Index: src/main.c ================================================================== --- src/main.c +++ src/main.c @@ -711,38 +711,10 @@ } rc = sqlite4ApiExit(db, rc); sqlite4_mutex_leave(db->mutex); return rc; } - -#ifndef SQLITE4_OMIT_UTF16 -int sqlite4_create_function16( - sqlite4 *db, - const void *zFunctionName, - int nArg, - int enc, - void *p, - void (*xFunc)(sqlite4_context*,int,sqlite4_value**), - void (*xStep)(sqlite4_context*,int,sqlite4_value**), - void (*xFinal)(sqlite4_context*), - void (*xDestroy)(void *) -){ - int rc; - char *zFunc8; - sqlite4_mutex_enter(db->mutex); - assert( !db->mallocFailed ); - zFunc8 = sqlite4Utf16to8(db, zFunctionName, -1, SQLITE4_UTF16NATIVE); - rc = createFunctionDestructor( - db, zFunc8, nArg, enc, p, xFunc, xStep, xFinal, xDestroy - ); - sqlite4DbFree(db, zFunc8); - rc = sqlite4ApiExit(db, rc); - sqlite4_mutex_leave(db->mutex); - return rc; -} -#endif - /* ** Declare that a function has been overloaded by a virtual table. ** ** If the function already exists as a regular global function, then @@ -870,57 +842,10 @@ } sqlite4_mutex_leave(db->mutex); return z; } -#ifndef SQLITE4_OMIT_UTF16 -/* -** Return UTF-16 encoded English language explanation of the most recent -** error. -*/ -const void *sqlite4_errmsg16(sqlite4 *db){ - static const u16 outOfMem[] = { - 'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0 - }; - static const u16 misuse[] = { - 'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ', - 'r', 'o', 'u', 't', 'i', 'n', 'e', ' ', - 'c', 'a', 'l', 'l', 'e', 'd', ' ', - 'o', 'u', 't', ' ', - 'o', 'f', ' ', - 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 0 - }; - - const void *z; - if( !db ){ - return (void *)outOfMem; - } - if( !sqlite4SafetyCheckSickOrOk(db) ){ - return (void *)misuse; - } - sqlite4_mutex_enter(db->mutex); - if( db->mallocFailed ){ - z = (void *)outOfMem; - }else{ - z = sqlite4_value_text16(db->pErr, 0); - if( z==0 ){ - sqlite4ValueSetStr(db->pErr, -1, sqlite4ErrStr(db->errCode), - SQLITE4_UTF8, SQLITE4_STATIC, 0); - z = sqlite4_value_text16(db->pErr, 0); - } - /* A malloc() may have failed within the call to sqlite4_value_text16() - ** above. If this is the case, then the db->mallocFailed flag needs to - ** be cleared before returning. Do this directly, instead of via - ** sqlite4ApiExit(), to avoid setting the database handle error message. - */ - db->mallocFailed = 0; - } - sqlite4_mutex_leave(db->mutex); - return z; -} -#endif /* SQLITE4_OMIT_UTF16 */ - /* ** Return the most recent error code generated by an SQLite routine. If NULL is ** passed to this function, we assume a malloc() failed during sqlite4_open(). */ int sqlite4_errcode(sqlite4 *db){ @@ -1549,29 +1474,10 @@ db->pCollNeededArg = pCollNeededArg; sqlite4_mutex_leave(db->mutex); return SQLITE4_OK; } -#ifndef SQLITE4_OMIT_UTF16 -/* -** Register a collation sequence factory callback with the database handle -** db. Replace any previously installed collation sequence factory. -*/ -int sqlite4_collation_needed16( - sqlite4 *db, - void(*xCollNeeded16)(void*,sqlite4*,int eTextRep,const void*), - void *pCollNeededArg -){ - sqlite4_mutex_enter(db->mutex); - db->xCollNeeded = 0; - db->xCollNeeded16 = xCollNeeded16; - db->pCollNeededArg = pCollNeededArg; - sqlite4_mutex_leave(db->mutex); - return SQLITE4_OK; -} -#endif /* SQLITE4_OMIT_UTF16 */ - /* ** Test to see whether or not the database connection is currently within ** an explicitly started transaction (BEGIN/COMMIT block). Return non-zero ** if it is and FALSE otherwise. Explicit transactions are opened by a ** BEGIN statement and concluded by the next COMMIT or ROLLBACK. Index: src/sqlite.h.in ================================================================== --- src/sqlite.h.in +++ src/sqlite.h.in @@ -968,42 +968,29 @@ void sqlite4_interrupt(sqlite4*); /* ** CAPIREF: Determine If An SQL Statement Is Complete ** -** These routines are useful during command-line input to determine if the -** currently entered text seems to form a complete SQL statement or -** if additional input is needed before sending the text into -** SQLite for parsing. ^These routines return 1 if the input string -** appears to be a complete SQL statement. ^A statement is judged to be -** complete if it ends with a semicolon token and is not a prefix of a -** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within -** string literals or quoted identifier names or comments are not -** independent tokens (they are part of the token in which they are -** embedded) and thus do not count as a statement terminator. ^Whitespace -** and comments that follow the final semicolon are ignored. -** -** ^These routines return 0 if the statement is incomplete. ^If a -** memory allocation fails, then SQLITE4_NOMEM is returned. -** -** ^These routines do not parse the SQL statements thus -** will not detect syntactically incorrect SQL. -** -** ^(If SQLite has not been initialized using [sqlite4_initialize()] prior -** to invoking sqlite4_complete16() then sqlite4_initialize() is invoked -** automatically by sqlite4_complete16(). If that initialization fails, -** then the return value from sqlite4_complete16() will be non-zero -** regardless of whether or not the input SQL is complete.)^ -** -** The input to [sqlite4_complete()] must be a zero-terminated -** UTF-8 string. -** -** The input to [sqlite4_complete16()] must be a zero-terminated -** UTF-16 string in native byte order. +** This routine is useful when processing command-line input to determine +** if the currently entered text appears to form a complete SQL statement +** or if additional input is needed before sending the text into +** SQLite for parsing. ^This routine returns 1 if the input string +** appears to be a complete SQL statement, or 0 otherwise. ^A statement +** is judged to be complete if it ends with a semicolon token and is not +** a prefix of a well-formed CREATE TRIGGER statement. ^Semicolons that +** are embedded within string literals or quoted identifier names or +** comments are not independent tokens (they are part of the token in which +** they are embedded) and thus do not count as a statement terminator. +** ^Whitespace and comments that follow the final semicolon are ignored. +** +** ^This routine does not parse the SQL statements thus will not detect +** syntactically incorrect SQL. +** +** The argument passed to [sqlite4_complete()] must be a pointer to a +** zero-terminated UTF-8 string. */ int sqlite4_complete(const char *sql); -int sqlite4_complete16(const void *sql); /* ** CAPIREF: Formatted String Printing Functions ** @@ -1449,16 +1436,16 @@ ** [extended result code] for the most recent failed sqlite4_* API call ** associated with a [database connection]. If a prior API call failed ** but the most recent API call succeeded, the return value from ** sqlite4_errcode() is undefined. ** -** ^The sqlite4_errmsg() and sqlite4_errmsg16() return English-language -** text that describes the error, as either UTF-8 or UTF-16 respectively. -** ^(Memory to hold the error message string is managed internally. -** The application does not need to worry about freeing the result. -** However, the error string might be overwritten or deallocated by -** subsequent calls to other SQLite interface functions.)^ +** ^The sqlite4_errmsg() routine returns English-language text that +** describes the error, as a UTF-8 encoded string. ^(Memory to hold the +** error message string is managed internally. The application does not +** need to worry about freeing the result. However, the error string +** might be overwritten or deallocated by subsequent calls to other +** SQLite interface functions.)^ ** ** When the serialized [threading mode] is in use, it might be the ** case that a second error occurs on a separate thread in between ** the time of the first error and the call to these interfaces. ** When that happens, the second error will be reported since these @@ -1466,17 +1453,16 @@ ** this, each thread can obtain exclusive use of the [database connection] D ** by invoking [sqlite4_mutex_enter]([sqlite4_db_mutex](D)) before beginning ** to use D and invoking [sqlite4_mutex_leave]([sqlite4_db_mutex](D)) after ** all calls to the interfaces listed here are completed. ** -** If an interface fails with SQLITE4_MISUSE, that means the interface -** was invoked incorrectly by the application. In that case, the +** If an SQLite API call fails with SQLITE4_MISUSE, that means the +** interface was invoked incorrectly by the application. In that case, the ** error code and message may or may not be set. */ int sqlite4_errcode(sqlite4 *db); const char *sqlite4_errmsg(sqlite4*); -const void *sqlite4_errmsg16(sqlite4*); /* ** CAPIREF: SQL Statement Object ** KEYWORDS: {prepared statement} {prepared statements} ** @@ -1905,51 +1891,40 @@ int sqlite4_column_count(sqlite4_stmt *pStmt); /* ** CAPIREF: Column Names In A Result Set ** -** ^These routines return the name assigned to a particular column -** in the result set of a [SELECT] statement. ^The sqlite4_column_name() -** interface returns a pointer to a zero-terminated UTF-8 string -** and sqlite4_column_name16() returns a pointer to a zero-terminated -** UTF-16 string. ^The first parameter is the [prepared statement] -** that implements the [SELECT] statement. ^The second parameter is the -** column number. ^The leftmost column is number 0. -** -** ^The returned string pointer is valid until either the [prepared statement] -** is destroyed by [sqlite4_finalize()] or until the statement is automatically -** reprepared by the first call to [sqlite4_step()] for a particular run -** or until the next call to -** sqlite4_column_name() or sqlite4_column_name16() on the same column. -** -** ^If sqlite4_malloc() fails during the processing of either routine -** (for example during a conversion from UTF-8 to UTF-16) then a -** NULL pointer is returned. +** ^This routine returns the name assigned to a particular column +** in the result set of a [SELECT] statement. ^The first parameter is the +** [prepared statement] that implements the [SELECT] statement. ^The second +** parameter is the column number. ^The leftmost column is number 0. ** ** ^The name of a result column is the value of the "AS" clause for ** that column, if there is an AS clause. If there is no AS clause ** then the name of the column is unspecified and may change from ** one release of SQLite to the next. +** +** ^The returned string pointer is valid until either the [prepared statement] +** is destroyed by [sqlite4_finalize()] or until the statement is automatically +** reprepared by the first call to [sqlite4_step()] for a particular run. +** +** ^If a memory allocation fails during the processing of this routine +** then a NULL pointer is returned. */ const char *sqlite4_column_name(sqlite4_stmt*, int N); -const void *sqlite4_column_name16(sqlite4_stmt*, int N); /* ** CAPIREF: Source Of Data In A Query Result ** ** ^These routines provide a means to determine the database, table, and ** table column that is the origin of a particular result column in -** [SELECT] statement. -** ^The name of the database or table or column can be returned as -** either a UTF-8 or UTF-16 string. ^The _database_ routines return -** the database name, the _table_ routines return the table name, and -** the origin_ routines return the column name. +** [SELECT] statement. Specifically, the sqlite4_column_database_name() +** routine returns the database name, the _table_name() routine returns +** the table name and _origin_name() returns the column name. ** ^The returned string is valid until the [prepared statement] is destroyed ** using [sqlite4_finalize()] or until the statement is automatically -** reprepared by the first call to [sqlite4_step()] for a particular run -** or until the same information is requested -** again in a different encoding. +** reprepared by the first call to [sqlite4_step()] for a particular run. ** ** ^The names returned are the original un-aliased names of the ** database, table, and column. ** ** ^The first argument to these interfaces is a [prepared statement]. @@ -1961,13 +1936,10 @@ ** subquery and is not a column value, then all of these functions return ** NULL. ^These routine might also return NULL if a memory allocation error ** occurs. ^Otherwise, they return the name of the attached database, table, ** or column that query result column was extracted from. ** -** ^As with all other SQLite APIs, those whose names end with "16" return -** UTF-16 encoded strings and the other functions return UTF-8. -** ** ^These APIs are only available if the library was compiled with the ** [SQLITE4_ENABLE_COLUMN_METADATA] C-preprocessor symbol. ** ** If two or more threads call one or more of these routines against the same ** prepared statement and column at the same time then the results are @@ -1977,15 +1949,12 @@ ** [sqlite4_column_database_name | column metadata interfaces] ** for the same [prepared statement] and result column ** at the same time then the results are undefined. */ const char *sqlite4_column_database_name(sqlite4_stmt*,int); -const void *sqlite4_column_database_name16(sqlite4_stmt*,int); const char *sqlite4_column_table_name(sqlite4_stmt*,int); -const void *sqlite4_column_table_name16(sqlite4_stmt*,int); const char *sqlite4_column_origin_name(sqlite4_stmt*,int); -const void *sqlite4_column_origin_name16(sqlite4_stmt*,int); /* ** CAPIREF: Declared Datatype Of A Query Result ** ** ^(The first parameter is a [prepared statement]. @@ -2013,11 +1982,10 @@ ** strongly typed, but the typing is dynamic not static. ^Type ** is associated with individual values, not with the containers ** used to hold those values. */ const char *sqlite4_column_decltype(sqlite4_stmt*,int); -const void *sqlite4_column_decltype16(sqlite4_stmt*,int); /* ** CAPIREF: Evaluate An SQL Statement ** ** After a [prepared statement] has been prepared using [sqlite4_prepare()], @@ -2293,30 +2261,26 @@ */ int sqlite4_reset(sqlite4_stmt *pStmt); /* ** CAPIREF: Create Or Redefine SQL Functions -** KEYWORDS: {function creation routines} +** KEYWORDS: {function creation routine} ** KEYWORDS: {application-defined SQL function} ** KEYWORDS: {application-defined SQL functions} ** -** ^These functions (collectively known as "function creation routines") -** are used to add new SQL scalar or aggregate functions. The only -** difference between the two routines is the text encoding expected for -** the second parameter (the name of the function being created). +** ^This function is used to add new SQL scalar or aggregate functions. ** ** ^The first parameter is the [database connection] to which the SQL ** function is to be added. ^If an application uses more than one database ** connection then application-defined SQL functions must be added ** to each database connection separately. ** ** ^The second parameter is the name of the SQL function to be created or ** redefined. ^The length of the name is limited to 255 bytes in a UTF-8 ** representation, exclusive of the zero-terminator. ^Note that the name -** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes. -** ^Any attempt to create a function with a longer name -** will result in [SQLITE4_MISUSE] being returned. +** length limit is in bytes, not characters. ^Any attempt to create a +** function with a longer name will result in [SQLITE4_MISUSE] being returned. ** ** ^The third parameter (nArg) is the number of arguments that the SQL ** function or aggregate takes. ^If this parameter is -1, then the SQL ** function or aggregate may take any number of arguments between 0 and ** the limit set by [sqlite4_limit]([SQLITE4_LIMIT_FUNCTION_ARG]). If @@ -2378,21 +2342,10 @@ */ int sqlite4_create_function( sqlite4 *db, const char *zFunctionName, int nArg, - int eTextRep, - void *pApp, - void (*xFunc)(sqlite4_context*,int,sqlite4_value**), - void (*xStep)(sqlite4_context*,int,sqlite4_value**), - void (*xFinal)(sqlite4_context*), - void(*xDestroy)(void*) -); -int sqlite4_create_function16( - sqlite4 *db, - const void *zFunctionName, - int nArg, int eTextRep, void *pApp, void (*xFunc)(sqlite4_context*,int,sqlite4_value**), void (*xStep)(sqlite4_context*,int,sqlite4_value**), void (*xFinal)(sqlite4_context*), @@ -2823,16 +2776,10 @@ ** ^To avoid having to register all collation sequences before a database ** can be used, a single callback function may be registered with the ** [database connection] to be invoked whenever an undefined collation ** sequence is required. ** -** ^If the function is registered using the sqlite4_collation_needed() API, -** then it is passed the names of undefined collation sequences as strings -** encoded in UTF-8. ^If sqlite4_collation_needed16() is used, -** the names are passed as UTF-16 in machine native byte order. -** ^A call to either function replaces the existing collation-needed callback. -** ** ^(When the callback is invoked, the first argument passed is a copy ** of the second argument to sqlite4_collation_needed() or ** sqlite4_collation_needed16(). The second argument is the database ** connection. The third argument is one of [SQLITE4_UTF8], [SQLITE4_UTF16BE], ** or [SQLITE4_UTF16LE], indicating the most desirable form of the collation @@ -2845,15 +2792,10 @@ int sqlite4_collation_needed( sqlite4*, void(*)(void*,sqlite4*,int eTextRep,const char*), void* ); -int sqlite4_collation_needed16( - sqlite4*, - void(*)(void*,sqlite4*,int eTextRep,const void*), - void* -); /* ** CAPIREF: Suspend Execution For A Short Time ** ** The sqlite4_sleep() function causes the current thread to suspend execution Index: src/vdbeapi.c ================================================================== --- src/vdbeapi.c +++ src/vdbeapi.c @@ -848,16 +848,10 @@ */ const char *sqlite4_column_name(sqlite4_stmt *pStmt, int N){ return columnName( pStmt, N, (const void*(*)(Mem*, int*))sqlite4_value_text, COLNAME_NAME); } -#ifndef SQLITE4_OMIT_UTF16 -const void *sqlite4_column_name16(sqlite4_stmt *pStmt, int N){ - return columnName( - pStmt, N, (const void*(*)(Mem*, int*))sqlite4_value_text16, COLNAME_NAME); -} -#endif /* ** Constraint: If you have ENABLE_COLUMN_METADATA then you must ** not define OMIT_DECLTYPE. */ @@ -873,16 +867,10 @@ */ const char *sqlite4_column_decltype(sqlite4_stmt *pStmt, int N){ return columnName(pStmt, N, (const void*(*)(Mem*, int*))sqlite4_value_text, COLNAME_DECLTYPE); } -#ifndef SQLITE4_OMIT_UTF16 -const void *sqlite4_column_decltype16(sqlite4_stmt *pStmt, int N){ - return columnName(pStmt, - N, (const void*(*)(Mem*, int*))sqlite4_value_text16, COLNAME_DECLTYPE); -} -#endif /* SQLITE4_OMIT_UTF16 */ #endif /* SQLITE4_OMIT_DECLTYPE */ #ifdef SQLITE4_ENABLE_COLUMN_METADATA /* ** Return the name of the database from which a result column derives. @@ -891,16 +879,10 @@ */ const char *sqlite4_column_database_name(sqlite4_stmt *pStmt, int N){ return columnName(pStmt, N, (const void*(*)(Mem*, int*))sqlite4_value_text, COLNAME_DATABASE); } -#ifndef SQLITE4_OMIT_UTF16 -const void *sqlite4_column_database_name16(sqlite4_stmt *pStmt, int N){ - return columnName(pStmt, - N, (const void*(*)(Mem*, int*))sqlite4_value_text16, COLNAME_DATABASE); -} -#endif /* SQLITE4_OMIT_UTF16 */ /* ** Return the name of the table from which a result column derives. ** NULL is returned if the result column is an expression or constant or ** anything else which is not an unabiguous reference to a database column. @@ -907,16 +889,10 @@ */ const char *sqlite4_column_table_name(sqlite4_stmt *pStmt, int N){ return columnName(pStmt, N, (const void*(*)(Mem*, int*))sqlite4_value_text, COLNAME_TABLE); } -#ifndef SQLITE4_OMIT_UTF16 -const void *sqlite4_column_table_name16(sqlite4_stmt *pStmt, int N){ - return columnName(pStmt, - N, (const void*(*)(Mem*, int*))sqlite4_value_text16, COLNAME_TABLE); -} -#endif /* SQLITE4_OMIT_UTF16 */ /* ** Return the name of the table column from which a result column derives. ** NULL is returned if the result column is an expression or constant or ** anything else which is not an unabiguous reference to a database column. @@ -923,16 +899,10 @@ */ const char *sqlite4_column_origin_name(sqlite4_stmt *pStmt, int N){ return columnName(pStmt, N, (const void*(*)(Mem*, int*))sqlite4_value_text, COLNAME_COLUMN); } -#ifndef SQLITE4_OMIT_UTF16 -const void *sqlite4_column_origin_name16(sqlite4_stmt *pStmt, int N){ - return columnName(pStmt, - N, (const void*(*)(Mem*, int*))sqlite4_value_text16, COLNAME_COLUMN); -} -#endif /* SQLITE4_OMIT_UTF16 */ #endif /* SQLITE4_ENABLE_COLUMN_METADATA */ /******************************* sqlite4_bind_ *************************** ** Index: test/bind.test ================================================================== --- test/bind.test +++ test/bind.test @@ -375,15 +375,13 @@ catch { sqlite4_bind_null $VM 0 } } {1} do_test bind-8.2 { sqlite4_errmsg $DB } {bind or column index out of range} -ifcapable {utf16} { - do_test bind-8.3 { - encoding convertfrom unicode [sqlite4_errmsg16 $DB] - } {bind or column index out of range} -} +do_test bind-8.3 { + sqlite4_errmsg $DB +} {bind or column index out of range} do_test bind-8.4 { sqlite4_bind_null $VM 1 sqlite4_errmsg $DB } {not an error} do_test bind-8.5 { @@ -390,15 +388,13 @@ catch { sqlite4_bind_null $VM 4 } } {1} do_test bind-8.6 { sqlite4_errmsg $DB } {bind or column index out of range} -ifcapable {utf16} { - do_test bind-8.7 { - encoding convertfrom unicode [sqlite4_errmsg16 $DB] - } {bind or column index out of range} -} +do_test bind-8.7 { + sqlite4_errmsg $DB +} {bind or column index out of range} do_test bind-8.8 { catch { sqlite4_bind_blob $VM 0 "abc" 3 } } {1} do_test bind-8.9 { Index: test/test_func.c ================================================================== --- test/test_func.c +++ test/test_func.c @@ -157,23 +157,10 @@ void sqlite4EndBenignMalloc(void); #else #define sqlite4BeginBenignMalloc() #define sqlite4EndBenignMalloc() #endif -static void test_agg_errmsg16_step(sqlite4_context *a, int b,sqlite4_value **c){ -} -static void test_agg_errmsg16_final(sqlite4_context *ctx){ -#ifndef SQLITE4_OMIT_UTF16 - const void *z; - sqlite4 * db = sqlite4_context_db_handle(ctx); - sqlite4_aggregate_context(ctx, 2048); - sqlite4BeginBenignMalloc(); - z = sqlite4_errmsg16(db); - sqlite4EndBenignMalloc(); - sqlite4_result_text16(ctx, z, -1, SQLITE4_TRANSIENT, 0); -#endif -} /* ** Routines for testing the sqlite4_auxdata_fetch() and sqlite4_auxdata_store() ** interface. ** @@ -466,13 +453,10 @@ for(i=0; imutex); - pVal = sqlite4ValueNew(db); - sqlite4ValueSetStr(pVal, -1, "x_sqlite_exec", SQLITE4_UTF8, - SQLITE4_STATIC, 0); - zUtf16 = sqlite4ValueText(pVal, SQLITE4_UTF16NATIVE); - if( db->mallocFailed ){ - rc = SQLITE4_NOMEM; - }else{ - rc = sqlite4_create_function16(db, zUtf16, - 1, SQLITE4_UTF16, db, sqlite4ExecFunc, 0, 0, 0); - } - sqlite4ValueFree(pVal); - sqlite4_mutex_leave(db->mutex); - } -#endif + rc = sqlite4_create_function( + db, "x_sqlite_exec", 1, SQLITE4_UTF16, db, sqlite4ExecFunc, 0, 0, 0 + ); + } if( sqlite4TestErrCode(interp, db, rc) ) return TCL_ERROR; Tcl_SetResult(interp, (char *)t1ErrorName(rc), 0); return TCL_OK; } @@ -2104,22 +2088,17 @@ */ static void test_collate_needed_cb( void *pCtx, sqlite4 *db, int eTextRep, - const void *pName + const char *zName ){ int enc = ENC(db); - int i; - char *z; - for(z = (char*)pName, i=0; *z || z[1]; z++){ - if( *z ) zNeededCollation[i++] = *z; - } - zNeededCollation[i] = 0; + strcpy(zNeededCollation, zName); sqlite4_create_collation( - db, "test_collate", ENC(db), SQLITE4_INT_TO_PTR(enc), test_collate_func, - 0, 0); + db, "test_collate", enc, SQLITE4_INT_TO_PTR(enc), test_collate_func, 0, 0 + ); } /* ** Usage: add_test_collate_needed DB */ @@ -2132,12 +2111,11 @@ sqlite4 *db; int rc; if( objc!=2 ) goto bad_args; if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; - rc = sqlite4_collation_needed16(db, test_collate_needed_cb, 0); - zNeededCollation[0] = 0; + rc = sqlite4_collation_needed(db, test_collate_needed_cb, 0); if( sqlite4TestErrCode(interp, db, rc) ) return TCL_ERROR; return TCL_OK; bad_args: Tcl_WrongNumArgs(interp, 1, objv, "DB"); @@ -2882,47 +2860,10 @@ zErr = sqlite4_errmsg(db); Tcl_SetObjResult(interp, Tcl_NewStringObj(zErr, -1)); return TCL_OK; } -/* -** Usage: test_errmsg16 DB -** -** Returns the UTF-16 representation of the error message string for the -** most recent sqlite4_* API call. This is a byte array object at the TCL -** level, and it includes the 0x00 0x00 terminator bytes at the end of the -** UTF-16 string. -*/ -static int test_errmsg16( - void * clientData, - Tcl_Interp *interp, - int objc, - Tcl_Obj *CONST objv[] -){ -#ifndef SQLITE4_OMIT_UTF16 - sqlite4 *db; - const void *zErr; - const char *z; - int bytes = 0; - - if( objc!=2 ){ - Tcl_AppendResult(interp, "wrong # args: should be \"", - Tcl_GetString(objv[0]), " DB", 0); - return TCL_ERROR; - } - if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; - - zErr = sqlite4_errmsg16(db); - if( zErr ){ - z = zErr; - for(bytes=0; z[bytes] || z[bytes+1]; bytes+=2){} - } - Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(zErr, bytes)); -#endif /* SQLITE4_OMIT_UTF16 */ - return TCL_OK; -} - /* ** Usage: sqlite4_prepare DB sql bytes ?tailvar? ** ** Compile up to bytes of the supplied SQL string using ** database handle . The parameter is the name of a global @@ -3365,53 +3306,10 @@ if( Tcl_GetIntFromObj(interp, objv[2], &col) ) return TCL_ERROR; zRet = xFunc(pStmt, col, 0); if( zRet ){ Tcl_SetResult(interp, (char *)zRet, 0); } - return TCL_OK; -} - -/* -** Usage: sqlite4_column_text STMT column -** -** Usage: sqlite4_column_decltype STMT column -** -** Usage: sqlite4_column_name STMT column -*/ -static int test_stmt_utf16( - void * clientData, /* Pointer to SQLite API function to be invoked */ - Tcl_Interp *interp, - int objc, - Tcl_Obj *CONST objv[] -){ -#ifndef SQLITE4_OMIT_UTF16 - sqlite4_stmt *pStmt; - int col; - Tcl_Obj *pRet; - const void *zName16; - const void *(*xFunc)(sqlite4_stmt*, int); - - xFunc = (const void *(*)(sqlite4_stmt*, int))clientData; - if( objc!=3 ){ - Tcl_AppendResult(interp, "wrong # args: should be \"", - Tcl_GetString(objv[0]), " STMT column", 0); - return TCL_ERROR; - } - - if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR; - if( Tcl_GetIntFromObj(interp, objv[2], &col) ) return TCL_ERROR; - - zName16 = xFunc(pStmt, col); - if( zName16 ){ - int n; - const char *z = zName16; - for(n=0; z[n] || z[n+1]; n+=2){} - pRet = Tcl_NewByteArrayObj(zName16, n+2); - Tcl_SetObjResult(interp, pRet); - } -#endif /* SQLITE4_OMIT_UTF16 */ - return TCL_OK; } /* ** Usage: sqlite4_column_int STMT column @@ -4224,11 +4122,10 @@ { "sqlite4_bind_parameter_index", test_bind_parameter_index, 0}, { "sqlite4_clear_bindings", test_clear_bindings, 0}, { "sqlite4_sleep", test_sleep, 0}, { "sqlite4_errcode", test_errcode ,0 }, { "sqlite4_errmsg", test_errmsg ,0 }, - { "sqlite4_errmsg16", test_errmsg16 ,0 }, { "sqlite4_open", test_open ,0 }, { "sqlite4_open_v2", test_open_v2 ,0 }, { "sqlite4_prepare", test_prepare ,0 }, { "sqlite4_prepare_tkt3134", test_prepare_tkt3134, 0}, @@ -4271,22 +4168,11 @@ { "sqlite4_column_table_name",test_stmt_utf8,(void*)sqlite4_column_table_name}, { "sqlite4_column_origin_name",test_stmt_utf8,(void*)sqlite4_column_origin_name}, #endif #ifndef SQLITE4_OMIT_UTF16 - { "sqlite4_column_text16", test_stmt_utf16, (void*)sqlite4_column_text16}, - { "sqlite4_column_name16", test_stmt_utf16, (void*)sqlite4_column_name16}, { "add_alignment_test_collations", add_alignment_test_collations, 0 }, -#ifndef SQLITE4_OMIT_DECLTYPE - { "sqlite4_column_decltype16",test_stmt_utf16,(void*)sqlite4_column_decltype16}, -#endif -#ifdef SQLITE4_ENABLE_COLUMN_METADATA -{"sqlite4_column_database_name16", - test_stmt_utf16, sqlite4_column_database_name16}, -{"sqlite4_column_table_name16", test_stmt_utf16, (void*)sqlite4_column_table_name16}, -{"sqlite4_column_origin_name16", test_stmt_utf16, (void*)sqlite4_column_origin_name16}, -#endif #endif { "sqlite4_create_collation", test_create_collation, 0 }, { "working_64bit_int", working_64bit_int, 0 }, { "sqlite4_create_function_v2", test_create_function_v2, 0 }, Index: test/test_utf.c ================================================================== --- test/test_utf.c +++ test/test_utf.c @@ -89,10 +89,11 @@ val.enc = SQLITE4_UTF8; for(i=0; i