On Tue, Jun 26, 2012 at 11:11 AM, Black, Michael (IS) <
michael.bla...@ngc.com> wrote:

> So...transaction is started at sqlite3_step and stays open until
> sqlite3_reset or sqlite3_finalize, right?
>
> sqlite3_close would do what if you didn't finalize?  Just a memory leak or
> worse?  Or would sqlite3_close return an error if there's an open
> transaction?
>

The first prepared statement is never reset or finalized.  It is merely
stepped once, and then the pointer to the prepared statement is overwritten
by a different pointer, thus leaking the perpared statement.

Because the prepared statement remains open, the sqlite3_close() call
fails.  The database connection remains open, with a half-run statement
holding open a read transaction.


>
>
>
>
>
> Michael D. Black
>
> Senior Scientist
>
> Advanced Analytics Directorate
>
> Advanced GEOINT Solutions Operating Unit
>
> Northrop Grumman Information Systems
>
> ________________________________
> From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org]
> on behalf of Richard Hipp [d...@sqlite.org]
> Sent: Tuesday, June 26, 2012 9:54 AM
> To: General Discussion of SQLite Database
> Subject: EXT :Re: [sqlite] access from 2 different programms to same
> sqlite3-db
>
> On Tue, Jun 26, 2012 at 10:51 AM, Black, Michael (IS) <
> michael.bla...@ngc.com> wrote:
>
> > Does that mean the "prepare" is wrapped inside a transaction?
> >
> >
> >
> > So you must finalize and re-prepare?
> >
>
> No.  It just means you need to run sqlite3_reset() on your prepared
> statements when you are finished with them, so that they will release the
> transaction they are holding.
>
>
>
>
> >
> >
> >
> > Michael D. Black
> >
> > Senior Scientist
> >
> > Advanced Analytics Directorate
> >
> > Advanced GEOINT Solutions Operating Unit
> >
> > Northrop Grumman Information Systems
> >
> > ________________________________
> > From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org]
> > on behalf of Richard Hipp [d...@sqlite.org]
> > Sent: Tuesday, June 26, 2012 9:49 AM
> > To: General Discussion of SQLite Database
> > Subject: EXT :Re: [sqlite] access from 2 different programms to same
> > sqlite3-db
> >
> > On Tue, Jun 26, 2012 at 10:46 AM, deltagam...@gmx.net
> > <deltagam...@gmx.net>wrote:
> >
> > > I have a c++ GUI application from where the db is read and the content
> is
> > > displayed in a Clistbox.
> > > Then I try to delete some rows from the sqlite3-db from the console.
> > > After rereading from within the GUI the deleted rows are still there.
> > >
> > > How is this possible ?
> > >
> >
> > The GUI is holding a read transaction open.  Hence it sees a consistent
> > snapshot of the database from the moment in time when the transaction was
> > started.  Subsequent writes to the database are ignored by the GUI until
> it
> > closes its current transaction and starts a new one.
> >
> >
> > >
> > > ______________________________**_________________
> > > sqlite-users mailing list
> > > sqlite-users@sqlite.org
> > > http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users<<
> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users%3C>
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users<<
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users%3C>
> >
> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users%3Chttp://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > >>
> > >
> >
> >
> >
> > --
> > D. Richard Hipp
> > d...@sqlite.org
> > _______________________________________________
> > 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
> >
>
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> _______________________________________________
> 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
>



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

Reply via email to