Re: [sqlite] Issue with 2 connections getting out of sync, sample code included

2013-06-25 Thread Richard Hipp
On Tue, Jun 25, 2013 at 9:40 PM, Jay A. Kreibich wrote: > On Tue, Jun 25, 2013 at 11:49:00PM +0100, Simon Slavin scratched on the > wall: > Your other point still stands, however... as soon as _step() returns > SQLITE_DONE, it is best to call _reset() before doing anything else. > _finalize

Re: [sqlite] Issue with 2 connections getting out of sync, sample code included

2013-06-25 Thread Jay A. Kreibich
On Tue, Jun 25, 2013 at 11:49:00PM +0100, Simon Slavin scratched on the wall: > > On 25 Jun 2013, at 11:45pm, Yuriy Stelmakh wrote: > > > I assumed that commit would take care of sync, but because my > > statement was never finalized/reset after last use, it didn't it > > seems.. > > You always

Re: [sqlite] Issue with 2 connections getting out of sync, sample code included

2013-06-25 Thread Yuriy Stelmakh
i'm caching the statements for later use, so i assume just doing reset is also ok? it seemed to work well. Again thank you for help, wasted a few days on this. Thanks, Yuriy On Jun 25, 2013, at 6:49 PM, Simon Slavin wrote: > > On 25 Jun 2013, at 11:45pm, Yuriy Stelmakh wrote: > >> I assumed

Re: [sqlite] Issue with 2 connections getting out of sync, sample code included

2013-06-25 Thread Simon Slavin
On 25 Jun 2013, at 11:45pm, Yuriy Stelmakh wrote: > I assumed that commit would take care of sync, but because my > statement was never finalized/reset after last use, it didn't it > seems.. You always need to _finalize(). Getting the data you asked for is not the end of the job. You have to

Re: [sqlite] Issue with 2 connections getting out of sync, sample code included

2013-06-25 Thread Yuriy Stelmakh
In the sample code I did not indeed. But in the actual code that i'm using, the prepared statement used was part of bulk insert surrounded by begin transaction/ commit transaction. I was reseting the stmt before it was used inside of transaction and not after, so it caused a problem. this is what

Re: [sqlite] Issue with 2 connections getting out of sync, sample code included

2013-06-25 Thread Richard Hipp
On Tue, Jun 25, 2013 at 6:32 PM, Yuriy Stelmakh wrote: > Thank you! that did the trick. Its interesting that even though you > can commit a transaction, the cache sync doesn't happen until you > finalize or reset all you statements. I wish this was documented > somewhere better! > No, you compl

Re: [sqlite] Issue with 2 connections getting out of sync, sample code included

2013-06-25 Thread Yuriy Stelmakh
Thank you! that did the trick. Its interesting that even though you can commit a transaction, the cache sync doesn't happen until you finalize or reset all you statements. I wish this was documented somewhere better! Thanks, Yuriy On Jun 25, 2013, at 2:19 PM, Richard Hipp wrote: > On Tue, Jun

Re: [sqlite] Issue with 2 connections getting out of sync, sample code included

2013-06-25 Thread Richard Hipp
On Tue, Jun 25, 2013 at 2:06 PM, Yuriy Stelmakh wrote: > Hi all, please help: very strange issue that should not be happening: > > > > 1. Have two connections to same database: _db1 and _db2. > > 2. Create table in _db1 > > 3. Run count * from _db2 -> returns 0 > > 4. In

Re: [sqlite] Issue with 2 connections getting out of sync, sample code included

2013-06-25 Thread Yuriy Stelmakh
This is on OSX and iOs 6. Sqlite versions tested were 3.7.13 & 3.7.17 Database file is stored on disk. Mac OSX journaled partion HFS+. Thanks, Yuriy On Jun 25, 2013, at 2:09 PM, Simon Slavin wrote: > > On 25 Jun 2013, at 7:06pm, Yuriy Stelmakh wrote: > >> Hi all, please help: very strange is

Re: [sqlite] Issue with 2 connections getting out of sync, sample code included

2013-06-25 Thread Simon Slavin
On 25 Jun 2013, at 7:06pm, Yuriy Stelmakh wrote: > Hi all, please help: very strange issue that should not be happening: Please verify: Which operating system are you using ? And which version ? Is the database file stored on the hard disk of the computer running the program ? What format

[sqlite] Issue with 2 connections getting out of sync, sample code included

2013-06-25 Thread Yuriy Stelmakh
Hi all, please help: very strange issue that should not be happening: 1. Have two connections to same database: _db1 and _db2. 2. Create table in _db1 3. Run count * from _db2 -> returns 0 4. Insert 1 row using _db1 –OK 5. Run select * from _db2 -> 0 rows retu