I'd also suggest option 3. And make sure you extract the file to a
folder that the user has permission to access.

Monday, October 25, 2010, 1:17:13 AM, you wrote:

KN> On Sun, 24 Oct 2010 20:57:15 +0800, Mohd Radzi Ibrahim
KN> <mra...@pc.jaring.my> wrote:

>> Hi,
>> I am planning to deploy my sqlite database together
>> with the exe file. Is there a way to open the sqlite
>> database with a file handle and starting offset of
>> the file, as read-only?
>>
>> Thank you for any suggestion.

KN> Not out of the box.
KN> I can think of three solutions:

KN> 1- Difficult: change the sqlite3 library in such a way so it
KN> uses the whole executable as the "first page" of the
KN> database

KN> 2- Easier: Store the output of the .dump command of the
KN> sqlite3 shell in a 'resource' in the executable and on
KN> execution of your program read the resource and load it in
KN> an in-memory database (filename ":memory:" ) by calling
KN> sqlite3_exec() on each of its statements.

KN> 3- Easier: Store the database file as-is in a resource in
KN> the executable and on execution of your program write it to
KN> disk and open it in the normal way. 

KN> HTH


-- 
Best regards,
  Neville Franks, http://www.surfulater.com http://blog.surfulater.com
 

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to