You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a bit of the fault of the sqlite3 lib since passing an empty string to prepare_v2() statement causes a misuse error (21) but doesn't set the error message which is SQLITE_OK message "not an error".
sqlite.h:
(#define SQLITE_MISUSE 21 /* Library used incorrectly */)
main.c:
static const char* const aMsg[] = {
/* SQLITE_OK */ "not an error",
...
/* SQLITE_MISUSE */ "bad parameter or other API misuse",
The wrapped sqlite3_exec() lib function which is a convenience function that does: prepare(), step() and finalize() doesn't return this error and returns an SQLITE_OK even when passed a string that only contains whitespace.
The impure nim library exec() doesn't call the wrapped sqlite3.exec() but instead makes it's own prepare(), step() and finalize() calls which means it does not inherit the same behavior as the wrapped sqlite3_exec().
Proposed solutions:
make db_sqlite.exec() act like sqlite3.exec()
return the proper error message for SQLITE_MISUSE: "bad parameter or other API misuse"
actually use the sqlite3.exec() to inherit the behavior.
Function
exec
indb_sqlite.nim
throws an unclear error when passing an empty query.Example
Current Output
Possible Solution
Let the empty string pass, or throw a more clear exception.
Additional Information
The text was updated successfully, but these errors were encountered: