diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 5 | ||||
-rw-r--r-- | src/test_func.c | 34 |
2 files changed, 11 insertions, 28 deletions
diff --git a/src/main.c b/src/main.c index 6626d152a..92fc864fa 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.548 2009/05/06 19:03:14 drh Exp $ +** $Id: main.c,v 1.549 2009/05/07 13:43:49 drh Exp $ */ #include "sqliteInt.h" @@ -931,8 +931,7 @@ int sqlite3CreateFunc( (!xFunc && (!xFinal && xStep)) || (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG) || (255<(nName = sqlite3Strlen30( zFunctionName))) ){ - sqlite3Error(db, SQLITE_ERROR, "bad parameters"); - return SQLITE_ERROR; + return SQLITE_MISUSE; } #ifndef SQLITE_OMIT_UTF16 diff --git a/src/test_func.c b/src/test_func.c index 275359e38..c8990cc83 100644 --- a/src/test_func.c +++ b/src/test_func.c @@ -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 |