You are not logged in.
Pages: 1
While debugging my application I found an error in this function:
3972 for i := 0 to n-1 do
3973 if Fields[i].DBType=ftUnknown then
3974 Types[ i ] := ftInt64 // <=== was Types[ n ] ...
3975 else
3976 Types[ i ] := Fields[i].DBType; // <=== was Types[ n ] ...
3977 Properties.GetTableNames(Tables);
The error meant that all field types were being left as ftUnknown and not being processed
I still have an error in my application when processing BLOBS...
I am importing a database from file into an in-memory database (opened with ':memory:' filename).
All records and fields are being imported correctly EXCEPT for blobs.
The blobs are saved using the SaveToRawByteString into a field defined as fCustomPicture: TSQLRawBlob;
I can view the blob using an external SQLite3 db management tool, so I know it is saved correctly.
When the NewTableFromRows function processes that field it thinks the column type is ftUTF8 and I end up with content in that field like "PNG
" which is not recognised as a blob and causes errors when trying to retrieve it.
Should the field type be ftBlob and there is an error in the routine? Or am I doing something wrong?
My code is copied from sample12:
if aSourceFileName <> '' then
begin
ExcludeTypes := [];
SourceProp := TSQLDBSQLite3ConnectionProperties.Create(StringToUTF8(aSourceFileName),'','','');
TargetProp := TSQLDBSQLite3ConnectionProperties.Create(TSQLRestServerDB(aDestDB).DB);
try
TargetConn := TargetProp.MainConnection as TSQLDBSQLite3Connection;
TargetConn.Connect;
try
TargetConn.DB.ExecuteAll('PRAGMA journal_mode=MEMORY;PRAGMA journal_size_limit=16777216;'+'PRAGMA synchronous=OFF;');
TSQLRestClientURI(SourceProp.MainConnection).ForceBlobTransfert := true;
TSQLRestClientURI(TargetConn).ForceBlobTransfert := true;
SourceProp.GetTableNames(Tables);
TableList := TStringList.Create;
try
TableList.CommaText := UTF8ToString(RawUTF8ArrayToCSV(Tables,#13#10));
for i := 0 to TableList.Count - 1 do
begin
Application.ProcessMessages;
SQL := format('SELECT * FROM %s',[TableList.Strings[i]]);
rows := SourceProp.NewThreadSafeStatement;
try
rows.Prepare(SQL,true);
rows.ExecutePrepared;
result := TargetConn.NewTableFromRows(S2U(TableList.Strings[i]),Rows,true);
I'm using mORMot as an application file (like a document in a word-processor) and would also like to have the functionallity of copying a database between disk and memory. Could you please let us know if you get this working.
Pages: 1