Hello SQLite list,

we have noticed that the sqlite shell is unable to report errors that happen 
within exec_prepared_stmt, because that function has no return value and is 
thus unable to bubble issues up. For example, if sqlite3_step should fail for 
some reason, this should be shown to the user, for example in the call to 
exec_prepared_stmt from shell_exec. 

We propose to add a return code to exec_prepared_stmt like so:

static int exec_prepared_stmt(
 ShellState *pArg,                                /* Pointer to ShellState */
 sqlite3_stmt *pStmt                              /* Statment to run */
){
 int rc;
        /* ... */
return rc;
}

then, in shell_exec, we could say something like

 rc = exec_prepared_stmt(pArg, pStmt);
                if (rc != SQLITE_OK) {
                        if (pzErrMsg) {
                                *pzErrMsg = save_err_msg(db);
                        }
                }

This way, if an error occurs during execution, this will be displayed to the 
user.

Best from Amsterdam,

Hannes

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

Reply via email to