GOT IT!! Thanks for responding!

Its embarrassing but hopefully others can learn from my mistakes.

It turns out I was not ALWAYS calling finalize. One little "return nil;" snuck into a case statement (see below). Bad form!

sqlite_prepare (...);
...
switch (type) {
case SQLITE_INTEGER:
value = [NSNumber numberWithInt:(sqlite3_column_int (stmt, 0))];
break;
case SQLITE_FLOAT:
value = [NSNumber numberWithDouble:(sqlite3_column_double (stmt, 0))];
break;
case SQLITE_TEXT:
value = [NSString stringWithUTF8String:(sqlite3_column_text (stmt, 0))];
break;
case SQLITE_BLOB:
case SQLITE_NULL:
return nil;
default:
value = [super valueForKey:key];
break;
}
...
sqlite3_finalize(...);



Thanks again for your pointers; they did help me focus in on the problem.


On Jan 30, 2005, at 9:06 PM, Ulrik Petersen wrote:

Jason Jobe wrote:

I did find some where I wasn't doing that but I think I got them all.

Sometimes I use sqlite3_exec; other times, when I need to get the rows I use sqlite3_step (with the finalize).

Then perhaps you are calling sqlite3_exec in between an sqlite3_step and its corresponding sqlite3_finalize?


HTH

Ulrik P.

PS: Please use bottom-posting, i.e., writing replies after replies, not before. It helps when one wants to follow the thread of the conversation.


Should I wrap either or both of these in a transaction?

I've also tried it backed by a file as well as the in-memory version; same results.

On Jan 30, 2005, at 8:10 PM, D. Richard Hipp wrote:

On Sun, 2005-01-30 at 19:56 -0500, Jason Jobe wrote:

Hey out there.

I'm having a dickens of a time trying to debug a locking issue. I
thought I was doing something simple enough; accessing a database from
within one process with no threading.


2005-01-30 19:28:10.736[5716] sqlite:ERROR database table is locked

Trying again I get

2005-01-30 19:28:10.737[5716] sqlite:ERROR cannot commit transaction -
SQL statements in progress


I can't figure why the db thinks it should be locked.

Any pointers would be most appreciated.


Did you remember to sqlite3_finalize() statements that you were finished with? -- D. Richard Hipp <[EMAIL PROTECTED]>


- jason

[EMAIL PROTECTED]



- jason

[EMAIL PROTECTED]



Reply via email to