#1 Re: mORMot 1 » Bizarre SQLite error - database disk image is malformed » 2011-12-28 16:06:47

Never mind, figured it out. Windows (in it's supreme knowledge) had created a file in the VirtualStore directory. That is the db file that was being accessed.  Deleted that file and all is ok now.

For any others that may run into this issue, I am writing my data to the commonappdata directory (C:\ProgramData on Win 7). Windows will redirect commonappdata to the C:\users\loggedinusername\AppData\Local\VirtualStore\ProgramData directory if the rights to the actual directory desired are not sufficient. Once the file is there, even if the actual directory rights are sufficient, Windows will still look in the virtual directory first for the file.

#2 mORMot 1 » Bizarre SQLite error - database disk image is malformed » 2011-12-28 15:05:01

Gene Lamb
Replies: 2

I hope someone can shed some light on this as it's driving me nuts. I'm opening an existing db file and attempting to get the table names like this.

  Props := TSQLDBSQLite3ConnectionProperties.Create(dbFile,'','','');
  Props.GetTableNames(tableRA);

I built a sample program to test with. Works fine. I'm using the same unit with this code in both an application and a service to open/access the db. It works fine in the service. In the application when I call the GetTableNames, I get a "database disk image is malformed" (error 11) in the sqlite3_prepare_v2 routine. I've double and triple (and ...) that the database name is correct (even copy/pasted from the working test program). Are there any known conflicts with any other libraries that I may be using or can anyone shed any insight on this?

I doubt it's relevant but I'm using Delphi 2010 on Win 7 64 for testing.

#3 Re: mORMot 1 » Two questions Busy_Timeout and column types » 2011-11-26 15:08:51

Thank you for your response. For your answer to my second question, I've tried and when using Execute to get an ISQLRows result, ColumnType() does not return the proper column type. As already mentioned, for DateTime fields it returns ftUTF8 and if there is a null in the field it just returns ftNull. I am trying to write a generic routine to grab the results of a query and put them into a memory table (kbmmemtable, which I can then hook directly to screen fields). I need to know the proper column types to do this (even if DateTime, TimeStamp or field value is Null). To use the ColumnDateTime() or other column type methods, I need to know beforehand what the column type is. Is there another way to get query results that will return the proper native column type information?

#4 mORMot 1 » Two questions Busy_Timeout and column types » 2011-11-23 18:29:36

Gene Lamb
Replies: 3

Please pardon my ignorance. I would like to use your software to access an existing SQLite database. I'm not using the ORM features as this would require a total rewrite of my code. I just want to use your framework to replace Zeos.

If I use the TSQLDBConnectionProperties to connect to the db, I can easily access data with an ISQLDBRows field but can't see any way to set the Busy_Timeout.

If I connect with the TSQLDataBase, I can set the Busy_Timeout but can't see any easy way to get rows of data.

I have existing programs (both an application and a service accessing the same database) that I'm plugging this into (replacing Zeos) but am not sure of the best way to do this. What can you suggest? Is there a way to use the TSQLDBConnectionProperties and set the busy_timeout? Or is there an easy way to get row data using just the TSQLDataBase?

I have another question. When getting ISQLDBRows data from a query, there doesn't seem to be any way to determine the datatypes of each column. The ColumnType function just makes a guess returning an ftNull for an empty field and ftUTF8 for a datetime field. I can use the GetFields or GetFieldDefinitions to get the datatypes from a table but this won't work for a query.

Thanks to anyone for their help.

Board footer

Powered by FluxBB