Thank you! I renamed and included prepare function for UTF16. I would like to ask you about a feature request in sqlite I have. I have similar query object inspired by your uniquery but field maping supports types: [WIDE]TEXT, [WIDE][VAR]CHAR, INTEGER, SMALLINT, LARGEINT | BIGINT, REAL, FLOAT, NUMERIC, DECIMAL, CURRENCY, DATE, TIME, DATETIME, TIMESTAMP, BOOLEAN, BLOB, ZBLOB (ZLib compressed). For expression fields (count(*), avg(), sum()) I have added ability to read type from field alias (count(*) "CNT:integer") so I could map field in query. If I forget alias, I map fields with no affinity to variants. I wonder to ask drh if he can improve sqlite to return affinity (not just NONE) for expression fields. Best Regards, R.Antloga----- Original Message ----- From: "Delphi Inspiration" <delphi@xxxxxxxx>
To: <yunqa@xxxxxxxxxxxxx> Sent: 4. junij 2009 18:23 Subject: [yunqa.de] Re: SQLite metadata
At 09:45 04.06.2009, Radovan Antloga wrote:You would probably add this to DISQLite3 to in next release. I have done it already so I created new function:function sqlite3_prepare(Db: sqlite3; const zSQL: PAnsiChar; nByte: integer;ppStmt: sqlite3_stmt_ptr; const pzTail: PPUtf8Char): Integer; var Retries: integer; begin Retries := 0; repeat Inc(Retries); Result := sqlite3_prepare_v2(DB, zSQL, nByte, ppStmt, pzTail); until (Retries > 1) or (Result <> SQLITE_SCHEMA); end; and replaced all sqlite3_prepare_v2 with new sqlite3_prepare.Yes, but I can not redefine sqlite3_prepare (and similar functions) because this would break the original SQLite API.Instead, I will add two new functions (see below) to DISQLite3Api.pas and call them throughout the DISQLite3 library wherever appropriate. They wrap around the recommended sqlite3_prepare_v2(). As the name suggests, they should be seen as "internal" functions only which could change without notice.Ralf //------------------------------------------------------------------------------ function sqlite3_prepare_internal( DB: sqlite3; // Database handle. const zSql: PUtf8Char; // SQL statement, UTF-8 encoded. nByte: Integer; // Maximum length of zSql in bytes. ppStmt: sqlite3_stmt_ptr; // OUT: Statement handle. const pzTail: PPUtf8Char // OUT: Pointer to unused portion of zSql. ): Integer; var Retries: Cardinal; begin Retries := 0; repeat Inc(Retries); Result := sqlite3_prepare_v2(DB, zSql, nByte, ppStmt, pzTail); until (Result <> SQLITE_SCHEMA) or (Retries > 1); end; //------------------------------------------------------------------------------ {$IFNDEF SQLITE_OMIT_UTF16} function sqlite3_prepare16_internal( DB: sqlite3; // Database handle. const zSql: PWideChar; // SQL statement, UTF-16 encoded. nByte: Integer; // Maximum length of zSql in bytes. ppStmt: sqlite3_stmt_ptr; // OUT: Statement handle. const pzTail: PPWideChar // OUT: Pointer to unused portion of zSql. ): Integer; var Retries: Cardinal; begin Retries := 0; repeat Inc(Retries); Result := sqlite3_prepare16_v2(DB, zSql, nByte, ppStmt, pzTail); until (Result <> SQLITE_SCHEMA) or (Retries > 1); end;
_______________________________________________ Delphi Inspiration mailing list yunqa@xxxxxxxxxxxxx //www.freelists.org/list/yunqa