Closed Bug 291991 Opened 20 years ago Closed 16 years ago

update storage to check if a statement needs to be recreated, to avoid SQLITE_SCHEMA

Categories

(Core :: SQLite and Embedded Database Bindings, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: vlad, Unassigned)

Details

Attachments

(1 file)

Patch attached; new sqlite3 function should be going into core SQLite at some
point as well.
Comment on attachment 181899 [details] [diff] [review]
storage-stmt-fix-0.patch

>+    if (mExecuting == PR_FALSE) {

(Checking against == PR_FALSE specifically seems awkward, but if that's
the style you prefer to |if (!mExecuting)|, it's your code!)

>         } else if (srv == SQLITE_ERROR) {
>             // so we may end up with a SQLITE_SCHEMA only after
>-            // we finalize, because SQLite's error reporting story
>+            // we reset, because SQLite's error reporting story
>             // sucks.
>             if (mExecuting == PR_TRUE) {
>+                PR_LOG(gStorageLog, PR_LOG_ERROR, ("SQLITE_SCHEMA after mExecuting was true!"));
>+
>                 mExecuting = PR_FALSE;
>                 return NS_ERROR_FAILURE;

It doesn't look like this block has to do with SQLITE_SCHEMA (the
one before it would be entered instead), so the comment and PR_LOG
message seem misleading.  Should those be SQLITE_ERROR instead?

>+nsresult
>+mozStorageStatement::Recreate()
>+{
>+    nsresult rv;
>+    sqlite3_stmt *savedStmt = mDBStatement;
>+    mDBStatement = nsnull;
>+    rv = Initialize(mDBConnection, mStatementString);
>+    NS_ENSURE_SUCCESS(rv, rv);
>+
>+    // copy over the param bindings
>+    sqlite3_transfer_bindings(savedStmt, mDBStatement);

If this fails, do we want to just keep going? I think we'd want to
return an error to the caller, which would trickle out for the
mozStorage consumer to handle.

Does one of those cases (the VDBE_MAGIC_RUN test?) catch us if
the database has been DETACHed?

r=shaver with error checking of transfer_bindings, at least, and
probably the SCHEMA->ERROR changes.
Attachment #181899 - Flags: first-review?(shaver) → first-review+
Is this the same as bug 291335? Will that be fixed with this?
Assignee: vladimir → nobody
QA Contact: nobody → storage
Turns out we don't have to worry about this anymore
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
Product: Toolkit → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: