Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Remove legacy API functions: complete16(), errmsg16(), column_name16(), column_database_name16(), column_table_name16(), column_origin_name16(), column_decltype16(), create_function16() and collation_needed16(). |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c7c533dddcf39d9a47276892573032cb |
User & Date: | dan 2013-06-11 16:48:56.720 |
Context
2013-06-11
| ||
17:27 | Add a note to www/porting.wiki describing the changes to utf-16 support. check-in: 5cd50e225c user: dan tags: trunk | |
16:48 | Remove legacy API functions: complete16(), errmsg16(), column_name16(), column_database_name16(), column_table_name16(), column_origin_name16(), column_decltype16(), create_function16() and collation_needed16(). check-in: c7c533dddc user: dan tags: trunk | |
15:18 | Add tests and minor fixes for the sqlite4_translate() API. check-in: 211c1baef7 user: dan tags: trunk | |
Changes
Changes to src/main.c.
︙ | ︙ | |||
709 710 711 712 713 714 715 | FuncDef *p = sqlite4FindFunction(db, zFunc, -1, n, enc, 0); p->bMatchinfo = 1; } rc = sqlite4ApiExit(db, rc); sqlite4_mutex_leave(db->mutex); return rc; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | FuncDef *p = sqlite4FindFunction(db, zFunc, -1, n, enc, 0); p->bMatchinfo = 1; } rc = sqlite4ApiExit(db, rc); sqlite4_mutex_leave(db->mutex); return rc; } /* ** Declare that a function has been overloaded by a virtual table. ** ** If the function already exists as a regular global function, then ** this routine is a no-op. If the function does not exist, then create ** a new one that always throws a run-time error. |
︙ | ︙ | |||
868 869 870 871 872 873 874 | z = sqlite4ErrStr(db->errCode); } } sqlite4_mutex_leave(db->mutex); return z; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | z = sqlite4ErrStr(db->errCode); } } sqlite4_mutex_leave(db->mutex); return z; } /* ** 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){ if( db && !sqlite4SafetyCheckSickOrOk(db) ){ return SQLITE4_MISUSE_BKPT; |
︙ | ︙ | |||
1547 1548 1549 1550 1551 1552 1553 | db->xCollNeeded = xCollNeeded; db->xCollNeeded16 = 0; db->pCollNeededArg = pCollNeededArg; sqlite4_mutex_leave(db->mutex); return SQLITE4_OK; } | < < < < < < < < < < < < < < < < < < < | 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 | db->xCollNeeded = xCollNeeded; db->xCollNeeded16 = 0; db->pCollNeededArg = pCollNeededArg; sqlite4_mutex_leave(db->mutex); return SQLITE4_OK; } /* ** 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. */ int sqlite4_db_transaction_status(sqlite4 *db){ |
︙ | ︙ |
Changes to src/sqlite.h.in.
︙ | ︙ | |||
966 967 968 969 970 971 972 | ** is running then bad things will likely happen. */ void sqlite4_interrupt(sqlite4*); /* ** CAPIREF: Determine If An SQL Statement Is Complete ** | | | | | | | | | | | | < < < | | < < < < < < | | < < < < | 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 | ** is running then bad things will likely happen. */ void sqlite4_interrupt(sqlite4*); /* ** CAPIREF: Determine If An SQL Statement Is Complete ** ** 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); /* ** CAPIREF: Formatted String Printing Functions ** ** These routines are work-alikes of the "printf()" family of functions ** from the standard C library. |
︙ | ︙ | |||
1447 1448 1449 1450 1451 1452 1453 | ** ** ^The sqlite4_errcode() interface returns the numeric ** [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. ** | | | | | | | | | < | 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 | ** ** ^The sqlite4_errcode() interface returns the numeric ** [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() 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 ** interfaces always report the most recent result. To avoid ** 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 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*); /* ** CAPIREF: SQL Statement Object ** KEYWORDS: {prepared statement} {prepared statements} ** ** An instance of this object represents a single SQL statement. ** This object is variously known as a "prepared statement" or a |
︙ | ︙ | |||
1903 1904 1905 1906 1907 1908 1909 | ** See also: [sqlite4_data_count()] */ int sqlite4_column_count(sqlite4_stmt *pStmt); /* ** CAPIREF: Column Names In A Result Set ** | | | < < < | | < < < < < < < < < < > > > > > > > < | < < | | | < < < < < < < < | 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 | ** See also: [sqlite4_data_count()] */ int sqlite4_column_count(sqlite4_stmt *pStmt); /* ** CAPIREF: Column Names In A Result Set ** ** ^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); /* ** 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. 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. ** ** ^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]. ** ^These functions return information about the Nth result column returned by ** the statement, where N is the second function argument. ** ^The left-most column is column 0 for these routines. ** ** ^If the Nth column returned by the statement is an expression or ** 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. ** ** ^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 ** undefined. ** ** If two or more threads call one or more ** [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 char *sqlite4_column_table_name(sqlite4_stmt*,int); const char *sqlite4_column_origin_name(sqlite4_stmt*,int); /* ** CAPIREF: Declared Datatype Of A Query Result ** ** ^(The first parameter is a [prepared statement]. ** If this statement is a [SELECT] statement and the Nth column of the ** returned result set of that [SELECT] is a table column (not an |
︙ | ︙ | |||
2011 2012 2013 2014 2015 2016 2017 | ** is declared to contain a particular type does not mean that the ** data stored in that column is of the declared type. SQLite is ** 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); | < | 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 | ** is declared to contain a particular type does not mean that the ** data stored in that column is of the declared type. SQLite is ** 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); /* ** CAPIREF: Evaluate An SQL Statement ** ** After a [prepared statement] has been prepared using [sqlite4_prepare()], ** this function must be called one or more times to evaluate the statement. ** |
︙ | ︙ | |||
2291 2292 2293 2294 2295 2296 2297 | ** ^The [sqlite4_reset(S)] interface does not change the values ** of any [sqlite4_bind_blob|bindings] on the [prepared statement] S. */ int sqlite4_reset(sqlite4_stmt *pStmt); /* ** CAPIREF: Create Or Redefine SQL Functions | | < | < < < | | | 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 | ** ^The [sqlite4_reset(S)] interface does not change the values ** of any [sqlite4_bind_blob|bindings] on the [prepared statement] S. */ int sqlite4_reset(sqlite4_stmt *pStmt); /* ** CAPIREF: Create Or Redefine SQL Functions ** KEYWORDS: {function creation routine} ** KEYWORDS: {application-defined SQL function} ** KEYWORDS: {application-defined SQL functions} ** ** ^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 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 ** the third parameter is less than -1 or greater than 127 then the ** behavior is undefined. |
︙ | ︙ | |||
2376 2377 2378 2379 2380 2381 2382 | ** close the database connection nor finalize or reset the prepared ** statement in which the function is running. */ int sqlite4_create_function( sqlite4 *db, const char *zFunctionName, int nArg, | < < < < < < < < < < < | 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 | ** close the database connection nor finalize or reset the prepared ** statement in which the function is running. */ 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*) ); |
︙ | ︙ | |||
2821 2822 2823 2824 2825 2826 2827 | ** CAPIREF: Collation Needed Callbacks ** ** ^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. ** | < < < < < < < < < < < | 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 | ** CAPIREF: Collation Needed Callbacks ** ** ^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. ** ** ^(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 ** sequence function required. The fourth parameter is the name of the ** required collation sequence.)^ ** ** The callback function should register the desired collation using ** [sqlite4_create_collation()]. */ int sqlite4_collation_needed( sqlite4*, void(*)(void*,sqlite4*,int eTextRep,const char*), void* ); /* ** CAPIREF: Suspend Execution For A Short Time ** ** The sqlite4_sleep() function causes the current thread to suspend execution ** for at least a number of milliseconds specified in its parameter. ** |
︙ | ︙ |
Changes to src/vdbeapi.c.
︙ | ︙ | |||
846 847 848 849 850 851 852 | ** Return the name of the Nth column of the result set returned by SQL ** statement pStmt. */ const char *sqlite4_column_name(sqlite4_stmt *pStmt, int N){ return columnName( pStmt, N, (const void*(*)(Mem*, int*))sqlite4_value_text, COLNAME_NAME); } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 | ** Return the name of the Nth column of the result set returned by SQL ** statement pStmt. */ const char *sqlite4_column_name(sqlite4_stmt *pStmt, int N){ return columnName( pStmt, N, (const void*(*)(Mem*, int*))sqlite4_value_text, COLNAME_NAME); } /* ** Constraint: If you have ENABLE_COLUMN_METADATA then you must ** not define OMIT_DECLTYPE. */ #if defined(SQLITE4_OMIT_DECLTYPE) && defined(SQLITE4_ENABLE_COLUMN_METADATA) # error "Must not define both SQLITE4_OMIT_DECLTYPE \ and SQLITE4_ENABLE_COLUMN_METADATA" #endif #ifndef SQLITE4_OMIT_DECLTYPE /* ** Return the column declaration type (if applicable) of the 'i'th column ** of the result set of SQL statement pStmt. */ const char *sqlite4_column_decltype(sqlite4_stmt *pStmt, int N){ return columnName(pStmt, N, (const void*(*)(Mem*, int*))sqlite4_value_text, COLNAME_DECLTYPE); } #endif /* SQLITE4_OMIT_DECLTYPE */ #ifdef SQLITE4_ENABLE_COLUMN_METADATA /* ** Return the name of the database 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. */ const char *sqlite4_column_database_name(sqlite4_stmt *pStmt, int N){ return columnName(pStmt, N, (const void*(*)(Mem*, int*))sqlite4_value_text, COLNAME_DATABASE); } /* ** 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. */ const char *sqlite4_column_table_name(sqlite4_stmt *pStmt, int N){ return columnName(pStmt, N, (const void*(*)(Mem*, int*))sqlite4_value_text, COLNAME_TABLE); } /* ** 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. */ const char *sqlite4_column_origin_name(sqlite4_stmt *pStmt, int N){ return columnName(pStmt, N, (const void*(*)(Mem*, int*))sqlite4_value_text, COLNAME_COLUMN); } #endif /* SQLITE4_ENABLE_COLUMN_METADATA */ /******************************* sqlite4_bind_ *************************** ** ** Routines used to attach values to wildcards in a compiled SQL statement. */ |
︙ | ︙ |
Changes to test/bind.test.
︙ | ︙ | |||
373 374 375 376 377 378 379 | # Test that the 'out of range' error works. do_test bind-8.1 { catch { sqlite4_bind_null $VM 0 } } {1} do_test bind-8.2 { sqlite4_errmsg $DB } {bind or column index out of range} | < | | | < < | | | < | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | # Test that the 'out of range' error works. do_test bind-8.1 { catch { sqlite4_bind_null $VM 0 } } {1} do_test bind-8.2 { sqlite4_errmsg $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 { catch { sqlite4_bind_null $VM 4 } } {1} do_test bind-8.6 { sqlite4_errmsg $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 { catch { sqlite4_bind_blob $VM 4 "abc" 3 } } {1} |
︙ | ︙ |
Changes to test/test_func.c.
︙ | ︙ | |||
155 156 157 158 159 160 161 | #ifndef SQLITE4_OMIT_BUILTIN_TEST void sqlite4BeginBenignMalloc(void); void sqlite4EndBenignMalloc(void); #else #define sqlite4BeginBenignMalloc() #define sqlite4EndBenignMalloc() #endif | < < < < < < < < < < < < < | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | #ifndef SQLITE4_OMIT_BUILTIN_TEST void sqlite4BeginBenignMalloc(void); void sqlite4EndBenignMalloc(void); #else #define sqlite4BeginBenignMalloc() #define sqlite4EndBenignMalloc() #endif /* ** Routines for testing the sqlite4_auxdata_fetch() and sqlite4_auxdata_store() ** interface. ** ** The test_auxdata() SQL function attempts to register each of its arguments ** as auxiliary data. If there are no prior registrations of aux data for |
︙ | ︙ | |||
464 465 466 467 468 469 470 | int i; for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){ sqlite4_create_function(db, aFuncs[i].zName, aFuncs[i].nArg, aFuncs[i].eTextRep, 0, aFuncs[i].xFunc, 0, 0, 0); } | < < < | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | int i; for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){ sqlite4_create_function(db, aFuncs[i].zName, aFuncs[i].nArg, aFuncs[i].eTextRep, 0, aFuncs[i].xFunc, 0, 0, 0); } return SQLITE4_OK; } /* ** A bogus step function and finalizer function. */ static void tStep(sqlite4_context *a, int b, sqlite4_value **c){} |
︙ | ︙ |
Changes to test/test_main.c.
︙ | ︙ | |||
866 867 868 869 870 871 872 | } #endif if( rc==SQLITE4_OK ){ rc = sqlite4_create_function(db, "tkt2213func", 1, SQLITE4_ANY, 0, tkt2213Function, 0, 0, 0); } | < < < < < < < < < < < < < | | < | < < | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 | } #endif if( rc==SQLITE4_OK ){ rc = sqlite4_create_function(db, "tkt2213func", 1, SQLITE4_ANY, 0, tkt2213Function, 0, 0, 0); } if( rc==SQLITE4_OK ){ 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; } /* |
︙ | ︙ | |||
2102 2103 2104 2105 2106 2107 2108 | ** Called when a collating sequence is needed. Registered using ** sqlite4_collation_needed16(). */ static void test_collate_needed_cb( void *pCtx, sqlite4 *db, int eTextRep, | | < < < < < | | | | < | 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 | ** Called when a collating sequence is needed. Registered using ** sqlite4_collation_needed16(). */ static void test_collate_needed_cb( void *pCtx, sqlite4 *db, int eTextRep, const char *zName ){ int enc = ENC(db); strcpy(zNeededCollation, zName); sqlite4_create_collation( db, "test_collate", enc, SQLITE4_INT_TO_PTR(enc), test_collate_func, 0, 0 ); } /* ** Usage: add_test_collate_needed DB */ static int test_collate_needed( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite4 *db; int rc; if( objc!=2 ) goto bad_args; if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; 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"); return TCL_ERROR; } |
︙ | ︙ | |||
2880 2881 2882 2883 2884 2885 2886 | if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; zErr = sqlite4_errmsg(db); Tcl_SetObjResult(interp, Tcl_NewStringObj(zErr, -1)); return TCL_OK; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 | if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; zErr = sqlite4_errmsg(db); Tcl_SetObjResult(interp, Tcl_NewStringObj(zErr, -1)); return TCL_OK; } /* ** Usage: sqlite4_prepare DB sql bytes ?tailvar? ** ** Compile up to <bytes> bytes of the supplied SQL string <sql> using ** database handle <DB>. The parameter <tailval> is the name of a global ** variable that is set to the unused portion of <sql> (if any). A ** STMT handle is returned. |
︙ | ︙ | |||
3363 3364 3365 3366 3367 3368 3369 | if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR; if( Tcl_GetIntFromObj(interp, objv[2], &col) ) return TCL_ERROR; zRet = xFunc(pStmt, col, 0); if( zRet ){ Tcl_SetResult(interp, (char *)zRet, 0); } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 | if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR; 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_int STMT column */ static int test_stmt_int( |
︙ | ︙ | |||
4222 4223 4224 4225 4226 4227 4228 | { "sqlite4_bind_parameter_count", test_bind_parameter_count, 0}, { "sqlite4_bind_parameter_name", test_bind_parameter_name, 0}, { "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 }, | < | 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 | { "sqlite4_bind_parameter_count", test_bind_parameter_count, 0}, { "sqlite4_bind_parameter_name", test_bind_parameter_name, 0}, { "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_open", test_open ,0 }, { "sqlite4_open_v2", test_open_v2 ,0 }, { "sqlite4_prepare", test_prepare ,0 }, { "sqlite4_prepare_tkt3134", test_prepare_tkt3134, 0}, { "sqlite4_finalize", test_finalize ,0 }, { "sqlite4_stmt_status", test_stmt_status ,0 }, |
︙ | ︙ | |||
4269 4270 4271 4272 4273 4274 4275 | #ifdef SQLITE4_ENABLE_COLUMN_METADATA { "sqlite4_column_database_name",test_stmt_utf8,(void*)sqlite4_column_database_name}, { "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 | < < < < < < < < < < < | 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 | #ifdef SQLITE4_ENABLE_COLUMN_METADATA { "sqlite4_column_database_name",test_stmt_utf8,(void*)sqlite4_column_database_name}, { "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 { "add_alignment_test_collations", add_alignment_test_collations, 0 }, #endif { "sqlite4_create_collation", test_create_collation, 0 }, { "working_64bit_int", working_64bit_int, 0 }, { "sqlite4_create_function_v2", test_create_function_v2, 0 }, /* Functions from os.h */ #ifndef SQLITE4_OMIT_UTF16 |
︙ | ︙ |
Changes to test/test_utf.c.
︙ | ︙ | |||
87 88 89 90 91 92 93 94 95 96 97 98 99 100 | val.z = "hello world"; val.type = SQLITE4_TEXT; val.enc = SQLITE4_UTF8; for(i=0; i<repeat_count; i++){ if( do_calls ){ zVal = sqlite4_value_text(&val, 0); } } return TCL_OK; } static u8 name_to_enc(Tcl_Interp *interp, Tcl_Obj *pObj){ | > | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | val.z = "hello world"; val.type = SQLITE4_TEXT; val.enc = SQLITE4_UTF8; for(i=0; i<repeat_count; i++){ if( do_calls ){ zVal = sqlite4_value_text(&val, 0); UNUSED_PARAMETER(zVal); } } return TCL_OK; } static u8 name_to_enc(Tcl_Interp *interp, Tcl_Obj *pObj){ |
︙ | ︙ |