aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/SQLite/SQLite3.pas
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-10-27 15:52:30 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-10-27 15:52:30 +0000
commitf209316474cc121b51455770df6c24b9c64796a9 (patch)
tree150a982d7f1dc84d27590d9956366872a326cae1 /src/lib/SQLite/SQLite3.pas
parentd6770dd47dcb871f021868dec2b333527ffb8ee8 (diff)
downloadusdx-f209316474cc121b51455770df6c24b9c64796a9.tar.gz
usdx-f209316474cc121b51455770df6c24b9c64796a9.tar.xz
usdx-f209316474cc121b51455770df6c24b9c64796a9.zip
- Results of UTF8Encode() in TSQLiteDatabase.BindData() are stored in a local AnsiString variable instead of directly converting it to PChar
old: PAnsiChar(UTF8Encode(WideString(Bindings[I].VPWideChar))); new: AnsiStr := UTF8Encode(WideString(Bindings[I].VPWideChar)); DataPtr := PAnsiChar(AnsiStr); Although Delphi and FPC create a temporary AnsiString on the stack which is valid until the end of the method, it is more safe not to rely on this behavior. Maybe in some future version of Delphi/FPC the reference count might be decremented and invalidated after converting the temporary AnsiString to a PChar and the PChar will point to invalid data. In contrast to this, the scope of AnsiStr is obvious. - {$IFDEF WIN32} -> {$IFDEF MSWINDOWS} - {$WARNINGS OFF/ON} removed - var-parameters of SQLite3_Open/SQLite3_Prepare/SQLite3_Prepare_v2 declared as out git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1480 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/lib/SQLite/SQLite3.pas')
-rw-r--r--src/lib/SQLite/SQLite3.pas6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/SQLite/SQLite3.pas b/src/lib/SQLite/SQLite3.pas
index 6120e013..9537606c 100644
--- a/src/lib/SQLite/SQLite3.pas
+++ b/src/lib/SQLite/SQLite3.pas
@@ -97,7 +97,7 @@ type
Buf2Len: integer; Buf2: pointer): integer; cdecl;
-function SQLite3_Open(filename: PAnsiChar; var db: TSQLiteDB): integer; cdecl; external SQLiteDLL name 'sqlite3_open';
+function SQLite3_Open(filename: PAnsiChar; out db: TSQLiteDB): integer; cdecl; external SQLiteDLL name 'sqlite3_open';
function SQLite3_Close(db: TSQLiteDB): integer; cdecl; external SQLiteDLL name 'sqlite3_close';
function SQLite3_Exec(db: TSQLiteDB; SQLStatement: PAnsiChar; CallbackPtr: TSQLiteExecCallback; UserData: Pointer; var ErrMsg: PAnsiChar): integer; cdecl; external SQLiteDLL name 'sqlite3_exec';
function SQLite3_Version(): PAnsiChar; cdecl; external SQLiteDLL name 'sqlite3_libversion';
@@ -113,8 +113,8 @@ procedure SQLite3_BusyHandler(db: TSQLiteDB; CallbackPtr: TSQLiteBusyHandlerCall
procedure SQLite3_BusyTimeout(db: TSQLiteDB; TimeOut: integer); cdecl; external SQLiteDLL name 'sqlite3_busy_timeout';
function SQLite3_Changes(db: TSQLiteDB): integer; cdecl; external SQLiteDLL name 'sqlite3_changes';
function SQLite3_TotalChanges(db: TSQLiteDB): integer; cdecl; external SQLiteDLL name 'sqlite3_total_changes';
-function SQLite3_Prepare(db: TSQLiteDB; SQLStatement: PAnsiChar; nBytes: integer; var hStmt: TSqliteStmt; var pzTail: PAnsiChar): integer; cdecl; external SQLiteDLL name 'sqlite3_prepare';
-function SQLite3_Prepare_v2(db: TSQLiteDB; SQLStatement: PAnsiChar; nBytes: integer; var hStmt: TSqliteStmt; var pzTail: PAnsiChar): integer; cdecl; external SQLiteDLL name 'sqlite3_prepare_v2';
+function SQLite3_Prepare(db: TSQLiteDB; SQLStatement: PAnsiChar; nBytes: integer; out hStmt: TSqliteStmt; out pzTail: PAnsiChar): integer; cdecl; external SQLiteDLL name 'sqlite3_prepare';
+function SQLite3_Prepare_v2(db: TSQLiteDB; SQLStatement: PAnsiChar; nBytes: integer; out hStmt: TSqliteStmt; out pzTail: PAnsiChar): integer; cdecl; external SQLiteDLL name 'sqlite3_prepare_v2';
function SQLite3_ColumnCount(hStmt: TSqliteStmt): integer; cdecl; external SQLiteDLL name 'sqlite3_column_count';
function SQLite3_ColumnName(hStmt: TSqliteStmt; ColNum: integer): PAnsiChar; cdecl; external SQLiteDLL name 'sqlite3_column_name';
function SQLite3_ColumnDeclType(hStmt: TSqliteStmt; ColNum: integer): PAnsiChar; cdecl; external SQLiteDLL name 'sqlite3_column_decltype';