> 1) What else can prevent incremental data to be written to the hard drive?

Besides all that I mentioned only explicit BEGIN statement can open
transaction and thus prevent anything after that from being written to
disk immediately until COMMIT is executed. What you can do now is
first of all use sqlite3_get_autocommit function
(http://www.sqlite.org/c3ref/get_autocommit.html) after closing blob
handle to check that transaction should be automatically committed.
But I'm not sure that it will return 0 if some SELECT statement is in
progress. To check that you can call sqlite3_next_stmt(db, NULL)
(http://www.sqlite.org/c3ref/next_stmt.html) to obtain pointer to the
statement that is still open (if you finalize all your statements then
this function should return NULL). If function returns some statement
you can use sqlite3_sql (http://www.sqlite.org/c3ref/sql.html) to see
what statement is at fault.

> 2) Is there a way to force a write to the hard drive?

Nothing but COMMIT statement (or auto-commit) can force new and
changed data to be written on disk. BTW, to check that transaction
wasn't committed yet you can connect to the database with external
command while application is working and try to update or insert
something. If it fails with message "The database file is locked" then
application didn't commit transaction. If update succeeds and you
still cannot see changes made by application then you have some
problems with file system, but I hope you have not.


Pavel

On Thu, Feb 4, 2010 at 1:49 PM, a1rex <a1rex2...@yahoo.com> wrote:
> Pavel,
> Thank you very much for your email. I greatly appreciate
> your knowledge on the internal workings of Sqlite and your kindness to share 
> it.
>
>>All incremental writing is committed (and thus is written to disk)
>>when blob handle is closed. And even when you close the handle
>>transaction is committed only when there's no more blob handles or
>>SELECT statements open at the moment on the same connection.
>
> I would never guess that SELECT dependency, never!
>
> I checked my code. But as far as I can tell I have all SELECT statements are 
> finalized
> by sqlite3_finalize() and not held by sqlite3_reset(). I have only one blob 
> handle and I am opening and
> closing it when I SELECT another record from the table.
>
> Incremental changes are done for sure, I can come back to the
> modified record read it within program and new data is in. But when an 
> external
> program reads the same database it does not see the changes till my program 
> exits.
>
> 1) What else can prevent incremental data to be written to the hard drive?
>
> 2) Is there a way to force a write to the hard drive?
>
> Thank you for reading. Any comment greatly appreciated!
>
> Regards,
> Samuel
>
>
>      __________________________________________________________________
> Be smarter than spam. See how smart SpamGuard is at giving junk email the 
> boot with the All-new Yahoo! Mail.  Click on Options in Mail and switch to 
> New Mail today or register for free at http://mail.yahoo.ca
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to