Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
FPC
FPC
FPC Source
Commits
89866cd1
Commit
89866cd1
authored
Jan 21, 2012
by
Marco Van de Voort
Browse files
* LoadExtension, patch by BigChimp, Mantis
#20640
git-svn-id: trunk@20146 -
parent
eedb5c89
Changes
1
Hide whitespace changes
Inline
Side-by-side
packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp
View file @
89866cd1
...
...
@@ -94,6 +94,7 @@ TSQLite3Connection = class(TSQLConnection)
constructor
Create
(
AOwner
:
TComponent
);
override
;
function
GetInsertID
:
int64
;
procedure
GetFieldNames
(
const
TableName
:
string
;
List
:
TStrings
);
override
;
procedure
LoadExtension
(
LibraryFile
:
string
);
published
property
Options
:
TSqliteOptions
read
FOptions
write
SetOptions
;
end
;
...
...
@@ -910,6 +911,31 @@ procedure TSQLite3Connection.GetFieldNames(const TableName: string;
GetDBInfo
(
stColumns
,
TableName
,
'name'
,
List
);
end
;
procedure
Tsqlite3connection
.
LoadExtension
(
Libraryfile
:
String
);
var
LoadResult
:
integer
;
begin
CheckConnected
;
//Apparently we need a connection before we can load extensions.
LoadResult
:=
SQLITE_ERROR
;
//Default to failed
try
LoadResult
:=
sqlite3_enable_load_extension
(
fhandle
,
1
);
//Make sure we are allowed to load
if
LoadResult
=
SQLITE_OK
then
begin
LoadResult
:=
sqlite3_load_extension
(
fhandle
,
PChar
(
LibraryFile
),
nil
,
nil
);
//Actually load extension
if
LoadResult
=
SQLITE_ERROR
then
begin
DatabaseError
(
'LoadExtension: failed to load SQLite extension (SQLite returned an error while loading).'
,
Self
);
end
;
end
else
begin
DatabaseError
(
'LoadExtension: failed to load SQLite extension (SQLite returned an error while enabling extensions).'
,
Self
);
end
;
except
DatabaseError
(
'LoadExtension: failed to load SQLite extension.'
,
Self
)
end
;
end
;
procedure
TSQLite3Connection
.
setoptions
(
const
avalue
:
tsqliteoptions
);
begin
if
avalue
<>
foptions
then
...
...
FPC Admin account
@fpc_admin
mentioned in issue
#20640 (closed)
·
Aug 05, 2021
mentioned in issue
#20640 (closed)
mentioned in issue #20640
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment