1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Add a test for the (failure) case of client-level code calling the oo1.Stmt constructor directly.

FossilOrigin-Name: 6a37874db04f3b4842994ad17fc74cb6222f8ea0fa1315a23aff1ffa69bcd12a
This commit is contained in:
stephan
2022-12-24 13:46:27 +00:00
parent 4b4ae86445
commit 0db1c90137
4 changed files with 26 additions and 17 deletions

View File

@ -337,7 +337,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
*/
const Stmt = function(){
if(BindTypes!==arguments[2]){
toss3("Do not call the Stmt constructor directly. Use DB.prepare().");
toss3(capi.SQLITE_MISUSE, "Do not call the Stmt constructor directly. Use DB.prepare().");
}
this.db = arguments[0];
__ptrMap.set(this, arguments[1]);
@ -887,10 +887,11 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}
return arg.returnVal();
}/*exec()*/,
/**
Creates a new scalar UDF (User-Defined Function) which is
accessible via SQL code. This function may be called in any
of the following forms:
Creates a new UDF (User-Defined Function) which is accessible
via SQL code. This function may be called in any of the
following forms:
- (name, function)
- (name, function, optionsObject)
@ -906,10 +907,12 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
functions. Creating an aggregate or window function requires
the options-object form (see below for details).
UDFs cannot currently be removed from a DB handle after they're
added. More correctly, they can be removed as documented for
sqlite3_create_function_v2(), but doing so will "leak" the
JS-created WASM binding of those functions.
UDFs can be removed as documented for
sqlite3_create_function_v2() and
sqlite3_create_window_function(), but doing so will "leak" the
JS-created WASM binding of those functions (meaning that their
entries in the WASM indirect function table still
exist). Eliminating that potential leak is a pending TODO.
On success, returns this object. Throws on error.