Re: [sqlite] Is sqlite_master special? (Or, why SQLITE_MISUSE when preparing?)

2009-02-27 Thread Lukhnos D. Liu
On Feb 28, 2009, at 4:27 AM, D. Richard Hipp wrote: > This is usually an indication that you passed in a database connection > pointer to sqlite3_prepare() that had previously been closed. For > example: > sqlite3_close(db); > sqlite3_prepare(db, zSql, -1, &pStmt, 0); > SQLite does *not*

Re: [sqlite] Is sqlite_master special? (Or, why SQLITE_MISUSE when preparing?)

2009-02-27 Thread D. Richard Hipp
On Feb 27, 2009, at 2:30 PM, Lukhnos D. Liu wrote: > > Some casual search in SQLite's source code revealed that it was about > some safety check mechanism (sqlite->magic), but it still didn't tell > me when and what constitues a misuse. > This is usually an indication that you passed in a databas

Re: [sqlite] Is sqlite_master special? (Or, why SQLITE_MISUSE when preparing?)

2009-02-27 Thread Lukhnos D. Liu
On Feb 28, 2009, at 3:50 AM, Igor Tandetnik wrote: > All statements prepared with sqlite3_prepare[16] are invalidated > whenever you change database schema in any way. Next time you use > such a > statement, you get SQLITE_MISUSE error and you have to finalize and > re-prepare it. > Use the newer

Re: [sqlite] Is sqlite_master special? (Or, why SQLITE_MISUSE when preparing?)

2009-02-27 Thread Igor Tandetnik
"Lukhnos D. Liu" wrote in message news:24584eea-b339-408d-805b-9616cc7d9...@lithoglyph.com > Here's the interesting part. When my app failed, the preparation > always returned SQLITE_MISUSE. That was a very curious error. I > searched the documents, and it wasn't entirely clear to me why one > wou

[sqlite] Is sqlite_master special? (Or, why SQLITE_MISUSE when preparing?)

2009-02-27 Thread Lukhnos D. Liu
Hi all, Lately I ran into an interesting problem. The problem is solved, but I'm really curious about the inner works of the sqlite_master table. I have an iPhone application. In the previous version, there was a very slight chance (about 1%) that a query would fail. The user might be wonde