Topic: enconding and sqlitepass clob information.
Currently, database file encoding and page size is not set correctly at creating database file except Kexi format.
unction TSqlitePassDatabase.CreateDatabase(DbName: String; DbType: TSqlitePassDatabaseType;
Encoding: TSqlitePassEncoding = UTF_8; PageSize: TSqlitePassPageSize = 4096;
AutoVacuum: TSqlitePassAutoVacuumType = 0): Boolean;
...
ExecSQL('PRAGMA encoding = ' + EncodingStr+';');
ExecSQL('PRAGMA page_size = ' + IntToStr(PageSize)+';');
ExecSQL('PRAGMA Auto_Vacuum = ' + IntToStr(AutoVacuum)+';');
{ Creates system tables for Kexi }
if DbType = dbtKexi then
begin
ExecSQL(KexiDb_CreateSQLStmt);
ExecSQL(KexiParts_CreateSQLStmt);
ExecSQL(KexiObjects_CreateSQLStmt);
ExecSQL(KexiObjectData_CreateSQLStmt);
ExecSQL(KexiFields_CreateSQLStmt);
ExecSQL(KexiBlobs_CreateSQLStmt);
ExecSQL('INSERT INTO "kexi__db" (db_property, db_value) VALUES ("kexidb_major_ver", "1");');
ExecSQL('INSERT INTO "kexi__db" (db_property, db_value) VALUES ("kexidb_minor_ver", "8");');
ExecSQL('INSERT INTO "kexi__db" (db_property, db_value) VALUES ("kexiproject_major_ver", "1");');
ExecSQL('INSERT INTO "kexi__db" (db_property, db_value) VALUES ("kexiproject_minor_ver", "0");');
ExecSQL('INSERT INTO "kexi__db" (db_property, db_value) VALUES ("project_caption", "");');
ExecSQL('INSERT INTO "kexi__db" (db_property, db_value) VALUES ("project_desc", "");');
end else
// for other format
ExecSQL('CREATE TABLE "sqlitepass__dummy" (dummy TEXT(1));');
...
Last sql statment is correctly set encoding and pagesize of database file except kexi format.
At different encoding, 'SQLitePass__DbSettings' table's information is not read correctly in utf-16 encodings.
procedure TSqlitePassRecordset.GetRecords(Sql: String);
...
ColumnStr : string;
ColumnSize : integer;
begin
...
{ No fields are defined, so we store all the values as string }
else begin
ColumnSize := SqliteDbv3_column_Bytes(PSqliteData,ColumnIndex);
SetLength(ColumnStr,ColumnSize);
system.Move(pansichar(SqliteDbv3_column_Blob(PSqliteData,ColumnIndex))^,ColumnStr[1],ColumnSize);
AddString(Buffer, ColumnStr);
SetFieldNullValue(RecordIndex, ColumnIndex, False);
Inc(Buffer, SizeOf(Integer));
end;
end; { for }
...
And sqlite3_open function protorype declaration is invalid.
SqliteDbv3_open: function(dbname: PChar; var db:pointer):integer; cdecl;
...
procedure TSqlitePassEngine.OpenDatabase(FullName, LibraryFile: String);
begin
FLibraryLoaded := LoadSqliteLibrary(LibraryFile);
CheckResult(SqliteDbv3_Open(Pchar(FullName), FConnectionHandle));
end;
...
Sorry for short explanation.
I'm not English well