mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Change the sqlite3_create_function() family of routines to return
SQLITE_MISUSE instead of SQLITE_ERROR if their parameters are incorrect. (CVS 6617) FossilOrigin-Name: 866f13e28c6fdb98947e1c7a89b7855bb5bbdb96
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
** Code for testing all sorts of SQLite interfaces. This code
|
||||
** implements new SQL functions used by the test scripts.
|
||||
**
|
||||
** $Id: test_func.c,v 1.14 2009/03/19 18:51:07 danielk1977 Exp $
|
||||
** $Id: test_func.c,v 1.15 2009/05/07 13:43:49 drh Exp $
|
||||
*/
|
||||
#include "sqlite3.h"
|
||||
#include "tcl.h"
|
||||
@@ -393,39 +393,25 @@ static int abuse_create_function(
|
||||
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
|
||||
|
||||
rc = sqlite3_create_function(db, "tx", 1, SQLITE_UTF8, 0, tStep,tStep,tFinal);
|
||||
if( rc!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( sqlite3_errcode(db)!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( strcmp(sqlite3_errmsg(db), "bad parameters")!=0 ) goto abuse_err;
|
||||
if( rc!=SQLITE_MISUSE ) goto abuse_err;
|
||||
|
||||
rc = sqlite3_create_function(db, "tx", 1, SQLITE_UTF8, 0, tStep, tStep, 0);
|
||||
if( rc!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( sqlite3_errcode(db)!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( strcmp(sqlite3_errmsg(db), "bad parameters")!=0 ) goto abuse_err;
|
||||
if( rc!=SQLITE_MISUSE ) goto abuse_err;
|
||||
|
||||
rc = sqlite3_create_function(db, "tx", 1, SQLITE_UTF8, 0, tStep, 0, tFinal);
|
||||
if( rc!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( sqlite3_errcode(db)!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( strcmp(sqlite3_errmsg(db), "bad parameters")!=0 ) goto abuse_err;
|
||||
if( rc!=SQLITE_MISUSE) goto abuse_err;
|
||||
|
||||
rc = sqlite3_create_function(db, "tx", 1, SQLITE_UTF8, 0, 0, 0, tFinal);
|
||||
if( rc!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( sqlite3_errcode(db)!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( strcmp(sqlite3_errmsg(db), "bad parameters")!=0 ) goto abuse_err;
|
||||
if( rc!=SQLITE_MISUSE ) goto abuse_err;
|
||||
|
||||
rc = sqlite3_create_function(db, "tx", 1, SQLITE_UTF8, 0, 0, tStep, 0);
|
||||
if( rc!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( sqlite3_errcode(db)!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( strcmp(sqlite3_errmsg(db), "bad parameters")!=0 ) goto abuse_err;
|
||||
if( rc!=SQLITE_MISUSE ) goto abuse_err;
|
||||
|
||||
rc = sqlite3_create_function(db, "tx", -2, SQLITE_UTF8, 0, tStep, 0, 0);
|
||||
if( rc!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( sqlite3_errcode(db)!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( strcmp(sqlite3_errmsg(db), "bad parameters")!=0 ) goto abuse_err;
|
||||
if( rc!=SQLITE_MISUSE ) goto abuse_err;
|
||||
|
||||
rc = sqlite3_create_function(db, "tx", 128, SQLITE_UTF8, 0, tStep, 0, 0);
|
||||
if( rc!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( sqlite3_errcode(db)!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( strcmp(sqlite3_errmsg(db), "bad parameters")!=0 ) goto abuse_err;
|
||||
if( rc!=SQLITE_MISUSE ) goto abuse_err;
|
||||
|
||||
rc = sqlite3_create_function(db, "funcxx"
|
||||
"_123456789_123456789_123456789_123456789_123456789"
|
||||
@@ -434,9 +420,7 @@ static int abuse_create_function(
|
||||
"_123456789_123456789_123456789_123456789_123456789"
|
||||
"_123456789_123456789_123456789_123456789_123456789",
|
||||
1, SQLITE_UTF8, 0, tStep, 0, 0);
|
||||
if( rc!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( sqlite3_errcode(db)!=SQLITE_ERROR ) goto abuse_err;
|
||||
if( strcmp(sqlite3_errmsg(db), "bad parameters")!=0 ) goto abuse_err;
|
||||
if( rc!=SQLITE_MISUSE ) goto abuse_err;
|
||||
|
||||
/* This last function registration should actually work. Generate
|
||||
** a no-op function (that always returns NULL) and which has the
|
||||
|
||||
Reference in New Issue
Block a user