On 27 Apr 2013, at 8:34am, Igor Korot <ikoro...@gmail.com> wrote:

> In the other area of the program I have a transaction that does 5 or 6
> inserts and no selects.
> This transaction works fine as I just verified.
> 
> Now in the failing case the flow goes like this:
> 
> First the program updates couple of tables, then it inserts this particular
> record.
> This algorithm is going thru the loop of the players vector.
> I'm using the same handle and the same statement object. Only different
> queries.
> 
> After every query I'm calling sqlite3_finalize() to free the memory and the
> statement object.
> 
> Am I doing it wrong?

See section 3.0 in

<http://www.sqlite.org/cintro.html>

If you're not sure whether you're doing it right or not, stop doing it.  Do a 
_prepare() _step() _finalize() on each command and see if that fixes your 
problem.  Once you know what fixes it you'll know what to do in your final code.

You are not doing sufficient exploration yourself to tell us what's wrong.  You 
are combining both a complicated INSERT and a complicated SELECT and we have no 
way to tell which one isn't doing what you expected.

Create a new table with just one integer column.  Write code in your language to

Count the rows in your table.
Insert a new row in that.
Count the rows again.

Do it first with _exec instead of _prepare() _step() _finalize().  If your code 
doesn't work you now have something incredibly simple to debug.  If it does 
work, gradually add the complications of your original example back in until it 
stops working.  At that point you will have identified what it is you're doing 
that isn't working properly.

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

Reply via email to