From 110ef61861e8435d07cb844a2ea2cec0af131fab Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 4 Aug 2022 14:37:08 +0300 Subject: [PATCH] Move SQLite to namespace tdsqlite. --- sqlite/CMakeLists.txt | 2 + sqlite/sqlite/sqlite3.c | 50388 ++++++++++++++-------------- sqlite/sqlite/sqlite3.h | 4806 +-- sqlite/sqlite/sqlite3ext.h | 966 +- sqlite/sqlite/sqlite3session.h | 472 +- tddb/td/db/SqliteDb.cpp | 21 +- tddb/td/db/SqliteDb.h | 4 +- tddb/td/db/SqliteStatement.cpp | 62 +- tddb/td/db/SqliteStatement.h | 10 +- tddb/td/db/detail/RawSqliteDb.cpp | 8 +- tddb/td/db/detail/RawSqliteDb.h | 10 +- 11 files changed, 28376 insertions(+), 28373 deletions(-) diff --git a/sqlite/CMakeLists.txt b/sqlite/CMakeLists.txt index df2f5c18c..518e3f0aa 100644 --- a/sqlite/CMakeLists.txt +++ b/sqlite/CMakeLists.txt @@ -19,6 +19,8 @@ set(SQLITE_SOURCE sqlite/sqlite3session.h ) +# all SQLite functions are moved to namespace tdsqlite3 by `sed -Ebi 's/sqlite3([^.]|$)/td&/g' *` + add_library(tdsqlite STATIC ${SQLITE_SOURCE}) target_include_directories(tdsqlite PUBLIC $) target_include_directories(tdsqlite SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR}) diff --git a/sqlite/sqlite/sqlite3.c b/sqlite/sqlite/sqlite3.c index cb15a29a3..d1e48513f 100644 --- a/sqlite/sqlite/sqlite3.c +++ b/sqlite/sqlite/sqlite3.c @@ -14,7 +14,7 @@ ** the text of this file. Search for "Begin file sqlite3.h" to find the start ** of the embedded sqlite3.h header file.) Additional code files may be needed ** if you want a wrapper to interface SQLite with your choice of programming -** language. The code for the "sqlite3" command-line shell is also in a +** language. The code for the "tdsqlite3" command-line shell is also in a ** separate file. This file contains only code for the core SQLite library. */ #define SQLITE_CORE 1 @@ -69,7 +69,7 @@ ** only a handful of compile-time options, so most times this array is usually ** rather short and uses little memory space. */ -static const char * const sqlite3azCompileOpt[] = { +static const char * const tdsqlite3azCompileOpt[] = { /* ** BEGIN CODE GENERATED BY tool/mkctime.tcl @@ -782,9 +782,9 @@ static const char * const sqlite3azCompileOpt[] = { */ }; -SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt){ - *pnOpt = sizeof(sqlite3azCompileOpt) / sizeof(sqlite3azCompileOpt[0]); - return (const char**)sqlite3azCompileOpt; +SQLITE_PRIVATE const char **tdsqlite3CompileOptions(int *pnOpt){ + *pnOpt = sizeof(tdsqlite3azCompileOpt) / sizeof(tdsqlite3azCompileOpt[0]); + return (const char**)tdsqlite3azCompileOpt; } #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ @@ -1161,8 +1161,8 @@ extern "C" { ** been edited in any way since it was last checked in, then the last ** four hexadecimal digits of the hash may be modified. ** -** See also: [sqlite3_libversion()], -** [sqlite3_libversion_number()], [sqlite3_sourceid()], +** See also: [tdsqlite3_libversion()], +** [tdsqlite3_libversion_number()], [tdsqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.31.0" @@ -1171,7 +1171,7 @@ extern "C" { /* ** CAPI3REF: Run-Time Library Version Numbers -** KEYWORDS: sqlite3_version sqlite3_sourceid +** KEYWORDS: tdsqlite3_version tdsqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros @@ -1182,18 +1182,18 @@ extern "C" { ** compiled with matching library and header files. ** **
-** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
-** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
-** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
+** assert( tdsqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
+** assert( strncmp(tdsqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
+** assert( strcmp(tdsqlite3_libversion(),SQLITE_VERSION)==0 );
 ** 
)^ ** -** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] -** macro. ^The sqlite3_libversion() function returns a pointer to the -** to the sqlite3_version[] string constant. The sqlite3_libversion() +** ^The tdsqlite3_version[] string constant contains the text of [SQLITE_VERSION] +** macro. ^The tdsqlite3_libversion() function returns a pointer to the +** to the tdsqlite3_version[] string constant. The tdsqlite3_libversion() ** function is provided for use in DLLs since DLL users usually do not have ** direct access to string constants within the DLL. ^The -** sqlite3_libversion_number() function returns an integer equal to -** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns +** tdsqlite3_libversion_number() function returns an integer equal to +** [SQLITE_VERSION_NUMBER]. ^(The tdsqlite3_sourceid() function returns ** a pointer to a string constant whose value is the same as the ** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built ** using an edited copy of [the amalgamation], then the last four characters @@ -1201,45 +1201,45 @@ extern "C" { ** ** See also: [sqlite_version()] and [sqlite_source_id()]. */ -SQLITE_API const char sqlite3_version[] = SQLITE_VERSION; -SQLITE_API const char *sqlite3_libversion(void); -SQLITE_API const char *sqlite3_sourceid(void); -SQLITE_API int sqlite3_libversion_number(void); +SQLITE_API const char tdsqlite3_version[] = SQLITE_VERSION; +SQLITE_API const char *tdsqlite3_libversion(void); +SQLITE_API const char *tdsqlite3_sourceid(void); +SQLITE_API int tdsqlite3_libversion_number(void); /* ** CAPI3REF: Run-Time Library Compilation Options Diagnostics ** -** ^The sqlite3_compileoption_used() function returns 0 or 1 +** ^The tdsqlite3_compileoption_used() function returns 0 or 1 ** indicating whether the specified option was defined at ** compile time. ^The SQLITE_ prefix may be omitted from the -** option name passed to sqlite3_compileoption_used(). +** option name passed to tdsqlite3_compileoption_used(). ** -** ^The sqlite3_compileoption_get() function allows iterating +** ^The tdsqlite3_compileoption_get() function allows iterating ** over the list of options that were defined at compile time by ** returning the N-th compile time option string. ^If N is out of range, -** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ +** tdsqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ ** prefix is omitted from any strings returned by -** sqlite3_compileoption_get(). +** tdsqlite3_compileoption_get(). ** -** ^Support for the diagnostic functions sqlite3_compileoption_used() -** and sqlite3_compileoption_get() may be omitted by specifying the +** ^Support for the diagnostic functions tdsqlite3_compileoption_used() +** and tdsqlite3_compileoption_get() may be omitted by specifying the ** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time. ** ** See also: SQL functions [sqlite_compileoption_used()] and ** [sqlite_compileoption_get()] and the [compile_options pragma]. */ #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS -SQLITE_API int sqlite3_compileoption_used(const char *zOptName); -SQLITE_API const char *sqlite3_compileoption_get(int N); +SQLITE_API int tdsqlite3_compileoption_used(const char *zOptName); +SQLITE_API const char *tdsqlite3_compileoption_get(int N); #else -# define sqlite3_compileoption_used(X) 0 -# define sqlite3_compileoption_get(X) ((void*)0) +# define tdsqlite3_compileoption_used(X) 0 +# define tdsqlite3_compileoption_get(X) ((void*)0) #endif /* ** CAPI3REF: Test To See If The Library Is Threadsafe ** -** ^The sqlite3_threadsafe() function returns zero if and only if +** ^The tdsqlite3_threadsafe() function returns zero if and only if ** SQLite was compiled with mutexing code omitted due to the ** [SQLITE_THREADSAFE] compile-time option being set to 0. ** @@ -1262,33 +1262,33 @@ SQLITE_API const char *sqlite3_compileoption_get(int N); ** This interface only reports on the compile-time mutex setting ** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with ** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but -** can be fully or partially disabled using a call to [sqlite3_config()] +** can be fully or partially disabled using a call to [tdsqlite3_config()] ** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], ** or [SQLITE_CONFIG_SERIALIZED]. ^(The return value of the -** sqlite3_threadsafe() function shows only the compile-time setting of +** tdsqlite3_threadsafe() function shows only the compile-time setting of ** thread safety, not any run-time changes to that setting made by -** sqlite3_config(). In other words, the return value from sqlite3_threadsafe() -** is unchanged by calls to sqlite3_config().)^ +** tdsqlite3_config(). In other words, the return value from tdsqlite3_threadsafe() +** is unchanged by calls to tdsqlite3_config().)^ ** ** See the [threading mode] documentation for additional information. */ -SQLITE_API int sqlite3_threadsafe(void); +SQLITE_API int tdsqlite3_threadsafe(void); /* ** CAPI3REF: Database Connection Handle ** KEYWORDS: {database connection} {database connections} ** ** Each open SQLite database is represented by a pointer to an instance of -** the opaque structure named "sqlite3". It is useful to think of an sqlite3 -** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and -** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] -** and [sqlite3_close_v2()] are its destructors. There are many other +** the opaque structure named "tdsqlite3". It is useful to think of an tdsqlite3 +** pointer as an object. The [tdsqlite3_open()], [tdsqlite3_open16()], and +** [tdsqlite3_open_v2()] interfaces are its constructors, and [tdsqlite3_close()] +** and [tdsqlite3_close_v2()] are its destructors. There are many other ** interfaces (such as -** [sqlite3_prepare_v2()], [sqlite3_create_function()], and -** [sqlite3_busy_timeout()] to name but three) that are methods on an -** sqlite3 object. +** [tdsqlite3_prepare_v2()], [tdsqlite3_create_function()], and +** [tdsqlite3_busy_timeout()] to name but three) that are methods on an +** tdsqlite3 object. */ -typedef struct sqlite3 sqlite3; +typedef struct tdsqlite3 tdsqlite3; /* ** CAPI3REF: 64-Bit Integer Types @@ -1297,13 +1297,13 @@ typedef struct sqlite3 sqlite3; ** Because there is no cross-platform way to specify 64-bit integer types ** SQLite includes typedefs for 64-bit signed and unsigned integers. ** -** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions. +** The tdsqlite3_int64 and tdsqlite3_uint64 are the preferred type definitions. ** The sqlite_int64 and sqlite_uint64 types are supported for backwards ** compatibility only. ** -** ^The sqlite3_int64 and sqlite_int64 types can store integer values +** ^The tdsqlite3_int64 and sqlite_int64 types can store integer values ** between -9223372036854775808 and +9223372036854775807 inclusive. ^The -** sqlite3_uint64 and sqlite_uint64 types can store integer values +** tdsqlite3_uint64 and sqlite_uint64 types can store integer values ** between 0 and +18446744073709551615 inclusive. */ #ifdef SQLITE_INT64_TYPE @@ -1320,116 +1320,116 @@ typedef struct sqlite3 sqlite3; typedef long long int sqlite_int64; typedef unsigned long long int sqlite_uint64; #endif -typedef sqlite_int64 sqlite3_int64; -typedef sqlite_uint64 sqlite3_uint64; +typedef sqlite_int64 tdsqlite3_int64; +typedef sqlite_uint64 tdsqlite3_uint64; /* ** If compiling for a processor that lacks floating point support, ** substitute integer for floating-point. */ #ifdef SQLITE_OMIT_FLOATING_POINT -# define double sqlite3_int64 +# define double tdsqlite3_int64 #endif /* ** CAPI3REF: Closing A Database Connection -** DESTRUCTOR: sqlite3 +** DESTRUCTOR: tdsqlite3 ** -** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors -** for the [sqlite3] object. -** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if -** the [sqlite3] object is successfully destroyed and all associated +** ^The tdsqlite3_close() and tdsqlite3_close_v2() routines are destructors +** for the [tdsqlite3] object. +** ^Calls to tdsqlite3_close() and tdsqlite3_close_v2() return [SQLITE_OK] if +** the [tdsqlite3] object is successfully destroyed and all associated ** resources are deallocated. ** ** ^If the database connection is associated with unfinalized prepared -** statements or unfinished sqlite3_backup objects then sqlite3_close() +** statements or unfinished tdsqlite3_backup objects then tdsqlite3_close() ** will leave the database connection open and return [SQLITE_BUSY]. -** ^If sqlite3_close_v2() is called with unfinalized prepared statements -** and/or unfinished sqlite3_backups, then the database connection becomes +** ^If tdsqlite3_close_v2() is called with unfinalized prepared statements +** and/or unfinished tdsqlite3_backups, then the database connection becomes ** an unusable "zombie" which will automatically be deallocated when the -** last prepared statement is finalized or the last sqlite3_backup is -** finished. The sqlite3_close_v2() interface is intended for use with +** last prepared statement is finalized or the last tdsqlite3_backup is +** finished. The tdsqlite3_close_v2() interface is intended for use with ** host languages that are garbage collected, and where the order in which ** destructors are called is arbitrary. ** -** Applications should [sqlite3_finalize | finalize] all [prepared statements], -** [sqlite3_blob_close | close] all [BLOB handles], and -** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated -** with the [sqlite3] object prior to attempting to close the object. ^If -** sqlite3_close_v2() is called on a [database connection] that still has +** Applications should [tdsqlite3_finalize | finalize] all [prepared statements], +** [tdsqlite3_blob_close | close] all [BLOB handles], and +** [tdsqlite3_backup_finish | finish] all [tdsqlite3_backup] objects associated +** with the [tdsqlite3] object prior to attempting to close the object. ^If +** tdsqlite3_close_v2() is called on a [database connection] that still has ** outstanding [prepared statements], [BLOB handles], and/or -** [sqlite3_backup] objects then it returns [SQLITE_OK] and the deallocation +** [tdsqlite3_backup] objects then it returns [SQLITE_OK] and the deallocation ** of resources is deferred until all [prepared statements], [BLOB handles], -** and [sqlite3_backup] objects are also destroyed. +** and [tdsqlite3_backup] objects are also destroyed. ** -** ^If an [sqlite3] object is destroyed while a transaction is open, +** ^If an [tdsqlite3] object is destroyed while a transaction is open, ** the transaction is automatically rolled back. ** -** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)] +** The C parameter to [tdsqlite3_close(C)] and [tdsqlite3_close_v2(C)] ** must be either a NULL -** pointer or an [sqlite3] object pointer obtained -** from [sqlite3_open()], [sqlite3_open16()], or -** [sqlite3_open_v2()], and not previously closed. -** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer +** pointer or an [tdsqlite3] object pointer obtained +** from [tdsqlite3_open()], [tdsqlite3_open16()], or +** [tdsqlite3_open_v2()], and not previously closed. +** ^Calling tdsqlite3_close() or tdsqlite3_close_v2() with a NULL pointer ** argument is a harmless no-op. */ -SQLITE_API int sqlite3_close(sqlite3*); -SQLITE_API int sqlite3_close_v2(sqlite3*); +SQLITE_API int tdsqlite3_close(tdsqlite3*); +SQLITE_API int tdsqlite3_close_v2(tdsqlite3*); /* ** The type for a callback function. ** This is legacy and deprecated. It is included for historical ** compatibility and is not documented. */ -typedef int (*sqlite3_callback)(void*,int,char**, char**); +typedef int (*tdsqlite3_callback)(void*,int,char**, char**); /* ** CAPI3REF: One-Step Query Execution Interface -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** The sqlite3_exec() interface is a convenience wrapper around -** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], +** The tdsqlite3_exec() interface is a convenience wrapper around +** [tdsqlite3_prepare_v2()], [tdsqlite3_step()], and [tdsqlite3_finalize()], ** that allows an application to run multiple statements of SQL ** without having to use a lot of C code. ** -** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, +** ^The tdsqlite3_exec() interface runs zero or more UTF-8 encoded, ** semicolon-separate SQL statements passed into its 2nd argument, ** in the context of the [database connection] passed in as its 1st ** argument. ^If the callback function of the 3rd argument to -** sqlite3_exec() is not NULL, then it is invoked for each result row +** tdsqlite3_exec() is not NULL, then it is invoked for each result row ** coming out of the evaluated SQL statements. ^The 4th argument to -** sqlite3_exec() is relayed through to the 1st argument of each -** callback invocation. ^If the callback pointer to sqlite3_exec() +** tdsqlite3_exec() is relayed through to the 1st argument of each +** callback invocation. ^If the callback pointer to tdsqlite3_exec() ** is NULL, then no callback is ever invoked and result rows are ** ignored. ** ** ^If an error occurs while evaluating the SQL statements passed into -** sqlite3_exec(), then execution of the current statement stops and -** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec() +** tdsqlite3_exec(), then execution of the current statement stops and +** subsequent statements are skipped. ^If the 5th parameter to tdsqlite3_exec() ** is not NULL then any error message is written into memory obtained -** from [sqlite3_malloc()] and passed back through the 5th parameter. -** To avoid memory leaks, the application should invoke [sqlite3_free()] +** from [tdsqlite3_malloc()] and passed back through the 5th parameter. +** To avoid memory leaks, the application should invoke [tdsqlite3_free()] ** on error message strings returned through the 5th parameter of -** sqlite3_exec() after the error message string is no longer needed. -** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors -** occur, then sqlite3_exec() sets the pointer in its 5th parameter to +** tdsqlite3_exec() after the error message string is no longer needed. +** ^If the 5th parameter to tdsqlite3_exec() is not NULL and no errors +** occur, then tdsqlite3_exec() sets the pointer in its 5th parameter to ** NULL before returning. ** -** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec() +** ^If an tdsqlite3_exec() callback returns non-zero, the tdsqlite3_exec() ** routine returns SQLITE_ABORT without invoking the callback again and ** without running any subsequent SQL statements. ** -** ^The 2nd argument to the sqlite3_exec() callback function is the -** number of columns in the result. ^The 3rd argument to the sqlite3_exec() +** ^The 2nd argument to the tdsqlite3_exec() callback function is the +** number of columns in the result. ^The 3rd argument to the tdsqlite3_exec() ** callback is an array of pointers to strings obtained as if from -** [sqlite3_column_text()], one for each column. ^If an element of a +** [tdsqlite3_column_text()], one for each column. ^If an element of a ** result row is NULL then the corresponding string pointer for the -** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the -** sqlite3_exec() callback is an array of pointers to strings where each +** tdsqlite3_exec() callback is a NULL pointer. ^The 4th argument to the +** tdsqlite3_exec() callback is an array of pointers to strings where each ** entry represents the name of corresponding result column as obtained -** from [sqlite3_column_name()]. +** from [tdsqlite3_column_name()]. ** -** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer +** ^If the 2nd parameter to tdsqlite3_exec() is a NULL pointer, a pointer ** to an empty string, or a pointer that contains only whitespace and/or ** SQL comments, then no SQL statements are evaluated and the database ** is not changed. @@ -1437,16 +1437,16 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**); ** Restrictions: ** ** */ -SQLITE_API int sqlite3_exec( - sqlite3*, /* An open database */ +SQLITE_API int tdsqlite3_exec( + tdsqlite3*, /* An open database */ const char *sql, /* SQL to be evaluated */ int (*callback)(void*,int,char**,char**), /* Callback function */ void *, /* 1st argument to callback */ @@ -1474,10 +1474,10 @@ SQLITE_API int sqlite3_exec( #define SQLITE_LOCKED 6 /* A table in the database is locked */ #define SQLITE_NOMEM 7 /* A malloc() failed */ #define SQLITE_READONLY 8 /* Attempt to write a readonly database */ -#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ +#define SQLITE_INTERRUPT 9 /* Operation terminated by tdsqlite3_interrupt()*/ #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ #define SQLITE_CORRUPT 11 /* The database disk image is malformed */ -#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */ +#define SQLITE_NOTFOUND 12 /* Unknown opcode in tdsqlite3_file_control() */ #define SQLITE_FULL 13 /* Insertion failed because database is full */ #define SQLITE_CANTOPEN 14 /* Unable to open the database file */ #define SQLITE_PROTOCOL 15 /* Database lock protocol error */ @@ -1490,12 +1490,12 @@ SQLITE_API int sqlite3_exec( #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ #define SQLITE_AUTH 23 /* Authorization denied */ #define SQLITE_FORMAT 24 /* Not used */ -#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ +#define SQLITE_RANGE 25 /* 2nd parameter to tdsqlite3_bind out of range */ #define SQLITE_NOTADB 26 /* File opened that is not a database file */ -#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */ -#define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */ -#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */ -#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */ +#define SQLITE_NOTICE 27 /* Notifications from tdsqlite3_log() */ +#define SQLITE_WARNING 28 /* Warnings from tdsqlite3_log() */ +#define SQLITE_ROW 100 /* tdsqlite3_step() has another row ready */ +#define SQLITE_DONE 101 /* tdsqlite3_step() has finished executing */ /* end-of-error-codes */ /* @@ -1511,9 +1511,9 @@ SQLITE_API int sqlite3_exec( ** support for additional result codes that provide more detailed information ** about errors. These [extended result codes] are enabled or disabled ** on a per database connection basis using the -** [sqlite3_extended_result_codes()] API. Or, the extended code for +** [tdsqlite3_extended_result_codes()] API. Or, the extended code for ** the most recent error can be obtained using -** [sqlite3_extended_errcode()]. +** [tdsqlite3_extended_errcode()]. */ #define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8)) #define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8)) @@ -1590,17 +1590,17 @@ SQLITE_API int sqlite3_exec( ** CAPI3REF: Flags For File Open Operations ** ** These bit values are intended for use in the -** 3rd parameter to the [sqlite3_open_v2()] interface and -** in the 4th parameter to the [sqlite3_vfs.xOpen] method. +** 3rd parameter to the [tdsqlite3_open_v2()] interface and +** in the 4th parameter to the [tdsqlite3_vfs.xOpen] method. */ -#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for tdsqlite3_open_v2() */ +#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for tdsqlite3_open_v2() */ +#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for tdsqlite3_open_v2() */ #define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */ #define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */ #define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */ -#define SQLITE_OPEN_URI 0x00000040 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_MEMORY 0x00000080 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_URI 0x00000040 /* Ok for tdsqlite3_open_v2() */ +#define SQLITE_OPEN_MEMORY 0x00000080 /* Ok for tdsqlite3_open_v2() */ #define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */ #define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */ #define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */ @@ -1608,22 +1608,22 @@ SQLITE_API int sqlite3_exec( #define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */ #define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */ #define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */ -#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for tdsqlite3_open_v2() */ +#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for tdsqlite3_open_v2() */ +#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for tdsqlite3_open_v2() */ +#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for tdsqlite3_open_v2() */ #define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ -#define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for tdsqlite3_open_v2() */ /* Reserved: 0x00F00000 */ /* ** CAPI3REF: Device Characteristics ** -** The xDeviceCharacteristics method of the [sqlite3_io_methods] +** The xDeviceCharacteristics method of the [tdsqlite3_io_methods] ** object returns an integer which is a vector of these ** bit values expressing I/O characteristics of the mass storage -** device that holds the file that the [sqlite3_io_methods] +** device that holds the file that the [tdsqlite3_io_methods] ** refers to. ** ** The SQLITE_IOCAP_ATOMIC property means that all writes of @@ -1671,7 +1671,7 @@ SQLITE_API int sqlite3_exec( ** ** SQLite uses one of these integer values as the second ** argument to calls it makes to the xLock() and xUnlock() methods -** of an [sqlite3_io_methods] object. +** of an [tdsqlite3_io_methods] object. */ #define SQLITE_LOCK_NONE 0 #define SQLITE_LOCK_SHARED 1 @@ -1683,7 +1683,7 @@ SQLITE_API int sqlite3_exec( ** CAPI3REF: Synchronization Type Flags ** ** When SQLite invokes the xSync() method of an -** [sqlite3_io_methods] object it uses a combination of +** [tdsqlite3_io_methods] object it uses a combination of ** these integer values as the second argument. ** ** When the SQLITE_SYNC_DATAONLY flag is used, it means that the @@ -1712,33 +1712,33 @@ SQLITE_API int sqlite3_exec( /* ** CAPI3REF: OS Interface Open File Handle ** -** An [sqlite3_file] object represents an open file in the -** [sqlite3_vfs | OS interface layer]. Individual OS interface +** An [tdsqlite3_file] object represents an open file in the +** [tdsqlite3_vfs | OS interface layer]. Individual OS interface ** implementations will ** want to subclass this object by appending additional fields ** for their own use. The pMethods entry is a pointer to an -** [sqlite3_io_methods] object that defines methods for performing +** [tdsqlite3_io_methods] object that defines methods for performing ** I/O operations on the open file. */ -typedef struct sqlite3_file sqlite3_file; -struct sqlite3_file { - const struct sqlite3_io_methods *pMethods; /* Methods for an open file */ +typedef struct tdsqlite3_file tdsqlite3_file; +struct tdsqlite3_file { + const struct tdsqlite3_io_methods *pMethods; /* Methods for an open file */ }; /* ** CAPI3REF: OS Interface File Virtual Methods Object ** -** Every file opened by the [sqlite3_vfs.xOpen] method populates an -** [sqlite3_file] object (or, more commonly, a subclass of the -** [sqlite3_file] object) with a pointer to an instance of this object. +** Every file opened by the [tdsqlite3_vfs.xOpen] method populates an +** [tdsqlite3_file] object (or, more commonly, a subclass of the +** [tdsqlite3_file] object) with a pointer to an instance of this object. ** This object defines the methods used to perform various operations -** against the open file represented by the [sqlite3_file] object. +** against the open file represented by the [tdsqlite3_file] object. ** -** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element -** to a non-NULL pointer, then the sqlite3_io_methods.xClose method -** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The -** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen] -** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element +** If the [tdsqlite3_vfs.xOpen] method sets the tdsqlite3_file.pMethods element +** to a non-NULL pointer, then the tdsqlite3_io_methods.xClose method +** may be invoked even if the [tdsqlite3_vfs.xOpen] reported that it failed. The +** only way to prevent a call to xClose following a failed [tdsqlite3_vfs.xOpen] +** is for the [tdsqlite3_vfs.xOpen] to set the tdsqlite3_file.pMethods element ** to NULL. ** ** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or @@ -1763,7 +1763,7 @@ struct sqlite3_file { ** ** The xFileControl() method is a generic interface that allows custom ** VFS implementations to directly control an open file using the -** [sqlite3_file_control()] interface. The second "op" argument is an +** [tdsqlite3_file_control()] interface. The second "op" argument is an ** integer opcode. The third argument is a generic pointer intended to ** point to a structure that may contain arguments or space in which to ** write return values. Potential uses for xFileControl() might be @@ -1819,29 +1819,29 @@ struct sqlite3_file { ** failure to zero-fill short reads will eventually lead to ** database corruption. */ -typedef struct sqlite3_io_methods sqlite3_io_methods; -struct sqlite3_io_methods { +typedef struct tdsqlite3_io_methods tdsqlite3_io_methods; +struct tdsqlite3_io_methods { int iVersion; - int (*xClose)(sqlite3_file*); - int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst); - int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst); - int (*xTruncate)(sqlite3_file*, sqlite3_int64 size); - int (*xSync)(sqlite3_file*, int flags); - int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize); - int (*xLock)(sqlite3_file*, int); - int (*xUnlock)(sqlite3_file*, int); - int (*xCheckReservedLock)(sqlite3_file*, int *pResOut); - int (*xFileControl)(sqlite3_file*, int op, void *pArg); - int (*xSectorSize)(sqlite3_file*); - int (*xDeviceCharacteristics)(sqlite3_file*); + int (*xClose)(tdsqlite3_file*); + int (*xRead)(tdsqlite3_file*, void*, int iAmt, tdsqlite3_int64 iOfst); + int (*xWrite)(tdsqlite3_file*, const void*, int iAmt, tdsqlite3_int64 iOfst); + int (*xTruncate)(tdsqlite3_file*, tdsqlite3_int64 size); + int (*xSync)(tdsqlite3_file*, int flags); + int (*xFileSize)(tdsqlite3_file*, tdsqlite3_int64 *pSize); + int (*xLock)(tdsqlite3_file*, int); + int (*xUnlock)(tdsqlite3_file*, int); + int (*xCheckReservedLock)(tdsqlite3_file*, int *pResOut); + int (*xFileControl)(tdsqlite3_file*, int op, void *pArg); + int (*xSectorSize)(tdsqlite3_file*); + int (*xDeviceCharacteristics)(tdsqlite3_file*); /* Methods above are valid for version 1 */ - int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**); - int (*xShmLock)(sqlite3_file*, int offset, int n, int flags); - void (*xShmBarrier)(sqlite3_file*); - int (*xShmUnmap)(sqlite3_file*, int deleteFlag); + int (*xShmMap)(tdsqlite3_file*, int iPg, int pgsz, int, void volatile**); + int (*xShmLock)(tdsqlite3_file*, int offset, int n, int flags); + void (*xShmBarrier)(tdsqlite3_file*); + int (*xShmUnmap)(tdsqlite3_file*, int deleteFlag); /* Methods above are valid for version 2 */ - int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp); - int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p); + int (*xFetch)(tdsqlite3_file*, tdsqlite3_int64 iOfst, int iAmt, void **pp); + int (*xUnfetch)(tdsqlite3_file*, tdsqlite3_int64 iOfst, void *p); /* Methods above are valid for version 3 */ /* Additional methods may be added in future releases */ }; @@ -1851,7 +1851,7 @@ struct sqlite3_io_methods { ** KEYWORDS: {file control opcodes} {file control opcode} ** ** These integer constants are opcodes for the xFileControl method -** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()] +** of the [tdsqlite3_io_methods] object and for the [tdsqlite3_file_control()] ** interface. ** ** ** ** To clarify, if this function is called and then a changeset constructed -** using [sqlite3session_changeset()], then after applying that changeset to +** using [tdsqlite3session_changeset()], then after applying that changeset to ** database zFrom the contents of the two compatible tables would be ** identical. ** @@ -11281,10 +11281,10 @@ SQLITE_API int sqlite3session_changeset( ** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg ** may be set to point to a buffer containing an English language error ** message. It is the responsibility of the caller to free this buffer using -** sqlite3_free(). +** tdsqlite3_free(). */ -SQLITE_API int sqlite3session_diff( - sqlite3_session *pSession, +SQLITE_API int tdsqlite3session_diff( + tdsqlite3_session *pSession, const char *zFromDb, const char *zTbl, char **pzErrMsg @@ -11293,7 +11293,7 @@ SQLITE_API int sqlite3session_diff( /* ** CAPI3REF: Generate A Patchset From A Session Object -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** The differences between a patchset and a changeset are that: ** @@ -11305,23 +11305,23 @@ SQLITE_API int sqlite3session_diff( ** ** ** A patchset blob may be used with up to date versions of all -** sqlite3changeset_xxx API functions except for sqlite3changeset_invert(), +** tdsqlite3changeset_xxx API functions except for tdsqlite3changeset_invert(), ** which returns SQLITE_CORRUPT if it is passed a patchset. Similarly, ** attempting to use a patchset blob with old versions of the -** sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error. +** tdsqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error. ** ** Because the non-primary key "old.*" fields are omitted, no ** SQLITE_CHANGESET_DATA conflicts can be detected or reported if a patchset -** is passed to the sqlite3changeset_apply() API. Other conflict types work +** is passed to the tdsqlite3changeset_apply() API. Other conflict types work ** in the same way as for changesets. ** ** Changes within a patchset are ordered in the same way as for changesets -** generated by the sqlite3session_changeset() function (i.e. all changes for +** generated by the tdsqlite3session_changeset() function (i.e. all changes for ** a single table are grouped together, tables appear in the order in which ** they were attached to the session object). */ -SQLITE_API int sqlite3session_patchset( - sqlite3_session *pSession, /* Session object */ +SQLITE_API int tdsqlite3session_patchset( + tdsqlite3_session *pSession, /* Session object */ int *pnPatchset, /* OUT: Size of buffer at *ppPatchset */ void **ppPatchset /* OUT: Buffer containing patchset */ ); @@ -11334,18 +11334,18 @@ SQLITE_API int sqlite3session_patchset( ** more changes have been recorded, return zero. ** ** Even if this function returns zero, it is possible that calling -** [sqlite3session_changeset()] on the session handle may still return a +** [tdsqlite3session_changeset()] on the session handle may still return a ** changeset that contains no changes. This can happen when a row in ** an attached table is modified and then later on the original values ** are restored. However, if this function returns non-zero, then it is -** guaranteed that a call to sqlite3session_changeset() will return a +** guaranteed that a call to tdsqlite3session_changeset() will return a ** changeset containing zero changes. */ -SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession); +SQLITE_API int tdsqlite3session_isempty(tdsqlite3_session *pSession); /* ** CAPI3REF: Create An Iterator To Traverse A Changeset -** CONSTRUCTOR: sqlite3_changeset_iter +** CONSTRUCTOR: tdsqlite3_changeset_iter ** ** Create an iterator used to iterate through the contents of a changeset. ** If successful, *pp is set to point to the iterator handle and SQLITE_OK @@ -11356,20 +11356,20 @@ SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession); ** iterator created by this function: ** ** ** ** It is the responsibility of the caller to eventually destroy the iterator -** by passing it to [sqlite3changeset_finalize()]. The buffer containing the +** by passing it to [tdsqlite3changeset_finalize()]. The buffer containing the ** changeset (pChangeset) must remain valid until after the iterator is ** destroyed. ** ** Assuming the changeset blob was created by one of the -** [sqlite3session_changeset()], [sqlite3changeset_concat()] or -** [sqlite3changeset_invert()] functions, all changes within the changeset +** [tdsqlite3session_changeset()], [tdsqlite3changeset_concat()] or +** [tdsqlite3changeset_invert()] functions, all changes within the changeset ** that apply to a single table are grouped together. This means that when ** an application iterates through a changeset using an iterator created by ** this function, all changes that relate to a single table are visited @@ -11377,34 +11377,34 @@ SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession); ** the applies to table X, then one for table Y, and then later on visit ** another change for table X. ** -** The behavior of sqlite3changeset_start_v2() and its streaming equivalent +** The behavior of tdsqlite3changeset_start_v2() and its streaming equivalent ** may be modified by passing a combination of ** [SQLITE_CHANGESETSTART_INVERT | supported flags] as the 4th parameter. ** -** Note that the sqlite3changeset_start_v2() API is still experimental +** Note that the tdsqlite3changeset_start_v2() API is still experimental ** and therefore subject to change. */ -SQLITE_API int sqlite3changeset_start( - sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ +SQLITE_API int tdsqlite3changeset_start( + tdsqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ int nChangeset, /* Size of changeset blob in bytes */ void *pChangeset /* Pointer to blob containing changeset */ ); -SQLITE_API int sqlite3changeset_start_v2( - sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ +SQLITE_API int tdsqlite3changeset_start_v2( + tdsqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ int nChangeset, /* Size of changeset blob in bytes */ void *pChangeset, /* Pointer to blob containing changeset */ int flags /* SESSION_CHANGESETSTART_* flags */ ); /* -** CAPI3REF: Flags for sqlite3changeset_start_v2 +** CAPI3REF: Flags for tdsqlite3changeset_start_v2 ** ** The following flags may passed via the 4th parameter to -** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]: +** [tdsqlite3changeset_start_v2] and [tdsqlite3changeset_start_v2_strm]: ** **
SQLITE_CHANGESETAPPLY_INVERT
** Invert the changeset while iterating through it. This is equivalent to -** inverting a changeset using sqlite3changeset_invert() before applying it. +** inverting a changeset using tdsqlite3changeset_invert() before applying it. ** It is an error to specify this flag with a patchset. */ #define SQLITE_CHANGESETSTART_INVERT 0x0002 @@ -11412,20 +11412,20 @@ SQLITE_API int sqlite3changeset_start_v2( /* ** CAPI3REF: Advance A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** This function may only be used with iterators created by the function -** [sqlite3changeset_start()]. If it is called on an iterator passed to -** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE +** [tdsqlite3changeset_start()]. If it is called on an iterator passed to +** a conflict-handler callback by [tdsqlite3changeset_apply()], SQLITE_MISUSE ** is returned and the call has no effect. ** -** Immediately after an iterator is created by sqlite3changeset_start(), it +** Immediately after an iterator is created by tdsqlite3changeset_start(), it ** does not point to any change in the changeset. Assuming the changeset ** is not empty, the first call to this function advances the iterator to ** point to the first change in the changeset. Each subsequent call advances ** the iterator to point to the next change in the changeset (if any). If ** no error occurs and the iterator points to a valid change after a call -** to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned. +** to tdsqlite3changeset_next() has advanced it, SQLITE_ROW is returned. ** Otherwise, if all changes in the changeset have already been visited, ** SQLITE_DONE is returned. ** @@ -11433,27 +11433,27 @@ SQLITE_API int sqlite3changeset_start_v2( ** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or ** SQLITE_NOMEM. */ -SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter); +SQLITE_API int tdsqlite3changeset_next(tdsqlite3_changeset_iter *pIter); /* ** CAPI3REF: Obtain The Current Operation From A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** The pIter argument passed to this function may either be an iterator -** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator -** created by [sqlite3changeset_start()]. In the latter case, the most recent -** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this +** passed to a conflict-handler by [tdsqlite3changeset_apply()], or an iterator +** created by [tdsqlite3changeset_start()]. In the latter case, the most recent +** call to [tdsqlite3changeset_next()] must have returned [SQLITE_ROW]. If this ** is not the case, this function returns [SQLITE_MISUSE]. ** ** If argument pzTab is not NULL, then *pzTab is set to point to a ** nul-terminated utf-8 encoded string containing the name of the table ** affected by the current change. The buffer remains valid until either -** sqlite3changeset_next() is called on the iterator or until the +** tdsqlite3changeset_next() is called on the iterator or until the ** conflict-handler function returns. If pnCol is not NULL, then *pnCol is ** set to the number of columns in the table affected by the change. If ** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change ** is an indirect change, or false (0) otherwise. See the documentation for -** [sqlite3session_indirect()] for a description of direct and indirect +** [tdsqlite3session_indirect()] for a description of direct and indirect ** changes. Finally, if pOp is not NULL, then *pOp is set to one of ** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the ** type of change that the iterator currently points to. @@ -11462,8 +11462,8 @@ SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter); ** SQLite error code is returned. The values of the output variables may not ** be trusted in this case. */ -SQLITE_API int sqlite3changeset_op( - sqlite3_changeset_iter *pIter, /* Iterator object */ +SQLITE_API int tdsqlite3changeset_op( + tdsqlite3_changeset_iter *pIter, /* Iterator object */ const char **pzTab, /* OUT: Pointer to table name */ int *pnCol, /* OUT: Number of columns in table */ int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */ @@ -11472,7 +11472,7 @@ SQLITE_API int sqlite3changeset_op( /* ** CAPI3REF: Obtain The Primary Key Definition Of A Table -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** For each modified table, a changeset includes the following: ** @@ -11496,20 +11496,20 @@ SQLITE_API int sqlite3changeset_op( ** SQLITE_OK is returned and the output variables populated as described ** above. */ -SQLITE_API int sqlite3changeset_pk( - sqlite3_changeset_iter *pIter, /* Iterator object */ +SQLITE_API int tdsqlite3changeset_pk( + tdsqlite3_changeset_iter *pIter, /* Iterator object */ unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */ int *pnCol /* OUT: Number of entries in output array */ ); /* ** CAPI3REF: Obtain old.* Values From A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** The pIter argument passed to this function may either be an iterator -** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator -** created by [sqlite3changeset_start()]. In the latter case, the most recent -** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. +** passed to a conflict-handler by [tdsqlite3changeset_apply()], or an iterator +** created by [tdsqlite3changeset_start()]. In the latter case, the most recent +** call to [tdsqlite3changeset_next()] must have returned SQLITE_ROW. ** Furthermore, it may only be called if the type of change that the iterator ** currently points to is either [SQLITE_DELETE] or [SQLITE_UPDATE]. Otherwise, ** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL. @@ -11519,7 +11519,7 @@ SQLITE_API int sqlite3changeset_pk( ** [SQLITE_RANGE] is returned and *ppValue is set to NULL. ** ** If successful, this function sets *ppValue to point to a protected -** sqlite3_value object containing the iVal'th value from the vector of +** tdsqlite3_value object containing the iVal'th value from the vector of ** original row values stored as part of the UPDATE or DELETE change and ** returns SQLITE_OK. The name of the function comes from the fact that this ** is similar to the "old.*" columns available to update or delete triggers. @@ -11527,20 +11527,20 @@ SQLITE_API int sqlite3changeset_pk( ** If some other error occurs (e.g. an OOM condition), an SQLite error code ** is returned and *ppValue is set to NULL. */ -SQLITE_API int sqlite3changeset_old( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +SQLITE_API int tdsqlite3changeset_old( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Column number */ - sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ + tdsqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ ); /* ** CAPI3REF: Obtain new.* Values From A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** The pIter argument passed to this function may either be an iterator -** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator -** created by [sqlite3changeset_start()]. In the latter case, the most recent -** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. +** passed to a conflict-handler by [tdsqlite3changeset_apply()], or an iterator +** created by [tdsqlite3changeset_start()]. In the latter case, the most recent +** call to [tdsqlite3changeset_next()] must have returned SQLITE_ROW. ** Furthermore, it may only be called if the type of change that the iterator ** currently points to is either [SQLITE_UPDATE] or [SQLITE_INSERT]. Otherwise, ** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL. @@ -11550,7 +11550,7 @@ SQLITE_API int sqlite3changeset_old( ** [SQLITE_RANGE] is returned and *ppValue is set to NULL. ** ** If successful, this function sets *ppValue to point to a protected -** sqlite3_value object containing the iVal'th value from the vector of +** tdsqlite3_value object containing the iVal'th value from the vector of ** new row values stored as part of the UPDATE or INSERT change and ** returns SQLITE_OK. If the change is an UPDATE and does not include ** a new value for the requested column, *ppValue is set to NULL and @@ -11561,18 +11561,18 @@ SQLITE_API int sqlite3changeset_old( ** If some other error occurs (e.g. an OOM condition), an SQLite error code ** is returned and *ppValue is set to NULL. */ -SQLITE_API int sqlite3changeset_new( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +SQLITE_API int tdsqlite3changeset_new( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Column number */ - sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ + tdsqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ ); /* ** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** This function should only be used with iterator objects passed to a -** conflict-handler callback by [sqlite3changeset_apply()] with either +** conflict-handler callback by [tdsqlite3changeset_apply()] with either ** [SQLITE_CHANGESET_DATA] or [SQLITE_CHANGESET_CONFLICT]. If this function ** is called on any other iterator, [SQLITE_MISUSE] is returned and *ppValue ** is set to NULL. @@ -11582,22 +11582,22 @@ SQLITE_API int sqlite3changeset_new( ** [SQLITE_RANGE] is returned and *ppValue is set to NULL. ** ** If successful, this function sets *ppValue to point to a protected -** sqlite3_value object containing the iVal'th value from the +** tdsqlite3_value object containing the iVal'th value from the ** "conflicting row" associated with the current conflict-handler callback ** and returns SQLITE_OK. ** ** If some other error occurs (e.g. an OOM condition), an SQLite error code ** is returned and *ppValue is set to NULL. */ -SQLITE_API int sqlite3changeset_conflict( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +SQLITE_API int tdsqlite3changeset_conflict( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Column number */ - sqlite3_value **ppValue /* OUT: Value from conflicting row */ + tdsqlite3_value **ppValue /* OUT: Value from conflicting row */ ); /* ** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** This function may only be called with an iterator passed to an ** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case @@ -11606,43 +11606,43 @@ SQLITE_API int sqlite3changeset_conflict( ** ** In all other cases this function returns SQLITE_MISUSE. */ -SQLITE_API int sqlite3changeset_fk_conflicts( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +SQLITE_API int tdsqlite3changeset_fk_conflicts( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int *pnOut /* OUT: Number of FK violations */ ); /* ** CAPI3REF: Finalize A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** This function is used to finalize an iterator allocated with -** [sqlite3changeset_start()]. +** [tdsqlite3changeset_start()]. ** ** This function should only be called on iterators created using the -** [sqlite3changeset_start()] function. If an application calls this +** [tdsqlite3changeset_start()] function. If an application calls this ** function with an iterator passed to a conflict-handler by -** [sqlite3changeset_apply()], [SQLITE_MISUSE] is immediately returned and the +** [tdsqlite3changeset_apply()], [SQLITE_MISUSE] is immediately returned and the ** call has no effect. ** -** If an error was encountered within a call to an sqlite3changeset_xxx() -** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an -** [SQLITE_NOMEM] in [sqlite3changeset_new()]) then an error code corresponding +** If an error was encountered within a call to an tdsqlite3changeset_xxx() +** function (for example an [SQLITE_CORRUPT] in [tdsqlite3changeset_next()] or an +** [SQLITE_NOMEM] in [tdsqlite3changeset_new()]) then an error code corresponding ** to that error is returned by this function. Otherwise, SQLITE_OK is ** returned. This is to allow the following pattern (pseudo-code): ** **
-**   sqlite3changeset_start();
-**   while( SQLITE_ROW==sqlite3changeset_next() ){
+**   tdsqlite3changeset_start();
+**   while( SQLITE_ROW==tdsqlite3changeset_next() ){
 **     // Do something with change.
 **   }
-**   rc = sqlite3changeset_finalize();
+**   rc = tdsqlite3changeset_finalize();
 **   if( rc!=SQLITE_OK ){
 **     // An error has occurred 
 **   }
 ** 
*/ -SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); +SQLITE_API int tdsqlite3changeset_finalize(tdsqlite3_changeset_iter *pIter); /* ** CAPI3REF: Invert A Changeset @@ -11665,14 +11665,14 @@ SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); ** SQLITE_OK is returned. If an error occurs, both *pnOut and *ppOut are ** zeroed and an SQLite error code returned. ** -** It is the responsibility of the caller to eventually call sqlite3_free() +** It is the responsibility of the caller to eventually call tdsqlite3_free() ** on the *ppOut pointer to free the buffer allocation following a successful ** call to this function. ** ** WARNING/TODO: This function currently assumes that the input is a valid ** changeset. If it is not, the results are undefined. */ -SQLITE_API int sqlite3changeset_invert( +SQLITE_API int tdsqlite3changeset_invert( int nIn, const void *pIn, /* Input changeset */ int *pnOut, void **ppOut /* OUT: Inverse of input */ ); @@ -11685,25 +11685,25 @@ SQLITE_API int sqlite3changeset_invert( ** changeset A followed by changeset B. ** ** This function combines the two input changesets using an -** sqlite3_changegroup object. Calling it produces similar results as the +** tdsqlite3_changegroup object. Calling it produces similar results as the ** following code fragment: ** **
-**   sqlite3_changegroup *pGrp;
-**   rc = sqlite3_changegroup_new(&pGrp);
-**   if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA);
-**   if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB);
+**   tdsqlite3_changegroup *pGrp;
+**   rc = tdsqlite3_changegroup_new(&pGrp);
+**   if( rc==SQLITE_OK ) rc = tdsqlite3changegroup_add(pGrp, nA, pA);
+**   if( rc==SQLITE_OK ) rc = tdsqlite3changegroup_add(pGrp, nB, pB);
 **   if( rc==SQLITE_OK ){
-**     rc = sqlite3changegroup_output(pGrp, pnOut, ppOut);
+**     rc = tdsqlite3changegroup_output(pGrp, pnOut, ppOut);
 **   }else{
 **     *ppOut = 0;
 **     *pnOut = 0;
 **   }
 ** 
** -** Refer to the sqlite3_changegroup documentation below for details. +** Refer to the tdsqlite3_changegroup documentation below for details. */ -SQLITE_API int sqlite3changeset_concat( +SQLITE_API int tdsqlite3changeset_concat( int nA, /* Number of bytes in buffer pA */ void *pA, /* Pointer to buffer containing changeset A */ int nB, /* Number of bytes in buffer pB */ @@ -11719,49 +11719,49 @@ SQLITE_API int sqlite3changeset_concat( ** A changegroup is an object used to combine two or more ** [changesets] or [patchsets] */ -typedef struct sqlite3_changegroup sqlite3_changegroup; +typedef struct tdsqlite3_changegroup tdsqlite3_changegroup; /* ** CAPI3REF: Create A New Changegroup Object -** CONSTRUCTOR: sqlite3_changegroup +** CONSTRUCTOR: tdsqlite3_changegroup ** -** An sqlite3_changegroup object is used to combine two or more changesets +** An tdsqlite3_changegroup object is used to combine two or more changesets ** (or patchsets) into a single changeset (or patchset). A single changegroup ** object may combine changesets or patchsets, but not both. The output is ** always in the same format as the input. ** ** If successful, this function returns SQLITE_OK and populates (*pp) with -** a pointer to a new sqlite3_changegroup object before returning. The caller +** a pointer to a new tdsqlite3_changegroup object before returning. The caller ** should eventually free the returned object using a call to -** sqlite3changegroup_delete(). If an error occurs, an SQLite error code +** tdsqlite3changegroup_delete(). If an error occurs, an SQLite error code ** (i.e. SQLITE_NOMEM) is returned and *pp is set to NULL. ** -** The usual usage pattern for an sqlite3_changegroup object is as follows: +** The usual usage pattern for an tdsqlite3_changegroup object is as follows: ** **
    -**
  • It is created using a call to sqlite3changegroup_new(). +**
  • It is created using a call to tdsqlite3changegroup_new(). ** **
  • Zero or more changesets (or patchsets) are added to the object -** by calling sqlite3changegroup_add(). +** by calling tdsqlite3changegroup_add(). ** **
  • The result of combining all input changesets together is obtained -** by the application via a call to sqlite3changegroup_output(). +** by the application via a call to tdsqlite3changegroup_output(). ** -**
  • The object is deleted using a call to sqlite3changegroup_delete(). +**
  • The object is deleted using a call to tdsqlite3changegroup_delete(). **
** ** Any number of calls to add() and output() may be made between the calls to ** new() and delete(), and in any order. ** -** As well as the regular sqlite3changegroup_add() and -** sqlite3changegroup_output() functions, also available are the streaming -** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm(). +** As well as the regular tdsqlite3changegroup_add() and +** tdsqlite3changegroup_output() functions, also available are the streaming +** versions tdsqlite3changegroup_add_strm() and tdsqlite3changegroup_output_strm(). */ -SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); +SQLITE_API int tdsqlite3changegroup_new(tdsqlite3_changegroup **pp); /* ** CAPI3REF: Add A Changeset To A Changegroup -** METHOD: sqlite3_changegroup +** METHOD: tdsqlite3_changegroup ** ** Add all changes within the changeset (or patchset) in buffer pData (size ** nData bytes) to the changegroup. @@ -11835,19 +11835,19 @@ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); ** ** If no error occurs, SQLITE_OK is returned. */ -SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); +SQLITE_API int tdsqlite3changegroup_add(tdsqlite3_changegroup*, int nData, void *pData); /* ** CAPI3REF: Obtain A Composite Changeset From A Changegroup -** METHOD: sqlite3_changegroup +** METHOD: tdsqlite3_changegroup ** ** Obtain a buffer containing a changeset (or patchset) representing the ** current contents of the changegroup. If the inputs to the changegroup ** were themselves changesets, the output is a changeset. Or, if the ** inputs were patchsets, the output is also a patchset. ** -** As with the output of the sqlite3session_changeset() and -** sqlite3session_patchset() functions, all changes related to a single +** As with the output of the tdsqlite3session_changeset() and +** tdsqlite3session_patchset() functions, all changes related to a single ** table are grouped together in the output of this function. Tables appear ** in the same order as for the very first changeset added to the changegroup. ** If the second or subsequent changesets added to the changegroup contain @@ -11860,19 +11860,19 @@ SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pDa ** is returned and the output variables are set to the size of and a ** pointer to the output buffer, respectively. In this case it is the ** responsibility of the caller to eventually free the buffer using a -** call to sqlite3_free(). +** call to tdsqlite3_free(). */ -SQLITE_API int sqlite3changegroup_output( - sqlite3_changegroup*, +SQLITE_API int tdsqlite3changegroup_output( + tdsqlite3_changegroup*, int *pnData, /* OUT: Size of output buffer in bytes */ void **ppData /* OUT: Pointer to output buffer */ ); /* ** CAPI3REF: Delete A Changegroup Object -** DESTRUCTOR: sqlite3_changegroup +** DESTRUCTOR: tdsqlite3_changegroup */ -SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*); +SQLITE_API void tdsqlite3changegroup_delete(tdsqlite3_changegroup*); /* ** CAPI3REF: Apply A Changeset To A Database @@ -11905,13 +11905,13 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*); ** ** If there is no compatible table, it is not an error, but none of the ** changes associated with the table are applied. A warning message is issued -** via the sqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most +** via the tdsqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most ** one such warning is issued for each table in the changeset. ** ** For each change for which there is a compatible table, an attempt is made ** to modify the table contents according to the UPDATE, INSERT or DELETE ** change. If a change cannot be applied cleanly, the conflict handler -** function passed as the fifth argument to sqlite3changeset_apply() may be +** function passed as the fifth argument to tdsqlite3changeset_apply() may be ** invoked. A description of exactly when the conflict handler is invoked for ** each type of change is below. ** @@ -11925,8 +11925,8 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*); ** if the second argument passed to the conflict handler is either ** SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If the conflict-handler ** returns an illegal value, any changes already made are rolled back and -** the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different -** actions are taken by sqlite3changeset_apply() depending on the value +** the call to tdsqlite3changeset_apply() returns SQLITE_MISUSE. Different +** actions are taken by tdsqlite3changeset_apply() depending on the value ** returned by each invocation of the conflict-handler function. Refer to ** the documentation for the three ** [SQLITE_CHANGESET_OMIT|available return values] for details. @@ -12016,24 +12016,24 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*); ** SQLite error code returned. ** ** If the output parameters (ppRebase) and (pnRebase) are non-NULL and -** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2() +** the input is a changeset (not a patchset), then tdsqlite3changeset_apply_v2() ** may set (*ppRebase) to point to a "rebase" that may be used with the -** sqlite3_rebaser APIs buffer before returning. In this case (*pnRebase) +** tdsqlite3_rebaser APIs buffer before returning. In this case (*pnRebase) ** is set to the size of the buffer in bytes. It is the responsibility of the -** caller to eventually free any such buffer using sqlite3_free(). The buffer +** caller to eventually free any such buffer using tdsqlite3_free(). The buffer ** is only allocated and populated if one or more conflicts were encountered -** while applying the patchset. See comments surrounding the sqlite3_rebaser +** while applying the patchset. See comments surrounding the tdsqlite3_rebaser ** APIs for further details. ** -** The behavior of sqlite3changeset_apply_v2() and its streaming equivalent +** The behavior of tdsqlite3changeset_apply_v2() and its streaming equivalent ** may be modified by passing a combination of ** [SQLITE_CHANGESETAPPLY_NOSAVEPOINT | supported flags] as the 9th parameter. ** -** Note that the sqlite3changeset_apply_v2() API is still experimental +** Note that the tdsqlite3changeset_apply_v2() API is still experimental ** and therefore subject to change. */ -SQLITE_API int sqlite3changeset_apply( - sqlite3 *db, /* Apply change to "main" db of this handle */ +SQLITE_API int tdsqlite3changeset_apply( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int nChangeset, /* Size of changeset in bytes */ void *pChangeset, /* Changeset blob */ int(*xFilter)( @@ -12043,12 +12043,12 @@ SQLITE_API int sqlite3changeset_apply( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx /* First argument passed to xConflict */ ); -SQLITE_API int sqlite3changeset_apply_v2( - sqlite3 *db, /* Apply change to "main" db of this handle */ +SQLITE_API int tdsqlite3changeset_apply_v2( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int nChangeset, /* Size of changeset in bytes */ void *pChangeset, /* Changeset blob */ int(*xFilter)( @@ -12058,7 +12058,7 @@ SQLITE_API int sqlite3changeset_apply_v2( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx, /* First argument passed to xConflict */ void **ppRebase, int *pnRebase, /* OUT: Rebase data */ @@ -12066,10 +12066,10 @@ SQLITE_API int sqlite3changeset_apply_v2( ); /* -** CAPI3REF: Flags for sqlite3changeset_apply_v2 +** CAPI3REF: Flags for tdsqlite3changeset_apply_v2 ** ** The following flags may passed via the 9th parameter to -** [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +** [tdsqlite3changeset_apply_v2] and [tdsqlite3changeset_apply_v2_strm]: ** **
**
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
@@ -12083,7 +12083,7 @@ SQLITE_API int sqlite3changeset_apply_v2( ** **
SQLITE_CHANGESETAPPLY_INVERT
** Invert the changeset before applying it. This is equivalent to inverting -** a changeset using sqlite3changeset_invert() before applying it. It is +** a changeset using tdsqlite3changeset_invert() before applying it. It is ** an error to specify this flag with a patchset. */ #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 @@ -12111,7 +12111,7 @@ SQLITE_API int sqlite3changeset_apply_v2( ** required PRIMARY KEY fields is not present in the database. ** ** There is no conflicting row in this case. The results of invoking the -** sqlite3changeset_conflict() API are undefined. +** tdsqlite3changeset_conflict() API are undefined. ** **
SQLITE_CHANGESET_CONFLICT
** CHANGESET_CONFLICT is passed as the second argument to the conflict @@ -12131,8 +12131,8 @@ SQLITE_API int sqlite3changeset_apply_v2( ** CHANGESET_ABORT, the changeset is rolled back. ** ** No current or conflicting row information is provided. The only function -** it is possible to call on the supplied sqlite3_changeset_iter handle -** is sqlite3changeset_fk_conflicts(). +** it is possible to call on the supplied tdsqlite3_changeset_iter handle +** is tdsqlite3changeset_fk_conflicts(). ** **
SQLITE_CHANGESET_CONSTRAINT
** If any other constraint violation occurs while applying a change (i.e. @@ -12140,7 +12140,7 @@ SQLITE_API int sqlite3changeset_apply_v2( ** invoked with CHANGESET_CONSTRAINT as the second argument. ** ** There is no conflicting row in this case. The results of invoking the -** sqlite3changeset_conflict() API are undefined. +** tdsqlite3changeset_conflict() API are undefined. ** **
*/ @@ -12165,7 +12165,7 @@ SQLITE_API int sqlite3changeset_apply_v2( ** This value may only be returned if the second argument to the conflict ** handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this ** is not the case, any changes applied so far are rolled back and the -** call to sqlite3changeset_apply() returns SQLITE_MISUSE. +** call to tdsqlite3changeset_apply() returns SQLITE_MISUSE. ** ** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict ** handler, then the conflicting row is either updated or deleted, depending @@ -12178,7 +12178,7 @@ SQLITE_API int sqlite3changeset_apply_v2( ** **
SQLITE_CHANGESET_ABORT
** If this value is returned, any changes applied so far are rolled back -** and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +** and the call to tdsqlite3changeset_apply() returns SQLITE_ABORT. ** */ #define SQLITE_CHANGESET_OMIT 0 @@ -12266,24 +12266,24 @@ SQLITE_API int sqlite3changeset_apply_v2( ** OMIT. ** ** In order to rebase a local changeset, the remote changeset must first -** be applied to the local database using sqlite3changeset_apply_v2() and +** be applied to the local database using tdsqlite3changeset_apply_v2() and ** the buffer of rebase information captured. Then: ** **
    -**
  1. An sqlite3_rebaser object is created by calling -** sqlite3rebaser_create(). +**
  2. An tdsqlite3_rebaser object is created by calling +** tdsqlite3rebaser_create(). **
  3. The new object is configured with the rebase buffer obtained from -** sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +** tdsqlite3changeset_apply_v2() by calling tdsqlite3rebaser_configure(). ** If the local changeset is to be rebased against multiple remote -** changesets, then sqlite3rebaser_configure() should be called +** changesets, then tdsqlite3rebaser_configure() should be called ** multiple times, in the same order that the multiple -** sqlite3changeset_apply_v2() calls were made. -**
  4. Each local changeset is rebased by calling sqlite3rebaser_rebase(). -**
  5. The sqlite3_rebaser object is deleted by calling -** sqlite3rebaser_delete(). +** tdsqlite3changeset_apply_v2() calls were made. +**
  6. Each local changeset is rebased by calling tdsqlite3rebaser_rebase(). +**
  7. The tdsqlite3_rebaser object is deleted by calling +** tdsqlite3rebaser_delete(). **
*/ -typedef struct sqlite3_rebaser sqlite3_rebaser; +typedef struct tdsqlite3_rebaser tdsqlite3_rebaser; /* ** CAPI3REF: Create a changeset rebaser object. @@ -12294,7 +12294,7 @@ typedef struct sqlite3_rebaser sqlite3_rebaser; ** occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew) ** to NULL. */ -SQLITE_API int sqlite3rebaser_create(sqlite3_rebaser **ppNew); +SQLITE_API int tdsqlite3rebaser_create(tdsqlite3_rebaser **ppNew); /* ** CAPI3REF: Configure a changeset rebaser object. @@ -12303,10 +12303,10 @@ SQLITE_API int sqlite3rebaser_create(sqlite3_rebaser **ppNew); ** Configure the changeset rebaser object to rebase changesets according ** to the conflict resolutions described by buffer pRebase (size nRebase ** bytes), which must have been obtained from a previous call to -** sqlite3changeset_apply_v2(). +** tdsqlite3changeset_apply_v2(). */ -SQLITE_API int sqlite3rebaser_configure( - sqlite3_rebaser*, +SQLITE_API int tdsqlite3rebaser_configure( + tdsqlite3_rebaser*, int nRebase, const void *pRebase ); @@ -12321,11 +12321,11 @@ SQLITE_API int sqlite3rebaser_configure( ** is set to point to the new buffer containing the rebased changeset and ** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the ** responsibility of the caller to eventually free the new buffer using -** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) +** tdsqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) ** are set to zero and an SQLite error code returned. */ -SQLITE_API int sqlite3rebaser_rebase( - sqlite3_rebaser*, +SQLITE_API int tdsqlite3rebaser_rebase( + tdsqlite3_rebaser*, int nIn, const void *pIn, int *pnOut, void **ppOut ); @@ -12336,9 +12336,9 @@ SQLITE_API int sqlite3rebaser_rebase( ** ** Delete the changeset rebaser object and all associated resources. There ** should be one call to this function for each successful invocation -** of sqlite3rebaser_create(). +** of tdsqlite3rebaser_create(). */ -SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p); +SQLITE_API void tdsqlite3rebaser_delete(tdsqlite3_rebaser *p); /* ** CAPI3REF: Streaming Versions of API functions. @@ -12348,19 +12348,19 @@ SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p); ** ** ** -**
Streaming functionNon-streaming equivalent
sqlite3changeset_apply_strm[sqlite3changeset_apply] -**
sqlite3changeset_apply_strm_v2[sqlite3changeset_apply_v2] -**
sqlite3changeset_concat_strm[sqlite3changeset_concat] -**
sqlite3changeset_invert_strm[sqlite3changeset_invert] -**
sqlite3changeset_start_strm[sqlite3changeset_start] -**
sqlite3session_changeset_strm[sqlite3session_changeset] -**
sqlite3session_patchset_strm[sqlite3session_patchset] +**
tdsqlite3changeset_apply_strm[tdsqlite3changeset_apply] +**
tdsqlite3changeset_apply_strm_v2[tdsqlite3changeset_apply_v2] +**
tdsqlite3changeset_concat_strm[tdsqlite3changeset_concat] +**
tdsqlite3changeset_invert_strm[tdsqlite3changeset_invert] +**
tdsqlite3changeset_start_strm[tdsqlite3changeset_start] +**
tdsqlite3session_changeset_strm[tdsqlite3session_changeset] +**
tdsqlite3session_patchset_strm[tdsqlite3session_patchset] **
** ** Non-streaming functions that accept changesets (or patchsets) as input ** require that the entire changeset be stored in a single buffer in memory. ** Similarly, those that return a changeset or patchset do so by returning -** a pointer to a single large buffer allocated using sqlite3_malloc(). +** a pointer to a single large buffer allocated using tdsqlite3_malloc(). ** Normally this is convenient. However, if an application running in a ** low-memory environment is required to handle very large changesets, the ** large contiguous memory allocations required can become onerous. @@ -12393,7 +12393,7 @@ SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p); ** an error, all processing is abandoned and the streaming API function ** returns a copy of the error code to the caller. ** -** In the case of sqlite3changeset_start_strm(), the xInput callback may be +** In the case of tdsqlite3changeset_start_strm(), the xInput callback may be ** invoked by the sessions module at any point during the lifetime of the ** iterator. If such an xInput callback returns an error, the iterator enters ** an error state, whereby all subsequent calls to iterator functions @@ -12430,8 +12430,8 @@ SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p); ** parameter set to a value less than or equal to zero. Other than this, ** no guarantees are made as to the size of the chunks of data returned. */ -SQLITE_API int sqlite3changeset_apply_strm( - sqlite3 *db, /* Apply change to "main" db of this handle */ +SQLITE_API int tdsqlite3changeset_apply_strm( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ void *pIn, /* First arg for xInput */ int(*xFilter)( @@ -12441,12 +12441,12 @@ SQLITE_API int sqlite3changeset_apply_strm( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx /* First argument passed to xConflict */ ); -SQLITE_API int sqlite3changeset_apply_v2_strm( - sqlite3 *db, /* Apply change to "main" db of this handle */ +SQLITE_API int tdsqlite3changeset_apply_v2_strm( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ void *pIn, /* First arg for xInput */ int(*xFilter)( @@ -12456,13 +12456,13 @@ SQLITE_API int sqlite3changeset_apply_v2_strm( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx, /* First argument passed to xConflict */ void **ppRebase, int *pnRebase, int flags ); -SQLITE_API int sqlite3changeset_concat_strm( +SQLITE_API int tdsqlite3changeset_concat_strm( int (*xInputA)(void *pIn, void *pData, int *pnData), void *pInA, int (*xInputB)(void *pIn, void *pData, int *pnData), @@ -12470,43 +12470,43 @@ SQLITE_API int sqlite3changeset_concat_strm( int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -SQLITE_API int sqlite3changeset_invert_strm( +SQLITE_API int tdsqlite3changeset_invert_strm( int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -SQLITE_API int sqlite3changeset_start_strm( - sqlite3_changeset_iter **pp, +SQLITE_API int tdsqlite3changeset_start_strm( + tdsqlite3_changeset_iter **pp, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn ); -SQLITE_API int sqlite3changeset_start_v2_strm( - sqlite3_changeset_iter **pp, +SQLITE_API int tdsqlite3changeset_start_v2_strm( + tdsqlite3_changeset_iter **pp, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int flags ); -SQLITE_API int sqlite3session_changeset_strm( - sqlite3_session *pSession, +SQLITE_API int tdsqlite3session_changeset_strm( + tdsqlite3_session *pSession, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -SQLITE_API int sqlite3session_patchset_strm( - sqlite3_session *pSession, +SQLITE_API int tdsqlite3session_patchset_strm( + tdsqlite3_session *pSession, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -SQLITE_API int sqlite3changegroup_add_strm(sqlite3_changegroup*, +SQLITE_API int tdsqlite3changegroup_add_strm(tdsqlite3_changegroup*, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn ); -SQLITE_API int sqlite3changegroup_output_strm(sqlite3_changegroup*, +SQLITE_API int tdsqlite3changegroup_output_strm(tdsqlite3_changegroup*, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -SQLITE_API int sqlite3rebaser_rebase_strm( - sqlite3_rebaser *pRebaser, +SQLITE_API int tdsqlite3rebaser_rebase_strm( + tdsqlite3_rebaser *pRebaser, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int (*xOutput)(void *pOut, const void *pData, int nData), @@ -12516,16 +12516,16 @@ SQLITE_API int sqlite3rebaser_rebase_strm( /* ** CAPI3REF: Configure global parameters ** -** The sqlite3session_config() interface is used to make global configuration +** The tdsqlite3session_config() interface is used to make global configuration ** changes to the sessions module in order to tune it to the specific needs ** of the application. ** -** The sqlite3session_config() interface is not threadsafe. If it is invoked +** The tdsqlite3session_config() interface is not threadsafe. If it is invoked ** while any other thread is inside any other sessions method then the ** results are undefined. Furthermore, if it is invoked after any sessions ** related objects have been created, the results are also undefined. ** -** The first argument to the sqlite3session_config() function must be one +** The first argument to the tdsqlite3session_config() function must be one ** of the SQLITE_SESSION_CONFIG_XXX constants defined below. The ** interpretation of the (void*) value passed as the second parameter and ** the effect of calling this function depends on the value of the first @@ -12546,10 +12546,10 @@ SQLITE_API int sqlite3rebaser_rebase_strm( ** This function returns SQLITE_OK if successful, or an SQLite error code ** otherwise. */ -SQLITE_API int sqlite3session_config(int op, void *pArg); +SQLITE_API int tdsqlite3session_config(int op, void *pArg); /* -** CAPI3REF: Values for sqlite3session_config(). +** CAPI3REF: Values for tdsqlite3session_config(). */ #define SQLITE_SESSION_CONFIG_STRMSIZE 1 @@ -12562,7 +12562,7 @@ SQLITE_API int sqlite3session_config(int op, void *pArg); #endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */ -/******** End of sqlite3session.h *********/ +/******** End of tdsqlite3session.h *********/ /******** Begin file fts5.h *********/ /* ** 2014 May 31 @@ -12596,7 +12596,7 @@ extern "C" { ** CUSTOM AUXILIARY FUNCTIONS ** ** Virtual table implementations may overload SQL functions by implementing -** the sqlite3_module.xFindFunction() method. +** the tdsqlite3_module.xFindFunction() method. */ typedef struct Fts5ExtensionApi Fts5ExtensionApi; @@ -12606,9 +12606,9 @@ typedef struct Fts5PhraseIter Fts5PhraseIter; typedef void (*fts5_extension_function)( const Fts5ExtensionApi *pApi, /* API offered by current FTS version */ Fts5Context *pFts, /* First arg to pass to pApi functions */ - sqlite3_context *pCtx, /* Context for returning result/error */ + tdsqlite3_context *pCtx, /* Context for returning result/error */ int nVal, /* Number of values in apVal[] array */ - sqlite3_value **apVal /* Array of trailing arguments */ + tdsqlite3_value **apVal /* Array of trailing arguments */ ); struct Fts5PhraseIter { @@ -12833,8 +12833,8 @@ struct Fts5ExtensionApi { void *(*xUserData)(Fts5Context*); int (*xColumnCount)(Fts5Context*); - int (*xRowCount)(Fts5Context*, sqlite3_int64 *pnRow); - int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64 *pnToken); + int (*xRowCount)(Fts5Context*, tdsqlite3_int64 *pnRow); + int (*xColumnTotalSize)(Fts5Context*, int iCol, tdsqlite3_int64 *pnToken); int (*xTokenize)(Fts5Context*, const char *pText, int nText, /* Text to tokenize */ @@ -12848,7 +12848,7 @@ struct Fts5ExtensionApi { int (*xInstCount)(Fts5Context*, int *pnInst); int (*xInst)(Fts5Context*, int iIdx, int *piPhrase, int *piCol, int *piOff); - sqlite3_int64 (*xRowid)(Fts5Context*); + tdsqlite3_int64 (*xRowid)(Fts5Context*); int (*xColumnText)(Fts5Context*, int iCol, const char **pz, int *pn); int (*xColumnSize)(Fts5Context*, int iCol, int *pnToken); @@ -13582,8 +13582,8 @@ struct fts5_api { ** */ #ifdef SQLITE_COVERAGE_TEST -SQLITE_PRIVATE void sqlite3Coverage(int); -# define testcase(X) if( X ){ sqlite3Coverage(__LINE__); } +SQLITE_PRIVATE void tdsqlite3Coverage(int); +# define testcase(X) if( X ){ tdsqlite3Coverage(__LINE__); } #else # define testcase(X) #endif @@ -13694,8 +13694,8 @@ SQLITE_PRIVATE void sqlite3Coverage(int); */ #if defined(SQLITE_FORCE_OS_TRACE) || defined(SQLITE_TEST) || \ (defined(SQLITE_DEBUG) && SQLITE_OS_WIN) - extern int sqlite3OSTrace; -# define OSTRACE(X) if( sqlite3OSTrace ) sqlite3DebugPrintf X + extern int tdsqlite3OSTrace; +# define OSTRACE(X) if( tdsqlite3OSTrace ) tdsqlite3DebugPrintf X # define SQLITE_HAVE_OS_TRACE #else # define OSTRACE(X) @@ -13703,7 +13703,7 @@ SQLITE_PRIVATE void sqlite3Coverage(int); #endif /* -** Is the sqlite3ErrName() function needed in the build? Currently, +** Is the tdsqlite3ErrName() function needed in the build? Currently, ** it is needed by "mutex_w32.c" (when debugging), "os_win.c" (when ** OSTRACE is enabled), and by several "test*.c" files (which are ** compiled using SQLITE_TEST). @@ -13808,10 +13808,10 @@ struct HashElem { /* ** Access routines. To delete, insert a NULL pointer. */ -SQLITE_PRIVATE void sqlite3HashInit(Hash*); -SQLITE_PRIVATE void *sqlite3HashInsert(Hash*, const char *pKey, void *pData); -SQLITE_PRIVATE void *sqlite3HashFind(const Hash*, const char *pKey); -SQLITE_PRIVATE void sqlite3HashClear(Hash*); +SQLITE_PRIVATE void tdsqlite3HashInit(Hash*); +SQLITE_PRIVATE void *tdsqlite3HashInsert(Hash*, const char *pKey, void *pData); +SQLITE_PRIVATE void *tdsqlite3HashFind(const Hash*, const char *pKey); +SQLITE_PRIVATE void tdsqlite3HashClear(Hash*); /* ** Macros for looping over all elements of a hash table. The idiom is @@ -14052,7 +14052,7 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); # define float sqlite_int64 # define LONGDOUBLE_TYPE sqlite_int64 # ifndef SQLITE_BIG_DBL -# define SQLITE_BIG_DBL (((sqlite3_int64)1)<<50) +# define SQLITE_BIG_DBL (((tdsqlite3_int64)1)<<50) # endif # define SQLITE_OMIT_DATETIME_FUNCS 1 # define SQLITE_OMIT_TRACE 1 @@ -14349,12 +14349,12 @@ typedef INT16_TYPE LogEst; # define SQLITE_UTF16NATIVE SQLITE_UTF16LE #else # ifdef SQLITE_AMALGAMATION - const int sqlite3one = 1; + const int tdsqlite3one = 1; # else - extern const int sqlite3one; + extern const int tdsqlite3one; # endif -# define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0) -# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1) +# define SQLITE_BIGENDIAN (*(char *)(&tdsqlite3one)==0) +# define SQLITE_LITTLEENDIAN (*(char *)(&tdsqlite3one)==1) # define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE) #endif @@ -14456,7 +14456,7 @@ struct BusyHandler { int (*xBusyHandler)(void *,int); /* The busy callback */ void *pBusyArg; /* First arg to busy callback */ int nBusy; /* Incremented with each busy call */ - u8 bExtraFileArg; /* Include sqlite3_file as callback arg */ + u8 bExtraFileArg; /* Include tdsqlite3_file as callback arg */ }; /* @@ -14489,14 +14489,14 @@ struct BusyHandler { #define IsPowerOfTwo(X) (((X)&((X)-1))==0) /* -** The following value as a destructor means to use sqlite3DbFree(). -** The sqlite3DbFree() routine requires two parameters instead of the +** The following value as a destructor means to use tdsqlite3DbFree(). +** The tdsqlite3DbFree() routine requires two parameters instead of the ** one parameter that destructors normally want. So we have to introduce ** this magic value that the code knows to handle differently. Any ** pointer will work here as long as it is distinct from SQLITE_STATIC ** and SQLITE_TRANSIENT. */ -#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3MallocSize) +#define SQLITE_DYNAMIC ((tdsqlite3_destructor_type)tdsqlite3MallocSize) /* ** When SQLITE_OMIT_WSD is defined, it means that the target platform does @@ -14514,14 +14514,14 @@ struct BusyHandler { */ #ifdef SQLITE_OMIT_WSD #define SQLITE_WSD const - #define GLOBAL(t,v) (*(t*)sqlite3_wsd_find((void*)&(v), sizeof(v))) - #define sqlite3GlobalConfig GLOBAL(struct Sqlite3Config, sqlite3Config) -SQLITE_API int sqlite3_wsd_init(int N, int J); -SQLITE_API void *sqlite3_wsd_find(void *K, int L); + #define GLOBAL(t,v) (*(t*)tdsqlite3_wsd_find((void*)&(v), sizeof(v))) + #define tdsqlite3GlobalConfig GLOBAL(struct Sqlite3Config, tdsqlite3Config) +SQLITE_API int tdsqlite3_wsd_init(int N, int J); +SQLITE_API void *tdsqlite3_wsd_find(void *K, int L); #else #define SQLITE_WSD #define GLOBAL(t,v) v - #define sqlite3GlobalConfig sqlite3Config + #define tdsqlite3GlobalConfig tdsqlite3Config #endif /* @@ -14579,7 +14579,7 @@ typedef struct Select Select; typedef struct SQLiteThread SQLiteThread; typedef struct SelectDest SelectDest; typedef struct SrcList SrcList; -typedef struct sqlite3_str StrAccum; /* Internal alias for sqlite3_str */ +typedef struct tdsqlite3_str StrAccum; /* Internal alias for tdsqlite3_str */ typedef struct Table Table; typedef struct TableLock TableLock; typedef struct Token Token; @@ -14626,7 +14626,7 @@ typedef struct With With; /* A VList object records a mapping between parameters/variables/wildcards ** in the SQL statement (such as $abc, @pqr, or :xyz) and the integer ** variable number associated with that parameter. See the format description -** on the sqlite3VListAdd() routine for more information. A VList is really +** on the tdsqlite3VListAdd() routine for more information. A VList is really ** just an array of integers. */ typedef int VList; @@ -14682,16 +14682,16 @@ typedef struct BtShared BtShared; typedef struct BtreePayload BtreePayload; -SQLITE_PRIVATE int sqlite3BtreeOpen( - sqlite3_vfs *pVfs, /* VFS to use with this b-tree */ +SQLITE_PRIVATE int tdsqlite3BtreeOpen( + tdsqlite3_vfs *pVfs, /* VFS to use with this b-tree */ const char *zFilename, /* Name of database file to open */ - sqlite3 *db, /* Associated database connection */ + tdsqlite3 *db, /* Associated database connection */ Btree **ppBtree, /* Return open Btree* here */ int flags, /* Flags */ int vfsFlags /* Flags passed through to VFS open */ ); -/* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the +/* The flags parameter to tdsqlite3BtreeOpen can be the bitwise or of the ** following values. ** ** NOTE: These values must match the corresponding PAGER_ values in @@ -14702,46 +14702,46 @@ SQLITE_PRIVATE int sqlite3BtreeOpen( #define BTREE_SINGLE 4 /* The file contains at most 1 b-tree */ #define BTREE_UNORDERED 8 /* Use of a hash implementation is OK */ -SQLITE_PRIVATE int sqlite3BtreeClose(Btree*); -SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree*,int); -SQLITE_PRIVATE int sqlite3BtreeSetSpillSize(Btree*,int); +SQLITE_PRIVATE int tdsqlite3BtreeClose(Btree*); +SQLITE_PRIVATE int tdsqlite3BtreeSetCacheSize(Btree*,int); +SQLITE_PRIVATE int tdsqlite3BtreeSetSpillSize(Btree*,int); #if SQLITE_MAX_MMAP_SIZE>0 -SQLITE_PRIVATE int sqlite3BtreeSetMmapLimit(Btree*,sqlite3_int64); +SQLITE_PRIVATE int tdsqlite3BtreeSetMmapLimit(Btree*,tdsqlite3_int64); #endif -SQLITE_PRIVATE int sqlite3BtreeSetPagerFlags(Btree*,unsigned); -SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix); -SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree*); -SQLITE_PRIVATE int sqlite3BtreeMaxPageCount(Btree*,int); -SQLITE_PRIVATE u32 sqlite3BtreeLastPage(Btree*); -SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree*,int); -SQLITE_PRIVATE int sqlite3BtreeGetOptimalReserve(Btree*); -SQLITE_PRIVATE int sqlite3BtreeGetReserveNoMutex(Btree *p); -SQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *, int); -SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *); -SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree*,int,int*); -SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster); -SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree*, int); -SQLITE_PRIVATE int sqlite3BtreeCommit(Btree*); -SQLITE_PRIVATE int sqlite3BtreeRollback(Btree*,int,int); -SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree*,int); -SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree*, int*, int flags); -SQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree*); -SQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree*); -SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree*); -SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *, int, void(*)(void *)); -SQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *pBtree); +SQLITE_PRIVATE int tdsqlite3BtreeSetPagerFlags(Btree*,unsigned); +SQLITE_PRIVATE int tdsqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix); +SQLITE_PRIVATE int tdsqlite3BtreeGetPageSize(Btree*); +SQLITE_PRIVATE int tdsqlite3BtreeMaxPageCount(Btree*,int); +SQLITE_PRIVATE u32 tdsqlite3BtreeLastPage(Btree*); +SQLITE_PRIVATE int tdsqlite3BtreeSecureDelete(Btree*,int); +SQLITE_PRIVATE int tdsqlite3BtreeGetOptimalReserve(Btree*); +SQLITE_PRIVATE int tdsqlite3BtreeGetReserveNoMutex(Btree *p); +SQLITE_PRIVATE int tdsqlite3BtreeSetAutoVacuum(Btree *, int); +SQLITE_PRIVATE int tdsqlite3BtreeGetAutoVacuum(Btree *); +SQLITE_PRIVATE int tdsqlite3BtreeBeginTrans(Btree*,int,int*); +SQLITE_PRIVATE int tdsqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster); +SQLITE_PRIVATE int tdsqlite3BtreeCommitPhaseTwo(Btree*, int); +SQLITE_PRIVATE int tdsqlite3BtreeCommit(Btree*); +SQLITE_PRIVATE int tdsqlite3BtreeRollback(Btree*,int,int); +SQLITE_PRIVATE int tdsqlite3BtreeBeginStmt(Btree*,int); +SQLITE_PRIVATE int tdsqlite3BtreeCreateTable(Btree*, int*, int flags); +SQLITE_PRIVATE int tdsqlite3BtreeIsInTrans(Btree*); +SQLITE_PRIVATE int tdsqlite3BtreeIsInReadTrans(Btree*); +SQLITE_PRIVATE int tdsqlite3BtreeIsInBackup(Btree*); +SQLITE_PRIVATE void *tdsqlite3BtreeSchema(Btree *, int, void(*)(void *)); +SQLITE_PRIVATE int tdsqlite3BtreeSchemaLocked(Btree *pBtree); #ifndef SQLITE_OMIT_SHARED_CACHE -SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock); +SQLITE_PRIVATE int tdsqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock); #endif -SQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *, int, int); +SQLITE_PRIVATE int tdsqlite3BtreeSavepoint(Btree *, int, int); -SQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *); -SQLITE_PRIVATE const char *sqlite3BtreeGetJournalname(Btree *); -SQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *, Btree *); +SQLITE_PRIVATE const char *tdsqlite3BtreeGetFilename(Btree *); +SQLITE_PRIVATE const char *tdsqlite3BtreeGetJournalname(Btree *); +SQLITE_PRIVATE int tdsqlite3BtreeCopyFile(Btree *, Btree *); -SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *); +SQLITE_PRIVATE int tdsqlite3BtreeIncrVacuum(Btree *); -/* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR +/* The flags parameter to tdsqlite3BtreeCreateTable can be the bitwise OR ** of the flags shown below. ** ** Every SQLite table must have either BTREE_INTKEY or BTREE_BLOBKEY set. @@ -14754,18 +14754,18 @@ SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *); #define BTREE_INTKEY 1 /* Table has only 64-bit signed integer keys */ #define BTREE_BLOBKEY 2 /* Table has keys only - no data */ -SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree*, int, int*); -SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree*, int, int*); -SQLITE_PRIVATE int sqlite3BtreeClearTableOfCursor(BtCursor*); -SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree*, int, int); +SQLITE_PRIVATE int tdsqlite3BtreeDropTable(Btree*, int, int*); +SQLITE_PRIVATE int tdsqlite3BtreeClearTable(Btree*, int, int*); +SQLITE_PRIVATE int tdsqlite3BtreeClearTableOfCursor(BtCursor*); +SQLITE_PRIVATE int tdsqlite3BtreeTripAllCursors(Btree*, int, int); -SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue); -SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value); +SQLITE_PRIVATE void tdsqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue); +SQLITE_PRIVATE int tdsqlite3BtreeUpdateMeta(Btree*, int idx, u32 value); -SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p); +SQLITE_PRIVATE int tdsqlite3BtreeNewDb(Btree *p); /* -** The second parameter to sqlite3BtreeGetMeta or sqlite3BtreeUpdateMeta +** The second parameter to tdsqlite3BtreeGetMeta or tdsqlite3BtreeUpdateMeta ** should be one of the following values. The integer values are assigned ** to constants so that the offset of the corresponding field in an ** SQLite database header may be found using the following formula: @@ -14793,7 +14793,7 @@ SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p); #define BTREE_DATA_VERSION 15 /* A virtual meta-value */ /* -** Kinds of hints that can be passed into the sqlite3BtreeCursorHint() +** Kinds of hints that can be passed into the tdsqlite3BtreeCursorHint() ** interface. ** ** BTREE_HINT_RANGE (arguments: Expr*, Mem*) @@ -14823,7 +14823,7 @@ SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p); /* ** Values that may be OR'd together to form the argument to the -** BTREE_HINT_FLAGS hint for sqlite3BtreeCursorHint(): +** BTREE_HINT_FLAGS hint for tdsqlite3BtreeCursorHint(): ** ** The BTREE_BULKLOAD flag is set on index cursors when the index is going ** to be filled with content that is already in sorted order. @@ -14838,7 +14838,7 @@ SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p); #define BTREE_SEEK_EQ 0x00000002 /* EQ seeks only - no range seeks */ /* -** Flags passed as the third argument to sqlite3BtreeCursor(). +** Flags passed as the third argument to tdsqlite3BtreeCursor(). ** ** For read-only cursors the wrFlag argument is always zero. For read-write ** cursors it may be set to either (BTREE_WRCSR|BTREE_FORDELETE) or just @@ -14863,34 +14863,34 @@ SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p); #define BTREE_WRCSR 0x00000004 /* read-write cursor */ #define BTREE_FORDELETE 0x00000008 /* Cursor is for seek/delete only */ -SQLITE_PRIVATE int sqlite3BtreeCursor( +SQLITE_PRIVATE int tdsqlite3BtreeCursor( Btree*, /* BTree containing table to open */ int iTable, /* Index of root page */ int wrFlag, /* 1 for writing. 0 for read-only */ struct KeyInfo*, /* First argument to compare function */ BtCursor *pCursor /* Space to write cursor structure */ ); -SQLITE_PRIVATE BtCursor *sqlite3BtreeFakeValidCursor(void); -SQLITE_PRIVATE int sqlite3BtreeCursorSize(void); -SQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor*); -SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor*, unsigned); +SQLITE_PRIVATE BtCursor *tdsqlite3BtreeFakeValidCursor(void); +SQLITE_PRIVATE int tdsqlite3BtreeCursorSize(void); +SQLITE_PRIVATE void tdsqlite3BtreeCursorZero(BtCursor*); +SQLITE_PRIVATE void tdsqlite3BtreeCursorHintFlags(BtCursor*, unsigned); #ifdef SQLITE_ENABLE_CURSOR_HINTS -SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor*, int, ...); +SQLITE_PRIVATE void tdsqlite3BtreeCursorHint(BtCursor*, int, ...); #endif -SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor*); -SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( +SQLITE_PRIVATE int tdsqlite3BtreeCloseCursor(BtCursor*); +SQLITE_PRIVATE int tdsqlite3BtreeMovetoUnpacked( BtCursor*, UnpackedRecord *pUnKey, i64 intKey, int bias, int *pRes ); -SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor*); -SQLITE_PRIVATE int sqlite3BtreeCursorRestore(BtCursor*, int*); -SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*, u8 flags); +SQLITE_PRIVATE int tdsqlite3BtreeCursorHasMoved(BtCursor*); +SQLITE_PRIVATE int tdsqlite3BtreeCursorRestore(BtCursor*, int*); +SQLITE_PRIVATE int tdsqlite3BtreeDelete(BtCursor*, u8 flags); -/* Allowed flags for sqlite3BtreeDelete() and sqlite3BtreeInsert() */ +/* Allowed flags for tdsqlite3BtreeDelete() and tdsqlite3BtreeInsert() */ #define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */ #define BTREE_AUXDELETE 0x04 /* not the primary delete operation */ #define BTREE_APPEND 0x08 /* Insert is likely an append */ @@ -14922,7 +14922,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*, u8 flags); ** nData length of pData not used ** nZero extra zeros after pData not used ** -** This object is used to pass information into sqlite3BtreeInsert(). The +** This object is used to pass information into tdsqlite3BtreeInsert(). The ** same information used to be passed as five separate parameters. But placing ** the information into this object helps to keep the interface more ** organized and understandable, and it also helps the resulting code to @@ -14930,63 +14930,63 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*, u8 flags); */ struct BtreePayload { const void *pKey; /* Key content for indexes. NULL for tables */ - sqlite3_int64 nKey; /* Size of pKey for indexes. PRIMARY KEY for tabs */ + tdsqlite3_int64 nKey; /* Size of pKey for indexes. PRIMARY KEY for tabs */ const void *pData; /* Data for tables. */ - sqlite3_value *aMem; /* First of nMem value in the unpacked pKey */ + tdsqlite3_value *aMem; /* First of nMem value in the unpacked pKey */ u16 nMem; /* Number of aMem[] value. Might be zero */ int nData; /* Size of pData. 0 if none. */ int nZero; /* Extra zero data appended after pData,nData */ }; -SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const BtreePayload *pPayload, +SQLITE_PRIVATE int tdsqlite3BtreeInsert(BtCursor*, const BtreePayload *pPayload, int flags, int seekResult); -SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor*, int *pRes); -SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor*, int *pRes); -SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int flags); -SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor*); -SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int flags); -SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor*); -SQLITE_PRIVATE void sqlite3BtreeCursorPin(BtCursor*); -SQLITE_PRIVATE void sqlite3BtreeCursorUnpin(BtCursor*); +SQLITE_PRIVATE int tdsqlite3BtreeFirst(BtCursor*, int *pRes); +SQLITE_PRIVATE int tdsqlite3BtreeLast(BtCursor*, int *pRes); +SQLITE_PRIVATE int tdsqlite3BtreeNext(BtCursor*, int flags); +SQLITE_PRIVATE int tdsqlite3BtreeEof(BtCursor*); +SQLITE_PRIVATE int tdsqlite3BtreePrevious(BtCursor*, int flags); +SQLITE_PRIVATE i64 tdsqlite3BtreeIntegerKey(BtCursor*); +SQLITE_PRIVATE void tdsqlite3BtreeCursorPin(BtCursor*); +SQLITE_PRIVATE void tdsqlite3BtreeCursorUnpin(BtCursor*); #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC -SQLITE_PRIVATE i64 sqlite3BtreeOffset(BtCursor*); +SQLITE_PRIVATE i64 tdsqlite3BtreeOffset(BtCursor*); #endif -SQLITE_PRIVATE int sqlite3BtreePayload(BtCursor*, u32 offset, u32 amt, void*); -SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt); -SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor*); -SQLITE_PRIVATE sqlite3_int64 sqlite3BtreeMaxRecordSize(BtCursor*); +SQLITE_PRIVATE int tdsqlite3BtreePayload(BtCursor*, u32 offset, u32 amt, void*); +SQLITE_PRIVATE const void *tdsqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt); +SQLITE_PRIVATE u32 tdsqlite3BtreePayloadSize(BtCursor*); +SQLITE_PRIVATE tdsqlite3_int64 tdsqlite3BtreeMaxRecordSize(BtCursor*); -SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(sqlite3*,Btree*,int*aRoot,int nRoot,int,int*); -SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*); -SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor*); +SQLITE_PRIVATE char *tdsqlite3BtreeIntegrityCheck(tdsqlite3*,Btree*,int*aRoot,int nRoot,int,int*); +SQLITE_PRIVATE struct Pager *tdsqlite3BtreePager(Btree*); +SQLITE_PRIVATE i64 tdsqlite3BtreeRowCountEst(BtCursor*); #ifndef SQLITE_OMIT_INCRBLOB -SQLITE_PRIVATE int sqlite3BtreePayloadChecked(BtCursor*, u32 offset, u32 amt, void*); -SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*); -SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *); +SQLITE_PRIVATE int tdsqlite3BtreePayloadChecked(BtCursor*, u32 offset, u32 amt, void*); +SQLITE_PRIVATE int tdsqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*); +SQLITE_PRIVATE void tdsqlite3BtreeIncrblobCursor(BtCursor *); #endif -SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *); -SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion); -SQLITE_PRIVATE int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask); -SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *pBt); -SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void); +SQLITE_PRIVATE void tdsqlite3BtreeClearCursor(BtCursor *); +SQLITE_PRIVATE int tdsqlite3BtreeSetVersion(Btree *pBt, int iVersion); +SQLITE_PRIVATE int tdsqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask); +SQLITE_PRIVATE int tdsqlite3BtreeIsReadonly(Btree *pBt); +SQLITE_PRIVATE int tdsqlite3HeaderSizeBtree(void); #ifndef NDEBUG -SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*); +SQLITE_PRIVATE int tdsqlite3BtreeCursorIsValid(BtCursor*); #endif -SQLITE_PRIVATE int sqlite3BtreeCursorIsValidNN(BtCursor*); +SQLITE_PRIVATE int tdsqlite3BtreeCursorIsValidNN(BtCursor*); #ifndef SQLITE_OMIT_BTREECOUNT -SQLITE_PRIVATE int sqlite3BtreeCount(sqlite3*, BtCursor*, i64*); +SQLITE_PRIVATE int tdsqlite3BtreeCount(tdsqlite3*, BtCursor*, i64*); #endif #ifdef SQLITE_TEST -SQLITE_PRIVATE int sqlite3BtreeCursorInfo(BtCursor*, int*, int); -SQLITE_PRIVATE void sqlite3BtreeCursorList(Btree*); +SQLITE_PRIVATE int tdsqlite3BtreeCursorInfo(BtCursor*, int*, int); +SQLITE_PRIVATE void tdsqlite3BtreeCursorList(Btree*); #endif #ifndef SQLITE_OMIT_WAL -SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *); +SQLITE_PRIVATE int tdsqlite3BtreeCheckpoint(Btree*, int, int *, int *); #endif /* @@ -14995,38 +14995,38 @@ SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *); ** Enter and Leave procedures no-ops. */ #ifndef SQLITE_OMIT_SHARED_CACHE -SQLITE_PRIVATE void sqlite3BtreeEnter(Btree*); -SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3*); -SQLITE_PRIVATE int sqlite3BtreeSharable(Btree*); -SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor*); -SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree*); +SQLITE_PRIVATE void tdsqlite3BtreeEnter(Btree*); +SQLITE_PRIVATE void tdsqlite3BtreeEnterAll(tdsqlite3*); +SQLITE_PRIVATE int tdsqlite3BtreeSharable(Btree*); +SQLITE_PRIVATE void tdsqlite3BtreeEnterCursor(BtCursor*); +SQLITE_PRIVATE int tdsqlite3BtreeConnectionCount(Btree*); #else -# define sqlite3BtreeEnter(X) -# define sqlite3BtreeEnterAll(X) -# define sqlite3BtreeSharable(X) 0 -# define sqlite3BtreeEnterCursor(X) -# define sqlite3BtreeConnectionCount(X) 1 +# define tdsqlite3BtreeEnter(X) +# define tdsqlite3BtreeEnterAll(X) +# define tdsqlite3BtreeSharable(X) 0 +# define tdsqlite3BtreeEnterCursor(X) +# define tdsqlite3BtreeConnectionCount(X) 1 #endif #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE -SQLITE_PRIVATE void sqlite3BtreeLeave(Btree*); -SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor*); -SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3*); +SQLITE_PRIVATE void tdsqlite3BtreeLeave(Btree*); +SQLITE_PRIVATE void tdsqlite3BtreeLeaveCursor(BtCursor*); +SQLITE_PRIVATE void tdsqlite3BtreeLeaveAll(tdsqlite3*); #ifndef NDEBUG /* These routines are used inside assert() statements only. */ -SQLITE_PRIVATE int sqlite3BtreeHoldsMutex(Btree*); -SQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3*); -SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*); +SQLITE_PRIVATE int tdsqlite3BtreeHoldsMutex(Btree*); +SQLITE_PRIVATE int tdsqlite3BtreeHoldsAllMutexes(tdsqlite3*); +SQLITE_PRIVATE int tdsqlite3SchemaMutexHeld(tdsqlite3*,int,Schema*); #endif #else -# define sqlite3BtreeLeave(X) -# define sqlite3BtreeLeaveCursor(X) -# define sqlite3BtreeLeaveAll(X) +# define tdsqlite3BtreeLeave(X) +# define tdsqlite3BtreeLeaveCursor(X) +# define tdsqlite3BtreeLeaveAll(X) -# define sqlite3BtreeHoldsMutex(X) 1 -# define sqlite3BtreeHoldsAllMutexes(X) 1 -# define sqlite3SchemaMutexHeld(X,Y,Z) 1 +# define tdsqlite3BtreeHoldsMutex(X) 1 +# define tdsqlite3BtreeHoldsAllMutexes(X) 1 +# define tdsqlite3SchemaMutexHeld(X,Y,Z) 1 #endif @@ -15068,7 +15068,7 @@ typedef struct Vdbe Vdbe; ** The names of the following types declared in vdbeInt.h are required ** for the VdbeOp definition. */ -typedef struct sqlite3_value Mem; +typedef struct tdsqlite3_value Mem; typedef struct SubProgram SubProgram; /* @@ -15090,7 +15090,7 @@ struct VdbeOp { i64 *pI64; /* Used when p4type is P4_INT64 */ double *pReal; /* Used when p4type is P4_REAL */ FuncDef *pFunc; /* Used when p4type is P4_FUNCDEF */ - sqlite3_context *pCtx; /* Used when p4type is P4_FUNCCTX */ + tdsqlite3_context *pCtx; /* Used when p4type is P4_FUNCCTX */ CollSeq *pColl; /* Used when p4type is P4_COLLSEQ */ Mem *pMem; /* Used when p4type is P4_MEM */ VTable *pVtab; /* Used when p4type is P4_VTAB */ @@ -15161,11 +15161,11 @@ typedef struct VdbeOpList VdbeOpList; #define P4_KEYINFO (-9) /* P4 is a pointer to a KeyInfo structure */ #define P4_EXPR (-10) /* P4 is a pointer to an Expr tree */ #define P4_MEM (-11) /* P4 is a pointer to a Mem* structure */ -#define P4_VTAB (-12) /* P4 is a pointer to an sqlite3_vtab structure */ +#define P4_VTAB (-12) /* P4 is a pointer to an tdsqlite3_vtab structure */ #define P4_REAL (-13) /* P4 is a 64-bit floating point value */ #define P4_INT64 (-14) /* P4 is a 64-bit signed integer */ #define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */ -#define P4_FUNCCTX (-16) /* P4 is a pointer to an sqlite3_context object */ +#define P4_FUNCCTX (-16) /* P4 is a pointer to an tdsqlite3_context object */ #define P4_DYNBLOB (-17) /* Pointer to memory from sqliteMalloc() */ /* Error message codes for OP_Halt */ @@ -15194,7 +15194,7 @@ typedef struct VdbeOpList VdbeOpList; #endif /* -** The following macro converts a label returned by sqlite3VdbeMakeLabel() +** The following macro converts a label returned by tdsqlite3VdbeMakeLabel() ** into an index into the Parse.aLabel[] array that contains the resolved ** address of that label. */ @@ -15420,7 +15420,7 @@ typedef struct VdbeOpList VdbeOpList; /* 168 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ } -/* The sqlite3P2Values() routine is able to run faster if it knows +/* The tdsqlite3P2Values() routine is able to run faster if it knows ** the value of the largest JUMP opcode. The smaller the maximum ** JUMP opcode the better, so the mkopcodeh.tcl script that ** generated this include file strives to group all JUMP opcodes @@ -15441,117 +15441,117 @@ typedef struct VdbeOpList VdbeOpList; ** Prototypes for the VDBE interface. See comments on the implementation ** for a description of what each of these routines does. */ -SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse*); -SQLITE_PRIVATE Parse *sqlite3VdbeParser(Vdbe*); -SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe*,int); -SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe*,int,int); -SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int); -SQLITE_PRIVATE int sqlite3VdbeGoto(Vdbe*,int); -SQLITE_PRIVATE int sqlite3VdbeLoadString(Vdbe*,int,const char*); -SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe*,int,const char*,...); -SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int); -SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int); -SQLITE_PRIVATE int sqlite3VdbeAddOp4Dup8(Vdbe*,int,int,int,int,const u8*,int); -SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int); -SQLITE_PRIVATE int sqlite3VdbeAddFunctionCall(Parse*,int,int,int,int,const FuncDef*,int); -SQLITE_PRIVATE void sqlite3VdbeEndCoroutine(Vdbe*,int); +SQLITE_PRIVATE Vdbe *tdsqlite3VdbeCreate(Parse*); +SQLITE_PRIVATE Parse *tdsqlite3VdbeParser(Vdbe*); +SQLITE_PRIVATE int tdsqlite3VdbeAddOp0(Vdbe*,int); +SQLITE_PRIVATE int tdsqlite3VdbeAddOp1(Vdbe*,int,int); +SQLITE_PRIVATE int tdsqlite3VdbeAddOp2(Vdbe*,int,int,int); +SQLITE_PRIVATE int tdsqlite3VdbeGoto(Vdbe*,int); +SQLITE_PRIVATE int tdsqlite3VdbeLoadString(Vdbe*,int,const char*); +SQLITE_PRIVATE void tdsqlite3VdbeMultiLoad(Vdbe*,int,const char*,...); +SQLITE_PRIVATE int tdsqlite3VdbeAddOp3(Vdbe*,int,int,int,int); +SQLITE_PRIVATE int tdsqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int); +SQLITE_PRIVATE int tdsqlite3VdbeAddOp4Dup8(Vdbe*,int,int,int,int,const u8*,int); +SQLITE_PRIVATE int tdsqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int); +SQLITE_PRIVATE int tdsqlite3VdbeAddFunctionCall(Parse*,int,int,int,int,const FuncDef*,int); +SQLITE_PRIVATE void tdsqlite3VdbeEndCoroutine(Vdbe*,int); #if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS) -SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N); -SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p); +SQLITE_PRIVATE void tdsqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N); +SQLITE_PRIVATE void tdsqlite3VdbeVerifyNoResultRow(Vdbe *p); #else -# define sqlite3VdbeVerifyNoMallocRequired(A,B) -# define sqlite3VdbeVerifyNoResultRow(A) +# define tdsqlite3VdbeVerifyNoMallocRequired(A,B) +# define tdsqlite3VdbeVerifyNoResultRow(A) #endif #if defined(SQLITE_DEBUG) -SQLITE_PRIVATE void sqlite3VdbeVerifyAbortable(Vdbe *p, int); +SQLITE_PRIVATE void tdsqlite3VdbeVerifyAbortable(Vdbe *p, int); #else -# define sqlite3VdbeVerifyAbortable(A,B) +# define tdsqlite3VdbeVerifyAbortable(A,B) #endif -SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp,int iLineno); +SQLITE_PRIVATE VdbeOp *tdsqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp,int iLineno); #ifndef SQLITE_OMIT_EXPLAIN -SQLITE_PRIVATE void sqlite3VdbeExplain(Parse*,u8,const char*,...); -SQLITE_PRIVATE void sqlite3VdbeExplainPop(Parse*); -SQLITE_PRIVATE int sqlite3VdbeExplainParent(Parse*); -# define ExplainQueryPlan(P) sqlite3VdbeExplain P -# define ExplainQueryPlanPop(P) sqlite3VdbeExplainPop(P) -# define ExplainQueryPlanParent(P) sqlite3VdbeExplainParent(P) +SQLITE_PRIVATE void tdsqlite3VdbeExplain(Parse*,u8,const char*,...); +SQLITE_PRIVATE void tdsqlite3VdbeExplainPop(Parse*); +SQLITE_PRIVATE int tdsqlite3VdbeExplainParent(Parse*); +# define ExplainQueryPlan(P) tdsqlite3VdbeExplain P +# define ExplainQueryPlanPop(P) tdsqlite3VdbeExplainPop(P) +# define ExplainQueryPlanParent(P) tdsqlite3VdbeExplainParent(P) #else # define ExplainQueryPlan(P) # define ExplainQueryPlanPop(P) # define ExplainQueryPlanParent(P) 0 -# define sqlite3ExplainBreakpoint(A,B) /*no-op*/ +# define tdsqlite3ExplainBreakpoint(A,B) /*no-op*/ #endif #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_EXPLAIN) -SQLITE_PRIVATE void sqlite3ExplainBreakpoint(const char*,const char*); +SQLITE_PRIVATE void tdsqlite3ExplainBreakpoint(const char*,const char*); #else -# define sqlite3ExplainBreakpoint(A,B) /*no-op*/ +# define tdsqlite3ExplainBreakpoint(A,B) /*no-op*/ #endif -SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*); -SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe*, int addr, u8); -SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1); -SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2); -SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3); -SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u16 P5); -SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe*, int addr); -SQLITE_PRIVATE int sqlite3VdbeChangeToNoop(Vdbe*, int addr); -SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe*, u8 op); +SQLITE_PRIVATE void tdsqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*); +SQLITE_PRIVATE void tdsqlite3VdbeChangeOpcode(Vdbe*, int addr, u8); +SQLITE_PRIVATE void tdsqlite3VdbeChangeP1(Vdbe*, int addr, int P1); +SQLITE_PRIVATE void tdsqlite3VdbeChangeP2(Vdbe*, int addr, int P2); +SQLITE_PRIVATE void tdsqlite3VdbeChangeP3(Vdbe*, int addr, int P3); +SQLITE_PRIVATE void tdsqlite3VdbeChangeP5(Vdbe*, u16 P5); +SQLITE_PRIVATE void tdsqlite3VdbeJumpHere(Vdbe*, int addr); +SQLITE_PRIVATE int tdsqlite3VdbeChangeToNoop(Vdbe*, int addr); +SQLITE_PRIVATE int tdsqlite3VdbeDeletePriorOpcode(Vdbe*, u8 op); #ifdef SQLITE_DEBUG -SQLITE_PRIVATE void sqlite3VdbeReleaseRegisters(Parse*,int addr, int n, u32 mask, int); +SQLITE_PRIVATE void tdsqlite3VdbeReleaseRegisters(Parse*,int addr, int n, u32 mask, int); #else -# define sqlite3VdbeReleaseRegisters(P,A,N,M,F) +# define tdsqlite3VdbeReleaseRegisters(P,A,N,M,F) #endif -SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N); -SQLITE_PRIVATE void sqlite3VdbeAppendP4(Vdbe*, void *pP4, int p4type); -SQLITE_PRIVATE void sqlite3VdbeSetP4KeyInfo(Parse*, Index*); -SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe*, int); -SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe*, int); -SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Parse*); -SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*); -SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int); -SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N); +SQLITE_PRIVATE void tdsqlite3VdbeAppendP4(Vdbe*, void *pP4, int p4type); +SQLITE_PRIVATE void tdsqlite3VdbeSetP4KeyInfo(Parse*, Index*); +SQLITE_PRIVATE void tdsqlite3VdbeUsesBtree(Vdbe*, int); +SQLITE_PRIVATE VdbeOp *tdsqlite3VdbeGetOp(Vdbe*, int); +SQLITE_PRIVATE int tdsqlite3VdbeMakeLabel(Parse*); +SQLITE_PRIVATE void tdsqlite3VdbeRunOnlyOnce(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeReusable(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeDelete(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeClearObject(tdsqlite3*,Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeMakeReady(Vdbe*,Parse*); +SQLITE_PRIVATE int tdsqlite3VdbeFinalize(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeResolveLabel(Vdbe*, int); +SQLITE_PRIVATE int tdsqlite3VdbeCurrentAddr(Vdbe*); #ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int); +SQLITE_PRIVATE int tdsqlite3VdbeAssertMayAbort(Vdbe *, int); #endif -SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe*); -SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe*,int); -SQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*)); -SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*); -SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*); -SQLITE_PRIVATE u8 sqlite3VdbePrepareFlags(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, u8); +SQLITE_PRIVATE void tdsqlite3VdbeResetStepResult(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeRewind(Vdbe*); +SQLITE_PRIVATE int tdsqlite3VdbeReset(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeSetNumCols(Vdbe*,int); +SQLITE_PRIVATE int tdsqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*)); +SQLITE_PRIVATE void tdsqlite3VdbeCountChanges(Vdbe*); +SQLITE_PRIVATE tdsqlite3 *tdsqlite3VdbeDb(Vdbe*); +SQLITE_PRIVATE u8 tdsqlite3VdbePrepareFlags(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeSetSql(Vdbe*, const char *z, int n, u8); #ifdef SQLITE_ENABLE_NORMALIZE -SQLITE_PRIVATE void sqlite3VdbeAddDblquoteStr(sqlite3*,Vdbe*,const char*); -SQLITE_PRIVATE int sqlite3VdbeUsesDoubleQuotedString(Vdbe*,const char*); +SQLITE_PRIVATE void tdsqlite3VdbeAddDblquoteStr(tdsqlite3*,Vdbe*,const char*); +SQLITE_PRIVATE int tdsqlite3VdbeUsesDoubleQuotedString(Vdbe*,const char*); #endif -SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*); -SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*); -SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8); -SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int); +SQLITE_PRIVATE void tdsqlite3VdbeSwap(Vdbe*,Vdbe*); +SQLITE_PRIVATE VdbeOp *tdsqlite3VdbeTakeOpArray(Vdbe*, int*, int*); +SQLITE_PRIVATE tdsqlite3_value *tdsqlite3VdbeGetBoundValue(Vdbe*, int, u8); +SQLITE_PRIVATE void tdsqlite3VdbeSetVarmask(Vdbe*, int); #ifndef SQLITE_OMIT_TRACE -SQLITE_PRIVATE char *sqlite3VdbeExpandSql(Vdbe*, const char*); +SQLITE_PRIVATE char *tdsqlite3VdbeExpandSql(Vdbe*, const char*); #endif -SQLITE_PRIVATE int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); -SQLITE_PRIVATE int sqlite3BlobCompare(const Mem*, const Mem*); +SQLITE_PRIVATE int tdsqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); +SQLITE_PRIVATE int tdsqlite3BlobCompare(const Mem*, const Mem*); -SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*); -SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*); -SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip(int, const void *, UnpackedRecord *, int); -SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo*); +SQLITE_PRIVATE void tdsqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*); +SQLITE_PRIVATE int tdsqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*); +SQLITE_PRIVATE int tdsqlite3VdbeRecordCompareWithSkip(int, const void *, UnpackedRecord *, int); +SQLITE_PRIVATE UnpackedRecord *tdsqlite3VdbeAllocUnpackedRecord(KeyInfo*); typedef int (*RecordCompare)(int,const void*,UnpackedRecord*); -SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*); +SQLITE_PRIVATE RecordCompare tdsqlite3VdbeFindCompare(UnpackedRecord*); -SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); -SQLITE_PRIVATE int sqlite3VdbeHasSubProgram(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); +SQLITE_PRIVATE int tdsqlite3VdbeHasSubProgram(Vdbe*); -SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context*); +SQLITE_PRIVATE int tdsqlite3NotPureFunc(tdsqlite3_context*); /* Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on ** each VDBE opcode. @@ -15561,12 +15561,12 @@ SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context*); ** generator. */ #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS -SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe*, const char*, ...); -# define VdbeComment(X) sqlite3VdbeComment X -SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe*, const char*, ...); -# define VdbeNoopComment(X) sqlite3VdbeNoopComment X +SQLITE_PRIVATE void tdsqlite3VdbeComment(Vdbe*, const char*, ...); +# define VdbeComment(X) tdsqlite3VdbeComment X +SQLITE_PRIVATE void tdsqlite3VdbeNoopComment(Vdbe*, const char*, ...); +# define VdbeNoopComment(X) tdsqlite3VdbeNoopComment X # ifdef SQLITE_ENABLE_MODULE_COMMENTS -# define VdbeModuleComment(X) sqlite3VdbeNoopComment X +# define VdbeModuleComment(X) tdsqlite3VdbeNoopComment X # else # define VdbeModuleComment(X) # endif @@ -15606,7 +15606,7 @@ SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe*, const char*, ...); ** routine in vdbe.c, alerting the developer to the missed tag. ** ** During testing, the test application will invoke -** sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE,...) to set a callback +** tdsqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE,...) to set a callback ** routine that is invoked as each bytecode branch is taken. The callback ** contains the sqlite3.c source line number ov the VdbeCoverage macro and ** flags to indicate whether or not the branch was taken. The test application @@ -15617,19 +15617,19 @@ SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe*, const char*, ...); ** vdbe.c source file for additional information. */ #ifdef SQLITE_VDBE_COVERAGE -SQLITE_PRIVATE void sqlite3VdbeSetLineNumber(Vdbe*,int); -# define VdbeCoverage(v) sqlite3VdbeSetLineNumber(v,__LINE__) -# define VdbeCoverageIf(v,x) if(x)sqlite3VdbeSetLineNumber(v,__LINE__) +SQLITE_PRIVATE void tdsqlite3VdbeSetLineNumber(Vdbe*,int); +# define VdbeCoverage(v) tdsqlite3VdbeSetLineNumber(v,__LINE__) +# define VdbeCoverageIf(v,x) if(x)tdsqlite3VdbeSetLineNumber(v,__LINE__) # define VdbeCoverageAlwaysTaken(v) \ - sqlite3VdbeSetLineNumber(v,__LINE__|0x5000000); + tdsqlite3VdbeSetLineNumber(v,__LINE__|0x5000000); # define VdbeCoverageNeverTaken(v) \ - sqlite3VdbeSetLineNumber(v,__LINE__|0x6000000); + tdsqlite3VdbeSetLineNumber(v,__LINE__|0x6000000); # define VdbeCoverageNeverNull(v) \ - sqlite3VdbeSetLineNumber(v,__LINE__|0x4000000); + tdsqlite3VdbeSetLineNumber(v,__LINE__|0x4000000); # define VdbeCoverageNeverNullIf(v,x) \ - if(x)sqlite3VdbeSetLineNumber(v,__LINE__|0x4000000); + if(x)tdsqlite3VdbeSetLineNumber(v,__LINE__|0x4000000); # define VdbeCoverageEqNe(v) \ - sqlite3VdbeSetLineNumber(v,__LINE__|0x8000000); + tdsqlite3VdbeSetLineNumber(v,__LINE__|0x8000000); # define VDBE_OFFSET_LINENO(x) (__LINE__+x) #else # define VdbeCoverage(v) @@ -15643,13 +15643,13 @@ SQLITE_PRIVATE void sqlite3VdbeSetLineNumber(Vdbe*,int); #endif #ifdef SQLITE_ENABLE_STMT_SCANSTATUS -SQLITE_PRIVATE void sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const char*); +SQLITE_PRIVATE void tdsqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const char*); #else -# define sqlite3VdbeScanStatus(a,b,c,d,e) +# define tdsqlite3VdbeScanStatus(a,b,c,d,e) #endif #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) -SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE*, int, VdbeOp*); +SQLITE_PRIVATE void tdsqlite3VdbePrintOp(FILE*, int, VdbeOp*); #endif #endif /* SQLITE_VDBE_H */ @@ -15680,7 +15680,7 @@ SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE*, int, VdbeOp*); /* ** Default maximum size for persistent journal files. A negative ** value means no limit. This value may be overridden using the -** sqlite3PagerJournalSizeLimit() API. See also "PRAGMA journal_size_limit". +** tdsqlite3PagerJournalSizeLimit() API. See also "PRAGMA journal_size_limit". */ #ifndef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT #define SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT -1 @@ -15713,7 +15713,7 @@ typedef struct PgHdr DbPage; #define PAGER_MJ_PGNO(x) ((Pgno)((PENDING_BYTE/((x)->pageSize))+1)) /* -** Allowed values for the flags parameter to sqlite3PagerOpen(). +** Allowed values for the flags parameter to tdsqlite3PagerOpen(). ** ** NOTE: These values must match the corresponding BTREE_ values in btree.h. */ @@ -15721,7 +15721,7 @@ typedef struct PgHdr DbPage; #define PAGER_MEMORY 0x0002 /* In-memory database */ /* -** Valid values for the second argument to sqlite3PagerLockingMode(). +** Valid values for the second argument to tdsqlite3PagerLockingMode(). */ #define PAGER_LOCKINGMODE_QUERY -1 #define PAGER_LOCKINGMODE_NORMAL 0 @@ -15743,13 +15743,13 @@ typedef struct PgHdr DbPage; #define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */ /* -** Flags that make up the mask passed to sqlite3PagerGet(). +** Flags that make up the mask passed to tdsqlite3PagerGet(). */ #define PAGER_GET_NOCONTENT 0x01 /* Do not load data from disk */ #define PAGER_GET_READONLY 0x02 /* Read-only page is acceptable */ /* -** Flags for sqlite3PagerSetFlags() +** Flags for tdsqlite3PagerSetFlags() ** ** Value constraints (enforced via assert()): ** PAGER_FULLFSYNC == SQLITE_FullFSync @@ -15773,8 +15773,8 @@ typedef struct PgHdr DbPage; */ /* Open and close a Pager connection. */ -SQLITE_PRIVATE int sqlite3PagerOpen( - sqlite3_vfs*, +SQLITE_PRIVATE int tdsqlite3PagerOpen( + tdsqlite3_vfs*, Pager **ppPager, const char*, int, @@ -15782,120 +15782,120 @@ SQLITE_PRIVATE int sqlite3PagerOpen( int, void(*)(DbPage*) ); -SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager, sqlite3*); -SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager*, int, unsigned char*); +SQLITE_PRIVATE int tdsqlite3PagerClose(Pager *pPager, tdsqlite3*); +SQLITE_PRIVATE int tdsqlite3PagerReadFileheader(Pager*, int, unsigned char*); /* Functions used to configure a Pager object. */ -SQLITE_PRIVATE void sqlite3PagerSetBusyHandler(Pager*, int(*)(void *), void *); -SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager*, u32*, int); +SQLITE_PRIVATE void tdsqlite3PagerSetBusyHandler(Pager*, int(*)(void *), void *); +SQLITE_PRIVATE int tdsqlite3PagerSetPagesize(Pager*, u32*, int); #ifdef SQLITE_HAS_CODEC -SQLITE_PRIVATE void sqlite3PagerAlignReserve(Pager*,Pager*); +SQLITE_PRIVATE void tdsqlite3PagerAlignReserve(Pager*,Pager*); #endif -SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager*, int); -SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager*, int); -SQLITE_PRIVATE int sqlite3PagerSetSpillsize(Pager*, int); -SQLITE_PRIVATE void sqlite3PagerSetMmapLimit(Pager *, sqlite3_int64); -SQLITE_PRIVATE void sqlite3PagerShrink(Pager*); -SQLITE_PRIVATE void sqlite3PagerSetFlags(Pager*,unsigned); -SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *, int); -SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *, int); -SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager*); -SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager*); -SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *, i64); -SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager*); -SQLITE_PRIVATE int sqlite3PagerFlush(Pager*); +SQLITE_PRIVATE int tdsqlite3PagerMaxPageCount(Pager*, int); +SQLITE_PRIVATE void tdsqlite3PagerSetCachesize(Pager*, int); +SQLITE_PRIVATE int tdsqlite3PagerSetSpillsize(Pager*, int); +SQLITE_PRIVATE void tdsqlite3PagerSetMmapLimit(Pager *, tdsqlite3_int64); +SQLITE_PRIVATE void tdsqlite3PagerShrink(Pager*); +SQLITE_PRIVATE void tdsqlite3PagerSetFlags(Pager*,unsigned); +SQLITE_PRIVATE int tdsqlite3PagerLockingMode(Pager *, int); +SQLITE_PRIVATE int tdsqlite3PagerSetJournalMode(Pager *, int); +SQLITE_PRIVATE int tdsqlite3PagerGetJournalMode(Pager*); +SQLITE_PRIVATE int tdsqlite3PagerOkToChangeJournalMode(Pager*); +SQLITE_PRIVATE i64 tdsqlite3PagerJournalSizeLimit(Pager *, i64); +SQLITE_PRIVATE tdsqlite3_backup **tdsqlite3PagerBackupPtr(Pager*); +SQLITE_PRIVATE int tdsqlite3PagerFlush(Pager*); /* Functions used to obtain and release page references. */ -SQLITE_PRIVATE int sqlite3PagerGet(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag); -SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno); -SQLITE_PRIVATE void sqlite3PagerRef(DbPage*); -SQLITE_PRIVATE void sqlite3PagerUnref(DbPage*); -SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage*); -SQLITE_PRIVATE void sqlite3PagerUnrefPageOne(DbPage*); +SQLITE_PRIVATE int tdsqlite3PagerGet(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag); +SQLITE_PRIVATE DbPage *tdsqlite3PagerLookup(Pager *pPager, Pgno pgno); +SQLITE_PRIVATE void tdsqlite3PagerRef(DbPage*); +SQLITE_PRIVATE void tdsqlite3PagerUnref(DbPage*); +SQLITE_PRIVATE void tdsqlite3PagerUnrefNotNull(DbPage*); +SQLITE_PRIVATE void tdsqlite3PagerUnrefPageOne(DbPage*); /* Operations on page references. */ -SQLITE_PRIVATE int sqlite3PagerWrite(DbPage*); -SQLITE_PRIVATE void sqlite3PagerDontWrite(DbPage*); -SQLITE_PRIVATE int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int); -SQLITE_PRIVATE int sqlite3PagerPageRefcount(DbPage*); -SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *); -SQLITE_PRIVATE void *sqlite3PagerGetExtra(DbPage *); +SQLITE_PRIVATE int tdsqlite3PagerWrite(DbPage*); +SQLITE_PRIVATE void tdsqlite3PagerDontWrite(DbPage*); +SQLITE_PRIVATE int tdsqlite3PagerMovepage(Pager*,DbPage*,Pgno,int); +SQLITE_PRIVATE int tdsqlite3PagerPageRefcount(DbPage*); +SQLITE_PRIVATE void *tdsqlite3PagerGetData(DbPage *); +SQLITE_PRIVATE void *tdsqlite3PagerGetExtra(DbPage *); /* Functions used to manage pager transactions and savepoints. */ -SQLITE_PRIVATE void sqlite3PagerPagecount(Pager*, int*); -SQLITE_PRIVATE int sqlite3PagerBegin(Pager*, int exFlag, int); -SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int); -SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager*); -SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zMaster); -SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager*); -SQLITE_PRIVATE int sqlite3PagerRollback(Pager*); -SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int n); -SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint); -SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager); +SQLITE_PRIVATE void tdsqlite3PagerPagecount(Pager*, int*); +SQLITE_PRIVATE int tdsqlite3PagerBegin(Pager*, int exFlag, int); +SQLITE_PRIVATE int tdsqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int); +SQLITE_PRIVATE int tdsqlite3PagerExclusiveLock(Pager*); +SQLITE_PRIVATE int tdsqlite3PagerSync(Pager *pPager, const char *zMaster); +SQLITE_PRIVATE int tdsqlite3PagerCommitPhaseTwo(Pager*); +SQLITE_PRIVATE int tdsqlite3PagerRollback(Pager*); +SQLITE_PRIVATE int tdsqlite3PagerOpenSavepoint(Pager *pPager, int n); +SQLITE_PRIVATE int tdsqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint); +SQLITE_PRIVATE int tdsqlite3PagerSharedLock(Pager *pPager); #ifndef SQLITE_OMIT_WAL -SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, sqlite3*, int, int*, int*); -SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager); -SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager); -SQLITE_PRIVATE int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen); -SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager, sqlite3*); +SQLITE_PRIVATE int tdsqlite3PagerCheckpoint(Pager *pPager, tdsqlite3*, int, int*, int*); +SQLITE_PRIVATE int tdsqlite3PagerWalSupported(Pager *pPager); +SQLITE_PRIVATE int tdsqlite3PagerWalCallback(Pager *pPager); +SQLITE_PRIVATE int tdsqlite3PagerOpenWal(Pager *pPager, int *pisOpen); +SQLITE_PRIVATE int tdsqlite3PagerCloseWal(Pager *pPager, tdsqlite3*); # ifdef SQLITE_ENABLE_SNAPSHOT -SQLITE_PRIVATE int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot); -SQLITE_PRIVATE int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSnapshot); -SQLITE_PRIVATE int sqlite3PagerSnapshotRecover(Pager *pPager); -SQLITE_PRIVATE int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot); -SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager); +SQLITE_PRIVATE int tdsqlite3PagerSnapshotGet(Pager *pPager, tdsqlite3_snapshot **ppSnapshot); +SQLITE_PRIVATE int tdsqlite3PagerSnapshotOpen(Pager *pPager, tdsqlite3_snapshot *pSnapshot); +SQLITE_PRIVATE int tdsqlite3PagerSnapshotRecover(Pager *pPager); +SQLITE_PRIVATE int tdsqlite3PagerSnapshotCheck(Pager *pPager, tdsqlite3_snapshot *pSnapshot); +SQLITE_PRIVATE void tdsqlite3PagerSnapshotUnlock(Pager *pPager); # endif #endif #ifdef SQLITE_DIRECT_OVERFLOW_READ -SQLITE_PRIVATE int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno); +SQLITE_PRIVATE int tdsqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno); #endif #ifdef SQLITE_ENABLE_ZIPVFS -SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager); +SQLITE_PRIVATE int tdsqlite3PagerWalFramesize(Pager *pPager); #endif /* Functions used to query pager state and configuration. */ -SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager*); -SQLITE_PRIVATE u32 sqlite3PagerDataVersion(Pager*); +SQLITE_PRIVATE u8 tdsqlite3PagerIsreadonly(Pager*); +SQLITE_PRIVATE u32 tdsqlite3PagerDataVersion(Pager*); #ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3PagerRefcount(Pager*); +SQLITE_PRIVATE int tdsqlite3PagerRefcount(Pager*); #endif -SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager*); -SQLITE_PRIVATE const char *sqlite3PagerFilename(const Pager*, int); -SQLITE_PRIVATE sqlite3_vfs *sqlite3PagerVfs(Pager*); -SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager*); -SQLITE_PRIVATE sqlite3_file *sqlite3PagerJrnlFile(Pager*); -SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*); -SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*); -SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*); -SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, int *); -SQLITE_PRIVATE void sqlite3PagerClearCache(Pager*); -SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *); +SQLITE_PRIVATE int tdsqlite3PagerMemUsed(Pager*); +SQLITE_PRIVATE const char *tdsqlite3PagerFilename(const Pager*, int); +SQLITE_PRIVATE tdsqlite3_vfs *tdsqlite3PagerVfs(Pager*); +SQLITE_PRIVATE tdsqlite3_file *tdsqlite3PagerFile(Pager*); +SQLITE_PRIVATE tdsqlite3_file *tdsqlite3PagerJrnlFile(Pager*); +SQLITE_PRIVATE const char *tdsqlite3PagerJournalname(Pager*); +SQLITE_PRIVATE void *tdsqlite3PagerTempSpace(Pager*); +SQLITE_PRIVATE int tdsqlite3PagerIsMemdb(Pager*); +SQLITE_PRIVATE void tdsqlite3PagerCacheStat(Pager *, int, int, int *); +SQLITE_PRIVATE void tdsqlite3PagerClearCache(Pager*); +SQLITE_PRIVATE int tdsqlite3SectorSize(tdsqlite3_file *); #ifdef SQLITE_ENABLE_SETLK_TIMEOUT -SQLITE_PRIVATE void sqlite3PagerResetLockTimeout(Pager *pPager); +SQLITE_PRIVATE void tdsqlite3PagerResetLockTimeout(Pager *pPager); #else -# define sqlite3PagerResetLockTimeout(X) +# define tdsqlite3PagerResetLockTimeout(X) #endif /* Functions used to truncate the database file. */ -SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno); +SQLITE_PRIVATE void tdsqlite3PagerTruncateImage(Pager*,Pgno); -SQLITE_PRIVATE void sqlite3PagerRekey(DbPage*, Pgno, u16); +SQLITE_PRIVATE void tdsqlite3PagerRekey(DbPage*, Pgno, u16); #if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL) -SQLITE_PRIVATE void *sqlite3PagerCodec(DbPage *); +SQLITE_PRIVATE void *tdsqlite3PagerCodec(DbPage *); #endif /* Functions to support testing and debugging. */ #if !defined(NDEBUG) || defined(SQLITE_TEST) -SQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage*); -SQLITE_PRIVATE int sqlite3PagerIswriteable(DbPage*); +SQLITE_PRIVATE Pgno tdsqlite3PagerPagenumber(DbPage*); +SQLITE_PRIVATE int tdsqlite3PagerIswriteable(DbPage*); #endif #ifdef SQLITE_TEST -SQLITE_PRIVATE int *sqlite3PagerStats(Pager*); -SQLITE_PRIVATE void sqlite3PagerRefdump(Pager*); +SQLITE_PRIVATE int *tdsqlite3PagerStats(Pager*); +SQLITE_PRIVATE void tdsqlite3PagerRefdump(Pager*); void disable_simulated_io_errors(void); void enable_simulated_io_errors(void); #else @@ -15934,7 +15934,7 @@ typedef struct PCache PCache; ** structure. */ struct PgHdr { - sqlite3_pcache_page *pPage; /* Pcache object page handle */ + tdsqlite3_pcache_page *pPage; /* Pcache object page handle */ void *pData; /* Page data */ void *pExtra; /* Extra content */ PCache *pCache; /* PRIVATE: Cache that owns this page */ @@ -15970,19 +15970,19 @@ struct PgHdr { #define PGHDR_WAL_APPEND 0x040 /* Appended to wal file */ /* Initialize and shutdown the page cache subsystem */ -SQLITE_PRIVATE int sqlite3PcacheInitialize(void); -SQLITE_PRIVATE void sqlite3PcacheShutdown(void); +SQLITE_PRIVATE int tdsqlite3PcacheInitialize(void); +SQLITE_PRIVATE void tdsqlite3PcacheShutdown(void); /* Page cache buffer management: ** These routines implement SQLITE_CONFIG_PAGECACHE. */ -SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *, int sz, int n); +SQLITE_PRIVATE void tdsqlite3PCacheBufferSetup(void *, int sz, int n); /* Create a new pager cache. ** Under memory stress, invoke xStress to try to make pages clean. ** Only clean and unpinned pages can be reclaimed. */ -SQLITE_PRIVATE int sqlite3PcacheOpen( +SQLITE_PRIVATE int tdsqlite3PcacheOpen( int szPage, /* Size of every page */ int szExtra, /* Extra space associated with each page */ int bPurgeable, /* True if pages are on backing store */ @@ -15992,67 +15992,67 @@ SQLITE_PRIVATE int sqlite3PcacheOpen( ); /* Modify the page-size after the cache has been created. */ -SQLITE_PRIVATE int sqlite3PcacheSetPageSize(PCache *, int); +SQLITE_PRIVATE int tdsqlite3PcacheSetPageSize(PCache *, int); /* Return the size in bytes of a PCache object. Used to preallocate ** storage space. */ -SQLITE_PRIVATE int sqlite3PcacheSize(void); +SQLITE_PRIVATE int tdsqlite3PcacheSize(void); /* One release per successful fetch. Page is pinned until released. ** Reference counted. */ -SQLITE_PRIVATE sqlite3_pcache_page *sqlite3PcacheFetch(PCache*, Pgno, int createFlag); -SQLITE_PRIVATE int sqlite3PcacheFetchStress(PCache*, Pgno, sqlite3_pcache_page**); -SQLITE_PRIVATE PgHdr *sqlite3PcacheFetchFinish(PCache*, Pgno, sqlite3_pcache_page *pPage); -SQLITE_PRIVATE void sqlite3PcacheRelease(PgHdr*); +SQLITE_PRIVATE tdsqlite3_pcache_page *tdsqlite3PcacheFetch(PCache*, Pgno, int createFlag); +SQLITE_PRIVATE int tdsqlite3PcacheFetchStress(PCache*, Pgno, tdsqlite3_pcache_page**); +SQLITE_PRIVATE PgHdr *tdsqlite3PcacheFetchFinish(PCache*, Pgno, tdsqlite3_pcache_page *pPage); +SQLITE_PRIVATE void tdsqlite3PcacheRelease(PgHdr*); -SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr*); /* Remove page from cache */ -SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr*); /* Make sure page is marked dirty */ -SQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr*); /* Mark a single page as clean */ -SQLITE_PRIVATE void sqlite3PcacheCleanAll(PCache*); /* Mark all dirty list pages as clean */ -SQLITE_PRIVATE void sqlite3PcacheClearWritable(PCache*); +SQLITE_PRIVATE void tdsqlite3PcacheDrop(PgHdr*); /* Remove page from cache */ +SQLITE_PRIVATE void tdsqlite3PcacheMakeDirty(PgHdr*); /* Make sure page is marked dirty */ +SQLITE_PRIVATE void tdsqlite3PcacheMakeClean(PgHdr*); /* Mark a single page as clean */ +SQLITE_PRIVATE void tdsqlite3PcacheCleanAll(PCache*); /* Mark all dirty list pages as clean */ +SQLITE_PRIVATE void tdsqlite3PcacheClearWritable(PCache*); /* Change a page number. Used by incr-vacuum. */ -SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr*, Pgno); +SQLITE_PRIVATE void tdsqlite3PcacheMove(PgHdr*, Pgno); /* Remove all pages with pgno>x. Reset the cache if x==0 */ -SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache*, Pgno x); +SQLITE_PRIVATE void tdsqlite3PcacheTruncate(PCache*, Pgno x); /* Get a list of all dirty pages in the cache, sorted by page number */ -SQLITE_PRIVATE PgHdr *sqlite3PcacheDirtyList(PCache*); +SQLITE_PRIVATE PgHdr *tdsqlite3PcacheDirtyList(PCache*); /* Reset and close the cache object */ -SQLITE_PRIVATE void sqlite3PcacheClose(PCache*); +SQLITE_PRIVATE void tdsqlite3PcacheClose(PCache*); /* Clear flags from pages of the page cache */ -SQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *); +SQLITE_PRIVATE void tdsqlite3PcacheClearSyncFlags(PCache *); /* Discard the contents of the cache */ -SQLITE_PRIVATE void sqlite3PcacheClear(PCache*); +SQLITE_PRIVATE void tdsqlite3PcacheClear(PCache*); /* Return the total number of outstanding page references */ -SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache*); +SQLITE_PRIVATE int tdsqlite3PcacheRefCount(PCache*); /* Increment the reference count of an existing page */ -SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*); +SQLITE_PRIVATE void tdsqlite3PcacheRef(PgHdr*); -SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr*); +SQLITE_PRIVATE int tdsqlite3PcachePageRefcount(PgHdr*); /* Return the total number of pages stored in the cache */ -SQLITE_PRIVATE int sqlite3PcachePagecount(PCache*); +SQLITE_PRIVATE int tdsqlite3PcachePagecount(PCache*); #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG) /* Iterate through all dirty pages currently stored in the cache. This ** interface is only available if SQLITE_CHECK_PAGES is defined when the ** library is built. */ -SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *)); +SQLITE_PRIVATE void tdsqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *)); #endif #if defined(SQLITE_DEBUG) /* Check invariants on a PgHdr object */ -SQLITE_PRIVATE int sqlite3PcachePageSanity(PgHdr*); +SQLITE_PRIVATE int tdsqlite3PcachePageSanity(PgHdr*); #endif /* Set and get the suggested cache-size for the specified pager-cache. @@ -16061,9 +16061,9 @@ SQLITE_PRIVATE int sqlite3PcachePageSanity(PgHdr*); ** the total number of pages cached by purgeable pager-caches to the sum ** of the suggested cache-sizes. */ -SQLITE_PRIVATE void sqlite3PcacheSetCachesize(PCache *, int); +SQLITE_PRIVATE void tdsqlite3PcacheSetCachesize(PCache *, int); #ifdef SQLITE_TEST -SQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *); +SQLITE_PRIVATE int tdsqlite3PcacheGetCachesize(PCache *); #endif /* Set or get the suggested spill-size for the specified pager-cache. @@ -16071,31 +16071,31 @@ SQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *); ** The spill-size is the minimum number of pages in cache before the cache ** will attempt to spill dirty pages by calling xStress. */ -SQLITE_PRIVATE int sqlite3PcacheSetSpillsize(PCache *, int); +SQLITE_PRIVATE int tdsqlite3PcacheSetSpillsize(PCache *, int); /* Free up as much memory as possible from the page cache */ -SQLITE_PRIVATE void sqlite3PcacheShrink(PCache*); +SQLITE_PRIVATE void tdsqlite3PcacheShrink(PCache*); #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT /* Try to return memory used by the pcache module to the main memory heap */ -SQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int); +SQLITE_PRIVATE int tdsqlite3PcacheReleaseMemory(int); #endif #ifdef SQLITE_TEST -SQLITE_PRIVATE void sqlite3PcacheStats(int*,int*,int*,int*); +SQLITE_PRIVATE void tdsqlite3PcacheStats(int*,int*,int*,int*); #endif -SQLITE_PRIVATE void sqlite3PCacheSetDefault(void); +SQLITE_PRIVATE void tdsqlite3PCacheSetDefault(void); /* Return the header size */ -SQLITE_PRIVATE int sqlite3HeaderSizePcache(void); -SQLITE_PRIVATE int sqlite3HeaderSizePcache1(void); +SQLITE_PRIVATE int tdsqlite3HeaderSizePcache(void); +SQLITE_PRIVATE int tdsqlite3HeaderSizePcache1(void); /* Number of dirty pages as a percentage of the configured cache size */ -SQLITE_PRIVATE int sqlite3PCachePercentDirty(PCache*); +SQLITE_PRIVATE int tdsqlite3PCachePercentDirty(PCache*); #ifdef SQLITE_DIRECT_OVERFLOW_READ -SQLITE_PRIVATE int sqlite3PCacheIsDirty(PCache *pCache); +SQLITE_PRIVATE int tdsqlite3PCacheIsDirty(PCache *pCache); #endif #endif /* _PCACHE_H_ */ @@ -16234,7 +16234,7 @@ SQLITE_PRIVATE int sqlite3PCacheIsDirty(PCache *pCache); /* ** The following values may be passed as the second argument to -** sqlite3OsLock(). The various locks exhibit the following semantics: +** tdsqlite3OsLock(). The various locks exhibit the following semantics: ** ** SHARED: Any number of processes may hold a SHARED lock simultaneously. ** RESERVED: A single process may hold a RESERVED lock on a file at @@ -16244,10 +16244,10 @@ SQLITE_PRIVATE int sqlite3PCacheIsDirty(PCache *pCache); ** SHARED locks may be obtained by other processes. ** EXCLUSIVE: An EXCLUSIVE lock precludes all other locks. ** -** PENDING_LOCK may not be passed directly to sqlite3OsLock(). Instead, a +** PENDING_LOCK may not be passed directly to tdsqlite3OsLock(). Instead, a ** process that requests an EXCLUSIVE lock may actually obtain a PENDING ** lock. This can be upgraded to an EXCLUSIVE lock by a subsequent call to -** sqlite3OsLock(). +** tdsqlite3OsLock(). */ #define NO_LOCK 0 #define SHARED_LOCK 1 @@ -16313,68 +16313,68 @@ SQLITE_PRIVATE int sqlite3PCacheIsDirty(PCache *pCache); #ifdef SQLITE_OMIT_WSD # define PENDING_BYTE (0x40000000) #else -# define PENDING_BYTE sqlite3PendingByte +# define PENDING_BYTE tdsqlite3PendingByte #endif #define RESERVED_BYTE (PENDING_BYTE+1) #define SHARED_FIRST (PENDING_BYTE+2) #define SHARED_SIZE 510 /* -** Wrapper around OS specific sqlite3_os_init() function. +** Wrapper around OS specific tdsqlite3_os_init() function. */ -SQLITE_PRIVATE int sqlite3OsInit(void); +SQLITE_PRIVATE int tdsqlite3OsInit(void); /* -** Functions for accessing sqlite3_file methods +** Functions for accessing tdsqlite3_file methods */ -SQLITE_PRIVATE void sqlite3OsClose(sqlite3_file*); -SQLITE_PRIVATE int sqlite3OsRead(sqlite3_file*, void*, int amt, i64 offset); -SQLITE_PRIVATE int sqlite3OsWrite(sqlite3_file*, const void*, int amt, i64 offset); -SQLITE_PRIVATE int sqlite3OsTruncate(sqlite3_file*, i64 size); -SQLITE_PRIVATE int sqlite3OsSync(sqlite3_file*, int); -SQLITE_PRIVATE int sqlite3OsFileSize(sqlite3_file*, i64 *pSize); -SQLITE_PRIVATE int sqlite3OsLock(sqlite3_file*, int); -SQLITE_PRIVATE int sqlite3OsUnlock(sqlite3_file*, int); -SQLITE_PRIVATE int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut); -SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file*,int,void*); -SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file*,int,void*); +SQLITE_PRIVATE void tdsqlite3OsClose(tdsqlite3_file*); +SQLITE_PRIVATE int tdsqlite3OsRead(tdsqlite3_file*, void*, int amt, i64 offset); +SQLITE_PRIVATE int tdsqlite3OsWrite(tdsqlite3_file*, const void*, int amt, i64 offset); +SQLITE_PRIVATE int tdsqlite3OsTruncate(tdsqlite3_file*, i64 size); +SQLITE_PRIVATE int tdsqlite3OsSync(tdsqlite3_file*, int); +SQLITE_PRIVATE int tdsqlite3OsFileSize(tdsqlite3_file*, i64 *pSize); +SQLITE_PRIVATE int tdsqlite3OsLock(tdsqlite3_file*, int); +SQLITE_PRIVATE int tdsqlite3OsUnlock(tdsqlite3_file*, int); +SQLITE_PRIVATE int tdsqlite3OsCheckReservedLock(tdsqlite3_file *id, int *pResOut); +SQLITE_PRIVATE int tdsqlite3OsFileControl(tdsqlite3_file*,int,void*); +SQLITE_PRIVATE void tdsqlite3OsFileControlHint(tdsqlite3_file*,int,void*); #define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0 -SQLITE_PRIVATE int sqlite3OsSectorSize(sqlite3_file *id); -SQLITE_PRIVATE int sqlite3OsDeviceCharacteristics(sqlite3_file *id); +SQLITE_PRIVATE int tdsqlite3OsSectorSize(tdsqlite3_file *id); +SQLITE_PRIVATE int tdsqlite3OsDeviceCharacteristics(tdsqlite3_file *id); #ifndef SQLITE_OMIT_WAL -SQLITE_PRIVATE int sqlite3OsShmMap(sqlite3_file *,int,int,int,void volatile **); -SQLITE_PRIVATE int sqlite3OsShmLock(sqlite3_file *id, int, int, int); -SQLITE_PRIVATE void sqlite3OsShmBarrier(sqlite3_file *id); -SQLITE_PRIVATE int sqlite3OsShmUnmap(sqlite3_file *id, int); +SQLITE_PRIVATE int tdsqlite3OsShmMap(tdsqlite3_file *,int,int,int,void volatile **); +SQLITE_PRIVATE int tdsqlite3OsShmLock(tdsqlite3_file *id, int, int, int); +SQLITE_PRIVATE void tdsqlite3OsShmBarrier(tdsqlite3_file *id); +SQLITE_PRIVATE int tdsqlite3OsShmUnmap(tdsqlite3_file *id, int); #endif /* SQLITE_OMIT_WAL */ -SQLITE_PRIVATE int sqlite3OsFetch(sqlite3_file *id, i64, int, void **); -SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *, i64, void *); +SQLITE_PRIVATE int tdsqlite3OsFetch(tdsqlite3_file *id, i64, int, void **); +SQLITE_PRIVATE int tdsqlite3OsUnfetch(tdsqlite3_file *, i64, void *); /* -** Functions for accessing sqlite3_vfs methods +** Functions for accessing tdsqlite3_vfs methods */ -SQLITE_PRIVATE int sqlite3OsOpen(sqlite3_vfs *, const char *, sqlite3_file*, int, int *); -SQLITE_PRIVATE int sqlite3OsDelete(sqlite3_vfs *, const char *, int); -SQLITE_PRIVATE int sqlite3OsAccess(sqlite3_vfs *, const char *, int, int *pResOut); -SQLITE_PRIVATE int sqlite3OsFullPathname(sqlite3_vfs *, const char *, int, char *); +SQLITE_PRIVATE int tdsqlite3OsOpen(tdsqlite3_vfs *, const char *, tdsqlite3_file*, int, int *); +SQLITE_PRIVATE int tdsqlite3OsDelete(tdsqlite3_vfs *, const char *, int); +SQLITE_PRIVATE int tdsqlite3OsAccess(tdsqlite3_vfs *, const char *, int, int *pResOut); +SQLITE_PRIVATE int tdsqlite3OsFullPathname(tdsqlite3_vfs *, const char *, int, char *); #ifndef SQLITE_OMIT_LOAD_EXTENSION -SQLITE_PRIVATE void *sqlite3OsDlOpen(sqlite3_vfs *, const char *); -SQLITE_PRIVATE void sqlite3OsDlError(sqlite3_vfs *, int, char *); -SQLITE_PRIVATE void (*sqlite3OsDlSym(sqlite3_vfs *, void *, const char *))(void); -SQLITE_PRIVATE void sqlite3OsDlClose(sqlite3_vfs *, void *); +SQLITE_PRIVATE void *tdsqlite3OsDlOpen(tdsqlite3_vfs *, const char *); +SQLITE_PRIVATE void tdsqlite3OsDlError(tdsqlite3_vfs *, int, char *); +SQLITE_PRIVATE void (*tdsqlite3OsDlSym(tdsqlite3_vfs *, void *, const char *))(void); +SQLITE_PRIVATE void tdsqlite3OsDlClose(tdsqlite3_vfs *, void *); #endif /* SQLITE_OMIT_LOAD_EXTENSION */ -SQLITE_PRIVATE int sqlite3OsRandomness(sqlite3_vfs *, int, char *); -SQLITE_PRIVATE int sqlite3OsSleep(sqlite3_vfs *, int); -SQLITE_PRIVATE int sqlite3OsGetLastError(sqlite3_vfs*); -SQLITE_PRIVATE int sqlite3OsCurrentTimeInt64(sqlite3_vfs *, sqlite3_int64*); +SQLITE_PRIVATE int tdsqlite3OsRandomness(tdsqlite3_vfs *, int, char *); +SQLITE_PRIVATE int tdsqlite3OsSleep(tdsqlite3_vfs *, int); +SQLITE_PRIVATE int tdsqlite3OsGetLastError(tdsqlite3_vfs*); +SQLITE_PRIVATE int tdsqlite3OsCurrentTimeInt64(tdsqlite3_vfs *, tdsqlite3_int64*); /* ** Convenience functions for opening and closing files using -** sqlite3_malloc() to obtain space for the file-handle structure. +** tdsqlite3_malloc() to obtain space for the file-handle structure. */ -SQLITE_PRIVATE int sqlite3OsOpenMalloc(sqlite3_vfs *, const char *, sqlite3_file **, int,int*); -SQLITE_PRIVATE void sqlite3OsCloseFree(sqlite3_file *); +SQLITE_PRIVATE int tdsqlite3OsOpenMalloc(tdsqlite3_vfs *, const char *, tdsqlite3_file **, int,int*); +SQLITE_PRIVATE void tdsqlite3OsCloseFree(tdsqlite3_file *); #endif /* _SQLITE_OS_H_ */ @@ -16438,20 +16438,20 @@ SQLITE_PRIVATE void sqlite3OsCloseFree(sqlite3_file *); /* ** If this is a no-op implementation, implement everything as macros. */ -#define sqlite3_mutex_alloc(X) ((sqlite3_mutex*)8) -#define sqlite3_mutex_free(X) -#define sqlite3_mutex_enter(X) -#define sqlite3_mutex_try(X) SQLITE_OK -#define sqlite3_mutex_leave(X) -#define sqlite3_mutex_held(X) ((void)(X),1) -#define sqlite3_mutex_notheld(X) ((void)(X),1) -#define sqlite3MutexAlloc(X) ((sqlite3_mutex*)8) -#define sqlite3MutexInit() SQLITE_OK -#define sqlite3MutexEnd() +#define tdsqlite3_mutex_alloc(X) ((tdsqlite3_mutex*)8) +#define tdsqlite3_mutex_free(X) +#define tdsqlite3_mutex_enter(X) +#define tdsqlite3_mutex_try(X) SQLITE_OK +#define tdsqlite3_mutex_leave(X) +#define tdsqlite3_mutex_held(X) ((void)(X),1) +#define tdsqlite3_mutex_notheld(X) ((void)(X),1) +#define tdsqlite3MutexAlloc(X) ((tdsqlite3_mutex*)8) +#define tdsqlite3MutexInit() SQLITE_OK +#define tdsqlite3MutexEnd() #define MUTEX_LOGIC(X) #else #define MUTEX_LOGIC(X) X -SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*); +SQLITE_API int tdsqlite3_mutex_held(tdsqlite3_mutex*); #endif /* defined(SQLITE_MUTEX_OMIT) */ /************** End of mutex.h ***********************************************/ @@ -16513,11 +16513,11 @@ struct Db { ** ** Schema objects are automatically deallocated when the last Btree that ** references them is destroyed. The TEMP Schema is manually freed by -** sqlite3_close(). +** tdsqlite3_close(). * ** A thread must be holding a mutex on the corresponding Btree in order ** to access Schema content. This implies that the thread must also be -** holding a mutex on the sqlite3 connection pointer that owns the Btree. +** holding a mutex on the tdsqlite3 connection pointer that owns the Btree. ** For a TEMP Schema, only the connection mutex is required. */ struct Schema { @@ -16560,7 +16560,7 @@ struct Schema { /* ** The number of different kinds of things that can be limited -** using the sqlite3_limit() interface. +** using the tdsqlite3_limit() interface. */ #define SQLITE_N_LIMIT (SQLITE_LIMIT_WORKER_THREADS+1) @@ -16613,7 +16613,7 @@ struct Lookaside { u32 bDisable; /* Only operate the lookaside when zero */ u16 sz; /* Size of each buffer in bytes */ u16 szTrue; /* True value of sz, even if disabled */ - u8 bMalloced; /* True if pStart obtained from sqlite3_malloc() */ + u8 bMalloced; /* True if pStart obtained from tdsqlite3_malloc() */ u32 nSlot; /* Number of lookaside slots allocated */ u32 anStat[3]; /* 0: hits. 1: size misses. 2: full misses */ LookasideSlot *pInit; /* List of buffers not previously used */ @@ -16658,28 +16658,28 @@ struct FuncDefHash { #ifdef SQLITE_USER_AUTHENTICATION /* -** Information held in the "sqlite3" database connection object and used +** Information held in the "tdsqlite3" database connection object and used ** to manage user authentication. */ -typedef struct sqlite3_userauth sqlite3_userauth; -struct sqlite3_userauth { +typedef struct tdsqlite3_userauth tdsqlite3_userauth; +struct tdsqlite3_userauth { u8 authLevel; /* Current authentication level */ int nAuthPW; /* Size of the zAuthPW in bytes */ char *zAuthPW; /* Password used to authenticate */ char *zAuthUser; /* User name used to authenticate */ }; -/* Allowed values for sqlite3_userauth.authLevel */ +/* Allowed values for tdsqlite3_userauth.authLevel */ #define UAUTH_Unknown 0 /* Authentication not yet checked */ #define UAUTH_Fail 1 /* User authentication failed */ #define UAUTH_User 2 /* Authenticated as a normal user */ #define UAUTH_Admin 3 /* Authenticated as an administrator */ /* Functions used only by user authorization logic */ -SQLITE_PRIVATE int sqlite3UserAuthTable(const char*); -SQLITE_PRIVATE int sqlite3UserAuthCheckLogin(sqlite3*,const char*,u8*); -SQLITE_PRIVATE void sqlite3UserAuthInit(sqlite3*); -SQLITE_PRIVATE void sqlite3CryptFunc(sqlite3_context*,int,sqlite3_value**); +SQLITE_PRIVATE int tdsqlite3UserAuthTable(const char*); +SQLITE_PRIVATE int tdsqlite3UserAuthCheckLogin(tdsqlite3*,const char*,u8*); +SQLITE_PRIVATE void tdsqlite3UserAuthInit(tdsqlite3*); +SQLITE_PRIVATE void tdsqlite3CryptFunc(tdsqlite3_context*,int,tdsqlite3_value**); #endif /* SQLITE_USER_AUTHENTICATION */ @@ -16687,16 +16687,16 @@ SQLITE_PRIVATE void sqlite3CryptFunc(sqlite3_context*,int,sqlite3_value**); ** typedef for the authorization callback function. */ #ifdef SQLITE_USER_AUTHENTICATION - typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*, + typedef int (*tdsqlite3_xauth)(void*,int,const char*,const char*,const char*, const char*, const char*); #else - typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*, + typedef int (*tdsqlite3_xauth)(void*,int,const char*,const char*,const char*, const char*); #endif #ifndef SQLITE_OMIT_DEPRECATED /* This is an extra SQLITE_TRACE macro that indicates "legacy" tracing -** in the style of sqlite3_trace() +** in the style of tdsqlite3_trace() */ #define SQLITE_TRACE_LEGACY 0x40 /* Use the legacy xTrace */ #define SQLITE_TRACE_XPROFILE 0x80 /* Use the legacy xProfile */ @@ -16710,11 +16710,11 @@ SQLITE_PRIVATE void sqlite3CryptFunc(sqlite3_context*,int,sqlite3_value**); /* ** Each database connection is an instance of the following structure. */ -struct sqlite3 { - sqlite3_vfs *pVfs; /* OS Interface */ +struct tdsqlite3 { + tdsqlite3_vfs *pVfs; /* OS Interface */ struct Vdbe *pVdbe; /* List of active virtual machines */ CollSeq *pDfltColl; /* The default collating sequence (BINARY) */ - sqlite3_mutex *mutex; /* Connection mutex */ + tdsqlite3_mutex *mutex; /* Connection mutex */ Db *aDb; /* All backends */ int nDb; /* Number of backends currently in use */ u32 mDbFlags; /* flags recording internal state */ @@ -16722,7 +16722,7 @@ struct sqlite3 { i64 lastRowid; /* ROWID of most recent insert (see above) */ i64 szMmap; /* Default mmap_size setting */ u32 nSchemaLock; /* Do not reset the schema when non-zero */ - unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */ + unsigned int openFlags; /* Flags passed to tdsqlite3_vfs.xOpen() */ int errCode; /* Most recent error code (SQLITE_*) */ int errMask; /* & result codes with this before returning */ int iSysErrno; /* Errno value from last system error */ @@ -16742,11 +16742,11 @@ struct sqlite3 { u8 nSqlExec; /* Number of pending OP_SqlExec opcodes */ int nextPagesize; /* Pagesize after VACUUM if >0 */ u32 magic; /* Magic number for detect library misuse */ - int nChange; /* Value returned by sqlite3_changes() */ - int nTotalChange; /* Value returned by sqlite3_total_changes() */ + int nChange; /* Value returned by tdsqlite3_changes() */ + int nTotalChange; /* Value returned by tdsqlite3_total_changes() */ int aLimit[SQLITE_N_LIMIT]; /* Limits */ int nMaxSorterMmap; /* Maximum size of regions mapped by sorter */ - struct sqlite3InitInfo { /* Information used during initialization */ + struct tdsqlite3InitInfo { /* Information used during initialization */ int newTnum; /* Rootpage of table being initialized */ u8 iDb; /* Which db file is being initialized */ u8 busy; /* TRUE if currently initializing */ @@ -16777,26 +16777,26 @@ struct sqlite3 { Parse *pParse; /* Current parse */ #ifdef SQLITE_ENABLE_PREUPDATE_HOOK void *pPreUpdateArg; /* First argument to xPreUpdateCallback */ - void (*xPreUpdateCallback)( /* Registered using sqlite3_preupdate_hook() */ - void*,sqlite3*,int,char const*,char const*,sqlite3_int64,sqlite3_int64 + void (*xPreUpdateCallback)( /* Registered using tdsqlite3_preupdate_hook() */ + void*,tdsqlite3*,int,char const*,char const*,tdsqlite3_int64,tdsqlite3_int64 ); PreUpdate *pPreUpdate; /* Context for active pre-update callback */ #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ #ifndef SQLITE_OMIT_WAL - int (*xWalCallback)(void *, sqlite3 *, const char *, int); + int (*xWalCallback)(void *, tdsqlite3 *, const char *, int); void *pWalArg; #endif - void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*); - void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*); + void(*xCollNeeded)(void*,tdsqlite3*,int eTextRep,const char*); + void(*xCollNeeded16)(void*,tdsqlite3*,int eTextRep,const void*); void *pCollNeededArg; - sqlite3_value *pErr; /* Most recent error message */ + tdsqlite3_value *pErr; /* Most recent error message */ union { - volatile int isInterrupted; /* True if sqlite3_interrupt has been called */ + volatile int isInterrupted; /* True if tdsqlite3_interrupt has been called */ double notUsed1; /* Spacer */ } u1; Lookaside lookaside; /* Lookaside malloc configuration */ #ifndef SQLITE_OMIT_AUTHORIZATION - sqlite3_xauth xAuth; /* Access authorization function */ + tdsqlite3_xauth xAuth; /* Access authorization function */ void *pAuthArg; /* 1st argument to the access auth function */ #endif #ifndef SQLITE_OMIT_PROGRESS_CALLBACK @@ -16806,10 +16806,10 @@ struct sqlite3 { #endif #ifndef SQLITE_OMIT_VIRTUALTABLE int nVTrans; /* Allocated size of aVTrans */ - Hash aModule; /* populated by sqlite3_create_module() */ + Hash aModule; /* populated by tdsqlite3_create_module() */ VtabCtx *pVtabCtx; /* Context for active vtab connect/create */ VTable **aVTrans; /* Virtual tables with open transactions */ - VTable *pDisconnect; /* Disconnect these in next sqlite3_prepare() */ + VTable *pDisconnect; /* Disconnect these in next tdsqlite3_prepare() */ #endif Hash aFunc; /* Hash table of connection functions */ Hash aCollSeq; /* All collating sequences */ @@ -16833,14 +16833,14 @@ struct sqlite3 { ** tried to do recently failed with an SQLITE_LOCKED error due to locks ** held by Y. */ - sqlite3 *pBlockingConnection; /* Connection that caused SQLITE_LOCKED */ - sqlite3 *pUnlockConnection; /* Connection to watch for unlock */ + tdsqlite3 *pBlockingConnection; /* Connection that caused SQLITE_LOCKED */ + tdsqlite3 *pUnlockConnection; /* Connection to watch for unlock */ void *pUnlockArg; /* Argument to xUnlockNotify */ void (*xUnlockNotify)(void **, int); /* Unlock notify callback */ - sqlite3 *pNextBlocked; /* Next in list of all blocked connections */ + tdsqlite3 *pNextBlocked; /* Next in list of all blocked connections */ #endif #ifdef SQLITE_USER_AUTHENTICATION - sqlite3_userauth auth; /* User authentication information */ + tdsqlite3_userauth auth; /* User authentication information */ #endif }; @@ -16908,7 +16908,7 @@ struct sqlite3 { #define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */ #define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */ #define SQLITE_VdbeTrace HI(0x0400000) /* True to trace VDBE execution */ -#define SQLITE_VdbeAddopTrace HI(0x0800000) /* Trace sqlite3VdbeAddOp() calls */ +#define SQLITE_VdbeAddopTrace HI(0x0800000) /* Trace tdsqlite3VdbeAddOp() calls */ #define SQLITE_VdbeEQP HI(0x1000000) /* Debug EXPLAIN QUERY PLAN */ #define SQLITE_ParserTrace HI(0x2000000) /* PRAGMA parser_trace=ON */ #endif @@ -16925,7 +16925,7 @@ struct sqlite3 { /* ** Bits of the sqlite3.dbOptFlags field that are used by the -** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to +** tdsqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to ** selectively disable various optimizations. */ #define SQLITE_QueryFlattener 0x0001 /* Query flattening */ @@ -16974,7 +16974,7 @@ struct sqlite3 { /* ** Each SQL function is defined by an instance of the following ** structure. For global built-in functions (ex: substr(), max(), count()) -** a pointer to this structure is held in the sqlite3BuiltinFunctions object. +** a pointer to this structure is held in the tdsqlite3BuiltinFunctions object. ** For per-connection application-defined functions, a pointer to this ** structure is held in the db->aHash hash table. ** @@ -16986,10 +16986,10 @@ struct FuncDef { u32 funcFlags; /* Some combination of SQLITE_FUNC_* */ void *pUserData; /* User data parameter */ FuncDef *pNext; /* Next function with same name */ - void (*xSFunc)(sqlite3_context*,int,sqlite3_value**); /* func or agg-step */ - void (*xFinalize)(sqlite3_context*); /* Agg finalizer */ - void (*xValue)(sqlite3_context*); /* Current agg value */ - void (*xInverse)(sqlite3_context*,int,sqlite3_value**); /* inverse agg-step */ + void (*xSFunc)(tdsqlite3_context*,int,tdsqlite3_value**); /* func or agg-step */ + void (*xFinalize)(tdsqlite3_context*); /* Agg finalizer */ + void (*xValue)(tdsqlite3_context*); /* Current agg value */ + void (*xInverse)(tdsqlite3_context*,int,tdsqlite3_value**); /* inverse agg-step */ const char *zName; /* SQL name of the function. */ union { FuncDef *pHash; /* Next with a different name but the same hash */ @@ -17036,7 +17036,7 @@ struct FuncDestructor { #define SQLITE_FUNC_LIKE 0x0004 /* Candidate for the LIKE optimization */ #define SQLITE_FUNC_CASE 0x0008 /* Case-sensitive LIKE-type function */ #define SQLITE_FUNC_EPHEM 0x0010 /* Ephemeral. Delete with VDBE */ -#define SQLITE_FUNC_NEEDCOLL 0x0020 /* sqlite3GetFuncCollSeq() might be called*/ +#define SQLITE_FUNC_NEEDCOLL 0x0020 /* tdsqlite3GetFuncCollSeq() might be called*/ #define SQLITE_FUNC_LENGTH 0x0040 /* Built-in length() function */ #define SQLITE_FUNC_TYPEOF 0x0080 /* Built-in typeof() function */ #define SQLITE_FUNC_COUNT 0x0100 /* Built-in count(*) aggregate */ @@ -17071,7 +17071,7 @@ struct FuncDestructor { ** Used to create a scalar function definition of a function zName ** implemented by C function xFunc that accepts nArg arguments. The ** value passed as iArg is cast to a (void*) and made available -** as the user-data (sqlite3_user_data()) for the function. If +** as the user-data (tdsqlite3_user_data()) for the function. If ** argument bNC is true, then the SQLITE_FUNC_NEEDCOLL flag is set. ** ** VFUNCTION(zName, nArg, iArg, bNC, xFunc) @@ -17122,7 +17122,7 @@ struct FuncDestructor { ** Used to create a scalar function definition of a function zName ** that accepts nArg arguments and is implemented by a call to C ** function likeFunc. Argument pArg is cast to a (void *) and made -** available as the function user-data (sqlite3_user_data()). The +** available as the function user-data (tdsqlite3_user_data()). The ** FuncDef.flags variable is set to the value passed as the flags ** parameter. */ @@ -17147,7 +17147,7 @@ struct FuncDestructor { 0, 0, xFunc, 0, 0, 0, #zName, {0} } #define PURE_DATE(zName, nArg, iArg, bNC, xFunc) \ {nArg, SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|SQLITE_FUNC_CONSTANT, \ - (void*)&sqlite3Config, 0, xFunc, 0, 0, 0, #zName, {0} } + (void*)&tdsqlite3Config, 0, xFunc, 0, 0, 0, #zName, {0} } #define FUNCTION2(zName, nArg, iArg, bNC, xFunc, extraFlags) \ {nArg,SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL)|extraFlags,\ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} } @@ -17179,7 +17179,7 @@ struct Savepoint { }; /* -** The following are used as the second parameter to sqlite3Savepoint(), +** The following are used as the second parameter to tdsqlite3Savepoint(), ** and as the P1 argument to the OP_Savepoint instruction. */ #define SAVEPOINT_BEGIN 0 @@ -17193,7 +17193,7 @@ struct Savepoint { ** hash table. */ struct Module { - const sqlite3_module *pModule; /* Callback pointers */ + const tdsqlite3_module *pModule; /* Callback pointers */ const char *zName; /* Name passed to create_module() */ int nRefModule; /* Number of pointers to this object */ void *pAux; /* pAux passed to create_module() */ @@ -17287,7 +17287,7 @@ struct CollSeq { #define SQLITE_AFF_INTEGER 0x44 /* 'D' */ #define SQLITE_AFF_REAL 0x45 /* 'E' */ -#define sqlite3IsNumericAffinity(X) ((X)>=SQLITE_AFF_NUMERIC) +#define tdsqlite3IsNumericAffinity(X) ((X)>=SQLITE_AFF_NUMERIC) /* ** The SQLITE_AFF_MASK values masks off the significant bits of an @@ -17315,10 +17315,10 @@ struct CollSeq { ** the database schema. ** ** If the database schema is shared, then there is one instance of this -** structure for each database connection (sqlite3*) that uses the shared +** structure for each database connection (tdsqlite3*) that uses the shared ** schema. This is because each database connection requires its own unique -** instance of the sqlite3_vtab* handle used to access the virtual table -** implementation. sqlite3_vtab* handles can not be shared between +** instance of the tdsqlite3_vtab* handle used to access the virtual table +** implementation. tdsqlite3_vtab* handles can not be shared between ** database connections, even when the rest of the in-memory database ** schema is shared, as the implementation often stores the database ** connection handle passed to it via the xConnect() or xCreate() method @@ -17331,31 +17331,31 @@ struct CollSeq { ** All VTable objects that correspond to a single table in a shared ** database schema are initially stored in a linked-list pointed to by ** the Table.pVTable member variable of the corresponding Table object. -** When an sqlite3_prepare() operation is required to access the virtual +** When an tdsqlite3_prepare() operation is required to access the virtual ** table, it searches the list for the VTable that corresponds to the ** database connection doing the preparing so as to use the correct -** sqlite3_vtab* handle in the compiled query. +** tdsqlite3_vtab* handle in the compiled query. ** ** When an in-memory Table object is deleted (for example when the ** schema is being reloaded for some reason), the VTable objects are not -** deleted and the sqlite3_vtab* handles are not xDisconnect()ed +** deleted and the tdsqlite3_vtab* handles are not xDisconnect()ed ** immediately. Instead, they are moved from the Table.pVTable list to ** another linked list headed by the sqlite3.pDisconnect member of the -** corresponding sqlite3 structure. They are then deleted/xDisconnected -** next time a statement is prepared using said sqlite3*. This is done +** corresponding tdsqlite3 structure. They are then deleted/xDisconnected +** next time a statement is prepared using said tdsqlite3*. This is done ** to avoid deadlock issues involving multiple sqlite3.mutex mutexes. -** Refer to comments above function sqlite3VtabUnlockList() for an +** Refer to comments above function tdsqlite3VtabUnlockList() for an ** explanation as to why it is safe to add an entry to an sqlite3.pDisconnect ** list without holding the corresponding sqlite3.mutex mutex. ** ** The memory for objects of this type is always allocated by -** sqlite3DbMalloc(), using the connection handle stored in VTable.db as +** tdsqlite3DbMalloc(), using the connection handle stored in VTable.db as ** the first argument. */ struct VTable { - sqlite3 *db; /* Database connection associated with this table */ + tdsqlite3 *db; /* Database connection associated with this table */ Module *pMod; /* Pointer to module implementation */ - sqlite3_vtab *pVtab; /* Pointer to vtab instance */ + tdsqlite3_vtab *pVtab; /* Pointer to vtab instance */ int nRef; /* Number of pointers to this structure */ u8 bConstraint; /* True if constraints are supported */ u8 eVtabRisk; /* Riskiness of allowing hacker access */ @@ -17556,7 +17556,7 @@ struct FKey { /* ** An instance of the following structure is passed as the first -** argument to sqlite3VdbeKeyCompare and is used to control the +** argument to tdsqlite3VdbeKeyCompare and is used to control the ** comparison of the two index keys. ** ** Note that aSortOrder[] and aColl[] have nField+1 slots. There @@ -17568,7 +17568,7 @@ struct KeyInfo { u8 enc; /* Text encoding - one of the SQLITE_UTF* values */ u16 nKeyField; /* Number of key columns in the index */ u16 nAllField; /* Total columns, including key plus others */ - sqlite3 *db; /* The database connection */ + tdsqlite3 *db; /* The database connection */ u8 *aSortFlags; /* Sort order for each column. */ CollSeq *aColl[1]; /* Collating sequence for each term of the key */ }; @@ -17732,7 +17732,7 @@ struct IndexSample { }; /* -** Possible values to use within the flags argument to sqlite3GetToken(). +** Possible values to use within the flags argument to tdsqlite3GetToken(). */ #define SQLITE_TOKEN_QUOTED 0x1 /* Token is a quoted identifier. */ #define SQLITE_TOKEN_KEYWORD 0x2 /* Token is a keyword. */ @@ -17955,7 +17955,7 @@ struct Expr { #define EP_Reduced 0x002000 /* Expr struct EXPR_REDUCEDSIZE bytes only */ #define EP_TokenOnly 0x004000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */ #define EP_Win 0x008000 /* Contains window functions */ -#define EP_MemToken 0x010000 /* Need to sqlite3DbFree() Expr.zToken */ +#define EP_MemToken 0x010000 /* Need to tdsqlite3DbFree() Expr.zToken */ #define EP_NoReduce 0x020000 /* Cannot EXPRDUP_REDUCE this Expr */ #define EP_Unlikely 0x040000 /* unlikely() or likelihood() function */ #define EP_ConstFunc 0x080000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */ @@ -18008,8 +18008,8 @@ struct Expr { #define EXPR_TOKENONLYSIZE offsetof(Expr,pLeft) /* Fewer features */ /* -** Flags passed to the sqlite3ExprDup() function. See the header comment -** above sqlite3ExprDup() for details. +** Flags passed to the tdsqlite3ExprDup() function. See the header comment +** above tdsqlite3ExprDup() for details. */ #define EXPRDUP_REDUCE 0x0001 /* Used reduced-size Expr nodes */ @@ -18111,7 +18111,7 @@ struct IdList { ** ** The jointype starts out showing the join type between the current table ** and the next table on the list. The parser builds the list this way. -** But sqlite3SrcListShiftJoinType() later shifts the jointypes so that each +** But tdsqlite3SrcListShiftJoinType() later shifts the jointypes so that each ** jointype expresses the join between the table and the previous table. ** ** In the colUsed field, the high-order bit (bit 63) is set if the table @@ -18165,7 +18165,7 @@ struct SrcList { /* -** Flags appropriate for the wctrlFlags parameter of sqlite3WhereBegin() +** Flags appropriate for the wctrlFlags parameter of tdsqlite3WhereBegin() ** and the WhereInfo.wctrlFlags member. ** ** Value constraints (enforced via assert()): @@ -18182,7 +18182,7 @@ struct SrcList { #define WHERE_GROUPBY 0x0040 /* pOrderBy is really a GROUP BY */ #define WHERE_DISTINCTBY 0x0080 /* pOrderby is really a DISTINCT clause */ #define WHERE_WANT_DISTINCT 0x0100 /* All output needs to be distinct */ -#define WHERE_SORTBYGROUP 0x0200 /* Support sqlite3WhereIsSorted() */ +#define WHERE_SORTBYGROUP 0x0200 /* Support tdsqlite3WhereIsSorted() */ #define WHERE_SEEK_TABLE 0x0400 /* Do not defer seeks on main table */ #define WHERE_ORDERBY_LIMIT 0x0800 /* ORDERBY+LIMIT on the inner loop */ #define WHERE_SEEK_UNIQ_TABLE 0x1000 /* Do not defer seeks if unique */ @@ -18190,7 +18190,7 @@ struct SrcList { #define WHERE_USE_LIMIT 0x4000 /* Use the LIMIT in cost estimates */ /* 0x8000 not currently used */ -/* Allowed return values from sqlite3WhereIsDistinct() +/* Allowed return values from tdsqlite3WhereIsDistinct() */ #define WHERE_DISTINCT_NOOP 0 /* DISTINCT keyword not used */ #define WHERE_DISTINCT_UNIQUE 1 /* No duplicates */ @@ -18346,7 +18346,7 @@ struct Select { #define SF_Aggregate 0x0000008 /* Contains agg functions or a GROUP BY */ #define SF_HasAgg 0x0000010 /* Contains aggregate functions */ #define SF_UsesEphemeral 0x0000020 /* Uses the OpenEphemeral opcode */ -#define SF_Expanded 0x0000040 /* sqlite3SelectExpand() called on this */ +#define SF_Expanded 0x0000040 /* tdsqlite3SelectExpand() called on this */ #define SF_HasTypeInfo 0x0000080 /* FROM subqueries have Table metadata */ #define SF_Compound 0x0000100 /* Part of a compound query */ #define SF_Values 0x0000200 /* Synthesized from VALUES clause */ @@ -18509,8 +18509,8 @@ struct TriggerPrg { # define DbMaskTest(M,I) (((M)[(I)/8]&(1<<((I)&7)))!=0) # define DbMaskZero(M) memset((M),0,sizeof(M)) # define DbMaskSet(M,I) (M)[(I)/8]|=(1<<((I)&7)) -# define DbMaskAllZero(M) sqlite3DbMaskAllZero(M) -# define DbMaskNonZero(M) (sqlite3DbMaskAllZero(M)==0) +# define DbMaskAllZero(M) tdsqlite3DbMaskAllZero(M) +# define DbMaskNonZero(M) (tdsqlite3DbMaskAllZero(M)==0) #else typedef unsigned int yDbMask; # define DbMaskTest(M,I) (((M)&(((yDbMask)1)<<(I)))!=0) @@ -18531,13 +18531,13 @@ struct TriggerPrg { ** each recursion. ** ** The nTableLock and aTableLock variables are only used if the shared-cache -** feature is enabled (if sqlite3Tsd()->useSharedData is true). They are +** feature is enabled (if tdsqlite3Tsd()->useSharedData is true). They are ** used to store the set of table-locks required by the statement being -** compiled. Function sqlite3TableLock() is used to add entries to the +** compiled. Function tdsqlite3TableLock() is used to add entries to the ** list. */ struct Parse { - sqlite3 *db; /* The main database structure */ + tdsqlite3 *db; /* The main database structure */ char *zErrMsg; /* An error message */ Vdbe *pVdbe; /* An engine for executing database bytecode */ int rc; /* Return code from execution */ @@ -18618,7 +18618,7 @@ struct Parse { int addrExplain; /* Address of current OP_Explain opcode */ #endif VList *pVList; /* Mapping between variable names and numbers */ - Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */ + Vdbe *pReprepare; /* VM being reprepared (tdsqlite3Reprepare()) */ const char *zTail; /* All SQL text past the last semicolon parsed */ Table *pNewTable; /* A table being constructed by CREATE TABLE */ Index *pNewIndex; /* An index being constructed by CREATE INDEX. @@ -18653,7 +18653,7 @@ struct Parse { #define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */ /* -** Return true if currently inside an sqlite3_declare_vtab() call. +** Return true if currently inside an tdsqlite3_declare_vtab() call. */ #ifdef SQLITE_OMIT_VIRTUALTABLE #define IN_DECLARE_VTAB 0 @@ -18719,7 +18719,7 @@ struct AuthContext { * struct Trigger. * * Pointers to instances of struct Trigger are stored in two ways. - * 1. In the "trigHash" hash table (part of the sqlite3* that represents the + * 1. In the "trigHash" hash table (part of the tdsqlite3* that represents the * database). This allows Trigger structures to be retrieved by name. * 2. All triggers associated with a single table form a linked list, using the * pNext member of struct Trigger. A pointer to the first element of the @@ -18787,7 +18787,7 @@ struct Trigger { * pWhere -> The WHERE clause of the UPDATE statement if one is specified. * Otherwise NULL. * pExprList -> A list of the columns to update and the expressions to update - * them to. See sqlite3Update() documentation of "pChanges" + * them to. See tdsqlite3Update() documentation of "pChanges" * argument. * */ @@ -18825,8 +18825,8 @@ struct DbFixer { ** An objected used to accumulate the text of a string where we ** do not necessarily know how big the string will be in the end. */ -struct sqlite3_str { - sqlite3 *db; /* Optional database for lookaside. Can be NULL */ +struct tdsqlite3_str { + tdsqlite3 *db; /* Optional database for lookaside. Can be NULL */ char *zText; /* The string collected so far */ u32 nAlloc; /* Amount of space allocated in zText */ u32 mxAlloc; /* Maximum allowed allocation. 0 for no malloc usage */ @@ -18843,10 +18843,10 @@ struct sqlite3_str { /* ** A pointer to this structure is used to communicate information -** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback. +** from tdsqlite3Init and OP_ParseSchema into the tdsqlite3InitCallback. */ typedef struct { - sqlite3 *db; /* The database being initialized */ + tdsqlite3 *db; /* The database being initialized */ char **pzErrMsg; /* Error message stored here */ int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */ int rc; /* Result code stored here */ @@ -18877,14 +18877,14 @@ struct Sqlite3Config { int szLookaside; /* Default lookaside buffer size */ int nLookaside; /* Default lookaside buffer count */ int nStmtSpill; /* Stmt-journal spill-to-disk threshold */ - sqlite3_mem_methods m; /* Low-level memory allocation interface */ - sqlite3_mutex_methods mutex; /* Low-level mutex interface */ - sqlite3_pcache_methods2 pcache2; /* Low-level page-cache interface */ + tdsqlite3_mem_methods m; /* Low-level memory allocation interface */ + tdsqlite3_mutex_methods mutex; /* Low-level mutex interface */ + tdsqlite3_pcache_methods2 pcache2; /* Low-level page-cache interface */ void *pHeap; /* Heap storage space */ int nHeap; /* Size of pHeap[] */ int mnReq, mxReq; /* Min and max heap requests sizes */ - sqlite3_int64 szMmap; /* mmap() space per open file */ - sqlite3_int64 mxMmap; /* Maximum value for szMmap */ + tdsqlite3_int64 szMmap; /* mmap() space per open file */ + tdsqlite3_int64 mxMmap; /* Maximum value for szMmap */ void *pPage; /* Page cache memory */ int szPage; /* Size of each page in pPage[] */ int nPage; /* Number of pages in pPage[] */ @@ -18899,11 +18899,11 @@ struct Sqlite3Config { int isMallocInit; /* True after malloc is initialized */ int isPCacheInit; /* True after malloc is initialized */ int nRefInitMutex; /* Number of users of pInitMutex */ - sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */ + tdsqlite3_mutex *pInitMutex; /* Mutex used by tdsqlite3_initialize() */ void (*xLog)(void*,int,const char*); /* Function for logging */ void *pLogArg; /* First argument to xLog() */ #ifdef SQLITE_ENABLE_SQLLOG - void(*xSqllog)(void*,sqlite3*,const char*, int); + void(*xSqllog)(void*,tdsqlite3*,const char*, int); void *pSqllogArg; #endif #ifdef SQLITE_VDBE_COVERAGE @@ -18914,10 +18914,10 @@ struct Sqlite3Config { void *pVdbeBranchArg; /* 1st argument */ #endif #ifdef SQLITE_ENABLE_DESERIALIZE - sqlite3_int64 mxMemdbSize; /* Default max memdb size */ + tdsqlite3_int64 mxMemdbSize; /* Default max memdb size */ #endif #ifndef SQLITE_UNTESTABLE - int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */ + int (*xTestCallback)(int); /* Invoked by tdsqlite3FaultSim() */ #endif int bLocaltimeFault; /* True to fail localtime() calls */ int iOnceResetThreshold; /* When to reset OP_Once counters */ @@ -18938,10 +18938,10 @@ struct Sqlite3Config { ** CORRUPT_DB is true during normal operation. CORRUPT_DB does not indicate ** that the database is definitely corrupt, only that it might be corrupt. ** For most test cases, CORRUPT_DB is set to false using a special -** sqlite3_test_control(). This enables assert() statements to prove +** tdsqlite3_test_control(). This enables assert() statements to prove ** things that are always true for well-formed databases. */ -#define CORRUPT_DB (sqlite3Config.neverCorrupt==0) +#define CORRUPT_DB (tdsqlite3Config.neverCorrupt==0) /* ** Context pointer passed down through the tree-walk. @@ -18973,16 +18973,16 @@ struct Walker { }; /* Forward declarations */ -SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*); -SQLITE_PRIVATE int sqlite3WalkExprList(Walker*, ExprList*); -SQLITE_PRIVATE int sqlite3WalkSelect(Walker*, Select*); -SQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker*, Select*); -SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker*, Select*); -SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker*, Expr*); -SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker*, Select*); -SQLITE_PRIVATE int sqlite3SelectWalkFail(Walker*, Select*); +SQLITE_PRIVATE int tdsqlite3WalkExpr(Walker*, Expr*); +SQLITE_PRIVATE int tdsqlite3WalkExprList(Walker*, ExprList*); +SQLITE_PRIVATE int tdsqlite3WalkSelect(Walker*, Select*); +SQLITE_PRIVATE int tdsqlite3WalkSelectExpr(Walker*, Select*); +SQLITE_PRIVATE int tdsqlite3WalkSelectFrom(Walker*, Select*); +SQLITE_PRIVATE int tdsqlite3ExprWalkNoop(Walker*, Expr*); +SQLITE_PRIVATE int tdsqlite3SelectWalkNoop(Walker*, Select*); +SQLITE_PRIVATE int tdsqlite3SelectWalkFail(Walker*, Select*); #ifdef SQLITE_DEBUG -SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker*, Select*); +SQLITE_PRIVATE void tdsqlite3SelectWalkAssert2(Walker*, Select*); #endif /* @@ -19011,7 +19011,7 @@ struct With { #ifdef SQLITE_DEBUG /* ** An instance of the TreeView object is used for printing the content of -** data structures on sqlite3DebugPrintf() using a tree-like view. +** data structures on tdsqlite3DebugPrintf() using a tree-like view. */ struct TreeView { int iLevel; /* Which level of the tree we are on */ @@ -19075,27 +19075,27 @@ struct Window { }; #ifndef SQLITE_OMIT_WINDOWFUNC -SQLITE_PRIVATE void sqlite3WindowDelete(sqlite3*, Window*); -SQLITE_PRIVATE void sqlite3WindowUnlinkFromSelect(Window*); -SQLITE_PRIVATE void sqlite3WindowListDelete(sqlite3 *db, Window *p); -SQLITE_PRIVATE Window *sqlite3WindowAlloc(Parse*, int, int, Expr*, int , Expr*, u8); -SQLITE_PRIVATE void sqlite3WindowAttach(Parse*, Expr*, Window*); -SQLITE_PRIVATE void sqlite3WindowLink(Select *pSel, Window *pWin); -SQLITE_PRIVATE int sqlite3WindowCompare(Parse*, Window*, Window*, int); -SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse*, Select*); -SQLITE_PRIVATE void sqlite3WindowCodeStep(Parse*, Select*, WhereInfo*, int, int); -SQLITE_PRIVATE int sqlite3WindowRewrite(Parse*, Select*); -SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, struct SrcList_item*); -SQLITE_PRIVATE void sqlite3WindowUpdate(Parse*, Window*, Window*, FuncDef*); -SQLITE_PRIVATE Window *sqlite3WindowDup(sqlite3 *db, Expr *pOwner, Window *p); -SQLITE_PRIVATE Window *sqlite3WindowListDup(sqlite3 *db, Window *p); -SQLITE_PRIVATE void sqlite3WindowFunctions(void); -SQLITE_PRIVATE void sqlite3WindowChain(Parse*, Window*, Window*); -SQLITE_PRIVATE Window *sqlite3WindowAssemble(Parse*, Window*, ExprList*, ExprList*, Token*); +SQLITE_PRIVATE void tdsqlite3WindowDelete(tdsqlite3*, Window*); +SQLITE_PRIVATE void tdsqlite3WindowUnlinkFromSelect(Window*); +SQLITE_PRIVATE void tdsqlite3WindowListDelete(tdsqlite3 *db, Window *p); +SQLITE_PRIVATE Window *tdsqlite3WindowAlloc(Parse*, int, int, Expr*, int , Expr*, u8); +SQLITE_PRIVATE void tdsqlite3WindowAttach(Parse*, Expr*, Window*); +SQLITE_PRIVATE void tdsqlite3WindowLink(Select *pSel, Window *pWin); +SQLITE_PRIVATE int tdsqlite3WindowCompare(Parse*, Window*, Window*, int); +SQLITE_PRIVATE void tdsqlite3WindowCodeInit(Parse*, Select*); +SQLITE_PRIVATE void tdsqlite3WindowCodeStep(Parse*, Select*, WhereInfo*, int, int); +SQLITE_PRIVATE int tdsqlite3WindowRewrite(Parse*, Select*); +SQLITE_PRIVATE int tdsqlite3ExpandSubquery(Parse*, struct SrcList_item*); +SQLITE_PRIVATE void tdsqlite3WindowUpdate(Parse*, Window*, Window*, FuncDef*); +SQLITE_PRIVATE Window *tdsqlite3WindowDup(tdsqlite3 *db, Expr *pOwner, Window *p); +SQLITE_PRIVATE Window *tdsqlite3WindowListDup(tdsqlite3 *db, Window *p); +SQLITE_PRIVATE void tdsqlite3WindowFunctions(void); +SQLITE_PRIVATE void tdsqlite3WindowChain(Parse*, Window*, Window*); +SQLITE_PRIVATE Window *tdsqlite3WindowAssemble(Parse*, Window*, ExprList*, ExprList*, Token*); #else -# define sqlite3WindowDelete(a,b) -# define sqlite3WindowFunctions() -# define sqlite3WindowAttach(a,b,c) +# define tdsqlite3WindowDelete(a,b) +# define tdsqlite3WindowFunctions() +# define tdsqlite3WindowAttach(a,b,c) #endif /* @@ -19112,27 +19112,27 @@ SQLITE_PRIVATE Window *sqlite3WindowAssemble(Parse*, Window*, ExprList*, ExprLis ** The SQLITE_*_BKPT macros are substitutes for the error codes with ** the same name but without the _BKPT suffix. These macros invoke ** routines that report the line-number on which the error originated -** using sqlite3_log(). The routines also provide a convenient place +** using tdsqlite3_log(). The routines also provide a convenient place ** to set a debugger breakpoint. */ -SQLITE_PRIVATE int sqlite3ReportError(int iErr, int lineno, const char *zType); -SQLITE_PRIVATE int sqlite3CorruptError(int); -SQLITE_PRIVATE int sqlite3MisuseError(int); -SQLITE_PRIVATE int sqlite3CantopenError(int); -#define SQLITE_CORRUPT_BKPT sqlite3CorruptError(__LINE__) -#define SQLITE_MISUSE_BKPT sqlite3MisuseError(__LINE__) -#define SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__) +SQLITE_PRIVATE int tdsqlite3ReportError(int iErr, int lineno, const char *zType); +SQLITE_PRIVATE int tdsqlite3CorruptError(int); +SQLITE_PRIVATE int tdsqlite3MisuseError(int); +SQLITE_PRIVATE int tdsqlite3CantopenError(int); +#define SQLITE_CORRUPT_BKPT tdsqlite3CorruptError(__LINE__) +#define SQLITE_MISUSE_BKPT tdsqlite3MisuseError(__LINE__) +#define SQLITE_CANTOPEN_BKPT tdsqlite3CantopenError(__LINE__) #ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3NomemError(int); -SQLITE_PRIVATE int sqlite3IoerrnomemError(int); -SQLITE_PRIVATE int sqlite3CorruptPgnoError(int,Pgno); -# define SQLITE_NOMEM_BKPT sqlite3NomemError(__LINE__) -# define SQLITE_IOERR_NOMEM_BKPT sqlite3IoerrnomemError(__LINE__) -# define SQLITE_CORRUPT_PGNO(P) sqlite3CorruptPgnoError(__LINE__,(P)) +SQLITE_PRIVATE int tdsqlite3NomemError(int); +SQLITE_PRIVATE int tdsqlite3IoerrnomemError(int); +SQLITE_PRIVATE int tdsqlite3CorruptPgnoError(int,Pgno); +# define SQLITE_NOMEM_BKPT tdsqlite3NomemError(__LINE__) +# define SQLITE_IOERR_NOMEM_BKPT tdsqlite3IoerrnomemError(__LINE__) +# define SQLITE_CORRUPT_PGNO(P) tdsqlite3CorruptPgnoError(__LINE__,(P)) #else # define SQLITE_NOMEM_BKPT SQLITE_NOMEM # define SQLITE_IOERR_NOMEM_BKPT SQLITE_IOERR_NOMEM -# define SQLITE_CORRUPT_PGNO(P) sqlite3CorruptError(__LINE__) +# define SQLITE_CORRUPT_PGNO(P) tdsqlite3CorruptError(__LINE__) #endif /* @@ -19167,59 +19167,59 @@ SQLITE_PRIVATE int sqlite3CorruptPgnoError(int,Pgno); ** sqlite versions only work for ASCII characters, regardless of locale. */ #ifdef SQLITE_ASCII -# define sqlite3Toupper(x) ((x)&~(sqlite3CtypeMap[(unsigned char)(x)]&0x20)) -# define sqlite3Isspace(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x01) -# define sqlite3Isalnum(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x06) -# define sqlite3Isalpha(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x02) -# define sqlite3Isdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x04) -# define sqlite3Isxdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x08) -# define sqlite3Tolower(x) (sqlite3UpperToLower[(unsigned char)(x)]) -# define sqlite3Isquote(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x80) +# define tdsqlite3Toupper(x) ((x)&~(tdsqlite3CtypeMap[(unsigned char)(x)]&0x20)) +# define tdsqlite3Isspace(x) (tdsqlite3CtypeMap[(unsigned char)(x)]&0x01) +# define tdsqlite3Isalnum(x) (tdsqlite3CtypeMap[(unsigned char)(x)]&0x06) +# define tdsqlite3Isalpha(x) (tdsqlite3CtypeMap[(unsigned char)(x)]&0x02) +# define tdsqlite3Isdigit(x) (tdsqlite3CtypeMap[(unsigned char)(x)]&0x04) +# define tdsqlite3Isxdigit(x) (tdsqlite3CtypeMap[(unsigned char)(x)]&0x08) +# define tdsqlite3Tolower(x) (tdsqlite3UpperToLower[(unsigned char)(x)]) +# define tdsqlite3Isquote(x) (tdsqlite3CtypeMap[(unsigned char)(x)]&0x80) #else -# define sqlite3Toupper(x) toupper((unsigned char)(x)) -# define sqlite3Isspace(x) isspace((unsigned char)(x)) -# define sqlite3Isalnum(x) isalnum((unsigned char)(x)) -# define sqlite3Isalpha(x) isalpha((unsigned char)(x)) -# define sqlite3Isdigit(x) isdigit((unsigned char)(x)) -# define sqlite3Isxdigit(x) isxdigit((unsigned char)(x)) -# define sqlite3Tolower(x) tolower((unsigned char)(x)) -# define sqlite3Isquote(x) ((x)=='"'||(x)=='\''||(x)=='['||(x)=='`') +# define tdsqlite3Toupper(x) toupper((unsigned char)(x)) +# define tdsqlite3Isspace(x) isspace((unsigned char)(x)) +# define tdsqlite3Isalnum(x) isalnum((unsigned char)(x)) +# define tdsqlite3Isalpha(x) isalpha((unsigned char)(x)) +# define tdsqlite3Isdigit(x) isdigit((unsigned char)(x)) +# define tdsqlite3Isxdigit(x) isxdigit((unsigned char)(x)) +# define tdsqlite3Tolower(x) tolower((unsigned char)(x)) +# define tdsqlite3Isquote(x) ((x)=='"'||(x)=='\''||(x)=='['||(x)=='`') #endif -SQLITE_PRIVATE int sqlite3IsIdChar(u8); +SQLITE_PRIVATE int tdsqlite3IsIdChar(u8); /* ** Internal function prototypes */ -SQLITE_PRIVATE int sqlite3StrICmp(const char*,const char*); -SQLITE_PRIVATE int sqlite3Strlen30(const char*); -#define sqlite3Strlen30NN(C) (strlen(C)&0x3fffffff) -SQLITE_PRIVATE char *sqlite3ColumnType(Column*,char*); -#define sqlite3StrNICmp sqlite3_strnicmp +SQLITE_PRIVATE int tdsqlite3StrICmp(const char*,const char*); +SQLITE_PRIVATE int tdsqlite3Strlen30(const char*); +#define tdsqlite3Strlen30NN(C) (strlen(C)&0x3fffffff) +SQLITE_PRIVATE char *tdsqlite3ColumnType(Column*,char*); +#define tdsqlite3StrNICmp tdsqlite3_strnicmp -SQLITE_PRIVATE int sqlite3MallocInit(void); -SQLITE_PRIVATE void sqlite3MallocEnd(void); -SQLITE_PRIVATE void *sqlite3Malloc(u64); -SQLITE_PRIVATE void *sqlite3MallocZero(u64); -SQLITE_PRIVATE void *sqlite3DbMallocZero(sqlite3*, u64); -SQLITE_PRIVATE void *sqlite3DbMallocRaw(sqlite3*, u64); -SQLITE_PRIVATE void *sqlite3DbMallocRawNN(sqlite3*, u64); -SQLITE_PRIVATE char *sqlite3DbStrDup(sqlite3*,const char*); -SQLITE_PRIVATE char *sqlite3DbStrNDup(sqlite3*,const char*, u64); -SQLITE_PRIVATE char *sqlite3DbSpanDup(sqlite3*,const char*,const char*); -SQLITE_PRIVATE void *sqlite3Realloc(void*, u64); -SQLITE_PRIVATE void *sqlite3DbReallocOrFree(sqlite3 *, void *, u64); -SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *, void *, u64); -SQLITE_PRIVATE void sqlite3DbFree(sqlite3*, void*); -SQLITE_PRIVATE void sqlite3DbFreeNN(sqlite3*, void*); -SQLITE_PRIVATE int sqlite3MallocSize(void*); -SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3*, void*); -SQLITE_PRIVATE void *sqlite3PageMalloc(int); -SQLITE_PRIVATE void sqlite3PageFree(void*); -SQLITE_PRIVATE void sqlite3MemSetDefault(void); +SQLITE_PRIVATE int tdsqlite3MallocInit(void); +SQLITE_PRIVATE void tdsqlite3MallocEnd(void); +SQLITE_PRIVATE void *tdsqlite3Malloc(u64); +SQLITE_PRIVATE void *tdsqlite3MallocZero(u64); +SQLITE_PRIVATE void *tdsqlite3DbMallocZero(tdsqlite3*, u64); +SQLITE_PRIVATE void *tdsqlite3DbMallocRaw(tdsqlite3*, u64); +SQLITE_PRIVATE void *tdsqlite3DbMallocRawNN(tdsqlite3*, u64); +SQLITE_PRIVATE char *tdsqlite3DbStrDup(tdsqlite3*,const char*); +SQLITE_PRIVATE char *tdsqlite3DbStrNDup(tdsqlite3*,const char*, u64); +SQLITE_PRIVATE char *tdsqlite3DbSpanDup(tdsqlite3*,const char*,const char*); +SQLITE_PRIVATE void *tdsqlite3Realloc(void*, u64); +SQLITE_PRIVATE void *tdsqlite3DbReallocOrFree(tdsqlite3 *, void *, u64); +SQLITE_PRIVATE void *tdsqlite3DbRealloc(tdsqlite3 *, void *, u64); +SQLITE_PRIVATE void tdsqlite3DbFree(tdsqlite3*, void*); +SQLITE_PRIVATE void tdsqlite3DbFreeNN(tdsqlite3*, void*); +SQLITE_PRIVATE int tdsqlite3MallocSize(void*); +SQLITE_PRIVATE int tdsqlite3DbMallocSize(tdsqlite3*, void*); +SQLITE_PRIVATE void *tdsqlite3PageMalloc(int); +SQLITE_PRIVATE void tdsqlite3PageFree(void*); +SQLITE_PRIVATE void tdsqlite3MemSetDefault(void); #ifndef SQLITE_UNTESTABLE -SQLITE_PRIVATE void sqlite3BenignMallocHooks(void (*)(void), void (*)(void)); +SQLITE_PRIVATE void tdsqlite3BenignMallocHooks(void (*)(void), void (*)(void)); #endif -SQLITE_PRIVATE int sqlite3HeapNearlyFull(void); +SQLITE_PRIVATE int tdsqlite3HeapNearlyFull(void); /* ** On systems with ample stack space and that support alloca(), make @@ -19227,67 +19227,67 @@ SQLITE_PRIVATE int sqlite3HeapNearlyFull(void); ** obtain space from malloc(). ** ** The alloca() routine never returns NULL. This will cause code paths -** that deal with sqlite3StackAlloc() failures to be unreachable. +** that deal with tdsqlite3StackAlloc() failures to be unreachable. */ #ifdef SQLITE_USE_ALLOCA -# define sqlite3StackAllocRaw(D,N) alloca(N) -# define sqlite3StackAllocZero(D,N) memset(alloca(N), 0, N) -# define sqlite3StackFree(D,P) +# define tdsqlite3StackAllocRaw(D,N) alloca(N) +# define tdsqlite3StackAllocZero(D,N) memset(alloca(N), 0, N) +# define tdsqlite3StackFree(D,P) #else -# define sqlite3StackAllocRaw(D,N) sqlite3DbMallocRaw(D,N) -# define sqlite3StackAllocZero(D,N) sqlite3DbMallocZero(D,N) -# define sqlite3StackFree(D,P) sqlite3DbFree(D,P) +# define tdsqlite3StackAllocRaw(D,N) tdsqlite3DbMallocRaw(D,N) +# define tdsqlite3StackAllocZero(D,N) tdsqlite3DbMallocZero(D,N) +# define tdsqlite3StackFree(D,P) tdsqlite3DbFree(D,P) #endif /* Do not allow both MEMSYS5 and MEMSYS3 to be defined together. If they ** are, disable MEMSYS3 */ #ifdef SQLITE_ENABLE_MEMSYS5 -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys5(void); +SQLITE_PRIVATE const tdsqlite3_mem_methods *tdsqlite3MemGetMemsys5(void); #undef SQLITE_ENABLE_MEMSYS3 #endif #ifdef SQLITE_ENABLE_MEMSYS3 -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void); +SQLITE_PRIVATE const tdsqlite3_mem_methods *tdsqlite3MemGetMemsys3(void); #endif #ifndef SQLITE_MUTEX_OMIT -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void); -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void); -SQLITE_PRIVATE sqlite3_mutex *sqlite3MutexAlloc(int); -SQLITE_PRIVATE int sqlite3MutexInit(void); -SQLITE_PRIVATE int sqlite3MutexEnd(void); +SQLITE_PRIVATE tdsqlite3_mutex_methods const *tdsqlite3DefaultMutex(void); +SQLITE_PRIVATE tdsqlite3_mutex_methods const *tdsqlite3NoopMutex(void); +SQLITE_PRIVATE tdsqlite3_mutex *tdsqlite3MutexAlloc(int); +SQLITE_PRIVATE int tdsqlite3MutexInit(void); +SQLITE_PRIVATE int tdsqlite3MutexEnd(void); #endif #if !defined(SQLITE_MUTEX_OMIT) && !defined(SQLITE_MUTEX_NOOP) -SQLITE_PRIVATE void sqlite3MemoryBarrier(void); +SQLITE_PRIVATE void tdsqlite3MemoryBarrier(void); #else -# define sqlite3MemoryBarrier() +# define tdsqlite3MemoryBarrier() #endif -SQLITE_PRIVATE sqlite3_int64 sqlite3StatusValue(int); -SQLITE_PRIVATE void sqlite3StatusUp(int, int); -SQLITE_PRIVATE void sqlite3StatusDown(int, int); -SQLITE_PRIVATE void sqlite3StatusHighwater(int, int); -SQLITE_PRIVATE int sqlite3LookasideUsed(sqlite3*,int*); +SQLITE_PRIVATE tdsqlite3_int64 tdsqlite3StatusValue(int); +SQLITE_PRIVATE void tdsqlite3StatusUp(int, int); +SQLITE_PRIVATE void tdsqlite3StatusDown(int, int); +SQLITE_PRIVATE void tdsqlite3StatusHighwater(int, int); +SQLITE_PRIVATE int tdsqlite3LookasideUsed(tdsqlite3*,int*); -/* Access to mutexes used by sqlite3_status() */ -SQLITE_PRIVATE sqlite3_mutex *sqlite3Pcache1Mutex(void); -SQLITE_PRIVATE sqlite3_mutex *sqlite3MallocMutex(void); +/* Access to mutexes used by tdsqlite3_status() */ +SQLITE_PRIVATE tdsqlite3_mutex *tdsqlite3Pcache1Mutex(void); +SQLITE_PRIVATE tdsqlite3_mutex *tdsqlite3MallocMutex(void); #if defined(SQLITE_ENABLE_MULTITHREADED_CHECKS) && !defined(SQLITE_MUTEX_OMIT) -SQLITE_PRIVATE void sqlite3MutexWarnOnContention(sqlite3_mutex*); +SQLITE_PRIVATE void tdsqlite3MutexWarnOnContention(tdsqlite3_mutex*); #else -# define sqlite3MutexWarnOnContention(x) +# define tdsqlite3MutexWarnOnContention(x) #endif #ifndef SQLITE_OMIT_FLOATING_POINT # define EXP754 (((u64)0x7ff)<<52) # define MAN754 ((((u64)1)<<52)-1) # define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0) -SQLITE_PRIVATE int sqlite3IsNaN(double); +SQLITE_PRIVATE int tdsqlite3IsNaN(double); #else # define IsNaN(X) 0 -# define sqlite3IsNaN(X) 0 +# define tdsqlite3IsNaN(X) 0 #endif /* @@ -19297,418 +19297,418 @@ SQLITE_PRIVATE int sqlite3IsNaN(double); struct PrintfArguments { int nArg; /* Total number of arguments */ int nUsed; /* Number of arguments used so far */ - sqlite3_value **apArg; /* The argument values */ + tdsqlite3_value **apArg; /* The argument values */ }; -SQLITE_PRIVATE char *sqlite3MPrintf(sqlite3*,const char*, ...); -SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3*,const char*, va_list); +SQLITE_PRIVATE char *tdsqlite3MPrintf(tdsqlite3*,const char*, ...); +SQLITE_PRIVATE char *tdsqlite3VMPrintf(tdsqlite3*,const char*, va_list); #if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE) -SQLITE_PRIVATE void sqlite3DebugPrintf(const char*, ...); +SQLITE_PRIVATE void tdsqlite3DebugPrintf(const char*, ...); #endif #if defined(SQLITE_TEST) -SQLITE_PRIVATE void *sqlite3TestTextToPtr(const char*); +SQLITE_PRIVATE void *tdsqlite3TestTextToPtr(const char*); #endif #if defined(SQLITE_DEBUG) -SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView*, const Expr*, u8); -SQLITE_PRIVATE void sqlite3TreeViewBareExprList(TreeView*, const ExprList*, const char*); -SQLITE_PRIVATE void sqlite3TreeViewExprList(TreeView*, const ExprList*, u8, const char*); -SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView*, const SrcList*); -SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView*, const Select*, u8); -SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView*, const With*, u8); +SQLITE_PRIVATE void tdsqlite3TreeViewExpr(TreeView*, const Expr*, u8); +SQLITE_PRIVATE void tdsqlite3TreeViewBareExprList(TreeView*, const ExprList*, const char*); +SQLITE_PRIVATE void tdsqlite3TreeViewExprList(TreeView*, const ExprList*, u8, const char*); +SQLITE_PRIVATE void tdsqlite3TreeViewSrcList(TreeView*, const SrcList*); +SQLITE_PRIVATE void tdsqlite3TreeViewSelect(TreeView*, const Select*, u8); +SQLITE_PRIVATE void tdsqlite3TreeViewWith(TreeView*, const With*, u8); #ifndef SQLITE_OMIT_WINDOWFUNC -SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView*, const Window*, u8); -SQLITE_PRIVATE void sqlite3TreeViewWinFunc(TreeView*, const Window*, u8); +SQLITE_PRIVATE void tdsqlite3TreeViewWindow(TreeView*, const Window*, u8); +SQLITE_PRIVATE void tdsqlite3TreeViewWinFunc(TreeView*, const Window*, u8); #endif #endif -SQLITE_PRIVATE void sqlite3SetString(char **, sqlite3*, const char*); -SQLITE_PRIVATE void sqlite3ErrorMsg(Parse*, const char*, ...); -SQLITE_PRIVATE int sqlite3ErrorToParser(sqlite3*,int); -SQLITE_PRIVATE void sqlite3Dequote(char*); -SQLITE_PRIVATE void sqlite3DequoteExpr(Expr*); -SQLITE_PRIVATE void sqlite3TokenInit(Token*,char*); -SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int); -SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*, char **); -SQLITE_PRIVATE void sqlite3FinishCoding(Parse*); -SQLITE_PRIVATE int sqlite3GetTempReg(Parse*); -SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int); -SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int); -SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int); -SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse*); +SQLITE_PRIVATE void tdsqlite3SetString(char **, tdsqlite3*, const char*); +SQLITE_PRIVATE void tdsqlite3ErrorMsg(Parse*, const char*, ...); +SQLITE_PRIVATE int tdsqlite3ErrorToParser(tdsqlite3*,int); +SQLITE_PRIVATE void tdsqlite3Dequote(char*); +SQLITE_PRIVATE void tdsqlite3DequoteExpr(Expr*); +SQLITE_PRIVATE void tdsqlite3TokenInit(Token*,char*); +SQLITE_PRIVATE int tdsqlite3KeywordCode(const unsigned char*, int); +SQLITE_PRIVATE int tdsqlite3RunParser(Parse*, const char*, char **); +SQLITE_PRIVATE void tdsqlite3FinishCoding(Parse*); +SQLITE_PRIVATE int tdsqlite3GetTempReg(Parse*); +SQLITE_PRIVATE void tdsqlite3ReleaseTempReg(Parse*,int); +SQLITE_PRIVATE int tdsqlite3GetTempRange(Parse*,int); +SQLITE_PRIVATE void tdsqlite3ReleaseTempRange(Parse*,int,int); +SQLITE_PRIVATE void tdsqlite3ClearTempRegCache(Parse*); #ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int); +SQLITE_PRIVATE int tdsqlite3NoTempsInRange(Parse*,int,int); #endif -SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int); -SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*); -SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*); -SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*); -SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*); -SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*); -SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr*); -SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int); -SQLITE_PRIVATE void sqlite3ExprFunctionUsable(Parse*,Expr*,FuncDef*); -SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32); -SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*); -SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse*, Expr*); -SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*); -SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*); -SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int,int); -SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int); -SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*); -SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*); -SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList*); -SQLITE_PRIVATE int sqlite3IndexHasDuplicateRootPage(Index*); -SQLITE_PRIVATE int sqlite3Init(sqlite3*, char**); -SQLITE_PRIVATE int sqlite3InitCallback(void*, int, char**, char**); -SQLITE_PRIVATE int sqlite3InitOne(sqlite3*, int, char**, u32); -SQLITE_PRIVATE void sqlite3Pragma(Parse*,Token*,Token*,Token*,int); +SQLITE_PRIVATE Expr *tdsqlite3ExprAlloc(tdsqlite3*,int,const Token*,int); +SQLITE_PRIVATE Expr *tdsqlite3Expr(tdsqlite3*,int,const char*); +SQLITE_PRIVATE void tdsqlite3ExprAttachSubtrees(tdsqlite3*,Expr*,Expr*,Expr*); +SQLITE_PRIVATE Expr *tdsqlite3PExpr(Parse*, int, Expr*, Expr*); +SQLITE_PRIVATE void tdsqlite3PExprAddSelect(Parse*, Expr*, Select*); +SQLITE_PRIVATE Expr *tdsqlite3ExprAnd(Parse*,Expr*, Expr*); +SQLITE_PRIVATE Expr *tdsqlite3ExprSimplifiedAndOr(Expr*); +SQLITE_PRIVATE Expr *tdsqlite3ExprFunction(Parse*,ExprList*, Token*, int); +SQLITE_PRIVATE void tdsqlite3ExprFunctionUsable(Parse*,Expr*,FuncDef*); +SQLITE_PRIVATE void tdsqlite3ExprAssignVarNumber(Parse*, Expr*, u32); +SQLITE_PRIVATE void tdsqlite3ExprDelete(tdsqlite3*, Expr*); +SQLITE_PRIVATE void tdsqlite3ExprUnmapAndDelete(Parse*, Expr*); +SQLITE_PRIVATE ExprList *tdsqlite3ExprListAppend(Parse*,ExprList*,Expr*); +SQLITE_PRIVATE ExprList *tdsqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*); +SQLITE_PRIVATE void tdsqlite3ExprListSetSortOrder(ExprList*,int,int); +SQLITE_PRIVATE void tdsqlite3ExprListSetName(Parse*,ExprList*,Token*,int); +SQLITE_PRIVATE void tdsqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*); +SQLITE_PRIVATE void tdsqlite3ExprListDelete(tdsqlite3*, ExprList*); +SQLITE_PRIVATE u32 tdsqlite3ExprListFlags(const ExprList*); +SQLITE_PRIVATE int tdsqlite3IndexHasDuplicateRootPage(Index*); +SQLITE_PRIVATE int tdsqlite3Init(tdsqlite3*, char**); +SQLITE_PRIVATE int tdsqlite3InitCallback(void*, int, char**, char**); +SQLITE_PRIVATE int tdsqlite3InitOne(tdsqlite3*, int, char**, u32); +SQLITE_PRIVATE void tdsqlite3Pragma(Parse*,Token*,Token*,Token*,int); #ifndef SQLITE_OMIT_VIRTUALTABLE -SQLITE_PRIVATE Module *sqlite3PragmaVtabRegister(sqlite3*,const char *zName); +SQLITE_PRIVATE Module *tdsqlite3PragmaVtabRegister(tdsqlite3*,const char *zName); #endif -SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3*); -SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3*,int); -SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3*); -SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3*); -SQLITE_PRIVATE void sqlite3DeleteColumnNames(sqlite3*,Table*); -SQLITE_PRIVATE int sqlite3ColumnsFromExprList(Parse*,ExprList*,i16*,Column**); -SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation(Parse*,Table*,Select*,char); -SQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse*,Select*,char); -SQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *, int); -SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table*); -SQLITE_PRIVATE i16 sqlite3TableColumnToIndex(Index*, i16); +SQLITE_PRIVATE void tdsqlite3ResetAllSchemasOfConnection(tdsqlite3*); +SQLITE_PRIVATE void tdsqlite3ResetOneSchema(tdsqlite3*,int); +SQLITE_PRIVATE void tdsqlite3CollapseDatabaseArray(tdsqlite3*); +SQLITE_PRIVATE void tdsqlite3CommitInternalChanges(tdsqlite3*); +SQLITE_PRIVATE void tdsqlite3DeleteColumnNames(tdsqlite3*,Table*); +SQLITE_PRIVATE int tdsqlite3ColumnsFromExprList(Parse*,ExprList*,i16*,Column**); +SQLITE_PRIVATE void tdsqlite3SelectAddColumnTypeAndCollation(Parse*,Table*,Select*,char); +SQLITE_PRIVATE Table *tdsqlite3ResultSetOfSelect(Parse*,Select*,char); +SQLITE_PRIVATE void tdsqlite3OpenMasterTable(Parse *, int); +SQLITE_PRIVATE Index *tdsqlite3PrimaryKeyIndex(Table*); +SQLITE_PRIVATE i16 tdsqlite3TableColumnToIndex(Index*, i16); #ifdef SQLITE_OMIT_GENERATED_COLUMNS -# define sqlite3TableColumnToStorage(T,X) (X) /* No-op pass-through */ -# define sqlite3StorageColumnToTable(T,X) (X) /* No-op pass-through */ +# define tdsqlite3TableColumnToStorage(T,X) (X) /* No-op pass-through */ +# define tdsqlite3StorageColumnToTable(T,X) (X) /* No-op pass-through */ #else -SQLITE_PRIVATE i16 sqlite3TableColumnToStorage(Table*, i16); -SQLITE_PRIVATE i16 sqlite3StorageColumnToTable(Table*, i16); +SQLITE_PRIVATE i16 tdsqlite3TableColumnToStorage(Table*, i16); +SQLITE_PRIVATE i16 tdsqlite3StorageColumnToTable(Table*, i16); #endif -SQLITE_PRIVATE void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int); +SQLITE_PRIVATE void tdsqlite3StartTable(Parse*,Token*,Token*,int,int,int,int); #if SQLITE_ENABLE_HIDDEN_COLUMNS -SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table*, Column*); +SQLITE_PRIVATE void tdsqlite3ColumnPropertiesFromName(Table*, Column*); #else -# define sqlite3ColumnPropertiesFromName(T,C) /* no-op */ +# define tdsqlite3ColumnPropertiesFromName(T,C) /* no-op */ #endif -SQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token*,Token*); -SQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int); -SQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int); -SQLITE_PRIVATE void sqlite3AddCheckConstraint(Parse*, Expr*); -SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse*,Expr*,const char*,const char*); -SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*); -SQLITE_PRIVATE void sqlite3AddGenerated(Parse*,Expr*,Token*); -SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*); -SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*, - sqlite3_vfs**,char**,char **); +SQLITE_PRIVATE void tdsqlite3AddColumn(Parse*,Token*,Token*); +SQLITE_PRIVATE void tdsqlite3AddNotNull(Parse*, int); +SQLITE_PRIVATE void tdsqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int); +SQLITE_PRIVATE void tdsqlite3AddCheckConstraint(Parse*, Expr*); +SQLITE_PRIVATE void tdsqlite3AddDefaultValue(Parse*,Expr*,const char*,const char*); +SQLITE_PRIVATE void tdsqlite3AddCollateType(Parse*, Token*); +SQLITE_PRIVATE void tdsqlite3AddGenerated(Parse*,Expr*,Token*); +SQLITE_PRIVATE void tdsqlite3EndTable(Parse*,Token*,Token*,u8,Select*); +SQLITE_PRIVATE int tdsqlite3ParseUri(const char*,const char*,unsigned int*, + tdsqlite3_vfs**,char**,char **); #ifdef SQLITE_HAS_CODEC -SQLITE_PRIVATE int sqlite3CodecQueryParameters(sqlite3*,const char*,const char*); +SQLITE_PRIVATE int tdsqlite3CodecQueryParameters(tdsqlite3*,const char*,const char*); #else -# define sqlite3CodecQueryParameters(A,B,C) 0 +# define tdsqlite3CodecQueryParameters(A,B,C) 0 #endif -SQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3*,const char*); +SQLITE_PRIVATE Btree *tdsqlite3DbNameToBtree(tdsqlite3*,const char*); #ifdef SQLITE_UNTESTABLE -# define sqlite3FaultSim(X) SQLITE_OK +# define tdsqlite3FaultSim(X) SQLITE_OK #else -SQLITE_PRIVATE int sqlite3FaultSim(int); +SQLITE_PRIVATE int tdsqlite3FaultSim(int); #endif -SQLITE_PRIVATE Bitvec *sqlite3BitvecCreate(u32); -SQLITE_PRIVATE int sqlite3BitvecTest(Bitvec*, u32); -SQLITE_PRIVATE int sqlite3BitvecTestNotNull(Bitvec*, u32); -SQLITE_PRIVATE int sqlite3BitvecSet(Bitvec*, u32); -SQLITE_PRIVATE void sqlite3BitvecClear(Bitvec*, u32, void*); -SQLITE_PRIVATE void sqlite3BitvecDestroy(Bitvec*); -SQLITE_PRIVATE u32 sqlite3BitvecSize(Bitvec*); +SQLITE_PRIVATE Bitvec *tdsqlite3BitvecCreate(u32); +SQLITE_PRIVATE int tdsqlite3BitvecTest(Bitvec*, u32); +SQLITE_PRIVATE int tdsqlite3BitvecTestNotNull(Bitvec*, u32); +SQLITE_PRIVATE int tdsqlite3BitvecSet(Bitvec*, u32); +SQLITE_PRIVATE void tdsqlite3BitvecClear(Bitvec*, u32, void*); +SQLITE_PRIVATE void tdsqlite3BitvecDestroy(Bitvec*); +SQLITE_PRIVATE u32 tdsqlite3BitvecSize(Bitvec*); #ifndef SQLITE_UNTESTABLE -SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int,int*); +SQLITE_PRIVATE int tdsqlite3BitvecBuiltinTest(int,int*); #endif -SQLITE_PRIVATE RowSet *sqlite3RowSetInit(sqlite3*); -SQLITE_PRIVATE void sqlite3RowSetDelete(void*); -SQLITE_PRIVATE void sqlite3RowSetClear(void*); -SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet*, i64); -SQLITE_PRIVATE int sqlite3RowSetTest(RowSet*, int iBatch, i64); -SQLITE_PRIVATE int sqlite3RowSetNext(RowSet*, i64*); +SQLITE_PRIVATE RowSet *tdsqlite3RowSetInit(tdsqlite3*); +SQLITE_PRIVATE void tdsqlite3RowSetDelete(void*); +SQLITE_PRIVATE void tdsqlite3RowSetClear(void*); +SQLITE_PRIVATE void tdsqlite3RowSetInsert(RowSet*, i64); +SQLITE_PRIVATE int tdsqlite3RowSetTest(RowSet*, int iBatch, i64); +SQLITE_PRIVATE int tdsqlite3RowSetNext(RowSet*, i64*); -SQLITE_PRIVATE void sqlite3CreateView(Parse*,Token*,Token*,Token*,ExprList*,Select*,int,int); +SQLITE_PRIVATE void tdsqlite3CreateView(Parse*,Token*,Token*,Token*,ExprList*,Select*,int,int); #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) -SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse*,Table*); +SQLITE_PRIVATE int tdsqlite3ViewGetColumnNames(Parse*,Table*); #else -# define sqlite3ViewGetColumnNames(A,B) 0 +# define tdsqlite3ViewGetColumnNames(A,B) 0 #endif #if SQLITE_MAX_ATTACHED>30 -SQLITE_PRIVATE int sqlite3DbMaskAllZero(yDbMask); +SQLITE_PRIVATE int tdsqlite3DbMaskAllZero(yDbMask); #endif -SQLITE_PRIVATE void sqlite3DropTable(Parse*, SrcList*, int, int); -SQLITE_PRIVATE void sqlite3CodeDropTable(Parse*, Table*, int, int); -SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3*, Table*); -SQLITE_PRIVATE void sqlite3FreeIndex(sqlite3*, Index*); +SQLITE_PRIVATE void tdsqlite3DropTable(Parse*, SrcList*, int, int); +SQLITE_PRIVATE void tdsqlite3CodeDropTable(Parse*, Table*, int, int); +SQLITE_PRIVATE void tdsqlite3DeleteTable(tdsqlite3*, Table*); +SQLITE_PRIVATE void tdsqlite3FreeIndex(tdsqlite3*, Index*); #ifndef SQLITE_OMIT_AUTOINCREMENT -SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse); -SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse); +SQLITE_PRIVATE void tdsqlite3AutoincrementBegin(Parse *pParse); +SQLITE_PRIVATE void tdsqlite3AutoincrementEnd(Parse *pParse); #else -# define sqlite3AutoincrementBegin(X) -# define sqlite3AutoincrementEnd(X) +# define tdsqlite3AutoincrementBegin(X) +# define tdsqlite3AutoincrementEnd(X) #endif -SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, Upsert*); +SQLITE_PRIVATE void tdsqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, Upsert*); #ifndef SQLITE_OMIT_GENERATED_COLUMNS -SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns(Parse*, int, Table*); +SQLITE_PRIVATE void tdsqlite3ComputeGeneratedColumns(Parse*, int, Table*); #endif -SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*); -SQLITE_PRIVATE IdList *sqlite3IdListAppend(Parse*, IdList*, Token*); -SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*); -SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(Parse*, SrcList*, int, int); -SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(Parse*, SrcList*, Token*, Token*); -SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*, +SQLITE_PRIVATE void *tdsqlite3ArrayAllocate(tdsqlite3*,void*,int,int*,int*); +SQLITE_PRIVATE IdList *tdsqlite3IdListAppend(Parse*, IdList*, Token*); +SQLITE_PRIVATE int tdsqlite3IdListIndex(IdList*,const char*); +SQLITE_PRIVATE SrcList *tdsqlite3SrcListEnlarge(Parse*, SrcList*, int, int); +SQLITE_PRIVATE SrcList *tdsqlite3SrcListAppend(Parse*, SrcList*, Token*, Token*); +SQLITE_PRIVATE SrcList *tdsqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*, Token*, Select*, Expr*, IdList*); -SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *); -SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse*, SrcList*, ExprList*); -SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, struct SrcList_item *); -SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList*); -SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse*, SrcList*); -SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3*, IdList*); -SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3*, SrcList*); -SQLITE_PRIVATE Index *sqlite3AllocateIndexObject(sqlite3*,i16,int,char**); -SQLITE_PRIVATE void sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, +SQLITE_PRIVATE void tdsqlite3SrcListIndexedBy(Parse *, SrcList *, Token *); +SQLITE_PRIVATE void tdsqlite3SrcListFuncArgs(Parse*, SrcList*, ExprList*); +SQLITE_PRIVATE int tdsqlite3IndexedByLookup(Parse *, struct SrcList_item *); +SQLITE_PRIVATE void tdsqlite3SrcListShiftJoinType(SrcList*); +SQLITE_PRIVATE void tdsqlite3SrcListAssignCursors(Parse*, SrcList*); +SQLITE_PRIVATE void tdsqlite3IdListDelete(tdsqlite3*, IdList*); +SQLITE_PRIVATE void tdsqlite3SrcListDelete(tdsqlite3*, SrcList*); +SQLITE_PRIVATE Index *tdsqlite3AllocateIndexObject(tdsqlite3*,i16,int,char**); +SQLITE_PRIVATE void tdsqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, Expr*, int, int, u8); -SQLITE_PRIVATE void sqlite3DropIndex(Parse*, SrcList*, int); -SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*); -SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*, +SQLITE_PRIVATE void tdsqlite3DropIndex(Parse*, SrcList*, int); +SQLITE_PRIVATE int tdsqlite3Select(Parse*, Select*, SelectDest*); +SQLITE_PRIVATE Select *tdsqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*, Expr*,ExprList*,u32,Expr*); -SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*); -SQLITE_PRIVATE void sqlite3SelectReset(Parse*, Select*); -SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*); -SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int); -SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); +SQLITE_PRIVATE void tdsqlite3SelectDelete(tdsqlite3*, Select*); +SQLITE_PRIVATE void tdsqlite3SelectReset(Parse*, Select*); +SQLITE_PRIVATE Table *tdsqlite3SrcListLookup(Parse*, SrcList*); +SQLITE_PRIVATE int tdsqlite3IsReadOnly(Parse*, Table*, int); +SQLITE_PRIVATE void tdsqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) -SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*); +SQLITE_PRIVATE Expr *tdsqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*); #endif -SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*); -SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*, +SQLITE_PRIVATE void tdsqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*); +SQLITE_PRIVATE void tdsqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*, Upsert*); -SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int); -SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*); -SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereOrderByLimitOptLabel(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereIsSorted(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo*, int*); +SQLITE_PRIVATE WhereInfo *tdsqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int); +SQLITE_PRIVATE void tdsqlite3WhereEnd(WhereInfo*); +SQLITE_PRIVATE LogEst tdsqlite3WhereOutputRowCount(WhereInfo*); +SQLITE_PRIVATE int tdsqlite3WhereIsDistinct(WhereInfo*); +SQLITE_PRIVATE int tdsqlite3WhereIsOrdered(WhereInfo*); +SQLITE_PRIVATE int tdsqlite3WhereOrderByLimitOptLabel(WhereInfo*); +SQLITE_PRIVATE int tdsqlite3WhereIsSorted(WhereInfo*); +SQLITE_PRIVATE int tdsqlite3WhereContinueLabel(WhereInfo*); +SQLITE_PRIVATE int tdsqlite3WhereBreakLabel(WhereInfo*); +SQLITE_PRIVATE int tdsqlite3WhereOkOnePass(WhereInfo*, int*); #define ONEPASS_OFF 0 /* Use of ONEPASS not allowed */ #define ONEPASS_SINGLE 1 /* ONEPASS valid for a single row update */ #define ONEPASS_MULTI 2 /* ONEPASS is valid for multiple rows */ -SQLITE_PRIVATE int sqlite3WhereUsesDeferredSeek(WhereInfo*); -SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(Parse*, Index*, int, int, int); -SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, u8); -SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int); -SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int); -SQLITE_PRIVATE void sqlite3ExprCode(Parse*, Expr*, int); +SQLITE_PRIVATE int tdsqlite3WhereUsesDeferredSeek(WhereInfo*); +SQLITE_PRIVATE void tdsqlite3ExprCodeLoadIndexColumn(Parse*, Index*, int, int, int); +SQLITE_PRIVATE int tdsqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, u8); +SQLITE_PRIVATE void tdsqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int); +SQLITE_PRIVATE void tdsqlite3ExprCodeMove(Parse*, int, int, int); +SQLITE_PRIVATE void tdsqlite3ExprCode(Parse*, Expr*, int); #ifndef SQLITE_OMIT_GENERATED_COLUMNS -SQLITE_PRIVATE void sqlite3ExprCodeGeneratedColumn(Parse*, Column*, int); +SQLITE_PRIVATE void tdsqlite3ExprCodeGeneratedColumn(Parse*, Column*, int); #endif -SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, Expr*, int); -SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int); -SQLITE_PRIVATE int sqlite3ExprCodeAtInit(Parse*, Expr*, int); -SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*); -SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int); -SQLITE_PRIVATE int sqlite3ExprCodeExprList(Parse*, ExprList*, int, int, u8); +SQLITE_PRIVATE void tdsqlite3ExprCodeCopy(Parse*, Expr*, int); +SQLITE_PRIVATE void tdsqlite3ExprCodeFactorable(Parse*, Expr*, int); +SQLITE_PRIVATE int tdsqlite3ExprCodeAtInit(Parse*, Expr*, int); +SQLITE_PRIVATE int tdsqlite3ExprCodeTemp(Parse*, Expr*, int*); +SQLITE_PRIVATE int tdsqlite3ExprCodeTarget(Parse*, Expr*, int); +SQLITE_PRIVATE int tdsqlite3ExprCodeExprList(Parse*, ExprList*, int, int, u8); #define SQLITE_ECEL_DUP 0x01 /* Deep, not shallow copies */ #define SQLITE_ECEL_FACTOR 0x02 /* Factor out constant terms */ #define SQLITE_ECEL_REF 0x04 /* Use ExprList.u.x.iOrderByCol */ #define SQLITE_ECEL_OMITREF 0x08 /* Omit if ExprList.u.x.iOrderByCol */ -SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse*, Expr*, int, int); -SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse*, Expr*, int, int); -SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse*, Expr*, int, int); -SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3*,const char*, const char*); +SQLITE_PRIVATE void tdsqlite3ExprIfTrue(Parse*, Expr*, int, int); +SQLITE_PRIVATE void tdsqlite3ExprIfFalse(Parse*, Expr*, int, int); +SQLITE_PRIVATE void tdsqlite3ExprIfFalseDup(Parse*, Expr*, int, int); +SQLITE_PRIVATE Table *tdsqlite3FindTable(tdsqlite3*,const char*, const char*); #define LOCATE_VIEW 0x01 #define LOCATE_NOERR 0x02 -SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,u32 flags,const char*, const char*); -SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,u32 flags,struct SrcList_item *); -SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3*,const char*, const char*); -SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*); -SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*); -SQLITE_PRIVATE void sqlite3Vacuum(Parse*,Token*,Expr*); -SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*, int, sqlite3_value*); -SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*); -SQLITE_PRIVATE int sqlite3ExprCompare(Parse*,Expr*, Expr*, int); -SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr*, Expr*, int); -SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int); -SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Parse*,Expr*, Expr*, int); -SQLITE_PRIVATE int sqlite3ExprImpliesNonNullRow(Expr*,int); -SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*); -SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*); -SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx); -SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr*, SrcList*); -SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*); +SQLITE_PRIVATE Table *tdsqlite3LocateTable(Parse*,u32 flags,const char*, const char*); +SQLITE_PRIVATE Table *tdsqlite3LocateTableItem(Parse*,u32 flags,struct SrcList_item *); +SQLITE_PRIVATE Index *tdsqlite3FindIndex(tdsqlite3*,const char*, const char*); +SQLITE_PRIVATE void tdsqlite3UnlinkAndDeleteTable(tdsqlite3*,int,const char*); +SQLITE_PRIVATE void tdsqlite3UnlinkAndDeleteIndex(tdsqlite3*,int,const char*); +SQLITE_PRIVATE void tdsqlite3Vacuum(Parse*,Token*,Expr*); +SQLITE_PRIVATE int tdsqlite3RunVacuum(char**, tdsqlite3*, int, tdsqlite3_value*); +SQLITE_PRIVATE char *tdsqlite3NameFromToken(tdsqlite3*, Token*); +SQLITE_PRIVATE int tdsqlite3ExprCompare(Parse*,Expr*, Expr*, int); +SQLITE_PRIVATE int tdsqlite3ExprCompareSkip(Expr*, Expr*, int); +SQLITE_PRIVATE int tdsqlite3ExprListCompare(ExprList*, ExprList*, int); +SQLITE_PRIVATE int tdsqlite3ExprImpliesExpr(Parse*,Expr*, Expr*, int); +SQLITE_PRIVATE int tdsqlite3ExprImpliesNonNullRow(Expr*,int); +SQLITE_PRIVATE void tdsqlite3ExprAnalyzeAggregates(NameContext*, Expr*); +SQLITE_PRIVATE void tdsqlite3ExprAnalyzeAggList(NameContext*,ExprList*); +SQLITE_PRIVATE int tdsqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx); +SQLITE_PRIVATE int tdsqlite3FunctionUsesThisSrc(Expr*, SrcList*); +SQLITE_PRIVATE Vdbe *tdsqlite3GetVdbe(Parse*); #ifndef SQLITE_UNTESTABLE -SQLITE_PRIVATE void sqlite3PrngSaveState(void); -SQLITE_PRIVATE void sqlite3PrngRestoreState(void); +SQLITE_PRIVATE void tdsqlite3PrngSaveState(void); +SQLITE_PRIVATE void tdsqlite3PrngRestoreState(void); #endif -SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3*,int); -SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse*, int); -SQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse*, const char *zDb); -SQLITE_PRIVATE void sqlite3BeginTransaction(Parse*, int); -SQLITE_PRIVATE void sqlite3EndTransaction(Parse*,int); -SQLITE_PRIVATE void sqlite3Savepoint(Parse*, int, Token*); -SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *); -SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*); -SQLITE_PRIVATE u32 sqlite3IsTrueOrFalse(const char*); -SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr*); -SQLITE_PRIVATE int sqlite3ExprTruthValue(const Expr*); -SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*); -SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*); -SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8); -SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*); -SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int); +SQLITE_PRIVATE void tdsqlite3RollbackAll(tdsqlite3*,int); +SQLITE_PRIVATE void tdsqlite3CodeVerifySchema(Parse*, int); +SQLITE_PRIVATE void tdsqlite3CodeVerifyNamedSchema(Parse*, const char *zDb); +SQLITE_PRIVATE void tdsqlite3BeginTransaction(Parse*, int); +SQLITE_PRIVATE void tdsqlite3EndTransaction(Parse*,int); +SQLITE_PRIVATE void tdsqlite3Savepoint(Parse*, int, Token*); +SQLITE_PRIVATE void tdsqlite3CloseSavepoints(tdsqlite3 *); +SQLITE_PRIVATE void tdsqlite3LeaveMutexAndCloseZombie(tdsqlite3*); +SQLITE_PRIVATE u32 tdsqlite3IsTrueOrFalse(const char*); +SQLITE_PRIVATE int tdsqlite3ExprIdToTrueFalse(Expr*); +SQLITE_PRIVATE int tdsqlite3ExprTruthValue(const Expr*); +SQLITE_PRIVATE int tdsqlite3ExprIsConstant(Expr*); +SQLITE_PRIVATE int tdsqlite3ExprIsConstantNotJoin(Expr*); +SQLITE_PRIVATE int tdsqlite3ExprIsConstantOrFunction(Expr*, u8); +SQLITE_PRIVATE int tdsqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*); +SQLITE_PRIVATE int tdsqlite3ExprIsTableConstant(Expr*,int); #ifdef SQLITE_ENABLE_CURSOR_HINTS -SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*); +SQLITE_PRIVATE int tdsqlite3ExprContainsSubquery(Expr*); #endif -SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr*, int*); -SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*); -SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr*, char); -SQLITE_PRIVATE int sqlite3IsRowid(const char*); -SQLITE_PRIVATE void sqlite3GenerateRowDelete( +SQLITE_PRIVATE int tdsqlite3ExprIsInteger(Expr*, int*); +SQLITE_PRIVATE int tdsqlite3ExprCanBeNull(const Expr*); +SQLITE_PRIVATE int tdsqlite3ExprNeedsNoAffinityChange(const Expr*, char); +SQLITE_PRIVATE int tdsqlite3IsRowid(const char*); +SQLITE_PRIVATE void tdsqlite3GenerateRowDelete( Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8,int); -SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*, int); -SQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int, int*,Index*,int); -SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse*,int); -SQLITE_PRIVATE int sqlite3ExprReferencesUpdatedColumn(Expr*,int*,int); -SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(Parse*,Table*,int*,int,int,int,int, +SQLITE_PRIVATE void tdsqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*, int); +SQLITE_PRIVATE int tdsqlite3GenerateIndexKey(Parse*, Index*, int, int, int, int*,Index*,int); +SQLITE_PRIVATE void tdsqlite3ResolvePartIdxLabel(Parse*,int); +SQLITE_PRIVATE int tdsqlite3ExprReferencesUpdatedColumn(Expr*,int*,int); +SQLITE_PRIVATE void tdsqlite3GenerateConstraintChecks(Parse*,Table*,int*,int,int,int,int, u8,u8,int,int*,int*,Upsert*); #ifdef SQLITE_ENABLE_NULL_TRIM -SQLITE_PRIVATE void sqlite3SetMakeRecordP5(Vdbe*,Table*); +SQLITE_PRIVATE void tdsqlite3SetMakeRecordP5(Vdbe*,Table*); #else -# define sqlite3SetMakeRecordP5(A,B) +# define tdsqlite3SetMakeRecordP5(A,B) #endif -SQLITE_PRIVATE void sqlite3CompleteInsertion(Parse*,Table*,int,int,int,int*,int,int,int); -SQLITE_PRIVATE int sqlite3OpenTableAndIndices(Parse*, Table*, int, u8, int, u8*, int*, int*); -SQLITE_PRIVATE void sqlite3BeginWriteOperation(Parse*, int, int); -SQLITE_PRIVATE void sqlite3MultiWrite(Parse*); -SQLITE_PRIVATE void sqlite3MayAbort(Parse*); -SQLITE_PRIVATE void sqlite3HaltConstraint(Parse*, int, int, char*, i8, u8); -SQLITE_PRIVATE void sqlite3UniqueConstraint(Parse*, int, Index*); -SQLITE_PRIVATE void sqlite3RowidConstraint(Parse*, int, Table*); -SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3*,Expr*,int); -SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3*,ExprList*,int); -SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3*,SrcList*,int); -SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3*,IdList*); -SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3*,Select*,int); -SQLITE_PRIVATE FuncDef *sqlite3FunctionSearch(int,const char*); -SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs(FuncDef*,int); -SQLITE_PRIVATE FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,u8,u8); -SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void); -SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void); -SQLITE_PRIVATE void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3*); -SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3*); -SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3*); -SQLITE_PRIVATE void sqlite3ChangeCookie(Parse*, int); +SQLITE_PRIVATE void tdsqlite3CompleteInsertion(Parse*,Table*,int,int,int,int*,int,int,int); +SQLITE_PRIVATE int tdsqlite3OpenTableAndIndices(Parse*, Table*, int, u8, int, u8*, int*, int*); +SQLITE_PRIVATE void tdsqlite3BeginWriteOperation(Parse*, int, int); +SQLITE_PRIVATE void tdsqlite3MultiWrite(Parse*); +SQLITE_PRIVATE void tdsqlite3MayAbort(Parse*); +SQLITE_PRIVATE void tdsqlite3HaltConstraint(Parse*, int, int, char*, i8, u8); +SQLITE_PRIVATE void tdsqlite3UniqueConstraint(Parse*, int, Index*); +SQLITE_PRIVATE void tdsqlite3RowidConstraint(Parse*, int, Table*); +SQLITE_PRIVATE Expr *tdsqlite3ExprDup(tdsqlite3*,Expr*,int); +SQLITE_PRIVATE ExprList *tdsqlite3ExprListDup(tdsqlite3*,ExprList*,int); +SQLITE_PRIVATE SrcList *tdsqlite3SrcListDup(tdsqlite3*,SrcList*,int); +SQLITE_PRIVATE IdList *tdsqlite3IdListDup(tdsqlite3*,IdList*); +SQLITE_PRIVATE Select *tdsqlite3SelectDup(tdsqlite3*,Select*,int); +SQLITE_PRIVATE FuncDef *tdsqlite3FunctionSearch(int,const char*); +SQLITE_PRIVATE void tdsqlite3InsertBuiltinFuncs(FuncDef*,int); +SQLITE_PRIVATE FuncDef *tdsqlite3FindFunction(tdsqlite3*,const char*,int,u8,u8); +SQLITE_PRIVATE void tdsqlite3RegisterBuiltinFunctions(void); +SQLITE_PRIVATE void tdsqlite3RegisterDateTimeFunctions(void); +SQLITE_PRIVATE void tdsqlite3RegisterPerConnectionBuiltinFunctions(tdsqlite3*); +SQLITE_PRIVATE int tdsqlite3SafetyCheckOk(tdsqlite3*); +SQLITE_PRIVATE int tdsqlite3SafetyCheckSickOrOk(tdsqlite3*); +SQLITE_PRIVATE void tdsqlite3ChangeCookie(Parse*, int); #if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) -SQLITE_PRIVATE void sqlite3MaterializeView(Parse*, Table*, Expr*, ExprList*,Expr*,int); +SQLITE_PRIVATE void tdsqlite3MaterializeView(Parse*, Table*, Expr*, ExprList*,Expr*,int); #endif #ifndef SQLITE_OMIT_TRIGGER -SQLITE_PRIVATE void sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*, +SQLITE_PRIVATE void tdsqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*, Expr*,int, int); -SQLITE_PRIVATE void sqlite3FinishTrigger(Parse*, TriggerStep*, Token*); -SQLITE_PRIVATE void sqlite3DropTrigger(Parse*, SrcList*, int); -SQLITE_PRIVATE void sqlite3DropTriggerPtr(Parse*, Trigger*); -SQLITE_PRIVATE Trigger *sqlite3TriggersExist(Parse *, Table*, int, ExprList*, int *pMask); -SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *, Table *); -SQLITE_PRIVATE void sqlite3CodeRowTrigger(Parse*, Trigger *, int, ExprList*, int, Table *, +SQLITE_PRIVATE void tdsqlite3FinishTrigger(Parse*, TriggerStep*, Token*); +SQLITE_PRIVATE void tdsqlite3DropTrigger(Parse*, SrcList*, int); +SQLITE_PRIVATE void tdsqlite3DropTriggerPtr(Parse*, Trigger*); +SQLITE_PRIVATE Trigger *tdsqlite3TriggersExist(Parse *, Table*, int, ExprList*, int *pMask); +SQLITE_PRIVATE Trigger *tdsqlite3TriggerList(Parse *, Table *); +SQLITE_PRIVATE void tdsqlite3CodeRowTrigger(Parse*, Trigger *, int, ExprList*, int, Table *, int, int, int); -SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int); +SQLITE_PRIVATE void tdsqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int); void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*); -SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*); -SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*, +SQLITE_PRIVATE void tdsqlite3DeleteTriggerStep(tdsqlite3*, TriggerStep*); +SQLITE_PRIVATE TriggerStep *tdsqlite3TriggerSelectStep(tdsqlite3*,Select*, const char*,const char*); -SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(Parse*,Token*, IdList*, +SQLITE_PRIVATE TriggerStep *tdsqlite3TriggerInsertStep(Parse*,Token*, IdList*, Select*,u8,Upsert*, const char*,const char*); -SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(Parse*,Token*,ExprList*, Expr*, u8, +SQLITE_PRIVATE TriggerStep *tdsqlite3TriggerUpdateStep(Parse*,Token*,ExprList*, Expr*, u8, const char*,const char*); -SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(Parse*,Token*, Expr*, +SQLITE_PRIVATE TriggerStep *tdsqlite3TriggerDeleteStep(Parse*,Token*, Expr*, const char*,const char*); -SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3*, Trigger*); -SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*); -SQLITE_PRIVATE u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int); -# define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p)) -# define sqlite3IsToplevel(p) ((p)->pToplevel==0) +SQLITE_PRIVATE void tdsqlite3DeleteTrigger(tdsqlite3*, Trigger*); +SQLITE_PRIVATE void tdsqlite3UnlinkAndDeleteTrigger(tdsqlite3*,int,const char*); +SQLITE_PRIVATE u32 tdsqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int); +# define tdsqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p)) +# define tdsqlite3IsToplevel(p) ((p)->pToplevel==0) #else -# define sqlite3TriggersExist(B,C,D,E,F) 0 -# define sqlite3DeleteTrigger(A,B) -# define sqlite3DropTriggerPtr(A,B) -# define sqlite3UnlinkAndDeleteTrigger(A,B,C) -# define sqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I) -# define sqlite3CodeRowTriggerDirect(A,B,C,D,E,F) -# define sqlite3TriggerList(X, Y) 0 -# define sqlite3ParseToplevel(p) p -# define sqlite3IsToplevel(p) 1 -# define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0 +# define tdsqlite3TriggersExist(B,C,D,E,F) 0 +# define tdsqlite3DeleteTrigger(A,B) +# define tdsqlite3DropTriggerPtr(A,B) +# define tdsqlite3UnlinkAndDeleteTrigger(A,B,C) +# define tdsqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I) +# define tdsqlite3CodeRowTriggerDirect(A,B,C,D,E,F) +# define tdsqlite3TriggerList(X, Y) 0 +# define tdsqlite3ParseToplevel(p) p +# define tdsqlite3IsToplevel(p) 1 +# define tdsqlite3TriggerColmask(A,B,C,D,E,F,G) 0 #endif -SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*); -SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr*,int); -SQLITE_PRIVATE void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int); -SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse*, int); +SQLITE_PRIVATE int tdsqlite3JoinType(Parse*, Token*, Token*, Token*); +SQLITE_PRIVATE void tdsqlite3SetJoinExpr(Expr*,int); +SQLITE_PRIVATE void tdsqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int); +SQLITE_PRIVATE void tdsqlite3DeferForeignKey(Parse*, int); #ifndef SQLITE_OMIT_AUTHORIZATION -SQLITE_PRIVATE void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*); -SQLITE_PRIVATE int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*); -SQLITE_PRIVATE void sqlite3AuthContextPush(Parse*, AuthContext*, const char*); -SQLITE_PRIVATE void sqlite3AuthContextPop(AuthContext*); -SQLITE_PRIVATE int sqlite3AuthReadCol(Parse*, const char *, const char *, int); +SQLITE_PRIVATE void tdsqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*); +SQLITE_PRIVATE int tdsqlite3AuthCheck(Parse*,int, const char*, const char*, const char*); +SQLITE_PRIVATE void tdsqlite3AuthContextPush(Parse*, AuthContext*, const char*); +SQLITE_PRIVATE void tdsqlite3AuthContextPop(AuthContext*); +SQLITE_PRIVATE int tdsqlite3AuthReadCol(Parse*, const char *, const char *, int); #else -# define sqlite3AuthRead(a,b,c,d) -# define sqlite3AuthCheck(a,b,c,d,e) SQLITE_OK -# define sqlite3AuthContextPush(a,b,c) -# define sqlite3AuthContextPop(a) ((void)(a)) +# define tdsqlite3AuthRead(a,b,c,d) +# define tdsqlite3AuthCheck(a,b,c,d,e) SQLITE_OK +# define tdsqlite3AuthContextPush(a,b,c) +# define tdsqlite3AuthContextPop(a) ((void)(a)) #endif -SQLITE_PRIVATE void sqlite3Attach(Parse*, Expr*, Expr*, Expr*); -SQLITE_PRIVATE void sqlite3Detach(Parse*, Expr*); -SQLITE_PRIVATE void sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*); -SQLITE_PRIVATE int sqlite3FixSrcList(DbFixer*, SrcList*); -SQLITE_PRIVATE int sqlite3FixSelect(DbFixer*, Select*); -SQLITE_PRIVATE int sqlite3FixExpr(DbFixer*, Expr*); -SQLITE_PRIVATE int sqlite3FixExprList(DbFixer*, ExprList*); -SQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*); -SQLITE_PRIVATE int sqlite3RealSameAsInt(double,sqlite3_int64); -SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8); -SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*); -SQLITE_PRIVATE int sqlite3Atoi(const char*); +SQLITE_PRIVATE void tdsqlite3Attach(Parse*, Expr*, Expr*, Expr*); +SQLITE_PRIVATE void tdsqlite3Detach(Parse*, Expr*); +SQLITE_PRIVATE void tdsqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*); +SQLITE_PRIVATE int tdsqlite3FixSrcList(DbFixer*, SrcList*); +SQLITE_PRIVATE int tdsqlite3FixSelect(DbFixer*, Select*); +SQLITE_PRIVATE int tdsqlite3FixExpr(DbFixer*, Expr*); +SQLITE_PRIVATE int tdsqlite3FixExprList(DbFixer*, ExprList*); +SQLITE_PRIVATE int tdsqlite3FixTriggerStep(DbFixer*, TriggerStep*); +SQLITE_PRIVATE int tdsqlite3RealSameAsInt(double,tdsqlite3_int64); +SQLITE_PRIVATE int tdsqlite3AtoF(const char *z, double*, int, u8); +SQLITE_PRIVATE int tdsqlite3GetInt32(const char *, int*); +SQLITE_PRIVATE int tdsqlite3Atoi(const char*); #ifndef SQLITE_OMIT_UTF16 -SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar); +SQLITE_PRIVATE int tdsqlite3Utf16ByteLen(const void *pData, int nChar); #endif -SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte); -SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**); -SQLITE_PRIVATE LogEst sqlite3LogEst(u64); -SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst); +SQLITE_PRIVATE int tdsqlite3Utf8CharLen(const char *pData, int nByte); +SQLITE_PRIVATE u32 tdsqlite3Utf8Read(const u8**); +SQLITE_PRIVATE LogEst tdsqlite3LogEst(u64); +SQLITE_PRIVATE LogEst tdsqlite3LogEstAdd(LogEst,LogEst); #ifndef SQLITE_OMIT_VIRTUALTABLE -SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double); +SQLITE_PRIVATE LogEst tdsqlite3LogEstFromDouble(double); #endif #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \ defined(SQLITE_ENABLE_STAT4) || \ defined(SQLITE_EXPLAIN_ESTIMATED_ROWS) -SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst); +SQLITE_PRIVATE u64 tdsqlite3LogEstToInt(LogEst); #endif -SQLITE_PRIVATE VList *sqlite3VListAdd(sqlite3*,VList*,const char*,int,int); -SQLITE_PRIVATE const char *sqlite3VListNumToName(VList*,int); -SQLITE_PRIVATE int sqlite3VListNameToNum(VList*,const char*,int); +SQLITE_PRIVATE VList *tdsqlite3VListAdd(tdsqlite3*,VList*,const char*,int,int); +SQLITE_PRIVATE const char *tdsqlite3VListNumToName(VList*,int); +SQLITE_PRIVATE int tdsqlite3VListNameToNum(VList*,const char*,int); /* ** Routines to read and write variable-length integers. These used to ** be defined locally, but now we use the varint routines in the util.c ** file. */ -SQLITE_PRIVATE int sqlite3PutVarint(unsigned char*, u64); -SQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *, u64 *); -SQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *, u32 *); -SQLITE_PRIVATE int sqlite3VarintLen(u64 v); +SQLITE_PRIVATE int tdsqlite3PutVarint(unsigned char*, u64); +SQLITE_PRIVATE u8 tdsqlite3GetVarint(const unsigned char *, u64 *); +SQLITE_PRIVATE u8 tdsqlite3GetVarint32(const unsigned char *, u32 *); +SQLITE_PRIVATE int tdsqlite3VarintLen(u64 v); /* ** The common case is for a varint to be a single byte. They following @@ -19716,301 +19716,301 @@ SQLITE_PRIVATE int sqlite3VarintLen(u64 v); ** the procedure for larger varints. */ #define getVarint32(A,B) \ - (u8)((*(A)<(u8)0x80)?((B)=(u32)*(A)),1:sqlite3GetVarint32((A),(u32 *)&(B))) + (u8)((*(A)<(u8)0x80)?((B)=(u32)*(A)),1:tdsqlite3GetVarint32((A),(u32 *)&(B))) #define putVarint32(A,B) \ (u8)(((u32)(B)<(u32)0x80)?(*(A)=(unsigned char)(B)),1:\ - sqlite3PutVarint((A),(B))) -#define getVarint sqlite3GetVarint -#define putVarint sqlite3PutVarint + tdsqlite3PutVarint((A),(B))) +#define getVarint tdsqlite3GetVarint +#define putVarint tdsqlite3PutVarint -SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3*, Index*); -SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe*, Table*, int); -SQLITE_PRIVATE char sqlite3CompareAffinity(Expr *pExpr, char aff2); -SQLITE_PRIVATE int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity); -SQLITE_PRIVATE char sqlite3TableColumnAffinity(Table*,int); -SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr); -SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8); -SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char*, i64*); -SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...); -SQLITE_PRIVATE void sqlite3Error(sqlite3*,int); -SQLITE_PRIVATE void sqlite3SystemError(sqlite3*,int); -SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n); -SQLITE_PRIVATE u8 sqlite3HexToInt(int h); -SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **); +SQLITE_PRIVATE const char *tdsqlite3IndexAffinityStr(tdsqlite3*, Index*); +SQLITE_PRIVATE void tdsqlite3TableAffinity(Vdbe*, Table*, int); +SQLITE_PRIVATE char tdsqlite3CompareAffinity(Expr *pExpr, char aff2); +SQLITE_PRIVATE int tdsqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity); +SQLITE_PRIVATE char tdsqlite3TableColumnAffinity(Table*,int); +SQLITE_PRIVATE char tdsqlite3ExprAffinity(Expr *pExpr); +SQLITE_PRIVATE int tdsqlite3Atoi64(const char*, i64*, int, u8); +SQLITE_PRIVATE int tdsqlite3DecOrHexToI64(const char*, i64*); +SQLITE_PRIVATE void tdsqlite3ErrorWithMsg(tdsqlite3*, int, const char*,...); +SQLITE_PRIVATE void tdsqlite3Error(tdsqlite3*,int); +SQLITE_PRIVATE void tdsqlite3SystemError(tdsqlite3*,int); +SQLITE_PRIVATE void *tdsqlite3HexToBlob(tdsqlite3*, const char *z, int n); +SQLITE_PRIVATE u8 tdsqlite3HexToInt(int h); +SQLITE_PRIVATE int tdsqlite3TwoPartName(Parse *, Token *, Token *, Token **); #if defined(SQLITE_NEED_ERR_NAME) -SQLITE_PRIVATE const char *sqlite3ErrName(int); +SQLITE_PRIVATE const char *tdsqlite3ErrName(int); #endif #ifdef SQLITE_ENABLE_DESERIALIZE -SQLITE_PRIVATE int sqlite3MemdbInit(void); +SQLITE_PRIVATE int tdsqlite3MemdbInit(void); #endif -SQLITE_PRIVATE const char *sqlite3ErrStr(int); -SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse); -SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int); -SQLITE_PRIVATE int sqlite3IsBinary(const CollSeq*); -SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName); -SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr); -SQLITE_PRIVATE CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr); -SQLITE_PRIVATE int sqlite3ExprCollSeqMatch(Parse*,Expr*,Expr*); -SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int); -SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString(Parse*,Expr*,const char*); -SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr*); -SQLITE_PRIVATE Expr *sqlite3ExprSkipCollateAndLikely(Expr*); -SQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *, CollSeq *); -SQLITE_PRIVATE int sqlite3WritableSchema(sqlite3*); -SQLITE_PRIVATE int sqlite3CheckObjectName(Parse*, const char*,const char*,const char*); -SQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *, int); -SQLITE_PRIVATE int sqlite3AddInt64(i64*,i64); -SQLITE_PRIVATE int sqlite3SubInt64(i64*,i64); -SQLITE_PRIVATE int sqlite3MulInt64(i64*,i64); -SQLITE_PRIVATE int sqlite3AbsInt32(int); +SQLITE_PRIVATE const char *tdsqlite3ErrStr(int); +SQLITE_PRIVATE int tdsqlite3ReadSchema(Parse *pParse); +SQLITE_PRIVATE CollSeq *tdsqlite3FindCollSeq(tdsqlite3*,u8 enc, const char*,int); +SQLITE_PRIVATE int tdsqlite3IsBinary(const CollSeq*); +SQLITE_PRIVATE CollSeq *tdsqlite3LocateCollSeq(Parse *pParse, const char*zName); +SQLITE_PRIVATE CollSeq *tdsqlite3ExprCollSeq(Parse *pParse, Expr *pExpr); +SQLITE_PRIVATE CollSeq *tdsqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr); +SQLITE_PRIVATE int tdsqlite3ExprCollSeqMatch(Parse*,Expr*,Expr*); +SQLITE_PRIVATE Expr *tdsqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int); +SQLITE_PRIVATE Expr *tdsqlite3ExprAddCollateString(Parse*,Expr*,const char*); +SQLITE_PRIVATE Expr *tdsqlite3ExprSkipCollate(Expr*); +SQLITE_PRIVATE Expr *tdsqlite3ExprSkipCollateAndLikely(Expr*); +SQLITE_PRIVATE int tdsqlite3CheckCollSeq(Parse *, CollSeq *); +SQLITE_PRIVATE int tdsqlite3WritableSchema(tdsqlite3*); +SQLITE_PRIVATE int tdsqlite3CheckObjectName(Parse*, const char*,const char*,const char*); +SQLITE_PRIVATE void tdsqlite3VdbeSetChanges(tdsqlite3 *, int); +SQLITE_PRIVATE int tdsqlite3AddInt64(i64*,i64); +SQLITE_PRIVATE int tdsqlite3SubInt64(i64*,i64); +SQLITE_PRIVATE int tdsqlite3MulInt64(i64*,i64); +SQLITE_PRIVATE int tdsqlite3AbsInt32(int); #ifdef SQLITE_ENABLE_8_3_NAMES -SQLITE_PRIVATE void sqlite3FileSuffix3(const char*, char*); +SQLITE_PRIVATE void tdsqlite3FileSuffix3(const char*, char*); #else -# define sqlite3FileSuffix3(X,Y) +# define tdsqlite3FileSuffix3(X,Y) #endif -SQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z,u8); +SQLITE_PRIVATE u8 tdsqlite3GetBoolean(const char *z,u8); -SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8); -SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8); -SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, +SQLITE_PRIVATE const void *tdsqlite3ValueText(tdsqlite3_value*, u8); +SQLITE_PRIVATE int tdsqlite3ValueBytes(tdsqlite3_value*, u8); +SQLITE_PRIVATE void tdsqlite3ValueSetStr(tdsqlite3_value*, int, const void *,u8, void(*)(void*)); -SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value*); -SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*); +SQLITE_PRIVATE void tdsqlite3ValueSetNull(tdsqlite3_value*); +SQLITE_PRIVATE void tdsqlite3ValueFree(tdsqlite3_value*); #ifndef SQLITE_UNTESTABLE -SQLITE_PRIVATE void sqlite3ResultIntReal(sqlite3_context*); +SQLITE_PRIVATE void tdsqlite3ResultIntReal(tdsqlite3_context*); #endif -SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *); +SQLITE_PRIVATE tdsqlite3_value *tdsqlite3ValueNew(tdsqlite3 *); #ifndef SQLITE_OMIT_UTF16 -SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8); +SQLITE_PRIVATE char *tdsqlite3Utf16to8(tdsqlite3 *, const void*, int, u8); #endif -SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **); -SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8); +SQLITE_PRIVATE int tdsqlite3ValueFromExpr(tdsqlite3 *, Expr *, u8, u8, tdsqlite3_value **); +SQLITE_PRIVATE void tdsqlite3ValueApplyAffinity(tdsqlite3_value *, u8, u8); #ifndef SQLITE_AMALGAMATION -SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[]; -SQLITE_PRIVATE const char sqlite3StrBINARY[]; -SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[]; -SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[]; -SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config; -SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions; +SQLITE_PRIVATE const unsigned char tdsqlite3OpcodeProperty[]; +SQLITE_PRIVATE const char tdsqlite3StrBINARY[]; +SQLITE_PRIVATE const unsigned char tdsqlite3UpperToLower[]; +SQLITE_PRIVATE const unsigned char tdsqlite3CtypeMap[]; +SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config tdsqlite3Config; +SQLITE_PRIVATE FuncDefHash tdsqlite3BuiltinFunctions; #ifndef SQLITE_OMIT_WSD -SQLITE_PRIVATE int sqlite3PendingByte; +SQLITE_PRIVATE int tdsqlite3PendingByte; #endif #endif #ifdef VDBE_PROFILE -SQLITE_PRIVATE sqlite3_uint64 sqlite3NProfileCnt; +SQLITE_PRIVATE tdsqlite3_uint64 tdsqlite3NProfileCnt; #endif -SQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3*, int, int, int); -SQLITE_PRIVATE void sqlite3Reindex(Parse*, Token*, Token*); -SQLITE_PRIVATE void sqlite3AlterFunctions(void); -SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); -SQLITE_PRIVATE void sqlite3AlterRenameColumn(Parse*, SrcList*, Token*, Token*); -SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); -SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...); -SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int); -SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int); -SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*); -SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*); -SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p); -SQLITE_PRIVATE int sqlite3MatchEName( +SQLITE_PRIVATE void tdsqlite3RootPageMoved(tdsqlite3*, int, int, int); +SQLITE_PRIVATE void tdsqlite3Reindex(Parse*, Token*, Token*); +SQLITE_PRIVATE void tdsqlite3AlterFunctions(void); +SQLITE_PRIVATE void tdsqlite3AlterRenameTable(Parse*, SrcList*, Token*); +SQLITE_PRIVATE void tdsqlite3AlterRenameColumn(Parse*, SrcList*, Token*, Token*); +SQLITE_PRIVATE int tdsqlite3GetToken(const unsigned char *, int *); +SQLITE_PRIVATE void tdsqlite3NestedParse(Parse*, const char*, ...); +SQLITE_PRIVATE void tdsqlite3ExpirePreparedStatements(tdsqlite3*, int); +SQLITE_PRIVATE void tdsqlite3CodeRhsOfIN(Parse*, Expr*, int); +SQLITE_PRIVATE int tdsqlite3CodeSubselect(Parse*, Expr*); +SQLITE_PRIVATE void tdsqlite3SelectPrep(Parse*, Select*, NameContext*); +SQLITE_PRIVATE void tdsqlite3SelectWrongNumTermsError(Parse *pParse, Select *p); +SQLITE_PRIVATE int tdsqlite3MatchEName( const struct ExprList_item*, const char*, const char*, const char* ); -SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*); -SQLITE_PRIVATE int sqlite3ResolveExprListNames(NameContext*, ExprList*); -SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*); -SQLITE_PRIVATE int sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*); -SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*); -SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int); -SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *); -SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *); -SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse*, void*, Token*); -SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom); -SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse*, Expr*); -SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse*, ExprList*); -SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*); -SQLITE_PRIVATE char sqlite3AffinityType(const char*, Column*); -SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*); -SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler*, sqlite3_file*); -SQLITE_PRIVATE int sqlite3FindDb(sqlite3*, Token*); -SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *, const char *); -SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3*,int iDB); -SQLITE_PRIVATE void sqlite3DeleteIndexSamples(sqlite3*,Index*); -SQLITE_PRIVATE void sqlite3DefaultRowEst(Index*); -SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3*, int); -SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*); -SQLITE_PRIVATE void sqlite3SchemaClear(void *); -SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *, Btree *); -SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *); -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3*,int,int); -SQLITE_PRIVATE void sqlite3KeyInfoUnref(KeyInfo*); -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoRef(KeyInfo*); -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoOfIndex(Parse*, Index*); -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoFromExprList(Parse*, ExprList*, int, int); -SQLITE_PRIVATE int sqlite3HasExplicitNulls(Parse*, ExprList*); +SQLITE_PRIVATE int tdsqlite3ResolveExprNames(NameContext*, Expr*); +SQLITE_PRIVATE int tdsqlite3ResolveExprListNames(NameContext*, ExprList*); +SQLITE_PRIVATE void tdsqlite3ResolveSelectNames(Parse*, Select*, NameContext*); +SQLITE_PRIVATE int tdsqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*); +SQLITE_PRIVATE int tdsqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*); +SQLITE_PRIVATE void tdsqlite3ColumnDefault(Vdbe *, Table *, int, int); +SQLITE_PRIVATE void tdsqlite3AlterFinishAddColumn(Parse *, Token *); +SQLITE_PRIVATE void tdsqlite3AlterBeginAddColumn(Parse *, SrcList *); +SQLITE_PRIVATE void *tdsqlite3RenameTokenMap(Parse*, void*, Token*); +SQLITE_PRIVATE void tdsqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom); +SQLITE_PRIVATE void tdsqlite3RenameExprUnmap(Parse*, Expr*); +SQLITE_PRIVATE void tdsqlite3RenameExprlistUnmap(Parse*, ExprList*); +SQLITE_PRIVATE CollSeq *tdsqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*); +SQLITE_PRIVATE char tdsqlite3AffinityType(const char*, Column*); +SQLITE_PRIVATE void tdsqlite3Analyze(Parse*, Token*, Token*); +SQLITE_PRIVATE int tdsqlite3InvokeBusyHandler(BusyHandler*, tdsqlite3_file*); +SQLITE_PRIVATE int tdsqlite3FindDb(tdsqlite3*, Token*); +SQLITE_PRIVATE int tdsqlite3FindDbName(tdsqlite3 *, const char *); +SQLITE_PRIVATE int tdsqlite3AnalysisLoad(tdsqlite3*,int iDB); +SQLITE_PRIVATE void tdsqlite3DeleteIndexSamples(tdsqlite3*,Index*); +SQLITE_PRIVATE void tdsqlite3DefaultRowEst(Index*); +SQLITE_PRIVATE void tdsqlite3RegisterLikeFunctions(tdsqlite3*, int); +SQLITE_PRIVATE int tdsqlite3IsLikeFunction(tdsqlite3*,Expr*,int*,char*); +SQLITE_PRIVATE void tdsqlite3SchemaClear(void *); +SQLITE_PRIVATE Schema *tdsqlite3SchemaGet(tdsqlite3 *, Btree *); +SQLITE_PRIVATE int tdsqlite3SchemaToIndex(tdsqlite3 *db, Schema *); +SQLITE_PRIVATE KeyInfo *tdsqlite3KeyInfoAlloc(tdsqlite3*,int,int); +SQLITE_PRIVATE void tdsqlite3KeyInfoUnref(KeyInfo*); +SQLITE_PRIVATE KeyInfo *tdsqlite3KeyInfoRef(KeyInfo*); +SQLITE_PRIVATE KeyInfo *tdsqlite3KeyInfoOfIndex(Parse*, Index*); +SQLITE_PRIVATE KeyInfo *tdsqlite3KeyInfoFromExprList(Parse*, ExprList*, int, int); +SQLITE_PRIVATE int tdsqlite3HasExplicitNulls(Parse*, ExprList*); #ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3KeyInfoIsWriteable(KeyInfo*); +SQLITE_PRIVATE int tdsqlite3KeyInfoIsWriteable(KeyInfo*); #endif -SQLITE_PRIVATE int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *, - void (*)(sqlite3_context*,int,sqlite3_value **), - void (*)(sqlite3_context*,int,sqlite3_value **), - void (*)(sqlite3_context*), - void (*)(sqlite3_context*), - void (*)(sqlite3_context*,int,sqlite3_value **), +SQLITE_PRIVATE int tdsqlite3CreateFunc(tdsqlite3 *, const char *, int, int, void *, + void (*)(tdsqlite3_context*,int,tdsqlite3_value **), + void (*)(tdsqlite3_context*,int,tdsqlite3_value **), + void (*)(tdsqlite3_context*), + void (*)(tdsqlite3_context*), + void (*)(tdsqlite3_context*,int,tdsqlite3_value **), FuncDestructor *pDestructor ); -SQLITE_PRIVATE void sqlite3NoopDestructor(void*); -SQLITE_PRIVATE void sqlite3OomFault(sqlite3*); -SQLITE_PRIVATE void sqlite3OomClear(sqlite3*); -SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int); -SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *); +SQLITE_PRIVATE void tdsqlite3NoopDestructor(void*); +SQLITE_PRIVATE void tdsqlite3OomFault(tdsqlite3*); +SQLITE_PRIVATE void tdsqlite3OomClear(tdsqlite3*); +SQLITE_PRIVATE int tdsqlite3ApiExit(tdsqlite3 *db, int); +SQLITE_PRIVATE int tdsqlite3OpenTempDatabase(Parse *); -SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, sqlite3*, char*, int, int); -SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*); -SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int); -SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int); +SQLITE_PRIVATE void tdsqlite3StrAccumInit(StrAccum*, tdsqlite3*, char*, int, int); +SQLITE_PRIVATE char *tdsqlite3StrAccumFinish(StrAccum*); +SQLITE_PRIVATE void tdsqlite3SelectDestInit(SelectDest*,int,int); +SQLITE_PRIVATE Expr *tdsqlite3CreateColumnExpr(tdsqlite3 *, SrcList *, int, int); -SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *); -SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); +SQLITE_PRIVATE void tdsqlite3BackupRestart(tdsqlite3_backup *); +SQLITE_PRIVATE void tdsqlite3BackupUpdate(tdsqlite3_backup *, Pgno, const u8 *); #ifndef SQLITE_OMIT_SUBQUERY -SQLITE_PRIVATE int sqlite3ExprCheckIN(Parse*, Expr*); +SQLITE_PRIVATE int tdsqlite3ExprCheckIN(Parse*, Expr*); #else -# define sqlite3ExprCheckIN(x,y) SQLITE_OK +# define tdsqlite3ExprCheckIN(x,y) SQLITE_OK #endif #ifdef SQLITE_ENABLE_STAT4 -SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue( +SQLITE_PRIVATE int tdsqlite3Stat4ProbeSetValue( Parse*,Index*,UnpackedRecord**,Expr*,int,int,int*); -SQLITE_PRIVATE int sqlite3Stat4ValueFromExpr(Parse*, Expr*, u8, sqlite3_value**); -SQLITE_PRIVATE void sqlite3Stat4ProbeFree(UnpackedRecord*); -SQLITE_PRIVATE int sqlite3Stat4Column(sqlite3*, const void*, int, int, sqlite3_value**); -SQLITE_PRIVATE char sqlite3IndexColumnAffinity(sqlite3*, Index*, int); +SQLITE_PRIVATE int tdsqlite3Stat4ValueFromExpr(Parse*, Expr*, u8, tdsqlite3_value**); +SQLITE_PRIVATE void tdsqlite3Stat4ProbeFree(UnpackedRecord*); +SQLITE_PRIVATE int tdsqlite3Stat4Column(tdsqlite3*, const void*, int, int, tdsqlite3_value**); +SQLITE_PRIVATE char tdsqlite3IndexColumnAffinity(tdsqlite3*, Index*, int); #endif /* ** The interface to the LEMON-generated parser */ #ifndef SQLITE_AMALGAMATION -SQLITE_PRIVATE void *sqlite3ParserAlloc(void*(*)(u64), Parse*); -SQLITE_PRIVATE void sqlite3ParserFree(void*, void(*)(void*)); +SQLITE_PRIVATE void *tdsqlite3ParserAlloc(void*(*)(u64), Parse*); +SQLITE_PRIVATE void tdsqlite3ParserFree(void*, void(*)(void*)); #endif -SQLITE_PRIVATE void sqlite3Parser(void*, int, Token); -SQLITE_PRIVATE int sqlite3ParserFallback(int); +SQLITE_PRIVATE void tdsqlite3Parser(void*, int, Token); +SQLITE_PRIVATE int tdsqlite3ParserFallback(int); #ifdef YYTRACKMAXSTACKDEPTH -SQLITE_PRIVATE int sqlite3ParserStackPeak(void*); +SQLITE_PRIVATE int tdsqlite3ParserStackPeak(void*); #endif -SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3*); +SQLITE_PRIVATE void tdsqlite3AutoLoadExtensions(tdsqlite3*); #ifndef SQLITE_OMIT_LOAD_EXTENSION -SQLITE_PRIVATE void sqlite3CloseExtensions(sqlite3*); +SQLITE_PRIVATE void tdsqlite3CloseExtensions(tdsqlite3*); #else -# define sqlite3CloseExtensions(X) +# define tdsqlite3CloseExtensions(X) #endif #ifndef SQLITE_OMIT_SHARED_CACHE -SQLITE_PRIVATE void sqlite3TableLock(Parse *, int, int, u8, const char *); +SQLITE_PRIVATE void tdsqlite3TableLock(Parse *, int, int, u8, const char *); #else - #define sqlite3TableLock(v,w,x,y,z) + #define tdsqlite3TableLock(v,w,x,y,z) #endif #ifdef SQLITE_TEST -SQLITE_PRIVATE int sqlite3Utf8To8(unsigned char*); +SQLITE_PRIVATE int tdsqlite3Utf8To8(unsigned char*); #endif #ifdef SQLITE_OMIT_VIRTUALTABLE -# define sqlite3VtabClear(Y) -# define sqlite3VtabSync(X,Y) SQLITE_OK -# define sqlite3VtabRollback(X) -# define sqlite3VtabCommit(X) -# define sqlite3VtabInSync(db) 0 -# define sqlite3VtabLock(X) -# define sqlite3VtabUnlock(X) -# define sqlite3VtabModuleUnref(D,X) -# define sqlite3VtabUnlockList(X) -# define sqlite3VtabSavepoint(X, Y, Z) SQLITE_OK -# define sqlite3GetVTable(X,Y) ((VTable*)0) +# define tdsqlite3VtabClear(Y) +# define tdsqlite3VtabSync(X,Y) SQLITE_OK +# define tdsqlite3VtabRollback(X) +# define tdsqlite3VtabCommit(X) +# define tdsqlite3VtabInSync(db) 0 +# define tdsqlite3VtabLock(X) +# define tdsqlite3VtabUnlock(X) +# define tdsqlite3VtabModuleUnref(D,X) +# define tdsqlite3VtabUnlockList(X) +# define tdsqlite3VtabSavepoint(X, Y, Z) SQLITE_OK +# define tdsqlite3GetVTable(X,Y) ((VTable*)0) #else -SQLITE_PRIVATE void sqlite3VtabClear(sqlite3 *db, Table*); -SQLITE_PRIVATE void sqlite3VtabDisconnect(sqlite3 *db, Table *p); -SQLITE_PRIVATE int sqlite3VtabSync(sqlite3 *db, Vdbe*); -SQLITE_PRIVATE int sqlite3VtabRollback(sqlite3 *db); -SQLITE_PRIVATE int sqlite3VtabCommit(sqlite3 *db); -SQLITE_PRIVATE void sqlite3VtabLock(VTable *); -SQLITE_PRIVATE void sqlite3VtabUnlock(VTable *); -SQLITE_PRIVATE void sqlite3VtabModuleUnref(sqlite3*,Module*); -SQLITE_PRIVATE void sqlite3VtabUnlockList(sqlite3*); -SQLITE_PRIVATE int sqlite3VtabSavepoint(sqlite3 *, int, int); -SQLITE_PRIVATE void sqlite3VtabImportErrmsg(Vdbe*, sqlite3_vtab*); -SQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3*, Table*); -SQLITE_PRIVATE Module *sqlite3VtabCreateModule( - sqlite3*, +SQLITE_PRIVATE void tdsqlite3VtabClear(tdsqlite3 *db, Table*); +SQLITE_PRIVATE void tdsqlite3VtabDisconnect(tdsqlite3 *db, Table *p); +SQLITE_PRIVATE int tdsqlite3VtabSync(tdsqlite3 *db, Vdbe*); +SQLITE_PRIVATE int tdsqlite3VtabRollback(tdsqlite3 *db); +SQLITE_PRIVATE int tdsqlite3VtabCommit(tdsqlite3 *db); +SQLITE_PRIVATE void tdsqlite3VtabLock(VTable *); +SQLITE_PRIVATE void tdsqlite3VtabUnlock(VTable *); +SQLITE_PRIVATE void tdsqlite3VtabModuleUnref(tdsqlite3*,Module*); +SQLITE_PRIVATE void tdsqlite3VtabUnlockList(tdsqlite3*); +SQLITE_PRIVATE int tdsqlite3VtabSavepoint(tdsqlite3 *, int, int); +SQLITE_PRIVATE void tdsqlite3VtabImportErrmsg(Vdbe*, tdsqlite3_vtab*); +SQLITE_PRIVATE VTable *tdsqlite3GetVTable(tdsqlite3*, Table*); +SQLITE_PRIVATE Module *tdsqlite3VtabCreateModule( + tdsqlite3*, const char*, - const sqlite3_module*, + const tdsqlite3_module*, void*, void(*)(void*) ); -# define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0) +# define tdsqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0) #endif -SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db); +SQLITE_PRIVATE int tdsqlite3ReadOnlyShadowTables(tdsqlite3 *db); #ifndef SQLITE_OMIT_VIRTUALTABLE -SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName); +SQLITE_PRIVATE int tdsqlite3ShadowTableName(tdsqlite3 *db, const char *zName); #else -# define sqlite3ShadowTableName(A,B) 0 +# define tdsqlite3ShadowTableName(A,B) 0 #endif -SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*); -SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*); -SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*); -SQLITE_PRIVATE void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*, int); -SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse*, Token*); -SQLITE_PRIVATE void sqlite3VtabArgInit(Parse*); -SQLITE_PRIVATE void sqlite3VtabArgExtend(Parse*, Token*); -SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **); -SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*); -SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3*, int, const char *); -SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *, VTable *); -SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*); -SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*); -SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int); -SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *); -SQLITE_PRIVATE void sqlite3ParserReset(Parse*); +SQLITE_PRIVATE int tdsqlite3VtabEponymousTableInit(Parse*,Module*); +SQLITE_PRIVATE void tdsqlite3VtabEponymousTableClear(tdsqlite3*,Module*); +SQLITE_PRIVATE void tdsqlite3VtabMakeWritable(Parse*,Table*); +SQLITE_PRIVATE void tdsqlite3VtabBeginParse(Parse*, Token*, Token*, Token*, int); +SQLITE_PRIVATE void tdsqlite3VtabFinishParse(Parse*, Token*); +SQLITE_PRIVATE void tdsqlite3VtabArgInit(Parse*); +SQLITE_PRIVATE void tdsqlite3VtabArgExtend(Parse*, Token*); +SQLITE_PRIVATE int tdsqlite3VtabCallCreate(tdsqlite3*, int, const char *, char **); +SQLITE_PRIVATE int tdsqlite3VtabCallConnect(Parse*, Table*); +SQLITE_PRIVATE int tdsqlite3VtabCallDestroy(tdsqlite3*, int, const char *); +SQLITE_PRIVATE int tdsqlite3VtabBegin(tdsqlite3 *, VTable *); +SQLITE_PRIVATE FuncDef *tdsqlite3VtabOverloadFunction(tdsqlite3 *,FuncDef*, int nArg, Expr*); +SQLITE_PRIVATE tdsqlite3_int64 tdsqlite3StmtCurrentTime(tdsqlite3_context*); +SQLITE_PRIVATE int tdsqlite3VdbeParameterIndex(Vdbe*, const char*, int); +SQLITE_PRIVATE int tdsqlite3TransferBindings(tdsqlite3_stmt *, tdsqlite3_stmt *); +SQLITE_PRIVATE void tdsqlite3ParserReset(Parse*); #ifdef SQLITE_ENABLE_NORMALIZE -SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*); +SQLITE_PRIVATE char *tdsqlite3Normalize(Vdbe*, const char*); #endif -SQLITE_PRIVATE int sqlite3Reprepare(Vdbe*); -SQLITE_PRIVATE void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*); -SQLITE_PRIVATE CollSeq *sqlite3ExprCompareCollSeq(Parse*,Expr*); -SQLITE_PRIVATE CollSeq *sqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *); -SQLITE_PRIVATE int sqlite3TempInMemory(const sqlite3*); -SQLITE_PRIVATE const char *sqlite3JournalModename(int); +SQLITE_PRIVATE int tdsqlite3Reprepare(Vdbe*); +SQLITE_PRIVATE void tdsqlite3ExprListCheckLength(Parse*, ExprList*, const char*); +SQLITE_PRIVATE CollSeq *tdsqlite3ExprCompareCollSeq(Parse*,Expr*); +SQLITE_PRIVATE CollSeq *tdsqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *); +SQLITE_PRIVATE int tdsqlite3TempInMemory(const tdsqlite3*); +SQLITE_PRIVATE const char *tdsqlite3JournalModename(int); #ifndef SQLITE_OMIT_WAL -SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3*, int, int, int*, int*); -SQLITE_PRIVATE int sqlite3WalDefaultHook(void*,sqlite3*,const char*,int); +SQLITE_PRIVATE int tdsqlite3Checkpoint(tdsqlite3*, int, int, int*, int*); +SQLITE_PRIVATE int tdsqlite3WalDefaultHook(void*,tdsqlite3*,const char*,int); #endif #ifndef SQLITE_OMIT_CTE -SQLITE_PRIVATE With *sqlite3WithAdd(Parse*,With*,Token*,ExprList*,Select*); -SQLITE_PRIVATE void sqlite3WithDelete(sqlite3*,With*); -SQLITE_PRIVATE void sqlite3WithPush(Parse*, With*, u8); +SQLITE_PRIVATE With *tdsqlite3WithAdd(Parse*,With*,Token*,ExprList*,Select*); +SQLITE_PRIVATE void tdsqlite3WithDelete(tdsqlite3*,With*); +SQLITE_PRIVATE void tdsqlite3WithPush(Parse*, With*, u8); #else -#define sqlite3WithPush(x,y,z) -#define sqlite3WithDelete(x,y) +#define tdsqlite3WithPush(x,y,z) +#define tdsqlite3WithDelete(x,y) #endif #ifndef SQLITE_OMIT_UPSERT -SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*); -SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*); -SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*); -SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*); -SQLITE_PRIVATE void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int); +SQLITE_PRIVATE Upsert *tdsqlite3UpsertNew(tdsqlite3*,ExprList*,Expr*,ExprList*,Expr*); +SQLITE_PRIVATE void tdsqlite3UpsertDelete(tdsqlite3*,Upsert*); +SQLITE_PRIVATE Upsert *tdsqlite3UpsertDup(tdsqlite3*,Upsert*); +SQLITE_PRIVATE int tdsqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*); +SQLITE_PRIVATE void tdsqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int); #else -#define sqlite3UpsertNew(v,w,x,y,z) ((Upsert*)0) -#define sqlite3UpsertDelete(x,y) -#define sqlite3UpsertDup(x,y) ((Upsert*)0) +#define tdsqlite3UpsertNew(v,w,x,y,z) ((Upsert*)0) +#define tdsqlite3UpsertDelete(x,y) +#define tdsqlite3UpsertDup(x,y) ((Upsert*)0) #endif @@ -20022,26 +20022,26 @@ SQLITE_PRIVATE void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int); ** provided (enforcement of FK constraints requires the triggers sub-system). */ #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) -SQLITE_PRIVATE void sqlite3FkCheck(Parse*, Table*, int, int, int*, int); -SQLITE_PRIVATE void sqlite3FkDropTable(Parse*, SrcList *, Table*); -SQLITE_PRIVATE void sqlite3FkActions(Parse*, Table*, ExprList*, int, int*, int); -SQLITE_PRIVATE int sqlite3FkRequired(Parse*, Table*, int*, int); -SQLITE_PRIVATE u32 sqlite3FkOldmask(Parse*, Table*); -SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *); +SQLITE_PRIVATE void tdsqlite3FkCheck(Parse*, Table*, int, int, int*, int); +SQLITE_PRIVATE void tdsqlite3FkDropTable(Parse*, SrcList *, Table*); +SQLITE_PRIVATE void tdsqlite3FkActions(Parse*, Table*, ExprList*, int, int*, int); +SQLITE_PRIVATE int tdsqlite3FkRequired(Parse*, Table*, int*, int); +SQLITE_PRIVATE u32 tdsqlite3FkOldmask(Parse*, Table*); +SQLITE_PRIVATE FKey *tdsqlite3FkReferences(Table *); #else - #define sqlite3FkActions(a,b,c,d,e,f) - #define sqlite3FkCheck(a,b,c,d,e,f) - #define sqlite3FkDropTable(a,b,c) - #define sqlite3FkOldmask(a,b) 0 - #define sqlite3FkRequired(a,b,c,d) 0 - #define sqlite3FkReferences(a) 0 + #define tdsqlite3FkActions(a,b,c,d,e,f) + #define tdsqlite3FkCheck(a,b,c,d,e,f) + #define tdsqlite3FkDropTable(a,b,c) + #define tdsqlite3FkOldmask(a,b) 0 + #define tdsqlite3FkRequired(a,b,c,d) 0 + #define tdsqlite3FkReferences(a) 0 #endif #ifndef SQLITE_OMIT_FOREIGN_KEY -SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *, Table*); -SQLITE_PRIVATE int sqlite3FkLocateIndex(Parse*,Table*,FKey*,Index**,int**); +SQLITE_PRIVATE void tdsqlite3FkDelete(tdsqlite3 *, Table*); +SQLITE_PRIVATE int tdsqlite3FkLocateIndex(Parse*,Table*,FKey*,Index**,int**); #else - #define sqlite3FkDelete(a,b) - #define sqlite3FkLocateIndex(a,b,c,d,e) + #define tdsqlite3FkDelete(a,b) + #define tdsqlite3FkLocateIndex(a,b,c,d,e) #endif @@ -20057,15 +20057,15 @@ SQLITE_PRIVATE int sqlite3FkLocateIndex(Parse*,Table*,FKey*,Index**,int**); ** is not defined. */ #ifndef SQLITE_UNTESTABLE -SQLITE_PRIVATE void sqlite3BeginBenignMalloc(void); -SQLITE_PRIVATE void sqlite3EndBenignMalloc(void); +SQLITE_PRIVATE void tdsqlite3BeginBenignMalloc(void); +SQLITE_PRIVATE void tdsqlite3EndBenignMalloc(void); #else - #define sqlite3BeginBenignMalloc() - #define sqlite3EndBenignMalloc() + #define tdsqlite3BeginBenignMalloc() + #define tdsqlite3EndBenignMalloc() #endif /* -** Allowed return values from sqlite3FindInIndex() +** Allowed return values from tdsqlite3FindInIndex() */ #define IN_INDEX_ROWID 1 /* Search the rowid of the table */ #define IN_INDEX_EPH 2 /* Search an ephemeral b-tree */ @@ -20073,64 +20073,64 @@ SQLITE_PRIVATE void sqlite3EndBenignMalloc(void); #define IN_INDEX_INDEX_DESC 4 /* Existing index DESCENDING */ #define IN_INDEX_NOOP 5 /* No table available. Use comparisons */ /* -** Allowed flags for the 3rd parameter to sqlite3FindInIndex(). +** Allowed flags for the 3rd parameter to tdsqlite3FindInIndex(). */ #define IN_INDEX_NOOP_OK 0x0001 /* OK to return IN_INDEX_NOOP */ #define IN_INDEX_MEMBERSHIP 0x0002 /* IN operator used for membership test */ #define IN_INDEX_LOOP 0x0004 /* IN operator used as a loop */ -SQLITE_PRIVATE int sqlite3FindInIndex(Parse *, Expr *, u32, int*, int*, int*); +SQLITE_PRIVATE int tdsqlite3FindInIndex(Parse *, Expr *, u32, int*, int*, int*); -SQLITE_PRIVATE int sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int); -SQLITE_PRIVATE int sqlite3JournalSize(sqlite3_vfs *); +SQLITE_PRIVATE int tdsqlite3JournalOpen(tdsqlite3_vfs *, const char *, tdsqlite3_file *, int, int); +SQLITE_PRIVATE int tdsqlite3JournalSize(tdsqlite3_vfs *); #if defined(SQLITE_ENABLE_ATOMIC_WRITE) \ || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE) -SQLITE_PRIVATE int sqlite3JournalCreate(sqlite3_file *); +SQLITE_PRIVATE int tdsqlite3JournalCreate(tdsqlite3_file *); #endif -SQLITE_PRIVATE int sqlite3JournalIsInMemory(sqlite3_file *p); -SQLITE_PRIVATE void sqlite3MemJournalOpen(sqlite3_file *); +SQLITE_PRIVATE int tdsqlite3JournalIsInMemory(tdsqlite3_file *p); +SQLITE_PRIVATE void tdsqlite3MemJournalOpen(tdsqlite3_file *); -SQLITE_PRIVATE void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p); +SQLITE_PRIVATE void tdsqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p); #if SQLITE_MAX_EXPR_DEPTH>0 -SQLITE_PRIVATE int sqlite3SelectExprHeight(Select *); -SQLITE_PRIVATE int sqlite3ExprCheckHeight(Parse*, int); +SQLITE_PRIVATE int tdsqlite3SelectExprHeight(Select *); +SQLITE_PRIVATE int tdsqlite3ExprCheckHeight(Parse*, int); #else - #define sqlite3SelectExprHeight(x) 0 - #define sqlite3ExprCheckHeight(x,y) + #define tdsqlite3SelectExprHeight(x) 0 + #define tdsqlite3ExprCheckHeight(x,y) #endif -SQLITE_PRIVATE u32 sqlite3Get4byte(const u8*); -SQLITE_PRIVATE void sqlite3Put4byte(u8*, u32); +SQLITE_PRIVATE u32 tdsqlite3Get4byte(const u8*); +SQLITE_PRIVATE void tdsqlite3Put4byte(u8*, u32); #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY -SQLITE_PRIVATE void sqlite3ConnectionBlocked(sqlite3 *, sqlite3 *); -SQLITE_PRIVATE void sqlite3ConnectionUnlocked(sqlite3 *db); -SQLITE_PRIVATE void sqlite3ConnectionClosed(sqlite3 *db); +SQLITE_PRIVATE void tdsqlite3ConnectionBlocked(tdsqlite3 *, tdsqlite3 *); +SQLITE_PRIVATE void tdsqlite3ConnectionUnlocked(tdsqlite3 *db); +SQLITE_PRIVATE void tdsqlite3ConnectionClosed(tdsqlite3 *db); #else - #define sqlite3ConnectionBlocked(x,y) - #define sqlite3ConnectionUnlocked(x) - #define sqlite3ConnectionClosed(x) + #define tdsqlite3ConnectionBlocked(x,y) + #define tdsqlite3ConnectionUnlocked(x) + #define tdsqlite3ConnectionClosed(x) #endif #ifdef SQLITE_DEBUG -SQLITE_PRIVATE void sqlite3ParserTrace(FILE*, char *); +SQLITE_PRIVATE void tdsqlite3ParserTrace(FILE*, char *); #endif #if defined(YYCOVERAGE) -SQLITE_PRIVATE int sqlite3ParserCoverage(FILE*); +SQLITE_PRIVATE int tdsqlite3ParserCoverage(FILE*); #endif /* ** If the SQLITE_ENABLE IOTRACE exists then the global variable -** sqlite3IoTrace is a pointer to a printf-like routine used to +** tdsqlite3IoTrace is a pointer to a printf-like routine used to ** print I/O tracing messages. */ #ifdef SQLITE_ENABLE_IOTRACE -# define IOTRACE(A) if( sqlite3IoTrace ){ sqlite3IoTrace A; } -SQLITE_PRIVATE void sqlite3VdbeIOTraceSql(Vdbe*); -SQLITE_API SQLITE_EXTERN void (SQLITE_CDECL *sqlite3IoTrace)(const char*,...); +# define IOTRACE(A) if( tdsqlite3IoTrace ){ tdsqlite3IoTrace A; } +SQLITE_PRIVATE void tdsqlite3VdbeIOTraceSql(Vdbe*); +SQLITE_API SQLITE_EXTERN void (SQLITE_CDECL *tdsqlite3IoTrace)(const char*,...); #else # define IOTRACE(A) -# define sqlite3VdbeIOTraceSql(X) +# define tdsqlite3VdbeIOTraceSql(X) #endif /* @@ -20138,16 +20138,16 @@ SQLITE_API SQLITE_EXTERN void (SQLITE_CDECL *sqlite3IoTrace)(const char*,...); ** only. They are used to verify that different "types" of memory ** allocations are properly tracked by the system. ** -** sqlite3MemdebugSetType() sets the "type" of an allocation to one of +** tdsqlite3MemdebugSetType() sets the "type" of an allocation to one of ** the MEMTYPE_* macros defined below. The type must be a bitmask with ** a single bit set. ** -** sqlite3MemdebugHasType() returns true if any of the bits in its second -** argument match the type set by the previous sqlite3MemdebugSetType(). -** sqlite3MemdebugHasType() is intended for use inside assert() statements. +** tdsqlite3MemdebugHasType() returns true if any of the bits in its second +** argument match the type set by the previous tdsqlite3MemdebugSetType(). +** tdsqlite3MemdebugHasType() is intended for use inside assert() statements. ** -** sqlite3MemdebugNoType() returns true if none of the bits in its second -** argument match the type set by the previous sqlite3MemdebugSetType(). +** tdsqlite3MemdebugNoType() returns true if none of the bits in its second +** argument match the type set by the previous tdsqlite3MemdebugSetType(). ** ** Perhaps the most important point is the difference between MEMTYPE_HEAP ** and MEMTYPE_LOOKASIDE. If an allocation is MEMTYPE_LOOKASIDE, that means @@ -20162,13 +20162,13 @@ SQLITE_API SQLITE_EXTERN void (SQLITE_CDECL *sqlite3IoTrace)(const char*,...); ** play when the SQLITE_MEMDEBUG compile-time option is used. */ #ifdef SQLITE_MEMDEBUG -SQLITE_PRIVATE void sqlite3MemdebugSetType(void*,u8); -SQLITE_PRIVATE int sqlite3MemdebugHasType(void*,u8); -SQLITE_PRIVATE int sqlite3MemdebugNoType(void*,u8); +SQLITE_PRIVATE void tdsqlite3MemdebugSetType(void*,u8); +SQLITE_PRIVATE int tdsqlite3MemdebugHasType(void*,u8); +SQLITE_PRIVATE int tdsqlite3MemdebugNoType(void*,u8); #else -# define sqlite3MemdebugSetType(X,Y) /* no-op */ -# define sqlite3MemdebugHasType(X,Y) 1 -# define sqlite3MemdebugNoType(X,Y) 1 +# define tdsqlite3MemdebugSetType(X,Y) /* no-op */ +# define tdsqlite3MemdebugHasType(X,Y) 1 +# define tdsqlite3MemdebugNoType(X,Y) 1 #endif #define MEMTYPE_HEAP 0x01 /* General heap allocations */ #define MEMTYPE_LOOKASIDE 0x02 /* Heap that might have been lookaside */ @@ -20178,25 +20178,25 @@ SQLITE_PRIVATE int sqlite3MemdebugNoType(void*,u8); ** Threading interface */ #if SQLITE_MAX_WORKER_THREADS>0 -SQLITE_PRIVATE int sqlite3ThreadCreate(SQLiteThread**,void*(*)(void*),void*); -SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread*, void**); +SQLITE_PRIVATE int tdsqlite3ThreadCreate(SQLiteThread**,void*(*)(void*),void*); +SQLITE_PRIVATE int tdsqlite3ThreadJoin(SQLiteThread*, void**); #endif #if defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST) -SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3*); +SQLITE_PRIVATE int tdsqlite3DbpageRegister(tdsqlite3*); #endif #if defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST) -SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3*); +SQLITE_PRIVATE int tdsqlite3DbstatRegister(tdsqlite3*); #endif -SQLITE_PRIVATE int sqlite3ExprVectorSize(Expr *pExpr); -SQLITE_PRIVATE int sqlite3ExprIsVector(Expr *pExpr); -SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr*, int); -SQLITE_PRIVATE Expr *sqlite3ExprForVectorField(Parse*,Expr*,int); -SQLITE_PRIVATE void sqlite3VectorErrorMsg(Parse*, Expr*); +SQLITE_PRIVATE int tdsqlite3ExprVectorSize(Expr *pExpr); +SQLITE_PRIVATE int tdsqlite3ExprIsVector(Expr *pExpr); +SQLITE_PRIVATE Expr *tdsqlite3VectorFieldSubexpr(Expr*, int); +SQLITE_PRIVATE Expr *tdsqlite3ExprForVectorField(Parse*,Expr*,int); +SQLITE_PRIVATE void tdsqlite3VectorErrorMsg(Parse*, Expr*); #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS -SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt); +SQLITE_PRIVATE const char **tdsqlite3CompileOptions(int *pnOpt); #endif #endif /* SQLITEINT_H */ @@ -20334,7 +20334,7 @@ sqlcipher_provider* sqlcipher_get_provider(void); #define SQLCIPHER_MUTEX_RESERVED3 5 #define SQLCIPHER_MUTEX_COUNT 6 -sqlite3_mutex* sqlcipher_mutex(int); +tdsqlite3_mutex* sqlcipher_mutex(int); #endif #endif @@ -20729,13 +20729,13 @@ struct BtLock { ** they often do so without holding sqlite3.mutex. */ struct Btree { - sqlite3 *db; /* The database connection holding this btree */ + tdsqlite3 *db; /* The database connection holding this btree */ BtShared *pBt; /* Sharable content of this btree */ u8 inTrans; /* TRANS_NONE, TRANS_READ or TRANS_WRITE */ u8 sharable; /* True if we can share pBt with another db */ u8 locked; /* True if db currently has pBt locked */ u8 hasIncrblobCur; /* True if there are one or more Incrblob cursors */ - int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */ + int wantToLock; /* Number of nested calls to tdsqlite3BtreeEnter() */ int nBackup; /* Number of backup operations reading this btree */ u32 iDataVersion; /* Combines with pBt->pPager->iDataVersion */ Btree *pNext; /* List of other sharable Btrees from the same db */ @@ -20793,10 +20793,10 @@ struct Btree { */ struct BtShared { Pager *pPager; /* The page cache */ - sqlite3 *db; /* Database connection currently using this Btree */ + tdsqlite3 *db; /* Database connection currently using this Btree */ BtCursor *pCursor; /* A list of all open cursors */ MemPage *pPage1; /* First page of the database */ - u8 openFlags; /* Flags to sqlite3BtreeOpen() */ + u8 openFlags; /* Flags to tdsqlite3BtreeOpen() */ #ifndef SQLITE_OMIT_AUTOVACUUM u8 autoVacuum; /* True if auto-vacuum is enabled */ u8 incrVacuum; /* True if incr-vacuum is enabled */ @@ -20816,9 +20816,9 @@ struct BtShared { u32 usableSize; /* Number of usable bytes on each page */ int nTransaction; /* Number of open transactions (read + write) */ u32 nPage; /* Number of pages in the database */ - void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */ + void *pSchema; /* Pointer to space allocated by tdsqlite3BtreeSchema() */ void (*xFreeSchema)(void*); /* Destructor for BtShared.pSchema */ - sqlite3_mutex *mutex; /* Non-recursive mutex required to access this object */ + tdsqlite3_mutex *mutex; /* Non-recursive mutex required to access this object */ Bitvec *pHasContent; /* Set of pages moved to free-list this transaction */ #ifndef SQLITE_OMIT_SHARED_CACHE int nRef; /* Number of references to this structure */ @@ -20886,8 +20886,8 @@ struct CellInfo { ** eState Meaning of skipNext ** VALID skipNext is meaningless and is ignored ** INVALID skipNext is meaningless and is ignored -** SKIPNEXT sqlite3BtreeNext() is a no-op if skipNext>0 and -** sqlite3BtreePrevious() is no-op if skipNext<0. +** SKIPNEXT tdsqlite3BtreeNext() is a no-op if skipNext>0 and +** tdsqlite3BtreePrevious() is no-op if skipNext<0. ** REQUIRESEEK restoreCursorPosition() restores the cursor to ** eState=SKIPNEXT if skipNext!=0 ** FAULT skipNext holds the cursor fault error code. @@ -20895,7 +20895,7 @@ struct CellInfo { struct BtCursor { u8 eState; /* One of the CURSOR_XXX constants (see below) */ u8 curFlags; /* zero or more BTCF_* flags defined below */ - u8 curPagerFlags; /* Flags to send to sqlite3PagerGet() */ + u8 curPagerFlags; /* Flags to send to tdsqlite3PagerGet() */ u8 hints; /* As configured by CursorSetHints() */ int skipNext; /* Prev() is noop if negative. Next() is noop if positive. ** Error code if eState==CURSOR_FAULT */ @@ -20903,7 +20903,7 @@ struct BtCursor { Pgno *aOverflow; /* Cache of overflow page locations */ void *pKey; /* Saved key that was cursor last known position */ /* All fields above are zeroed when the cursor is allocated. See - ** sqlite3BtreeCursorZero(). Fields that follow must be manually + ** tdsqlite3BtreeCursorZero(). Fields that follow must be manually ** initialized. */ #define BTCURSOR_FIRST_UNINIT pBt /* Name of first uninitialized field */ BtShared *pBt; /* The BtShared this cursor points to */ @@ -20944,7 +20944,7 @@ struct BtCursor { ** ** CURSOR_SKIPNEXT: ** Cursor is valid except that the Cursor.skipNext field is non-zero -** indicating that the next sqlite3BtreeNext() or sqlite3BtreePrevious() +** indicating that the next tdsqlite3BtreeNext() or tdsqlite3BtreePrevious() ** operation should be a no-op. ** ** CURSOR_REQUIRESEEK: @@ -21073,7 +21073,7 @@ struct IntegrityCk { int v1, v2; /* Values for up to two %d fields in zPfx */ StrAccum errMsg; /* Accumulate the error message text here */ u32 *heap; /* Min-heap used for analyzing cell coverage */ - sqlite3 *db; /* Database connection running the check */ + tdsqlite3 *db; /* Database connection running the check */ }; /* @@ -21081,8 +21081,8 @@ struct IntegrityCk { */ #define get2byte(x) ((x)[0]<<8 | (x)[1]) #define put2byte(p,v) ((p)[0] = (u8)((v)>>8), (p)[1] = (u8)(v)) -#define get4byte sqlite3Get4byte -#define put4byte sqlite3Put4byte +#define get4byte tdsqlite3Get4byte +#define put4byte tdsqlite3Put4byte /* ** get2byteAligned(), unlike get2byte(), requires that its argument point to a @@ -21104,11 +21104,11 @@ struct IntegrityCk { /* #include "pager.h" */ /* extensions defined in pager.c */ -SQLITE_PRIVATE void *sqlite3PagerGetCodec(Pager*); -SQLITE_PRIVATE void sqlite3PagerSetCodec(Pager*, void *(*)(void*,void*,Pgno,int), void (*)(void*,int,int), void (*)(void*), void *); -SQLITE_API int sqlite3pager_is_mj_pgno(Pager*, Pgno); -SQLITE_API void sqlite3pager_error(Pager*, int); -SQLITE_API void sqlite3pager_reset(Pager *pPager); +SQLITE_PRIVATE void *tdsqlite3PagerGetCodec(Pager*); +SQLITE_PRIVATE void tdsqlite3PagerSetCodec(Pager*, void *(*)(void*,void*,Pgno,int), void (*)(void*,int,int), void (*)(void*), void *); +SQLITE_API int tdsqlite3pager_is_mj_pgno(Pager*, Pgno); +SQLITE_API void tdsqlite3pager_error(Pager*, int); +SQLITE_API void tdsqlite3pager_reset(Pager *pPager); #if !defined (SQLCIPHER_CRYPTO_CC) \ && !defined (SQLCIPHER_CRYPTO_LIBTOMCRYPT) \ @@ -21238,7 +21238,7 @@ static void cipher_hex2bin(const unsigned char *hex, int sz, unsigned char *out) static void cipher_bin2hex(const unsigned char* in, int sz, char *out) { int i; for(i=0; i < sz; i++) { - sqlite3_snprintf(3, out + (i*2), "%02x ", in[i]); + tdsqlite3_snprintf(3, out + (i*2), "%02x ", in[i]); } } @@ -21298,10 +21298,10 @@ typedef struct { } codec_ctx ; /* crypto.c functions */ -int sqlcipher_codec_pragma(sqlite3*, int, Parse*, const char *, const char*); -SQLITE_PRIVATE int sqlite3CodecAttach(sqlite3*, int, const void *, int); -SQLITE_PRIVATE void sqlite3CodecGetKey(sqlite3*, int, void**, int*); -void sqlcipher_exportFunc(sqlite3_context *, int, sqlite3_value **); +int sqlcipher_codec_pragma(tdsqlite3*, int, Parse*, const char *, const char*); +SQLITE_PRIVATE int tdsqlite3CodecAttach(tdsqlite3*, int, const void *, int); +SQLITE_PRIVATE void tdsqlite3CodecGetKey(tdsqlite3*, int, void**, int*); +void sqlcipher_exportFunc(tdsqlite3_context *, int, tdsqlite3_value **); /* crypto_impl.c functions */ @@ -21364,7 +21364,7 @@ int sqlcipher_codec_ctx_get_flag(codec_ctx *ctx, unsigned int flag); const char* sqlcipher_codec_get_cipher_provider(codec_ctx *ctx); int sqlcipher_codec_ctx_migrate(codec_ctx *ctx); int sqlcipher_codec_add_random(codec_ctx *ctx, const char *data, int random_sz); -int sqlcipher_cipher_profile(sqlite3 *db, const char *destination); +int sqlcipher_cipher_profile(tdsqlite3 *db, const char *destination); int sqlcipher_codec_get_store_pass(codec_ctx *ctx); void sqlcipher_codec_get_pass(codec_ctx *ctx, void **zKey, int *nKey); void sqlcipher_codec_set_store_pass(codec_ctx *ctx, int value); @@ -21389,7 +21389,7 @@ int sqlcipher_codec_ctx_get_kdf_algorithm(codec_ctx *ctx); void sqlcipher_set_mem_security(int); int sqlcipher_get_mem_security(void); -int sqlcipher_find_db_index(sqlite3 *db, const char *zDb); +int sqlcipher_find_db_index(tdsqlite3 *db, const char *zDb); int sqlcipher_codec_ctx_integrity_check(codec_ctx *, Parse *, char *); @@ -21406,175 +21406,175 @@ int sqlcipher_codec_ctx_integrity_check(codec_ctx *, Parse *, char *); /* Generate code to return a string value */ static void codec_vdbe_return_string(Parse *pParse, const char *zLabel, const char *value, int value_type){ - Vdbe *v = sqlite3GetVdbe(pParse); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLabel, SQLITE_STATIC); - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, value, value_type); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); + Vdbe *v = tdsqlite3GetVdbe(pParse); + tdsqlite3VdbeSetNumCols(v, 1); + tdsqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLabel, SQLITE_STATIC); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, value, value_type); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); } -static int codec_set_btree_to_codec_pagesize(sqlite3 *db, Db *pDb, codec_ctx *ctx) { +static int codec_set_btree_to_codec_pagesize(tdsqlite3 *db, Db *pDb, codec_ctx *ctx) { int rc, page_sz, reserve_sz; page_sz = sqlcipher_codec_ctx_get_pagesize(ctx); reserve_sz = sqlcipher_codec_ctx_get_reservesize(ctx); - CODEC_TRACE("codec_set_btree_to_codec_pagesize: sqlite3BtreeSetPageSize() size=%d reserve=%d\n", page_sz, reserve_sz); + CODEC_TRACE("codec_set_btree_to_codec_pagesize: tdsqlite3BtreeSetPageSize() size=%d reserve=%d\n", page_sz, reserve_sz); CODEC_TRACE_MUTEX("codec_set_btree_to_codec_pagesize: entering database mutex %p\n", db->mutex); - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); CODEC_TRACE_MUTEX("codec_set_btree_to_codec_pagesize: entered database mutex %p\n", db->mutex); db->nextPagesize = page_sz; /* before forcing the page size we need to unset the BTS_PAGESIZE_FIXED flag, else sqliteBtreeSetPageSize will block the change */ pDb->pBt->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED; - rc = sqlite3BtreeSetPageSize(pDb->pBt, page_sz, reserve_sz, 0); + rc = tdsqlite3BtreeSetPageSize(pDb->pBt, page_sz, reserve_sz, 0); - CODEC_TRACE("codec_set_btree_to_codec_pagesize: sqlite3BtreeSetPageSize returned %d\n", rc); + CODEC_TRACE("codec_set_btree_to_codec_pagesize: tdsqlite3BtreeSetPageSize returned %d\n", rc); CODEC_TRACE_MUTEX("codec_set_btree_to_codec_pagesize: leaving database mutex %p\n", db->mutex); - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); CODEC_TRACE_MUTEX("codec_set_btree_to_codec_pagesize: left database mutex %p\n", db->mutex); return rc; } -static int codec_set_pass_key(sqlite3* db, int nDb, const void *zKey, int nKey, int for_ctx) { +static int codec_set_pass_key(tdsqlite3* db, int nDb, const void *zKey, int nKey, int for_ctx) { struct Db *pDb = &db->aDb[nDb]; CODEC_TRACE("codec_set_pass_key: entered db=%p nDb=%d zKey=%s nKey=%d for_ctx=%d\n", db, nDb, (char *)zKey, nKey, for_ctx); if(pDb->pBt) { - codec_ctx *ctx = (codec_ctx*) sqlite3PagerGetCodec(pDb->pBt->pBt->pPager); + codec_ctx *ctx = (codec_ctx*) tdsqlite3PagerGetCodec(pDb->pBt->pBt->pPager); if(ctx) return sqlcipher_codec_ctx_set_pass(ctx, zKey, nKey, for_ctx); } return SQLITE_ERROR; } -int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLeft, const char *zRight) { +int sqlcipher_codec_pragma(tdsqlite3* db, int iDb, Parse *pParse, const char *zLeft, const char *zRight) { struct Db *pDb = &db->aDb[iDb]; codec_ctx *ctx = NULL; int rc; if(pDb->pBt) { - ctx = (codec_ctx*) sqlite3PagerGetCodec(pDb->pBt->pBt->pPager); + ctx = (codec_ctx*) tdsqlite3PagerGetCodec(pDb->pBt->pBt->pPager); } CODEC_TRACE("sqlcipher_codec_pragma: entered db=%p iDb=%d pParse=%p zLeft=%s zRight=%s ctx=%p\n", db, iDb, pParse, zLeft, zRight, ctx); #ifdef SQLCIPHER_EXT - if( sqlite3StrICmp(zLeft, "cipher_license")==0 && zRight ){ - char *license_result = sqlite3_mprintf("%d", sqlcipher_license_key(zRight)); + if( tdsqlite3StrICmp(zLeft, "cipher_license")==0 && zRight ){ + char *license_result = tdsqlite3_mprintf("%d", sqlcipher_license_key(zRight)); codec_vdbe_return_string(pParse, "cipher_license", license_result, P4_DYNAMIC); } else - if( sqlite3StrICmp(zLeft, "cipher_license")==0 && !zRight ){ + if( tdsqlite3StrICmp(zLeft, "cipher_license")==0 && !zRight ){ if(ctx) { - char *license_result = sqlite3_mprintf("%d", ctx + char *license_result = tdsqlite3_mprintf("%d", ctx ? sqlcipher_license_key_status(ctx->provider) : SQLITE_ERROR); codec_vdbe_return_string(pParse, "cipher_license", license_result, P4_DYNAMIC); } } else #endif - if( sqlite3StrICmp(zLeft, "cipher_fips_status")== 0 && !zRight ){ + if( tdsqlite3StrICmp(zLeft, "cipher_fips_status")== 0 && !zRight ){ if(ctx) { - char *fips_mode_status = sqlite3_mprintf("%d", sqlcipher_codec_fips_status(ctx)); + char *fips_mode_status = tdsqlite3_mprintf("%d", sqlcipher_codec_fips_status(ctx)); codec_vdbe_return_string(pParse, "cipher_fips_status", fips_mode_status, P4_DYNAMIC); } } else - if( sqlite3StrICmp(zLeft, "cipher_store_pass")==0 && zRight ) { + if( tdsqlite3StrICmp(zLeft, "cipher_store_pass")==0 && zRight ) { if(ctx) { - sqlcipher_codec_set_store_pass(ctx, sqlite3GetBoolean(zRight, 1)); + sqlcipher_codec_set_store_pass(ctx, tdsqlite3GetBoolean(zRight, 1)); } } else - if( sqlite3StrICmp(zLeft, "cipher_store_pass")==0 && !zRight ) { + if( tdsqlite3StrICmp(zLeft, "cipher_store_pass")==0 && !zRight ) { if(ctx){ - char *store_pass_value = sqlite3_mprintf("%d", sqlcipher_codec_get_store_pass(ctx)); + char *store_pass_value = tdsqlite3_mprintf("%d", sqlcipher_codec_get_store_pass(ctx)); codec_vdbe_return_string(pParse, "cipher_store_pass", store_pass_value, P4_DYNAMIC); } } - if( sqlite3StrICmp(zLeft, "cipher_profile")== 0 && zRight ){ - char *profile_status = sqlite3_mprintf("%d", sqlcipher_cipher_profile(db, zRight)); + if( tdsqlite3StrICmp(zLeft, "cipher_profile")== 0 && zRight ){ + char *profile_status = tdsqlite3_mprintf("%d", sqlcipher_cipher_profile(db, zRight)); codec_vdbe_return_string(pParse, "cipher_profile", profile_status, P4_DYNAMIC); } else - if( sqlite3StrICmp(zLeft, "cipher_add_random")==0 && zRight ){ + if( tdsqlite3StrICmp(zLeft, "cipher_add_random")==0 && zRight ){ if(ctx) { - char *add_random_status = sqlite3_mprintf("%d", sqlcipher_codec_add_random(ctx, zRight, sqlite3Strlen30(zRight))); + char *add_random_status = tdsqlite3_mprintf("%d", sqlcipher_codec_add_random(ctx, zRight, tdsqlite3Strlen30(zRight))); codec_vdbe_return_string(pParse, "cipher_add_random", add_random_status, P4_DYNAMIC); } } else - if( sqlite3StrICmp(zLeft, "cipher_migrate")==0 && !zRight ){ + if( tdsqlite3StrICmp(zLeft, "cipher_migrate")==0 && !zRight ){ if(ctx){ - char *migrate_status = sqlite3_mprintf("%d", sqlcipher_codec_ctx_migrate(ctx)); + char *migrate_status = tdsqlite3_mprintf("%d", sqlcipher_codec_ctx_migrate(ctx)); codec_vdbe_return_string(pParse, "cipher_migrate", migrate_status, P4_DYNAMIC); } } else - if( sqlite3StrICmp(zLeft, "cipher_provider")==0 && !zRight ){ + if( tdsqlite3StrICmp(zLeft, "cipher_provider")==0 && !zRight ){ if(ctx) { codec_vdbe_return_string(pParse, "cipher_provider", sqlcipher_codec_get_cipher_provider(ctx), P4_TRANSIENT); } } else - if( sqlite3StrICmp(zLeft, "cipher_provider_version")==0 && !zRight){ + if( tdsqlite3StrICmp(zLeft, "cipher_provider_version")==0 && !zRight){ if(ctx) { codec_vdbe_return_string(pParse, "cipher_provider_version", sqlcipher_codec_get_provider_version(ctx), P4_TRANSIENT); } } else - if( sqlite3StrICmp(zLeft, "cipher_version")==0 && !zRight ){ + if( tdsqlite3StrICmp(zLeft, "cipher_version")==0 && !zRight ){ codec_vdbe_return_string(pParse, "cipher_version", sqlcipher_version(), P4_DYNAMIC); }else - if( sqlite3StrICmp(zLeft, "cipher")==0 ){ + if( tdsqlite3StrICmp(zLeft, "cipher")==0 ){ if(ctx) { if( zRight ) { const char* message = "PRAGMA cipher is no longer supported."; codec_vdbe_return_string(pParse, "cipher", message, P4_TRANSIENT); - sqlite3_log(SQLITE_WARNING, message); + tdsqlite3_log(SQLITE_WARNING, message); }else { codec_vdbe_return_string(pParse, "cipher", sqlcipher_codec_ctx_get_cipher(ctx), P4_TRANSIENT); } } }else - if( sqlite3StrICmp(zLeft, "rekey_cipher")==0 && zRight ){ + if( tdsqlite3StrICmp(zLeft, "rekey_cipher")==0 && zRight ){ const char* message = "PRAGMA rekey_cipher is no longer supported."; codec_vdbe_return_string(pParse, "rekey_cipher", message, P4_TRANSIENT); - sqlite3_log(SQLITE_WARNING, message); + tdsqlite3_log(SQLITE_WARNING, message); }else - if( sqlite3StrICmp(zLeft,"cipher_default_kdf_iter")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_default_kdf_iter")==0 ){ if( zRight ) { sqlcipher_set_default_kdf_iter(atoi(zRight)); /* change default KDF iterations */ } else { - char *kdf_iter = sqlite3_mprintf("%d", sqlcipher_get_default_kdf_iter()); + char *kdf_iter = tdsqlite3_mprintf("%d", sqlcipher_get_default_kdf_iter()); codec_vdbe_return_string(pParse, "cipher_default_kdf_iter", kdf_iter, P4_DYNAMIC); } }else - if( sqlite3StrICmp(zLeft, "kdf_iter")==0 ){ + if( tdsqlite3StrICmp(zLeft, "kdf_iter")==0 ){ if(ctx) { if( zRight ) { sqlcipher_codec_ctx_set_kdf_iter(ctx, atoi(zRight)); /* change of RW PBKDF2 iteration */ } else { - char *kdf_iter = sqlite3_mprintf("%d", sqlcipher_codec_ctx_get_kdf_iter(ctx)); + char *kdf_iter = tdsqlite3_mprintf("%d", sqlcipher_codec_ctx_get_kdf_iter(ctx)); codec_vdbe_return_string(pParse, "kdf_iter", kdf_iter, P4_DYNAMIC); } } }else - if( sqlite3StrICmp(zLeft, "fast_kdf_iter")==0){ + if( tdsqlite3StrICmp(zLeft, "fast_kdf_iter")==0){ if(ctx) { if( zRight ) { char *deprecation = "PRAGMA fast_kdf_iter is deprecated, please remove from use"; sqlcipher_codec_ctx_set_fast_kdf_iter(ctx, atoi(zRight)); /* change of RW PBKDF2 iteration */ codec_vdbe_return_string(pParse, "fast_kdf_iter", deprecation, P4_TRANSIENT); - sqlite3_log(SQLITE_WARNING, deprecation); + tdsqlite3_log(SQLITE_WARNING, deprecation); } else { - char *fast_kdf_iter = sqlite3_mprintf("%d", sqlcipher_codec_ctx_get_fast_kdf_iter(ctx)); + char *fast_kdf_iter = tdsqlite3_mprintf("%d", sqlcipher_codec_ctx_get_fast_kdf_iter(ctx)); codec_vdbe_return_string(pParse, "fast_kdf_iter", fast_kdf_iter, P4_DYNAMIC); } } }else - if( sqlite3StrICmp(zLeft, "rekey_kdf_iter")==0 && zRight ){ + if( tdsqlite3StrICmp(zLeft, "rekey_kdf_iter")==0 && zRight ){ const char* message = "PRAGMA rekey_kdf_iter is no longer supported."; codec_vdbe_return_string(pParse, "rekey_kdf_iter", message, P4_TRANSIENT); - sqlite3_log(SQLITE_WARNING, message); + tdsqlite3_log(SQLITE_WARNING, message); }else - if( sqlite3StrICmp(zLeft,"cipher_page_size")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_page_size")==0 ){ if(ctx) { if( zRight ) { int size = atoi(zRight); @@ -21583,58 +21583,58 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef rc = codec_set_btree_to_codec_pagesize(db, pDb, ctx); if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc); } else { - char * page_size = sqlite3_mprintf("%d", sqlcipher_codec_ctx_get_pagesize(ctx)); + char * page_size = tdsqlite3_mprintf("%d", sqlcipher_codec_ctx_get_pagesize(ctx)); codec_vdbe_return_string(pParse, "cipher_page_size", page_size, P4_DYNAMIC); } } }else - if( sqlite3StrICmp(zLeft,"cipher_default_page_size")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_default_page_size")==0 ){ if( zRight ) { sqlcipher_set_default_pagesize(atoi(zRight)); } else { - char *default_page_size = sqlite3_mprintf("%d", sqlcipher_get_default_pagesize()); + char *default_page_size = tdsqlite3_mprintf("%d", sqlcipher_get_default_pagesize()); codec_vdbe_return_string(pParse, "cipher_default_page_size", default_page_size, P4_DYNAMIC); } }else - if( sqlite3StrICmp(zLeft,"cipher_default_use_hmac")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_default_use_hmac")==0 ){ if( zRight ) { - sqlcipher_set_default_use_hmac(sqlite3GetBoolean(zRight,1)); + sqlcipher_set_default_use_hmac(tdsqlite3GetBoolean(zRight,1)); } else { - char *default_use_hmac = sqlite3_mprintf("%d", sqlcipher_get_default_use_hmac()); + char *default_use_hmac = tdsqlite3_mprintf("%d", sqlcipher_get_default_use_hmac()); codec_vdbe_return_string(pParse, "cipher_default_use_hmac", default_use_hmac, P4_DYNAMIC); } }else - if( sqlite3StrICmp(zLeft,"cipher_use_hmac")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_use_hmac")==0 ){ if(ctx) { if( zRight ) { - rc = sqlcipher_codec_ctx_set_use_hmac(ctx, sqlite3GetBoolean(zRight,1)); + rc = sqlcipher_codec_ctx_set_use_hmac(ctx, tdsqlite3GetBoolean(zRight,1)); if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc); /* since the use of hmac has changed, the page size may also change */ rc = codec_set_btree_to_codec_pagesize(db, pDb, ctx); if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc); } else { - char *hmac_flag = sqlite3_mprintf("%d", sqlcipher_codec_ctx_get_use_hmac(ctx)); + char *hmac_flag = tdsqlite3_mprintf("%d", sqlcipher_codec_ctx_get_use_hmac(ctx)); codec_vdbe_return_string(pParse, "cipher_use_hmac", hmac_flag, P4_DYNAMIC); } } }else - if( sqlite3StrICmp(zLeft,"cipher_hmac_pgno")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_hmac_pgno")==0 ){ if(ctx) { if(zRight) { char *deprecation = "PRAGMA cipher_hmac_pgno is deprecated, please remove from use"; /* clear both pgno endian flags */ - if(sqlite3StrICmp(zRight, "le") == 0) { + if(tdsqlite3StrICmp(zRight, "le") == 0) { sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_BE_PGNO); sqlcipher_codec_ctx_set_flag(ctx, CIPHER_FLAG_LE_PGNO); - } else if(sqlite3StrICmp(zRight, "be") == 0) { + } else if(tdsqlite3StrICmp(zRight, "be") == 0) { sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_LE_PGNO); sqlcipher_codec_ctx_set_flag(ctx, CIPHER_FLAG_BE_PGNO); - } else if(sqlite3StrICmp(zRight, "native") == 0) { + } else if(tdsqlite3StrICmp(zRight, "native") == 0) { sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_LE_PGNO); sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_BE_PGNO); } codec_vdbe_return_string(pParse, "cipher_hmac_pgno", deprecation, P4_TRANSIENT); - sqlite3_log(SQLITE_WARNING, deprecation); + tdsqlite3_log(SQLITE_WARNING, deprecation); } else { if(sqlcipher_codec_ctx_get_flag(ctx, CIPHER_FLAG_LE_PGNO)) { @@ -21647,77 +21647,77 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef } } }else - if( sqlite3StrICmp(zLeft,"cipher_hmac_salt_mask")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_hmac_salt_mask")==0 ){ if(ctx) { if(zRight) { char *deprecation = "PRAGMA cipher_hmac_salt_mask is deprecated, please remove from use"; - if (sqlite3StrNICmp(zRight ,"x'", 2) == 0 && sqlite3Strlen30(zRight) == 5) { + if (tdsqlite3StrNICmp(zRight ,"x'", 2) == 0 && tdsqlite3Strlen30(zRight) == 5) { unsigned char mask = 0; const unsigned char *hex = (const unsigned char *)zRight+2; cipher_hex2bin(hex,2,&mask); sqlcipher_set_hmac_salt_mask(mask); } codec_vdbe_return_string(pParse, "cipher_hmac_salt_mask", deprecation, P4_TRANSIENT); - sqlite3_log(SQLITE_WARNING, deprecation); + tdsqlite3_log(SQLITE_WARNING, deprecation); } else { - char *hmac_salt_mask = sqlite3_mprintf("%02x", sqlcipher_get_hmac_salt_mask()); + char *hmac_salt_mask = tdsqlite3_mprintf("%02x", sqlcipher_get_hmac_salt_mask()); codec_vdbe_return_string(pParse, "cipher_hmac_salt_mask", hmac_salt_mask, P4_DYNAMIC); } } }else - if( sqlite3StrICmp(zLeft,"cipher_plaintext_header_size")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_plaintext_header_size")==0 ){ if(ctx) { if( zRight ) { int size = atoi(zRight); if((rc = sqlcipher_codec_ctx_set_plaintext_header_size(ctx, size)) != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR); } else { - char *size = sqlite3_mprintf("%d", sqlcipher_codec_ctx_get_plaintext_header_size(ctx)); + char *size = tdsqlite3_mprintf("%d", sqlcipher_codec_ctx_get_plaintext_header_size(ctx)); codec_vdbe_return_string(pParse, "cipher_plaintext_header_size", size, P4_DYNAMIC); } } }else - if( sqlite3StrICmp(zLeft,"cipher_default_plaintext_header_size")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_default_plaintext_header_size")==0 ){ if( zRight ) { sqlcipher_set_default_plaintext_header_size(atoi(zRight)); } else { - char *size = sqlite3_mprintf("%d", sqlcipher_get_default_plaintext_header_size()); + char *size = tdsqlite3_mprintf("%d", sqlcipher_get_default_plaintext_header_size()); codec_vdbe_return_string(pParse, "cipher_default_plaintext_header_size", size, P4_DYNAMIC); - sqlite3_free(size); + tdsqlite3_free(size); } }else - if( sqlite3StrICmp(zLeft,"cipher_salt")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_salt")==0 ){ if(ctx) { if(zRight) { - if (sqlite3StrNICmp(zRight ,"x'", 2) == 0 && sqlite3Strlen30(zRight) == (FILE_HEADER_SZ*2)+3) { - unsigned char *salt = (unsigned char*) sqlite3_malloc(FILE_HEADER_SZ); + if (tdsqlite3StrNICmp(zRight ,"x'", 2) == 0 && tdsqlite3Strlen30(zRight) == (FILE_HEADER_SZ*2)+3) { + unsigned char *salt = (unsigned char*) tdsqlite3_malloc(FILE_HEADER_SZ); const unsigned char *hex = (const unsigned char *)zRight+2; cipher_hex2bin(hex,FILE_HEADER_SZ*2,salt); sqlcipher_codec_ctx_set_kdf_salt(ctx, salt, FILE_HEADER_SZ); - sqlite3_free(salt); + tdsqlite3_free(salt); } } else { void *salt; - char *hexsalt = (char*) sqlite3_malloc((FILE_HEADER_SZ*2)+1); + char *hexsalt = (char*) tdsqlite3_malloc((FILE_HEADER_SZ*2)+1); if((rc = sqlcipher_codec_ctx_get_kdf_salt(ctx, &salt)) == SQLITE_OK) { cipher_bin2hex(salt, FILE_HEADER_SZ, hexsalt); codec_vdbe_return_string(pParse, "cipher_salt", hexsalt, P4_DYNAMIC); } else { - sqlite3_free(hexsalt); + tdsqlite3_free(hexsalt); sqlcipher_codec_ctx_set_error(ctx, rc); } } } }else - if( sqlite3StrICmp(zLeft,"cipher_hmac_algorithm")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_hmac_algorithm")==0 ){ if(ctx) { if(zRight) { rc = SQLITE_ERROR; - if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA1_LABEL) == 0) { + if(tdsqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA1_LABEL) == 0) { rc = sqlcipher_codec_ctx_set_hmac_algorithm(ctx, SQLCIPHER_HMAC_SHA1); - } else if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA256_LABEL) == 0) { + } else if(tdsqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA256_LABEL) == 0) { rc = sqlcipher_codec_ctx_set_hmac_algorithm(ctx, SQLCIPHER_HMAC_SHA256); - } else if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA512_LABEL) == 0) { + } else if(tdsqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA512_LABEL) == 0) { rc = sqlcipher_codec_ctx_set_hmac_algorithm(ctx, SQLCIPHER_HMAC_SHA512); } if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR); @@ -21735,14 +21735,14 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef } } }else - if( sqlite3StrICmp(zLeft,"cipher_default_hmac_algorithm")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_default_hmac_algorithm")==0 ){ if(zRight) { rc = SQLITE_ERROR; - if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA1_LABEL) == 0) { + if(tdsqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA1_LABEL) == 0) { rc = sqlcipher_set_default_hmac_algorithm(SQLCIPHER_HMAC_SHA1); - } else if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA256_LABEL) == 0) { + } else if(tdsqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA256_LABEL) == 0) { rc = sqlcipher_set_default_hmac_algorithm(SQLCIPHER_HMAC_SHA256); - } else if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA512_LABEL) == 0) { + } else if(tdsqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA512_LABEL) == 0) { rc = sqlcipher_set_default_hmac_algorithm(SQLCIPHER_HMAC_SHA512); } } else { @@ -21756,15 +21756,15 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef } } }else - if( sqlite3StrICmp(zLeft,"cipher_kdf_algorithm")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_kdf_algorithm")==0 ){ if(ctx) { if(zRight) { rc = SQLITE_ERROR; - if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL) == 0) { + if(tdsqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL) == 0) { rc = sqlcipher_codec_ctx_set_kdf_algorithm(ctx, SQLCIPHER_PBKDF2_HMAC_SHA1); - } else if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL) == 0) { + } else if(tdsqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL) == 0) { rc = sqlcipher_codec_ctx_set_kdf_algorithm(ctx, SQLCIPHER_PBKDF2_HMAC_SHA256); - } else if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL) == 0) { + } else if(tdsqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL) == 0) { rc = sqlcipher_codec_ctx_set_kdf_algorithm(ctx, SQLCIPHER_PBKDF2_HMAC_SHA512); } if (rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, SQLITE_ERROR); @@ -21780,14 +21780,14 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef } } }else - if( sqlite3StrICmp(zLeft,"cipher_default_kdf_algorithm")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_default_kdf_algorithm")==0 ){ if(zRight) { rc = SQLITE_ERROR; - if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL) == 0) { + if(tdsqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL) == 0) { rc = sqlcipher_set_default_kdf_algorithm(SQLCIPHER_PBKDF2_HMAC_SHA1); - } else if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL) == 0) { + } else if(tdsqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL) == 0) { rc = sqlcipher_set_default_kdf_algorithm(SQLCIPHER_PBKDF2_HMAC_SHA256); - } else if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL) == 0) { + } else if(tdsqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL) == 0) { rc = sqlcipher_set_default_kdf_algorithm(SQLCIPHER_PBKDF2_HMAC_SHA512); } } else { @@ -21801,7 +21801,7 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef } } }else - if( sqlite3StrICmp(zLeft,"cipher_compatibility")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_compatibility")==0 ){ if(ctx) { if(zRight) { int version = atoi(zRight); @@ -21865,7 +21865,7 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef } } }else - if( sqlite3StrICmp(zLeft,"cipher_default_compatibility")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_default_compatibility")==0 ){ if(zRight) { int version = atoi(zRight); switch(version) { @@ -21903,94 +21903,94 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef } } }else - if( sqlite3StrICmp(zLeft,"cipher_memory_security")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_memory_security")==0 ){ if( zRight ) { - sqlcipher_set_mem_security(sqlite3GetBoolean(zRight,1)); + sqlcipher_set_mem_security(tdsqlite3GetBoolean(zRight,1)); } else { - char *on = sqlite3_mprintf("%d", sqlcipher_get_mem_security()); + char *on = tdsqlite3_mprintf("%d", sqlcipher_get_mem_security()); codec_vdbe_return_string(pParse, "cipher_memory_security", on, P4_DYNAMIC); } }else - if( sqlite3StrICmp(zLeft,"cipher_settings")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_settings")==0 ){ if(ctx) { int algorithm; char *pragma; - pragma = sqlite3_mprintf("PRAGMA kdf_iter = %d;", sqlcipher_codec_ctx_get_kdf_iter(ctx)); + pragma = tdsqlite3_mprintf("PRAGMA kdf_iter = %d;", sqlcipher_codec_ctx_get_kdf_iter(ctx)); codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC); - pragma = sqlite3_mprintf("PRAGMA cipher_page_size = %d;", sqlcipher_codec_ctx_get_pagesize(ctx)); + pragma = tdsqlite3_mprintf("PRAGMA cipher_page_size = %d;", sqlcipher_codec_ctx_get_pagesize(ctx)); codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC); - pragma = sqlite3_mprintf("PRAGMA cipher_use_hmac = %d;", sqlcipher_codec_ctx_get_use_hmac(ctx)); + pragma = tdsqlite3_mprintf("PRAGMA cipher_use_hmac = %d;", sqlcipher_codec_ctx_get_use_hmac(ctx)); codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC); - pragma = sqlite3_mprintf("PRAGMA cipher_plaintext_header_size = %d;", sqlcipher_codec_ctx_get_plaintext_header_size(ctx)); + pragma = tdsqlite3_mprintf("PRAGMA cipher_plaintext_header_size = %d;", sqlcipher_codec_ctx_get_plaintext_header_size(ctx)); codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC); algorithm = sqlcipher_codec_ctx_get_hmac_algorithm(ctx); pragma = NULL; if(algorithm == SQLCIPHER_HMAC_SHA1) { - pragma = sqlite3_mprintf("PRAGMA cipher_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA1_LABEL); + pragma = tdsqlite3_mprintf("PRAGMA cipher_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA1_LABEL); } else if(algorithm == SQLCIPHER_HMAC_SHA256) { - pragma = sqlite3_mprintf("PRAGMA cipher_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA256_LABEL); + pragma = tdsqlite3_mprintf("PRAGMA cipher_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA256_LABEL); } else if(algorithm == SQLCIPHER_HMAC_SHA512) { - pragma = sqlite3_mprintf("PRAGMA cipher_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA512_LABEL); + pragma = tdsqlite3_mprintf("PRAGMA cipher_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA512_LABEL); } codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC); algorithm = sqlcipher_codec_ctx_get_kdf_algorithm(ctx); pragma = NULL; if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA1) { - pragma = sqlite3_mprintf("PRAGMA cipher_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL); + pragma = tdsqlite3_mprintf("PRAGMA cipher_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL); } else if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA256) { - pragma = sqlite3_mprintf("PRAGMA cipher_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL); + pragma = tdsqlite3_mprintf("PRAGMA cipher_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL); } else if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA512) { - pragma = sqlite3_mprintf("PRAGMA cipher_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL); + pragma = tdsqlite3_mprintf("PRAGMA cipher_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL); } codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC); } }else - if( sqlite3StrICmp(zLeft,"cipher_default_settings")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_default_settings")==0 ){ int algorithm; char *pragma; - pragma = sqlite3_mprintf("PRAGMA cipher_default_kdf_iter = %d;", sqlcipher_get_default_kdf_iter()); + pragma = tdsqlite3_mprintf("PRAGMA cipher_default_kdf_iter = %d;", sqlcipher_get_default_kdf_iter()); codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC); - pragma = sqlite3_mprintf("PRAGMA cipher_default_page_size = %d;", sqlcipher_get_default_pagesize()); + pragma = tdsqlite3_mprintf("PRAGMA cipher_default_page_size = %d;", sqlcipher_get_default_pagesize()); codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC); - pragma = sqlite3_mprintf("PRAGMA cipher_default_use_hmac = %d;", sqlcipher_get_default_use_hmac()); + pragma = tdsqlite3_mprintf("PRAGMA cipher_default_use_hmac = %d;", sqlcipher_get_default_use_hmac()); codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC); - pragma = sqlite3_mprintf("PRAGMA cipher_default_plaintext_header_size = %d;", sqlcipher_get_default_plaintext_header_size()); + pragma = tdsqlite3_mprintf("PRAGMA cipher_default_plaintext_header_size = %d;", sqlcipher_get_default_plaintext_header_size()); codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC); algorithm = sqlcipher_get_default_hmac_algorithm(); pragma = NULL; if(algorithm == SQLCIPHER_HMAC_SHA1) { - pragma = sqlite3_mprintf("PRAGMA cipher_default_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA1_LABEL); + pragma = tdsqlite3_mprintf("PRAGMA cipher_default_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA1_LABEL); } else if(algorithm == SQLCIPHER_HMAC_SHA256) { - pragma = sqlite3_mprintf("PRAGMA cipher_default_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA256_LABEL); + pragma = tdsqlite3_mprintf("PRAGMA cipher_default_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA256_LABEL); } else if(algorithm == SQLCIPHER_HMAC_SHA512) { - pragma = sqlite3_mprintf("PRAGMA cipher_default_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA512_LABEL); + pragma = tdsqlite3_mprintf("PRAGMA cipher_default_hmac_algorithm = %s;", SQLCIPHER_HMAC_SHA512_LABEL); } codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC); algorithm = sqlcipher_get_default_kdf_algorithm(); pragma = NULL; if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA1) { - pragma = sqlite3_mprintf("PRAGMA cipher_default_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL); + pragma = tdsqlite3_mprintf("PRAGMA cipher_default_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL); } else if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA256) { - pragma = sqlite3_mprintf("PRAGMA cipher_default_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL); + pragma = tdsqlite3_mprintf("PRAGMA cipher_default_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL); } else if(algorithm == SQLCIPHER_PBKDF2_HMAC_SHA512) { - pragma = sqlite3_mprintf("PRAGMA cipher_default_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL); + pragma = tdsqlite3_mprintf("PRAGMA cipher_default_kdf_algorithm = %s;", SQLCIPHER_PBKDF2_HMAC_SHA512_LABEL); } codec_vdbe_return_string(pParse, "pragma", pragma, P4_DYNAMIC); }else - if( sqlite3StrICmp(zLeft,"cipher_integrity_check")==0 ){ + if( tdsqlite3StrICmp(zLeft,"cipher_integrity_check")==0 ){ if(ctx) { sqlcipher_codec_ctx_integrity_check(ctx, pParse, "cipher_integrity_check"); } @@ -22010,13 +22010,13 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef #define CODEC_JOURNAL_OP 7 /* - * sqlite3Codec can be called in multiple modes. + * tdsqlite3Codec can be called in multiple modes. * encrypt mode - expected to return a pointer to the * encrypted data without altering pData. * decrypt mode - expected to return a pointer to pData, with * the data decrypted in the input buffer */ -static void* sqlite3Codec(void *iCtx, void *data, Pgno pgno, int mode) { +static void* tdsqlite3Codec(void *iCtx, void *data, Pgno pgno, int mode) { codec_ctx *ctx = (codec_ctx *) iCtx; int offset = 0, rc = 0; int page_sz = sqlcipher_codec_ctx_get_pagesize(ctx); @@ -22025,7 +22025,7 @@ static void* sqlite3Codec(void *iCtx, void *data, Pgno pgno, int mode) { int plaintext_header_sz = sqlcipher_codec_ctx_get_plaintext_header_size(ctx); int cctx = CIPHER_READ_CTX; - CODEC_TRACE("sqlite3Codec: entered pgno=%d, mode=%d, page_sz=%d\n", pgno, mode, page_sz); + CODEC_TRACE("tdsqlite3Codec: entered pgno=%d, mode=%d, page_sz=%d\n", pgno, mode, page_sz); #ifdef SQLCIPHER_EXT if(sqlcipher_license_check(ctx) != SQLITE_OK) return NULL; @@ -22041,7 +22041,7 @@ static void* sqlite3Codec(void *iCtx, void *data, Pgno pgno, int mode) { offset = plaintext_header_sz ? plaintext_header_sz : FILE_HEADER_SZ; - CODEC_TRACE("sqlite3Codec: switch mode=%d offset=%d\n", mode, offset); + CODEC_TRACE("tdsqlite3Codec: switch mode=%d offset=%d\n", mode, offset); switch(mode) { case CODEC_READ_OP: /* decrypt */ if(pgno == 1) /* copy initial part of file header or SQLite magic to buffer */ @@ -22084,86 +22084,86 @@ static void* sqlite3Codec(void *iCtx, void *data, Pgno pgno, int mode) { } } -static void sqlite3FreeCodecArg(void *pCodecArg) { +static void tdsqlite3FreeCodecArg(void *pCodecArg) { codec_ctx *ctx = (codec_ctx *) pCodecArg; if(pCodecArg == NULL) return; sqlcipher_codec_ctx_free(&ctx); /* wipe and free allocated memory for the context */ sqlcipher_deactivate(); /* cleanup related structures, OpenSSL etc, when codec is detatched */ } -SQLITE_PRIVATE int sqlite3CodecAttach(sqlite3* db, int nDb, const void *zKey, int nKey) { +SQLITE_PRIVATE int tdsqlite3CodecAttach(tdsqlite3* db, int nDb, const void *zKey, int nKey) { struct Db *pDb = &db->aDb[nDb]; - CODEC_TRACE("sqlite3CodecAttach: entered db=%p, nDb=%d zKey=%s, nKey=%d\n", db, nDb, (char *)zKey, nKey); + CODEC_TRACE("tdsqlite3CodecAttach: entered db=%p, nDb=%d zKey=%s, nKey=%d\n", db, nDb, (char *)zKey, nKey); if(nKey && zKey && pDb->pBt) { int rc; Pager *pPager = pDb->pBt->pBt->pPager; - sqlite3_file *fd; + tdsqlite3_file *fd; codec_ctx *ctx; - /* check if the sqlite3_file is open, and if not force handle to NULL */ - if((fd = sqlite3PagerFile(pPager))->pMethods == 0) fd = NULL; + /* check if the tdsqlite3_file is open, and if not force handle to NULL */ + if((fd = tdsqlite3PagerFile(pPager))->pMethods == 0) fd = NULL; - CODEC_TRACE("sqlite3CodecAttach: calling sqlcipher_activate()\n"); + CODEC_TRACE("tdsqlite3CodecAttach: calling sqlcipher_activate()\n"); sqlcipher_activate(); /* perform internal initialization for sqlcipher */ - CODEC_TRACE_MUTEX("sqlite3CodecAttach: entering database mutex %p\n", db->mutex); - sqlite3_mutex_enter(db->mutex); - CODEC_TRACE_MUTEX("sqlite3CodecAttach: entered database mutex %p\n", db->mutex); + CODEC_TRACE_MUTEX("tdsqlite3CodecAttach: entering database mutex %p\n", db->mutex); + tdsqlite3_mutex_enter(db->mutex); + CODEC_TRACE_MUTEX("tdsqlite3CodecAttach: entered database mutex %p\n", db->mutex); #ifdef SQLCIPHER_EXT - if((rc = sqlite3_set_authorizer(db, sqlcipher_license_authorizer, db)) != SQLITE_OK) { - sqlite3_mutex_leave(db->mutex); + if((rc = tdsqlite3_set_authorizer(db, sqlcipher_license_authorizer, db)) != SQLITE_OK) { + tdsqlite3_mutex_leave(db->mutex); return rc; } #endif /* point the internal codec argument against the contet to be prepared */ - CODEC_TRACE("sqlite3CodecAttach: calling sqlcipher_codec_ctx_init()\n"); + CODEC_TRACE("tdsqlite3CodecAttach: calling sqlcipher_codec_ctx_init()\n"); rc = sqlcipher_codec_ctx_init(&ctx, pDb, pDb->pBt->pBt->pPager, zKey, nKey); if(rc != SQLITE_OK) { /* initialization failed, do not attach potentially corrupted context */ - CODEC_TRACE("sqlite3CodecAttach: context initialization failed with rc=%d\n", rc); + CODEC_TRACE("tdsqlite3CodecAttach: context initialization failed with rc=%d\n", rc); /* force an error at the pager level, such that even the upstream caller ignores the return code the pager will be in an error state and will process no further operations */ - sqlite3pager_error(pPager, rc); + tdsqlite3pager_error(pPager, rc); pDb->pBt->pBt->db->errCode = rc; - CODEC_TRACE_MUTEX("sqlite3CodecAttach: leaving database mutex %p (early return on rc=%d)\n", db->mutex, rc); - sqlite3_mutex_leave(db->mutex); - CODEC_TRACE_MUTEX("sqlite3CodecAttach: left database mutex %p (early return on rc=%d)\n", db->mutex, rc); + CODEC_TRACE_MUTEX("tdsqlite3CodecAttach: leaving database mutex %p (early return on rc=%d)\n", db->mutex, rc); + tdsqlite3_mutex_leave(db->mutex); + CODEC_TRACE_MUTEX("tdsqlite3CodecAttach: left database mutex %p (early return on rc=%d)\n", db->mutex, rc); return rc; } - CODEC_TRACE("sqlite3CodecAttach: calling sqlite3PagerSetCodec()\n"); - sqlite3PagerSetCodec(sqlite3BtreePager(pDb->pBt), sqlite3Codec, NULL, sqlite3FreeCodecArg, (void *) ctx); + CODEC_TRACE("tdsqlite3CodecAttach: calling tdsqlite3PagerSetCodec()\n"); + tdsqlite3PagerSetCodec(tdsqlite3BtreePager(pDb->pBt), tdsqlite3Codec, NULL, tdsqlite3FreeCodecArg, (void *) ctx); - CODEC_TRACE("sqlite3CodecAttach: calling codec_set_btree_to_codec_pagesize()\n"); + CODEC_TRACE("tdsqlite3CodecAttach: calling codec_set_btree_to_codec_pagesize()\n"); codec_set_btree_to_codec_pagesize(db, pDb, ctx); /* force secure delete. This has the benefit of wiping internal data when deleted and also ensures that all pages are written to disk (i.e. not skipped by - sqlite3PagerDontWrite optimizations) */ - CODEC_TRACE("sqlite3CodecAttach: calling sqlite3BtreeSecureDelete()\n"); - sqlite3BtreeSecureDelete(pDb->pBt, 1); + tdsqlite3PagerDontWrite optimizations) */ + CODEC_TRACE("tdsqlite3CodecAttach: calling tdsqlite3BtreeSecureDelete()\n"); + tdsqlite3BtreeSecureDelete(pDb->pBt, 1); /* if fd is null, then this is an in-memory database and we dont' want to overwrite the AutoVacuum settings if not null, then set to the default */ if(fd != NULL) { - CODEC_TRACE("sqlite3CodecAttach: calling sqlite3BtreeSetAutoVacuum()\n"); - sqlite3BtreeSetAutoVacuum(pDb->pBt, SQLITE_DEFAULT_AUTOVACUUM); + CODEC_TRACE("tdsqlite3CodecAttach: calling tdsqlite3BtreeSetAutoVacuum()\n"); + tdsqlite3BtreeSetAutoVacuum(pDb->pBt, SQLITE_DEFAULT_AUTOVACUUM); } - CODEC_TRACE_MUTEX("sqlite3CodecAttach: leaving database mutex %p\n", db->mutex); - sqlite3_mutex_leave(db->mutex); - CODEC_TRACE_MUTEX("sqlite3CodecAttach: left database mutex %p\n", db->mutex); + CODEC_TRACE_MUTEX("tdsqlite3CodecAttach: leaving database mutex %p\n", db->mutex); + tdsqlite3_mutex_leave(db->mutex); + CODEC_TRACE_MUTEX("tdsqlite3CodecAttach: left database mutex %p\n", db->mutex); } return SQLITE_OK; } -int sqlcipher_find_db_index(sqlite3 *db, const char *zDb) { +int sqlcipher_find_db_index(tdsqlite3 *db, const char *zDb) { int db_index; if(zDb == NULL){ return 0; @@ -22177,31 +22177,31 @@ int sqlcipher_find_db_index(sqlite3 *db, const char *zDb) { return 0; } -SQLITE_API void sqlite3_activate_see(const char* in) { +SQLITE_API void tdsqlite3_activate_see(const char* in) { /* do nothing, security enhancements are always active */ } -SQLITE_API int sqlite3_key(sqlite3 *db, const void *pKey, int nKey) { - CODEC_TRACE("sqlite3_key entered: db=%p pKey=%s nKey=%d\n", db, (char *)pKey, nKey); - return sqlite3_key_v2(db, "main", pKey, nKey); +SQLITE_API int tdsqlite3_key(tdsqlite3 *db, const void *pKey, int nKey) { + CODEC_TRACE("tdsqlite3_key entered: db=%p pKey=%s nKey=%d\n", db, (char *)pKey, nKey); + return tdsqlite3_key_v2(db, "main", pKey, nKey); } -SQLITE_API int sqlite3_key_v2(sqlite3 *db, const char *zDb, const void *pKey, int nKey) { - CODEC_TRACE("sqlite3_key_v2: entered db=%p zDb=%s pKey=%s nKey=%d\n", db, zDb, (char *)pKey, nKey); +SQLITE_API int tdsqlite3_key_v2(tdsqlite3 *db, const char *zDb, const void *pKey, int nKey) { + CODEC_TRACE("tdsqlite3_key_v2: entered db=%p zDb=%s pKey=%s nKey=%d\n", db, zDb, (char *)pKey, nKey); /* attach key if db and pKey are not null and nKey is > 0 */ if(db && pKey && nKey) { int db_index = sqlcipher_find_db_index(db, zDb); - return sqlite3CodecAttach(db, db_index, pKey, nKey); + return tdsqlite3CodecAttach(db, db_index, pKey, nKey); } return SQLITE_ERROR; } -SQLITE_API int sqlite3_rekey(sqlite3 *db, const void *pKey, int nKey) { - CODEC_TRACE("sqlite3_rekey entered: db=%p pKey=%s nKey=%d\n", db, (char *)pKey, nKey); - return sqlite3_rekey_v2(db, "main", pKey, nKey); +SQLITE_API int tdsqlite3_rekey(tdsqlite3 *db, const void *pKey, int nKey) { + CODEC_TRACE("tdsqlite3_rekey entered: db=%p pKey=%s nKey=%d\n", db, (char *)pKey, nKey); + return tdsqlite3_rekey_v2(db, "main", pKey, nKey); } -/* sqlite3_rekey_v2 +/* tdsqlite3_rekey_v2 ** Given a database, this will reencrypt the database using a new key. ** There is only one possible modes of operation - to encrypt a database ** that is already encrpyted. If the database is not already encrypted @@ -22211,12 +22211,12 @@ SQLITE_API int sqlite3_rekey(sqlite3 *db, const void *pKey, int nKey) { ** 2. If there is NOT already a key present do nothing ** 3. If there is a key present, re-encrypt the database with the new key */ -SQLITE_API int sqlite3_rekey_v2(sqlite3 *db, const char *zDb, const void *pKey, int nKey) { - CODEC_TRACE("sqlite3_rekey_v2: entered db=%p zDb=%s pKey=%s, nKey=%d\n", db, zDb, (char *)pKey, nKey); +SQLITE_API int tdsqlite3_rekey_v2(tdsqlite3 *db, const char *zDb, const void *pKey, int nKey) { + CODEC_TRACE("tdsqlite3_rekey_v2: entered db=%p zDb=%s pKey=%s, nKey=%d\n", db, zDb, (char *)pKey, nKey); if(db && pKey && nKey) { int db_index = sqlcipher_find_db_index(db, zDb); struct Db *pDb = &db->aDb[db_index]; - CODEC_TRACE("sqlite3_rekey_v2: database pDb=%p db_index:%d\n", pDb, db_index); + CODEC_TRACE("tdsqlite3_rekey_v2: database pDb=%p db_index:%d\n", pDb, db_index); if(pDb->pBt) { codec_ctx *ctx; int rc, page_count; @@ -22224,17 +22224,17 @@ SQLITE_API int sqlite3_rekey_v2(sqlite3 *db, const char *zDb, const void *pKey, PgHdr *page; Pager *pPager = pDb->pBt->pBt->pPager; - ctx = (codec_ctx*) sqlite3PagerGetCodec(pDb->pBt->pBt->pPager); + ctx = (codec_ctx*) tdsqlite3PagerGetCodec(pDb->pBt->pBt->pPager); if(ctx == NULL) { /* there was no codec attached to this database, so this should do nothing! */ - CODEC_TRACE("sqlite3_rekey_v2: no codec attached to db, exiting\n"); + CODEC_TRACE("tdsqlite3_rekey_v2: no codec attached to db, exiting\n"); return SQLITE_OK; } - CODEC_TRACE_MUTEX("sqlite3_rekey_v2: entering database mutex %p\n", db->mutex); - sqlite3_mutex_enter(db->mutex); - CODEC_TRACE_MUTEX("sqlite3_rekey_v2: entered database mutex %p\n", db->mutex); + CODEC_TRACE_MUTEX("tdsqlite3_rekey_v2: entering database mutex %p\n", db->mutex); + tdsqlite3_mutex_enter(db->mutex); + CODEC_TRACE_MUTEX("tdsqlite3_rekey_v2: entered database mutex %p\n", db->mutex); codec_set_pass_key(db, db_index, pKey, nKey, CIPHER_WRITE_CTX); @@ -22244,48 +22244,48 @@ SQLITE_API int sqlite3_rekey_v2(sqlite3 *db, const char *zDb, const void *pKey, ** 3. If that goes ok then commit and put ctx->rekey into ctx->key ** note: don't deallocate rekey since it may be used in a subsequent iteration */ - rc = sqlite3BtreeBeginTrans(pDb->pBt, 1, 0); /* begin write transaction */ - sqlite3PagerPagecount(pPager, &page_count); + rc = tdsqlite3BtreeBeginTrans(pDb->pBt, 1, 0); /* begin write transaction */ + tdsqlite3PagerPagecount(pPager, &page_count); for(pgno = 1; rc == SQLITE_OK && pgno <= (unsigned int)page_count; pgno++) { /* pgno's start at 1 see pager.c:pagerAcquire */ - if(!sqlite3pager_is_mj_pgno(pPager, pgno)) { /* skip this page (see pager.c:pagerAcquire for reasoning) */ - rc = sqlite3PagerGet(pPager, pgno, &page, 0); + if(!tdsqlite3pager_is_mj_pgno(pPager, pgno)) { /* skip this page (see pager.c:pagerAcquire for reasoning) */ + rc = tdsqlite3PagerGet(pPager, pgno, &page, 0); if(rc == SQLITE_OK) { /* write page see pager_incr_changecounter for example */ - rc = sqlite3PagerWrite(page); + rc = tdsqlite3PagerWrite(page); if(rc == SQLITE_OK) { - sqlite3PagerUnref(page); + tdsqlite3PagerUnref(page); } else { - CODEC_TRACE("sqlite3_rekey_v2: error %d occurred writing page %d\n", rc, pgno); + CODEC_TRACE("tdsqlite3_rekey_v2: error %d occurred writing page %d\n", rc, pgno); } } else { - CODEC_TRACE("sqlite3_rekey_v2: error %d occurred getting page %d\n", rc, pgno); + CODEC_TRACE("tdsqlite3_rekey_v2: error %d occurred getting page %d\n", rc, pgno); } } } /* if commit was successful commit and copy the rekey data to current key, else rollback to release locks */ if(rc == SQLITE_OK) { - CODEC_TRACE("sqlite3_rekey_v2: committing\n"); - rc = sqlite3BtreeCommit(pDb->pBt); + CODEC_TRACE("tdsqlite3_rekey_v2: committing\n"); + rc = tdsqlite3BtreeCommit(pDb->pBt); sqlcipher_codec_key_copy(ctx, CIPHER_WRITE_CTX); } else { - CODEC_TRACE("sqlite3_rekey_v2: rollback\n"); - sqlite3BtreeRollback(pDb->pBt, SQLITE_ABORT_ROLLBACK, 0); + CODEC_TRACE("tdsqlite3_rekey_v2: rollback\n"); + tdsqlite3BtreeRollback(pDb->pBt, SQLITE_ABORT_ROLLBACK, 0); } - CODEC_TRACE_MUTEX("sqlite3_rekey_v2: leaving database mutex %p\n", db->mutex); - sqlite3_mutex_leave(db->mutex); - CODEC_TRACE_MUTEX("sqlite3_rekey_v2: left database mutex %p\n", db->mutex); + CODEC_TRACE_MUTEX("tdsqlite3_rekey_v2: leaving database mutex %p\n", db->mutex); + tdsqlite3_mutex_leave(db->mutex); + CODEC_TRACE_MUTEX("tdsqlite3_rekey_v2: left database mutex %p\n", db->mutex); } return SQLITE_OK; } return SQLITE_ERROR; } -SQLITE_PRIVATE void sqlite3CodecGetKey(sqlite3* db, int nDb, void **zKey, int *nKey) { +SQLITE_PRIVATE void tdsqlite3CodecGetKey(tdsqlite3* db, int nDb, void **zKey, int *nKey) { struct Db *pDb = &db->aDb[nDb]; - CODEC_TRACE("sqlite3CodecGetKey: entered db=%p, nDb=%d\n", db, nDb); + CODEC_TRACE("tdsqlite3CodecGetKey: entered db=%p, nDb=%d\n", db, nDb); if( pDb->pBt ) { - codec_ctx *ctx = (codec_ctx*) sqlite3PagerGetCodec(pDb->pBt->pBt->pPager); + codec_ctx *ctx = (codec_ctx*) tdsqlite3PagerGetCodec(pDb->pBt->pBt->pPager); if(ctx) { /* pass back the keyspec from the codec, unless PRAGMA cipher_store_pass @@ -22324,11 +22324,11 @@ SQLITE_PRIVATE void sqlite3CodecGetKey(sqlite3* db, int nDb, void **zKey, int *n ** ** Based on vacuumFinalize from vacuum.c */ -static int sqlcipher_finalize(sqlite3 *db, sqlite3_stmt *pStmt, char **pzErrMsg){ +static int sqlcipher_finalize(tdsqlite3 *db, tdsqlite3_stmt *pStmt, char **pzErrMsg){ int rc; - rc = sqlite3VdbeFinalize((Vdbe*)pStmt); + rc = tdsqlite3VdbeFinalize((Vdbe*)pStmt); if( rc ){ - sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db)); + tdsqlite3SetString(pzErrMsg, db, tdsqlite3_errmsg(db)); } return rc; } @@ -22338,17 +22338,17 @@ static int sqlcipher_finalize(sqlite3 *db, sqlite3_stmt *pStmt, char **pzErrMsg) ** ** Based on execSql from vacuum.c */ -static int sqlcipher_execSql(sqlite3 *db, char **pzErrMsg, const char *zSql){ - sqlite3_stmt *pStmt; +static int sqlcipher_execSql(tdsqlite3 *db, char **pzErrMsg, const char *zSql){ + tdsqlite3_stmt *pStmt; VVA_ONLY( int rc; ) if( !zSql ){ return SQLITE_NOMEM; } - if( SQLITE_OK!=sqlite3_prepare(db, zSql, -1, &pStmt, 0) ){ - sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db)); - return sqlite3_errcode(db); + if( SQLITE_OK!=tdsqlite3_prepare(db, zSql, -1, &pStmt, 0) ){ + tdsqlite3SetString(pzErrMsg, db, tdsqlite3_errmsg(db)); + return tdsqlite3_errcode(db); } - VVA_ONLY( rc = ) sqlite3_step(pStmt); + VVA_ONLY( rc = ) tdsqlite3_step(pStmt); assert( rc!=SQLITE_ROW ); return sqlcipher_finalize(db, pStmt, pzErrMsg); } @@ -22359,15 +22359,15 @@ static int sqlcipher_execSql(sqlite3 *db, char **pzErrMsg, const char *zSql){ ** ** Based on execExecSql from vacuum.c */ -static int sqlcipher_execExecSql(sqlite3 *db, char **pzErrMsg, const char *zSql){ - sqlite3_stmt *pStmt; +static int sqlcipher_execExecSql(tdsqlite3 *db, char **pzErrMsg, const char *zSql){ + tdsqlite3_stmt *pStmt; int rc; - rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0); + rc = tdsqlite3_prepare(db, zSql, -1, &pStmt, 0); if( rc!=SQLITE_OK ) return rc; - while( SQLITE_ROW==sqlite3_step(pStmt) ){ - rc = sqlcipher_execSql(db, pzErrMsg, (char*)sqlite3_column_text(pStmt, 0)); + while( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + rc = sqlcipher_execSql(db, pzErrMsg, (char*)tdsqlite3_column_text(pStmt, 0)); if( rc!=SQLITE_OK ){ sqlcipher_finalize(db, pStmt, pzErrMsg); return rc; @@ -22380,10 +22380,10 @@ static int sqlcipher_execExecSql(sqlite3 *db, char **pzErrMsg, const char *zSql) /* * copy database and schema from the main database to an attached database * - * Based on sqlite3RunVacuum from vacuum.c + * Based on tdsqlite3RunVacuum from vacuum.c */ -void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **argv) { - sqlite3 *db = sqlite3_context_db_handle(context); +void sqlcipher_exportFunc(tdsqlite3_context *context, int argc, tdsqlite3_value **argv) { + tdsqlite3 *db = tdsqlite3_context_db_handle(context); const char* targetDb, *sourceDb; int targetDb_idx = 0; u64 saved_flags = db->flags; /* Saved value of the db->flags */ @@ -22398,19 +22398,19 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar if(argc != 1 && argc != 2) { rc = SQLITE_ERROR; - pzErrMsg = sqlite3_mprintf("invalid number of arguments (%d) passed to sqlcipher_export", argc); + pzErrMsg = tdsqlite3_mprintf("invalid number of arguments (%d) passed to sqlcipher_export", argc); goto end_of_export; } - targetDb = (const char*) sqlite3_value_text(argv[0]); - sourceDb = (argc == 2) ? (char *) sqlite3_value_text(argv[1]) : "main"; + targetDb = (const char*) tdsqlite3_value_text(argv[0]); + sourceDb = (argc == 2) ? (char *) tdsqlite3_value_text(argv[1]) : "main"; /* if the name of the target is not main, but the index returned is zero there is a mismatch and we should not proceed */ targetDb_idx = sqlcipher_find_db_index(db, targetDb); - if(targetDb_idx == 0 && sqlite3StrICmp("main", targetDb) != 0) { + if(targetDb_idx == 0 && tdsqlite3StrICmp("main", targetDb) != 0) { rc = SQLITE_ERROR; - pzErrMsg = sqlite3_mprintf("unknown database %s", targetDb); + pzErrMsg = tdsqlite3_mprintf("unknown database %s", targetDb); goto end_of_export; } db->init.iDb = targetDb_idx; @@ -22424,36 +22424,36 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar /* Query the schema of the main database. Create a mirror schema ** in the temporary database. */ - zSql = sqlite3_mprintf( + zSql = tdsqlite3_mprintf( "SELECT sql " " FROM %s.sqlite_master WHERE type='table' AND name!='sqlite_sequence'" " AND rootpage>0" , sourceDb); rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql); if( rc!=SQLITE_OK ) goto end_of_export; - sqlite3_free(zSql); + tdsqlite3_free(zSql); - zSql = sqlite3_mprintf( + zSql = tdsqlite3_mprintf( "SELECT sql " " FROM %s.sqlite_master WHERE sql LIKE 'CREATE INDEX %%' " , sourceDb); rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql); if( rc!=SQLITE_OK ) goto end_of_export; - sqlite3_free(zSql); + tdsqlite3_free(zSql); - zSql = sqlite3_mprintf( + zSql = tdsqlite3_mprintf( "SELECT sql " " FROM %s.sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %%'" , sourceDb); rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql); if( rc!=SQLITE_OK ) goto end_of_export; - sqlite3_free(zSql); + tdsqlite3_free(zSql); /* Loop through the tables in the main database. For each, do ** an "INSERT INTO rekey_db.xxx SELECT * FROM main.xxx;" to copy ** the contents to the temporary database. */ - zSql = sqlite3_mprintf( + zSql = tdsqlite3_mprintf( "SELECT 'INSERT INTO %s.' || quote(name) " "|| ' SELECT * FROM %s.' || quote(name) || ';'" "FROM %s.sqlite_master " @@ -22462,25 +22462,25 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar , targetDb, sourceDb, sourceDb); rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql); if( rc!=SQLITE_OK ) goto end_of_export; - sqlite3_free(zSql); + tdsqlite3_free(zSql); /* Copy over the contents of the sequence table */ - zSql = sqlite3_mprintf( + zSql = tdsqlite3_mprintf( "SELECT 'INSERT INTO %s.' || quote(name) " "|| ' SELECT * FROM %s.' || quote(name) || ';' " "FROM %s.sqlite_master WHERE name=='sqlite_sequence';" , targetDb, sourceDb, targetDb); rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql); if( rc!=SQLITE_OK ) goto end_of_export; - sqlite3_free(zSql); + tdsqlite3_free(zSql); /* Copy the triggers, views, and virtual tables from the main database ** over to the temporary database. None of these objects has any ** associated storage, so all we have to do is copy their entries ** from the SQLITE_MASTER table. */ - zSql = sqlite3_mprintf( + zSql = tdsqlite3_mprintf( "INSERT INTO %s.sqlite_master " " SELECT type, name, tbl_name, rootpage, sql" " FROM %s.sqlite_master" @@ -22489,7 +22489,7 @@ void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **ar , targetDb, sourceDb); rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execSql(db, &pzErrMsg, zSql); if( rc!=SQLITE_OK ) goto end_of_export; - sqlite3_free(zSql); + tdsqlite3_free(zSql); zSql = NULL; end_of_export: @@ -22501,14 +22501,14 @@ end_of_export: db->xTrace = saved_xTrace; db->mTrace = saved_mTrace; - if(zSql) sqlite3_free(zSql); + if(zSql) tdsqlite3_free(zSql); if(rc) { if(pzErrMsg != NULL) { - sqlite3_result_error(context, pzErrMsg, -1); - sqlite3DbFree(db, pzErrMsg); + tdsqlite3_result_error(context, pzErrMsg, -1); + tdsqlite3DbFree(db, pzErrMsg); } else { - sqlite3_result_error(context, sqlite3ErrStr(rc), -1); + tdsqlite3_result_error(context, tdsqlite3ErrStr(rc), -1); } } } @@ -22588,12 +22588,12 @@ static volatile int mem_security_on = 1; static volatile int mem_security_initialized = 0; static volatile int mem_security_activated = 0; static volatile unsigned int sqlcipher_activate_count = 0; -static volatile sqlite3_mem_methods default_mem_methods; +static volatile tdsqlite3_mem_methods default_mem_methods; static sqlcipher_provider *default_provider = NULL; -static sqlite3_mutex* sqlcipher_static_mutex[SQLCIPHER_MUTEX_COUNT]; +static tdsqlite3_mutex* sqlcipher_static_mutex[SQLCIPHER_MUTEX_COUNT]; -sqlite3_mutex* sqlcipher_mutex(int mutex) { +tdsqlite3_mutex* sqlcipher_mutex(int mutex) { if(mutex < 0 || mutex >= SQLCIPHER_MUTEX_COUNT) return NULL; return sqlcipher_static_mutex[mutex]; } @@ -22634,7 +22634,7 @@ static int sqlcipher_mem_roundup(int n) { return default_mem_methods.xRoundup(n); } -static sqlite3_mem_methods sqlcipher_mem_methods = { +static tdsqlite3_mem_methods sqlcipher_mem_methods = { sqlcipher_mem_malloc, sqlcipher_mem_free, sqlcipher_mem_realloc, @@ -22647,8 +22647,8 @@ static sqlite3_mem_methods sqlcipher_mem_methods = { void sqlcipher_init_memmethods() { if(mem_security_initialized) return; - if(sqlite3_config(SQLITE_CONFIG_GETMALLOC, &default_mem_methods) != SQLITE_OK || - sqlite3_config(SQLITE_CONFIG_MALLOC, &sqlcipher_mem_methods) != SQLITE_OK) { + if(tdsqlite3_config(SQLITE_CONFIG_GETMALLOC, &default_mem_methods) != SQLITE_OK || + tdsqlite3_config(SQLITE_CONFIG_MALLOC, &sqlcipher_mem_methods) != SQLITE_OK) { mem_security_on = mem_security_activated = 0; } mem_security_initialized = 1; @@ -22656,7 +22656,7 @@ void sqlcipher_init_memmethods() { int sqlcipher_register_provider(sqlcipher_provider *p) { CODEC_TRACE_MUTEX("sqlcipher_register_provider: entering SQLCIPHER_MUTEX_PROVIDER\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER)); CODEC_TRACE_MUTEX("sqlcipher_register_provider: entered SQLCIPHER_MUTEX_PROVIDER\n"); if(default_provider != NULL && default_provider != p) { @@ -22667,7 +22667,7 @@ int sqlcipher_register_provider(sqlcipher_provider *p) { } default_provider = p; CODEC_TRACE_MUTEX("sqlcipher_register_provider: leaving SQLCIPHER_MUTEX_PROVIDER\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER)); CODEC_TRACE_MUTEX("sqlcipher_register_provider: left SQLCIPHER_MUTEX_PROVIDER\n"); return SQLITE_OK; @@ -22682,14 +22682,14 @@ sqlcipher_provider* sqlcipher_get_provider() { void sqlcipher_activate() { CODEC_TRACE_MUTEX("sqlcipher_activate: entering static master mutex\n"); - sqlite3_mutex_enter(sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER)); + tdsqlite3_mutex_enter(tdsqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER)); CODEC_TRACE_MUTEX("sqlcipher_activate: entered static master mutex\n"); /* allocate new mutexes */ if(sqlcipher_activate_count == 0) { int i; for(i = 0; i < SQLCIPHER_MUTEX_COUNT; i++) { - sqlcipher_static_mutex[i] = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); + sqlcipher_static_mutex[i] = tdsqlite3_mutex_alloc(SQLITE_MUTEX_FAST); } } @@ -22724,13 +22724,13 @@ void sqlcipher_activate() { sqlcipher_activate_count++; /* increment activation count */ CODEC_TRACE_MUTEX("sqlcipher_activate: leaving static master mutex\n"); - sqlite3_mutex_leave(sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER)); + tdsqlite3_mutex_leave(tdsqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER)); CODEC_TRACE_MUTEX("sqlcipher_activate: left static master mutex\n"); } void sqlcipher_deactivate() { CODEC_TRACE_MUTEX("sqlcipher_deactivate: entering static master mutex\n"); - sqlite3_mutex_enter(sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER)); + tdsqlite3_mutex_enter(tdsqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER)); CODEC_TRACE_MUTEX("sqlcipher_deactivate: entered static master mutex\n"); sqlcipher_activate_count--; @@ -22738,7 +22738,7 @@ void sqlcipher_deactivate() { if(sqlcipher_activate_count < 1) { CODEC_TRACE_MUTEX("sqlcipher_deactivate: entering SQLCIPHER_MUTEX_PROVIDER\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER)); CODEC_TRACE_MUTEX("sqlcipher_deactivate: entered SQLCIPHER_MUTEX_PROVIDER\n"); if(default_provider != NULL) { @@ -22747,7 +22747,7 @@ void sqlcipher_deactivate() { } CODEC_TRACE_MUTEX("sqlcipher_deactivate: leaving SQLCIPHER_MUTEX_PROVIDER\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER)); CODEC_TRACE_MUTEX("sqlcipher_deactivate: left SQLCIPHER_MUTEX_PROVIDER\n"); #ifdef SQLCIPHER_EXT @@ -22758,14 +22758,14 @@ void sqlcipher_deactivate() { if(sqlcipher_activate_count == 0) { int i; for(i = 0; i < SQLCIPHER_MUTEX_COUNT; i++) { - sqlite3_mutex_free(sqlcipher_static_mutex[i]); + tdsqlite3_mutex_free(sqlcipher_static_mutex[i]); } } sqlcipher_activate_count = 0; /* reset activation count */ } CODEC_TRACE_MUTEX("sqlcipher_deactivate: leaving static master mutex\n"); - sqlite3_mutex_leave(sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER)); + tdsqlite3_mutex_leave(tdsqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER)); CODEC_TRACE_MUTEX("sqlcipher_deactivate: left static master mutex\n"); } @@ -22869,7 +22869,7 @@ void sqlcipher_munlock(void *ptr, u64 sz) { } /** - * Free and wipe memory. Uses SQLites internal sqlite3_free so that memory + * Free and wipe memory. Uses SQLites internal tdsqlite3_free so that memory * can be countend and memory leak detection works in the test suite. * If ptr is not null memory will be freed. * If sz is greater than zero, the memory will be overwritten with zero before it is freed @@ -22880,7 +22880,7 @@ void sqlcipher_free(void *ptr, u64 sz) { CODEC_TRACE_MEMORY("sqlcipher_free: calling sqlcipher_memset(%p,0,%llu)\n", ptr, sz); sqlcipher_memset(ptr, 0, sz); sqlcipher_munlock(ptr, sz); - sqlite3_free(ptr); + tdsqlite3_free(ptr); } /** @@ -22890,8 +22890,8 @@ void sqlcipher_free(void *ptr, u64 sz) { */ void* sqlcipher_malloc(u64 sz) { void *ptr; - CODEC_TRACE_MEMORY("sqlcipher_malloc: calling sqlite3Malloc(%llu)\n", sz); - ptr = sqlite3Malloc(sz); + CODEC_TRACE_MEMORY("sqlcipher_malloc: calling tdsqlite3Malloc(%llu)\n", sz); + ptr = tdsqlite3Malloc(sz); CODEC_TRACE_MEMORY("sqlcipher_malloc: calling sqlcipher_memset(%p,0,%llu)\n", ptr, sz); sqlcipher_memset(ptr, 0, sz); sqlcipher_mlock(ptr, sz); @@ -22900,9 +22900,9 @@ void* sqlcipher_malloc(u64 sz) { char* sqlcipher_version() { #ifdef CIPHER_VERSION_QUALIFIER - char *version = sqlite3_mprintf("%s %s %s", CIPHER_XSTR(CIPHER_VERSION_NUMBER), CIPHER_XSTR(CIPHER_VERSION_QUALIFIER), CIPHER_XSTR(CIPHER_VERSION_BUILD)); + char *version = tdsqlite3_mprintf("%s %s %s", CIPHER_XSTR(CIPHER_VERSION_NUMBER), CIPHER_XSTR(CIPHER_VERSION_QUALIFIER), CIPHER_XSTR(CIPHER_VERSION_BUILD)); #else - char *version = sqlite3_mprintf("%s %s", CIPHER_XSTR(CIPHER_VERSION_NUMBER), CIPHER_XSTR(CIPHER_VERSION_BUILD)); + char *version = tdsqlite3_mprintf("%s %s", CIPHER_XSTR(CIPHER_VERSION_NUMBER), CIPHER_XSTR(CIPHER_VERSION_BUILD)); #endif return version; } @@ -23263,7 +23263,7 @@ int sqlcipher_codec_ctx_get_flag(codec_ctx *ctx, unsigned int flag) { void sqlcipher_codec_ctx_set_error(codec_ctx *ctx, int error) { CODEC_TRACE("sqlcipher_codec_ctx_set_error: ctx=%p, error=%d\n", ctx, error); - sqlite3pager_error(ctx->pBt->pBt->pPager, error); + tdsqlite3pager_error(ctx->pBt->pBt->pPager, error); ctx->pBt->pBt->db->errCode = error; } @@ -23276,7 +23276,7 @@ void* sqlcipher_codec_ctx_get_data(codec_ctx *ctx) { } static int sqlcipher_codec_ctx_init_kdf_salt(codec_ctx *ctx) { - sqlite3_file *fd = sqlite3PagerFile(ctx->pBt->pBt->pPager); + tdsqlite3_file *fd = tdsqlite3PagerFile(ctx->pBt->pBt->pPager); if(!ctx->need_kdf_salt) { return SQLITE_OK; /* don't reload salt when not needed */ @@ -23284,7 +23284,7 @@ static int sqlcipher_codec_ctx_init_kdf_salt(codec_ctx *ctx) { /* read salt from header, if present, otherwise generate a new random salt */ CODEC_TRACE("sqlcipher_codec_ctx_init_kdf_salt: obtaining salt\n"); - if(fd == NULL || fd->pMethods == 0 || sqlite3OsRead(fd, ctx->kdf_salt, ctx->kdf_salt_sz, 0) != SQLITE_OK) { + if(fd == NULL || fd->pMethods == 0 || tdsqlite3OsRead(fd, ctx->kdf_salt, ctx->kdf_salt_sz, 0) != SQLITE_OK) { CODEC_TRACE("sqlcipher_codec_ctx_init_kdf_salt: unable to read salt from file header, generating random\n"); if(ctx->provider->random(ctx->provider_ctx, ctx->kdf_salt, ctx->kdf_salt_sz) != SQLITE_OK) return SQLITE_ERROR; } @@ -23397,13 +23397,13 @@ int sqlcipher_codec_ctx_init(codec_ctx **iCtx, Db *pDb, Pager *pPager, const voi /* make a copy of the provider to be used for the duration of the context */ CODEC_TRACE_MUTEX("sqlcipher_codec_ctx_init: entering SQLCIPHER_MUTEX_PROVIDER\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER)); CODEC_TRACE_MUTEX("sqlcipher_codec_ctx_init: entered SQLCIPHER_MUTEX_PROVIDER\n"); memcpy(ctx->provider, default_provider, sizeof(sqlcipher_provider)); CODEC_TRACE_MUTEX("sqlcipher_codec_ctx_init: leaving SQLCIPHER_MUTEX_PROVIDER\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER)); CODEC_TRACE_MUTEX("sqlcipher_codec_ctx_init: left SQLCIPHER_MUTEX_PROVIDER\n"); CODEC_TRACE("sqlcipher_codec_ctx_init: calling provider ctx_init\n"); @@ -23506,7 +23506,7 @@ static int sqlcipher_page_hmac(codec_ctx *ctx, cipher_ctx *c_ctx, Pgno pgno, uns if(ctx->flags & CIPHER_FLAG_LE_PGNO) { /* compute hmac using little endian pgno*/ sqlcipher_put4byte_le(pgno_raw, pgno); } else if(ctx->flags & CIPHER_FLAG_BE_PGNO) { /* compute hmac using big endian pgno */ - sqlite3Put4byte(pgno_raw, pgno); /* sqlite3Put4byte converts 32bit uint to big endian */ + tdsqlite3Put4byte(pgno_raw, pgno); /* tdsqlite3Put4byte converts 32bit uint to big endian */ } else { /* use native byte ordering */ memcpy(pgno_raw, &pgno, sizeof(pgno)); } @@ -23638,12 +23638,12 @@ static int sqlcipher_cipher_ctx_key_derive(codec_ctx *ctx, cipher_ctx *c_ctx) { if((rc = sqlcipher_codec_ctx_init_kdf_salt(ctx)) != SQLITE_OK) return rc; } - if (c_ctx->pass_sz == ((ctx->key_sz * 2) + 3) && sqlite3StrNICmp((const char *)c_ctx->pass ,"x'", 2) == 0 && cipher_isHex(c_ctx->pass + 2, ctx->key_sz * 2)) { + if (c_ctx->pass_sz == ((ctx->key_sz * 2) + 3) && tdsqlite3StrNICmp((const char *)c_ctx->pass ,"x'", 2) == 0 && cipher_isHex(c_ctx->pass + 2, ctx->key_sz * 2)) { int n = c_ctx->pass_sz - 3; /* adjust for leading x' and tailing ' */ const unsigned char *z = c_ctx->pass + 2; /* adjust lead offset of x' */ CODEC_TRACE("cipher_ctx_key_derive: using raw key from hex\n"); cipher_hex2bin(z, n, c_ctx->key); - } else if (c_ctx->pass_sz == (((ctx->key_sz + ctx->kdf_salt_sz) * 2) + 3) && sqlite3StrNICmp((const char *)c_ctx->pass ,"x'", 2) == 0 && cipher_isHex(c_ctx->pass + 2, (ctx->key_sz + ctx->kdf_salt_sz) * 2)) { + } else if (c_ctx->pass_sz == (((ctx->key_sz + ctx->kdf_salt_sz) * 2) + 3) && tdsqlite3StrNICmp((const char *)c_ctx->pass ,"x'", 2) == 0 && cipher_isHex(c_ctx->pass + 2, (ctx->key_sz + ctx->kdf_salt_sz) * 2)) { const unsigned char *z = c_ctx->pass + 2; /* adjust lead offset of x' */ CODEC_TRACE("cipher_ctx_key_derive: using raw key from hex\n"); cipher_hex2bin(z, (ctx->key_sz * 2), c_ctx->key); @@ -23728,39 +23728,39 @@ const char* sqlcipher_codec_get_cipher_provider(codec_ctx *ctx) { static int sqlcipher_check_connection(const char *filename, char *key, int key_sz, char *sql, int *user_version, char** journal_mode) { int rc; - sqlite3 *db = NULL; - sqlite3_stmt *statement = NULL; + tdsqlite3 *db = NULL; + tdsqlite3_stmt *statement = NULL; char *query_journal_mode = "PRAGMA journal_mode;"; char *query_user_version = "PRAGMA user_version;"; - rc = sqlite3_open(filename, &db); + rc = tdsqlite3_open(filename, &db); if(rc != SQLITE_OK) goto cleanup; - rc = sqlite3_key(db, key, key_sz); + rc = tdsqlite3_key(db, key, key_sz); if(rc != SQLITE_OK) goto cleanup; - rc = sqlite3_exec(db, sql, NULL, NULL, NULL); + rc = tdsqlite3_exec(db, sql, NULL, NULL, NULL); if(rc != SQLITE_OK) goto cleanup; /* start by querying the user version. this will fail if the key is incorrect */ - rc = sqlite3_prepare(db, query_user_version, -1, &statement, NULL); + rc = tdsqlite3_prepare(db, query_user_version, -1, &statement, NULL); if(rc != SQLITE_OK) goto cleanup; - rc = sqlite3_step(statement); + rc = tdsqlite3_step(statement); if(rc == SQLITE_ROW) { - *user_version = sqlite3_column_int(statement, 0); + *user_version = tdsqlite3_column_int(statement, 0); } else { goto cleanup; } - sqlite3_finalize(statement); + tdsqlite3_finalize(statement); - rc = sqlite3_prepare(db, query_journal_mode, -1, &statement, NULL); + rc = tdsqlite3_prepare(db, query_journal_mode, -1, &statement, NULL); if(rc != SQLITE_OK) goto cleanup; - rc = sqlite3_step(statement); + rc = tdsqlite3_step(statement); if(rc == SQLITE_ROW) { - *journal_mode = sqlite3_mprintf("%s", sqlite3_column_text(statement, 0)); + *journal_mode = tdsqlite3_mprintf("%s", tdsqlite3_column_text(statement, 0)); } else { goto cleanup; } @@ -23768,8 +23768,8 @@ static int sqlcipher_check_connection(const char *filename, char *key, int key_s /* cleanup will finalize open statement */ cleanup: - if(statement) sqlite3_finalize(statement); - if(db) sqlite3_close(db); + if(statement) tdsqlite3_finalize(statement); + if(db) tdsqlite3_close(db); return rc; } @@ -23778,32 +23778,32 @@ int sqlcipher_codec_ctx_integrity_check(codec_ctx *ctx, Parse *pParse, char *col int rc = 0; char *result; unsigned char *hmac_out = NULL; - sqlite3_file *fd = sqlite3PagerFile(ctx->pBt->pBt->pPager); + tdsqlite3_file *fd = tdsqlite3PagerFile(ctx->pBt->pBt->pPager); i64 file_sz; - Vdbe *v = sqlite3GetVdbe(pParse); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, column, SQLITE_STATIC); + Vdbe *v = tdsqlite3GetVdbe(pParse); + tdsqlite3VdbeSetNumCols(v, 1); + tdsqlite3VdbeSetColName(v, 0, COLNAME_NAME, column, SQLITE_STATIC); if(fd == NULL || fd->pMethods == 0) { - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, "database file is undefined", P4_TRANSIENT); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, "database file is undefined", P4_TRANSIENT); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); goto cleanup; } if(!(ctx->flags & CIPHER_FLAG_HMAC)) { - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, "HMAC is not enabled, unable to integrity check", P4_TRANSIENT); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, "HMAC is not enabled, unable to integrity check", P4_TRANSIENT); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); goto cleanup; } if((rc = sqlcipher_codec_key_derive(ctx)) != SQLITE_OK) { - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, "unable to derive keys", P4_TRANSIENT); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, "unable to derive keys", P4_TRANSIENT); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); goto cleanup; } - sqlite3OsFileSize(fd, &file_sz); + tdsqlite3OsFileSize(fd, &file_sz); hmac_out = sqlcipher_malloc(ctx->hmac_sz); for(page = 1; page <= file_sz / ctx->page_sz; page++) { @@ -23820,25 +23820,25 @@ int sqlcipher_codec_ctx_integrity_check(codec_ctx *ctx, Parse *pParse, char *col sqlcipher_memset(ctx->buffer, 0, ctx->page_sz); sqlcipher_memset(hmac_out, 0, ctx->hmac_sz); - if(sqlite3OsRead(fd, ctx->buffer, read_sz, offset) != SQLITE_OK) { - result = sqlite3_mprintf("error reading %d bytes from file page %d at offset %d\n", read_sz, page, offset); - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, result, P4_DYNAMIC); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); + if(tdsqlite3OsRead(fd, ctx->buffer, read_sz, offset) != SQLITE_OK) { + result = tdsqlite3_mprintf("error reading %d bytes from file page %d at offset %d\n", read_sz, page, offset); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, result, P4_DYNAMIC); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); } else if(sqlcipher_page_hmac(ctx, ctx->read_ctx, page, ctx->buffer, payload_sz, hmac_out) != SQLITE_OK) { - result = sqlite3_mprintf("HMAC operation failed for page %d", page); - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, result, P4_DYNAMIC); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); + result = tdsqlite3_mprintf("HMAC operation failed for page %d", page); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, result, P4_DYNAMIC); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); } else if(sqlcipher_memcmp(ctx->buffer + payload_sz, hmac_out, ctx->hmac_sz) != 0) { - result = sqlite3_mprintf("HMAC verification failed for page %d", page); - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, result, P4_DYNAMIC); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); + result = tdsqlite3_mprintf("HMAC verification failed for page %d", page); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, result, P4_DYNAMIC); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); } } if(file_sz % ctx->page_sz != 0) { - result = sqlite3_mprintf("page %d has an invalid size of %lld bytes", page, file_sz - ((file_sz / ctx->page_sz) * ctx->page_sz)); - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, result, P4_DYNAMIC); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); + result = tdsqlite3_mprintf("page %d has an invalid size of %lld bytes", page, file_sz - ((file_sz / ctx->page_sz) * ctx->page_sz)); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, result, P4_DYNAMIC); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); } cleanup: @@ -23849,18 +23849,18 @@ cleanup: int sqlcipher_codec_ctx_migrate(codec_ctx *ctx) { int i, pass_sz, keyspec_sz, nRes, user_version, rc, oflags; Db *pDb = 0; - sqlite3 *db = ctx->pBt->db; - const char *db_filename = sqlite3_db_filename(db, "main"); + tdsqlite3 *db = ctx->pBt->db; + const char *db_filename = tdsqlite3_db_filename(db, "main"); char *set_user_version = NULL, *pass = NULL, *attach_command = NULL, *migrated_db_filename = NULL, *keyspec = NULL, *temp = NULL, *journal_mode = NULL, *set_journal_mode = NULL, *pragma_compat = NULL; Btree *pDest = NULL, *pSrc = NULL; - sqlite3_file *srcfile, *destfile; + tdsqlite3_file *srcfile, *destfile; #if defined(_WIN32) || defined(SQLITE_OS_WINRT) LPWSTR w_db_filename = NULL, w_migrated_db_filename = NULL; int w_db_filename_sz = 0, w_migrated_db_filename_sz = 0; #endif pass_sz = keyspec_sz = rc = user_version = 0; - if(!db_filename || sqlite3Strlen30(db_filename) < 1) + if(!db_filename || tdsqlite3Strlen30(db_filename) < 1) goto cleanup; /* exit immediately if this is an in memory database */ /* pull the provided password / key material off the current codec context */ @@ -23877,13 +23877,13 @@ int sqlcipher_codec_ctx_migrate(codec_ctx *ctx) { } for(i = 3; i > 0; i--) { - pragma_compat = sqlite3_mprintf("PRAGMA cipher_compatibility = %d;", i); + pragma_compat = tdsqlite3_mprintf("PRAGMA cipher_compatibility = %d;", i); rc = sqlcipher_check_connection(db_filename, pass, pass_sz, pragma_compat, &user_version, &journal_mode); if(rc == SQLITE_OK) { CODEC_TRACE("Version %d format found\n", i); goto migrate; } - if(pragma_compat) sqlcipher_free(pragma_compat, sqlite3Strlen30(pragma_compat)); + if(pragma_compat) sqlcipher_free(pragma_compat, tdsqlite3Strlen30(pragma_compat)); pragma_compat = NULL; } /* if we exit the loop normally we failed to determine the version, this is an error */ @@ -23892,48 +23892,48 @@ int sqlcipher_codec_ctx_migrate(codec_ctx *ctx) { migrate: - temp = sqlite3_mprintf("%s-migrated", db_filename); - /* overallocate migrated_db_filename, because sqlite3OsOpen will read past the null terminator + temp = tdsqlite3_mprintf("%s-migrated", db_filename); + /* overallocate migrated_db_filename, because tdsqlite3OsOpen will read past the null terminator * to determine whether the filename was URI formatted */ - migrated_db_filename = sqlcipher_malloc(sqlite3Strlen30(temp)+2); - memcpy(migrated_db_filename, temp, sqlite3Strlen30(temp)); - sqlcipher_free(temp, sqlite3Strlen30(temp)); + migrated_db_filename = sqlcipher_malloc(tdsqlite3Strlen30(temp)+2); + memcpy(migrated_db_filename, temp, tdsqlite3Strlen30(temp)); + sqlcipher_free(temp, tdsqlite3Strlen30(temp)); - attach_command = sqlite3_mprintf("ATTACH DATABASE '%s' as migrate;", migrated_db_filename, pass); - set_user_version = sqlite3_mprintf("PRAGMA migrate.user_version = %d;", user_version); + attach_command = tdsqlite3_mprintf("ATTACH DATABASE '%s' as migrate;", migrated_db_filename, pass); + set_user_version = tdsqlite3_mprintf("PRAGMA migrate.user_version = %d;", user_version); - rc = sqlite3_exec(db, pragma_compat, NULL, NULL, NULL); + rc = tdsqlite3_exec(db, pragma_compat, NULL, NULL, NULL); if(rc != SQLITE_OK){ CODEC_TRACE("set compatibility mode failed, error code %d\n", rc); goto handle_error; } /* force journal mode to DELETE, we will set it back later if different */ - rc = sqlite3_exec(db, "PRAGMA journal_mode = delete;", NULL, NULL, NULL); + rc = tdsqlite3_exec(db, "PRAGMA journal_mode = delete;", NULL, NULL, NULL); if(rc != SQLITE_OK){ CODEC_TRACE("force journal mode DELETE failed, error code %d\n", rc); goto handle_error; } - rc = sqlite3_exec(db, attach_command, NULL, NULL, NULL); + rc = tdsqlite3_exec(db, attach_command, NULL, NULL, NULL); if(rc != SQLITE_OK){ CODEC_TRACE("attach failed, error code %d\n", rc); goto handle_error; } - rc = sqlite3_key_v2(db, "migrate", pass, pass_sz); + rc = tdsqlite3_key_v2(db, "migrate", pass, pass_sz); if(rc != SQLITE_OK){ CODEC_TRACE("keying attached database failed, error code %d\n", rc); goto handle_error; } - rc = sqlite3_exec(db, "SELECT sqlcipher_export('migrate');", NULL, NULL, NULL); + rc = tdsqlite3_exec(db, "SELECT sqlcipher_export('migrate');", NULL, NULL, NULL); if(rc != SQLITE_OK){ CODEC_TRACE("sqlcipher_export failed, error code %d\n", rc); goto handle_error; } - rc = sqlite3_exec(db, set_user_version, NULL, NULL, NULL); + rc = tdsqlite3_exec(db, set_user_version, NULL, NULL, NULL); if(rc != SQLITE_OK){ CODEC_TRACE("set user version failed, error code %d\n", rc); goto handle_error; @@ -23952,21 +23952,21 @@ migrate: pDb = &(db->aDb[db->nDb-1]); pSrc = pDb->pBt; - nRes = sqlite3BtreeGetOptimalReserve(pSrc); + nRes = tdsqlite3BtreeGetOptimalReserve(pSrc); /* unset the BTS_PAGESIZE_FIXED flag to avoid SQLITE_READONLY */ pDest->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED; - rc = sqlite3BtreeSetPageSize(pDest, default_page_size, nRes, 0); + rc = tdsqlite3BtreeSetPageSize(pDest, default_page_size, nRes, 0); CODEC_TRACE("set btree page size to %d res %d rc %d\n", default_page_size, nRes, rc); if( rc!=SQLITE_OK ) goto handle_error; - sqlite3CodecGetKey(db, db->nDb - 1, (void**)&keyspec, &keyspec_sz); - sqlite3CodecAttach(db, 0, keyspec, keyspec_sz); + tdsqlite3CodecGetKey(db, db->nDb - 1, (void**)&keyspec, &keyspec_sz); + tdsqlite3CodecAttach(db, 0, keyspec, keyspec_sz); - srcfile = sqlite3PagerFile(pSrc->pBt->pPager); - destfile = sqlite3PagerFile(pDest->pBt->pPager); + srcfile = tdsqlite3PagerFile(pSrc->pBt->pPager); + destfile = tdsqlite3PagerFile(pDest->pBt->pPager); - sqlite3OsClose(srcfile); - sqlite3OsClose(destfile); + tdsqlite3OsClose(srcfile); + tdsqlite3OsClose(destfile); #if defined(_WIN32) || defined(SQLITE_OS_WINRT) CODEC_TRACE("performing windows MoveFileExA\n"); @@ -23994,30 +23994,30 @@ migrate: #endif CODEC_TRACE("renamed migration database %s to main database %s: %d\n", migrated_db_filename, db_filename, rc); - rc = sqlite3OsOpen(db->pVfs, migrated_db_filename, srcfile, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MAIN_DB, &oflags); + rc = tdsqlite3OsOpen(db->pVfs, migrated_db_filename, srcfile, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MAIN_DB, &oflags); CODEC_TRACE("reopened migration database: %d\n", rc); if( rc!=SQLITE_OK ) goto handle_error; - rc = sqlite3OsOpen(db->pVfs, db_filename, destfile, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MAIN_DB, &oflags); + rc = tdsqlite3OsOpen(db->pVfs, db_filename, destfile, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MAIN_DB, &oflags); CODEC_TRACE("reopened main database: %d\n", rc); if( rc!=SQLITE_OK ) goto handle_error; - sqlite3pager_reset(pDest->pBt->pPager); + tdsqlite3pager_reset(pDest->pBt->pPager); CODEC_TRACE("reset pager\n"); - rc = sqlite3_exec(db, "DETACH DATABASE migrate;", NULL, NULL, NULL); + rc = tdsqlite3_exec(db, "DETACH DATABASE migrate;", NULL, NULL, NULL); CODEC_TRACE("DETACH DATABASE called %d\n", rc); if(rc != SQLITE_OK) goto cleanup; - rc = sqlite3OsDelete(db->pVfs, migrated_db_filename, 0); + rc = tdsqlite3OsDelete(db->pVfs, migrated_db_filename, 0); CODEC_TRACE("deleted migration database: %d\n", rc); if( rc!=SQLITE_OK ) goto handle_error; - sqlite3ResetAllSchemasOfConnection(db); + tdsqlite3ResetAllSchemasOfConnection(db); CODEC_TRACE("reset all schemas\n"); - set_journal_mode = sqlite3_mprintf("PRAGMA journal_mode = %s;", journal_mode); - rc = sqlite3_exec(db, set_journal_mode, NULL, NULL, NULL); + set_journal_mode = tdsqlite3_mprintf("PRAGMA journal_mode = %s;", journal_mode); + rc = tdsqlite3_exec(db, set_journal_mode, NULL, NULL, NULL); CODEC_TRACE("%s: %d\n", set_journal_mode, rc); if( rc!=SQLITE_OK ) goto handle_error; @@ -24029,12 +24029,12 @@ handle_error: cleanup: if(pass) sqlcipher_free(pass, pass_sz); - if(attach_command) sqlcipher_free(attach_command, sqlite3Strlen30(attach_command)); - if(migrated_db_filename) sqlcipher_free(migrated_db_filename, sqlite3Strlen30(migrated_db_filename)); - if(set_user_version) sqlcipher_free(set_user_version, sqlite3Strlen30(set_user_version)); - if(set_journal_mode) sqlcipher_free(set_journal_mode, sqlite3Strlen30(set_journal_mode)); - if(journal_mode) sqlcipher_free(journal_mode, sqlite3Strlen30(journal_mode)); - if(pragma_compat) sqlcipher_free(pragma_compat, sqlite3Strlen30(pragma_compat)); + if(attach_command) sqlcipher_free(attach_command, tdsqlite3Strlen30(attach_command)); + if(migrated_db_filename) sqlcipher_free(migrated_db_filename, tdsqlite3Strlen30(migrated_db_filename)); + if(set_user_version) sqlcipher_free(set_user_version, tdsqlite3Strlen30(set_user_version)); + if(set_journal_mode) sqlcipher_free(set_journal_mode, tdsqlite3Strlen30(set_journal_mode)); + if(journal_mode) sqlcipher_free(journal_mode, tdsqlite3Strlen30(journal_mode)); + if(pragma_compat) sqlcipher_free(pragma_compat, tdsqlite3Strlen30(pragma_compat)); #if defined(_WIN32) || defined(SQLITE_OS_WINRT) if(w_db_filename) sqlcipher_free(w_db_filename, w_db_filename_sz); if(w_migrated_db_filename) sqlcipher_free(w_migrated_db_filename, w_migrated_db_filename_sz); @@ -24046,8 +24046,8 @@ int sqlcipher_codec_add_random(codec_ctx *ctx, const char *zRight, int random_sz const char *suffix = &zRight[random_sz-1]; int n = random_sz - 3; /* adjust for leading x' and tailing ' */ if (n > 0 && - sqlite3StrNICmp((const char *)zRight ,"x'", 2) == 0 && - sqlite3StrNICmp(suffix, "'", 1) == 0 && + tdsqlite3StrNICmp((const char *)zRight ,"x'", 2) == 0 && + tdsqlite3StrNICmp(suffix, "'", 1) == 0 && n % 2 == 0) { int rc = 0; int buffer_sz = n / 2; @@ -24064,22 +24064,22 @@ int sqlcipher_codec_add_random(codec_ctx *ctx, const char *zRight, int random_sz return SQLITE_ERROR; } -static void sqlcipher_profile_callback(void *file, const char *sql, sqlite3_uint64 run_time){ +static void sqlcipher_profile_callback(void *file, const char *sql, tdsqlite3_uint64 run_time){ FILE *f = (FILE*)file; double elapsed = run_time/1000000.0; if(f) fprintf(f, "Elapsed time:%.3f ms - %s\n", elapsed, sql); } -int sqlcipher_cipher_profile(sqlite3 *db, const char *destination){ +int sqlcipher_cipher_profile(tdsqlite3 *db, const char *destination){ #if defined(SQLITE_OMIT_TRACE) || defined(SQLITE_OMIT_DEPRECATED) return SQLITE_ERROR; #else FILE *f; - if(sqlite3StrICmp(destination, "stdout") == 0){ + if(tdsqlite3StrICmp(destination, "stdout") == 0){ f = stdout; - }else if(sqlite3StrICmp(destination, "stderr") == 0){ + }else if(tdsqlite3StrICmp(destination, "stderr") == 0){ f = stderr; - }else if(sqlite3StrICmp(destination, "off") == 0){ + }else if(tdsqlite3StrICmp(destination, "off") == 0){ f = 0; }else{ #if !defined(SQLCIPHER_PROFILE_USE_FOPEN) && (defined(_WIN32) && (__STDC_VERSION__ > 199901L) || defined(SQLITE_OS_WINRT)) @@ -24088,7 +24088,7 @@ int sqlcipher_cipher_profile(sqlite3 *db, const char *destination){ if((f = fopen(destination, "a")) == 0) return SQLITE_ERROR; #endif } - sqlite3_profile(db, sqlcipher_profile_callback, f); + tdsqlite3_profile(db, sqlcipher_profile_callback, f); return SQLITE_OK; #endif } @@ -24157,7 +24157,7 @@ static int sqlcipher_ltc_add_random(void *ctx, void *buffer, int length) { const unsigned char * data = (const unsigned char *)buffer; CODEC_TRACE_MUTEX("sqlcipher_ltc_add_random: entering SQLCIPHER_MUTEX_PROVIDER_RAND\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); CODEC_TRACE_MUTEX("sqlcipher_ltc_add_random: entered SQLCIPHER_MUTEX_PROVIDER_RAND\n"); while(data_to_read > 0){ @@ -24173,7 +24173,7 @@ static int sqlcipher_ltc_add_random(void *ctx, void *buffer, int length) { fortuna_ready(&prng); CODEC_TRACE_MUTEX("sqlcipher_ltc_add_random: leaving SQLCIPHER_MUTEX_PROVIDER_RAND\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); CODEC_TRACE_MUTEX("sqlcipher_ltc_add_random: left SQLCIPHER_MUTEX_PROVIDER_RAND\n"); return rc; @@ -24183,7 +24183,7 @@ static int sqlcipher_ltc_activate(void *ctx) { unsigned char random_buffer[FORTUNA_MAX_SZ]; CODEC_TRACE_MUTEX("sqlcipher_ltc_activate: entering SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); CODEC_TRACE_MUTEX("sqlcipher_ltc_activate: entered SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); sqlcipher_memset(random_buffer, 0, FORTUNA_MAX_SZ); @@ -24202,7 +24202,7 @@ static int sqlcipher_ltc_activate(void *ctx) { ltc_ref_count++; #ifndef SQLCIPHER_TEST - sqlite3_randomness(FORTUNA_MAX_SZ, random_buffer); + tdsqlite3_randomness(FORTUNA_MAX_SZ, random_buffer); #endif if(sqlcipher_ltc_add_random(ctx, random_buffer, FORTUNA_MAX_SZ) != SQLITE_OK) { @@ -24211,7 +24211,7 @@ static int sqlcipher_ltc_activate(void *ctx) { sqlcipher_memset(random_buffer, 0, FORTUNA_MAX_SZ); CODEC_TRACE_MUTEX("sqlcipher_ltc_activate: leaving SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); CODEC_TRACE_MUTEX("sqlcipher_ltc_activate: left SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); return SQLITE_OK; @@ -24219,7 +24219,7 @@ static int sqlcipher_ltc_activate(void *ctx) { static int sqlcipher_ltc_deactivate(void *ctx) { CODEC_TRACE_MUTEX("sqlcipher_ltc_deactivate: entering SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); CODEC_TRACE_MUTEX("sqlcipher_ltc_deactivate: entered SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); ltc_ref_count--; @@ -24229,7 +24229,7 @@ static int sqlcipher_ltc_deactivate(void *ctx) { } CODEC_TRACE_MUTEX("sqlcipher_ltc_deactivate: leaving SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); CODEC_TRACE_MUTEX("sqlcipher_ltc_deactivate: left SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); return SQLITE_OK; @@ -24245,13 +24245,13 @@ static const char* sqlcipher_ltc_get_provider_version(void *ctx) { static int sqlcipher_ltc_random(void *ctx, void *buffer, int length) { CODEC_TRACE_MUTEX("sqlcipher_ltc_random: entering SQLCIPHER_MUTEX_PROVIDER_RAND\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); CODEC_TRACE_MUTEX("sqlcipher_ltc_random: entered SQLCIPHER_MUTEX_PROVIDER_RAND\n"); fortuna_read(buffer, length, &prng); CODEC_TRACE_MUTEX("sqlcipher_ltc_random: leaving SQLCIPHER_MUTEX_PROVIDER_RAND\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); CODEC_TRACE_MUTEX("sqlcipher_ltc_random: left SQLCIPHER_MUTEX_PROVIDER_RAND\n"); return SQLITE_OK; @@ -24452,7 +24452,7 @@ int sqlcipher_nss_setup(sqlcipher_provider *p); static int sqlcipher_nss_activate(void *ctx) { CODEC_TRACE_MUTEX("sqlcipher_nss_activate: entering SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); CODEC_TRACE_MUTEX("sqlcipher_nss_activate: entered SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); if (nss_init_context == NULL) { nss_init_context = NSS_InitContext("", "", "", "", NULL, @@ -24461,14 +24461,14 @@ static int sqlcipher_nss_activate(void *ctx) { } nss_init_count++; CODEC_TRACE_MUTEX("sqlcipher_nss_activate: leaving SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); CODEC_TRACE_MUTEX("sqlcipher_nss_activate: left SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); return SQLITE_OK; } static int sqlcipher_nss_deactivate(void *ctx) { CODEC_TRACE_MUTEX("sqlcipher_nss_activate: entering SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); CODEC_TRACE_MUTEX("sqlcipher_nss_activate: entered SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); nss_init_count--; @@ -24478,7 +24478,7 @@ static int sqlcipher_nss_deactivate(void *ctx) { } CODEC_TRACE_MUTEX("sqlcipher_nss_activate: leaving SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); CODEC_TRACE_MUTEX("sqlcipher_nss_activate: left SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); return SQLITE_OK; } @@ -24800,13 +24800,13 @@ static void HMAC_CTX_free(HMAC_CTX *ctx) static int sqlcipher_openssl_add_random(void *ctx, void *buffer, int length) { #ifndef SQLCIPHER_OPENSSL_NO_MUTEX_RAND CODEC_TRACE_MUTEX("sqlcipher_openssl_add_random: entering SQLCIPHER_MUTEX_PROVIDER_RAND\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); CODEC_TRACE_MUTEX("sqlcipher_openssl_add_random: entered SQLCIPHER_MUTEX_PROVIDER_RAND\n"); #endif RAND_add(buffer, length, 0); #ifndef SQLCIPHER_OPENSSL_NO_MUTEX_RAND CODEC_TRACE_MUTEX("sqlcipher_openssl_add_random: leaving SQLCIPHER_MUTEX_PROVIDER_RAND\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); CODEC_TRACE_MUTEX("sqlcipher_openssl_add_random: left SQLCIPHER_MUTEX_PROVIDER_RAND\n"); #endif return SQLITE_OK; @@ -24827,7 +24827,7 @@ static int sqlcipher_openssl_activate(void *ctx) { e.g. on startup */ CODEC_TRACE_MUTEX("sqlcipher_openssl_activate: entering SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); CODEC_TRACE_MUTEX("sqlcipher_openssl_activate: entered SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); if(openssl_init_count == 0 && EVP_get_cipherbyname(OPENSSL_CIPHER) != NULL) { @@ -24862,7 +24862,7 @@ static int sqlcipher_openssl_activate(void *ctx) { openssl_init_count++; CODEC_TRACE_MUTEX("sqlcipher_openssl_activate: leaving SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); CODEC_TRACE_MUTEX("sqlcipher_openssl_activate: left SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); return SQLITE_OK; } @@ -24872,7 +24872,7 @@ static int sqlcipher_openssl_activate(void *ctx) { OpenSSL memory is cleaned up */ static int sqlcipher_openssl_deactivate(void *ctx) { CODEC_TRACE_MUTEX("sqlcipher_openssl_deactivate: entering SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); CODEC_TRACE_MUTEX("sqlcipher_openssl_deactivate: entered SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); openssl_init_count--; @@ -24892,7 +24892,7 @@ static int sqlcipher_openssl_deactivate(void *ctx) { } CODEC_TRACE_MUTEX("sqlcipher_openssl_deactivate: leaving SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_ACTIVATE)); CODEC_TRACE_MUTEX("sqlcipher_openssl_deactivate: left SQLCIPHER_MUTEX_PROVIDER_ACTIVATE\n"); return SQLITE_OK; } @@ -24916,13 +24916,13 @@ static int sqlcipher_openssl_random (void *ctx, void *buffer, int length) { thread saftey in openssl externally */ #ifndef SQLCIPHER_OPENSSL_NO_MUTEX_RAND CODEC_TRACE_MUTEX("sqlcipher_openssl_random: entering SQLCIPHER_MUTEX_PROVIDER_RAND\n"); - sqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); + tdsqlite3_mutex_enter(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); CODEC_TRACE_MUTEX("sqlcipher_openssl_random: entered SQLCIPHER_MUTEX_PROVIDER_RAND\n"); #endif rc = RAND_bytes((unsigned char *)buffer, length); #ifndef SQLCIPHER_OPENSSL_NO_MUTEX_RAND CODEC_TRACE_MUTEX("sqlcipher_openssl_random: leaving SQLCIPHER_MUTEX_PROVIDER_RAND\n"); - sqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); + tdsqlite3_mutex_leave(sqlcipher_mutex(SQLCIPHER_MUTEX_PROVIDER_RAND)); CODEC_TRACE_MUTEX("sqlcipher_openssl_random: left SQLCIPHER_MUTEX_PROVIDER_RAND\n"); #endif return (rc == 1) ? SQLITE_OK : SQLITE_ERROR; @@ -25319,7 +25319,7 @@ int sqlcipher_cc_setup(sqlcipher_provider *p) { ** handle case conversions for the UTF character set since the tables ** involved are nearly as big or bigger than SQLite itself. */ -SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[] = { +SQLITE_PRIVATE const unsigned char tdsqlite3UpperToLower[] = { #ifdef SQLITE_ASCII 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, @@ -25377,7 +25377,7 @@ SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[] = { ** ** (x & ~(map[x]&0x20)) ** -** The equivalent of tolower() is implemented using the sqlite3UpperToLower[] +** The equivalent of tolower() is implemented using the tdsqlite3UpperToLower[] ** array. tolower() is used more often than toupper() by SQLite. ** ** Bit 0x40 is set if the character is non-alphanumeric and can be used in an @@ -25385,7 +25385,7 @@ SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[] = { ** non-ASCII UTF character. Hence the test for whether or not a character is ** part of an identifier is 0x46. */ -SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[256] = { +SQLITE_PRIVATE const unsigned char tdsqlite3CtypeMap[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00..07 ........ */ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, /* 08..0f ........ */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 10..17 ........ */ @@ -25483,9 +25483,9 @@ SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[256] = { ** The default lookaside-configuration, the format "SZ,N". SZ is the ** number of bytes in each lookaside slot (should be a multiple of 8) ** and N is the number of slots. The lookaside-configuration can be -** changed as start-time using sqlite3_config(SQLITE_CONFIG_LOOKASIDE) +** changed as start-time using tdsqlite3_config(SQLITE_CONFIG_LOOKASIDE) ** or at run-time for an individual database connection using -** sqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE); +** tdsqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE); ** ** With the two-size-lookaside enhancement, less lookaside is required. ** The default configuration of 1200,40 actually provides 30 1200-byte slots @@ -25502,7 +25502,7 @@ SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[256] = { /* The default maximum size of an in-memory database created using -** sqlite3_deserialize() +** tdsqlite3_deserialize() */ #ifndef SQLITE_MEMDB_DEFAULT_MAXSIZE # define SQLITE_MEMDB_DEFAULT_MAXSIZE 1073741824 @@ -25512,7 +25512,7 @@ SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[256] = { ** The following singleton contains the global configuration for ** the SQLite library. */ -SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = { +SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config tdsqlite3Config = { SQLITE_DEFAULT_MEMSTATUS, /* bMemstat */ 1, /* bCoreMutex */ SQLITE_THREADSAFE==1, /* bFullMutex */ @@ -25573,14 +25573,14 @@ SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = { ** database connections. After initialization, this table is ** read-only. */ -SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions; +SQLITE_PRIVATE FuncDefHash tdsqlite3BuiltinFunctions; #ifdef VDBE_PROFILE /* ** The following performance counter can be used in place of -** sqlite3Hwtime() for profiling. This is a no-op on standard builds. +** tdsqlite3Hwtime() for profiling. This is a no-op on standard builds. */ -SQLITE_PRIVATE sqlite3_uint64 sqlite3NProfileCnt = 0; +SQLITE_PRIVATE tdsqlite3_uint64 tdsqlite3NProfileCnt = 0; #endif /* @@ -25593,7 +25593,7 @@ SQLITE_PRIVATE sqlite3_uint64 sqlite3NProfileCnt = 0; ** During testing, it is often desirable to move the pending byte to ** a different position in the file. This allows code that has to ** deal with the pending byte to run on files that are much smaller -** than 1 GiB. The sqlite3_test_control() interface can be used to +** than 1 GiB. The tdsqlite3_test_control() interface can be used to ** move the pending byte. ** ** IMPORTANT: Changing the pending byte to any value other than @@ -25602,7 +25602,7 @@ SQLITE_PRIVATE sqlite3_uint64 sqlite3NProfileCnt = 0; ** and incorrect behavior. */ #ifndef SQLITE_OMIT_WSD -SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000; +SQLITE_PRIVATE int tdsqlite3PendingByte = 0x40000000; #endif /* #include "opcodes.h" */ @@ -25612,12 +25612,12 @@ SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000; ** from the comments following the "case OP_xxxx:" statements in ** the vdbe.c file. */ -SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER; +SQLITE_PRIVATE const unsigned char tdsqlite3OpcodeProperty[] = OPFLG_INITIALIZER; /* ** Name of the default collating sequence */ -SQLITE_PRIVATE const char sqlite3StrBINARY[] = "BINARY"; +SQLITE_PRIVATE const char tdsqlite3StrBINARY[] = "BINARY"; /************** End of global.c **********************************************/ /************** Begin file status.c ******************************************/ @@ -25633,7 +25633,7 @@ SQLITE_PRIVATE const char sqlite3StrBINARY[] = "BINARY"; ** ************************************************************************* ** -** This module implements the sqlite3_status() interface and related +** This module implements the tdsqlite3_status() interface and related ** functionality. */ /* #include "sqliteInt.h" */ @@ -25717,11 +25717,11 @@ struct VdbeCursor { u8 eCurType; /* One of the CURTYPE_* values above */ i8 iDb; /* Index of cursor database in db->aDb[] (or -1) */ u8 nullRow; /* True if pointing to a row with no data */ - u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */ + u8 deferredMoveto; /* A call to tdsqlite3BtreeMoveto() is needed */ u8 isTable; /* True for rowid tables. False for indexes */ #ifdef SQLITE_DEBUG u8 seekOp; /* Most recent seek operation on this cursor */ - u8 wrFlag; /* The wrFlag argument to sqlite3BtreeCursor() */ + u8 wrFlag; /* The wrFlag argument to tdsqlite3BtreeCursor() */ #endif Bool isEphemeral:1; /* True for an ephemeral table */ Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */ @@ -25736,7 +25736,7 @@ struct VdbeCursor { ** CACHE_STALE (0) and so setting cacheStatus=CACHE_STALE guarantees that ** the cache is out of date. */ u32 cacheStatus; /* Cache is valid if this matches Vdbe.cacheCtr */ - int seekResult; /* Result of previous sqlite3BtreeMoveto() or 0 + int seekResult; /* Result of previous tdsqlite3BtreeMoveto() or 0 ** if there have been no prior seeks on the cursor. */ /* seekResult does not distinguish between "no seeks have ever occurred ** on this cursor" and "the most recent seek was an exact match". @@ -25748,7 +25748,7 @@ struct VdbeCursor { VdbeCursor *pAltCursor; /* Associated index cursor from which to read */ union { BtCursor *pCursor; /* CURTYPE_BTREE or _PSEUDO. Btree cursor */ - sqlite3_vtab_cursor *pVCur; /* CURTYPE_VTAB. Vtab cursor */ + tdsqlite3_vtab_cursor *pVCur; /* CURTYPE_VTAB. Vtab cursor */ VdbeSorter *pSorter; /* CURTYPE_SORTER. Sorter object */ } uc; KeyInfo *pKeyInfo; /* Info about index keys needed by index cursors */ @@ -25756,7 +25756,7 @@ struct VdbeCursor { Pgno pgnoRoot; /* Root page of the open btree cursor */ i16 nField; /* Number of fields in the header */ u16 nHdrParsed; /* Number of header fields parsed so far */ - i64 movetoTarget; /* Argument to the deferred sqlite3BtreeMoveto() */ + i64 movetoTarget; /* Argument to the deferred tdsqlite3BtreeMoveto() */ u32 *aOffset; /* Pointer to aType[nField] */ const u8 *aRow; /* Data for the current row, if all on one page */ u32 payloadSize; /* Total number of bytes in the record */ @@ -25792,7 +25792,7 @@ struct VdbeCursor { ** is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame ** list is deleted when the VM is reset in VdbeHalt(). The reason for doing ** this instead of deleting the VdbeFrame immediately is to avoid recursive -** calls to sqlite3VdbeMemRelease() when the memory cells belonging to the +** calls to tdsqlite3VdbeMemRelease() when the memory cells belonging to the ** child frame are released. ** ** The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is @@ -25837,7 +25837,7 @@ struct VdbeFrame { ** structures. Each Mem struct may cache multiple representations (string, ** integer etc.) of the same value. */ -struct sqlite3_value { +struct tdsqlite3_value { union MemValue { double r; /* Real value used when MEM_Real is set in flags */ i64 i; /* Integer value used when MEM_Int is set in flags */ @@ -25854,7 +25854,7 @@ struct sqlite3_value { char *zMalloc; /* Space to hold MEM_Str or MEM_Blob if szMalloc>0 */ int szMalloc; /* Size of the zMalloc allocation */ u32 uTemp; /* Transient storage for serial_type in OP_MakeRecord */ - sqlite3 *db; /* The associated database connection */ + tdsqlite3 *db; /* The associated database connection */ void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */ #ifdef SQLITE_DEBUG Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ @@ -25872,8 +25872,8 @@ struct sqlite3_value { ** representations of the value stored in the Mem struct. ** ** If the MEM_Null flag is set, then the value is an SQL NULL value. -** For a pointer type created using sqlite3_bind_pointer() or -** sqlite3_result_pointer() the MEM_Term and MEM_Subtype flags are also set. +** For a pointer type created using tdsqlite3_bind_pointer() or +** tdsqlite3_result_pointer() the MEM_Term and MEM_Subtype flags are also set. ** ** If the MEM_Str flag is set then Mem.z points at a string representation. ** Usually this is encoded in the same unicode encoding as the main @@ -25888,7 +25888,7 @@ struct sqlite3_value { #define MEM_Blob 0x0010 /* Value is a BLOB */ #define MEM_IntReal 0x0020 /* MEM_Int that stringifies like MEM_Real */ #define MEM_AffMask 0x003f /* Mask of affinity bits */ -#define MEM_FromBind 0x0040 /* Value originates from sqlite3_bind() */ +#define MEM_FromBind 0x0040 /* Value originates from tdsqlite3_bind() */ #define MEM_Undefined 0x0080 /* Value is undefined */ #define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */ #define MEM_TypeMask 0xc1bf /* Mask of type bits */ @@ -25940,7 +25940,7 @@ struct sqlite3_value { /* ** Each auxiliary data pointer stored by a user defined function -** implementation calling sqlite3_set_auxdata() is stored in an instance +** implementation calling tdsqlite3_set_auxdata() is stored in an instance ** of this structure. All such structures associated with a single VM ** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed ** when the VM is halted (if not before). @@ -25966,7 +25966,7 @@ struct AuxData { ** This structure is defined inside of vdbeInt.h because it uses substructures ** (Mem) which are only defined there. */ -struct sqlite3_context { +struct tdsqlite3_context { Mem *pOut; /* The return value is stored here */ FuncDef *pFunc; /* Pointer to function information */ Mem *pMem; /* Memory cell used to store aggregate context */ @@ -25975,7 +25975,7 @@ struct sqlite3_context { int isError; /* Error code returned by the function. */ u8 skipFlag; /* Skip accumulator loading if true */ u8 argc; /* Number of arguments */ - sqlite3_value *argv[1]; /* Argument set */ + tdsqlite3_value *argv[1]; /* Argument set */ }; /* A bitfield type for use inside of structures. Always follow with :N where @@ -25984,7 +25984,7 @@ struct sqlite3_context { typedef unsigned bft; /* Bit Field Type */ /* The ScanStatus object holds a single value for the -** sqlite3_stmt_scanstatus() interface. +** tdsqlite3_stmt_scanstatus() interface. */ typedef struct ScanStatus ScanStatus; struct ScanStatus { @@ -26013,11 +26013,11 @@ struct DblquoteStr { ** An instance of the virtual machine. This structure contains the complete ** state of the virtual machine. ** -** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare() +** The "tdsqlite3_stmt" structure pointer that is returned by tdsqlite3_prepare() ** is really a pointer to an instance of this structure. */ struct Vdbe { - sqlite3 *db; /* The database connection that owns this statement */ + tdsqlite3 *db; /* The database connection that owns this statement */ Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */ Parse *pParse; /* Parsing context used to create this Vdbe */ ynVar nVar; /* Number of entries in aVar[] */ @@ -26052,7 +26052,7 @@ struct Vdbe { i64 startTime; /* Time when query started - used for profiling */ #endif #ifdef SQLITE_DEBUG - int rcApp; /* errcode set by sqlite3_result_error_code() */ + int rcApp; /* errcode set by tdsqlite3_result_error_code() */ u32 nWrite; /* Number of write operations that have occurred */ #endif u16 nResColumn; /* Number of columns in one row of the result set */ @@ -26069,7 +26069,7 @@ struct Vdbe { bft bIsReader:1; /* True for statements that read */ yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */ yDbMask lockMask; /* Subset of btreeMask that requires a lock */ - u32 aCounter[7]; /* Counters used by sqlite3_stmt_status() */ + u32 aCounter[7]; /* Counters used by tdsqlite3_stmt_status() */ char *zSql; /* Text of the SQL statement that generated this */ #ifdef SQLITE_ENABLE_NORMALIZE char *zNormSql; /* Normalization of the associated SQL statement */ @@ -26085,7 +26085,7 @@ struct Vdbe { #ifdef SQLITE_ENABLE_STMT_SCANSTATUS i64 *anExec; /* Number of times each op has been executed */ int nScan; /* Entries in aScan[] */ - ScanStatus *aScan; /* Scan definitions for sqlite3_stmt_scanstatus() */ + ScanStatus *aScan; /* Scan definitions for tdsqlite3_stmt_scanstatus() */ #endif }; @@ -26100,7 +26100,7 @@ struct Vdbe { /* ** Structure used to store the context required by the -** sqlite3_preupdate_*() API functions. +** tdsqlite3_preupdate_*() API functions. */ struct PreUpdate { Vdbe *v; @@ -26121,134 +26121,134 @@ struct PreUpdate { /* ** Function prototypes */ -SQLITE_PRIVATE void sqlite3VdbeError(Vdbe*, const char *, ...); -SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*); +SQLITE_PRIVATE void tdsqlite3VdbeError(Vdbe*, const char *, ...); +SQLITE_PRIVATE void tdsqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*); void sqliteVdbePopStack(Vdbe*,int); -SQLITE_PRIVATE int SQLITE_NOINLINE sqlite3VdbeFinishMoveto(VdbeCursor*); -SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor**, int*); -SQLITE_PRIVATE int sqlite3VdbeCursorRestore(VdbeCursor*); -SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32); -SQLITE_PRIVATE u8 sqlite3VdbeOneByteSerialTypeLen(u8); -SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32); -SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); -SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int); +SQLITE_PRIVATE int SQLITE_NOINLINE tdsqlite3VdbeFinishMoveto(VdbeCursor*); +SQLITE_PRIVATE int tdsqlite3VdbeCursorMoveto(VdbeCursor**, int*); +SQLITE_PRIVATE int tdsqlite3VdbeCursorRestore(VdbeCursor*); +SQLITE_PRIVATE u32 tdsqlite3VdbeSerialTypeLen(u32); +SQLITE_PRIVATE u8 tdsqlite3VdbeOneByteSerialTypeLen(u8); +SQLITE_PRIVATE u32 tdsqlite3VdbeSerialPut(unsigned char*, Mem*, u32); +SQLITE_PRIVATE u32 tdsqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); +SQLITE_PRIVATE void tdsqlite3VdbeDeleteAuxData(tdsqlite3*, AuxData**, int, int); int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *); -SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(sqlite3*,VdbeCursor*,UnpackedRecord*,int*); -SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3*, BtCursor*, i64*); -SQLITE_PRIVATE int sqlite3VdbeExec(Vdbe*); +SQLITE_PRIVATE int tdsqlite3VdbeIdxKeyCompare(tdsqlite3*,VdbeCursor*,UnpackedRecord*,int*); +SQLITE_PRIVATE int tdsqlite3VdbeIdxRowid(tdsqlite3*, BtCursor*, i64*); +SQLITE_PRIVATE int tdsqlite3VdbeExec(Vdbe*); #ifndef SQLITE_OMIT_EXPLAIN -SQLITE_PRIVATE int sqlite3VdbeList(Vdbe*); +SQLITE_PRIVATE int tdsqlite3VdbeList(Vdbe*); #endif -SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe*); -SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *, int); -SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem*, const Mem*); -SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int); -SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem*, Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*)); -SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem*, i64); +SQLITE_PRIVATE int tdsqlite3VdbeHalt(Vdbe*); +SQLITE_PRIVATE int tdsqlite3VdbeChangeEncoding(Mem *, int); +SQLITE_PRIVATE int tdsqlite3VdbeMemTooBig(Mem*); +SQLITE_PRIVATE int tdsqlite3VdbeMemCopy(Mem*, const Mem*); +SQLITE_PRIVATE void tdsqlite3VdbeMemShallowCopy(Mem*, const Mem*, int); +SQLITE_PRIVATE void tdsqlite3VdbeMemMove(Mem*, Mem*); +SQLITE_PRIVATE int tdsqlite3VdbeMemNulTerminate(Mem*); +SQLITE_PRIVATE int tdsqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*)); +SQLITE_PRIVATE void tdsqlite3VdbeMemSetInt64(Mem*, i64); #ifdef SQLITE_OMIT_FLOATING_POINT -# define sqlite3VdbeMemSetDouble sqlite3VdbeMemSetInt64 +# define tdsqlite3VdbeMemSetDouble tdsqlite3VdbeMemSetInt64 #else -SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem*, double); +SQLITE_PRIVATE void tdsqlite3VdbeMemSetDouble(Mem*, double); #endif -SQLITE_PRIVATE void sqlite3VdbeMemSetPointer(Mem*, void*, const char*, void(*)(void*)); -SQLITE_PRIVATE void sqlite3VdbeMemInit(Mem*,sqlite3*,u16); -SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem*); -SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem*,int); +SQLITE_PRIVATE void tdsqlite3VdbeMemSetPointer(Mem*, void*, const char*, void(*)(void*)); +SQLITE_PRIVATE void tdsqlite3VdbeMemInit(Mem*,tdsqlite3*,u16); +SQLITE_PRIVATE void tdsqlite3VdbeMemSetNull(Mem*); +SQLITE_PRIVATE void tdsqlite3VdbeMemSetZeroBlob(Mem*,int); #ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3VdbeMemIsRowSet(const Mem*); +SQLITE_PRIVATE int tdsqlite3VdbeMemIsRowSet(const Mem*); #endif -SQLITE_PRIVATE int sqlite3VdbeMemSetRowSet(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem*, u8, u8); -SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem*); -SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem*); -SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem*, int ifNull); -SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemCast(Mem*,u8,u8); -SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,Mem*); -SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p); -SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*); +SQLITE_PRIVATE int tdsqlite3VdbeMemSetRowSet(Mem*); +SQLITE_PRIVATE int tdsqlite3VdbeMemMakeWriteable(Mem*); +SQLITE_PRIVATE int tdsqlite3VdbeMemStringify(Mem*, u8, u8); +SQLITE_PRIVATE i64 tdsqlite3VdbeIntValue(Mem*); +SQLITE_PRIVATE int tdsqlite3VdbeMemIntegerify(Mem*); +SQLITE_PRIVATE double tdsqlite3VdbeRealValue(Mem*); +SQLITE_PRIVATE int tdsqlite3VdbeBooleanValue(Mem*, int ifNull); +SQLITE_PRIVATE void tdsqlite3VdbeIntegerAffinity(Mem*); +SQLITE_PRIVATE int tdsqlite3VdbeMemRealify(Mem*); +SQLITE_PRIVATE int tdsqlite3VdbeMemNumerify(Mem*); +SQLITE_PRIVATE int tdsqlite3VdbeMemCast(Mem*,u8,u8); +SQLITE_PRIVATE int tdsqlite3VdbeMemFromBtree(BtCursor*,u32,u32,Mem*); +SQLITE_PRIVATE void tdsqlite3VdbeMemRelease(Mem *p); +SQLITE_PRIVATE int tdsqlite3VdbeMemFinalize(Mem*, FuncDef*); #ifndef SQLITE_OMIT_WINDOWFUNC -SQLITE_PRIVATE int sqlite3VdbeMemAggValue(Mem*, Mem*, FuncDef*); +SQLITE_PRIVATE int tdsqlite3VdbeMemAggValue(Mem*, Mem*, FuncDef*); #endif #ifndef SQLITE_OMIT_EXPLAIN -SQLITE_PRIVATE const char *sqlite3OpcodeName(int); +SQLITE_PRIVATE const char *tdsqlite3OpcodeName(int); #endif -SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); -SQLITE_PRIVATE int sqlite3VdbeMemClearAndResize(Mem *pMem, int n); -SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int); +SQLITE_PRIVATE int tdsqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); +SQLITE_PRIVATE int tdsqlite3VdbeMemClearAndResize(Mem *pMem, int n); +SQLITE_PRIVATE int tdsqlite3VdbeCloseStatement(Vdbe *, int); #ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3VdbeFrameIsValid(VdbeFrame*); +SQLITE_PRIVATE int tdsqlite3VdbeFrameIsValid(VdbeFrame*); #endif -SQLITE_PRIVATE void sqlite3VdbeFrameMemDel(void*); /* Destructor on Mem */ -SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); /* Actually deletes the Frame */ -SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *); +SQLITE_PRIVATE void tdsqlite3VdbeFrameMemDel(void*); /* Destructor on Mem */ +SQLITE_PRIVATE void tdsqlite3VdbeFrameDelete(VdbeFrame*); /* Actually deletes the Frame */ +SQLITE_PRIVATE int tdsqlite3VdbeFrameRestore(VdbeFrame *); #ifdef SQLITE_ENABLE_PREUPDATE_HOOK -SQLITE_PRIVATE void sqlite3VdbePreUpdateHook(Vdbe*,VdbeCursor*,int,const char*,Table*,i64,int); +SQLITE_PRIVATE void tdsqlite3VdbePreUpdateHook(Vdbe*,VdbeCursor*,int,const char*,Table*,i64,int); #endif -SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p); +SQLITE_PRIVATE int tdsqlite3VdbeTransferError(Vdbe *p); -SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, int, VdbeCursor *); -SQLITE_PRIVATE void sqlite3VdbeSorterReset(sqlite3 *, VdbeSorter *); -SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *); -SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *); -SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *, const VdbeCursor *); -SQLITE_PRIVATE int sqlite3VdbeSorterRewind(const VdbeCursor *, int *); -SQLITE_PRIVATE int sqlite3VdbeSorterWrite(const VdbeCursor *, Mem *); -SQLITE_PRIVATE int sqlite3VdbeSorterCompare(const VdbeCursor *, Mem *, int, int *); +SQLITE_PRIVATE int tdsqlite3VdbeSorterInit(tdsqlite3 *, int, VdbeCursor *); +SQLITE_PRIVATE void tdsqlite3VdbeSorterReset(tdsqlite3 *, VdbeSorter *); +SQLITE_PRIVATE void tdsqlite3VdbeSorterClose(tdsqlite3 *, VdbeCursor *); +SQLITE_PRIVATE int tdsqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *); +SQLITE_PRIVATE int tdsqlite3VdbeSorterNext(tdsqlite3 *, const VdbeCursor *); +SQLITE_PRIVATE int tdsqlite3VdbeSorterRewind(const VdbeCursor *, int *); +SQLITE_PRIVATE int tdsqlite3VdbeSorterWrite(const VdbeCursor *, Mem *); +SQLITE_PRIVATE int tdsqlite3VdbeSorterCompare(const VdbeCursor *, Mem *, int, int *); #ifdef SQLITE_DEBUG -SQLITE_PRIVATE void sqlite3VdbeIncrWriteCounter(Vdbe*, VdbeCursor*); -SQLITE_PRIVATE void sqlite3VdbeAssertAbortable(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeIncrWriteCounter(Vdbe*, VdbeCursor*); +SQLITE_PRIVATE void tdsqlite3VdbeAssertAbortable(Vdbe*); #else -# define sqlite3VdbeIncrWriteCounter(V,C) -# define sqlite3VdbeAssertAbortable(V) +# define tdsqlite3VdbeIncrWriteCounter(V,C) +# define tdsqlite3VdbeAssertAbortable(V) #endif #if !defined(SQLITE_OMIT_SHARED_CACHE) -SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeEnter(Vdbe*); #else -# define sqlite3VdbeEnter(X) +# define tdsqlite3VdbeEnter(X) #endif #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0 -SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeLeave(Vdbe*); #else -# define sqlite3VdbeLeave(X) +# define tdsqlite3VdbeLeave(X) #endif #ifdef SQLITE_DEBUG -SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe*,Mem*); -SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem*); +SQLITE_PRIVATE void tdsqlite3VdbeMemAboutToChange(Vdbe*,Mem*); +SQLITE_PRIVATE int tdsqlite3VdbeCheckMemInvariants(Mem*); #endif #ifndef SQLITE_OMIT_FOREIGN_KEY -SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int); +SQLITE_PRIVATE int tdsqlite3VdbeCheckFk(Vdbe *, int); #else -# define sqlite3VdbeCheckFk(p,i) 0 +# define tdsqlite3VdbeCheckFk(p,i) 0 #endif #ifdef SQLITE_DEBUG -SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, StrAccum *pStr); +SQLITE_PRIVATE void tdsqlite3VdbePrintSql(Vdbe*); +SQLITE_PRIVATE void tdsqlite3VdbeMemPrettyPrint(Mem *pMem, StrAccum *pStr); #endif #ifndef SQLITE_OMIT_UTF16 -SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem*, u8); -SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem); +SQLITE_PRIVATE int tdsqlite3VdbeMemTranslate(Mem*, u8); +SQLITE_PRIVATE int tdsqlite3VdbeMemHandleBom(Mem *pMem); #endif #ifndef SQLITE_OMIT_INCRBLOB -SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *); - #define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0) +SQLITE_PRIVATE int tdsqlite3VdbeMemExpandBlob(Mem *); + #define ExpandBlob(P) (((P)->flags&MEM_Zero)?tdsqlite3VdbeMemExpandBlob(P):0) #else - #define sqlite3VdbeMemExpandBlob(x) SQLITE_OK + #define tdsqlite3VdbeMemExpandBlob(x) SQLITE_OK #define ExpandBlob(P) SQLITE_OK #endif @@ -26261,18 +26261,18 @@ SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *); ** Variables in which to record status information. */ #if SQLITE_PTRSIZE>4 -typedef sqlite3_int64 sqlite3StatValueType; +typedef tdsqlite3_int64 tdsqlite3StatValueType; #else -typedef u32 sqlite3StatValueType; +typedef u32 tdsqlite3StatValueType; #endif -typedef struct sqlite3StatType sqlite3StatType; -static SQLITE_WSD struct sqlite3StatType { - sqlite3StatValueType nowValue[10]; /* Current value */ - sqlite3StatValueType mxValue[10]; /* Maximum value */ -} sqlite3Stat = { {0,}, {0,} }; +typedef struct tdsqlite3StatType tdsqlite3StatType; +static SQLITE_WSD struct tdsqlite3StatType { + tdsqlite3StatValueType nowValue[10]; /* Current value */ + tdsqlite3StatValueType mxValue[10]; /* Maximum value */ +} tdsqlite3Stat = { {0,}, {0,} }; /* -** Elements of sqlite3Stat[] are protected by either the memory allocator +** Elements of tdsqlite3Stat[] are protected by either the memory allocator ** mutex, or by the pcache1 mutex. The following array determines which. */ static const char statMutex[] = { @@ -26293,26 +26293,26 @@ static const char statMutex[] = { ** state vector. If writable static data is unsupported on the target, ** we have to locate the state vector at run-time. In the more common ** case where writable static data is supported, wsdStat can refer directly -** to the "sqlite3Stat" state vector declared above. +** to the "tdsqlite3Stat" state vector declared above. */ #ifdef SQLITE_OMIT_WSD -# define wsdStatInit sqlite3StatType *x = &GLOBAL(sqlite3StatType,sqlite3Stat) +# define wsdStatInit tdsqlite3StatType *x = &GLOBAL(tdsqlite3StatType,tdsqlite3Stat) # define wsdStat x[0] #else # define wsdStatInit -# define wsdStat sqlite3Stat +# define wsdStat tdsqlite3Stat #endif /* ** Return the current value of a status parameter. The caller must ** be holding the appropriate mutex. */ -SQLITE_PRIVATE sqlite3_int64 sqlite3StatusValue(int op){ +SQLITE_PRIVATE tdsqlite3_int64 tdsqlite3StatusValue(int op){ wsdStatInit; assert( op>=0 && op=0 && op=0 && op=0 && opwsdStat.mxValue[op] ){ wsdStat.mxValue[op] = wsdStat.nowValue[op]; } } -SQLITE_PRIVATE void sqlite3StatusDown(int op, int N){ +SQLITE_PRIVATE void tdsqlite3StatusDown(int op, int N){ wsdStatInit; assert( N>=0 ); assert( op>=0 && op=0 && op=0 ); - newValue = (sqlite3StatValueType)X; + newValue = (tdsqlite3StatValueType)X; assert( op>=0 && op=0 && op=ArraySize(wsdStat.nowValue) ){ return SQLITE_MISUSE_BKPT; @@ -26386,24 +26386,24 @@ SQLITE_API int sqlite3_status64( #ifdef SQLITE_ENABLE_API_ARMOR if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT; #endif - pMutex = statMutex[op] ? sqlite3Pcache1Mutex() : sqlite3MallocMutex(); - sqlite3_mutex_enter(pMutex); + pMutex = statMutex[op] ? tdsqlite3Pcache1Mutex() : tdsqlite3MallocMutex(); + tdsqlite3_mutex_enter(pMutex); *pCurrent = wsdStat.nowValue[op]; *pHighwater = wsdStat.mxValue[op]; if( resetFlag ){ wsdStat.mxValue[op] = wsdStat.nowValue[op]; } - sqlite3_mutex_leave(pMutex); + tdsqlite3_mutex_leave(pMutex); (void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */ return SQLITE_OK; } -SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){ - sqlite3_int64 iCur = 0, iHwtr = 0; +SQLITE_API int tdsqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){ + tdsqlite3_int64 iCur = 0, iHwtr = 0; int rc; #ifdef SQLITE_ENABLE_API_ARMOR if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT; #endif - rc = sqlite3_status64(op, &iCur, &iHwtr, resetFlag); + rc = tdsqlite3_status64(op, &iCur, &iHwtr, resetFlag); if( rc==0 ){ *pCurrent = (int)iCur; *pHighwater = (int)iHwtr; @@ -26426,7 +26426,7 @@ static u32 countLookasideSlots(LookasideSlot *p){ /* ** Count the number of slots of lookaside memory that are outstanding */ -SQLITE_PRIVATE int sqlite3LookasideUsed(sqlite3 *db, int *pHighwater){ +SQLITE_PRIVATE int tdsqlite3LookasideUsed(tdsqlite3 *db, int *pHighwater){ u32 nInit = countLookasideSlots(db->lookaside.pInit); u32 nFree = countLookasideSlots(db->lookaside.pFree); #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE @@ -26440,8 +26440,8 @@ SQLITE_PRIVATE int sqlite3LookasideUsed(sqlite3 *db, int *pHighwater){ /* ** Query status information for a single database connection */ -SQLITE_API int sqlite3_db_status( - sqlite3 *db, /* The database connection whose status is desired */ +SQLITE_API int tdsqlite3_db_status( + tdsqlite3 *db, /* The database connection whose status is desired */ int op, /* Status verb */ int *pCurrent, /* Write current value here */ int *pHighwater, /* Write high-water mark here */ @@ -26449,14 +26449,14 @@ SQLITE_API int sqlite3_db_status( ){ int rc = SQLITE_OK; /* Return code */ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || pCurrent==0|| pHighwater==0 ){ + if( !tdsqlite3SafetyCheckOk(db) || pCurrent==0|| pHighwater==0 ){ return SQLITE_MISUSE_BKPT; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); switch( op ){ case SQLITE_DBSTATUS_LOOKASIDE_USED: { - *pCurrent = sqlite3LookasideUsed(db, pHighwater); + *pCurrent = tdsqlite3LookasideUsed(db, pHighwater); if( resetFlag ){ LookasideSlot *p = db->lookaside.pFree; if( p ){ @@ -26503,19 +26503,19 @@ SQLITE_API int sqlite3_db_status( case SQLITE_DBSTATUS_CACHE_USED: { int totalUsed = 0; int i; - sqlite3BtreeEnterAll(db); + tdsqlite3BtreeEnterAll(db); for(i=0; inDb; i++){ Btree *pBt = db->aDb[i].pBt; if( pBt ){ - Pager *pPager = sqlite3BtreePager(pBt); - int nByte = sqlite3PagerMemUsed(pPager); + Pager *pPager = tdsqlite3BtreePager(pBt); + int nByte = tdsqlite3PagerMemUsed(pPager); if( op==SQLITE_DBSTATUS_CACHE_USED_SHARED ){ - nByte = nByte / sqlite3BtreeConnectionCount(pBt); + nByte = nByte / tdsqlite3BtreeConnectionCount(pBt); } totalUsed += nByte; } } - sqlite3BtreeLeaveAll(db); + tdsqlite3BtreeLeaveAll(db); *pCurrent = totalUsed; *pHighwater = 0; break; @@ -26530,34 +26530,34 @@ SQLITE_API int sqlite3_db_status( int i; /* Used to iterate through schemas */ int nByte = 0; /* Used to accumulate return value */ - sqlite3BtreeEnterAll(db); + tdsqlite3BtreeEnterAll(db); db->pnBytesFreed = &nByte; for(i=0; inDb; i++){ Schema *pSchema = db->aDb[i].pSchema; if( ALWAYS(pSchema!=0) ){ HashElem *p; - nByte += sqlite3GlobalConfig.m.xRoundup(sizeof(HashElem)) * ( + nByte += tdsqlite3GlobalConfig.m.xRoundup(sizeof(HashElem)) * ( pSchema->tblHash.count + pSchema->trigHash.count + pSchema->idxHash.count + pSchema->fkeyHash.count ); - nByte += sqlite3_msize(pSchema->tblHash.ht); - nByte += sqlite3_msize(pSchema->trigHash.ht); - nByte += sqlite3_msize(pSchema->idxHash.ht); - nByte += sqlite3_msize(pSchema->fkeyHash.ht); + nByte += tdsqlite3_msize(pSchema->tblHash.ht); + nByte += tdsqlite3_msize(pSchema->trigHash.ht); + nByte += tdsqlite3_msize(pSchema->idxHash.ht); + nByte += tdsqlite3_msize(pSchema->fkeyHash.ht); for(p=sqliteHashFirst(&pSchema->trigHash); p; p=sqliteHashNext(p)){ - sqlite3DeleteTrigger(db, (Trigger*)sqliteHashData(p)); + tdsqlite3DeleteTrigger(db, (Trigger*)sqliteHashData(p)); } for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){ - sqlite3DeleteTable(db, (Table *)sqliteHashData(p)); + tdsqlite3DeleteTable(db, (Table *)sqliteHashData(p)); } } } db->pnBytesFreed = 0; - sqlite3BtreeLeaveAll(db); + tdsqlite3BtreeLeaveAll(db); *pHighwater = 0; *pCurrent = nByte; @@ -26575,8 +26575,8 @@ SQLITE_API int sqlite3_db_status( db->pnBytesFreed = &nByte; for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){ - sqlite3VdbeClearObject(db, pVdbe); - sqlite3DbFree(db, pVdbe); + tdsqlite3VdbeClearObject(db, pVdbe); + tdsqlite3DbFree(db, pVdbe); } db->pnBytesFreed = 0; @@ -26604,8 +26604,8 @@ SQLITE_API int sqlite3_db_status( for(i=0; inDb; i++){ if( db->aDb[i].pBt ){ - Pager *pPager = sqlite3BtreePager(db->aDb[i].pBt); - sqlite3PagerCacheStat(pPager, op, resetFlag, &nRet); + Pager *pPager = tdsqlite3BtreePager(db->aDb[i].pBt); + tdsqlite3PagerCacheStat(pPager, op, resetFlag, &nRet); } } *pHighwater = 0; /* IMP: R-42420-56072 */ @@ -26629,7 +26629,7 @@ SQLITE_API int sqlite3_db_status( rc = SQLITE_ERROR; } } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return rc; } @@ -26650,7 +26650,7 @@ SQLITE_API int sqlite3_db_status( ** functions for SQLite. ** ** There is only one exported symbol in this file - the function -** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. +** tdsqlite3RegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** ** SQLite processes all times and dates as julian day numbers. The @@ -26702,7 +26702,7 @@ struct tm *__cdecl localtime(const time_t *); */ typedef struct DateTime DateTime; struct DateTime { - sqlite3_int64 iJD; /* The julian day number times 86400000 */ + tdsqlite3_int64 iJD; /* The julian day number times 86400000 */ int Y, M, D; /* Year, month, and day */ int h, m; /* Hour and minutes */ int tz; /* Timezone offset in minutes */ @@ -26763,7 +26763,7 @@ static int getDigits(const char *zDate, const char *zFormat, ...){ nextC = zFormat[3]; val = 0; while( N-- ){ - if( !sqlite3Isdigit(*zDate) ){ + if( !tdsqlite3Isdigit(*zDate) ){ goto end_getDigits; } val = val*10 + *zDate - '0'; @@ -26802,7 +26802,7 @@ static int parseTimezone(const char *zDate, DateTime *p){ int sgn = 0; int nHr, nMn; int c; - while( sqlite3Isspace(*zDate) ){ zDate++; } + while( tdsqlite3Isspace(*zDate) ){ zDate++; } p->tz = 0; c = *zDate; if( c=='-' ){ @@ -26822,7 +26822,7 @@ static int parseTimezone(const char *zDate, DateTime *p){ zDate += 5; p->tz = sgn*(nMn + nHr*60); zulu_time: - while( sqlite3Isspace(*zDate) ){ zDate++; } + while( tdsqlite3Isspace(*zDate) ){ zDate++; } p->tzSet = 1; return *zDate!=0; } @@ -26847,10 +26847,10 @@ static int parseHhMmSs(const char *zDate, DateTime *p){ return 1; } zDate += 2; - if( *zDate=='.' && sqlite3Isdigit(zDate[1]) ){ + if( *zDate=='.' && tdsqlite3Isdigit(zDate[1]) ){ double rScale = 1.0; zDate++; - while( sqlite3Isdigit(*zDate) ){ + while( tdsqlite3Isdigit(*zDate) ){ ms = ms*10.0 + *zDate - '0'; rScale *= 10.0; zDate++; @@ -26910,10 +26910,10 @@ static void computeJD(DateTime *p){ B = 2 - A + (A/4); X1 = 36525*(Y+4716)/100; X2 = 306001*(M+1)/10000; - p->iJD = (sqlite3_int64)((X1 + X2 + D + B - 1524.5 ) * 86400000); + p->iJD = (tdsqlite3_int64)((X1 + X2 + D + B - 1524.5 ) * 86400000); p->validJD = 1; if( p->validHMS ){ - p->iJD += p->h*3600000 + p->m*60000 + (sqlite3_int64)(p->s*1000); + p->iJD += p->h*3600000 + p->m*60000 + (tdsqlite3_int64)(p->s*1000); if( p->validTZ ){ p->iJD -= p->tz*60000; p->validYMD = 0; @@ -26948,7 +26948,7 @@ static int parseYyyyMmDd(const char *zDate, DateTime *p){ return 1; } zDate += 10; - while( sqlite3Isspace(*zDate) || 'T'==*(u8*)zDate ){ zDate++; } + while( tdsqlite3Isspace(*zDate) || 'T'==*(u8*)zDate ){ zDate++; } if( parseHhMmSs(zDate, p)==0 ){ /* We got the time */ }else if( *zDate==0 ){ @@ -26972,8 +26972,8 @@ static int parseYyyyMmDd(const char *zDate, DateTime *p){ ** ** Return the number of errors. */ -static int setDateTimeToCurrent(sqlite3_context *context, DateTime *p){ - p->iJD = sqlite3StmtCurrentTime(context); +static int setDateTimeToCurrent(tdsqlite3_context *context, DateTime *p){ + p->iJD = tdsqlite3StmtCurrentTime(context); if( p->iJD>0 ){ p->validJD = 1; return 0; @@ -26992,7 +26992,7 @@ static void setRawDateNumber(DateTime *p, double r){ p->s = r; p->rawS = 1; if( r>=0.0 && r<5373484.5 ){ - p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5); + p->iJD = (tdsqlite3_int64)(r*86400000.0 + 0.5); p->validJD = 1; } } @@ -27014,7 +27014,7 @@ static void setRawDateNumber(DateTime *p, double r){ ** as there is a year and date. */ static int parseDateOrTime( - sqlite3_context *context, + tdsqlite3_context *context, const char *zDate, DateTime *p ){ @@ -27023,9 +27023,9 @@ static int parseDateOrTime( return 0; }else if( parseHhMmSs(zDate, p)==0 ){ return 0; - }else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){ + }else if( tdsqlite3StrICmp(zDate,"now")==0 && tdsqlite3NotPureFunc(context) ){ return setDateTimeToCurrent(context, p); - }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8)>0 ){ + }else if( tdsqlite3AtoF(zDate, &r, tdsqlite3Strlen30(zDate), SQLITE_UTF8)>0 ){ setRawDateNumber(p, r); return 0; } @@ -27046,7 +27046,7 @@ static int parseDateOrTime( ** ** The input is the JulianDay times 86400000. */ -static int validJulianDay(sqlite3_int64 iJD){ +static int validJulianDay(tdsqlite3_int64 iJD){ return iJD>=0 && iJD<=INT_464269060799999; } @@ -27140,7 +27140,7 @@ static void clearYMD_HMS_TZ(DateTime *p){ ** is available. This routine returns 0 on success and ** non-zero on any kind of error. ** -** If the sqlite3GlobalConfig.bLocaltimeFault variable is true then this +** If the tdsqlite3GlobalConfig.bLocaltimeFault variable is true then this ** routine will always fail. ** ** EVIDENCE-OF: R-62172-00036 In this implementation, the standard C @@ -27152,19 +27152,19 @@ static int osLocaltime(time_t *t, struct tm *pTm){ #if !HAVE_LOCALTIME_R && !HAVE_LOCALTIME_S struct tm *pX; #if SQLITE_THREADSAFE>0 - sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); + tdsqlite3_mutex *mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); #endif - sqlite3_mutex_enter(mutex); + tdsqlite3_mutex_enter(mutex); pX = localtime(t); #ifndef SQLITE_UNTESTABLE - if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0; + if( tdsqlite3GlobalConfig.bLocaltimeFault ) pX = 0; #endif if( pX ) *pTm = *pX; - sqlite3_mutex_leave(mutex); + tdsqlite3_mutex_leave(mutex); rc = pX==0; #else #ifndef SQLITE_UNTESTABLE - if( sqlite3GlobalConfig.bLocaltimeFault ) return 1; + if( tdsqlite3GlobalConfig.bLocaltimeFault ) return 1; #endif #if HAVE_LOCALTIME_R rc = localtime_r(t, pTm)==0; @@ -27186,9 +27186,9 @@ static int osLocaltime(time_t *t, struct tm *pTm){ ** Or, if an error does occur, set *pRc to SQLITE_ERROR. The returned value ** is undefined in this case. */ -static sqlite3_int64 localtimeOffset( +static tdsqlite3_int64 localtimeOffset( DateTime *p, /* Date at which to calculate offset */ - sqlite3_context *pCtx, /* Write error here if one occurs */ + tdsqlite3_context *pCtx, /* Write error here if one occurs */ int *pRc /* OUT: Error code. SQLITE_OK or ERROR */ ){ DateTime x, y; @@ -27221,7 +27221,7 @@ static sqlite3_int64 localtimeOffset( computeJD(&x); t = (time_t)(x.iJD/1000 - 21086676*(i64)10000); if( osLocaltime(&t, &sLocal) ){ - sqlite3_result_error(pCtx, "local time unavailable", -1); + tdsqlite3_result_error(pCtx, "local time unavailable", -1); *pRc = SQLITE_ERROR; return 0; } @@ -27291,14 +27291,14 @@ static const struct { ** written to pCtx. */ static int parseModifier( - sqlite3_context *pCtx, /* Function context */ + tdsqlite3_context *pCtx, /* Function context */ const char *z, /* The text of the modifier */ int n, /* Length of zMod in bytes */ DateTime *p /* The date/time value to be modified */ ){ int rc = 1; double r; - switch(sqlite3UpperToLower[(u8)z[0]] ){ + switch(tdsqlite3UpperToLower[(u8)z[0]] ){ #ifndef SQLITE_OMIT_LOCALTIME case 'l': { /* localtime @@ -27306,7 +27306,7 @@ static int parseModifier( ** Assuming the current time value is UTC (a.k.a. GMT), shift it to ** show local time. */ - if( sqlite3_stricmp(z, "localtime")==0 && sqlite3NotPureFunc(pCtx) ){ + if( tdsqlite3_stricmp(z, "localtime")==0 && tdsqlite3NotPureFunc(pCtx) ){ computeJD(p); p->iJD += localtimeOffset(p, pCtx, &rc); clearYMD_HMS_TZ(p); @@ -27321,20 +27321,20 @@ static int parseModifier( ** Treat the current value of p->s as the number of ** seconds since 1970. Convert to a real julian day number. */ - if( sqlite3_stricmp(z, "unixepoch")==0 && p->rawS ){ + if( tdsqlite3_stricmp(z, "unixepoch")==0 && p->rawS ){ r = p->s*1000.0 + 210866760000000.0; if( r>=0.0 && r<464269060800000.0 ){ clearYMD_HMS_TZ(p); - p->iJD = (sqlite3_int64)(r + 0.5); + p->iJD = (tdsqlite3_int64)(r + 0.5); p->validJD = 1; p->rawS = 0; rc = 0; } } #ifndef SQLITE_OMIT_LOCALTIME - else if( sqlite3_stricmp(z, "utc")==0 && sqlite3NotPureFunc(pCtx) ){ + else if( tdsqlite3_stricmp(z, "utc")==0 && tdsqlite3NotPureFunc(pCtx) ){ if( p->tzSet==0 ){ - sqlite3_int64 c1; + tdsqlite3_int64 c1; computeJD(p); c1 = localtimeOffset(p, pCtx, &rc); if( rc==SQLITE_OK ){ @@ -27358,10 +27358,10 @@ static int parseModifier( ** weekday N where 0==Sunday, 1==Monday, and so forth. If the ** date is already on the appropriate weekday, this is a no-op. */ - if( sqlite3_strnicmp(z, "weekday ", 8)==0 - && sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8)>0 + if( tdsqlite3_strnicmp(z, "weekday ", 8)==0 + && tdsqlite3AtoF(&z[8], &r, tdsqlite3Strlen30(&z[8]), SQLITE_UTF8)>0 && (n=(int)r)==r && n>=0 && r<7 ){ - sqlite3_int64 Z; + tdsqlite3_int64 Z; computeYMD_HMS(p); p->validTZ = 0; p->validJD = 0; @@ -27381,7 +27381,7 @@ static int parseModifier( ** Move the date backwards to the beginning of the current day, ** or month or year. */ - if( sqlite3_strnicmp(z, "start of ", 9)!=0 ) break; + if( tdsqlite3_strnicmp(z, "start of ", 9)!=0 ) break; if( !p->validJD && !p->validYMD && !p->validHMS ) break; z += 9; computeYMD(p); @@ -27391,14 +27391,14 @@ static int parseModifier( p->rawS = 0; p->validTZ = 0; p->validJD = 0; - if( sqlite3_stricmp(z,"month")==0 ){ + if( tdsqlite3_stricmp(z,"month")==0 ){ p->D = 1; rc = 0; - }else if( sqlite3_stricmp(z,"year")==0 ){ + }else if( tdsqlite3_stricmp(z,"year")==0 ){ p->M = 1; p->D = 1; rc = 0; - }else if( sqlite3_stricmp(z,"day")==0 ){ + }else if( tdsqlite3_stricmp(z,"day")==0 ){ rc = 0; } break; @@ -27417,8 +27417,8 @@ static int parseModifier( case '9': { double rRounder; int i; - for(n=1; z[n] && z[n]!=':' && !sqlite3Isspace(z[n]); n++){} - if( sqlite3AtoF(z, &r, n, SQLITE_UTF8)<=0 ){ + for(n=1; z[n] && z[n]!=':' && !tdsqlite3Isspace(z[n]); n++){} + if( tdsqlite3AtoF(z, &r, n, SQLITE_UTF8)<=0 ){ rc = 1; break; } @@ -27430,8 +27430,8 @@ static int parseModifier( */ const char *z2 = z; DateTime tx; - sqlite3_int64 day; - if( !sqlite3Isdigit(*z2) ) z2++; + tdsqlite3_int64 day; + if( !tdsqlite3Isdigit(*z2) ) z2++; memset(&tx, 0, sizeof(tx)); if( parseHhMmSs(z2, &tx) ) break; computeJD(&tx); @@ -27449,16 +27449,16 @@ static int parseModifier( /* If control reaches this point, it means the transformation is ** one of the forms like "+NNN days". */ z += n; - while( sqlite3Isspace(*z) ) z++; - n = sqlite3Strlen30(z); + while( tdsqlite3Isspace(*z) ) z++; + n = tdsqlite3Strlen30(z); if( n>10 || n<3 ) break; - if( sqlite3UpperToLower[(u8)z[n-1]]=='s' ) n--; + if( tdsqlite3UpperToLower[(u8)z[n-1]]=='s' ) n--; computeJD(p); rc = 1; rRounder = r<0 ? -0.5 : +0.5; for(i=0; i-aXformType[i].rLimit && riJD += (sqlite3_int64)(r*aXformType[i].rXform + rRounder); + p->iJD += (tdsqlite3_int64)(r*aXformType[i].rXform + rRounder); rc = 0; break; } @@ -27508,9 +27508,9 @@ static int parseModifier( ** then assume a default value of "now" for argv[0]. */ static int isDate( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv, + tdsqlite3_value **argv, DateTime *p ){ int i, n; @@ -27520,18 +27520,18 @@ static int isDate( if( argc==0 ){ return setDateTimeToCurrent(context, p); } - if( (eType = sqlite3_value_type(argv[0]))==SQLITE_FLOAT + if( (eType = tdsqlite3_value_type(argv[0]))==SQLITE_FLOAT || eType==SQLITE_INTEGER ){ - setRawDateNumber(p, sqlite3_value_double(argv[0])); + setRawDateNumber(p, tdsqlite3_value_double(argv[0])); }else{ - z = sqlite3_value_text(argv[0]); + z = tdsqlite3_value_text(argv[0]); if( !z || parseDateOrTime(context, (char*)z, p) ){ return 1; } } for(i=1; i(u64)db->aLimit[SQLITE_LIMIT_LENGTH] ){ - sqlite3_result_error_toobig(context); + tdsqlite3_result_error_toobig(context); return; }else{ - z = sqlite3DbMallocRawNN(db, (int)n); + z = tdsqlite3DbMallocRawNN(db, (int)n); if( z==0 ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); return; } } @@ -27712,15 +27712,15 @@ static void strftimeFunc( }else{ i++; switch( zFmt[i] ){ - case 'd': sqlite3_snprintf(3, &z[j],"%02d",x.D); j+=2; break; + case 'd': tdsqlite3_snprintf(3, &z[j],"%02d",x.D); j+=2; break; case 'f': { double s = x.s; if( s>59.999 ) s = 59.999; - sqlite3_snprintf(7, &z[j],"%06.3f", s); - j += sqlite3Strlen30(&z[j]); + tdsqlite3_snprintf(7, &z[j],"%06.3f", s); + j += tdsqlite3Strlen30(&z[j]); break; } - case 'H': sqlite3_snprintf(3, &z[j],"%02d",x.h); j+=2; break; + case 'H': tdsqlite3_snprintf(3, &z[j],"%02d",x.h); j+=2; break; case 'W': /* Fall thru */ case 'j': { int nDay; /* Number of days since 1st day of year */ @@ -27733,34 +27733,34 @@ static void strftimeFunc( if( zFmt[i]=='W' ){ int wd; /* 0=Monday, 1=Tuesday, ... 6=Sunday */ wd = (int)(((x.iJD+43200000)/86400000)%7); - sqlite3_snprintf(3, &z[j],"%02d",(nDay+7-wd)/7); + tdsqlite3_snprintf(3, &z[j],"%02d",(nDay+7-wd)/7); j += 2; }else{ - sqlite3_snprintf(4, &z[j],"%03d",nDay+1); + tdsqlite3_snprintf(4, &z[j],"%03d",nDay+1); j += 3; } break; } case 'J': { - sqlite3_snprintf(20, &z[j],"%.16g",x.iJD/86400000.0); - j+=sqlite3Strlen30(&z[j]); + tdsqlite3_snprintf(20, &z[j],"%.16g",x.iJD/86400000.0); + j+=tdsqlite3Strlen30(&z[j]); break; } - case 'm': sqlite3_snprintf(3, &z[j],"%02d",x.M); j+=2; break; - case 'M': sqlite3_snprintf(3, &z[j],"%02d",x.m); j+=2; break; + case 'm': tdsqlite3_snprintf(3, &z[j],"%02d",x.M); j+=2; break; + case 'M': tdsqlite3_snprintf(3, &z[j],"%02d",x.m); j+=2; break; case 's': { - sqlite3_snprintf(30,&z[j],"%lld", + tdsqlite3_snprintf(30,&z[j],"%lld", (i64)(x.iJD/1000 - 21086676*(i64)10000)); - j += sqlite3Strlen30(&z[j]); + j += tdsqlite3Strlen30(&z[j]); break; } - case 'S': sqlite3_snprintf(3,&z[j],"%02d",(int)x.s); j+=2; break; + case 'S': tdsqlite3_snprintf(3,&z[j],"%02d",(int)x.s); j+=2; break; case 'w': { z[j++] = (char)(((x.iJD+129600000)/86400000) % 7) + '0'; break; } case 'Y': { - sqlite3_snprintf(5,&z[j],"%04d",x.Y); j+=sqlite3Strlen30(&z[j]); + tdsqlite3_snprintf(5,&z[j],"%04d",x.Y); j+=tdsqlite3Strlen30(&z[j]); break; } default: z[j++] = '%'; break; @@ -27768,7 +27768,7 @@ static void strftimeFunc( } } z[j] = 0; - sqlite3_result_text(context, z, -1, + tdsqlite3_result_text(context, z, -1, z==zBuf ? SQLITE_TRANSIENT : SQLITE_DYNAMIC); } @@ -27778,9 +27778,9 @@ static void strftimeFunc( ** This function returns the same value as time('now'). */ static void ctimeFunc( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **NotUsed2 + tdsqlite3_value **NotUsed2 ){ UNUSED_PARAMETER2(NotUsed, NotUsed2); timeFunc(context, 0, 0); @@ -27792,9 +27792,9 @@ static void ctimeFunc( ** This function returns the same value as date('now'). */ static void cdateFunc( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **NotUsed2 + tdsqlite3_value **NotUsed2 ){ UNUSED_PARAMETER2(NotUsed, NotUsed2); dateFunc(context, 0, 0); @@ -27806,9 +27806,9 @@ static void cdateFunc( ** This function returns the same value as datetime('now'). */ static void ctimestampFunc( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **NotUsed2 + tdsqlite3_value **NotUsed2 ){ UNUSED_PARAMETER2(NotUsed, NotUsed2); datetimeFunc(context, 0, 0); @@ -27828,13 +27828,13 @@ static void ctimestampFunc( ** as the user-data for the function. */ static void currentTimeFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ time_t t; - char *zFormat = (char *)sqlite3_user_data(context); - sqlite3_int64 iT; + char *zFormat = (char *)tdsqlite3_user_data(context); + tdsqlite3_int64 iT; struct tm *pTm; struct tm sNow; char zBuf[20]; @@ -27842,20 +27842,20 @@ static void currentTimeFunc( UNUSED_PARAMETER(argc); UNUSED_PARAMETER(argv); - iT = sqlite3StmtCurrentTime(context); + iT = tdsqlite3StmtCurrentTime(context); if( iT<=0 ) return; - t = iT/1000 - 10000*(sqlite3_int64)21086676; + t = iT/1000 - 10000*(tdsqlite3_int64)21086676; #if HAVE_GMTIME_R pTm = gmtime_r(&t, &sNow); #else - sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); + tdsqlite3_mutex_enter(tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); pTm = gmtime(&t); if( pTm ) memcpy(&sNow, pTm, sizeof(sNow)); - sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); + tdsqlite3_mutex_leave(tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); #endif if( pTm ){ strftime(zBuf, 20, zFormat, &sNow); - sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); + tdsqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); } } #endif @@ -27865,7 +27865,7 @@ static void currentTimeFunc( ** functions. This should be the only routine in this file with ** external linkage. */ -SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){ +SQLITE_PRIVATE void tdsqlite3RegisterDateTimeFunctions(void){ static FuncDef aDateTimeFuncs[] = { #ifndef SQLITE_OMIT_DATETIME_FUNCS PURE_DATE(julianday, -1, 0, 0, juliandayFunc ), @@ -27882,7 +27882,7 @@ SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){ STR_FUNCTION(current_timestamp, 0, "%Y-%m-%d %H:%M:%S", 0, currentTimeFunc), #endif }; - sqlite3InsertBuiltinFuncs(aDateTimeFuncs, ArraySize(aDateTimeFuncs)); + tdsqlite3InsertBuiltinFuncs(aDateTimeFuncs, ArraySize(aDateTimeFuncs)); } /************** End of date.c ************************************************/ @@ -27910,53 +27910,53 @@ SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){ ** is used for testing the I/O recovery logic. */ #if defined(SQLITE_TEST) -SQLITE_API int sqlite3_io_error_hit = 0; /* Total number of I/O Errors */ -SQLITE_API int sqlite3_io_error_hardhit = 0; /* Number of non-benign errors */ -SQLITE_API int sqlite3_io_error_pending = 0; /* Count down to first I/O error */ -SQLITE_API int sqlite3_io_error_persist = 0; /* True if I/O errors persist */ -SQLITE_API int sqlite3_io_error_benign = 0; /* True if errors are benign */ -SQLITE_API int sqlite3_diskfull_pending = 0; -SQLITE_API int sqlite3_diskfull = 0; +SQLITE_API int tdsqlite3_io_error_hit = 0; /* Total number of I/O Errors */ +SQLITE_API int tdsqlite3_io_error_hardhit = 0; /* Number of non-benign errors */ +SQLITE_API int tdsqlite3_io_error_pending = 0; /* Count down to first I/O error */ +SQLITE_API int tdsqlite3_io_error_persist = 0; /* True if I/O errors persist */ +SQLITE_API int tdsqlite3_io_error_benign = 0; /* True if errors are benign */ +SQLITE_API int tdsqlite3_diskfull_pending = 0; +SQLITE_API int tdsqlite3_diskfull = 0; #endif /* defined(SQLITE_TEST) */ /* ** When testing, also keep a count of the number of open files. */ #if defined(SQLITE_TEST) -SQLITE_API int sqlite3_open_file_count = 0; +SQLITE_API int tdsqlite3_open_file_count = 0; #endif /* defined(SQLITE_TEST) */ /* -** The default SQLite sqlite3_vfs implementations do not allocate +** The default SQLite tdsqlite3_vfs implementations do not allocate ** memory (actually, os_unix.c allocates a small amount of memory ** from within OsOpen()), but some third-party implementations may. -** So we test the effects of a malloc() failing and the sqlite3OsXXX() +** So we test the effects of a malloc() failing and the tdsqlite3OsXXX() ** function returning SQLITE_IOERR_NOMEM using the DO_OS_MALLOC_TEST macro. ** ** The following functions are instrumented for malloc() failure ** testing: ** -** sqlite3OsRead() -** sqlite3OsWrite() -** sqlite3OsSync() -** sqlite3OsFileSize() -** sqlite3OsLock() -** sqlite3OsCheckReservedLock() -** sqlite3OsFileControl() -** sqlite3OsShmMap() -** sqlite3OsOpen() -** sqlite3OsDelete() -** sqlite3OsAccess() -** sqlite3OsFullPathname() +** tdsqlite3OsRead() +** tdsqlite3OsWrite() +** tdsqlite3OsSync() +** tdsqlite3OsFileSize() +** tdsqlite3OsLock() +** tdsqlite3OsCheckReservedLock() +** tdsqlite3OsFileControl() +** tdsqlite3OsShmMap() +** tdsqlite3OsOpen() +** tdsqlite3OsDelete() +** tdsqlite3OsAccess() +** tdsqlite3OsFullPathname() ** */ #if defined(SQLITE_TEST) -SQLITE_API int sqlite3_memdebug_vfs_oom_test = 1; +SQLITE_API int tdsqlite3_memdebug_vfs_oom_test = 1; #define DO_OS_MALLOC_TEST(x) \ - if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3JournalIsInMemory(x))) { \ - void *pTstAlloc = sqlite3Malloc(10); \ + if (tdsqlite3_memdebug_vfs_oom_test && (!x || !tdsqlite3JournalIsInMemory(x))) { \ + void *pTstAlloc = tdsqlite3Malloc(10); \ if (!pTstAlloc) return SQLITE_IOERR_NOMEM_BKPT; \ - sqlite3_free(pTstAlloc); \ + tdsqlite3_free(pTstAlloc); \ } #else #define DO_OS_MALLOC_TEST(x) @@ -27964,56 +27964,56 @@ SQLITE_API int sqlite3_memdebug_vfs_oom_test = 1; /* ** The following routines are convenience wrappers around methods -** of the sqlite3_file object. This is mostly just syntactic sugar. All +** of the tdsqlite3_file object. This is mostly just syntactic sugar. All ** of this would be completely automatic if SQLite were coded using ** C++ instead of plain old C. */ -SQLITE_PRIVATE void sqlite3OsClose(sqlite3_file *pId){ +SQLITE_PRIVATE void tdsqlite3OsClose(tdsqlite3_file *pId){ if( pId->pMethods ){ pId->pMethods->xClose(pId); pId->pMethods = 0; } } -SQLITE_PRIVATE int sqlite3OsRead(sqlite3_file *id, void *pBuf, int amt, i64 offset){ +SQLITE_PRIVATE int tdsqlite3OsRead(tdsqlite3_file *id, void *pBuf, int amt, i64 offset){ DO_OS_MALLOC_TEST(id); return id->pMethods->xRead(id, pBuf, amt, offset); } -SQLITE_PRIVATE int sqlite3OsWrite(sqlite3_file *id, const void *pBuf, int amt, i64 offset){ +SQLITE_PRIVATE int tdsqlite3OsWrite(tdsqlite3_file *id, const void *pBuf, int amt, i64 offset){ DO_OS_MALLOC_TEST(id); return id->pMethods->xWrite(id, pBuf, amt, offset); } -SQLITE_PRIVATE int sqlite3OsTruncate(sqlite3_file *id, i64 size){ +SQLITE_PRIVATE int tdsqlite3OsTruncate(tdsqlite3_file *id, i64 size){ return id->pMethods->xTruncate(id, size); } -SQLITE_PRIVATE int sqlite3OsSync(sqlite3_file *id, int flags){ +SQLITE_PRIVATE int tdsqlite3OsSync(tdsqlite3_file *id, int flags){ DO_OS_MALLOC_TEST(id); return flags ? id->pMethods->xSync(id, flags) : SQLITE_OK; } -SQLITE_PRIVATE int sqlite3OsFileSize(sqlite3_file *id, i64 *pSize){ +SQLITE_PRIVATE int tdsqlite3OsFileSize(tdsqlite3_file *id, i64 *pSize){ DO_OS_MALLOC_TEST(id); return id->pMethods->xFileSize(id, pSize); } -SQLITE_PRIVATE int sqlite3OsLock(sqlite3_file *id, int lockType){ +SQLITE_PRIVATE int tdsqlite3OsLock(tdsqlite3_file *id, int lockType){ DO_OS_MALLOC_TEST(id); return id->pMethods->xLock(id, lockType); } -SQLITE_PRIVATE int sqlite3OsUnlock(sqlite3_file *id, int lockType){ +SQLITE_PRIVATE int tdsqlite3OsUnlock(tdsqlite3_file *id, int lockType){ return id->pMethods->xUnlock(id, lockType); } -SQLITE_PRIVATE int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut){ +SQLITE_PRIVATE int tdsqlite3OsCheckReservedLock(tdsqlite3_file *id, int *pResOut){ DO_OS_MALLOC_TEST(id); return id->pMethods->xCheckReservedLock(id, pResOut); } /* -** Use sqlite3OsFileControl() when we are doing something that might fail -** and we need to know about the failures. Use sqlite3OsFileControlHint() +** Use tdsqlite3OsFileControl() when we are doing something that might fail +** and we need to know about the failures. Use tdsqlite3OsFileControlHint() ** when simply tossing information over the wall to the VFS and we do not ** really care if the VFS receives and understands the information since it -** is only a hint and can be safely ignored. The sqlite3OsFileControlHint() +** is only a hint and can be safely ignored. The tdsqlite3OsFileControlHint() ** routine has no return value since the return value would be meaningless. */ -SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){ +SQLITE_PRIVATE int tdsqlite3OsFileControl(tdsqlite3_file *id, int op, void *pArg){ if( id->pMethods==0 ) return SQLITE_NOTFOUND; #ifdef SQLITE_TEST if( op!=SQLITE_FCNTL_COMMIT_PHASETWO @@ -28034,29 +28034,29 @@ SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){ #endif return id->pMethods->xFileControl(id, op, pArg); } -SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file *id, int op, void *pArg){ +SQLITE_PRIVATE void tdsqlite3OsFileControlHint(tdsqlite3_file *id, int op, void *pArg){ if( id->pMethods ) (void)id->pMethods->xFileControl(id, op, pArg); } -SQLITE_PRIVATE int sqlite3OsSectorSize(sqlite3_file *id){ - int (*xSectorSize)(sqlite3_file*) = id->pMethods->xSectorSize; +SQLITE_PRIVATE int tdsqlite3OsSectorSize(tdsqlite3_file *id){ + int (*xSectorSize)(tdsqlite3_file*) = id->pMethods->xSectorSize; return (xSectorSize ? xSectorSize(id) : SQLITE_DEFAULT_SECTOR_SIZE); } -SQLITE_PRIVATE int sqlite3OsDeviceCharacteristics(sqlite3_file *id){ +SQLITE_PRIVATE int tdsqlite3OsDeviceCharacteristics(tdsqlite3_file *id){ return id->pMethods->xDeviceCharacteristics(id); } #ifndef SQLITE_OMIT_WAL -SQLITE_PRIVATE int sqlite3OsShmLock(sqlite3_file *id, int offset, int n, int flags){ +SQLITE_PRIVATE int tdsqlite3OsShmLock(tdsqlite3_file *id, int offset, int n, int flags){ return id->pMethods->xShmLock(id, offset, n, flags); } -SQLITE_PRIVATE void sqlite3OsShmBarrier(sqlite3_file *id){ +SQLITE_PRIVATE void tdsqlite3OsShmBarrier(tdsqlite3_file *id){ id->pMethods->xShmBarrier(id); } -SQLITE_PRIVATE int sqlite3OsShmUnmap(sqlite3_file *id, int deleteFlag){ +SQLITE_PRIVATE int tdsqlite3OsShmUnmap(tdsqlite3_file *id, int deleteFlag){ return id->pMethods->xShmUnmap(id, deleteFlag); } -SQLITE_PRIVATE int sqlite3OsShmMap( - sqlite3_file *id, /* Database file handle */ +SQLITE_PRIVATE int tdsqlite3OsShmMap( + tdsqlite3_file *id, /* Database file handle */ int iPage, int pgsz, int bExtend, /* True to extend file if necessary */ @@ -28069,20 +28069,20 @@ SQLITE_PRIVATE int sqlite3OsShmMap( #if SQLITE_MAX_MMAP_SIZE>0 /* The real implementation of xFetch and xUnfetch */ -SQLITE_PRIVATE int sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, void **pp){ +SQLITE_PRIVATE int tdsqlite3OsFetch(tdsqlite3_file *id, i64 iOff, int iAmt, void **pp){ DO_OS_MALLOC_TEST(id); return id->pMethods->xFetch(id, iOff, iAmt, pp); } -SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){ +SQLITE_PRIVATE int tdsqlite3OsUnfetch(tdsqlite3_file *id, i64 iOff, void *p){ return id->pMethods->xUnfetch(id, iOff, p); } #else /* No-op stubs to use when memory-mapped I/O is disabled */ -SQLITE_PRIVATE int sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, void **pp){ +SQLITE_PRIVATE int tdsqlite3OsFetch(tdsqlite3_file *id, i64 iOff, int iAmt, void **pp){ *pp = 0; return SQLITE_OK; } -SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){ +SQLITE_PRIVATE int tdsqlite3OsUnfetch(tdsqlite3_file *id, i64 iOff, void *p){ return SQLITE_OK; } #endif @@ -28091,10 +28091,10 @@ SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){ ** The next group of routines are convenience wrappers around the ** VFS methods. */ -SQLITE_PRIVATE int sqlite3OsOpen( - sqlite3_vfs *pVfs, +SQLITE_PRIVATE int tdsqlite3OsOpen( + tdsqlite3_vfs *pVfs, const char *zPath, - sqlite3_file *pFile, + tdsqlite3_file *pFile, int flags, int *pFlagsOut ){ @@ -28108,13 +28108,13 @@ SQLITE_PRIVATE int sqlite3OsOpen( assert( rc==SQLITE_OK || pFile->pMethods==0 ); return rc; } -SQLITE_PRIVATE int sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ +SQLITE_PRIVATE int tdsqlite3OsDelete(tdsqlite3_vfs *pVfs, const char *zPath, int dirSync){ DO_OS_MALLOC_TEST(0); assert( dirSync==0 || dirSync==1 ); return pVfs->xDelete(pVfs, zPath, dirSync); } -SQLITE_PRIVATE int sqlite3OsAccess( - sqlite3_vfs *pVfs, +SQLITE_PRIVATE int tdsqlite3OsAccess( + tdsqlite3_vfs *pVfs, const char *zPath, int flags, int *pResOut @@ -28122,8 +28122,8 @@ SQLITE_PRIVATE int sqlite3OsAccess( DO_OS_MALLOC_TEST(0); return pVfs->xAccess(pVfs, zPath, flags, pResOut); } -SQLITE_PRIVATE int sqlite3OsFullPathname( - sqlite3_vfs *pVfs, +SQLITE_PRIVATE int tdsqlite3OsFullPathname( + tdsqlite3_vfs *pVfs, const char *zPath, int nPathOut, char *zPathOut @@ -28133,37 +28133,37 @@ SQLITE_PRIVATE int sqlite3OsFullPathname( return pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut); } #ifndef SQLITE_OMIT_LOAD_EXTENSION -SQLITE_PRIVATE void *sqlite3OsDlOpen(sqlite3_vfs *pVfs, const char *zPath){ +SQLITE_PRIVATE void *tdsqlite3OsDlOpen(tdsqlite3_vfs *pVfs, const char *zPath){ return pVfs->xDlOpen(pVfs, zPath); } -SQLITE_PRIVATE void sqlite3OsDlError(sqlite3_vfs *pVfs, int nByte, char *zBufOut){ +SQLITE_PRIVATE void tdsqlite3OsDlError(tdsqlite3_vfs *pVfs, int nByte, char *zBufOut){ pVfs->xDlError(pVfs, nByte, zBufOut); } -SQLITE_PRIVATE void (*sqlite3OsDlSym(sqlite3_vfs *pVfs, void *pHdle, const char *zSym))(void){ +SQLITE_PRIVATE void (*tdsqlite3OsDlSym(tdsqlite3_vfs *pVfs, void *pHdle, const char *zSym))(void){ return pVfs->xDlSym(pVfs, pHdle, zSym); } -SQLITE_PRIVATE void sqlite3OsDlClose(sqlite3_vfs *pVfs, void *pHandle){ +SQLITE_PRIVATE void tdsqlite3OsDlClose(tdsqlite3_vfs *pVfs, void *pHandle){ pVfs->xDlClose(pVfs, pHandle); } #endif /* SQLITE_OMIT_LOAD_EXTENSION */ -SQLITE_PRIVATE int sqlite3OsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){ - if( sqlite3Config.iPrngSeed ){ +SQLITE_PRIVATE int tdsqlite3OsRandomness(tdsqlite3_vfs *pVfs, int nByte, char *zBufOut){ + if( tdsqlite3Config.iPrngSeed ){ memset(zBufOut, 0, nByte); if( ALWAYS(nByte>(signed)sizeof(unsigned)) ) nByte = sizeof(unsigned int); - memcpy(zBufOut, &sqlite3Config.iPrngSeed, nByte); + memcpy(zBufOut, &tdsqlite3Config.iPrngSeed, nByte); return SQLITE_OK; }else{ return pVfs->xRandomness(pVfs, nByte, zBufOut); } } -SQLITE_PRIVATE int sqlite3OsSleep(sqlite3_vfs *pVfs, int nMicro){ +SQLITE_PRIVATE int tdsqlite3OsSleep(tdsqlite3_vfs *pVfs, int nMicro){ return pVfs->xSleep(pVfs, nMicro); } -SQLITE_PRIVATE int sqlite3OsGetLastError(sqlite3_vfs *pVfs){ +SQLITE_PRIVATE int tdsqlite3OsGetLastError(tdsqlite3_vfs *pVfs){ return pVfs->xGetLastError ? pVfs->xGetLastError(pVfs, 0, 0) : 0; } -SQLITE_PRIVATE int sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){ +SQLITE_PRIVATE int tdsqlite3OsCurrentTimeInt64(tdsqlite3_vfs *pVfs, tdsqlite3_int64 *pTimeOut){ int rc; /* IMPLEMENTATION-OF: R-49045-42493 SQLite will use the xCurrentTimeInt64() ** method to get the current date and time if that method is available @@ -28176,25 +28176,25 @@ SQLITE_PRIVATE int sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *p }else{ double r; rc = pVfs->xCurrentTime(pVfs, &r); - *pTimeOut = (sqlite3_int64)(r*86400000.0); + *pTimeOut = (tdsqlite3_int64)(r*86400000.0); } return rc; } -SQLITE_PRIVATE int sqlite3OsOpenMalloc( - sqlite3_vfs *pVfs, +SQLITE_PRIVATE int tdsqlite3OsOpenMalloc( + tdsqlite3_vfs *pVfs, const char *zFile, - sqlite3_file **ppFile, + tdsqlite3_file **ppFile, int flags, int *pOutFlags ){ int rc; - sqlite3_file *pFile; - pFile = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile); + tdsqlite3_file *pFile; + pFile = (tdsqlite3_file *)tdsqlite3MallocZero(pVfs->szOsFile); if( pFile ){ - rc = sqlite3OsOpen(pVfs, zFile, pFile, flags, pOutFlags); + rc = tdsqlite3OsOpen(pVfs, zFile, pFile, flags, pOutFlags); if( rc!=SQLITE_OK ){ - sqlite3_free(pFile); + tdsqlite3_free(pFile); }else{ *ppFile = pFile; } @@ -28203,67 +28203,67 @@ SQLITE_PRIVATE int sqlite3OsOpenMalloc( } return rc; } -SQLITE_PRIVATE void sqlite3OsCloseFree(sqlite3_file *pFile){ +SQLITE_PRIVATE void tdsqlite3OsCloseFree(tdsqlite3_file *pFile){ assert( pFile ); - sqlite3OsClose(pFile); - sqlite3_free(pFile); + tdsqlite3OsClose(pFile); + tdsqlite3_free(pFile); } /* ** This function is a wrapper around the OS specific implementation of -** sqlite3_os_init(). The purpose of the wrapper is to provide the +** tdsqlite3_os_init(). The purpose of the wrapper is to provide the ** ability to simulate a malloc failure, so that the handling of an -** error in sqlite3_os_init() by the upper layers can be tested. +** error in tdsqlite3_os_init() by the upper layers can be tested. */ -SQLITE_PRIVATE int sqlite3OsInit(void){ - void *p = sqlite3_malloc(10); +SQLITE_PRIVATE int tdsqlite3OsInit(void){ + void *p = tdsqlite3_malloc(10); if( p==0 ) return SQLITE_NOMEM_BKPT; - sqlite3_free(p); - return sqlite3_os_init(); + tdsqlite3_free(p); + return tdsqlite3_os_init(); } /* ** The list of all registered VFS implementations. */ -static sqlite3_vfs * SQLITE_WSD vfsList = 0; -#define vfsList GLOBAL(sqlite3_vfs *, vfsList) +static tdsqlite3_vfs * SQLITE_WSD vfsList = 0; +#define vfsList GLOBAL(tdsqlite3_vfs *, vfsList) /* ** Locate a VFS by name. If no name is given, simply return the ** first VFS on the list. */ -SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfs){ - sqlite3_vfs *pVfs = 0; +SQLITE_API tdsqlite3_vfs *tdsqlite3_vfs_find(const char *zVfs){ + tdsqlite3_vfs *pVfs = 0; #if SQLITE_THREADSAFE - sqlite3_mutex *mutex; + tdsqlite3_mutex *mutex; #endif #ifndef SQLITE_OMIT_AUTOINIT - int rc = sqlite3_initialize(); + int rc = tdsqlite3_initialize(); if( rc ) return 0; #endif #if SQLITE_THREADSAFE - mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); + mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); #endif - sqlite3_mutex_enter(mutex); + tdsqlite3_mutex_enter(mutex); for(pVfs = vfsList; pVfs; pVfs=pVfs->pNext){ if( zVfs==0 ) break; if( strcmp(zVfs, pVfs->zName)==0 ) break; } - sqlite3_mutex_leave(mutex); + tdsqlite3_mutex_leave(mutex); return pVfs; } /* ** Unlink a VFS from the linked list */ -static void vfsUnlink(sqlite3_vfs *pVfs){ - assert( sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)) ); +static void vfsUnlink(tdsqlite3_vfs *pVfs){ + assert( tdsqlite3_mutex_held(tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)) ); if( pVfs==0 ){ /* No-op */ }else if( vfsList==pVfs ){ vfsList = pVfs->pNext; }else if( vfsList ){ - sqlite3_vfs *p = vfsList; + tdsqlite3_vfs *p = vfsList; while( p->pNext && p->pNext!=pVfs ){ p = p->pNext; } @@ -28278,18 +28278,18 @@ static void vfsUnlink(sqlite3_vfs *pVfs){ ** VFS multiple times. The new VFS becomes the default if makeDflt is ** true. */ -SQLITE_API int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){ - MUTEX_LOGIC(sqlite3_mutex *mutex;) +SQLITE_API int tdsqlite3_vfs_register(tdsqlite3_vfs *pVfs, int makeDflt){ + MUTEX_LOGIC(tdsqlite3_mutex *mutex;) #ifndef SQLITE_OMIT_AUTOINIT - int rc = sqlite3_initialize(); + int rc = tdsqlite3_initialize(); if( rc ) return rc; #endif #ifdef SQLITE_ENABLE_API_ARMOR if( pVfs==0 ) return SQLITE_MISUSE_BKPT; #endif - MUTEX_LOGIC( mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) - sqlite3_mutex_enter(mutex); + MUTEX_LOGIC( mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) + tdsqlite3_mutex_enter(mutex); vfsUnlink(pVfs); if( makeDflt || vfsList==0 ){ pVfs->pNext = vfsList; @@ -28299,23 +28299,23 @@ SQLITE_API int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){ vfsList->pNext = pVfs; } assert(vfsList); - sqlite3_mutex_leave(mutex); + tdsqlite3_mutex_leave(mutex); return SQLITE_OK; } /* ** Unregister a VFS so that it is no longer accessible. */ -SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs *pVfs){ - MUTEX_LOGIC(sqlite3_mutex *mutex;) +SQLITE_API int tdsqlite3_vfs_unregister(tdsqlite3_vfs *pVfs){ + MUTEX_LOGIC(tdsqlite3_mutex *mutex;) #ifndef SQLITE_OMIT_AUTOINIT - int rc = sqlite3_initialize(); + int rc = tdsqlite3_initialize(); if( rc ) return rc; #endif - MUTEX_LOGIC( mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) - sqlite3_mutex_enter(mutex); + MUTEX_LOGIC( mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) + tdsqlite3_mutex_enter(mutex); vfsUnlink(pVfs); - sqlite3_mutex_leave(mutex); + tdsqlite3_mutex_leave(mutex); return SQLITE_OK; } @@ -28335,7 +28335,7 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs *pVfs){ ** ** This file contains code to support the concept of "benign" ** malloc failures (when the xMalloc() or xRealloc() method of the -** sqlite3_mem_methods structure fails to allocate a block of memory +** tdsqlite3_mem_methods structure fails to allocate a block of memory ** and returns 0). ** ** Most malloc failures are non-benign. After they occur, SQLite @@ -28358,29 +28358,29 @@ typedef struct BenignMallocHooks BenignMallocHooks; static SQLITE_WSD struct BenignMallocHooks { void (*xBenignBegin)(void); void (*xBenignEnd)(void); -} sqlite3Hooks = { 0, 0 }; +} tdsqlite3Hooks = { 0, 0 }; /* The "wsdHooks" macro will resolve to the appropriate BenignMallocHooks ** structure. If writable static data is unsupported on the target, ** we have to locate the state vector at run-time. In the more common ** case where writable static data is supported, wsdHooks can refer directly -** to the "sqlite3Hooks" state vector declared above. +** to the "tdsqlite3Hooks" state vector declared above. */ #ifdef SQLITE_OMIT_WSD # define wsdHooksInit \ - BenignMallocHooks *x = &GLOBAL(BenignMallocHooks,sqlite3Hooks) + BenignMallocHooks *x = &GLOBAL(BenignMallocHooks,tdsqlite3Hooks) # define wsdHooks x[0] #else # define wsdHooksInit -# define wsdHooks sqlite3Hooks +# define wsdHooks tdsqlite3Hooks #endif /* -** Register hooks to call when sqlite3BeginBenignMalloc() and -** sqlite3EndBenignMalloc() are called, respectively. +** Register hooks to call when tdsqlite3BeginBenignMalloc() and +** tdsqlite3EndBenignMalloc() are called, respectively. */ -SQLITE_PRIVATE void sqlite3BenignMallocHooks( +SQLITE_PRIVATE void tdsqlite3BenignMallocHooks( void (*xBenignBegin)(void), void (*xBenignEnd)(void) ){ @@ -28390,17 +28390,17 @@ SQLITE_PRIVATE void sqlite3BenignMallocHooks( } /* -** This (sqlite3EndBenignMalloc()) is called by SQLite code to indicate that -** subsequent malloc failures are benign. A call to sqlite3EndBenignMalloc() +** This (tdsqlite3EndBenignMalloc()) is called by SQLite code to indicate that +** subsequent malloc failures are benign. A call to tdsqlite3EndBenignMalloc() ** indicates that subsequent malloc failures are non-benign. */ -SQLITE_PRIVATE void sqlite3BeginBenignMalloc(void){ +SQLITE_PRIVATE void tdsqlite3BeginBenignMalloc(void){ wsdHooksInit; if( wsdHooks.xBenignBegin ){ wsdHooks.xBenignBegin(); } } -SQLITE_PRIVATE void sqlite3EndBenignMalloc(void){ +SQLITE_PRIVATE void tdsqlite3EndBenignMalloc(void){ wsdHooksInit; if( wsdHooks.xBenignEnd ){ wsdHooks.xBenignEnd(); @@ -28427,7 +28427,7 @@ SQLITE_PRIVATE void sqlite3EndBenignMalloc(void){ ** SQLITE_ZERO_MALLOC is defined. The allocation drivers implemented ** here always fail. SQLite will not operate with these drivers. These ** are merely placeholders. Real drivers must be substituted using -** sqlite3_config() before SQLite will operate. +** tdsqlite3_config() before SQLite will operate. */ /* #include "sqliteInt.h" */ @@ -28441,32 +28441,32 @@ SQLITE_PRIVATE void sqlite3EndBenignMalloc(void){ /* ** No-op versions of all memory allocation routines */ -static void *sqlite3MemMalloc(int nByte){ return 0; } -static void sqlite3MemFree(void *pPrior){ return; } -static void *sqlite3MemRealloc(void *pPrior, int nByte){ return 0; } -static int sqlite3MemSize(void *pPrior){ return 0; } -static int sqlite3MemRoundup(int n){ return n; } -static int sqlite3MemInit(void *NotUsed){ return SQLITE_OK; } -static void sqlite3MemShutdown(void *NotUsed){ return; } +static void *tdsqlite3MemMalloc(int nByte){ return 0; } +static void tdsqlite3MemFree(void *pPrior){ return; } +static void *tdsqlite3MemRealloc(void *pPrior, int nByte){ return 0; } +static int tdsqlite3MemSize(void *pPrior){ return 0; } +static int tdsqlite3MemRoundup(int n){ return n; } +static int tdsqlite3MemInit(void *NotUsed){ return SQLITE_OK; } +static void tdsqlite3MemShutdown(void *NotUsed){ return; } /* ** This routine is the only routine in this file with external linkage. ** ** Populate the low-level memory allocation function pointers in -** sqlite3GlobalConfig.m with pointers to the routines in this file. +** tdsqlite3GlobalConfig.m with pointers to the routines in this file. */ -SQLITE_PRIVATE void sqlite3MemSetDefault(void){ - static const sqlite3_mem_methods defaultMethods = { - sqlite3MemMalloc, - sqlite3MemFree, - sqlite3MemRealloc, - sqlite3MemSize, - sqlite3MemRoundup, - sqlite3MemInit, - sqlite3MemShutdown, +SQLITE_PRIVATE void tdsqlite3MemSetDefault(void){ + static const tdsqlite3_mem_methods defaultMethods = { + tdsqlite3MemMalloc, + tdsqlite3MemFree, + tdsqlite3MemRealloc, + tdsqlite3MemSize, + tdsqlite3MemRoundup, + tdsqlite3MemInit, + tdsqlite3MemShutdown, 0 }; - sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods); + tdsqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods); } #endif /* SQLITE_ZERO_MALLOC */ @@ -28490,7 +28490,7 @@ SQLITE_PRIVATE void sqlite3MemSetDefault(void){ ** to obtain the memory it needs. ** ** This file contains implementations of the low-level memory allocation -** routines specified in the sqlite3_mem_methods object. The content of +** routines specified in the tdsqlite3_mem_methods object. The content of ** this file is only used if SQLITE_SYSTEM_MALLOC is defined. The ** SQLITE_SYSTEM_MALLOC macro is defined automatically if neither the ** SQLITE_MEMDEBUG nor the SQLITE_WIN32_MALLOC macros are defined. The @@ -28594,24 +28594,24 @@ static malloc_zone_t* _sqliteZone_; /* ** Like malloc(), but remember the size of the allocation -** so that we can find it later using sqlite3MemSize(). +** so that we can find it later using tdsqlite3MemSize(). ** ** For this low-level routine, we are guaranteed that nByte>0 because ** cases of nByte<=0 will be intercepted and dealt with by higher level ** routines. */ -static void *sqlite3MemMalloc(int nByte){ +static void *tdsqlite3MemMalloc(int nByte){ #ifdef SQLITE_MALLOCSIZE void *p; testcase( ROUND8(nByte)==nByte ); p = SQLITE_MALLOC( nByte ); if( p==0 ){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte); + testcase( tdsqlite3GlobalConfig.xLog!=0 ); + tdsqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte); } return p; #else - sqlite3_int64 *p; + tdsqlite3_int64 *p; assert( nByte>0 ); testcase( ROUND8(nByte)!=nByte ); p = SQLITE_MALLOC( nByte+8 ); @@ -28619,26 +28619,26 @@ static void *sqlite3MemMalloc(int nByte){ p[0] = nByte; p++; }else{ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte); + testcase( tdsqlite3GlobalConfig.xLog!=0 ); + tdsqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte); } return (void *)p; #endif } /* -** Like free() but works for allocations obtained from sqlite3MemMalloc() -** or sqlite3MemRealloc(). +** Like free() but works for allocations obtained from tdsqlite3MemMalloc() +** or tdsqlite3MemRealloc(). ** ** For this low-level routine, we already know that pPrior!=0 since ** cases where pPrior==0 will have been intecepted and dealt with ** by higher-level routines. */ -static void sqlite3MemFree(void *pPrior){ +static void tdsqlite3MemFree(void *pPrior){ #ifdef SQLITE_MALLOCSIZE SQLITE_FREE(pPrior); #else - sqlite3_int64 *p = (sqlite3_int64*)pPrior; + tdsqlite3_int64 *p = (tdsqlite3_int64*)pPrior; assert( pPrior!=0 ); p--; SQLITE_FREE(p); @@ -28649,14 +28649,14 @@ static void sqlite3MemFree(void *pPrior){ ** Report the allocated size of a prior return from xMalloc() ** or xRealloc(). */ -static int sqlite3MemSize(void *pPrior){ +static int tdsqlite3MemSize(void *pPrior){ #ifdef SQLITE_MALLOCSIZE assert( pPrior!=0 ); return (int)SQLITE_MALLOCSIZE(pPrior); #else - sqlite3_int64 *p; + tdsqlite3_int64 *p; assert( pPrior!=0 ); - p = (sqlite3_int64*)pPrior; + p = (tdsqlite3_int64*)pPrior; p--; return (int)p[0]; #endif @@ -28664,7 +28664,7 @@ static int sqlite3MemSize(void *pPrior){ /* ** Like realloc(). Resize an allocation previously obtained from -** sqlite3MemMalloc(). +** tdsqlite3MemMalloc(). ** ** For this low-level interface, we know that pPrior!=0. Cases where ** pPrior==0 while have been intercepted by higher-level routine and @@ -28672,18 +28672,18 @@ static int sqlite3MemSize(void *pPrior){ ** cases where nByte<=0 will have been intercepted by higher-level ** routines and redirected to xFree. */ -static void *sqlite3MemRealloc(void *pPrior, int nByte){ +static void *tdsqlite3MemRealloc(void *pPrior, int nByte){ #ifdef SQLITE_MALLOCSIZE void *p = SQLITE_REALLOC(pPrior, nByte); if( p==0 ){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_NOMEM, + testcase( tdsqlite3GlobalConfig.xLog!=0 ); + tdsqlite3_log(SQLITE_NOMEM, "failed memory resize %u to %u bytes", SQLITE_MALLOCSIZE(pPrior), nByte); } return p; #else - sqlite3_int64 *p = (sqlite3_int64*)pPrior; + tdsqlite3_int64 *p = (tdsqlite3_int64*)pPrior; assert( pPrior!=0 && nByte>0 ); assert( nByte==ROUND8(nByte) ); /* EV: R-46199-30249 */ p--; @@ -28692,10 +28692,10 @@ static void *sqlite3MemRealloc(void *pPrior, int nByte){ p[0] = nByte; p++; }else{ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_NOMEM, + testcase( tdsqlite3GlobalConfig.xLog!=0 ); + tdsqlite3_log(SQLITE_NOMEM, "failed memory resize %u to %u bytes", - sqlite3MemSize(pPrior), nByte); + tdsqlite3MemSize(pPrior), nByte); } return (void*)p; #endif @@ -28704,14 +28704,14 @@ static void *sqlite3MemRealloc(void *pPrior, int nByte){ /* ** Round up a request size to the next valid allocation size. */ -static int sqlite3MemRoundup(int n){ +static int tdsqlite3MemRoundup(int n){ return ROUND8(n); } /* ** Initialize this module. */ -static int sqlite3MemInit(void *NotUsed){ +static int tdsqlite3MemInit(void *NotUsed){ #if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC) int cpuCount; size_t len; @@ -28738,7 +28738,7 @@ static int sqlite3MemInit(void *NotUsed){ /* ** Deinitialize this module. */ -static void sqlite3MemShutdown(void *NotUsed){ +static void tdsqlite3MemShutdown(void *NotUsed){ UNUSED_PARAMETER(NotUsed); return; } @@ -28747,20 +28747,20 @@ static void sqlite3MemShutdown(void *NotUsed){ ** This routine is the only routine in this file with external linkage. ** ** Populate the low-level memory allocation function pointers in -** sqlite3GlobalConfig.m with pointers to the routines in this file. +** tdsqlite3GlobalConfig.m with pointers to the routines in this file. */ -SQLITE_PRIVATE void sqlite3MemSetDefault(void){ - static const sqlite3_mem_methods defaultMethods = { - sqlite3MemMalloc, - sqlite3MemFree, - sqlite3MemRealloc, - sqlite3MemSize, - sqlite3MemRoundup, - sqlite3MemInit, - sqlite3MemShutdown, +SQLITE_PRIVATE void tdsqlite3MemSetDefault(void){ + static const tdsqlite3_mem_methods defaultMethods = { + tdsqlite3MemMalloc, + tdsqlite3MemFree, + tdsqlite3MemRealloc, + tdsqlite3MemSize, + tdsqlite3MemRoundup, + tdsqlite3MemInit, + tdsqlite3MemShutdown, 0 }; - sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods); + tdsqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods); } #endif /* SQLITE_SYSTEM_MALLOC */ @@ -28786,7 +28786,7 @@ SQLITE_PRIVATE void sqlite3MemSetDefault(void){ ** leaks and memory usage errors. ** ** This file contains implementations of the low-level memory allocation -** routines specified in the sqlite3_mem_methods object. +** routines specified in the tdsqlite3_mem_methods object. */ /* #include "sqliteInt.h" */ @@ -28853,7 +28853,7 @@ static struct { /* ** Mutex to control access to the memory allocation subsystem. */ - sqlite3_mutex *mutex; + tdsqlite3_mutex *mutex; /* ** Head and tail of a linked list of all outstanding allocations @@ -28874,8 +28874,8 @@ static struct { char zTitle[100]; /* The title text */ /* - ** sqlite3MallocDisallow() increments the following counter. - ** sqlite3MallocAllow() decrements it. + ** tdsqlite3MallocDisallow() increments the following counter. + ** tdsqlite3MallocAllow() decrements it. */ int disallow; /* Do not allow memory allocation */ @@ -28918,7 +28918,7 @@ static void adjustStats(int iSize, int increment){ ** This routine checks the guards at either end of the allocation and ** if they are incorrect it asserts. */ -static struct MemBlockHdr *sqlite3MemsysGetHeader(void *pAllocation){ +static struct MemBlockHdr *tdsqlite3MemsysGetHeader(void *pAllocation){ struct MemBlockHdr *p; int *pInt; u8 *pU8; @@ -28942,25 +28942,25 @@ static struct MemBlockHdr *sqlite3MemsysGetHeader(void *pAllocation){ /* ** Return the number of bytes currently allocated at address p. */ -static int sqlite3MemSize(void *p){ +static int tdsqlite3MemSize(void *p){ struct MemBlockHdr *pHdr; if( !p ){ return 0; } - pHdr = sqlite3MemsysGetHeader(p); + pHdr = tdsqlite3MemsysGetHeader(p); return (int)pHdr->iSize; } /* ** Initialize the memory allocation subsystem. */ -static int sqlite3MemInit(void *NotUsed){ +static int tdsqlite3MemInit(void *NotUsed){ UNUSED_PARAMETER(NotUsed); assert( (sizeof(struct MemBlockHdr)&7) == 0 ); - if( !sqlite3GlobalConfig.bMemstat ){ + if( !tdsqlite3GlobalConfig.bMemstat ){ /* If memory status is enabled, then the malloc.c wrapper will already ** hold the STATIC_MEM mutex when the routines here are invoked. */ - mem.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); + mem.mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); } return SQLITE_OK; } @@ -28968,7 +28968,7 @@ static int sqlite3MemInit(void *NotUsed){ /* ** Deinitialize the memory allocation subsystem. */ -static void sqlite3MemShutdown(void *NotUsed){ +static void tdsqlite3MemShutdown(void *NotUsed){ UNUSED_PARAMETER(NotUsed); mem.mutex = 0; } @@ -28976,7 +28976,7 @@ static void sqlite3MemShutdown(void *NotUsed){ /* ** Round up a request size to the next valid allocation size. */ -static int sqlite3MemRoundup(int n){ +static int tdsqlite3MemRoundup(int n){ return ROUND8(n); } @@ -29008,7 +29008,7 @@ static void randomFill(char *pBuf, int nByte){ /* ** Allocate nByte bytes of memory. */ -static void *sqlite3MemMalloc(int nByte){ +static void *tdsqlite3MemMalloc(int nByte){ struct MemBlockHdr *pHdr; void **pBt; char *z; @@ -29016,7 +29016,7 @@ static void *sqlite3MemMalloc(int nByte){ void *p = 0; int totalSize; int nReserve; - sqlite3_mutex_enter(mem.mutex); + tdsqlite3_mutex_enter(mem.mutex); assert( mem.disallow==0 ); nReserve = ROUND8(nByte); totalSize = nReserve + sizeof(*pHdr) + sizeof(int) + @@ -29060,23 +29060,23 @@ static void *sqlite3MemMalloc(int nByte){ memset(((char*)pInt)+nByte, 0x65, nReserve-nByte); p = (void*)pInt; } - sqlite3_mutex_leave(mem.mutex); + tdsqlite3_mutex_leave(mem.mutex); return p; } /* ** Free memory. */ -static void sqlite3MemFree(void *pPrior){ +static void tdsqlite3MemFree(void *pPrior){ struct MemBlockHdr *pHdr; void **pBt; char *z; - assert( sqlite3GlobalConfig.bMemstat || sqlite3GlobalConfig.bCoreMutex==0 + assert( tdsqlite3GlobalConfig.bMemstat || tdsqlite3GlobalConfig.bCoreMutex==0 || mem.mutex!=0 ); - pHdr = sqlite3MemsysGetHeader(pPrior); + pHdr = tdsqlite3MemsysGetHeader(pPrior); pBt = (void**)pHdr; pBt -= pHdr->nBacktraceSlots; - sqlite3_mutex_enter(mem.mutex); + tdsqlite3_mutex_enter(mem.mutex); if( pHdr->pPrev ){ assert( pHdr->pPrev->pNext==pHdr ); pHdr->pPrev->pNext = pHdr->pNext; @@ -29097,7 +29097,7 @@ static void sqlite3MemFree(void *pPrior){ randomFill(z, sizeof(void*)*pHdr->nBacktraceSlots + sizeof(*pHdr) + (int)pHdr->iSize + sizeof(int) + pHdr->nTitle); free(z); - sqlite3_mutex_leave(mem.mutex); + tdsqlite3_mutex_leave(mem.mutex); } /* @@ -29109,48 +29109,48 @@ static void sqlite3MemFree(void *pPrior){ ** much more likely to break and we are much more liking to find ** the error. */ -static void *sqlite3MemRealloc(void *pPrior, int nByte){ +static void *tdsqlite3MemRealloc(void *pPrior, int nByte){ struct MemBlockHdr *pOldHdr; void *pNew; assert( mem.disallow==0 ); assert( (nByte & 7)==0 ); /* EV: R-46199-30249 */ - pOldHdr = sqlite3MemsysGetHeader(pPrior); - pNew = sqlite3MemMalloc(nByte); + pOldHdr = tdsqlite3MemsysGetHeader(pPrior); + pNew = tdsqlite3MemMalloc(nByte); if( pNew ){ memcpy(pNew, pPrior, (int)(nByteiSize ? nByte : pOldHdr->iSize)); if( nByte>pOldHdr->iSize ){ randomFill(&((char*)pNew)[pOldHdr->iSize], nByte - (int)pOldHdr->iSize); } - sqlite3MemFree(pPrior); + tdsqlite3MemFree(pPrior); } return pNew; } /* ** Populate the low-level memory allocation function pointers in -** sqlite3GlobalConfig.m with pointers to the routines in this file. +** tdsqlite3GlobalConfig.m with pointers to the routines in this file. */ -SQLITE_PRIVATE void sqlite3MemSetDefault(void){ - static const sqlite3_mem_methods defaultMethods = { - sqlite3MemMalloc, - sqlite3MemFree, - sqlite3MemRealloc, - sqlite3MemSize, - sqlite3MemRoundup, - sqlite3MemInit, - sqlite3MemShutdown, +SQLITE_PRIVATE void tdsqlite3MemSetDefault(void){ + static const tdsqlite3_mem_methods defaultMethods = { + tdsqlite3MemMalloc, + tdsqlite3MemFree, + tdsqlite3MemRealloc, + tdsqlite3MemSize, + tdsqlite3MemRoundup, + tdsqlite3MemInit, + tdsqlite3MemShutdown, 0 }; - sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods); + tdsqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods); } /* ** Set the "type" of an allocation. */ -SQLITE_PRIVATE void sqlite3MemdebugSetType(void *p, u8 eType){ - if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){ +SQLITE_PRIVATE void tdsqlite3MemdebugSetType(void *p, u8 eType){ + if( p && tdsqlite3GlobalConfig.m.xMalloc==tdsqlite3MemMalloc ){ struct MemBlockHdr *pHdr; - pHdr = sqlite3MemsysGetHeader(p); + pHdr = tdsqlite3MemsysGetHeader(p); assert( pHdr->iForeGuard==FOREGUARD ); pHdr->eType = eType; } @@ -29163,13 +29163,13 @@ SQLITE_PRIVATE void sqlite3MemdebugSetType(void *p, u8 eType){ ** This routine is designed for use within an assert() statement, to ** verify the type of an allocation. For example: ** -** assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); +** assert( tdsqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); */ -SQLITE_PRIVATE int sqlite3MemdebugHasType(void *p, u8 eType){ +SQLITE_PRIVATE int tdsqlite3MemdebugHasType(void *p, u8 eType){ int rc = 1; - if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){ + if( p && tdsqlite3GlobalConfig.m.xMalloc==tdsqlite3MemMalloc ){ struct MemBlockHdr *pHdr; - pHdr = sqlite3MemsysGetHeader(p); + pHdr = tdsqlite3MemsysGetHeader(p); assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */ if( (pHdr->eType&eType)==0 ){ rc = 0; @@ -29185,13 +29185,13 @@ SQLITE_PRIVATE int sqlite3MemdebugHasType(void *p, u8 eType){ ** This routine is designed for use within an assert() statement, to ** verify the type of an allocation. For example: ** -** assert( sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) ); +** assert( tdsqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) ); */ -SQLITE_PRIVATE int sqlite3MemdebugNoType(void *p, u8 eType){ +SQLITE_PRIVATE int tdsqlite3MemdebugNoType(void *p, u8 eType){ int rc = 1; - if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){ + if( p && tdsqlite3GlobalConfig.m.xMalloc==tdsqlite3MemMalloc ){ struct MemBlockHdr *pHdr; - pHdr = sqlite3MemsysGetHeader(p); + pHdr = tdsqlite3MemsysGetHeader(p); assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */ if( (pHdr->eType&eType)!=0 ){ rc = 0; @@ -29205,31 +29205,31 @@ SQLITE_PRIVATE int sqlite3MemdebugNoType(void *p, u8 eType){ ** A value of zero turns off backtracing. The number is always rounded ** up to a multiple of 2. */ -SQLITE_PRIVATE void sqlite3MemdebugBacktrace(int depth){ +SQLITE_PRIVATE void tdsqlite3MemdebugBacktrace(int depth){ if( depth<0 ){ depth = 0; } if( depth>20 ){ depth = 20; } depth = (depth+1)&0xfe; mem.nBacktrace = depth; } -SQLITE_PRIVATE void sqlite3MemdebugBacktraceCallback(void (*xBacktrace)(int, int, void **)){ +SQLITE_PRIVATE void tdsqlite3MemdebugBacktraceCallback(void (*xBacktrace)(int, int, void **)){ mem.xBacktrace = xBacktrace; } /* ** Set the title string for subsequent allocations. */ -SQLITE_PRIVATE void sqlite3MemdebugSettitle(const char *zTitle){ - unsigned int n = sqlite3Strlen30(zTitle) + 1; - sqlite3_mutex_enter(mem.mutex); +SQLITE_PRIVATE void tdsqlite3MemdebugSettitle(const char *zTitle){ + unsigned int n = tdsqlite3Strlen30(zTitle) + 1; + tdsqlite3_mutex_enter(mem.mutex); if( n>=sizeof(mem.zTitle) ) n = sizeof(mem.zTitle)-1; memcpy(mem.zTitle, zTitle, n); mem.zTitle[n] = 0; mem.nTitle = ROUND8(n); - sqlite3_mutex_leave(mem.mutex); + tdsqlite3_mutex_leave(mem.mutex); } -SQLITE_PRIVATE void sqlite3MemdebugSync(){ +SQLITE_PRIVATE void tdsqlite3MemdebugSync(){ struct MemBlockHdr *pHdr; for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){ void **pBt = (void**)pHdr; @@ -29242,7 +29242,7 @@ SQLITE_PRIVATE void sqlite3MemdebugSync(){ ** Open the file indicated and write a log of all unfreed memory ** allocations into that log. */ -SQLITE_PRIVATE void sqlite3MemdebugDump(const char *zFilename){ +SQLITE_PRIVATE void tdsqlite3MemdebugDump(const char *zFilename){ FILE *out; struct MemBlockHdr *pHdr; void **pBt; @@ -29282,9 +29282,9 @@ SQLITE_PRIVATE void sqlite3MemdebugDump(const char *zFilename){ } /* -** Return the number of times sqlite3MemMalloc() has been called. +** Return the number of times tdsqlite3MemMalloc() has been called. */ -SQLITE_PRIVATE int sqlite3MemdebugMallocCount(){ +SQLITE_PRIVATE int tdsqlite3MemdebugMallocCount(){ int i; int nTotal = 0; for(i=0; i=1 ); size = mem3.aPool[i-1].u.hdr.size4x/4; @@ -29485,7 +29485,7 @@ static void memsys3Unlink(u32 i){ ** at *pRoot. */ static void memsys3LinkIntoList(u32 i, u32 *pRoot){ - assert( sqlite3_mutex_held(mem3.mutex) ); + assert( tdsqlite3_mutex_held(mem3.mutex) ); mem3.aPool[i].u.list.next = *pRoot; mem3.aPool[i].u.list.prev = 0; if( *pRoot ){ @@ -29500,7 +29500,7 @@ static void memsys3LinkIntoList(u32 i, u32 *pRoot){ */ static void memsys3Link(u32 i){ u32 size, hash; - assert( sqlite3_mutex_held(mem3.mutex) ); + assert( tdsqlite3_mutex_held(mem3.mutex) ); assert( i>=1 ); assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 ); size = mem3.aPool[i-1].u.hdr.size4x/4; @@ -29517,16 +29517,16 @@ static void memsys3Link(u32 i){ /* ** If the STATIC_MEM mutex is not already held, obtain it now. The mutex ** will already be held (obtained by code in malloc.c) if -** sqlite3GlobalConfig.bMemStat is true. +** tdsqlite3GlobalConfig.bMemStat is true. */ static void memsys3Enter(void){ - if( sqlite3GlobalConfig.bMemstat==0 && mem3.mutex==0 ){ - mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); + if( tdsqlite3GlobalConfig.bMemstat==0 && mem3.mutex==0 ){ + mem3.mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); } - sqlite3_mutex_enter(mem3.mutex); + tdsqlite3_mutex_enter(mem3.mutex); } static void memsys3Leave(void){ - sqlite3_mutex_leave(mem3.mutex); + tdsqlite3_mutex_leave(mem3.mutex); } /* @@ -29535,10 +29535,10 @@ static void memsys3Leave(void){ static void memsys3OutOfMemory(int nByte){ if( !mem3.alarmBusy ){ mem3.alarmBusy = 1; - assert( sqlite3_mutex_held(mem3.mutex) ); - sqlite3_mutex_leave(mem3.mutex); - sqlite3_release_memory(nByte); - sqlite3_mutex_enter(mem3.mutex); + assert( tdsqlite3_mutex_held(mem3.mutex) ); + tdsqlite3_mutex_leave(mem3.mutex); + tdsqlite3_release_memory(nByte); + tdsqlite3_mutex_enter(mem3.mutex); mem3.alarmBusy = 0; } } @@ -29551,7 +29551,7 @@ static void memsys3OutOfMemory(int nByte){ */ static void *memsys3Checkout(u32 i, u32 nBlock){ u32 x; - assert( sqlite3_mutex_held(mem3.mutex) ); + assert( tdsqlite3_mutex_held(mem3.mutex) ); assert( i>=1 ); assert( mem3.aPool[i-1].u.hdr.size4x/4==nBlock ); assert( mem3.aPool[i+nBlock-1].u.hdr.prevSize==nBlock ); @@ -29568,7 +29568,7 @@ static void *memsys3Checkout(u32 i, u32 nBlock){ ** is not large enough, return 0. */ static void *memsys3FromMaster(u32 nBlock){ - assert( sqlite3_mutex_held(mem3.mutex) ); + assert( tdsqlite3_mutex_held(mem3.mutex) ); assert( mem3.szMaster>=nBlock ); if( nBlock>=mem3.szMaster-1 ){ /* Use the entire master */ @@ -29615,7 +29615,7 @@ static void *memsys3FromMaster(u32 nBlock){ static void memsys3Merge(u32 *pRoot){ u32 iNext, prev, size, i, x; - assert( sqlite3_mutex_held(mem3.mutex) ); + assert( tdsqlite3_mutex_held(mem3.mutex) ); for(i=*pRoot; i>0; i=iNext){ iNext = mem3.aPool[i].u.list.next; size = mem3.aPool[i-1].u.hdr.size4x; @@ -29656,7 +29656,7 @@ static void *memsys3MallocUnsafe(int nByte){ u32 nBlock; u32 toFree; - assert( sqlite3_mutex_held(mem3.mutex) ); + assert( tdsqlite3_mutex_held(mem3.mutex) ); assert( sizeof(Mem3Block)==8 ); if( nByte<=12 ){ nBlock = 2; @@ -29737,7 +29737,7 @@ static void memsys3FreeUnsafe(void *pOld){ Mem3Block *p = (Mem3Block*)pOld; int i; u32 size, x; - assert( sqlite3_mutex_held(mem3.mutex) ); + assert( tdsqlite3_mutex_held(mem3.mutex) ); assert( p>mem3.aPool && p<&mem3.aPool[mem3.nPool] ); i = p - mem3.aPool; assert( (mem3.aPool[i-1].u.hdr.size4x&1)==1 ); @@ -29797,7 +29797,7 @@ static int memsys3Roundup(int n){ ** Allocate nBytes of memory. */ static void *memsys3Malloc(int nBytes){ - sqlite3_int64 *p; + tdsqlite3_int64 *p; assert( nBytes>0 ); /* malloc.c filters out 0 byte requests */ memsys3Enter(); p = memsys3MallocUnsafe(nBytes); @@ -29822,10 +29822,10 @@ static void *memsys3Realloc(void *pPrior, int nBytes){ int nOld; void *p; if( pPrior==0 ){ - return sqlite3_malloc(nBytes); + return tdsqlite3_malloc(nBytes); } if( nBytes<=0 ){ - sqlite3_free(pPrior); + tdsqlite3_free(pPrior); return 0; } nOld = memsys3Size(pPrior); @@ -29851,14 +29851,14 @@ static void *memsys3Realloc(void *pPrior, int nBytes){ */ static int memsys3Init(void *NotUsed){ UNUSED_PARAMETER(NotUsed); - if( !sqlite3GlobalConfig.pHeap ){ + if( !tdsqlite3GlobalConfig.pHeap ){ return SQLITE_ERROR; } /* Store a pointer to the memory block in global structure mem3. */ assert( sizeof(Mem3Block)==8 ); - mem3.aPool = (Mem3Block *)sqlite3GlobalConfig.pHeap; - mem3.nPool = (sqlite3GlobalConfig.nHeap / sizeof(Mem3Block)) - 2; + mem3.aPool = (Mem3Block *)tdsqlite3GlobalConfig.pHeap; + mem3.nPool = (tdsqlite3GlobalConfig.nHeap / sizeof(Mem3Block)) - 2; /* Initialize the master block. */ mem3.szMaster = mem3.nPool; @@ -29886,7 +29886,7 @@ static void memsys3Shutdown(void *NotUsed){ ** Open the file indicated and write a log of all unfreed memory ** allocations into that log. */ -SQLITE_PRIVATE void sqlite3Memsys3Dump(const char *zFilename){ +SQLITE_PRIVATE void tdsqlite3Memsys3Dump(const char *zFilename){ #ifdef SQLITE_DEBUG FILE *out; u32 i, j; @@ -29948,7 +29948,7 @@ SQLITE_PRIVATE void sqlite3Memsys3Dump(const char *zFilename){ fprintf(out, "master=%d\n", mem3.iMaster); fprintf(out, "nowUsed=%d\n", mem3.nPool*8 - mem3.szMaster*8); fprintf(out, "mxUsed=%d\n", mem3.nPool*8 - mem3.mnMaster*8); - sqlite3_mutex_leave(mem3.mutex); + tdsqlite3_mutex_leave(mem3.mutex); if( out==stdout ){ fflush(stdout); }else{ @@ -29964,14 +29964,14 @@ SQLITE_PRIVATE void sqlite3Memsys3Dump(const char *zFilename){ ** linkage. ** ** Populate the low-level memory allocation function pointers in -** sqlite3GlobalConfig.m with pointers to the routines in this file. The +** tdsqlite3GlobalConfig.m with pointers to the routines in this file. The ** arguments specify the block of memory to manage. ** -** This routine is only called by sqlite3_config(), and therefore +** This routine is only called by tdsqlite3_config(), and therefore ** is not required to be threadsafe (it is not). */ -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){ - static const sqlite3_mem_methods mempoolMethods = { +SQLITE_PRIVATE const tdsqlite3_mem_methods *tdsqlite3MemGetMemsys3(void){ + static const tdsqlite3_mem_methods mempoolMethods = { memsys3Malloc, memsys3Free, memsys3Realloc, @@ -30004,9 +30004,9 @@ SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){ ** ** This version of the memory allocation subsystem omits all ** use of malloc(). The application gives SQLite a block of memory -** before calling sqlite3_initialize() from which allocations +** before calling tdsqlite3_initialize() from which allocations ** are made and returned by the xMalloc() and xRealloc() -** implementations. Once sqlite3_initialize() has been called, +** implementations. Once tdsqlite3_initialize() has been called, ** the amount of memory available to SQLite is fixed and cannot ** be changed. ** @@ -30035,7 +30035,7 @@ SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){ ** ** N >= M*(1 + log2(n)/2) - n + 1 ** -** The sqlite3_status() logic tracks the maximum values of n and M so +** The tdsqlite3_status() logic tracks the maximum values of n and M so ** that an application can, at any time, verify this constraint. */ /* #include "sqliteInt.h" */ @@ -30090,7 +30090,7 @@ static SQLITE_WSD struct Mem5Global { /* ** Mutex to control access to the memory allocation subsystem. */ - sqlite3_mutex *mutex; + tdsqlite3_mutex *mutex; #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) /* @@ -30160,7 +30160,7 @@ static void memsys5Unlink(int i, int iLogsize){ */ static void memsys5Link(int i, int iLogsize){ int x; - assert( sqlite3_mutex_held(mem5.mutex) ); + assert( tdsqlite3_mutex_held(mem5.mutex) ); assert( i>=0 && i=0 && iLogsize<=LOGMAX ); assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize ); @@ -30178,10 +30178,10 @@ static void memsys5Link(int i, int iLogsize){ ** Obtain or release the mutex needed to access global data structures. */ static void memsys5Enter(void){ - sqlite3_mutex_enter(mem5.mutex); + tdsqlite3_mutex_enter(mem5.mutex); } static void memsys5Leave(void){ - sqlite3_mutex_leave(mem5.mutex); + tdsqlite3_mutex_leave(mem5.mutex); } /* @@ -30237,8 +30237,8 @@ static void *memsys5MallocUnsafe(int nByte){ */ for(iBin=iLogsize; iBin<=LOGMAX && mem5.aiFreelist[iBin]<0; iBin++){} if( iBin>LOGMAX ){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes", nByte); + testcase( tdsqlite3GlobalConfig.xLog!=0 ); + tdsqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes", nByte); return 0; } i = mem5.aiFreelist[iBin]; @@ -30344,7 +30344,7 @@ static void memsys5FreeUnsafe(void *pOld){ ** Allocate nBytes of memory. */ static void *memsys5Malloc(int nBytes){ - sqlite3_int64 *p = 0; + tdsqlite3_int64 *p = 0; if( nBytes>0 ){ memsys5Enter(); p = memsys5MallocUnsafe(nBytes); @@ -30454,12 +30454,12 @@ static int memsys5Init(void *NotUsed){ */ assert( (sizeof(Mem5Link)&(sizeof(Mem5Link)-1))==0 ); - nByte = sqlite3GlobalConfig.nHeap; - zByte = (u8*)sqlite3GlobalConfig.pHeap; - assert( zByte!=0 ); /* sqlite3_config() does not allow otherwise */ + nByte = tdsqlite3GlobalConfig.nHeap; + zByte = (u8*)tdsqlite3GlobalConfig.pHeap; + assert( zByte!=0 ); /* tdsqlite3_config() does not allow otherwise */ - /* boundaries on sqlite3GlobalConfig.mnReq are enforced in sqlite3_config() */ - nMinLog = memsys5Log(sqlite3GlobalConfig.mnReq); + /* boundaries on tdsqlite3GlobalConfig.mnReq are enforced in tdsqlite3_config() */ + nMinLog = memsys5Log(tdsqlite3GlobalConfig.mnReq); mem5.szAtom = (1<mem5.szAtom ){ mem5.szAtom = mem5.szAtom << 1; @@ -30485,8 +30485,8 @@ static int memsys5Init(void *NotUsed){ } /* If a mutex is required for normal operation, allocate one */ - if( sqlite3GlobalConfig.bMemstat==0 ){ - mem5.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); + if( tdsqlite3GlobalConfig.bMemstat==0 ){ + mem5.mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); } return SQLITE_OK; @@ -30506,7 +30506,7 @@ static void memsys5Shutdown(void *NotUsed){ ** Open the file indicated and write a log of all unfreed memory ** allocations into that log. */ -SQLITE_PRIVATE void sqlite3Memsys5Dump(const char *zFilename){ +SQLITE_PRIVATE void tdsqlite3Memsys5Dump(const char *zFilename){ FILE *out; int i, j, n; int nMinLog; @@ -30546,11 +30546,11 @@ SQLITE_PRIVATE void sqlite3Memsys5Dump(const char *zFilename){ /* ** This routine is the only routine in this file with external -** linkage. It returns a pointer to a static sqlite3_mem_methods +** linkage. It returns a pointer to a static tdsqlite3_mem_methods ** struct populated with the memsys5 methods. */ -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys5(void){ - static const sqlite3_mem_methods memsys5Methods = { +SQLITE_PRIVATE const tdsqlite3_mem_methods *tdsqlite3MemGetMemsys5(void){ + static const tdsqlite3_mem_methods memsys5Methods = { memsys5Malloc, memsys5Free, memsys5Realloc, @@ -30600,12 +30600,12 @@ static SQLITE_WSD int mutexIsInit = 0; /* ** This block (enclosed by SQLITE_ENABLE_MULTITHREADED_CHECKS) contains ** the implementation of a wrapper around the system default mutex -** implementation (sqlite3DefaultMutex()). +** implementation (tdsqlite3DefaultMutex()). ** ** Most calls are passed directly through to the underlying default ** mutex implementation. Except, if a mutex is configured by calling -** sqlite3MutexWarnOnContention() on it, then if contention is ever -** encountered within xMutexEnter() a warning is emitted via sqlite3_log(). +** tdsqlite3MutexWarnOnContention() on it, then if contention is ever +** encountered within xMutexEnter() a warning is emitted via tdsqlite3_log(). ** ** This type of mutex is used as the database handle mutex when testing ** apps that usually use SQLITE_CONFIG_MULTITHREAD mode. @@ -30617,13 +30617,13 @@ static SQLITE_WSD int mutexIsInit = 0; ** allocated by the system mutex implementation. Variable iType is usually set ** to the type of mutex requested - SQLITE_MUTEX_RECURSIVE, SQLITE_MUTEX_FAST ** or one of the static mutex identifiers. Or, if this is a recursive mutex -** that has been configured using sqlite3MutexWarnOnContention(), it is +** that has been configured using tdsqlite3MutexWarnOnContention(), it is ** set to SQLITE_MUTEX_WARNONCONTENTION. */ typedef struct CheckMutex CheckMutex; struct CheckMutex { int iType; - sqlite3_mutex *mutex; + tdsqlite3_mutex *mutex; }; #define SQLITE_MUTEX_WARNONCONTENTION (-1) @@ -30632,13 +30632,13 @@ struct CheckMutex { ** Pointer to real mutex methods object used by the CheckMutex ** implementation. Set by checkMutexInit(). */ -static SQLITE_WSD const sqlite3_mutex_methods *pGlobalMutexMethods; +static SQLITE_WSD const tdsqlite3_mutex_methods *pGlobalMutexMethods; #ifdef SQLITE_DEBUG -static int checkMutexHeld(sqlite3_mutex *p){ +static int checkMutexHeld(tdsqlite3_mutex *p){ return pGlobalMutexMethods->xMutexHeld(((CheckMutex*)p)->mutex); } -static int checkMutexNotheld(sqlite3_mutex *p){ +static int checkMutexNotheld(tdsqlite3_mutex *p){ return pGlobalMutexMethods->xMutexNotheld(((CheckMutex*)p)->mutex); } #endif @@ -30647,7 +30647,7 @@ static int checkMutexNotheld(sqlite3_mutex *p){ ** Initialize and deinitialize the mutex subsystem. */ static int checkMutexInit(void){ - pGlobalMutexMethods = sqlite3DefaultMutex(); + pGlobalMutexMethods = tdsqlite3DefaultMutex(); return SQLITE_OK; } static int checkMutexEnd(void){ @@ -30658,7 +30658,7 @@ static int checkMutexEnd(void){ /* ** Allocate a mutex. */ -static sqlite3_mutex *checkMutexAlloc(int iType){ +static tdsqlite3_mutex *checkMutexAlloc(int iType){ static CheckMutex staticMutexes[] = { {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0}, @@ -30668,7 +30668,7 @@ static sqlite3_mutex *checkMutexAlloc(int iType){ assert( SQLITE_MUTEX_RECURSIVE==1 && SQLITE_MUTEX_FAST==0 ); if( iType<2 ){ - p = sqlite3MallocZero(sizeof(CheckMutex)); + p = tdsqlite3MallocZero(sizeof(CheckMutex)); if( p==0 ) return 0; p->iType = iType; }else{ @@ -30685,19 +30685,19 @@ static sqlite3_mutex *checkMutexAlloc(int iType){ p->mutex = pGlobalMutexMethods->xMutexAlloc(iType); if( p->mutex==0 ){ if( iType<2 ){ - sqlite3_free(p); + tdsqlite3_free(p); } p = 0; } } - return (sqlite3_mutex*)p; + return (tdsqlite3_mutex*)p; } /* ** Free a mutex. */ -static void checkMutexFree(sqlite3_mutex *p){ +static void checkMutexFree(tdsqlite3_mutex *p){ assert( SQLITE_MUTEX_RECURSIVE<2 ); assert( SQLITE_MUTEX_FAST<2 ); assert( SQLITE_MUTEX_WARNONCONTENTION<2 ); @@ -30708,7 +30708,7 @@ static void checkMutexFree(sqlite3_mutex *p){ { CheckMutex *pCheck = (CheckMutex*)p; pGlobalMutexMethods->xMutexFree(pCheck->mutex); - sqlite3_free(pCheck); + tdsqlite3_free(pCheck); } #ifdef SQLITE_ENABLE_API_ARMOR else{ @@ -30720,13 +30720,13 @@ static void checkMutexFree(sqlite3_mutex *p){ /* ** Enter the mutex. */ -static void checkMutexEnter(sqlite3_mutex *p){ +static void checkMutexEnter(tdsqlite3_mutex *p){ CheckMutex *pCheck = (CheckMutex*)p; if( pCheck->iType==SQLITE_MUTEX_WARNONCONTENTION ){ if( SQLITE_OK==pGlobalMutexMethods->xMutexTry(pCheck->mutex) ){ return; } - sqlite3_log(SQLITE_MISUSE, + tdsqlite3_log(SQLITE_MISUSE, "illegal multi-threaded access to database connection" ); } @@ -30736,7 +30736,7 @@ static void checkMutexEnter(sqlite3_mutex *p){ /* ** Enter the mutex (do not block). */ -static int checkMutexTry(sqlite3_mutex *p){ +static int checkMutexTry(tdsqlite3_mutex *p){ CheckMutex *pCheck = (CheckMutex*)p; return pGlobalMutexMethods->xMutexTry(pCheck->mutex); } @@ -30744,13 +30744,13 @@ static int checkMutexTry(sqlite3_mutex *p){ /* ** Leave the mutex. */ -static void checkMutexLeave(sqlite3_mutex *p){ +static void checkMutexLeave(tdsqlite3_mutex *p){ CheckMutex *pCheck = (CheckMutex*)p; pGlobalMutexMethods->xMutexLeave(pCheck->mutex); } -sqlite3_mutex_methods const *multiThreadedCheckMutex(void){ - static const sqlite3_mutex_methods sMutex = { +tdsqlite3_mutex_methods const *multiThreadedCheckMutex(void){ + static const tdsqlite3_mutex_methods sMutex = { checkMutexInit, checkMutexEnd, checkMutexAlloc, @@ -30773,8 +30773,8 @@ sqlite3_mutex_methods const *multiThreadedCheckMutex(void){ ** Mark the SQLITE_MUTEX_RECURSIVE mutex passed as the only argument as ** one on which there should be no contention. */ -SQLITE_PRIVATE void sqlite3MutexWarnOnContention(sqlite3_mutex *p){ - if( sqlite3GlobalConfig.mutex.xMutexAlloc==checkMutexAlloc ){ +SQLITE_PRIVATE void tdsqlite3MutexWarnOnContention(tdsqlite3_mutex *p){ + if( tdsqlite3GlobalConfig.mutex.xMutexAlloc==checkMutexAlloc ){ CheckMutex *pCheck = (CheckMutex*)p; assert( pCheck->iType==SQLITE_MUTEX_RECURSIVE ); pCheck->iType = SQLITE_MUTEX_WARNONCONTENTION; @@ -30785,25 +30785,25 @@ SQLITE_PRIVATE void sqlite3MutexWarnOnContention(sqlite3_mutex *p){ /* ** Initialize the mutex system. */ -SQLITE_PRIVATE int sqlite3MutexInit(void){ +SQLITE_PRIVATE int tdsqlite3MutexInit(void){ int rc = SQLITE_OK; - if( !sqlite3GlobalConfig.mutex.xMutexAlloc ){ + if( !tdsqlite3GlobalConfig.mutex.xMutexAlloc ){ /* If the xMutexAlloc method has not been set, then the user did not - ** install a mutex implementation via sqlite3_config() prior to - ** sqlite3_initialize() being called. This block copies pointers to - ** the default implementation into the sqlite3GlobalConfig structure. + ** install a mutex implementation via tdsqlite3_config() prior to + ** tdsqlite3_initialize() being called. This block copies pointers to + ** the default implementation into the tdsqlite3GlobalConfig structure. */ - sqlite3_mutex_methods const *pFrom; - sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex; + tdsqlite3_mutex_methods const *pFrom; + tdsqlite3_mutex_methods *pTo = &tdsqlite3GlobalConfig.mutex; - if( sqlite3GlobalConfig.bCoreMutex ){ + if( tdsqlite3GlobalConfig.bCoreMutex ){ #ifdef SQLITE_ENABLE_MULTITHREADED_CHECKS pFrom = multiThreadedCheckMutex(); #else - pFrom = sqlite3DefaultMutex(); + pFrom = tdsqlite3DefaultMutex(); #endif }else{ - pFrom = sqlite3NoopMutex(); + pFrom = tdsqlite3NoopMutex(); } pTo->xMutexInit = pFrom->xMutexInit; pTo->xMutexEnd = pFrom->xMutexEnd; @@ -30813,11 +30813,11 @@ SQLITE_PRIVATE int sqlite3MutexInit(void){ pTo->xMutexLeave = pFrom->xMutexLeave; pTo->xMutexHeld = pFrom->xMutexHeld; pTo->xMutexNotheld = pFrom->xMutexNotheld; - sqlite3MemoryBarrier(); + tdsqlite3MemoryBarrier(); pTo->xMutexAlloc = pFrom->xMutexAlloc; } - assert( sqlite3GlobalConfig.mutex.xMutexInit ); - rc = sqlite3GlobalConfig.mutex.xMutexInit(); + assert( tdsqlite3GlobalConfig.mutex.xMutexInit ); + rc = tdsqlite3GlobalConfig.mutex.xMutexInit(); #ifdef SQLITE_DEBUG GLOBAL(int, mutexIsInit) = 1; @@ -30828,12 +30828,12 @@ SQLITE_PRIVATE int sqlite3MutexInit(void){ /* ** Shutdown the mutex system. This call frees resources allocated by -** sqlite3MutexInit(). +** tdsqlite3MutexInit(). */ -SQLITE_PRIVATE int sqlite3MutexEnd(void){ +SQLITE_PRIVATE int tdsqlite3MutexEnd(void){ int rc = SQLITE_OK; - if( sqlite3GlobalConfig.mutex.xMutexEnd ){ - rc = sqlite3GlobalConfig.mutex.xMutexEnd(); + if( tdsqlite3GlobalConfig.mutex.xMutexEnd ){ + rc = tdsqlite3GlobalConfig.mutex.xMutexEnd(); } #ifdef SQLITE_DEBUG @@ -30846,31 +30846,31 @@ SQLITE_PRIVATE int sqlite3MutexEnd(void){ /* ** Retrieve a pointer to a static mutex or allocate a new dynamic one. */ -SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int id){ +SQLITE_API tdsqlite3_mutex *tdsqlite3_mutex_alloc(int id){ #ifndef SQLITE_OMIT_AUTOINIT - if( id<=SQLITE_MUTEX_RECURSIVE && sqlite3_initialize() ) return 0; - if( id>SQLITE_MUTEX_RECURSIVE && sqlite3MutexInit() ) return 0; + if( id<=SQLITE_MUTEX_RECURSIVE && tdsqlite3_initialize() ) return 0; + if( id>SQLITE_MUTEX_RECURSIVE && tdsqlite3MutexInit() ) return 0; #endif - assert( sqlite3GlobalConfig.mutex.xMutexAlloc ); - return sqlite3GlobalConfig.mutex.xMutexAlloc(id); + assert( tdsqlite3GlobalConfig.mutex.xMutexAlloc ); + return tdsqlite3GlobalConfig.mutex.xMutexAlloc(id); } -SQLITE_PRIVATE sqlite3_mutex *sqlite3MutexAlloc(int id){ - if( !sqlite3GlobalConfig.bCoreMutex ){ +SQLITE_PRIVATE tdsqlite3_mutex *tdsqlite3MutexAlloc(int id){ + if( !tdsqlite3GlobalConfig.bCoreMutex ){ return 0; } assert( GLOBAL(int, mutexIsInit) ); - assert( sqlite3GlobalConfig.mutex.xMutexAlloc ); - return sqlite3GlobalConfig.mutex.xMutexAlloc(id); + assert( tdsqlite3GlobalConfig.mutex.xMutexAlloc ); + return tdsqlite3GlobalConfig.mutex.xMutexAlloc(id); } /* ** Free a dynamic mutex. */ -SQLITE_API void sqlite3_mutex_free(sqlite3_mutex *p){ +SQLITE_API void tdsqlite3_mutex_free(tdsqlite3_mutex *p){ if( p ){ - assert( sqlite3GlobalConfig.mutex.xMutexFree ); - sqlite3GlobalConfig.mutex.xMutexFree(p); + assert( tdsqlite3GlobalConfig.mutex.xMutexFree ); + tdsqlite3GlobalConfig.mutex.xMutexFree(p); } } @@ -30878,10 +30878,10 @@ SQLITE_API void sqlite3_mutex_free(sqlite3_mutex *p){ ** Obtain the mutex p. If some other thread already has the mutex, block ** until it can be obtained. */ -SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex *p){ +SQLITE_API void tdsqlite3_mutex_enter(tdsqlite3_mutex *p){ if( p ){ - assert( sqlite3GlobalConfig.mutex.xMutexEnter ); - sqlite3GlobalConfig.mutex.xMutexEnter(p); + assert( tdsqlite3GlobalConfig.mutex.xMutexEnter ); + tdsqlite3GlobalConfig.mutex.xMutexEnter(p); } } @@ -30889,40 +30889,40 @@ SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex *p){ ** Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another ** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY. */ -SQLITE_API int sqlite3_mutex_try(sqlite3_mutex *p){ +SQLITE_API int tdsqlite3_mutex_try(tdsqlite3_mutex *p){ int rc = SQLITE_OK; if( p ){ - assert( sqlite3GlobalConfig.mutex.xMutexTry ); - return sqlite3GlobalConfig.mutex.xMutexTry(p); + assert( tdsqlite3GlobalConfig.mutex.xMutexTry ); + return tdsqlite3GlobalConfig.mutex.xMutexTry(p); } return rc; } /* -** The sqlite3_mutex_leave() routine exits a mutex that was previously +** The tdsqlite3_mutex_leave() routine exits a mutex that was previously ** entered by the same thread. The behavior is undefined if the mutex ** is not currently entered. If a NULL pointer is passed as an argument ** this function is a no-op. */ -SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex *p){ +SQLITE_API void tdsqlite3_mutex_leave(tdsqlite3_mutex *p){ if( p ){ - assert( sqlite3GlobalConfig.mutex.xMutexLeave ); - sqlite3GlobalConfig.mutex.xMutexLeave(p); + assert( tdsqlite3GlobalConfig.mutex.xMutexLeave ); + tdsqlite3GlobalConfig.mutex.xMutexLeave(p); } } #ifndef NDEBUG /* -** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are +** The tdsqlite3_mutex_held() and tdsqlite3_mutex_notheld() routine are ** intended for use inside assert() statements. */ -SQLITE_API int sqlite3_mutex_held(sqlite3_mutex *p){ - assert( p==0 || sqlite3GlobalConfig.mutex.xMutexHeld ); - return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p); +SQLITE_API int tdsqlite3_mutex_held(tdsqlite3_mutex *p){ + assert( p==0 || tdsqlite3GlobalConfig.mutex.xMutexHeld ); + return p==0 || tdsqlite3GlobalConfig.mutex.xMutexHeld(p); } -SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex *p){ - assert( p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld ); - return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p); +SQLITE_API int tdsqlite3_mutex_notheld(tdsqlite3_mutex *p){ + assert( p==0 || tdsqlite3GlobalConfig.mutex.xMutexNotheld ); + return p==0 || tdsqlite3GlobalConfig.mutex.xMutexNotheld(p); } #endif @@ -30949,7 +30949,7 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex *p){ ** here are place-holders. Applications can substitute working ** mutex routines at start-time using the ** -** sqlite3_config(SQLITE_CONFIG_MUTEX,...) +** tdsqlite3_config(SQLITE_CONFIG_MUTEX,...) ** ** interface. ** @@ -30969,20 +30969,20 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex *p){ */ static int noopMutexInit(void){ return SQLITE_OK; } static int noopMutexEnd(void){ return SQLITE_OK; } -static sqlite3_mutex *noopMutexAlloc(int id){ +static tdsqlite3_mutex *noopMutexAlloc(int id){ UNUSED_PARAMETER(id); - return (sqlite3_mutex*)8; + return (tdsqlite3_mutex*)8; } -static void noopMutexFree(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; } -static void noopMutexEnter(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; } -static int noopMutexTry(sqlite3_mutex *p){ +static void noopMutexFree(tdsqlite3_mutex *p){ UNUSED_PARAMETER(p); return; } +static void noopMutexEnter(tdsqlite3_mutex *p){ UNUSED_PARAMETER(p); return; } +static int noopMutexTry(tdsqlite3_mutex *p){ UNUSED_PARAMETER(p); return SQLITE_OK; } -static void noopMutexLeave(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; } +static void noopMutexLeave(tdsqlite3_mutex *p){ UNUSED_PARAMETER(p); return; } -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void){ - static const sqlite3_mutex_methods sMutex = { +SQLITE_PRIVATE tdsqlite3_mutex_methods const *tdsqlite3NoopMutex(void){ + static const tdsqlite3_mutex_methods sMutex = { noopMutexInit, noopMutexEnd, noopMutexAlloc, @@ -31009,21 +31009,21 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void){ /* ** The mutex object */ -typedef struct sqlite3_debug_mutex { +typedef struct tdsqlite3_debug_mutex { int id; /* The mutex type */ int cnt; /* Number of entries without a matching leave */ -} sqlite3_debug_mutex; +} tdsqlite3_debug_mutex; /* -** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are +** The tdsqlite3_mutex_held() and tdsqlite3_mutex_notheld() routine are ** intended for use inside assert() statements. */ -static int debugMutexHeld(sqlite3_mutex *pX){ - sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX; +static int debugMutexHeld(tdsqlite3_mutex *pX){ + tdsqlite3_debug_mutex *p = (tdsqlite3_debug_mutex*)pX; return p==0 || p->cnt>0; } -static int debugMutexNotheld(sqlite3_mutex *pX){ - sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX; +static int debugMutexNotheld(tdsqlite3_mutex *pX){ + tdsqlite3_debug_mutex *p = (tdsqlite3_debug_mutex*)pX; return p==0 || p->cnt==0; } @@ -31034,17 +31034,17 @@ static int debugMutexInit(void){ return SQLITE_OK; } static int debugMutexEnd(void){ return SQLITE_OK; } /* -** The sqlite3_mutex_alloc() routine allocates a new +** The tdsqlite3_mutex_alloc() routine allocates a new ** mutex and returns a pointer to it. If it returns NULL ** that means that a mutex could not be allocated. */ -static sqlite3_mutex *debugMutexAlloc(int id){ - static sqlite3_debug_mutex aStatic[SQLITE_MUTEX_STATIC_VFS3 - 1]; - sqlite3_debug_mutex *pNew = 0; +static tdsqlite3_mutex *debugMutexAlloc(int id){ + static tdsqlite3_debug_mutex aStatic[SQLITE_MUTEX_STATIC_VFS3 - 1]; + tdsqlite3_debug_mutex *pNew = 0; switch( id ){ case SQLITE_MUTEX_FAST: case SQLITE_MUTEX_RECURSIVE: { - pNew = sqlite3Malloc(sizeof(*pNew)); + pNew = tdsqlite3Malloc(sizeof(*pNew)); if( pNew ){ pNew->id = id; pNew->cnt = 0; @@ -31063,17 +31063,17 @@ static sqlite3_mutex *debugMutexAlloc(int id){ break; } } - return (sqlite3_mutex*)pNew; + return (tdsqlite3_mutex*)pNew; } /* ** This routine deallocates a previously allocated mutex. */ -static void debugMutexFree(sqlite3_mutex *pX){ - sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX; +static void debugMutexFree(tdsqlite3_mutex *pX){ + tdsqlite3_debug_mutex *p = (tdsqlite3_debug_mutex*)pX; assert( p->cnt==0 ); if( p->id==SQLITE_MUTEX_RECURSIVE || p->id==SQLITE_MUTEX_FAST ){ - sqlite3_free(p); + tdsqlite3_free(p); }else{ #ifdef SQLITE_ENABLE_API_ARMOR (void)SQLITE_MISUSE_BKPT; @@ -31082,43 +31082,43 @@ static void debugMutexFree(sqlite3_mutex *pX){ } /* -** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt +** The tdsqlite3_mutex_enter() and tdsqlite3_mutex_try() routines attempt ** to enter a mutex. If another thread is already within the mutex, -** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return -** SQLITE_BUSY. The sqlite3_mutex_try() interface returns SQLITE_OK +** tdsqlite3_mutex_enter() will block and tdsqlite3_mutex_try() will return +** SQLITE_BUSY. The tdsqlite3_mutex_try() interface returns SQLITE_OK ** upon successful entry. Mutexes created using SQLITE_MUTEX_RECURSIVE can ** be entered multiple times by the same thread. In such cases the, ** mutex must be exited an equal number of times before another thread ** can enter. If the same thread tries to enter any other kind of mutex ** more than once, the behavior is undefined. */ -static void debugMutexEnter(sqlite3_mutex *pX){ - sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX; +static void debugMutexEnter(tdsqlite3_mutex *pX){ + tdsqlite3_debug_mutex *p = (tdsqlite3_debug_mutex*)pX; assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) ); p->cnt++; } -static int debugMutexTry(sqlite3_mutex *pX){ - sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX; +static int debugMutexTry(tdsqlite3_mutex *pX){ + tdsqlite3_debug_mutex *p = (tdsqlite3_debug_mutex*)pX; assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) ); p->cnt++; return SQLITE_OK; } /* -** The sqlite3_mutex_leave() routine exits a mutex that was +** The tdsqlite3_mutex_leave() routine exits a mutex that was ** previously entered by the same thread. The behavior ** is undefined if the mutex is not currently entered or ** is not currently allocated. SQLite will never do either. */ -static void debugMutexLeave(sqlite3_mutex *pX){ - sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX; +static void debugMutexLeave(tdsqlite3_mutex *pX){ + tdsqlite3_debug_mutex *p = (tdsqlite3_debug_mutex*)pX; assert( debugMutexHeld(pX) ); p->cnt--; assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) ); } -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void){ - static const sqlite3_mutex_methods sMutex = { +SQLITE_PRIVATE tdsqlite3_mutex_methods const *tdsqlite3NoopMutex(void){ + static const tdsqlite3_mutex_methods sMutex = { debugMutexInit, debugMutexEnd, debugMutexAlloc, @@ -31140,8 +31140,8 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void){ ** is used regardless of the run-time threadsafety setting. */ #ifdef SQLITE_MUTEX_NOOP -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ - return sqlite3NoopMutex(); +SQLITE_PRIVATE tdsqlite3_mutex_methods const *tdsqlite3DefaultMutex(void){ + return tdsqlite3NoopMutex(); } #endif /* defined(SQLITE_MUTEX_NOOP) */ #endif /* !defined(SQLITE_MUTEX_OMIT) */ @@ -31175,7 +31175,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ #include /* -** The sqlite3_mutex.id, sqlite3_mutex.nRef, and sqlite3_mutex.owner fields +** The tdsqlite3_mutex.id, tdsqlite3_mutex.nRef, and tdsqlite3_mutex.owner fields ** are necessary under two condidtions: (1) Debug builds and (2) using ** home-grown mutexes. Encapsulate these conditions into a single #define. */ @@ -31188,7 +31188,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ /* ** Each recursive mutex is an instance of the following structure. */ -struct sqlite3_mutex { +struct tdsqlite3_mutex { pthread_mutex_t mutex; /* Mutex controlling the lock */ #if SQLITE_MUTEX_NREF || defined(SQLITE_ENABLE_API_ARMOR) int id; /* Mutex type */ @@ -31209,7 +31209,7 @@ struct sqlite3_mutex { #endif /* -** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are +** The tdsqlite3_mutex_held() and tdsqlite3_mutex_notheld() routine are ** intended for use only inside assert() statements. On some platforms, ** there might be race conditions that can cause these routines to ** deliver incorrect results. In particular, if pthread_equal() is @@ -31225,10 +31225,10 @@ struct sqlite3_mutex { ** routines are never called. */ #if !defined(NDEBUG) || defined(SQLITE_DEBUG) -static int pthreadMutexHeld(sqlite3_mutex *p){ +static int pthreadMutexHeld(tdsqlite3_mutex *p){ return (p->nRef!=0 && pthread_equal(p->owner, pthread_self())); } -static int pthreadMutexNotheld(sqlite3_mutex *p){ +static int pthreadMutexNotheld(tdsqlite3_mutex *p){ return p->nRef==0 || pthread_equal(p->owner, pthread_self())==0; } #endif @@ -31238,7 +31238,7 @@ static int pthreadMutexNotheld(sqlite3_mutex *p){ ** and also for the implementation of xShmBarrier in the VFS in cases ** where SQLite is compiled without mutexes. */ -SQLITE_PRIVATE void sqlite3MemoryBarrier(void){ +SQLITE_PRIVATE void tdsqlite3MemoryBarrier(void){ #if defined(SQLITE_MEMORY_BARRIER) SQLITE_MEMORY_BARRIER; #elif defined(__GNUC__) && GCC_VERSION>=4001000 @@ -31253,11 +31253,11 @@ static int pthreadMutexInit(void){ return SQLITE_OK; } static int pthreadMutexEnd(void){ return SQLITE_OK; } /* -** The sqlite3_mutex_alloc() routine allocates a new +** The tdsqlite3_mutex_alloc() routine allocates a new ** mutex and returns a pointer to it. If it returns NULL ** that means that a mutex could not be allocated. SQLite ** will unwind its stack and return an error. The argument -** to sqlite3_mutex_alloc() is one of these integer constants: +** to tdsqlite3_mutex_alloc() is one of these integer constants: ** **
    **
  • SQLITE_MUTEX_FAST @@ -31276,7 +31276,7 @@ static int pthreadMutexEnd(void){ return SQLITE_OK; } **
  • SQLITE_MUTEX_STATIC_VFS3 **
** -** The first two constants cause sqlite3_mutex_alloc() to create +** The first two constants cause tdsqlite3_mutex_alloc() to create ** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE ** is used but not necessarily so when SQLITE_MUTEX_FAST is used. ** The mutex implementation does not need to make a distinction @@ -31286,7 +31286,7 @@ static int pthreadMutexEnd(void){ return SQLITE_OK; } ** implementation is available on the host platform, the mutex subsystem ** might return such a mutex in response to SQLITE_MUTEX_FAST. ** -** The other allowed parameters to sqlite3_mutex_alloc() each return +** The other allowed parameters to tdsqlite3_mutex_alloc() each return ** a pointer to a static preexisting mutex. Six static mutexes are ** used by the current version of SQLite. Future versions of SQLite ** may add additional static mutexes. Static mutexes are for internal @@ -31295,13 +31295,13 @@ static int pthreadMutexEnd(void){ return SQLITE_OK; } ** SQLITE_MUTEX_RECURSIVE. ** ** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST -** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() +** or SQLITE_MUTEX_RECURSIVE) is used then tdsqlite3_mutex_alloc() ** returns a different mutex on every call. But for the static ** mutex types, the same mutex is returned on every call that has ** the same type number. */ -static sqlite3_mutex *pthreadMutexAlloc(int iType){ - static sqlite3_mutex staticMutexes[] = { +static tdsqlite3_mutex *pthreadMutexAlloc(int iType){ + static tdsqlite3_mutex staticMutexes[] = { SQLITE3_MUTEX_INITIALIZER(2), SQLITE3_MUTEX_INITIALIZER(3), SQLITE3_MUTEX_INITIALIZER(4), @@ -31315,10 +31315,10 @@ static sqlite3_mutex *pthreadMutexAlloc(int iType){ SQLITE3_MUTEX_INITIALIZER(12), SQLITE3_MUTEX_INITIALIZER(13) }; - sqlite3_mutex *p; + tdsqlite3_mutex *p; switch( iType ){ case SQLITE_MUTEX_RECURSIVE: { - p = sqlite3MallocZero( sizeof(*p) ); + p = tdsqlite3MallocZero( sizeof(*p) ); if( p ){ #ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX /* If recursive mutexes are not available, we will have to @@ -31339,7 +31339,7 @@ static sqlite3_mutex *pthreadMutexAlloc(int iType){ break; } case SQLITE_MUTEX_FAST: { - p = sqlite3MallocZero( sizeof(*p) ); + p = tdsqlite3MallocZero( sizeof(*p) ); if( p ){ pthread_mutex_init(&p->mutex, 0); #if SQLITE_MUTEX_NREF || defined(SQLITE_ENABLE_API_ARMOR) @@ -31371,14 +31371,14 @@ static sqlite3_mutex *pthreadMutexAlloc(int iType){ ** allocated mutex. SQLite is careful to deallocate every ** mutex that it allocates. */ -static void pthreadMutexFree(sqlite3_mutex *p){ +static void pthreadMutexFree(tdsqlite3_mutex *p){ assert( p->nRef==0 ); #if SQLITE_ENABLE_API_ARMOR if( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE ) #endif { pthread_mutex_destroy(&p->mutex); - sqlite3_free(p); + tdsqlite3_free(p); } #ifdef SQLITE_ENABLE_API_ARMOR else{ @@ -31388,17 +31388,17 @@ static void pthreadMutexFree(sqlite3_mutex *p){ } /* -** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt +** The tdsqlite3_mutex_enter() and tdsqlite3_mutex_try() routines attempt ** to enter a mutex. If another thread is already within the mutex, -** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return -** SQLITE_BUSY. The sqlite3_mutex_try() interface returns SQLITE_OK +** tdsqlite3_mutex_enter() will block and tdsqlite3_mutex_try() will return +** SQLITE_BUSY. The tdsqlite3_mutex_try() interface returns SQLITE_OK ** upon successful entry. Mutexes created using SQLITE_MUTEX_RECURSIVE can ** be entered multiple times by the same thread. In such cases the, ** mutex must be exited an equal number of times before another thread ** can enter. If the same thread tries to enter any other kind of mutex ** more than once, the behavior is undefined. */ -static void pthreadMutexEnter(sqlite3_mutex *p){ +static void pthreadMutexEnter(tdsqlite3_mutex *p){ assert( p->id==SQLITE_MUTEX_RECURSIVE || pthreadMutexNotheld(p) ); #ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX @@ -31440,7 +31440,7 @@ static void pthreadMutexEnter(sqlite3_mutex *p){ } #endif } -static int pthreadMutexTry(sqlite3_mutex *p){ +static int pthreadMutexTry(tdsqlite3_mutex *p){ int rc; assert( p->id==SQLITE_MUTEX_RECURSIVE || pthreadMutexNotheld(p) ); @@ -31492,12 +31492,12 @@ static int pthreadMutexTry(sqlite3_mutex *p){ } /* -** The sqlite3_mutex_leave() routine exits a mutex that was +** The tdsqlite3_mutex_leave() routine exits a mutex that was ** previously entered by the same thread. The behavior ** is undefined if the mutex is not currently entered or ** is not currently allocated. SQLite will never do either. */ -static void pthreadMutexLeave(sqlite3_mutex *p){ +static void pthreadMutexLeave(tdsqlite3_mutex *p){ assert( pthreadMutexHeld(p) ); #if SQLITE_MUTEX_NREF p->nRef--; @@ -31520,8 +31520,8 @@ static void pthreadMutexLeave(sqlite3_mutex *p){ #endif } -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ - static const sqlite3_mutex_methods sMutex = { +SQLITE_PRIVATE tdsqlite3_mutex_methods const *tdsqlite3DefaultMutex(void){ + static const tdsqlite3_mutex_methods sMutex = { pthreadMutexInit, pthreadMutexEnd, pthreadMutexAlloc, @@ -31639,7 +31639,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ #if defined(__GNUC__) - __inline__ sqlite_uint64 sqlite3Hwtime(void){ + __inline__ sqlite_uint64 tdsqlite3Hwtime(void){ unsigned int lo, hi; __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); return (sqlite_uint64)hi << 32 | lo; @@ -31647,7 +31647,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ #elif defined(_MSC_VER) - __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ + __declspec(naked) __inline sqlite_uint64 __cdecl tdsqlite3Hwtime(void){ __asm { rdtsc ret ; return value at EDX:EAX @@ -31658,7 +31658,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ #elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) - __inline__ sqlite_uint64 sqlite3Hwtime(void){ + __inline__ sqlite_uint64 tdsqlite3Hwtime(void){ unsigned long val; __asm__ __volatile__ ("rdtsc" : "=A" (val)); return val; @@ -31666,7 +31666,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ #elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) - __inline__ sqlite_uint64 sqlite3Hwtime(void){ + __inline__ sqlite_uint64 tdsqlite3Hwtime(void){ unsigned long long retval; unsigned long junk; __asm__ __volatile__ ("\n\ @@ -31683,13 +31683,13 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ /* ** asm() is needed for hardware timing support. Without asm(), - ** disable the sqlite3Hwtime() routine. + ** disable the tdsqlite3Hwtime() routine. ** - ** sqlite3Hwtime() is only used for some obscure debugging + ** tdsqlite3Hwtime() is only used for some obscure debugging ** and analysis configurations, not in any deliverable, so this ** should not be a great loss. */ -SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } +SQLITE_PRIVATE sqlite_uint64 tdsqlite3Hwtime(void){ return ((sqlite_uint64)0); } #endif @@ -31700,8 +31700,8 @@ SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } static sqlite_uint64 g_start; static sqlite_uint64 g_elapsed; -#define TIMER_START g_start=sqlite3Hwtime() -#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start +#define TIMER_START g_start=tdsqlite3Hwtime() +#define TIMER_END g_elapsed=tdsqlite3Hwtime()-g_start #define TIMER_ELAPSED g_elapsed #else #define TIMER_START @@ -31715,32 +31715,32 @@ static sqlite_uint64 g_elapsed; ** is used for testing the I/O recovery logic. */ #if defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_io_error_hit; -SQLITE_API extern int sqlite3_io_error_hardhit; -SQLITE_API extern int sqlite3_io_error_pending; -SQLITE_API extern int sqlite3_io_error_persist; -SQLITE_API extern int sqlite3_io_error_benign; -SQLITE_API extern int sqlite3_diskfull_pending; -SQLITE_API extern int sqlite3_diskfull; -#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X) +SQLITE_API extern int tdsqlite3_io_error_hit; +SQLITE_API extern int tdsqlite3_io_error_hardhit; +SQLITE_API extern int tdsqlite3_io_error_pending; +SQLITE_API extern int tdsqlite3_io_error_persist; +SQLITE_API extern int tdsqlite3_io_error_benign; +SQLITE_API extern int tdsqlite3_diskfull_pending; +SQLITE_API extern int tdsqlite3_diskfull; +#define SimulateIOErrorBenign(X) tdsqlite3_io_error_benign=(X) #define SimulateIOError(CODE) \ - if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \ - || sqlite3_io_error_pending-- == 1 ) \ + if( (tdsqlite3_io_error_persist && tdsqlite3_io_error_hit) \ + || tdsqlite3_io_error_pending-- == 1 ) \ { local_ioerr(); CODE; } static void local_ioerr(){ IOTRACE(("IOERR\n")); - sqlite3_io_error_hit++; - if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++; + tdsqlite3_io_error_hit++; + if( !tdsqlite3_io_error_benign ) tdsqlite3_io_error_hardhit++; } #define SimulateDiskfullError(CODE) \ - if( sqlite3_diskfull_pending ){ \ - if( sqlite3_diskfull_pending == 1 ){ \ + if( tdsqlite3_diskfull_pending ){ \ + if( tdsqlite3_diskfull_pending == 1 ){ \ local_ioerr(); \ - sqlite3_diskfull = 1; \ - sqlite3_io_error_hit = 1; \ + tdsqlite3_diskfull = 1; \ + tdsqlite3_io_error_hit = 1; \ CODE; \ }else{ \ - sqlite3_diskfull_pending--; \ + tdsqlite3_diskfull_pending--; \ } \ } #else @@ -31753,8 +31753,8 @@ static void local_ioerr(){ ** When testing, keep a count of the number of open files. */ #if defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_open_file_count; -#define OpenCounter(X) sqlite3_open_file_count+=(X) +SQLITE_API extern int tdsqlite3_open_file_count; +#define OpenCounter(X) tdsqlite3_open_file_count+=(X) #else #define OpenCounter(X) #endif /* defined(SQLITE_TEST) */ @@ -31874,7 +31874,7 @@ SQLITE_API extern int sqlite3_open_file_count; /* ** Each recursive mutex is an instance of the following structure. */ -struct sqlite3_mutex { +struct tdsqlite3_mutex { CRITICAL_SECTION mutex; /* Mutex controlling the lock */ int id; /* Mutex type */ #ifdef SQLITE_DEBUG @@ -31900,18 +31900,18 @@ struct sqlite3_mutex { #ifdef SQLITE_DEBUG /* -** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are +** The tdsqlite3_mutex_held() and tdsqlite3_mutex_notheld() routine are ** intended for use only inside assert() statements. */ -static int winMutexHeld(sqlite3_mutex *p){ +static int winMutexHeld(tdsqlite3_mutex *p){ return p->nRef!=0 && p->owner==GetCurrentThreadId(); } -static int winMutexNotheld2(sqlite3_mutex *p, DWORD tid){ +static int winMutexNotheld2(tdsqlite3_mutex *p, DWORD tid){ return p->nRef==0 || p->owner!=tid; } -static int winMutexNotheld(sqlite3_mutex *p){ +static int winMutexNotheld(tdsqlite3_mutex *p){ DWORD tid = GetCurrentThreadId(); return winMutexNotheld2(p, tid); } @@ -31922,7 +31922,7 @@ static int winMutexNotheld(sqlite3_mutex *p){ ** and also for the xShmBarrier method of the VFS in cases when SQLite is ** compiled without mutexes (SQLITE_THREADSAFE=0). */ -SQLITE_PRIVATE void sqlite3MemoryBarrier(void){ +SQLITE_PRIVATE void tdsqlite3MemoryBarrier(void){ #if defined(SQLITE_MEMORY_BARRIER) SQLITE_MEMORY_BARRIER; #elif defined(__GNUC__) @@ -31937,7 +31937,7 @@ SQLITE_PRIVATE void sqlite3MemoryBarrier(void){ /* ** Initialize and deinitialize the mutex subsystem. */ -static sqlite3_mutex winMutex_staticMutexes[] = { +static tdsqlite3_mutex winMutex_staticMutexes[] = { SQLITE3_MUTEX_INITIALIZER(2), SQLITE3_MUTEX_INITIALIZER(3), SQLITE3_MUTEX_INITIALIZER(4), @@ -31956,13 +31956,13 @@ static int winMutex_isInit = 0; static int winMutex_isNt = -1; /* <0 means "need to query" */ /* As the winMutexInit() and winMutexEnd() functions are called as part -** of the sqlite3_initialize() and sqlite3_shutdown() processing, the +** of the tdsqlite3_initialize() and tdsqlite3_shutdown() processing, the ** "interlocked" magic used here is probably not strictly necessary. */ static LONG SQLITE_WIN32_VOLATILE winMutex_lock = 0; -SQLITE_API int sqlite3_win32_is_nt(void); /* os_win.c */ -SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds); /* os_win.c */ +SQLITE_API int tdsqlite3_win32_is_nt(void); /* os_win.c */ +SQLITE_API void tdsqlite3_win32_sleep(DWORD milliseconds); /* os_win.c */ static int winMutexInit(void){ /* The first to increment to 1 does actual initialization */ @@ -31980,7 +31980,7 @@ static int winMutexInit(void){ /* Another thread is (in the process of) initializing the static ** mutexes */ while( !winMutex_isInit ){ - sqlite3_win32_sleep(1); + tdsqlite3_win32_sleep(1); } } return SQLITE_OK; @@ -32002,11 +32002,11 @@ static int winMutexEnd(void){ } /* -** The sqlite3_mutex_alloc() routine allocates a new +** The tdsqlite3_mutex_alloc() routine allocates a new ** mutex and returns a pointer to it. If it returns NULL ** that means that a mutex could not be allocated. SQLite ** will unwind its stack and return an error. The argument -** to sqlite3_mutex_alloc() is one of these integer constants: +** to tdsqlite3_mutex_alloc() is one of these integer constants: ** **
    **
  • SQLITE_MUTEX_FAST @@ -32025,7 +32025,7 @@ static int winMutexEnd(void){ **
  • SQLITE_MUTEX_STATIC_VFS3 **
** -** The first two constants cause sqlite3_mutex_alloc() to create +** The first two constants cause tdsqlite3_mutex_alloc() to create ** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE ** is used but not necessarily so when SQLITE_MUTEX_FAST is used. ** The mutex implementation does not need to make a distinction @@ -32035,7 +32035,7 @@ static int winMutexEnd(void){ ** implementation is available on the host platform, the mutex subsystem ** might return such a mutex in response to SQLITE_MUTEX_FAST. ** -** The other allowed parameters to sqlite3_mutex_alloc() each return +** The other allowed parameters to tdsqlite3_mutex_alloc() each return ** a pointer to a static preexisting mutex. Six static mutexes are ** used by the current version of SQLite. Future versions of SQLite ** may add additional static mutexes. Static mutexes are for internal @@ -32044,18 +32044,18 @@ static int winMutexEnd(void){ ** SQLITE_MUTEX_RECURSIVE. ** ** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST -** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() +** or SQLITE_MUTEX_RECURSIVE) is used then tdsqlite3_mutex_alloc() ** returns a different mutex on every call. But for the static ** mutex types, the same mutex is returned on every call that has ** the same type number. */ -static sqlite3_mutex *winMutexAlloc(int iType){ - sqlite3_mutex *p; +static tdsqlite3_mutex *winMutexAlloc(int iType){ + tdsqlite3_mutex *p; switch( iType ){ case SQLITE_MUTEX_FAST: case SQLITE_MUTEX_RECURSIVE: { - p = sqlite3MallocZero( sizeof(*p) ); + p = tdsqlite3MallocZero( sizeof(*p) ); if( p ){ p->id = iType; #ifdef SQLITE_DEBUG @@ -32097,12 +32097,12 @@ static sqlite3_mutex *winMutexAlloc(int iType){ ** allocated mutex. SQLite is careful to deallocate every ** mutex that it allocates. */ -static void winMutexFree(sqlite3_mutex *p){ +static void winMutexFree(tdsqlite3_mutex *p){ assert( p ); assert( p->nRef==0 && p->owner==0 ); if( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE ){ DeleteCriticalSection(&p->mutex); - sqlite3_free(p); + tdsqlite3_free(p); }else{ #ifdef SQLITE_ENABLE_API_ARMOR (void)SQLITE_MISUSE_BKPT; @@ -32111,17 +32111,17 @@ static void winMutexFree(sqlite3_mutex *p){ } /* -** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt +** The tdsqlite3_mutex_enter() and tdsqlite3_mutex_try() routines attempt ** to enter a mutex. If another thread is already within the mutex, -** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return -** SQLITE_BUSY. The sqlite3_mutex_try() interface returns SQLITE_OK +** tdsqlite3_mutex_enter() will block and tdsqlite3_mutex_try() will return +** SQLITE_BUSY. The tdsqlite3_mutex_try() interface returns SQLITE_OK ** upon successful entry. Mutexes created using SQLITE_MUTEX_RECURSIVE can ** be entered multiple times by the same thread. In such cases the, ** mutex must be exited an equal number of times before another thread ** can enter. If the same thread tries to enter any other kind of mutex ** more than once, the behavior is undefined. */ -static void winMutexEnter(sqlite3_mutex *p){ +static void winMutexEnter(tdsqlite3_mutex *p){ #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) DWORD tid = GetCurrentThreadId(); #endif @@ -32144,7 +32144,7 @@ static void winMutexEnter(sqlite3_mutex *p){ #endif } -static int winMutexTry(sqlite3_mutex *p){ +static int winMutexTry(tdsqlite3_mutex *p){ #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) DWORD tid = GetCurrentThreadId(); #endif @@ -32152,7 +32152,7 @@ static int winMutexTry(sqlite3_mutex *p){ assert( p ); assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) ); /* - ** The sqlite3_mutex_try() routine is very rarely used, and when it + ** The tdsqlite3_mutex_try() routine is very rarely used, and when it ** is used it is merely an optimization. So it is OK for it to always ** fail. ** @@ -32166,7 +32166,7 @@ static int winMutexTry(sqlite3_mutex *p){ assert( winMutex_isInit==1 ); assert( winMutex_isNt>=-1 && winMutex_isNt<=1 ); if( winMutex_isNt<0 ){ - winMutex_isNt = sqlite3_win32_is_nt(); + winMutex_isNt = tdsqlite3_win32_is_nt(); } assert( winMutex_isNt==0 || winMutex_isNt==1 ); if( winMutex_isNt && TryEnterCriticalSection(&p->mutex) ){ @@ -32182,19 +32182,19 @@ static int winMutexTry(sqlite3_mutex *p){ #ifdef SQLITE_DEBUG if( p->trace ){ OSTRACE(("TRY-MUTEX tid=%lu, mutex(%d)=%p (%d), owner=%lu, nRef=%d, rc=%s\n", - tid, p->id, p, p->trace, p->owner, p->nRef, sqlite3ErrName(rc))); + tid, p->id, p, p->trace, p->owner, p->nRef, tdsqlite3ErrName(rc))); } #endif return rc; } /* -** The sqlite3_mutex_leave() routine exits a mutex that was +** The tdsqlite3_mutex_leave() routine exits a mutex that was ** previously entered by the same thread. The behavior ** is undefined if the mutex is not currently entered or ** is not currently allocated. SQLite will never do either. */ -static void winMutexLeave(sqlite3_mutex *p){ +static void winMutexLeave(tdsqlite3_mutex *p){ #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) DWORD tid = GetCurrentThreadId(); #endif @@ -32216,8 +32216,8 @@ static void winMutexLeave(sqlite3_mutex *p){ #endif } -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ - static const sqlite3_mutex_methods sMutex = { +SQLITE_PRIVATE tdsqlite3_mutex_methods const *tdsqlite3DefaultMutex(void){ + static const tdsqlite3_mutex_methods sMutex = { winMutexInit, winMutexEnd, winMutexAlloc, @@ -32262,11 +32262,11 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ ** held by SQLite. An example of non-essential memory is memory used to ** cache database pages that are not currently in use. */ -SQLITE_API int sqlite3_release_memory(int n){ +SQLITE_API int tdsqlite3_release_memory(int n){ #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT - return sqlite3PcacheReleaseMemory(n); + return tdsqlite3PcacheReleaseMemory(n); #else - /* IMPLEMENTATION-OF: R-34391-24921 The sqlite3_release_memory() routine + /* IMPLEMENTATION-OF: R-34391-24921 The tdsqlite3_release_memory() routine ** is a no-op returning zero if SQLite is not compiled with ** SQLITE_ENABLE_MEMORY_MANAGEMENT. */ UNUSED_PARAMETER(n); @@ -32285,13 +32285,13 @@ SQLITE_API int sqlite3_release_memory(int n){ ** State information local to the memory allocation subsystem. */ static SQLITE_WSD struct Mem0Global { - sqlite3_mutex *mutex; /* Mutex to serialize access */ - sqlite3_int64 alarmThreshold; /* The soft heap limit */ - sqlite3_int64 hardLimit; /* The hard upper bound on memory */ + tdsqlite3_mutex *mutex; /* Mutex to serialize access */ + tdsqlite3_int64 alarmThreshold; /* The soft heap limit */ + tdsqlite3_int64 hardLimit; /* The hard upper bound on memory */ /* ** True if heap is nearly "full" where "full" is defined by the - ** sqlite3_soft_heap_limit() setting. + ** tdsqlite3_soft_heap_limit() setting. */ int nearlyFull; } mem0 = { 0, SQLITE_MAX_MEMORY, SQLITE_MAX_MEMORY, 0 }; @@ -32299,9 +32299,9 @@ static SQLITE_WSD struct Mem0Global { #define mem0 GLOBAL(struct Mem0Global, mem0) /* -** Return the memory allocator mutex. sqlite3_status() needs it. +** Return the memory allocator mutex. tdsqlite3_status() needs it. */ -SQLITE_PRIVATE sqlite3_mutex *sqlite3MallocMutex(void){ +SQLITE_PRIVATE tdsqlite3_mutex *tdsqlite3MallocMutex(void){ return mem0.mutex; } @@ -32311,10 +32311,10 @@ SQLITE_PRIVATE sqlite3_mutex *sqlite3MallocMutex(void){ ** that was invoked when memory usage grew too large. Now it is a ** no-op. */ -SQLITE_API int sqlite3_memory_alarm( - void(*xCallback)(void *pArg, sqlite3_int64 used,int N), +SQLITE_API int tdsqlite3_memory_alarm( + void(*xCallback)(void *pArg, tdsqlite3_int64 used,int N), void *pArg, - sqlite3_int64 iThreshold + tdsqlite3_int64 iThreshold ){ (void)xCallback; (void)pArg; @@ -32334,34 +32334,34 @@ SQLITE_API int sqlite3_memory_alarm( ** If the hard heap limit is enabled, then the soft heap limit cannot ** be disabled nor raised above the hard heap limit. */ -SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 n){ - sqlite3_int64 priorLimit; - sqlite3_int64 excess; - sqlite3_int64 nUsed; +SQLITE_API tdsqlite3_int64 tdsqlite3_soft_heap_limit64(tdsqlite3_int64 n){ + tdsqlite3_int64 priorLimit; + tdsqlite3_int64 excess; + tdsqlite3_int64 nUsed; #ifndef SQLITE_OMIT_AUTOINIT - int rc = sqlite3_initialize(); + int rc = tdsqlite3_initialize(); if( rc ) return -1; #endif - sqlite3_mutex_enter(mem0.mutex); + tdsqlite3_mutex_enter(mem0.mutex); priorLimit = mem0.alarmThreshold; if( n<0 ){ - sqlite3_mutex_leave(mem0.mutex); + tdsqlite3_mutex_leave(mem0.mutex); return priorLimit; } if( mem0.hardLimit>0 && (n>mem0.hardLimit || n==0) ){ n = mem0.hardLimit; } mem0.alarmThreshold = n; - nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); + nUsed = tdsqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); mem0.nearlyFull = (n>0 && n<=nUsed); - sqlite3_mutex_leave(mem0.mutex); - excess = sqlite3_memory_used() - n; - if( excess>0 ) sqlite3_release_memory((int)(excess & 0x7fffffff)); + tdsqlite3_mutex_leave(mem0.mutex); + excess = tdsqlite3_memory_used() - n; + if( excess>0 ) tdsqlite3_release_memory((int)(excess & 0x7fffffff)); return priorLimit; } -SQLITE_API void sqlite3_soft_heap_limit(int n){ +SQLITE_API void tdsqlite3_soft_heap_limit(int n){ if( n<0 ) n = 0; - sqlite3_soft_heap_limit64(n); + tdsqlite3_soft_heap_limit64(n); } /* @@ -32376,13 +32376,13 @@ SQLITE_API void sqlite3_soft_heap_limit(int n){ ** and constrain the soft heap limit to be no more than the hard heap ** limit. */ -SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 n){ - sqlite3_int64 priorLimit; +SQLITE_API tdsqlite3_int64 tdsqlite3_hard_heap_limit64(tdsqlite3_int64 n){ + tdsqlite3_int64 priorLimit; #ifndef SQLITE_OMIT_AUTOINIT - int rc = sqlite3_initialize(); + int rc = tdsqlite3_initialize(); if( rc ) return -1; #endif - sqlite3_mutex_enter(mem0.mutex); + tdsqlite3_mutex_enter(mem0.mutex); priorLimit = mem0.hardLimit; if( n>=0 ){ mem0.hardLimit = n; @@ -32390,7 +32390,7 @@ SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 n){ mem0.alarmThreshold = n; } } - sqlite3_mutex_leave(mem0.mutex); + tdsqlite3_mutex_leave(mem0.mutex); return priorLimit; } @@ -32398,19 +32398,19 @@ SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 n){ /* ** Initialize the memory allocation subsystem. */ -SQLITE_PRIVATE int sqlite3MallocInit(void){ +SQLITE_PRIVATE int tdsqlite3MallocInit(void){ int rc; - if( sqlite3GlobalConfig.m.xMalloc==0 ){ - sqlite3MemSetDefault(); + if( tdsqlite3GlobalConfig.m.xMalloc==0 ){ + tdsqlite3MemSetDefault(); } memset(&mem0, 0, sizeof(mem0)); - mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); - if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512 - || sqlite3GlobalConfig.nPage<=0 ){ - sqlite3GlobalConfig.pPage = 0; - sqlite3GlobalConfig.szPage = 0; + mem0.mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); + if( tdsqlite3GlobalConfig.pPage==0 || tdsqlite3GlobalConfig.szPage<512 + || tdsqlite3GlobalConfig.nPage<=0 ){ + tdsqlite3GlobalConfig.pPage = 0; + tdsqlite3GlobalConfig.szPage = 0; } - rc = sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData); + rc = tdsqlite3GlobalConfig.m.xInit(tdsqlite3GlobalConfig.m.pAppData); if( rc!=SQLITE_OK ) memset(&mem0, 0, sizeof(mem0)); /* BEGIN SQLCIPHER */ #ifdef SQLITE_HAS_CODEC @@ -32429,18 +32429,18 @@ SQLITE_PRIVATE int sqlite3MallocInit(void){ /* ** Return true if the heap is currently under memory pressure - in other ** words if the amount of heap used is close to the limit set by -** sqlite3_soft_heap_limit(). +** tdsqlite3_soft_heap_limit(). */ -SQLITE_PRIVATE int sqlite3HeapNearlyFull(void){ +SQLITE_PRIVATE int tdsqlite3HeapNearlyFull(void){ return mem0.nearlyFull; } /* ** Deinitialize the memory allocation subsystem. */ -SQLITE_PRIVATE void sqlite3MallocEnd(void){ - if( sqlite3GlobalConfig.m.xShutdown ){ - sqlite3GlobalConfig.m.xShutdown(sqlite3GlobalConfig.m.pAppData); +SQLITE_PRIVATE void tdsqlite3MallocEnd(void){ + if( tdsqlite3GlobalConfig.m.xShutdown ){ + tdsqlite3GlobalConfig.m.xShutdown(tdsqlite3GlobalConfig.m.pAppData); } memset(&mem0, 0, sizeof(mem0)); } @@ -32448,9 +32448,9 @@ SQLITE_PRIVATE void sqlite3MallocEnd(void){ /* ** Return the amount of memory currently checked out. */ -SQLITE_API sqlite3_int64 sqlite3_memory_used(void){ - sqlite3_int64 res, mx; - sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, 0); +SQLITE_API tdsqlite3_int64 tdsqlite3_memory_used(void){ + tdsqlite3_int64 res, mx; + tdsqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, 0); return res; } @@ -32459,20 +32459,20 @@ SQLITE_API sqlite3_int64 sqlite3_memory_used(void){ ** checked out since either the beginning of this process ** or since the most recent reset. */ -SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag){ - sqlite3_int64 res, mx; - sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, resetFlag); +SQLITE_API tdsqlite3_int64 tdsqlite3_memory_highwater(int resetFlag){ + tdsqlite3_int64 res, mx; + tdsqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, resetFlag); return mx; } /* ** Trigger the alarm */ -static void sqlite3MallocAlarm(int nByte){ +static void tdsqlite3MallocAlarm(int nByte){ if( mem0.alarmThreshold<=0 ) return; - sqlite3_mutex_leave(mem0.mutex); - sqlite3_release_memory(nByte); - sqlite3_mutex_enter(mem0.mutex); + tdsqlite3_mutex_leave(mem0.mutex); + tdsqlite3_release_memory(nByte); + tdsqlite3_mutex_enter(mem0.mutex); } /* @@ -32482,7 +32482,7 @@ static void sqlite3MallocAlarm(int nByte){ static void mallocWithAlarm(int n, void **pp){ void *p; int nFull; - assert( sqlite3_mutex_held(mem0.mutex) ); + assert( tdsqlite3_mutex_held(mem0.mutex) ); assert( n>0 ); /* In Firefox (circa 2017-02-08), xRoundup() is remapped to an internal @@ -32490,16 +32490,16 @@ static void mallocWithAlarm(int n, void **pp){ ** mode and specifically when the DMD "Dark Matter Detector" is enabled ** or else a crash results. Hence, do not attempt to optimize out the ** following xRoundup() call. */ - nFull = sqlite3GlobalConfig.m.xRoundup(n); + nFull = tdsqlite3GlobalConfig.m.xRoundup(n); - sqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, n); + tdsqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, n); if( mem0.alarmThreshold>0 ){ - sqlite3_int64 nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); + tdsqlite3_int64 nUsed = tdsqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); if( nUsed >= mem0.alarmThreshold - nFull ){ mem0.nearlyFull = 1; - sqlite3MallocAlarm(nFull); + tdsqlite3MallocAlarm(nFull); if( mem0.hardLimit ){ - nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); + nUsed = tdsqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); if( nUsed >= mem0.hardLimit - nFull ){ *pp = 0; return; @@ -32509,40 +32509,40 @@ static void mallocWithAlarm(int n, void **pp){ mem0.nearlyFull = 0; } } - p = sqlite3GlobalConfig.m.xMalloc(nFull); + p = tdsqlite3GlobalConfig.m.xMalloc(nFull); #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT if( p==0 && mem0.alarmThreshold>0 ){ - sqlite3MallocAlarm(nFull); - p = sqlite3GlobalConfig.m.xMalloc(nFull); + tdsqlite3MallocAlarm(nFull); + p = tdsqlite3GlobalConfig.m.xMalloc(nFull); } #endif if( p ){ - nFull = sqlite3MallocSize(p); - sqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nFull); - sqlite3StatusUp(SQLITE_STATUS_MALLOC_COUNT, 1); + nFull = tdsqlite3MallocSize(p); + tdsqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nFull); + tdsqlite3StatusUp(SQLITE_STATUS_MALLOC_COUNT, 1); } *pp = p; } /* -** Allocate memory. This routine is like sqlite3_malloc() except that it +** Allocate memory. This routine is like tdsqlite3_malloc() except that it ** assumes the memory subsystem has already been initialized. */ -SQLITE_PRIVATE void *sqlite3Malloc(u64 n){ +SQLITE_PRIVATE void *tdsqlite3Malloc(u64 n){ void *p; if( n==0 || n>=0x7fffff00 ){ /* A memory allocation of a number of bytes which is near the maximum ** signed integer value might cause an integer overflow inside of the ** xMalloc(). Hence we limit the maximum size to 0x7fffff00, giving ** 255 bytes of overhead. SQLite itself will never use anything near - ** this amount. The only way to reach the limit is with sqlite3_malloc() */ + ** this amount. The only way to reach the limit is with tdsqlite3_malloc() */ p = 0; - }else if( sqlite3GlobalConfig.bMemstat ){ - sqlite3_mutex_enter(mem0.mutex); + }else if( tdsqlite3GlobalConfig.bMemstat ){ + tdsqlite3_mutex_enter(mem0.mutex); mallocWithAlarm((int)n, &p); - sqlite3_mutex_leave(mem0.mutex); + tdsqlite3_mutex_leave(mem0.mutex); }else{ - p = sqlite3GlobalConfig.m.xMalloc((int)n); + p = tdsqlite3GlobalConfig.m.xMalloc((int)n); } assert( EIGHT_BYTE_ALIGNMENT(p) ); /* IMP: R-11148-40995 */ return p; @@ -32553,24 +32553,24 @@ SQLITE_PRIVATE void *sqlite3Malloc(u64 n){ ** First make sure the memory subsystem is initialized, then do the ** allocation. */ -SQLITE_API void *sqlite3_malloc(int n){ +SQLITE_API void *tdsqlite3_malloc(int n){ #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; + if( tdsqlite3_initialize() ) return 0; #endif - return n<=0 ? 0 : sqlite3Malloc(n); + return n<=0 ? 0 : tdsqlite3Malloc(n); } -SQLITE_API void *sqlite3_malloc64(sqlite3_uint64 n){ +SQLITE_API void *tdsqlite3_malloc64(tdsqlite3_uint64 n){ #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; + if( tdsqlite3_initialize() ) return 0; #endif - return sqlite3Malloc(n); + return tdsqlite3Malloc(n); } /* ** TRUE if p is a lookaside memory allocation from db */ #ifndef SQLITE_OMIT_LOOKASIDE -static int isLookaside(sqlite3 *db, void *p){ +static int isLookaside(tdsqlite3 *db, void *p){ return SQLITE_WITHIN(p, db->lookaside.pStart, db->lookaside.pEnd); } #else @@ -32579,29 +32579,29 @@ static int isLookaside(sqlite3 *db, void *p){ /* ** Return the size of a memory allocation previously obtained from -** sqlite3Malloc() or sqlite3_malloc(). +** tdsqlite3Malloc() or tdsqlite3_malloc(). */ -SQLITE_PRIVATE int sqlite3MallocSize(void *p){ - assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); - return sqlite3GlobalConfig.m.xSize(p); +SQLITE_PRIVATE int tdsqlite3MallocSize(void *p){ + assert( tdsqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); + return tdsqlite3GlobalConfig.m.xSize(p); } -static int lookasideMallocSize(sqlite3 *db, void *p){ +static int lookasideMallocSize(tdsqlite3 *db, void *p){ #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE return plookaside.pMiddle ? db->lookaside.szTrue : LOOKASIDE_SMALL; #else return db->lookaside.szTrue; #endif } -SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){ +SQLITE_PRIVATE int tdsqlite3DbMallocSize(tdsqlite3 *db, void *p){ assert( p!=0 ); #ifdef SQLITE_DEBUG if( db==0 || !isLookaside(db,p) ){ if( db==0 ){ - assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) ); - assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); + assert( tdsqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) ); + assert( tdsqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); }else{ - assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); - assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); + assert( tdsqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); + assert( tdsqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); } } #endif @@ -32609,39 +32609,39 @@ SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){ if( ((uptr)p)<(uptr)(db->lookaside.pEnd) ){ #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE if( ((uptr)p)>=(uptr)(db->lookaside.pMiddle) ){ - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); return LOOKASIDE_SMALL; } #endif if( ((uptr)p)>=(uptr)(db->lookaside.pStart) ){ - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); return db->lookaside.szTrue; } } } - return sqlite3GlobalConfig.m.xSize(p); + return tdsqlite3GlobalConfig.m.xSize(p); } -SQLITE_API sqlite3_uint64 sqlite3_msize(void *p){ - assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) ); - assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); - return p ? sqlite3GlobalConfig.m.xSize(p) : 0; +SQLITE_API tdsqlite3_uint64 tdsqlite3_msize(void *p){ + assert( tdsqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) ); + assert( tdsqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); + return p ? tdsqlite3GlobalConfig.m.xSize(p) : 0; } /* -** Free memory previously obtained from sqlite3Malloc(). +** Free memory previously obtained from tdsqlite3Malloc(). */ -SQLITE_API void sqlite3_free(void *p){ +SQLITE_API void tdsqlite3_free(void *p){ if( p==0 ) return; /* IMP: R-49053-54554 */ - assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); - assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) ); - if( sqlite3GlobalConfig.bMemstat ){ - sqlite3_mutex_enter(mem0.mutex); - sqlite3StatusDown(SQLITE_STATUS_MEMORY_USED, sqlite3MallocSize(p)); - sqlite3StatusDown(SQLITE_STATUS_MALLOC_COUNT, 1); - sqlite3GlobalConfig.m.xFree(p); - sqlite3_mutex_leave(mem0.mutex); + assert( tdsqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); + assert( tdsqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) ); + if( tdsqlite3GlobalConfig.bMemstat ){ + tdsqlite3_mutex_enter(mem0.mutex); + tdsqlite3StatusDown(SQLITE_STATUS_MEMORY_USED, tdsqlite3MallocSize(p)); + tdsqlite3StatusDown(SQLITE_STATUS_MALLOC_COUNT, 1); + tdsqlite3GlobalConfig.m.xFree(p); + tdsqlite3_mutex_leave(mem0.mutex); }else{ - sqlite3GlobalConfig.m.xFree(p); + tdsqlite3GlobalConfig.m.xFree(p); } } @@ -32649,17 +32649,17 @@ SQLITE_API void sqlite3_free(void *p){ ** Add the size of memory allocation "p" to the count in ** *db->pnBytesFreed. */ -static SQLITE_NOINLINE void measureAllocationSize(sqlite3 *db, void *p){ - *db->pnBytesFreed += sqlite3DbMallocSize(db,p); +static SQLITE_NOINLINE void measureAllocationSize(tdsqlite3 *db, void *p){ + *db->pnBytesFreed += tdsqlite3DbMallocSize(db,p); } /* ** Free memory that might be associated with a particular database -** connection. Calling sqlite3DbFree(D,X) for X==0 is a harmless no-op. -** The sqlite3DbFreeNN(D,X) version requires that X be non-NULL. +** connection. Calling tdsqlite3DbFree(D,X) for X==0 is a harmless no-op. +** The tdsqlite3DbFreeNN(D,X) version requires that X be non-NULL. */ -SQLITE_PRIVATE void sqlite3DbFreeNN(sqlite3 *db, void *p){ - assert( db==0 || sqlite3_mutex_held(db->mutex) ); +SQLITE_PRIVATE void tdsqlite3DbFreeNN(tdsqlite3 *db, void *p){ + assert( db==0 || tdsqlite3_mutex_held(db->mutex) ); assert( p!=0 ); if( db ){ if( db->pnBytesFreed ){ @@ -32689,92 +32689,92 @@ SQLITE_PRIVATE void sqlite3DbFreeNN(sqlite3 *db, void *p){ } } } - assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); - assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); - assert( db!=0 || sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) ); - sqlite3MemdebugSetType(p, MEMTYPE_HEAP); - sqlite3_free(p); + assert( tdsqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); + assert( tdsqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); + assert( db!=0 || tdsqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) ); + tdsqlite3MemdebugSetType(p, MEMTYPE_HEAP); + tdsqlite3_free(p); } -SQLITE_PRIVATE void sqlite3DbFree(sqlite3 *db, void *p){ - assert( db==0 || sqlite3_mutex_held(db->mutex) ); - if( p ) sqlite3DbFreeNN(db, p); +SQLITE_PRIVATE void tdsqlite3DbFree(tdsqlite3 *db, void *p){ + assert( db==0 || tdsqlite3_mutex_held(db->mutex) ); + if( p ) tdsqlite3DbFreeNN(db, p); } /* ** Change the size of an existing memory allocation */ -SQLITE_PRIVATE void *sqlite3Realloc(void *pOld, u64 nBytes){ +SQLITE_PRIVATE void *tdsqlite3Realloc(void *pOld, u64 nBytes){ int nOld, nNew, nDiff; void *pNew; - assert( sqlite3MemdebugHasType(pOld, MEMTYPE_HEAP) ); - assert( sqlite3MemdebugNoType(pOld, (u8)~MEMTYPE_HEAP) ); + assert( tdsqlite3MemdebugHasType(pOld, MEMTYPE_HEAP) ); + assert( tdsqlite3MemdebugNoType(pOld, (u8)~MEMTYPE_HEAP) ); if( pOld==0 ){ - return sqlite3Malloc(nBytes); /* IMP: R-04300-56712 */ + return tdsqlite3Malloc(nBytes); /* IMP: R-04300-56712 */ } if( nBytes==0 ){ - sqlite3_free(pOld); /* IMP: R-26507-47431 */ + tdsqlite3_free(pOld); /* IMP: R-26507-47431 */ return 0; } if( nBytes>=0x7fffff00 ){ - /* The 0x7ffff00 limit term is explained in comments on sqlite3Malloc() */ + /* The 0x7ffff00 limit term is explained in comments on tdsqlite3Malloc() */ return 0; } - nOld = sqlite3MallocSize(pOld); + nOld = tdsqlite3MallocSize(pOld); /* IMPLEMENTATION-OF: R-46199-30249 SQLite guarantees that the second ** argument to xRealloc is always a value returned by a prior call to ** xRoundup. */ - nNew = sqlite3GlobalConfig.m.xRoundup((int)nBytes); + nNew = tdsqlite3GlobalConfig.m.xRoundup((int)nBytes); if( nOld==nNew ){ pNew = pOld; - }else if( sqlite3GlobalConfig.bMemstat ){ - sqlite3_mutex_enter(mem0.mutex); - sqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, (int)nBytes); + }else if( tdsqlite3GlobalConfig.bMemstat ){ + tdsqlite3_mutex_enter(mem0.mutex); + tdsqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, (int)nBytes); nDiff = nNew - nOld; - if( nDiff>0 && sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED) >= + if( nDiff>0 && tdsqlite3StatusValue(SQLITE_STATUS_MEMORY_USED) >= mem0.alarmThreshold-nDiff ){ - sqlite3MallocAlarm(nDiff); + tdsqlite3MallocAlarm(nDiff); } - pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew); + pNew = tdsqlite3GlobalConfig.m.xRealloc(pOld, nNew); if( pNew==0 && mem0.alarmThreshold>0 ){ - sqlite3MallocAlarm((int)nBytes); - pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew); + tdsqlite3MallocAlarm((int)nBytes); + pNew = tdsqlite3GlobalConfig.m.xRealloc(pOld, nNew); } if( pNew ){ - nNew = sqlite3MallocSize(pNew); - sqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nNew-nOld); + nNew = tdsqlite3MallocSize(pNew); + tdsqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nNew-nOld); } - sqlite3_mutex_leave(mem0.mutex); + tdsqlite3_mutex_leave(mem0.mutex); }else{ - pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew); + pNew = tdsqlite3GlobalConfig.m.xRealloc(pOld, nNew); } assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-11148-40995 */ return pNew; } /* -** The public interface to sqlite3Realloc. Make sure that the memory +** The public interface to tdsqlite3Realloc. Make sure that the memory ** subsystem is initialized prior to invoking sqliteRealloc. */ -SQLITE_API void *sqlite3_realloc(void *pOld, int n){ +SQLITE_API void *tdsqlite3_realloc(void *pOld, int n){ #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; + if( tdsqlite3_initialize() ) return 0; #endif if( n<0 ) n = 0; /* IMP: R-26507-47431 */ - return sqlite3Realloc(pOld, n); + return tdsqlite3Realloc(pOld, n); } -SQLITE_API void *sqlite3_realloc64(void *pOld, sqlite3_uint64 n){ +SQLITE_API void *tdsqlite3_realloc64(void *pOld, tdsqlite3_uint64 n){ #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; + if( tdsqlite3_initialize() ) return 0; #endif - return sqlite3Realloc(pOld, n); + return tdsqlite3Realloc(pOld, n); } /* ** Allocate and zero memory. */ -SQLITE_PRIVATE void *sqlite3MallocZero(u64 n){ - void *p = sqlite3Malloc(n); +SQLITE_PRIVATE void *tdsqlite3MallocZero(u64 n){ + void *p = tdsqlite3Malloc(n); if( p ){ memset(p, 0, (size_t)n); } @@ -32785,24 +32785,24 @@ SQLITE_PRIVATE void *sqlite3MallocZero(u64 n){ ** Allocate and zero memory. If the allocation fails, make ** the mallocFailed flag in the connection pointer. */ -SQLITE_PRIVATE void *sqlite3DbMallocZero(sqlite3 *db, u64 n){ +SQLITE_PRIVATE void *tdsqlite3DbMallocZero(tdsqlite3 *db, u64 n){ void *p; testcase( db==0 ); - p = sqlite3DbMallocRaw(db, n); + p = tdsqlite3DbMallocRaw(db, n); if( p ) memset(p, 0, (size_t)n); return p; } -/* Finish the work of sqlite3DbMallocRawNN for the unusual and +/* Finish the work of tdsqlite3DbMallocRawNN for the unusual and ** slower case when the allocation cannot be fulfilled using lookaside. */ -static SQLITE_NOINLINE void *dbMallocRawFinish(sqlite3 *db, u64 n){ +static SQLITE_NOINLINE void *dbMallocRawFinish(tdsqlite3 *db, u64 n){ void *p; assert( db!=0 ); - p = sqlite3Malloc(n); - if( !p ) sqlite3OomFault(db); - sqlite3MemdebugSetType(p, + p = tdsqlite3Malloc(n); + if( !p ) tdsqlite3OomFault(db); + tdsqlite3MemdebugSetType(p, (db->lookaside.bDisable==0) ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP); return p; } @@ -32819,28 +32819,28 @@ static SQLITE_NOINLINE void *dbMallocRawFinish(sqlite3 *db, u64 n){ ** This is an important assumption. There are many places in the ** code that do things like this: ** -** int *a = (int*)sqlite3DbMallocRaw(db, 100); -** int *b = (int*)sqlite3DbMallocRaw(db, 200); +** int *a = (int*)tdsqlite3DbMallocRaw(db, 100); +** int *b = (int*)tdsqlite3DbMallocRaw(db, 200); ** if( b ) a[10] = 9; ** ** In other words, if a subsequent malloc (ex: "b") worked, it is assumed ** that all prior mallocs (ex: "a") worked too. ** -** The sqlite3MallocRawNN() variant guarantees that the "db" parameter is +** The tdsqlite3MallocRawNN() variant guarantees that the "db" parameter is ** not a NULL pointer. */ -SQLITE_PRIVATE void *sqlite3DbMallocRaw(sqlite3 *db, u64 n){ +SQLITE_PRIVATE void *tdsqlite3DbMallocRaw(tdsqlite3 *db, u64 n){ void *p; - if( db ) return sqlite3DbMallocRawNN(db, n); - p = sqlite3Malloc(n); - sqlite3MemdebugSetType(p, MEMTYPE_HEAP); + if( db ) return tdsqlite3DbMallocRawNN(db, n); + p = tdsqlite3Malloc(n); + tdsqlite3MemdebugSetType(p, MEMTYPE_HEAP); return p; } -SQLITE_PRIVATE void *sqlite3DbMallocRawNN(sqlite3 *db, u64 n){ +SQLITE_PRIVATE void *tdsqlite3DbMallocRawNN(tdsqlite3 *db, u64 n){ #ifndef SQLITE_OMIT_LOOKASIDE LookasideSlot *pBuf; assert( db!=0 ); - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); assert( db->pnBytesFreed==0 ); if( n>db->lookaside.sz ){ if( !db->lookaside.bDisable ){ @@ -32876,7 +32876,7 @@ SQLITE_PRIVATE void *sqlite3DbMallocRawNN(sqlite3 *db, u64 n){ } #else assert( db!=0 ); - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); assert( db->pnBytesFreed==0 ); if( db->mallocFailed ){ return 0; @@ -32886,16 +32886,16 @@ SQLITE_PRIVATE void *sqlite3DbMallocRawNN(sqlite3 *db, u64 n){ } /* Forward declaration */ -static SQLITE_NOINLINE void *dbReallocFinish(sqlite3 *db, void *p, u64 n); +static SQLITE_NOINLINE void *dbReallocFinish(tdsqlite3 *db, void *p, u64 n); /* ** Resize the block of memory pointed to by p to n bytes. If the ** resize fails, set the mallocFailed flag in the connection object. */ -SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *db, void *p, u64 n){ +SQLITE_PRIVATE void *tdsqlite3DbRealloc(tdsqlite3 *db, void *p, u64 n){ assert( db!=0 ); - if( p==0 ) return sqlite3DbMallocRawNN(db, n); - assert( sqlite3_mutex_held(db->mutex) ); + if( p==0 ) return tdsqlite3DbMallocRawNN(db, n); + assert( tdsqlite3_mutex_held(db->mutex) ); if( ((uptr)p)<(uptr)db->lookaside.pEnd ){ #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE if( ((uptr)p)>=(uptr)db->lookaside.pMiddle ){ @@ -32908,26 +32908,26 @@ SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *db, void *p, u64 n){ } return dbReallocFinish(db, p, n); } -static SQLITE_NOINLINE void *dbReallocFinish(sqlite3 *db, void *p, u64 n){ +static SQLITE_NOINLINE void *dbReallocFinish(tdsqlite3 *db, void *p, u64 n){ void *pNew = 0; assert( db!=0 ); assert( p!=0 ); if( db->mallocFailed==0 ){ if( isLookaside(db, p) ){ - pNew = sqlite3DbMallocRawNN(db, n); + pNew = tdsqlite3DbMallocRawNN(db, n); if( pNew ){ memcpy(pNew, p, lookasideMallocSize(db, p)); - sqlite3DbFree(db, p); + tdsqlite3DbFree(db, p); } }else{ - assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); - assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); - sqlite3MemdebugSetType(p, MEMTYPE_HEAP); - pNew = sqlite3_realloc64(p, n); + assert( tdsqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); + assert( tdsqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); + tdsqlite3MemdebugSetType(p, MEMTYPE_HEAP); + pNew = tdsqlite3_realloc64(p, n); if( !pNew ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); } - sqlite3MemdebugSetType(pNew, + tdsqlite3MemdebugSetType(pNew, (db->lookaside.bDisable==0 ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP)); } } @@ -32938,43 +32938,43 @@ static SQLITE_NOINLINE void *dbReallocFinish(sqlite3 *db, void *p, u64 n){ ** Attempt to reallocate p. If the reallocation fails, then free p ** and set the mallocFailed flag in the database connection. */ -SQLITE_PRIVATE void *sqlite3DbReallocOrFree(sqlite3 *db, void *p, u64 n){ +SQLITE_PRIVATE void *tdsqlite3DbReallocOrFree(tdsqlite3 *db, void *p, u64 n){ void *pNew; - pNew = sqlite3DbRealloc(db, p, n); + pNew = tdsqlite3DbRealloc(db, p, n); if( !pNew ){ - sqlite3DbFree(db, p); + tdsqlite3DbFree(db, p); } return pNew; } /* ** Make a copy of a string in memory obtained from sqliteMalloc(). These -** functions call sqlite3MallocRaw() directly instead of sqliteMalloc(). This +** functions call tdsqlite3MallocRaw() directly instead of sqliteMalloc(). This ** is because when memory debugging is turned on, these two functions are ** called via macros that record the current file and line number in the ** ThreadData structure. */ -SQLITE_PRIVATE char *sqlite3DbStrDup(sqlite3 *db, const char *z){ +SQLITE_PRIVATE char *tdsqlite3DbStrDup(tdsqlite3 *db, const char *z){ char *zNew; size_t n; if( z==0 ){ return 0; } n = strlen(z) + 1; - zNew = sqlite3DbMallocRaw(db, n); + zNew = tdsqlite3DbMallocRaw(db, n); if( zNew ){ memcpy(zNew, z, n); } return zNew; } -SQLITE_PRIVATE char *sqlite3DbStrNDup(sqlite3 *db, const char *z, u64 n){ +SQLITE_PRIVATE char *tdsqlite3DbStrNDup(tdsqlite3 *db, const char *z, u64 n){ char *zNew; assert( db!=0 ); if( z==0 ){ return 0; } assert( (n&0x7fffffff)==n ); - zNew = sqlite3DbMallocRawNN(db, n+1); + zNew = tdsqlite3DbMallocRawNN(db, n+1); if( zNew ){ memcpy(zNew, z, (size_t)n); zNew[n] = 0; @@ -32985,22 +32985,22 @@ SQLITE_PRIVATE char *sqlite3DbStrNDup(sqlite3 *db, const char *z, u64 n){ /* ** The text between zStart and zEnd represents a phrase within a larger ** SQL statement. Make a copy of this phrase in space obtained form -** sqlite3DbMalloc(). Omit leading and trailing whitespace. +** tdsqlite3DbMalloc(). Omit leading and trailing whitespace. */ -SQLITE_PRIVATE char *sqlite3DbSpanDup(sqlite3 *db, const char *zStart, const char *zEnd){ +SQLITE_PRIVATE char *tdsqlite3DbSpanDup(tdsqlite3 *db, const char *zStart, const char *zEnd){ int n; - while( sqlite3Isspace(zStart[0]) ) zStart++; + while( tdsqlite3Isspace(zStart[0]) ) zStart++; n = (int)(zEnd - zStart); - while( ALWAYS(n>0) && sqlite3Isspace(zStart[n-1]) ) n--; - return sqlite3DbStrNDup(db, zStart, n); + while( ALWAYS(n>0) && tdsqlite3Isspace(zStart[n-1]) ) n--; + return tdsqlite3DbStrNDup(db, zStart, n); } /* ** Free any prior content in *pz and replace it with a copy of zNew. */ -SQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char *zNew){ - sqlite3DbFree(db, *pz); - *pz = sqlite3DbStrDup(db, zNew); +SQLITE_PRIVATE void tdsqlite3SetString(char **pz, tdsqlite3 *db, const char *zNew){ + tdsqlite3DbFree(db, *pz); + *pz = tdsqlite3DbStrDup(db, zNew); } /* @@ -33009,7 +33009,7 @@ SQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char *zNew){ ** temporarily disable the lookaside memory allocator and interrupt ** any running VDBEs. */ -SQLITE_PRIVATE void sqlite3OomFault(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3OomFault(tdsqlite3 *db){ if( db->mallocFailed==0 && db->bBenignMalloc==0 ){ db->mallocFailed = 1; if( db->nVdbeExec>0 ){ @@ -33029,7 +33029,7 @@ SQLITE_PRIVATE void sqlite3OomFault(sqlite3 *db){ ** The memory allocator is not restarted if there are running ** VDBEs. */ -SQLITE_PRIVATE void sqlite3OomClear(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3OomClear(tdsqlite3 *db){ if( db->mallocFailed && db->nVdbeExec==0 ){ db->mallocFailed = 0; db->u1.isInterrupted = 0; @@ -33041,31 +33041,31 @@ SQLITE_PRIVATE void sqlite3OomClear(sqlite3 *db){ /* ** Take actions at the end of an API call to indicate an OOM error */ -static SQLITE_NOINLINE int apiOomError(sqlite3 *db){ - sqlite3OomClear(db); - sqlite3Error(db, SQLITE_NOMEM); +static SQLITE_NOINLINE int apiOomError(tdsqlite3 *db){ + tdsqlite3OomClear(db); + tdsqlite3Error(db, SQLITE_NOMEM); return SQLITE_NOMEM_BKPT; } /* ** This function must be called before exiting any API function (i.e. -** returning control to the user) that has called sqlite3_malloc or -** sqlite3_realloc. +** returning control to the user) that has called tdsqlite3_malloc or +** tdsqlite3_realloc. ** ** The returned value is normally a copy of the second argument to this ** function. However, if a malloc() failure has occurred since the previous ** invocation SQLITE_NOMEM is returned instead. ** ** If an OOM as occurred, then the connection error-code (the value -** returned by sqlite3_errcode()) is set to SQLITE_NOMEM. +** returned by tdsqlite3_errcode()) is set to SQLITE_NOMEM. */ -SQLITE_PRIVATE int sqlite3ApiExit(sqlite3* db, int rc){ +SQLITE_PRIVATE int tdsqlite3ApiExit(tdsqlite3* db, int rc){ /* If the db handle must hold the connection handle mutex here. ** Otherwise the read (and possible write) of db->mallocFailed - ** is unsafe, as is the call to sqlite3Error(). + ** is unsafe, as is the call to tdsqlite3Error(). */ assert( db!=0 ); - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); if( db->mallocFailed || rc==SQLITE_IOERR_NOMEM ){ return apiOomError(db); } @@ -33218,24 +33218,24 @@ static char et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){ static void setStrAccumError(StrAccum *p, u8 eError){ assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG ); p->accError = eError; - if( p->mxAlloc ) sqlite3_str_reset(p); - if( eError==SQLITE_TOOBIG ) sqlite3ErrorToParser(p->db, eError); + if( p->mxAlloc ) tdsqlite3_str_reset(p); + if( eError==SQLITE_TOOBIG ) tdsqlite3ErrorToParser(p->db, eError); } /* ** Extra argument values from a PrintfArguments object */ -static sqlite3_int64 getIntArg(PrintfArguments *p){ +static tdsqlite3_int64 getIntArg(PrintfArguments *p){ if( p->nArg<=p->nUsed ) return 0; - return sqlite3_value_int64(p->apArg[p->nUsed++]); + return tdsqlite3_value_int64(p->apArg[p->nUsed++]); } static double getDoubleArg(PrintfArguments *p){ if( p->nArg<=p->nUsed ) return 0.0; - return sqlite3_value_double(p->apArg[p->nUsed++]); + return tdsqlite3_value_double(p->apArg[p->nUsed++]); } static char *getTextArg(PrintfArguments *p){ if( p->nArg<=p->nUsed ) return 0; - return (char*)sqlite3_value_text(p->apArg[p->nUsed++]); + return (char*)tdsqlite3_value_text(p->apArg[p->nUsed++]); } /* @@ -33247,14 +33247,14 @@ static char *getTextArg(PrintfArguments *p){ ** SQL from requesting large allocations using the precision or width ** field of the printf() function. */ -static char *printfTempBuf(sqlite3_str *pAccum, sqlite3_int64 n){ +static char *printfTempBuf(tdsqlite3_str *pAccum, tdsqlite3_int64 n){ char *z; if( pAccum->accError ) return 0; if( n>pAccum->nAlloc && n>pAccum->mxAlloc ){ setStrAccumError(pAccum, SQLITE_TOOBIG); return 0; } - z = sqlite3DbMallocRaw(pAccum->db, n); + z = tdsqlite3DbMallocRaw(pAccum->db, n); if( z==0 ){ setStrAccumError(pAccum, SQLITE_NOMEM); } @@ -33273,8 +33273,8 @@ static char *printfTempBuf(sqlite3_str *pAccum, sqlite3_int64 n){ /* ** Render a string given by "fmt" into the StrAccum object. */ -SQLITE_API void sqlite3_str_vappendf( - sqlite3_str *pAccum, /* Accumulate results here */ +SQLITE_API void tdsqlite3_str_vappendf( + tdsqlite3_str *pAccum, /* Accumulate results here */ const char *fmt, /* Format string */ va_list ap /* arguments */ ){ @@ -33331,11 +33331,11 @@ SQLITE_API void sqlite3_str_vappendf( #else do{ fmt++; }while( *fmt && *fmt != '%' ); #endif - sqlite3_str_append(pAccum, bufpt, (int)(fmt - bufpt)); + tdsqlite3_str_append(pAccum, bufpt, (int)(fmt - bufpt)); if( *fmt==0 ) break; } if( (c=(*++fmt))==0 ){ - sqlite3_str_append(pAccum, "%", 1); + tdsqlite3_str_append(pAccum, "%", 1); break; } /* Find out what flags are present */ @@ -33604,7 +33604,7 @@ SQLITE_API void sqlite3_str_vappendf( while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; } if( xtype==etFLOAT ){ double rx = (double)realvalue; - sqlite3_uint64 u; + tdsqlite3_uint64 u; int ex; memcpy(&u, &rx, sizeof(u)); ex = -1023 + (int)((u>>52)&0x7ff); @@ -33613,7 +33613,7 @@ SQLITE_API void sqlite3_str_vappendf( } /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */ exp = 0; - if( sqlite3IsNaN((double)realvalue) ){ + if( tdsqlite3IsNaN((double)realvalue) ){ bufpt = "NaN"; length = 3; break; @@ -33795,11 +33795,11 @@ SQLITE_API void sqlite3_str_vappendf( if( precision>1 ){ width -= precision-1; if( width>1 && !flag_leftjustify ){ - sqlite3_str_appendchar(pAccum, width-1, ' '); + tdsqlite3_str_appendchar(pAccum, width-1, ' '); width = 0; } while( precision-- > 1 ){ - sqlite3_str_append(pAccum, buf, length); + tdsqlite3_str_append(pAccum, buf, length); } } bufpt = buf; @@ -33822,12 +33822,12 @@ SQLITE_API void sqlite3_str_vappendf( && precision<0 && pAccum->accError==0 ){ - /* Special optimization for sqlite3_mprintf("%z..."): + /* Special optimization for tdsqlite3_mprintf("%z..."): ** Extend an existing memory allocation rather than creating ** a new one. */ assert( (pAccum->printfFlags&SQLITE_PRINTF_MALLOCED)==0 ); pAccum->zText = bufpt; - pAccum->nAlloc = sqlite3DbMallocSize(pAccum->db, bufpt); + pAccum->nAlloc = tdsqlite3DbMallocSize(pAccum->db, bufpt); pAccum->nChar = 0x7fffffff & (int)strlen(bufpt); pAccum->printfFlags |= SQLITE_PRINTF_MALLOCED; length = 0; @@ -33911,7 +33911,7 @@ SQLITE_API void sqlite3_str_vappendf( pToken = va_arg(ap, Token*); assert( bArgList==0 ); if( pToken && pToken->n ){ - sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n); + tdsqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n); } length = width = 0; break; @@ -33927,10 +33927,10 @@ SQLITE_API void sqlite3_str_vappendf( assert( bArgList==0 ); assert( k>=0 && knSrc ); if( pItem->zDatabase ){ - sqlite3_str_appendall(pAccum, pItem->zDatabase); - sqlite3_str_append(pAccum, ".", 1); + tdsqlite3_str_appendall(pAccum, pItem->zDatabase); + tdsqlite3_str_append(pAccum, ".", 1); } - sqlite3_str_appendall(pAccum, pItem->zName); + tdsqlite3_str_appendall(pAccum, pItem->zName); length = width = 0; break; } @@ -33949,15 +33949,15 @@ SQLITE_API void sqlite3_str_vappendf( */ width -= length; if( width>0 ){ - if( !flag_leftjustify ) sqlite3_str_appendchar(pAccum, width, ' '); - sqlite3_str_append(pAccum, bufpt, length); - if( flag_leftjustify ) sqlite3_str_appendchar(pAccum, width, ' '); + if( !flag_leftjustify ) tdsqlite3_str_appendchar(pAccum, width, ' '); + tdsqlite3_str_append(pAccum, bufpt, length); + if( flag_leftjustify ) tdsqlite3_str_appendchar(pAccum, width, ' '); }else{ - sqlite3_str_append(pAccum, bufpt, length); + tdsqlite3_str_append(pAccum, bufpt, length); } if( zExtra ){ - sqlite3DbFree(pAccum->db, zExtra); + tdsqlite3DbFree(pAccum->db, zExtra); zExtra = 0; } }/* End for loop over the format string */ @@ -33970,7 +33970,7 @@ SQLITE_API void sqlite3_str_vappendf( ** Return the number of bytes of text that StrAccum is able to accept ** after the attempted enlargement. The value returned might be zero. */ -static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ +static int tdsqlite3StrAccumEnlarge(StrAccum *p, int N){ char *zNew; assert( p->nChar+(i64)N >= p->nAlloc ); /* Only called if really needed */ if( p->accError ){ @@ -33991,25 +33991,25 @@ static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ szNew += p->nChar; } if( szNew > p->mxAlloc ){ - sqlite3_str_reset(p); + tdsqlite3_str_reset(p); setStrAccumError(p, SQLITE_TOOBIG); return 0; }else{ p->nAlloc = (int)szNew; } if( p->db ){ - zNew = sqlite3DbRealloc(p->db, zOld, p->nAlloc); + zNew = tdsqlite3DbRealloc(p->db, zOld, p->nAlloc); }else{ - zNew = sqlite3_realloc64(zOld, p->nAlloc); + zNew = tdsqlite3_realloc64(zOld, p->nAlloc); } if( zNew ){ assert( p->zText!=0 || p->nChar==0 ); if( !isMalloced(p) && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar); p->zText = zNew; - p->nAlloc = sqlite3DbMallocSize(p->db, zNew); + p->nAlloc = tdsqlite3DbMallocSize(p->db, zNew); p->printfFlags |= SQLITE_PRINTF_MALLOCED; }else{ - sqlite3_str_reset(p); + tdsqlite3_str_reset(p); setStrAccumError(p, SQLITE_NOMEM); return 0; } @@ -34020,9 +34020,9 @@ static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ /* ** Append N copies of character c to the given string buffer. */ -SQLITE_API void sqlite3_str_appendchar(sqlite3_str *p, int N, char c){ +SQLITE_API void tdsqlite3_str_appendchar(tdsqlite3_str *p, int N, char c){ testcase( p->nChar + (i64)N > 0x7fffffff ); - if( p->nChar+(i64)N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ){ + if( p->nChar+(i64)N >= p->nAlloc && (N = tdsqlite3StrAccumEnlarge(p, N))<=0 ){ return; } while( (N--)>0 ) p->zText[p->nChar++] = c; @@ -34032,12 +34032,12 @@ SQLITE_API void sqlite3_str_appendchar(sqlite3_str *p, int N, char c){ ** The StrAccum "p" is not large enough to accept N new bytes of z[]. ** So enlarge if first, then do the append. ** -** This is a helper routine to sqlite3_str_append() that does special-case +** This is a helper routine to tdsqlite3_str_append() that does special-case ** work (enlarging the buffer) using tail recursion, so that the -** sqlite3_str_append() routine can use fast calling semantics. +** tdsqlite3_str_append() routine can use fast calling semantics. */ static void SQLITE_NOINLINE enlargeAndAppend(StrAccum *p, const char *z, int N){ - N = sqlite3StrAccumEnlarge(p, N); + N = tdsqlite3StrAccumEnlarge(p, N); if( N>0 ){ memcpy(&p->zText[p->nChar], z, N); p->nChar += N; @@ -34048,7 +34048,7 @@ static void SQLITE_NOINLINE enlargeAndAppend(StrAccum *p, const char *z, int N){ ** Append N bytes of text from z to the StrAccum object. Increase the ** size of the memory allocation for StrAccum if necessary. */ -SQLITE_API void sqlite3_str_append(sqlite3_str *p, const char *z, int N){ +SQLITE_API void tdsqlite3_str_append(tdsqlite3_str *p, const char *z, int N){ assert( z!=0 || N==0 ); assert( p->zText!=0 || p->nChar==0 || p->accError ); assert( N>=0 ); @@ -34065,8 +34065,8 @@ SQLITE_API void sqlite3_str_append(sqlite3_str *p, const char *z, int N){ /* ** Append the complete text of zero-terminated string z[] to the p string. */ -SQLITE_API void sqlite3_str_appendall(sqlite3_str *p, const char *z){ - sqlite3_str_append(p, z, sqlite3Strlen30(z)); +SQLITE_API void tdsqlite3_str_appendall(tdsqlite3_str *p, const char *z){ + tdsqlite3_str_append(p, z, tdsqlite3Strlen30(z)); } @@ -34078,7 +34078,7 @@ SQLITE_API void sqlite3_str_appendall(sqlite3_str *p, const char *z){ static SQLITE_NOINLINE char *strAccumFinishRealloc(StrAccum *p){ char *zText; assert( p->mxAlloc>0 && !isMalloced(p) ); - zText = sqlite3DbMallocRaw(p->db, p->nChar+1 ); + zText = tdsqlite3DbMallocRaw(p->db, p->nChar+1 ); if( zText ){ memcpy(zText, p->zText, p->nChar+1); p->printfFlags |= SQLITE_PRINTF_MALLOCED; @@ -34088,7 +34088,7 @@ static SQLITE_NOINLINE char *strAccumFinishRealloc(StrAccum *p){ p->zText = zText; return zText; } -SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum *p){ +SQLITE_PRIVATE char *tdsqlite3StrAccumFinish(StrAccum *p){ if( p->zText ){ p->zText[p->nChar] = 0; if( p->mxAlloc>0 && !isMalloced(p) ){ @@ -34099,22 +34099,22 @@ SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum *p){ } /* -** This singleton is an sqlite3_str object that is returned if -** sqlite3_malloc() fails to provide space for a real one. This -** sqlite3_str object accepts no new text and always returns +** This singleton is an tdsqlite3_str object that is returned if +** tdsqlite3_malloc() fails to provide space for a real one. This +** tdsqlite3_str object accepts no new text and always returns ** an SQLITE_NOMEM error. */ -static sqlite3_str sqlite3OomStr = { +static tdsqlite3_str tdsqlite3OomStr = { 0, 0, 0, 0, 0, SQLITE_NOMEM, 0 }; -/* Finalize a string created using sqlite3_str_new(). +/* Finalize a string created using tdsqlite3_str_new(). */ -SQLITE_API char *sqlite3_str_finish(sqlite3_str *p){ +SQLITE_API char *tdsqlite3_str_finish(tdsqlite3_str *p){ char *z; - if( p!=0 && p!=&sqlite3OomStr ){ - z = sqlite3StrAccumFinish(p); - sqlite3_free(p); + if( p!=0 && p!=&tdsqlite3OomStr ){ + z = tdsqlite3StrAccumFinish(p); + tdsqlite3_free(p); }else{ z = 0; } @@ -34122,17 +34122,17 @@ SQLITE_API char *sqlite3_str_finish(sqlite3_str *p){ } /* Return any error code associated with p */ -SQLITE_API int sqlite3_str_errcode(sqlite3_str *p){ +SQLITE_API int tdsqlite3_str_errcode(tdsqlite3_str *p){ return p ? p->accError : SQLITE_NOMEM; } /* Return the current length of p in bytes */ -SQLITE_API int sqlite3_str_length(sqlite3_str *p){ +SQLITE_API int tdsqlite3_str_length(tdsqlite3_str *p){ return p ? p->nChar : 0; } /* Return the current value for p */ -SQLITE_API char *sqlite3_str_value(sqlite3_str *p){ +SQLITE_API char *tdsqlite3_str_value(tdsqlite3_str *p){ if( p==0 || p->nChar==0 ) return 0; p->zText[p->nChar] = 0; return p->zText; @@ -34141,9 +34141,9 @@ SQLITE_API char *sqlite3_str_value(sqlite3_str *p){ /* ** Reset an StrAccum string. Reclaim all malloced memory. */ -SQLITE_API void sqlite3_str_reset(StrAccum *p){ +SQLITE_API void tdsqlite3_str_reset(StrAccum *p){ if( isMalloced(p) ){ - sqlite3DbFree(p->db, p->zText); + tdsqlite3DbFree(p->db, p->zText); p->printfFlags &= ~SQLITE_PRINTF_MALLOCED; } p->nAlloc = 0; @@ -34165,7 +34165,7 @@ SQLITE_API void sqlite3_str_reset(StrAccum *p){ ** mx: Maximum number of bytes to accumulate. If mx==0 then no memory ** allocations will ever occur. */ -SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum *p, sqlite3 *db, char *zBase, int n, int mx){ +SQLITE_PRIVATE void tdsqlite3StrAccumInit(StrAccum *p, tdsqlite3 *db, char *zBase, int n, int mx){ p->zText = zBase; p->db = db; p->nAlloc = n; @@ -34176,13 +34176,13 @@ SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum *p, sqlite3 *db, char *zBase, i } /* Allocate and initialize a new dynamic string object */ -SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3 *db){ - sqlite3_str *p = sqlite3_malloc64(sizeof(*p)); +SQLITE_API tdsqlite3_str *tdsqlite3_str_new(tdsqlite3 *db){ + tdsqlite3_str *p = tdsqlite3_malloc64(sizeof(*p)); if( p ){ - sqlite3StrAccumInit(p, 0, 0, 0, + tdsqlite3StrAccumInit(p, 0, 0, 0, db ? db->aLimit[SQLITE_LIMIT_LENGTH] : SQLITE_MAX_LENGTH); }else{ - p = &sqlite3OomStr; + p = &tdsqlite3OomStr; } return p; } @@ -34191,18 +34191,18 @@ SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3 *db){ ** Print into memory obtained from sqliteMalloc(). Use the internal ** %-conversion extensions. */ -SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3 *db, const char *zFormat, va_list ap){ +SQLITE_PRIVATE char *tdsqlite3VMPrintf(tdsqlite3 *db, const char *zFormat, va_list ap){ char *z; char zBase[SQLITE_PRINT_BUF_SIZE]; StrAccum acc; assert( db!=0 ); - sqlite3StrAccumInit(&acc, db, zBase, sizeof(zBase), + tdsqlite3StrAccumInit(&acc, db, zBase, sizeof(zBase), db->aLimit[SQLITE_LIMIT_LENGTH]); acc.printfFlags = SQLITE_PRINTF_INTERNAL; - sqlite3_str_vappendf(&acc, zFormat, ap); - z = sqlite3StrAccumFinish(&acc); + tdsqlite3_str_vappendf(&acc, zFormat, ap); + z = tdsqlite3StrAccumFinish(&acc); if( acc.accError==SQLITE_NOMEM ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); } return z; } @@ -34211,20 +34211,20 @@ SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3 *db, const char *zFormat, va_list a ** Print into memory obtained from sqliteMalloc(). Use the internal ** %-conversion extensions. */ -SQLITE_PRIVATE char *sqlite3MPrintf(sqlite3 *db, const char *zFormat, ...){ +SQLITE_PRIVATE char *tdsqlite3MPrintf(tdsqlite3 *db, const char *zFormat, ...){ va_list ap; char *z; va_start(ap, zFormat); - z = sqlite3VMPrintf(db, zFormat, ap); + z = tdsqlite3VMPrintf(db, zFormat, ap); va_end(ap); return z; } /* -** Print into memory obtained from sqlite3_malloc(). Omit the internal +** Print into memory obtained from tdsqlite3_malloc(). Omit the internal ** %-conversion extensions. */ -SQLITE_API char *sqlite3_vmprintf(const char *zFormat, va_list ap){ +SQLITE_API char *tdsqlite3_vmprintf(const char *zFormat, va_list ap){ char *z; char zBase[SQLITE_PRINT_BUF_SIZE]; StrAccum acc; @@ -34236,44 +34236,44 @@ SQLITE_API char *sqlite3_vmprintf(const char *zFormat, va_list ap){ } #endif #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; + if( tdsqlite3_initialize() ) return 0; #endif - sqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), SQLITE_MAX_LENGTH); - sqlite3_str_vappendf(&acc, zFormat, ap); - z = sqlite3StrAccumFinish(&acc); + tdsqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), SQLITE_MAX_LENGTH); + tdsqlite3_str_vappendf(&acc, zFormat, ap); + z = tdsqlite3StrAccumFinish(&acc); return z; } /* -** Print into memory obtained from sqlite3_malloc()(). Omit the internal +** Print into memory obtained from tdsqlite3_malloc()(). Omit the internal ** %-conversion extensions. */ -SQLITE_API char *sqlite3_mprintf(const char *zFormat, ...){ +SQLITE_API char *tdsqlite3_mprintf(const char *zFormat, ...){ va_list ap; char *z; #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; + if( tdsqlite3_initialize() ) return 0; #endif va_start(ap, zFormat); - z = sqlite3_vmprintf(zFormat, ap); + z = tdsqlite3_vmprintf(zFormat, ap); va_end(ap); return z; } /* -** sqlite3_snprintf() works like snprintf() except that it ignores the +** tdsqlite3_snprintf() works like snprintf() except that it ignores the ** current locale settings. This is important for SQLite because we ** are not able to use a "," as the decimal point in place of "." as ** specified by some locales. ** -** Oops: The first two arguments of sqlite3_snprintf() are backwards +** Oops: The first two arguments of tdsqlite3_snprintf() are backwards ** from the snprintf() standard. Unfortunately, it is too late to change ** this without breaking compatibility, so we just have to live with the ** mistake. ** -** sqlite3_vsnprintf() is the varargs version. +** tdsqlite3_vsnprintf() is the varargs version. */ -SQLITE_API char *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){ +SQLITE_API char *tdsqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){ StrAccum acc; if( n<=0 ) return zBuf; #ifdef SQLITE_ENABLE_API_ARMOR @@ -34283,50 +34283,50 @@ SQLITE_API char *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_li return zBuf; } #endif - sqlite3StrAccumInit(&acc, 0, zBuf, n, 0); - sqlite3_str_vappendf(&acc, zFormat, ap); + tdsqlite3StrAccumInit(&acc, 0, zBuf, n, 0); + tdsqlite3_str_vappendf(&acc, zFormat, ap); zBuf[acc.nChar] = 0; return zBuf; } -SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){ +SQLITE_API char *tdsqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){ char *z; va_list ap; va_start(ap,zFormat); - z = sqlite3_vsnprintf(n, zBuf, zFormat, ap); + z = tdsqlite3_vsnprintf(n, zBuf, zFormat, ap); va_end(ap); return z; } /* -** This is the routine that actually formats the sqlite3_log() message. -** We house it in a separate routine from sqlite3_log() to avoid using +** This is the routine that actually formats the tdsqlite3_log() message. +** We house it in a separate routine from tdsqlite3_log() to avoid using ** stack space on small-stack systems when logging is disabled. ** -** sqlite3_log() must render into a static buffer. It cannot dynamically +** tdsqlite3_log() must render into a static buffer. It cannot dynamically ** allocate memory because it might be called while the memory allocator ** mutex is held. ** -** sqlite3_str_vappendf() might ask for *temporary* memory allocations for +** tdsqlite3_str_vappendf() might ask for *temporary* memory allocations for ** certain format characters (%q) or for very large precisions or widths. -** Care must be taken that any sqlite3_log() calls that occur while the +** Care must be taken that any tdsqlite3_log() calls that occur while the ** memory mutex is held do not use these mechanisms. */ static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){ StrAccum acc; /* String accumulator */ char zMsg[SQLITE_PRINT_BUF_SIZE*3]; /* Complete log message */ - sqlite3StrAccumInit(&acc, 0, zMsg, sizeof(zMsg), 0); - sqlite3_str_vappendf(&acc, zFormat, ap); - sqlite3GlobalConfig.xLog(sqlite3GlobalConfig.pLogArg, iErrCode, - sqlite3StrAccumFinish(&acc)); + tdsqlite3StrAccumInit(&acc, 0, zMsg, sizeof(zMsg), 0); + tdsqlite3_str_vappendf(&acc, zFormat, ap); + tdsqlite3GlobalConfig.xLog(tdsqlite3GlobalConfig.pLogArg, iErrCode, + tdsqlite3StrAccumFinish(&acc)); } /* ** Format and write a message to the log if logging is enabled. */ -SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...){ +SQLITE_API void tdsqlite3_log(int iErrCode, const char *zFormat, ...){ va_list ap; /* Vararg list */ - if( sqlite3GlobalConfig.xLog ){ + if( tdsqlite3GlobalConfig.xLog ){ va_start(ap, zFormat); renderLogMsg(iErrCode, zFormat, ap); va_end(ap); @@ -34339,15 +34339,15 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...){ ** The printf() built into some versions of windows does not understand %lld ** and segfaults if you give it a long long int. */ -SQLITE_PRIVATE void sqlite3DebugPrintf(const char *zFormat, ...){ +SQLITE_PRIVATE void tdsqlite3DebugPrintf(const char *zFormat, ...){ va_list ap; StrAccum acc; char zBuf[500]; - sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); + tdsqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); va_start(ap,zFormat); - sqlite3_str_vappendf(&acc, zFormat, ap); + tdsqlite3_str_vappendf(&acc, zFormat, ap); va_end(ap); - sqlite3StrAccumFinish(&acc); + tdsqlite3StrAccumFinish(&acc); #ifdef SQLITE_OS_TRACE_PROC { extern void SQLITE_OS_TRACE_PROC(const char *zBuf, int nBuf); @@ -34362,13 +34362,13 @@ SQLITE_PRIVATE void sqlite3DebugPrintf(const char *zFormat, ...){ /* -** variable-argument wrapper around sqlite3_str_vappendf(). The bFlags argument +** variable-argument wrapper around tdsqlite3_str_vappendf(). The bFlags argument ** can contain the bit SQLITE_PRINTF_INTERNAL enable internal formats. */ -SQLITE_API void sqlite3_str_appendf(StrAccum *p, const char *zFormat, ...){ +SQLITE_API void tdsqlite3_str_appendf(StrAccum *p, const char *zFormat, ...){ va_list ap; va_start(ap,zFormat); - sqlite3_str_vappendf(p, zFormat, ap); + tdsqlite3_str_vappendf(p, zFormat, ap); va_end(ap); } @@ -34400,9 +34400,9 @@ SQLITE_API void sqlite3_str_appendf(StrAccum *p, const char *zFormat, ...){ ** Add a new subitem to the tree. The moreToFollow flag indicates that this ** is not the last item in the tree. */ -static TreeView *sqlite3TreeViewPush(TreeView *p, u8 moreToFollow){ +static TreeView *tdsqlite3TreeViewPush(TreeView *p, u8 moreToFollow){ if( p==0 ){ - p = sqlite3_malloc64( sizeof(*p) ); + p = tdsqlite3_malloc64( sizeof(*p) ); if( p==0 ) return 0; memset(p, 0, sizeof(*p)); }else{ @@ -34416,36 +34416,36 @@ static TreeView *sqlite3TreeViewPush(TreeView *p, u8 moreToFollow){ /* ** Finished with one layer of the tree */ -static void sqlite3TreeViewPop(TreeView *p){ +static void tdsqlite3TreeViewPop(TreeView *p){ if( p==0 ) return; p->iLevel--; - if( p->iLevel<0 ) sqlite3_free(p); + if( p->iLevel<0 ) tdsqlite3_free(p); } /* ** Generate a single line of output for the tree, with a prefix that contains ** all the appropriate tree lines */ -static void sqlite3TreeViewLine(TreeView *p, const char *zFormat, ...){ +static void tdsqlite3TreeViewLine(TreeView *p, const char *zFormat, ...){ va_list ap; int i; StrAccum acc; char zBuf[500]; - sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); + tdsqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); if( p ){ for(i=0; iiLevel && ibLine)-1; i++){ - sqlite3_str_append(&acc, p->bLine[i] ? "| " : " ", 4); + tdsqlite3_str_append(&acc, p->bLine[i] ? "| " : " ", 4); } - sqlite3_str_append(&acc, p->bLine[i] ? "|-- " : "'-- ", 4); + tdsqlite3_str_append(&acc, p->bLine[i] ? "|-- " : "'-- ", 4); } if( zFormat!=0 ){ va_start(ap, zFormat); - sqlite3_str_vappendf(&acc, zFormat, ap); + tdsqlite3_str_vappendf(&acc, zFormat, ap); va_end(ap); assert( acc.nChar>0 || acc.accError ); - sqlite3_str_append(&acc, "\n", 1); + tdsqlite3_str_append(&acc, "\n", 1); } - sqlite3StrAccumFinish(&acc); + tdsqlite3StrAccumFinish(&acc); fprintf(stdout,"%s", zBuf); fflush(stdout); } @@ -34453,112 +34453,112 @@ static void sqlite3TreeViewLine(TreeView *p, const char *zFormat, ...){ /* ** Shorthand for starting a new tree item that consists of a single label */ -static void sqlite3TreeViewItem(TreeView *p, const char *zLabel,u8 moreFollows){ - p = sqlite3TreeViewPush(p, moreFollows); - sqlite3TreeViewLine(p, "%s", zLabel); +static void tdsqlite3TreeViewItem(TreeView *p, const char *zLabel,u8 moreFollows){ + p = tdsqlite3TreeViewPush(p, moreFollows); + tdsqlite3TreeViewLine(p, "%s", zLabel); } /* ** Generate a human-readable description of a WITH clause. */ -SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView *pView, const With *pWith, u8 moreToFollow){ +SQLITE_PRIVATE void tdsqlite3TreeViewWith(TreeView *pView, const With *pWith, u8 moreToFollow){ int i; if( pWith==0 ) return; if( pWith->nCte==0 ) return; if( pWith->pOuter ){ - sqlite3TreeViewLine(pView, "WITH (0x%p, pOuter=0x%p)",pWith,pWith->pOuter); + tdsqlite3TreeViewLine(pView, "WITH (0x%p, pOuter=0x%p)",pWith,pWith->pOuter); }else{ - sqlite3TreeViewLine(pView, "WITH (0x%p)", pWith); + tdsqlite3TreeViewLine(pView, "WITH (0x%p)", pWith); } if( pWith->nCte>0 ){ - pView = sqlite3TreeViewPush(pView, 1); + pView = tdsqlite3TreeViewPush(pView, 1); for(i=0; inCte; i++){ StrAccum x; char zLine[1000]; const struct Cte *pCte = &pWith->a[i]; - sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0); - sqlite3_str_appendf(&x, "%s", pCte->zName); + tdsqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0); + tdsqlite3_str_appendf(&x, "%s", pCte->zName); if( pCte->pCols && pCte->pCols->nExpr>0 ){ char cSep = '('; int j; for(j=0; jpCols->nExpr; j++){ - sqlite3_str_appendf(&x, "%c%s", cSep, pCte->pCols->a[j].zEName); + tdsqlite3_str_appendf(&x, "%c%s", cSep, pCte->pCols->a[j].zEName); cSep = ','; } - sqlite3_str_appendf(&x, ")"); + tdsqlite3_str_appendf(&x, ")"); } - sqlite3_str_appendf(&x, " AS"); - sqlite3StrAccumFinish(&x); - sqlite3TreeViewItem(pView, zLine, inCte-1); - sqlite3TreeViewSelect(pView, pCte->pSelect, 0); - sqlite3TreeViewPop(pView); + tdsqlite3_str_appendf(&x, " AS"); + tdsqlite3StrAccumFinish(&x); + tdsqlite3TreeViewItem(pView, zLine, inCte-1); + tdsqlite3TreeViewSelect(pView, pCte->pSelect, 0); + tdsqlite3TreeViewPop(pView); } - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewPop(pView); } } /* ** Generate a human-readable description of a SrcList object. */ -SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){ +SQLITE_PRIVATE void tdsqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){ int i; for(i=0; inSrc; i++){ const struct SrcList_item *pItem = &pSrc->a[i]; StrAccum x; char zLine[100]; - sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0); - sqlite3_str_appendf(&x, "{%d:*}", pItem->iCursor); + tdsqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0); + tdsqlite3_str_appendf(&x, "{%d:*}", pItem->iCursor); if( pItem->zDatabase ){ - sqlite3_str_appendf(&x, " %s.%s", pItem->zDatabase, pItem->zName); + tdsqlite3_str_appendf(&x, " %s.%s", pItem->zDatabase, pItem->zName); }else if( pItem->zName ){ - sqlite3_str_appendf(&x, " %s", pItem->zName); + tdsqlite3_str_appendf(&x, " %s", pItem->zName); } if( pItem->pTab ){ - sqlite3_str_appendf(&x, " tab=%Q nCol=%d ptr=%p", + tdsqlite3_str_appendf(&x, " tab=%Q nCol=%d ptr=%p", pItem->pTab->zName, pItem->pTab->nCol, pItem->pTab); } if( pItem->zAlias ){ - sqlite3_str_appendf(&x, " (AS %s)", pItem->zAlias); + tdsqlite3_str_appendf(&x, " (AS %s)", pItem->zAlias); } if( pItem->fg.jointype & JT_LEFT ){ - sqlite3_str_appendf(&x, " LEFT-JOIN"); + tdsqlite3_str_appendf(&x, " LEFT-JOIN"); } if( pItem->fg.fromDDL ){ - sqlite3_str_appendf(&x, " DDL"); + tdsqlite3_str_appendf(&x, " DDL"); } - sqlite3StrAccumFinish(&x); - sqlite3TreeViewItem(pView, zLine, inSrc-1); + tdsqlite3StrAccumFinish(&x); + tdsqlite3TreeViewItem(pView, zLine, inSrc-1); if( pItem->pSelect ){ - sqlite3TreeViewSelect(pView, pItem->pSelect, 0); + tdsqlite3TreeViewSelect(pView, pItem->pSelect, 0); } if( pItem->fg.isTabFunc ){ - sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:"); + tdsqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:"); } - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewPop(pView); } } /* ** Generate a human-readable description of a Select object. */ -SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){ +SQLITE_PRIVATE void tdsqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){ int n = 0; int cnt = 0; if( p==0 ){ - sqlite3TreeViewLine(pView, "nil-SELECT"); + tdsqlite3TreeViewLine(pView, "nil-SELECT"); return; } - pView = sqlite3TreeViewPush(pView, moreToFollow); + pView = tdsqlite3TreeViewPush(pView, moreToFollow); if( p->pWith ){ - sqlite3TreeViewWith(pView, p->pWith, 1); + tdsqlite3TreeViewWith(pView, p->pWith, 1); cnt = 1; - sqlite3TreeViewPush(pView, 1); + tdsqlite3TreeViewPush(pView, 1); } do{ if( p->selFlags & SF_WhereBegin ){ - sqlite3TreeViewLine(pView, "sqlite3WhereBegin()"); + tdsqlite3TreeViewLine(pView, "tdsqlite3WhereBegin()"); }else{ - sqlite3TreeViewLine(pView, + tdsqlite3TreeViewLine(pView, "SELECT%s%s (%u/%p) selFlags=0x%x nSelectRow=%d", ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""), ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""), @@ -34566,7 +34566,7 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 m (int)p->nSelectRow ); } - if( cnt++ ) sqlite3TreeViewPop(pView); + if( cnt++ ) tdsqlite3TreeViewPop(pView); if( p->pPrior ){ n = 1000; }else{ @@ -34583,61 +34583,61 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 m #endif } if( p->pEList ){ - sqlite3TreeViewExprList(pView, p->pEList, n>0, "result-set"); + tdsqlite3TreeViewExprList(pView, p->pEList, n>0, "result-set"); } n--; #ifndef SQLITE_OMIT_WINDOWFUNC if( p->pWin ){ Window *pX; - pView = sqlite3TreeViewPush(pView, (n--)>0); - sqlite3TreeViewLine(pView, "window-functions"); + pView = tdsqlite3TreeViewPush(pView, (n--)>0); + tdsqlite3TreeViewLine(pView, "window-functions"); for(pX=p->pWin; pX; pX=pX->pNextWin){ - sqlite3TreeViewWinFunc(pView, pX, pX->pNextWin!=0); + tdsqlite3TreeViewWinFunc(pView, pX, pX->pNextWin!=0); } - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewPop(pView); } #endif if( p->pSrc && p->pSrc->nSrc ){ - pView = sqlite3TreeViewPush(pView, (n--)>0); - sqlite3TreeViewLine(pView, "FROM"); - sqlite3TreeViewSrcList(pView, p->pSrc); - sqlite3TreeViewPop(pView); + pView = tdsqlite3TreeViewPush(pView, (n--)>0); + tdsqlite3TreeViewLine(pView, "FROM"); + tdsqlite3TreeViewSrcList(pView, p->pSrc); + tdsqlite3TreeViewPop(pView); } if( p->pWhere ){ - sqlite3TreeViewItem(pView, "WHERE", (n--)>0); - sqlite3TreeViewExpr(pView, p->pWhere, 0); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewItem(pView, "WHERE", (n--)>0); + tdsqlite3TreeViewExpr(pView, p->pWhere, 0); + tdsqlite3TreeViewPop(pView); } if( p->pGroupBy ){ - sqlite3TreeViewExprList(pView, p->pGroupBy, (n--)>0, "GROUPBY"); + tdsqlite3TreeViewExprList(pView, p->pGroupBy, (n--)>0, "GROUPBY"); } if( p->pHaving ){ - sqlite3TreeViewItem(pView, "HAVING", (n--)>0); - sqlite3TreeViewExpr(pView, p->pHaving, 0); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewItem(pView, "HAVING", (n--)>0); + tdsqlite3TreeViewExpr(pView, p->pHaving, 0); + tdsqlite3TreeViewPop(pView); } #ifndef SQLITE_OMIT_WINDOWFUNC if( p->pWinDefn ){ Window *pX; - sqlite3TreeViewItem(pView, "WINDOW", (n--)>0); + tdsqlite3TreeViewItem(pView, "WINDOW", (n--)>0); for(pX=p->pWinDefn; pX; pX=pX->pNextWin){ - sqlite3TreeViewWindow(pView, pX, pX->pNextWin!=0); + tdsqlite3TreeViewWindow(pView, pX, pX->pNextWin!=0); } - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewPop(pView); } #endif if( p->pOrderBy ){ - sqlite3TreeViewExprList(pView, p->pOrderBy, (n--)>0, "ORDERBY"); + tdsqlite3TreeViewExprList(pView, p->pOrderBy, (n--)>0, "ORDERBY"); } if( p->pLimit ){ - sqlite3TreeViewItem(pView, "LIMIT", (n--)>0); - sqlite3TreeViewExpr(pView, p->pLimit->pLeft, p->pLimit->pRight!=0); + tdsqlite3TreeViewItem(pView, "LIMIT", (n--)>0); + tdsqlite3TreeViewExpr(pView, p->pLimit->pLeft, p->pLimit->pRight!=0); if( p->pLimit->pRight ){ - sqlite3TreeViewItem(pView, "OFFSET", (n--)>0); - sqlite3TreeViewExpr(pView, p->pLimit->pRight, 0); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewItem(pView, "OFFSET", (n--)>0); + tdsqlite3TreeViewExpr(pView, p->pLimit->pRight, 0); + tdsqlite3TreeViewPop(pView); } - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewPop(pView); } if( p->pPrior ){ const char *zOp = "UNION"; @@ -34646,18 +34646,18 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 m case TK_INTERSECT: zOp = "INTERSECT"; break; case TK_EXCEPT: zOp = "EXCEPT"; break; } - sqlite3TreeViewItem(pView, zOp, 1); + tdsqlite3TreeViewItem(pView, zOp, 1); } p = p->pPrior; }while( p!=0 ); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewPop(pView); } #ifndef SQLITE_OMIT_WINDOWFUNC /* ** Generate a description of starting or stopping bounds */ -SQLITE_PRIVATE void sqlite3TreeViewBound( +SQLITE_PRIVATE void tdsqlite3TreeViewBound( TreeView *pView, /* View context */ u8 eBound, /* UNBOUNDED, CURRENT, PRECEDING, FOLLOWING */ Expr *pExpr, /* Value for PRECEDING or FOLLOWING */ @@ -34665,25 +34665,25 @@ SQLITE_PRIVATE void sqlite3TreeViewBound( ){ switch( eBound ){ case TK_UNBOUNDED: { - sqlite3TreeViewItem(pView, "UNBOUNDED", moreToFollow); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewItem(pView, "UNBOUNDED", moreToFollow); + tdsqlite3TreeViewPop(pView); break; } case TK_CURRENT: { - sqlite3TreeViewItem(pView, "CURRENT", moreToFollow); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewItem(pView, "CURRENT", moreToFollow); + tdsqlite3TreeViewPop(pView); break; } case TK_PRECEDING: { - sqlite3TreeViewItem(pView, "PRECEDING", moreToFollow); - sqlite3TreeViewExpr(pView, pExpr, 0); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewItem(pView, "PRECEDING", moreToFollow); + tdsqlite3TreeViewExpr(pView, pExpr, 0); + tdsqlite3TreeViewPop(pView); break; } case TK_FOLLOWING: { - sqlite3TreeViewItem(pView, "FOLLOWING", moreToFollow); - sqlite3TreeViewExpr(pView, pExpr, 0); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewItem(pView, "FOLLOWING", moreToFollow); + tdsqlite3TreeViewExpr(pView, pExpr, 0); + tdsqlite3TreeViewPop(pView); break; } } @@ -34694,45 +34694,45 @@ SQLITE_PRIVATE void sqlite3TreeViewBound( /* ** Generate a human-readable explanation for a Window object */ -SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u8 more){ +SQLITE_PRIVATE void tdsqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u8 more){ int nElement = 0; if( pWin->pFilter ){ - sqlite3TreeViewItem(pView, "FILTER", 1); - sqlite3TreeViewExpr(pView, pWin->pFilter, 0); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewItem(pView, "FILTER", 1); + tdsqlite3TreeViewExpr(pView, pWin->pFilter, 0); + tdsqlite3TreeViewPop(pView); } - pView = sqlite3TreeViewPush(pView, more); + pView = tdsqlite3TreeViewPush(pView, more); if( pWin->zName ){ - sqlite3TreeViewLine(pView, "OVER %s (%p)", pWin->zName, pWin); + tdsqlite3TreeViewLine(pView, "OVER %s (%p)", pWin->zName, pWin); }else{ - sqlite3TreeViewLine(pView, "OVER (%p)", pWin); + tdsqlite3TreeViewLine(pView, "OVER (%p)", pWin); } if( pWin->zBase ) nElement++; if( pWin->pOrderBy ) nElement++; if( pWin->eFrmType ) nElement++; if( pWin->eExclude ) nElement++; if( pWin->zBase ){ - sqlite3TreeViewPush(pView, (--nElement)>0); - sqlite3TreeViewLine(pView, "window: %s", pWin->zBase); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewPush(pView, (--nElement)>0); + tdsqlite3TreeViewLine(pView, "window: %s", pWin->zBase); + tdsqlite3TreeViewPop(pView); } if( pWin->pPartition ){ - sqlite3TreeViewExprList(pView, pWin->pPartition, nElement>0,"PARTITION-BY"); + tdsqlite3TreeViewExprList(pView, pWin->pPartition, nElement>0,"PARTITION-BY"); } if( pWin->pOrderBy ){ - sqlite3TreeViewExprList(pView, pWin->pOrderBy, (--nElement)>0, "ORDER-BY"); + tdsqlite3TreeViewExprList(pView, pWin->pOrderBy, (--nElement)>0, "ORDER-BY"); } if( pWin->eFrmType ){ char zBuf[30]; const char *zFrmType = "ROWS"; if( pWin->eFrmType==TK_RANGE ) zFrmType = "RANGE"; if( pWin->eFrmType==TK_GROUPS ) zFrmType = "GROUPS"; - sqlite3_snprintf(sizeof(zBuf),zBuf,"%s%s",zFrmType, + tdsqlite3_snprintf(sizeof(zBuf),zBuf,"%s%s",zFrmType, pWin->bImplicitFrame ? " (implied)" : ""); - sqlite3TreeViewItem(pView, zBuf, (--nElement)>0); - sqlite3TreeViewBound(pView, pWin->eStart, pWin->pStart, 1); - sqlite3TreeViewBound(pView, pWin->eEnd, pWin->pEnd, 0); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewItem(pView, zBuf, (--nElement)>0); + tdsqlite3TreeViewBound(pView, pWin->eStart, pWin->pStart, 1); + tdsqlite3TreeViewBound(pView, pWin->eEnd, pWin->pEnd, 0); + tdsqlite3TreeViewPop(pView); } if( pWin->eExclude ){ char zBuf[30]; @@ -34743,15 +34743,15 @@ SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u case TK_GROUP: zExclude = "GROUP"; break; case TK_TIES: zExclude = "TIES"; break; default: - sqlite3_snprintf(sizeof(zBuf),zBuf,"invalid(%d)", pWin->eExclude); + tdsqlite3_snprintf(sizeof(zBuf),zBuf,"invalid(%d)", pWin->eExclude); zExclude = zBuf; break; } - sqlite3TreeViewPush(pView, 0); - sqlite3TreeViewLine(pView, "EXCLUDE %s", zExclude); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewPush(pView, 0); + tdsqlite3TreeViewLine(pView, "EXCLUDE %s", zExclude); + tdsqlite3TreeViewPop(pView); } - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewPop(pView); } #endif /* SQLITE_OMIT_WINDOWFUNC */ @@ -34759,46 +34759,46 @@ SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u /* ** Generate a human-readable explanation for a Window Function object */ -SQLITE_PRIVATE void sqlite3TreeViewWinFunc(TreeView *pView, const Window *pWin, u8 more){ - pView = sqlite3TreeViewPush(pView, more); - sqlite3TreeViewLine(pView, "WINFUNC %s(%d)", +SQLITE_PRIVATE void tdsqlite3TreeViewWinFunc(TreeView *pView, const Window *pWin, u8 more){ + pView = tdsqlite3TreeViewPush(pView, more); + tdsqlite3TreeViewLine(pView, "WINFUNC %s(%d)", pWin->pFunc->zName, pWin->pFunc->nArg); - sqlite3TreeViewWindow(pView, pWin, 0); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewWindow(pView, pWin, 0); + tdsqlite3TreeViewPop(pView); } #endif /* SQLITE_OMIT_WINDOWFUNC */ /* ** Generate a human-readable explanation of an expression tree. */ -SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){ +SQLITE_PRIVATE void tdsqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){ const char *zBinOp = 0; /* Binary operator */ const char *zUniOp = 0; /* Unary operator */ char zFlgs[60]; - pView = sqlite3TreeViewPush(pView, moreToFollow); + pView = tdsqlite3TreeViewPush(pView, moreToFollow); if( pExpr==0 ){ - sqlite3TreeViewLine(pView, "nil"); - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewLine(pView, "nil"); + tdsqlite3TreeViewPop(pView); return; } if( pExpr->flags || pExpr->affExpr ){ StrAccum x; - sqlite3StrAccumInit(&x, 0, zFlgs, sizeof(zFlgs), 0); - sqlite3_str_appendf(&x, " fg.af=%x.%c", + tdsqlite3StrAccumInit(&x, 0, zFlgs, sizeof(zFlgs), 0); + tdsqlite3_str_appendf(&x, " fg.af=%x.%c", pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n'); if( ExprHasProperty(pExpr, EP_FromJoin) ){ - sqlite3_str_appendf(&x, " iRJT=%d", pExpr->iRightJoinTable); + tdsqlite3_str_appendf(&x, " iRJT=%d", pExpr->iRightJoinTable); } if( ExprHasProperty(pExpr, EP_FromDDL) ){ - sqlite3_str_appendf(&x, " DDL"); + tdsqlite3_str_appendf(&x, " DDL"); } - sqlite3StrAccumFinish(&x); + tdsqlite3StrAccumFinish(&x); }else{ zFlgs[0] = 0; } switch( pExpr->op ){ case TK_AGG_COLUMN: { - sqlite3TreeViewLine(pView, "AGG{%d:%d}%s", + tdsqlite3TreeViewLine(pView, "AGG{%d:%d}%s", pExpr->iTable, pExpr->iColumn, zFlgs); break; } @@ -34807,73 +34807,73 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m /* This only happens when coding check constraints */ char zOp2[16]; if( pExpr->op2 ){ - sqlite3_snprintf(sizeof(zOp2),zOp2," op2=0x%02x",pExpr->op2); + tdsqlite3_snprintf(sizeof(zOp2),zOp2," op2=0x%02x",pExpr->op2); }else{ zOp2[0] = 0; } - sqlite3TreeViewLine(pView, "COLUMN(%d)%s%s", + tdsqlite3TreeViewLine(pView, "COLUMN(%d)%s%s", pExpr->iColumn, zFlgs, zOp2); }else{ - sqlite3TreeViewLine(pView, "{%d:%d} pTab=%p%s", + tdsqlite3TreeViewLine(pView, "{%d:%d} pTab=%p%s", pExpr->iTable, pExpr->iColumn, pExpr->y.pTab, zFlgs); } if( ExprHasProperty(pExpr, EP_FixedCol) ){ - sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); + tdsqlite3TreeViewExpr(pView, pExpr->pLeft, 0); } break; } case TK_INTEGER: { if( pExpr->flags & EP_IntValue ){ - sqlite3TreeViewLine(pView, "%d", pExpr->u.iValue); + tdsqlite3TreeViewLine(pView, "%d", pExpr->u.iValue); }else{ - sqlite3TreeViewLine(pView, "%s", pExpr->u.zToken); + tdsqlite3TreeViewLine(pView, "%s", pExpr->u.zToken); } break; } #ifndef SQLITE_OMIT_FLOATING_POINT case TK_FLOAT: { - sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken); + tdsqlite3TreeViewLine(pView,"%s", pExpr->u.zToken); break; } #endif case TK_STRING: { - sqlite3TreeViewLine(pView,"%Q", pExpr->u.zToken); + tdsqlite3TreeViewLine(pView,"%Q", pExpr->u.zToken); break; } case TK_NULL: { - sqlite3TreeViewLine(pView,"NULL"); + tdsqlite3TreeViewLine(pView,"NULL"); break; } case TK_TRUEFALSE: { - sqlite3TreeViewLine(pView, - sqlite3ExprTruthValue(pExpr) ? "TRUE" : "FALSE"); + tdsqlite3TreeViewLine(pView, + tdsqlite3ExprTruthValue(pExpr) ? "TRUE" : "FALSE"); break; } #ifndef SQLITE_OMIT_BLOB_LITERAL case TK_BLOB: { - sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken); + tdsqlite3TreeViewLine(pView,"%s", pExpr->u.zToken); break; } #endif case TK_VARIABLE: { - sqlite3TreeViewLine(pView,"VARIABLE(%s,%d)", + tdsqlite3TreeViewLine(pView,"VARIABLE(%s,%d)", pExpr->u.zToken, pExpr->iColumn); break; } case TK_REGISTER: { - sqlite3TreeViewLine(pView,"REGISTER(%d)", pExpr->iTable); + tdsqlite3TreeViewLine(pView,"REGISTER(%d)", pExpr->iTable); break; } case TK_ID: { - sqlite3TreeViewLine(pView,"ID \"%w\"", pExpr->u.zToken); + tdsqlite3TreeViewLine(pView,"ID \"%w\"", pExpr->u.zToken); break; } #ifndef SQLITE_OMIT_CAST case TK_CAST: { /* Expressions of the form: CAST(pLeft AS token) */ - sqlite3TreeViewLine(pView,"CAST %Q", pExpr->u.zToken); - sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); + tdsqlite3TreeViewLine(pView,"CAST %Q", pExpr->u.zToken); + tdsqlite3TreeViewExpr(pView, pExpr->pLeft, 0); break; } #endif /* SQLITE_OMIT_CAST */ @@ -34913,15 +34913,15 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m }; assert( pExpr->op2==TK_IS || pExpr->op2==TK_ISNOT ); assert( pExpr->pRight ); - assert( sqlite3ExprSkipCollate(pExpr->pRight)->op==TK_TRUEFALSE ); - x = (pExpr->op2==TK_ISNOT)*2 + sqlite3ExprTruthValue(pExpr->pRight); + assert( tdsqlite3ExprSkipCollate(pExpr->pRight)->op==TK_TRUEFALSE ); + x = (pExpr->op2==TK_ISNOT)*2 + tdsqlite3ExprTruthValue(pExpr->pRight); zUniOp = azOp[x]; break; } case TK_SPAN: { - sqlite3TreeViewLine(pView, "SPAN %Q", pExpr->u.zToken); - sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); + tdsqlite3TreeViewLine(pView, "SPAN %Q", pExpr->u.zToken); + tdsqlite3TreeViewExpr(pView, pExpr->pLeft, 0); break; } @@ -34931,10 +34931,10 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m ** up in the treeview output as "SOFT-COLLATE". Explicit COLLATE ** operators that appear in the original SQL always have the ** EP_Collate bit set and appear in treeview output as just "COLLATE" */ - sqlite3TreeViewLine(pView, "%sCOLLATE %Q%s", + tdsqlite3TreeViewLine(pView, "%sCOLLATE %Q%s", !ExprHasProperty(pExpr, EP_Collate) ? "SOFT-" : "", pExpr->u.zToken, zFlgs); - sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); + tdsqlite3TreeViewExpr(pView, pExpr->pLeft, 0); break; } @@ -34954,50 +34954,50 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m #endif } if( pExpr->op==TK_AGG_FUNCTION ){ - sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s", + tdsqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s", pExpr->op2, pExpr->u.zToken, zFlgs); }else if( pExpr->op2!=0 ){ const char *zOp2; char zBuf[8]; - sqlite3_snprintf(sizeof(zBuf),zBuf,"0x%02x",pExpr->op2); + tdsqlite3_snprintf(sizeof(zBuf),zBuf,"0x%02x",pExpr->op2); zOp2 = zBuf; if( pExpr->op2==NC_IsCheck ) zOp2 = "NC_IsCheck"; if( pExpr->op2==NC_IdxExpr ) zOp2 = "NC_IdxExpr"; if( pExpr->op2==NC_PartIdx ) zOp2 = "NC_PartIdx"; if( pExpr->op2==NC_GenCol ) zOp2 = "NC_GenCol"; - sqlite3TreeViewLine(pView, "FUNCTION %Q%s op2=%s", + tdsqlite3TreeViewLine(pView, "FUNCTION %Q%s op2=%s", pExpr->u.zToken, zFlgs, zOp2); }else{ - sqlite3TreeViewLine(pView, "FUNCTION %Q%s", pExpr->u.zToken, zFlgs); + tdsqlite3TreeViewLine(pView, "FUNCTION %Q%s", pExpr->u.zToken, zFlgs); } if( pFarg ){ - sqlite3TreeViewExprList(pView, pFarg, pWin!=0, 0); + tdsqlite3TreeViewExprList(pView, pFarg, pWin!=0, 0); } #ifndef SQLITE_OMIT_WINDOWFUNC if( pWin ){ - sqlite3TreeViewWindow(pView, pWin, 0); + tdsqlite3TreeViewWindow(pView, pWin, 0); } #endif break; } #ifndef SQLITE_OMIT_SUBQUERY case TK_EXISTS: { - sqlite3TreeViewLine(pView, "EXISTS-expr flags=0x%x", pExpr->flags); - sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); + tdsqlite3TreeViewLine(pView, "EXISTS-expr flags=0x%x", pExpr->flags); + tdsqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); break; } case TK_SELECT: { - sqlite3TreeViewLine(pView, "SELECT-expr flags=0x%x", pExpr->flags); - sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); + tdsqlite3TreeViewLine(pView, "SELECT-expr flags=0x%x", pExpr->flags); + tdsqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); break; } case TK_IN: { - sqlite3TreeViewLine(pView, "IN flags=0x%x", pExpr->flags); - sqlite3TreeViewExpr(pView, pExpr->pLeft, 1); + tdsqlite3TreeViewLine(pView, "IN flags=0x%x", pExpr->flags); + tdsqlite3TreeViewExpr(pView, pExpr->pLeft, 1); if( ExprHasProperty(pExpr, EP_xIsSelect) ){ - sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); + tdsqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); }else{ - sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0); + tdsqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0); } break; } @@ -35018,10 +35018,10 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m Expr *pX = pExpr->pLeft; Expr *pY = pExpr->x.pList->a[0].pExpr; Expr *pZ = pExpr->x.pList->a[1].pExpr; - sqlite3TreeViewLine(pView, "BETWEEN"); - sqlite3TreeViewExpr(pView, pX, 1); - sqlite3TreeViewExpr(pView, pY, 1); - sqlite3TreeViewExpr(pView, pZ, 0); + tdsqlite3TreeViewLine(pView, "BETWEEN"); + tdsqlite3TreeViewExpr(pView, pX, 1); + tdsqlite3TreeViewExpr(pView, pY, 1); + tdsqlite3TreeViewExpr(pView, pZ, 0); break; } case TK_TRIGGER: { @@ -35032,14 +35032,14 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m ** is set to the column of the pseudo-table to read, or to -1 to ** read the rowid field. */ - sqlite3TreeViewLine(pView, "%s(%d)", + tdsqlite3TreeViewLine(pView, "%s(%d)", pExpr->iTable ? "NEW" : "OLD", pExpr->iColumn); break; } case TK_CASE: { - sqlite3TreeViewLine(pView, "CASE"); - sqlite3TreeViewExpr(pView, pExpr->pLeft, 1); - sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0); + tdsqlite3TreeViewLine(pView, "CASE"); + tdsqlite3TreeViewExpr(pView, pExpr->pLeft, 1); + tdsqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0); break; } #ifndef SQLITE_OMIT_TRIGGER @@ -35051,72 +35051,72 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m case OE_Fail: zType = "fail"; break; case OE_Ignore: zType = "ignore"; break; } - sqlite3TreeViewLine(pView, "RAISE %s(%Q)", zType, pExpr->u.zToken); + tdsqlite3TreeViewLine(pView, "RAISE %s(%Q)", zType, pExpr->u.zToken); break; } #endif case TK_MATCH: { - sqlite3TreeViewLine(pView, "MATCH {%d:%d}%s", + tdsqlite3TreeViewLine(pView, "MATCH {%d:%d}%s", pExpr->iTable, pExpr->iColumn, zFlgs); - sqlite3TreeViewExpr(pView, pExpr->pRight, 0); + tdsqlite3TreeViewExpr(pView, pExpr->pRight, 0); break; } case TK_VECTOR: { - char *z = sqlite3_mprintf("VECTOR%s",zFlgs); - sqlite3TreeViewBareExprList(pView, pExpr->x.pList, z); - sqlite3_free(z); + char *z = tdsqlite3_mprintf("VECTOR%s",zFlgs); + tdsqlite3TreeViewBareExprList(pView, pExpr->x.pList, z); + tdsqlite3_free(z); break; } case TK_SELECT_COLUMN: { - sqlite3TreeViewLine(pView, "SELECT-COLUMN %d", pExpr->iColumn); - sqlite3TreeViewSelect(pView, pExpr->pLeft->x.pSelect, 0); + tdsqlite3TreeViewLine(pView, "SELECT-COLUMN %d", pExpr->iColumn); + tdsqlite3TreeViewSelect(pView, pExpr->pLeft->x.pSelect, 0); break; } case TK_IF_NULL_ROW: { - sqlite3TreeViewLine(pView, "IF-NULL-ROW %d", pExpr->iTable); - sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); + tdsqlite3TreeViewLine(pView, "IF-NULL-ROW %d", pExpr->iTable); + tdsqlite3TreeViewExpr(pView, pExpr->pLeft, 0); break; } default: { - sqlite3TreeViewLine(pView, "op=%d", pExpr->op); + tdsqlite3TreeViewLine(pView, "op=%d", pExpr->op); break; } } if( zBinOp ){ - sqlite3TreeViewLine(pView, "%s%s", zBinOp, zFlgs); - sqlite3TreeViewExpr(pView, pExpr->pLeft, 1); - sqlite3TreeViewExpr(pView, pExpr->pRight, 0); + tdsqlite3TreeViewLine(pView, "%s%s", zBinOp, zFlgs); + tdsqlite3TreeViewExpr(pView, pExpr->pLeft, 1); + tdsqlite3TreeViewExpr(pView, pExpr->pRight, 0); }else if( zUniOp ){ - sqlite3TreeViewLine(pView, "%s%s", zUniOp, zFlgs); - sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); + tdsqlite3TreeViewLine(pView, "%s%s", zUniOp, zFlgs); + tdsqlite3TreeViewExpr(pView, pExpr->pLeft, 0); } - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewPop(pView); } /* ** Generate a human-readable explanation of an expression list. */ -SQLITE_PRIVATE void sqlite3TreeViewBareExprList( +SQLITE_PRIVATE void tdsqlite3TreeViewBareExprList( TreeView *pView, const ExprList *pList, const char *zLabel ){ if( zLabel==0 || zLabel[0]==0 ) zLabel = "LIST"; if( pList==0 ){ - sqlite3TreeViewLine(pView, "%s (empty)", zLabel); + tdsqlite3TreeViewLine(pView, "%s (empty)", zLabel); }else{ int i; - sqlite3TreeViewLine(pView, "%s", zLabel); + tdsqlite3TreeViewLine(pView, "%s", zLabel); for(i=0; inExpr; i++){ int j = pList->a[i].u.x.iOrderByCol; char *zName = pList->a[i].zEName; int moreToFollow = inExpr - 1; if( pList->a[i].eEName!=ENAME_NAME ) zName = 0; if( j || zName ){ - sqlite3TreeViewPush(pView, moreToFollow); + tdsqlite3TreeViewPush(pView, moreToFollow); moreToFollow = 0; - sqlite3TreeViewLine(pView, 0); + tdsqlite3TreeViewLine(pView, 0); if( zName ){ fprintf(stdout, "AS %s ", zName); } @@ -35126,22 +35126,22 @@ SQLITE_PRIVATE void sqlite3TreeViewBareExprList( fprintf(stdout, "\n"); fflush(stdout); } - sqlite3TreeViewExpr(pView, pList->a[i].pExpr, moreToFollow); + tdsqlite3TreeViewExpr(pView, pList->a[i].pExpr, moreToFollow); if( j || zName ){ - sqlite3TreeViewPop(pView); + tdsqlite3TreeViewPop(pView); } } } } -SQLITE_PRIVATE void sqlite3TreeViewExprList( +SQLITE_PRIVATE void tdsqlite3TreeViewExprList( TreeView *pView, const ExprList *pList, u8 moreToFollow, const char *zLabel ){ - pView = sqlite3TreeViewPush(pView, moreToFollow); - sqlite3TreeViewBareExprList(pView, pList, zLabel); - sqlite3TreeViewPop(pView); + pView = tdsqlite3TreeViewPush(pView, moreToFollow); + tdsqlite3TreeViewBareExprList(pView, pList, zLabel); + tdsqlite3TreeViewPop(pView); } #endif /* SQLITE_DEBUG */ @@ -35171,16 +35171,16 @@ SQLITE_PRIVATE void sqlite3TreeViewExprList( /* All threads share a single random number generator. ** This structure is the current state of the generator. */ -static SQLITE_WSD struct sqlite3PrngType { +static SQLITE_WSD struct tdsqlite3PrngType { unsigned char isInit; /* True if initialized */ unsigned char i, j; /* State variables */ unsigned char s[256]; /* State variables */ -} sqlite3Prng; +} tdsqlite3Prng; /* ** Return N random bytes. */ -SQLITE_API void sqlite3_randomness(int N, void *pBuf){ +SQLITE_API void tdsqlite3_randomness(int N, void *pBuf){ unsigned char t; unsigned char *zBuf = pBuf; @@ -35188,31 +35188,31 @@ SQLITE_API void sqlite3_randomness(int N, void *pBuf){ ** state vector. If writable static data is unsupported on the target, ** we have to locate the state vector at run-time. In the more common ** case where writable static data is supported, wsdPrng can refer directly - ** to the "sqlite3Prng" state vector declared above. + ** to the "tdsqlite3Prng" state vector declared above. */ #ifdef SQLITE_OMIT_WSD - struct sqlite3PrngType *p = &GLOBAL(struct sqlite3PrngType, sqlite3Prng); + struct tdsqlite3PrngType *p = &GLOBAL(struct tdsqlite3PrngType, tdsqlite3Prng); # define wsdPrng p[0] #else -# define wsdPrng sqlite3Prng +# define wsdPrng tdsqlite3Prng #endif #if SQLITE_THREADSAFE - sqlite3_mutex *mutex; + tdsqlite3_mutex *mutex; #endif #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return; + if( tdsqlite3_initialize() ) return; #endif #if SQLITE_THREADSAFE - mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG); + mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG); #endif - sqlite3_mutex_enter(mutex); + tdsqlite3_mutex_enter(mutex); if( N<=0 || pBuf==0 ){ wsdPrng.isInit = 0; - sqlite3_mutex_leave(mutex); + tdsqlite3_mutex_leave(mutex); return; } @@ -35230,7 +35230,7 @@ SQLITE_API void sqlite3_randomness(int N, void *pBuf){ char k[256]; wsdPrng.j = 0; wsdPrng.i = 0; - sqlite3OsRandomness(sqlite3_vfs_find(0), 256, k); + tdsqlite3OsRandomness(tdsqlite3_vfs_find(0), 256, k); for(i=0; i<256; i++){ wsdPrng.s[i] = (u8)i; } @@ -35253,7 +35253,7 @@ SQLITE_API void sqlite3_randomness(int N, void *pBuf){ t += wsdPrng.s[wsdPrng.i]; *(zBuf++) = wsdPrng.s[t]; }while( --N ); - sqlite3_mutex_leave(mutex); + tdsqlite3_mutex_leave(mutex); } #ifndef SQLITE_UNTESTABLE @@ -35263,22 +35263,22 @@ SQLITE_API void sqlite3_randomness(int N, void *pBuf){ ** to reset the PRNG to its initial state. These routines accomplish ** those tasks. ** -** The sqlite3_test_control() interface calls these routines to +** The tdsqlite3_test_control() interface calls these routines to ** control the PRNG. */ -static SQLITE_WSD struct sqlite3PrngType sqlite3SavedPrng; -SQLITE_PRIVATE void sqlite3PrngSaveState(void){ +static SQLITE_WSD struct tdsqlite3PrngType tdsqlite3SavedPrng; +SQLITE_PRIVATE void tdsqlite3PrngSaveState(void){ memcpy( - &GLOBAL(struct sqlite3PrngType, sqlite3SavedPrng), - &GLOBAL(struct sqlite3PrngType, sqlite3Prng), - sizeof(sqlite3Prng) + &GLOBAL(struct tdsqlite3PrngType, tdsqlite3SavedPrng), + &GLOBAL(struct tdsqlite3PrngType, tdsqlite3Prng), + sizeof(tdsqlite3Prng) ); } -SQLITE_PRIVATE void sqlite3PrngRestoreState(void){ +SQLITE_PRIVATE void tdsqlite3PrngRestoreState(void){ memcpy( - &GLOBAL(struct sqlite3PrngType, sqlite3Prng), - &GLOBAL(struct sqlite3PrngType, sqlite3SavedPrng), - sizeof(sqlite3Prng) + &GLOBAL(struct tdsqlite3PrngType, tdsqlite3Prng), + &GLOBAL(struct tdsqlite3PrngType, tdsqlite3SavedPrng), + sizeof(tdsqlite3Prng) ); } #endif /* SQLITE_UNTESTABLE */ @@ -35300,13 +35300,13 @@ SQLITE_PRIVATE void sqlite3PrngRestoreState(void){ ** This file presents a simple cross-platform threading interface for ** use internally by SQLite. ** -** A "thread" can be created using sqlite3ThreadCreate(). This thread +** A "thread" can be created using tdsqlite3ThreadCreate(). This thread ** runs independently of its creator until it is joined using -** sqlite3ThreadJoin(), at which point it terminates. +** tdsqlite3ThreadJoin(), at which point it terminates. ** ** Threads do not have to be real. It could be that the work of the -** "thread" is done by the main thread at either the sqlite3ThreadCreate() -** or sqlite3ThreadJoin() call. This is, in fact, what happens in +** "thread" is done by the main thread at either the tdsqlite3ThreadCreate() +** or tdsqlite3ThreadJoin() call. This is, in fact, what happens in ** single threaded systems. Nothing in SQLite requires multiple threads. ** This interface exists so that applications that want to take advantage ** of multiple cores can do so, while also allowing applications to stay @@ -35335,7 +35335,7 @@ struct SQLiteThread { }; /* Create a new thread */ -SQLITE_PRIVATE int sqlite3ThreadCreate( +SQLITE_PRIVATE int tdsqlite3ThreadCreate( SQLiteThread **ppThread, /* OUT: Write the thread object here */ void *(*xTask)(void*), /* Routine to run in a separate thread */ void *pIn /* Argument passed into xTask() */ @@ -35346,10 +35346,10 @@ SQLITE_PRIVATE int sqlite3ThreadCreate( assert( ppThread!=0 ); assert( xTask!=0 ); /* This routine is never used in single-threaded mode */ - assert( sqlite3GlobalConfig.bCoreMutex!=0 ); + assert( tdsqlite3GlobalConfig.bCoreMutex!=0 ); *ppThread = 0; - p = sqlite3Malloc(sizeof(*p)); + p = tdsqlite3Malloc(sizeof(*p)); if( p==0 ) return SQLITE_NOMEM_BKPT; memset(p, 0, sizeof(*p)); p->xTask = xTask; @@ -35358,7 +35358,7 @@ SQLITE_PRIVATE int sqlite3ThreadCreate( ** function that returns SQLITE_ERROR when passed the argument 200, that ** forces worker threads to run sequentially and deterministically ** for testing purposes. */ - if( sqlite3FaultSim(200) ){ + if( tdsqlite3FaultSim(200) ){ rc = 1; }else{ rc = pthread_create(&p->tid, 0, xTask, pIn); @@ -35372,7 +35372,7 @@ SQLITE_PRIVATE int sqlite3ThreadCreate( } /* Get the results of the thread */ -SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ +SQLITE_PRIVATE int tdsqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ int rc; assert( ppOut!=0 ); @@ -35383,7 +35383,7 @@ SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ }else{ rc = pthread_join(p->tid, ppOut) ? SQLITE_ERROR : SQLITE_OK; } - sqlite3_free(p); + tdsqlite3_free(p); return rc; } @@ -35407,7 +35407,7 @@ struct SQLiteThread { }; /* Thread procedure Win32 compatibility shim */ -static unsigned __stdcall sqlite3ThreadProc( +static unsigned __stdcall tdsqlite3ThreadProc( void *pArg /* IN: Pointer to the SQLiteThread structure */ ){ SQLiteThread *p = (SQLiteThread *)pArg; @@ -35430,7 +35430,7 @@ static unsigned __stdcall sqlite3ThreadProc( } /* Create a new thread */ -SQLITE_PRIVATE int sqlite3ThreadCreate( +SQLITE_PRIVATE int tdsqlite3ThreadCreate( SQLiteThread **ppThread, /* OUT: Write the thread object here */ void *(*xTask)(void*), /* Routine to run in a separate thread */ void *pIn /* Argument passed into xTask() */ @@ -35440,19 +35440,19 @@ SQLITE_PRIVATE int sqlite3ThreadCreate( assert( ppThread!=0 ); assert( xTask!=0 ); *ppThread = 0; - p = sqlite3Malloc(sizeof(*p)); + p = tdsqlite3Malloc(sizeof(*p)); if( p==0 ) return SQLITE_NOMEM_BKPT; /* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a ** function that returns SQLITE_ERROR when passed the argument 200, that ** forces worker threads to run sequentially and deterministically - ** (via the sqlite3FaultSim() term of the conditional) for testing + ** (via the tdsqlite3FaultSim() term of the conditional) for testing ** purposes. */ - if( sqlite3GlobalConfig.bCoreMutex==0 || sqlite3FaultSim(200) ){ + if( tdsqlite3GlobalConfig.bCoreMutex==0 || tdsqlite3FaultSim(200) ){ memset(p, 0, sizeof(*p)); }else{ p->xTask = xTask; p->pIn = pIn; - p->tid = (void*)_beginthreadex(0, 0, sqlite3ThreadProc, p, 0, &p->id); + p->tid = (void*)_beginthreadex(0, 0, tdsqlite3ThreadProc, p, 0, &p->id); if( p->tid==0 ){ memset(p, 0, sizeof(*p)); } @@ -35465,10 +35465,10 @@ SQLITE_PRIVATE int sqlite3ThreadCreate( return SQLITE_OK; } -SQLITE_PRIVATE DWORD sqlite3Win32Wait(HANDLE hObject); /* os_win.c */ +SQLITE_PRIVATE DWORD tdsqlite3Win32Wait(HANDLE hObject); /* os_win.c */ /* Get the results of the thread */ -SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ +SQLITE_PRIVATE int tdsqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ DWORD rc; BOOL bRc; @@ -35480,13 +35480,13 @@ SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ assert( p->tid==0 ); }else{ assert( p->id!=0 && p->id!=GetCurrentThreadId() ); - rc = sqlite3Win32Wait((HANDLE)p->tid); + rc = tdsqlite3Win32Wait((HANDLE)p->tid); assert( rc!=WAIT_IO_COMPLETION ); bRc = CloseHandle((HANDLE)p->tid); assert( bRc ); } if( rc==WAIT_OBJECT_0 ) *ppOut = p->pResult; - sqlite3_free(p); + tdsqlite3_free(p); return (rc==WAIT_OBJECT_0) ? SQLITE_OK : SQLITE_ERROR; } @@ -35510,7 +35510,7 @@ struct SQLiteThread { }; /* Create a new thread */ -SQLITE_PRIVATE int sqlite3ThreadCreate( +SQLITE_PRIVATE int tdsqlite3ThreadCreate( SQLiteThread **ppThread, /* OUT: Write the thread object here */ void *(*xTask)(void*), /* Routine to run in a separate thread */ void *pIn /* Argument passed into xTask() */ @@ -35520,7 +35520,7 @@ SQLITE_PRIVATE int sqlite3ThreadCreate( assert( ppThread!=0 ); assert( xTask!=0 ); *ppThread = 0; - p = sqlite3Malloc(sizeof(*p)); + p = tdsqlite3Malloc(sizeof(*p)); if( p==0 ) return SQLITE_NOMEM_BKPT; if( (SQLITE_PTR_TO_INT(p)/17)&1 ){ p->xTask = xTask; @@ -35534,7 +35534,7 @@ SQLITE_PRIVATE int sqlite3ThreadCreate( } /* Get the results of the thread */ -SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ +SQLITE_PRIVATE int tdsqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ assert( ppOut!=0 ); if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT; @@ -35543,13 +35543,13 @@ SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ }else{ *ppOut = p->pResult; } - sqlite3_free(p); + tdsqlite3_free(p); #if defined(SQLITE_TEST) { - void *pTstAlloc = sqlite3Malloc(10); + void *pTstAlloc = tdsqlite3Malloc(10); if (!pTstAlloc) return SQLITE_NOMEM_BKPT; - sqlite3_free(pTstAlloc); + tdsqlite3_free(pTstAlloc); } #endif @@ -35606,14 +35606,14 @@ SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ ** The following constant value is used by the SQLITE_BIGENDIAN and ** SQLITE_LITTLEENDIAN macros. */ -SQLITE_PRIVATE const int sqlite3one = 1; +SQLITE_PRIVATE const int tdsqlite3one = 1; #endif /* SQLITE_AMALGAMATION && SQLITE_BYTEORDER==0 */ /* ** This lookup table is used to help decode the first byte of ** a multi-byte UTF8 character. */ -static const unsigned char sqlite3Utf8Trans1[] = { +static const unsigned char tdsqlite3Utf8Trans1[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -35719,7 +35719,7 @@ static const unsigned char sqlite3Utf8Trans1[] = { #define READ_UTF8(zIn, zTerm, c) \ c = *(zIn++); \ if( c>=0xc0 ){ \ - c = sqlite3Utf8Trans1[c-0xc0]; \ + c = tdsqlite3Utf8Trans1[c-0xc0]; \ while( zIn!=zTerm && (*zIn & 0xc0)==0x80 ){ \ c = (c<<6) + (0x3f & *(zIn++)); \ } \ @@ -35727,7 +35727,7 @@ static const unsigned char sqlite3Utf8Trans1[] = { || (c&0xFFFFF800)==0xD800 \ || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } \ } -SQLITE_PRIVATE u32 sqlite3Utf8Read( +SQLITE_PRIVATE u32 tdsqlite3Utf8Read( const unsigned char **pz /* Pointer to string from which to read char */ ){ unsigned int c; @@ -35737,7 +35737,7 @@ SQLITE_PRIVATE u32 sqlite3Utf8Read( */ c = *((*pz)++); if( c>=0xc0 ){ - c = sqlite3Utf8Trans1[c-0xc0]; + c = tdsqlite3Utf8Trans1[c-0xc0]; while( (*(*pz) & 0xc0)==0x80 ){ c = (c<<6) + (0x3f & *((*pz)++)); } @@ -35753,7 +35753,7 @@ SQLITE_PRIVATE u32 sqlite3Utf8Read( /* ** If the TRANSLATE_TRACE macro is defined, the value of each Mem is -** printed on stderr on the way into and out of sqlite3VdbeMemTranslate(). +** printed on stderr on the way into and out of tdsqlite3VdbeMemTranslate(). */ /* #define TRANSLATE_TRACE 1 */ @@ -35763,15 +35763,15 @@ SQLITE_PRIVATE u32 sqlite3Utf8Read( ** desiredEnc. It is an error if the string is already of the desired ** encoding, or if *pMem does not contain a string value. */ -SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){ - sqlite3_int64 len; /* Maximum length of output string in bytes */ +SQLITE_PRIVATE SQLITE_NOINLINE int tdsqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){ + tdsqlite3_int64 len; /* Maximum length of output string in bytes */ unsigned char *zOut; /* Output buffer */ unsigned char *zIn; /* Input iterator */ unsigned char *zTerm; /* End of input */ unsigned char *z; /* Output iterator */ unsigned int c; - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); assert( pMem->flags&MEM_Str ); assert( pMem->enc!=desiredEnc ); assert( pMem->enc!=0 ); @@ -35781,9 +35781,9 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desired { StrAccum acc; char zBuf[1000]; - sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); - sqlite3VdbeMemPrettyPrint(pMem, &acc); - fprintf(stderr, "INPUT: %s\n", sqlite3StrAccumFinish(&acc)); + tdsqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); + tdsqlite3VdbeMemPrettyPrint(pMem, &acc); + fprintf(stderr, "INPUT: %s\n", tdsqlite3StrAccumFinish(&acc)); } #endif @@ -35794,7 +35794,7 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desired if( pMem->enc!=SQLITE_UTF8 && desiredEnc!=SQLITE_UTF8 ){ u8 temp; int rc; - rc = sqlite3VdbeMemMakeWriteable(pMem); + rc = tdsqlite3VdbeMemMakeWriteable(pMem); if( rc!=SQLITE_OK ){ assert( rc==SQLITE_NOMEM ); return SQLITE_NOMEM_BKPT; @@ -35819,25 +35819,25 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desired ** nul-terminator. */ pMem->n &= ~1; - len = 2 * (sqlite3_int64)pMem->n + 1; + len = 2 * (tdsqlite3_int64)pMem->n + 1; }else{ /* When converting from UTF-8 to UTF-16 the maximum growth is caused ** when a 1-byte UTF-8 character is translated into a 2-byte UTF-16 ** character. Two bytes are required in the output buffer for the ** nul-terminator. */ - len = 2 * (sqlite3_int64)pMem->n + 2; + len = 2 * (tdsqlite3_int64)pMem->n + 2; } /* Set zIn to point at the start of the input buffer and zTerm to point 1 ** byte past the end. ** ** Variable zOut is set to point at the output buffer, space obtained - ** from sqlite3_malloc(). + ** from tdsqlite3_malloc(). */ zIn = (u8*)pMem->z; zTerm = &zIn[pMem->n]; - zOut = sqlite3DbMallocRaw(pMem->db, len); + zOut = tdsqlite3DbMallocRaw(pMem->db, len); if( !zOut ){ return SQLITE_NOMEM_BKPT; } @@ -35881,21 +35881,21 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desired assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len ); c = pMem->flags; - sqlite3VdbeMemRelease(pMem); + tdsqlite3VdbeMemRelease(pMem); pMem->flags = MEM_Str|MEM_Term|(c&(MEM_AffMask|MEM_Subtype)); pMem->enc = desiredEnc; pMem->z = (char*)zOut; pMem->zMalloc = pMem->z; - pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->z); + pMem->szMalloc = tdsqlite3DbMallocSize(pMem->db, pMem->z); translate_out: #if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG) { StrAccum acc; char zBuf[1000]; - sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); - sqlite3VdbeMemPrettyPrint(pMem, &acc); - fprintf(stderr, "OUTPUT: %s\n", sqlite3StrAccumFinish(&acc)); + tdsqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); + tdsqlite3VdbeMemPrettyPrint(pMem, &acc); + fprintf(stderr, "OUTPUT: %s\n", tdsqlite3StrAccumFinish(&acc)); } #endif return SQLITE_OK; @@ -35912,7 +35912,7 @@ translate_out: ** The allocation (static, dynamic etc.) and encoding of the Mem may be ** changed by this function. */ -SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem){ +SQLITE_PRIVATE int tdsqlite3VdbeMemHandleBom(Mem *pMem){ int rc = SQLITE_OK; u8 bom = 0; @@ -35929,7 +35929,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem){ } if( bom ){ - rc = sqlite3VdbeMemMakeWriteable(pMem); + rc = tdsqlite3VdbeMemMakeWriteable(pMem); if( rc==SQLITE_OK ){ pMem->n -= 2; memmove(pMem->z, &pMem->z[2], pMem->n); @@ -35950,7 +35950,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem){ ** number of unicode characters in the first nByte of pZ (or up to ** the first 0x00, whichever comes first). */ -SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *zIn, int nByte){ +SQLITE_PRIVATE int tdsqlite3Utf8CharLen(const char *zIn, int nByte){ int r = 0; const u8 *z = (const u8*)zIn; const u8 *zTerm; @@ -35980,13 +35980,13 @@ SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *zIn, int nByte){ ** The translation is done in-place and aborted if the output ** overruns the input. */ -SQLITE_PRIVATE int sqlite3Utf8To8(unsigned char *zIn){ +SQLITE_PRIVATE int tdsqlite3Utf8To8(unsigned char *zIn){ unsigned char *zOut = zIn; unsigned char *zStart = zIn; u32 c; while( zIn[0] && zOut<=zIn ){ - c = sqlite3Utf8Read((const u8**)&zIn); + c = tdsqlite3Utf8Read((const u8**)&zIn); if( c!=0xfffd ){ WRITE_UTF8(zOut, c); } @@ -35999,19 +35999,19 @@ SQLITE_PRIVATE int sqlite3Utf8To8(unsigned char *zIn){ #ifndef SQLITE_OMIT_UTF16 /* ** Convert a UTF-16 string in the native encoding into a UTF-8 string. -** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must +** Memory to hold the UTF-8 string is obtained from tdsqlite3_malloc and must ** be freed by the calling function. ** ** NULL is returned if there is an allocation error. */ -SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte, u8 enc){ +SQLITE_PRIVATE char *tdsqlite3Utf16to8(tdsqlite3 *db, const void *z, int nByte, u8 enc){ Mem m; memset(&m, 0, sizeof(m)); m.db = db; - sqlite3VdbeMemSetStr(&m, z, nByte, enc, SQLITE_STATIC); - sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8); + tdsqlite3VdbeMemSetStr(&m, z, nByte, enc, SQLITE_STATIC); + tdsqlite3VdbeChangeEncoding(&m, SQLITE_UTF8); if( db->mallocFailed ){ - sqlite3VdbeMemRelease(&m); + tdsqlite3VdbeMemRelease(&m); m.z = 0; } assert( (m.flags & MEM_Term)!=0 || db->mallocFailed ); @@ -36025,7 +36025,7 @@ SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte, u8 e ** Return the number of bytes in the first nChar unicode characters ** in pZ. nChar must be non-negative. */ -SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nChar){ +SQLITE_PRIVATE int tdsqlite3Utf16ByteLen(const void *zIn, int nChar){ int c; unsigned char const *z = zIn; int n = 0; @@ -36050,7 +36050,7 @@ SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nChar){ ** It checks that the primitives for serializing and deserializing ** characters in each encoding are inverses of each other. */ -SQLITE_PRIVATE void sqlite3UtfSelfTest(void){ +SQLITE_PRIVATE void tdsqlite3UtfSelfTest(void){ unsigned int i, t; unsigned char zBuf[20]; unsigned char *z; @@ -36064,7 +36064,7 @@ SQLITE_PRIVATE void sqlite3UtfSelfTest(void){ assert( n>0 && n<=4 ); z[0] = 0; z = zBuf; - c = sqlite3Utf8Read((const u8**)&z); + c = tdsqlite3Utf8Read((const u8**)&z); t = i; if( i>=0xD800 && i<=0xDFFF ) t = 0xFFFD; if( (i&0xFFFFFFFE)==0xFFFE ) t = 0xFFFD; @@ -36128,34 +36128,34 @@ SQLITE_PRIVATE void sqlite3UtfSelfTest(void){ ** Routine needed to support the testcase() macro. */ #ifdef SQLITE_COVERAGE_TEST -SQLITE_PRIVATE void sqlite3Coverage(int x){ +SQLITE_PRIVATE void tdsqlite3Coverage(int x){ static unsigned dummy = 0; dummy += (unsigned)x; } #endif /* -** Calls to sqlite3FaultSim() are used to simulate a failure during testing, +** Calls to tdsqlite3FaultSim() are used to simulate a failure during testing, ** or to bypass normal error detection during testing in order to let ** execute proceed futher downstream. ** -** In deployment, sqlite3FaultSim() *always* return SQLITE_OK (0). The -** sqlite3FaultSim() function only returns non-zero during testing. +** In deployment, tdsqlite3FaultSim() *always* return SQLITE_OK (0). The +** tdsqlite3FaultSim() function only returns non-zero during testing. ** ** During testing, if the test harness has set a fault-sim callback using -** a call to sqlite3_test_control(SQLITE_TESTCTRL_FAULT_INSTALL), then -** each call to sqlite3FaultSim() is relayed to that application-supplied +** a call to tdsqlite3_test_control(SQLITE_TESTCTRL_FAULT_INSTALL), then +** each call to tdsqlite3FaultSim() is relayed to that application-supplied ** callback and the integer return value form the application-supplied -** callback is returned by sqlite3FaultSim(). +** callback is returned by tdsqlite3FaultSim(). ** -** The integer argument to sqlite3FaultSim() is a code to identify which -** sqlite3FaultSim() instance is being invoked. Each call to sqlite3FaultSim() +** The integer argument to tdsqlite3FaultSim() is a code to identify which +** tdsqlite3FaultSim() instance is being invoked. Each call to tdsqlite3FaultSim() ** should have a unique code. To prevent legacy testing applications from ** breaking, the codes should not be changed or reused. */ #ifndef SQLITE_UNTESTABLE -SQLITE_PRIVATE int sqlite3FaultSim(int iTest){ - int (*xCallback)(int) = sqlite3GlobalConfig.xTestCallback; +SQLITE_PRIVATE int tdsqlite3FaultSim(int iTest){ + int (*xCallback)(int) = tdsqlite3GlobalConfig.xTestCallback; return xCallback ? xCallback(iTest) : SQLITE_OK; } #endif @@ -36164,7 +36164,7 @@ SQLITE_PRIVATE int sqlite3FaultSim(int iTest){ /* ** Return true if the floating point value is Not a Number (NaN). */ -SQLITE_PRIVATE int sqlite3IsNaN(double x){ +SQLITE_PRIVATE int tdsqlite3IsNaN(double x){ u64 y; memcpy(&y,&x,sizeof(y)); return IsNaN(y); @@ -36179,7 +36179,7 @@ SQLITE_PRIVATE int sqlite3IsNaN(double x){ ** than the actual length of the string. For very long strings (greater ** than 1GiB) the value returned might be less than the true string length. */ -SQLITE_PRIVATE int sqlite3Strlen30(const char *z){ +SQLITE_PRIVATE int tdsqlite3Strlen30(const char *z){ if( z==0 ) return 0; return 0x3fffffff & (int)strlen(z); } @@ -36191,41 +36191,41 @@ SQLITE_PRIVATE int sqlite3Strlen30(const char *z){ ** The column type is an extra string stored after the zero-terminator on ** the column name if and only if the COLFLAG_HASTYPE flag is set. */ -SQLITE_PRIVATE char *sqlite3ColumnType(Column *pCol, char *zDflt){ +SQLITE_PRIVATE char *tdsqlite3ColumnType(Column *pCol, char *zDflt){ if( (pCol->colFlags & COLFLAG_HASTYPE)==0 ) return zDflt; return pCol->zName + strlen(pCol->zName) + 1; } /* -** Helper function for sqlite3Error() - called rarely. Broken out into +** Helper function for tdsqlite3Error() - called rarely. Broken out into ** a separate routine to avoid unnecessary register saves on entry to -** sqlite3Error(). +** tdsqlite3Error(). */ -static SQLITE_NOINLINE void sqlite3ErrorFinish(sqlite3 *db, int err_code){ - if( db->pErr ) sqlite3ValueSetNull(db->pErr); - sqlite3SystemError(db, err_code); +static SQLITE_NOINLINE void tdsqlite3ErrorFinish(tdsqlite3 *db, int err_code){ + if( db->pErr ) tdsqlite3ValueSetNull(db->pErr); + tdsqlite3SystemError(db, err_code); } /* ** Set the current error code to err_code and clear any prior error message. -** Also set iSysErrno (by calling sqlite3System) if the err_code indicates +** Also set iSysErrno (by calling tdsqlite3System) if the err_code indicates ** that would be appropriate. */ -SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){ +SQLITE_PRIVATE void tdsqlite3Error(tdsqlite3 *db, int err_code){ assert( db!=0 ); db->errCode = err_code; - if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code); + if( err_code || db->pErr ) tdsqlite3ErrorFinish(db, err_code); } /* ** Load the sqlite3.iSysErrno field if that is an appropriate thing ** to do based on the SQLite error code in rc. */ -SQLITE_PRIVATE void sqlite3SystemError(sqlite3 *db, int rc){ +SQLITE_PRIVATE void tdsqlite3SystemError(tdsqlite3 *db, int rc){ if( rc==SQLITE_IOERR_NOMEM ) return; rc &= 0xff; if( rc==SQLITE_CANTOPEN || rc==SQLITE_IOERR ){ - db->iSysErrno = sqlite3OsGetLastError(db->pVfs); + db->iSysErrno = tdsqlite3OsGetLastError(db->pVfs); } } @@ -36246,23 +36246,23 @@ SQLITE_PRIVATE void sqlite3SystemError(sqlite3 *db, int rc){ ** zFormat and any string tokens that follow it are assumed to be ** encoded in UTF-8. ** -** To clear the most recent error for sqlite handle "db", sqlite3Error +** To clear the most recent error for sqlite handle "db", tdsqlite3Error ** should be called with err_code set to SQLITE_OK and zFormat set ** to NULL. */ -SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3 *db, int err_code, const char *zFormat, ...){ +SQLITE_PRIVATE void tdsqlite3ErrorWithMsg(tdsqlite3 *db, int err_code, const char *zFormat, ...){ assert( db!=0 ); db->errCode = err_code; - sqlite3SystemError(db, err_code); + tdsqlite3SystemError(db, err_code); if( zFormat==0 ){ - sqlite3Error(db, err_code); - }else if( db->pErr || (db->pErr = sqlite3ValueNew(db))!=0 ){ + tdsqlite3Error(db, err_code); + }else if( db->pErr || (db->pErr = tdsqlite3ValueNew(db))!=0 ){ char *z; va_list ap; va_start(ap, zFormat); - z = sqlite3VMPrintf(db, zFormat, ap); + z = tdsqlite3VMPrintf(db, zFormat, ap); va_end(ap); - sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC); + tdsqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC); } } @@ -36277,24 +36277,24 @@ SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3 *db, int err_code, const char *z ** %S Insert the first element of a SrcList ** ** This function should be used to report any error that occurs while -** compiling an SQL statement (i.e. within sqlite3_prepare()). The -** last thing the sqlite3_prepare() function does is copy the error -** stored by this function into the database handle using sqlite3Error(). -** Functions sqlite3Error() or sqlite3ErrorWithMsg() should be used -** during statement execution (sqlite3_step() etc.). +** compiling an SQL statement (i.e. within tdsqlite3_prepare()). The +** last thing the tdsqlite3_prepare() function does is copy the error +** stored by this function into the database handle using tdsqlite3Error(). +** Functions tdsqlite3Error() or tdsqlite3ErrorWithMsg() should be used +** during statement execution (tdsqlite3_step() etc.). */ -SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){ +SQLITE_PRIVATE void tdsqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){ char *zMsg; va_list ap; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; va_start(ap, zFormat); - zMsg = sqlite3VMPrintf(db, zFormat, ap); + zMsg = tdsqlite3VMPrintf(db, zFormat, ap); va_end(ap); if( db->suppressErr ){ - sqlite3DbFree(db, zMsg); + tdsqlite3DbFree(db, zMsg); }else{ pParse->nErr++; - sqlite3DbFree(db, pParse->zErrMsg); + tdsqlite3DbFree(db, pParse->zErrMsg); pParse->zErrMsg = zMsg; pParse->rc = SQLITE_ERROR; pParse->pWith = 0; @@ -36306,7 +36306,7 @@ SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){ ** error code errCode to that parser if the parser has not already ** encountered some other kind of error. */ -SQLITE_PRIVATE int sqlite3ErrorToParser(sqlite3 *db, int errCode){ +SQLITE_PRIVATE int tdsqlite3ErrorToParser(tdsqlite3 *db, int errCode){ Parse *pParse; if( db==0 || (pParse = db->pParse)==0 ) return errCode; pParse->rc = errCode; @@ -36331,12 +36331,12 @@ SQLITE_PRIVATE int sqlite3ErrorToParser(sqlite3 *db, int errCode){ ** brackets from around identifiers. For example: "[a-b-c]" becomes ** "a-b-c". */ -SQLITE_PRIVATE void sqlite3Dequote(char *z){ +SQLITE_PRIVATE void tdsqlite3Dequote(char *z){ char quote; int i, j; if( z==0 ) return; quote = z[0]; - if( !sqlite3Isquote(quote) ) return; + if( !tdsqlite3Isquote(quote) ) return; if( quote=='[' ) quote = ']'; for(i=1, j=0;; i++){ assert( z[i] ); @@ -36353,42 +36353,42 @@ SQLITE_PRIVATE void sqlite3Dequote(char *z){ } z[j] = 0; } -SQLITE_PRIVATE void sqlite3DequoteExpr(Expr *p){ - assert( sqlite3Isquote(p->u.zToken[0]) ); +SQLITE_PRIVATE void tdsqlite3DequoteExpr(Expr *p){ + assert( tdsqlite3Isquote(p->u.zToken[0]) ); p->flags |= p->u.zToken[0]=='"' ? EP_Quoted|EP_DblQuoted : EP_Quoted; - sqlite3Dequote(p->u.zToken); + tdsqlite3Dequote(p->u.zToken); } /* ** Generate a Token object from a string */ -SQLITE_PRIVATE void sqlite3TokenInit(Token *p, char *z){ +SQLITE_PRIVATE void tdsqlite3TokenInit(Token *p, char *z){ p->z = z; - p->n = sqlite3Strlen30(z); + p->n = tdsqlite3Strlen30(z); } /* Convenient short-hand */ -#define UpperToLower sqlite3UpperToLower +#define UpperToLower tdsqlite3UpperToLower /* ** Some systems have stricmp(). Others have strcasecmp(). Because ** there is no consistency, we will define our own. ** -** IMPLEMENTATION-OF: R-30243-02494 The sqlite3_stricmp() and -** sqlite3_strnicmp() APIs allow applications and extensions to compare +** IMPLEMENTATION-OF: R-30243-02494 The tdsqlite3_stricmp() and +** tdsqlite3_strnicmp() APIs allow applications and extensions to compare ** the contents of two buffers containing UTF-8 strings in a ** case-independent fashion, using the same definition of "case ** independence" that SQLite uses internally when comparing identifiers. */ -SQLITE_API int sqlite3_stricmp(const char *zLeft, const char *zRight){ +SQLITE_API int tdsqlite3_stricmp(const char *zLeft, const char *zRight){ if( zLeft==0 ){ return zRight ? -1 : 0; }else if( zRight==0 ){ return 1; } - return sqlite3StrICmp(zLeft, zRight); + return tdsqlite3StrICmp(zLeft, zRight); } -SQLITE_PRIVATE int sqlite3StrICmp(const char *zLeft, const char *zRight){ +SQLITE_PRIVATE int tdsqlite3StrICmp(const char *zLeft, const char *zRight){ unsigned char *a, *b; int c, x; a = (unsigned char *)zLeft; @@ -36407,7 +36407,7 @@ SQLITE_PRIVATE int sqlite3StrICmp(const char *zLeft, const char *zRight){ } return c; } -SQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){ +SQLITE_API int tdsqlite3_strnicmp(const char *zLeft, const char *zRight, int N){ register unsigned char *a, *b; if( zLeft==0 ){ return zRight ? -1 : 0; @@ -36426,7 +36426,7 @@ SQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){ ** ** This routine only works for values of E between 1 and 341. */ -static LONGDOUBLE_TYPE sqlite3Pow10(int E){ +static LONGDOUBLE_TYPE tdsqlite3Pow10(int E){ #if defined(_MSC_VER) static const LONGDOUBLE_TYPE x[] = { 1.0e+001L, @@ -36491,7 +36491,7 @@ static LONGDOUBLE_TYPE sqlite3Pow10(int E){ #if defined(_MSC_VER) #pragma warning(disable : 4756) #endif -SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 enc){ +SQLITE_PRIVATE int tdsqlite3AtoF(const char *z, double *pResult, int length, u8 enc){ #ifndef SQLITE_OMIT_FLOATING_POINT int incr; const char *zEnd; @@ -36527,7 +36527,7 @@ SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 en } /* skip leading spaces */ - while( z=zEnd ) return 0; /* get sign of significand */ @@ -36539,13 +36539,13 @@ SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 en } /* copy max significant digits to significand */ - while( z=((LARGEST_INT64-9)/10) ){ /* skip non-significant significand digits ** (increase exponent by d to shift decimal left) */ - while( z=zEnd ) goto do_atof_calc; @@ -36556,7 +36556,7 @@ SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 en eType++; /* copy digits from after decimal to significand ** (decrease exponent by d to shift decimal right) */ - while( z307 ){ /*OPTIMIZATION-IF-TRUE*/ if( e<342 ){ /*OPTIMIZATION-IF-TRUE*/ - LONGDOUBLE_TYPE scale = sqlite3Pow10(e-308); + LONGDOUBLE_TYPE scale = tdsqlite3Pow10(e-308); if( esign<0 ){ result = s / scale; result /= 1.0e+308; @@ -36656,7 +36656,7 @@ do_atof_calc: } } }else{ - LONGDOUBLE_TYPE scale = sqlite3Pow10(e); + LONGDOUBLE_TYPE scale = tdsqlite3Pow10(e); if( esign<0 ){ result = s / scale; }else{ @@ -36678,7 +36678,7 @@ do_atof_calc: return 0; } #else - return !sqlite3Atoi64(z, pResult, length, enc); + return !tdsqlite3Atoi64(z, pResult, length, enc); #endif /* SQLITE_OMIT_FLOATING_POINT */ } #if defined(_MSC_VER) @@ -36732,7 +36732,7 @@ static int compare2pow63(const char *zNum, int incr){ ** The string is not necessarily zero-terminated. The encoding is ** given by enc. */ -SQLITE_PRIVATE int sqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc){ +SQLITE_PRIVATE int tdsqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc){ int incr; u64 u = 0; int neg = 0; /* assume positive */ @@ -36753,7 +36753,7 @@ SQLITE_PRIVATE int sqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc zEnd = &zNum[i^1]; zNum += (enc&1); } - while( zNum=0 && c<=9; i++){ v = v*10 + c; @@ -36923,9 +36923,9 @@ SQLITE_PRIVATE int sqlite3GetInt32(const char *zNum, int *pValue){ ** Return a 32-bit integer value extracted from a string. If the ** string is not an integer, just return 0. */ -SQLITE_PRIVATE int sqlite3Atoi(const char *z){ +SQLITE_PRIVATE int tdsqlite3Atoi(const char *z){ int x = 0; - if( z ) sqlite3GetInt32(z, &x); + if( z ) tdsqlite3GetInt32(z, &x); return x; } @@ -36982,7 +36982,7 @@ static int SQLITE_NOINLINE putVarint64(unsigned char *p, u64 v){ } return n; } -SQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){ +SQLITE_PRIVATE int tdsqlite3PutVarint(unsigned char *p, u64 v){ if( v<=0x7f ){ p[0] = v&0x7f; return 1; @@ -36996,7 +36996,7 @@ SQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){ } /* -** Bitmasks used by sqlite3GetVarint(). These precomputed constants +** Bitmasks used by tdsqlite3GetVarint(). These precomputed constants ** are defined here rather than simply putting the constant expressions ** inline in order to work around bugs in the RVT compiler. ** @@ -37012,7 +37012,7 @@ SQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){ ** Read a 64-bit variable-length integer from memory starting at p[0]. ** Return the number of bytes read. The value is stored in *v. */ -SQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *p, u64 *v){ +SQLITE_PRIVATE u8 tdsqlite3GetVarint(const unsigned char *p, u64 *v){ u32 a,b,s; if( ((signed char*)p)[0]>=0 ){ @@ -37173,7 +37173,7 @@ SQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *p, u64 *v){ ** single-byte case. All code should use the MACRO version as ** this function assumes the single-byte case has already been handled. */ -SQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *p, u32 *v){ +SQLITE_PRIVATE u8 tdsqlite3GetVarint32(const unsigned char *p, u32 *v){ u32 a,b; /* The 1-byte case. Overwhelmingly the most common. Handled inline @@ -37232,7 +37232,7 @@ SQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *p, u32 *v){ u8 n; p -= 2; - n = sqlite3GetVarint(p, &v64); + n = tdsqlite3GetVarint(p, &v64); assert( n>3 && n<=9 ); if( (v64 & SQLITE_MAX_U32)!=v64 ){ *v = 0xffffffff; @@ -37277,14 +37277,14 @@ SQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *p, u32 *v){ /* We can only reach this point when reading a corrupt database ** file. In that case we are not in any hurry. Use the (relatively - ** slow) general-purpose sqlite3GetVarint() routine to extract the + ** slow) general-purpose tdsqlite3GetVarint() routine to extract the ** value. */ { u64 v64; u8 n; p -= 4; - n = sqlite3GetVarint(p, &v64); + n = tdsqlite3GetVarint(p, &v64); assert( n>5 && n<=9 ); *v = (u32)v64; return n; @@ -37296,7 +37296,7 @@ SQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *p, u32 *v){ ** Return the number of bytes that will be needed to store the given ** 64-bit integer. */ -SQLITE_PRIVATE int sqlite3VarintLen(u64 v){ +SQLITE_PRIVATE int tdsqlite3VarintLen(u64 v){ int i; for(i=1; (v >>= 7)!=0; i++){ assert( i<10 ); } return i; @@ -37306,7 +37306,7 @@ SQLITE_PRIVATE int sqlite3VarintLen(u64 v){ /* ** Read or write a four-byte big-endian integer value. */ -SQLITE_PRIVATE u32 sqlite3Get4byte(const u8 *p){ +SQLITE_PRIVATE u32 tdsqlite3Get4byte(const u8 *p){ #if SQLITE_BYTEORDER==4321 u32 x; memcpy(&x,p,4); @@ -37324,7 +37324,7 @@ SQLITE_PRIVATE u32 sqlite3Get4byte(const u8 *p){ return ((unsigned)p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3]; #endif } -SQLITE_PRIVATE void sqlite3Put4byte(unsigned char *p, u32 v){ +SQLITE_PRIVATE void tdsqlite3Put4byte(unsigned char *p, u32 v){ #if SQLITE_BYTEORDER==4321 memcpy(p,&v,4); #elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000 @@ -37348,7 +37348,7 @@ SQLITE_PRIVATE void sqlite3Put4byte(unsigned char *p, u32 v){ ** This routine only works if h really is a valid hexadecimal ** character: 0..9a..fA..F */ -SQLITE_PRIVATE u8 sqlite3HexToInt(int h){ +SQLITE_PRIVATE u8 tdsqlite3HexToInt(int h){ assert( (h>='0' && h<='9') || (h>='a' && h<='f') || (h>='A' && h<='F') ); #ifdef SQLITE_ASCII h += 9*(1&(h>>6)); @@ -37366,15 +37366,15 @@ SQLITE_PRIVATE u8 sqlite3HexToInt(int h){ ** binary value has been obtained from malloc and must be freed by ** the calling routine. */ -SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3 *db, const char *z, int n){ +SQLITE_PRIVATE void *tdsqlite3HexToBlob(tdsqlite3 *db, const char *z, int n){ char *zBlob; int i; - zBlob = (char *)sqlite3DbMallocRawNN(db, n/2 + 1); + zBlob = (char *)tdsqlite3DbMallocRawNN(db, n/2 + 1); n--; if( zBlob ){ for(i=0; imagic; if( magic!=SQLITE_MAGIC_OPEN ){ - if( sqlite3SafetyCheckSickOrOk(db) ){ - testcase( sqlite3GlobalConfig.xLog!=0 ); + if( tdsqlite3SafetyCheckSickOrOk(db) ){ + testcase( tdsqlite3GlobalConfig.xLog!=0 ); logBadConnection("unopened"); } return 0; @@ -37425,13 +37425,13 @@ SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3 *db){ return 1; } } -SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3 *db){ +SQLITE_PRIVATE int tdsqlite3SafetyCheckSickOrOk(tdsqlite3 *db){ u32 magic; magic = db->magic; if( magic!=SQLITE_MAGIC_SICK && magic!=SQLITE_MAGIC_OPEN && magic!=SQLITE_MAGIC_BUSY ){ - testcase( sqlite3GlobalConfig.xLog!=0 ); + testcase( tdsqlite3GlobalConfig.xLog!=0 ); logBadConnection("invalid"); return 0; }else{ @@ -37445,7 +37445,7 @@ SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3 *db){ ** Return 0 on success. Or if the operation would have resulted in an ** overflow, leave *pA unchanged and return 1. */ -SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){ +SQLITE_PRIVATE int tdsqlite3AddInt64(i64 *pA, i64 iB){ #if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER) return __builtin_add_overflow(*pA, iB, pA); #else @@ -37465,7 +37465,7 @@ SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){ return 0; #endif } -SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){ +SQLITE_PRIVATE int tdsqlite3SubInt64(i64 *pA, i64 iB){ #if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER) return __builtin_sub_overflow(*pA, iB, pA); #else @@ -37476,11 +37476,11 @@ SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){ *pA -= iB; return 0; }else{ - return sqlite3AddInt64(pA, -iB); + return tdsqlite3AddInt64(pA, -iB); } #endif } -SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){ +SQLITE_PRIVATE int tdsqlite3MulInt64(i64 *pA, i64 iB){ #if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER) return __builtin_mul_overflow(*pA, iB, pA); #else @@ -37506,7 +37506,7 @@ SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){ ** Compute the absolute value of a 32-bit signed integer, of possible. Or ** if the integer has a value of -2147483648, return +2147483647 */ -SQLITE_PRIVATE int sqlite3AbsInt32(int x){ +SQLITE_PRIVATE int tdsqlite3AbsInt32(int x){ if( x>=0 ) return x; if( x==(int)0x80000000 ) return 0x7fffffff; return -x; @@ -37530,13 +37530,13 @@ SQLITE_PRIVATE int sqlite3AbsInt32(int x){ ** test.db-shm => test.shm ** test.db-mj7f3319fa => test.9fa */ -SQLITE_PRIVATE void sqlite3FileSuffix3(const char *zBaseFilename, char *z){ +SQLITE_PRIVATE void tdsqlite3FileSuffix3(const char *zBaseFilename, char *z){ #if SQLITE_ENABLE_8_3_NAMES<2 - if( sqlite3_uri_boolean(zBaseFilename, "8_3_names", 0) ) + if( tdsqlite3_uri_boolean(zBaseFilename, "8_3_names", 0) ) #endif { int i, sz; - sz = sqlite3Strlen30(z); + sz = tdsqlite3Strlen30(z); for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){} if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 4); } @@ -37549,7 +37549,7 @@ SQLITE_PRIVATE void sqlite3FileSuffix3(const char *zBaseFilename, char *z){ ** value. ** */ -SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst a, LogEst b){ +SQLITE_PRIVATE LogEst tdsqlite3LogEstAdd(LogEst a, LogEst b){ static const unsigned char x[] = { 10, 10, /* 0,1 */ 9, 9, /* 2,3 */ @@ -37576,7 +37576,7 @@ SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst a, LogEst b){ ** Convert an integer into a LogEst. In other words, compute an ** approximation for 10*log2(x). */ -SQLITE_PRIVATE LogEst sqlite3LogEst(u64 x){ +SQLITE_PRIVATE LogEst tdsqlite3LogEst(u64 x){ static LogEst a[] = { 0, 2, 3, 5, 6, 7, 8, 9 }; LogEst y = 40; if( x<8 ){ @@ -37600,12 +37600,12 @@ SQLITE_PRIVATE LogEst sqlite3LogEst(u64 x){ ** Convert a double into a LogEst ** In other words, compute an approximation for 10*log2(x). */ -SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double x){ +SQLITE_PRIVATE LogEst tdsqlite3LogEstFromDouble(double x){ u64 a; LogEst e; assert( sizeof(x)==8 && sizeof(a)==8 ); if( x<=1 ) return 0; - if( x<=2000000000 ) return sqlite3LogEst((u64)x); + if( x<=2000000000 ) return tdsqlite3LogEst((u64)x); memcpy(&a, &x, 8); e = (a>>52) - 1022; return e*10; @@ -37621,7 +37621,7 @@ SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double x){ ** Note that this routine is only used when one or more of various ** non-standard compile-time options is enabled. */ -SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){ +SQLITE_PRIVATE u64 tdsqlite3LogEstToInt(LogEst x){ u64 n; n = x%10; x /= 10; @@ -37646,7 +37646,7 @@ SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){ ** db->mallocFailed flag is set. ** ** A VList is really just an array of integers. To destroy a VList, -** simply pass it to sqlite3DbFree(). +** simply pass it to tdsqlite3DbFree(). ** ** The first integer is the number of integers allocated for the whole ** VList. The second integer is the number of integers actually used. @@ -37675,8 +37675,8 @@ SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){ ** indication that the VList may never again be enlarged, since the ** accompanying realloc() would invalidate the pointers. */ -SQLITE_PRIVATE VList *sqlite3VListAdd( - sqlite3 *db, /* The database connection used for malloc() */ +SQLITE_PRIVATE VList *tdsqlite3VListAdd( + tdsqlite3 *db, /* The database connection used for malloc() */ VList *pIn, /* The input VList. Might be NULL */ const char *zName, /* Name of symbol to add */ int nName, /* Bytes of text in zName */ @@ -37690,8 +37690,8 @@ SQLITE_PRIVATE VList *sqlite3VListAdd( assert( pIn==0 || pIn[0]>=3 ); /* Verify ok to add new elements */ if( pIn==0 || pIn[1]+nInt > pIn[0] ){ /* Enlarge the allocation */ - sqlite3_int64 nAlloc = (pIn ? 2*(sqlite3_int64)pIn[0] : 10) + nInt; - VList *pOut = sqlite3DbRealloc(db, pIn, nAlloc*sizeof(int)); + tdsqlite3_int64 nAlloc = (pIn ? 2*(tdsqlite3_int64)pIn[0] : 10) + nInt; + VList *pOut = tdsqlite3DbRealloc(db, pIn, nAlloc*sizeof(int)); if( pOut==0 ) return pIn; if( pIn==0 ) pOut[1] = 2; pIn = pOut; @@ -37713,7 +37713,7 @@ SQLITE_PRIVATE VList *sqlite3VListAdd( ** has the value iVal. Or return a NULL if there is no such variable in ** the list */ -SQLITE_PRIVATE const char *sqlite3VListNumToName(VList *pIn, int iVal){ +SQLITE_PRIVATE const char *tdsqlite3VListNumToName(VList *pIn, int iVal){ int i, mx; if( pIn==0 ) return 0; mx = pIn[1]; @@ -37729,7 +37729,7 @@ SQLITE_PRIVATE const char *sqlite3VListNumToName(VList *pIn, int iVal){ ** Return the number of the variable named zName, if it is in VList. ** or return 0 if there is no such variable. */ -SQLITE_PRIVATE int sqlite3VListNameToNum(VList *pIn, const char *zName, int nName){ +SQLITE_PRIVATE int tdsqlite3VListNameToNum(VList *pIn, const char *zName, int nName){ int i, mx; if( pIn==0 ) return 0; mx = pIn[1]; @@ -37766,7 +37766,7 @@ SQLITE_PRIVATE int sqlite3VListNameToNum(VList *pIn, const char *zName, int nNam ** ** "pNew" is a pointer to the hash table that is to be initialized. */ -SQLITE_PRIVATE void sqlite3HashInit(Hash *pNew){ +SQLITE_PRIVATE void tdsqlite3HashInit(Hash *pNew){ assert( pNew!=0 ); pNew->first = 0; pNew->count = 0; @@ -37778,18 +37778,18 @@ SQLITE_PRIVATE void sqlite3HashInit(Hash *pNew){ ** Call this routine to delete a hash table or to reset a hash table ** to the empty state. */ -SQLITE_PRIVATE void sqlite3HashClear(Hash *pH){ +SQLITE_PRIVATE void tdsqlite3HashClear(Hash *pH){ HashElem *elem; /* For looping over all elements of the table */ assert( pH!=0 ); elem = pH->first; pH->first = 0; - sqlite3_free(pH->ht); + tdsqlite3_free(pH->ht); pH->ht = 0; pH->htsize = 0; while( elem ){ HashElem *next_elem = elem->next; - sqlite3_free(elem); + tdsqlite3_free(elem); elem = next_elem; } pH->count = 0; @@ -37805,7 +37805,7 @@ static unsigned int strHash(const char *z){ /* Knuth multiplicative hashing. (Sorting & Searching, p. 510). ** 0x9e3779b1 is 2654435761 which is the closest prime number to ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. */ - h += sqlite3UpperToLower[c]; + h += tdsqlite3UpperToLower[c]; h *= 0x9e3779b1; } return h; @@ -37845,7 +37845,7 @@ static void insertElement( /* Resize the hash table so that it cantains "new_size" buckets. ** -** The hash table might fail to resize if sqlite3_malloc() fails or +** The hash table might fail to resize if tdsqlite3_malloc() fails or ** if the new size is the same as the prior size. ** Return TRUE if the resize occurs and false if not. */ @@ -37862,20 +37862,20 @@ static int rehash(Hash *pH, unsigned int new_size){ /* The inability to allocates space for a larger hash table is ** a performance hit but it is not a fatal error. So mark the - ** allocation as a benign. Use sqlite3Malloc()/memset(0) instead of - ** sqlite3MallocZero() to make the allocation, as sqlite3MallocZero() + ** allocation as a benign. Use tdsqlite3Malloc()/memset(0) instead of + ** tdsqlite3MallocZero() to make the allocation, as tdsqlite3MallocZero() ** only zeroes the requested number of bytes whereas this module will ** use the actual amount of space allocated for the hash table (which ** may be larger than the requested amount). */ - sqlite3BeginBenignMalloc(); - new_ht = (struct _ht *)sqlite3Malloc( new_size*sizeof(struct _ht) ); - sqlite3EndBenignMalloc(); + tdsqlite3BeginBenignMalloc(); + new_ht = (struct _ht *)tdsqlite3Malloc( new_size*sizeof(struct _ht) ); + tdsqlite3EndBenignMalloc(); if( new_ht==0 ) return 0; - sqlite3_free(pH->ht); + tdsqlite3_free(pH->ht); pH->ht = new_ht; - pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht); + pH->htsize = new_size = tdsqlite3MallocSize(new_ht)/sizeof(struct _ht); memset(new_ht, 0, new_size*sizeof(struct _ht)); for(elem=pH->first, pH->first=0; elem; elem = next_elem){ unsigned int h = strHash(elem->pKey) % new_size; @@ -37914,7 +37914,7 @@ static HashElem *findElementWithHash( if( pHash ) *pHash = h; while( count-- ){ assert( elem!=0 ); - if( sqlite3StrICmp(elem->pKey,pKey)==0 ){ + if( tdsqlite3StrICmp(elem->pKey,pKey)==0 ){ return elem; } elem = elem->next; @@ -37947,12 +37947,12 @@ static void removeElementGivenHash( assert( pEntry->count>0 ); pEntry->count--; } - sqlite3_free( elem ); + tdsqlite3_free( elem ); pH->count--; if( pH->count==0 ){ assert( pH->first==0 ); assert( pH->count==0 ); - sqlite3HashClear(pH); + tdsqlite3HashClear(pH); } } @@ -37960,7 +37960,7 @@ static void removeElementGivenHash( ** that matches pKey. Return the data for this element if it is ** found, or NULL if there is no match. */ -SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey){ +SQLITE_PRIVATE void *tdsqlite3HashFind(const Hash *pH, const char *pKey){ assert( pH!=0 ); assert( pKey!=0 ); return findElementWithHash(pH, pKey, 0)->data; @@ -37980,7 +37980,7 @@ SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey){ ** If the "data" parameter to this function is NULL, then the ** element corresponding to "key" is removed from the hash table. */ -SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){ +SQLITE_PRIVATE void *tdsqlite3HashInsert(Hash *pH, const char *pKey, void *data){ unsigned int h; /* the hash of the key modulo hash table size */ HashElem *elem; /* Used to loop thru the element list */ HashElem *new_elem; /* New element added to the pH */ @@ -37999,7 +37999,7 @@ SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){ return old_data; } if( data==0 ) return 0; - new_elem = (HashElem*)sqlite3Malloc( sizeof(HashElem) ); + new_elem = (HashElem*)tdsqlite3Malloc( sizeof(HashElem) ); if( new_elem==0 ) return data; new_elem->pKey = pKey; new_elem->data = data; @@ -38026,7 +38026,7 @@ SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){ #else # define OpHelp(X) #endif -SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ +SQLITE_PRIVATE const char *tdsqlite3OpcodeName(int i){ static const char *const azName[] = { /* 0 */ "Savepoint" OpHelp(""), /* 1 */ "AutoCommit" OpHelp(""), @@ -38248,13 +38248,13 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ ** + for flock() locking ** + for named semaphore locks (VxWorks only) ** + for AFP filesystem locks (MacOSX only) -** * sqlite3_file methods not associated with locking. -** * Definitions of sqlite3_io_methods objects for all locking +** * tdsqlite3_file methods not associated with locking. +** * Definitions of tdsqlite3_io_methods objects for all locking ** methods plus "finder" functions for each locking method. -** * sqlite3_vfs method implementations. +** * tdsqlite3_vfs method implementations. ** * Locking primitives for the proxy uber-locking-method. (MacOSX only) -** * Definitions of sqlite3_vfs objects for all locking methods -** plus implementations of sqlite3_os_init() and sqlite3_os_end(). +** * Definitions of tdsqlite3_vfs objects for all locking methods +** plus implementations of tdsqlite3_os_init() and tdsqlite3_os_end(). */ /* #include "sqliteInt.h" */ #if SQLITE_OS_UNIX /* This file is used on unix only */ @@ -38424,13 +38424,13 @@ struct UnixUnusedFd { }; /* -** The unixFile structure is subclass of sqlite3_file specific to the unix +** The unixFile structure is subclass of tdsqlite3_file specific to the unix ** VFS implementations. */ typedef struct unixFile unixFile; struct unixFile { - sqlite3_io_methods const *pMethod; /* Always the first entry */ - sqlite3_vfs *pVfs; /* The VFS that created this unixFile */ + tdsqlite3_io_methods const *pMethod; /* Always the first entry */ + tdsqlite3_vfs *pVfs; /* The VFS that created this unixFile */ unixInodeInfo *pInode; /* Info about locks on this inode */ int h; /* The file descriptor */ unsigned char eFileLock; /* The type of lock held on this fd */ @@ -38443,9 +38443,9 @@ struct unixFile { int szChunk; /* Configured by FCNTL_CHUNK_SIZE */ #if SQLITE_MAX_MMAP_SIZE>0 int nFetchOut; /* Number of outstanding xFetch refs */ - sqlite3_int64 mmapSize; /* Usable size of mapping at pMapRegion */ - sqlite3_int64 mmapSizeActual; /* Actual size of mapping at pMapRegion */ - sqlite3_int64 mmapSizeMax; /* Configured FCNTL_MMAP_SIZE value */ + tdsqlite3_int64 mmapSize; /* Usable size of mapping at pMapRegion */ + tdsqlite3_int64 mmapSizeActual; /* Actual size of mapping at pMapRegion */ + tdsqlite3_int64 mmapSizeMax; /* Configured FCNTL_MMAP_SIZE value */ void *pMapRegion; /* Memory mapped region */ #endif int sectorSize; /* Device sector size */ @@ -38584,7 +38584,7 @@ static pid_t randomnessPid = 0; #if defined(__GNUC__) - __inline__ sqlite_uint64 sqlite3Hwtime(void){ + __inline__ sqlite_uint64 tdsqlite3Hwtime(void){ unsigned int lo, hi; __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); return (sqlite_uint64)hi << 32 | lo; @@ -38592,7 +38592,7 @@ static pid_t randomnessPid = 0; #elif defined(_MSC_VER) - __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ + __declspec(naked) __inline sqlite_uint64 __cdecl tdsqlite3Hwtime(void){ __asm { rdtsc ret ; return value at EDX:EAX @@ -38603,7 +38603,7 @@ static pid_t randomnessPid = 0; #elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) - __inline__ sqlite_uint64 sqlite3Hwtime(void){ + __inline__ sqlite_uint64 tdsqlite3Hwtime(void){ unsigned long val; __asm__ __volatile__ ("rdtsc" : "=A" (val)); return val; @@ -38611,7 +38611,7 @@ static pid_t randomnessPid = 0; #elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) - __inline__ sqlite_uint64 sqlite3Hwtime(void){ + __inline__ sqlite_uint64 tdsqlite3Hwtime(void){ unsigned long long retval; unsigned long junk; __asm__ __volatile__ ("\n\ @@ -38628,13 +38628,13 @@ static pid_t randomnessPid = 0; /* ** asm() is needed for hardware timing support. Without asm(), - ** disable the sqlite3Hwtime() routine. + ** disable the tdsqlite3Hwtime() routine. ** - ** sqlite3Hwtime() is only used for some obscure debugging + ** tdsqlite3Hwtime() is only used for some obscure debugging ** and analysis configurations, not in any deliverable, so this ** should not be a great loss. */ -SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } +SQLITE_PRIVATE sqlite_uint64 tdsqlite3Hwtime(void){ return ((sqlite_uint64)0); } #endif @@ -38645,8 +38645,8 @@ SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } static sqlite_uint64 g_start; static sqlite_uint64 g_elapsed; -#define TIMER_START g_start=sqlite3Hwtime() -#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start +#define TIMER_START g_start=tdsqlite3Hwtime() +#define TIMER_END g_elapsed=tdsqlite3Hwtime()-g_start #define TIMER_ELAPSED g_elapsed #else #define TIMER_START @@ -38660,32 +38660,32 @@ static sqlite_uint64 g_elapsed; ** is used for testing the I/O recovery logic. */ #if defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_io_error_hit; -SQLITE_API extern int sqlite3_io_error_hardhit; -SQLITE_API extern int sqlite3_io_error_pending; -SQLITE_API extern int sqlite3_io_error_persist; -SQLITE_API extern int sqlite3_io_error_benign; -SQLITE_API extern int sqlite3_diskfull_pending; -SQLITE_API extern int sqlite3_diskfull; -#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X) +SQLITE_API extern int tdsqlite3_io_error_hit; +SQLITE_API extern int tdsqlite3_io_error_hardhit; +SQLITE_API extern int tdsqlite3_io_error_pending; +SQLITE_API extern int tdsqlite3_io_error_persist; +SQLITE_API extern int tdsqlite3_io_error_benign; +SQLITE_API extern int tdsqlite3_diskfull_pending; +SQLITE_API extern int tdsqlite3_diskfull; +#define SimulateIOErrorBenign(X) tdsqlite3_io_error_benign=(X) #define SimulateIOError(CODE) \ - if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \ - || sqlite3_io_error_pending-- == 1 ) \ + if( (tdsqlite3_io_error_persist && tdsqlite3_io_error_hit) \ + || tdsqlite3_io_error_pending-- == 1 ) \ { local_ioerr(); CODE; } static void local_ioerr(){ IOTRACE(("IOERR\n")); - sqlite3_io_error_hit++; - if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++; + tdsqlite3_io_error_hit++; + if( !tdsqlite3_io_error_benign ) tdsqlite3_io_error_hardhit++; } #define SimulateDiskfullError(CODE) \ - if( sqlite3_diskfull_pending ){ \ - if( sqlite3_diskfull_pending == 1 ){ \ + if( tdsqlite3_diskfull_pending ){ \ + if( tdsqlite3_diskfull_pending == 1 ){ \ local_ioerr(); \ - sqlite3_diskfull = 1; \ - sqlite3_io_error_hit = 1; \ + tdsqlite3_diskfull = 1; \ + tdsqlite3_io_error_hit = 1; \ CODE; \ }else{ \ - sqlite3_diskfull_pending--; \ + tdsqlite3_diskfull_pending--; \ } \ } #else @@ -38698,8 +38698,8 @@ static void local_ioerr(){ ** When testing, keep a count of the number of open files. */ #if defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_open_file_count; -#define OpenCounter(X) sqlite3_open_file_count+=(X) +SQLITE_API extern int tdsqlite3_open_file_count; +#define OpenCounter(X) tdsqlite3_open_file_count+=(X) #else #define OpenCounter(X) #endif /* defined(SQLITE_TEST) */ @@ -38793,22 +38793,22 @@ static int unixGetpagesize(void); */ static struct unix_syscall { const char *zName; /* Name of the system call */ - sqlite3_syscall_ptr pCurrent; /* Current value of the system call */ - sqlite3_syscall_ptr pDefault; /* Default value */ + tdsqlite3_syscall_ptr pCurrent; /* Current value of the system call */ + tdsqlite3_syscall_ptr pDefault; /* Default value */ } aSyscall[] = { - { "open", (sqlite3_syscall_ptr)posixOpen, 0 }, + { "open", (tdsqlite3_syscall_ptr)posixOpen, 0 }, #define osOpen ((int(*)(const char*,int,int))aSyscall[0].pCurrent) - { "close", (sqlite3_syscall_ptr)close, 0 }, + { "close", (tdsqlite3_syscall_ptr)close, 0 }, #define osClose ((int(*)(int))aSyscall[1].pCurrent) - { "access", (sqlite3_syscall_ptr)access, 0 }, + { "access", (tdsqlite3_syscall_ptr)access, 0 }, #define osAccess ((int(*)(const char*,int))aSyscall[2].pCurrent) - { "getcwd", (sqlite3_syscall_ptr)getcwd, 0 }, + { "getcwd", (tdsqlite3_syscall_ptr)getcwd, 0 }, #define osGetcwd ((char*(*)(char*,size_t))aSyscall[3].pCurrent) - { "stat", (sqlite3_syscall_ptr)stat, 0 }, + { "stat", (tdsqlite3_syscall_ptr)stat, 0 }, #define osStat ((int(*)(const char*,struct stat*))aSyscall[4].pCurrent) /* @@ -38821,140 +38821,140 @@ static struct unix_syscall { { "fstat", 0, 0 }, #define osFstat(a,b,c) 0 #else - { "fstat", (sqlite3_syscall_ptr)fstat, 0 }, + { "fstat", (tdsqlite3_syscall_ptr)fstat, 0 }, #define osFstat ((int(*)(int,struct stat*))aSyscall[5].pCurrent) #endif - { "ftruncate", (sqlite3_syscall_ptr)ftruncate, 0 }, + { "ftruncate", (tdsqlite3_syscall_ptr)ftruncate, 0 }, #define osFtruncate ((int(*)(int,off_t))aSyscall[6].pCurrent) - { "fcntl", (sqlite3_syscall_ptr)fcntl, 0 }, + { "fcntl", (tdsqlite3_syscall_ptr)fcntl, 0 }, #define osFcntl ((int(*)(int,int,...))aSyscall[7].pCurrent) - { "read", (sqlite3_syscall_ptr)read, 0 }, + { "read", (tdsqlite3_syscall_ptr)read, 0 }, #define osRead ((ssize_t(*)(int,void*,size_t))aSyscall[8].pCurrent) #if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE - { "pread", (sqlite3_syscall_ptr)pread, 0 }, + { "pread", (tdsqlite3_syscall_ptr)pread, 0 }, #else - { "pread", (sqlite3_syscall_ptr)0, 0 }, + { "pread", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osPread ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[9].pCurrent) #if defined(USE_PREAD64) - { "pread64", (sqlite3_syscall_ptr)pread64, 0 }, + { "pread64", (tdsqlite3_syscall_ptr)pread64, 0 }, #else - { "pread64", (sqlite3_syscall_ptr)0, 0 }, + { "pread64", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osPread64 ((ssize_t(*)(int,void*,size_t,off64_t))aSyscall[10].pCurrent) - { "write", (sqlite3_syscall_ptr)write, 0 }, + { "write", (tdsqlite3_syscall_ptr)write, 0 }, #define osWrite ((ssize_t(*)(int,const void*,size_t))aSyscall[11].pCurrent) #if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE - { "pwrite", (sqlite3_syscall_ptr)pwrite, 0 }, + { "pwrite", (tdsqlite3_syscall_ptr)pwrite, 0 }, #else - { "pwrite", (sqlite3_syscall_ptr)0, 0 }, + { "pwrite", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osPwrite ((ssize_t(*)(int,const void*,size_t,off_t))\ aSyscall[12].pCurrent) #if defined(USE_PREAD64) - { "pwrite64", (sqlite3_syscall_ptr)pwrite64, 0 }, + { "pwrite64", (tdsqlite3_syscall_ptr)pwrite64, 0 }, #else - { "pwrite64", (sqlite3_syscall_ptr)0, 0 }, + { "pwrite64", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osPwrite64 ((ssize_t(*)(int,const void*,size_t,off64_t))\ aSyscall[13].pCurrent) - { "fchmod", (sqlite3_syscall_ptr)fchmod, 0 }, + { "fchmod", (tdsqlite3_syscall_ptr)fchmod, 0 }, #define osFchmod ((int(*)(int,mode_t))aSyscall[14].pCurrent) #if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE - { "fallocate", (sqlite3_syscall_ptr)posix_fallocate, 0 }, + { "fallocate", (tdsqlite3_syscall_ptr)posix_fallocate, 0 }, #else - { "fallocate", (sqlite3_syscall_ptr)0, 0 }, + { "fallocate", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osFallocate ((int(*)(int,off_t,off_t))aSyscall[15].pCurrent) - { "unlink", (sqlite3_syscall_ptr)unlink, 0 }, + { "unlink", (tdsqlite3_syscall_ptr)unlink, 0 }, #define osUnlink ((int(*)(const char*))aSyscall[16].pCurrent) - { "openDirectory", (sqlite3_syscall_ptr)openDirectory, 0 }, + { "openDirectory", (tdsqlite3_syscall_ptr)openDirectory, 0 }, #define osOpenDirectory ((int(*)(const char*,int*))aSyscall[17].pCurrent) - { "mkdir", (sqlite3_syscall_ptr)mkdir, 0 }, + { "mkdir", (tdsqlite3_syscall_ptr)mkdir, 0 }, #define osMkdir ((int(*)(const char*,mode_t))aSyscall[18].pCurrent) - { "rmdir", (sqlite3_syscall_ptr)rmdir, 0 }, + { "rmdir", (tdsqlite3_syscall_ptr)rmdir, 0 }, #define osRmdir ((int(*)(const char*))aSyscall[19].pCurrent) #if defined(HAVE_FCHOWN) - { "fchown", (sqlite3_syscall_ptr)fchown, 0 }, + { "fchown", (tdsqlite3_syscall_ptr)fchown, 0 }, #else - { "fchown", (sqlite3_syscall_ptr)0, 0 }, + { "fchown", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osFchown ((int(*)(int,uid_t,gid_t))aSyscall[20].pCurrent) #if defined(HAVE_FCHOWN) - { "geteuid", (sqlite3_syscall_ptr)geteuid, 0 }, + { "geteuid", (tdsqlite3_syscall_ptr)geteuid, 0 }, #else - { "geteuid", (sqlite3_syscall_ptr)0, 0 }, + { "geteuid", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osGeteuid ((uid_t(*)(void))aSyscall[21].pCurrent) #if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 - { "mmap", (sqlite3_syscall_ptr)mmap, 0 }, + { "mmap", (tdsqlite3_syscall_ptr)mmap, 0 }, #else - { "mmap", (sqlite3_syscall_ptr)0, 0 }, + { "mmap", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osMmap ((void*(*)(void*,size_t,int,int,int,off_t))aSyscall[22].pCurrent) #if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 - { "munmap", (sqlite3_syscall_ptr)munmap, 0 }, + { "munmap", (tdsqlite3_syscall_ptr)munmap, 0 }, #else - { "munmap", (sqlite3_syscall_ptr)0, 0 }, + { "munmap", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osMunmap ((int(*)(void*,size_t))aSyscall[23].pCurrent) #if HAVE_MREMAP && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) - { "mremap", (sqlite3_syscall_ptr)mremap, 0 }, + { "mremap", (tdsqlite3_syscall_ptr)mremap, 0 }, #else - { "mremap", (sqlite3_syscall_ptr)0, 0 }, + { "mremap", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osMremap ((void*(*)(void*,size_t,size_t,int,...))aSyscall[24].pCurrent) #if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 - { "getpagesize", (sqlite3_syscall_ptr)unixGetpagesize, 0 }, + { "getpagesize", (tdsqlite3_syscall_ptr)unixGetpagesize, 0 }, #else - { "getpagesize", (sqlite3_syscall_ptr)0, 0 }, + { "getpagesize", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osGetpagesize ((int(*)(void))aSyscall[25].pCurrent) #if defined(HAVE_READLINK) - { "readlink", (sqlite3_syscall_ptr)readlink, 0 }, + { "readlink", (tdsqlite3_syscall_ptr)readlink, 0 }, #else - { "readlink", (sqlite3_syscall_ptr)0, 0 }, + { "readlink", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[26].pCurrent) #if defined(HAVE_LSTAT) - { "lstat", (sqlite3_syscall_ptr)lstat, 0 }, + { "lstat", (tdsqlite3_syscall_ptr)lstat, 0 }, #else - { "lstat", (sqlite3_syscall_ptr)0, 0 }, + { "lstat", (tdsqlite3_syscall_ptr)0, 0 }, #endif #define osLstat ((int(*)(const char*,struct stat*))aSyscall[27].pCurrent) #if defined(__linux__) && defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE) # ifdef __ANDROID__ - { "ioctl", (sqlite3_syscall_ptr)(int(*)(int, int, ...))ioctl, 0 }, + { "ioctl", (tdsqlite3_syscall_ptr)(int(*)(int, int, ...))ioctl, 0 }, #define osIoctl ((int(*)(int,int,...))aSyscall[28].pCurrent) # else - { "ioctl", (sqlite3_syscall_ptr)ioctl, 0 }, + { "ioctl", (tdsqlite3_syscall_ptr)ioctl, 0 }, #define osIoctl ((int(*)(int,unsigned long,...))aSyscall[28].pCurrent) # endif #else - { "ioctl", (sqlite3_syscall_ptr)0, 0 }, + { "ioctl", (tdsqlite3_syscall_ptr)0, 0 }, #endif }; /* End of the overrideable system calls */ @@ -38974,15 +38974,15 @@ static int robustFchown(int fd, uid_t uid, gid_t gid){ } /* -** This is the xSetSystemCall() method of sqlite3_vfs for all of the +** This is the xSetSystemCall() method of tdsqlite3_vfs for all of the ** "unix" VFSes. Return SQLITE_OK opon successfully updating the ** system call pointer, or SQLITE_NOTFOUND if there is no configurable ** system call named zName. */ static int unixSetSystemCall( - sqlite3_vfs *pNotUsed, /* The VFS pointer. Not used */ + tdsqlite3_vfs *pNotUsed, /* The VFS pointer. Not used */ const char *zName, /* Name of system call to override */ - sqlite3_syscall_ptr pNewFunc /* Pointer to new system call value */ + tdsqlite3_syscall_ptr pNewFunc /* Pointer to new system call value */ ){ unsigned int i; int rc = SQLITE_NOTFOUND; @@ -39022,8 +39022,8 @@ static int unixSetSystemCall( ** recognized system call name. NULL is also returned if the system call ** is currently undefined. */ -static sqlite3_syscall_ptr unixGetSystemCall( - sqlite3_vfs *pNotUsed, +static tdsqlite3_syscall_ptr unixGetSystemCall( + tdsqlite3_vfs *pNotUsed, const char *zName ){ unsigned int i; @@ -39041,7 +39041,7 @@ static sqlite3_syscall_ptr unixGetSystemCall( ** is the last system call or if zName is not the name of a valid ** system call. */ -static const char *unixNextSystemCall(sqlite3_vfs *p, const char *zName){ +static const char *unixNextSystemCall(tdsqlite3_vfs *p, const char *zName){ int i = -1; UNUSED_PARAMETER(p); @@ -39097,7 +39097,7 @@ static int robust_open(const char *z, int f, mode_t m){ } if( fd>=SQLITE_MINIMUM_FILE_DESCRIPTOR ) break; osClose(fd); - sqlite3_log(SQLITE_WARNING, + tdsqlite3_log(SQLITE_WARNING, "attempt to open \"%s\" as file descriptor %d", z, fd); fd = -1; if( osOpen("/dev/null", f, m)<0 ) break; @@ -39144,18 +39144,18 @@ static int robust_open(const char *z, int f, mode_t m){ ** OK: enter(pLockInfo) ** ERROR: enter(pLockInfo), enter(unixBigLock) */ -static sqlite3_mutex *unixBigLock = 0; +static tdsqlite3_mutex *unixBigLock = 0; static void unixEnterMutex(void){ - assert( sqlite3_mutex_notheld(unixBigLock) ); /* Not a recursive mutex */ - sqlite3_mutex_enter(unixBigLock); + assert( tdsqlite3_mutex_notheld(unixBigLock) ); /* Not a recursive mutex */ + tdsqlite3_mutex_enter(unixBigLock); } static void unixLeaveMutex(void){ - assert( sqlite3_mutex_held(unixBigLock) ); - sqlite3_mutex_leave(unixBigLock); + assert( tdsqlite3_mutex_held(unixBigLock) ); + tdsqlite3_mutex_leave(unixBigLock); } #ifdef SQLITE_DEBUG static int unixMutexHeld(void) { - return sqlite3_mutex_held(unixBigLock); + return tdsqlite3_mutex_held(unixBigLock); } #endif @@ -39197,7 +39197,7 @@ static int lockTrace(int fd, int op, struct flock *p){ zOpName = "SETLK"; }else{ s = osFcntl(fd, op, p); - sqlite3DebugPrintf("fcntl unknown %d %d %d\n", fd, op, s); + tdsqlite3DebugPrintf("fcntl unknown %d %d %d\n", fd, op, s); return s; } if( p->l_type==F_RDLCK ){ @@ -39212,7 +39212,7 @@ static int lockTrace(int fd, int op, struct flock *p){ assert( p->l_whence==SEEK_SET ); s = osFcntl(fd, op, p); savedErrno = errno; - sqlite3DebugPrintf("fcntl %d %d %s %s %d %d %d %d\n", + tdsqlite3DebugPrintf("fcntl %d %d %s %s %d %d %d %d\n", threadid, fd, zOpName, zType, (int)p->l_start, (int)p->l_len, (int)p->l_pid, s); if( s==(-1) && op==F_SETLK && (p->l_type==F_RDLCK || p->l_type==F_WRLCK) ){ @@ -39228,7 +39228,7 @@ static int lockTrace(int fd, int op, struct flock *p){ }else{ assert( 0 ); } - sqlite3DebugPrintf("fcntl-failure-reason: %s %d %d %d\n", + tdsqlite3DebugPrintf("fcntl-failure-reason: %s %d %d %d\n", zType, (int)l2.l_start, (int)l2.l_len, (int)l2.l_pid); } errno = savedErrno; @@ -39245,14 +39245,14 @@ static int lockTrace(int fd, int op, struct flock *p){ ** this wrapper. On the Android platform, bypassing the logic below ** could lead to a corrupt database. */ -static int robust_ftruncate(int h, sqlite3_int64 sz){ +static int robust_ftruncate(int h, tdsqlite3_int64 sz){ int rc; #ifdef __ANDROID__ /* On Android, ftruncate() always uses 32-bit offsets, even if ** _FILE_OFFSET_BITS=64 is defined. This means it is unsafe to attempt to ** truncate a file to any size larger than 2GiB. Silently ignore any ** such attempts. */ - if( sz>(sqlite3_int64)0x7FFFFFFF ){ + if( sz>(tdsqlite3_int64)0x7FFFFFFF ){ rc = SQLITE_OK; }else #endif @@ -39262,7 +39262,7 @@ static int robust_ftruncate(int h, sqlite3_int64 sz){ /* ** This routine translates a standard POSIX errno code into something -** useful to the clients of the sqlite3 functions. Specifically, it is +** useful to the clients of the tdsqlite3 functions. Specifically, it is ** intended to translate a variety of "try again" errors into SQLITE_BUSY ** and a variety of "please close the file descriptor NOW" errors into ** SQLITE_IOERR @@ -39380,7 +39380,7 @@ static struct vxworksFileId *vxworksFindFileId(const char *zAbsoluteName){ assert( zAbsoluteName[0]=='/' ); n = (int)strlen(zAbsoluteName); - pNew = sqlite3_malloc64( sizeof(*pNew) + (n+1) ); + pNew = tdsqlite3_malloc64( sizeof(*pNew) + (n+1) ); if( pNew==0 ) return 0; pNew->zCanonicalName = (char*)&pNew[1]; memcpy(pNew->zCanonicalName, zAbsoluteName, n+1); @@ -39395,7 +39395,7 @@ static struct vxworksFileId *vxworksFindFileId(const char *zAbsoluteName){ if( pCandidate->nName==n && memcmp(pCandidate->zCanonicalName, pNew->zCanonicalName, n)==0 ){ - sqlite3_free(pNew); + tdsqlite3_free(pNew); pCandidate->nRef++; unixLeaveMutex(); return pCandidate; @@ -39424,7 +39424,7 @@ static void vxworksReleaseFileId(struct vxworksFileId *pId){ for(pp=&vxworksFileList; *pp && *pp!=pId; pp = &((*pp)->pNext)){} assert( *pp==pId ); *pp = pId->pNext; - sqlite3_free(pId); + tdsqlite3_free(pId); } unixLeaveMutex(); } @@ -39473,7 +39473,7 @@ static void vxworksReleaseFileId(struct vxworksFileId *pId){ ** For VxWorks, we have to use the alternative unique ID system based on ** canonical filename and implemented in the previous division.) ** -** The sqlite3_file structure for POSIX is no longer just an integer file +** The tdsqlite3_file structure for POSIX is no longer just an integer file ** descriptor. It is now a structure that holds the integer file ** descriptor and a pointer to a structure that describes the internal ** locks on the corresponding inode. There is one locking structure @@ -39570,7 +39570,7 @@ struct unixFileId { */ struct unixInodeInfo { struct unixFileId fileId; /* The lookup key */ - sqlite3_mutex *pLockMutex; /* Hold this mutex for... */ + tdsqlite3_mutex *pLockMutex; /* Hold this mutex for... */ int nShared; /* Number of SHARED locks held */ int nLock; /* Number of outstanding file locks */ unsigned char eFileLock; /* One of SHARED_LOCK, RESERVED_LOCK etc. */ @@ -39604,11 +39604,11 @@ static unixInodeInfo *inodeList = 0; /* All unixInodeInfo objects */ */ int unixFileMutexHeld(unixFile *pFile){ assert( pFile->pInode ); - return sqlite3_mutex_held(pFile->pInode->pLockMutex); + return tdsqlite3_mutex_held(pFile->pInode->pLockMutex); } int unixFileMutexNotheld(unixFile *pFile){ assert( pFile->pInode ); - return sqlite3_mutex_notheld(pFile->pInode->pLockMutex); + return tdsqlite3_mutex_notheld(pFile->pInode->pLockMutex); } #endif @@ -39618,7 +39618,7 @@ int unixFileMutexNotheld(unixFile *pFile){ ** unixLogError(). ** ** It is invoked after an error occurs in an OS function and errno has been -** set. It logs a message using sqlite3_log() containing the current value of +** set. It logs a message using tdsqlite3_log() containing the current value of ** errno and, if possible, the human-readable equivalent from strerror() or ** strerror_r(). ** @@ -39673,7 +39673,7 @@ static int unixLogErrorAtLine( #endif if( zPath==0 ) zPath = ""; - sqlite3_log(errcode, + tdsqlite3_log(errcode, "os_unix.c:%d: (%d) %s(%s) - %s", iLine, iErrno, zFunc, zPath, zErr ); @@ -39720,7 +39720,7 @@ static void closePendingFds(unixFile *pFile){ for(p=pInode->pUnused; p; p=pNext){ pNext = p->pNext; robust_close(pFile, p->fd, __LINE__); - sqlite3_free(p); + tdsqlite3_free(p); } pInode->pUnused = 0; } @@ -39739,9 +39739,9 @@ static void releaseInodeInfo(unixFile *pFile){ pInode->nRef--; if( pInode->nRef==0 ){ assert( pInode->pShmNode==0 ); - sqlite3_mutex_enter(pInode->pLockMutex); + tdsqlite3_mutex_enter(pInode->pLockMutex); closePendingFds(pFile); - sqlite3_mutex_leave(pInode->pLockMutex); + tdsqlite3_mutex_leave(pInode->pLockMutex); if( pInode->pPrev ){ assert( pInode->pPrev->pNext==pInode ); pInode->pPrev->pNext = pInode->pNext; @@ -39753,8 +39753,8 @@ static void releaseInodeInfo(unixFile *pFile){ assert( pInode->pNext->pPrev==pInode ); pInode->pNext->pPrev = pInode->pPrev; } - sqlite3_mutex_free(pInode->pLockMutex); - sqlite3_free(pInode); + tdsqlite3_mutex_free(pInode->pLockMutex); + tdsqlite3_free(pInode); } } } @@ -39831,16 +39831,16 @@ static int findInodeInfo( pInode = pInode->pNext; } if( pInode==0 ){ - pInode = sqlite3_malloc64( sizeof(*pInode) ); + pInode = tdsqlite3_malloc64( sizeof(*pInode) ); if( pInode==0 ){ return SQLITE_NOMEM_BKPT; } memset(pInode, 0, sizeof(*pInode)); memcpy(&pInode->fileId, &fileId, sizeof(fileId)); - if( sqlite3GlobalConfig.bCoreMutex ){ - pInode->pLockMutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); + if( tdsqlite3GlobalConfig.bCoreMutex ){ + pInode->pLockMutex = tdsqlite3_mutex_alloc(SQLITE_MUTEX_FAST); if( pInode->pLockMutex==0 ){ - sqlite3_free(pInode); + tdsqlite3_free(pInode); return SQLITE_NOMEM_BKPT; } } @@ -39879,7 +39879,7 @@ static int fileHasMoved(unixFile *pFile){ ** (2) The file is not a symbolic link ** (3) The file has not been renamed or unlinked ** -** Issue sqlite3_log(SQLITE_WARNING,...) messages if anything is not right. +** Issue tdsqlite3_log(SQLITE_WARNING,...) messages if anything is not right. */ static void verifyDbFile(unixFile *pFile){ struct stat buf; @@ -39890,19 +39890,19 @@ static void verifyDbFile(unixFile *pFile){ rc = osFstat(pFile->h, &buf); if( rc!=0 ){ - sqlite3_log(SQLITE_WARNING, "cannot fstat db file %s", pFile->zPath); + tdsqlite3_log(SQLITE_WARNING, "cannot fstat db file %s", pFile->zPath); return; } if( buf.st_nlink==0 ){ - sqlite3_log(SQLITE_WARNING, "file unlinked while open: %s", pFile->zPath); + tdsqlite3_log(SQLITE_WARNING, "file unlinked while open: %s", pFile->zPath); return; } if( buf.st_nlink>1 ){ - sqlite3_log(SQLITE_WARNING, "multiple links to file: %s", pFile->zPath); + tdsqlite3_log(SQLITE_WARNING, "multiple links to file: %s", pFile->zPath); return; } if( fileHasMoved(pFile) ){ - sqlite3_log(SQLITE_WARNING, "file renamed while open: %s", pFile->zPath); + tdsqlite3_log(SQLITE_WARNING, "file renamed while open: %s", pFile->zPath); return; } } @@ -39914,7 +39914,7 @@ static void verifyDbFile(unixFile *pFile){ ** to a non-zero value otherwise *pResOut is set to zero. The return value ** is set to SQLITE_OK unless an I/O error occurs during lock checking. */ -static int unixCheckReservedLock(sqlite3_file *id, int *pResOut){ +static int unixCheckReservedLock(tdsqlite3_file *id, int *pResOut){ int rc = SQLITE_OK; int reserved = 0; unixFile *pFile = (unixFile*)id; @@ -39923,7 +39923,7 @@ static int unixCheckReservedLock(sqlite3_file *id, int *pResOut){ assert( pFile ); assert( pFile->eFileLock<=SHARED_LOCK ); - sqlite3_mutex_enter(pFile->pInode->pLockMutex); + tdsqlite3_mutex_enter(pFile->pInode->pLockMutex); /* Check if a thread in this process holds such a lock */ if( pFile->pInode->eFileLock>SHARED_LOCK ){ @@ -39948,7 +39948,7 @@ static int unixCheckReservedLock(sqlite3_file *id, int *pResOut){ } #endif - sqlite3_mutex_leave(pFile->pInode->pLockMutex); + tdsqlite3_mutex_leave(pFile->pInode->pLockMutex); OSTRACE(("TEST WR-LOCK %d %d %d (unix)\n", pFile->h, rc, reserved)); *pResOut = reserved; @@ -40015,7 +40015,7 @@ static int unixFileLock(unixFile *pFile, struct flock *pLock){ int rc; unixInodeInfo *pInode = pFile->pInode; assert( pInode!=0 ); - assert( sqlite3_mutex_held(pInode->pLockMutex) ); + assert( tdsqlite3_mutex_held(pInode->pLockMutex) ); if( (pFile->ctrlFlags & (UNIXFILE_EXCL|UNIXFILE_RDONLY))==UNIXFILE_EXCL ){ if( pInode->bProcessLock==0 ){ struct flock lock; @@ -40058,10 +40058,10 @@ static int unixFileLock(unixFile *pFile, struct flock *pLock){ ** RESERVED -> (PENDING) -> EXCLUSIVE ** PENDING -> EXCLUSIVE ** -** This routine will only increase a lock. Use the sqlite3OsUnlock() +** This routine will only increase a lock. Use the tdsqlite3OsUnlock() ** routine to lower a locking level. */ -static int unixLock(sqlite3_file *id, int eFileLock){ +static int unixLock(tdsqlite3_file *id, int eFileLock){ /* The following describes the implementation of the various locks and ** lock transitions in terms of the POSIX advisory shared and exclusive ** lock primitives (called read-locks and write-locks below, to avoid @@ -40135,7 +40135,7 @@ static int unixLock(sqlite3_file *id, int eFileLock){ /* This mutex is needed because pFile->pInode is shared across threads */ pInode = pFile->pInode; - sqlite3_mutex_enter(pInode->pLockMutex); + tdsqlite3_mutex_enter(pInode->pLockMutex); /* If some thread using this PID has a lock via a different unixFile* ** handle that precludes the requested lock, return BUSY. @@ -40278,7 +40278,7 @@ static int unixLock(sqlite3_file *id, int eFileLock){ } end_lock: - sqlite3_mutex_leave(pInode->pLockMutex); + tdsqlite3_mutex_leave(pInode->pLockMutex); OSTRACE(("LOCK %d %s %s (unix)\n", pFile->h, azFileLock(eFileLock), rc==SQLITE_OK ? "ok" : "failed")); return rc; @@ -40311,7 +40311,7 @@ static void setPendingFd(unixFile *pFile){ ** around a bug in BSD NFS lockd (also seen on MacOSX 10.3+) that fails to ** remove the write lock on a region when a read lock is set. */ -static int posixUnlock(sqlite3_file *id, int eFileLock, int handleNFSUnlock){ +static int posixUnlock(tdsqlite3_file *id, int eFileLock, int handleNFSUnlock){ unixFile *pFile = (unixFile*)id; unixInodeInfo *pInode; struct flock lock; @@ -40327,7 +40327,7 @@ static int posixUnlock(sqlite3_file *id, int eFileLock, int handleNFSUnlock){ return SQLITE_OK; } pInode = pFile->pInode; - sqlite3_mutex_enter(pInode->pLockMutex); + tdsqlite3_mutex_enter(pInode->pLockMutex); assert( pInode->nShared!=0 ); if( pFile->eFileLock>SHARED_LOCK ){ assert( pInode->eFileLock==pFile->eFileLock ); @@ -40457,7 +40457,7 @@ static int posixUnlock(sqlite3_file *id, int eFileLock, int handleNFSUnlock){ } end_unlock: - sqlite3_mutex_leave(pInode->pLockMutex); + tdsqlite3_mutex_leave(pInode->pLockMutex); if( rc==SQLITE_OK ){ pFile->eFileLock = eFileLock; } @@ -40471,7 +40471,7 @@ end_unlock: ** If the locking level of the file descriptor is already at or below ** the requested locking level, this routine is a no-op. */ -static int unixUnlock(sqlite3_file *id, int eFileLock){ +static int unixUnlock(tdsqlite3_file *id, int eFileLock){ #if SQLITE_MAX_MMAP_SIZE>0 assert( eFileLock==SHARED_LOCK || ((unixFile *)id)->nFetchOut==0 ); #endif @@ -40493,7 +40493,7 @@ static void unixUnmapfile(unixFile *pFd); ** even on VxWorks. A mutex will be acquired on VxWorks by the ** vxworksReleaseFileId() routine. */ -static int closeUnixFile(sqlite3_file *id){ +static int closeUnixFile(tdsqlite3_file *id){ unixFile *pFile = (unixFile*)id; #if SQLITE_MAX_MMAP_SIZE>0 unixUnmapfile(pFile); @@ -40514,13 +40514,13 @@ static int closeUnixFile(sqlite3_file *id){ #ifdef SQLITE_UNLINK_AFTER_CLOSE if( pFile->ctrlFlags & UNIXFILE_DELETE ){ osUnlink(pFile->zPath); - sqlite3_free(*(char**)&pFile->zPath); + tdsqlite3_free(*(char**)&pFile->zPath); pFile->zPath = 0; } #endif OSTRACE(("CLOSE %-3d\n", pFile->h)); OpenCounter(-1); - sqlite3_free(pFile->pPreallocatedUnused); + tdsqlite3_free(pFile->pPreallocatedUnused); memset(pFile, 0, sizeof(unixFile)); return SQLITE_OK; } @@ -40528,7 +40528,7 @@ static int closeUnixFile(sqlite3_file *id){ /* ** Close a file. */ -static int unixClose(sqlite3_file *id){ +static int unixClose(tdsqlite3_file *id){ int rc = SQLITE_OK; unixFile *pFile = (unixFile *)id; unixInodeInfo *pInode = pFile->pInode; @@ -40543,7 +40543,7 @@ static int unixClose(sqlite3_file *id){ ** routine (e.g. nolockClose()) would be called instead. */ assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 ); - sqlite3_mutex_enter(pInode->pLockMutex); + tdsqlite3_mutex_enter(pInode->pLockMutex); if( pInode->nLock ){ /* If there are outstanding locks, do not actually close the file just ** yet because that would clear those locks. Instead, add the file @@ -40552,7 +40552,7 @@ static int unixClose(sqlite3_file *id){ */ setPendingFd(pFile); } - sqlite3_mutex_leave(pInode->pLockMutex); + tdsqlite3_mutex_leave(pInode->pLockMutex); releaseInodeInfo(pFile); rc = closeUnixFile(id); unixLeaveMutex(); @@ -40579,16 +40579,16 @@ static int unixClose(sqlite3_file *id){ ** time and one or more of those connections are writing. */ -static int nolockCheckReservedLock(sqlite3_file *NotUsed, int *pResOut){ +static int nolockCheckReservedLock(tdsqlite3_file *NotUsed, int *pResOut){ UNUSED_PARAMETER(NotUsed); *pResOut = 0; return SQLITE_OK; } -static int nolockLock(sqlite3_file *NotUsed, int NotUsed2){ +static int nolockLock(tdsqlite3_file *NotUsed, int NotUsed2){ UNUSED_PARAMETER2(NotUsed, NotUsed2); return SQLITE_OK; } -static int nolockUnlock(sqlite3_file *NotUsed, int NotUsed2){ +static int nolockUnlock(tdsqlite3_file *NotUsed, int NotUsed2){ UNUSED_PARAMETER2(NotUsed, NotUsed2); return SQLITE_OK; } @@ -40596,7 +40596,7 @@ static int nolockUnlock(sqlite3_file *NotUsed, int NotUsed2){ /* ** Close the file. */ -static int nolockClose(sqlite3_file *id) { +static int nolockClose(tdsqlite3_file *id) { return closeUnixFile(id); } @@ -40641,7 +40641,7 @@ static int nolockClose(sqlite3_file *id) { ** variation of CheckReservedLock(), *pResOut is set to true if any lock ** is held on the file and false if the file is unlocked. */ -static int dotlockCheckReservedLock(sqlite3_file *id, int *pResOut) { +static int dotlockCheckReservedLock(tdsqlite3_file *id, int *pResOut) { int rc = SQLITE_OK; int reserved = 0; unixFile *pFile = (unixFile*)id; @@ -40676,13 +40676,13 @@ static int dotlockCheckReservedLock(sqlite3_file *id, int *pResOut) { ** RESERVED -> (PENDING) -> EXCLUSIVE ** PENDING -> EXCLUSIVE ** -** This routine will only increase a lock. Use the sqlite3OsUnlock() +** This routine will only increase a lock. Use the tdsqlite3OsUnlock() ** routine to lower a locking level. ** ** With dotfile locking, we really only support state (4): EXCLUSIVE. ** But we track the other locking levels internally. */ -static int dotlockLock(sqlite3_file *id, int eFileLock) { +static int dotlockLock(tdsqlite3_file *id, int eFileLock) { unixFile *pFile = (unixFile*)id; char *zLockFile = (char *)pFile->lockingContext; int rc = SQLITE_OK; @@ -40732,7 +40732,7 @@ static int dotlockLock(sqlite3_file *id, int eFileLock) { ** ** When the locking level reaches NO_LOCK, delete the lock file. */ -static int dotlockUnlock(sqlite3_file *id, int eFileLock) { +static int dotlockUnlock(tdsqlite3_file *id, int eFileLock) { unixFile *pFile = (unixFile*)id; char *zLockFile = (char *)pFile->lockingContext; int rc; @@ -40775,11 +40775,11 @@ static int dotlockUnlock(sqlite3_file *id, int eFileLock) { /* ** Close a file. Make sure the lock has been released before closing. */ -static int dotlockClose(sqlite3_file *id) { +static int dotlockClose(tdsqlite3_file *id) { unixFile *pFile = (unixFile*)id; assert( id!=0 ); dotlockUnlock(id, NO_LOCK); - sqlite3_free(pFile->lockingContext); + tdsqlite3_free(pFile->lockingContext); return closeUnixFile(id); } /****************** End of the dot-file lock implementation ******************* @@ -40821,7 +40821,7 @@ static int robust_flock(int fd, int op){ ** to a non-zero value otherwise *pResOut is set to zero. The return value ** is set to SQLITE_OK unless an I/O error occurs during lock checking. */ -static int flockCheckReservedLock(sqlite3_file *id, int *pResOut){ +static int flockCheckReservedLock(tdsqlite3_file *id, int *pResOut){ int rc = SQLITE_OK; int reserved = 0; unixFile *pFile = (unixFile*)id; @@ -40894,14 +40894,14 @@ static int flockCheckReservedLock(sqlite3_file *id, int *pResOut){ ** PENDING -> EXCLUSIVE ** ** flock() only really support EXCLUSIVE locks. We track intermediate -** lock states in the sqlite3_file structure, but all locks SHARED or +** lock states in the tdsqlite3_file structure, but all locks SHARED or ** above are really EXCLUSIVE locks and exclude all other processes from ** access the file. ** -** This routine will only increase a lock. Use the sqlite3OsUnlock() +** This routine will only increase a lock. Use the tdsqlite3OsUnlock() ** routine to lower a locking level. */ -static int flockLock(sqlite3_file *id, int eFileLock) { +static int flockLock(tdsqlite3_file *id, int eFileLock) { int rc = SQLITE_OK; unixFile *pFile = (unixFile*)id; @@ -40945,7 +40945,7 @@ static int flockLock(sqlite3_file *id, int eFileLock) { ** If the locking level of the file descriptor is already at or below ** the requested locking level, this routine is a no-op. */ -static int flockUnlock(sqlite3_file *id, int eFileLock) { +static int flockUnlock(tdsqlite3_file *id, int eFileLock) { unixFile *pFile = (unixFile*)id; assert( pFile ); @@ -40979,7 +40979,7 @@ static int flockUnlock(sqlite3_file *id, int eFileLock) { /* ** Close a file. */ -static int flockClose(sqlite3_file *id) { +static int flockClose(tdsqlite3_file *id) { assert( id!=0 ); flockUnlock(id, NO_LOCK); return closeUnixFile(id); @@ -41008,7 +41008,7 @@ static int flockClose(sqlite3_file *id) { ** to a non-zero value otherwise *pResOut is set to zero. The return value ** is set to SQLITE_OK unless an I/O error occurs during lock checking. */ -static int semXCheckReservedLock(sqlite3_file *id, int *pResOut) { +static int semXCheckReservedLock(tdsqlite3_file *id, int *pResOut) { int rc = SQLITE_OK; int reserved = 0; unixFile *pFile = (unixFile*)id; @@ -41068,14 +41068,14 @@ static int semXCheckReservedLock(sqlite3_file *id, int *pResOut) { ** PENDING -> EXCLUSIVE ** ** Semaphore locks only really support EXCLUSIVE locks. We track intermediate -** lock states in the sqlite3_file structure, but all locks SHARED or +** lock states in the tdsqlite3_file structure, but all locks SHARED or ** above are really EXCLUSIVE locks and exclude all other processes from ** access the file. ** -** This routine will only increase a lock. Use the sqlite3OsUnlock() +** This routine will only increase a lock. Use the tdsqlite3OsUnlock() ** routine to lower a locking level. */ -static int semXLock(sqlite3_file *id, int eFileLock) { +static int semXLock(tdsqlite3_file *id, int eFileLock) { unixFile *pFile = (unixFile*)id; sem_t *pSem = pFile->pInode->pSem; int rc = SQLITE_OK; @@ -41108,7 +41108,7 @@ static int semXLock(sqlite3_file *id, int eFileLock) { ** If the locking level of the file descriptor is already at or below ** the requested locking level, this routine is a no-op. */ -static int semXUnlock(sqlite3_file *id, int eFileLock) { +static int semXUnlock(tdsqlite3_file *id, int eFileLock) { unixFile *pFile = (unixFile*)id; sem_t *pSem = pFile->pInode->pSem; @@ -41145,7 +41145,7 @@ static int semXUnlock(sqlite3_file *id, int eFileLock) { /* ** Close a file. */ -static int semXClose(sqlite3_file *id) { +static int semXClose(tdsqlite3_file *id) { if( id ){ unixFile *pFile = (unixFile*)id; semXUnlock(id, NO_LOCK); @@ -41251,7 +41251,7 @@ static int afpSetLock( ** to a non-zero value otherwise *pResOut is set to zero. The return value ** is set to SQLITE_OK unless an I/O error occurs during lock checking. */ -static int afpCheckReservedLock(sqlite3_file *id, int *pResOut){ +static int afpCheckReservedLock(tdsqlite3_file *id, int *pResOut){ int rc = SQLITE_OK; int reserved = 0; unixFile *pFile = (unixFile*)id; @@ -41265,7 +41265,7 @@ static int afpCheckReservedLock(sqlite3_file *id, int *pResOut){ *pResOut = 1; return SQLITE_OK; } - sqlite3_mutex_enter(pFile->pInode->pLockMutex); + tdsqlite3_mutex_enter(pFile->pInode->pLockMutex); /* Check if a thread in this process holds such a lock */ if( pFile->pInode->eFileLock>SHARED_LOCK ){ reserved = 1; @@ -41289,7 +41289,7 @@ static int afpCheckReservedLock(sqlite3_file *id, int *pResOut){ } } - sqlite3_mutex_leave(pFile->pInode->pLockMutex); + tdsqlite3_mutex_leave(pFile->pInode->pLockMutex); OSTRACE(("TEST WR-LOCK %d %d %d (afp)\n", pFile->h, rc, reserved)); *pResOut = reserved; @@ -41317,10 +41317,10 @@ static int afpCheckReservedLock(sqlite3_file *id, int *pResOut){ ** RESERVED -> (PENDING) -> EXCLUSIVE ** PENDING -> EXCLUSIVE ** -** This routine will only increase a lock. Use the sqlite3OsUnlock() +** This routine will only increase a lock. Use the tdsqlite3OsUnlock() ** routine to lower a locking level. */ -static int afpLock(sqlite3_file *id, int eFileLock){ +static int afpLock(tdsqlite3_file *id, int eFileLock){ int rc = SQLITE_OK; unixFile *pFile = (unixFile*)id; unixInodeInfo *pInode = pFile->pInode; @@ -41353,7 +41353,7 @@ static int afpLock(sqlite3_file *id, int eFileLock){ /* This mutex is needed because pFile->pInode is shared across threads */ pInode = pFile->pInode; - sqlite3_mutex_enter(pInode->pLockMutex); + tdsqlite3_mutex_enter(pInode->pLockMutex); /* If some thread using this PID has a lock via a different unixFile* ** handle that precludes the requested lock, return BUSY. @@ -41489,7 +41489,7 @@ static int afpLock(sqlite3_file *id, int eFileLock){ } afp_end_lock: - sqlite3_mutex_leave(pInode->pLockMutex); + tdsqlite3_mutex_leave(pInode->pLockMutex); OSTRACE(("LOCK %d %s %s (afp)\n", pFile->h, azFileLock(eFileLock), rc==SQLITE_OK ? "ok" : "failed")); return rc; @@ -41502,7 +41502,7 @@ afp_end_lock: ** If the locking level of the file descriptor is already at or below ** the requested locking level, this routine is a no-op. */ -static int afpUnlock(sqlite3_file *id, int eFileLock) { +static int afpUnlock(tdsqlite3_file *id, int eFileLock) { int rc = SQLITE_OK; unixFile *pFile = (unixFile*)id; unixInodeInfo *pInode; @@ -41522,7 +41522,7 @@ static int afpUnlock(sqlite3_file *id, int eFileLock) { return SQLITE_OK; } pInode = pFile->pInode; - sqlite3_mutex_enter(pInode->pLockMutex); + tdsqlite3_mutex_enter(pInode->pLockMutex); assert( pInode->nShared!=0 ); if( pFile->eFileLock>SHARED_LOCK ){ assert( pInode->eFileLock==pFile->eFileLock ); @@ -41595,7 +41595,7 @@ static int afpUnlock(sqlite3_file *id, int eFileLock) { } } - sqlite3_mutex_leave(pInode->pLockMutex); + tdsqlite3_mutex_leave(pInode->pLockMutex); if( rc==SQLITE_OK ){ pFile->eFileLock = eFileLock; } @@ -41605,7 +41605,7 @@ static int afpUnlock(sqlite3_file *id, int eFileLock) { /* ** Close a file & cleanup AFP specific locking context */ -static int afpClose(sqlite3_file *id) { +static int afpClose(tdsqlite3_file *id) { int rc = SQLITE_OK; unixFile *pFile = (unixFile*)id; assert( id!=0 ); @@ -41614,7 +41614,7 @@ static int afpClose(sqlite3_file *id) { unixEnterMutex(); if( pFile->pInode ){ unixInodeInfo *pInode = pFile->pInode; - sqlite3_mutex_enter(pInode->pLockMutex); + tdsqlite3_mutex_enter(pInode->pLockMutex); if( pInode->nLock ){ /* If there are outstanding locks, do not actually close the file just ** yet because that would clear those locks. Instead, add the file @@ -41623,10 +41623,10 @@ static int afpClose(sqlite3_file *id) { */ setPendingFd(pFile); } - sqlite3_mutex_leave(pInode->pLockMutex); + tdsqlite3_mutex_leave(pInode->pLockMutex); } releaseInodeInfo(pFile); - sqlite3_free(pFile->lockingContext); + tdsqlite3_free(pFile->lockingContext); rc = closeUnixFile(id); unixLeaveMutex(); return rc; @@ -41653,7 +41653,7 @@ static int afpClose(sqlite3_file *id) { ** If the locking level of the file descriptor is already at or below ** the requested locking level, this routine is a no-op. */ -static int nfsUnlock(sqlite3_file *id, int eFileLock){ +static int nfsUnlock(tdsqlite3_file *id, int eFileLock){ return posixUnlock(id, eFileLock, 1); } @@ -41667,10 +41667,10 @@ static int nfsUnlock(sqlite3_file *id, int eFileLock){ ******************************************************************************/ /****************************************************************************** -**************** Non-locking sqlite3_file methods ***************************** +**************** Non-locking tdsqlite3_file methods ***************************** ** ** The next division contains implementations for all methods of the -** sqlite3_file object other than the locking methods. The locking +** tdsqlite3_file object other than the locking methods. The locking ** methods were defined in divisions above (one locking method per ** division). Those methods that are common to all locking modes ** are gather together into this division. @@ -41689,7 +41689,7 @@ static int nfsUnlock(sqlite3_file *id, int eFileLock){ ** To avoid stomping the errno value on a failed read the lastErrno value ** is set before returning. */ -static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){ +static int seekAndRead(unixFile *id, tdsqlite3_int64 offset, void *pBuf, int cnt){ int got; int prior = 0; #if (!defined(USE_PREAD) && !defined(USE_PREAD64)) @@ -41739,10 +41739,10 @@ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){ ** wrong. */ static int unixRead( - sqlite3_file *id, + tdsqlite3_file *id, void *pBuf, int amt, - sqlite3_int64 offset + tdsqlite3_int64 offset ){ unixFile *pFile = (unixFile *)id; int got; @@ -41853,10 +41853,10 @@ static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){ ** or some other error code on failure. */ static int unixWrite( - sqlite3_file *id, + tdsqlite3_file *id, const void *pBuf, int amt, - sqlite3_int64 offset + tdsqlite3_int64 offset ){ unixFile *pFile = (unixFile*)id; int wrote = 0; @@ -41937,8 +41937,8 @@ static int unixWrite( ** Count the number of fullsyncs and normal syncs. This is used to test ** that syncs and fullsyncs are occurring at the right times. */ -SQLITE_API int sqlite3_sync_count = 0; -SQLITE_API int sqlite3_fullsync_count = 0; +SQLITE_API int tdsqlite3_sync_count = 0; +SQLITE_API int tdsqlite3_fullsync_count = 0; #endif /* @@ -42010,8 +42010,8 @@ static int full_fsync(int fd, int fullSync, int dataOnly){ ** gets called with the correct arguments. */ #ifdef SQLITE_TEST - if( fullSync ) sqlite3_fullsync_count++; - sqlite3_sync_count++; + if( fullSync ) tdsqlite3_fullsync_count++; + tdsqlite3_sync_count++; #endif /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a @@ -42088,7 +42088,7 @@ static int openDirectory(const char *zFilename, int *pFd){ int fd = -1; char zDirname[MAX_PATHNAME+1]; - sqlite3_snprintf(MAX_PATHNAME, zDirname, "%s", zFilename); + tdsqlite3_snprintf(MAX_PATHNAME, zDirname, "%s", zFilename); for(ii=(int)strlen(zDirname); ii>0 && zDirname[ii]!='/'; ii--); if( ii>0 ){ zDirname[ii] = '\0'; @@ -42120,7 +42120,7 @@ static int openDirectory(const char *zFilename, int *pFd){ ** the directory entry for the journal was never created) and the transaction ** will not roll back - possibly leading to database corruption. */ -static int unixSync(sqlite3_file *id, int flags){ +static int unixSync(tdsqlite3_file *id, int flags){ int rc; unixFile *pFile = (unixFile*)id; @@ -42170,7 +42170,7 @@ static int unixSync(sqlite3_file *id, int flags){ /* ** Truncate an open file to a specified size */ -static int unixTruncate(sqlite3_file *id, i64 nByte){ +static int unixTruncate(tdsqlite3_file *id, i64 nByte){ unixFile *pFile = (unixFile *)id; int rc; assert( pFile ); @@ -42220,7 +42220,7 @@ static int unixTruncate(sqlite3_file *id, i64 nByte){ /* ** Determine the current size of a file in bytes */ -static int unixFileSize(sqlite3_file *id, i64 *pSize){ +static int unixFileSize(tdsqlite3_file *id, i64 *pSize){ int rc; struct stat buf; assert( id ); @@ -42249,7 +42249,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){ ** Handler for proxy-locking file-control verbs. Defined below in the ** proxying locking division. */ -static int proxyFileControl(sqlite3_file*,int,void*); +static int proxyFileControl(tdsqlite3_file*,int,void*); #endif /* @@ -42343,7 +42343,7 @@ static int unixGetTempname(int nBuf, char *zBuf); /* ** Information and control of an open file handle. */ -static int unixFileControl(sqlite3_file *id, int op, void *pArg){ +static int unixFileControl(tdsqlite3_file *id, int op, void *pArg){ unixFile *pFile = (unixFile*)id; switch( op ){ #if defined(__linux__) && defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE) @@ -42389,11 +42389,11 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){ return SQLITE_OK; } case SQLITE_FCNTL_VFSNAME: { - *(char**)pArg = sqlite3_mprintf("%s", pFile->pVfs->zName); + *(char**)pArg = tdsqlite3_mprintf("%s", pFile->pVfs->zName); return SQLITE_OK; } case SQLITE_FCNTL_TEMPFILENAME: { - char *zTFile = sqlite3_malloc64( pFile->pVfs->mxPathname ); + char *zTFile = tdsqlite3_malloc64( pFile->pVfs->mxPathname ); if( zTFile ){ unixGetTempname(pFile->pVfs->mxPathname, zTFile); *(char**)pArg = zTFile; @@ -42414,8 +42414,8 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){ case SQLITE_FCNTL_MMAP_SIZE: { i64 newLimit = *(i64*)pArg; int rc = SQLITE_OK; - if( newLimit>sqlite3GlobalConfig.mxMmap ){ - newLimit = sqlite3GlobalConfig.mxMmap; + if( newLimit>tdsqlite3GlobalConfig.mxMmap ){ + newLimit = tdsqlite3GlobalConfig.mxMmap; } /* The value of newLimit may be eventually cast to (size_t) and passed @@ -42574,7 +42574,7 @@ static void setDeviceCharacteristics(unixFile *pFile){ ** a database and its journal file) that the sector size will be the ** same for both. */ -static int unixSectorSize(sqlite3_file *id){ +static int unixSectorSize(tdsqlite3_file *id){ unixFile *pFd = (unixFile*)id; setDeviceCharacteristics(pFd); return pFd->sectorSize; @@ -42593,7 +42593,7 @@ static int unixSectorSize(sqlite3_file *id){ ** Hence, while POWERSAFE_OVERWRITE is on by default, there is a file-control ** available to turn it off and URI query parameter available to turn it off. */ -static int unixDeviceCharacteristics(sqlite3_file *id){ +static int unixDeviceCharacteristics(tdsqlite3_file *id){ unixFile *pFd = (unixFile*)id; setDeviceCharacteristics(pFd); return pFd->deviceCharacteristics; @@ -42652,7 +42652,7 @@ static int unixGetpagesize(void){ */ struct unixShmNode { unixInodeInfo *pInode; /* unixInodeInfo that owns this SHM node */ - sqlite3_mutex *pShmMutex; /* Mutex to access this object */ + tdsqlite3_mutex *pShmMutex; /* Mutex to access this object */ char *zFilename; /* Name of the mmapped file */ int hShm; /* Open file descriptor */ int szRegion; /* Size of shared-memory regions */ @@ -42715,7 +42715,7 @@ static int unixShmSystemLock( /* Access to the unixShmNode object is serialized by the caller */ pShmNode = pFile->pInode->pShmNode; - assert( pShmNode->nRef==0 || sqlite3_mutex_held(pShmNode->pShmMutex) ); + assert( pShmNode->nRef==0 || tdsqlite3_mutex_held(pShmNode->pShmMutex) ); assert( pShmNode->nRef>0 || unixMutexHeld() ); /* Shared locks never span more than one byte */ @@ -42802,21 +42802,21 @@ static void unixShmPurge(unixFile *pFd){ int nShmPerMap = unixShmRegionPerMap(); int i; assert( p->pInode==pFd->pInode ); - sqlite3_mutex_free(p->pShmMutex); + tdsqlite3_mutex_free(p->pShmMutex); for(i=0; inRegion; i+=nShmPerMap){ if( p->hShm>=0 ){ osMunmap(p->apRegion[i], p->szRegion); }else{ - sqlite3_free(p->apRegion[i]); + tdsqlite3_free(p->apRegion[i]); } } - sqlite3_free(p->apRegion); + tdsqlite3_free(p->apRegion); if( p->hShm>=0 ){ robust_close(pFd, p->hShm, __LINE__); p->hShm = -1; } p->pInode->pShmNode = 0; - sqlite3_free(p); + tdsqlite3_free(p); } } @@ -42932,7 +42932,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){ int nShmFilename; /* Size of the SHM filename in bytes */ /* Allocate space for the new unixShm object. */ - p = sqlite3_malloc64( sizeof(*p) ); + p = tdsqlite3_malloc64( sizeof(*p) ); if( p==0 ) return SQLITE_NOMEM_BKPT; memset(p, 0, sizeof(*p)); assert( pDbFd->pShm==0 ); @@ -42964,7 +42964,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){ #else nShmFilename = 6 + (int)strlen(zBasePath); #endif - pShmNode = sqlite3_malloc64( sizeof(*pShmNode) + nShmFilename ); + pShmNode = tdsqlite3_malloc64( sizeof(*pShmNode) + nShmFilename ); if( pShmNode==0 ){ rc = SQLITE_NOMEM_BKPT; goto shm_open_err; @@ -42972,18 +42972,18 @@ static int unixOpenSharedMemory(unixFile *pDbFd){ memset(pShmNode, 0, sizeof(*pShmNode)+nShmFilename); zShm = pShmNode->zFilename = (char*)&pShmNode[1]; #ifdef SQLITE_SHM_DIRECTORY - sqlite3_snprintf(nShmFilename, zShm, + tdsqlite3_snprintf(nShmFilename, zShm, SQLITE_SHM_DIRECTORY "/sqlite-shm-%x-%x", (u32)sStat.st_ino, (u32)sStat.st_dev); #else - sqlite3_snprintf(nShmFilename, zShm, "%s-shm", zBasePath); - sqlite3FileSuffix3(pDbFd->zPath, zShm); + tdsqlite3_snprintf(nShmFilename, zShm, "%s-shm", zBasePath); + tdsqlite3FileSuffix3(pDbFd->zPath, zShm); #endif pShmNode->hShm = -1; pDbFd->pInode->pShmNode = pShmNode; pShmNode->pInode = pDbFd->pInode; - if( sqlite3GlobalConfig.bCoreMutex ){ - pShmNode->pShmMutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); + if( tdsqlite3GlobalConfig.bCoreMutex ){ + pShmNode->pShmMutex = tdsqlite3_mutex_alloc(SQLITE_MUTEX_FAST); if( pShmNode->pShmMutex==0 ){ rc = SQLITE_NOMEM_BKPT; goto shm_open_err; @@ -42991,7 +42991,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){ } if( pInode->bProcessLock==0 ){ - if( 0==sqlite3_uri_boolean(pDbFd->zPath, "readonly_shm", 0) ){ + if( 0==tdsqlite3_uri_boolean(pDbFd->zPath, "readonly_shm", 0) ){ pShmNode->hShm = robust_open(zShm, O_RDWR|O_CREAT|O_NOFOLLOW, (sStat.st_mode&0777)); } @@ -43032,16 +43032,16 @@ static int unixOpenSharedMemory(unixFile *pDbFd){ ** at pShmNode->pFirst. This must be done while holding the ** pShmNode->pShmMutex. */ - sqlite3_mutex_enter(pShmNode->pShmMutex); + tdsqlite3_mutex_enter(pShmNode->pShmMutex); p->pNext = pShmNode->pFirst; pShmNode->pFirst = p; - sqlite3_mutex_leave(pShmNode->pShmMutex); + tdsqlite3_mutex_leave(pShmNode->pShmMutex); return rc; /* Jump here on any error */ shm_open_err: unixShmPurge(pDbFd); /* This call frees pShmNode if required */ - sqlite3_free(p); + tdsqlite3_free(p); unixLeaveMutex(); return rc; } @@ -43066,7 +43066,7 @@ shm_open_err: ** memory and SQLITE_OK returned. */ static int unixShmMap( - sqlite3_file *fd, /* Handle open on database file */ + tdsqlite3_file *fd, /* Handle open on database file */ int iRegion, /* Region to retrieve */ int szRegion, /* Size of regions */ int bExtend, /* True to extend file if necessary */ @@ -43087,7 +43087,7 @@ static int unixShmMap( p = pDbFd->pShm; pShmNode = p->pShmNode; - sqlite3_mutex_enter(pShmNode->pShmMutex); + tdsqlite3_mutex_enter(pShmNode->pShmMutex); if( pShmNode->isUnlocked ){ rc = unixLockSharedMemory(pDbFd, pShmNode); if( rc!=SQLITE_OK ) goto shmpage_out; @@ -43152,7 +43152,7 @@ static int unixShmMap( } /* Map the requested memory region into this processes address space. */ - apNew = (char **)sqlite3_realloc( + apNew = (char **)tdsqlite3_realloc( pShmNode->apRegion, nReqRegion*sizeof(char *) ); if( !apNew ){ @@ -43174,7 +43174,7 @@ static int unixShmMap( goto shmpage_out; } }else{ - pMem = sqlite3_malloc64(nMap); + pMem = tdsqlite3_malloc64(nMap); if( pMem==0 ){ rc = SQLITE_NOMEM_BKPT; goto shmpage_out; @@ -43196,7 +43196,7 @@ shmpage_out: *pp = 0; } if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY; - sqlite3_mutex_leave(pShmNode->pShmMutex); + tdsqlite3_mutex_leave(pShmNode->pShmMutex); return rc; } @@ -43209,7 +43209,7 @@ shmpage_out: ** not go from shared to exclusive or from exclusive to shared. */ static int unixShmLock( - sqlite3_file *fd, /* Database file holding the shared memory */ + tdsqlite3_file *fd, /* Database file holding the shared memory */ int ofst, /* First lock to acquire or release */ int n, /* Number of locks to acquire or release */ int flags /* What to do with the lock */ @@ -43235,7 +43235,7 @@ static int unixShmLock( mask = (1<<(ofst+n)) - (1<1 || mask==(1<pShmMutex); + tdsqlite3_mutex_enter(pShmNode->pShmMutex); if( flags & SQLITE_SHM_UNLOCK ){ u16 allMask = 0; /* Mask of locks held by siblings */ @@ -43308,7 +43308,7 @@ static int unixShmLock( } } } - sqlite3_mutex_leave(pShmNode->pShmMutex); + tdsqlite3_mutex_leave(pShmNode->pShmMutex); OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %03x,%03x\n", p->id, osGetpid(0), p->sharedMask, p->exclMask)); return rc; @@ -43321,10 +43321,10 @@ static int unixShmLock( ** any load or store begun after the barrier. */ static void unixShmBarrier( - sqlite3_file *fd /* Database file holding the shared memory */ + tdsqlite3_file *fd /* Database file holding the shared memory */ ){ UNUSED_PARAMETER(fd); - sqlite3MemoryBarrier(); /* compiler-defined memory barrier */ + tdsqlite3MemoryBarrier(); /* compiler-defined memory barrier */ assert( fd->pMethods->xLock==nolockLock || unixFileMutexNotheld((unixFile*)fd) ); @@ -43340,7 +43340,7 @@ static void unixShmBarrier( ** routine is a harmless no-op. */ static int unixShmUnmap( - sqlite3_file *fd, /* The underlying database file */ + tdsqlite3_file *fd, /* The underlying database file */ int deleteFlag /* Delete shared-memory if true */ ){ unixShm *p; /* The connection to be closed */ @@ -43358,14 +43358,14 @@ static int unixShmUnmap( /* Remove connection p from the set of connections associated ** with pShmNode */ - sqlite3_mutex_enter(pShmNode->pShmMutex); + tdsqlite3_mutex_enter(pShmNode->pShmMutex); for(pp=&pShmNode->pFirst; (*pp)!=p; pp = &(*pp)->pNext){} *pp = p->pNext; /* Free the connection p */ - sqlite3_free(p); + tdsqlite3_free(p); pDbFd->pShm = 0; - sqlite3_mutex_leave(pShmNode->pShmMutex); + tdsqlite3_mutex_leave(pShmNode->pShmMutex); /* If pShmNode->nRef has reached 0, then close the underlying ** shared-memory file, too */ @@ -43416,7 +43416,7 @@ static void unixUnmapfile(unixFile *pFd){ ** unixFile.mmapSize ** unixFile.mmapSizeActual ** -** If unsuccessful, an error message is logged via sqlite3_log() and +** If unsuccessful, an error message is logged via tdsqlite3_log() and ** the three variables above are zeroed. In this case SQLite should ** continue accessing the database using the xRead() and xWrite() ** methods. @@ -43550,7 +43550,7 @@ static int unixMapfile(unixFile *pFd, i64 nMap){ ** If this function does return a pointer, the caller must eventually ** release the reference by calling unixUnfetch(). */ -static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){ +static int unixFetch(tdsqlite3_file *fd, i64 iOff, int nAmt, void **pp){ #if SQLITE_MAX_MMAP_SIZE>0 unixFile *pFd = (unixFile *)fd; /* The underlying database file */ #endif @@ -43581,7 +43581,7 @@ static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){ ** to inform the VFS layer that, according to POSIX, any existing mapping ** may now be invalid and should be unmapped. */ -static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){ +static int unixUnfetch(tdsqlite3_file *fd, i64 iOff, void *p){ #if SQLITE_MAX_MMAP_SIZE>0 unixFile *pFd = (unixFile *)fd; /* The underlying database file */ UNUSED_PARAMETER(iOff); @@ -43610,20 +43610,20 @@ static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){ } /* -** Here ends the implementation of all sqlite3_file methods. +** Here ends the implementation of all tdsqlite3_file methods. ** -********************** End sqlite3_file Methods ******************************* +********************** End tdsqlite3_file Methods ******************************* ******************************************************************************/ /* -** This division contains definitions of sqlite3_io_methods objects that +** This division contains definitions of tdsqlite3_io_methods objects that ** implement various file locking strategies. It also contains definitions ** of "finder" functions. A finder-function is used to locate the appropriate -** sqlite3_io_methods object for a particular database file. The pAppData -** field of the sqlite3_vfs VFS objects are initialized to be pointers to +** tdsqlite3_io_methods object for a particular database file. The pAppData +** field of the tdsqlite3_vfs VFS objects are initialized to be pointers to ** the correct finder-function for that VFS. ** -** Most finder functions return a pointer to a fixed sqlite3_io_methods +** Most finder functions return a pointer to a fixed tdsqlite3_io_methods ** object. The only interesting finder-function is autolockIoFinder, which ** looks at the filesystem type and tries to guess the best locking ** strategy from that. @@ -43643,14 +43643,14 @@ static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){ ** ** Each instance of this macro generates two objects: ** -** * A constant sqlite3_io_methods object call METHOD that has locking +** * A constant tdsqlite3_io_methods object call METHOD that has locking ** methods CLOSE, LOCK, UNLOCK, CKRESLOCK. ** ** * An I/O method finder function called FINDER that returns a pointer ** to the METHOD object in the previous bullet. */ #define IOMETHODS(FINDER,METHOD,VERSION,CLOSE,LOCK,UNLOCK,CKLOCK,SHMMAP) \ -static const sqlite3_io_methods METHOD = { \ +static const tdsqlite3_io_methods METHOD = { \ VERSION, /* iVersion */ \ CLOSE, /* xClose */ \ unixRead, /* xRead */ \ @@ -43671,21 +43671,21 @@ static const sqlite3_io_methods METHOD = { \ unixFetch, /* xFetch */ \ unixUnfetch, /* xUnfetch */ \ }; \ -static const sqlite3_io_methods *FINDER##Impl(const char *z, unixFile *p){ \ +static const tdsqlite3_io_methods *FINDER##Impl(const char *z, unixFile *p){ \ UNUSED_PARAMETER(z); UNUSED_PARAMETER(p); \ return &METHOD; \ } \ -static const sqlite3_io_methods *(*const FINDER)(const char*,unixFile *p) \ +static const tdsqlite3_io_methods *(*const FINDER)(const char*,unixFile *p) \ = FINDER##Impl; /* -** Here are all of the sqlite3_io_methods objects for each of the +** Here are all of the tdsqlite3_io_methods objects for each of the ** locking strategies. Functions that return pointers to these methods ** are also created. */ IOMETHODS( posixIoFinder, /* Finder function name */ - posixIoMethods, /* sqlite3_io_methods object name */ + posixIoMethods, /* tdsqlite3_io_methods object name */ 3, /* shared memory and mmap are enabled */ unixClose, /* xClose method */ unixLock, /* xLock method */ @@ -43695,7 +43695,7 @@ IOMETHODS( ) IOMETHODS( nolockIoFinder, /* Finder function name */ - nolockIoMethods, /* sqlite3_io_methods object name */ + nolockIoMethods, /* tdsqlite3_io_methods object name */ 3, /* shared memory and mmap are enabled */ nolockClose, /* xClose method */ nolockLock, /* xLock method */ @@ -43705,7 +43705,7 @@ IOMETHODS( ) IOMETHODS( dotlockIoFinder, /* Finder function name */ - dotlockIoMethods, /* sqlite3_io_methods object name */ + dotlockIoMethods, /* tdsqlite3_io_methods object name */ 1, /* shared memory is disabled */ dotlockClose, /* xClose method */ dotlockLock, /* xLock method */ @@ -43717,7 +43717,7 @@ IOMETHODS( #if SQLITE_ENABLE_LOCKING_STYLE IOMETHODS( flockIoFinder, /* Finder function name */ - flockIoMethods, /* sqlite3_io_methods object name */ + flockIoMethods, /* tdsqlite3_io_methods object name */ 1, /* shared memory is disabled */ flockClose, /* xClose method */ flockLock, /* xLock method */ @@ -43730,7 +43730,7 @@ IOMETHODS( #if OS_VXWORKS IOMETHODS( semIoFinder, /* Finder function name */ - semIoMethods, /* sqlite3_io_methods object name */ + semIoMethods, /* tdsqlite3_io_methods object name */ 1, /* shared memory is disabled */ semXClose, /* xClose method */ semXLock, /* xLock method */ @@ -43743,7 +43743,7 @@ IOMETHODS( #if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE IOMETHODS( afpIoFinder, /* Finder function name */ - afpIoMethods, /* sqlite3_io_methods object name */ + afpIoMethods, /* tdsqlite3_io_methods object name */ 1, /* shared memory is disabled */ afpClose, /* xClose method */ afpLock, /* xLock method */ @@ -43759,17 +43759,17 @@ IOMETHODS( ** it uses proxy, dot-file, AFP, and flock() locking methods on those ** secondary files. For this reason, the division that implements ** proxy locking is located much further down in the file. But we need -** to go ahead and define the sqlite3_io_methods and finder function +** to go ahead and define the tdsqlite3_io_methods and finder function ** for proxy locking here. So we forward declare the I/O methods. */ #if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE -static int proxyClose(sqlite3_file*); -static int proxyLock(sqlite3_file*, int); -static int proxyUnlock(sqlite3_file*, int); -static int proxyCheckReservedLock(sqlite3_file*, int*); +static int proxyClose(tdsqlite3_file*); +static int proxyLock(tdsqlite3_file*, int); +static int proxyUnlock(tdsqlite3_file*, int); +static int proxyCheckReservedLock(tdsqlite3_file*, int*); IOMETHODS( proxyIoFinder, /* Finder function name */ - proxyIoMethods, /* sqlite3_io_methods object name */ + proxyIoMethods, /* tdsqlite3_io_methods object name */ 1, /* shared memory is disabled */ proxyClose, /* xClose method */ proxyLock, /* xLock method */ @@ -43783,7 +43783,7 @@ IOMETHODS( #if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE IOMETHODS( nfsIoFinder, /* Finder function name */ - nfsIoMethods, /* sqlite3_io_methods object name */ + nfsIoMethods, /* tdsqlite3_io_methods object name */ 1, /* shared memory is disabled */ unixClose, /* xClose method */ unixLock, /* xLock method */ @@ -43796,18 +43796,18 @@ IOMETHODS( #if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE /* ** This "finder" function attempts to determine the best locking strategy -** for the database file "filePath". It then returns the sqlite3_io_methods +** for the database file "filePath". It then returns the tdsqlite3_io_methods ** object that implements that strategy. ** ** This is for MacOSX only. */ -static const sqlite3_io_methods *autolockIoFinderImpl( +static const tdsqlite3_io_methods *autolockIoFinderImpl( const char *filePath, /* name of the database file */ unixFile *pNew /* open file object for the database file */ ){ static const struct Mapping { const char *zFilesystem; /* Filesystem type name */ - const sqlite3_io_methods *pMethods; /* Appropriate locking method */ + const tdsqlite3_io_methods *pMethods; /* Appropriate locking method */ } aMap[] = { { "hfs", &posixIoMethods }, { "ufs", &posixIoMethods }, @@ -43854,7 +43854,7 @@ static const sqlite3_io_methods *autolockIoFinderImpl( return &dotlockIoMethods; } } -static const sqlite3_io_methods +static const tdsqlite3_io_methods *(*const autolockIoFinder)(const char*,unixFile*) = autolockIoFinderImpl; #endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */ @@ -43865,7 +43865,7 @@ static const sqlite3_io_methods ** locking works. If it does, then that is what is used. If it does not ** work, then fallback to named semaphore locking. */ -static const sqlite3_io_methods *vxworksIoFinderImpl( +static const tdsqlite3_io_methods *vxworksIoFinderImpl( const char *filePath, /* name of the database file */ unixFile *pNew /* the open file object */ ){ @@ -43890,7 +43890,7 @@ static const sqlite3_io_methods *vxworksIoFinderImpl( return &semIoMethods; } } -static const sqlite3_io_methods +static const tdsqlite3_io_methods *(*const vxworksIoFinder)(const char*,unixFile*) = vxworksIoFinderImpl; #endif /* OS_VXWORKS */ @@ -43898,27 +43898,27 @@ static const sqlite3_io_methods /* ** An abstract type for a pointer to an IO method finder function: */ -typedef const sqlite3_io_methods *(*finder_type)(const char*,unixFile*); +typedef const tdsqlite3_io_methods *(*finder_type)(const char*,unixFile*); /**************************************************************************** -**************************** sqlite3_vfs methods **************************** +**************************** tdsqlite3_vfs methods **************************** ** ** This division contains the implementation of methods on the -** sqlite3_vfs object. +** tdsqlite3_vfs object. */ /* ** Initialize the contents of the unixFile structure pointed to by pId. */ static int fillInUnixFile( - sqlite3_vfs *pVfs, /* Pointer to vfs object */ + tdsqlite3_vfs *pVfs, /* Pointer to vfs object */ int h, /* Open file descriptor of file being opened */ - sqlite3_file *pId, /* Write to the unixFile structure here */ + tdsqlite3_file *pId, /* Write to the unixFile structure here */ const char *zFilename, /* Name of the file being opened */ int ctrlFlags /* Zero or more UNIXFILE_* values */ ){ - const sqlite3_io_methods *pLockingStyle; + const tdsqlite3_io_methods *pLockingStyle; unixFile *pNew = (unixFile *)pId; int rc = SQLITE_OK; @@ -43933,9 +43933,9 @@ static int fillInUnixFile( pNew->zPath = zFilename; pNew->ctrlFlags = (u8)ctrlFlags; #if SQLITE_MAX_MMAP_SIZE>0 - pNew->mmapSizeMax = sqlite3GlobalConfig.szMmap; + pNew->mmapSizeMax = tdsqlite3GlobalConfig.szMmap; #endif - if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0), + if( tdsqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0), "psow", SQLITE_POWERSAFE_OVERWRITE) ){ pNew->ctrlFlags |= UNIXFILE_PSOW; } @@ -44001,7 +44001,7 @@ static int fillInUnixFile( ** the afpLockingContext. */ afpLockingContext *pCtx; - pNew->lockingContext = pCtx = sqlite3_malloc64( sizeof(*pCtx) ); + pNew->lockingContext = pCtx = tdsqlite3_malloc64( sizeof(*pCtx) ); if( pCtx==0 ){ rc = SQLITE_NOMEM_BKPT; }else{ @@ -44014,7 +44014,7 @@ static int fillInUnixFile( unixEnterMutex(); rc = findInodeInfo(pNew, &pNew->pInode); if( rc!=SQLITE_OK ){ - sqlite3_free(pNew->lockingContext); + tdsqlite3_free(pNew->lockingContext); robust_close(pNew, h, __LINE__); h = -1; } @@ -44031,11 +44031,11 @@ static int fillInUnixFile( int nFilename; assert( zFilename!=0 ); nFilename = (int)strlen(zFilename) + 6; - zLockFile = (char *)sqlite3_malloc64(nFilename); + zLockFile = (char *)tdsqlite3_malloc64(nFilename); if( zLockFile==0 ){ rc = SQLITE_NOMEM_BKPT; }else{ - sqlite3_snprintf(nFilename, zLockFile, "%s" DOTLOCK_SUFFIX, zFilename); + tdsqlite3_snprintf(nFilename, zLockFile, "%s" DOTLOCK_SUFFIX, zFilename); } pNew->lockingContext = zLockFile; } @@ -44050,7 +44050,7 @@ static int fillInUnixFile( if( (rc==SQLITE_OK) && (pNew->pInode->pSem==NULL) ){ char *zSemName = pNew->pInode->aSemName; int n; - sqlite3_snprintf(MAX_PATHNAME, zSemName, "/%s.sem", + tdsqlite3_snprintf(MAX_PATHNAME, zSemName, "/%s.sem", pNew->pId->zCanonicalName); for( n=1; zSemName[n]; n++ ) if( zSemName[n]=='/' ) zSemName[n] = '_'; @@ -44098,7 +44098,7 @@ static const char *unixTempFileDir(void){ }; unsigned int i = 0; struct stat buf; - const char *zDir = sqlite3_temp_directory; + const char *zDir = tdsqlite3_temp_directory; if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR"); if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); @@ -44136,10 +44136,10 @@ static int unixGetTempname(int nBuf, char *zBuf){ if( zDir==0 ) return SQLITE_IOERR_GETTEMPPATH; do{ u64 r; - sqlite3_randomness(sizeof(r), &r); + tdsqlite3_randomness(sizeof(r), &r); assert( nBuf>2 ); zBuf[nBuf-2] = 0; - sqlite3_snprintf(nBuf, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX"%llx%c", + tdsqlite3_snprintf(nBuf, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX"%llx%c", zDir, r, 0); if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ) return SQLITE_ERROR; }while( osAccess(zBuf,0)==0 ); @@ -44202,15 +44202,15 @@ static UnixUnusedFd *findReusableFd(const char *zPath, int flags){ } if( pInode ){ UnixUnusedFd **pp; - assert( sqlite3_mutex_notheld(pInode->pLockMutex) ); - sqlite3_mutex_enter(pInode->pLockMutex); + assert( tdsqlite3_mutex_notheld(pInode->pLockMutex) ); + tdsqlite3_mutex_enter(pInode->pLockMutex); flags &= (SQLITE_OPEN_READONLY|SQLITE_OPEN_READWRITE); for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext)); pUnused = *pp; if( pUnused ){ *pp = pUnused->pNext; } - sqlite3_mutex_leave(pInode->pLockMutex); + tdsqlite3_mutex_leave(pInode->pLockMutex); } } unixLeaveMutex(); @@ -44287,7 +44287,7 @@ static int findCreateFileMode( ** where NN is a decimal number. The NN naming schemes are ** used by the test_multiplex.c module. */ - nDb = sqlite3Strlen30(zPath) - 1; + nDb = tdsqlite3Strlen30(zPath) - 1; while( zPath[nDb]!='-' ){ /* In normal operation, the journal file name will always contain ** a '-' character. However in 8+3 filename mode, or if a corrupt @@ -44307,7 +44307,7 @@ static int findCreateFileMode( ** filename, check for the "modeof" parameter. If present, interpret ** its value as a filename and try to copy the mode, uid and gid from ** that file. */ - const char *z = sqlite3_uri_parameter(zPath, "modeof"); + const char *z = tdsqlite3_uri_parameter(zPath, "modeof"); if( z ){ rc = getFileMode(z, pMode, pUid, pGid); } @@ -44321,9 +44321,9 @@ static int findCreateFileMode( ** Previously, the SQLite OS layer used three functions in place of this ** one: ** -** sqlite3OsOpenReadWrite(); -** sqlite3OsOpenReadOnly(); -** sqlite3OsOpenExclusive(); +** tdsqlite3OsOpenReadWrite(); +** tdsqlite3OsOpenReadOnly(); +** tdsqlite3OsOpenExclusive(); ** ** These calls correspond to the following combinations of flags: ** @@ -44338,9 +44338,9 @@ static int findCreateFileMode( ** OpenExclusive(). */ static int unixOpen( - sqlite3_vfs *pVfs, /* The VFS for which this is the xOpen method */ + tdsqlite3_vfs *pVfs, /* The VFS for which this is the xOpen method */ const char *zPath, /* Pathname of file to be opened */ - sqlite3_file *pFile, /* The file descriptor to be filled in */ + tdsqlite3_file *pFile, /* The file descriptor to be filled in */ int flags, /* Input flags to control the opening */ int *pOutFlags /* Output flags returned to SQLite core */ ){ @@ -44413,7 +44413,7 @@ static int unixOpen( */ if( randomnessPid!=osGetpid(0) ){ randomnessPid = osGetpid(0); - sqlite3_randomness(0,0); + tdsqlite3_randomness(0,0); } memset(p, 0, sizeof(unixFile)); @@ -44423,7 +44423,7 @@ static int unixOpen( if( pUnused ){ fd = pUnused->fd; }else{ - pUnused = sqlite3_malloc64(sizeof(*pUnused)); + pUnused = tdsqlite3_malloc64(sizeof(*pUnused)); if( !pUnused ){ return SQLITE_NOMEM_BKPT; } @@ -44432,7 +44432,7 @@ static int unixOpen( /* Database filenames are double-zero terminated if they are not ** URIs with parameters. Hence, they can always be passed into - ** sqlite3_uri_parameter(). */ + ** tdsqlite3_uri_parameter(). */ assert( (flags & SQLITE_OPEN_URI) || zName[strlen(zName)+1]==0 ); }else if( !zName ){ @@ -44445,7 +44445,7 @@ static int unixOpen( zName = zTmpname; /* Generated temporary filenames are always double-zero terminated - ** for use by sqlite3_uri_parameter(). */ + ** for use by tdsqlite3_uri_parameter(). */ assert( zName[strlen(zName)+1]==0 ); } @@ -44524,7 +44524,7 @@ static int unixOpen( #if OS_VXWORKS zPath = zName; #elif defined(SQLITE_UNLINK_AFTER_CLOSE) - zPath = sqlite3_mprintf("%s", zName); + zPath = tdsqlite3_mprintf("%s", zName); if( zPath==0 ){ robust_close(p, fd, __LINE__); return SQLITE_NOMEM_BKPT; @@ -44583,7 +44583,7 @@ static int unixOpen( if( rc!=SQLITE_OK ){ /* Use unixClose to clean up the resources added in fillInUnixFile ** and clear all the structure's references. Specifically, - ** pFile->pMethods will be NULL so sqlite3OsClose will be a no-op + ** pFile->pMethods will be NULL so tdsqlite3OsClose will be a no-op */ unixClose(pFile); return rc; @@ -44601,7 +44601,7 @@ static int unixOpen( open_finished: if( rc!=SQLITE_OK ){ - sqlite3_free(p->pPreallocatedUnused); + tdsqlite3_free(p->pPreallocatedUnused); } return rc; } @@ -44612,7 +44612,7 @@ open_finished: ** the directory after deleting the file. */ static int unixDelete( - sqlite3_vfs *NotUsed, /* VFS containing this as the xDelete method */ + tdsqlite3_vfs *NotUsed, /* VFS containing this as the xDelete method */ const char *zPath, /* Name of file to be deleted */ int dirSync /* If true, fsync() directory after deleting file */ ){ @@ -44660,7 +44660,7 @@ static int unixDelete( ** Otherwise return 0. */ static int unixAccess( - sqlite3_vfs *NotUsed, /* The VFS containing this xAccess method */ + tdsqlite3_vfs *NotUsed, /* The VFS containing this xAccess method */ const char *zPath, /* Path of the file to examine */ int flags, /* What do we want to learn about the zPath file? */ int *pResOut /* Write result boolean here */ @@ -44691,13 +44691,13 @@ static int mkFullPathname( char *zOut, /* Output buffer */ int nOut /* Allocated size of buffer zOut */ ){ - int nPath = sqlite3Strlen30(zPath); + int nPath = tdsqlite3Strlen30(zPath); int iOff = 0; if( zPath[0]!='/' ){ if( osGetcwd(zOut, nOut-2)==0 ){ return unixLogError(SQLITE_CANTOPEN_BKPT, "getcwd", zPath); } - iOff = sqlite3Strlen30(zOut); + iOff = tdsqlite3Strlen30(zOut); zOut[iOff++] = '/'; } if( (iOff+nPath+1)>nOut ){ @@ -44706,7 +44706,7 @@ static int mkFullPathname( zOut[iOff] = '\0'; return SQLITE_CANTOPEN_BKPT; } - sqlite3_snprintf(nOut-iOff, &zOut[iOff], "%s", zPath); + tdsqlite3_snprintf(nOut-iOff, &zOut[iOff], "%s", zPath); return SQLITE_OK; } @@ -44715,12 +44715,12 @@ static int mkFullPathname( ** is stored as a nul-terminated string in the buffer pointed to by ** zPath. ** -** zOut points to a buffer of at least sqlite3_vfs.mxPathname bytes +** zOut points to a buffer of at least tdsqlite3_vfs.mxPathname bytes ** (in this case, MAX_PATHNAME bytes). The full-path is written to ** this buffer before returning. */ static int unixFullPathname( - sqlite3_vfs *pVfs, /* Pointer to vfs object */ + tdsqlite3_vfs *pVfs, /* Pointer to vfs object */ const char *zPath, /* Possibly relative input path */ int nOut, /* Size of output buffer in bytes */ char *zOut /* Output buffer */ @@ -44761,7 +44761,7 @@ static int unixFullPathname( if( bLink ){ nLink++; if( zDel==0 ){ - zDel = sqlite3_malloc(nOut); + zDel = tdsqlite3_malloc(nOut); if( zDel==0 ) rc = SQLITE_NOMEM_BKPT; }else if( nLink>=SQLITE_MAX_SYMLINKS ){ rc = SQLITE_CANTOPEN_BKPT; @@ -44774,7 +44774,7 @@ static int unixFullPathname( }else{ if( zDel[0]!='/' ){ int n; - for(n = sqlite3Strlen30(zIn); n>0 && zIn[n-1]!='/'; n--); + for(n = tdsqlite3Strlen30(zIn); n>0 && zIn[n-1]!='/'; n--); if( nByte+n+1>nOut ){ rc = SQLITE_CANTOPEN_BKPT; }else{ @@ -44798,7 +44798,7 @@ static int unixFullPathname( zIn = zOut; }while( rc==SQLITE_OK ); - sqlite3_free(zDel); + tdsqlite3_free(zDel); if( rc==SQLITE_OK && nLink ) rc = SQLITE_OK_SYMLINK; return rc; #endif /* HAVE_READLINK && HAVE_LSTAT */ @@ -44811,7 +44811,7 @@ static int unixFullPathname( ** within the shared library, and closing the shared library. */ #include -static void *unixDlOpen(sqlite3_vfs *NotUsed, const char *zFilename){ +static void *unixDlOpen(tdsqlite3_vfs *NotUsed, const char *zFilename){ UNUSED_PARAMETER(NotUsed); return dlopen(zFilename, RTLD_NOW | RTLD_GLOBAL); } @@ -44823,17 +44823,17 @@ static void *unixDlOpen(sqlite3_vfs *NotUsed, const char *zFilename){ ** is available, zBufOut is left unmodified and SQLite uses a default ** error message. */ -static void unixDlError(sqlite3_vfs *NotUsed, int nBuf, char *zBufOut){ +static void unixDlError(tdsqlite3_vfs *NotUsed, int nBuf, char *zBufOut){ const char *zErr; UNUSED_PARAMETER(NotUsed); unixEnterMutex(); zErr = dlerror(); if( zErr ){ - sqlite3_snprintf(nBuf, zBufOut, "%s", zErr); + tdsqlite3_snprintf(nBuf, zBufOut, "%s", zErr); } unixLeaveMutex(); } -static void (*unixDlSym(sqlite3_vfs *NotUsed, void *p, const char*zSym))(void){ +static void (*unixDlSym(tdsqlite3_vfs *NotUsed, void *p, const char*zSym))(void){ /* ** GCC with -pedantic-errors says that C90 does not allow a void* to be ** cast into a pointer to a function. And yet the library dlsym() routine @@ -44856,7 +44856,7 @@ static void (*unixDlSym(sqlite3_vfs *NotUsed, void *p, const char*zSym))(void){ x = (void(*(*)(void*,const char*))(void))dlsym; return (*x)(p, zSym); } -static void unixDlClose(sqlite3_vfs *NotUsed, void *pHandle){ +static void unixDlClose(tdsqlite3_vfs *NotUsed, void *pHandle){ UNUSED_PARAMETER(NotUsed); dlclose(pHandle); } @@ -44870,7 +44870,7 @@ static void unixDlClose(sqlite3_vfs *NotUsed, void *pHandle){ /* ** Write nBuf bytes of random data to the supplied buffer zBuf. */ -static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){ +static int unixRandomness(tdsqlite3_vfs *NotUsed, int nBuf, char *zBuf){ UNUSED_PARAMETER(NotUsed); assert((size_t)nBuf>=(sizeof(time_t)+sizeof(int))); @@ -44917,7 +44917,7 @@ static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){ ** might be greater than or equal to the argument, but not less ** than the argument. */ -static int unixSleep(sqlite3_vfs *NotUsed, int microseconds){ +static int unixSleep(tdsqlite3_vfs *NotUsed, int microseconds){ #if OS_VXWORKS struct timespec sp; @@ -44941,10 +44941,10 @@ static int unixSleep(sqlite3_vfs *NotUsed, int microseconds){ /* ** The following variable, if set to a non-zero value, is interpreted as ** the number of seconds since 1970 and is used to set the result of -** sqlite3OsCurrentTime() during testing. +** tdsqlite3OsCurrentTime() during testing. */ #ifdef SQLITE_TEST -SQLITE_API int sqlite3_current_time = 0; /* Fake system time in seconds since 1970. */ +SQLITE_API int tdsqlite3_current_time = 0; /* Fake system time in seconds since 1970. */ #endif /* @@ -44957,26 +44957,26 @@ SQLITE_API int sqlite3_current_time = 0; /* Fake system time in seconds since 1 ** On success, return SQLITE_OK. Return SQLITE_ERROR if the time and date ** cannot be found. */ -static int unixCurrentTimeInt64(sqlite3_vfs *NotUsed, sqlite3_int64 *piNow){ - static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000; +static int unixCurrentTimeInt64(tdsqlite3_vfs *NotUsed, tdsqlite3_int64 *piNow){ + static const tdsqlite3_int64 unixEpoch = 24405875*(tdsqlite3_int64)8640000; int rc = SQLITE_OK; #if defined(NO_GETTOD) time_t t; time(&t); - *piNow = ((sqlite3_int64)t)*1000 + unixEpoch; + *piNow = ((tdsqlite3_int64)t)*1000 + unixEpoch; #elif OS_VXWORKS struct timespec sNow; clock_gettime(CLOCK_REALTIME, &sNow); - *piNow = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_nsec/1000000; + *piNow = unixEpoch + 1000*(tdsqlite3_int64)sNow.tv_sec + sNow.tv_nsec/1000000; #else struct timeval sNow; (void)gettimeofday(&sNow, 0); /* Cannot fail given valid arguments */ - *piNow = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_usec/1000; + *piNow = unixEpoch + 1000*(tdsqlite3_int64)sNow.tv_sec + sNow.tv_usec/1000; #endif #ifdef SQLITE_TEST - if( sqlite3_current_time ){ - *piNow = 1000*(sqlite3_int64)sqlite3_current_time + unixEpoch; + if( tdsqlite3_current_time ){ + *piNow = 1000*(tdsqlite3_int64)tdsqlite3_current_time + unixEpoch; } #endif UNUSED_PARAMETER(NotUsed); @@ -44989,8 +44989,8 @@ static int unixCurrentTimeInt64(sqlite3_vfs *NotUsed, sqlite3_int64 *piNow){ ** current time and date as a Julian Day number into *prNow and ** return 0. Return 1 if the time and date cannot be found. */ -static int unixCurrentTime(sqlite3_vfs *NotUsed, double *prNow){ - sqlite3_int64 i = 0; +static int unixCurrentTime(tdsqlite3_vfs *NotUsed, double *prNow){ + tdsqlite3_int64 i = 0; int rc; UNUSED_PARAMETER(NotUsed); rc = unixCurrentTimeInt64(0, &i); @@ -45007,7 +45007,7 @@ static int unixCurrentTime(sqlite3_vfs *NotUsed, double *prNow){ ** during SQLite operation. Only the integer return code is currently ** used. */ -static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){ +static int unixGetLastError(tdsqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){ UNUSED_PARAMETER(NotUsed); UNUSED_PARAMETER(NotUsed2); UNUSED_PARAMETER(NotUsed3); @@ -45016,7 +45016,7 @@ static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){ /* -************************ End of sqlite3_vfs methods *************************** +************************ End of tdsqlite3_vfs methods *************************** ******************************************************************************/ /****************************************************************************** @@ -45069,9 +45069,9 @@ static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){ ** ** C APIs ** -** sqlite3_file_control(db, dbname, SQLITE_FCNTL_SET_LOCKPROXYFILE, +** tdsqlite3_file_control(db, dbname, SQLITE_FCNTL_SET_LOCKPROXYFILE, ** | ":auto:"); -** sqlite3_file_control(db, dbname, SQLITE_FCNTL_GET_LOCKPROXYFILE, +** tdsqlite3_file_control(db, dbname, SQLITE_FCNTL_GET_LOCKPROXYFILE, ** &); ** ** @@ -45188,7 +45188,7 @@ struct proxyLockingContext { int conchHeld; /* 1 if the conch is held, -1 if lockless */ int nFails; /* Number of conch taking failures */ void *oldLockingContext; /* Original lockingcontext to restore on close */ - sqlite3_io_methods const *pOldMethod; /* Original I/O methods for close */ + tdsqlite3_io_methods const *pOldMethod; /* Original I/O methods for close */ }; /* @@ -45272,7 +45272,7 @@ static int proxyCreateLockPath(const char *lockPath){ /* ** Create a new VFS file descriptor (stored in memory obtained from -** sqlite3_malloc) and open the file named "path" in the file descriptor. +** tdsqlite3_malloc) and open the file named "path" in the file descriptor. ** ** The caller is responsible not only for closing the file descriptor ** but also for freeing the memory associated with the file descriptor. @@ -45286,7 +45286,7 @@ static int proxyCreateUnixFile( unixFile *pNew; int rc = SQLITE_OK; int openFlags = O_RDWR | O_CREAT | O_NOFOLLOW; - sqlite3_vfs dummyVfs; + tdsqlite3_vfs dummyVfs; int terrno = 0; UnixUnusedFd *pUnused = NULL; @@ -45300,7 +45300,7 @@ static int proxyCreateUnixFile( if( pUnused ){ fd = pUnused->fd; }else{ - pUnused = sqlite3_malloc64(sizeof(*pUnused)); + pUnused = tdsqlite3_malloc64(sizeof(*pUnused)); if( !pUnused ){ return SQLITE_NOMEM_BKPT; } @@ -45333,7 +45333,7 @@ static int proxyCreateUnixFile( } } - pNew = (unixFile *)sqlite3_malloc64(sizeof(*pNew)); + pNew = (unixFile *)tdsqlite3_malloc64(sizeof(*pNew)); if( pNew==NULL ){ rc = SQLITE_NOMEM_BKPT; goto end_create_proxy; @@ -45347,21 +45347,21 @@ static int proxyCreateUnixFile( pUnused->flags = openFlags; pNew->pPreallocatedUnused = pUnused; - rc = fillInUnixFile(&dummyVfs, fd, (sqlite3_file*)pNew, path, 0); + rc = fillInUnixFile(&dummyVfs, fd, (tdsqlite3_file*)pNew, path, 0); if( rc==SQLITE_OK ){ *ppFile = pNew; return SQLITE_OK; } end_create_proxy: robust_close(pNew, fd, __LINE__); - sqlite3_free(pNew); - sqlite3_free(pUnused); + tdsqlite3_free(pNew); + tdsqlite3_free(pUnused); return rc; } #ifdef SQLITE_TEST /* simulate multiple hosts by creating unique hostid file paths */ -SQLITE_API int sqlite3_hostid_num = 0; +SQLITE_API int tdsqlite3_hostid_num = 0; #endif #define PROXY_HOSTIDLEN 16 /* conch file host id length */ @@ -45393,8 +45393,8 @@ static int proxyGetHostID(unsigned char *pHostID, int *pError){ #endif #ifdef SQLITE_TEST /* simulate multiple hosts by creating unique hostid file paths */ - if( sqlite3_hostid_num != 0){ - pHostID[0] = (char)(pHostID[0] + (char)(sqlite3_hostid_num & 0xFF)); + if( tdsqlite3_hostid_num != 0){ + pHostID[0] = (char)(pHostID[0] + (char)(tdsqlite3_hostid_num & 0xFF)); } #endif @@ -45431,27 +45431,27 @@ static int proxyBreakConchLock(unixFile *pFile, uuid_t myHostID){ pathLen = strlcpy(tPath, cPath, MAXPATHLEN); if( pathLen>MAXPATHLEN || pathLen<6 || (strlcpy(&tPath[pathLen-5], "break", 6) != 5) ){ - sqlite3_snprintf(sizeof(errmsg),errmsg,"path error (len %d)",(int)pathLen); + tdsqlite3_snprintf(sizeof(errmsg),errmsg,"path error (len %d)",(int)pathLen); goto end_breaklock; } /* read the conch content */ readLen = osPread(conchFile->h, buf, PROXY_MAXCONCHLEN, 0); if( readLenpMethod->xLock((sqlite3_file*)conchFile, lockType); + rc = conchFile->pMethod->xLock((tdsqlite3_file*)conchFile, lockType); nTries ++; if( rc==SQLITE_BUSY ){ /* If the lock failed (busy): @@ -45534,10 +45534,10 @@ static int proxyConchLock(unixFile *pFile, uuid_t myHostID, int lockType){ if( 0==proxyBreakConchLock(pFile, myHostID) ){ rc = SQLITE_OK; if( lockType==EXCLUSIVE_LOCK ){ - rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, SHARED_LOCK); + rc = conchFile->pMethod->xLock((tdsqlite3_file*)conchFile, SHARED_LOCK); } if( !rc ){ - rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, lockType); + rc = conchFile->pMethod->xLock((tdsqlite3_file*)conchFile, lockType); } } } @@ -45677,7 +45677,7 @@ static int proxyTakeConch(unixFile *pFile){ } writeSize = PROXY_PATHINDEX + strlen(&writeBuffer[PROXY_PATHINDEX]); robust_ftruncate(conchFile->h, writeSize); - rc = unixWrite((sqlite3_file *)conchFile, writeBuffer, writeSize, 0); + rc = unixWrite((tdsqlite3_file *)conchFile, writeBuffer, writeSize, 0); full_fsync(conchFile->h,0,0); /* If we created a new conch file (not just updated the contents of a ** valid conch file), try to match the permissions of the database @@ -45710,7 +45710,7 @@ static int proxyTakeConch(unixFile *pFile){ } } } - conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, SHARED_LOCK); + conchFile->pMethod->xUnlock((tdsqlite3_file*)conchFile, SHARED_LOCK); end_takeconch: OSTRACE(("TRANSPROXY: CLOSE %d\n", pFile->h)); @@ -45746,7 +45746,7 @@ static int proxyTakeConch(unixFile *pFile){ ** from the conch file or the path was allocated on the stack */ if( tempLockPath ){ - pCtx->lockProxyPath = sqlite3DbStrDup(0, tempLockPath); + pCtx->lockProxyPath = tdsqlite3DbStrDup(0, tempLockPath); if( !pCtx->lockProxyPath ){ rc = SQLITE_NOMEM_BKPT; } @@ -45761,7 +45761,7 @@ static int proxyTakeConch(unixFile *pFile){ afpCtx->dbPath = pCtx->lockProxyPath; } } else { - conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK); + conchFile->pMethod->xUnlock((tdsqlite3_file*)conchFile, NO_LOCK); } OSTRACE(("TAKECONCH %d %s\n", conchFile->h, rc==SQLITE_OK?"ok":"failed")); @@ -45785,7 +45785,7 @@ static int proxyReleaseConch(unixFile *pFile){ (pCtx->lockProxyPath ? pCtx->lockProxyPath : ":auto:"), osGetpid(0))); if( pCtx->conchHeld>0 ){ - rc = conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK); + rc = conchFile->pMethod->xUnlock((tdsqlite3_file*)conchFile, NO_LOCK); } pCtx->conchHeld = 0; OSTRACE(("RELEASECONCH %d %s\n", conchFile->h, @@ -45795,7 +45795,7 @@ static int proxyReleaseConch(unixFile *pFile){ /* ** Given the name of a database file, compute the name of its conch file. -** Store the conch filename in memory obtained from sqlite3_malloc64(). +** Store the conch filename in memory obtained from tdsqlite3_malloc64(). ** Make *pConchPath point to the new name. Return SQLITE_OK on success ** or SQLITE_NOMEM if unable to obtain memory. ** @@ -45811,7 +45811,7 @@ static int proxyCreateConchPathname(char *dbPath, char **pConchPath){ /* Allocate space for the conch filename and initialize the name to ** the name of the original database file. */ - *pConchPath = conchPath = (char *)sqlite3_malloc64(len + 8); + *pConchPath = conchPath = (char *)tdsqlite3_malloc64(len + 8); if( conchPath==0 ){ return SQLITE_NOMEM_BKPT; } @@ -45859,12 +45859,12 @@ static int switchLockProxyPath(unixFile *pFile, const char *path) { pCtx->lockProxy=NULL; pCtx->conchHeld = 0; if( lockProxy!=NULL ){ - rc=lockProxy->pMethod->xClose((sqlite3_file *)lockProxy); + rc=lockProxy->pMethod->xClose((tdsqlite3_file *)lockProxy); if( rc ) return rc; - sqlite3_free(lockProxy); + tdsqlite3_free(lockProxy); } - sqlite3_free(oldPath); - pCtx->lockProxyPath = sqlite3DbStrDup(0, path); + tdsqlite3_free(oldPath); + pCtx->lockProxyPath = tdsqlite3DbStrDup(0, path); } return rc; @@ -45927,7 +45927,7 @@ static int proxyTransformUnixFile(unixFile *pFile, const char *path) { OSTRACE(("TRANSPROXY %d for %s pid=%d\n", pFile->h, (lockPath ? lockPath : ":auto:"), osGetpid(0))); - pCtx = sqlite3_malloc64( sizeof(*pCtx) ); + pCtx = tdsqlite3_malloc64( sizeof(*pCtx) ); if( pCtx==0 ){ return SQLITE_NOMEM_BKPT; } @@ -45959,11 +45959,11 @@ static int proxyTransformUnixFile(unixFile *pFile, const char *path) { } } if( rc==SQLITE_OK && lockPath ){ - pCtx->lockProxyPath = sqlite3DbStrDup(0, lockPath); + pCtx->lockProxyPath = tdsqlite3DbStrDup(0, lockPath); } if( rc==SQLITE_OK ){ - pCtx->dbPath = sqlite3DbStrDup(0, dbPath); + pCtx->dbPath = tdsqlite3DbStrDup(0, dbPath); if( pCtx->dbPath==NULL ){ rc = SQLITE_NOMEM_BKPT; } @@ -45978,12 +45978,12 @@ static int proxyTransformUnixFile(unixFile *pFile, const char *path) { pFile->pMethod = &proxyIoMethods; }else{ if( pCtx->conchFile ){ - pCtx->conchFile->pMethod->xClose((sqlite3_file *)pCtx->conchFile); - sqlite3_free(pCtx->conchFile); + pCtx->conchFile->pMethod->xClose((tdsqlite3_file *)pCtx->conchFile); + tdsqlite3_free(pCtx->conchFile); } - sqlite3DbFree(0, pCtx->lockProxyPath); - sqlite3_free(pCtx->conchFilePath); - sqlite3_free(pCtx); + tdsqlite3DbFree(0, pCtx->lockProxyPath); + tdsqlite3_free(pCtx->conchFilePath); + tdsqlite3_free(pCtx); } OSTRACE(("TRANSPROXY %d %s\n", pFile->h, (rc==SQLITE_OK ? "ok" : "failed"))); @@ -45992,10 +45992,10 @@ static int proxyTransformUnixFile(unixFile *pFile, const char *path) { /* -** This routine handles sqlite3_file_control() calls that are specific +** This routine handles tdsqlite3_file_control() calls that are specific ** to proxy locking. */ -static int proxyFileControl(sqlite3_file *id, int op, void *pArg){ +static int proxyFileControl(tdsqlite3_file *id, int op, void *pArg){ switch( op ){ case SQLITE_FCNTL_GET_LOCKPROXYFILE: { unixFile *pFile = (unixFile*)id; @@ -46058,7 +46058,7 @@ static int proxyFileControl(sqlite3_file *id, int op, void *pArg){ /* ** Within this division (the proxying locking implementation) the procedures ** above this point are all utilities. The lock-related methods of the -** proxy-locking sqlite3_io_method object follow. +** proxy-locking tdsqlite3_io_method object follow. */ @@ -46068,14 +46068,14 @@ static int proxyFileControl(sqlite3_file *id, int op, void *pArg){ ** to a non-zero value otherwise *pResOut is set to zero. The return value ** is set to SQLITE_OK unless an I/O error occurs during lock checking. */ -static int proxyCheckReservedLock(sqlite3_file *id, int *pResOut) { +static int proxyCheckReservedLock(tdsqlite3_file *id, int *pResOut) { unixFile *pFile = (unixFile*)id; int rc = proxyTakeConch(pFile); if( rc==SQLITE_OK ){ proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; if( pCtx->conchHeld>0 ){ unixFile *proxy = pCtx->lockProxy; - return proxy->pMethod->xCheckReservedLock((sqlite3_file*)proxy, pResOut); + return proxy->pMethod->xCheckReservedLock((tdsqlite3_file*)proxy, pResOut); }else{ /* conchHeld < 0 is lockless */ pResOut=0; } @@ -46104,17 +46104,17 @@ static int proxyCheckReservedLock(sqlite3_file *id, int *pResOut) { ** RESERVED -> (PENDING) -> EXCLUSIVE ** PENDING -> EXCLUSIVE ** -** This routine will only increase a lock. Use the sqlite3OsUnlock() +** This routine will only increase a lock. Use the tdsqlite3OsUnlock() ** routine to lower a locking level. */ -static int proxyLock(sqlite3_file *id, int eFileLock) { +static int proxyLock(tdsqlite3_file *id, int eFileLock) { unixFile *pFile = (unixFile*)id; int rc = proxyTakeConch(pFile); if( rc==SQLITE_OK ){ proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; if( pCtx->conchHeld>0 ){ unixFile *proxy = pCtx->lockProxy; - rc = proxy->pMethod->xLock((sqlite3_file*)proxy, eFileLock); + rc = proxy->pMethod->xLock((tdsqlite3_file*)proxy, eFileLock); pFile->eFileLock = proxy->eFileLock; }else{ /* conchHeld < 0 is lockless */ @@ -46131,14 +46131,14 @@ static int proxyLock(sqlite3_file *id, int eFileLock) { ** If the locking level of the file descriptor is already at or below ** the requested locking level, this routine is a no-op. */ -static int proxyUnlock(sqlite3_file *id, int eFileLock) { +static int proxyUnlock(tdsqlite3_file *id, int eFileLock) { unixFile *pFile = (unixFile*)id; int rc = proxyTakeConch(pFile); if( rc==SQLITE_OK ){ proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; if( pCtx->conchHeld>0 ){ unixFile *proxy = pCtx->lockProxy; - rc = proxy->pMethod->xUnlock((sqlite3_file*)proxy, eFileLock); + rc = proxy->pMethod->xUnlock((tdsqlite3_file*)proxy, eFileLock); pFile->eFileLock = proxy->eFileLock; }else{ /* conchHeld < 0 is lockless */ @@ -46150,7 +46150,7 @@ static int proxyUnlock(sqlite3_file *id, int eFileLock) { /* ** Close a file that uses proxy locks. */ -static int proxyClose(sqlite3_file *id) { +static int proxyClose(tdsqlite3_file *id) { if( ALWAYS(id) ){ unixFile *pFile = (unixFile*)id; proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; @@ -46159,11 +46159,11 @@ static int proxyClose(sqlite3_file *id) { int rc = SQLITE_OK; if( lockProxy ){ - rc = lockProxy->pMethod->xUnlock((sqlite3_file*)lockProxy, NO_LOCK); + rc = lockProxy->pMethod->xUnlock((tdsqlite3_file*)lockProxy, NO_LOCK); if( rc ) return rc; - rc = lockProxy->pMethod->xClose((sqlite3_file*)lockProxy); + rc = lockProxy->pMethod->xClose((tdsqlite3_file*)lockProxy); if( rc ) return rc; - sqlite3_free(lockProxy); + tdsqlite3_free(lockProxy); pCtx->lockProxy = 0; } if( conchFile ){ @@ -46171,17 +46171,17 @@ static int proxyClose(sqlite3_file *id) { rc = proxyReleaseConch(pFile); if( rc ) return rc; } - rc = conchFile->pMethod->xClose((sqlite3_file*)conchFile); + rc = conchFile->pMethod->xClose((tdsqlite3_file*)conchFile); if( rc ) return rc; - sqlite3_free(conchFile); + tdsqlite3_free(conchFile); } - sqlite3DbFree(0, pCtx->lockProxyPath); - sqlite3_free(pCtx->conchFilePath); - sqlite3DbFree(0, pCtx->dbPath); + tdsqlite3DbFree(0, pCtx->lockProxyPath); + tdsqlite3_free(pCtx->conchFilePath); + tdsqlite3DbFree(0, pCtx->dbPath); /* restore the original locking context and pMethod then close it */ pFile->lockingContext = pCtx->oldLockingContext; pFile->pMethod = pCtx->pOldMethod; - sqlite3_free(pCtx); + tdsqlite3_free(pCtx); return pFile->pMethod->xClose(id); } return SQLITE_OK; @@ -46203,7 +46203,7 @@ static int proxyClose(sqlite3_file *id) { ** Initialize the operating system interface. ** ** This routine registers all VFS implementations for unix-like operating -** systems. This routine, and the sqlite3_os_end() routine that follows, +** systems. This routine, and the tdsqlite3_os_end() routine that follows, ** should be the only routines in this file that are visible from other ** files. ** @@ -46212,9 +46212,9 @@ static int proxyClose(sqlite3_file *id) { ** necessarily been initialized when this routine is called, and so they ** should not be used. */ -SQLITE_API int sqlite3_os_init(void){ +SQLITE_API int tdsqlite3_os_init(void){ /* - ** The following macro defines an initializer for an sqlite3_vfs object. + ** The following macro defines an initializer for an tdsqlite3_vfs object. ** The name of the VFS is NAME. The pAppData is a pointer to a pointer ** to the "finder" function. (pAppData is a pointer to a pointer because ** silly C90 rules prohibit a void* from being cast to a function pointer @@ -46227,7 +46227,7 @@ SQLITE_API int sqlite3_os_init(void){ ** behaviors. See the division above that contains the IOMETHODS ** macro for addition information on finder-functions. ** - ** Most finders simply return a pointer to a fixed sqlite3_io_methods + ** Most finders simply return a pointer to a fixed tdsqlite3_io_methods ** object. But the "autolockIoFinder" available on MacOSX does a little ** more than that; it looks at the filesystem type that hosts the ** database file and tries to choose an locking method appropriate for @@ -46261,11 +46261,11 @@ SQLITE_API int sqlite3_os_init(void){ /* ** All default VFSes for unix are contained in the following array. ** - ** Note that the sqlite3_vfs.pNext field of the VFS object is modified + ** Note that the tdsqlite3_vfs.pNext field of the VFS object is modified ** by the SQLite core when the VFS is registered. So the following ** array cannot be const. */ - static sqlite3_vfs aVfs[] = { + static tdsqlite3_vfs aVfs[] = { #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) UNIXVFS("unix", autolockIoFinder ), #elif OS_VXWORKS @@ -46298,10 +46298,10 @@ SQLITE_API int sqlite3_os_init(void){ assert( ArraySize(aSyscall)==29 ); /* Register all VFSes defined in the aVfs[] array */ - for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){ - sqlite3_vfs_register(&aVfs[i], i==0); + for(i=0; i<(sizeof(aVfs)/sizeof(tdsqlite3_vfs)); i++){ + tdsqlite3_vfs_register(&aVfs[i], i==0); } - unixBigLock = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1); + unixBigLock = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1); return SQLITE_OK; } @@ -46312,7 +46312,7 @@ SQLITE_API int sqlite3_os_init(void){ ** to release dynamically allocated objects. But not on unix. ** This routine is a no-op for unix. */ -SQLITE_API int sqlite3_os_end(void){ +SQLITE_API int tdsqlite3_os_end(void){ unixBigLock = 0; return SQLITE_OK; } @@ -46416,7 +46416,7 @@ SQLITE_API int sqlite3_os_end(void){ #if defined(__GNUC__) - __inline__ sqlite_uint64 sqlite3Hwtime(void){ + __inline__ sqlite_uint64 tdsqlite3Hwtime(void){ unsigned int lo, hi; __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); return (sqlite_uint64)hi << 32 | lo; @@ -46424,7 +46424,7 @@ SQLITE_API int sqlite3_os_end(void){ #elif defined(_MSC_VER) - __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ + __declspec(naked) __inline sqlite_uint64 __cdecl tdsqlite3Hwtime(void){ __asm { rdtsc ret ; return value at EDX:EAX @@ -46435,7 +46435,7 @@ SQLITE_API int sqlite3_os_end(void){ #elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) - __inline__ sqlite_uint64 sqlite3Hwtime(void){ + __inline__ sqlite_uint64 tdsqlite3Hwtime(void){ unsigned long val; __asm__ __volatile__ ("rdtsc" : "=A" (val)); return val; @@ -46443,7 +46443,7 @@ SQLITE_API int sqlite3_os_end(void){ #elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) - __inline__ sqlite_uint64 sqlite3Hwtime(void){ + __inline__ sqlite_uint64 tdsqlite3Hwtime(void){ unsigned long long retval; unsigned long junk; __asm__ __volatile__ ("\n\ @@ -46460,13 +46460,13 @@ SQLITE_API int sqlite3_os_end(void){ /* ** asm() is needed for hardware timing support. Without asm(), - ** disable the sqlite3Hwtime() routine. + ** disable the tdsqlite3Hwtime() routine. ** - ** sqlite3Hwtime() is only used for some obscure debugging + ** tdsqlite3Hwtime() is only used for some obscure debugging ** and analysis configurations, not in any deliverable, so this ** should not be a great loss. */ -SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } +SQLITE_PRIVATE sqlite_uint64 tdsqlite3Hwtime(void){ return ((sqlite_uint64)0); } #endif @@ -46477,8 +46477,8 @@ SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } static sqlite_uint64 g_start; static sqlite_uint64 g_elapsed; -#define TIMER_START g_start=sqlite3Hwtime() -#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start +#define TIMER_START g_start=tdsqlite3Hwtime() +#define TIMER_END g_elapsed=tdsqlite3Hwtime()-g_start #define TIMER_ELAPSED g_elapsed #else #define TIMER_START @@ -46492,32 +46492,32 @@ static sqlite_uint64 g_elapsed; ** is used for testing the I/O recovery logic. */ #if defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_io_error_hit; -SQLITE_API extern int sqlite3_io_error_hardhit; -SQLITE_API extern int sqlite3_io_error_pending; -SQLITE_API extern int sqlite3_io_error_persist; -SQLITE_API extern int sqlite3_io_error_benign; -SQLITE_API extern int sqlite3_diskfull_pending; -SQLITE_API extern int sqlite3_diskfull; -#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X) +SQLITE_API extern int tdsqlite3_io_error_hit; +SQLITE_API extern int tdsqlite3_io_error_hardhit; +SQLITE_API extern int tdsqlite3_io_error_pending; +SQLITE_API extern int tdsqlite3_io_error_persist; +SQLITE_API extern int tdsqlite3_io_error_benign; +SQLITE_API extern int tdsqlite3_diskfull_pending; +SQLITE_API extern int tdsqlite3_diskfull; +#define SimulateIOErrorBenign(X) tdsqlite3_io_error_benign=(X) #define SimulateIOError(CODE) \ - if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \ - || sqlite3_io_error_pending-- == 1 ) \ + if( (tdsqlite3_io_error_persist && tdsqlite3_io_error_hit) \ + || tdsqlite3_io_error_pending-- == 1 ) \ { local_ioerr(); CODE; } static void local_ioerr(){ IOTRACE(("IOERR\n")); - sqlite3_io_error_hit++; - if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++; + tdsqlite3_io_error_hit++; + if( !tdsqlite3_io_error_benign ) tdsqlite3_io_error_hardhit++; } #define SimulateDiskfullError(CODE) \ - if( sqlite3_diskfull_pending ){ \ - if( sqlite3_diskfull_pending == 1 ){ \ + if( tdsqlite3_diskfull_pending ){ \ + if( tdsqlite3_diskfull_pending == 1 ){ \ local_ioerr(); \ - sqlite3_diskfull = 1; \ - sqlite3_io_error_hit = 1; \ + tdsqlite3_diskfull = 1; \ + tdsqlite3_io_error_hit = 1; \ CODE; \ }else{ \ - sqlite3_diskfull_pending--; \ + tdsqlite3_diskfull_pending--; \ } \ } #else @@ -46530,8 +46530,8 @@ static void local_ioerr(){ ** When testing, keep a count of the number of open files. */ #if defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_open_file_count; -#define OpenCounter(X) sqlite3_open_file_count+=(X) +SQLITE_API extern int tdsqlite3_open_file_count; +#define OpenCounter(X) tdsqlite3_open_file_count+=(X) #else #define OpenCounter(X) #endif /* defined(SQLITE_TEST) */ @@ -46777,13 +46777,13 @@ typedef struct winceLock { #endif /* -** The winFile structure is a subclass of sqlite3_file* specific to the win32 +** The winFile structure is a subclass of tdsqlite3_file* specific to the win32 ** portability layer. */ typedef struct winFile winFile; struct winFile { - const sqlite3_io_methods *pMethod; /*** Must be first ***/ - sqlite3_vfs *pVfs; /* The VFS used to open this file */ + const tdsqlite3_io_methods *pMethod; /*** Must be first ***/ + tdsqlite3_vfs *pVfs; /* The VFS used to open this file */ HANDLE h; /* Handle for accessing the file */ u8 locktype; /* Type of lock currently held on this file */ short sharedLockByte; /* Randomly chosen byte used as a shared lock */ @@ -46805,8 +46805,8 @@ struct winFile { int nFetchOut; /* Number of outstanding xFetch references */ HANDLE hMap; /* Handle for accessing memory mapping */ void *pMapRegion; /* Area memory mapped */ - sqlite3_int64 mmapSize; /* Size of mapped region */ - sqlite3_int64 mmapSizeMax; /* Configured FCNTL_MMAP_SIZE value */ + tdsqlite3_int64 mmapSize; /* Size of mapped region */ + tdsqlite3_int64 mmapSizeMax; /* Configured FCNTL_MMAP_SIZE value */ #endif }; @@ -46816,7 +46816,7 @@ struct winFile { */ typedef struct winVfsAppData winVfsAppData; struct winVfsAppData { - const sqlite3_io_methods *pMethod; /* The file I/O methods to use. */ + const tdsqlite3_io_methods *pMethod; /* The file I/O methods to use. */ void *pAppData; /* The extra pAppData, if any. */ BOOL bNoLock; /* Non-zero if locking is disabled. */ }; @@ -46829,7 +46829,7 @@ struct winVfsAppData { #define WINFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */ /* - * The size of the buffer used by sqlite3_win32_write_debug(). + * The size of the buffer used by tdsqlite3_win32_write_debug(). */ #ifndef SQLITE_WIN32_DBG_BUF_SIZE # define SQLITE_WIN32_DBG_BUF_SIZE ((int)(4096-sizeof(DWORD))) @@ -46849,7 +46849,7 @@ struct winVfsAppData { * ****************************************************************************** * WARNING: It is important to note that when this setting is non-zero and the - * winMemShutdown function is called (e.g. by the sqlite3_shutdown + * winMemShutdown function is called (e.g. by the tdsqlite3_shutdown * function), all data that was allocated using the isolated heap will * be freed immediately and any attempt to access any of that freed * data will almost certainly result in an immediate access violation. @@ -46935,7 +46935,7 @@ struct winVfsAppData { /* ** The winMemData structure stores information required by the Win32-specific -** sqlite3_mem_methods implementation. +** tdsqlite3_mem_methods implementation. */ typedef struct winMemData winMemData; struct winMemData { @@ -46984,7 +46984,7 @@ static int winMemRoundup(int n); static int winMemInit(void *pAppData); static void winMemShutdown(void *pAppData); -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetWin32(void); +SQLITE_PRIVATE const tdsqlite3_mem_methods *tdsqlite3MemGetWin32(void); #endif /* SQLITE_WIN32_MALLOC */ /* @@ -47000,13 +47000,13 @@ SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetWin32(void); ** can manually set this value to 1 to emulate Win98 behavior. */ #ifdef SQLITE_TEST -SQLITE_API LONG SQLITE_WIN32_VOLATILE sqlite3_os_type = 0; +SQLITE_API LONG SQLITE_WIN32_VOLATILE tdsqlite3_os_type = 0; #else -static LONG SQLITE_WIN32_VOLATILE sqlite3_os_type = 0; +static LONG SQLITE_WIN32_VOLATILE tdsqlite3_os_type = 0; #endif #ifndef SYSCALL -# define SYSCALL sqlite3_syscall_ptr +# define SYSCALL tdsqlite3_syscall_ptr #endif /* @@ -47025,8 +47025,8 @@ static LONG SQLITE_WIN32_VOLATILE sqlite3_os_type = 0; */ static struct win_syscall { const char *zName; /* Name of the system call */ - sqlite3_syscall_ptr pCurrent; /* Current value of the system call */ - sqlite3_syscall_ptr pDefault; /* Default value */ + tdsqlite3_syscall_ptr pCurrent; /* Current value of the system call */ + tdsqlite3_syscall_ptr pDefault; /* Default value */ } aSyscall[] = { #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT { "AreFileApisANSI", (SYSCALL)AreFileApisANSI, 0 }, @@ -47679,15 +47679,15 @@ static struct win_syscall { }; /* End of the overrideable system calls */ /* -** This is the xSetSystemCall() method of sqlite3_vfs for all of the +** This is the xSetSystemCall() method of tdsqlite3_vfs for all of the ** "win32" VFSes. Return SQLITE_OK opon successfully updating the ** system call pointer, or SQLITE_NOTFOUND if there is no configurable ** system call named zName. */ static int winSetSystemCall( - sqlite3_vfs *pNotUsed, /* The VFS pointer. Not used */ + tdsqlite3_vfs *pNotUsed, /* The VFS pointer. Not used */ const char *zName, /* Name of system call to override */ - sqlite3_syscall_ptr pNewFunc /* Pointer to new system call value */ + tdsqlite3_syscall_ptr pNewFunc /* Pointer to new system call value */ ){ unsigned int i; int rc = SQLITE_NOTFOUND; @@ -47727,8 +47727,8 @@ static int winSetSystemCall( ** recognized system call name. NULL is also returned if the system call ** is currently undefined. */ -static sqlite3_syscall_ptr winGetSystemCall( - sqlite3_vfs *pNotUsed, +static tdsqlite3_syscall_ptr winGetSystemCall( + tdsqlite3_vfs *pNotUsed, const char *zName ){ unsigned int i; @@ -47746,7 +47746,7 @@ static sqlite3_syscall_ptr winGetSystemCall( ** is the last system call or if zName is not the name of a valid ** system call. */ -static const char *winNextSystemCall(sqlite3_vfs *p, const char *zName){ +static const char *winNextSystemCall(tdsqlite3_vfs *p, const char *zName){ int i = -1; UNUSED_PARAMETER(p); @@ -47769,7 +47769,7 @@ static const char *winNextSystemCall(sqlite3_vfs *p, const char *zName){ ** "pnLargest" argument, if non-zero, will be used to return the size of the ** largest committed free block in the heap, in bytes. */ -SQLITE_API int sqlite3_win32_compact_heap(LPUINT pnLargest){ +SQLITE_API int tdsqlite3_win32_compact_heap(LPUINT pnLargest){ int rc = SQLITE_OK; UINT nLargest = 0; HANDLE hHeap; @@ -47785,17 +47785,17 @@ SQLITE_API int sqlite3_win32_compact_heap(LPUINT pnLargest){ if( (nLargest=osHeapCompact(hHeap, SQLITE_WIN32_HEAP_FLAGS))==0 ){ DWORD lastErrno = osGetLastError(); if( lastErrno==NO_ERROR ){ - sqlite3_log(SQLITE_NOMEM, "failed to HeapCompact (no space), heap=%p", + tdsqlite3_log(SQLITE_NOMEM, "failed to HeapCompact (no space), heap=%p", (void*)hHeap); rc = SQLITE_NOMEM_BKPT; }else{ - sqlite3_log(SQLITE_ERROR, "failed to HeapCompact (%lu), heap=%p", + tdsqlite3_log(SQLITE_ERROR, "failed to HeapCompact (%lu), heap=%p", osGetLastError(), (void*)hHeap); rc = SQLITE_ERROR; } } #else - sqlite3_log(SQLITE_NOTFOUND, "failed to HeapCompact, heap=%p", + tdsqlite3_log(SQLITE_NOTFOUND, "failed to HeapCompact, heap=%p", (void*)hHeap); rc = SQLITE_NOTFOUND; #endif @@ -47806,19 +47806,19 @@ SQLITE_API int sqlite3_win32_compact_heap(LPUINT pnLargest){ /* ** If a Win32 native heap has been configured, this function will attempt to ** destroy and recreate it. If the Win32 native heap is not isolated and/or -** the sqlite3_memory_used() function does not return zero, SQLITE_BUSY will +** the tdsqlite3_memory_used() function does not return zero, SQLITE_BUSY will ** be returned and no changes will be made to the Win32 native heap. */ -SQLITE_API int sqlite3_win32_reset_heap(){ +SQLITE_API int tdsqlite3_win32_reset_heap(){ int rc; - MUTEX_LOGIC( sqlite3_mutex *pMaster; ) /* The main static mutex */ - MUTEX_LOGIC( sqlite3_mutex *pMem; ) /* The memsys static mutex */ - MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) - MUTEX_LOGIC( pMem = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); ) - sqlite3_mutex_enter(pMaster); - sqlite3_mutex_enter(pMem); + MUTEX_LOGIC( tdsqlite3_mutex *pMaster; ) /* The main static mutex */ + MUTEX_LOGIC( tdsqlite3_mutex *pMem; ) /* The memsys static mutex */ + MUTEX_LOGIC( pMaster = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) + MUTEX_LOGIC( pMem = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); ) + tdsqlite3_mutex_enter(pMaster); + tdsqlite3_mutex_enter(pMem); winMemAssertMagic(); - if( winMemGetHeap()!=NULL && winMemGetOwned() && sqlite3_memory_used()==0 ){ + if( winMemGetHeap()!=NULL && winMemGetOwned() && tdsqlite3_memory_used()==0 ){ /* ** At this point, there should be no outstanding memory allocations on ** the heap. Also, since both the master and memsys locks are currently @@ -47828,23 +47828,23 @@ SQLITE_API int sqlite3_win32_reset_heap(){ */ assert( winMemGetHeap()!=NULL ); assert( winMemGetOwned() ); - assert( sqlite3_memory_used()==0 ); + assert( tdsqlite3_memory_used()==0 ); winMemShutdown(winMemGetDataPtr()); assert( winMemGetHeap()==NULL ); assert( !winMemGetOwned() ); - assert( sqlite3_memory_used()==0 ); + assert( tdsqlite3_memory_used()==0 ); rc = winMemInit(winMemGetDataPtr()); assert( rc!=SQLITE_OK || winMemGetHeap()!=NULL ); assert( rc!=SQLITE_OK || winMemGetOwned() ); - assert( rc!=SQLITE_OK || sqlite3_memory_used()==0 ); + assert( rc!=SQLITE_OK || tdsqlite3_memory_used()==0 ); }else{ /* ** The Win32 native heap cannot be modified because it may be in use. */ rc = SQLITE_BUSY; } - sqlite3_mutex_leave(pMem); - sqlite3_mutex_leave(pMaster); + tdsqlite3_mutex_leave(pMem); + tdsqlite3_mutex_leave(pMaster); return rc; } #endif /* SQLITE_WIN32_MALLOC */ @@ -47854,7 +47854,7 @@ SQLITE_API int sqlite3_win32_reset_heap(){ ** (if available). */ -SQLITE_API void sqlite3_win32_write_debug(const char *zBuf, int nBuf){ +SQLITE_API void tdsqlite3_win32_write_debug(const char *zBuf, int nBuf){ char zDbgBuf[SQLITE_WIN32_DBG_BUF_SIZE]; int nMin = MIN(nBuf, (SQLITE_WIN32_DBG_BUF_SIZE - 1)); /* may be negative. */ if( nMin<-1 ) nMin = -1; /* all negative values become -1. */ @@ -47900,7 +47900,7 @@ SQLITE_API void sqlite3_win32_write_debug(const char *zBuf, int nBuf){ static HANDLE sleepObj = NULL; #endif -SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds){ +SQLITE_API void tdsqlite3_win32_sleep(DWORD milliseconds){ #if SQLITE_OS_WINRT if ( sleepObj==NULL ){ sleepObj = osCreateEventExW(NULL, NULL, CREATE_EVENT_MANUAL_RESET, @@ -47915,7 +47915,7 @@ SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds){ #if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \ SQLITE_THREADSAFE>0 -SQLITE_PRIVATE DWORD sqlite3Win32Wait(HANDLE hObject){ +SQLITE_PRIVATE DWORD tdsqlite3Win32Wait(HANDLE hObject){ DWORD rc; while( (rc = osWaitForSingleObjectEx(hObject, INFINITE, TRUE))==WAIT_IO_COMPLETION ){} @@ -47942,14 +47942,14 @@ SQLITE_PRIVATE DWORD sqlite3Win32Wait(HANDLE hObject){ #elif !defined(SQLITE_WIN32_HAS_WIDE) # define osIsNT() (0) #else -# define osIsNT() ((sqlite3_os_type==2) || sqlite3_win32_is_nt()) +# define osIsNT() ((tdsqlite3_os_type==2) || tdsqlite3_win32_is_nt()) #endif /* ** This function determines if the machine is running a version of Windows ** based on the NT kernel. */ -SQLITE_API int sqlite3_win32_is_nt(void){ +SQLITE_API int tdsqlite3_win32_is_nt(void){ #if SQLITE_OS_WINRT /* ** NOTE: The WinRT sub-platform is always assumed to be based on the NT @@ -47957,24 +47957,24 @@ SQLITE_API int sqlite3_win32_is_nt(void){ */ return 1; #elif SQLITE_WIN32_GETVERSIONEX - if( osInterlockedCompareExchange(&sqlite3_os_type, 0, 0)==0 ){ + if( osInterlockedCompareExchange(&tdsqlite3_os_type, 0, 0)==0 ){ #if defined(SQLITE_WIN32_HAS_ANSI) OSVERSIONINFOA sInfo; sInfo.dwOSVersionInfoSize = sizeof(sInfo); osGetVersionExA(&sInfo); - osInterlockedCompareExchange(&sqlite3_os_type, + osInterlockedCompareExchange(&tdsqlite3_os_type, (sInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) ? 2 : 1, 0); #elif defined(SQLITE_WIN32_HAS_WIDE) OSVERSIONINFOW sInfo; sInfo.dwOSVersionInfoSize = sizeof(sInfo); osGetVersionExW(&sInfo); - osInterlockedCompareExchange(&sqlite3_os_type, + osInterlockedCompareExchange(&tdsqlite3_os_type, (sInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) ? 2 : 1, 0); #endif } - return osInterlockedCompareExchange(&sqlite3_os_type, 2, 2)==2; + return osInterlockedCompareExchange(&tdsqlite3_os_type, 2, 2)==2; #elif SQLITE_TEST - return osInterlockedCompareExchange(&sqlite3_os_type, 2, 2)==2; + return osInterlockedCompareExchange(&tdsqlite3_os_type, 2, 2)==2; #else /* ** NOTE: All sub-platforms where the GetVersionEx[AW] functions are @@ -48002,7 +48002,7 @@ static void *winMemMalloc(int nBytes){ assert( nBytes>=0 ); p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes); if( !p ){ - sqlite3_log(SQLITE_NOMEM, "failed to HeapAlloc %u bytes (%lu), heap=%p", + tdsqlite3_log(SQLITE_NOMEM, "failed to HeapAlloc %u bytes (%lu), heap=%p", nBytes, osGetLastError(), (void*)hHeap); } return p; @@ -48023,7 +48023,7 @@ static void winMemFree(void *pPrior){ #endif if( !pPrior ) return; /* Passing NULL to HeapFree is undefined. */ if( !osHeapFree(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ){ - sqlite3_log(SQLITE_NOMEM, "failed to HeapFree block %p (%lu), heap=%p", + tdsqlite3_log(SQLITE_NOMEM, "failed to HeapFree block %p (%lu), heap=%p", pPrior, osGetLastError(), (void*)hHeap); } } @@ -48049,7 +48049,7 @@ static void *winMemRealloc(void *pPrior, int nBytes){ p = osHeapReAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior, (SIZE_T)nBytes); } if( !p ){ - sqlite3_log(SQLITE_NOMEM, "failed to %s %u bytes (%lu), heap=%p", + tdsqlite3_log(SQLITE_NOMEM, "failed to %s %u bytes (%lu), heap=%p", pPrior ? "HeapReAlloc" : "HeapAlloc", nBytes, osGetLastError(), (void*)hHeap); } @@ -48073,7 +48073,7 @@ static int winMemSize(void *p){ if( !p ) return 0; n = osHeapSize(hHeap, SQLITE_WIN32_HEAP_FLAGS, p); if( n==(SIZE_T)-1 ){ - sqlite3_log(SQLITE_NOMEM, "failed to HeapSize block %p (%lu), heap=%p", + tdsqlite3_log(SQLITE_NOMEM, "failed to HeapSize block %p (%lu), heap=%p", p, osGetLastError(), (void*)hHeap); return 0; } @@ -48100,7 +48100,7 @@ static int winMemInit(void *pAppData){ #if !SQLITE_OS_WINRT && SQLITE_WIN32_HEAP_CREATE if( !pWinMemData->hHeap ){ DWORD dwInitialSize = SQLITE_WIN32_HEAP_INIT_SIZE; - DWORD dwMaximumSize = (DWORD)sqlite3GlobalConfig.nHeap; + DWORD dwMaximumSize = (DWORD)tdsqlite3GlobalConfig.nHeap; if( dwMaximumSize==0 ){ dwMaximumSize = SQLITE_WIN32_HEAP_MAX_SIZE; }else if( dwInitialSize>dwMaximumSize ){ @@ -48109,7 +48109,7 @@ static int winMemInit(void *pAppData){ pWinMemData->hHeap = osHeapCreate(SQLITE_WIN32_HEAP_FLAGS, dwInitialSize, dwMaximumSize); if( !pWinMemData->hHeap ){ - sqlite3_log(SQLITE_NOMEM, + tdsqlite3_log(SQLITE_NOMEM, "failed to HeapCreate (%lu), flags=%u, initSize=%lu, maxSize=%lu", osGetLastError(), SQLITE_WIN32_HEAP_FLAGS, dwInitialSize, dwMaximumSize); @@ -48121,7 +48121,7 @@ static int winMemInit(void *pAppData){ #else pWinMemData->hHeap = osGetProcessHeap(); if( !pWinMemData->hHeap ){ - sqlite3_log(SQLITE_NOMEM, + tdsqlite3_log(SQLITE_NOMEM, "failed to GetProcessHeap (%lu)", osGetLastError()); return SQLITE_NOMEM_BKPT; } @@ -48153,7 +48153,7 @@ static void winMemShutdown(void *pAppData){ #endif if( pWinMemData->bOwned ){ if( !osHeapDestroy(pWinMemData->hHeap) ){ - sqlite3_log(SQLITE_NOMEM, "failed to HeapDestroy (%lu), heap=%p", + tdsqlite3_log(SQLITE_NOMEM, "failed to HeapDestroy (%lu), heap=%p", osGetLastError(), (void*)pWinMemData->hHeap); } pWinMemData->bOwned = FALSE; @@ -48164,14 +48164,14 @@ static void winMemShutdown(void *pAppData){ /* ** Populate the low-level memory allocation function pointers in -** sqlite3GlobalConfig.m with pointers to the routines in this file. The +** tdsqlite3GlobalConfig.m with pointers to the routines in this file. The ** arguments specify the block of memory to manage. ** -** This routine is only called by sqlite3_config(), and therefore +** This routine is only called by tdsqlite3_config(), and therefore ** is not required to be threadsafe (it is not). */ -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetWin32(void){ - static const sqlite3_mem_methods winMemMethods = { +SQLITE_PRIVATE const tdsqlite3_mem_methods *tdsqlite3MemGetWin32(void){ + static const tdsqlite3_mem_methods winMemMethods = { winMemMalloc, winMemFree, winMemRealloc, @@ -48184,15 +48184,15 @@ SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetWin32(void){ return &winMemMethods; } -SQLITE_PRIVATE void sqlite3MemSetDefault(void){ - sqlite3_config(SQLITE_CONFIG_MALLOC, sqlite3MemGetWin32()); +SQLITE_PRIVATE void tdsqlite3MemSetDefault(void){ + tdsqlite3_config(SQLITE_CONFIG_MALLOC, tdsqlite3MemGetWin32()); } #endif /* SQLITE_WIN32_MALLOC */ /* ** Convert a UTF-8 string to Microsoft Unicode. ** -** Space to hold the returned string is obtained from sqlite3_malloc(). +** Space to hold the returned string is obtained from tdsqlite3_malloc(). */ static LPWSTR winUtf8ToUnicode(const char *zText){ int nChar; @@ -48202,14 +48202,14 @@ static LPWSTR winUtf8ToUnicode(const char *zText){ if( nChar==0 ){ return 0; } - zWideText = sqlite3MallocZero( nChar*sizeof(WCHAR) ); + zWideText = tdsqlite3MallocZero( nChar*sizeof(WCHAR) ); if( zWideText==0 ){ return 0; } nChar = osMultiByteToWideChar(CP_UTF8, 0, zText, -1, zWideText, nChar); if( nChar==0 ){ - sqlite3_free(zWideText); + tdsqlite3_free(zWideText); zWideText = 0; } return zWideText; @@ -48218,7 +48218,7 @@ static LPWSTR winUtf8ToUnicode(const char *zText){ /* ** Convert a Microsoft Unicode string to UTF-8. ** -** Space to hold the returned string is obtained from sqlite3_malloc(). +** Space to hold the returned string is obtained from tdsqlite3_malloc(). */ static char *winUnicodeToUtf8(LPCWSTR zWideText){ int nByte; @@ -48228,14 +48228,14 @@ static char *winUnicodeToUtf8(LPCWSTR zWideText){ if( nByte == 0 ){ return 0; } - zText = sqlite3MallocZero( nByte ); + zText = tdsqlite3MallocZero( nByte ); if( zText==0 ){ return 0; } nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideText, -1, zText, nByte, 0, 0); if( nByte == 0 ){ - sqlite3_free(zText); + tdsqlite3_free(zText); zText = 0; } return zText; @@ -48245,7 +48245,7 @@ static char *winUnicodeToUtf8(LPCWSTR zWideText){ ** Convert an ANSI string to Microsoft Unicode, using the ANSI or OEM ** code page. ** -** Space to hold the returned string is obtained from sqlite3_malloc(). +** Space to hold the returned string is obtained from tdsqlite3_malloc(). */ static LPWSTR winMbcsToUnicode(const char *zText, int useAnsi){ int nByte; @@ -48257,14 +48257,14 @@ static LPWSTR winMbcsToUnicode(const char *zText, int useAnsi){ if( nByte==0 ){ return 0; } - zMbcsText = sqlite3MallocZero( nByte*sizeof(WCHAR) ); + zMbcsText = tdsqlite3MallocZero( nByte*sizeof(WCHAR) ); if( zMbcsText==0 ){ return 0; } nByte = osMultiByteToWideChar(codepage, 0, zText, -1, zMbcsText, nByte); if( nByte==0 ){ - sqlite3_free(zMbcsText); + tdsqlite3_free(zMbcsText); zMbcsText = 0; } return zMbcsText; @@ -48274,7 +48274,7 @@ static LPWSTR winMbcsToUnicode(const char *zText, int useAnsi){ ** Convert a Microsoft Unicode string to a multi-byte character string, ** using the ANSI or OEM code page. ** -** Space to hold the returned string is obtained from sqlite3_malloc(). +** Space to hold the returned string is obtained from tdsqlite3_malloc(). */ static char *winUnicodeToMbcs(LPCWSTR zWideText, int useAnsi){ int nByte; @@ -48285,14 +48285,14 @@ static char *winUnicodeToMbcs(LPCWSTR zWideText, int useAnsi){ if( nByte == 0 ){ return 0; } - zText = sqlite3MallocZero( nByte ); + zText = tdsqlite3MallocZero( nByte ); if( zText==0 ){ return 0; } nByte = osWideCharToMultiByte(codepage, 0, zWideText, -1, zText, nByte, 0, 0); if( nByte == 0 ){ - sqlite3_free(zText); + tdsqlite3_free(zText); zText = 0; } return zText; @@ -48301,7 +48301,7 @@ static char *winUnicodeToMbcs(LPCWSTR zWideText, int useAnsi){ /* ** Convert a multi-byte character string to UTF-8. ** -** Space to hold the returned string is obtained from sqlite3_malloc(). +** Space to hold the returned string is obtained from tdsqlite3_malloc(). */ static char *winMbcsToUtf8(const char *zText, int useAnsi){ char *zTextUtf8; @@ -48312,14 +48312,14 @@ static char *winMbcsToUtf8(const char *zText, int useAnsi){ return 0; } zTextUtf8 = winUnicodeToUtf8(zTmpWide); - sqlite3_free(zTmpWide); + tdsqlite3_free(zTmpWide); return zTextUtf8; } /* ** Convert a UTF-8 string to a multi-byte character string. ** -** Space to hold the returned string is obtained from sqlite3_malloc(). +** Space to hold the returned string is obtained from tdsqlite3_malloc(). */ static char *winUtf8ToMbcs(const char *zText, int useAnsi){ char *zTextMbcs; @@ -48330,14 +48330,14 @@ static char *winUtf8ToMbcs(const char *zText, int useAnsi){ return 0; } zTextMbcs = winUnicodeToMbcs(zTmpWide, useAnsi); - sqlite3_free(zTmpWide); + tdsqlite3_free(zTmpWide); return zTextMbcs; } /* ** This is a public wrapper for the winUtf8ToUnicode() function. */ -SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText){ +SQLITE_API LPWSTR tdsqlite3_win32_utf8_to_unicode(const char *zText){ #ifdef SQLITE_ENABLE_API_ARMOR if( !zText ){ (void)SQLITE_MISUSE_BKPT; @@ -48345,7 +48345,7 @@ SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText){ } #endif #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; + if( tdsqlite3_initialize() ) return 0; #endif return winUtf8ToUnicode(zText); } @@ -48353,7 +48353,7 @@ SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText){ /* ** This is a public wrapper for the winUnicodeToUtf8() function. */ -SQLITE_API char *sqlite3_win32_unicode_to_utf8(LPCWSTR zWideText){ +SQLITE_API char *tdsqlite3_win32_unicode_to_utf8(LPCWSTR zWideText){ #ifdef SQLITE_ENABLE_API_ARMOR if( !zWideText ){ (void)SQLITE_MISUSE_BKPT; @@ -48361,7 +48361,7 @@ SQLITE_API char *sqlite3_win32_unicode_to_utf8(LPCWSTR zWideText){ } #endif #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; + if( tdsqlite3_initialize() ) return 0; #endif return winUnicodeToUtf8(zWideText); } @@ -48369,7 +48369,7 @@ SQLITE_API char *sqlite3_win32_unicode_to_utf8(LPCWSTR zWideText){ /* ** This is a public wrapper for the winMbcsToUtf8() function. */ -SQLITE_API char *sqlite3_win32_mbcs_to_utf8(const char *zText){ +SQLITE_API char *tdsqlite3_win32_mbcs_to_utf8(const char *zText){ #ifdef SQLITE_ENABLE_API_ARMOR if( !zText ){ (void)SQLITE_MISUSE_BKPT; @@ -48377,7 +48377,7 @@ SQLITE_API char *sqlite3_win32_mbcs_to_utf8(const char *zText){ } #endif #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; + if( tdsqlite3_initialize() ) return 0; #endif return winMbcsToUtf8(zText, osAreFileApisANSI()); } @@ -48385,7 +48385,7 @@ SQLITE_API char *sqlite3_win32_mbcs_to_utf8(const char *zText){ /* ** This is a public wrapper for the winMbcsToUtf8() function. */ -SQLITE_API char *sqlite3_win32_mbcs_to_utf8_v2(const char *zText, int useAnsi){ +SQLITE_API char *tdsqlite3_win32_mbcs_to_utf8_v2(const char *zText, int useAnsi){ #ifdef SQLITE_ENABLE_API_ARMOR if( !zText ){ (void)SQLITE_MISUSE_BKPT; @@ -48393,7 +48393,7 @@ SQLITE_API char *sqlite3_win32_mbcs_to_utf8_v2(const char *zText, int useAnsi){ } #endif #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; + if( tdsqlite3_initialize() ) return 0; #endif return winMbcsToUtf8(zText, useAnsi); } @@ -48401,7 +48401,7 @@ SQLITE_API char *sqlite3_win32_mbcs_to_utf8_v2(const char *zText, int useAnsi){ /* ** This is a public wrapper for the winUtf8ToMbcs() function. */ -SQLITE_API char *sqlite3_win32_utf8_to_mbcs(const char *zText){ +SQLITE_API char *tdsqlite3_win32_utf8_to_mbcs(const char *zText){ #ifdef SQLITE_ENABLE_API_ARMOR if( !zText ){ (void)SQLITE_MISUSE_BKPT; @@ -48409,7 +48409,7 @@ SQLITE_API char *sqlite3_win32_utf8_to_mbcs(const char *zText){ } #endif #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; + if( tdsqlite3_initialize() ) return 0; #endif return winUtf8ToMbcs(zText, osAreFileApisANSI()); } @@ -48417,7 +48417,7 @@ SQLITE_API char *sqlite3_win32_utf8_to_mbcs(const char *zText){ /* ** This is a public wrapper for the winUtf8ToMbcs() function. */ -SQLITE_API char *sqlite3_win32_utf8_to_mbcs_v2(const char *zText, int useAnsi){ +SQLITE_API char *tdsqlite3_win32_utf8_to_mbcs_v2(const char *zText, int useAnsi){ #ifdef SQLITE_ENABLE_API_ARMOR if( !zText ){ (void)SQLITE_MISUSE_BKPT; @@ -48425,42 +48425,42 @@ SQLITE_API char *sqlite3_win32_utf8_to_mbcs_v2(const char *zText, int useAnsi){ } #endif #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; + if( tdsqlite3_initialize() ) return 0; #endif return winUtf8ToMbcs(zText, useAnsi); } /* -** This function is the same as sqlite3_win32_set_directory (below); however, +** This function is the same as tdsqlite3_win32_set_directory (below); however, ** it accepts a UTF-8 string. */ -SQLITE_API int sqlite3_win32_set_directory8( +SQLITE_API int tdsqlite3_win32_set_directory8( unsigned long type, /* Identifier for directory being set or reset */ const char *zValue /* New value for directory being set or reset */ ){ char **ppDirectory = 0; #ifndef SQLITE_OMIT_AUTOINIT - int rc = sqlite3_initialize(); + int rc = tdsqlite3_initialize(); if( rc ) return rc; #endif if( type==SQLITE_WIN32_DATA_DIRECTORY_TYPE ){ - ppDirectory = &sqlite3_data_directory; + ppDirectory = &tdsqlite3_data_directory; }else if( type==SQLITE_WIN32_TEMP_DIRECTORY_TYPE ){ - ppDirectory = &sqlite3_temp_directory; + ppDirectory = &tdsqlite3_temp_directory; } assert( !ppDirectory || type==SQLITE_WIN32_DATA_DIRECTORY_TYPE || type==SQLITE_WIN32_TEMP_DIRECTORY_TYPE ); - assert( !ppDirectory || sqlite3MemdebugHasType(*ppDirectory, MEMTYPE_HEAP) ); + assert( !ppDirectory || tdsqlite3MemdebugHasType(*ppDirectory, MEMTYPE_HEAP) ); if( ppDirectory ){ char *zCopy = 0; if( zValue && zValue[0] ){ - zCopy = sqlite3_mprintf("%s", zValue); + zCopy = tdsqlite3_mprintf("%s", zValue); if ( zCopy==0 ){ return SQLITE_NOMEM_BKPT; } } - sqlite3_free(*ppDirectory); + tdsqlite3_free(*ppDirectory); *ppDirectory = zCopy; return SQLITE_OK; } @@ -48468,21 +48468,21 @@ SQLITE_API int sqlite3_win32_set_directory8( } /* -** This function is the same as sqlite3_win32_set_directory (below); however, +** This function is the same as tdsqlite3_win32_set_directory (below); however, ** it accepts a UTF-16 string. */ -SQLITE_API int sqlite3_win32_set_directory16( +SQLITE_API int tdsqlite3_win32_set_directory16( unsigned long type, /* Identifier for directory being set or reset */ const void *zValue /* New value for directory being set or reset */ ){ int rc; char *zUtf8 = 0; if( zValue ){ - zUtf8 = sqlite3_win32_unicode_to_utf8(zValue); + zUtf8 = tdsqlite3_win32_unicode_to_utf8(zValue); if( zUtf8==0 ) return SQLITE_NOMEM_BKPT; } - rc = sqlite3_win32_set_directory8(type, zUtf8); - if( zUtf8 ) sqlite3_free(zUtf8); + rc = tdsqlite3_win32_set_directory8(type, zUtf8); + if( zUtf8 ) tdsqlite3_free(zUtf8); return rc; } @@ -48493,11 +48493,11 @@ SQLITE_API int sqlite3_win32_set_directory16( ** argument is the name of the directory to use. The return value will be ** SQLITE_OK if successful. */ -SQLITE_API int sqlite3_win32_set_directory( +SQLITE_API int tdsqlite3_win32_set_directory( unsigned long type, /* Identifier for directory being set or reset */ void *zValue /* New value for directory being set or reset */ ){ - return sqlite3_win32_set_directory16(type, zValue); + return tdsqlite3_win32_set_directory16(type, zValue); } /* @@ -48538,9 +48538,9 @@ static int winGetLastErrorMsg(DWORD lastErrno, int nBuf, char *zBuf){ #endif if( dwLen > 0 ){ /* allocate a buffer and convert to UTF8 */ - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); zOut = winUnicodeToUtf8(zTempWide); - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); #if !SQLITE_OS_WINRT /* free the system buffer allocated by FormatMessage */ osLocalFree(zTempWide); @@ -48561,21 +48561,21 @@ static int winGetLastErrorMsg(DWORD lastErrno, int nBuf, char *zBuf){ 0); if( dwLen > 0 ){ /* allocate a buffer and convert to UTF8 */ - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); zOut = winMbcsToUtf8(zTemp, osAreFileApisANSI()); - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); /* free the system buffer allocated by FormatMessage */ osLocalFree(zTemp); } } #endif if( 0 == dwLen ){ - sqlite3_snprintf(nBuf, zBuf, "OsError 0x%lx (%lu)", lastErrno, lastErrno); + tdsqlite3_snprintf(nBuf, zBuf, "OsError 0x%lx (%lu)", lastErrno, lastErrno); }else{ /* copy a maximum of nBuf chars to output buffer */ - sqlite3_snprintf(nBuf, zBuf, "%s", zOut); + tdsqlite3_snprintf(nBuf, zBuf, "%s", zOut); /* free the UTF8 buffer */ - sqlite3_free(zOut); + tdsqlite3_free(zOut); } return 0; } @@ -48586,7 +48586,7 @@ static int winGetLastErrorMsg(DWORD lastErrno, int nBuf, char *zBuf){ ** winLogError(). ** ** This routine is invoked after an error occurs in an OS function. -** It logs a message using sqlite3_log() containing the current value of +** It logs a message using tdsqlite3_log() containing the current value of ** error code and, if possible, the human-readable equivalent from ** FormatMessage. ** @@ -48612,7 +48612,7 @@ static int winLogErrorAtLine( if( zPath==0 ) zPath = ""; for(i=0; zMsg[i] && zMsg[i]!='\r' && zMsg[i]!='\n'; i++){} zMsg[i] = 0; - sqlite3_log(errcode, + tdsqlite3_log(errcode, "os_win.c:%d: (%lu) %s(%s) - %s", iLine, lastErrno, zFunc, zPath, zMsg ); @@ -48675,13 +48675,13 @@ static int winRetryIoerr(int *pnRetry, DWORD *pError){ return 0; } if( winIoerrCanRetry1(e) ){ - sqlite3_win32_sleep(winIoerrRetryDelay*(1+*pnRetry)); + tdsqlite3_win32_sleep(winIoerrRetryDelay*(1+*pnRetry)); ++*pnRetry; return 1; } #if defined(winIoerrCanRetry2) else if( winIoerrCanRetry2(e) ){ - sqlite3_win32_sleep(winIoerrRetryDelay*(1+*pnRetry)); + tdsqlite3_win32_sleep(winIoerrRetryDelay*(1+*pnRetry)); ++*pnRetry; return 1; } @@ -48697,7 +48697,7 @@ static int winRetryIoerr(int *pnRetry, DWORD *pError){ */ static void winLogIoerr(int nRetry, int lineno){ if( nRetry ){ - sqlite3_log(SQLITE_NOTICE, + tdsqlite3_log(SQLITE_NOTICE, "delayed %dms for lock/sharing conflict at line %d", winIoerrRetryDelay*nRetry*(nRetry+1)/2, lineno ); @@ -48720,7 +48720,7 @@ struct tm *__cdecl localtime(const time_t *t) static struct tm y; FILETIME uTm, lTm; SYSTEMTIME pTm; - sqlite3_int64 t64; + tdsqlite3_int64 t64; t64 = *t; t64 = (t64 + 11644473600)*10000000; uTm.dwLowDateTime = (DWORD)(t64 & 0xFFFFFFFF); @@ -48789,7 +48789,7 @@ static int winceCreateLock(const char *zFilename, winFile *pFile){ pFile->hMutex = osCreateMutexW(NULL, FALSE, zName); if (!pFile->hMutex){ pFile->lastErrno = osGetLastError(); - sqlite3_free(zName); + tdsqlite3_free(zName); return winLogError(SQLITE_IOERR, pFile->lastErrno, "winceCreateLock1", zFilename); } @@ -48813,7 +48813,7 @@ static int winceCreateLock(const char *zFilename, winFile *pFile){ bInit = FALSE; } - sqlite3_free(zName); + tdsqlite3_free(zName); /* If we succeeded in making the shared memory handle, map it. */ if( pFile->hShared ){ @@ -49087,7 +49087,7 @@ static BOOL winUnlockFile( /***************************************************************************** ** The next group of routines implement the I/O methods specified -** by the sqlite3_io_methods object. +** by the tdsqlite3_io_methods object. ******************************************************************************/ /* @@ -49102,7 +49102,7 @@ static BOOL winUnlockFile( ** argument to offset iOffset within the file. If successful, return 0. ** Otherwise, set pFile->lastErrno and return non-zero. */ -static int winSeekFile(winFile *pFile, sqlite3_int64 iOffset){ +static int winSeekFile(winFile *pFile, tdsqlite3_int64 iOffset){ #if !SQLITE_OS_WINRT LONG upperBits; /* Most sig. 32 bits of new offset */ LONG lowerBits; /* Least sig. 32 bits of new offset */ @@ -49160,7 +49160,7 @@ static int winSeekFile(winFile *pFile, sqlite3_int64 iOffset){ #if SQLITE_MAX_MMAP_SIZE>0 /* Forward references to VFS helper methods used for memory mapped files */ -static int winMapfile(winFile*, sqlite3_int64); +static int winMapfile(winFile*, tdsqlite3_int64); static int winUnmapfile(winFile*); #endif @@ -49175,7 +49175,7 @@ static int winUnmapfile(winFile*); ** giving up and returning an error. */ #define MX_CLOSE_ATTEMPT 3 -static int winClose(sqlite3_file *id){ +static int winClose(tdsqlite3_file *id){ int rc, cnt = 0; winFile *pFile = (winFile*)id; @@ -49194,7 +49194,7 @@ static int winClose(sqlite3_file *id){ do{ rc = osCloseHandle(pFile->h); /* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */ - }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (sqlite3_win32_sleep(100), 1) ); + }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (tdsqlite3_win32_sleep(100), 1) ); #if SQLITE_OS_WINCE #define WINCE_DELETION_ATTEMPTS 3 { @@ -49210,9 +49210,9 @@ static int winClose(sqlite3_file *id){ && osGetFileAttributesW(pFile->zDeleteOnClose)!=0xffffffff && cnt++ < WINCE_DELETION_ATTEMPTS ){ - sqlite3_win32_sleep(100); /* Wait a little before trying again */ + tdsqlite3_win32_sleep(100); /* Wait a little before trying again */ } - sqlite3_free(pFile->zDeleteOnClose); + tdsqlite3_free(pFile->zDeleteOnClose); } #endif if( rc ){ @@ -49232,10 +49232,10 @@ static int winClose(sqlite3_file *id){ ** wrong. */ static int winRead( - sqlite3_file *id, /* File to read from */ + tdsqlite3_file *id, /* File to read from */ void *pBuf, /* Write content into this buffer */ int amt, /* Number of bytes to read */ - sqlite3_int64 offset /* Begin reading at this offset */ + tdsqlite3_int64 offset /* Begin reading at this offset */ ){ #if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED) OVERLAPPED overlapped; /* The offset for ReadFile. */ @@ -49312,10 +49312,10 @@ static int winRead( ** or some other error code on failure. */ static int winWrite( - sqlite3_file *id, /* File to write into */ + tdsqlite3_file *id, /* File to write into */ const void *pBuf, /* The bytes to be written */ int amt, /* Number of bytes to write */ - sqlite3_int64 offset /* Offset into the file to begin writing at */ + tdsqlite3_int64 offset /* Offset into the file to begin writing at */ ){ int rc = 0; /* True if error has occurred, else false */ winFile *pFile = (winFile*)id; /* File handle */ @@ -49420,12 +49420,12 @@ static int winWrite( /* ** Truncate an open file to a specified size */ -static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){ +static int winTruncate(tdsqlite3_file *id, tdsqlite3_int64 nByte){ winFile *pFile = (winFile*)id; /* File handle object */ int rc = SQLITE_OK; /* Return code for this function */ DWORD lastErrno; #if SQLITE_MAX_MMAP_SIZE>0 - sqlite3_int64 oldMmapSize; + tdsqlite3_int64 oldMmapSize; if( pFile->nFetchOut>0 ){ /* File truncation is a no-op if there are outstanding memory mapped ** pages. This is because truncating the file means temporarily unmapping @@ -49493,7 +49493,7 @@ static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){ #endif OSTRACE(("TRUNCATE pid=%lu, pFile=%p, file=%p, rc=%s\n", - osGetCurrentProcessId(), pFile, pFile->h, sqlite3ErrName(rc))); + osGetCurrentProcessId(), pFile, pFile->h, tdsqlite3ErrName(rc))); return rc; } @@ -49502,14 +49502,14 @@ static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){ ** Count the number of fullsyncs and normal syncs. This is used to test ** that syncs and fullsyncs are occuring at the right times. */ -SQLITE_API int sqlite3_sync_count = 0; -SQLITE_API int sqlite3_fullsync_count = 0; +SQLITE_API int tdsqlite3_sync_count = 0; +SQLITE_API int tdsqlite3_fullsync_count = 0; #endif /* ** Make sure all writes to a particular file are committed to disk. */ -static int winSync(sqlite3_file *id, int flags){ +static int winSync(tdsqlite3_file *id, int flags){ #ifndef SQLITE_NO_SYNC /* ** Used only when SQLITE_NO_SYNC is not defined. @@ -49546,9 +49546,9 @@ static int winSync(sqlite3_file *id, int flags){ UNUSED_PARAMETER(flags); #else if( (flags&0x0F)==SQLITE_SYNC_FULL ){ - sqlite3_fullsync_count++; + tdsqlite3_fullsync_count++; } - sqlite3_sync_count++; + tdsqlite3_sync_count++; #endif /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a @@ -49594,7 +49594,7 @@ static int winSync(sqlite3_file *id, int flags){ /* ** Determine the current size of a file in bytes */ -static int winFileSize(sqlite3_file *id, sqlite3_int64 *pSize){ +static int winFileSize(tdsqlite3_file *id, tdsqlite3_int64 *pSize){ winFile *pFile = (winFile*)id; int rc = SQLITE_OK; @@ -49622,7 +49622,7 @@ static int winFileSize(sqlite3_file *id, sqlite3_int64 *pSize){ DWORD lastErrno; lowerBits = osGetFileSize(pFile->h, &upperBits); - *pSize = (((sqlite3_int64)upperBits)<<32) + lowerBits; + *pSize = (((tdsqlite3_int64)upperBits)<<32) + lowerBits; if( (lowerBits == INVALID_FILE_SIZE) && ((lastErrno = osGetLastError())!=NO_ERROR) ){ pFile->lastErrno = lastErrno; @@ -49632,7 +49632,7 @@ static int winFileSize(sqlite3_file *id, sqlite3_int64 *pSize){ } #endif OSTRACE(("SIZE file=%p, pSize=%p, *pSize=%lld, rc=%s\n", - pFile->h, pSize, *pSize, sqlite3ErrName(rc))); + pFile->h, pSize, *pSize, tdsqlite3ErrName(rc))); return rc; } @@ -49690,7 +49690,7 @@ static int winGetReadLock(winFile *pFile){ #ifdef SQLITE_WIN32_HAS_ANSI else{ int lk; - sqlite3_randomness(sizeof(lk), &lk); + tdsqlite3_randomness(sizeof(lk), &lk); pFile->sharedLockByte = (short)((lk & 0x7fffffff)%(SHARED_SIZE - 1)); res = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS, SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0); @@ -49754,7 +49754,7 @@ static int winUnlockReadLock(winFile *pFile){ ** It is not possible to lower the locking level one step at a time. You ** must go straight to locking level 0. */ -static int winLock(sqlite3_file *id, int locktype){ +static int winLock(tdsqlite3_file *id, int locktype){ int rc = SQLITE_OK; /* Return code from subroutines */ int res = 1; /* Result of a Windows lock call */ int newLocktype; /* Set pFile->locktype to this value before exiting */ @@ -49768,7 +49768,7 @@ static int winLock(sqlite3_file *id, int locktype){ /* If there is already a lock of this type or more restrictive on the ** OsFile, do nothing. Don't use the end_lock: exit path, as - ** sqlite3OsEnterMutex() hasn't been called yet. + ** tdsqlite3OsEnterMutex() hasn't been called yet. */ if( pFile->locktype>=locktype ){ OSTRACE(("LOCK-HELD file=%p, rc=SQLITE_OK\n", pFile->h)); @@ -49811,10 +49811,10 @@ static int winLock(sqlite3_file *id, int locktype){ pFile->lastErrno = lastErrno; rc = SQLITE_IOERR_LOCK; OSTRACE(("LOCK-FAIL file=%p, count=%d, rc=%s\n", - pFile->h, cnt, sqlite3ErrName(rc))); + pFile->h, cnt, tdsqlite3ErrName(rc))); return rc; } - if( cnt ) sqlite3_win32_sleep(1); + if( cnt ) tdsqlite3_win32_sleep(1); } gotPendingLock = res; if( !res ){ @@ -49888,7 +49888,7 @@ static int winLock(sqlite3_file *id, int locktype){ } pFile->locktype = (u8)newLocktype; OSTRACE(("LOCK file=%p, lock=%d, rc=%s\n", - pFile->h, pFile->locktype, sqlite3ErrName(rc))); + pFile->h, pFile->locktype, tdsqlite3ErrName(rc))); return rc; } @@ -49897,7 +49897,7 @@ static int winLock(sqlite3_file *id, int locktype){ ** file by this or any other process. If such a lock is held, return ** non-zero, otherwise zero. */ -static int winCheckReservedLock(sqlite3_file *id, int *pResOut){ +static int winCheckReservedLock(tdsqlite3_file *id, int *pResOut){ int res; winFile *pFile = (winFile*)id; @@ -49933,7 +49933,7 @@ static int winCheckReservedLock(sqlite3_file *id, int *pResOut){ ** is NO_LOCK. If the second argument is SHARED_LOCK then this routine ** might return SQLITE_IOERR; */ -static int winUnlock(sqlite3_file *id, int locktype){ +static int winUnlock(tdsqlite3_file *id, int locktype){ int type; winFile *pFile = (winFile*)id; int rc = SQLITE_OK; @@ -49962,7 +49962,7 @@ static int winUnlock(sqlite3_file *id, int locktype){ } pFile->locktype = (u8)locktype; OSTRACE(("UNLOCK file=%p, lock=%d, rc=%s\n", - pFile->h, pFile->locktype, sqlite3ErrName(rc))); + pFile->h, pFile->locktype, tdsqlite3ErrName(rc))); return rc; } @@ -49983,19 +49983,19 @@ static int winUnlock(sqlite3_file *id, int locktype){ ** time and one or more of those connections are writing. */ -static int winNolockLock(sqlite3_file *id, int locktype){ +static int winNolockLock(tdsqlite3_file *id, int locktype){ UNUSED_PARAMETER(id); UNUSED_PARAMETER(locktype); return SQLITE_OK; } -static int winNolockCheckReservedLock(sqlite3_file *id, int *pResOut){ +static int winNolockCheckReservedLock(tdsqlite3_file *id, int *pResOut){ UNUSED_PARAMETER(id); UNUSED_PARAMETER(pResOut); return SQLITE_OK; } -static int winNolockUnlock(sqlite3_file *id, int locktype){ +static int winNolockUnlock(tdsqlite3_file *id, int locktype){ UNUSED_PARAMETER(id); UNUSED_PARAMETER(locktype); return SQLITE_OK; @@ -50021,14 +50021,14 @@ static void winModeBit(winFile *pFile, unsigned char mask, int *pArg){ } /* Forward references to VFS helper methods used for temporary files */ -static int winGetTempname(sqlite3_vfs *, char **); +static int winGetTempname(tdsqlite3_vfs *, char **); static int winIsDir(const void *); static BOOL winIsDriveLetterAndColon(const char *); /* ** Control and query of the open file handle. */ -static int winFileControl(sqlite3_file *id, int op, void *pArg){ +static int winFileControl(tdsqlite3_file *id, int op, void *pArg){ winFile *pFile = (winFile*)id; OSTRACE(("FCNTL file=%p, op=%d, pArg=%p\n", pFile->h, op, pArg)); switch( op ){ @@ -50049,17 +50049,17 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ } case SQLITE_FCNTL_SIZE_HINT: { if( pFile->szChunk>0 ){ - sqlite3_int64 oldSz; + tdsqlite3_int64 oldSz; int rc = winFileSize(id, &oldSz); if( rc==SQLITE_OK ){ - sqlite3_int64 newSz = *(sqlite3_int64*)pArg; + tdsqlite3_int64 newSz = *(tdsqlite3_int64*)pArg; if( newSz>oldSz ){ SimulateIOErrorBenign(1); rc = winTruncate(id, newSz); SimulateIOErrorBenign(0); } } - OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc))); + OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, tdsqlite3ErrName(rc))); return rc; } OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h)); @@ -50076,7 +50076,7 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ return SQLITE_OK; } case SQLITE_FCNTL_VFSNAME: { - *(char**)pArg = sqlite3_mprintf("%s", pFile->pVfs->zName); + *(char**)pArg = tdsqlite3_mprintf("%s", pFile->pVfs->zName); OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h)); return SQLITE_OK; } @@ -50118,15 +50118,15 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ if( rc==SQLITE_OK ){ *(char**)pArg = zTFile; } - OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc))); + OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, tdsqlite3ErrName(rc))); return rc; } #if SQLITE_MAX_MMAP_SIZE>0 case SQLITE_FCNTL_MMAP_SIZE: { i64 newLimit = *(i64*)pArg; int rc = SQLITE_OK; - if( newLimit>sqlite3GlobalConfig.mxMmap ){ - newLimit = sqlite3GlobalConfig.mxMmap; + if( newLimit>tdsqlite3GlobalConfig.mxMmap ){ + newLimit = tdsqlite3GlobalConfig.mxMmap; } /* The value of newLimit may be eventually cast to (SIZE_T) and passed @@ -50144,7 +50144,7 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ rc = winMapfile(pFile, -1); } } - OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc))); + OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, tdsqlite3ErrName(rc))); return rc; } #endif @@ -50163,7 +50163,7 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ ** a database and its journal file) that the sector size will be the ** same for both. */ -static int winSectorSize(sqlite3_file *id){ +static int winSectorSize(tdsqlite3_file *id){ (void)id; return SQLITE_DEFAULT_SECTOR_SIZE; } @@ -50171,7 +50171,7 @@ static int winSectorSize(sqlite3_file *id){ /* ** Return a vector of device characteristics. */ -static int winDeviceCharacteristics(sqlite3_file *id){ +static int winDeviceCharacteristics(tdsqlite3_file *id){ winFile *p = (winFile*)id; return SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN | ((p->ctrlFlags & WINFILE_PSOW)?SQLITE_IOCAP_POWERSAFE_OVERWRITE:0); @@ -50180,7 +50180,7 @@ static int winDeviceCharacteristics(sqlite3_file *id){ /* ** Windows will only let you create file view mappings ** on allocation size granularity boundaries. -** During sqlite3_os_init() we do a GetSystemInfo() +** During tdsqlite3_os_init() we do a GetSystemInfo() ** to get the granularity size. */ static SYSTEM_INFO winSysInfo; @@ -50200,16 +50200,16 @@ static SYSTEM_INFO winSysInfo; ** assert( winShmMutexHeld() ); ** winShmLeaveMutex() */ -static sqlite3_mutex *winBigLock = 0; +static tdsqlite3_mutex *winBigLock = 0; static void winShmEnterMutex(void){ - sqlite3_mutex_enter(winBigLock); + tdsqlite3_mutex_enter(winBigLock); } static void winShmLeaveMutex(void){ - sqlite3_mutex_leave(winBigLock); + tdsqlite3_mutex_leave(winBigLock); } #ifndef NDEBUG static int winShmMutexHeld(void) { - return sqlite3_mutex_held(winBigLock); + return tdsqlite3_mutex_held(winBigLock); } #endif @@ -50237,7 +50237,7 @@ static int winShmMutexHeld(void) { ** */ struct winShmNode { - sqlite3_mutex *mutex; /* Mutex to access this object */ + tdsqlite3_mutex *mutex; /* Mutex to access this object */ char *zFilename; /* Name of the file */ winFile hFile; /* File handle from winOpen */ @@ -50312,7 +50312,7 @@ static int winShmSystemLock( int rc = 0; /* Result code form Lock/UnlockFileEx() */ /* Access to the winShmNode object is serialized by the caller */ - assert( pFile->nRef==0 || sqlite3_mutex_held(pFile->mutex) ); + assert( pFile->nRef==0 || tdsqlite3_mutex_held(pFile->mutex) ); OSTRACE(("SHM-LOCK file=%p, lock=%d, offset=%d, size=%d\n", pFile->hFile.h, lockType, ofst, nByte)); @@ -50336,14 +50336,14 @@ static int winShmSystemLock( OSTRACE(("SHM-LOCK file=%p, func=%s, errno=%lu, rc=%s\n", pFile->hFile.h, (lockType == WINSHM_UNLCK) ? "winUnlockFile" : - "winLockFile", pFile->lastErrno, sqlite3ErrName(rc))); + "winLockFile", pFile->lastErrno, tdsqlite3ErrName(rc))); return rc; } /* Forward references to VFS methods */ -static int winOpen(sqlite3_vfs*,const char*,sqlite3_file*,int,int*); -static int winDelete(sqlite3_vfs *,const char*,int); +static int winOpen(tdsqlite3_vfs*,const char*,tdsqlite3_file*,int,int*); +static int winDelete(tdsqlite3_vfs *,const char*,int); /* ** Purge the winShmNodeList list of all entries with winShmNode.nRef==0. @@ -50351,7 +50351,7 @@ static int winDelete(sqlite3_vfs *,const char*,int); ** This is not a VFS shared-memory method; it is a utility function called ** by VFS shared-memory methods. */ -static void winShmPurge(sqlite3_vfs *pVfs, int deleteFlag){ +static void winShmPurge(tdsqlite3_vfs *pVfs, int deleteFlag){ winShmNode **pp; winShmNode *p; assert( winShmMutexHeld() ); @@ -50361,7 +50361,7 @@ static void winShmPurge(sqlite3_vfs *pVfs, int deleteFlag){ while( (p = *pp)!=0 ){ if( p->nRef==0 ){ int i; - if( p->mutex ){ sqlite3_mutex_free(p->mutex); } + if( p->mutex ){ tdsqlite3_mutex_free(p->mutex); } for(i=0; inRegion; i++){ BOOL bRc = osUnmapViewOfFile(p->aRegion[i].pMap); OSTRACE(("SHM-PURGE-UNMAP pid=%lu, region=%d, rc=%s\n", @@ -50374,19 +50374,19 @@ static void winShmPurge(sqlite3_vfs *pVfs, int deleteFlag){ } if( p->hFile.h!=NULL && p->hFile.h!=INVALID_HANDLE_VALUE ){ SimulateIOErrorBenign(1); - winClose((sqlite3_file *)&p->hFile); + winClose((tdsqlite3_file *)&p->hFile); SimulateIOErrorBenign(0); } if( deleteFlag ){ SimulateIOErrorBenign(1); - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); winDelete(pVfs, p->zFilename, 0); - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); SimulateIOErrorBenign(0); } *pp = p->pNext; - sqlite3_free(p->aRegion); - sqlite3_free(p); + tdsqlite3_free(p->aRegion); + tdsqlite3_free(p); }else{ pp = &p->pNext; } @@ -50410,7 +50410,7 @@ static int winLockSharedMemory(winShmNode *pShmNode){ pShmNode->isUnlocked = 1; winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1); return SQLITE_READONLY_CANTINIT; - }else if( winTruncate((sqlite3_file*)&pShmNode->hFile, 0) ){ + }else if( winTruncate((tdsqlite3_file*)&pShmNode->hFile, 0) ){ winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1); return winLogError(SQLITE_IOERR_SHMOPEN, osGetLastError(), "winLockSharedMemory", pShmNode->zFilename); @@ -50440,20 +50440,20 @@ static int winOpenSharedMemory(winFile *pDbFd){ assert( pDbFd->pShm==0 ); /* Not previously opened */ - /* Allocate space for the new sqlite3_shm object. Also speculatively + /* Allocate space for the new tdsqlite3_shm object. Also speculatively ** allocate space for a new winShmNode and filename. */ - p = sqlite3MallocZero( sizeof(*p) ); + p = tdsqlite3MallocZero( sizeof(*p) ); if( p==0 ) return SQLITE_IOERR_NOMEM_BKPT; - nName = sqlite3Strlen30(pDbFd->zPath); - pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 ); + nName = tdsqlite3Strlen30(pDbFd->zPath); + pNew = tdsqlite3MallocZero( sizeof(*pShmNode) + nName + 17 ); if( pNew==0 ){ - sqlite3_free(p); + tdsqlite3_free(p); return SQLITE_IOERR_NOMEM_BKPT; } pNew->zFilename = (char*)&pNew[1]; - sqlite3_snprintf(nName+15, pNew->zFilename, "%s-shm", pDbFd->zPath); - sqlite3FileSuffix3(pDbFd->zPath, pNew->zFilename); + tdsqlite3_snprintf(nName+15, pNew->zFilename, "%s-shm", pDbFd->zPath); + tdsqlite3FileSuffix3(pDbFd->zPath, pNew->zFilename); /* Look to see if there is an existing winShmNode that can be used. ** If no matching winShmNode currently exists, create a new one. @@ -50463,10 +50463,10 @@ static int winOpenSharedMemory(winFile *pDbFd){ /* TBD need to come up with better match here. Perhaps ** use FILE_ID_BOTH_DIR_INFO Structure. */ - if( sqlite3StrICmp(pShmNode->zFilename, pNew->zFilename)==0 ) break; + if( tdsqlite3StrICmp(pShmNode->zFilename, pNew->zFilename)==0 ) break; } if( pShmNode ){ - sqlite3_free(pNew); + tdsqlite3_free(pNew); }else{ int inFlags = SQLITE_OPEN_WAL; int outFlags = 0; @@ -50477,21 +50477,21 @@ static int winOpenSharedMemory(winFile *pDbFd){ pShmNode->pNext = winShmNodeList; winShmNodeList = pShmNode; - if( sqlite3GlobalConfig.bCoreMutex ){ - pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); + if( tdsqlite3GlobalConfig.bCoreMutex ){ + pShmNode->mutex = tdsqlite3_mutex_alloc(SQLITE_MUTEX_FAST); if( pShmNode->mutex==0 ){ rc = SQLITE_IOERR_NOMEM_BKPT; goto shm_open_err; } } - if( 0==sqlite3_uri_boolean(pDbFd->zPath, "readonly_shm", 0) ){ + if( 0==tdsqlite3_uri_boolean(pDbFd->zPath, "readonly_shm", 0) ){ inFlags |= SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; }else{ inFlags |= SQLITE_OPEN_READONLY; } rc = winOpen(pDbFd->pVfs, pShmNode->zFilename, - (sqlite3_file*)&pShmNode->hFile, + (tdsqlite3_file*)&pShmNode->hFile, inFlags, &outFlags); if( rc!=SQLITE_OK ){ rc = winLogError(rc, osGetLastError(), "winOpenShm", @@ -50520,18 +50520,18 @@ static int winOpenSharedMemory(winFile *pDbFd){ ** at pShmNode->pFirst. This must be done while holding the pShmNode->mutex ** mutex. */ - sqlite3_mutex_enter(pShmNode->mutex); + tdsqlite3_mutex_enter(pShmNode->mutex); p->pNext = pShmNode->pFirst; pShmNode->pFirst = p; - sqlite3_mutex_leave(pShmNode->mutex); + tdsqlite3_mutex_leave(pShmNode->mutex); return rc; /* Jump here on any error */ shm_open_err: winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1); winShmPurge(pDbFd->pVfs, 0); /* This call frees pShmNode if required */ - sqlite3_free(p); - sqlite3_free(pNew); + tdsqlite3_free(p); + tdsqlite3_free(pNew); winShmLeaveMutex(); return rc; } @@ -50541,7 +50541,7 @@ shm_open_err: ** storage if deleteFlag is true. */ static int winShmUnmap( - sqlite3_file *fd, /* Database holding shared memory */ + tdsqlite3_file *fd, /* Database holding shared memory */ int deleteFlag /* Delete after closing if true */ ){ winFile *pDbFd; /* Database holding shared-memory */ @@ -50556,14 +50556,14 @@ static int winShmUnmap( /* Remove connection p from the set of connections associated ** with pShmNode */ - sqlite3_mutex_enter(pShmNode->mutex); + tdsqlite3_mutex_enter(pShmNode->mutex); for(pp=&pShmNode->pFirst; (*pp)!=p; pp = &(*pp)->pNext){} *pp = p->pNext; /* Free the connection p */ - sqlite3_free(p); + tdsqlite3_free(p); pDbFd->pShm = 0; - sqlite3_mutex_leave(pShmNode->mutex); + tdsqlite3_mutex_leave(pShmNode->mutex); /* If pShmNode->nRef has reached 0, then close the underlying ** shared-memory file, too */ @@ -50582,7 +50582,7 @@ static int winShmUnmap( ** Change the lock state for a shared-memory segment. */ static int winShmLock( - sqlite3_file *fd, /* Database file holding the shared memory */ + tdsqlite3_file *fd, /* Database file holding the shared memory */ int ofst, /* First lock to acquire or release */ int n, /* Number of locks to acquire or release */ int flags /* What to do with the lock */ @@ -50604,7 +50604,7 @@ static int winShmLock( mask = (u16)((1U<<(ofst+n)) - (1U<1 || mask==(1<mutex); + tdsqlite3_mutex_enter(pShmNode->mutex); if( flags & SQLITE_SHM_UNLOCK ){ u16 allMask = 0; /* Mask of locks held by siblings */ @@ -50677,10 +50677,10 @@ static int winShmLock( } } } - sqlite3_mutex_leave(pShmNode->mutex); + tdsqlite3_mutex_leave(pShmNode->mutex); OSTRACE(("SHM-LOCK pid=%lu, id=%d, sharedMask=%03x, exclMask=%03x, rc=%s\n", osGetCurrentProcessId(), p->id, p->sharedMask, p->exclMask, - sqlite3ErrName(rc))); + tdsqlite3ErrName(rc))); return rc; } @@ -50691,10 +50691,10 @@ static int winShmLock( ** any load or store begun after the barrier. */ static void winShmBarrier( - sqlite3_file *fd /* Database holding the shared memory */ + tdsqlite3_file *fd /* Database holding the shared memory */ ){ UNUSED_PARAMETER(fd); - sqlite3MemoryBarrier(); /* compiler-defined memory barrier */ + tdsqlite3MemoryBarrier(); /* compiler-defined memory barrier */ winShmEnterMutex(); /* Also mutex, for redundancy */ winShmLeaveMutex(); } @@ -50719,7 +50719,7 @@ static void winShmBarrier( ** memory and SQLITE_OK returned. */ static int winShmMap( - sqlite3_file *fd, /* Handle open on database file */ + tdsqlite3_file *fd, /* Handle open on database file */ int iRegion, /* Region to retrieve */ int szRegion, /* Size of regions */ int isWrite, /* True to extend file if necessary */ @@ -50740,7 +50740,7 @@ static int winShmMap( } pShmNode = pShm->pShmNode; - sqlite3_mutex_enter(pShmNode->mutex); + tdsqlite3_mutex_enter(pShmNode->mutex); if( pShmNode->isUnlocked ){ rc = winLockSharedMemory(pShmNode); if( rc!=SQLITE_OK ) goto shmpage_out; @@ -50751,7 +50751,7 @@ static int winShmMap( if( pShmNode->nRegion<=iRegion ){ struct ShmRegion *apNew; /* New aRegion[] array */ int nByte = (iRegion+1)*szRegion; /* Minimum required file size */ - sqlite3_int64 sz; /* Current size of wal-index file */ + tdsqlite3_int64 sz; /* Current size of wal-index file */ pShmNode->szRegion = szRegion; @@ -50759,7 +50759,7 @@ static int winShmMap( ** Check to see if it has been allocated (i.e. if the wal-index file is ** large enough to contain the requested region). */ - rc = winFileSize((sqlite3_file *)&pShmNode->hFile, &sz); + rc = winFileSize((tdsqlite3_file *)&pShmNode->hFile, &sz); if( rc!=SQLITE_OK ){ rc = winLogError(SQLITE_IOERR_SHMSIZE, osGetLastError(), "winShmMap1", pDbFd->zPath); @@ -50774,7 +50774,7 @@ static int winShmMap( ** the requested memory region. */ if( !isWrite ) goto shmpage_out; - rc = winTruncate((sqlite3_file *)&pShmNode->hFile, nByte); + rc = winTruncate((tdsqlite3_file *)&pShmNode->hFile, nByte); if( rc!=SQLITE_OK ){ rc = winLogError(SQLITE_IOERR_SHMSIZE, osGetLastError(), "winShmMap2", pDbFd->zPath); @@ -50783,7 +50783,7 @@ static int winShmMap( } /* Map the requested memory region into this processes address space. */ - apNew = (struct ShmRegion *)sqlite3_realloc64( + apNew = (struct ShmRegion *)tdsqlite3_realloc64( pShmNode->aRegion, (iRegion+1)*sizeof(apNew[0]) ); if( !apNew ){ @@ -50857,7 +50857,7 @@ shmpage_out: *pp = 0; } if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY; - sqlite3_mutex_leave(pShmNode->mutex); + tdsqlite3_mutex_leave(pShmNode->mutex); return rc; } @@ -50921,8 +50921,8 @@ static int winUnmapfile(winFile *pFile){ ** recreated as a result of outstanding references) or an SQLite error ** code otherwise. */ -static int winMapfile(winFile *pFd, sqlite3_int64 nByte){ - sqlite3_int64 nMap = nByte; +static int winMapfile(winFile *pFd, tdsqlite3_int64 nByte){ + tdsqlite3_int64 nMap = nByte; int rc; assert( nMap>=0 || pFd->nFetchOut==0 ); @@ -50932,7 +50932,7 @@ static int winMapfile(winFile *pFd, sqlite3_int64 nByte){ if( pFd->nFetchOut>0 ) return SQLITE_OK; if( nMap<0 ){ - rc = winFileSize((sqlite3_file*)pFd, &nMap); + rc = winFileSize((tdsqlite3_file*)pFd, &nMap); if( rc ){ OSTRACE(("MAP-FILE pid=%lu, pFile=%p, rc=SQLITE_IOERR_FSTAT\n", osGetCurrentProcessId(), pFd)); @@ -50942,7 +50942,7 @@ static int winMapfile(winFile *pFd, sqlite3_int64 nByte){ if( nMap>pFd->mmapSizeMax ){ nMap = pFd->mmapSizeMax; } - nMap &= ~(sqlite3_int64)(winSysInfo.dwPageSize - 1); + nMap &= ~(tdsqlite3_int64)(winSysInfo.dwPageSize - 1); if( nMap==0 && pFd->mmapSize>0 ){ winUnmapfile(pFd); @@ -50976,11 +50976,11 @@ static int winMapfile(winFile *pFd, sqlite3_int64 nByte){ "winMapfile1", pFd->zPath); /* Log the error, but continue normal operation using xRead/xWrite */ OSTRACE(("MAP-FILE-CREATE pid=%lu, pFile=%p, rc=%s\n", - osGetCurrentProcessId(), pFd, sqlite3ErrName(rc))); + osGetCurrentProcessId(), pFd, tdsqlite3ErrName(rc))); return SQLITE_OK; } assert( (nMap % winSysInfo.dwPageSize)==0 ); - assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff ); + assert( sizeof(SIZE_T)==sizeof(tdsqlite3_int64) || nMap<=0xffffffff ); #if SQLITE_OS_WINRT pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap); #else @@ -50994,7 +50994,7 @@ static int winMapfile(winFile *pFd, sqlite3_int64 nByte){ "winMapfile2", pFd->zPath); /* Log the error, but continue normal operation using xRead/xWrite */ OSTRACE(("MAP-FILE-MAP pid=%lu, pFile=%p, rc=%s\n", - osGetCurrentProcessId(), pFd, sqlite3ErrName(rc))); + osGetCurrentProcessId(), pFd, tdsqlite3ErrName(rc))); return SQLITE_OK; } pFd->pMapRegion = pNew; @@ -51019,7 +51019,7 @@ static int winMapfile(winFile *pFd, sqlite3_int64 nByte){ ** If this function does return a pointer, the caller must eventually ** release the reference by calling winUnfetch(). */ -static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){ +static int winFetch(tdsqlite3_file *fd, i64 iOff, int nAmt, void **pp){ #if SQLITE_MAX_MMAP_SIZE>0 winFile *pFd = (winFile*)fd; /* The underlying database file */ #endif @@ -51034,7 +51034,7 @@ static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){ int rc = winMapfile(pFd, -1); if( rc!=SQLITE_OK ){ OSTRACE(("FETCH pid=%lu, pFile=%p, rc=%s\n", - osGetCurrentProcessId(), pFd, sqlite3ErrName(rc))); + osGetCurrentProcessId(), pFd, tdsqlite3ErrName(rc))); return rc; } } @@ -51061,7 +51061,7 @@ static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){ ** to inform the VFS layer that, according to POSIX, any existing mapping ** may now be invalid and should be unmapped. */ -static int winUnfetch(sqlite3_file *fd, i64 iOff, void *p){ +static int winUnfetch(tdsqlite3_file *fd, i64 iOff, void *p){ #if SQLITE_MAX_MMAP_SIZE>0 winFile *pFd = (winFile*)fd; /* The underlying database file */ @@ -51095,16 +51095,16 @@ static int winUnfetch(sqlite3_file *fd, i64 iOff, void *p){ } /* -** Here ends the implementation of all sqlite3_file methods. +** Here ends the implementation of all tdsqlite3_file methods. ** -********************** End sqlite3_file Methods ******************************* +********************** End tdsqlite3_file Methods ******************************* ******************************************************************************/ /* ** This vector defines all the methods that can operate on an -** sqlite3_file for win32. +** tdsqlite3_file for win32. */ -static const sqlite3_io_methods winIoMethod = { +static const tdsqlite3_io_methods winIoMethod = { 3, /* iVersion */ winClose, /* xClose */ winRead, /* xRead */ @@ -51128,9 +51128,9 @@ static const sqlite3_io_methods winIoMethod = { /* ** This vector defines all the methods that can operate on an -** sqlite3_file for win32 without performing any locking. +** tdsqlite3_file for win32 without performing any locking. */ -static const sqlite3_io_methods winIoNolockMethod = { +static const tdsqlite3_io_methods winIoNolockMethod = { 3, /* iVersion */ winClose, /* xClose */ winRead, /* xRead */ @@ -51165,10 +51165,10 @@ static winVfsAppData winNolockAppData = { }; /**************************************************************************** -**************************** sqlite3_vfs methods **************************** +**************************** tdsqlite3_vfs methods **************************** ** ** This division contains the implementation of methods on the -** sqlite3_vfs object. +** tdsqlite3_vfs object. */ #if defined(__CYGWIN__) @@ -51219,7 +51219,7 @@ static void *winConvertFromUtf8Filename(const char *zFilename){ */ static int winMakeEndInDirSep(int nBuf, char *zBuf){ if( zBuf ){ - int nLen = sqlite3Strlen30(zBuf); + int nLen = tdsqlite3Strlen30(zBuf); if( nLen>0 ){ if( winIsDirSep(zBuf[nLen-1]) ){ return 1; @@ -51235,15 +51235,15 @@ static int winMakeEndInDirSep(int nBuf, char *zBuf){ /* ** Create a temporary file name and store the resulting pointer into pzBuf. -** The pointer returned in pzBuf must be freed via sqlite3_free(). +** The pointer returned in pzBuf must be freed via tdsqlite3_free(). */ -static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){ +static int winGetTempname(tdsqlite3_vfs *pVfs, char **pzBuf){ static char zChars[] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789"; size_t i, j; - int nPre = sqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX); + int nPre = tdsqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX); int nMax, nBuf, nDir, nLen; char *zBuf; @@ -51257,7 +51257,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){ ** name for the temporary file. If this fails, we cannot continue. */ nMax = pVfs->mxPathname; nBuf = nMax + 2; - zBuf = sqlite3MallocZero( nBuf ); + zBuf = tdsqlite3MallocZero( nBuf ); if( !zBuf ){ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); return SQLITE_IOERR_NOMEM_BKPT; @@ -51269,18 +51269,18 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){ */ nDir = nMax - (nPre + 15); assert( nDir>0 ); - if( sqlite3_temp_directory ){ - int nDirLen = sqlite3Strlen30(sqlite3_temp_directory); + if( tdsqlite3_temp_directory ){ + int nDirLen = tdsqlite3Strlen30(tdsqlite3_temp_directory); if( nDirLen>0 ){ - if( !winIsDirSep(sqlite3_temp_directory[nDirLen-1]) ){ + if( !winIsDirSep(tdsqlite3_temp_directory[nDirLen-1]) ){ nDirLen++; } if( nDirLen>nDir ){ - sqlite3_free(zBuf); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n")); return winLogError(SQLITE_ERROR, 0, "winGetTempname1", 0); } - sqlite3_snprintf(nMax, zBuf, "%s", sqlite3_temp_directory); + tdsqlite3_snprintf(nMax, zBuf, "%s", tdsqlite3_temp_directory); } } #if defined(__CYGWIN__) @@ -51316,28 +51316,28 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){ if( winIsDriveLetterAndColon(zDir) ){ zConverted = winConvertFromUtf8Filename(zDir); if( !zConverted ){ - sqlite3_free(zBuf); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); return SQLITE_IOERR_NOMEM_BKPT; } if( winIsDir(zConverted) ){ - sqlite3_snprintf(nMax, zBuf, "%s", zDir); - sqlite3_free(zConverted); + tdsqlite3_snprintf(nMax, zBuf, "%s", zDir); + tdsqlite3_free(zConverted); break; } - sqlite3_free(zConverted); + tdsqlite3_free(zConverted); }else{ - zConverted = sqlite3MallocZero( nMax+1 ); + zConverted = tdsqlite3MallocZero( nMax+1 ); if( !zConverted ){ - sqlite3_free(zBuf); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); return SQLITE_IOERR_NOMEM_BKPT; } if( cygwin_conv_path( osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A, zDir, zConverted, nMax+1)<0 ){ - sqlite3_free(zConverted); - sqlite3_free(zBuf); + tdsqlite3_free(zConverted); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_CONVPATH\n")); return winLogError(SQLITE_IOERR_CONVPATH, (DWORD)errno, "winGetTempname2", zDir); @@ -51349,44 +51349,44 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){ */ char *zUtf8 = winConvertToUtf8Filename(zConverted); if( !zUtf8 ){ - sqlite3_free(zConverted); - sqlite3_free(zBuf); + tdsqlite3_free(zConverted); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); return SQLITE_IOERR_NOMEM_BKPT; } - sqlite3_snprintf(nMax, zBuf, "%s", zUtf8); - sqlite3_free(zUtf8); - sqlite3_free(zConverted); + tdsqlite3_snprintf(nMax, zBuf, "%s", zUtf8); + tdsqlite3_free(zUtf8); + tdsqlite3_free(zConverted); break; } - sqlite3_free(zConverted); + tdsqlite3_free(zConverted); } } } #elif !SQLITE_OS_WINRT && !defined(__CYGWIN__) else if( osIsNT() ){ char *zMulti; - LPWSTR zWidePath = sqlite3MallocZero( nMax*sizeof(WCHAR) ); + LPWSTR zWidePath = tdsqlite3MallocZero( nMax*sizeof(WCHAR) ); if( !zWidePath ){ - sqlite3_free(zBuf); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); return SQLITE_IOERR_NOMEM_BKPT; } if( osGetTempPathW(nMax, zWidePath)==0 ){ - sqlite3_free(zWidePath); - sqlite3_free(zBuf); + tdsqlite3_free(zWidePath); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); return winLogError(SQLITE_IOERR_GETTEMPPATH, osGetLastError(), "winGetTempname2", 0); } zMulti = winUnicodeToUtf8(zWidePath); if( zMulti ){ - sqlite3_snprintf(nMax, zBuf, "%s", zMulti); - sqlite3_free(zMulti); - sqlite3_free(zWidePath); + tdsqlite3_snprintf(nMax, zBuf, "%s", zMulti); + tdsqlite3_free(zMulti); + tdsqlite3_free(zWidePath); }else{ - sqlite3_free(zWidePath); - sqlite3_free(zBuf); + tdsqlite3_free(zWidePath); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); return SQLITE_IOERR_NOMEM_BKPT; } @@ -51394,24 +51394,24 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){ #ifdef SQLITE_WIN32_HAS_ANSI else{ char *zUtf8; - char *zMbcsPath = sqlite3MallocZero( nMax ); + char *zMbcsPath = tdsqlite3MallocZero( nMax ); if( !zMbcsPath ){ - sqlite3_free(zBuf); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); return SQLITE_IOERR_NOMEM_BKPT; } if( osGetTempPathA(nMax, zMbcsPath)==0 ){ - sqlite3_free(zBuf); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); return winLogError(SQLITE_IOERR_GETTEMPPATH, osGetLastError(), "winGetTempname3", 0); } zUtf8 = winMbcsToUtf8(zMbcsPath, osAreFileApisANSI()); if( zUtf8 ){ - sqlite3_snprintf(nMax, zBuf, "%s", zUtf8); - sqlite3_free(zUtf8); + tdsqlite3_snprintf(nMax, zBuf, "%s", zUtf8); + tdsqlite3_free(zUtf8); }else{ - sqlite3_free(zBuf); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); return SQLITE_IOERR_NOMEM_BKPT; } @@ -51425,7 +51425,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){ ** one, fail. */ if( !winMakeEndInDirSep(nDir+1, zBuf) ){ - sqlite3_free(zBuf); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n")); return winLogError(SQLITE_ERROR, 0, "winGetTempname4", 0); } @@ -51441,17 +51441,17 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){ ** two trailing NUL characters. The final directory separator character ** has already added if it was not already present. */ - nLen = sqlite3Strlen30(zBuf); + nLen = tdsqlite3Strlen30(zBuf); if( (nLen + nPre + 17) > nBuf ){ - sqlite3_free(zBuf); + tdsqlite3_free(zBuf); OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n")); return winLogError(SQLITE_ERROR, 0, "winGetTempname5", 0); } - sqlite3_snprintf(nBuf-16-nLen, zBuf+nLen, SQLITE_TEMP_FILE_PREFIX); + tdsqlite3_snprintf(nBuf-16-nLen, zBuf+nLen, SQLITE_TEMP_FILE_PREFIX); - j = sqlite3Strlen30(zBuf); - sqlite3_randomness(15, &zBuf[j]); + j = tdsqlite3Strlen30(zBuf); + tdsqlite3_randomness(15, &zBuf[j]); for(i=0; i<15; i++, j++){ zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; } @@ -51494,7 +51494,7 @@ static int winIsDir(const void *zConverted){ /* forward reference */ static int winAccess( - sqlite3_vfs *pVfs, /* Not used on win32 */ + tdsqlite3_vfs *pVfs, /* Not used on win32 */ const char *zFilename, /* Name of file to check */ int flags, /* Type of test to make on this file */ int *pResOut /* OUT: Result */ @@ -51504,9 +51504,9 @@ static int winAccess( ** Open a file. */ static int winOpen( - sqlite3_vfs *pVfs, /* Used to get maximum path length and AppData */ + tdsqlite3_vfs *pVfs, /* Used to get maximum path length and AppData */ const char *zName, /* Name of the file (UTF-8) */ - sqlite3_file *id, /* Write the SQLite file handle here */ + tdsqlite3_file *id, /* Write the SQLite file handle here */ int flags, /* Open mode flags */ int *pOutFlags /* Status return flags */ ){ @@ -51583,9 +51583,9 @@ static int winOpen( pFile->h = INVALID_HANDLE_VALUE; #if SQLITE_OS_WINRT - if( !zUtf8Name && !sqlite3_temp_directory ){ - sqlite3_log(SQLITE_ERROR, - "sqlite3_temp_directory variable should be set for WinRT"); + if( !zUtf8Name && !tdsqlite3_temp_directory ){ + tdsqlite3_log(SQLITE_ERROR, + "tdsqlite3_temp_directory variable should be set for WinRT"); } #endif @@ -51596,7 +51596,7 @@ static int winOpen( assert( isDelete && !isOpenJournal ); rc = winGetTempname(pVfs, &zTmpname); if( rc!=SQLITE_OK ){ - OSTRACE(("OPEN name=%s, rc=%s", zUtf8Name, sqlite3ErrName(rc))); + OSTRACE(("OPEN name=%s, rc=%s", zUtf8Name, tdsqlite3ErrName(rc))); return rc; } zUtf8Name = zTmpname; @@ -51604,22 +51604,22 @@ static int winOpen( /* Database filenames are double-zero terminated if they are not ** URIs with parameters. Hence, they can always be passed into - ** sqlite3_uri_parameter(). + ** tdsqlite3_uri_parameter(). */ assert( (eType!=SQLITE_OPEN_MAIN_DB) || (flags & SQLITE_OPEN_URI) || - zUtf8Name[sqlite3Strlen30(zUtf8Name)+1]==0 ); + zUtf8Name[tdsqlite3Strlen30(zUtf8Name)+1]==0 ); /* Convert the filename to the system encoding. */ zConverted = winConvertFromUtf8Filename(zUtf8Name); if( zConverted==0 ){ - sqlite3_free(zTmpname); + tdsqlite3_free(zTmpname); OSTRACE(("OPEN name=%s, rc=SQLITE_IOERR_NOMEM", zUtf8Name)); return SQLITE_IOERR_NOMEM_BKPT; } if( winIsDir(zConverted) ){ - sqlite3_free(zConverted); - sqlite3_free(zTmpname); + tdsqlite3_free(zConverted); + tdsqlite3_free(zTmpname); OSTRACE(("OPEN name=%s, rc=SQLITE_CANTOPEN_ISDIR", zUtf8Name)); return SQLITE_CANTOPEN_ISDIR; } @@ -51688,9 +51688,9 @@ static int winOpen( if( h!=INVALID_HANDLE_VALUE ) break; if( isReadWrite ){ int rc2, isRO = 0; - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); rc2 = winAccess(pVfs, zName, SQLITE_ACCESS_READ, &isRO); - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); if( rc2==SQLITE_OK && isRO ) break; } }while( winRetryIoerr(&cnt, &lastErrno) ); @@ -51705,9 +51705,9 @@ static int winOpen( if( h!=INVALID_HANDLE_VALUE ) break; if( isReadWrite ){ int rc2, isRO = 0; - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); rc2 = winAccess(pVfs, zName, SQLITE_ACCESS_READ, &isRO); - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); if( rc2==SQLITE_OK && isRO ) break; } }while( winRetryIoerr(&cnt, &lastErrno) ); @@ -51725,9 +51725,9 @@ static int winOpen( if( h!=INVALID_HANDLE_VALUE ) break; if( isReadWrite ){ int rc2, isRO = 0; - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); rc2 = winAccess(pVfs, zName, SQLITE_ACCESS_READ, &isRO); - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); if( rc2==SQLITE_OK && isRO ) break; } }while( winRetryIoerr(&cnt, &lastErrno) ); @@ -51739,8 +51739,8 @@ static int winOpen( dwDesiredAccess, (h==INVALID_HANDLE_VALUE) ? "failed" : "ok")); if( h==INVALID_HANDLE_VALUE ){ - sqlite3_free(zConverted); - sqlite3_free(zTmpname); + tdsqlite3_free(zConverted); + tdsqlite3_free(zTmpname); if( isReadWrite && !isExclusive ){ return winOpen(pVfs, zName, id, ((flags|SQLITE_OPEN_READONLY) & @@ -51774,9 +51774,9 @@ static int winOpen( && (rc = winceCreateLock(zName, pFile))!=SQLITE_OK ){ osCloseHandle(h); - sqlite3_free(zConverted); - sqlite3_free(zTmpname); - OSTRACE(("OPEN-CE-LOCK name=%s, rc=%s\n", zName, sqlite3ErrName(rc))); + tdsqlite3_free(zConverted); + tdsqlite3_free(zTmpname); + OSTRACE(("OPEN-CE-LOCK name=%s, rc=%s\n", zName, tdsqlite3ErrName(rc))); return rc; } } @@ -51785,17 +51785,17 @@ static int winOpen( }else #endif { - sqlite3_free(zConverted); + tdsqlite3_free(zConverted); } - sqlite3_free(zTmpname); + tdsqlite3_free(zTmpname); pFile->pMethod = pAppData ? pAppData->pMethod : &winIoMethod; pFile->pVfs = pVfs; pFile->h = h; if( isReadonly ){ pFile->ctrlFlags |= WINFILE_RDONLY; } - if( sqlite3_uri_boolean(zName, "psow", SQLITE_POWERSAFE_OVERWRITE) ){ + if( tdsqlite3_uri_boolean(zName, "psow", SQLITE_POWERSAFE_OVERWRITE) ){ pFile->ctrlFlags |= WINFILE_PSOW; } pFile->lastErrno = NO_ERROR; @@ -51804,7 +51804,7 @@ static int winOpen( pFile->hMap = NULL; pFile->pMapRegion = 0; pFile->mmapSize = 0; - pFile->mmapSizeMax = sqlite3GlobalConfig.szMmap; + pFile->mmapSizeMax = tdsqlite3GlobalConfig.szMmap; #endif OpenCounter(+1); @@ -51824,7 +51824,7 @@ static int winOpen( ** up and returning an error. */ static int winDelete( - sqlite3_vfs *pVfs, /* Not used on win32 */ + tdsqlite3_vfs *pVfs, /* Not used on win32 */ const char *zFilename, /* Name of file to delete */ int syncDir /* Not used on win32 */ ){ @@ -51923,8 +51923,8 @@ static int winDelete( }else{ winLogIoerr(cnt, __LINE__); } - sqlite3_free(zConverted); - OSTRACE(("DELETE name=%s, rc=%s\n", zFilename, sqlite3ErrName(rc))); + tdsqlite3_free(zConverted); + OSTRACE(("DELETE name=%s, rc=%s\n", zFilename, tdsqlite3ErrName(rc))); return rc; } @@ -51932,7 +51932,7 @@ static int winDelete( ** Check the existence and status of a file. */ static int winAccess( - sqlite3_vfs *pVfs, /* Not used on win32 */ + tdsqlite3_vfs *pVfs, /* Not used on win32 */ const char *zFilename, /* Name of file to check */ int flags, /* Type of test to make on this file */ int *pResOut /* OUT: Result */ @@ -51973,7 +51973,7 @@ static int winAccess( }else{ winLogIoerr(cnt, __LINE__); if( lastErrno!=ERROR_FILE_NOT_FOUND && lastErrno!=ERROR_PATH_NOT_FOUND ){ - sqlite3_free(zConverted); + tdsqlite3_free(zConverted); return winLogError(SQLITE_IOERR_ACCESS, lastErrno, "winAccess", zFilename); }else{ @@ -51986,7 +51986,7 @@ static int winAccess( attr = osGetFileAttributesA((char*)zConverted); } #endif - sqlite3_free(zConverted); + tdsqlite3_free(zConverted); switch( flags ){ case SQLITE_ACCESS_READ: case SQLITE_ACCESS_EXISTS: @@ -52012,7 +52012,7 @@ static int winAccess( static BOOL winIsDriveLetterAndColon( const char *zPathname ){ - return ( sqlite3Isalpha(zPathname[0]) && zPathname[1]==':' ); + return ( tdsqlite3Isalpha(zPathname[0]) && zPathname[1]==':' ); } /* @@ -52058,7 +52058,7 @@ static BOOL winIsVerbatimPathname( ** bytes in size. */ static int winFullPathname( - sqlite3_vfs *pVfs, /* Pointer to vfs object */ + tdsqlite3_vfs *pVfs, /* Pointer to vfs object */ const char *zRelative, /* Possibly relative input path */ int nFull, /* Size of output buffer in bytes */ char *zFull /* Output buffer */ @@ -52080,54 +52080,54 @@ static int winFullPathname( SimulateIOError( return SQLITE_ERROR ); UNUSED_PARAMETER(nFull); assert( nFull>=pVfs->mxPathname ); - if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ + if ( tdsqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ /* ** NOTE: We are dealing with a relative path name and the data ** directory has been set. Therefore, use it as the basis ** for converting the relative path name to an absolute ** one by prepending the data directory and a slash. */ - char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 ); + char *zOut = tdsqlite3MallocZero( pVfs->mxPathname+1 ); if( !zOut ){ return SQLITE_IOERR_NOMEM_BKPT; } if( cygwin_conv_path( (osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A) | CCP_RELATIVE, zRelative, zOut, pVfs->mxPathname+1)<0 ){ - sqlite3_free(zOut); + tdsqlite3_free(zOut); return winLogError(SQLITE_CANTOPEN_CONVPATH, (DWORD)errno, "winFullPathname1", zRelative); }else{ char *zUtf8 = winConvertToUtf8Filename(zOut); if( !zUtf8 ){ - sqlite3_free(zOut); + tdsqlite3_free(zOut); return SQLITE_IOERR_NOMEM_BKPT; } - sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s", - sqlite3_data_directory, winGetDirSep(), zUtf8); - sqlite3_free(zUtf8); - sqlite3_free(zOut); + tdsqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s", + tdsqlite3_data_directory, winGetDirSep(), zUtf8); + tdsqlite3_free(zUtf8); + tdsqlite3_free(zOut); } }else{ - char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 ); + char *zOut = tdsqlite3MallocZero( pVfs->mxPathname+1 ); if( !zOut ){ return SQLITE_IOERR_NOMEM_BKPT; } if( cygwin_conv_path( (osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A), zRelative, zOut, pVfs->mxPathname+1)<0 ){ - sqlite3_free(zOut); + tdsqlite3_free(zOut); return winLogError(SQLITE_CANTOPEN_CONVPATH, (DWORD)errno, "winFullPathname2", zRelative); }else{ char *zUtf8 = winConvertToUtf8Filename(zOut); if( !zUtf8 ){ - sqlite3_free(zOut); + tdsqlite3_free(zOut); return SQLITE_IOERR_NOMEM_BKPT; } - sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zUtf8); - sqlite3_free(zUtf8); - sqlite3_free(zOut); + tdsqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zUtf8); + tdsqlite3_free(zUtf8); + tdsqlite3_free(zOut); } } return SQLITE_OK; @@ -52137,17 +52137,17 @@ static int winFullPathname( SimulateIOError( return SQLITE_ERROR ); /* WinCE has no concept of a relative pathname, or so I am told. */ /* WinRT has no way to convert a relative path to an absolute one. */ - if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ + if ( tdsqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ /* ** NOTE: We are dealing with a relative path name and the data ** directory has been set. Therefore, use it as the basis ** for converting the relative path name to an absolute ** one by prepending the data directory and a backslash. */ - sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s", - sqlite3_data_directory, winGetDirSep(), zRelative); + tdsqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s", + tdsqlite3_data_directory, winGetDirSep(), zRelative); }else{ - sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zRelative); + tdsqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zRelative); } return SQLITE_OK; #endif @@ -52159,15 +52159,15 @@ static int winFullPathname( ** current working directory has been unlinked. */ SimulateIOError( return SQLITE_ERROR ); - if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ + if ( tdsqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ /* ** NOTE: We are dealing with a relative path name and the data ** directory has been set. Therefore, use it as the basis ** for converting the relative path name to an absolute ** one by prepending the data directory and a backslash. */ - sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s", - sqlite3_data_directory, winGetDirSep(), zRelative); + tdsqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s", + tdsqlite3_data_directory, winGetDirSep(), zRelative); return SQLITE_OK; } zConverted = winConvertFromUtf8Filename(zRelative); @@ -52178,57 +52178,57 @@ static int winFullPathname( LPWSTR zTemp; nByte = osGetFullPathNameW((LPCWSTR)zConverted, 0, 0, 0); if( nByte==0 ){ - sqlite3_free(zConverted); + tdsqlite3_free(zConverted); return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), "winFullPathname1", zRelative); } nByte += 3; - zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); + zTemp = tdsqlite3MallocZero( nByte*sizeof(zTemp[0]) ); if( zTemp==0 ){ - sqlite3_free(zConverted); + tdsqlite3_free(zConverted); return SQLITE_IOERR_NOMEM_BKPT; } nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0); if( nByte==0 ){ - sqlite3_free(zConverted); - sqlite3_free(zTemp); + tdsqlite3_free(zConverted); + tdsqlite3_free(zTemp); return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), "winFullPathname2", zRelative); } - sqlite3_free(zConverted); + tdsqlite3_free(zConverted); zOut = winUnicodeToUtf8(zTemp); - sqlite3_free(zTemp); + tdsqlite3_free(zTemp); } #ifdef SQLITE_WIN32_HAS_ANSI else{ char *zTemp; nByte = osGetFullPathNameA((char*)zConverted, 0, 0, 0); if( nByte==0 ){ - sqlite3_free(zConverted); + tdsqlite3_free(zConverted); return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), "winFullPathname3", zRelative); } nByte += 3; - zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); + zTemp = tdsqlite3MallocZero( nByte*sizeof(zTemp[0]) ); if( zTemp==0 ){ - sqlite3_free(zConverted); + tdsqlite3_free(zConverted); return SQLITE_IOERR_NOMEM_BKPT; } nByte = osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0); if( nByte==0 ){ - sqlite3_free(zConverted); - sqlite3_free(zTemp); + tdsqlite3_free(zConverted); + tdsqlite3_free(zTemp); return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), "winFullPathname4", zRelative); } - sqlite3_free(zConverted); + tdsqlite3_free(zConverted); zOut = winMbcsToUtf8(zTemp, osAreFileApisANSI()); - sqlite3_free(zTemp); + tdsqlite3_free(zTemp); } #endif if( zOut ){ - sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zOut); - sqlite3_free(zOut); + tdsqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zOut); + tdsqlite3_free(zOut); return SQLITE_OK; }else{ return SQLITE_IOERR_NOMEM_BKPT; @@ -52241,23 +52241,23 @@ static int winFullPathname( ** Interfaces for opening a shared library, finding entry points ** within the shared library, and closing the shared library. */ -static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){ +static void *winDlOpen(tdsqlite3_vfs *pVfs, const char *zFilename){ HANDLE h; #if defined(__CYGWIN__) int nFull = pVfs->mxPathname+1; - char *zFull = sqlite3MallocZero( nFull ); + char *zFull = tdsqlite3MallocZero( nFull ); void *zConverted = 0; if( zFull==0 ){ OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)0)); return 0; } if( winFullPathname(pVfs, zFilename, nFull, zFull)!=SQLITE_OK ){ - sqlite3_free(zFull); + tdsqlite3_free(zFull); OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)0)); return 0; } zConverted = winConvertFromUtf8Filename(zFull); - sqlite3_free(zFull); + tdsqlite3_free(zFull); #else void *zConverted = winConvertFromUtf8Filename(zFilename); UNUSED_PARAMETER(pVfs); @@ -52279,14 +52279,14 @@ static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){ } #endif OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)h)); - sqlite3_free(zConverted); + tdsqlite3_free(zConverted); return (void*)h; } -static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){ +static void winDlError(tdsqlite3_vfs *pVfs, int nBuf, char *zBufOut){ UNUSED_PARAMETER(pVfs); winGetLastErrorMsg(osGetLastError(), nBuf, zBufOut); } -static void (*winDlSym(sqlite3_vfs *pVfs,void *pH,const char *zSym))(void){ +static void (*winDlSym(tdsqlite3_vfs *pVfs,void *pH,const char *zSym))(void){ FARPROC proc; UNUSED_PARAMETER(pVfs); proc = osGetProcAddressA((HANDLE)pH, zSym); @@ -52294,7 +52294,7 @@ static void (*winDlSym(sqlite3_vfs *pVfs,void *pH,const char *zSym))(void){ (void*)pH, zSym, (void*)proc)); return (void(*)(void))proc; } -static void winDlClose(sqlite3_vfs *pVfs, void *pHandle){ +static void winDlClose(tdsqlite3_vfs *pVfs, void *pHandle){ UNUSED_PARAMETER(pVfs); osFreeLibrary((HANDLE)pHandle); OSTRACE(("DLCLOSE handle=%p\n", (void*)pHandle)); @@ -52331,7 +52331,7 @@ static void xorMemory(EntropyGatherer *p, unsigned char *x, int sz){ /* ** Write up to nBuf bytes of randomness into zBuf. */ -static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ +static int winRandomness(tdsqlite3_vfs *pVfs, int nBuf, char *zBuf){ #if defined(SQLITE_TEST) || defined(SQLITE_OMIT_RANDOMNESS) UNUSED_PARAMETER(pVfs); memset(zBuf, 0, nBuf); @@ -52388,8 +52388,8 @@ static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ /* ** Sleep for a little while. Return the amount of time slept. */ -static int winSleep(sqlite3_vfs *pVfs, int microsec){ - sqlite3_win32_sleep((microsec+999)/1000); +static int winSleep(tdsqlite3_vfs *pVfs, int microsec){ + tdsqlite3_win32_sleep((microsec+999)/1000); UNUSED_PARAMETER(pVfs); return ((microsec+999)/1000)*1000; } @@ -52397,10 +52397,10 @@ static int winSleep(sqlite3_vfs *pVfs, int microsec){ /* ** The following variable, if set to a non-zero value, is interpreted as ** the number of seconds since 1970 and is used to set the result of -** sqlite3OsCurrentTime() during testing. +** tdsqlite3OsCurrentTime() during testing. */ #ifdef SQLITE_TEST -SQLITE_API int sqlite3_current_time = 0; /* Fake system time in seconds since 1970. */ +SQLITE_API int tdsqlite3_current_time = 0; /* Fake system time in seconds since 1970. */ #endif /* @@ -52413,19 +52413,19 @@ SQLITE_API int sqlite3_current_time = 0; /* Fake system time in seconds since 1 ** On success, return SQLITE_OK. Return SQLITE_ERROR if the time and date ** cannot be found. */ -static int winCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *piNow){ +static int winCurrentTimeInt64(tdsqlite3_vfs *pVfs, tdsqlite3_int64 *piNow){ /* FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (= JD 2305813.5). */ FILETIME ft; - static const sqlite3_int64 winFiletimeEpoch = 23058135*(sqlite3_int64)8640000; + static const tdsqlite3_int64 winFiletimeEpoch = 23058135*(tdsqlite3_int64)8640000; #ifdef SQLITE_TEST - static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000; + static const tdsqlite3_int64 unixEpoch = 24405875*(tdsqlite3_int64)8640000; #endif /* 2^32 - to avoid use of LL and warnings in gcc */ - static const sqlite3_int64 max32BitValue = - (sqlite3_int64)2000000000 + (sqlite3_int64)2000000000 + - (sqlite3_int64)294967296; + static const tdsqlite3_int64 max32BitValue = + (tdsqlite3_int64)2000000000 + (tdsqlite3_int64)2000000000 + + (tdsqlite3_int64)294967296; #if SQLITE_OS_WINCE SYSTEMTIME time; @@ -52439,12 +52439,12 @@ static int winCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *piNow){ #endif *piNow = winFiletimeEpoch + - ((((sqlite3_int64)ft.dwHighDateTime)*max32BitValue) + - (sqlite3_int64)ft.dwLowDateTime)/(sqlite3_int64)10000; + ((((tdsqlite3_int64)ft.dwHighDateTime)*max32BitValue) + + (tdsqlite3_int64)ft.dwLowDateTime)/(tdsqlite3_int64)10000; #ifdef SQLITE_TEST - if( sqlite3_current_time ){ - *piNow = 1000*(sqlite3_int64)sqlite3_current_time + unixEpoch; + if( tdsqlite3_current_time ){ + *piNow = 1000*(tdsqlite3_int64)tdsqlite3_current_time + unixEpoch; } #endif UNUSED_PARAMETER(pVfs); @@ -52456,9 +52456,9 @@ static int winCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *piNow){ ** current time and date as a Julian Day number into *prNow and ** return 0. Return 1 if the time and date cannot be found. */ -static int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){ +static int winCurrentTime(tdsqlite3_vfs *pVfs, double *prNow){ int rc; - sqlite3_int64 i; + tdsqlite3_int64 i; rc = winCurrentTimeInt64(pVfs, &i); if( !rc ){ *prNow = i/86400000.0; @@ -52487,16 +52487,16 @@ static int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){ ** on SQLite. It is fine to have an implementation that never ** returns an error message: ** -** int xGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ +** int xGetLastError(tdsqlite3_vfs *pVfs, int nBuf, char *zBuf){ ** assert(zBuf[0]=='\0'); ** return 0; ** } ** ** However if an error message is supplied, it will be incorporated ** by sqlite into the error message available to the user using -** sqlite3_errmsg(), possibly making IO errors easier to debug. +** tdsqlite3_errmsg(), possibly making IO errors easier to debug. */ -static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ +static int winGetLastError(tdsqlite3_vfs *pVfs, int nBuf, char *zBuf){ DWORD e = osGetLastError(); UNUSED_PARAMETER(pVfs); if( nBuf>0 ) winGetLastErrorMsg(e, nBuf, zBuf); @@ -52506,8 +52506,8 @@ static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ /* ** Initialize and deinitialize the operating system interface. */ -SQLITE_API int sqlite3_os_init(void){ - static sqlite3_vfs winVfs = { +SQLITE_API int tdsqlite3_os_init(void){ + static tdsqlite3_vfs winVfs = { 3, /* iVersion */ sizeof(winFile), /* szOsFile */ SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */ @@ -52532,7 +52532,7 @@ SQLITE_API int sqlite3_os_init(void){ winNextSystemCall, /* xNextSystemCall */ }; #if defined(SQLITE_WIN32_HAS_WIDE) - static sqlite3_vfs winLongPathVfs = { + static tdsqlite3_vfs winLongPathVfs = { 3, /* iVersion */ sizeof(winFile), /* szOsFile */ SQLITE_WINNT_MAX_PATH_BYTES, /* mxPathname */ @@ -52557,7 +52557,7 @@ SQLITE_API int sqlite3_os_init(void){ winNextSystemCall, /* xNextSystemCall */ }; #endif - static sqlite3_vfs winNolockVfs = { + static tdsqlite3_vfs winNolockVfs = { 3, /* iVersion */ sizeof(winFile), /* szOsFile */ SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */ @@ -52582,7 +52582,7 @@ SQLITE_API int sqlite3_os_init(void){ winNextSystemCall, /* xNextSystemCall */ }; #if defined(SQLITE_WIN32_HAS_WIDE) - static sqlite3_vfs winLongPathNolockVfs = { + static tdsqlite3_vfs winLongPathNolockVfs = { 3, /* iVersion */ sizeof(winFile), /* szOsFile */ SQLITE_WINNT_MAX_PATH_BYTES, /* mxPathname */ @@ -52622,26 +52622,26 @@ SQLITE_API int sqlite3_os_init(void){ assert( winSysInfo.dwAllocationGranularity>0 ); assert( winSysInfo.dwPageSize>0 ); - sqlite3_vfs_register(&winVfs, 1); + tdsqlite3_vfs_register(&winVfs, 1); #if defined(SQLITE_WIN32_HAS_WIDE) - sqlite3_vfs_register(&winLongPathVfs, 0); + tdsqlite3_vfs_register(&winLongPathVfs, 0); #endif - sqlite3_vfs_register(&winNolockVfs, 0); + tdsqlite3_vfs_register(&winNolockVfs, 0); #if defined(SQLITE_WIN32_HAS_WIDE) - sqlite3_vfs_register(&winLongPathNolockVfs, 0); + tdsqlite3_vfs_register(&winLongPathNolockVfs, 0); #endif #ifndef SQLITE_OMIT_WAL - winBigLock = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1); + winBigLock = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1); #endif return SQLITE_OK; } -SQLITE_API int sqlite3_os_end(void){ +SQLITE_API int tdsqlite3_os_end(void){ #if SQLITE_OS_WINRT if( sleepObj!=NULL ){ osCloseHandle(sleepObj); @@ -52675,8 +52675,8 @@ SQLITE_API int sqlite3_os_end(void){ ** This file implements an in-memory VFS. A database is held as a contiguous ** block of memory. ** -** This file also implements interface sqlite3_serialize() and -** sqlite3_deserialize(). +** This file also implements interface tdsqlite3_serialize() and +** tdsqlite3_deserialize(). */ /* #include "sqliteInt.h" */ #ifdef SQLITE_ENABLE_DESERIALIZE @@ -52684,20 +52684,20 @@ SQLITE_API int sqlite3_os_end(void){ /* ** Forward declaration of objects used by this utility */ -typedef struct sqlite3_vfs MemVfs; +typedef struct tdsqlite3_vfs MemVfs; typedef struct MemFile MemFile; /* Access to a lower-level VFS that (might) implement dynamic loading, ** access to randomness, etc. */ -#define ORIGVFS(p) ((sqlite3_vfs*)((p)->pAppData)) +#define ORIGVFS(p) ((tdsqlite3_vfs*)((p)->pAppData)) /* An open file */ struct MemFile { - sqlite3_file base; /* IO methods */ - sqlite3_int64 sz; /* Size of the file */ - sqlite3_int64 szAlloc; /* Space allocated to aData */ - sqlite3_int64 szMax; /* Maximum allowed size of the file */ + tdsqlite3_file base; /* IO methods */ + tdsqlite3_int64 sz; /* Size of the file */ + tdsqlite3_int64 szAlloc; /* Space allocated to aData */ + tdsqlite3_int64 szMax; /* Maximum allowed size of the file */ unsigned char *aData; /* content of the file */ int nMmap; /* Number of memory mapped pages */ unsigned mFlags; /* Flags */ @@ -52707,38 +52707,38 @@ struct MemFile { /* ** Methods for MemFile */ -static int memdbClose(sqlite3_file*); -static int memdbRead(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst); -static int memdbWrite(sqlite3_file*,const void*,int iAmt, sqlite3_int64 iOfst); -static int memdbTruncate(sqlite3_file*, sqlite3_int64 size); -static int memdbSync(sqlite3_file*, int flags); -static int memdbFileSize(sqlite3_file*, sqlite3_int64 *pSize); -static int memdbLock(sqlite3_file*, int); -/* static int memdbCheckReservedLock(sqlite3_file*, int *pResOut);// not used */ -static int memdbFileControl(sqlite3_file*, int op, void *pArg); -/* static int memdbSectorSize(sqlite3_file*); // not used */ -static int memdbDeviceCharacteristics(sqlite3_file*); -static int memdbFetch(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp); -static int memdbUnfetch(sqlite3_file*, sqlite3_int64 iOfst, void *p); +static int memdbClose(tdsqlite3_file*); +static int memdbRead(tdsqlite3_file*, void*, int iAmt, tdsqlite3_int64 iOfst); +static int memdbWrite(tdsqlite3_file*,const void*,int iAmt, tdsqlite3_int64 iOfst); +static int memdbTruncate(tdsqlite3_file*, tdsqlite3_int64 size); +static int memdbSync(tdsqlite3_file*, int flags); +static int memdbFileSize(tdsqlite3_file*, tdsqlite3_int64 *pSize); +static int memdbLock(tdsqlite3_file*, int); +/* static int memdbCheckReservedLock(tdsqlite3_file*, int *pResOut);// not used */ +static int memdbFileControl(tdsqlite3_file*, int op, void *pArg); +/* static int memdbSectorSize(tdsqlite3_file*); // not used */ +static int memdbDeviceCharacteristics(tdsqlite3_file*); +static int memdbFetch(tdsqlite3_file*, tdsqlite3_int64 iOfst, int iAmt, void **pp); +static int memdbUnfetch(tdsqlite3_file*, tdsqlite3_int64 iOfst, void *p); /* ** Methods for MemVfs */ -static int memdbOpen(sqlite3_vfs*, const char *, sqlite3_file*, int , int *); -/* static int memdbDelete(sqlite3_vfs*, const char *zName, int syncDir); */ -static int memdbAccess(sqlite3_vfs*, const char *zName, int flags, int *); -static int memdbFullPathname(sqlite3_vfs*, const char *zName, int, char *zOut); -static void *memdbDlOpen(sqlite3_vfs*, const char *zFilename); -static void memdbDlError(sqlite3_vfs*, int nByte, char *zErrMsg); -static void (*memdbDlSym(sqlite3_vfs *pVfs, void *p, const char*zSym))(void); -static void memdbDlClose(sqlite3_vfs*, void*); -static int memdbRandomness(sqlite3_vfs*, int nByte, char *zOut); -static int memdbSleep(sqlite3_vfs*, int microseconds); -/* static int memdbCurrentTime(sqlite3_vfs*, double*); */ -static int memdbGetLastError(sqlite3_vfs*, int, char *); -static int memdbCurrentTimeInt64(sqlite3_vfs*, sqlite3_int64*); +static int memdbOpen(tdsqlite3_vfs*, const char *, tdsqlite3_file*, int , int *); +/* static int memdbDelete(tdsqlite3_vfs*, const char *zName, int syncDir); */ +static int memdbAccess(tdsqlite3_vfs*, const char *zName, int flags, int *); +static int memdbFullPathname(tdsqlite3_vfs*, const char *zName, int, char *zOut); +static void *memdbDlOpen(tdsqlite3_vfs*, const char *zFilename); +static void memdbDlError(tdsqlite3_vfs*, int nByte, char *zErrMsg); +static void (*memdbDlSym(tdsqlite3_vfs *pVfs, void *p, const char*zSym))(void); +static void memdbDlClose(tdsqlite3_vfs*, void*); +static int memdbRandomness(tdsqlite3_vfs*, int nByte, char *zOut); +static int memdbSleep(tdsqlite3_vfs*, int microseconds); +/* static int memdbCurrentTime(tdsqlite3_vfs*, double*); */ +static int memdbGetLastError(tdsqlite3_vfs*, int, char *); +static int memdbCurrentTimeInt64(tdsqlite3_vfs*, tdsqlite3_int64*); -static sqlite3_vfs memdb_vfs = { +static tdsqlite3_vfs memdb_vfs = { 2, /* iVersion */ 0, /* szOsFile (set when registered) */ 1024, /* mxPathname */ @@ -52760,7 +52760,7 @@ static sqlite3_vfs memdb_vfs = { memdbCurrentTimeInt64 /* xCurrentTimeInt64 */ }; -static const sqlite3_io_methods memdb_io_methods = { +static const tdsqlite3_io_methods memdb_io_methods = { 3, /* iVersion */ memdbClose, /* xClose */ memdbRead, /* xRead */ @@ -52790,9 +52790,9 @@ static const sqlite3_io_methods memdb_io_methods = { ** The pData pointer is owned by the application, so there is nothing ** to free. */ -static int memdbClose(sqlite3_file *pFile){ +static int memdbClose(tdsqlite3_file *pFile){ MemFile *p = (MemFile *)pFile; - if( p->mFlags & SQLITE_DESERIALIZE_FREEONCLOSE ) sqlite3_free(p->aData); + if( p->mFlags & SQLITE_DESERIALIZE_FREEONCLOSE ) tdsqlite3_free(p->aData); return SQLITE_OK; } @@ -52800,7 +52800,7 @@ static int memdbClose(sqlite3_file *pFile){ ** Read data from an memdb-file. */ static int memdbRead( - sqlite3_file *pFile, + tdsqlite3_file *pFile, void *zBuf, int iAmt, sqlite_int64 iOfst @@ -52818,7 +52818,7 @@ static int memdbRead( /* ** Try to enlarge the memory allocation to hold at least sz bytes */ -static int memdbEnlarge(MemFile *p, sqlite3_int64 newSz){ +static int memdbEnlarge(MemFile *p, tdsqlite3_int64 newSz){ unsigned char *pNew; if( (p->mFlags & SQLITE_DESERIALIZE_RESIZEABLE)==0 || p->nMmap>0 ){ return SQLITE_FULL; @@ -52828,7 +52828,7 @@ static int memdbEnlarge(MemFile *p, sqlite3_int64 newSz){ } newSz *= 2; if( newSz>p->szMax ) newSz = p->szMax; - pNew = sqlite3_realloc64(p->aData, newSz); + pNew = tdsqlite3_realloc64(p->aData, newSz); if( pNew==0 ) return SQLITE_NOMEM; p->aData = pNew; p->szAlloc = newSz; @@ -52839,7 +52839,7 @@ static int memdbEnlarge(MemFile *p, sqlite3_int64 newSz){ ** Write data to an memdb-file. */ static int memdbWrite( - sqlite3_file *pFile, + tdsqlite3_file *pFile, const void *z, int iAmt, sqlite_int64 iOfst @@ -52867,7 +52867,7 @@ static int memdbWrite( ** support WAL mode) the truncate() method is only used to reduce ** the size of a file, never to increase the size. */ -static int memdbTruncate(sqlite3_file *pFile, sqlite_int64 size){ +static int memdbTruncate(tdsqlite3_file *pFile, sqlite_int64 size){ MemFile *p = (MemFile *)pFile; if( NEVER(size>p->sz) ) return SQLITE_FULL; p->sz = size; @@ -52877,14 +52877,14 @@ static int memdbTruncate(sqlite3_file *pFile, sqlite_int64 size){ /* ** Sync an memdb-file. */ -static int memdbSync(sqlite3_file *pFile, int flags){ +static int memdbSync(tdsqlite3_file *pFile, int flags){ return SQLITE_OK; } /* ** Return the current file-size of an memdb-file. */ -static int memdbFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){ +static int memdbFileSize(tdsqlite3_file *pFile, sqlite_int64 *pSize){ MemFile *p = (MemFile *)pFile; *pSize = p->sz; return SQLITE_OK; @@ -52893,7 +52893,7 @@ static int memdbFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){ /* ** Lock an memdb-file. */ -static int memdbLock(sqlite3_file *pFile, int eLock){ +static int memdbLock(tdsqlite3_file *pFile, int eLock){ MemFile *p = (MemFile *)pFile; if( eLock>SQLITE_LOCK_SHARED && (p->mFlags & SQLITE_DESERIALIZE_READONLY)!=0 @@ -52908,7 +52908,7 @@ static int memdbLock(sqlite3_file *pFile, int eLock){ /* ** Check if another file-handle holds a RESERVED lock on an memdb-file. */ -static int memdbCheckReservedLock(sqlite3_file *pFile, int *pResOut){ +static int memdbCheckReservedLock(tdsqlite3_file *pFile, int *pResOut){ *pResOut = 0; return SQLITE_OK; } @@ -52917,15 +52917,15 @@ static int memdbCheckReservedLock(sqlite3_file *pFile, int *pResOut){ /* ** File control method. For custom operations on an memdb-file. */ -static int memdbFileControl(sqlite3_file *pFile, int op, void *pArg){ +static int memdbFileControl(tdsqlite3_file *pFile, int op, void *pArg){ MemFile *p = (MemFile *)pFile; int rc = SQLITE_NOTFOUND; if( op==SQLITE_FCNTL_VFSNAME ){ - *(char**)pArg = sqlite3_mprintf("memdb(%p,%lld)", p->aData, p->sz); + *(char**)pArg = tdsqlite3_mprintf("memdb(%p,%lld)", p->aData, p->sz); rc = SQLITE_OK; } if( op==SQLITE_FCNTL_SIZE_LIMIT ){ - sqlite3_int64 iLimit = *(sqlite3_int64*)pArg; + tdsqlite3_int64 iLimit = *(tdsqlite3_int64*)pArg; if( iLimitsz ){ if( iLimit<0 ){ iLimit = p->szMax; @@ -52934,7 +52934,7 @@ static int memdbFileControl(sqlite3_file *pFile, int op, void *pArg){ } } p->szMax = iLimit; - *(sqlite3_int64*)pArg = iLimit; + *(tdsqlite3_int64*)pArg = iLimit; rc = SQLITE_OK; } return rc; @@ -52944,7 +52944,7 @@ static int memdbFileControl(sqlite3_file *pFile, int op, void *pArg){ /* ** Return the sector-size in bytes for an memdb-file. */ -static int memdbSectorSize(sqlite3_file *pFile){ +static int memdbSectorSize(tdsqlite3_file *pFile){ return 1024; } #endif @@ -52952,7 +52952,7 @@ static int memdbSectorSize(sqlite3_file *pFile){ /* ** Return the device characteristic flags supported by an memdb-file. */ -static int memdbDeviceCharacteristics(sqlite3_file *pFile){ +static int memdbDeviceCharacteristics(tdsqlite3_file *pFile){ return SQLITE_IOCAP_ATOMIC | SQLITE_IOCAP_POWERSAFE_OVERWRITE | SQLITE_IOCAP_SAFE_APPEND | @@ -52961,8 +52961,8 @@ static int memdbDeviceCharacteristics(sqlite3_file *pFile){ /* Fetch a page of a memory-mapped file */ static int memdbFetch( - sqlite3_file *pFile, - sqlite3_int64 iOfst, + tdsqlite3_file *pFile, + tdsqlite3_int64 iOfst, int iAmt, void **pp ){ @@ -52977,7 +52977,7 @@ static int memdbFetch( } /* Release a memory-mapped page */ -static int memdbUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *pPage){ +static int memdbUnfetch(tdsqlite3_file *pFile, tdsqlite3_int64 iOfst, void *pPage){ MemFile *p = (MemFile *)pFile; p->nMmap--; return SQLITE_OK; @@ -52987,9 +52987,9 @@ static int memdbUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *pPage){ ** Open an mem file handle. */ static int memdbOpen( - sqlite3_vfs *pVfs, + tdsqlite3_vfs *pVfs, const char *zName, - sqlite3_file *pFile, + tdsqlite3_file *pFile, int flags, int *pOutFlags ){ @@ -53002,7 +53002,7 @@ static int memdbOpen( assert( pOutFlags!=0 ); /* True because flags==SQLITE_OPEN_MAIN_DB */ *pOutFlags = flags | SQLITE_OPEN_MEMORY; p->base.pMethods = &memdb_io_methods; - p->szMax = sqlite3GlobalConfig.mxMemdbSize; + p->szMax = tdsqlite3GlobalConfig.mxMemdbSize; return SQLITE_OK; } @@ -53013,7 +53013,7 @@ static int memdbOpen( ** ensure the file-system modifications are synced to disk before ** returning. */ -static int memdbDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ +static int memdbDelete(tdsqlite3_vfs *pVfs, const char *zPath, int dirSync){ return SQLITE_IOERR_DELETE; } #endif @@ -53025,7 +53025,7 @@ static int memdbDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ ** With memdb, no files ever exist on disk. So always return false. */ static int memdbAccess( - sqlite3_vfs *pVfs, + tdsqlite3_vfs *pVfs, const char *zPath, int flags, int *pResOut @@ -53040,19 +53040,19 @@ static int memdbAccess( ** of at least (INST_MAX_PATHNAME+1) bytes. */ static int memdbFullPathname( - sqlite3_vfs *pVfs, + tdsqlite3_vfs *pVfs, const char *zPath, int nOut, char *zOut ){ - sqlite3_snprintf(nOut, zOut, "%s", zPath); + tdsqlite3_snprintf(nOut, zOut, "%s", zPath); return SQLITE_OK; } /* ** Open the dynamic library located at zPath and return a handle. */ -static void *memdbDlOpen(sqlite3_vfs *pVfs, const char *zPath){ +static void *memdbDlOpen(tdsqlite3_vfs *pVfs, const char *zPath){ return ORIGVFS(pVfs)->xDlOpen(ORIGVFS(pVfs), zPath); } @@ -53061,21 +53061,21 @@ static void *memdbDlOpen(sqlite3_vfs *pVfs, const char *zPath){ ** utf-8 string describing the most recent error encountered associated ** with dynamic libraries. */ -static void memdbDlError(sqlite3_vfs *pVfs, int nByte, char *zErrMsg){ +static void memdbDlError(tdsqlite3_vfs *pVfs, int nByte, char *zErrMsg){ ORIGVFS(pVfs)->xDlError(ORIGVFS(pVfs), nByte, zErrMsg); } /* ** Return a pointer to the symbol zSymbol in the dynamic library pHandle. */ -static void (*memdbDlSym(sqlite3_vfs *pVfs, void *p, const char *zSym))(void){ +static void (*memdbDlSym(tdsqlite3_vfs *pVfs, void *p, const char *zSym))(void){ return ORIGVFS(pVfs)->xDlSym(ORIGVFS(pVfs), p, zSym); } /* ** Close the dynamic library handle pHandle. */ -static void memdbDlClose(sqlite3_vfs *pVfs, void *pHandle){ +static void memdbDlClose(tdsqlite3_vfs *pVfs, void *pHandle){ ORIGVFS(pVfs)->xDlClose(ORIGVFS(pVfs), pHandle); } @@ -53083,7 +53083,7 @@ static void memdbDlClose(sqlite3_vfs *pVfs, void *pHandle){ ** Populate the buffer pointed to by zBufOut with nByte bytes of ** random data. */ -static int memdbRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){ +static int memdbRandomness(tdsqlite3_vfs *pVfs, int nByte, char *zBufOut){ return ORIGVFS(pVfs)->xRandomness(ORIGVFS(pVfs), nByte, zBufOut); } @@ -53091,7 +53091,7 @@ static int memdbRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){ ** Sleep for nMicro microseconds. Return the number of microseconds ** actually slept. */ -static int memdbSleep(sqlite3_vfs *pVfs, int nMicro){ +static int memdbSleep(tdsqlite3_vfs *pVfs, int nMicro){ return ORIGVFS(pVfs)->xSleep(ORIGVFS(pVfs), nMicro); } @@ -53099,15 +53099,15 @@ static int memdbSleep(sqlite3_vfs *pVfs, int nMicro){ /* ** Return the current time as a Julian Day number in *pTimeOut. */ -static int memdbCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){ +static int memdbCurrentTime(tdsqlite3_vfs *pVfs, double *pTimeOut){ return ORIGVFS(pVfs)->xCurrentTime(ORIGVFS(pVfs), pTimeOut); } #endif -static int memdbGetLastError(sqlite3_vfs *pVfs, int a, char *b){ +static int memdbGetLastError(tdsqlite3_vfs *pVfs, int a, char *b){ return ORIGVFS(pVfs)->xGetLastError(ORIGVFS(pVfs), a, b); } -static int memdbCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *p){ +static int memdbCurrentTimeInt64(tdsqlite3_vfs *pVfs, tdsqlite3_int64 *p){ return ORIGVFS(pVfs)->xCurrentTimeInt64(ORIGVFS(pVfs), p); } @@ -53115,9 +53115,9 @@ static int memdbCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *p){ ** Translate a database connection pointer and schema name into a ** MemFile pointer. */ -static MemFile *memdbFromDbSchema(sqlite3 *db, const char *zSchema){ +static MemFile *memdbFromDbSchema(tdsqlite3 *db, const char *zSchema){ MemFile *p = 0; - int rc = sqlite3_file_control(db, zSchema, SQLITE_FCNTL_FILE_POINTER, &p); + int rc = tdsqlite3_file_control(db, zSchema, SQLITE_FCNTL_FILE_POINTER, &p); if( rc ) return 0; if( p->base.pMethods!=&memdb_io_methods ) return 0; return p; @@ -53126,24 +53126,24 @@ static MemFile *memdbFromDbSchema(sqlite3 *db, const char *zSchema){ /* ** Return the serialization of a database */ -SQLITE_API unsigned char *sqlite3_serialize( - sqlite3 *db, /* The database connection */ +SQLITE_API unsigned char *tdsqlite3_serialize( + tdsqlite3 *db, /* The database connection */ const char *zSchema, /* Which database within the connection */ - sqlite3_int64 *piSize, /* Write size here, if not NULL */ + tdsqlite3_int64 *piSize, /* Write size here, if not NULL */ unsigned int mFlags /* Maybe SQLITE_SERIALIZE_NOCOPY */ ){ MemFile *p; int iDb; Btree *pBt; - sqlite3_int64 sz; + tdsqlite3_int64 sz; int szPage = 0; - sqlite3_stmt *pStmt = 0; + tdsqlite3_stmt *pStmt = 0; unsigned char *pOut; char *zSql; int rc; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } @@ -53151,7 +53151,7 @@ SQLITE_API unsigned char *sqlite3_serialize( if( zSchema==0 ) zSchema = db->aDb[0].zDbSName; p = memdbFromDbSchema(db, zSchema); - iDb = sqlite3FindDbName(db, zSchema); + iDb = tdsqlite3FindDbName(db, zSchema); if( piSize ) *piSize = -1; if( iDb<0 ) return 0; if( p ){ @@ -53159,88 +53159,88 @@ SQLITE_API unsigned char *sqlite3_serialize( if( mFlags & SQLITE_SERIALIZE_NOCOPY ){ pOut = p->aData; }else{ - pOut = sqlite3_malloc64( p->sz ); + pOut = tdsqlite3_malloc64( p->sz ); if( pOut ) memcpy(pOut, p->aData, p->sz); } return pOut; } pBt = db->aDb[iDb].pBt; if( pBt==0 ) return 0; - szPage = sqlite3BtreeGetPageSize(pBt); - zSql = sqlite3_mprintf("PRAGMA \"%w\".page_count", zSchema); - rc = zSql ? sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0) : SQLITE_NOMEM; - sqlite3_free(zSql); + szPage = tdsqlite3BtreeGetPageSize(pBt); + zSql = tdsqlite3_mprintf("PRAGMA \"%w\".page_count", zSchema); + rc = zSql ? tdsqlite3_prepare_v2(db, zSql, -1, &pStmt, 0) : SQLITE_NOMEM; + tdsqlite3_free(zSql); if( rc ) return 0; - rc = sqlite3_step(pStmt); + rc = tdsqlite3_step(pStmt); if( rc!=SQLITE_ROW ){ pOut = 0; }else{ - sz = sqlite3_column_int64(pStmt, 0)*szPage; + sz = tdsqlite3_column_int64(pStmt, 0)*szPage; if( piSize ) *piSize = sz; if( mFlags & SQLITE_SERIALIZE_NOCOPY ){ pOut = 0; }else{ - pOut = sqlite3_malloc64( sz ); + pOut = tdsqlite3_malloc64( sz ); if( pOut ){ - int nPage = sqlite3_column_int(pStmt, 0); - Pager *pPager = sqlite3BtreePager(pBt); + int nPage = tdsqlite3_column_int(pStmt, 0); + Pager *pPager = tdsqlite3BtreePager(pBt); int pgno; for(pgno=1; pgno<=nPage; pgno++){ DbPage *pPage = 0; - unsigned char *pTo = pOut + szPage*(sqlite3_int64)(pgno-1); - rc = sqlite3PagerGet(pPager, pgno, (DbPage**)&pPage, 0); + unsigned char *pTo = pOut + szPage*(tdsqlite3_int64)(pgno-1); + rc = tdsqlite3PagerGet(pPager, pgno, (DbPage**)&pPage, 0); if( rc==SQLITE_OK ){ - memcpy(pTo, sqlite3PagerGetData(pPage), szPage); + memcpy(pTo, tdsqlite3PagerGetData(pPage), szPage); }else{ memset(pTo, 0, szPage); } - sqlite3PagerUnref(pPage); + tdsqlite3PagerUnref(pPage); } } } } - sqlite3_finalize(pStmt); + tdsqlite3_finalize(pStmt); return pOut; } /* Convert zSchema to a MemDB and initialize its content. */ -SQLITE_API int sqlite3_deserialize( - sqlite3 *db, /* The database connection */ +SQLITE_API int tdsqlite3_deserialize( + tdsqlite3 *db, /* The database connection */ const char *zSchema, /* Which DB to reopen with the deserialization */ unsigned char *pData, /* The serialized database content */ - sqlite3_int64 szDb, /* Number bytes in the deserialization */ - sqlite3_int64 szBuf, /* Total size of buffer pData[] */ + tdsqlite3_int64 szDb, /* Number bytes in the deserialization */ + tdsqlite3_int64 szBuf, /* Total size of buffer pData[] */ unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */ ){ MemFile *p; char *zSql; - sqlite3_stmt *pStmt = 0; + tdsqlite3_stmt *pStmt = 0; int rc; int iDb; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ return SQLITE_MISUSE_BKPT; } if( szDb<0 ) return SQLITE_MISUSE_BKPT; if( szBuf<0 ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); if( zSchema==0 ) zSchema = db->aDb[0].zDbSName; - iDb = sqlite3FindDbName(db, zSchema); + iDb = tdsqlite3FindDbName(db, zSchema); if( iDb<0 ){ rc = SQLITE_ERROR; goto end_deserialize; } - zSql = sqlite3_mprintf("ATTACH x AS %Q", zSchema); - rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); - sqlite3_free(zSql); + zSql = tdsqlite3_mprintf("ATTACH x AS %Q", zSchema); + rc = tdsqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); + tdsqlite3_free(zSql); if( rc ) goto end_deserialize; db->init.iDb = (u8)iDb; db->init.reopenMemdb = 1; - rc = sqlite3_step(pStmt); + rc = tdsqlite3_step(pStmt); db->init.reopenMemdb = 0; if( rc!=SQLITE_DONE ){ rc = SQLITE_ERROR; @@ -53254,16 +53254,16 @@ SQLITE_API int sqlite3_deserialize( p->sz = szDb; p->szAlloc = szBuf; p->szMax = szBuf; - if( p->szMaxszMax = sqlite3GlobalConfig.mxMemdbSize; + if( p->szMaxszMax = tdsqlite3GlobalConfig.mxMemdbSize; } p->mFlags = mFlags; rc = SQLITE_OK; } end_deserialize: - sqlite3_finalize(pStmt); - sqlite3_mutex_leave(db->mutex); + tdsqlite3_finalize(pStmt); + tdsqlite3_mutex_leave(db->mutex); return rc; } @@ -53271,16 +53271,16 @@ end_deserialize: ** This routine is called when the extension is loaded. ** Register the new VFS. */ -SQLITE_PRIVATE int sqlite3MemdbInit(void){ - sqlite3_vfs *pLower = sqlite3_vfs_find(0); +SQLITE_PRIVATE int tdsqlite3MemdbInit(void){ + tdsqlite3_vfs *pLower = tdsqlite3_vfs_find(0); int sz = pLower->szOsFile; memdb_vfs.pAppData = pLower; /* In all known configurations of SQLite, the size of a default - ** sqlite3_file is greater than the size of a memdb sqlite3_file. + ** tdsqlite3_file is greater than the size of a memdb tdsqlite3_file. ** Should that ever change, remove the following NEVER() */ if( NEVER(sziSize = iSize; } @@ -53415,7 +53415,7 @@ SQLITE_PRIVATE Bitvec *sqlite3BitvecCreate(u32 iSize){ ** If p is NULL (if the bitmap has not been created) or if ** i is out of range, then return false. */ -SQLITE_PRIVATE int sqlite3BitvecTestNotNull(Bitvec *p, u32 i){ +SQLITE_PRIVATE int tdsqlite3BitvecTestNotNull(Bitvec *p, u32 i){ assert( p!=0 ); i--; if( i>=p->iSize ) return 0; @@ -53438,8 +53438,8 @@ SQLITE_PRIVATE int sqlite3BitvecTestNotNull(Bitvec *p, u32 i){ return 0; } } -SQLITE_PRIVATE int sqlite3BitvecTest(Bitvec *p, u32 i){ - return p!=0 && sqlite3BitvecTestNotNull(p,i); +SQLITE_PRIVATE int tdsqlite3BitvecTest(Bitvec *p, u32 i){ + return p!=0 && tdsqlite3BitvecTestNotNull(p,i); } /* @@ -53454,7 +53454,7 @@ SQLITE_PRIVATE int sqlite3BitvecTest(Bitvec *p, u32 i){ ** and that the value for "i" is within range of the Bitvec object. ** Otherwise the behavior is undefined. */ -SQLITE_PRIVATE int sqlite3BitvecSet(Bitvec *p, u32 i){ +SQLITE_PRIVATE int tdsqlite3BitvecSet(Bitvec *p, u32 i){ u32 h; if( p==0 ) return SQLITE_OK; assert( i>0 ); @@ -53464,7 +53464,7 @@ SQLITE_PRIVATE int sqlite3BitvecSet(Bitvec *p, u32 i){ u32 bin = i/p->iDivisor; i = i%p->iDivisor; if( p->u.apSub[bin]==0 ){ - p->u.apSub[bin] = sqlite3BitvecCreate( p->iDivisor ); + p->u.apSub[bin] = tdsqlite3BitvecCreate( p->iDivisor ); if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM_BKPT; } p = p->u.apSub[bin]; @@ -53498,18 +53498,18 @@ bitvec_set_rehash: if( p->nSet>=BITVEC_MXHASH ){ unsigned int j; int rc; - u32 *aiValues = sqlite3StackAllocRaw(0, sizeof(p->u.aHash)); + u32 *aiValues = tdsqlite3StackAllocRaw(0, sizeof(p->u.aHash)); if( aiValues==0 ){ return SQLITE_NOMEM_BKPT; }else{ memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash)); memset(p->u.apSub, 0, sizeof(p->u.apSub)); p->iDivisor = (p->iSize + BITVEC_NPTR - 1)/BITVEC_NPTR; - rc = sqlite3BitvecSet(p, i); + rc = tdsqlite3BitvecSet(p, i); for(j=0; j0 ); i--; @@ -53562,22 +53562,22 @@ SQLITE_PRIVATE void sqlite3BitvecClear(Bitvec *p, u32 i, void *pBuf){ /* ** Destroy a bitmap object. Reclaim all memory used. */ -SQLITE_PRIVATE void sqlite3BitvecDestroy(Bitvec *p){ +SQLITE_PRIVATE void tdsqlite3BitvecDestroy(Bitvec *p){ if( p==0 ) return; if( p->iDivisor ){ unsigned int i; for(i=0; iu.apSub[i]); + tdsqlite3BitvecDestroy(p->u.apSub[i]); } } - sqlite3_free(p); + tdsqlite3_free(p); } /* ** Return the value of the iSize parameter specified when Bitvec *p ** was created. */ -SQLITE_PRIVATE u32 sqlite3BitvecSize(Bitvec *p){ +SQLITE_PRIVATE u32 tdsqlite3BitvecSize(Bitvec *p){ return p->iSize; } @@ -53622,7 +53622,7 @@ SQLITE_PRIVATE u32 sqlite3BitvecSize(Bitvec *p){ ** ** If a memory allocation error occurs, return -1. */ -SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int sz, int *aOp){ +SQLITE_PRIVATE int tdsqlite3BitvecBuiltinTest(int sz, int *aOp){ Bitvec *pBitvec = 0; unsigned char *pV = 0; int rc = -1; @@ -53631,14 +53631,14 @@ SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int sz, int *aOp){ /* Allocate the Bitvec to be tested and a linear array of ** bits to act as the reference */ - pBitvec = sqlite3BitvecCreate( sz ); - pV = sqlite3MallocZero( (sz+7)/8 + 1 ); - pTmpSpace = sqlite3_malloc64(BITVEC_SZ); + pBitvec = tdsqlite3BitvecCreate( sz ); + pV = tdsqlite3MallocZero( (sz+7)/8 + 1 ); + pTmpSpace = tdsqlite3_malloc64(BITVEC_SZ); if( pBitvec==0 || pV==0 || pTmpSpace==0 ) goto bitvec_end; /* NULL pBitvec tests */ - sqlite3BitvecSet(0, 1); - sqlite3BitvecClear(0, 1, pTmpSpace); + tdsqlite3BitvecSet(0, 1); + tdsqlite3BitvecClear(0, 1, pTmpSpace); /* Run the program */ pc = 0; @@ -53656,7 +53656,7 @@ SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int sz, int *aOp){ case 4: default: { nx = 2; - sqlite3_randomness(sizeof(i), &i); + tdsqlite3_randomness(sizeof(i), &i); break; } } @@ -53666,11 +53666,11 @@ SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int sz, int *aOp){ if( (op & 1)!=0 ){ SETBIT(pV, (i+1)); if( op!=5 ){ - if( sqlite3BitvecSet(pBitvec, i+1) ) goto bitvec_end; + if( tdsqlite3BitvecSet(pBitvec, i+1) ) goto bitvec_end; } }else{ CLEARBIT(pV, (i+1)); - sqlite3BitvecClear(pBitvec, i+1, pTmpSpace); + tdsqlite3BitvecClear(pBitvec, i+1, pTmpSpace); } } @@ -53679,11 +53679,11 @@ SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int sz, int *aOp){ ** match (rc==0). Change rc to non-zero if a discrepancy ** is found. */ - rc = sqlite3BitvecTest(0,0) + sqlite3BitvecTest(pBitvec, sz+1) - + sqlite3BitvecTest(pBitvec, 0) - + (sqlite3BitvecSize(pBitvec) - sz); + rc = tdsqlite3BitvecTest(0,0) + tdsqlite3BitvecTest(pBitvec, sz+1) + + tdsqlite3BitvecTest(pBitvec, 0) + + (tdsqlite3BitvecSize(pBitvec) - sz); for(i=1; i<=sz; i++){ - if( (TESTBIT(pV,i))!=sqlite3BitvecTest(pBitvec,i) ){ + if( (TESTBIT(pV,i))!=tdsqlite3BitvecTest(pBitvec,i) ){ rc = i; break; } @@ -53691,9 +53691,9 @@ SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int sz, int *aOp){ /* Free allocated structure */ bitvec_end: - sqlite3_free(pTmpSpace); - sqlite3_free(pV); - sqlite3BitvecDestroy(pBitvec); + tdsqlite3_free(pTmpSpace); + tdsqlite3_free(pV); + tdsqlite3BitvecDestroy(pBitvec); return rc; } #endif /* SQLITE_UNTESTABLE */ @@ -53752,7 +53752,7 @@ struct PCache { u8 eCreate; /* eCreate value for for xFetch() */ int (*xStress)(void*,PgHdr*); /* Call to try make a page clean */ void *pStress; /* Argument to xStress */ - sqlite3_pcache *pCache; /* Pluggable cache module */ + tdsqlite3_pcache *pCache; /* Pluggable cache module */ }; /********************************** Test and Debug Logic **********************/ @@ -53760,27 +53760,27 @@ struct PCache { ** Debug tracing macros. Enable by by changing the "0" to "1" and ** recompiling. ** -** When sqlite3PcacheTrace is 1, single line trace messages are issued. -** When sqlite3PcacheTrace is 2, a dump of the pcache showing all cache entries +** When tdsqlite3PcacheTrace is 1, single line trace messages are issued. +** When tdsqlite3PcacheTrace is 2, a dump of the pcache showing all cache entries ** is displayed for many operations, resulting in a lot of output. */ #if defined(SQLITE_DEBUG) && 0 - int sqlite3PcacheTrace = 2; /* 0: off 1: simple 2: cache dumps */ - int sqlite3PcacheMxDump = 9999; /* Max cache entries for pcacheDump() */ -# define pcacheTrace(X) if(sqlite3PcacheTrace){sqlite3DebugPrintf X;} + int tdsqlite3PcacheTrace = 2; /* 0: off 1: simple 2: cache dumps */ + int tdsqlite3PcacheMxDump = 9999; /* Max cache entries for pcacheDump() */ +# define pcacheTrace(X) if(tdsqlite3PcacheTrace){tdsqlite3DebugPrintf X;} void pcacheDump(PCache *pCache){ int N; int i, j; - sqlite3_pcache_page *pLower; + tdsqlite3_pcache_page *pLower; PgHdr *pPg; unsigned char *a; - if( sqlite3PcacheTrace<2 ) return; + if( tdsqlite3PcacheTrace<2 ) return; if( pCache->pCache==0 ) return; - N = sqlite3PcachePagecount(pCache); - if( N>sqlite3PcacheMxDump ) N = sqlite3PcacheMxDump; + N = tdsqlite3PcachePagecount(pCache); + if( N>tdsqlite3PcacheMxDump ) N = tdsqlite3PcacheMxDump; for(i=1; i<=N; i++){ - pLower = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, i, 0); + pLower = tdsqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, i, 0); if( pLower==0 ) continue; pPg = (PgHdr*)pLower->pExtra; printf("%3d: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags); @@ -53788,7 +53788,7 @@ struct PCache { for(j=0; j<12; j++) printf("%02x", a[j]); printf("\n"); if( pPg->pPage==0 ){ - sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, pLower, 0); + tdsqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, pLower, 0); } } } @@ -53804,10 +53804,10 @@ struct PCache { ** This routine is for use inside of assert() statements only. For ** example: ** -** assert( sqlite3PcachePageSanity(pPg) ); +** assert( tdsqlite3PcachePageSanity(pPg) ); */ #ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3PcachePageSanity(PgHdr *pPg){ +SQLITE_PRIVATE int tdsqlite3PcachePageSanity(PgHdr *pPg){ PCache *pCache; assert( pPg!=0 ); assert( pPg->pgno>0 || pPg->pPager==0 ); /* Page number is 1 or more */ @@ -53823,7 +53823,7 @@ SQLITE_PRIVATE int sqlite3PcachePageSanity(PgHdr *pPg){ assert( pPg->flags & PGHDR_DIRTY ); /* WRITEABLE implies DIRTY */ } /* NEED_SYNC can be set independently of WRITEABLE. This can happen, - ** for example, when using the sqlite3PagerDontWrite() optimization: + ** for example, when using the tdsqlite3PagerDontWrite() optimization: ** (1) Page X is journalled, and gets WRITEABLE and NEED_SEEK. ** (2) Page X moved to freelist, WRITEABLE is cleared ** (3) Page X reused, WRITEABLE is set again @@ -53882,7 +53882,7 @@ static void pcacheManageDirtyList(PgHdr *pPage, u8 addRemove){ pPage->pDirtyPrev->pDirtyNext = pPage->pDirtyNext; }else{ /* If there are now no dirty pages in the cache, set eCreate to 2. - ** This is an optimization that allows sqlite3PcacheFetch() to skip + ** This is an optimization that allows tdsqlite3PcacheFetch() to skip ** searching for a dirty page to eject from the cache when it might ** otherwise have to. */ assert( pPage==p->pDirty ); @@ -53912,7 +53912,7 @@ static void pcacheManageDirtyList(PgHdr *pPage, u8 addRemove){ /* If pSynced is NULL and this page has a clear NEED_SYNC flag, set ** pSynced to point to it. Checking the NEED_SYNC flag is an ** optimization, as if pSynced points to a page with the NEED_SYNC - ** flag set sqlite3PcacheFetchStress() searches through all newer + ** flag set tdsqlite3PcacheFetchStress() searches through all newer ** entries of the dirty-list for a page with NEED_SYNC clear anyway. */ if( !p->pSynced && 0==(pPage->flags&PGHDR_NEED_SYNC) /*OPTIMIZATION-IF-FALSE*/ @@ -53930,7 +53930,7 @@ static void pcacheManageDirtyList(PgHdr *pPage, u8 addRemove){ static void pcacheUnpin(PgHdr *p){ if( p->pCache->bPurgeable ){ pcacheTrace(("%p.UNPIN %d\n", p->pCache, p->pgno)); - sqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 0); + tdsqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 0); pcacheDump(p->pCache); } } @@ -53958,33 +53958,33 @@ static int numberOfCachePages(PCache *p){ ** Initialize and shutdown the page cache subsystem. Neither of these ** functions are threadsafe. */ -SQLITE_PRIVATE int sqlite3PcacheInitialize(void){ - if( sqlite3GlobalConfig.pcache2.xInit==0 ){ +SQLITE_PRIVATE int tdsqlite3PcacheInitialize(void){ + if( tdsqlite3GlobalConfig.pcache2.xInit==0 ){ /* IMPLEMENTATION-OF: R-26801-64137 If the xInit() method is NULL, then the ** built-in default page cache is used instead of the application defined ** page cache. */ - sqlite3PCacheSetDefault(); - assert( sqlite3GlobalConfig.pcache2.xInit!=0 ); + tdsqlite3PCacheSetDefault(); + assert( tdsqlite3GlobalConfig.pcache2.xInit!=0 ); } - return sqlite3GlobalConfig.pcache2.xInit(sqlite3GlobalConfig.pcache2.pArg); + return tdsqlite3GlobalConfig.pcache2.xInit(tdsqlite3GlobalConfig.pcache2.pArg); } -SQLITE_PRIVATE void sqlite3PcacheShutdown(void){ - if( sqlite3GlobalConfig.pcache2.xShutdown ){ +SQLITE_PRIVATE void tdsqlite3PcacheShutdown(void){ + if( tdsqlite3GlobalConfig.pcache2.xShutdown ){ /* IMPLEMENTATION-OF: R-26000-56589 The xShutdown() method may be NULL. */ - sqlite3GlobalConfig.pcache2.xShutdown(sqlite3GlobalConfig.pcache2.pArg); + tdsqlite3GlobalConfig.pcache2.xShutdown(tdsqlite3GlobalConfig.pcache2.pArg); } } /* ** Return the size in bytes of a PCache object. */ -SQLITE_PRIVATE int sqlite3PcacheSize(void){ return sizeof(PCache); } +SQLITE_PRIVATE int tdsqlite3PcacheSize(void){ return sizeof(PCache); } /* ** Create a new PCache object. Storage space to hold the object ** has already been allocated and is passed in as the p pointer. ** The caller discovers how much space needs to be allocated by -** calling sqlite3PcacheSize(). +** calling tdsqlite3PcacheSize(). ** ** szExtra is some extra space allocated for each page. The first ** 8 bytes of the extra space will be zeroed as the page is allocated, @@ -53992,7 +53992,7 @@ SQLITE_PRIVATE int sqlite3PcacheSize(void){ return sizeof(PCache); } ** to this module, the extra space really ends up being the MemPage ** structure in the pager. */ -SQLITE_PRIVATE int sqlite3PcacheOpen( +SQLITE_PRIVATE int tdsqlite3PcacheOpen( int szPage, /* Size of every page */ int szExtra, /* Extra space associated with each page */ int bPurgeable, /* True if pages are on backing store */ @@ -54011,25 +54011,25 @@ SQLITE_PRIVATE int sqlite3PcacheOpen( p->szCache = 100; p->szSpill = 1; pcacheTrace(("%p.OPEN szPage %d bPurgeable %d\n",p,szPage,bPurgeable)); - return sqlite3PcacheSetPageSize(p, szPage); + return tdsqlite3PcacheSetPageSize(p, szPage); } /* ** Change the page size for PCache object. The caller must ensure that there ** are no outstanding page references when this function is called. */ -SQLITE_PRIVATE int sqlite3PcacheSetPageSize(PCache *pCache, int szPage){ +SQLITE_PRIVATE int tdsqlite3PcacheSetPageSize(PCache *pCache, int szPage){ assert( pCache->nRefSum==0 && pCache->pDirty==0 ); if( pCache->szPage ){ - sqlite3_pcache *pNew; - pNew = sqlite3GlobalConfig.pcache2.xCreate( + tdsqlite3_pcache *pNew; + pNew = tdsqlite3GlobalConfig.pcache2.xCreate( szPage, pCache->szExtra + ROUND8(sizeof(PgHdr)), pCache->bPurgeable ); if( pNew==0 ) return SQLITE_NOMEM_BKPT; - sqlite3GlobalConfig.pcache2.xCachesize(pNew, numberOfCachePages(pCache)); + tdsqlite3GlobalConfig.pcache2.xCachesize(pNew, numberOfCachePages(pCache)); if( pCache->pCache ){ - sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache); + tdsqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache); } pCache->pCache = pNew; pCache->szPage = szPage; @@ -54041,7 +54041,7 @@ SQLITE_PRIVATE int sqlite3PcacheSetPageSize(PCache *pCache, int szPage){ /* ** Try to obtain a page from the cache. ** -** This routine returns a pointer to an sqlite3_pcache_page object if +** This routine returns a pointer to an tdsqlite3_pcache_page object if ** such an object is already in cache, or if a new one is created. ** This routine returns a NULL pointer if the object was not in cache ** and could not be created. @@ -54054,21 +54054,21 @@ SQLITE_PRIVATE int sqlite3PcacheSetPageSize(PCache *pCache, int szPage){ ** is created only if that can be done without spilling dirty pages ** and without exceeding the cache size limit. ** -** The caller needs to invoke sqlite3PcacheFetchFinish() to properly -** initialize the sqlite3_pcache_page object and convert it into a -** PgHdr object. The sqlite3PcacheFetch() and sqlite3PcacheFetchFinish() +** The caller needs to invoke tdsqlite3PcacheFetchFinish() to properly +** initialize the tdsqlite3_pcache_page object and convert it into a +** PgHdr object. The tdsqlite3PcacheFetch() and tdsqlite3PcacheFetchFinish() ** routines are split this way for performance reasons. When separated ** they can both (usually) operate without having to push values to ** the stack on entry and pop them back off on exit, which saves a ** lot of pushing and popping. */ -SQLITE_PRIVATE sqlite3_pcache_page *sqlite3PcacheFetch( +SQLITE_PRIVATE tdsqlite3_pcache_page *tdsqlite3PcacheFetch( PCache *pCache, /* Obtain the page from this cache */ Pgno pgno, /* Page number to obtain */ int createFlag /* If true, create page if it does not exist already */ ){ int eCreate; - sqlite3_pcache_page *pRes; + tdsqlite3_pcache_page *pRes; assert( pCache!=0 ); assert( pCache->pCache!=0 ); @@ -54086,14 +54086,14 @@ SQLITE_PRIVATE sqlite3_pcache_page *sqlite3PcacheFetch( assert( eCreate==0 || eCreate==1 || eCreate==2 ); assert( createFlag==0 || pCache->eCreate==eCreate ); assert( createFlag==0 || eCreate==1+(!pCache->bPurgeable||!pCache->pDirty) ); - pRes = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, eCreate); + pRes = tdsqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, eCreate); pcacheTrace(("%p.FETCH %d%s (result: %p)\n",pCache,pgno, createFlag?" create":"",pRes)); return pRes; } /* -** If the sqlite3PcacheFetch() routine is unable to allocate a new +** If the tdsqlite3PcacheFetch() routine is unable to allocate a new ** page because no clean pages are available for reuse and the cache ** size limit has been reached, then this routine can be invoked to ** try harder to allocate a page. This routine might invoke the stress @@ -54101,17 +54101,17 @@ SQLITE_PRIVATE sqlite3_pcache_page *sqlite3PcacheFetch( ** allocate the new page and will only fail to allocate a new page on ** an OOM error. ** -** This routine should be invoked only after sqlite3PcacheFetch() fails. +** This routine should be invoked only after tdsqlite3PcacheFetch() fails. */ -SQLITE_PRIVATE int sqlite3PcacheFetchStress( +SQLITE_PRIVATE int tdsqlite3PcacheFetchStress( PCache *pCache, /* Obtain the page from this cache */ Pgno pgno, /* Page number to obtain */ - sqlite3_pcache_page **ppPage /* Write result here */ + tdsqlite3_pcache_page **ppPage /* Write result here */ ){ PgHdr *pPg; if( pCache->eCreate==2 ) return 0; - if( sqlite3PcachePagecount(pCache)>pCache->szSpill ){ + if( tdsqlite3PcachePagecount(pCache)>pCache->szSpill ){ /* Find a dirty page to write-out and recycle. First try to find a ** page that does not require a journal-sync (one with PGHDR_NEED_SYNC ** cleared), but if that is not possible settle for any other @@ -54132,10 +54132,10 @@ SQLITE_PRIVATE int sqlite3PcacheFetchStress( if( pPg ){ int rc; #ifdef SQLITE_LOG_CACHE_SPILL - sqlite3_log(SQLITE_FULL, + tdsqlite3_log(SQLITE_FULL, "spill page %d making room for %d - cache used: %d/%d", pPg->pgno, pgno, - sqlite3GlobalConfig.pcache2.xPagecount(pCache->pCache), + tdsqlite3GlobalConfig.pcache2.xPagecount(pCache->pCache), numberOfCachePages(pCache)); #endif pcacheTrace(("%p.SPILL %d\n",pCache,pPg->pgno)); @@ -54146,12 +54146,12 @@ SQLITE_PRIVATE int sqlite3PcacheFetchStress( } } } - *ppPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, 2); + *ppPage = tdsqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, 2); return *ppPage==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK; } /* -** This is a helper routine for sqlite3PcacheFetchFinish() +** This is a helper routine for tdsqlite3PcacheFetchFinish() ** ** In the uncommon case where the page being fetched has not been ** initialized, this routine is invoked to do the initialization. @@ -54162,7 +54162,7 @@ SQLITE_PRIVATE int sqlite3PcacheFetchStress( static SQLITE_NOINLINE PgHdr *pcacheFetchFinishWithInit( PCache *pCache, /* Obtain the page from this cache */ Pgno pgno, /* Page number obtained */ - sqlite3_pcache_page *pPage /* Page obtained by prior PcacheFetch() call */ + tdsqlite3_pcache_page *pPage /* Page obtained by prior PcacheFetch() call */ ){ PgHdr *pPgHdr; assert( pPage!=0 ); @@ -54176,19 +54176,19 @@ static SQLITE_NOINLINE PgHdr *pcacheFetchFinishWithInit( pPgHdr->pCache = pCache; pPgHdr->pgno = pgno; pPgHdr->flags = PGHDR_CLEAN; - return sqlite3PcacheFetchFinish(pCache,pgno,pPage); + return tdsqlite3PcacheFetchFinish(pCache,pgno,pPage); } /* -** This routine converts the sqlite3_pcache_page object returned by -** sqlite3PcacheFetch() into an initialized PgHdr object. This routine -** must be called after sqlite3PcacheFetch() in order to get a usable +** This routine converts the tdsqlite3_pcache_page object returned by +** tdsqlite3PcacheFetch() into an initialized PgHdr object. This routine +** must be called after tdsqlite3PcacheFetch() in order to get a usable ** result. */ -SQLITE_PRIVATE PgHdr *sqlite3PcacheFetchFinish( +SQLITE_PRIVATE PgHdr *tdsqlite3PcacheFetchFinish( PCache *pCache, /* Obtain the page from this cache */ Pgno pgno, /* Page number obtained */ - sqlite3_pcache_page *pPage /* Page obtained by prior PcacheFetch() call */ + tdsqlite3_pcache_page *pPage /* Page obtained by prior PcacheFetch() call */ ){ PgHdr *pPgHdr; @@ -54200,7 +54200,7 @@ SQLITE_PRIVATE PgHdr *sqlite3PcacheFetchFinish( } pCache->nRefSum++; pPgHdr->nRef++; - assert( sqlite3PcachePageSanity(pPgHdr) ); + assert( tdsqlite3PcachePageSanity(pPgHdr) ); return pPgHdr; } @@ -54208,7 +54208,7 @@ SQLITE_PRIVATE PgHdr *sqlite3PcacheFetchFinish( ** Decrement the reference count on a page. If the page is clean and the ** reference count drops to 0, then it is made eligible for recycling. */ -SQLITE_PRIVATE void SQLITE_NOINLINE sqlite3PcacheRelease(PgHdr *p){ +SQLITE_PRIVATE void SQLITE_NOINLINE tdsqlite3PcacheRelease(PgHdr *p){ assert( p->nRef>0 ); p->pCache->nRefSum--; if( (--p->nRef)==0 ){ @@ -54223,9 +54223,9 @@ SQLITE_PRIVATE void SQLITE_NOINLINE sqlite3PcacheRelease(PgHdr *p){ /* ** Increase the reference count of a supplied page by 1. */ -SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr *p){ +SQLITE_PRIVATE void tdsqlite3PcacheRef(PgHdr *p){ assert(p->nRef>0); - assert( sqlite3PcachePageSanity(p) ); + assert( tdsqlite3PcachePageSanity(p) ); p->nRef++; p->pCache->nRefSum++; } @@ -54235,23 +54235,23 @@ SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr *p){ ** page. This function deletes that reference, so after it returns the ** page pointed to by p is invalid. */ -SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr *p){ +SQLITE_PRIVATE void tdsqlite3PcacheDrop(PgHdr *p){ assert( p->nRef==1 ); - assert( sqlite3PcachePageSanity(p) ); + assert( tdsqlite3PcachePageSanity(p) ); if( p->flags&PGHDR_DIRTY ){ pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE); } p->pCache->nRefSum--; - sqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 1); + tdsqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 1); } /* ** Make sure the page is marked as dirty. If it isn't dirty already, ** make it so. */ -SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr *p){ +SQLITE_PRIVATE void tdsqlite3PcacheMakeDirty(PgHdr *p){ assert( p->nRef>0 ); - assert( sqlite3PcachePageSanity(p) ); + assert( tdsqlite3PcachePageSanity(p) ); if( p->flags & (PGHDR_CLEAN|PGHDR_DONT_WRITE) ){ /*OPTIMIZATION-IF-FALSE*/ p->flags &= ~PGHDR_DONT_WRITE; if( p->flags & PGHDR_CLEAN ){ @@ -54260,7 +54260,7 @@ SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr *p){ assert( (p->flags & (PGHDR_DIRTY|PGHDR_CLEAN))==PGHDR_DIRTY ); pcacheManageDirtyList(p, PCACHE_DIRTYLIST_ADD); } - assert( sqlite3PcachePageSanity(p) ); + assert( tdsqlite3PcachePageSanity(p) ); } } @@ -54268,15 +54268,15 @@ SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr *p){ ** Make sure the page is marked as clean. If it isn't clean already, ** make it so. */ -SQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr *p){ - assert( sqlite3PcachePageSanity(p) ); +SQLITE_PRIVATE void tdsqlite3PcacheMakeClean(PgHdr *p){ + assert( tdsqlite3PcachePageSanity(p) ); assert( (p->flags & PGHDR_DIRTY)!=0 ); assert( (p->flags & PGHDR_CLEAN)==0 ); pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE); p->flags &= ~(PGHDR_DIRTY|PGHDR_NEED_SYNC|PGHDR_WRITEABLE); p->flags |= PGHDR_CLEAN; pcacheTrace(("%p.CLEAN %d\n",p->pCache,p->pgno)); - assert( sqlite3PcachePageSanity(p) ); + assert( tdsqlite3PcachePageSanity(p) ); if( p->nRef==0 ){ pcacheUnpin(p); } @@ -54285,18 +54285,18 @@ SQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr *p){ /* ** Make every page in the cache clean. */ -SQLITE_PRIVATE void sqlite3PcacheCleanAll(PCache *pCache){ +SQLITE_PRIVATE void tdsqlite3PcacheCleanAll(PCache *pCache){ PgHdr *p; pcacheTrace(("%p.CLEAN-ALL\n",pCache)); while( (p = pCache->pDirty)!=0 ){ - sqlite3PcacheMakeClean(p); + tdsqlite3PcacheMakeClean(p); } } /* ** Clear the PGHDR_NEED_SYNC and PGHDR_WRITEABLE flag from all dirty pages. */ -SQLITE_PRIVATE void sqlite3PcacheClearWritable(PCache *pCache){ +SQLITE_PRIVATE void tdsqlite3PcacheClearWritable(PCache *pCache){ PgHdr *p; pcacheTrace(("%p.CLEAR-WRITEABLE\n",pCache)); for(p=pCache->pDirty; p; p=p->pDirtyNext){ @@ -54308,7 +54308,7 @@ SQLITE_PRIVATE void sqlite3PcacheClearWritable(PCache *pCache){ /* ** Clear the PGHDR_NEED_SYNC flag from all dirty pages. */ -SQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *pCache){ +SQLITE_PRIVATE void tdsqlite3PcacheClearSyncFlags(PCache *pCache){ PgHdr *p; for(p=pCache->pDirty; p; p=p->pDirtyNext){ p->flags &= ~PGHDR_NEED_SYNC; @@ -54319,13 +54319,13 @@ SQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *pCache){ /* ** Change the page number of page p to newPgno. */ -SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){ +SQLITE_PRIVATE void tdsqlite3PcacheMove(PgHdr *p, Pgno newPgno){ PCache *pCache = p->pCache; assert( p->nRef>0 ); assert( newPgno>0 ); - assert( sqlite3PcachePageSanity(p) ); + assert( tdsqlite3PcachePageSanity(p) ); pcacheTrace(("%p.MOVE %d -> %d\n",pCache,p->pgno,newPgno)); - sqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno); + tdsqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno); p->pgno = newPgno; if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){ pcacheManageDirtyList(p, PCACHE_DIRTYLIST_FRONT); @@ -54341,7 +54341,7 @@ SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){ ** function is 0, then the data area associated with page 1 is zeroed, but ** the page object is not dropped. */ -SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache *pCache, Pgno pgno){ +SQLITE_PRIVATE void tdsqlite3PcacheTruncate(PCache *pCache, Pgno pgno){ if( pCache->pCache ){ PgHdr *p; PgHdr *pNext; @@ -54349,42 +54349,42 @@ SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache *pCache, Pgno pgno){ for(p=pCache->pDirty; p; p=pNext){ pNext = p->pDirtyNext; /* This routine never gets call with a positive pgno except right - ** after sqlite3PcacheCleanAll(). So if there are dirty pages, + ** after tdsqlite3PcacheCleanAll(). So if there are dirty pages, ** it must be that pgno==0. */ assert( p->pgno>0 ); if( p->pgno>pgno ){ assert( p->flags&PGHDR_DIRTY ); - sqlite3PcacheMakeClean(p); + tdsqlite3PcacheMakeClean(p); } } if( pgno==0 && pCache->nRefSum ){ - sqlite3_pcache_page *pPage1; - pPage1 = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache,1,0); + tdsqlite3_pcache_page *pPage1; + pPage1 = tdsqlite3GlobalConfig.pcache2.xFetch(pCache->pCache,1,0); if( ALWAYS(pPage1) ){ /* Page 1 is always available in cache, because ** pCache->nRefSum>0 */ memset(pPage1->pBuf, 0, pCache->szPage); pgno = 1; } } - sqlite3GlobalConfig.pcache2.xTruncate(pCache->pCache, pgno+1); + tdsqlite3GlobalConfig.pcache2.xTruncate(pCache->pCache, pgno+1); } } /* ** Close a cache. */ -SQLITE_PRIVATE void sqlite3PcacheClose(PCache *pCache){ +SQLITE_PRIVATE void tdsqlite3PcacheClose(PCache *pCache){ assert( pCache->pCache!=0 ); pcacheTrace(("%p.CLOSE\n",pCache)); - sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache); + tdsqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache); } /* ** Discard the contents of the cache. */ -SQLITE_PRIVATE void sqlite3PcacheClear(PCache *pCache){ - sqlite3PcacheTruncate(pCache, 0); +SQLITE_PRIVATE void tdsqlite3PcacheClear(PCache *pCache){ + tdsqlite3PcacheTruncate(pCache, 0); } /* @@ -54463,7 +54463,7 @@ static PgHdr *pcacheSortDirtyList(PgHdr *pIn){ /* ** Return a list of all dirty pages in the cache, sorted by page number. */ -SQLITE_PRIVATE PgHdr *sqlite3PcacheDirtyList(PCache *pCache){ +SQLITE_PRIVATE PgHdr *tdsqlite3PcacheDirtyList(PCache *pCache){ PgHdr *p; for(p=pCache->pDirty; p; p=p->pDirtyNext){ p->pDirty = p->pDirtyNext; @@ -54477,30 +54477,30 @@ SQLITE_PRIVATE PgHdr *sqlite3PcacheDirtyList(PCache *pCache){ ** This is not the total number of pages referenced, but the sum of the ** reference count for all pages. */ -SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache *pCache){ +SQLITE_PRIVATE int tdsqlite3PcacheRefCount(PCache *pCache){ return pCache->nRefSum; } /* ** Return the number of references to the page supplied as an argument. */ -SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr *p){ +SQLITE_PRIVATE int tdsqlite3PcachePageRefcount(PgHdr *p){ return p->nRef; } /* ** Return the total number of pages in the cache. */ -SQLITE_PRIVATE int sqlite3PcachePagecount(PCache *pCache){ +SQLITE_PRIVATE int tdsqlite3PcachePagecount(PCache *pCache){ assert( pCache->pCache!=0 ); - return sqlite3GlobalConfig.pcache2.xPagecount(pCache->pCache); + return tdsqlite3GlobalConfig.pcache2.xPagecount(pCache->pCache); } #ifdef SQLITE_TEST /* ** Get the suggested cache-size value. */ -SQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *pCache){ +SQLITE_PRIVATE int tdsqlite3PcacheGetCachesize(PCache *pCache){ return numberOfCachePages(pCache); } #endif @@ -54508,10 +54508,10 @@ SQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *pCache){ /* ** Set the suggested cache-size value. */ -SQLITE_PRIVATE void sqlite3PcacheSetCachesize(PCache *pCache, int mxPage){ +SQLITE_PRIVATE void tdsqlite3PcacheSetCachesize(PCache *pCache, int mxPage){ assert( pCache->pCache!=0 ); pCache->szCache = mxPage; - sqlite3GlobalConfig.pcache2.xCachesize(pCache->pCache, + tdsqlite3GlobalConfig.pcache2.xCachesize(pCache->pCache, numberOfCachePages(pCache)); } @@ -54520,7 +54520,7 @@ SQLITE_PRIVATE void sqlite3PcacheSetCachesize(PCache *pCache, int mxPage){ ** argument is zero. Return the effective cache-spill size, which will ** be the larger of the szSpill and szCache. */ -SQLITE_PRIVATE int sqlite3PcacheSetSpillsize(PCache *p, int mxPage){ +SQLITE_PRIVATE int tdsqlite3PcacheSetSpillsize(PCache *p, int mxPage){ int res; assert( p->pCache!=0 ); if( mxPage ){ @@ -54537,22 +54537,22 @@ SQLITE_PRIVATE int sqlite3PcacheSetSpillsize(PCache *p, int mxPage){ /* ** Free up as much memory as possible from the page cache. */ -SQLITE_PRIVATE void sqlite3PcacheShrink(PCache *pCache){ +SQLITE_PRIVATE void tdsqlite3PcacheShrink(PCache *pCache){ assert( pCache->pCache!=0 ); - sqlite3GlobalConfig.pcache2.xShrink(pCache->pCache); + tdsqlite3GlobalConfig.pcache2.xShrink(pCache->pCache); } /* ** Return the size of the header added by this middleware layer ** in the page-cache hierarchy. */ -SQLITE_PRIVATE int sqlite3HeaderSizePcache(void){ return ROUND8(sizeof(PgHdr)); } +SQLITE_PRIVATE int tdsqlite3HeaderSizePcache(void){ return ROUND8(sizeof(PgHdr)); } /* ** Return the number of dirty pages currently in the cache, as a percentage ** of the configured cache size. */ -SQLITE_PRIVATE int sqlite3PCachePercentDirty(PCache *pCache){ +SQLITE_PRIVATE int tdsqlite3PCachePercentDirty(PCache *pCache){ PgHdr *pDirty; int nDirty = 0; int nCache = numberOfCachePages(pCache); @@ -54564,7 +54564,7 @@ SQLITE_PRIVATE int sqlite3PCachePercentDirty(PCache *pCache){ /* ** Return true if there are one or more dirty pages in the cache. Else false. */ -SQLITE_PRIVATE int sqlite3PCacheIsDirty(PCache *pCache){ +SQLITE_PRIVATE int tdsqlite3PCacheIsDirty(PCache *pCache){ return (pCache->pDirty!=0); } #endif @@ -54575,7 +54575,7 @@ SQLITE_PRIVATE int sqlite3PCacheIsDirty(PCache *pCache){ ** callback. This is only used if the SQLITE_CHECK_PAGES macro is ** defined. */ -SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *)){ +SQLITE_PRIVATE void tdsqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *)){ PgHdr *pDirty; for(pDirty=pCache->pDirty; pDirty; pDirty=pDirty->pDirtyNext){ xIter(pDirty); @@ -54598,8 +54598,8 @@ SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHd ************************************************************************* ** ** This file implements the default page cache implementation (the -** sqlite3_pcache interface). It also contains part of the implementation -** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features. +** tdsqlite3_pcache interface). It also contains part of the implementation +** of the SQLITE_CONFIG_PAGECACHE and tdsqlite3_release_memory() features. ** If the default page cache implementation is overridden, then neither of ** these two features are available. ** @@ -54615,13 +54615,13 @@ SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHd ** as the database page number and how that database page is used. PgHdr ** is added by the pcache.c layer and contains information used to keep track ** of which pages are "dirty". PgHdr1 is an extension added by this -** module (pcache1.c). The PgHdr1 header is a subclass of sqlite3_pcache_page. +** module (pcache1.c). The PgHdr1 header is a subclass of tdsqlite3_pcache_page. ** PgHdr1 contains information needed to look up a page by its page number. -** The superclass sqlite3_pcache_page.pBuf points to the start of the -** database page content and sqlite3_pcache_page.pExtra points to PgHdr. +** The superclass tdsqlite3_pcache_page.pBuf points to the start of the +** database page content and tdsqlite3_pcache_page.pExtra points to PgHdr. ** ** The size of the extension (MemPage+PgHdr+PgHdr1) can be determined at -** runtime using sqlite3_config(SQLITE_CONFIG_PCACHE_HDRSZ, &size). The +** runtime using tdsqlite3_config(SQLITE_CONFIG_PCACHE_HDRSZ, &size). The ** sizes of the extensions sum to 272 bytes on x64 for 3.8.10, but this ** size can vary according to architecture, compile-time options, and ** SQLite library version number. @@ -54643,8 +54643,8 @@ SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHd ** ** Memory for a page might come from any of three sources: ** -** (1) The general-purpose memory allocator - sqlite3Malloc() -** (2) Global page-cache memory provided using sqlite3_config() with +** (1) The general-purpose memory allocator - tdsqlite3Malloc() +** (2) Global page-cache memory provided using tdsqlite3_config() with ** SQLITE_CONFIG_PAGECACHE. ** (3) PCache-local bulk allocation. ** @@ -54652,10 +54652,10 @@ SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHd ** that is allocated when the page cache is created. The size of the local ** bulk allocation can be adjusted using ** -** sqlite3_config(SQLITE_CONFIG_PAGECACHE, (void*)0, 0, N). +** tdsqlite3_config(SQLITE_CONFIG_PAGECACHE, (void*)0, 0, N). ** ** If N is positive, then N pages worth of memory are allocated using a single -** sqlite3Malloc() call and that memory is used for the first N pages allocated. +** tdsqlite3Malloc() call and that memory is used for the first N pages allocated. ** Or if N is negative, then -1024*N bytes of memory are allocated and used ** for as many pages as can be accomodated. ** @@ -54691,7 +54691,7 @@ typedef struct PGroup PGroup; ** in the structure. */ struct PgHdr1 { - sqlite3_pcache_page page; /* Base class. Must be first. pBuf & pExtra */ + tdsqlite3_pcache_page page; /* Base class. Must be first. pBuf & pExtra */ unsigned int iKey; /* Key value (page number) */ u16 isBulkLocal; /* This page from bulk local storage */ u16 isAnchor; /* This is the PGroup.lru element */ @@ -54732,7 +54732,7 @@ struct PgHdr1 { ** SQLITE_MUTEX_STATIC_LRU. */ struct PGroup { - sqlite3_mutex *mutex; /* MUTEX_STATIC_LRU or NULL */ + tdsqlite3_mutex *mutex; /* MUTEX_STATIC_LRU or NULL */ unsigned int nMaxPage; /* Sum of nMax for purgeable caches */ unsigned int nMinPage; /* Sum of nMin for purgeable caches */ unsigned int mxPinned; /* nMaxpage + 10 - nMinPage */ @@ -54746,7 +54746,7 @@ struct PGroup { ** is an instance of this object. ** ** Pointers to structures of this type are cast and returned as -** opaque sqlite3_pcache* handles. +** opaque tdsqlite3_pcache* handles. */ struct PCache1 { /* Cache configuration parameters. Page size (szPage) and the purgeable @@ -54794,7 +54794,7 @@ static SQLITE_WSD struct PCacheGlobal { /* Variables related to SQLITE_CONFIG_PAGECACHE settings. The ** szSlot, nSlot, pStart, pEnd, nReserve, and isInit values are all - ** fixed at sqlite3_initialize() time and do not require mutex protection. + ** fixed at tdsqlite3_initialize() time and do not require mutex protection. ** The nFreeSlot and pFree values do require mutex protection. */ int isInit; /* True if initialized */ @@ -54805,7 +54805,7 @@ static SQLITE_WSD struct PCacheGlobal { int nReserve; /* Try to keep nFreeSlot above this */ void *pStart, *pEnd; /* Bounds of global page cache memory */ /* Above requires no mutex. Use mutex below for variable that follow. */ - sqlite3_mutex *mutex; /* Mutex for accessing the following: */ + tdsqlite3_mutex *mutex; /* Mutex for accessing the following: */ PgFreeslot *pFree; /* Free page blocks */ int nFreeSlot; /* Number of unused pcache slots */ /* The following value requires a mutex to change. We skip the mutex on @@ -54830,8 +54830,8 @@ static SQLITE_WSD struct PCacheGlobal { # define pcache1LeaveMutex(X) assert((X)->mutex==0) # define PCACHE1_MIGHT_USE_GROUP_MUTEX 0 #else -# define pcache1EnterMutex(X) sqlite3_mutex_enter((X)->mutex) -# define pcache1LeaveMutex(X) sqlite3_mutex_leave((X)->mutex) +# define pcache1EnterMutex(X) tdsqlite3_mutex_enter((X)->mutex) +# define pcache1LeaveMutex(X) tdsqlite3_mutex_leave((X)->mutex) # define PCACHE1_MIGHT_USE_GROUP_MUTEX 1 #endif @@ -54842,13 +54842,13 @@ static SQLITE_WSD struct PCacheGlobal { /* ** This function is called during initialization if a static buffer is ** supplied to use for the page-cache by passing the SQLITE_CONFIG_PAGECACHE -** verb to sqlite3_config(). Parameter pBuf points to an allocation large +** verb to tdsqlite3_config(). Parameter pBuf points to an allocation large ** enough to contain 'n' buffers of 'sz' bytes each. ** -** This routine is called from sqlite3_initialize() and so it is guaranteed +** This routine is called from tdsqlite3_initialize() and so it is guaranteed ** to be serialized already. There is no need for further mutexing. */ -SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){ +SQLITE_PRIVATE void tdsqlite3PCacheBufferSetup(void *pBuf, int sz, int n){ if( pcache1.isInit ){ PgFreeslot *p; if( pBuf==0 ) sz = n = 0; @@ -54880,7 +54880,7 @@ static int pcache1InitBulk(PCache1 *pCache){ if( pcache1.nInitPage==0 ) return 0; /* Do not bother with a bulk allocation if the cache size very small */ if( pCache->nMax<3 ) return 0; - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); if( pcache1.nInitPage>0 ){ szBulk = pCache->szAlloc * (i64)pcache1.nInitPage; }else{ @@ -54889,10 +54889,10 @@ static int pcache1InitBulk(PCache1 *pCache){ if( szBulk > pCache->szAlloc*(i64)pCache->nMax ){ szBulk = pCache->szAlloc*(i64)pCache->nMax; } - zBulk = pCache->pBulk = sqlite3Malloc( szBulk ); - sqlite3EndBenignMalloc(); + zBulk = pCache->pBulk = tdsqlite3Malloc( szBulk ); + tdsqlite3EndBenignMalloc(); if( zBulk ){ - int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc; + int nBulk = tdsqlite3MallocSize(zBulk)/pCache->szAlloc; do{ PgHdr1 *pX = (PgHdr1*)&zBulk[pCache->szPage]; pX->page.pBuf = zBulk; @@ -54910,44 +54910,44 @@ static int pcache1InitBulk(PCache1 *pCache){ /* ** Malloc function used within this file to allocate space from the buffer -** configured using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no +** configured using tdsqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no ** such buffer exists or there is no space left in it, this function falls -** back to sqlite3Malloc(). +** back to tdsqlite3Malloc(). ** ** Multiple threads can run this routine at the same time. Global variables ** in pcache1 need to be protected via mutex. */ static void *pcache1Alloc(int nByte){ void *p = 0; - assert( sqlite3_mutex_notheld(pcache1.grp.mutex) ); + assert( tdsqlite3_mutex_notheld(pcache1.grp.mutex) ); if( nByte<=pcache1.szSlot ){ - sqlite3_mutex_enter(pcache1.mutex); + tdsqlite3_mutex_enter(pcache1.mutex); p = (PgHdr1 *)pcache1.pFree; if( p ){ pcache1.pFree = pcache1.pFree->pNext; pcache1.nFreeSlot--; pcache1.bUnderPressure = pcache1.nFreeSlot=0 ); - sqlite3StatusHighwater(SQLITE_STATUS_PAGECACHE_SIZE, nByte); - sqlite3StatusUp(SQLITE_STATUS_PAGECACHE_USED, 1); + tdsqlite3StatusHighwater(SQLITE_STATUS_PAGECACHE_SIZE, nByte); + tdsqlite3StatusUp(SQLITE_STATUS_PAGECACHE_USED, 1); } - sqlite3_mutex_leave(pcache1.mutex); + tdsqlite3_mutex_leave(pcache1.mutex); } if( p==0 ){ /* Memory is not available in the SQLITE_CONFIG_PAGECACHE pool. Get - ** it from sqlite3Malloc instead. + ** it from tdsqlite3Malloc instead. */ - p = sqlite3Malloc(nByte); + p = tdsqlite3Malloc(nByte); #ifndef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS if( p ){ - int sz = sqlite3MallocSize(p); - sqlite3_mutex_enter(pcache1.mutex); - sqlite3StatusHighwater(SQLITE_STATUS_PAGECACHE_SIZE, nByte); - sqlite3StatusUp(SQLITE_STATUS_PAGECACHE_OVERFLOW, sz); - sqlite3_mutex_leave(pcache1.mutex); + int sz = tdsqlite3MallocSize(p); + tdsqlite3_mutex_enter(pcache1.mutex); + tdsqlite3StatusHighwater(SQLITE_STATUS_PAGECACHE_SIZE, nByte); + tdsqlite3StatusUp(SQLITE_STATUS_PAGECACHE_OVERFLOW, sz); + tdsqlite3_mutex_leave(pcache1.mutex); } #endif - sqlite3MemdebugSetType(p, MEMTYPE_PCACHE); + tdsqlite3MemdebugSetType(p, MEMTYPE_PCACHE); } return p; } @@ -54959,28 +54959,28 @@ static void pcache1Free(void *p){ if( p==0 ) return; if( SQLITE_WITHIN(p, pcache1.pStart, pcache1.pEnd) ){ PgFreeslot *pSlot; - sqlite3_mutex_enter(pcache1.mutex); - sqlite3StatusDown(SQLITE_STATUS_PAGECACHE_USED, 1); + tdsqlite3_mutex_enter(pcache1.mutex); + tdsqlite3StatusDown(SQLITE_STATUS_PAGECACHE_USED, 1); pSlot = (PgFreeslot*)p; pSlot->pNext = pcache1.pFree; pcache1.pFree = pSlot; pcache1.nFreeSlot++; pcache1.bUnderPressure = pcache1.nFreeSlotpGroup->mutex) ); + assert( tdsqlite3_mutex_held(pCache->pGroup->mutex) ); if( pCache->pFree || (pCache->nPage==0 && pcache1InitBulk(pCache)) ){ assert( pCache->pFree!=0 ); p = pCache->pFree; @@ -55018,25 +55018,25 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache, int benignMalloc){ }else{ #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT /* The group mutex must be released before pcache1Alloc() is called. This - ** is because it might call sqlite3_release_memory(), which assumes that + ** is because it might call tdsqlite3_release_memory(), which assumes that ** this mutex is not held. */ assert( pcache1.separateCache==0 ); assert( pCache->pGroup==&pcache1.grp ); pcache1LeaveMutex(pCache->pGroup); #endif - if( benignMalloc ){ sqlite3BeginBenignMalloc(); } + if( benignMalloc ){ tdsqlite3BeginBenignMalloc(); } #ifdef SQLITE_PCACHE_SEPARATE_HEADER pPg = pcache1Alloc(pCache->szPage); - p = sqlite3Malloc(sizeof(PgHdr1) + pCache->szExtra); + p = tdsqlite3Malloc(sizeof(PgHdr1) + pCache->szExtra); if( !pPg || !p ){ pcache1Free(pPg); - sqlite3_free(p); + tdsqlite3_free(p); pPg = 0; } #else pPg = pcache1Alloc(pCache->szAlloc); #endif - if( benignMalloc ){ sqlite3EndBenignMalloc(); } + if( benignMalloc ){ tdsqlite3EndBenignMalloc(); } #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT pcache1EnterMutex(pCache->pGroup); #endif @@ -55060,14 +55060,14 @@ static void pcache1FreePage(PgHdr1 *p){ PCache1 *pCache; assert( p!=0 ); pCache = p->pCache; - assert( sqlite3_mutex_held(p->pCache->pGroup->mutex) ); + assert( tdsqlite3_mutex_held(p->pCache->pGroup->mutex) ); if( p->isBulkLocal ){ p->pNext = pCache->pFree; pCache->pFree = p; }else{ pcache1Free(p->page.pBuf); #ifdef SQLITE_PCACHE_SEPARATE_HEADER - sqlite3_free(p); + tdsqlite3_free(p); #endif } (*pCache->pnPurgeable)--; @@ -55075,18 +55075,18 @@ static void pcache1FreePage(PgHdr1 *p){ /* ** Malloc function used by SQLite to obtain space from the buffer configured -** using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no such buffer -** exists, this function falls back to sqlite3Malloc(). +** using tdsqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no such buffer +** exists, this function falls back to tdsqlite3Malloc(). */ -SQLITE_PRIVATE void *sqlite3PageMalloc(int sz){ +SQLITE_PRIVATE void *tdsqlite3PageMalloc(int sz){ assert( sz<=65536+8 ); /* These allocations are never very large */ return pcache1Alloc(sz); } /* -** Free an allocated buffer obtained from sqlite3PageMalloc(). +** Free an allocated buffer obtained from tdsqlite3PageMalloc(). */ -SQLITE_PRIVATE void sqlite3PageFree(void *p){ +SQLITE_PRIVATE void tdsqlite3PageFree(void *p){ pcache1Free(p); } @@ -55111,7 +55111,7 @@ static int pcache1UnderMemoryPressure(PCache1 *pCache){ if( pcache1.nSlot && (pCache->szPage+pCache->szExtra)<=pcache1.szSlot ){ return pcache1.bUnderPressure; }else{ - return sqlite3HeapNearlyFull(); + return tdsqlite3HeapNearlyFull(); } } @@ -55129,7 +55129,7 @@ static void pcache1ResizeHash(PCache1 *p){ unsigned int nNew; unsigned int i; - assert( sqlite3_mutex_held(p->pGroup->mutex) ); + assert( tdsqlite3_mutex_held(p->pGroup->mutex) ); nNew = p->nHash*2; if( nNew<256 ){ @@ -55137,9 +55137,9 @@ static void pcache1ResizeHash(PCache1 *p){ } pcache1LeaveMutex(p->pGroup); - if( p->nHash ){ sqlite3BeginBenignMalloc(); } - apNew = (PgHdr1 **)sqlite3MallocZero(sizeof(PgHdr1 *)*nNew); - if( p->nHash ){ sqlite3EndBenignMalloc(); } + if( p->nHash ){ tdsqlite3BeginBenignMalloc(); } + apNew = (PgHdr1 **)tdsqlite3MallocZero(sizeof(PgHdr1 *)*nNew); + if( p->nHash ){ tdsqlite3EndBenignMalloc(); } pcache1EnterMutex(p->pGroup); if( apNew ){ for(i=0; inHash; i++){ @@ -55152,7 +55152,7 @@ static void pcache1ResizeHash(PCache1 *p){ apNew[h] = pPage; } } - sqlite3_free(p->apHash); + tdsqlite3_free(p->apHash); p->apHash = apNew; p->nHash = nNew; } @@ -55170,7 +55170,7 @@ static PgHdr1 *pcache1PinPage(PgHdr1 *pPage){ assert( PAGE_IS_UNPINNED(pPage) ); assert( pPage->pLruNext ); assert( pPage->pLruPrev ); - assert( sqlite3_mutex_held(pPage->pCache->pGroup->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pCache->pGroup->mutex) ); pPage->pLruPrev->pLruNext = pPage->pLruNext; pPage->pLruNext->pLruPrev = pPage->pLruPrev; pPage->pLruNext = 0; @@ -55195,7 +55195,7 @@ static void pcache1RemoveFromHash(PgHdr1 *pPage, int freeFlag){ PCache1 *pCache = pPage->pCache; PgHdr1 **pp; - assert( sqlite3_mutex_held(pCache->pGroup->mutex) ); + assert( tdsqlite3_mutex_held(pCache->pGroup->mutex) ); h = pPage->iKey % pCache->nHash; for(pp=&pCache->apHash[h]; (*pp)!=pPage; pp=&(*pp)->pNext); *pp = (*pp)->pNext; @@ -55211,7 +55211,7 @@ static void pcache1RemoveFromHash(PgHdr1 *pPage, int freeFlag){ static void pcache1EnforceMaxPage(PCache1 *pCache){ PGroup *pGroup = pCache->pGroup; PgHdr1 *p; - assert( sqlite3_mutex_held(pGroup->mutex) ); + assert( tdsqlite3_mutex_held(pGroup->mutex) ); while( pGroup->nPurgeable>pGroup->nMaxPage && (p=pGroup->lru.pLruPrev)->isAnchor==0 ){ @@ -55221,7 +55221,7 @@ static void pcache1EnforceMaxPage(PCache1 *pCache){ pcache1RemoveFromHash(p, 1); } if( pCache->nPage==0 && pCache->pBulk ){ - sqlite3_free(pCache->pBulk); + tdsqlite3_free(pCache->pBulk); pCache->pBulk = pCache->pFree = 0; } } @@ -55239,7 +55239,7 @@ static void pcache1TruncateUnsafe( ){ TESTONLY( int nPage = 0; ) /* To assert pCache->nPage is correct */ unsigned int h, iStop; - assert( sqlite3_mutex_held(pCache->pGroup->mutex) ); + assert( tdsqlite3_mutex_held(pCache->pGroup->mutex) ); assert( pCache->iMaxKey >= iLimit ); assert( pCache->nHash > 0 ); if( pCache->iMaxKey - iLimit < pCache->nHash ){ @@ -55279,10 +55279,10 @@ static void pcache1TruncateUnsafe( } /******************************************************************************/ -/******** sqlite3_pcache Methods **********************************************/ +/******** tdsqlite3_pcache Methods **********************************************/ /* -** Implementation of the sqlite3_pcache.xInit method. +** Implementation of the tdsqlite3_pcache.xInit method. */ static int pcache1Init(void *NotUsed){ UNUSED_PARAMETER(NotUsed); @@ -55299,7 +55299,7 @@ static int pcache1Init(void *NotUsed){ ** ** * Use a unified cache in single-threaded applications that have ** configured a start-time buffer for use as page-cache memory using - ** sqlite3_config(SQLITE_CONFIG_PAGECACHE, pBuf, sz, N) with non-NULL + ** tdsqlite3_config(SQLITE_CONFIG_PAGECACHE, pBuf, sz, N) with non-NULL ** pBuf argument. ** ** * Otherwise use separate caches (mode-1) @@ -55307,23 +55307,23 @@ static int pcache1Init(void *NotUsed){ #if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) pcache1.separateCache = 0; #elif SQLITE_THREADSAFE - pcache1.separateCache = sqlite3GlobalConfig.pPage==0 - || sqlite3GlobalConfig.bCoreMutex>0; + pcache1.separateCache = tdsqlite3GlobalConfig.pPage==0 + || tdsqlite3GlobalConfig.bCoreMutex>0; #else - pcache1.separateCache = sqlite3GlobalConfig.pPage==0; + pcache1.separateCache = tdsqlite3GlobalConfig.pPage==0; #endif #if SQLITE_THREADSAFE - if( sqlite3GlobalConfig.bCoreMutex ){ - pcache1.grp.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU); - pcache1.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PMEM); + if( tdsqlite3GlobalConfig.bCoreMutex ){ + pcache1.grp.mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU); + pcache1.mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PMEM); } #endif if( pcache1.separateCache - && sqlite3GlobalConfig.nPage!=0 - && sqlite3GlobalConfig.pPage==0 + && tdsqlite3GlobalConfig.nPage!=0 + && tdsqlite3GlobalConfig.pPage==0 ){ - pcache1.nInitPage = sqlite3GlobalConfig.nPage; + pcache1.nInitPage = tdsqlite3GlobalConfig.nPage; }else{ pcache1.nInitPage = 0; } @@ -55333,7 +55333,7 @@ static int pcache1Init(void *NotUsed){ } /* -** Implementation of the sqlite3_pcache.xShutdown method. +** Implementation of the tdsqlite3_pcache.xShutdown method. ** Note that the static mutex allocated in xInit does ** not need to be freed. */ @@ -55344,14 +55344,14 @@ static void pcache1Shutdown(void *NotUsed){ } /* forward declaration */ -static void pcache1Destroy(sqlite3_pcache *p); +static void pcache1Destroy(tdsqlite3_pcache *p); /* -** Implementation of the sqlite3_pcache.xCreate method. +** Implementation of the tdsqlite3_pcache.xCreate method. ** ** Allocate a new cache. */ -static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){ +static tdsqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){ PCache1 *pCache; /* The newly created page cache */ PGroup *pGroup; /* The group the new page cache will belong to */ int sz; /* Bytes of memory required to allocate the new cache */ @@ -55360,7 +55360,7 @@ static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){ assert( szExtra < 300 ); sz = sizeof(PCache1) + sizeof(PGroup)*pcache1.separateCache; - pCache = (PCache1 *)sqlite3MallocZero(sz); + pCache = (PCache1 *)tdsqlite3MallocZero(sz); if( pCache ){ if( pcache1.separateCache ){ pGroup = (PGroup*)&pCache[1]; @@ -55389,19 +55389,19 @@ static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){ } pcache1LeaveMutex(pGroup); if( pCache->nHash==0 ){ - pcache1Destroy((sqlite3_pcache*)pCache); + pcache1Destroy((tdsqlite3_pcache*)pCache); pCache = 0; } } - return (sqlite3_pcache *)pCache; + return (tdsqlite3_pcache *)pCache; } /* -** Implementation of the sqlite3_pcache.xCachesize method. +** Implementation of the tdsqlite3_pcache.xCachesize method. ** ** Configure the cache_size limit for a cache. */ -static void pcache1Cachesize(sqlite3_pcache *p, int nMax){ +static void pcache1Cachesize(tdsqlite3_pcache *p, int nMax){ PCache1 *pCache = (PCache1 *)p; if( pCache->bPurgeable ){ PGroup *pGroup = pCache->pGroup; @@ -55416,11 +55416,11 @@ static void pcache1Cachesize(sqlite3_pcache *p, int nMax){ } /* -** Implementation of the sqlite3_pcache.xShrink method. +** Implementation of the tdsqlite3_pcache.xShrink method. ** ** Free up as much memory as possible. */ -static void pcache1Shrink(sqlite3_pcache *p){ +static void pcache1Shrink(tdsqlite3_pcache *p){ PCache1 *pCache = (PCache1*)p; if( pCache->bPurgeable ){ PGroup *pGroup = pCache->pGroup; @@ -55435,9 +55435,9 @@ static void pcache1Shrink(sqlite3_pcache *p){ } /* -** Implementation of the sqlite3_pcache.xPagecount method. +** Implementation of the tdsqlite3_pcache.xPagecount method. */ -static int pcache1Pagecount(sqlite3_pcache *p){ +static int pcache1Pagecount(tdsqlite3_pcache *p){ int n; PCache1 *pCache = (PCache1*)p; pcache1EnterMutex(pCache->pGroup); @@ -55525,7 +55525,7 @@ static SQLITE_NOINLINE PgHdr1 *pcache1FetchStage2( } /* -** Implementation of the sqlite3_pcache.xFetch method. +** Implementation of the tdsqlite3_pcache.xFetch method. ** ** Fetch a page by key value. ** @@ -55584,7 +55584,7 @@ static SQLITE_NOINLINE PgHdr1 *pcache1FetchStage2( ** invokes the appropriate routine. */ static PgHdr1 *pcache1FetchNoMutex( - sqlite3_pcache *p, + tdsqlite3_pcache *p, unsigned int iKey, int createFlag ){ @@ -55614,7 +55614,7 @@ static PgHdr1 *pcache1FetchNoMutex( } #if PCACHE1_MIGHT_USE_GROUP_MUTEX static PgHdr1 *pcache1FetchWithMutex( - sqlite3_pcache *p, + tdsqlite3_pcache *p, unsigned int iKey, int createFlag ){ @@ -55628,8 +55628,8 @@ static PgHdr1 *pcache1FetchWithMutex( return pPage; } #endif -static sqlite3_pcache_page *pcache1Fetch( - sqlite3_pcache *p, +static tdsqlite3_pcache_page *pcache1Fetch( + tdsqlite3_pcache *p, unsigned int iKey, int createFlag ){ @@ -55645,23 +55645,23 @@ static sqlite3_pcache_page *pcache1Fetch( assert( pCache->nHash>0 ); #if PCACHE1_MIGHT_USE_GROUP_MUTEX if( pCache->pGroup->mutex ){ - return (sqlite3_pcache_page*)pcache1FetchWithMutex(p, iKey, createFlag); + return (tdsqlite3_pcache_page*)pcache1FetchWithMutex(p, iKey, createFlag); }else #endif { - return (sqlite3_pcache_page*)pcache1FetchNoMutex(p, iKey, createFlag); + return (tdsqlite3_pcache_page*)pcache1FetchNoMutex(p, iKey, createFlag); } } /* -** Implementation of the sqlite3_pcache.xUnpin method. +** Implementation of the tdsqlite3_pcache.xUnpin method. ** ** Mark a page as unpinned (eligible for asynchronous recycling). */ static void pcache1Unpin( - sqlite3_pcache *p, - sqlite3_pcache_page *pPg, + tdsqlite3_pcache *p, + tdsqlite3_pcache_page *pPg, int reuseUnlikely ){ PCache1 *pCache = (PCache1 *)p; @@ -55692,11 +55692,11 @@ static void pcache1Unpin( } /* -** Implementation of the sqlite3_pcache.xRekey method. +** Implementation of the tdsqlite3_pcache.xRekey method. */ static void pcache1Rekey( - sqlite3_pcache *p, - sqlite3_pcache_page *pPg, + tdsqlite3_pcache *p, + tdsqlite3_pcache_page *pPg, unsigned int iOld, unsigned int iNew ){ @@ -55728,13 +55728,13 @@ static void pcache1Rekey( } /* -** Implementation of the sqlite3_pcache.xTruncate method. +** Implementation of the tdsqlite3_pcache.xTruncate method. ** ** Discard all unpinned pages in the cache with a page number equal to ** or greater than parameter iLimit. Any pinned pages with a page number ** equal to or greater than iLimit are implicitly unpinned. */ -static void pcache1Truncate(sqlite3_pcache *p, unsigned int iLimit){ +static void pcache1Truncate(tdsqlite3_pcache *p, unsigned int iLimit){ PCache1 *pCache = (PCache1 *)p; pcache1EnterMutex(pCache->pGroup); if( iLimit<=pCache->iMaxKey ){ @@ -55745,11 +55745,11 @@ static void pcache1Truncate(sqlite3_pcache *p, unsigned int iLimit){ } /* -** Implementation of the sqlite3_pcache.xDestroy method. +** Implementation of the tdsqlite3_pcache.xDestroy method. ** ** Destroy a cache allocated using pcache1Create(). */ -static void pcache1Destroy(sqlite3_pcache *p){ +static void pcache1Destroy(tdsqlite3_pcache *p){ PCache1 *pCache = (PCache1 *)p; PGroup *pGroup = pCache->pGroup; assert( pCache->bPurgeable || (pCache->nMax==0 && pCache->nMin==0) ); @@ -55762,18 +55762,18 @@ static void pcache1Destroy(sqlite3_pcache *p){ pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage; pcache1EnforceMaxPage(pCache); pcache1LeaveMutex(pGroup); - sqlite3_free(pCache->pBulk); - sqlite3_free(pCache->apHash); - sqlite3_free(pCache); + tdsqlite3_free(pCache->pBulk); + tdsqlite3_free(pCache->apHash); + tdsqlite3_free(pCache); } /* -** This function is called during initialization (sqlite3_initialize()) to +** This function is called during initialization (tdsqlite3_initialize()) to ** install the default pluggable cache module, assuming the user has not ** already provided an alternative. */ -SQLITE_PRIVATE void sqlite3PCacheSetDefault(void){ - static const sqlite3_pcache_methods2 defaultMethods = { +SQLITE_PRIVATE void tdsqlite3PCacheSetDefault(void){ + static const tdsqlite3_pcache_methods2 defaultMethods = { 1, /* iVersion */ 0, /* pArg */ pcache1Init, /* xInit */ @@ -55788,19 +55788,19 @@ SQLITE_PRIVATE void sqlite3PCacheSetDefault(void){ pcache1Destroy, /* xDestroy */ pcache1Shrink /* xShrink */ }; - sqlite3_config(SQLITE_CONFIG_PCACHE2, &defaultMethods); + tdsqlite3_config(SQLITE_CONFIG_PCACHE2, &defaultMethods); } /* ** Return the size of the header on each page of this PCACHE implementation. */ -SQLITE_PRIVATE int sqlite3HeaderSizePcache1(void){ return ROUND8(sizeof(PgHdr1)); } +SQLITE_PRIVATE int tdsqlite3HeaderSizePcache1(void){ return ROUND8(sizeof(PgHdr1)); } /* ** Return the global mutex used by this PCACHE implementation. The -** sqlite3_status() routine needs access to this mutex. +** tdsqlite3_status() routine needs access to this mutex. */ -SQLITE_PRIVATE sqlite3_mutex *sqlite3Pcache1Mutex(void){ +SQLITE_PRIVATE tdsqlite3_mutex *tdsqlite3Pcache1Mutex(void){ return pcache1.mutex; } @@ -55808,17 +55808,17 @@ SQLITE_PRIVATE sqlite3_mutex *sqlite3Pcache1Mutex(void){ /* ** This function is called to free superfluous dynamically allocated memory ** held by the pager system. Memory in use by any SQLite pager allocated -** by the current thread may be sqlite3_free()ed. +** by the current thread may be tdsqlite3_free()ed. ** ** nReq is the number of bytes of memory required. Once this much has ** been released, the function returns. The return value is the total number ** of bytes of memory released. */ -SQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int nReq){ +SQLITE_PRIVATE int tdsqlite3PcacheReleaseMemory(int nReq){ int nFree = 0; - assert( sqlite3_mutex_notheld(pcache1.grp.mutex) ); - assert( sqlite3_mutex_notheld(pcache1.mutex) ); - if( sqlite3GlobalConfig.pPage==0 ){ + assert( tdsqlite3_mutex_notheld(pcache1.grp.mutex) ); + assert( tdsqlite3_mutex_notheld(pcache1.mutex) ); + if( tdsqlite3GlobalConfig.pPage==0 ){ PgHdr1 *p; pcache1EnterMutex(&pcache1.grp); while( (nReq<0 || nFreepage.pBuf); #ifdef SQLITE_PCACHE_SEPARATE_HEADER - nFree += sqlite3MemSize(p); + nFree += tdsqlite3MemSize(p); #endif assert( PAGE_IS_UNPINNED(p) ); pcache1PinPage(p); @@ -55844,7 +55844,7 @@ SQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int nReq){ ** This function is used by test procedures to inspect the internal state ** of the global cache. */ -SQLITE_PRIVATE void sqlite3PcacheStats( +SQLITE_PRIVATE void tdsqlite3PcacheStats( int *pnCurrent, /* OUT: Total number of pages cached */ int *pnMax, /* OUT: Global maximum cache size */ int *pnMin, /* OUT: Sum of PCache1.nMin for purgeable caches */ @@ -55974,7 +55974,7 @@ struct RowSetChunk { */ struct RowSet { struct RowSetChunk *pChunk; /* List of all chunk allocations */ - sqlite3 *db; /* The database connection */ + tdsqlite3 *db; /* The database connection */ struct RowSetEntry *pEntry; /* List of entries using pRight */ struct RowSetEntry *pLast; /* Last entry on the pEntry list */ struct RowSetEntry *pFresh; /* Source of new entry objects */ @@ -55988,16 +55988,16 @@ struct RowSet { ** Allowed values for RowSet.rsFlags */ #define ROWSET_SORTED 0x01 /* True if RowSet.pEntry is sorted */ -#define ROWSET_NEXT 0x02 /* True if sqlite3RowSetNext() has been called */ +#define ROWSET_NEXT 0x02 /* True if tdsqlite3RowSetNext() has been called */ /* ** Allocate a RowSet object. Return NULL if a memory allocation ** error occurs. */ -SQLITE_PRIVATE RowSet *sqlite3RowSetInit(sqlite3 *db){ - RowSet *p = sqlite3DbMallocRawNN(db, sizeof(*p)); +SQLITE_PRIVATE RowSet *tdsqlite3RowSetInit(tdsqlite3 *db){ + RowSet *p = tdsqlite3DbMallocRawNN(db, sizeof(*p)); if( p ){ - int N = sqlite3DbMallocSize(db, p); + int N = tdsqlite3DbMallocSize(db, p); p->pChunk = 0; p->db = db; p->pEntry = 0; @@ -56016,12 +56016,12 @@ SQLITE_PRIVATE RowSet *sqlite3RowSetInit(sqlite3 *db){ ** the RowSet has allocated over its lifetime. This routine is ** the destructor for the RowSet. */ -SQLITE_PRIVATE void sqlite3RowSetClear(void *pArg){ +SQLITE_PRIVATE void tdsqlite3RowSetClear(void *pArg){ RowSet *p = (RowSet*)pArg; struct RowSetChunk *pChunk, *pNextChunk; for(pChunk=p->pChunk; pChunk; pChunk = pNextChunk){ pNextChunk = pChunk->pNextChunk; - sqlite3DbFree(p->db, pChunk); + tdsqlite3DbFree(p->db, pChunk); } p->pChunk = 0; p->nFresh = 0; @@ -56036,9 +56036,9 @@ SQLITE_PRIVATE void sqlite3RowSetClear(void *pArg){ ** the RowSet has allocated over its lifetime. This routine is ** the destructor for the RowSet. */ -SQLITE_PRIVATE void sqlite3RowSetDelete(void *pArg){ - sqlite3RowSetClear(pArg); - sqlite3DbFree(((RowSet*)pArg)->db, pArg); +SQLITE_PRIVATE void tdsqlite3RowSetDelete(void *pArg){ + tdsqlite3RowSetClear(pArg); + tdsqlite3DbFree(((RowSet*)pArg)->db, pArg); } /* @@ -56055,7 +56055,7 @@ static struct RowSetEntry *rowSetEntryAlloc(RowSet *p){ /* We could allocate a fresh RowSetEntry each time one is needed, but it ** is more efficient to pull a preallocated entry from the pool */ struct RowSetChunk *pNew; - pNew = sqlite3DbMallocRawNN(p->db, sizeof(*pNew)); + pNew = tdsqlite3DbMallocRawNN(p->db, sizeof(*pNew)); if( pNew==0 ){ return 0; } @@ -56074,11 +56074,11 @@ static struct RowSetEntry *rowSetEntryAlloc(RowSet *p){ ** The mallocFailed flag of the database connection is set if a ** memory allocation fails. */ -SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet *p, i64 rowid){ +SQLITE_PRIVATE void tdsqlite3RowSetInsert(RowSet *p, i64 rowid){ struct RowSetEntry *pEntry; /* The new entry */ struct RowSetEntry *pLast; /* The last prior entry */ - /* This routine is never called after sqlite3RowSetNext() */ + /* This routine is never called after tdsqlite3RowSetNext() */ assert( p!=0 && (p->rsFlags & ROWSET_NEXT)==0 ); pEntry = rowSetEntryAlloc(p); @@ -56264,17 +56264,17 @@ static struct RowSetEntry *rowSetListToTree(struct RowSetEntry *pList){ ** Write the element into *pRowid. Return 1 on success. Return ** 0 if the RowSet is already empty. ** -** After this routine has been called, the sqlite3RowSetInsert() +** After this routine has been called, the tdsqlite3RowSetInsert() ** routine may not be called again. ** -** This routine may not be called after sqlite3RowSetTest() has +** This routine may not be called after tdsqlite3RowSetTest() has ** been used. Older versions of RowSet allowed that, but as the ** capability was not used by the code generator, it was removed ** for code economy. */ -SQLITE_PRIVATE int sqlite3RowSetNext(RowSet *p, i64 *pRowid){ +SQLITE_PRIVATE int tdsqlite3RowSetNext(RowSet *p, i64 *pRowid){ assert( p!=0 ); - assert( p->pForest==0 ); /* Cannot be used with sqlite3RowSetText() */ + assert( p->pForest==0 ); /* Cannot be used with tdsqlite3RowSetText() */ /* Merge the forest into a single sorted list on first call */ if( (p->rsFlags & ROWSET_NEXT)==0 ){ /*OPTIMIZATION-IF-FALSE*/ @@ -56289,8 +56289,8 @@ SQLITE_PRIVATE int sqlite3RowSetNext(RowSet *p, i64 *pRowid){ *pRowid = p->pEntry->v; p->pEntry = p->pEntry->pRight; if( p->pEntry==0 ){ /*OPTIMIZATION-IF-TRUE*/ - /* Free memory immediately, rather than waiting on sqlite3_finalize() */ - sqlite3RowSetClear(p); + /* Free memory immediately, rather than waiting on tdsqlite3_finalize() */ + tdsqlite3RowSetClear(p); } return 1; }else{ @@ -56306,10 +56306,10 @@ SQLITE_PRIVATE int sqlite3RowSetNext(RowSet *p, i64 *pRowid){ ** on pRowSet->pEntry, then sort those entries into the forest at ** pRowSet->pForest so that they can be tested. */ -SQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, int iBatch, sqlite3_int64 iRowid){ +SQLITE_PRIVATE int tdsqlite3RowSetTest(RowSet *pRowSet, int iBatch, tdsqlite3_int64 iRowid){ struct RowSetEntry *p, *pTree; - /* This routine is never called after sqlite3RowSetNext() */ + /* This routine is never called after tdsqlite3RowSetNext() */ assert( pRowSet!=0 && (pRowSet->rsFlags & ROWSET_NEXT)==0 ); /* Sort entries into the forest on the first test of a new batch. @@ -56422,25 +56422,25 @@ SQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, int iBatch, sqlite3_int64 #define CKPT_SYNC_FLAGS(X) (((X)>>2)&0x03) #ifdef SQLITE_OMIT_WAL -# define sqlite3WalOpen(x,y,z) 0 -# define sqlite3WalLimit(x,y) -# define sqlite3WalClose(v,w,x,y,z) 0 -# define sqlite3WalBeginReadTransaction(y,z) 0 -# define sqlite3WalEndReadTransaction(z) -# define sqlite3WalDbsize(y) 0 -# define sqlite3WalBeginWriteTransaction(y) 0 -# define sqlite3WalEndWriteTransaction(x) 0 -# define sqlite3WalUndo(x,y,z) 0 -# define sqlite3WalSavepoint(y,z) -# define sqlite3WalSavepointUndo(y,z) 0 -# define sqlite3WalFrames(u,v,w,x,y,z) 0 -# define sqlite3WalCheckpoint(q,r,s,t,u,v,w,x,y,z) 0 -# define sqlite3WalCallback(z) 0 -# define sqlite3WalExclusiveMode(y,z) 0 -# define sqlite3WalHeapMemory(z) 0 -# define sqlite3WalFramesize(z) 0 -# define sqlite3WalFindFrame(x,y,z) 0 -# define sqlite3WalFile(x) 0 +# define tdsqlite3WalOpen(x,y,z) 0 +# define tdsqlite3WalLimit(x,y) +# define tdsqlite3WalClose(v,w,x,y,z) 0 +# define tdsqlite3WalBeginReadTransaction(y,z) 0 +# define tdsqlite3WalEndReadTransaction(z) +# define tdsqlite3WalDbsize(y) 0 +# define tdsqlite3WalBeginWriteTransaction(y) 0 +# define tdsqlite3WalEndWriteTransaction(x) 0 +# define tdsqlite3WalUndo(x,y,z) 0 +# define tdsqlite3WalSavepoint(y,z) +# define tdsqlite3WalSavepointUndo(y,z) 0 +# define tdsqlite3WalFrames(u,v,w,x,y,z) 0 +# define tdsqlite3WalCheckpoint(q,r,s,t,u,v,w,x,y,z) 0 +# define tdsqlite3WalCallback(z) 0 +# define tdsqlite3WalExclusiveMode(y,z) 0 +# define tdsqlite3WalHeapMemory(z) 0 +# define tdsqlite3WalFramesize(z) 0 +# define tdsqlite3WalFindFrame(x,y,z) 0 +# define tdsqlite3WalFile(x) 0 #else #define WAL_SAVEPOINT_NDATA 4 @@ -56451,51 +56451,51 @@ SQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, int iBatch, sqlite3_int64 typedef struct Wal Wal; /* Open and close a connection to a write-ahead log. */ -SQLITE_PRIVATE int sqlite3WalOpen(sqlite3_vfs*, sqlite3_file*, const char *, int, i64, Wal**); -SQLITE_PRIVATE int sqlite3WalClose(Wal *pWal, sqlite3*, int sync_flags, int, u8 *); +SQLITE_PRIVATE int tdsqlite3WalOpen(tdsqlite3_vfs*, tdsqlite3_file*, const char *, int, i64, Wal**); +SQLITE_PRIVATE int tdsqlite3WalClose(Wal *pWal, tdsqlite3*, int sync_flags, int, u8 *); /* Set the limiting size of a WAL file. */ -SQLITE_PRIVATE void sqlite3WalLimit(Wal*, i64); +SQLITE_PRIVATE void tdsqlite3WalLimit(Wal*, i64); /* Used by readers to open (lock) and close (unlock) a snapshot. A ** snapshot is like a read-transaction. It is the state of the database -** at an instant in time. sqlite3WalOpenSnapshot gets a read lock and +** at an instant in time. tdsqlite3WalOpenSnapshot gets a read lock and ** preserves the current state even if the other threads or processes -** write to or checkpoint the WAL. sqlite3WalCloseSnapshot() closes the +** write to or checkpoint the WAL. tdsqlite3WalCloseSnapshot() closes the ** transaction and releases the lock. */ -SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *); -SQLITE_PRIVATE void sqlite3WalEndReadTransaction(Wal *pWal); +SQLITE_PRIVATE int tdsqlite3WalBeginReadTransaction(Wal *pWal, int *); +SQLITE_PRIVATE void tdsqlite3WalEndReadTransaction(Wal *pWal); /* Read a page from the write-ahead log, if it is present. */ -SQLITE_PRIVATE int sqlite3WalFindFrame(Wal *, Pgno, u32 *); -SQLITE_PRIVATE int sqlite3WalReadFrame(Wal *, u32, int, u8 *); +SQLITE_PRIVATE int tdsqlite3WalFindFrame(Wal *, Pgno, u32 *); +SQLITE_PRIVATE int tdsqlite3WalReadFrame(Wal *, u32, int, u8 *); /* If the WAL is not empty, return the size of the database. */ -SQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal); +SQLITE_PRIVATE Pgno tdsqlite3WalDbsize(Wal *pWal); /* Obtain or release the WRITER lock. */ -SQLITE_PRIVATE int sqlite3WalBeginWriteTransaction(Wal *pWal); -SQLITE_PRIVATE int sqlite3WalEndWriteTransaction(Wal *pWal); +SQLITE_PRIVATE int tdsqlite3WalBeginWriteTransaction(Wal *pWal); +SQLITE_PRIVATE int tdsqlite3WalEndWriteTransaction(Wal *pWal); /* Undo any frames written (but not committed) to the log */ -SQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx); +SQLITE_PRIVATE int tdsqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx); /* Return an integer that records the current (uncommitted) write ** position in the WAL */ -SQLITE_PRIVATE void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData); +SQLITE_PRIVATE void tdsqlite3WalSavepoint(Wal *pWal, u32 *aWalData); /* Move the write position of the WAL back to iFrame. Called in ** response to a ROLLBACK TO command. */ -SQLITE_PRIVATE int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData); +SQLITE_PRIVATE int tdsqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData); /* Write a frame or frames to the log. */ -SQLITE_PRIVATE int sqlite3WalFrames(Wal *pWal, int, PgHdr *, Pgno, int, int); +SQLITE_PRIVATE int tdsqlite3WalFrames(Wal *pWal, int, PgHdr *, Pgno, int, int); /* Copy pages from the log to the database file */ -SQLITE_PRIVATE int sqlite3WalCheckpoint( +SQLITE_PRIVATE int tdsqlite3WalCheckpoint( Wal *pWal, /* Write-ahead log connection */ - sqlite3 *db, /* Check this handle's interrupt flag */ + tdsqlite3 *db, /* Check this handle's interrupt flag */ int eMode, /* One of PASSIVE, FULL and RESTART */ int (*xBusy)(void*), /* Function to call when busy */ void *pBusyArg, /* Context argument for xBusyHandler */ @@ -56506,41 +56506,41 @@ SQLITE_PRIVATE int sqlite3WalCheckpoint( int *pnCkpt /* OUT: Number of backfilled frames in WAL */ ); -/* Return the value to pass to a sqlite3_wal_hook callback, the +/* Return the value to pass to a tdsqlite3_wal_hook callback, the ** number of frames in the WAL at the point of the last commit since -** sqlite3WalCallback() was called. If no commits have occurred since +** tdsqlite3WalCallback() was called. If no commits have occurred since ** the last call, then return 0. */ -SQLITE_PRIVATE int sqlite3WalCallback(Wal *pWal); +SQLITE_PRIVATE int tdsqlite3WalCallback(Wal *pWal); /* Tell the wal layer that an EXCLUSIVE lock has been obtained (or released) ** by the pager layer on the database file. */ -SQLITE_PRIVATE int sqlite3WalExclusiveMode(Wal *pWal, int op); +SQLITE_PRIVATE int tdsqlite3WalExclusiveMode(Wal *pWal, int op); /* Return true if the argument is non-NULL and the WAL module is using ** heap-memory for the wal-index. Otherwise, if the argument is NULL or the ** WAL module is using shared-memory, return false. */ -SQLITE_PRIVATE int sqlite3WalHeapMemory(Wal *pWal); +SQLITE_PRIVATE int tdsqlite3WalHeapMemory(Wal *pWal); #ifdef SQLITE_ENABLE_SNAPSHOT -SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot); -SQLITE_PRIVATE void sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *pSnapshot); -SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal); -SQLITE_PRIVATE int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot); -SQLITE_PRIVATE void sqlite3WalSnapshotUnlock(Wal *pWal); +SQLITE_PRIVATE int tdsqlite3WalSnapshotGet(Wal *pWal, tdsqlite3_snapshot **ppSnapshot); +SQLITE_PRIVATE void tdsqlite3WalSnapshotOpen(Wal *pWal, tdsqlite3_snapshot *pSnapshot); +SQLITE_PRIVATE int tdsqlite3WalSnapshotRecover(Wal *pWal); +SQLITE_PRIVATE int tdsqlite3WalSnapshotCheck(Wal *pWal, tdsqlite3_snapshot *pSnapshot); +SQLITE_PRIVATE void tdsqlite3WalSnapshotUnlock(Wal *pWal); #endif #ifdef SQLITE_ENABLE_ZIPVFS /* If the WAL file is not empty, return the number of bytes of content ** stored in each frame (i.e. the db page-size when the WAL was created). */ -SQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal); +SQLITE_PRIVATE int tdsqlite3WalFramesize(Wal *pWal); #endif -/* Return the sqlite3_file object for the WAL file */ -SQLITE_PRIVATE sqlite3_file *sqlite3WalFile(Wal *pWal); +/* Return the tdsqlite3_file object for the WAL file */ +SQLITE_PRIVATE tdsqlite3_file *tdsqlite3WalFile(Wal *pWal); #endif /* ifndef SQLITE_OMIT_WAL */ #endif /* SQLITE_WAL_H */ @@ -56639,9 +56639,9 @@ SQLITE_PRIVATE sqlite3_file *sqlite3WalFile(Wal *pWal); ** Macros for troubleshooting. Normally turned off */ #if 0 -int sqlite3PagerTrace=1; /* True to enable tracing */ -#define sqlite3DebugPrintf printf -#define PAGERTRACE(X) if( sqlite3PagerTrace ){ sqlite3DebugPrintf X; } +int tdsqlite3PagerTrace=1; /* True to enable tracing */ +#define tdsqlite3DebugPrintf printf +#define PAGERTRACE(X) if( tdsqlite3PagerTrace ){ tdsqlite3DebugPrintf X; } #else #define PAGERTRACE(X) #endif @@ -56651,7 +56651,7 @@ int sqlite3PagerTrace=1; /* True to enable tracing */ ** to print out file-descriptors. ** ** PAGERID() takes a pointer to a Pager struct as its argument. The -** associated file-descriptor is returned. FILEHANDLEID() takes an sqlite3_file +** associated file-descriptor is returned. FILEHANDLEID() takes an tdsqlite3_file ** struct as its argument. */ #define PAGERID(p) (SQLITE_PTR_TO_INT(p->fd)) @@ -56682,13 +56682,13 @@ int sqlite3PagerTrace=1; /* True to enable tracing */ ** ** List of state transitions and the C [function] that performs each: ** -** OPEN -> READER [sqlite3PagerSharedLock] +** OPEN -> READER [tdsqlite3PagerSharedLock] ** READER -> OPEN [pager_unlock] ** -** READER -> WRITER_LOCKED [sqlite3PagerBegin] +** READER -> WRITER_LOCKED [tdsqlite3PagerBegin] ** WRITER_LOCKED -> WRITER_CACHEMOD [pager_open_journal] ** WRITER_CACHEMOD -> WRITER_DBMOD [syncJournal] -** WRITER_DBMOD -> WRITER_FINISHED [sqlite3PagerCommitPhaseOne] +** WRITER_DBMOD -> WRITER_FINISHED [tdsqlite3PagerCommitPhaseOne] ** WRITER_*** -> READER [pager_end_transaction] ** ** WRITER_*** -> ERROR [pager_error] @@ -56751,7 +56751,7 @@ int sqlite3PagerTrace=1; /* True to enable tracing */ ** * If the connection is open in rollback-mode, a RESERVED or greater ** lock is held on the database file. ** * If the connection is open in WAL-mode, a WAL write transaction -** is open (i.e. sqlite3WalBeginWriteTransaction() has been successfully +** is open (i.e. tdsqlite3WalBeginWriteTransaction() has been successfully ** called). ** * The dbSize, dbOrigSize and dbFileSize variables are all valid. ** * The contents of the pager cache have not been modified. @@ -56835,10 +56835,10 @@ int sqlite3PagerTrace=1; /* True to enable tracing */ ** Specifically, the pager jumps into the ERROR state if: ** ** 1. An error occurs while attempting a rollback. This happens in -** function sqlite3PagerRollback(). +** function tdsqlite3PagerRollback(). ** ** 2. An error occurs while attempting to finalize a journal file -** following a commit in function sqlite3PagerCommitPhaseTwo(). +** following a commit in function tdsqlite3PagerCommitPhaseTwo(). ** ** 3. An error occurs while attempting to write to the journal or ** database file in function pagerStress() in order to free up @@ -56959,7 +56959,7 @@ int sqlite3PagerTrace=1; /* True to enable tracing */ ** An instance of the following structure is allocated for each active ** savepoint and statement transaction in the system. All such structures ** are stored in the Pager.aSavepoint[] array, which is allocated and -** resized using sqlite3Realloc(). +** resized using tdsqlite3Realloc(). ** ** When a savepoint is created, the PagerSavepoint.iHdrOffset field is ** set to 0. If a journal-header is written into the main journal while @@ -57069,7 +57069,7 @@ struct PagerSavepoint { ** ** If the SPILLFLAG_NOSYNC bit is set, writing to the database from ** pagerStress() is permitted, but syncing the journal file is not. -** This flag is set by sqlite3PagerWrite() when the file-system sector-size +** This flag is set by tdsqlite3PagerWrite() when the file-system sector-size ** is larger than the database page-size in order to prevent a journal sync ** from happening in between the journalling of two pages on the same sector. ** @@ -57156,7 +57156,7 @@ struct PagerSavepoint { ** meaning that the 0x04 and 0x08 bits are both zero. */ struct Pager { - sqlite3_vfs *pVfs; /* OS functions to use for IO */ + tdsqlite3_vfs *pVfs; /* OS functions to use for IO */ u8 exclusiveMode; /* Boolean. True if locking_mode==EXCLUSIVE */ u8 journalMode; /* One of the PAGER_JOURNALMODE_* values */ u8 useJournal; /* Use a rollback journal on this file */ @@ -57196,19 +57196,19 @@ struct Pager { u32 cksumInit; /* Quasi-random value added to every checksum */ u32 nSubRec; /* Number of records written to sub-journal */ Bitvec *pInJournal; /* One bit for each page in the database file */ - sqlite3_file *fd; /* File descriptor for database */ - sqlite3_file *jfd; /* File descriptor for main journal */ - sqlite3_file *sjfd; /* File descriptor for sub-journal */ + tdsqlite3_file *fd; /* File descriptor for database */ + tdsqlite3_file *jfd; /* File descriptor for main journal */ + tdsqlite3_file *sjfd; /* File descriptor for sub-journal */ i64 journalOff; /* Current write offset in the journal file */ i64 journalHdr; /* Byte offset to previous journal header */ - sqlite3_backup *pBackup; /* Pointer to list of ongoing backup processes */ + tdsqlite3_backup *pBackup; /* Pointer to list of ongoing backup processes */ PagerSavepoint *aSavepoint; /* Array of active savepoints */ int nSavepoint; /* Number of elements in aSavepoint[] */ u32 iDataVersion; /* Changes whenever database content changes */ char dbFileVers[16]; /* Changes whenever database file changes */ int nMmapOut; /* Number of mmap pages currently outstanding */ - sqlite3_int64 szMmap; /* Desired maximum mmap size */ + tdsqlite3_int64 szMmap; /* Desired maximum mmap size */ PgHdr *pMmapFreelist; /* List of free mmap page headers (pDirty) */ /* ** End of the routinely-changing class members @@ -57216,7 +57216,7 @@ struct Pager { u16 nExtra; /* Add this many bytes to each in-memory page */ i16 nReserve; /* Number of unused bytes at end of each page */ - u32 vfsFlags; /* Flags for sqlite3_vfs.xOpen() */ + u32 vfsFlags; /* Flags for tdsqlite3_vfs.xOpen() */ u32 sectorSize; /* Assumed sector size during rollback */ int pageSize; /* Number of bytes in a page */ Pgno mxPgno; /* Maximum allowed size of the database */ @@ -57248,7 +57248,7 @@ struct Pager { /* ** Indexes for use with Pager.aStat[]. The Pager.aStat[] array contains ** the values accessed by passing SQLITE_DBSTATUS_CACHE_HIT, CACHE_MISS -** or CACHE_WRITE to sqlite3_db_status(). +** or CACHE_WRITE to tdsqlite3_db_status(). */ #define PAGER_STAT_HIT 0 #define PAGER_STAT_MISS 1 @@ -57261,9 +57261,9 @@ struct Pager { ** a non-testing build. These variables are not thread-safe. */ #ifdef SQLITE_TEST -SQLITE_API int sqlite3_pager_readdb_count = 0; /* Number of full pages read from DB */ -SQLITE_API int sqlite3_pager_writedb_count = 0; /* Number of full pages written to DB */ -SQLITE_API int sqlite3_pager_writej_count = 0; /* Number of pages written to journal */ +SQLITE_API int tdsqlite3_pager_readdb_count = 0; /* Number of full pages read from DB */ +SQLITE_API int tdsqlite3_pager_writedb_count = 0; /* Number of full pages written to DB */ +SQLITE_API int tdsqlite3_pager_writej_count = 0; /* Number of pages written to journal */ # define PAGER_INCR(v) v++ #else # define PAGER_INCR(v) @@ -57338,7 +57338,7 @@ static const unsigned char aJournalMagic[] = { #define PAGER_MAX_PGNO 2147483647 /* -** The argument to this macro is a file descriptor (type sqlite3_file*). +** The argument to this macro is a file descriptor (type tdsqlite3_file*). ** Return 0 if it is not open, or non-zero (but not 1) if it is. ** ** This is so that expressions can be written as: @@ -57360,9 +57360,9 @@ static const unsigned char aJournalMagic[] = { ** * there are no dirty pages in the cache, and ** * the desired page is not currently in the wal file. */ -SQLITE_PRIVATE int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno){ +SQLITE_PRIVATE int tdsqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno){ if( pPager->fd->pMethods==0 ) return 0; - if( sqlite3PCacheIsDirty(pPager->pPCache) ) return 0; + if( tdsqlite3PCacheIsDirty(pPager->pPCache) ) return 0; #ifdef SQLITE_HAS_CODEC if( pPager->xCodec!=0 ) return 0; #endif @@ -57370,7 +57370,7 @@ SQLITE_PRIVATE int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno){ if( pPager->pWal ){ u32 iRead = 0; int rc; - rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iRead); + rc = tdsqlite3WalFindFrame(pPager->pWal, pgno, &iRead); return (rc==SQLITE_OK && iRead==0); } #endif @@ -57451,7 +57451,7 @@ static int assert_pager_state(Pager *p){ case PAGER_OPEN: assert( !MEMDB ); assert( pPager->errCode==SQLITE_OK ); - assert( sqlite3PcacheRefCount(pPager->pPCache)==0 || pPager->tempFile ); + assert( tdsqlite3PcacheRefCount(pPager->pPCache)==0 || pPager->tempFile ); break; case PAGER_READER: @@ -57499,7 +57499,7 @@ static int assert_pager_state(Pager *p){ assert( isOpen(p->jfd) || p->journalMode==PAGER_JOURNALMODE_OFF || p->journalMode==PAGER_JOURNALMODE_WAL - || (sqlite3OsDeviceCharacteristics(p->fd)&SQLITE_IOCAP_BATCH_ATOMIC) + || (tdsqlite3OsDeviceCharacteristics(p->fd)&SQLITE_IOCAP_BATCH_ATOMIC) ); assert( pPager->dbOrigSize<=pPager->dbHintSize ); break; @@ -57511,7 +57511,7 @@ static int assert_pager_state(Pager *p){ assert( isOpen(p->jfd) || p->journalMode==PAGER_JOURNALMODE_OFF || p->journalMode==PAGER_JOURNALMODE_WAL - || (sqlite3OsDeviceCharacteristics(p->fd)&SQLITE_IOCAP_BATCH_ATOMIC) + || (tdsqlite3OsDeviceCharacteristics(p->fd)&SQLITE_IOCAP_BATCH_ATOMIC) ); break; @@ -57521,7 +57521,7 @@ static int assert_pager_state(Pager *p){ ** back to OPEN state. */ assert( pPager->errCode!=SQLITE_OK ); - assert( sqlite3PcacheRefCount(pPager->pPCache)>0 || pPager->tempFile ); + assert( tdsqlite3PcacheRefCount(pPager->pPCache)>0 || pPager->tempFile ); break; } @@ -57545,7 +57545,7 @@ static int assert_pager_state(Pager *p){ char *print_pager_state(Pager *p){ static char zRet[1024]; - sqlite3_snprintf(1024, zRet, + tdsqlite3_snprintf(1024, zRet, "Filename: %s\n" "State: %s errCode=%d\n" "Lock: %s\n" @@ -57627,7 +57627,7 @@ static int subjRequiresPage(PgHdr *pPg){ int i; for(i=0; inSavepoint; i++){ p = &pPager->aSavepoint[i]; - if( p->nOrig>=pgno && 0==sqlite3BitvecTestNotNull(p->pInSavepoint, pgno) ){ + if( p->nOrig>=pgno && 0==tdsqlite3BitvecTestNotNull(p->pInSavepoint, pgno) ){ return 1; } } @@ -57639,7 +57639,7 @@ static int subjRequiresPage(PgHdr *pPg){ ** Return true if the page is already in the journal file. */ static int pageInJournal(Pager *pPager, PgHdr *pPg){ - return sqlite3BitvecTest(pPager->pInJournal, pPg->pgno); + return tdsqlite3BitvecTest(pPager->pInJournal, pPg->pgno); } #endif @@ -57650,11 +57650,11 @@ static int pageInJournal(Pager *pPager, PgHdr *pPg){ ** ** All values are stored on disk as big-endian. */ -static int read32bits(sqlite3_file *fd, i64 offset, u32 *pRes){ +static int read32bits(tdsqlite3_file *fd, i64 offset, u32 *pRes){ unsigned char ac[4]; - int rc = sqlite3OsRead(fd, ac, sizeof(ac), offset); + int rc = tdsqlite3OsRead(fd, ac, sizeof(ac), offset); if( rc==SQLITE_OK ){ - *pRes = sqlite3Get4byte(ac); + *pRes = tdsqlite3Get4byte(ac); } return rc; } @@ -57662,17 +57662,17 @@ static int read32bits(sqlite3_file *fd, i64 offset, u32 *pRes){ /* ** Write a 32-bit integer into a string buffer in big-endian byte order. */ -#define put32bits(A,B) sqlite3Put4byte((u8*)A,B) +#define put32bits(A,B) tdsqlite3Put4byte((u8*)A,B) /* ** Write a 32-bit integer into the given file descriptor. Return SQLITE_OK ** on success or an error code is something goes wrong. */ -static int write32bits(sqlite3_file *fd, i64 offset, u32 val){ +static int write32bits(tdsqlite3_file *fd, i64 offset, u32 val){ char ac[4]; put32bits(ac, val); - return sqlite3OsWrite(fd, ac, 4, offset); + return tdsqlite3OsWrite(fd, ac, 4, offset); } /* @@ -57692,7 +57692,7 @@ static int pagerUnlockDb(Pager *pPager, int eLock){ assert( eLock!=NO_LOCK || pagerUseWal(pPager)==0 ); if( isOpen(pPager->fd) ){ assert( pPager->eLock>=eLock ); - rc = pPager->noLock ? SQLITE_OK : sqlite3OsUnlock(pPager->fd, eLock); + rc = pPager->noLock ? SQLITE_OK : tdsqlite3OsUnlock(pPager->fd, eLock); if( pPager->eLock!=UNKNOWN_LOCK ){ pPager->eLock = (u8)eLock; } @@ -57717,7 +57717,7 @@ static int pagerLockDb(Pager *pPager, int eLock){ assert( eLock==SHARED_LOCK || eLock==RESERVED_LOCK || eLock==EXCLUSIVE_LOCK ); if( pPager->eLockeLock==UNKNOWN_LOCK ){ - rc = pPager->noLock ? SQLITE_OK : sqlite3OsLock(pPager->fd, eLock); + rc = pPager->noLock ? SQLITE_OK : tdsqlite3OsLock(pPager->fd, eLock); if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){ pPager->eLock = (u8)eLock; IOTRACE(("LOCK %p %d\n", pPager, eLock)) @@ -57753,7 +57753,7 @@ static int jrnlBufferSize(Pager *pPager){ int dc; /* Device characteristics */ assert( isOpen(pPager->fd) ); - dc = sqlite3OsDeviceCharacteristics(pPager->fd); + dc = tdsqlite3OsDeviceCharacteristics(pPager->fd); #else UNUSED_PARAMETER(pPager); #endif @@ -57833,7 +57833,7 @@ static void checkPage(PgHdr *pPg){ ** used to store a master journal file name at the end of a journal file. ** ** zMaster must point to a buffer of at least nMaster bytes allocated by -** the caller. This should be sqlite3_vfs.mxPathname+1 (to ensure there is +** the caller. This should be tdsqlite3_vfs.mxPathname+1 (to ensure there is ** enough space to write the master journal name). If the master journal ** name in the journal is longer than nMaster bytes (including a ** nul-terminator), then this is handled as if no master journal name @@ -57850,7 +57850,7 @@ static void checkPage(PgHdr *pPg){ ** If an error occurs while reading from the journal file, an SQLite ** error code is returned. */ -static int readMasterJournal(sqlite3_file *pJrnl, char *zMaster, u32 nMaster){ +static int readMasterJournal(tdsqlite3_file *pJrnl, char *zMaster, u32 nMaster){ int rc; /* Return code */ u32 len; /* Length in bytes of master journal name */ i64 szJ; /* Total size in bytes of journal file pJrnl */ @@ -57859,16 +57859,16 @@ static int readMasterJournal(sqlite3_file *pJrnl, char *zMaster, u32 nMaster){ unsigned char aMagic[8]; /* A buffer to hold the magic header */ zMaster[0] = '\0'; - if( SQLITE_OK!=(rc = sqlite3OsFileSize(pJrnl, &szJ)) + if( SQLITE_OK!=(rc = tdsqlite3OsFileSize(pJrnl, &szJ)) || szJ<16 || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len)) || len>=nMaster || len>szJ-16 || len==0 || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-12, &cksum)) - || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8)) + || SQLITE_OK!=(rc = tdsqlite3OsRead(pJrnl, aMagic, 8, szJ-8)) || memcmp(aMagic, aJournalMagic, 8) - || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, zMaster, len, szJ-16-len)) + || SQLITE_OK!=(rc = tdsqlite3OsRead(pJrnl, zMaster, len, szJ-16-len)) ){ return rc; } @@ -57942,19 +57942,19 @@ static i64 journalHdrOffset(Pager *pPager){ static int zeroJournalHdr(Pager *pPager, int doTruncate){ int rc = SQLITE_OK; /* Return code */ assert( isOpen(pPager->jfd) ); - assert( !sqlite3JournalIsInMemory(pPager->jfd) ); + assert( !tdsqlite3JournalIsInMemory(pPager->jfd) ); if( pPager->journalOff ){ const i64 iLimit = pPager->journalSizeLimit; /* Local cache of jsl */ IOTRACE(("JZEROHDR %p\n", pPager)) if( doTruncate || iLimit==0 ){ - rc = sqlite3OsTruncate(pPager->jfd, 0); + rc = tdsqlite3OsTruncate(pPager->jfd, 0); }else{ static const char zeroHdr[28] = {0}; - rc = sqlite3OsWrite(pPager->jfd, zeroHdr, sizeof(zeroHdr), 0); + rc = tdsqlite3OsWrite(pPager->jfd, zeroHdr, sizeof(zeroHdr), 0); } if( rc==SQLITE_OK && !pPager->noSync ){ - rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_DATAONLY|pPager->syncFlags); + rc = tdsqlite3OsSync(pPager->jfd, SQLITE_SYNC_DATAONLY|pPager->syncFlags); } /* At this point the transaction is committed but the write lock @@ -57965,9 +57965,9 @@ static int zeroJournalHdr(Pager *pPager, int doTruncate){ */ if( rc==SQLITE_OK && iLimit>0 ){ i64 sz; - rc = sqlite3OsFileSize(pPager->jfd, &sz); + rc = tdsqlite3OsFileSize(pPager->jfd, &sz); if( rc==SQLITE_OK && sz>iLimit ){ - rc = sqlite3OsTruncate(pPager->jfd, iLimit); + rc = tdsqlite3OsTruncate(pPager->jfd, iLimit); } } } @@ -58036,7 +58036,7 @@ static int writeJournalHdr(Pager *pPager){ */ assert( isOpen(pPager->fd) || pPager->noSync ); if( pPager->noSync || (pPager->journalMode==PAGER_JOURNALMODE_MEMORY) - || (sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_SAFE_APPEND) + || (tdsqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_SAFE_APPEND) ){ memcpy(zHeader, aJournalMagic, sizeof(aJournalMagic)); put32bits(&zHeader[sizeof(aJournalMagic)], 0xffffffff); @@ -58045,7 +58045,7 @@ static int writeJournalHdr(Pager *pPager){ } /* The random check-hash initializer */ - sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit); + tdsqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit); put32bits(&zHeader[sizeof(aJournalMagic)+4], pPager->cksumInit); /* The initial database size */ put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbOrigSize); @@ -58077,12 +58077,12 @@ static int writeJournalHdr(Pager *pPager){ ** ** The loop is required here in case the sector-size is larger than the ** database page size. Since the zHeader buffer is only Pager.pageSize - ** bytes in size, more than one call to sqlite3OsWrite() may be required + ** bytes in size, more than one call to tdsqlite3OsWrite() may be required ** to populate the entire journal header sector. */ for(nWrite=0; rc==SQLITE_OK&&nWritejournalHdr, nHeader)) - rc = sqlite3OsWrite(pPager->jfd, zHeader, nHeader, pPager->journalOff); + rc = tdsqlite3OsWrite(pPager->jfd, zHeader, nHeader, pPager->journalOff); assert( pPager->journalHdr <= pPager->journalOff ); pPager->journalOff += nHeader; } @@ -58136,7 +58136,7 @@ static int readJournalHdr( ** proceed. */ if( isHot || iHdrOff!=pPager->journalHdr ){ - rc = sqlite3OsRead(pPager->jfd, aMagic, sizeof(aMagic), iHdrOff); + rc = tdsqlite3OsRead(pPager->jfd, aMagic, sizeof(aMagic), iHdrOff); if( rc ){ return rc; } @@ -58196,7 +58196,7 @@ static int readJournalHdr( ** Use a testcase() macro to make sure that malloc failure within ** PagerSetPagesize() is tested. */ - rc = sqlite3PagerSetPagesize(pPager, &iPageSize, -1); + rc = tdsqlite3PagerSetPagesize(pPager, &iPageSize, -1); testcase( rc!=SQLITE_OK ); /* Update the assumed sector-size to match the value used by @@ -58269,10 +58269,10 @@ static int writeMasterJournal(Pager *pPager, const char *zMaster){ ** an error occurs, return the error code to the caller. */ if( (0 != (rc = write32bits(pPager->jfd, iHdrOff, PAGER_MJ_PGNO(pPager)))) - || (0 != (rc = sqlite3OsWrite(pPager->jfd, zMaster, nMaster, iHdrOff+4))) + || (0 != (rc = tdsqlite3OsWrite(pPager->jfd, zMaster, nMaster, iHdrOff+4))) || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nMaster, nMaster))) || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nMaster+4, cksum))) - || (0 != (rc = sqlite3OsWrite(pPager->jfd, aJournalMagic, 8, + || (0 != (rc = tdsqlite3OsWrite(pPager->jfd, aJournalMagic, 8, iHdrOff+4+nMaster+8))) ){ return rc; @@ -58289,10 +58289,10 @@ static int writeMasterJournal(Pager *pPager, const char *zMaster){ ** Easiest thing to do in this scenario is to truncate the journal ** file to the required size. */ - if( SQLITE_OK==(rc = sqlite3OsFileSize(pPager->jfd, &jrnlSize)) + if( SQLITE_OK==(rc = tdsqlite3OsFileSize(pPager->jfd, &jrnlSize)) && jrnlSize>pPager->journalOff ){ - rc = sqlite3OsTruncate(pPager->jfd, pPager->journalOff); + rc = tdsqlite3OsTruncate(pPager->jfd, pPager->journalOff); } return rc; } @@ -58302,14 +58302,14 @@ static int writeMasterJournal(Pager *pPager, const char *zMaster){ */ static void pager_reset(Pager *pPager){ pPager->iDataVersion++; - sqlite3BackupRestart(pPager->pBackup); - sqlite3PcacheClear(pPager->pPCache); + tdsqlite3BackupRestart(pPager->pBackup); + tdsqlite3PcacheClear(pPager->pPCache); } /* ** Return the pPager->iDataVersion value */ -SQLITE_PRIVATE u32 sqlite3PagerDataVersion(Pager *pPager){ +SQLITE_PRIVATE u32 tdsqlite3PagerDataVersion(Pager *pPager){ return pPager->iDataVersion; } @@ -58321,12 +58321,12 @@ SQLITE_PRIVATE u32 sqlite3PagerDataVersion(Pager *pPager){ static void releaseAllSavepoints(Pager *pPager){ int ii; /* Iterator for looping through Pager.aSavepoint */ for(ii=0; iinSavepoint; ii++){ - sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint); + tdsqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint); } - if( !pPager->exclusiveMode || sqlite3JournalIsInMemory(pPager->sjfd) ){ - sqlite3OsClose(pPager->sjfd); + if( !pPager->exclusiveMode || tdsqlite3JournalIsInMemory(pPager->sjfd) ){ + tdsqlite3OsClose(pPager->sjfd); } - sqlite3_free(pPager->aSavepoint); + tdsqlite3_free(pPager->aSavepoint); pPager->aSavepoint = 0; pPager->nSavepoint = 0; pPager->nSubRec = 0; @@ -58344,7 +58344,7 @@ static int addToSavepointBitvecs(Pager *pPager, Pgno pgno){ for(ii=0; iinSavepoint; ii++){ PagerSavepoint *p = &pPager->aSavepoint[ii]; if( pgno<=p->nOrig ){ - rc |= sqlite3BitvecSet(p->pInSavepoint, pgno); + rc |= tdsqlite3BitvecSet(p->pInSavepoint, pgno); testcase( rc==SQLITE_NOMEM ); assert( rc==SQLITE_OK || rc==SQLITE_NOMEM ); } @@ -58376,17 +58376,17 @@ static void pager_unlock(Pager *pPager){ || pPager->eState==PAGER_ERROR ); - sqlite3BitvecDestroy(pPager->pInJournal); + tdsqlite3BitvecDestroy(pPager->pInJournal); pPager->pInJournal = 0; releaseAllSavepoints(pPager); if( pagerUseWal(pPager) ){ assert( !isOpen(pPager->jfd) ); - sqlite3WalEndReadTransaction(pPager->pWal); + tdsqlite3WalEndReadTransaction(pPager->pWal); pPager->eState = PAGER_OPEN; }else if( !pPager->exclusiveMode ){ int rc; /* Error code returned by pagerUnlockDb() */ - int iDc = isOpen(pPager->fd)?sqlite3OsDeviceCharacteristics(pPager->fd):0; + int iDc = isOpen(pPager->fd)?tdsqlite3OsDeviceCharacteristics(pPager->fd):0; /* If the operating system support deletion of open files, then ** close the journal file when dropping the database lock. Otherwise @@ -58402,7 +58402,7 @@ static void pager_unlock(Pager *pPager){ if( 0==(iDc & SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN) || 1!=(pPager->journalMode & 5) ){ - sqlite3OsClose(pPager->jfd); + tdsqlite3OsClose(pPager->jfd); } /* If the pager is in the ERROR state and the call to unlock the database @@ -58437,7 +58437,7 @@ static void pager_unlock(Pager *pPager){ }else{ pPager->eState = (isOpen(pPager->jfd) ? PAGER_OPEN : PAGER_READER); } - if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0); + if( USEFETCH(pPager) ) tdsqlite3OsUnfetch(pPager->fd, 0, 0); pPager->errCode = SQLITE_OK; setGetterMethod(pPager); } @@ -58504,7 +58504,7 @@ static int pagerFlushOnCommit(Pager *pPager, int bCommit){ if( pPager->tempFile==0 ) return 1; if( !bCommit ) return 0; if( !isOpen(pPager->fd) ) return 0; - return (sqlite3PCachePercentDirty(pPager->pPCache)>=25); + return (tdsqlite3PCachePercentDirty(pPager->pPCache)>=25); } /* @@ -58540,7 +58540,7 @@ static int pagerFlushOnCommit(Pager *pPager, int bCommit){ ** file. An invalid journal file cannot be rolled back. ** ** journalMode==DELETE -** The journal file is closed and deleted using sqlite3OsDelete(). +** The journal file is closed and deleted using tdsqlite3OsDelete(). ** ** If the pager is running in exclusive mode, this method of finalizing ** the journal file is never used. Instead, if the journalMode is @@ -58585,27 +58585,27 @@ static int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){ releaseAllSavepoints(pPager); assert( isOpen(pPager->jfd) || pPager->pInJournal==0 - || (sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_BATCH_ATOMIC) + || (tdsqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_BATCH_ATOMIC) ); if( isOpen(pPager->jfd) ){ assert( !pagerUseWal(pPager) ); /* Finalize the journal file. */ - if( sqlite3JournalIsInMemory(pPager->jfd) ){ + if( tdsqlite3JournalIsInMemory(pPager->jfd) ){ /* assert( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ); */ - sqlite3OsClose(pPager->jfd); + tdsqlite3OsClose(pPager->jfd); }else if( pPager->journalMode==PAGER_JOURNALMODE_TRUNCATE ){ if( pPager->journalOff==0 ){ rc = SQLITE_OK; }else{ - rc = sqlite3OsTruncate(pPager->jfd, 0); + rc = tdsqlite3OsTruncate(pPager->jfd, 0); if( rc==SQLITE_OK && pPager->fullSync ){ /* Make sure the new file size is written into the inode right away. ** Otherwise the journal might resurrect following a power loss and ** cause the last transaction to roll back. See ** https://bugzilla.mozilla.org/show_bug.cgi?id=1072773 */ - rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags); + rc = tdsqlite3OsSync(pPager->jfd, pPager->syncFlags); } } pPager->journalOff = 0; @@ -58621,39 +58621,39 @@ static int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){ ** the database file, it will do so using an in-memory journal. */ int bDelete = !pPager->tempFile; - assert( sqlite3JournalIsInMemory(pPager->jfd)==0 ); + assert( tdsqlite3JournalIsInMemory(pPager->jfd)==0 ); assert( pPager->journalMode==PAGER_JOURNALMODE_DELETE || pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->journalMode==PAGER_JOURNALMODE_WAL ); - sqlite3OsClose(pPager->jfd); + tdsqlite3OsClose(pPager->jfd); if( bDelete ){ - rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal, pPager->extraSync); + rc = tdsqlite3OsDelete(pPager->pVfs, pPager->zJournal, pPager->extraSync); } } } #ifdef SQLITE_CHECK_PAGES - sqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash); - if( pPager->dbSize==0 && sqlite3PcacheRefCount(pPager->pPCache)>0 ){ - PgHdr *p = sqlite3PagerLookup(pPager, 1); + tdsqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash); + if( pPager->dbSize==0 && tdsqlite3PcacheRefCount(pPager->pPCache)>0 ){ + PgHdr *p = tdsqlite3PagerLookup(pPager, 1); if( p ){ p->pageHash = 0; - sqlite3PagerUnrefNotNull(p); + tdsqlite3PagerUnrefNotNull(p); } } #endif - sqlite3BitvecDestroy(pPager->pInJournal); + tdsqlite3BitvecDestroy(pPager->pInJournal); pPager->pInJournal = 0; pPager->nRec = 0; if( rc==SQLITE_OK ){ if( MEMDB || pagerFlushOnCommit(pPager, bCommit) ){ - sqlite3PcacheCleanAll(pPager->pPCache); + tdsqlite3PcacheCleanAll(pPager->pPCache); }else{ - sqlite3PcacheClearWritable(pPager->pPCache); + tdsqlite3PcacheClearWritable(pPager->pPCache); } - sqlite3PcacheTruncate(pPager->pPCache, pPager->dbSize); + tdsqlite3PcacheTruncate(pPager->pPCache, pPager->dbSize); } if( pagerUseWal(pPager) ){ @@ -58661,7 +58661,7 @@ static int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){ ** locking_mode=exclusive mode but is no longer, drop the EXCLUSIVE ** lock held on the database file. */ - rc2 = sqlite3WalEndWriteTransaction(pPager->pWal); + rc2 = tdsqlite3WalEndWriteTransaction(pPager->pWal); assert( rc2==SQLITE_OK ); }else if( rc==SQLITE_OK && bCommit && pPager->dbFileSize>pPager->dbSize ){ /* This branch is taken when committing a transaction in rollback-journal @@ -58675,12 +58675,12 @@ static int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){ } if( rc==SQLITE_OK && bCommit ){ - rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_COMMIT_PHASETWO, 0); + rc = tdsqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_COMMIT_PHASETWO, 0); if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK; } if( !pPager->exclusiveMode - && (!pagerUseWal(pPager) || sqlite3WalExclusiveMode(pPager->pWal, 0)) + && (!pagerUseWal(pPager) || tdsqlite3WalExclusiveMode(pPager->pWal, 0)) ){ rc2 = pagerUnlockDb(pPager, SHARED_LOCK); } @@ -58711,9 +58711,9 @@ static void pagerUnlockAndRollback(Pager *pPager){ if( pPager->eState!=PAGER_ERROR && pPager->eState!=PAGER_OPEN ){ assert( assert_pager_state(pPager) ); if( pPager->eState>=PAGER_WRITER_LOCKED ){ - sqlite3BeginBenignMalloc(); - sqlite3PagerRollback(pPager); - sqlite3EndBenignMalloc(); + tdsqlite3BeginBenignMalloc(); + tdsqlite3PagerRollback(pPager); + tdsqlite3EndBenignMalloc(); }else if( !pPager->exclusiveMode ){ assert( pPager->eState==PAGER_READER ); pager_end_transaction(pPager, 0, 0); @@ -58772,7 +58772,7 @@ static void pagerReportSize(Pager *pPager){ ** pager as it is in the source. This comes up when a VACUUM changes the ** number of reserved bits to the "optimal" amount. */ -SQLITE_PRIVATE void sqlite3PagerAlignReserve(Pager *pDest, Pager *pSrc){ +SQLITE_PRIVATE void tdsqlite3PagerAlignReserve(Pager *pDest, Pager *pSrc){ if( pDest->nReserve!=pSrc->nReserve ){ pDest->nReserve = pSrc->nReserve; pagerReportSize(pDest); @@ -58829,7 +58829,7 @@ static int pager_playback_one_page( Pgno pgno; /* The page number of a page in journal */ u32 cksum; /* Checksum used for sanity checking */ char *aData; /* Temporary storage for the page */ - sqlite3_file *jfd; /* The file descriptor for the journal file */ + tdsqlite3_file *jfd; /* The file descriptor for the journal file */ int isSynced; /* True if journal page is synced */ #ifdef SQLITE_HAS_CODEC /* The jrnlEnc flag is true if Journal pages should be passed through @@ -58863,7 +58863,7 @@ static int pager_playback_one_page( jfd = isMainJrnl ? pPager->jfd : pPager->sjfd; rc = read32bits(jfd, *pOffset, &pgno); if( rc!=SQLITE_OK ) return rc; - rc = sqlite3OsRead(jfd, (u8*)aData, pPager->pageSize, (*pOffset)+4); + rc = tdsqlite3OsRead(jfd, (u8*)aData, pPager->pageSize, (*pOffset)+4); if( rc!=SQLITE_OK ) return rc; *pOffset += pPager->pageSize + 4 + isMainJrnl*4; @@ -58876,7 +58876,7 @@ static int pager_playback_one_page( assert( !isSavepnt ); return SQLITE_DONE; } - if( pgno>(Pgno)pPager->dbSize || sqlite3BitvecTest(pDone, pgno) ){ + if( pgno>(Pgno)pPager->dbSize || tdsqlite3BitvecTest(pDone, pgno) ){ return SQLITE_OK; } if( isMainJrnl ){ @@ -58890,7 +58890,7 @@ static int pager_playback_one_page( /* If this page has already been played back before during the current ** rollback, then don't bother to play it back again. */ - if( pDone && (rc = sqlite3BitvecSet(pDone, pgno))!=SQLITE_OK ){ + if( pDone && (rc = tdsqlite3BitvecSet(pDone, pgno))!=SQLITE_OK ){ return rc; } @@ -58939,7 +58939,7 @@ static int pager_playback_one_page( if( pagerUseWal(pPager) ){ pPg = 0; }else{ - pPg = sqlite3PagerLookup(pPager, pgno); + pPg = tdsqlite3PagerLookup(pPager, pgno); } assert( pPg || !MEMDB ); assert( pPager->eState!=PAGER_OPEN || pPg==0 || pPager->tempFile ); @@ -58969,11 +58969,11 @@ static int pager_playback_one_page( #ifdef SQLITE_HAS_CODEC if( !jrnlEnc ){ CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM_BKPT, aData); - rc = sqlite3OsWrite(pPager->fd, (u8 *)aData, pPager->pageSize, ofst); + rc = tdsqlite3OsWrite(pPager->fd, (u8 *)aData, pPager->pageSize, ofst); CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM_BKPT); }else #endif - rc = sqlite3OsWrite(pPager->fd, (u8 *)aData, pPager->pageSize, ofst); + rc = tdsqlite3OsWrite(pPager->fd, (u8 *)aData, pPager->pageSize, ofst); if( pgno>pPager->dbFileSize ){ pPager->dbFileSize = pgno; @@ -58982,11 +58982,11 @@ static int pager_playback_one_page( #ifdef SQLITE_HAS_CODEC if( jrnlEnc ){ CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM_BKPT); - sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData); + tdsqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData); CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM_BKPT,aData); }else #endif - sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData); + tdsqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData); } }else if( !isMainJrnl && pPg==0 ){ /* If this is a rollback of a savepoint and data was not written to @@ -58998,7 +58998,7 @@ static int pager_playback_one_page( ** There are a couple of different ways this can happen. All are quite ** obscure. When running in synchronous mode, this can only happen ** if the page is on the free-list at the start of the transaction, then - ** populated, then moved using sqlite3PagerMovepage(). + ** populated, then moved using tdsqlite3PagerMovepage(). ** ** The solution is to add an in-memory page to the cache containing ** the data just read from the sub-journal. Mark the page as dirty @@ -59008,26 +59008,26 @@ static int pager_playback_one_page( assert( isSavepnt ); assert( (pPager->doNotSpill & SPILLFLAG_ROLLBACK)==0 ); pPager->doNotSpill |= SPILLFLAG_ROLLBACK; - rc = sqlite3PagerGet(pPager, pgno, &pPg, 1); + rc = tdsqlite3PagerGet(pPager, pgno, &pPg, 1); assert( (pPager->doNotSpill & SPILLFLAG_ROLLBACK)!=0 ); pPager->doNotSpill &= ~SPILLFLAG_ROLLBACK; if( rc!=SQLITE_OK ) return rc; - sqlite3PcacheMakeDirty(pPg); + tdsqlite3PcacheMakeDirty(pPg); } if( pPg ){ /* No page should ever be explicitly rolled back that is in use, except ** for page 1 which is held in use in order to keep the lock on the ** database active. However such a page may be rolled back as a result ** of an internal error resulting in an automatic call to - ** sqlite3PagerRollback(). + ** tdsqlite3PagerRollback(). */ void *pData; pData = pPg->pData; memcpy(pData, (u8*)aData, pPager->pageSize); pPager->xReiniter(pPg); - /* It used to be that sqlite3PcacheMakeClean(pPg) was called here. But + /* It used to be that tdsqlite3PcacheMakeClean(pPg) was called here. But ** that call was dangerous and had no detectable benefit since the cache - ** is normally cleaned by sqlite3PcacheCleanAll() after rollback and so + ** is normally cleaned by tdsqlite3PcacheCleanAll() after rollback and so ** has been removed. */ pager_set_pagehash(pPg); @@ -59041,7 +59041,7 @@ static int pager_playback_one_page( #if SQLITE_HAS_CODEC if( jrnlEnc ){ CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM_BKPT); } #endif - sqlite3PcacheRelease(pPg); + tdsqlite3PcacheRelease(pPg); } return rc; } @@ -59077,10 +59077,10 @@ static int pager_playback_one_page( ** If a child journal can be found that matches both of the criteria ** above, this function returns without doing anything. Otherwise, if ** no such child journal can be found, file zMaster is deleted from -** the file-system using sqlite3OsDelete(). +** the file-system using tdsqlite3OsDelete(). ** ** If an IO error within this function, an error code is returned. This -** function allocates memory by calling sqlite3Malloc(). If an allocation +** function allocates memory by calling tdsqlite3Malloc(). If an allocation ** fails, SQLITE_NOMEM is returned. Otherwise, if no IO or malloc errors ** occur, SQLITE_OK is returned. ** @@ -59090,10 +59090,10 @@ static int pager_playback_one_page( ** size. */ static int pager_delmaster(Pager *pPager, const char *zMaster){ - sqlite3_vfs *pVfs = pPager->pVfs; + tdsqlite3_vfs *pVfs = pPager->pVfs; int rc; /* Return code */ - sqlite3_file *pMaster; /* Malloc'd master-journal file descriptor */ - sqlite3_file *pJournal; /* Malloc'd child-journal file descriptor */ + tdsqlite3_file *pMaster; /* Malloc'd master-journal file descriptor */ + tdsqlite3_file *pJournal; /* Malloc'd child-journal file descriptor */ char *zMasterJournal = 0; /* Contents of master journal file */ i64 nMasterJournal; /* Size of master journal file */ char *zJournal; /* Pointer to one journal within MJ file */ @@ -59103,31 +59103,31 @@ static int pager_delmaster(Pager *pPager, const char *zMaster){ /* Allocate space for both the pJournal and pMaster file descriptors. ** If successful, open the master journal file for reading. */ - pMaster = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2); - pJournal = (sqlite3_file *)(((u8 *)pMaster) + pVfs->szOsFile); + pMaster = (tdsqlite3_file *)tdsqlite3MallocZero(pVfs->szOsFile * 2); + pJournal = (tdsqlite3_file *)(((u8 *)pMaster) + pVfs->szOsFile); if( !pMaster ){ rc = SQLITE_NOMEM_BKPT; }else{ const int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_MASTER_JOURNAL); - rc = sqlite3OsOpen(pVfs, zMaster, pMaster, flags, 0); + rc = tdsqlite3OsOpen(pVfs, zMaster, pMaster, flags, 0); } if( rc!=SQLITE_OK ) goto delmaster_out; /* Load the entire master journal file into space obtained from - ** sqlite3_malloc() and pointed to by zMasterJournal. Also obtain + ** tdsqlite3_malloc() and pointed to by zMasterJournal. Also obtain ** sufficient space (in zMasterPtr) to hold the names of master ** journal files extracted from regular rollback-journals. */ - rc = sqlite3OsFileSize(pMaster, &nMasterJournal); + rc = tdsqlite3OsFileSize(pMaster, &nMasterJournal); if( rc!=SQLITE_OK ) goto delmaster_out; nMasterPtr = pVfs->mxPathname+1; - zMasterJournal = sqlite3Malloc(nMasterJournal + nMasterPtr + 2); + zMasterJournal = tdsqlite3Malloc(nMasterJournal + nMasterPtr + 2); if( !zMasterJournal ){ rc = SQLITE_NOMEM_BKPT; goto delmaster_out; } zMasterPtr = &zMasterJournal[nMasterJournal+2]; - rc = sqlite3OsRead(pMaster, zMasterJournal, (int)nMasterJournal, 0); + rc = tdsqlite3OsRead(pMaster, zMasterJournal, (int)nMasterJournal, 0); if( rc!=SQLITE_OK ) goto delmaster_out; zMasterJournal[nMasterJournal] = 0; zMasterJournal[nMasterJournal+1] = 0; @@ -59135,7 +59135,7 @@ static int pager_delmaster(Pager *pPager, const char *zMaster){ zJournal = zMasterJournal; while( (zJournal-zMasterJournal)pageSize; assert( pPager->eLock==EXCLUSIVE_LOCK ); /* TODO: Is it safe to use Pager.dbFileSize here? */ - rc = sqlite3OsFileSize(pPager->fd, ¤tSize); + rc = tdsqlite3OsFileSize(pPager->fd, ¤tSize); newSize = szPage*(i64)nPage; if( rc==SQLITE_OK && currentSize!=newSize ){ if( currentSize>newSize ){ - rc = sqlite3OsTruncate(pPager->fd, newSize); + rc = tdsqlite3OsTruncate(pPager->fd, newSize); }else if( (currentSize+szPage)<=newSize ){ char *pTmp = pPager->pTmpSpace; memset(pTmp, 0, szPage); testcase( (newSize-szPage) == currentSize ); testcase( (newSize-szPage) > currentSize ); - rc = sqlite3OsWrite(pPager->fd, pTmp, szPage, newSize-szPage); + rc = tdsqlite3OsWrite(pPager->fd, pTmp, szPage, newSize-szPage); } if( rc==SQLITE_OK ){ pPager->dbFileSize = nPage; @@ -59236,8 +59236,8 @@ static int pager_truncate(Pager *pPager, Pgno nPage){ ** Return a sanitized version of the sector-size of OS file pFile. The ** return value is guaranteed to lie between 32 and MAX_SECTOR_SIZE. */ -SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *pFile){ - int iRet = sqlite3OsSectorSize(pFile); +SQLITE_PRIVATE int tdsqlite3SectorSize(tdsqlite3_file *pFile){ + int iRet = tdsqlite3OsSectorSize(pFile); if( iRet<32 ){ iRet = 512; }else if( iRet>MAX_SECTOR_SIZE ){ @@ -59274,7 +59274,7 @@ static void setSectorSize(Pager *pPager){ assert( isOpen(pPager->fd) || pPager->tempFile ); if( pPager->tempFile - || (sqlite3OsDeviceCharacteristics(pPager->fd) & + || (tdsqlite3OsDeviceCharacteristics(pPager->fd) & SQLITE_IOCAP_POWERSAFE_OVERWRITE)!=0 ){ /* Sector size doesn't matter for temporary files. Also, the file @@ -59282,7 +59282,7 @@ static void setSectorSize(Pager *pPager){ ** call will segfault. */ pPager->sectorSize = 512; }else{ - pPager->sectorSize = sqlite3SectorSize(pPager->fd); + pPager->sectorSize = tdsqlite3SectorSize(pPager->fd); } } @@ -59344,13 +59344,13 @@ static void setSectorSize(Pager *pPager){ ** needed. */ static int pager_playback(Pager *pPager, int isHot){ - sqlite3_vfs *pVfs = pPager->pVfs; + tdsqlite3_vfs *pVfs = pPager->pVfs; i64 szJ; /* Size of the journal file in bytes */ u32 nRec; /* Number of Records in the journal */ u32 u; /* Unsigned loop counter */ Pgno mxPg = 0; /* Size of the original file in pages */ int rc; /* Result code of a subroutine */ - int res = 1; /* Value returned by sqlite3OsAccess() */ + int res = 1; /* Value returned by tdsqlite3OsAccess() */ char *zMaster = 0; /* Name of master journal file if any */ int needPagerReset; /* True to reset page prior to first page rollback */ int nPlayback = 0; /* Total number of pages restored from journal */ @@ -59360,7 +59360,7 @@ static int pager_playback(Pager *pPager, int isHot){ ** the journal is empty. */ assert( isOpen(pPager->jfd) ); - rc = sqlite3OsFileSize(pPager->jfd, &szJ); + rc = tdsqlite3OsFileSize(pPager->jfd, &szJ); if( rc!=SQLITE_OK ){ goto end_playback; } @@ -59379,7 +59379,7 @@ static int pager_playback(Pager *pPager, int isHot){ zMaster = pPager->pTmpSpace; rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1); if( rc==SQLITE_OK && zMaster[0] ){ - rc = sqlite3OsAccess(pVfs, zMaster, SQLITE_ACCESS_EXISTS, &res); + rc = tdsqlite3OsAccess(pVfs, zMaster, SQLITE_ACCESS_EXISTS, &res); } zMaster = 0; if( rc!=SQLITE_OK || !res ){ @@ -59485,7 +59485,7 @@ static int pager_playback(Pager *pPager, int isHot){ end_playback: if( rc==SQLITE_OK ){ - rc = sqlite3PagerSetPagesize(pPager, &savedPageSize, -1); + rc = tdsqlite3PagerSetPagesize(pPager, &savedPageSize, -1); } /* Following a rollback, the database file should be back in its original ** state prior to the start of the transaction, so invoke the @@ -59493,7 +59493,7 @@ end_playback: ** assertion that the transaction counter was modified. */ #ifdef SQLITE_DEBUG - sqlite3OsFileControlHint(pPager->fd,SQLITE_FCNTL_DB_UNCHANGED,0); + tdsqlite3OsFileControlHint(pPager->fd,SQLITE_FCNTL_DB_UNCHANGED,0); #endif /* If this playback is happening automatically as a result of an IO or @@ -59515,7 +59515,7 @@ end_playback: if( rc==SQLITE_OK && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN) ){ - rc = sqlite3PagerSync(pPager, 0); + rc = tdsqlite3PagerSync(pPager, 0); } if( rc==SQLITE_OK ){ rc = pager_end_transaction(pPager, zMaster[0]!='\0', 0); @@ -59529,7 +59529,7 @@ end_playback: testcase( rc!=SQLITE_OK ); } if( isHot && nPlayback ){ - sqlite3_log(SQLITE_NOTICE_RECOVER_ROLLBACK, "recovered %d pages from %s", + tdsqlite3_log(SQLITE_NOTICE_RECOVER_ROLLBACK, "recovered %d pages from %s", nPlayback, pPager->zJournal); } @@ -59565,16 +59565,16 @@ static int readDbPage(PgHdr *pPg){ assert( isOpen(pPager->fd) ); if( pagerUseWal(pPager) ){ - rc = sqlite3WalFindFrame(pPager->pWal, pPg->pgno, &iFrame); + rc = tdsqlite3WalFindFrame(pPager->pWal, pPg->pgno, &iFrame); if( rc ) return rc; } if( iFrame ){ - rc = sqlite3WalReadFrame(pPager->pWal, iFrame,pPager->pageSize,pPg->pData); + rc = tdsqlite3WalReadFrame(pPager->pWal, iFrame,pPager->pageSize,pPg->pData); }else #endif { i64 iOffset = (pPg->pgno-1)*(i64)pPager->pageSize; - rc = sqlite3OsRead(pPager->fd, pPg->pData, pPager->pageSize, iOffset); + rc = tdsqlite3OsRead(pPager->fd, pPg->pData, pPager->pageSize, iOffset); if( rc==SQLITE_IOERR_SHORT_READ ){ rc = SQLITE_OK; } @@ -59602,7 +59602,7 @@ static int readDbPage(PgHdr *pPg){ } CODEC1(pPager, pPg->pData, pPg->pgno, 3, rc = SQLITE_NOMEM_BKPT); - PAGER_INCR(sqlite3_pager_readdb_count); + PAGER_INCR(tdsqlite3_pager_readdb_count); PAGER_INCR(pPager->nRead); IOTRACE(("PGIN %p %d\n", pPager, pPg->pgno)); PAGERTRACE(("FETCH %d page %d hash(%08x)\n", @@ -59623,7 +59623,7 @@ static void pager_write_changecounter(PgHdr *pPg){ u32 change_counter; /* Increment the value just read and write it back to byte 24. */ - change_counter = sqlite3Get4byte((u8*)pPg->pPager->dbFileVers)+1; + change_counter = tdsqlite3Get4byte((u8*)pPg->pPager->dbFileVers)+1; put32bits(((char*)pPg->pData)+24, change_counter); /* Also store the SQLite version number in bytes 96..99 and in @@ -59652,16 +59652,16 @@ static int pagerUndoCallback(void *pCtx, Pgno iPg){ PgHdr *pPg; assert( pagerUseWal(pPager) ); - pPg = sqlite3PagerLookup(pPager, iPg); + pPg = tdsqlite3PagerLookup(pPager, iPg); if( pPg ){ - if( sqlite3PcachePageRefcount(pPg)==1 ){ - sqlite3PcacheDrop(pPg); + if( tdsqlite3PcachePageRefcount(pPg)==1 ){ + tdsqlite3PcacheDrop(pPg); }else{ rc = readDbPage(pPg); if( rc==SQLITE_OK ){ pPager->xReiniter(pPg); } - sqlite3PagerUnrefNotNull(pPg); + tdsqlite3PagerUnrefNotNull(pPg); } } @@ -59673,7 +59673,7 @@ static int pagerUndoCallback(void *pCtx, Pgno iPg){ ** also copied into the backup databases) as part of this transaction, ** the backups must be restarted. */ - sqlite3BackupRestart(pPager->pBackup); + tdsqlite3BackupRestart(pPager->pBackup); return rc; } @@ -59693,8 +59693,8 @@ static int pagerRollbackWal(Pager *pPager){ ** + Reload page content from the database (if refcount>0). */ pPager->dbSize = pPager->dbOrigSize; - rc = sqlite3WalUndo(pPager->pWal, pagerUndoCallback, (void *)pPager); - pList = sqlite3PcacheDirtyList(pPager->pPCache); + rc = tdsqlite3WalUndo(pPager->pWal, pagerUndoCallback, (void *)pPager); + pList = tdsqlite3PcacheDirtyList(pPager->pPCache); while( pList && rc==SQLITE_OK ){ PgHdr *pNext = pList->pDirty; rc = pagerUndoCallback((void *)pPager, pList->pgno); @@ -59705,7 +59705,7 @@ static int pagerRollbackWal(Pager *pPager){ } /* -** This function is a wrapper around sqlite3WalFrames(). As well as logging +** This function is a wrapper around tdsqlite3WalFrames(). As well as logging ** the contents of the list of pages headed by pList (connected by pDirty), ** this function notifies any active backup processes that the pages have ** changed. @@ -59753,17 +59753,17 @@ static int pagerWalFrames( pPager->aStat[PAGER_STAT_WRITE] += nList; if( pList->pgno==1 ) pager_write_changecounter(pList); - rc = sqlite3WalFrames(pPager->pWal, + rc = tdsqlite3WalFrames(pPager->pWal, pPager->pageSize, pList, nTruncate, isCommit, pPager->walSyncFlags ); if( rc==SQLITE_OK && pPager->pBackup ){ for(p=pList; p; p=p->pDirty){ - sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData); + tdsqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData); } } #ifdef SQLITE_CHECK_PAGES - pList = sqlite3PcacheDirtyList(pPager->pPCache); + pList = tdsqlite3PcacheDirtyList(pPager->pPCache); for(p=pList; p; p=p->pDirty){ pager_set_pagehash(p); } @@ -59787,17 +59787,17 @@ static int pagerBeginReadTransaction(Pager *pPager){ assert( pagerUseWal(pPager) ); assert( pPager->eState==PAGER_OPEN || pPager->eState==PAGER_READER ); - /* sqlite3WalEndReadTransaction() was not called for the previous + /* tdsqlite3WalEndReadTransaction() was not called for the previous ** transaction in locking_mode=EXCLUSIVE. So call it now. If we ** are in locking_mode=NORMAL and EndRead() was previously called, ** the duplicate call is harmless. */ - sqlite3WalEndReadTransaction(pPager->pWal); + tdsqlite3WalEndReadTransaction(pPager->pWal); - rc = sqlite3WalBeginReadTransaction(pPager->pWal, &changed); + rc = tdsqlite3WalBeginReadTransaction(pPager->pWal, &changed); if( rc!=SQLITE_OK || changed ){ pager_reset(pPager); - if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0); + if( USEFETCH(pPager) ) tdsqlite3OsUnfetch(pPager->fd, 0, 0); } return rc; @@ -59826,7 +59826,7 @@ static int pagerPagecount(Pager *pPager, Pgno *pnPage){ assert( pPager->eLock>=SHARED_LOCK ); assert( isOpen(pPager->fd) ); assert( pPager->tempFile==0 ); - nPage = sqlite3WalDbsize(pPager->pWal); + nPage = tdsqlite3WalDbsize(pPager->pWal); /* If the number of pages in the database is not available from the ** WAL sub-system, determine the page count based on the size of @@ -59835,7 +59835,7 @@ static int pagerPagecount(Pager *pPager, Pgno *pnPage){ */ if( nPage==0 && ALWAYS(isOpen(pPager->fd)) ){ i64 n = 0; /* Size of db file in bytes */ - int rc = sqlite3OsFileSize(pPager->fd, &n); + int rc = tdsqlite3OsFileSize(pPager->fd, &n); if( rc!=SQLITE_OK ){ return rc; } @@ -59880,7 +59880,7 @@ static int pagerOpenWalIfPresent(Pager *pPager){ if( !pPager->tempFile ){ int isWal; /* True if WAL file exists */ - rc = sqlite3OsAccess( + rc = tdsqlite3OsAccess( pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &isWal ); if( rc==SQLITE_OK ){ @@ -59890,10 +59890,10 @@ static int pagerOpenWalIfPresent(Pager *pPager){ rc = pagerPagecount(pPager, &nPage); if( rc ) return rc; if( nPage==0 ){ - rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0); + rc = tdsqlite3OsDelete(pPager->pVfs, pPager->zWal, 0); }else{ - testcase( sqlite3PcachePagecount(pPager->pPCache)==0 ); - rc = sqlite3PagerOpenWal(pPager, 0); + testcase( tdsqlite3PcachePagecount(pPager->pPCache)==0 ); + rc = tdsqlite3PagerOpenWal(pPager, 0); } }else if( pPager->journalMode==PAGER_JOURNALMODE_WAL ){ pPager->journalMode = PAGER_JOURNALMODE_DELETE; @@ -59951,7 +59951,7 @@ static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){ /* Allocate a bitvec to use to store the set of pages rolled back */ if( pSavepoint ){ - pDone = sqlite3BitvecCreate(pSavepoint->nOrig); + pDone = tdsqlite3BitvecCreate(pSavepoint->nOrig); if( !pDone ){ return SQLITE_NOMEM_BKPT; } @@ -60031,7 +60031,7 @@ static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){ i64 offset = (i64)pSavepoint->iSubRec*(4+pPager->pageSize); if( pagerUseWal(pPager) ){ - rc = sqlite3WalSavepointUndo(pPager->pWal, pSavepoint->aWalData); + rc = tdsqlite3WalSavepointUndo(pPager->pWal, pSavepoint->aWalData); } for(ii=pSavepoint->iSubRec; rc==SQLITE_OK && iinSubRec; ii++){ assert( offset==(i64)ii*(4+pPager->pageSize) ); @@ -60040,7 +60040,7 @@ static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){ assert( rc!=SQLITE_DONE ); } - sqlite3BitvecDestroy(pDone); + tdsqlite3BitvecDestroy(pDone); if( rc==SQLITE_OK ){ pPager->journalOff = szJ; } @@ -60052,16 +60052,16 @@ static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){ ** Change the maximum number of in-memory pages that are allowed ** before attempting to recycle clean and unused pages. */ -SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager *pPager, int mxPage){ - sqlite3PcacheSetCachesize(pPager->pPCache, mxPage); +SQLITE_PRIVATE void tdsqlite3PagerSetCachesize(Pager *pPager, int mxPage){ + tdsqlite3PcacheSetCachesize(pPager->pPCache, mxPage); } /* ** Change the maximum number of in-memory pages that are allowed ** before attempting to spill pages to journal. */ -SQLITE_PRIVATE int sqlite3PagerSetSpillsize(Pager *pPager, int mxPage){ - return sqlite3PcacheSetSpillsize(pPager->pPCache, mxPage); +SQLITE_PRIVATE int tdsqlite3PagerSetSpillsize(Pager *pPager, int mxPage){ + return tdsqlite3PcacheSetSpillsize(pPager->pPCache, mxPage); } /* @@ -60069,13 +60069,13 @@ SQLITE_PRIVATE int sqlite3PagerSetSpillsize(Pager *pPager, int mxPage){ */ static void pagerFixMaplimit(Pager *pPager){ #if SQLITE_MAX_MMAP_SIZE>0 - sqlite3_file *fd = pPager->fd; + tdsqlite3_file *fd = pPager->fd; if( isOpen(fd) && fd->pMethods->iVersion>=3 ){ - sqlite3_int64 sz; + tdsqlite3_int64 sz; sz = pPager->szMmap; pPager->bUseFetch = (sz>0); setGetterMethod(pPager); - sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_MMAP_SIZE, &sz); + tdsqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_MMAP_SIZE, &sz); } #endif } @@ -60083,7 +60083,7 @@ static void pagerFixMaplimit(Pager *pPager){ /* ** Change the maximum size of any memory mapping made of the database file. */ -SQLITE_PRIVATE void sqlite3PagerSetMmapLimit(Pager *pPager, sqlite3_int64 szMmap){ +SQLITE_PRIVATE void tdsqlite3PagerSetMmapLimit(Pager *pPager, tdsqlite3_int64 szMmap){ pPager->szMmap = szMmap; pagerFixMaplimit(pPager); } @@ -60091,8 +60091,8 @@ SQLITE_PRIVATE void sqlite3PagerSetMmapLimit(Pager *pPager, sqlite3_int64 szMmap /* ** Free as much memory as possible from the pager. */ -SQLITE_PRIVATE void sqlite3PagerShrink(Pager *pPager){ - sqlite3PcacheShrink(pPager->pPCache); +SQLITE_PRIVATE void tdsqlite3PagerShrink(Pager *pPager){ + tdsqlite3PcacheShrink(pPager->pPCache); } /* @@ -60103,7 +60103,7 @@ SQLITE_PRIVATE void sqlite3PagerShrink(Pager *pPager){ ** changing the number of syncs()s when writing the journals. ** There are four levels: ** -** OFF sqlite3OsSync() is never called. This is the default +** OFF tdsqlite3OsSync() is never called. This is the default ** for temporary and transient files. ** ** NORMAL The journal is synced once before writes begin on the @@ -60147,7 +60147,7 @@ SQLITE_PRIVATE void sqlite3PagerShrink(Pager *pPager){ ** and FULL=3. */ #ifndef SQLITE_OMIT_PAGER_PRAGMAS -SQLITE_PRIVATE void sqlite3PagerSetFlags( +SQLITE_PRIVATE void tdsqlite3PagerSetFlags( Pager *pPager, /* The pager to set safety level for */ unsigned pgFlags /* Various flags */ ){ @@ -60189,7 +60189,7 @@ SQLITE_PRIVATE void sqlite3PagerSetFlags( ** testing and analysis only. */ #ifdef SQLITE_TEST -SQLITE_API int sqlite3_opentemp_count = 0; +SQLITE_API int tdsqlite3_opentemp_count = 0; #endif /* @@ -60209,18 +60209,18 @@ SQLITE_API int sqlite3_opentemp_count = 0; */ static int pagerOpentemp( Pager *pPager, /* The pager object */ - sqlite3_file *pFile, /* Write the file descriptor here */ + tdsqlite3_file *pFile, /* Write the file descriptor here */ int vfsFlags /* Flags passed through to the VFS */ ){ int rc; /* Return code */ #ifdef SQLITE_TEST - sqlite3_opentemp_count++; /* Used for testing and analysis only */ + tdsqlite3_opentemp_count++; /* Used for testing and analysis only */ #endif vfsFlags |= SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE; - rc = sqlite3OsOpen(pPager->pVfs, 0, pFile, vfsFlags, 0); + rc = tdsqlite3OsOpen(pPager->pVfs, 0, pFile, vfsFlags, 0); assert( rc!=SQLITE_OK || isOpen(pFile) ); return rc; } @@ -60228,7 +60228,7 @@ static int pagerOpentemp( /* ** Set the busy handler function. ** -** The pager invokes the busy-handler if sqlite3OsLock() returns +** The pager invokes the busy-handler if tdsqlite3OsLock() returns ** SQLITE_BUSY when trying to upgrade from no-lock to a SHARED lock, ** or when trying to upgrade from a RESERVED lock to an EXCLUSIVE ** lock. It does *not* invoke the busy handler when upgrading from @@ -60246,7 +60246,7 @@ static int pagerOpentemp( ** retried. If it returns zero, then the SQLITE_BUSY error is ** returned to the caller of the pager API function. */ -SQLITE_PRIVATE void sqlite3PagerSetBusyHandler( +SQLITE_PRIVATE void tdsqlite3PagerSetBusyHandler( Pager *pPager, /* Pager object */ int (*xBusyHandler)(void *), /* Pointer to busy-handler function */ void *pBusyHandlerArg /* Argument to pass to xBusyHandler */ @@ -60257,7 +60257,7 @@ SQLITE_PRIVATE void sqlite3PagerSetBusyHandler( ap = (void **)&pPager->xBusyHandler; assert( ((int(*)(void *))(ap[0]))==xBusyHandler ); assert( ap[1]==pBusyHandlerArg ); - sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_BUSYHANDLER, (void *)ap); + tdsqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_BUSYHANDLER, (void *)ap); } /* @@ -60280,7 +60280,7 @@ SQLITE_PRIVATE void sqlite3PagerSetBusyHandler( ** ** then the pager object page size is set to *pPageSize. ** -** If the page size is changed, then this function uses sqlite3PagerMalloc() +** If the page size is changed, then this function uses tdsqlite3PagerMalloc() ** to obtain a new Pager.pTmpSpace buffer. If this allocation attempt ** fails, SQLITE_NOMEM is returned and the page size remains unchanged. ** In all other cases, SQLITE_OK is returned. @@ -60290,7 +60290,7 @@ SQLITE_PRIVATE void sqlite3PagerSetBusyHandler( ** function was called, or because the memory allocation attempt failed, ** then *pPageSize is set to the old, retained page size before returning. */ -SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){ +SQLITE_PRIVATE int tdsqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){ int rc = SQLITE_OK; /* It is not possible to do a full assert_pager_state() here, as this @@ -60306,19 +60306,19 @@ SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nR u32 pageSize = *pPageSize; assert( pageSize==0 || (pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE) ); if( (pPager->memDb==0 || pPager->dbSize==0) - && sqlite3PcacheRefCount(pPager->pPCache)==0 + && tdsqlite3PcacheRefCount(pPager->pPCache)==0 && pageSize && pageSize!=(u32)pPager->pageSize ){ char *pNew = NULL; /* New temp space */ i64 nByte = 0; if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){ - rc = sqlite3OsFileSize(pPager->fd, &nByte); + rc = tdsqlite3OsFileSize(pPager->fd, &nByte); } if( rc==SQLITE_OK ){ /* 8 bytes of zeroed overrun space is sufficient so that the b-tree * cell header parser will never run off the end of the allocation */ - pNew = (char *)sqlite3PageMalloc(pageSize+8); + pNew = (char *)tdsqlite3PageMalloc(pageSize+8); if( !pNew ){ rc = SQLITE_NOMEM_BKPT; }else{ @@ -60328,15 +60328,15 @@ SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nR if( rc==SQLITE_OK ){ pager_reset(pPager); - rc = sqlite3PcacheSetPageSize(pPager->pPCache, pageSize); + rc = tdsqlite3PcacheSetPageSize(pPager->pPCache, pageSize); } if( rc==SQLITE_OK ){ - sqlite3PageFree(pPager->pTmpSpace); + tdsqlite3PageFree(pPager->pTmpSpace); pPager->pTmpSpace = pNew; pPager->dbSize = (Pgno)((nByte+pageSize-1)/pageSize); pPager->pageSize = pageSize; }else{ - sqlite3PageFree(pNew); + tdsqlite3PageFree(pNew); } } @@ -60359,7 +60359,7 @@ SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nR ** occurs. But other modules are free to use it too, as long as ** no rollbacks are happening. */ -SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager *pPager){ +SQLITE_PRIVATE void *tdsqlite3PagerTempSpace(Pager *pPager){ return pPager->pTmpSpace; } @@ -60370,7 +60370,7 @@ SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager *pPager){ ** ** Regardless of mxPage, return the current maximum page count. */ -SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){ +SQLITE_PRIVATE int tdsqlite3PagerMaxPageCount(Pager *pPager, int mxPage){ if( mxPage>0 ){ pPager->mxPgno = mxPage; } @@ -60391,15 +60391,15 @@ SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){ ** and generate no code. */ #ifdef SQLITE_TEST -SQLITE_API extern int sqlite3_io_error_pending; -SQLITE_API extern int sqlite3_io_error_hit; +SQLITE_API extern int tdsqlite3_io_error_pending; +SQLITE_API extern int tdsqlite3_io_error_hit; static int saved_cnt; void disable_simulated_io_errors(void){ - saved_cnt = sqlite3_io_error_pending; - sqlite3_io_error_pending = -1; + saved_cnt = tdsqlite3_io_error_pending; + tdsqlite3_io_error_pending = -1; } void enable_simulated_io_errors(void){ - sqlite3_io_error_pending = saved_cnt; + tdsqlite3_io_error_pending = saved_cnt; } #else # define disable_simulated_io_errors() @@ -60420,7 +60420,7 @@ void enable_simulated_io_errors(void){ ** the error code is returned to the caller and the contents of the ** output buffer undefined. */ -SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager *pPager, int N, unsigned char *pDest){ +SQLITE_PRIVATE int tdsqlite3PagerReadFileheader(Pager *pPager, int N, unsigned char *pDest){ int rc = SQLITE_OK; memset(pDest, 0, N); assert( isOpen(pPager->fd) || pPager->tempFile ); @@ -60433,7 +60433,7 @@ SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager *pPager, int N, unsigned cha if( isOpen(pPager->fd) ){ IOTRACE(("DBHDR %p 0 %d\n", pPager, N)) - rc = sqlite3OsRead(pPager->fd, pDest, N, 0); + rc = tdsqlite3OsRead(pPager->fd, pDest, N, 0); if( rc==SQLITE_IOERR_SHORT_READ ){ rc = SQLITE_OK; } @@ -60448,7 +60448,7 @@ SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager *pPager, int N, unsigned cha ** However, if the file is between 1 and bytes in size, then ** this is considered a 1 page file. */ -SQLITE_PRIVATE void sqlite3PagerPagecount(Pager *pPager, int *pnPage){ +SQLITE_PRIVATE void tdsqlite3PagerPagecount(Pager *pPager, int *pnPage){ assert( pPager->eState>=PAGER_READER ); assert( pPager->eState!=PAGER_WRITER_FINISHED ); *pnPage = (int)pPager->dbSize; @@ -60460,7 +60460,7 @@ SQLITE_PRIVATE void sqlite3PagerPagecount(Pager *pPager, int *pnPage){ ** a similar or greater lock is already held, this function is a no-op ** (returning SQLITE_OK immediately). ** -** Otherwise, attempt to obtain the lock using sqlite3OsLock(). Invoke +** Otherwise, attempt to obtain the lock using tdsqlite3OsLock(). Invoke ** the busy callback if the lock is currently not available. Repeat ** until the busy callback returns false or until the attempt to ** obtain the lock succeeds. @@ -60475,7 +60475,7 @@ static int pager_wait_on_lock(Pager *pPager, int locktype){ /* Check that this is either a no-op (because the requested lock is ** already held), or one of the transitions that the busy-handler ** may be invoked during, according to the comment above - ** sqlite3PagerSetBusyhandler(). + ** tdsqlite3PagerSetBusyhandler(). */ assert( (pPager->eLock>=locktype) || (pPager->eLock==NO_LOCK && locktype==SHARED_LOCK) @@ -60516,7 +60516,7 @@ static void assertTruncateConstraintCb(PgHdr *pPg){ assert( !subjRequiresPage(pPg) || pPg->pgno<=pPg->pPager->dbSize ); } static void assertTruncateConstraint(Pager *pPager){ - sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb); + tdsqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb); } #else # define assertTruncateConstraint(pPager) @@ -60533,7 +60533,7 @@ static void assertTruncateConstraint(Pager *pPager){ ** rolled back or committed. It is not safe to call this function and ** then continue writing to the database. */ -SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){ +SQLITE_PRIVATE void tdsqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){ assert( pPager->dbSize>=nPage ); assert( pPager->eState>=PAGER_WRITER_CACHEMOD ); pPager->dbSize = nPage; @@ -60567,10 +60567,10 @@ SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){ static int pagerSyncHotJournal(Pager *pPager){ int rc = SQLITE_OK; if( !pPager->noSync ){ - rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_NORMAL); + rc = tdsqlite3OsSync(pPager->jfd, SQLITE_SYNC_NORMAL); } if( rc==SQLITE_OK ){ - rc = sqlite3OsFileSize(pPager->jfd, &pPager->journalHdr); + rc = tdsqlite3OsFileSize(pPager->jfd, &pPager->journalHdr); } return rc; } @@ -60601,9 +60601,9 @@ static int pagerAcquireMapPage( assert( pPager->nExtra>=8 ); memset(p->pExtra, 0, 8); }else{ - *ppPage = p = (PgHdr *)sqlite3MallocZero(sizeof(PgHdr) + pPager->nExtra); + *ppPage = p = (PgHdr *)tdsqlite3MallocZero(sizeof(PgHdr) + pPager->nExtra); if( p==0 ){ - sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1) * pPager->pageSize, pData); + tdsqlite3OsUnfetch(pPager->fd, (i64)(pgno-1) * pPager->pageSize, pData); return SQLITE_NOMEM_BKPT; } p->pExtra = (void *)&p[1]; @@ -60637,7 +60637,7 @@ static void pagerReleaseMapPage(PgHdr *pPg){ pPager->pMmapFreelist = pPg; assert( pPager->fd->pMethods->iVersion>=3 ); - sqlite3OsUnfetch(pPager->fd, (i64)(pPg->pgno-1)*pPager->pageSize, pPg->pData); + tdsqlite3OsUnfetch(pPager->fd, (i64)(pPg->pgno-1)*pPager->pageSize, pPg->pData); } /* @@ -60648,14 +60648,14 @@ static void pagerFreeMapHdrs(Pager *pPager){ PgHdr *pNext; for(p=pPager->pMmapFreelist; p; p=pNext){ pNext = p->pDirty; - sqlite3_free(p); + tdsqlite3_free(p); } } /* Verify that the database file has not be deleted or renamed out from ** under the pager. Return SQLITE_OK if the database is still where it ought ** to be on disk. Return non-zero (SQLITE_READONLY_DBMOVED or some other error -** code from sqlite3OsAccess()) if the database has gone missing. +** code from tdsqlite3OsAccess()) if the database has gone missing. */ static int databaseIsUnmoved(Pager *pPager){ int bHasMoved = 0; @@ -60664,7 +60664,7 @@ static int databaseIsUnmoved(Pager *pPager){ if( pPager->tempFile ) return SQLITE_OK; if( pPager->dbSize==0 ) return SQLITE_OK; assert( pPager->zFilename && pPager->zFilename[0] ); - rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_HAS_MOVED, &bHasMoved); + rc = tdsqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_HAS_MOVED, &bHasMoved); if( rc==SQLITE_NOTFOUND ){ /* If the HAS_MOVED file-control is unimplemented, assume that the file ** has not been moved. That is the historical behavior of SQLite: prior to @@ -60691,12 +60691,12 @@ static int databaseIsUnmoved(Pager *pPager){ ** a hot journal may be left in the filesystem but no error is returned ** to the caller. */ -SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager, sqlite3 *db){ +SQLITE_PRIVATE int tdsqlite3PagerClose(Pager *pPager, tdsqlite3 *db){ u8 *pTmp = (u8*)pPager->pTmpSpace; assert( db || pagerUseWal(pPager)==0 ); assert( assert_pager_state(pPager) ); disable_simulated_io_errors(); - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); pagerFreeMapHdrs(pPager); /* pPager->errCode = 0; */ pPager->exclusiveMode = 0; @@ -60709,7 +60709,7 @@ SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager, sqlite3 *db){ ){ a = pTmp; } - sqlite3WalClose(pPager->pWal, db, pPager->walSyncFlags, pPager->pageSize,a); + tdsqlite3WalClose(pPager->pWal, db, pPager->walSyncFlags, pPager->pageSize,a); pPager->pWal = 0; } #endif @@ -60733,14 +60733,14 @@ SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager, sqlite3 *db){ } pagerUnlockAndRollback(pPager); } - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); enable_simulated_io_errors(); PAGERTRACE(("CLOSE %d\n", PAGERID(pPager))); IOTRACE(("CLOSE %p\n", pPager)) - sqlite3OsClose(pPager->jfd); - sqlite3OsClose(pPager->fd); - sqlite3PageFree(pTmp); - sqlite3PcacheClose(pPager->pPCache); + tdsqlite3OsClose(pPager->jfd); + tdsqlite3OsClose(pPager->fd); + tdsqlite3PageFree(pTmp); + tdsqlite3PcacheClose(pPager->pPCache); #ifdef SQLITE_HAS_CODEC if( pPager->xCodecFree ) pPager->xCodecFree(pPager->pCodec); @@ -60749,7 +60749,7 @@ SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager, sqlite3 *db){ assert( !pPager->aSavepoint && !pPager->pInJournal ); assert( !isOpen(pPager->jfd) && !isOpen(pPager->sjfd) ); - sqlite3_free(pPager); + tdsqlite3_free(pPager); return SQLITE_OK; } @@ -60757,7 +60757,7 @@ SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager, sqlite3 *db){ /* ** Return the page number for page pPg. */ -SQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage *pPg){ +SQLITE_PRIVATE Pgno tdsqlite3PagerPagenumber(DbPage *pPg){ return pPg->pgno; } #endif @@ -60765,8 +60765,8 @@ SQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage *pPg){ /* ** Increment the reference count for page pPg. */ -SQLITE_PRIVATE void sqlite3PagerRef(DbPage *pPg){ - sqlite3PcacheRef(pPg); +SQLITE_PRIVATE void tdsqlite3PagerRef(DbPage *pPg){ + tdsqlite3PcacheRef(pPg); } /* @@ -60813,13 +60813,13 @@ static int syncJournal(Pager *pPager, int newHdr){ assert( assert_pager_state(pPager) ); assert( !pagerUseWal(pPager) ); - rc = sqlite3PagerExclusiveLock(pPager); + rc = tdsqlite3PagerExclusiveLock(pPager); if( rc!=SQLITE_OK ) return rc; if( !pPager->noSync ){ assert( !pPager->tempFile ); if( isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_MEMORY ){ - const int iDc = sqlite3OsDeviceCharacteristics(pPager->fd); + const int iDc = tdsqlite3OsDeviceCharacteristics(pPager->fd); assert( isOpen(pPager->jfd) ); if( 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){ @@ -60853,10 +60853,10 @@ static int syncJournal(Pager *pPager, int newHdr){ put32bits(&zHeader[sizeof(aJournalMagic)], pPager->nRec); iNextHdrOffset = journalHdrOffset(pPager); - rc = sqlite3OsRead(pPager->jfd, aMagic, 8, iNextHdrOffset); + rc = tdsqlite3OsRead(pPager->jfd, aMagic, 8, iNextHdrOffset); if( rc==SQLITE_OK && 0==memcmp(aMagic, aJournalMagic, 8) ){ static const u8 zerobyte = 0; - rc = sqlite3OsWrite(pPager->jfd, &zerobyte, 1, iNextHdrOffset); + rc = tdsqlite3OsWrite(pPager->jfd, &zerobyte, 1, iNextHdrOffset); } if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){ return rc; @@ -60876,11 +60876,11 @@ static int syncJournal(Pager *pPager, int newHdr){ if( pPager->fullSync && 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){ PAGERTRACE(("SYNC journal of %d\n", PAGERID(pPager))); IOTRACE(("JSYNC %p\n", pPager)) - rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags); + rc = tdsqlite3OsSync(pPager->jfd, pPager->syncFlags); if( rc!=SQLITE_OK ) return rc; } IOTRACE(("JHDR %p %lld\n", pPager, pPager->journalHdr)); - rc = sqlite3OsWrite( + rc = tdsqlite3OsWrite( pPager->jfd, zHeader, sizeof(zHeader), pPager->journalHdr ); if( rc!=SQLITE_OK ) return rc; @@ -60888,7 +60888,7 @@ static int syncJournal(Pager *pPager, int newHdr){ if( 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){ PAGERTRACE(("SYNC journal of %d\n", PAGERID(pPager))); IOTRACE(("JSYNC %p\n", pPager)) - rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags| + rc = tdsqlite3OsSync(pPager->jfd, pPager->syncFlags| (pPager->syncFlags==SQLITE_SYNC_FULL?SQLITE_SYNC_DATAONLY:0) ); if( rc!=SQLITE_OK ) return rc; @@ -60909,7 +60909,7 @@ static int syncJournal(Pager *pPager, int newHdr){ ** successfully synced. Either way, clear the PGHDR_NEED_SYNC flag on ** all pages. */ - sqlite3PcacheClearSyncFlags(pPager->pPCache); + tdsqlite3PcacheClearSyncFlags(pPager->pPCache); pPager->eState = PAGER_WRITER_DBMOD; assert( assert_pager_state(pPager) ); return SQLITE_OK; @@ -60973,8 +60973,8 @@ static int pager_write_pagelist(Pager *pPager, PgHdr *pList){ && pPager->dbHintSizedbSize && (pList->pDirty || pList->pgno>pPager->dbHintSize) ){ - sqlite3_int64 szFile = pPager->pageSize * (sqlite3_int64)pPager->dbSize; - sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile); + tdsqlite3_int64 szFile = pPager->pageSize * (tdsqlite3_int64)pPager->dbSize; + tdsqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile); pPager->dbHintSize = pPager->dbSize; } @@ -60982,12 +60982,12 @@ static int pager_write_pagelist(Pager *pPager, PgHdr *pList){ Pgno pgno = pList->pgno; /* If there are dirty pages in the page cache with page numbers greater - ** than Pager.dbSize, this means sqlite3PagerTruncateImage() was called to + ** than Pager.dbSize, this means tdsqlite3PagerTruncateImage() was called to ** make the file smaller (presumably by auto-vacuum code). Do not write ** any such pages to the file. ** ** Also, do not write out any page that has the PGHDR_DONT_WRITE flag - ** set (set by sqlite3PagerDontWrite()). + ** set (set by tdsqlite3PagerDontWrite()). */ if( pgno<=pPager->dbSize && 0==(pList->flags&PGHDR_DONT_WRITE) ){ i64 offset = (pgno-1)*(i64)pPager->pageSize; /* Offset to write */ @@ -61000,7 +61000,7 @@ static int pager_write_pagelist(Pager *pPager, PgHdr *pList){ CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM_BKPT, pData); /* Write out the page data. */ - rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset); + rc = tdsqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset); /* If page 1 was just written, update Pager.dbFileVers to match ** the value now stored in the database file. If writing this @@ -61015,12 +61015,12 @@ static int pager_write_pagelist(Pager *pPager, PgHdr *pList){ pPager->aStat[PAGER_STAT_WRITE]++; /* Update any backup objects copying the contents of this pager. */ - sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)pList->pData); + tdsqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)pList->pData); PAGERTRACE(("STORE %d page %d hash(%08x)\n", PAGERID(pPager), pgno, pager_pagehash(pList))); IOTRACE(("PGOUT %p %d\n", pPager, pgno)); - PAGER_INCR(sqlite3_pager_writedb_count); + PAGER_INCR(tdsqlite3_pager_writedb_count); }else{ PAGERTRACE(("NOSTORE %d page %d\n", PAGERID(pPager), pgno)); } @@ -61036,7 +61036,7 @@ static int pager_write_pagelist(Pager *pPager, PgHdr *pList){ ** function is a no-op. ** ** SQLITE_OK is returned if everything goes according to plan. An -** SQLITE_IOERR_XXX error code is returned if a call to sqlite3OsOpen() +** SQLITE_IOERR_XXX error code is returned if a call to tdsqlite3OsOpen() ** fails. */ static int openSubJournal(Pager *pPager){ @@ -61045,11 +61045,11 @@ static int openSubJournal(Pager *pPager){ const int flags = SQLITE_OPEN_SUBJOURNAL | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE; - int nStmtSpill = sqlite3Config.nStmtSpill; + int nStmtSpill = tdsqlite3Config.nStmtSpill; if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->subjInMemory ){ nStmtSpill = -1; } - rc = sqlite3JournalOpen(pPager->pVfs, 0, pPager->sjfd, flags, nStmtSpill); + rc = tdsqlite3JournalOpen(pPager->pVfs, 0, pPager->sjfd, flags, nStmtSpill); } return rc; } @@ -61096,7 +61096,7 @@ static int subjournalPage(PgHdr *pPg){ PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno)); rc = write32bits(pPager->sjfd, offset, pPg->pgno); if( rc==SQLITE_OK ){ - rc = sqlite3OsWrite(pPager->sjfd, pData2, pPager->pageSize, offset+4); + rc = tdsqlite3OsWrite(pPager->sjfd, pData2, pPager->pageSize, offset+4); } } } @@ -61128,11 +61128,11 @@ static int subjournalPageIfRequired(PgHdr *pPg){ ** out to the database file, if possible. This may involve syncing the ** journal file. ** -** If successful, sqlite3PcacheMakeClean() is called on the page and +** If successful, tdsqlite3PcacheMakeClean() is called on the page and ** SQLITE_OK returned. If an IO error occurs while trying to make the ** page clean, the IO error code is returned. If the page cannot be ** made clean for some other reason, but no error occurs, then SQLITE_OK -** is returned by sqlite3PcacheMakeClean() is not called. +** is returned by tdsqlite3PcacheMakeClean() is not called. */ static int pagerStress(void *p, PgHdr *pPg){ Pager *pPager = (Pager *)p; @@ -61143,7 +61143,7 @@ static int pagerStress(void *p, PgHdr *pPg){ /* The doNotSpill NOSYNC bit is set during times when doing a sync of ** journal (and adding a new header) is not allowed. This occurs - ** during calls to sqlite3PagerWrite() while trying to journal multiple + ** during calls to tdsqlite3PagerWrite() while trying to journal multiple ** pages belonging to the same sector. ** ** The doNotSpill ROLLBACK and OFF bits inhibits all cache spilling @@ -61152,7 +61152,7 @@ static int pagerStress(void *p, PgHdr *pPg){ ** ** Spilling is also prohibited when in an error state since that could ** lead to database corruption. In the current implementation it - ** is impossible for sqlite3PcacheFetch() to be called with createFlag==3 + ** is impossible for tdsqlite3PcacheFetch() to be called with createFlag==3 ** while in the error state, hence it is impossible for this routine to ** be called in the error state. Nevertheless, we include a NEVER() ** test for the error state as a safeguard against future changes. @@ -61180,7 +61180,7 @@ static int pagerStress(void *p, PgHdr *pPg){ #ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE if( pPager->tempFile==0 ){ - rc = sqlite3JournalCreate(pPager->jfd); + rc = tdsqlite3JournalCreate(pPager->jfd); if( rc!=SQLITE_OK ) return pager_error(pPager, rc); } #endif @@ -61202,7 +61202,7 @@ static int pagerStress(void *p, PgHdr *pPg){ /* Mark the page as clean. */ if( rc==SQLITE_OK ){ PAGERTRACE(("STRESS %d page %d\n", PAGERID(pPager), pPg->pgno)); - sqlite3PcacheMakeClean(pPg); + tdsqlite3PcacheMakeClean(pPg); } return pager_error(pPager, rc); @@ -61211,10 +61211,10 @@ static int pagerStress(void *p, PgHdr *pPg){ /* ** Flush all unreferenced dirty pages to disk. */ -SQLITE_PRIVATE int sqlite3PagerFlush(Pager *pPager){ +SQLITE_PRIVATE int tdsqlite3PagerFlush(Pager *pPager){ int rc = pPager->errCode; if( !MEMDB ){ - PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache); + PgHdr *pList = tdsqlite3PcacheDirtyList(pPager->pPCache); assert( assert_pager_state(pPager) ); while( rc==SQLITE_OK && pList ){ PgHdr *pNext = pList->pDirty; @@ -61231,7 +61231,7 @@ SQLITE_PRIVATE int sqlite3PagerFlush(Pager *pPager){ /* ** Allocate and initialize a new Pager object and put a pointer to it ** in *ppPager. The pager should eventually be freed by passing it -** to sqlite3PagerClose(). +** to tdsqlite3PagerClose(). ** ** The zFilename argument is the path to the database file to open. ** If zFilename is NULL then a randomly-named temporary file is created @@ -61242,7 +61242,7 @@ SQLITE_PRIVATE int sqlite3PagerFlush(Pager *pPager){ ** ** The nExtra parameter specifies the number of bytes of space allocated ** along with each page reference. This space is available to the user -** via the sqlite3PagerGetExtra() API. When a new page is allocated, the +** via the tdsqlite3PagerGetExtra() API. When a new page is allocated, the ** first 8 bytes of this space are zeroed but the remainder is uninitialized. ** (The extra space is used by btree as the MemPage object.) ** @@ -61257,16 +61257,16 @@ SQLITE_PRIVATE int sqlite3PagerFlush(Pager *pPager){ ** successfully, SQLITE_OK is returned and *ppPager set to point to ** the new pager object. If an error occurs, *ppPager is set to NULL ** and error code returned. This function may return SQLITE_NOMEM -** (sqlite3Malloc() is used to allocate memory), SQLITE_CANTOPEN or +** (tdsqlite3Malloc() is used to allocate memory), SQLITE_CANTOPEN or ** various SQLITE_IO_XXX errors. */ -SQLITE_PRIVATE int sqlite3PagerOpen( - sqlite3_vfs *pVfs, /* The virtual file system to use */ +SQLITE_PRIVATE int tdsqlite3PagerOpen( + tdsqlite3_vfs *pVfs, /* The virtual file system to use */ Pager **ppPager, /* OUT: Return the Pager structure here */ const char *zFilename, /* Name of the database file to open */ int nExtra, /* Extra bytes append to each in-memory page */ int flags, /* flags controlling this file */ - int vfsFlags, /* flags passed through to sqlite3_vfs.xOpen() */ + int vfsFlags, /* flags passed through to tdsqlite3_vfs.xOpen() */ void (*xReinit)(DbPage*) /* Function to reinitialize pages */ ){ u8 *pPtr; @@ -61284,7 +61284,7 @@ SQLITE_PRIVATE int sqlite3PagerOpen( char *zPathname = 0; /* Full path to database file */ int nPathname = 0; /* Number of bytes in zPathname */ int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; /* False to omit journal */ - int pcacheSize = sqlite3PcacheSize(); /* Bytes to allocate for PCache */ + int pcacheSize = tdsqlite3PcacheSize(); /* Bytes to allocate for PCache */ u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */ const char *zUri = 0; /* URI args to copy */ int nUriByte = 1; /* Number of bytes of URI args at *zUri */ @@ -61292,7 +61292,7 @@ SQLITE_PRIVATE int sqlite3PagerOpen( /* Figure out how much space is required for each journal file-handle ** (there are two of them, the main journal and the sub-journal). */ - journalFileSize = ROUND8(sqlite3JournalSize(pVfs)); + journalFileSize = ROUND8(tdsqlite3JournalSize(pVfs)); /* Set the output variable to NULL in case an error occurs. */ *ppPager = 0; @@ -61301,9 +61301,9 @@ SQLITE_PRIVATE int sqlite3PagerOpen( if( flags & PAGER_MEMORY ){ memDb = 1; if( zFilename && zFilename[0] ){ - zPathname = sqlite3DbStrDup(0, zFilename); + zPathname = tdsqlite3DbStrDup(0, zFilename); if( zPathname==0 ) return SQLITE_NOMEM_BKPT; - nPathname = sqlite3Strlen30(zPathname); + nPathname = tdsqlite3Strlen30(zPathname); zFilename = 0; } } @@ -61316,12 +61316,12 @@ SQLITE_PRIVATE int sqlite3PagerOpen( if( zFilename && zFilename[0] ){ const char *z; nPathname = pVfs->mxPathname+1; - zPathname = sqlite3DbMallocRaw(0, nPathname*2); + zPathname = tdsqlite3DbMallocRaw(0, nPathname*2); if( zPathname==0 ){ return SQLITE_NOMEM_BKPT; } zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */ - rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname); + rc = tdsqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname); if( rc!=SQLITE_OK ){ if( rc==SQLITE_OK_SYMLINK ){ if( vfsFlags & SQLITE_OPEN_NOFOLLOW ){ @@ -61331,8 +61331,8 @@ SQLITE_PRIVATE int sqlite3PagerOpen( } } } - nPathname = sqlite3Strlen30(zPathname); - z = zUri = &zFilename[sqlite3Strlen30(zFilename)+1]; + nPathname = tdsqlite3Strlen30(zPathname); + z = zUri = &zFilename[tdsqlite3Strlen30(zFilename)+1]; while( *z ){ z += strlen(z)+1; z += strlen(z)+1; @@ -61350,7 +61350,7 @@ SQLITE_PRIVATE int sqlite3PagerOpen( rc = SQLITE_CANTOPEN_BKPT; } if( rc!=SQLITE_OK ){ - sqlite3DbFree(0, zPathname); + tdsqlite3DbFree(0, zPathname); return rc; } } @@ -61360,7 +61360,7 @@ SQLITE_PRIVATE int sqlite3PagerOpen( ** file name. The layout in memory is as follows: ** ** Pager object (sizeof(Pager) bytes) - ** PCache object (sqlite3PcacheSize() bytes) + ** PCache object (tdsqlite3PcacheSize() bytes) ** Database file handle (pVfs->szOsFile bytes) ** Sub-journal file handle (journalFileSize bytes) ** Main journal file handle (journalFileSize bytes) @@ -61373,7 +61373,7 @@ SQLITE_PRIVATE int sqlite3PagerOpen( ** URI query parameters (nUriByte bytes) ** \0\0 terminator (2 bytes) */ - pPtr = (u8 *)sqlite3MallocZero( + pPtr = (u8 *)tdsqlite3MallocZero( ROUND8(sizeof(*pPager)) + /* Pager structure */ ROUND8(pcacheSize) + /* PCache object */ ROUND8(pVfs->szOsFile) + /* The main db file */ @@ -61391,14 +61391,14 @@ SQLITE_PRIVATE int sqlite3PagerOpen( ); assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) ); if( !pPtr ){ - sqlite3DbFree(0, zPathname); + tdsqlite3DbFree(0, zPathname); return SQLITE_NOMEM_BKPT; } pPager = (Pager*)pPtr; pPtr += ROUND8(sizeof(*pPager)); pPager->pPCache = (PCache*)pPtr; pPtr += ROUND8(pcacheSize); - pPager->fd = (sqlite3_file*)pPtr; pPtr += ROUND8(pVfs->szOsFile); - pPager->sjfd = (sqlite3_file*)pPtr; pPtr += journalFileSize; - pPager->jfd = (sqlite3_file*)pPtr; pPtr += journalFileSize; + pPager->fd = (tdsqlite3_file*)pPtr; pPtr += ROUND8(pVfs->szOsFile); + pPager->sjfd = (tdsqlite3_file*)pPtr; pPtr += journalFileSize; + pPager->jfd = (tdsqlite3_file*)pPtr; pPtr += journalFileSize; assert( EIGHT_BYTE_ALIGNMENT(pPager->jfd) ); @@ -61409,8 +61409,8 @@ SQLITE_PRIVATE int sqlite3PagerOpen( memcpy(pPtr, zPathname, nPathname); pPtr += nPathname; memcpy(pPtr, "-journal",8); pPtr += 8 + 1; #ifdef SQLITE_ENABLE_8_3_NAMES - sqlite3FileSuffix3(zFilename,pPager->zJournal); - pPtr = (u8*)(pPager->zJournal + sqlite3Strlen30(pPager->zJournal)+1); + tdsqlite3FileSuffix3(zFilename,pPager->zJournal); + pPtr = (u8*)(pPager->zJournal + tdsqlite3Strlen30(pPager->zJournal)+1); #endif }else{ pPager->zJournal = 0; @@ -61425,8 +61425,8 @@ SQLITE_PRIVATE int sqlite3PagerOpen( memcpy(pPtr, zPathname, nPathname); pPtr += nPathname; memcpy(pPtr, "-wal", 4); pPtr += 4 + 1; #ifdef SQLITE_ENABLE_8_3_NAMES - sqlite3FileSuffix3(zFilename, pPager->zWal); - pPtr = (u8*)(pPager->zWal + sqlite3Strlen30(pPager->zWal)+1); + tdsqlite3FileSuffix3(zFilename, pPager->zWal); + pPtr = (u8*)(pPager->zWal + tdsqlite3Strlen30(pPager->zWal)+1); #endif }else{ pPager->zWal = 0; @@ -61442,10 +61442,10 @@ SQLITE_PRIVATE int sqlite3PagerOpen( if( zUri ){ memcpy(pPtr, zUri, nUriByte); /* pPtr += nUriByte; // not needed */ } - /* Double-zero terminator implied by the sqlite3MallocZero */ + /* Double-zero terminator implied by the tdsqlite3MallocZero */ } - if( nPathname ) sqlite3DbFree(0, zPathname); + if( nPathname ) tdsqlite3DbFree(0, zPathname); pPager->pVfs = pVfs; pPager->vfsFlags = vfsFlags; @@ -61453,7 +61453,7 @@ SQLITE_PRIVATE int sqlite3PagerOpen( */ if( zFilename && zFilename[0] ){ int fout = 0; /* VFS flags returned by xOpen() */ - rc = sqlite3OsOpen(pVfs, pPager->zFilename, pPager->fd, vfsFlags, &fout); + rc = tdsqlite3OsOpen(pVfs, pPager->zFilename, pPager->fd, vfsFlags, &fout); assert( !memDb ); #ifdef SQLITE_ENABLE_DESERIALIZE memJM = (fout&SQLITE_OPEN_MEMORY)!=0; @@ -61465,11 +61465,11 @@ SQLITE_PRIVATE int sqlite3PagerOpen( ** database file. The default page size is the maximum of: ** ** + SQLITE_DEFAULT_PAGE_SIZE, - ** + The value returned by sqlite3OsSectorSize() + ** + The value returned by tdsqlite3OsSectorSize() ** + The largest page size that can be written atomically. */ if( rc==SQLITE_OK ){ - int iDc = sqlite3OsDeviceCharacteristics(pPager->fd); + int iDc = tdsqlite3OsDeviceCharacteristics(pPager->fd); if( !readOnly ){ setSectorSize(pPager); assert(SQLITE_DEFAULT_PAGE_SIZE<=SQLITE_MAX_DEFAULT_PAGE_SIZE); @@ -61494,9 +61494,9 @@ SQLITE_PRIVATE int sqlite3PagerOpen( } #endif } - pPager->noLock = sqlite3_uri_boolean(pPager->zFilename, "nolock", 0); + pPager->noLock = tdsqlite3_uri_boolean(pPager->zFilename, "nolock", 0); if( (iDc & SQLITE_IOCAP_IMMUTABLE)!=0 - || sqlite3_uri_boolean(pPager->zFilename, "immutable", 0) ){ + || tdsqlite3_uri_boolean(pPager->zFilename, "immutable", 0) ){ vfsFlags |= SQLITE_OPEN_READONLY; goto act_like_temp_file; } @@ -61525,7 +61525,7 @@ act_like_temp_file: */ if( rc==SQLITE_OK ){ assert( pPager->memDb==0 ); - rc = sqlite3PagerSetPagesize(pPager, &szPageDflt, -1); + rc = tdsqlite3PagerSetPagesize(pPager, &szPageDflt, -1); testcase( rc!=SQLITE_OK ); } @@ -61533,16 +61533,16 @@ act_like_temp_file: if( rc==SQLITE_OK ){ nExtra = ROUND8(nExtra); assert( nExtra>=8 && nExtra<1000 ); - rc = sqlite3PcacheOpen(szPageDflt, nExtra, !memDb, + rc = tdsqlite3PcacheOpen(szPageDflt, nExtra, !memDb, !memDb?pagerStress:0, (void *)pPager, pPager->pPCache); } /* If an error occurred above, free the Pager structure and close the file. */ if( rc!=SQLITE_OK ){ - sqlite3OsClose(pPager->fd); - sqlite3PageFree(pPager->pTmpSpace); - sqlite3_free(pPager); + tdsqlite3OsClose(pPager->fd); + tdsqlite3PageFree(pPager->pTmpSpace); + tdsqlite3_free(pPager); return rc; } @@ -61637,7 +61637,7 @@ act_like_temp_file: ** code is returned and the value of *pExists is undefined. */ static int hasHotJournal(Pager *pPager, int *pExists){ - sqlite3_vfs * const pVfs = pPager->pVfs; + tdsqlite3_vfs * const pVfs = pPager->pVfs; int rc = SQLITE_OK; /* Return code */ int exists = 1; /* True if a journal file is present */ int jrnlOpen = !!isOpen(pPager->jfd); @@ -61646,26 +61646,26 @@ static int hasHotJournal(Pager *pPager, int *pExists){ assert( isOpen(pPager->fd) ); assert( pPager->eState==PAGER_OPEN ); - assert( jrnlOpen==0 || ( sqlite3OsDeviceCharacteristics(pPager->jfd) & + assert( jrnlOpen==0 || ( tdsqlite3OsDeviceCharacteristics(pPager->jfd) & SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN )); *pExists = 0; if( !jrnlOpen ){ - rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists); + rc = tdsqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists); } if( rc==SQLITE_OK && exists ){ int locked = 0; /* True if some process holds a RESERVED lock */ /* Race condition here: Another process might have been holding the - ** the RESERVED lock and have a journal open at the sqlite3OsAccess() + ** the RESERVED lock and have a journal open at the tdsqlite3OsAccess() ** call above, but then delete the journal and drop the lock before - ** we get to the following sqlite3OsCheckReservedLock() call. If that + ** we get to the following tdsqlite3OsCheckReservedLock() call. If that ** is the case, this routine might think there is a hot journal when ** in fact there is none. This results in a false-positive which will ** be dealt with by the playback routine. Ticket #3883. */ - rc = sqlite3OsCheckReservedLock(pPager->fd, &locked); + rc = tdsqlite3OsCheckReservedLock(pPager->fd, &locked); if( rc==SQLITE_OK && !locked ){ Pgno nPage; /* Number of pages in database file */ @@ -61681,12 +61681,12 @@ static int hasHotJournal(Pager *pPager, int *pExists){ ** journal_mode=PERSIST. */ if( nPage==0 && !jrnlOpen ){ - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); if( pagerLockDb(pPager, RESERVED_LOCK)==SQLITE_OK ){ - sqlite3OsDelete(pVfs, pPager->zJournal, 0); + tdsqlite3OsDelete(pVfs, pPager->zJournal, 0); if( !pPager->exclusiveMode ) pagerUnlockDb(pPager, SHARED_LOCK); } - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); }else{ /* The journal file exists and no other connection has a reserved ** or greater lock on the database file. Now check that there is @@ -61696,16 +61696,16 @@ static int hasHotJournal(Pager *pPager, int *pExists){ */ if( !jrnlOpen ){ int f = SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL; - rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &f); + rc = tdsqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &f); } if( rc==SQLITE_OK ){ u8 first = 0; - rc = sqlite3OsRead(pPager->jfd, (void *)&first, 1, 0); + rc = tdsqlite3OsRead(pPager->jfd, (void *)&first, 1, 0); if( rc==SQLITE_IOERR_SHORT_READ ){ rc = SQLITE_OK; } if( !jrnlOpen ){ - sqlite3OsClose(pPager->jfd); + tdsqlite3OsClose(pPager->jfd); } *pExists = (first!=0); }else if( rc==SQLITE_CANTOPEN ){ @@ -61731,7 +61731,7 @@ static int hasHotJournal(Pager *pPager, int *pExists){ /* ** This function is called to obtain a shared lock on the database file. -** It is illegal to call sqlite3PagerGet() until after this function +** It is illegal to call tdsqlite3PagerGet() until after this function ** has been successfully called. If a shared-lock is already held when ** this function is called, it is a no-op. ** @@ -61756,14 +61756,14 @@ static int hasHotJournal(Pager *pPager, int *pExists){ ** occurs while locking the database, checking for a hot-journal file or ** rolling back a journal file, the IO error code is returned. */ -SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){ +SQLITE_PRIVATE int tdsqlite3PagerSharedLock(Pager *pPager){ int rc = SQLITE_OK; /* Return code */ /* This routine is only called from b-tree and only when there are no ** outstanding pages. This implies that the pager state should either ** be OPEN or READER. READER is only possible if the pager is or was in ** exclusive access mode. */ - assert( sqlite3PcacheRefCount(pPager->pPCache)==0 ); + assert( tdsqlite3PcacheRefCount(pPager->pPCache)==0 ); assert( assert_pager_state(pPager) ); assert( pPager->eState==PAGER_OPEN || pPager->eState==PAGER_READER ); assert( pPager->errCode==SQLITE_OK ); @@ -61829,19 +61829,19 @@ SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){ ** function was called and the journal file does not exist. */ if( !isOpen(pPager->jfd) ){ - sqlite3_vfs * const pVfs = pPager->pVfs; + tdsqlite3_vfs * const pVfs = pPager->pVfs; int bExists; /* True if journal file exists */ - rc = sqlite3OsAccess( + rc = tdsqlite3OsAccess( pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &bExists); if( rc==SQLITE_OK && bExists ){ int fout = 0; int f = SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_JOURNAL; assert( !pPager->tempFile ); - rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &fout); + rc = tdsqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &fout); assert( rc!=SQLITE_OK || isOpen(pPager->jfd) ); if( rc==SQLITE_OK && fout&SQLITE_OPEN_READONLY ){ rc = SQLITE_CANTOPEN_BKPT; - sqlite3OsClose(pPager->jfd); + tdsqlite3OsClose(pPager->jfd); } } } @@ -61897,7 +61897,7 @@ SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){ ** see if the database has been modified. If the database has changed, ** flush the cache. The hasHeldSharedLock flag prevents this from ** occurring on the very first access to a file, in order to save a - ** single unnecessary sqlite3OsRead() call at the start-up. + ** single unnecessary tdsqlite3OsRead() call at the start-up. ** ** Database changes are detected by looking at 15 bytes beginning ** at offset 24 into the file. The first 4 of these 16 bytes are @@ -61912,7 +61912,7 @@ SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){ char dbFileVers[sizeof(pPager->dbFileVers)]; IOTRACE(("CKVERS %p %d\n", pPager, sizeof(dbFileVers))); - rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24); + rc = tdsqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24); if( rc!=SQLITE_OK ){ if( rc!=SQLITE_IOERR_SHORT_READ ){ goto failed; @@ -61930,7 +61930,7 @@ SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){ ** to be the right size but is not actually valid. Avoid this ** possibility by unmapping the db here. */ if( USEFETCH(pPager) ){ - sqlite3OsUnfetch(pPager->fd, 0, 0); + tdsqlite3OsUnfetch(pPager->fd, 0, 0); } } } @@ -61974,7 +61974,7 @@ SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){ ** nothing to rollback, so this routine is a no-op. */ static void pagerUnlockIfUnused(Pager *pPager){ - if( sqlite3PcacheRefCount(pPager->pPCache)==0 ){ + if( tdsqlite3PcacheRefCount(pPager->pPCache)==0 ){ assert( pPager->nMmapOut==0 ); /* because page1 is never memory mapped */ pagerUnlockAndRollback(pPager); } @@ -62023,13 +62023,13 @@ static void pagerUnlockIfUnused(Pager *pPager){ ** to pgno in Pager.pInJournal (bitvec of pages already written to the ** journal file) and the PagerSavepoint.pInSavepoint bitvecs of any open ** savepoints are set. This means if the page is made writable at any -** point in the future, using a call to sqlite3PagerWrite(), its contents +** point in the future, using a call to tdsqlite3PagerWrite(), its contents ** will not be journaled. This saves IO. ** ** The acquisition might fail for several reasons. In all cases, ** an appropriate error code is returned and *ppPage is set to NULL. ** -** See also sqlite3PagerLookup(). Both this routine and Lookup() attempt +** See also tdsqlite3PagerLookup(). Both this routine and Lookup() attempt ** to find a page in the in-memory cache first. If the page is not already ** in memory, this routine goes to disk to read it in whereas Lookup() ** just returns 0. This routine acquires a read-lock the first time it @@ -62046,7 +62046,7 @@ static int getPageNormal( int rc = SQLITE_OK; PgHdr *pPg; u8 noContent; /* True if PAGER_GET_NOCONTENT is set */ - sqlite3_pcache_page *pBase; + tdsqlite3_pcache_page *pBase; assert( pPager->errCode==SQLITE_OK ); assert( pPager->eState>=PAGER_READER ); @@ -62054,17 +62054,17 @@ static int getPageNormal( assert( pPager->hasHeldSharedLock==1 ); if( pgno==0 ) return SQLITE_CORRUPT_BKPT; - pBase = sqlite3PcacheFetch(pPager->pPCache, pgno, 3); + pBase = tdsqlite3PcacheFetch(pPager->pPCache, pgno, 3); if( pBase==0 ){ pPg = 0; - rc = sqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase); + rc = tdsqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase); if( rc!=SQLITE_OK ) goto pager_acquire_err; if( pBase==0 ){ rc = SQLITE_NOMEM_BKPT; goto pager_acquire_err; } } - pPg = *ppPage = sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pBase); + pPg = *ppPage = tdsqlite3PcacheFetchFinish(pPager->pPCache, pgno, pBase); assert( pPg==(*ppPage) ); assert( pPg->pgno==pgno ); assert( pPg->pPager==pPager || pPg->pPager==0 ); @@ -62104,14 +62104,14 @@ static int getPageNormal( ** to test the case where a malloc error occurs while trying to set ** a bit in a bit vector. */ - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); if( pgno<=pPager->dbOrigSize ){ - TESTONLY( rc = ) sqlite3BitvecSet(pPager->pInJournal, pgno); + TESTONLY( rc = ) tdsqlite3BitvecSet(pPager->pInJournal, pgno); testcase( rc==SQLITE_NOMEM ); } TESTONLY( rc = ) addToSavepointBitvecs(pPager, pgno); testcase( rc==SQLITE_NOMEM ); - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); } memset(pPg->pData, 0, pPager->pageSize); IOTRACE(("ZERO %p %d\n", pPager, pgno)); @@ -62130,7 +62130,7 @@ static int getPageNormal( pager_acquire_err: assert( rc!=SQLITE_OK ); if( pPg ){ - sqlite3PcacheDrop(pPg); + tdsqlite3PcacheDrop(pPg); } pagerUnlockIfUnused(pPager); *ppPage = 0; @@ -62175,7 +62175,7 @@ static int getPageMMap( assert( pPager->errCode==SQLITE_OK ); if( bMmapOk && pagerUseWal(pPager) ){ - rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iFrame); + rc = tdsqlite3WalFindFrame(pPager->pWal, pgno, &iFrame); if( rc!=SQLITE_OK ){ *ppPage = 0; return rc; @@ -62183,17 +62183,17 @@ static int getPageMMap( } if( bMmapOk && iFrame==0 ){ void *pData = 0; - rc = sqlite3OsFetch(pPager->fd, + rc = tdsqlite3OsFetch(pPager->fd, (i64)(pgno-1) * pPager->pageSize, pPager->pageSize, &pData ); if( rc==SQLITE_OK && pData ){ if( pPager->eState>PAGER_READER || pPager->tempFile ){ - pPg = sqlite3PagerLookup(pPager, pgno); + pPg = tdsqlite3PagerLookup(pPager, pgno); } if( pPg==0 ){ rc = pagerAcquireMapPage(pPager, pgno, pData, &pPg); }else{ - sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1)*pPager->pageSize, pData); + tdsqlite3OsUnfetch(pPager->fd, (i64)(pgno-1)*pPager->pageSize, pData); } if( pPg ){ assert( rc==SQLITE_OK ); @@ -62227,7 +62227,7 @@ static int getPageError( /* Dispatch all page fetch requests to the appropriate getter method. */ -SQLITE_PRIVATE int sqlite3PagerGet( +SQLITE_PRIVATE int tdsqlite3PagerGet( Pager *pPager, /* The pager open on the database file */ Pgno pgno, /* Page number to fetch */ DbPage **ppPage, /* Write a pointer to the page here */ @@ -62241,58 +62241,58 @@ SQLITE_PRIVATE int sqlite3PagerGet( ** not read the page from disk. Return a pointer to the page, ** or 0 if the page is not in cache. ** -** See also sqlite3PagerGet(). The difference between this routine -** and sqlite3PagerGet() is that _get() will go to the disk and read +** See also tdsqlite3PagerGet(). The difference between this routine +** and tdsqlite3PagerGet() is that _get() will go to the disk and read ** in the page if the page is not already in cache. This routine ** returns NULL if the page is not in cache or if a disk I/O error ** has ever happened. */ -SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){ - sqlite3_pcache_page *pPage; +SQLITE_PRIVATE DbPage *tdsqlite3PagerLookup(Pager *pPager, Pgno pgno){ + tdsqlite3_pcache_page *pPage; assert( pPager!=0 ); assert( pgno!=0 ); assert( pPager->pPCache!=0 ); - pPage = sqlite3PcacheFetch(pPager->pPCache, pgno, 0); + pPage = tdsqlite3PcacheFetch(pPager->pPCache, pgno, 0); assert( pPage==0 || pPager->hasHeldSharedLock ); if( pPage==0 ) return 0; - return sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pPage); + return tdsqlite3PcacheFetchFinish(pPager->pPCache, pgno, pPage); } /* ** Release a page reference. ** -** The sqlite3PagerUnref() and sqlite3PagerUnrefNotNull() may only be +** The tdsqlite3PagerUnref() and tdsqlite3PagerUnrefNotNull() may only be ** used if we know that the page being released is not the last page. ** The btree layer always holds page1 open until the end, so these first ** to routines can be used to release any page other than BtShared.pPage1. ** -** Use sqlite3PagerUnrefPageOne() to release page1. This latter routine +** Use tdsqlite3PagerUnrefPageOne() to release page1. This latter routine ** checks the total number of outstanding pages and if the number of ** pages reaches zero it drops the database lock. */ -SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage *pPg){ +SQLITE_PRIVATE void tdsqlite3PagerUnrefNotNull(DbPage *pPg){ TESTONLY( Pager *pPager = pPg->pPager; ) assert( pPg!=0 ); if( pPg->flags & PGHDR_MMAP ){ assert( pPg->pgno!=1 ); /* Page1 is never memory mapped */ pagerReleaseMapPage(pPg); }else{ - sqlite3PcacheRelease(pPg); + tdsqlite3PcacheRelease(pPg); } /* Do not use this routine to release the last reference to page1 */ - assert( sqlite3PcacheRefCount(pPager->pPCache)>0 ); + assert( tdsqlite3PcacheRefCount(pPager->pPCache)>0 ); } -SQLITE_PRIVATE void sqlite3PagerUnref(DbPage *pPg){ - if( pPg ) sqlite3PagerUnrefNotNull(pPg); +SQLITE_PRIVATE void tdsqlite3PagerUnref(DbPage *pPg){ + if( pPg ) tdsqlite3PagerUnrefNotNull(pPg); } -SQLITE_PRIVATE void sqlite3PagerUnrefPageOne(DbPage *pPg){ +SQLITE_PRIVATE void tdsqlite3PagerUnrefPageOne(DbPage *pPg){ Pager *pPager; assert( pPg!=0 ); assert( pPg->pgno==1 ); assert( (pPg->flags & PGHDR_MMAP)==0 ); /* Page1 is never memory mapped */ pPager = pPg->pPager; - sqlite3PagerResetLockTimeout(pPager); - sqlite3PcacheRelease(pPg); + tdsqlite3PagerResetLockTimeout(pPager); + tdsqlite3PcacheRelease(pPg); pagerUnlockIfUnused(pPager); } @@ -62320,7 +62320,7 @@ SQLITE_PRIVATE void sqlite3PagerUnrefPageOne(DbPage *pPg){ */ static int pager_open_journal(Pager *pPager){ int rc = SQLITE_OK; /* Return code */ - sqlite3_vfs * const pVfs = pPager->pVfs; /* Local cache of vfs pointer */ + tdsqlite3_vfs * const pVfs = pPager->pVfs; /* Local cache of vfs pointer */ assert( pPager->eState==PAGER_WRITER_LOCKED ); assert( assert_pager_state(pPager) ); @@ -62332,7 +62332,7 @@ static int pager_open_journal(Pager *pPager){ if( NEVER(pPager->errCode) ) return pPager->errCode; if( !pagerUseWal(pPager) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){ - pPager->pInJournal = sqlite3BitvecCreate(pPager->dbSize); + pPager->pInJournal = tdsqlite3BitvecCreate(pPager->dbSize); if( pPager->pInJournal==0 ){ return SQLITE_NOMEM_BKPT; } @@ -62340,14 +62340,14 @@ static int pager_open_journal(Pager *pPager){ /* Open the journal file if it is not already open. */ if( !isOpen(pPager->jfd) ){ if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ){ - sqlite3MemJournalOpen(pPager->jfd); + tdsqlite3MemJournalOpen(pPager->jfd); }else{ int flags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE; int nSpill; if( pPager->tempFile ){ flags |= (SQLITE_OPEN_DELETEONCLOSE|SQLITE_OPEN_TEMP_JOURNAL); - nSpill = sqlite3Config.nStmtSpill; + nSpill = tdsqlite3Config.nStmtSpill; }else{ flags |= SQLITE_OPEN_MAIN_JOURNAL; nSpill = jrnlBufferSize(pPager); @@ -62357,7 +62357,7 @@ static int pager_open_journal(Pager *pPager){ ** it was originally opened. */ rc = databaseIsUnmoved(pPager); if( rc==SQLITE_OK ){ - rc = sqlite3JournalOpen ( + rc = tdsqlite3JournalOpen ( pVfs, pPager->zJournal, pPager->jfd, flags, nSpill ); } @@ -62380,7 +62380,7 @@ static int pager_open_journal(Pager *pPager){ } if( rc!=SQLITE_OK ){ - sqlite3BitvecDestroy(pPager->pInJournal); + tdsqlite3BitvecDestroy(pPager->pInJournal); pPager->pInJournal = 0; }else{ assert( pPager->eState==PAGER_WRITER_LOCKED ); @@ -62407,7 +62407,7 @@ static int pager_open_journal(Pager *pPager){ ** sub-journal is implemented in-memory if pPager is an in-memory database, ** or using a temporary file otherwise. */ -SQLITE_PRIVATE int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){ +SQLITE_PRIVATE int tdsqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){ int rc = SQLITE_OK; if( pPager->errCode ) return pPager->errCode; @@ -62421,12 +62421,12 @@ SQLITE_PRIVATE int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory /* If the pager is configured to use locking_mode=exclusive, and an ** exclusive lock on the database is not already held, obtain it now. */ - if( pPager->exclusiveMode && sqlite3WalExclusiveMode(pPager->pWal, -1) ){ + if( pPager->exclusiveMode && tdsqlite3WalExclusiveMode(pPager->pWal, -1) ){ rc = pagerLockDb(pPager, EXCLUSIVE_LOCK); if( rc!=SQLITE_OK ){ return rc; } - (void)sqlite3WalExclusiveMode(pPager->pWal, 1); + (void)tdsqlite3WalExclusiveMode(pPager->pWal, 1); } /* Grab the write lock on the log file. If successful, upgrade to @@ -62434,7 +62434,7 @@ SQLITE_PRIVATE int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory ** The busy-handler is not invoked if another connection already ** holds the write-lock. If possible, the upper layer will call it. */ - rc = sqlite3WalBeginWriteTransaction(pPager->pWal); + rc = tdsqlite3WalBeginWriteTransaction(pPager->pWal); }else{ /* Obtain a RESERVED lock on the database file. If the exFlag parameter ** is true, then immediately upgrade this to an EXCLUSIVE lock. The @@ -62503,14 +62503,14 @@ static SQLITE_NOINLINE int pagerAddPageToRollbackJournal(PgHdr *pPg){ rc = write32bits(pPager->jfd, iOff, pPg->pgno); if( rc!=SQLITE_OK ) return rc; - rc = sqlite3OsWrite(pPager->jfd, pData2, pPager->pageSize, iOff+4); + rc = tdsqlite3OsWrite(pPager->jfd, pData2, pPager->pageSize, iOff+4); if( rc!=SQLITE_OK ) return rc; rc = write32bits(pPager->jfd, iOff+pPager->pageSize+4, cksum); if( rc!=SQLITE_OK ) return rc; IOTRACE(("JOUT %p %d %lld %d\n", pPager, pPg->pgno, pPager->journalOff, pPager->pageSize)); - PAGER_INCR(sqlite3_pager_writej_count); + PAGER_INCR(tdsqlite3_pager_writej_count); PAGERTRACE(("JOURNAL %d page %d needSync=%d hash(%08x)\n", PAGERID(pPager), pPg->pgno, ((pPg->flags&PGHDR_NEED_SYNC)?1:0), pager_pagehash(pPg))); @@ -62518,7 +62518,7 @@ static SQLITE_NOINLINE int pagerAddPageToRollbackJournal(PgHdr *pPg){ pPager->journalOff += 8 + pPager->pageSize; pPager->nRec++; assert( pPager->pInJournal!=0 ); - rc = sqlite3BitvecSet(pPager->pInJournal, pPg->pgno); + rc = tdsqlite3BitvecSet(pPager->pInJournal, pPg->pgno); testcase( rc==SQLITE_NOMEM ); assert( rc==SQLITE_OK || rc==SQLITE_NOMEM ); rc |= addToSavepointBitvecs(pPager, pPg->pgno); @@ -62554,8 +62554,8 @@ static int pager_write(PgHdr *pPg){ ** obtained the necessary locks to begin the write-transaction, but the ** rollback journal might not yet be open. Open it now if this is the case. ** - ** This is done before calling sqlite3PcacheMakeDirty() on the page. - ** Otherwise, if it were done after calling sqlite3PcacheMakeDirty(), then + ** This is done before calling tdsqlite3PcacheMakeDirty() on the page. + ** Otherwise, if it were done after calling tdsqlite3PcacheMakeDirty(), then ** an error might occur and the pager would end up in WRITER_LOCKED state ** with pages marked as dirty in the cache. */ @@ -62567,7 +62567,7 @@ static int pager_write(PgHdr *pPg){ assert( assert_pager_state(pPager) ); /* Mark the page that is about to be modified as dirty. */ - sqlite3PcacheMakeDirty(pPg); + tdsqlite3PcacheMakeDirty(pPg); /* If a rollback journal is in use, them make sure the page that is about ** to change is in the rollback journal, or if the page is a new page off @@ -62575,7 +62575,7 @@ static int pager_write(PgHdr *pPg){ */ assert( (pPager->pInJournal!=0) == isOpen(pPager->jfd) ); if( pPager->pInJournal!=0 - && sqlite3BitvecTestNotNull(pPager->pInJournal, pPg->pgno)==0 + && tdsqlite3BitvecTestNotNull(pPager->pInJournal, pPg->pgno)==0 ){ assert( pagerUseWal(pPager)==0 ); if( pPg->pgno<=pPager->dbOrigSize ){ @@ -62615,7 +62615,7 @@ static int pager_write(PgHdr *pPg){ } /* -** This is a variant of sqlite3PagerWrite() that runs when the sector size +** This is a variant of tdsqlite3PagerWrite() that runs when the sector size ** is larger than the page size. SQLite makes the (reasonable) assumption that ** all bytes of a sector are written together by hardware. Hence, all bytes of ** a sector need to be journalled in case of a power loss in the middle of @@ -62664,22 +62664,22 @@ static SQLITE_NOINLINE int pagerWriteLargeSector(PgHdr *pPg){ for(ii=0; iipgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){ + if( pg==pPg->pgno || !tdsqlite3BitvecTest(pPager->pInJournal, pg) ){ if( pg!=PAGER_MJ_PGNO(pPager) ){ - rc = sqlite3PagerGet(pPager, pg, &pPage, 0); + rc = tdsqlite3PagerGet(pPager, pg, &pPage, 0); if( rc==SQLITE_OK ){ rc = pager_write(pPage); if( pPage->flags&PGHDR_NEED_SYNC ){ needSync = 1; } - sqlite3PagerUnrefNotNull(pPage); + tdsqlite3PagerUnrefNotNull(pPage); } } - }else if( (pPage = sqlite3PagerLookup(pPager, pg))!=0 ){ + }else if( (pPage = tdsqlite3PagerLookup(pPager, pg))!=0 ){ if( pPage->flags&PGHDR_NEED_SYNC ){ needSync = 1; } - sqlite3PagerUnrefNotNull(pPage); + tdsqlite3PagerUnrefNotNull(pPage); } } @@ -62692,10 +62692,10 @@ static SQLITE_NOINLINE int pagerWriteLargeSector(PgHdr *pPg){ if( rc==SQLITE_OK && needSync ){ assert( !MEMDB ); for(ii=0; iiflags |= PGHDR_NEED_SYNC; - sqlite3PagerUnrefNotNull(pPage); + tdsqlite3PagerUnrefNotNull(pPage); } } } @@ -62719,7 +62719,7 @@ static SQLITE_NOINLINE int pagerWriteLargeSector(PgHdr *pPg){ ** If an error occurs, SQLITE_NOMEM or an IO error code is returned ** as appropriate. Otherwise, SQLITE_OK. */ -SQLITE_PRIVATE int sqlite3PagerWrite(PgHdr *pPg){ +SQLITE_PRIVATE int tdsqlite3PagerWrite(PgHdr *pPg){ Pager *pPager = pPg->pPager; assert( (pPg->flags & PGHDR_MMAP)==0 ); assert( pPager->eState>=PAGER_WRITER_LOCKED ); @@ -62739,11 +62739,11 @@ SQLITE_PRIVATE int sqlite3PagerWrite(PgHdr *pPg){ /* ** Return TRUE if the page given in the argument was previously passed -** to sqlite3PagerWrite(). In other words, return TRUE if it is ok +** to tdsqlite3PagerWrite(). In other words, return TRUE if it is ok ** to change the content of the page. */ #ifndef NDEBUG -SQLITE_PRIVATE int sqlite3PagerIswriteable(DbPage *pPg){ +SQLITE_PRIVATE int tdsqlite3PagerIswriteable(DbPage *pPg){ return pPg->flags & PGHDR_WRITEABLE; } #endif @@ -62768,7 +62768,7 @@ SQLITE_PRIVATE int sqlite3PagerIswriteable(DbPage *pPg){ ** to be written out to disk so that it may be read back in if the ** current transaction is rolled back. */ -SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){ +SQLITE_PRIVATE void tdsqlite3PagerDontWrite(PgHdr *pPg){ Pager *pPager = pPg->pPager; if( !pPager->tempFile && (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){ PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager))); @@ -62792,7 +62792,7 @@ SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){ ** unconditional update of the change counters. ** ** If the isDirectMode flag is zero, then this is done by calling -** sqlite3PagerWrite() on page 1, then modifying the contents of the +** tdsqlite3PagerWrite() on page 1, then modifying the contents of the ** page data. In this case the file will be updated when the current ** transaction is committed. ** @@ -62800,7 +62800,7 @@ SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){ ** with the SQLITE_ENABLE_ATOMIC_WRITE macro defined. In this case, ** if isDirect is non-zero, then the database file is updated directly ** by writing an updated version of page 1 using a call to the -** sqlite3OsWrite() function. +** tdsqlite3OsWrite() function. */ static int pager_incr_changecounter(Pager *pPager, int isDirectMode){ int rc = SQLITE_OK; @@ -62834,7 +62834,7 @@ static int pager_incr_changecounter(Pager *pPager, int isDirectMode){ assert( !pPager->tempFile && isOpen(pPager->fd) ); /* Open page 1 of the file for writing. */ - rc = sqlite3PagerGet(pPager, 1, &pPgHdr, 0); + rc = tdsqlite3PagerGet(pPager, 1, &pPgHdr, 0); assert( pPgHdr==0 || rc==SQLITE_OK ); /* If page one was fetched successfully, and this function is not @@ -62843,7 +62843,7 @@ static int pager_incr_changecounter(Pager *pPager, int isDirectMode){ ** above is always successful - hence the ALWAYS on rc==SQLITE_OK. */ if( !DIRECT_MODE && ALWAYS(rc==SQLITE_OK) ){ - rc = sqlite3PagerWrite(pPgHdr); + rc = tdsqlite3PagerWrite(pPgHdr); } if( rc==SQLITE_OK ){ @@ -62856,7 +62856,7 @@ static int pager_incr_changecounter(Pager *pPager, int isDirectMode){ assert( pPager->dbFileSize>0 ); CODEC2(pPager, pPgHdr->pData, 1, 6, rc=SQLITE_NOMEM_BKPT, zBuf); if( rc==SQLITE_OK ){ - rc = sqlite3OsWrite(pPager->fd, zBuf, pPager->pageSize, 0); + rc = tdsqlite3OsWrite(pPager->fd, zBuf, pPager->pageSize, 0); pPager->aStat[PAGER_STAT_WRITE]++; } if( rc==SQLITE_OK ){ @@ -62873,7 +62873,7 @@ static int pager_incr_changecounter(Pager *pPager, int isDirectMode){ } /* Release the page reference. */ - sqlite3PagerUnref(pPgHdr); + tdsqlite3PagerUnref(pPgHdr); } return rc; } @@ -62885,14 +62885,14 @@ static int pager_incr_changecounter(Pager *pPager, int isDirectMode){ ** If successful, or if called on a pager for which it is a no-op, this ** function returns SQLITE_OK. Otherwise, an IO error code is returned. */ -SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zMaster){ +SQLITE_PRIVATE int tdsqlite3PagerSync(Pager *pPager, const char *zMaster){ int rc = SQLITE_OK; void *pArg = (void*)zMaster; - rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC, pArg); + rc = tdsqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC, pArg); if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK; if( rc==SQLITE_OK && !pPager->noSync ){ assert( !MEMDB ); - rc = sqlite3OsSync(pPager->fd, pPager->syncFlags); + rc = tdsqlite3OsSync(pPager->fd, pPager->syncFlags); } return rc; } @@ -62908,7 +62908,7 @@ SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zMaster){ ** Otherwise, either SQLITE_BUSY or an SQLITE_IOERR_XXX error code is ** returned. */ -SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager *pPager){ +SQLITE_PRIVATE int tdsqlite3PagerExclusiveLock(Pager *pPager){ int rc = pPager->errCode; assert( assert_pager_state(pPager) ); if( rc==SQLITE_OK ){ @@ -62943,14 +62943,14 @@ SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager *pPager){ ** delete the master journal file if specified). ** ** Note that if zMaster==NULL, this does not overwrite a previous value -** passed to an sqlite3PagerCommitPhaseOne() call. +** passed to an tdsqlite3PagerCommitPhaseOne() call. ** ** If the final parameter - noSync - is true, then the database file itself -** is not synced. The caller must call sqlite3PagerSync() directly to +** is not synced. The caller must call tdsqlite3PagerSync() directly to ** sync the database file before calling CommitPhaseTwo() to delete the ** journal file in this case. */ -SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( +SQLITE_PRIVATE int tdsqlite3PagerCommitPhaseOne( Pager *pPager, /* Pager object */ const char *zMaster, /* If not NULL, the master journal name */ int noSync /* True to omit the xSync on the db file */ @@ -62968,7 +62968,7 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( if( NEVER(pPager->errCode) ) return pPager->errCode; /* Provide the ability to easily simulate an I/O error during testing */ - if( sqlite3FaultSim(400) ) return SQLITE_IOERR; + if( tdsqlite3FaultSim(400) ) return SQLITE_IOERR; PAGERTRACE(("DATABASE SYNC: File=%s zMaster=%s nSize=%d\n", pPager->zFilename, zMaster, pPager->dbSize)); @@ -62982,16 +62982,16 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( /* If this is an in-memory db, or no pages have been written to, or this ** function has already been called, it is mostly a no-op. However, any ** backup in progress needs to be restarted. */ - sqlite3BackupRestart(pPager->pBackup); + tdsqlite3BackupRestart(pPager->pBackup); }else{ PgHdr *pList; if( pagerUseWal(pPager) ){ PgHdr *pPageOne = 0; - pList = sqlite3PcacheDirtyList(pPager->pPCache); + pList = tdsqlite3PcacheDirtyList(pPager->pPCache); if( pList==0 ){ /* Must have at least one page for the WAL commit flag. ** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */ - rc = sqlite3PagerGet(pPager, 1, &pPageOne, 0); + rc = tdsqlite3PagerGet(pPager, 1, &pPageOne, 0); pList = pPageOne; pList->pDirty = 0; } @@ -62999,9 +62999,9 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( if( ALWAYS(pList) ){ rc = pagerWalFrames(pPager, pList, pPager->dbSize, 1); } - sqlite3PagerUnref(pPageOne); + tdsqlite3PagerUnref(pPageOne); if( rc==SQLITE_OK ){ - sqlite3PcacheCleanAll(pPager->pPCache); + tdsqlite3PcacheCleanAll(pPager->pPCache); } }else{ /* The bBatch boolean is true if the batch-atomic-write commit method @@ -63009,11 +63009,11 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( ** is enabled. */ #ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE - sqlite3_file *fd = pPager->fd; + tdsqlite3_file *fd = pPager->fd; int bBatch = zMaster==0 /* An SQLITE_IOCAP_BATCH_ATOMIC commit */ - && (sqlite3OsDeviceCharacteristics(fd) & SQLITE_IOCAP_BATCH_ATOMIC) + && (tdsqlite3OsDeviceCharacteristics(fd) & SQLITE_IOCAP_BATCH_ATOMIC) && !pPager->noSync - && sqlite3JournalIsInMemory(pPager->jfd); + && tdsqlite3JournalIsInMemory(pPager->jfd); #else # define bBatch 0 #endif @@ -63032,7 +63032,7 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( ** If the optimization was not enabled at compile time, then the ** pager_incr_changecounter() function is called to update the change ** counter in 'indirect-mode'. If the optimization is compiled in but - ** is not applicable to this transaction, call sqlite3JournalCreate() + ** is not applicable to this transaction, call tdsqlite3JournalCreate() ** to make sure the journal file has actually been created, then call ** pager_incr_changecounter() to update the change-counter in indirect ** mode. @@ -63051,7 +63051,7 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( if( !zMaster && isOpen(pPager->jfd) && pPager->journalOff==jrnlBufferSize(pPager) && pPager->dbSize>=pPager->dbOrigSize - && (!(pPg = sqlite3PcacheDirtyList(pPager->pPCache)) || 0==pPg->pDirty) + && (!(pPg = tdsqlite3PcacheDirtyList(pPager->pPCache)) || 0==pPg->pDirty) ){ /* Update the db file change counter via the direct-write method. The ** following call will modify the in-memory representation of page 1 @@ -63061,7 +63061,7 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( */ rc = pager_incr_changecounter(pPager, 1); }else{ - rc = sqlite3JournalCreate(pPager->jfd); + rc = tdsqlite3JournalCreate(pPager->jfd); if( rc==SQLITE_OK ){ rc = pager_incr_changecounter(pPager, 0); } @@ -63070,7 +63070,7 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( #else /* SQLITE_ENABLE_ATOMIC_WRITE */ #ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE if( zMaster ){ - rc = sqlite3JournalCreate(pPager->jfd); + rc = tdsqlite3JournalCreate(pPager->jfd); if( rc!=SQLITE_OK ) goto commit_phase_one_exit; assert( bBatch==0 ); } @@ -63100,29 +63100,29 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( rc = syncJournal(pPager, 0); if( rc!=SQLITE_OK ) goto commit_phase_one_exit; - pList = sqlite3PcacheDirtyList(pPager->pPCache); + pList = tdsqlite3PcacheDirtyList(pPager->pPCache); #ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE if( bBatch ){ - rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, 0); + rc = tdsqlite3OsFileControl(fd, SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, 0); if( rc==SQLITE_OK ){ rc = pager_write_pagelist(pPager, pList); if( rc==SQLITE_OK ){ - rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0); + rc = tdsqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0); } if( rc!=SQLITE_OK ){ - sqlite3OsFileControlHint(fd, SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE, 0); + tdsqlite3OsFileControlHint(fd, SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE, 0); } } if( (rc&0xFF)==SQLITE_IOERR && rc!=SQLITE_IOERR_NOMEM ){ - rc = sqlite3JournalCreate(pPager->jfd); + rc = tdsqlite3JournalCreate(pPager->jfd); if( rc!=SQLITE_OK ){ - sqlite3OsClose(pPager->jfd); + tdsqlite3OsClose(pPager->jfd); goto commit_phase_one_exit; } bBatch = 0; }else{ - sqlite3OsClose(pPager->jfd); + tdsqlite3OsClose(pPager->jfd); } } #endif /* SQLITE_ENABLE_BATCH_ATOMIC_WRITE */ @@ -63134,7 +63134,7 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( assert( rc!=SQLITE_IOERR_BLOCKED ); goto commit_phase_one_exit; } - sqlite3PcacheCleanAll(pPager->pPCache); + tdsqlite3PcacheCleanAll(pPager->pPCache); /* If the file on disk is smaller than the database image, use ** pager_truncate to grow the file here. This can happen if the database @@ -63151,7 +63151,7 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( /* Finally, sync the database file. */ if( !noSync ){ - rc = sqlite3PagerSync(pPager, zMaster); + rc = tdsqlite3PagerSync(pPager, zMaster); } IOTRACE(("DBSYNC %p\n", pPager)) } @@ -63180,7 +63180,7 @@ commit_phase_one_exit: ** If an error occurs, an IO error code is returned and the pager ** moves into the error state. Otherwise, SQLITE_OK is returned. */ -SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager *pPager){ +SQLITE_PRIVATE int tdsqlite3PagerCommitPhaseTwo(Pager *pPager){ int rc = SQLITE_OK; /* Return code */ /* This routine should not be called if a prior error has occurred. @@ -63246,7 +63246,7 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager *pPager){ ** their pre-transaction state by re-reading data from the database or ** WAL files. The WAL transaction is then closed. */ -SQLITE_PRIVATE int sqlite3PagerRollback(Pager *pPager){ +SQLITE_PRIVATE int tdsqlite3PagerRollback(Pager *pPager){ int rc = SQLITE_OK; /* Return code */ PAGERTRACE(("ROLLBACK %d\n", PAGERID(pPager))); @@ -63260,7 +63260,7 @@ SQLITE_PRIVATE int sqlite3PagerRollback(Pager *pPager){ if( pagerUseWal(pPager) ){ int rc2; - rc = sqlite3PagerSavepoint(pPager, SAVEPOINT_ROLLBACK, -1); + rc = tdsqlite3PagerSavepoint(pPager, SAVEPOINT_ROLLBACK, -1); rc2 = pager_end_transaction(pPager, pPager->setMaster, 0); if( rc==SQLITE_OK ) rc = rc2; }else if( !isOpen(pPager->jfd) || pPager->eState==PAGER_WRITER_LOCKED ){ @@ -63296,7 +63296,7 @@ SQLITE_PRIVATE int sqlite3PagerRollback(Pager *pPager){ ** Return TRUE if the database file is opened read-only. Return FALSE ** if the database is (in theory) writable. */ -SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager *pPager){ +SQLITE_PRIVATE u8 tdsqlite3PagerIsreadonly(Pager *pPager){ return pPager->readOnly; } @@ -63304,8 +63304,8 @@ SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager *pPager){ /* ** Return the sum of the reference counts for all pages held by pPager. */ -SQLITE_PRIVATE int sqlite3PagerRefcount(Pager *pPager){ - return sqlite3PcacheRefCount(pPager->pPCache); +SQLITE_PRIVATE int tdsqlite3PagerRefcount(Pager *pPager){ + return tdsqlite3PcacheRefCount(pPager->pPCache); } #endif @@ -63313,30 +63313,30 @@ SQLITE_PRIVATE int sqlite3PagerRefcount(Pager *pPager){ ** Return the approximate number of bytes of memory currently ** used by the pager and its associated cache. */ -SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager *pPager){ +SQLITE_PRIVATE int tdsqlite3PagerMemUsed(Pager *pPager){ int perPageSize = pPager->pageSize + pPager->nExtra + sizeof(PgHdr) + 5*sizeof(void*); - return perPageSize*sqlite3PcachePagecount(pPager->pPCache) - + sqlite3MallocSize(pPager) + return perPageSize*tdsqlite3PcachePagecount(pPager->pPCache) + + tdsqlite3MallocSize(pPager) + pPager->pageSize; } /* ** Return the number of references to the specified page. */ -SQLITE_PRIVATE int sqlite3PagerPageRefcount(DbPage *pPage){ - return sqlite3PcachePageRefcount(pPage); +SQLITE_PRIVATE int tdsqlite3PagerPageRefcount(DbPage *pPage){ + return tdsqlite3PcachePageRefcount(pPage); } #ifdef SQLITE_TEST /* ** This routine is used for testing and analysis only. */ -SQLITE_PRIVATE int *sqlite3PagerStats(Pager *pPager){ +SQLITE_PRIVATE int *tdsqlite3PagerStats(Pager *pPager){ static int a[11]; - a[0] = sqlite3PcacheRefCount(pPager->pPCache); - a[1] = sqlite3PcachePagecount(pPager->pPCache); - a[2] = sqlite3PcacheGetCachesize(pPager->pPCache); + a[0] = tdsqlite3PcacheRefCount(pPager->pPCache); + a[1] = tdsqlite3PcachePagecount(pPager->pPCache); + a[2] = tdsqlite3PcacheGetCachesize(pPager->pPCache); a[3] = pPager->eState==PAGER_OPEN ? -1 : (int) pPager->dbSize; a[4] = pPager->eState; a[5] = pPager->errCode; @@ -63360,7 +63360,7 @@ SQLITE_PRIVATE int *sqlite3PagerStats(Pager *pPager){ ** reset parameter is non-zero, the cache hit or miss count is zeroed before ** returning. */ -SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, int *pnVal){ +SQLITE_PRIVATE void tdsqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, int *pnVal){ assert( eStat==SQLITE_DBSTATUS_CACHE_HIT || eStat==SQLITE_DBSTATUS_CACHE_MISS @@ -63383,7 +63383,7 @@ SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, i /* ** Return true if this is an in-memory or temp-file backed pager. */ -SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager *pPager){ +SQLITE_PRIVATE int tdsqlite3PagerIsMemdb(Pager *pPager){ return pPager->tempFile; } @@ -63411,7 +63411,7 @@ static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){ ** if the allocation fails. Otherwise, zero the new portion in case a ** malloc failure occurs while populating it in the for(...) loop below. */ - aNew = (PagerSavepoint *)sqlite3Realloc( + aNew = (PagerSavepoint *)tdsqlite3Realloc( pPager->aSavepoint, sizeof(PagerSavepoint)*nSavepoint ); if( !aNew ){ @@ -63429,12 +63429,12 @@ static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){ aNew[ii].iOffset = JOURNAL_HDR_SZ(pPager); } aNew[ii].iSubRec = pPager->nSubRec; - aNew[ii].pInSavepoint = sqlite3BitvecCreate(pPager->dbSize); + aNew[ii].pInSavepoint = tdsqlite3BitvecCreate(pPager->dbSize); if( !aNew[ii].pInSavepoint ){ return SQLITE_NOMEM_BKPT; } if( pagerUseWal(pPager) ){ - sqlite3WalSavepoint(pPager->pWal, aNew[ii].aWalData); + tdsqlite3WalSavepoint(pPager->pWal, aNew[ii].aWalData); } pPager->nSavepoint = ii+1; } @@ -63442,7 +63442,7 @@ static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){ assertTruncateConstraint(pPager); return rc; } -SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoint){ +SQLITE_PRIVATE int tdsqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoint){ assert( pPager->eState>=PAGER_WRITER_LOCKED ); assert( assert_pager_state(pPager) ); @@ -63472,7 +63472,7 @@ SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoint){ ** ** If a negative value is passed to this function, then the current ** transaction is rolled back. This is different to calling -** sqlite3PagerRollback() because this function does not terminate +** tdsqlite3PagerRollback() because this function does not terminate ** the transaction or unlock the database, it just restores the ** contents of the database to its original state. ** @@ -63484,7 +63484,7 @@ SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoint){ ** or an IO error code if an IO error occurs while rolling back a ** savepoint. If no errors occur, SQLITE_OK is returned. */ -SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){ +SQLITE_PRIVATE int tdsqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){ int rc = pPager->errCode; #ifdef SQLITE_ENABLE_ZIPVFS @@ -63504,7 +63504,7 @@ SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){ */ nNew = iSavepoint + (( op==SAVEPOINT_RELEASE ) ? 0 : 1); for(ii=nNew; iinSavepoint; ii++){ - sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint); + tdsqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint); } pPager->nSavepoint = nNew; @@ -63513,8 +63513,8 @@ SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){ if( op==SAVEPOINT_RELEASE ){ if( nNew==0 && isOpen(pPager->sjfd) ){ /* Only truncate if it is an in-memory sub-journal. */ - if( sqlite3JournalIsInMemory(pPager->sjfd) ){ - rc = sqlite3OsTruncate(pPager->sjfd, 0); + if( tdsqlite3JournalIsInMemory(pPager->sjfd) ){ + rc = tdsqlite3OsTruncate(pPager->sjfd, 0); assert( rc==SQLITE_OK ); } pPager->nSubRec = 0; @@ -63561,9 +63561,9 @@ SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){ ** participate in shared-cache. ** ** The return value to this routine is always safe to use with -** sqlite3_uri_parameter() and sqlite3_filename_database() and friends. +** tdsqlite3_uri_parameter() and tdsqlite3_filename_database() and friends. */ -SQLITE_PRIVATE const char *sqlite3PagerFilename(const Pager *pPager, int nullIfMemDb){ +SQLITE_PRIVATE const char *tdsqlite3PagerFilename(const Pager *pPager, int nullIfMemDb){ static const char zFake[] = { 0x00, 0x01, 0x00, 0x00, 0x00 }; return (nullIfMemDb && pPager->memDb) ? &zFake[3] : pPager->zFilename; } @@ -63571,7 +63571,7 @@ SQLITE_PRIVATE const char *sqlite3PagerFilename(const Pager *pPager, int nullIfM /* ** Return the VFS structure for the pager. */ -SQLITE_PRIVATE sqlite3_vfs *sqlite3PagerVfs(Pager *pPager){ +SQLITE_PRIVATE tdsqlite3_vfs *tdsqlite3PagerVfs(Pager *pPager){ return pPager->pVfs; } @@ -63580,7 +63580,7 @@ SQLITE_PRIVATE sqlite3_vfs *sqlite3PagerVfs(Pager *pPager){ ** with the pager. This might return NULL if the file has ** not yet been opened. */ -SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager *pPager){ +SQLITE_PRIVATE tdsqlite3_file *tdsqlite3PagerFile(Pager *pPager){ return pPager->fd; } @@ -63588,9 +63588,9 @@ SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager *pPager){ /* ** Reset the lock timeout for pager. */ -SQLITE_PRIVATE void sqlite3PagerResetLockTimeout(Pager *pPager){ +SQLITE_PRIVATE void tdsqlite3PagerResetLockTimeout(Pager *pPager){ int x = 0; - sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_LOCK_TIMEOUT, &x); + tdsqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_LOCK_TIMEOUT, &x); } #endif @@ -63598,18 +63598,18 @@ SQLITE_PRIVATE void sqlite3PagerResetLockTimeout(Pager *pPager){ ** Return the file handle for the journal file (if it exists). ** This will be either the rollback journal or the WAL file. */ -SQLITE_PRIVATE sqlite3_file *sqlite3PagerJrnlFile(Pager *pPager){ +SQLITE_PRIVATE tdsqlite3_file *tdsqlite3PagerJrnlFile(Pager *pPager){ #if SQLITE_OMIT_WAL return pPager->jfd; #else - return pPager->pWal ? sqlite3WalFile(pPager->pWal) : pPager->jfd; + return pPager->pWal ? tdsqlite3WalFile(pPager->pWal) : pPager->jfd; #endif } /* ** Return the full pathname of the journal file. */ -SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager *pPager){ +SQLITE_PRIVATE const char *tdsqlite3PagerJournalname(Pager *pPager){ return pPager->zJournal; } @@ -63617,7 +63617,7 @@ SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager *pPager){ /* ** Set or retrieve the codec for this pager */ -SQLITE_PRIVATE void sqlite3PagerSetCodec( +SQLITE_PRIVATE void tdsqlite3PagerSetCodec( Pager *pPager, void *(*xCodec)(void*,void*,Pgno,int), void (*xCodecSizeChng)(void*,int,int), @@ -63636,7 +63636,7 @@ SQLITE_PRIVATE void sqlite3PagerSetCodec( setGetterMethod(pPager); pagerReportSize(pPager); } -SQLITE_PRIVATE void *sqlite3PagerGetCodec(Pager *pPager){ +SQLITE_PRIVATE void *tdsqlite3PagerGetCodec(Pager *pPager){ return pPager->pCodec; } @@ -63647,7 +63647,7 @@ SQLITE_PRIVATE void *sqlite3PagerGetCodec(Pager *pPager){ ** This function returns a pointer to a buffer containing the encrypted ** page content. If a malloc fails, this function may return NULL. */ -SQLITE_PRIVATE void *sqlite3PagerCodec(PgHdr *pPg){ +SQLITE_PRIVATE void *tdsqlite3PagerCodec(PgHdr *pPg){ void *aData = 0; CODEC2(pPg->pPager, pPg->pData, pPg->pgno, 6, return 0, aData); return aData; @@ -63656,7 +63656,7 @@ SQLITE_PRIVATE void *sqlite3PagerCodec(PgHdr *pPg){ /* ** Return the current pager state */ -SQLITE_PRIVATE int sqlite3PagerState(Pager *pPager){ +SQLITE_PRIVATE int tdsqlite3PagerState(Pager *pPager){ return pPager->eState; } #endif /* SQLITE_HAS_CODEC */ @@ -63687,7 +63687,7 @@ SQLITE_PRIVATE int sqlite3PagerState(Pager *pPager){ ** This function may return SQLITE_NOMEM or an IO error code if an error ** occurs. Otherwise, it returns SQLITE_OK. */ -SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){ +SQLITE_PRIVATE int tdsqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){ PgHdr *pPgOld; /* The page being overwritten. */ Pgno needSyncPgno = 0; /* Old value of pPg->pgno, if sync is required */ int rc; /* Return code */ @@ -63704,7 +63704,7 @@ SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, i */ assert( pPager->tempFile || !MEMDB ); if( pPager->tempFile ){ - rc = sqlite3PagerWrite(pPg); + rc = tdsqlite3PagerWrite(pPg); if( rc ) return rc; } @@ -63756,34 +63756,34 @@ SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, i ** for the page moved there. */ pPg->flags &= ~PGHDR_NEED_SYNC; - pPgOld = sqlite3PagerLookup(pPager, pgno); + pPgOld = tdsqlite3PagerLookup(pPager, pgno); assert( !pPgOld || pPgOld->nRef==1 || CORRUPT_DB ); if( pPgOld ){ if( pPgOld->nRef>1 ){ - sqlite3PagerUnrefNotNull(pPgOld); + tdsqlite3PagerUnrefNotNull(pPgOld); return SQLITE_CORRUPT_BKPT; } pPg->flags |= (pPgOld->flags&PGHDR_NEED_SYNC); if( pPager->tempFile ){ /* Do not discard pages from an in-memory database since we might ** need to rollback later. Just move the page out of the way. */ - sqlite3PcacheMove(pPgOld, pPager->dbSize+1); + tdsqlite3PcacheMove(pPgOld, pPager->dbSize+1); }else{ - sqlite3PcacheDrop(pPgOld); + tdsqlite3PcacheDrop(pPgOld); } } origPgno = pPg->pgno; - sqlite3PcacheMove(pPg, pgno); - sqlite3PcacheMakeDirty(pPg); + tdsqlite3PcacheMove(pPg, pgno); + tdsqlite3PcacheMakeDirty(pPg); /* For an in-memory database, make sure the original page continues ** to exist, in case the transaction needs to roll back. Use pPgOld ** as the original page since it has already been allocated. */ if( pPager->tempFile && pPgOld ){ - sqlite3PcacheMove(pPgOld, origPgno); - sqlite3PagerUnrefNotNull(pPgOld); + tdsqlite3PcacheMove(pPgOld, origPgno); + tdsqlite3PagerUnrefNotNull(pPgOld); } if( needSyncPgno ){ @@ -63802,17 +63802,17 @@ SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, i ** the journal file twice, but that is not a problem. */ PgHdr *pPgHdr; - rc = sqlite3PagerGet(pPager, needSyncPgno, &pPgHdr, 0); + rc = tdsqlite3PagerGet(pPager, needSyncPgno, &pPgHdr, 0); if( rc!=SQLITE_OK ){ if( needSyncPgno<=pPager->dbOrigSize ){ assert( pPager->pTmpSpace!=0 ); - sqlite3BitvecClear(pPager->pInJournal, needSyncPgno, pPager->pTmpSpace); + tdsqlite3BitvecClear(pPager->pInJournal, needSyncPgno, pPager->pTmpSpace); } return rc; } pPgHdr->flags |= PGHDR_NEED_SYNC; - sqlite3PcacheMakeDirty(pPgHdr); - sqlite3PagerUnrefNotNull(pPgHdr); + tdsqlite3PcacheMakeDirty(pPgHdr); + tdsqlite3PagerUnrefNotNull(pPgHdr); } return SQLITE_OK; @@ -63825,16 +63825,16 @@ SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, i ** page number to iNew and sets the value of the PgHdr.flags field to ** the value passed as the third parameter. */ -SQLITE_PRIVATE void sqlite3PagerRekey(DbPage *pPg, Pgno iNew, u16 flags){ +SQLITE_PRIVATE void tdsqlite3PagerRekey(DbPage *pPg, Pgno iNew, u16 flags){ assert( pPg->pgno!=iNew ); pPg->flags = flags; - sqlite3PcacheMove(pPg, iNew); + tdsqlite3PcacheMove(pPg, iNew); } /* ** Return a pointer to the data for the specified page. */ -SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *pPg){ +SQLITE_PRIVATE void *tdsqlite3PagerGetData(DbPage *pPg){ assert( pPg->nRef>0 || pPg->pPager->memDb ); return pPg->pData; } @@ -63843,7 +63843,7 @@ SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *pPg){ ** Return a pointer to the Pager.nExtra bytes of "extra" space ** allocated along with the specified page. */ -SQLITE_PRIVATE void *sqlite3PagerGetExtra(DbPage *pPg){ +SQLITE_PRIVATE void *tdsqlite3PagerGetExtra(DbPage *pPg){ return pPg->pExtra; } @@ -63857,14 +63857,14 @@ SQLITE_PRIVATE void *sqlite3PagerGetExtra(DbPage *pPg){ ** PAGER_LOCKINGMODE_EXCLUSIVE, indicating the current (possibly updated) ** locking-mode. */ -SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *pPager, int eMode){ +SQLITE_PRIVATE int tdsqlite3PagerLockingMode(Pager *pPager, int eMode){ assert( eMode==PAGER_LOCKINGMODE_QUERY || eMode==PAGER_LOCKINGMODE_NORMAL || eMode==PAGER_LOCKINGMODE_EXCLUSIVE ); assert( PAGER_LOCKINGMODE_QUERY<0 ); assert( PAGER_LOCKINGMODE_NORMAL>=0 && PAGER_LOCKINGMODE_EXCLUSIVE>=0 ); - assert( pPager->exclusiveMode || 0==sqlite3WalHeapMemory(pPager->pWal) ); - if( eMode>=0 && !pPager->tempFile && !sqlite3WalHeapMemory(pPager->pWal) ){ + assert( pPager->exclusiveMode || 0==tdsqlite3WalHeapMemory(pPager->pWal) ); + if( eMode>=0 && !pPager->tempFile && !tdsqlite3WalHeapMemory(pPager->pWal) ){ pPager->exclusiveMode = (u8)eMode; } return (int)pPager->exclusiveMode; @@ -63890,7 +63890,7 @@ SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *pPager, int eMode){ ** ** The returned indicate the current (possibly updated) journal-mode. */ -SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ +SQLITE_PRIVATE int tdsqlite3PagerSetJournalMode(Pager *pPager, int eMode){ u8 eOld = pPager->journalMode; /* Prior journalmode */ /* The eMode parameter is always valid */ @@ -63945,22 +63945,22 @@ SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ ** database file. This ensures that the journal file is not deleted ** while it is in use by some other client. */ - sqlite3OsClose(pPager->jfd); + tdsqlite3OsClose(pPager->jfd); if( pPager->eLock>=RESERVED_LOCK ){ - sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); + tdsqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); }else{ int rc = SQLITE_OK; int state = pPager->eState; assert( state==PAGER_OPEN || state==PAGER_READER ); if( state==PAGER_OPEN ){ - rc = sqlite3PagerSharedLock(pPager); + rc = tdsqlite3PagerSharedLock(pPager); } if( pPager->eState==PAGER_READER ){ assert( rc==SQLITE_OK ); rc = pagerLockDb(pPager, RESERVED_LOCK); } if( rc==SQLITE_OK ){ - sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); + tdsqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); } if( rc==SQLITE_OK && state==PAGER_READER ){ pagerUnlockDb(pPager, SHARED_LOCK); @@ -63970,7 +63970,7 @@ SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ assert( state==pPager->eState ); } }else if( eMode==PAGER_JOURNALMODE_OFF ){ - sqlite3OsClose(pPager->jfd); + tdsqlite3OsClose(pPager->jfd); } } @@ -63981,7 +63981,7 @@ SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ /* ** Return the current journal mode. */ -SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager *pPager){ +SQLITE_PRIVATE int tdsqlite3PagerGetJournalMode(Pager *pPager){ return (int)pPager->journalMode; } @@ -63990,7 +63990,7 @@ SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager *pPager){ ** journalmode. Journalmode changes can only happen when the database ** is unmodified. */ -SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager *pPager){ +SQLITE_PRIVATE int tdsqlite3PagerOkToChangeJournalMode(Pager *pPager){ assert( assert_pager_state(pPager) ); if( pPager->eState>=PAGER_WRITER_CACHEMOD ) return 0; if( NEVER(isOpen(pPager->jfd) && pPager->journalOff>0) ) return 0; @@ -64003,10 +64003,10 @@ SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager *pPager){ ** Setting the size limit to -1 means no limit is enforced. ** An attempt to set a limit smaller than -1 is a no-op. */ -SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){ +SQLITE_PRIVATE i64 tdsqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){ if( iLimit>=-1 ){ pPager->journalSizeLimit = iLimit; - sqlite3WalLimit(pPager->pWal, iLimit); + tdsqlite3WalLimit(pPager->pWal, iLimit); } return pPager->journalSizeLimit; } @@ -64014,10 +64014,10 @@ SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){ /* ** Return a pointer to the pPager->pBackup variable. The backup module ** in backup.c maintains the content of this variable. This module -** uses it opaquely as an argument to sqlite3BackupRestart() and -** sqlite3BackupUpdate() only. +** uses it opaquely as an argument to tdsqlite3BackupRestart() and +** tdsqlite3BackupUpdate() only. */ -SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){ +SQLITE_PRIVATE tdsqlite3_backup **tdsqlite3PagerBackupPtr(Pager *pPager){ return &pPager->pBackup; } @@ -64025,7 +64025,7 @@ SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){ /* ** Unless this is an in-memory or temporary database, clear the pager cache. */ -SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *pPager){ +SQLITE_PRIVATE void tdsqlite3PagerClearCache(Pager *pPager){ assert( MEMDB==0 || pPager->tempFile ); if( pPager->tempFile==0 ) pager_reset(pPager); } @@ -64035,41 +64035,41 @@ SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *pPager){ #ifndef SQLITE_OMIT_WAL /* ** This function is called when the user invokes "PRAGMA wal_checkpoint", -** "PRAGMA wal_blocking_checkpoint" or calls the sqlite3_wal_checkpoint() +** "PRAGMA wal_blocking_checkpoint" or calls the tdsqlite3_wal_checkpoint() ** or wal_blocking_checkpoint() API functions. ** ** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART. */ -SQLITE_PRIVATE int sqlite3PagerCheckpoint( +SQLITE_PRIVATE int tdsqlite3PagerCheckpoint( Pager *pPager, /* Checkpoint on this pager */ - sqlite3 *db, /* Db handle used to check for interrupts */ + tdsqlite3 *db, /* Db handle used to check for interrupts */ int eMode, /* Type of checkpoint */ int *pnLog, /* OUT: Final number of frames in log */ int *pnCkpt /* OUT: Final number of checkpointed frames */ ){ int rc = SQLITE_OK; if( pPager->pWal ){ - rc = sqlite3WalCheckpoint(pPager->pWal, db, eMode, + rc = tdsqlite3WalCheckpoint(pPager->pWal, db, eMode, (eMode==SQLITE_CHECKPOINT_PASSIVE ? 0 : pPager->xBusyHandler), pPager->pBusyHandlerArg, pPager->walSyncFlags, pPager->pageSize, (u8 *)pPager->pTmpSpace, pnLog, pnCkpt ); - sqlite3PagerResetLockTimeout(pPager); + tdsqlite3PagerResetLockTimeout(pPager); } return rc; } -SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager){ - return sqlite3WalCallback(pPager->pWal); +SQLITE_PRIVATE int tdsqlite3PagerWalCallback(Pager *pPager){ + return tdsqlite3WalCallback(pPager->pWal); } /* ** Return true if the underlying VFS for the given pager supports the ** primitives necessary for write-ahead logging. */ -SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager){ - const sqlite3_io_methods *pMethods = pPager->fd->pMethods; +SQLITE_PRIVATE int tdsqlite3PagerWalSupported(Pager *pPager){ + const tdsqlite3_io_methods *pMethods = pPager->fd->pMethods; if( pPager->noLock ) return 0; return pPager->exclusiveMode || (pMethods->iVersion>=2 && pMethods->xShmMap); } @@ -64093,7 +64093,7 @@ static int pagerExclusiveLock(Pager *pPager){ } /* -** Call sqlite3WalOpen() to open the WAL handle. If the pager is in +** Call tdsqlite3WalOpen() to open the WAL handle. If the pager is in ** exclusive-locking mode when this function is called, take an EXCLUSIVE ** lock on the database file and use heap-memory to store the wal-index ** in. Otherwise, use the normal shared-memory. @@ -64117,7 +64117,7 @@ static int pagerOpenWal(Pager *pPager){ ** (e.g. due to malloc() failure), return an error code. */ if( rc==SQLITE_OK ){ - rc = sqlite3WalOpen(pPager->pVfs, + rc = tdsqlite3WalOpen(pPager->pVfs, pPager->fd, pPager->zWal, pPager->exclusiveMode, pPager->journalSizeLimit, &pPager->pWal ); @@ -64143,7 +64143,7 @@ static int pagerOpenWal(Pager *pPager){ ** the WAL file is already open, set *pbOpen to 1 and return SQLITE_OK ** without doing anything. */ -SQLITE_PRIVATE int sqlite3PagerOpenWal( +SQLITE_PRIVATE int tdsqlite3PagerOpenWal( Pager *pPager, /* Pager object */ int *pbOpen /* OUT: Set to true if call is a no-op */ ){ @@ -64156,10 +64156,10 @@ SQLITE_PRIVATE int sqlite3PagerOpenWal( assert( pbOpen!=0 || (!pPager->tempFile && !pPager->pWal) ); if( !pPager->tempFile && !pPager->pWal ){ - if( !sqlite3PagerWalSupported(pPager) ) return SQLITE_CANTOPEN; + if( !tdsqlite3PagerWalSupported(pPager) ) return SQLITE_CANTOPEN; /* Close any rollback journal previously open */ - sqlite3OsClose(pPager->jfd); + tdsqlite3OsClose(pPager->jfd); rc = pagerOpenWal(pPager); if( rc==SQLITE_OK ){ @@ -64182,7 +64182,7 @@ SQLITE_PRIVATE int sqlite3PagerOpenWal( ** error (SQLITE_BUSY) is returned and the log connection is not closed. ** If successful, the EXCLUSIVE lock is not released before returning. */ -SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager, sqlite3 *db){ +SQLITE_PRIVATE int tdsqlite3PagerCloseWal(Pager *pPager, tdsqlite3 *db){ int rc = SQLITE_OK; assert( pPager->journalMode==PAGER_JOURNALMODE_WAL ); @@ -64195,7 +64195,7 @@ SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager, sqlite3 *db){ int logexists = 0; rc = pagerLockDb(pPager, SHARED_LOCK); if( rc==SQLITE_OK ){ - rc = sqlite3OsAccess( + rc = tdsqlite3OsAccess( pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &logexists ); } @@ -64210,7 +64210,7 @@ SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager, sqlite3 *db){ if( rc==SQLITE_OK && pPager->pWal ){ rc = pagerExclusiveLock(pPager); if( rc==SQLITE_OK ){ - rc = sqlite3WalClose(pPager->pWal, db, pPager->walSyncFlags, + rc = tdsqlite3WalClose(pPager->pWal, db, pPager->walSyncFlags, pPager->pageSize, (u8*)pPager->pTmpSpace); pPager->pWal = 0; pagerFixMaplimit(pPager); @@ -64227,10 +64227,10 @@ SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager, sqlite3 *db){ ** If this is a WAL database, obtain a snapshot handle for the snapshot ** currently open. Otherwise, return an error. */ -SQLITE_PRIVATE int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot){ +SQLITE_PRIVATE int tdsqlite3PagerSnapshotGet(Pager *pPager, tdsqlite3_snapshot **ppSnapshot){ int rc = SQLITE_ERROR; if( pPager->pWal ){ - rc = sqlite3WalSnapshotGet(pPager->pWal, ppSnapshot); + rc = tdsqlite3WalSnapshotGet(pPager->pWal, ppSnapshot); } return rc; } @@ -64240,10 +64240,10 @@ SQLITE_PRIVATE int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppS ** read transaction is opened, attempt to read from the snapshot it ** identifies. If this is not a WAL database, return an error. */ -SQLITE_PRIVATE int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSnapshot){ +SQLITE_PRIVATE int tdsqlite3PagerSnapshotOpen(Pager *pPager, tdsqlite3_snapshot *pSnapshot){ int rc = SQLITE_OK; if( pPager->pWal ){ - sqlite3WalSnapshotOpen(pPager->pWal, pSnapshot); + tdsqlite3WalSnapshotOpen(pPager->pWal, pSnapshot); }else{ rc = SQLITE_ERROR; } @@ -64251,13 +64251,13 @@ SQLITE_PRIVATE int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSn } /* -** If this is a WAL database, call sqlite3WalSnapshotRecover(). If this +** If this is a WAL database, call tdsqlite3WalSnapshotRecover(). If this ** is not a WAL database, return an error. */ -SQLITE_PRIVATE int sqlite3PagerSnapshotRecover(Pager *pPager){ +SQLITE_PRIVATE int tdsqlite3PagerSnapshotRecover(Pager *pPager){ int rc; if( pPager->pWal ){ - rc = sqlite3WalSnapshotRecover(pPager->pWal); + rc = tdsqlite3WalSnapshotRecover(pPager->pWal); }else{ rc = SQLITE_ERROR; } @@ -64276,10 +64276,10 @@ SQLITE_PRIVATE int sqlite3PagerSnapshotRecover(Pager *pPager){ ** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER ** lock is released before returning. */ -SQLITE_PRIVATE int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot){ +SQLITE_PRIVATE int tdsqlite3PagerSnapshotCheck(Pager *pPager, tdsqlite3_snapshot *pSnapshot){ int rc; if( pPager->pWal ){ - rc = sqlite3WalSnapshotCheck(pPager->pWal, pSnapshot); + rc = tdsqlite3WalSnapshotCheck(pPager->pWal, pSnapshot); }else{ rc = SQLITE_ERROR; } @@ -64288,11 +64288,11 @@ SQLITE_PRIVATE int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pS /* ** Release a lock obtained by an earlier successful call to -** sqlite3PagerSnapshotCheck(). +** tdsqlite3PagerSnapshotCheck(). */ -SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager){ +SQLITE_PRIVATE void tdsqlite3PagerSnapshotUnlock(Pager *pPager){ assert( pPager->pWal ); - sqlite3WalSnapshotUnlock(pPager->pWal); + tdsqlite3WalSnapshotUnlock(pPager->pWal); } #endif /* SQLITE_ENABLE_SNAPSHOT */ @@ -64306,9 +64306,9 @@ SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager){ ** WAL frames. Otherwise, if this is not a WAL database or the WAL file ** is empty, return 0. */ -SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){ +SQLITE_PRIVATE int tdsqlite3PagerWalFramesize(Pager *pPager){ assert( pPager->eState>=PAGER_READER ); - return sqlite3WalFramesize(pPager->pWal); + return tdsqlite3WalFramesize(pPager->pWal); } #endif @@ -64317,17 +64317,17 @@ SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){ /* BEGIN SQLCIPHER */ #ifdef SQLITE_HAS_CODEC -SQLITE_API int sqlite3pager_is_mj_pgno(Pager *pPager, Pgno pgno) { +SQLITE_API int tdsqlite3pager_is_mj_pgno(Pager *pPager, Pgno pgno) { return (PAGER_MJ_PGNO(pPager) == pgno) ? 1 : 0; } -SQLITE_API void sqlite3pager_error(Pager *pPager, int error) { +SQLITE_API void tdsqlite3pager_error(Pager *pPager, int error) { pPager->errCode = error; pPager->eState = PAGER_ERROR; setGetterMethod(pPager); } -SQLITE_API void sqlite3pager_reset(Pager *pPager){ +SQLITE_API void tdsqlite3pager_reset(Pager *pPager){ pager_reset(pPager); } @@ -64591,8 +64591,8 @@ SQLITE_API void sqlite3pager_reset(Pager *pPager){ ** Trace output macros */ #if defined(SQLITE_TEST) && defined(SQLITE_DEBUG) -SQLITE_PRIVATE int sqlite3WalTrace = 0; -# define WALTRACE(X) if(sqlite3WalTrace) sqlite3DebugPrintf X +SQLITE_PRIVATE int tdsqlite3WalTrace = 0; +# define WALTRACE(X) if(tdsqlite3WalTrace) tdsqlite3DebugPrintf X #else # define WALTRACE(X) #endif @@ -64788,9 +64788,9 @@ struct WalCkptInfo { ** following object. */ struct Wal { - sqlite3_vfs *pVfs; /* The VFS used to create pDbFd */ - sqlite3_file *pDbFd; /* File handle for the database file */ - sqlite3_file *pWalFd; /* File handle for WAL file */ + tdsqlite3_vfs *pVfs; /* The VFS used to create pDbFd */ + tdsqlite3_file *pDbFd; /* File handle for the database file */ + tdsqlite3_file *pWalFd; /* File handle for WAL file */ u32 iCallback; /* Value to pass to log callback (or 0) */ i64 mxWalSize; /* Truncate WAL to this size upon reset */ int nWiData; /* Size of array apWiData */ @@ -64914,9 +64914,9 @@ static SQLITE_NOINLINE int walIndexPageRealloc( /* Enlarge the pWal->apWiData[] array if required */ if( pWal->nWiData<=iPage ){ - sqlite3_int64 nByte = sizeof(u32*)*(iPage+1); + tdsqlite3_int64 nByte = sizeof(u32*)*(iPage+1); volatile u32 **apNew; - apNew = (volatile u32 **)sqlite3_realloc64((void *)pWal->apWiData, nByte); + apNew = (volatile u32 **)tdsqlite3_realloc64((void *)pWal->apWiData, nByte); if( !apNew ){ *ppPage = 0; return SQLITE_NOMEM_BKPT; @@ -64930,10 +64930,10 @@ static SQLITE_NOINLINE int walIndexPageRealloc( /* Request a pointer to the required page from the VFS */ assert( pWal->apWiData[iPage]==0 ); if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){ - pWal->apWiData[iPage] = (u32 volatile *)sqlite3MallocZero(WALINDEX_PGSZ); + pWal->apWiData[iPage] = (u32 volatile *)tdsqlite3MallocZero(WALINDEX_PGSZ); if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM_BKPT; }else{ - rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ, + rc = tdsqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ, pWal->writeLock, (void volatile **)&pWal->apWiData[iPage] ); assert( pWal->apWiData[iPage]!=0 || rc!=SQLITE_OK || pWal->writeLock==0 ); @@ -65039,7 +65039,7 @@ static void walChecksumBytes( static void walShmBarrier(Wal *pWal){ if( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE ){ - sqlite3OsShmBarrier(pWal->pDbFd); + tdsqlite3OsShmBarrier(pWal->pDbFd); } } @@ -65084,8 +65084,8 @@ static void walEncodeFrame( int nativeCksum; /* True for native byte-order checksums */ u32 *aCksum = pWal->hdr.aFrameCksum; assert( WAL_FRAME_HDRSIZE==24 ); - sqlite3Put4byte(&aFrame[0], iPage); - sqlite3Put4byte(&aFrame[4], nTruncate); + tdsqlite3Put4byte(&aFrame[0], iPage); + tdsqlite3Put4byte(&aFrame[4], nTruncate); if( pWal->iReCksum==0 ){ memcpy(&aFrame[8], pWal->hdr.aSalt, 8); @@ -65093,8 +65093,8 @@ static void walEncodeFrame( walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum); walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum); - sqlite3Put4byte(&aFrame[16], aCksum[0]); - sqlite3Put4byte(&aFrame[20], aCksum[1]); + tdsqlite3Put4byte(&aFrame[16], aCksum[0]); + tdsqlite3Put4byte(&aFrame[20], aCksum[1]); }else{ memset(&aFrame[8], 0, 16); } @@ -65126,7 +65126,7 @@ static int walDecodeFrame( /* A frame is only valid if the page number is creater than zero. */ - pgno = sqlite3Get4byte(&aFrame[0]); + pgno = tdsqlite3Get4byte(&aFrame[0]); if( pgno==0 ){ return 0; } @@ -65139,8 +65139,8 @@ static int walDecodeFrame( nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN); walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum); walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum); - if( aCksum[0]!=sqlite3Get4byte(&aFrame[16]) - || aCksum[1]!=sqlite3Get4byte(&aFrame[20]) + if( aCksum[0]!=tdsqlite3Get4byte(&aFrame[16]) + || aCksum[1]!=tdsqlite3Get4byte(&aFrame[20]) ){ /* Checksum failed. */ return 0; @@ -65150,7 +65150,7 @@ static int walDecodeFrame( ** and the new database size. */ *piPage = pgno; - *pnTruncate = sqlite3Get4byte(&aFrame[4]); + *pnTruncate = tdsqlite3Get4byte(&aFrame[4]); return 1; } @@ -65169,7 +65169,7 @@ static const char *walLockName(int lockIdx){ return "RECOVER-LOCK"; }else{ static char zName[15]; - sqlite3_snprintf(sizeof(zName), zName, "READ-LOCK[%d]", + tdsqlite3_snprintf(sizeof(zName), zName, "READ-LOCK[%d]", lockIdx-WAL_READ_LOCK(0)); return zName; } @@ -65187,7 +65187,7 @@ static const char *walLockName(int lockIdx){ static int walLockShared(Wal *pWal, int lockIdx){ int rc; if( pWal->exclusiveMode ) return SQLITE_OK; - rc = sqlite3OsShmLock(pWal->pDbFd, lockIdx, 1, + rc = tdsqlite3OsShmLock(pWal->pDbFd, lockIdx, 1, SQLITE_SHM_LOCK | SQLITE_SHM_SHARED); WALTRACE(("WAL%p: acquire SHARED-%s %s\n", pWal, walLockName(lockIdx), rc ? "failed" : "ok")); @@ -65196,14 +65196,14 @@ static int walLockShared(Wal *pWal, int lockIdx){ } static void walUnlockShared(Wal *pWal, int lockIdx){ if( pWal->exclusiveMode ) return; - (void)sqlite3OsShmLock(pWal->pDbFd, lockIdx, 1, + (void)tdsqlite3OsShmLock(pWal->pDbFd, lockIdx, 1, SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED); WALTRACE(("WAL%p: release SHARED-%s\n", pWal, walLockName(lockIdx))); } static int walLockExclusive(Wal *pWal, int lockIdx, int n){ int rc; if( pWal->exclusiveMode ) return SQLITE_OK; - rc = sqlite3OsShmLock(pWal->pDbFd, lockIdx, n, + rc = tdsqlite3OsShmLock(pWal->pDbFd, lockIdx, n, SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE); WALTRACE(("WAL%p: acquire EXCLUSIVE-%s cnt=%d %s\n", pWal, walLockName(lockIdx), n, rc ? "failed" : "ok")); @@ -65212,7 +65212,7 @@ static int walLockExclusive(Wal *pWal, int lockIdx, int n){ } static void walUnlockExclusive(Wal *pWal, int lockIdx, int n){ if( pWal->exclusiveMode ) return; - (void)sqlite3OsShmLock(pWal->pDbFd, lockIdx, n, + (void)tdsqlite3OsShmLock(pWal->pDbFd, lockIdx, n, SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE); WALTRACE(("WAL%p: release EXCLUSIVE-%s cnt=%d\n", pWal, walLockName(lockIdx), n)); @@ -65505,7 +65505,7 @@ static int walIndexRecover(Wal *pWal){ memset(&pWal->hdr, 0, sizeof(WalIndexHdr)); - rc = sqlite3OsFileSize(pWal->pWalFd, &nSize); + rc = tdsqlite3OsFileSize(pWal->pWalFd, &nSize); if( rc!=SQLITE_OK ){ goto recovery_error; } @@ -65523,7 +65523,7 @@ static int walIndexRecover(Wal *pWal){ int isValid; /* True if this frame is valid */ /* Read in the WAL header. */ - rc = sqlite3OsRead(pWal->pWalFd, aBuf, WAL_HDRSIZE, 0); + rc = tdsqlite3OsRead(pWal->pWalFd, aBuf, WAL_HDRSIZE, 0); if( rc!=SQLITE_OK ){ goto recovery_error; } @@ -65533,8 +65533,8 @@ static int walIndexRecover(Wal *pWal){ ** data. Similarly, if the 'magic' value is invalid, ignore the whole ** WAL file. */ - magic = sqlite3Get4byte(&aBuf[0]); - szPage = sqlite3Get4byte(&aBuf[8]); + magic = tdsqlite3Get4byte(&aBuf[0]); + szPage = tdsqlite3Get4byte(&aBuf[8]); if( (magic&0xFFFFFFFE)!=WAL_MAGIC || szPage&(szPage-1) || szPage>SQLITE_MAX_PAGE_SIZE @@ -65544,22 +65544,22 @@ static int walIndexRecover(Wal *pWal){ } pWal->hdr.bigEndCksum = (u8)(magic&0x00000001); pWal->szPage = szPage; - pWal->nCkpt = sqlite3Get4byte(&aBuf[12]); + pWal->nCkpt = tdsqlite3Get4byte(&aBuf[12]); memcpy(&pWal->hdr.aSalt, &aBuf[16], 8); /* Verify that the WAL header checksum is correct */ walChecksumBytes(pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN, aBuf, WAL_HDRSIZE-2*4, 0, pWal->hdr.aFrameCksum ); - if( pWal->hdr.aFrameCksum[0]!=sqlite3Get4byte(&aBuf[24]) - || pWal->hdr.aFrameCksum[1]!=sqlite3Get4byte(&aBuf[28]) + if( pWal->hdr.aFrameCksum[0]!=tdsqlite3Get4byte(&aBuf[24]) + || pWal->hdr.aFrameCksum[1]!=tdsqlite3Get4byte(&aBuf[28]) ){ goto finished; } /* Verify that the version number on the WAL format is one that ** are able to understand */ - version = sqlite3Get4byte(&aBuf[4]); + version = tdsqlite3Get4byte(&aBuf[4]); if( version!=WAL_MAX_VERSION ){ rc = SQLITE_CANTOPEN_BKPT; goto finished; @@ -65567,7 +65567,7 @@ static int walIndexRecover(Wal *pWal){ /* Malloc a buffer to read frames into. */ szFrame = szPage + WAL_FRAME_HDRSIZE; - aFrame = (u8 *)sqlite3_malloc64(szFrame); + aFrame = (u8 *)tdsqlite3_malloc64(szFrame); if( !aFrame ){ rc = SQLITE_NOMEM_BKPT; goto recovery_error; @@ -65582,7 +65582,7 @@ static int walIndexRecover(Wal *pWal){ /* Read and decode the next log frame. */ iFrame++; - rc = sqlite3OsRead(pWal->pWalFd, aFrame, szFrame, iOffset); + rc = tdsqlite3OsRead(pWal->pWalFd, aFrame, szFrame, iOffset); if( rc!=SQLITE_OK ) break; isValid = walDecodeFrame(pWal, &pgno, &nTruncate, aData, aFrame); if( !isValid ) break; @@ -65601,7 +65601,7 @@ static int walIndexRecover(Wal *pWal){ } } - sqlite3_free(aFrame); + tdsqlite3_free(aFrame); } finished: @@ -65624,12 +65624,12 @@ finished: if( pWal->hdr.mxFrame ) pInfo->aReadMark[1] = pWal->hdr.mxFrame; /* If more than one frame was recovered from the log file, report an - ** event via sqlite3_log(). This is to help with identifying performance + ** event via tdsqlite3_log(). This is to help with identifying performance ** problems caused by applications routinely shutting down without ** checkpointing the log file. */ if( pWal->hdr.nPage ){ - sqlite3_log(SQLITE_NOTICE_RECOVER_WAL, + tdsqlite3_log(SQLITE_NOTICE_RECOVER_WAL, "recovered %d frames from WAL file %s", pWal->hdr.mxFrame, pWal->zWalName ); @@ -65650,12 +65650,12 @@ static void walIndexClose(Wal *pWal, int isDelete){ if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE || pWal->bShmUnreliable ){ int i; for(i=0; inWiData; i++){ - sqlite3_free((void *)pWal->apWiData[i]); + tdsqlite3_free((void *)pWal->apWiData[i]); pWal->apWiData[i] = 0; } } if( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE ){ - sqlite3OsShmUnmap(pWal->pDbFd, isDelete); + tdsqlite3OsShmUnmap(pWal->pDbFd, isDelete); } } @@ -65674,9 +65674,9 @@ static void walIndexClose(Wal *pWal, int isDelete){ ** *ppWal is set to point to a new WAL handle. If an error occurs, ** an SQLite error code is returned and *ppWal is left unmodified. */ -SQLITE_PRIVATE int sqlite3WalOpen( - sqlite3_vfs *pVfs, /* vfs module to open wal and wal-index */ - sqlite3_file *pDbFd, /* The open database file */ +SQLITE_PRIVATE int tdsqlite3WalOpen( + tdsqlite3_vfs *pVfs, /* vfs module to open wal and wal-index */ + tdsqlite3_file *pDbFd, /* The open database file */ const char *zWalName, /* Name of the WAL file */ int bNoShm, /* True to run in heap-memory mode */ i64 mxWalSize, /* Truncate WAL to this size on reset */ @@ -65707,13 +65707,13 @@ SQLITE_PRIVATE int sqlite3WalOpen( /* Allocate an instance of struct Wal to return. */ *ppWal = 0; - pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile); + pRet = (Wal*)tdsqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile); if( !pRet ){ return SQLITE_NOMEM_BKPT; } pRet->pVfs = pVfs; - pRet->pWalFd = (sqlite3_file *)&pRet[1]; + pRet->pWalFd = (tdsqlite3_file *)&pRet[1]; pRet->pDbFd = pDbFd; pRet->readLock = -1; pRet->mxWalSize = mxWalSize; @@ -65724,17 +65724,17 @@ SQLITE_PRIVATE int sqlite3WalOpen( /* Open file handle on the write-ahead log file. */ flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_WAL); - rc = sqlite3OsOpen(pVfs, zWalName, pRet->pWalFd, flags, &flags); + rc = tdsqlite3OsOpen(pVfs, zWalName, pRet->pWalFd, flags, &flags); if( rc==SQLITE_OK && flags&SQLITE_OPEN_READONLY ){ pRet->readOnly = WAL_RDONLY; } if( rc!=SQLITE_OK ){ walIndexClose(pRet, 0); - sqlite3OsClose(pRet->pWalFd); - sqlite3_free(pRet); + tdsqlite3OsClose(pRet->pWalFd); + tdsqlite3_free(pRet); }else{ - int iDC = sqlite3OsDeviceCharacteristics(pDbFd); + int iDC = tdsqlite3OsDeviceCharacteristics(pDbFd); if( iDC & SQLITE_IOCAP_SEQUENTIAL ){ pRet->syncHeader = 0; } if( iDC & SQLITE_IOCAP_POWERSAFE_OVERWRITE ){ pRet->padToSectorBoundary = 0; @@ -65748,7 +65748,7 @@ SQLITE_PRIVATE int sqlite3WalOpen( /* ** Change the size to which the WAL file is trucated on each reset. */ -SQLITE_PRIVATE void sqlite3WalLimit(Wal *pWal, i64 iLimit){ +SQLITE_PRIVATE void tdsqlite3WalLimit(Wal *pWal, i64 iLimit){ if( pWal ) pWal->mxWalSize = iLimit; } @@ -65936,7 +65936,7 @@ static void walMergesort( ** Free an iterator allocated by walIteratorInit(). */ static void walIteratorFree(WalIterator *p){ - sqlite3_free(p); + tdsqlite3_free(p); } /* @@ -65956,7 +65956,7 @@ static int walIteratorInit(Wal *pWal, u32 nBackfill, WalIterator **pp){ WalIterator *p; /* Return value */ int nSegment; /* Number of segments to merge */ u32 iLast; /* Last frame in log */ - sqlite3_int64 nByte; /* Number of bytes to allocate */ + tdsqlite3_int64 nByte; /* Number of bytes to allocate */ int i; /* Iterator variable */ ht_slot *aTmp; /* Temp space used by merge-sort */ int rc = SQLITE_OK; /* Return Code */ @@ -65972,7 +65972,7 @@ static int walIteratorInit(Wal *pWal, u32 nBackfill, WalIterator **pp){ nByte = sizeof(WalIterator) + (nSegment-1)*sizeof(struct WalSegment) + iLast*sizeof(ht_slot); - p = (WalIterator *)sqlite3_malloc64(nByte); + p = (WalIterator *)tdsqlite3_malloc64(nByte); if( !p ){ return SQLITE_NOMEM_BKPT; } @@ -65982,7 +65982,7 @@ static int walIteratorInit(Wal *pWal, u32 nBackfill, WalIterator **pp){ /* Allocate temporary space used by the merge-sort routine. This block ** of memory will be freed before this function returns. */ - aTmp = (ht_slot *)sqlite3_malloc64( + aTmp = (ht_slot *)tdsqlite3_malloc64( sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast) ); if( !aTmp ){ @@ -66017,7 +66017,7 @@ static int walIteratorInit(Wal *pWal, u32 nBackfill, WalIterator **pp){ p->aSegment[i].aPgno = (u32 *)sLoc.aPgno; } } - sqlite3_free(aTmp); + tdsqlite3_free(aTmp); if( rc!=SQLITE_OK ){ walIteratorFree(p); @@ -66070,7 +66070,7 @@ static int walPagesize(Wal *pWal){ ** ** The value of parameter salt1 is used as the aSalt[1] value in the ** new wal-index header. It should be passed a pseudo-random value (i.e. -** one obtained from sqlite3_randomness()). +** one obtained from tdsqlite3_randomness()). */ static void walRestartHdr(Wal *pWal, u32 salt1){ volatile WalCkptInfo *pInfo = walCkptInfo(pWal); @@ -66078,7 +66078,7 @@ static void walRestartHdr(Wal *pWal, u32 salt1){ u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */ pWal->nCkpt++; pWal->hdr.mxFrame = 0; - sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0])); + tdsqlite3Put4byte((u8*)&aSalt[0], 1 + tdsqlite3Get4byte((u8*)&aSalt[0])); memcpy(&pWal->hdr.aSalt[1], &salt1, 4); walIndexWriteHdr(pWal); pInfo->nBackfill = 0; @@ -66090,7 +66090,7 @@ static void walRestartHdr(Wal *pWal, u32 salt1){ /* ** Copy as much content as we can from the WAL back into the database file -** in response to an sqlite3_wal_checkpoint() request or the equivalent. +** in response to an tdsqlite3_wal_checkpoint() request or the equivalent. ** ** The amount of information copies from WAL to database might be limited ** by active readers. This routine will never overwrite a database page @@ -66121,7 +66121,7 @@ static void walRestartHdr(Wal *pWal, u32 salt1){ */ static int walCheckpoint( Wal *pWal, /* Wal connection */ - sqlite3 *db, /* Check for interrupts on this handle */ + tdsqlite3 *db, /* Check for interrupts on this handle */ int eMode, /* One of PASSIVE, FULL or RESTART */ int (*xBusy)(void*), /* Function to call when busy */ void *pBusyArg, /* Context argument for xBusyHandler */ @@ -66206,7 +66206,7 @@ static int walCheckpoint( pInfo->nBackfillAttempted = mxSafeFrame; /* Sync the WAL to disk */ - rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags)); + rc = tdsqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags)); /* If the database may grow as a result of this checkpoint, hint ** about the eventual size of the db file to the VFS layer. @@ -66214,9 +66214,9 @@ static int walCheckpoint( if( rc==SQLITE_OK ){ i64 nReq = ((i64)mxPage * szPage); i64 nSize; /* Current size of database file */ - rc = sqlite3OsFileSize(pWal->pDbFd, &nSize); + rc = tdsqlite3OsFileSize(pWal->pDbFd, &nSize); if( rc==SQLITE_OK && nSizepDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq); + tdsqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq); } } @@ -66234,11 +66234,11 @@ static int walCheckpoint( } iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE; /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */ - rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset); + rc = tdsqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset); if( rc!=SQLITE_OK ) break; iOffset = (iDbpage-1)*(i64)szPage; testcase( IS_BIG_INT(iOffset) ); - rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset); + rc = tdsqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset); if( rc!=SQLITE_OK ) break; } @@ -66247,13 +66247,13 @@ static int walCheckpoint( if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){ i64 szDb = pWal->hdr.nPage*(i64)szPage; testcase( IS_BIG_INT(szDb) ); - rc = sqlite3OsTruncate(pWal->pDbFd, szDb); + rc = tdsqlite3OsTruncate(pWal->pDbFd, szDb); if( rc==SQLITE_OK ){ - rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags)); + rc = tdsqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags)); } } if( rc==SQLITE_OK ){ - rc = sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_DONE, 0); + rc = tdsqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_DONE, 0); if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK; } if( rc==SQLITE_OK ){ @@ -66283,7 +66283,7 @@ static int walCheckpoint( rc = SQLITE_BUSY; }else if( eMode>=SQLITE_CHECKPOINT_RESTART ){ u32 salt1; - sqlite3_randomness(4, &salt1); + tdsqlite3_randomness(4, &salt1); assert( pInfo->nBackfill==pWal->hdr.mxFrame ); rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(1), WAL_NREADER-1); if( rc==SQLITE_OK ){ @@ -66302,7 +66302,7 @@ static int walCheckpoint( ** file-system. To avoid this, update the wal-index header to ** indicate that the log file contains zero valid frames. */ walRestartHdr(pWal, salt1); - rc = sqlite3OsTruncate(pWal->pWalFd, 0); + rc = tdsqlite3OsTruncate(pWal->pWalFd, 0); } walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1); } @@ -66321,23 +66321,23 @@ static int walCheckpoint( static void walLimitSize(Wal *pWal, i64 nMax){ i64 sz; int rx; - sqlite3BeginBenignMalloc(); - rx = sqlite3OsFileSize(pWal->pWalFd, &sz); + tdsqlite3BeginBenignMalloc(); + rx = tdsqlite3OsFileSize(pWal->pWalFd, &sz); if( rx==SQLITE_OK && (sz > nMax ) ){ - rx = sqlite3OsTruncate(pWal->pWalFd, nMax); + rx = tdsqlite3OsTruncate(pWal->pWalFd, nMax); } - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); if( rx ){ - sqlite3_log(rx, "cannot limit WAL size: %s", pWal->zWalName); + tdsqlite3_log(rx, "cannot limit WAL size: %s", pWal->zWalName); } } /* ** Close a connection to a log file. */ -SQLITE_PRIVATE int sqlite3WalClose( +SQLITE_PRIVATE int tdsqlite3WalClose( Wal *pWal, /* Wal to close */ - sqlite3 *db, /* For interrupt flag */ + tdsqlite3 *db, /* For interrupt flag */ int sync_flags, /* Flags to pass to OsSync() (or 0) */ int nBuf, u8 *zBuf /* Buffer of at least nBuf bytes */ @@ -66355,17 +66355,17 @@ SQLITE_PRIVATE int sqlite3WalClose( ** The EXCLUSIVE lock is not released before returning. */ if( zBuf!=0 - && SQLITE_OK==(rc = sqlite3OsLock(pWal->pDbFd, SQLITE_LOCK_EXCLUSIVE)) + && SQLITE_OK==(rc = tdsqlite3OsLock(pWal->pDbFd, SQLITE_LOCK_EXCLUSIVE)) ){ if( pWal->exclusiveMode==WAL_NORMAL_MODE ){ pWal->exclusiveMode = WAL_EXCLUSIVE_MODE; } - rc = sqlite3WalCheckpoint(pWal, db, + rc = tdsqlite3WalCheckpoint(pWal, db, SQLITE_CHECKPOINT_PASSIVE, 0, 0, sync_flags, nBuf, zBuf, 0, 0 ); if( rc==SQLITE_OK ){ int bPersist = -1; - sqlite3OsFileControlHint( + tdsqlite3OsFileControlHint( pWal->pDbFd, SQLITE_FCNTL_PERSIST_WAL, &bPersist ); if( bPersist!=1 ){ @@ -66386,15 +66386,15 @@ SQLITE_PRIVATE int sqlite3WalClose( } walIndexClose(pWal, isDelete); - sqlite3OsClose(pWal->pWalFd); + tdsqlite3OsClose(pWal->pWalFd); if( isDelete ){ - sqlite3BeginBenignMalloc(); - sqlite3OsDelete(pWal->pVfs, pWal->zWalName, 0); - sqlite3EndBenignMalloc(); + tdsqlite3BeginBenignMalloc(); + tdsqlite3OsDelete(pWal->pVfs, pWal->zWalName, 0); + tdsqlite3EndBenignMalloc(); } WALTRACE(("WAL%p: closed\n", pWal)); - sqlite3_free((void *)pWal->apWiData); - sqlite3_free(pWal); + tdsqlite3_free((void *)pWal->apWiData); + tdsqlite3_free(pWal); } return rc; } @@ -66640,14 +66640,14 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){ ** is active, wrap the WAL and start overwriting frames that this ** process wants to use. ** - ** Once sqlite3OsShmMap() has been called for an sqlite3_file and has + ** Once tdsqlite3OsShmMap() has been called for an tdsqlite3_file and has ** returned any SQLITE_READONLY value, it must return only SQLITE_READONLY ** or SQLITE_READONLY_CANTINIT or some error for all subsequent invocations, ** even if some external agent does a "chmod" to make the shared-memory - ** writable by us, until sqlite3OsShmUnmap() has been called. + ** writable by us, until tdsqlite3OsShmUnmap() has been called. ** This is a requirement on the VFS implementation. */ - rc = sqlite3OsShmMap(pWal->pDbFd, 0, WALINDEX_PGSZ, 0, &pDummy); + rc = tdsqlite3OsShmMap(pWal->pDbFd, 0, WALINDEX_PGSZ, 0, &pDummy); assert( rc!=SQLITE_OK ); /* SQLITE_OK not possible for read-only connection */ if( rc!=SQLITE_READONLY_CANTINIT ){ rc = (rc==SQLITE_READONLY ? WAL_RETRY : rc); @@ -66663,7 +66663,7 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){ /* Make sure some writer hasn't come in and changed the WAL file out ** from under us, then disconnected, while we were not looking. */ - rc = sqlite3OsFileSize(pWal->pWalFd, &szWal); + rc = tdsqlite3OsFileSize(pWal->pWalFd, &szWal); if( rc!=SQLITE_OK ){ goto begin_unreliable_shm_out; } @@ -66680,7 +66680,7 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){ } /* Check the salt keys at the start of the wal file still match. */ - rc = sqlite3OsRead(pWal->pWalFd, aBuf, WAL_HDRSIZE, 0); + rc = tdsqlite3OsRead(pWal->pWalFd, aBuf, WAL_HDRSIZE, 0); if( rc!=SQLITE_OK ){ goto begin_unreliable_shm_out; } @@ -66694,7 +66694,7 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){ /* Allocate a buffer to read frames into */ szFrame = pWal->hdr.szPage + WAL_FRAME_HDRSIZE; - aFrame = (u8 *)sqlite3_malloc64(szFrame); + aFrame = (u8 *)tdsqlite3_malloc64(szFrame); if( aFrame==0 ){ rc = SQLITE_NOMEM_BKPT; goto begin_unreliable_shm_out; @@ -66715,7 +66715,7 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){ u32 nTruncate; /* dbsize field from frame header */ /* Read and decode the next log frame. */ - rc = sqlite3OsRead(pWal->pWalFd, aFrame, szFrame, iOffset); + rc = tdsqlite3OsRead(pWal->pWalFd, aFrame, szFrame, iOffset); if( rc!=SQLITE_OK ) break; if( !walDecodeFrame(pWal, &pgno, &nTruncate, aData, aFrame) ) break; @@ -66731,15 +66731,15 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){ pWal->hdr.aFrameCksum[1] = aSaveCksum[1]; begin_unreliable_shm_out: - sqlite3_free(aFrame); + tdsqlite3_free(aFrame); if( rc!=SQLITE_OK ){ int i; for(i=0; inWiData; i++){ - sqlite3_free((void*)pWal->apWiData[i]); + tdsqlite3_free((void*)pWal->apWiData[i]); pWal->apWiData[i] = 0; } pWal->bShmUnreliable = 0; - sqlite3WalEndReadTransaction(pWal); + tdsqlite3WalEndReadTransaction(pWal); *pChanged = 1; } return rc; @@ -66818,8 +66818,8 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ ** during the few nanoseconds that it is holding the lock. In that case, ** it might take longer than normal for the lock to free. ** - ** After 5 RETRYs, we begin calling sqlite3OsSleep(). The first few - ** calls to sqlite3OsSleep() have a delay of 1 microsecond. Really this + ** After 5 RETRYs, we begin calling tdsqlite3OsSleep(). The first few + ** calls to tdsqlite3OsSleep() have a delay of 1 microsecond. Really this ** is more of a scheduler yield than an actual delay. But on the 10th ** an subsequent retries, the delays start becoming longer and longer, ** so that on the 100th (and last) RETRY we delay for 323 milliseconds. @@ -66832,7 +66832,7 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ return SQLITE_PROTOCOL; } if( cnt>=10 ) nDelay = (cnt-9)*(cnt-9)*39; - sqlite3OsSleep(pWal->pVfs, nDelay); + tdsqlite3OsSleep(pWal->pVfs, nDelay); } if( !useWal ){ @@ -67024,7 +67024,7 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ ** error occurs. It is not an error if nBackfillAttempted cannot be ** decreased at all. */ -SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal){ +SQLITE_PRIVATE int tdsqlite3WalSnapshotRecover(Wal *pWal){ int rc; assert( pWal->readLock>=0 ); @@ -67034,10 +67034,10 @@ SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal){ int szPage = (int)pWal->szPage; i64 szDb; /* Size of db file in bytes */ - rc = sqlite3OsFileSize(pWal->pDbFd, &szDb); + rc = tdsqlite3OsFileSize(pWal->pDbFd, &szDb); if( rc==SQLITE_OK ){ - void *pBuf1 = sqlite3_malloc(szPage); - void *pBuf2 = sqlite3_malloc(szPage); + void *pBuf1 = tdsqlite3_malloc(szPage); + void *pBuf2 = tdsqlite3_malloc(szPage); if( pBuf1==0 || pBuf2==0 ){ rc = SQLITE_NOMEM; }else{ @@ -67055,10 +67055,10 @@ SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal){ if( iDbOff+szPage<=szDb ){ iWalOff = walFrameOffset(i, szPage) + WAL_FRAME_HDRSIZE; - rc = sqlite3OsRead(pWal->pWalFd, pBuf1, szPage, iWalOff); + rc = tdsqlite3OsRead(pWal->pWalFd, pBuf1, szPage, iWalOff); if( rc==SQLITE_OK ){ - rc = sqlite3OsRead(pWal->pDbFd, pBuf2, szPage, iDbOff); + rc = tdsqlite3OsRead(pWal->pDbFd, pBuf2, szPage, iDbOff); } if( rc!=SQLITE_OK || 0==memcmp(pBuf1, pBuf2, szPage) ){ @@ -67070,8 +67070,8 @@ SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal){ } } - sqlite3_free(pBuf1); - sqlite3_free(pBuf2); + tdsqlite3_free(pBuf1); + tdsqlite3_free(pBuf2); } walUnlockExclusive(pWal, WAL_CKPT_LOCK, 1); } @@ -67083,7 +67083,7 @@ SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal){ /* ** Begin a read transaction on the database. ** -** This routine used to be called sqlite3OpenSnapshot() and with good reason: +** This routine used to be called tdsqlite3OpenSnapshot() and with good reason: ** it takes a snapshot of the state of the WAL and wal-index for the current ** instant in time. The current thread will continue to use this snapshot. ** Other threads might append new content to the WAL and wal-index but @@ -67094,7 +67094,7 @@ SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal){ ** Pager layer will use this to know that its cache is stale and ** needs to be flushed. */ -SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){ +SQLITE_PRIVATE int tdsqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){ int rc; /* Return code */ int cnt = 0; /* Number of TryBeginRead attempts */ @@ -67173,7 +67173,7 @@ SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){ if( rc!=SQLITE_OK ){ - sqlite3WalEndReadTransaction(pWal); + tdsqlite3WalEndReadTransaction(pWal); } } } @@ -67185,8 +67185,8 @@ SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){ ** Finish with a read transaction. All this does is release the ** read-lock. */ -SQLITE_PRIVATE void sqlite3WalEndReadTransaction(Wal *pWal){ - sqlite3WalEndWriteTransaction(pWal); +SQLITE_PRIVATE void tdsqlite3WalEndReadTransaction(Wal *pWal){ + tdsqlite3WalEndWriteTransaction(pWal); if( pWal->readLock>=0 ){ walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock)); pWal->readLock = -1; @@ -67201,7 +67201,7 @@ SQLITE_PRIVATE void sqlite3WalEndReadTransaction(Wal *pWal){ ** Return SQLITE_OK if successful, or an error code if an error occurs. If an ** error does occur, the final value of *piRead is undefined. */ -SQLITE_PRIVATE int sqlite3WalFindFrame( +SQLITE_PRIVATE int tdsqlite3WalFindFrame( Wal *pWal, /* WAL handle */ Pgno pgno, /* Database page number to read data for */ u32 *piRead /* OUT: Frame number (or zero) */ @@ -67303,7 +67303,7 @@ SQLITE_PRIVATE int sqlite3WalFindFrame( ** (which is nOut bytes in size). Return SQLITE_OK if successful, or an ** error code otherwise. */ -SQLITE_PRIVATE int sqlite3WalReadFrame( +SQLITE_PRIVATE int tdsqlite3WalReadFrame( Wal *pWal, /* WAL handle */ u32 iRead, /* Frame to read */ int nOut, /* Size of buffer pOut in bytes */ @@ -67317,13 +67317,13 @@ SQLITE_PRIVATE int sqlite3WalReadFrame( testcase( sz>=65536 ); iOffset = walFrameOffset(iRead, sz) + WAL_FRAME_HDRSIZE; /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */ - return sqlite3OsRead(pWal->pWalFd, pOut, (nOut>sz ? sz : nOut), iOffset); + return tdsqlite3OsRead(pWal->pWalFd, pOut, (nOut>sz ? sz : nOut), iOffset); } /* ** Return the size of the database in pages (or zero, if unknown). */ -SQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal){ +SQLITE_PRIVATE Pgno tdsqlite3WalDbsize(Wal *pWal){ if( pWal && ALWAYS(pWal->readLock>=0) ){ return pWal->hdr.nPage; } @@ -67335,7 +67335,7 @@ SQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal){ ** This function starts a write transaction on the WAL. ** ** A read transaction must have already been started by a prior call -** to sqlite3WalBeginReadTransaction(). +** to tdsqlite3WalBeginReadTransaction(). ** ** If another thread or process has written into the database since ** the read transaction was started, then it is not possible for this @@ -67344,7 +67344,7 @@ SQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal){ ** ** There can only be a single writer active at a time. */ -SQLITE_PRIVATE int sqlite3WalBeginWriteTransaction(Wal *pWal){ +SQLITE_PRIVATE int tdsqlite3WalBeginWriteTransaction(Wal *pWal){ int rc; /* Cannot start a write transaction without first holding a read @@ -67382,7 +67382,7 @@ SQLITE_PRIVATE int sqlite3WalBeginWriteTransaction(Wal *pWal){ ** End a write transaction. The commit has already been done. This ** routine merely releases the lock. */ -SQLITE_PRIVATE int sqlite3WalEndWriteTransaction(Wal *pWal){ +SQLITE_PRIVATE int tdsqlite3WalEndWriteTransaction(Wal *pWal){ if( pWal->writeLock ){ walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1); pWal->writeLock = 0; @@ -67404,7 +67404,7 @@ SQLITE_PRIVATE int sqlite3WalEndWriteTransaction(Wal *pWal){ ** Otherwise, if the callback function does not return an error, this ** function returns SQLITE_OK. */ -SQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx){ +SQLITE_PRIVATE int tdsqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx){ int rc = SQLITE_OK; if( ALWAYS(pWal->writeLock) ){ Pgno iMax = pWal->hdr.mxFrame; @@ -67444,7 +67444,7 @@ SQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *p ** "rollback" the write position of the WAL handle back to the current ** point in the event of a savepoint rollback (via WalSavepointUndo()). */ -SQLITE_PRIVATE void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData){ +SQLITE_PRIVATE void tdsqlite3WalSavepoint(Wal *pWal, u32 *aWalData){ assert( pWal->writeLock ); aWalData[0] = pWal->hdr.mxFrame; aWalData[1] = pWal->hdr.aFrameCksum[0]; @@ -67458,7 +67458,7 @@ SQLITE_PRIVATE void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData){ ** of WAL_SAVEPOINT_NDATA u32 values that has been previously populated ** by a call to WalSavepoint(). */ -SQLITE_PRIVATE int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData){ +SQLITE_PRIVATE int tdsqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData){ int rc = SQLITE_OK; assert( pWal->writeLock ); @@ -67485,7 +67485,7 @@ SQLITE_PRIVATE int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData){ /* ** This function is called just before writing a set of frames to the log -** file (see sqlite3WalFrames()). It checks to see if, instead of appending +** file (see tdsqlite3WalFrames()). It checks to see if, instead of appending ** to the current log file, it is possible to overwrite the start of the ** existing log file with the new frames (i.e. "reset" the log). If so, ** it sets pWal->hdr.mxFrame to 0. Otherwise, pWal->hdr.mxFrame is left @@ -67504,7 +67504,7 @@ static int walRestartLog(Wal *pWal){ assert( pInfo->nBackfill==pWal->hdr.mxFrame ); if( pInfo->nBackfill>0 ){ u32 salt1; - sqlite3_randomness(4, &salt1); + tdsqlite3_randomness(4, &salt1); rc = walLockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1); if( rc==SQLITE_OK ){ /* If all readers are using WAL_READ_LOCK(0) (in other words if no @@ -67514,7 +67514,7 @@ static int walRestartLog(Wal *pWal){ ** ** In theory it would be Ok to update the cache of the header only ** at this point. But updating the actual wal-index header is also - ** safe and means there is no special case for sqlite3WalUndo() + ** safe and means there is no special case for tdsqlite3WalUndo() ** to handle if this transaction is rolled back. */ walRestartHdr(pWal, salt1); walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1); @@ -67539,13 +67539,13 @@ static int walRestartLog(Wal *pWal){ /* ** Information about the current state of the WAL file and where -** the next fsync should occur - passed from sqlite3WalFrames() into +** the next fsync should occur - passed from tdsqlite3WalFrames() into ** walWriteToLog(). */ typedef struct WalWriter { Wal *pWal; /* The complete WAL information */ - sqlite3_file *pFd; /* The WAL file to which we write */ - sqlite3_int64 iSyncPoint; /* Fsync at this offset */ + tdsqlite3_file *pFd; /* The WAL file to which we write */ + tdsqlite3_int64 iSyncPoint; /* Fsync at this offset */ int syncFlags; /* Flags for the fsync */ int szPage; /* Size of one page */ } WalWriter; @@ -67562,21 +67562,21 @@ static int walWriteToLog( WalWriter *p, /* WAL to write to */ void *pContent, /* Content to be written */ int iAmt, /* Number of bytes to write */ - sqlite3_int64 iOffset /* Start writing at this offset */ + tdsqlite3_int64 iOffset /* Start writing at this offset */ ){ int rc; if( iOffsetiSyncPoint && iOffset+iAmt>=p->iSyncPoint ){ int iFirstAmt = (int)(p->iSyncPoint - iOffset); - rc = sqlite3OsWrite(p->pFd, pContent, iFirstAmt, iOffset); + rc = tdsqlite3OsWrite(p->pFd, pContent, iFirstAmt, iOffset); if( rc ) return rc; iOffset += iFirstAmt; iAmt -= iFirstAmt; pContent = (void*)(iFirstAmt + (char*)pContent); assert( WAL_SYNC_FLAGS(p->syncFlags)!=0 ); - rc = sqlite3OsSync(p->pFd, WAL_SYNC_FLAGS(p->syncFlags)); + rc = tdsqlite3OsSync(p->pFd, WAL_SYNC_FLAGS(p->syncFlags)); if( iAmt==0 || rc ) return rc; } - rc = sqlite3OsWrite(p->pFd, pContent, iAmt, iOffset); + rc = tdsqlite3OsWrite(p->pFd, pContent, iAmt, iOffset); return rc; } @@ -67587,13 +67587,13 @@ static int walWriteOneFrame( WalWriter *p, /* Where to write the frame */ PgHdr *pPage, /* The page of the frame to be written */ int nTruncate, /* The commit flag. Usually 0. >0 for commit */ - sqlite3_int64 iOffset /* Byte offset at which to write */ + tdsqlite3_int64 iOffset /* Byte offset at which to write */ ){ int rc; /* Result code from subfunctions */ void *pData; /* Data actually written */ u8 aFrame[WAL_FRAME_HDRSIZE]; /* Buffer to assemble frame-header in */ #if defined(SQLITE_HAS_CODEC) - if( (pData = sqlite3PagerCodec(pPage))==0 ) return SQLITE_NOMEM_BKPT; + if( (pData = tdsqlite3PagerCodec(pPage))==0 ) return SQLITE_NOMEM_BKPT; #else pData = pPage->pData; #endif @@ -67621,7 +67621,7 @@ static int walRewriteChecksums(Wal *pWal, u32 iLast){ u32 iRead; /* Next frame to read from wal file */ i64 iCksumOff; - aBuf = sqlite3_malloc(szPage + WAL_FRAME_HDRSIZE); + aBuf = tdsqlite3_malloc(szPage + WAL_FRAME_HDRSIZE); if( aBuf==0 ) return SQLITE_NOMEM_BKPT; /* Find the checksum values to use as input for the recalculating the @@ -67635,34 +67635,34 @@ static int walRewriteChecksums(Wal *pWal, u32 iLast){ }else{ iCksumOff = walFrameOffset(pWal->iReCksum-1, szPage) + 16; } - rc = sqlite3OsRead(pWal->pWalFd, aBuf, sizeof(u32)*2, iCksumOff); - pWal->hdr.aFrameCksum[0] = sqlite3Get4byte(aBuf); - pWal->hdr.aFrameCksum[1] = sqlite3Get4byte(&aBuf[sizeof(u32)]); + rc = tdsqlite3OsRead(pWal->pWalFd, aBuf, sizeof(u32)*2, iCksumOff); + pWal->hdr.aFrameCksum[0] = tdsqlite3Get4byte(aBuf); + pWal->hdr.aFrameCksum[1] = tdsqlite3Get4byte(&aBuf[sizeof(u32)]); iRead = pWal->iReCksum; pWal->iReCksum = 0; for(; rc==SQLITE_OK && iRead<=iLast; iRead++){ i64 iOff = walFrameOffset(iRead, szPage); - rc = sqlite3OsRead(pWal->pWalFd, aBuf, szPage+WAL_FRAME_HDRSIZE, iOff); + rc = tdsqlite3OsRead(pWal->pWalFd, aBuf, szPage+WAL_FRAME_HDRSIZE, iOff); if( rc==SQLITE_OK ){ u32 iPgno, nDbSize; - iPgno = sqlite3Get4byte(aBuf); - nDbSize = sqlite3Get4byte(&aBuf[4]); + iPgno = tdsqlite3Get4byte(aBuf); + nDbSize = tdsqlite3Get4byte(&aBuf[4]); walEncodeFrame(pWal, iPgno, nDbSize, &aBuf[WAL_FRAME_HDRSIZE], aFrame); - rc = sqlite3OsWrite(pWal->pWalFd, aFrame, sizeof(aFrame), iOff); + rc = tdsqlite3OsWrite(pWal->pWalFd, aFrame, sizeof(aFrame), iOff); } } - sqlite3_free(aBuf); + tdsqlite3_free(aBuf); return rc; } /* ** Write a set of frames to the log. The caller must hold the write-lock -** on the log file (obtained using sqlite3WalBeginWriteTransaction()). +** on the log file (obtained using tdsqlite3WalBeginWriteTransaction()). */ -SQLITE_PRIVATE int sqlite3WalFrames( +SQLITE_PRIVATE int tdsqlite3WalFrames( Wal *pWal, /* Wal handle to write to */ int szPage, /* Database page-size in bytes */ PgHdr *pList, /* List of dirty pages to write */ @@ -67716,15 +67716,15 @@ SQLITE_PRIVATE int sqlite3WalFrames( u8 aWalHdr[WAL_HDRSIZE]; /* Buffer to assemble wal-header in */ u32 aCksum[2]; /* Checksum for wal-header */ - sqlite3Put4byte(&aWalHdr[0], (WAL_MAGIC | SQLITE_BIGENDIAN)); - sqlite3Put4byte(&aWalHdr[4], WAL_MAX_VERSION); - sqlite3Put4byte(&aWalHdr[8], szPage); - sqlite3Put4byte(&aWalHdr[12], pWal->nCkpt); - if( pWal->nCkpt==0 ) sqlite3_randomness(8, pWal->hdr.aSalt); + tdsqlite3Put4byte(&aWalHdr[0], (WAL_MAGIC | SQLITE_BIGENDIAN)); + tdsqlite3Put4byte(&aWalHdr[4], WAL_MAX_VERSION); + tdsqlite3Put4byte(&aWalHdr[8], szPage); + tdsqlite3Put4byte(&aWalHdr[12], pWal->nCkpt); + if( pWal->nCkpt==0 ) tdsqlite3_randomness(8, pWal->hdr.aSalt); memcpy(&aWalHdr[16], pWal->hdr.aSalt, 8); walChecksumBytes(1, aWalHdr, WAL_HDRSIZE-2*4, 0, aCksum); - sqlite3Put4byte(&aWalHdr[24], aCksum[0]); - sqlite3Put4byte(&aWalHdr[28], aCksum[1]); + tdsqlite3Put4byte(&aWalHdr[24], aCksum[0]); + tdsqlite3Put4byte(&aWalHdr[28], aCksum[1]); pWal->szPage = szPage; pWal->hdr.bigEndCksum = SQLITE_BIGENDIAN; @@ -67732,7 +67732,7 @@ SQLITE_PRIVATE int sqlite3WalFrames( pWal->hdr.aFrameCksum[1] = aCksum[1]; pWal->truncateOnCommit = 1; - rc = sqlite3OsWrite(pWal->pWalFd, aWalHdr, sizeof(aWalHdr), 0); + rc = tdsqlite3OsWrite(pWal->pWalFd, aWalHdr, sizeof(aWalHdr), 0); WALTRACE(("WAL%p: wal-header write %s\n", pWal, rc ? "failed" : "ok")); if( rc!=SQLITE_OK ){ return rc; @@ -67746,7 +67746,7 @@ SQLITE_PRIVATE int sqlite3WalFrames( ** https://sqlite.org/src/info/ff5be73dee */ if( pWal->syncHeader ){ - rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags)); + rc = tdsqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags)); if( rc ) return rc; } } @@ -67771,7 +67771,7 @@ SQLITE_PRIVATE int sqlite3WalFrames( ** checksums must be recomputed when the transaction is committed. */ if( iFirst && (p->pDirty || isCommit==0) ){ u32 iWrite = 0; - VVA_ONLY(rc =) sqlite3WalFindFrame(pWal, p->pgno, &iWrite); + VVA_ONLY(rc =) tdsqlite3WalFindFrame(pWal, p->pgno, &iWrite); assert( rc==SQLITE_OK || iWrite==0 ); if( iWrite>=iFirst ){ i64 iOff = walFrameOffset(iWrite, szPage) + WAL_FRAME_HDRSIZE; @@ -67780,11 +67780,11 @@ SQLITE_PRIVATE int sqlite3WalFrames( pWal->iReCksum = iWrite; } #if defined(SQLITE_HAS_CODEC) - if( (pData = sqlite3PagerCodec(p))==0 ) return SQLITE_NOMEM; + if( (pData = tdsqlite3PagerCodec(p))==0 ) return SQLITE_NOMEM; #else pData = p->pData; #endif - rc = sqlite3OsWrite(pWal->pWalFd, pData, szPage, iOff); + rc = tdsqlite3OsWrite(pWal->pWalFd, pData, szPage, iOff); if( rc ) return rc; p->flags &= ~PGHDR_WAL_APPEND; continue; @@ -67824,7 +67824,7 @@ SQLITE_PRIVATE int sqlite3WalFrames( if( isCommit && WAL_SYNC_FLAGS(sync_flags)!=0 ){ int bSync = 1; if( pWal->padToSectorBoundary ){ - int sectorSize = sqlite3SectorSize(pWal->pWalFd); + int sectorSize = tdsqlite3SectorSize(pWal->pWalFd); w.iSyncPoint = ((iOffset+sectorSize-1)/sectorSize)*sectorSize; bSync = (w.iSyncPoint==iOffset); testcase( bSync ); @@ -67838,7 +67838,7 @@ SQLITE_PRIVATE int sqlite3WalFrames( } if( bSync ){ assert( rc==SQLITE_OK ); - rc = sqlite3OsSync(w.pFd, WAL_SYNC_FLAGS(sync_flags)); + rc = tdsqlite3OsSync(w.pFd, WAL_SYNC_FLAGS(sync_flags)); } } @@ -67895,7 +67895,7 @@ SQLITE_PRIVATE int sqlite3WalFrames( } /* -** This routine is called to implement sqlite3_wal_checkpoint() and +** This routine is called to implement tdsqlite3_wal_checkpoint() and ** related interfaces. ** ** Obtain a CHECKPOINT lock and then backfill as much information as @@ -67904,9 +67904,9 @@ SQLITE_PRIVATE int sqlite3WalFrames( ** If parameter xBusy is not NULL, it is a pointer to a busy-handler ** callback. In this case this function runs a blocking checkpoint. */ -SQLITE_PRIVATE int sqlite3WalCheckpoint( +SQLITE_PRIVATE int tdsqlite3WalCheckpoint( Wal *pWal, /* Wal connection */ - sqlite3 *db, /* Check this handle's interrupt flag */ + tdsqlite3 *db, /* Check this handle's interrupt flag */ int eMode, /* PASSIVE, FULL, RESTART, or TRUNCATE */ int (*xBusy)(void*), /* Function to call when busy */ void *pBusyArg, /* Context argument for xBusyHandler */ @@ -67971,7 +67971,7 @@ SQLITE_PRIVATE int sqlite3WalCheckpoint( if( rc==SQLITE_OK ){ rc = walIndexReadHdr(pWal, &isChanged); if( isChanged && pWal->pDbFd->pMethods->iVersion>=3 ){ - sqlite3OsUnfetch(pWal->pDbFd, 0, 0); + tdsqlite3OsUnfetch(pWal->pDbFd, 0, 0); } } @@ -68002,19 +68002,19 @@ SQLITE_PRIVATE int sqlite3WalCheckpoint( } /* Release the locks. */ - sqlite3WalEndWriteTransaction(pWal); + tdsqlite3WalEndWriteTransaction(pWal); walUnlockExclusive(pWal, WAL_CKPT_LOCK, 1); pWal->ckptLock = 0; WALTRACE(("WAL%p: checkpoint %s\n", pWal, rc ? "failed" : "ok")); return (rc==SQLITE_OK && eMode!=eMode2 ? SQLITE_BUSY : rc); } -/* Return the value to pass to a sqlite3_wal_hook callback, the +/* Return the value to pass to a tdsqlite3_wal_hook callback, the ** number of frames in the WAL at the point of the last commit since -** sqlite3WalCallback() was called. If no commits have occurred since +** tdsqlite3WalCallback() was called. If no commits have occurred since ** the last call, then return 0. */ -SQLITE_PRIVATE int sqlite3WalCallback(Wal *pWal){ +SQLITE_PRIVATE int tdsqlite3WalCallback(Wal *pWal){ u32 ret = 0; if( pWal ){ ret = pWal->iCallback; @@ -68047,7 +68047,7 @@ SQLITE_PRIVATE int sqlite3WalCallback(Wal *pWal){ ** should acquire the database exclusive lock prior to invoking ** the op==1 case. */ -SQLITE_PRIVATE int sqlite3WalExclusiveMode(Wal *pWal, int op){ +SQLITE_PRIVATE int tdsqlite3WalExclusiveMode(Wal *pWal, int op){ int rc; assert( pWal->writeLock==0 ); assert( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE || op==-1 ); @@ -68089,7 +68089,7 @@ SQLITE_PRIVATE int sqlite3WalExclusiveMode(Wal *pWal, int op){ ** heap-memory for the wal-index. Otherwise, if the argument is NULL or the ** WAL module is using shared-memory, return false. */ -SQLITE_PRIVATE int sqlite3WalHeapMemory(Wal *pWal){ +SQLITE_PRIVATE int tdsqlite3WalHeapMemory(Wal *pWal){ return (pWal && pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ); } @@ -68098,7 +68098,7 @@ SQLITE_PRIVATE int sqlite3WalHeapMemory(Wal *pWal){ ** every other subsystem, so the WAL module can put whatever it needs ** in the object. */ -SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot){ +SQLITE_PRIVATE int tdsqlite3WalSnapshotGet(Wal *pWal, tdsqlite3_snapshot **ppSnapshot){ int rc = SQLITE_OK; WalIndexHdr *pRet; static const u32 aZero[4] = { 0, 0, 0, 0 }; @@ -68109,12 +68109,12 @@ SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapsho *ppSnapshot = 0; return SQLITE_ERROR; } - pRet = (WalIndexHdr*)sqlite3_malloc(sizeof(WalIndexHdr)); + pRet = (WalIndexHdr*)tdsqlite3_malloc(sizeof(WalIndexHdr)); if( pRet==0 ){ rc = SQLITE_NOMEM_BKPT; }else{ memcpy(pRet, &pWal->hdr, sizeof(WalIndexHdr)); - *ppSnapshot = (sqlite3_snapshot*)pRet; + *ppSnapshot = (tdsqlite3_snapshot*)pRet; } return rc; @@ -68122,7 +68122,7 @@ SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapsho /* Try to open on pSnapshot when the next read-transaction starts */ -SQLITE_PRIVATE void sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *pSnapshot){ +SQLITE_PRIVATE void tdsqlite3WalSnapshotOpen(Wal *pWal, tdsqlite3_snapshot *pSnapshot){ pWal->pSnapshot = (WalIndexHdr*)pSnapshot; } @@ -68130,7 +68130,7 @@ SQLITE_PRIVATE void sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *pSnapsho ** Return a +ve value if snapshot p1 is newer than p2. A -ve value if ** p1 is older than p2 and zero if p1 and p2 are the same snapshot. */ -SQLITE_API int sqlite3_snapshot_cmp(sqlite3_snapshot *p1, sqlite3_snapshot *p2){ +SQLITE_API int tdsqlite3_snapshot_cmp(tdsqlite3_snapshot *p1, tdsqlite3_snapshot *p2){ WalIndexHdr *pHdr1 = (WalIndexHdr*)p1; WalIndexHdr *pHdr2 = (WalIndexHdr*)p2; @@ -68154,7 +68154,7 @@ SQLITE_API int sqlite3_snapshot_cmp(sqlite3_snapshot *p1, sqlite3_snapshot *p2){ ** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER ** lock is released before returning. */ -SQLITE_PRIVATE int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot){ +SQLITE_PRIVATE int tdsqlite3WalSnapshotCheck(Wal *pWal, tdsqlite3_snapshot *pSnapshot){ int rc; rc = walLockShared(pWal, WAL_CKPT_LOCK); if( rc==SQLITE_OK ){ @@ -68171,9 +68171,9 @@ SQLITE_PRIVATE int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapsho /* ** Release a lock obtained by an earlier successful call to -** sqlite3WalSnapshotCheck(). +** tdsqlite3WalSnapshotCheck(). */ -SQLITE_PRIVATE void sqlite3WalSnapshotUnlock(Wal *pWal){ +SQLITE_PRIVATE void tdsqlite3WalSnapshotUnlock(Wal *pWal){ assert( pWal ); walUnlockShared(pWal, WAL_CKPT_LOCK); } @@ -68187,15 +68187,15 @@ SQLITE_PRIVATE void sqlite3WalSnapshotUnlock(Wal *pWal){ ** read-lock. This function returns the database page-size if it is known, ** or zero if it is not (or if pWal is NULL). */ -SQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal){ +SQLITE_PRIVATE int tdsqlite3WalFramesize(Wal *pWal){ assert( pWal==0 || pWal->readLock>=0 ); return (pWal ? pWal->szPage : 0); } #endif -/* Return the sqlite3_file object for the WAL file +/* Return the tdsqlite3_file object for the WAL file */ -SQLITE_PRIVATE sqlite3_file *sqlite3WalFile(Wal *pWal){ +SQLITE_PRIVATE tdsqlite3_file *tdsqlite3WalFile(Wal *pWal){ return pWal->pWalFd; } @@ -68231,10 +68231,10 @@ SQLITE_PRIVATE sqlite3_file *sqlite3WalFile(Wal *pWal){ */ static void lockBtreeMutex(Btree *p){ assert( p->locked==0 ); - assert( sqlite3_mutex_notheld(p->pBt->mutex) ); - assert( sqlite3_mutex_held(p->db->mutex) ); + assert( tdsqlite3_mutex_notheld(p->pBt->mutex) ); + assert( tdsqlite3_mutex_held(p->db->mutex) ); - sqlite3_mutex_enter(p->pBt->mutex); + tdsqlite3_mutex_enter(p->pBt->mutex); p->pBt->db = p->db; p->locked = 1; } @@ -68246,11 +68246,11 @@ static void lockBtreeMutex(Btree *p){ static void SQLITE_NOINLINE unlockBtreeMutex(Btree *p){ BtShared *pBt = p->pBt; assert( p->locked==1 ); - assert( sqlite3_mutex_held(pBt->mutex) ); - assert( sqlite3_mutex_held(p->db->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(p->db->mutex) ); assert( p->db==pBt->db ); - sqlite3_mutex_leave(pBt->mutex); + tdsqlite3_mutex_leave(pBt->mutex); p->locked = 0; } @@ -68273,7 +68273,7 @@ static void SQLITE_NOINLINE btreeLockCarefully(Btree *p); ** for the lock to become available on p, then relock all of the ** subsequent Btrees that desire a lock. */ -SQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){ +SQLITE_PRIVATE void tdsqlite3BtreeEnter(Btree *p){ /* Some basic sanity checking on the Btree. The list of Btrees ** connected by pNext and pPrev should be in sorted order by ** Btree.pBt value. All elements of the list should belong to @@ -68289,7 +68289,7 @@ SQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){ assert( p->sharable || p->wantToLock==0 ); /* We should already hold a lock on the database connection */ - assert( sqlite3_mutex_held(p->db->mutex) ); + assert( tdsqlite3_mutex_held(p->db->mutex) ); /* Unless the database is sharable and unlocked, then BtShared.db ** should already be set correctly. */ @@ -68301,10 +68301,10 @@ SQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){ btreeLockCarefully(p); } -/* This is a helper function for sqlite3BtreeLock(). By moving -** complex, but seldom used logic, out of sqlite3BtreeLock() and +/* This is a helper function for tdsqlite3BtreeLock(). By moving +** complex, but seldom used logic, out of tdsqlite3BtreeLock() and ** into this routine, we avoid unnecessary stack pointer changes -** and thus help the sqlite3BtreeLock() routine to run much faster +** and thus help the tdsqlite3BtreeLock() routine to run much faster ** in the common case. */ static void SQLITE_NOINLINE btreeLockCarefully(Btree *p){ @@ -68314,7 +68314,7 @@ static void SQLITE_NOINLINE btreeLockCarefully(Btree *p){ ** want without having to go through the ascending lock ** procedure that follows. Just be sure not to block. */ - if( sqlite3_mutex_try(p->pBt->mutex)==SQLITE_OK ){ + if( tdsqlite3_mutex_try(p->pBt->mutex)==SQLITE_OK ){ p->pBt->db = p->db; p->locked = 1; return; @@ -68345,8 +68345,8 @@ static void SQLITE_NOINLINE btreeLockCarefully(Btree *p){ /* ** Exit the recursive mutex on a Btree. */ -SQLITE_PRIVATE void sqlite3BtreeLeave(Btree *p){ - assert( sqlite3_mutex_held(p->db->mutex) ); +SQLITE_PRIVATE void tdsqlite3BtreeLeave(Btree *p){ + assert( tdsqlite3_mutex_held(p->db->mutex) ); if( p->sharable ){ assert( p->wantToLock>0 ); p->wantToLock--; @@ -68363,11 +68363,11 @@ SQLITE_PRIVATE void sqlite3BtreeLeave(Btree *p){ ** ** This routine is used only from within assert() statements. */ -SQLITE_PRIVATE int sqlite3BtreeHoldsMutex(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeHoldsMutex(Btree *p){ assert( p->sharable==0 || p->locked==0 || p->wantToLock>0 ); assert( p->sharable==0 || p->locked==0 || p->db==p->pBt->db ); - assert( p->sharable==0 || p->locked==0 || sqlite3_mutex_held(p->pBt->mutex) ); - assert( p->sharable==0 || p->locked==0 || sqlite3_mutex_held(p->db->mutex) ); + assert( p->sharable==0 || p->locked==0 || tdsqlite3_mutex_held(p->pBt->mutex) ); + assert( p->sharable==0 || p->locked==0 || tdsqlite3_mutex_held(p->db->mutex) ); return (p->sharable==0 || p->locked); } @@ -68388,33 +68388,33 @@ SQLITE_PRIVATE int sqlite3BtreeHoldsMutex(Btree *p){ ** two or more btrees in common both try to lock all their btrees ** at the same instant. */ -static void SQLITE_NOINLINE btreeEnterAll(sqlite3 *db){ +static void SQLITE_NOINLINE btreeEnterAll(tdsqlite3 *db){ int i; int skipOk = 1; Btree *p; - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); for(i=0; inDb; i++){ p = db->aDb[i].pBt; if( p && p->sharable ){ - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); skipOk = 0; } } db->noSharedCache = skipOk; } -SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3BtreeEnterAll(tdsqlite3 *db){ if( db->noSharedCache==0 ) btreeEnterAll(db); } -static void SQLITE_NOINLINE btreeLeaveAll(sqlite3 *db){ +static void SQLITE_NOINLINE btreeLeaveAll(tdsqlite3 *db){ int i; Btree *p; - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); for(i=0; inDb; i++){ p = db->aDb[i].pBt; - if( p ) sqlite3BtreeLeave(p); + if( p ) tdsqlite3BtreeLeave(p); } } -SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3BtreeLeaveAll(tdsqlite3 *db){ if( db->noSharedCache==0 ) btreeLeaveAll(db); } @@ -68425,16 +68425,16 @@ SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3 *db){ ** ** This routine is used inside assert() statements only. */ -SQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3 *db){ +SQLITE_PRIVATE int tdsqlite3BtreeHoldsAllMutexes(tdsqlite3 *db){ int i; - if( !sqlite3_mutex_held(db->mutex) ){ + if( !tdsqlite3_mutex_held(db->mutex) ){ return 0; } for(i=0; inDb; i++){ Btree *p; p = db->aDb[i].pBt; if( p && p->sharable && - (p->wantToLock==0 || !sqlite3_mutex_held(p->pBt->mutex)) ){ + (p->wantToLock==0 || !tdsqlite3_mutex_held(p->pBt->mutex)) ){ return 0; } } @@ -68452,14 +68452,14 @@ SQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3 *db){ ** (2) if iDb!=1, then the mutex on db->aDb[iDb].pBt. ** ** If pSchema is not NULL, then iDb is computed from pSchema and -** db using sqlite3SchemaToIndex(). +** db using tdsqlite3SchemaToIndex(). */ -SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){ +SQLITE_PRIVATE int tdsqlite3SchemaMutexHeld(tdsqlite3 *db, int iDb, Schema *pSchema){ Btree *p; assert( db!=0 ); - if( pSchema ) iDb = sqlite3SchemaToIndex(db, pSchema); + if( pSchema ) iDb = tdsqlite3SchemaToIndex(db, pSchema); assert( iDb>=0 && iDbnDb ); - if( !sqlite3_mutex_held(db->mutex) ) return 0; + if( !tdsqlite3_mutex_held(db->mutex) ) return 0; if( iDb==1 ) return 1; p = db->aDb[iDb].pBt; assert( p!=0 ); @@ -68478,10 +68478,10 @@ SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema) ** the ones below, are no-ops and are null #defines in btree.h. */ -SQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){ +SQLITE_PRIVATE void tdsqlite3BtreeEnter(Btree *p){ p->pBt->db = p->db; } -SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3BtreeEnterAll(tdsqlite3 *db){ int i; for(i=0; inDb; i++){ Btree *p = db->aDb[i].pBt; @@ -68500,12 +68500,12 @@ SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){ ** any time OMIT_SHARED_CACHE is not defined, regardless of whether or not ** the build is threadsafe. Leave() is only required by threadsafe builds. */ -SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor *pCur){ - sqlite3BtreeEnter(pCur->pBtree); +SQLITE_PRIVATE void tdsqlite3BtreeEnterCursor(BtCursor *pCur){ + tdsqlite3BtreeEnter(pCur->pBtree); } # if SQLITE_THREADSAFE -SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor *pCur){ - sqlite3BtreeLeave(pCur->pBtree); +SQLITE_PRIVATE void tdsqlite3BtreeLeaveCursor(BtCursor *pCur){ + tdsqlite3BtreeLeave(pCur->pBtree); } # endif #endif /* ifndef SQLITE_OMIT_INCRBLOB */ @@ -68542,8 +68542,8 @@ static const char zMagicHeader[] = SQLITE_FILE_HEADER; ** macro. */ #if 0 -int sqlite3BtreeTrace=1; /* True to enable tracing */ -# define TRACE(X) if(sqlite3BtreeTrace){printf X;fflush(stdout);} +int tdsqlite3BtreeTrace=1; /* True to enable tracing */ +# define TRACE(X) if(tdsqlite3BtreeTrace){printf X;fflush(stdout);} #else # define TRACE(X) #endif @@ -68588,9 +68588,9 @@ int sqlite3BtreeTrace=1; /* True to enable tracing */ ** Access to this variable is protected by SQLITE_MUTEX_STATIC_MASTER. */ #ifdef SQLITE_TEST -SQLITE_PRIVATE BtShared *SQLITE_WSD sqlite3SharedCacheList = 0; +SQLITE_PRIVATE BtShared *SQLITE_WSD tdsqlite3SharedCacheList = 0; #else -static BtShared *SQLITE_WSD sqlite3SharedCacheList = 0; +static BtShared *SQLITE_WSD tdsqlite3SharedCacheList = 0; #endif #endif /* SQLITE_OMIT_SHARED_CACHE */ @@ -68600,10 +68600,10 @@ static BtShared *SQLITE_WSD sqlite3SharedCacheList = 0; ** ** This routine has no effect on existing database connections. ** The shared cache setting effects only future calls to -** sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2(). +** tdsqlite3_open(), tdsqlite3_open16(), or tdsqlite3_open_v2(). */ -SQLITE_API int sqlite3_enable_shared_cache(int enable){ - sqlite3GlobalConfig.sharedCacheEnabled = enable; +SQLITE_API int tdsqlite3_enable_shared_cache(int enable){ + tdsqlite3GlobalConfig.sharedCacheEnabled = enable; return SQLITE_OK; } #endif @@ -68640,15 +68640,15 @@ SQLITE_API int sqlite3_enable_shared_cache(int enable){ #ifdef SQLITE_DEBUG int corruptPageError(int lineno, MemPage *p){ char *zMsg; - sqlite3BeginBenignMalloc(); - zMsg = sqlite3_mprintf("database corruption page %d of %s", - (int)p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0) + tdsqlite3BeginBenignMalloc(); + zMsg = tdsqlite3_mprintf("database corruption page %d of %s", + (int)p->pgno, tdsqlite3PagerFilename(p->pBt->pPager, 0) ); - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); if( zMsg ){ - sqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg); + tdsqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg); } - sqlite3_free(zMsg); + tdsqlite3_free(zMsg); return SQLITE_CORRUPT_BKPT; } # define SQLITE_CORRUPT_PAGE(pMemPage) corruptPageError(__LINE__, pMemPage) @@ -68792,7 +68792,7 @@ static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){ BtShared *pBt = p->pBt; BtLock *pIter; - assert( sqlite3BtreeHoldsMutex(p) ); + assert( tdsqlite3BtreeHoldsMutex(p) ); assert( eLock==READ_LOCK || eLock==WRITE_LOCK ); assert( p->db!=0 ); assert( !(p->db->flags&SQLITE_ReadUncommit)||eLock==WRITE_LOCK||iTab==1 ); @@ -68813,7 +68813,7 @@ static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){ ** requested lock may not be obtained. */ if( pBt->pWriter!=p && (pBt->btsFlags & BTS_EXCLUSIVE)!=0 ){ - sqlite3ConnectionBlocked(p->db, pBt->pWriter->db); + tdsqlite3ConnectionBlocked(p->db, pBt->pWriter->db); return SQLITE_LOCKED_SHAREDCACHE; } @@ -68830,7 +68830,7 @@ static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){ assert( pIter->eLock==READ_LOCK || pIter->eLock==WRITE_LOCK ); assert( eLock==READ_LOCK || pIter->pBtree==p || pIter->eLock==READ_LOCK); if( pIter->pBtree!=p && pIter->iTable==iTab && pIter->eLock!=eLock ){ - sqlite3ConnectionBlocked(p->db, pIter->pBtree->db); + tdsqlite3ConnectionBlocked(p->db, pIter->pBtree->db); if( eLock==WRITE_LOCK ){ assert( p==pBt->pWriter ); pBt->btsFlags |= BTS_PENDING; @@ -68865,7 +68865,7 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){ BtLock *pLock = 0; BtLock *pIter; - assert( sqlite3BtreeHoldsMutex(p) ); + assert( tdsqlite3BtreeHoldsMutex(p) ); assert( eLock==READ_LOCK || eLock==WRITE_LOCK ); assert( p->db!=0 ); @@ -68892,7 +68892,7 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){ ** with table iTable, allocate one and link it into the list. */ if( !pLock ){ - pLock = (BtLock *)sqlite3MallocZero(sizeof(BtLock)); + pLock = (BtLock *)tdsqlite3MallocZero(sizeof(BtLock)); if( !pLock ){ return SQLITE_NOMEM_BKPT; } @@ -68928,7 +68928,7 @@ static void clearAllSharedCacheTableLocks(Btree *p){ BtShared *pBt = p->pBt; BtLock **ppIter = &pBt->pLock; - assert( sqlite3BtreeHoldsMutex(p) ); + assert( tdsqlite3BtreeHoldsMutex(p) ); assert( p->sharable || 0==*ppIter ); assert( p->inTrans>0 ); @@ -68940,7 +68940,7 @@ static void clearAllSharedCacheTableLocks(Btree *p){ *ppIter = pLock->pNext; assert( pLock->iTable!=1 || pLock==&p->lock ); if( pLock->iTable!=1 ){ - sqlite3_free(pLock); + tdsqlite3_free(pLock); } }else{ ppIter = &pLock->pNext; @@ -68994,7 +68994,7 @@ static void releasePageNotNull(MemPage *pPage); /* Forward reference */ */ #ifdef SQLITE_DEBUG static int cursorHoldsMutex(BtCursor *p){ - return sqlite3_mutex_held(p->pBt->mutex); + return tdsqlite3_mutex_held(p->pBt->mutex); } /* Verify that the cursor and the BtShared agree about what is the current @@ -69023,7 +69023,7 @@ static int cursorOwnsBtShared(BtCursor *p){ */ static void invalidateAllOverflowCache(BtShared *pBt){ BtCursor *p; - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); for(p=pBt->pCursor; p; p=p->pNext){ invalidateOverflowCache(p); } @@ -69051,7 +69051,7 @@ static void invalidateIncrblobCursors( ){ BtCursor *p; if( pBtree->hasIncrblobCur==0 ) return; - assert( sqlite3BtreeHoldsMutex(pBtree) ); + assert( tdsqlite3BtreeHoldsMutex(pBtree) ); pBtree->hasIncrblobCur = 0; for(p=pBtree->pBt->pCursor; p; p=p->pNext){ if( (p->curFlags & BTCF_Incrblob)!=0 ){ @@ -69107,13 +69107,13 @@ static int btreeSetHasContent(BtShared *pBt, Pgno pgno){ int rc = SQLITE_OK; if( !pBt->pHasContent ){ assert( pgno<=pBt->nPage ); - pBt->pHasContent = sqlite3BitvecCreate(pBt->nPage); + pBt->pHasContent = tdsqlite3BitvecCreate(pBt->nPage); if( !pBt->pHasContent ){ rc = SQLITE_NOMEM_BKPT; } } - if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){ - rc = sqlite3BitvecSet(pBt->pHasContent, pgno); + if( rc==SQLITE_OK && pgno<=tdsqlite3BitvecSize(pBt->pHasContent) ){ + rc = tdsqlite3BitvecSet(pBt->pHasContent, pgno); } return rc; } @@ -69127,7 +69127,7 @@ static int btreeSetHasContent(BtShared *pBt, Pgno pgno){ */ static int btreeGetHasContent(BtShared *pBt, Pgno pgno){ Bitvec *p = pBt->pHasContent; - return (p && (pgno>sqlite3BitvecSize(p) || sqlite3BitvecTest(p, pgno))); + return (p && (pgno>tdsqlite3BitvecSize(p) || tdsqlite3BitvecTest(p, pgno))); } /* @@ -69135,7 +69135,7 @@ static int btreeGetHasContent(BtShared *pBt, Pgno pgno){ ** invoked at the conclusion of each write-transaction. */ static void btreeClearHasContent(BtShared *pBt){ - sqlite3BitvecDestroy(pBt->pHasContent); + tdsqlite3BitvecDestroy(pBt->pHasContent); pBt->pHasContent = 0; } @@ -69174,24 +69174,24 @@ static int saveCursorKey(BtCursor *pCur){ if( pCur->curIntKey ){ /* Only the rowid is required for a table btree */ - pCur->nKey = sqlite3BtreeIntegerKey(pCur); + pCur->nKey = tdsqlite3BtreeIntegerKey(pCur); }else{ /* For an index btree, save the complete key content. It is possible ** that the current key is corrupt. In that case, it is possible that - ** the sqlite3VdbeRecordUnpack() function may overread the buffer by + ** the tdsqlite3VdbeRecordUnpack() function may overread the buffer by ** up to the size of 1 varint plus 1 8-byte value when the cursor ** position is restored. Hence the 17 bytes of padding allocated ** below. */ void *pKey; - pCur->nKey = sqlite3BtreePayloadSize(pCur); - pKey = sqlite3Malloc( pCur->nKey + 9 + 8 ); + pCur->nKey = tdsqlite3BtreePayloadSize(pCur); + pKey = tdsqlite3Malloc( pCur->nKey + 9 + 8 ); if( pKey ){ - rc = sqlite3BtreePayload(pCur, 0, (int)pCur->nKey, pKey); + rc = tdsqlite3BtreePayload(pCur, 0, (int)pCur->nKey, pKey); if( rc==SQLITE_OK ){ memset(((u8*)pKey)+pCur->nKey, 0, 9+8); pCur->pKey = pKey; }else{ - sqlite3_free(pKey); + tdsqlite3_free(pKey); } }else{ rc = SQLITE_NOMEM_BKPT; @@ -69260,7 +69260,7 @@ static int SQLITE_NOINLINE saveCursorsOnList(BtCursor*,Pgno,BtCursor*); */ static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){ BtCursor *p; - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); assert( pExcept==0 || pExcept->pBt==pBt ); for(p=pBt->pCursor; p; p=p->pNext){ if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ) break; @@ -69300,9 +69300,9 @@ static int SQLITE_NOINLINE saveCursorsOnList( /* ** Clear the current cursor position. */ -SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *pCur){ +SQLITE_PRIVATE void tdsqlite3BtreeClearCursor(BtCursor *pCur){ assert( cursorHoldsMutex(pCur) ); - sqlite3_free(pCur->pKey); + tdsqlite3_free(pCur->pKey); pCur->pKey = 0; pCur->eState = CURSOR_INVALID; } @@ -69325,9 +69325,9 @@ static int btreeMoveto( if( pKey ){ KeyInfo *pKeyInfo = pCur->pKeyInfo; assert( nKey==(i64)(int)nKey ); - pIdxKey = sqlite3VdbeAllocUnpackedRecord(pKeyInfo); + pIdxKey = tdsqlite3VdbeAllocUnpackedRecord(pKeyInfo); if( pIdxKey==0 ) return SQLITE_NOMEM_BKPT; - sqlite3VdbeRecordUnpack(pKeyInfo, (int)nKey, pKey, pIdxKey); + tdsqlite3VdbeRecordUnpack(pKeyInfo, (int)nKey, pKey, pIdxKey); if( pIdxKey->nField==0 || pIdxKey->nField>pKeyInfo->nAllField ){ rc = SQLITE_CORRUPT_BKPT; goto moveto_done; @@ -69335,10 +69335,10 @@ static int btreeMoveto( }else{ pIdxKey = 0; } - rc = sqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes); + rc = tdsqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes); moveto_done: if( pIdxKey ){ - sqlite3DbFree(pCur->pKeyInfo->db, pIdxKey); + tdsqlite3DbFree(pCur->pKeyInfo->db, pIdxKey); } return rc; } @@ -69359,13 +69359,13 @@ static int btreeRestoreCursorPosition(BtCursor *pCur){ return pCur->skipNext; } pCur->eState = CURSOR_INVALID; - if( sqlite3FaultSim(410) ){ + if( tdsqlite3FaultSim(410) ){ rc = SQLITE_IOERR; }else{ rc = btreeMoveto(pCur, pCur->pKey, pCur->nKey, 0, &skipNext); } if( rc==SQLITE_OK ){ - sqlite3_free(pCur->pKey); + tdsqlite3_free(pCur->pKey); pCur->pKey = 0; assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_INVALID ); if( skipNext ) pCur->skipNext = skipNext; @@ -69390,12 +69390,12 @@ static int btreeRestoreCursorPosition(BtCursor *pCur){ ** ** Calling this routine with a NULL cursor pointer returns false. ** -** Use the separate sqlite3BtreeCursorRestore() routine to restore a cursor +** Use the separate tdsqlite3BtreeCursorRestore() routine to restore a cursor ** back to where it ought to be if this routine returns true. */ -SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor *pCur){ +SQLITE_PRIVATE int tdsqlite3BtreeCursorHasMoved(BtCursor *pCur){ assert( EIGHT_BYTE_ALIGNMENT(pCur) - || pCur==sqlite3BtreeFakeValidCursor() ); + || pCur==tdsqlite3BtreeFakeValidCursor() ); assert( offsetof(BtCursor, eState)==0 ); assert( sizeof(pCur->eState)==1 ); return CURSOR_VALID != *(u8*)pCur; @@ -69403,10 +69403,10 @@ SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor *pCur){ /* ** Return a pointer to a fake BtCursor object that will always answer -** false to the sqlite3BtreeCursorHasMoved() routine above. The fake +** false to the tdsqlite3BtreeCursorHasMoved() routine above. The fake ** cursor returned must not be used with any other Btree interface. */ -SQLITE_PRIVATE BtCursor *sqlite3BtreeFakeValidCursor(void){ +SQLITE_PRIVATE BtCursor *tdsqlite3BtreeFakeValidCursor(void){ static u8 fakeCursor = CURSOR_VALID; assert( offsetof(BtCursor, eState)==0 ); return (BtCursor*)&fakeCursor; @@ -69423,9 +69423,9 @@ SQLITE_PRIVATE BtCursor *sqlite3BtreeFakeValidCursor(void){ ** nearby row. ** ** This routine should only be called for a cursor that just returned -** TRUE from sqlite3BtreeCursorHasMoved(). +** TRUE from tdsqlite3BtreeCursorHasMoved(). */ -SQLITE_PRIVATE int sqlite3BtreeCursorRestore(BtCursor *pCur, int *pDifferentRow){ +SQLITE_PRIVATE int tdsqlite3BtreeCursorRestore(BtCursor *pCur, int *pDifferentRow){ int rc; assert( pCur!=0 ); @@ -69449,7 +69449,7 @@ SQLITE_PRIVATE int sqlite3BtreeCursorRestore(BtCursor *pCur, int *pDifferentRow) ** and number of the varargs parameters) is determined by the eHintType ** parameter. See the definitions of the BTREE_HINT_* macros for details. */ -SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){ +SQLITE_PRIVATE void tdsqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){ /* Used only by system that substitute their own storage engine */ } #endif @@ -69457,7 +69457,7 @@ SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){ /* ** Provide flag hints to the cursor. */ -SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){ +SQLITE_PRIVATE void tdsqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){ assert( x==BTREE_SEEK_EQ || x==BTREE_BULKLOAD || x==0 ); pCur->hints = x; } @@ -69476,7 +69476,7 @@ SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){ static Pgno ptrmapPageno(BtShared *pBt, Pgno pgno){ int nPagesPerMapPage; Pgno iPtrMap, ret; - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); if( pgno<2 ) return 0; nPagesPerMapPage = (pBt->usableSize/5)+1; iPtrMap = (pgno-2)/nPagesPerMapPage; @@ -69506,7 +69506,7 @@ static void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){ if( *pRC ) return; - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); /* The master-journal page number must never be used as a pointer map page */ assert( 0==PTRMAP_ISPAGE(pBt, PENDING_BYTE_PAGE(pBt)) ); @@ -69516,12 +69516,12 @@ static void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){ return; } iPtrmap = PTRMAP_PAGENO(pBt, key); - rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0); + rc = tdsqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0); if( rc!=SQLITE_OK ){ *pRC = rc; return; } - if( ((char*)sqlite3PagerGetExtra(pDbPage))[0]!=0 ){ + if( ((char*)tdsqlite3PagerGetExtra(pDbPage))[0]!=0 ){ /* The first byte of the extra data is the MemPage.isInit byte. ** If that byte is set, it means this page is also being used ** as a btree page. */ @@ -69534,11 +69534,11 @@ static void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){ goto ptrmap_exit; } assert( offset <= (int)pBt->usableSize-5 ); - pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage); + pPtrmap = (u8 *)tdsqlite3PagerGetData(pDbPage); if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){ TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent)); - *pRC= rc = sqlite3PagerWrite(pDbPage); + *pRC= rc = tdsqlite3PagerWrite(pDbPage); if( rc==SQLITE_OK ){ pPtrmap[offset] = eType; put4byte(&pPtrmap[offset+1], parent); @@ -69546,7 +69546,7 @@ static void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){ } ptrmap_exit: - sqlite3PagerUnref(pDbPage); + tdsqlite3PagerUnref(pDbPage); } /* @@ -69563,18 +69563,18 @@ static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){ int offset; /* Offset of entry in pointer map */ int rc; - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); iPtrmap = PTRMAP_PAGENO(pBt, key); - rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0); + rc = tdsqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0); if( rc!=0 ){ return rc; } - pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage); + pPtrmap = (u8 *)tdsqlite3PagerGetData(pDbPage); offset = PTRMAP_PTROFFSET(iPtrmap, key); if( offset<0 ){ - sqlite3PagerUnref(pDbPage); + tdsqlite3PagerUnref(pDbPage); return SQLITE_CORRUPT_BKPT; } assert( offset <= (int)pBt->usableSize-5 ); @@ -69582,7 +69582,7 @@ static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){ *pEType = pPtrmap[offset]; if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]); - sqlite3PagerUnref(pDbPage); + tdsqlite3PagerUnref(pDbPage); if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_PGNO(iPtrmap); return SQLITE_OK; } @@ -69665,7 +69665,7 @@ static void btreeParseCellPtrNoPayload( u8 *pCell, /* Pointer to the cell text. */ CellInfo *pInfo /* Fill in this structure */ ){ - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); assert( pPage->leaf==0 ); assert( pPage->childPtrSize==4 ); #ifndef SQLITE_DEBUG @@ -69686,7 +69686,7 @@ static void btreeParseCellPtr( u32 nPayload; /* Number of bytes of cell payload */ u64 iKey; /* Extracted Key value */ - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); assert( pPage->leaf==0 || pPage->leaf==1 ); assert( pPage->intKeyLeaf ); assert( pPage->childPtrSize==0 ); @@ -69753,7 +69753,7 @@ static void btreeParseCellPtrIndex( u8 *pIter; /* For scanning through pCell */ u32 nPayload; /* Number of bytes of cell payload */ - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); assert( pPage->leaf==0 || pPage->leaf==1 ); assert( pPage->intKeyLeaf==0 ); pIter = pCell + pPage->childPtrSize; @@ -69934,11 +69934,11 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){ int iCellFirst; /* First allowable cell index */ int iCellLast; /* Last possible cell index */ - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); + assert( tdsqlite3PagerIswriteable(pPage->pDbPage) ); assert( pPage->pBt!=0 ); assert( pPage->pBt->usableSize <= SQLITE_MAX_PAGE_SIZE ); assert( pPage->nOverflow==0 ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); temp = 0; src = data = pPage->aData; hdr = pPage->hdrOffset; @@ -70018,7 +70018,7 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){ if( temp==0 ){ int x; if( cbrk==pc ) continue; - temp = sqlite3PagerTempSpace(pPage->pBt->pPager); + temp = tdsqlite3PagerTempSpace(pPage->pBt->pPager); x = get2byte(&data[hdr+5]); memcpy(&temp[x], &data[x], (cbrk+size) - x); src = temp; @@ -70037,7 +70037,7 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){ data[hdr+1] = 0; data[hdr+2] = 0; memset(&data[iCellFirst], 0, cbrk-iCellFirst); - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); + assert( tdsqlite3PagerIswriteable(pPage->pDbPage) ); return SQLITE_OK; } @@ -70130,9 +70130,9 @@ static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){ int rc = SQLITE_OK; /* Integer return code */ int gap; /* First byte of gap between cell pointers and cell content */ - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); + assert( tdsqlite3PagerIswriteable(pPage->pDbPage) ); assert( pPage->pBt ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); assert( nByte>=0 ); /* Minimum cell size is 4 */ assert( pPage->nFree>=nByte ); assert( pPage->nOverflow==0 ); @@ -70230,10 +70230,10 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){ unsigned char *data = pPage->aData; /* Page content */ assert( pPage->pBt!=0 ); - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); + assert( tdsqlite3PagerIswriteable(pPage->pDbPage) ); assert( CORRUPT_DB || iStart>=pPage->hdrOffset+6+pPage->childPtrSize ); assert( CORRUPT_DB || iEnd <= pPage->pBt->usableSize ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); assert( iSize>=4 ); /* Minimum cell size is 4 */ assert( iStart<=pPage->pBt->usableSize-4 ); @@ -70330,7 +70330,7 @@ static int decodeFlags(MemPage *pPage, int flagByte){ BtShared *pBt; /* A copy of pPage->pBt */ assert( pPage->hdrOffset==(pPage->pgno==1 ? 100 : 0) ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); pPage->leaf = (u8)(flagByte>>3); assert( PTF_LEAF == 1<<3 ); flagByte &= ~PTF_LEAF; pPage->childPtrSize = 4-4*pPage->leaf; @@ -70391,10 +70391,10 @@ static int btreeComputeFreeSpace(MemPage *pPage){ assert( pPage->pBt!=0 ); assert( pPage->pBt->db!=0 ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) ); - assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) ); - assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); + assert( pPage->pgno==tdsqlite3PagerPagenumber(pPage->pDbPage) ); + assert( pPage == tdsqlite3PagerGetExtra(pPage->pDbPage) ); + assert( pPage->aData == tdsqlite3PagerGetData(pPage->pDbPage) ); assert( pPage->isInit==1 ); assert( pPage->nFree<0 ); @@ -70508,10 +70508,10 @@ static int btreeInitPage(MemPage *pPage){ assert( pPage->pBt!=0 ); assert( pPage->pBt->db!=0 ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) ); - assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) ); - assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); + assert( pPage->pgno==tdsqlite3PagerPagenumber(pPage->pDbPage) ); + assert( pPage == tdsqlite3PagerGetExtra(pPage->pDbPage) ); + assert( pPage->aData == tdsqlite3PagerGetData(pPage->pDbPage) ); assert( pPage->isInit==0 ); pBt = pPage->pBt; @@ -70561,11 +70561,11 @@ static void zeroPage(MemPage *pPage, int flags){ u8 hdr = pPage->hdrOffset; u16 first; - assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno ); - assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); - assert( sqlite3PagerGetData(pPage->pDbPage) == data ); - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno ); + assert( tdsqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); + assert( tdsqlite3PagerGetData(pPage->pDbPage) == data ); + assert( tdsqlite3PagerIswriteable(pPage->pDbPage) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); if( pBt->btsFlags & BTS_FAST_SECURE ){ memset(&data[hdr], 0, pBt->usableSize - hdr); } @@ -70593,15 +70593,15 @@ static void zeroPage(MemPage *pPage, int flags){ ** the btree layer. */ static MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared *pBt){ - MemPage *pPage = (MemPage*)sqlite3PagerGetExtra(pDbPage); + MemPage *pPage = (MemPage*)tdsqlite3PagerGetExtra(pDbPage); if( pgno!=pPage->pgno ){ - pPage->aData = sqlite3PagerGetData(pDbPage); + pPage->aData = tdsqlite3PagerGetData(pDbPage); pPage->pDbPage = pDbPage; pPage->pBt = pBt; pPage->pgno = pgno; pPage->hdrOffset = pgno==1 ? 100 : 0; } - assert( pPage->aData==sqlite3PagerGetData(pDbPage) ); + assert( pPage->aData==tdsqlite3PagerGetData(pDbPage) ); return pPage; } @@ -70612,7 +70612,7 @@ static MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared *pBt){ ** If the PAGER_GET_NOCONTENT flag is set, it means that we do not care ** about the content of the page at this time. So do not go to the disk ** to fetch the content. Just fill in the content with zeros for now. -** If in the future we call sqlite3PagerWrite() on this page, that +** If in the future we call tdsqlite3PagerWrite() on this page, that ** means we have started to be concerned about content and the disk ** read should occur at that point. */ @@ -70626,8 +70626,8 @@ static int btreeGetPage( DbPage *pDbPage; assert( flags==0 || flags==PAGER_GET_NOCONTENT || flags==PAGER_GET_READONLY ); - assert( sqlite3_mutex_held(pBt->mutex) ); - rc = sqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, flags); + assert( tdsqlite3_mutex_held(pBt->mutex) ); + rc = tdsqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, flags); if( rc ) return rc; *ppPage = btreePageFromDbPage(pDbPage, pgno, pBt); return SQLITE_OK; @@ -70640,8 +70640,8 @@ static int btreeGetPage( */ static MemPage *btreePageLookup(BtShared *pBt, Pgno pgno){ DbPage *pDbPage; - assert( sqlite3_mutex_held(pBt->mutex) ); - pDbPage = sqlite3PagerLookup(pBt->pPager, pgno); + assert( tdsqlite3_mutex_held(pBt->mutex) ); + pDbPage = tdsqlite3PagerLookup(pBt->pPager, pgno); if( pDbPage ){ return btreePageFromDbPage(pDbPage, pgno, pBt); } @@ -70656,8 +70656,8 @@ static Pgno btreePagecount(BtShared *pBt){ assert( (pBt->nPage & 0x80000000)==0 || CORRUPT_DB ); return pBt->nPage; } -SQLITE_PRIVATE u32 sqlite3BtreeLastPage(Btree *p){ - assert( sqlite3BtreeHoldsMutex(p) ); +SQLITE_PRIVATE u32 tdsqlite3BtreeLastPage(Btree *p){ + assert( tdsqlite3BtreeHoldsMutex(p) ); return btreePagecount(p->pBt) & 0x7fffffff; } @@ -70683,7 +70683,7 @@ static int getAndInitPage( ){ int rc; DbPage *pDbPage; - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); assert( pCur==0 || ppPage==&pCur->pPage ); assert( pCur==0 || bReadOnly==pCur->curPagerFlags ); assert( pCur==0 || pCur->iPage>0 ); @@ -70692,11 +70692,11 @@ static int getAndInitPage( rc = SQLITE_CORRUPT_BKPT; goto getAndInitPage_error1; } - rc = sqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, bReadOnly); + rc = tdsqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, bReadOnly); if( rc ){ goto getAndInitPage_error1; } - *ppPage = (MemPage*)sqlite3PagerGetExtra(pDbPage); + *ppPage = (MemPage*)tdsqlite3PagerGetExtra(pDbPage); if( (*ppPage)->isInit==0 ){ btreePageFromDbPage(pDbPage, pgno, pBt); rc = btreeInitPage(*ppPage); @@ -70705,7 +70705,7 @@ static int getAndInitPage( } } assert( (*ppPage)->pgno==pgno ); - assert( (*ppPage)->aData==sqlite3PagerGetData(pDbPage) ); + assert( (*ppPage)->aData==tdsqlite3PagerGetData(pDbPage) ); /* If obtaining a child page for a cursor, we must verify that the page is ** compatible with the root page. */ @@ -70737,10 +70737,10 @@ static void releasePageNotNull(MemPage *pPage){ assert( pPage->aData ); assert( pPage->pBt ); assert( pPage->pDbPage!=0 ); - assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); - assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - sqlite3PagerUnrefNotNull(pPage->pDbPage); + assert( tdsqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); + assert( tdsqlite3PagerGetData(pPage->pDbPage)==pPage->aData ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); + tdsqlite3PagerUnrefNotNull(pPage->pDbPage); } static void releasePage(MemPage *pPage){ if( pPage ) releasePageNotNull(pPage); @@ -70750,10 +70750,10 @@ static void releasePageOne(MemPage *pPage){ assert( pPage->aData ); assert( pPage->pBt ); assert( pPage->pDbPage!=0 ); - assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); - assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - sqlite3PagerUnrefPageOne(pPage->pDbPage); + assert( tdsqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); + assert( tdsqlite3PagerGetData(pPage->pDbPage)==pPage->aData ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); + tdsqlite3PagerUnrefPageOne(pPage->pDbPage); } /* @@ -70773,7 +70773,7 @@ static int btreeGetUnusedPage( ){ int rc = btreeGetPage(pBt, pgno, ppPage, flags); if( rc==SQLITE_OK ){ - if( sqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){ + if( tdsqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){ releasePage(*ppPage); *ppPage = 0; return SQLITE_CORRUPT_BKPT; @@ -70796,12 +70796,12 @@ static int btreeGetUnusedPage( */ static void pageReinit(DbPage *pData){ MemPage *pPage; - pPage = (MemPage *)sqlite3PagerGetExtra(pData); - assert( sqlite3PagerPageRefcount(pData)>0 ); + pPage = (MemPage *)tdsqlite3PagerGetExtra(pData); + assert( tdsqlite3PagerPageRefcount(pData)>0 ); if( pPage->isInit ){ - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); pPage->isInit = 0; - if( sqlite3PagerPageRefcount(pData)>1 ){ + if( tdsqlite3PagerPageRefcount(pData)>1 ){ /* pPage might not be a btree page; it might be an overflow page ** or ptrmap page or a free page. In those cases, the following ** call to btreeInitPage() will likely return SQLITE_CORRUPT. @@ -70819,9 +70819,9 @@ static void pageReinit(DbPage *pData){ static int btreeInvokeBusyHandler(void *pArg){ BtShared *pBt = (BtShared*)pArg; assert( pBt->db ); - assert( sqlite3_mutex_held(pBt->db->mutex) ); - return sqlite3InvokeBusyHandler(&pBt->db->busyHandler, - sqlite3PagerFile(pBt->pPager)); + assert( tdsqlite3_mutex_held(pBt->db->mutex) ); + return tdsqlite3InvokeBusyHandler(&pBt->db->busyHandler, + tdsqlite3PagerFile(pBt->pPager)); } /* @@ -70831,7 +70831,7 @@ static int btreeInvokeBusyHandler(void *pArg){ ** then an ephemeral database is created. The ephemeral database might ** be exclusively in memory, or it might use a disk-based memory cache. ** Either way, the ephemeral database will be automatically deleted -** when sqlite3BtreeClose() is called. +** when tdsqlite3BtreeClose() is called. ** ** If zFilename is ":memory:" then an in-memory database is created ** that is automatically destroyed when it is closed. @@ -70845,17 +70845,17 @@ static int btreeInvokeBusyHandler(void *pArg){ ** objects in the same database connection since doing so will lead ** to problems with locking. */ -SQLITE_PRIVATE int sqlite3BtreeOpen( - sqlite3_vfs *pVfs, /* VFS to use for this b-tree */ +SQLITE_PRIVATE int tdsqlite3BtreeOpen( + tdsqlite3_vfs *pVfs, /* VFS to use for this b-tree */ const char *zFilename, /* Name of the file containing the BTree database */ - sqlite3 *db, /* Associated database handle */ + tdsqlite3 *db, /* Associated database handle */ Btree **ppBtree, /* Pointer to new Btree object written here */ int flags, /* Options */ - int vfsFlags /* Flags passed through to sqlite3_vfs.xOpen() */ + int vfsFlags /* Flags passed through to tdsqlite3_vfs.xOpen() */ ){ BtShared *pBt = 0; /* Shared part of btree structure */ Btree *p; /* Handle to return */ - sqlite3_mutex *mutexOpen = 0; /* Prevents a race condition. Ticket #3537 */ + tdsqlite3_mutex *mutexOpen = 0; /* Prevents a race condition. Ticket #3537 */ int rc = SQLITE_OK; /* Result code from this function */ u8 nReserve; /* Byte of unused space on each page */ unsigned char zDbHeader[100]; /* Database header content */ @@ -70870,13 +70870,13 @@ SQLITE_PRIVATE int sqlite3BtreeOpen( const int isMemdb = 0; #else const int isMemdb = (zFilename && strcmp(zFilename, ":memory:")==0) - || (isTempDb && sqlite3TempInMemory(db)) + || (isTempDb && tdsqlite3TempInMemory(db)) || (vfsFlags & SQLITE_OPEN_MEMORY)!=0; #endif assert( db!=0 ); assert( pVfs!=0 ); - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); assert( (flags&0xff)==flags ); /* flags fit in 8 bits */ /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */ @@ -70891,7 +70891,7 @@ SQLITE_PRIVATE int sqlite3BtreeOpen( if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (isMemdb || isTempDb) ){ vfsFlags = (vfsFlags & ~SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB; } - p = sqlite3MallocZero(sizeof(Btree)); + p = tdsqlite3MallocZero(sizeof(Btree)); if( !p ){ return SQLITE_NOMEM_BKPT; } @@ -70909,49 +70909,49 @@ SQLITE_PRIVATE int sqlite3BtreeOpen( */ if( isTempDb==0 && (isMemdb==0 || (vfsFlags&SQLITE_OPEN_URI)!=0) ){ if( vfsFlags & SQLITE_OPEN_SHAREDCACHE ){ - int nFilename = sqlite3Strlen30(zFilename)+1; + int nFilename = tdsqlite3Strlen30(zFilename)+1; int nFullPathname = pVfs->mxPathname+1; - char *zFullPathname = sqlite3Malloc(MAX(nFullPathname,nFilename)); - MUTEX_LOGIC( sqlite3_mutex *mutexShared; ) + char *zFullPathname = tdsqlite3Malloc(MAX(nFullPathname,nFilename)); + MUTEX_LOGIC( tdsqlite3_mutex *mutexShared; ) p->sharable = 1; if( !zFullPathname ){ - sqlite3_free(p); + tdsqlite3_free(p); return SQLITE_NOMEM_BKPT; } if( isMemdb ){ memcpy(zFullPathname, zFilename, nFilename); }else{ - rc = sqlite3OsFullPathname(pVfs, zFilename, + rc = tdsqlite3OsFullPathname(pVfs, zFilename, nFullPathname, zFullPathname); if( rc ){ if( rc==SQLITE_OK_SYMLINK ){ rc = SQLITE_OK; }else{ - sqlite3_free(zFullPathname); - sqlite3_free(p); + tdsqlite3_free(zFullPathname); + tdsqlite3_free(p); return rc; } } } #if SQLITE_THREADSAFE - mutexOpen = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_OPEN); - sqlite3_mutex_enter(mutexOpen); - mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); - sqlite3_mutex_enter(mutexShared); + mutexOpen = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_OPEN); + tdsqlite3_mutex_enter(mutexOpen); + mutexShared = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); + tdsqlite3_mutex_enter(mutexShared); #endif - for(pBt=GLOBAL(BtShared*,sqlite3SharedCacheList); pBt; pBt=pBt->pNext){ + for(pBt=GLOBAL(BtShared*,tdsqlite3SharedCacheList); pBt; pBt=pBt->pNext){ assert( pBt->nRef>0 ); - if( 0==strcmp(zFullPathname, sqlite3PagerFilename(pBt->pPager, 0)) - && sqlite3PagerVfs(pBt->pPager)==pVfs ){ + if( 0==strcmp(zFullPathname, tdsqlite3PagerFilename(pBt->pPager, 0)) + && tdsqlite3PagerVfs(pBt->pPager)==pVfs ){ int iDb; for(iDb=db->nDb-1; iDb>=0; iDb--){ Btree *pExisting = db->aDb[iDb].pBt; if( pExisting && pExisting->pBt==pBt ){ - sqlite3_mutex_leave(mutexShared); - sqlite3_mutex_leave(mutexOpen); - sqlite3_free(zFullPathname); - sqlite3_free(p); + tdsqlite3_mutex_leave(mutexShared); + tdsqlite3_mutex_leave(mutexOpen); + tdsqlite3_free(zFullPathname); + tdsqlite3_free(p); return SQLITE_CONSTRAINT; } } @@ -70960,14 +70960,14 @@ SQLITE_PRIVATE int sqlite3BtreeOpen( break; } } - sqlite3_mutex_leave(mutexShared); - sqlite3_free(zFullPathname); + tdsqlite3_mutex_leave(mutexShared); + tdsqlite3_free(zFullPathname); } #ifdef SQLITE_DEBUG else{ /* In debug mode, we mark all persistent databases as sharable ** even when they are not. This exercises the locking code and - ** gives more opportunity for asserts(sqlite3_mutex_held()) + ** gives more opportunity for asserts(tdsqlite3_mutex_held()) ** statements to find locking problems. */ p->sharable = 1; @@ -70987,28 +70987,28 @@ SQLITE_PRIVATE int sqlite3BtreeOpen( assert( sizeof(u16)==2 ); assert( sizeof(Pgno)==4 ); - pBt = sqlite3MallocZero( sizeof(*pBt) ); + pBt = tdsqlite3MallocZero( sizeof(*pBt) ); if( pBt==0 ){ rc = SQLITE_NOMEM_BKPT; goto btree_open_out; } - rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename, + rc = tdsqlite3PagerOpen(pVfs, &pBt->pPager, zFilename, sizeof(MemPage), flags, vfsFlags, pageReinit); if( rc==SQLITE_OK ){ - sqlite3PagerSetMmapLimit(pBt->pPager, db->szMmap); - rc = sqlite3PagerReadFileheader(pBt->pPager,sizeof(zDbHeader),zDbHeader); + tdsqlite3PagerSetMmapLimit(pBt->pPager, db->szMmap); + rc = tdsqlite3PagerReadFileheader(pBt->pPager,sizeof(zDbHeader),zDbHeader); } if( rc!=SQLITE_OK ){ goto btree_open_out; } pBt->openFlags = (u8)flags; pBt->db = db; - sqlite3PagerSetBusyHandler(pBt->pPager, btreeInvokeBusyHandler, pBt); + tdsqlite3PagerSetBusyHandler(pBt->pPager, btreeInvokeBusyHandler, pBt); p->pBt = pBt; pBt->pCursor = 0; pBt->pPage1 = 0; - if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY; + if( tdsqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY; #if defined(SQLITE_SECURE_DELETE) pBt->btsFlags |= BTS_SECURE_DELETE; #elif defined(SQLITE_FAST_SECURE_DELETE) @@ -71045,7 +71045,7 @@ SQLITE_PRIVATE int sqlite3BtreeOpen( pBt->incrVacuum = (get4byte(&zDbHeader[36 + 7*4])?1:0); #endif } - rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve); + rc = tdsqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve); if( rc ) goto btree_open_out; pBt->usableSize = pBt->pageSize - nReserve; assert( (pBt->pageSize & 7)==0 ); /* 8-byte alignment of pageSize */ @@ -71055,19 +71055,19 @@ SQLITE_PRIVATE int sqlite3BtreeOpen( */ pBt->nRef = 1; if( p->sharable ){ - MUTEX_LOGIC( sqlite3_mutex *mutexShared; ) - MUTEX_LOGIC( mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);) - if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){ - pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST); + MUTEX_LOGIC( tdsqlite3_mutex *mutexShared; ) + MUTEX_LOGIC( mutexShared = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);) + if( SQLITE_THREADSAFE && tdsqlite3GlobalConfig.bCoreMutex ){ + pBt->mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_FAST); if( pBt->mutex==0 ){ rc = SQLITE_NOMEM_BKPT; goto btree_open_out; } } - sqlite3_mutex_enter(mutexShared); - pBt->pNext = GLOBAL(BtShared*,sqlite3SharedCacheList); - GLOBAL(BtShared*,sqlite3SharedCacheList) = pBt; - sqlite3_mutex_leave(mutexShared); + tdsqlite3_mutex_enter(mutexShared); + pBt->pNext = GLOBAL(BtShared*,tdsqlite3SharedCacheList); + GLOBAL(BtShared*,tdsqlite3SharedCacheList) = pBt; + tdsqlite3_mutex_leave(mutexShared); } #endif } @@ -71108,32 +71108,32 @@ SQLITE_PRIVATE int sqlite3BtreeOpen( btree_open_out: if( rc!=SQLITE_OK ){ if( pBt && pBt->pPager ){ - sqlite3PagerClose(pBt->pPager, 0); + tdsqlite3PagerClose(pBt->pPager, 0); } - sqlite3_free(pBt); - sqlite3_free(p); + tdsqlite3_free(pBt); + tdsqlite3_free(p); *ppBtree = 0; }else{ - sqlite3_file *pFile; + tdsqlite3_file *pFile; /* If the B-Tree was successfully opened, set the pager-cache size to the ** default value. Except, when opening on an existing shared pager-cache, ** do not change the pager-cache size. */ - if( sqlite3BtreeSchema(p, 0, 0)==0 ){ - sqlite3PagerSetCachesize(p->pBt->pPager, SQLITE_DEFAULT_CACHE_SIZE); + if( tdsqlite3BtreeSchema(p, 0, 0)==0 ){ + tdsqlite3PagerSetCachesize(p->pBt->pPager, SQLITE_DEFAULT_CACHE_SIZE); } - pFile = sqlite3PagerFile(pBt->pPager); + pFile = tdsqlite3PagerFile(pBt->pPager); if( pFile->pMethods ){ - sqlite3OsFileControlHint(pFile, SQLITE_FCNTL_PDB, (void*)&pBt->db); + tdsqlite3OsFileControlHint(pFile, SQLITE_FCNTL_PDB, (void*)&pBt->db); } } if( mutexOpen ){ - assert( sqlite3_mutex_held(mutexOpen) ); - sqlite3_mutex_leave(mutexOpen); + assert( tdsqlite3_mutex_held(mutexOpen) ); + tdsqlite3_mutex_leave(mutexOpen); } - assert( rc!=SQLITE_OK || sqlite3BtreeConnectionCount(*ppBtree)>0 ); + assert( rc!=SQLITE_OK || tdsqlite3BtreeConnectionCount(*ppBtree)>0 ); return rc; } @@ -71145,19 +71145,19 @@ btree_open_out: */ static int removeFromSharingList(BtShared *pBt){ #ifndef SQLITE_OMIT_SHARED_CACHE - MUTEX_LOGIC( sqlite3_mutex *pMaster; ) + MUTEX_LOGIC( tdsqlite3_mutex *pMaster; ) BtShared *pList; int removed = 0; - assert( sqlite3_mutex_notheld(pBt->mutex) ); - MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) - sqlite3_mutex_enter(pMaster); + assert( tdsqlite3_mutex_notheld(pBt->mutex) ); + MUTEX_LOGIC( pMaster = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) + tdsqlite3_mutex_enter(pMaster); pBt->nRef--; if( pBt->nRef<=0 ){ - if( GLOBAL(BtShared*,sqlite3SharedCacheList)==pBt ){ - GLOBAL(BtShared*,sqlite3SharedCacheList) = pBt->pNext; + if( GLOBAL(BtShared*,tdsqlite3SharedCacheList)==pBt ){ + GLOBAL(BtShared*,tdsqlite3SharedCacheList) = pBt->pNext; }else{ - pList = GLOBAL(BtShared*,sqlite3SharedCacheList); + pList = GLOBAL(BtShared*,tdsqlite3SharedCacheList); while( ALWAYS(pList) && pList->pNext!=pBt ){ pList=pList->pNext; } @@ -71166,11 +71166,11 @@ static int removeFromSharingList(BtShared *pBt){ } } if( SQLITE_THREADSAFE ){ - sqlite3_mutex_free(pBt->mutex); + tdsqlite3_mutex_free(pBt->mutex); } removed = 1; } - sqlite3_mutex_leave(pMaster); + tdsqlite3_mutex_leave(pMaster); return removed; #else return 1; @@ -71184,7 +71184,7 @@ static int removeFromSharingList(BtShared *pBt){ */ static void allocateTempSpace(BtShared *pBt){ if( !pBt->pTmpSpace ){ - pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize ); + pBt->pTmpSpace = tdsqlite3PageMalloc( pBt->pageSize ); /* One of the uses of pBt->pTmpSpace is to format cells before ** inserting them into a leaf page (function fillInCell()). If @@ -71214,7 +71214,7 @@ static void allocateTempSpace(BtShared *pBt){ static void freeTempSpace(BtShared *pBt){ if( pBt->pTmpSpace ){ pBt->pTmpSpace -= 4; - sqlite3PageFree(pBt->pTmpSpace); + tdsqlite3PageFree(pBt->pTmpSpace); pBt->pTmpSpace = 0; } } @@ -71222,28 +71222,28 @@ static void freeTempSpace(BtShared *pBt){ /* ** Close an open database and invalidate all cursors. */ -SQLITE_PRIVATE int sqlite3BtreeClose(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeClose(Btree *p){ BtShared *pBt = p->pBt; BtCursor *pCur; /* Close all cursors opened via this handle. */ - assert( sqlite3_mutex_held(p->db->mutex) ); - sqlite3BtreeEnter(p); + assert( tdsqlite3_mutex_held(p->db->mutex) ); + tdsqlite3BtreeEnter(p); pCur = pBt->pCursor; while( pCur ){ BtCursor *pTmp = pCur; pCur = pCur->pNext; if( pTmp->pBtree==p ){ - sqlite3BtreeCloseCursor(pTmp); + tdsqlite3BtreeCloseCursor(pTmp); } } /* Rollback any active transaction and free the handle structure. - ** The call to sqlite3BtreeRollback() drops any table-locks held by + ** The call to tdsqlite3BtreeRollback() drops any table-locks held by ** this handle. */ - sqlite3BtreeRollback(p, SQLITE_OK, 0); - sqlite3BtreeLeave(p); + tdsqlite3BtreeRollback(p, SQLITE_OK, 0); + tdsqlite3BtreeLeave(p); /* If there are still other outstanding references to the shared-btree ** structure, return now. The remainder of this procedure cleans @@ -71257,13 +71257,13 @@ SQLITE_PRIVATE int sqlite3BtreeClose(Btree *p){ ** Clean out and delete the BtShared object. */ assert( !pBt->pCursor ); - sqlite3PagerClose(pBt->pPager, p->db); + tdsqlite3PagerClose(pBt->pPager, p->db); if( pBt->xFreeSchema && pBt->pSchema ){ pBt->xFreeSchema(pBt->pSchema); } - sqlite3DbFree(0, pBt->pSchema); + tdsqlite3DbFree(0, pBt->pSchema); freeTempSpace(pBt); - sqlite3_free(pBt); + tdsqlite3_free(pBt); } #ifndef SQLITE_OMIT_SHARED_CACHE @@ -71273,7 +71273,7 @@ SQLITE_PRIVATE int sqlite3BtreeClose(Btree *p){ if( p->pNext ) p->pNext->pPrev = p->pPrev; #endif - sqlite3_free(p); + tdsqlite3_free(p); return SQLITE_OK; } @@ -71284,12 +71284,12 @@ SQLITE_PRIVATE int sqlite3BtreeClose(Btree *p){ ** cache is allowed to grow larger than this limit if it contains ** dirty pages or pages still in active use. */ -SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree *p, int mxPage){ +SQLITE_PRIVATE int tdsqlite3BtreeSetCacheSize(Btree *p, int mxPage){ BtShared *pBt = p->pBt; - assert( sqlite3_mutex_held(p->db->mutex) ); - sqlite3BtreeEnter(p); - sqlite3PagerSetCachesize(pBt->pPager, mxPage); - sqlite3BtreeLeave(p); + assert( tdsqlite3_mutex_held(p->db->mutex) ); + tdsqlite3BtreeEnter(p); + tdsqlite3PagerSetCachesize(pBt->pPager, mxPage); + tdsqlite3BtreeLeave(p); return SQLITE_OK; } @@ -71303,13 +71303,13 @@ SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree *p, int mxPage){ ** as an argument, no changes are made to the spill size setting, so ** using mxPage of 0 is a way to query the current spill size. */ -SQLITE_PRIVATE int sqlite3BtreeSetSpillSize(Btree *p, int mxPage){ +SQLITE_PRIVATE int tdsqlite3BtreeSetSpillSize(Btree *p, int mxPage){ BtShared *pBt = p->pBt; int res; - assert( sqlite3_mutex_held(p->db->mutex) ); - sqlite3BtreeEnter(p); - res = sqlite3PagerSetSpillsize(pBt->pPager, mxPage); - sqlite3BtreeLeave(p); + assert( tdsqlite3_mutex_held(p->db->mutex) ); + tdsqlite3BtreeEnter(p); + res = tdsqlite3PagerSetSpillsize(pBt->pPager, mxPage); + tdsqlite3BtreeLeave(p); return res; } @@ -71318,12 +71318,12 @@ SQLITE_PRIVATE int sqlite3BtreeSetSpillSize(Btree *p, int mxPage){ ** Change the limit on the amount of the database file that may be ** memory mapped. */ -SQLITE_PRIVATE int sqlite3BtreeSetMmapLimit(Btree *p, sqlite3_int64 szMmap){ +SQLITE_PRIVATE int tdsqlite3BtreeSetMmapLimit(Btree *p, tdsqlite3_int64 szMmap){ BtShared *pBt = p->pBt; - assert( sqlite3_mutex_held(p->db->mutex) ); - sqlite3BtreeEnter(p); - sqlite3PagerSetMmapLimit(pBt->pPager, szMmap); - sqlite3BtreeLeave(p); + assert( tdsqlite3_mutex_held(p->db->mutex) ); + tdsqlite3BtreeEnter(p); + tdsqlite3PagerSetMmapLimit(pBt->pPager, szMmap); + tdsqlite3BtreeLeave(p); return SQLITE_OK; } #endif /* SQLITE_MAX_MMAP_SIZE>0 */ @@ -71337,15 +71337,15 @@ SQLITE_PRIVATE int sqlite3BtreeSetMmapLimit(Btree *p, sqlite3_int64 szMmap){ ** probability of damage to near zero but with a write performance reduction. */ #ifndef SQLITE_OMIT_PAGER_PRAGMAS -SQLITE_PRIVATE int sqlite3BtreeSetPagerFlags( +SQLITE_PRIVATE int tdsqlite3BtreeSetPagerFlags( Btree *p, /* The btree to set the safety level on */ unsigned pgFlags /* Various PAGER_* flags */ ){ BtShared *pBt = p->pBt; - assert( sqlite3_mutex_held(p->db->mutex) ); - sqlite3BtreeEnter(p); - sqlite3PagerSetFlags(pBt->pPager, pgFlags); - sqlite3BtreeLeave(p); + assert( tdsqlite3_mutex_held(p->db->mutex) ); + tdsqlite3BtreeEnter(p); + tdsqlite3PagerSetFlags(pBt->pPager, pgFlags); + tdsqlite3BtreeLeave(p); return SQLITE_OK; } #endif @@ -71370,16 +71370,16 @@ SQLITE_PRIVATE int sqlite3BtreeSetPagerFlags( ** If the iFix!=0 then the BTS_PAGESIZE_FIXED flag is set so that the page size ** and autovacuum mode can no longer be changed. */ -SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve, int iFix){ +SQLITE_PRIVATE int tdsqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve, int iFix){ int rc = SQLITE_OK; BtShared *pBt = p->pBt; assert( nReserve>=-1 && nReserve<=255 ); - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); #if SQLITE_HAS_CODEC if( nReserve>pBt->optimalReserve ) pBt->optimalReserve = (u8)nReserve; #endif if( pBt->btsFlags & BTS_PAGESIZE_FIXED ){ - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return SQLITE_READONLY; } if( nReserve<0 ){ @@ -71393,34 +71393,34 @@ SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve, pBt->pageSize = (u32)pageSize; freeTempSpace(pBt); } - rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve); + rc = tdsqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve); pBt->usableSize = pBt->pageSize - (u16)nReserve; if( iFix ) pBt->btsFlags |= BTS_PAGESIZE_FIXED; - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } /* ** Return the currently defined page size */ -SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeGetPageSize(Btree *p){ return p->pBt->pageSize; } /* -** This function is similar to sqlite3BtreeGetReserve(), except that it +** This function is similar to tdsqlite3BtreeGetReserve(), except that it ** may only be called if it is guaranteed that the b-tree mutex is already ** held. ** ** This is useful in one special case in the backup API code where it is ** known that the shared b-tree mutex is held, but the mutex on the -** database handle that owns *p is not. In this case if sqlite3BtreeEnter() +** database handle that owns *p is not. In this case if tdsqlite3BtreeEnter() ** were to be called, it might collide with some other operation on the ** database handle that owns *p, causing undefined behavior. */ -SQLITE_PRIVATE int sqlite3BtreeGetReserveNoMutex(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeGetReserveNoMutex(Btree *p){ int n; - assert( sqlite3_mutex_held(p->pBt->mutex) ); + assert( tdsqlite3_mutex_held(p->pBt->mutex) ); n = p->pBt->pageSize - p->pBt->usableSize; return n; } @@ -71434,14 +71434,14 @@ SQLITE_PRIVATE int sqlite3BtreeGetReserveNoMutex(Btree *p){ ** greater of the current reserved space and the maximum requested ** reserve space. */ -SQLITE_PRIVATE int sqlite3BtreeGetOptimalReserve(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeGetOptimalReserve(Btree *p){ int n; - sqlite3BtreeEnter(p); - n = sqlite3BtreeGetReserveNoMutex(p); + tdsqlite3BtreeEnter(p); + n = tdsqlite3BtreeGetReserveNoMutex(p); #ifdef SQLITE_HAS_CODEC if( npBt->optimalReserve ) n = p->pBt->optimalReserve; #endif - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return n; } @@ -71451,11 +71451,11 @@ SQLITE_PRIVATE int sqlite3BtreeGetOptimalReserve(Btree *p){ ** No changes are made if mxPage is 0 or negative. ** Regardless of the value of mxPage, return the maximum page count. */ -SQLITE_PRIVATE int sqlite3BtreeMaxPageCount(Btree *p, int mxPage){ +SQLITE_PRIVATE int tdsqlite3BtreeMaxPageCount(Btree *p, int mxPage){ int n; - sqlite3BtreeEnter(p); - n = sqlite3PagerMaxPageCount(p->pBt->pPager, mxPage); - sqlite3BtreeLeave(p); + tdsqlite3BtreeEnter(p); + n = tdsqlite3PagerMaxPageCount(p->pBt->pPager, mxPage); + tdsqlite3BtreeLeave(p); return n; } @@ -71477,10 +71477,10 @@ SQLITE_PRIVATE int sqlite3BtreeMaxPageCount(Btree *p, int mxPage){ ** that freelist leaf pages are written back into the database, increasing ** the amount of disk I/O. */ -SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree *p, int newFlag){ +SQLITE_PRIVATE int tdsqlite3BtreeSecureDelete(Btree *p, int newFlag){ int b; if( p==0 ) return 0; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); assert( BTS_OVERWRITE==BTS_SECURE_DELETE*2 ); assert( BTS_FAST_SECURE==(BTS_OVERWRITE|BTS_SECURE_DELETE) ); if( newFlag>=0 ){ @@ -71488,7 +71488,7 @@ SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree *p, int newFlag){ p->pBt->btsFlags |= BTS_SECURE_DELETE*newFlag; } b = (p->pBt->btsFlags & BTS_FAST_SECURE)/BTS_SECURE_DELETE; - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return b; } @@ -71498,7 +71498,7 @@ SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree *p, int newFlag){ ** is disabled. The default value for the auto-vacuum property is ** determined by the SQLITE_DEFAULT_AUTOVACUUM macro. */ -SQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){ +SQLITE_PRIVATE int tdsqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){ #ifdef SQLITE_OMIT_AUTOVACUUM return SQLITE_READONLY; #else @@ -71506,14 +71506,14 @@ SQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){ int rc = SQLITE_OK; u8 av = (u8)autoVacuum; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); if( (pBt->btsFlags & BTS_PAGESIZE_FIXED)!=0 && (av ?1:0)!=pBt->autoVacuum ){ rc = SQLITE_READONLY; }else{ pBt->autoVacuum = av ?1:0; pBt->incrVacuum = av==2 ?1:0; } - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; #endif } @@ -71522,18 +71522,18 @@ SQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){ ** Return the value of the 'auto-vacuum' property. If auto-vacuum is ** enabled 1 is returned. Otherwise 0. */ -SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeGetAutoVacuum(Btree *p){ #ifdef SQLITE_OMIT_AUTOVACUUM return BTREE_AUTOVACUUM_NONE; #else int rc; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); rc = ( (!p->pBt->autoVacuum)?BTREE_AUTOVACUUM_NONE: (!p->pBt->incrVacuum)?BTREE_AUTOVACUUM_FULL: BTREE_AUTOVACUUM_INCR ); - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; #endif } @@ -71547,7 +71547,7 @@ SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *p){ #if SQLITE_DEFAULT_SYNCHRONOUS!=SQLITE_DEFAULT_WAL_SYNCHRONOUS \ && !defined(SQLITE_OMIT_WAL) static void setDefaultSyncFlag(BtShared *pBt, u8 safety_level){ - sqlite3 *db; + tdsqlite3 *db; Db *pDb; if( (db=pBt->db)!=0 && (pDb=db->aDb)!=0 ){ while( pDb->pBt==0 || pDb->pBt->pBt!=pBt ){ pDb++; } @@ -71556,7 +71556,7 @@ static void setDefaultSyncFlag(BtShared *pBt, u8 safety_level){ && pDb!=&db->aDb[1] ){ pDb->safety_level = safety_level; - sqlite3PagerSetFlags(pBt->pPager, + tdsqlite3PagerSetFlags(pBt->pPager, pDb->safety_level | (db->flags & PAGER_FLAGS_MASK)); } } @@ -71585,9 +71585,9 @@ static int lockBtree(BtShared *pBt){ u32 nPageFile = 0; /* Number of pages in the database file */ u32 nPageHeader; /* Number of pages in the database according to hdr */ - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); assert( pBt->pPage1==0 ); - rc = sqlite3PagerSharedLock(pBt->pPager); + rc = tdsqlite3PagerSharedLock(pBt->pPager); if( rc!=SQLITE_OK ) return rc; rc = btreeGetPage(pBt, 1, &pPage1, 0); if( rc!=SQLITE_OK ) return rc; @@ -71596,7 +71596,7 @@ static int lockBtree(BtShared *pBt){ ** a valid database file. */ nPage = nPageHeader = get4byte(28+(u8*)pPage1->aData); - sqlite3PagerPagecount(pBt->pPager, (int*)&nPageFile); + tdsqlite3PagerPagecount(pBt->pPager, (int*)&nPageFile); if( nPage==0 || memcmp(24+(u8*)pPage1->aData, 92+(u8*)pPage1->aData,4)!=0 ){ nPage = nPageFile; } @@ -71640,7 +71640,7 @@ static int lockBtree(BtShared *pBt){ */ if( page1[19]==2 && (pBt->btsFlags & BTS_NO_WAL)==0 ){ int isOpen = 0; - rc = sqlite3PagerOpenWal(pBt->pPager, &isOpen); + rc = tdsqlite3PagerOpenWal(pBt->pPager, &isOpen); if( rc!=SQLITE_OK ){ goto page1_init_failed; }else{ @@ -71698,11 +71698,11 @@ static int lockBtree(BtShared *pBt){ pBt->usableSize = usableSize; pBt->pageSize = pageSize; freeTempSpace(pBt); - rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, + rc = tdsqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, pageSize-usableSize); return rc; } - if( sqlite3WritableSchema(pBt->db)==0 && nPage>nPageFile ){ + if( tdsqlite3WritableSchema(pBt->db)==0 && nPage>nPageFile ){ rc = SQLITE_CORRUPT_BKPT; goto page1_init_failed; } @@ -71786,12 +71786,12 @@ static int countValidCursors(BtShared *pBt, int wrOnly){ ** If there is a transaction in progress, this routine is a no-op. */ static void unlockBtreeIfUnused(BtShared *pBt){ - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); assert( countValidCursors(pBt,0)==0 || pBt->inTransaction>TRANS_NONE ); if( pBt->inTransaction==TRANS_NONE && pBt->pPage1!=0 ){ MemPage *pPage1 = pBt->pPage1; assert( pPage1->aData ); - assert( sqlite3PagerRefcount(pBt->pPager)==1 ); + assert( tdsqlite3PagerRefcount(pBt->pPager)==1 ); pBt->pPage1 = 0; releasePageOne(pPage1); } @@ -71807,14 +71807,14 @@ static int newDatabase(BtShared *pBt){ unsigned char *data; int rc; - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); if( pBt->nPage>0 ){ return SQLITE_OK; } pP1 = pBt->pPage1; assert( pP1!=0 ); data = pP1->aData; - rc = sqlite3PagerWrite(pP1->pDbPage); + rc = tdsqlite3PagerWrite(pP1->pDbPage); if( rc ) return rc; memcpy(data, zMagicHeader, sizeof(zMagicHeader)); assert( sizeof(zMagicHeader)==16 ); @@ -71846,12 +71846,12 @@ static int newDatabase(BtShared *pBt){ ** consisting of a single page and no schema objects). Return SQLITE_OK ** if successful, or an SQLite error code otherwise. */ -SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeNewDb(Btree *p){ int rc; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); p->pBt->nPage = 0; rc = newDatabase(p->pBt); - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } @@ -71868,13 +71868,13 @@ SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p){ ** changes to the database. None of the following routines ** will work unless a transaction is started first: ** -** sqlite3BtreeCreateTable() -** sqlite3BtreeCreateIndex() -** sqlite3BtreeClearTable() -** sqlite3BtreeDropTable() -** sqlite3BtreeInsert() -** sqlite3BtreeDelete() -** sqlite3BtreeUpdateMeta() +** tdsqlite3BtreeCreateTable() +** tdsqlite3BtreeCreateIndex() +** tdsqlite3BtreeClearTable() +** tdsqlite3BtreeDropTable() +** tdsqlite3BtreeInsert() +** tdsqlite3BtreeDelete() +** tdsqlite3BtreeUpdateMeta() ** ** If an initial attempt to acquire the lock fails because of lock contention ** and the database was previously unlocked, then invoke the busy handler @@ -71890,11 +71890,11 @@ SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p){ ** when A already has a read lock, we encourage A to give up and let B ** proceed. */ -SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree *p, int wrflag, int *pSchemaVersion){ +SQLITE_PRIVATE int tdsqlite3BtreeBeginTrans(Btree *p, int wrflag, int *pSchemaVersion){ BtShared *pBt = p->pBt; int rc = SQLITE_OK; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); btreeIntegrity(p); /* If the btree is already in a write-transaction, or it @@ -71907,7 +71907,7 @@ SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree *p, int wrflag, int *pSchemaVers assert( pBt->inTransaction==TRANS_WRITE || IfNotOmitAV(pBt->bDoTruncate)==0 ); if( (p->db->flags & SQLITE_ResetDatabase) - && sqlite3PagerIsreadonly(pBt->pPager)==0 + && tdsqlite3PagerIsreadonly(pBt->pPager)==0 ){ pBt->btsFlags &= ~BTS_READ_ONLY; } @@ -71920,7 +71920,7 @@ SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree *p, int wrflag, int *pSchemaVers #ifndef SQLITE_OMIT_SHARED_CACHE { - sqlite3 *pBlock = 0; + tdsqlite3 *pBlock = 0; /* If another database handle has already opened a write transaction ** on this shared-btree structure and a second write transaction is ** requested, return SQLITE_LOCKED. @@ -71939,7 +71939,7 @@ SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree *p, int wrflag, int *pSchemaVers } } if( pBlock ){ - sqlite3ConnectionBlocked(p->db, pBlock); + tdsqlite3ConnectionBlocked(p->db, pBlock); rc = SQLITE_LOCKED_SHAREDCACHE; goto trans_begun; } @@ -71968,7 +71968,7 @@ SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree *p, int wrflag, int *pSchemaVers if( (pBt->btsFlags & BTS_READ_ONLY)!=0 ){ rc = SQLITE_READONLY; }else{ - rc = sqlite3PagerBegin(pBt->pPager,wrflag>1,sqlite3TempInMemory(p->db)); + rc = tdsqlite3PagerBegin(pBt->pPager,wrflag>1,tdsqlite3TempInMemory(p->db)); if( rc==SQLITE_OK ){ rc = newDatabase(pBt); }else if( rc==SQLITE_BUSY_SNAPSHOT && pBt->inTransaction==TRANS_NONE ){ @@ -71985,7 +71985,7 @@ SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree *p, int wrflag, int *pSchemaVers } }while( (rc&0xFF)==SQLITE_BUSY && pBt->inTransaction==TRANS_NONE && btreeInvokeBusyHandler(pBt) ); - sqlite3PagerResetLockTimeout(pBt->pPager); + tdsqlite3PagerResetLockTimeout(pBt->pPager); if( rc==SQLITE_OK ){ if( p->inTrans==TRANS_NONE ){ @@ -72019,7 +72019,7 @@ SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree *p, int wrflag, int *pSchemaVers ** rollback occurs within the transaction. */ if( pBt->nPage!=get4byte(&pPage1->aData[28]) ){ - rc = sqlite3PagerWrite(pPage1->pDbPage); + rc = tdsqlite3PagerWrite(pPage1->pDbPage); if( rc==SQLITE_OK ){ put4byte(&pPage1->aData[28], pBt->nPage); } @@ -72037,12 +72037,12 @@ trans_begun: ** open savepoints. If the second parameter is greater than 0 and ** the sub-journal is not already open, then it will be opened here. */ - rc = sqlite3PagerOpenSavepoint(pBt->pPager, p->db->nSavepoint); + rc = tdsqlite3PagerOpenSavepoint(pBt->pPager, p->db->nSavepoint); } } btreeIntegrity(p); - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } @@ -72060,7 +72060,7 @@ static int setChildPtrmaps(MemPage *pPage){ BtShared *pBt = pPage->pBt; Pgno pgno = pPage->pgno; - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); rc = pPage->isInit ? SQLITE_OK : btreeInitPage(pPage); if( rc!=SQLITE_OK ) return rc; nCell = pPage->nCell; @@ -72099,8 +72099,8 @@ static int setChildPtrmaps(MemPage *pPage){ ** overflow page in the list. */ static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){ - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3PagerIswriteable(pPage->pDbPage) ); if( eType==PTRMAP_OVERFLOW2 ){ /* The pointer is always the first 4 bytes of the page in this case. */ if( get4byte(pPage->aData)!=iFrom ){ @@ -72165,7 +72165,7 @@ static int relocatePage( u8 eType, /* Pointer map 'type' entry for pDbPage */ Pgno iPtrPage, /* Pointer map 'page-no' entry for pDbPage */ Pgno iFreePage, /* The location to move pDbPage to */ - int isCommit /* isCommit flag passed to sqlite3PagerMovepage */ + int isCommit /* isCommit flag passed to tdsqlite3PagerMovepage */ ){ MemPage *pPtrPage; /* The page that contains a pointer to pDbPage */ Pgno iDbPage = pDbPage->pgno; @@ -72174,14 +72174,14 @@ static int relocatePage( assert( eType==PTRMAP_OVERFLOW2 || eType==PTRMAP_OVERFLOW1 || eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE ); - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); assert( pDbPage->pBt==pBt ); if( iDbPage<3 ) return SQLITE_CORRUPT_BKPT; /* Move page iDbPage from its current location to page number iFreePage */ TRACE(("AUTOVACUUM: Moving %d to free page %d (ptr page %d type %d)\n", iDbPage, iFreePage, iPtrPage, eType)); - rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit); + rc = tdsqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit); if( rc!=SQLITE_OK ){ return rc; } @@ -72219,7 +72219,7 @@ static int relocatePage( if( rc!=SQLITE_OK ){ return rc; } - rc = sqlite3PagerWrite(pPtrPage->pDbPage); + rc = tdsqlite3PagerWrite(pPtrPage->pDbPage); if( rc!=SQLITE_OK ){ releasePage(pPtrPage); return rc; @@ -72257,7 +72257,7 @@ static int incrVacuumStep(BtShared *pBt, Pgno nFin, Pgno iLastPg, int bCommit){ Pgno nFreeList; /* Number of pages still on the free-list */ int rc; - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); assert( iLastPg>nFin ); if( !PTRMAP_ISPAGE(pBt, iLastPg) && iLastPg!=PENDING_BYTE_PAGE(pBt) ){ @@ -72375,11 +72375,11 @@ static Pgno finalDbSize(BtShared *pBt, Pgno nOrig, Pgno nFree){ ** SQLITE_DONE is returned. If it is not finished, but no error occurred, ** SQLITE_OK is returned. Otherwise an SQLite error code. */ -SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeIncrVacuum(Btree *p){ int rc; BtShared *pBt = p->pBt; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); assert( pBt->inTransaction==TRANS_WRITE && p->inTrans==TRANS_WRITE ); if( !pBt->autoVacuum ){ rc = SQLITE_DONE; @@ -72397,19 +72397,19 @@ SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *p){ rc = incrVacuumStep(pBt, nFin, nOrig, 0); } if( rc==SQLITE_OK ){ - rc = sqlite3PagerWrite(pBt->pPage1->pDbPage); + rc = tdsqlite3PagerWrite(pBt->pPage1->pDbPage); put4byte(&pBt->pPage1->aData[28], pBt->nPage); } }else{ rc = SQLITE_DONE; } } - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } /* -** This routine is called prior to sqlite3PagerCommit when a transaction +** This routine is called prior to tdsqlite3PagerCommit when a transaction ** is committed for an auto-vacuum database. ** ** If SQLITE_OK is returned, then *pnTrunc is set to the number of pages @@ -72420,9 +72420,9 @@ SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *p){ static int autoVacuumCommit(BtShared *pBt){ int rc = SQLITE_OK; Pager *pPager = pBt->pPager; - VVA_ONLY( int nRef = sqlite3PagerRefcount(pPager); ) + VVA_ONLY( int nRef = tdsqlite3PagerRefcount(pPager); ) - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); invalidateAllOverflowCache(pBt); assert(pBt->autoVacuum); if( !pBt->incrVacuum ){ @@ -72450,7 +72450,7 @@ static int autoVacuumCommit(BtShared *pBt){ rc = incrVacuumStep(pBt, nFin, iFree, 1); } if( (rc==SQLITE_DONE || rc==SQLITE_OK) && nFree>0 ){ - rc = sqlite3PagerWrite(pBt->pPage1->pDbPage); + rc = tdsqlite3PagerWrite(pBt->pPage1->pDbPage); put4byte(&pBt->pPage1->aData[32], 0); put4byte(&pBt->pPage1->aData[36], 0); put4byte(&pBt->pPage1->aData[28], nFin); @@ -72458,11 +72458,11 @@ static int autoVacuumCommit(BtShared *pBt){ pBt->nPage = nFin; } if( rc!=SQLITE_OK ){ - sqlite3PagerRollback(pPager); + tdsqlite3PagerRollback(pPager); } } - assert( nRef>=sqlite3PagerRefcount(pPager) ); + assert( nRef>=tdsqlite3PagerRefcount(pPager) ); return rc; } @@ -72480,7 +72480,7 @@ static int autoVacuumCommit(BtShared *pBt){ ** database are written into the database file and flushed to oxide. ** At the end of this call, the rollback journal still exists on the ** disk and we are still holding all locks, so the transaction has not -** committed. See sqlite3BtreeCommitPhaseTwo() for the second phase of the +** committed. See tdsqlite3BtreeCommitPhaseTwo() for the second phase of the ** commit process. ** ** This call is a no-op if no write-transaction is currently active on pBt. @@ -72496,25 +72496,25 @@ static int autoVacuumCommit(BtShared *pBt){ ** Once this is routine has returned, the only thing required to commit ** the write-transaction for this database file is to delete the journal. */ -SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zMaster){ +SQLITE_PRIVATE int tdsqlite3BtreeCommitPhaseOne(Btree *p, const char *zMaster){ int rc = SQLITE_OK; if( p->inTrans==TRANS_WRITE ){ BtShared *pBt = p->pBt; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); #ifndef SQLITE_OMIT_AUTOVACUUM if( pBt->autoVacuum ){ rc = autoVacuumCommit(pBt); if( rc!=SQLITE_OK ){ - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } } if( pBt->bDoTruncate ){ - sqlite3PagerTruncateImage(pBt->pPager, pBt->nPage); + tdsqlite3PagerTruncateImage(pBt->pPager, pBt->nPage); } #endif - rc = sqlite3PagerCommitPhaseOne(pBt->pPager, zMaster, 0); - sqlite3BtreeLeave(p); + rc = tdsqlite3PagerCommitPhaseOne(pBt->pPager, zMaster, 0); + tdsqlite3BtreeLeave(p); } return rc; } @@ -72525,8 +72525,8 @@ SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zMaster){ */ static void btreeEndTransaction(Btree *p){ BtShared *pBt = p->pBt; - sqlite3 *db = p->db; - assert( sqlite3BtreeHoldsMutex(p) ); + tdsqlite3 *db = p->db; + assert( tdsqlite3BtreeHoldsMutex(p) ); #ifndef SQLITE_OMIT_AUTOVACUUM pBt->bDoTruncate = 0; @@ -72563,8 +72563,8 @@ static void btreeEndTransaction(Btree *p){ ** Commit the transaction currently in progress. ** ** This routine implements the second phase of a 2-phase commit. The -** sqlite3BtreeCommitPhaseOne() routine does the first phase and should -** be invoked prior to calling this routine. The sqlite3BtreeCommitPhaseOne() +** tdsqlite3BtreeCommitPhaseOne() routine does the first phase and should +** be invoked prior to calling this routine. The tdsqlite3BtreeCommitPhaseOne() ** routine did all the work of writing information out to disk and flushing the ** contents so that they are written onto the disk platter. All this ** routine has to do is delete or truncate or zero the header in the @@ -72585,10 +72585,10 @@ static void btreeEndTransaction(Btree *p){ ** This will release the write lock on the database file. If there ** are no active cursors, it also releases the read lock. */ -SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){ +SQLITE_PRIVATE int tdsqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){ if( p->inTrans==TRANS_NONE ) return SQLITE_OK; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); btreeIntegrity(p); /* If the handle has a write-transaction open, commit the shared-btrees @@ -72599,9 +72599,9 @@ SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){ BtShared *pBt = p->pBt; assert( pBt->inTransaction==TRANS_WRITE ); assert( pBt->nTransaction>0 ); - rc = sqlite3PagerCommitPhaseTwo(pBt->pPager); + rc = tdsqlite3PagerCommitPhaseTwo(pBt->pPager); if( rc!=SQLITE_OK && bCleanup==0 ){ - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } p->iDataVersion--; /* Compensate for pPager->iDataVersion++; */ @@ -72610,21 +72610,21 @@ SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){ } btreeEndTransaction(p); - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return SQLITE_OK; } /* ** Do both phases of a commit. */ -SQLITE_PRIVATE int sqlite3BtreeCommit(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeCommit(Btree *p){ int rc; - sqlite3BtreeEnter(p); - rc = sqlite3BtreeCommitPhaseOne(p, 0); + tdsqlite3BtreeEnter(p); + rc = tdsqlite3BtreeCommitPhaseOne(p, 0); if( rc==SQLITE_OK ){ - rc = sqlite3BtreeCommitPhaseTwo(p, 0); + rc = tdsqlite3BtreeCommitPhaseTwo(p, 0); } - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } @@ -72654,30 +72654,30 @@ SQLITE_PRIVATE int sqlite3BtreeCommit(Btree *p){ ** SQLITE_OK is returned if successful, or if an error occurs while ** saving a cursor position, an SQLite error code. */ -SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode, int writeOnly){ +SQLITE_PRIVATE int tdsqlite3BtreeTripAllCursors(Btree *pBtree, int errCode, int writeOnly){ BtCursor *p; int rc = SQLITE_OK; assert( (writeOnly==0 || writeOnly==1) && BTCF_WriteFlag==1 ); if( pBtree ){ - sqlite3BtreeEnter(pBtree); + tdsqlite3BtreeEnter(pBtree); for(p=pBtree->pBt->pCursor; p; p=p->pNext){ if( writeOnly && (p->curFlags & BTCF_WriteFlag)==0 ){ if( p->eState==CURSOR_VALID || p->eState==CURSOR_SKIPNEXT ){ rc = saveCursorPosition(p); if( rc!=SQLITE_OK ){ - (void)sqlite3BtreeTripAllCursors(pBtree, rc, 0); + (void)tdsqlite3BtreeTripAllCursors(pBtree, rc, 0); break; } } }else{ - sqlite3BtreeClearCursor(p); + tdsqlite3BtreeClearCursor(p); p->eState = CURSOR_FAULT; p->skipNext = errCode; } btreeReleaseAllCursorPages(p); } - sqlite3BtreeLeave(pBtree); + tdsqlite3BtreeLeave(pBtree); } return rc; } @@ -72689,7 +72689,7 @@ SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode, int wr static void btreeSetNPage(BtShared *pBt, MemPage *pPage1){ int nPage = get4byte(&pPage1->aData[28]); testcase( nPage==0 ); - if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage); + if( nPage==0 ) tdsqlite3PagerPagecount(pBt->pPager, &nPage); testcase( pBt->nPage!=nPage ); pBt->nPage = nPage; } @@ -72705,14 +72705,14 @@ static void btreeSetNPage(BtShared *pBt, MemPage *pPage1){ ** This will release the write lock on the database file. If there ** are no active cursors, it also releases the read lock. */ -SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){ +SQLITE_PRIVATE int tdsqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){ int rc; BtShared *pBt = p->pBt; MemPage *pPage1; assert( writeOnly==1 || writeOnly==0 ); assert( tripCode==SQLITE_ABORT_ROLLBACK || tripCode==SQLITE_OK ); - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); if( tripCode==SQLITE_OK ){ rc = tripCode = saveAllCursors(pBt, 0, 0); if( rc ) writeOnly = 0; @@ -72720,7 +72720,7 @@ SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){ rc = SQLITE_OK; } if( tripCode ){ - int rc2 = sqlite3BtreeTripAllCursors(p, tripCode, writeOnly); + int rc2 = tdsqlite3BtreeTripAllCursors(p, tripCode, writeOnly); assert( rc==SQLITE_OK || (writeOnly==0 && rc2==SQLITE_OK) ); if( rc2!=SQLITE_OK ) rc = rc2; } @@ -72730,7 +72730,7 @@ SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){ int rc2; assert( TRANS_WRITE==pBt->inTransaction ); - rc2 = sqlite3PagerRollback(pBt->pPager); + rc2 = tdsqlite3PagerRollback(pBt->pPager); if( rc2!=SQLITE_OK ){ rc = rc2; } @@ -72748,7 +72748,7 @@ SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){ } btreeEndTransaction(p); - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } @@ -72768,12 +72768,12 @@ SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){ ** including the new anonymous savepoint, open on the B-Tree. i.e. if there ** are no active savepoints and no other statement-transactions open, ** iStatement is 1. This anonymous savepoint can be released or rolled back -** using the sqlite3BtreeSavepoint() function. +** using the tdsqlite3BtreeSavepoint() function. */ -SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree *p, int iStatement){ +SQLITE_PRIVATE int tdsqlite3BtreeBeginStmt(Btree *p, int iStatement){ int rc; BtShared *pBt = p->pBt; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); assert( p->inTrans==TRANS_WRITE ); assert( (pBt->btsFlags & BTS_READ_ONLY)==0 ); assert( iStatement>0 ); @@ -72784,8 +72784,8 @@ SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree *p, int iStatement){ ** SQL statements. It is illegal to open, release or rollback any ** such savepoints while the statement transaction savepoint is active. */ - rc = sqlite3PagerOpenSavepoint(pBt->pPager, iStatement); - sqlite3BtreeLeave(p); + rc = tdsqlite3PagerOpenSavepoint(pBt->pPager, iStatement); + tdsqlite3BtreeLeave(p); return rc; } @@ -72801,18 +72801,18 @@ SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree *p, int iStatement){ ** from a normal transaction rollback, as no locks are released and the ** transaction remains open. */ -SQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){ +SQLITE_PRIVATE int tdsqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){ int rc = SQLITE_OK; if( p && p->inTrans==TRANS_WRITE ){ BtShared *pBt = p->pBt; assert( op==SAVEPOINT_RELEASE || op==SAVEPOINT_ROLLBACK ); assert( iSavepoint>=0 || (iSavepoint==-1 && op==SAVEPOINT_ROLLBACK) ); - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); if( op==SAVEPOINT_ROLLBACK ){ rc = saveAllCursors(pBt, 0, 0); } if( rc==SQLITE_OK ){ - rc = sqlite3PagerSavepoint(pBt->pPager, op, iSavepoint); + rc = tdsqlite3PagerSavepoint(pBt->pPager, op, iSavepoint); } if( rc==SQLITE_OK ){ if( iSavepoint<0 && (pBt->btsFlags & BTS_INITIALLY_EMPTY)!=0 ){ @@ -72825,7 +72825,7 @@ SQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){ ** the transaction was started. Otherwise, it must be at least 1. */ assert( CORRUPT_DB || pBt->nPage>0 ); } - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); } return rc; } @@ -72869,7 +72869,7 @@ SQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){ ** root page of a b-tree. If it is not, then the cursor acquired ** will not work correctly. ** -** It is assumed that the sqlite3BtreeCursorZero() has been called +** It is assumed that the tdsqlite3BtreeCursorZero() has been called ** on pCur to initialize the memory space prior to invoking this routine. */ static int btreeCursor( @@ -72882,7 +72882,7 @@ static int btreeCursor( BtShared *pBt = p->pBt; /* Shared b-tree handle */ BtCursor *pX; /* Looping over other all cursors */ - assert( sqlite3BtreeHoldsMutex(p) ); + assert( tdsqlite3BtreeHoldsMutex(p) ); assert( wrFlag==0 || wrFlag==BTREE_WRCSR || wrFlag==(BTREE_WRCSR|BTREE_FORDELETE) @@ -72945,12 +72945,12 @@ static int btreeCursorWithLock( BtCursor *pCur /* Space for new cursor */ ){ int rc; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); rc = btreeCursor(p, iTable, wrFlag, pKeyInfo, pCur); - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } -SQLITE_PRIVATE int sqlite3BtreeCursor( +SQLITE_PRIVATE int tdsqlite3BtreeCursor( Btree *p, /* The btree */ int iTable, /* Root page of table to open */ int wrFlag, /* 1 to write. 0 read-only */ @@ -72972,7 +72972,7 @@ SQLITE_PRIVATE int sqlite3BtreeCursor( ** to users so they cannot do the sizeof() themselves - they must call ** this routine. */ -SQLITE_PRIVATE int sqlite3BtreeCursorSize(void){ +SQLITE_PRIVATE int tdsqlite3BtreeCursorSize(void){ return ROUND8(sizeof(BtCursor)); } @@ -72984,7 +72984,7 @@ SQLITE_PRIVATE int sqlite3BtreeCursorSize(void){ ** do not need to be zeroed and they are large, so we can save a lot ** of run-time by skipping the initialization of those elements. */ -SQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor *p){ +SQLITE_PRIVATE void tdsqlite3BtreeCursorZero(BtCursor *p){ memset(p, 0, offsetof(BtCursor, BTCURSOR_FIRST_UNINIT)); } @@ -72992,11 +72992,11 @@ SQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor *p){ ** Close a cursor. The read lock on the database file is released ** when the last cursor is closed. */ -SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){ +SQLITE_PRIVATE int tdsqlite3BtreeCloseCursor(BtCursor *pCur){ Btree *pBtree = pCur->pBtree; if( pBtree ){ BtShared *pBt = pCur->pBt; - sqlite3BtreeEnter(pBtree); + tdsqlite3BtreeEnter(pBtree); assert( pBt->pCursor!=0 ); if( pBt->pCursor==pCur ){ pBt->pCursor = pCur->pNext; @@ -73012,9 +73012,9 @@ SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){ } btreeReleaseAllCursorPages(pCur); unlockBtreeIfUnused(pBt); - sqlite3_free(pCur->aOverflow); - sqlite3_free(pCur->pKey); - sqlite3BtreeLeave(pBtree); + tdsqlite3_free(pCur->aOverflow); + tdsqlite3_free(pCur->pKey); + tdsqlite3BtreeLeave(pBtree); pCur->pBtree = 0; } return SQLITE_OK; @@ -73061,11 +73061,11 @@ static SQLITE_NOINLINE void getCellInfo(BtCursor *pCur){ ** that is currently pointing to a row in a (non-empty) table. ** This is a verification routine is used only within assert() statements. */ -SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor *pCur){ +SQLITE_PRIVATE int tdsqlite3BtreeCursorIsValid(BtCursor *pCur){ return pCur && pCur->eState==CURSOR_VALID; } #endif /* NDEBUG */ -SQLITE_PRIVATE int sqlite3BtreeCursorIsValidNN(BtCursor *pCur){ +SQLITE_PRIVATE int tdsqlite3BtreeCursorIsValidNN(BtCursor *pCur){ assert( pCur!=0 ); return pCur->eState==CURSOR_VALID; } @@ -73076,7 +73076,7 @@ SQLITE_PRIVATE int sqlite3BtreeCursorIsValidNN(BtCursor *pCur){ ** ordinary table btree. If the cursor points to an index btree or ** is invalid, the result of this routine is undefined. */ -SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor *pCur){ +SQLITE_PRIVATE i64 tdsqlite3BtreeIntegerKey(BtCursor *pCur){ assert( cursorHoldsMutex(pCur) ); assert( pCur->eState==CURSOR_VALID ); assert( pCur->curIntKey ); @@ -73087,11 +73087,11 @@ SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor *pCur){ /* ** Pin or unpin a cursor. */ -SQLITE_PRIVATE void sqlite3BtreeCursorPin(BtCursor *pCur){ +SQLITE_PRIVATE void tdsqlite3BtreeCursorPin(BtCursor *pCur){ assert( (pCur->curFlags & BTCF_Pinned)==0 ); pCur->curFlags |= BTCF_Pinned; } -SQLITE_PRIVATE void sqlite3BtreeCursorUnpin(BtCursor *pCur){ +SQLITE_PRIVATE void tdsqlite3BtreeCursorUnpin(BtCursor *pCur){ assert( (pCur->curFlags & BTCF_Pinned)!=0 ); pCur->curFlags &= ~BTCF_Pinned; } @@ -73101,7 +73101,7 @@ SQLITE_PRIVATE void sqlite3BtreeCursorUnpin(BtCursor *pCur){ ** Return the offset into the database file for the start of the ** payload to which the cursor is pointing. */ -SQLITE_PRIVATE i64 sqlite3BtreeOffset(BtCursor *pCur){ +SQLITE_PRIVATE i64 tdsqlite3BtreeOffset(BtCursor *pCur){ assert( cursorHoldsMutex(pCur) ); assert( pCur->eState==CURSOR_VALID ); getCellInfo(pCur); @@ -73119,7 +73119,7 @@ SQLITE_PRIVATE i64 sqlite3BtreeOffset(BtCursor *pCur){ ** valid entry. In other words, the calling procedure must guarantee ** that the cursor has Cursor.eState==CURSOR_VALID. */ -SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor *pCur){ +SQLITE_PRIVATE u32 tdsqlite3BtreePayloadSize(BtCursor *pCur){ assert( cursorHoldsMutex(pCur) ); assert( pCur->eState==CURSOR_VALID ); getCellInfo(pCur); @@ -73139,10 +73139,10 @@ SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor *pCur){ ** The current implementation merely returns the size of the underlying ** database file. */ -SQLITE_PRIVATE sqlite3_int64 sqlite3BtreeMaxRecordSize(BtCursor *pCur){ +SQLITE_PRIVATE tdsqlite3_int64 tdsqlite3BtreeMaxRecordSize(BtCursor *pCur){ assert( cursorHoldsMutex(pCur) ); assert( pCur->eState==CURSOR_VALID ); - return pCur->pBt->pageSize * (sqlite3_int64)pCur->pBt->nPage; + return pCur->pBt->pageSize * (tdsqlite3_int64)pCur->pBt->nPage; } /* @@ -73174,7 +73174,7 @@ static int getOverflowPage( MemPage *pPage = 0; int rc = SQLITE_OK; - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); assert(pPgnoNext); #ifndef SQLITE_OMIT_AUTOVACUUM @@ -73227,7 +73227,7 @@ static int getOverflowPage( ** pPayload is a pointer to data stored on database page pDbPage. ** If argument eOp is false, then nByte bytes of data are copied ** from pPayload to the buffer pointed at by pBuf. If eOp is true, -** then sqlite3PagerWrite() is called on pDbPage and nByte bytes +** then tdsqlite3PagerWrite() is called on pDbPage and nByte bytes ** of data are copied from the buffer pBuf to pPayload. ** ** SQLITE_OK is returned on success, otherwise an error code. @@ -73241,7 +73241,7 @@ static int copyPayload( ){ if( eOp ){ /* Copy data from buffer to page (a write operation) */ - int rc = sqlite3PagerWrite(pDbPage); + int rc = tdsqlite3PagerWrite(pDbPage); if( rc!=SQLITE_OK ){ return rc; } @@ -73349,9 +73349,9 @@ static int accessPayload( if( (pCur->curFlags & BTCF_ValidOvfl)==0 ){ int nOvfl = (pCur->info.nPayload-pCur->info.nLocal+ovflSize-1)/ovflSize; if( pCur->aOverflow==0 - || nOvfl*(int)sizeof(Pgno) > sqlite3MallocSize(pCur->aOverflow) + || nOvfl*(int)sizeof(Pgno) > tdsqlite3MallocSize(pCur->aOverflow) ){ - Pgno *aNew = (Pgno*)sqlite3Realloc( + Pgno *aNew = (Pgno*)tdsqlite3Realloc( pCur->aOverflow, nOvfl*2*sizeof(Pgno) ); if( aNew==0 ){ @@ -73422,15 +73422,15 @@ static int accessPayload( */ if( eOp==0 /* (1) */ && offset==0 /* (2) */ - && sqlite3PagerDirectReadOk(pBt->pPager, nextPage) /* (3,4,5) */ + && tdsqlite3PagerDirectReadOk(pBt->pPager, nextPage) /* (3,4,5) */ && &pBuf[-4]>=pBufStart /* (6) */ ){ - sqlite3_file *fd = sqlite3PagerFile(pBt->pPager); + tdsqlite3_file *fd = tdsqlite3PagerFile(pBt->pPager); u8 aSave[4]; u8 *aWrite = &pBuf[-4]; assert( aWrite>=pBufStart ); /* due to (6) */ memcpy(aSave, aWrite, 4); - rc = sqlite3OsRead(fd, aWrite, a+4, (i64)pBt->pageSize*(nextPage-1)); + rc = tdsqlite3OsRead(fd, aWrite, a+4, (i64)pBt->pageSize*(nextPage-1)); if( rc && nextPage>pBt->nPage ) rc = SQLITE_CORRUPT_BKPT; nextPage = get4byte(aWrite); memcpy(aWrite, aSave, 4); @@ -73439,14 +73439,14 @@ static int accessPayload( { DbPage *pDbPage; - rc = sqlite3PagerGet(pBt->pPager, nextPage, &pDbPage, + rc = tdsqlite3PagerGet(pBt->pPager, nextPage, &pDbPage, (eOp==0 ? PAGER_GET_READONLY : 0) ); if( rc==SQLITE_OK ){ - aPayload = sqlite3PagerGetData(pDbPage); + aPayload = tdsqlite3PagerGetData(pDbPage); nextPage = get4byte(aPayload); rc = copyPayload(&aPayload[offset+4], pBuf, a, eOp, pDbPage); - sqlite3PagerUnref(pDbPage); + tdsqlite3PagerUnref(pDbPage); offset = 0; } } @@ -73475,15 +73475,15 @@ static int accessPayload( ** If pointing to a table btree, then the content section is read. If ** pCur is pointing to an index b-tree then the key section is read. ** -** For sqlite3BtreePayload(), the caller must ensure that pCur is pointing -** to a valid row in the table. For sqlite3BtreePayloadChecked(), the +** For tdsqlite3BtreePayload(), the caller must ensure that pCur is pointing +** to a valid row in the table. For tdsqlite3BtreePayloadChecked(), the ** cursor might be invalid or might need to be restored before being read. ** ** Return SQLITE_OK on success or an error code if anything goes ** wrong. An error is returned if "offset+amt" is larger than ** the available payload. */ -SQLITE_PRIVATE int sqlite3BtreePayload(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){ +SQLITE_PRIVATE int tdsqlite3BtreePayload(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){ assert( cursorHoldsMutex(pCur) ); assert( pCur->eState==CURSOR_VALID ); assert( pCur->iPage>=0 && pCur->pPage ); @@ -73492,8 +73492,8 @@ SQLITE_PRIVATE int sqlite3BtreePayload(BtCursor *pCur, u32 offset, u32 amt, void } /* -** This variant of sqlite3BtreePayload() works even if the cursor has not -** in the CURSOR_VALID state. It is only used by the sqlite3_blob_read() +** This variant of tdsqlite3BtreePayload() works even if the cursor has not +** in the CURSOR_VALID state. It is only used by the tdsqlite3_blob_read() ** interface. */ #ifndef SQLITE_OMIT_INCRBLOB @@ -73511,7 +73511,7 @@ static SQLITE_NOINLINE int accessPayloadChecked( rc = btreeRestoreCursorPosition(pCur); return rc ? rc : accessPayload(pCur, offset, amt, pBuf, 0); } -SQLITE_PRIVATE int sqlite3BtreePayloadChecked(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){ +SQLITE_PRIVATE int tdsqlite3BtreePayloadChecked(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){ if( pCur->eState==CURSOR_VALID ){ assert( cursorOwnsBtShared(pCur) ); return accessPayload(pCur, offset, amt, pBuf, 0); @@ -73547,7 +73547,7 @@ static const void *fetchPayload( int amt; assert( pCur!=0 && pCur->iPage>=0 && pCur->pPage); assert( pCur->eState==CURSOR_VALID ); - assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); + assert( tdsqlite3_mutex_held(pCur->pBtree->db->mutex) ); assert( cursorOwnsBtShared(pCur) ); assert( pCur->ixpPage->nCell ); assert( pCur->info.nSize>0 ); @@ -73579,7 +73579,7 @@ static const void *fetchPayload( ** These routines is used to get quick access to key and data ** in the common case where no overflow pages are used. */ -SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor *pCur, u32 *pAmt){ +SQLITE_PRIVATE const void *tdsqlite3BtreePayloadFetch(BtCursor *pCur, u32 *pAmt){ return fetchPayload(pCur, pAmt); } @@ -73713,7 +73713,7 @@ static int moveToRoot(BtCursor *pCur){ assert( pCur->skipNext!=SQLITE_OK ); return pCur->skipNext; } - sqlite3BtreeClearCursor(pCur); + tdsqlite3BtreeClearCursor(pCur); } rc = getAndInitPage(pCur->pBtree->pBt, pCur->pgnoRoot, &pCur->pPage, 0, pCur->curPagerFlags); @@ -73818,11 +73818,11 @@ static int moveToRightmost(BtCursor *pCur){ ** on success. Set *pRes to 0 if the cursor actually points to something ** or set *pRes to 1 if the table is empty. */ -SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){ +SQLITE_PRIVATE int tdsqlite3BtreeFirst(BtCursor *pCur, int *pRes){ int rc; assert( cursorOwnsBtShared(pCur) ); - assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); + assert( tdsqlite3_mutex_held(pCur->pBtree->db->mutex) ); rc = moveToRoot(pCur); if( rc==SQLITE_OK ){ assert( pCur->pPage->nCell>0 ); @@ -73840,11 +73840,11 @@ SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){ ** on success. Set *pRes to 0 if the cursor actually points to something ** or set *pRes to 1 if the table is empty. */ -SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){ +SQLITE_PRIVATE int tdsqlite3BtreeLast(BtCursor *pCur, int *pRes){ int rc; assert( cursorOwnsBtShared(pCur) ); - assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); + assert( tdsqlite3_mutex_held(pCur->pBtree->db->mutex) ); /* If the cursor already points to the last entry, this is a no-op. */ if( CURSOR_VALID==pCur->eState && (pCur->curFlags & BTCF_AtLast)!=0 ){ @@ -73910,7 +73910,7 @@ SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){ ** For index tables, the pIdxKey->eqSeen field is set to 1 if there ** exists an entry in the table that exactly matches pIdxKey. */ -SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( +SQLITE_PRIVATE int tdsqlite3BtreeMovetoUnpacked( BtCursor *pCur, /* The cursor to be moved */ UnpackedRecord *pIdxKey, /* Unpacked index key */ i64 intKey, /* The table key */ @@ -73921,7 +73921,7 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( RecordCompare xRecordCompare; assert( cursorOwnsBtShared(pCur) ); - assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); + assert( tdsqlite3_mutex_held(pCur->pBtree->db->mutex) ); assert( pRes ); assert( (pIdxKey==0)==(pCur->pKeyInfo==0) ); assert( pCur->eState!=CURSOR_VALID || (pIdxKey==0)==(pCur->curIntKey!=0) ); @@ -73941,12 +73941,12 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( return SQLITE_OK; } /* If the requested key is one more than the previous key, then - ** try to get there using sqlite3BtreeNext() rather than a full + ** try to get there using tdsqlite3BtreeNext() rather than a full ** binary search. This is an optimization only. The correct answer ** is still obtained without this case, only a little more slowely */ if( pCur->info.nKey+1==intKey ){ *pRes = 0; - rc = sqlite3BtreeNext(pCur, 0); + rc = tdsqlite3BtreeNext(pCur, 0); if( rc==SQLITE_OK ){ getCellInfo(pCur); if( pCur->info.nKey==intKey ){ @@ -73962,7 +73962,7 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( } if( pIdxKey ){ - xRecordCompare = sqlite3VdbeFindCompare(pIdxKey); + xRecordCompare = tdsqlite3VdbeFindCompare(pIdxKey); pIdxKey->errCode = 0; assert( pIdxKey->default_rc==1 || pIdxKey->default_rc==0 @@ -74091,7 +74091,7 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( rc = SQLITE_CORRUPT_PAGE(pPage); goto moveto_finish; } - pCellKey = sqlite3Malloc( nCell+nOverrun ); + pCellKey = tdsqlite3Malloc( nCell+nOverrun ); if( pCellKey==0 ){ rc = SQLITE_NOMEM_BKPT; goto moveto_finish; @@ -74101,11 +74101,11 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( memset(((u8*)pCellKey)+nCell,0,nOverrun); /* Fix uninit warnings */ pCur->curFlags &= ~BTCF_ValidOvfl; if( rc ){ - sqlite3_free(pCellKey); + tdsqlite3_free(pCellKey); goto moveto_finish; } - c = sqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey); - sqlite3_free(pCellKey); + c = tdsqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey); + tdsqlite3_free(pCellKey); } assert( (pIdxKey->errCode!=SQLITE_CORRUPT || c==0) @@ -74157,11 +74157,11 @@ moveto_finish: /* ** Return TRUE if the cursor is not pointing at an entry of the table. ** -** TRUE will be returned after a call to sqlite3BtreeNext() moves -** past the last entry in the table or sqlite3BtreePrev() moves past +** TRUE will be returned after a call to tdsqlite3BtreeNext() moves +** past the last entry in the table or tdsqlite3BtreePrev() moves past ** the first entry. TRUE is also returned if the table is empty. */ -SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor *pCur){ +SQLITE_PRIVATE int tdsqlite3BtreeEof(BtCursor *pCur){ /* TODO: What if the cursor is in CURSOR_REQUIRESEEK but all table entries ** have been deleted? This API will need to change to return an error code ** as well as the boolean result value. @@ -74174,12 +74174,12 @@ SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor *pCur){ ** pointing to. Return a negative number if no estimate is currently ** available. */ -SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor *pCur){ +SQLITE_PRIVATE i64 tdsqlite3BtreeRowCountEst(BtCursor *pCur){ i64 n; u8 i; assert( cursorOwnsBtShared(pCur) ); - assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); + assert( tdsqlite3_mutex_held(pCur->pBtree->db->mutex) ); /* Currently this interface is only called by the OP_IfSmaller ** opcode, and it that case the cursor will always be valid and @@ -74202,13 +74202,13 @@ SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor *pCur){ ** SQLITE_DONE cursor is already pointing at the last element ** otherwise some kind of error occurred ** -** The main entry point is sqlite3BtreeNext(). That routine is optimized +** The main entry point is tdsqlite3BtreeNext(). That routine is optimized ** for the common case of merely incrementing the cell counter BtCursor.aiIdx ** to the next cell on the current page. The (slower) btreeNext() helper ** routine is called when it is necessary to move to a different page or ** to restore the cursor. ** -** If bit 0x01 of the F argument in sqlite3BtreeNext(C,F) is 1, then the +** If bit 0x01 of the F argument in tdsqlite3BtreeNext(C,F) is 1, then the ** cursor corresponds to an SQL index and this routine could have been ** skipped if the SQL index had been a unique index. The F argument ** is a hint to the implement. SQLite btree implementation does not use @@ -74273,7 +74273,7 @@ static SQLITE_NOINLINE int btreeNext(BtCursor *pCur){ pPage = pCur->pPage; }while( pCur->ix>=pPage->nCell ); if( pPage->intKey ){ - return sqlite3BtreeNext(pCur, 0); + return tdsqlite3BtreeNext(pCur, 0); }else{ return SQLITE_OK; } @@ -74284,7 +74284,7 @@ static SQLITE_NOINLINE int btreeNext(BtCursor *pCur){ return moveToLeftmost(pCur); } } -SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int flags){ +SQLITE_PRIVATE int tdsqlite3BtreeNext(BtCursor *pCur, int flags){ MemPage *pPage; UNUSED_PARAMETER( flags ); /* Used in COMDB2 but not native SQLite */ assert( cursorOwnsBtShared(pCur) ); @@ -74312,13 +74312,13 @@ SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int flags){ ** SQLITE_DONE the cursor is already on the first element of the table ** otherwise some kind of error occurred ** -** The main entry point is sqlite3BtreePrevious(). That routine is optimized +** The main entry point is tdsqlite3BtreePrevious(). That routine is optimized ** for the common case of merely decrementing the cell counter BtCursor.aiIdx ** to the previous cell on the current page. The (slower) btreePrevious() ** helper routine is called when it is necessary to move to a different page ** or to restore the cursor. ** -** If bit 0x01 of the F argument to sqlite3BtreePrevious(C,F) is 1, then +** If bit 0x01 of the F argument to tdsqlite3BtreePrevious(C,F) is 1, then ** the cursor corresponds to an SQL index and this routine could have been ** skipped if the SQL index had been a unique index. The F argument is a ** hint to the implement. The native SQLite btree implementation does not @@ -74366,14 +74366,14 @@ static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur){ pCur->ix--; pPage = pCur->pPage; if( pPage->intKey && !pPage->leaf ){ - rc = sqlite3BtreePrevious(pCur, 0); + rc = tdsqlite3BtreePrevious(pCur, 0); }else{ rc = SQLITE_OK; } } return rc; } -SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int flags){ +SQLITE_PRIVATE int tdsqlite3BtreePrevious(BtCursor *pCur, int flags){ assert( cursorOwnsBtShared(pCur) ); assert( flags==0 || flags==1 ); UNUSED_PARAMETER( flags ); /* Used in COMDB2 but not native SQLite */ @@ -74392,10 +74392,10 @@ SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int flags){ /* ** Allocate a new page from the database file. ** -** The new page is marked as dirty. (In other words, sqlite3PagerWrite() +** The new page is marked as dirty. (In other words, tdsqlite3PagerWrite() ** has already been called on the new page.) The new page has also ** been referenced and the calling routine is responsible for calling -** sqlite3PagerUnref() on the new page when it is done. +** tdsqlite3PagerUnref() on the new page when it is done. ** ** SQLITE_OK is returned on success. Any other return value indicates ** an error. *ppPage is set to NULL in the event of an error. @@ -74426,7 +74426,7 @@ static int allocateBtreePage( MemPage *pPrevTrunk = 0; Pgno mxPage; /* Total size of the database file */ - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); assert( eMode==BTALLOC_ANY || (nearby>0 && IfNotOmitAV(pBt->autoVacuum)) ); pPage1 = pBt->pPage1; mxPage = btreePagecount(pBt); @@ -74467,7 +74467,7 @@ static int allocateBtreePage( /* Decrement the free-list count by 1. Set iTrunk to the index of the ** first free-list trunk page. iPrevTrunk is initially 1. */ - rc = sqlite3PagerWrite(pPage1->pDbPage); + rc = tdsqlite3PagerWrite(pPage1->pDbPage); if( rc ) return rc; put4byte(&pPage1->aData[36], n-1); @@ -74509,7 +74509,7 @@ static int allocateBtreePage( ** So extract the trunk page itself and use it as the newly ** allocated page */ assert( pPrevTrunk==0 ); - rc = sqlite3PagerWrite(pTrunk->pDbPage); + rc = tdsqlite3PagerWrite(pTrunk->pDbPage); if( rc ){ goto end_allocate_page; } @@ -74532,7 +74532,7 @@ static int allocateBtreePage( *pPgno = iTrunk; *ppPage = pTrunk; searchList = 0; - rc = sqlite3PagerWrite(pTrunk->pDbPage); + rc = tdsqlite3PagerWrite(pTrunk->pDbPage); if( rc ){ goto end_allocate_page; } @@ -74540,7 +74540,7 @@ static int allocateBtreePage( if( !pPrevTrunk ){ memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4); }else{ - rc = sqlite3PagerWrite(pPrevTrunk->pDbPage); + rc = tdsqlite3PagerWrite(pPrevTrunk->pDbPage); if( rc!=SQLITE_OK ){ goto end_allocate_page; } @@ -74562,7 +74562,7 @@ static int allocateBtreePage( if( rc!=SQLITE_OK ){ goto end_allocate_page; } - rc = sqlite3PagerWrite(pNewTrunk->pDbPage); + rc = tdsqlite3PagerWrite(pNewTrunk->pDbPage); if( rc!=SQLITE_OK ){ releasePage(pNewTrunk); goto end_allocate_page; @@ -74572,10 +74572,10 @@ static int allocateBtreePage( memcpy(&pNewTrunk->aData[8], &pTrunk->aData[12], (k-1)*4); releasePage(pNewTrunk); if( !pPrevTrunk ){ - assert( sqlite3PagerIswriteable(pPage1->pDbPage) ); + assert( tdsqlite3PagerIswriteable(pPage1->pDbPage) ); put4byte(&pPage1->aData[32], iNewTrunk); }else{ - rc = sqlite3PagerWrite(pPrevTrunk->pDbPage); + rc = tdsqlite3PagerWrite(pPrevTrunk->pDbPage); if( rc ){ goto end_allocate_page; } @@ -74603,9 +74603,9 @@ static int allocateBtreePage( } }else{ int dist; - dist = sqlite3AbsInt32(get4byte(&aData[8]) - nearby); + dist = tdsqlite3AbsInt32(get4byte(&aData[8]) - nearby); for(i=1; ipgno, n-1)); - rc = sqlite3PagerWrite(pTrunk->pDbPage); + rc = tdsqlite3PagerWrite(pTrunk->pDbPage); if( rc ) goto end_allocate_page; if( closestpDbPage); + rc = tdsqlite3PagerWrite((*ppPage)->pDbPage); if( rc!=SQLITE_OK ){ releasePage(*ppPage); *ppPage = 0; @@ -74673,7 +74673,7 @@ static int allocateBtreePage( */ int bNoContent = (0==IfNotOmitAV(pBt->bDoTruncate))? PAGER_GET_NOCONTENT:0; - rc = sqlite3PagerWrite(pBt->pPage1->pDbPage); + rc = tdsqlite3PagerWrite(pBt->pPage1->pDbPage); if( rc ) return rc; pBt->nPage++; if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ) pBt->nPage++; @@ -74689,7 +74689,7 @@ static int allocateBtreePage( assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) ); rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent); if( rc==SQLITE_OK ){ - rc = sqlite3PagerWrite(pPg->pDbPage); + rc = tdsqlite3PagerWrite(pPg->pDbPage); releasePage(pPg); } if( rc ) return rc; @@ -74703,7 +74703,7 @@ static int allocateBtreePage( assert( *pPgno!=PENDING_BYTE_PAGE(pBt) ); rc = btreeGetUnusedPage(pBt, *pPgno, ppPage, bNoContent); if( rc ) return rc; - rc = sqlite3PagerWrite((*ppPage)->pDbPage); + rc = tdsqlite3PagerWrite((*ppPage)->pDbPage); if( rc!=SQLITE_OK ){ releasePage(*ppPage); *ppPage = 0; @@ -74716,7 +74716,7 @@ static int allocateBtreePage( end_allocate_page: releasePage(pTrunk); releasePage(pPrevTrunk); - assert( rc!=SQLITE_OK || sqlite3PagerPageRefcount((*ppPage)->pDbPage)<=1 ); + assert( rc!=SQLITE_OK || tdsqlite3PagerPageRefcount((*ppPage)->pDbPage)<=1 ); assert( rc!=SQLITE_OK || (*ppPage)->isInit==0 ); return rc; } @@ -74741,7 +74741,7 @@ static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){ int rc; /* Return Code */ u32 nFree; /* Initial number of pages on free-list */ - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); assert( CORRUPT_DB || iPage>1 ); assert( !pMemPage || pMemPage->pgno==iPage ); @@ -74750,13 +74750,13 @@ static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){ } if( pMemPage ){ pPage = pMemPage; - sqlite3PagerRef(pPage->pDbPage); + tdsqlite3PagerRef(pPage->pDbPage); }else{ pPage = btreePageLookup(pBt, iPage); } /* Increment the free page count on pPage1 */ - rc = sqlite3PagerWrite(pPage1->pDbPage); + rc = tdsqlite3PagerWrite(pPage1->pDbPage); if( rc ) goto freepage_out; nFree = get4byte(&pPage1->aData[36]); put4byte(&pPage1->aData[36], nFree+1); @@ -74766,7 +74766,7 @@ static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){ ** always fully overwrite deleted information with zeros. */ if( (!pPage && ((rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0) ) - || ((rc = sqlite3PagerWrite(pPage->pDbPage))!=0) + || ((rc = tdsqlite3PagerWrite(pPage->pDbPage))!=0) ){ goto freepage_out; } @@ -74823,12 +74823,12 @@ static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){ ** order that database files created by newer versions of SQLite can be ** read by older versions of SQLite. */ - rc = sqlite3PagerWrite(pTrunk->pDbPage); + rc = tdsqlite3PagerWrite(pTrunk->pDbPage); if( rc==SQLITE_OK ){ put4byte(&pTrunk->aData[4], nLeaf+1); put4byte(&pTrunk->aData[8+nLeaf*4], iPage); if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){ - sqlite3PagerDontWrite(pPage->pDbPage); + tdsqlite3PagerDontWrite(pPage->pDbPage); } rc = btreeSetHasContent(pBt, iPage); } @@ -74846,7 +74846,7 @@ static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){ if( pPage==0 && SQLITE_OK!=(rc = btreeGetPage(pBt, iPage, &pPage, 0)) ){ goto freepage_out; } - rc = sqlite3PagerWrite(pPage->pDbPage); + rc = tdsqlite3PagerWrite(pPage->pDbPage); if( rc!=SQLITE_OK ){ goto freepage_out; } @@ -74884,7 +74884,7 @@ static int clearCell( int nOvfl; u32 ovflPageSize; - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); pPage->xParseCell(pPage, pCell, pInfo); if( pInfo->nLocal==pInfo->nPayload ){ return SQLITE_OK; /* No overflow pages. Return without doing anything */ @@ -74918,7 +74918,7 @@ static int clearCell( } if( ( pOvfl || ((pOvfl = btreePageLookup(pBt, ovflPgno))!=0) ) - && sqlite3PagerPageRefcount(pOvfl->pDbPage)!=1 + && tdsqlite3PagerPageRefcount(pOvfl->pDbPage)!=1 ){ /* There is no reason any cursor should have an outstanding reference ** to an overflow page belonging to a cell that is being deleted/updated. @@ -74936,7 +74936,7 @@ static int clearCell( } if( pOvfl ){ - sqlite3PagerUnref(pOvfl->pDbPage); + tdsqlite3PagerUnref(pOvfl->pDbPage); } if( rc ) return rc; ovflPgno = iNext; @@ -74973,12 +74973,12 @@ static int fillInCell( Pgno pgnoOvfl; int nHeader; - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); /* pPage is not necessarily writeable since pCell might be auxiliary ** buffer space that is separate from the pPage buffer area */ assert( pCellaData || pCell>=&pPage->aData[pPage->pBt->pageSize] - || sqlite3PagerIswriteable(pPage->pDbPage) ); + || tdsqlite3PagerIswriteable(pPage->pDbPage) ); /* Fill in the header. */ nHeader = pPage->childPtrSize; @@ -75058,12 +75058,12 @@ static int fillInCell( /* If pToRelease is not zero than pPayload points into the data area ** of pToRelease. Make sure pToRelease is still writeable. */ - assert( pToRelease==0 || sqlite3PagerIswriteable(pToRelease->pDbPage) ); + assert( pToRelease==0 || tdsqlite3PagerIswriteable(pToRelease->pDbPage) ); /* If pPayload is part of the data area of pPage, then make sure pPage ** is still writeable */ assert( pPayloadaData || pPayload>=&pPage->aData[pBt->pageSize] - || sqlite3PagerIswriteable(pPage->pDbPage) ); + || tdsqlite3PagerIswriteable(pPage->pDbPage) ); if( nSrc>=n ){ memcpy(pPayload, pSrc, n); @@ -75118,12 +75118,12 @@ static int fillInCell( /* If pToRelease is not zero than pPrior points into the data area ** of pToRelease. Make sure pToRelease is still writeable. */ - assert( pToRelease==0 || sqlite3PagerIswriteable(pToRelease->pDbPage) ); + assert( pToRelease==0 || tdsqlite3PagerIswriteable(pToRelease->pDbPage) ); /* If pPrior is part of the data area of pPage, then make sure pPage ** is still writeable */ assert( pPrioraData || pPrior>=&pPage->aData[pBt->pageSize] - || sqlite3PagerIswriteable(pPage->pDbPage) ); + || tdsqlite3PagerIswriteable(pPage->pDbPage) ); put4byte(pPrior, pgnoOvfl); releasePage(pToRelease); @@ -75156,8 +75156,8 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){ if( *pRC ) return; assert( idx>=0 && idxnCell ); assert( CORRUPT_DB || sz==cellSize(pPage, idx) ); - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3PagerIswriteable(pPage->pDbPage) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); assert( pPage->nFree>=0 ); data = pPage->aData; ptr = &pPage->aCellIdx[2*idx]; @@ -75222,7 +75222,7 @@ static void insertCell( assert( pPage->nCell<=MX_CELL(pPage->pBt) || CORRUPT_DB ); assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) ); assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); assert( sz==pPage->xCellSize(pPage, pCell) || CORRUPT_DB ); assert( pPage->nFree>=0 ); if( pPage->nOverflow || sz+2>pPage->nFree ){ @@ -75249,12 +75249,12 @@ static void insertCell( assert( j==0 || pPage->aiOvfl[j-1]<(u16)i ); /* Overflows in sorted order */ assert( j==0 || i==pPage->aiOvfl[j-1]+1 ); /* Overflows are sequential */ }else{ - int rc = sqlite3PagerWrite(pPage->pDbPage); + int rc = tdsqlite3PagerWrite(pPage->pDbPage); if( rc!=SQLITE_OK ){ *pRC = rc; return; } - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); + assert( tdsqlite3PagerIswriteable(pPage->pDbPage) ); data = pPage->aData; assert( &data[pPage->cellOffset]==pPage->aCellIdx ); rc = allocateSpace(pPage, sz, &idx); @@ -75448,7 +75448,7 @@ static int rebuildPage( u32 j; /* Start of cell content area */ int iEnd = i+nCell; /* Loop terminator */ u8 *pCellptr = pPg->aCellIdx; - u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager); + u8 *pTmp = tdsqlite3PagerTempSpace(pPg->pBt->pPager); u8 *pData; int k; /* Current slot in pCArray->apEnd[] */ u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */ @@ -75665,7 +75665,7 @@ static int editPage( int iNewEnd = iNew + nNew; #ifdef SQLITE_DEBUG - u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager); + u8 *pTmp = tdsqlite3PagerTempSpace(pPg->pBt->pPager); memcpy(pTmp, aData, pPg->pBt->usableSize); #endif @@ -75781,8 +75781,8 @@ static int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){ int rc; /* Return Code */ Pgno pgnoNew; /* Page number of pNew */ - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - assert( sqlite3PagerIswriteable(pParent->pDbPage) ); + assert( tdsqlite3_mutex_held(pPage->pBt->mutex) ); + assert( tdsqlite3PagerIswriteable(pParent->pDbPage) ); assert( pPage->nOverflow==1 ); if( pPage->nCell==0 ) return SQLITE_CORRUPT_BKPT; /* dbfuzz001.test */ @@ -75803,7 +75803,7 @@ static int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){ u8 *pStop; CellArray b; - assert( sqlite3PagerIswriteable(pNew->pDbPage) ); + assert( tdsqlite3PagerIswriteable(pNew->pDbPage) ); assert( CORRUPT_DB || pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) ); zeroPage(pNew, PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF); b.nCell = 1; @@ -76052,13 +76052,13 @@ static int balance_nonroot( b.nCell = 0; b.apCell = 0; pBt = pParent->pBt; - assert( sqlite3_mutex_held(pBt->mutex) ); - assert( sqlite3PagerIswriteable(pParent->pDbPage) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3PagerIswriteable(pParent->pDbPage) ); /* At this point pParent may have at most one overflow cell. And if ** this overflow cell is present, it must be the cell with ** index iParentIdx. This scenario comes about when this function - ** is called (indirectly) from sqlite3BtreeDelete(). + ** is called (indirectly) from tdsqlite3BtreeDelete(). */ assert( pParent->nOverflow==0 || pParent->nOverflow==1 ); assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx ); @@ -76168,7 +76168,7 @@ static int balance_nonroot( + pBt->pageSize; /* aSpace1 */ assert( szScratch<=7*(int)pBt->pageSize ); - b.apCell = sqlite3StackAllocRaw(0, szScratch ); + b.apCell = tdsqlite3StackAllocRaw(0, szScratch ); if( b.apCell==0 ){ rc = SQLITE_NOMEM_BKPT; goto balance_cleanup; @@ -76437,7 +76437,7 @@ static int balance_nonroot( if( ipDbPage); + rc = tdsqlite3PagerWrite(pNew->pDbPage); nNew++; if( rc ) goto balance_cleanup; }else{ @@ -76497,9 +76497,9 @@ static int balance_nonroot( aPgOrder[iBest] = 0xffffffff; if( iBest!=i ){ if( iBest>i ){ - sqlite3PagerRekey(apNew[iBest]->pDbPage, pBt->nPage+iBest+1, 0); + tdsqlite3PagerRekey(apNew[iBest]->pDbPage, pBt->nPage+iBest+1, 0); } - sqlite3PagerRekey(apNew[i]->pDbPage, pgno, aPgFlags[iBest]); + tdsqlite3PagerRekey(apNew[i]->pDbPage, pgno, aPgFlags[iBest]); apNew[i]->pgno = pgno; } } @@ -76517,7 +76517,7 @@ static int balance_nonroot( nNew>=5 ? cntNew[4] - cntNew[3] - !leafData : 0 )); - assert( sqlite3PagerIswriteable(pParent->pDbPage) ); + assert( tdsqlite3PagerIswriteable(pParent->pDbPage) ); assert( nNew>=1 && nNew<=ArraySize(apNew) ); assert( apNew[nNew-1]!=0 ); put4byte(pRight, apNew[nNew-1]->pgno); @@ -76638,7 +76638,7 @@ static int balance_nonroot( assert( iOvflSpace <= (int)pBt->pageSize ); insertCell(pParent, nxDiv+i, pCell, sz, pTemp, pNew->pgno, &rc); if( rc!=SQLITE_OK ) goto balance_cleanup; - assert( sqlite3PagerIswriteable(pParent->pDbPage) ); + assert( tdsqlite3PagerIswriteable(pParent->pDbPage) ); } /* Now update the actual sibling pages. The order in which they are updated @@ -76767,7 +76767,7 @@ static int balance_nonroot( ** Cleanup before returning. */ balance_cleanup: - sqlite3StackFree(0, b.apCell); + tdsqlite3StackFree(0, b.apCell); for(i=0; ipBt; /* The BTree */ assert( pRoot->nOverflow>0 ); - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); /* Make pRoot, the root page of the b-tree, writable. Allocate a new ** page that will become the new right-child of pPage. Copy the contents ** of the node stored on pRoot into the new child page. */ - rc = sqlite3PagerWrite(pRoot->pDbPage); + rc = tdsqlite3PagerWrite(pRoot->pDbPage); if( rc==SQLITE_OK ){ rc = allocateBtreePage(pBt,&pChild,&pgnoChild,pRoot->pgno,0); copyNodeContent(pRoot, pChild, &rc); @@ -76824,8 +76824,8 @@ static int balance_deeper(MemPage *pRoot, MemPage **ppChild){ releasePage(pChild); return rc; } - assert( sqlite3PagerIswriteable(pChild->pDbPage) ); - assert( sqlite3PagerIswriteable(pRoot->pDbPage) ); + assert( tdsqlite3PagerIswriteable(pChild->pDbPage) ); + assert( tdsqlite3PagerIswriteable(pRoot->pDbPage) ); assert( pChild->nCell==pRoot->nCell || CORRUPT_DB ); TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno)); @@ -76920,7 +76920,7 @@ static int balance(BtCursor *pCur){ MemPage * const pParent = pCur->apPage[iPage-1]; int const iIdx = pCur->aiIdx[iPage-1]; - rc = sqlite3PagerWrite(pParent->pDbPage); + rc = tdsqlite3PagerWrite(pParent->pDbPage); if( rc==SQLITE_OK && pParent->nFree<0 ){ rc = btreeComputeFreeSpace(pParent); } @@ -76968,7 +76968,7 @@ static int balance(BtCursor *pCur){ ** copied either into the body of a database page or into the new ** pSpace buffer passed to the latter call to balance_nonroot(). */ - u8 *pSpace = sqlite3PageMalloc(pCur->pBt->pageSize); + u8 *pSpace = tdsqlite3PageMalloc(pCur->pBt->pageSize); rc = balance_nonroot(pParent, iIdx, pSpace, iPage==1, pCur->hints&BTREE_BULKLOAD); if( pFree ){ @@ -76976,7 +76976,7 @@ static int balance(BtCursor *pCur){ ** by a previous call to balance_nonroot(). Its contents are ** now stored either on real database pages or within the ** new pSpace buffer, so it may be safely freed here. */ - sqlite3PageFree(pFree); + tdsqlite3PageFree(pFree); } /* The pSpace buffer will be freed after the next call to @@ -76997,7 +76997,7 @@ static int balance(BtCursor *pCur){ }while( rc==SQLITE_OK ); if( pFree ){ - sqlite3PageFree(pFree); + tdsqlite3PageFree(pFree); } return rc; } @@ -77018,7 +77018,7 @@ static int btreeOverwriteContent( int i; for(i=0; ipDbPage); + int rc = tdsqlite3PagerWrite(pPage->pDbPage); if( rc ) return rc; memset(pDest + i, 0, iAmt - i); } @@ -77032,7 +77032,7 @@ static int btreeOverwriteContent( iAmt = nData; } if( memcmp(pDest, ((u8*)pX->pData) + iOffset, iAmt)!=0 ){ - int rc = sqlite3PagerWrite(pPage->pDbPage); + int rc = tdsqlite3PagerWrite(pPage->pDbPage); if( rc ) return rc; /* In a corrupt database, it is possible for the source and destination ** buffers to overlap. This is harmless since the database is already @@ -77078,7 +77078,7 @@ static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){ do{ rc = btreeGetPage(pBt, ovflPgno, &pPage, 0); if( rc ) return rc; - if( sqlite3PagerPageRefcount(pPage->pDbPage)!=1 ){ + if( tdsqlite3PagerPageRefcount(pPage->pDbPage)!=1 ){ rc = SQLITE_CORRUPT_BKPT; }else{ if( iOffset+ovflPageSize<(u32)nTotal ){ @@ -77089,7 +77089,7 @@ static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){ rc = btreeOverwriteContent(pPage, pPage->aData+4, pX, iOffset, ovflPageSize); } - sqlite3PagerUnref(pPage->pDbPage); + tdsqlite3PagerUnref(pPage->pDbPage); if( rc ) return rc; iOffset += ovflPageSize; }while( iOffsetaMem can be used instead of pX->pKey to avoid having ** to decode the key. */ -SQLITE_PRIVATE int sqlite3BtreeInsert( +SQLITE_PRIVATE int tdsqlite3BtreeInsert( BtCursor *pCur, /* Insert data into the table of this cursor */ const BtreePayload *pX, /* Content of the row to be inserted */ int flags, /* True if this is likely an append */ @@ -77167,7 +77167,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( ** ** In some cases, the call to btreeMoveto() below is a no-op. For ** example, when inserting data into a table with auto-generated integer - ** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the + ** keys, the VDBE layer invokes tdsqlite3BtreeLast() to figure out the ** integer key to use. It then calls this function to actually insert the ** data into the intkey B-Tree. In this case btreeMoveto() recognizes ** that the cursor is already where it needs to be and returns without @@ -77216,7 +77216,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( ** to an adjacent cell. Move the cursor so that it is pointing either ** to the cell to be overwritten or an adjacent cell. */ - rc = sqlite3BtreeMovetoUnpacked(pCur, 0, pX->nKey, flags!=0, &loc); + rc = tdsqlite3BtreeMovetoUnpacked(pCur, 0, pX->nKey, flags!=0, &loc); if( rc ) return rc; } }else{ @@ -77243,7 +77243,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( r.r1 = 0; r.r2 = 0; r.eqSeen = 0; - rc = sqlite3BtreeMovetoUnpacked(pCur, &r, 0, flags!=0, &loc); + rc = tdsqlite3BtreeMovetoUnpacked(pCur, &r, 0, flags!=0, &loc); }else{ rc = btreeMoveto(pCur, pX->pKey, pX->nKey, flags!=0, &loc); } @@ -77292,7 +77292,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( if( loc==0 ){ CellInfo info; assert( idxnCell ); - rc = sqlite3PagerWrite(pPage->pDbPage); + rc = tdsqlite3PagerWrite(pPage->pDbPage); if( rc ){ goto end_insert; } @@ -77374,7 +77374,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( btreeReleaseAllCursorPages(pCur); if( pCur->pKeyInfo ){ assert( pCur->pKey==0 ); - pCur->pKey = sqlite3Malloc( pX->nKey ); + pCur->pKey = tdsqlite3Malloc( pX->nKey ); if( pCur->pKey==0 ){ rc = SQLITE_NOMEM; }else{ @@ -77408,7 +77408,7 @@ end_insert: ** The BTREE_AUXDELETE bit is a hint that is not used by this implementation, ** but which might be used by alternative storage engines. */ -SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ +SQLITE_PRIVATE int tdsqlite3BtreeDelete(BtCursor *pCur, u8 flags){ Btree *p = pCur->pBtree; BtShared *pBt = p->pBt; int rc; /* Return code */ @@ -77470,7 +77470,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ ** sub-tree headed by the child page of the cell being deleted. This makes ** balancing the tree following the delete operation easier. */ if( !pPage->leaf ){ - rc = sqlite3BtreePrevious(pCur, 0); + rc = tdsqlite3BtreePrevious(pCur, 0); assert( rc!=SQLITE_DONE ); if( rc ) return rc; } @@ -77491,7 +77491,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ /* Make the page containing the entry to be deleted writable. Then free any ** overflow pages associated with the entry and finally remove the cell ** itself from within the page. */ - rc = sqlite3PagerWrite(pPage->pDbPage); + rc = tdsqlite3PagerWrite(pPage->pDbPage); if( rc ) return rc; rc = clearCell(pPage, pCell, &info); dropCell(pPage, iCellIdx, info.nSize, &rc); @@ -77523,7 +77523,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ assert( MX_CELL_SIZE(pBt) >= nCell ); pTmp = pBt->pTmpSpace; assert( pTmp!=0 ); - rc = sqlite3PagerWrite(pLeaf->pDbPage); + rc = tdsqlite3PagerWrite(pLeaf->pDbPage); if( rc==SQLITE_OK ){ insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n, &rc); } @@ -77599,7 +77599,7 @@ static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){ int rc; int ptfFlags; /* Page-type flage for the root page of new table */ - assert( sqlite3BtreeHoldsMutex(p) ); + assert( tdsqlite3BtreeHoldsMutex(p) ); assert( pBt->inTransaction==TRANS_WRITE ); assert( (pBt->btsFlags & BTS_READ_ONLY)==0 ); @@ -77624,7 +77624,7 @@ static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){ ** root page of the new table should go. meta[3] is the largest root-page ** created so far, so the new root-page is (meta[3]+1). */ - sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot); + tdsqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot); pgnoRoot++; /* The new root-page may not be allocated on a pointer-map page, or the @@ -77691,7 +77691,7 @@ static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){ if( rc!=SQLITE_OK ){ return rc; } - rc = sqlite3PagerWrite(pRoot->pDbPage); + rc = tdsqlite3PagerWrite(pRoot->pDbPage); if( rc!=SQLITE_OK ){ releasePage(pRoot); return rc; @@ -77709,10 +77709,10 @@ static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){ /* When the new root page was allocated, page 1 was made writable in ** order either to increase the database filesize, or to decrement the - ** freelist count. Hence, the sqlite3BtreeUpdateMeta() call cannot fail. + ** freelist count. Hence, the tdsqlite3BtreeUpdateMeta() call cannot fail. */ - assert( sqlite3PagerIswriteable(pBt->pPage1->pDbPage) ); - rc = sqlite3BtreeUpdateMeta(p, 4, pgnoRoot); + assert( tdsqlite3PagerIswriteable(pBt->pPage1->pDbPage) ); + rc = tdsqlite3BtreeUpdateMeta(p, 4, pgnoRoot); if( NEVER(rc) ){ releasePage(pRoot); return rc; @@ -77723,23 +77723,23 @@ static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){ if( rc ) return rc; } #endif - assert( sqlite3PagerIswriteable(pRoot->pDbPage) ); + assert( tdsqlite3PagerIswriteable(pRoot->pDbPage) ); if( createTabFlags & BTREE_INTKEY ){ ptfFlags = PTF_INTKEY | PTF_LEAFDATA | PTF_LEAF; }else{ ptfFlags = PTF_ZERODATA | PTF_LEAF; } zeroPage(pRoot, ptfFlags); - sqlite3PagerUnref(pRoot->pDbPage); + tdsqlite3PagerUnref(pRoot->pDbPage); assert( (pBt->openFlags & BTREE_SINGLE)==0 || pgnoRoot==2 ); *piTable = (int)pgnoRoot; return SQLITE_OK; } -SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree *p, int *piTable, int flags){ +SQLITE_PRIVATE int tdsqlite3BtreeCreateTable(Btree *p, int *piTable, int flags){ int rc; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); rc = btreeCreateTable(p, piTable, flags); - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } @@ -77760,7 +77760,7 @@ static int clearDatabasePage( int hdr; CellInfo info; - assert( sqlite3_mutex_held(pBt->mutex) ); + assert( tdsqlite3_mutex_held(pBt->mutex) ); if( pgno>btreePagecount(pBt) ){ return SQLITE_CORRUPT_BKPT; } @@ -77791,7 +77791,7 @@ static int clearDatabasePage( } if( freePageFlag ){ freePage(pPage, &rc); - }else if( (rc = sqlite3PagerWrite(pPage->pDbPage))==0 ){ + }else if( (rc = tdsqlite3PagerWrite(pPage->pDbPage))==0 ){ zeroPage(pPage, pPage->aData[hdr] | PTF_LEAF); } @@ -77814,10 +77814,10 @@ cleardatabasepage_out: ** integer value pointed to by pnChange is incremented by the number of ** entries in the table. */ -SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){ +SQLITE_PRIVATE int tdsqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){ int rc; BtShared *pBt = p->pBt; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); assert( p->inTrans==TRANS_WRITE ); rc = saveAllCursors(pBt, (Pgno)iTable, 0); @@ -77829,7 +77829,7 @@ SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){ invalidateIncrblobCursors(p, (Pgno)iTable, 0, 1); rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange); } - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } @@ -77838,8 +77838,8 @@ SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){ ** ** This routine only work for pCur on an ephemeral table. */ -SQLITE_PRIVATE int sqlite3BtreeClearTableOfCursor(BtCursor *pCur){ - return sqlite3BtreeClearTable(pCur->pBtree, pCur->pgnoRoot, 0); +SQLITE_PRIVATE int tdsqlite3BtreeClearTableOfCursor(BtCursor *pCur){ + return tdsqlite3BtreeClearTable(pCur->pBtree, pCur->pgnoRoot, 0); } /* @@ -77867,7 +77867,7 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){ MemPage *pPage = 0; BtShared *pBt = p->pBt; - assert( sqlite3BtreeHoldsMutex(p) ); + assert( tdsqlite3BtreeHoldsMutex(p) ); assert( p->inTrans==TRANS_WRITE ); assert( iTable>=2 ); if( iTable>btreePagecount(pBt) ){ @@ -77876,7 +77876,7 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){ rc = btreeGetPage(pBt, (Pgno)iTable, &pPage, 0); if( rc ) return rc; - rc = sqlite3BtreeClearTable(p, iTable, 0); + rc = tdsqlite3BtreeClearTable(p, iTable, 0); if( rc ){ releasePage(pPage); return rc; @@ -77890,7 +77890,7 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){ #else if( pBt->autoVacuum ){ Pgno maxRootPgno; - sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &maxRootPgno); + tdsqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &maxRootPgno); if( iTable==maxRootPgno ){ /* If the table being dropped is the table with the largest root-page @@ -77939,7 +77939,7 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){ } assert( maxRootPgno!=PENDING_BYTE_PAGE(pBt) ); - rc = sqlite3BtreeUpdateMeta(p, 4, maxRootPgno); + rc = tdsqlite3BtreeUpdateMeta(p, 4, maxRootPgno); }else{ freePage(pPage, &rc); releasePage(pPage); @@ -77947,11 +77947,11 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){ #endif return rc; } -SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){ +SQLITE_PRIVATE int tdsqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){ int rc; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); rc = btreeDropTable(p, iTable, piMoved); - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } @@ -77976,17 +77976,17 @@ SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){ ** pattern is the same as header meta values, and so it is convenient to ** read it from this routine. */ -SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){ +SQLITE_PRIVATE void tdsqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){ BtShared *pBt = p->pBt; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); assert( p->inTrans>TRANS_NONE ); assert( SQLITE_OK==querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK) ); assert( pBt->pPage1 ); assert( idx>=0 && idx<=15 ); if( idx==BTREE_DATA_VERSION ){ - *pMeta = sqlite3PagerDataVersion(pBt->pPager) + p->iDataVersion; + *pMeta = tdsqlite3PagerDataVersion(pBt->pPager) + p->iDataVersion; }else{ *pMeta = get4byte(&pBt->pPage1->aData[36 + idx*4]); } @@ -77999,23 +77999,23 @@ SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){ } #endif - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); } /* ** Write meta-information back into the database. Meta[0] is ** read-only and may not be written. */ -SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){ +SQLITE_PRIVATE int tdsqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){ BtShared *pBt = p->pBt; unsigned char *pP1; int rc; assert( idx>=1 && idx<=15 ); - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); assert( p->inTrans==TRANS_WRITE ); assert( pBt->pPage1!=0 ); pP1 = pBt->pPage1->aData; - rc = sqlite3PagerWrite(pBt->pPage1->pDbPage); + rc = tdsqlite3PagerWrite(pBt->pPage1->pDbPage); if( rc==SQLITE_OK ){ put4byte(&pP1[36 + idx*4], iMeta); #ifndef SQLITE_OMIT_AUTOVACUUM @@ -78026,7 +78026,7 @@ SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){ } #endif } - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } @@ -78039,7 +78039,7 @@ SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){ ** Otherwise, if an error is encountered (i.e. an IO error or database ** corruption) an SQLite error code is returned. */ -SQLITE_PRIVATE int sqlite3BtreeCount(sqlite3 *db, BtCursor *pCur, i64 *pnEntry){ +SQLITE_PRIVATE int tdsqlite3BtreeCount(tdsqlite3 *db, BtCursor *pCur, i64 *pnEntry){ i64 nEntry = 0; /* Value to return in *pnEntry */ int rc; /* Return code */ @@ -78109,7 +78109,7 @@ SQLITE_PRIVATE int sqlite3BtreeCount(sqlite3 *db, BtCursor *pCur, i64 *pnEntry){ ** Return the pager associated with a BTree. This routine is used for ** testing and debugging only. */ -SQLITE_PRIVATE Pager *sqlite3BtreePager(Btree *p){ +SQLITE_PRIVATE Pager *tdsqlite3BtreePager(Btree *p){ return p->pBt->pPager; } @@ -78128,12 +78128,12 @@ static void checkAppendMsg( pCheck->nErr++; va_start(ap, zFormat); if( pCheck->errMsg.nChar ){ - sqlite3_str_append(&pCheck->errMsg, "\n", 1); + tdsqlite3_str_append(&pCheck->errMsg, "\n", 1); } if( pCheck->zPfx ){ - sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx, pCheck->v1, pCheck->v2); + tdsqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx, pCheck->v1, pCheck->v2); } - sqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap); + tdsqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap); va_end(ap); if( pCheck->errMsg.accError==SQLITE_NOMEM ){ pCheck->mallocFailed = 1; @@ -78232,11 +78232,11 @@ static void checkList( unsigned char *pOvflData; if( checkRef(pCheck, iPage) ) break; N--; - if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){ + if( tdsqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){ checkAppendMsg(pCheck, "failed to get page %d", iPage); break; } - pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage); + pOvflData = (unsigned char *)tdsqlite3PagerGetData(pOvflPage); if( isFreeList ){ u32 n = (u32)get4byte(&pOvflData[4]); #ifndef SQLITE_OMIT_AUTOVACUUM @@ -78274,7 +78274,7 @@ static void checkList( } #endif iPage = get4byte(pOvflData); - sqlite3PagerUnref(pOvflPage); + tdsqlite3PagerUnref(pOvflPage); } if( N && nErrAtStart==pCheck->nErr ){ checkAppendMsg(pCheck, @@ -78621,8 +78621,8 @@ end_of_check: ** malloc is returned if *pnErr is non-zero. If *pnErr==0 then NULL is ** returned. If a memory allocation error occurs, NULL is returned. */ -SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck( - sqlite3 *db, /* Database connection that is running the check */ +SQLITE_PRIVATE char *tdsqlite3BtreeIntegrityCheck( + tdsqlite3 *db, /* Database connection that is running the check */ Btree *p, /* The btree to be checked */ int *aRoot, /* An array of root pages numbers for individual trees */ int nRoot, /* Number of entries in aRoot[] */ @@ -78636,9 +78636,9 @@ SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck( char zErr[100]; VVA_ONLY( int nRef ); - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); assert( p->inTrans>TRANS_NONE && pBt->inTransaction>TRANS_NONE ); - VVA_ONLY( nRef = sqlite3PagerRefcount(pBt->pPager) ); + VVA_ONLY( nRef = tdsqlite3PagerRefcount(pBt->pPager) ); assert( nRef>=0 ); sCheck.db = db; sCheck.pBt = pBt; @@ -78652,18 +78652,18 @@ SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck( sCheck.v2 = 0; sCheck.aPgRef = 0; sCheck.heap = 0; - sqlite3StrAccumInit(&sCheck.errMsg, 0, zErr, sizeof(zErr), SQLITE_MAX_LENGTH); + tdsqlite3StrAccumInit(&sCheck.errMsg, 0, zErr, sizeof(zErr), SQLITE_MAX_LENGTH); sCheck.errMsg.printfFlags = SQLITE_PRINTF_INTERNAL; if( sCheck.nPage==0 ){ goto integrity_ck_cleanup; } - sCheck.aPgRef = sqlite3MallocZero((sCheck.nPage / 8)+ 1); + sCheck.aPgRef = tdsqlite3MallocZero((sCheck.nPage / 8)+ 1); if( !sCheck.aPgRef ){ sCheck.mallocFailed = 1; goto integrity_ck_cleanup; } - sCheck.heap = (u32*)sqlite3PageMalloc( pBt->pageSize ); + sCheck.heap = (u32*)tdsqlite3PageMalloc( pBt->pageSize ); if( sCheck.heap==0 ){ sCheck.mallocFailed = 1; goto integrity_ck_cleanup; @@ -78738,18 +78738,18 @@ SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck( /* Clean up and report errors. */ integrity_ck_cleanup: - sqlite3PageFree(sCheck.heap); - sqlite3_free(sCheck.aPgRef); + tdsqlite3PageFree(sCheck.heap); + tdsqlite3_free(sCheck.aPgRef); if( sCheck.mallocFailed ){ - sqlite3_str_reset(&sCheck.errMsg); + tdsqlite3_str_reset(&sCheck.errMsg); sCheck.nErr++; } *pnErr = sCheck.nErr; - if( sCheck.nErr==0 ) sqlite3_str_reset(&sCheck.errMsg); + if( sCheck.nErr==0 ) tdsqlite3_str_reset(&sCheck.errMsg); /* Make sure this analysis did not leave any unref() pages. */ - assert( nRef==sqlite3PagerRefcount(pBt->pPager) ); - sqlite3BtreeLeave(p); - return sqlite3StrAccumFinish(&sCheck.errMsg); + assert( nRef==tdsqlite3PagerRefcount(pBt->pPager) ); + tdsqlite3BtreeLeave(p); + return tdsqlite3StrAccumFinish(&sCheck.errMsg); } #endif /* SQLITE_OMIT_INTEGRITY_CHECK */ @@ -78760,9 +78760,9 @@ integrity_ck_cleanup: ** The pager filename is invariant as long as the pager is ** open so it is safe to access without the BtShared mutex. */ -SQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *p){ +SQLITE_PRIVATE const char *tdsqlite3BtreeGetFilename(Btree *p){ assert( p->pBt->pPager!=0 ); - return sqlite3PagerFilename(p->pBt->pPager, 1); + return tdsqlite3PagerFilename(p->pBt->pPager, 1); } /* @@ -78773,16 +78773,16 @@ SQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *p){ ** The pager journal filename is invariant as long as the pager is ** open so it is safe to access without the BtShared mutex. */ -SQLITE_PRIVATE const char *sqlite3BtreeGetJournalname(Btree *p){ +SQLITE_PRIVATE const char *tdsqlite3BtreeGetJournalname(Btree *p){ assert( p->pBt->pPager!=0 ); - return sqlite3PagerJournalname(p->pBt->pPager); + return tdsqlite3PagerJournalname(p->pBt->pPager); } /* ** Return non-zero if a transaction is active. */ -SQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree *p){ - assert( p==0 || sqlite3_mutex_held(p->db->mutex) ); +SQLITE_PRIVATE int tdsqlite3BtreeIsInTrans(Btree *p){ + assert( p==0 || tdsqlite3_mutex_held(p->db->mutex) ); return (p && (p->inTrans==TRANS_WRITE)); } @@ -78795,17 +78795,17 @@ SQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree *p){ ** ** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART. */ -SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree *p, int eMode, int *pnLog, int *pnCkpt){ +SQLITE_PRIVATE int tdsqlite3BtreeCheckpoint(Btree *p, int eMode, int *pnLog, int *pnCkpt){ int rc = SQLITE_OK; if( p ){ BtShared *pBt = p->pBt; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); if( pBt->inTransaction!=TRANS_NONE ){ rc = SQLITE_LOCKED; }else{ - rc = sqlite3PagerCheckpoint(pBt->pPager, p->db, eMode, pnLog, pnCkpt); + rc = tdsqlite3PagerCheckpoint(pBt->pPager, p->db, eMode, pnLog, pnCkpt); } - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); } return rc; } @@ -78814,15 +78814,15 @@ SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree *p, int eMode, int *pnLog, int * /* ** Return non-zero if a read (or write) transaction is active. */ -SQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeIsInReadTrans(Btree *p){ assert( p ); - assert( sqlite3_mutex_held(p->db->mutex) ); + assert( tdsqlite3_mutex_held(p->db->mutex) ); return p->inTrans!=TRANS_NONE; } -SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeIsInBackup(Btree *p){ assert( p ); - assert( sqlite3_mutex_held(p->db->mutex) ); + assert( tdsqlite3_mutex_held(p->db->mutex) ); return p->nBackup!=0; } @@ -78843,17 +78843,17 @@ SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree *p){ ** ** Just before the shared-btree is closed, the function passed as the ** xFree argument when the memory allocation was made is invoked on the -** blob of allocated memory. The xFree function should not call sqlite3_free() +** blob of allocated memory. The xFree function should not call tdsqlite3_free() ** on the memory, the btree layer does that. */ -SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){ +SQLITE_PRIVATE void *tdsqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){ BtShared *pBt = p->pBt; - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); if( !pBt->pSchema && nBytes ){ - pBt->pSchema = sqlite3DbMallocZero(0, nBytes); + pBt->pSchema = tdsqlite3DbMallocZero(0, nBytes); pBt->xFreeSchema = xFree; } - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return pBt->pSchema; } @@ -78862,13 +78862,13 @@ SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void ** btree as the argument handle holds an exclusive lock on the ** sqlite_master table. Otherwise SQLITE_OK. */ -SQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeSchemaLocked(Btree *p){ int rc; - assert( sqlite3_mutex_held(p->db->mutex) ); - sqlite3BtreeEnter(p); + assert( tdsqlite3_mutex_held(p->db->mutex) ); + tdsqlite3BtreeEnter(p); rc = querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK); assert( rc==SQLITE_OK || rc==SQLITE_LOCKED_SHAREDCACHE ); - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); return rc; } @@ -78879,7 +78879,7 @@ SQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *p){ ** lock is a write lock if isWritelock is true or a read lock ** if it is false. */ -SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){ +SQLITE_PRIVATE int tdsqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){ int rc = SQLITE_OK; assert( p->inTrans!=TRANS_NONE ); if( p->sharable ){ @@ -78887,12 +78887,12 @@ SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){ assert( READ_LOCK+1==WRITE_LOCK ); assert( isWriteLock==0 || isWriteLock==1 ); - sqlite3BtreeEnter(p); + tdsqlite3BtreeEnter(p); rc = querySharedCacheTableLock(p, iTab, lockType); if( rc==SQLITE_OK ){ rc = setSharedCacheTableLock(p, iTab, lockType); } - sqlite3BtreeLeave(p); + tdsqlite3BtreeLeave(p); } return rc; } @@ -78909,10 +78909,10 @@ SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){ ** parameters that attempt to write past the end of the existing data, ** no modifications are made and SQLITE_CORRUPT is returned. */ -SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void *z){ +SQLITE_PRIVATE int tdsqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void *z){ int rc; assert( cursorOwnsBtShared(pCsr) ); - assert( sqlite3_mutex_held(pCsr->pBtree->db->mutex) ); + assert( tdsqlite3_mutex_held(pCsr->pBtree->db->mutex) ); assert( pCsr->curFlags & BTCF_Incrblob ); rc = restoreCursorPosition(pCsr); @@ -78957,7 +78957,7 @@ SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void /* ** Mark this cursor as an incremental blob cursor. */ -SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *pCur){ +SQLITE_PRIVATE void tdsqlite3BtreeIncrblobCursor(BtCursor *pCur){ pCur->curFlags |= BTCF_Incrblob; pCur->pBtree->hasIncrblobCur = 1; } @@ -78968,7 +78968,7 @@ SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *pCur){ ** "write version" (single byte at byte offset 19) fields in the database ** header to iVersion. */ -SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){ +SQLITE_PRIVATE int tdsqlite3BtreeSetVersion(Btree *pBtree, int iVersion){ BtShared *pBt = pBtree->pBt; int rc; /* Return code */ @@ -78980,13 +78980,13 @@ SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){ pBt->btsFlags &= ~BTS_NO_WAL; if( iVersion==1 ) pBt->btsFlags |= BTS_NO_WAL; - rc = sqlite3BtreeBeginTrans(pBtree, 0, 0); + rc = tdsqlite3BtreeBeginTrans(pBtree, 0, 0); if( rc==SQLITE_OK ){ u8 *aData = pBt->pPage1->aData; if( aData[18]!=(u8)iVersion || aData[19]!=(u8)iVersion ){ - rc = sqlite3BtreeBeginTrans(pBtree, 2, 0); + rc = tdsqlite3BtreeBeginTrans(pBtree, 2, 0); if( rc==SQLITE_OK ){ - rc = sqlite3PagerWrite(pBt->pPage1->pDbPage); + rc = tdsqlite3PagerWrite(pBt->pPage1->pDbPage); if( rc==SQLITE_OK ){ aData[18] = (u8)iVersion; aData[19] = (u8)iVersion; @@ -79003,27 +79003,27 @@ SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){ ** Return true if the cursor has a hint specified. This routine is ** only used from within assert() statements */ -SQLITE_PRIVATE int sqlite3BtreeCursorHasHint(BtCursor *pCsr, unsigned int mask){ +SQLITE_PRIVATE int tdsqlite3BtreeCursorHasHint(BtCursor *pCsr, unsigned int mask){ return (pCsr->hints & mask)!=0; } /* ** Return true if the given Btree is read-only. */ -SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeIsReadonly(Btree *p){ return (p->pBt->btsFlags & BTS_READ_ONLY)!=0; } /* ** Return the size of the header added to each page by this module. */ -SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(MemPage)); } +SQLITE_PRIVATE int tdsqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(MemPage)); } #if !defined(SQLITE_OMIT_SHARED_CACHE) /* ** Return true if the Btree passed as the only argument is sharable. */ -SQLITE_PRIVATE int sqlite3BtreeSharable(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeSharable(Btree *p){ return p->sharable; } @@ -79032,7 +79032,7 @@ SQLITE_PRIVATE int sqlite3BtreeSharable(Btree *p){ ** the Btree handle passed as the only argument. For private caches ** this is always 1. For shared caches it may be 1 or greater. */ -SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree *p){ +SQLITE_PRIVATE int tdsqlite3BtreeConnectionCount(Btree *p){ testcase( p->sharable ); return p->pBt->nRef; } @@ -79051,7 +79051,7 @@ SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree *p){ ** May you share freely, never taking more than you give. ** ************************************************************************* -** This file contains the implementation of the sqlite3_backup_XXX() +** This file contains the implementation of the tdsqlite3_backup_XXX() ** API functions and the related features. */ /* #include "sqliteInt.h" */ @@ -79060,14 +79060,14 @@ SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree *p){ /* ** Structure allocated for each backup operation. */ -struct sqlite3_backup { - sqlite3* pDestDb; /* Destination database handle */ +struct tdsqlite3_backup { + tdsqlite3* pDestDb; /* Destination database handle */ Btree *pDest; /* Destination b-tree file */ u32 iDestSchema; /* Original schema cookie in destination */ int bDestLocked; /* True once a write-transaction is open on pDest */ Pgno iNext; /* Page number of the next source page to copy */ - sqlite3* pSrcDb; /* Source database handle */ + tdsqlite3* pSrcDb; /* Source database handle */ Btree *pSrc; /* Source b-tree file */ int rc; /* Backup process error code */ @@ -79079,16 +79079,16 @@ struct sqlite3_backup { Pgno nPagecount; /* Total number of pages to copy */ int isAttached; /* True once backup has been registered with pager */ - sqlite3_backup *pNext; /* Next backup associated with source pager */ + tdsqlite3_backup *pNext; /* Next backup associated with source pager */ }; /* ** THREAD SAFETY NOTES: ** -** Once it has been created using backup_init(), a single sqlite3_backup +** Once it has been created using backup_init(), a single tdsqlite3_backup ** structure may be accessed via two groups of thread-safe entry points: ** -** * Via the sqlite3_backup_XXX() API function backup_step() and +** * Via the tdsqlite3_backup_XXX() API function backup_step() and ** backup_finish(). Both these functions obtain the source database ** handle mutex and the mutex associated with the source BtShared ** structure, in that order. @@ -79099,7 +79099,7 @@ struct sqlite3_backup { ** associated with the source database BtShared structure will always ** be held when either of these functions are invoked. ** -** The other sqlite3_backup_XXX() API functions, backup_remaining() and +** The other tdsqlite3_backup_XXX() API functions, backup_remaining() and ** backup_pagecount() are not thread-safe functions. If they are called ** while some other thread is calling backup_step() or backup_finish(), ** the values returned may be invalid. There is no way for a call to @@ -79121,27 +79121,27 @@ struct sqlite3_backup { ** function. If an error occurs while doing so, return 0 and write an ** error message to pErrorDb. */ -static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){ - int i = sqlite3FindDbName(pDb, zDb); +static Btree *findBtree(tdsqlite3 *pErrorDb, tdsqlite3 *pDb, const char *zDb){ + int i = tdsqlite3FindDbName(pDb, zDb); if( i==1 ){ Parse sParse; int rc = 0; memset(&sParse, 0, sizeof(sParse)); sParse.db = pDb; - if( sqlite3OpenTempDatabase(&sParse) ){ - sqlite3ErrorWithMsg(pErrorDb, sParse.rc, "%s", sParse.zErrMsg); + if( tdsqlite3OpenTempDatabase(&sParse) ){ + tdsqlite3ErrorWithMsg(pErrorDb, sParse.rc, "%s", sParse.zErrMsg); rc = SQLITE_ERROR; } - sqlite3DbFree(pErrorDb, sParse.zErrMsg); - sqlite3ParserReset(&sParse); + tdsqlite3DbFree(pErrorDb, sParse.zErrMsg); + tdsqlite3ParserReset(&sParse); if( rc ){ return 0; } } if( i<0 ){ - sqlite3ErrorWithMsg(pErrorDb, SQLITE_ERROR, "unknown database %s", zDb); + tdsqlite3ErrorWithMsg(pErrorDb, SQLITE_ERROR, "unknown database %s", zDb); return 0; } @@ -79152,9 +79152,9 @@ static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){ ** Attempt to set the page size of the destination to match the page size ** of the source. */ -static int setDestPgsz(sqlite3_backup *p){ +static int setDestPgsz(tdsqlite3_backup *p){ int rc; - rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),-1,0); + rc = tdsqlite3BtreeSetPageSize(p->pDest,tdsqlite3BtreeGetPageSize(p->pSrc),-1,0); return rc; } @@ -79164,32 +79164,32 @@ static int setDestPgsz(sqlite3_backup *p){ ** is an open read-transaction, return SQLITE_ERROR and leave an error ** message in database handle db. */ -static int checkReadTransaction(sqlite3 *db, Btree *p){ - if( sqlite3BtreeIsInReadTrans(p) ){ - sqlite3ErrorWithMsg(db, SQLITE_ERROR, "destination database is in use"); +static int checkReadTransaction(tdsqlite3 *db, Btree *p){ + if( tdsqlite3BtreeIsInReadTrans(p) ){ + tdsqlite3ErrorWithMsg(db, SQLITE_ERROR, "destination database is in use"); return SQLITE_ERROR; } return SQLITE_OK; } /* -** Create an sqlite3_backup process to copy the contents of zSrcDb from +** Create an tdsqlite3_backup process to copy the contents of zSrcDb from ** connection handle pSrcDb to zDestDb in pDestDb. If successful, return -** a pointer to the new sqlite3_backup object. +** a pointer to the new tdsqlite3_backup object. ** ** If an error occurs, NULL is returned and an error code and error message ** stored in database handle pDestDb. */ -SQLITE_API sqlite3_backup *sqlite3_backup_init( - sqlite3* pDestDb, /* Database to write to */ +SQLITE_API tdsqlite3_backup *tdsqlite3_backup_init( + tdsqlite3* pDestDb, /* Database to write to */ const char *zDestDb, /* Name of database within pDestDb */ - sqlite3* pSrcDb, /* Database connection to read from */ + tdsqlite3* pSrcDb, /* Database connection to read from */ const char *zSrcDb /* Name of database within pSrcDb */ ){ - sqlite3_backup *p; /* Value to return */ + tdsqlite3_backup *p; /* Value to return */ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(pSrcDb)||!sqlite3SafetyCheckOk(pDestDb) ){ + if( !tdsqlite3SafetyCheckOk(pSrcDb)||!tdsqlite3SafetyCheckOk(pDestDb) ){ (void)SQLITE_MISUSE_BKPT; return 0; } @@ -79198,18 +79198,18 @@ SQLITE_API sqlite3_backup *sqlite3_backup_init( /* BEGIN SQLCIPHER */ #ifdef SQLITE_HAS_CODEC { - extern int sqlcipher_find_db_index(sqlite3*, const char*); - extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*); + extern int sqlcipher_find_db_index(tdsqlite3*, const char*); + extern void tdsqlite3CodecGetKey(tdsqlite3*, int, void**, int*); int srcNKey, destNKey; void *zKey; - sqlite3CodecGetKey(pSrcDb, sqlcipher_find_db_index(pSrcDb, zSrcDb), &zKey, &srcNKey); - sqlite3CodecGetKey(pDestDb, sqlcipher_find_db_index(pDestDb, zDestDb), &zKey, &destNKey); + tdsqlite3CodecGetKey(pSrcDb, sqlcipher_find_db_index(pSrcDb, zSrcDb), &zKey, &srcNKey); + tdsqlite3CodecGetKey(pDestDb, sqlcipher_find_db_index(pDestDb, zDestDb), &zKey, &destNKey); zKey = NULL; /* either both databases must be plaintext, or both must be encrypted */ if((srcNKey == 0 && destNKey > 0) || (srcNKey > 0 && destNKey == 0)) { - sqlite3ErrorWithMsg(pDestDb, SQLITE_ERROR, "backup is not supported with encrypted databases"); + tdsqlite3ErrorWithMsg(pDestDb, SQLITE_ERROR, "backup is not supported with encrypted databases"); return NULL; } } @@ -79218,28 +79218,28 @@ SQLITE_API sqlite3_backup *sqlite3_backup_init( /* Lock the source database handle. The destination database ** handle is not locked in this routine, but it is locked in - ** sqlite3_backup_step(). The user is required to ensure that no + ** tdsqlite3_backup_step(). The user is required to ensure that no ** other thread accesses the destination handle for the duration ** of the backup operation. Any attempt to use the destination ** database connection while a backup is in progress may cause ** a malfunction or a deadlock. */ - sqlite3_mutex_enter(pSrcDb->mutex); - sqlite3_mutex_enter(pDestDb->mutex); + tdsqlite3_mutex_enter(pSrcDb->mutex); + tdsqlite3_mutex_enter(pDestDb->mutex); if( pSrcDb==pDestDb ){ - sqlite3ErrorWithMsg( + tdsqlite3ErrorWithMsg( pDestDb, SQLITE_ERROR, "source and destination must be distinct" ); p = 0; }else { - /* Allocate space for a new sqlite3_backup object... - ** EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a - ** call to sqlite3_backup_init() and is destroyed by a call to - ** sqlite3_backup_finish(). */ - p = (sqlite3_backup *)sqlite3MallocZero(sizeof(sqlite3_backup)); + /* Allocate space for a new tdsqlite3_backup object... + ** EVIDENCE-OF: R-64852-21591 The tdsqlite3_backup object is created by a + ** call to tdsqlite3_backup_init() and is destroyed by a call to + ** tdsqlite3_backup_finish(). */ + p = (tdsqlite3_backup *)tdsqlite3MallocZero(sizeof(tdsqlite3_backup)); if( !p ){ - sqlite3Error(pDestDb, SQLITE_NOMEM_BKPT); + tdsqlite3Error(pDestDb, SQLITE_NOMEM_BKPT); } } @@ -79258,9 +79258,9 @@ SQLITE_API sqlite3_backup *sqlite3_backup_init( /* One (or both) of the named databases did not exist or an OOM ** error was hit. Or there is a transaction open on the destination ** database. The error has already been written into the pDestDb - ** handle. All that is left to do here is free the sqlite3_backup + ** handle. All that is left to do here is free the tdsqlite3_backup ** structure. */ - sqlite3_free(p); + tdsqlite3_free(p); p = 0; } } @@ -79268,8 +79268,8 @@ SQLITE_API sqlite3_backup *sqlite3_backup_init( p->pSrc->nBackup++; } - sqlite3_mutex_leave(pDestDb->mutex); - sqlite3_mutex_leave(pSrcDb->mutex); + tdsqlite3_mutex_leave(pDestDb->mutex); + tdsqlite3_mutex_leave(pSrcDb->mutex); return p; } @@ -79288,27 +79288,27 @@ static int isFatalError(int rc){ ** destination database. */ static int backupOnePage( - sqlite3_backup *p, /* Backup handle */ + tdsqlite3_backup *p, /* Backup handle */ Pgno iSrcPg, /* Source database page to backup */ const u8 *zSrcData, /* Source database page data */ int bUpdate /* True for an update, false otherwise */ ){ - Pager * const pDestPager = sqlite3BtreePager(p->pDest); - const int nSrcPgsz = sqlite3BtreeGetPageSize(p->pSrc); - int nDestPgsz = sqlite3BtreeGetPageSize(p->pDest); + Pager * const pDestPager = tdsqlite3BtreePager(p->pDest); + const int nSrcPgsz = tdsqlite3BtreeGetPageSize(p->pSrc); + int nDestPgsz = tdsqlite3BtreeGetPageSize(p->pDest); const int nCopy = MIN(nSrcPgsz, nDestPgsz); const i64 iEnd = (i64)iSrcPg*(i64)nSrcPgsz; #ifdef SQLITE_HAS_CODEC /* Use BtreeGetReserveNoMutex() for the source b-tree, as although it is ** guaranteed that the shared-mutex is held by this thread, handle ** p->pSrc may not actually be the owner. */ - int nSrcReserve = sqlite3BtreeGetReserveNoMutex(p->pSrc); - int nDestReserve = sqlite3BtreeGetOptimalReserve(p->pDest); + int nSrcReserve = tdsqlite3BtreeGetReserveNoMutex(p->pSrc); + int nDestReserve = tdsqlite3BtreeGetOptimalReserve(p->pDest); #endif int rc = SQLITE_OK; i64 iOff; - assert( sqlite3BtreeGetReserveNoMutex(p->pSrc)>=0 ); + assert( tdsqlite3BtreeGetReserveNoMutex(p->pSrc)>=0 ); assert( p->bDestLocked ); assert( !isFatalError(p->rc) ); assert( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ); @@ -79317,7 +79317,7 @@ static int backupOnePage( /* Catch the case where the destination is an in-memory database and the ** page sizes of the source and destination differ. */ - if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(pDestPager) ){ + if( nSrcPgsz!=nDestPgsz && tdsqlite3PagerIsMemdb(pDestPager) ){ rc = SQLITE_READONLY; } @@ -79325,7 +79325,7 @@ static int backupOnePage( /* Backup is not possible if the page size of the destination is changing ** and a codec is in use. */ - if( nSrcPgsz!=nDestPgsz && sqlite3PagerGetCodec(pDestPager)!=0 ){ + if( nSrcPgsz!=nDestPgsz && tdsqlite3PagerGetCodec(pDestPager)!=0 ){ rc = SQLITE_READONLY; } @@ -79336,7 +79336,7 @@ static int backupOnePage( */ if( nSrcReserve!=nDestReserve ){ u32 newPgsz = nSrcPgsz; - rc = sqlite3PagerSetPagesize(pDestPager, &newPgsz, nSrcReserve); + rc = tdsqlite3PagerSetPagesize(pDestPager, &newPgsz, nSrcReserve); if( rc==SQLITE_OK && newPgsz!=(u32)nSrcPgsz ) rc = SQLITE_READONLY; } #endif @@ -79349,11 +79349,11 @@ static int backupOnePage( DbPage *pDestPg = 0; Pgno iDest = (Pgno)(iOff/nDestPgsz)+1; if( iDest==PENDING_BYTE_PAGE(p->pDest->pBt) ) continue; - if( SQLITE_OK==(rc = sqlite3PagerGet(pDestPager, iDest, &pDestPg, 0)) - && SQLITE_OK==(rc = sqlite3PagerWrite(pDestPg)) + if( SQLITE_OK==(rc = tdsqlite3PagerGet(pDestPager, iDest, &pDestPg, 0)) + && SQLITE_OK==(rc = tdsqlite3PagerWrite(pDestPg)) ){ const u8 *zIn = &zSrcData[iOff%nSrcPgsz]; - u8 *zDestData = sqlite3PagerGetData(pDestPg); + u8 *zDestData = tdsqlite3PagerGetData(pDestPg); u8 *zOut = &zDestData[iOff%nDestPgsz]; /* Copy the data from the source page into the destination page. @@ -79364,12 +79364,12 @@ static int backupOnePage( ** "MUST BE FIRST" for this purpose. */ memcpy(zOut, zIn, nCopy); - ((u8 *)sqlite3PagerGetExtra(pDestPg))[0] = 0; + ((u8 *)tdsqlite3PagerGetExtra(pDestPg))[0] = 0; if( iOff==0 && bUpdate==0 ){ - sqlite3Put4byte(&zOut[28], sqlite3BtreeLastPage(p->pSrc)); + tdsqlite3Put4byte(&zOut[28], tdsqlite3BtreeLastPage(p->pSrc)); } } - sqlite3PagerUnref(pDestPg); + tdsqlite3PagerUnref(pDestPg); } return rc; @@ -79383,11 +79383,11 @@ static int backupOnePage( ** Return SQLITE_OK if everything is successful, or an SQLite error ** code if an error occurs. */ -static int backupTruncateFile(sqlite3_file *pFile, i64 iSize){ +static int backupTruncateFile(tdsqlite3_file *pFile, i64 iSize){ i64 iCurrent; - int rc = sqlite3OsFileSize(pFile, &iCurrent); + int rc = tdsqlite3OsFileSize(pFile, &iCurrent); if( rc==SQLITE_OK && iCurrent>iSize ){ - rc = sqlite3OsTruncate(pFile, iSize); + rc = tdsqlite3OsTruncate(pFile, iSize); } return rc; } @@ -79396,10 +79396,10 @@ static int backupTruncateFile(sqlite3_file *pFile, i64 iSize){ ** Register this backup object with the associated source pager for ** callbacks when pages are changed or the cache invalidated. */ -static void attachBackupObject(sqlite3_backup *p){ - sqlite3_backup **pp; - assert( sqlite3BtreeHoldsMutex(p->pSrc) ); - pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc)); +static void attachBackupObject(tdsqlite3_backup *p){ + tdsqlite3_backup **pp; + assert( tdsqlite3BtreeHoldsMutex(p->pSrc) ); + pp = tdsqlite3PagerBackupPtr(tdsqlite3BtreePager(p->pSrc)); p->pNext = *pp; *pp = p; p->isAttached = 1; @@ -79408,7 +79408,7 @@ static void attachBackupObject(sqlite3_backup *p){ /* ** Copy nPage pages from the source b-tree to the destination. */ -SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ +SQLITE_API int tdsqlite3_backup_step(tdsqlite3_backup *p, int nPage){ int rc; int destMode; /* Destination journal mode */ int pgszSrc = 0; /* Source page size */ @@ -79417,16 +79417,16 @@ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ #ifdef SQLITE_ENABLE_API_ARMOR if( p==0 ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(p->pSrcDb->mutex); - sqlite3BtreeEnter(p->pSrc); + tdsqlite3_mutex_enter(p->pSrcDb->mutex); + tdsqlite3BtreeEnter(p->pSrc); if( p->pDestDb ){ - sqlite3_mutex_enter(p->pDestDb->mutex); + tdsqlite3_mutex_enter(p->pDestDb->mutex); } rc = p->rc; if( !isFatalError(rc) ){ - Pager * const pSrcPager = sqlite3BtreePager(p->pSrc); /* Source pager */ - Pager * const pDestPager = sqlite3BtreePager(p->pDest); /* Dest pager */ + Pager * const pSrcPager = tdsqlite3BtreePager(p->pSrc); /* Source pager */ + Pager * const pDestPager = tdsqlite3BtreePager(p->pDest); /* Dest pager */ int ii; /* Iterator variable */ int nSrcPage = -1; /* Size of source db in pages */ int bCloseTrans = 0; /* True if src db requires unlocking */ @@ -79444,8 +79444,8 @@ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ ** one now. If a transaction is opened here, then it will be closed ** before this function exits. */ - if( rc==SQLITE_OK && 0==sqlite3BtreeIsInReadTrans(p->pSrc) ){ - rc = sqlite3BtreeBeginTrans(p->pSrc, 0, 0); + if( rc==SQLITE_OK && 0==tdsqlite3BtreeIsInReadTrans(p->pSrc) ){ + rc = tdsqlite3BtreeBeginTrans(p->pSrc, 0, 0); bCloseTrans = 1; } @@ -79461,7 +79461,7 @@ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ /* Lock the destination database, if it is not locked already. */ if( SQLITE_OK==rc && p->bDestLocked==0 - && SQLITE_OK==(rc = sqlite3BtreeBeginTrans(p->pDest, 2, + && SQLITE_OK==(rc = tdsqlite3BtreeBeginTrans(p->pDest, 2, (int*)&p->iDestSchema)) ){ p->bDestLocked = 1; @@ -79469,9 +79469,9 @@ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ /* Do not allow backup if the destination database is in WAL mode ** and the page sizes are different between source and destination */ - pgszSrc = sqlite3BtreeGetPageSize(p->pSrc); - pgszDest = sqlite3BtreeGetPageSize(p->pDest); - destMode = sqlite3PagerGetJournalMode(sqlite3BtreePager(p->pDest)); + pgszSrc = tdsqlite3BtreeGetPageSize(p->pSrc); + pgszDest = tdsqlite3BtreeGetPageSize(p->pDest); + destMode = tdsqlite3PagerGetJournalMode(tdsqlite3BtreePager(p->pDest)); if( SQLITE_OK==rc && destMode==PAGER_JOURNALMODE_WAL && pgszSrc!=pgszDest ){ rc = SQLITE_READONLY; } @@ -79479,16 +79479,16 @@ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ /* Now that there is a read-lock on the source database, query the ** source pager for the number of pages in the database. */ - nSrcPage = (int)sqlite3BtreeLastPage(p->pSrc); + nSrcPage = (int)tdsqlite3BtreeLastPage(p->pSrc); assert( nSrcPage>=0 ); for(ii=0; (nPage<0 || iiiNext<=(Pgno)nSrcPage && !rc; ii++){ const Pgno iSrcPg = p->iNext; /* Source page number */ if( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ){ DbPage *pSrcPg; /* Source page object */ - rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg,PAGER_GET_READONLY); + rc = tdsqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg,PAGER_GET_READONLY); if( rc==SQLITE_OK ){ - rc = backupOnePage(p, iSrcPg, sqlite3PagerGetData(pSrcPg), 0); - sqlite3PagerUnref(pSrcPg); + rc = backupOnePage(p, iSrcPg, tdsqlite3PagerGetData(pSrcPg), 0); + tdsqlite3PagerUnref(pSrcPg); } } p->iNext++; @@ -79510,18 +79510,18 @@ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ */ if( rc==SQLITE_DONE ){ if( nSrcPage==0 ){ - rc = sqlite3BtreeNewDb(p->pDest); + rc = tdsqlite3BtreeNewDb(p->pDest); nSrcPage = 1; } if( rc==SQLITE_OK || rc==SQLITE_DONE ){ - rc = sqlite3BtreeUpdateMeta(p->pDest,1,p->iDestSchema+1); + rc = tdsqlite3BtreeUpdateMeta(p->pDest,1,p->iDestSchema+1); } if( rc==SQLITE_OK ){ if( p->pDestDb ){ - sqlite3ResetAllSchemasOfConnection(p->pDestDb); + tdsqlite3ResetAllSchemasOfConnection(p->pDestDb); } if( destMode==PAGER_JOURNALMODE_WAL ){ - rc = sqlite3BtreeSetVersion(p->pDest, 2); + rc = tdsqlite3BtreeSetVersion(p->pDest, 2); } } if( rc==SQLITE_OK ){ @@ -79531,15 +79531,15 @@ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ ** size may be different to the source page size. ** ** If the source page size is smaller than the destination page size, - ** round up. In this case the call to sqlite3OsTruncate() below will + ** round up. In this case the call to tdsqlite3OsTruncate() below will ** fix the size of the file. However it is important to call - ** sqlite3PagerTruncateImage() here so that any pages in the + ** tdsqlite3PagerTruncateImage() here so that any pages in the ** destination file that lie beyond the nDestTruncate page mark are ** journalled by PagerCommitPhaseOne() before they are destroyed ** by the file truncation. */ - assert( pgszSrc==sqlite3BtreeGetPageSize(p->pSrc) ); - assert( pgszDest==sqlite3BtreeGetPageSize(p->pDest) ); + assert( pgszSrc==tdsqlite3BtreeGetPageSize(p->pSrc) ); + assert( pgszDest==tdsqlite3BtreeGetPageSize(p->pDest) ); if( pgszSrcpDest->pBt) ){ DbPage *pPg; - rc = sqlite3PagerGet(pDestPager, iPg, &pPg, 0); + rc = tdsqlite3PagerGet(pDestPager, iPg, &pPg, 0); if( rc==SQLITE_OK ){ - rc = sqlite3PagerWrite(pPg); - sqlite3PagerUnref(pPg); + rc = tdsqlite3PagerWrite(pPg); + tdsqlite3PagerUnref(pPg); } } } if( rc==SQLITE_OK ){ - rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 1); + rc = tdsqlite3PagerCommitPhaseOne(pDestPager, 0, 1); } /* Write the extra pages and truncate the database file as required */ @@ -79605,12 +79605,12 @@ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ ){ PgHdr *pSrcPg = 0; const Pgno iSrcPg = (Pgno)((iOff/pgszSrc)+1); - rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg, 0); + rc = tdsqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg, 0); if( rc==SQLITE_OK ){ - u8 *zData = sqlite3PagerGetData(pSrcPg); - rc = sqlite3OsWrite(pFile, zData, pgszSrc, iOff); + u8 *zData = tdsqlite3PagerGetData(pSrcPg); + rc = tdsqlite3OsWrite(pFile, zData, pgszSrc, iOff); } - sqlite3PagerUnref(pSrcPg); + tdsqlite3PagerUnref(pSrcPg); } if( rc==SQLITE_OK ){ rc = backupTruncateFile(pFile, iSize); @@ -79618,16 +79618,16 @@ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ /* Sync the database file to disk. */ if( rc==SQLITE_OK ){ - rc = sqlite3PagerSync(pDestPager, 0); + rc = tdsqlite3PagerSync(pDestPager, 0); } }else{ - sqlite3PagerTruncateImage(pDestPager, nDestTruncate); - rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 0); + tdsqlite3PagerTruncateImage(pDestPager, nDestTruncate); + rc = tdsqlite3PagerCommitPhaseOne(pDestPager, 0, 0); } /* Finish committing the transaction to the destination database. */ if( SQLITE_OK==rc - && SQLITE_OK==(rc = sqlite3BtreeCommitPhaseTwo(p->pDest, 0)) + && SQLITE_OK==(rc = tdsqlite3BtreeCommitPhaseTwo(p->pDest, 0)) ){ rc = SQLITE_DONE; } @@ -79641,8 +79641,8 @@ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ */ if( bCloseTrans ){ TESTONLY( int rc2 ); - TESTONLY( rc2 = ) sqlite3BtreeCommitPhaseOne(p->pSrc, 0); - TESTONLY( rc2 |= ) sqlite3BtreeCommitPhaseTwo(p->pSrc, 0); + TESTONLY( rc2 = ) tdsqlite3BtreeCommitPhaseOne(p->pSrc, 0); + TESTONLY( rc2 |= ) tdsqlite3BtreeCommitPhaseTwo(p->pSrc, 0); assert( rc2==SQLITE_OK ); } @@ -79652,28 +79652,28 @@ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ p->rc = rc; } if( p->pDestDb ){ - sqlite3_mutex_leave(p->pDestDb->mutex); + tdsqlite3_mutex_leave(p->pDestDb->mutex); } - sqlite3BtreeLeave(p->pSrc); - sqlite3_mutex_leave(p->pSrcDb->mutex); + tdsqlite3BtreeLeave(p->pSrc); + tdsqlite3_mutex_leave(p->pSrcDb->mutex); return rc; } /* -** Release all resources associated with an sqlite3_backup* handle. +** Release all resources associated with an tdsqlite3_backup* handle. */ -SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p){ - sqlite3_backup **pp; /* Ptr to head of pagers backup list */ - sqlite3 *pSrcDb; /* Source database connection */ +SQLITE_API int tdsqlite3_backup_finish(tdsqlite3_backup *p){ + tdsqlite3_backup **pp; /* Ptr to head of pagers backup list */ + tdsqlite3 *pSrcDb; /* Source database connection */ int rc; /* Value to return */ /* Enter the mutexes */ if( p==0 ) return SQLITE_OK; pSrcDb = p->pSrcDb; - sqlite3_mutex_enter(pSrcDb->mutex); - sqlite3BtreeEnter(p->pSrc); + tdsqlite3_mutex_enter(pSrcDb->mutex); + tdsqlite3BtreeEnter(p->pSrc); if( p->pDestDb ){ - sqlite3_mutex_enter(p->pDestDb->mutex); + tdsqlite3_mutex_enter(p->pDestDb->mutex); } /* Detach this backup from the source pager. */ @@ -79681,7 +79681,7 @@ SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p){ p->pSrc->nBackup--; } if( p->isAttached ){ - pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc)); + pp = tdsqlite3PagerBackupPtr(tdsqlite3BtreePager(p->pSrc)); assert( pp!=0 ); while( *pp!=p ){ pp = &(*pp)->pNext; @@ -79691,32 +79691,32 @@ SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p){ } /* If a transaction is still open on the Btree, roll it back. */ - sqlite3BtreeRollback(p->pDest, SQLITE_OK, 0); + tdsqlite3BtreeRollback(p->pDest, SQLITE_OK, 0); /* Set the error code of the destination database handle. */ rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc; if( p->pDestDb ){ - sqlite3Error(p->pDestDb, rc); + tdsqlite3Error(p->pDestDb, rc); /* Exit the mutexes and free the backup context structure. */ - sqlite3LeaveMutexAndCloseZombie(p->pDestDb); + tdsqlite3LeaveMutexAndCloseZombie(p->pDestDb); } - sqlite3BtreeLeave(p->pSrc); + tdsqlite3BtreeLeave(p->pSrc); if( p->pDestDb ){ - /* EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a - ** call to sqlite3_backup_init() and is destroyed by a call to - ** sqlite3_backup_finish(). */ - sqlite3_free(p); + /* EVIDENCE-OF: R-64852-21591 The tdsqlite3_backup object is created by a + ** call to tdsqlite3_backup_init() and is destroyed by a call to + ** tdsqlite3_backup_finish(). */ + tdsqlite3_free(p); } - sqlite3LeaveMutexAndCloseZombie(pSrcDb); + tdsqlite3LeaveMutexAndCloseZombie(pSrcDb); return rc; } /* ** Return the number of pages still to be backed up as of the most recent -** call to sqlite3_backup_step(). +** call to tdsqlite3_backup_step(). */ -SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p){ +SQLITE_API int tdsqlite3_backup_remaining(tdsqlite3_backup *p){ #ifdef SQLITE_ENABLE_API_ARMOR if( p==0 ){ (void)SQLITE_MISUSE_BKPT; @@ -79728,9 +79728,9 @@ SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p){ /* ** Return the total number of pages in the source database as of the most -** recent call to sqlite3_backup_step(). +** recent call to tdsqlite3_backup_step(). */ -SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p){ +SQLITE_API int tdsqlite3_backup_pagecount(tdsqlite3_backup *p){ #ifdef SQLITE_ENABLE_API_ARMOR if( p==0 ){ (void)SQLITE_MISUSE_BKPT; @@ -79753,13 +79753,13 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p){ ** called. */ static SQLITE_NOINLINE void backupUpdate( - sqlite3_backup *p, + tdsqlite3_backup *p, Pgno iPage, const u8 *aData ){ assert( p!=0 ); do{ - assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) ); + assert( tdsqlite3_mutex_held(p->pSrc->pBt->mutex) ); if( !isFatalError(p->rc) && iPageiNext ){ /* The backup process p has already copied page iPage. But now it ** has been modified by a transaction on the source pager. Copy @@ -79767,9 +79767,9 @@ static SQLITE_NOINLINE void backupUpdate( */ int rc; assert( p->pDestDb ); - sqlite3_mutex_enter(p->pDestDb->mutex); + tdsqlite3_mutex_enter(p->pDestDb->mutex); rc = backupOnePage(p, iPage, aData, 1); - sqlite3_mutex_leave(p->pDestDb->mutex); + tdsqlite3_mutex_leave(p->pDestDb->mutex); assert( rc!=SQLITE_BUSY && rc!=SQLITE_LOCKED ); if( rc!=SQLITE_OK ){ p->rc = rc; @@ -79777,7 +79777,7 @@ static SQLITE_NOINLINE void backupUpdate( } }while( (p = p->pNext)!=0 ); } -SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *pBackup, Pgno iPage, const u8 *aData){ +SQLITE_PRIVATE void tdsqlite3BackupUpdate(tdsqlite3_backup *pBackup, Pgno iPage, const u8 *aData){ if( pBackup ) backupUpdate(pBackup, iPage, aData); } @@ -79792,10 +79792,10 @@ SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *pBackup, Pgno iPage, con ** corresponding to the source database is held when this function is ** called. */ -SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *pBackup){ - sqlite3_backup *p; /* Iterator variable */ +SQLITE_PRIVATE void tdsqlite3BackupRestart(tdsqlite3_backup *pBackup){ + tdsqlite3_backup *p; /* Iterator variable */ for(p=pBackup; p; p=p->pNext){ - assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) ); + assert( tdsqlite3_mutex_held(p->pSrc->pBt->mutex) ); p->iNext = 1; } } @@ -79809,25 +79809,25 @@ SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *pBackup){ ** goes wrong, the transaction on pTo is rolled back. If successful, the ** transaction is committed before returning. */ -SQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){ +SQLITE_PRIVATE int tdsqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){ int rc; - sqlite3_file *pFd; /* File descriptor for database pTo */ - sqlite3_backup b; - sqlite3BtreeEnter(pTo); - sqlite3BtreeEnter(pFrom); + tdsqlite3_file *pFd; /* File descriptor for database pTo */ + tdsqlite3_backup b; + tdsqlite3BtreeEnter(pTo); + tdsqlite3BtreeEnter(pFrom); - assert( sqlite3BtreeIsInTrans(pTo) ); - pFd = sqlite3PagerFile(sqlite3BtreePager(pTo)); + assert( tdsqlite3BtreeIsInTrans(pTo) ); + pFd = tdsqlite3PagerFile(tdsqlite3BtreePager(pTo)); if( pFd->pMethods ){ - i64 nByte = sqlite3BtreeGetPageSize(pFrom)*(i64)sqlite3BtreeLastPage(pFrom); - rc = sqlite3OsFileControl(pFd, SQLITE_FCNTL_OVERWRITE, &nByte); + i64 nByte = tdsqlite3BtreeGetPageSize(pFrom)*(i64)tdsqlite3BtreeLastPage(pFrom); + rc = tdsqlite3OsFileControl(pFd, SQLITE_FCNTL_OVERWRITE, &nByte); if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK; if( rc ) goto copy_finished; } - /* Set up an sqlite3_backup object. sqlite3_backup.pDestDb must be set - ** to 0. This is used by the implementations of sqlite3_backup_step() - ** and sqlite3_backup_finish() to detect that they are being called + /* Set up an tdsqlite3_backup object. tdsqlite3_backup.pDestDb must be set + ** to 0. This is used by the implementations of tdsqlite3_backup_step() + ** and tdsqlite3_backup_finish() to detect that they are being called ** from this function, not directly by the user. */ memset(&b, 0, sizeof(b)); @@ -79837,29 +79837,29 @@ SQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){ b.iNext = 1; #ifdef SQLITE_HAS_CODEC - sqlite3PagerAlignReserve(sqlite3BtreePager(pTo), sqlite3BtreePager(pFrom)); + tdsqlite3PagerAlignReserve(tdsqlite3BtreePager(pTo), tdsqlite3BtreePager(pFrom)); #endif /* 0x7FFFFFFF is the hard limit for the number of pages in a database ** file. By passing this as the number of pages to copy to - ** sqlite3_backup_step(), we can guarantee that the copy finishes + ** tdsqlite3_backup_step(), we can guarantee that the copy finishes ** within a single call (unless an error occurs). The assert() statement ** checks this assumption - (p->rc) should be set to either SQLITE_DONE ** or an error code. */ - sqlite3_backup_step(&b, 0x7FFFFFFF); + tdsqlite3_backup_step(&b, 0x7FFFFFFF); assert( b.rc!=SQLITE_OK ); - rc = sqlite3_backup_finish(&b); + rc = tdsqlite3_backup_finish(&b); if( rc==SQLITE_OK ){ pTo->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED; }else{ - sqlite3PagerClearCache(sqlite3BtreePager(b.pDest)); + tdsqlite3PagerClearCache(tdsqlite3BtreePager(b.pDest)); } - assert( sqlite3BtreeIsInTrans(pTo)==0 ); + assert( tdsqlite3BtreeIsInTrans(pTo)==0 ); copy_finished: - sqlite3BtreeLeave(pFrom); - sqlite3BtreeLeave(pTo); + tdsqlite3BtreeLeave(pFrom); + tdsqlite3BtreeLeave(pTo); return rc; } #endif /* SQLITE_OMIT_VACUUM */ @@ -79896,9 +79896,9 @@ copy_finished: ** Check invariants on a Mem object. ** ** This routine is intended for use inside of assert() statements, like -** this: assert( sqlite3VdbeCheckMemInvariants(pMem) ); +** this: assert( tdsqlite3VdbeCheckMemInvariants(pMem) ); */ -SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem *p){ +SQLITE_PRIVATE int tdsqlite3VdbeCheckMemInvariants(Mem *p){ /* If MEM_Dyn is set then Mem.xDel!=0. ** Mem.xDel might not be initialized if MEM_Dyn is clear. */ @@ -79918,8 +79918,8 @@ SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem *p){ assert( (p->flags & (MEM_Int|MEM_Real|MEM_Str|MEM_Blob|MEM_Agg))==0 ); /* If MEM_Null is set, then either the value is a pure NULL (the usual - ** case) or it is a pointer set using sqlite3_bind_pointer() or - ** sqlite3_result_pointer(). If a pointer, then MEM_Term must also be + ** case) or it is a pointer set using tdsqlite3_bind_pointer() or + ** tdsqlite3_result_pointer(). If a pointer, then MEM_Term must also be ** set. */ if( (p->flags & (MEM_Term|MEM_Subtype))==(MEM_Term|MEM_Subtype) ){ @@ -79943,7 +79943,7 @@ SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem *p){ /* The szMalloc field holds the correct memory allocation size */ assert( p->szMalloc==0 - || p->szMalloc==sqlite3DbMallocSize(p->db,p->zMalloc) ); + || p->szMalloc==tdsqlite3DbMallocSize(p->db,p->zMalloc) ); /* If p holds a string or blob, the Mem.z must point to exactly ** one of the following: @@ -79972,16 +79972,16 @@ SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem *p){ static void vdbeMemRenderNum(int sz, char *zBuf, Mem *p){ StrAccum acc; assert( p->flags & (MEM_Int|MEM_Real|MEM_IntReal) ); - sqlite3StrAccumInit(&acc, 0, zBuf, sz, 0); + tdsqlite3StrAccumInit(&acc, 0, zBuf, sz, 0); if( p->flags & MEM_Int ){ - sqlite3_str_appendf(&acc, "%lld", p->u.i); + tdsqlite3_str_appendf(&acc, "%lld", p->u.i); }else if( p->flags & MEM_IntReal ){ - sqlite3_str_appendf(&acc, "%!.15g", (double)p->u.i); + tdsqlite3_str_appendf(&acc, "%!.15g", (double)p->u.i); }else{ - sqlite3_str_appendf(&acc, "%!.15g", p->u.r); + tdsqlite3_str_appendf(&acc, "%!.15g", p->u.r); } assert( acc.zText==zBuf && acc.mxAlloc<=0 ); - zBuf[acc.nChar] = 0; /* Fast version of sqlite3StrAccumFinish(&acc) */ + zBuf[acc.nChar] = 0; /* Fast version of tdsqlite3StrAccumFinish(&acc) */ } #ifdef SQLITE_DEBUG @@ -80007,7 +80007,7 @@ static void vdbeMemRenderNum(int sz, char *zBuf, Mem *p){ ** ** This routine is for use inside of assert() statements only. */ -SQLITE_PRIVATE int sqlite3VdbeMemValidStrRep(Mem *p){ +SQLITE_PRIVATE int tdsqlite3VdbeMemValidStrRep(Mem *p){ char zBuf[100]; char *z; int i, j, incr; @@ -80053,17 +80053,17 @@ SQLITE_PRIVATE int sqlite3VdbeMemValidStrRep(Mem *p){ ** SQLITE_NOMEM may be returned if a malloc() fails during conversion ** between formats. */ -SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){ +SQLITE_PRIVATE int tdsqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){ #ifndef SQLITE_OMIT_UTF16 int rc; #endif - assert( !sqlite3VdbeMemIsRowSet(pMem) ); + assert( !tdsqlite3VdbeMemIsRowSet(pMem) ); assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE || desiredEnc==SQLITE_UTF16BE ); if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){ return SQLITE_OK; } - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); #ifdef SQLITE_OMIT_UTF16 return SQLITE_ERROR; #else @@ -80071,7 +80071,7 @@ SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){ /* MemTranslate() may return SQLITE_OK or SQLITE_NOMEM. If NOMEM is returned, ** then the encoding of the value may not have changed. */ - rc = sqlite3VdbeMemTranslate(pMem, (u8)desiredEnc); + rc = tdsqlite3VdbeMemTranslate(pMem, (u8)desiredEnc); assert(rc==SQLITE_OK || rc==SQLITE_NOMEM); assert(rc==SQLITE_OK || pMem->enc!=desiredEnc); assert(rc==SQLITE_NOMEM || pMem->enc==desiredEnc); @@ -80087,9 +80087,9 @@ SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){ ** blob if bPreserve is true. If bPreserve is false, any prior content ** in pMem->z is discarded. */ -SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPreserve){ - assert( sqlite3VdbeCheckMemInvariants(pMem) ); - assert( !sqlite3VdbeMemIsRowSet(pMem) ); +SQLITE_PRIVATE SQLITE_NOINLINE int tdsqlite3VdbeMemGrow(Mem *pMem, int n, int bPreserve){ + assert( tdsqlite3VdbeCheckMemInvariants(pMem) ); + assert( !tdsqlite3VdbeMemIsRowSet(pMem) ); testcase( pMem->db==0 ); /* If the bPreserve flag is set to true, then the memory cell must already @@ -80098,27 +80098,27 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPre testcase( bPreserve && pMem->z==0 ); assert( pMem->szMalloc==0 - || pMem->szMalloc==sqlite3DbMallocSize(pMem->db, pMem->zMalloc) ); + || pMem->szMalloc==tdsqlite3DbMallocSize(pMem->db, pMem->zMalloc) ); if( pMem->szMalloc>0 && bPreserve && pMem->z==pMem->zMalloc ){ if( pMem->db ){ - pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n); + pMem->z = pMem->zMalloc = tdsqlite3DbReallocOrFree(pMem->db, pMem->z, n); }else{ - pMem->zMalloc = sqlite3Realloc(pMem->z, n); - if( pMem->zMalloc==0 ) sqlite3_free(pMem->z); + pMem->zMalloc = tdsqlite3Realloc(pMem->z, n); + if( pMem->zMalloc==0 ) tdsqlite3_free(pMem->z); pMem->z = pMem->zMalloc; } bPreserve = 0; }else{ - if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc); - pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n); + if( pMem->szMalloc>0 ) tdsqlite3DbFreeNN(pMem->db, pMem->zMalloc); + pMem->zMalloc = tdsqlite3DbMallocRaw(pMem->db, n); } if( pMem->zMalloc==0 ){ - sqlite3VdbeMemSetNull(pMem); + tdsqlite3VdbeMemSetNull(pMem); pMem->z = 0; pMem->szMalloc = 0; return SQLITE_NOMEM_BKPT; }else{ - pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc); + pMem->szMalloc = tdsqlite3DbMallocSize(pMem->db, pMem->zMalloc); } if( bPreserve && pMem->z ){ @@ -80148,11 +80148,11 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPre ** Return SQLITE_OK on success or an error code (probably SQLITE_NOMEM) ** if unable to complete the resizing. */ -SQLITE_PRIVATE int sqlite3VdbeMemClearAndResize(Mem *pMem, int szNew){ +SQLITE_PRIVATE int tdsqlite3VdbeMemClearAndResize(Mem *pMem, int szNew){ assert( CORRUPT_DB || szNew>0 ); assert( (pMem->flags & MEM_Dyn)==0 || pMem->szMalloc==0 ); if( pMem->szMallocflags & MEM_Dyn)==0 ); pMem->z = pMem->zMalloc; @@ -80170,7 +80170,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemClearAndResize(Mem *pMem, int szNew){ ** is an odd number of bytes. */ static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){ - if( sqlite3VdbeMemGrow(pMem, pMem->n+3, 1) ){ + if( tdsqlite3VdbeMemGrow(pMem, pMem->n+3, 1) ){ return SQLITE_NOMEM_BKPT; } pMem->z[pMem->n] = 0; @@ -80186,9 +80186,9 @@ static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){ ** ** Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails. */ -SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){ - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - assert( !sqlite3VdbeMemIsRowSet(pMem) ); +SQLITE_PRIVATE int tdsqlite3VdbeMemMakeWriteable(Mem *pMem){ + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); + assert( !tdsqlite3VdbeMemIsRowSet(pMem) ); if( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ){ if( ExpandBlob(pMem) ) return SQLITE_NOMEM; if( pMem->szMalloc==0 || pMem->z!=pMem->zMalloc ){ @@ -80209,13 +80209,13 @@ SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){ ** blob stored in dynamically allocated space. */ #ifndef SQLITE_OMIT_INCRBLOB -SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){ +SQLITE_PRIVATE int tdsqlite3VdbeMemExpandBlob(Mem *pMem){ int nByte; assert( pMem->flags & MEM_Zero ); assert( (pMem->flags&MEM_Blob)!=0 || MemNullNochng(pMem) ); - testcase( sqlite3_value_nochange(pMem) ); - assert( !sqlite3VdbeMemIsRowSet(pMem) ); - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); + testcase( tdsqlite3_value_nochange(pMem) ); + assert( !tdsqlite3VdbeMemIsRowSet(pMem) ); + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); /* Set nByte to the number of bytes required to store the expanded blob. */ nByte = pMem->n + pMem->u.nZero; @@ -80223,7 +80223,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){ if( (pMem->flags & MEM_Blob)==0 ) return SQLITE_OK; nByte = 1; } - if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){ + if( tdsqlite3VdbeMemGrow(pMem, nByte, 1) ){ return SQLITE_NOMEM_BKPT; } @@ -80237,8 +80237,8 @@ SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){ /* ** Make sure the given Mem is \u0000 terminated. */ -SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){ - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); +SQLITE_PRIVATE int tdsqlite3VdbeMemNulTerminate(Mem *pMem){ + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); testcase( (pMem->flags & (MEM_Term|MEM_Str))==(MEM_Term|MEM_Str) ); testcase( (pMem->flags & (MEM_Term|MEM_Str))==0 ); if( (pMem->flags & (MEM_Term|MEM_Str))!=MEM_Str ){ @@ -80258,33 +80258,33 @@ SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){ ** ** A MEM_Null value will never be passed to this function. This function is ** used for converting values to text for returning to the user (i.e. via -** sqlite3_value_text()), or for ensuring that values to be used as btree +** tdsqlite3_value_text()), or for ensuring that values to be used as btree ** keys are strings. In the former case a NULL pointer is returned the ** user and the latter is an internal programming error. */ -SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){ +SQLITE_PRIVATE int tdsqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){ const int nByte = 32; - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); assert( !(pMem->flags&MEM_Zero) ); assert( !(pMem->flags&(MEM_Str|MEM_Blob)) ); assert( pMem->flags&(MEM_Int|MEM_Real|MEM_IntReal) ); - assert( !sqlite3VdbeMemIsRowSet(pMem) ); + assert( !tdsqlite3VdbeMemIsRowSet(pMem) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); - if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){ + if( tdsqlite3VdbeMemClearAndResize(pMem, nByte) ){ pMem->enc = 0; return SQLITE_NOMEM_BKPT; } vdbeMemRenderNum(nByte, pMem->z, pMem); assert( pMem->z!=0 ); - pMem->n = sqlite3Strlen30NN(pMem->z); + pMem->n = tdsqlite3Strlen30NN(pMem->z); pMem->enc = SQLITE_UTF8; pMem->flags |= MEM_Str|MEM_Term; if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal); - sqlite3VdbeChangeEncoding(pMem, enc); + tdsqlite3VdbeChangeEncoding(pMem, enc); return SQLITE_OK; } @@ -80296,13 +80296,13 @@ SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){ ** Return SQLITE_ERROR if the finalizer reports an error. SQLITE_OK ** otherwise. */ -SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){ - sqlite3_context ctx; +SQLITE_PRIVATE int tdsqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){ + tdsqlite3_context ctx; Mem t; assert( pFunc!=0 ); assert( pFunc->xFinalize!=0 ); assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef ); - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); memset(&ctx, 0, sizeof(ctx)); memset(&t, 0, sizeof(t)); t.flags = MEM_Null; @@ -80312,7 +80312,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){ ctx.pFunc = pFunc; pFunc->xFinalize(&ctx); /* IMP: R-24505-23230 */ assert( (pMem->flags & MEM_Dyn)==0 ); - if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc); + if( pMem->szMalloc>0 ) tdsqlite3DbFreeNN(pMem->db, pMem->zMalloc); memcpy(pMem, &t, sizeof(t)); return ctx.isError; } @@ -80326,14 +80326,14 @@ SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){ ** otherwise. */ #ifndef SQLITE_OMIT_WINDOWFUNC -SQLITE_PRIVATE int sqlite3VdbeMemAggValue(Mem *pAccum, Mem *pOut, FuncDef *pFunc){ - sqlite3_context ctx; +SQLITE_PRIVATE int tdsqlite3VdbeMemAggValue(Mem *pAccum, Mem *pOut, FuncDef *pFunc){ + tdsqlite3_context ctx; assert( pFunc!=0 ); assert( pFunc->xValue!=0 ); assert( (pAccum->flags & MEM_Null)!=0 || pFunc==pAccum->u.pDef ); - assert( pAccum->db==0 || sqlite3_mutex_held(pAccum->db->mutex) ); + assert( pAccum->db==0 || tdsqlite3_mutex_held(pAccum->db->mutex) ); memset(&ctx, 0, sizeof(ctx)); - sqlite3VdbeMemSetNull(pOut); + tdsqlite3VdbeMemSetNull(pOut); ctx.pOut = pOut; ctx.pMem = pAccum; ctx.pFunc = pFunc; @@ -80347,15 +80347,15 @@ SQLITE_PRIVATE int sqlite3VdbeMemAggValue(Mem *pAccum, Mem *pOut, FuncDef *pFunc ** invoking the external callback in Mem.xDel, then this routine ** will free that value. It also sets Mem.flags to MEM_Null. ** -** This is a helper routine for sqlite3VdbeMemSetNull() and -** for sqlite3VdbeMemRelease(). Use those other routines as the +** This is a helper routine for tdsqlite3VdbeMemSetNull() and +** for tdsqlite3VdbeMemRelease(). Use those other routines as the ** entry point for releasing Mem resources. */ static SQLITE_NOINLINE void vdbeMemClearExternAndSetNull(Mem *p){ - assert( p->db==0 || sqlite3_mutex_held(p->db->mutex) ); + assert( p->db==0 || tdsqlite3_mutex_held(p->db->mutex) ); assert( VdbeMemDynamic(p) ); if( p->flags&MEM_Agg ){ - sqlite3VdbeMemFinalize(p, p->u.pDef); + tdsqlite3VdbeMemFinalize(p, p->u.pDef); assert( (p->flags & MEM_Agg)==0 ); testcase( p->flags & MEM_Dyn ); } @@ -80370,7 +80370,7 @@ static SQLITE_NOINLINE void vdbeMemClearExternAndSetNull(Mem *p){ ** Release memory held by the Mem p, both external memory cleared ** by p->xDel and memory in p->zMalloc. ** -** This is a helper routine invoked by sqlite3VdbeMemRelease() in +** This is a helper routine invoked by tdsqlite3VdbeMemRelease() in ** the unusual case where there really is memory in p that needs ** to be freed. */ @@ -80379,7 +80379,7 @@ static SQLITE_NOINLINE void vdbeMemClear(Mem *p){ vdbeMemClearExternAndSetNull(p); } if( p->szMalloc ){ - sqlite3DbFreeNN(p->db, p->zMalloc); + tdsqlite3DbFreeNN(p->db, p->zMalloc); p->szMalloc = 0; } p->z = 0; @@ -80392,11 +80392,11 @@ static SQLITE_NOINLINE void vdbeMemClear(Mem *p){ ** Use this routine prior to clean up prior to abandoning a Mem, or to ** reset a Mem back to its minimum memory utilization. ** -** Use sqlite3VdbeMemSetNull() to release just the Mem.xDel space +** Use tdsqlite3VdbeMemSetNull() to release just the Mem.xDel space ** prior to inserting new content into the Mem. */ -SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p){ - assert( sqlite3VdbeCheckMemInvariants(p) ); +SQLITE_PRIVATE void tdsqlite3VdbeMemRelease(Mem *p){ + assert( tdsqlite3VdbeCheckMemInvariants(p) ); if( VdbeMemDynamic(p) || p->szMalloc ){ vdbeMemClear(p); } @@ -80445,12 +80445,12 @@ static SQLITE_NOINLINE i64 doubleToInt64(double r){ */ static SQLITE_NOINLINE i64 memIntValue(Mem *pMem){ i64 value = 0; - sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc); + tdsqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc); return value; } -SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){ +SQLITE_PRIVATE i64 tdsqlite3VdbeIntValue(Mem *pMem){ int flags; - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); flags = pMem->flags; if( flags & (MEM_Int|MEM_IntReal) ){ @@ -80474,11 +80474,11 @@ SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){ static SQLITE_NOINLINE double memRealValue(Mem *pMem){ /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ double val = (double)0; - sqlite3AtoF(pMem->z, &val, pMem->n, pMem->enc); + tdsqlite3AtoF(pMem->z, &val, pMem->n, pMem->enc); return val; } -SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){ - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); +SQLITE_PRIVATE double tdsqlite3VdbeRealValue(Mem *pMem){ + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); if( pMem->flags & MEM_Real ){ return pMem->u.r; @@ -80497,22 +80497,22 @@ SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){ ** Return 1 if pMem represents true, and return 0 if pMem represents false. ** Return the value ifNull if pMem is NULL. */ -SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem *pMem, int ifNull){ +SQLITE_PRIVATE int tdsqlite3VdbeBooleanValue(Mem *pMem, int ifNull){ testcase( pMem->flags & MEM_IntReal ); if( pMem->flags & (MEM_Int|MEM_IntReal) ) return pMem->u.i!=0; if( pMem->flags & MEM_Null ) return ifNull; - return sqlite3VdbeRealValue(pMem)!=0.0; + return tdsqlite3VdbeRealValue(pMem)!=0.0; } /* ** The MEM structure is already a MEM_Real. Try to also make it a ** MEM_Int if we can. */ -SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem *pMem){ +SQLITE_PRIVATE void tdsqlite3VdbeIntegerAffinity(Mem *pMem){ i64 ix; assert( pMem->flags & MEM_Real ); - assert( !sqlite3VdbeMemIsRowSet(pMem) ); - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); + assert( !tdsqlite3VdbeMemIsRowSet(pMem) ); + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); ix = doubleToInt64(pMem->u.r); @@ -80536,12 +80536,12 @@ SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem *pMem){ /* ** Convert pMem to type integer. Invalidate any prior representations. */ -SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem *pMem){ - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - assert( !sqlite3VdbeMemIsRowSet(pMem) ); +SQLITE_PRIVATE int tdsqlite3VdbeMemIntegerify(Mem *pMem){ + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); + assert( !tdsqlite3VdbeMemIsRowSet(pMem) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); - pMem->u.i = sqlite3VdbeIntValue(pMem); + pMem->u.i = tdsqlite3VdbeIntValue(pMem); MemSetTypeFlag(pMem, MEM_Int); return SQLITE_OK; } @@ -80550,11 +80550,11 @@ SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem *pMem){ ** Convert pMem so that it is of type MEM_Real. ** Invalidate any prior representations. */ -SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem *pMem){ - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); +SQLITE_PRIVATE int tdsqlite3VdbeMemRealify(Mem *pMem){ + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); - pMem->u.r = sqlite3VdbeRealValue(pMem); + pMem->u.r = tdsqlite3VdbeRealValue(pMem); MemSetTypeFlag(pMem, MEM_Real); return SQLITE_OK; } @@ -80568,7 +80568,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem *pMem){ ** comparison of "r1==(double)i" you sometimes get an answer of false even ** though the r1 and (double)i values are bit-for-bit the same. */ -SQLITE_PRIVATE int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){ +SQLITE_PRIVATE int tdsqlite3RealSameAsInt(double r1, tdsqlite3_int64 i){ double r2 = (double)i; return r1==0.0 || (memcmp(&r1, &r2, sizeof(r1))==0 @@ -80583,19 +80583,19 @@ SQLITE_PRIVATE int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){ ** is a string that does not look completely like a number. Convert ** as much of the string as we can and ignore the rest. */ -SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){ +SQLITE_PRIVATE int tdsqlite3VdbeMemNumerify(Mem *pMem){ testcase( pMem->flags & MEM_Int ); testcase( pMem->flags & MEM_Real ); testcase( pMem->flags & MEM_IntReal ); testcase( pMem->flags & MEM_Null ); if( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Null))==0 ){ int rc; - sqlite3_int64 ix; + tdsqlite3_int64 ix; assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 ); - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - rc = sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc); - if( ((rc==0 || rc==1) && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)<=1) - || sqlite3RealSameAsInt(pMem->u.r, (ix = (i64)pMem->u.r)) + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); + rc = tdsqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc); + if( ((rc==0 || rc==1) && tdsqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)<=1) + || tdsqlite3RealSameAsInt(pMem->u.r, (ix = (i64)pMem->u.r)) ){ pMem->u.i = ix; MemSetTypeFlag(pMem, MEM_Int); @@ -80615,12 +80615,12 @@ SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){ ** affinity even if that results in loss of data. This routine is ** used (for example) to implement the SQL "cast()" operator. */ -SQLITE_PRIVATE int sqlite3VdbeMemCast(Mem *pMem, u8 aff, u8 encoding){ +SQLITE_PRIVATE int tdsqlite3VdbeMemCast(Mem *pMem, u8 aff, u8 encoding){ if( pMem->flags & MEM_Null ) return SQLITE_OK; switch( aff ){ case SQLITE_AFF_BLOB: { /* Really a cast to BLOB */ if( (pMem->flags & MEM_Blob)==0 ){ - sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding); + tdsqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding); assert( pMem->flags & MEM_Str || pMem->db->mallocFailed ); if( pMem->flags & MEM_Str ) MemSetTypeFlag(pMem, MEM_Blob); }else{ @@ -80629,25 +80629,25 @@ SQLITE_PRIVATE int sqlite3VdbeMemCast(Mem *pMem, u8 aff, u8 encoding){ break; } case SQLITE_AFF_NUMERIC: { - sqlite3VdbeMemNumerify(pMem); + tdsqlite3VdbeMemNumerify(pMem); break; } case SQLITE_AFF_INTEGER: { - sqlite3VdbeMemIntegerify(pMem); + tdsqlite3VdbeMemIntegerify(pMem); break; } case SQLITE_AFF_REAL: { - sqlite3VdbeMemRealify(pMem); + tdsqlite3VdbeMemRealify(pMem); break; } default: { assert( aff==SQLITE_AFF_TEXT ); assert( MEM_Str==(MEM_Blob>>3) ); pMem->flags |= (pMem->flags&MEM_Blob)>>3; - sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding); + tdsqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding); assert( pMem->flags & MEM_Str || pMem->db->mallocFailed ); pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal|MEM_Blob|MEM_Zero); - return sqlite3VdbeChangeEncoding(pMem, encoding); + return tdsqlite3VdbeChangeEncoding(pMem, encoding); } } return SQLITE_OK; @@ -80658,7 +80658,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemCast(Mem *pMem, u8 aff, u8 encoding){ ** ** The minimum amount of initialization feasible is performed. */ -SQLITE_PRIVATE void sqlite3VdbeMemInit(Mem *pMem, sqlite3 *db, u16 flags){ +SQLITE_PRIVATE void tdsqlite3VdbeMemInit(Mem *pMem, tdsqlite3 *db, u16 flags){ assert( (flags & ~MEM_TypeMask)==0 ); pMem->flags = flags; pMem->db = db; @@ -80671,30 +80671,30 @@ SQLITE_PRIVATE void sqlite3VdbeMemInit(Mem *pMem, sqlite3 *db, u16 flags){ ** ** This routine calls the Mem.xDel destructor to dispose of values that ** require the destructor. But it preserves the Mem.zMalloc memory allocation. -** To free all resources, use sqlite3VdbeMemRelease(), which both calls this +** To free all resources, use tdsqlite3VdbeMemRelease(), which both calls this ** routine to invoke the destructor and deallocates Mem.zMalloc. ** ** Use this routine to reset the Mem prior to insert a new value. ** -** Use sqlite3VdbeMemRelease() to complete erase the Mem prior to abandoning it. +** Use tdsqlite3VdbeMemRelease() to complete erase the Mem prior to abandoning it. */ -SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem *pMem){ +SQLITE_PRIVATE void tdsqlite3VdbeMemSetNull(Mem *pMem){ if( VdbeMemDynamic(pMem) ){ vdbeMemClearExternAndSetNull(pMem); }else{ pMem->flags = MEM_Null; } } -SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value *p){ - sqlite3VdbeMemSetNull((Mem*)p); +SQLITE_PRIVATE void tdsqlite3ValueSetNull(tdsqlite3_value *p){ + tdsqlite3VdbeMemSetNull((Mem*)p); } /* ** Delete any previous value and set the value to be a BLOB of length ** n containing all zeros. */ -SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){ - sqlite3VdbeMemRelease(pMem); +SQLITE_PRIVATE void tdsqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){ + tdsqlite3VdbeMemRelease(pMem); pMem->flags = MEM_Blob|MEM_Zero; pMem->n = 0; if( n<0 ) n = 0; @@ -80709,7 +80709,7 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){ ** a 64-bit integer. */ static SQLITE_NOINLINE void vdbeReleaseAndSetInt64(Mem *pMem, i64 val){ - sqlite3VdbeMemSetNull(pMem); + tdsqlite3VdbeMemSetNull(pMem); pMem->u.i = val; pMem->flags = MEM_Int; } @@ -80718,7 +80718,7 @@ static SQLITE_NOINLINE void vdbeReleaseAndSetInt64(Mem *pMem, i64 val){ ** Delete any previous value and set the value stored in *pMem to val, ** manifest type INTEGER. */ -SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){ +SQLITE_PRIVATE void tdsqlite3VdbeMemSetInt64(Mem *pMem, i64 val){ if( VdbeMemDynamic(pMem) ){ vdbeReleaseAndSetInt64(pMem, val); }else{ @@ -80728,13 +80728,13 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){ } /* A no-op destructor */ -SQLITE_PRIVATE void sqlite3NoopDestructor(void *p){ UNUSED_PARAMETER(p); } +SQLITE_PRIVATE void tdsqlite3NoopDestructor(void *p){ UNUSED_PARAMETER(p); } /* ** Set the value stored in *pMem should already be a NULL. ** Also store a pointer to go with it. */ -SQLITE_PRIVATE void sqlite3VdbeMemSetPointer( +SQLITE_PRIVATE void tdsqlite3VdbeMemSetPointer( Mem *pMem, void *pPtr, const char *zPType, @@ -80745,7 +80745,7 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetPointer( pMem->z = pPtr; pMem->flags = MEM_Null|MEM_Dyn|MEM_Subtype|MEM_Term; pMem->eSubtype = 'p'; - pMem->xDel = xDestructor ? xDestructor : sqlite3NoopDestructor; + pMem->xDel = xDestructor ? xDestructor : tdsqlite3NoopDestructor; } #ifndef SQLITE_OMIT_FLOATING_POINT @@ -80753,9 +80753,9 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetPointer( ** Delete any previous value and set the value stored in *pMem to val, ** manifest type REAL. */ -SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem *pMem, double val){ - sqlite3VdbeMemSetNull(pMem); - if( !sqlite3IsNaN(val) ){ +SQLITE_PRIVATE void tdsqlite3VdbeMemSetDouble(Mem *pMem, double val){ + tdsqlite3VdbeMemSetNull(pMem); + if( !tdsqlite3IsNaN(val) ){ pMem->u.r = val; pMem->flags = MEM_Real; } @@ -80767,9 +80767,9 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem *pMem, double val){ ** Return true if the Mem holds a RowSet object. This routine is intended ** for use inside of assert() statements. */ -SQLITE_PRIVATE int sqlite3VdbeMemIsRowSet(const Mem *pMem){ +SQLITE_PRIVATE int tdsqlite3VdbeMemIsRowSet(const Mem *pMem){ return (pMem->flags&(MEM_Blob|MEM_Dyn))==(MEM_Blob|MEM_Dyn) - && pMem->xDel==sqlite3RowSetDelete; + && pMem->xDel==tdsqlite3RowSetDelete; } #endif @@ -80780,17 +80780,17 @@ SQLITE_PRIVATE int sqlite3VdbeMemIsRowSet(const Mem *pMem){ ** Return SQLITE_OK on success and SQLITE_NOMEM if a memory allocation ** error occurs. */ -SQLITE_PRIVATE int sqlite3VdbeMemSetRowSet(Mem *pMem){ - sqlite3 *db = pMem->db; +SQLITE_PRIVATE int tdsqlite3VdbeMemSetRowSet(Mem *pMem){ + tdsqlite3 *db = pMem->db; RowSet *p; assert( db!=0 ); - assert( !sqlite3VdbeMemIsRowSet(pMem) ); - sqlite3VdbeMemRelease(pMem); - p = sqlite3RowSetInit(db); + assert( !tdsqlite3VdbeMemIsRowSet(pMem) ); + tdsqlite3VdbeMemRelease(pMem); + p = tdsqlite3RowSetInit(db); if( p==0 ) return SQLITE_NOMEM; pMem->z = (char*)p; pMem->flags = MEM_Blob|MEM_Dyn; - pMem->xDel = sqlite3RowSetDelete; + pMem->xDel = tdsqlite3RowSetDelete; return SQLITE_OK; } @@ -80798,7 +80798,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetRowSet(Mem *pMem){ ** Return true if the Mem object contains a TEXT or BLOB that is ** too large - whose size exceeds SQLITE_MAX_LENGTH. */ -SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem *p){ +SQLITE_PRIVATE int tdsqlite3VdbeMemTooBig(Mem *p){ assert( p->db!=0 ); if( p->flags & (MEM_Str|MEM_Blob) ){ int n = p->n; @@ -80819,14 +80819,14 @@ SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem *p){ ** This is used for testing and debugging only - to help ensure that shallow ** copies (created by OP_SCopy) are not misused. */ -SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){ +SQLITE_PRIVATE void tdsqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){ int i; Mem *pX; for(i=1, pX=pVdbe->aMem+1; inMem; i++, pX++){ if( pX->pScopyFrom==pMem ){ u16 mFlags; if( pVdbe->db->flags & SQLITE_VdbeTrace ){ - sqlite3DebugPrintf("Invalidate R[%d] due to change in R[%d]\n", + tdsqlite3DebugPrintf("Invalidate R[%d] due to change in R[%d]\n", (int)(pX - pVdbe->aMem), (int)(pMem - pVdbe->aMem)); } /* If pX is marked as a shallow copy of pMem, then verify that @@ -80841,7 +80841,7 @@ SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){ /* ^^ */ /* Cannot reliably compare doubles for equality */ assert( (mFlags&MEM_Str)==0 || (pMem->n==pX->n && pMem->z==pX->z) ); - assert( (mFlags&MEM_Blob)==0 || sqlite3BlobCompare(pMem,pX)==0 ); + assert( (mFlags&MEM_Blob)==0 || tdsqlite3BlobCompare(pMem,pX)==0 ); /* pMem is the register that is changing. But also mark pX as ** undefined so that we can quickly detect the shallow-copy error */ @@ -80862,10 +80862,10 @@ SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){ static SQLITE_NOINLINE void vdbeClrCopy(Mem *pTo, const Mem *pFrom, int eType){ vdbeMemClearExternAndSetNull(pTo); assert( !VdbeMemDynamic(pTo) ); - sqlite3VdbeMemShallowCopy(pTo, pFrom, eType); + tdsqlite3VdbeMemShallowCopy(pTo, pFrom, eType); } -SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){ - assert( !sqlite3VdbeMemIsRowSet(pFrom) ); +SQLITE_PRIVATE void tdsqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){ + assert( !tdsqlite3VdbeMemIsRowSet(pFrom) ); assert( pTo->db==pFrom->db ); if( VdbeMemDynamic(pTo) ){ vdbeClrCopy(pTo,pFrom,srcType); return; } memcpy(pTo, pFrom, MEMCELLSIZE); @@ -80880,17 +80880,17 @@ SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int sr ** Make a full copy of pFrom into pTo. Prior contents of pTo are ** freed before the copy is made. */ -SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){ +SQLITE_PRIVATE int tdsqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){ int rc = SQLITE_OK; - assert( !sqlite3VdbeMemIsRowSet(pFrom) ); + assert( !tdsqlite3VdbeMemIsRowSet(pFrom) ); if( VdbeMemDynamic(pTo) ) vdbeMemClearExternAndSetNull(pTo); memcpy(pTo, pFrom, MEMCELLSIZE); pTo->flags &= ~MEM_Dyn; if( pTo->flags&(MEM_Str|MEM_Blob) ){ if( 0==(pFrom->flags&MEM_Static) ){ pTo->flags |= MEM_Ephem; - rc = sqlite3VdbeMemMakeWriteable(pTo); + rc = tdsqlite3VdbeMemMakeWriteable(pTo); } } @@ -80903,12 +80903,12 @@ SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){ ** ** pFrom contains an SQL NULL when this routine returns. */ -SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem *pTo, Mem *pFrom){ - assert( pFrom->db==0 || sqlite3_mutex_held(pFrom->db->mutex) ); - assert( pTo->db==0 || sqlite3_mutex_held(pTo->db->mutex) ); +SQLITE_PRIVATE void tdsqlite3VdbeMemMove(Mem *pTo, Mem *pFrom){ + assert( pFrom->db==0 || tdsqlite3_mutex_held(pFrom->db->mutex) ); + assert( pTo->db==0 || tdsqlite3_mutex_held(pTo->db->mutex) ); assert( pFrom->db==0 || pTo->db==0 || pFrom->db==pTo->db ); - sqlite3VdbeMemRelease(pTo); + tdsqlite3VdbeMemRelease(pTo); memcpy(pTo, pFrom, sizeof(Mem)); pFrom->flags = MEM_Null; pFrom->szMalloc = 0; @@ -80929,7 +80929,7 @@ SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem *pTo, Mem *pFrom){ ** is required to store the string, then value of pMem is unchanged. In ** either case, SQLITE_TOOBIG is returned. */ -SQLITE_PRIVATE int sqlite3VdbeMemSetStr( +SQLITE_PRIVATE int tdsqlite3VdbeMemSetStr( Mem *pMem, /* Memory cell to set to string value */ const char *z, /* String pointer */ int n, /* Bytes in string, or negative */ @@ -80940,12 +80940,12 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetStr( int iLimit; /* Maximum allowed string or blob size */ u16 flags = 0; /* New value for pMem->flags */ - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - assert( !sqlite3VdbeMemIsRowSet(pMem) ); + assert( pMem->db==0 || tdsqlite3_mutex_held(pMem->db->mutex) ); + assert( !tdsqlite3VdbeMemIsRowSet(pMem) ); /* If z is a NULL pointer, set pMem to contain an SQL NULL. */ if( !z ){ - sqlite3VdbeMemSetNull(pMem); + tdsqlite3VdbeMemSetNull(pMem); return SQLITE_OK; } @@ -80975,21 +80975,21 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetStr( nAlloc += (enc==SQLITE_UTF8?1:2); } if( nByte>iLimit ){ - return sqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG); + return tdsqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG); } testcase( nAlloc==0 ); testcase( nAlloc==31 ); testcase( nAlloc==32 ); - if( sqlite3VdbeMemClearAndResize(pMem, (int)MAX(nAlloc,32)) ){ + if( tdsqlite3VdbeMemClearAndResize(pMem, (int)MAX(nAlloc,32)) ){ return SQLITE_NOMEM_BKPT; } memcpy(pMem->z, z, nAlloc); }else{ - sqlite3VdbeMemRelease(pMem); + tdsqlite3VdbeMemRelease(pMem); pMem->z = (char *)z; if( xDel==SQLITE_DYNAMIC ){ pMem->zMalloc = pMem->z; - pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc); + pMem->szMalloc = tdsqlite3DbMallocSize(pMem->db, pMem->zMalloc); }else{ pMem->xDel = xDel; flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn); @@ -81010,7 +81010,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetStr( } #ifndef SQLITE_OMIT_UTF16 - if( enc>SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){ + if( enc>SQLITE_UTF8 && tdsqlite3VdbeMemHandleBom(pMem) ){ return SQLITE_NOMEM_BKPT; } #endif @@ -81045,22 +81045,22 @@ static SQLITE_NOINLINE int vdbeMemFromBtreeResize( ){ int rc; pMem->flags = MEM_Null; - if( sqlite3BtreeMaxRecordSize(pCur)z); + if( SQLITE_OK==(rc = tdsqlite3VdbeMemClearAndResize(pMem, amt+1)) ){ + rc = tdsqlite3BtreePayload(pCur, offset, amt, pMem->z); if( rc==SQLITE_OK ){ pMem->z[amt] = 0; /* Overrun area used when reading malformed records */ pMem->flags = MEM_Blob; pMem->n = (int)amt; }else{ - sqlite3VdbeMemRelease(pMem); + tdsqlite3VdbeMemRelease(pMem); } } return rc; } -SQLITE_PRIVATE int sqlite3VdbeMemFromBtree( +SQLITE_PRIVATE int tdsqlite3VdbeMemFromBtree( BtCursor *pCur, /* Cursor pointing at record to retrieve. */ u32 offset, /* Offset from the start of data to return bytes from. */ u32 amt, /* Number of bytes to return. */ @@ -81070,13 +81070,13 @@ SQLITE_PRIVATE int sqlite3VdbeMemFromBtree( u32 available = 0; /* Number of bytes available on the local btree page */ int rc = SQLITE_OK; /* Return code */ - assert( sqlite3BtreeCursorIsValid(pCur) ); + assert( tdsqlite3BtreeCursorIsValid(pCur) ); assert( !VdbeMemDynamic(pMem) ); /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert() ** that both the BtShared and database handle mutexes are held. */ - assert( !sqlite3VdbeMemIsRowSet(pMem) ); - zData = (char *)sqlite3BtreePayloadFetch(pCur, &available); + assert( !tdsqlite3VdbeMemIsRowSet(pMem) ); + zData = (char *)tdsqlite3BtreePayloadFetch(pCur, &available); assert( zData!=0 ); if( offset+amt<=available ){ @@ -81095,33 +81095,33 @@ SQLITE_PRIVATE int sqlite3VdbeMemFromBtree( ** Convert it into a string with encoding enc and return a pointer ** to a zero-terminated version of that string. */ -static SQLITE_NOINLINE const void *valueToText(sqlite3_value* pVal, u8 enc){ +static SQLITE_NOINLINE const void *valueToText(tdsqlite3_value* pVal, u8 enc){ assert( pVal!=0 ); - assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) ); + assert( pVal->db==0 || tdsqlite3_mutex_held(pVal->db->mutex) ); assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) ); - assert( !sqlite3VdbeMemIsRowSet(pVal) ); + assert( !tdsqlite3VdbeMemIsRowSet(pVal) ); assert( (pVal->flags & (MEM_Null))==0 ); if( pVal->flags & (MEM_Blob|MEM_Str) ){ if( ExpandBlob(pVal) ) return 0; pVal->flags |= MEM_Str; if( pVal->enc != (enc & ~SQLITE_UTF16_ALIGNED) ){ - sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED); + tdsqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED); } if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){ assert( (pVal->flags & (MEM_Ephem|MEM_Static))!=0 ); - if( sqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){ + if( tdsqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){ return 0; } } - sqlite3VdbeMemNulTerminate(pVal); /* IMP: R-31275-44060 */ + tdsqlite3VdbeMemNulTerminate(pVal); /* IMP: R-31275-44060 */ }else{ - sqlite3VdbeMemStringify(pVal, enc, 0); + tdsqlite3VdbeMemStringify(pVal, enc, 0); assert( 0==(1&SQLITE_PTR_TO_INT(pVal->z)) ); } assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || pVal->db==0 || pVal->db->mallocFailed ); if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){ - assert( sqlite3VdbeMemValidStrRep(pVal) ); + assert( tdsqlite3VdbeMemValidStrRep(pVal) ); return pVal->z; }else{ return 0; @@ -81129,7 +81129,7 @@ static SQLITE_NOINLINE const void *valueToText(sqlite3_value* pVal, u8 enc){ } /* This function is only available internally, it is not part of the -** external API. It works in a similar way to sqlite3_value_text(), +** external API. It works in a similar way to tdsqlite3_value_text(), ** except the data returned is in the encoding specified by the second ** parameter, which must be one of SQLITE_UTF16BE, SQLITE_UTF16LE or ** SQLITE_UTF8. @@ -81138,13 +81138,13 @@ static SQLITE_NOINLINE const void *valueToText(sqlite3_value* pVal, u8 enc){ ** If that is the case, then the result must be aligned on an even byte ** boundary. */ -SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){ +SQLITE_PRIVATE const void *tdsqlite3ValueText(tdsqlite3_value* pVal, u8 enc){ if( !pVal ) return 0; - assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) ); + assert( pVal->db==0 || tdsqlite3_mutex_held(pVal->db->mutex) ); assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) ); - assert( !sqlite3VdbeMemIsRowSet(pVal) ); + assert( !tdsqlite3VdbeMemIsRowSet(pVal) ); if( (pVal->flags&(MEM_Str|MEM_Term))==(MEM_Str|MEM_Term) && pVal->enc==enc ){ - assert( sqlite3VdbeMemValidStrRep(pVal) ); + assert( tdsqlite3VdbeMemValidStrRep(pVal) ); return pVal->z; } if( pVal->flags&MEM_Null ){ @@ -81154,10 +81154,10 @@ SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){ } /* -** Create a new sqlite3_value object. +** Create a new tdsqlite3_value object. */ -SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *db){ - Mem *p = sqlite3DbMallocZero(db, sizeof(*p)); +SQLITE_PRIVATE tdsqlite3_value *tdsqlite3ValueNew(tdsqlite3 *db){ + Mem *p = tdsqlite3DbMallocZero(db, sizeof(*p)); if( p ){ p->flags = MEM_Null; p->db = db; @@ -81166,7 +81166,7 @@ SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *db){ } /* -** Context object passed by sqlite3Stat4ProbeSetValue() through to +** Context object passed by tdsqlite3Stat4ProbeSetValue() through to ** valueNew(). See comments above valueNew() for details. */ struct ValueNewStat4Ctx { @@ -81177,17 +81177,17 @@ struct ValueNewStat4Ctx { }; /* -** Allocate and return a pointer to a new sqlite3_value object. If +** Allocate and return a pointer to a new tdsqlite3_value object. If ** the second argument to this function is NULL, the object is allocated -** by calling sqlite3ValueNew(). +** by calling tdsqlite3ValueNew(). ** ** Otherwise, if the second argument is non-zero, then this function is -** being called indirectly by sqlite3Stat4ProbeSetValue(). If it has not +** being called indirectly by tdsqlite3Stat4ProbeSetValue(). If it has not ** already been allocated, allocate the UnpackedRecord structure that ** that function will return to its caller here. Then return a pointer to -** an sqlite3_value within the UnpackedRecord.a[] array. +** an tdsqlite3_value within the UnpackedRecord.a[] array. */ -static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){ +static tdsqlite3_value *valueNew(tdsqlite3 *db, struct ValueNewStat4Ctx *p){ #ifdef SQLITE_ENABLE_STAT4 if( p ){ UnpackedRecord *pRec = p->ppRec[0]; @@ -81199,9 +81199,9 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){ int nCol = pIdx->nColumn; /* Number of index columns including rowid */ nByte = sizeof(Mem) * nCol + ROUND8(sizeof(UnpackedRecord)); - pRec = (UnpackedRecord*)sqlite3DbMallocZero(db, nByte); + pRec = (UnpackedRecord*)tdsqlite3DbMallocZero(db, nByte); if( pRec ){ - pRec->pKeyInfo = sqlite3KeyInfoOfIndex(p->pParse, pIdx); + pRec->pKeyInfo = tdsqlite3KeyInfoOfIndex(p->pParse, pIdx); if( pRec->pKeyInfo ){ assert( pRec->pKeyInfo->nAllField==nCol ); assert( pRec->pKeyInfo->enc==ENC(db) ); @@ -81211,7 +81211,7 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){ pRec->aMem[i].db = db; } }else{ - sqlite3DbFreeNN(db, pRec); + tdsqlite3DbFreeNN(db, pRec); pRec = 0; } } @@ -81225,7 +81225,7 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){ #else UNUSED_PARAMETER(p); #endif /* defined(SQLITE_ENABLE_STAT4) */ - return sqlite3ValueNew(db); + return tdsqlite3ValueNew(db); } /* @@ -81241,7 +81241,7 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){ ** object containing the result before returning SQLITE_OK. ** ** Affinity aff is applied to the result of the function before returning. -** If the result is a text value, the sqlite3_value object uses encoding +** If the result is a text value, the tdsqlite3_value object uses encoding ** enc. ** ** If the conditions above are not met, this function returns SQLITE_OK @@ -81250,18 +81250,18 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){ */ #ifdef SQLITE_ENABLE_STAT4 static int valueFromFunction( - sqlite3 *db, /* The database connection */ + tdsqlite3 *db, /* The database connection */ Expr *p, /* The expression to evaluate */ u8 enc, /* Encoding to use */ u8 aff, /* Affinity to use */ - sqlite3_value **ppVal, /* Write the new value here */ + tdsqlite3_value **ppVal, /* Write the new value here */ struct ValueNewStat4Ctx *pCtx /* Second argument for valueNew() */ ){ - sqlite3_context ctx; /* Context object for function invocation */ - sqlite3_value **apVal = 0; /* Function arguments */ + tdsqlite3_context ctx; /* Context object for function invocation */ + tdsqlite3_value **apVal = 0; /* Function arguments */ int nVal = 0; /* Size of apVal[] array */ FuncDef *pFunc = 0; /* Function definition */ - sqlite3_value *pVal = 0; /* New value */ + tdsqlite3_value *pVal = 0; /* New value */ int rc = SQLITE_OK; /* Return code */ ExprList *pList = 0; /* Function arguments */ int i; /* Iterator variable */ @@ -81270,7 +81270,7 @@ static int valueFromFunction( assert( (p->flags & EP_TokenOnly)==0 ); pList = p->x.pList; if( pList ) nVal = pList->nExpr; - pFunc = sqlite3FindFunction(db, p->u.zToken, nVal, enc, 0); + pFunc = tdsqlite3FindFunction(db, p->u.zToken, nVal, enc, 0); assert( pFunc ); if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0 || (pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL) @@ -81279,13 +81279,13 @@ static int valueFromFunction( } if( pList ){ - apVal = (sqlite3_value**)sqlite3DbMallocZero(db, sizeof(apVal[0]) * nVal); + apVal = (tdsqlite3_value**)tdsqlite3DbMallocZero(db, sizeof(apVal[0]) * nVal); if( apVal==0 ){ rc = SQLITE_NOMEM_BKPT; goto value_from_function_out; } for(i=0; ia[i].pExpr, enc, aff, &apVal[i]); + rc = tdsqlite3ValueFromExpr(db, pList->a[i].pExpr, enc, aff, &apVal[i]); if( apVal[i]==0 || rc!=SQLITE_OK ) goto value_from_function_out; } } @@ -81303,12 +81303,12 @@ static int valueFromFunction( pFunc->xSFunc(&ctx, nVal, apVal); if( ctx.isError ){ rc = ctx.isError; - sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal)); + tdsqlite3ErrorMsg(pCtx->pParse, "%s", tdsqlite3_value_text(pVal)); }else{ - sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8); + tdsqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8); assert( rc==SQLITE_OK ); - rc = sqlite3VdbeChangeEncoding(pVal, enc); - if( rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal) ){ + rc = tdsqlite3VdbeChangeEncoding(pVal, enc); + if( rc==SQLITE_OK && tdsqlite3VdbeMemTooBig(pVal) ){ rc = SQLITE_TOOBIG; pCtx->pParse->nErr++; } @@ -81321,9 +81321,9 @@ static int valueFromFunction( } if( apVal ){ for(i=0; iflags & EP_TokenOnly)==0 || pCtx==0 ); if( op==TK_CAST ){ - u8 aff = sqlite3AffinityType(pExpr->u.zToken,0); + u8 aff = tdsqlite3AffinityType(pExpr->u.zToken,0); rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx); testcase( rc!=SQLITE_OK ); if( *ppVal ){ - sqlite3VdbeMemCast(*ppVal, aff, SQLITE_UTF8); - sqlite3ValueApplyAffinity(*ppVal, affinity, SQLITE_UTF8); + tdsqlite3VdbeMemCast(*ppVal, aff, SQLITE_UTF8); + tdsqlite3ValueApplyAffinity(*ppVal, affinity, SQLITE_UTF8); } return rc; } @@ -81398,16 +81398,16 @@ static int valueFromExpr( pVal = valueNew(db, pCtx); if( pVal==0 ) goto no_mem; if( ExprHasProperty(pExpr, EP_IntValue) ){ - sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt); + tdsqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt); }else{ - zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken); + zVal = tdsqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken); if( zVal==0 ) goto no_mem; - sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC); + tdsqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC); } if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){ - sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8); + tdsqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8); }else{ - sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8); + tdsqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8); } assert( (pVal->flags & MEM_IntReal)==0 ); if( pVal->flags & (MEM_Int|MEM_IntReal|MEM_Real) ){ @@ -81416,14 +81416,14 @@ static int valueFromExpr( pVal->flags &= ~MEM_Str; } if( enc!=SQLITE_UTF8 ){ - rc = sqlite3VdbeChangeEncoding(pVal, enc); + rc = tdsqlite3VdbeChangeEncoding(pVal, enc); } }else if( op==TK_UMINUS ) { /* This branch happens for multiple negative signs. Ex: -(-5) */ if( SQLITE_OK==valueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal,pCtx) && pVal!=0 ){ - sqlite3VdbeMemNumerify(pVal); + tdsqlite3VdbeMemNumerify(pVal); if( pVal->flags & MEM_Real ){ pVal->u.r = -pVal->u.r; }else if( pVal->u.i==SMALLEST_INT64 ){ @@ -81436,12 +81436,12 @@ static int valueFromExpr( }else{ pVal->u.i = -pVal->u.i; } - sqlite3ValueApplyAffinity(pVal, affinity, enc); + tdsqlite3ValueApplyAffinity(pVal, affinity, enc); } }else if( op==TK_NULL ){ pVal = valueNew(db, pCtx); if( pVal==0 ) goto no_mem; - sqlite3VdbeMemSetNull(pVal); + tdsqlite3VdbeMemSetNull(pVal); } #ifndef SQLITE_OMIT_BLOB_LITERAL else if( op==TK_BLOB ){ @@ -81451,9 +81451,9 @@ static int valueFromExpr( pVal = valueNew(db, pCtx); if( !pVal ) goto no_mem; zVal = &pExpr->u.zToken[2]; - nVal = sqlite3Strlen30(zVal)-1; + nVal = tdsqlite3Strlen30(zVal)-1; assert( zVal[nVal]=='\'' ); - sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2, + tdsqlite3VdbeMemSetStr(pVal, tdsqlite3HexToBlob(db, zVal, nVal), nVal/2, 0, SQLITE_DYNAMIC); } #endif @@ -81477,33 +81477,33 @@ no_mem: #ifdef SQLITE_ENABLE_STAT4 if( pCtx==0 || pCtx->pParse->nErr==0 ) #endif - sqlite3OomFault(db); - sqlite3DbFree(db, zVal); + tdsqlite3OomFault(db); + tdsqlite3DbFree(db, zVal); assert( *ppVal==0 ); #ifdef SQLITE_ENABLE_STAT4 - if( pCtx==0 ) sqlite3ValueFree(pVal); + if( pCtx==0 ) tdsqlite3ValueFree(pVal); #else - assert( pCtx==0 ); sqlite3ValueFree(pVal); + assert( pCtx==0 ); tdsqlite3ValueFree(pVal); #endif return SQLITE_NOMEM_BKPT; } /* -** Create a new sqlite3_value object, containing the value of pExpr. +** Create a new tdsqlite3_value object, containing the value of pExpr. ** ** This only works for very simple expressions that consist of one constant ** token (i.e. "5", "5.1", "'a string'"). If the expression can ** be converted directly into a value, then the value is allocated and ** a pointer written to *ppVal. The caller is responsible for deallocating -** the value by passing it to sqlite3ValueFree() later on. If the expression +** the value by passing it to tdsqlite3ValueFree() later on. If the expression ** cannot be converted to a value, then *ppVal is set to NULL. */ -SQLITE_PRIVATE int sqlite3ValueFromExpr( - sqlite3 *db, /* The database connection */ +SQLITE_PRIVATE int tdsqlite3ValueFromExpr( + tdsqlite3 *db, /* The database connection */ Expr *pExpr, /* The expression to evaluate */ u8 enc, /* Encoding to use */ u8 affinity, /* Affinity to use */ - sqlite3_value **ppVal /* Write the new value here */ + tdsqlite3_value **ppVal /* Write the new value here */ ){ return pExpr ? valueFromExpr(db, pExpr, enc, affinity, ppVal, 0) : 0; } @@ -81532,30 +81532,30 @@ static int stat4ValueFromExpr( Expr *pExpr, /* The expression to extract a value from */ u8 affinity, /* Affinity to use */ struct ValueNewStat4Ctx *pAlloc,/* How to allocate space. Or NULL */ - sqlite3_value **ppVal /* OUT: New value object (or NULL) */ + tdsqlite3_value **ppVal /* OUT: New value object (or NULL) */ ){ int rc = SQLITE_OK; - sqlite3_value *pVal = 0; - sqlite3 *db = pParse->db; + tdsqlite3_value *pVal = 0; + tdsqlite3 *db = pParse->db; /* Skip over any TK_COLLATE nodes */ - pExpr = sqlite3ExprSkipCollate(pExpr); + pExpr = tdsqlite3ExprSkipCollate(pExpr); assert( pExpr==0 || pExpr->op!=TK_REGISTER || pExpr->op2!=TK_VARIABLE ); if( !pExpr ){ pVal = valueNew(db, pAlloc); if( pVal ){ - sqlite3VdbeMemSetNull((Mem*)pVal); + tdsqlite3VdbeMemSetNull((Mem*)pVal); } }else if( pExpr->op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){ Vdbe *v; int iBindVar = pExpr->iColumn; - sqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar); + tdsqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar); if( (v = pParse->pReprepare)!=0 ){ pVal = valueNew(db, pAlloc); if( pVal ){ - rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]); - sqlite3ValueApplyAffinity(pVal, affinity, ENC(db)); + rc = tdsqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]); + tdsqlite3ValueApplyAffinity(pVal, affinity, ENC(db)); pVal->db = pParse->db; } } @@ -81581,7 +81581,7 @@ static int stat4ValueFromExpr( ** ** * The expression is a bound variable, and this is a reprepare, or ** -** * The sqlite3ValueFromExpr() function is able to extract a value +** * The tdsqlite3ValueFromExpr() function is able to extract a value ** from the expression (i.e. the expression is a literal value). ** ** Or, if pExpr is a TK_VECTOR, one field is populated for each of the @@ -81602,7 +81602,7 @@ static int stat4ValueFromExpr( ** error if a value cannot be extracted from pExpr. If an error does ** occur, an SQLite error code is returned. */ -SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue( +SQLITE_PRIVATE int tdsqlite3Stat4ProbeSetValue( Parse *pParse, /* Parse context */ Index *pIdx, /* Index being probed */ UnpackedRecord **ppRec, /* IN/OUT: Probe record */ @@ -81623,9 +81623,9 @@ SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue( alloc.ppRec = ppRec; for(i=0; idb, pIdx, iVal+i); + tdsqlite3_value *pVal = 0; + Expr *pElem = (pExpr ? tdsqlite3VectorFieldSubexpr(pExpr, i) : 0); + u8 aff = tdsqlite3IndexColumnAffinity(pParse->db, pIdx, iVal+i); alloc.iVal = iVal+i; rc = stat4ValueFromExpr(pParse, pElem, aff, &alloc, &pVal); if( !pVal ) break; @@ -81639,7 +81639,7 @@ SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue( /* ** Attempt to extract a value from expression pExpr using the methods -** as described for sqlite3Stat4ProbeSetValue() above. +** as described for tdsqlite3Stat4ProbeSetValue() above. ** ** If successful, set *ppVal to point to a new value object and return ** SQLITE_OK. If no value can be extracted, but no other error occurs @@ -81647,11 +81647,11 @@ SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue( ** does occur, return an SQLite error code. The final value of *ppVal ** is undefined in this case. */ -SQLITE_PRIVATE int sqlite3Stat4ValueFromExpr( +SQLITE_PRIVATE int tdsqlite3Stat4ValueFromExpr( Parse *pParse, /* Parse context */ Expr *pExpr, /* The expression to extract a value from */ u8 affinity, /* Affinity to use */ - sqlite3_value **ppVal /* OUT: New value object (or NULL) */ + tdsqlite3_value **ppVal /* OUT: New value object (or NULL) */ ){ return stat4ValueFromExpr(pParse, pExpr, affinity, 0, ppVal); } @@ -81659,17 +81659,17 @@ SQLITE_PRIVATE int sqlite3Stat4ValueFromExpr( /* ** Extract the iCol-th column from the nRec-byte record in pRec. Write ** the column value into *ppVal. If *ppVal is initially NULL then a new -** sqlite3_value object is allocated. +** tdsqlite3_value object is allocated. ** ** If *ppVal is initially NULL then the caller is responsible for ** ensuring that the value written into *ppVal is eventually freed. */ -SQLITE_PRIVATE int sqlite3Stat4Column( - sqlite3 *db, /* Database handle */ +SQLITE_PRIVATE int tdsqlite3Stat4Column( + tdsqlite3 *db, /* Database handle */ const void *pRec, /* Pointer to buffer containing record */ int nRec, /* Size of buffer pRec in bytes */ int iCol, /* Column to extract */ - sqlite3_value **ppVal /* OUT: Extracted value */ + tdsqlite3_value **ppVal /* OUT: Extracted value */ ){ u32 t = 0; /* a column type code */ int nHdr; /* Size of the header in the record */ @@ -81689,72 +81689,72 @@ SQLITE_PRIVATE int sqlite3Stat4Column( testcase( iHdr==nHdr ); testcase( iHdr==nHdr+1 ); if( iHdr>nHdr ) return SQLITE_CORRUPT_BKPT; - szField = sqlite3VdbeSerialTypeLen(t); + szField = tdsqlite3VdbeSerialTypeLen(t); iField += szField; } testcase( iField==nRec ); testcase( iField==nRec+1 ); if( iField>nRec ) return SQLITE_CORRUPT_BKPT; if( pMem==0 ){ - pMem = *ppVal = sqlite3ValueNew(db); + pMem = *ppVal = tdsqlite3ValueNew(db); if( pMem==0 ) return SQLITE_NOMEM_BKPT; } - sqlite3VdbeSerialGet(&a[iField-szField], t, pMem); + tdsqlite3VdbeSerialGet(&a[iField-szField], t, pMem); pMem->enc = ENC(db); return SQLITE_OK; } /* ** Unless it is NULL, the argument must be an UnpackedRecord object returned -** by an earlier call to sqlite3Stat4ProbeSetValue(). This call deletes +** by an earlier call to tdsqlite3Stat4ProbeSetValue(). This call deletes ** the object. */ -SQLITE_PRIVATE void sqlite3Stat4ProbeFree(UnpackedRecord *pRec){ +SQLITE_PRIVATE void tdsqlite3Stat4ProbeFree(UnpackedRecord *pRec){ if( pRec ){ int i; int nCol = pRec->pKeyInfo->nAllField; Mem *aMem = pRec->aMem; - sqlite3 *db = aMem[0].db; + tdsqlite3 *db = aMem[0].db; for(i=0; ipKeyInfo); - sqlite3DbFreeNN(db, pRec); + tdsqlite3KeyInfoUnref(pRec->pKeyInfo); + tdsqlite3DbFreeNN(db, pRec); } } #endif /* ifdef SQLITE_ENABLE_STAT4 */ /* -** Change the string value of an sqlite3_value object +** Change the string value of an tdsqlite3_value object */ -SQLITE_PRIVATE void sqlite3ValueSetStr( - sqlite3_value *v, /* Value to be set */ +SQLITE_PRIVATE void tdsqlite3ValueSetStr( + tdsqlite3_value *v, /* Value to be set */ int n, /* Length of string z */ const void *z, /* Text of the new string */ u8 enc, /* Encoding to use */ void (*xDel)(void*) /* Destructor for the string */ ){ - if( v ) sqlite3VdbeMemSetStr((Mem *)v, z, n, enc, xDel); + if( v ) tdsqlite3VdbeMemSetStr((Mem *)v, z, n, enc, xDel); } /* -** Free an sqlite3_value object +** Free an tdsqlite3_value object */ -SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value *v){ +SQLITE_PRIVATE void tdsqlite3ValueFree(tdsqlite3_value *v){ if( !v ) return; - sqlite3VdbeMemRelease((Mem *)v); - sqlite3DbFreeNN(((Mem*)v)->db, v); + tdsqlite3VdbeMemRelease((Mem *)v); + tdsqlite3DbFreeNN(((Mem*)v)->db, v); } /* -** The sqlite3ValueBytes() routine returns the number of bytes in the -** sqlite3_value object assuming that it uses the encoding "enc". +** The tdsqlite3ValueBytes() routine returns the number of bytes in the +** tdsqlite3_value object assuming that it uses the encoding "enc". ** The valueBytes() routine is a helper function. */ -static SQLITE_NOINLINE int valueBytes(sqlite3_value *pVal, u8 enc){ +static SQLITE_NOINLINE int valueBytes(tdsqlite3_value *pVal, u8 enc){ return valueToText(pVal, enc)!=0 ? pVal->n : 0; } -SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value *pVal, u8 enc){ +SQLITE_PRIVATE int tdsqlite3ValueBytes(tdsqlite3_value *pVal, u8 enc){ Mem *p = (Mem*)pVal; assert( (p->flags & MEM_Null)==0 || (p->flags & (MEM_Str|MEM_Blob))==0 ); if( (p->flags & MEM_Str)!=0 && pVal->enc==enc ){ @@ -81785,22 +81785,22 @@ SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value *pVal, u8 enc){ ** ************************************************************************* ** This file contains code used for creating, destroying, and populating -** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.) +** a VDBE (or an "tdsqlite3_stmt" as it is known to the outside world.) */ /* #include "sqliteInt.h" */ /* #include "vdbeInt.h" */ /* Forward references */ -static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef); -static void vdbeFreeOpArray(sqlite3 *, Op *, int); +static void freeEphemeralFunction(tdsqlite3 *db, FuncDef *pDef); +static void vdbeFreeOpArray(tdsqlite3 *, Op *, int); /* ** Create a new virtual database engine. */ -SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){ - sqlite3 *db = pParse->db; +SQLITE_PRIVATE Vdbe *tdsqlite3VdbeCreate(Parse *pParse){ + tdsqlite3 *db = pParse->db; Vdbe *p; - p = sqlite3DbMallocRawNN(db, sizeof(Vdbe) ); + p = tdsqlite3DbMallocRawNN(db, sizeof(Vdbe) ); if( p==0 ) return 0; memset(&p->aOp, 0, sizeof(Vdbe)-offsetof(Vdbe,aOp)); p->db = db; @@ -81817,49 +81817,49 @@ SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){ assert( pParse->nLabel==0 ); assert( p->nOpAlloc==0 ); assert( pParse->szOpAlloc==0 ); - sqlite3VdbeAddOp2(p, OP_Init, 0, 1); + tdsqlite3VdbeAddOp2(p, OP_Init, 0, 1); return p; } /* ** Return the Parse object that owns a Vdbe object. */ -SQLITE_PRIVATE Parse *sqlite3VdbeParser(Vdbe *p){ +SQLITE_PRIVATE Parse *tdsqlite3VdbeParser(Vdbe *p){ return p->pParse; } /* ** Change the error string stored in Vdbe.zErrMsg */ -SQLITE_PRIVATE void sqlite3VdbeError(Vdbe *p, const char *zFormat, ...){ +SQLITE_PRIVATE void tdsqlite3VdbeError(Vdbe *p, const char *zFormat, ...){ va_list ap; - sqlite3DbFree(p->db, p->zErrMsg); + tdsqlite3DbFree(p->db, p->zErrMsg); va_start(ap, zFormat); - p->zErrMsg = sqlite3VMPrintf(p->db, zFormat, ap); + p->zErrMsg = tdsqlite3VMPrintf(p->db, zFormat, ap); va_end(ap); } /* ** Remember the SQL string for a prepared statement. */ -SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, u8 prepFlags){ +SQLITE_PRIVATE void tdsqlite3VdbeSetSql(Vdbe *p, const char *z, int n, u8 prepFlags){ if( p==0 ) return; p->prepFlags = prepFlags; if( (prepFlags & SQLITE_PREPARE_SAVESQL)==0 ){ p->expmask = 0; } assert( p->zSql==0 ); - p->zSql = sqlite3DbStrNDup(p->db, z, n); + p->zSql = tdsqlite3DbStrNDup(p->db, z, n); } #ifdef SQLITE_ENABLE_NORMALIZE /* ** Add a new element to the Vdbe->pDblStr list. */ -SQLITE_PRIVATE void sqlite3VdbeAddDblquoteStr(sqlite3 *db, Vdbe *p, const char *z){ +SQLITE_PRIVATE void tdsqlite3VdbeAddDblquoteStr(tdsqlite3 *db, Vdbe *p, const char *z){ if( p ){ - int n = sqlite3Strlen30(z); - DblquoteStr *pStr = sqlite3DbMallocRawNN(db, + int n = tdsqlite3Strlen30(z); + DblquoteStr *pStr = tdsqlite3DbMallocRawNN(db, sizeof(*pStr)+n+1-sizeof(pStr->z)); if( pStr ){ pStr->pNextStr = p->pDblStr; @@ -81875,7 +81875,7 @@ SQLITE_PRIVATE void sqlite3VdbeAddDblquoteStr(sqlite3 *db, Vdbe *p, const char * ** zId of length nId is a double-quoted identifier. Check to see if ** that identifier is really used as a string literal. */ -SQLITE_PRIVATE int sqlite3VdbeUsesDoubleQuotedString( +SQLITE_PRIVATE int tdsqlite3VdbeUsesDoubleQuotedString( Vdbe *pVdbe, /* The prepared statement */ const char *zId /* The double-quoted identifier, already dequoted */ ){ @@ -81892,7 +81892,7 @@ SQLITE_PRIVATE int sqlite3VdbeUsesDoubleQuotedString( /* ** Swap all content between two VDBE structures. */ -SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){ +SQLITE_PRIVATE void tdsqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){ Vdbe tmp, *pTmp; char *zTmp; assert( pA->db==pB->db ); @@ -81941,25 +81941,25 @@ static int growOpArray(Vdbe *v, int nOp){ ** operation (without SQLITE_TEST_REALLOC_STRESS) is to double the current ** size of the op array or add 1KB of space, whichever is smaller. */ #ifdef SQLITE_TEST_REALLOC_STRESS - sqlite3_int64 nNew = (v->nOpAlloc>=512 ? 2*(sqlite3_int64)v->nOpAlloc - : (sqlite3_int64)v->nOpAlloc+nOp); + tdsqlite3_int64 nNew = (v->nOpAlloc>=512 ? 2*(tdsqlite3_int64)v->nOpAlloc + : (tdsqlite3_int64)v->nOpAlloc+nOp); #else - sqlite3_int64 nNew = (v->nOpAlloc ? 2*(sqlite3_int64)v->nOpAlloc - : (sqlite3_int64)(1024/sizeof(Op))); + tdsqlite3_int64 nNew = (v->nOpAlloc ? 2*(tdsqlite3_int64)v->nOpAlloc + : (tdsqlite3_int64)(1024/sizeof(Op))); UNUSED_PARAMETER(nOp); #endif /* Ensure that the size of a VDBE does not grow too large */ if( nNew > p->db->aLimit[SQLITE_LIMIT_VDBE_OP] ){ - sqlite3OomFault(p->db); + tdsqlite3OomFault(p->db); return SQLITE_NOMEM; } assert( nOp<=(1024/sizeof(Op)) ); assert( nNew>=(v->nOpAlloc+nOp) ); - pNew = sqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op)); + pNew = tdsqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op)); if( pNew ){ - p->szOpAlloc = sqlite3DbMallocSize(p->db, pNew); + p->szOpAlloc = tdsqlite3DbMallocSize(p->db, pNew); v->nOpAlloc = p->szOpAlloc/sizeof(Op); v->aOp = pNew; } @@ -81974,9 +81974,9 @@ static int growOpArray(Vdbe *v, int nOp){ ** ** Other useful labels for breakpoints include: ** test_trace_breakpoint(pc,pOp) -** sqlite3CorruptError(lineno) -** sqlite3MisuseError(lineno) -** sqlite3CantopenError(lineno) +** tdsqlite3CorruptError(lineno) +** tdsqlite3MisuseError(lineno) +** tdsqlite3CantopenError(lineno) */ static void test_addop_breakpoint(int pc, Op *pOp){ static int n = 0; @@ -81996,17 +81996,17 @@ static void test_addop_breakpoint(int pc, Op *pOp){ ** ** p1, p2, p3 Operands ** -** Use the sqlite3VdbeResolveLabel() function to fix an address and -** the sqlite3VdbeChangeP4() function to change the value of the P4 +** Use the tdsqlite3VdbeResolveLabel() function to fix an address and +** the tdsqlite3VdbeChangeP4() function to change the value of the P4 ** operand. */ static SQLITE_NOINLINE int growOp3(Vdbe *p, int op, int p1, int p2, int p3){ assert( p->nOpAlloc<=p->nOp ); if( growOpArray(p, 1) ) return 1; assert( p->nOpAlloc>p->nOp ); - return sqlite3VdbeAddOp3(p, op, p1, p2, p3); + return tdsqlite3VdbeAddOp3(p, op, p1, p2, p3); } -SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){ +SQLITE_PRIVATE int tdsqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){ int i; VdbeOp *pOp; @@ -82030,7 +82030,7 @@ SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){ #endif #ifdef SQLITE_DEBUG if( p->db->flags & SQLITE_VdbeAddopTrace ){ - sqlite3VdbePrintOp(0, i, &p->aOp[i]); + tdsqlite3VdbePrintOp(0, i, &p->aOp[i]); test_addop_breakpoint(i, &p->aOp[i]); } #endif @@ -82043,27 +82043,27 @@ SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){ #endif return i; } -SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe *p, int op){ - return sqlite3VdbeAddOp3(p, op, 0, 0, 0); +SQLITE_PRIVATE int tdsqlite3VdbeAddOp0(Vdbe *p, int op){ + return tdsqlite3VdbeAddOp3(p, op, 0, 0, 0); } -SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe *p, int op, int p1){ - return sqlite3VdbeAddOp3(p, op, p1, 0, 0); +SQLITE_PRIVATE int tdsqlite3VdbeAddOp1(Vdbe *p, int op, int p1){ + return tdsqlite3VdbeAddOp3(p, op, p1, 0, 0); } -SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe *p, int op, int p1, int p2){ - return sqlite3VdbeAddOp3(p, op, p1, p2, 0); +SQLITE_PRIVATE int tdsqlite3VdbeAddOp2(Vdbe *p, int op, int p1, int p2){ + return tdsqlite3VdbeAddOp3(p, op, p1, p2, 0); } /* Generate code for an unconditional jump to instruction iDest */ -SQLITE_PRIVATE int sqlite3VdbeGoto(Vdbe *p, int iDest){ - return sqlite3VdbeAddOp3(p, OP_Goto, 0, iDest, 0); +SQLITE_PRIVATE int tdsqlite3VdbeGoto(Vdbe *p, int iDest){ + return tdsqlite3VdbeAddOp3(p, OP_Goto, 0, iDest, 0); } /* Generate code to cause the string zStr to be loaded into ** register iDest */ -SQLITE_PRIVATE int sqlite3VdbeLoadString(Vdbe *p, int iDest, const char *zStr){ - return sqlite3VdbeAddOp4(p, OP_String8, 0, iDest, 0, zStr, 0); +SQLITE_PRIVATE int tdsqlite3VdbeLoadString(Vdbe *p, int iDest, const char *zStr){ + return tdsqlite3VdbeAddOp4(p, OP_String8, 0, iDest, 0, zStr, 0); } /* @@ -82077,7 +82077,7 @@ SQLITE_PRIVATE int sqlite3VdbeLoadString(Vdbe *p, int iDest, const char *zStr){ ** If the input string does not end with "X" then an OP_ResultRow instruction ** is generated for the values inserted. */ -SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, ...){ +SQLITE_PRIVATE void tdsqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, ...){ va_list ap; int i; char c; @@ -82085,14 +82085,14 @@ SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, for(i=0; (c = zTypes[i])!=0; i++){ if( c=='s' ){ const char *z = va_arg(ap, const char*); - sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest+i, 0, z, 0); + tdsqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest+i, 0, z, 0); }else if( c=='i' ){ - sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest+i); + tdsqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest+i); }else{ goto skip_op_resultrow; } } - sqlite3VdbeAddOp2(p, OP_ResultRow, iDest, i); + tdsqlite3VdbeAddOp2(p, OP_ResultRow, iDest, i); skip_op_resultrow: va_end(ap); } @@ -82100,7 +82100,7 @@ skip_op_resultrow: /* ** Add an opcode that includes the p4 value as a pointer. */ -SQLITE_PRIVATE int sqlite3VdbeAddOp4( +SQLITE_PRIVATE int tdsqlite3VdbeAddOp4( Vdbe *p, /* Add the opcode to this VM */ int op, /* The new opcode */ int p1, /* The P1 operand */ @@ -82109,8 +82109,8 @@ SQLITE_PRIVATE int sqlite3VdbeAddOp4( const char *zP4, /* The P4 operand */ int p4type /* P4 operand type */ ){ - int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3); - sqlite3VdbeChangeP4(p, addr, zP4, p4type); + int addr = tdsqlite3VdbeAddOp3(p, op, p1, p2, p3); + tdsqlite3VdbeChangeP4(p, addr, zP4, p4type); return addr; } @@ -82124,7 +82124,7 @@ SQLITE_PRIVATE int sqlite3VdbeAddOp4( ** means in the WHERE clause of a partial index. NC_GenCol means called ** while computing a generated column value. 0 is the usual case. */ -SQLITE_PRIVATE int sqlite3VdbeAddFunctionCall( +SQLITE_PRIVATE int tdsqlite3VdbeAddFunctionCall( Parse *pParse, /* Parsing context */ int p1, /* Constant argument mask */ int p2, /* First argument register */ @@ -82136,10 +82136,10 @@ SQLITE_PRIVATE int sqlite3VdbeAddFunctionCall( Vdbe *v = pParse->pVdbe; int nByte; int addr; - sqlite3_context *pCtx; + tdsqlite3_context *pCtx; assert( v ); - nByte = sizeof(*pCtx) + (nArg-1)*sizeof(sqlite3_value*); - pCtx = sqlite3DbMallocRawNN(pParse->db, nByte); + nByte = sizeof(*pCtx) + (nArg-1)*sizeof(tdsqlite3_value*); + pCtx = tdsqlite3DbMallocRawNN(pParse->db, nByte); if( pCtx==0 ){ assert( pParse->db->mallocFailed ); freeEphemeralFunction(pParse->db, (FuncDef*)pFunc); @@ -82150,10 +82150,10 @@ SQLITE_PRIVATE int sqlite3VdbeAddFunctionCall( pCtx->pVdbe = 0; pCtx->isError = 0; pCtx->argc = nArg; - pCtx->iOp = sqlite3VdbeCurrentAddr(v); - addr = sqlite3VdbeAddOp4(v, eCallCtx ? OP_PureFunc : OP_Function, + pCtx->iOp = tdsqlite3VdbeCurrentAddr(v); + addr = tdsqlite3VdbeAddOp4(v, eCallCtx ? OP_PureFunc : OP_Function, p1, p2, p3, (char*)pCtx, P4_FUNCCTX); - sqlite3VdbeChangeP5(v, eCallCtx & NC_SelfRef); + tdsqlite3VdbeChangeP5(v, eCallCtx & NC_SelfRef); return addr; } @@ -82161,7 +82161,7 @@ SQLITE_PRIVATE int sqlite3VdbeAddFunctionCall( ** Add an opcode that includes the p4 value with a P4_INT64 or ** P4_REAL type. */ -SQLITE_PRIVATE int sqlite3VdbeAddOp4Dup8( +SQLITE_PRIVATE int tdsqlite3VdbeAddOp4Dup8( Vdbe *p, /* Add the opcode to this VM */ int op, /* The new opcode */ int p1, /* The P1 operand */ @@ -82170,9 +82170,9 @@ SQLITE_PRIVATE int sqlite3VdbeAddOp4Dup8( const u8 *zP4, /* The P4 operand */ int p4type /* P4 operand type */ ){ - char *p4copy = sqlite3DbMallocRawNN(sqlite3VdbeDb(p), 8); + char *p4copy = tdsqlite3DbMallocRawNN(tdsqlite3VdbeDb(p), 8); if( p4copy ) memcpy(p4copy, zP4, 8); - return sqlite3VdbeAddOp4(p, op, p1, p2, p3, p4copy, p4type); + return tdsqlite3VdbeAddOp4(p, op, p1, p2, p3, p4copy, p4type); } #ifndef SQLITE_OMIT_EXPLAIN @@ -82180,10 +82180,10 @@ SQLITE_PRIVATE int sqlite3VdbeAddOp4Dup8( ** Return the address of the current EXPLAIN QUERY PLAN baseline. ** 0 means "none". */ -SQLITE_PRIVATE int sqlite3VdbeExplainParent(Parse *pParse){ +SQLITE_PRIVATE int tdsqlite3VdbeExplainParent(Parse *pParse){ VdbeOp *pOp; if( pParse->addrExplain==0 ) return 0; - pOp = sqlite3VdbeGetOp(pParse->pVdbe, pParse->addrExplain); + pOp = tdsqlite3VdbeGetOp(pParse->pVdbe, pParse->addrExplain); return pOp->p2; } @@ -82192,7 +82192,7 @@ SQLITE_PRIVATE int sqlite3VdbeExplainParent(Parse *pParse){ ** monitor the EXPLAIN QUERY PLAN code generation. */ #if defined(SQLITE_DEBUG) -SQLITE_PRIVATE void sqlite3ExplainBreakpoint(const char *z1, const char *z2){ +SQLITE_PRIVATE void tdsqlite3ExplainBreakpoint(const char *z1, const char *z2){ (void)z1; (void)z2; } @@ -82202,9 +82202,9 @@ SQLITE_PRIVATE void sqlite3ExplainBreakpoint(const char *z1, const char *z2){ ** Add a new OP_ opcode. ** ** If the bPush flag is true, then make this opcode the parent for -** subsequent Explains until sqlite3VdbeExplainPop() is called. +** subsequent Explains until tdsqlite3VdbeExplainPop() is called. */ -SQLITE_PRIVATE void sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){ +SQLITE_PRIVATE void tdsqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){ #ifndef SQLITE_DEBUG /* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined. ** But omit them (for performance) during production builds */ @@ -82216,13 +82216,13 @@ SQLITE_PRIVATE void sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt va_list ap; int iThis; va_start(ap, zFmt); - zMsg = sqlite3VMPrintf(pParse->db, zFmt, ap); + zMsg = tdsqlite3VMPrintf(pParse->db, zFmt, ap); va_end(ap); v = pParse->pVdbe; iThis = v->nOp; - sqlite3VdbeAddOp4(v, OP_Explain, iThis, pParse->addrExplain, 0, + tdsqlite3VdbeAddOp4(v, OP_Explain, iThis, pParse->addrExplain, 0, zMsg, P4_DYNAMIC); - sqlite3ExplainBreakpoint(bPush?"PUSH":"", sqlite3VdbeGetOp(v,-1)->p4.z); + tdsqlite3ExplainBreakpoint(bPush?"PUSH":"", tdsqlite3VdbeGetOp(v,-1)->p4.z); if( bPush){ pParse->addrExplain = iThis; } @@ -82232,30 +82232,30 @@ SQLITE_PRIVATE void sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt /* ** Pop the EXPLAIN QUERY PLAN stack one level. */ -SQLITE_PRIVATE void sqlite3VdbeExplainPop(Parse *pParse){ - sqlite3ExplainBreakpoint("POP", 0); - pParse->addrExplain = sqlite3VdbeExplainParent(pParse); +SQLITE_PRIVATE void tdsqlite3VdbeExplainPop(Parse *pParse){ + tdsqlite3ExplainBreakpoint("POP", 0); + pParse->addrExplain = tdsqlite3VdbeExplainParent(pParse); } #endif /* SQLITE_OMIT_EXPLAIN */ /* ** Add an OP_ParseSchema opcode. This routine is broken out from -** sqlite3VdbeAddOp4() since it needs to also needs to mark all btrees +** tdsqlite3VdbeAddOp4() since it needs to also needs to mark all btrees ** as having been used. ** -** The zWhere string must have been obtained from sqlite3_malloc(). +** The zWhere string must have been obtained from tdsqlite3_malloc(). ** This routine will take ownership of the allocated memory. */ -SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere){ +SQLITE_PRIVATE void tdsqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere){ int j; - sqlite3VdbeAddOp4(p, OP_ParseSchema, iDb, 0, 0, zWhere, P4_DYNAMIC); - for(j=0; jdb->nDb; j++) sqlite3VdbeUsesBtree(p, j); + tdsqlite3VdbeAddOp4(p, OP_ParseSchema, iDb, 0, 0, zWhere, P4_DYNAMIC); + for(j=0; jdb->nDb; j++) tdsqlite3VdbeUsesBtree(p, j); } /* ** Add an opcode that includes the p4 value as an integer. */ -SQLITE_PRIVATE int sqlite3VdbeAddOp4Int( +SQLITE_PRIVATE int tdsqlite3VdbeAddOp4Int( Vdbe *p, /* Add the opcode to this VM */ int op, /* The new opcode */ int p1, /* The P1 operand */ @@ -82263,7 +82263,7 @@ SQLITE_PRIVATE int sqlite3VdbeAddOp4Int( int p3, /* The P3 operand */ int p4 /* The P4 operand as an integer */ ){ - int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3); + int addr = tdsqlite3VdbeAddOp3(p, op, p1, p2, p3); if( p->db->mallocFailed==0 ){ VdbeOp *pOp = &p->aOp[addr]; pOp->p4type = P4_INT32; @@ -82274,8 +82274,8 @@ SQLITE_PRIVATE int sqlite3VdbeAddOp4Int( /* Insert the end of a co-routine */ -SQLITE_PRIVATE void sqlite3VdbeEndCoroutine(Vdbe *v, int regYield){ - sqlite3VdbeAddOp1(v, OP_EndCoroutine, regYield); +SQLITE_PRIVATE void tdsqlite3VdbeEndCoroutine(Vdbe *v, int regYield){ + tdsqlite3VdbeAddOp1(v, OP_EndCoroutine, regYield); /* Clear the temporary register cache, thereby ensuring that each ** co-routine has its own independent set of registers, because co-routines @@ -82312,18 +82312,18 @@ SQLITE_PRIVATE void sqlite3VdbeEndCoroutine(Vdbe *v, int regYield){ ** that gives a performance improvement over storing ** the equivalent positive value. */ -SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Parse *pParse){ +SQLITE_PRIVATE int tdsqlite3VdbeMakeLabel(Parse *pParse){ return --pParse->nLabel; } /* ** Resolve label "x" to be the address of the next instruction to ** be inserted. The parameter "x" must have been obtained from -** a prior call to sqlite3VdbeMakeLabel(). +** a prior call to tdsqlite3VdbeMakeLabel(). */ static SQLITE_NOINLINE void resizeResolveLabel(Parse *p, Vdbe *v, int j){ int nNewSize = 10 - p->nLabel; - p->aLabel = sqlite3DbReallocOrFree(p->db, p->aLabel, + p->aLabel = tdsqlite3DbReallocOrFree(p->db, p->aLabel, nNewSize*sizeof(p->aLabel[0])); if( p->aLabel==0 ){ p->nLabelAlloc = 0; @@ -82336,7 +82336,7 @@ static SQLITE_NOINLINE void resizeResolveLabel(Parse *p, Vdbe *v, int j){ p->aLabel[j] = v->nOp; } } -SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){ +SQLITE_PRIVATE void tdsqlite3VdbeResolveLabel(Vdbe *v, int x){ Parse *p = v->pParse; int j = ADDR(x); assert( v->magic==VDBE_MAGIC_INIT ); @@ -82358,18 +82358,18 @@ SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){ /* ** Mark the VDBE as one that can only be run one time. */ -SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){ +SQLITE_PRIVATE void tdsqlite3VdbeRunOnlyOnce(Vdbe *p){ p->runOnlyOnce = 1; } /* ** Mark the VDBE as one that can only be run multiple times. */ -SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe *p){ +SQLITE_PRIVATE void tdsqlite3VdbeReusable(Vdbe *p){ p->runOnlyOnce = 0; } -#ifdef SQLITE_DEBUG /* sqlite3AssertMayAbort() logic */ +#ifdef SQLITE_DEBUG /* tdsqlite3AssertMayAbort() logic */ /* ** The following type and function are used to iterate through all opcodes @@ -82384,7 +82384,7 @@ SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe *p){ ** while( (pOp = opIterNext(&sIter)) ){ ** // Do something with pOp ** } -** sqlite3DbFree(v->db, sIter.apSub); +** tdsqlite3DbFree(v->db, sIter.apSub); ** */ typedef struct VdbeOpIter VdbeOpIter; @@ -82426,7 +82426,7 @@ static Op *opIterNext(VdbeOpIter *p){ if( p->apSub[j]==pRet->p4.pProgram ) break; } if( j==p->nSub ){ - p->apSub = sqlite3DbReallocOrFree(v->db, p->apSub, nByte); + p->apSub = tdsqlite3DbReallocOrFree(v->db, p->apSub, nByte); if( !p->apSub ){ pRet = 0; }else{ @@ -82460,9 +82460,9 @@ static Op *opIterNext(VdbeOpIter *p){ ** match, or false otherwise. This function is intended to be used as ** part of an assert statement in the compiler. Similar to: ** -** assert( sqlite3VdbeAssertMayAbort(pParse->pVdbe, pParse->mayAbort) ); +** assert( tdsqlite3VdbeAssertMayAbort(pParse->pVdbe, pParse->mayAbort) ); */ -SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ +SQLITE_PRIVATE int tdsqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ int hasAbort = 0; int hasFkCounter = 0; int hasCreateTable = 0; @@ -82501,7 +82501,7 @@ SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ } #endif } - sqlite3DbFree(v->db, sIter.apSub); + tdsqlite3DbFree(v->db, sIter.apSub); /* Return true if hasAbort==mayAbort. Or if a malloc failure occurred. ** If malloc failed, then the while() loop above may not have iterated @@ -82512,14 +82512,14 @@ SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ || (hasCreateTable && hasInitCoroutine) || hasCreateIndex ); } -#endif /* SQLITE_DEBUG - the sqlite3AssertMayAbort() function */ +#endif /* SQLITE_DEBUG - the tdsqlite3AssertMayAbort() function */ #ifdef SQLITE_DEBUG /* ** Increment the nWrite counter in the VDBE if the cursor is not an ** ephemeral cursor, or if the cursor argument is NULL. */ -SQLITE_PRIVATE void sqlite3VdbeIncrWriteCounter(Vdbe *p, VdbeCursor *pC){ +SQLITE_PRIVATE void tdsqlite3VdbeIncrWriteCounter(Vdbe *p, VdbeCursor *pC){ if( pC==0 || (pC->eCurType!=CURTYPE_SORTER && pC->eCurType!=CURTYPE_PSEUDO @@ -82535,7 +82535,7 @@ SQLITE_PRIVATE void sqlite3VdbeIncrWriteCounter(Vdbe *p, VdbeCursor *pC){ ** Assert if an Abort at this point in time might result in a corrupt ** database. */ -SQLITE_PRIVATE void sqlite3VdbeAssertAbortable(Vdbe *p){ +SQLITE_PRIVATE void tdsqlite3VdbeAssertAbortable(Vdbe *p){ assert( p->nWrite==0 || p->usesStmtJournal ); } #endif @@ -82601,7 +82601,7 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){ } case OP_Next: case OP_SorterNext: { - pOp->p4.xAdvance = sqlite3BtreeNext; + pOp->p4.xAdvance = tdsqlite3BtreeNext; pOp->p4type = P4_ADVANCE; /* The code generator never codes any of these opcodes as a jump ** to a label. They are always coded as a jump backwards to a @@ -82610,7 +82610,7 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){ break; } case OP_Prev: { - pOp->p4.xAdvance = sqlite3BtreePrevious; + pOp->p4.xAdvance = tdsqlite3BtreePrevious; pOp->p4type = P4_ADVANCE; /* The code generator never codes any of these opcodes as a jump ** to a label. They are always coded as a jump backwards to a @@ -82637,7 +82637,7 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){ /* The mkopcodeh.tcl script has so arranged things that the only ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to ** have non-negative values for P2. */ - assert( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)!=0 ); + assert( (tdsqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)!=0 ); assert( ADDR(pOp->p2)<-pParse->nLabel ); pOp->p2 = aLabel[ADDR(pOp->p2)]; } @@ -82647,12 +82647,12 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){ /* The mkopcodeh.tcl script has so arranged things that the only ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to ** have non-negative values for P2. */ - assert( (sqlite3OpcodeProperty[pOp->opcode]&OPFLG_JUMP)==0 || pOp->p2>=0); + assert( (tdsqlite3OpcodeProperty[pOp->opcode]&OPFLG_JUMP)==0 || pOp->p2>=0); } if( pOp==p->aOp ) break; pOp--; } - sqlite3DbFree(p->db, pParse->aLabel); + tdsqlite3DbFree(p->db, pParse->aLabel); pParse->aLabel = 0; pParse->nLabel = 0; *pMaxFuncArgs = nMaxArgs; @@ -82662,7 +82662,7 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){ /* ** Return the address of the next instruction to be inserted. */ -SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe *p){ +SQLITE_PRIVATE int tdsqlite3VdbeCurrentAddr(Vdbe *p){ assert( p->magic==VDBE_MAGIC_INIT ); return p->nOp; } @@ -82671,12 +82671,12 @@ SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe *p){ ** Verify that at least N opcode slots are available in p without ** having to malloc for more space (except when compiled using ** SQLITE_TEST_REALLOC_STRESS). This interface is used during testing -** to verify that certain calls to sqlite3VdbeAddOpList() can never +** to verify that certain calls to tdsqlite3VdbeAddOpList() can never ** fail due to a OOM fault and hence that the return value from -** sqlite3VdbeAddOpList() will always be non-NULL. +** tdsqlite3VdbeAddOpList() will always be non-NULL. */ #if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS) -SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N){ +SQLITE_PRIVATE void tdsqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N){ assert( p->nOp + N <= p->nOpAlloc ); } #endif @@ -82689,7 +82689,7 @@ SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N){ ** script. */ #if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS) -SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p){ +SQLITE_PRIVATE void tdsqlite3VdbeVerifyNoResultRow(Vdbe *p){ int i; for(i=0; inOp; i++){ assert( p->aOp[i].opcode!=OP_ResultRow ); @@ -82703,8 +82703,8 @@ SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p){ ** context. */ #if defined(SQLITE_DEBUG) -SQLITE_PRIVATE void sqlite3VdbeVerifyAbortable(Vdbe *p, int onError){ - if( onError==OE_Abort ) sqlite3VdbeAddOp0(p, OP_Abortable); +SQLITE_PRIVATE void tdsqlite3VdbeVerifyAbortable(Vdbe *p, int onError){ + if( onError==OE_Abort ) tdsqlite3VdbeAddOp0(p, OP_Abortable); } #endif @@ -82719,11 +82719,11 @@ SQLITE_PRIVATE void sqlite3VdbeVerifyAbortable(Vdbe *p, int onError){ ** the number of entries in the Vdbe.apArg[] array required to execute the ** returned program. */ -SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe *p, int *pnOp, int *pnMaxArg){ +SQLITE_PRIVATE VdbeOp *tdsqlite3VdbeTakeOpArray(Vdbe *p, int *pnOp, int *pnMaxArg){ VdbeOp *aOp = p->aOp; assert( aOp && !p->db->mallocFailed ); - /* Check that sqlite3VdbeUsesBtree() was not called on this VM */ + /* Check that tdsqlite3VdbeUsesBtree() was not called on this VM */ assert( DbMaskAllZero(p->btreeMask) ); resolveP2Values(p, pnMaxArg); @@ -82739,7 +82739,7 @@ SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe *p, int *pnOp, int *pnMaxArg) ** Non-zero P2 arguments to jump instructions are automatically adjusted ** so that the jump target is relative to the first operation inserted. */ -SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList( +SQLITE_PRIVATE VdbeOp *tdsqlite3VdbeAddOpList( Vdbe *p, /* Add opcodes to the prepared statement */ int nOp, /* Number of opcodes to add */ VdbeOpList const *aOp, /* The opcodes to be added */ @@ -82758,7 +82758,7 @@ SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList( pOut->p1 = aOp->p1; pOut->p2 = aOp->p2; assert( aOp->p2>=0 ); - if( (sqlite3OpcodeProperty[aOp->opcode] & OPFLG_JUMP)!=0 && aOp->p2>0 ){ + if( (tdsqlite3OpcodeProperty[aOp->opcode] & OPFLG_JUMP)!=0 && aOp->p2>0 ){ pOut->p2 += p->nOp; } pOut->p3 = aOp->p3; @@ -82775,7 +82775,7 @@ SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList( #endif #ifdef SQLITE_DEBUG if( p->db->flags & SQLITE_VdbeAddopTrace ){ - sqlite3VdbePrintOp(0, i+p->nOp, &p->aOp[i+p->nOp]); + tdsqlite3VdbePrintOp(0, i+p->nOp, &p->aOp[i+p->nOp]); } #endif } @@ -82785,9 +82785,9 @@ SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList( #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) /* -** Add an entry to the array of counters managed by sqlite3_stmt_scanstatus(). +** Add an entry to the array of counters managed by tdsqlite3_stmt_scanstatus(). */ -SQLITE_PRIVATE void sqlite3VdbeScanStatus( +SQLITE_PRIVATE void tdsqlite3VdbeScanStatus( Vdbe *p, /* VM to add scanstatus() to */ int addrExplain, /* Address of OP_Explain (or 0) */ int addrLoop, /* Address of loop counter */ @@ -82795,16 +82795,16 @@ SQLITE_PRIVATE void sqlite3VdbeScanStatus( LogEst nEst, /* Estimated number of output rows */ const char *zName /* Name of table or index being scanned */ ){ - sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus); + tdsqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus); ScanStatus *aNew; - aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte); + aNew = (ScanStatus*)tdsqlite3DbRealloc(p->db, p->aScan, nByte); if( aNew ){ ScanStatus *pNew = &aNew[p->nScan++]; pNew->addrExplain = addrExplain; pNew->addrLoop = addrLoop; pNew->addrVisit = addrVisit; pNew->nEst = nEst; - pNew->zName = sqlite3DbStrDup(p->db, zName); + pNew->zName = tdsqlite3DbStrDup(p->db, zName); p->aScan = aNew; } } @@ -82815,19 +82815,19 @@ SQLITE_PRIVATE void sqlite3VdbeScanStatus( ** Change the value of the opcode, or P1, P2, P3, or P5 operands ** for a specific instruction. */ -SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe *p, int addr, u8 iNewOpcode){ - sqlite3VdbeGetOp(p,addr)->opcode = iNewOpcode; +SQLITE_PRIVATE void tdsqlite3VdbeChangeOpcode(Vdbe *p, int addr, u8 iNewOpcode){ + tdsqlite3VdbeGetOp(p,addr)->opcode = iNewOpcode; } -SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe *p, int addr, int val){ - sqlite3VdbeGetOp(p,addr)->p1 = val; +SQLITE_PRIVATE void tdsqlite3VdbeChangeP1(Vdbe *p, int addr, int val){ + tdsqlite3VdbeGetOp(p,addr)->p1 = val; } -SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe *p, int addr, int val){ - sqlite3VdbeGetOp(p,addr)->p2 = val; +SQLITE_PRIVATE void tdsqlite3VdbeChangeP2(Vdbe *p, int addr, int val){ + tdsqlite3VdbeGetOp(p,addr)->p2 = val; } -SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe *p, int addr, int val){ - sqlite3VdbeGetOp(p,addr)->p3 = val; +SQLITE_PRIVATE void tdsqlite3VdbeChangeP3(Vdbe *p, int addr, int val){ + tdsqlite3VdbeGetOp(p,addr)->p3 = val; } -SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe *p, u16 p5){ +SQLITE_PRIVATE void tdsqlite3VdbeChangeP5(Vdbe *p, u16 p5){ assert( p->nOp>0 || p->db->mallocFailed ); if( p->nOp>0 ) p->aOp[p->nOp-1].p5 = p5; } @@ -82836,8 +82836,8 @@ SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe *p, u16 p5){ ** Change the P2 operand of instruction addr so that it points to ** the address of the next instruction to be coded. */ -SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe *p, int addr){ - sqlite3VdbeChangeP2(p, addr, p->nOp); +SQLITE_PRIVATE void tdsqlite3VdbeJumpHere(Vdbe *p, int addr){ + tdsqlite3VdbeChangeP2(p, addr, p->nOp); } @@ -82845,28 +82845,28 @@ SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe *p, int addr){ ** If the input FuncDef structure is ephemeral, then free it. If ** the FuncDef is not ephermal, then do nothing. */ -static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){ +static void freeEphemeralFunction(tdsqlite3 *db, FuncDef *pDef){ if( (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){ - sqlite3DbFreeNN(db, pDef); + tdsqlite3DbFreeNN(db, pDef); } } /* ** Delete a P4 value if necessary. */ -static SQLITE_NOINLINE void freeP4Mem(sqlite3 *db, Mem *p){ - if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc); - sqlite3DbFreeNN(db, p); +static SQLITE_NOINLINE void freeP4Mem(tdsqlite3 *db, Mem *p){ + if( p->szMalloc ) tdsqlite3DbFree(db, p->zMalloc); + tdsqlite3DbFreeNN(db, p); } -static SQLITE_NOINLINE void freeP4FuncCtx(sqlite3 *db, sqlite3_context *p){ +static SQLITE_NOINLINE void freeP4FuncCtx(tdsqlite3 *db, tdsqlite3_context *p){ freeEphemeralFunction(db, p->pFunc); - sqlite3DbFreeNN(db, p); + tdsqlite3DbFreeNN(db, p); } -static void freeP4(sqlite3 *db, int p4type, void *p4){ +static void freeP4(tdsqlite3 *db, int p4type, void *p4){ assert( db ); switch( p4type ){ case P4_FUNCCTX: { - freeP4FuncCtx(db, (sqlite3_context*)p4); + freeP4FuncCtx(db, (tdsqlite3_context*)p4); break; } case P4_REAL: @@ -82874,16 +82874,16 @@ static void freeP4(sqlite3 *db, int p4type, void *p4){ case P4_DYNAMIC: case P4_DYNBLOB: case P4_INTARRAY: { - sqlite3DbFree(db, p4); + tdsqlite3DbFree(db, p4); break; } case P4_KEYINFO: { - if( db->pnBytesFreed==0 ) sqlite3KeyInfoUnref((KeyInfo*)p4); + if( db->pnBytesFreed==0 ) tdsqlite3KeyInfoUnref((KeyInfo*)p4); break; } #ifdef SQLITE_ENABLE_CURSOR_HINTS case P4_EXPR: { - sqlite3ExprDelete(db, (Expr*)p4); + tdsqlite3ExprDelete(db, (Expr*)p4); break; } #endif @@ -82893,14 +82893,14 @@ static void freeP4(sqlite3 *db, int p4type, void *p4){ } case P4_MEM: { if( db->pnBytesFreed==0 ){ - sqlite3ValueFree((sqlite3_value*)p4); + tdsqlite3ValueFree((tdsqlite3_value*)p4); }else{ freeP4Mem(db, (Mem*)p4); } break; } case P4_VTAB : { - if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4); + if( db->pnBytesFreed==0 ) tdsqlite3VtabUnlock((VTable *)p4); break; } } @@ -82911,16 +82911,16 @@ static void freeP4(sqlite3 *db, int p4type, void *p4){ ** opcodes contained within. If aOp is not NULL it is assumed to contain ** nOp entries. */ -static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){ +static void vdbeFreeOpArray(tdsqlite3 *db, Op *aOp, int nOp){ if( aOp ){ Op *pOp; for(pOp=&aOp[nOp-1]; pOp>=aOp; pOp--){ if( pOp->p4type <= P4_FREE_IF_LE ) freeP4(db, pOp->p4type, pOp->p4.p); #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS - sqlite3DbFree(db, pOp->zComment); + tdsqlite3DbFree(db, pOp->zComment); #endif } - sqlite3DbFreeNN(db, aOp); + tdsqlite3DbFreeNN(db, aOp); } } @@ -82929,7 +82929,7 @@ static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){ ** list at Vdbe.pSubProgram. This list is used to delete all sub-program ** objects when the VM is no longer required. */ -SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *pVdbe, SubProgram *p){ +SQLITE_PRIVATE void tdsqlite3VdbeLinkSubProgram(Vdbe *pVdbe, SubProgram *p){ p->pNext = pVdbe->pProgram; pVdbe->pProgram = p; } @@ -82937,14 +82937,14 @@ SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *pVdbe, SubProgram *p){ /* ** Return true if the given Vdbe has any SubPrograms. */ -SQLITE_PRIVATE int sqlite3VdbeHasSubProgram(Vdbe *pVdbe){ +SQLITE_PRIVATE int tdsqlite3VdbeHasSubProgram(Vdbe *pVdbe){ return pVdbe->pProgram!=0; } /* ** Change the opcode at addr into OP_Noop */ -SQLITE_PRIVATE int sqlite3VdbeChangeToNoop(Vdbe *p, int addr){ +SQLITE_PRIVATE int tdsqlite3VdbeChangeToNoop(Vdbe *p, int addr){ VdbeOp *pOp; if( p->db->mallocFailed ) return 0; assert( addr>=0 && addrnOp ); @@ -82960,9 +82960,9 @@ SQLITE_PRIVATE int sqlite3VdbeChangeToNoop(Vdbe *p, int addr){ ** If the last opcode is "op" and it is not a jump destination, ** then remove it. Return true if and only if an opcode was removed. */ -SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){ +SQLITE_PRIVATE int tdsqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){ if( p->nOp>0 && p->aOp[p->nOp-1].opcode==op ){ - return sqlite3VdbeChangeToNoop(p, p->nOp-1); + return tdsqlite3VdbeChangeToNoop(p, p->nOp-1); }else{ return 0; } @@ -82973,7 +82973,7 @@ SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){ ** Generate an OP_ReleaseReg opcode to indicate that a range of ** registers, except any identified by mask, are no longer in use. */ -SQLITE_PRIVATE void sqlite3VdbeReleaseRegisters( +SQLITE_PRIVATE void tdsqlite3VdbeReleaseRegisters( Parse *pParse, /* Parsing context */ int iFirst, /* Index of first register to be released */ int N, /* Number of registers to release */ @@ -82996,8 +82996,8 @@ SQLITE_PRIVATE void sqlite3VdbeReleaseRegisters( } } if( N>0 ){ - sqlite3VdbeAddOp3(pParse->pVdbe, OP_ReleaseReg, iFirst, N, *(int*)&mask); - if( bUndefine ) sqlite3VdbeChangeP5(pParse->pVdbe, 1); + tdsqlite3VdbeAddOp3(pParse->pVdbe, OP_ReleaseReg, iFirst, N, *(int*)&mask); + if( bUndefine ) tdsqlite3VdbeChangeP5(pParse->pVdbe, 1); } } #endif /* SQLITE_DEBUG */ @@ -83006,11 +83006,11 @@ SQLITE_PRIVATE void sqlite3VdbeReleaseRegisters( /* ** Change the value of the P4 operand for a specific instruction. ** This routine is useful when a large program is loaded from a -** static array using sqlite3VdbeAddOpList but we want to make a +** static array using tdsqlite3VdbeAddOpList but we want to make a ** few minor changes to the program. ** ** If n>=0 then the P4 operand is dynamic, meaning that a copy of -** the string is made into memory obtained from sqlite3_malloc(). +** the string is made into memory obtained from tdsqlite3_malloc(). ** A value of n==0 means copy bytes of zP4 up to and including the ** first null byte. If n>0 then copy n+1 bytes of zP4. ** @@ -83032,16 +83032,16 @@ static void SQLITE_NOINLINE vdbeChangeP4Full( pOp->p4.p = 0; } if( n<0 ){ - sqlite3VdbeChangeP4(p, (int)(pOp - p->aOp), zP4, n); + tdsqlite3VdbeChangeP4(p, (int)(pOp - p->aOp), zP4, n); }else{ - if( n==0 ) n = sqlite3Strlen30(zP4); - pOp->p4.z = sqlite3DbStrNDup(p->db, zP4, n); + if( n==0 ) n = tdsqlite3Strlen30(zP4); + pOp->p4.z = tdsqlite3DbStrNDup(p->db, zP4, n); pOp->p4type = P4_DYNAMIC; } } -SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){ +SQLITE_PRIVATE void tdsqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){ Op *pOp; - sqlite3 *db; + tdsqlite3 *db; assert( p!=0 ); db = p->db; assert( p->magic==VDBE_MAGIC_INIT ); @@ -83069,20 +83069,20 @@ SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int assert( n<0 ); pOp->p4.p = (void*)zP4; pOp->p4type = (signed char)n; - if( n==P4_VTAB ) sqlite3VtabLock((VTable*)zP4); + if( n==P4_VTAB ) tdsqlite3VtabLock((VTable*)zP4); } } /* ** Change the P4 operand of the most recently coded instruction ** to the value defined by the arguments. This is a high-speed -** version of sqlite3VdbeChangeP4(). +** version of tdsqlite3VdbeChangeP4(). ** ** The P4 operand must not have been previously defined. And the new -** P4 must not be P4_INT32. Use sqlite3VdbeChangeP4() in either of +** P4 must not be P4_INT32. Use tdsqlite3VdbeChangeP4() in either of ** those cases. */ -SQLITE_PRIVATE void sqlite3VdbeAppendP4(Vdbe *p, void *pP4, int n){ +SQLITE_PRIVATE void tdsqlite3VdbeAppendP4(Vdbe *p, void *pP4, int n){ VdbeOp *pOp; assert( n!=P4_INT32 && n!=P4_VTAB ); assert( n<=0 ); @@ -83102,13 +83102,13 @@ SQLITE_PRIVATE void sqlite3VdbeAppendP4(Vdbe *p, void *pP4, int n){ ** Set the P4 on the most recently added opcode to the KeyInfo for the ** index given. */ -SQLITE_PRIVATE void sqlite3VdbeSetP4KeyInfo(Parse *pParse, Index *pIdx){ +SQLITE_PRIVATE void tdsqlite3VdbeSetP4KeyInfo(Parse *pParse, Index *pIdx){ Vdbe *v = pParse->pVdbe; KeyInfo *pKeyInfo; assert( v!=0 ); assert( pIdx!=0 ); - pKeyInfo = sqlite3KeyInfoOfIndex(pParse, pIdx); - if( pKeyInfo ) sqlite3VdbeAppendP4(v, pKeyInfo, P4_KEYINFO); + pKeyInfo = tdsqlite3KeyInfoOfIndex(pParse, pIdx); + if( pKeyInfo ) tdsqlite3VdbeAppendP4(v, pKeyInfo, P4_KEYINFO); } #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS @@ -83124,11 +83124,11 @@ static void vdbeVComment(Vdbe *p, const char *zFormat, va_list ap){ || p->pParse->nErr>0 ); if( p->nOp ){ assert( p->aOp ); - sqlite3DbFree(p->db, p->aOp[p->nOp-1].zComment); - p->aOp[p->nOp-1].zComment = sqlite3VMPrintf(p->db, zFormat, ap); + tdsqlite3DbFree(p->db, p->aOp[p->nOp-1].zComment); + p->aOp[p->nOp-1].zComment = tdsqlite3VMPrintf(p->db, zFormat, ap); } } -SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe *p, const char *zFormat, ...){ +SQLITE_PRIVATE void tdsqlite3VdbeComment(Vdbe *p, const char *zFormat, ...){ va_list ap; if( p ){ va_start(ap, zFormat); @@ -83136,10 +83136,10 @@ SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe *p, const char *zFormat, ...){ va_end(ap); } } -SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){ +SQLITE_PRIVATE void tdsqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){ va_list ap; if( p ){ - sqlite3VdbeAddOp0(p, OP_Noop); + tdsqlite3VdbeAddOp0(p, OP_Noop); va_start(ap, zFormat); vdbeVComment(p, zFormat, ap); va_end(ap); @@ -83151,8 +83151,8 @@ SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){ /* ** Set the value if the iSrcLine field for the previously coded instruction. */ -SQLITE_PRIVATE void sqlite3VdbeSetLineNumber(Vdbe *v, int iLine){ - sqlite3VdbeGetOp(v,-1)->iSrcLine = iLine; +SQLITE_PRIVATE void tdsqlite3VdbeSetLineNumber(Vdbe *v, int iLine){ + tdsqlite3VdbeGetOp(v,-1)->iSrcLine = iLine; } #endif /* SQLITE_VDBE_COVERAGE */ @@ -83169,7 +83169,7 @@ SQLITE_PRIVATE void sqlite3VdbeSetLineNumber(Vdbe *v, int iLine){ ** dummy will never be written to. This is verified by code inspection and ** by running with Valgrind. */ -SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){ +SQLITE_PRIVATE VdbeOp *tdsqlite3VdbeGetOp(Vdbe *p, int addr){ /* C89 specifies that the constant "dummy" will be initialized to all ** zeros, which is correct. MSVC generates a warning, nevertheless. */ static VdbeOp dummy; /* Ignore the MSVC warning about no initializer */ @@ -83202,7 +83202,7 @@ static int translateP(char c, const Op *pOp){ ** Compute a string for the "comment" field of a VDBE opcode listing. ** ** The Synopsis: field in comments in the vdbe.c source file gets converted -** to an extra string that is appended to the sqlite3OpcodeName(). In the +** to an extra string that is appended to the tdsqlite3OpcodeName(). In the ** absence of other comments, this synopsis becomes the comment on the opcode. ** Some translation occurs: ** @@ -83222,17 +83222,17 @@ static int displayComment( int nOpName; int ii, jj; char zAlt[50]; - zOpName = sqlite3OpcodeName(pOp->opcode); - nOpName = sqlite3Strlen30(zOpName); + zOpName = tdsqlite3OpcodeName(pOp->opcode); + nOpName = tdsqlite3Strlen30(zOpName); if( zOpName[nOpName+1] ){ int seenCom = 0; char c; zSynopsis = zOpName += nOpName + 1; if( strncmp(zSynopsis,"IF ",3)==0 ){ if( pOp->p5 & SQLITE_STOREP2 ){ - sqlite3_snprintf(sizeof(zAlt), zAlt, "r[P2] = (%s)", zSynopsis+3); + tdsqlite3_snprintf(sizeof(zAlt), zAlt, "r[P2] = (%s)", zSynopsis+3); }else{ - sqlite3_snprintf(sizeof(zAlt), zAlt, "if %s goto P2", zSynopsis+3); + tdsqlite3_snprintf(sizeof(zAlt), zAlt, "if %s goto P2", zSynopsis+3); } zSynopsis = zAlt; } @@ -83240,42 +83240,42 @@ static int displayComment( if( c=='P' ){ c = zSynopsis[++ii]; if( c=='4' ){ - sqlite3_snprintf(nTemp-jj, zTemp+jj, "%s", zP4); + tdsqlite3_snprintf(nTemp-jj, zTemp+jj, "%s", zP4); }else if( c=='X' ){ - sqlite3_snprintf(nTemp-jj, zTemp+jj, "%s", pOp->zComment); + tdsqlite3_snprintf(nTemp-jj, zTemp+jj, "%s", pOp->zComment); seenCom = 1; }else{ int v1 = translateP(c, pOp); int v2; - sqlite3_snprintf(nTemp-jj, zTemp+jj, "%d", v1); + tdsqlite3_snprintf(nTemp-jj, zTemp+jj, "%d", v1); if( strncmp(zSynopsis+ii+1, "@P", 2)==0 ){ ii += 3; - jj += sqlite3Strlen30(zTemp+jj); + jj += tdsqlite3Strlen30(zTemp+jj); v2 = translateP(zSynopsis[ii], pOp); if( strncmp(zSynopsis+ii+1,"+1",2)==0 ){ ii += 2; v2++; } if( v2>1 ){ - sqlite3_snprintf(nTemp-jj, zTemp+jj, "..%d", v1+v2-1); + tdsqlite3_snprintf(nTemp-jj, zTemp+jj, "..%d", v1+v2-1); } }else if( strncmp(zSynopsis+ii+1, "..P3", 4)==0 && pOp->p3==0 ){ ii += 4; } } - jj += sqlite3Strlen30(zTemp+jj); + jj += tdsqlite3Strlen30(zTemp+jj); }else{ zTemp[jj++] = c; } } if( !seenCom && jjzComment ){ - sqlite3_snprintf(nTemp-jj, zTemp+jj, "; %s", pOp->zComment); - jj += sqlite3Strlen30(zTemp+jj); + tdsqlite3_snprintf(nTemp-jj, zTemp+jj, "; %s", pOp->zComment); + jj += tdsqlite3Strlen30(zTemp+jj); } if( jjzComment ){ - sqlite3_snprintf(nTemp, zTemp, "%s", pOp->zComment); - jj = sqlite3Strlen30(zTemp); + tdsqlite3_snprintf(nTemp, zTemp, "%s", pOp->zComment); + jj = tdsqlite3Strlen30(zTemp); }else{ zTemp[0] = 0; jj = 0; @@ -83293,23 +83293,23 @@ static void displayP4Expr(StrAccum *p, Expr *pExpr){ const char *zOp = 0; switch( pExpr->op ){ case TK_STRING: - sqlite3_str_appendf(p, "%Q", pExpr->u.zToken); + tdsqlite3_str_appendf(p, "%Q", pExpr->u.zToken); break; case TK_INTEGER: - sqlite3_str_appendf(p, "%d", pExpr->u.iValue); + tdsqlite3_str_appendf(p, "%d", pExpr->u.iValue); break; case TK_NULL: - sqlite3_str_appendf(p, "NULL"); + tdsqlite3_str_appendf(p, "NULL"); break; case TK_REGISTER: { - sqlite3_str_appendf(p, "r[%d]", pExpr->iTable); + tdsqlite3_str_appendf(p, "r[%d]", pExpr->iTable); break; } case TK_COLUMN: { if( pExpr->iColumn<0 ){ - sqlite3_str_appendf(p, "rowid"); + tdsqlite3_str_appendf(p, "rowid"); }else{ - sqlite3_str_appendf(p, "c%d", (int)pExpr->iColumn); + tdsqlite3_str_appendf(p, "c%d", (int)pExpr->iColumn); } break; } @@ -83341,18 +83341,18 @@ static void displayP4Expr(StrAccum *p, Expr *pExpr){ case TK_NOTNULL: zOp = "NOTNULL"; break; default: - sqlite3_str_appendf(p, "%s", "expr"); + tdsqlite3_str_appendf(p, "%s", "expr"); break; } if( zOp ){ - sqlite3_str_appendf(p, "%s(", zOp); + tdsqlite3_str_appendf(p, "%s(", zOp); displayP4Expr(p, pExpr->pLeft); if( pExpr->pRight ){ - sqlite3_str_append(p, ",", 1); + tdsqlite3_str_append(p, ",", 1); displayP4Expr(p, pExpr->pRight); } - sqlite3_str_append(p, ")", 1); + tdsqlite3_str_append(p, ")", 1); } } #endif /* VDBE_DISPLAY_P4 && defined(SQLITE_ENABLE_CURSOR_HINTS) */ @@ -83367,23 +83367,23 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){ char *zP4 = zTemp; StrAccum x; assert( nTemp>=20 ); - sqlite3StrAccumInit(&x, 0, zTemp, nTemp, 0); + tdsqlite3StrAccumInit(&x, 0, zTemp, nTemp, 0); switch( pOp->p4type ){ case P4_KEYINFO: { int j; KeyInfo *pKeyInfo = pOp->p4.pKeyInfo; assert( pKeyInfo->aSortFlags!=0 ); - sqlite3_str_appendf(&x, "k(%d", pKeyInfo->nKeyField); + tdsqlite3_str_appendf(&x, "k(%d", pKeyInfo->nKeyField); for(j=0; jnKeyField; j++){ CollSeq *pColl = pKeyInfo->aColl[j]; const char *zColl = pColl ? pColl->zName : ""; if( strcmp(zColl, "BINARY")==0 ) zColl = "B"; - sqlite3_str_appendf(&x, ",%s%s%s", + tdsqlite3_str_appendf(&x, ",%s%s%s", (pKeyInfo->aSortFlags[j] & KEYINFO_ORDER_DESC) ? "-" : "", (pKeyInfo->aSortFlags[j] & KEYINFO_ORDER_BIGNULL)? "N." : "", zColl); } - sqlite3_str_append(&x, ")", 1); + tdsqlite3_str_append(&x, ")", 1); break; } #ifdef SQLITE_ENABLE_CURSOR_HINTS @@ -83394,29 +83394,29 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){ #endif case P4_COLLSEQ: { CollSeq *pColl = pOp->p4.pColl; - sqlite3_str_appendf(&x, "(%.20s)", pColl->zName); + tdsqlite3_str_appendf(&x, "(%.20s)", pColl->zName); break; } case P4_FUNCDEF: { FuncDef *pDef = pOp->p4.pFunc; - sqlite3_str_appendf(&x, "%s(%d)", pDef->zName, pDef->nArg); + tdsqlite3_str_appendf(&x, "%s(%d)", pDef->zName, pDef->nArg); break; } case P4_FUNCCTX: { FuncDef *pDef = pOp->p4.pCtx->pFunc; - sqlite3_str_appendf(&x, "%s(%d)", pDef->zName, pDef->nArg); + tdsqlite3_str_appendf(&x, "%s(%d)", pDef->zName, pDef->nArg); break; } case P4_INT64: { - sqlite3_str_appendf(&x, "%lld", *pOp->p4.pI64); + tdsqlite3_str_appendf(&x, "%lld", *pOp->p4.pI64); break; } case P4_INT32: { - sqlite3_str_appendf(&x, "%d", pOp->p4.i); + tdsqlite3_str_appendf(&x, "%d", pOp->p4.i); break; } case P4_REAL: { - sqlite3_str_appendf(&x, "%.16g", *pOp->p4.pReal); + tdsqlite3_str_appendf(&x, "%.16g", *pOp->p4.pReal); break; } case P4_MEM: { @@ -83424,9 +83424,9 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){ if( pMem->flags & MEM_Str ){ zP4 = pMem->z; }else if( pMem->flags & (MEM_Int|MEM_IntReal) ){ - sqlite3_str_appendf(&x, "%lld", pMem->u.i); + tdsqlite3_str_appendf(&x, "%lld", pMem->u.i); }else if( pMem->flags & MEM_Real ){ - sqlite3_str_appendf(&x, "%.16g", pMem->u.r); + tdsqlite3_str_appendf(&x, "%.16g", pMem->u.r); }else if( pMem->flags & MEM_Null ){ zP4 = "NULL"; }else{ @@ -83437,8 +83437,8 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){ } #ifndef SQLITE_OMIT_VIRTUALTABLE case P4_VTAB: { - sqlite3_vtab *pVtab = pOp->p4.pVtab->pVtab; - sqlite3_str_appendf(&x, "vtab:%p", pVtab); + tdsqlite3_vtab *pVtab = pOp->p4.pVtab->pVtab; + tdsqlite3_str_appendf(&x, "vtab:%p", pVtab); break; } #endif @@ -83448,14 +83448,14 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){ int n = ai[0]; /* The first element of an INTARRAY is always the ** count of the number of elements to follow */ for(i=1; i<=n; i++){ - sqlite3_str_appendf(&x, ",%d", ai[i]); + tdsqlite3_str_appendf(&x, ",%d", ai[i]); } zTemp[0] = '['; - sqlite3_str_append(&x, "]", 1); + tdsqlite3_str_append(&x, "]", 1); break; } case P4_SUBPROGRAM: { - sqlite3_str_appendf(&x, "program"); + tdsqlite3_str_appendf(&x, "program"); break; } case P4_DYNBLOB: @@ -83464,7 +83464,7 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){ break; } case P4_TABLE: { - sqlite3_str_appendf(&x, "%s", pOp->p4.pTab->zName); + tdsqlite3_str_appendf(&x, "%s", pOp->p4.pTab->zName); break; } default: { @@ -83475,7 +83475,7 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){ } } } - sqlite3StrAccumFinish(&x); + tdsqlite3StrAccumFinish(&x); assert( zP4!=0 ); return zP4; } @@ -83489,11 +83489,11 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){ ** is maintained in p->btreeMask. The p->lockMask value is the subset of ** p->btreeMask of databases that will require a lock. */ -SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe *p, int i){ +SQLITE_PRIVATE void tdsqlite3VdbeUsesBtree(Vdbe *p, int i){ assert( i>=0 && idb->nDb && i<(int)sizeof(yDbMask)*8 ); assert( i<(int)sizeof(p->btreeMask)*8 ); DbMaskSet(p->btreeMask, i); - if( i!=1 && sqlite3BtreeSharable(p->db->aDb[i].pBt) ){ + if( i!=1 && tdsqlite3BtreeSharable(p->db->aDb[i].pBt) ){ DbMaskSet(p->lockMask, i); } } @@ -83507,7 +83507,7 @@ SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe *p, int i){ ** that the correct busy-handler callback is invoked if required. ** ** If SQLite is not threadsafe but does support shared-cache mode, then -** sqlite3BtreeEnter() is invoked to set the BtShared.db variables +** tdsqlite3BtreeEnter() is invoked to set the BtShared.db variables ** of all of BtShared structures accessible via the database handle ** associated with the VM. ** @@ -83520,9 +83520,9 @@ SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe *p, int i){ ** this routine is N*N. But as N is rarely more than 1, this should not ** be a problem. */ -SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe *p){ +SQLITE_PRIVATE void tdsqlite3VdbeEnter(Vdbe *p){ int i; - sqlite3 *db; + tdsqlite3 *db; Db *aDb; int nDb; if( DbMaskAllZero(p->lockMask) ) return; /* The common case */ @@ -83531,7 +83531,7 @@ SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe *p){ nDb = db->nDb; for(i=0; ilockMask,i) && ALWAYS(aDb[i].pBt!=0) ){ - sqlite3BtreeEnter(aDb[i].pBt); + tdsqlite3BtreeEnter(aDb[i].pBt); } } } @@ -83539,11 +83539,11 @@ SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe *p){ #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0 /* -** Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter(). +** Unlock all of the btrees previously locked by a call to tdsqlite3VdbeEnter(). */ static SQLITE_NOINLINE void vdbeLeave(Vdbe *p){ int i; - sqlite3 *db; + tdsqlite3 *db; Db *aDb; int nDb; db = p->db; @@ -83551,11 +83551,11 @@ static SQLITE_NOINLINE void vdbeLeave(Vdbe *p){ nDb = db->nDb; for(i=0; ilockMask,i) && ALWAYS(aDb[i].pBt!=0) ){ - sqlite3BtreeLeave(aDb[i].pBt); + tdsqlite3BtreeLeave(aDb[i].pBt); } } } -SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe *p){ +SQLITE_PRIVATE void tdsqlite3VdbeLeave(Vdbe *p){ if( DbMaskAllZero(p->lockMask) ) return; /* The common case */ vdbeLeave(p); } @@ -83565,7 +83565,7 @@ SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe *p){ /* ** Print a single opcode. This routine is used for debugging only. */ -SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE *pOut, int pc, VdbeOp *pOp){ +SQLITE_PRIVATE void tdsqlite3VdbePrintOp(FILE *pOut, int pc, VdbeOp *pOp){ char *zP4; char zPtr[50]; char zCom[100]; @@ -83577,11 +83577,11 @@ SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE *pOut, int pc, VdbeOp *pOp){ #else zCom[0] = 0; #endif - /* NB: The sqlite3OpcodeName() function is implemented by code created + /* NB: The tdsqlite3OpcodeName() function is implemented by code created ** by the mkopcodeh.awk and mkopcodec.awk scripts which extract the ** information from the vdbe.c source text */ fprintf(pOut, zFormat1, pc, - sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4, pOp->p5, + tdsqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4, pOp->p5, zCom ); fflush(pOut); @@ -83591,7 +83591,7 @@ SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE *pOut, int pc, VdbeOp *pOp){ /* ** Initialize an array of N Mem element. */ -static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){ +static void initMemArray(Mem *p, int N, tdsqlite3 *db, u16 flags){ while( (N--)>0 ){ p->db = db; p->flags = flags; @@ -83609,36 +83609,36 @@ static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){ static void releaseMemArray(Mem *p, int N){ if( p && N ){ Mem *pEnd = &p[N]; - sqlite3 *db = p->db; + tdsqlite3 *db = p->db; if( db->pnBytesFreed ){ do{ - if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc); + if( p->szMalloc ) tdsqlite3DbFree(db, p->zMalloc); }while( (++p)flags & MEM_Agg ); testcase( p->flags & MEM_Dyn ); - testcase( p->xDel==sqlite3VdbeFrameMemDel ); + testcase( p->xDel==tdsqlite3VdbeFrameMemDel ); if( p->flags&(MEM_Agg|MEM_Dyn) ){ - sqlite3VdbeMemRelease(p); + tdsqlite3VdbeMemRelease(p); }else if( p->szMalloc ){ - sqlite3DbFreeNN(db, p->zMalloc); + tdsqlite3DbFreeNN(db, p->zMalloc); p->szMalloc = 0; } @@ -83654,7 +83654,7 @@ static void releaseMemArray(Mem *p, int N){ ** ** This routine is intended for use inside of assert() statements only. */ -SQLITE_PRIVATE int sqlite3VdbeFrameIsValid(VdbeFrame *pFrame){ +SQLITE_PRIVATE int tdsqlite3VdbeFrameIsValid(VdbeFrame *pFrame){ if( pFrame->iFrameMagic!=SQLITE_FRAME_MAGIC ) return 0; return 1; } @@ -83662,15 +83662,15 @@ SQLITE_PRIVATE int sqlite3VdbeFrameIsValid(VdbeFrame *pFrame){ /* -** This is a destructor on a Mem object (which is really an sqlite3_value) +** This is a destructor on a Mem object (which is really an tdsqlite3_value) ** that deletes the Frame object that is attached to it as a blob. ** ** This routine does not delete the Frame right away. It merely adds the ** frame to a list of frames to be deleted when the Vdbe halts. */ -SQLITE_PRIVATE void sqlite3VdbeFrameMemDel(void *pArg){ +SQLITE_PRIVATE void tdsqlite3VdbeFrameMemDel(void *pArg){ VdbeFrame *pFrame = (VdbeFrame*)pArg; - assert( sqlite3VdbeFrameIsValid(pFrame) ); + assert( tdsqlite3VdbeFrameIsValid(pFrame) ); pFrame->pParent = pFrame->v->pDelFrame; pFrame->v->pDelFrame = pFrame; } @@ -83678,26 +83678,26 @@ SQLITE_PRIVATE void sqlite3VdbeFrameMemDel(void *pArg){ /* ** Delete a VdbeFrame object and its contents. VdbeFrame objects are -** allocated by the OP_Program opcode in sqlite3VdbeExec(). +** allocated by the OP_Program opcode in tdsqlite3VdbeExec(). */ -SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame *p){ +SQLITE_PRIVATE void tdsqlite3VdbeFrameDelete(VdbeFrame *p){ int i; Mem *aMem = VdbeFrameMem(p); VdbeCursor **apCsr = (VdbeCursor **)&aMem[p->nChildMem]; - assert( sqlite3VdbeFrameIsValid(p) ); + assert( tdsqlite3VdbeFrameIsValid(p) ); for(i=0; inChildCsr; i++){ - sqlite3VdbeFreeCursor(p->v, apCsr[i]); + tdsqlite3VdbeFreeCursor(p->v, apCsr[i]); } releaseMemArray(aMem, p->nChildMem); - sqlite3VdbeDeleteAuxData(p->v->db, &p->pAuxData, -1, 0); - sqlite3DbFree(p->v->db, p); + tdsqlite3VdbeDeleteAuxData(p->v->db, &p->pAuxData, -1, 0); + tdsqlite3DbFree(p->v->db, p); } #ifndef SQLITE_OMIT_EXPLAIN /* ** Give a listing of the program in the virtual machine. ** -** The interface is the same as sqlite3VdbeExec(). But instead of +** The interface is the same as tdsqlite3VdbeExec(). But instead of ** running the code, it invokes the callback once for each instruction. ** This feature is used to implement "EXPLAIN". ** @@ -83712,14 +83712,14 @@ SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame *p){ ** When p->explain==1, first the main program is listed, then each of ** the trigger subprograms are listed one by one. */ -SQLITE_PRIVATE int sqlite3VdbeList( +SQLITE_PRIVATE int tdsqlite3VdbeList( Vdbe *p /* The VDBE */ ){ int nRow; /* Stop when row count reaches this */ int nSub = 0; /* Number of sub-vdbes seen so far */ SubProgram **apSub = 0; /* Array of sub-vdbes */ Mem *pSub = 0; /* Memory cell hold array of subprogs */ - sqlite3 *db = p->db; /* The database connection */ + tdsqlite3 *db = p->db; /* The database connection */ int i; /* Loop counter */ int rc = SQLITE_OK; /* Return code */ Mem *pMem = &p->aMem[1]; /* First Mem of result set */ @@ -83732,20 +83732,20 @@ SQLITE_PRIVATE int sqlite3VdbeList( /* Even though this opcode does not use dynamic strings for ** the result, result columns may become dynamic if the user calls - ** sqlite3_column_text16(), causing a translation to UTF-16 encoding. + ** tdsqlite3_column_text16(), causing a translation to UTF-16 encoding. */ releaseMemArray(pMem, 8); p->pResultSet = 0; if( p->rc==SQLITE_NOMEM ){ - /* This happens if a malloc() inside a call to sqlite3_column_text() or - ** sqlite3_column_text16() failed. */ - sqlite3OomFault(db); + /* This happens if a malloc() inside a call to tdsqlite3_column_text() or + ** tdsqlite3_column_text16() failed. */ + tdsqlite3OomFault(db); return SQLITE_ERROR; } /* When the number of output rows reaches nRow, that means the - ** listing has finished and sqlite3_step() should return SQLITE_DONE. + ** listing has finished and tdsqlite3_step() should return SQLITE_DONE. ** nRow is the sum of the number of rows in the main program, plus ** the sum of the number of rows in all trigger subprograms encountered ** so far. The nRow value will increase as new trigger subprograms are @@ -83760,7 +83760,7 @@ SQLITE_PRIVATE int sqlite3VdbeList( assert( p->nMem>9 ); pSub = &p->aMem[9]; if( pSub->flags&MEM_Blob ){ - /* On the first call to sqlite3_step(), pSub will hold a NULL. It is + /* On the first call to tdsqlite3_step(), pSub will hold a NULL. It is ** initialized to a BLOB by the P4_SUBPROGRAM processing logic below */ nSub = pSub->n/sizeof(Vdbe*); apSub = (SubProgram **)pSub->z; @@ -83807,7 +83807,7 @@ SQLITE_PRIVATE int sqlite3VdbeList( if( apSub[j]==pOp->p4.pProgram ) break; } if( j==nSub ){ - p->rc = sqlite3VdbeMemGrow(pSub, nByte, nSub!=0); + p->rc = tdsqlite3VdbeMemGrow(pSub, nByte, nSub!=0); if( p->rc!=SQLITE_OK ){ rc = SQLITE_ERROR; break; @@ -83828,7 +83828,7 @@ SQLITE_PRIVATE int sqlite3VdbeList( if( db->u1.isInterrupted ){ p->rc = SQLITE_INTERRUPT; rc = SQLITE_ERROR; - sqlite3VdbeError(p, sqlite3ErrStr(p->rc)); + tdsqlite3VdbeError(p, tdsqlite3ErrStr(p->rc)); }else{ char *zP4; if( p->explain==1 ){ @@ -83837,9 +83837,9 @@ SQLITE_PRIVATE int sqlite3VdbeList( pMem++; pMem->flags = MEM_Static|MEM_Str|MEM_Term; - pMem->z = (char*)sqlite3OpcodeName(pOp->opcode); /* Opcode */ + pMem->z = (char*)tdsqlite3OpcodeName(pOp->opcode); /* Opcode */ assert( pMem->z!=0 ); - pMem->n = sqlite3Strlen30(pMem->z); + pMem->n = tdsqlite3Strlen30(pMem->z); pMem->enc = SQLITE_UTF8; pMem++; } @@ -83856,7 +83856,7 @@ SQLITE_PRIVATE int sqlite3VdbeList( pMem->u.i = pOp->p3; /* P3 */ pMem++; - if( sqlite3VdbeMemClearAndResize(pMem, 100) ){ /* P4 */ + if( tdsqlite3VdbeMemClearAndResize(pMem, 100) ){ /* P4 */ assert( p->db->mallocFailed ); return SQLITE_ERROR; } @@ -83864,27 +83864,27 @@ SQLITE_PRIVATE int sqlite3VdbeList( zP4 = displayP4(pOp, pMem->z, pMem->szMalloc); if( zP4!=pMem->z ){ pMem->n = 0; - sqlite3VdbeMemSetStr(pMem, zP4, -1, SQLITE_UTF8, 0); + tdsqlite3VdbeMemSetStr(pMem, zP4, -1, SQLITE_UTF8, 0); }else{ assert( pMem->z!=0 ); - pMem->n = sqlite3Strlen30(pMem->z); + pMem->n = tdsqlite3Strlen30(pMem->z); pMem->enc = SQLITE_UTF8; } pMem++; if( p->explain==1 ){ - if( sqlite3VdbeMemClearAndResize(pMem, 4) ){ + if( tdsqlite3VdbeMemClearAndResize(pMem, 4) ){ assert( p->db->mallocFailed ); return SQLITE_ERROR; } pMem->flags = MEM_Str|MEM_Term; pMem->n = 2; - sqlite3_snprintf(3, pMem->z, "%.2x", pOp->p5); /* P5 */ + tdsqlite3_snprintf(3, pMem->z, "%.2x", pOp->p5); /* P5 */ pMem->enc = SQLITE_UTF8; pMem++; #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS - if( sqlite3VdbeMemClearAndResize(pMem, 500) ){ + if( tdsqlite3VdbeMemClearAndResize(pMem, 500) ){ assert( p->db->mallocFailed ); return SQLITE_ERROR; } @@ -83910,7 +83910,7 @@ SQLITE_PRIVATE int sqlite3VdbeList( /* ** Print the SQL that was used to generate a VDBE program. */ -SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe *p){ +SQLITE_PRIVATE void tdsqlite3VdbePrintSql(Vdbe *p){ const char *z = 0; if( p->zSql ){ z = p->zSql; @@ -83918,7 +83918,7 @@ SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe *p){ const VdbeOp *pOp = &p->aOp[0]; if( pOp->opcode==OP_Init && pOp->p4.z!=0 ){ z = pOp->p4.z; - while( sqlite3Isspace(*z) ) z++; + while( tdsqlite3Isspace(*z) ) z++; } } if( z ) printf("SQL: [%s]\n", z); @@ -83929,19 +83929,19 @@ SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe *p){ /* ** Print an IOTRACE message showing SQL content. */ -SQLITE_PRIVATE void sqlite3VdbeIOTraceSql(Vdbe *p){ +SQLITE_PRIVATE void tdsqlite3VdbeIOTraceSql(Vdbe *p){ int nOp = p->nOp; VdbeOp *pOp; - if( sqlite3IoTrace==0 ) return; + if( tdsqlite3IoTrace==0 ) return; if( nOp<1 ) return; pOp = &p->aOp[0]; if( pOp->opcode==OP_Init && pOp->p4.z!=0 ){ int i, j; char z[1000]; - sqlite3_snprintf(sizeof(z), z, "%s", pOp->p4.z); - for(i=0; sqlite3Isspace(z[i]); i++){} + tdsqlite3_snprintf(sizeof(z), z, "%s", pOp->p4.z); + for(i=0; tdsqlite3Isspace(z[i]); i++){} for(j=0; z[i]; i++){ - if( sqlite3Isspace(z[i]) ){ + if( tdsqlite3Isspace(z[i]) ){ if( z[i-1]!=' ' ){ z[j++] = ' '; } @@ -83950,7 +83950,7 @@ SQLITE_PRIVATE void sqlite3VdbeIOTraceSql(Vdbe *p){ } } z[j] = 0; - sqlite3IoTrace("SQL %s\n", z); + tdsqlite3IoTrace("SQL %s\n", z); } } #endif /* !SQLITE_OMIT_TRACE && SQLITE_ENABLE_IOTRACE */ @@ -83961,8 +83961,8 @@ SQLITE_PRIVATE void sqlite3VdbeIOTraceSql(Vdbe *p){ */ struct ReusableSpace { u8 *pSpace; /* Available memory */ - sqlite3_int64 nFree; /* Bytes of available memory */ - sqlite3_int64 nNeeded; /* Total bytes that could not be allocated */ + tdsqlite3_int64 nFree; /* Bytes of available memory */ + tdsqlite3_int64 nNeeded; /* Total bytes that could not be allocated */ }; /* Try to allocate nByte bytes of 8-byte aligned bulk memory for pBuf @@ -83982,7 +83982,7 @@ struct ReusableSpace { static void *allocSpace( struct ReusableSpace *p, /* Bulk memory available for allocation */ void *pBuf, /* Pointer to a prior allocation */ - sqlite3_int64 nByte /* Bytes of memory needed */ + tdsqlite3_int64 nByte /* Bytes of memory needed */ ){ assert( EIGHT_BYTE_ALIGNMENT(p->pSpace) ); if( pBuf==0 ){ @@ -84002,7 +84002,7 @@ static void *allocSpace( ** Rewind the VDBE back to the beginning in preparation for ** running it. */ -SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){ +SQLITE_PRIVATE void tdsqlite3VdbeRewind(Vdbe *p){ #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) int i; #endif @@ -84042,24 +84042,24 @@ SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){ ** creating the virtual machine. This involves things such ** as allocating registers and initializing the program counter. ** After the VDBE has be prepped, it can be executed by one or more -** calls to sqlite3VdbeExec(). +** calls to tdsqlite3VdbeExec(). ** ** This function may be called exactly once on each virtual machine. ** After this routine is called the VM has been "packaged" and is ready ** to run. After this routine is called, further calls to -** sqlite3VdbeAddOp() functions are prohibited. This routine disconnects +** tdsqlite3VdbeAddOp() functions are prohibited. This routine disconnects ** the Vdbe from the Parse object that helped generate it so that the ** the Vdbe becomes an independent entity and the Parse object can be ** destroyed. ** -** Use the sqlite3VdbeRewind() procedure to restore a virtual machine back +** Use the tdsqlite3VdbeRewind() procedure to restore a virtual machine back ** to its initial state after it has been run. */ -SQLITE_PRIVATE void sqlite3VdbeMakeReady( +SQLITE_PRIVATE void tdsqlite3VdbeMakeReady( Vdbe *p, /* The VDBE */ Parse *pParse /* Parsing context */ ){ - sqlite3 *db; /* The database connection */ + tdsqlite3 *db; /* The database connection */ int nVar; /* Number of parameters */ int nMem; /* Number of VM memory registers */ int nCursor; /* Number of cursors required */ @@ -84108,16 +84108,16 @@ SQLITE_PRIVATE void sqlite3VdbeMakeReady( int iFirst, mx, i; if( nMem<10 ) nMem = 10; if( pParse->explain==2 ){ - sqlite3VdbeSetNumCols(p, 4); + tdsqlite3VdbeSetNumCols(p, 4); iFirst = 8; mx = 12; }else{ - sqlite3VdbeSetNumCols(p, 8); + tdsqlite3VdbeSetNumCols(p, 8); iFirst = 0; mx = 8; } for(i=iFirst; ianExec = allocSpace(&x, 0, p->nOp*sizeof(i64)); #endif if( x.nNeeded ){ - x.pSpace = p->pFree = sqlite3DbMallocRawNN(db, x.nNeeded); + x.pSpace = p->pFree = tdsqlite3DbMallocRawNN(db, x.nNeeded); x.nFree = x.nNeeded; if( !db->mallocFailed ){ p->aMem = allocSpace(&x, p->aMem, nMem*sizeof(Mem)); @@ -84173,38 +84173,38 @@ SQLITE_PRIVATE void sqlite3VdbeMakeReady( memset(p->anExec, 0, p->nOp*sizeof(i64)); #endif } - sqlite3VdbeRewind(p); + tdsqlite3VdbeRewind(p); } /* ** Close a VDBE cursor and release all the resources that cursor ** happens to hold. */ -SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){ +SQLITE_PRIVATE void tdsqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){ if( pCx==0 ){ return; } assert( pCx->pBtx==0 || pCx->eCurType==CURTYPE_BTREE ); switch( pCx->eCurType ){ case CURTYPE_SORTER: { - sqlite3VdbeSorterClose(p->db, pCx); + tdsqlite3VdbeSorterClose(p->db, pCx); break; } case CURTYPE_BTREE: { if( pCx->isEphemeral ){ - if( pCx->pBtx ) sqlite3BtreeClose(pCx->pBtx); + if( pCx->pBtx ) tdsqlite3BtreeClose(pCx->pBtx); /* The pCx->pCursor will be close automatically, if it exists, by ** the call above. */ }else{ assert( pCx->uc.pCursor!=0 ); - sqlite3BtreeCloseCursor(pCx->uc.pCursor); + tdsqlite3BtreeCloseCursor(pCx->uc.pCursor); } break; } #ifndef SQLITE_OMIT_VIRTUALTABLE case CURTYPE_VTAB: { - sqlite3_vtab_cursor *pVCur = pCx->uc.pVCur; - const sqlite3_module *pModule = pVCur->pVtab->pModule; + tdsqlite3_vtab_cursor *pVCur = pCx->uc.pVCur; + const tdsqlite3_module *pModule = pVCur->pVtab->pModule; assert( pVCur->pVtab->nRef>0 ); pVCur->pVtab->nRef--; pModule->xClose(pVCur); @@ -84223,7 +84223,7 @@ static void closeCursorsInFrame(Vdbe *p){ for(i=0; inCursor; i++){ VdbeCursor *pC = p->apCsr[i]; if( pC ){ - sqlite3VdbeFreeCursor(p, pC); + tdsqlite3VdbeFreeCursor(p, pC); p->apCsr[i] = 0; } } @@ -84235,7 +84235,7 @@ static void closeCursorsInFrame(Vdbe *p){ ** is used, for example, when a trigger sub-program is halted to restore ** control to the main program. */ -SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *pFrame){ +SQLITE_PRIVATE int tdsqlite3VdbeFrameRestore(VdbeFrame *pFrame){ Vdbe *v = pFrame->v; closeCursorsInFrame(v); #ifdef SQLITE_ENABLE_STMT_SCANSTATUS @@ -84250,7 +84250,7 @@ SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *pFrame){ v->db->lastRowid = pFrame->lastRowid; v->nChange = pFrame->nChange; v->db->nChange = pFrame->nDbChange; - sqlite3VdbeDeleteAuxData(v->db, &v->pAuxData, -1, 0); + tdsqlite3VdbeDeleteAuxData(v->db, &v->pAuxData, -1, 0); v->pAuxData = pFrame->pAuxData; pFrame->pAuxData = 0; return pFrame->pc; @@ -84268,7 +84268,7 @@ static void closeAllCursors(Vdbe *p){ if( p->pFrame ){ VdbeFrame *pFrame; for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent); - sqlite3VdbeFrameRestore(pFrame); + tdsqlite3VdbeFrameRestore(pFrame); p->pFrame = 0; p->nFrame = 0; } @@ -84280,31 +84280,31 @@ static void closeAllCursors(Vdbe *p){ while( p->pDelFrame ){ VdbeFrame *pDel = p->pDelFrame; p->pDelFrame = pDel->pParent; - sqlite3VdbeFrameDelete(pDel); + tdsqlite3VdbeFrameDelete(pDel); } /* Delete any auxdata allocations made by the VM */ - if( p->pAuxData ) sqlite3VdbeDeleteAuxData(p->db, &p->pAuxData, -1, 0); + if( p->pAuxData ) tdsqlite3VdbeDeleteAuxData(p->db, &p->pAuxData, -1, 0); assert( p->pAuxData==0 ); } /* ** Set the number of result columns that will be returned by this SQL ** statement. This is now set at compile time, rather than during -** execution of the vdbe program so that sqlite3_column_count() can -** be called on an SQL statement before sqlite3_step(). +** execution of the vdbe program so that tdsqlite3_column_count() can +** be called on an SQL statement before tdsqlite3_step(). */ -SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){ +SQLITE_PRIVATE void tdsqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){ int n; - sqlite3 *db = p->db; + tdsqlite3 *db = p->db; if( p->nResColumn ){ releaseMemArray(p->aColName, p->nResColumn*COLNAME_N); - sqlite3DbFree(db, p->aColName); + tdsqlite3DbFree(db, p->aColName); } n = nResColumn*COLNAME_N; p->nResColumn = (u16)nResColumn; - p->aColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n ); + p->aColName = (Mem*)tdsqlite3DbMallocRawNN(db, sizeof(Mem)*n ); if( p->aColName==0 ) return; initMemArray(p->aColName, n, db, MEM_Null); } @@ -84313,13 +84313,13 @@ SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){ ** Set the name of the idx'th column to be returned by the SQL statement. ** zName must be a pointer to a nul terminated string. ** -** This call must be made after a call to sqlite3VdbeSetNumCols(). +** This call must be made after a call to tdsqlite3VdbeSetNumCols(). ** ** The final parameter, xDel, must be one of SQLITE_DYNAMIC, SQLITE_STATIC ** or SQLITE_TRANSIENT. If it is SQLITE_DYNAMIC, then the buffer pointed -** to by zName will be freed by sqlite3DbFree() when the vdbe is destroyed. +** to by zName will be freed by tdsqlite3DbFree() when the vdbe is destroyed. */ -SQLITE_PRIVATE int sqlite3VdbeSetColName( +SQLITE_PRIVATE int tdsqlite3VdbeSetColName( Vdbe *p, /* Vdbe being configured */ int idx, /* Index of column zName applies to */ int var, /* One of the COLNAME_* constants */ @@ -84336,7 +84336,7 @@ SQLITE_PRIVATE int sqlite3VdbeSetColName( } assert( p->aColName!=0 ); pColName = &(p->aColName[idx+var*p->nResColumn]); - rc = sqlite3VdbeMemSetStr(pColName, zName, -1, SQLITE_UTF8, xDel); + rc = tdsqlite3VdbeMemSetStr(pColName, zName, -1, SQLITE_UTF8, xDel); assert( rc!=0 || !zName || (pColName->flags&MEM_Term)!=0 ); return rc; } @@ -84347,7 +84347,7 @@ SQLITE_PRIVATE int sqlite3VdbeSetColName( ** write-transaction spanning more than one database file, this routine ** takes care of the master journal trickery. */ -static int vdbeCommit(sqlite3 *db, Vdbe *p){ +static int vdbeCommit(tdsqlite3 *db, Vdbe *p){ int i; int nTrans = 0; /* Number of databases with an active write-transaction ** that are candidates for a two-phase commit using a @@ -84356,7 +84356,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ int needXcommit = 0; #ifdef SQLITE_OMIT_VIRTUALTABLE - /* With this option, sqlite3VtabSync() is defined to be simply + /* With this option, tdsqlite3VtabSync() is defined to be simply ** SQLITE_OK so p is not used. */ UNUSED_PARAMETER(p); @@ -84368,7 +84368,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ ** required, as an xSync() callback may add an attached database ** to the transaction. */ - rc = sqlite3VtabSync(db, p); + rc = tdsqlite3VtabSync(db, p); /* This loop determines (a) if the commit hook should be invoked and ** (b) how many database files have open write transactions, not @@ -84378,7 +84378,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ */ for(i=0; rc==SQLITE_OK && inDb; i++){ Btree *pBt = db->aDb[i].pBt; - if( sqlite3BtreeIsInTrans(pBt) ){ + if( tdsqlite3BtreeIsInTrans(pBt) ){ /* Whether or not a database might need a master journal depends upon ** its journal mode (among other things). This matrix determines which ** journal modes use a master journal and which do not */ @@ -84392,17 +84392,17 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ }; Pager *pPager; /* Pager associated with pBt */ needXcommit = 1; - sqlite3BtreeEnter(pBt); - pPager = sqlite3BtreePager(pBt); + tdsqlite3BtreeEnter(pBt); + pPager = tdsqlite3BtreePager(pBt); if( db->aDb[i].safety_level!=PAGER_SYNCHRONOUS_OFF - && aMJNeeded[sqlite3PagerGetJournalMode(pPager)] - && sqlite3PagerIsMemdb(pPager)==0 + && aMJNeeded[tdsqlite3PagerGetJournalMode(pPager)] + && tdsqlite3PagerIsMemdb(pPager)==0 ){ assert( i!=1 ); nTrans++; } - rc = sqlite3PagerExclusiveLock(pPager); - sqlite3BtreeLeave(pBt); + rc = tdsqlite3PagerExclusiveLock(pPager); + tdsqlite3BtreeLeave(pBt); } } if( rc!=SQLITE_OK ){ @@ -84421,18 +84421,18 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ ** TEMP database) has a transaction active. There is no need for the ** master-journal. ** - ** If the return value of sqlite3BtreeGetFilename() is a zero length + ** If the return value of tdsqlite3BtreeGetFilename() is a zero length ** string, it means the main database is :memory: or a temp file. In ** that case we do not support atomic multi-file commits, so use the ** simple case then too. */ - if( 0==sqlite3Strlen30(sqlite3BtreeGetFilename(db->aDb[0].pBt)) + if( 0==tdsqlite3Strlen30(tdsqlite3BtreeGetFilename(db->aDb[0].pBt)) || nTrans<=1 ){ for(i=0; rc==SQLITE_OK && inDb; i++){ Btree *pBt = db->aDb[i].pBt; if( pBt ){ - rc = sqlite3BtreeCommitPhaseOne(pBt, 0); + rc = tdsqlite3BtreeCommitPhaseOne(pBt, 0); } } @@ -84444,11 +84444,11 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ for(i=0; rc==SQLITE_OK && inDb; i++){ Btree *pBt = db->aDb[i].pBt; if( pBt ){ - rc = sqlite3BtreeCommitPhaseTwo(pBt, 0); + rc = tdsqlite3BtreeCommitPhaseTwo(pBt, 0); } } if( rc==SQLITE_OK ){ - sqlite3VtabCommit(db); + tdsqlite3VtabCommit(db); } } @@ -84458,49 +84458,49 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ */ #ifndef SQLITE_OMIT_DISKIO else{ - sqlite3_vfs *pVfs = db->pVfs; + tdsqlite3_vfs *pVfs = db->pVfs; char *zMaster = 0; /* File-name for the master journal */ - char const *zMainFile = sqlite3BtreeGetFilename(db->aDb[0].pBt); - sqlite3_file *pMaster = 0; + char const *zMainFile = tdsqlite3BtreeGetFilename(db->aDb[0].pBt); + tdsqlite3_file *pMaster = 0; i64 offset = 0; int res; int retryCount = 0; int nMainFile; /* Select a master journal file name */ - nMainFile = sqlite3Strlen30(zMainFile); - zMaster = sqlite3MPrintf(db, "%s-mjXXXXXX9XXz%c%c", zMainFile, 0, 0); + nMainFile = tdsqlite3Strlen30(zMainFile); + zMaster = tdsqlite3MPrintf(db, "%s-mjXXXXXX9XXz%c%c", zMainFile, 0, 0); if( zMaster==0 ) return SQLITE_NOMEM_BKPT; do { u32 iRandom; if( retryCount ){ if( retryCount>100 ){ - sqlite3_log(SQLITE_FULL, "MJ delete: %s", zMaster); - sqlite3OsDelete(pVfs, zMaster, 0); + tdsqlite3_log(SQLITE_FULL, "MJ delete: %s", zMaster); + tdsqlite3OsDelete(pVfs, zMaster, 0); break; }else if( retryCount==1 ){ - sqlite3_log(SQLITE_FULL, "MJ collide: %s", zMaster); + tdsqlite3_log(SQLITE_FULL, "MJ collide: %s", zMaster); } } retryCount++; - sqlite3_randomness(sizeof(iRandom), &iRandom); - sqlite3_snprintf(13, &zMaster[nMainFile], "-mj%06X9%02X", + tdsqlite3_randomness(sizeof(iRandom), &iRandom); + tdsqlite3_snprintf(13, &zMaster[nMainFile], "-mj%06X9%02X", (iRandom>>8)&0xffffff, iRandom&0xff); /* The antipenultimate character of the master journal name must ** be "9" to avoid name collisions when using 8+3 filenames. */ - assert( zMaster[sqlite3Strlen30(zMaster)-3]=='9' ); - sqlite3FileSuffix3(zMainFile, zMaster); - rc = sqlite3OsAccess(pVfs, zMaster, SQLITE_ACCESS_EXISTS, &res); + assert( zMaster[tdsqlite3Strlen30(zMaster)-3]=='9' ); + tdsqlite3FileSuffix3(zMainFile, zMaster); + rc = tdsqlite3OsAccess(pVfs, zMaster, SQLITE_ACCESS_EXISTS, &res); }while( rc==SQLITE_OK && res ); if( rc==SQLITE_OK ){ /* Open the master journal. */ - rc = sqlite3OsOpenMalloc(pVfs, zMaster, &pMaster, + rc = tdsqlite3OsOpenMalloc(pVfs, zMaster, &pMaster, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE| SQLITE_OPEN_EXCLUSIVE|SQLITE_OPEN_MASTER_JOURNAL, 0 ); } if( rc!=SQLITE_OK ){ - sqlite3DbFree(db, zMaster); + tdsqlite3DbFree(db, zMaster); return rc; } @@ -84512,18 +84512,18 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ */ for(i=0; inDb; i++){ Btree *pBt = db->aDb[i].pBt; - if( sqlite3BtreeIsInTrans(pBt) ){ - char const *zFile = sqlite3BtreeGetJournalname(pBt); + if( tdsqlite3BtreeIsInTrans(pBt) ){ + char const *zFile = tdsqlite3BtreeGetJournalname(pBt); if( zFile==0 ){ continue; /* Ignore TEMP and :memory: databases */ } assert( zFile[0]!=0 ); - rc = sqlite3OsWrite(pMaster, zFile, sqlite3Strlen30(zFile)+1, offset); - offset += sqlite3Strlen30(zFile)+1; + rc = tdsqlite3OsWrite(pMaster, zFile, tdsqlite3Strlen30(zFile)+1, offset); + offset += tdsqlite3Strlen30(zFile)+1; if( rc!=SQLITE_OK ){ - sqlite3OsCloseFree(pMaster); - sqlite3OsDelete(pVfs, zMaster, 0); - sqlite3DbFree(db, zMaster); + tdsqlite3OsCloseFree(pMaster); + tdsqlite3OsDelete(pVfs, zMaster, 0); + tdsqlite3DbFree(db, zMaster); return rc; } } @@ -84532,12 +84532,12 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ /* Sync the master journal file. If the IOCAP_SEQUENTIAL device ** flag is set this is not required. */ - if( 0==(sqlite3OsDeviceCharacteristics(pMaster)&SQLITE_IOCAP_SEQUENTIAL) - && SQLITE_OK!=(rc = sqlite3OsSync(pMaster, SQLITE_SYNC_NORMAL)) + if( 0==(tdsqlite3OsDeviceCharacteristics(pMaster)&SQLITE_IOCAP_SEQUENTIAL) + && SQLITE_OK!=(rc = tdsqlite3OsSync(pMaster, SQLITE_SYNC_NORMAL)) ){ - sqlite3OsCloseFree(pMaster); - sqlite3OsDelete(pVfs, zMaster, 0); - sqlite3DbFree(db, zMaster); + tdsqlite3OsCloseFree(pMaster); + tdsqlite3OsDelete(pVfs, zMaster, 0); + tdsqlite3DbFree(db, zMaster); return rc; } @@ -84546,7 +84546,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ ** an error occurs here, do not delete the master journal file. ** ** If the error occurs during the first call to - ** sqlite3BtreeCommitPhaseOne(), then there is a chance that the + ** tdsqlite3BtreeCommitPhaseOne(), then there is a chance that the ** master journal file will be orphaned. But we cannot delete it, ** in case the master journal file name was written into the journal ** file before the failure occurred. @@ -84554,13 +84554,13 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ for(i=0; rc==SQLITE_OK && inDb; i++){ Btree *pBt = db->aDb[i].pBt; if( pBt ){ - rc = sqlite3BtreeCommitPhaseOne(pBt, zMaster); + rc = tdsqlite3BtreeCommitPhaseOne(pBt, zMaster); } } - sqlite3OsCloseFree(pMaster); + tdsqlite3OsCloseFree(pMaster); assert( rc!=SQLITE_BUSY ); if( rc!=SQLITE_OK ){ - sqlite3DbFree(db, zMaster); + tdsqlite3DbFree(db, zMaster); return rc; } @@ -84568,32 +84568,32 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ ** doing this the directory is synced again before any individual ** transaction files are deleted. */ - rc = sqlite3OsDelete(pVfs, zMaster, 1); - sqlite3DbFree(db, zMaster); + rc = tdsqlite3OsDelete(pVfs, zMaster, 1); + tdsqlite3DbFree(db, zMaster); zMaster = 0; if( rc ){ return rc; } /* All files and directories have already been synced, so the following - ** calls to sqlite3BtreeCommitPhaseTwo() are only closing files and + ** calls to tdsqlite3BtreeCommitPhaseTwo() are only closing files and ** deleting or truncating journals. If something goes wrong while ** this is happening we don't really care. The integrity of the ** transaction is already guaranteed, but some stray 'cold' journals ** may be lying around. Returning an error code won't help matters. */ disable_simulated_io_errors(); - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); for(i=0; inDb; i++){ Btree *pBt = db->aDb[i].pBt; if( pBt ){ - sqlite3BtreeCommitPhaseTwo(pBt, 1); + tdsqlite3BtreeCommitPhaseTwo(pBt, 1); } } - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); enable_simulated_io_errors(); - sqlite3VtabCommit(db); + tdsqlite3VtabCommit(db); } #endif @@ -84610,14 +84610,14 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ ** This is a no-op if NDEBUG is defined. */ #ifndef NDEBUG -static void checkActiveVdbeCnt(sqlite3 *db){ +static void checkActiveVdbeCnt(tdsqlite3 *db){ Vdbe *p; int cnt = 0; int nWrite = 0; int nRead = 0; p = db->pVdbe; while( p ){ - if( sqlite3_stmt_busy((sqlite3_stmt*)p) ){ + if( tdsqlite3_stmt_busy((tdsqlite3_stmt*)p) ){ cnt++; if( p->readOnly==0 ) nWrite++; if( p->bIsReader ) nRead++; @@ -84643,7 +84643,7 @@ static void checkActiveVdbeCnt(sqlite3 *db){ ** Otherwise SQLITE_OK. */ static SQLITE_NOINLINE int vdbeCloseStatement(Vdbe *p, int eOp){ - sqlite3 *const db = p->db; + tdsqlite3 *const db = p->db; int rc = SQLITE_OK; int i; const int iSavepoint = p->iStatement-1; @@ -84657,10 +84657,10 @@ static SQLITE_NOINLINE int vdbeCloseStatement(Vdbe *p, int eOp){ Btree *pBt = db->aDb[i].pBt; if( pBt ){ if( eOp==SAVEPOINT_ROLLBACK ){ - rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_ROLLBACK, iSavepoint); + rc2 = tdsqlite3BtreeSavepoint(pBt, SAVEPOINT_ROLLBACK, iSavepoint); } if( rc2==SQLITE_OK ){ - rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_RELEASE, iSavepoint); + rc2 = tdsqlite3BtreeSavepoint(pBt, SAVEPOINT_RELEASE, iSavepoint); } if( rc==SQLITE_OK ){ rc = rc2; @@ -84672,10 +84672,10 @@ static SQLITE_NOINLINE int vdbeCloseStatement(Vdbe *p, int eOp){ if( rc==SQLITE_OK ){ if( eOp==SAVEPOINT_ROLLBACK ){ - rc = sqlite3VtabSavepoint(db, SAVEPOINT_ROLLBACK, iSavepoint); + rc = tdsqlite3VtabSavepoint(db, SAVEPOINT_ROLLBACK, iSavepoint); } if( rc==SQLITE_OK ){ - rc = sqlite3VtabSavepoint(db, SAVEPOINT_RELEASE, iSavepoint); + rc = tdsqlite3VtabSavepoint(db, SAVEPOINT_RELEASE, iSavepoint); } } @@ -84688,7 +84688,7 @@ static SQLITE_NOINLINE int vdbeCloseStatement(Vdbe *p, int eOp){ } return rc; } -SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *p, int eOp){ +SQLITE_PRIVATE int tdsqlite3VdbeCloseStatement(Vdbe *p, int eOp){ if( p->db->nStatement && p->iStatement ){ return vdbeCloseStatement(p, eOp); } @@ -84707,14 +84707,14 @@ SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *p, int eOp){ ** and write an error message to it. Then return SQLITE_ERROR. */ #ifndef SQLITE_OMIT_FOREIGN_KEY -SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *p, int deferred){ - sqlite3 *db = p->db; +SQLITE_PRIVATE int tdsqlite3VdbeCheckFk(Vdbe *p, int deferred){ + tdsqlite3 *db = p->db; if( (deferred && (db->nDeferredCons+db->nDeferredImmCons)>0) || (!deferred && p->nFkConstraint>0) ){ p->rc = SQLITE_CONSTRAINT_FOREIGNKEY; p->errorAction = OE_Abort; - sqlite3VdbeError(p, "FOREIGN KEY constraint failed"); + tdsqlite3VdbeError(p, "FOREIGN KEY constraint failed"); return SQLITE_ERROR; } return SQLITE_OK; @@ -84734,9 +84734,9 @@ SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *p, int deferred){ ** lock contention, return SQLITE_BUSY. If SQLITE_BUSY is returned, it ** means the close did not happen and needs to be repeated. */ -SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ +SQLITE_PRIVATE int tdsqlite3VdbeHalt(Vdbe *p){ int rc; /* Used to store transient return codes */ - sqlite3 *db = p->db; + tdsqlite3 *db = p->db; /* This function contains the logic that determines if a statement or ** transaction will be committed or rolled back as a result of the @@ -84771,7 +84771,7 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ int isSpecialError; /* Set to true if a 'special' error */ /* Lock all btrees used by the statement */ - sqlite3VdbeEnter(p); + tdsqlite3VdbeEnter(p); /* Check for one of the special errors */ mrc = p->rc & 0xff; @@ -84797,8 +84797,8 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ /* We are forced to roll back the active transaction. Before doing ** so, abort any other statements this handle currently has active. */ - sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); - sqlite3CloseSavepoints(db); + tdsqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); + tdsqlite3CloseSavepoints(db); db->autoCommit = 1; p->nChange = 0; } @@ -84807,7 +84807,7 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ /* Check for immediate foreign key violations. */ if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){ - sqlite3VdbeCheckFk(p, 0); + tdsqlite3VdbeCheckFk(p, 0); } /* If the auto-commit flag is set and this is the only active writer @@ -84816,15 +84816,15 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ ** Note: This block also runs if one of the special errors handled ** above has occurred. */ - if( !sqlite3VtabInSync(db) + if( !tdsqlite3VtabInSync(db) && db->autoCommit && db->nVdbeWrite==(p->readOnly==0) ){ if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){ - rc = sqlite3VdbeCheckFk(p, 1); + rc = tdsqlite3VdbeCheckFk(p, 1); if( rc!=SQLITE_OK ){ if( NEVER(p->readOnly) ){ - sqlite3VdbeLeave(p); + tdsqlite3VdbeLeave(p); return SQLITE_ERROR; } rc = SQLITE_CONSTRAINT_FOREIGNKEY; @@ -84836,20 +84836,20 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ rc = vdbeCommit(db, p); } if( rc==SQLITE_BUSY && p->readOnly ){ - sqlite3VdbeLeave(p); + tdsqlite3VdbeLeave(p); return SQLITE_BUSY; }else if( rc!=SQLITE_OK ){ p->rc = rc; - sqlite3RollbackAll(db, SQLITE_OK); + tdsqlite3RollbackAll(db, SQLITE_OK); p->nChange = 0; }else{ db->nDeferredCons = 0; db->nDeferredImmCons = 0; db->flags &= ~(u64)SQLITE_DeferFKs; - sqlite3CommitInternalChanges(db); + tdsqlite3CommitInternalChanges(db); } }else{ - sqlite3RollbackAll(db, SQLITE_OK); + tdsqlite3RollbackAll(db, SQLITE_OK); p->nChange = 0; } db->nStatement = 0; @@ -84859,29 +84859,29 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ }else if( p->errorAction==OE_Abort ){ eStatementOp = SAVEPOINT_ROLLBACK; }else{ - sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); - sqlite3CloseSavepoints(db); + tdsqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); + tdsqlite3CloseSavepoints(db); db->autoCommit = 1; p->nChange = 0; } } /* If eStatementOp is non-zero, then a statement transaction needs to - ** be committed or rolled back. Call sqlite3VdbeCloseStatement() to + ** be committed or rolled back. Call tdsqlite3VdbeCloseStatement() to ** do so. If this operation returns an error, and the current statement ** error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the ** current statement error code. */ if( eStatementOp ){ - rc = sqlite3VdbeCloseStatement(p, eStatementOp); + rc = tdsqlite3VdbeCloseStatement(p, eStatementOp); if( rc ){ if( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_CONSTRAINT ){ p->rc = rc; - sqlite3DbFree(db, p->zErrMsg); + tdsqlite3DbFree(db, p->zErrMsg); p->zErrMsg = 0; } - sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); - sqlite3CloseSavepoints(db); + tdsqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); + tdsqlite3CloseSavepoints(db); db->autoCommit = 1; p->nChange = 0; } @@ -84892,15 +84892,15 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ */ if( p->changeCntOn ){ if( eStatementOp!=SAVEPOINT_ROLLBACK ){ - sqlite3VdbeSetChanges(db, p->nChange); + tdsqlite3VdbeSetChanges(db, p->nChange); }else{ - sqlite3VdbeSetChanges(db, 0); + tdsqlite3VdbeSetChanges(db, 0); } p->nChange = 0; } /* Release the locks */ - sqlite3VdbeLeave(p); + tdsqlite3VdbeLeave(p); } /* We have successfully halted and closed the VM. Record this fact. */ @@ -84919,11 +84919,11 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ } /* If the auto-commit flag is set to true, then any locks that were held - ** by connection db have now been released. Call sqlite3ConnectionUnlocked() + ** by connection db have now been released. Call tdsqlite3ConnectionUnlocked() ** to invoke any required unlock-notify callbacks. */ if( db->autoCommit ){ - sqlite3ConnectionUnlocked(db); + tdsqlite3ConnectionUnlocked(db); } assert( db->nVdbeActive>0 || db->autoCommit==0 || db->nStatement==0 ); @@ -84932,33 +84932,33 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ /* -** Each VDBE holds the result of the most recent sqlite3_step() call +** Each VDBE holds the result of the most recent tdsqlite3_step() call ** in p->rc. This routine sets that result back to SQLITE_OK. */ -SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe *p){ +SQLITE_PRIVATE void tdsqlite3VdbeResetStepResult(Vdbe *p){ p->rc = SQLITE_OK; } /* ** Copy the error code and error message belonging to the VDBE passed ** as the first argument to its database handle (so that they will be -** returned by calls to sqlite3_errcode() and sqlite3_errmsg()). +** returned by calls to tdsqlite3_errcode() and tdsqlite3_errmsg()). ** ** This function does not clear the VDBE error code or message, just ** copies them to the database handle. */ -SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){ - sqlite3 *db = p->db; +SQLITE_PRIVATE int tdsqlite3VdbeTransferError(Vdbe *p){ + tdsqlite3 *db = p->db; int rc = p->rc; if( p->zErrMsg ){ db->bBenignMalloc++; - sqlite3BeginBenignMalloc(); - if( db->pErr==0 ) db->pErr = sqlite3ValueNew(db); - sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT); - sqlite3EndBenignMalloc(); + tdsqlite3BeginBenignMalloc(); + if( db->pErr==0 ) db->pErr = tdsqlite3ValueNew(db); + tdsqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT); + tdsqlite3EndBenignMalloc(); db->bBenignMalloc--; }else if( db->pErr ){ - sqlite3ValueSetNull(db->pErr); + tdsqlite3ValueSetNull(db->pErr); } db->errCode = rc; return rc; @@ -84970,14 +84970,14 @@ SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){ ** invoke it. */ static void vdbeInvokeSqllog(Vdbe *v){ - if( sqlite3GlobalConfig.xSqllog && v->rc==SQLITE_OK && v->zSql && v->pc>=0 ){ - char *zExpanded = sqlite3VdbeExpandSql(v, v->zSql); + if( tdsqlite3GlobalConfig.xSqllog && v->rc==SQLITE_OK && v->zSql && v->pc>=0 ){ + char *zExpanded = tdsqlite3VdbeExpandSql(v, v->zSql); assert( v->db->init.busy==0 ); if( zExpanded ){ - sqlite3GlobalConfig.xSqllog( - sqlite3GlobalConfig.pSqllogArg, v->db, zExpanded, 1 + tdsqlite3GlobalConfig.xSqllog( + tdsqlite3GlobalConfig.pSqllogArg, v->db, zExpanded, 1 ); - sqlite3DbFree(v->db, zExpanded); + tdsqlite3DbFree(v->db, zExpanded); } } } @@ -84996,19 +84996,19 @@ static void vdbeInvokeSqllog(Vdbe *v){ ** virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to ** VDBE_MAGIC_INIT. */ -SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){ +SQLITE_PRIVATE int tdsqlite3VdbeReset(Vdbe *p){ #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) int i; #endif - sqlite3 *db; + tdsqlite3 *db; db = p->db; /* If the VM did not run to completion or if it encountered an ** error, then it might not have been halted properly. So halt ** it now. */ - sqlite3VdbeHalt(p); + tdsqlite3VdbeHalt(p); /* If the VDBE has been run even partially, then transfer the error code ** and error message from the VDBE into the main database structure. But @@ -85017,14 +85017,14 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){ */ if( p->pc>=0 ){ vdbeInvokeSqllog(p); - sqlite3VdbeTransferError(p); + tdsqlite3VdbeTransferError(p); if( p->runOnlyOnce ) p->expired = 1; }else if( p->rc && p->expired ){ /* The expired flag was set on the VDBE before the first call - ** to sqlite3_step(). For consistency (since sqlite3_step() was + ** to tdsqlite3_step(). For consistency (since tdsqlite3_step() was ** called), set the database error in this case as well. */ - sqlite3ErrorWithMsg(db, p->rc, p->zErrMsg ? "%s" : 0, p->zErrMsg); + tdsqlite3ErrorWithMsg(db, p->rc, p->zErrMsg ? "%s" : 0, p->zErrMsg); } /* Reset register contents and reclaim error message memory. @@ -85037,7 +85037,7 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){ for(i=0; inMem; i++) assert( p->aMem[i].flags==MEM_Undefined ); } #endif - sqlite3DbFree(db, p->zErrMsg); + tdsqlite3DbFree(db, p->zErrMsg); p->zErrMsg = 0; p->pResultSet = 0; #ifdef SQLITE_DEBUG @@ -85067,13 +85067,13 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){ } for(i=0; inOp; i++){ char zHdr[100]; - sqlite3_snprintf(sizeof(zHdr), zHdr, "%6u %12llu %8llu ", + tdsqlite3_snprintf(sizeof(zHdr), zHdr, "%6u %12llu %8llu ", p->aOp[i].cnt, p->aOp[i].cycles, p->aOp[i].cnt>0 ? p->aOp[i].cycles/p->aOp[i].cnt : 0 ); fprintf(out, "%s", zHdr); - sqlite3VdbePrintOp(out, i, &p->aOp[i]); + tdsqlite3VdbePrintOp(out, i, &p->aOp[i]); } fclose(out); } @@ -85087,13 +85087,13 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){ ** Clean up and delete a VDBE after execution. Return an integer which is ** the result code. Write any error message text into *pzErrMsg. */ -SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe *p){ +SQLITE_PRIVATE int tdsqlite3VdbeFinalize(Vdbe *p){ int rc = SQLITE_OK; if( p->magic==VDBE_MAGIC_RUN || p->magic==VDBE_MAGIC_HALT ){ - rc = sqlite3VdbeReset(p); + rc = tdsqlite3VdbeReset(p); assert( (rc & p->db->errMask)==rc ); } - sqlite3VdbeDelete(p); + tdsqlite3VdbeDelete(p); return rc; } @@ -85113,7 +85113,7 @@ SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe *p){ ** * the corresponding bit in argument mask is clear (where the first ** function parameter corresponds to bit 0 etc.). */ -SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3 *db, AuxData **pp, int iOp, int mask){ +SQLITE_PRIVATE void tdsqlite3VdbeDeleteAuxData(tdsqlite3 *db, AuxData **pp, int iOp, int mask){ while( *pp ){ AuxData *pAux = *pp; if( (iOp<0) @@ -85126,7 +85126,7 @@ SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3 *db, AuxData **pp, int iOp, pAux->xDeleteAux(pAux->pAux); } *pp = pAux->pNextAux; - sqlite3DbFree(db, pAux); + tdsqlite3DbFree(db, pAux); }else{ pp= &pAux->pNextAux; } @@ -85137,34 +85137,34 @@ SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3 *db, AuxData **pp, int iOp, ** Free all memory associated with the Vdbe passed as the second argument, ** except for object itself, which is preserved. ** -** The difference between this function and sqlite3VdbeDelete() is that +** The difference between this function and tdsqlite3VdbeDelete() is that ** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with ** the database connection and frees the object itself. */ -SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){ +SQLITE_PRIVATE void tdsqlite3VdbeClearObject(tdsqlite3 *db, Vdbe *p){ SubProgram *pSub, *pNext; assert( p->db==0 || p->db==db ); releaseMemArray(p->aColName, p->nResColumn*COLNAME_N); for(pSub=p->pProgram; pSub; pSub=pNext){ pNext = pSub->pNext; vdbeFreeOpArray(db, pSub->aOp, pSub->nOp); - sqlite3DbFree(db, pSub); + tdsqlite3DbFree(db, pSub); } if( p->magic!=VDBE_MAGIC_INIT ){ releaseMemArray(p->aVar, p->nVar); - sqlite3DbFree(db, p->pVList); - sqlite3DbFree(db, p->pFree); + tdsqlite3DbFree(db, p->pVList); + tdsqlite3DbFree(db, p->pFree); } vdbeFreeOpArray(db, p->aOp, p->nOp); - sqlite3DbFree(db, p->aColName); - sqlite3DbFree(db, p->zSql); + tdsqlite3DbFree(db, p->aColName); + tdsqlite3DbFree(db, p->zSql); #ifdef SQLITE_ENABLE_NORMALIZE - sqlite3DbFree(db, p->zNormSql); + tdsqlite3DbFree(db, p->zNormSql); { DblquoteStr *pThis, *pNext; for(pThis=p->pDblStr; pThis; pThis=pNext){ pNext = pThis->pNextStr; - sqlite3DbFree(db, pThis); + tdsqlite3DbFree(db, pThis); } } #endif @@ -85172,9 +85172,9 @@ SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){ { int i; for(i=0; inScan; i++){ - sqlite3DbFree(db, p->aScan[i].zName); + tdsqlite3DbFree(db, p->aScan[i].zName); } - sqlite3DbFree(db, p->aScan); + tdsqlite3DbFree(db, p->aScan); } #endif } @@ -85182,13 +85182,13 @@ SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){ /* ** Delete an entire VDBE. */ -SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe *p){ - sqlite3 *db; +SQLITE_PRIVATE void tdsqlite3VdbeDelete(Vdbe *p){ + tdsqlite3 *db; assert( p!=0 ); db = p->db; - assert( sqlite3_mutex_held(db->mutex) ); - sqlite3VdbeClearObject(db, p); + assert( tdsqlite3_mutex_held(db->mutex) ); + tdsqlite3VdbeClearObject(db, p); if( p->pPrev ){ p->pPrev->pNext = p->pNext; }else{ @@ -85200,7 +85200,7 @@ SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe *p){ } p->magic = VDBE_MAGIC_DEAD; p->db = 0; - sqlite3DbFreeNN(db, p); + tdsqlite3DbFreeNN(db, p); } /* @@ -85208,19 +85208,19 @@ SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe *p){ ** carried out. Seek the cursor now. If an error occurs, return ** the appropriate error code. */ -SQLITE_PRIVATE int SQLITE_NOINLINE sqlite3VdbeFinishMoveto(VdbeCursor *p){ +SQLITE_PRIVATE int SQLITE_NOINLINE tdsqlite3VdbeFinishMoveto(VdbeCursor *p){ int res, rc; #ifdef SQLITE_TEST - extern int sqlite3_search_count; + extern int tdsqlite3_search_count; #endif assert( p->deferredMoveto ); assert( p->isTable ); assert( p->eCurType==CURTYPE_BTREE ); - rc = sqlite3BtreeMovetoUnpacked(p->uc.pCursor, 0, p->movetoTarget, 0, &res); + rc = tdsqlite3BtreeMovetoUnpacked(p->uc.pCursor, 0, p->movetoTarget, 0, &res); if( rc ) return rc; if( res!=0 ) return SQLITE_CORRUPT_BKPT; #ifdef SQLITE_TEST - sqlite3_search_count++; + tdsqlite3_search_count++; #endif p->deferredMoveto = 0; p->cacheStatus = CACHE_STALE; @@ -85238,8 +85238,8 @@ static int SQLITE_NOINLINE handleMovedCursor(VdbeCursor *p){ int isDifferentRow, rc; assert( p->eCurType==CURTYPE_BTREE ); assert( p->uc.pCursor!=0 ); - assert( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ); - rc = sqlite3BtreeCursorRestore(p->uc.pCursor, &isDifferentRow); + assert( tdsqlite3BtreeCursorHasMoved(p->uc.pCursor) ); + rc = tdsqlite3BtreeCursorRestore(p->uc.pCursor, &isDifferentRow); p->cacheStatus = CACHE_STALE; if( isDifferentRow ) p->nullRow = 1; return rc; @@ -85249,9 +85249,9 @@ static int SQLITE_NOINLINE handleMovedCursor(VdbeCursor *p){ ** Check to ensure that the cursor is valid. Restore the cursor ** if need be. Return any I/O error from the restore operation. */ -SQLITE_PRIVATE int sqlite3VdbeCursorRestore(VdbeCursor *p){ +SQLITE_PRIVATE int tdsqlite3VdbeCursorRestore(VdbeCursor *p){ assert( p->eCurType==CURTYPE_BTREE ); - if( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ){ + if( tdsqlite3BtreeCursorHasMoved(p->uc.pCursor) ){ return handleMovedCursor(p); } return SQLITE_OK; @@ -85270,7 +85270,7 @@ SQLITE_PRIVATE int sqlite3VdbeCursorRestore(VdbeCursor *p){ ** If the cursor is already pointing to the correct row and that row has ** not been deleted out from under the cursor, then this routine is a no-op. */ -SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor **pp, int *piCol){ +SQLITE_PRIVATE int tdsqlite3VdbeCursorMoveto(VdbeCursor **pp, int *piCol){ VdbeCursor *p = *pp; assert( p->eCurType==CURTYPE_BTREE || p->eCurType==CURTYPE_PSEUDO ); if( p->deferredMoveto ){ @@ -85280,9 +85280,9 @@ SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor **pp, int *piCol){ *piCol = iMap - 1; return SQLITE_OK; } - return sqlite3VdbeFinishMoveto(p); + return tdsqlite3VdbeFinishMoveto(p); } - if( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ){ + if( tdsqlite3BtreeCursorHasMoved(p->uc.pCursor) ){ return handleMovedCursor(p); } return SQLITE_OK; @@ -85291,11 +85291,11 @@ SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor **pp, int *piCol){ /* ** The following functions: ** -** sqlite3VdbeSerialType() -** sqlite3VdbeSerialTypeLen() -** sqlite3VdbeSerialLen() -** sqlite3VdbeSerialPut() -** sqlite3VdbeSerialGet() +** tdsqlite3VdbeSerialType() +** tdsqlite3VdbeSerialTypeLen() +** tdsqlite3VdbeSerialLen() +** tdsqlite3VdbeSerialPut() +** tdsqlite3VdbeSerialGet() ** ** encapsulate the code that serializes values for storage in SQLite ** data and index records. Each serialized value consists of a @@ -85342,7 +85342,7 @@ SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor **pp, int *piCol){ ** this routine is now only used by the STAT3 logic and STAT3 support has ** ended. The code is kept here for historical reference only. */ -SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format, u32 *pLen){ +SQLITE_PRIVATE u32 tdsqlite3VdbeSerialType(Mem *pMem, int file_format, u32 *pLen){ int flags = pMem->flags; u32 n; @@ -85406,7 +85406,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format, u32 *pLen){ /* ** The sizes for serial types less than 128 */ -static const u8 sqlite3SmallTypeSizes[] = { +static const u8 tdsqlite3SmallTypeSizes[] = { /* 0 1 2 3 4 5 6 7 8 9 */ /* 0 */ 0, 1, 2, 3, 4, 6, 8, 8, 0, 0, /* 10 */ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, @@ -85426,18 +85426,18 @@ static const u8 sqlite3SmallTypeSizes[] = { /* ** Return the length of the data corresponding to the supplied serial-type. */ -SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32 serial_type){ +SQLITE_PRIVATE u32 tdsqlite3VdbeSerialTypeLen(u32 serial_type){ if( serial_type>=128 ){ return (serial_type-12)/2; }else{ assert( serial_type<12 - || sqlite3SmallTypeSizes[serial_type]==(serial_type - 12)/2 ); - return sqlite3SmallTypeSizes[serial_type]; + || tdsqlite3SmallTypeSizes[serial_type]==(serial_type - 12)/2 ); + return tdsqlite3SmallTypeSizes[serial_type]; } } -SQLITE_PRIVATE u8 sqlite3VdbeOneByteSerialTypeLen(u8 serial_type){ +SQLITE_PRIVATE u8 tdsqlite3VdbeOneByteSerialTypeLen(u8 serial_type){ assert( serial_type<128 ); - return sqlite3SmallTypeSizes[serial_type]; + return tdsqlite3SmallTypeSizes[serial_type]; } /* @@ -85506,7 +85506,7 @@ static u64 floatSwap(u64 in){ ** of bytes in the zero-filled tail is included in the return value only ** if those bytes were zeroed in buf[]. */ -SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){ +SQLITE_PRIVATE u32 tdsqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){ u32 len; /* Integer and Real */ @@ -85520,7 +85520,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){ }else{ v = pMem->u.i; } - len = i = sqlite3SmallTypeSizes[serial_type]; + len = i = tdsqlite3SmallTypeSizes[serial_type]; assert( i>0 ); do{ buf[--i] = (u8)(v&0xFF); @@ -85532,7 +85532,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){ /* String or blob */ if( serial_type>=12 ){ assert( pMem->n + ((pMem->flags & MEM_Zero)?pMem->u.nZero:0) - == (int)sqlite3VdbeSerialTypeLen(serial_type) ); + == (int)tdsqlite3VdbeSerialTypeLen(serial_type) ); len = pMem->n; if( len>0 ) memcpy(buf, pMem->z, len); return len; @@ -85596,7 +85596,7 @@ static u32 serialGet( } return 8; } -SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( +SQLITE_PRIVATE u32 tdsqlite3VdbeSerialGet( const unsigned char *buf, /* Buffer to deserialize from */ u32 serial_type, /* Serial type to deserialize */ Mem *pMem /* Memory cell to write value into */ @@ -85689,25 +85689,25 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( } /* ** This routine is used to allocate sufficient space for an UnpackedRecord -** structure large enough to be used with sqlite3VdbeRecordUnpack() if +** structure large enough to be used with tdsqlite3VdbeRecordUnpack() if ** the first argument is a pointer to KeyInfo structure pKeyInfo. ** -** The space is either allocated using sqlite3DbMallocRaw() or from within +** The space is either allocated using tdsqlite3DbMallocRaw() or from within ** the unaligned buffer passed via the second and third arguments (presumably ** stack space). If the former, then *ppFree is set to a pointer that should -** be eventually freed by the caller using sqlite3DbFree(). Or, if the +** be eventually freed by the caller using tdsqlite3DbFree(). Or, if the ** allocation comes from the pSpace/szSpace buffer, *ppFree is set to NULL ** before returning. ** ** If an OOM error occurs, NULL is returned. */ -SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord( +SQLITE_PRIVATE UnpackedRecord *tdsqlite3VdbeAllocUnpackedRecord( KeyInfo *pKeyInfo /* Description of the record */ ){ UnpackedRecord *p; /* Unpacked record to return */ int nByte; /* Number of bytes required for *p */ nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nKeyField+1); - p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte); + p = (UnpackedRecord *)tdsqlite3DbMallocRaw(pKeyInfo->db, nByte); if( !p ) return 0; p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))]; assert( pKeyInfo->aSortFlags!=0 ); @@ -85721,7 +85721,7 @@ SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord( ** UnpackedRecord structure indicated by the fourth argument with the ** contents of the decoded record. */ -SQLITE_PRIVATE void sqlite3VdbeRecordUnpack( +SQLITE_PRIVATE void tdsqlite3VdbeRecordUnpack( KeyInfo *pKeyInfo, /* Information about the record format */ int nKey, /* Size of the binary record */ const void *pKey, /* The binary record */ @@ -85745,10 +85745,10 @@ SQLITE_PRIVATE void sqlite3VdbeRecordUnpack( idx += getVarint32(&aKey[idx], serial_type); pMem->enc = pKeyInfo->enc; pMem->db = pKeyInfo->db; - /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */ + /* pMem->flags = 0; // tdsqlite3VdbeSerialGet() will set this for us */ pMem->szMalloc = 0; pMem->z = 0; - d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem); + d += tdsqlite3VdbeSerialGet(&aKey[d], serial_type, pMem); pMem++; if( (++u)>=p->nField ) break; } @@ -85757,7 +85757,7 @@ SQLITE_PRIVATE void sqlite3VdbeRecordUnpack( /* In a corrupt record entry, the last pMem might have been set up using ** uninitialized memory. Overwrite its value with NULL, to prevent ** warnings from MSAN. */ - sqlite3VdbeMemSetNull(pMem-1); + tdsqlite3VdbeMemSetNull(pMem-1); } assert( u<=pKeyInfo->nKeyField + 1 ); p->nField = u; @@ -85766,11 +85766,11 @@ SQLITE_PRIVATE void sqlite3VdbeRecordUnpack( #ifdef SQLITE_DEBUG /* ** This function compares two index or table record keys in the same way -** as the sqlite3VdbeRecordCompare() routine. Unlike VdbeRecordCompare(), +** as the tdsqlite3VdbeRecordCompare() routine. Unlike VdbeRecordCompare(), ** this function deserializes and compares values using the -** sqlite3VdbeSerialGet() and sqlite3MemCompare() functions. It is used +** tdsqlite3VdbeSerialGet() and tdsqlite3MemCompare() functions. It is used ** in assert() statements to ensure that the optimized code in -** sqlite3VdbeRecordCompare() returns results with these two primitives. +** tdsqlite3VdbeRecordCompare() returns results with these two primitives. ** ** Return true if the result of comparison is equivalent to desiredResult. ** Return false if there is a disagreement. @@ -85793,7 +85793,7 @@ static int vdbeRecordCompareDebug( if( pKeyInfo->db==0 ) return 1; mem1.enc = pKeyInfo->enc; mem1.db = pKeyInfo->db; - /* mem1.flags = 0; // Will be initialized by sqlite3VdbeSerialGet() */ + /* mem1.flags = 0; // Will be initialized by tdsqlite3VdbeSerialGet() */ VVA_ONLY( mem1.szMalloc = 0; ) /* Only needed by assert() statements */ /* Compilers may complain that mem1.u.i is potentially uninitialized. @@ -85822,21 +85822,21 @@ static int vdbeRecordCompareDebug( ** a buffer overread. The "d1+serial_type1+2" subexpression will ** always be greater than or equal to the amount of required key space. ** Use that approximation to avoid the more expensive call to - ** sqlite3VdbeSerialTypeLen() in the common case. + ** tdsqlite3VdbeSerialTypeLen() in the common case. */ if( d1+(u64)serial_type1+2>(u64)nKey1 - && d1+(u64)sqlite3VdbeSerialTypeLen(serial_type1)>(u64)nKey1 + && d1+(u64)tdsqlite3VdbeSerialTypeLen(serial_type1)>(u64)nKey1 ){ break; } /* Extract the values to be compared. */ - d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1); + d1 += tdsqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1); /* Do the comparison */ - rc = sqlite3MemCompare(&mem1, &pPKey2->aMem[i], + rc = tdsqlite3MemCompare(&mem1, &pPKey2->aMem[i], pKeyInfo->nAllField>i ? pKeyInfo->aColl[i] : 0); if( rc!=0 ){ assert( mem1.szMalloc==0 ); /* See comment below */ @@ -85855,7 +85855,7 @@ static int vdbeRecordCompareDebug( /* No memory allocation is ever used on mem1. Prove this using ** the following assert(). If the assert() fails, it indicates a - ** memory leak and a need to call sqlite3VdbeMemRelease(&mem1). + ** memory leak and a need to call tdsqlite3VdbeMemRelease(&mem1). */ assert( mem1.szMalloc==0 ); @@ -85931,20 +85931,20 @@ static int vdbeCompareMemString( const void *v1, *v2; Mem c1; Mem c2; - sqlite3VdbeMemInit(&c1, pMem1->db, MEM_Null); - sqlite3VdbeMemInit(&c2, pMem1->db, MEM_Null); - sqlite3VdbeMemShallowCopy(&c1, pMem1, MEM_Ephem); - sqlite3VdbeMemShallowCopy(&c2, pMem2, MEM_Ephem); - v1 = sqlite3ValueText((sqlite3_value*)&c1, pColl->enc); - v2 = sqlite3ValueText((sqlite3_value*)&c2, pColl->enc); + tdsqlite3VdbeMemInit(&c1, pMem1->db, MEM_Null); + tdsqlite3VdbeMemInit(&c2, pMem1->db, MEM_Null); + tdsqlite3VdbeMemShallowCopy(&c1, pMem1, MEM_Ephem); + tdsqlite3VdbeMemShallowCopy(&c2, pMem2, MEM_Ephem); + v1 = tdsqlite3ValueText((tdsqlite3_value*)&c1, pColl->enc); + v2 = tdsqlite3ValueText((tdsqlite3_value*)&c2, pColl->enc); if( (v1==0 || v2==0) ){ if( prcErr ) *prcErr = SQLITE_NOMEM_BKPT; rc = 0; }else{ rc = pColl->xCmp(pColl->pUser, c1.n, v1, c2.n, v2); } - sqlite3VdbeMemRelease(&c1); - sqlite3VdbeMemRelease(&c2); + tdsqlite3VdbeMemRelease(&c1); + tdsqlite3VdbeMemRelease(&c2); return rc; } } @@ -85966,7 +85966,7 @@ static int isAllZero(const char *z, int n){ ** is less than, equal to, or greater than the second, respectively. ** If one blob is a prefix of the other, then the shorter is the lessor. */ -SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem *pB2){ +SQLITE_PRIVATE SQLITE_NOINLINE int tdsqlite3BlobCompare(const Mem *pB1, const Mem *pB2){ int c; int n1 = pB1->n; int n2 = pB2->n; @@ -85974,7 +85974,7 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem /* It is possible to have a Blob value that has some non-zero content ** followed by zero content. But that only comes up for Blobs formed ** by the OP_MakeRecord opcode, and such Blobs never get passed into - ** sqlite3MemCompare(). */ + ** tdsqlite3MemCompare(). */ assert( (pB1->flags & MEM_Zero)==0 || n1==0 ); assert( (pB2->flags & MEM_Zero)==0 || n2==0 ); @@ -85999,7 +85999,7 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem ** number. Return negative, zero, or positive if the first (i64) is less than, ** equal to, or greater than the second (double). */ -static int sqlite3IntFloatCompare(i64 i, double r){ +static int tdsqlite3IntFloatCompare(i64 i, double r){ if( sizeof(LONGDOUBLE_TYPE)>8 ){ LONGDOUBLE_TYPE x = (LONGDOUBLE_TYPE)i; if( xflags; f2 = pMem2->flags; combined_flags = f1|f2; - assert( !sqlite3VdbeMemIsRowSet(pMem1) && !sqlite3VdbeMemIsRowSet(pMem2) ); + assert( !tdsqlite3VdbeMemIsRowSet(pMem1) && !tdsqlite3VdbeMemIsRowSet(pMem2) ); /* If one value is NULL, it is less than the other. If both values ** are NULL, return 0. @@ -86067,7 +86067,7 @@ SQLITE_PRIVATE int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const C testcase( f1 & MEM_Int ); testcase( f1 & MEM_IntReal ); if( (f2&MEM_Real)!=0 ){ - return sqlite3IntFloatCompare(pMem1->u.i, pMem2->u.r); + return tdsqlite3IntFloatCompare(pMem1->u.i, pMem2->u.r); }else if( (f2&(MEM_Int|MEM_IntReal))!=0 ){ if( pMem1->u.i < pMem2->u.i ) return -1; if( pMem1->u.i > pMem2->u.i ) return +1; @@ -86080,7 +86080,7 @@ SQLITE_PRIVATE int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const C if( (f2&(MEM_Int|MEM_IntReal))!=0 ){ testcase( f2 & MEM_Int ); testcase( f2 & MEM_IntReal ); - return -sqlite3IntFloatCompare(pMem2->u.i, pMem1->u.r); + return -tdsqlite3IntFloatCompare(pMem2->u.i, pMem1->u.r); }else{ return -1; } @@ -86117,7 +86117,7 @@ SQLITE_PRIVATE int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const C } /* Both values must be blobs. Compare using memcmp(). */ - return sqlite3BlobCompare(pMem1, pMem2); + return tdsqlite3BlobCompare(pMem1, pMem2); } @@ -86169,7 +86169,7 @@ static i64 vdbeRecordDecodeInt(u32 serial_type, const u8 *aKey){ ** greater than key2. The {nKey1, pKey1} key must be a blob ** created by the OP_MakeRecord opcode of the VDBE. The pPKey2 ** key must be a parsed key such as obtained from -** sqlite3VdbeParseRecord. +** tdsqlite3VdbeParseRecord. ** ** If argument bSkip is non-zero, it is assumed that the caller has already ** determined that the first fields of the keys are equal. @@ -86183,7 +86183,7 @@ static i64 vdbeRecordDecodeInt(u32 serial_type, const u8 *aKey){ ** pPKey2->errCode is set to SQLITE_NOMEM and, if it is not NULL, the ** malloc-failed flag set on database handle (pPKey2->pKeyInfo->db). */ -SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( +SQLITE_PRIVATE int tdsqlite3VdbeRecordCompareWithSkip( int nKey1, const void *pKey1, /* Left key */ UnpackedRecord *pPKey2, /* Right key */ int bSkip /* If true, skip the first field */ @@ -86205,7 +86205,7 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( u32 s1; idx1 = 1 + getVarint32(&aKey1[1], s1); szHdr1 = aKey1[0]; - d1 = szHdr1 + sqlite3VdbeSerialTypeLen(s1); + d1 = szHdr1 + tdsqlite3VdbeSerialTypeLen(s1); i = 1; pRhs++; }else{ @@ -86238,8 +86238,8 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( }else if( serial_type==0 ){ rc = -1; }else if( serial_type==7 ){ - sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); - rc = -sqlite3IntFloatCompare(pRhs->u.i, mem1.u.r); + tdsqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); + rc = -tdsqlite3IntFloatCompare(pRhs->u.i, mem1.u.r); }else{ i64 lhs = vdbeRecordDecodeInt(serial_type, &aKey1[d1]); i64 rhs = pRhs->u.i; @@ -86263,7 +86263,7 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( }else if( serial_type==0 ){ rc = -1; }else{ - sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); + tdsqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); if( serial_type==7 ){ if( mem1.u.ru.r ){ rc = -1; @@ -86271,7 +86271,7 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( rc = +1; } }else{ - rc = sqlite3IntFloatCompare(mem1.u.i, pRhs->u.r); + rc = tdsqlite3IntFloatCompare(mem1.u.i, pRhs->u.r); } } } @@ -86361,13 +86361,13 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( i++; if( i==pPKey2->nField ) break; pRhs++; - d1 += sqlite3VdbeSerialTypeLen(serial_type); - idx1 += sqlite3VarintLen(serial_type); + d1 += tdsqlite3VdbeSerialTypeLen(serial_type); + idx1 += tdsqlite3VarintLen(serial_type); }while( idx1<(unsigned)szHdr1 && d1<=(unsigned)nKey1 ); /* No memory allocation is ever used on mem1. Prove this using ** the following assert(). If the assert() fails, it indicates a - ** memory leak and a need to call sqlite3VdbeMemRelease(&mem1). */ + ** memory leak and a need to call tdsqlite3VdbeMemRelease(&mem1). */ assert( mem1.szMalloc==0 ); /* rc==0 here means that one or both of the keys ran out of fields and @@ -86380,16 +86380,16 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( pPKey2->eqSeen = 1; return pPKey2->default_rc; } -SQLITE_PRIVATE int sqlite3VdbeRecordCompare( +SQLITE_PRIVATE int tdsqlite3VdbeRecordCompare( int nKey1, const void *pKey1, /* Left key */ UnpackedRecord *pPKey2 /* Right key */ ){ - return sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 0); + return tdsqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 0); } /* -** This function is an optimized version of sqlite3VdbeRecordCompare() +** This function is an optimized version of tdsqlite3VdbeRecordCompare() ** that (a) the first field of pPKey2 is an integer, and (b) the ** size-of-header varint at the start of (pKey1/nKey1) fits in a single ** byte (i.e. is less than 128). @@ -86459,10 +86459,10 @@ static int vdbeRecordCompareInt( ** (as gcc is clever enough to combine the two like cases). Other ** compilers might be similar. */ case 0: case 7: - return sqlite3VdbeRecordCompare(nKey1, pKey1, pPKey2); + return tdsqlite3VdbeRecordCompare(nKey1, pKey1, pPKey2); default: - return sqlite3VdbeRecordCompare(nKey1, pKey1, pPKey2); + return tdsqlite3VdbeRecordCompare(nKey1, pKey1, pPKey2); } v = pPKey2->aMem[0].u.i; @@ -86473,7 +86473,7 @@ static int vdbeRecordCompareInt( }else if( pPKey2->nField>1 ){ /* The first fields of the two keys are equal. Compare the trailing ** fields. */ - res = sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 1); + res = tdsqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 1); }else{ /* The first fields of the two keys are equal and there are no trailing ** fields. Return pPKey2->default_rc in this case. */ @@ -86486,7 +86486,7 @@ static int vdbeRecordCompareInt( } /* -** This function is an optimized version of sqlite3VdbeRecordCompare() +** This function is an optimized version of tdsqlite3VdbeRecordCompare() ** that (a) the first field of pPKey2 is a string, that (b) the first field ** uses the collation sequence BINARY and (c) that the size-of-header varint ** at the start of (pKey1/nKey1) fits in a single byte. @@ -86527,7 +86527,7 @@ static int vdbeRecordCompareString( res = nStr - pPKey2->aMem[0].n; if( res==0 ){ if( pPKey2->nField>1 ){ - res = sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 1); + res = tdsqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 1); }else{ res = pPKey2->default_rc; pPKey2->eqSeen = 1; @@ -86548,11 +86548,11 @@ static int vdbeRecordCompareString( } /* -** Return a pointer to an sqlite3VdbeRecordCompare() compatible function +** Return a pointer to an tdsqlite3VdbeRecordCompare() compatible function ** suitable for comparing serialized records to the unpacked record passed ** as the only argument. */ -SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord *p){ +SQLITE_PRIVATE RecordCompare tdsqlite3VdbeFindCompare(UnpackedRecord *p){ /* varintRecordCompareInt() and varintRecordCompareString() both assume ** that the size-of-header varint that occurs at the start of each record ** fits in a single byte (i.e. is 127 or less). varintRecordCompareInt() @@ -86570,7 +86570,7 @@ SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord *p){ int flags = p->aMem[0].flags; if( p->pKeyInfo->aSortFlags[0] ){ if( p->pKeyInfo->aSortFlags[0] & KEYINFO_ORDER_BIGNULL ){ - return sqlite3VdbeRecordCompare; + return tdsqlite3VdbeRecordCompare; } p->r1 = 1; p->r2 = -1; @@ -86592,7 +86592,7 @@ SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord *p){ } } - return sqlite3VdbeRecordCompare; + return tdsqlite3VdbeRecordCompare; } /* @@ -86603,7 +86603,7 @@ SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord *p){ ** pCur might be pointing to text obtained from a corrupt database file. ** So the content cannot be trusted. Do appropriate checks on the content. */ -SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){ +SQLITE_PRIVATE int tdsqlite3VdbeIdxRowid(tdsqlite3 *db, BtCursor *pCur, i64 *rowid){ i64 nCellKey = 0; int rc; u32 szHdr; /* Size of the header */ @@ -86613,16 +86613,16 @@ SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){ /* Get the size of the index entry. Only indices entries of less ** than 2GiB are support - anything large must be database corruption. - ** Any corruption is detected in sqlite3BtreeParseCellPtr(), though, so + ** Any corruption is detected in tdsqlite3BtreeParseCellPtr(), though, so ** this code can safely assume that nCellKey is 32-bits */ - assert( sqlite3BtreeCursorIsValid(pCur) ); - nCellKey = sqlite3BtreePayloadSize(pCur); + assert( tdsqlite3BtreeCursorIsValid(pCur) ); + nCellKey = tdsqlite3BtreePayloadSize(pCur); assert( (nCellKey & SQLITE_MAX_U32)==(u64)nCellKey ); /* Read in the complete content of the index entry */ - sqlite3VdbeMemInit(&m, db, 0); - rc = sqlite3VdbeMemFromBtree(pCur, 0, (u32)nCellKey, &m); + tdsqlite3VdbeMemInit(&m, db, 0); + rc = tdsqlite3VdbeMemFromBtree(pCur, 0, (u32)nCellKey, &m); if( rc ){ return rc; } @@ -86651,23 +86651,23 @@ SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){ if( unlikely(typeRowid<1 || typeRowid>9 || typeRowid==7) ){ goto idx_rowid_corruption; } - lenRowid = sqlite3SmallTypeSizes[typeRowid]; + lenRowid = tdsqlite3SmallTypeSizes[typeRowid]; testcase( (u32)m.n==szHdr+lenRowid ); if( unlikely((u32)m.neCurType==CURTYPE_BTREE ); pCur = pC->uc.pCursor; - assert( sqlite3BtreeCursorIsValid(pCur) ); - nCellKey = sqlite3BtreePayloadSize(pCur); + assert( tdsqlite3BtreeCursorIsValid(pCur) ); + nCellKey = tdsqlite3BtreePayloadSize(pCur); /* nCellKey will always be between 0 and 0xffffffff because of the way - ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ + ** that btreeParseCellPtr() and tdsqlite3GetVarint32() are implemented */ if( nCellKey<=0 || nCellKey>0x7fffffff ){ *res = 0; return SQLITE_CORRUPT_BKPT; } - sqlite3VdbeMemInit(&m, db, 0); - rc = sqlite3VdbeMemFromBtree(pCur, 0, (u32)nCellKey, &m); + tdsqlite3VdbeMemInit(&m, db, 0); + rc = tdsqlite3VdbeMemFromBtree(pCur, 0, (u32)nCellKey, &m); if( rc ){ return rc; } - *res = sqlite3VdbeRecordCompareWithSkip(m.n, m.z, pUnpacked, 0); - sqlite3VdbeMemRelease(&m); + *res = tdsqlite3VdbeRecordCompareWithSkip(m.n, m.z, pUnpacked, 0); + tdsqlite3VdbeMemRelease(&m); return SQLITE_OK; } /* ** This routine sets the value to be returned by subsequent calls to -** sqlite3_changes() on the database handle 'db'. +** tdsqlite3_changes() on the database handle 'db'. */ -SQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *db, int nChange){ - assert( sqlite3_mutex_held(db->mutex) ); +SQLITE_PRIVATE void tdsqlite3VdbeSetChanges(tdsqlite3 *db, int nChange){ + assert( tdsqlite3_mutex_held(db->mutex) ); db->nChange = nChange; db->nTotalChange += nChange; } @@ -86727,7 +86727,7 @@ SQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *db, int nChange){ ** Set a flag in the vdbe to update the change counter when it is finalised ** or reset. */ -SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe *v){ +SQLITE_PRIVATE void tdsqlite3VdbeCountChanges(Vdbe *v){ v->changeCntOn = 1; } @@ -86749,7 +86749,7 @@ SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe *v){ ** prepared statements. The flag is set to 1 for an immediate expiration ** and set to 2 for an advisory expiration. */ -SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3 *db, int iCode){ +SQLITE_PRIVATE void tdsqlite3ExpirePreparedStatements(tdsqlite3 *db, int iCode){ Vdbe *p; for(p = db->pVdbe; p; p=p->pNext){ p->expired = iCode+1; @@ -86759,35 +86759,35 @@ SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3 *db, int iCode){ /* ** Return the database associated with the Vdbe. */ -SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe *v){ +SQLITE_PRIVATE tdsqlite3 *tdsqlite3VdbeDb(Vdbe *v){ return v->db; } /* ** Return the SQLITE_PREPARE flags for a Vdbe. */ -SQLITE_PRIVATE u8 sqlite3VdbePrepareFlags(Vdbe *v){ +SQLITE_PRIVATE u8 tdsqlite3VdbePrepareFlags(Vdbe *v){ return v->prepFlags; } /* -** Return a pointer to an sqlite3_value structure containing the value bound +** Return a pointer to an tdsqlite3_value structure containing the value bound ** parameter iVar of VM v. Except, if the value is an SQL NULL, return ** 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_* ** constants) to the value before returning it. ** -** The returned value must be freed by the caller using sqlite3ValueFree(). +** The returned value must be freed by the caller using tdsqlite3ValueFree(). */ -SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff){ +SQLITE_PRIVATE tdsqlite3_value *tdsqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff){ assert( iVar>0 ); if( v ){ Mem *pMem = &v->aVar[iVar-1]; assert( (v->db->flags & SQLITE_EnableQPSG)==0 ); if( 0==(pMem->flags & MEM_Null) ){ - sqlite3_value *pRet = sqlite3ValueNew(v->db); + tdsqlite3_value *pRet = tdsqlite3ValueNew(v->db); if( pRet ){ - sqlite3VdbeMemCopy((Mem *)pRet, pMem); - sqlite3ValueApplyAffinity(pRet, aff, SQLITE_UTF8); + tdsqlite3VdbeMemCopy((Mem *)pRet, pMem); + tdsqlite3ValueApplyAffinity(pRet, aff, SQLITE_UTF8); } return pRet; } @@ -86797,10 +86797,10 @@ SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff /* ** Configure SQL variable iVar so that binding a new value to it signals -** to sqlite3_reoptimize() that re-preparing the statement may result +** to tdsqlite3_reoptimize() that re-preparing the statement may result ** in a better query plan. */ -SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){ +SQLITE_PRIVATE void tdsqlite3VdbeSetVarmask(Vdbe *v, int iVar){ assert( iVar>0 ); assert( (v->db->flags & SQLITE_EnableQPSG)==0 ); if( iVar>=32 ){ @@ -86819,7 +86819,7 @@ SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){ ** This routine is invoked by date/time functions that use non-deterministic ** features such as 'now'. */ -SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context *pCtx){ +SQLITE_PRIVATE int tdsqlite3NotPureFunc(tdsqlite3_context *pCtx){ const VdbeOp *pOp; #ifdef SQLITE_ENABLE_STAT4 if( pCtx->pVdbe==0 ) return 1; @@ -86835,10 +86835,10 @@ SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context *pCtx){ }else{ zContext = "an index"; } - zMsg = sqlite3_mprintf("non-deterministic use of %s() in %s", + zMsg = tdsqlite3_mprintf("non-deterministic use of %s() in %s", pCtx->pFunc->zName, zContext); - sqlite3_result_error(pCtx, zMsg, -1); - sqlite3_free(zMsg); + tdsqlite3_result_error(pCtx, zMsg, -1); + tdsqlite3_free(zMsg); return 0; } return 1; @@ -86846,16 +86846,16 @@ SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context *pCtx){ #ifndef SQLITE_OMIT_VIRTUALTABLE /* -** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored -** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored -** in memory obtained from sqlite3DbMalloc). +** Transfer error message text from an tdsqlite3_vtab.zErrMsg (text stored +** in memory obtained from tdsqlite3_malloc) into a Vdbe.zErrMsg (text stored +** in memory obtained from tdsqlite3DbMalloc). */ -SQLITE_PRIVATE void sqlite3VtabImportErrmsg(Vdbe *p, sqlite3_vtab *pVtab){ +SQLITE_PRIVATE void tdsqlite3VtabImportErrmsg(Vdbe *p, tdsqlite3_vtab *pVtab){ if( pVtab->zErrMsg ){ - sqlite3 *db = p->db; - sqlite3DbFree(db, p->zErrMsg); - p->zErrMsg = sqlite3DbStrDup(db, pVtab->zErrMsg); - sqlite3_free(pVtab->zErrMsg); + tdsqlite3 *db = p->db; + tdsqlite3DbFree(db, p->zErrMsg); + p->zErrMsg = tdsqlite3DbStrDup(db, pVtab->zErrMsg); + tdsqlite3_free(pVtab->zErrMsg); pVtab->zErrMsg = 0; } } @@ -86866,19 +86866,19 @@ SQLITE_PRIVATE void sqlite3VtabImportErrmsg(Vdbe *p, sqlite3_vtab *pVtab){ /* ** If the second argument is not NULL, release any allocations associated ** with the memory cells in the p->aMem[] array. Also free the UnpackedRecord -** structure itself, using sqlite3DbFree(). +** structure itself, using tdsqlite3DbFree(). ** ** This function is used to free UnpackedRecord structures allocated by ** the vdbeUnpackRecord() function found in vdbeapi.c. */ -static void vdbeFreeUnpacked(sqlite3 *db, int nField, UnpackedRecord *p){ +static void vdbeFreeUnpacked(tdsqlite3 *db, int nField, UnpackedRecord *p){ if( p ){ int i; for(i=0; iaMem[i]; - if( pMem->zMalloc ) sqlite3VdbeMemRelease(pMem); + if( pMem->zMalloc ) tdsqlite3VdbeMemRelease(pMem); } - sqlite3DbFreeNN(db, p); + tdsqlite3DbFreeNN(db, p); } } #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ @@ -86887,10 +86887,10 @@ static void vdbeFreeUnpacked(sqlite3 *db, int nField, UnpackedRecord *p){ /* ** Invoke the pre-update hook. If this is an UPDATE or DELETE pre-update call, ** then cursor passed as the second argument should point to the row about -** to be update or deleted. If the application calls sqlite3_preupdate_old(), +** to be update or deleted. If the application calls tdsqlite3_preupdate_old(), ** the required value will be read from the row the cursor points to. */ -SQLITE_PRIVATE void sqlite3VdbePreUpdateHook( +SQLITE_PRIVATE void tdsqlite3VdbePreUpdateHook( Vdbe *v, /* Vdbe pre-update hook is invoked by */ VdbeCursor *pCsr, /* Cursor to grab old.* values from */ int op, /* SQLITE_INSERT, UPDATE or DELETE */ @@ -86899,7 +86899,7 @@ SQLITE_PRIVATE void sqlite3VdbePreUpdateHook( i64 iKey1, /* Initial key value */ int iReg /* Register for new.* record */ ){ - sqlite3 *db = v->db; + tdsqlite3 *db = v->db; i64 iKey2; PreUpdate preupdate; const char *zTbl = pTab->zName; @@ -86909,7 +86909,7 @@ SQLITE_PRIVATE void sqlite3VdbePreUpdateHook( memset(&preupdate, 0, sizeof(PreUpdate)); if( HasRowid(pTab)==0 ){ iKey1 = iKey2 = 0; - preupdate.pPk = sqlite3PrimaryKeyIndex(pTab); + preupdate.pPk = tdsqlite3PrimaryKeyIndex(pTab); }else{ if( op==SQLITE_UPDATE ){ iKey2 = v->aMem[iReg].u.i; @@ -86937,15 +86937,15 @@ SQLITE_PRIVATE void sqlite3VdbePreUpdateHook( db->pPreUpdate = &preupdate; db->xPreUpdateCallback(db->pPreUpdateArg, db, op, zDb, zTbl, iKey1, iKey2); db->pPreUpdate = 0; - sqlite3DbFree(db, preupdate.aRecord); + tdsqlite3DbFree(db, preupdate.aRecord); vdbeFreeUnpacked(db, preupdate.keyinfo.nKeyField+1, preupdate.pUnpacked); vdbeFreeUnpacked(db, preupdate.keyinfo.nKeyField+1, preupdate.pNewUnpacked); if( preupdate.aNew ){ int i; for(i=0; inField; i++){ - sqlite3VdbeMemRelease(&preupdate.aNew[i]); + tdsqlite3VdbeMemRelease(&preupdate.aNew[i]); } - sqlite3DbFreeNN(db, preupdate.aNew); + tdsqlite3DbFreeNN(db, preupdate.aNew); } } #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ @@ -86975,11 +86975,11 @@ SQLITE_PRIVATE void sqlite3VdbePreUpdateHook( ** Return TRUE (non-zero) of the statement supplied as an argument needs ** to be recompiled. A statement needs to be recompiled whenever the ** execution environment changes in a way that would alter the program -** that sqlite3_prepare() generates. For example, if new functions or +** that tdsqlite3_prepare() generates. For example, if new functions or ** collating sequences are registered or if an authorizer function is ** added or changed. */ -SQLITE_API int sqlite3_expired(sqlite3_stmt *pStmt){ +SQLITE_API int tdsqlite3_expired(tdsqlite3_stmt *pStmt){ Vdbe *p = (Vdbe*)pStmt; return p==0 || p->expired; } @@ -86992,7 +86992,7 @@ SQLITE_API int sqlite3_expired(sqlite3_stmt *pStmt){ */ static int vdbeSafety(Vdbe *p){ if( p->db==0 ){ - sqlite3_log(SQLITE_MISUSE, "API called with finalized prepared statement"); + tdsqlite3_log(SQLITE_MISUSE, "API called with finalized prepared statement"); return 1; }else{ return 0; @@ -87000,7 +87000,7 @@ static int vdbeSafety(Vdbe *p){ } static int vdbeSafetyNotNull(Vdbe *p){ if( p==0 ){ - sqlite3_log(SQLITE_MISUSE, "API called with NULL prepared statement"); + tdsqlite3_log(SQLITE_MISUSE, "API called with NULL prepared statement"); return 1; }else{ return vdbeSafety(p); @@ -87012,14 +87012,14 @@ static int vdbeSafetyNotNull(Vdbe *p){ ** Invoke the profile callback. This routine is only called if we already ** know that the profile callback is defined and needs to be invoked. */ -static SQLITE_NOINLINE void invokeProfileCallback(sqlite3 *db, Vdbe *p){ - sqlite3_int64 iNow; - sqlite3_int64 iElapse; +static SQLITE_NOINLINE void invokeProfileCallback(tdsqlite3 *db, Vdbe *p){ + tdsqlite3_int64 iNow; + tdsqlite3_int64 iElapse; assert( p->startTime>0 ); assert( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0 ); assert( db->init.busy==0 ); assert( p->zSql!=0 ); - sqlite3OsCurrentTimeInt64(db->pVfs, &iNow); + tdsqlite3OsCurrentTimeInt64(db->pVfs, &iNow); iElapse = (iNow - p->startTime)*1000000; #ifndef SQLITE_OMIT_DEPRECATED if( db->xProfile ){ @@ -87043,28 +87043,28 @@ static SQLITE_NOINLINE void invokeProfileCallback(sqlite3 *db, Vdbe *p){ /* ** The following routine destroys a virtual machine that is created by -** the sqlite3_compile() routine. The integer returned is an SQLITE_ +** the tdsqlite3_compile() routine. The integer returned is an SQLITE_ ** success/failure code that describes the result of executing the virtual ** machine. ** ** This routine sets the error code and string returned by -** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16(). +** tdsqlite3_errcode(), tdsqlite3_errmsg() and tdsqlite3_errmsg16(). */ -SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt){ +SQLITE_API int tdsqlite3_finalize(tdsqlite3_stmt *pStmt){ int rc; if( pStmt==0 ){ - /* IMPLEMENTATION-OF: R-57228-12904 Invoking sqlite3_finalize() on a NULL + /* IMPLEMENTATION-OF: R-57228-12904 Invoking tdsqlite3_finalize() on a NULL ** pointer is a harmless no-op. */ rc = SQLITE_OK; }else{ Vdbe *v = (Vdbe*)pStmt; - sqlite3 *db = v->db; + tdsqlite3 *db = v->db; if( vdbeSafety(v) ) return SQLITE_MISUSE_BKPT; - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); checkProfileCallback(db, v); - rc = sqlite3VdbeFinalize(v); - rc = sqlite3ApiExit(db, rc); - sqlite3LeaveMutexAndCloseZombie(db); + rc = tdsqlite3VdbeFinalize(v); + rc = tdsqlite3ApiExit(db, rc); + tdsqlite3LeaveMutexAndCloseZombie(db); } return rc; } @@ -87075,22 +87075,22 @@ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt){ ** the prior execution is returned. ** ** This routine sets the error code and string returned by -** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16(). +** tdsqlite3_errcode(), tdsqlite3_errmsg() and tdsqlite3_errmsg16(). */ -SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt){ +SQLITE_API int tdsqlite3_reset(tdsqlite3_stmt *pStmt){ int rc; if( pStmt==0 ){ rc = SQLITE_OK; }else{ Vdbe *v = (Vdbe*)pStmt; - sqlite3 *db = v->db; - sqlite3_mutex_enter(db->mutex); + tdsqlite3 *db = v->db; + tdsqlite3_mutex_enter(db->mutex); checkProfileCallback(db, v); - rc = sqlite3VdbeReset(v); - sqlite3VdbeRewind(v); + rc = tdsqlite3VdbeReset(v); + tdsqlite3VdbeRewind(v); assert( (rc & (db->errMask))==rc ); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); + rc = tdsqlite3ApiExit(db, rc); + tdsqlite3_mutex_leave(db->mutex); } return rc; } @@ -87098,32 +87098,32 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt){ /* ** Set all the parameters in the compiled SQL statement to NULL. */ -SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt *pStmt){ +SQLITE_API int tdsqlite3_clear_bindings(tdsqlite3_stmt *pStmt){ int i; int rc = SQLITE_OK; Vdbe *p = (Vdbe*)pStmt; #if SQLITE_THREADSAFE - sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex; + tdsqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex; #endif - sqlite3_mutex_enter(mutex); + tdsqlite3_mutex_enter(mutex); for(i=0; inVar; i++){ - sqlite3VdbeMemRelease(&p->aVar[i]); + tdsqlite3VdbeMemRelease(&p->aVar[i]); p->aVar[i].flags = MEM_Null; } assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || p->expmask==0 ); if( p->expmask ){ p->expired = 1; } - sqlite3_mutex_leave(mutex); + tdsqlite3_mutex_leave(mutex); return rc; } -/**************************** sqlite3_value_ ******************************* -** The following routines extract information from a Mem or sqlite3_value +/**************************** tdsqlite3_value_ ******************************* +** The following routines extract information from a Mem or tdsqlite3_value ** structure. */ -SQLITE_API const void *sqlite3_value_blob(sqlite3_value *pVal){ +SQLITE_API const void *tdsqlite3_value_blob(tdsqlite3_value *pVal){ Mem *p = (Mem*)pVal; if( p->flags & (MEM_Blob|MEM_Str) ){ if( ExpandBlob(p)!=SQLITE_OK ){ @@ -87133,29 +87133,29 @@ SQLITE_API const void *sqlite3_value_blob(sqlite3_value *pVal){ p->flags |= MEM_Blob; return p->n ? p->z : 0; }else{ - return sqlite3_value_text(pVal); + return tdsqlite3_value_text(pVal); } } -SQLITE_API int sqlite3_value_bytes(sqlite3_value *pVal){ - return sqlite3ValueBytes(pVal, SQLITE_UTF8); +SQLITE_API int tdsqlite3_value_bytes(tdsqlite3_value *pVal){ + return tdsqlite3ValueBytes(pVal, SQLITE_UTF8); } -SQLITE_API int sqlite3_value_bytes16(sqlite3_value *pVal){ - return sqlite3ValueBytes(pVal, SQLITE_UTF16NATIVE); +SQLITE_API int tdsqlite3_value_bytes16(tdsqlite3_value *pVal){ + return tdsqlite3ValueBytes(pVal, SQLITE_UTF16NATIVE); } -SQLITE_API double sqlite3_value_double(sqlite3_value *pVal){ - return sqlite3VdbeRealValue((Mem*)pVal); +SQLITE_API double tdsqlite3_value_double(tdsqlite3_value *pVal){ + return tdsqlite3VdbeRealValue((Mem*)pVal); } -SQLITE_API int sqlite3_value_int(sqlite3_value *pVal){ - return (int)sqlite3VdbeIntValue((Mem*)pVal); +SQLITE_API int tdsqlite3_value_int(tdsqlite3_value *pVal){ + return (int)tdsqlite3VdbeIntValue((Mem*)pVal); } -SQLITE_API sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){ - return sqlite3VdbeIntValue((Mem*)pVal); +SQLITE_API sqlite_int64 tdsqlite3_value_int64(tdsqlite3_value *pVal){ + return tdsqlite3VdbeIntValue((Mem*)pVal); } -SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value *pVal){ +SQLITE_API unsigned int tdsqlite3_value_subtype(tdsqlite3_value *pVal){ Mem *pMem = (Mem*)pVal; return ((pMem->flags & MEM_Subtype) ? pMem->eSubtype : 0); } -SQLITE_API void *sqlite3_value_pointer(sqlite3_value *pVal, const char *zPType){ +SQLITE_API void *tdsqlite3_value_pointer(tdsqlite3_value *pVal, const char *zPType){ Mem *p = (Mem*)pVal; if( (p->flags&(MEM_TypeMask|MEM_Term|MEM_Subtype)) == (MEM_Null|MEM_Term|MEM_Subtype) @@ -87168,25 +87168,25 @@ SQLITE_API void *sqlite3_value_pointer(sqlite3_value *pVal, const char *zPType){ return 0; } } -SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value *pVal){ - return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8); +SQLITE_API const unsigned char *tdsqlite3_value_text(tdsqlite3_value *pVal){ + return (const unsigned char *)tdsqlite3ValueText(pVal, SQLITE_UTF8); } #ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_value_text16(sqlite3_value* pVal){ - return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE); +SQLITE_API const void *tdsqlite3_value_text16(tdsqlite3_value* pVal){ + return tdsqlite3ValueText(pVal, SQLITE_UTF16NATIVE); } -SQLITE_API const void *sqlite3_value_text16be(sqlite3_value *pVal){ - return sqlite3ValueText(pVal, SQLITE_UTF16BE); +SQLITE_API const void *tdsqlite3_value_text16be(tdsqlite3_value *pVal){ + return tdsqlite3ValueText(pVal, SQLITE_UTF16BE); } -SQLITE_API const void *sqlite3_value_text16le(sqlite3_value *pVal){ - return sqlite3ValueText(pVal, SQLITE_UTF16LE); +SQLITE_API const void *tdsqlite3_value_text16le(tdsqlite3_value *pVal){ + return tdsqlite3ValueText(pVal, SQLITE_UTF16LE); } #endif /* SQLITE_OMIT_UTF16 */ /* EVIDENCE-OF: R-12793-43283 Every value in SQLite has one of five ** fundamental datatypes: 64-bit signed integer 64-bit IEEE floating ** point number string BLOB NULL */ -SQLITE_API int sqlite3_value_type(sqlite3_value* pVal){ +SQLITE_API int tdsqlite3_value_type(tdsqlite3_value* pVal){ static const u8 aType[] = { SQLITE_BLOB, /* 0x00 (not possible) */ SQLITE_NULL, /* 0x01 NULL */ @@ -87272,21 +87272,21 @@ SQLITE_API int sqlite3_value_type(sqlite3_value* pVal){ } /* Return true if a parameter to xUpdate represents an unchanged column */ -SQLITE_API int sqlite3_value_nochange(sqlite3_value *pVal){ +SQLITE_API int tdsqlite3_value_nochange(tdsqlite3_value *pVal){ return (pVal->flags&(MEM_Null|MEM_Zero))==(MEM_Null|MEM_Zero); } -/* Return true if a parameter value originated from an sqlite3_bind() */ -SQLITE_API int sqlite3_value_frombind(sqlite3_value *pVal){ +/* Return true if a parameter value originated from an tdsqlite3_bind() */ +SQLITE_API int tdsqlite3_value_frombind(tdsqlite3_value *pVal){ return (pVal->flags&MEM_FromBind)!=0; } -/* Make a copy of an sqlite3_value object +/* Make a copy of an tdsqlite3_value object */ -SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value *pOrig){ - sqlite3_value *pNew; +SQLITE_API tdsqlite3_value *tdsqlite3_value_dup(const tdsqlite3_value *pOrig){ + tdsqlite3_value *pNew; if( pOrig==0 ) return 0; - pNew = sqlite3_malloc( sizeof(*pNew) ); + pNew = tdsqlite3_malloc( sizeof(*pNew) ); if( pNew==0 ) return 0; memset(pNew, 0, sizeof(*pNew)); memcpy(pNew, pOrig, MEMCELLSIZE); @@ -87295,27 +87295,27 @@ SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value *pOrig){ if( pNew->flags&(MEM_Str|MEM_Blob) ){ pNew->flags &= ~(MEM_Static|MEM_Dyn); pNew->flags |= MEM_Ephem; - if( sqlite3VdbeMemMakeWriteable(pNew)!=SQLITE_OK ){ - sqlite3ValueFree(pNew); + if( tdsqlite3VdbeMemMakeWriteable(pNew)!=SQLITE_OK ){ + tdsqlite3ValueFree(pNew); pNew = 0; } } return pNew; } -/* Destroy an sqlite3_value object previously obtained from -** sqlite3_value_dup(). +/* Destroy an tdsqlite3_value object previously obtained from +** tdsqlite3_value_dup(). */ -SQLITE_API void sqlite3_value_free(sqlite3_value *pOld){ - sqlite3ValueFree(pOld); +SQLITE_API void tdsqlite3_value_free(tdsqlite3_value *pOld){ + tdsqlite3ValueFree(pOld); } -/**************************** sqlite3_result_ ******************************* +/**************************** tdsqlite3_result_ ******************************* ** The following routines are used by user-defined functions to specify ** the function result. ** -** The setStrOrError() function calls sqlite3VdbeMemSetStr() to store the +** The setStrOrError() function calls tdsqlite3VdbeMemSetStr() to store the ** result as a string or blob but if the string or blob is too large, it ** then sets the error code to SQLITE_TOOBIG ** @@ -87323,20 +87323,20 @@ SQLITE_API void sqlite3_value_free(sqlite3_value *pOld){ ** on value P is not going to be used and need to be destroyed. */ static void setResultStrOrError( - sqlite3_context *pCtx, /* Function context */ + tdsqlite3_context *pCtx, /* Function context */ const char *z, /* String pointer */ int n, /* Bytes in string, or negative */ u8 enc, /* Encoding of z. 0 for BLOBs */ void (*xDel)(void*) /* Destructor function */ ){ - if( sqlite3VdbeMemSetStr(pCtx->pOut, z, n, enc, xDel)==SQLITE_TOOBIG ){ - sqlite3_result_error_toobig(pCtx); + if( tdsqlite3VdbeMemSetStr(pCtx->pOut, z, n, enc, xDel)==SQLITE_TOOBIG ){ + tdsqlite3_result_error_toobig(pCtx); } } static int invokeValueDestructor( const void *p, /* Value to destroy */ void (*xDel)(void*), /* The destructor */ - sqlite3_context *pCtx /* Set a SQLITE_TOOBIG error if no NULL */ + tdsqlite3_context *pCtx /* Set a SQLITE_TOOBIG error if no NULL */ ){ assert( xDel!=SQLITE_DYNAMIC ); if( xDel==0 ){ @@ -87346,26 +87346,26 @@ static int invokeValueDestructor( }else{ xDel((void*)p); } - if( pCtx ) sqlite3_result_error_toobig(pCtx); + if( pCtx ) tdsqlite3_result_error_toobig(pCtx); return SQLITE_TOOBIG; } -SQLITE_API void sqlite3_result_blob( - sqlite3_context *pCtx, +SQLITE_API void tdsqlite3_result_blob( + tdsqlite3_context *pCtx, const void *z, int n, void (*xDel)(void *) ){ assert( n>=0 ); - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); setResultStrOrError(pCtx, z, n, 0, xDel); } -SQLITE_API void sqlite3_result_blob64( - sqlite3_context *pCtx, +SQLITE_API void tdsqlite3_result_blob64( + tdsqlite3_context *pCtx, const void *z, - sqlite3_uint64 n, + tdsqlite3_uint64 n, void (*xDel)(void *) ){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); assert( xDel!=SQLITE_DYNAMIC ); if( n>0x7fffffff ){ (void)invokeValueDestructor(z, xDel, pCtx); @@ -87373,69 +87373,69 @@ SQLITE_API void sqlite3_result_blob64( setResultStrOrError(pCtx, z, (int)n, 0, xDel); } } -SQLITE_API void sqlite3_result_double(sqlite3_context *pCtx, double rVal){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); - sqlite3VdbeMemSetDouble(pCtx->pOut, rVal); +SQLITE_API void tdsqlite3_result_double(tdsqlite3_context *pCtx, double rVal){ + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); + tdsqlite3VdbeMemSetDouble(pCtx->pOut, rVal); } -SQLITE_API void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); +SQLITE_API void tdsqlite3_result_error(tdsqlite3_context *pCtx, const char *z, int n){ + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); pCtx->isError = SQLITE_ERROR; - sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF8, SQLITE_TRANSIENT); + tdsqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF8, SQLITE_TRANSIENT); } #ifndef SQLITE_OMIT_UTF16 -SQLITE_API void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); +SQLITE_API void tdsqlite3_result_error16(tdsqlite3_context *pCtx, const void *z, int n){ + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); pCtx->isError = SQLITE_ERROR; - sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT); + tdsqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT); } #endif -SQLITE_API void sqlite3_result_int(sqlite3_context *pCtx, int iVal){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); - sqlite3VdbeMemSetInt64(pCtx->pOut, (i64)iVal); +SQLITE_API void tdsqlite3_result_int(tdsqlite3_context *pCtx, int iVal){ + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); + tdsqlite3VdbeMemSetInt64(pCtx->pOut, (i64)iVal); } -SQLITE_API void sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); - sqlite3VdbeMemSetInt64(pCtx->pOut, iVal); +SQLITE_API void tdsqlite3_result_int64(tdsqlite3_context *pCtx, i64 iVal){ + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); + tdsqlite3VdbeMemSetInt64(pCtx->pOut, iVal); } -SQLITE_API void sqlite3_result_null(sqlite3_context *pCtx){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); - sqlite3VdbeMemSetNull(pCtx->pOut); +SQLITE_API void tdsqlite3_result_null(tdsqlite3_context *pCtx){ + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); + tdsqlite3VdbeMemSetNull(pCtx->pOut); } -SQLITE_API void sqlite3_result_pointer( - sqlite3_context *pCtx, +SQLITE_API void tdsqlite3_result_pointer( + tdsqlite3_context *pCtx, void *pPtr, const char *zPType, void (*xDestructor)(void*) ){ Mem *pOut = pCtx->pOut; - assert( sqlite3_mutex_held(pOut->db->mutex) ); - sqlite3VdbeMemRelease(pOut); + assert( tdsqlite3_mutex_held(pOut->db->mutex) ); + tdsqlite3VdbeMemRelease(pOut); pOut->flags = MEM_Null; - sqlite3VdbeMemSetPointer(pOut, pPtr, zPType, xDestructor); + tdsqlite3VdbeMemSetPointer(pOut, pPtr, zPType, xDestructor); } -SQLITE_API void sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){ +SQLITE_API void tdsqlite3_result_subtype(tdsqlite3_context *pCtx, unsigned int eSubtype){ Mem *pOut = pCtx->pOut; - assert( sqlite3_mutex_held(pOut->db->mutex) ); + assert( tdsqlite3_mutex_held(pOut->db->mutex) ); pOut->eSubtype = eSubtype & 0xff; pOut->flags |= MEM_Subtype; } -SQLITE_API void sqlite3_result_text( - sqlite3_context *pCtx, +SQLITE_API void tdsqlite3_result_text( + tdsqlite3_context *pCtx, const char *z, int n, void (*xDel)(void *) ){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); setResultStrOrError(pCtx, z, n, SQLITE_UTF8, xDel); } -SQLITE_API void sqlite3_result_text64( - sqlite3_context *pCtx, +SQLITE_API void tdsqlite3_result_text64( + tdsqlite3_context *pCtx, const char *z, - sqlite3_uint64 n, + tdsqlite3_uint64 n, void (*xDel)(void *), unsigned char enc ){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); assert( xDel!=SQLITE_DYNAMIC ); if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE; if( n>0x7fffffff ){ @@ -87445,76 +87445,76 @@ SQLITE_API void sqlite3_result_text64( } } #ifndef SQLITE_OMIT_UTF16 -SQLITE_API void sqlite3_result_text16( - sqlite3_context *pCtx, +SQLITE_API void tdsqlite3_result_text16( + tdsqlite3_context *pCtx, const void *z, int n, void (*xDel)(void *) ){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); setResultStrOrError(pCtx, z, n, SQLITE_UTF16NATIVE, xDel); } -SQLITE_API void sqlite3_result_text16be( - sqlite3_context *pCtx, +SQLITE_API void tdsqlite3_result_text16be( + tdsqlite3_context *pCtx, const void *z, int n, void (*xDel)(void *) ){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); setResultStrOrError(pCtx, z, n, SQLITE_UTF16BE, xDel); } -SQLITE_API void sqlite3_result_text16le( - sqlite3_context *pCtx, +SQLITE_API void tdsqlite3_result_text16le( + tdsqlite3_context *pCtx, const void *z, int n, void (*xDel)(void *) ){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); setResultStrOrError(pCtx, z, n, SQLITE_UTF16LE, xDel); } #endif /* SQLITE_OMIT_UTF16 */ -SQLITE_API void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); - sqlite3VdbeMemCopy(pCtx->pOut, pValue); +SQLITE_API void tdsqlite3_result_value(tdsqlite3_context *pCtx, tdsqlite3_value *pValue){ + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); + tdsqlite3VdbeMemCopy(pCtx->pOut, pValue); } -SQLITE_API void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); - sqlite3VdbeMemSetZeroBlob(pCtx->pOut, n); +SQLITE_API void tdsqlite3_result_zeroblob(tdsqlite3_context *pCtx, int n){ + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); + tdsqlite3VdbeMemSetZeroBlob(pCtx->pOut, n); } -SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){ +SQLITE_API int tdsqlite3_result_zeroblob64(tdsqlite3_context *pCtx, u64 n){ Mem *pOut = pCtx->pOut; - assert( sqlite3_mutex_held(pOut->db->mutex) ); + assert( tdsqlite3_mutex_held(pOut->db->mutex) ); if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){ return SQLITE_TOOBIG; } - sqlite3VdbeMemSetZeroBlob(pCtx->pOut, (int)n); + tdsqlite3VdbeMemSetZeroBlob(pCtx->pOut, (int)n); return SQLITE_OK; } -SQLITE_API void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){ +SQLITE_API void tdsqlite3_result_error_code(tdsqlite3_context *pCtx, int errCode){ pCtx->isError = errCode ? errCode : -1; #ifdef SQLITE_DEBUG if( pCtx->pVdbe ) pCtx->pVdbe->rcApp = errCode; #endif if( pCtx->pOut->flags & MEM_Null ){ - sqlite3VdbeMemSetStr(pCtx->pOut, sqlite3ErrStr(errCode), -1, + tdsqlite3VdbeMemSetStr(pCtx->pOut, tdsqlite3ErrStr(errCode), -1, SQLITE_UTF8, SQLITE_STATIC); } } /* Force an SQLITE_TOOBIG error. */ -SQLITE_API void sqlite3_result_error_toobig(sqlite3_context *pCtx){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); +SQLITE_API void tdsqlite3_result_error_toobig(tdsqlite3_context *pCtx){ + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); pCtx->isError = SQLITE_TOOBIG; - sqlite3VdbeMemSetStr(pCtx->pOut, "string or blob too big", -1, + tdsqlite3VdbeMemSetStr(pCtx->pOut, "string or blob too big", -1, SQLITE_UTF8, SQLITE_STATIC); } /* An SQLITE_NOMEM error. */ -SQLITE_API void sqlite3_result_error_nomem(sqlite3_context *pCtx){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); - sqlite3VdbeMemSetNull(pCtx->pOut); +SQLITE_API void tdsqlite3_result_error_nomem(tdsqlite3_context *pCtx){ + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); + tdsqlite3VdbeMemSetNull(pCtx->pOut); pCtx->isError = SQLITE_NOMEM_BKPT; - sqlite3OomFault(pCtx->pOut->db); + tdsqlite3OomFault(pCtx->pOut->db); } #ifndef SQLITE_UNTESTABLE @@ -87522,8 +87522,8 @@ SQLITE_API void sqlite3_result_error_nomem(sqlite3_context *pCtx){ ** a MEM_IntReal value. See the SQLITE_TESTCTRL_RESULT_INTREAL ** test-control. */ -SQLITE_PRIVATE void sqlite3ResultIntReal(sqlite3_context *pCtx){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); +SQLITE_PRIVATE void tdsqlite3ResultIntReal(tdsqlite3_context *pCtx){ + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); if( pCtx->pOut->flags & MEM_Int ){ pCtx->pOut->flags &= ~MEM_Int; pCtx->pOut->flags |= MEM_IntReal; @@ -87534,9 +87534,9 @@ SQLITE_PRIVATE void sqlite3ResultIntReal(sqlite3_context *pCtx){ /* ** This function is called after a transaction has been committed. It -** invokes callbacks registered with sqlite3_wal_hook() as required. +** invokes callbacks registered with tdsqlite3_wal_hook() as required. */ -static int doWalCallbacks(sqlite3 *db){ +static int doWalCallbacks(tdsqlite3 *db){ int rc = SQLITE_OK; #ifndef SQLITE_OMIT_WAL int i; @@ -87544,9 +87544,9 @@ static int doWalCallbacks(sqlite3 *db){ Btree *pBt = db->aDb[i].pBt; if( pBt ){ int nEntry; - sqlite3BtreeEnter(pBt); - nEntry = sqlite3PagerWalCallback(sqlite3BtreePager(pBt)); - sqlite3BtreeLeave(pBt); + tdsqlite3BtreeEnter(pBt); + nEntry = tdsqlite3PagerWalCallback(tdsqlite3BtreePager(pBt)); + tdsqlite3BtreeLeave(pBt); if( nEntry>0 && db->xWalCallback && rc==SQLITE_OK ){ rc = db->xWalCallback(db->pWalArg, db, db->aDb[i].zDbSName, nEntry); } @@ -87564,17 +87564,17 @@ static int doWalCallbacks(sqlite3 *db){ ** This routine implements the bulk of the logic behind the sqlite_step() ** API. The only thing omitted is the automatic recompile if a ** schema change has occurred. That detail is handled by the -** outer sqlite3_step() wrapper procedure. +** outer tdsqlite3_step() wrapper procedure. */ -static int sqlite3Step(Vdbe *p){ - sqlite3 *db; +static int tdsqlite3Step(Vdbe *p){ + tdsqlite3 *db; int rc; assert(p); if( p->magic!=VDBE_MAGIC_RUN ){ - /* We used to require that sqlite3_reset() be called before retrying - ** sqlite3_step() after any error or after SQLITE_DONE. But beginning - ** with version 3.7.0, we changed this so that sqlite3_reset() would + /* We used to require that tdsqlite3_reset() be called before retrying + ** tdsqlite3_step() after any error or after SQLITE_DONE. But beginning + ** with version 3.7.0, we changed this so that tdsqlite3_reset() would ** be called automatically instead of throwing the SQLITE_MISUSE error. ** This "automatic-reset" change is not technically an incompatibility, ** since any application that receives an SQLITE_MISUSE is broken by @@ -87585,17 +87585,17 @@ static int sqlite3Step(Vdbe *p){ ** returns, and those were broken by the automatic-reset change. As a ** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the ** legacy behavior of returning SQLITE_MISUSE for cases where the - ** previous sqlite3_step() returned something other than a SQLITE_LOCKED + ** previous tdsqlite3_step() returned something other than a SQLITE_LOCKED ** or SQLITE_BUSY error. */ #ifdef SQLITE_OMIT_AUTORESET if( (rc = p->rc&0xff)==SQLITE_BUSY || rc==SQLITE_LOCKED ){ - sqlite3_reset((sqlite3_stmt*)p); + tdsqlite3_reset((tdsqlite3_stmt*)p); }else{ return SQLITE_MISUSE_BKPT; } #else - sqlite3_reset((sqlite3_stmt*)p); + tdsqlite3_reset((tdsqlite3_stmt*)p); #endif } @@ -87613,7 +87613,7 @@ static int sqlite3Step(Vdbe *p){ } if( p->pc<0 ){ /* If there are no other statements currently running, then - ** reset the interrupt flag. This prevents a call to sqlite3_interrupt + ** reset the interrupt flag. This prevents a call to tdsqlite3_interrupt ** from interrupting a statement that has not yet started. */ if( db->nVdbeActive==0 ){ @@ -87627,7 +87627,7 @@ static int sqlite3Step(Vdbe *p){ #ifndef SQLITE_OMIT_TRACE if( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0 && !db->init.busy && p->zSql ){ - sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime); + tdsqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime); }else{ assert( p->startTime==0 ); } @@ -87643,12 +87643,12 @@ static int sqlite3Step(Vdbe *p){ #endif #ifndef SQLITE_OMIT_EXPLAIN if( p->explain ){ - rc = sqlite3VdbeList(p); + rc = tdsqlite3VdbeList(p); }else #endif /* SQLITE_OMIT_EXPLAIN */ { db->nVdbeExec++; - rc = sqlite3VdbeExec(p); + rc = tdsqlite3VdbeExec(p); db->nVdbeExec--; } @@ -87668,15 +87668,15 @@ static int sqlite3Step(Vdbe *p){ } db->errCode = rc; - if( SQLITE_NOMEM==sqlite3ApiExit(p->db, p->rc) ){ + if( SQLITE_NOMEM==tdsqlite3ApiExit(p->db, p->rc) ){ p->rc = SQLITE_NOMEM_BKPT; } end_of_step: /* At this point local variable rc holds the value that should be ** returned if this statement was compiled using the legacy - ** sqlite3_prepare() interface. According to the docs, this can only + ** tdsqlite3_prepare() interface. According to the docs, this can only ** be one of the values in the first assert() below. Variable p->rc - ** contains the value that would be returned if sqlite3_finalize() + ** contains the value that would be returned if tdsqlite3_finalize() ** were called on statement p. */ assert( rc==SQLITE_ROW || rc==SQLITE_DONE || rc==SQLITE_ERROR @@ -87691,32 +87691,32 @@ end_of_step: ** error has occurred, then return the error code in p->rc to the ** caller. Set the error code in the database handle to the same value. */ - rc = sqlite3VdbeTransferError(p); + rc = tdsqlite3VdbeTransferError(p); } return (rc&db->errMask); } /* -** This is the top-level implementation of sqlite3_step(). Call -** sqlite3Step() to do most of the work. If a schema error occurs, -** call sqlite3Reprepare() and try again. +** This is the top-level implementation of tdsqlite3_step(). Call +** tdsqlite3Step() to do most of the work. If a schema error occurs, +** call tdsqlite3Reprepare() and try again. */ -SQLITE_API int sqlite3_step(sqlite3_stmt *pStmt){ - int rc = SQLITE_OK; /* Result from sqlite3Step() */ +SQLITE_API int tdsqlite3_step(tdsqlite3_stmt *pStmt){ + int rc = SQLITE_OK; /* Result from tdsqlite3Step() */ Vdbe *v = (Vdbe*)pStmt; /* the prepared statement */ int cnt = 0; /* Counter to prevent infinite loop of reprepares */ - sqlite3 *db; /* The database connection */ + tdsqlite3 *db; /* The database connection */ if( vdbeSafetyNotNull(v) ){ return SQLITE_MISUSE_BKPT; } db = v->db; - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); v->doingRerun = 0; - while( (rc = sqlite3Step(v))==SQLITE_SCHEMA + while( (rc = tdsqlite3Step(v))==SQLITE_SCHEMA && cnt++ < SQLITE_MAX_SCHEMA_RETRY ){ int savedPc = v->pc; - rc = sqlite3Reprepare(v); + rc = tdsqlite3Reprepare(v); if( rc!=SQLITE_OK ){ /* This case occurs after failing to recompile an sql statement. ** The error message from the SQL compiler has already been loaded @@ -87724,48 +87724,48 @@ SQLITE_API int sqlite3_step(sqlite3_stmt *pStmt){ ** from the database handle into the statement and sets the statement ** program counter to 0 to ensure that when the statement is ** finalized or reset the parser error message is available via - ** sqlite3_errmsg() and sqlite3_errcode(). + ** tdsqlite3_errmsg() and tdsqlite3_errcode(). */ - const char *zErr = (const char *)sqlite3_value_text(db->pErr); - sqlite3DbFree(db, v->zErrMsg); + const char *zErr = (const char *)tdsqlite3_value_text(db->pErr); + tdsqlite3DbFree(db, v->zErrMsg); if( !db->mallocFailed ){ - v->zErrMsg = sqlite3DbStrDup(db, zErr); - v->rc = rc = sqlite3ApiExit(db, rc); + v->zErrMsg = tdsqlite3DbStrDup(db, zErr); + v->rc = rc = tdsqlite3ApiExit(db, rc); } else { v->zErrMsg = 0; v->rc = rc = SQLITE_NOMEM_BKPT; } break; } - sqlite3_reset(pStmt); + tdsqlite3_reset(pStmt); if( savedPc>=0 ) v->doingRerun = 1; assert( v->expired==0 ); } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return rc; } /* -** Extract the user data from a sqlite3_context structure and return a +** Extract the user data from a tdsqlite3_context structure and return a ** pointer to it. */ -SQLITE_API void *sqlite3_user_data(sqlite3_context *p){ +SQLITE_API void *tdsqlite3_user_data(tdsqlite3_context *p){ assert( p && p->pFunc ); return p->pFunc->pUserData; } /* -** Extract the user data from a sqlite3_context structure and return a +** Extract the user data from a tdsqlite3_context structure and return a ** pointer to it. ** -** IMPLEMENTATION-OF: R-46798-50301 The sqlite3_context_db_handle() interface +** IMPLEMENTATION-OF: R-46798-50301 The tdsqlite3_context_db_handle() interface ** returns a copy of the pointer to the database connection (the 1st -** parameter) of the sqlite3_create_function() and -** sqlite3_create_function16() routines that originally registered the +** parameter) of the tdsqlite3_create_function() and +** tdsqlite3_create_function16() routines that originally registered the ** application defined function. */ -SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context *p){ +SQLITE_API tdsqlite3 *tdsqlite3_context_db_handle(tdsqlite3_context *p){ assert( p && p->pOut ); return p->pOut->db; } @@ -87784,9 +87784,9 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context *p){ ** performance by substituting a NULL result, or some other light-weight ** value, as a signal to the xUpdate routine that the column is unchanged. */ -SQLITE_API int sqlite3_vtab_nochange(sqlite3_context *p){ +SQLITE_API int tdsqlite3_vtab_nochange(tdsqlite3_context *p){ assert( p ); - return sqlite3_value_nochange(p->pOut); + return tdsqlite3_value_nochange(p->pOut); } /* @@ -87796,17 +87796,17 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context *p){ ** of the amount of time that elapses between invocations. In other words, ** the time returned is always the time of the first call. */ -SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context *p){ +SQLITE_PRIVATE tdsqlite3_int64 tdsqlite3StmtCurrentTime(tdsqlite3_context *p){ int rc; #ifndef SQLITE_ENABLE_STAT4 - sqlite3_int64 *piTime = &p->pVdbe->iCurrentTime; + tdsqlite3_int64 *piTime = &p->pVdbe->iCurrentTime; assert( p->pVdbe!=0 ); #else - sqlite3_int64 iTime = 0; - sqlite3_int64 *piTime = p->pVdbe!=0 ? &p->pVdbe->iCurrentTime : &iTime; + tdsqlite3_int64 iTime = 0; + tdsqlite3_int64 *piTime = p->pVdbe!=0 ? &p->pVdbe->iCurrentTime : &iTime; #endif if( *piTime==0 ){ - rc = sqlite3OsCurrentTimeInt64(p->pOut->db->pVfs, piTime); + rc = tdsqlite3OsCurrentTimeInt64(p->pOut->db->pVfs, piTime); if( rc ) *piTime = 0; } return *piTime; @@ -87816,14 +87816,14 @@ SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context *p){ ** Create a new aggregate context for p and return a pointer to ** its pMem->z element. */ -static SQLITE_NOINLINE void *createAggContext(sqlite3_context *p, int nByte){ +static SQLITE_NOINLINE void *createAggContext(tdsqlite3_context *p, int nByte){ Mem *pMem = p->pMem; assert( (pMem->flags & MEM_Agg)==0 ); if( nByte<=0 ){ - sqlite3VdbeMemSetNull(pMem); + tdsqlite3VdbeMemSetNull(pMem); pMem->z = 0; }else{ - sqlite3VdbeMemClearAndResize(pMem, nByte); + tdsqlite3VdbeMemClearAndResize(pMem, nByte); pMem->flags = MEM_Agg; pMem->u.pDef = p->pFunc; if( pMem->z ){ @@ -87838,9 +87838,9 @@ static SQLITE_NOINLINE void *createAggContext(sqlite3_context *p, int nByte){ ** context is allocated on the first call. Subsequent calls return the ** same context that was returned on prior calls. */ -SQLITE_API void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){ +SQLITE_API void *tdsqlite3_aggregate_context(tdsqlite3_context *p, int nByte){ assert( p && p->pFunc && p->pFunc->xFinalize ); - assert( sqlite3_mutex_held(p->pOut->db->mutex) ); + assert( tdsqlite3_mutex_held(p->pOut->db->mutex) ); testcase( nByte<0 ); if( (p->pMem->flags & MEM_Agg)==0 ){ return createAggContext(p, nByte); @@ -87859,10 +87859,10 @@ SQLITE_API void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){ ** auxiliary data pointers that is available to all functions within a ** single prepared statement. The iArg values must match. */ -SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){ +SQLITE_API void *tdsqlite3_get_auxdata(tdsqlite3_context *pCtx, int iArg){ AuxData *pAuxData; - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); #if SQLITE_ENABLE_STAT4 if( pCtx->pVdbe==0 ) return 0; #else @@ -87887,8 +87887,8 @@ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){ ** to all functions within the current prepared statement using iArg as an ** access code. */ -SQLITE_API void sqlite3_set_auxdata( - sqlite3_context *pCtx, +SQLITE_API void tdsqlite3_set_auxdata( + tdsqlite3_context *pCtx, int iArg, void *pAux, void (*xDelete)(void*) @@ -87896,7 +87896,7 @@ SQLITE_API void sqlite3_set_auxdata( AuxData *pAuxData; Vdbe *pVdbe = pCtx->pVdbe; - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); + assert( tdsqlite3_mutex_held(pCtx->pOut->db->mutex) ); #ifdef SQLITE_ENABLE_STAT4 if( pVdbe==0 ) goto failed; #else @@ -87909,7 +87909,7 @@ SQLITE_API void sqlite3_set_auxdata( } } if( pAuxData==0 ){ - pAuxData = sqlite3DbMallocZero(pVdbe->db, sizeof(AuxData)); + pAuxData = tdsqlite3DbMallocZero(pVdbe->db, sizeof(AuxData)); if( !pAuxData ) goto failed; pAuxData->iAuxOp = pCtx->iOp; pAuxData->iAuxArg = iArg; @@ -87940,7 +87940,7 @@ failed: ** implementations should keep their own counts within their aggregate ** context. */ -SQLITE_API int sqlite3_aggregate_count(sqlite3_context *p){ +SQLITE_API int tdsqlite3_aggregate_count(tdsqlite3_context *p){ assert( p && p->pMem && p->pFunc && p->pFunc->xFinalize ); return p->pMem->n; } @@ -87949,7 +87949,7 @@ SQLITE_API int sqlite3_aggregate_count(sqlite3_context *p){ /* ** Return the number of columns in the result set for the statement pStmt. */ -SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt){ +SQLITE_API int tdsqlite3_column_count(tdsqlite3_stmt *pStmt){ Vdbe *pVm = (Vdbe *)pStmt; return pVm ? pVm->nResColumn : 0; } @@ -87958,7 +87958,7 @@ SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt){ ** Return the number of values available from the current row of the ** currently executing statement pStmt. */ -SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt){ +SQLITE_API int tdsqlite3_data_count(tdsqlite3_stmt *pStmt){ Vdbe *pVm = (Vdbe *)pStmt; if( pVm==0 || pVm->pResultSet==0 ) return 0; return pVm->nResColumn; @@ -87991,7 +87991,7 @@ static const Mem *columnNullValue(void){ /* .zMalloc = */ (char*)0, /* .szMalloc = */ (int)0, /* .uTemp = */ (u32)0, - /* .db = */ (sqlite3*)0, + /* .db = */ (tdsqlite3*)0, /* .xDel = */ (void(*)(void*))0, #ifdef SQLITE_DEBUG /* .pScopyFrom = */ (Mem*)0, @@ -88007,25 +88007,25 @@ static const Mem *columnNullValue(void){ ** If iCol is not valid, return a pointer to a Mem which has a value ** of NULL. */ -static Mem *columnMem(sqlite3_stmt *pStmt, int i){ +static Mem *columnMem(tdsqlite3_stmt *pStmt, int i){ Vdbe *pVm; Mem *pOut; pVm = (Vdbe *)pStmt; if( pVm==0 ) return (Mem*)columnNullValue(); assert( pVm->db ); - sqlite3_mutex_enter(pVm->db->mutex); + tdsqlite3_mutex_enter(pVm->db->mutex); if( pVm->pResultSet!=0 && inResColumn && i>=0 ){ pOut = &pVm->pResultSet[i]; }else{ - sqlite3Error(pVm->db, SQLITE_RANGE); + tdsqlite3Error(pVm->db, SQLITE_RANGE); pOut = (Mem*)columnNullValue(); } return pOut; } /* -** This function is called after invoking an sqlite3_value_XXX function on a +** This function is called after invoking an tdsqlite3_value_XXX function on a ** column value (i.e. a value returned by evaluating an SQL expression in the ** select list of a SELECT statement) that may cause a malloc() failure. If ** malloc() has failed, the threads mallocFailed flag is cleared and the result @@ -88033,38 +88033,38 @@ static Mem *columnMem(sqlite3_stmt *pStmt, int i){ ** ** Specifically, this is called from within: ** -** sqlite3_column_int() -** sqlite3_column_int64() -** sqlite3_column_text() -** sqlite3_column_text16() -** sqlite3_column_real() -** sqlite3_column_bytes() -** sqlite3_column_bytes16() +** tdsqlite3_column_int() +** tdsqlite3_column_int64() +** tdsqlite3_column_text() +** tdsqlite3_column_text16() +** tdsqlite3_column_real() +** tdsqlite3_column_bytes() +** tdsqlite3_column_bytes16() ** sqiite3_column_blob() */ -static void columnMallocFailure(sqlite3_stmt *pStmt) +static void columnMallocFailure(tdsqlite3_stmt *pStmt) { /* If malloc() failed during an encoding conversion within an - ** sqlite3_column_XXX API, then set the return code of the statement to + ** tdsqlite3_column_XXX API, then set the return code of the statement to ** SQLITE_NOMEM. The next call to _step() (if any) will return SQLITE_ERROR ** and _finalize() will return NOMEM. */ Vdbe *p = (Vdbe *)pStmt; if( p ){ assert( p->db!=0 ); - assert( sqlite3_mutex_held(p->db->mutex) ); - p->rc = sqlite3ApiExit(p->db, p->rc); - sqlite3_mutex_leave(p->db->mutex); + assert( tdsqlite3_mutex_held(p->db->mutex) ); + p->rc = tdsqlite3ApiExit(p->db, p->rc); + tdsqlite3_mutex_leave(p->db->mutex); } } -/**************************** sqlite3_column_ ******************************* +/**************************** tdsqlite3_column_ ******************************* ** The following routines are used to access elements of the current row ** in the result set. */ -SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt *pStmt, int i){ +SQLITE_API const void *tdsqlite3_column_blob(tdsqlite3_stmt *pStmt, int i){ const void *val; - val = sqlite3_value_blob( columnMem(pStmt,i) ); + val = tdsqlite3_value_blob( columnMem(pStmt,i) ); /* Even though there is no encoding conversion, value_blob() might ** need to call malloc() to expand the result of a zeroblob() ** expression. @@ -88072,54 +88072,54 @@ SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt *pStmt, int i){ columnMallocFailure(pStmt); return val; } -SQLITE_API int sqlite3_column_bytes(sqlite3_stmt *pStmt, int i){ - int val = sqlite3_value_bytes( columnMem(pStmt,i) ); +SQLITE_API int tdsqlite3_column_bytes(tdsqlite3_stmt *pStmt, int i){ + int val = tdsqlite3_value_bytes( columnMem(pStmt,i) ); columnMallocFailure(pStmt); return val; } -SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt *pStmt, int i){ - int val = sqlite3_value_bytes16( columnMem(pStmt,i) ); +SQLITE_API int tdsqlite3_column_bytes16(tdsqlite3_stmt *pStmt, int i){ + int val = tdsqlite3_value_bytes16( columnMem(pStmt,i) ); columnMallocFailure(pStmt); return val; } -SQLITE_API double sqlite3_column_double(sqlite3_stmt *pStmt, int i){ - double val = sqlite3_value_double( columnMem(pStmt,i) ); +SQLITE_API double tdsqlite3_column_double(tdsqlite3_stmt *pStmt, int i){ + double val = tdsqlite3_value_double( columnMem(pStmt,i) ); columnMallocFailure(pStmt); return val; } -SQLITE_API int sqlite3_column_int(sqlite3_stmt *pStmt, int i){ - int val = sqlite3_value_int( columnMem(pStmt,i) ); +SQLITE_API int tdsqlite3_column_int(tdsqlite3_stmt *pStmt, int i){ + int val = tdsqlite3_value_int( columnMem(pStmt,i) ); columnMallocFailure(pStmt); return val; } -SQLITE_API sqlite_int64 sqlite3_column_int64(sqlite3_stmt *pStmt, int i){ - sqlite_int64 val = sqlite3_value_int64( columnMem(pStmt,i) ); +SQLITE_API sqlite_int64 tdsqlite3_column_int64(tdsqlite3_stmt *pStmt, int i){ + sqlite_int64 val = tdsqlite3_value_int64( columnMem(pStmt,i) ); columnMallocFailure(pStmt); return val; } -SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt *pStmt, int i){ - const unsigned char *val = sqlite3_value_text( columnMem(pStmt,i) ); +SQLITE_API const unsigned char *tdsqlite3_column_text(tdsqlite3_stmt *pStmt, int i){ + const unsigned char *val = tdsqlite3_value_text( columnMem(pStmt,i) ); columnMallocFailure(pStmt); return val; } -SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt *pStmt, int i){ +SQLITE_API tdsqlite3_value *tdsqlite3_column_value(tdsqlite3_stmt *pStmt, int i){ Mem *pOut = columnMem(pStmt, i); if( pOut->flags&MEM_Static ){ pOut->flags &= ~MEM_Static; pOut->flags |= MEM_Ephem; } columnMallocFailure(pStmt); - return (sqlite3_value *)pOut; + return (tdsqlite3_value *)pOut; } #ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt *pStmt, int i){ - const void *val = sqlite3_value_text16( columnMem(pStmt,i) ); +SQLITE_API const void *tdsqlite3_column_text16(tdsqlite3_stmt *pStmt, int i){ + const void *val = tdsqlite3_value_text16( columnMem(pStmt,i) ); columnMallocFailure(pStmt); return val; } #endif /* SQLITE_OMIT_UTF16 */ -SQLITE_API int sqlite3_column_type(sqlite3_stmt *pStmt, int i){ - int iType = sqlite3_value_type( columnMem(pStmt,i) ); +SQLITE_API int tdsqlite3_column_type(tdsqlite3_stmt *pStmt, int i){ + int iType = tdsqlite3_value_type( columnMem(pStmt,i) ); columnMallocFailure(pStmt); return iType; } @@ -88141,7 +88141,7 @@ SQLITE_API int sqlite3_column_type(sqlite3_stmt *pStmt, int i){ ** or a constant) then useTypes 2, 3, and 4 return NULL. */ static const void *columnName( - sqlite3_stmt *pStmt, /* The statement */ + tdsqlite3_stmt *pStmt, /* The statement */ int N, /* Which column to get the name for */ int useUtf16, /* True to return the name as UTF16 */ int useType /* What type of name */ @@ -88149,7 +88149,7 @@ static const void *columnName( const void *ret; Vdbe *p; int n; - sqlite3 *db; + tdsqlite3 *db; #ifdef SQLITE_ENABLE_API_ARMOR if( pStmt==0 ){ (void)SQLITE_MISUSE_BKPT; @@ -88160,27 +88160,27 @@ static const void *columnName( p = (Vdbe *)pStmt; db = p->db; assert( db!=0 ); - n = sqlite3_column_count(pStmt); + n = tdsqlite3_column_count(pStmt); if( N=0 ){ N += useType*n; - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); assert( db->mallocFailed==0 ); #ifndef SQLITE_OMIT_UTF16 if( useUtf16 ){ - ret = sqlite3_value_text16((sqlite3_value*)&p->aColName[N]); + ret = tdsqlite3_value_text16((tdsqlite3_value*)&p->aColName[N]); }else #endif { - ret = sqlite3_value_text((sqlite3_value*)&p->aColName[N]); + ret = tdsqlite3_value_text((tdsqlite3_value*)&p->aColName[N]); } /* A malloc may have failed inside of the _text() call. If this ** is the case, clear the mallocFailed flag and return NULL. */ if( db->mallocFailed ){ - sqlite3OomClear(db); + tdsqlite3OomClear(db); ret = 0; } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); } return ret; } @@ -88189,11 +88189,11 @@ static const void *columnName( ** Return the name of the Nth column of the result set returned by SQL ** statement pStmt. */ -SQLITE_API const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){ +SQLITE_API const char *tdsqlite3_column_name(tdsqlite3_stmt *pStmt, int N){ return columnName(pStmt, N, 0, COLNAME_NAME); } #ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){ +SQLITE_API const void *tdsqlite3_column_name16(tdsqlite3_stmt *pStmt, int N){ return columnName(pStmt, N, 1, COLNAME_NAME); } #endif @@ -88212,11 +88212,11 @@ SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){ ** Return the column declaration type (if applicable) of the 'i'th column ** of the result set of SQL statement pStmt. */ -SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){ +SQLITE_API const char *tdsqlite3_column_decltype(tdsqlite3_stmt *pStmt, int N){ return columnName(pStmt, N, 0, COLNAME_DECLTYPE); } #ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){ +SQLITE_API const void *tdsqlite3_column_decltype16(tdsqlite3_stmt *pStmt, int N){ return columnName(pStmt, N, 1, COLNAME_DECLTYPE); } #endif /* SQLITE_OMIT_UTF16 */ @@ -88228,11 +88228,11 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){ ** NULL is returned if the result column is an expression or constant or ** anything else which is not an unambiguous reference to a database column. */ -SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){ +SQLITE_API const char *tdsqlite3_column_database_name(tdsqlite3_stmt *pStmt, int N){ return columnName(pStmt, N, 0, COLNAME_DATABASE); } #ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){ +SQLITE_API const void *tdsqlite3_column_database_name16(tdsqlite3_stmt *pStmt, int N){ return columnName(pStmt, N, 1, COLNAME_DATABASE); } #endif /* SQLITE_OMIT_UTF16 */ @@ -88242,11 +88242,11 @@ SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N ** NULL is returned if the result column is an expression or constant or ** anything else which is not an unambiguous reference to a database column. */ -SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){ +SQLITE_API const char *tdsqlite3_column_table_name(tdsqlite3_stmt *pStmt, int N){ return columnName(pStmt, N, 0, COLNAME_TABLE); } #ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){ +SQLITE_API const void *tdsqlite3_column_table_name16(tdsqlite3_stmt *pStmt, int N){ return columnName(pStmt, N, 1, COLNAME_TABLE); } #endif /* SQLITE_OMIT_UTF16 */ @@ -88256,18 +88256,18 @@ SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){ ** NULL is returned if the result column is an expression or constant or ** anything else which is not an unambiguous reference to a database column. */ -SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){ +SQLITE_API const char *tdsqlite3_column_origin_name(tdsqlite3_stmt *pStmt, int N){ return columnName(pStmt, N, 0, COLNAME_COLUMN); } #ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){ +SQLITE_API const void *tdsqlite3_column_origin_name16(tdsqlite3_stmt *pStmt, int N){ return columnName(pStmt, N, 1, COLNAME_COLUMN); } #endif /* SQLITE_OMIT_UTF16 */ #endif /* SQLITE_ENABLE_COLUMN_METADATA */ -/******************************* sqlite3_bind_ *************************** +/******************************* tdsqlite3_bind_ *************************** ** ** Routines used to attach values to wildcards in a compiled SQL statement. */ @@ -88287,22 +88287,22 @@ static int vdbeUnbind(Vdbe *p, int i){ if( vdbeSafetyNotNull(p) ){ return SQLITE_MISUSE_BKPT; } - sqlite3_mutex_enter(p->db->mutex); + tdsqlite3_mutex_enter(p->db->mutex); if( p->magic!=VDBE_MAGIC_RUN || p->pc>=0 ){ - sqlite3Error(p->db, SQLITE_MISUSE); - sqlite3_mutex_leave(p->db->mutex); - sqlite3_log(SQLITE_MISUSE, + tdsqlite3Error(p->db, SQLITE_MISUSE); + tdsqlite3_mutex_leave(p->db->mutex); + tdsqlite3_log(SQLITE_MISUSE, "bind on a busy prepared statement: [%s]", p->zSql); return SQLITE_MISUSE_BKPT; } if( i<1 || i>p->nVar ){ - sqlite3Error(p->db, SQLITE_RANGE); - sqlite3_mutex_leave(p->db->mutex); + tdsqlite3Error(p->db, SQLITE_RANGE); + tdsqlite3_mutex_leave(p->db->mutex); return SQLITE_RANGE; } i--; pVar = &p->aVar[i]; - sqlite3VdbeMemRelease(pVar); + tdsqlite3VdbeMemRelease(pVar); pVar->flags = MEM_Null; p->db->errCode = SQLITE_OK; @@ -88312,7 +88312,7 @@ static int vdbeUnbind(Vdbe *p, int i){ ** IMPLEMENTATION-OF: R-48440-37595 If the specific value bound to host ** parameter in the WHERE clause might influence the choice of query plan ** for a statement, then the statement will be automatically recompiled, - ** as if there had been a schema change, on the first sqlite3_step() call + ** as if there had been a schema change, on the first tdsqlite3_step() call ** following any change to the bindings of that parameter. */ assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || p->expmask==0 ); @@ -88326,7 +88326,7 @@ static int vdbeUnbind(Vdbe *p, int i){ ** Bind a text or BLOB value. */ static int bindText( - sqlite3_stmt *pStmt, /* The statement to bind against */ + tdsqlite3_stmt *pStmt, /* The statement to bind against */ int i, /* Index of the parameter to bind */ const void *zData, /* Pointer to the data to be bound */ int nData, /* Number of bytes of data to be bound */ @@ -88341,16 +88341,16 @@ static int bindText( if( rc==SQLITE_OK ){ if( zData!=0 ){ pVar = &p->aVar[i-1]; - rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel); + rc = tdsqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel); if( rc==SQLITE_OK && encoding!=0 ){ - rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db)); + rc = tdsqlite3VdbeChangeEncoding(pVar, ENC(p->db)); } if( rc ){ - sqlite3Error(p->db, rc); - rc = sqlite3ApiExit(p->db, rc); + tdsqlite3Error(p->db, rc); + rc = tdsqlite3ApiExit(p->db, rc); } } - sqlite3_mutex_leave(p->db->mutex); + tdsqlite3_mutex_leave(p->db->mutex); }else if( xDel!=SQLITE_STATIC && xDel!=SQLITE_TRANSIENT ){ xDel((void*)zData); } @@ -88361,8 +88361,8 @@ static int bindText( /* ** Bind a blob value to an SQL statement variable. */ -SQLITE_API int sqlite3_bind_blob( - sqlite3_stmt *pStmt, +SQLITE_API int tdsqlite3_bind_blob( + tdsqlite3_stmt *pStmt, int i, const void *zData, int nData, @@ -88373,11 +88373,11 @@ SQLITE_API int sqlite3_bind_blob( #endif return bindText(pStmt, i, zData, nData, xDel, 0); } -SQLITE_API int sqlite3_bind_blob64( - sqlite3_stmt *pStmt, +SQLITE_API int tdsqlite3_bind_blob64( + tdsqlite3_stmt *pStmt, int i, const void *zData, - sqlite3_uint64 nData, + tdsqlite3_uint64 nData, void (*xDel)(void*) ){ assert( xDel!=SQLITE_DYNAMIC ); @@ -88387,40 +88387,40 @@ SQLITE_API int sqlite3_bind_blob64( return bindText(pStmt, i, zData, (int)nData, xDel, 0); } } -SQLITE_API int sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){ +SQLITE_API int tdsqlite3_bind_double(tdsqlite3_stmt *pStmt, int i, double rValue){ int rc; Vdbe *p = (Vdbe *)pStmt; rc = vdbeUnbind(p, i); if( rc==SQLITE_OK ){ - sqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue); - sqlite3_mutex_leave(p->db->mutex); + tdsqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue); + tdsqlite3_mutex_leave(p->db->mutex); } return rc; } -SQLITE_API int sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){ - return sqlite3_bind_int64(p, i, (i64)iValue); +SQLITE_API int tdsqlite3_bind_int(tdsqlite3_stmt *p, int i, int iValue){ + return tdsqlite3_bind_int64(p, i, (i64)iValue); } -SQLITE_API int sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValue){ +SQLITE_API int tdsqlite3_bind_int64(tdsqlite3_stmt *pStmt, int i, sqlite_int64 iValue){ int rc; Vdbe *p = (Vdbe *)pStmt; rc = vdbeUnbind(p, i); if( rc==SQLITE_OK ){ - sqlite3VdbeMemSetInt64(&p->aVar[i-1], iValue); - sqlite3_mutex_leave(p->db->mutex); + tdsqlite3VdbeMemSetInt64(&p->aVar[i-1], iValue); + tdsqlite3_mutex_leave(p->db->mutex); } return rc; } -SQLITE_API int sqlite3_bind_null(sqlite3_stmt *pStmt, int i){ +SQLITE_API int tdsqlite3_bind_null(tdsqlite3_stmt *pStmt, int i){ int rc; Vdbe *p = (Vdbe*)pStmt; rc = vdbeUnbind(p, i); if( rc==SQLITE_OK ){ - sqlite3_mutex_leave(p->db->mutex); + tdsqlite3_mutex_leave(p->db->mutex); } return rc; } -SQLITE_API int sqlite3_bind_pointer( - sqlite3_stmt *pStmt, +SQLITE_API int tdsqlite3_bind_pointer( + tdsqlite3_stmt *pStmt, int i, void *pPtr, const char *zPTtype, @@ -88430,15 +88430,15 @@ SQLITE_API int sqlite3_bind_pointer( Vdbe *p = (Vdbe*)pStmt; rc = vdbeUnbind(p, i); if( rc==SQLITE_OK ){ - sqlite3VdbeMemSetPointer(&p->aVar[i-1], pPtr, zPTtype, xDestructor); - sqlite3_mutex_leave(p->db->mutex); + tdsqlite3VdbeMemSetPointer(&p->aVar[i-1], pPtr, zPTtype, xDestructor); + tdsqlite3_mutex_leave(p->db->mutex); }else if( xDestructor ){ xDestructor(pPtr); } return rc; } -SQLITE_API int sqlite3_bind_text( - sqlite3_stmt *pStmt, +SQLITE_API int tdsqlite3_bind_text( + tdsqlite3_stmt *pStmt, int i, const char *zData, int nData, @@ -88446,11 +88446,11 @@ SQLITE_API int sqlite3_bind_text( ){ return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8); } -SQLITE_API int sqlite3_bind_text64( - sqlite3_stmt *pStmt, +SQLITE_API int tdsqlite3_bind_text64( + tdsqlite3_stmt *pStmt, int i, const char *zData, - sqlite3_uint64 nData, + tdsqlite3_uint64 nData, void (*xDel)(void*), unsigned char enc ){ @@ -88463,8 +88463,8 @@ SQLITE_API int sqlite3_bind_text64( } } #ifndef SQLITE_OMIT_UTF16 -SQLITE_API int sqlite3_bind_text16( - sqlite3_stmt *pStmt, +SQLITE_API int tdsqlite3_bind_text16( + tdsqlite3_stmt *pStmt, int i, const void *zData, int nData, @@ -88473,22 +88473,22 @@ SQLITE_API int sqlite3_bind_text16( return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE); } #endif /* SQLITE_OMIT_UTF16 */ -SQLITE_API int sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_value *pValue){ +SQLITE_API int tdsqlite3_bind_value(tdsqlite3_stmt *pStmt, int i, const tdsqlite3_value *pValue){ int rc; - switch( sqlite3_value_type((sqlite3_value*)pValue) ){ + switch( tdsqlite3_value_type((tdsqlite3_value*)pValue) ){ case SQLITE_INTEGER: { - rc = sqlite3_bind_int64(pStmt, i, pValue->u.i); + rc = tdsqlite3_bind_int64(pStmt, i, pValue->u.i); break; } case SQLITE_FLOAT: { - rc = sqlite3_bind_double(pStmt, i, pValue->u.r); + rc = tdsqlite3_bind_double(pStmt, i, pValue->u.r); break; } case SQLITE_BLOB: { if( pValue->flags & MEM_Zero ){ - rc = sqlite3_bind_zeroblob(pStmt, i, pValue->u.nZero); + rc = tdsqlite3_bind_zeroblob(pStmt, i, pValue->u.nZero); }else{ - rc = sqlite3_bind_blob(pStmt, i, pValue->z, pValue->n,SQLITE_TRANSIENT); + rc = tdsqlite3_bind_blob(pStmt, i, pValue->z, pValue->n,SQLITE_TRANSIENT); } break; } @@ -88498,34 +88498,34 @@ SQLITE_API int sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_valu break; } default: { - rc = sqlite3_bind_null(pStmt, i); + rc = tdsqlite3_bind_null(pStmt, i); break; } } return rc; } -SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){ +SQLITE_API int tdsqlite3_bind_zeroblob(tdsqlite3_stmt *pStmt, int i, int n){ int rc; Vdbe *p = (Vdbe *)pStmt; rc = vdbeUnbind(p, i); if( rc==SQLITE_OK ){ - sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n); - sqlite3_mutex_leave(p->db->mutex); + tdsqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n); + tdsqlite3_mutex_leave(p->db->mutex); } return rc; } -SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt *pStmt, int i, sqlite3_uint64 n){ +SQLITE_API int tdsqlite3_bind_zeroblob64(tdsqlite3_stmt *pStmt, int i, tdsqlite3_uint64 n){ int rc; Vdbe *p = (Vdbe *)pStmt; - sqlite3_mutex_enter(p->db->mutex); + tdsqlite3_mutex_enter(p->db->mutex); if( n>(u64)p->db->aLimit[SQLITE_LIMIT_LENGTH] ){ rc = SQLITE_TOOBIG; }else{ assert( (n & 0x7FFFFFFF)==n ); - rc = sqlite3_bind_zeroblob(pStmt, i, n); + rc = tdsqlite3_bind_zeroblob(pStmt, i, n); } - rc = sqlite3ApiExit(p->db, rc); - sqlite3_mutex_leave(p->db->mutex); + rc = tdsqlite3ApiExit(p->db, rc); + tdsqlite3_mutex_leave(p->db->mutex); return rc; } @@ -88533,7 +88533,7 @@ SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt *pStmt, int i, sqlite3_uint6 ** Return the number of wildcards that can be potentially bound to. ** This routine is added to support DBD::SQLite. */ -SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){ +SQLITE_API int tdsqlite3_bind_parameter_count(tdsqlite3_stmt *pStmt){ Vdbe *p = (Vdbe*)pStmt; return p ? p->nVar : 0; } @@ -88544,10 +88544,10 @@ SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){ ** ** The result is always UTF-8. */ -SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){ +SQLITE_API const char *tdsqlite3_bind_parameter_name(tdsqlite3_stmt *pStmt, int i){ Vdbe *p = (Vdbe*)pStmt; if( p==0 ) return 0; - return sqlite3VListNumToName(p->pVList, i); + return tdsqlite3VListNumToName(p->pVList, i); } /* @@ -88555,35 +88555,35 @@ SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){ ** with that name. If there is no variable with the given name, ** return 0. */ -SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe *p, const char *zName, int nName){ +SQLITE_PRIVATE int tdsqlite3VdbeParameterIndex(Vdbe *p, const char *zName, int nName){ if( p==0 || zName==0 ) return 0; - return sqlite3VListNameToNum(p->pVList, zName, nName); + return tdsqlite3VListNameToNum(p->pVList, zName, nName); } -SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){ - return sqlite3VdbeParameterIndex((Vdbe*)pStmt, zName, sqlite3Strlen30(zName)); +SQLITE_API int tdsqlite3_bind_parameter_index(tdsqlite3_stmt *pStmt, const char *zName){ + return tdsqlite3VdbeParameterIndex((Vdbe*)pStmt, zName, tdsqlite3Strlen30(zName)); } /* ** Transfer all bindings from the first statement over to the second. */ -SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){ +SQLITE_PRIVATE int tdsqlite3TransferBindings(tdsqlite3_stmt *pFromStmt, tdsqlite3_stmt *pToStmt){ Vdbe *pFrom = (Vdbe*)pFromStmt; Vdbe *pTo = (Vdbe*)pToStmt; int i; assert( pTo->db==pFrom->db ); assert( pTo->nVar==pFrom->nVar ); - sqlite3_mutex_enter(pTo->db->mutex); + tdsqlite3_mutex_enter(pTo->db->mutex); for(i=0; inVar; i++){ - sqlite3VdbeMemMove(&pTo->aVar[i], &pFrom->aVar[i]); + tdsqlite3VdbeMemMove(&pTo->aVar[i], &pFrom->aVar[i]); } - sqlite3_mutex_leave(pTo->db->mutex); + tdsqlite3_mutex_leave(pTo->db->mutex); return SQLITE_OK; } #ifndef SQLITE_OMIT_DEPRECATED /* ** Deprecated external interface. Internal/core SQLite code -** should call sqlite3TransferBindings. +** should call tdsqlite3TransferBindings. ** ** It is misuse to call this routine with statements from different ** database connections. But as this is a deprecated interface, we @@ -88593,7 +88593,7 @@ SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *pFromStmt, sqlite3_stmt ** an SQLITE_ERROR is returned. Nothing else can go wrong, so otherwise ** SQLITE_OK is returned. */ -SQLITE_API int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){ +SQLITE_API int tdsqlite3_transfer_bindings(tdsqlite3_stmt *pFromStmt, tdsqlite3_stmt *pToStmt){ Vdbe *pFrom = (Vdbe*)pFromStmt; Vdbe *pTo = (Vdbe*)pToStmt; if( pFrom->nVar!=pTo->nVar ){ @@ -88607,17 +88607,17 @@ SQLITE_API int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt * if( pFrom->expmask ){ pFrom->expired = 1; } - return sqlite3TransferBindings(pFromStmt, pToStmt); + return tdsqlite3TransferBindings(pFromStmt, pToStmt); } #endif /* -** Return the sqlite3* database handle to which the prepared statement given +** Return the tdsqlite3* database handle to which the prepared statement given ** in the argument belongs. This is the same database handle that was -** the first argument to the sqlite3_prepare() that was used to create +** the first argument to the tdsqlite3_prepare() that was used to create ** the statement in the first place. */ -SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt *pStmt){ +SQLITE_API tdsqlite3 *tdsqlite3_db_handle(tdsqlite3_stmt *pStmt){ return pStmt ? ((Vdbe*)pStmt)->db : 0; } @@ -88625,7 +88625,7 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt *pStmt){ ** Return true if the prepared statement is guaranteed to not modify the ** database. */ -SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt){ +SQLITE_API int tdsqlite3_stmt_readonly(tdsqlite3_stmt *pStmt){ return pStmt ? ((Vdbe*)pStmt)->readOnly : 1; } @@ -88633,14 +88633,14 @@ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt){ ** Return 1 if the statement is an EXPLAIN and return 2 if the ** statement is an EXPLAIN QUERY PLAN */ -SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt){ +SQLITE_API int tdsqlite3_stmt_isexplain(tdsqlite3_stmt *pStmt){ return pStmt ? ((Vdbe*)pStmt)->explain : 0; } /* ** Return true if the prepared statement is in need of being reset. */ -SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){ +SQLITE_API int tdsqlite3_stmt_busy(tdsqlite3_stmt *pStmt){ Vdbe *v = (Vdbe*)pStmt; return v!=0 && v->magic==VDBE_MAGIC_RUN && v->pc>=0; } @@ -88651,28 +88651,28 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){ ** prepared statement for the database connection. Return NULL if there ** are no more. */ -SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){ - sqlite3_stmt *pNext; +SQLITE_API tdsqlite3_stmt *tdsqlite3_next_stmt(tdsqlite3 *pDb, tdsqlite3_stmt *pStmt){ + tdsqlite3_stmt *pNext; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(pDb) ){ + if( !tdsqlite3SafetyCheckOk(pDb) ){ (void)SQLITE_MISUSE_BKPT; return 0; } #endif - sqlite3_mutex_enter(pDb->mutex); + tdsqlite3_mutex_enter(pDb->mutex); if( pStmt==0 ){ - pNext = (sqlite3_stmt*)pDb->pVdbe; + pNext = (tdsqlite3_stmt*)pDb->pVdbe; }else{ - pNext = (sqlite3_stmt*)((Vdbe*)pStmt)->pNext; + pNext = (tdsqlite3_stmt*)((Vdbe*)pStmt)->pNext; } - sqlite3_mutex_leave(pDb->mutex); + tdsqlite3_mutex_leave(pDb->mutex); return pNext; } /* ** Return the value of a status counter for a prepared statement */ -SQLITE_API int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){ +SQLITE_API int tdsqlite3_stmt_status(tdsqlite3_stmt *pStmt, int op, int resetFlag){ Vdbe *pVdbe = (Vdbe*)pStmt; u32 v; #ifdef SQLITE_ENABLE_API_ARMOR @@ -88684,14 +88684,14 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){ } #endif if( op==SQLITE_STMTSTATUS_MEMUSED ){ - sqlite3 *db = pVdbe->db; - sqlite3_mutex_enter(db->mutex); + tdsqlite3 *db = pVdbe->db; + tdsqlite3_mutex_enter(db->mutex); v = 0; db->pnBytesFreed = (int*)&v; - sqlite3VdbeClearObject(db, pVdbe); - sqlite3DbFree(db, pVdbe); + tdsqlite3VdbeClearObject(db, pVdbe); + tdsqlite3DbFree(db, pVdbe); db->pnBytesFreed = 0; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); }else{ v = pVdbe->aCounter[op]; if( resetFlag ) pVdbe->aCounter[op] = 0; @@ -88702,7 +88702,7 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){ /* ** Return the SQL associated with a prepared statement */ -SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt){ +SQLITE_API const char *tdsqlite3_sql(tdsqlite3_stmt *pStmt){ Vdbe *p = (Vdbe *)pStmt; return p ? p->zSql : 0; } @@ -88710,23 +88710,23 @@ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt){ /* ** Return the SQL associated with a prepared statement with ** bound parameters expanded. Space to hold the returned string is -** obtained from sqlite3_malloc(). The caller is responsible for -** freeing the returned string by passing it to sqlite3_free(). +** obtained from tdsqlite3_malloc(). The caller is responsible for +** freeing the returned string by passing it to tdsqlite3_free(). ** ** The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of ** expanded bound parameters. */ -SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt){ +SQLITE_API char *tdsqlite3_expanded_sql(tdsqlite3_stmt *pStmt){ #ifdef SQLITE_OMIT_TRACE return 0; #else char *z = 0; - const char *zSql = sqlite3_sql(pStmt); + const char *zSql = tdsqlite3_sql(pStmt); if( zSql ){ Vdbe *p = (Vdbe *)pStmt; - sqlite3_mutex_enter(p->db->mutex); - z = sqlite3VdbeExpandSql(p, zSql); - sqlite3_mutex_leave(p->db->mutex); + tdsqlite3_mutex_enter(p->db->mutex); + z = tdsqlite3VdbeExpandSql(p, zSql); + tdsqlite3_mutex_leave(p->db->mutex); } return z; #endif @@ -88736,13 +88736,13 @@ SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt){ /* ** Return the normalized SQL associated with a prepared statement. */ -SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt){ +SQLITE_API const char *tdsqlite3_normalized_sql(tdsqlite3_stmt *pStmt){ Vdbe *p = (Vdbe *)pStmt; if( p==0 ) return 0; if( p->zNormSql==0 && ALWAYS(p->zSql!=0) ){ - sqlite3_mutex_enter(p->db->mutex); - p->zNormSql = sqlite3Normalize(p, p->zSql); - sqlite3_mutex_leave(p->db->mutex); + tdsqlite3_mutex_enter(p->db->mutex); + p->zNormSql = tdsqlite3Normalize(p, p->zSql); + tdsqlite3_mutex_leave(p->db->mutex); } return p->zNormSql; } @@ -88761,10 +88761,10 @@ static UnpackedRecord *vdbeUnpackRecord( ){ UnpackedRecord *pRet; /* Return value */ - pRet = sqlite3VdbeAllocUnpackedRecord(pKeyInfo); + pRet = tdsqlite3VdbeAllocUnpackedRecord(pKeyInfo); if( pRet ){ memset(pRet->aMem, 0, sizeof(Mem)*(pKeyInfo->nKeyField+1)); - sqlite3VdbeRecordUnpack(pKeyInfo, nKey, pKey, pRet); + tdsqlite3VdbeRecordUnpack(pKeyInfo, nKey, pKey, pRet); } return pRet; } @@ -88773,7 +88773,7 @@ static UnpackedRecord *vdbeUnpackRecord( ** This function is called from within a pre-update callback to retrieve ** a field of the row currently being updated or deleted. */ -SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ +SQLITE_API int tdsqlite3_preupdate_old(tdsqlite3 *db, int iIdx, tdsqlite3_value **ppValue){ PreUpdate *p = db->pPreUpdate; Mem *pMem; int rc = SQLITE_OK; @@ -88785,7 +88785,7 @@ SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppVa goto preupdate_old_out; } if( p->pPk ){ - iIdx = sqlite3TableColumnToIndex(p->pPk, iIdx); + iIdx = tdsqlite3TableColumnToIndex(p->pPk, iIdx); } if( iIdx>=p->pCsr->nField || iIdx<0 ){ rc = SQLITE_RANGE; @@ -88797,16 +88797,16 @@ SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppVa u32 nRec; u8 *aRec; - nRec = sqlite3BtreePayloadSize(p->pCsr->uc.pCursor); - aRec = sqlite3DbMallocRaw(db, nRec); + nRec = tdsqlite3BtreePayloadSize(p->pCsr->uc.pCursor); + aRec = tdsqlite3DbMallocRaw(db, nRec); if( !aRec ) goto preupdate_old_out; - rc = sqlite3BtreePayload(p->pCsr->uc.pCursor, 0, nRec, aRec); + rc = tdsqlite3BtreePayload(p->pCsr->uc.pCursor, 0, nRec, aRec); if( rc==SQLITE_OK ){ p->pUnpacked = vdbeUnpackRecord(&p->keyinfo, nRec, aRec); if( !p->pUnpacked ) rc = SQLITE_NOMEM; } if( rc!=SQLITE_OK ){ - sqlite3DbFree(db, aRec); + tdsqlite3DbFree(db, aRec); goto preupdate_old_out; } p->aRecord = aRec; @@ -88814,20 +88814,20 @@ SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppVa pMem = *ppValue = &p->pUnpacked->aMem[iIdx]; if( iIdx==p->pTab->iPKey ){ - sqlite3VdbeMemSetInt64(pMem, p->iKey1); + tdsqlite3VdbeMemSetInt64(pMem, p->iKey1); }else if( iIdx>=p->pUnpacked->nField ){ - *ppValue = (sqlite3_value *)columnNullValue(); + *ppValue = (tdsqlite3_value *)columnNullValue(); }else if( p->pTab->aCol[iIdx].affinity==SQLITE_AFF_REAL ){ if( pMem->flags & (MEM_Int|MEM_IntReal) ){ testcase( pMem->flags & MEM_Int ); testcase( pMem->flags & MEM_IntReal ); - sqlite3VdbeMemRealify(pMem); + tdsqlite3VdbeMemRealify(pMem); } } preupdate_old_out: - sqlite3Error(db, rc); - return sqlite3ApiExit(db, rc); + tdsqlite3Error(db, rc); + return tdsqlite3ApiExit(db, rc); } #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ @@ -88836,7 +88836,7 @@ SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppVa ** This function is called from within a pre-update callback to retrieve ** the number of columns in the row being updated, deleted or inserted. */ -SQLITE_API int sqlite3_preupdate_count(sqlite3 *db){ +SQLITE_API int tdsqlite3_preupdate_count(tdsqlite3 *db){ PreUpdate *p = db->pPreUpdate; return (p ? p->keyinfo.nKeyField : 0); } @@ -88854,7 +88854,7 @@ SQLITE_API int sqlite3_preupdate_count(sqlite3 *db){ ** For the purposes of the previous paragraph, a foreign key CASCADE, SET NULL ** or SET DEFAULT action is considered a trigger. */ -SQLITE_API int sqlite3_preupdate_depth(sqlite3 *db){ +SQLITE_API int tdsqlite3_preupdate_depth(tdsqlite3 *db){ PreUpdate *p = db->pPreUpdate; return (p ? p->v->nFrame : 0); } @@ -88865,7 +88865,7 @@ SQLITE_API int sqlite3_preupdate_depth(sqlite3 *db){ ** This function is called from within a pre-update callback to retrieve ** a field of the row currently being updated or inserted. */ -SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ +SQLITE_API int tdsqlite3_preupdate_new(tdsqlite3 *db, int iIdx, tdsqlite3_value **ppValue){ PreUpdate *p = db->pPreUpdate; int rc = SQLITE_OK; Mem *pMem; @@ -88875,7 +88875,7 @@ SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppVa goto preupdate_new_out; } if( p->pPk && p->op!=SQLITE_UPDATE ){ - iIdx = sqlite3TableColumnToIndex(p->pPk, iIdx); + iIdx = tdsqlite3TableColumnToIndex(p->pPk, iIdx); } if( iIdx>=p->pCsr->nField || iIdx<0 ){ rc = SQLITE_RANGE; @@ -88899,9 +88899,9 @@ SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppVa } pMem = &pUnpack->aMem[iIdx]; if( iIdx==p->pTab->iPKey ){ - sqlite3VdbeMemSetInt64(pMem, p->iKey2); + tdsqlite3VdbeMemSetInt64(pMem, p->iKey2); }else if( iIdx>=pUnpack->nField ){ - pMem = (sqlite3_value *)columnNullValue(); + pMem = (tdsqlite3_value *)columnNullValue(); } }else{ /* For an UPDATE, memory cell (p->iNewReg+1+iIdx) contains the required @@ -88911,7 +88911,7 @@ SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppVa */ assert( p->op==SQLITE_UPDATE ); if( !p->aNew ){ - p->aNew = (Mem *)sqlite3DbMallocZero(db, sizeof(Mem) * p->pCsr->nField); + p->aNew = (Mem *)tdsqlite3DbMallocZero(db, sizeof(Mem) * p->pCsr->nField); if( !p->aNew ){ rc = SQLITE_NOMEM; goto preupdate_new_out; @@ -88921,9 +88921,9 @@ SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppVa pMem = &p->aNew[iIdx]; if( pMem->flags==0 ){ if( iIdx==p->pTab->iPKey ){ - sqlite3VdbeMemSetInt64(pMem, p->iKey2); + tdsqlite3VdbeMemSetInt64(pMem, p->iKey2); }else{ - rc = sqlite3VdbeMemCopy(pMem, &p->v->aMem[p->iNewReg+1+iIdx]); + rc = tdsqlite3VdbeMemCopy(pMem, &p->v->aMem[p->iNewReg+1+iIdx]); if( rc!=SQLITE_OK ) goto preupdate_new_out; } } @@ -88931,8 +88931,8 @@ SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppVa *ppValue = pMem; preupdate_new_out: - sqlite3Error(db, rc); - return sqlite3ApiExit(db, rc); + tdsqlite3Error(db, rc); + return tdsqlite3ApiExit(db, rc); } #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ @@ -88940,8 +88940,8 @@ SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppVa /* ** Return status data for a single loop within query pStmt. */ -SQLITE_API int sqlite3_stmt_scanstatus( - sqlite3_stmt *pStmt, /* Prepared statement being queried */ +SQLITE_API int tdsqlite3_stmt_scanstatus( + tdsqlite3_stmt *pStmt, /* Prepared statement being queried */ int idx, /* Index of loop to report on */ int iScanStatusOp, /* Which metric to return */ void *pOut /* OUT: Write the answer here */ @@ -88952,11 +88952,11 @@ SQLITE_API int sqlite3_stmt_scanstatus( pScan = &p->aScan[idx]; switch( iScanStatusOp ){ case SQLITE_SCANSTAT_NLOOP: { - *(sqlite3_int64*)pOut = p->anExec[pScan->addrLoop]; + *(tdsqlite3_int64*)pOut = p->anExec[pScan->addrLoop]; break; } case SQLITE_SCANSTAT_NVISIT: { - *(sqlite3_int64*)pOut = p->anExec[pScan->addrVisit]; + *(tdsqlite3_int64*)pOut = p->anExec[pScan->addrVisit]; break; } case SQLITE_SCANSTAT_EST: { @@ -88966,7 +88966,7 @@ SQLITE_API int sqlite3_stmt_scanstatus( x += 10; r *= 0.5; } - *(double*)pOut = r*sqlite3LogEstToInt(x); + *(double*)pOut = r*tdsqlite3LogEstToInt(x); break; } case SQLITE_SCANSTAT_NAME: { @@ -88997,9 +88997,9 @@ SQLITE_API int sqlite3_stmt_scanstatus( } /* -** Zero all counters associated with the sqlite3_stmt_scanstatus() data. +** Zero all counters associated with the tdsqlite3_stmt_scanstatus() data. */ -SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt){ +SQLITE_API void tdsqlite3_stmt_scanstatus_reset(tdsqlite3_stmt *pStmt){ Vdbe *p = (Vdbe*)pStmt; memset(p->anExec, 0, p->nOp * sizeof(i64)); } @@ -89020,7 +89020,7 @@ SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt){ ************************************************************************* ** ** This file contains code used to insert the values of host parameters -** (aka "wildcards") into the SQL text output by sqlite3_trace(). +** (aka "wildcards") into the SQL text output by tdsqlite3_trace(). ** ** The Vdbe parse-tree explainer is also found here. */ @@ -89042,7 +89042,7 @@ static int findNextHostParameter(const char *zSql, int *pnToken){ *pnToken = 0; while( zSql[0] ){ - n = sqlite3GetToken((u8*)zSql, &tokenType); + n = tdsqlite3GetToken((u8*)zSql, &tokenType); assert( n>0 && tokenType!=TK_ILLEGAL ); if( tokenType==TK_VARIABLE ){ *pnToken = n; @@ -89056,7 +89056,7 @@ static int findNextHostParameter(const char *zSql, int *pnToken){ /* ** This function returns a pointer to a nul-terminated string in memory -** obtained from sqlite3DbMalloc(). If sqlite3.nVdbeExec is 1, then the +** obtained from tdsqlite3DbMalloc(). If sqlite3.nVdbeExec is 1, then the ** string contains a copy of zRawSql but with host parameters expanded to ** their current bindings. Or, if sqlite3.nVdbeExec is greater than 1, ** then the returned string holds a copy of zRawSql with "-- " prepended @@ -89078,11 +89078,11 @@ static int findNextHostParameter(const char *zSql, int *pnToken){ ** parameter index is known, locate the value in p->aVar[]. Then render ** the value as a literal in place of the host parameter name. */ -SQLITE_PRIVATE char *sqlite3VdbeExpandSql( +SQLITE_PRIVATE char *tdsqlite3VdbeExpandSql( Vdbe *p, /* The prepared statement being evaluated */ const char *zRawSql /* Raw text of the SQL statement */ ){ - sqlite3 *db; /* The database connection */ + tdsqlite3 *db; /* The database connection */ int idx = 0; /* Index of a host parameter */ int nextIndex = 1; /* Index of next ? host parameter */ int n; /* Length of a token prefix */ @@ -89096,30 +89096,30 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql( char zBase[100]; /* Initial working space */ db = p->db; - sqlite3StrAccumInit(&out, 0, zBase, sizeof(zBase), + tdsqlite3StrAccumInit(&out, 0, zBase, sizeof(zBase), db->aLimit[SQLITE_LIMIT_LENGTH]); if( db->nVdbeExec>1 ){ while( *zRawSql ){ const char *zStart = zRawSql; while( *(zRawSql++)!='\n' && *zRawSql ); - sqlite3_str_append(&out, "-- ", 3); + tdsqlite3_str_append(&out, "-- ", 3); assert( (zRawSql - zStart) > 0 ); - sqlite3_str_append(&out, zStart, (int)(zRawSql-zStart)); + tdsqlite3_str_append(&out, zStart, (int)(zRawSql-zStart)); } }else if( p->nVar==0 ){ - sqlite3_str_append(&out, zRawSql, sqlite3Strlen30(zRawSql)); + tdsqlite3_str_append(&out, zRawSql, tdsqlite3Strlen30(zRawSql)); }else{ while( zRawSql[0] ){ n = findNextHostParameter(zRawSql, &nToken); assert( n>0 ); - sqlite3_str_append(&out, zRawSql, n); + tdsqlite3_str_append(&out, zRawSql, n); zRawSql += n; assert( zRawSql[0] || nToken==0 ); if( nToken==0 ) break; if( zRawSql[0]=='?' ){ if( nToken>1 ){ - assert( sqlite3Isdigit(zRawSql[1]) ); - sqlite3GetInt32(&zRawSql[1], &idx); + assert( tdsqlite3Isdigit(zRawSql[1]) ); + tdsqlite3GetInt32(&zRawSql[1], &idx); }else{ idx = nextIndex; } @@ -89130,7 +89130,7 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql( testcase( zRawSql[0]=='$' ); testcase( zRawSql[0]=='@' ); testcase( zRawSql[0]=='#' ); - idx = sqlite3VdbeParameterIndex(p, zRawSql, nToken); + idx = tdsqlite3VdbeParameterIndex(p, zRawSql, nToken); assert( idx>0 ); } zRawSql += nToken; @@ -89138,11 +89138,11 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql( assert( idx>0 && idx<=p->nVar ); pVar = &p->aVar[idx-1]; if( pVar->flags & MEM_Null ){ - sqlite3_str_append(&out, "NULL", 4); + tdsqlite3_str_append(&out, "NULL", 4); }else if( pVar->flags & (MEM_Int|MEM_IntReal) ){ - sqlite3_str_appendf(&out, "%lld", pVar->u.i); + tdsqlite3_str_appendf(&out, "%lld", pVar->u.i); }else if( pVar->flags & MEM_Real ){ - sqlite3_str_appendf(&out, "%!.15g", pVar->u.r); + tdsqlite3_str_appendf(&out, "%!.15g", pVar->u.r); }else if( pVar->flags & MEM_Str ){ int nOut; /* Number of bytes of the string text to include in output */ #ifndef SQLITE_OMIT_UTF16 @@ -89150,8 +89150,8 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql( if( enc!=SQLITE_UTF8 ){ memset(&utf8, 0, sizeof(utf8)); utf8.db = db; - sqlite3VdbeMemSetStr(&utf8, pVar->z, pVar->n, enc, SQLITE_STATIC); - if( SQLITE_NOMEM==sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8) ){ + tdsqlite3VdbeMemSetStr(&utf8, pVar->z, pVar->n, enc, SQLITE_STATIC); + if( SQLITE_NOMEM==tdsqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8) ){ out.accError = SQLITE_NOMEM; out.nAlloc = 0; } @@ -89165,39 +89165,39 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql( while( nOutn && (pVar->z[nOut]&0xc0)==0x80 ){ nOut++; } } #endif - sqlite3_str_appendf(&out, "'%.*q'", nOut, pVar->z); + tdsqlite3_str_appendf(&out, "'%.*q'", nOut, pVar->z); #ifdef SQLITE_TRACE_SIZE_LIMIT if( nOutn ){ - sqlite3_str_appendf(&out, "/*+%d bytes*/", pVar->n-nOut); + tdsqlite3_str_appendf(&out, "/*+%d bytes*/", pVar->n-nOut); } #endif #ifndef SQLITE_OMIT_UTF16 - if( enc!=SQLITE_UTF8 ) sqlite3VdbeMemRelease(&utf8); + if( enc!=SQLITE_UTF8 ) tdsqlite3VdbeMemRelease(&utf8); #endif }else if( pVar->flags & MEM_Zero ){ - sqlite3_str_appendf(&out, "zeroblob(%d)", pVar->u.nZero); + tdsqlite3_str_appendf(&out, "zeroblob(%d)", pVar->u.nZero); }else{ int nOut; /* Number of bytes of the blob to include in output */ assert( pVar->flags & MEM_Blob ); - sqlite3_str_append(&out, "x'", 2); + tdsqlite3_str_append(&out, "x'", 2); nOut = pVar->n; #ifdef SQLITE_TRACE_SIZE_LIMIT if( nOut>SQLITE_TRACE_SIZE_LIMIT ) nOut = SQLITE_TRACE_SIZE_LIMIT; #endif for(i=0; iz[i]&0xff); + tdsqlite3_str_appendf(&out, "%02x", pVar->z[i]&0xff); } - sqlite3_str_append(&out, "'", 1); + tdsqlite3_str_append(&out, "'", 1); #ifdef SQLITE_TRACE_SIZE_LIMIT if( nOutn ){ - sqlite3_str_appendf(&out, "/*+%d bytes*/", pVar->n-nOut); + tdsqlite3_str_appendf(&out, "/*+%d bytes*/", pVar->n-nOut); } #endif } } } - if( out.accError ) sqlite3_str_reset(&out); - return sqlite3StrAccumFinish(&out); + if( out.accError ) tdsqlite3_str_reset(&out); + return tdsqlite3StrAccumFinish(&out); } #endif /* #ifndef SQLITE_OMIT_TRACE */ @@ -89237,7 +89237,7 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql( ** like that ever happens. */ #ifdef SQLITE_DEBUG -# define memAboutToChange(P,M) sqlite3VdbeMemAboutToChange(P,M) +# define memAboutToChange(P,M) tdsqlite3VdbeMemAboutToChange(P,M) #else # define memAboutToChange(P,M) #endif @@ -89250,19 +89250,19 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql( ** help verify the correct operation of the library. */ #ifdef SQLITE_TEST -SQLITE_API int sqlite3_search_count = 0; +SQLITE_API int tdsqlite3_search_count = 0; #endif /* ** When this global variable is positive, it gets decremented once before ** each instruction in the VDBE. When it reaches zero, the u1.isInterrupted -** field of the sqlite3 structure is set in order to simulate an interrupt. +** field of the tdsqlite3 structure is set in order to simulate an interrupt. ** ** This facility is used for testing purposes only. It does not function ** in an ordinary build. */ #ifdef SQLITE_TEST -SQLITE_API int sqlite3_interrupt_count = 0; +SQLITE_API int tdsqlite3_interrupt_count = 0; #endif /* @@ -89273,7 +89273,7 @@ SQLITE_API int sqlite3_interrupt_count = 0; ** library. */ #ifdef SQLITE_TEST -SQLITE_API int sqlite3_sort_count = 0; +SQLITE_API int tdsqlite3_sort_count = 0; #endif /* @@ -89284,10 +89284,10 @@ SQLITE_API int sqlite3_sort_count = 0; ** help verify the correct operation of the library. */ #ifdef SQLITE_TEST -SQLITE_API int sqlite3_max_blobsize = 0; +SQLITE_API int tdsqlite3_max_blobsize = 0; static void updateMaxBlobsize(Mem *p){ - if( (p->flags & (MEM_Str|MEM_Blob))!=0 && p->n>sqlite3_max_blobsize ){ - sqlite3_max_blobsize = p->n; + if( (p->flags & (MEM_Str|MEM_Blob))!=0 && p->n>tdsqlite3_max_blobsize ){ + tdsqlite3_max_blobsize = p->n; } } #endif @@ -89310,7 +89310,7 @@ static void updateMaxBlobsize(Mem *p){ ** library. */ #ifdef SQLITE_TEST -SQLITE_API int sqlite3_found_count = 0; +SQLITE_API int tdsqlite3_found_count = 0; #endif /* @@ -89333,9 +89333,9 @@ SQLITE_API int sqlite3_found_count = 0; ** ** Other useful labels for breakpoints include: ** test_addop_breakpoint(pc,pOp) -** sqlite3CorruptError(lineno) -** sqlite3MisuseError(lineno) -** sqlite3CantopenError(lineno) +** tdsqlite3CorruptError(lineno) +** tdsqlite3MisuseError(lineno) +** tdsqlite3CantopenError(lineno) */ static void test_trace_breakpoint(int pc, Op *pOp, Vdbe *v){ static int n = 0; @@ -89397,7 +89397,7 @@ static void test_trace_breakpoint(int pc, Op *pOp, Vdbe *v){ ** away. */ mNever = iSrcLine >> 24; assert( (I & mNever)==0 ); - if( sqlite3GlobalConfig.xVdbeBranch==0 ) return; /*NO_TEST*/ + if( tdsqlite3GlobalConfig.xVdbeBranch==0 ) return; /*NO_TEST*/ /* Invoke the branch coverage callback with three arguments: ** iSrcLine - the line number of the VdbeCoverage() macro, with ** flags removed. @@ -89416,7 +89416,7 @@ static void test_trace_breakpoint(int pc, Op *pOp, Vdbe *v){ I |= 0x08; if( (mNever&0x08)!=0 && (I&0x05)!=0) I |= 0x05; /*NO_TEST*/ } - sqlite3GlobalConfig.xVdbeBranch(sqlite3GlobalConfig.pVdbeBranchArg, + tdsqlite3GlobalConfig.xVdbeBranch(tdsqlite3GlobalConfig.pVdbeBranchArg, iSrcLine&0xffffff, I, M); } #endif @@ -89434,7 +89434,7 @@ static void test_trace_breakpoint(int pc, Op *pOp, Vdbe *v){ */ #define Deephemeralize(P) \ if( ((P)->flags&MEM_Ephem)!=0 \ - && sqlite3VdbeMemMakeWriteable(P) ){ goto no_mem;} + && tdsqlite3VdbeMemMakeWriteable(P) ){ goto no_mem;} /* Return true if the cursor was opened using the OP_OpenSorter opcode. */ #define isSorter(x) ((x)->eCurType==CURTYPE_SORTER) @@ -89461,7 +89461,7 @@ static VdbeCursor *allocateCursor( ** allocations. ** ** * When using ENABLE_MEMORY_MANAGEMENT, memory cell buffers can - ** be freed lazily via the sqlite3_release_memory() API. This + ** be freed lazily via the tdsqlite3_release_memory() API. This ** minimizes the number of malloc calls made by the system. ** ** The memory cell for cursor 0 is aMem[0]. The rest are allocated from @@ -89474,19 +89474,19 @@ static VdbeCursor *allocateCursor( VdbeCursor *pCx = 0; nByte = ROUND8(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField + - (eCurType==CURTYPE_BTREE?sqlite3BtreeCursorSize():0); + (eCurType==CURTYPE_BTREE?tdsqlite3BtreeCursorSize():0); assert( iCur>=0 && iCurnCursor ); if( p->apCsr[iCur] ){ /*OPTIMIZATION-IF-FALSE*/ - /* Before calling sqlite3VdbeFreeCursor(), ensure the isEphemeral flag + /* Before calling tdsqlite3VdbeFreeCursor(), ensure the isEphemeral flag ** is clear. Otherwise, if this is an ephemeral cursor created by ** OP_OpenDup, the cursor will not be closed and will still be part ** of a BtShared.pCursor list. */ if( p->apCsr[iCur]->pBtx==0 ) p->apCsr[iCur]->isEphemeral = 0; - sqlite3VdbeFreeCursor(p, p->apCsr[iCur]); + tdsqlite3VdbeFreeCursor(p, p->apCsr[iCur]); p->apCsr[iCur] = 0; } - if( SQLITE_OK==sqlite3VdbeMemClearAndResize(pMem, nByte) ){ + if( SQLITE_OK==tdsqlite3VdbeMemClearAndResize(pMem, nByte) ){ p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z; memset(pCx, 0, offsetof(VdbeCursor,pAltCursor)); pCx->eCurType = eCurType; @@ -89496,7 +89496,7 @@ static VdbeCursor *allocateCursor( if( eCurType==CURTYPE_BTREE ){ pCx->uc.pCursor = (BtCursor*) &pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField]; - sqlite3BtreeCursorZero(pCx->uc.pCursor); + tdsqlite3BtreeCursorZero(pCx->uc.pCursor); } } return pCx; @@ -89510,11 +89510,11 @@ static VdbeCursor *allocateCursor( */ static int alsoAnInt(Mem *pRec, double rValue, i64 *piValue){ i64 iValue = (double)rValue; - if( sqlite3RealSameAsInt(rValue,iValue) ){ + if( tdsqlite3RealSameAsInt(rValue,iValue) ){ *piValue = iValue; return 1; } - return 0==sqlite3Atoi64(pRec->z, piValue, pRec->n, pRec->enc); + return 0==tdsqlite3Atoi64(pRec->z, piValue, pRec->n, pRec->enc); } /* @@ -89537,14 +89537,14 @@ static void applyNumericAffinity(Mem *pRec, int bTryForInt){ u8 enc = pRec->enc; int rc; assert( (pRec->flags & (MEM_Str|MEM_Int|MEM_Real|MEM_IntReal))==MEM_Str ); - rc = sqlite3AtoF(pRec->z, &rValue, pRec->n, enc); + rc = tdsqlite3AtoF(pRec->z, &rValue, pRec->n, enc); if( rc<=0 ) return; if( rc==1 && alsoAnInt(pRec, rValue, &pRec->u.i) ){ pRec->flags |= MEM_Int; }else{ pRec->u.r = rValue; pRec->flags |= MEM_Real; - if( bTryForInt ) sqlite3VdbeIntegerAffinity(pRec); + if( bTryForInt ) tdsqlite3VdbeIntegerAffinity(pRec); } /* TEXT->NUMERIC is many->one. Hence, it is important to invalidate the ** string representation after computing a numeric equivalent, because the @@ -89584,7 +89584,7 @@ static void applyAffinity( if( (pRec->flags & MEM_Real)==0 ){ if( pRec->flags & MEM_Str ) applyNumericAffinity(pRec,1); }else{ - sqlite3VdbeIntegerAffinity(pRec); + tdsqlite3VdbeIntegerAffinity(pRec); } } }else if( affinity==SQLITE_AFF_TEXT ){ @@ -89598,7 +89598,7 @@ static void applyAffinity( testcase( pRec->flags & MEM_Int ); testcase( pRec->flags & MEM_Real ); testcase( pRec->flags & MEM_IntReal ); - sqlite3VdbeMemStringify(pRec, enc, 1); + tdsqlite3VdbeMemStringify(pRec, enc, 1); } } pRec->flags &= ~(MEM_Real|MEM_Int|MEM_IntReal); @@ -89611,22 +89611,22 @@ static void applyAffinity( ** is appropriate. But only do the conversion if it is possible without ** loss of information and return the revised type of the argument. */ -SQLITE_API int sqlite3_value_numeric_type(sqlite3_value *pVal){ - int eType = sqlite3_value_type(pVal); +SQLITE_API int tdsqlite3_value_numeric_type(tdsqlite3_value *pVal){ + int eType = tdsqlite3_value_type(pVal); if( eType==SQLITE_TEXT ){ Mem *pMem = (Mem*)pVal; applyNumericAffinity(pMem, 0); - eType = sqlite3_value_type(pVal); + eType = tdsqlite3_value_type(pVal); } return eType; } /* -** Exported version of applyAffinity(). This one works on sqlite3_value*, +** Exported version of applyAffinity(). This one works on tdsqlite3_value*, ** not the internal Mem* type. */ -SQLITE_PRIVATE void sqlite3ValueApplyAffinity( - sqlite3_value *pVal, +SQLITE_PRIVATE void tdsqlite3ValueApplyAffinity( + tdsqlite3_value *pVal, u8 affinity, u8 enc ){ @@ -89641,19 +89641,19 @@ SQLITE_PRIVATE void sqlite3ValueApplyAffinity( */ static u16 SQLITE_NOINLINE computeNumericType(Mem *pMem){ int rc; - sqlite3_int64 ix; + tdsqlite3_int64 ix; assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal))==0 ); assert( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ); ExpandBlob(pMem); - rc = sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc); + rc = tdsqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc); if( rc<=0 ){ - if( rc==0 && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)<=1 ){ + if( rc==0 && tdsqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)<=1 ){ pMem->u.i = ix; return MEM_Int; }else{ return MEM_Real; } - }else if( rc==1 && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)==0 ){ + }else if( rc==1 && tdsqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)==0 ){ pMem->u.i = ix; return MEM_Int; } @@ -89687,7 +89687,7 @@ static u16 numericType(Mem *pMem){ ** Write a nice string representation of the contents of cell pMem ** into buffer zBuf, length nBuf. */ -SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, StrAccum *pStr){ +SQLITE_PRIVATE void tdsqlite3VdbeMemPrettyPrint(Mem *pMem, StrAccum *pStr){ int f = pMem->flags; static const char *const encnames[] = {"(X)", "(8)", "(16LE)", "(16BE)"}; if( f&MEM_Blob ){ @@ -89705,18 +89705,18 @@ SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, StrAccum *pStr){ }else{ c = 's'; } - sqlite3_str_appendf(pStr, "%cx[", c); + tdsqlite3_str_appendf(pStr, "%cx[", c); for(i=0; i<25 && in; i++){ - sqlite3_str_appendf(pStr, "%02X", ((int)pMem->z[i] & 0xFF)); + tdsqlite3_str_appendf(pStr, "%02X", ((int)pMem->z[i] & 0xFF)); } - sqlite3_str_appendf(pStr, "|"); + tdsqlite3_str_appendf(pStr, "|"); for(i=0; i<25 && in; i++){ char z = pMem->z[i]; - sqlite3_str_appendchar(pStr, 1, (z<32||z>126)?'.':z); + tdsqlite3_str_appendchar(pStr, 1, (z<32||z>126)?'.':z); } - sqlite3_str_appendf(pStr,"]"); + tdsqlite3_str_appendf(pStr,"]"); if( f & MEM_Zero ){ - sqlite3_str_appendf(pStr, "+%dz",pMem->u.nZero); + tdsqlite3_str_appendf(pStr, "+%dz",pMem->u.nZero); } }else if( f & MEM_Str ){ int j; @@ -89733,12 +89733,12 @@ SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, StrAccum *pStr){ }else{ c = 's'; } - sqlite3_str_appendf(pStr, " %c%d[", c, pMem->n); + tdsqlite3_str_appendf(pStr, " %c%d[", c, pMem->n); for(j=0; j<25 && jn; j++){ c = pMem->z[j]; - sqlite3_str_appendchar(pStr, 1, (c>=0x20&&c<=0x7f) ? c : '.'); + tdsqlite3_str_appendchar(pStr, 1, (c>=0x20&&c<=0x7f) ? c : '.'); } - sqlite3_str_appendf(pStr, "]%s", encnames[pMem->enc]); + tdsqlite3_str_appendf(pStr, "]%s", encnames[pMem->enc]); } } #endif @@ -89762,14 +89762,14 @@ static void memTracePrint(Mem *p){ }else if( p->flags & MEM_Real ){ printf(" r:%.17g", p->u.r); #endif - }else if( sqlite3VdbeMemIsRowSet(p) ){ + }else if( tdsqlite3VdbeMemIsRowSet(p) ){ printf(" (rowset)"); }else{ StrAccum acc; char zBuf[1000]; - sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); - sqlite3VdbeMemPrettyPrint(p, &acc); - printf(" %s", sqlite3StrAccumFinish(&acc)); + tdsqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); + tdsqlite3VdbeMemPrettyPrint(p, &acc); + printf(" %s", tdsqlite3StrAccumFinish(&acc)); } if( p->flags & MEM_Subtype ) printf(" subtype=0x%02x", p->eSubtype); } @@ -89780,7 +89780,7 @@ static void registerTrace(int iReg, Mem *p){ printf(" <== R[%d]", (int)(p->pScopyFrom - &p[-iReg])); } printf("\n"); - sqlite3VdbeCheckMemInvariants(p); + tdsqlite3VdbeCheckMemInvariants(p); } #endif @@ -89789,7 +89789,7 @@ static void registerTrace(int iReg, Mem *p){ ** Show the values of all registers in the virtual machine. Used for ** interactive debugging. */ -SQLITE_PRIVATE void sqlite3VdbeRegisterDump(Vdbe *v){ +SQLITE_PRIVATE void tdsqlite3VdbeRegisterDump(Vdbe *v){ int i; for(i=1; inMem; i++) registerTrace(i, v->aMem+i); } @@ -89841,7 +89841,7 @@ SQLITE_PRIVATE void sqlite3VdbeRegisterDump(Vdbe *v){ #if defined(__GNUC__) - __inline__ sqlite_uint64 sqlite3Hwtime(void){ + __inline__ sqlite_uint64 tdsqlite3Hwtime(void){ unsigned int lo, hi; __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); return (sqlite_uint64)hi << 32 | lo; @@ -89849,7 +89849,7 @@ SQLITE_PRIVATE void sqlite3VdbeRegisterDump(Vdbe *v){ #elif defined(_MSC_VER) - __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ + __declspec(naked) __inline sqlite_uint64 __cdecl tdsqlite3Hwtime(void){ __asm { rdtsc ret ; return value at EDX:EAX @@ -89860,7 +89860,7 @@ SQLITE_PRIVATE void sqlite3VdbeRegisterDump(Vdbe *v){ #elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) - __inline__ sqlite_uint64 sqlite3Hwtime(void){ + __inline__ sqlite_uint64 tdsqlite3Hwtime(void){ unsigned long val; __asm__ __volatile__ ("rdtsc" : "=A" (val)); return val; @@ -89868,7 +89868,7 @@ SQLITE_PRIVATE void sqlite3VdbeRegisterDump(Vdbe *v){ #elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) - __inline__ sqlite_uint64 sqlite3Hwtime(void){ + __inline__ sqlite_uint64 tdsqlite3Hwtime(void){ unsigned long long retval; unsigned long junk; __asm__ __volatile__ ("\n\ @@ -89885,13 +89885,13 @@ SQLITE_PRIVATE void sqlite3VdbeRegisterDump(Vdbe *v){ /* ** asm() is needed for hardware timing support. Without asm(), - ** disable the sqlite3Hwtime() routine. + ** disable the tdsqlite3Hwtime() routine. ** - ** sqlite3Hwtime() is only used for some obscure debugging + ** tdsqlite3Hwtime() is only used for some obscure debugging ** and analysis configurations, not in any deliverable, so this ** should not be a great loss. */ -SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } +SQLITE_PRIVATE sqlite_uint64 tdsqlite3Hwtime(void){ return ((sqlite_uint64)0); } #endif @@ -89913,7 +89913,7 @@ SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } ** ** assert( checkSavepointCount(db) ); */ -static int checkSavepointCount(sqlite3 *db){ +static int checkSavepointCount(tdsqlite3 *db){ int n = 0; Savepoint *p; for(p=db->pSavepoint; p; p=p->pNext) n++; @@ -89927,7 +89927,7 @@ static int checkSavepointCount(sqlite3 *db){ ** overwritten with an integer value. */ static SQLITE_NOINLINE Mem *out2PrereleaseWithClear(Mem *pOut){ - sqlite3VdbeMemSetNull(pOut); + tdsqlite3VdbeMemSetNull(pOut); pOut->flags = MEM_Int; return pOut; } @@ -89948,9 +89948,9 @@ static Mem *out2Prerelease(Vdbe *p, VdbeOp *pOp){ /* ** Execute as much of a VDBE program as we can. -** This is the core of sqlite3_step(). +** This is the core of tdsqlite3_step(). */ -SQLITE_PRIVATE int sqlite3VdbeExec( +SQLITE_PRIVATE int tdsqlite3VdbeExec( Vdbe *p /* The VDBE */ ){ Op *aOp = p->aOp; /* Copy of p->aOp */ @@ -89962,7 +89962,7 @@ SQLITE_PRIVATE int sqlite3VdbeExec( int nExtraDelete = 0; /* Verifies FORDELETE and AUXDELETE flags */ #endif int rc = SQLITE_OK; /* Value to return */ - sqlite3 *db = p->db; /* The database */ + tdsqlite3 *db = p->db; /* The database */ u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */ u8 encoding = ENC(db); /* The database encoding */ int iCompare = 0; /* Result of last comparison */ @@ -89980,8 +89980,8 @@ SQLITE_PRIVATE int sqlite3VdbeExec( #endif /*** INSERT STACK UNION HERE ***/ - assert( p->magic==VDBE_MAGIC_RUN ); /* sqlite3_step() verifies this */ - sqlite3VdbeEnter(p); + assert( p->magic==VDBE_MAGIC_RUN ); /* tdsqlite3_step() verifies this */ + tdsqlite3VdbeEnter(p); #ifndef SQLITE_OMIT_PROGRESS_CALLBACK if( db->xProgress ){ u32 iPrior = p->aCounter[SQLITE_STMTSTATUS_VM_STEP]; @@ -89992,8 +89992,8 @@ SQLITE_PRIVATE int sqlite3VdbeExec( } #endif if( p->rc==SQLITE_NOMEM ){ - /* This happens if a malloc() inside a call to sqlite3_column_text() or - ** sqlite3_column_text16() failed. */ + /* This happens if a malloc() inside a call to tdsqlite3_column_text() or + ** tdsqlite3_column_text16() failed. */ goto no_mem; } assert( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_BUSY ); @@ -90003,19 +90003,19 @@ SQLITE_PRIVATE int sqlite3VdbeExec( p->pResultSet = 0; db->busyHandler.nBusy = 0; if( db->u1.isInterrupted ) goto abort_due_to_interrupt; - sqlite3VdbeIOTraceSql(p); + tdsqlite3VdbeIOTraceSql(p); #ifdef SQLITE_DEBUG - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); if( p->pc==0 && (p->db->flags & (SQLITE_VdbeListing|SQLITE_VdbeEQP|SQLITE_VdbeTrace))!=0 ){ int i; int once = 1; - sqlite3VdbePrintSql(p); + tdsqlite3VdbePrintSql(p); if( p->db->flags & SQLITE_VdbeListing ){ printf("VDBE Program Listing:\n"); for(i=0; inOp; i++){ - sqlite3VdbePrintOp(stdout, i, &aOp[i]); + tdsqlite3VdbePrintOp(stdout, i, &aOp[i]); } } if( p->db->flags & SQLITE_VdbeEQP ){ @@ -90029,7 +90029,7 @@ SQLITE_PRIVATE int sqlite3VdbeExec( } if( p->db->flags & SQLITE_VdbeTrace ) printf("VDBE Trace:\n"); } - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); #endif for(pOp=&aOp[p->pc]; 1; pOp++){ /* Errors are detected by individual opcodes, with an immediate @@ -90038,7 +90038,7 @@ SQLITE_PRIVATE int sqlite3VdbeExec( assert( pOp>=aOp && pOp<&aOp[p->nOp]); #ifdef VDBE_PROFILE - start = sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime(); + start = tdsqlite3NProfileCnt ? tdsqlite3NProfileCnt : tdsqlite3Hwtime(); #endif nVmStep++; #ifdef SQLITE_ENABLE_STMT_SCANSTATUS @@ -90049,7 +90049,7 @@ SQLITE_PRIVATE int sqlite3VdbeExec( */ #ifdef SQLITE_DEBUG if( db->flags & SQLITE_VdbeTrace ){ - sqlite3VdbePrintOp(stdout, (int)(pOp - aOp), pOp); + tdsqlite3VdbePrintOp(stdout, (int)(pOp - aOp), pOp); test_trace_breakpoint((int)(pOp - aOp),pOp,p); } #endif @@ -90059,10 +90059,10 @@ SQLITE_PRIVATE int sqlite3VdbeExec( ** if we have a special test build. */ #ifdef SQLITE_TEST - if( sqlite3_interrupt_count>0 ){ - sqlite3_interrupt_count--; - if( sqlite3_interrupt_count==0 ){ - sqlite3_interrupt(db); + if( tdsqlite3_interrupt_count>0 ){ + tdsqlite3_interrupt_count--; + if( tdsqlite3_interrupt_count==0 ){ + tdsqlite3_interrupt(db); } } #endif @@ -90070,26 +90070,26 @@ SQLITE_PRIVATE int sqlite3VdbeExec( /* Sanity checking on other operands */ #ifdef SQLITE_DEBUG { - u8 opProperty = sqlite3OpcodeProperty[pOp->opcode]; + u8 opProperty = tdsqlite3OpcodeProperty[pOp->opcode]; if( (opProperty & OPFLG_IN1)!=0 ){ assert( pOp->p1>0 ); assert( pOp->p1<=(p->nMem+1 - p->nCursor) ); assert( memIsValid(&aMem[pOp->p1]) ); - assert( sqlite3VdbeCheckMemInvariants(&aMem[pOp->p1]) ); + assert( tdsqlite3VdbeCheckMemInvariants(&aMem[pOp->p1]) ); REGISTER_TRACE(pOp->p1, &aMem[pOp->p1]); } if( (opProperty & OPFLG_IN2)!=0 ){ assert( pOp->p2>0 ); assert( pOp->p2<=(p->nMem+1 - p->nCursor) ); assert( memIsValid(&aMem[pOp->p2]) ); - assert( sqlite3VdbeCheckMemInvariants(&aMem[pOp->p2]) ); + assert( tdsqlite3VdbeCheckMemInvariants(&aMem[pOp->p2]) ); REGISTER_TRACE(pOp->p2, &aMem[pOp->p2]); } if( (opProperty & OPFLG_IN3)!=0 ){ assert( pOp->p3>0 ); assert( pOp->p3<=(p->nMem+1 - p->nCursor) ); assert( memIsValid(&aMem[pOp->p3]) ); - assert( sqlite3VdbeCheckMemInvariants(&aMem[pOp->p3]) ); + assert( tdsqlite3VdbeCheckMemInvariants(&aMem[pOp->p3]) ); REGISTER_TRACE(pOp->p3, &aMem[pOp->p3]); } if( (opProperty & OPFLG_OUT2)!=0 ){ @@ -90177,20 +90177,20 @@ jump_to_p2_and_check_for_interrupt: /* Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev, ** OP_VNext, or OP_SorterNext) all jump here upon - ** completion. Check to see if sqlite3_interrupt() has been called + ** completion. Check to see if tdsqlite3_interrupt() has been called ** or if the progress callback needs to be invoked. ** ** This code uses unstructured "goto" statements and does not look clean. ** But that is not due to sloppy coding habits. The code is written this ** way for performance, to avoid having to run the interrupt and progress - ** checks on every opcode. This helps sqlite3_step() to run about 1.5% + ** checks on every opcode. This helps tdsqlite3_step() to run about 1.5% ** faster according to "valgrind --tool=cachegrind" */ check_for_interrupt: if( db->u1.isInterrupted ) goto abort_due_to_interrupt; #ifndef SQLITE_OMIT_PROGRESS_CALLBACK /* Call the progress callback if it is configured and the required number ** of VDBE ops have been executed (either since this invocation of - ** sqlite3VdbeExec() or since last time the progress callback was called). + ** tdsqlite3VdbeExec() or since last time the progress callback was called). ** If the progress callback returns non-zero, exit the virtual machine with ** a return code SQLITE_ABORT. */ @@ -90322,7 +90322,7 @@ case OP_Yield: { /* in1, jump */ case OP_HaltIfNull: { /* in3 */ pIn3 = &aMem[pOp->p3]; #ifdef SQLITE_DEBUG - if( pOp->p2==OE_Abort ){ sqlite3VdbeAssertAbortable(p); } + if( pOp->p2==OE_Abort ){ tdsqlite3VdbeAssertAbortable(p); } #endif if( (pIn3->flags & MEM_Null)==0 ) break; /* Fall through into OP_Halt */ @@ -90333,8 +90333,8 @@ case OP_HaltIfNull: { /* in3 */ ** Exit immediately. All open cursors, etc are closed ** automatically. ** -** P1 is the result code returned by sqlite3_exec(), sqlite3_reset(), -** or sqlite3_finalize(). For a normal halt, this should be SQLITE_OK (0). +** P1 is the result code returned by tdsqlite3_exec(), tdsqlite3_reset(), +** or tdsqlite3_finalize(). For a normal halt, this should be SQLITE_OK (0). ** For errors, it can be some other value. If P1!=0 then P2 will determine ** whether or not to rollback the current transaction. Do not rollback ** if P2==OE_Fail. Do the rollback if P2==OE_Rollback. If P2==OE_Abort, @@ -90364,15 +90364,15 @@ case OP_Halt: { pcx = (int)(pOp - aOp); #ifdef SQLITE_DEBUG - if( pOp->p2==OE_Abort ){ sqlite3VdbeAssertAbortable(p); } + if( pOp->p2==OE_Abort ){ tdsqlite3VdbeAssertAbortable(p); } #endif if( pOp->p1==SQLITE_OK && p->pFrame ){ /* Halt the sub-program. Return control to the parent frame. */ pFrame = p->pFrame; p->pFrame = pFrame->pParent; p->nFrame--; - sqlite3VdbeSetChanges(db, p->nChange); - pcx = sqlite3VdbeFrameRestore(pFrame); + tdsqlite3VdbeSetChanges(db, p->nChange); + pcx = tdsqlite3VdbeFrameRestore(pFrame); if( pOp->p2==OE_Ignore ){ /* Instruction pcx is the OP_Program that invoked the sub-program ** currently being halted. If the p2 instruction of this OP_Halt @@ -90398,16 +90398,16 @@ case OP_Halt: { testcase( pOp->p5==2 ); testcase( pOp->p5==3 ); testcase( pOp->p5==4 ); - sqlite3VdbeError(p, "%s constraint failed", azType[pOp->p5-1]); + tdsqlite3VdbeError(p, "%s constraint failed", azType[pOp->p5-1]); if( pOp->p4.z ){ - p->zErrMsg = sqlite3MPrintf(db, "%z: %s", p->zErrMsg, pOp->p4.z); + p->zErrMsg = tdsqlite3MPrintf(db, "%z: %s", p->zErrMsg, pOp->p4.z); } }else{ - sqlite3VdbeError(p, "%s", pOp->p4.z); + tdsqlite3VdbeError(p, "%s", pOp->p4.z); } - sqlite3_log(pOp->p1, "abort at %d in [%s]: %s", pcx, p->zSql, p->zErrMsg); + tdsqlite3_log(pOp->p1, "abort at %d in [%s]: %s", pcx, p->zSql, p->zErrMsg); } - rc = sqlite3VdbeHalt(p); + rc = tdsqlite3VdbeHalt(p); assert( rc==SQLITE_BUSY || rc==SQLITE_OK || rc==SQLITE_ERROR ); if( rc==SQLITE_BUSY ){ p->rc = SQLITE_BUSY; @@ -90453,7 +90453,7 @@ case OP_Int64: { /* out2 */ case OP_Real: { /* same as TK_FLOAT, out2 */ pOut = out2Prerelease(p, pOp); pOut->flags = MEM_Real; - assert( !sqlite3IsNaN(*pOp->p4.pReal) ); + assert( !tdsqlite3IsNaN(*pOp->p4.pReal) ); pOut->u.r = *pOp->p4.pReal; break; } @@ -90470,20 +90470,20 @@ case OP_Real: { /* same as TK_FLOAT, out2 */ case OP_String8: { /* same as TK_STRING, out2 */ assert( pOp->p4.z!=0 ); pOut = out2Prerelease(p, pOp); - pOp->p1 = sqlite3Strlen30(pOp->p4.z); + pOp->p1 = tdsqlite3Strlen30(pOp->p4.z); #ifndef SQLITE_OMIT_UTF16 if( encoding!=SQLITE_UTF8 ){ - rc = sqlite3VdbeMemSetStr(pOut, pOp->p4.z, -1, SQLITE_UTF8, SQLITE_STATIC); + rc = tdsqlite3VdbeMemSetStr(pOut, pOp->p4.z, -1, SQLITE_UTF8, SQLITE_STATIC); assert( rc==SQLITE_OK || rc==SQLITE_TOOBIG ); if( rc ) goto too_big; - if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem; + if( SQLITE_OK!=tdsqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem; assert( pOut->szMalloc>0 && pOut->zMalloc==pOut->z ); assert( VdbeMemDynamic(pOut)==0 ); pOut->szMalloc = 0; pOut->flags |= MEM_Static; if( pOp->p4type==P4_DYNAMIC ){ - sqlite3DbFree(db, pOp->p4.z); + tdsqlite3DbFree(db, pOp->p4.z); } pOp->p4type = P4_DYNAMIC; pOp->p4.z = pOut->z; @@ -90555,7 +90555,7 @@ case OP_Null: { /* out2 */ while( cnt>0 ){ pOut++; memAboutToChange(p, pOut); - sqlite3VdbeMemSetNull(pOut); + tdsqlite3VdbeMemSetNull(pOut); pOut->flags = nullFlag; pOut->n = 0; cnt--; @@ -90587,7 +90587,7 @@ case OP_SoftNull: { case OP_Blob: { /* out2 */ assert( pOp->p1 <= SQLITE_MAX_LENGTH ); pOut = out2Prerelease(p, pOp); - sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0); + tdsqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0); pOut->enc = encoding; UPDATE_MAX_BLOBSIZE(pOut); break; @@ -90599,19 +90599,19 @@ case OP_Blob: { /* out2 */ ** Transfer the values of bound parameter P1 into register P2 ** ** If the parameter is named, then its name appears in P4. -** The P4 value is used by sqlite3_bind_parameter_name(). +** The P4 value is used by tdsqlite3_bind_parameter_name(). */ case OP_Variable: { /* out2 */ Mem *pVar; /* Value being transferred */ assert( pOp->p1>0 && pOp->p1<=p->nVar ); - assert( pOp->p4.z==0 || pOp->p4.z==sqlite3VListNumToName(p->pVList,pOp->p1) ); + assert( pOp->p4.z==0 || pOp->p4.z==tdsqlite3VListNumToName(p->pVList,pOp->p1) ); pVar = &p->aVar[pOp->p1 - 1]; - if( sqlite3VdbeMemTooBig(pVar) ){ + if( tdsqlite3VdbeMemTooBig(pVar) ){ goto too_big; } pOut = &aMem[pOp->p2]; - if( VdbeMemDynamic(pOut) ) sqlite3VdbeMemSetNull(pOut); + if( VdbeMemDynamic(pOut) ) tdsqlite3VdbeMemSetNull(pOut); memcpy(pOut, pVar, MEMCELLSIZE); pOut->flags &= ~(MEM_Dyn|MEM_Ephem); pOut->flags |= MEM_Static|MEM_FromBind; @@ -90646,7 +90646,7 @@ case OP_Move: { assert( pIn1<=&aMem[(p->nMem+1 - p->nCursor)] ); assert( memIsValid(pIn1) ); memAboutToChange(p, pOut); - sqlite3VdbeMemMove(pOut, pIn1); + tdsqlite3VdbeMemMove(pOut, pIn1); #ifdef SQLITE_DEBUG pIn1->pScopyFrom = 0; { int i; @@ -90682,7 +90682,7 @@ case OP_Copy: { assert( pOut!=pIn1 ); while( 1 ){ memAboutToChange(p, pOut); - sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem); + tdsqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem); Deephemeralize(pOut); #ifdef SQLITE_DEBUG pOut->pScopyFrom = 0; @@ -90712,7 +90712,7 @@ case OP_SCopy: { /* out2 */ pIn1 = &aMem[pOp->p1]; pOut = &aMem[pOp->p2]; assert( pOut!=pIn1 ); - sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem); + tdsqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem); #ifdef SQLITE_DEBUG pOut->pScopyFrom = pIn1; pOut->mScopyFlags = pIn1->flags; @@ -90732,7 +90732,7 @@ case OP_IntCopy: { /* out2 */ pIn1 = &aMem[pOp->p1]; assert( (pIn1->flags & MEM_Int)!=0 ); pOut = &aMem[pOp->p2]; - sqlite3VdbeMemSetInt64(pOut, pIn1->u.i); + tdsqlite3VdbeMemSetInt64(pOut, pIn1->u.i); break; } @@ -90740,8 +90740,8 @@ case OP_IntCopy: { /* out2 */ ** Synopsis: output=r[P1@P2] ** ** The registers P1 through P1+P2-1 contain a single row of -** results. This opcode causes the sqlite3_step() call to terminate -** with an SQLITE_ROW return code and it sets up the sqlite3_stmt +** results. This opcode causes the tdsqlite3_step() call to terminate +** with an SQLITE_ROW return code and it sets up the tdsqlite3_stmt ** structure to provide access to the r(P1)..r(P1+P2-1) values as ** the result row. */ @@ -90755,7 +90755,7 @@ case OP_ResultRow: { /* If this statement has violated immediate foreign key constraints, do ** not return the number of rows modified. And do not RELEASE the statement ** transaction. It needs to be rolled back. */ - if( SQLITE_OK!=(rc = sqlite3VdbeCheckFk(p, 0)) ){ + if( SQLITE_OK!=(rc = tdsqlite3VdbeCheckFk(p, 0)) ){ assert( db->flags&SQLITE_CountRows ); assert( p->usesStmtJournal ); goto abort_due_to_error; @@ -90777,7 +90777,7 @@ case OP_ResultRow: { ** the RELEASE call below can never fail. */ assert( p->iStatement==0 || db->flags&SQLITE_CountRows ); - rc = sqlite3VdbeCloseStatement(p, SAVEPOINT_RELEASE); + rc = tdsqlite3VdbeCloseStatement(p, SAVEPOINT_RELEASE); assert( rc==SQLITE_OK ); /* Invalidate all ephemeral cursor row caches */ @@ -90793,11 +90793,11 @@ case OP_ResultRow: { Deephemeralize(&pMem[i]); assert( (pMem[i].flags & MEM_Ephem)==0 || (pMem[i].flags & (MEM_Str|MEM_Blob))==0 ); - sqlite3VdbeMemNulTerminate(&pMem[i]); + tdsqlite3VdbeMemNulTerminate(&pMem[i]); REGISTER_TRACE(pOp->p1+i, &pMem[i]); #ifdef SQLITE_DEBUG /* The registers in the result will not be used again when the - ** prepared statement restarts. This is because sqlite3_column() + ** prepared statement restarts. This is because tdsqlite3_column() ** APIs might have caused type conversions of made other changes to ** the register values. Therefore, we can go ahead and break any ** OP_SCopy dependencies. */ @@ -90846,29 +90846,29 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */ testcase( flags1 & MEM_Null ); testcase( pIn2->flags & MEM_Null ); if( (flags1 | pIn2->flags) & MEM_Null ){ - sqlite3VdbeMemSetNull(pOut); + tdsqlite3VdbeMemSetNull(pOut); break; } if( (flags1 & (MEM_Str|MEM_Blob))==0 ){ - if( sqlite3VdbeMemStringify(pIn1,encoding,0) ) goto no_mem; + if( tdsqlite3VdbeMemStringify(pIn1,encoding,0) ) goto no_mem; flags1 = pIn1->flags & ~MEM_Str; }else if( (flags1 & MEM_Zero)!=0 ){ - if( sqlite3VdbeMemExpandBlob(pIn1) ) goto no_mem; + if( tdsqlite3VdbeMemExpandBlob(pIn1) ) goto no_mem; flags1 = pIn1->flags & ~MEM_Str; } flags2 = pIn2->flags; if( (flags2 & (MEM_Str|MEM_Blob))==0 ){ - if( sqlite3VdbeMemStringify(pIn2,encoding,0) ) goto no_mem; + if( tdsqlite3VdbeMemStringify(pIn2,encoding,0) ) goto no_mem; flags2 = pIn2->flags & ~MEM_Str; }else if( (flags2 & MEM_Zero)!=0 ){ - if( sqlite3VdbeMemExpandBlob(pIn2) ) goto no_mem; + if( tdsqlite3VdbeMemExpandBlob(pIn2) ) goto no_mem; flags2 = pIn2->flags & ~MEM_Str; } nByte = pIn1->n + pIn2->n; if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){ goto too_big; } - if( sqlite3VdbeMemGrow(pOut, (int)nByte+3, pOut==pIn2) ){ + if( tdsqlite3VdbeMemGrow(pOut, (int)nByte+3, pOut==pIn2) ){ goto no_mem; } MemSetTypeFlag(pOut, MEM_Str); @@ -90951,9 +90951,9 @@ case OP_Remainder: { /* same as TK_REM, in1, in2, out3 */ iA = pIn1->u.i; iB = pIn2->u.i; switch( pOp->opcode ){ - case OP_Add: if( sqlite3AddInt64(&iB,iA) ) goto fp_math; break; - case OP_Subtract: if( sqlite3SubInt64(&iB,iA) ) goto fp_math; break; - case OP_Multiply: if( sqlite3MulInt64(&iB,iA) ) goto fp_math; break; + case OP_Add: if( tdsqlite3AddInt64(&iB,iA) ) goto fp_math; break; + case OP_Subtract: if( tdsqlite3SubInt64(&iB,iA) ) goto fp_math; break; + case OP_Multiply: if( tdsqlite3MulInt64(&iB,iA) ) goto fp_math; break; case OP_Divide: { if( iA==0 ) goto arithmetic_result_is_null; if( iA==-1 && iB==SMALLEST_INT64 ) goto fp_math; @@ -90973,8 +90973,8 @@ case OP_Remainder: { /* same as TK_REM, in1, in2, out3 */ goto arithmetic_result_is_null; }else{ fp_math: - rA = sqlite3VdbeRealValue(pIn1); - rB = sqlite3VdbeRealValue(pIn2); + rA = tdsqlite3VdbeRealValue(pIn1); + rB = tdsqlite3VdbeRealValue(pIn2); switch( pOp->opcode ){ case OP_Add: rB += rA; break; case OP_Subtract: rB -= rA; break; @@ -90986,8 +90986,8 @@ fp_math: break; } default: { - iA = sqlite3VdbeIntValue(pIn1); - iB = sqlite3VdbeIntValue(pIn2); + iA = tdsqlite3VdbeIntValue(pIn1); + iB = tdsqlite3VdbeIntValue(pIn2); if( iA==0 ) goto arithmetic_result_is_null; if( iA==-1 ) iA = 1; rB = (double)(iB % iA); @@ -90998,7 +90998,7 @@ fp_math: pOut->u.i = rB; MemSetTypeFlag(pOut, MEM_Int); #else - if( sqlite3IsNaN(rB) ){ + if( tdsqlite3IsNaN(rB) ){ goto arithmetic_result_is_null; } pOut->u.r = rB; @@ -91008,14 +91008,14 @@ fp_math: break; arithmetic_result_is_null: - sqlite3VdbeMemSetNull(pOut); + tdsqlite3VdbeMemSetNull(pOut); break; } /* Opcode: CollSeq P1 * * P4 ** ** P4 is a pointer to a CollSeq object. If the next call to a user function -** or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will +** or aggregate calls tdsqlite3GetFuncCollSeq(), this collation sequence will ** be returned. This is used by the built-in min(), max() and nullif() ** functions. ** @@ -91030,7 +91030,7 @@ arithmetic_result_is_null: case OP_CollSeq: { assert( pOp->p4type==P4_COLLSEQ ); if( pOp->p1 ){ - sqlite3VdbeMemSetInt64(&aMem[pOp->p1], 0); + tdsqlite3VdbeMemSetInt64(&aMem[pOp->p1], 0); } break; } @@ -91078,11 +91078,11 @@ case OP_ShiftRight: { /* same as TK_RSHIFT, in1, in2, out3 */ pIn2 = &aMem[pOp->p2]; pOut = &aMem[pOp->p3]; if( (pIn1->flags | pIn2->flags) & MEM_Null ){ - sqlite3VdbeMemSetNull(pOut); + tdsqlite3VdbeMemSetNull(pOut); break; } - iA = sqlite3VdbeIntValue(pIn2); - iB = sqlite3VdbeIntValue(pIn1); + iA = tdsqlite3VdbeIntValue(pIn2); + iB = tdsqlite3VdbeIntValue(pIn1); op = pOp->opcode; if( op==OP_BitAnd ){ iA &= iB; @@ -91128,7 +91128,7 @@ case OP_ShiftRight: { /* same as TK_RSHIFT, in1, in2, out3 */ case OP_AddImm: { /* in1 */ pIn1 = &aMem[pOp->p1]; memAboutToChange(p, pIn1); - sqlite3VdbeMemIntegerify(pIn1); + tdsqlite3VdbeMemIntegerify(pIn1); pIn1->u.i += pOp->p2; break; } @@ -91174,7 +91174,7 @@ case OP_RealAffinity: { /* in1 */ if( pIn1->flags & (MEM_Int|MEM_IntReal) ){ testcase( pIn1->flags & MEM_Int ); testcase( pIn1->flags & MEM_IntReal ); - sqlite3VdbeMemRealify(pIn1); + tdsqlite3VdbeMemRealify(pIn1); REGISTER_TRACE(pOp->p1, pIn1); } break; @@ -91208,7 +91208,7 @@ case OP_Cast: { /* in1 */ memAboutToChange(p, pIn1); rc = ExpandBlob(pIn1); if( rc ) goto abort_due_to_error; - rc = sqlite3VdbeMemCast(pIn1, pOp->p2, encoding); + rc = tdsqlite3VdbeMemCast(pIn1, pOp->p2, encoding); if( rc ) goto abort_due_to_error; UPDATE_MAX_BLOBSIZE(pIn1); REGISTER_TRACE(pOp->p1, pIn1); @@ -91378,7 +91378,7 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ } } /* Handle the common case of integer comparison here, as an - ** optimization, to avoid a call to sqlite3MemCompare() */ + ** optimization, to avoid a call to tdsqlite3MemCompare() */ if( (pIn1->flags & pIn3->flags & MEM_Int)!=0 ){ if( pIn3->u.i > pIn1->u.i ){ res = +1; goto compare_op; } if( pIn3->u.i < pIn1->u.i ){ res = -1; goto compare_op; } @@ -91390,7 +91390,7 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ testcase( pIn1->flags & MEM_Int ); testcase( pIn1->flags & MEM_Real ); testcase( pIn1->flags & MEM_IntReal ); - sqlite3VdbeMemStringify(pIn1, encoding, 1); + tdsqlite3VdbeMemStringify(pIn1, encoding, 1); testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) ); flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask); if( pIn1==pIn3 ) flags3 = flags1 | MEM_Str; @@ -91399,13 +91399,13 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ testcase( pIn3->flags & MEM_Int ); testcase( pIn3->flags & MEM_Real ); testcase( pIn3->flags & MEM_IntReal ); - sqlite3VdbeMemStringify(pIn3, encoding, 1); + tdsqlite3VdbeMemStringify(pIn3, encoding, 1); testcase( (flags3&MEM_Dyn) != (pIn3->flags&MEM_Dyn) ); flags3 = (pIn3->flags & ~MEM_TypeMask) | (flags3 & MEM_TypeMask); } } assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 ); - res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl); + res = tdsqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl); } compare_op: /* At this point, res is negative, zero, or positive if reg[P1] is @@ -91584,7 +91584,7 @@ case OP_Compare: { assert( inKeyField ); pColl = pKeyInfo->aColl[i]; bRev = (pKeyInfo->aSortFlags[i] & KEYINFO_ORDER_DESC); - iCompare = sqlite3MemCompare(&aMem[p1+idx], &aMem[p2+idx], pColl); + iCompare = tdsqlite3MemCompare(&aMem[p1+idx], &aMem[p2+idx], pColl); if( iCompare ){ if( (pKeyInfo->aSortFlags[i] & KEYINFO_ORDER_BIGNULL) && ((aMem[p1+idx].flags & MEM_Null) || (aMem[p2+idx].flags & MEM_Null)) @@ -91640,8 +91640,8 @@ case OP_Or: { /* same as TK_OR, in1, in2, out3 */ int v1; /* Left operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ int v2; /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ - v1 = sqlite3VdbeBooleanValue(&aMem[pOp->p1], 2); - v2 = sqlite3VdbeBooleanValue(&aMem[pOp->p2], 2); + v1 = tdsqlite3VdbeBooleanValue(&aMem[pOp->p1], 2); + v2 = tdsqlite3VdbeBooleanValue(&aMem[pOp->p2], 2); if( pOp->opcode==OP_And ){ static const unsigned char and_logic[] = { 0, 0, 0, 0, 1, 2, 0, 2, 2 }; v1 = and_logic[v1*3+v2]; @@ -91683,8 +91683,8 @@ case OP_IsTrue: { /* in1, out2 */ assert( pOp->p4type==P4_INT32 ); assert( pOp->p4.i==0 || pOp->p4.i==1 ); assert( pOp->p3==0 || pOp->p3==1 ); - sqlite3VdbeMemSetInt64(&aMem[pOp->p2], - sqlite3VdbeBooleanValue(&aMem[pOp->p1], pOp->p3) ^ pOp->p4.i); + tdsqlite3VdbeMemSetInt64(&aMem[pOp->p2], + tdsqlite3VdbeBooleanValue(&aMem[pOp->p1], pOp->p3) ^ pOp->p4.i); break; } @@ -91699,9 +91699,9 @@ case OP_Not: { /* same as TK_NOT, in1, out2 */ pIn1 = &aMem[pOp->p1]; pOut = &aMem[pOp->p2]; if( (pIn1->flags & MEM_Null)==0 ){ - sqlite3VdbeMemSetInt64(pOut, !sqlite3VdbeBooleanValue(pIn1,0)); + tdsqlite3VdbeMemSetInt64(pOut, !tdsqlite3VdbeBooleanValue(pIn1,0)); }else{ - sqlite3VdbeMemSetNull(pOut); + tdsqlite3VdbeMemSetNull(pOut); } break; } @@ -91716,10 +91716,10 @@ case OP_Not: { /* same as TK_NOT, in1, out2 */ case OP_BitNot: { /* same as TK_BITNOT, in1, out2 */ pIn1 = &aMem[pOp->p1]; pOut = &aMem[pOp->p2]; - sqlite3VdbeMemSetNull(pOut); + tdsqlite3VdbeMemSetNull(pOut); if( (pIn1->flags & MEM_Null)==0 ){ pOut->flags = MEM_Int; - pOut->u.i = ~sqlite3VdbeIntValue(pIn1); + pOut->u.i = ~tdsqlite3VdbeIntValue(pIn1); } break; } @@ -91770,7 +91770,7 @@ case OP_Once: { /* jump */ */ case OP_If: { /* jump, in1 */ int c; - c = sqlite3VdbeBooleanValue(&aMem[pOp->p1], pOp->p3); + c = tdsqlite3VdbeBooleanValue(&aMem[pOp->p1], pOp->p3); VdbeBranchTaken(c!=0, 2); if( c ) goto jump_to_p2; break; @@ -91784,7 +91784,7 @@ case OP_If: { /* jump, in1 */ */ case OP_IfNot: { /* jump, in1 */ int c; - c = !sqlite3VdbeBooleanValue(&aMem[pOp->p1], !pOp->p3); + c = !tdsqlite3VdbeBooleanValue(&aMem[pOp->p1], !pOp->p3); VdbeBranchTaken(c!=0, 2); if( c ) goto jump_to_p2; break; @@ -91830,7 +91830,7 @@ case OP_IfNullRow: { /* jump */ assert( pOp->p1>=0 && pOp->p1nCursor ); assert( p->apCsr[pOp->p1]!=0 ); if( p->apCsr[pOp->p1]->nullRow ){ - sqlite3VdbeMemSetNull(aMem + pOp->p3); + tdsqlite3VdbeMemSetNull(aMem + pOp->p3); goto jump_to_p2; } break; @@ -91858,9 +91858,9 @@ case OP_Offset: { /* out3 */ pC = p->apCsr[pOp->p1]; pOut = &p->aMem[pOp->p3]; if( NEVER(pC==0) || pC->eCurType!=CURTYPE_BTREE ){ - sqlite3VdbeMemSetNull(pOut); + tdsqlite3VdbeMemSetNull(pOut); }else{ - sqlite3VdbeMemSetInt64(pOut, sqlite3BtreeOffset(pC->uc.pCursor)); + tdsqlite3VdbeMemSetInt64(pOut, tdsqlite3BtreeOffset(pC->uc.pCursor)); } break; } @@ -91910,7 +91910,7 @@ case OP_Column: { /* If the cursor cache is stale (meaning it is not currently point at ** the correct row) then bring it up-to-date by doing the necessary ** B-Tree seek. */ - rc = sqlite3VdbeCursorMoveto(&pC, &p2); + rc = tdsqlite3VdbeCursorMoveto(&pC, &p2); if( rc ) goto abort_due_to_error; assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); @@ -91935,16 +91935,16 @@ case OP_Column: { pC->payloadSize = pC->szRow = pReg->n; pC->aRow = (u8*)pReg->z; }else{ - sqlite3VdbeMemSetNull(pDest); + tdsqlite3VdbeMemSetNull(pDest); goto op_column_out; } }else{ pCrsr = pC->uc.pCursor; assert( pC->eCurType==CURTYPE_BTREE ); assert( pCrsr ); - assert( sqlite3BtreeCursorIsValid(pCrsr) ); - pC->payloadSize = sqlite3BtreePayloadSize(pCrsr); - pC->aRow = sqlite3BtreePayloadFetch(pCrsr, &pC->szRow); + assert( tdsqlite3BtreeCursorIsValid(pCrsr) ); + pC->payloadSize = tdsqlite3BtreePayloadSize(pCrsr); + pC->aRow = tdsqlite3BtreePayloadFetch(pCrsr, &pC->szRow); assert( pC->szRow<=pC->payloadSize ); assert( pC->szRow<=65536 ); /* Maximum page size is 64KiB */ if( pC->payloadSize > (u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ @@ -92008,7 +92008,7 @@ case OP_Column: { /* Make sure zData points to enough of the record to cover the header. */ if( pC->aRow==0 ){ memset(&sMem, 0, sizeof(sMem)); - rc = sqlite3VdbeMemFromBtree(pC->uc.pCursor, 0, aOffset[0], &sMem); + rc = tdsqlite3VdbeMemFromBtree(pC->uc.pCursor, 0, aOffset[0], &sMem); if( rc!=SQLITE_OK ) goto abort_due_to_error; zData = (u8*)sMem.z; }else{ @@ -92025,11 +92025,11 @@ case OP_Column: { do{ if( (pC->aType[i] = t = zHdr[0])<0x80 ){ zHdr++; - offset64 += sqlite3VdbeOneByteSerialTypeLen(t); + offset64 += tdsqlite3VdbeOneByteSerialTypeLen(t); }else{ - zHdr += sqlite3GetVarint32(zHdr, &t); + zHdr += tdsqlite3GetVarint32(zHdr, &t); pC->aType[i] = t; - offset64 += sqlite3VdbeSerialTypeLen(t); + offset64 += tdsqlite3VdbeSerialTypeLen(t); } aOffset[++i] = (u32)(offset64 & 0xffffffff); }while( i<=p2 && zHdraRow==0 ) sqlite3VdbeMemRelease(&sMem); + if( pC->aRow==0 ) tdsqlite3VdbeMemRelease(&sMem); goto op_column_corrupt; } } pC->nHdrParsed = i; pC->iHdrOffset = (u32)(zHdr - zData); - if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem); + if( pC->aRow==0 ) tdsqlite3VdbeMemRelease(&sMem); }else{ t = 0; } @@ -92064,9 +92064,9 @@ case OP_Column: { */ if( pC->nHdrParsed<=p2 ){ if( pOp->p4type==P4_MEM ){ - sqlite3VdbeMemShallowCopy(pDest, pOp->p4.pMem, MEM_Static); + tdsqlite3VdbeMemShallowCopy(pDest, pOp->p4.pMem, MEM_Static); }else{ - sqlite3VdbeMemSetNull(pDest); + tdsqlite3VdbeMemSetNull(pDest); } goto op_column_out; } @@ -92080,9 +92080,9 @@ case OP_Column: { */ assert( p2nHdrParsed ); assert( rc==SQLITE_OK ); - assert( sqlite3VdbeCheckMemInvariants(pDest) ); + assert( tdsqlite3VdbeCheckMemInvariants(pDest) ); if( VdbeMemDynamic(pDest) ){ - sqlite3VdbeMemSetNull(pDest); + tdsqlite3VdbeMemSetNull(pDest); } assert( t==pC->aType[p2] ); if( pC->szRow>=aOffset[p2+1] ){ @@ -92090,18 +92090,18 @@ case OP_Column: { ** page - where the content is not on an overflow page */ zData = pC->aRow + aOffset[p2]; if( t<12 ){ - sqlite3VdbeSerialGet(zData, t, pDest); + tdsqlite3VdbeSerialGet(zData, t, pDest); }else{ /* If the column value is a string, we need a persistent value, not ** a MEM_Ephem value. This branch is a fast short-cut that is equivalent - ** to calling sqlite3VdbeSerialGet() and sqlite3VdbeDeephemeralize(). + ** to calling tdsqlite3VdbeSerialGet() and tdsqlite3VdbeDeephemeralize(). */ static const u16 aFlag[] = { MEM_Blob, MEM_Str|MEM_Term }; pDest->n = len = (t-12)/2; pDest->enc = encoding; if( pDest->szMalloc < len+2 ){ pDest->flags = MEM_Null; - if( sqlite3VdbeMemGrow(pDest, len+2, 0) ) goto no_mem; + if( tdsqlite3VdbeMemGrow(pDest, len+2, 0) ) goto no_mem; }else{ pDest->z = pDest->zMalloc; } @@ -92115,7 +92115,7 @@ case OP_Column: { /* This branch happens only when content is on overflow pages */ if( ((pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0 && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0)) - || (len = sqlite3VdbeSerialTypeLen(t))==0 + || (len = tdsqlite3VdbeSerialTypeLen(t))==0 ){ /* Content is irrelevant for ** 1. the typeof() function, @@ -92124,17 +92124,17 @@ case OP_Column: { ** So we might as well use bogus content rather than reading ** content from disk. ** - ** Although sqlite3VdbeSerialGet() may read at most 8 bytes from the + ** Although tdsqlite3VdbeSerialGet() may read at most 8 bytes from the ** buffer passed to it, debugging function VdbeMemPrettyPrint() may - ** read more. Use the global constant sqlite3CtypeMap[] as the array, + ** read more. Use the global constant tdsqlite3CtypeMap[] as the array, ** as that array is 256 bytes long (plenty for VdbeMemPrettyPrint()) ** and it begins with a bunch of zeros. */ - sqlite3VdbeSerialGet((u8*)sqlite3CtypeMap, t, pDest); + tdsqlite3VdbeSerialGet((u8*)tdsqlite3CtypeMap, t, pDest); }else{ - rc = sqlite3VdbeMemFromBtree(pC->uc.pCursor, aOffset[p2], len, pDest); + rc = tdsqlite3VdbeMemFromBtree(pC->uc.pCursor, aOffset[p2], len, pDest); if( rc!=SQLITE_OK ) goto abort_due_to_error; - sqlite3VdbeSerialGet((const u8*)pDest->z, t, pDest); + tdsqlite3VdbeSerialGet((const u8*)pDest->z, t, pDest); pDest->flags &= ~MEM_Ephem; } } @@ -92245,7 +92245,7 @@ case OP_MakeRecord: { ** and so forth. ** ** Each type field is a varint representing the serial type of the - ** corresponding data element (see sqlite3VdbeSerialType()). The + ** corresponding data element (see tdsqlite3VdbeSerialType()). The ** hdr-size field is also a varint which is the offset from the beginning ** of the record to data0. */ @@ -92329,11 +92329,11 @@ case OP_MakeRecord: { if( pRec->flags & MEM_Null ){ if( pRec->flags & MEM_Zero ){ /* Values with MEM_Null and MEM_Zero are created by xColumn virtual - ** table methods that never invoke sqlite3_result_xxxxx() while + ** table methods that never invoke tdsqlite3_result_xxxxx() while ** computing an unchanging column value in an UPDATE statement. ** Give such values a special internal-use-only serial-type of 10 ** so that they can be passed through to xUpdate and have - ** a true sqlite3_value_nochange(). */ + ** a true tdsqlite3_value_nochange(). */ assert( pOp->p5==OPFLAG_NOCHNG_MAGIC || CORRUPT_DB ); pRec->uTemp = 10; }else{ @@ -92402,14 +92402,14 @@ case OP_MakeRecord: { if( pRec->flags & MEM_Zero ){ serial_type += pRec->u.nZero*2; if( nData ){ - if( sqlite3VdbeMemExpandBlob(pRec) ) goto no_mem; + if( tdsqlite3VdbeMemExpandBlob(pRec) ) goto no_mem; len += pRec->u.nZero; }else{ nZero += pRec->u.nZero; } } nData += len; - nHdr += sqlite3VarintLen(serial_type); + nHdr += tdsqlite3VarintLen(serial_type); pRec->uTemp = serial_type; } if( pRec==pData0 ) break; @@ -92427,16 +92427,16 @@ case OP_MakeRecord: { nHdr += 1; }else{ /* Rare case of a really large header */ - nVarint = sqlite3VarintLen(nHdr); + nVarint = tdsqlite3VarintLen(nHdr); nHdr += nVarint; - if( nVarintp3) is not allowed to ** be one of the input registers (because the following call to - ** sqlite3VdbeMemClearAndResize() could clobber the value before it is used). + ** tdsqlite3VdbeMemClearAndResize() could clobber the value before it is used). */ if( nByte+nZero<=pOut->szMalloc ){ /* The output register is already large enough to hold the record. @@ -92448,7 +92448,7 @@ case OP_MakeRecord: { if( nByte+nZero>db->aLimit[SQLITE_LIMIT_LENGTH] ){ goto too_big; } - if( sqlite3VdbeMemClearAndResize(pOut, (int)nByte) ){ + if( tdsqlite3VdbeMemClearAndResize(pOut, (int)nByte) ){ goto no_mem; } } @@ -92473,7 +92473,7 @@ case OP_MakeRecord: { zHdr += putVarint32(zHdr, serial_type); /* serial type */ /* EVIDENCE-OF: R-64536-51728 The values for each column in the record ** immediately follow the header. */ - zPayload += sqlite3VdbeSerialPut(zPayload, pRec, serial_type); /* content */ + zPayload += tdsqlite3VdbeSerialPut(zPayload, pRec, serial_type); /* content */ }while( (++pRec)<=pLast ); assert( nHdr==(int)(zHdr - (u8*)pOut->z) ); assert( nByte==(int)(zPayload - (u8*)pOut->z) ); @@ -92498,7 +92498,7 @@ case OP_Count: { /* out2 */ pCrsr = p->apCsr[pOp->p1]->uc.pCursor; assert( pCrsr ); nEntry = 0; /* Not needed. Only used to silence a warning. */ - rc = sqlite3BtreeCount(db, pCrsr, &nEntry); + rc = tdsqlite3BtreeCount(db, pCrsr, &nEntry); if( rc ) goto abort_due_to_error; pOut = out2Prerelease(p, pOp); pOut->u.i = nEntry; @@ -92540,10 +92540,10 @@ case OP_Savepoint: { /* A new savepoint cannot be created if there are active write ** statements (i.e. open read/write incremental blob handles). */ - sqlite3VdbeError(p, "cannot open savepoint - SQL statements in progress"); + tdsqlite3VdbeError(p, "cannot open savepoint - SQL statements in progress"); rc = SQLITE_BUSY; }else{ - nName = sqlite3Strlen30(zName); + nName = tdsqlite3Strlen30(zName); #ifndef SQLITE_OMIT_VIRTUALTABLE /* This call is Ok even if this savepoint is actually a transaction @@ -92551,13 +92551,13 @@ case OP_Savepoint: { ** If this is a transaction savepoint being opened, it is guaranteed ** that the db->aVTrans[] array is empty. */ assert( db->autoCommit==0 || db->nVTrans==0 ); - rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, + rc = tdsqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, db->nStatement+db->nSavepoint); if( rc!=SQLITE_OK ) goto abort_due_to_error; #endif /* Create a new savepoint structure. */ - pNew = sqlite3DbMallocRawNN(db, sizeof(Savepoint)+nName+1); + pNew = tdsqlite3DbMallocRawNN(db, sizeof(Savepoint)+nName+1); if( pNew ){ pNew->zName = (char *)&pNew[1]; memcpy(pNew->zName, zName, nName+1); @@ -92586,19 +92586,19 @@ case OP_Savepoint: { ** an error is returned to the user. */ for( pSavepoint = db->pSavepoint; - pSavepoint && sqlite3StrICmp(pSavepoint->zName, zName); + pSavepoint && tdsqlite3StrICmp(pSavepoint->zName, zName); pSavepoint = pSavepoint->pNext ){ iSavepoint++; } if( !pSavepoint ){ - sqlite3VdbeError(p, "no such savepoint: %s", zName); + tdsqlite3VdbeError(p, "no such savepoint: %s", zName); rc = SQLITE_ERROR; }else if( db->nVdbeWrite>0 && p1==SAVEPOINT_RELEASE ){ /* It is not possible to release (commit) a savepoint if there are ** active write statements. */ - sqlite3VdbeError(p, "cannot release savepoint - " + tdsqlite3VdbeError(p, "cannot release savepoint - " "SQL statements in progress"); rc = SQLITE_BUSY; }else{ @@ -92609,11 +92609,11 @@ case OP_Savepoint: { */ int isTransaction = pSavepoint->pNext==0 && db->isTransactionSavepoint; if( isTransaction && p1==SAVEPOINT_RELEASE ){ - if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){ + if( (rc = tdsqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){ goto vdbe_return; } db->autoCommit = 1; - if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){ + if( tdsqlite3VdbeHalt(p)==SQLITE_BUSY ){ p->pc = (int)(pOp - aOp); db->autoCommit = 0; p->rc = rc = SQLITE_BUSY; @@ -92631,7 +92631,7 @@ case OP_Savepoint: { if( p1==SAVEPOINT_ROLLBACK ){ isSchemaChange = (db->mDbFlags & DBFLAG_SchemaChange)!=0; for(ii=0; iinDb; ii++){ - rc = sqlite3BtreeTripAllCursors(db->aDb[ii].pBt, + rc = tdsqlite3BtreeTripAllCursors(db->aDb[ii].pBt, SQLITE_ABORT_ROLLBACK, isSchemaChange==0); if( rc!=SQLITE_OK ) goto abort_due_to_error; @@ -92641,14 +92641,14 @@ case OP_Savepoint: { isSchemaChange = 0; } for(ii=0; iinDb; ii++){ - rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint); + rc = tdsqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint); if( rc!=SQLITE_OK ){ goto abort_due_to_error; } } if( isSchemaChange ){ - sqlite3ExpirePreparedStatements(db, 0); - sqlite3ResetAllSchemasOfConnection(db); + tdsqlite3ExpirePreparedStatements(db, 0); + tdsqlite3ResetAllSchemasOfConnection(db); db->mDbFlags |= DBFLAG_SchemaChange; } } @@ -92659,7 +92659,7 @@ case OP_Savepoint: { while( db->pSavepoint!=pSavepoint ){ pTmp = db->pSavepoint; db->pSavepoint = pTmp->pNext; - sqlite3DbFree(db, pTmp); + tdsqlite3DbFree(db, pTmp); db->nSavepoint--; } @@ -92670,7 +92670,7 @@ case OP_Savepoint: { if( p1==SAVEPOINT_RELEASE ){ assert( pSavepoint==db->pSavepoint ); db->pSavepoint = pSavepoint->pNext; - sqlite3DbFree(db, pSavepoint); + tdsqlite3DbFree(db, pSavepoint); if( !isTransaction ){ db->nSavepoint--; } @@ -92681,7 +92681,7 @@ case OP_Savepoint: { } if( !isTransaction || p1==SAVEPOINT_ROLLBACK ){ - rc = sqlite3VtabSavepoint(db, p1, iSavepoint); + rc = tdsqlite3VtabSavepoint(db, p1, iSavepoint); if( rc!=SQLITE_OK ) goto abort_due_to_error; } } @@ -92714,28 +92714,28 @@ case OP_AutoCommit: { if( desiredAutoCommit!=db->autoCommit ){ if( iRollback ){ assert( desiredAutoCommit==1 ); - sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); + tdsqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); db->autoCommit = 1; }else if( desiredAutoCommit && db->nVdbeWrite>0 ){ /* If this instruction implements a COMMIT and other VMs are writing ** return an error indicating that the other VMs must complete first. */ - sqlite3VdbeError(p, "cannot commit transaction - " + tdsqlite3VdbeError(p, "cannot commit transaction - " "SQL statements in progress"); rc = SQLITE_BUSY; goto abort_due_to_error; - }else if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){ + }else if( (rc = tdsqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){ goto vdbe_return; }else{ db->autoCommit = (u8)desiredAutoCommit; } - if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){ + if( tdsqlite3VdbeHalt(p)==SQLITE_BUSY ){ p->pc = (int)(pOp - aOp); db->autoCommit = (u8)(1-desiredAutoCommit); p->rc = rc = SQLITE_BUSY; goto vdbe_return; } - sqlite3CloseSavepoints(db); + tdsqlite3CloseSavepoints(db); if( p->rc==SQLITE_OK ){ rc = SQLITE_DONE; }else{ @@ -92743,7 +92743,7 @@ case OP_AutoCommit: { } goto vdbe_return; }else{ - sqlite3VdbeError(p, + tdsqlite3VdbeError(p, (!desiredAutoCommit)?"cannot start a transaction within a transaction":( (iRollback)?"cannot rollback - no transaction is active": "cannot commit - no transaction is active")); @@ -92785,7 +92785,7 @@ case OP_AutoCommit: { ** cookie in P3 differs from the schema cookie in the database header or ** if the schema generation counter in P4 differs from the current ** generation counter, then an SQLITE_SCHEMA error is raised and execution -** halts. The sqlite3_step() wrapper function might then reprepare the +** halts. The tdsqlite3_step() wrapper function might then reprepare the ** statement and rerun it from the beginning. */ case OP_Transaction: { @@ -92803,7 +92803,7 @@ case OP_Transaction: { pBt = db->aDb[pOp->p1].pBt; if( pBt ){ - rc = sqlite3BtreeBeginTrans(pBt, pOp->p2, &iMeta); + rc = tdsqlite3BtreeBeginTrans(pBt, pOp->p2, &iMeta); testcase( rc==SQLITE_BUSY_SNAPSHOT ); testcase( rc==SQLITE_BUSY_RECOVERY ); if( rc!=SQLITE_OK ){ @@ -92819,16 +92819,16 @@ case OP_Transaction: { && pOp->p2 && (db->autoCommit==0 || db->nVdbeRead>1) ){ - assert( sqlite3BtreeIsInTrans(pBt) ); + assert( tdsqlite3BtreeIsInTrans(pBt) ); if( p->iStatement==0 ){ assert( db->nStatement>=0 && db->nSavepoint>=0 ); db->nStatement++; p->iStatement = db->nSavepoint + db->nStatement; } - rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, p->iStatement-1); + rc = tdsqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, p->iStatement-1); if( rc==SQLITE_OK ){ - rc = sqlite3BtreeBeginStmt(pBt, p->iStatement); + rc = tdsqlite3BtreeBeginStmt(pBt, p->iStatement); } /* Store the current value of the database handles deferred constraint @@ -92848,8 +92848,8 @@ case OP_Transaction: { ** version is checked to ensure that the schema has not changed since the ** SQL statement was prepared. */ - sqlite3DbFree(db, p->zErrMsg); - p->zErrMsg = sqlite3DbStrDup(db, "database schema has changed"); + tdsqlite3DbFree(db, p->zErrMsg); + p->zErrMsg = tdsqlite3DbStrDup(db, "database schema has changed"); /* If the schema-cookie from the database file matches the cookie ** stored with the in-memory representation of the schema, do ** not reload the schema from the database file. @@ -92859,12 +92859,12 @@ case OP_Transaction: { ** are queried from within xNext() and other v-table methods using ** prepared queries. If such a query is out-of-date, we do not want to ** discard the database schema, as the user code implementing the - ** v-table would have to be ready for the sqlite3_vtab structure itself - ** to be invalidated whenever sqlite3_step() is called from within + ** v-table would have to be ready for the tdsqlite3_vtab structure itself + ** to be invalidated whenever tdsqlite3_step() is called from within ** a v-table method. */ if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){ - sqlite3ResetOneSchema(db, pOp->p1); + tdsqlite3ResetOneSchema(db, pOp->p1); } p->expired = 1; rc = SQLITE_SCHEMA; @@ -92898,7 +92898,7 @@ case OP_ReadCookie: { /* out2 */ assert( db->aDb[iDb].pBt!=0 ); assert( DbMaskTest(p->btreeMask, iDb) ); - sqlite3BtreeGetMeta(db->aDb[iDb].pBt, iCookie, (u32 *)&iMeta); + tdsqlite3BtreeGetMeta(db->aDb[iDb].pBt, iCookie, (u32 *)&iMeta); pOut = out2Prerelease(p, pOp); pOut->u.i = iMeta; break; @@ -92917,16 +92917,16 @@ case OP_ReadCookie: { /* out2 */ case OP_SetCookie: { Db *pDb; - sqlite3VdbeIncrWriteCounter(p, 0); + tdsqlite3VdbeIncrWriteCounter(p, 0); assert( pOp->p2p1>=0 && pOp->p1nDb ); assert( DbMaskTest(p->btreeMask, pOp->p1) ); assert( p->readOnly==0 ); pDb = &db->aDb[pOp->p1]; assert( pDb->pBt!=0 ); - assert( sqlite3SchemaMutexHeld(db, pOp->p1, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, pOp->p1, 0) ); /* See note about index shifting on OP_ReadCookie */ - rc = sqlite3BtreeUpdateMeta(pDb->pBt, pOp->p2, pOp->p3); + rc = tdsqlite3BtreeUpdateMeta(pDb->pBt, pOp->p2, pOp->p3); if( pOp->p2==BTREE_SCHEMA_VERSION ){ /* When the schema cookie changes, record the new cookie internally */ pDb->pSchema->schema_cookie = pOp->p3; @@ -92938,7 +92938,7 @@ case OP_SetCookie: { if( pOp->p1==1 ){ /* Invalidate all prepared statements whenever the TEMP database ** schema is changed. Ticket #1644 */ - sqlite3ExpirePreparedStatements(db, 0); + tdsqlite3ExpirePreparedStatements(db, 0); p->expired = 0; } if( rc ) goto abort_due_to_error; @@ -93073,7 +93073,7 @@ case OP_OpenWrite: if( pOp->opcode==OP_OpenWrite ){ assert( OPFLAG_FORDELETE==BTREE_FORDELETE ); wrFlag = BTREE_WRCSR | (pOp->p5 & OPFLAG_FORDELETE); - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); if( pDb->pSchema->file_format < p->minWriteFileFormat ){ p->minWriteFileFormat = pDb->pSchema->file_format; } @@ -93087,7 +93087,7 @@ case OP_OpenWrite: pIn2 = &aMem[p2]; assert( memIsValid(pIn2) ); assert( (pIn2->flags & MEM_Int)!=0 ); - sqlite3VdbeMemIntegerify(pIn2); + tdsqlite3VdbeMemIntegerify(pIn2); p2 = (int)pIn2->u.i; /* The p2 value always comes from a prior OP_CreateBtree opcode and ** that opcode will always set the p2 value to 2 or more or else fail. @@ -93114,7 +93114,7 @@ case OP_OpenWrite: #ifdef SQLITE_DEBUG pCur->wrFlag = wrFlag; #endif - rc = sqlite3BtreeCursor(pX, p2, wrFlag, pKeyInfo, pCur->uc.pCursor); + rc = tdsqlite3BtreeCursor(pX, p2, wrFlag, pKeyInfo, pCur->uc.pCursor); pCur->pKeyInfo = pKeyInfo; /* Set the VdbeCursor.isTable variable. Previous versions of ** SQLite used to check if the root-page flags were sane at this point @@ -93129,7 +93129,7 @@ open_cursor_set_hints: #ifdef SQLITE_ENABLE_CURSOR_HINTS testcase( pOp->p2 & OPFLAG_SEEKEQ ); #endif - sqlite3BtreeCursorHintFlags(pCur->uc.pCursor, + tdsqlite3BtreeCursorHintFlags(pCur->uc.pCursor, (pOp->p5 & (OPFLAG_BULKCSR|OPFLAG_SEEKEQ))); if( rc ) goto abort_due_to_error; break; @@ -93159,11 +93159,11 @@ case OP_OpenDup: { pCx->isTable = pOrig->isTable; pCx->pgnoRoot = pOrig->pgnoRoot; pCx->isOrdered = pOrig->isOrdered; - rc = sqlite3BtreeCursor(pOrig->pBtx, pCx->pgnoRoot, BTREE_WRCSR, + rc = tdsqlite3BtreeCursor(pOrig->pBtx, pCx->pgnoRoot, BTREE_WRCSR, pCx->pKeyInfo, pCx->uc.pCursor); - /* The sqlite3BtreeCursor() routine can only fail for the first cursor + /* The tdsqlite3BtreeCursor() routine can only fail for the first cursor ** opened for a database. Since there is already an open cursor when this - ** opcode is run, the sqlite3BtreeCursor() cannot fail */ + ** opcode is run, the tdsqlite3BtreeCursor() cannot fail */ assert( rc==SQLITE_OK ); break; } @@ -93218,38 +93218,38 @@ case OP_OpenEphemeral: { assert( pCx->isEphemeral ); pCx->seqCount = 0; pCx->cacheStatus = CACHE_STALE; - rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0); + rc = tdsqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0); }else{ pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE); if( pCx==0 ) goto no_mem; pCx->isEphemeral = 1; - rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBtx, + rc = tdsqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBtx, BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5, vfsFlags); if( rc==SQLITE_OK ){ - rc = sqlite3BtreeBeginTrans(pCx->pBtx, 1, 0); + rc = tdsqlite3BtreeBeginTrans(pCx->pBtx, 1, 0); } if( rc==SQLITE_OK ){ /* If a transient index is required, create it by calling - ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before + ** tdsqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before ** opening it. If a transient table is required, just use the ** automatically created table with root-page 1 (an BLOB_INTKEY table). */ if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){ assert( pOp->p4type==P4_KEYINFO ); - rc = sqlite3BtreeCreateTable(pCx->pBtx, (int*)&pCx->pgnoRoot, + rc = tdsqlite3BtreeCreateTable(pCx->pBtx, (int*)&pCx->pgnoRoot, BTREE_BLOBKEY | pOp->p5); if( rc==SQLITE_OK ){ assert( pCx->pgnoRoot==MASTER_ROOT+1 ); assert( pKeyInfo->db==db ); assert( pKeyInfo->enc==ENC(db) ); - rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR, + rc = tdsqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR, pKeyInfo, pCx->uc.pCursor); } pCx->isTable = 0; }else{ pCx->pgnoRoot = MASTER_ROOT; - rc = sqlite3BtreeCursor(pCx->pBtx, MASTER_ROOT, BTREE_WRCSR, + rc = tdsqlite3BtreeCursor(pCx->pBtx, MASTER_ROOT, BTREE_WRCSR, 0, pCx->uc.pCursor); pCx->isTable = 1; } @@ -93281,7 +93281,7 @@ case OP_SorterOpen: { pCx->pKeyInfo = pOp->p4.pKeyInfo; assert( pCx->pKeyInfo->db==db ); assert( pCx->pKeyInfo->enc==ENC(db) ); - rc = sqlite3VdbeSorterInit(db, pOp->p3, pCx); + rc = tdsqlite3VdbeSorterInit(db, pOp->p3, pCx); if( rc ) goto abort_due_to_error; break; } @@ -93331,10 +93331,10 @@ case OP_OpenPseudo: { pCx->seekResult = pOp->p2; pCx->isTable = 1; /* Give this pseudo-cursor a fake BtCursor pointer so that pCx - ** can be safely passed to sqlite3VdbeCursorMoveto(). This avoids a test - ** for pCx->eCurType==CURTYPE_BTREE inside of sqlite3VdbeCursorMoveto() + ** can be safely passed to tdsqlite3VdbeCursorMoveto(). This avoids a test + ** for pCx->eCurType==CURTYPE_BTREE inside of tdsqlite3VdbeCursorMoveto() ** which is a performance optimization */ - pCx->uc.pCursor = sqlite3BtreeFakeValidCursor(); + pCx->uc.pCursor = tdsqlite3BtreeFakeValidCursor(); assert( pOp->p5==0 ); break; } @@ -93346,7 +93346,7 @@ case OP_OpenPseudo: { */ case OP_Close: { assert( pOp->p1>=0 && pOp->p1nCursor ); - sqlite3VdbeFreeCursor(p, p->apCsr[pOp->p1]); + tdsqlite3VdbeFreeCursor(p, p->apCsr[pOp->p1]); p->apCsr[pOp->p1] = 0; break; } @@ -93491,7 +93491,7 @@ case OP_SeekGT: { /* jump, in3, group */ if( pC->isTable ){ u16 flags3, newType; /* The BTREE_SEEK_EQ flag is only set on index cursors */ - assert( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ)==0 + assert( tdsqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ)==0 || CORRUPT_DB ); /* The input value in P3 might be of any type: integer, real, string, @@ -93502,7 +93502,7 @@ case OP_SeekGT: { /* jump, in3, group */ if( (flags3 & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Str))==MEM_Str ){ applyNumericAffinity(pIn3, 0); } - iKey = sqlite3VdbeIntValue(pIn3); /* Get the integer key value */ + iKey = tdsqlite3VdbeIntValue(pIn3); /* Get the integer key value */ newType = pIn3->flags; /* Record the type after applying numeric affinity */ pIn3->flags = flags3; /* But convert the type back to its original */ @@ -93514,7 +93514,7 @@ case OP_SeekGT: { /* jump, in3, group */ VdbeBranchTaken(1,2); goto jump_to_p2; }else{ - rc = sqlite3BtreeLast(pC->uc.pCursor, &res); + rc = tdsqlite3BtreeLast(pC->uc.pCursor, &res); if( rc!=SQLITE_OK ) goto abort_due_to_error; goto seek_not_found; } @@ -93543,7 +93543,7 @@ case OP_SeekGT: { /* jump, in3, group */ if( (oc & 0x0001)==(OP_SeekLT & 0x0001) ) oc++; } } - rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)iKey, 0, &res); + rc = tdsqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)iKey, 0, &res); pC->movetoTarget = iKey; /* Used by OP_Delete */ if( rc!=SQLITE_OK ){ goto abort_due_to_error; @@ -93553,7 +93553,7 @@ case OP_SeekGT: { /* jump, in3, group */ ** OP_SeekLE opcodes are allowed, and these must be immediately followed ** by an OP_IdxGT or OP_IdxLT opcode, respectively, with the same key. */ - if( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ) ){ + if( tdsqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ) ){ eqOnly = 1; assert( pOp->opcode==OP_SeekGE || pOp->opcode==OP_SeekLE ); assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT ); @@ -93587,7 +93587,7 @@ case OP_SeekGT: { /* jump, in3, group */ { int i; for(i=0; iuc.pCursor, &r, 0, 0, &res); + rc = tdsqlite3BtreeMovetoUnpacked(pC->uc.pCursor, &r, 0, 0, &res); if( rc!=SQLITE_OK ){ goto abort_due_to_error; } @@ -93597,12 +93597,12 @@ case OP_SeekGT: { /* jump, in3, group */ } } #ifdef SQLITE_TEST - sqlite3_search_count++; + tdsqlite3_search_count++; #endif if( oc>=OP_SeekGE ){ assert( oc==OP_SeekGE || oc==OP_SeekGT ); if( res<0 || (res==0 && oc==OP_SeekGT) ){ res = 0; - rc = sqlite3BtreeNext(pC->uc.pCursor, 0); + rc = tdsqlite3BtreeNext(pC->uc.pCursor, 0); if( rc!=SQLITE_OK ){ if( rc==SQLITE_DONE ){ rc = SQLITE_OK; @@ -93618,7 +93618,7 @@ case OP_SeekGT: { /* jump, in3, group */ assert( oc==OP_SeekLT || oc==OP_SeekLE ); if( res>0 || (res==0 && oc==OP_SeekLT) ){ res = 0; - rc = sqlite3BtreePrevious(pC->uc.pCursor, 0); + rc = tdsqlite3BtreePrevious(pC->uc.pCursor, 0); if( rc!=SQLITE_OK ){ if( rc==SQLITE_DONE ){ rc = SQLITE_OK; @@ -93631,7 +93631,7 @@ case OP_SeekGT: { /* jump, in3, group */ /* res might be negative because the table is empty. Check to ** see if this is the case. */ - res = sqlite3BtreeEof(pC->uc.pCursor); + res = tdsqlite3BtreeEof(pC->uc.pCursor); } } seek_not_found: @@ -93786,7 +93786,7 @@ case OP_Found: { /* jump, in3 */ UnpackedRecord r; #ifdef SQLITE_TEST - if( pOp->opcode!=OP_NoConflict ) sqlite3_found_count++; + if( pOp->opcode!=OP_NoConflict ) tdsqlite3_found_count++; #endif assert( pOp->p1>=0 && pOp->p1nCursor ); @@ -93818,9 +93818,9 @@ case OP_Found: { /* jump, in3 */ rc = ExpandBlob(pIn3); assert( rc==SQLITE_OK || rc==SQLITE_NOMEM ); if( rc ) goto no_mem; - pFree = pIdxKey = sqlite3VdbeAllocUnpackedRecord(pC->pKeyInfo); + pFree = pIdxKey = tdsqlite3VdbeAllocUnpackedRecord(pC->pKeyInfo); if( pIdxKey==0 ) goto no_mem; - sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z, pIdxKey); + tdsqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z, pIdxKey); } pIdxKey->default_rc = 0; takeJump = 0; @@ -93835,8 +93835,8 @@ case OP_Found: { /* jump, in3 */ } } } - rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, pIdxKey, 0, 0, &res); - if( pFree ) sqlite3DbFreeNN(db, pFree); + rc = tdsqlite3BtreeMovetoUnpacked(pC->uc.pCursor, pIdxKey, 0, 0, &res); + if( pFree ) tdsqlite3DbFreeNN(db, pFree); if( rc!=SQLITE_OK ){ goto abort_due_to_error; } @@ -93942,7 +93942,7 @@ notExistsWithKey: pCrsr = pC->uc.pCursor; assert( pCrsr!=0 ); res = 0; - rc = sqlite3BtreeMovetoUnpacked(pCrsr, 0, iKey, 0, &res); + rc = tdsqlite3BtreeMovetoUnpacked(pCrsr, 0, iKey, 0, &res); assert( rc==SQLITE_OK || res==0 ); pC->movetoTarget = iKey; /* Used by OP_Delete */ pC->nullRow = 0; @@ -93998,7 +93998,7 @@ case OP_Sequence: { /* out2 */ case OP_NewRowid: { /* out2 */ i64 v; /* The new rowid */ VdbeCursor *pC; /* Cursor of table to get the new rowid */ - int res; /* Result of an sqlite3BtreeLast() */ + int res; /* Result of an tdsqlite3BtreeLast() */ int cnt; /* Counter to limit the number of searches */ Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */ VdbeFrame *pFrame; /* Root frame of VDBE */ @@ -94039,15 +94039,15 @@ case OP_NewRowid: { /* out2 */ #endif if( !pC->useRandomRowid ){ - rc = sqlite3BtreeLast(pC->uc.pCursor, &res); + rc = tdsqlite3BtreeLast(pC->uc.pCursor, &res); if( rc!=SQLITE_OK ){ goto abort_due_to_error; } if( res ){ v = 1; /* IMP: R-61914-48074 */ }else{ - assert( sqlite3BtreeCursorIsValid(pC->uc.pCursor) ); - v = sqlite3BtreeIntegerKey(pC->uc.pCursor); + assert( tdsqlite3BtreeCursorIsValid(pC->uc.pCursor) ); + v = tdsqlite3BtreeIntegerKey(pC->uc.pCursor); if( v>=MAX_ROWID ){ pC->useRandomRowid = 1; }else{ @@ -94074,7 +94074,7 @@ case OP_NewRowid: { /* out2 */ assert( memIsValid(pMem) ); REGISTER_TRACE(pOp->p3, pMem); - sqlite3VdbeMemIntegerify(pMem); + tdsqlite3VdbeMemIntegerify(pMem); assert( (pMem->flags & MEM_Int)!=0 ); /* mem(P3) holds an integer */ if( pMem->u.i==MAX_ROWID || pC->useRandomRowid ){ rc = SQLITE_FULL; /* IMP: R-17817-00630 */ @@ -94095,9 +94095,9 @@ case OP_NewRowid: { /* out2 */ ** an AUTOINCREMENT table. */ cnt = 0; do{ - sqlite3_randomness(sizeof(v), &v); + tdsqlite3_randomness(sizeof(v), &v); v &= (MAX_ROWID>>1); v++; /* Ensure that v is greater than zero */ - }while( ((rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)v, + }while( ((rc = tdsqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)v, 0, &res))==SQLITE_OK) && (res==0) && (++cnt<100)); @@ -94127,7 +94127,7 @@ case OP_NewRowid: { /* out2 */ ** If the OPFLAG_NCHANGE flag of P5 is set, then the row change count is ** incremented (otherwise not). If the OPFLAG_LASTROWID flag of P5 is set, ** then rowid is stored for subsequent return by the -** sqlite3_last_insert_rowid() function (otherwise it is unmodified). +** tdsqlite3_last_insert_rowid() function (otherwise it is unmodified). ** ** If the OPFLAG_USESEEKRESULT flag of P5 is set, the implementation might ** run faster by avoiding an unnecessary seek on cursor P1. However, @@ -94172,7 +94172,7 @@ case OP_Insert: { assert( (pOp->p5 & OPFLAG_ISNOOP) || pC->isTable ); assert( pOp->p4type==P4_TABLE || pOp->p4type>=P4_STATIC ); REGISTER_TRACE(pOp->p2, pData); - sqlite3VdbeIncrWriteCounter(p, pC); + tdsqlite3VdbeIncrWriteCounter(p, pC); pKey = &aMem[pOp->p3]; assert( pKey->flags & MEM_Int ); @@ -94194,7 +94194,7 @@ case OP_Insert: { /* Invoke the pre-update hook, if any */ if( pTab ){ if( db->xPreUpdateCallback && !(pOp->p5 & OPFLAG_ISUPDATE) ){ - sqlite3VdbePreUpdateHook(p, pC, SQLITE_INSERT, zDb, pTab, x.nKey,pOp->p2); + tdsqlite3VdbePreUpdateHook(p, pC, SQLITE_INSERT, zDb, pTab, x.nKey,pOp->p2); } if( db->xUpdateCallback==0 || pTab->aCol==0 ){ /* Prevent post-update hook from running in cases when it should not */ @@ -94216,7 +94216,7 @@ case OP_Insert: { x.nZero = 0; } x.pKey = 0; - rc = sqlite3BtreeInsert(pC->uc.pCursor, &x, + rc = tdsqlite3BtreeInsert(pC->uc.pCursor, &x, (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION)), seekResult ); pC->deferredMoveto = 0; @@ -94282,18 +94282,18 @@ case OP_Delete: { assert( pC->eCurType==CURTYPE_BTREE ); assert( pC->uc.pCursor!=0 ); assert( pC->deferredMoveto==0 ); - sqlite3VdbeIncrWriteCounter(p, pC); + tdsqlite3VdbeIncrWriteCounter(p, pC); #ifdef SQLITE_DEBUG if( pOp->p4type==P4_TABLE && HasRowid(pOp->p4.pTab) && pOp->p5==0 - && sqlite3BtreeCursorIsValidNN(pC->uc.pCursor) + && tdsqlite3BtreeCursorIsValidNN(pC->uc.pCursor) ){ /* If p5 is zero, the seek operation that positioned the cursor prior to ** OP_Delete will have also set the pC->movetoTarget field to the rowid of ** the row that is being deleted */ - i64 iKey = sqlite3BtreeIntegerKey(pC->uc.pCursor); + i64 iKey = tdsqlite3BtreeIntegerKey(pC->uc.pCursor); assert( CORRUPT_DB || pC->movetoTarget==iKey ); } #endif @@ -94309,7 +94309,7 @@ case OP_Delete: { zDb = db->aDb[pC->iDb].zDbSName; pTab = pOp->p4.pTab; if( (pOp->p5 & OPFLAG_SAVEPOSITION)!=0 && pC->isTable ){ - pC->movetoTarget = sqlite3BtreeIntegerKey(pC->uc.pCursor); + pC->movetoTarget = tdsqlite3BtreeIntegerKey(pC->uc.pCursor); } }else{ zDb = 0; /* Not needed. Silence a compiler warning. */ @@ -94323,7 +94323,7 @@ case OP_Delete: { || HasRowid(pTab)==0 || (aMem[pOp->p3].flags & MEM_Int) ); - sqlite3VdbePreUpdateHook(p, pC, + tdsqlite3VdbePreUpdateHook(p, pC, (opflags & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_DELETE, zDb, pTab, pC->movetoTarget, pOp->p3 @@ -94351,7 +94351,7 @@ case OP_Delete: { } #endif - rc = sqlite3BtreeDelete(pC->uc.pCursor, pOp->p5); + rc = tdsqlite3BtreeDelete(pC->uc.pCursor, pOp->p5); pC->cacheStatus = CACHE_STALE; pC->seekResult = 0; if( rc ) goto abort_due_to_error; @@ -94371,12 +94371,12 @@ case OP_Delete: { /* Opcode: ResetCount * * * * * ** ** The value of the change counter is copied to the database handle -** change counter (returned by subsequent calls to sqlite3_changes()). +** change counter (returned by subsequent calls to tdsqlite3_changes()). ** Then the VMs internal change counter resets to 0. ** This is used by trigger programs. */ case OP_ResetCount: { - sqlite3VdbeSetChanges(db, p->nChange); + tdsqlite3VdbeSetChanges(db, p->nChange); p->nChange = 0; break; } @@ -94407,7 +94407,7 @@ case OP_SorterCompare: { pIn3 = &aMem[pOp->p3]; nKeyCol = pOp->p4.i; res = 0; - rc = sqlite3VdbeSorterCompare(pC, pIn3, nKeyCol, &res); + rc = tdsqlite3VdbeSorterCompare(pC, pIn3, nKeyCol, &res); VdbeBranchTaken(res!=0,2); if( rc ) goto abort_due_to_error; if( res ) goto jump_to_p2; @@ -94432,7 +94432,7 @@ case OP_SorterData: { pOut = &aMem[pOp->p2]; pC = p->apCsr[pOp->p1]; assert( isSorter(pC) ); - rc = sqlite3VdbeSorterRowkey(pC, pOut); + rc = tdsqlite3VdbeSorterRowkey(pC, pOut); assert( rc!=SQLITE_OK || (pOut->flags & MEM_Blob) ); assert( pOp->p1>=0 && pOp->p1nCursor ); if( rc ) goto abort_due_to_error; @@ -94490,21 +94490,21 @@ case OP_RowData: { ** If this where not the case, on of the following assert()s ** would fail. Should this ever change (because of changes in the code ** generator) then the fix would be to insert a call to - ** sqlite3VdbeCursorMoveto(). + ** tdsqlite3VdbeCursorMoveto(). */ assert( pC->deferredMoveto==0 ); - assert( sqlite3BtreeCursorIsValid(pCrsr) ); + assert( tdsqlite3BtreeCursorIsValid(pCrsr) ); #if 0 /* Not required due to the previous to assert() statements */ - rc = sqlite3VdbeCursorMoveto(pC); + rc = tdsqlite3VdbeCursorMoveto(pC); if( rc!=SQLITE_OK ) goto abort_due_to_error; #endif - n = sqlite3BtreePayloadSize(pCrsr); + n = tdsqlite3BtreePayloadSize(pCrsr); if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ goto too_big; } testcase( n==0 ); - rc = sqlite3VdbeMemFromBtree(pCrsr, 0, n, pOut); + rc = tdsqlite3VdbeMemFromBtree(pCrsr, 0, n, pOut); if( rc ) goto abort_due_to_error; if( !pOp->p3 ) Deephemeralize(pOut); UPDATE_MAX_BLOBSIZE(pOut); @@ -94525,8 +94525,8 @@ case OP_RowData: { case OP_Rowid: { /* out2 */ VdbeCursor *pC; i64 v; - sqlite3_vtab *pVtab; - const sqlite3_module *pModule; + tdsqlite3_vtab *pVtab; + const tdsqlite3_module *pModule; pOut = out2Prerelease(p, pOp); assert( pOp->p1>=0 && pOp->p1nCursor ); @@ -94545,19 +94545,19 @@ case OP_Rowid: { /* out2 */ pModule = pVtab->pModule; assert( pModule->xRowid ); rc = pModule->xRowid(pC->uc.pVCur, &v); - sqlite3VtabImportErrmsg(p, pVtab); + tdsqlite3VtabImportErrmsg(p, pVtab); if( rc ) goto abort_due_to_error; #endif /* SQLITE_OMIT_VIRTUALTABLE */ }else{ assert( pC->eCurType==CURTYPE_BTREE ); assert( pC->uc.pCursor!=0 ); - rc = sqlite3VdbeCursorRestore(pC); + rc = tdsqlite3VdbeCursorRestore(pC); if( rc ) goto abort_due_to_error; if( pC->nullRow ){ pOut->flags = MEM_Null; break; } - v = sqlite3BtreeIntegerKey(pC->uc.pCursor); + v = tdsqlite3BtreeIntegerKey(pC->uc.pCursor); } pOut->u.i = v; break; @@ -94579,7 +94579,7 @@ case OP_NullRow: { pC->cacheStatus = CACHE_STALE; if( pC->eCurType==CURTYPE_BTREE ){ assert( pC->uc.pCursor!=0 ); - sqlite3BtreeClearCursor(pC->uc.pCursor); + tdsqlite3BtreeClearCursor(pC->uc.pCursor); } #ifdef SQLITE_DEBUG if( pC->seekOp==0 ) pC->seekOp = OP_NullRow; @@ -94628,11 +94628,11 @@ case OP_Last: { /* jump */ if( pOp->opcode==OP_SeekEnd ){ assert( pOp->p2==0 ); pC->seekResult = -1; - if( sqlite3BtreeCursorIsValidNN(pCrsr) ){ + if( tdsqlite3BtreeCursorIsValidNN(pCrsr) ){ break; } } - rc = sqlite3BtreeLast(pCrsr, &res); + rc = tdsqlite3BtreeLast(pCrsr, &res); pC->nullRow = (u8)res; pC->deferredMoveto = 0; pC->cacheStatus = CACHE_STALE; @@ -94660,11 +94660,11 @@ case OP_IfSmaller: { /* jump */ assert( pC!=0 ); pCrsr = pC->uc.pCursor; assert( pCrsr ); - rc = sqlite3BtreeFirst(pCrsr, &res); + rc = tdsqlite3BtreeFirst(pCrsr, &res); if( rc ) goto abort_due_to_error; if( res==0 ){ - sz = sqlite3BtreeRowCountEst(pCrsr); - if( ALWAYS(sz>=0) && sqlite3LogEst((u64)sz)p3 ) res = 1; + sz = tdsqlite3BtreeRowCountEst(pCrsr); + if( ALWAYS(sz>=0) && tdsqlite3LogEst((u64)sz)p3 ) res = 1; } VdbeBranchTaken(res!=0,2); if( res ) goto jump_to_p2; @@ -94696,8 +94696,8 @@ case OP_IfSmaller: { /* jump */ case OP_SorterSort: /* jump */ case OP_Sort: { /* jump */ #ifdef SQLITE_TEST - sqlite3_sort_count++; - sqlite3_search_count--; + tdsqlite3_sort_count++; + tdsqlite3_search_count--; #endif p->aCounter[SQLITE_STMTSTATUS_SORT]++; /* Fall through into OP_Rewind */ @@ -94729,12 +94729,12 @@ case OP_Rewind: { /* jump */ pC->seekOp = OP_Rewind; #endif if( isSorter(pC) ){ - rc = sqlite3VdbeSorterRewind(pC, &res); + rc = tdsqlite3VdbeSorterRewind(pC, &res); }else{ assert( pC->eCurType==CURTYPE_BTREE ); pCrsr = pC->uc.pCursor; assert( pCrsr ); - rc = sqlite3BtreeFirst(pCrsr, &res); + rc = tdsqlite3BtreeFirst(pCrsr, &res); pC->deferredMoveto = 0; pC->cacheStatus = CACHE_STALE; } @@ -94766,7 +94766,7 @@ case OP_Rewind: { /* jump */ ** always either 0 or 1. ** ** P4 is always of type P4_ADVANCE. The function pointer points to -** sqlite3BtreeNext(). +** tdsqlite3BtreeNext(). ** ** If P5 is positive and the jump is taken, then event counter ** number P5-1 in the prepared statement is incremented. @@ -94794,7 +94794,7 @@ case OP_Rewind: { /* jump */ ** always either 0 or 1. ** ** P4 is always of type P4_ADVANCE. The function pointer points to -** sqlite3BtreePrevious(). +** tdsqlite3BtreePrevious(). ** ** If P5 is positive and the jump is taken, then event counter ** number P5-1 in the prepared statement is incremented. @@ -94811,7 +94811,7 @@ case OP_SorterNext: { /* jump */ pC = p->apCsr[pOp->p1]; assert( isSorter(pC) ); - rc = sqlite3VdbeSorterNext(db, pC); + rc = tdsqlite3VdbeSorterNext(db, pC); goto next_tail; case OP_Prev: /* jump */ case OP_Next: /* jump */ @@ -94821,8 +94821,8 @@ case OP_Next: /* jump */ assert( pC!=0 ); assert( pC->deferredMoveto==0 ); assert( pC->eCurType==CURTYPE_BTREE ); - assert( pOp->opcode!=OP_Next || pOp->p4.xAdvance==sqlite3BtreeNext ); - assert( pOp->opcode!=OP_Prev || pOp->p4.xAdvance==sqlite3BtreePrevious ); + assert( pOp->opcode!=OP_Next || pOp->p4.xAdvance==tdsqlite3BtreeNext ); + assert( pOp->opcode!=OP_Prev || pOp->p4.xAdvance==tdsqlite3BtreePrevious ); /* The Next opcode is only used after SeekGT, SeekGE, Rewind, and Found. ** The Prev opcode is only used after SeekLT, SeekLE, and Last. */ @@ -94844,7 +94844,7 @@ next_tail: pC->nullRow = 0; p->aCounter[pOp->p5]++; #ifdef SQLITE_TEST - sqlite3_search_count++; + tdsqlite3_search_count++; #endif goto jump_to_p2_and_check_for_interrupt; } @@ -94896,7 +94896,7 @@ case OP_IdxInsert: { /* in2 */ assert( pOp->p1>=0 && pOp->p1nCursor ); pC = p->apCsr[pOp->p1]; - sqlite3VdbeIncrWriteCounter(p, pC); + tdsqlite3VdbeIncrWriteCounter(p, pC); assert( pC!=0 ); assert( isSorter(pC)==(pOp->opcode==OP_SorterInsert) ); pIn2 = &aMem[pOp->p2]; @@ -94907,13 +94907,13 @@ case OP_IdxInsert: { /* in2 */ rc = ExpandBlob(pIn2); if( rc ) goto abort_due_to_error; if( pOp->opcode==OP_SorterInsert ){ - rc = sqlite3VdbeSorterWrite(pC, pIn2); + rc = tdsqlite3VdbeSorterWrite(pC, pIn2); }else{ x.nKey = pIn2->n; x.pKey = pIn2->z; x.aMem = aMem + pOp->p3; x.nMem = (u16)pOp->p4.i; - rc = sqlite3BtreeInsert(pC->uc.pCursor, &x, + rc = tdsqlite3BtreeInsert(pC->uc.pCursor, &x, (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION)), ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0) ); @@ -94943,7 +94943,7 @@ case OP_IdxDelete: { pC = p->apCsr[pOp->p1]; assert( pC!=0 ); assert( pC->eCurType==CURTYPE_BTREE ); - sqlite3VdbeIncrWriteCounter(p, pC); + tdsqlite3VdbeIncrWriteCounter(p, pC); pCrsr = pC->uc.pCursor; assert( pCrsr!=0 ); assert( pOp->p5==0 ); @@ -94951,10 +94951,10 @@ case OP_IdxDelete: { r.nField = (u16)pOp->p3; r.default_rc = 0; r.aMem = &aMem[pOp->p2]; - rc = sqlite3BtreeMovetoUnpacked(pCrsr, &r, 0, 0, &res); + rc = tdsqlite3BtreeMovetoUnpacked(pCrsr, &r, 0, 0, &res); if( rc ) goto abort_due_to_error; if( res==0 ){ - rc = sqlite3BtreeDelete(pCrsr, BTREE_AUXDELETE); + rc = tdsqlite3BtreeDelete(pCrsr, BTREE_AUXDELETE); if( rc ) goto abort_due_to_error; } assert( pC->deferredMoveto==0 ); @@ -95007,17 +95007,17 @@ case OP_IdxRowid: { /* out2 */ assert( !pC->nullRow || pOp->opcode==OP_IdxRowid ); /* The IdxRowid and Seek opcodes are combined because of the commonality - ** of sqlite3VdbeCursorRestore() and sqlite3VdbeIdxRowid(). */ - rc = sqlite3VdbeCursorRestore(pC); + ** of tdsqlite3VdbeCursorRestore() and tdsqlite3VdbeIdxRowid(). */ + rc = tdsqlite3VdbeCursorRestore(pC); - /* sqlite3VbeCursorRestore() can only fail if the record has been deleted + /* tdsqlite3VbeCursorRestore() can only fail if the record has been deleted ** out from under the cursor. That will never happens for an IdxRowid ** or Seek opcode */ if( NEVER(rc!=SQLITE_OK) ) goto abort_due_to_error; if( !pC->nullRow ){ rowid = 0; /* Not needed. Only used to silence a warning. */ - rc = sqlite3VdbeIdxRowid(db, pC->uc.pCursor, &rowid); + rc = tdsqlite3VdbeIdxRowid(db, pC->uc.pCursor, &rowid); if( rc!=SQLITE_OK ){ goto abort_due_to_error; } @@ -95040,7 +95040,7 @@ case OP_IdxRowid: { /* out2 */ } }else{ assert( pOp->opcode==OP_IdxRowid ); - sqlite3VdbeMemSetNull(&aMem[pOp->p2]); + tdsqlite3VdbeMemSetNull(&aMem[pOp->p2]); } break; } @@ -95057,7 +95057,7 @@ case OP_FinishSeek: { assert( pOp->p1>=0 && pOp->p1nCursor ); pC = p->apCsr[pOp->p1]; if( pC->deferredMoveto ){ - rc = sqlite3VdbeFinishMoveto(pC); + rc = tdsqlite3VdbeFinishMoveto(pC); if( rc ) goto abort_due_to_error; } break; @@ -95144,7 +95144,7 @@ case OP_IdxGE: { /* jump */ } #endif res = 0; /* Not needed. Only used to silence a warning. */ - rc = sqlite3VdbeIdxKeyCompare(db, pC, &r, &res); + rc = tdsqlite3VdbeIdxKeyCompare(db, pC, &r, &res); assert( (OP_IdxLE&1)==(OP_IdxLT&1) && (OP_IdxGE&1)==(OP_IdxGT&1) ); if( (pOp->opcode&1)==(OP_IdxLT&1) ){ assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxLT ); @@ -95190,7 +95190,7 @@ case OP_Destroy: { /* out2 */ int iMoved; int iDb; - sqlite3VdbeIncrWriteCounter(p, 0); + tdsqlite3VdbeIncrWriteCounter(p, 0); assert( p->readOnly==0 ); assert( pOp->p1>1 ); pOut = out2Prerelease(p, pOp); @@ -95203,13 +95203,13 @@ case OP_Destroy: { /* out2 */ iDb = pOp->p3; assert( DbMaskTest(p->btreeMask, iDb) ); iMoved = 0; /* Not needed. Only to silence a warning. */ - rc = sqlite3BtreeDropTable(db->aDb[iDb].pBt, pOp->p1, &iMoved); + rc = tdsqlite3BtreeDropTable(db->aDb[iDb].pBt, pOp->p1, &iMoved); pOut->flags = MEM_Int; pOut->u.i = iMoved; if( rc ) goto abort_due_to_error; #ifndef SQLITE_OMIT_AUTOVACUUM if( iMoved!=0 ){ - sqlite3RootPageMoved(db, iDb, iMoved, pOp->p1); + tdsqlite3RootPageMoved(db, iDb, iMoved, pOp->p1); /* All OP_Destroy operations occur on the same btree */ assert( resetSchemaOnFault==0 || resetSchemaOnFault==iDb+1 ); resetSchemaOnFault = iDb+1; @@ -95240,11 +95240,11 @@ case OP_Destroy: { /* out2 */ case OP_Clear: { int nChange; - sqlite3VdbeIncrWriteCounter(p, 0); + tdsqlite3VdbeIncrWriteCounter(p, 0); nChange = 0; assert( p->readOnly==0 ); assert( DbMaskTest(p->btreeMask, pOp->p2) ); - rc = sqlite3BtreeClearTable( + rc = tdsqlite3BtreeClearTable( db->aDb[pOp->p2].pBt, pOp->p1, (pOp->p3 ? &nChange : 0) ); if( pOp->p3 ){ @@ -95274,11 +95274,11 @@ case OP_ResetSorter: { pC = p->apCsr[pOp->p1]; assert( pC!=0 ); if( isSorter(pC) ){ - sqlite3VdbeSorterReset(db, pC->uc.pSorter); + tdsqlite3VdbeSorterReset(db, pC->uc.pSorter); }else{ assert( pC->eCurType==CURTYPE_BTREE ); assert( pC->isEphemeral ); - rc = sqlite3BtreeClearTableOfCursor(pC->uc.pCursor); + rc = tdsqlite3BtreeClearTableOfCursor(pC->uc.pCursor); if( rc ) goto abort_due_to_error; } break; @@ -95297,7 +95297,7 @@ case OP_CreateBtree: { /* out2 */ int pgno; Db *pDb; - sqlite3VdbeIncrWriteCounter(p, 0); + tdsqlite3VdbeIncrWriteCounter(p, 0); pOut = out2Prerelease(p, pOp); pgno = 0; assert( pOp->p3==BTREE_INTKEY || pOp->p3==BTREE_BLOBKEY ); @@ -95306,7 +95306,7 @@ case OP_CreateBtree: { /* out2 */ assert( p->readOnly==0 ); pDb = &db->aDb[pOp->p1]; assert( pDb->pBt!=0 ); - rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, pOp->p3); + rc = tdsqlite3BtreeCreateTable(pDb->pBt, &pgno, pOp->p3); if( rc ) goto abort_due_to_error; pOut->u.i = pgno; break; @@ -95317,9 +95317,9 @@ case OP_CreateBtree: { /* out2 */ ** Run the SQL statement or statements specified in the P4 string. */ case OP_SqlExec: { - sqlite3VdbeIncrWriteCounter(p, 0); + tdsqlite3VdbeIncrWriteCounter(p, 0); db->nSqlExec++; - rc = sqlite3_exec(db, pOp->p4.z, 0, 0, 0); + rc = tdsqlite3_exec(db, pOp->p4.z, 0, 0, 0); db->nSqlExec--; if( rc ) goto abort_due_to_error; break; @@ -95342,11 +95342,11 @@ case OP_ParseSchema: { /* Any prepared statement that invokes this opcode will hold mutexes ** on every btree. This is a prerequisite for invoking - ** sqlite3InitCallback(). + ** tdsqlite3InitCallback(). */ #ifdef SQLITE_DEBUG for(iDb=0; iDbnDb; iDb++){ - assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) ); + assert( iDb==1 || tdsqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) ); } #endif @@ -95356,9 +95356,9 @@ case OP_ParseSchema: { #ifndef SQLITE_OMIT_ALTERTABLE if( pOp->p4.z==0 ){ - sqlite3SchemaClear(db->aDb[iDb].pSchema); + tdsqlite3SchemaClear(db->aDb[iDb].pSchema); db->mDbFlags &= ~DBFLAG_SchemaKnownOk; - rc = sqlite3InitOne(db, iDb, &p->zErrMsg, INITFLAG_AlterTable); + rc = tdsqlite3InitOne(db, iDb, &p->zErrMsg, INITFLAG_AlterTable); db->mDbFlags |= DBFLAG_SchemaChange; p->expired = 0; }else @@ -95369,7 +95369,7 @@ case OP_ParseSchema: { initData.iDb = iDb; initData.pzErrMsg = &p->zErrMsg; initData.mInitFlags = 0; - zSql = sqlite3MPrintf(db, + zSql = tdsqlite3MPrintf(db, "SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid", db->aDb[iDb].zDbSName, zMaster, pOp->p4.z); if( zSql==0 ){ @@ -95380,7 +95380,7 @@ case OP_ParseSchema: { initData.rc = SQLITE_OK; initData.nInitRow = 0; assert( !db->mallocFailed ); - rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0); + rc = tdsqlite3_exec(db, zSql, tdsqlite3InitCallback, &initData, 0); if( rc==SQLITE_OK ) rc = initData.rc; if( rc==SQLITE_OK && initData.nInitRow==0 ){ /* The OP_ParseSchema opcode with a non-NULL P4 argument should parse @@ -95388,12 +95388,12 @@ case OP_ParseSchema: { ** the sqlite_master table is corrupt. */ rc = SQLITE_CORRUPT_BKPT; } - sqlite3DbFreeNN(db, zSql); + tdsqlite3DbFreeNN(db, zSql); db->init.busy = 0; } } if( rc ){ - sqlite3ResetAllSchemasOfConnection(db); + tdsqlite3ResetAllSchemasOfConnection(db); if( rc==SQLITE_NOMEM ){ goto no_mem; } @@ -95411,7 +95411,7 @@ case OP_ParseSchema: { */ case OP_LoadAnalysis: { assert( pOp->p1>=0 && pOp->p1nDb ); - rc = sqlite3AnalysisLoad(db, pOp->p1); + rc = tdsqlite3AnalysisLoad(db, pOp->p1); if( rc ) goto abort_due_to_error; break; } @@ -95426,8 +95426,8 @@ case OP_LoadAnalysis: { ** schema consistent with what is on disk. */ case OP_DropTable: { - sqlite3VdbeIncrWriteCounter(p, 0); - sqlite3UnlinkAndDeleteTable(db, pOp->p1, pOp->p4.z); + tdsqlite3VdbeIncrWriteCounter(p, 0); + tdsqlite3UnlinkAndDeleteTable(db, pOp->p1, pOp->p4.z); break; } @@ -95440,8 +95440,8 @@ case OP_DropTable: { ** schema consistent with what is on disk. */ case OP_DropIndex: { - sqlite3VdbeIncrWriteCounter(p, 0); - sqlite3UnlinkAndDeleteIndex(db, pOp->p1, pOp->p4.z); + tdsqlite3VdbeIncrWriteCounter(p, 0); + tdsqlite3UnlinkAndDeleteIndex(db, pOp->p1, pOp->p4.z); break; } @@ -95454,8 +95454,8 @@ case OP_DropIndex: { ** schema consistent with what is on disk. */ case OP_DropTrigger: { - sqlite3VdbeIncrWriteCounter(p, 0); - sqlite3UnlinkAndDeleteTrigger(db, pOp->p1, pOp->p4.z); + tdsqlite3VdbeIncrWriteCounter(p, 0); + tdsqlite3UnlinkAndDeleteTrigger(db, pOp->p1, pOp->p4.z); break; } @@ -95499,19 +95499,19 @@ case OP_IntegrityCk: { pIn1 = &aMem[pOp->p1]; assert( pOp->p5nDb ); assert( DbMaskTest(p->btreeMask, pOp->p5) ); - z = sqlite3BtreeIntegrityCheck(db, db->aDb[pOp->p5].pBt, &aRoot[1], nRoot, + z = tdsqlite3BtreeIntegrityCheck(db, db->aDb[pOp->p5].pBt, &aRoot[1], nRoot, (int)pnErr->u.i+1, &nErr); - sqlite3VdbeMemSetNull(pIn1); + tdsqlite3VdbeMemSetNull(pIn1); if( nErr==0 ){ assert( z==0 ); }else if( z==0 ){ goto no_mem; }else{ pnErr->u.i -= nErr-1; - sqlite3VdbeMemSetStr(pIn1, z, -1, SQLITE_UTF8, sqlite3_free); + tdsqlite3VdbeMemSetStr(pIn1, z, -1, SQLITE_UTF8, tdsqlite3_free); } UPDATE_MAX_BLOBSIZE(pIn1); - sqlite3VdbeChangeEncoding(pIn1, encoding); + tdsqlite3VdbeChangeEncoding(pIn1, encoding); goto check_for_interrupt; } #endif /* SQLITE_OMIT_INTEGRITY_CHECK */ @@ -95529,10 +95529,10 @@ case OP_RowSetAdd: { /* in1, in2 */ pIn2 = &aMem[pOp->p2]; assert( (pIn2->flags & MEM_Int)!=0 ); if( (pIn1->flags & MEM_Blob)==0 ){ - if( sqlite3VdbeMemSetRowSet(pIn1) ) goto no_mem; + if( tdsqlite3VdbeMemSetRowSet(pIn1) ) goto no_mem; } - assert( sqlite3VdbeMemIsRowSet(pIn1) ); - sqlite3RowSetInsert((RowSet*)pIn1->z, pIn2->u.i); + assert( tdsqlite3VdbeMemIsRowSet(pIn1) ); + tdsqlite3RowSetInsert((RowSet*)pIn1->z, pIn2->u.i); break; } @@ -95548,18 +95548,18 @@ case OP_RowSetRead: { /* jump, in1, out3 */ i64 val; pIn1 = &aMem[pOp->p1]; - assert( (pIn1->flags & MEM_Blob)==0 || sqlite3VdbeMemIsRowSet(pIn1) ); + assert( (pIn1->flags & MEM_Blob)==0 || tdsqlite3VdbeMemIsRowSet(pIn1) ); if( (pIn1->flags & MEM_Blob)==0 - || sqlite3RowSetNext((RowSet*)pIn1->z, &val)==0 + || tdsqlite3RowSetNext((RowSet*)pIn1->z, &val)==0 ){ /* The boolean index is empty */ - sqlite3VdbeMemSetNull(pIn1); + tdsqlite3VdbeMemSetNull(pIn1); VdbeBranchTaken(1,2); goto jump_to_p2_and_check_for_interrupt; }else{ /* A value was pulled from the index */ VdbeBranchTaken(0,2); - sqlite3VdbeMemSetInt64(&aMem[pOp->p3], val); + tdsqlite3VdbeMemSetInt64(&aMem[pOp->p3], val); } goto check_for_interrupt; } @@ -95600,18 +95600,18 @@ case OP_RowSetTest: { /* jump, in1, in3 */ ** delete it now and initialize P1 with an empty rowset */ if( (pIn1->flags & MEM_Blob)==0 ){ - if( sqlite3VdbeMemSetRowSet(pIn1) ) goto no_mem; + if( tdsqlite3VdbeMemSetRowSet(pIn1) ) goto no_mem; } - assert( sqlite3VdbeMemIsRowSet(pIn1) ); + assert( tdsqlite3VdbeMemIsRowSet(pIn1) ); assert( pOp->p4type==P4_INT32 ); assert( iSet==-1 || iSet>=0 ); if( iSet ){ - exists = sqlite3RowSetTest((RowSet*)pIn1->z, iSet, pIn3->u.i); + exists = tdsqlite3RowSetTest((RowSet*)pIn1->z, iSet, pIn3->u.i); VdbeBranchTaken(exists!=0,2); if( exists ) goto jump_to_p2; } if( iSet>=0 ){ - sqlite3RowSetInsert((RowSet*)pIn1->z, pIn3->u.i); + tdsqlite3RowSetInsert((RowSet*)pIn1->z, pIn3->u.i); } break; } @@ -95667,7 +95667,7 @@ case OP_Program: { /* jump */ if( p->nFrame>=db->aLimit[SQLITE_LIMIT_TRIGGER_DEPTH] ){ rc = SQLITE_ERROR; - sqlite3VdbeError(p, "too many levels of trigger recursion"); + tdsqlite3VdbeError(p, "too many levels of trigger recursion"); goto abort_due_to_error; } @@ -95688,15 +95688,15 @@ case OP_Program: { /* jump */ + nMem * sizeof(Mem) + pProgram->nCsr * sizeof(VdbeCursor*) + (pProgram->nOp + 7)/8; - pFrame = sqlite3DbMallocZero(db, nByte); + pFrame = tdsqlite3DbMallocZero(db, nByte); if( !pFrame ){ goto no_mem; } - sqlite3VdbeMemRelease(pRt); + tdsqlite3VdbeMemRelease(pRt); pRt->flags = MEM_Blob|MEM_Dyn; pRt->z = (char*)pFrame; pRt->n = nByte; - pRt->xDel = sqlite3VdbeFrameMemDel; + pRt->xDel = tdsqlite3VdbeFrameMemDel; pFrame->v = p; pFrame->nChildMem = nMem; @@ -95723,7 +95723,7 @@ case OP_Program: { /* jump */ } }else{ pFrame = (VdbeFrame*)pRt->z; - assert( pRt->xDel==sqlite3VdbeFrameMemDel ); + assert( pRt->xDel==tdsqlite3VdbeFrameMemDel ); assert( pProgram->nMem+pProgram->nCsr==pFrame->nChildMem || (pProgram->nCsr==0 && pProgram->nMem+1==pFrame->nChildMem) ); assert( pProgram->nCsr==pFrame->nChildCsr ); @@ -95784,7 +95784,7 @@ case OP_Param: { /* out2 */ pOut = out2Prerelease(p, pOp); pFrame = p->pFrame; pIn = &pFrame->aMem[pOp->p1 + pFrame->aOp[pFrame->pc].p1]; - sqlite3VdbeMemShallowCopy(pOut, pIn, MEM_Ephem); + tdsqlite3VdbeMemShallowCopy(pOut, pIn, MEM_Ephem); break; } @@ -95855,9 +95855,9 @@ case OP_MemMax: { /* in2 */ pIn1 = &aMem[pOp->p1]; } assert( memIsValid(pIn1) ); - sqlite3VdbeMemIntegerify(pIn1); + tdsqlite3VdbeMemIntegerify(pIn1); pIn2 = &aMem[pOp->p2]; - sqlite3VdbeMemIntegerify(pIn2); + tdsqlite3VdbeMemIntegerify(pIn2); if( pIn1->u.iu.i){ pIn1->u.i = pIn2->u.i; } @@ -95912,7 +95912,7 @@ case OP_OffsetLimit: { /* in1, out2, in3 */ assert( pIn1->flags & MEM_Int ); assert( pIn3->flags & MEM_Int ); x = pIn1->u.i; - if( x<=0 || sqlite3AddInt64(&x, pIn3->u.i>0?pIn3->u.i:0) ){ + if( x<=0 || tdsqlite3AddInt64(&x, pIn3->u.i>0?pIn3->u.i:0) ){ /* If the LIMIT is less than or equal to zero, loop forever. This ** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then ** also loop forever. This is undocumented. In fact, one could argue @@ -95996,27 +95996,27 @@ case OP_DecrJumpZero: { /* jump, in1 */ ** successors. ** ** This opcode is initially coded as OP_AggStep0. On first evaluation, -** the FuncDef stored in P4 is converted into an sqlite3_context and +** the FuncDef stored in P4 is converted into an tdsqlite3_context and ** the opcode is changed. In this way, the initialization of the -** sqlite3_context only happens once, instead of on each call to the +** tdsqlite3_context only happens once, instead of on each call to the ** step function. */ case OP_AggInverse: case OP_AggStep: { int n; - sqlite3_context *pCtx; + tdsqlite3_context *pCtx; assert( pOp->p4type==P4_FUNCDEF ); n = pOp->p5; assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); assert( n==0 || (pOp->p2>0 && pOp->p2+n<=(p->nMem+1 - p->nCursor)+1) ); assert( pOp->p3p2 || pOp->p3>=pOp->p2+n ); - pCtx = sqlite3DbMallocRawNN(db, n*sizeof(sqlite3_value*) + - (sizeof(pCtx[0]) + sizeof(Mem) - sizeof(sqlite3_value*))); + pCtx = tdsqlite3DbMallocRawNN(db, n*sizeof(tdsqlite3_value*) + + (sizeof(pCtx[0]) + sizeof(Mem) - sizeof(tdsqlite3_value*))); if( pCtx==0 ) goto no_mem; pCtx->pMem = 0; pCtx->pOut = (Mem*)&(pCtx->argv[n]); - sqlite3VdbeMemInit(pCtx->pOut, db, MEM_Null); + tdsqlite3VdbeMemInit(pCtx->pOut, db, MEM_Null); pCtx->pFunc = pOp->p4.pFunc; pCtx->iOp = (int)(pOp - aOp); pCtx->pVdbe = p; @@ -96034,7 +96034,7 @@ case OP_AggStep: { } case OP_AggStep1: { int i; - sqlite3_context *pCtx; + tdsqlite3_context *pCtx; Mem *pMem; assert( pOp->p4type==P4_FUNCCTX ); @@ -96055,7 +96055,7 @@ case OP_AggStep1: { /* If this function is inside of a trigger, the register array in aMem[] ** might change from one evaluation to the next. The next block of code ** checks to see if the register array has changed, and if so it - ** reinitializes the relavant parts of the sqlite3_context object */ + ** reinitializes the relavant parts of the tdsqlite3_context object */ if( pCtx->pMem != pMem ){ pCtx->pMem = pMem; for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i]; @@ -96081,16 +96081,16 @@ case OP_AggStep1: { if( pCtx->isError ){ if( pCtx->isError>0 ){ - sqlite3VdbeError(p, "%s", sqlite3_value_text(pCtx->pOut)); + tdsqlite3VdbeError(p, "%s", tdsqlite3_value_text(pCtx->pOut)); rc = pCtx->isError; } if( pCtx->skipFlag ){ assert( pOp[-1].opcode==OP_CollSeq ); i = pOp[-1].p1; - if( i ) sqlite3VdbeMemSetInt64(&aMem[i], 1); + if( i ) tdsqlite3VdbeMemSetInt64(&aMem[i], 1); pCtx->skipFlag = 0; } - sqlite3VdbeMemRelease(pCtx->pOut); + tdsqlite3VdbeMemRelease(pCtx->pOut); pCtx->pOut->flags = MEM_Null; pCtx->isError = 0; if( rc ) goto abort_due_to_error; @@ -96136,21 +96136,21 @@ case OP_AggFinal: { #ifndef SQLITE_OMIT_WINDOWFUNC if( pOp->p3 ){ memAboutToChange(p, &aMem[pOp->p3]); - rc = sqlite3VdbeMemAggValue(pMem, &aMem[pOp->p3], pOp->p4.pFunc); + rc = tdsqlite3VdbeMemAggValue(pMem, &aMem[pOp->p3], pOp->p4.pFunc); pMem = &aMem[pOp->p3]; }else #endif { - rc = sqlite3VdbeMemFinalize(pMem, pOp->p4.pFunc); + rc = tdsqlite3VdbeMemFinalize(pMem, pOp->p4.pFunc); } if( rc ){ - sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem)); + tdsqlite3VdbeError(p, "%s", tdsqlite3_value_text(pMem)); goto abort_due_to_error; } - sqlite3VdbeChangeEncoding(pMem, encoding); + tdsqlite3VdbeChangeEncoding(pMem, encoding); UPDATE_MAX_BLOBSIZE(pMem); - if( sqlite3VdbeMemTooBig(pMem) ){ + if( tdsqlite3VdbeMemTooBig(pMem) ){ goto too_big; } break; @@ -96181,14 +96181,14 @@ case OP_Checkpoint: { || pOp->p2==SQLITE_CHECKPOINT_RESTART || pOp->p2==SQLITE_CHECKPOINT_TRUNCATE ); - rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &aRes[1], &aRes[2]); + rc = tdsqlite3Checkpoint(db, pOp->p1, pOp->p2, &aRes[1], &aRes[2]); if( rc ){ if( rc!=SQLITE_BUSY ) goto abort_due_to_error; rc = SQLITE_OK; aRes[0] = 1; } for(i=0, pMem = &aMem[pOp->p3]; i<3; i++, pMem++){ - sqlite3VdbeMemSetInt64(pMem, (i64)aRes[i]); + tdsqlite3VdbeMemSetInt64(pMem, (i64)aRes[i]); } break; }; @@ -96229,20 +96229,20 @@ case OP_JournalMode: { /* out2 */ assert( p->readOnly==0 ); pBt = db->aDb[pOp->p1].pBt; - pPager = sqlite3BtreePager(pBt); - eOld = sqlite3PagerGetJournalMode(pPager); + pPager = tdsqlite3BtreePager(pBt); + eOld = tdsqlite3PagerGetJournalMode(pPager); if( eNew==PAGER_JOURNALMODE_QUERY ) eNew = eOld; - if( !sqlite3PagerOkToChangeJournalMode(pPager) ) eNew = eOld; + if( !tdsqlite3PagerOkToChangeJournalMode(pPager) ) eNew = eOld; #ifndef SQLITE_OMIT_WAL - zFilename = sqlite3PagerFilename(pPager, 1); + zFilename = tdsqlite3PagerFilename(pPager, 1); /* Do not allow a transition to journal_mode=WAL for a database ** in temporary storage or if the VFS does not support shared memory */ if( eNew==PAGER_JOURNALMODE_WAL - && (sqlite3Strlen30(zFilename)==0 /* Temp file */ - || !sqlite3PagerWalSupported(pPager)) /* No shared-memory support */ + && (tdsqlite3Strlen30(zFilename)==0 /* Temp file */ + || !tdsqlite3PagerWalSupported(pPager)) /* No shared-memory support */ ){ eNew = eOld; } @@ -96252,7 +96252,7 @@ case OP_JournalMode: { /* out2 */ ){ if( !db->autoCommit || db->nVdbeRead>1 ){ rc = SQLITE_ERROR; - sqlite3VdbeError(p, + tdsqlite3VdbeError(p, "cannot change %s wal mode from within a transaction", (eNew==PAGER_JOURNALMODE_WAL ? "into" : "out of") ); @@ -96265,35 +96265,35 @@ case OP_JournalMode: { /* out2 */ ** file. An EXCLUSIVE lock may still be held on the database file ** after a successful return. */ - rc = sqlite3PagerCloseWal(pPager, db); + rc = tdsqlite3PagerCloseWal(pPager, db); if( rc==SQLITE_OK ){ - sqlite3PagerSetJournalMode(pPager, eNew); + tdsqlite3PagerSetJournalMode(pPager, eNew); } }else if( eOld==PAGER_JOURNALMODE_MEMORY ){ /* Cannot transition directly from MEMORY to WAL. Use mode OFF ** as an intermediate */ - sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF); + tdsqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF); } /* Open a transaction on the database file. Regardless of the journal ** mode, this transaction always uses a rollback journal. */ - assert( sqlite3BtreeIsInTrans(pBt)==0 ); + assert( tdsqlite3BtreeIsInTrans(pBt)==0 ); if( rc==SQLITE_OK ){ - rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1)); + rc = tdsqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1)); } } } #endif /* ifndef SQLITE_OMIT_WAL */ if( rc ) eNew = eOld; - eNew = sqlite3PagerSetJournalMode(pPager, eNew); + eNew = tdsqlite3PagerSetJournalMode(pPager, eNew); pOut->flags = MEM_Str|MEM_Static|MEM_Term; - pOut->z = (char *)sqlite3JournalModename(eNew); - pOut->n = sqlite3Strlen30(pOut->z); + pOut->z = (char *)tdsqlite3JournalModename(eNew); + pOut->n = tdsqlite3Strlen30(pOut->z); pOut->enc = SQLITE_UTF8; - sqlite3VdbeChangeEncoding(pOut, encoding); + tdsqlite3VdbeChangeEncoding(pOut, encoding); if( rc ) goto abort_due_to_error; break; }; @@ -96311,7 +96311,7 @@ case OP_JournalMode: { /* out2 */ */ case OP_Vacuum: { assert( p->readOnly==0 ); - rc = sqlite3RunVacuum(&p->zErrMsg, db, pOp->p1, + rc = tdsqlite3RunVacuum(&p->zErrMsg, db, pOp->p1, pOp->p2 ? &aMem[pOp->p2] : 0); if( rc ) goto abort_due_to_error; break; @@ -96332,7 +96332,7 @@ case OP_IncrVacuum: { /* jump */ assert( DbMaskTest(p->btreeMask, pOp->p1) ); assert( p->readOnly==0 ); pBt = db->aDb[pOp->p1].pBt; - rc = sqlite3BtreeIncrVacuum(pBt); + rc = tdsqlite3BtreeIncrVacuum(pBt); VdbeBranchTaken(rc==SQLITE_DONE,2); if( rc ){ if( rc!=SQLITE_DONE ) goto abort_due_to_error; @@ -96346,8 +96346,8 @@ case OP_IncrVacuum: { /* jump */ /* Opcode: Expire P1 P2 * * * ** ** Cause precompiled statements to expire. When an expired statement -** is executed using sqlite3_step() it will either automatically -** reprepare itself (if it was originally created using sqlite3_prepare_v2()) +** is executed using tdsqlite3_step() it will either automatically +** reprepare itself (if it was originally created using tdsqlite3_prepare_v2()) ** or it will fail with SQLITE_SCHEMA. ** ** If P1 is 0, then all SQL statements become expired. If P1 is non-zero, @@ -96362,7 +96362,7 @@ case OP_IncrVacuum: { /* jump */ case OP_Expire: { assert( pOp->p2==0 || pOp->p2==1 ); if( !pOp->p1 ){ - sqlite3ExpirePreparedStatements(db, pOp->p2); + tdsqlite3ExpirePreparedStatements(db, pOp->p2); }else{ p->expired = pOp->p2+1; } @@ -96380,7 +96380,7 @@ case OP_CursorLock: { pC = p->apCsr[pOp->p1]; assert( pC!=0 ); assert( pC->eCurType==CURTYPE_BTREE ); - sqlite3BtreeCursorPin(pC->uc.pCursor); + tdsqlite3BtreeCursorPin(pC->uc.pCursor); break; } @@ -96395,7 +96395,7 @@ case OP_CursorUnlock: { pC = p->apCsr[pOp->p1]; assert( pC!=0 ); assert( pC->eCurType==CURTYPE_BTREE ); - sqlite3BtreeCursorUnpin(pC->uc.pCursor); + tdsqlite3BtreeCursorUnpin(pC->uc.pCursor); break; } @@ -96422,11 +96422,11 @@ case OP_TableLock: { assert( p1>=0 && p1nDb ); assert( DbMaskTest(p->btreeMask, p1) ); assert( isWriteLock==0 || isWriteLock==1 ); - rc = sqlite3BtreeLockTable(db->aDb[p1].pBt, pOp->p2, isWriteLock); + rc = tdsqlite3BtreeLockTable(db->aDb[p1].pBt, pOp->p2, isWriteLock); if( rc ){ if( (rc&0xFF)==SQLITE_LOCKED ){ const char *z = pOp->p4.z; - sqlite3VdbeError(p, "database table is locked: %s", z); + tdsqlite3VdbeError(p, "database table is locked: %s", z); } goto abort_due_to_error; } @@ -96438,7 +96438,7 @@ case OP_TableLock: { #ifndef SQLITE_OMIT_VIRTUALTABLE /* Opcode: VBegin * * * P4 * ** -** P4 may be a pointer to an sqlite3_vtab structure. If so, call the +** P4 may be a pointer to an tdsqlite3_vtab structure. If so, call the ** xBegin method for that table. ** ** Also, whether or not P4 is set, check that this is not being called from @@ -96448,8 +96448,8 @@ case OP_TableLock: { case OP_VBegin: { VTable *pVTab; pVTab = pOp->p4.pVtab; - rc = sqlite3VtabBegin(db, pVTab); - if( pVTab ) sqlite3VtabImportErrmsg(p, pVTab->pVtab); + rc = tdsqlite3VtabBegin(db, pVTab); + if( pVTab ) tdsqlite3VtabImportErrmsg(p, pVTab->pVtab); if( rc ) goto abort_due_to_error; break; } @@ -96468,17 +96468,17 @@ case OP_VCreate: { memset(&sMem, 0, sizeof(sMem)); sMem.db = db; /* Because P2 is always a static string, it is impossible for the - ** sqlite3VdbeMemCopy() to fail */ + ** tdsqlite3VdbeMemCopy() to fail */ assert( (aMem[pOp->p2].flags & MEM_Str)!=0 ); assert( (aMem[pOp->p2].flags & MEM_Static)!=0 ); - rc = sqlite3VdbeMemCopy(&sMem, &aMem[pOp->p2]); + rc = tdsqlite3VdbeMemCopy(&sMem, &aMem[pOp->p2]); assert( rc==SQLITE_OK ); - zTab = (const char*)sqlite3_value_text(&sMem); + zTab = (const char*)tdsqlite3_value_text(&sMem); assert( zTab || db->mallocFailed ); if( zTab ){ - rc = sqlite3VtabCallCreate(db, pOp->p1, zTab, &p->zErrMsg); + rc = tdsqlite3VtabCallCreate(db, pOp->p1, zTab, &p->zErrMsg); } - sqlite3VdbeMemRelease(&sMem); + tdsqlite3VdbeMemRelease(&sMem); if( rc ) goto abort_due_to_error; break; } @@ -96492,7 +96492,7 @@ case OP_VCreate: { */ case OP_VDestroy: { db->nVDestroy++; - rc = sqlite3VtabCallDestroy(db, pOp->p1, pOp->p4.z); + rc = tdsqlite3VtabCallDestroy(db, pOp->p1, pOp->p4.z); db->nVDestroy--; assert( p->errorAction==OE_Abort && p->usesStmtJournal ); if( rc ) goto abort_due_to_error; @@ -96503,15 +96503,15 @@ case OP_VDestroy: { #ifndef SQLITE_OMIT_VIRTUALTABLE /* Opcode: VOpen P1 * * P4 * ** -** P4 is a pointer to a virtual table object, an sqlite3_vtab structure. +** P4 is a pointer to a virtual table object, an tdsqlite3_vtab structure. ** P1 is a cursor number. This opcode opens a cursor to the virtual ** table and stores that cursor in P1. */ case OP_VOpen: { VdbeCursor *pCur; - sqlite3_vtab_cursor *pVCur; - sqlite3_vtab *pVtab; - const sqlite3_module *pModule; + tdsqlite3_vtab_cursor *pVCur; + tdsqlite3_vtab *pVtab; + const tdsqlite3_module *pModule; assert( p->bIsReader ); pCur = 0; @@ -96523,10 +96523,10 @@ case OP_VOpen: { } pModule = pVtab->pModule; rc = pModule->xOpen(pVtab, &pVCur); - sqlite3VtabImportErrmsg(p, pVtab); + tdsqlite3VtabImportErrmsg(p, pVtab); if( rc ) goto abort_due_to_error; - /* Initialize sqlite3_vtab_cursor base class */ + /* Initialize tdsqlite3_vtab_cursor base class */ pVCur->pVtab = pVtab; /* Initialize vdbe cursor object */ @@ -96566,11 +96566,11 @@ case OP_VOpen: { case OP_VFilter: { /* jump */ int nArg; int iQuery; - const sqlite3_module *pModule; + const tdsqlite3_module *pModule; Mem *pQuery; Mem *pArgc; - sqlite3_vtab_cursor *pVCur; - sqlite3_vtab *pVtab; + tdsqlite3_vtab_cursor *pVCur; + tdsqlite3_vtab *pVtab; VdbeCursor *pCur; int res; int i; @@ -96598,7 +96598,7 @@ case OP_VFilter: { /* jump */ apArg[i] = &pArgc[i+1]; } rc = pModule->xFilter(pVCur, iQuery, pOp->p4.z, nArg, apArg); - sqlite3VtabImportErrmsg(p, pVtab); + tdsqlite3VtabImportErrmsg(p, pVtab); if( rc ) goto abort_due_to_error; res = pModule->xEof(pVCur); pCur->nullRow = 0; @@ -96617,17 +96617,17 @@ case OP_VFilter: { /* jump */ ** ** If the VColumn opcode is being used to fetch the value of ** an unchanging column during an UPDATE operation, then the P5 -** value is OPFLAG_NOCHNG. This will cause the sqlite3_vtab_nochange() +** value is OPFLAG_NOCHNG. This will cause the tdsqlite3_vtab_nochange() ** function to return true inside the xColumn method of the virtual ** table implementation. The P5 column might also contain other ** bits (OPFLAG_LENGTHARG or OPFLAG_TYPEOFARG) but those bits are ** unused by OP_VColumn. */ case OP_VColumn: { - sqlite3_vtab *pVtab; - const sqlite3_module *pModule; + tdsqlite3_vtab *pVtab; + const tdsqlite3_module *pModule; Mem *pDest; - sqlite3_context sContext; + tdsqlite3_context sContext; VdbeCursor *pCur = p->apCsr[pOp->p1]; assert( pCur->eCurType==CURTYPE_VTAB ); @@ -96635,7 +96635,7 @@ case OP_VColumn: { pDest = &aMem[pOp->p3]; memAboutToChange(p, pDest); if( pCur->nullRow ){ - sqlite3VdbeMemSetNull(pDest); + tdsqlite3VdbeMemSetNull(pDest); break; } pVtab = pCur->uc.pVCur->pVtab; @@ -96645,23 +96645,23 @@ case OP_VColumn: { sContext.pOut = pDest; assert( pOp->p5==OPFLAG_NOCHNG || pOp->p5==0 ); if( pOp->p5 & OPFLAG_NOCHNG ){ - sqlite3VdbeMemSetNull(pDest); + tdsqlite3VdbeMemSetNull(pDest); pDest->flags = MEM_Null|MEM_Zero; pDest->u.nZero = 0; }else{ MemSetTypeFlag(pDest, MEM_Null); } rc = pModule->xColumn(pCur->uc.pVCur, &sContext, pOp->p2); - sqlite3VtabImportErrmsg(p, pVtab); + tdsqlite3VtabImportErrmsg(p, pVtab); if( sContext.isError>0 ){ - sqlite3VdbeError(p, "%s", sqlite3_value_text(pDest)); + tdsqlite3VdbeError(p, "%s", tdsqlite3_value_text(pDest)); rc = sContext.isError; } - sqlite3VdbeChangeEncoding(pDest, encoding); + tdsqlite3VdbeChangeEncoding(pDest, encoding); REGISTER_TRACE(pOp->p3, pDest); UPDATE_MAX_BLOBSIZE(pDest); - if( sqlite3VdbeMemTooBig(pDest) ){ + if( tdsqlite3VdbeMemTooBig(pDest) ){ goto too_big; } if( rc ) goto abort_due_to_error; @@ -96677,8 +96677,8 @@ case OP_VColumn: { ** the end of its result set, then fall through to the next instruction. */ case OP_VNext: { /* jump */ - sqlite3_vtab *pVtab; - const sqlite3_module *pModule; + tdsqlite3_vtab *pVtab; + const tdsqlite3_module *pModule; int res; VdbeCursor *pCur; @@ -96699,7 +96699,7 @@ case OP_VNext: { /* jump */ ** some other method is next invoked on the save virtual table cursor. */ rc = pModule->xNext(pCur->uc.pVCur); - sqlite3VtabImportErrmsg(p, pVtab); + tdsqlite3VtabImportErrmsg(p, pVtab); if( rc ) goto abort_due_to_error; res = pModule->xEof(pCur->uc.pVCur); VdbeBranchTaken(!res,2); @@ -96714,12 +96714,12 @@ case OP_VNext: { /* jump */ #ifndef SQLITE_OMIT_VIRTUALTABLE /* Opcode: VRename P1 * * P4 * ** -** P4 is a pointer to a virtual table object, an sqlite3_vtab structure. +** P4 is a pointer to a virtual table object, an tdsqlite3_vtab structure. ** This opcode invokes the corresponding xRename method. The value ** in register P1 is passed as the zName argument to the xRename method. */ case OP_VRename: { - sqlite3_vtab *pVtab; + tdsqlite3_vtab *pVtab; Mem *pName; int isLegacy; @@ -96735,11 +96735,11 @@ case OP_VRename: { testcase( pName->enc==SQLITE_UTF8 ); testcase( pName->enc==SQLITE_UTF16BE ); testcase( pName->enc==SQLITE_UTF16LE ); - rc = sqlite3VdbeChangeEncoding(pName, SQLITE_UTF8); + rc = tdsqlite3VdbeChangeEncoding(pName, SQLITE_UTF8); if( rc ) goto abort_due_to_error; rc = pVtab->pModule->xRename(pVtab, pName->z); if( isLegacy==0 ) db->flags &= ~(u64)SQLITE_LegacyAlter; - sqlite3VtabImportErrmsg(p, pVtab); + tdsqlite3VtabImportErrmsg(p, pVtab); p->expired = 0; if( rc ) goto abort_due_to_error; break; @@ -96750,7 +96750,7 @@ case OP_VRename: { /* Opcode: VUpdate P1 P2 P3 P4 P5 ** Synopsis: data=r[P3@P2] ** -** P4 is a pointer to a virtual table object, an sqlite3_vtab structure. +** P4 is a pointer to a virtual table object, an tdsqlite3_vtab structure. ** This opcode invokes the corresponding xUpdate method. P2 values ** are contiguous memory cells starting at P3 to pass to the xUpdate ** invocation. The value in register (P3+P2-1) corresponds to the @@ -96768,15 +96768,15 @@ case OP_VRename: { ** a row to delete. ** ** P1 is a boolean flag. If it is set to true and the xUpdate call -** is successful, then the value returned by sqlite3_last_insert_rowid() +** is successful, then the value returned by tdsqlite3_last_insert_rowid() ** is set to the value of the rowid for the row just inserted. ** ** P5 is the error actions (OE_Replace, OE_Fail, OE_Ignore, etc) to ** apply in the case of a constraint failure on an insert or update. */ case OP_VUpdate: { - sqlite3_vtab *pVtab; - const sqlite3_module *pModule; + tdsqlite3_vtab *pVtab; + const tdsqlite3_module *pModule; int nArg; int i; sqlite_int64 rowid; @@ -96788,7 +96788,7 @@ case OP_VUpdate: { ); assert( p->readOnly==0 ); if( db->mallocFailed ) goto no_mem; - sqlite3VdbeIncrWriteCounter(p, 0); + tdsqlite3VdbeIncrWriteCounter(p, 0); pVtab = pOp->p4.pVtab->pVtab; if( pVtab==0 || NEVER(pVtab->pModule==0) ){ rc = SQLITE_LOCKED; @@ -96810,7 +96810,7 @@ case OP_VUpdate: { db->vtabOnConflict = pOp->p5; rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid); db->vtabOnConflict = vtabOnConflict; - sqlite3VtabImportErrmsg(p, pVtab); + tdsqlite3VtabImportErrmsg(p, pVtab); if( rc==SQLITE_OK && pOp->p1 ){ assert( nArg>1 && apArg[0] && (apArg[0]->flags&MEM_Null) ); db->lastRowid = rowid; @@ -96837,7 +96837,7 @@ case OP_VUpdate: { */ case OP_Pagecount: { /* out2 */ pOut = out2Prerelease(p, pOp); - pOut->u.i = sqlite3BtreeLastPage(db->aDb[pOp->p1].pBt); + pOut->u.i = tdsqlite3BtreeLastPage(db->aDb[pOp->p1].pBt); break; } #endif @@ -96860,10 +96860,10 @@ case OP_MaxPgcnt: { /* out2 */ pBt = db->aDb[pOp->p1].pBt; newMax = 0; if( pOp->p3 ){ - newMax = sqlite3BtreeLastPage(pBt); + newMax = tdsqlite3BtreeLastPage(pBt); if( newMax < (unsigned)pOp->p3 ) newMax = (unsigned)pOp->p3; } - pOut->u.i = sqlite3BtreeMaxPageCount(pBt, newMax); + pOut->u.i = tdsqlite3BtreeMaxPageCount(pBt, newMax); break; } #endif @@ -96871,10 +96871,10 @@ case OP_MaxPgcnt: { /* out2 */ /* Opcode: Function P1 P2 P3 P4 * ** Synopsis: r[P3]=func(r[P2@P5]) ** -** Invoke a user function (P4 is a pointer to an sqlite3_context object that +** Invoke a user function (P4 is a pointer to an tdsqlite3_context object that ** contains a pointer to the function to be run) with arguments taken ** from register P2 and successors. The number of arguments is in -** the sqlite3_context object that P4 points to. +** the tdsqlite3_context object that P4 points to. ** The result of the function is stored ** in register P3. Register P3 must not be one of the function inputs. ** @@ -96882,7 +96882,7 @@ case OP_MaxPgcnt: { /* out2 */ ** function was determined to be constant at compile time. If the first ** argument was constant then bit 0 of P1 is set. This is used to determine ** whether meta data associated with a user function argument using the -** sqlite3_set_auxdata() API may be safely retained until the next +** tdsqlite3_set_auxdata() API may be safely retained until the next ** invocation of this opcode. ** ** See also: AggStep, AggFinal, PureFunc @@ -96890,10 +96890,10 @@ case OP_MaxPgcnt: { /* out2 */ /* Opcode: PureFunc P1 P2 P3 P4 * ** Synopsis: r[P3]=func(r[P2@P5]) ** -** Invoke a user function (P4 is a pointer to an sqlite3_context object that +** Invoke a user function (P4 is a pointer to an tdsqlite3_context object that ** contains a pointer to the function to be run) with arguments taken ** from register P2 and successors. The number of arguments is in -** the sqlite3_context object that P4 points to. +** the tdsqlite3_context object that P4 points to. ** The result of the function is stored ** in register P3. Register P3 must not be one of the function inputs. ** @@ -96901,7 +96901,7 @@ case OP_MaxPgcnt: { /* out2 */ ** function was determined to be constant at compile time. If the first ** argument was constant then bit 0 of P1 is set. This is used to determine ** whether meta data associated with a user function argument using the -** sqlite3_set_auxdata() API may be safely retained until the next +** tdsqlite3_set_auxdata() API may be safely retained until the next ** invocation of this opcode. ** ** This opcode works exactly like OP_Function. The only difference is in @@ -96917,7 +96917,7 @@ case OP_MaxPgcnt: { /* out2 */ case OP_PureFunc: /* group */ case OP_Function: { /* group */ int i; - sqlite3_context *pCtx; + tdsqlite3_context *pCtx; assert( pOp->p4type==P4_FUNCCTX ); pCtx = pOp->p4.pCtx; @@ -96925,7 +96925,7 @@ case OP_Function: { /* group */ /* If this function is inside of a trigger, the register array in aMem[] ** might change from one evaluation to the next. The next block of code ** checks to see if the register array has changed, and if so it - ** reinitializes the relavant parts of the sqlite3_context object */ + ** reinitializes the relavant parts of the tdsqlite3_context object */ pOut = &aMem[pOp->p3]; if( pCtx->pOut != pOut ){ pCtx->pVdbe = p; @@ -96948,18 +96948,18 @@ case OP_Function: { /* group */ /* If the function returned an error, throw an exception */ if( pCtx->isError ){ if( pCtx->isError>0 ){ - sqlite3VdbeError(p, "%s", sqlite3_value_text(pOut)); + tdsqlite3VdbeError(p, "%s", tdsqlite3_value_text(pOut)); rc = pCtx->isError; } - sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1); + tdsqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1); pCtx->isError = 0; if( rc ) goto abort_due_to_error; } /* Copy the result of the function into register P3 */ if( pOut->flags & (MEM_Str|MEM_Blob) ){ - sqlite3VdbeChangeEncoding(pOut, encoding); - if( sqlite3VdbeMemTooBig(pOut) ) goto too_big; + tdsqlite3VdbeChangeEncoding(pOut, encoding); + if( tdsqlite3VdbeMemTooBig(pOut) ) goto too_big; } REGISTER_TRACE(pOp->p3, pOut); @@ -96980,9 +96980,9 @@ case OP_Function: { /* group */ ** Programs contain a single instance of this opcode as the very first ** opcode. ** -** If tracing is enabled (by the sqlite3_trace()) interface, then +** If tracing is enabled (by the tdsqlite3_trace()) interface, then ** the UTF-8 string contained in P4 is emitted on the trace callback. -** Or if P4 is blank, use the string returned by sqlite3_sql(). +** Or if P4 is blank, use the string returned by tdsqlite3_sql(). ** ** If P2 is not zero, jump to instruction P2. ** @@ -97004,9 +97004,9 @@ case OP_Init: { /* jump */ ** ** This assert() provides evidence for: ** EVIDENCE-OF: R-50676-09860 The callback can compute the same text that - ** would have been returned by the legacy sqlite3_trace() interface by + ** would have been returned by the legacy tdsqlite3_trace() interface by ** using the X argument when X begins with "--" and invoking - ** sqlite3_expanded_sql(P) otherwise. + ** tdsqlite3_expanded_sql(P) otherwise. */ assert( pOp->p4.z==0 || strncmp(pOp->p4.z, "-" "- ", 3)==0 ); @@ -97021,15 +97021,15 @@ case OP_Init: { /* jump */ #ifndef SQLITE_OMIT_DEPRECATED if( db->mTrace & SQLITE_TRACE_LEGACY ){ void (*x)(void*,const char*) = (void(*)(void*,const char*))db->xTrace; - char *z = sqlite3VdbeExpandSql(p, zTrace); + char *z = tdsqlite3VdbeExpandSql(p, zTrace); x(db->pTraceArg, z); - sqlite3_free(z); + tdsqlite3_free(z); }else #endif if( db->nVdbeExec>1 ){ - char *z = sqlite3MPrintf(db, "-- %s", zTrace); + char *z = tdsqlite3MPrintf(db, "-- %s", zTrace); (void)db->xTrace(SQLITE_TRACE_STMT, db->pTraceArg, p, z); - sqlite3DbFree(db, z); + tdsqlite3DbFree(db, z); }else{ (void)db->xTrace(SQLITE_TRACE_STMT, db->pTraceArg, p, zTrace); } @@ -97040,7 +97040,7 @@ case OP_Init: { /* jump */ int j; for(j=0; jnDb; j++){ if( DbMaskTest(p->btreeMask, j)==0 ) continue; - sqlite3_file_control(db, db->aDb[j].zDbSName, SQLITE_FCNTL_TRACE, zTrace); + tdsqlite3_file_control(db, db->aDb[j].zDbSName, SQLITE_FCNTL_TRACE, zTrace); } } #endif /* SQLITE_USE_FCNTL_TRACE */ @@ -97048,12 +97048,12 @@ case OP_Init: { /* jump */ if( (db->flags & SQLITE_SqlTrace)!=0 && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0 ){ - sqlite3DebugPrintf("SQL-trace: %s\n", zTrace); + tdsqlite3DebugPrintf("SQL-trace: %s\n", zTrace); } #endif /* SQLITE_DEBUG */ #endif /* SQLITE_OMIT_TRACE */ assert( pOp->p2>0 ); - if( pOp->p1>=sqlite3GlobalConfig.iOnceResetThreshold ){ + if( pOp->p1>=tdsqlite3GlobalConfig.iOnceResetThreshold ){ if( pOp->opcode==OP_Trace ) break; for(i=1; inOp; i++){ if( p->aOp[i].opcode==OP_Once ) p->aOp[i].p1 = 0; @@ -97081,7 +97081,7 @@ case OP_CursorHint: { pC = p->apCsr[pOp->p1]; if( pC ){ assert( pC->eCurType==CURTYPE_BTREE ); - sqlite3BtreeCursorHint(pC->uc.pCursor, BTREE_HINT_RANGE, + tdsqlite3BtreeCursorHint(pC->uc.pCursor, BTREE_HINT_RANGE, pOp->p4.pExpr, aMem); } break; @@ -97099,7 +97099,7 @@ case OP_CursorHint: { ** an active statement journal. */ case OP_Abortable: { - sqlite3VdbeAssertAbortable(p); + tdsqlite3VdbeAssertAbortable(p); break; } #endif @@ -97118,7 +97118,7 @@ case OP_Abortable: { ** Releasing a register clears the Mem.pScopyFrom pointer. That means ** that if the content of the released register was set using OP_SCopy, ** a change to the value of the source register for the OP_SCopy will no longer -** generate an assertion fault in sqlite3VdbeMemAboutToChange(). +** generate an assertion fault in tdsqlite3VdbeMemAboutToChange(). ** ** If P5 is set, then all released registers have their type set ** to MEM_Undefined so that any subsequent attempt to read the released @@ -97180,7 +97180,7 @@ default: { /* This is really OP_Noop, OP_Explain */ #ifdef VDBE_PROFILE { - u64 endTime = sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime(); + u64 endTime = tdsqlite3NProfileCnt ? tdsqlite3NProfileCnt : tdsqlite3Hwtime(); if( endTime>start ) pOrigOp->cycles += endTime - start; pOrigOp->cnt++; } @@ -97196,7 +97196,7 @@ default: { /* This is really OP_Noop, OP_Explain */ #ifdef SQLITE_DEBUG if( db->flags & SQLITE_VdbeTrace ){ - u8 opProperty = sqlite3OpcodeProperty[pOrigOp->opcode]; + u8 opProperty = tdsqlite3OpcodeProperty[pOrigOp->opcode]; if( rc!=0 ) printf("rc=%d\n",rc); if( opProperty & (OPFLG_OUT2) ){ registerTrace(pOrigOp->p2, &aMem[pOrigOp->p2]); @@ -97206,9 +97206,9 @@ default: { /* This is really OP_Noop, OP_Explain */ } if( opProperty==0xff ){ /* Never happens. This code exists to avoid a harmless linkage - ** warning aboud sqlite3VdbeRegisterDump() being defined but not + ** warning aboud tdsqlite3VdbeRegisterDump() being defined but not ** used. */ - sqlite3VdbeRegisterDump(p); + tdsqlite3VdbeRegisterDump(p); } } #endif /* SQLITE_DEBUG */ @@ -97222,18 +97222,18 @@ abort_due_to_error: if( db->mallocFailed ) rc = SQLITE_NOMEM_BKPT; assert( rc ); if( p->zErrMsg==0 && rc!=SQLITE_IOERR_NOMEM ){ - sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc)); + tdsqlite3VdbeError(p, "%s", tdsqlite3ErrStr(rc)); } p->rc = rc; - sqlite3SystemError(db, rc); - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(rc, "statement aborts at %d: [%s] %s", + tdsqlite3SystemError(db, rc); + testcase( tdsqlite3GlobalConfig.xLog!=0 ); + tdsqlite3_log(rc, "statement aborts at %d: [%s] %s", (int)(pOp - aOp), p->zSql, p->zErrMsg); - sqlite3VdbeHalt(p); - if( rc==SQLITE_IOERR_NOMEM ) sqlite3OomFault(db); + tdsqlite3VdbeHalt(p); + if( rc==SQLITE_IOERR_NOMEM ) tdsqlite3OomFault(db); rc = SQLITE_ERROR; if( resetSchemaOnFault>0 ){ - sqlite3ResetOneSchema(db, resetSchemaOnFault-1); + tdsqlite3ResetOneSchema(db, resetSchemaOnFault-1); } /* This is the only way out of this procedure. We have to @@ -97251,9 +97251,9 @@ vdbe_return: } #endif p->aCounter[SQLITE_STMTSTATUS_VM_STEP] += (int)nVmStep; - sqlite3VdbeLeave(p); + tdsqlite3VdbeLeave(p); assert( rc!=SQLITE_OK || nExtraDelete==0 - || sqlite3_strlike("DELETE%",p->zSql,0)!=0 + || tdsqlite3_strlike("DELETE%",p->zSql,0)!=0 ); return rc; @@ -97261,26 +97261,26 @@ vdbe_return: ** is encountered. */ too_big: - sqlite3VdbeError(p, "string or blob too big"); + tdsqlite3VdbeError(p, "string or blob too big"); rc = SQLITE_TOOBIG; goto abort_due_to_error; /* Jump to here if a malloc() fails. */ no_mem: - sqlite3OomFault(db); - sqlite3VdbeError(p, "out of memory"); + tdsqlite3OomFault(db); + tdsqlite3VdbeError(p, "out of memory"); rc = SQLITE_NOMEM_BKPT; goto abort_due_to_error; - /* Jump to here if the sqlite3_interrupt() API sets the interrupt + /* Jump to here if the tdsqlite3_interrupt() API sets the interrupt ** flag. */ abort_due_to_interrupt: assert( db->u1.isInterrupted ); rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT; p->rc = rc; - sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc)); + tdsqlite3VdbeError(p, "%s", tdsqlite3ErrStr(rc)); goto abort_due_to_error; } @@ -97308,7 +97308,7 @@ abort_due_to_interrupt: #ifndef SQLITE_OMIT_INCRBLOB /* -** Valid sqlite3_blob* handles point to Incrblob structures. +** Valid tdsqlite3_blob* handles point to Incrblob structures. */ typedef struct Incrblob Incrblob; struct Incrblob { @@ -97316,8 +97316,8 @@ struct Incrblob { int iOffset; /* Byte offset of blob in cursor data */ u16 iCol; /* Table column this handle is open on */ BtCursor *pCsr; /* Cursor pointing at blob row */ - sqlite3_stmt *pStmt; /* Statement holding cursor open */ - sqlite3 *db; /* The associated database */ + tdsqlite3_stmt *pStmt; /* Statement holding cursor open */ + tdsqlite3 *db; /* The associated database */ char *zDb; /* Database name */ Table *pTab; /* Table object */ }; @@ -97327,20 +97327,20 @@ struct Incrblob { ** This function is used by both blob_open() and blob_reopen(). It seeks ** the b-tree cursor associated with blob handle p to point to row iRow. ** If successful, SQLITE_OK is returned and subsequent calls to -** sqlite3_blob_read() or sqlite3_blob_write() access the specified row. +** tdsqlite3_blob_read() or tdsqlite3_blob_write() access the specified row. ** ** If an error occurs, or if the specified row does not exist or does not ** contain a value of type TEXT or BLOB in the column nominated when the ** blob handle was opened, then an error code is returned and *pzErr may ** be set to point to a buffer containing an error message. It is the ** responsibility of the caller to free the error message buffer using -** sqlite3DbFree(). +** tdsqlite3DbFree(). ** ** If an error does occur, then the b-tree cursor is closed. All subsequent -** calls to sqlite3_blob_read(), blob_write() or blob_reopen() will +** calls to tdsqlite3_blob_read(), blob_write() or blob_reopen() will ** immediately return SQLITE_ABORT. */ -static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){ +static int blobSeekToRow(Incrblob *p, tdsqlite3_int64 iRow, char **pzErr){ int rc; /* Error code */ char *zErr = 0; /* Error message */ Vdbe *v = (Vdbe *)p->pStmt; @@ -97358,9 +97358,9 @@ static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){ if( v->pc>4 ){ v->pc = 4; assert( v->aOp[v->pc].opcode==OP_NotExists ); - rc = sqlite3VdbeExec(v); + rc = tdsqlite3VdbeExec(v); }else{ - rc = sqlite3_step(p->pStmt); + rc = tdsqlite3_step(p->pStmt); } if( rc==SQLITE_ROW ){ VdbeCursor *pC = v->apCsr[0]; @@ -97368,30 +97368,30 @@ static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){ testcase( pC->nHdrParsed==p->iCol ); testcase( pC->nHdrParsed==p->iCol+1 ); if( type<12 ){ - zErr = sqlite3MPrintf(p->db, "cannot open value of type %s", + zErr = tdsqlite3MPrintf(p->db, "cannot open value of type %s", type==0?"null": type==7?"real": "integer" ); rc = SQLITE_ERROR; - sqlite3_finalize(p->pStmt); + tdsqlite3_finalize(p->pStmt); p->pStmt = 0; }else{ p->iOffset = pC->aType[p->iCol + pC->nField]; - p->nByte = sqlite3VdbeSerialTypeLen(type); + p->nByte = tdsqlite3VdbeSerialTypeLen(type); p->pCsr = pC->uc.pCursor; - sqlite3BtreeIncrblobCursor(p->pCsr); + tdsqlite3BtreeIncrblobCursor(p->pCsr); } } if( rc==SQLITE_ROW ){ rc = SQLITE_OK; }else if( p->pStmt ){ - rc = sqlite3_finalize(p->pStmt); + rc = tdsqlite3_finalize(p->pStmt); p->pStmt = 0; if( rc==SQLITE_OK ){ - zErr = sqlite3MPrintf(p->db, "no such rowid: %lld", iRow); + zErr = tdsqlite3MPrintf(p->db, "no such rowid: %lld", iRow); rc = SQLITE_ERROR; }else{ - zErr = sqlite3MPrintf(p->db, "%s", sqlite3_errmsg(p->db)); + zErr = tdsqlite3MPrintf(p->db, "%s", tdsqlite3_errmsg(p->db)); } } @@ -97405,14 +97405,14 @@ static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){ /* ** Open a blob handle. */ -SQLITE_API int sqlite3_blob_open( - sqlite3* db, /* The database connection */ +SQLITE_API int tdsqlite3_blob_open( + tdsqlite3* db, /* The database connection */ const char *zDb, /* The attached database containing the blob */ const char *zTable, /* The table containing the blob */ const char *zColumn, /* The column containing the blob */ sqlite_int64 iRow, /* The row containing the glob */ int wrFlag, /* True -> read/write access, false -> read-only */ - sqlite3_blob **ppBlob /* Handle for accessing the blob returned here */ + tdsqlite3_blob **ppBlob /* Handle for accessing the blob returned here */ ){ int nAttempt = 0; int iCol; /* Index of zColumn in row-record */ @@ -97429,62 +97429,62 @@ SQLITE_API int sqlite3_blob_open( #endif *ppBlob = 0; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || zTable==0 ){ + if( !tdsqlite3SafetyCheckOk(db) || zTable==0 ){ return SQLITE_MISUSE_BKPT; } #endif wrFlag = !!wrFlag; /* wrFlag = (wrFlag ? 1 : 0); */ - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); - pBlob = (Incrblob *)sqlite3DbMallocZero(db, sizeof(Incrblob)); + pBlob = (Incrblob *)tdsqlite3DbMallocZero(db, sizeof(Incrblob)); do { memset(&sParse, 0, sizeof(Parse)); if( !pBlob ) goto blob_open_out; sParse.db = db; - sqlite3DbFree(db, zErr); + tdsqlite3DbFree(db, zErr); zErr = 0; - sqlite3BtreeEnterAll(db); - pTab = sqlite3LocateTable(&sParse, 0, zTable, zDb); + tdsqlite3BtreeEnterAll(db); + pTab = tdsqlite3LocateTable(&sParse, 0, zTable, zDb); if( pTab && IsVirtual(pTab) ){ pTab = 0; - sqlite3ErrorMsg(&sParse, "cannot open virtual table: %s", zTable); + tdsqlite3ErrorMsg(&sParse, "cannot open virtual table: %s", zTable); } if( pTab && !HasRowid(pTab) ){ pTab = 0; - sqlite3ErrorMsg(&sParse, "cannot open table without rowid: %s", zTable); + tdsqlite3ErrorMsg(&sParse, "cannot open table without rowid: %s", zTable); } #ifndef SQLITE_OMIT_VIEW if( pTab && pTab->pSelect ){ pTab = 0; - sqlite3ErrorMsg(&sParse, "cannot open view: %s", zTable); + tdsqlite3ErrorMsg(&sParse, "cannot open view: %s", zTable); } #endif if( !pTab ){ if( sParse.zErrMsg ){ - sqlite3DbFree(db, zErr); + tdsqlite3DbFree(db, zErr); zErr = sParse.zErrMsg; sParse.zErrMsg = 0; } rc = SQLITE_ERROR; - sqlite3BtreeLeaveAll(db); + tdsqlite3BtreeLeaveAll(db); goto blob_open_out; } pBlob->pTab = pTab; - pBlob->zDb = db->aDb[sqlite3SchemaToIndex(db, pTab->pSchema)].zDbSName; + pBlob->zDb = db->aDb[tdsqlite3SchemaToIndex(db, pTab->pSchema)].zDbSName; /* Now search pTab for the exact column. */ for(iCol=0; iColnCol; iCol++) { - if( sqlite3StrICmp(pTab->aCol[iCol].zName, zColumn)==0 ){ + if( tdsqlite3StrICmp(pTab->aCol[iCol].zName, zColumn)==0 ){ break; } } if( iCol==pTab->nCol ){ - sqlite3DbFree(db, zErr); - zErr = sqlite3MPrintf(db, "no such column: \"%s\"", zColumn); + tdsqlite3DbFree(db, zErr); + zErr = tdsqlite3MPrintf(db, "no such column: \"%s\"", zColumn); rc = SQLITE_ERROR; - sqlite3BtreeLeaveAll(db); + tdsqlite3BtreeLeaveAll(db); goto blob_open_out; } @@ -97521,15 +97521,15 @@ SQLITE_API int sqlite3_blob_open( } } if( zFault ){ - sqlite3DbFree(db, zErr); - zErr = sqlite3MPrintf(db, "cannot open %s column for writing", zFault); + tdsqlite3DbFree(db, zErr); + zErr = tdsqlite3MPrintf(db, "cannot open %s column for writing", zFault); rc = SQLITE_ERROR; - sqlite3BtreeLeaveAll(db); + tdsqlite3BtreeLeaveAll(db); goto blob_open_out; } } - pBlob->pStmt = (sqlite3_stmt *)sqlite3VdbeCreate(&sParse); + pBlob->pStmt = (tdsqlite3_stmt *)tdsqlite3VdbeCreate(&sParse); assert( pBlob->pStmt || db->mallocFailed ); if( pBlob->pStmt ){ @@ -97544,7 +97544,7 @@ SQLITE_API int sqlite3_blob_open( ** uses it to implement the blob_read(), blob_write() and ** blob_bytes() functions. ** - ** The sqlite3_blob_close() function finalizes the vdbe program, + ** The tdsqlite3_blob_close() function finalizes the vdbe program, ** which closes the b-tree cursor and (possibly) commits the ** transaction. */ @@ -97559,18 +97559,18 @@ SQLITE_API int sqlite3_blob_open( {OP_Halt, 0, 0, 0}, /* 5 */ }; Vdbe *v = (Vdbe *)pBlob->pStmt; - int iDb = sqlite3SchemaToIndex(db, pTab->pSchema); + int iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); VdbeOp *aOp; - sqlite3VdbeAddOp4Int(v, OP_Transaction, iDb, wrFlag, + tdsqlite3VdbeAddOp4Int(v, OP_Transaction, iDb, wrFlag, pTab->pSchema->schema_cookie, pTab->pSchema->iGeneration); - sqlite3VdbeChangeP5(v, 1); - assert( sqlite3VdbeCurrentAddr(v)==2 || db->mallocFailed ); - aOp = sqlite3VdbeAddOpList(v, ArraySize(openBlob), openBlob, iLn); + tdsqlite3VdbeChangeP5(v, 1); + assert( tdsqlite3VdbeCurrentAddr(v)==2 || db->mallocFailed ); + aOp = tdsqlite3VdbeAddOpList(v, ArraySize(openBlob), openBlob, iLn); /* Make sure a mutex is held on the table to be accessed */ - sqlite3VdbeUsesBtree(v, iDb); + tdsqlite3VdbeUsesBtree(v, iDb); if( db->mallocFailed==0 ){ assert( aOp!=0 ); @@ -97581,7 +97581,7 @@ SQLITE_API int sqlite3_blob_open( aOp[0].p1 = iDb; aOp[0].p2 = pTab->tnum; aOp[0].p3 = wrFlag; - sqlite3VdbeChangeP4(v, 2, pTab->zName, P4_TRANSIENT); + tdsqlite3VdbeChangeP4(v, 2, pTab->zName, P4_TRANSIENT); } if( db->mallocFailed==0 ){ #endif @@ -97606,13 +97606,13 @@ SQLITE_API int sqlite3_blob_open( sParse.nVar = 0; sParse.nMem = 1; sParse.nTab = 1; - sqlite3VdbeMakeReady(v, &sParse); + tdsqlite3VdbeMakeReady(v, &sParse); } } pBlob->iCol = iCol; pBlob->db = db; - sqlite3BtreeLeaveAll(db); + tdsqlite3BtreeLeaveAll(db); if( db->mallocFailed ){ goto blob_open_out; } @@ -97621,35 +97621,35 @@ SQLITE_API int sqlite3_blob_open( blob_open_out: if( rc==SQLITE_OK && db->mallocFailed==0 ){ - *ppBlob = (sqlite3_blob *)pBlob; + *ppBlob = (tdsqlite3_blob *)pBlob; }else{ - if( pBlob && pBlob->pStmt ) sqlite3VdbeFinalize((Vdbe *)pBlob->pStmt); - sqlite3DbFree(db, pBlob); + if( pBlob && pBlob->pStmt ) tdsqlite3VdbeFinalize((Vdbe *)pBlob->pStmt); + tdsqlite3DbFree(db, pBlob); } - sqlite3ErrorWithMsg(db, rc, (zErr ? "%s" : 0), zErr); - sqlite3DbFree(db, zErr); - sqlite3ParserReset(&sParse); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); + tdsqlite3ErrorWithMsg(db, rc, (zErr ? "%s" : 0), zErr); + tdsqlite3DbFree(db, zErr); + tdsqlite3ParserReset(&sParse); + rc = tdsqlite3ApiExit(db, rc); + tdsqlite3_mutex_leave(db->mutex); return rc; } /* ** Close a blob handle that was previously created using -** sqlite3_blob_open(). +** tdsqlite3_blob_open(). */ -SQLITE_API int sqlite3_blob_close(sqlite3_blob *pBlob){ +SQLITE_API int tdsqlite3_blob_close(tdsqlite3_blob *pBlob){ Incrblob *p = (Incrblob *)pBlob; int rc; - sqlite3 *db; + tdsqlite3 *db; if( p ){ - sqlite3_stmt *pStmt = p->pStmt; + tdsqlite3_stmt *pStmt = p->pStmt; db = p->db; - sqlite3_mutex_enter(db->mutex); - sqlite3DbFree(db, p); - sqlite3_mutex_leave(db->mutex); - rc = sqlite3_finalize(pStmt); + tdsqlite3_mutex_enter(db->mutex); + tdsqlite3DbFree(db, p); + tdsqlite3_mutex_leave(db->mutex); + rc = tdsqlite3_finalize(pStmt); }else{ rc = SQLITE_OK; } @@ -97660,7 +97660,7 @@ SQLITE_API int sqlite3_blob_close(sqlite3_blob *pBlob){ ** Perform a read or write operation on a blob */ static int blobReadWrite( - sqlite3_blob *pBlob, + tdsqlite3_blob *pBlob, void *z, int n, int iOffset, @@ -97669,14 +97669,14 @@ static int blobReadWrite( int rc; Incrblob *p = (Incrblob *)pBlob; Vdbe *v; - sqlite3 *db; + tdsqlite3 *db; if( p==0 ) return SQLITE_MISUSE_BKPT; db = p->db; - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); v = (Vdbe*)p->pStmt; - if( n<0 || iOffset<0 || ((sqlite3_int64)iOffset+n)>p->nByte ){ + if( n<0 || iOffset<0 || ((tdsqlite3_int64)iOffset+n)>p->nByte ){ /* Request is out of range. Return a transient error. */ rc = SQLITE_ERROR; }else if( v==0 ){ @@ -97689,10 +97689,10 @@ static int blobReadWrite( ** returned, clean-up the statement handle. */ assert( db == v->db ); - sqlite3BtreeEnterCursor(p->pCsr); + tdsqlite3BtreeEnterCursor(p->pCsr); #ifdef SQLITE_ENABLE_PREUPDATE_HOOK - if( xCall==sqlite3BtreePutData && db->xPreUpdateCallback ){ + if( xCall==tdsqlite3BtreePutData && db->xPreUpdateCallback ){ /* If a pre-update hook is registered and this is a write cursor, ** invoke it here. ** @@ -97706,41 +97706,41 @@ static int blobReadWrite( ** using the incremental-blob API, this works. For the sessions module ** anyhow. */ - sqlite3_int64 iKey; - iKey = sqlite3BtreeIntegerKey(p->pCsr); - sqlite3VdbePreUpdateHook( + tdsqlite3_int64 iKey; + iKey = tdsqlite3BtreeIntegerKey(p->pCsr); + tdsqlite3VdbePreUpdateHook( v, v->apCsr[0], SQLITE_DELETE, p->zDb, p->pTab, iKey, -1 ); } #endif rc = xCall(p->pCsr, iOffset+p->iOffset, n, z); - sqlite3BtreeLeaveCursor(p->pCsr); + tdsqlite3BtreeLeaveCursor(p->pCsr); if( rc==SQLITE_ABORT ){ - sqlite3VdbeFinalize(v); + tdsqlite3VdbeFinalize(v); p->pStmt = 0; }else{ v->rc = rc; } } - sqlite3Error(db, rc); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); + tdsqlite3Error(db, rc); + rc = tdsqlite3ApiExit(db, rc); + tdsqlite3_mutex_leave(db->mutex); return rc; } /* ** Read data from a blob handle. */ -SQLITE_API int sqlite3_blob_read(sqlite3_blob *pBlob, void *z, int n, int iOffset){ - return blobReadWrite(pBlob, z, n, iOffset, sqlite3BtreePayloadChecked); +SQLITE_API int tdsqlite3_blob_read(tdsqlite3_blob *pBlob, void *z, int n, int iOffset){ + return blobReadWrite(pBlob, z, n, iOffset, tdsqlite3BtreePayloadChecked); } /* ** Write data to a blob handle. */ -SQLITE_API int sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, int n, int iOffset){ - return blobReadWrite(pBlob, (void *)z, n, iOffset, sqlite3BtreePutData); +SQLITE_API int tdsqlite3_blob_write(tdsqlite3_blob *pBlob, const void *z, int n, int iOffset){ + return blobReadWrite(pBlob, (void *)z, n, iOffset, tdsqlite3BtreePutData); } /* @@ -97749,7 +97749,7 @@ SQLITE_API int sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, int n, int ** The Incrblob.nByte field is fixed for the lifetime of the Incrblob ** so no mutex is required for access. */ -SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *pBlob){ +SQLITE_API int tdsqlite3_blob_bytes(tdsqlite3_blob *pBlob){ Incrblob *p = (Incrblob *)pBlob; return (p && p->pStmt) ? p->nByte : 0; } @@ -97761,17 +97761,17 @@ SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *pBlob){ ** If an error occurs, or if the specified row does not exist or does not ** contain a blob or text value, then an error code is returned and the ** database handle error code and message set. If this happens, then all -** subsequent calls to sqlite3_blob_xxx() functions (except blob_close()) +** subsequent calls to tdsqlite3_blob_xxx() functions (except blob_close()) ** immediately return SQLITE_ABORT. */ -SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){ +SQLITE_API int tdsqlite3_blob_reopen(tdsqlite3_blob *pBlob, tdsqlite3_int64 iRow){ int rc; Incrblob *p = (Incrblob *)pBlob; - sqlite3 *db; + tdsqlite3 *db; if( p==0 ) return SQLITE_MISUSE_BKPT; db = p->db; - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); if( p->pStmt==0 ){ /* If there is no statement handle, then the blob-handle has @@ -97782,15 +97782,15 @@ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){ char *zErr; rc = blobSeekToRow(p, iRow, &zErr); if( rc!=SQLITE_OK ){ - sqlite3ErrorWithMsg(db, rc, (zErr ? "%s" : 0), zErr); - sqlite3DbFree(db, zErr); + tdsqlite3ErrorWithMsg(db, rc, (zErr ? "%s" : 0), zErr); + tdsqlite3DbFree(db, zErr); } assert( rc!=SQLITE_SCHEMA ); } - rc = sqlite3ApiExit(db, rc); + rc = tdsqlite3ApiExit(db, rc); assert( rc==SQLITE_OK || p->pStmt==0 ); - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return rc; } @@ -97821,9 +97821,9 @@ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){ ** Here is the (internal, non-API) interface between this module and the ** rest of the SQLite system: ** -** sqlite3VdbeSorterInit() Create a new VdbeSorter object. +** tdsqlite3VdbeSorterInit() Create a new VdbeSorter object. ** -** sqlite3VdbeSorterWrite() Add a single new row to the VdbeSorter +** tdsqlite3VdbeSorterWrite() Add a single new row to the VdbeSorter ** object. The row is a binary blob in the ** OP_MakeRecord format that contains both ** the ORDER BY key columns and result columns @@ -97831,27 +97831,27 @@ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){ ** the complete record for an index entry ** in the case of a CREATE INDEX. ** -** sqlite3VdbeSorterRewind() Sort all content previously added. +** tdsqlite3VdbeSorterRewind() Sort all content previously added. ** Position the read cursor on the ** first sorted element. ** -** sqlite3VdbeSorterNext() Advance the read cursor to the next sorted +** tdsqlite3VdbeSorterNext() Advance the read cursor to the next sorted ** element. ** -** sqlite3VdbeSorterRowkey() Return the complete binary blob for the +** tdsqlite3VdbeSorterRowkey() Return the complete binary blob for the ** row currently under the read cursor. ** -** sqlite3VdbeSorterCompare() Compare the binary blob for the row +** tdsqlite3VdbeSorterCompare() Compare the binary blob for the row ** currently under the read cursor against ** another binary blob X and report if ** X is strictly less than the read cursor. ** Used to enforce uniqueness in a ** CREATE UNIQUE INDEX statement. ** -** sqlite3VdbeSorterClose() Close the VdbeSorter object and reclaim +** tdsqlite3VdbeSorterClose() Close the VdbeSorter object and reclaim ** all resources. ** -** sqlite3VdbeSorterReset() Refurbish the VdbeSorter for reuse. This +** tdsqlite3VdbeSorterReset() Refurbish the VdbeSorter for reuse. This ** is like Close() followed by Init() only ** much faster. ** @@ -97971,7 +97971,7 @@ typedef struct IncrMerger IncrMerger; /* Read & merge multiple PMAs */ ** stored in the file. */ struct SorterFile { - sqlite3_file *pFd; /* File handle */ + tdsqlite3_file *pFd; /* File handle */ i64 iEof; /* Bytes of data stored in pFd */ }; @@ -98084,7 +98084,7 @@ struct MergeEngine { ** to block until it finishes). ** ** 2. If SQLITE_DEBUG_SORTER_THREADS is defined, to determine if a call -** to sqlite3ThreadJoin() is likely to block. Cases that are likely to +** to tdsqlite3ThreadJoin() is likely to block. Cases that are likely to ** block provoke debugging output. ** ** In both cases, the effects of the main thread seeing (bDone==0) even @@ -98110,7 +98110,7 @@ struct SortSubtask { ** sorter cursor created by the VDBE. ** ** mxKeysize: -** As records are added to the sorter by calls to sqlite3VdbeSorterWrite(), +** As records are added to the sorter by calls to tdsqlite3VdbeSorterWrite(), ** this variable is updated so as to be set to the size on disk of the ** largest record in the sorter. */ @@ -98121,7 +98121,7 @@ struct VdbeSorter { int pgsz; /* Main database page size */ PmaReader *pReader; /* Readr data from here after Rewind() */ MergeEngine *pMerger; /* Or here, if bUseThreads==0 */ - sqlite3 *db; /* Database connection */ + tdsqlite3 *db; /* Database connection */ KeyInfo *pKeyInfo; /* How to compare records */ UnpackedRecord *pUnpacked; /* Used by VdbeSorterCompare() */ SorterList list; /* List of in-memory records */ @@ -98152,7 +98152,7 @@ struct PmaReader { i64 iEof; /* 1 byte past EOF for this PmaReader */ int nAlloc; /* Bytes of space at aAlloc */ int nKey; /* Number of bytes in key */ - sqlite3_file *pFd; /* File handle we are reading from */ + tdsqlite3_file *pFd; /* File handle we are reading from */ u8 *aAlloc; /* Space for aKey if aBuffer and pMap wont work */ u8 *aKey; /* Pointer to current key */ u8 *aBuffer; /* Current read buffer */ @@ -98218,7 +98218,7 @@ struct PmaWriter { int iBufStart; /* First byte of buffer to write */ int iBufEnd; /* Last byte of buffer to write */ i64 iWriteOff; /* Offset of start of buffer in file */ - sqlite3_file *pFd; /* File handle to write to */ + tdsqlite3_file *pFd; /* File handle to write to */ }; /* @@ -98233,7 +98233,7 @@ struct PmaWriter { ** Or, if using the single large allocation method (VdbeSorter.list.aMemory!=0), ** then while records are being accumulated the list is linked using the ** SorterRecord.u.iNext offset. This is because the aMemory[] array may -** be sqlite3Realloc()ed while records are being accumulated. Once the VM +** be tdsqlite3Realloc()ed while records are being accumulated. Once the VM ** has finished passing records to the sorter, or when the in-memory buffer ** is full, the list is sorted. As part of the sorting process, it is ** converted to use the SorterRecord.u.pNext pointers. See function @@ -98267,9 +98267,9 @@ static void vdbeIncrFree(IncrMerger *); ** argument. All structure fields are set to zero before returning. */ static void vdbePmaReaderClear(PmaReader *pReadr){ - sqlite3_free(pReadr->aAlloc); - sqlite3_free(pReadr->aBuffer); - if( pReadr->aMap ) sqlite3OsUnfetch(pReadr->pFd, 0, pReadr->aMap); + tdsqlite3_free(pReadr->aAlloc); + tdsqlite3_free(pReadr->aBuffer); + if( pReadr->aMap ) tdsqlite3OsUnfetch(pReadr->pFd, 0, pReadr->aMap); vdbeIncrFree(pReadr->pIncr); memset(pReadr, 0, sizeof(PmaReader)); } @@ -98305,7 +98305,7 @@ static int vdbePmaReadBlob( iBuf = p->iReadOff % p->nBuffer; if( iBuf==0 ){ int nRead; /* Bytes to read from disk */ - int rc; /* sqlite3OsRead() return code */ + int rc; /* tdsqlite3OsRead() return code */ /* Determine how many bytes of data to read. */ if( (p->iEof - p->iReadOff) > (i64)p->nBuffer ){ @@ -98316,7 +98316,7 @@ static int vdbePmaReadBlob( assert( nRead>0 ); /* Readr data from the file. Return early if an error occurs. */ - rc = sqlite3OsRead(p->pFd, p->aBuffer, nRead, p->iReadOff); + rc = tdsqlite3OsRead(p->pFd, p->aBuffer, nRead, p->iReadOff); assert( rc!=SQLITE_IOERR_SHORT_READ ); if( rc!=SQLITE_OK ) return rc; } @@ -98337,9 +98337,9 @@ static int vdbePmaReadBlob( /* Extend the p->aAlloc[] allocation if required. */ if( p->nAllocnAlloc); + tdsqlite3_int64 nNew = MAX(128, 2*(tdsqlite3_int64)p->nAlloc); while( nByte>nNew ) nNew = nNew*2; - aNew = sqlite3Realloc(p->aAlloc, nNew); + aNew = tdsqlite3Realloc(p->aAlloc, nNew); if( !aNew ) return SQLITE_NOMEM_BKPT; p->nAlloc = nNew; p->aAlloc = aNew; @@ -98381,11 +98381,11 @@ static int vdbePmaReadVarint(PmaReader *p, u64 *pnOut){ int iBuf; if( p->aMap ){ - p->iReadOff += sqlite3GetVarint(&p->aMap[p->iReadOff], pnOut); + p->iReadOff += tdsqlite3GetVarint(&p->aMap[p->iReadOff], pnOut); }else{ iBuf = p->iReadOff % p->nBuffer; if( iBuf && (p->nBuffer-iBuf)>=9 ){ - p->iReadOff += sqlite3GetVarint(&p->aBuffer[iBuf], pnOut); + p->iReadOff += tdsqlite3GetVarint(&p->aBuffer[iBuf], pnOut); }else{ u8 aVarint[16], *a; int i = 0, rc; @@ -98394,7 +98394,7 @@ static int vdbePmaReadVarint(PmaReader *p, u64 *pnOut){ if( rc ) return rc; aVarint[(i++)&0xf] = a[0]; }while( (a[0]&0x80)!=0 ); - sqlite3GetVarint(aVarint, pnOut); + tdsqlite3GetVarint(aVarint, pnOut); } } @@ -98413,9 +98413,9 @@ static int vdbePmaReadVarint(PmaReader *p, u64 *pnOut){ static int vdbeSorterMapFile(SortSubtask *pTask, SorterFile *pFile, u8 **pp){ int rc = SQLITE_OK; if( pFile->iEof<=(i64)(pTask->pSorter->db->nMaxSorterMmap) ){ - sqlite3_file *pFd = pFile->pFd; + tdsqlite3_file *pFd = pFile->pFd; if( pFd->pMethods->iVersion>=3 ){ - rc = sqlite3OsFetch(pFd, 0, (int)pFile->iEof, (void**)pp); + rc = tdsqlite3OsFetch(pFd, 0, (int)pFile->iEof, (void**)pp); testcase( rc!=SQLITE_OK ); } } @@ -98437,9 +98437,9 @@ static int vdbePmaReaderSeek( assert( pReadr->pIncr==0 || pReadr->pIncr->bEof==0 ); - if( sqlite3FaultSim(201) ) return SQLITE_IOERR_READ; + if( tdsqlite3FaultSim(201) ) return SQLITE_IOERR_READ; if( pReadr->aMap ){ - sqlite3OsUnfetch(pReadr->pFd, 0, pReadr->aMap); + tdsqlite3OsUnfetch(pReadr->pFd, 0, pReadr->aMap); pReadr->aMap = 0; } pReadr->iReadOff = iOff; @@ -98451,7 +98451,7 @@ static int vdbePmaReaderSeek( int pgsz = pTask->pSorter->pgsz; int iBuf = pReadr->iReadOff % pgsz; if( pReadr->aBuffer==0 ){ - pReadr->aBuffer = (u8*)sqlite3Malloc(pgsz); + pReadr->aBuffer = (u8*)tdsqlite3Malloc(pgsz); if( pReadr->aBuffer==0 ) rc = SQLITE_NOMEM_BKPT; pReadr->nBuffer = pgsz; } @@ -98460,7 +98460,7 @@ static int vdbePmaReaderSeek( if( (pReadr->iReadOff + nRead) > pReadr->iEof ){ nRead = (int)(pReadr->iEof - pReadr->iReadOff); } - rc = sqlite3OsRead( + rc = tdsqlite3OsRead( pReadr->pFd, &pReadr->aBuffer[iBuf], nRead, pReadr->iReadOff ); testcase( rc!=SQLITE_OK ); @@ -98562,10 +98562,10 @@ static int vdbeSorterCompareTail( ){ UnpackedRecord *r2 = pTask->pUnpacked; if( *pbKey2Cached==0 ){ - sqlite3VdbeRecordUnpack(pTask->pSorter->pKeyInfo, nKey2, pKey2, r2); + tdsqlite3VdbeRecordUnpack(pTask->pSorter->pKeyInfo, nKey2, pKey2, r2); *pbKey2Cached = 1; } - return sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, r2, 1); + return tdsqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, r2, 1); } /* @@ -98589,10 +98589,10 @@ static int vdbeSorterCompare( ){ UnpackedRecord *r2 = pTask->pUnpacked; if( !*pbKey2Cached ){ - sqlite3VdbeRecordUnpack(pTask->pSorter->pKeyInfo, nKey2, pKey2, r2); + tdsqlite3VdbeRecordUnpack(pTask->pSorter->pKeyInfo, nKey2, pKey2, r2); *pbKey2Cached = 1; } - return sqlite3VdbeRecordCompare(nKey1, pKey1, r2); + return tdsqlite3VdbeRecordCompare(nKey1, pKey1, r2); } /* @@ -98725,8 +98725,8 @@ static int vdbeSorterCompareInt( ** ** SQLITE_OK is returned if successful, or an SQLite error code otherwise. */ -SQLITE_PRIVATE int sqlite3VdbeSorterInit( - sqlite3 *db, /* Database connection (for malloc()) */ +SQLITE_PRIVATE int tdsqlite3VdbeSorterInit( + tdsqlite3 *db, /* Database connection (for malloc()) */ int nField, /* Number of key fields in each record */ VdbeCursor *pCsr /* Cursor that holds the new sorter */ ){ @@ -98745,7 +98745,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit( /* Initialize the upper limit on the number of worker threads */ #if SQLITE_MAX_WORKER_THREADS>0 - if( sqlite3TempInMemory(db) || sqlite3GlobalConfig.bCoreMutex==0 ){ + if( tdsqlite3TempInMemory(db) || tdsqlite3GlobalConfig.bCoreMutex==0 ){ nWorker = 0; }else{ nWorker = db->aLimit[SQLITE_LIMIT_WORKER_THREADS]; @@ -98765,7 +98765,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit( szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*); sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask); - pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo); + pSorter = (VdbeSorter*)tdsqlite3DbMallocZero(db, sz + szKeyInfo); pCsr->uc.pSorter = pSorter; if( pSorter==0 ){ rc = SQLITE_NOMEM_BKPT; @@ -98776,7 +98776,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit( if( nField && nWorker==0 ){ pKeyInfo->nKeyField = nField; } - pSorter->pgsz = pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt); + pSorter->pgsz = pgsz = tdsqlite3BtreeGetPageSize(db->aDb[0].pBt); pSorter->nTask = nWorker + 1; pSorter->iPrev = (u8)(nWorker - 1); pSorter->bUseThreads = (pSorter->nTask>1); @@ -98786,9 +98786,9 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit( pTask->pSorter = pSorter; } - if( !sqlite3TempInMemory(db) ){ + if( !tdsqlite3TempInMemory(db) ){ i64 mxCache; /* Cache size in bytes*/ - u32 szPma = sqlite3GlobalConfig.szPma; + u32 szPma = tdsqlite3GlobalConfig.szPma; pSorter->mnPmaSize = szPma * pgsz; mxCache = db->aDb[0].pSchema->cache_size; @@ -98804,10 +98804,10 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit( /* Avoid large memory allocations if the application has requested ** SQLITE_CONFIG_SMALL_MALLOC. */ - if( sqlite3GlobalConfig.bSmallMalloc==0 ){ + if( tdsqlite3GlobalConfig.bSmallMalloc==0 ){ assert( pSorter->iMemory==0 ); pSorter->nMemory = pgsz; - pSorter->list.aMemory = (u8*)sqlite3Malloc(pgsz); + pSorter->list.aMemory = (u8*)tdsqlite3Malloc(pgsz); if( !pSorter->list.aMemory ) rc = SQLITE_NOMEM_BKPT; } } @@ -98827,12 +98827,12 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit( /* ** Free the list of sorted records starting at pRecord. */ -static void vdbeSorterRecordFree(sqlite3 *db, SorterRecord *pRecord){ +static void vdbeSorterRecordFree(tdsqlite3 *db, SorterRecord *pRecord){ SorterRecord *p; SorterRecord *pNext; for(p=pRecord; p; p=pNext){ pNext = p->u.pNext; - sqlite3DbFree(db, p); + tdsqlite3DbFree(db, p); } } @@ -98840,13 +98840,13 @@ static void vdbeSorterRecordFree(sqlite3 *db, SorterRecord *pRecord){ ** Free all resources owned by the object indicated by argument pTask. All ** fields of *pTask are zeroed before returning. */ -static void vdbeSortSubtaskCleanup(sqlite3 *db, SortSubtask *pTask){ - sqlite3DbFree(db, pTask->pUnpacked); +static void vdbeSortSubtaskCleanup(tdsqlite3 *db, SortSubtask *pTask){ + tdsqlite3DbFree(db, pTask->pUnpacked); #if SQLITE_MAX_WORKER_THREADS>0 /* pTask->list.aMemory can only be non-zero if it was handed memory ** from the main thread. That only occurs SQLITE_MAX_WORKER_THREADS>0 */ if( pTask->list.aMemory ){ - sqlite3_free(pTask->list.aMemory); + tdsqlite3_free(pTask->list.aMemory); }else #endif { @@ -98854,10 +98854,10 @@ static void vdbeSortSubtaskCleanup(sqlite3 *db, SortSubtask *pTask){ vdbeSorterRecordFree(0, pTask->list.pList); } if( pTask->file.pFd ){ - sqlite3OsCloseFree(pTask->file.pFd); + tdsqlite3OsCloseFree(pTask->file.pFd); } if( pTask->file2.pFd ){ - sqlite3OsCloseFree(pTask->file2.pFd); + tdsqlite3OsCloseFree(pTask->file2.pFd); } memset(pTask, 0, sizeof(SortSubtask)); } @@ -98866,12 +98866,12 @@ static void vdbeSortSubtaskCleanup(sqlite3 *db, SortSubtask *pTask){ static void vdbeSorterWorkDebug(SortSubtask *pTask, const char *zEvent){ i64 t; int iTask = (pTask - pTask->pSorter->aTask); - sqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t); + tdsqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t); fprintf(stderr, "%lld:%d %s\n", t, iTask, zEvent); } static void vdbeSorterRewindDebug(const char *zEvent){ i64 t; - sqlite3OsCurrentTimeInt64(sqlite3_vfs_find(0), &t); + tdsqlite3OsCurrentTimeInt64(tdsqlite3_vfs_find(0), &t); fprintf(stderr, "%lld:X %s\n", t, zEvent); } static void vdbeSorterPopulateDebug( @@ -98880,7 +98880,7 @@ static void vdbeSorterPopulateDebug( ){ i64 t; int iTask = (pTask - pTask->pSorter->aTask); - sqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t); + tdsqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t); fprintf(stderr, "%lld:bg%d %s\n", t, iTask, zEvent); } static void vdbeSorterBlockDebug( @@ -98890,7 +98890,7 @@ static void vdbeSorterBlockDebug( ){ if( bBlocked ){ i64 t; - sqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t); + tdsqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t); fprintf(stderr, "%lld:main %s\n", t, zEvent); } } @@ -98913,7 +98913,7 @@ static int vdbeSorterJoinThread(SortSubtask *pTask){ #endif void *pRet = SQLITE_INT_TO_PTR(SQLITE_ERROR); vdbeSorterBlockDebug(pTask, !bDone, "enter"); - (void)sqlite3ThreadJoin(pTask->pThread, &pRet); + (void)tdsqlite3ThreadJoin(pTask->pThread, &pRet); vdbeSorterBlockDebug(pTask, !bDone, "exit"); rc = SQLITE_PTR_TO_INT(pRet); assert( pTask->bDone==1 ); @@ -98932,7 +98932,7 @@ static int vdbeSorterCreateThread( void *pIn /* Argument passed into xTask() */ ){ assert( pTask->pThread==0 && pTask->bDone==0 ); - return sqlite3ThreadCreate(&pTask->pThread, xTask, pIn); + return tdsqlite3ThreadCreate(&pTask->pThread, xTask, pIn); } /* @@ -98979,7 +98979,7 @@ static MergeEngine *vdbeMergeEngineNew(int nReader){ while( NnTree = N; pNew->pTask = 0; @@ -98999,7 +98999,7 @@ static void vdbeMergeEngineFree(MergeEngine *pMerger){ vdbePmaReaderClear(&pMerger->aReadr[i]); } } - sqlite3_free(pMerger); + tdsqlite3_free(pMerger); } /* @@ -99011,26 +99011,26 @@ static void vdbeIncrFree(IncrMerger *pIncr){ #if SQLITE_MAX_WORKER_THREADS>0 if( pIncr->bUseThread ){ vdbeSorterJoinThread(pIncr->pTask); - if( pIncr->aFile[0].pFd ) sqlite3OsCloseFree(pIncr->aFile[0].pFd); - if( pIncr->aFile[1].pFd ) sqlite3OsCloseFree(pIncr->aFile[1].pFd); + if( pIncr->aFile[0].pFd ) tdsqlite3OsCloseFree(pIncr->aFile[0].pFd); + if( pIncr->aFile[1].pFd ) tdsqlite3OsCloseFree(pIncr->aFile[1].pFd); } #endif vdbeMergeEngineFree(pIncr->pMerger); - sqlite3_free(pIncr); + tdsqlite3_free(pIncr); } } /* ** Reset a sorting cursor back to its original empty state. */ -SQLITE_PRIVATE void sqlite3VdbeSorterReset(sqlite3 *db, VdbeSorter *pSorter){ +SQLITE_PRIVATE void tdsqlite3VdbeSorterReset(tdsqlite3 *db, VdbeSorter *pSorter){ int i; (void)vdbeSorterJoinAll(pSorter, SQLITE_OK); assert( pSorter->bUseThreads || pSorter->pReader==0 ); #if SQLITE_MAX_WORKER_THREADS>0 if( pSorter->pReader ){ vdbePmaReaderClear(pSorter->pReader); - sqlite3DbFree(db, pSorter->pReader); + tdsqlite3DbFree(db, pSorter->pReader); pSorter->pReader = 0; } #endif @@ -99049,21 +99049,21 @@ SQLITE_PRIVATE void sqlite3VdbeSorterReset(sqlite3 *db, VdbeSorter *pSorter){ pSorter->bUsePMA = 0; pSorter->iMemory = 0; pSorter->mxKeysize = 0; - sqlite3DbFree(db, pSorter->pUnpacked); + tdsqlite3DbFree(db, pSorter->pUnpacked); pSorter->pUnpacked = 0; } /* -** Free any cursor components allocated by sqlite3VdbeSorterXXX routines. +** Free any cursor components allocated by tdsqlite3VdbeSorterXXX routines. */ -SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *db, VdbeCursor *pCsr){ +SQLITE_PRIVATE void tdsqlite3VdbeSorterClose(tdsqlite3 *db, VdbeCursor *pCsr){ VdbeSorter *pSorter; assert( pCsr->eCurType==CURTYPE_SORTER ); pSorter = pCsr->uc.pSorter; if( pSorter ){ - sqlite3VdbeSorterReset(db, pSorter); - sqlite3_free(pSorter->list.aMemory); - sqlite3DbFree(db, pSorter); + tdsqlite3VdbeSorterReset(db, pSorter); + tdsqlite3_free(pSorter->list.aMemory); + tdsqlite3DbFree(db, pSorter); pCsr->uc.pSorter = 0; } } @@ -99078,14 +99078,14 @@ SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *db, VdbeCursor *pCsr){ ** Whether or not the file does end up memory mapped of course depends on ** the specific VFS implementation. */ -static void vdbeSorterExtendFile(sqlite3 *db, sqlite3_file *pFd, i64 nByte){ +static void vdbeSorterExtendFile(tdsqlite3 *db, tdsqlite3_file *pFd, i64 nByte){ if( nByte<=(i64)(db->nMaxSorterMmap) && pFd->pMethods->iVersion>=3 ){ void *p = 0; int chunksize = 4*1024; - sqlite3OsFileControlHint(pFd, SQLITE_FCNTL_CHUNK_SIZE, &chunksize); - sqlite3OsFileControlHint(pFd, SQLITE_FCNTL_SIZE_HINT, &nByte); - sqlite3OsFetch(pFd, 0, (int)nByte, &p); - sqlite3OsUnfetch(pFd, 0, p); + tdsqlite3OsFileControlHint(pFd, SQLITE_FCNTL_CHUNK_SIZE, &chunksize); + tdsqlite3OsFileControlHint(pFd, SQLITE_FCNTL_SIZE_HINT, &nByte); + tdsqlite3OsFetch(pFd, 0, (int)nByte, &p); + tdsqlite3OsUnfetch(pFd, 0, p); } } #else @@ -99098,20 +99098,20 @@ static void vdbeSorterExtendFile(sqlite3 *db, sqlite3_file *pFd, i64 nByte){ ** Otherwise, set *ppFd to 0 and return an SQLite error code. */ static int vdbeSorterOpenTempFile( - sqlite3 *db, /* Database handle doing sort */ + tdsqlite3 *db, /* Database handle doing sort */ i64 nExtend, /* Attempt to extend file to this size */ - sqlite3_file **ppFd + tdsqlite3_file **ppFd ){ int rc; - if( sqlite3FaultSim(202) ) return SQLITE_IOERR_ACCESS; - rc = sqlite3OsOpenMalloc(db->pVfs, 0, ppFd, + if( tdsqlite3FaultSim(202) ) return SQLITE_IOERR_ACCESS; + rc = tdsqlite3OsOpenMalloc(db->pVfs, 0, ppFd, SQLITE_OPEN_TEMP_JOURNAL | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE, &rc ); if( rc==SQLITE_OK ){ i64 max = SQLITE_MAX_MMAP_SIZE; - sqlite3OsFileControlHint(*ppFd, SQLITE_FCNTL_MMAP_SIZE, (void*)&max); + tdsqlite3OsFileControlHint(*ppFd, SQLITE_FCNTL_MMAP_SIZE, (void*)&max); if( nExtend>0 ){ vdbeSorterExtendFile(db, *ppFd, nExtend); } @@ -99126,7 +99126,7 @@ static int vdbeSorterOpenTempFile( */ static int vdbeSortAllocUnpacked(SortSubtask *pTask){ if( pTask->pUnpacked==0 ){ - pTask->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pTask->pSorter->pKeyInfo); + pTask->pUnpacked = tdsqlite3VdbeAllocUnpackedRecord(pTask->pSorter->pKeyInfo); if( pTask->pUnpacked==0 ) return SQLITE_NOMEM_BKPT; pTask->pUnpacked->nField = pTask->pSorter->pKeyInfo->nKeyField; pTask->pUnpacked->errCode = 0; @@ -99213,7 +99213,7 @@ static int vdbeSorterSort(SortSubtask *pTask, SorterList *pList){ if( (u8*)p==pList->aMemory ){ pNext = 0; }else{ - assert( p->u.iNextaMemory) ); + assert( p->u.iNextaMemory) ); pNext = (SorterRecord*)&pList->aMemory[p->u.iNext]; } }else{ @@ -99246,13 +99246,13 @@ static int vdbeSorterSort(SortSubtask *pTask, SorterList *pList){ ** Initialize a PMA-writer object. */ static void vdbePmaWriterInit( - sqlite3_file *pFd, /* File handle to write to */ + tdsqlite3_file *pFd, /* File handle to write to */ PmaWriter *p, /* Object to populate */ int nBuf, /* Buffer size */ i64 iStart /* Offset of pFd to begin writing at */ ){ memset(p, 0, sizeof(PmaWriter)); - p->aBuffer = (u8*)sqlite3Malloc(nBuf); + p->aBuffer = (u8*)tdsqlite3Malloc(nBuf); if( !p->aBuffer ){ p->eFWErr = SQLITE_NOMEM_BKPT; }else{ @@ -99278,7 +99278,7 @@ static void vdbePmaWriteBlob(PmaWriter *p, u8 *pData, int nData){ memcpy(&p->aBuffer[p->iBufEnd], &pData[nData-nRem], nCopy); p->iBufEnd += nCopy; if( p->iBufEnd==p->nBuffer ){ - p->eFWErr = sqlite3OsWrite(p->pFd, + p->eFWErr = tdsqlite3OsWrite(p->pFd, &p->aBuffer[p->iBufStart], p->iBufEnd - p->iBufStart, p->iWriteOff + p->iBufStart ); @@ -99303,13 +99303,13 @@ static void vdbePmaWriteBlob(PmaWriter *p, u8 *pData, int nData){ static int vdbePmaWriterFinish(PmaWriter *p, i64 *piEof){ int rc; if( p->eFWErr==0 && ALWAYS(p->aBuffer) && p->iBufEnd>p->iBufStart ){ - p->eFWErr = sqlite3OsWrite(p->pFd, + p->eFWErr = tdsqlite3OsWrite(p->pFd, &p->aBuffer[p->iBufStart], p->iBufEnd - p->iBufStart, p->iWriteOff + p->iBufStart ); } *piEof = (p->iWriteOff + p->iBufEnd); - sqlite3_free(p->aBuffer); + tdsqlite3_free(p->aBuffer); rc = p->eFWErr; memset(p, 0, sizeof(PmaWriter)); return rc; @@ -99322,7 +99322,7 @@ static int vdbePmaWriterFinish(PmaWriter *p, i64 *piEof){ static void vdbePmaWriteVarint(PmaWriter *p, u64 iVal){ int nByte; u8 aByte[10]; - nByte = sqlite3PutVarint(aByte, iVal); + nByte = tdsqlite3PutVarint(aByte, iVal); vdbePmaWriteBlob(p, aByte, nByte); } @@ -99341,14 +99341,14 @@ static void vdbePmaWriteVarint(PmaWriter *p, u64 iVal){ ** key). The varint is the number of bytes in the blob of data. */ static int vdbeSorterListToPMA(SortSubtask *pTask, SorterList *pList){ - sqlite3 *db = pTask->pSorter->db; + tdsqlite3 *db = pTask->pSorter->db; int rc = SQLITE_OK; /* Return code */ PmaWriter writer; /* Object used to write to the file */ #ifdef SQLITE_DEBUG /* Set iSz to the expected size of file pTask->file after writing the PMA. ** This is used by an assert() statement at the end of this function. */ - i64 iSz = pList->szPMA + sqlite3VarintLen(pList->szPMA) + pTask->file.iEof; + i64 iSz = pList->szPMA + tdsqlite3VarintLen(pList->szPMA) + pTask->file.iEof; #endif vdbeSorterWorkDebug(pTask, "enter"); @@ -99385,7 +99385,7 @@ static int vdbeSorterListToPMA(SortSubtask *pTask, SorterList *pList){ pNext = p->u.pNext; vdbePmaWriteVarint(&writer, p->nVal); vdbePmaWriteBlob(&writer, SRVAL(p), p->nVal); - if( pList->aMemory==0 ) sqlite3_free(p); + if( pList->aMemory==0 ) tdsqlite3_free(p); } pList->pList = p; rc = vdbePmaWriterFinish(&writer, &pTask->file.iEof); @@ -99542,9 +99542,9 @@ static int vdbeSorterFlushPMA(VdbeSorter *pSorter){ pSorter->list.szPMA = 0; if( aMem ){ pSorter->list.aMemory = aMem; - pSorter->nMemory = sqlite3MallocSize(aMem); + pSorter->nMemory = tdsqlite3MallocSize(aMem); }else if( pSorter->list.aMemory ){ - pSorter->list.aMemory = sqlite3Malloc(pSorter->nMemory); + pSorter->list.aMemory = tdsqlite3Malloc(pSorter->nMemory); if( !pSorter->list.aMemory ) return SQLITE_NOMEM_BKPT; } @@ -99559,7 +99559,7 @@ static int vdbeSorterFlushPMA(VdbeSorter *pSorter){ /* ** Add a record to the sorter. */ -SQLITE_PRIVATE int sqlite3VdbeSorterWrite( +SQLITE_PRIVATE int tdsqlite3VdbeSorterWrite( const VdbeCursor *pCsr, /* Sorter cursor */ Mem *pVal /* Memory cell containing record */ ){ @@ -99598,17 +99598,17 @@ SQLITE_PRIVATE int sqlite3VdbeSorterWrite( ** than (page-size * cache-size), or ** ** * The total memory allocated for the in-memory list is greater - ** than (page-size * 10) and sqlite3HeapNearlyFull() returns true. + ** than (page-size * 10) and tdsqlite3HeapNearlyFull() returns true. */ nReq = pVal->n + sizeof(SorterRecord); - nPMA = pVal->n + sqlite3VarintLen(pVal->n); + nPMA = pVal->n + tdsqlite3VarintLen(pVal->n); if( pSorter->mxPmaSize ){ if( pSorter->list.aMemory ){ bFlush = pSorter->iMemory && (pSorter->iMemory+nReq) > pSorter->mxPmaSize; }else{ bFlush = ( (pSorter->list.szPMA > pSorter->mxPmaSize) - || (pSorter->list.szPMA > pSorter->mnPmaSize && sqlite3HeapNearlyFull()) + || (pSorter->list.szPMA > pSorter->mnPmaSize && tdsqlite3HeapNearlyFull()) ); } if( bFlush ){ @@ -99629,7 +99629,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterWrite( if( nMin>pSorter->nMemory ){ u8 *aNew; - sqlite3_int64 nNew = 2 * (sqlite3_int64)pSorter->nMemory; + tdsqlite3_int64 nNew = 2 * (tdsqlite3_int64)pSorter->nMemory; int iListOff = -1; if( pSorter->list.pList ){ iListOff = (u8*)pSorter->list.pList - pSorter->list.aMemory; @@ -99637,7 +99637,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterWrite( while( nNew < nMin ) nNew = nNew*2; if( nNew > pSorter->mxPmaSize ) nNew = pSorter->mxPmaSize; if( nNew < nMin ) nNew = nMin; - aNew = sqlite3Realloc(pSorter->list.aMemory, nNew); + aNew = tdsqlite3Realloc(pSorter->list.aMemory, nNew); if( !aNew ) return SQLITE_NOMEM_BKPT; if( iListOff>=0 ){ pSorter->list.pList = (SorterRecord*)&aNew[iListOff]; @@ -99652,7 +99652,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterWrite( pNew->u.iNext = (int)((u8*)(pSorter->list.pList) - pSorter->list.aMemory); } }else{ - pNew = (SorterRecord *)sqlite3Malloc(nReq); + pNew = (SorterRecord *)tdsqlite3Malloc(nReq); if( pNew==0 ){ return SQLITE_NOMEM_BKPT; } @@ -99693,7 +99693,7 @@ static int vdbeIncrPopulate(IncrMerger *pIncr){ /* Check if the output file is full or if the input has been exhausted. ** In either case exit the loop. */ if( pReader->pFd==0 ) break; - if( (iEof + nKey + sqlite3VarintLen(nKey))>(iStart + pIncr->mxSz) ) break; + if( (iEof + nKey + tdsqlite3VarintLen(nKey))>(iStart + pIncr->mxSz) ) break; /* Write the next key to the output. */ vdbePmaWriteVarint(&writer, nKey); @@ -99793,7 +99793,7 @@ static int vdbeIncrMergerNew( ){ int rc = SQLITE_OK; IncrMerger *pIncr = *ppOut = (IncrMerger*) - (sqlite3FaultSim(100) ? 0 : sqlite3MallocZero(sizeof(*pIncr))); + (tdsqlite3FaultSim(100) ? 0 : tdsqlite3MallocZero(sizeof(*pIncr))); if( pIncr ){ pIncr->pMerger = pMerger; pIncr->pTask = pTask; @@ -99985,7 +99985,7 @@ static int vdbePmaReaderIncrMergeInit(PmaReader *pReadr, int eMode){ int rc = SQLITE_OK; IncrMerger *pIncr = pReadr->pIncr; SortSubtask *pTask = pIncr->pTask; - sqlite3 *db = pTask->pSorter->db; + tdsqlite3 *db = pTask->pSorter->db; /* eMode is always INCRINIT_NORMAL in single-threaded mode */ assert( SQLITE_MAX_WORKER_THREADS>0 || eMode==INCRINIT_NORMAL ); @@ -100283,7 +100283,7 @@ static int vdbeSorterMergeTreeBuild( } /* -** This function is called as part of an sqlite3VdbeSorterRewind() operation +** This function is called as part of an tdsqlite3VdbeSorterRewind() operation ** on a sorter that has written two or more PMAs to temporary files. It sets ** up either VdbeSorter.pMerger (for single threaded sorters) or pReader ** (for multi-threaded sorters) so that it can be used to iterate through @@ -100296,7 +100296,7 @@ static int vdbeSorterSetupMerge(VdbeSorter *pSorter){ SortSubtask *pTask0 = &pSorter->aTask[0]; MergeEngine *pMain = 0; #if SQLITE_MAX_WORKER_THREADS - sqlite3 *db = pTask0->pSorter->db; + tdsqlite3 *db = pTask0->pSorter->db; int i; SorterCompare xCompare = vdbeSorterGetCompare(pSorter); for(i=0; inTask; i++){ @@ -100314,7 +100314,7 @@ static int vdbeSorterSetupMerge(VdbeSorter *pSorter){ SortSubtask *pLast = &pSorter->aTask[pSorter->nTask-1]; rc = vdbeSortAllocUnpacked(pLast); if( rc==SQLITE_OK ){ - pReadr = (PmaReader*)sqlite3DbMallocZero(db, sizeof(PmaReader)); + pReadr = (PmaReader*)tdsqlite3DbMallocZero(db, sizeof(PmaReader)); pSorter->pReader = pReadr; if( pReadr==0 ) rc = SQLITE_NOMEM_BKPT; } @@ -100369,11 +100369,11 @@ static int vdbeSorterSetupMerge(VdbeSorter *pSorter){ /* -** Once the sorter has been populated by calls to sqlite3VdbeSorterWrite, +** Once the sorter has been populated by calls to tdsqlite3VdbeSorterWrite, ** this function is called to prepare for iterating through the records ** in sorted order. */ -SQLITE_PRIVATE int sqlite3VdbeSorterRewind(const VdbeCursor *pCsr, int *pbEof){ +SQLITE_PRIVATE int tdsqlite3VdbeSorterRewind(const VdbeCursor *pCsr, int *pbEof){ VdbeSorter *pSorter; int rc = SQLITE_OK; /* Return code */ @@ -100425,7 +100425,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterRewind(const VdbeCursor *pCsr, int *pbEof){ ** SQLITE_DONE end of data ** otherwise some kind of error. */ -SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *pCsr){ +SQLITE_PRIVATE int tdsqlite3VdbeSorterNext(tdsqlite3 *db, const VdbeCursor *pCsr){ VdbeSorter *pSorter; int rc; /* Return code */ @@ -100490,14 +100490,14 @@ static void *vdbeSorterRowkey( /* ** Copy the current sorter key into the memory cell pOut. */ -SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *pCsr, Mem *pOut){ +SQLITE_PRIVATE int tdsqlite3VdbeSorterRowkey(const VdbeCursor *pCsr, Mem *pOut){ VdbeSorter *pSorter; void *pKey; int nKey; /* Sorter key to copy into pOut */ assert( pCsr->eCurType==CURTYPE_SORTER ); pSorter = pCsr->uc.pSorter; pKey = vdbeSorterRowkey(pSorter, &nKey); - if( sqlite3VdbeMemClearAndResize(pOut, nKey) ){ + if( tdsqlite3VdbeMemClearAndResize(pOut, nKey) ){ return SQLITE_NOMEM_BKPT; } pOut->n = nKey; @@ -100523,7 +100523,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *pCsr, Mem *pOut){ ** This routine forms the core of the OP_SorterCompare opcode, which in ** turn is used to verify uniqueness when constructing a UNIQUE INDEX. */ -SQLITE_PRIVATE int sqlite3VdbeSorterCompare( +SQLITE_PRIVATE int tdsqlite3VdbeSorterCompare( const VdbeCursor *pCsr, /* Sorter cursor */ Mem *pVal, /* Value to compare to current sorter key */ int nKeyCol, /* Compare this many columns */ @@ -100540,14 +100540,14 @@ SQLITE_PRIVATE int sqlite3VdbeSorterCompare( r2 = pSorter->pUnpacked; pKeyInfo = pCsr->pKeyInfo; if( r2==0 ){ - r2 = pSorter->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pKeyInfo); + r2 = pSorter->pUnpacked = tdsqlite3VdbeAllocUnpackedRecord(pKeyInfo); if( r2==0 ) return SQLITE_NOMEM_BKPT; r2->nField = nKeyCol; } assert( r2->nField==nKeyCol ); pKey = vdbeSorterRowkey(pSorter, &nKey); - sqlite3VdbeRecordUnpack(pKeyInfo, nKey, pKey, r2); + tdsqlite3VdbeRecordUnpack(pKeyInfo, nKey, pKey, r2); for(i=0; iaMem[i].flags & MEM_Null ){ *pRes = -1; @@ -100555,7 +100555,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterCompare( } } - *pRes = sqlite3VdbeRecordCompare(pVal->n, pVal->z, r2); + *pRes = tdsqlite3VdbeRecordCompare(pVal->n, pVal->z, r2); return SQLITE_OK; } @@ -100620,16 +100620,16 @@ struct FileChunk { ** The cursor can be either for reading or writing. */ struct FilePoint { - sqlite3_int64 iOffset; /* Offset from the beginning of the file */ + tdsqlite3_int64 iOffset; /* Offset from the beginning of the file */ FileChunk *pChunk; /* Specific chunk into which cursor points */ }; /* -** This structure is a subclass of sqlite3_file. Each open memory-journal +** This structure is a subclass of tdsqlite3_file. Each open memory-journal ** is an instance of this class. */ struct MemJournal { - const sqlite3_io_methods *pMethod; /* Parent class. MUST BE FIRST */ + const tdsqlite3_io_methods *pMethod; /* Parent class. MUST BE FIRST */ int nChunkSize; /* In-memory chunk-size */ int nSpill; /* Bytes of data before flushing */ @@ -100639,16 +100639,16 @@ struct MemJournal { FilePoint readpoint; /* Pointer to the end of the last xRead() */ int flags; /* xOpen flags */ - sqlite3_vfs *pVfs; /* The "real" underlying VFS */ + tdsqlite3_vfs *pVfs; /* The "real" underlying VFS */ const char *zJournal; /* Name of the journal file */ }; /* ** Read data from the in-memory journal file. This is the implementation -** of the sqlite3_vfs.xRead method. +** of the tdsqlite3_vfs.xRead method. */ static int memjrnlRead( - sqlite3_file *pJfd, /* The journal file from which to read */ + tdsqlite3_file *pJfd, /* The journal file from which to read */ void *zBuf, /* Put the results here */ int iAmt, /* Number of bytes to read */ sqlite_int64 iOfst /* Begin reading at this offset */ @@ -100664,7 +100664,7 @@ static int memjrnlRead( } assert( p->readpoint.iOffset==0 || p->readpoint.pChunk!=0 ); if( p->readpoint.iOffset!=iOfst || iOfst==0 ){ - sqlite3_int64 iOff = 0; + tdsqlite3_int64 iOff = 0; for(pChunk=p->pFirst; ALWAYS(pChunk) && (iOff+p->nChunkSize)<=iOfst; pChunk=pChunk->pNext @@ -100699,7 +100699,7 @@ static void memjrnlFreeChunks(MemJournal *p){ FileChunk *pNext; for(pIter=p->pFirst; pIter; pIter=pNext){ pNext = pIter->pNext; - sqlite3_free(pIter); + tdsqlite3_free(pIter); } p->pFirst = 0; } @@ -100709,11 +100709,11 @@ static void memjrnlFreeChunks(MemJournal *p){ */ static int memjrnlCreateFile(MemJournal *p){ int rc; - sqlite3_file *pReal = (sqlite3_file*)p; + tdsqlite3_file *pReal = (tdsqlite3_file*)p; MemJournal copy = *p; memset(p, 0, sizeof(MemJournal)); - rc = sqlite3OsOpen(copy.pVfs, copy.zJournal, pReal, copy.flags, 0); + rc = tdsqlite3OsOpen(copy.pVfs, copy.zJournal, pReal, copy.flags, 0); if( rc==SQLITE_OK ){ int nChunk = copy.nChunkSize; i64 iOff = 0; @@ -100722,7 +100722,7 @@ static int memjrnlCreateFile(MemJournal *p){ if( iOff + nChunk > copy.endpoint.iOffset ){ nChunk = copy.endpoint.iOffset - iOff; } - rc = sqlite3OsWrite(pReal, (u8*)pIter->zChunk, nChunk, iOff); + rc = tdsqlite3OsWrite(pReal, (u8*)pIter->zChunk, nChunk, iOff); if( rc ) break; iOff += nChunk; } @@ -100736,7 +100736,7 @@ static int memjrnlCreateFile(MemJournal *p){ ** the original before returning. This way, SQLite uses the in-memory ** journal data to roll back changes made to the internal page-cache ** before this function was called. */ - sqlite3OsClose(pReal); + tdsqlite3OsClose(pReal); *p = copy; } return rc; @@ -100747,7 +100747,7 @@ static int memjrnlCreateFile(MemJournal *p){ ** Write data to the file. */ static int memjrnlWrite( - sqlite3_file *pJfd, /* The journal file into which to write */ + tdsqlite3_file *pJfd, /* The journal file into which to write */ const void *zBuf, /* Take data to be written from here */ int iAmt, /* Number of bytes to write */ sqlite_int64 iOfst /* Begin writing at this offset into the file */ @@ -100761,7 +100761,7 @@ static int memjrnlWrite( if( p->nSpill>0 && (iAmt+iOfst)>p->nSpill ){ int rc = memjrnlCreateFile(p); if( rc==SQLITE_OK ){ - rc = sqlite3OsWrite(pJfd, zBuf, iAmt, iOfst); + rc = tdsqlite3OsWrite(pJfd, zBuf, iAmt, iOfst); } return rc; } @@ -100791,7 +100791,7 @@ static int memjrnlWrite( if( iChunkOffset==0 ){ /* New chunk is required to extend the file. */ - FileChunk *pNew = sqlite3_malloc(fileChunkSize(p->nChunkSize)); + FileChunk *pNew = tdsqlite3_malloc(fileChunkSize(p->nChunkSize)); if( !pNew ){ return SQLITE_IOERR_NOMEM_BKPT; } @@ -100825,7 +100825,7 @@ static int memjrnlWrite( ** is still in main memory but is being truncated to zero bytes in size, ** ignore */ -static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){ +static int memjrnlTruncate(tdsqlite3_file *pJfd, sqlite_int64 size){ MemJournal *p = (MemJournal *)pJfd; if( ALWAYS(size==0) ){ memjrnlFreeChunks(p); @@ -100841,7 +100841,7 @@ static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){ /* ** Close the file. */ -static int memjrnlClose(sqlite3_file *pJfd){ +static int memjrnlClose(tdsqlite3_file *pJfd){ MemJournal *p = (MemJournal *)pJfd; memjrnlFreeChunks(p); return SQLITE_OK; @@ -100853,7 +100853,7 @@ static int memjrnlClose(sqlite3_file *pJfd){ ** If the real file has been created, call its xSync method. Otherwise, ** syncing an in-memory journal is a no-op. */ -static int memjrnlSync(sqlite3_file *pJfd, int flags){ +static int memjrnlSync(tdsqlite3_file *pJfd, int flags){ UNUSED_PARAMETER2(pJfd, flags); return SQLITE_OK; } @@ -100861,16 +100861,16 @@ static int memjrnlSync(sqlite3_file *pJfd, int flags){ /* ** Query the size of the file in bytes. */ -static int memjrnlFileSize(sqlite3_file *pJfd, sqlite_int64 *pSize){ +static int memjrnlFileSize(tdsqlite3_file *pJfd, sqlite_int64 *pSize){ MemJournal *p = (MemJournal *)pJfd; *pSize = (sqlite_int64) p->endpoint.iOffset; return SQLITE_OK; } /* -** Table of methods for MemJournal sqlite3_file object. +** Table of methods for MemJournal tdsqlite3_file object. */ -static const struct sqlite3_io_methods MemJournalMethods = { +static const struct tdsqlite3_io_methods MemJournalMethods = { 1, /* iVersion */ memjrnlClose, /* xClose */ memjrnlRead, /* xRead */ @@ -100902,24 +100902,24 @@ static const struct sqlite3_io_methods MemJournalMethods = { ** positive value, then the journal file is initially created in-memory ** but may be flushed to disk later on. In this case the journal file is ** flushed to disk either when it grows larger than nSpill bytes in size, -** or when sqlite3JournalCreate() is called. +** or when tdsqlite3JournalCreate() is called. */ -SQLITE_PRIVATE int sqlite3JournalOpen( - sqlite3_vfs *pVfs, /* The VFS to use for actual file I/O */ +SQLITE_PRIVATE int tdsqlite3JournalOpen( + tdsqlite3_vfs *pVfs, /* The VFS to use for actual file I/O */ const char *zName, /* Name of the journal file */ - sqlite3_file *pJfd, /* Preallocated, blank file handle */ + tdsqlite3_file *pJfd, /* Preallocated, blank file handle */ int flags, /* Opening flags */ int nSpill /* Bytes buffered before opening the file */ ){ MemJournal *p = (MemJournal*)pJfd; /* Zero the file-handle object. If nSpill was passed zero, initialize - ** it using the sqlite3OsOpen() function of the underlying VFS. In this + ** it using the tdsqlite3OsOpen() function of the underlying VFS. In this ** case none of the code in this module is executed as a result of calls ** made on the journal file-handle. */ memset(p, 0, sizeof(MemJournal)); if( nSpill==0 ){ - return sqlite3OsOpen(pVfs, zName, pJfd, flags, 0); + return tdsqlite3OsOpen(pVfs, zName, pJfd, flags, 0); } if( nSpill>0 ){ @@ -100929,7 +100929,7 @@ SQLITE_PRIVATE int sqlite3JournalOpen( assert( MEMJOURNAL_DFLT_FILECHUNKSIZE==fileChunkSize(p->nChunkSize) ); } - p->pMethod = (const sqlite3_io_methods*)&MemJournalMethods; + p->pMethod = (const tdsqlite3_io_methods*)&MemJournalMethods; p->nSpill = nSpill; p->flags = flags; p->zJournal = zName; @@ -100940,8 +100940,8 @@ SQLITE_PRIVATE int sqlite3JournalOpen( /* ** Open an in-memory journal file. */ -SQLITE_PRIVATE void sqlite3MemJournalOpen(sqlite3_file *pJfd){ - sqlite3JournalOpen(0, 0, pJfd, 0, -1); +SQLITE_PRIVATE void tdsqlite3MemJournalOpen(tdsqlite3_file *pJfd){ + tdsqlite3JournalOpen(0, 0, pJfd, 0, -1); } #if defined(SQLITE_ENABLE_ATOMIC_WRITE) \ @@ -100952,7 +100952,7 @@ SQLITE_PRIVATE void sqlite3MemJournalOpen(sqlite3_file *pJfd){ ** nSpill parameter or as SQLITE_OPEN_MAIN_JOURNAL), and the underlying ** file has not yet been created, create it now. */ -SQLITE_PRIVATE int sqlite3JournalCreate(sqlite3_file *pJfd){ +SQLITE_PRIVATE int tdsqlite3JournalCreate(tdsqlite3_file *pJfd){ int rc = SQLITE_OK; MemJournal *p = (MemJournal*)pJfd; if( p->pMethod==&MemJournalMethods && ( @@ -100979,7 +100979,7 @@ SQLITE_PRIVATE int sqlite3JournalCreate(sqlite3_file *pJfd){ ** Return true if this "journal file" is currently stored in heap memory, ** or false otherwise. */ -SQLITE_PRIVATE int sqlite3JournalIsInMemory(sqlite3_file *p){ +SQLITE_PRIVATE int tdsqlite3JournalIsInMemory(tdsqlite3_file *p){ return p->pMethods==&MemJournalMethods; } @@ -100987,7 +100987,7 @@ SQLITE_PRIVATE int sqlite3JournalIsInMemory(sqlite3_file *p){ ** Return the number of bytes required to store a JournalFile that uses vfs ** pVfs to create the underlying on-disk files. */ -SQLITE_PRIVATE int sqlite3JournalSize(sqlite3_vfs *pVfs){ +SQLITE_PRIVATE int tdsqlite3JournalSize(tdsqlite3_vfs *pVfs){ return MAX(pVfs->szOsFile, (int)sizeof(MemJournal)); } @@ -101021,20 +101021,20 @@ static int walkWindowList(Walker *pWalker, Window *pList){ Window *pWin; for(pWin=pList; pWin; pWin=pWin->pNextWin){ int rc; - rc = sqlite3WalkExprList(pWalker, pWin->pOrderBy); + rc = tdsqlite3WalkExprList(pWalker, pWin->pOrderBy); if( rc ) return WRC_Abort; - rc = sqlite3WalkExprList(pWalker, pWin->pPartition); + rc = tdsqlite3WalkExprList(pWalker, pWin->pPartition); if( rc ) return WRC_Abort; - rc = sqlite3WalkExpr(pWalker, pWin->pFilter); + rc = tdsqlite3WalkExpr(pWalker, pWin->pFilter); if( rc ) return WRC_Abort; - /* The next two are purely for calls to sqlite3RenameExprUnmap() - ** within sqlite3WindowOffsetExpr(). Because of constraints imposed - ** by sqlite3WindowOffsetExpr(), they can never fail. The results do + /* The next two are purely for calls to tdsqlite3RenameExprUnmap() + ** within tdsqlite3WindowOffsetExpr(). Because of constraints imposed + ** by tdsqlite3WindowOffsetExpr(), they can never fail. The results do ** not matter anyhow. */ - rc = sqlite3WalkExpr(pWalker, pWin->pStart); + rc = tdsqlite3WalkExpr(pWalker, pWin->pStart); if( NEVER(rc) ) return WRC_Abort; - rc = sqlite3WalkExpr(pWalker, pWin->pEnd); + rc = tdsqlite3WalkExpr(pWalker, pWin->pEnd); if( NEVER(rc) ) return WRC_Abort; } return WRC_Continue; @@ -101076,10 +101076,10 @@ static SQLITE_NOINLINE int walkExpr(Walker *pWalker, Expr *pExpr){ continue; }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){ assert( !ExprHasProperty(pExpr, EP_WinFunc) ); - if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort; + if( tdsqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort; }else{ if( pExpr->x.pList ){ - if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort; + if( tdsqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort; } #ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(pExpr, EP_WinFunc) ){ @@ -101092,20 +101092,20 @@ static SQLITE_NOINLINE int walkExpr(Walker *pWalker, Expr *pExpr){ } return WRC_Continue; } -SQLITE_PRIVATE int sqlite3WalkExpr(Walker *pWalker, Expr *pExpr){ +SQLITE_PRIVATE int tdsqlite3WalkExpr(Walker *pWalker, Expr *pExpr){ return pExpr ? walkExpr(pWalker,pExpr) : WRC_Continue; } /* -** Call sqlite3WalkExpr() for every expression in list p or until +** Call tdsqlite3WalkExpr() for every expression in list p or until ** an abort request is seen. */ -SQLITE_PRIVATE int sqlite3WalkExprList(Walker *pWalker, ExprList *p){ +SQLITE_PRIVATE int tdsqlite3WalkExprList(Walker *pWalker, ExprList *p){ int i; struct ExprList_item *pItem; if( p ){ for(i=p->nExpr, pItem=p->a; i>0; i--, pItem++){ - if( sqlite3WalkExpr(pWalker, pItem->pExpr) ) return WRC_Abort; + if( tdsqlite3WalkExpr(pWalker, pItem->pExpr) ) return WRC_Abort; } } return WRC_Continue; @@ -101117,13 +101117,13 @@ SQLITE_PRIVATE int sqlite3WalkExprList(Walker *pWalker, ExprList *p){ ** any expr callbacks and SELECT callbacks that come from subqueries. ** Return WRC_Abort or WRC_Continue. */ -SQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker *pWalker, Select *p){ - if( sqlite3WalkExprList(pWalker, p->pEList) ) return WRC_Abort; - if( sqlite3WalkExpr(pWalker, p->pWhere) ) return WRC_Abort; - if( sqlite3WalkExprList(pWalker, p->pGroupBy) ) return WRC_Abort; - if( sqlite3WalkExpr(pWalker, p->pHaving) ) return WRC_Abort; - if( sqlite3WalkExprList(pWalker, p->pOrderBy) ) return WRC_Abort; - if( sqlite3WalkExpr(pWalker, p->pLimit) ) return WRC_Abort; +SQLITE_PRIVATE int tdsqlite3WalkSelectExpr(Walker *pWalker, Select *p){ + if( tdsqlite3WalkExprList(pWalker, p->pEList) ) return WRC_Abort; + if( tdsqlite3WalkExpr(pWalker, p->pWhere) ) return WRC_Abort; + if( tdsqlite3WalkExprList(pWalker, p->pGroupBy) ) return WRC_Abort; + if( tdsqlite3WalkExpr(pWalker, p->pHaving) ) return WRC_Abort; + if( tdsqlite3WalkExprList(pWalker, p->pOrderBy) ) return WRC_Abort; + if( tdsqlite3WalkExpr(pWalker, p->pLimit) ) return WRC_Abort; #if !defined(SQLITE_OMIT_WINDOWFUNC) && !defined(SQLITE_OMIT_ALTERTABLE) { Parse *pParse = pWalker->pParse; @@ -101145,7 +101145,7 @@ SQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker *pWalker, Select *p){ ** and on any subqueries further down in the tree. Return ** WRC_Abort or WRC_Continue; */ -SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){ +SQLITE_PRIVATE int tdsqlite3WalkSelectFrom(Walker *pWalker, Select *p){ SrcList *pSrc; int i; struct SrcList_item *pItem; @@ -101153,11 +101153,11 @@ SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){ pSrc = p->pSrc; assert( pSrc!=0 ); for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){ - if( pItem->pSelect && sqlite3WalkSelect(pWalker, pItem->pSelect) ){ + if( pItem->pSelect && tdsqlite3WalkSelect(pWalker, pItem->pSelect) ){ return WRC_Abort; } if( pItem->fg.isTabFunc - && sqlite3WalkExprList(pWalker, pItem->u1.pFuncArg) + && tdsqlite3WalkExprList(pWalker, pItem->u1.pFuncArg) ){ return WRC_Abort; } @@ -101166,8 +101166,8 @@ SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){ } /* -** Call sqlite3WalkExpr() for every expression in Select statement p. -** Invoke sqlite3WalkSelect() for subqueries in the FROM clause and +** Call tdsqlite3WalkExpr() for every expression in Select statement p. +** Invoke tdsqlite3WalkSelect() for subqueries in the FROM clause and ** on the compound select chain, p->pPrior. ** ** If it is not NULL, the xSelectCallback() callback is invoked before @@ -101182,15 +101182,15 @@ SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){ ** If the Walker does not have an xSelectCallback() then this routine ** is a no-op returning WRC_Continue. */ -SQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, Select *p){ +SQLITE_PRIVATE int tdsqlite3WalkSelect(Walker *pWalker, Select *p){ int rc; if( p==0 ) return WRC_Continue; if( pWalker->xSelectCallback==0 ) return WRC_Continue; do{ rc = pWalker->xSelectCallback(pWalker, p); if( rc ) return rc & WRC_Abort; - if( sqlite3WalkSelectExpr(pWalker, p) - || sqlite3WalkSelectFrom(pWalker, p) + if( tdsqlite3WalkSelectExpr(pWalker, p) + || tdsqlite3WalkSelectFrom(pWalker, p) ){ return WRC_Abort; } @@ -101241,7 +101241,7 @@ static void incrAggFunctionDepth(Expr *pExpr, int N){ memset(&w, 0, sizeof(w)); w.xExprCallback = incrAggDepth; w.u.n = N; - sqlite3WalkExpr(&w, pExpr); + tdsqlite3WalkExpr(&w, pExpr); } } @@ -101274,32 +101274,32 @@ static void resolveAlias( ){ Expr *pOrig; /* The iCol-th column of the result set */ Expr *pDup; /* Copy of pOrig */ - sqlite3 *db; /* The database connection */ + tdsqlite3 *db; /* The database connection */ assert( iCol>=0 && iColnExpr ); pOrig = pEList->a[iCol].pExpr; assert( pOrig!=0 ); db = pParse->db; - pDup = sqlite3ExprDup(db, pOrig, 0); + pDup = tdsqlite3ExprDup(db, pOrig, 0); if( pDup!=0 ){ if( zType[0]!='G' ) incrAggFunctionDepth(pDup, nSubquery); if( pExpr->op==TK_COLLATE ){ - pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken); + pDup = tdsqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken); } - /* Before calling sqlite3ExprDelete(), set the EP_Static flag. This + /* Before calling tdsqlite3ExprDelete(), set the EP_Static flag. This ** prevents ExprDelete() from deleting the Expr structure itself, ** allowing it to be repopulated by the memcpy() on the following line. ** The pExpr->u.zToken might point into memory that will be freed by the - ** sqlite3DbFree(db, pDup) on the last line of this block, so be sure to - ** make a copy of the token before doing the sqlite3DbFree(). + ** tdsqlite3DbFree(db, pDup) on the last line of this block, so be sure to + ** make a copy of the token before doing the tdsqlite3DbFree(). */ ExprSetProperty(pExpr, EP_Static); - sqlite3ExprDelete(db, pExpr); + tdsqlite3ExprDelete(db, pExpr); memcpy(pExpr, pDup, sizeof(*pExpr)); if( !ExprHasProperty(pExpr, EP_IntValue) && pExpr->u.zToken!=0 ){ assert( (pExpr->flags & (EP_Reduced|EP_TokenOnly))==0 ); - pExpr->u.zToken = sqlite3DbStrDup(db, pExpr->u.zToken); + pExpr->u.zToken = tdsqlite3DbStrDup(db, pExpr->u.zToken); pExpr->flags |= EP_MemToken; } if( ExprHasProperty(pExpr, EP_WinFunc) ){ @@ -101309,7 +101309,7 @@ static void resolveAlias( assert( db->mallocFailed ); } } - sqlite3DbFree(db, pDup); + tdsqlite3DbFree(db, pDup); } ExprSetProperty(pExpr, EP_Alias); } @@ -101325,7 +101325,7 @@ static int nameInUsingClause(IdList *pUsing, const char *zCol){ if( pUsing ){ int k; for(k=0; knId; k++){ - if( sqlite3StrICmp(pUsing->a[k].zName, zCol)==0 ) return 1; + if( tdsqlite3StrICmp(pUsing->a[k].zName, zCol)==0 ) return 1; } } return 0; @@ -101338,7 +101338,7 @@ static int nameInUsingClause(IdList *pUsing, const char *zCol){ ** and zCol. If any of zDb, zTab, and zCol are NULL then those fields will ** match anything. */ -SQLITE_PRIVATE int sqlite3MatchEName( +SQLITE_PRIVATE int tdsqlite3MatchEName( const struct ExprList_item *pItem, const char *zCol, const char *zTab, @@ -101349,16 +101349,16 @@ SQLITE_PRIVATE int sqlite3MatchEName( if( NEVER(pItem->eEName!=ENAME_TAB) ) return 0; zSpan = pItem->zEName; for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){} - if( zDb && (sqlite3StrNICmp(zSpan, zDb, n)!=0 || zDb[n]!=0) ){ + if( zDb && (tdsqlite3StrNICmp(zSpan, zDb, n)!=0 || zDb[n]!=0) ){ return 0; } zSpan += n+1; for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){} - if( zTab && (sqlite3StrNICmp(zSpan, zTab, n)!=0 || zTab[n]!=0) ){ + if( zTab && (tdsqlite3StrNICmp(zSpan, zTab, n)!=0 || zTab[n]!=0) ){ return 0; } zSpan += n+1; - if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){ + if( zCol && tdsqlite3StrICmp(zSpan, zCol)!=0 ){ return 0; } return 1; @@ -101367,11 +101367,11 @@ SQLITE_PRIVATE int sqlite3MatchEName( /* ** Return TRUE if the double-quoted string mis-feature should be supported. */ -static int areDoubleQuotedStringsEnabled(sqlite3 *db, NameContext *pTopNC){ +static int areDoubleQuotedStringsEnabled(tdsqlite3 *db, NameContext *pTopNC){ if( db->init.busy ) return 1; /* Always support for legacy schemas */ if( pTopNC->ncFlags & NC_IsDDL ){ /* Currently parsing a DDL statement */ - if( sqlite3WritableSchema(db) && (db->flags & SQLITE_DqsDML)!=0 ){ + if( tdsqlite3WritableSchema(db) && (db->flags & SQLITE_DqsDML)!=0 ){ return 1; } return (db->flags & SQLITE_DqsDDL)!=0; @@ -101420,7 +101420,7 @@ static int lookupName( int cnt = 0; /* Number of matching column names */ int cntTab = 0; /* Number of matching table names */ int nSubquery = 0; /* How many levels of subquery */ - sqlite3 *db = pParse->db; /* The database connection */ + tdsqlite3 *db = pParse->db; /* The database connection */ struct SrcList_item *pItem; /* Use for looping over pSrcList items */ struct SrcList_item *pMatch = 0; /* The matching pSrcList item */ NameContext *pTopNC = pNC; /* First namecontext in the list */ @@ -101453,7 +101453,7 @@ static int lookupName( }else{ for(i=0; inDb; i++){ assert( db->aDb[i].zDbSName ); - if( sqlite3StrICmp(db->aDb[i].zDbSName,zDb)==0 ){ + if( tdsqlite3StrICmp(db->aDb[i].zDbSName,zDb)==0 ){ pSchema = db->aDb[i].pSchema; break; } @@ -101476,7 +101476,7 @@ static int lookupName( int hit = 0; pEList = pItem->pSelect->pEList; for(j=0; jnExpr; j++){ - if( sqlite3MatchEName(&pEList->a[j], zCol, zTab, zDb) ){ + if( tdsqlite3MatchEName(&pEList->a[j], zCol, zTab, zDb) ){ cnt++; cntTab = 2; pMatch = pItem; @@ -101492,18 +101492,18 @@ static int lookupName( if( zTab ){ const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName; assert( zTabName!=0 ); - if( sqlite3StrICmp(zTabName, zTab)!=0 ){ + if( tdsqlite3StrICmp(zTabName, zTab)!=0 ){ continue; } if( IN_RENAME_OBJECT && pItem->zAlias ){ - sqlite3RenameTokenRemap(pParse, 0, (void*)&pExpr->y.pTab); + tdsqlite3RenameTokenRemap(pParse, 0, (void*)&pExpr->y.pTab); } } if( 0==(cntTab++) ){ pMatch = pItem; } for(j=0, pCol=pTab->aCol; jnCol; j++, pCol++){ - if( sqlite3StrICmp(pCol->zName, zCol)==0 ){ + if( tdsqlite3StrICmp(pCol->zName, zCol)==0 ){ /* If there has been exactly one prior match and this match ** is for the right-hand table of a NATURAL JOIN or is in a ** USING clause, then skip this match. @@ -101543,10 +101543,10 @@ static int lookupName( if( pParse->pTriggerTab!=0 ){ int op = pParse->eTriggerOp; assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT ); - if( op!=TK_DELETE && sqlite3StrICmp("new",zTab) == 0 ){ + if( op!=TK_DELETE && tdsqlite3StrICmp("new",zTab) == 0 ){ pExpr->iTable = 1; pTab = pParse->pTriggerTab; - }else if( op!=TK_INSERT && sqlite3StrICmp("old",zTab)==0 ){ + }else if( op!=TK_INSERT && tdsqlite3StrICmp("old",zTab)==0 ){ pExpr->iTable = 0; pTab = pParse->pTriggerTab; } @@ -101555,7 +101555,7 @@ static int lookupName( #ifndef SQLITE_OMIT_UPSERT if( (pNC->ncFlags & NC_UUpsert)!=0 ){ Upsert *pUpsert = pNC->uNC.pUpsert; - if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){ + if( pUpsert && tdsqlite3StrICmp("excluded",zTab)==0 ){ pTab = pUpsert->pUpsertSrc->a[0].pTab; pExpr->iTable = 2; } @@ -101567,14 +101567,14 @@ static int lookupName( pSchema = pTab->pSchema; cntTab++; for(iCol=0, pCol=pTab->aCol; iColnCol; iCol++, pCol++){ - if( sqlite3StrICmp(pCol->zName, zCol)==0 ){ + if( tdsqlite3StrICmp(pCol->zName, zCol)==0 ){ if( iCol==pTab->iPKey ){ iCol = -1; } break; } } - if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){ + if( iCol>=pTab->nCol && tdsqlite3IsRowid(zCol) && VisibleRowid(pTab) ){ /* IMP: R-51414-32910 */ iCol = -1; } @@ -101624,7 +101624,7 @@ static int lookupName( && cntTab==1 && pMatch && (pNC->ncFlags & (NC_IdxExpr|NC_GenCol))==0 - && sqlite3IsRowid(zCol) + && tdsqlite3IsRowid(zCol) && VisibleRowid(pMatch->pTab) ){ cnt = 1; @@ -101648,7 +101648,7 @@ static int lookupName( ** or HAVING clauses, or as part of a larger expression in the ORDER BY ** clause is not standard SQL. This is a (goofy) SQLite extension, that ** is supported for backwards compatibility only. Hence, we issue a warning - ** on sqlite3_log() whenever the capability is used. + ** on tdsqlite3_log() whenever the capability is used. */ if( (pNC->ncFlags & NC_UEList)!=0 && cnt==0 @@ -101659,7 +101659,7 @@ static int lookupName( for(j=0; jnExpr; j++){ char *zAs = pEList->a[j].zEName; if( pEList->a[j].eEName==ENAME_NAME - && sqlite3_stricmp(zAs, zCol)==0 + && tdsqlite3_stricmp(zAs, zCol)==0 ){ Expr *pOrig; assert( pExpr->pLeft==0 && pExpr->pRight==0 ); @@ -101667,17 +101667,17 @@ static int lookupName( assert( pExpr->x.pSelect==0 ); pOrig = pEList->a[j].pExpr; if( (pNC->ncFlags&NC_AllowAgg)==0 && ExprHasProperty(pOrig, EP_Agg) ){ - sqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs); + tdsqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs); return WRC_Abort; } if( ExprHasProperty(pOrig, EP_Win) && ((pNC->ncFlags&NC_AllowWin)==0 || pNC!=pTopNC ) ){ - sqlite3ErrorMsg(pParse, "misuse of aliased window function %s",zAs); + tdsqlite3ErrorMsg(pParse, "misuse of aliased window function %s",zAs); return WRC_Abort; } - if( sqlite3ExprVectorSize(pOrig)!=1 ){ - sqlite3ErrorMsg(pParse, "row value misused"); + if( tdsqlite3ExprVectorSize(pOrig)!=1 ){ + tdsqlite3ErrorMsg(pParse, "row value misused"); return WRC_Abort; } resolveAlias(pParse, pEList, j, pExpr, "", nSubquery); @@ -101685,7 +101685,7 @@ static int lookupName( pMatch = 0; assert( zTab==0 && zDb==0 ); if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr); + tdsqlite3RenameTokenRemap(pParse, 0, (void*)pExpr); } goto lookupname_end; } @@ -101730,16 +101730,16 @@ static int lookupName( ** a huge amount of legacy SQL that uses it. So for now, we just ** issue a warning. */ - sqlite3_log(SQLITE_WARNING, + tdsqlite3_log(SQLITE_WARNING, "double-quoted string literal: \"%w\"", zCol); #ifdef SQLITE_ENABLE_NORMALIZE - sqlite3VdbeAddDblquoteStr(db, pParse->pVdbe, zCol); + tdsqlite3VdbeAddDblquoteStr(db, pParse->pVdbe, zCol); #endif pExpr->op = TK_STRING; pExpr->y.pTab = 0; return WRC_Prune; } - if( sqlite3ExprIdToTrueFalse(pExpr) ){ + if( tdsqlite3ExprIdToTrueFalse(pExpr) ){ return WRC_Prune; } } @@ -101752,11 +101752,11 @@ static int lookupName( const char *zErr; zErr = cnt==0 ? "no such column" : "ambiguous column name"; if( zDb ){ - sqlite3ErrorMsg(pParse, "%s: %s.%s.%s", zErr, zDb, zTab, zCol); + tdsqlite3ErrorMsg(pParse, "%s: %s.%s.%s", zErr, zDb, zTab, zCol); }else if( zTab ){ - sqlite3ErrorMsg(pParse, "%s: %s.%s", zErr, zTab, zCol); + tdsqlite3ErrorMsg(pParse, "%s: %s.%s", zErr, zTab, zCol); }else{ - sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol); + tdsqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol); } pParse->checkSchema = 1; pTopNC->nErr++; @@ -101797,9 +101797,9 @@ static int lookupName( /* Clean up and return */ - sqlite3ExprDelete(db, pExpr->pLeft); + tdsqlite3ExprDelete(db, pExpr->pLeft); pExpr->pLeft = 0; - sqlite3ExprDelete(db, pExpr->pRight); + tdsqlite3ExprDelete(db, pExpr->pRight); pExpr->pRight = 0; pExpr->op = eNewExprOp; ExprSetProperty(pExpr, EP_Leaf); @@ -101807,7 +101807,7 @@ lookupname_end: if( cnt==1 ){ assert( pNC!=0 ); if( !ExprHasProperty(pExpr, EP_Alias) ){ - sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList); + tdsqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList); } /* Increment the nRef value on all name contexts from TopNC up to ** the point where the name matched. */ @@ -101827,8 +101827,8 @@ lookupname_end: ** Allocate and return a pointer to an expression to load the column iCol ** from datasource iSrc in SrcList pSrc. */ -SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){ - Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0); +SQLITE_PRIVATE Expr *tdsqlite3CreateColumnExpr(tdsqlite3 *db, SrcList *pSrc, int iSrc, int iCol){ + Expr *p = tdsqlite3ExprAlloc(db, TK_COLUMN, 0, 0); if( p ){ struct SrcList_item *pItem = &pSrc->a[iSrc]; Table *pTab = p->y.pTab = pItem->pTab; @@ -101883,10 +101883,10 @@ static void notValidImpl( #ifndef SQLITE_OMIT_GENERATED_COLUMNS else if( pNC->ncFlags & NC_GenCol ) zIn = "generated columns"; #endif - sqlite3ErrorMsg(pParse, "%s prohibited in %s", zMsg, zIn); + tdsqlite3ErrorMsg(pParse, "%s prohibited in %s", zMsg, zIn); if( pExpr ) pExpr->op = TK_NULL; } -#define sqlite3ResolveNotValid(P,N,M,X,E) \ +#define tdsqlite3ResolveNotValid(P,N,M,X,E) \ assert( ((X)&~(NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol))==0 ); \ if( ((N)->ncFlags & (X))!=0 ) notValidImpl(P,N,M,E); @@ -101898,14 +101898,14 @@ static void notValidImpl( static int exprProbability(Expr *p){ double r = -1.0; if( p->op!=TK_FLOAT ) return -1; - sqlite3AtoF(p->u.zToken, &r, sqlite3Strlen30(p->u.zToken), SQLITE_UTF8); + tdsqlite3AtoF(p->u.zToken, &r, tdsqlite3Strlen30(p->u.zToken), SQLITE_UTF8); assert( r>=0.0 ); if( r>1.0 ) return -1; return (int)(r*134217728.0); } /* -** This routine is callback for sqlite3WalkExpr(). +** This routine is callback for tdsqlite3WalkExpr(). ** ** Resolve symbolic names into TK_COLUMN operators for the current ** node in the expression tree. Return 0 to continue the search down @@ -101979,7 +101979,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ Expr *pLeft = pExpr->pLeft; testcase( pNC->ncFlags & NC_IdxExpr ); testcase( pNC->ncFlags & NC_GenCol ); - sqlite3ResolveNotValid(pParse, pNC, "the \".\" operator", + tdsqlite3ResolveNotValid(pParse, pNC, "the \".\" operator", NC_IdxExpr|NC_GenCol, 0); pRight = pExpr->pRight; if( pRight->op==TK_ID ){ @@ -101993,8 +101993,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ zTable = pLeft->u.zToken; zColumn = pRight->u.zToken; if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenRemap(pParse, (void*)pExpr, (void*)pRight); - sqlite3RenameTokenRemap(pParse, (void*)&pExpr->y.pTab, (void*)pLeft); + tdsqlite3RenameTokenRemap(pParse, (void*)pExpr, (void*)pRight); + tdsqlite3RenameTokenRemap(pParse, (void*)&pExpr->y.pTab, (void*)pLeft); } } return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr); @@ -102018,10 +102018,10 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ #endif assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); zId = pExpr->u.zToken; - nId = sqlite3Strlen30(zId); - pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0); + nId = tdsqlite3Strlen30(zId); + pDef = tdsqlite3FindFunction(pParse->db, zId, n, enc, 0); if( pDef==0 ){ - pDef = sqlite3FindFunction(pParse->db, zId, -2, enc, 0); + pDef = tdsqlite3FindFunction(pParse->db, zId, -2, enc, 0); if( pDef==0 ){ no_such_func = 1; }else{ @@ -102034,7 +102034,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ if( n==2 ){ pExpr->iTable = exprProbability(pList->a[1].pExpr); if( pExpr->iTable<0 ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "second argument to likelihood() must be a " "constant between 0.0 and 1.0"); pNC->nErr++; @@ -102054,10 +102054,10 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ } #ifndef SQLITE_OMIT_AUTHORIZATION { - int auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0,pDef->zName,0); + int auth = tdsqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0,pDef->zName,0); if( auth!=SQLITE_OK ){ if( auth==SQLITE_DENY ){ - sqlite3ErrorMsg(pParse, "not authorized to use function: %s", + tdsqlite3ErrorMsg(pParse, "not authorized to use function: %s", pDef->zName); pNC->nErr++; } @@ -102080,7 +102080,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ ** in an index or generated column. Curiously, they can be used ** in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all ** all this. */ - sqlite3ResolveNotValid(pParse, pNC, "non-deterministic functions", + tdsqlite3ResolveNotValid(pParse, pNC, "non-deterministic functions", NC_IdxExpr|NC_PartIdx|NC_GenCol, 0); }else{ assert( (NC_SelfRef & 0xff)==NC_SelfRef ); /* Must fit in 8 bits */ @@ -102092,7 +102092,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ && (pParse->db->mDbFlags & DBFLAG_InternalFunc)==0 ){ /* Internal-use-only functions are disallowed unless the - ** SQL is being compiled using sqlite3NestedParse() or + ** SQL is being compiled using tdsqlite3NestedParse() or ** the SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test-control has be ** used to activate internal functionsn for testing purposes */ no_such_func = 1; @@ -102101,7 +102101,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ if( (pDef->funcFlags & (SQLITE_FUNC_DIRECT|SQLITE_FUNC_UNSAFE))!=0 && !IN_RENAME_OBJECT ){ - sqlite3ExprFunctionUsable(pParse, pExpr, pDef); + tdsqlite3ExprFunctionUsable(pParse, pExpr, pDef); } } @@ -102112,7 +102112,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ || (pDef->xValue && pDef->xInverse && pDef->xSFunc && pDef->xFinalize) ); if( pDef && pDef->xValue==0 && pWin ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "%.*s() may not be used as a window function", nId, zId ); pNC->nErr++; @@ -102127,13 +102127,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ }else{ zType = "aggregate"; } - sqlite3ErrorMsg(pParse, "misuse of %s function %.*s()",zType,nId,zId); + tdsqlite3ErrorMsg(pParse, "misuse of %s function %.*s()",zType,nId,zId); pNC->nErr++; is_agg = 0; } #else if( (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) ){ - sqlite3ErrorMsg(pParse,"misuse of aggregate function %.*s()",nId,zId); + tdsqlite3ErrorMsg(pParse,"misuse of aggregate function %.*s()",nId,zId); pNC->nErr++; is_agg = 0; } @@ -102143,16 +102143,16 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ && pParse->explain==0 #endif ){ - sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); + tdsqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); pNC->nErr++; }else if( wrong_num_args ){ - sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()", + tdsqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()", nId, zId); pNC->nErr++; } #ifndef SQLITE_OMIT_WINDOWFUNC else if( is_agg==0 && ExprHasProperty(pExpr, EP_WinFunc) ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "FILTER may not be used with non-aggregate %.*s()", nId, zId ); @@ -102175,19 +102175,19 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ is_agg = 1; } #endif - sqlite3WalkExprList(pWalker, pList); + tdsqlite3WalkExprList(pWalker, pList); if( is_agg ){ #ifndef SQLITE_OMIT_WINDOWFUNC if( pWin ){ Select *pSel = pNC->pWinSelect; assert( pWin==pExpr->y.pWin ); if( IN_RENAME_OBJECT==0 ){ - sqlite3WindowUpdate(pParse, pSel ? pSel->pWinDefn : 0, pWin, pDef); + tdsqlite3WindowUpdate(pParse, pSel ? pSel->pWinDefn : 0, pWin, pDef); } - sqlite3WalkExprList(pWalker, pWin->pPartition); - sqlite3WalkExprList(pWalker, pWin->pOrderBy); - sqlite3WalkExpr(pWalker, pWin->pFilter); - sqlite3WindowLink(pSel, pWin); + tdsqlite3WalkExprList(pWalker, pWin->pPartition); + tdsqlite3WalkExprList(pWalker, pWin->pOrderBy); + tdsqlite3WalkExpr(pWalker, pWin->pFilter); + tdsqlite3WindowLink(pSel, pWin); pNC->ncFlags |= NC_HasWin; }else #endif /* SQLITE_OMIT_WINDOWFUNC */ @@ -102197,10 +102197,10 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ pExpr->op2 = 0; #ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(pExpr, EP_WinFunc) ){ - sqlite3WalkExpr(pWalker, pExpr->y.pWin->pFilter); + tdsqlite3WalkExpr(pWalker, pExpr->y.pWin->pFilter); } #endif - while( pNC2 && !sqlite3FunctionUsesThisSrc(pExpr, pNC2->pSrcList) ){ + while( pNC2 && !tdsqlite3FunctionUsesThisSrc(pExpr, pNC2->pSrcList) ){ pExpr->op2++; pNC2 = pNC2->pNext; } @@ -102231,9 +102231,9 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ testcase( pNC->ncFlags & NC_PartIdx ); testcase( pNC->ncFlags & NC_IdxExpr ); testcase( pNC->ncFlags & NC_GenCol ); - sqlite3ResolveNotValid(pParse, pNC, "subqueries", + tdsqlite3ResolveNotValid(pParse, pNC, "subqueries", NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol, pExpr); - sqlite3WalkSelect(pWalker, pExpr->x.pSelect); + tdsqlite3WalkSelect(pWalker, pExpr->x.pSelect); assert( pNC->nRef>=nRef ); if( nRef!=pNC->nRef ){ ExprSetProperty(pExpr, EP_VarSelect); @@ -102247,13 +102247,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ testcase( pNC->ncFlags & NC_PartIdx ); testcase( pNC->ncFlags & NC_IdxExpr ); testcase( pNC->ncFlags & NC_GenCol ); - sqlite3ResolveNotValid(pParse, pNC, "parameters", + tdsqlite3ResolveNotValid(pParse, pNC, "parameters", NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol, pExpr); break; } case TK_IS: case TK_ISNOT: { - Expr *pRight = sqlite3ExprSkipCollateAndLikely(pExpr->pRight); + Expr *pRight = tdsqlite3ExprSkipCollateAndLikely(pExpr->pRight); assert( !ExprHasProperty(pExpr, EP_Reduced) ); /* Handle special cases of "x IS TRUE", "x IS FALSE", "x IS NOT TRUE", ** and "x IS NOT FALSE". */ @@ -102278,15 +102278,15 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ int nLeft, nRight; if( pParse->db->mallocFailed ) break; assert( pExpr->pLeft!=0 ); - nLeft = sqlite3ExprVectorSize(pExpr->pLeft); + nLeft = tdsqlite3ExprVectorSize(pExpr->pLeft); if( pExpr->op==TK_BETWEEN ){ - nRight = sqlite3ExprVectorSize(pExpr->x.pList->a[0].pExpr); + nRight = tdsqlite3ExprVectorSize(pExpr->x.pList->a[0].pExpr); if( nRight==nLeft ){ - nRight = sqlite3ExprVectorSize(pExpr->x.pList->a[1].pExpr); + nRight = tdsqlite3ExprVectorSize(pExpr->x.pList->a[1].pExpr); } }else{ assert( pExpr->pRight!=0 ); - nRight = sqlite3ExprVectorSize(pExpr->pRight); + nRight = tdsqlite3ExprVectorSize(pExpr->pRight); } if( nLeft!=nRight ){ testcase( pExpr->op==TK_EQ ); @@ -102298,7 +102298,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ testcase( pExpr->op==TK_IS ); testcase( pExpr->op==TK_ISNOT ); testcase( pExpr->op==TK_BETWEEN ); - sqlite3ErrorMsg(pParse, "row value misused"); + tdsqlite3ErrorMsg(pParse, "row value misused"); } break; } @@ -102331,7 +102331,7 @@ static int resolveAsName( char *zCol = pE->u.zToken; for(i=0; inExpr; i++){ if( pEList->a[i].eEName==ENAME_NAME - && sqlite3_stricmp(pEList->a[i].zEName, zCol)==0 + && tdsqlite3_stricmp(pEList->a[i].zEName, zCol)==0 ){ return i+1; } @@ -102366,11 +102366,11 @@ static int resolveOrderByTermToExprList( int i; /* Loop counter */ ExprList *pEList; /* The columns of the result set */ NameContext nc; /* Name context for resolving pE */ - sqlite3 *db; /* Database connection */ + tdsqlite3 *db; /* Database connection */ int rc; /* Return code from subprocedures */ u8 savedSuppErr; /* Saved value of db->suppressErr */ - assert( sqlite3ExprIsInteger(pE, &i)==0 ); + assert( tdsqlite3ExprIsInteger(pE, &i)==0 ); pEList = pSelect->pEList; /* Resolve all names in the ORDER BY term expression @@ -102384,7 +102384,7 @@ static int resolveOrderByTermToExprList( db = pParse->db; savedSuppErr = db->suppressErr; db->suppressErr = 1; - rc = sqlite3ResolveExprNames(&nc, pE); + rc = tdsqlite3ResolveExprNames(&nc, pE); db->suppressErr = savedSuppErr; if( rc ) return 0; @@ -102393,7 +102393,7 @@ static int resolveOrderByTermToExprList( ** result-set entry. */ for(i=0; inExpr; i++){ - if( sqlite3ExprCompare(0, pEList->a[i].pExpr, pE, -1)<2 ){ + if( tdsqlite3ExprCompare(0, pEList->a[i].pExpr, pE, -1)<2 ){ return i+1; } } @@ -102411,7 +102411,7 @@ static void resolveOutOfRangeError( int i, /* The index (1-based) of the term out of range */ int mx /* Largest permissible value of i */ ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "%r %s BY term out of range - should be " "between 1 and %d", i, zType, mx); } @@ -102438,14 +102438,14 @@ static int resolveCompoundOrderBy( int i; ExprList *pOrderBy; ExprList *pEList; - sqlite3 *db; + tdsqlite3 *db; int moreToDo = 1; pOrderBy = pSelect->pOrderBy; if( pOrderBy==0 ) return 0; db = pParse->db; if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){ - sqlite3ErrorMsg(pParse, "too many terms in ORDER BY clause"); + tdsqlite3ErrorMsg(pParse, "too many terms in ORDER BY clause"); return 1; } for(i=0; inExpr; i++){ @@ -102465,8 +102465,8 @@ static int resolveCompoundOrderBy( int iCol = -1; Expr *pE, *pDup; if( pItem->done ) continue; - pE = sqlite3ExprSkipCollateAndLikely(pItem->pExpr); - if( sqlite3ExprIsInteger(pE, &iCol) ){ + pE = tdsqlite3ExprSkipCollateAndLikely(pItem->pExpr); + if( tdsqlite3ExprIsInteger(pE, &iCol) ){ if( iCol<=0 || iCol>pEList->nExpr ){ resolveOutOfRangeError(pParse, "ORDER", i+1, pEList->nExpr); return 1; @@ -102490,14 +102490,14 @@ static int resolveCompoundOrderBy( if( IN_RENAME_OBJECT ){ pDup = pE; }else{ - pDup = sqlite3ExprDup(db, pE, 0); + pDup = tdsqlite3ExprDup(db, pE, 0); } if( !db->mallocFailed ){ assert(pDup); iCol = resolveOrderByTermToExprList(pParse, pSelect, pDup); } if( !IN_RENAME_OBJECT ){ - sqlite3ExprDelete(db, pDup); + tdsqlite3ExprDelete(db, pDup); } } } @@ -102505,7 +102505,7 @@ static int resolveCompoundOrderBy( /* Convert the ORDER BY term into an integer column number iCol, ** taking care to preserve the COLLATE clause if it exists */ if( !IN_RENAME_OBJECT ){ - Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0); + Expr *pNew = tdsqlite3Expr(db, TK_INTEGER, 0); if( pNew==0 ) return 1; pNew->flags |= EP_IntValue; pNew->u.iValue = iCol; @@ -102518,7 +102518,7 @@ static int resolveCompoundOrderBy( assert( pParent->pLeft==pE ); pParent->pLeft = pNew; } - sqlite3ExprDelete(db, pE); + tdsqlite3ExprDelete(db, pE); pItem->u.x.iOrderByCol = (u16)iCol; } pItem->done = 1; @@ -102530,7 +102530,7 @@ static int resolveCompoundOrderBy( } for(i=0; inExpr; i++){ if( pOrderBy->a[i].done==0 ){ - sqlite3ErrorMsg(pParse, "%r ORDER BY term does not match any " + tdsqlite3ErrorMsg(pParse, "%r ORDER BY term does not match any " "column in the result set", i+1); return 1; } @@ -102548,24 +102548,24 @@ static int resolveCompoundOrderBy( ** If any errors are detected, add an error message to pParse and ** return non-zero. Return zero if no errors are seen. */ -SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy( +SQLITE_PRIVATE int tdsqlite3ResolveOrderGroupBy( Parse *pParse, /* Parsing context. Leave error messages here */ Select *pSelect, /* The SELECT statement containing the clause */ ExprList *pOrderBy, /* The ORDER BY or GROUP BY clause to be processed */ const char *zType /* "ORDER" or "GROUP" */ ){ int i; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; ExprList *pEList; struct ExprList_item *pItem; if( pOrderBy==0 || pParse->db->mallocFailed || IN_RENAME_OBJECT ) return 0; if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){ - sqlite3ErrorMsg(pParse, "too many terms in %s BY clause", zType); + tdsqlite3ErrorMsg(pParse, "too many terms in %s BY clause", zType); return 1; } pEList = pSelect->pEList; - assert( pEList!=0 ); /* sqlite3SelectNew() guarantees this */ + assert( pEList!=0 ); /* tdsqlite3SelectNew() guarantees this */ for(i=0, pItem=pOrderBy->a; inExpr; i++, pItem++){ if( pItem->u.x.iOrderByCol ){ if( pItem->u.x.iOrderByCol>pEList->nExpr ){ @@ -102587,7 +102587,7 @@ static int resolveRemoveWindowsCb(Walker *pWalker, Expr *pExpr){ UNUSED_PARAMETER(pWalker); if( ExprHasProperty(pExpr, EP_WinFunc) ){ Window *pWin = pExpr->y.pWin; - sqlite3WindowUnlinkFromSelect(pWin); + tdsqlite3WindowUnlinkFromSelect(pWin); } return WRC_Continue; } @@ -102602,7 +102602,7 @@ static void windowRemoveExprFromSelect(Select *pSelect, Expr *pExpr){ memset(&sWalker, 0, sizeof(Walker)); sWalker.xExprCallback = resolveRemoveWindowsCb; sWalker.u.pSelect = pSelect; - sqlite3WalkExpr(&sWalker, pExpr); + tdsqlite3WalkExpr(&sWalker, pExpr); } } #else @@ -102621,7 +102621,7 @@ static void windowRemoveExprFromSelect(Select *pSelect, Expr *pExpr){ ** the order-by term is an identifier that corresponds to the AS-name of ** a result-set expression, then the term resolves to a copy of the ** result-set expression. Otherwise, the expression is resolved in -** the usual way - using sqlite3ResolveExprNames(). +** the usual way - using tdsqlite3ResolveExprNames(). ** ** This routine returns the number of errors. If errors occur, then ** an appropriate error message might be left in pParse. (OOM errors @@ -102644,21 +102644,21 @@ static int resolveOrderGroupBy( pParse = pNC->pParse; for(i=0, pItem=pOrderBy->a; inExpr; i++, pItem++){ Expr *pE = pItem->pExpr; - Expr *pE2 = sqlite3ExprSkipCollateAndLikely(pE); + Expr *pE2 = tdsqlite3ExprSkipCollateAndLikely(pE); if( zType[0]!='G' ){ iCol = resolveAsName(pParse, pSelect->pEList, pE2); if( iCol>0 ){ /* If an AS-name match is found, mark this ORDER BY column as being ** a copy of the iCol-th result-set column. The subsequent call to - ** sqlite3ResolveOrderGroupBy() will convert the expression to a + ** tdsqlite3ResolveOrderGroupBy() will convert the expression to a ** copy of the iCol-th result-set expression. */ pItem->u.x.iOrderByCol = (u16)iCol; continue; } } - if( sqlite3ExprIsInteger(pE2, &iCol) ){ + if( tdsqlite3ExprIsInteger(pE2, &iCol) ){ /* The ORDER BY term is an integer constant. Again, set the column - ** number so that sqlite3ResolveOrderGroupBy() will convert the + ** number so that tdsqlite3ResolveOrderGroupBy() will convert the ** order-by term to a copy of the result-set expression */ if( iCol<1 || iCol>0xffff ){ resolveOutOfRangeError(pParse, zType, i+1, nResult); @@ -102670,11 +102670,11 @@ static int resolveOrderGroupBy( /* Otherwise, treat the ORDER BY term as an ordinary expression */ pItem->u.x.iOrderByCol = 0; - if( sqlite3ResolveExprNames(pNC, pE) ){ + if( tdsqlite3ResolveExprNames(pNC, pE) ){ return 1; } for(j=0; jpEList->nExpr; j++){ - if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){ + if( tdsqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){ /* Since this expresion is being changed into a reference ** to an identical expression in the result set, remove all Window ** objects belonging to the expression from the Select.pWin list. */ @@ -102683,7 +102683,7 @@ static int resolveOrderGroupBy( } } } - return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType); + return tdsqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType); } /* @@ -102698,7 +102698,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ int i; /* Loop counter */ ExprList *pGroupBy; /* The GROUP BY clause */ Select *pLeftmost; /* Left-most of SELECT of a compound */ - sqlite3 *db; /* Database connection */ + tdsqlite3 *db; /* Database connection */ assert( p!=0 ); @@ -102709,16 +102709,16 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ pParse = pWalker->pParse; db = pParse->db; - /* Normally sqlite3SelectExpand() will be called first and will have + /* Normally tdsqlite3SelectExpand() will be called first and will have ** already expanded this SELECT. However, if this is a subquery within - ** an expression, sqlite3ResolveExprNames() will be called without a - ** prior call to sqlite3SelectExpand(). When that happens, let - ** sqlite3SelectPrep() do all of the processing for this SELECT. - ** sqlite3SelectPrep() will invoke both sqlite3SelectExpand() and + ** an expression, tdsqlite3ResolveExprNames() will be called without a + ** prior call to tdsqlite3SelectExpand(). When that happens, let + ** tdsqlite3SelectPrep() do all of the processing for this SELECT. + ** tdsqlite3SelectPrep() will invoke both tdsqlite3SelectExpand() and ** this routine in the correct order. */ if( (p->selFlags & SF_Expanded)==0 ){ - sqlite3SelectPrep(pParse, p, pOuterNC); + tdsqlite3SelectPrep(pParse, p, pOuterNC); return (pParse->nErr || db->mallocFailed) ? WRC_Abort : WRC_Prune; } @@ -102736,7 +102736,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pParse; sNC.pWinSelect = p; - if( sqlite3ResolveExprNames(&sNC, p->pLimit) ){ + if( tdsqlite3ResolveExprNames(&sNC, p->pLimit) ){ return WRC_Abort; } @@ -102771,7 +102771,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ for(pNC=pOuterNC; pNC; pNC=pNC->pNext) nRef += pNC->nRef; if( pItem->zName ) pParse->zAuthContext = pItem->zName; - sqlite3ResolveSelectNames(pParse, pItem->pSelect, pOuterNC); + tdsqlite3ResolveSelectNames(pParse, pItem->pSelect, pOuterNC); pParse->zAuthContext = zSavedContext; if( pParse->nErr || db->mallocFailed ) return WRC_Abort; @@ -102781,7 +102781,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ } } - /* Set up the local name-context to pass to sqlite3ResolveExprNames() to + /* Set up the local name-context to pass to tdsqlite3ResolveExprNames() to ** resolve the result-set expression list. */ sNC.ncFlags = NC_AllowAgg|NC_AllowWin; @@ -102789,7 +102789,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ sNC.pNext = pOuterNC; /* Resolve names in the result set. */ - if( sqlite3ResolveExprListNames(&sNC, p->pEList) ) return WRC_Abort; + if( tdsqlite3ResolveExprListNames(&sNC, p->pEList) ) return WRC_Abort; sNC.ncFlags &= ~NC_AllowWin; /* If there are no aggregate functions in the result-set, and no GROUP BY @@ -102807,7 +102807,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ /* If a HAVING clause is present, then there must be a GROUP BY clause. */ if( p->pHaving && !pGroupBy ){ - sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING"); + tdsqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING"); return WRC_Abort; } @@ -102822,14 +102822,14 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ assert( (sNC.ncFlags & (NC_UAggInfo|NC_UUpsert))==0 ); sNC.uNC.pEList = p->pEList; sNC.ncFlags |= NC_UEList; - if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort; - if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort; + if( tdsqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort; + if( tdsqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort; /* Resolve names in table-valued-function arguments */ for(i=0; ipSrc->nSrc; i++){ struct SrcList_item *pItem = &p->pSrc->a[i]; if( pItem->fg.isTabFunc - && sqlite3ResolveExprListNames(&sNC, pItem->u1.pFuncArg) + && tdsqlite3ResolveExprListNames(&sNC, pItem->u1.pFuncArg) ){ return WRC_Abort; } @@ -102883,7 +102883,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ } for(i=0, pItem=pGroupBy->a; inExpr; i++, pItem++){ if( ExprHasProperty(pItem->pExpr, EP_Agg) ){ - sqlite3ErrorMsg(pParse, "aggregate functions are not allowed in " + tdsqlite3ErrorMsg(pParse, "aggregate functions are not allowed in " "the GROUP BY clause"); return WRC_Abort; } @@ -102894,8 +102894,8 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ if( IN_RENAME_OBJECT ){ Window *pWin; for(pWin=p->pWinDefn; pWin; pWin=pWin->pNextWin){ - if( sqlite3ResolveExprListNames(&sNC, pWin->pOrderBy) - || sqlite3ResolveExprListNames(&sNC, pWin->pPartition) + if( tdsqlite3ResolveExprListNames(&sNC, pWin->pOrderBy) + || tdsqlite3ResolveExprListNames(&sNC, pWin->pPartition) ){ return WRC_Abort; } @@ -102906,7 +102906,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ /* If this is part of a compound SELECT, check that it has the right ** number of expressions in the select list. */ if( p->pNext && p->pEList->nExpr!=p->pNext->pEList->nExpr ){ - sqlite3SelectWrongNumTermsError(pParse, p->pNext); + tdsqlite3SelectWrongNumTermsError(pParse, p->pNext); return WRC_Abort; } @@ -102974,7 +102974,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ ** An error message is left in pParse if anything is amiss. The number ** if errors is returned. */ -SQLITE_PRIVATE int sqlite3ResolveExprNames( +SQLITE_PRIVATE int tdsqlite3ResolveExprNames( NameContext *pNC, /* Namespace to resolve expressions in. */ Expr *pExpr /* The expression to be analyzed. */ ){ @@ -102991,11 +102991,11 @@ SQLITE_PRIVATE int sqlite3ResolveExprNames( w.u.pNC = pNC; #if SQLITE_MAX_EXPR_DEPTH>0 w.pParse->nHeight += pExpr->nHeight; - if( sqlite3ExprCheckHeight(w.pParse, w.pParse->nHeight) ){ + if( tdsqlite3ExprCheckHeight(w.pParse, w.pParse->nHeight) ){ return SQLITE_ERROR; } #endif - sqlite3WalkExpr(&w, pExpr); + tdsqlite3WalkExpr(&w, pExpr); #if SQLITE_MAX_EXPR_DEPTH>0 w.pParse->nHeight -= pExpr->nHeight; #endif @@ -103010,17 +103010,17 @@ SQLITE_PRIVATE int sqlite3ResolveExprNames( /* ** Resolve all names for all expression in an expression list. This is -** just like sqlite3ResolveExprNames() except that it works for an expression +** just like tdsqlite3ResolveExprNames() except that it works for an expression ** list rather than a single expression. */ -SQLITE_PRIVATE int sqlite3ResolveExprListNames( +SQLITE_PRIVATE int tdsqlite3ResolveExprListNames( NameContext *pNC, /* Namespace to resolve expressions in. */ ExprList *pList /* The expression list to be analyzed. */ ){ int i; if( pList ){ for(i=0; inExpr; i++){ - if( sqlite3ResolveExprNames(pNC, pList->a[i].pExpr) ) return WRC_Abort; + if( tdsqlite3ResolveExprNames(pNC, pList->a[i].pExpr) ) return WRC_Abort; } } return WRC_Continue; @@ -103032,13 +103032,13 @@ SQLITE_PRIVATE int sqlite3ResolveExprListNames( ** subqueries in expressions, and subqueries used as FROM clause ** terms. ** -** See sqlite3ResolveExprNames() for a description of the kinds of +** See tdsqlite3ResolveExprNames() for a description of the kinds of ** transformations that occur. ** ** All SELECT statements should have been expanded using -** sqlite3SelectExpand() prior to invoking this routine. +** tdsqlite3SelectExpand() prior to invoking this routine. */ -SQLITE_PRIVATE void sqlite3ResolveSelectNames( +SQLITE_PRIVATE void tdsqlite3ResolveSelectNames( Parse *pParse, /* The parser context */ Select *p, /* The SELECT statement being coded. */ NameContext *pOuterNC /* Name context for parent SELECT statement */ @@ -103051,7 +103051,7 @@ SQLITE_PRIVATE void sqlite3ResolveSelectNames( w.xSelectCallback2 = 0; w.pParse = pParse; w.u.pNC = pOuterNC; - sqlite3WalkSelect(&w, p); + tdsqlite3WalkSelect(&w, p); } /* @@ -103072,7 +103072,7 @@ SQLITE_PRIVATE void sqlite3ResolveSelectNames( ** ** Any errors cause an error message to be set in pParse. */ -SQLITE_PRIVATE int sqlite3ResolveSelfReference( +SQLITE_PRIVATE int tdsqlite3ResolveSelfReference( Parse *pParse, /* Parsing context */ Table *pTab, /* The table being referenced, or NULL */ int type, /* NC_IsCheck, NC_PartIdx, NC_IdxExpr, NC_GenCol, or 0 */ @@ -103102,8 +103102,8 @@ SQLITE_PRIVATE int sqlite3ResolveSelfReference( sNC.pParse = pParse; sNC.pSrcList = &sSrc; sNC.ncFlags = type | NC_IsDDL; - if( (rc = sqlite3ResolveExprNames(&sNC, pExpr))!=SQLITE_OK ) return rc; - if( pList ) rc = sqlite3ResolveExprListNames(&sNC, pList); + if( (rc = tdsqlite3ResolveExprNames(&sNC, pExpr))!=SQLITE_OK ) return rc; + if( pList ) rc = tdsqlite3ResolveExprListNames(&sNC, pList); return rc; } @@ -103132,7 +103132,7 @@ static int exprCodeVector(Parse *pParse, Expr *p, int *piToFree); /* ** Return the affinity character for a single column of a table. */ -SQLITE_PRIVATE char sqlite3TableColumnAffinity(Table *pTab, int iCol){ +SQLITE_PRIVATE char tdsqlite3TableColumnAffinity(Table *pTab, int iCol){ assert( iColnCol ); return iCol>=0 ? pTab->aCol[iCol].affinity : SQLITE_AFF_INTEGER; } @@ -103153,7 +103153,7 @@ SQLITE_PRIVATE char sqlite3TableColumnAffinity(Table *pTab, int iCol){ ** SELECT a AS b FROM t1 WHERE b; ** SELECT * FROM t1 WHERE (select a from t1); */ -SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr){ +SQLITE_PRIVATE char tdsqlite3ExprAffinity(Expr *pExpr){ int op; while( ExprHasProperty(pExpr, EP_Skip) ){ assert( pExpr->op==TK_COLLATE ); @@ -103163,26 +103163,26 @@ SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr){ op = pExpr->op; if( op==TK_SELECT ){ assert( pExpr->flags&EP_xIsSelect ); - return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr); + return tdsqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr); } if( op==TK_REGISTER ) op = pExpr->op2; #ifndef SQLITE_OMIT_CAST if( op==TK_CAST ){ assert( !ExprHasProperty(pExpr, EP_IntValue) ); - return sqlite3AffinityType(pExpr->u.zToken, 0); + return tdsqlite3AffinityType(pExpr->u.zToken, 0); } #endif if( (op==TK_AGG_COLUMN || op==TK_COLUMN) && pExpr->y.pTab ){ - return sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn); + return tdsqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn); } if( op==TK_SELECT_COLUMN ){ assert( pExpr->pLeft->flags&EP_xIsSelect ); - return sqlite3ExprAffinity( + return tdsqlite3ExprAffinity( pExpr->pLeft->x.pSelect->pEList->a[pExpr->iColumn].pExpr ); } if( op==TK_VECTOR ){ - return sqlite3ExprAffinity(pExpr->x.pList->a[0].pExpr); + return tdsqlite3ExprAffinity(pExpr->x.pList->a[0].pExpr); } return pExpr->affExpr; } @@ -103195,14 +103195,14 @@ SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr){ ** If a memory allocation error occurs, that fact is recorded in pParse->db ** and the pExpr parameter is returned unchanged. */ -SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken( +SQLITE_PRIVATE Expr *tdsqlite3ExprAddCollateToken( Parse *pParse, /* Parsing context */ Expr *pExpr, /* Add the "COLLATE" clause to this expression */ const Token *pCollName, /* Name of collating sequence */ int dequote /* True to dequote pCollName */ ){ if( pCollName->n>0 ){ - Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, dequote); + Expr *pNew = tdsqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, dequote); if( pNew ){ pNew->pLeft = pExpr; pNew->flags |= EP_Collate|EP_Skip; @@ -103211,17 +103211,17 @@ SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken( } return pExpr; } -SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){ +SQLITE_PRIVATE Expr *tdsqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){ Token s; assert( zC!=0 ); - sqlite3TokenInit(&s, (char*)zC); - return sqlite3ExprAddCollateToken(pParse, pExpr, &s, 0); + tdsqlite3TokenInit(&s, (char*)zC); + return tdsqlite3ExprAddCollateToken(pParse, pExpr, &s, 0); } /* ** Skip over any TK_COLLATE operators. */ -SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr *pExpr){ +SQLITE_PRIVATE Expr *tdsqlite3ExprSkipCollate(Expr *pExpr){ while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){ assert( pExpr->op==TK_COLLATE ); pExpr = pExpr->pLeft; @@ -103234,7 +103234,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr *pExpr){ ** or likelihood() or likely() functions at the root of an ** expression. */ -SQLITE_PRIVATE Expr *sqlite3ExprSkipCollateAndLikely(Expr *pExpr){ +SQLITE_PRIVATE Expr *tdsqlite3ExprSkipCollateAndLikely(Expr *pExpr){ while( pExpr && ExprHasProperty(pExpr, EP_Skip|EP_Unlikely) ){ if( ExprHasProperty(pExpr, EP_Unlikely) ){ assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); @@ -103253,9 +103253,9 @@ SQLITE_PRIVATE Expr *sqlite3ExprSkipCollateAndLikely(Expr *pExpr){ ** Return the collation sequence for the expression pExpr. If ** there is no defined collating sequence, return NULL. ** -** See also: sqlite3ExprNNCollSeq() +** See also: tdsqlite3ExprNNCollSeq() ** -** The sqlite3ExprNNCollSeq() works the same exact that it returns the +** The tdsqlite3ExprNNCollSeq() works the same exact that it returns the ** default collation if pExpr has no defined collation. ** ** The collating sequence might be determined by a COLLATE operator @@ -103263,8 +103263,8 @@ SQLITE_PRIVATE Expr *sqlite3ExprSkipCollateAndLikely(Expr *pExpr){ ** COLLATE operators take first precedence. Left operands take ** precedence over right operands. */ -SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){ - sqlite3 *db = pParse->db; +SQLITE_PRIVATE CollSeq *tdsqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){ + tdsqlite3 *db = pParse->db; CollSeq *pColl = 0; Expr *p = pExpr; while( p ){ @@ -103278,7 +103278,7 @@ SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){ int j = p->iColumn; if( j>=0 ){ const char *zColl = p->y.pTab->aCol[j].zColl; - pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0); + pColl = tdsqlite3FindCollSeq(db, ENC(db), zColl, 0); } break; } @@ -103291,7 +103291,7 @@ SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){ continue; } if( op==TK_COLLATE ){ - pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken); + pColl = tdsqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken); break; } if( p->flags & EP_Collate ){ @@ -103319,7 +103319,7 @@ SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){ break; } } - if( sqlite3CheckCollSeq(pParse, pColl) ){ + if( tdsqlite3CheckCollSeq(pParse, pColl) ){ pColl = 0; } return pColl; @@ -103330,13 +103330,13 @@ SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){ ** there is no defined collating sequence, return a pointer to the ** defautl collation sequence. ** -** See also: sqlite3ExprCollSeq() +** See also: tdsqlite3ExprCollSeq() ** -** The sqlite3ExprCollSeq() routine works the same except that it +** The tdsqlite3ExprCollSeq() routine works the same except that it ** returns NULL if there is no defined collation. */ -SQLITE_PRIVATE CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr){ - CollSeq *p = sqlite3ExprCollSeq(pParse, pExpr); +SQLITE_PRIVATE CollSeq *tdsqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr){ + CollSeq *p = tdsqlite3ExprCollSeq(pParse, pExpr); if( p==0 ) p = pParse->db->pDfltColl; assert( p!=0 ); return p; @@ -103345,10 +103345,10 @@ SQLITE_PRIVATE CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr){ /* ** Return TRUE if the two expressions have equivalent collating sequences. */ -SQLITE_PRIVATE int sqlite3ExprCollSeqMatch(Parse *pParse, Expr *pE1, Expr *pE2){ - CollSeq *pColl1 = sqlite3ExprNNCollSeq(pParse, pE1); - CollSeq *pColl2 = sqlite3ExprNNCollSeq(pParse, pE2); - return sqlite3StrICmp(pColl1->zName, pColl2->zName)==0; +SQLITE_PRIVATE int tdsqlite3ExprCollSeqMatch(Parse *pParse, Expr *pE1, Expr *pE2){ + CollSeq *pColl1 = tdsqlite3ExprNNCollSeq(pParse, pE1); + CollSeq *pColl2 = tdsqlite3ExprNNCollSeq(pParse, pE2); + return tdsqlite3StrICmp(pColl1->zName, pColl2->zName)==0; } /* @@ -103356,13 +103356,13 @@ SQLITE_PRIVATE int sqlite3ExprCollSeqMatch(Parse *pParse, Expr *pE1, Expr *pE2){ ** type affinity of the other operand. This routine returns the ** type affinity that should be used for the comparison operator. */ -SQLITE_PRIVATE char sqlite3CompareAffinity(Expr *pExpr, char aff2){ - char aff1 = sqlite3ExprAffinity(pExpr); +SQLITE_PRIVATE char tdsqlite3CompareAffinity(Expr *pExpr, char aff2){ + char aff1 = tdsqlite3ExprAffinity(pExpr); if( aff1>SQLITE_AFF_NONE && aff2>SQLITE_AFF_NONE ){ /* Both sides of the comparison are columns. If one has numeric ** affinity, use that. Otherwise use no affinity. */ - if( sqlite3IsNumericAffinity(aff1) || sqlite3IsNumericAffinity(aff2) ){ + if( tdsqlite3IsNumericAffinity(aff1) || tdsqlite3IsNumericAffinity(aff2) ){ return SQLITE_AFF_NUMERIC; }else{ return SQLITE_AFF_BLOB; @@ -103384,11 +103384,11 @@ static char comparisonAffinity(Expr *pExpr){ pExpr->op==TK_GT || pExpr->op==TK_GE || pExpr->op==TK_LE || pExpr->op==TK_NE || pExpr->op==TK_IS || pExpr->op==TK_ISNOT ); assert( pExpr->pLeft ); - aff = sqlite3ExprAffinity(pExpr->pLeft); + aff = tdsqlite3ExprAffinity(pExpr->pLeft); if( pExpr->pRight ){ - aff = sqlite3CompareAffinity(pExpr->pRight, aff); + aff = tdsqlite3CompareAffinity(pExpr->pRight, aff); }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){ - aff = sqlite3CompareAffinity(pExpr->x.pSelect->pEList->a[0].pExpr, aff); + aff = tdsqlite3CompareAffinity(pExpr->x.pSelect->pEList->a[0].pExpr, aff); }else if( aff==0 ){ aff = SQLITE_AFF_BLOB; } @@ -103401,7 +103401,7 @@ static char comparisonAffinity(Expr *pExpr){ ** if the index with affinity idx_affinity may be used to implement ** the comparison in pExpr. */ -SQLITE_PRIVATE int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){ +SQLITE_PRIVATE int tdsqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){ char aff = comparisonAffinity(pExpr); if( affflags & EP_Collate ){ - pColl = sqlite3ExprCollSeq(pParse, pLeft); + pColl = tdsqlite3ExprCollSeq(pParse, pLeft); }else if( pRight && (pRight->flags & EP_Collate)!=0 ){ - pColl = sqlite3ExprCollSeq(pParse, pRight); + pColl = tdsqlite3ExprCollSeq(pParse, pRight); }else{ - pColl = sqlite3ExprCollSeq(pParse, pLeft); + pColl = tdsqlite3ExprCollSeq(pParse, pLeft); if( !pColl ){ - pColl = sqlite3ExprCollSeq(pParse, pRight); + pColl = tdsqlite3ExprCollSeq(pParse, pRight); } } return pColl; @@ -103457,16 +103457,16 @@ SQLITE_PRIVATE CollSeq *sqlite3BinaryCompareCollSeq( /* Expresssion p is a comparison operator. Return a collation sequence ** appropriate for the comparison operator. ** -** This is normally just a wrapper around sqlite3BinaryCompareCollSeq(). +** This is normally just a wrapper around tdsqlite3BinaryCompareCollSeq(). ** However, if the OP_Commuted flag is set, then the order of the operands -** is reversed in the sqlite3BinaryCompareCollSeq() call so that the +** is reversed in the tdsqlite3BinaryCompareCollSeq() call so that the ** correct collating sequence is found. */ -SQLITE_PRIVATE CollSeq *sqlite3ExprCompareCollSeq(Parse *pParse, Expr *p){ +SQLITE_PRIVATE CollSeq *tdsqlite3ExprCompareCollSeq(Parse *pParse, Expr *p){ if( ExprHasProperty(p, EP_Commuted) ){ - return sqlite3BinaryCompareCollSeq(pParse, p->pRight, p->pLeft); + return tdsqlite3BinaryCompareCollSeq(pParse, p->pRight, p->pLeft); }else{ - return sqlite3BinaryCompareCollSeq(pParse, p->pLeft, p->pRight); + return tdsqlite3BinaryCompareCollSeq(pParse, p->pLeft, p->pRight); } } @@ -103489,14 +103489,14 @@ static int codeCompare( if( pParse->nErr ) return 0; if( isCommuted ){ - p4 = sqlite3BinaryCompareCollSeq(pParse, pRight, pLeft); + p4 = tdsqlite3BinaryCompareCollSeq(pParse, pRight, pLeft); }else{ - p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight); + p4 = tdsqlite3BinaryCompareCollSeq(pParse, pLeft, pRight); } p5 = binaryCompareP5(pLeft, pRight, jumpIfNull); - addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, + addr = tdsqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, (void*)p4, P4_COLLSEQ); - sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5); + tdsqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5); return addr; } @@ -103509,8 +103509,8 @@ static int codeCompare( ** But a TK_SELECT might be either a vector or a scalar. It is only ** considered a vector if it has two or more result columns. */ -SQLITE_PRIVATE int sqlite3ExprIsVector(Expr *pExpr){ - return sqlite3ExprVectorSize(pExpr)>1; +SQLITE_PRIVATE int tdsqlite3ExprIsVector(Expr *pExpr){ + return tdsqlite3ExprVectorSize(pExpr)>1; } /* @@ -103519,7 +103519,7 @@ SQLITE_PRIVATE int sqlite3ExprIsVector(Expr *pExpr){ ** is a sub-select, return the number of columns in the sub-select. For ** any other type of expression, return 1. */ -SQLITE_PRIVATE int sqlite3ExprVectorSize(Expr *pExpr){ +SQLITE_PRIVATE int tdsqlite3ExprVectorSize(Expr *pExpr){ u8 op = pExpr->op; if( op==TK_REGISTER ) op = pExpr->op2; if( op==TK_VECTOR ){ @@ -103546,9 +103546,9 @@ SQLITE_PRIVATE int sqlite3ExprVectorSize(Expr *pExpr){ ** not be ready for evaluation because the table cursor has not yet ** been positioned. */ -SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr *pVector, int i){ - assert( iop2==0 || pVector->op==TK_REGISTER ); if( pVector->op==TK_SELECT || pVector->op2==TK_SELECT ){ return pVector->x.pSelect->pEList->a[i].pExpr; @@ -103561,11 +103561,11 @@ SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr *pVector, int i){ /* ** Compute and return a new Expr object which when passed to -** sqlite3ExprCode() will generate all necessary code to compute +** tdsqlite3ExprCode() will generate all necessary code to compute ** the iField-th column of the vector expression pVector. ** ** It is ok for pVector to be a scalar (as long as iField==0). -** In that case, this routine works like sqlite3ExprDup(). +** In that case, this routine works like tdsqlite3ExprDup(). ** ** The caller owns the returned Expr object and is responsible for ** ensuring that the returned value eventually gets freed. @@ -103580,7 +103580,7 @@ SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr *pVector, int i){ ** the returned Expr object is to attach the pVector to the pRight field ** of the returned TK_SELECT_COLUMN Expr object. */ -SQLITE_PRIVATE Expr *sqlite3ExprForVectorField( +SQLITE_PRIVATE Expr *tdsqlite3ExprForVectorField( Parse *pParse, /* Parsing context */ Expr *pVector, /* The vector. List of expressions or a sub-SELECT */ int iField /* Which column of the vector to return */ @@ -103597,14 +103597,14 @@ SQLITE_PRIVATE Expr *sqlite3ExprForVectorField( ** pLeft->iTable: First in an array of register holding result, or 0 ** if the result is not yet computed. ** - ** sqlite3ExprDelete() specifically skips the recursive delete of + ** tdsqlite3ExprDelete() specifically skips the recursive delete of ** pLeft on TK_SELECT_COLUMN nodes. But pRight is followed, so pVector ** can be attached to pRight to cause this node to take ownership of ** pVector. Typically there will be multiple TK_SELECT_COLUMN nodes ** with the same pLeft pointer to the pVector, but only one of them ** will own the pVector. */ - pRet = sqlite3PExpr(pParse, TK_SELECT_COLUMN, 0, 0); + pRet = tdsqlite3PExpr(pParse, TK_SELECT_COLUMN, 0, 0); if( pRet ){ pRet->iColumn = iField; pRet->pLeft = pVector; @@ -103612,8 +103612,8 @@ SQLITE_PRIVATE Expr *sqlite3ExprForVectorField( assert( pRet==0 || pRet->iTable==0 ); }else{ if( pVector->op==TK_VECTOR ) pVector = pVector->x.pList->a[iField].pExpr; - pRet = sqlite3ExprDup(pParse->db, pVector, 0); - sqlite3RenameTokenRemap(pParse, pRet, pVector); + pRet = tdsqlite3ExprDup(pParse->db, pVector, 0); + tdsqlite3RenameTokenRemap(pParse, pRet, pVector); } return pRet; } @@ -103630,7 +103630,7 @@ static int exprCodeSubselect(Parse *pParse, Expr *pExpr){ int reg = 0; #ifndef SQLITE_OMIT_SUBQUERY if( pExpr->op==TK_SELECT ){ - reg = sqlite3CodeSubselect(pParse, pExpr); + reg = tdsqlite3CodeSubselect(pParse, pExpr); } #endif return reg; @@ -103665,7 +103665,7 @@ static int exprVectorRegister( u8 op = pVector->op; assert( op==TK_VECTOR || op==TK_REGISTER || op==TK_SELECT ); if( op==TK_REGISTER ){ - *ppExpr = sqlite3VectorFieldSubexpr(pVector, iField); + *ppExpr = tdsqlite3VectorFieldSubexpr(pVector, iField); return pVector->iTable+iField; } if( op==TK_SELECT ){ @@ -103673,7 +103673,7 @@ static int exprVectorRegister( return regSelect+iField; } *ppExpr = pVector->x.pList->a[iField].pExpr; - return sqlite3ExprCodeTemp(pParse, *ppExpr, pRegFree); + return tdsqlite3ExprCodeTemp(pParse, *ppExpr, pRegFree); } /* @@ -103697,17 +103697,17 @@ static void codeVectorCompare( Vdbe *v = pParse->pVdbe; Expr *pLeft = pExpr->pLeft; Expr *pRight = pExpr->pRight; - int nLeft = sqlite3ExprVectorSize(pLeft); + int nLeft = tdsqlite3ExprVectorSize(pLeft); int i; int regLeft = 0; int regRight = 0; u8 opx = op; - int addrDone = sqlite3VdbeMakeLabel(pParse); + int addrDone = tdsqlite3VdbeMakeLabel(pParse); int isCommuted = ExprHasProperty(pExpr,EP_Commuted); if( pParse->nErr ) return; - if( nLeft!=sqlite3ExprVectorSize(pRight) ){ - sqlite3ErrorMsg(pParse, "row value misused"); + if( nLeft!=tdsqlite3ExprVectorSize(pRight) ){ + tdsqlite3ErrorMsg(pParse, "row value misused"); return; } assert( pExpr->op==TK_EQ || pExpr->op==TK_NE @@ -103741,20 +103741,20 @@ static void codeVectorCompare( testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge); testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq); testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne); - sqlite3ReleaseTempReg(pParse, regFree1); - sqlite3ReleaseTempReg(pParse, regFree2); + tdsqlite3ReleaseTempReg(pParse, regFree1); + tdsqlite3ReleaseTempReg(pParse, regFree2); if( i==nLeft-1 ){ break; } if( opx==TK_EQ ){ - sqlite3VdbeAddOp2(v, OP_IfNot, dest, addrDone); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_IfNot, dest, addrDone); VdbeCoverage(v); p5 |= SQLITE_KEEPNULL; }else if( opx==TK_NE ){ - sqlite3VdbeAddOp2(v, OP_If, dest, addrDone); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_If, dest, addrDone); VdbeCoverage(v); p5 |= SQLITE_KEEPNULL; }else{ assert( op==TK_LT || op==TK_GT || op==TK_LE || op==TK_GE ); - sqlite3VdbeAddOp2(v, OP_ElseNotEq, 0, addrDone); + tdsqlite3VdbeAddOp2(v, OP_ElseNotEq, 0, addrDone); VdbeCoverageIf(v, op==TK_LT); VdbeCoverageIf(v, op==TK_GT); VdbeCoverageIf(v, op==TK_LE); @@ -103762,7 +103762,7 @@ static void codeVectorCompare( if( i==nLeft-2 ) opx = op; } } - sqlite3VdbeResolveLabel(v, addrDone); + tdsqlite3VdbeResolveLabel(v, addrDone); } #if SQLITE_MAX_EXPR_DEPTH>0 @@ -103771,11 +103771,11 @@ static void codeVectorCompare( ** expression depth allowed. If it is not, leave an error message in ** pParse. */ -SQLITE_PRIVATE int sqlite3ExprCheckHeight(Parse *pParse, int nHeight){ +SQLITE_PRIVATE int tdsqlite3ExprCheckHeight(Parse *pParse, int nHeight){ int rc = SQLITE_OK; int mxHeight = pParse->db->aLimit[SQLITE_LIMIT_EXPR_DEPTH]; if( nHeight>mxHeight ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "Expression tree is too large (maximum depth %d)", mxHeight ); rc = SQLITE_ERROR; @@ -103837,7 +103837,7 @@ static void exprSetHeight(Expr *p){ heightOfSelect(p->x.pSelect, &nHeight); }else if( p->x.pList ){ heightOfExprList(p->x.pList, &nHeight); - p->flags |= EP_Propagate & sqlite3ExprListFlags(p->x.pList); + p->flags |= EP_Propagate & tdsqlite3ExprListFlags(p->x.pList); } p->nHeight = nHeight + 1; } @@ -103850,17 +103850,17 @@ static void exprSetHeight(Expr *p){ ** Also propagate all EP_Propagate flags from the Expr.x.pList into ** Expr.flags. */ -SQLITE_PRIVATE void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){ +SQLITE_PRIVATE void tdsqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){ if( pParse->nErr ) return; exprSetHeight(p); - sqlite3ExprCheckHeight(pParse, p->nHeight); + tdsqlite3ExprCheckHeight(pParse, p->nHeight); } /* ** Return the maximum height of any expression tree referenced ** by the select statement passed as an argument. */ -SQLITE_PRIVATE int sqlite3SelectExprHeight(Select *p){ +SQLITE_PRIVATE int tdsqlite3SelectExprHeight(Select *p){ int nHeight = 0; heightOfSelect(p, &nHeight); return nHeight; @@ -103870,9 +103870,9 @@ SQLITE_PRIVATE int sqlite3SelectExprHeight(Select *p){ ** Propagate all EP_Propagate flags from the Expr.x.pList into ** Expr.flags. */ -SQLITE_PRIVATE void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){ +SQLITE_PRIVATE void tdsqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){ if( p && p->x.pList && !ExprHasProperty(p, EP_xIsSelect) ){ - p->flags |= EP_Propagate & sqlite3ExprListFlags(p->x.pList); + p->flags |= EP_Propagate & tdsqlite3ExprListFlags(p->x.pList); } } #define exprSetHeight(y) @@ -103883,7 +103883,7 @@ SQLITE_PRIVATE void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){ ** ** Construct a new expression node and return a pointer to it. Memory ** for this node and for the pToken argument is a single allocation -** obtained from sqlite3DbMalloc(). The calling function +** obtained from tdsqlite3DbMalloc(). The calling function ** is responsible for making sure the node eventually gets freed. ** ** If dequote is true, then the token (if it exists) is dequoted. @@ -103898,8 +103898,8 @@ SQLITE_PRIVATE void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){ ** into u.iValue and the EP_IntValue flag is set. No extra storage ** is allocated to hold the integer text and the dequote flag is ignored. */ -SQLITE_PRIVATE Expr *sqlite3ExprAlloc( - sqlite3 *db, /* Handle for sqlite3DbMallocRawNN() */ +SQLITE_PRIVATE Expr *tdsqlite3ExprAlloc( + tdsqlite3 *db, /* Handle for tdsqlite3DbMallocRawNN() */ int op, /* Expression opcode */ const Token *pToken, /* Token argument. Might be NULL */ int dequote /* True to dequote */ @@ -103911,12 +103911,12 @@ SQLITE_PRIVATE Expr *sqlite3ExprAlloc( assert( db!=0 ); if( pToken ){ if( op!=TK_INTEGER || pToken->z==0 - || sqlite3GetInt32(pToken->z, &iValue)==0 ){ + || tdsqlite3GetInt32(pToken->z, &iValue)==0 ){ nExtra = pToken->n+1; assert( iValue>=0 ); } } - pNew = sqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra); + pNew = tdsqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra); if( pNew ){ memset(pNew, 0, sizeof(Expr)); pNew->op = (u8)op; @@ -103930,8 +103930,8 @@ SQLITE_PRIVATE Expr *sqlite3ExprAlloc( assert( pToken->z!=0 || pToken->n==0 ); if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n); pNew->u.zToken[pToken->n] = 0; - if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){ - sqlite3DequoteExpr(pNew); + if( dequote && tdsqlite3Isquote(pNew->u.zToken[0]) ){ + tdsqlite3DequoteExpr(pNew); } } } @@ -103946,15 +103946,15 @@ SQLITE_PRIVATE Expr *sqlite3ExprAlloc( ** Allocate a new expression node from a zero-terminated token that has ** already been dequoted. */ -SQLITE_PRIVATE Expr *sqlite3Expr( - sqlite3 *db, /* Handle for sqlite3DbMallocZero() (may be null) */ +SQLITE_PRIVATE Expr *tdsqlite3Expr( + tdsqlite3 *db, /* Handle for tdsqlite3DbMallocZero() (may be null) */ int op, /* Expression opcode */ const char *zToken /* Token argument. Might be NULL */ ){ Token x; x.z = zToken; - x.n = sqlite3Strlen30(zToken); - return sqlite3ExprAlloc(db, op, &x, 0); + x.n = tdsqlite3Strlen30(zToken); + return tdsqlite3ExprAlloc(db, op, &x, 0); } /* @@ -103963,16 +103963,16 @@ SQLITE_PRIVATE Expr *sqlite3Expr( ** If pRoot==NULL that means that a memory allocation error has occurred. ** In that case, delete the subtrees pLeft and pRight. */ -SQLITE_PRIVATE void sqlite3ExprAttachSubtrees( - sqlite3 *db, +SQLITE_PRIVATE void tdsqlite3ExprAttachSubtrees( + tdsqlite3 *db, Expr *pRoot, Expr *pLeft, Expr *pRight ){ if( pRoot==0 ){ assert( db->mallocFailed ); - sqlite3ExprDelete(db, pLeft); - sqlite3ExprDelete(db, pRight); + tdsqlite3ExprDelete(db, pLeft); + tdsqlite3ExprDelete(db, pRight); }else{ if( pRight ){ pRoot->pRight = pRight; @@ -103993,23 +103993,23 @@ SQLITE_PRIVATE void sqlite3ExprAttachSubtrees( ** Expr node. Or, if an OOM error occurs, set pParse->db->mallocFailed, ** free the subtrees and return NULL. */ -SQLITE_PRIVATE Expr *sqlite3PExpr( +SQLITE_PRIVATE Expr *tdsqlite3PExpr( Parse *pParse, /* Parsing context */ int op, /* Expression opcode */ Expr *pLeft, /* Left operand */ Expr *pRight /* Right operand */ ){ Expr *p; - p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)); + p = tdsqlite3DbMallocRawNN(pParse->db, sizeof(Expr)); if( p ){ memset(p, 0, sizeof(Expr)); p->op = op & 0xff; p->iAgg = -1; - sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight); - sqlite3ExprCheckHeight(pParse, p->nHeight); + tdsqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight); + tdsqlite3ExprCheckHeight(pParse, p->nHeight); }else{ - sqlite3ExprDelete(pParse->db, pLeft); - sqlite3ExprDelete(pParse->db, pRight); + tdsqlite3ExprDelete(pParse->db, pLeft); + tdsqlite3ExprDelete(pParse->db, pRight); } return p; } @@ -104018,14 +104018,14 @@ SQLITE_PRIVATE Expr *sqlite3PExpr( ** Add pSelect to the Expr.x.pSelect field. Or, if pExpr is NULL (due ** do a memory allocation failure) then delete the pSelect object. */ -SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse *pParse, Expr *pExpr, Select *pSelect){ +SQLITE_PRIVATE void tdsqlite3PExprAddSelect(Parse *pParse, Expr *pExpr, Select *pSelect){ if( pExpr ){ pExpr->x.pSelect = pSelect; ExprSetProperty(pExpr, EP_xIsSelect|EP_Subquery); - sqlite3ExprSetHeightAndFlags(pParse, pExpr); + tdsqlite3ExprSetHeightAndFlags(pParse, pExpr); }else{ assert( pParse->db->mallocFailed ); - sqlite3SelectDelete(pParse->db, pSelect); + tdsqlite3SelectDelete(pParse->db, pSelect); } } @@ -104038,8 +104038,8 @@ SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse *pParse, Expr *pExpr, Select *pS ** of returning an AND expression, just return a constant expression with ** a value of false. */ -SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){ - sqlite3 *db = pParse->db; +SQLITE_PRIVATE Expr *tdsqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){ + tdsqlite3 *db = pParse->db; if( pLeft==0 ){ return pRight; }else if( pRight==0 ){ @@ -104047,11 +104047,11 @@ SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){ }else if( (ExprAlwaysFalse(pLeft) || ExprAlwaysFalse(pRight)) && !IN_RENAME_OBJECT ){ - sqlite3ExprDelete(db, pLeft); - sqlite3ExprDelete(db, pRight); - return sqlite3Expr(db, TK_INTEGER, "0"); + tdsqlite3ExprDelete(db, pLeft); + tdsqlite3ExprDelete(db, pRight); + return tdsqlite3Expr(db, TK_INTEGER, "0"); }else{ - return sqlite3PExpr(pParse, TK_AND, pLeft, pRight); + return tdsqlite3PExpr(pParse, TK_AND, pLeft, pRight); } } @@ -104059,27 +104059,27 @@ SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){ ** Construct a new expression node for a function with multiple ** arguments. */ -SQLITE_PRIVATE Expr *sqlite3ExprFunction( +SQLITE_PRIVATE Expr *tdsqlite3ExprFunction( Parse *pParse, /* Parsing context */ ExprList *pList, /* Argument list */ Token *pToken, /* Name of the function */ int eDistinct /* SF_Distinct or SF_ALL or 0 */ ){ Expr *pNew; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; assert( pToken ); - pNew = sqlite3ExprAlloc(db, TK_FUNCTION, pToken, 1); + pNew = tdsqlite3ExprAlloc(db, TK_FUNCTION, pToken, 1); if( pNew==0 ){ - sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */ + tdsqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */ return 0; } if( pList && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ - sqlite3ErrorMsg(pParse, "too many arguments on function %T", pToken); + tdsqlite3ErrorMsg(pParse, "too many arguments on function %T", pToken); } pNew->x.pList = pList; ExprSetProperty(pNew, EP_HasFunc); assert( !ExprHasProperty(pNew, EP_xIsSelect) ); - sqlite3ExprSetHeightAndFlags(pParse, pNew); + tdsqlite3ExprSetHeightAndFlags(pParse, pNew); if( eDistinct==SF_Distinct ) ExprSetProperty(pNew, EP_Distinct); return pNew; } @@ -104095,7 +104095,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprFunction( ** ** If the function is not usable, create an error. */ -SQLITE_PRIVATE void sqlite3ExprFunctionUsable( +SQLITE_PRIVATE void tdsqlite3ExprFunctionUsable( Parse *pParse, /* Parsing and code generating context */ Expr *pExpr, /* The function invocation */ FuncDef *pDef /* The function being invoked */ @@ -104113,7 +104113,7 @@ SQLITE_PRIVATE void sqlite3ExprFunctionUsable( ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning ** that the schema is possibly tainted). */ - sqlite3ErrorMsg(pParse, "unsafe use of %s()", pDef->zName); + tdsqlite3ErrorMsg(pParse, "unsafe use of %s()", pDef->zName); } } } @@ -104134,8 +104134,8 @@ SQLITE_PRIVATE void sqlite3ExprFunctionUsable( ** instance of the wildcard, the next sequential variable number is ** assigned. */ -SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n){ - sqlite3 *db = pParse->db; +SQLITE_PRIVATE void tdsqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n){ + tdsqlite3 *db = pParse->db; const char *z; ynVar x; @@ -104144,7 +104144,7 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n z = pExpr->u.zToken; assert( z!=0 ); assert( z[0]!=0 ); - assert( n==(u32)sqlite3Strlen30(z) ); + assert( n==(u32)tdsqlite3Strlen30(z) ); if( z[1]==0 ){ /* Wildcard of the form "?". Assign the next variable number */ assert( z[0]=='?' ); @@ -104160,14 +104160,14 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n i = z[1]-'0'; /* The common case of ?N for a single digit N */ bOk = 1; }else{ - bOk = 0==sqlite3Atoi64(&z[1], &i, n-1, SQLITE_UTF8); + bOk = 0==tdsqlite3Atoi64(&z[1], &i, n-1, SQLITE_UTF8); } testcase( i==0 ); testcase( i==1 ); testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]-1 ); testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ); if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){ - sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d", + tdsqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d", db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]); return; } @@ -104175,7 +104175,7 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n if( x>pParse->nVar ){ pParse->nVar = (int)x; doAdd = 1; - }else if( sqlite3VListNumToName(pParse->pVList, x)==0 ){ + }else if( tdsqlite3VListNumToName(pParse->pVList, x)==0 ){ doAdd = 1; } }else{ @@ -104183,26 +104183,26 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n ** number as the prior appearance of the same name, or if the name ** has never appeared before, reuse the same variable number */ - x = (ynVar)sqlite3VListNameToNum(pParse->pVList, z, n); + x = (ynVar)tdsqlite3VListNameToNum(pParse->pVList, z, n); if( x==0 ){ x = (ynVar)(++pParse->nVar); doAdd = 1; } } if( doAdd ){ - pParse->pVList = sqlite3VListAdd(db, pParse->pVList, z, n, x); + pParse->pVList = tdsqlite3VListAdd(db, pParse->pVList, z, n, x); } } pExpr->iColumn = x; if( x>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){ - sqlite3ErrorMsg(pParse, "too many SQL variables"); + tdsqlite3ErrorMsg(pParse, "too many SQL variables"); } } /* ** Recursively delete an expression tree. */ -static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){ +static SQLITE_NOINLINE void tdsqlite3ExprDeleteNN(tdsqlite3 *db, Expr *p){ assert( p!=0 ); /* Sanity check: Assert that the IntValue is non-negative if it exists */ assert( !ExprHasProperty(p, EP_IntValue) || p->u.iValue>=0 ); @@ -104220,40 +104220,40 @@ static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){ if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){ /* The Expr.x union is never used at the same time as Expr.pRight */ assert( p->x.pList==0 || p->pRight==0 ); - if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft); + if( p->pLeft && p->op!=TK_SELECT_COLUMN ) tdsqlite3ExprDeleteNN(db, p->pLeft); if( p->pRight ){ assert( !ExprHasProperty(p, EP_WinFunc) ); - sqlite3ExprDeleteNN(db, p->pRight); + tdsqlite3ExprDeleteNN(db, p->pRight); }else if( ExprHasProperty(p, EP_xIsSelect) ){ assert( !ExprHasProperty(p, EP_WinFunc) ); - sqlite3SelectDelete(db, p->x.pSelect); + tdsqlite3SelectDelete(db, p->x.pSelect); }else{ - sqlite3ExprListDelete(db, p->x.pList); + tdsqlite3ExprListDelete(db, p->x.pList); #ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(p, EP_WinFunc) ){ - sqlite3WindowDelete(db, p->y.pWin); + tdsqlite3WindowDelete(db, p->y.pWin); } #endif } } - if( ExprHasProperty(p, EP_MemToken) ) sqlite3DbFree(db, p->u.zToken); + if( ExprHasProperty(p, EP_MemToken) ) tdsqlite3DbFree(db, p->u.zToken); if( !ExprHasProperty(p, EP_Static) ){ - sqlite3DbFreeNN(db, p); + tdsqlite3DbFreeNN(db, p); } } -SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){ - if( p ) sqlite3ExprDeleteNN(db, p); +SQLITE_PRIVATE void tdsqlite3ExprDelete(tdsqlite3 *db, Expr *p){ + if( p ) tdsqlite3ExprDeleteNN(db, p); } -/* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the +/* Invoke tdsqlite3RenameExprUnmap() and tdsqlite3ExprDelete() on the ** expression. */ -SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse *pParse, Expr *p){ +SQLITE_PRIVATE void tdsqlite3ExprUnmapAndDelete(Parse *pParse, Expr *p){ if( p ){ if( IN_RENAME_OBJECT ){ - sqlite3RenameExprUnmap(pParse, p); + tdsqlite3RenameExprUnmap(pParse, p); } - sqlite3ExprDeleteNN(pParse->db, p); + tdsqlite3ExprDeleteNN(pParse->db, p); } } @@ -104336,7 +104336,7 @@ static int dupedExprStructSize(Expr *p, int flags){ static int dupedExprNodeSize(Expr *p, int flags){ int nByte = dupedExprStructSize(p, flags) & 0xfff; if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ - nByte += sqlite3Strlen30NN(p->u.zToken)+1; + nByte += tdsqlite3Strlen30NN(p->u.zToken)+1; } return ROUND8(nByte); } @@ -104366,14 +104366,14 @@ static int dupedExprSize(Expr *p, int flags){ } /* -** This function is similar to sqlite3ExprDup(), except that if pzBuffer +** This function is similar to tdsqlite3ExprDup(), except that if pzBuffer ** is not NULL then *pzBuffer is assumed to point to a buffer large enough ** to store the copy of expression p, the copies of p->u.zToken ** (if applicable), and the copies of the p->pLeft and p->pRight expressions, ** if any. Before returning, *pzBuffer is set to the first byte past the ** portion of the buffer copied into by this function. */ -static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ +static Expr *exprDup(tdsqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ Expr *pNew; /* Value to return */ u8 *zAlloc; /* Memory space from which to build Expr object */ u32 staticFlag; /* EP_Static if space not obtained from malloc */ @@ -104388,7 +104388,7 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ zAlloc = *pzBuffer; staticFlag = EP_Static; }else{ - zAlloc = sqlite3DbMallocRawNN(db, dupedExprSize(p, dupFlags)); + zAlloc = tdsqlite3DbMallocRawNN(db, dupedExprSize(p, dupFlags)); staticFlag = 0; } pNew = (Expr *)zAlloc; @@ -104403,7 +104403,7 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ const int nNewSize = nStructSize & 0xfff; int nToken; if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ - nToken = sqlite3Strlen30(p->u.zToken) + 1; + nToken = tdsqlite3Strlen30(p->u.zToken) + 1; }else{ nToken = 0; } @@ -104432,9 +104432,9 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ if( 0==((p->flags|pNew->flags) & (EP_TokenOnly|EP_Leaf)) ){ /* Fill in the pNew->x.pSelect or pNew->x.pList member. */ if( ExprHasProperty(p, EP_xIsSelect) ){ - pNew->x.pSelect = sqlite3SelectDup(db, p->x.pSelect, dupFlags); + pNew->x.pSelect = tdsqlite3SelectDup(db, p->x.pSelect, dupFlags); }else{ - pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, dupFlags); + pNew->x.pList = tdsqlite3ExprListDup(db, p->x.pList, dupFlags); } } @@ -104449,7 +104449,7 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ } #ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(p, EP_WinFunc) ){ - pNew->y.pWin = sqlite3WindowDup(db, pNew, p->y.pWin); + pNew->y.pWin = tdsqlite3WindowDup(db, pNew, p->y.pWin); assert( ExprHasProperty(pNew, EP_WinFunc) ); } #endif /* SQLITE_OMIT_WINDOWFUNC */ @@ -104463,9 +104463,9 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ assert( p->iColumn==0 || p->pRight==0 ); assert( p->pRight==0 || p->pRight==p->pLeft ); }else{ - pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0); + pNew->pLeft = tdsqlite3ExprDup(db, p->pLeft, 0); } - pNew->pRight = sqlite3ExprDup(db, p->pRight, 0); + pNew->pRight = tdsqlite3ExprDup(db, p->pRight, 0); } } } @@ -104478,18 +104478,18 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ ** and the db->mallocFailed flag set. */ #ifndef SQLITE_OMIT_CTE -static With *withDup(sqlite3 *db, With *p){ +static With *withDup(tdsqlite3 *db, With *p){ With *pRet = 0; if( p ){ - sqlite3_int64 nByte = sizeof(*p) + sizeof(p->a[0]) * (p->nCte-1); - pRet = sqlite3DbMallocZero(db, nByte); + tdsqlite3_int64 nByte = sizeof(*p) + sizeof(p->a[0]) * (p->nCte-1); + pRet = tdsqlite3DbMallocZero(db, nByte); if( pRet ){ int i; pRet->nCte = p->nCte; for(i=0; inCte; i++){ - pRet->a[i].pSelect = sqlite3SelectDup(db, p->a[i].pSelect, 0); - pRet->a[i].pCols = sqlite3ExprListDup(db, p->a[i].pCols, 0); - pRet->a[i].zName = sqlite3DbStrDup(db, p->a[i].zName); + pRet->a[i].pSelect = tdsqlite3SelectDup(db, p->a[i].pSelect, 0); + pRet->a[i].pCols = tdsqlite3ExprListDup(db, p->a[i].pCols, 0); + pRet->a[i].zName = tdsqlite3DbStrDup(db, p->a[i].zName); } } } @@ -104513,7 +104513,7 @@ static int gatherSelectWindowsCallback(Walker *pWalker, Expr *pExpr){ assert( pWin ); assert( IsWindowFunc(pExpr) ); assert( pWin->ppThis==0 ); - sqlite3WindowLink(pSelect, pWin); + tdsqlite3WindowLink(pSelect, pWin); } return WRC_Continue; } @@ -104527,7 +104527,7 @@ static void gatherSelectWindows(Select *p){ w.xSelectCallback2 = 0; w.pParse = 0; w.u.pSelect = p; - sqlite3WalkSelect(&w, p); + tdsqlite3WalkSelect(&w, p); } #endif @@ -104538,8 +104538,8 @@ static void gatherSelectWindows(Select *p){ ** be deleted (by being passed to their respective ...Delete() routines) ** without effecting the originals. ** -** The expression list, ID, and source lists return by sqlite3ExprListDup(), -** sqlite3IdListDup(), and sqlite3SrcListDup() can not be further expanded +** The expression list, ID, and source lists return by tdsqlite3ExprListDup(), +** tdsqlite3IdListDup(), and tdsqlite3SrcListDup() can not be further expanded ** by subsequent calls to sqlite*ListAppend() routines. ** ** Any tables that the SrcList might point to are not duplicated. @@ -104549,18 +104549,18 @@ static void gatherSelectWindows(Select *p){ ** truncated version of the usual Expr structure that will be stored as ** part of the in-memory representation of the database schema. */ -SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3 *db, Expr *p, int flags){ +SQLITE_PRIVATE Expr *tdsqlite3ExprDup(tdsqlite3 *db, Expr *p, int flags){ assert( flags==0 || flags==EXPRDUP_REDUCE ); return p ? exprDup(db, p, flags, 0) : 0; } -SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags){ +SQLITE_PRIVATE ExprList *tdsqlite3ExprListDup(tdsqlite3 *db, ExprList *p, int flags){ ExprList *pNew; struct ExprList_item *pItem, *pOldItem; int i; Expr *pPriorSelectCol = 0; assert( db!=0 ); if( p==0 ) return 0; - pNew = sqlite3DbMallocRawNN(db, sqlite3DbMallocSize(db, p)); + pNew = tdsqlite3DbMallocRawNN(db, tdsqlite3DbMallocSize(db, p)); if( pNew==0 ) return 0; pNew->nExpr = p->nExpr; pItem = pNew->a; @@ -104568,7 +104568,7 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags) for(i=0; inExpr; i++, pItem++, pOldItem++){ Expr *pOldExpr = pOldItem->pExpr; Expr *pNewExpr; - pItem->pExpr = sqlite3ExprDup(db, pOldExpr, flags); + pItem->pExpr = tdsqlite3ExprDup(db, pOldExpr, flags); if( pOldExpr && pOldExpr->op==TK_SELECT_COLUMN && (pNewExpr = pItem->pExpr)!=0 @@ -104585,7 +104585,7 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags) pNewExpr->pLeft = pPriorSelectCol; } } - pItem->zEName = sqlite3DbStrDup(db, pOldItem->zEName); + pItem->zEName = tdsqlite3DbStrDup(db, pOldItem->zEName); pItem->sortFlags = pOldItem->sortFlags; pItem->eEName = pOldItem->eEName; pItem->done = 0; @@ -104599,19 +104599,19 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags) /* ** If cursors, triggers, views and subqueries are all omitted from ** the build, then none of the following routines, except for -** sqlite3SelectDup(), can be called. sqlite3SelectDup() is sometimes +** tdsqlite3SelectDup(), can be called. tdsqlite3SelectDup() is sometimes ** called with a NULL argument. */ #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) \ || !defined(SQLITE_OMIT_SUBQUERY) -SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){ +SQLITE_PRIVATE SrcList *tdsqlite3SrcListDup(tdsqlite3 *db, SrcList *p, int flags){ SrcList *pNew; int i; int nByte; assert( db!=0 ); if( p==0 ) return 0; nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0); - pNew = sqlite3DbMallocRawNN(db, nByte ); + pNew = tdsqlite3DbMallocRawNN(db, nByte ); if( pNew==0 ) return 0; pNew->nSrc = pNew->nAlloc = p->nSrc; for(i=0; inSrc; i++){ @@ -104619,57 +104619,57 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){ struct SrcList_item *pOldItem = &p->a[i]; Table *pTab; pNewItem->pSchema = pOldItem->pSchema; - pNewItem->zDatabase = sqlite3DbStrDup(db, pOldItem->zDatabase); - pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName); - pNewItem->zAlias = sqlite3DbStrDup(db, pOldItem->zAlias); + pNewItem->zDatabase = tdsqlite3DbStrDup(db, pOldItem->zDatabase); + pNewItem->zName = tdsqlite3DbStrDup(db, pOldItem->zName); + pNewItem->zAlias = tdsqlite3DbStrDup(db, pOldItem->zAlias); pNewItem->fg = pOldItem->fg; pNewItem->iCursor = pOldItem->iCursor; pNewItem->addrFillSub = pOldItem->addrFillSub; pNewItem->regReturn = pOldItem->regReturn; if( pNewItem->fg.isIndexedBy ){ - pNewItem->u1.zIndexedBy = sqlite3DbStrDup(db, pOldItem->u1.zIndexedBy); + pNewItem->u1.zIndexedBy = tdsqlite3DbStrDup(db, pOldItem->u1.zIndexedBy); } pNewItem->pIBIndex = pOldItem->pIBIndex; if( pNewItem->fg.isTabFunc ){ pNewItem->u1.pFuncArg = - sqlite3ExprListDup(db, pOldItem->u1.pFuncArg, flags); + tdsqlite3ExprListDup(db, pOldItem->u1.pFuncArg, flags); } pTab = pNewItem->pTab = pOldItem->pTab; if( pTab ){ pTab->nTabRef++; } - pNewItem->pSelect = sqlite3SelectDup(db, pOldItem->pSelect, flags); - pNewItem->pOn = sqlite3ExprDup(db, pOldItem->pOn, flags); - pNewItem->pUsing = sqlite3IdListDup(db, pOldItem->pUsing); + pNewItem->pSelect = tdsqlite3SelectDup(db, pOldItem->pSelect, flags); + pNewItem->pOn = tdsqlite3ExprDup(db, pOldItem->pOn, flags); + pNewItem->pUsing = tdsqlite3IdListDup(db, pOldItem->pUsing); pNewItem->colUsed = pOldItem->colUsed; } return pNew; } -SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3 *db, IdList *p){ +SQLITE_PRIVATE IdList *tdsqlite3IdListDup(tdsqlite3 *db, IdList *p){ IdList *pNew; int i; assert( db!=0 ); if( p==0 ) return 0; - pNew = sqlite3DbMallocRawNN(db, sizeof(*pNew) ); + pNew = tdsqlite3DbMallocRawNN(db, sizeof(*pNew) ); if( pNew==0 ) return 0; pNew->nId = p->nId; - pNew->a = sqlite3DbMallocRawNN(db, p->nId*sizeof(p->a[0]) ); + pNew->a = tdsqlite3DbMallocRawNN(db, p->nId*sizeof(p->a[0]) ); if( pNew->a==0 ){ - sqlite3DbFreeNN(db, pNew); + tdsqlite3DbFreeNN(db, pNew); return 0; } /* Note that because the size of the allocation for p->a[] is not - ** necessarily a power of two, sqlite3IdListAppend() may not be called + ** necessarily a power of two, tdsqlite3IdListAppend() may not be called ** on the duplicate created by this function. */ for(i=0; inId; i++){ struct IdList_item *pNewItem = &pNew->a[i]; struct IdList_item *pOldItem = &p->a[i]; - pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName); + pNewItem->zName = tdsqlite3DbStrDup(db, pOldItem->zName); pNewItem->idx = pOldItem->idx; } return pNew; } -SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *pDup, int flags){ +SQLITE_PRIVATE Select *tdsqlite3SelectDup(tdsqlite3 *db, Select *pDup, int flags){ Select *pRet = 0; Select *pNext = 0; Select **pp = &pRet; @@ -104677,18 +104677,18 @@ SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *pDup, int flags){ assert( db!=0 ); for(p=pDup; p; p=p->pPrior){ - Select *pNew = sqlite3DbMallocRawNN(db, sizeof(*p) ); + Select *pNew = tdsqlite3DbMallocRawNN(db, sizeof(*p) ); if( pNew==0 ) break; - pNew->pEList = sqlite3ExprListDup(db, p->pEList, flags); - pNew->pSrc = sqlite3SrcListDup(db, p->pSrc, flags); - pNew->pWhere = sqlite3ExprDup(db, p->pWhere, flags); - pNew->pGroupBy = sqlite3ExprListDup(db, p->pGroupBy, flags); - pNew->pHaving = sqlite3ExprDup(db, p->pHaving, flags); - pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy, flags); + pNew->pEList = tdsqlite3ExprListDup(db, p->pEList, flags); + pNew->pSrc = tdsqlite3SrcListDup(db, p->pSrc, flags); + pNew->pWhere = tdsqlite3ExprDup(db, p->pWhere, flags); + pNew->pGroupBy = tdsqlite3ExprListDup(db, p->pGroupBy, flags); + pNew->pHaving = tdsqlite3ExprDup(db, p->pHaving, flags); + pNew->pOrderBy = tdsqlite3ExprListDup(db, p->pOrderBy, flags); pNew->op = p->op; pNew->pNext = pNext; pNew->pPrior = 0; - pNew->pLimit = sqlite3ExprDup(db, p->pLimit, flags); + pNew->pLimit = tdsqlite3ExprDup(db, p->pLimit, flags); pNew->iLimit = 0; pNew->iOffset = 0; pNew->selFlags = p->selFlags & ~SF_UsesEphemeral; @@ -104698,7 +104698,7 @@ SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *pDup, int flags){ pNew->pWith = withDup(db, p->pWith); #ifndef SQLITE_OMIT_WINDOWFUNC pNew->pWin = 0; - pNew->pWinDefn = sqlite3WindowListDup(db, p->pWinDefn); + pNew->pWinDefn = tdsqlite3WindowListDup(db, p->pWinDefn); if( p->pWin && db->mallocFailed==0 ) gatherSelectWindows(pNew); #endif pNew->selId = p->selId; @@ -104710,7 +104710,7 @@ SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *pDup, int flags){ return pRet; } #else -SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){ +SQLITE_PRIVATE Select *tdsqlite3SelectDup(tdsqlite3 *db, Select *p, int flags){ assert( p==0 ); return 0; } @@ -104722,34 +104722,34 @@ SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){ ** initially NULL, then create a new expression list. ** ** The pList argument must be either NULL or a pointer to an ExprList -** obtained from a prior call to sqlite3ExprListAppend(). This routine -** may not be used with an ExprList obtained from sqlite3ExprListDup(). +** obtained from a prior call to tdsqlite3ExprListAppend(). This routine +** may not be used with an ExprList obtained from tdsqlite3ExprListDup(). ** Reason: This routine assumes that the number of slots in pList->a[] -** is a power of two. That is true for sqlite3ExprListAppend() returns -** but is not necessarily true from the return value of sqlite3ExprListDup(). +** is a power of two. That is true for tdsqlite3ExprListAppend() returns +** but is not necessarily true from the return value of tdsqlite3ExprListDup(). ** ** If a memory allocation error occurs, the entire list is freed and ** NULL is returned. If non-NULL is returned, then it is guaranteed ** that the new entry was successfully appended. */ -SQLITE_PRIVATE ExprList *sqlite3ExprListAppend( +SQLITE_PRIVATE ExprList *tdsqlite3ExprListAppend( Parse *pParse, /* Parsing context */ ExprList *pList, /* List to which to append. Might be NULL */ Expr *pExpr /* Expression to be appended. Might be NULL */ ){ struct ExprList_item *pItem; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; assert( db!=0 ); if( pList==0 ){ - pList = sqlite3DbMallocRawNN(db, sizeof(ExprList) ); + pList = tdsqlite3DbMallocRawNN(db, sizeof(ExprList) ); if( pList==0 ){ goto no_mem; } pList->nExpr = 0; }else if( (pList->nExpr & (pList->nExpr-1))==0 ){ ExprList *pNew; - pNew = sqlite3DbRealloc(db, pList, - sizeof(*pList)+(2*(sqlite3_int64)pList->nExpr-1)*sizeof(pList->a[0])); + pNew = tdsqlite3DbRealloc(db, pList, + sizeof(*pList)+(2*(tdsqlite3_int64)pList->nExpr-1)*sizeof(pList->a[0])); if( pNew==0 ){ goto no_mem; } @@ -104764,8 +104764,8 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListAppend( no_mem: /* Avoid leaking memory if malloc has failed. */ - sqlite3ExprDelete(db, pExpr); - sqlite3ExprListDelete(db, pList); + tdsqlite3ExprDelete(db, pExpr); + tdsqlite3ExprListDelete(db, pList); return 0; } @@ -104780,13 +104780,13 @@ no_mem: ** expression list pList. In the case of a subquery on the RHS, append ** TK_SELECT_COLUMN expressions. */ -SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector( +SQLITE_PRIVATE ExprList *tdsqlite3ExprListAppendVector( Parse *pParse, /* Parsing context */ ExprList *pList, /* List to which to append. Might be NULL */ IdList *pColumns, /* List of names of LHS of the assignment */ Expr *pExpr /* Vector expression to be appended. Might be NULL */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; int n; int i; int iFirst = pList ? pList->nExpr : 0; @@ -104800,19 +104800,19 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector( ** wildcards ("*") in the result set of the SELECT must be expanded before ** we can do the size check, so defer the size check until code generation. */ - if( pExpr->op!=TK_SELECT && pColumns->nId!=(n=sqlite3ExprVectorSize(pExpr)) ){ - sqlite3ErrorMsg(pParse, "%d columns assigned %d values", + if( pExpr->op!=TK_SELECT && pColumns->nId!=(n=tdsqlite3ExprVectorSize(pExpr)) ){ + tdsqlite3ErrorMsg(pParse, "%d columns assigned %d values", pColumns->nId, n); goto vector_append_error; } for(i=0; inId; i++){ - Expr *pSubExpr = sqlite3ExprForVectorField(pParse, pExpr, i); + Expr *pSubExpr = tdsqlite3ExprForVectorField(pParse, pExpr, i); assert( pSubExpr!=0 || db->mallocFailed ); assert( pSubExpr==0 || pSubExpr->iTable==0 ); if( pSubExpr==0 ) continue; pSubExpr->iTable = pColumns->nId; - pList = sqlite3ExprListAppend(pParse, pList, pSubExpr); + pList = tdsqlite3ExprListAppend(pParse, pList, pSubExpr); if( pList ){ assert( pList->nExpr==iFirst+i+1 ); pList->a[pList->nExpr-1].zEName = pColumns->a[i].zName; @@ -104826,7 +104826,7 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector( assert( pFirst->op==TK_SELECT_COLUMN ); /* Store the SELECT statement in pRight so it will be deleted when - ** sqlite3ExprListDelete() is called */ + ** tdsqlite3ExprListDelete() is called */ pFirst->pRight = pExpr; pExpr = 0; @@ -104836,15 +104836,15 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector( } vector_append_error: - sqlite3ExprUnmapAndDelete(pParse, pExpr); - sqlite3IdListDelete(db, pColumns); + tdsqlite3ExprUnmapAndDelete(pParse, pExpr); + tdsqlite3IdListDelete(db, pColumns); return pList; } /* ** Set the sort order for the last element on the given ExprList. */ -SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList *p, int iSortOrder, int eNulls){ +SQLITE_PRIVATE void tdsqlite3ExprListSetSortOrder(ExprList *p, int iSortOrder, int eNulls){ struct ExprList_item *pItem; if( p==0 ) return; assert( p->nExpr>0 ); @@ -104882,7 +104882,7 @@ SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList *p, int iSortOrder, int ** NULL. If a memory allocation fails, the pParse->db->mallocFailed flag ** is set. */ -SQLITE_PRIVATE void sqlite3ExprListSetName( +SQLITE_PRIVATE void tdsqlite3ExprListSetName( Parse *pParse, /* Parsing context */ ExprList *pList, /* List to which to add the span. */ Token *pName, /* Name to be added */ @@ -104895,10 +104895,10 @@ SQLITE_PRIVATE void sqlite3ExprListSetName( pItem = &pList->a[pList->nExpr-1]; assert( pItem->zEName==0 ); assert( pItem->eEName==ENAME_NAME ); - pItem->zEName = sqlite3DbStrNDup(pParse->db, pName->z, pName->n); - if( dequote ) sqlite3Dequote(pItem->zEName); + pItem->zEName = tdsqlite3DbStrNDup(pParse->db, pName->z, pName->n); + if( dequote ) tdsqlite3Dequote(pItem->zEName); if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenMap(pParse, (void*)pItem->zEName, pName); + tdsqlite3RenameTokenMap(pParse, (void*)pItem->zEName, pName); } } } @@ -104911,19 +104911,19 @@ SQLITE_PRIVATE void sqlite3ExprListSetName( ** NULL. If a memory allocation fails, the pParse->db->mallocFailed flag ** is set. */ -SQLITE_PRIVATE void sqlite3ExprListSetSpan( +SQLITE_PRIVATE void tdsqlite3ExprListSetSpan( Parse *pParse, /* Parsing context */ ExprList *pList, /* List to which to add the span. */ const char *zStart, /* Start of the span */ const char *zEnd /* End of the span */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; assert( pList!=0 || db->mallocFailed!=0 ); if( pList ){ struct ExprList_item *pItem = &pList->a[pList->nExpr-1]; assert( pList->nExpr>0 ); if( pItem->zEName==0 ){ - pItem->zEName = sqlite3DbSpanDup(db, zStart, zEnd); + pItem->zEName = tdsqlite3DbSpanDup(db, zStart, zEnd); pItem->eEName = ENAME_SPAN; } } @@ -104933,7 +104933,7 @@ SQLITE_PRIVATE void sqlite3ExprListSetSpan( ** If the expression list pEList contains more than iLimit elements, ** leave an error message in pParse. */ -SQLITE_PRIVATE void sqlite3ExprListCheckLength( +SQLITE_PRIVATE void tdsqlite3ExprListCheckLength( Parse *pParse, ExprList *pEList, const char *zObject @@ -104942,25 +104942,25 @@ SQLITE_PRIVATE void sqlite3ExprListCheckLength( testcase( pEList && pEList->nExpr==mx ); testcase( pEList && pEList->nExpr==mx+1 ); if( pEList && pEList->nExpr>mx ){ - sqlite3ErrorMsg(pParse, "too many columns in %s", zObject); + tdsqlite3ErrorMsg(pParse, "too many columns in %s", zObject); } } /* ** Delete an entire expression list. */ -static SQLITE_NOINLINE void exprListDeleteNN(sqlite3 *db, ExprList *pList){ +static SQLITE_NOINLINE void exprListDeleteNN(tdsqlite3 *db, ExprList *pList){ int i = pList->nExpr; struct ExprList_item *pItem = pList->a; assert( pList->nExpr>0 ); do{ - sqlite3ExprDelete(db, pItem->pExpr); - sqlite3DbFree(db, pItem->zEName); + tdsqlite3ExprDelete(db, pItem->pExpr); + tdsqlite3DbFree(db, pItem->zEName); pItem++; }while( --i>0 ); - sqlite3DbFreeNN(db, pList); + tdsqlite3DbFreeNN(db, pList); } -SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){ +SQLITE_PRIVATE void tdsqlite3ExprListDelete(tdsqlite3 *db, ExprList *pList){ if( pList ) exprListDeleteNN(db, pList); } @@ -104968,7 +104968,7 @@ SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){ ** Return the bitwise-OR of all Expr.flags fields in the given ** ExprList. */ -SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList *pList){ +SQLITE_PRIVATE u32 tdsqlite3ExprListFlags(const ExprList *pList){ int i; u32 m = 0; assert( pList!=0 ); @@ -104987,7 +104987,7 @@ SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList *pList){ ** ** This callback is used by multiple expression walkers. */ -SQLITE_PRIVATE int sqlite3SelectWalkFail(Walker *pWalker, Select *NotUsed){ +SQLITE_PRIVATE int tdsqlite3SelectWalkFail(Walker *pWalker, Select *NotUsed){ UNUSED_PARAMETER(NotUsed); pWalker->eCode = 0; return WRC_Abort; @@ -105001,9 +105001,9 @@ SQLITE_PRIVATE int sqlite3SelectWalkFail(Walker *pWalker, Select *NotUsed){ ** "false" EP_IsFalse ** anything else 0 */ -SQLITE_PRIVATE u32 sqlite3IsTrueOrFalse(const char *zIn){ - if( sqlite3StrICmp(zIn, "true")==0 ) return EP_IsTrue; - if( sqlite3StrICmp(zIn, "false")==0 ) return EP_IsFalse; +SQLITE_PRIVATE u32 tdsqlite3IsTrueOrFalse(const char *zIn){ + if( tdsqlite3StrICmp(zIn, "true")==0 ) return EP_IsTrue; + if( tdsqlite3StrICmp(zIn, "false")==0 ) return EP_IsFalse; return 0; } @@ -105013,11 +105013,11 @@ SQLITE_PRIVATE u32 sqlite3IsTrueOrFalse(const char *zIn){ ** then convert it into an TK_TRUEFALSE term. Return non-zero if ** the conversion happened, and zero if the expression is unaltered. */ -SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr *pExpr){ +SQLITE_PRIVATE int tdsqlite3ExprIdToTrueFalse(Expr *pExpr){ u32 v; assert( pExpr->op==TK_ID || pExpr->op==TK_STRING ); if( !ExprHasProperty(pExpr, EP_Quoted) - && (v = sqlite3IsTrueOrFalse(pExpr->u.zToken))!=0 + && (v = tdsqlite3IsTrueOrFalse(pExpr->u.zToken))!=0 ){ pExpr->op = TK_TRUEFALSE; ExprSetProperty(pExpr, v); @@ -105030,11 +105030,11 @@ SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr *pExpr){ ** The argument must be a TK_TRUEFALSE Expr node. Return 1 if it is TRUE ** and 0 if it is FALSE. */ -SQLITE_PRIVATE int sqlite3ExprTruthValue(const Expr *pExpr){ - pExpr = sqlite3ExprSkipCollate((Expr*)pExpr); +SQLITE_PRIVATE int tdsqlite3ExprTruthValue(const Expr *pExpr){ + pExpr = tdsqlite3ExprSkipCollate((Expr*)pExpr); assert( pExpr->op==TK_TRUEFALSE ); - assert( sqlite3StrICmp(pExpr->u.zToken,"true")==0 - || sqlite3StrICmp(pExpr->u.zToken,"false")==0 ); + assert( tdsqlite3StrICmp(pExpr->u.zToken,"true")==0 + || tdsqlite3StrICmp(pExpr->u.zToken,"false")==0 ); return pExpr->u.zToken[4]==0; } @@ -105051,11 +105051,11 @@ SQLITE_PRIVATE int sqlite3ExprTruthValue(const Expr *pExpr){ ** (x<10) AND (y=22 OR true) => (x<10) ** (y=22) OR true => true */ -SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){ +SQLITE_PRIVATE Expr *tdsqlite3ExprSimplifiedAndOr(Expr *pExpr){ assert( pExpr!=0 ); if( pExpr->op==TK_AND || pExpr->op==TK_OR ){ - Expr *pRight = sqlite3ExprSimplifiedAndOr(pExpr->pRight); - Expr *pLeft = sqlite3ExprSimplifiedAndOr(pExpr->pLeft); + Expr *pRight = tdsqlite3ExprSimplifiedAndOr(pExpr->pRight); + Expr *pLeft = tdsqlite3ExprSimplifiedAndOr(pExpr->pLeft); if( ExprAlwaysTrue(pLeft) || ExprAlwaysFalse(pRight) ){ pExpr = pExpr->op==TK_AND ? pRight : pLeft; }else if( ExprAlwaysTrue(pRight) || ExprAlwaysFalse(pLeft) ){ @@ -105074,15 +105074,15 @@ SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){ ** ** These callback routines are used to implement the following: ** -** sqlite3ExprIsConstant() pWalker->eCode==1 -** sqlite3ExprIsConstantNotJoin() pWalker->eCode==2 -** sqlite3ExprIsTableConstant() pWalker->eCode==3 -** sqlite3ExprIsConstantOrFunction() pWalker->eCode==4 or 5 +** tdsqlite3ExprIsConstant() pWalker->eCode==1 +** tdsqlite3ExprIsConstantNotJoin() pWalker->eCode==2 +** tdsqlite3ExprIsTableConstant() pWalker->eCode==3 +** tdsqlite3ExprIsConstantOrFunction() pWalker->eCode==4 or 5 ** ** In all cases, the callbacks set Walker.eCode=0 and abort if the expression ** is found to not be a constant. ** -** The sqlite3ExprIsConstantOrFunction() is used for evaluating DEFAULT +** The tdsqlite3ExprIsConstantOrFunction() is used for evaluating DEFAULT ** expressions in a CREATE TABLE statement. The Walker.eCode value is 5 ** when parsing an existing schema out of the sqlite_master table and 4 ** when processing a new CREATE TABLE statement. A bound parameter raises @@ -105119,7 +105119,7 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){ case TK_ID: /* Convert "true" or "false" in a DEFAULT clause into the ** appropriate TK_TRUEFALSE operator */ - if( sqlite3ExprIdToTrueFalse(pExpr) ){ + if( tdsqlite3ExprIdToTrueFalse(pExpr) ){ return WRC_Prune; } /* Fall thru */ @@ -105151,14 +105151,14 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){ pExpr->op = TK_NULL; }else if( pWalker->eCode==4 ){ /* A bound parameter in a CREATE statement that originates from - ** sqlite3_prepare() causes an error */ + ** tdsqlite3_prepare() causes an error */ pWalker->eCode = 0; return WRC_Abort; } /* Fall through */ default: - testcase( pExpr->op==TK_SELECT ); /* sqlite3SelectWalkFail() disallows */ - testcase( pExpr->op==TK_EXISTS ); /* sqlite3SelectWalkFail() disallows */ + testcase( pExpr->op==TK_SELECT ); /* tdsqlite3SelectWalkFail() disallows */ + testcase( pExpr->op==TK_EXISTS ); /* tdsqlite3SelectWalkFail() disallows */ return WRC_Continue; } } @@ -105166,12 +105166,12 @@ static int exprIsConst(Expr *p, int initFlag, int iCur){ Walker w; w.eCode = initFlag; w.xExprCallback = exprNodeIsConstant; - w.xSelectCallback = sqlite3SelectWalkFail; + w.xSelectCallback = tdsqlite3SelectWalkFail; #ifdef SQLITE_DEBUG - w.xSelectCallback2 = sqlite3SelectWalkAssert2; + w.xSelectCallback2 = tdsqlite3SelectWalkAssert2; #endif w.u.iCur = iCur; - sqlite3WalkExpr(&w, p); + tdsqlite3WalkExpr(&w, p); return w.eCode; } @@ -105183,7 +105183,7 @@ static int exprIsConst(Expr *p, int initFlag, int iCur){ ** is considered a variable but a single-quoted string (ex: 'abc') is ** a constant. */ -SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){ +SQLITE_PRIVATE int tdsqlite3ExprIsConstant(Expr *p){ return exprIsConst(p, 1, 0); } @@ -105198,9 +105198,9 @@ SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){ ** ** When this routine returns true, it indicates that the expression ** can be added to the pParse->pConstExpr list and evaluated once when -** the prepared statement starts up. See sqlite3ExprCodeAtInit(). +** the prepared statement starts up. See tdsqlite3ExprCodeAtInit(). */ -SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){ +SQLITE_PRIVATE int tdsqlite3ExprIsConstantNotJoin(Expr *p){ return exprIsConst(p, 2, 0); } @@ -105210,13 +105210,13 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){ ** expression must not refer to any non-deterministic function nor any ** table other than iCur. */ -SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){ +SQLITE_PRIVATE int tdsqlite3ExprIsTableConstant(Expr *p, int iCur){ return exprIsConst(p, 3, iCur); } /* -** sqlite3WalkExpr() callback used by sqlite3ExprIsConstantOrGroupBy(). +** tdsqlite3WalkExpr() callback used by tdsqlite3ExprIsConstantOrGroupBy(). */ static int exprNodeIsConstantOrGroupBy(Walker *pWalker, Expr *pExpr){ ExprList *pGroupBy = pWalker->u.pGroupBy; @@ -105226,9 +105226,9 @@ static int exprNodeIsConstantOrGroupBy(Walker *pWalker, Expr *pExpr){ ** it constant. */ for(i=0; inExpr; i++){ Expr *p = pGroupBy->a[i].pExpr; - if( sqlite3ExprCompare(0, pExpr, p, -1)<2 ){ - CollSeq *pColl = sqlite3ExprNNCollSeq(pWalker->pParse, p); - if( sqlite3IsBinary(pColl) ){ + if( tdsqlite3ExprCompare(0, pExpr, p, -1)<2 ){ + CollSeq *pColl = tdsqlite3ExprNNCollSeq(pWalker->pParse, p); + if( tdsqlite3IsBinary(pColl) ){ return WRC_Prune; } } @@ -105262,14 +105262,14 @@ static int exprNodeIsConstantOrGroupBy(Walker *pWalker, Expr *pExpr){ ** optimization, so we take the easy way out and simply require the ** GROUP BY to use the BINARY collating sequence. */ -SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse *pParse, Expr *p, ExprList *pGroupBy){ +SQLITE_PRIVATE int tdsqlite3ExprIsConstantOrGroupBy(Parse *pParse, Expr *p, ExprList *pGroupBy){ Walker w; w.eCode = 1; w.xExprCallback = exprNodeIsConstantOrGroupBy; w.xSelectCallback = 0; w.u.pGroupBy = pGroupBy; w.pParse = pParse; - sqlite3WalkExpr(&w, p); + tdsqlite3WalkExpr(&w, p); return w.eCode; } @@ -105294,7 +105294,7 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse *pParse, Expr *p, ExprLi ** is considered a variable but a single-quoted string (ex: 'abc') is ** a constant. */ -SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr *p, u8 isInit){ +SQLITE_PRIVATE int tdsqlite3ExprIsConstantOrFunction(Expr *p, u8 isInit){ assert( isInit==0 || isInit==1 ); return exprIsConst(p, 4+isInit, 0); } @@ -105304,15 +105304,15 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr *p, u8 isInit){ ** Walk an expression tree. Return 1 if the expression contains a ** subquery of some kind. Return 0 if there are no subqueries. */ -SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr *p){ +SQLITE_PRIVATE int tdsqlite3ExprContainsSubquery(Expr *p){ Walker w; w.eCode = 1; - w.xExprCallback = sqlite3ExprWalkNoop; - w.xSelectCallback = sqlite3SelectWalkFail; + w.xExprCallback = tdsqlite3ExprWalkNoop; + w.xSelectCallback = tdsqlite3SelectWalkFail; #ifdef SQLITE_DEBUG - w.xSelectCallback2 = sqlite3SelectWalkAssert2; + w.xSelectCallback2 = tdsqlite3SelectWalkAssert2; #endif - sqlite3WalkExpr(&w, p); + tdsqlite3WalkExpr(&w, p); return w.eCode==0; } #endif @@ -105323,14 +105323,14 @@ SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr *p){ ** in *pValue. If the expression is not an integer or if it is too big ** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged. */ -SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr *p, int *pValue){ +SQLITE_PRIVATE int tdsqlite3ExprIsInteger(Expr *p, int *pValue){ int rc = 0; if( NEVER(p==0) ) return 0; /* Used to only happen following on OOM */ /* If an expression is an integer literal that fits in a signed 32-bit ** integer, then the EP_IntValue flag will have already been set */ assert( p->op!=TK_INTEGER || (p->flags & EP_IntValue)!=0 - || sqlite3GetInt32(p->u.zToken, &rc)==0 ); + || tdsqlite3GetInt32(p->u.zToken, &rc)==0 ); if( p->flags & EP_IntValue ){ *pValue = p->u.iValue; @@ -105338,12 +105338,12 @@ SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr *p, int *pValue){ } switch( p->op ){ case TK_UPLUS: { - rc = sqlite3ExprIsInteger(p->pLeft, pValue); + rc = tdsqlite3ExprIsInteger(p->pLeft, pValue); break; } case TK_UMINUS: { int v; - if( sqlite3ExprIsInteger(p->pLeft, &v) ){ + if( tdsqlite3ExprIsInteger(p->pLeft, &v) ){ assert( v!=(-2147483647-1) ); *pValue = -v; rc = 1; @@ -105369,7 +105369,7 @@ SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr *p, int *pValue){ ** will likely result in an incorrect answer. So when in doubt, return ** TRUE. */ -SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr *p){ +SQLITE_PRIVATE int tdsqlite3ExprCanBeNull(const Expr *p){ u8 op; while( p->op==TK_UPLUS || p->op==TK_UMINUS ){ p = p->pLeft; @@ -105403,7 +105403,7 @@ SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr *p){ ** is harmless. A false positive, however, can result in the wrong ** answer. */ -SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr *p, char aff){ +SQLITE_PRIVATE int tdsqlite3ExprNeedsNoAffinityChange(const Expr *p, char aff){ u8 op; int unaryMinus = 0; if( aff==SQLITE_AFF_BLOB ) return 1; @@ -105439,10 +105439,10 @@ SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr *p, char aff){ /* ** Return TRUE if the given string is a row-id column name. */ -SQLITE_PRIVATE int sqlite3IsRowid(const char *z){ - if( sqlite3StrICmp(z, "_ROWID_")==0 ) return 1; - if( sqlite3StrICmp(z, "ROWID")==0 ) return 1; - if( sqlite3StrICmp(z, "OID")==0 ) return 1; +SQLITE_PRIVATE int tdsqlite3IsRowid(const char *z){ + if( tdsqlite3StrICmp(z, "_ROWID_")==0 ) return 1; + if( tdsqlite3StrICmp(z, "ROWID")==0 ) return 1; + if( tdsqlite3StrICmp(z, "OID")==0 ) return 1; return 0; } @@ -105499,14 +105499,14 @@ static Select *isCandidateForInOpt(Expr *pX){ ** to a non-NULL value if iCur contains no NULLs. Cause register regHasNull ** to be set to NULL if iCur contains one or more NULL values. */ -static void sqlite3SetHasNullFlag(Vdbe *v, int iCur, int regHasNull){ +static void tdsqlite3SetHasNullFlag(Vdbe *v, int iCur, int regHasNull){ int addr1; - sqlite3VdbeAddOp2(v, OP_Integer, 0, regHasNull); - addr1 = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_Column, iCur, 0, regHasNull); - sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, regHasNull); + addr1 = tdsqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v); + tdsqlite3VdbeAddOp3(v, OP_Column, iCur, 0, regHasNull); + tdsqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); VdbeComment((v, "first_entry_in(%d)", iCur)); - sqlite3VdbeJumpHere(v, addr1); + tdsqlite3VdbeJumpHere(v, addr1); } #endif @@ -105516,13 +105516,13 @@ static void sqlite3SetHasNullFlag(Vdbe *v, int iCur, int regHasNull){ ** The argument is an IN operator with a list (not a subquery) on the ** right-hand side. Return TRUE if that list is constant. */ -static int sqlite3InRhsIsConstant(Expr *pIn){ +static int tdsqlite3InRhsIsConstant(Expr *pIn){ Expr *pLHS; int res; assert( !ExprHasProperty(pIn, EP_xIsSelect) ); pLHS = pIn->pLeft; pIn->pLeft = 0; - res = sqlite3ExprIsConstant(pIn); + res = tdsqlite3ExprIsConstant(pIn); pIn->pLeft = pLHS; return res; } @@ -105609,7 +105609,7 @@ static int sqlite3InRhsIsConstant(Expr *pIn){ ** then aiMap[] is populated with {2, 0, 1}. */ #ifndef SQLITE_OMIT_SUBQUERY -SQLITE_PRIVATE int sqlite3FindInIndex( +SQLITE_PRIVATE int tdsqlite3FindInIndex( Parse *pParse, /* Parsing context */ Expr *pX, /* The IN expression */ u32 inFlags, /* IN_INDEX_LOOP, _MEMBERSHIP, and/or _NOOP_OK */ @@ -105621,7 +105621,7 @@ SQLITE_PRIVATE int sqlite3FindInIndex( int eType = 0; /* Type of RHS table. IN_INDEX_* */ int iTab = pParse->nTab++; /* Cursor of the RHS table */ int mustBeUnique; /* True if RHS must be unique */ - Vdbe *v = sqlite3GetVdbe(pParse); /* Virtual machine being coded */ + Vdbe *v = tdsqlite3GetVdbe(pParse); /* Virtual machine being coded */ assert( pX->op==TK_IN ); mustBeUnique = (inFlags & IN_INDEX_LOOP)!=0; @@ -105635,7 +105635,7 @@ SQLITE_PRIVATE int sqlite3FindInIndex( int i; ExprList *pEList = pX->x.pSelect->pEList; for(i=0; inExpr; i++){ - if( sqlite3ExprCanBeNull(pEList->a[i].pExpr) ) break; + if( tdsqlite3ExprCanBeNull(pEList->a[i].pExpr) ) break; } if( i==pEList->nExpr ){ prRhsHasNull = 0; @@ -105646,7 +105646,7 @@ SQLITE_PRIVATE int sqlite3FindInIndex( ** satisfy the query. This is preferable to generating a new ** ephemeral table. */ if( pParse->nErr==0 && (p = isCandidateForInOpt(pX))!=0 ){ - sqlite3 *db = pParse->db; /* Database connection */ + tdsqlite3 *db = pParse->db; /* Database connection */ Table *pTab; /* Table . */ i16 iDb; /* Database idx for pTab */ ExprList *pEList = p->pEList; @@ -105658,21 +105658,21 @@ SQLITE_PRIVATE int sqlite3FindInIndex( pTab = p->pSrc->a[0].pTab; /* Code an OP_Transaction and OP_TableLock for
. */ - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - sqlite3CodeVerifySchema(pParse, iDb); - sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); + iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); + tdsqlite3CodeVerifySchema(pParse, iDb); + tdsqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); - assert(v); /* sqlite3GetVdbe() has always been previously called */ + assert(v); /* tdsqlite3GetVdbe() has always been previously called */ if( nExpr==1 && pEList->a[0].pExpr->iColumn<0 ){ /* The "x IN (SELECT rowid FROM table)" case */ - int iAddr = sqlite3VdbeAddOp0(v, OP_Once); + int iAddr = tdsqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); - sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead); + tdsqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead); eType = IN_INDEX_ROWID; ExplainQueryPlan((pParse, 0, "USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR",pTab->zName)); - sqlite3VdbeJumpHere(v, iAddr); + tdsqlite3VdbeJumpHere(v, iAddr); }else{ Index *pIdx; /* Iterator variable */ int affinity_ok = 1; @@ -105683,24 +105683,24 @@ SQLITE_PRIVATE int sqlite3FindInIndex( ** on the RHS of the IN operator. If it not, it is not possible to ** use any index of the RHS table. */ for(i=0; ipLeft, i); + Expr *pLhs = tdsqlite3VectorFieldSubexpr(pX->pLeft, i); int iCol = pEList->a[i].pExpr->iColumn; - char idxaff = sqlite3TableColumnAffinity(pTab,iCol); /* RHS table */ - char cmpaff = sqlite3CompareAffinity(pLhs, idxaff); + char idxaff = tdsqlite3TableColumnAffinity(pTab,iCol); /* RHS table */ + char cmpaff = tdsqlite3CompareAffinity(pLhs, idxaff); testcase( cmpaff==SQLITE_AFF_BLOB ); testcase( cmpaff==SQLITE_AFF_TEXT ); switch( cmpaff ){ case SQLITE_AFF_BLOB: break; case SQLITE_AFF_TEXT: - /* sqlite3CompareAffinity() only returns TEXT if one side or the + /* tdsqlite3CompareAffinity() only returns TEXT if one side or the ** other has no affinity and the other side is TEXT. Hence, ** the only way for cmpaff to be TEXT is for idxaff to be TEXT ** and for the term on the LHS of the IN to have no affinity. */ assert( idxaff==SQLITE_AFF_TEXT ); break; default: - affinity_ok = sqlite3IsNumericAffinity(idxaff); + affinity_ok = tdsqlite3IsNumericAffinity(idxaff); } } @@ -105726,16 +105726,16 @@ SQLITE_PRIVATE int sqlite3FindInIndex( colUsed = 0; /* Columns of index used so far */ for(i=0; ipLeft, i); + Expr *pLhs = tdsqlite3VectorFieldSubexpr(pX->pLeft, i); Expr *pRhs = pEList->a[i].pExpr; - CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs); + CollSeq *pReq = tdsqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs); int j; assert( pReq!=0 || pRhs->iColumn==XN_ROWID || pParse->nErr ); for(j=0; jaiColumn[j]!=pRhs->iColumn ) continue; assert( pIdx->azColl[j] ); - if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){ + if( pReq!=0 && tdsqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){ continue; } break; @@ -105750,11 +105750,11 @@ SQLITE_PRIVATE int sqlite3FindInIndex( assert( i==nExpr || colUsed!=(MASKBIT(nExpr)-1) ); if( colUsed==(MASKBIT(nExpr)-1) ){ /* If we reach this point, that means the index pIdx is usable */ - int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); + int iAddr = tdsqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); ExplainQueryPlan((pParse, 0, "USING INDEX %s FOR IN-OPERATOR",pIdx->zName)); - sqlite3VdbeAddOp3(v, OP_OpenRead, iTab, pIdx->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); + tdsqlite3VdbeAddOp3(v, OP_OpenRead, iTab, pIdx->tnum, iDb); + tdsqlite3VdbeSetP4KeyInfo(pParse, pIdx); VdbeComment((v, "%s", pIdx->zName)); assert( IN_INDEX_INDEX_DESC == IN_INDEX_INDEX_ASC+1 ); eType = IN_INDEX_INDEX_ASC + pIdx->aSortOrder[0]; @@ -105762,15 +105762,15 @@ SQLITE_PRIVATE int sqlite3FindInIndex( if( prRhsHasNull ){ #ifdef SQLITE_ENABLE_COLUMN_USED_MASK i64 mask = (1<nMem; if( nExpr==1 ){ - sqlite3SetHasNullFlag(v, iTab, *prRhsHasNull); + tdsqlite3SetHasNullFlag(v, iTab, *prRhsHasNull); } } - sqlite3VdbeJumpHere(v, iAddr); + tdsqlite3VdbeJumpHere(v, iAddr); } } /* End loop over indexes */ } /* End if( affinity_ok ) */ @@ -105787,7 +105787,7 @@ SQLITE_PRIVATE int sqlite3FindInIndex( if( eType==0 && (inFlags & IN_INDEX_NOOP_OK) && !ExprHasProperty(pX, EP_xIsSelect) - && (!sqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2) + && (!tdsqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2) ){ eType = IN_INDEX_NOOP; } @@ -105805,16 +105805,16 @@ SQLITE_PRIVATE int sqlite3FindInIndex( *prRhsHasNull = rMayHaveNull = ++pParse->nMem; } assert( pX->op==TK_IN ); - sqlite3CodeRhsOfIN(pParse, pX, iTab); + tdsqlite3CodeRhsOfIN(pParse, pX, iTab); if( rMayHaveNull ){ - sqlite3SetHasNullFlag(v, iTab, rMayHaveNull); + tdsqlite3SetHasNullFlag(v, iTab, rMayHaveNull); } pParse->nQueryLoop = savedNQueryLoop; } if( aiMap && eType!=IN_INDEX_INDEX_ASC && eType!=IN_INDEX_INDEX_DESC ){ int i, n; - n = sqlite3ExprVectorSize(pX->pLeft); + n = tdsqlite3ExprVectorSize(pX->pLeft); for(i=0; ipLeft; - int nVal = sqlite3ExprVectorSize(pLeft); + int nVal = tdsqlite3ExprVectorSize(pLeft); Select *pSelect = (pExpr->flags & EP_xIsSelect) ? pExpr->x.pSelect : 0; char *zRet; assert( pExpr->op==TK_IN ); - zRet = sqlite3DbMallocRaw(pParse->db, nVal+1); + zRet = tdsqlite3DbMallocRaw(pParse->db, nVal+1); if( zRet ){ int i; for(i=0; ipEList->a[i].pExpr, a); + zRet[i] = tdsqlite3CompareAffinity(pSelect->pEList->a[i].pExpr, a); }else{ zRet[i] = a; } @@ -105863,10 +105863,10 @@ static char *exprINAffinity(Parse *pParse, Expr *pExpr){ ** ** "sub-select returns N columns - expected M" */ -SQLITE_PRIVATE void sqlite3SubselectError(Parse *pParse, int nActual, int nExpect){ +SQLITE_PRIVATE void tdsqlite3SubselectError(Parse *pParse, int nActual, int nExpect){ if( pParse->nErr==0 ){ const char *zFmt = "sub-select returns %d columns - expected %d"; - sqlite3ErrorMsg(pParse, zFmt, nActual, nExpect); + tdsqlite3ErrorMsg(pParse, zFmt, nActual, nExpect); } } #endif @@ -105882,14 +105882,14 @@ SQLITE_PRIVATE void sqlite3SubselectError(Parse *pParse, int nActual, int nExpec ** ** "row value misused" */ -SQLITE_PRIVATE void sqlite3VectorErrorMsg(Parse *pParse, Expr *pExpr){ +SQLITE_PRIVATE void tdsqlite3VectorErrorMsg(Parse *pParse, Expr *pExpr){ #ifndef SQLITE_OMIT_SUBQUERY if( pExpr->flags & EP_xIsSelect ){ - sqlite3SubselectError(pParse, pExpr->x.pSelect->pEList->nExpr, 1); + tdsqlite3SubselectError(pParse, pExpr->x.pSelect->pEList->nExpr, 1); }else #endif { - sqlite3ErrorMsg(pParse, "row value misused"); + tdsqlite3ErrorMsg(pParse, "row value misused"); } } @@ -105916,7 +105916,7 @@ SQLITE_PRIVATE void sqlite3VectorErrorMsg(Parse *pParse, Expr *pExpr){ ** 'x' nor the SELECT... statement are columns, then numeric affinity ** is used. */ -SQLITE_PRIVATE void sqlite3CodeRhsOfIN( +SQLITE_PRIVATE void tdsqlite3CodeRhsOfIN( Parse *pParse, /* Parsing context */ Expr *pExpr, /* The IN operator */ int iTab /* Use this cursor number */ @@ -105947,15 +105947,15 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( ** might not have been invoked yet, so invoke it now as a subroutine. */ if( ExprHasProperty(pExpr, EP_Subrtn) ){ - addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); + addrOnce = tdsqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); if( ExprHasProperty(pExpr, EP_xIsSelect) ){ ExplainQueryPlan((pParse, 0, "REUSE LIST SUBQUERY %d", pExpr->x.pSelect->selId)); } - sqlite3VdbeAddOp2(v, OP_Gosub, pExpr->y.sub.regReturn, + tdsqlite3VdbeAddOp2(v, OP_Gosub, pExpr->y.sub.regReturn, pExpr->y.sub.iAddr); - sqlite3VdbeAddOp2(v, OP_OpenDup, iTab, pExpr->iTable); - sqlite3VdbeJumpHere(v, addrOnce); + tdsqlite3VdbeAddOp2(v, OP_OpenDup, iTab, pExpr->iTable); + tdsqlite3VdbeJumpHere(v, addrOnce); return; } @@ -105963,21 +105963,21 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( ExprSetProperty(pExpr, EP_Subrtn); pExpr->y.sub.regReturn = ++pParse->nMem; pExpr->y.sub.iAddr = - sqlite3VdbeAddOp2(v, OP_Integer, 0, pExpr->y.sub.regReturn) + 1; + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, pExpr->y.sub.regReturn) + 1; VdbeComment((v, "return address")); - addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); + addrOnce = tdsqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } /* Check to see if this is a vector IN operator */ pLeft = pExpr->pLeft; - nVal = sqlite3ExprVectorSize(pLeft); + nVal = tdsqlite3ExprVectorSize(pLeft); /* Construct the ephemeral table that will contain the content of ** RHS of the IN operator. */ pExpr->iTable = iTab; - addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, nVal); + addr = tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, nVal); #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS if( ExprHasProperty(pExpr, EP_xIsSelect) ){ VdbeComment((v, "Result of SELECT %u", pExpr->x.pSelect->selId)); @@ -105985,7 +105985,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( VdbeComment((v, "RHS of IN operator")); } #endif - pKeyInfo = sqlite3KeyInfoAlloc(pParse->db, nVal, 1); + pKeyInfo = tdsqlite3KeyInfoAlloc(pParse->db, nVal, 1); if( ExprHasProperty(pExpr, EP_xIsSelect) ){ /* Case 1: expr IN (SELECT ...) @@ -106004,24 +106004,24 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( if( ALWAYS(pEList->nExpr==nVal) ){ SelectDest dest; int i; - sqlite3SelectDestInit(&dest, SRT_Set, iTab); + tdsqlite3SelectDestInit(&dest, SRT_Set, iTab); dest.zAffSdst = exprINAffinity(pParse, pExpr); pSelect->iLimit = 0; testcase( pSelect->selFlags & SF_Distinct ); - testcase( pKeyInfo==0 ); /* Caused by OOM in sqlite3KeyInfoAlloc() */ - if( sqlite3Select(pParse, pSelect, &dest) ){ - sqlite3DbFree(pParse->db, dest.zAffSdst); - sqlite3KeyInfoUnref(pKeyInfo); + testcase( pKeyInfo==0 ); /* Caused by OOM in tdsqlite3KeyInfoAlloc() */ + if( tdsqlite3Select(pParse, pSelect, &dest) ){ + tdsqlite3DbFree(pParse->db, dest.zAffSdst); + tdsqlite3KeyInfoUnref(pKeyInfo); return; } - sqlite3DbFree(pParse->db, dest.zAffSdst); - assert( pKeyInfo!=0 ); /* OOM will cause exit after sqlite3Select() */ + tdsqlite3DbFree(pParse->db, dest.zAffSdst); + assert( pKeyInfo!=0 ); /* OOM will cause exit after tdsqlite3Select() */ assert( pEList!=0 ); assert( pEList->nExpr>0 ); - assert( sqlite3KeyInfoIsWriteable(pKeyInfo) ); + assert( tdsqlite3KeyInfoIsWriteable(pKeyInfo) ); for(i=0; iaColl[i] = sqlite3BinaryCompareCollSeq( + Expr *p = tdsqlite3VectorFieldSubexpr(pLeft, i); + pKeyInfo->aColl[i] = tdsqlite3BinaryCompareCollSeq( pParse, p, pEList->a[i].pExpr ); } @@ -106039,18 +106039,18 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( ExprList *pList = pExpr->x.pList; struct ExprList_item *pItem; int r1, r2; - affinity = sqlite3ExprAffinity(pLeft); + affinity = tdsqlite3ExprAffinity(pLeft); if( affinity<=SQLITE_AFF_NONE ){ affinity = SQLITE_AFF_BLOB; } if( pKeyInfo ){ - assert( sqlite3KeyInfoIsWriteable(pKeyInfo) ); - pKeyInfo->aColl[0] = sqlite3ExprCollSeq(pParse, pExpr->pLeft); + assert( tdsqlite3KeyInfoIsWriteable(pKeyInfo) ); + pKeyInfo->aColl[0] = tdsqlite3ExprCollSeq(pParse, pExpr->pLeft); } /* Loop through each expression in . */ - r1 = sqlite3GetTempReg(pParse); - r2 = sqlite3GetTempReg(pParse); + r1 = tdsqlite3GetTempReg(pParse); + r2 = tdsqlite3GetTempReg(pParse); for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){ Expr *pE2 = pItem->pExpr; @@ -106059,29 +106059,29 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( ** this code only executes once. Because for a non-constant ** expression we need to rerun this code each time. */ - if( addrOnce && !sqlite3ExprIsConstant(pE2) ){ - sqlite3VdbeChangeToNoop(v, addrOnce); + if( addrOnce && !tdsqlite3ExprIsConstant(pE2) ){ + tdsqlite3VdbeChangeToNoop(v, addrOnce); ExprClearProperty(pExpr, EP_Subrtn); addrOnce = 0; } /* Evaluate the expression and insert it into the temp table */ - sqlite3ExprCode(pParse, pE2, r1); - sqlite3VdbeAddOp4(v, OP_MakeRecord, r1, 1, r2, &affinity, 1); - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r1, 1); + tdsqlite3ExprCode(pParse, pE2, r1); + tdsqlite3VdbeAddOp4(v, OP_MakeRecord, r1, 1, r2, &affinity, 1); + tdsqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r1, 1); } - sqlite3ReleaseTempReg(pParse, r1); - sqlite3ReleaseTempReg(pParse, r2); + tdsqlite3ReleaseTempReg(pParse, r1); + tdsqlite3ReleaseTempReg(pParse, r2); } if( pKeyInfo ){ - sqlite3VdbeChangeP4(v, addr, (void *)pKeyInfo, P4_KEYINFO); + tdsqlite3VdbeChangeP4(v, addr, (void *)pKeyInfo, P4_KEYINFO); } if( addrOnce ){ - sqlite3VdbeJumpHere(v, addrOnce); + tdsqlite3VdbeJumpHere(v, addrOnce); /* Subroutine return */ - sqlite3VdbeAddOp1(v, OP_Return, pExpr->y.sub.regReturn); - sqlite3VdbeChangeP1(v, pExpr->y.sub.iAddr-1, sqlite3VdbeCurrentAddr(v)-1); - sqlite3ClearTempRegCache(pParse); + tdsqlite3VdbeAddOp1(v, OP_Return, pExpr->y.sub.regReturn); + tdsqlite3VdbeChangeP1(v, pExpr->y.sub.iAddr-1, tdsqlite3VdbeCurrentAddr(v)-1); + tdsqlite3ClearTempRegCache(pParse); } } #endif /* SQLITE_OMIT_SUBQUERY */ @@ -106101,7 +106101,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( ** Return 0 if an error occurs. */ #ifndef SQLITE_OMIT_SUBQUERY -SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ +SQLITE_PRIVATE int tdsqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ int addrOnce = 0; /* Address of OP_Once at top of subroutine */ int rReg = 0; /* Register storing resulting */ Select *pSel; /* SELECT statement to encode */ @@ -106132,7 +106132,7 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ ** subroutine. */ if( ExprHasProperty(pExpr, EP_Subrtn) ){ ExplainQueryPlan((pParse, 0, "REUSE SUBQUERY %d", pSel->selId)); - sqlite3VdbeAddOp2(v, OP_Gosub, pExpr->y.sub.regReturn, + tdsqlite3VdbeAddOp2(v, OP_Gosub, pExpr->y.sub.regReturn, pExpr->y.sub.iAddr); return pExpr->iTable; } @@ -106141,10 +106141,10 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ ExprSetProperty(pExpr, EP_Subrtn); pExpr->y.sub.regReturn = ++pParse->nMem; pExpr->y.sub.iAddr = - sqlite3VdbeAddOp2(v, OP_Integer, 0, pExpr->y.sub.regReturn) + 1; + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, pExpr->y.sub.regReturn) + 1; VdbeComment((v, "return address")); - addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); + addrOnce = tdsqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } /* For a SELECT, generate code to put the values for all columns of @@ -106160,49 +106160,49 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ ExplainQueryPlan((pParse, 1, "%sSCALAR SUBQUERY %d", addrOnce?"":"CORRELATED ", pSel->selId)); nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1; - sqlite3SelectDestInit(&dest, 0, pParse->nMem+1); + tdsqlite3SelectDestInit(&dest, 0, pParse->nMem+1); pParse->nMem += nReg; if( pExpr->op==TK_SELECT ){ dest.eDest = SRT_Mem; dest.iSdst = dest.iSDParm; dest.nSdst = nReg; - sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, dest.iSDParm+nReg-1); + tdsqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, dest.iSDParm+nReg-1); VdbeComment((v, "Init subquery result")); }else{ dest.eDest = SRT_Exists; - sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iSDParm); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iSDParm); VdbeComment((v, "Init EXISTS result")); } if( pSel->pLimit ){ /* The subquery already has a limit. If the pre-existing limit is X ** then make the new limit X<>0 so that the new limit is either 1 or 0 */ - sqlite3 *db = pParse->db; - pLimit = sqlite3Expr(db, TK_INTEGER, "0"); + tdsqlite3 *db = pParse->db; + pLimit = tdsqlite3Expr(db, TK_INTEGER, "0"); if( pLimit ){ pLimit->affExpr = SQLITE_AFF_NUMERIC; - pLimit = sqlite3PExpr(pParse, TK_NE, - sqlite3ExprDup(db, pSel->pLimit->pLeft, 0), pLimit); + pLimit = tdsqlite3PExpr(pParse, TK_NE, + tdsqlite3ExprDup(db, pSel->pLimit->pLeft, 0), pLimit); } - sqlite3ExprDelete(db, pSel->pLimit->pLeft); + tdsqlite3ExprDelete(db, pSel->pLimit->pLeft); pSel->pLimit->pLeft = pLimit; }else{ /* If there is no pre-existing limit add a limit of 1 */ - pLimit = sqlite3Expr(pParse->db, TK_INTEGER, "1"); - pSel->pLimit = sqlite3PExpr(pParse, TK_LIMIT, pLimit, 0); + pLimit = tdsqlite3Expr(pParse->db, TK_INTEGER, "1"); + pSel->pLimit = tdsqlite3PExpr(pParse, TK_LIMIT, pLimit, 0); } pSel->iLimit = 0; - if( sqlite3Select(pParse, pSel, &dest) ){ + if( tdsqlite3Select(pParse, pSel, &dest) ){ return 0; } pExpr->iTable = rReg = dest.iSDParm; ExprSetVVAProperty(pExpr, EP_NoReduce); if( addrOnce ){ - sqlite3VdbeJumpHere(v, addrOnce); + tdsqlite3VdbeJumpHere(v, addrOnce); /* Subroutine return */ - sqlite3VdbeAddOp1(v, OP_Return, pExpr->y.sub.regReturn); - sqlite3VdbeChangeP1(v, pExpr->y.sub.iAddr-1, sqlite3VdbeCurrentAddr(v)-1); - sqlite3ClearTempRegCache(pParse); + tdsqlite3VdbeAddOp1(v, OP_Return, pExpr->y.sub.regReturn); + tdsqlite3VdbeChangeP1(v, pExpr->y.sub.iAddr-1, tdsqlite3VdbeCurrentAddr(v)-1); + tdsqlite3ClearTempRegCache(pParse); } return rReg; @@ -106216,15 +106216,15 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ ** columns as the vector on the LHS. Or, if the RHS of the IN() is not ** a sub-query, that the LHS is a vector of size 1. */ -SQLITE_PRIVATE int sqlite3ExprCheckIN(Parse *pParse, Expr *pIn){ - int nVector = sqlite3ExprVectorSize(pIn->pLeft); +SQLITE_PRIVATE int tdsqlite3ExprCheckIN(Parse *pParse, Expr *pIn){ + int nVector = tdsqlite3ExprVectorSize(pIn->pLeft); if( (pIn->flags & EP_xIsSelect) ){ if( nVector!=pIn->x.pSelect->pEList->nExpr ){ - sqlite3SubselectError(pParse, pIn->x.pSelect->pEList->nExpr, nVector); + tdsqlite3SubselectError(pParse, pIn->x.pSelect->pEList->nExpr, nVector); return 1; } }else if( nVector!=1 ){ - sqlite3VectorErrorMsg(pParse, pIn->pLeft); + tdsqlite3VectorErrorMsg(pParse, pIn->pLeft); return 1; } return 0; @@ -106257,7 +106257,7 @@ SQLITE_PRIVATE int sqlite3ExprCheckIN(Parse *pParse, Expr *pIn){ ** See the separate in-operator.md documentation file in the canonical ** SQLite source tree for additional information. */ -static void sqlite3ExprCodeIN( +static void tdsqlite3ExprCodeIN( Parse *pParse, /* Parsing and code generating context */ Expr *pExpr, /* The IN expression */ int destIfFalse, /* Jump here if LHS is not contained in the RHS */ @@ -106282,13 +106282,13 @@ static void sqlite3ExprCodeIN( int iTab = 0; /* Index to use */ pLeft = pExpr->pLeft; - if( sqlite3ExprCheckIN(pParse, pExpr) ) return; + if( tdsqlite3ExprCheckIN(pParse, pExpr) ) return; zAff = exprINAffinity(pParse, pExpr); - nVector = sqlite3ExprVectorSize(pExpr->pLeft); - aiMap = (int*)sqlite3DbMallocZero( + nVector = tdsqlite3ExprVectorSize(pExpr->pLeft); + aiMap = (int*)tdsqlite3DbMallocZero( pParse->db, nVector*(sizeof(int) + sizeof(char)) + 1 ); - if( pParse->db->mallocFailed ) goto sqlite3ExprCodeIN_oom_error; + if( pParse->db->mallocFailed ) goto tdsqlite3ExprCodeIN_oom_error; /* Attempt to compute the RHS. After this step, if anything other than ** IN_INDEX_NOOP is returned, the table opened with cursor iTab @@ -106297,7 +106297,7 @@ static void sqlite3ExprCodeIN( v = pParse->pVdbe; assert( v!=0 ); /* OOM detected prior to this routine */ VdbeNoopComment((v, "begin IN expr")); - eType = sqlite3FindInIndex(pParse, pExpr, + eType = tdsqlite3FindInIndex(pParse, pExpr, IN_INDEX_MEMBERSHIP | IN_INDEX_NOOP_OK, destIfFalse==destIfNull ? 0 : &rRhsHasNull, aiMap, &iTab); @@ -106319,7 +106319,7 @@ static void sqlite3ExprCodeIN( ** vector, then it is stored in an array of nVector registers starting ** at r1. ** - ** sqlite3FindInIndex() might have reordered the fields of the LHS vector + ** tdsqlite3FindInIndex() might have reordered the fields of the LHS vector ** so that the fields are in the same order as an existing index. The ** aiMap[] array contains a mapping from the original LHS field order to ** the field order that matches the RHS index. @@ -106331,13 +106331,13 @@ static void sqlite3ExprCodeIN( rLhs = rLhsOrig; }else{ /* Need to reorder the LHS fields according to aiMap */ - rLhs = sqlite3GetTempRange(pParse, nVector); + rLhs = tdsqlite3GetTempRange(pParse, nVector); for(i=0; ix.pList; - CollSeq *pColl = sqlite3ExprCollSeq(pParse, pExpr->pLeft); - int labelOk = sqlite3VdbeMakeLabel(pParse); + CollSeq *pColl = tdsqlite3ExprCollSeq(pParse, pExpr->pLeft); + int labelOk = tdsqlite3VdbeMakeLabel(pParse); int r2, regToFree; int regCkNull = 0; int ii; int bLhsReal; /* True if the LHS of the IN has REAL affinity */ assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); if( destIfNull!=destIfFalse ){ - regCkNull = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_BitAnd, rLhs, rLhs, regCkNull); + regCkNull = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp3(v, OP_BitAnd, rLhs, rLhs, regCkNull); } - bLhsReal = sqlite3ExprAffinity(pExpr->pLeft)==SQLITE_AFF_REAL; + bLhsReal = tdsqlite3ExprAffinity(pExpr->pLeft)==SQLITE_AFF_REAL; for(ii=0; iinExpr; ii++){ if( bLhsReal ){ - r2 = regToFree = sqlite3GetTempReg(pParse); - sqlite3ExprCode(pParse, pList->a[ii].pExpr, r2); - sqlite3VdbeAddOp4(v, OP_Affinity, r2, 1, 0, "E", P4_STATIC); + r2 = regToFree = tdsqlite3GetTempReg(pParse); + tdsqlite3ExprCode(pParse, pList->a[ii].pExpr, r2); + tdsqlite3VdbeAddOp4(v, OP_Affinity, r2, 1, 0, "E", P4_STATIC); }else{ - r2 = sqlite3ExprCodeTemp(pParse, pList->a[ii].pExpr, ®ToFree); + r2 = tdsqlite3ExprCodeTemp(pParse, pList->a[ii].pExpr, ®ToFree); } - if( regCkNull && sqlite3ExprCanBeNull(pList->a[ii].pExpr) ){ - sqlite3VdbeAddOp3(v, OP_BitAnd, regCkNull, r2, regCkNull); + if( regCkNull && tdsqlite3ExprCanBeNull(pList->a[ii].pExpr) ){ + tdsqlite3VdbeAddOp3(v, OP_BitAnd, regCkNull, r2, regCkNull); } - sqlite3ReleaseTempReg(pParse, regToFree); + tdsqlite3ReleaseTempReg(pParse, regToFree); if( iinExpr-1 || destIfNull!=destIfFalse ){ int op = rLhs!=r2 ? OP_Eq : OP_NotNull; - sqlite3VdbeAddOp4(v, op, rLhs, labelOk, r2, + tdsqlite3VdbeAddOp4(v, op, rLhs, labelOk, r2, (void*)pColl, P4_COLLSEQ); VdbeCoverageIf(v, iinExpr-1 && op==OP_Eq); VdbeCoverageIf(v, ii==pList->nExpr-1 && op==OP_Eq); VdbeCoverageIf(v, iinExpr-1 && op==OP_NotNull); VdbeCoverageIf(v, ii==pList->nExpr-1 && op==OP_NotNull); - sqlite3VdbeChangeP5(v, zAff[0]); + tdsqlite3VdbeChangeP5(v, zAff[0]); }else{ int op = rLhs!=r2 ? OP_Ne : OP_IsNull; assert( destIfNull==destIfFalse ); - sqlite3VdbeAddOp4(v, op, rLhs, destIfFalse, r2, + tdsqlite3VdbeAddOp4(v, op, rLhs, destIfFalse, r2, (void*)pColl, P4_COLLSEQ); VdbeCoverageIf(v, op==OP_Ne); VdbeCoverageIf(v, op==OP_IsNull); - sqlite3VdbeChangeP5(v, zAff[0] | SQLITE_JUMPIFNULL); + tdsqlite3VdbeChangeP5(v, zAff[0] | SQLITE_JUMPIFNULL); } } if( regCkNull ){ - sqlite3VdbeAddOp2(v, OP_IsNull, regCkNull, destIfNull); VdbeCoverage(v); - sqlite3VdbeGoto(v, destIfFalse); + tdsqlite3VdbeAddOp2(v, OP_IsNull, regCkNull, destIfNull); VdbeCoverage(v); + tdsqlite3VdbeGoto(v, destIfFalse); } - sqlite3VdbeResolveLabel(v, labelOk); - sqlite3ReleaseTempReg(pParse, regCkNull); - goto sqlite3ExprCodeIN_finished; + tdsqlite3VdbeResolveLabel(v, labelOk); + tdsqlite3ReleaseTempReg(pParse, regCkNull); + goto tdsqlite3ExprCodeIN_finished; } /* Step 2: Check to see if the LHS contains any NULL columns. If the @@ -106404,13 +106404,13 @@ static void sqlite3ExprCodeIN( if( destIfNull==destIfFalse ){ destStep2 = destIfFalse; }else{ - destStep2 = destStep6 = sqlite3VdbeMakeLabel(pParse); + destStep2 = destStep6 = tdsqlite3VdbeMakeLabel(pParse); } - if( pParse->nErr ) goto sqlite3ExprCodeIN_finished; + if( pParse->nErr ) goto tdsqlite3ExprCodeIN_finished; for(i=0; ipLeft, i); - if( sqlite3ExprCanBeNull(p) ){ - sqlite3VdbeAddOp2(v, OP_IsNull, rLhs+i, destStep2); + Expr *p = tdsqlite3VectorFieldSubexpr(pExpr->pLeft, i); + if( tdsqlite3ExprCanBeNull(p) ){ + tdsqlite3VdbeAddOp2(v, OP_IsNull, rLhs+i, destStep2); VdbeCoverage(v); } } @@ -106423,19 +106423,19 @@ static void sqlite3ExprCodeIN( /* In this case, the RHS is the ROWID of table b-tree and so we also ** know that the RHS is non-NULL. Hence, we combine steps 3 and 4 ** into a single opcode. */ - sqlite3VdbeAddOp3(v, OP_SeekRowid, iTab, destIfFalse, rLhs); + tdsqlite3VdbeAddOp3(v, OP_SeekRowid, iTab, destIfFalse, rLhs); VdbeCoverage(v); - addrTruthOp = sqlite3VdbeAddOp0(v, OP_Goto); /* Return True */ + addrTruthOp = tdsqlite3VdbeAddOp0(v, OP_Goto); /* Return True */ }else{ - sqlite3VdbeAddOp4(v, OP_Affinity, rLhs, nVector, 0, zAff, nVector); + tdsqlite3VdbeAddOp4(v, OP_Affinity, rLhs, nVector, 0, zAff, nVector); if( destIfFalse==destIfNull ){ /* Combine Step 3 and Step 5 into a single opcode */ - sqlite3VdbeAddOp4Int(v, OP_NotFound, iTab, destIfFalse, + tdsqlite3VdbeAddOp4Int(v, OP_NotFound, iTab, destIfFalse, rLhs, nVector); VdbeCoverage(v); - goto sqlite3ExprCodeIN_finished; + goto tdsqlite3ExprCodeIN_finished; } /* Ordinary Step 3, for the case where FALSE and NULL are distinct */ - addrTruthOp = sqlite3VdbeAddOp4Int(v, OP_Found, iTab, 0, + addrTruthOp = tdsqlite3VdbeAddOp4Int(v, OP_Found, iTab, 0, rLhs, nVector); VdbeCoverage(v); } @@ -106443,14 +106443,14 @@ static void sqlite3ExprCodeIN( ** an match on the search above, then the result must be FALSE. */ if( rRhsHasNull && nVector==1 ){ - sqlite3VdbeAddOp2(v, OP_NotNull, rRhsHasNull, destIfFalse); + tdsqlite3VdbeAddOp2(v, OP_NotNull, rRhsHasNull, destIfFalse); VdbeCoverage(v); } /* Step 5. If we do not care about the difference between NULL and ** FALSE, then just return false. */ - if( destIfFalse==destIfNull ) sqlite3VdbeGoto(v, destIfFalse); + if( destIfFalse==destIfNull ) tdsqlite3VdbeGoto(v, destIfFalse); /* Step 6: Loop through rows of the RHS. Compare each row to the LHS. ** If any comparison is NULL, then the result is NULL. If all @@ -106459,11 +106459,11 @@ static void sqlite3ExprCodeIN( ** For a scalar LHS, it is sufficient to check just the first row ** of the RHS. */ - if( destStep6 ) sqlite3VdbeResolveLabel(v, destStep6); - addrTop = sqlite3VdbeAddOp2(v, OP_Rewind, iTab, destIfFalse); + if( destStep6 ) tdsqlite3VdbeResolveLabel(v, destStep6); + addrTop = tdsqlite3VdbeAddOp2(v, OP_Rewind, iTab, destIfFalse); VdbeCoverage(v); if( nVector>1 ){ - destNotNull = sqlite3VdbeMakeLabel(pParse); + destNotNull = tdsqlite3VdbeMakeLabel(pParse); }else{ /* For nVector==1, combine steps 6 and 7 by immediately returning ** FALSE if the first comparison is not NULL */ @@ -106472,35 +106472,35 @@ static void sqlite3ExprCodeIN( for(i=0; i1 ){ - sqlite3VdbeResolveLabel(v, destNotNull); - sqlite3VdbeAddOp2(v, OP_Next, iTab, addrTop+1); + tdsqlite3VdbeResolveLabel(v, destNotNull); + tdsqlite3VdbeAddOp2(v, OP_Next, iTab, addrTop+1); VdbeCoverage(v); /* Step 7: If we reach this point, we know that the result must ** be false. */ - sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfFalse); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, destIfFalse); } /* Jumps here in order to return true. */ - sqlite3VdbeJumpHere(v, addrTruthOp); + tdsqlite3VdbeJumpHere(v, addrTruthOp); -sqlite3ExprCodeIN_finished: - if( rLhs!=rLhsOrig ) sqlite3ReleaseTempReg(pParse, rLhs); +tdsqlite3ExprCodeIN_finished: + if( rLhs!=rLhsOrig ) tdsqlite3ReleaseTempReg(pParse, rLhs); VdbeComment((v, "end IN expr")); -sqlite3ExprCodeIN_oom_error: - sqlite3DbFree(pParse->db, aiMap); - sqlite3DbFree(pParse->db, zAff); +tdsqlite3ExprCodeIN_oom_error: + tdsqlite3DbFree(pParse->db, aiMap); + tdsqlite3DbFree(pParse->db, zAff); } #endif /* SQLITE_OMIT_SUBQUERY */ @@ -106516,10 +106516,10 @@ sqlite3ExprCodeIN_oom_error: static void codeReal(Vdbe *v, const char *z, int negateFlag, int iMem){ if( ALWAYS(z!=0) ){ double value; - sqlite3AtoF(z, &value, sqlite3Strlen30(z), SQLITE_UTF8); - assert( !sqlite3IsNaN(value) ); /* The new AtoF never returns NaN */ + tdsqlite3AtoF(z, &value, tdsqlite3Strlen30(z), SQLITE_UTF8); + assert( !tdsqlite3IsNaN(value) ); /* The new AtoF never returns NaN */ if( negateFlag ) value = -value; - sqlite3VdbeAddOp4Dup8(v, OP_Real, 0, iMem, 0, (u8*)&value, P4_REAL); + tdsqlite3VdbeAddOp4Dup8(v, OP_Real, 0, iMem, 0, (u8*)&value, P4_REAL); } } #endif @@ -106537,20 +106537,20 @@ static void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iMem){ int i = pExpr->u.iValue; assert( i>=0 ); if( negFlag ) i = -i; - sqlite3VdbeAddOp2(v, OP_Integer, i, iMem); + tdsqlite3VdbeAddOp2(v, OP_Integer, i, iMem); }else{ int c; i64 value; const char *z = pExpr->u.zToken; assert( z!=0 ); - c = sqlite3DecOrHexToI64(z, &value); + c = tdsqlite3DecOrHexToI64(z, &value); if( (c==3 && !negFlag) || (c==2) || (negFlag && value==SMALLEST_INT64)){ #ifdef SQLITE_OMIT_FLOATING_POINT - sqlite3ErrorMsg(pParse, "oversized integer: %s%s", negFlag ? "-" : "", z); + tdsqlite3ErrorMsg(pParse, "oversized integer: %s%s", negFlag ? "-" : "", z); #else #ifndef SQLITE_OMIT_HEX_INTEGER - if( sqlite3_strnicmp(z,"0x",2)==0 ){ - sqlite3ErrorMsg(pParse, "hex literal too big: %s%s", negFlag?"-":"",z); + if( tdsqlite3_strnicmp(z,"0x",2)==0 ){ + tdsqlite3ErrorMsg(pParse, "hex literal too big: %s%s", negFlag?"-":"",z); }else #endif { @@ -106559,7 +106559,7 @@ static void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iMem){ #endif }else{ if( negFlag ){ value = c==3 ? SMALLEST_INT64 : -value; } - sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, iMem, 0, (u8*)&value, P4_INT64); + tdsqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, iMem, 0, (u8*)&value, P4_INT64); } } } @@ -106568,7 +106568,7 @@ static void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iMem){ /* Generate code that will load into register regOut a value that is ** appropriate for the iIdxCol-th column of index pIdx. */ -SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn( +SQLITE_PRIVATE void tdsqlite3ExprCodeLoadIndexColumn( Parse *pParse, /* The parsing context */ Index *pIdx, /* The index whose column is to be loaded */ int iTabCur, /* Cursor pointing to a table row */ @@ -106580,10 +106580,10 @@ SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn( assert( pIdx->aColExpr ); assert( pIdx->aColExpr->nExpr>iIdxCol ); pParse->iSelfTab = iTabCur + 1; - sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[iIdxCol].pExpr, regOut); + tdsqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[iIdxCol].pExpr, regOut); pParse->iSelfTab = 0; }else{ - sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pIdx->pTable, iTabCur, + tdsqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pIdx->pTable, iTabCur, iTabCol, regOut); } } @@ -106593,7 +106593,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn( ** Generate code that will compute the value of generated column pCol ** and store the result in register regOut */ -SQLITE_PRIVATE void sqlite3ExprCodeGeneratedColumn( +SQLITE_PRIVATE void tdsqlite3ExprCodeGeneratedColumn( Parse *pParse, Column *pCol, int regOut @@ -106603,22 +106603,22 @@ SQLITE_PRIVATE void sqlite3ExprCodeGeneratedColumn( assert( v!=0 ); assert( pParse->iSelfTab!=0 ); if( pParse->iSelfTab>0 ){ - iAddr = sqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut); + iAddr = tdsqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut); }else{ iAddr = 0; } - sqlite3ExprCode(pParse, pCol->pDflt, regOut); + tdsqlite3ExprCode(pParse, pCol->pDflt, regOut); if( pCol->affinity>=SQLITE_AFF_TEXT ){ - sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1); + tdsqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1); } - if( iAddr ) sqlite3VdbeJumpHere(v, iAddr); + if( iAddr ) tdsqlite3VdbeJumpHere(v, iAddr); } #endif /* SQLITE_OMIT_GENERATED_COLUMNS */ /* ** Generate code to extract the value of the iCol-th column of a table. */ -SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable( +SQLITE_PRIVATE void tdsqlite3ExprCodeGetColumnOfTable( Vdbe *v, /* Parsing context */ Table *pTab, /* The table containing the value */ int iTabCur, /* The table cursor. Or the PK cursor for WITHOUT ROWID */ @@ -106628,11 +106628,11 @@ SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable( Column *pCol; assert( v!=0 ); if( pTab==0 ){ - sqlite3VdbeAddOp3(v, OP_Column, iTabCur, iCol, regOut); + tdsqlite3VdbeAddOp3(v, OP_Column, iTabCur, iCol, regOut); return; } if( iCol<0 || iCol==pTab->iPKey ){ - sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut); + tdsqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut); }else{ int op; int x; @@ -106641,30 +106641,30 @@ SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable( x = iCol; #ifndef SQLITE_OMIT_GENERATED_COLUMNS }else if( (pCol = &pTab->aCol[iCol])->colFlags & COLFLAG_VIRTUAL ){ - Parse *pParse = sqlite3VdbeParser(v); + Parse *pParse = tdsqlite3VdbeParser(v); if( pCol->colFlags & COLFLAG_BUSY ){ - sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", pCol->zName); + tdsqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", pCol->zName); }else{ int savedSelfTab = pParse->iSelfTab; pCol->colFlags |= COLFLAG_BUSY; pParse->iSelfTab = iTabCur+1; - sqlite3ExprCodeGeneratedColumn(pParse, pCol, regOut); + tdsqlite3ExprCodeGeneratedColumn(pParse, pCol, regOut); pParse->iSelfTab = savedSelfTab; pCol->colFlags &= ~COLFLAG_BUSY; } return; #endif }else if( !HasRowid(pTab) ){ - testcase( iCol!=sqlite3TableColumnToStorage(pTab, iCol) ); - x = sqlite3TableColumnToIndex(sqlite3PrimaryKeyIndex(pTab), iCol); + testcase( iCol!=tdsqlite3TableColumnToStorage(pTab, iCol) ); + x = tdsqlite3TableColumnToIndex(tdsqlite3PrimaryKeyIndex(pTab), iCol); op = OP_Column; }else{ - x = sqlite3TableColumnToStorage(pTab,iCol); + x = tdsqlite3TableColumnToStorage(pTab,iCol); testcase( x!=iCol ); op = OP_Column; } - sqlite3VdbeAddOp3(v, op, iTabCur, x, regOut); - sqlite3ColumnDefault(v, pTab, iCol, regOut); + tdsqlite3VdbeAddOp3(v, op, iTabCur, x, regOut); + tdsqlite3ColumnDefault(v, pTab, iCol, regOut); } } @@ -106675,7 +106675,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable( ** There must be an open cursor to pTab in iTable when this routine ** is called. If iColumn<0 then code is generated that extracts the rowid. */ -SQLITE_PRIVATE int sqlite3ExprCodeGetColumn( +SQLITE_PRIVATE int tdsqlite3ExprCodeGetColumn( Parse *pParse, /* Parsing and code generating context */ Table *pTab, /* Description of the table we are reading from */ int iColumn, /* Index of the table column */ @@ -106684,9 +106684,9 @@ SQLITE_PRIVATE int sqlite3ExprCodeGetColumn( u8 p5 /* P5 value for OP_Column + FLAGS */ ){ assert( pParse->pVdbe!=0 ); - sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pTab, iTable, iColumn, iReg); + tdsqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pTab, iTable, iColumn, iReg); if( p5 ){ - VdbeOp *pOp = sqlite3VdbeGetOp(pParse->pVdbe,-1); + VdbeOp *pOp = tdsqlite3VdbeGetOp(pParse->pVdbe,-1); if( pOp->opcode==OP_Column ) pOp->p5 = p5; } return iReg; @@ -106696,8 +106696,8 @@ SQLITE_PRIVATE int sqlite3ExprCodeGetColumn( ** Generate code to move content from registers iFrom...iFrom+nReg-1 ** over to iTo..iTo+nReg-1. */ -SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){ - sqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg); +SQLITE_PRIVATE void tdsqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){ + tdsqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg); } /* @@ -106706,7 +106706,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int n ** the correct value for the expression. */ static void exprToRegister(Expr *pExpr, int iReg){ - Expr *p = sqlite3ExprSkipCollateAndLikely(pExpr); + Expr *p = tdsqlite3ExprSkipCollateAndLikely(pExpr); p->op2 = p->op; p->op = TK_REGISTER; p->iTable = iReg; @@ -106725,23 +106725,23 @@ static void exprToRegister(Expr *pExpr, int iReg){ */ static int exprCodeVector(Parse *pParse, Expr *p, int *piFreeable){ int iResult; - int nResult = sqlite3ExprVectorSize(p); + int nResult = tdsqlite3ExprVectorSize(p); if( nResult==1 ){ - iResult = sqlite3ExprCodeTemp(pParse, p, piFreeable); + iResult = tdsqlite3ExprCodeTemp(pParse, p, piFreeable); }else{ *piFreeable = 0; if( p->op==TK_SELECT ){ #if SQLITE_OMIT_SUBQUERY iResult = 0; #else - iResult = sqlite3CodeSubselect(pParse, p); + iResult = tdsqlite3CodeSubselect(pParse, p); #endif }else{ int i; iResult = pParse->nMem+1; pParse->nMem += nResult; for(i=0; ix.pList->a[i].pExpr, i+iResult); + tdsqlite3ExprCodeFactorable(pParse, p->x.pList->a[i].pExpr, i+iResult); } } } @@ -106770,19 +106770,19 @@ static int exprCodeInlineFunction( ** IFNULL() functions. This avoids unnecessary evaluation of ** arguments past the first non-NULL argument. */ - int endCoalesce = sqlite3VdbeMakeLabel(pParse); + int endCoalesce = tdsqlite3VdbeMakeLabel(pParse); int i; assert( nFarg>=2 ); - sqlite3ExprCode(pParse, pFarg->a[0].pExpr, target); + tdsqlite3ExprCode(pParse, pFarg->a[0].pExpr, target); for(i=1; ia[i].pExpr, target); + tdsqlite3ExprCode(pParse, pFarg->a[i].pExpr, target); } - if( sqlite3VdbeGetOp(v, -1)->opcode==OP_Copy ){ - sqlite3VdbeChangeP5(v, 1); /* Tag trailing OP_Copy as not mergable */ + if( tdsqlite3VdbeGetOp(v, -1)->opcode==OP_Copy ){ + tdsqlite3VdbeChangeP5(v, 1); /* Tag trailing OP_Copy as not mergable */ } - sqlite3VdbeResolveLabel(v, endCoalesce); + tdsqlite3VdbeResolveLabel(v, endCoalesce); break; } @@ -106791,7 +106791,7 @@ static int exprCodeInlineFunction( ** of the first argument. */ assert( nFarg==1 || nFarg==2 ); - target = sqlite3ExprCodeTarget(pParse, pFarg->a[0].pExpr, target); + target = tdsqlite3ExprCodeTarget(pParse, pFarg->a[0].pExpr, target); break; } @@ -106800,34 +106800,34 @@ static int exprCodeInlineFunction( ** via SQLITE_TESTCTRL_INTERNAL_FUNCTIONS */ case INLINEFUNC_expr_compare: { - /* Compare two expressions using sqlite3ExprCompare() */ + /* Compare two expressions using tdsqlite3ExprCompare() */ assert( nFarg==2 ); - sqlite3VdbeAddOp2(v, OP_Integer, - sqlite3ExprCompare(0,pFarg->a[0].pExpr, pFarg->a[1].pExpr,-1), + tdsqlite3VdbeAddOp2(v, OP_Integer, + tdsqlite3ExprCompare(0,pFarg->a[0].pExpr, pFarg->a[1].pExpr,-1), target); break; } case INLINEFUNC_expr_implies_expr: { - /* Compare two expressions using sqlite3ExprImpliesExpr() */ + /* Compare two expressions using tdsqlite3ExprImpliesExpr() */ assert( nFarg==2 ); - sqlite3VdbeAddOp2(v, OP_Integer, - sqlite3ExprImpliesExpr(pParse,pFarg->a[0].pExpr, pFarg->a[1].pExpr,-1), + tdsqlite3VdbeAddOp2(v, OP_Integer, + tdsqlite3ExprImpliesExpr(pParse,pFarg->a[0].pExpr, pFarg->a[1].pExpr,-1), target); break; } case INLINEFUNC_implies_nonnull_row: { - /* REsult of sqlite3ExprImpliesNonNullRow() */ + /* REsult of tdsqlite3ExprImpliesNonNullRow() */ Expr *pA1; assert( nFarg==2 ); pA1 = pFarg->a[1].pExpr; if( pA1->op==TK_COLUMN ){ - sqlite3VdbeAddOp2(v, OP_Integer, - sqlite3ExprImpliesNonNullRow(pFarg->a[0].pExpr,pA1->iTable), + tdsqlite3VdbeAddOp2(v, OP_Integer, + tdsqlite3ExprImpliesNonNullRow(pFarg->a[0].pExpr,pA1->iTable), target); }else{ - sqlite3VdbeAddOp2(v, OP_Null, 0, target); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, target); } break; } @@ -106841,8 +106841,8 @@ static int exprCodeInlineFunction( const char *azAff[] = { "blob", "text", "numeric", "integer", "real" }; char aff; assert( nFarg==1 ); - aff = sqlite3ExprAffinity(pFarg->a[0].pExpr); - sqlite3VdbeLoadString(v, target, + aff = tdsqlite3ExprAffinity(pFarg->a[0].pExpr); + tdsqlite3VdbeLoadString(v, target, (aff<=SQLITE_AFF_NONE) ? "none" : azAff[aff-SQLITE_AFF_BLOB]); break; } @@ -106863,7 +106863,7 @@ static int exprCodeInlineFunction( ** must check the return code and move the results to the desired ** register. */ -SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ +SQLITE_PRIVATE int tdsqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ Vdbe *v = pParse->pVdbe; /* The VM under construction */ int op; /* The opcode being coded */ int inReg = target; /* Results stored in register inReg */ @@ -106893,7 +106893,7 @@ expr_code_doover: assert( pCol->iMem>0 ); return pCol->iMem; }else if( pAggInfo->useSortingIdx ){ - sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab, + tdsqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab, pCol->iSorterColumn, target); return target; } @@ -106910,9 +106910,9 @@ expr_code_doover: ** constant. */ int aff; - iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target); + iReg = tdsqlite3ExprCodeTarget(pParse, pExpr->pLeft,target); if( pExpr->y.pTab ){ - aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn); + aff = tdsqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn); }else{ aff = pExpr->affExpr; } @@ -106921,10 +106921,10 @@ expr_code_doover: assert( SQLITE_AFF_BLOB=='A' ); assert( SQLITE_AFF_TEXT=='B' ); if( iReg!=target ){ - sqlite3VdbeAddOp2(v, OP_SCopy, iReg, target); + tdsqlite3VdbeAddOp2(v, OP_SCopy, iReg, target); iReg = target; } - sqlite3VdbeAddOp4(v, OP_Affinity, iReg, 1, 0, + tdsqlite3VdbeAddOp4(v, OP_Affinity, iReg, 1, 0, &zAff[(aff-'B')*2], P4_STATIC); } return iReg; @@ -106948,26 +106948,26 @@ expr_code_doover: return -1-pParse->iSelfTab; } pCol = pTab->aCol + iCol; - testcase( iCol!=sqlite3TableColumnToStorage(pTab,iCol) ); - iSrc = sqlite3TableColumnToStorage(pTab, iCol) - pParse->iSelfTab; + testcase( iCol!=tdsqlite3TableColumnToStorage(pTab,iCol) ); + iSrc = tdsqlite3TableColumnToStorage(pTab, iCol) - pParse->iSelfTab; #ifndef SQLITE_OMIT_GENERATED_COLUMNS if( pCol->colFlags & COLFLAG_GENERATED ){ if( pCol->colFlags & COLFLAG_BUSY ){ - sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", + tdsqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", pCol->zName); return 0; } pCol->colFlags |= COLFLAG_BUSY; if( pCol->colFlags & COLFLAG_NOTAVAIL ){ - sqlite3ExprCodeGeneratedColumn(pParse, pCol, iSrc); + tdsqlite3ExprCodeGeneratedColumn(pParse, pCol, iSrc); } pCol->colFlags &= ~(COLFLAG_BUSY|COLFLAG_NOTAVAIL); return iSrc; }else #endif /* SQLITE_OMIT_GENERATED_COLUMNS */ if( pCol->affinity==SQLITE_AFF_REAL ){ - sqlite3VdbeAddOp2(v, OP_SCopy, iSrc, target); - sqlite3VdbeAddOp1(v, OP_RealAffinity, target); + tdsqlite3VdbeAddOp2(v, OP_SCopy, iSrc, target); + tdsqlite3VdbeAddOp1(v, OP_RealAffinity, target); return target; }else{ return iSrc; @@ -106978,11 +106978,11 @@ expr_code_doover: iTab = pParse->iSelfTab - 1; } } - iReg = sqlite3ExprCodeGetColumn(pParse, pExpr->y.pTab, + iReg = tdsqlite3ExprCodeGetColumn(pParse, pExpr->y.pTab, pExpr->iColumn, iTab, target, pExpr->op2); if( pExpr->y.pTab==0 && pExpr->affExpr==SQLITE_AFF_REAL ){ - sqlite3VdbeAddOp1(v, OP_RealAffinity, iReg); + tdsqlite3VdbeAddOp1(v, OP_RealAffinity, iReg); } return iReg; } @@ -106991,7 +106991,7 @@ expr_code_doover: return target; } case TK_TRUEFALSE: { - sqlite3VdbeAddOp2(v, OP_Integer, sqlite3ExprTruthValue(pExpr), target); + tdsqlite3VdbeAddOp2(v, OP_Integer, tdsqlite3ExprTruthValue(pExpr), target); return target; } #ifndef SQLITE_OMIT_FLOATING_POINT @@ -107003,7 +107003,7 @@ expr_code_doover: #endif case TK_STRING: { assert( !ExprHasProperty(pExpr, EP_IntValue) ); - sqlite3VdbeLoadString(v, target, pExpr->u.zToken); + tdsqlite3VdbeLoadString(v, target, pExpr->u.zToken); return target; } default: { @@ -107012,7 +107012,7 @@ expr_code_doover: ** sanely and not crash. But keep the assert() to bring the problem ** to the attention of the developers. */ assert( op==TK_NULL ); - sqlite3VdbeAddOp2(v, OP_Null, 0, target); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, target); return target; } #ifndef SQLITE_OMIT_BLOB_LITERAL @@ -107024,10 +107024,10 @@ expr_code_doover: assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' ); assert( pExpr->u.zToken[1]=='\'' ); z = &pExpr->u.zToken[2]; - n = sqlite3Strlen30(z) - 1; + n = tdsqlite3Strlen30(z) - 1; assert( z[n]=='\'' ); - zBlob = sqlite3HexToBlob(sqlite3VdbeDb(v), z, n); - sqlite3VdbeAddOp4(v, OP_Blob, n/2, target, 0, zBlob, P4_DYNAMIC); + zBlob = tdsqlite3HexToBlob(tdsqlite3VdbeDb(v), z, n); + tdsqlite3VdbeAddOp4(v, OP_Blob, n/2, target, 0, zBlob, P4_DYNAMIC); return target; } #endif @@ -107035,12 +107035,12 @@ expr_code_doover: assert( !ExprHasProperty(pExpr, EP_IntValue) ); assert( pExpr->u.zToken!=0 ); assert( pExpr->u.zToken[0]!=0 ); - sqlite3VdbeAddOp2(v, OP_Variable, pExpr->iColumn, target); + tdsqlite3VdbeAddOp2(v, OP_Variable, pExpr->iColumn, target); if( pExpr->u.zToken[1]!=0 ){ - const char *z = sqlite3VListNumToName(pParse->pVList, pExpr->iColumn); + const char *z = tdsqlite3VListNumToName(pParse->pVList, pExpr->iColumn); assert( pExpr->u.zToken[0]=='?' || (z && !strcmp(pExpr->u.zToken, z)) ); pParse->pVList[0] = 0; /* Indicate VList may no longer be enlarged */ - sqlite3VdbeAppendP4(v, (char*)z, P4_STATIC); + tdsqlite3VdbeAppendP4(v, (char*)z, P4_STATIC); } return target; } @@ -107050,13 +107050,13 @@ expr_code_doover: #ifndef SQLITE_OMIT_CAST case TK_CAST: { /* Expressions of the form: CAST(pLeft AS token) */ - inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); + inReg = tdsqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); if( inReg!=target ){ - sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target); + tdsqlite3VdbeAddOp2(v, OP_SCopy, inReg, target); inReg = target; } - sqlite3VdbeAddOp2(v, OP_Cast, target, - sqlite3AffinityType(pExpr->u.zToken, 0)); + tdsqlite3VdbeAddOp2(v, OP_Cast, target, + tdsqlite3AffinityType(pExpr->u.zToken, 0)); return inReg; } #endif /* SQLITE_OMIT_CAST */ @@ -107072,11 +107072,11 @@ expr_code_doover: case TK_NE: case TK_EQ: { Expr *pLeft = pExpr->pLeft; - if( sqlite3ExprIsVector(pLeft) ){ + if( tdsqlite3ExprIsVector(pLeft) ){ codeVectorCompare(pParse, pExpr, target, op, p5); }else{ - r1 = sqlite3ExprCodeTemp(pParse, pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); + r1 = tdsqlite3ExprCodeTemp(pParse, pLeft, ®Free1); + r2 = tdsqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); codeCompare(pParse, pLeft, pExpr->pRight, op, r1, r2, inReg, SQLITE_STOREP2 | p5, ExprHasProperty(pExpr,EP_Commuted)); @@ -107114,9 +107114,9 @@ expr_code_doover: assert( TK_LSHIFT==OP_ShiftLeft ); testcase( op==TK_LSHIFT ); assert( TK_RSHIFT==OP_ShiftRight ); testcase( op==TK_RSHIFT ); assert( TK_CONCAT==OP_Concat ); testcase( op==TK_CONCAT ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); - sqlite3VdbeAddOp3(v, op, r2, r1, target); + r1 = tdsqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); + r2 = tdsqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); + tdsqlite3VdbeAddOp3(v, op, r2, r1, target); testcase( regFree1==0 ); testcase( regFree2==0 ); break; @@ -107137,9 +107137,9 @@ expr_code_doover: tempX.op = TK_INTEGER; tempX.flags = EP_IntValue|EP_TokenOnly; tempX.u.iValue = 0; - r1 = sqlite3ExprCodeTemp(pParse, &tempX, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free2); - sqlite3VdbeAddOp3(v, OP_Subtract, r2, r1, target); + r1 = tdsqlite3ExprCodeTemp(pParse, &tempX, ®Free1); + r2 = tdsqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free2); + tdsqlite3VdbeAddOp3(v, OP_Subtract, r2, r1, target); testcase( regFree2==0 ); } break; @@ -107148,21 +107148,21 @@ expr_code_doover: case TK_NOT: { assert( TK_BITNOT==OP_BitNot ); testcase( op==TK_BITNOT ); assert( TK_NOT==OP_Not ); testcase( op==TK_NOT ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); + r1 = tdsqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); testcase( regFree1==0 ); - sqlite3VdbeAddOp2(v, op, r1, inReg); + tdsqlite3VdbeAddOp2(v, op, r1, inReg); break; } case TK_TRUTH: { int isTrue; /* IS TRUE or IS NOT TRUE */ int bNormal; /* IS TRUE or IS FALSE */ - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); + r1 = tdsqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); testcase( regFree1==0 ); - isTrue = sqlite3ExprTruthValue(pExpr->pRight); + isTrue = tdsqlite3ExprTruthValue(pExpr->pRight); bNormal = pExpr->op2==TK_IS; testcase( isTrue && bNormal); testcase( !isTrue && bNormal); - sqlite3VdbeAddOp4Int(v, OP_IsTrue, r1, inReg, !isTrue, isTrue ^ bNormal); + tdsqlite3VdbeAddOp4Int(v, OP_IsTrue, r1, inReg, !isTrue, isTrue ^ bNormal); break; } case TK_ISNULL: @@ -107170,21 +107170,21 @@ expr_code_doover: int addr; assert( TK_ISNULL==OP_IsNull ); testcase( op==TK_ISNULL ); assert( TK_NOTNULL==OP_NotNull ); testcase( op==TK_NOTNULL ); - sqlite3VdbeAddOp2(v, OP_Integer, 1, target); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, target); + r1 = tdsqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); testcase( regFree1==0 ); - addr = sqlite3VdbeAddOp1(v, op, r1); + addr = tdsqlite3VdbeAddOp1(v, op, r1); VdbeCoverageIf(v, op==TK_ISNULL); VdbeCoverageIf(v, op==TK_NOTNULL); - sqlite3VdbeAddOp2(v, OP_Integer, 0, target); - sqlite3VdbeJumpHere(v, addr); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, target); + tdsqlite3VdbeJumpHere(v, addr); break; } case TK_AGG_FUNCTION: { AggInfo *pInfo = pExpr->pAggInfo; if( pInfo==0 ){ assert( !ExprHasProperty(pExpr, EP_IntValue) ); - sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken); + tdsqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken); }else{ return pInfo->aFunc[pExpr->iAgg].iMem; } @@ -107197,7 +107197,7 @@ expr_code_doover: const char *zId; /* The function name */ u32 constMask = 0; /* Mask of function arguments that are constant */ int i; /* Loop counter */ - sqlite3 *db = pParse->db; /* The database connection */ + tdsqlite3 *db = pParse->db; /* The database connection */ u8 enc = ENC(db); /* The text encoding used by this database */ CollSeq *pColl = 0; /* A collating sequence */ @@ -107207,10 +107207,10 @@ expr_code_doover: } #endif - if( ConstFactorOk(pParse) && sqlite3ExprIsConstantNotJoin(pExpr) ){ + if( ConstFactorOk(pParse) && tdsqlite3ExprIsConstantNotJoin(pExpr) ){ /* SQL functions can be expensive. So try to move constant functions ** out of the inner loop, even if that means an extra OP_Copy. */ - return sqlite3ExprCodeAtInit(pParse, pExpr, -1); + return tdsqlite3ExprCodeAtInit(pParse, pExpr, -1); } assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); if( ExprHasProperty(pExpr, EP_TokenOnly) ){ @@ -107221,14 +107221,14 @@ expr_code_doover: nFarg = pFarg ? pFarg->nExpr : 0; assert( !ExprHasProperty(pExpr, EP_IntValue) ); zId = pExpr->u.zToken; - pDef = sqlite3FindFunction(db, zId, nFarg, enc, 0); + pDef = tdsqlite3FindFunction(db, zId, nFarg, enc, 0); #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION if( pDef==0 && pParse->explain ){ - pDef = sqlite3FindFunction(db, "unknown", nFarg, enc, 0); + pDef = tdsqlite3FindFunction(db, "unknown", nFarg, enc, 0); } #endif if( pDef==0 || pDef->xFinalize!=0 ){ - sqlite3ErrorMsg(pParse, "unknown function: %s()", zId); + tdsqlite3ErrorMsg(pParse, "unknown function: %s()", zId); break; } if( pDef->funcFlags & SQLITE_FUNC_INLINE ){ @@ -107237,16 +107237,16 @@ expr_code_doover: return exprCodeInlineFunction(pParse, pFarg, SQLITE_PTR_TO_INT(pDef->pUserData), target); }else if( pDef->funcFlags & (SQLITE_FUNC_DIRECT|SQLITE_FUNC_UNSAFE) ){ - sqlite3ExprFunctionUsable(pParse, pExpr, pDef); + tdsqlite3ExprFunctionUsable(pParse, pExpr, pDef); } for(i=0; ia[i].pExpr) ){ + if( i<32 && tdsqlite3ExprIsConstant(pFarg->a[i].pExpr) ){ testcase( i==31 ); constMask |= MASKBIT32(i); } if( (pDef->funcFlags & SQLITE_FUNC_NEEDCOLL)!=0 && !pColl ){ - pColl = sqlite3ExprCollSeq(pParse, pFarg->a[i].pExpr); + pColl = tdsqlite3ExprCollSeq(pParse, pFarg->a[i].pExpr); } } if( pFarg ){ @@ -107254,7 +107254,7 @@ expr_code_doover: r1 = pParse->nMem+1; pParse->nMem += nFarg; }else{ - r1 = sqlite3GetTempRange(pParse, nFarg); + r1 = tdsqlite3GetTempRange(pParse, nFarg); } /* For length() and typeof() functions with a column argument, @@ -107276,7 +107276,7 @@ expr_code_doover: } } - sqlite3ExprCodeExprList(pParse, pFarg, r1, 0, + tdsqlite3ExprCodeExprList(pParse, pFarg, r1, 0, SQLITE_ECEL_DUP|SQLITE_ECEL_FACTOR); }else{ r1 = 0; @@ -107295,34 +107295,34 @@ expr_code_doover: ** for function overloading. But we use the B term in "glob(B,A)". */ if( nFarg>=2 && ExprHasProperty(pExpr, EP_InfixFunc) ){ - pDef = sqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[1].pExpr); + pDef = tdsqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[1].pExpr); }else if( nFarg>0 ){ - pDef = sqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[0].pExpr); + pDef = tdsqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[0].pExpr); } #endif if( pDef->funcFlags & SQLITE_FUNC_NEEDCOLL ){ if( !pColl ) pColl = db->pDfltColl; - sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ); + tdsqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ); } #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC if( pDef->funcFlags & SQLITE_FUNC_OFFSET ){ Expr *pArg = pFarg->a[0].pExpr; if( pArg->op==TK_COLUMN ){ - sqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target); + tdsqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target); }else{ - sqlite3VdbeAddOp2(v, OP_Null, 0, target); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, target); } }else #endif { - sqlite3VdbeAddFunctionCall(pParse, constMask, r1, target, nFarg, + tdsqlite3VdbeAddFunctionCall(pParse, constMask, r1, target, nFarg, pDef, pExpr->op2); } if( nFarg ){ if( constMask==0 ){ - sqlite3ReleaseTempRange(pParse, r1, nFarg); + tdsqlite3ReleaseTempRange(pParse, r1, nFarg); }else{ - sqlite3VdbeReleaseRegisters(pParse, r1, nFarg, constMask, 1); + tdsqlite3VdbeReleaseRegisters(pParse, r1, nFarg, constMask, 1); } } return target; @@ -107334,35 +107334,35 @@ expr_code_doover: testcase( op==TK_EXISTS ); testcase( op==TK_SELECT ); if( op==TK_SELECT && (nCol = pExpr->x.pSelect->pEList->nExpr)!=1 ){ - sqlite3SubselectError(pParse, nCol, 1); + tdsqlite3SubselectError(pParse, nCol, 1); }else{ - return sqlite3CodeSubselect(pParse, pExpr); + return tdsqlite3CodeSubselect(pParse, pExpr); } break; } case TK_SELECT_COLUMN: { int n; if( pExpr->pLeft->iTable==0 ){ - pExpr->pLeft->iTable = sqlite3CodeSubselect(pParse, pExpr->pLeft); + pExpr->pLeft->iTable = tdsqlite3CodeSubselect(pParse, pExpr->pLeft); } assert( pExpr->iTable==0 || pExpr->pLeft->op==TK_SELECT ); if( pExpr->iTable!=0 - && pExpr->iTable!=(n = sqlite3ExprVectorSize(pExpr->pLeft)) + && pExpr->iTable!=(n = tdsqlite3ExprVectorSize(pExpr->pLeft)) ){ - sqlite3ErrorMsg(pParse, "%d columns assigned %d values", + tdsqlite3ErrorMsg(pParse, "%d columns assigned %d values", pExpr->iTable, n); } return pExpr->pLeft->iTable + pExpr->iColumn; } case TK_IN: { - int destIfFalse = sqlite3VdbeMakeLabel(pParse); - int destIfNull = sqlite3VdbeMakeLabel(pParse); - sqlite3VdbeAddOp2(v, OP_Null, 0, target); - sqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull); - sqlite3VdbeAddOp2(v, OP_Integer, 1, target); - sqlite3VdbeResolveLabel(v, destIfFalse); - sqlite3VdbeAddOp2(v, OP_AddImm, target, 0); - sqlite3VdbeResolveLabel(v, destIfNull); + int destIfFalse = tdsqlite3VdbeMakeLabel(pParse); + int destIfNull = tdsqlite3VdbeMakeLabel(pParse); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, target); + tdsqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, target); + tdsqlite3VdbeResolveLabel(v, destIfFalse); + tdsqlite3VdbeAddOp2(v, OP_AddImm, target, 0); + tdsqlite3VdbeResolveLabel(v, destIfNull); return target; } #endif /* SQLITE_OMIT_SUBQUERY */ @@ -107419,14 +107419,14 @@ expr_code_doover: Table *pTab = pExpr->y.pTab; int iCol = pExpr->iColumn; int p1 = pExpr->iTable * (pTab->nCol+1) + 1 - + sqlite3TableColumnToStorage(pTab, iCol); + + tdsqlite3TableColumnToStorage(pTab, iCol); assert( pExpr->iTable==0 || pExpr->iTable==1 ); assert( iCol>=-1 && iColnCol ); assert( pTab->iPKey<0 || iCol!=pTab->iPKey ); assert( p1>=0 && p1<(pTab->nCol*2+2) ); - sqlite3VdbeAddOp2(v, OP_Param, p1, target); + tdsqlite3VdbeAddOp2(v, OP_Param, p1, target); VdbeComment((v, "r[%d]=%s.%s", target, (pExpr->iTable ? "new" : "old"), (pExpr->iColumn<0 ? "rowid" : pExpr->y.pTab->aCol[iCol].zName) @@ -107439,14 +107439,14 @@ expr_code_doover: ** EVIDENCE-OF: R-60985-57662 SQLite will convert the value back to ** floating point when extracting it from the record. */ if( iCol>=0 && pTab->aCol[iCol].affinity==SQLITE_AFF_REAL ){ - sqlite3VdbeAddOp1(v, OP_RealAffinity, target); + tdsqlite3VdbeAddOp1(v, OP_RealAffinity, target); } #endif break; } case TK_VECTOR: { - sqlite3ErrorMsg(pParse, "row value misused"); + tdsqlite3ErrorMsg(pParse, "row value misused"); break; } @@ -107459,16 +107459,16 @@ expr_code_doover: case TK_IF_NULL_ROW: { int addrINR; u8 okConstFactor = pParse->okConstFactor; - addrINR = sqlite3VdbeAddOp1(v, OP_IfNullRow, pExpr->iTable); + addrINR = tdsqlite3VdbeAddOp1(v, OP_IfNullRow, pExpr->iTable); /* Temporarily disable factoring of constant expressions, since ** even though expressions may appear to be constant, they are not ** really constant because they originate from the right-hand side ** of a LEFT JOIN. */ pParse->okConstFactor = 0; - inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); + inReg = tdsqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); pParse->okConstFactor = okConstFactor; - sqlite3VdbeJumpHere(v, addrINR); - sqlite3VdbeChangeP3(v, addrINR, inReg); + tdsqlite3VdbeJumpHere(v, addrINR); + tdsqlite3VdbeChangeP3(v, addrINR, inReg); break; } @@ -107504,18 +107504,18 @@ expr_code_doover: Expr *pX; /* The X expression */ Expr *pTest = 0; /* X==Ei (form A) or just Ei (form B) */ Expr *pDel = 0; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; assert( !ExprHasProperty(pExpr, EP_xIsSelect) && pExpr->x.pList ); assert(pExpr->x.pList->nExpr > 0); pEList = pExpr->x.pList; aListelem = pEList->a; nExpr = pEList->nExpr; - endLabel = sqlite3VdbeMakeLabel(pParse); + endLabel = tdsqlite3VdbeMakeLabel(pParse); if( (pX = pExpr->pLeft)!=0 ){ - pDel = sqlite3ExprDup(db, pX, 0); + pDel = tdsqlite3ExprDup(db, pX, 0); if( db->mallocFailed ){ - sqlite3ExprDelete(db, pDel); + tdsqlite3ExprDelete(db, pDel); break; } testcase( pX->op==TK_COLUMN ); @@ -107538,21 +107538,21 @@ expr_code_doover: }else{ pTest = aListelem[i].pExpr; } - nextCase = sqlite3VdbeMakeLabel(pParse); + nextCase = tdsqlite3VdbeMakeLabel(pParse); testcase( pTest->op==TK_COLUMN ); - sqlite3ExprIfFalse(pParse, pTest, nextCase, SQLITE_JUMPIFNULL); + tdsqlite3ExprIfFalse(pParse, pTest, nextCase, SQLITE_JUMPIFNULL); testcase( aListelem[i+1].pExpr->op==TK_COLUMN ); - sqlite3ExprCode(pParse, aListelem[i+1].pExpr, target); - sqlite3VdbeGoto(v, endLabel); - sqlite3VdbeResolveLabel(v, nextCase); + tdsqlite3ExprCode(pParse, aListelem[i+1].pExpr, target); + tdsqlite3VdbeGoto(v, endLabel); + tdsqlite3VdbeResolveLabel(v, nextCase); } if( (nExpr&1)!=0 ){ - sqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target); + tdsqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target); }else{ - sqlite3VdbeAddOp2(v, OP_Null, 0, target); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, target); } - sqlite3ExprDelete(db, pDel); - sqlite3VdbeResolveLabel(v, endLabel); + tdsqlite3ExprDelete(db, pDel); + tdsqlite3VdbeResolveLabel(v, endLabel); break; } #ifndef SQLITE_OMIT_TRIGGER @@ -107563,20 +107563,20 @@ expr_code_doover: || pExpr->affExpr==OE_Ignore ); if( !pParse->pTriggerTab ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "RAISE() may only be used within a trigger-program"); return 0; } if( pExpr->affExpr==OE_Abort ){ - sqlite3MayAbort(pParse); + tdsqlite3MayAbort(pParse); } assert( !ExprHasProperty(pExpr, EP_IntValue) ); if( pExpr->affExpr==OE_Ignore ){ - sqlite3VdbeAddOp4( + tdsqlite3VdbeAddOp4( v, OP_Halt, SQLITE_OK, OE_Ignore, 0, pExpr->u.zToken,0); VdbeCoverage(v); }else{ - sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_TRIGGER, + tdsqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_TRIGGER, pExpr->affExpr, pExpr->u.zToken, 0, 0); } @@ -107584,8 +107584,8 @@ expr_code_doover: } #endif } - sqlite3ReleaseTempReg(pParse, regFree1); - sqlite3ReleaseTempReg(pParse, regFree2); + tdsqlite3ReleaseTempReg(pParse, regFree1); + tdsqlite3ReleaseTempReg(pParse, regFree2); return inReg; } @@ -107598,7 +107598,7 @@ expr_code_doover: ** is stored is returned. When regDest<0, two identical expressions will ** code to the same register. */ -SQLITE_PRIVATE int sqlite3ExprCodeAtInit( +SQLITE_PRIVATE int tdsqlite3ExprCodeAtInit( Parse *pParse, /* Parsing context */ Expr *pExpr, /* The expression to code when the VDBE initializes */ int regDest /* Store the value in this register */ @@ -107610,13 +107610,13 @@ SQLITE_PRIVATE int sqlite3ExprCodeAtInit( struct ExprList_item *pItem; int i; for(pItem=p->a, i=p->nExpr; i>0; pItem++, i--){ - if( pItem->reusable && sqlite3ExprCompare(0,pItem->pExpr,pExpr,-1)==0 ){ + if( pItem->reusable && tdsqlite3ExprCompare(0,pItem->pExpr,pExpr,-1)==0 ){ return pItem->u.iConstExprReg; } } } - pExpr = sqlite3ExprDup(pParse->db, pExpr, 0); - p = sqlite3ExprListAppend(pParse, p, pExpr); + pExpr = tdsqlite3ExprDup(pParse->db, pExpr, 0); + p = tdsqlite3ExprListAppend(pParse, p, pExpr); if( p ){ struct ExprList_item *pItem = &p->a[p->nExpr-1]; pItem->reusable = regDest<0; @@ -107640,22 +107640,22 @@ SQLITE_PRIVATE int sqlite3ExprCodeAtInit( ** code to fill the register in the initialization section of the ** VDBE program, in order to factor it out of the evaluation loop. */ -SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse *pParse, Expr *pExpr, int *pReg){ +SQLITE_PRIVATE int tdsqlite3ExprCodeTemp(Parse *pParse, Expr *pExpr, int *pReg){ int r2; - pExpr = sqlite3ExprSkipCollateAndLikely(pExpr); + pExpr = tdsqlite3ExprSkipCollateAndLikely(pExpr); if( ConstFactorOk(pParse) && pExpr->op!=TK_REGISTER - && sqlite3ExprIsConstantNotJoin(pExpr) + && tdsqlite3ExprIsConstantNotJoin(pExpr) ){ *pReg = 0; - r2 = sqlite3ExprCodeAtInit(pParse, pExpr, -1); + r2 = tdsqlite3ExprCodeAtInit(pParse, pExpr, -1); }else{ - int r1 = sqlite3GetTempReg(pParse); - r2 = sqlite3ExprCodeTarget(pParse, pExpr, r1); + int r1 = tdsqlite3GetTempReg(pParse); + r2 = tdsqlite3ExprCodeTarget(pParse, pExpr, r1); if( r2==r1 ){ *pReg = r1; }else{ - sqlite3ReleaseTempReg(pParse, r1); + tdsqlite3ReleaseTempReg(pParse, r1); *pReg = 0; } } @@ -107667,11 +107667,11 @@ SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse *pParse, Expr *pExpr, int *pReg){ ** results in register target. The results are guaranteed to appear ** in register target. */ -SQLITE_PRIVATE void sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){ +SQLITE_PRIVATE void tdsqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){ int inReg; assert( target>0 && target<=pParse->nMem ); - inReg = sqlite3ExprCodeTarget(pParse, pExpr, target); + inReg = tdsqlite3ExprCodeTarget(pParse, pExpr, target); assert( pParse->pVdbe!=0 || pParse->db->mallocFailed ); if( inReg!=target && pParse->pVdbe ){ u8 op; @@ -107680,20 +107680,20 @@ SQLITE_PRIVATE void sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){ }else{ op = OP_SCopy; } - sqlite3VdbeAddOp2(pParse->pVdbe, op, inReg, target); + tdsqlite3VdbeAddOp2(pParse->pVdbe, op, inReg, target); } } /* ** Make a transient copy of expression pExpr and then code it using -** sqlite3ExprCode(). This routine works just like sqlite3ExprCode() +** tdsqlite3ExprCode(). This routine works just like tdsqlite3ExprCode() ** except that the input expression is guaranteed to be unchanged. */ -SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse *pParse, Expr *pExpr, int target){ - sqlite3 *db = pParse->db; - pExpr = sqlite3ExprDup(db, pExpr, 0); - if( !db->mallocFailed ) sqlite3ExprCode(pParse, pExpr, target); - sqlite3ExprDelete(db, pExpr); +SQLITE_PRIVATE void tdsqlite3ExprCodeCopy(Parse *pParse, Expr *pExpr, int target){ + tdsqlite3 *db = pParse->db; + pExpr = tdsqlite3ExprDup(db, pExpr, 0); + if( !db->mallocFailed ) tdsqlite3ExprCode(pParse, pExpr, target); + tdsqlite3ExprDelete(db, pExpr); } /* @@ -107702,11 +107702,11 @@ SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse *pParse, Expr *pExpr, int target){ ** in register target. If the expression is constant, then this routine ** might choose to code the expression at initialization time. */ -SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){ - if( pParse->okConstFactor && sqlite3ExprIsConstantNotJoin(pExpr) ){ - sqlite3ExprCodeAtInit(pParse, pExpr, target); +SQLITE_PRIVATE void tdsqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){ + if( pParse->okConstFactor && tdsqlite3ExprIsConstantNotJoin(pExpr) ){ + tdsqlite3ExprCodeAtInit(pParse, pExpr, target); }else{ - sqlite3ExprCode(pParse, pExpr, target); + tdsqlite3ExprCode(pParse, pExpr, target); } } @@ -107730,7 +107730,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int ta ** If SQLITE_ECEL_OMITREF is also set, then the values with u.x.iOrderByCol>0 ** are simply omitted rather than being copied from srcReg. */ -SQLITE_PRIVATE int sqlite3ExprCodeExprList( +SQLITE_PRIVATE int tdsqlite3ExprCodeExprList( Parse *pParse, /* Parsing context */ ExprList *pList, /* The expression list to be coded */ int target, /* Where to write results */ @@ -107759,25 +107759,25 @@ SQLITE_PRIVATE int sqlite3ExprCodeExprList( i--; n--; }else{ - sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i); + tdsqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i); } }else if( (flags & SQLITE_ECEL_FACTOR)!=0 - && sqlite3ExprIsConstantNotJoin(pExpr) + && tdsqlite3ExprIsConstantNotJoin(pExpr) ){ - sqlite3ExprCodeAtInit(pParse, pExpr, target+i); + tdsqlite3ExprCodeAtInit(pParse, pExpr, target+i); }else{ - int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i); + int inReg = tdsqlite3ExprCodeTarget(pParse, pExpr, target+i); if( inReg!=target+i ){ VdbeOp *pOp; if( copyOp==OP_Copy - && (pOp=sqlite3VdbeGetOp(v, -1))->opcode==OP_Copy + && (pOp=tdsqlite3VdbeGetOp(v, -1))->opcode==OP_Copy && pOp->p1+pOp->p3+1==inReg && pOp->p2+pOp->p3+1==target+i && pOp->p5==0 /* The do-not-merge flag must be clear */ ){ pOp->p3++; }else{ - sqlite3VdbeAddOp2(v, copyOp, inReg, target+i); + tdsqlite3VdbeAddOp2(v, copyOp, inReg, target+i); } } } @@ -107800,8 +107800,8 @@ SQLITE_PRIVATE int sqlite3ExprCodeExprList( ** The xJumpIf parameter determines details: ** ** NULL: Store the boolean result in reg[dest] -** sqlite3ExprIfTrue: Jump to dest if true -** sqlite3ExprIfFalse: Jump to dest if false +** tdsqlite3ExprIfTrue: Jump to dest if true +** tdsqlite3ExprIfFalse: Jump to dest if false ** ** The jumpIfNull parameter is ignored if xJumpIf is NULL. */ @@ -107817,14 +107817,14 @@ static void exprCodeBetween( Expr compRight; /* The x<=z term */ int regFree1 = 0; /* Temporary use register */ Expr *pDel = 0; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; memset(&compLeft, 0, sizeof(Expr)); memset(&compRight, 0, sizeof(Expr)); memset(&exprAnd, 0, sizeof(Expr)); assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); - pDel = sqlite3ExprDup(db, pExpr->pLeft, 0); + pDel = tdsqlite3ExprDup(db, pExpr->pLeft, 0); if( db->mallocFailed==0 ){ exprAnd.op = TK_AND; exprAnd.pLeft = &compLeft; @@ -107840,26 +107840,26 @@ static void exprCodeBetween( xJump(pParse, &exprAnd, dest, jumpIfNull); }else{ /* Mark the expression is being from the ON or USING clause of a join - ** so that the sqlite3ExprCodeTarget() routine will not attempt to move + ** so that the tdsqlite3ExprCodeTarget() routine will not attempt to move ** it into the Parse.pConstExpr list. We should use a new bit for this, ** for clarity, but we are out of bits in the Expr.flags field so we ** have to reuse the EP_FromJoin bit. Bummer. */ pDel->flags |= EP_FromJoin; - sqlite3ExprCodeTarget(pParse, &exprAnd, dest); + tdsqlite3ExprCodeTarget(pParse, &exprAnd, dest); } - sqlite3ReleaseTempReg(pParse, regFree1); + tdsqlite3ReleaseTempReg(pParse, regFree1); } - sqlite3ExprDelete(db, pDel); + tdsqlite3ExprDelete(db, pDel); /* Ensure adequate test coverage */ - testcase( xJump==sqlite3ExprIfTrue && jumpIfNull==0 && regFree1==0 ); - testcase( xJump==sqlite3ExprIfTrue && jumpIfNull==0 && regFree1!=0 ); - testcase( xJump==sqlite3ExprIfTrue && jumpIfNull!=0 && regFree1==0 ); - testcase( xJump==sqlite3ExprIfTrue && jumpIfNull!=0 && regFree1!=0 ); - testcase( xJump==sqlite3ExprIfFalse && jumpIfNull==0 && regFree1==0 ); - testcase( xJump==sqlite3ExprIfFalse && jumpIfNull==0 && regFree1!=0 ); - testcase( xJump==sqlite3ExprIfFalse && jumpIfNull!=0 && regFree1==0 ); - testcase( xJump==sqlite3ExprIfFalse && jumpIfNull!=0 && regFree1!=0 ); + testcase( xJump==tdsqlite3ExprIfTrue && jumpIfNull==0 && regFree1==0 ); + testcase( xJump==tdsqlite3ExprIfTrue && jumpIfNull==0 && regFree1!=0 ); + testcase( xJump==tdsqlite3ExprIfTrue && jumpIfNull!=0 && regFree1==0 ); + testcase( xJump==tdsqlite3ExprIfTrue && jumpIfNull!=0 && regFree1!=0 ); + testcase( xJump==tdsqlite3ExprIfFalse && jumpIfNull==0 && regFree1==0 ); + testcase( xJump==tdsqlite3ExprIfFalse && jumpIfNull==0 && regFree1!=0 ); + testcase( xJump==tdsqlite3ExprIfFalse && jumpIfNull!=0 && regFree1==0 ); + testcase( xJump==tdsqlite3ExprIfFalse && jumpIfNull!=0 && regFree1!=0 ); testcase( xJump==0 ); } @@ -107877,7 +107877,7 @@ static void exprCodeBetween( ** the make process cause these values to align. Assert()s in the code ** below verify that the numbers are aligned correctly. */ -SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){ +SQLITE_PRIVATE void tdsqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){ Vdbe *v = pParse->pVdbe; int op = 0; int regFree1 = 0; @@ -107891,26 +107891,26 @@ SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int switch( op ){ case TK_AND: case TK_OR: { - Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr); + Expr *pAlt = tdsqlite3ExprSimplifiedAndOr(pExpr); if( pAlt!=pExpr ){ - sqlite3ExprIfTrue(pParse, pAlt, dest, jumpIfNull); + tdsqlite3ExprIfTrue(pParse, pAlt, dest, jumpIfNull); }else if( op==TK_AND ){ - int d2 = sqlite3VdbeMakeLabel(pParse); + int d2 = tdsqlite3VdbeMakeLabel(pParse); testcase( jumpIfNull==0 ); - sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2, + tdsqlite3ExprIfFalse(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL); - sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); - sqlite3VdbeResolveLabel(v, d2); + tdsqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); + tdsqlite3VdbeResolveLabel(v, d2); }else{ testcase( jumpIfNull==0 ); - sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull); - sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); + tdsqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull); + tdsqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); } break; } case TK_NOT: { testcase( jumpIfNull==0 ); - sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull); + tdsqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull); break; } case TK_TRUTH: { @@ -107918,14 +107918,14 @@ SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int int isTrue; /* IS TRUE or IS NOT TRUE */ testcase( jumpIfNull==0 ); isNot = pExpr->op2==TK_ISNOT; - isTrue = sqlite3ExprTruthValue(pExpr->pRight); + isTrue = tdsqlite3ExprTruthValue(pExpr->pRight); testcase( isTrue && isNot ); testcase( !isTrue && isNot ); if( isTrue ^ isNot ){ - sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, + tdsqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, isNot ? SQLITE_JUMPIFNULL : 0); }else{ - sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, + tdsqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, isNot ? SQLITE_JUMPIFNULL : 0); } break; @@ -107943,10 +107943,10 @@ SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int case TK_GE: case TK_NE: case TK_EQ: { - if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; + if( tdsqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; testcase( jumpIfNull==0 ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); + r1 = tdsqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); + r2 = tdsqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, r1, r2, dest, jumpIfNull, ExprHasProperty(pExpr,EP_Commuted)); assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); @@ -107967,8 +107967,8 @@ SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int case TK_NOTNULL: { assert( TK_ISNULL==OP_IsNull ); testcase( op==TK_ISNULL ); assert( TK_NOTNULL==OP_NotNull ); testcase( op==TK_NOTNULL ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - sqlite3VdbeAddOp2(v, op, r1, dest); + r1 = tdsqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); + tdsqlite3VdbeAddOp2(v, op, r1, dest); VdbeCoverageIf(v, op==TK_ISNULL); VdbeCoverageIf(v, op==TK_NOTNULL); testcase( regFree1==0 ); @@ -107976,28 +107976,28 @@ SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int } case TK_BETWEEN: { testcase( jumpIfNull==0 ); - exprCodeBetween(pParse, pExpr, dest, sqlite3ExprIfTrue, jumpIfNull); + exprCodeBetween(pParse, pExpr, dest, tdsqlite3ExprIfTrue, jumpIfNull); break; } #ifndef SQLITE_OMIT_SUBQUERY case TK_IN: { - int destIfFalse = sqlite3VdbeMakeLabel(pParse); + int destIfFalse = tdsqlite3VdbeMakeLabel(pParse); int destIfNull = jumpIfNull ? dest : destIfFalse; - sqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull); - sqlite3VdbeGoto(v, dest); - sqlite3VdbeResolveLabel(v, destIfFalse); + tdsqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull); + tdsqlite3VdbeGoto(v, dest); + tdsqlite3VdbeResolveLabel(v, destIfFalse); break; } #endif default: { default_expr: if( ExprAlwaysTrue(pExpr) ){ - sqlite3VdbeGoto(v, dest); + tdsqlite3VdbeGoto(v, dest); }else if( ExprAlwaysFalse(pExpr) ){ /* No-op */ }else{ - r1 = sqlite3ExprCodeTemp(pParse, pExpr, ®Free1); - sqlite3VdbeAddOp3(v, OP_If, r1, dest, jumpIfNull!=0); + r1 = tdsqlite3ExprCodeTemp(pParse, pExpr, ®Free1); + tdsqlite3VdbeAddOp3(v, OP_If, r1, dest, jumpIfNull!=0); VdbeCoverage(v); testcase( regFree1==0 ); testcase( jumpIfNull==0 ); @@ -108005,8 +108005,8 @@ SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int break; } } - sqlite3ReleaseTempReg(pParse, regFree1); - sqlite3ReleaseTempReg(pParse, regFree2); + tdsqlite3ReleaseTempReg(pParse, regFree1); + tdsqlite3ReleaseTempReg(pParse, regFree2); } /* @@ -108018,7 +108018,7 @@ SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int ** jump if jumpIfNull is SQLITE_JUMPIFNULL or fall through if jumpIfNull ** is 0. */ -SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){ +SQLITE_PRIVATE void tdsqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){ Vdbe *v = pParse->pVdbe; int op = 0; int regFree1 = 0; @@ -108063,26 +108063,26 @@ SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int switch( pExpr->op ){ case TK_AND: case TK_OR: { - Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr); + Expr *pAlt = tdsqlite3ExprSimplifiedAndOr(pExpr); if( pAlt!=pExpr ){ - sqlite3ExprIfFalse(pParse, pAlt, dest, jumpIfNull); + tdsqlite3ExprIfFalse(pParse, pAlt, dest, jumpIfNull); }else if( pExpr->op==TK_AND ){ testcase( jumpIfNull==0 ); - sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull); - sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); + tdsqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull); + tdsqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); }else{ - int d2 = sqlite3VdbeMakeLabel(pParse); + int d2 = tdsqlite3VdbeMakeLabel(pParse); testcase( jumpIfNull==0 ); - sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, + tdsqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL); - sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); - sqlite3VdbeResolveLabel(v, d2); + tdsqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); + tdsqlite3VdbeResolveLabel(v, d2); } break; } case TK_NOT: { testcase( jumpIfNull==0 ); - sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull); + tdsqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull); break; } case TK_TRUTH: { @@ -108090,17 +108090,17 @@ SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int int isTrue; /* IS TRUE or IS NOT TRUE */ testcase( jumpIfNull==0 ); isNot = pExpr->op2==TK_ISNOT; - isTrue = sqlite3ExprTruthValue(pExpr->pRight); + isTrue = tdsqlite3ExprTruthValue(pExpr->pRight); testcase( isTrue && isNot ); testcase( !isTrue && isNot ); if( isTrue ^ isNot ){ /* IS TRUE and IS NOT FALSE */ - sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, + tdsqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, isNot ? 0 : SQLITE_JUMPIFNULL); }else{ /* IS FALSE and IS NOT TRUE */ - sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, + tdsqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, isNot ? 0 : SQLITE_JUMPIFNULL); } break; @@ -108118,10 +108118,10 @@ SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int case TK_GE: case TK_NE: case TK_EQ: { - if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; + if( tdsqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; testcase( jumpIfNull==0 ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); + r1 = tdsqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); + r2 = tdsqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, r1, r2, dest, jumpIfNull,ExprHasProperty(pExpr,EP_Commuted)); assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); @@ -108140,8 +108140,8 @@ SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int } case TK_ISNULL: case TK_NOTNULL: { - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - sqlite3VdbeAddOp2(v, op, r1, dest); + r1 = tdsqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); + tdsqlite3VdbeAddOp2(v, op, r1, dest); testcase( op==TK_ISNULL ); VdbeCoverageIf(v, op==TK_ISNULL); testcase( op==TK_NOTNULL ); VdbeCoverageIf(v, op==TK_NOTNULL); testcase( regFree1==0 ); @@ -108149,17 +108149,17 @@ SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int } case TK_BETWEEN: { testcase( jumpIfNull==0 ); - exprCodeBetween(pParse, pExpr, dest, sqlite3ExprIfFalse, jumpIfNull); + exprCodeBetween(pParse, pExpr, dest, tdsqlite3ExprIfFalse, jumpIfNull); break; } #ifndef SQLITE_OMIT_SUBQUERY case TK_IN: { if( jumpIfNull ){ - sqlite3ExprCodeIN(pParse, pExpr, dest, dest); + tdsqlite3ExprCodeIN(pParse, pExpr, dest, dest); }else{ - int destIfNull = sqlite3VdbeMakeLabel(pParse); - sqlite3ExprCodeIN(pParse, pExpr, dest, destIfNull); - sqlite3VdbeResolveLabel(v, destIfNull); + int destIfNull = tdsqlite3VdbeMakeLabel(pParse); + tdsqlite3ExprCodeIN(pParse, pExpr, dest, destIfNull); + tdsqlite3VdbeResolveLabel(v, destIfNull); } break; } @@ -108167,12 +108167,12 @@ SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int default: { default_expr: if( ExprAlwaysFalse(pExpr) ){ - sqlite3VdbeGoto(v, dest); + tdsqlite3VdbeGoto(v, dest); }else if( ExprAlwaysTrue(pExpr) ){ /* no-op */ }else{ - r1 = sqlite3ExprCodeTemp(pParse, pExpr, ®Free1); - sqlite3VdbeAddOp3(v, OP_IfNot, r1, dest, jumpIfNull!=0); + r1 = tdsqlite3ExprCodeTemp(pParse, pExpr, ®Free1); + tdsqlite3VdbeAddOp3(v, OP_IfNot, r1, dest, jumpIfNull!=0); VdbeCoverage(v); testcase( regFree1==0 ); testcase( jumpIfNull==0 ); @@ -108180,22 +108180,22 @@ SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int break; } } - sqlite3ReleaseTempReg(pParse, regFree1); - sqlite3ReleaseTempReg(pParse, regFree2); + tdsqlite3ReleaseTempReg(pParse, regFree1); + tdsqlite3ReleaseTempReg(pParse, regFree2); } /* -** Like sqlite3ExprIfFalse() except that a copy is made of pExpr before +** Like tdsqlite3ExprIfFalse() except that a copy is made of pExpr before ** code generation, and that copy is deleted after code generation. This ** ensures that the original pExpr is unchanged. */ -SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse *pParse, Expr *pExpr, int dest,int jumpIfNull){ - sqlite3 *db = pParse->db; - Expr *pCopy = sqlite3ExprDup(db, pExpr, 0); +SQLITE_PRIVATE void tdsqlite3ExprIfFalseDup(Parse *pParse, Expr *pExpr, int dest,int jumpIfNull){ + tdsqlite3 *db = pParse->db; + Expr *pCopy = tdsqlite3ExprDup(db, pExpr, 0); if( db->mallocFailed==0 ){ - sqlite3ExprIfFalse(pParse, pCopy, dest, jumpIfNull); + tdsqlite3ExprIfFalse(pParse, pCopy, dest, jumpIfNull); } - sqlite3ExprDelete(db, pCopy); + tdsqlite3ExprDelete(db, pCopy); } /* @@ -108214,21 +108214,21 @@ SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse *pParse, Expr *pExpr, int dest,i static int exprCompareVariable(Parse *pParse, Expr *pVar, Expr *pExpr){ int res = 0; int iVar; - sqlite3_value *pL, *pR = 0; + tdsqlite3_value *pL, *pR = 0; - sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, SQLITE_AFF_BLOB, &pR); + tdsqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, SQLITE_AFF_BLOB, &pR); if( pR ){ iVar = pVar->iColumn; - sqlite3VdbeSetVarmask(pParse->pVdbe, iVar); - pL = sqlite3VdbeGetBoundValue(pParse->pReprepare, iVar, SQLITE_AFF_BLOB); + tdsqlite3VdbeSetVarmask(pParse->pVdbe, iVar); + pL = tdsqlite3VdbeGetBoundValue(pParse->pReprepare, iVar, SQLITE_AFF_BLOB); if( pL ){ - if( sqlite3_value_type(pL)==SQLITE_TEXT ){ - sqlite3_value_text(pL); /* Make sure the encoding is UTF-8 */ + if( tdsqlite3_value_type(pL)==SQLITE_TEXT ){ + tdsqlite3_value_text(pL); /* Make sure the encoding is UTF-8 */ } - res = 0==sqlite3MemCompare(pL, pR, 0); + res = 0==tdsqlite3MemCompare(pL, pR, 0); } - sqlite3ValueFree(pR); - sqlite3ValueFree(pL); + tdsqlite3ValueFree(pR); + tdsqlite3ValueFree(pL); } return res; @@ -108263,7 +108263,7 @@ static int exprCompareVariable(Parse *pParse, Expr *pVar, Expr *pExpr){ ** Argument pParse should normally be NULL. If it is not NULL and pA or ** pB causes a return value of 2. */ -SQLITE_PRIVATE int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTab){ +SQLITE_PRIVATE int tdsqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTab){ u32 combinedFlags; if( pA==0 || pB==0 ){ return pB==pA ? 0 : 2; @@ -108279,24 +108279,24 @@ SQLITE_PRIVATE int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTa return 2; } if( pA->op!=pB->op || pA->op==TK_RAISE ){ - if( pA->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA->pLeft,pB,iTab)<2 ){ + if( pA->op==TK_COLLATE && tdsqlite3ExprCompare(pParse, pA->pLeft,pB,iTab)<2 ){ return 1; } - if( pB->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA,pB->pLeft,iTab)<2 ){ + if( pB->op==TK_COLLATE && tdsqlite3ExprCompare(pParse, pA,pB->pLeft,iTab)<2 ){ return 1; } return 2; } if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){ if( pA->op==TK_FUNCTION || pA->op==TK_AGG_FUNCTION ){ - if( sqlite3StrICmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2; + if( tdsqlite3StrICmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2; #ifndef SQLITE_OMIT_WINDOWFUNC assert( pA->op==pB->op ); if( ExprHasProperty(pA,EP_WinFunc)!=ExprHasProperty(pB,EP_WinFunc) ){ return 2; } if( ExprHasProperty(pA,EP_WinFunc) ){ - if( sqlite3WindowCompare(pParse, pA->y.pWin, pB->y.pWin, 1)!=0 ){ + if( tdsqlite3WindowCompare(pParse, pA->y.pWin, pB->y.pWin, 1)!=0 ){ return 2; } } @@ -108304,7 +108304,7 @@ SQLITE_PRIVATE int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTa }else if( pA->op==TK_NULL ){ return 0; }else if( pA->op==TK_COLLATE ){ - if( sqlite3_stricmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2; + if( tdsqlite3_stricmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2; }else if( ALWAYS(pB->u.zToken!=0) && strcmp(pA->u.zToken,pB->u.zToken)!=0 ){ return 2; } @@ -108314,9 +108314,9 @@ SQLITE_PRIVATE int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTa if( (combinedFlags & EP_TokenOnly)==0 ){ if( combinedFlags & EP_xIsSelect ) return 2; if( (combinedFlags & EP_FixedCol)==0 - && sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2; - if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2; - if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2; + && tdsqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2; + if( tdsqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2; + if( tdsqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2; if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE && (combinedFlags & EP_Reduced)==0 @@ -108327,9 +108327,9 @@ SQLITE_PRIVATE int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTa if( pA->op==TK_FUNCTION && iTab<0 ){ /* Ex: CREATE TABLE t1(a CHECK( aa[i].pExpr; Expr *pExprB = pB->a[i].pExpr; if( pA->a[i].sortFlags!=pB->a[i].sortFlags ) return 1; - if( (res = sqlite3ExprCompare(0, pExprA, pExprB, iTab)) ) return res; + if( (res = tdsqlite3ExprCompare(0, pExprA, pExprB, iTab)) ) return res; } return 0; } /* -** Like sqlite3ExprCompare() except COLLATE operators at the top-level +** Like tdsqlite3ExprCompare() except COLLATE operators at the top-level ** are ignored. */ -SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){ - return sqlite3ExprCompare(0, - sqlite3ExprSkipCollateAndLikely(pA), - sqlite3ExprSkipCollateAndLikely(pB), +SQLITE_PRIVATE int tdsqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){ + return tdsqlite3ExprCompare(0, + tdsqlite3ExprSkipCollateAndLikely(pA), + tdsqlite3ExprSkipCollateAndLikely(pB), iTab); } @@ -108402,7 +108402,7 @@ static int exprImpliesNotNull( ){ assert( p ); assert( pNN ); - if( sqlite3ExprCompare(pParse, p, pNN, iTab)==0 ){ + if( tdsqlite3ExprCompare(pParse, p, pNN, iTab)==0 ){ return pNN->op!=TK_NULL; } switch( p->op ){ @@ -108489,13 +108489,13 @@ static int exprImpliesNotNull( ** improvement. Returning false might cause a performance reduction, but ** it will always give the correct answer and is hence always safe. */ -SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Parse *pParse, Expr *pE1, Expr *pE2, int iTab){ - if( sqlite3ExprCompare(pParse, pE1, pE2, iTab)==0 ){ +SQLITE_PRIVATE int tdsqlite3ExprImpliesExpr(Parse *pParse, Expr *pE1, Expr *pE2, int iTab){ + if( tdsqlite3ExprCompare(pParse, pE1, pE2, iTab)==0 ){ return 1; } if( pE2->op==TK_OR - && (sqlite3ExprImpliesExpr(pParse, pE1, pE2->pLeft, iTab) - || sqlite3ExprImpliesExpr(pParse, pE1, pE2->pRight, iTab) ) + && (tdsqlite3ExprImpliesExpr(pParse, pE1, pE2->pLeft, iTab) + || tdsqlite3ExprImpliesExpr(pParse, pE1, pE2->pRight, iTab) ) ){ return 1; } @@ -108508,7 +108508,7 @@ SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Parse *pParse, Expr *pE1, Expr *pE2, i } /* -** This is the Expr node callback for sqlite3ExprImpliesNonNullRow(). +** This is the Expr node callback for tdsqlite3ExprImpliesNonNullRow(). ** If the expression node requires that the table at pWalker->iCur ** have one or more non-NULL column, then set pWalker->eCode to 1 and abort. ** @@ -108551,16 +108551,16 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){ case TK_AND: if( pWalker->eCode==0 ){ - sqlite3WalkExpr(pWalker, pExpr->pLeft); + tdsqlite3WalkExpr(pWalker, pExpr->pLeft); if( pWalker->eCode ){ pWalker->eCode = 0; - sqlite3WalkExpr(pWalker, pExpr->pRight); + tdsqlite3WalkExpr(pWalker, pExpr->pRight); } } return WRC_Prune; case TK_BETWEEN: - if( sqlite3WalkExpr(pWalker, pExpr->pLeft)==WRC_Abort ){ + if( tdsqlite3WalkExpr(pWalker, pExpr->pLeft)==WRC_Abort ){ assert( pWalker->eCode ); return WRC_Abort; } @@ -108614,15 +108614,15 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){ ** be non-NULL, then the LEFT JOIN can be safely converted into an ** ordinary join. */ -SQLITE_PRIVATE int sqlite3ExprImpliesNonNullRow(Expr *p, int iTab){ +SQLITE_PRIVATE int tdsqlite3ExprImpliesNonNullRow(Expr *p, int iTab){ Walker w; - p = sqlite3ExprSkipCollateAndLikely(p); + p = tdsqlite3ExprSkipCollateAndLikely(p); if( p==0 ) return 0; if( p->op==TK_NOTNULL ){ p = p->pLeft; }else{ while( p->op==TK_AND ){ - if( sqlite3ExprImpliesNonNullRow(p->pLeft, iTab) ) return 1; + if( tdsqlite3ExprImpliesNonNullRow(p->pLeft, iTab) ) return 1; p = p->pRight; } } @@ -108631,7 +108631,7 @@ SQLITE_PRIVATE int sqlite3ExprImpliesNonNullRow(Expr *p, int iTab){ w.xSelectCallback2 = 0; w.eCode = 0; w.u.iCur = iTab; - sqlite3WalkExpr(&w, p); + tdsqlite3WalkExpr(&w, p); return w.eCode; } @@ -108655,7 +108655,7 @@ struct IdxCover { static int exprIdxCover(Walker *pWalker, Expr *pExpr){ if( pExpr->op==TK_COLUMN && pExpr->iTable==pWalker->u.pIdxCover->iCur - && sqlite3TableColumnToIndex(pWalker->u.pIdxCover->pIdx, pExpr->iColumn)<0 + && tdsqlite3TableColumnToIndex(pWalker->u.pIdxCover->pIdx, pExpr->iColumn)<0 ){ pWalker->eCode = 1; return WRC_Abort; @@ -108673,7 +108673,7 @@ static int exprIdxCover(Walker *pWalker, Expr *pExpr){ ** evaluated using only the index and without having to lookup the ** corresponding table entry. */ -SQLITE_PRIVATE int sqlite3ExprCoveredByIndex( +SQLITE_PRIVATE int tdsqlite3ExprCoveredByIndex( Expr *pExpr, /* The index to be tested */ int iCur, /* The cursor number for the corresponding table */ Index *pIdx /* The index that might be used for coverage */ @@ -108685,7 +108685,7 @@ SQLITE_PRIVATE int sqlite3ExprCoveredByIndex( xcov.pIdx = pIdx; w.xExprCallback = exprIdxCover; w.u.pIdxCover = &xcov; - sqlite3WalkExpr(&w, pExpr); + tdsqlite3WalkExpr(&w, pExpr); return !w.eCode; } @@ -108694,7 +108694,7 @@ SQLITE_PRIVATE int sqlite3ExprCoveredByIndex( ** An instance of the following structure is used by the tree walker ** to count references to table columns in the arguments of an ** aggregate function, in order to implement the -** sqlite3FunctionThisSrc() routine. +** tdsqlite3FunctionThisSrc() routine. */ struct SrcCount { SrcList *pSrc; /* One particular FROM clause in a nested query */ @@ -108707,10 +108707,10 @@ struct SrcCount { */ static int exprSrcCount(Walker *pWalker, Expr *pExpr){ /* There was once a NEVER() on the second term on the grounds that - ** sqlite3FunctionUsesThisSrc() was always called before - ** sqlite3ExprAnalyzeAggregates() and so the TK_COLUMNs have not yet + ** tdsqlite3FunctionUsesThisSrc() was always called before + ** tdsqlite3ExprAnalyzeAggregates() and so the TK_COLUMNs have not yet ** been converted into TK_AGG_COLUMN. But this is no longer true due - ** to window functions - sqlite3WindowRewrite() may now indirectly call + ** to window functions - tdsqlite3WindowRewrite() may now indirectly call ** FunctionUsesThisSrc() when creating a new sub-select. */ if( pExpr->op==TK_COLUMN || pExpr->op==TK_AGG_COLUMN ){ int i; @@ -108738,21 +108738,21 @@ static int exprSrcCount(Walker *pWalker, Expr *pExpr){ ** has no arguments or has only constant arguments. Return false if pExpr ** references columns but not columns of tables found in pSrcList. */ -SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr *pExpr, SrcList *pSrcList){ +SQLITE_PRIVATE int tdsqlite3FunctionUsesThisSrc(Expr *pExpr, SrcList *pSrcList){ Walker w; struct SrcCount cnt; assert( pExpr->op==TK_AGG_FUNCTION ); memset(&w, 0, sizeof(w)); w.xExprCallback = exprSrcCount; - w.xSelectCallback = sqlite3SelectWalkNoop; + w.xSelectCallback = tdsqlite3SelectWalkNoop; w.u.pSrcCount = &cnt; cnt.pSrc = pSrcList; cnt.nThis = 0; cnt.nOther = 0; - sqlite3WalkExprList(&w, pExpr->x.pList); + tdsqlite3WalkExprList(&w, pExpr->x.pList); #ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(pExpr, EP_WinFunc) ){ - sqlite3WalkExpr(&w, pExpr->y.pWin->pFilter); + tdsqlite3WalkExpr(&w, pExpr->y.pWin->pFilter); } #endif return cnt.nThis>0 || cnt.nOther==0; @@ -108762,9 +108762,9 @@ SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr *pExpr, SrcList *pSrcList){ ** Add a new element to the pAggInfo->aCol[] array. Return the index of ** the new element. Return a negative number if malloc fails. */ -static int addAggInfoColumn(sqlite3 *db, AggInfo *pInfo){ +static int addAggInfoColumn(tdsqlite3 *db, AggInfo *pInfo){ int i; - pInfo->aCol = sqlite3ArrayAllocate( + pInfo->aCol = tdsqlite3ArrayAllocate( db, pInfo->aCol, sizeof(pInfo->aCol[0]), @@ -108778,9 +108778,9 @@ static int addAggInfoColumn(sqlite3 *db, AggInfo *pInfo){ ** Add a new element to the pAggInfo->aFunc[] array. Return the index of ** the new element. Return a negative number if malloc fails. */ -static int addAggInfoFunc(sqlite3 *db, AggInfo *pInfo){ +static int addAggInfoFunc(tdsqlite3 *db, AggInfo *pInfo){ int i; - pInfo->aFunc = sqlite3ArrayAllocate( + pInfo->aFunc = tdsqlite3ArrayAllocate( db, pInfo->aFunc, sizeof(pInfo->aFunc[0]), @@ -108792,7 +108792,7 @@ static int addAggInfoFunc(sqlite3 *db, AggInfo *pInfo){ /* ** This is the xExprCallback for a tree walker. It is used to -** implement sqlite3ExprAnalyzeAggregates(). See sqlite3ExprAnalyzeAggregates +** implement tdsqlite3ExprAnalyzeAggregates(). See tdsqlite3ExprAnalyzeAggregates ** for additional information. */ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ @@ -108882,7 +108882,7 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ */ struct AggInfo_func *pItem = pAggInfo->aFunc; for(i=0; inFunc; i++, pItem++){ - if( sqlite3ExprCompare(0, pItem->pExpr, pExpr, -1)==0 ){ + if( tdsqlite3ExprCompare(0, pItem->pExpr, pExpr, -1)==0 ){ break; } } @@ -108897,7 +108897,7 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ pItem->pExpr = pExpr; pItem->iMem = ++pParse->nMem; assert( !ExprHasProperty(pExpr, EP_IntValue) ); - pItem->pFunc = sqlite3FindFunction(pParse->db, + pItem->pFunc = tdsqlite3FindFunction(pParse->db, pExpr->u.zToken, pExpr->x.pList ? pExpr->x.pList->nExpr : 0, enc, 0); if( pExpr->flags & EP_Distinct ){ @@ -108938,9 +108938,9 @@ static void analyzeAggregatesInSelectEnd(Walker *pWalker, Select *pSelect){ ** necessary. ** ** This routine should only be called after the expression has been -** analyzed by sqlite3ResolveExprNames(). +** analyzed by tdsqlite3ResolveExprNames(). */ -SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){ +SQLITE_PRIVATE void tdsqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){ Walker w; w.xExprCallback = analyzeAggregate; w.xSelectCallback = analyzeAggregatesInSelect; @@ -108949,21 +108949,21 @@ SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){ w.u.pNC = pNC; w.pParse = 0; assert( pNC->pSrcList!=0 ); - sqlite3WalkExpr(&w, pExpr); + tdsqlite3WalkExpr(&w, pExpr); } /* -** Call sqlite3ExprAnalyzeAggregates() for every expression in an +** Call tdsqlite3ExprAnalyzeAggregates() for every expression in an ** expression list. Return the number of errors. ** ** If an error is found, the analysis is cut short. */ -SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext *pNC, ExprList *pList){ +SQLITE_PRIVATE void tdsqlite3ExprAnalyzeAggList(NameContext *pNC, ExprList *pList){ struct ExprList_item *pItem; int i; if( pList ){ for(pItem=pList->a, i=0; inExpr; i++, pItem++){ - sqlite3ExprAnalyzeAggregates(pNC, pItem->pExpr); + tdsqlite3ExprAnalyzeAggregates(pNC, pItem->pExpr); } } } @@ -108971,7 +108971,7 @@ SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext *pNC, ExprList *pList) /* ** Allocate a single new register for use to hold some intermediate result. */ -SQLITE_PRIVATE int sqlite3GetTempReg(Parse *pParse){ +SQLITE_PRIVATE int tdsqlite3GetTempReg(Parse *pParse){ if( pParse->nTempReg==0 ){ return ++pParse->nMem; } @@ -108982,9 +108982,9 @@ SQLITE_PRIVATE int sqlite3GetTempReg(Parse *pParse){ ** Deallocate a register, making available for reuse for some other ** purpose. */ -SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){ +SQLITE_PRIVATE void tdsqlite3ReleaseTempReg(Parse *pParse, int iReg){ if( iReg ){ - sqlite3VdbeReleaseRegisters(pParse, iReg, 1, 0, 0); + tdsqlite3VdbeReleaseRegisters(pParse, iReg, 1, 0, 0); if( pParse->nTempRegaTempReg) ){ pParse->aTempReg[pParse->nTempReg++] = iReg; } @@ -108994,9 +108994,9 @@ SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){ /* ** Allocate or deallocate a block of nReg consecutive registers. */ -SQLITE_PRIVATE int sqlite3GetTempRange(Parse *pParse, int nReg){ +SQLITE_PRIVATE int tdsqlite3GetTempRange(Parse *pParse, int nReg){ int i, n; - if( nReg==1 ) return sqlite3GetTempReg(pParse); + if( nReg==1 ) return tdsqlite3GetTempReg(pParse); i = pParse->iRangeReg; n = pParse->nRangeReg; if( nReg<=n ){ @@ -109008,12 +109008,12 @@ SQLITE_PRIVATE int sqlite3GetTempRange(Parse *pParse, int nReg){ } return i; } -SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){ +SQLITE_PRIVATE void tdsqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){ if( nReg==1 ){ - sqlite3ReleaseTempReg(pParse, iReg); + tdsqlite3ReleaseTempReg(pParse, iReg); return; } - sqlite3VdbeReleaseRegisters(pParse, iReg, nReg, 0, 0); + tdsqlite3VdbeReleaseRegisters(pParse, iReg, nReg, 0, 0); if( nReg>pParse->nRangeReg ){ pParse->nRangeReg = nReg; pParse->iRangeReg = iReg; @@ -109028,7 +109028,7 @@ SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){ ** the sub/co-routine does not use registers in common with the code that ** invokes the sub/co-routine. */ -SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){ +SQLITE_PRIVATE void tdsqlite3ClearTempRegCache(Parse *pParse){ pParse->nTempReg = 0; pParse->nRangeReg = 0; } @@ -109039,7 +109039,7 @@ SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){ ** statements. */ #ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse *pParse, int iFirst, int iLast){ +SQLITE_PRIVATE int tdsqlite3NoTempsInRange(Parse *pParse, int iFirst, int iLast){ int i; if( pParse->nRangeReg>0 && pParse->iRangeReg+pParse->nRangeReg > iFirst @@ -109089,14 +109089,14 @@ SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse *pParse, int iFirst, int iLast){ ** Or, if zName is not a system table, zero is returned. */ static int isAlterableTable(Parse *pParse, Table *pTab){ - if( 0==sqlite3StrNICmp(pTab->zName, "sqlite_", 7) + if( 0==tdsqlite3StrNICmp(pTab->zName, "sqlite_", 7) #ifndef SQLITE_OMIT_VIRTUALTABLE || ( (pTab->tabFlags & TF_Shadow)!=0 - && sqlite3ReadOnlyShadowTables(pParse->db) + && tdsqlite3ReadOnlyShadowTables(pParse->db) ) #endif ){ - sqlite3ErrorMsg(pParse, "table %s may not be altered", pTab->zName); + tdsqlite3ErrorMsg(pParse, "table %s may not be altered", pTab->zName); return 1; } return 0; @@ -109110,7 +109110,7 @@ static int isAlterableTable(Parse *pParse, Table *pTab){ ** objects unusable. */ static void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "SELECT 1 " "FROM \"%w\".%s " "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'" @@ -109121,7 +109121,7 @@ static void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){ ); if( bTemp==0 ){ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "SELECT 1 " "FROM temp.%s " "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'" @@ -109139,9 +109139,9 @@ static void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){ static void renameReloadSchema(Parse *pParse, int iDb){ Vdbe *v = pParse->pVdbe; if( v ){ - sqlite3ChangeCookie(pParse, iDb); - sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, iDb, 0); - if( iDb!=1 ) sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, 1, 0); + tdsqlite3ChangeCookie(pParse, iDb); + tdsqlite3VdbeAddParseSchemaOp(pParse->pVdbe, iDb, 0); + if( iDb!=1 ) tdsqlite3VdbeAddParseSchemaOp(pParse->pVdbe, 1, 0); } } @@ -109149,7 +109149,7 @@ static void renameReloadSchema(Parse *pParse, int iDb){ ** Generate code to implement the "ALTER TABLE xxx RENAME TO yyy" ** command. */ -SQLITE_PRIVATE void sqlite3AlterRenameTable( +SQLITE_PRIVATE void tdsqlite3AlterRenameTable( Parse *pParse, /* Parser context. */ SrcList *pSrc, /* The table to rename. */ Token *pName /* The new table name. */ @@ -109158,7 +109158,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( char *zDb; /* Name of database iDb */ Table *pTab; /* Table being renamed */ char *zName = 0; /* NULL-terminated version of pName */ - sqlite3 *db = pParse->db; /* Database connection */ + tdsqlite3 *db = pParse->db; /* Database connection */ int nTabName; /* Number of UTF-8 characters in zTabName */ const char *zTabName; /* Original name of the table */ Vdbe *v; @@ -109168,23 +109168,23 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( savedDbFlags = db->mDbFlags; if( NEVER(db->mallocFailed) ) goto exit_rename_table; assert( pSrc->nSrc==1 ); - assert( sqlite3BtreeHoldsAllMutexes(pParse->db) ); + assert( tdsqlite3BtreeHoldsAllMutexes(pParse->db) ); - pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]); + pTab = tdsqlite3LocateTableItem(pParse, 0, &pSrc->a[0]); if( !pTab ) goto exit_rename_table; - iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); + iDb = tdsqlite3SchemaToIndex(pParse->db, pTab->pSchema); zDb = db->aDb[iDb].zDbSName; db->mDbFlags |= DBFLAG_PreferBuiltin; /* Get a NULL terminated version of the new table name. */ - zName = sqlite3NameFromToken(db, pName); + zName = tdsqlite3NameFromToken(db, pName); if( !zName ) goto exit_rename_table; /* Check that a table or index named 'zName' does not already exist ** in database iDb. If so, this is an error. */ - if( sqlite3FindTable(db, zName, zDb) || sqlite3FindIndex(db, zName, zDb) ){ - sqlite3ErrorMsg(pParse, + if( tdsqlite3FindTable(db, zName, zDb) || tdsqlite3FindIndex(db, zName, zDb) ){ + tdsqlite3ErrorMsg(pParse, "there is already another table or index with this name: %s", zName); goto exit_rename_table; } @@ -109195,30 +109195,30 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( if( SQLITE_OK!=isAlterableTable(pParse, pTab) ){ goto exit_rename_table; } - if( SQLITE_OK!=sqlite3CheckObjectName(pParse,zName,"table",zName) ){ + if( SQLITE_OK!=tdsqlite3CheckObjectName(pParse,zName,"table",zName) ){ goto exit_rename_table; } #ifndef SQLITE_OMIT_VIEW if( pTab->pSelect ){ - sqlite3ErrorMsg(pParse, "view %s may not be altered", pTab->zName); + tdsqlite3ErrorMsg(pParse, "view %s may not be altered", pTab->zName); goto exit_rename_table; } #endif #ifndef SQLITE_OMIT_AUTHORIZATION /* Invoke the authorization callback. */ - if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){ + if( tdsqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){ goto exit_rename_table; } #endif #ifndef SQLITE_OMIT_VIRTUALTABLE - if( sqlite3ViewGetColumnNames(pParse, pTab) ){ + if( tdsqlite3ViewGetColumnNames(pParse, pTab) ){ goto exit_rename_table; } if( IsVirtual(pTab) ){ - pVTab = sqlite3GetVTable(db, pTab); + pVTab = tdsqlite3GetVTable(db, pTab); if( pVTab->pVtab->pModule->xRename==0 ){ pVTab = 0; } @@ -109226,22 +109226,22 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( #endif /* Begin a transaction for database iDb. Then modify the schema cookie - ** (since the ALTER TABLE modifies the schema). Call sqlite3MayAbort(), + ** (since the ALTER TABLE modifies the schema). Call tdsqlite3MayAbort(), ** as the scalar functions (e.g. sqlite_rename_table()) invoked by the ** nested SQL may raise an exception. */ - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( v==0 ){ goto exit_rename_table; } - sqlite3MayAbort(pParse); + tdsqlite3MayAbort(pParse); /* figure out how many UTF-8 characters are in zName */ zTabName = pTab->zName; - nTabName = sqlite3Utf8CharLen(zTabName, -1); + nTabName = tdsqlite3Utf8CharLen(zTabName, -1); /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in ** the schema to use the new table name. */ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "UPDATE \"%w\".%s SET " "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) " "WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)" @@ -109251,7 +109251,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( /* Update the tbl_name and name columns of the sqlite_master table ** as required. */ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "UPDATE %Q.%s SET " "tbl_name = %Q, " "name = CASE " @@ -109271,8 +109271,8 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( /* If the sqlite_sequence table exists in this database, then update ** it with the new table name. */ - if( sqlite3FindTable(db, "sqlite_sequence", zDb) ){ - sqlite3NestedParse(pParse, + if( tdsqlite3FindTable(db, "sqlite_sequence", zDb) ){ + tdsqlite3NestedParse(pParse, "UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q", zDb, zName, pTab->zName); } @@ -109282,7 +109282,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( ** edit view and trigger definitions within the temp database ** as required. */ if( iDb!=1 ){ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "UPDATE sqlite_temp_master SET " "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), " "tbl_name = " @@ -109301,8 +109301,8 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( #ifndef SQLITE_OMIT_VIRTUALTABLE if( pVTab ){ int i = ++pParse->nMem; - sqlite3VdbeLoadString(v, i, zName); - sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB); + tdsqlite3VdbeLoadString(v, i, zName); + tdsqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB); } #endif @@ -109310,8 +109310,8 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( renameTestSchema(pParse, zDb, iDb==1); exit_rename_table: - sqlite3SrcListDelete(db, pSrc); - sqlite3DbFree(db, zName); + tdsqlite3SrcListDelete(db, pSrc); + tdsqlite3DbFree(db, zName); db->mDbFlags = savedDbFlags; } @@ -109323,7 +109323,7 @@ exit_rename_table: ** The Table structure pParse->pNewTable was extended to include ** the new column during parsing. */ -SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ +SQLITE_PRIVATE void tdsqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ Table *pNew; /* Copy of pParse->pNewTable */ Table *pTab; /* Table being altered */ int iDb; /* Database number */ @@ -109332,7 +109332,7 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ char *zCol; /* Null-terminated column definition */ Column *pCol; /* The new column */ Expr *pDflt; /* Default value for the new column */ - sqlite3 *db; /* The database connection; */ + tdsqlite3 *db; /* The database connection; */ Vdbe *v; /* The prepared statement under construction */ int r1; /* Temporary registers */ @@ -109341,18 +109341,18 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ pNew = pParse->pNewTable; assert( pNew ); - assert( sqlite3BtreeHoldsAllMutexes(db) ); - iDb = sqlite3SchemaToIndex(db, pNew->pSchema); + assert( tdsqlite3BtreeHoldsAllMutexes(db) ); + iDb = tdsqlite3SchemaToIndex(db, pNew->pSchema); zDb = db->aDb[iDb].zDbSName; zTab = &pNew->zName[16]; /* Skip the "sqlite_altertab_" prefix on the name */ pCol = &pNew->aCol[pNew->nCol-1]; pDflt = pCol->pDflt; - pTab = sqlite3FindTable(db, zTab, zDb); + pTab = tdsqlite3FindTable(db, zTab, zDb); assert( pTab ); #ifndef SQLITE_OMIT_AUTHORIZATION /* Invoke the authorization callback. */ - if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){ + if( tdsqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){ return; } #endif @@ -109363,11 +109363,11 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ ** column must not be NULL. */ if( pCol->colFlags & COLFLAG_PRIMKEY ){ - sqlite3ErrorMsg(pParse, "Cannot add a PRIMARY KEY column"); + tdsqlite3ErrorMsg(pParse, "Cannot add a PRIMARY KEY column"); return; } if( pNew->pIndex ){ - sqlite3ErrorMsg(pParse, "Cannot add a UNIQUE column"); + tdsqlite3ErrorMsg(pParse, "Cannot add a UNIQUE column"); return; } if( (pCol->colFlags & COLFLAG_GENERATED)==0 ){ @@ -109380,57 +109380,57 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ pDflt = 0; } if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "Cannot add a REFERENCES column with non-NULL default value"); return; } if( pCol->notNull && !pDflt ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "Cannot add a NOT NULL column with default value NULL"); return; } - /* Ensure the default expression is something that sqlite3ValueFromExpr() + /* Ensure the default expression is something that tdsqlite3ValueFromExpr() ** can handle (i.e. not CURRENT_TIME etc.) */ if( pDflt ){ - sqlite3_value *pVal = 0; + tdsqlite3_value *pVal = 0; int rc; - rc = sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_BLOB, &pVal); + rc = tdsqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_BLOB, &pVal); assert( rc==SQLITE_OK || rc==SQLITE_NOMEM ); if( rc!=SQLITE_OK ){ assert( db->mallocFailed == 1 ); return; } if( !pVal ){ - sqlite3ErrorMsg(pParse,"Cannot add a column with non-constant default"); + tdsqlite3ErrorMsg(pParse,"Cannot add a column with non-constant default"); return; } - sqlite3ValueFree(pVal); + tdsqlite3ValueFree(pVal); } }else if( pCol->colFlags & COLFLAG_STORED ){ - sqlite3ErrorMsg(pParse, "cannot add a STORED column"); + tdsqlite3ErrorMsg(pParse, "cannot add a STORED column"); return; } /* Modify the CREATE TABLE statement. */ - zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n); + zCol = tdsqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n); if( zCol ){ char *zEnd = &zCol[pColDef->n-1]; u32 savedDbFlags = db->mDbFlags; - while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){ + while( zEnd>zCol && (*zEnd==';' || tdsqlite3Isspace(*zEnd)) ){ *zEnd-- = '\0'; } db->mDbFlags |= DBFLAG_PreferBuiltin; - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "UPDATE \"%w\".%s SET " "sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) " "WHERE type = 'table' AND name = %Q", zDb, MASTER_NAME, pNew->addColOffset, zCol, pNew->addColOffset+1, zTab ); - sqlite3DbFree(db, zCol); + tdsqlite3DbFree(db, zCol); db->mDbFlags = savedDbFlags; } @@ -109438,16 +109438,16 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ ** from less than 3 to 4, as that will corrupt any preexisting DESC ** index. */ - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( v ){ - r1 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT); - sqlite3VdbeUsesBtree(v, iDb); - sqlite3VdbeAddOp2(v, OP_AddImm, r1, -2); - sqlite3VdbeAddOp2(v, OP_IfPos, r1, sqlite3VdbeCurrentAddr(v)+2); + r1 = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT); + tdsqlite3VdbeUsesBtree(v, iDb); + tdsqlite3VdbeAddOp2(v, OP_AddImm, r1, -2); + tdsqlite3VdbeAddOp2(v, OP_IfPos, r1, tdsqlite3VdbeCurrentAddr(v)+2); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3); - sqlite3ReleaseTempReg(pParse, r1); + tdsqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3); + tdsqlite3ReleaseTempReg(pParse, r1); } /* Reload the table definition */ @@ -109462,56 +109462,56 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ ** This routine makes a (partial) copy of the Table structure ** for the table being altered and sets Parse.pNewTable to point ** to it. Routines called by the parser as the column definition -** is parsed (i.e. sqlite3AddColumn()) add the new Column data to +** is parsed (i.e. tdsqlite3AddColumn()) add the new Column data to ** the copy. The copy of the Table structure is deleted by tokenize.c ** after parsing is finished. ** -** Routine sqlite3AlterFinishAddColumn() will be called to complete +** Routine tdsqlite3AlterFinishAddColumn() will be called to complete ** coding the "ALTER TABLE ... ADD" statement. */ -SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ +SQLITE_PRIVATE void tdsqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ Table *pNew; Table *pTab; int iDb; int i; int nAlloc; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; /* Look up the table being altered. */ assert( pParse->pNewTable==0 ); - assert( sqlite3BtreeHoldsAllMutexes(db) ); + assert( tdsqlite3BtreeHoldsAllMutexes(db) ); if( db->mallocFailed ) goto exit_begin_add_column; - pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]); + pTab = tdsqlite3LocateTableItem(pParse, 0, &pSrc->a[0]); if( !pTab ) goto exit_begin_add_column; #ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pTab) ){ - sqlite3ErrorMsg(pParse, "virtual tables may not be altered"); + tdsqlite3ErrorMsg(pParse, "virtual tables may not be altered"); goto exit_begin_add_column; } #endif /* Make sure this is not an attempt to ALTER a view. */ if( pTab->pSelect ){ - sqlite3ErrorMsg(pParse, "Cannot add a column to a view"); + tdsqlite3ErrorMsg(pParse, "Cannot add a column to a view"); goto exit_begin_add_column; } if( SQLITE_OK!=isAlterableTable(pParse, pTab) ){ goto exit_begin_add_column; } - sqlite3MayAbort(pParse); + tdsqlite3MayAbort(pParse); assert( pTab->addColOffset>0 ); - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); + iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); /* Put a copy of the Table struct in Parse.pNewTable for the - ** sqlite3AddColumn() function and friends to modify. But modify + ** tdsqlite3AddColumn() function and friends to modify. But modify ** the name by adding an "sqlite_altertab_" prefix. By adding this ** prefix, we insure that the name will not collide with an existing ** table because user table are not allowed to have the "sqlite_" ** prefix on their name. */ - pNew = (Table*)sqlite3DbMallocZero(db, sizeof(Table)); + pNew = (Table*)tdsqlite3DbMallocZero(db, sizeof(Table)); if( !pNew ) goto exit_begin_add_column; pParse->pNewTable = pNew; pNew->nTabRef = 1; @@ -109519,8 +109519,8 @@ SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ assert( pNew->nCol>0 ); nAlloc = (((pNew->nCol-1)/8)*8)+8; assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 ); - pNew->aCol = (Column*)sqlite3DbMallocZero(db, sizeof(Column)*nAlloc); - pNew->zName = sqlite3MPrintf(db, "sqlite_altertab_%s", pTab->zName); + pNew->aCol = (Column*)tdsqlite3DbMallocZero(db, sizeof(Column)*nAlloc); + pNew->zName = tdsqlite3MPrintf(db, "sqlite_altertab_%s", pTab->zName); if( !pNew->aCol || !pNew->zName ){ assert( db->mallocFailed ); goto exit_begin_add_column; @@ -109528,7 +109528,7 @@ SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ memcpy(pNew->aCol, pTab->aCol, sizeof(Column)*pNew->nCol); for(i=0; inCol; i++){ Column *pCol = &pNew->aCol[i]; - pCol->zName = sqlite3DbStrDup(db, pCol->zName); + pCol->zName = tdsqlite3DbStrDup(db, pCol->zName); pCol->zColl = 0; pCol->pDflt = 0; } @@ -109537,7 +109537,7 @@ SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ pNew->nTabRef = 1; exit_begin_add_column: - sqlite3SrcListDelete(db, pSrc); + tdsqlite3SrcListDelete(db, pSrc); return; } @@ -109563,7 +109563,7 @@ static int isRealTable(Parse *pParse, Table *pTab){ } #endif if( zType ){ - sqlite3ErrorMsg( + tdsqlite3ErrorMsg( pParse, "cannot rename columns of %s \"%s\"", zType, pTab->zName ); return 1; @@ -109579,13 +109579,13 @@ static int isRealTable(Parse *pParse, Table *pTab){ ** ** cmd ::= ALTER TABLE pSrc RENAME COLUMN pOld TO pNew */ -SQLITE_PRIVATE void sqlite3AlterRenameColumn( +SQLITE_PRIVATE void tdsqlite3AlterRenameColumn( Parse *pParse, /* Parsing context */ SrcList *pSrc, /* Table being altered. pSrc->nSrc==1 */ Token *pOld, /* Name of column being changed */ Token *pNew /* New column name */ ){ - sqlite3 *db = pParse->db; /* Database connection */ + tdsqlite3 *db = pParse->db; /* Database connection */ Table *pTab; /* Table being updated */ int iCol; /* Index of column being renamed */ char *zOld = 0; /* Old column name */ @@ -109595,7 +109595,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn( int bQuote; /* True to quote the new name */ /* Locate the table to be altered */ - pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]); + pTab = tdsqlite3LocateTableItem(pParse, 0, &pSrc->a[0]); if( !pTab ) goto exit_rename_column; /* Cannot alter a system table */ @@ -109603,26 +109603,26 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn( if( SQLITE_OK!=isRealTable(pParse, pTab) ) goto exit_rename_column; /* Which schema holds the table to be altered */ - iSchema = sqlite3SchemaToIndex(db, pTab->pSchema); + iSchema = tdsqlite3SchemaToIndex(db, pTab->pSchema); assert( iSchema>=0 ); zDb = db->aDb[iSchema].zDbSName; #ifndef SQLITE_OMIT_AUTHORIZATION /* Invoke the authorization callback. */ - if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){ + if( tdsqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){ goto exit_rename_column; } #endif /* Make sure the old name really is a column name in the table to be ** altered. Set iCol to be the index of the column being renamed */ - zOld = sqlite3NameFromToken(db, pOld); + zOld = tdsqlite3NameFromToken(db, pOld); if( !zOld ) goto exit_rename_column; for(iCol=0; iColnCol; iCol++){ - if( 0==sqlite3StrICmp(pTab->aCol[iCol].zName, zOld) ) break; + if( 0==tdsqlite3StrICmp(pTab->aCol[iCol].zName, zOld) ) break; } if( iCol==pTab->nCol ){ - sqlite3ErrorMsg(pParse, "no such column: \"%s\"", zOld); + tdsqlite3ErrorMsg(pParse, "no such column: \"%s\"", zOld); goto exit_rename_column; } @@ -109630,12 +109630,12 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn( ** uses the sqlite_rename_column() SQL function to compute the new ** CREATE statement text for the sqlite_master table. */ - sqlite3MayAbort(pParse); - zNew = sqlite3NameFromToken(db, pNew); + tdsqlite3MayAbort(pParse); + zNew = tdsqlite3NameFromToken(db, pNew); if( !zNew ) goto exit_rename_column; assert( pNew->n>0 ); - bQuote = sqlite3Isquote(pNew->z[0]); - sqlite3NestedParse(pParse, + bQuote = tdsqlite3Isquote(pNew->z[0]); + tdsqlite3NestedParse(pParse, "UPDATE \"%w\".%s SET " "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) " "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' " @@ -109646,7 +109646,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn( pTab->zName ); - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "UPDATE temp.%s SET " "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) " "WHERE type IN ('trigger', 'view')", @@ -109659,9 +109659,9 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn( renameTestSchema(pParse, zDb, iSchema==1); exit_rename_column: - sqlite3SrcListDelete(db, pSrc); - sqlite3DbFree(db, zOld); - sqlite3DbFree(db, zNew); + tdsqlite3SrcListDelete(db, pSrc); + tdsqlite3DbFree(db, zOld); + tdsqlite3DbFree(db, zNew); return; } @@ -109674,8 +109674,8 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn( ** * The name of a table column in Column.zName ** ** A list of RenameToken objects can be constructed during parsing. -** Each new object is created by sqlite3RenameTokenMap(). -** As the parse tree is transformed, the sqlite3RenameTokenRemap() +** Each new object is created by tdsqlite3RenameTokenMap(). +** As the parse tree is transformed, the tdsqlite3RenameTokenRemap() ** routine is used to keep the mapping current. ** ** After the parse finishes, renameTokenFind() routine can be used @@ -109719,7 +109719,7 @@ struct RenameCtx { ** Even though this always seems to work, it is undefined according to the ** C standard. Example of undefined comparison: ** -** sqlite3_free(x); +** tdsqlite3_free(x); ** if( x==y ) ... ** ** Technically, as x no longer points into a valid object or to the byte @@ -109753,12 +109753,12 @@ static void renameTokenCheckAll(Parse *pParse, void *pPtr){ ** with tail recursion in tokenExpr() routine, for a small performance ** improvement. */ -SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse *pParse, void *pPtr, Token *pToken){ +SQLITE_PRIVATE void *tdsqlite3RenameTokenMap(Parse *pParse, void *pPtr, Token *pToken){ RenameToken *pNew; assert( pPtr || pParse->db->mallocFailed ); renameTokenCheckAll(pParse, pPtr); if( pParse->eParseMode!=PARSE_MODE_UNMAP ){ - pNew = sqlite3DbMallocZero(pParse->db, sizeof(RenameToken)); + pNew = tdsqlite3DbMallocZero(pParse->db, sizeof(RenameToken)); if( pNew ){ pNew->p = pPtr; pNew->t = *pToken; @@ -109775,7 +109775,7 @@ SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse *pParse, void *pPtr, Token *pTo ** with parse tree element pFrom. This function remaps the associated token ** to parse tree element pTo. */ -SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse *pParse, void *pTo, void *pFrom){ +SQLITE_PRIVATE void tdsqlite3RenameTokenRemap(Parse *pParse, void *pTo, void *pFrom){ RenameToken *p; renameTokenCheckAll(pParse, pTo); for(p=pParse->pRename; p; p=p->pNext){ @@ -109787,11 +109787,11 @@ SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse *pParse, void *pTo, void *pFro } /* -** Walker callback used by sqlite3RenameExprUnmap(). +** Walker callback used by tdsqlite3RenameExprUnmap(). */ static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){ Parse *pParse = pWalker->pParse; - sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr); + tdsqlite3RenameTokenRemap(pParse, 0, (void*)pExpr); return WRC_Continue; } @@ -109808,15 +109808,15 @@ static void renameWalkWith(Walker *pWalker, Select *pSelect){ NameContext sNC; memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pWalker->pParse; - sqlite3SelectPrep(sNC.pParse, p, &sNC); - sqlite3WalkSelect(pWalker, p); - sqlite3RenameExprlistUnmap(pWalker->pParse, pWith->a[i].pCols); + tdsqlite3SelectPrep(sNC.pParse, p, &sNC); + tdsqlite3WalkSelect(pWalker, p); + tdsqlite3RenameExprlistUnmap(pWalker->pParse, pWith->a[i].pCols); } } } /* -** Walker callback used by sqlite3RenameExprUnmap(). +** Walker callback used by tdsqlite3RenameExprUnmap(). */ static int renameUnmapSelectCb(Walker *pWalker, Select *p){ Parse *pParse = pWalker->pParse; @@ -109827,15 +109827,15 @@ static int renameUnmapSelectCb(Walker *pWalker, Select *p){ ExprList *pList = p->pEList; for(i=0; inExpr; i++){ if( pList->a[i].zEName && pList->a[i].eEName==ENAME_NAME ){ - sqlite3RenameTokenRemap(pParse, 0, (void*)pList->a[i].zEName); + tdsqlite3RenameTokenRemap(pParse, 0, (void*)pList->a[i].zEName); } } } if( ALWAYS(p->pSrc) ){ /* Every Select as a SrcList, even if it is empty */ SrcList *pSrc = p->pSrc; for(i=0; inSrc; i++){ - sqlite3RenameTokenRemap(pParse, 0, (void*)pSrc->a[i].zName); - if( sqlite3WalkExpr(pWalker, pSrc->a[i].pOn) ) return WRC_Abort; + tdsqlite3RenameTokenRemap(pParse, 0, (void*)pSrc->a[i].zName); + if( tdsqlite3WalkExpr(pWalker, pSrc->a[i].pOn) ) return WRC_Abort; } } @@ -109846,7 +109846,7 @@ static int renameUnmapSelectCb(Walker *pWalker, Select *p){ /* ** Remove all nodes that are part of expression pExpr from the rename list. */ -SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse *pParse, Expr *pExpr){ +SQLITE_PRIVATE void tdsqlite3RenameExprUnmap(Parse *pParse, Expr *pExpr){ u8 eMode = pParse->eParseMode; Walker sWalker; memset(&sWalker, 0, sizeof(Walker)); @@ -109854,7 +109854,7 @@ SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse *pParse, Expr *pExpr){ sWalker.xExprCallback = renameUnmapExprCb; sWalker.xSelectCallback = renameUnmapSelectCb; pParse->eParseMode = PARSE_MODE_UNMAP; - sqlite3WalkExpr(&sWalker, pExpr); + tdsqlite3WalkExpr(&sWalker, pExpr); pParse->eParseMode = eMode; } @@ -109862,17 +109862,17 @@ SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse *pParse, Expr *pExpr){ ** Remove all nodes that are part of expression-list pEList from the ** rename list. */ -SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse *pParse, ExprList *pEList){ +SQLITE_PRIVATE void tdsqlite3RenameExprlistUnmap(Parse *pParse, ExprList *pEList){ if( pEList ){ int i; Walker sWalker; memset(&sWalker, 0, sizeof(Walker)); sWalker.pParse = pParse; sWalker.xExprCallback = renameUnmapExprCb; - sqlite3WalkExprList(&sWalker, pEList); + tdsqlite3WalkExprList(&sWalker, pEList); for(i=0; inExpr; i++){ if( ALWAYS(pEList->a[i].eEName==ENAME_NAME) ){ - sqlite3RenameTokenRemap(pParse, 0, (void*)pEList->a[i].zEName); + tdsqlite3RenameTokenRemap(pParse, 0, (void*)pEList->a[i].zEName); } } } @@ -109881,12 +109881,12 @@ SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse *pParse, ExprList *pEList){ /* ** Free the list of RenameToken objects given in the second argument */ -static void renameTokenFree(sqlite3 *db, RenameToken *pToken){ +static void renameTokenFree(tdsqlite3 *db, RenameToken *pToken){ RenameToken *pNext; RenameToken *p; for(p=pToken; p; p=pNext){ pNext = p->pNext; - sqlite3DbFree(db, p); + tdsqlite3DbFree(db, p); } } @@ -109913,7 +109913,7 @@ static void renameTokenFind(Parse *pParse, struct RenameCtx *pCtx, void *pPtr){ /* ** This is a Walker select callback. It does nothing. It is only required -** because without a dummy callback, sqlite3WalkExpr() and similar do not +** because without a dummy callback, tdsqlite3WalkExpr() and similar do not ** descend into sub-select statements. */ static int renameColumnSelectCb(Walker *pWalker, Select *p){ @@ -109978,22 +109978,22 @@ static RenameToken *renameColumnTokenNext(RenameCtx *pCtx){ ** adds context to the error message and then stores it in pCtx. */ static void renameColumnParseError( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int bPost, - sqlite3_value *pType, - sqlite3_value *pObject, + tdsqlite3_value *pType, + tdsqlite3_value *pObject, Parse *pParse ){ - const char *zT = (const char*)sqlite3_value_text(pType); - const char *zN = (const char*)sqlite3_value_text(pObject); + const char *zT = (const char*)tdsqlite3_value_text(pType); + const char *zN = (const char*)tdsqlite3_value_text(pObject); char *zErr; - zErr = sqlite3_mprintf("error in %s %s%s: %s", + zErr = tdsqlite3_mprintf("error in %s %s%s: %s", zT, zN, (bPost ? " after rename" : ""), pParse->zErrMsg ); - sqlite3_result_error(pCtx, zErr, -1); - sqlite3_free(zErr); + tdsqlite3_result_error(pCtx, zErr, -1); + tdsqlite3_free(zErr); } /* @@ -110014,7 +110014,7 @@ static void renameColumnElistNames( char *zName = pEList->a[i].zEName; if( ALWAYS(pEList->a[i].eEName==ENAME_NAME) && ALWAYS(zName!=0) - && 0==sqlite3_stricmp(zName, zOld) + && 0==tdsqlite3_stricmp(zName, zOld) ){ renameTokenFind(pParse, pCtx, (void*)zName); } @@ -110037,7 +110037,7 @@ static void renameColumnIdlistNames( int i; for(i=0; inId; i++){ char *zName = pIdList->a[i].zName; - if( 0==sqlite3_stricmp(zName, zOld) ){ + if( 0==tdsqlite3_stricmp(zName, zOld) ){ renameTokenFind(pParse, pCtx, (void*)zName); } } @@ -110051,14 +110051,14 @@ static void renameColumnIdlistNames( static int renameParseSql( Parse *p, /* Memory to use for Parse object */ const char *zDb, /* Name of schema SQL belongs to */ - sqlite3 *db, /* Database handle */ + tdsqlite3 *db, /* Database handle */ const char *zSql, /* SQL to parse */ int bTemp /* True if SQL is from temp schema */ ){ int rc; char *zErr = 0; - db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb); + db->init.iDb = bTemp ? 1 : tdsqlite3FindDbName(db, zDb); /* Parse the SQL statement passed as the first argument. If no error ** occurs and the parse does not result in a new table, index or @@ -110067,7 +110067,7 @@ static int renameParseSql( p->eParseMode = PARSE_MODE_RENAME; p->db = db; p->nQueryLoop = 1; - rc = sqlite3RunParser(p, zSql, &zErr); + rc = tdsqlite3RunParser(p, zSql, &zErr); assert( p->zErrMsg==0 ); assert( rc!=SQLITE_OK || zErr==0 ); p->zErrMsg = zErr; @@ -110082,7 +110082,7 @@ static int renameParseSql( /* Ensure that all mappings in the Parse.pRename list really do map to ** a part of the input string. */ if( rc==SQLITE_OK ){ - int nSql = sqlite3Strlen30(zSql); + int nSql = tdsqlite3Strlen30(zSql); RenameToken *pToken; for(pToken=p->pRename; pToken; pToken=pToken->pNext){ assert( pToken->t.z>=zSql && &pToken->t.z[pToken->t.n]<=&zSql[nSql] ); @@ -110104,15 +110104,15 @@ static int renameParseSql( ** pCtx and an SQLite error code returned. */ static int renameEditSql( - sqlite3_context *pCtx, /* Return result here */ + tdsqlite3_context *pCtx, /* Return result here */ RenameCtx *pRename, /* Rename context */ const char *zSql, /* SQL statement to edit */ const char *zNew, /* New token text */ int bQuote /* True to always quote token */ ){ - int nNew = sqlite3Strlen30(zNew); - int nSql = sqlite3Strlen30(zSql); - sqlite3 *db = sqlite3_context_db_handle(pCtx); + int nNew = tdsqlite3Strlen30(zNew); + int nSql = tdsqlite3Strlen30(zSql); + tdsqlite3 *db = tdsqlite3_context_db_handle(pCtx); int rc = SQLITE_OK; char *zQuot; char *zOut; @@ -110123,11 +110123,11 @@ static int renameEditSql( ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to ** point to zQuot so that all substitutions are made using the ** quoted version of the new column name. */ - zQuot = sqlite3MPrintf(db, "\"%w\"", zNew); + zQuot = tdsqlite3MPrintf(db, "\"%w\"", zNew); if( zQuot==0 ){ return SQLITE_NOMEM; }else{ - nQuot = sqlite3Strlen30(zQuot); + nQuot = tdsqlite3Strlen30(zQuot); } if( bQuote ){ zNew = zQuot; @@ -110139,7 +110139,7 @@ static int renameEditSql( ** with the new column name. All that remains is to construct and ** return the edited SQL string. */ assert( nQuot>=nNew ); - zOut = sqlite3DbMallocZero(db, nSql + pRename->nList*nQuot + 1); + zOut = tdsqlite3DbMallocZero(db, nSql + pRename->nList*nQuot + 1); if( zOut ){ int nOut = nSql; memcpy(zOut, zSql, nSql); @@ -110149,7 +110149,7 @@ static int renameEditSql( u32 nReplace; const char *zReplace; - if( sqlite3IsIdChar(*pBest->t.z) ){ + if( tdsqlite3IsIdChar(*pBest->t.z) ){ nReplace = nNew; zReplace = zNew; }else{ @@ -110166,16 +110166,16 @@ static int renameEditSql( zOut[nOut] = '\0'; } memcpy(&zOut[iOff], zReplace, nReplace); - sqlite3DbFree(db, pBest); + tdsqlite3DbFree(db, pBest); } - sqlite3_result_text(pCtx, zOut, -1, SQLITE_TRANSIENT); - sqlite3DbFree(db, zOut); + tdsqlite3_result_text(pCtx, zOut, -1, SQLITE_TRANSIENT); + tdsqlite3DbFree(db, zOut); }else{ rc = SQLITE_NOMEM; } - sqlite3_free(zQuot); + tdsqlite3_free(zQuot); return rc; } @@ -110186,7 +110186,7 @@ static int renameEditSql( ** message in the Parse object. */ static int renameResolveTrigger(Parse *pParse, const char *zDb){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Trigger *pNew = pParse->pNewTrigger; TriggerStep *pStep; NameContext sNC; @@ -110195,31 +110195,31 @@ static int renameResolveTrigger(Parse *pParse, const char *zDb){ memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pParse; assert( pNew->pTabSchema ); - pParse->pTriggerTab = sqlite3FindTable(db, pNew->table, - db->aDb[sqlite3SchemaToIndex(db, pNew->pTabSchema)].zDbSName + pParse->pTriggerTab = tdsqlite3FindTable(db, pNew->table, + db->aDb[tdsqlite3SchemaToIndex(db, pNew->pTabSchema)].zDbSName ); pParse->eTriggerOp = pNew->op; /* ALWAYS() because if the table of the trigger does not exist, the ** error would have been hit before this point */ if( ALWAYS(pParse->pTriggerTab) ){ - rc = sqlite3ViewGetColumnNames(pParse, pParse->pTriggerTab); + rc = tdsqlite3ViewGetColumnNames(pParse, pParse->pTriggerTab); } /* Resolve symbols in WHEN clause */ if( rc==SQLITE_OK && pNew->pWhen ){ - rc = sqlite3ResolveExprNames(&sNC, pNew->pWhen); + rc = tdsqlite3ResolveExprNames(&sNC, pNew->pWhen); } for(pStep=pNew->step_list; rc==SQLITE_OK && pStep; pStep=pStep->pNext){ if( pStep->pSelect ){ - sqlite3SelectPrep(pParse, pStep->pSelect, &sNC); + tdsqlite3SelectPrep(pParse, pStep->pSelect, &sNC); if( pParse->nErr ) rc = pParse->rc; } if( rc==SQLITE_OK && pStep->zTarget ){ - Table *pTarget = sqlite3LocateTable(pParse, 0, pStep->zTarget, zDb); + Table *pTarget = tdsqlite3LocateTable(pParse, 0, pStep->zTarget, zDb); if( pTarget==0 ){ rc = SQLITE_ERROR; - }else if( SQLITE_OK==(rc = sqlite3ViewGetColumnNames(pParse, pTarget)) ){ + }else if( SQLITE_OK==(rc = tdsqlite3ViewGetColumnNames(pParse, pTarget)) ){ SrcList sSrc; memset(&sSrc, 0, sizeof(sSrc)); sSrc.nSrc = 1; @@ -110227,10 +110227,10 @@ static int renameResolveTrigger(Parse *pParse, const char *zDb){ sSrc.a[0].pTab = pTarget; sNC.pSrcList = &sSrc; if( pStep->pWhere ){ - rc = sqlite3ResolveExprNames(&sNC, pStep->pWhere); + rc = tdsqlite3ResolveExprNames(&sNC, pStep->pWhere); } if( rc==SQLITE_OK ){ - rc = sqlite3ResolveExprListNames(&sNC, pStep->pExprList); + rc = tdsqlite3ResolveExprListNames(&sNC, pStep->pExprList); } assert( !pStep->pUpsert || (!pStep->pWhere && !pStep->pExprList) ); if( pStep->pUpsert ){ @@ -110239,16 +110239,16 @@ static int renameResolveTrigger(Parse *pParse, const char *zDb){ pUpsert->pUpsertSrc = &sSrc; sNC.uNC.pUpsert = pUpsert; sNC.ncFlags = NC_UUpsert; - rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget); + rc = tdsqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget); if( rc==SQLITE_OK ){ ExprList *pUpsertSet = pUpsert->pUpsertSet; - rc = sqlite3ResolveExprListNames(&sNC, pUpsertSet); + rc = tdsqlite3ResolveExprListNames(&sNC, pUpsertSet); } if( rc==SQLITE_OK ){ - rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertWhere); + rc = tdsqlite3ResolveExprNames(&sNC, pUpsert->pUpsertWhere); } if( rc==SQLITE_OK ){ - rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere); + rc = tdsqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere); } sNC.ncFlags = 0; } @@ -110260,26 +110260,26 @@ static int renameResolveTrigger(Parse *pParse, const char *zDb){ } /* -** Invoke sqlite3WalkExpr() or sqlite3WalkSelect() on all Select or Expr +** Invoke tdsqlite3WalkExpr() or tdsqlite3WalkSelect() on all Select or Expr ** objects that are part of the trigger passed as the second argument. */ static void renameWalkTrigger(Walker *pWalker, Trigger *pTrigger){ TriggerStep *pStep; /* Find tokens to edit in WHEN clause */ - sqlite3WalkExpr(pWalker, pTrigger->pWhen); + tdsqlite3WalkExpr(pWalker, pTrigger->pWhen); /* Find tokens to edit in trigger steps */ for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){ - sqlite3WalkSelect(pWalker, pStep->pSelect); - sqlite3WalkExpr(pWalker, pStep->pWhere); - sqlite3WalkExprList(pWalker, pStep->pExprList); + tdsqlite3WalkSelect(pWalker, pStep->pSelect); + tdsqlite3WalkExpr(pWalker, pStep->pWhere); + tdsqlite3WalkExprList(pWalker, pStep->pExprList); if( pStep->pUpsert ){ Upsert *pUpsert = pStep->pUpsert; - sqlite3WalkExprList(pWalker, pUpsert->pUpsertTarget); - sqlite3WalkExprList(pWalker, pUpsert->pUpsertSet); - sqlite3WalkExpr(pWalker, pUpsert->pUpsertWhere); - sqlite3WalkExpr(pWalker, pUpsert->pUpsertTargetWhere); + tdsqlite3WalkExprList(pWalker, pUpsert->pUpsertTarget); + tdsqlite3WalkExprList(pWalker, pUpsert->pUpsertSet); + tdsqlite3WalkExpr(pWalker, pUpsert->pUpsertWhere); + tdsqlite3WalkExpr(pWalker, pUpsert->pUpsertTargetWhere); } } } @@ -110289,20 +110289,20 @@ static void renameWalkTrigger(Walker *pWalker, Trigger *pTrigger){ ** occupied by the Parse object itself. */ static void renameParseCleanup(Parse *pParse){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Index *pIdx; if( pParse->pVdbe ){ - sqlite3VdbeFinalize(pParse->pVdbe); + tdsqlite3VdbeFinalize(pParse->pVdbe); } - sqlite3DeleteTable(db, pParse->pNewTable); + tdsqlite3DeleteTable(db, pParse->pNewTable); while( (pIdx = pParse->pNewIndex)!=0 ){ pParse->pNewIndex = pIdx->pNext; - sqlite3FreeIndex(db, pIdx); + tdsqlite3FreeIndex(db, pIdx); } - sqlite3DeleteTrigger(db, pParse->pNewTrigger); - sqlite3DbFree(db, pParse->zErrMsg); + tdsqlite3DeleteTrigger(db, pParse->pNewTrigger); + tdsqlite3DbFree(db, pParse->zErrMsg); renameTokenFree(db, pParse->pRename); - sqlite3ParserReset(pParse); + tdsqlite3ParserReset(pParse); } /* @@ -110325,23 +110325,23 @@ static void renameParseCleanup(Parse *pParse){ ** into zNew. The name should be quoted if bQuote is true. ** ** This function is used internally by the ALTER TABLE RENAME COLUMN command. -** It is only accessible to SQL created using sqlite3NestedParse(). It is -** not reachable from ordinary SQL passed into sqlite3_prepare(). +** It is only accessible to SQL created using tdsqlite3NestedParse(). It is +** not reachable from ordinary SQL passed into tdsqlite3_prepare(). */ static void renameColumnFunc( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **argv + tdsqlite3_value **argv ){ - sqlite3 *db = sqlite3_context_db_handle(context); + tdsqlite3 *db = tdsqlite3_context_db_handle(context); RenameCtx sCtx; - const char *zSql = (const char*)sqlite3_value_text(argv[0]); - const char *zDb = (const char*)sqlite3_value_text(argv[3]); - const char *zTable = (const char*)sqlite3_value_text(argv[4]); - int iCol = sqlite3_value_int(argv[5]); - const char *zNew = (const char*)sqlite3_value_text(argv[6]); - int bQuote = sqlite3_value_int(argv[7]); - int bTemp = sqlite3_value_int(argv[8]); + const char *zSql = (const char*)tdsqlite3_value_text(argv[0]); + const char *zDb = (const char*)tdsqlite3_value_text(argv[3]); + const char *zTable = (const char*)tdsqlite3_value_text(argv[4]); + int iCol = tdsqlite3_value_int(argv[5]); + const char *zNew = (const char*)tdsqlite3_value_text(argv[6]); + int bQuote = tdsqlite3_value_int(argv[7]); + int bTemp = tdsqlite3_value_int(argv[8]); const char *zOld; int rc; Parse sParse; @@ -110350,7 +110350,7 @@ static void renameColumnFunc( int i; Table *pTab; #ifndef SQLITE_OMIT_AUTHORIZATION - sqlite3_xauth xAuth = db->xAuth; + tdsqlite3_xauth xAuth = db->xAuth; #endif UNUSED_PARAMETER(NotUsed); @@ -110358,10 +110358,10 @@ static void renameColumnFunc( if( zTable==0 ) return; if( zNew==0 ) return; if( iCol<0 ) return; - sqlite3BtreeEnterAll(db); - pTab = sqlite3FindTable(db, zTable, zDb); + tdsqlite3BtreeEnterAll(db); + pTab = tdsqlite3FindTable(db, zTable, zDb); if( pTab==0 || iCol>=pTab->nCol ){ - sqlite3BtreeLeaveAll(db); + tdsqlite3BtreeLeaveAll(db); return; } zOld = pTab->aCol[iCol].zName; @@ -110387,15 +110387,15 @@ static void renameColumnFunc( if( pSelect ){ pSelect->selFlags &= ~SF_View; sParse.rc = SQLITE_OK; - sqlite3SelectPrep(&sParse, pSelect, 0); + tdsqlite3SelectPrep(&sParse, pSelect, 0); rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc); if( rc==SQLITE_OK ){ - sqlite3WalkSelect(&sWalker, pSelect); + tdsqlite3WalkSelect(&sWalker, pSelect); } if( rc!=SQLITE_OK ) goto renameColumnFunc_done; }else{ /* A regular table */ - int bFKOnly = sqlite3_stricmp(zTable, sParse.pNewTable->zName); + int bFKOnly = tdsqlite3_stricmp(zTable, sParse.pNewTable->zName); FKey *pFKey; assert( sParse.pNewTable->pSelect==0 ); sCtx.pTab = sParse.pNewTable; @@ -110406,17 +110406,17 @@ static void renameColumnFunc( if( sCtx.iCol<0 ){ renameTokenFind(&sParse, &sCtx, (void*)&sParse.pNewTable->iPKey); } - sqlite3WalkExprList(&sWalker, sParse.pNewTable->pCheck); + tdsqlite3WalkExprList(&sWalker, sParse.pNewTable->pCheck); for(pIdx=sParse.pNewTable->pIndex; pIdx; pIdx=pIdx->pNext){ - sqlite3WalkExprList(&sWalker, pIdx->aColExpr); + tdsqlite3WalkExprList(&sWalker, pIdx->aColExpr); } for(pIdx=sParse.pNewIndex; pIdx; pIdx=pIdx->pNext){ - sqlite3WalkExprList(&sWalker, pIdx->aColExpr); + tdsqlite3WalkExprList(&sWalker, pIdx->aColExpr); } } #ifndef SQLITE_OMIT_GENERATED_COLUMNS for(i=0; inCol; i++){ - sqlite3WalkExpr(&sWalker, sParse.pNewTable->aCol[i].pDflt); + tdsqlite3WalkExpr(&sWalker, sParse.pNewTable->aCol[i].pDflt); } #endif @@ -110425,8 +110425,8 @@ static void renameColumnFunc( if( bFKOnly==0 && pFKey->aCol[i].iFrom==iCol ){ renameTokenFind(&sParse, &sCtx, (void*)&pFKey->aCol[i]); } - if( 0==sqlite3_stricmp(pFKey->zTo, zTable) - && 0==sqlite3_stricmp(pFKey->aCol[i].zCol, zOld) + if( 0==tdsqlite3_stricmp(pFKey->zTo, zTable) + && 0==tdsqlite3_stricmp(pFKey->aCol[i].zCol, zOld) ){ renameTokenFind(&sParse, &sCtx, (void*)pFKey->aCol[i].zCol); } @@ -110434,8 +110434,8 @@ static void renameColumnFunc( } } }else if( sParse.pNewIndex ){ - sqlite3WalkExprList(&sWalker, sParse.pNewIndex->aColExpr); - sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere); + tdsqlite3WalkExprList(&sWalker, sParse.pNewIndex->aColExpr); + tdsqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere); }else{ /* A trigger */ TriggerStep *pStep; @@ -110444,7 +110444,7 @@ static void renameColumnFunc( for(pStep=sParse.pNewTrigger->step_list; pStep; pStep=pStep->pNext){ if( pStep->zTarget ){ - Table *pTarget = sqlite3LocateTable(&sParse, 0, pStep->zTarget, zDb); + Table *pTarget = tdsqlite3LocateTable(&sParse, 0, pStep->zTarget, zDb); if( pTarget==pTab ){ if( pStep->pUpsert ){ ExprList *pUpsertSet = pStep->pUpsert->pUpsertSet; @@ -110474,7 +110474,7 @@ renameColumnFunc_done: if( sParse.zErrMsg ){ renameColumnParseError(context, 0, argv[1], argv[2], &sParse); }else{ - sqlite3_result_error_code(context, rc); + tdsqlite3_result_error_code(context, rc); } } @@ -110483,7 +110483,7 @@ renameColumnFunc_done: #ifndef SQLITE_OMIT_AUTHORIZATION db->xAuth = xAuth; #endif - sqlite3BtreeLeaveAll(db); + tdsqlite3BtreeLeaveAll(db); } /* @@ -110541,16 +110541,16 @@ static int renameTableSelectCb(Walker *pWalker, Select *pSelect){ ** -> 'CREATE TABLE t1(a REFERENCES t3)' */ static void renameTableFunc( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **argv + tdsqlite3_value **argv ){ - sqlite3 *db = sqlite3_context_db_handle(context); - const char *zDb = (const char*)sqlite3_value_text(argv[0]); - const char *zInput = (const char*)sqlite3_value_text(argv[3]); - const char *zOld = (const char*)sqlite3_value_text(argv[4]); - const char *zNew = (const char*)sqlite3_value_text(argv[5]); - int bTemp = sqlite3_value_int(argv[6]); + tdsqlite3 *db = tdsqlite3_context_db_handle(context); + const char *zDb = (const char*)tdsqlite3_value_text(argv[0]); + const char *zInput = (const char*)tdsqlite3_value_text(argv[3]); + const char *zOld = (const char*)tdsqlite3_value_text(argv[4]); + const char *zNew = (const char*)tdsqlite3_value_text(argv[5]); + int bTemp = tdsqlite3_value_int(argv[6]); UNUSED_PARAMETER(NotUsed); if( zInput && zOld && zNew ){ @@ -110561,14 +110561,14 @@ static void renameTableFunc( Walker sWalker; #ifndef SQLITE_OMIT_AUTHORIZATION - sqlite3_xauth xAuth = db->xAuth; + tdsqlite3_xauth xAuth = db->xAuth; db->xAuth = 0; #endif - sqlite3BtreeEnterAll(db); + tdsqlite3BtreeEnterAll(db); memset(&sCtx, 0, sizeof(RenameCtx)); - sCtx.pTab = sqlite3FindTable(db, zOld, zDb); + sCtx.pTab = tdsqlite3FindTable(db, zOld, zDb); memset(&sWalker, 0, sizeof(Walker)); sWalker.pParse = &sParse; sWalker.xExprCallback = renameTableExprCb; @@ -110591,11 +110591,11 @@ static void renameTableFunc( assert( pSelect->selFlags & SF_View ); pSelect->selFlags &= ~SF_View; - sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC); + tdsqlite3SelectPrep(&sParse, pTab->pSelect, &sNC); if( sParse.nErr ){ rc = sParse.rc; }else{ - sqlite3WalkSelect(&sWalker, pTab->pSelect); + tdsqlite3WalkSelect(&sWalker, pTab->pSelect); } } }else{ @@ -110604,7 +110604,7 @@ static void renameTableFunc( if( isLegacy==0 || (db->flags & SQLITE_ForeignKeys) ){ FKey *pFKey; for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){ - if( sqlite3_stricmp(pFKey->zTo, zOld)==0 ){ + if( tdsqlite3_stricmp(pFKey->zTo, zOld)==0 ){ renameTokenFind(&sParse, &sCtx, (void*)pFKey->zTo); } } @@ -110614,10 +110614,10 @@ static void renameTableFunc( /* If this is the table being altered, fix any table refs in CHECK ** expressions. Also update the name that appears right after the ** "CREATE [VIRTUAL] TABLE" bit. */ - if( sqlite3_stricmp(zOld, pTab->zName)==0 ){ + if( tdsqlite3_stricmp(zOld, pTab->zName)==0 ){ sCtx.pTab = pTab; if( isLegacy==0 ){ - sqlite3WalkExprList(&sWalker, pTab->pCheck); + tdsqlite3WalkExprList(&sWalker, pTab->pCheck); } renameTokenFind(&sParse, &sCtx, pTab->zName); } @@ -110627,7 +110627,7 @@ static void renameTableFunc( else if( sParse.pNewIndex ){ renameTokenFind(&sParse, &sCtx, sParse.pNewIndex->zName); if( isLegacy==0 ){ - sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere); + tdsqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere); } } @@ -110635,7 +110635,7 @@ static void renameTableFunc( else{ Trigger *pTrigger = sParse.pNewTrigger; TriggerStep *pStep; - if( 0==sqlite3_stricmp(sParse.pNewTrigger->table, zOld) + if( 0==tdsqlite3_stricmp(sParse.pNewTrigger->table, zOld) && sCtx.pTab->pSchema==pTrigger->pTabSchema ){ renameTokenFind(&sParse, &sCtx, sParse.pNewTrigger->table); @@ -110646,7 +110646,7 @@ static void renameTableFunc( if( rc==SQLITE_OK ){ renameWalkTrigger(&sWalker, pTrigger); for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){ - if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){ + if( pStep->zTarget && 0==tdsqlite3_stricmp(pStep->zTarget, zOld) ){ renameTokenFind(&sParse, &sCtx, pStep->zTarget); } } @@ -110663,13 +110663,13 @@ static void renameTableFunc( if( sParse.zErrMsg ){ renameColumnParseError(context, 0, argv[1], argv[2], &sParse); }else{ - sqlite3_result_error_code(context, rc); + tdsqlite3_result_error_code(context, rc); } } renameParseCleanup(&sParse); renameTokenFree(db, sCtx.pList); - sqlite3BtreeLeaveAll(db); + tdsqlite3BtreeLeaveAll(db); #ifndef SQLITE_OMIT_AUTHORIZATION db->xAuth = xAuth; #endif @@ -110698,18 +110698,18 @@ static void renameTableFunc( ** * the table that the trigger is attached to is in database zDb. */ static void renameTableTest( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **argv + tdsqlite3_value **argv ){ - sqlite3 *db = sqlite3_context_db_handle(context); - char const *zDb = (const char*)sqlite3_value_text(argv[0]); - char const *zInput = (const char*)sqlite3_value_text(argv[1]); - int bTemp = sqlite3_value_int(argv[4]); + tdsqlite3 *db = tdsqlite3_context_db_handle(context); + char const *zDb = (const char*)tdsqlite3_value_text(argv[0]); + char const *zInput = (const char*)tdsqlite3_value_text(argv[1]); + int bTemp = tdsqlite3_value_int(argv[4]); int isLegacy = (db->flags & SQLITE_LegacyAlter); #ifndef SQLITE_OMIT_AUTHORIZATION - sqlite3_xauth xAuth = db->xAuth; + tdsqlite3_xauth xAuth = db->xAuth; db->xAuth = 0; #endif @@ -110723,7 +110723,7 @@ static void renameTableTest( NameContext sNC; memset(&sNC, 0, sizeof(sNC)); sNC.pParse = &sParse; - sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, &sNC); + tdsqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, &sNC); if( sParse.nErr ) rc = sParse.rc; } @@ -110732,9 +110732,9 @@ static void renameTableTest( rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb); } if( rc==SQLITE_OK ){ - int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema); - int i2 = sqlite3FindDbName(db, zDb); - if( i1==i2 ) sqlite3_result_int(context, 1); + int i1 = tdsqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema); + int i2 = tdsqlite3FindDbName(db, zDb); + if( i1==i2 ) tdsqlite3_result_int(context, 1); } } } @@ -110753,13 +110753,13 @@ static void renameTableTest( /* ** Register built-in functions used to help implement ALTER TABLE */ -SQLITE_PRIVATE void sqlite3AlterFunctions(void){ +SQLITE_PRIVATE void tdsqlite3AlterFunctions(void){ static FuncDef aAlterTableFuncs[] = { INTERNAL_FUNCTION(sqlite_rename_column, 9, renameColumnFunc), INTERNAL_FUNCTION(sqlite_rename_table, 7, renameTableFunc), INTERNAL_FUNCTION(sqlite_rename_test, 5, renameTableTest), }; - sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs)); + tdsqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs)); } #endif /* SQLITE_ALTER_TABLE */ @@ -110950,15 +110950,15 @@ static void openStatTable( { "sqlite_stat3", 0 }, }; int i; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Db *pDb; - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); int aRoot[ArraySize(aTable)]; u8 aCreateTbl[ArraySize(aTable)]; if( v==0 ) return; - assert( sqlite3BtreeHoldsAllMutexes(db) ); - assert( sqlite3VdbeDb(v)==db ); + assert( tdsqlite3BtreeHoldsAllMutexes(db) ); + assert( tdsqlite3VdbeDb(v)==db ); pDb = &db->aDb[iDb]; /* Create new statistic tables if they do not exist, or clear them @@ -110967,13 +110967,13 @@ static void openStatTable( for(i=0; izDbSName))==0 ){ + if( (pStat = tdsqlite3FindTable(db, zTab, pDb->zDbSName))==0 ){ if( aTable[i].zCols ){ /* The sqlite_statN table does not exist. Create it. Note that a ** side-effect of the CREATE TABLE statement is to leave the rootpage ** of the new table in register pParse->regRoot. This is important ** because the OpenWrite opcode below will be needing it. */ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "CREATE TABLE %Q.%s(%s)", pDb->zDbSName, zTab, aTable[i].zCols ); aRoot[i] = pParse->regRoot; @@ -110985,19 +110985,19 @@ static void openStatTable( ** entire contents of the table. */ aRoot[i] = pStat->tnum; aCreateTbl[i] = 0; - sqlite3TableLock(pParse, iDb, aRoot[i], 1, zTab); + tdsqlite3TableLock(pParse, iDb, aRoot[i], 1, zTab); if( zWhere ){ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "DELETE FROM %Q.%s WHERE %s=%Q", pDb->zDbSName, zTab, zWhereType, zWhere ); #ifdef SQLITE_ENABLE_PREUPDATE_HOOK }else if( db->xPreUpdateCallback ){ - sqlite3NestedParse(pParse, "DELETE FROM %Q.%s", pDb->zDbSName, zTab); + tdsqlite3NestedParse(pParse, "DELETE FROM %Q.%s", pDb->zDbSName, zTab); #endif }else{ /* The sqlite_stat[134] table already exists. Delete all rows. */ - sqlite3VdbeAddOp2(v, OP_Clear, aRoot[i], iDb); + tdsqlite3VdbeAddOp2(v, OP_Clear, aRoot[i], iDb); } } } @@ -111005,8 +111005,8 @@ static void openStatTable( /* Open the sqlite_stat[134] tables for writing. */ for(i=0; aTable[i].zCols; i++){ assert( inRowid ){ - sqlite3DbFree(db, p->u.aRowid); + tdsqlite3DbFree(db, p->u.aRowid); p->nRowid = 0; } } @@ -111072,10 +111072,10 @@ static void sampleClear(sqlite3 *db, Stat4Sample *p){ /* Initialize the BLOB value of a ROWID */ #ifdef SQLITE_ENABLE_STAT4 -static void sampleSetRowid(sqlite3 *db, Stat4Sample *p, int n, const u8 *pData){ +static void sampleSetRowid(tdsqlite3 *db, Stat4Sample *p, int n, const u8 *pData){ assert( db!=0 ); - if( p->nRowid ) sqlite3DbFree(db, p->u.aRowid); - p->u.aRowid = sqlite3DbMallocRawNN(db, n); + if( p->nRowid ) tdsqlite3DbFree(db, p->u.aRowid); + p->u.aRowid = tdsqlite3DbMallocRawNN(db, n); if( p->u.aRowid ){ p->nRowid = n; memcpy(p->u.aRowid, pData, n); @@ -111088,9 +111088,9 @@ static void sampleSetRowid(sqlite3 *db, Stat4Sample *p, int n, const u8 *pData){ /* Initialize the INTEGER value of a ROWID. */ #ifdef SQLITE_ENABLE_STAT4 -static void sampleSetRowidInt64(sqlite3 *db, Stat4Sample *p, i64 iRowid){ +static void sampleSetRowidInt64(tdsqlite3 *db, Stat4Sample *p, i64 iRowid){ assert( db!=0 ); - if( p->nRowid ) sqlite3DbFree(db, p->u.aRowid); + if( p->nRowid ) tdsqlite3DbFree(db, p->u.aRowid); p->nRowid = 0; p->u.iRowid = iRowid; } @@ -111127,7 +111127,7 @@ static void stat4Destructor(void *pOld){ for(i=0; imxSample; i++) sampleClear(p->db, p->a+i); sampleClear(p->db, &p->current); #endif - sqlite3DbFree(p->db, p); + tdsqlite3DbFree(p->db, p); } /* @@ -111154,26 +111154,26 @@ static void stat4Destructor(void *pOld){ ** object. */ static void statInit( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ Stat4Accum *p; int nCol; /* Number of columns in index being sampled */ int nKeyCol; /* Number of key columns */ int nColUp; /* nCol rounded up for alignment */ int n; /* Bytes of space to allocate */ - sqlite3 *db; /* Database connection */ + tdsqlite3 *db; /* Database connection */ #ifdef SQLITE_ENABLE_STAT4 int mxSample = SQLITE_STAT4_SAMPLES; #endif /* Decode the three function arguments */ UNUSED_PARAMETER(argc); - nCol = sqlite3_value_int(argv[0]); + nCol = tdsqlite3_value_int(argv[0]); assert( nCol>0 ); nColUp = sizeof(tRowcnt)<8 ? (nCol+1)&~1 : nCol; - nKeyCol = sqlite3_value_int(argv[1]); + nKeyCol = tdsqlite3_value_int(argv[1]); assert( nKeyCol<=nCol ); assert( nKeyCol>0 ); @@ -111187,10 +111187,10 @@ static void statInit( + sizeof(tRowcnt)*3*nColUp*(nCol+mxSample) #endif ; - db = sqlite3_context_db_handle(context); - p = sqlite3DbMallocZero(db, n); + db = tdsqlite3_context_db_handle(context); + p = tdsqlite3DbMallocZero(db, n); if( p==0 ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); return; } @@ -111208,9 +111208,9 @@ static void statInit( p->iGet = -1; p->mxSample = mxSample; - p->nPSample = (tRowcnt)(sqlite3_value_int64(argv[2])/(mxSample/3+1) + 1); + p->nPSample = (tRowcnt)(tdsqlite3_value_int64(argv[2])/(mxSample/3+1) + 1); p->current.anLt = &p->current.anEq[nColUp]; - p->iPrn = 0x689e962d*(u32)nCol ^ 0xd0944565*(u32)sqlite3_value_int(argv[2]); + p->iPrn = 0x689e962d*(u32)nCol ^ 0xd0944565*(u32)tdsqlite3_value_int(argv[2]); /* Set up the Stat4Accum.a[] and aBest[] arrays */ p->a = (struct Stat4Sample*)&p->current.anLt[nColUp]; @@ -111233,7 +111233,7 @@ static void statInit( ** only the pointer (the 2nd parameter) matters. The size of the object ** (given by the 3rd parameter) is never used and can be any positive ** value. */ - sqlite3_result_blob(context, p, sizeof(*p), stat4Destructor); + tdsqlite3_result_blob(context, p, sizeof(*p), stat4Destructor); } static const FuncDef statInitFuncdef = { 2+IsStat4, /* nArg */ @@ -111453,15 +111453,15 @@ static void samplePushPrevious(Stat4Accum *p, int iChng){ ** The R parameter is only used for STAT4 */ static void statPush( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ int i; /* The three function arguments */ - Stat4Accum *p = (Stat4Accum*)sqlite3_value_blob(argv[0]); - int iChng = sqlite3_value_int(argv[1]); + Stat4Accum *p = (Stat4Accum*)tdsqlite3_value_blob(argv[0]); + int iChng = tdsqlite3_value_int(argv[1]); UNUSED_PARAMETER( argc ); UNUSED_PARAMETER( context ); @@ -111490,11 +111490,11 @@ static void statPush( } p->nRow++; #ifdef SQLITE_ENABLE_STAT4 - if( sqlite3_value_type(argv[2])==SQLITE_INTEGER ){ - sampleSetRowidInt64(p->db, &p->current, sqlite3_value_int64(argv[2])); + if( tdsqlite3_value_type(argv[2])==SQLITE_INTEGER ){ + sampleSetRowidInt64(p->db, &p->current, tdsqlite3_value_int64(argv[2])); }else{ - sampleSetRowid(p->db, &p->current, sqlite3_value_bytes(argv[2]), - sqlite3_value_blob(argv[2])); + sampleSetRowid(p->db, &p->current, tdsqlite3_value_bytes(argv[2]), + tdsqlite3_value_blob(argv[2])); } p->current.iHash = p->iPrn = p->iPrn*1103515245 + 12345; #endif @@ -111559,14 +111559,14 @@ static const FuncDef statPushFuncdef = { ** stat1 table entry information. */ static void statGet( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ - Stat4Accum *p = (Stat4Accum*)sqlite3_value_blob(argv[0]); + Stat4Accum *p = (Stat4Accum*)tdsqlite3_value_blob(argv[0]); #ifdef SQLITE_ENABLE_STAT4 /* STAT4 has a parameter on this routine. */ - int eCall = sqlite3_value_int(argv[1]); + int eCall = tdsqlite3_value_int(argv[1]); assert( argc==2 ); assert( eCall==STAT_GET_STAT1 || eCall==STAT_GET_NEQ || eCall==STAT_GET_ROWID || eCall==STAT_GET_NLT @@ -111601,24 +111601,24 @@ static void statGet( char *z; int i; - char *zRet = sqlite3MallocZero( (p->nKeyCol+1)*25 ); + char *zRet = tdsqlite3MallocZero( (p->nKeyCol+1)*25 ); if( zRet==0 ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); return; } - sqlite3_snprintf(24, zRet, "%llu", (u64)p->nRow); - z = zRet + sqlite3Strlen30(zRet); + tdsqlite3_snprintf(24, zRet, "%llu", (u64)p->nRow); + z = zRet + tdsqlite3Strlen30(zRet); for(i=0; inKeyCol; i++){ u64 nDistinct = p->current.anDLt[i] + 1; u64 iVal = (p->nRow + nDistinct - 1) / nDistinct; - sqlite3_snprintf(24, z, " %llu", iVal); - z += sqlite3Strlen30(z); + tdsqlite3_snprintf(24, z, " %llu", iVal); + z += tdsqlite3Strlen30(z); assert( p->current.anEq[i] ); } assert( z[0]=='\0' && z>zRet ); - sqlite3_result_text(context, zRet, -1, sqlite3_free); + tdsqlite3_result_text(context, zRet, -1, tdsqlite3_free); } #ifdef SQLITE_ENABLE_STAT4 else if( eCall==STAT_GET_ROWID ){ @@ -111629,9 +111629,9 @@ static void statGet( if( p->iGetnSample ){ Stat4Sample *pS = p->a + p->iGet; if( pS->nRowid==0 ){ - sqlite3_result_int64(context, pS->u.iRowid); + tdsqlite3_result_int64(context, pS->u.iRowid); }else{ - sqlite3_result_blob(context, pS->u.aRowid, pS->nRowid, + tdsqlite3_result_blob(context, pS->u.aRowid, pS->nRowid, SQLITE_TRANSIENT); } } @@ -111650,19 +111650,19 @@ static void statGet( } { - char *zRet = sqlite3MallocZero(p->nCol * 25); + char *zRet = tdsqlite3MallocZero(p->nCol * 25); if( zRet==0 ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); }else{ int i; char *z = zRet; for(i=0; inCol; i++){ - sqlite3_snprintf(24, z, "%llu ", (u64)aCnt[i]); - z += sqlite3Strlen30(z); + tdsqlite3_snprintf(24, z, "%llu ", (u64)aCnt[i]); + z += tdsqlite3Strlen30(z); } assert( z[0]=='\0' && z>zRet ); z[-1] = '\0'; - sqlite3_result_text(context, zRet, -1, sqlite3_free); + tdsqlite3_result_text(context, zRet, -1, tdsqlite3_free); } } } @@ -111685,14 +111685,14 @@ static const FuncDef statGetFuncdef = { static void callStatGet(Parse *pParse, int regStat4, int iParam, int regOut){ #ifdef SQLITE_ENABLE_STAT4 - sqlite3VdbeAddOp2(pParse->pVdbe, OP_Integer, iParam, regStat4+1); + tdsqlite3VdbeAddOp2(pParse->pVdbe, OP_Integer, iParam, regStat4+1); #elif SQLITE_DEBUG assert( iParam==STAT_GET_STAT1 ); #else UNUSED_PARAMETER( iParam ); #endif assert( regOut!=regStat4 && regOut!=regStat4+1 ); - sqlite3VdbeAddFunctionCall(pParse, 0, regStat4, regOut, 1+IsStat4, + tdsqlite3VdbeAddFunctionCall(pParse, 0, regStat4, regOut, 1+IsStat4, &statGetFuncdef, 0); } @@ -111708,7 +111708,7 @@ static void analyzeOneTable( int iMem, /* Available memory locations begin here */ int iTab /* Next available cursor */ ){ - sqlite3 *db = pParse->db; /* Database handle */ + tdsqlite3 *db = pParse->db; /* Database handle */ Index *pIdx; /* An index to being analyzed */ int iIdxCur; /* Cursor open on index being analyzed */ int iTabCur; /* Table cursor */ @@ -111733,7 +111733,7 @@ static void analyzeOneTable( #endif pParse->nMem = MAX(pParse->nMem, iMem); - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( v==0 || NEVER(pTab==0) ){ return; } @@ -111741,16 +111741,16 @@ static void analyzeOneTable( /* Do not gather statistics on views or virtual tables */ return; } - if( sqlite3_strlike("sqlite\\_%", pTab->zName, '\\')==0 ){ + if( tdsqlite3_strlike("sqlite\\_%", pTab->zName, '\\')==0 ){ /* Do not gather statistics on system tables */ return; } - assert( sqlite3BtreeHoldsAllMutexes(db) ); - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); + assert( tdsqlite3BtreeHoldsAllMutexes(db) ); + iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); assert( iDb>=0 ); - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); #ifndef SQLITE_OMIT_AUTHORIZATION - if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0, + if( tdsqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0, db->aDb[iDb].zDbSName ) ){ return; } @@ -111758,13 +111758,13 @@ static void analyzeOneTable( #ifdef SQLITE_ENABLE_PREUPDATE_HOOK if( db->xPreUpdateCallback ){ - pStat1 = (Table*)sqlite3DbMallocZero(db, sizeof(Table) + 13); + pStat1 = (Table*)tdsqlite3DbMallocZero(db, sizeof(Table) + 13); if( pStat1==0 ) return; pStat1->zName = (char*)&pStat1[1]; memcpy(pStat1->zName, "sqlite_stat1", 13); pStat1->nCol = 3; pStat1->iPKey = -1; - sqlite3VdbeAddOp4(pParse->pVdbe, OP_Noop, 0, 0, 0,(char*)pStat1,P4_DYNBLOB); + tdsqlite3VdbeAddOp4(pParse->pVdbe, OP_Noop, 0, 0, 0,(char*)pStat1,P4_DYNBLOB); } #endif @@ -111772,12 +111772,12 @@ static void analyzeOneTable( ** Open a read-only cursor on the table. Also allocate a cursor number ** to use for scanning indexes (iIdxCur). No index cursor is opened at ** this time though. */ - sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); + tdsqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); iTabCur = iTab++; iIdxCur = iTab++; pParse->nTab = MAX(pParse->nTab, iTab); - sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead); - sqlite3VdbeLoadString(v, regTabname, pTab->zName); + tdsqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead); + tdsqlite3VdbeLoadString(v, regTabname, pTab->zName); for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int nCol; /* Number of columns in pIdx. "N" */ @@ -111799,7 +111799,7 @@ static void analyzeOneTable( } /* Populate the register containing the index name. */ - sqlite3VdbeLoadString(v, regIdxname, zIdxName); + tdsqlite3VdbeLoadString(v, regIdxname, zIdxName); VdbeComment((v, "Analysis for %s.%s", pTab->zName, zIdxName)); /* @@ -111841,9 +111841,9 @@ static void analyzeOneTable( pParse->nMem = MAX(pParse->nMem, regPrev+nColTest); /* Open a read-only cursor on the index being analyzed. */ - assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) ); - sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); + assert( iDb==tdsqlite3SchemaToIndex(db, pIdx->pSchema) ); + tdsqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb); + tdsqlite3VdbeSetP4KeyInfo(pParse, pIdx); VdbeComment((v, "%s", pIdx->zName)); /* Invoke the stat_init() function. The arguments are: @@ -111857,11 +111857,11 @@ static void analyzeOneTable( ** The third argument is only used for STAT4 */ #ifdef SQLITE_ENABLE_STAT4 - sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regStat4+3); + tdsqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regStat4+3); #endif - sqlite3VdbeAddOp2(v, OP_Integer, nCol, regStat4+1); - sqlite3VdbeAddOp2(v, OP_Integer, pIdx->nKeyCol, regStat4+2); - sqlite3VdbeAddFunctionCall(pParse, 0, regStat4+1, regStat4, 2+IsStat4, + tdsqlite3VdbeAddOp2(v, OP_Integer, nCol, regStat4+1); + tdsqlite3VdbeAddOp2(v, OP_Integer, pIdx->nKeyCol, regStat4+2); + tdsqlite3VdbeAddFunctionCall(pParse, 0, regStat4+1, regStat4, 2+IsStat4, &statInitFuncdef, 0); /* Implementation of the following: @@ -111872,15 +111872,15 @@ static void analyzeOneTable( ** goto next_push_0; ** */ - addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur); + addrRewind = tdsqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur); VdbeCoverage(v); - sqlite3VdbeAddOp2(v, OP_Integer, 0, regChng); - addrNextRow = sqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, regChng); + addrNextRow = tdsqlite3VdbeCurrentAddr(v); if( nColTest>0 ){ - int endDistinctTest = sqlite3VdbeMakeLabel(pParse); + int endDistinctTest = tdsqlite3VdbeMakeLabel(pParse); int *aGotoChng; /* Array of jump instruction addresses */ - aGotoChng = sqlite3DbMallocRawNN(db, sizeof(int)*nColTest); + aGotoChng = tdsqlite3DbMallocRawNN(db, sizeof(int)*nColTest); if( aGotoChng==0 ) continue; /* @@ -111893,26 +111893,26 @@ static void analyzeOneTable( ** regChng = N ** goto endDistinctTest */ - sqlite3VdbeAddOp0(v, OP_Goto); - addrNextRow = sqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeAddOp0(v, OP_Goto); + addrNextRow = tdsqlite3VdbeCurrentAddr(v); if( nColTest==1 && pIdx->nKeyCol==1 && IsUniqueIndex(pIdx) ){ /* For a single-column UNIQUE index, once we have found a non-NULL ** row, we know that all the rest will be distinct, so skip ** subsequent distinctness tests. */ - sqlite3VdbeAddOp2(v, OP_NotNull, regPrev, endDistinctTest); + tdsqlite3VdbeAddOp2(v, OP_NotNull, regPrev, endDistinctTest); VdbeCoverage(v); } for(i=0; iazColl[i]); - sqlite3VdbeAddOp2(v, OP_Integer, i, regChng); - sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regTemp); + char *pColl = (char*)tdsqlite3LocateCollSeq(pParse, pIdx->azColl[i]); + tdsqlite3VdbeAddOp2(v, OP_Integer, i, regChng); + tdsqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regTemp); aGotoChng[i] = - sqlite3VdbeAddOp4(v, OP_Ne, regTemp, 0, regPrev+i, pColl, P4_COLLSEQ); - sqlite3VdbeChangeP5(v, SQLITE_NULLEQ); + tdsqlite3VdbeAddOp4(v, OP_Ne, regTemp, 0, regPrev+i, pColl, P4_COLLSEQ); + tdsqlite3VdbeChangeP5(v, SQLITE_NULLEQ); VdbeCoverage(v); } - sqlite3VdbeAddOp2(v, OP_Integer, nColTest, regChng); - sqlite3VdbeGoto(v, endDistinctTest); + tdsqlite3VdbeAddOp2(v, OP_Integer, nColTest, regChng); + tdsqlite3VdbeGoto(v, endDistinctTest); /* @@ -111922,13 +111922,13 @@ static void analyzeOneTable( ** regPrev(1) = idx(1) ** ... */ - sqlite3VdbeJumpHere(v, addrNextRow-1); + tdsqlite3VdbeJumpHere(v, addrNextRow-1); for(i=0; ipTable); + Index *pPk = tdsqlite3PrimaryKeyIndex(pIdx->pTable); int j, k, regKey; - regKey = sqlite3GetTempRange(pParse, pPk->nKeyCol); + regKey = tdsqlite3GetTempRange(pParse, pPk->nKeyCol); for(j=0; jnKeyCol; j++){ - k = sqlite3TableColumnToIndex(pIdx, pPk->aiColumn[j]); + k = tdsqlite3TableColumnToIndex(pIdx, pPk->aiColumn[j]); assert( k>=0 && knColumn ); - sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, k, regKey+j); + tdsqlite3VdbeAddOp3(v, OP_Column, iIdxCur, k, regKey+j); VdbeComment((v, "%s", pTab->aCol[pPk->aiColumn[j]].zName)); } - sqlite3VdbeAddOp3(v, OP_MakeRecord, regKey, pPk->nKeyCol, regRowid); - sqlite3ReleaseTempRange(pParse, regKey, pPk->nKeyCol); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, regKey, pPk->nKeyCol, regRowid); + tdsqlite3ReleaseTempRange(pParse, regKey, pPk->nKeyCol); } #endif assert( regChng==(regStat4+1) ); - sqlite3VdbeAddFunctionCall(pParse, 1, regStat4, regTemp, 2+IsStat4, + tdsqlite3VdbeAddFunctionCall(pParse, 1, regStat4, regTemp, 2+IsStat4, &statPushFuncdef, 0); - sqlite3VdbeAddOp2(v, OP_Next, iIdxCur, addrNextRow); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_Next, iIdxCur, addrNextRow); VdbeCoverage(v); /* Add the entry to the stat1 table. */ callStatGet(pParse, regStat4, STAT_GET_STAT1, regStat1); assert( "BBB"[0]==SQLITE_AFF_TEXT ); - sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, "BBB", 0); - sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid); - sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regTemp, regNewRowid); + tdsqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, "BBB", 0); + tdsqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid); + tdsqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regTemp, regNewRowid); #ifdef SQLITE_ENABLE_PREUPDATE_HOOK - sqlite3VdbeChangeP4(v, -1, (char*)pStat1, P4_TABLE); + tdsqlite3VdbeChangeP4(v, -1, (char*)pStat1, P4_TABLE); #endif - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); + tdsqlite3VdbeChangeP5(v, OPFLAG_APPEND); /* Add the entries to the stat4 table. */ #ifdef SQLITE_ENABLE_STAT4 @@ -111987,29 +111987,29 @@ static void analyzeOneTable( pParse->nMem = MAX(pParse->nMem, regCol+nCol); - addrNext = sqlite3VdbeCurrentAddr(v); + addrNext = tdsqlite3VdbeCurrentAddr(v); callStatGet(pParse, regStat4, STAT_GET_ROWID, regSampleRowid); - addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid); + addrIsNull = tdsqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid); VdbeCoverage(v); callStatGet(pParse, regStat4, STAT_GET_NEQ, regEq); callStatGet(pParse, regStat4, STAT_GET_NLT, regLt); callStatGet(pParse, regStat4, STAT_GET_NDLT, regDLt); - sqlite3VdbeAddOp4Int(v, seekOp, iTabCur, addrNext, regSampleRowid, 0); + tdsqlite3VdbeAddOp4Int(v, seekOp, iTabCur, addrNext, regSampleRowid, 0); VdbeCoverage(v); for(i=0; izName)); - sqlite3VdbeAddOp2(v, OP_Count, iTabCur, regStat1); - jZeroRows = sqlite3VdbeAddOp1(v, OP_IfNot, regStat1); VdbeCoverage(v); - sqlite3VdbeAddOp2(v, OP_Null, 0, regIdxname); + tdsqlite3VdbeAddOp2(v, OP_Count, iTabCur, regStat1); + jZeroRows = tdsqlite3VdbeAddOp1(v, OP_IfNot, regStat1); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, regIdxname); assert( "BBB"[0]==SQLITE_AFF_TEXT ); - sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, "BBB", 0); - sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid); - sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regTemp, regNewRowid); - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); + tdsqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, "BBB", 0); + tdsqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid); + tdsqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regTemp, regNewRowid); + tdsqlite3VdbeChangeP5(v, OPFLAG_APPEND); #ifdef SQLITE_ENABLE_PREUPDATE_HOOK - sqlite3VdbeChangeP4(v, -1, (char*)pStat1, P4_TABLE); + tdsqlite3VdbeChangeP4(v, -1, (char*)pStat1, P4_TABLE); #endif - sqlite3VdbeJumpHere(v, jZeroRows); + tdsqlite3VdbeJumpHere(v, jZeroRows); } } @@ -112039,9 +112039,9 @@ static void analyzeOneTable( ** be loaded into internal hash tables where is can be used. */ static void loadAnalysis(Parse *pParse, int iDb){ - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); if( v ){ - sqlite3VdbeAddOp1(v, OP_LoadAnalysis, iDb); + tdsqlite3VdbeAddOp1(v, OP_LoadAnalysis, iDb); } } @@ -112049,20 +112049,20 @@ static void loadAnalysis(Parse *pParse, int iDb){ ** Generate code that will do an analysis of an entire database */ static void analyzeDatabase(Parse *pParse, int iDb){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Schema *pSchema = db->aDb[iDb].pSchema; /* Schema of database iDb */ HashElem *k; int iStatCur; int iMem; int iTab; - sqlite3BeginWriteOperation(pParse, 0, iDb); + tdsqlite3BeginWriteOperation(pParse, 0, iDb); iStatCur = pParse->nTab; pParse->nTab += 3; openStatTable(pParse, iDb, iStatCur, 0, 0); iMem = pParse->nMem+1; iTab = pParse->nTab; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){ Table *pTab = (Table*)sqliteHashData(k); analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab); @@ -112080,9 +112080,9 @@ static void analyzeTable(Parse *pParse, Table *pTab, Index *pOnlyIdx){ int iStatCur; assert( pTab!=0 ); - assert( sqlite3BtreeHoldsAllMutexes(pParse->db) ); - iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - sqlite3BeginWriteOperation(pParse, 0, iDb); + assert( tdsqlite3BtreeHoldsAllMutexes(pParse->db) ); + iDb = tdsqlite3SchemaToIndex(pParse->db, pTab->pSchema); + tdsqlite3BeginWriteOperation(pParse, 0, iDb); iStatCur = pParse->nTab; pParse->nTab += 3; if( pOnlyIdx ){ @@ -112106,8 +112106,8 @@ static void analyzeTable(Parse *pParse, Table *pTab, Index *pOnlyIdx){ ** Form 2 analyzes all indices the single database named. ** Form 3 analyzes all indices associated with the named table. */ -SQLITE_PRIVATE void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){ - sqlite3 *db = pParse->db; +SQLITE_PRIVATE void tdsqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){ + tdsqlite3 *db = pParse->db; int iDb; int i; char *z, *zDb; @@ -112118,8 +112118,8 @@ SQLITE_PRIVATE void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){ /* Read the database schema. If an error occurs, leave an error message ** and code in pParse and return NULL. */ - assert( sqlite3BtreeHoldsAllMutexes(pParse->db) ); - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ + assert( tdsqlite3BtreeHoldsAllMutexes(pParse->db) ); + if( SQLITE_OK!=tdsqlite3ReadSchema(pParse) ){ return; } @@ -112130,27 +112130,27 @@ SQLITE_PRIVATE void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){ if( i==1 ) continue; /* Do not analyze the TEMP database */ analyzeDatabase(pParse, i); } - }else if( pName2->n==0 && (iDb = sqlite3FindDb(db, pName1))>=0 ){ + }else if( pName2->n==0 && (iDb = tdsqlite3FindDb(db, pName1))>=0 ){ /* Analyze the schema named as the argument */ analyzeDatabase(pParse, iDb); }else{ /* Form 3: Analyze the table or index named as an argument */ - iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pTableName); + iDb = tdsqlite3TwoPartName(pParse, pName1, pName2, &pTableName); if( iDb>=0 ){ zDb = pName2->n ? db->aDb[iDb].zDbSName : 0; - z = sqlite3NameFromToken(db, pTableName); + z = tdsqlite3NameFromToken(db, pTableName); if( z ){ - if( (pIdx = sqlite3FindIndex(db, z, zDb))!=0 ){ + if( (pIdx = tdsqlite3FindIndex(db, z, zDb))!=0 ){ analyzeTable(pParse, pIdx->pTable, pIdx); - }else if( (pTab = sqlite3LocateTable(pParse, 0, z, zDb))!=0 ){ + }else if( (pTab = tdsqlite3LocateTable(pParse, 0, z, zDb))!=0 ){ analyzeTable(pParse, pTab, 0); } - sqlite3DbFree(db, z); + tdsqlite3DbFree(db, z); } } } - if( db->nSqlExec==0 && (v = sqlite3GetVdbe(pParse))!=0 ){ - sqlite3VdbeAddOp0(v, OP_Expire); + if( db->nSqlExec==0 && (v = tdsqlite3GetVdbe(pParse))!=0 ){ + tdsqlite3VdbeAddOp0(v, OP_Expire); } } @@ -112160,7 +112160,7 @@ SQLITE_PRIVATE void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){ */ typedef struct analysisInfo analysisInfo; struct analysisInfo { - sqlite3 *db; + tdsqlite3 *db; const char *zDatabase; }; @@ -112194,12 +112194,12 @@ static void decodeIntArray( } #ifdef SQLITE_ENABLE_STAT4 if( aOut ) aOut[i] = v; - if( aLog ) aLog[i] = sqlite3LogEst(v); + if( aLog ) aLog[i] = tdsqlite3LogEst(v); #else assert( aOut==0 ); UNUSED_PARAMETER(aOut); assert( aLog!=0 ); - aLog[i] = sqlite3LogEst(v); + aLog[i] = tdsqlite3LogEst(v); #endif if( *z==' ' ) z++; } @@ -112211,18 +112211,18 @@ static void decodeIntArray( pIndex->bUnordered = 0; pIndex->noSkipScan = 0; while( z[0] ){ - if( sqlite3_strglob("unordered*", z)==0 ){ + if( tdsqlite3_strglob("unordered*", z)==0 ){ pIndex->bUnordered = 1; - }else if( sqlite3_strglob("sz=[0-9]*", z)==0 ){ - int sz = sqlite3Atoi(z+3); + }else if( tdsqlite3_strglob("sz=[0-9]*", z)==0 ){ + int sz = tdsqlite3Atoi(z+3); if( sz<2 ) sz = 2; - pIndex->szIdxRow = sqlite3LogEst(sz); - }else if( sqlite3_strglob("noskipscan*", z)==0 ){ + pIndex->szIdxRow = tdsqlite3LogEst(sz); + }else if( tdsqlite3_strglob("noskipscan*", z)==0 ){ pIndex->noSkipScan = 1; } #ifdef SQLITE_ENABLE_COSTMULT - else if( sqlite3_strglob("costmult=[0-9]*",z)==0 ){ - pIndex->pTable->costMult = sqlite3LogEst(sqlite3Atoi(z+9)); + else if( tdsqlite3_strglob("costmult=[0-9]*",z)==0 ){ + pIndex->pTable->costMult = tdsqlite3LogEst(tdsqlite3Atoi(z+9)); } #endif while( z[0]!=0 && z[0]!=' ' ) z++; @@ -112254,16 +112254,16 @@ static int analysisLoader(void *pData, int argc, char **argv, char **NotUsed){ if( argv==0 || argv[0]==0 || argv[2]==0 ){ return 0; } - pTable = sqlite3FindTable(pInfo->db, argv[0], pInfo->zDatabase); + pTable = tdsqlite3FindTable(pInfo->db, argv[0], pInfo->zDatabase); if( pTable==0 ){ return 0; } if( argv[1]==0 ){ pIndex = 0; - }else if( sqlite3_stricmp(argv[0],argv[1])==0 ){ - pIndex = sqlite3PrimaryKeyIndex(pTable); + }else if( tdsqlite3_stricmp(argv[0],argv[1])==0 ){ + pIndex = tdsqlite3PrimaryKeyIndex(pTable); }else{ - pIndex = sqlite3FindIndex(pInfo->db, argv[1], pInfo->zDatabase); + pIndex = tdsqlite3FindIndex(pInfo->db, argv[1], pInfo->zDatabase); } z = argv[2]; @@ -112275,8 +112275,8 @@ static int analysisLoader(void *pData, int argc, char **argv, char **NotUsed){ ** sqlite_stat1 entries for this index. In that case just clobber ** the old data with the new instead of allocating a new array. */ if( pIndex->aiRowEst==0 ){ - pIndex->aiRowEst = (tRowcnt*)sqlite3MallocZero(sizeof(tRowcnt) * nCol); - if( pIndex->aiRowEst==0 ) sqlite3OomFault(pInfo->db); + pIndex->aiRowEst = (tRowcnt*)tdsqlite3MallocZero(sizeof(tRowcnt) * nCol); + if( pIndex->aiRowEst==0 ) tdsqlite3OomFault(pInfo->db); } aiRowEst = pIndex->aiRowEst; #endif @@ -112305,15 +112305,15 @@ static int analysisLoader(void *pData, int argc, char **argv, char **NotUsed){ ** If the Index.aSample variable is not NULL, delete the aSample[] array ** and its contents. */ -SQLITE_PRIVATE void sqlite3DeleteIndexSamples(sqlite3 *db, Index *pIdx){ +SQLITE_PRIVATE void tdsqlite3DeleteIndexSamples(tdsqlite3 *db, Index *pIdx){ #ifdef SQLITE_ENABLE_STAT4 if( pIdx->aSample ){ int j; for(j=0; jnSample; j++){ IndexSample *p = &pIdx->aSample[j]; - sqlite3DbFree(db, p->p); + tdsqlite3DbFree(db, p->p); } - sqlite3DbFree(db, pIdx->aSample); + tdsqlite3DbFree(db, pIdx->aSample); } if( db && db->pnBytesFreed==0 ){ pIdx->nSample = 0; @@ -112390,14 +112390,14 @@ static void initAvgEq(Index *pIdx){ ** is supplied instead, find the PRIMARY KEY index for that table. */ static Index *findIndexOrPrimaryKey( - sqlite3 *db, + tdsqlite3 *db, const char *zName, const char *zDb ){ - Index *pIdx = sqlite3FindIndex(db, zName, zDb); + Index *pIdx = tdsqlite3FindIndex(db, zName, zDb); if( pIdx==0 ){ - Table *pTab = sqlite3FindTable(db, zName, zDb); - if( pTab && !HasRowid(pTab) ) pIdx = sqlite3PrimaryKeyIndex(pTab); + Table *pTab = tdsqlite3FindTable(db, zName, zDb); + if( pTab && !HasRowid(pTab) ) pIdx = tdsqlite3PrimaryKeyIndex(pTab); } return pIdx; } @@ -112415,27 +112415,27 @@ static Index *findIndexOrPrimaryKey( ** where %Q is replaced with the database name before the SQL is executed. */ static int loadStatTbl( - sqlite3 *db, /* Database handle */ + tdsqlite3 *db, /* Database handle */ const char *zSql1, /* SQL statement 1 (see above) */ const char *zSql2, /* SQL statement 2 (see above) */ const char *zDb /* Database name (e.g. "main") */ ){ int rc; /* Result codes from subroutines */ - sqlite3_stmt *pStmt = 0; /* An SQL statement being run */ + tdsqlite3_stmt *pStmt = 0; /* An SQL statement being run */ char *zSql; /* Text of the SQL statement */ Index *pPrevIdx = 0; /* Previous index in the loop */ IndexSample *pSample; /* A slot in pIdx->aSample[] */ assert( db->lookaside.bDisable ); - zSql = sqlite3MPrintf(db, zSql1, zDb); + zSql = tdsqlite3MPrintf(db, zSql1, zDb); if( !zSql ){ return SQLITE_NOMEM_BKPT; } - rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0); - sqlite3DbFree(db, zSql); + rc = tdsqlite3_prepare(db, zSql, -1, &pStmt, 0); + tdsqlite3DbFree(db, zSql); if( rc ) return rc; - while( sqlite3_step(pStmt)==SQLITE_ROW ){ + while( tdsqlite3_step(pStmt)==SQLITE_ROW ){ int nIdxCol = 1; /* Number of columns in stat4 records */ char *zIndex; /* Index name */ @@ -112445,9 +112445,9 @@ static int loadStatTbl( int i; /* Bytes of space required */ tRowcnt *pSpace; - zIndex = (char *)sqlite3_column_text(pStmt, 0); + zIndex = (char *)tdsqlite3_column_text(pStmt, 0); if( zIndex==0 ) continue; - nSample = sqlite3_column_int(pStmt, 1); + nSample = tdsqlite3_column_int(pStmt, 1); pIdx = findIndexOrPrimaryKey(db, zIndex, zDb); assert( pIdx==0 || pIdx->nSample==0 ); if( pIdx==0 ) continue; @@ -112462,9 +112462,9 @@ static int loadStatTbl( nByte += sizeof(tRowcnt) * nIdxCol * 3 * nSample; nByte += nIdxCol * sizeof(tRowcnt); /* Space for Index.aAvgEq[] */ - pIdx->aSample = sqlite3DbMallocZero(db, nByte); + pIdx->aSample = tdsqlite3DbMallocZero(db, nByte); if( pIdx->aSample==0 ){ - sqlite3_finalize(pStmt); + tdsqlite3_finalize(pStmt); return SQLITE_NOMEM_BKPT; } pSpace = (tRowcnt*)&pIdx->aSample[nSample]; @@ -112476,23 +112476,23 @@ static int loadStatTbl( } assert( ((u8*)pSpace)-nByte==(u8*)(pIdx->aSample) ); } - rc = sqlite3_finalize(pStmt); + rc = tdsqlite3_finalize(pStmt); if( rc ) return rc; - zSql = sqlite3MPrintf(db, zSql2, zDb); + zSql = tdsqlite3MPrintf(db, zSql2, zDb); if( !zSql ){ return SQLITE_NOMEM_BKPT; } - rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0); - sqlite3DbFree(db, zSql); + rc = tdsqlite3_prepare(db, zSql, -1, &pStmt, 0); + tdsqlite3DbFree(db, zSql); if( rc ) return rc; - while( sqlite3_step(pStmt)==SQLITE_ROW ){ + while( tdsqlite3_step(pStmt)==SQLITE_ROW ){ char *zIndex; /* Index name */ Index *pIdx; /* Pointer to the index object */ int nCol = 1; /* Number of columns in index */ - zIndex = (char *)sqlite3_column_text(pStmt, 0); + zIndex = (char *)tdsqlite3_column_text(pStmt, 0); if( zIndex==0 ) continue; pIdx = findIndexOrPrimaryKey(db, zIndex, zDb); if( pIdx==0 ) continue; @@ -112504,28 +112504,28 @@ static int loadStatTbl( pPrevIdx = pIdx; } pSample = &pIdx->aSample[pIdx->nSample]; - decodeIntArray((char*)sqlite3_column_text(pStmt,1),nCol,pSample->anEq,0,0); - decodeIntArray((char*)sqlite3_column_text(pStmt,2),nCol,pSample->anLt,0,0); - decodeIntArray((char*)sqlite3_column_text(pStmt,3),nCol,pSample->anDLt,0,0); + decodeIntArray((char*)tdsqlite3_column_text(pStmt,1),nCol,pSample->anEq,0,0); + decodeIntArray((char*)tdsqlite3_column_text(pStmt,2),nCol,pSample->anLt,0,0); + decodeIntArray((char*)tdsqlite3_column_text(pStmt,3),nCol,pSample->anDLt,0,0); /* Take a copy of the sample. Add two 0x00 bytes the end of the buffer. ** This is in case the sample record is corrupted. In that case, the - ** sqlite3VdbeRecordCompare() may read up to two varints past the + ** tdsqlite3VdbeRecordCompare() may read up to two varints past the ** end of the allocated buffer before it realizes it is dealing with ** a corrupt record. Adding the two 0x00 bytes prevents this from causing ** a buffer overread. */ - pSample->n = sqlite3_column_bytes(pStmt, 4); - pSample->p = sqlite3DbMallocZero(db, pSample->n + 2); + pSample->n = tdsqlite3_column_bytes(pStmt, 4); + pSample->p = tdsqlite3DbMallocZero(db, pSample->n + 2); if( pSample->p==0 ){ - sqlite3_finalize(pStmt); + tdsqlite3_finalize(pStmt); return SQLITE_NOMEM_BKPT; } if( pSample->n ){ - memcpy(pSample->p, sqlite3_column_blob(pStmt, 4), pSample->n); + memcpy(pSample->p, tdsqlite3_column_blob(pStmt, 4), pSample->n); } pIdx->nSample++; } - rc = sqlite3_finalize(pStmt); + rc = tdsqlite3_finalize(pStmt); if( rc==SQLITE_OK ) initAvgEq(pPrevIdx); return rc; } @@ -112534,11 +112534,11 @@ static int loadStatTbl( ** Load content from the sqlite_stat4 table into ** the Index.aSample[] arrays of all indices. */ -static int loadStat4(sqlite3 *db, const char *zDb){ +static int loadStat4(tdsqlite3 *db, const char *zDb){ int rc = SQLITE_OK; /* Result codes from subroutines */ assert( db->lookaside.bDisable ); - if( sqlite3FindTable(db, "sqlite_stat4", zDb) ){ + if( tdsqlite3FindTable(db, "sqlite_stat4", zDb) ){ rc = loadStatTbl(db, "SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx", "SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4", @@ -112569,7 +112569,7 @@ static int loadStat4(sqlite3 *db, const char *zDb){ ** This means if the caller does not care about other errors, the return ** code may be ignored. */ -SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){ +SQLITE_PRIVATE int tdsqlite3AnalysisLoad(tdsqlite3 *db, int iDb){ analysisInfo sInfo; HashElem *i; char *zSql; @@ -112580,7 +112580,7 @@ SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){ assert( db->aDb[iDb].pBt!=0 ); /* Clear any prior statistics */ - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); for(i=sqliteHashFirst(&pSchema->tblHash); i; i=sqliteHashNext(i)){ Table *pTab = sqliteHashData(i); pTab->tabFlags &= ~TF_HasStat1; @@ -112589,7 +112589,7 @@ SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){ Index *pIdx = sqliteHashData(i); pIdx->hasStat1 = 0; #ifdef SQLITE_ENABLE_STAT4 - sqlite3DeleteIndexSamples(db, pIdx); + tdsqlite3DeleteIndexSamples(db, pIdx); pIdx->aSample = 0; #endif } @@ -112597,22 +112597,22 @@ SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){ /* Load new statistics out of the sqlite_stat1 table */ sInfo.db = db; sInfo.zDatabase = db->aDb[iDb].zDbSName; - if( sqlite3FindTable(db, "sqlite_stat1", sInfo.zDatabase)!=0 ){ - zSql = sqlite3MPrintf(db, + if( tdsqlite3FindTable(db, "sqlite_stat1", sInfo.zDatabase)!=0 ){ + zSql = tdsqlite3MPrintf(db, "SELECT tbl,idx,stat FROM %Q.sqlite_stat1", sInfo.zDatabase); if( zSql==0 ){ rc = SQLITE_NOMEM_BKPT; }else{ - rc = sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0); - sqlite3DbFree(db, zSql); + rc = tdsqlite3_exec(db, zSql, analysisLoader, &sInfo, 0); + tdsqlite3DbFree(db, zSql); } } /* Set appropriate defaults on all indexes not in the sqlite_stat1 table */ - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){ Index *pIdx = sqliteHashData(i); - if( !pIdx->hasStat1 ) sqlite3DefaultRowEst(pIdx); + if( !pIdx->hasStat1 ) tdsqlite3DefaultRowEst(pIdx); } /* Load the statistics from the sqlite_stat4 table. */ @@ -112624,13 +112624,13 @@ SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){ } for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){ Index *pIdx = sqliteHashData(i); - sqlite3_free(pIdx->aiRowEst); + tdsqlite3_free(pIdx->aiRowEst); pIdx->aiRowEst = 0; } #endif if( rc==SQLITE_NOMEM ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); } return rc; } @@ -112679,7 +112679,7 @@ static int resolveAttachExpr(NameContext *pName, Expr *pExpr) int rc = SQLITE_OK; if( pExpr ){ if( pExpr->op!=TK_ID ){ - rc = sqlite3ResolveExprNames(pName, pExpr); + rc = tdsqlite3ResolveExprNames(pName, pExpr); }else{ pExpr->op = TK_STRING; } @@ -112703,13 +112703,13 @@ static int resolveAttachExpr(NameContext *pName, Expr *pExpr) ** empty MemDB. */ static void attachFunc( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **argv + tdsqlite3_value **argv ){ int i; int rc = 0; - sqlite3 *db = sqlite3_context_db_handle(context); + tdsqlite3 *db = tdsqlite3_context_db_handle(context); const char *zName; const char *zFile; char *zPath = 0; @@ -112718,11 +112718,11 @@ static void attachFunc( Db *aNew; /* New array of Db pointers */ Db *pNew; /* Db object for the newly attached database */ char *zErrDyn = 0; - sqlite3_vfs *pVfs; + tdsqlite3_vfs *pVfs; UNUSED_PARAMETER(NotUsed); - zFile = (const char *)sqlite3_value_text(argv[0]); - zName = (const char *)sqlite3_value_text(argv[1]); + zFile = (const char *)tdsqlite3_value_text(argv[0]); + zName = (const char *)tdsqlite3_value_text(argv[1]); if( zFile==0 ) zFile = ""; if( zName==0 ) zName = ""; @@ -112734,15 +112734,15 @@ static void attachFunc( if( REOPEN_AS_MEMDB(db) ){ /* This is not a real ATTACH. Instead, this routine is being called - ** from sqlite3_deserialize() to close database db->init.iDb and + ** from tdsqlite3_deserialize() to close database db->init.iDb and ** reopen it as a MemDB */ - pVfs = sqlite3_vfs_find("memdb"); + pVfs = tdsqlite3_vfs_find("memdb"); if( pVfs==0 ) return; pNew = &db->aDb[db->init.iDb]; - if( pNew->pBt ) sqlite3BtreeClose(pNew->pBt); + if( pNew->pBt ) tdsqlite3BtreeClose(pNew->pBt); pNew->pBt = 0; pNew->pSchema = 0; - rc = sqlite3BtreeOpen(pVfs, "x\0", db, &pNew->pBt, 0, SQLITE_OPEN_MAIN_DB); + rc = tdsqlite3BtreeOpen(pVfs, "x\0", db, &pNew->pBt, 0, SQLITE_OPEN_MAIN_DB); }else{ /* This is a real ATTACH ** @@ -112753,7 +112753,7 @@ static void attachFunc( ** * Specified database name already being used. */ if( db->nDb>=db->aLimit[SQLITE_LIMIT_ATTACHED]+2 ){ - zErrDyn = sqlite3MPrintf(db, "too many attached databases - max %d", + zErrDyn = tdsqlite3MPrintf(db, "too many attached databases - max %d", db->aLimit[SQLITE_LIMIT_ATTACHED] ); goto attach_error; @@ -112761,8 +112761,8 @@ static void attachFunc( for(i=0; inDb; i++){ char *z = db->aDb[i].zDbSName; assert( z && zName ); - if( sqlite3StrICmp(z, zName)==0 ){ - zErrDyn = sqlite3MPrintf(db, "database %s is already in use", zName); + if( tdsqlite3StrICmp(z, zName)==0 ){ + zErrDyn = tdsqlite3MPrintf(db, "database %s is already in use", zName); goto attach_error; } } @@ -112771,11 +112771,11 @@ static void attachFunc( ** hash tables. */ if( db->aDb==db->aDbStatic ){ - aNew = sqlite3DbMallocRawNN(db, sizeof(db->aDb[0])*3 ); + aNew = tdsqlite3DbMallocRawNN(db, sizeof(db->aDb[0])*3 ); if( aNew==0 ) return; memcpy(aNew, db->aDb, sizeof(db->aDb[0])*2); }else{ - aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(db->nDb+1) ); + aNew = tdsqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(db->nDb+1) ); if( aNew==0 ) return; } db->aDb = aNew; @@ -112787,43 +112787,43 @@ static void attachFunc( ** or may not be initialized. */ flags = db->openFlags; - rc = sqlite3ParseUri(db->pVfs->zName, zFile, &flags, &pVfs, &zPath, &zErr); + rc = tdsqlite3ParseUri(db->pVfs->zName, zFile, &flags, &pVfs, &zPath, &zErr); if( rc!=SQLITE_OK ){ - if( rc==SQLITE_NOMEM ) sqlite3OomFault(db); - sqlite3_result_error(context, zErr, -1); - sqlite3_free(zErr); + if( rc==SQLITE_NOMEM ) tdsqlite3OomFault(db); + tdsqlite3_result_error(context, zErr, -1); + tdsqlite3_free(zErr); return; } assert( pVfs ); flags |= SQLITE_OPEN_MAIN_DB; - rc = sqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags); + rc = tdsqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags); db->nDb++; - pNew->zDbSName = sqlite3DbStrDup(db, zName); + pNew->zDbSName = tdsqlite3DbStrDup(db, zName); } db->noSharedCache = 0; if( rc==SQLITE_CONSTRAINT ){ rc = SQLITE_ERROR; - zErrDyn = sqlite3MPrintf(db, "database is already attached"); + zErrDyn = tdsqlite3MPrintf(db, "database is already attached"); }else if( rc==SQLITE_OK ){ Pager *pPager; - pNew->pSchema = sqlite3SchemaGet(db, pNew->pBt); + pNew->pSchema = tdsqlite3SchemaGet(db, pNew->pBt); if( !pNew->pSchema ){ rc = SQLITE_NOMEM_BKPT; }else if( pNew->pSchema->file_format && pNew->pSchema->enc!=ENC(db) ){ - zErrDyn = sqlite3MPrintf(db, + zErrDyn = tdsqlite3MPrintf(db, "attached databases must use the same text encoding as main database"); rc = SQLITE_ERROR; } - sqlite3BtreeEnter(pNew->pBt); - pPager = sqlite3BtreePager(pNew->pBt); - sqlite3PagerLockingMode(pPager, db->dfltLockMode); - sqlite3BtreeSecureDelete(pNew->pBt, - sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) ); + tdsqlite3BtreeEnter(pNew->pBt); + pPager = tdsqlite3BtreePager(pNew->pBt); + tdsqlite3PagerLockingMode(pPager, db->dfltLockMode); + tdsqlite3BtreeSecureDelete(pNew->pBt, + tdsqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) ); #ifndef SQLITE_OMIT_PAGER_PRAGMAS - sqlite3BtreeSetPagerFlags(pNew->pBt, + tdsqlite3BtreeSetPagerFlags(pNew->pBt, PAGER_SYNCHRONOUS_FULL | (db->flags & PAGER_FLAGS_MASK)); #endif - sqlite3BtreeLeave(pNew->pBt); + tdsqlite3BtreeLeave(pNew->pBt); } pNew->safety_level = SQLITE_DEFAULT_SYNCHRONOUS+1; if( rc==SQLITE_OK && pNew->zDbSName==0 ){ @@ -112833,39 +112833,39 @@ static void attachFunc( #ifdef SQLITE_HAS_CODEC if( rc==SQLITE_OK ){ - extern int sqlite3CodecAttach(sqlite3*, int, const void*, int); - extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*); + extern int tdsqlite3CodecAttach(tdsqlite3*, int, const void*, int); + extern void tdsqlite3CodecGetKey(tdsqlite3*, int, void**, int*); int nKey; char *zKey; - int t = sqlite3_value_type(argv[2]); + int t = tdsqlite3_value_type(argv[2]); switch( t ){ case SQLITE_INTEGER: case SQLITE_FLOAT: - zErrDyn = sqlite3DbStrDup(db, "Invalid key value"); + zErrDyn = tdsqlite3DbStrDup(db, "Invalid key value"); rc = SQLITE_ERROR; break; case SQLITE_TEXT: case SQLITE_BLOB: - nKey = sqlite3_value_bytes(argv[2]); - zKey = (char *)sqlite3_value_blob(argv[2]); - rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey); + nKey = tdsqlite3_value_bytes(argv[2]); + zKey = (char *)tdsqlite3_value_blob(argv[2]); + rc = tdsqlite3CodecAttach(db, db->nDb-1, zKey, nKey); break; case SQLITE_NULL: /* No key specified. Use the key from URI filename, or if none, ** use the key from the main database. */ - if( sqlite3CodecQueryParameters(db, zName, zPath)==0 ){ - sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey); - if( nKey || sqlite3BtreeGetOptimalReserve(db->aDb[0].pBt)>0 ){ - rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey); + if( tdsqlite3CodecQueryParameters(db, zName, zPath)==0 ){ + tdsqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey); + if( nKey || tdsqlite3BtreeGetOptimalReserve(db->aDb[0].pBt)>0 ){ + rc = tdsqlite3CodecAttach(db, db->nDb-1, zKey, nKey); } } break; } } #endif - sqlite3_free( zPath ); + tdsqlite3_free( zPath ); /* If the file was opened successfully, read the schema for the new database. ** If this fails, or if opening the file failed, then close the file and @@ -112873,19 +112873,19 @@ static void attachFunc( ** way we found it. */ if( rc==SQLITE_OK ){ - sqlite3BtreeEnterAll(db); + tdsqlite3BtreeEnterAll(db); db->init.iDb = 0; db->mDbFlags &= ~(DBFLAG_SchemaKnownOk); if( !REOPEN_AS_MEMDB(db) ){ - rc = sqlite3Init(db, &zErrDyn); + rc = tdsqlite3Init(db, &zErrDyn); } - sqlite3BtreeLeaveAll(db); + tdsqlite3BtreeLeaveAll(db); assert( zErrDyn==0 || rc!=SQLITE_OK ); } #ifdef SQLITE_USER_AUTHENTICATION if( rc==SQLITE_OK && !REOPEN_AS_MEMDB(db) ){ u8 newAuth = 0; - rc = sqlite3UserAuthCheckLogin(db, zName, &newAuth); + rc = tdsqlite3UserAuthCheckLogin(db, zName, &newAuth); if( newAuthauth.authLevel ){ rc = SQLITE_AUTH_USER; } @@ -112896,18 +112896,18 @@ static void attachFunc( int iDb = db->nDb - 1; assert( iDb>=2 ); if( db->aDb[iDb].pBt ){ - sqlite3BtreeClose(db->aDb[iDb].pBt); + tdsqlite3BtreeClose(db->aDb[iDb].pBt); db->aDb[iDb].pBt = 0; db->aDb[iDb].pSchema = 0; } - sqlite3ResetAllSchemasOfConnection(db); + tdsqlite3ResetAllSchemasOfConnection(db); db->nDb = iDb; if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){ - sqlite3OomFault(db); - sqlite3DbFree(db, zErrDyn); - zErrDyn = sqlite3MPrintf(db, "out of memory"); + tdsqlite3OomFault(db); + tdsqlite3DbFree(db, zErrDyn); + zErrDyn = tdsqlite3MPrintf(db, "out of memory"); }else if( zErrDyn==0 ){ - zErrDyn = sqlite3MPrintf(db, "unable to open database: %s", zFile); + zErrDyn = tdsqlite3MPrintf(db, "unable to open database: %s", zFile); } } goto attach_error; @@ -112918,10 +112918,10 @@ static void attachFunc( attach_error: /* Return an error if we get here */ if( zErrDyn ){ - sqlite3_result_error(context, zErrDyn, -1); - sqlite3DbFree(db, zErrDyn); + tdsqlite3_result_error(context, zErrDyn, -1); + tdsqlite3DbFree(db, zErrDyn); } - if( rc ) sqlite3_result_error_code(context, rc); + if( rc ) tdsqlite3_result_error_code(context, rc); } /* @@ -112933,12 +112933,12 @@ attach_error: ** SELECT sqlite_detach(x) */ static void detachFunc( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **argv + tdsqlite3_value **argv ){ - const char *zName = (const char *)sqlite3_value_text(argv[0]); - sqlite3 *db = sqlite3_context_db_handle(context); + const char *zName = (const char *)tdsqlite3_value_text(argv[0]); + tdsqlite3 *db = tdsqlite3_context_db_handle(context); int i; Db *pDb = 0; HashElem *pEntry; @@ -112950,19 +112950,19 @@ static void detachFunc( for(i=0; inDb; i++){ pDb = &db->aDb[i]; if( pDb->pBt==0 ) continue; - if( sqlite3StrICmp(pDb->zDbSName, zName)==0 ) break; + if( tdsqlite3StrICmp(pDb->zDbSName, zName)==0 ) break; } if( i>=db->nDb ){ - sqlite3_snprintf(sizeof(zErr),zErr, "no such database: %s", zName); + tdsqlite3_snprintf(sizeof(zErr),zErr, "no such database: %s", zName); goto detach_error; } if( i<2 ){ - sqlite3_snprintf(sizeof(zErr),zErr, "cannot detach database %s", zName); + tdsqlite3_snprintf(sizeof(zErr),zErr, "cannot detach database %s", zName); goto detach_error; } - if( sqlite3BtreeIsInReadTrans(pDb->pBt) || sqlite3BtreeIsInBackup(pDb->pBt) ){ - sqlite3_snprintf(sizeof(zErr),zErr, "database %s is locked", zName); + if( tdsqlite3BtreeIsInReadTrans(pDb->pBt) || tdsqlite3BtreeIsInBackup(pDb->pBt) ){ + tdsqlite3_snprintf(sizeof(zErr),zErr, "database %s is locked", zName); goto detach_error; } @@ -112978,14 +112978,14 @@ static void detachFunc( pEntry = sqliteHashNext(pEntry); } - sqlite3BtreeClose(pDb->pBt); + tdsqlite3BtreeClose(pDb->pBt); pDb->pBt = 0; pDb->pSchema = 0; - sqlite3CollapseDatabaseArray(db); + tdsqlite3CollapseDatabaseArray(db); return; detach_error: - sqlite3_result_error(context, zErr, -1); + tdsqlite3_result_error(context, zErr, -1); } /* @@ -113004,7 +113004,7 @@ static void codeAttach( int rc; NameContext sName; Vdbe *v; - sqlite3* db = pParse->db; + tdsqlite3* db = pParse->db; int regArgs; if( pParse->nErr ) goto attach_end; @@ -113027,7 +113027,7 @@ static void codeAttach( }else{ zAuthArg = 0; } - rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0); + rc = tdsqlite3AuthCheck(pParse, type, zAuthArg, 0, 0); if(rc!=SQLITE_OK ){ goto attach_end; } @@ -113035,27 +113035,27 @@ static void codeAttach( #endif /* SQLITE_OMIT_AUTHORIZATION */ - v = sqlite3GetVdbe(pParse); - regArgs = sqlite3GetTempRange(pParse, 4); - sqlite3ExprCode(pParse, pFilename, regArgs); - sqlite3ExprCode(pParse, pDbname, regArgs+1); - sqlite3ExprCode(pParse, pKey, regArgs+2); + v = tdsqlite3GetVdbe(pParse); + regArgs = tdsqlite3GetTempRange(pParse, 4); + tdsqlite3ExprCode(pParse, pFilename, regArgs); + tdsqlite3ExprCode(pParse, pDbname, regArgs+1); + tdsqlite3ExprCode(pParse, pKey, regArgs+2); assert( v || db->mallocFailed ); if( v ){ - sqlite3VdbeAddFunctionCall(pParse, 0, regArgs+3-pFunc->nArg, regArgs+3, + tdsqlite3VdbeAddFunctionCall(pParse, 0, regArgs+3-pFunc->nArg, regArgs+3, pFunc->nArg, pFunc, 0); /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this ** statement only). For DETACH, set it to false (expire all existing ** statements). */ - sqlite3VdbeAddOp1(v, OP_Expire, (type==SQLITE_ATTACH)); + tdsqlite3VdbeAddOp1(v, OP_Expire, (type==SQLITE_ATTACH)); } attach_end: - sqlite3ExprDelete(db, pFilename); - sqlite3ExprDelete(db, pDbname); - sqlite3ExprDelete(db, pKey); + tdsqlite3ExprDelete(db, pFilename); + tdsqlite3ExprDelete(db, pDbname); + tdsqlite3ExprDelete(db, pKey); } /* @@ -113063,7 +113063,7 @@ attach_end: ** ** DETACH pDbname */ -SQLITE_PRIVATE void sqlite3Detach(Parse *pParse, Expr *pDbname){ +SQLITE_PRIVATE void tdsqlite3Detach(Parse *pParse, Expr *pDbname){ static const FuncDef detach_func = { 1, /* nArg */ SQLITE_UTF8, /* funcFlags */ @@ -113083,7 +113083,7 @@ SQLITE_PRIVATE void sqlite3Detach(Parse *pParse, Expr *pDbname){ ** ** ATTACH p AS pDbname KEY pKey */ -SQLITE_PRIVATE void sqlite3Attach(Parse *pParse, Expr *p, Expr *pDbname, Expr *pKey){ +SQLITE_PRIVATE void tdsqlite3Attach(Parse *pParse, Expr *p, Expr *pDbname, Expr *pKey){ static const FuncDef attach_func = { 3, /* nArg */ SQLITE_UTF8, /* funcFlags */ @@ -113103,14 +113103,14 @@ SQLITE_PRIVATE void sqlite3Attach(Parse *pParse, Expr *p, Expr *pDbname, Expr *p ** Initialize a DbFixer structure. This routine must be called prior ** to passing the structure to one of the sqliteFixAAAA() routines below. */ -SQLITE_PRIVATE void sqlite3FixInit( +SQLITE_PRIVATE void tdsqlite3FixInit( DbFixer *pFix, /* The fixer to be initialized */ Parse *pParse, /* Error messages will be written here */ int iDb, /* This is the database that must be used */ const char *zType, /* "view", "trigger", or "index" */ const Token *pName /* Name of the view, trigger, or index */ ){ - sqlite3 *db; + tdsqlite3 *db; db = pParse->db; assert( db->nDb>iDb ); @@ -113126,7 +113126,7 @@ SQLITE_PRIVATE void sqlite3FixInit( ** The following set of routines walk through the parse tree and assign ** a specific database to all table references where the database name ** was left unspecified in the original SQL statement. The pFix structure -** must have been initialized by a prior call to sqlite3FixInit(). +** must have been initialized by a prior call to tdsqlite3FixInit(). ** ** These routines are used to make sure that an index, trigger, or ** view in one database does not refer to objects in a different database. @@ -113136,7 +113136,7 @@ SQLITE_PRIVATE void sqlite3FixInit( ** pParse->zErrMsg and these routines return non-zero. If everything ** checks out, these routines return 0. */ -SQLITE_PRIVATE int sqlite3FixSrcList( +SQLITE_PRIVATE int tdsqlite3FixSrcList( DbFixer *pFix, /* Context of the fixation */ SrcList *pList /* The Source list to check and modify */ ){ @@ -113148,58 +113148,58 @@ SQLITE_PRIVATE int sqlite3FixSrcList( zDb = pFix->zDb; for(i=0, pItem=pList->a; inSrc; i++, pItem++){ if( pFix->bTemp==0 ){ - if( pItem->zDatabase && sqlite3StrICmp(pItem->zDatabase, zDb) ){ - sqlite3ErrorMsg(pFix->pParse, + if( pItem->zDatabase && tdsqlite3StrICmp(pItem->zDatabase, zDb) ){ + tdsqlite3ErrorMsg(pFix->pParse, "%s %T cannot reference objects in database %s", pFix->zType, pFix->pName, pItem->zDatabase); return 1; } - sqlite3DbFree(pFix->pParse->db, pItem->zDatabase); + tdsqlite3DbFree(pFix->pParse->db, pItem->zDatabase); pItem->zDatabase = 0; pItem->pSchema = pFix->pSchema; pItem->fg.fromDDL = 1; } #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) - if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1; - if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1; + if( tdsqlite3FixSelect(pFix, pItem->pSelect) ) return 1; + if( tdsqlite3FixExpr(pFix, pItem->pOn) ) return 1; #endif - if( pItem->fg.isTabFunc && sqlite3FixExprList(pFix, pItem->u1.pFuncArg) ){ + if( pItem->fg.isTabFunc && tdsqlite3FixExprList(pFix, pItem->u1.pFuncArg) ){ return 1; } } return 0; } #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) -SQLITE_PRIVATE int sqlite3FixSelect( +SQLITE_PRIVATE int tdsqlite3FixSelect( DbFixer *pFix, /* Context of the fixation */ Select *pSelect /* The SELECT statement to be fixed to one database */ ){ while( pSelect ){ - if( sqlite3FixExprList(pFix, pSelect->pEList) ){ + if( tdsqlite3FixExprList(pFix, pSelect->pEList) ){ return 1; } - if( sqlite3FixSrcList(pFix, pSelect->pSrc) ){ + if( tdsqlite3FixSrcList(pFix, pSelect->pSrc) ){ return 1; } - if( sqlite3FixExpr(pFix, pSelect->pWhere) ){ + if( tdsqlite3FixExpr(pFix, pSelect->pWhere) ){ return 1; } - if( sqlite3FixExprList(pFix, pSelect->pGroupBy) ){ + if( tdsqlite3FixExprList(pFix, pSelect->pGroupBy) ){ return 1; } - if( sqlite3FixExpr(pFix, pSelect->pHaving) ){ + if( tdsqlite3FixExpr(pFix, pSelect->pHaving) ){ return 1; } - if( sqlite3FixExprList(pFix, pSelect->pOrderBy) ){ + if( tdsqlite3FixExprList(pFix, pSelect->pOrderBy) ){ return 1; } - if( sqlite3FixExpr(pFix, pSelect->pLimit) ){ + if( tdsqlite3FixExpr(pFix, pSelect->pLimit) ){ return 1; } if( pSelect->pWith ){ int i; for(i=0; ipWith->nCte; i++){ - if( sqlite3FixSelect(pFix, pSelect->pWith->a[i].pSelect) ){ + if( tdsqlite3FixSelect(pFix, pSelect->pWith->a[i].pSelect) ){ return 1; } } @@ -113208,7 +113208,7 @@ SQLITE_PRIVATE int sqlite3FixSelect( } return 0; } -SQLITE_PRIVATE int sqlite3FixExpr( +SQLITE_PRIVATE int tdsqlite3FixExpr( DbFixer *pFix, /* Context of the fixation */ Expr *pExpr /* The expression to be fixed to one database */ ){ @@ -113218,24 +113218,24 @@ SQLITE_PRIVATE int sqlite3FixExpr( if( pFix->pParse->db->init.busy ){ pExpr->op = TK_NULL; }else{ - sqlite3ErrorMsg(pFix->pParse, "%s cannot use variables", pFix->zType); + tdsqlite3ErrorMsg(pFix->pParse, "%s cannot use variables", pFix->zType); return 1; } } if( ExprHasProperty(pExpr, EP_TokenOnly|EP_Leaf) ) break; if( ExprHasProperty(pExpr, EP_xIsSelect) ){ - if( sqlite3FixSelect(pFix, pExpr->x.pSelect) ) return 1; + if( tdsqlite3FixSelect(pFix, pExpr->x.pSelect) ) return 1; }else{ - if( sqlite3FixExprList(pFix, pExpr->x.pList) ) return 1; + if( tdsqlite3FixExprList(pFix, pExpr->x.pList) ) return 1; } - if( sqlite3FixExpr(pFix, pExpr->pRight) ){ + if( tdsqlite3FixExpr(pFix, pExpr->pRight) ){ return 1; } pExpr = pExpr->pLeft; } return 0; } -SQLITE_PRIVATE int sqlite3FixExprList( +SQLITE_PRIVATE int tdsqlite3FixExprList( DbFixer *pFix, /* Context of the fixation */ ExprList *pList /* The expression to be fixed to one database */ ){ @@ -113243,7 +113243,7 @@ SQLITE_PRIVATE int sqlite3FixExprList( struct ExprList_item *pItem; if( pList==0 ) return 0; for(i=0, pItem=pList->a; inExpr; i++, pItem++){ - if( sqlite3FixExpr(pFix, pItem->pExpr) ){ + if( tdsqlite3FixExpr(pFix, pItem->pExpr) ){ return 1; } } @@ -113252,27 +113252,27 @@ SQLITE_PRIVATE int sqlite3FixExprList( #endif #ifndef SQLITE_OMIT_TRIGGER -SQLITE_PRIVATE int sqlite3FixTriggerStep( +SQLITE_PRIVATE int tdsqlite3FixTriggerStep( DbFixer *pFix, /* Context of the fixation */ TriggerStep *pStep /* The trigger step be fixed to one database */ ){ while( pStep ){ - if( sqlite3FixSelect(pFix, pStep->pSelect) ){ + if( tdsqlite3FixSelect(pFix, pStep->pSelect) ){ return 1; } - if( sqlite3FixExpr(pFix, pStep->pWhere) ){ + if( tdsqlite3FixExpr(pFix, pStep->pWhere) ){ return 1; } - if( sqlite3FixExprList(pFix, pStep->pExprList) ){ + if( tdsqlite3FixExprList(pFix, pStep->pExprList) ){ return 1; } #ifndef SQLITE_OMIT_UPSERT if( pStep->pUpsert ){ Upsert *pUp = pStep->pUpsert; - if( sqlite3FixExprList(pFix, pUp->pUpsertTarget) - || sqlite3FixExpr(pFix, pUp->pUpsertTargetWhere) - || sqlite3FixExprList(pFix, pUp->pUpsertSet) - || sqlite3FixExpr(pFix, pUp->pUpsertWhere) + if( tdsqlite3FixExprList(pFix, pUp->pUpsertTarget) + || tdsqlite3FixExpr(pFix, pUp->pUpsertTargetWhere) + || tdsqlite3FixExprList(pFix, pUp->pUpsertSet) + || tdsqlite3FixExpr(pFix, pUp->pUpsertWhere) ){ return 1; } @@ -113297,7 +113297,7 @@ SQLITE_PRIVATE int sqlite3FixTriggerStep( ** May you share freely, never taking more than you give. ** ************************************************************************* -** This file contains code used to implement the sqlite3_set_authorizer() +** This file contains code used to implement the tdsqlite3_set_authorizer() ** API. This facility is an optional feature of the library. Embedded ** systems that do not need this facility may omit it by recompiling ** the library with -DSQLITE_OMIT_AUTHORIZATION=1 @@ -113347,7 +113347,7 @@ SQLITE_PRIVATE int sqlite3FixTriggerStep( ** the table and the column that are being accessed. The auth function ** should return either SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE. If ** SQLITE_OK is returned, it means that access is allowed. SQLITE_DENY -** means that the SQL statement will never-run - the sqlite3_exec() call +** means that the SQL statement will never-run - the tdsqlite3_exec() call ** will return with an error. SQLITE_IGNORE means that the SQL statement ** should run but attempts to read the specified column will return NULL ** and attempts to write the column will be ignored. @@ -113355,19 +113355,19 @@ SQLITE_PRIVATE int sqlite3FixTriggerStep( ** Setting the auth function to NULL disables this hook. The default ** setting of the auth function is NULL. */ -SQLITE_API int sqlite3_set_authorizer( - sqlite3 *db, +SQLITE_API int tdsqlite3_set_authorizer( + tdsqlite3 *db, int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), void *pArg ){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); - db->xAuth = (sqlite3_xauth)xAuth; + tdsqlite3_mutex_enter(db->mutex); + db->xAuth = (tdsqlite3_xauth)xAuth; db->pAuthArg = pArg; - if( db->xAuth ) sqlite3ExpirePreparedStatements(db, 1); - sqlite3_mutex_leave(db->mutex); + if( db->xAuth ) tdsqlite3ExpirePreparedStatements(db, 1); + tdsqlite3_mutex_leave(db->mutex); return SQLITE_OK; } @@ -113376,7 +113376,7 @@ SQLITE_API int sqlite3_set_authorizer( ** user-supplied authorization function returned an illegal value. */ static void sqliteAuthBadReturnCode(Parse *pParse){ - sqlite3ErrorMsg(pParse, "authorizer malfunction"); + tdsqlite3ErrorMsg(pParse, "authorizer malfunction"); pParse->rc = SQLITE_ERROR; } @@ -113389,13 +113389,13 @@ static void sqliteAuthBadReturnCode(Parse *pParse){ ** to an SQL NULL expression. Otherwise, if pExpr is NULL, then SQLITE_IGNORE ** is treated as SQLITE_DENY. In this case an error is left in pParse. */ -SQLITE_PRIVATE int sqlite3AuthReadCol( +SQLITE_PRIVATE int tdsqlite3AuthReadCol( Parse *pParse, /* The parser context */ const char *zTab, /* Table name */ const char *zCol, /* Column name */ int iDb /* Index of containing database. */ ){ - sqlite3 *db = pParse->db; /* Database handle */ + tdsqlite3 *db = pParse->db; /* Database handle */ char *zDb = db->aDb[iDb].zDbSName; /* Schema name of attached database */ int rc; /* Auth callback return code */ @@ -113406,9 +113406,9 @@ SQLITE_PRIVATE int sqlite3AuthReadCol( #endif ); if( rc==SQLITE_DENY ){ - char *z = sqlite3_mprintf("%s.%s", zTab, zCol); - if( db->nDb>2 || iDb!=0 ) z = sqlite3_mprintf("%s.%z", zDb, z); - sqlite3ErrorMsg(pParse, "access to %z is prohibited", z); + char *z = tdsqlite3_mprintf("%s.%s", zTab, zCol); + if( db->nDb>2 || iDb!=0 ) z = tdsqlite3_mprintf("%s.%z", zDb, z); + tdsqlite3ErrorMsg(pParse, "access to %z is prohibited", z); pParse->rc = SQLITE_AUTH; }else if( rc!=SQLITE_IGNORE && rc!=SQLITE_OK ){ sqliteAuthBadReturnCode(pParse); @@ -113425,13 +113425,13 @@ SQLITE_PRIVATE int sqlite3AuthReadCol( ** instruction into a TK_NULL. If the auth function returns SQLITE_DENY, ** then generate an error. */ -SQLITE_PRIVATE void sqlite3AuthRead( +SQLITE_PRIVATE void tdsqlite3AuthRead( Parse *pParse, /* The parser context */ Expr *pExpr, /* The expression to check authorization on */ Schema *pSchema, /* The schema of the expression */ SrcList *pTabList /* All table that pExpr might refer to */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Table *pTab = 0; /* The table being read */ const char *zCol; /* Name of the column of the table */ int iSrc; /* Index in pTabList->a[] of table being read */ @@ -113441,7 +113441,7 @@ SQLITE_PRIVATE void sqlite3AuthRead( assert( pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER ); assert( !IN_RENAME_OBJECT || db->xAuth==0 ); if( db->xAuth==0 ) return; - iDb = sqlite3SchemaToIndex(pParse->db, pSchema); + iDb = tdsqlite3SchemaToIndex(pParse->db, pSchema); if( iDb<0 ){ /* An attempt to read a column out of a subquery or other ** temporary table. */ @@ -113472,7 +113472,7 @@ SQLITE_PRIVATE void sqlite3AuthRead( zCol = "ROWID"; } assert( iDb>=0 && iDbnDb ); - if( SQLITE_IGNORE==sqlite3AuthReadCol(pParse, pTab->zName, zCol, iDb) ){ + if( SQLITE_IGNORE==tdsqlite3AuthReadCol(pParse, pTab->zName, zCol, iDb) ){ pExpr->op = TK_NULL; } } @@ -113483,18 +113483,18 @@ SQLITE_PRIVATE void sqlite3AuthRead( ** is returned, then the error count and error message in pParse are ** modified appropriately. */ -SQLITE_PRIVATE int sqlite3AuthCheck( +SQLITE_PRIVATE int tdsqlite3AuthCheck( Parse *pParse, int code, const char *zArg1, const char *zArg2, const char *zArg3 ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; int rc; /* Don't do any authorization checks if the database is initialising - ** or if the parser is being invoked from within sqlite3_declare_vtab. + ** or if the parser is being invoked from within tdsqlite3_declare_vtab. */ assert( !IN_RENAME_OBJECT || db->xAuth==0 ); if( db->init.busy || IN_SPECIAL_PARSE ){ @@ -113522,7 +113522,7 @@ SQLITE_PRIVATE int sqlite3AuthCheck( #endif ); if( rc==SQLITE_DENY ){ - sqlite3ErrorMsg(pParse, "not authorized"); + tdsqlite3ErrorMsg(pParse, "not authorized"); pParse->rc = SQLITE_AUTH; }else if( rc!=SQLITE_OK && rc!=SQLITE_IGNORE ){ rc = SQLITE_DENY; @@ -113536,7 +113536,7 @@ SQLITE_PRIVATE int sqlite3AuthCheck( ** zArg3 argument to authorization callbacks will be zContext until ** popped. Or if pParse==0, this routine is a no-op. */ -SQLITE_PRIVATE void sqlite3AuthContextPush( +SQLITE_PRIVATE void tdsqlite3AuthContextPush( Parse *pParse, AuthContext *pContext, const char *zContext @@ -113549,9 +113549,9 @@ SQLITE_PRIVATE void sqlite3AuthContextPush( /* ** Pop an authorization context that was previously pushed -** by sqlite3AuthContextPush +** by tdsqlite3AuthContextPush */ -SQLITE_PRIVATE void sqlite3AuthContextPop(AuthContext *pContext){ +SQLITE_PRIVATE void tdsqlite3AuthContextPop(AuthContext *pContext){ if( pContext->pParse ){ pContext->pParse->zAuthContext = pContext->zAuthContext; pContext->pParse = 0; @@ -113590,7 +113590,7 @@ SQLITE_PRIVATE void sqlite3AuthContextPop(AuthContext *pContext){ #ifndef SQLITE_OMIT_SHARED_CACHE /* -** The TableLock structure is only used by the sqlite3TableLock() and +** The TableLock structure is only used by the tdsqlite3TableLock() and ** codeTableLocks() functions. */ struct TableLock { @@ -113608,23 +113608,23 @@ struct TableLock { ** ** This routine just records the fact that the lock is desired. The ** code to make the lock occur is generated by a later call to -** codeTableLocks() which occurs during sqlite3FinishCoding(). +** codeTableLocks() which occurs during tdsqlite3FinishCoding(). */ -SQLITE_PRIVATE void sqlite3TableLock( +SQLITE_PRIVATE void tdsqlite3TableLock( Parse *pParse, /* Parsing context */ int iDb, /* Index of the database containing the table to lock */ int iTab, /* Root page number of the table to be locked */ u8 isWriteLock, /* True for a write lock */ const char *zName /* Name of the table to be locked */ ){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); + Parse *pToplevel = tdsqlite3ParseToplevel(pParse); int i; int nBytes; TableLock *p; assert( iDb>=0 ); if( iDb==1 ) return; - if( !sqlite3BtreeSharable(pParse->db->aDb[iDb].pBt) ) return; + if( !tdsqlite3BtreeSharable(pParse->db->aDb[iDb].pBt) ) return; for(i=0; inTableLock; i++){ p = &pToplevel->aTableLock[i]; if( p->iDb==iDb && p->iTab==iTab ){ @@ -113635,7 +113635,7 @@ SQLITE_PRIVATE void sqlite3TableLock( nBytes = sizeof(TableLock) * (pToplevel->nTableLock+1); pToplevel->aTableLock = - sqlite3DbReallocOrFree(pToplevel->db, pToplevel->aTableLock, nBytes); + tdsqlite3DbReallocOrFree(pToplevel->db, pToplevel->aTableLock, nBytes); if( pToplevel->aTableLock ){ p = &pToplevel->aTableLock[pToplevel->nTableLock++]; p->iDb = iDb; @@ -113644,25 +113644,25 @@ SQLITE_PRIVATE void sqlite3TableLock( p->zLockName = zName; }else{ pToplevel->nTableLock = 0; - sqlite3OomFault(pToplevel->db); + tdsqlite3OomFault(pToplevel->db); } } /* ** Code an OP_TableLock instruction for each table locked by the -** statement (configured by calls to sqlite3TableLock()). +** statement (configured by calls to tdsqlite3TableLock()). */ static void codeTableLocks(Parse *pParse){ int i; Vdbe *pVdbe; - pVdbe = sqlite3GetVdbe(pParse); - assert( pVdbe!=0 ); /* sqlite3GetVdbe cannot fail: VDBE already allocated */ + pVdbe = tdsqlite3GetVdbe(pParse); + assert( pVdbe!=0 ); /* tdsqlite3GetVdbe cannot fail: VDBE already allocated */ for(i=0; inTableLock; i++){ TableLock *p = &pParse->aTableLock[i]; int p1 = p->iDb; - sqlite3VdbeAddOp4(pVdbe, OP_TableLock, p1, p->iTab, p->isWriteLock, + tdsqlite3VdbeAddOp4(pVdbe, OP_TableLock, p1, p->iTab, p->isWriteLock, p->zLockName, P4_STATIC); } } @@ -113676,7 +113676,7 @@ static void codeTableLocks(Parse *pParse){ ** macros when SQLITE_MAX_ATTACHED is greater than 30. */ #if SQLITE_MAX_ATTACHED>30 -SQLITE_PRIVATE int sqlite3DbMaskAllZero(yDbMask m){ +SQLITE_PRIVATE int tdsqlite3DbMaskAllZero(yDbMask m){ int i; for(i=0; ipToplevel==0 ); @@ -113708,17 +113708,17 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ /* Begin by generating some termination code at the end of the ** vdbe program */ - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); assert( !pParse->isMultiWrite - || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort)); + || tdsqlite3VdbeAssertMayAbort(v, pParse->mayAbort)); if( v ){ - sqlite3VdbeAddOp0(v, OP_Halt); + tdsqlite3VdbeAddOp0(v, OP_Halt); #if SQLITE_USER_AUTHENTICATION if( pParse->nTableLock>0 && db->init.busy==0 ){ - sqlite3UserAuthInit(db); + tdsqlite3UserAuthInit(db); if( db->auth.authLevelrc = SQLITE_AUTH_USER; return; } @@ -113735,28 +113735,28 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ && (DbMaskNonZero(pParse->cookieMask) || pParse->pConstExpr) ){ int iDb, i; - assert( sqlite3VdbeGetOp(v, 0)->opcode==OP_Init ); - sqlite3VdbeJumpHere(v, 0); + assert( tdsqlite3VdbeGetOp(v, 0)->opcode==OP_Init ); + tdsqlite3VdbeJumpHere(v, 0); for(iDb=0; iDbnDb; iDb++){ Schema *pSchema; if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue; - sqlite3VdbeUsesBtree(v, iDb); + tdsqlite3VdbeUsesBtree(v, iDb); pSchema = db->aDb[iDb].pSchema; - sqlite3VdbeAddOp4Int(v, + tdsqlite3VdbeAddOp4Int(v, OP_Transaction, /* Opcode */ iDb, /* P1 */ DbMaskTest(pParse->writeMask,iDb), /* P2 */ pSchema->schema_cookie, /* P3 */ pSchema->iGeneration /* P4 */ ); - if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1); + if( db->init.busy==0 ) tdsqlite3VdbeChangeP5(v, 1); VdbeComment((v, "usesStmtJournal=%d", pParse->mayAbort && pParse->isMultiWrite)); } #ifndef SQLITE_OMIT_VIRTUALTABLE for(i=0; inVtabLock; i++){ - char *vtab = (char *)sqlite3GetVTable(db, pParse->apVtabLock[i]); - sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB); + char *vtab = (char *)tdsqlite3GetVTable(db, pParse->apVtabLock[i]); + tdsqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB); } pParse->nVtabLock = 0; #endif @@ -113769,19 +113769,19 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ /* Initialize any AUTOINCREMENT data structures required. */ - sqlite3AutoincrementBegin(pParse); + tdsqlite3AutoincrementBegin(pParse); /* Code constant expressions that where factored out of inner loops */ if( pParse->pConstExpr ){ ExprList *pEL = pParse->pConstExpr; pParse->okConstFactor = 0; for(i=0; inExpr; i++){ - sqlite3ExprCode(pParse, pEL->a[i].pExpr, pEL->a[i].u.iConstExprReg); + tdsqlite3ExprCode(pParse, pEL->a[i].pExpr, pEL->a[i].u.iConstExprReg); } } /* Finally, jump back to the beginning of the executable code. */ - sqlite3VdbeGoto(v, 1); + tdsqlite3VdbeGoto(v, 1); } } @@ -113792,7 +113792,7 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ /* A minimum of one cursor is required if autoincrement is used * See ticket [a696379c1f08866] */ assert( pParse->pAinc==0 || pParse->nTab>0 ); - sqlite3VdbeMakeReady(v, pParse); + tdsqlite3VdbeMakeReady(v, pParse); pParse->rc = SQLITE_DONE; }else{ pParse->rc = SQLITE_ERROR; @@ -113811,17 +113811,17 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ ** INSERT, UPDATE, and DELETE operations against SQLITE_MASTER. Use ** care if you decide to try to use this routine for some other purposes. */ -SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){ +SQLITE_PRIVATE void tdsqlite3NestedParse(Parse *pParse, const char *zFormat, ...){ va_list ap; char *zSql; char *zErrMsg = 0; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; char saveBuf[PARSE_TAIL_SZ]; if( pParse->nErr ) return; assert( pParse->nested<10 ); /* Nesting should only be of limited depth */ va_start(ap, zFormat); - zSql = sqlite3VMPrintf(db, zFormat, ap); + zSql = tdsqlite3VMPrintf(db, zFormat, ap); va_end(ap); if( zSql==0 ){ /* This can result either from an OOM or because the formatted string @@ -113834,9 +113834,9 @@ SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){ pParse->nested++; memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ); memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ); - sqlite3RunParser(pParse, zSql, &zErrMsg); - sqlite3DbFree(db, zErrMsg); - sqlite3DbFree(db, zSql); + tdsqlite3RunParser(pParse, zSql, &zErrMsg); + tdsqlite3DbFree(db, zErrMsg); + tdsqlite3DbFree(db, zSql); memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ); pParse->nested--; } @@ -113846,8 +113846,8 @@ SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){ ** Return TRUE if zTable is the name of the system table that stores the ** list of users and their access credentials. */ -SQLITE_PRIVATE int sqlite3UserAuthTable(const char *zTable){ - return sqlite3_stricmp(zTable, "sqlite_user")==0; +SQLITE_PRIVATE int tdsqlite3UserAuthTable(const char *zTable){ + return tdsqlite3_stricmp(zTable, "sqlite_user")==0; } #endif @@ -113861,34 +113861,34 @@ SQLITE_PRIVATE int sqlite3UserAuthTable(const char *zTable){ ** names is done.) The search order is TEMP first, then MAIN, then any ** auxiliary databases added using the ATTACH command. ** -** See also sqlite3LocateTable(). +** See also tdsqlite3LocateTable(). */ -SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){ +SQLITE_PRIVATE Table *tdsqlite3FindTable(tdsqlite3 *db, const char *zName, const char *zDatabase){ Table *p = 0; int i; /* All mutexes are required for schema access. Make sure we hold them. */ - assert( zDatabase!=0 || sqlite3BtreeHoldsAllMutexes(db) ); + assert( zDatabase!=0 || tdsqlite3BtreeHoldsAllMutexes(db) ); #if SQLITE_USER_AUTHENTICATION /* Only the admin user is allowed to know that the sqlite_user table ** exists */ - if( db->auth.authLevelauth.authLevelnDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ - if( zDatabase==0 || sqlite3StrICmp(zDatabase, db->aDb[j].zDbSName)==0 ){ - assert( sqlite3SchemaMutexHeld(db, j, 0) ); - p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName); + if( zDatabase==0 || tdsqlite3StrICmp(zDatabase, db->aDb[j].zDbSName)==0 ){ + assert( tdsqlite3SchemaMutexHeld(db, j, 0) ); + p = tdsqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName); if( p ) return p; } } /* Not found. If the name we were looking for was temp.sqlite_master ** then change the name to sqlite_temp_master and try again. */ - if( sqlite3StrICmp(zName, MASTER_NAME)!=0 ) break; - if( sqlite3_stricmp(zDatabase, db->aDb[1].zDbSName)!=0 ) break; + if( tdsqlite3StrICmp(zName, MASTER_NAME)!=0 ) break; + if( tdsqlite3_stricmp(zDatabase, db->aDb[1].zDbSName)!=0 ) break; zName = TEMP_MASTER_NAME; } return 0; @@ -113900,39 +113900,39 @@ SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const cha ** database containing the table. Return NULL if not found. Also leave an ** error message in pParse->zErrMsg. ** -** The difference between this routine and sqlite3FindTable() is that this +** The difference between this routine and tdsqlite3FindTable() is that this ** routine leaves an error message in pParse->zErrMsg where -** sqlite3FindTable() does not. +** tdsqlite3FindTable() does not. */ -SQLITE_PRIVATE Table *sqlite3LocateTable( +SQLITE_PRIVATE Table *tdsqlite3LocateTable( Parse *pParse, /* context in which to report errors */ u32 flags, /* LOCATE_VIEW or LOCATE_NOERR */ const char *zName, /* Name of the table we are looking for */ const char *zDbase /* Name of the database. Might be NULL */ ){ Table *p; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; /* Read the database schema. If an error occurs, leave an error message ** and code in pParse and return NULL. */ if( (db->mDbFlags & DBFLAG_SchemaKnownOk)==0 - && SQLITE_OK!=sqlite3ReadSchema(pParse) + && SQLITE_OK!=tdsqlite3ReadSchema(pParse) ){ return 0; } - p = sqlite3FindTable(db, zName, zDbase); + p = tdsqlite3FindTable(db, zName, zDbase); if( p==0 ){ #ifndef SQLITE_OMIT_VIRTUALTABLE /* If zName is the not the name of a table in the schema created using ** CREATE, then check to see if it is the name of an virtual table that ** can be an eponymous virtual table. */ if( pParse->disableVtab==0 ){ - Module *pMod = (Module*)sqlite3HashFind(&db->aModule, zName); - if( pMod==0 && sqlite3_strnicmp(zName, "pragma_", 7)==0 ){ - pMod = sqlite3PragmaVtabRegister(db, zName); + Module *pMod = (Module*)tdsqlite3HashFind(&db->aModule, zName); + if( pMod==0 && tdsqlite3_strnicmp(zName, "pragma_", 7)==0 ){ + pMod = tdsqlite3PragmaVtabRegister(db, zName); } - if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){ + if( pMod && tdsqlite3VtabEponymousTableInit(pParse, pMod) ){ return pMod->pEpoTab; } } @@ -113946,9 +113946,9 @@ SQLITE_PRIVATE Table *sqlite3LocateTable( if( p==0 ){ const char *zMsg = flags & LOCATE_VIEW ? "no such view" : "no such table"; if( zDbase ){ - sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); + tdsqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); }else{ - sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); + tdsqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); } } @@ -113958,13 +113958,13 @@ SQLITE_PRIVATE Table *sqlite3LocateTable( /* ** Locate the table identified by *p. ** -** This is a wrapper around sqlite3LocateTable(). The difference between -** sqlite3LocateTable() and this function is that this function restricts +** This is a wrapper around tdsqlite3LocateTable(). The difference between +** tdsqlite3LocateTable() and this function is that this function restricts ** the search to schema (p->pSchema) if it is not NULL. p->pSchema may be ** non-NULL if it is part of a view or trigger program definition. See -** sqlite3FixSrcList() for details. +** tdsqlite3FixSrcList() for details. */ -SQLITE_PRIVATE Table *sqlite3LocateTableItem( +SQLITE_PRIVATE Table *tdsqlite3LocateTableItem( Parse *pParse, u32 flags, struct SrcList_item *p @@ -113972,12 +113972,12 @@ SQLITE_PRIVATE Table *sqlite3LocateTableItem( const char *zDb; assert( p->pSchema==0 || p->zDatabase==0 ); if( p->pSchema ){ - int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema); + int iDb = tdsqlite3SchemaToIndex(pParse->db, p->pSchema); zDb = pParse->db->aDb[iDb].zDbSName; }else{ zDb = p->zDatabase; } - return sqlite3LocateTable(pParse, flags, p->zName, zDb); + return tdsqlite3LocateTable(pParse, flags, p->zName, zDb); } /* @@ -113992,18 +113992,18 @@ SQLITE_PRIVATE Table *sqlite3LocateTableItem( ** TEMP first, then MAIN, then any auxiliary databases added ** using the ATTACH command. */ -SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3 *db, const char *zName, const char *zDb){ +SQLITE_PRIVATE Index *tdsqlite3FindIndex(tdsqlite3 *db, const char *zName, const char *zDb){ Index *p = 0; int i; /* All mutexes are required for schema access. Make sure we hold them. */ - assert( zDb!=0 || sqlite3BtreeHoldsAllMutexes(db) ); + assert( zDb!=0 || tdsqlite3BtreeHoldsAllMutexes(db) ); for(i=OMIT_TEMPDB; inDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ Schema *pSchema = db->aDb[j].pSchema; assert( pSchema ); - if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zDbSName) ) continue; - assert( sqlite3SchemaMutexHeld(db, j, 0) ); - p = sqlite3HashFind(&pSchema->idxHash, zName); + if( zDb && tdsqlite3StrICmp(zDb, db->aDb[j].zDbSName) ) continue; + assert( tdsqlite3SchemaMutexHeld(db, j, 0) ); + p = tdsqlite3HashFind(&pSchema->idxHash, zName); if( p ) break; } return p; @@ -114012,18 +114012,18 @@ SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3 *db, const char *zName, const cha /* ** Reclaim the memory used by an index */ -SQLITE_PRIVATE void sqlite3FreeIndex(sqlite3 *db, Index *p){ +SQLITE_PRIVATE void tdsqlite3FreeIndex(tdsqlite3 *db, Index *p){ #ifndef SQLITE_OMIT_ANALYZE - sqlite3DeleteIndexSamples(db, p); + tdsqlite3DeleteIndexSamples(db, p); #endif - sqlite3ExprDelete(db, p->pPartIdxWhere); - sqlite3ExprListDelete(db, p->aColExpr); - sqlite3DbFree(db, p->zColAff); - if( p->isResized ) sqlite3DbFree(db, (void *)p->azColl); + tdsqlite3ExprDelete(db, p->pPartIdxWhere); + tdsqlite3ExprListDelete(db, p->aColExpr); + tdsqlite3DbFree(db, p->zColAff); + if( p->isResized ) tdsqlite3DbFree(db, (void *)p->azColl); #ifdef SQLITE_ENABLE_STAT4 - sqlite3_free(p->aiRowEst); + tdsqlite3_free(p->aiRowEst); #endif - sqlite3DbFree(db, p); + tdsqlite3DbFree(db, p); } /* @@ -114032,13 +114032,13 @@ SQLITE_PRIVATE void sqlite3FreeIndex(sqlite3 *db, Index *p){ ** the index hash table and free all memory structures associated ** with the index. */ -SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3 *db, int iDb, const char *zIdxName){ +SQLITE_PRIVATE void tdsqlite3UnlinkAndDeleteIndex(tdsqlite3 *db, int iDb, const char *zIdxName){ Index *pIndex; Hash *pHash; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); pHash = &db->aDb[iDb].pSchema->idxHash; - pIndex = sqlite3HashInsert(pHash, zIdxName, 0); + pIndex = tdsqlite3HashInsert(pHash, zIdxName, 0); if( ALWAYS(pIndex) ){ if( pIndex->pTable->pIndex==pIndex ){ pIndex->pTable->pIndex = pIndex->pNext; @@ -114052,7 +114052,7 @@ SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3 *db, int iDb, const char p->pNext = pIndex->pNext; } } - sqlite3FreeIndex(db, pIndex); + tdsqlite3FreeIndex(db, pIndex); } db->mDbFlags |= DBFLAG_SchemaChange; } @@ -114065,12 +114065,12 @@ SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3 *db, int iDb, const char ** Entry 0 (the "main" database) and entry 1 (the "temp" database) ** are never candidates for being collapsed. */ -SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3CollapseDatabaseArray(tdsqlite3 *db){ int i, j; for(i=j=2; inDb; i++){ struct Db *pDb = &db->aDb[i]; if( pDb->pBt==0 ){ - sqlite3DbFree(db, pDb->zDbSName); + tdsqlite3DbFree(db, pDb->zDbSName); pDb->zDbSName = 0; continue; } @@ -114082,7 +114082,7 @@ SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3 *db){ db->nDb = j; if( db->nDb<=2 && db->aDb!=db->aDbStatic ){ memcpy(db->aDbStatic, db->aDb, 2*sizeof(db->aDb[0])); - sqlite3DbFree(db, db->aDb); + tdsqlite3DbFree(db, db->aDb); db->aDb = db->aDbStatic; } } @@ -114092,12 +114092,12 @@ SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3 *db){ ** TEMP schema. The reset is deferred if db->nSchemaLock is not zero. ** Deferred resets may be run by calling with iDb<0. */ -SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3 *db, int iDb){ +SQLITE_PRIVATE void tdsqlite3ResetOneSchema(tdsqlite3 *db, int iDb){ int i; assert( iDbnDb ); if( iDb>=0 ){ - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); DbSetProperty(db, iDb, DB_ResetWanted); DbSetProperty(db, 1, DB_ResetWanted); db->mDbFlags &= ~DBFLAG_SchemaKnownOk; @@ -114106,7 +114106,7 @@ SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3 *db, int iDb){ if( db->nSchemaLock==0 ){ for(i=0; inDb; i++){ if( DbHasProperty(db, i, DB_ResetWanted) ){ - sqlite3SchemaClear(db->aDb[i].pSchema); + tdsqlite3SchemaClear(db->aDb[i].pSchema); } } } @@ -114116,31 +114116,31 @@ SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3 *db, int iDb){ ** Erase all schema information from all attached databases (including ** "main" and "temp") for a single database connection. */ -SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3ResetAllSchemasOfConnection(tdsqlite3 *db){ int i; - sqlite3BtreeEnterAll(db); + tdsqlite3BtreeEnterAll(db); for(i=0; inDb; i++){ Db *pDb = &db->aDb[i]; if( pDb->pSchema ){ if( db->nSchemaLock==0 ){ - sqlite3SchemaClear(pDb->pSchema); + tdsqlite3SchemaClear(pDb->pSchema); }else{ DbSetProperty(db, i, DB_ResetWanted); } } } db->mDbFlags &= ~(DBFLAG_SchemaChange|DBFLAG_SchemaKnownOk); - sqlite3VtabUnlockList(db); - sqlite3BtreeLeaveAll(db); + tdsqlite3VtabUnlockList(db); + tdsqlite3BtreeLeaveAll(db); if( db->nSchemaLock==0 ){ - sqlite3CollapseDatabaseArray(db); + tdsqlite3CollapseDatabaseArray(db); } } /* ** This routine is called when a commit occurs. */ -SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3CommitInternalChanges(tdsqlite3 *db){ db->mDbFlags &= ~DBFLAG_SchemaChange; } @@ -114148,17 +114148,17 @@ SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3 *db){ ** Delete memory allocated for the column names of a table or view (the ** Table.aCol[] array). */ -SQLITE_PRIVATE void sqlite3DeleteColumnNames(sqlite3 *db, Table *pTable){ +SQLITE_PRIVATE void tdsqlite3DeleteColumnNames(tdsqlite3 *db, Table *pTable){ int i; Column *pCol; assert( pTable!=0 ); if( (pCol = pTable->aCol)!=0 ){ for(i=0; inCol; i++, pCol++){ - sqlite3DbFree(db, pCol->zName); - sqlite3ExprDelete(db, pCol->pDflt); - sqlite3DbFree(db, pCol->zColl); + tdsqlite3DbFree(db, pCol->zName); + tdsqlite3ExprDelete(db, pCol->pDflt); + tdsqlite3DbFree(db, pCol->zColl); } - sqlite3DbFree(db, pTable->aCol); + tdsqlite3DbFree(db, pTable->aCol); } } @@ -114177,7 +114177,7 @@ SQLITE_PRIVATE void sqlite3DeleteColumnNames(sqlite3 *db, Table *pTable){ ** db parameter can be used with db->pnBytesFreed to measure the memory ** used by the Table object. */ -static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){ +static void SQLITE_NOINLINE deleteTable(tdsqlite3 *db, Table *pTable){ Index *pIndex, *pNext; #ifdef SQLITE_DEBUG @@ -114190,7 +114190,7 @@ static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){ ** that no lookaside memory is used in this case either. */ int nLookaside = 0; if( db && !db->mallocFailed && (pTable->tabFlags & TF_Ephemeral)==0 ){ - nLookaside = sqlite3LookasideUsed(db, 0); + nLookaside = tdsqlite3LookasideUsed(db, 0); } #endif @@ -114201,34 +114201,34 @@ static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){ || (IsVirtual(pTable) && pIndex->idxType!=SQLITE_IDXTYPE_APPDEF) ); if( (db==0 || db->pnBytesFreed==0) && !IsVirtual(pTable) ){ char *zName = pIndex->zName; - TESTONLY ( Index *pOld = ) sqlite3HashInsert( + TESTONLY ( Index *pOld = ) tdsqlite3HashInsert( &pIndex->pSchema->idxHash, zName, 0 ); - assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); + assert( db==0 || tdsqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); assert( pOld==pIndex || pOld==0 ); } - sqlite3FreeIndex(db, pIndex); + tdsqlite3FreeIndex(db, pIndex); } /* Delete any foreign keys attached to this table. */ - sqlite3FkDelete(db, pTable); + tdsqlite3FkDelete(db, pTable); /* Delete the Table structure itself. */ - sqlite3DeleteColumnNames(db, pTable); - sqlite3DbFree(db, pTable->zName); - sqlite3DbFree(db, pTable->zColAff); - sqlite3SelectDelete(db, pTable->pSelect); - sqlite3ExprListDelete(db, pTable->pCheck); + tdsqlite3DeleteColumnNames(db, pTable); + tdsqlite3DbFree(db, pTable->zName); + tdsqlite3DbFree(db, pTable->zColAff); + tdsqlite3SelectDelete(db, pTable->pSelect); + tdsqlite3ExprListDelete(db, pTable->pCheck); #ifndef SQLITE_OMIT_VIRTUALTABLE - sqlite3VtabClear(db, pTable); + tdsqlite3VtabClear(db, pTable); #endif - sqlite3DbFree(db, pTable); + tdsqlite3DbFree(db, pTable); /* Verify that no lookaside memory was used by schema tables */ - assert( nLookaside==0 || nLookaside==sqlite3LookasideUsed(db,0) ); + assert( nLookaside==0 || nLookaside==tdsqlite3LookasideUsed(db,0) ); } -SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){ +SQLITE_PRIVATE void tdsqlite3DeleteTable(tdsqlite3 *db, Table *pTable){ /* Do not delete the table until the reference count reaches zero. */ if( !pTable ) return; if( ((!db || db->pnBytesFreed==0) && (--pTable->nTabRef)>0) ) return; @@ -114240,18 +114240,18 @@ SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){ ** Unlink the given table from the hash tables and the delete the ** table structure with all its indices and foreign keys. */ -SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){ +SQLITE_PRIVATE void tdsqlite3UnlinkAndDeleteTable(tdsqlite3 *db, int iDb, const char *zTabName){ Table *p; Db *pDb; assert( db!=0 ); assert( iDb>=0 && iDbnDb ); assert( zTabName ); - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); testcase( zTabName[0]==0 ); /* Zero-length table names are allowed */ pDb = &db->aDb[iDb]; - p = sqlite3HashInsert(&pDb->pSchema->tblHash, zTabName, 0); - sqlite3DeleteTable(db, p); + p = tdsqlite3HashInsert(&pDb->pSchema->tblHash, zTabName, 0); + tdsqlite3DeleteTable(db, p); db->mDbFlags |= DBFLAG_SchemaChange; } @@ -114268,11 +114268,11 @@ SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char ** are not \000 terminated and are not persistent. The returned string ** is \000 terminated and is persistent. */ -SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3 *db, Token *pName){ +SQLITE_PRIVATE char *tdsqlite3NameFromToken(tdsqlite3 *db, Token *pName){ char *zName; if( pName ){ - zName = sqlite3DbStrNDup(db, (char*)pName->z, pName->n); - sqlite3Dequote(zName); + zName = tdsqlite3DbStrNDup(db, (char*)pName->z, pName->n); + tdsqlite3Dequote(zName); }else{ zName = 0; } @@ -114283,10 +114283,10 @@ SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3 *db, Token *pName){ ** Open the sqlite_master table stored in database number iDb for ** writing. The table is opened using cursor 0. */ -SQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *p, int iDb){ - Vdbe *v = sqlite3GetVdbe(p); - sqlite3TableLock(p, iDb, MASTER_ROOT, 1, MASTER_NAME); - sqlite3VdbeAddOp4Int(v, OP_OpenWrite, 0, MASTER_ROOT, iDb, 5); +SQLITE_PRIVATE void tdsqlite3OpenMasterTable(Parse *p, int iDb){ + Vdbe *v = tdsqlite3GetVdbe(p); + tdsqlite3TableLock(p, iDb, MASTER_ROOT, 1, MASTER_NAME); + tdsqlite3VdbeAddOp4Int(v, OP_OpenWrite, 0, MASTER_ROOT, iDb, 5); if( p->nTab==0 ){ p->nTab = 1; } @@ -114298,15 +114298,15 @@ SQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *p, int iDb){ ** function returns the index of the named database in db->aDb[], or ** -1 if the named db cannot be found. */ -SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *db, const char *zName){ +SQLITE_PRIVATE int tdsqlite3FindDbName(tdsqlite3 *db, const char *zName){ int i = -1; /* Database number */ if( zName ){ Db *pDb; for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){ - if( 0==sqlite3_stricmp(pDb->zDbSName, zName) ) break; + if( 0==tdsqlite3_stricmp(pDb->zDbSName, zName) ) break; /* "main" is always an acceptable alias for the primary database ** even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. */ - if( i==0 && 0==sqlite3_stricmp("main", zName) ) break; + if( i==0 && 0==tdsqlite3_stricmp("main", zName) ) break; } } return i; @@ -114318,12 +114318,12 @@ SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *db, const char *zName){ ** index of the named database in db->aDb[], or -1 if the named db ** does not exist. */ -SQLITE_PRIVATE int sqlite3FindDb(sqlite3 *db, Token *pName){ +SQLITE_PRIVATE int tdsqlite3FindDb(tdsqlite3 *db, Token *pName){ int i; /* Database number */ char *zName; /* Name we are searching for */ - zName = sqlite3NameFromToken(db, pName); - i = sqlite3FindDbName(db, zName); - sqlite3DbFree(db, zName); + zName = tdsqlite3NameFromToken(db, pName); + i = tdsqlite3FindDbName(db, zName); + tdsqlite3DbFree(db, zName); return i; } @@ -114343,25 +114343,25 @@ SQLITE_PRIVATE int sqlite3FindDb(sqlite3 *db, Token *pName){ ** pName2) that stores the unqualified table name. The index of the ** database "xxx" is returned. */ -SQLITE_PRIVATE int sqlite3TwoPartName( +SQLITE_PRIVATE int tdsqlite3TwoPartName( Parse *pParse, /* Parsing and code generating context */ Token *pName1, /* The "xxx" in the name "xxx.yyy" or "xxx" */ Token *pName2, /* The "yyy" in the name "xxx.yyy" */ Token **pUnqual /* Write the unqualified object name here */ ){ int iDb; /* Database holding the object */ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; assert( pName2!=0 ); if( pName2->n>0 ){ if( db->init.busy ) { - sqlite3ErrorMsg(pParse, "corrupt database"); + tdsqlite3ErrorMsg(pParse, "corrupt database"); return -1; } *pUnqual = pName2; - iDb = sqlite3FindDb(db, pName1); + iDb = tdsqlite3FindDb(db, pName1); if( iDb<0 ){ - sqlite3ErrorMsg(pParse, "unknown database %T", pName1); + tdsqlite3ErrorMsg(pParse, "unknown database %T", pName1); return -1; } }else{ @@ -114376,7 +114376,7 @@ SQLITE_PRIVATE int sqlite3TwoPartName( /* ** True if PRAGMA writable_schema is ON */ -SQLITE_PRIVATE int sqlite3WritableSchema(sqlite3 *db){ +SQLITE_PRIVATE int tdsqlite3WritableSchema(tdsqlite3 *db){ testcase( (db->flags&(SQLITE_WriteSchema|SQLITE_Defensive))==0 ); testcase( (db->flags&(SQLITE_WriteSchema|SQLITE_Defensive))== SQLITE_WriteSchema ); @@ -114398,32 +114398,32 @@ SQLITE_PRIVATE int sqlite3WritableSchema(sqlite3 *db){ ** make sure the "type", "name", and "tbl_name" columns are consistent ** with the SQL. */ -SQLITE_PRIVATE int sqlite3CheckObjectName( +SQLITE_PRIVATE int tdsqlite3CheckObjectName( Parse *pParse, /* Parsing context */ const char *zName, /* Name of the object to check */ const char *zType, /* Type of this object */ const char *zTblName /* Parent table name for triggers and indexes */ ){ - sqlite3 *db = pParse->db; - if( sqlite3WritableSchema(db) || db->init.imposterTable ){ + tdsqlite3 *db = pParse->db; + if( tdsqlite3WritableSchema(db) || db->init.imposterTable ){ /* Skip these error checks for writable_schema=ON */ return SQLITE_OK; } if( db->init.busy ){ - if( sqlite3_stricmp(zType, db->init.azInit[0]) - || sqlite3_stricmp(zName, db->init.azInit[1]) - || sqlite3_stricmp(zTblName, db->init.azInit[2]) + if( tdsqlite3_stricmp(zType, db->init.azInit[0]) + || tdsqlite3_stricmp(zName, db->init.azInit[1]) + || tdsqlite3_stricmp(zTblName, db->init.azInit[2]) ){ - if( sqlite3Config.bExtraSchemaChecks ){ - sqlite3ErrorMsg(pParse, ""); /* corruptSchema() will supply the error */ + if( tdsqlite3Config.bExtraSchemaChecks ){ + tdsqlite3ErrorMsg(pParse, ""); /* corruptSchema() will supply the error */ return SQLITE_ERROR; } } }else{ - if( (pParse->nested==0 && 0==sqlite3StrNICmp(zName, "sqlite_", 7)) - || (sqlite3ReadOnlyShadowTables(db) && sqlite3ShadowTableName(db, zName)) + if( (pParse->nested==0 && 0==tdsqlite3StrNICmp(zName, "sqlite_", 7)) + || (tdsqlite3ReadOnlyShadowTables(db) && tdsqlite3ShadowTableName(db, zName)) ){ - sqlite3ErrorMsg(pParse, "object name reserved for internal use: %s", + tdsqlite3ErrorMsg(pParse, "object name reserved for internal use: %s", zName); return SQLITE_ERROR; } @@ -114435,7 +114435,7 @@ SQLITE_PRIVATE int sqlite3CheckObjectName( /* ** Return the PRIMARY KEY index of a table */ -SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table *pTab){ +SQLITE_PRIVATE Index *tdsqlite3PrimaryKeyIndex(Table *pTab){ Index *p; for(p=pTab->pIndex; p && !IsPrimaryKeyIndex(p); p=p->pNext){} return p; @@ -114447,7 +114447,7 @@ SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table *pTab){ ** find the (first) offset of that column in index pIdx. Or return -1 ** if column iCol is not used in index pIdx. */ -SQLITE_PRIVATE i16 sqlite3TableColumnToIndex(Index *pIdx, i16 iCol){ +SQLITE_PRIVATE i16 tdsqlite3TableColumnToIndex(Index *pIdx, i16 iCol){ int i; for(i=0; inColumn; i++){ if( iCol==pIdx->aiColumn[i] ) return i; @@ -114467,7 +114467,7 @@ SQLITE_PRIVATE i16 sqlite3TableColumnToIndex(Index *pIdx, i16 iCol){ ** ** If SQLITE_OMIT_GENERATED_COLUMNS, this routine is a no-op macro. */ -SQLITE_PRIVATE i16 sqlite3StorageColumnToTable(Table *pTab, i16 iCol){ +SQLITE_PRIVATE i16 tdsqlite3StorageColumnToTable(Table *pTab, i16 iCol){ if( pTab->tabFlags & TF_HasVirtual ){ int i; for(i=0; i<=iCol; i++){ @@ -114515,7 +114515,7 @@ SQLITE_PRIVATE i16 sqlite3StorageColumnToTable(Table *pTab, i16 iCol){ ** columns, then this routine is no-op that always return iCol. If iCol ** is negative (indicating the ROWID column) then this routine return iCol. */ -SQLITE_PRIVATE i16 sqlite3TableColumnToStorage(Table *pTab, i16 iCol){ +SQLITE_PRIVATE i16 tdsqlite3TableColumnToStorage(Table *pTab, i16 iCol){ int i; i16 n; assert( iColnCol ); @@ -114546,10 +114546,10 @@ SQLITE_PRIVATE i16 sqlite3TableColumnToStorage(Table *pTab, i16 iCol){ ** The new table record is initialized and put in pParse->pNewTable. ** As more of the CREATE TABLE statement is parsed, additional action ** routines will be called to add more information to this record. -** At the end of the CREATE TABLE statement, the sqlite3EndTable() routine +** At the end of the CREATE TABLE statement, the tdsqlite3EndTable() routine ** is called to complete the construction of the new table record. */ -SQLITE_PRIVATE void sqlite3StartTable( +SQLITE_PRIVATE void tdsqlite3StartTable( Parse *pParse, /* Parser context */ Token *pName1, /* First part of the name of the table or view */ Token *pName2, /* Second part of the name of the table or view */ @@ -114560,7 +114560,7 @@ SQLITE_PRIVATE void sqlite3StartTable( ){ Table *pTable; char *zName = 0; /* The name of the new table */ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Vdbe *v; int iDb; /* Database number to create the table in */ Token *pName; /* Unqualified name of the table to create */ @@ -114568,27 +114568,27 @@ SQLITE_PRIVATE void sqlite3StartTable( if( db->init.busy && db->init.newTnum==1 ){ /* Special case: Parsing the sqlite_master or sqlite_temp_master schema */ iDb = db->init.iDb; - zName = sqlite3DbStrDup(db, SCHEMA_TABLE(iDb)); + zName = tdsqlite3DbStrDup(db, SCHEMA_TABLE(iDb)); pName = pName1; }else{ /* The common case */ - iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName); + iDb = tdsqlite3TwoPartName(pParse, pName1, pName2, &pName); if( iDb<0 ) return; if( !OMIT_TEMPDB && isTemp && pName2->n>0 && iDb!=1 ){ /* If creating a temp table, the name may not be qualified. Unless ** the database name is "temp" anyway. */ - sqlite3ErrorMsg(pParse, "temporary table name must be unqualified"); + tdsqlite3ErrorMsg(pParse, "temporary table name must be unqualified"); return; } if( !OMIT_TEMPDB && isTemp ) iDb = 1; - zName = sqlite3NameFromToken(db, pName); + zName = tdsqlite3NameFromToken(db, pName); if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenMap(pParse, (void*)zName, pName); + tdsqlite3RenameTokenMap(pParse, (void*)zName, pName); } } pParse->sNameToken = *pName; if( zName==0 ) return; - if( sqlite3CheckObjectName(pParse, zName, isView?"view":"table", zName) ){ + if( tdsqlite3CheckObjectName(pParse, zName, isView?"view":"table", zName) ){ goto begin_table_error; } if( db->init.iDb==1 ) isTemp = 1; @@ -114603,10 +114603,10 @@ SQLITE_PRIVATE void sqlite3StartTable( SQLITE_CREATE_TEMP_VIEW }; char *zDb = db->aDb[iDb].zDbSName; - if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){ + if( tdsqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){ goto begin_table_error; } - if( !isVirtual && sqlite3AuthCheck(pParse, (int)aCode[isTemp+2*isView], + if( !isVirtual && tdsqlite3AuthCheck(pParse, (int)aCode[isTemp+2*isView], zName, 0, zDb) ){ goto begin_table_error; } @@ -114616,32 +114616,32 @@ SQLITE_PRIVATE void sqlite3StartTable( /* Make sure the new table name does not collide with an existing ** index or table name in the same database. Issue an error message if ** it does. The exception is if the statement being parsed was passed - ** to an sqlite3_declare_vtab() call. In that case only the column names + ** to an tdsqlite3_declare_vtab() call. In that case only the column names ** and types will be used, so there is no need to test for namespace ** collisions. */ if( !IN_SPECIAL_PARSE ){ char *zDb = db->aDb[iDb].zDbSName; - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ + if( SQLITE_OK!=tdsqlite3ReadSchema(pParse) ){ goto begin_table_error; } - pTable = sqlite3FindTable(db, zName, zDb); + pTable = tdsqlite3FindTable(db, zName, zDb); if( pTable ){ if( !noErr ){ - sqlite3ErrorMsg(pParse, "table %T already exists", pName); + tdsqlite3ErrorMsg(pParse, "table %T already exists", pName); }else{ assert( !db->init.busy || CORRUPT_DB ); - sqlite3CodeVerifySchema(pParse, iDb); + tdsqlite3CodeVerifySchema(pParse, iDb); } goto begin_table_error; } - if( sqlite3FindIndex(db, zName, zDb)!=0 ){ - sqlite3ErrorMsg(pParse, "there is already an index named %s", zName); + if( tdsqlite3FindIndex(db, zName, zDb)!=0 ){ + tdsqlite3ErrorMsg(pParse, "there is already an index named %s", zName); goto begin_table_error; } } - pTable = sqlite3DbMallocZero(db, sizeof(Table)); + pTable = tdsqlite3DbMallocZero(db, sizeof(Table)); if( pTable==0 ){ assert( db->mallocFailed ); pParse->rc = SQLITE_NOMEM_BKPT; @@ -114653,9 +114653,9 @@ SQLITE_PRIVATE void sqlite3StartTable( pTable->pSchema = db->aDb[iDb].pSchema; pTable->nTabRef = 1; #ifdef SQLITE_DEFAULT_ROWEST - pTable->nRowLogEst = sqlite3LogEst(SQLITE_DEFAULT_ROWEST); + pTable->nRowLogEst = tdsqlite3LogEst(SQLITE_DEFAULT_ROWEST); #else - pTable->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) ); + pTable->nRowLogEst = 200; assert( 200==tdsqlite3LogEst(1048576) ); #endif assert( pParse->pNewTable==0 ); pParse->pNewTable = pTable; @@ -114666,7 +114666,7 @@ SQLITE_PRIVATE void sqlite3StartTable( */ #ifndef SQLITE_OMIT_AUTOINCREMENT if( !pParse->nested && strcmp(zName, "sqlite_sequence")==0 ){ - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); pTable->pSchema->pSeqTab = pTable; } #endif @@ -114679,17 +114679,17 @@ SQLITE_PRIVATE void sqlite3StartTable( ** indices. Hence, the record number for the table must be allocated ** now. */ - if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){ + if( !db->init.busy && (v = tdsqlite3GetVdbe(pParse))!=0 ){ int addr1; int fileFormat; int reg1, reg2, reg3; /* nullRow[] is an OP_Record encoding of a row containing 5 NULLs */ static const char nullRow[] = { 6, 0, 0, 0, 0, 0 }; - sqlite3BeginWriteOperation(pParse, 1, iDb); + tdsqlite3BeginWriteOperation(pParse, 1, iDb); #ifndef SQLITE_OMIT_VIRTUALTABLE if( isVirtual ){ - sqlite3VdbeAddOp0(v, OP_VBegin); + tdsqlite3VdbeAddOp0(v, OP_VBegin); } #endif @@ -114699,39 +114699,39 @@ SQLITE_PRIVATE void sqlite3StartTable( reg1 = pParse->regRowid = ++pParse->nMem; reg2 = pParse->regRoot = ++pParse->nMem; reg3 = ++pParse->nMem; - sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, reg3, BTREE_FILE_FORMAT); - sqlite3VdbeUsesBtree(v, iDb); - addr1 = sqlite3VdbeAddOp1(v, OP_If, reg3); VdbeCoverage(v); + tdsqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, reg3, BTREE_FILE_FORMAT); + tdsqlite3VdbeUsesBtree(v, iDb); + addr1 = tdsqlite3VdbeAddOp1(v, OP_If, reg3); VdbeCoverage(v); fileFormat = (db->flags & SQLITE_LegacyFileFmt)!=0 ? 1 : SQLITE_MAX_FILE_FORMAT; - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, fileFormat); - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_TEXT_ENCODING, ENC(db)); - sqlite3VdbeJumpHere(v, addr1); + tdsqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, fileFormat); + tdsqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_TEXT_ENCODING, ENC(db)); + tdsqlite3VdbeJumpHere(v, addr1); /* This just creates a place-holder record in the sqlite_master table. ** The record created does not contain anything yet. It will be replaced - ** by the real entry in code generated at sqlite3EndTable(). + ** by the real entry in code generated at tdsqlite3EndTable(). ** ** The rowid for the new entry is left in register pParse->regRowid. ** The root page number of the new table is left in reg pParse->regRoot. ** The rowid and root page number values are needed by the code that - ** sqlite3EndTable will generate. + ** tdsqlite3EndTable will generate. */ #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) if( isView || isVirtual ){ - sqlite3VdbeAddOp2(v, OP_Integer, 0, reg2); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, reg2); }else #endif { pParse->addrCrTab = - sqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, reg2, BTREE_INTKEY); + tdsqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, reg2, BTREE_INTKEY); } - sqlite3OpenMasterTable(pParse, iDb); - sqlite3VdbeAddOp2(v, OP_NewRowid, 0, reg1); - sqlite3VdbeAddOp4(v, OP_Blob, 6, reg3, 0, nullRow, P4_STATIC); - sqlite3VdbeAddOp3(v, OP_Insert, 0, reg3, reg1); - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); - sqlite3VdbeAddOp0(v, OP_Close); + tdsqlite3OpenMasterTable(pParse, iDb); + tdsqlite3VdbeAddOp2(v, OP_NewRowid, 0, reg1); + tdsqlite3VdbeAddOp4(v, OP_Blob, 6, reg3, 0, nullRow, P4_STATIC); + tdsqlite3VdbeAddOp3(v, OP_Insert, 0, reg3, reg1); + tdsqlite3VdbeChangeP5(v, OPFLAG_APPEND); + tdsqlite3VdbeAddOp0(v, OP_Close); } /* Normal (non-error) return. */ @@ -114739,7 +114739,7 @@ SQLITE_PRIVATE void sqlite3StartTable( /* If an error occurs, we jump here */ begin_table_error: - sqlite3DbFree(db, zName); + tdsqlite3DbFree(db, zName); return; } @@ -114747,8 +114747,8 @@ begin_table_error: ** name of the column. */ #if SQLITE_ENABLE_HIDDEN_COLUMNS -SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){ - if( sqlite3_strnicmp(pCol->zName, "__hidden__", 10)==0 ){ +SQLITE_PRIVATE void tdsqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){ + if( tdsqlite3_strnicmp(pCol->zName, "__hidden__", 10)==0 ){ pCol->colFlags |= COLFLAG_HIDDEN; }else if( pTab && pCol!=pTab->aCol && (pCol[-1].colFlags & COLFLAG_HIDDEN) ){ pTab->tabFlags |= TF_OOOHidden; @@ -114761,40 +114761,40 @@ SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){ ** Add a new column to the table currently being constructed. ** ** The parser calls this routine once for each column declaration -** in a CREATE TABLE statement. sqlite3StartTable() gets called +** in a CREATE TABLE statement. tdsqlite3StartTable() gets called ** first to get things going. Then this routine is called for each ** column. */ -SQLITE_PRIVATE void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ +SQLITE_PRIVATE void tdsqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ Table *p; int i; char *z; char *zType; Column *pCol; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; if( (p = pParse->pNewTable)==0 ) return; if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){ - sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName); + tdsqlite3ErrorMsg(pParse, "too many columns on %s", p->zName); return; } - z = sqlite3DbMallocRaw(db, pName->n + pType->n + 2); + z = tdsqlite3DbMallocRaw(db, pName->n + pType->n + 2); if( z==0 ) return; - if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, pName); + if( IN_RENAME_OBJECT ) tdsqlite3RenameTokenMap(pParse, (void*)z, pName); memcpy(z, pName->z, pName->n); z[pName->n] = 0; - sqlite3Dequote(z); + tdsqlite3Dequote(z); for(i=0; inCol; i++){ - if( sqlite3_stricmp(z, p->aCol[i].zName)==0 ){ - sqlite3ErrorMsg(pParse, "duplicate column name: %s", z); - sqlite3DbFree(db, z); + if( tdsqlite3_stricmp(z, p->aCol[i].zName)==0 ){ + tdsqlite3ErrorMsg(pParse, "duplicate column name: %s", z); + tdsqlite3DbFree(db, z); return; } } if( (p->nCol & 0x7)==0 ){ Column *aNew; - aNew = sqlite3DbRealloc(db,p->aCol,(p->nCol+8)*sizeof(p->aCol[0])); + aNew = tdsqlite3DbRealloc(db,p->aCol,(p->nCol+8)*sizeof(p->aCol[0])); if( aNew==0 ){ - sqlite3DbFree(db, z); + tdsqlite3DbFree(db, z); return; } p->aCol = aNew; @@ -114802,7 +114802,7 @@ SQLITE_PRIVATE void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ pCol = &p->aCol[p->nCol]; memset(pCol, 0, sizeof(p->aCol[0])); pCol->zName = z; - sqlite3ColumnPropertiesFromName(p, pCol); + tdsqlite3ColumnPropertiesFromName(p, pCol); if( pType->n==0 ){ /* If there is no type specified, columns have the default affinity @@ -114810,16 +114810,16 @@ SQLITE_PRIVATE void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ pCol->affinity = SQLITE_AFF_BLOB; pCol->szEst = 1; #ifdef SQLITE_ENABLE_SORTER_REFERENCES - if( 4>=sqlite3GlobalConfig.szSorterRef ){ + if( 4>=tdsqlite3GlobalConfig.szSorterRef ){ pCol->colFlags |= COLFLAG_SORTERREF; } #endif }else{ - zType = z + sqlite3Strlen30(z) + 1; + zType = z + tdsqlite3Strlen30(z) + 1; memcpy(zType, pType->z, pType->n); zType[pType->n] = 0; - sqlite3Dequote(zType); - pCol->affinity = sqlite3AffinityType(zType, pCol); + tdsqlite3Dequote(zType); + pCol->affinity = tdsqlite3AffinityType(zType, pCol); pCol->colFlags |= COLFLAG_HASTYPE; } p->nCol++; @@ -114833,7 +114833,7 @@ SQLITE_PRIVATE void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ ** been seen on a column. This routine sets the notNull flag on ** the column currently under construction. */ -SQLITE_PRIVATE void sqlite3AddNotNull(Parse *pParse, int onError){ +SQLITE_PRIVATE void tdsqlite3AddNotNull(Parse *pParse, int onError){ Table *p; Column *pCol; p = pParse->pNewTable; @@ -114880,14 +114880,14 @@ SQLITE_PRIVATE void sqlite3AddNotNull(Parse *pParse, int onError){ ** If none of the substrings in the above table are found, ** SQLITE_AFF_NUMERIC is returned. */ -SQLITE_PRIVATE char sqlite3AffinityType(const char *zIn, Column *pCol){ +SQLITE_PRIVATE char tdsqlite3AffinityType(const char *zIn, Column *pCol){ u32 h = 0; char aff = SQLITE_AFF_NUMERIC; const char *zChar = 0; assert( zIn!=0 ); while( zIn[0] ){ - h = (h<<8) + sqlite3UpperToLower[(*zIn)&0xff]; + h = (h<<8) + tdsqlite3UpperToLower[(*zIn)&0xff]; zIn++; if( h==(('c'<<24)+('h'<<16)+('a'<<8)+'r') ){ /* CHAR */ aff = SQLITE_AFF_TEXT; @@ -114924,9 +114924,9 @@ SQLITE_PRIVATE char sqlite3AffinityType(const char *zIn, Column *pCol){ if( aff r=(k/4+1) */ - sqlite3GetInt32(zChar, &v); + tdsqlite3GetInt32(zChar, &v); break; } zChar++; @@ -114936,7 +114936,7 @@ SQLITE_PRIVATE char sqlite3AffinityType(const char *zIn, Column *pCol){ } } #ifdef SQLITE_ENABLE_SORTER_REFERENCES - if( v>=sqlite3GlobalConfig.szSorterRef ){ + if( v>=tdsqlite3GlobalConfig.szSorterRef ){ pCol->colFlags |= COLFLAG_SORTERREF; } #endif @@ -114957,7 +114957,7 @@ SQLITE_PRIVATE char sqlite3AffinityType(const char *zIn, Column *pCol){ ** This routine is called by the parser while in the middle of ** parsing a CREATE TABLE statement. */ -SQLITE_PRIVATE void sqlite3AddDefaultValue( +SQLITE_PRIVATE void tdsqlite3AddDefaultValue( Parse *pParse, /* Parsing context */ Expr *pExpr, /* The parsed expression of the default value */ const char *zStart, /* Start of the default value text */ @@ -114965,39 +114965,39 @@ SQLITE_PRIVATE void sqlite3AddDefaultValue( ){ Table *p; Column *pCol; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; p = pParse->pNewTable; if( p!=0 ){ int isInit = db->init.busy && db->init.iDb!=1; pCol = &(p->aCol[p->nCol-1]); - if( !sqlite3ExprIsConstantOrFunction(pExpr, isInit) ){ - sqlite3ErrorMsg(pParse, "default value of column [%s] is not constant", + if( !tdsqlite3ExprIsConstantOrFunction(pExpr, isInit) ){ + tdsqlite3ErrorMsg(pParse, "default value of column [%s] is not constant", pCol->zName); #ifndef SQLITE_OMIT_GENERATED_COLUMNS }else if( pCol->colFlags & COLFLAG_GENERATED ){ testcase( pCol->colFlags & COLFLAG_VIRTUAL ); testcase( pCol->colFlags & COLFLAG_STORED ); - sqlite3ErrorMsg(pParse, "cannot use DEFAULT on a generated column"); + tdsqlite3ErrorMsg(pParse, "cannot use DEFAULT on a generated column"); #endif }else{ /* A copy of pExpr is used instead of the original, as pExpr contains ** tokens that point to volatile memory. */ Expr x; - sqlite3ExprDelete(db, pCol->pDflt); + tdsqlite3ExprDelete(db, pCol->pDflt); memset(&x, 0, sizeof(x)); x.op = TK_SPAN; - x.u.zToken = sqlite3DbSpanDup(db, zStart, zEnd); + x.u.zToken = tdsqlite3DbSpanDup(db, zStart, zEnd); x.pLeft = pExpr; x.flags = EP_Skip; - pCol->pDflt = sqlite3ExprDup(db, &x, EXPRDUP_REDUCE); - sqlite3DbFree(db, x.u.zToken); + pCol->pDflt = tdsqlite3ExprDup(db, &x, EXPRDUP_REDUCE); + tdsqlite3DbFree(db, x.u.zToken); } } if( IN_RENAME_OBJECT ){ - sqlite3RenameExprUnmap(pParse, pExpr); + tdsqlite3RenameExprUnmap(pParse, pExpr); } - sqlite3ExprDelete(db, pExpr); + tdsqlite3ExprDelete(db, pExpr); } /* @@ -115016,7 +115016,7 @@ SQLITE_PRIVATE void sqlite3AddDefaultValue( ** If the expression is anything other than TK_STRING, the expression is ** unchanged. */ -static void sqlite3StringToId(Expr *p){ +static void tdsqlite3StringToId(Expr *p){ if( p->op==TK_STRING ){ p->op = TK_ID; }else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){ @@ -115033,7 +115033,7 @@ static void makeColumnPartOfPrimaryKey(Parse *pParse, Column *pCol){ if( pCol->colFlags & COLFLAG_GENERATED ){ testcase( pCol->colFlags & COLFLAG_VIRTUAL ); testcase( pCol->colFlags & COLFLAG_STORED ); - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "generated columns cannot be part of the PRIMARY KEY"); } #endif @@ -115057,7 +115057,7 @@ static void makeColumnPartOfPrimaryKey(Parse *pParse, Column *pCol){ ** If the key is not an INTEGER PRIMARY KEY, then create a unique ** index for the key. No index is created for INTEGER PRIMARY KEYs. */ -SQLITE_PRIVATE void sqlite3AddPrimaryKey( +SQLITE_PRIVATE void tdsqlite3AddPrimaryKey( Parse *pParse, /* Parsing context */ ExprList *pList, /* List of field names to be indexed */ int onError, /* What to do with a uniqueness conflict */ @@ -115070,7 +115070,7 @@ SQLITE_PRIVATE void sqlite3AddPrimaryKey( int nTerm; if( pTab==0 ) goto primary_key_exit; if( pTab->tabFlags & TF_HasPrimaryKey ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "table \"%s\" has more than one primary key", pTab->zName); goto primary_key_exit; } @@ -115083,13 +115083,13 @@ SQLITE_PRIVATE void sqlite3AddPrimaryKey( }else{ nTerm = pList->nExpr; for(i=0; ia[i].pExpr); + Expr *pCExpr = tdsqlite3ExprSkipCollate(pList->a[i].pExpr); assert( pCExpr!=0 ); - sqlite3StringToId(pCExpr); + tdsqlite3StringToId(pCExpr); if( pCExpr->op==TK_ID ){ const char *zCName = pCExpr->u.zToken; for(iCol=0; iColnCol; iCol++){ - if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zName)==0 ){ + if( tdsqlite3StrICmp(zCName, pTab->aCol[iCol].zName)==0 ){ pCol = &pTab->aCol[iCol]; makeColumnPartOfPrimaryKey(pParse, pCol); break; @@ -115100,56 +115100,56 @@ SQLITE_PRIVATE void sqlite3AddPrimaryKey( } if( nTerm==1 && pCol - && sqlite3StrICmp(sqlite3ColumnType(pCol,""), "INTEGER")==0 + && tdsqlite3StrICmp(tdsqlite3ColumnType(pCol,""), "INTEGER")==0 && sortOrder!=SQLITE_SO_DESC ){ if( IN_RENAME_OBJECT && pList ){ - Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[0].pExpr); - sqlite3RenameTokenRemap(pParse, &pTab->iPKey, pCExpr); + Expr *pCExpr = tdsqlite3ExprSkipCollate(pList->a[0].pExpr); + tdsqlite3RenameTokenRemap(pParse, &pTab->iPKey, pCExpr); } pTab->iPKey = iCol; pTab->keyConf = (u8)onError; assert( autoInc==0 || autoInc==1 ); pTab->tabFlags |= autoInc*TF_Autoincrement; if( pList ) pParse->iPkSortOrder = pList->a[0].sortFlags; - (void)sqlite3HasExplicitNulls(pParse, pList); + (void)tdsqlite3HasExplicitNulls(pParse, pList); }else if( autoInc ){ #ifndef SQLITE_OMIT_AUTOINCREMENT - sqlite3ErrorMsg(pParse, "AUTOINCREMENT is only allowed on an " + tdsqlite3ErrorMsg(pParse, "AUTOINCREMENT is only allowed on an " "INTEGER PRIMARY KEY"); #endif }else{ - sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0, + tdsqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0, 0, sortOrder, 0, SQLITE_IDXTYPE_PRIMARYKEY); pList = 0; } primary_key_exit: - sqlite3ExprListDelete(pParse->db, pList); + tdsqlite3ExprListDelete(pParse->db, pList); return; } /* ** Add a new CHECK constraint to the table currently under construction. */ -SQLITE_PRIVATE void sqlite3AddCheckConstraint( +SQLITE_PRIVATE void tdsqlite3AddCheckConstraint( Parse *pParse, /* Parsing context */ Expr *pCheckExpr /* The check expression */ ){ #ifndef SQLITE_OMIT_CHECK Table *pTab = pParse->pNewTable; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; if( pTab && !IN_DECLARE_VTAB - && !sqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt) + && !tdsqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt) ){ - pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr); + pTab->pCheck = tdsqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr); if( pParse->constraintName.n ){ - sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1); + tdsqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1); } }else #endif { - sqlite3ExprDelete(pParse->db, pCheckExpr); + tdsqlite3ExprDelete(pParse->db, pCheckExpr); } } @@ -115157,21 +115157,21 @@ SQLITE_PRIVATE void sqlite3AddCheckConstraint( ** Set the collation function of the most recently parsed table column ** to the CollSeq given. */ -SQLITE_PRIVATE void sqlite3AddCollateType(Parse *pParse, Token *pToken){ +SQLITE_PRIVATE void tdsqlite3AddCollateType(Parse *pParse, Token *pToken){ Table *p; int i; char *zColl; /* Dequoted name of collation sequence */ - sqlite3 *db; + tdsqlite3 *db; if( (p = pParse->pNewTable)==0 ) return; i = p->nCol-1; db = pParse->db; - zColl = sqlite3NameFromToken(db, pToken); + zColl = tdsqlite3NameFromToken(db, pToken); if( !zColl ) return; - if( sqlite3LocateCollSeq(pParse, zColl) ){ + if( tdsqlite3LocateCollSeq(pParse, zColl) ){ Index *pIdx; - sqlite3DbFree(db, p->aCol[i].zColl); + tdsqlite3DbFree(db, p->aCol[i].zColl); p->aCol[i].zColl = zColl; /* If the column is declared as " PRIMARY KEY COLLATE ", @@ -115185,14 +115185,14 @@ SQLITE_PRIVATE void sqlite3AddCollateType(Parse *pParse, Token *pToken){ } } }else{ - sqlite3DbFree(db, zColl); + tdsqlite3DbFree(db, zColl); } } /* Change the most recently parsed column to be a GENERATED ALWAYS AS ** column. */ -SQLITE_PRIVATE void sqlite3AddGenerated(Parse *pParse, Expr *pExpr, Token *pType){ +SQLITE_PRIVATE void tdsqlite3AddGenerated(Parse *pParse, Expr *pExpr, Token *pType){ #ifndef SQLITE_OMIT_GENERATED_COLUMNS u8 eType = COLFLAG_VIRTUAL; Table *pTab = pParse->pNewTable; @@ -115203,14 +115203,14 @@ SQLITE_PRIVATE void sqlite3AddGenerated(Parse *pParse, Expr *pExpr, Token *pType } pCol = &(pTab->aCol[pTab->nCol-1]); if( IN_DECLARE_VTAB ){ - sqlite3ErrorMsg(pParse, "virtual tables cannot use computed columns"); + tdsqlite3ErrorMsg(pParse, "virtual tables cannot use computed columns"); goto generated_done; } if( pCol->pDflt ) goto generated_error; if( pType ){ - if( pType->n==7 && sqlite3StrNICmp("virtual",pType->z,7)==0 ){ + if( pType->n==7 && tdsqlite3StrNICmp("virtual",pType->z,7)==0 ){ /* no-op */ - }else if( pType->n==6 && sqlite3StrNICmp("stored",pType->z,6)==0 ){ + }else if( pType->n==6 && tdsqlite3StrNICmp("stored",pType->z,6)==0 ){ eType = COLFLAG_STORED; }else{ goto generated_error; @@ -115229,15 +115229,15 @@ SQLITE_PRIVATE void sqlite3AddGenerated(Parse *pParse, Expr *pExpr, Token *pType goto generated_done; generated_error: - sqlite3ErrorMsg(pParse, "error in generated column \"%s\"", + tdsqlite3ErrorMsg(pParse, "error in generated column \"%s\"", pCol->zName); generated_done: - sqlite3ExprDelete(pParse->db, pExpr); + tdsqlite3ExprDelete(pParse->db, pExpr); #else /* Throw and error for the GENERATED ALWAYS AS clause if the ** SQLITE_OMIT_GENERATED_COLUMNS compile-time option is used. */ - sqlite3ErrorMsg(pParse, "generated columns not supported"); - sqlite3ExprDelete(pParse->db, pExpr); + tdsqlite3ErrorMsg(pParse, "generated columns not supported"); + tdsqlite3ExprDelete(pParse->db, pExpr); #endif } @@ -115260,11 +115260,11 @@ generated_done: ** IMPLEMENTATION-OF: R-34230-56049 SQLite automatically increments ** the schema-version whenever the schema changes. */ -SQLITE_PRIVATE void sqlite3ChangeCookie(Parse *pParse, int iDb){ - sqlite3 *db = pParse->db; +SQLITE_PRIVATE void tdsqlite3ChangeCookie(Parse *pParse, int iDb){ + tdsqlite3 *db = pParse->db; Vdbe *v = pParse->pVdbe; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_SCHEMA_VERSION, + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); + tdsqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_SCHEMA_VERSION, (int)(1+(unsigned)db->aDb[iDb].pSchema->schema_cookie)); } @@ -115303,10 +115303,10 @@ static void identPut(char *z, int *pIdx, char *zSignedIdent){ i = *pIdx; for(j=0; zIdent[j]; j++){ - if( !sqlite3Isalnum(zIdent[j]) && zIdent[j]!='_' ) break; + if( !tdsqlite3Isalnum(zIdent[j]) && zIdent[j]!='_' ) break; } - needQuote = sqlite3Isdigit(zIdent[0]) - || sqlite3KeywordCode(zIdent, j)!=TK_ID + needQuote = tdsqlite3Isdigit(zIdent[0]) + || tdsqlite3KeywordCode(zIdent, j)!=TK_ID || zIdent[j]!=0 || j==0; @@ -115325,7 +115325,7 @@ static void identPut(char *z, int *pIdx, char *zSignedIdent){ ** table. Memory to hold the text of the statement is obtained ** from sqliteMalloc() and must be freed by the calling function. */ -static char *createTableStmt(sqlite3 *db, Table *p){ +static char *createTableStmt(tdsqlite3 *db, Table *p){ int i, k, n; char *zStmt; char *zSep, *zSep2, *zEnd; @@ -115345,13 +115345,13 @@ static char *createTableStmt(sqlite3 *db, Table *p){ zEnd = "\n)"; } n += 35 + 6*p->nCol; - zStmt = sqlite3DbMallocRaw(0, n); + zStmt = tdsqlite3DbMallocRaw(0, n); if( zStmt==0 ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); return 0; } - sqlite3_snprintf(n, zStmt, "CREATE TABLE "); - k = sqlite3Strlen30(zStmt); + tdsqlite3_snprintf(n, zStmt, "CREATE TABLE "); + k = tdsqlite3Strlen30(zStmt); identPut(zStmt, &k, p->zName); zStmt[k++] = '('; for(pCol=p->aCol, i=0; inCol; i++, pCol++){ @@ -115365,8 +115365,8 @@ static char *createTableStmt(sqlite3 *db, Table *p){ int len; const char *zType; - sqlite3_snprintf(n-k, &zStmt[k], zSep); - k += sqlite3Strlen30(&zStmt[k]); + tdsqlite3_snprintf(n-k, &zStmt[k], zSep); + k += tdsqlite3Strlen30(&zStmt[k]); zSep = zSep2; identPut(zStmt, &k, pCol->zName); assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 ); @@ -115378,14 +115378,14 @@ static char *createTableStmt(sqlite3 *db, Table *p){ testcase( pCol->affinity==SQLITE_AFF_REAL ); zType = azType[pCol->affinity - SQLITE_AFF_BLOB]; - len = sqlite3Strlen30(zType); + len = tdsqlite3Strlen30(zType); assert( pCol->affinity==SQLITE_AFF_BLOB - || pCol->affinity==sqlite3AffinityType(zType, 0) ); + || pCol->affinity==tdsqlite3AffinityType(zType, 0) ); memcpy(&zStmt[k], zType, len); k += len; assert( k<=n ); } - sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd); + tdsqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd); return zStmt; } @@ -115393,13 +115393,13 @@ static char *createTableStmt(sqlite3 *db, Table *p){ ** Resize an Index object to hold N columns total. Return SQLITE_OK ** on success and SQLITE_NOMEM on an OOM error. */ -static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){ +static int resizeIndexObject(tdsqlite3 *db, Index *pIdx, int N){ char *zExtra; int nByte; if( pIdx->nColumn>=N ) return SQLITE_OK; assert( pIdx->isResized==0 ); nByte = (sizeof(char*) + sizeof(i16) + 1)*N; - zExtra = sqlite3DbMallocZero(db, nByte); + zExtra = tdsqlite3DbMallocZero(db, nByte); if( zExtra==0 ) return SQLITE_NOMEM_BKPT; memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn); pIdx->azColl = (const char**)zExtra; @@ -115425,7 +115425,7 @@ static void estimateTableWidth(Table *pTab){ wTable += pTabCol->szEst; } if( pTab->iPKey<0 ) wTable++; - pTab->szTabRow = sqlite3LogEst(wTable*4); + pTab->szTabRow = tdsqlite3LogEst(wTable*4); } /* @@ -115440,7 +115440,7 @@ static void estimateIndexWidth(Index *pIdx){ assert( xpTable->nCol ); wIndex += x<0 ? 1 : aCol[pIdx->aiColumn[i]].szEst; } - pIdx->szIdxRow = sqlite3LogEst(wIndex*4); + pIdx->szIdxRow = tdsqlite3LogEst(wIndex*4); } /* Return true if column number x is any of the first nCol entries of aiCol[]. @@ -115483,7 +115483,7 @@ static int isDupColumn(Index *pIdx, int nKey, Index *pPk, int iCol){ for(i=0; iaiColumn[i]>=0 || j>=0 ); if( pIdx->aiColumn[i]==j - && sqlite3StrICmp(pIdx->azColl[i], pPk->azColl[iCol])==0 + && tdsqlite3StrICmp(pIdx->azColl[i], pPk->azColl[iCol])==0 ){ return 1; } @@ -115555,7 +115555,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ int nPk; int nExtra; int i, j; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Vdbe *v = pParse->pVdbe; /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) @@ -115574,7 +115574,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ */ if( pParse->addrCrTab ){ assert( v ); - sqlite3VdbeChangeP3(v, pParse->addrCrTab, BTREE_BLOBKEY); + tdsqlite3VdbeChangeP3(v, pParse->addrCrTab, BTREE_BLOBKEY); } /* Locate the PRIMARY KEY index. Or, if this table was originally @@ -115583,23 +115583,23 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ if( pTab->iPKey>=0 ){ ExprList *pList; Token ipkToken; - sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName); - pList = sqlite3ExprListAppend(pParse, 0, - sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); + tdsqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName); + pList = tdsqlite3ExprListAppend(pParse, 0, + tdsqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); if( pList==0 ) return; if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenRemap(pParse, pList->a[0].pExpr, &pTab->iPKey); + tdsqlite3RenameTokenRemap(pParse, pList->a[0].pExpr, &pTab->iPKey); } pList->a[0].sortFlags = pParse->iPkSortOrder; assert( pParse->pNewTable==pTab ); pTab->iPKey = -1; - sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, + tdsqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, SQLITE_IDXTYPE_PRIMARYKEY); if( db->mallocFailed || pParse->nErr ) return; - pPk = sqlite3PrimaryKeyIndex(pTab); + pPk = tdsqlite3PrimaryKeyIndex(pTab); assert( pPk->nKeyCol==1 ); }else{ - pPk = sqlite3PrimaryKeyIndex(pTab); + pPk = tdsqlite3PrimaryKeyIndex(pTab); assert( pPk!=0 ); /* @@ -115630,7 +115630,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ ** a database schema). */ if( v && pPk->tnum>0 ){ assert( db->init.busy==0 ); - sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto); + tdsqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto); } /* The root page of the PRIMARY KEY is the table root page */ @@ -115684,7 +115684,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ ){ assert( jnColumn ); pPk->aiColumn[j] = i; - pPk->azColl[j] = sqlite3StrBINARY; + pPk->azColl[j] = tdsqlite3StrBINARY; j++; } } @@ -115701,7 +115701,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ ** zName is temporarily modified while this routine is running, but is ** restored to its original value prior to this routine returning. */ -SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName){ +SQLITE_PRIVATE int tdsqlite3ShadowTableName(tdsqlite3 *db, const char *zName){ char *zTail; /* Pointer to the last "_" in zName */ Table *pTab; /* Table that zName is a shadow of */ Module *pMod; /* Module for the virtual table */ @@ -115709,11 +115709,11 @@ SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName){ zTail = strrchr(zName, '_'); if( zTail==0 ) return 0; *zTail = 0; - pTab = sqlite3FindTable(db, zName, 0); + pTab = tdsqlite3FindTable(db, zName, 0); *zTail = '_'; if( pTab==0 ) return 0; if( !IsVirtual(pTab) ) return 0; - pMod = (Module*)sqlite3HashFind(&db->aModule, pTab->azModuleArg[0]); + pMod = (Module*)tdsqlite3HashFind(&db->aModule, pTab->azModuleArg[0]); if( pMod==0 ) return 0; if( pMod->pModule->iVersion<3 ) return 0; if( pMod->pModule->xShadowName==0 ) return 0; @@ -115741,7 +115741,7 @@ SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName){ ** "CREATE TABLE ... AS SELECT ..." statement. The column names of ** the new table will match the result set of the SELECT. */ -SQLITE_PRIVATE void sqlite3EndTable( +SQLITE_PRIVATE void tdsqlite3EndTable( Parse *pParse, /* Parse context */ Token *pCons, /* The ',' token after the last column defn. */ Token *pEnd, /* The ')' before options in the CREATE TABLE */ @@ -115749,7 +115749,7 @@ SQLITE_PRIVATE void sqlite3EndTable( Select *pSelect /* Select from a "CREATE ... AS SELECT" */ ){ Table *p; /* The new table */ - sqlite3 *db = pParse->db; /* The database connection */ + tdsqlite3 *db = pParse->db; /* The database connection */ int iDb; /* Database in which the table lives */ Index *pIdx; /* An implied index of the table */ @@ -115760,7 +115760,7 @@ SQLITE_PRIVATE void sqlite3EndTable( p = pParse->pNewTable; if( p==0 ) return; - if( pSelect==0 && sqlite3ShadowTableName(db, p->zName) ){ + if( pSelect==0 && tdsqlite3ShadowTableName(db, p->zName) ){ p->tabFlags |= TF_Shadow; } @@ -115775,7 +115775,7 @@ SQLITE_PRIVATE void sqlite3EndTable( */ if( db->init.busy ){ if( pSelect ){ - sqlite3ErrorMsg(pParse, ""); + tdsqlite3ErrorMsg(pParse, ""); return; } p->tnum = db->init.newTnum; @@ -115783,35 +115783,35 @@ SQLITE_PRIVATE void sqlite3EndTable( } assert( (p->tabFlags & TF_HasPrimaryKey)==0 - || p->iPKey>=0 || sqlite3PrimaryKeyIndex(p)!=0 ); + || p->iPKey>=0 || tdsqlite3PrimaryKeyIndex(p)!=0 ); assert( (p->tabFlags & TF_HasPrimaryKey)!=0 - || (p->iPKey<0 && sqlite3PrimaryKeyIndex(p)==0) ); + || (p->iPKey<0 && tdsqlite3PrimaryKeyIndex(p)==0) ); /* Special processing for WITHOUT ROWID Tables */ if( tabOpts & TF_WithoutRowid ){ if( (p->tabFlags & TF_Autoincrement) ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "AUTOINCREMENT not allowed on WITHOUT ROWID tables"); return; } if( (p->tabFlags & TF_HasPrimaryKey)==0 ){ - sqlite3ErrorMsg(pParse, "PRIMARY KEY missing on table %s", p->zName); + tdsqlite3ErrorMsg(pParse, "PRIMARY KEY missing on table %s", p->zName); return; } p->tabFlags |= TF_WithoutRowid | TF_NoVisibleRowid; convertToWithoutRowidTable(pParse, p); } - iDb = sqlite3SchemaToIndex(db, p->pSchema); + iDb = tdsqlite3SchemaToIndex(db, p->pSchema); #ifndef SQLITE_OMIT_CHECK /* Resolve names in all CHECK constraint expressions. */ if( p->pCheck ){ - sqlite3ResolveSelfReference(pParse, p, NC_IsCheck, 0, p->pCheck); + tdsqlite3ResolveSelfReference(pParse, p, NC_IsCheck, 0, p->pCheck); if( pParse->nErr ){ /* If errors are seen, delete the CHECK constraints now, else they might ** actually be used if PRAGMA writable_schema=ON is set. */ - sqlite3ExprListDelete(db, p->pCheck); + tdsqlite3ExprListDelete(db, p->pCheck); p->pCheck = 0; } } @@ -115827,22 +115827,22 @@ SQLITE_PRIVATE void sqlite3EndTable( Expr *pX = p->aCol[ii].pDflt; testcase( colFlags & COLFLAG_VIRTUAL ); testcase( colFlags & COLFLAG_STORED ); - if( sqlite3ResolveSelfReference(pParse, p, NC_GenCol, pX, 0) ){ + if( tdsqlite3ResolveSelfReference(pParse, p, NC_GenCol, pX, 0) ){ /* If there are errors in resolving the expression, change the ** expression to a NULL. This prevents code generators that operate ** on the expression from inserting extra parts into the expression ** tree that have been allocated from lookaside memory, which is ** illegal in a schema and will lead to errors or heap corruption ** when the database connection closes. */ - sqlite3ExprDelete(db, pX); - p->aCol[ii].pDflt = sqlite3ExprAlloc(db, TK_NULL, 0, 0); + tdsqlite3ExprDelete(db, pX); + p->aCol[ii].pDflt = tdsqlite3ExprAlloc(db, TK_NULL, 0, 0); } }else{ nNG++; } } if( nNG==0 ){ - sqlite3ErrorMsg(pParse, "must have at least one non-generated column"); + tdsqlite3ErrorMsg(pParse, "must have at least one non-generated column"); return; } } @@ -115867,10 +115867,10 @@ SQLITE_PRIVATE void sqlite3EndTable( char *zType2; /* "VIEW" or "TABLE" */ char *zStmt; /* Text of the CREATE TABLE or CREATE VIEW statement */ - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( NEVER(v==0) ) return; - sqlite3VdbeAddOp1(v, OP_Close, 0); + tdsqlite3VdbeAddOp1(v, OP_Close, 0); /* ** Initialize zType for the new view or table. @@ -115891,7 +115891,7 @@ SQLITE_PRIVATE void sqlite3EndTable( ** statement to populate the new table. The root-page number for the ** new table is in register pParse->regRoot. ** - ** Once the SELECT has been coded by sqlite3Select(), it is in a + ** Once the SELECT has been coded by tdsqlite3Select(), it is in a ** suitable state to query for the column names and types to be used ** by the new table. ** @@ -115913,35 +115913,35 @@ SQLITE_PRIVATE void sqlite3EndTable( regRec = ++pParse->nMem; regRowid = ++pParse->nMem; assert(pParse->nTab==1); - sqlite3MayAbort(pParse); - sqlite3VdbeAddOp3(v, OP_OpenWrite, 1, pParse->regRoot, iDb); - sqlite3VdbeChangeP5(v, OPFLAG_P2ISREG); + tdsqlite3MayAbort(pParse); + tdsqlite3VdbeAddOp3(v, OP_OpenWrite, 1, pParse->regRoot, iDb); + tdsqlite3VdbeChangeP5(v, OPFLAG_P2ISREG); pParse->nTab = 2; - addrTop = sqlite3VdbeCurrentAddr(v) + 1; - sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); + addrTop = tdsqlite3VdbeCurrentAddr(v) + 1; + tdsqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); if( pParse->nErr ) return; - pSelTab = sqlite3ResultSetOfSelect(pParse, pSelect, SQLITE_AFF_BLOB); + pSelTab = tdsqlite3ResultSetOfSelect(pParse, pSelect, SQLITE_AFF_BLOB); if( pSelTab==0 ) return; assert( p->aCol==0 ); p->nCol = p->nNVCol = pSelTab->nCol; p->aCol = pSelTab->aCol; pSelTab->nCol = 0; pSelTab->aCol = 0; - sqlite3DeleteTable(db, pSelTab); - sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield); - sqlite3Select(pParse, pSelect, &dest); + tdsqlite3DeleteTable(db, pSelTab); + tdsqlite3SelectDestInit(&dest, SRT_Coroutine, regYield); + tdsqlite3Select(pParse, pSelect, &dest); if( pParse->nErr ) return; - sqlite3VdbeEndCoroutine(v, regYield); - sqlite3VdbeJumpHere(v, addrTop - 1); - addrInsLoop = sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm); + tdsqlite3VdbeEndCoroutine(v, regYield); + tdsqlite3VdbeJumpHere(v, addrTop - 1); + addrInsLoop = tdsqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_MakeRecord, dest.iSdst, dest.nSdst, regRec); - sqlite3TableAffinity(v, p, 0); - sqlite3VdbeAddOp2(v, OP_NewRowid, 1, regRowid); - sqlite3VdbeAddOp3(v, OP_Insert, 1, regRec, regRowid); - sqlite3VdbeGoto(v, addrInsLoop); - sqlite3VdbeJumpHere(v, addrInsLoop); - sqlite3VdbeAddOp1(v, OP_Close, 1); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, dest.iSdst, dest.nSdst, regRec); + tdsqlite3TableAffinity(v, p, 0); + tdsqlite3VdbeAddOp2(v, OP_NewRowid, 1, regRowid); + tdsqlite3VdbeAddOp3(v, OP_Insert, 1, regRec, regRowid); + tdsqlite3VdbeGoto(v, addrInsLoop); + tdsqlite3VdbeJumpHere(v, addrInsLoop); + tdsqlite3VdbeAddOp1(v, OP_Close, 1); } /* Compute the complete text of the CREATE statement */ @@ -115951,7 +115951,7 @@ SQLITE_PRIVATE void sqlite3EndTable( Token *pEnd2 = tabOpts ? &pParse->sLastToken : pEnd; n = (int)(pEnd2->z - pParse->sNameToken.z); if( pEnd2->z[0]!=';' ) n += pEnd2->n; - zStmt = sqlite3MPrintf(db, + zStmt = tdsqlite3MPrintf(db, "CREATE %s %.*s", zType2, n, pParse->sNameToken.z ); } @@ -115960,7 +115960,7 @@ SQLITE_PRIVATE void sqlite3EndTable( ** SQLITE_MASTER table. We just need to update that slot with all ** the information we've collected. */ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "UPDATE %Q.%s " "SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q " "WHERE rowid=#%d", @@ -115972,8 +115972,8 @@ SQLITE_PRIVATE void sqlite3EndTable( zStmt, pParse->regRowid ); - sqlite3DbFree(db, zStmt); - sqlite3ChangeCookie(pParse, iDb); + tdsqlite3DbFree(db, zStmt); + tdsqlite3ChangeCookie(pParse, iDb); #ifndef SQLITE_OMIT_AUTOINCREMENT /* Check to see if we need to create an sqlite_sequence table for @@ -115981,9 +115981,9 @@ SQLITE_PRIVATE void sqlite3EndTable( */ if( (p->tabFlags & TF_Autoincrement)!=0 ){ Db *pDb = &db->aDb[iDb]; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); if( pDb->pSchema->pSeqTab==0 ){ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "CREATE TABLE %Q.sqlite_sequence(name,seq)", pDb->zDbSName ); @@ -115992,8 +115992,8 @@ SQLITE_PRIVATE void sqlite3EndTable( #endif /* Reparse everything to update our internal data structures */ - sqlite3VdbeAddParseSchemaOp(v, iDb, - sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName)); + tdsqlite3VdbeAddParseSchemaOp(v, iDb, + tdsqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName)); } /* Add the table to the in-memory representation of the database. @@ -116001,11 +116001,11 @@ SQLITE_PRIVATE void sqlite3EndTable( if( db->init.busy ){ Table *pOld; Schema *pSchema = p->pSchema; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName, p); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); + pOld = tdsqlite3HashInsert(&pSchema->tblHash, p->zName, p); if( pOld ){ assert( p==pOld ); /* Malloc must have failed inside HashInsert() */ - sqlite3OomFault(db); + tdsqlite3OomFault(db); return; } pParse->pNewTable = 0; @@ -116020,7 +116020,7 @@ SQLITE_PRIVATE void sqlite3EndTable( pCons = pEnd; } nName = (int)((const char *)pCons->z - zName); - p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName); + p->addColOffset = 13 + tdsqlite3Utf8CharLen(zName, nName); } #endif } @@ -116030,7 +116030,7 @@ SQLITE_PRIVATE void sqlite3EndTable( /* ** The parser calls this routine in order to create a new VIEW */ -SQLITE_PRIVATE void sqlite3CreateView( +SQLITE_PRIVATE void tdsqlite3CreateView( Parse *pParse, /* The parsing context */ Token *pBegin, /* The CREATE token that begins the statement */ Token *pName1, /* The token that holds the name of the view */ @@ -116047,33 +116047,33 @@ SQLITE_PRIVATE void sqlite3CreateView( DbFixer sFix; Token *pName = 0; int iDb; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; if( pParse->nVar>0 ){ - sqlite3ErrorMsg(pParse, "parameters are not allowed in views"); + tdsqlite3ErrorMsg(pParse, "parameters are not allowed in views"); goto create_view_fail; } - sqlite3StartTable(pParse, pName1, pName2, isTemp, 1, 0, noErr); + tdsqlite3StartTable(pParse, pName1, pName2, isTemp, 1, 0, noErr); p = pParse->pNewTable; if( p==0 || pParse->nErr ) goto create_view_fail; - sqlite3TwoPartName(pParse, pName1, pName2, &pName); - iDb = sqlite3SchemaToIndex(db, p->pSchema); - sqlite3FixInit(&sFix, pParse, iDb, "view", pName); - if( sqlite3FixSelect(&sFix, pSelect) ) goto create_view_fail; + tdsqlite3TwoPartName(pParse, pName1, pName2, &pName); + iDb = tdsqlite3SchemaToIndex(db, p->pSchema); + tdsqlite3FixInit(&sFix, pParse, iDb, "view", pName); + if( tdsqlite3FixSelect(&sFix, pSelect) ) goto create_view_fail; /* Make a copy of the entire SELECT statement that defines the view. ** This will force all the Expr.token.z values to be dynamically ** allocated rather than point to the input string - which means that - ** they will persist after the current sqlite3_exec() call returns. + ** they will persist after the current tdsqlite3_exec() call returns. */ pSelect->selFlags |= SF_View; if( IN_RENAME_OBJECT ){ p->pSelect = pSelect; pSelect = 0; }else{ - p->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); + p->pSelect = tdsqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); } - p->pCheck = sqlite3ExprListDup(db, pCNames, EXPRDUP_REDUCE); + p->pCheck = tdsqlite3ExprListDup(db, pCNames, EXPRDUP_REDUCE); if( db->mallocFailed ) goto create_view_fail; /* Locate the end of the CREATE VIEW statement. Make sEnd point to @@ -116088,19 +116088,19 @@ SQLITE_PRIVATE void sqlite3CreateView( n = (int)(sEnd.z - pBegin->z); assert( n>0 ); z = pBegin->z; - while( sqlite3Isspace(z[n-1]) ){ n--; } + while( tdsqlite3Isspace(z[n-1]) ){ n--; } sEnd.z = &z[n-1]; sEnd.n = 1; - /* Use sqlite3EndTable() to add the view to the SQLITE_MASTER table */ - sqlite3EndTable(pParse, 0, &sEnd, 0, 0); + /* Use tdsqlite3EndTable() to add the view to the SQLITE_MASTER table */ + tdsqlite3EndTable(pParse, 0, &sEnd, 0, 0); create_view_fail: - sqlite3SelectDelete(db, pSelect); + tdsqlite3SelectDelete(db, pSelect); if( IN_RENAME_OBJECT ){ - sqlite3RenameExprlistUnmap(pParse, pCNames); + tdsqlite3RenameExprlistUnmap(pParse, pCNames); } - sqlite3ExprListDelete(db, pCNames); + tdsqlite3ExprListDelete(db, pCNames); return; } #endif /* SQLITE_OMIT_VIEW */ @@ -116111,24 +116111,24 @@ create_view_fail: ** the columns of the view in the pTable structure. Return the number ** of errors. If an error is seen leave an error message in pParse->zErrMsg. */ -SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ +SQLITE_PRIVATE int tdsqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ Table *pSelTab; /* A fake table from which we get the result set */ Select *pSel; /* Copy of the SELECT that implements the view */ int nErr = 0; /* Number of errors encountered */ int n; /* Temporarily holds the number of cursors assigned */ - sqlite3 *db = pParse->db; /* Database connection for malloc errors */ + tdsqlite3 *db = pParse->db; /* Database connection for malloc errors */ #ifndef SQLITE_OMIT_VIRTUALTABLE int rc; #endif #ifndef SQLITE_OMIT_AUTHORIZATION - sqlite3_xauth xAuth; /* Saved xAuth pointer */ + tdsqlite3_xauth xAuth; /* Saved xAuth pointer */ #endif assert( pTable ); #ifndef SQLITE_OMIT_VIRTUALTABLE db->nSchemaLock++; - rc = sqlite3VtabCallConnect(pParse, pTable); + rc = tdsqlite3VtabCallConnect(pParse, pTable); db->nSchemaLock--; if( rc ){ return 1; @@ -116158,36 +116158,36 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ ** SELECT * FROM temp.ex1; */ if( pTable->nCol<0 ){ - sqlite3ErrorMsg(pParse, "view %s is circularly defined", pTable->zName); + tdsqlite3ErrorMsg(pParse, "view %s is circularly defined", pTable->zName); return 1; } assert( pTable->nCol>=0 ); /* If we get this far, it means we need to compute the table names. - ** Note that the call to sqlite3ResultSetOfSelect() will expand any + ** Note that the call to tdsqlite3ResultSetOfSelect() will expand any ** "*" elements in the results set of the view and will assign cursors ** to the elements of the FROM clause. But we do not want these changes ** to be permanent. So the computation is done on a copy of the SELECT ** statement that defines the view. */ assert( pTable->pSelect ); - pSel = sqlite3SelectDup(db, pTable->pSelect, 0); + pSel = tdsqlite3SelectDup(db, pTable->pSelect, 0); if( pSel ){ #ifndef SQLITE_OMIT_ALTERTABLE u8 eParseMode = pParse->eParseMode; pParse->eParseMode = PARSE_MODE_NORMAL; #endif n = pParse->nTab; - sqlite3SrcListAssignCursors(pParse, pSel->pSrc); + tdsqlite3SrcListAssignCursors(pParse, pSel->pSrc); pTable->nCol = -1; DisableLookaside; #ifndef SQLITE_OMIT_AUTHORIZATION xAuth = db->xAuth; db->xAuth = 0; - pSelTab = sqlite3ResultSetOfSelect(pParse, pSel, SQLITE_AFF_NONE); + pSelTab = tdsqlite3ResultSetOfSelect(pParse, pSel, SQLITE_AFF_NONE); db->xAuth = xAuth; #else - pSelTab = sqlite3ResultSetOfSelect(pParse, pSel, SQLITE_AFF_NONE); + pSelTab = tdsqlite3ResultSetOfSelect(pParse, pSel, SQLITE_AFF_NONE); #endif pParse->nTab = n; if( pSelTab==0 ){ @@ -116200,13 +116200,13 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ ** normally holds CHECK constraints on an ordinary table, but for ** a VIEW it holds the list of column names. */ - sqlite3ColumnsFromExprList(pParse, pTable->pCheck, + tdsqlite3ColumnsFromExprList(pParse, pTable->pCheck, &pTable->nCol, &pTable->aCol); if( db->mallocFailed==0 && pParse->nErr==0 && pTable->nCol==pSel->pEList->nExpr ){ - sqlite3SelectAddColumnTypeAndCollation(pParse, pTable, pSel, + tdsqlite3SelectAddColumnTypeAndCollation(pParse, pTable, pSel, SQLITE_AFF_NONE); } }else{ @@ -116218,11 +116218,11 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ pTable->aCol = pSelTab->aCol; pSelTab->nCol = 0; pSelTab->aCol = 0; - assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) ); + assert( tdsqlite3SchemaMutexHeld(db, 0, pTable->pSchema) ); } pTable->nNVCol = pTable->nCol; - sqlite3DeleteTable(db, pSelTab); - sqlite3SelectDelete(db, pSel); + tdsqlite3DeleteTable(db, pSelTab); + tdsqlite3SelectDelete(db, pSel); EnableLookaside; #ifndef SQLITE_OMIT_ALTERTABLE pParse->eParseMode = eParseMode; @@ -116232,7 +116232,7 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ } pTable->pSchema->schemaFlags |= DB_UnresetViews; if( db->mallocFailed ){ - sqlite3DeleteColumnNames(db, pTable); + tdsqlite3DeleteColumnNames(db, pTable); pTable->aCol = 0; pTable->nCol = 0; } @@ -116245,14 +116245,14 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ /* ** Clear the column names from every VIEW in database idx. */ -static void sqliteViewResetAll(sqlite3 *db, int idx){ +static void sqliteViewResetAll(tdsqlite3 *db, int idx){ HashElem *i; - assert( sqlite3SchemaMutexHeld(db, idx, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, idx, 0) ); if( !DbHasProperty(db, idx, DB_UnresetViews) ) return; for(i=sqliteHashFirst(&db->aDb[idx].pSchema->tblHash); i;i=sqliteHashNext(i)){ Table *pTab = sqliteHashData(i); if( pTab->pSelect ){ - sqlite3DeleteColumnNames(db, pTab); + tdsqlite3DeleteColumnNames(db, pTab); pTab->aCol = 0; pTab->nCol = 0; } @@ -116281,12 +116281,12 @@ static void sqliteViewResetAll(sqlite3 *db, int idx){ ** in order to be certain that we got the right one. */ #ifndef SQLITE_OMIT_AUTOVACUUM -SQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3 *db, int iDb, int iFrom, int iTo){ +SQLITE_PRIVATE void tdsqlite3RootPageMoved(tdsqlite3 *db, int iDb, int iFrom, int iTo){ HashElem *pElem; Hash *pHash; Db *pDb; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); pDb = &db->aDb[iDb]; pHash = &pDb->pSchema->tblHash; for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){ @@ -116312,11 +116312,11 @@ SQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3 *db, int iDb, int iFrom, int iT ** erasing iTable (this can happen with an auto-vacuum database). */ static void destroyRootPage(Parse *pParse, int iTable, int iDb){ - Vdbe *v = sqlite3GetVdbe(pParse); - int r1 = sqlite3GetTempReg(pParse); - if( iTable<2 ) sqlite3ErrorMsg(pParse, "corrupt schema"); - sqlite3VdbeAddOp3(v, OP_Destroy, iTable, r1, iDb); - sqlite3MayAbort(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); + int r1 = tdsqlite3GetTempReg(pParse); + if( iTable<2 ) tdsqlite3ErrorMsg(pParse, "corrupt schema"); + tdsqlite3VdbeAddOp3(v, OP_Destroy, iTable, r1, iDb); + tdsqlite3MayAbort(pParse); #ifndef SQLITE_OMIT_AUTOVACUUM /* OP_Destroy stores an in integer r1. If this integer ** is non-zero, then it is the root page number of a table moved to @@ -116327,11 +116327,11 @@ static void destroyRootPage(Parse *pParse, int iTable, int iDb){ ** is in register NNN. See grammar rules associated with the TK_REGISTER ** token for additional information. */ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "UPDATE %Q.%s SET rootpage=%d WHERE #%d AND rootpage=#%d", pParse->db->aDb[iDb].zDbSName, MASTER_NAME, iTable, r1, r1); #endif - sqlite3ReleaseTempReg(pParse, r1); + tdsqlite3ReleaseTempReg(pParse, r1); } /* @@ -116377,7 +116377,7 @@ static void destroyTable(Parse *pParse, Table *pTab){ if( iLargest==0 ){ return; }else{ - int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); + int iDb = tdsqlite3SchemaToIndex(pParse->db, pTab->pSchema); assert( iDb>=0 && iDbdb->nDb ); destroyRootPage(pParse, iLargest, iDb); iDestroyed = iLargest; @@ -116389,7 +116389,7 @@ static void destroyTable(Parse *pParse, Table *pTab){ ** Remove entries from the sqlite_statN tables (for N in (1,2,3)) ** after a DROP INDEX or DROP TABLE command. */ -static void sqlite3ClearStatTables( +static void tdsqlite3ClearStatTables( Parse *pParse, /* The parsing context */ int iDb, /* The database number */ const char *zType, /* "idx" or "tbl" */ @@ -116399,9 +116399,9 @@ static void sqlite3ClearStatTables( const char *zDbName = pParse->db->aDb[iDb].zDbSName; for(i=1; i<=4; i++){ char zTab[24]; - sqlite3_snprintf(sizeof(zTab),zTab,"sqlite_stat%d",i); - if( sqlite3FindTable(pParse->db, zTab, zDbName) ){ - sqlite3NestedParse(pParse, + tdsqlite3_snprintf(sizeof(zTab),zTab,"sqlite_stat%d",i); + if( tdsqlite3FindTable(pParse->db, zTab, zDbName) ){ + tdsqlite3NestedParse(pParse, "DELETE FROM %Q.%s WHERE %s=%Q", zDbName, zTab, zType, zName ); @@ -116412,19 +116412,19 @@ static void sqlite3ClearStatTables( /* ** Generate code to drop a table. */ -SQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, int isView){ +SQLITE_PRIVATE void tdsqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, int isView){ Vdbe *v; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Trigger *pTrigger; Db *pDb = &db->aDb[iDb]; - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); assert( v!=0 ); - sqlite3BeginWriteOperation(pParse, 1, iDb); + tdsqlite3BeginWriteOperation(pParse, 1, iDb); #ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pTab) ){ - sqlite3VdbeAddOp0(v, OP_VBegin); + tdsqlite3VdbeAddOp0(v, OP_VBegin); } #endif @@ -116432,11 +116432,11 @@ SQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, in ** is generated to remove entries from sqlite_master and/or ** sqlite_temp_master if required. */ - pTrigger = sqlite3TriggerList(pParse, pTab); + pTrigger = tdsqlite3TriggerList(pParse, pTab); while( pTrigger ){ assert( pTrigger->pSchema==pTab->pSchema || pTrigger->pSchema==db->aDb[1].pSchema ); - sqlite3DropTriggerPtr(pParse, pTrigger); + tdsqlite3DropTriggerPtr(pParse, pTrigger); pTrigger = pTrigger->pNext; } @@ -116447,7 +116447,7 @@ SQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, in ** move as a result of the drop (can happen in auto-vacuum mode). */ if( pTab->tabFlags & TF_Autoincrement ){ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "DELETE FROM %Q.sqlite_sequence WHERE name=%Q", pDb->zDbSName, pTab->zName ); @@ -116461,7 +116461,7 @@ SQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, in ** created in the temp database that refers to a table in another ** database. */ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "DELETE FROM %Q.%s WHERE tbl_name=%Q and type!='trigger'", pDb->zDbSName, MASTER_NAME, pTab->zName); if( !isView && !IsVirtual(pTab) ){ @@ -116472,11 +116472,11 @@ SQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, in ** the schema cookie. */ if( IsVirtual(pTab) ){ - sqlite3VdbeAddOp4(v, OP_VDestroy, iDb, 0, 0, pTab->zName, 0); - sqlite3MayAbort(pParse); + tdsqlite3VdbeAddOp4(v, OP_VDestroy, iDb, 0, 0, pTab->zName, 0); + tdsqlite3MayAbort(pParse); } - sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0); - sqlite3ChangeCookie(pParse, iDb); + tdsqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0); + tdsqlite3ChangeCookie(pParse, iDb); sqliteViewResetAll(db, iDb); } @@ -116484,7 +116484,7 @@ SQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, in ** Return TRUE if shadow tables should be read-only in the current ** context. */ -SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db){ +SQLITE_PRIVATE int tdsqlite3ReadOnlyShadowTables(tdsqlite3 *db){ #ifndef SQLITE_OMIT_VIRTUALTABLE if( (db->flags & SQLITE_Defensive)!=0 && db->pVtabCtx==0 @@ -116499,13 +116499,13 @@ SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db){ /* ** Return true if it is not allowed to drop the given table */ -static int tableMayNotBeDropped(sqlite3 *db, Table *pTab){ - if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){ - if( sqlite3StrNICmp(pTab->zName+7, "stat", 4)==0 ) return 0; - if( sqlite3StrNICmp(pTab->zName+7, "parameters", 10)==0 ) return 0; +static int tableMayNotBeDropped(tdsqlite3 *db, Table *pTab){ + if( tdsqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){ + if( tdsqlite3StrNICmp(pTab->zName+7, "stat", 4)==0 ) return 0; + if( tdsqlite3StrNICmp(pTab->zName+7, "parameters", 10)==0 ) return 0; return 1; } - if( (pTab->tabFlags & TF_Shadow)!=0 && sqlite3ReadOnlyShadowTables(db) ){ + if( (pTab->tabFlags & TF_Shadow)!=0 && tdsqlite3ReadOnlyShadowTables(db) ){ return 1; } return 0; @@ -116515,10 +116515,10 @@ static int tableMayNotBeDropped(sqlite3 *db, Table *pTab){ ** This routine is called to do the work of a DROP TABLE statement. ** pName is the name of the table to be dropped. */ -SQLITE_PRIVATE void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){ +SQLITE_PRIVATE void tdsqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){ Table *pTab; Vdbe *v; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; int iDb; if( db->mallocFailed ){ @@ -116526,23 +116526,23 @@ SQLITE_PRIVATE void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, } assert( pParse->nErr==0 ); assert( pName->nSrc==1 ); - if( sqlite3ReadSchema(pParse) ) goto exit_drop_table; + if( tdsqlite3ReadSchema(pParse) ) goto exit_drop_table; if( noErr ) db->suppressErr++; assert( isView==0 || isView==LOCATE_VIEW ); - pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]); + pTab = tdsqlite3LocateTableItem(pParse, isView, &pName->a[0]); if( noErr ) db->suppressErr--; if( pTab==0 ){ - if( noErr ) sqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase); + if( noErr ) tdsqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase); goto exit_drop_table; } - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); + iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); assert( iDb>=0 && iDbnDb ); /* If pTab is a virtual table, call ViewGetColumnNames() to ensure ** it is initialized. */ - if( IsVirtual(pTab) && sqlite3ViewGetColumnNames(pParse, pTab) ){ + if( IsVirtual(pTab) && tdsqlite3ViewGetColumnNames(pParse, pTab) ){ goto exit_drop_table; } #ifndef SQLITE_OMIT_AUTHORIZATION @@ -116551,7 +116551,7 @@ SQLITE_PRIVATE void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, const char *zTab = SCHEMA_TABLE(iDb); const char *zDb = db->aDb[iDb].zDbSName; const char *zArg2 = 0; - if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb)){ + if( tdsqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb)){ goto exit_drop_table; } if( isView ){ @@ -116563,7 +116563,7 @@ SQLITE_PRIVATE void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, #ifndef SQLITE_OMIT_VIRTUALTABLE }else if( IsVirtual(pTab) ){ code = SQLITE_DROP_VTABLE; - zArg2 = sqlite3GetVTable(db, pTab)->pMod->zName; + zArg2 = tdsqlite3GetVTable(db, pTab)->pMod->zName; #endif }else{ if( !OMIT_TEMPDB && iDb==1 ){ @@ -116572,16 +116572,16 @@ SQLITE_PRIVATE void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, code = SQLITE_DROP_TABLE; } } - if( sqlite3AuthCheck(pParse, code, pTab->zName, zArg2, zDb) ){ + if( tdsqlite3AuthCheck(pParse, code, pTab->zName, zArg2, zDb) ){ goto exit_drop_table; } - if( sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){ + if( tdsqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){ goto exit_drop_table; } } #endif if( tableMayNotBeDropped(db, pTab) ){ - sqlite3ErrorMsg(pParse, "table %s may not be dropped", pTab->zName); + tdsqlite3ErrorMsg(pParse, "table %s may not be dropped", pTab->zName); goto exit_drop_table; } @@ -116590,11 +116590,11 @@ SQLITE_PRIVATE void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, ** on a table. */ if( isView && pTab->pSelect==0 ){ - sqlite3ErrorMsg(pParse, "use DROP TABLE to delete table %s", pTab->zName); + tdsqlite3ErrorMsg(pParse, "use DROP TABLE to delete table %s", pTab->zName); goto exit_drop_table; } if( !isView && pTab->pSelect ){ - sqlite3ErrorMsg(pParse, "use DROP VIEW to delete view %s", pTab->zName); + tdsqlite3ErrorMsg(pParse, "use DROP VIEW to delete view %s", pTab->zName); goto exit_drop_table; } #endif @@ -116602,18 +116602,18 @@ SQLITE_PRIVATE void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, /* Generate code to remove the table from the master table ** on disk. */ - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( v ){ - sqlite3BeginWriteOperation(pParse, 1, iDb); + tdsqlite3BeginWriteOperation(pParse, 1, iDb); if( !isView ){ - sqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName); - sqlite3FkDropTable(pParse, pName, pTab); + tdsqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName); + tdsqlite3FkDropTable(pParse, pName, pTab); } - sqlite3CodeDropTable(pParse, pTab, iDb, isView); + tdsqlite3CodeDropTable(pParse, pTab, iDb, isView); } exit_drop_table: - sqlite3SrcListDelete(db, pName); + tdsqlite3SrcListDelete(db, pName); } /* @@ -116630,16 +116630,16 @@ exit_drop_table: ** under construction in the pParse->pNewTable field. ** ** The foreign key is set for IMMEDIATE processing. A subsequent call -** to sqlite3DeferForeignKey() might change this to DEFERRED. +** to tdsqlite3DeferForeignKey() might change this to DEFERRED. */ -SQLITE_PRIVATE void sqlite3CreateForeignKey( +SQLITE_PRIVATE void tdsqlite3CreateForeignKey( Parse *pParse, /* Parsing context */ ExprList *pFromCol, /* Columns in this table that point to other table */ Token *pTo, /* Name of the other table */ ExprList *pToCol, /* Columns in the other table */ int flags /* Conflict resolution algorithms. */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; #ifndef SQLITE_OMIT_FOREIGN_KEY FKey *pFKey = 0; FKey *pNextTo; @@ -116655,14 +116655,14 @@ SQLITE_PRIVATE void sqlite3CreateForeignKey( int iCol = p->nCol-1; if( NEVER(iCol<0) ) goto fk_end; if( pToCol && pToCol->nExpr!=1 ){ - sqlite3ErrorMsg(pParse, "foreign key on %s" + tdsqlite3ErrorMsg(pParse, "foreign key on %s" " should reference only one column of table %T", p->aCol[iCol].zName, pTo); goto fk_end; } nCol = 1; }else if( pToCol && pToCol->nExpr!=pFromCol->nExpr ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "number of columns in foreign key does not match the number of " "columns in the referenced table"); goto fk_end; @@ -116672,10 +116672,10 @@ SQLITE_PRIVATE void sqlite3CreateForeignKey( nByte = sizeof(*pFKey) + (nCol-1)*sizeof(pFKey->aCol[0]) + pTo->n + 1; if( pToCol ){ for(i=0; inExpr; i++){ - nByte += sqlite3Strlen30(pToCol->a[i].zEName) + 1; + nByte += tdsqlite3Strlen30(pToCol->a[i].zEName) + 1; } } - pFKey = sqlite3DbMallocZero(db, nByte ); + pFKey = tdsqlite3DbMallocZero(db, nByte ); if( pFKey==0 ){ goto fk_end; } @@ -116684,11 +116684,11 @@ SQLITE_PRIVATE void sqlite3CreateForeignKey( z = (char*)&pFKey->aCol[nCol]; pFKey->zTo = z; if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenMap(pParse, (void*)z, pTo); + tdsqlite3RenameTokenMap(pParse, (void*)z, pTo); } memcpy(z, pTo->z, pTo->n); z[pTo->n] = 0; - sqlite3Dequote(z); + tdsqlite3Dequote(z); z += pTo->n+1; pFKey->nCol = nCol; if( pFromCol==0 ){ @@ -116697,28 +116697,28 @@ SQLITE_PRIVATE void sqlite3CreateForeignKey( for(i=0; inCol; j++){ - if( sqlite3StrICmp(p->aCol[j].zName, pFromCol->a[i].zEName)==0 ){ + if( tdsqlite3StrICmp(p->aCol[j].zName, pFromCol->a[i].zEName)==0 ){ pFKey->aCol[i].iFrom = j; break; } } if( j>=p->nCol ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "unknown column \"%s\" in foreign key definition", pFromCol->a[i].zEName); goto fk_end; } if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenRemap(pParse, &pFKey->aCol[i], pFromCol->a[i].zEName); + tdsqlite3RenameTokenRemap(pParse, &pFKey->aCol[i], pFromCol->a[i].zEName); } } } if( pToCol ){ for(i=0; ia[i].zEName); + int n = tdsqlite3Strlen30(pToCol->a[i].zEName); pFKey->aCol[i].zCol = z; if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenRemap(pParse, z, pToCol->a[i].zEName); + tdsqlite3RenameTokenRemap(pParse, z, pToCol->a[i].zEName); } memcpy(z, pToCol->a[i].zEName, n); z[n] = 0; @@ -116729,12 +116729,12 @@ SQLITE_PRIVATE void sqlite3CreateForeignKey( pFKey->aAction[0] = (u8)(flags & 0xff); /* ON DELETE action */ pFKey->aAction[1] = (u8)((flags >> 8 ) & 0xff); /* ON UPDATE action */ - assert( sqlite3SchemaMutexHeld(db, 0, p->pSchema) ); - pNextTo = (FKey *)sqlite3HashInsert(&p->pSchema->fkeyHash, + assert( tdsqlite3SchemaMutexHeld(db, 0, p->pSchema) ); + pNextTo = (FKey *)tdsqlite3HashInsert(&p->pSchema->fkeyHash, pFKey->zTo, (void *)pFKey ); if( pNextTo==pFKey ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); goto fk_end; } if( pNextTo ){ @@ -116749,10 +116749,10 @@ SQLITE_PRIVATE void sqlite3CreateForeignKey( pFKey = 0; fk_end: - sqlite3DbFree(db, pFKey); + tdsqlite3DbFree(db, pFKey); #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */ - sqlite3ExprListDelete(db, pFromCol); - sqlite3ExprListDelete(db, pToCol); + tdsqlite3ExprListDelete(db, pFromCol); + tdsqlite3ExprListDelete(db, pToCol); } /* @@ -116762,7 +116762,7 @@ fk_end: ** The behavior of the most recently created foreign key is adjusted ** accordingly. */ -SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse *pParse, int isDeferred){ +SQLITE_PRIVATE void tdsqlite3DeferForeignKey(Parse *pParse, int isDeferred){ #ifndef SQLITE_OMIT_FOREIGN_KEY Table *pTab; FKey *pFKey; @@ -116783,7 +116783,7 @@ SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse *pParse, int isDeferred){ ** the index already exists and must be cleared before being refilled and ** the root page number of the index is taken from pIndex->tnum. */ -static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){ +static void tdsqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){ Table *pTab = pIndex->pTable; /* The table that is indexed */ int iTab = pParse->nTab++; /* Btree cursor used for pTab */ int iIdx = pParse->nTab++; /* Btree cursor used for pIndex */ @@ -116795,60 +116795,60 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){ Vdbe *v; /* Generate code into this virtual machine */ KeyInfo *pKey; /* KeyInfo for index */ int regRecord; /* Register holding assembled index record */ - sqlite3 *db = pParse->db; /* The database connection */ - int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema); + tdsqlite3 *db = pParse->db; /* The database connection */ + int iDb = tdsqlite3SchemaToIndex(db, pIndex->pSchema); #ifndef SQLITE_OMIT_AUTHORIZATION - if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0, + if( tdsqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0, db->aDb[iDb].zDbSName ) ){ return; } #endif /* Require a write-lock on the table to perform this operation */ - sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName); + tdsqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName); - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( v==0 ) return; if( memRootPage>=0 ){ tnum = memRootPage; }else{ tnum = pIndex->tnum; } - pKey = sqlite3KeyInfoOfIndex(pParse, pIndex); + pKey = tdsqlite3KeyInfoOfIndex(pParse, pIndex); assert( pKey!=0 || db->mallocFailed || pParse->nErr ); /* Open the sorter cursor if we are to use one. */ iSorter = pParse->nTab++; - sqlite3VdbeAddOp4(v, OP_SorterOpen, iSorter, 0, pIndex->nKeyCol, (char*) - sqlite3KeyInfoRef(pKey), P4_KEYINFO); + tdsqlite3VdbeAddOp4(v, OP_SorterOpen, iSorter, 0, pIndex->nKeyCol, (char*) + tdsqlite3KeyInfoRef(pKey), P4_KEYINFO); /* Open the table. Loop through all rows of the table, inserting index ** records into the sorter. */ - sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead); - addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iTab, 0); VdbeCoverage(v); - regRecord = sqlite3GetTempReg(pParse); - sqlite3MultiWrite(pParse); + tdsqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead); + addr1 = tdsqlite3VdbeAddOp2(v, OP_Rewind, iTab, 0); VdbeCoverage(v); + regRecord = tdsqlite3GetTempReg(pParse); + tdsqlite3MultiWrite(pParse); - sqlite3GenerateIndexKey(pParse,pIndex,iTab,regRecord,0,&iPartIdxLabel,0,0); - sqlite3VdbeAddOp2(v, OP_SorterInsert, iSorter, regRecord); - sqlite3ResolvePartIdxLabel(pParse, iPartIdxLabel); - sqlite3VdbeAddOp2(v, OP_Next, iTab, addr1+1); VdbeCoverage(v); - sqlite3VdbeJumpHere(v, addr1); - if( memRootPage<0 ) sqlite3VdbeAddOp2(v, OP_Clear, tnum, iDb); - sqlite3VdbeAddOp4(v, OP_OpenWrite, iIdx, tnum, iDb, + tdsqlite3GenerateIndexKey(pParse,pIndex,iTab,regRecord,0,&iPartIdxLabel,0,0); + tdsqlite3VdbeAddOp2(v, OP_SorterInsert, iSorter, regRecord); + tdsqlite3ResolvePartIdxLabel(pParse, iPartIdxLabel); + tdsqlite3VdbeAddOp2(v, OP_Next, iTab, addr1+1); VdbeCoverage(v); + tdsqlite3VdbeJumpHere(v, addr1); + if( memRootPage<0 ) tdsqlite3VdbeAddOp2(v, OP_Clear, tnum, iDb); + tdsqlite3VdbeAddOp4(v, OP_OpenWrite, iIdx, tnum, iDb, (char *)pKey, P4_KEYINFO); - sqlite3VdbeChangeP5(v, OPFLAG_BULKCSR|((memRootPage>=0)?OPFLAG_P2ISREG:0)); + tdsqlite3VdbeChangeP5(v, OPFLAG_BULKCSR|((memRootPage>=0)?OPFLAG_P2ISREG:0)); - addr1 = sqlite3VdbeAddOp2(v, OP_SorterSort, iSorter, 0); VdbeCoverage(v); + addr1 = tdsqlite3VdbeAddOp2(v, OP_SorterSort, iSorter, 0); VdbeCoverage(v); if( IsUniqueIndex(pIndex) ){ - int j2 = sqlite3VdbeGoto(v, 1); - addr2 = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeVerifyAbortable(v, OE_Abort); - sqlite3VdbeAddOp4Int(v, OP_SorterCompare, iSorter, j2, regRecord, + int j2 = tdsqlite3VdbeGoto(v, 1); + addr2 = tdsqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeVerifyAbortable(v, OE_Abort); + tdsqlite3VdbeAddOp4Int(v, OP_SorterCompare, iSorter, j2, regRecord, pIndex->nKeyCol); VdbeCoverage(v); - sqlite3UniqueConstraint(pParse, OE_Abort, pIndex); - sqlite3VdbeJumpHere(v, j2); + tdsqlite3UniqueConstraint(pParse, OE_Abort, pIndex); + tdsqlite3VdbeJumpHere(v, j2); }else{ /* Most CREATE INDEX and REINDEX statements that are not UNIQUE can not ** abort. The exception is if one of the indexed expressions contains a @@ -116856,11 +116856,11 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){ ** overhead of adding a statement journal to a CREATE INDEX statement is ** very small (since most of the pages written do not contain content that ** needs to be restored if the statement aborts), so we call - ** sqlite3MayAbort() for all CREATE INDEX statements. */ - sqlite3MayAbort(pParse); - addr2 = sqlite3VdbeCurrentAddr(v); + ** tdsqlite3MayAbort() for all CREATE INDEX statements. */ + tdsqlite3MayAbort(pParse); + addr2 = tdsqlite3VdbeCurrentAddr(v); } - sqlite3VdbeAddOp3(v, OP_SorterData, iSorter, regRecord, iIdx); + tdsqlite3VdbeAddOp3(v, OP_SorterData, iSorter, regRecord, iIdx); if( !pIndex->bAscKeyBug ){ /* This OP_SeekEnd opcode makes index insert for a REINDEX go much ** faster by avoiding unnecessary seeks. But the optimization does @@ -116869,17 +116869,17 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){ ** a different order from the main table. ** See ticket: https://www.sqlite.org/src/info/bba7b69f9849b5bf */ - sqlite3VdbeAddOp1(v, OP_SeekEnd, iIdx); + tdsqlite3VdbeAddOp1(v, OP_SeekEnd, iIdx); } - sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, regRecord); - sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); - sqlite3ReleaseTempReg(pParse, regRecord); - sqlite3VdbeAddOp2(v, OP_SorterNext, iSorter, addr2); VdbeCoverage(v); - sqlite3VdbeJumpHere(v, addr1); + tdsqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, regRecord); + tdsqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); + tdsqlite3ReleaseTempReg(pParse, regRecord); + tdsqlite3VdbeAddOp2(v, OP_SorterNext, iSorter, addr2); VdbeCoverage(v); + tdsqlite3VdbeJumpHere(v, addr1); - sqlite3VdbeAddOp1(v, OP_Close, iTab); - sqlite3VdbeAddOp1(v, OP_Close, iIdx); - sqlite3VdbeAddOp1(v, OP_Close, iSorter); + tdsqlite3VdbeAddOp1(v, OP_Close, iTab); + tdsqlite3VdbeAddOp1(v, OP_Close, iIdx); + tdsqlite3VdbeAddOp1(v, OP_Close, iSorter); } /* @@ -116889,8 +116889,8 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){ ** of 8-byte aligned space after the Index object and return a ** pointer to this extra space in *ppExtra. */ -SQLITE_PRIVATE Index *sqlite3AllocateIndexObject( - sqlite3 *db, /* Database connection */ +SQLITE_PRIVATE Index *tdsqlite3AllocateIndexObject( + tdsqlite3 *db, /* Database connection */ i16 nCol, /* Total number of columns in the index */ int nExtra, /* Number of bytes of extra space to alloc */ char **ppExtra /* Pointer to the "extra" space */ @@ -116903,7 +116903,7 @@ SQLITE_PRIVATE Index *sqlite3AllocateIndexObject( ROUND8(sizeof(LogEst)*(nCol+1) + /* Index.aiRowLogEst */ sizeof(i16)*nCol + /* Index.aiColumn */ sizeof(u8)*nCol); /* Index.aSortOrder */ - p = sqlite3DbMallocZero(db, nByte + nExtra); + p = tdsqlite3DbMallocZero(db, nByte + nExtra); if( p ){ char *pExtra = ((char*)p)+ROUND8(sizeof(Index)); p->azColl = (const char**)pExtra; pExtra += ROUND8(sizeof(char*)*nCol); @@ -116922,13 +116922,13 @@ SQLITE_PRIVATE Index *sqlite3AllocateIndexObject( ** an explicit "NULLS FIRST" or "NULLS LAST" clause, leave an error in ** pParse and return non-zero. Otherwise, return zero. */ -SQLITE_PRIVATE int sqlite3HasExplicitNulls(Parse *pParse, ExprList *pList){ +SQLITE_PRIVATE int tdsqlite3HasExplicitNulls(Parse *pParse, ExprList *pList){ if( pList ){ int i; for(i=0; inExpr; i++){ if( pList->a[i].bNulls ){ u8 sf = pList->a[i].sortFlags; - sqlite3ErrorMsg(pParse, "unsupported use of NULLS %s", + tdsqlite3ErrorMsg(pParse, "unsupported use of NULLS %s", (sf==0 || sf==3) ? "FIRST" : "LAST" ); return 1; @@ -116950,7 +116950,7 @@ SQLITE_PRIVATE int sqlite3HasExplicitNulls(Parse *pParse, ExprList *pList){ ** is a primary key or unique-constraint on the most recent column added ** to the table currently under construction. */ -SQLITE_PRIVATE void sqlite3CreateIndex( +SQLITE_PRIVATE void tdsqlite3CreateIndex( Parse *pParse, /* All information about this parse */ Token *pName1, /* First part of index name. May be NULL */ Token *pName2, /* Second part of index name. May be NULL */ @@ -116970,7 +116970,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex( int i, j; DbFixer sFix; /* For assigning database names to pTable */ int sortOrderMask; /* 1 to honor DESC in index. 0 to ignore. */ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Db *pDb; /* The specific table containing the indexed database */ int iDb; /* Index of the database that is being written */ Token *pName = 0; /* Unqualified name of the index to create */ @@ -116986,10 +116986,10 @@ SQLITE_PRIVATE void sqlite3CreateIndex( if( IN_DECLARE_VTAB && idxType!=SQLITE_IDXTYPE_PRIMARYKEY ){ goto exit_create_index; } - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ + if( SQLITE_OK!=tdsqlite3ReadSchema(pParse) ){ goto exit_create_index; } - if( sqlite3HasExplicitNulls(pParse, pList) ){ + if( tdsqlite3HasExplicitNulls(pParse, pList) ){ goto exit_create_index; } @@ -117003,7 +117003,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex( ** before looking up the table. */ assert( pName1 && pName2 ); - iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName); + iDb = tdsqlite3TwoPartName(pParse, pName1, pName2, &pName); if( iDb<0 ) goto exit_create_index; assert( pName && pName->z ); @@ -117013,62 +117013,62 @@ SQLITE_PRIVATE void sqlite3CreateIndex( ** if initialising a database schema. */ if( !db->init.busy ){ - pTab = sqlite3SrcListLookup(pParse, pTblName); + pTab = tdsqlite3SrcListLookup(pParse, pTblName); if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){ iDb = 1; } } #endif - sqlite3FixInit(&sFix, pParse, iDb, "index", pName); - if( sqlite3FixSrcList(&sFix, pTblName) ){ + tdsqlite3FixInit(&sFix, pParse, iDb, "index", pName); + if( tdsqlite3FixSrcList(&sFix, pTblName) ){ /* Because the parser constructs pTblName from a single identifier, - ** sqlite3FixSrcList can never fail. */ + ** tdsqlite3FixSrcList can never fail. */ assert(0); } - pTab = sqlite3LocateTableItem(pParse, 0, &pTblName->a[0]); + pTab = tdsqlite3LocateTableItem(pParse, 0, &pTblName->a[0]); assert( db->mallocFailed==0 || pTab==0 ); if( pTab==0 ) goto exit_create_index; if( iDb==1 && db->aDb[iDb].pSchema!=pTab->pSchema ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "cannot create a TEMP index on non-TEMP table \"%s\"", pTab->zName); goto exit_create_index; } - if( !HasRowid(pTab) ) pPk = sqlite3PrimaryKeyIndex(pTab); + if( !HasRowid(pTab) ) pPk = tdsqlite3PrimaryKeyIndex(pTab); }else{ assert( pName==0 ); assert( pStart==0 ); pTab = pParse->pNewTable; if( !pTab ) goto exit_create_index; - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); + iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); } pDb = &db->aDb[iDb]; assert( pTab!=0 ); assert( pParse->nErr==0 ); - if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 + if( tdsqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 && db->init.busy==0 && pTblName!=0 #if SQLITE_USER_AUTHENTICATION - && sqlite3UserAuthTable(pTab->zName)==0 + && tdsqlite3UserAuthTable(pTab->zName)==0 #endif #ifdef SQLITE_ALLOW_SQLITE_MASTER_INDEX - && sqlite3StrICmp(&pTab->zName[7],"master")!=0 + && tdsqlite3StrICmp(&pTab->zName[7],"master")!=0 #endif ){ - sqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName); + tdsqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName); goto exit_create_index; } #ifndef SQLITE_OMIT_VIEW if( pTab->pSelect ){ - sqlite3ErrorMsg(pParse, "views may not be indexed"); + tdsqlite3ErrorMsg(pParse, "views may not be indexed"); goto exit_create_index; } #endif #ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pTab) ){ - sqlite3ErrorMsg(pParse, "virtual tables may not be indexed"); + tdsqlite3ErrorMsg(pParse, "virtual tables may not be indexed"); goto exit_create_index; } #endif @@ -117087,25 +117087,25 @@ SQLITE_PRIVATE void sqlite3CreateIndex( ** own name. */ if( pName ){ - zName = sqlite3NameFromToken(db, pName); + zName = tdsqlite3NameFromToken(db, pName); if( zName==0 ) goto exit_create_index; assert( pName->z!=0 ); - if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName,"index",pTab->zName) ){ + if( SQLITE_OK!=tdsqlite3CheckObjectName(pParse, zName,"index",pTab->zName) ){ goto exit_create_index; } if( !IN_RENAME_OBJECT ){ if( !db->init.busy ){ - if( sqlite3FindTable(db, zName, 0)!=0 ){ - sqlite3ErrorMsg(pParse, "there is already a table named %s", zName); + if( tdsqlite3FindTable(db, zName, 0)!=0 ){ + tdsqlite3ErrorMsg(pParse, "there is already a table named %s", zName); goto exit_create_index; } } - if( sqlite3FindIndex(db, zName, pDb->zDbSName)!=0 ){ + if( tdsqlite3FindIndex(db, zName, pDb->zDbSName)!=0 ){ if( !ifNotExist ){ - sqlite3ErrorMsg(pParse, "index %s already exists", zName); + tdsqlite3ErrorMsg(pParse, "index %s already exists", zName); }else{ assert( !db->init.busy ); - sqlite3CodeVerifySchema(pParse, iDb); + tdsqlite3CodeVerifySchema(pParse, iDb); } goto exit_create_index; } @@ -117114,15 +117114,15 @@ SQLITE_PRIVATE void sqlite3CreateIndex( int n; Index *pLoop; for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){} - zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n); + zName = tdsqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n); if( zName==0 ){ goto exit_create_index; } - /* Automatic index names generated from within sqlite3_declare_vtab() + /* Automatic index names generated from within tdsqlite3_declare_vtab() ** must have names that are distinct from normal automatic index names. - ** The following statement converts "sqlite3_autoindex..." into - ** "sqlite3_butoindex..." in order to make the names distinct. + ** The following statement converts "tdsqlite3_autoindex..." into + ** "tdsqlite3_butoindex..." in order to make the names distinct. ** The "vtab_err.test" test demonstrates the need of this statement. */ if( IN_SPECIAL_PARSE ) zName[7]++; } @@ -117132,12 +117132,12 @@ SQLITE_PRIVATE void sqlite3CreateIndex( #ifndef SQLITE_OMIT_AUTHORIZATION if( !IN_RENAME_OBJECT ){ const char *zDb = pDb->zDbSName; - if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iDb), 0, zDb) ){ + if( tdsqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iDb), 0, zDb) ){ goto exit_create_index; } i = SQLITE_CREATE_INDEX; if( !OMIT_TEMPDB && iDb==1 ) i = SQLITE_CREATE_TEMP_INDEX; - if( sqlite3AuthCheck(pParse, i, zName, pTab->zName, zDb) ){ + if( tdsqlite3AuthCheck(pParse, i, zName, pTab->zName, zDb) ){ goto exit_create_index; } } @@ -117151,14 +117151,14 @@ SQLITE_PRIVATE void sqlite3CreateIndex( Token prevCol; Column *pCol = &pTab->aCol[pTab->nCol-1]; pCol->colFlags |= COLFLAG_UNIQUE; - sqlite3TokenInit(&prevCol, pCol->zName); - pList = sqlite3ExprListAppend(pParse, 0, - sqlite3ExprAlloc(db, TK_ID, &prevCol, 0)); + tdsqlite3TokenInit(&prevCol, pCol->zName); + pList = tdsqlite3ExprListAppend(pParse, 0, + tdsqlite3ExprAlloc(db, TK_ID, &prevCol, 0)); if( pList==0 ) goto exit_create_index; assert( pList->nExpr==1 ); - sqlite3ExprListSetSortOrder(pList, sortOrder, SQLITE_SO_UNDEFINED); + tdsqlite3ExprListSetSortOrder(pList, sortOrder, SQLITE_SO_UNDEFINED); }else{ - sqlite3ExprListCheckLength(pParse, pList, "index"); + tdsqlite3ExprListCheckLength(pParse, pList, "index"); if( pParse->nErr ) goto exit_create_index; } @@ -117169,17 +117169,17 @@ SQLITE_PRIVATE void sqlite3CreateIndex( Expr *pExpr = pList->a[i].pExpr; assert( pExpr!=0 ); if( pExpr->op==TK_COLLATE ){ - nExtra += (1 + sqlite3Strlen30(pExpr->u.zToken)); + nExtra += (1 + tdsqlite3Strlen30(pExpr->u.zToken)); } } /* ** Allocate the index structure. */ - nName = sqlite3Strlen30(zName); + nName = tdsqlite3Strlen30(zName); nExtraCol = pPk ? pPk->nKeyCol : 1; assert( pList->nExpr + nExtraCol <= 32767 /* Fits in i16 */ ); - pIndex = sqlite3AllocateIndexObject(db, pList->nExpr + nExtraCol, + pIndex = tdsqlite3AllocateIndexObject(db, pList->nExpr + nExtraCol, nName + nExtra + 1, &zExtra); if( db->mallocFailed ){ goto exit_create_index; @@ -117196,11 +117196,11 @@ SQLITE_PRIVATE void sqlite3CreateIndex( pIndex->pSchema = db->aDb[iDb].pSchema; pIndex->nKeyCol = pList->nExpr; if( pPIWhere ){ - sqlite3ResolveSelfReference(pParse, pTab, NC_PartIdx, pPIWhere, 0); + tdsqlite3ResolveSelfReference(pParse, pTab, NC_PartIdx, pPIWhere, 0); pIndex->pPartIdxWhere = pPIWhere; pPIWhere = 0; } - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); /* Check to see if we should honor DESC requests on index columns */ @@ -117229,13 +117229,13 @@ SQLITE_PRIVATE void sqlite3CreateIndex( int requestedSortOrder; /* ASC or DESC on the i-th expression */ const char *zColl; /* Collation sequence name */ - sqlite3StringToId(pListItem->pExpr); - sqlite3ResolveSelfReference(pParse, pTab, NC_IdxExpr, pListItem->pExpr, 0); + tdsqlite3StringToId(pListItem->pExpr); + tdsqlite3ResolveSelfReference(pParse, pTab, NC_IdxExpr, pListItem->pExpr, 0); if( pParse->nErr ) goto exit_create_index; - pCExpr = sqlite3ExprSkipCollate(pListItem->pExpr); + pCExpr = tdsqlite3ExprSkipCollate(pListItem->pExpr); if( pCExpr->op!=TK_COLUMN ){ if( pTab==pParse->pNewTable ){ - sqlite3ErrorMsg(pParse, "expressions prohibited in PRIMARY KEY and " + tdsqlite3ErrorMsg(pParse, "expressions prohibited in PRIMARY KEY and " "UNIQUE constraints"); goto exit_create_index; } @@ -117265,7 +117265,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex( if( pListItem->pExpr->op==TK_COLLATE ){ int nColl; zColl = pListItem->pExpr->u.zToken; - nColl = sqlite3Strlen30(zColl) + 1; + nColl = tdsqlite3Strlen30(zColl) + 1; assert( nExtra>=nColl ); memcpy(zExtra, zColl, nColl); zColl = zExtra; @@ -117274,8 +117274,8 @@ SQLITE_PRIVATE void sqlite3CreateIndex( }else if( j>=0 ){ zColl = pTab->aCol[j].zColl; } - if( !zColl ) zColl = sqlite3StrBINARY; - if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){ + if( !zColl ) zColl = tdsqlite3StrBINARY; + if( !db->init.busy && !tdsqlite3LocateCollSeq(pParse, zColl) ){ goto exit_create_index; } pIndex->azColl[i] = zColl; @@ -117304,21 +117304,21 @@ SQLITE_PRIVATE void sqlite3CreateIndex( assert( i==pIndex->nColumn ); }else{ pIndex->aiColumn[i] = XN_ROWID; - pIndex->azColl[i] = sqlite3StrBINARY; + pIndex->azColl[i] = tdsqlite3StrBINARY; } - sqlite3DefaultRowEst(pIndex); + tdsqlite3DefaultRowEst(pIndex); if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex); /* If this index contains every column of its table, then mark ** it as a covering index */ assert( HasRowid(pTab) - || pTab->iPKey<0 || sqlite3TableColumnToIndex(pIndex, pTab->iPKey)>=0 ); + || pTab->iPKey<0 || tdsqlite3TableColumnToIndex(pIndex, pTab->iPKey)>=0 ); recomputeColumnsNotIndexed(pIndex); if( pTblName!=0 && pIndex->nColumn>=pTab->nCol ){ pIndex->isCovering = 1; for(j=0; jnCol; j++){ if( j==pTab->iPKey ) continue; - if( sqlite3TableColumnToIndex(pIndex,j)>=0 ) continue; + if( tdsqlite3TableColumnToIndex(pIndex,j)>=0 ) continue; pIndex->isCovering = 0; break; } @@ -117361,7 +117361,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex( if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break; z1 = pIdx->azColl[k]; z2 = pIndex->azColl[k]; - if( sqlite3StrICmp(z1, z2) ) break; + if( tdsqlite3StrICmp(z1, z2) ) break; } if( k==pIdx->nKeyCol ){ if( pIdx->onError!=pIndex->onError ){ @@ -117373,7 +117373,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex( ** explicitly specified behavior for the index. */ if( !(pIdx->onError==OE_Default || pIndex->onError==OE_Default) ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "conflicting ON CONFLICT clauses specified", 0); } if( pIdx->onError==OE_Default ){ @@ -117400,20 +117400,20 @@ SQLITE_PRIVATE void sqlite3CreateIndex( if( db->init.busy ){ Index *p; assert( !IN_SPECIAL_PARSE ); - assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); + assert( tdsqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); if( pTblName!=0 ){ pIndex->tnum = db->init.newTnum; - if( sqlite3IndexHasDuplicateRootPage(pIndex) ){ - sqlite3ErrorMsg(pParse, "invalid rootpage"); + if( tdsqlite3IndexHasDuplicateRootPage(pIndex) ){ + tdsqlite3ErrorMsg(pParse, "invalid rootpage"); pParse->rc = SQLITE_CORRUPT_BKPT; goto exit_create_index; } } - p = sqlite3HashInsert(&pIndex->pSchema->idxHash, + p = tdsqlite3HashInsert(&pIndex->pSchema->idxHash, pIndex->zName, pIndex); if( p ){ assert( p==pIndex ); /* Malloc must have failed */ - sqlite3OomFault(db); + tdsqlite3OomFault(db); goto exit_create_index; } db->mDbFlags |= DBFLAG_SchemaChange; @@ -117437,10 +117437,10 @@ SQLITE_PRIVATE void sqlite3CreateIndex( char *zStmt; int iMem = ++pParse->nMem; - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( v==0 ) goto exit_create_index; - sqlite3BeginWriteOperation(pParse, 1, iDb); + tdsqlite3BeginWriteOperation(pParse, 1, iDb); /* Create the rootpage for the index using CreateIndex. But before ** doing so, code a Noop instruction and store its address in @@ -117448,8 +117448,8 @@ SQLITE_PRIVATE void sqlite3CreateIndex( ** PRIMARY KEY and the table is actually a WITHOUT ROWID table. In ** that case the convertToWithoutRowidTable() routine will replace ** the Noop with a Goto to jump over the VDBE code generated below. */ - pIndex->tnum = sqlite3VdbeAddOp0(v, OP_Noop); - sqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, iMem, BTREE_BLOBKEY); + pIndex->tnum = tdsqlite3VdbeAddOp0(v, OP_Noop); + tdsqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, iMem, BTREE_BLOBKEY); /* Gather the complete text of the CREATE INDEX statement into ** the zStmt variable @@ -117459,17 +117459,17 @@ SQLITE_PRIVATE void sqlite3CreateIndex( int n = (int)(pParse->sLastToken.z - pName->z) + pParse->sLastToken.n; if( pName->z[n-1]==';' ) n--; /* A named index with an explicit CREATE INDEX statement */ - zStmt = sqlite3MPrintf(db, "CREATE%s INDEX %.*s", + zStmt = tdsqlite3MPrintf(db, "CREATE%s INDEX %.*s", onError==OE_None ? "" : " UNIQUE", n, pName->z); }else{ /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ - /* zStmt = sqlite3MPrintf(""); */ + /* zStmt = tdsqlite3MPrintf(""); */ zStmt = 0; } /* Add an entry in sqlite_master for this index */ - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "INSERT INTO %Q.%s VALUES('index',%Q,%Q,#%d,%Q);", db->aDb[iDb].zDbSName, MASTER_NAME, pIndex->zName, @@ -117477,20 +117477,20 @@ SQLITE_PRIVATE void sqlite3CreateIndex( iMem, zStmt ); - sqlite3DbFree(db, zStmt); + tdsqlite3DbFree(db, zStmt); /* Fill the index with data and reparse the schema. Code an OP_Expire ** to invalidate all pre-compiled statements. */ if( pTblName ){ - sqlite3RefillIndex(pParse, pIndex, iMem); - sqlite3ChangeCookie(pParse, iDb); - sqlite3VdbeAddParseSchemaOp(v, iDb, - sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName)); - sqlite3VdbeAddOp2(v, OP_Expire, 0, 1); + tdsqlite3RefillIndex(pParse, pIndex, iMem); + tdsqlite3ChangeCookie(pParse, iDb); + tdsqlite3VdbeAddParseSchemaOp(v, iDb, + tdsqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName)); + tdsqlite3VdbeAddOp2(v, OP_Expire, 0, 1); } - sqlite3VdbeJumpHere(v, pIndex->tnum); + tdsqlite3VdbeJumpHere(v, pIndex->tnum); } } if( db->init.busy || pTblName==0 ){ @@ -117506,7 +117506,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex( /* Clean up before exiting */ exit_create_index: - if( pIndex ) sqlite3FreeIndex(db, pIndex); + if( pIndex ) tdsqlite3FreeIndex(db, pIndex); if( pTab ){ /* Ensure all REPLACE indexes are at the end of the list */ Index **ppFrom = &pTab->pIndex; Index *pThis; @@ -117522,10 +117522,10 @@ exit_create_index: break; } } - sqlite3ExprDelete(db, pPIWhere); - sqlite3ExprListDelete(db, pList); - sqlite3SrcListDelete(db, pTblName); - sqlite3DbFree(db, zName); + tdsqlite3ExprDelete(db, pPIWhere); + tdsqlite3ExprListDelete(db, pList); + tdsqlite3SrcListDelete(db, pTblName); + tdsqlite3DbFree(db, zName); } /* @@ -117546,7 +117546,7 @@ exit_create_index: ** how aiRowEst[] should be initialized. The numbers generated here ** are based on typical values found in actual indices. */ -SQLITE_PRIVATE void sqlite3DefaultRowEst(Index *pIdx){ +SQLITE_PRIVATE void tdsqlite3DefaultRowEst(Index *pIdx){ /* 10, 9, 8, 7, 6 */ LogEst aVal[] = { 33, 32, 30, 28, 26 }; LogEst *a = pIdx->aiRowLogEst; @@ -117560,17 +117560,17 @@ SQLITE_PRIVATE void sqlite3DefaultRowEst(Index *pIdx){ ** number of rows in the table, or half the number of rows in the table ** for a partial index. But do not let the estimate drop below 10. */ a[0] = pIdx->pTable->nRowLogEst; - if( pIdx->pPartIdxWhere!=0 ) a[0] -= 10; assert( 10==sqlite3LogEst(2) ); - if( a[0]<33 ) a[0] = 33; assert( 33==sqlite3LogEst(10) ); + if( pIdx->pPartIdxWhere!=0 ) a[0] -= 10; assert( 10==tdsqlite3LogEst(2) ); + if( a[0]<33 ) a[0] = 33; assert( 33==tdsqlite3LogEst(10) ); /* Estimate that a[1] is 10, a[2] is 9, a[3] is 8, a[4] is 7, a[5] is ** 6 and each subsequent value (if any) is 5. */ memcpy(&a[1], aVal, nCopy*sizeof(LogEst)); for(i=nCopy+1; i<=pIdx->nKeyCol; i++){ - a[i] = 23; assert( 23==sqlite3LogEst(5) ); + a[i] = 23; assert( 23==tdsqlite3LogEst(5) ); } - assert( 0==sqlite3LogEst(1) ); + assert( 0==tdsqlite3LogEst(1) ); if( IsUniqueIndex(pIdx) ) a[pIdx->nKeyCol] = 0; } @@ -117578,10 +117578,10 @@ SQLITE_PRIVATE void sqlite3DefaultRowEst(Index *pIdx){ ** This routine will drop an existing named index. This routine ** implements the DROP INDEX statement. */ -SQLITE_PRIVATE void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists){ +SQLITE_PRIVATE void tdsqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists){ Index *pIndex; Vdbe *v; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; int iDb; assert( pParse->nErr==0 ); /* Never called with prior errors */ @@ -117589,62 +117589,62 @@ SQLITE_PRIVATE void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists goto exit_drop_index; } assert( pName->nSrc==1 ); - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ + if( SQLITE_OK!=tdsqlite3ReadSchema(pParse) ){ goto exit_drop_index; } - pIndex = sqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase); + pIndex = tdsqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase); if( pIndex==0 ){ if( !ifExists ){ - sqlite3ErrorMsg(pParse, "no such index: %S", pName, 0); + tdsqlite3ErrorMsg(pParse, "no such index: %S", pName, 0); }else{ - sqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase); + tdsqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase); } pParse->checkSchema = 1; goto exit_drop_index; } if( pIndex->idxType!=SQLITE_IDXTYPE_APPDEF ){ - sqlite3ErrorMsg(pParse, "index associated with UNIQUE " + tdsqlite3ErrorMsg(pParse, "index associated with UNIQUE " "or PRIMARY KEY constraint cannot be dropped", 0); goto exit_drop_index; } - iDb = sqlite3SchemaToIndex(db, pIndex->pSchema); + iDb = tdsqlite3SchemaToIndex(db, pIndex->pSchema); #ifndef SQLITE_OMIT_AUTHORIZATION { int code = SQLITE_DROP_INDEX; Table *pTab = pIndex->pTable; const char *zDb = db->aDb[iDb].zDbSName; const char *zTab = SCHEMA_TABLE(iDb); - if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){ + if( tdsqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){ goto exit_drop_index; } if( !OMIT_TEMPDB && iDb ) code = SQLITE_DROP_TEMP_INDEX; - if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){ + if( tdsqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){ goto exit_drop_index; } } #endif /* Generate code to remove the index and from the master table */ - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( v ){ - sqlite3BeginWriteOperation(pParse, 1, iDb); - sqlite3NestedParse(pParse, + tdsqlite3BeginWriteOperation(pParse, 1, iDb); + tdsqlite3NestedParse(pParse, "DELETE FROM %Q.%s WHERE name=%Q AND type='index'", db->aDb[iDb].zDbSName, MASTER_NAME, pIndex->zName ); - sqlite3ClearStatTables(pParse, iDb, "idx", pIndex->zName); - sqlite3ChangeCookie(pParse, iDb); + tdsqlite3ClearStatTables(pParse, iDb, "idx", pIndex->zName); + tdsqlite3ChangeCookie(pParse, iDb); destroyRootPage(pParse, pIndex->tnum, iDb); - sqlite3VdbeAddOp4(v, OP_DropIndex, iDb, 0, 0, pIndex->zName, 0); + tdsqlite3VdbeAddOp4(v, OP_DropIndex, iDb, 0, 0, pIndex->zName, 0); } exit_drop_index: - sqlite3SrcListDelete(db, pName); + tdsqlite3SrcListDelete(db, pName); } /* ** pArray is a pointer to an array of objects. Each object in the -** array is szEntry bytes in size. This routine uses sqlite3DbRealloc() +** array is szEntry bytes in size. This routine uses tdsqlite3DbRealloc() ** to extend the array so that there is space for a new object at the end. ** ** When this function is called, *pnEntry contains the current size of @@ -117659,18 +117659,18 @@ exit_drop_index: ** Otherwise, if the realloc() fails, *pIdx is set to -1, *pnEntry remains ** unchanged and a copy of pArray returned. */ -SQLITE_PRIVATE void *sqlite3ArrayAllocate( - sqlite3 *db, /* Connection to notify of malloc failures */ +SQLITE_PRIVATE void *tdsqlite3ArrayAllocate( + tdsqlite3 *db, /* Connection to notify of malloc failures */ void *pArray, /* Array of objects. Might be reallocated */ int szEntry, /* Size of each object in the array */ int *pnEntry, /* Number of objects currently in use */ int *pIdx /* Write the index of a new slot here */ ){ char *z; - sqlite3_int64 n = *pIdx = *pnEntry; + tdsqlite3_int64 n = *pIdx = *pnEntry; if( (n & (n-1))==0 ){ - sqlite3_int64 sz = (n==0) ? 1 : 2*n; - void *pNew = sqlite3DbRealloc(db, pArray, sz*szEntry); + tdsqlite3_int64 sz = (n==0) ? 1 : 2*n; + void *pNew = tdsqlite3DbRealloc(db, pArray, sz*szEntry); if( pNew==0 ){ *pIdx = -1; return pArray; @@ -117689,14 +117689,14 @@ SQLITE_PRIVATE void *sqlite3ArrayAllocate( ** ** A new IdList is returned, or NULL if malloc() fails. */ -SQLITE_PRIVATE IdList *sqlite3IdListAppend(Parse *pParse, IdList *pList, Token *pToken){ - sqlite3 *db = pParse->db; +SQLITE_PRIVATE IdList *tdsqlite3IdListAppend(Parse *pParse, IdList *pList, Token *pToken){ + tdsqlite3 *db = pParse->db; int i; if( pList==0 ){ - pList = sqlite3DbMallocZero(db, sizeof(IdList) ); + pList = tdsqlite3DbMallocZero(db, sizeof(IdList) ); if( pList==0 ) return 0; } - pList->a = sqlite3ArrayAllocate( + pList->a = tdsqlite3ArrayAllocate( db, pList->a, sizeof(pList->a[0]), @@ -117704,12 +117704,12 @@ SQLITE_PRIVATE IdList *sqlite3IdListAppend(Parse *pParse, IdList *pList, Token * &i ); if( i<0 ){ - sqlite3IdListDelete(db, pList); + tdsqlite3IdListDelete(db, pList); return 0; } - pList->a[i].zName = sqlite3NameFromToken(db, pToken); + pList->a[i].zName = tdsqlite3NameFromToken(db, pToken); if( IN_RENAME_OBJECT && pList->a[i].zName ){ - sqlite3RenameTokenMap(pParse, (void*)pList->a[i].zName, pToken); + tdsqlite3RenameTokenMap(pParse, (void*)pList->a[i].zName, pToken); } return pList; } @@ -117717,25 +117717,25 @@ SQLITE_PRIVATE IdList *sqlite3IdListAppend(Parse *pParse, IdList *pList, Token * /* ** Delete an IdList. */ -SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3 *db, IdList *pList){ +SQLITE_PRIVATE void tdsqlite3IdListDelete(tdsqlite3 *db, IdList *pList){ int i; if( pList==0 ) return; for(i=0; inId; i++){ - sqlite3DbFree(db, pList->a[i].zName); + tdsqlite3DbFree(db, pList->a[i].zName); } - sqlite3DbFree(db, pList->a); - sqlite3DbFreeNN(db, pList); + tdsqlite3DbFree(db, pList->a); + tdsqlite3DbFreeNN(db, pList); } /* ** Return the index in pList of the identifier named zId. Return -1 ** if not found. */ -SQLITE_PRIVATE int sqlite3IdListIndex(IdList *pList, const char *zName){ +SQLITE_PRIVATE int tdsqlite3IdListIndex(IdList *pList, const char *zName){ int i; if( pList==0 ) return -1; for(i=0; inId; i++){ - if( sqlite3StrICmp(pList->a[i].zName, zName)==0 ) return i; + if( tdsqlite3StrICmp(pList->a[i].zName, zName)==0 ) return i; } return -1; } @@ -117760,7 +117760,7 @@ SQLITE_PRIVATE int sqlite3IdListIndex(IdList *pList, const char *zName){ ** For example, suppose a SrcList initially contains two entries: A,B. ** To append 3 new entries onto the end, do this: ** -** sqlite3SrcListEnlarge(db, pSrclist, 3, 2); +** tdsqlite3SrcListEnlarge(db, pSrclist, 3, 2); ** ** After the call above it would contain: A, B, nil, nil, nil. ** If the iStart argument had been 1 instead of 2, then the result @@ -117772,7 +117772,7 @@ SQLITE_PRIVATE int sqlite3IdListIndex(IdList *pList, const char *zName){ ** the original SrcList unchanged, return NULL, and leave an error message ** in pParse. */ -SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge( +SQLITE_PRIVATE SrcList *tdsqlite3SrcListEnlarge( Parse *pParse, /* Parsing context into which errors are reported */ SrcList *pSrc, /* The SrcList to be enlarged */ int nExtra, /* Number of new slots to add to pSrc->a[] */ @@ -117789,16 +117789,16 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge( /* Allocate additional space if needed */ if( (u32)pSrc->nSrc+nExtra>pSrc->nAlloc ){ SrcList *pNew; - sqlite3_int64 nAlloc = 2*(sqlite3_int64)pSrc->nSrc+nExtra; - sqlite3 *db = pParse->db; + tdsqlite3_int64 nAlloc = 2*(tdsqlite3_int64)pSrc->nSrc+nExtra; + tdsqlite3 *db = pParse->db; if( pSrc->nSrc+nExtra>=SQLITE_MAX_SRCLIST ){ - sqlite3ErrorMsg(pParse, "too many FROM clause terms, max: %d", + tdsqlite3ErrorMsg(pParse, "too many FROM clause terms, max: %d", SQLITE_MAX_SRCLIST); return 0; } if( nAlloc>SQLITE_MAX_SRCLIST ) nAlloc = SQLITE_MAX_SRCLIST; - pNew = sqlite3DbRealloc(db, pSrc, + pNew = tdsqlite3DbRealloc(db, pSrc, sizeof(*pSrc) + (nAlloc-1)*sizeof(pSrc->a[0]) ); if( pNew==0 ){ assert( db->mallocFailed ); @@ -117846,44 +117846,44 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge( ** ** In other words, if call like this: ** -** sqlite3SrcListAppend(D,A,B,0); +** tdsqlite3SrcListAppend(D,A,B,0); ** ** Then B is a table name and the database name is unspecified. If called ** like this: ** -** sqlite3SrcListAppend(D,A,B,C); +** tdsqlite3SrcListAppend(D,A,B,C); ** ** Then C is the table name and B is the database name. If C is defined ** then so is B. In other words, we never have a case where: ** -** sqlite3SrcListAppend(D,A,0,C); +** tdsqlite3SrcListAppend(D,A,0,C); ** ** Both pTable and pDatabase are assumed to be quoted. They are dequoted ** before being added to the SrcList. */ -SQLITE_PRIVATE SrcList *sqlite3SrcListAppend( +SQLITE_PRIVATE SrcList *tdsqlite3SrcListAppend( Parse *pParse, /* Parsing context, in which errors are reported */ SrcList *pList, /* Append to this SrcList. NULL creates a new SrcList */ Token *pTable, /* Table to append */ Token *pDatabase /* Database of the table */ ){ struct SrcList_item *pItem; - sqlite3 *db; + tdsqlite3 *db; assert( pDatabase==0 || pTable!=0 ); /* Cannot have C without B */ assert( pParse!=0 ); assert( pParse->db!=0 ); db = pParse->db; if( pList==0 ){ - pList = sqlite3DbMallocRawNN(pParse->db, sizeof(SrcList) ); + pList = tdsqlite3DbMallocRawNN(pParse->db, sizeof(SrcList) ); if( pList==0 ) return 0; pList->nAlloc = 1; pList->nSrc = 1; memset(&pList->a[0], 0, sizeof(pList->a[0])); pList->a[0].iCursor = -1; }else{ - SrcList *pNew = sqlite3SrcListEnlarge(pParse, pList, 1, pList->nSrc); + SrcList *pNew = tdsqlite3SrcListEnlarge(pParse, pList, 1, pList->nSrc); if( pNew==0 ){ - sqlite3SrcListDelete(db, pList); + tdsqlite3SrcListDelete(db, pList); return 0; }else{ pList = pNew; @@ -117894,10 +117894,10 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppend( pDatabase = 0; } if( pDatabase ){ - pItem->zName = sqlite3NameFromToken(db, pDatabase); - pItem->zDatabase = sqlite3NameFromToken(db, pTable); + pItem->zName = tdsqlite3NameFromToken(db, pDatabase); + pItem->zDatabase = tdsqlite3NameFromToken(db, pTable); }else{ - pItem->zName = sqlite3NameFromToken(db, pTable); + pItem->zName = tdsqlite3NameFromToken(db, pTable); pItem->zDatabase = 0; } return pList; @@ -117906,7 +117906,7 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppend( /* ** Assign VdbeCursor index numbers to all tables in a SrcList */ -SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){ +SQLITE_PRIVATE void tdsqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){ int i; struct SrcList_item *pItem; assert(pList || pParse->db->mallocFailed ); @@ -117915,7 +117915,7 @@ SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){ if( pItem->iCursor>=0 ) break; pItem->iCursor = pParse->nTab++; if( pItem->pSelect ){ - sqlite3SrcListAssignCursors(pParse, pItem->pSelect->pSrc); + tdsqlite3SrcListAssignCursors(pParse, pItem->pSelect->pSrc); } } } @@ -117924,22 +117924,22 @@ SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){ /* ** Delete an entire SrcList including all its substructure. */ -SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){ +SQLITE_PRIVATE void tdsqlite3SrcListDelete(tdsqlite3 *db, SrcList *pList){ int i; struct SrcList_item *pItem; if( pList==0 ) return; for(pItem=pList->a, i=0; inSrc; i++, pItem++){ - sqlite3DbFree(db, pItem->zDatabase); - sqlite3DbFree(db, pItem->zName); - sqlite3DbFree(db, pItem->zAlias); - if( pItem->fg.isIndexedBy ) sqlite3DbFree(db, pItem->u1.zIndexedBy); - if( pItem->fg.isTabFunc ) sqlite3ExprListDelete(db, pItem->u1.pFuncArg); - sqlite3DeleteTable(db, pItem->pTab); - sqlite3SelectDelete(db, pItem->pSelect); - sqlite3ExprDelete(db, pItem->pOn); - sqlite3IdListDelete(db, pItem->pUsing); + tdsqlite3DbFree(db, pItem->zDatabase); + tdsqlite3DbFree(db, pItem->zName); + tdsqlite3DbFree(db, pItem->zAlias); + if( pItem->fg.isIndexedBy ) tdsqlite3DbFree(db, pItem->u1.zIndexedBy); + if( pItem->fg.isTabFunc ) tdsqlite3ExprListDelete(db, pItem->u1.pFuncArg); + tdsqlite3DeleteTable(db, pItem->pTab); + tdsqlite3SelectDelete(db, pItem->pSelect); + tdsqlite3ExprDelete(db, pItem->pOn); + tdsqlite3IdListDelete(db, pItem->pUsing); } - sqlite3DbFreeNN(db, pList); + tdsqlite3DbFreeNN(db, pList); } /* @@ -117958,7 +117958,7 @@ SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){ ** Return a new SrcList which encodes is the FROM with the new ** term added. */ -SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm( +SQLITE_PRIVATE SrcList *tdsqlite3SrcListAppendFromTerm( Parse *pParse, /* Parsing context */ SrcList *p, /* The left part of the FROM clause already seen */ Token *pTable, /* Name of the table to add to the FROM clause */ @@ -117969,14 +117969,14 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm( IdList *pUsing /* The USING clause of a join */ ){ struct SrcList_item *pItem; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; if( !p && (pOn || pUsing) ){ - sqlite3ErrorMsg(pParse, "a JOIN clause is required before %s", + tdsqlite3ErrorMsg(pParse, "a JOIN clause is required before %s", (pOn ? "ON" : "USING") ); goto append_from_error; } - p = sqlite3SrcListAppend(pParse, p, pTable, pDatabase); + p = tdsqlite3SrcListAppend(pParse, p, pTable, pDatabase); if( p==0 ){ goto append_from_error; } @@ -117986,11 +117986,11 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm( assert( pItem->zName==0 || pDatabase!=0 ); if( IN_RENAME_OBJECT && pItem->zName ){ Token *pToken = (ALWAYS(pDatabase) && pDatabase->z) ? pDatabase : pTable; - sqlite3RenameTokenMap(pParse, pItem->zName, pToken); + tdsqlite3RenameTokenMap(pParse, pItem->zName, pToken); } assert( pAlias!=0 ); if( pAlias->n ){ - pItem->zAlias = sqlite3NameFromToken(db, pAlias); + pItem->zAlias = tdsqlite3NameFromToken(db, pAlias); } pItem->pSelect = pSubquery; pItem->pOn = pOn; @@ -117999,9 +117999,9 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm( append_from_error: assert( p==0 ); - sqlite3ExprDelete(db, pOn); - sqlite3IdListDelete(db, pUsing); - sqlite3SelectDelete(db, pSubquery); + tdsqlite3ExprDelete(db, pOn); + tdsqlite3IdListDelete(db, pUsing); + tdsqlite3SelectDelete(db, pSubquery); return 0; } @@ -118009,7 +118009,7 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm( ** Add an INDEXED BY or NOT INDEXED clause to the most recently added ** element of the source-list passed as the second argument. */ -SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pIndexedBy){ +SQLITE_PRIVATE void tdsqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pIndexedBy){ assert( pIndexedBy!=0 ); if( p && pIndexedBy->n>0 ){ struct SrcList_item *pItem; @@ -118023,7 +118023,7 @@ SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pI ** construct "indexed_opt" for details. */ pItem->fg.notIndexed = 1; }else{ - pItem->u1.zIndexedBy = sqlite3NameFromToken(pParse->db, pIndexedBy); + pItem->u1.zIndexedBy = tdsqlite3NameFromToken(pParse->db, pIndexedBy); pItem->fg.isIndexedBy = 1; } } @@ -118033,7 +118033,7 @@ SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pI ** Add the list of function arguments to the SrcList entry for a ** table-valued-function. */ -SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse *pParse, SrcList *p, ExprList *pList){ +SQLITE_PRIVATE void tdsqlite3SrcListFuncArgs(Parse *pParse, SrcList *p, ExprList *pList){ if( p ){ struct SrcList_item *pItem = &p->a[p->nSrc-1]; assert( pItem->fg.notIndexed==0 ); @@ -118042,7 +118042,7 @@ SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse *pParse, SrcList *p, ExprList * pItem->u1.pFuncArg = pList; pItem->fg.isTabFunc = 1; }else{ - sqlite3ExprListDelete(pParse->db, pList); + tdsqlite3ExprListDelete(pParse->db, pList); } } @@ -118061,7 +118061,7 @@ SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse *pParse, SrcList *p, ExprList * ** in p->a[0] and p->a[1], respectively. The parser initially stores the ** operator with A. This routine shifts that operator over to B. */ -SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList *p){ +SQLITE_PRIVATE void tdsqlite3SrcListShiftJoinType(SrcList *p){ if( p ){ int i; for(i=p->nSrc-1; i>0; i--){ @@ -118074,26 +118074,26 @@ SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList *p){ /* ** Generate VDBE code for a BEGIN statement. */ -SQLITE_PRIVATE void sqlite3BeginTransaction(Parse *pParse, int type){ - sqlite3 *db; +SQLITE_PRIVATE void tdsqlite3BeginTransaction(Parse *pParse, int type){ + tdsqlite3 *db; Vdbe *v; int i; assert( pParse!=0 ); db = pParse->db; assert( db!=0 ); - if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "BEGIN", 0, 0) ){ + if( tdsqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "BEGIN", 0, 0) ){ return; } - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( !v ) return; if( type!=TK_DEFERRED ){ for(i=0; inDb; i++){ - sqlite3VdbeAddOp2(v, OP_Transaction, i, (type==TK_EXCLUSIVE)+1); - sqlite3VdbeUsesBtree(v, i); + tdsqlite3VdbeAddOp2(v, OP_Transaction, i, (type==TK_EXCLUSIVE)+1); + tdsqlite3VdbeUsesBtree(v, i); } } - sqlite3VdbeAddOp0(v, OP_AutoCommit); + tdsqlite3VdbeAddOp0(v, OP_AutoCommit); } /* @@ -118101,7 +118101,7 @@ SQLITE_PRIVATE void sqlite3BeginTransaction(Parse *pParse, int type){ ** Code for ROLLBACK is generated if eType==TK_ROLLBACK. Otherwise ** code is generated for a COMMIT. */ -SQLITE_PRIVATE void sqlite3EndTransaction(Parse *pParse, int eType){ +SQLITE_PRIVATE void tdsqlite3EndTransaction(Parse *pParse, int eType){ Vdbe *v; int isRollback; @@ -118109,13 +118109,13 @@ SQLITE_PRIVATE void sqlite3EndTransaction(Parse *pParse, int eType){ assert( pParse->db!=0 ); assert( eType==TK_COMMIT || eType==TK_END || eType==TK_ROLLBACK ); isRollback = eType==TK_ROLLBACK; - if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, + if( tdsqlite3AuthCheck(pParse, SQLITE_TRANSACTION, isRollback ? "ROLLBACK" : "COMMIT", 0, 0) ){ return; } - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( v ){ - sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, isRollback); + tdsqlite3VdbeAddOp2(v, OP_AutoCommit, 1, isRollback); } } @@ -118123,19 +118123,19 @@ SQLITE_PRIVATE void sqlite3EndTransaction(Parse *pParse, int eType){ ** This function is called by the parser when it parses a command to create, ** release or rollback an SQL savepoint. */ -SQLITE_PRIVATE void sqlite3Savepoint(Parse *pParse, int op, Token *pName){ - char *zName = sqlite3NameFromToken(pParse->db, pName); +SQLITE_PRIVATE void tdsqlite3Savepoint(Parse *pParse, int op, Token *pName){ + char *zName = tdsqlite3NameFromToken(pParse->db, pName); if( zName ){ - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); #ifndef SQLITE_OMIT_AUTHORIZATION static const char * const az[] = { "BEGIN", "RELEASE", "ROLLBACK" }; assert( !SAVEPOINT_BEGIN && SAVEPOINT_RELEASE==1 && SAVEPOINT_ROLLBACK==2 ); #endif - if( !v || sqlite3AuthCheck(pParse, SQLITE_SAVEPOINT, az[op], zName, 0) ){ - sqlite3DbFree(pParse->db, zName); + if( !v || tdsqlite3AuthCheck(pParse, SQLITE_SAVEPOINT, az[op], zName, 0) ){ + tdsqlite3DbFree(pParse->db, zName); return; } - sqlite3VdbeAddOp4(v, OP_Savepoint, op, 0, 0, zName, P4_DYNAMIC); + tdsqlite3VdbeAddOp4(v, OP_Savepoint, op, 0, 0, zName, P4_DYNAMIC); } } @@ -118143,8 +118143,8 @@ SQLITE_PRIVATE void sqlite3Savepoint(Parse *pParse, int op, Token *pName){ ** Make sure the TEMP database is open and available for use. Return ** the number of errors. Leave any error messages in the pParse structure. */ -SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *pParse){ - sqlite3 *db = pParse->db; +SQLITE_PRIVATE int tdsqlite3OpenTempDatabase(Parse *pParse){ + tdsqlite3 *db = pParse->db; if( db->aDb[1].pBt==0 && !pParse->explain ){ int rc; Btree *pBt; @@ -118155,17 +118155,17 @@ SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *pParse){ SQLITE_OPEN_DELETEONCLOSE | SQLITE_OPEN_TEMP_DB; - rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pBt, 0, flags); + rc = tdsqlite3BtreeOpen(db->pVfs, 0, db, &pBt, 0, flags); if( rc!=SQLITE_OK ){ - sqlite3ErrorMsg(pParse, "unable to open a temporary database " + tdsqlite3ErrorMsg(pParse, "unable to open a temporary database " "file for storing temporary tables"); pParse->rc = rc; return 1; } db->aDb[1].pBt = pBt; assert( db->aDb[1].pSchema ); - if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){ - sqlite3OomFault(db); + if( SQLITE_NOMEM==tdsqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){ + tdsqlite3OomFault(db); return 1; } } @@ -118176,34 +118176,34 @@ SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *pParse){ ** Record the fact that the schema cookie will need to be verified ** for database iDb. The code to actually verify the schema cookie ** will occur at the end of the top-level VDBE and will be generated -** later, by sqlite3FinishCoding(). +** later, by tdsqlite3FinishCoding(). */ -SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse *pParse, int iDb){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); +SQLITE_PRIVATE void tdsqlite3CodeVerifySchema(Parse *pParse, int iDb){ + Parse *pToplevel = tdsqlite3ParseToplevel(pParse); assert( iDb>=0 && iDbdb->nDb ); assert( pParse->db->aDb[iDb].pBt!=0 || iDb==1 ); assert( iDbdb, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(pParse->db, iDb, 0) ); if( DbMaskTest(pToplevel->cookieMask, iDb)==0 ){ DbMaskSet(pToplevel->cookieMask, iDb); if( !OMIT_TEMPDB && iDb==1 ){ - sqlite3OpenTempDatabase(pToplevel); + tdsqlite3OpenTempDatabase(pToplevel); } } } /* -** If argument zDb is NULL, then call sqlite3CodeVerifySchema() for each +** If argument zDb is NULL, then call tdsqlite3CodeVerifySchema() for each ** attached database. Otherwise, invoke it for the database named zDb only. */ -SQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse *pParse, const char *zDb){ - sqlite3 *db = pParse->db; +SQLITE_PRIVATE void tdsqlite3CodeVerifyNamedSchema(Parse *pParse, const char *zDb){ + tdsqlite3 *db = pParse->db; int i; for(i=0; inDb; i++){ Db *pDb = &db->aDb[i]; - if( pDb->pBt && (!zDb || 0==sqlite3StrICmp(zDb, pDb->zDbSName)) ){ - sqlite3CodeVerifySchema(pParse, i); + if( pDb->pBt && (!zDb || 0==tdsqlite3StrICmp(zDb, pDb->zDbSName)) ){ + tdsqlite3CodeVerifySchema(pParse, i); } } } @@ -118221,9 +118221,9 @@ SQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse *pParse, const char *zDb) ** can be checked before any changes are made to the database, it is never ** necessary to undo a write and the checkpoint should not be set. */ -SQLITE_PRIVATE void sqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); - sqlite3CodeVerifySchema(pParse, iDb); +SQLITE_PRIVATE void tdsqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){ + Parse *pToplevel = tdsqlite3ParseToplevel(pParse); + tdsqlite3CodeVerifySchema(pParse, iDb); DbMaskSet(pToplevel->writeMask, iDb); pToplevel->isMultiWrite |= setStatement; } @@ -118235,8 +118235,8 @@ SQLITE_PRIVATE void sqlite3BeginWriteOperation(Parse *pParse, int setStatement, ** If an abort occurs after some of these writes have completed, then it will ** be necessary to undo the completed writes. */ -SQLITE_PRIVATE void sqlite3MultiWrite(Parse *pParse){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); +SQLITE_PRIVATE void tdsqlite3MultiWrite(Parse *pParse){ + Parse *pToplevel = tdsqlite3ParseToplevel(pParse); pToplevel->isMultiWrite = 1; } @@ -118253,11 +118253,11 @@ SQLITE_PRIVATE void sqlite3MultiWrite(Parse *pParse){ ** go a little faster. But taking advantage of this time dependency ** makes it more difficult to prove that the code is correct (in ** particular, it prevents us from writing an effective -** implementation of sqlite3AssertMayAbort()) and so we have chosen +** implementation of tdsqlite3AssertMayAbort()) and so we have chosen ** to take the safe route and skip the optimization. */ -SQLITE_PRIVATE void sqlite3MayAbort(Parse *pParse){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); +SQLITE_PRIVATE void tdsqlite3MayAbort(Parse *pParse){ + Parse *pToplevel = tdsqlite3ParseToplevel(pParse); pToplevel->mayAbort = 1; } @@ -118266,7 +118266,7 @@ SQLITE_PRIVATE void sqlite3MayAbort(Parse *pParse){ ** error. The onError parameter determines which (if any) of the statement ** and/or current transaction is rolled back. */ -SQLITE_PRIVATE void sqlite3HaltConstraint( +SQLITE_PRIVATE void tdsqlite3HaltConstraint( Parse *pParse, /* Parsing context */ int errCode, /* extended error code */ int onError, /* Constraint type */ @@ -118274,19 +118274,19 @@ SQLITE_PRIVATE void sqlite3HaltConstraint( i8 p4type, /* P4_STATIC or P4_TRANSIENT */ u8 p5Errmsg /* P5_ErrMsg type */ ){ - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); assert( (errCode&0xff)==SQLITE_CONSTRAINT ); if( onError==OE_Abort ){ - sqlite3MayAbort(pParse); + tdsqlite3MayAbort(pParse); } - sqlite3VdbeAddOp4(v, OP_Halt, errCode, onError, 0, p4, p4type); - sqlite3VdbeChangeP5(v, p5Errmsg); + tdsqlite3VdbeAddOp4(v, OP_Halt, errCode, onError, 0, p4, p4type); + tdsqlite3VdbeChangeP5(v, p5Errmsg); } /* ** Code an OP_Halt due to UNIQUE or PRIMARY KEY constraint violation. */ -SQLITE_PRIVATE void sqlite3UniqueConstraint( +SQLITE_PRIVATE void tdsqlite3UniqueConstraint( Parse *pParse, /* Parsing context */ int onError, /* Constraint type */ Index *pIdx /* The index that triggers the constraint */ @@ -118296,23 +118296,23 @@ SQLITE_PRIVATE void sqlite3UniqueConstraint( StrAccum errMsg; Table *pTab = pIdx->pTable; - sqlite3StrAccumInit(&errMsg, pParse->db, 0, 0, + tdsqlite3StrAccumInit(&errMsg, pParse->db, 0, 0, pParse->db->aLimit[SQLITE_LIMIT_LENGTH]); if( pIdx->aColExpr ){ - sqlite3_str_appendf(&errMsg, "index '%q'", pIdx->zName); + tdsqlite3_str_appendf(&errMsg, "index '%q'", pIdx->zName); }else{ for(j=0; jnKeyCol; j++){ char *zCol; assert( pIdx->aiColumn[j]>=0 ); zCol = pTab->aCol[pIdx->aiColumn[j]].zName; - if( j ) sqlite3_str_append(&errMsg, ", ", 2); - sqlite3_str_appendall(&errMsg, pTab->zName); - sqlite3_str_append(&errMsg, ".", 1); - sqlite3_str_appendall(&errMsg, zCol); + if( j ) tdsqlite3_str_append(&errMsg, ", ", 2); + tdsqlite3_str_appendall(&errMsg, pTab->zName); + tdsqlite3_str_append(&errMsg, ".", 1); + tdsqlite3_str_appendall(&errMsg, zCol); } } - zErr = sqlite3StrAccumFinish(&errMsg); - sqlite3HaltConstraint(pParse, + zErr = tdsqlite3StrAccumFinish(&errMsg); + tdsqlite3HaltConstraint(pParse, IsPrimaryKeyIndex(pIdx) ? SQLITE_CONSTRAINT_PRIMARYKEY : SQLITE_CONSTRAINT_UNIQUE, onError, zErr, P4_DYNAMIC, P5_ConstraintUnique); @@ -118322,7 +118322,7 @@ SQLITE_PRIVATE void sqlite3UniqueConstraint( /* ** Code an OP_Halt due to non-unique rowid. */ -SQLITE_PRIVATE void sqlite3RowidConstraint( +SQLITE_PRIVATE void tdsqlite3RowidConstraint( Parse *pParse, /* Parsing context */ int onError, /* Conflict resolution algorithm */ Table *pTab /* The table with the non-unique rowid */ @@ -118330,14 +118330,14 @@ SQLITE_PRIVATE void sqlite3RowidConstraint( char *zMsg; int rc; if( pTab->iPKey>=0 ){ - zMsg = sqlite3MPrintf(pParse->db, "%s.%s", pTab->zName, + zMsg = tdsqlite3MPrintf(pParse->db, "%s.%s", pTab->zName, pTab->aCol[pTab->iPKey].zName); rc = SQLITE_CONSTRAINT_PRIMARYKEY; }else{ - zMsg = sqlite3MPrintf(pParse->db, "%s.rowid", pTab->zName); + zMsg = tdsqlite3MPrintf(pParse->db, "%s.rowid", pTab->zName); rc = SQLITE_CONSTRAINT_ROWID; } - sqlite3HaltConstraint(pParse, rc, onError, zMsg, P4_DYNAMIC, + tdsqlite3HaltConstraint(pParse, rc, onError, zMsg, P4_DYNAMIC, P5_ConstraintUnique); } @@ -118352,7 +118352,7 @@ static int collationMatch(const char *zColl, Index *pIndex){ for(i=0; inColumn; i++){ const char *z = pIndex->azColl[i]; assert( z!=0 || pIndex->aiColumn[i]<0 ); - if( pIndex->aiColumn[i]>=0 && 0==sqlite3StrICmp(z, zColl) ){ + if( pIndex->aiColumn[i]>=0 && 0==tdsqlite3StrICmp(z, zColl) ){ return 1; } } @@ -118371,9 +118371,9 @@ static void reindexTable(Parse *pParse, Table *pTab, char const *zColl){ for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){ if( zColl==0 || collationMatch(zColl, pIndex) ){ - int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - sqlite3BeginWriteOperation(pParse, 0, iDb); - sqlite3RefillIndex(pParse, pIndex, -1); + int iDb = tdsqlite3SchemaToIndex(pParse->db, pTab->pSchema); + tdsqlite3BeginWriteOperation(pParse, 0, iDb); + tdsqlite3RefillIndex(pParse, pIndex, -1); } } } @@ -118389,11 +118389,11 @@ static void reindexTable(Parse *pParse, Table *pTab, char const *zColl){ static void reindexDatabases(Parse *pParse, char const *zColl){ Db *pDb; /* A single database */ int iDb; /* The database index number */ - sqlite3 *db = pParse->db; /* The database connection */ + tdsqlite3 *db = pParse->db; /* The database connection */ HashElem *k; /* For looping over tables in pDb */ Table *pTab; /* A table in the database */ - assert( sqlite3BtreeHoldsAllMutexes(db) ); /* Needed for schema access */ + assert( tdsqlite3BtreeHoldsAllMutexes(db) ); /* Needed for schema access */ for(iDb=0, pDb=db->aDb; iDbnDb; iDb++, pDb++){ assert( pDb!=0 ); for(k=sqliteHashFirst(&pDb->pSchema->tblHash); k; k=sqliteHashNext(k)){ @@ -118418,19 +118418,19 @@ static void reindexDatabases(Parse *pParse, char const *zColl){ ** indices associated with the named table. */ #ifndef SQLITE_OMIT_REINDEX -SQLITE_PRIVATE void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){ +SQLITE_PRIVATE void tdsqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){ CollSeq *pColl; /* Collating sequence to be reindexed, or NULL */ char *z; /* Name of a table or index */ const char *zDb; /* Name of the database */ Table *pTab; /* A table in the database */ Index *pIndex; /* An index associated with pTab */ int iDb; /* The database index number */ - sqlite3 *db = pParse->db; /* The database connection */ + tdsqlite3 *db = pParse->db; /* The database connection */ Token *pObjName; /* Name of the table or index to be reindexed */ /* Read the database schema. If an error occurs, leave an error message ** and code in pParse and return NULL. */ - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ + if( SQLITE_OK!=tdsqlite3ReadSchema(pParse) ){ return; } @@ -118440,61 +118440,61 @@ SQLITE_PRIVATE void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){ }else if( NEVER(pName2==0) || pName2->z==0 ){ char *zColl; assert( pName1->z ); - zColl = sqlite3NameFromToken(pParse->db, pName1); + zColl = tdsqlite3NameFromToken(pParse->db, pName1); if( !zColl ) return; - pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0); + pColl = tdsqlite3FindCollSeq(db, ENC(db), zColl, 0); if( pColl ){ reindexDatabases(pParse, zColl); - sqlite3DbFree(db, zColl); + tdsqlite3DbFree(db, zColl); return; } - sqlite3DbFree(db, zColl); + tdsqlite3DbFree(db, zColl); } - iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pObjName); + iDb = tdsqlite3TwoPartName(pParse, pName1, pName2, &pObjName); if( iDb<0 ) return; - z = sqlite3NameFromToken(db, pObjName); + z = tdsqlite3NameFromToken(db, pObjName); if( z==0 ) return; zDb = db->aDb[iDb].zDbSName; - pTab = sqlite3FindTable(db, z, zDb); + pTab = tdsqlite3FindTable(db, z, zDb); if( pTab ){ reindexTable(pParse, pTab, 0); - sqlite3DbFree(db, z); + tdsqlite3DbFree(db, z); return; } - pIndex = sqlite3FindIndex(db, z, zDb); - sqlite3DbFree(db, z); + pIndex = tdsqlite3FindIndex(db, z, zDb); + tdsqlite3DbFree(db, z); if( pIndex ){ - sqlite3BeginWriteOperation(pParse, 0, iDb); - sqlite3RefillIndex(pParse, pIndex, -1); + tdsqlite3BeginWriteOperation(pParse, 0, iDb); + tdsqlite3RefillIndex(pParse, pIndex, -1); return; } - sqlite3ErrorMsg(pParse, "unable to identify the object to be reindexed"); + tdsqlite3ErrorMsg(pParse, "unable to identify the object to be reindexed"); } #endif /* ** Return a KeyInfo structure that is appropriate for the given Index. ** -** The caller should invoke sqlite3KeyInfoUnref() on the returned object +** The caller should invoke tdsqlite3KeyInfoUnref() on the returned object ** when it has finished using it. */ -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoOfIndex(Parse *pParse, Index *pIdx){ +SQLITE_PRIVATE KeyInfo *tdsqlite3KeyInfoOfIndex(Parse *pParse, Index *pIdx){ int i; int nCol = pIdx->nColumn; int nKey = pIdx->nKeyCol; KeyInfo *pKey; if( pParse->nErr ) return 0; if( pIdx->uniqNotNull ){ - pKey = sqlite3KeyInfoAlloc(pParse->db, nKey, nCol-nKey); + pKey = tdsqlite3KeyInfoAlloc(pParse->db, nKey, nCol-nKey); }else{ - pKey = sqlite3KeyInfoAlloc(pParse->db, nCol, 0); + pKey = tdsqlite3KeyInfoAlloc(pParse->db, nCol, 0); } if( pKey ){ - assert( sqlite3KeyInfoIsWriteable(pKey) ); + assert( tdsqlite3KeyInfoIsWriteable(pKey) ); for(i=0; iazColl[i]; - pKey->aColl[i] = zColl==sqlite3StrBINARY ? 0 : - sqlite3LocateCollSeq(pParse, zColl); + pKey->aColl[i] = zColl==tdsqlite3StrBINARY ? 0 : + tdsqlite3LocateCollSeq(pParse, zColl); pKey->aSortFlags[i] = pIdx->aSortOrder[i]; assert( 0==(pKey->aSortFlags[i] & KEYINFO_ORDER_BIGNULL) ); } @@ -118511,7 +118511,7 @@ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoOfIndex(Parse *pParse, Index *pIdx){ pIdx->bNoQuery = 1; pParse->rc = SQLITE_ERROR_RETRY; } - sqlite3KeyInfoUnref(pKey); + tdsqlite3KeyInfoUnref(pKey); pKey = 0; } } @@ -118523,41 +118523,41 @@ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoOfIndex(Parse *pParse, Index *pIdx){ ** This routine is invoked once per CTE by the parser while parsing a ** WITH clause. */ -SQLITE_PRIVATE With *sqlite3WithAdd( +SQLITE_PRIVATE With *tdsqlite3WithAdd( Parse *pParse, /* Parsing context */ With *pWith, /* Existing WITH clause, or NULL */ Token *pName, /* Name of the common-table */ ExprList *pArglist, /* Optional column name list for the table */ Select *pQuery /* Query used to initialize the table */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; With *pNew; char *zName; /* Check that the CTE name is unique within this WITH clause. If ** not, store an error in the Parse structure. */ - zName = sqlite3NameFromToken(pParse->db, pName); + zName = tdsqlite3NameFromToken(pParse->db, pName); if( zName && pWith ){ int i; for(i=0; inCte; i++){ - if( sqlite3StrICmp(zName, pWith->a[i].zName)==0 ){ - sqlite3ErrorMsg(pParse, "duplicate WITH table name: %s", zName); + if( tdsqlite3StrICmp(zName, pWith->a[i].zName)==0 ){ + tdsqlite3ErrorMsg(pParse, "duplicate WITH table name: %s", zName); } } } if( pWith ){ - sqlite3_int64 nByte = sizeof(*pWith) + (sizeof(pWith->a[1]) * pWith->nCte); - pNew = sqlite3DbRealloc(db, pWith, nByte); + tdsqlite3_int64 nByte = sizeof(*pWith) + (sizeof(pWith->a[1]) * pWith->nCte); + pNew = tdsqlite3DbRealloc(db, pWith, nByte); }else{ - pNew = sqlite3DbMallocZero(db, sizeof(*pWith)); + pNew = tdsqlite3DbMallocZero(db, sizeof(*pWith)); } assert( (pNew!=0 && zName!=0) || db->mallocFailed ); if( db->mallocFailed ){ - sqlite3ExprListDelete(db, pArglist); - sqlite3SelectDelete(db, pQuery); - sqlite3DbFree(db, zName); + tdsqlite3ExprListDelete(db, pArglist); + tdsqlite3SelectDelete(db, pQuery); + tdsqlite3DbFree(db, zName); pNew = pWith; }else{ pNew->a[pNew->nCte].pSelect = pQuery; @@ -118573,16 +118573,16 @@ SQLITE_PRIVATE With *sqlite3WithAdd( /* ** Free the contents of the With object passed as the second argument. */ -SQLITE_PRIVATE void sqlite3WithDelete(sqlite3 *db, With *pWith){ +SQLITE_PRIVATE void tdsqlite3WithDelete(tdsqlite3 *db, With *pWith){ if( pWith ){ int i; for(i=0; inCte; i++){ struct Cte *pCte = &pWith->a[i]; - sqlite3ExprListDelete(db, pCte->pCols); - sqlite3SelectDelete(db, pCte->pSelect); - sqlite3DbFree(db, pCte->zName); + tdsqlite3ExprListDelete(db, pCte->pCols); + tdsqlite3SelectDelete(db, pCte->pSelect); + tdsqlite3DbFree(db, pCte->zName); } - sqlite3DbFree(db, pWith); + tdsqlite3DbFree(db, pWith); } } #endif /* !defined(SQLITE_OMIT_CTE) */ @@ -118611,24 +118611,24 @@ SQLITE_PRIVATE void sqlite3WithDelete(sqlite3 *db, With *pWith){ ** Invoke the 'collation needed' callback to request a collation sequence ** in the encoding enc of name zName, length nName. */ -static void callCollNeeded(sqlite3 *db, int enc, const char *zName){ +static void callCollNeeded(tdsqlite3 *db, int enc, const char *zName){ assert( !db->xCollNeeded || !db->xCollNeeded16 ); if( db->xCollNeeded ){ - char *zExternal = sqlite3DbStrDup(db, zName); + char *zExternal = tdsqlite3DbStrDup(db, zName); if( !zExternal ) return; db->xCollNeeded(db->pCollNeededArg, db, enc, zExternal); - sqlite3DbFree(db, zExternal); + tdsqlite3DbFree(db, zExternal); } #ifndef SQLITE_OMIT_UTF16 if( db->xCollNeeded16 ){ char const *zExternal; - sqlite3_value *pTmp = sqlite3ValueNew(db); - sqlite3ValueSetStr(pTmp, -1, zName, SQLITE_UTF8, SQLITE_STATIC); - zExternal = sqlite3ValueText(pTmp, SQLITE_UTF16NATIVE); + tdsqlite3_value *pTmp = tdsqlite3ValueNew(db); + tdsqlite3ValueSetStr(pTmp, -1, zName, SQLITE_UTF8, SQLITE_STATIC); + zExternal = tdsqlite3ValueText(pTmp, SQLITE_UTF16NATIVE); if( zExternal ){ db->xCollNeeded16(db->pCollNeededArg, db, (int)ENC(db), zExternal); } - sqlite3ValueFree(pTmp); + tdsqlite3ValueFree(pTmp); } #endif } @@ -118640,13 +118640,13 @@ static void callCollNeeded(sqlite3 *db, int enc, const char *zName){ ** of these instead if they exist. Avoid a UTF-8 <-> UTF-16 conversion if ** possible. */ -static int synthCollSeq(sqlite3 *db, CollSeq *pColl){ +static int synthCollSeq(tdsqlite3 *db, CollSeq *pColl){ CollSeq *pColl2; char *z = pColl->zName; int i; static const u8 aEnc[] = { SQLITE_UTF16BE, SQLITE_UTF16LE, SQLITE_UTF8 }; for(i=0; i<3; i++){ - pColl2 = sqlite3FindCollSeq(db, aEnc[i], z, 0); + pColl2 = tdsqlite3FindCollSeq(db, aEnc[i], z, 0); if( pColl2->xCmp!=0 ){ memcpy(pColl, pColl2, sizeof(CollSeq)); pColl->xDel = 0; /* Do not copy the destructor */ @@ -118660,18 +118660,18 @@ static int synthCollSeq(sqlite3 *db, CollSeq *pColl){ ** This routine is called on a collation sequence before it is used to ** check that it is defined. An undefined collation sequence exists when ** a database is loaded that contains references to collation sequences -** that have not been defined by sqlite3_create_collation() etc. +** that have not been defined by tdsqlite3_create_collation() etc. ** ** If required, this routine calls the 'collation needed' callback to ** request a definition of the collating sequence. If this doesn't work, ** an equivalent collating sequence that uses a text encoding different ** from the main database is substituted, if one is available. */ -SQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){ +SQLITE_PRIVATE int tdsqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){ if( pColl && pColl->xCmp==0 ){ const char *zName = pColl->zName; - sqlite3 *db = pParse->db; - CollSeq *p = sqlite3GetCollSeq(pParse, ENC(db), pColl, zName); + tdsqlite3 *db = pParse->db; + CollSeq *p = tdsqlite3GetCollSeq(pParse, ENC(db), pColl, zName); if( !p ){ return SQLITE_ERROR; } @@ -118696,16 +118696,16 @@ SQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){ ** each collation sequence structure. */ static CollSeq *findCollSeqEntry( - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ const char *zName, /* Name of the collating sequence */ int create /* Create a new entry if true */ ){ CollSeq *pColl; - pColl = sqlite3HashFind(&db->aCollSeq, zName); + pColl = tdsqlite3HashFind(&db->aCollSeq, zName); if( 0==pColl && create ){ - int nName = sqlite3Strlen30(zName) + 1; - pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName); + int nName = tdsqlite3Strlen30(zName) + 1; + pColl = tdsqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName); if( pColl ){ CollSeq *pDel = 0; pColl[0].zName = (char*)&pColl[3]; @@ -118715,16 +118715,16 @@ static CollSeq *findCollSeqEntry( pColl[2].zName = (char*)&pColl[3]; pColl[2].enc = SQLITE_UTF16BE; memcpy(pColl[0].zName, zName, nName); - pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, pColl); + pDel = tdsqlite3HashInsert(&db->aCollSeq, pColl[0].zName, pColl); - /* If a malloc() failure occurred in sqlite3HashInsert(), it will + /* If a malloc() failure occurred in tdsqlite3HashInsert(), it will ** return the pColl pointer to be deleted (because it wasn't added ** to the hash table). */ assert( pDel==0 || pDel==pColl ); if( pDel!=0 ){ - sqlite3OomFault(db); - sqlite3DbFree(db, pDel); + tdsqlite3OomFault(db); + tdsqlite3DbFree(db, pDel); pColl = 0; } } @@ -118740,15 +118740,15 @@ static CollSeq *findCollSeqEntry( ** If the entry specified is not found and 'create' is true, then create a ** new entry. Otherwise return NULL. ** -** A separate function sqlite3LocateCollSeq() is a wrapper around -** this routine. sqlite3LocateCollSeq() invokes the collation factory +** A separate function tdsqlite3LocateCollSeq() is a wrapper around +** this routine. tdsqlite3LocateCollSeq() invokes the collation factory ** if necessary and generates an error message if the collating sequence ** cannot be found. ** -** See also: sqlite3LocateCollSeq(), sqlite3GetCollSeq() +** See also: tdsqlite3LocateCollSeq(), tdsqlite3GetCollSeq() */ -SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq( - sqlite3 *db, /* Database connection to search */ +SQLITE_PRIVATE CollSeq *tdsqlite3FindCollSeq( + tdsqlite3 *db, /* Database connection to search */ u8 enc, /* Desired text encoding */ const char *zName, /* Name of the collating sequence. Might be NULL */ int create /* True to create CollSeq if doesn't already exist */ @@ -118777,34 +118777,34 @@ SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq( ** db for collation type name zName, length nName, or NULL, if no collation ** sequence can be found. If no collation is found, leave an error message. ** -** See also: sqlite3LocateCollSeq(), sqlite3FindCollSeq() +** See also: tdsqlite3LocateCollSeq(), tdsqlite3FindCollSeq() */ -SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq( +SQLITE_PRIVATE CollSeq *tdsqlite3GetCollSeq( Parse *pParse, /* Parsing context */ u8 enc, /* The desired encoding for the collating sequence */ CollSeq *pColl, /* Collating sequence with native encoding, or NULL */ const char *zName /* Collating sequence name */ ){ CollSeq *p; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; p = pColl; if( !p ){ - p = sqlite3FindCollSeq(db, enc, zName, 0); + p = tdsqlite3FindCollSeq(db, enc, zName, 0); } if( !p || !p->xCmp ){ /* No collation sequence of this type for this encoding is registered. ** Call the collation factory to see if it can supply us with one. */ callCollNeeded(db, enc, zName); - p = sqlite3FindCollSeq(db, enc, zName, 0); + p = tdsqlite3FindCollSeq(db, enc, zName, 0); } if( p && !p->xCmp && synthCollSeq(db, p) ){ p = 0; } assert( !p || p->xCmp ); if( p==0 ){ - sqlite3ErrorMsg(pParse, "no such collation sequence: %s", zName); + tdsqlite3ErrorMsg(pParse, "no such collation sequence: %s", zName); pParse->rc = SQLITE_ERROR_MISSING_COLLSEQ; } return p; @@ -118824,21 +118824,21 @@ SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq( ** another error occurs, NULL is returned and an error message written into ** pParse. ** -** This routine is a wrapper around sqlite3FindCollSeq(). This routine +** This routine is a wrapper around tdsqlite3FindCollSeq(). This routine ** invokes the collation factory if the named collation cannot be found ** and generates an error message. ** -** See also: sqlite3FindCollSeq(), sqlite3GetCollSeq() +** See also: tdsqlite3FindCollSeq(), tdsqlite3GetCollSeq() */ -SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *zName){ - sqlite3 *db = pParse->db; +SQLITE_PRIVATE CollSeq *tdsqlite3LocateCollSeq(Parse *pParse, const char *zName){ + tdsqlite3 *db = pParse->db; u8 enc = ENC(db); u8 initbusy = db->init.busy; CollSeq *pColl; - pColl = sqlite3FindCollSeq(db, enc, zName, initbusy); + pColl = tdsqlite3FindCollSeq(db, enc, zName, initbusy); if( !initbusy && (!pColl || !pColl->xCmp) ){ - pColl = sqlite3GetCollSeq(pParse, enc, pColl, zName); + pColl = tdsqlite3GetCollSeq(pParse, enc, pColl, zName); } return pColl; @@ -118909,13 +118909,13 @@ static int matchQuality( ** Search a FuncDefHash for a function with the given name. Return ** a pointer to the matching FuncDef if found, or 0 if there is no match. */ -SQLITE_PRIVATE FuncDef *sqlite3FunctionSearch( +SQLITE_PRIVATE FuncDef *tdsqlite3FunctionSearch( int h, /* Hash of the name */ const char *zFunc /* Name of function */ ){ FuncDef *p; - for(p=sqlite3BuiltinFunctions.a[h]; p; p=p->u.pHash){ - if( sqlite3StrICmp(p->zName, zFunc)==0 ){ + for(p=tdsqlite3BuiltinFunctions.a[h]; p; p=p->u.pHash){ + if( tdsqlite3StrICmp(p->zName, zFunc)==0 ){ return p; } } @@ -118925,7 +118925,7 @@ SQLITE_PRIVATE FuncDef *sqlite3FunctionSearch( /* ** Insert a new FuncDef into a FuncDefHash hash table. */ -SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs( +SQLITE_PRIVATE void tdsqlite3InsertBuiltinFuncs( FuncDef *aDef, /* List of global functions to be inserted */ int nDef /* Length of the apDef[] list */ ){ @@ -118933,18 +118933,18 @@ SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs( for(i=0; i='a' && zName[0]<='z' ); - pOther = sqlite3FunctionSearch(h, zName); + pOther = tdsqlite3FunctionSearch(h, zName); if( pOther ){ assert( pOther!=&aDef[i] && pOther->pNext!=&aDef[i] ); aDef[i].pNext = pOther->pNext; pOther->pNext = &aDef[i]; }else{ aDef[i].pNext = 0; - aDef[i].u.pHash = sqlite3BuiltinFunctions.a[h]; - sqlite3BuiltinFunctions.a[h] = &aDef[i]; + aDef[i].u.pHash = tdsqlite3BuiltinFunctions.a[h]; + tdsqlite3BuiltinFunctions.a[h] = &aDef[i]; } } } @@ -118970,8 +118970,8 @@ SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs( ** number of arguments may be returned even if the eTextRep flag does not ** match that requested. */ -SQLITE_PRIVATE FuncDef *sqlite3FindFunction( - sqlite3 *db, /* An open database */ +SQLITE_PRIVATE FuncDef *tdsqlite3FindFunction( + tdsqlite3 *db, /* An open database */ const char *zName, /* Name of the function. zero-terminated */ int nArg, /* Number of arguments. -1 means any number */ u8 enc, /* Preferred text encoding */ @@ -118985,11 +118985,11 @@ SQLITE_PRIVATE FuncDef *sqlite3FindFunction( assert( nArg>=(-2) ); assert( nArg>=(-1) || createFlag==0 ); - nName = sqlite3Strlen30(zName); + nName = tdsqlite3Strlen30(zName); /* First search for a match amongst the application-defined functions. */ - p = (FuncDef*)sqlite3HashFind(&db->aFunc, zName); + p = (FuncDef*)tdsqlite3HashFind(&db->aFunc, zName); while( p ){ int score = matchQuality(p, nArg, enc); if( score>bestScore ){ @@ -119013,8 +119013,8 @@ SQLITE_PRIVATE FuncDef *sqlite3FindFunction( */ if( !createFlag && (pBest==0 || (db->mDbFlags & DBFLAG_PreferBuiltin)!=0) ){ bestScore = 0; - h = SQLITE_FUNC_HASH(sqlite3UpperToLower[(u8)zName[0]], nName); - p = sqlite3FunctionSearch(h, zName); + h = SQLITE_FUNC_HASH(tdsqlite3UpperToLower[(u8)zName[0]], nName); + p = tdsqlite3FunctionSearch(h, zName); while( p ){ int score = matchQuality(p, nArg, enc); if( score>bestScore ){ @@ -119030,18 +119030,18 @@ SQLITE_PRIVATE FuncDef *sqlite3FindFunction( ** new entry to the hash table and return it. */ if( createFlag && bestScorezName = (const char*)&pBest[1]; pBest->nArg = (u16)nArg; pBest->funcFlags = enc; memcpy((char*)&pBest[1], zName, nName+1); - for(z=(u8*)pBest->zName; *z; z++) *z = sqlite3UpperToLower[*z]; - pOther = (FuncDef*)sqlite3HashInsert(&db->aFunc, pBest->zName, pBest); + for(z=(u8*)pBest->zName; *z; z++) *z = tdsqlite3UpperToLower[*z]; + pOther = (FuncDef*)tdsqlite3HashInsert(&db->aFunc, pBest->zName, pBest); if( pOther==pBest ){ - sqlite3DbFree(db, pBest); - sqlite3OomFault(db); + tdsqlite3DbFree(db, pBest); + tdsqlite3OomFault(db); return 0; }else{ pBest->pNext = pOther; @@ -119056,13 +119056,13 @@ SQLITE_PRIVATE FuncDef *sqlite3FindFunction( /* ** Free all resources held by the schema structure. The void* argument points -** at a Schema struct. This function does not call sqlite3DbFree(db, ) on the +** at a Schema struct. This function does not call tdsqlite3DbFree(db, ) on the ** pointer itself, it just cleans up subsidiary resources (i.e. the contents ** of the schema hash tables). ** ** The Schema.cache_size variable is not cleared. */ -SQLITE_PRIVATE void sqlite3SchemaClear(void *p){ +SQLITE_PRIVATE void tdsqlite3SchemaClear(void *p){ Hash temp1; Hash temp2; HashElem *pElem; @@ -119070,19 +119070,19 @@ SQLITE_PRIVATE void sqlite3SchemaClear(void *p){ temp1 = pSchema->tblHash; temp2 = pSchema->trigHash; - sqlite3HashInit(&pSchema->trigHash); - sqlite3HashClear(&pSchema->idxHash); + tdsqlite3HashInit(&pSchema->trigHash); + tdsqlite3HashClear(&pSchema->idxHash); for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){ - sqlite3DeleteTrigger(0, (Trigger*)sqliteHashData(pElem)); + tdsqlite3DeleteTrigger(0, (Trigger*)sqliteHashData(pElem)); } - sqlite3HashClear(&temp2); - sqlite3HashInit(&pSchema->tblHash); + tdsqlite3HashClear(&temp2); + tdsqlite3HashInit(&pSchema->tblHash); for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){ Table *pTab = sqliteHashData(pElem); - sqlite3DeleteTable(0, pTab); + tdsqlite3DeleteTable(0, pTab); } - sqlite3HashClear(&temp1); - sqlite3HashClear(&pSchema->fkeyHash); + tdsqlite3HashClear(&temp1); + tdsqlite3HashClear(&pSchema->fkeyHash); pSchema->pSeqTab = 0; if( pSchema->schemaFlags & DB_SchemaLoaded ){ pSchema->iGeneration++; @@ -119094,20 +119094,20 @@ SQLITE_PRIVATE void sqlite3SchemaClear(void *p){ ** Find and return the schema associated with a BTree. Create ** a new one if necessary. */ -SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt){ +SQLITE_PRIVATE Schema *tdsqlite3SchemaGet(tdsqlite3 *db, Btree *pBt){ Schema * p; if( pBt ){ - p = (Schema *)sqlite3BtreeSchema(pBt, sizeof(Schema), sqlite3SchemaClear); + p = (Schema *)tdsqlite3BtreeSchema(pBt, sizeof(Schema), tdsqlite3SchemaClear); }else{ - p = (Schema *)sqlite3DbMallocZero(0, sizeof(Schema)); + p = (Schema *)tdsqlite3DbMallocZero(0, sizeof(Schema)); } if( !p ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); }else if ( 0==p->file_format ){ - sqlite3HashInit(&p->tblHash); - sqlite3HashInit(&p->idxHash); - sqlite3HashInit(&p->trigHash); - sqlite3HashInit(&p->fkeyHash); + tdsqlite3HashInit(&p->tblHash); + tdsqlite3HashInit(&p->idxHash); + tdsqlite3HashInit(&p->trigHash); + tdsqlite3HashInit(&p->fkeyHash); p->enc = SQLITE_UTF8; } return p; @@ -119145,17 +119145,17 @@ SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt){ ** pSrc->a[0].pIndex Pointer to the INDEXED BY index, if there is one ** */ -SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){ +SQLITE_PRIVATE Table *tdsqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){ struct SrcList_item *pItem = pSrc->a; Table *pTab; assert( pItem && pSrc->nSrc==1 ); - pTab = sqlite3LocateTableItem(pParse, 0, pItem); - sqlite3DeleteTable(pParse->db, pItem->pTab); + pTab = tdsqlite3LocateTableItem(pParse, 0, pItem); + tdsqlite3DeleteTable(pParse->db, pItem->pTab); pItem->pTab = pTab; if( pTab ){ pTab->nTabRef++; } - if( sqlite3IndexedByLookup(pParse, pItem) ){ + if( tdsqlite3IndexedByLookup(pParse, pItem) ){ pTab = 0; } return pTab; @@ -119173,21 +119173,21 @@ SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){ ** been specified ** ** 3) The table is a shadow table, the database connection is in -** defensive mode, and the current sqlite3_prepare() +** defensive mode, and the current tdsqlite3_prepare() ** is for a top-level SQL statement. */ static int tabIsReadOnly(Parse *pParse, Table *pTab){ - sqlite3 *db; + tdsqlite3 *db; if( IsVirtual(pTab) ){ - return sqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0; + return tdsqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0; } if( (pTab->tabFlags & (TF_Readonly|TF_Shadow))==0 ) return 0; db = pParse->db; if( (pTab->tabFlags & TF_Readonly)!=0 ){ - return sqlite3WritableSchema(db)==0 && pParse->nested==0; + return tdsqlite3WritableSchema(db)==0 && pParse->nested==0; } assert( pTab->tabFlags & TF_Shadow ); - return sqlite3ReadOnlyShadowTables(db); + return tdsqlite3ReadOnlyShadowTables(db); } /* @@ -119195,14 +119195,14 @@ static int tabIsReadOnly(Parse *pParse, Table *pTab){ ** writable, generate an error message and return 1. If it is ** writable return 0; */ -SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){ +SQLITE_PRIVATE int tdsqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){ if( tabIsReadOnly(pParse, pTab) ){ - sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName); + tdsqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName); return 1; } #ifndef SQLITE_OMIT_VIEW if( !viewOk && pTab->pSelect ){ - sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName); + tdsqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName); return 1; } #endif @@ -119216,7 +119216,7 @@ SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){ ** pWhere argument is an optional WHERE clause that restricts the ** set of rows in the view that are to be added to the ephemeral table. */ -SQLITE_PRIVATE void sqlite3MaterializeView( +SQLITE_PRIVATE void tdsqlite3MaterializeView( Parse *pParse, /* Parsing context */ Table *pView, /* View definition */ Expr *pWhere, /* Optional WHERE clause to be added */ @@ -119227,22 +119227,22 @@ SQLITE_PRIVATE void sqlite3MaterializeView( SelectDest dest; Select *pSel; SrcList *pFrom; - sqlite3 *db = pParse->db; - int iDb = sqlite3SchemaToIndex(db, pView->pSchema); - pWhere = sqlite3ExprDup(db, pWhere, 0); - pFrom = sqlite3SrcListAppend(pParse, 0, 0, 0); + tdsqlite3 *db = pParse->db; + int iDb = tdsqlite3SchemaToIndex(db, pView->pSchema); + pWhere = tdsqlite3ExprDup(db, pWhere, 0); + pFrom = tdsqlite3SrcListAppend(pParse, 0, 0, 0); if( pFrom ){ assert( pFrom->nSrc==1 ); - pFrom->a[0].zName = sqlite3DbStrDup(db, pView->zName); - pFrom->a[0].zDatabase = sqlite3DbStrDup(db, db->aDb[iDb].zDbSName); + pFrom->a[0].zName = tdsqlite3DbStrDup(db, pView->zName); + pFrom->a[0].zDatabase = tdsqlite3DbStrDup(db, db->aDb[iDb].zDbSName); assert( pFrom->a[0].pOn==0 ); assert( pFrom->a[0].pUsing==0 ); } - pSel = sqlite3SelectNew(pParse, 0, pFrom, pWhere, 0, 0, pOrderBy, + pSel = tdsqlite3SelectNew(pParse, 0, pFrom, pWhere, 0, 0, pOrderBy, SF_IncludeHidden, pLimit); - sqlite3SelectDestInit(&dest, SRT_EphemTab, iCur); - sqlite3Select(pParse, pSel, &dest); - sqlite3SelectDelete(db, pSel); + tdsqlite3SelectDestInit(&dest, SRT_EphemTab, iCur); + tdsqlite3Select(pParse, pSel, &dest); + tdsqlite3SelectDelete(db, pSel); } #endif /* !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) */ @@ -119255,7 +119255,7 @@ SQLITE_PRIVATE void sqlite3MaterializeView( ** \__________________________/ ** pLimitWhere (pInClause) */ -SQLITE_PRIVATE Expr *sqlite3LimitWhere( +SQLITE_PRIVATE Expr *tdsqlite3LimitWhere( Parse *pParse, /* The parser context */ SrcList *pSrc, /* the FROM clause -- which tables to scan */ Expr *pWhere, /* The WHERE clause. May be null */ @@ -119263,7 +119263,7 @@ SQLITE_PRIVATE Expr *sqlite3LimitWhere( Expr *pLimit, /* The LIMIT clause. May be null */ char *zStmtType /* Either DELETE or UPDATE. For err msgs. */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Expr *pLhs = NULL; /* LHS of IN(SELECT...) operator */ Expr *pInClause = NULL; /* WHERE rowid IN ( select ) */ ExprList *pEList = NULL; /* Expression list contaning only pSelectRowid */ @@ -119274,9 +119274,9 @@ SQLITE_PRIVATE Expr *sqlite3LimitWhere( /* Check that there isn't an ORDER BY without a LIMIT clause. */ if( pOrderBy && pLimit==0 ) { - sqlite3ErrorMsg(pParse, "ORDER BY without LIMIT on %s", zStmtType); - sqlite3ExprDelete(pParse->db, pWhere); - sqlite3ExprListDelete(pParse->db, pOrderBy); + tdsqlite3ErrorMsg(pParse, "ORDER BY without LIMIT on %s", zStmtType); + tdsqlite3ExprDelete(pParse->db, pWhere); + tdsqlite3ExprListDelete(pParse->db, pOrderBy); return 0; } @@ -119298,25 +119298,25 @@ SQLITE_PRIVATE Expr *sqlite3LimitWhere( pTab = pSrc->a[0].pTab; if( HasRowid(pTab) ){ - pLhs = sqlite3PExpr(pParse, TK_ROW, 0, 0); - pEList = sqlite3ExprListAppend( - pParse, 0, sqlite3PExpr(pParse, TK_ROW, 0, 0) + pLhs = tdsqlite3PExpr(pParse, TK_ROW, 0, 0); + pEList = tdsqlite3ExprListAppend( + pParse, 0, tdsqlite3PExpr(pParse, TK_ROW, 0, 0) ); }else{ - Index *pPk = sqlite3PrimaryKeyIndex(pTab); + Index *pPk = tdsqlite3PrimaryKeyIndex(pTab); if( pPk->nKeyCol==1 ){ const char *zName = pTab->aCol[pPk->aiColumn[0]].zName; - pLhs = sqlite3Expr(db, TK_ID, zName); - pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ID, zName)); + pLhs = tdsqlite3Expr(db, TK_ID, zName); + pEList = tdsqlite3ExprListAppend(pParse, 0, tdsqlite3Expr(db, TK_ID, zName)); }else{ int i; for(i=0; inKeyCol; i++){ - Expr *p = sqlite3Expr(db, TK_ID, pTab->aCol[pPk->aiColumn[i]].zName); - pEList = sqlite3ExprListAppend(pParse, pEList, p); + Expr *p = tdsqlite3Expr(db, TK_ID, pTab->aCol[pPk->aiColumn[i]].zName); + pEList = tdsqlite3ExprListAppend(pParse, pEList, p); } - pLhs = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); + pLhs = tdsqlite3PExpr(pParse, TK_VECTOR, 0, 0); if( pLhs ){ - pLhs->x.pList = sqlite3ExprListDup(db, pEList, 0); + pLhs->x.pList = tdsqlite3ExprListDup(db, pEList, 0); } } } @@ -119324,18 +119324,18 @@ SQLITE_PRIVATE Expr *sqlite3LimitWhere( /* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree ** and the SELECT subtree. */ pSrc->a[0].pTab = 0; - pSelectSrc = sqlite3SrcListDup(pParse->db, pSrc, 0); + pSelectSrc = tdsqlite3SrcListDup(pParse->db, pSrc, 0); pSrc->a[0].pTab = pTab; pSrc->a[0].pIBIndex = 0; /* generate the SELECT expression tree. */ - pSelect = sqlite3SelectNew(pParse, pEList, pSelectSrc, pWhere, 0 ,0, + pSelect = tdsqlite3SelectNew(pParse, pEList, pSelectSrc, pWhere, 0 ,0, pOrderBy,0,pLimit ); /* now generate the new WHERE rowid IN clause for the DELETE/UDPATE */ - pInClause = sqlite3PExpr(pParse, TK_IN, pLhs, 0); - sqlite3PExprAddSelect(pParse, pInClause, pSelect); + pInClause = tdsqlite3PExpr(pParse, TK_IN, pLhs, 0); + tdsqlite3PExprAddSelect(pParse, pInClause, pSelect); return pInClause; } #endif /* defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) */ @@ -119348,7 +119348,7 @@ SQLITE_PRIVATE Expr *sqlite3LimitWhere( ** \________/ \________________/ ** pTabList pWhere */ -SQLITE_PRIVATE void sqlite3DeleteFrom( +SQLITE_PRIVATE void tdsqlite3DeleteFrom( Parse *pParse, /* The parser context */ SrcList *pTabList, /* The table from which we should delete things */ Expr *pWhere, /* The WHERE clause. May be null */ @@ -119364,7 +119364,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( int iDataCur = 0; /* VDBE cursor for the canonical data source */ int iIdxCur = 0; /* Cursor number of the first index */ int nIdx; /* Number of indices */ - sqlite3 *db; /* Main database structure */ + tdsqlite3 *db; /* Main database structure */ AuthContext sContext; /* Authorization context */ NameContext sNC; /* Name context to resolve expressions in */ int iDb; /* Database number */ @@ -119404,20 +119404,20 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( ** will be calling are designed to work with multiple tables and expect ** an SrcList* parameter instead of just a Table* parameter. */ - pTab = sqlite3SrcListLookup(pParse, pTabList); + pTab = tdsqlite3SrcListLookup(pParse, pTabList); if( pTab==0 ) goto delete_from_cleanup; /* Figure out if we have any triggers and if the table being ** deleted from is a view */ #ifndef SQLITE_OMIT_TRIGGER - pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); + pTrigger = tdsqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); isView = pTab->pSelect!=0; #else # define pTrigger 0 # define isView 0 #endif - bComplex = pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0); + bComplex = pTrigger || tdsqlite3FkRequired(pParse, pTab, 0, 0); #ifdef SQLITE_OMIT_VIEW # undef isView # define isView 0 @@ -119425,7 +119425,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( #ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT if( !isView ){ - pWhere = sqlite3LimitWhere( + pWhere = tdsqlite3LimitWhere( pParse, pTabList, pWhere, pOrderBy, pLimit, "DELETE" ); pOrderBy = 0; @@ -119435,16 +119435,16 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( /* If pTab is really a view, make sure it has been initialized. */ - if( sqlite3ViewGetColumnNames(pParse, pTab) ){ + if( tdsqlite3ViewGetColumnNames(pParse, pTab) ){ goto delete_from_cleanup; } - if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){ + if( tdsqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){ goto delete_from_cleanup; } - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); + iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); assert( iDbnDb ); - rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, + rcauth = tdsqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, db->aDb[iDb].zDbSName); assert( rcauth==SQLITE_OK || rcauth==SQLITE_DENY || rcauth==SQLITE_IGNORE ); if( rcauth==SQLITE_DENY ){ @@ -119463,24 +119463,24 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( /* Start the view context */ if( isView ){ - sqlite3AuthContextPush(pParse, &sContext, pTab->zName); + tdsqlite3AuthContextPush(pParse, &sContext, pTab->zName); } /* Begin generating code. */ - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( v==0 ){ goto delete_from_cleanup; } - if( pParse->nested==0 ) sqlite3VdbeCountChanges(v); - sqlite3BeginWriteOperation(pParse, bComplex, iDb); + if( pParse->nested==0 ) tdsqlite3VdbeCountChanges(v); + tdsqlite3BeginWriteOperation(pParse, bComplex, iDb); /* If we are trying to delete from a view, realize that view into ** an ephemeral table. */ #if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) if( isView ){ - sqlite3MaterializeView(pParse, pTab, + tdsqlite3MaterializeView(pParse, pTab, pWhere, pOrderBy, pLimit, iTabCur ); iDataCur = iIdxCur = iTabCur; @@ -119494,7 +119494,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pParse; sNC.pSrcList = pTabList; - if( sqlite3ResolveExprNames(&sNC, pWhere) ){ + if( tdsqlite3ResolveExprNames(&sNC, pWhere) ){ goto delete_from_cleanup; } @@ -119506,14 +119506,14 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( && !pParse->pTriggerTab ){ memCnt = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Integer, 0, memCnt); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, memCnt); } #ifndef SQLITE_OMIT_TRUNCATE_OPTIMIZATION /* Special case: A DELETE without a WHERE clause deletes everything. ** It is easier just to erase the whole table. Prior to version 3.6.5, ** this optimization caused the row change count (the value returned by - ** API function sqlite3_count_changes) to be set incorrectly. + ** API function tdsqlite3_count_changes) to be set incorrectly. ** ** The "rcauth==SQLITE_OK" terms is the ** IMPLEMENTATION-OF: R-17228-37124 If the action code is SQLITE_DELETE and @@ -119530,14 +119530,14 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( #endif ){ assert( !isView ); - sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName); + tdsqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName); if( HasRowid(pTab) ){ - sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt ? memCnt : -1, + tdsqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt ? memCnt : -1, pTab->zName, P4_STATIC); } for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ assert( pIdx->pSchema==pTab->pSchema ); - sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb); + tdsqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb); } }else #endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */ @@ -119550,18 +119550,18 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( pPk = 0; nPk = 1; iRowSet = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Null, 0, iRowSet); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, iRowSet); }else{ /* For a WITHOUT ROWID table, create an ephemeral table used to ** hold all primary keys for rows to be deleted. */ - pPk = sqlite3PrimaryKeyIndex(pTab); + pPk = tdsqlite3PrimaryKeyIndex(pTab); assert( pPk!=0 ); nPk = pPk->nKeyCol; iPk = pParse->nMem+1; pParse->nMem += nPk; iEphCur = pParse->nTab++; - addrEphOpen = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEphCur, nPk); - sqlite3VdbeSetP4KeyInfo(pParse, pPk); + addrEphOpen = tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEphCur, nPk); + tdsqlite3VdbeSetP4KeyInfo(pParse, pPk); } /* Construct a query to find the rowid or primary key for every row @@ -119572,29 +119572,29 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( ** ONEPASS_SINGLE: One-pass approach - at most one row deleted. ** ONEPASS_MULTI: One-pass approach - any number of rows may be deleted. */ - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, wcf, iTabCur+1); + pWInfo = tdsqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, wcf, iTabCur+1); if( pWInfo==0 ) goto delete_from_cleanup; - eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); + eOnePass = tdsqlite3WhereOkOnePass(pWInfo, aiCurOnePass); assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI ); assert( IsVirtual(pTab) || bComplex || eOnePass!=ONEPASS_OFF ); - if( eOnePass!=ONEPASS_SINGLE ) sqlite3MultiWrite(pParse); + if( eOnePass!=ONEPASS_SINGLE ) tdsqlite3MultiWrite(pParse); /* Keep track of the number of rows to be deleted */ if( memCnt ){ - sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1); + tdsqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1); } /* Extract the rowid or primary key for the current row */ if( pPk ){ for(i=0; iaiColumn[i]>=0 ); - sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, + tdsqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, pPk->aiColumn[i], iPk+i); } iKey = iPk; }else{ iKey = ++pParse->nMem; - sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, -1, iKey); + tdsqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, -1, iKey); } if( eOnePass!=ONEPASS_OFF ){ @@ -119602,37 +119602,37 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( ** one, so just keep it in its register(s) and fall through to the ** delete code. */ nKey = nPk; /* OP_Found will use an unpacked key */ - aToOpen = sqlite3DbMallocRawNN(db, nIdx+2); + aToOpen = tdsqlite3DbMallocRawNN(db, nIdx+2); if( aToOpen==0 ){ - sqlite3WhereEnd(pWInfo); + tdsqlite3WhereEnd(pWInfo); goto delete_from_cleanup; } memset(aToOpen, 1, nIdx+1); aToOpen[nIdx+1] = 0; if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iTabCur] = 0; if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iTabCur] = 0; - if( addrEphOpen ) sqlite3VdbeChangeToNoop(v, addrEphOpen); + if( addrEphOpen ) tdsqlite3VdbeChangeToNoop(v, addrEphOpen); }else{ if( pPk ){ /* Add the PK key for this row to the temporary table */ iKey = ++pParse->nMem; nKey = 0; /* Zero tells OP_Found to use a composite key */ - sqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, iKey, - sqlite3IndexAffinityStr(pParse->db, pPk), nPk); - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iEphCur, iKey, iPk, nPk); + tdsqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, iKey, + tdsqlite3IndexAffinityStr(pParse->db, pPk), nPk); + tdsqlite3VdbeAddOp4Int(v, OP_IdxInsert, iEphCur, iKey, iPk, nPk); }else{ /* Add the rowid of the row to be deleted to the RowSet */ nKey = 1; /* OP_DeferredSeek always uses a single rowid */ - sqlite3VdbeAddOp2(v, OP_RowSetAdd, iRowSet, iKey); + tdsqlite3VdbeAddOp2(v, OP_RowSetAdd, iRowSet, iKey); } } /* If this DELETE cannot use the ONEPASS strategy, this is the ** end of the WHERE loop */ if( eOnePass!=ONEPASS_OFF ){ - addrBypass = sqlite3VdbeMakeLabel(pParse); + addrBypass = tdsqlite3VdbeMakeLabel(pParse); }else{ - sqlite3WhereEnd(pWInfo); + tdsqlite3WhereEnd(pWInfo); } /* Unless this is a view, open cursors for the table we are @@ -119643,14 +119643,14 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( if( !isView ){ int iAddrOnce = 0; if( eOnePass==ONEPASS_MULTI ){ - iAddrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); + iAddrOnce = tdsqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } testcase( IsVirtual(pTab) ); - sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, OPFLAG_FORDELETE, + tdsqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, OPFLAG_FORDELETE, iTabCur, aToOpen, &iDataCur, &iIdxCur); assert( pPk || IsVirtual(pTab) || iDataCur==iTabCur ); assert( pPk || IsVirtual(pTab) || iIdxCur==iDataCur+1 ); - if( eOnePass==ONEPASS_MULTI ) sqlite3VdbeJumpHere(v, iAddrOnce); + if( eOnePass==ONEPASS_MULTI ) tdsqlite3VdbeJumpHere(v, iAddrOnce); } /* Set up a loop over the rowids/primary-keys that were found in the @@ -119660,19 +119660,19 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( assert( nKey==nPk ); /* OP_Found will use an unpacked key */ if( !IsVirtual(pTab) && aToOpen[iDataCur-iTabCur] ){ assert( pPk!=0 || pTab->pSelect!=0 ); - sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, addrBypass, iKey, nKey); + tdsqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, addrBypass, iKey, nKey); VdbeCoverage(v); } }else if( pPk ){ - addrLoop = sqlite3VdbeAddOp1(v, OP_Rewind, iEphCur); VdbeCoverage(v); + addrLoop = tdsqlite3VdbeAddOp1(v, OP_Rewind, iEphCur); VdbeCoverage(v); if( IsVirtual(pTab) ){ - sqlite3VdbeAddOp3(v, OP_Column, iEphCur, 0, iKey); + tdsqlite3VdbeAddOp3(v, OP_Column, iEphCur, 0, iKey); }else{ - sqlite3VdbeAddOp2(v, OP_RowData, iEphCur, iKey); + tdsqlite3VdbeAddOp2(v, OP_RowData, iEphCur, iKey); } assert( nKey==0 ); /* OP_Found will use a composite key */ }else{ - addrLoop = sqlite3VdbeAddOp3(v, OP_RowSetRead, iRowSet, 0, iKey); + addrLoop = tdsqlite3VdbeAddOp3(v, OP_RowSetRead, iRowSet, 0, iKey); VdbeCoverage(v); assert( nKey==1 ); } @@ -119680,36 +119680,36 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( /* Delete the row */ #ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pTab) ){ - const char *pVTab = (const char *)sqlite3GetVTable(db, pTab); - sqlite3VtabMakeWritable(pParse, pTab); + const char *pVTab = (const char *)tdsqlite3GetVTable(db, pTab); + tdsqlite3VtabMakeWritable(pParse, pTab); assert( eOnePass==ONEPASS_OFF || eOnePass==ONEPASS_SINGLE ); - sqlite3MayAbort(pParse); + tdsqlite3MayAbort(pParse); if( eOnePass==ONEPASS_SINGLE ){ - sqlite3VdbeAddOp1(v, OP_Close, iTabCur); - if( sqlite3IsToplevel(pParse) ){ + tdsqlite3VdbeAddOp1(v, OP_Close, iTabCur); + if( tdsqlite3IsToplevel(pParse) ){ pParse->isMultiWrite = 0; } } - sqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iKey, pVTab, P4_VTAB); - sqlite3VdbeChangeP5(v, OE_Abort); + tdsqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iKey, pVTab, P4_VTAB); + tdsqlite3VdbeChangeP5(v, OE_Abort); }else #endif { int count = (pParse->nested==0); /* True to count changes */ - sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, + tdsqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, iKey, nKey, count, OE_Default, eOnePass, aiCurOnePass[1]); } /* End of the loop over all rowids/primary-keys. */ if( eOnePass!=ONEPASS_OFF ){ - sqlite3VdbeResolveLabel(v, addrBypass); - sqlite3WhereEnd(pWInfo); + tdsqlite3VdbeResolveLabel(v, addrBypass); + tdsqlite3WhereEnd(pWInfo); }else if( pPk ){ - sqlite3VdbeAddOp2(v, OP_Next, iEphCur, addrLoop+1); VdbeCoverage(v); - sqlite3VdbeJumpHere(v, addrLoop); + tdsqlite3VdbeAddOp2(v, OP_Next, iEphCur, addrLoop+1); VdbeCoverage(v); + tdsqlite3VdbeJumpHere(v, addrLoop); }else{ - sqlite3VdbeGoto(v, addrLoop); - sqlite3VdbeJumpHere(v, addrLoop); + tdsqlite3VdbeGoto(v, addrLoop); + tdsqlite3VdbeJumpHere(v, addrLoop); } } /* End non-truncate path */ @@ -119718,28 +119718,28 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( ** autoincrement tables. */ if( pParse->nested==0 && pParse->pTriggerTab==0 ){ - sqlite3AutoincrementEnd(pParse); + tdsqlite3AutoincrementEnd(pParse); } /* Return the number of rows that were deleted. If this routine is - ** generating code because of a call to sqlite3NestedParse(), do not + ** generating code because of a call to tdsqlite3NestedParse(), do not ** invoke the callback function. */ if( memCnt ){ - sqlite3VdbeAddOp2(v, OP_ResultRow, memCnt, 1); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, memCnt, 1); + tdsqlite3VdbeSetNumCols(v, 1); + tdsqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC); } delete_from_cleanup: - sqlite3AuthContextPop(&sContext); - sqlite3SrcListDelete(db, pTabList); - sqlite3ExprDelete(db, pWhere); + tdsqlite3AuthContextPop(&sContext); + tdsqlite3SrcListDelete(db, pTabList); + tdsqlite3ExprDelete(db, pWhere); #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) - sqlite3ExprListDelete(db, pOrderBy); - sqlite3ExprDelete(db, pLimit); + tdsqlite3ExprListDelete(db, pOrderBy); + tdsqlite3ExprDelete(db, pLimit); #endif - sqlite3DbFree(db, aToOpen); + tdsqlite3DbFree(db, aToOpen); return; } /* Make sure "isView" and other macros defined above are undefined. Otherwise @@ -119793,7 +119793,7 @@ delete_from_cleanup: ** Except, this optimization is disabled if there are BEFORE triggers since ** the trigger body might have moved the cursor. */ -SQLITE_PRIVATE void sqlite3GenerateRowDelete( +SQLITE_PRIVATE void tdsqlite3GenerateRowDelete( Parse *pParse, /* Parsing context */ Table *pTab, /* Table containing the row to be deleted */ Trigger *pTrigger, /* List of triggers to (potentially) fire */ @@ -119819,45 +119819,45 @@ SQLITE_PRIVATE void sqlite3GenerateRowDelete( /* Seek cursor iCur to the row to delete. If this row no longer exists ** (this can happen if a trigger program has already deleted it), do ** not attempt to delete it or fire any DELETE triggers. */ - iLabel = sqlite3VdbeMakeLabel(pParse); + iLabel = tdsqlite3VdbeMakeLabel(pParse); opSeek = HasRowid(pTab) ? OP_NotExists : OP_NotFound; if( eMode==ONEPASS_OFF ){ - sqlite3VdbeAddOp4Int(v, opSeek, iDataCur, iLabel, iPk, nPk); + tdsqlite3VdbeAddOp4Int(v, opSeek, iDataCur, iLabel, iPk, nPk); VdbeCoverageIf(v, opSeek==OP_NotExists); VdbeCoverageIf(v, opSeek==OP_NotFound); } /* If there are any triggers to fire, allocate a range of registers to ** use for the old.* references in the triggers. */ - if( sqlite3FkRequired(pParse, pTab, 0, 0) || pTrigger ){ + if( tdsqlite3FkRequired(pParse, pTab, 0, 0) || pTrigger ){ u32 mask; /* Mask of OLD.* columns in use */ int iCol; /* Iterator used while populating OLD.* */ int addrStart; /* Start of BEFORE trigger programs */ /* TODO: Could use temporary registers here. Also could attempt to ** avoid copying the contents of the rowid register. */ - mask = sqlite3TriggerColmask( + mask = tdsqlite3TriggerColmask( pParse, pTrigger, 0, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onconf ); - mask |= sqlite3FkOldmask(pParse, pTab); + mask |= tdsqlite3FkOldmask(pParse, pTab); iOld = pParse->nMem+1; pParse->nMem += (1 + pTab->nCol); /* Populate the OLD.* pseudo-table register array. These values will be ** used by any BEFORE and AFTER triggers that exist. */ - sqlite3VdbeAddOp2(v, OP_Copy, iPk, iOld); + tdsqlite3VdbeAddOp2(v, OP_Copy, iPk, iOld); for(iCol=0; iColnCol; iCol++){ testcase( mask!=0xffffffff && iCol==31 ); testcase( mask!=0xffffffff && iCol==32 ); if( mask==0xffffffff || (iCol<=31 && (mask & MASKBIT32(iCol))!=0) ){ - int kk = sqlite3TableColumnToStorage(pTab, iCol); - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, iCol, iOld+kk+1); + int kk = tdsqlite3TableColumnToStorage(pTab, iCol); + tdsqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, iCol, iOld+kk+1); } } /* Invoke BEFORE DELETE trigger programs. */ - addrStart = sqlite3VdbeCurrentAddr(v); - sqlite3CodeRowTrigger(pParse, pTrigger, + addrStart = tdsqlite3VdbeCurrentAddr(v); + tdsqlite3CodeRowTrigger(pParse, pTrigger, TK_DELETE, 0, TRIGGER_BEFORE, pTab, iOld, onconf, iLabel ); @@ -119869,8 +119869,8 @@ SQLITE_PRIVATE void sqlite3GenerateRowDelete( ** Also disable the iIdxNoSeek optimization since the BEFORE trigger ** may have moved that cursor. */ - if( addrStart=0 ); @@ -119880,7 +119880,7 @@ SQLITE_PRIVATE void sqlite3GenerateRowDelete( /* Do FK processing. This call checks that any FK constraints that ** refer to this table (i.e. constraints attached to other tables) ** are not violated by deleting this row. */ - sqlite3FkCheck(pParse, pTab, iOld, 0, 0, 0); + tdsqlite3FkCheck(pParse, pTab, iOld, 0, 0, 0); } /* Delete the index and table entries. Skip this step if pTab is really @@ -119895,35 +119895,35 @@ SQLITE_PRIVATE void sqlite3GenerateRowDelete( */ if( pTab->pSelect==0 ){ u8 p5 = 0; - sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,iIdxNoSeek); - sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, (count?OPFLAG_NCHANGE:0)); - if( pParse->nested==0 || 0==sqlite3_stricmp(pTab->zName, "sqlite_stat1") ){ - sqlite3VdbeAppendP4(v, (char*)pTab, P4_TABLE); + tdsqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,iIdxNoSeek); + tdsqlite3VdbeAddOp2(v, OP_Delete, iDataCur, (count?OPFLAG_NCHANGE:0)); + if( pParse->nested==0 || 0==tdsqlite3_stricmp(pTab->zName, "sqlite_stat1") ){ + tdsqlite3VdbeAppendP4(v, (char*)pTab, P4_TABLE); } if( eMode!=ONEPASS_OFF ){ - sqlite3VdbeChangeP5(v, OPFLAG_AUXDELETE); + tdsqlite3VdbeChangeP5(v, OPFLAG_AUXDELETE); } if( iIdxNoSeek>=0 && iIdxNoSeek!=iDataCur ){ - sqlite3VdbeAddOp1(v, OP_Delete, iIdxNoSeek); + tdsqlite3VdbeAddOp1(v, OP_Delete, iIdxNoSeek); } if( eMode==ONEPASS_MULTI ) p5 |= OPFLAG_SAVEPOSITION; - sqlite3VdbeChangeP5(v, p5); + tdsqlite3VdbeChangeP5(v, p5); } /* Do any ON CASCADE, SET NULL or SET DEFAULT operations required to ** handle rows (possibly in other tables) that refer via a foreign key ** to the row just deleted. */ - sqlite3FkActions(pParse, pTab, 0, iOld, 0, 0); + tdsqlite3FkActions(pParse, pTab, 0, iOld, 0, 0); /* Invoke AFTER DELETE trigger programs. */ - sqlite3CodeRowTrigger(pParse, pTrigger, + tdsqlite3CodeRowTrigger(pParse, pTrigger, TK_DELETE, 0, TRIGGER_AFTER, pTab, iOld, onconf, iLabel ); /* Jump here if the row had already been deleted before any BEFORE ** trigger programs were invoked. Or if a trigger program throws a ** RAISE(IGNORE) exception. */ - sqlite3VdbeResolveLabel(v, iLabel); + tdsqlite3VdbeResolveLabel(v, iLabel); VdbeModuleComment((v, "END: GenRowDel()")); } @@ -119945,7 +119945,7 @@ SQLITE_PRIVATE void sqlite3GenerateRowDelete( ** 3. The "iDataCur" cursor must be already be positioned on the row ** that is to be deleted. */ -SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete( +SQLITE_PRIVATE void tdsqlite3GenerateRowIndexDelete( Parse *pParse, /* Parsing and code generating context */ Table *pTab, /* Table containing the row to be deleted */ int iDataCur, /* Cursor of table holding data. */ @@ -119962,18 +119962,18 @@ SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete( Index *pPk; /* PRIMARY KEY index, or NULL for rowid tables */ v = pParse->pVdbe; - pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab); + pPk = HasRowid(pTab) ? 0 : tdsqlite3PrimaryKeyIndex(pTab); for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){ assert( iIdxCur+i!=iDataCur || pPk==pIdx ); if( aRegIdx!=0 && aRegIdx[i]==0 ) continue; if( pIdx==pPk ) continue; if( iIdxCur+i==iIdxNoSeek ) continue; VdbeModuleComment((v, "GenRowIdxDel for %s", pIdx->zName)); - r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 1, + r1 = tdsqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 1, &iPartIdxLabel, pPrior, r1); - sqlite3VdbeAddOp3(v, OP_IdxDelete, iIdxCur+i, r1, + tdsqlite3VdbeAddOp3(v, OP_IdxDelete, iIdxCur+i, r1, pIdx->uniqNotNull ? pIdx->nKeyCol : pIdx->nColumn); - sqlite3ResolvePartIdxLabel(pParse, iPartIdxLabel); + tdsqlite3ResolvePartIdxLabel(pParse, iPartIdxLabel); pPrior = pIdx; } } @@ -119992,11 +119992,11 @@ SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete( ** ** If *piPartIdxLabel is not NULL, fill it in with a label and jump ** to that label if pIdx is a partial index that should be skipped. -** The label should be resolved using sqlite3ResolvePartIdxLabel(). +** The label should be resolved using tdsqlite3ResolvePartIdxLabel(). ** A partial index should be skipped if its WHERE clause evaluates ** to false or null. If pIdx is not a partial index, *piPartIdxLabel ** will be set to zero which is an empty label that is ignored by -** sqlite3ResolvePartIdxLabel(). +** tdsqlite3ResolvePartIdxLabel(). ** ** The pPrior and regPrior parameters are used to implement a cache to ** avoid unnecessary register loads. If pPrior is not NULL, then it is @@ -120009,7 +120009,7 @@ SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete( ** on a table with multiple indices, and especially with the ROWID or ** PRIMARY KEY columns of the index. */ -SQLITE_PRIVATE int sqlite3GenerateIndexKey( +SQLITE_PRIVATE int tdsqlite3GenerateIndexKey( Parse *pParse, /* Parsing context */ Index *pIdx, /* The index for which to generate a key */ int iDataCur, /* Cursor number from which to take column data */ @@ -120026,9 +120026,9 @@ SQLITE_PRIVATE int sqlite3GenerateIndexKey( if( piPartIdxLabel ){ if( pIdx->pPartIdxWhere ){ - *piPartIdxLabel = sqlite3VdbeMakeLabel(pParse); + *piPartIdxLabel = tdsqlite3VdbeMakeLabel(pParse); pParse->iSelfTab = iDataCur + 1; - sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel, + tdsqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel, SQLITE_JUMPIFNULL); pParse->iSelfTab = 0; pPrior = 0; /* Ticket a9efb42811fa41ee 2019-11-02; @@ -120038,7 +120038,7 @@ SQLITE_PRIVATE int sqlite3GenerateIndexKey( } } nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn; - regBase = sqlite3GetTempRange(pParse, nCol); + regBase = tdsqlite3GetTempRange(pParse, nCol); if( pPrior && (regBase!=regPrior || pPrior->pPartIdxWhere) ) pPrior = 0; for(j=0; jpTable->pSelect ){ - const char *zAff = sqlite3IndexAffinityStr(pParse->db, pIdx); - sqlite3VdbeChangeP4(v, -1, zAff, P4_TRANSIENT); + const char *zAff = tdsqlite3IndexAffinityStr(pParse->db, pIdx); + tdsqlite3VdbeChangeP4(v, -1, zAff, P4_TRANSIENT); } } - sqlite3ReleaseTempRange(pParse, regBase, nCol); + tdsqlite3ReleaseTempRange(pParse, regBase, nCol); return regBase; } /* -** If a prior call to sqlite3GenerateIndexKey() generated a jump-over label +** If a prior call to tdsqlite3GenerateIndexKey() generated a jump-over label ** because it was a partial index, then this routine should be called to ** resolve that label. */ -SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse *pParse, int iLabel){ +SQLITE_PRIVATE void tdsqlite3ResolvePartIdxLabel(Parse *pParse, int iLabel){ if( iLabel ){ - sqlite3VdbeResolveLabel(pParse->pVdbe, iLabel); + tdsqlite3VdbeResolveLabel(pParse->pVdbe, iLabel); } } @@ -120107,7 +120107,7 @@ SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse *pParse, int iLabel){ /* ** Return the collating function associated with a function. */ -static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){ +static CollSeq *tdsqlite3GetFuncCollSeq(tdsqlite3_context *context){ VdbeOp *pOp; assert( context->pVdbe!=0 ); pOp = &context->pVdbe->aOp[context->iOp-1]; @@ -120120,7 +120120,7 @@ static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){ ** Indicate that the accumulator load should be skipped on this ** iteration of the aggregate loop. */ -static void sqlite3SkipAccumulatorLoad(sqlite3_context *context){ +static void tdsqlite3SkipAccumulatorLoad(tdsqlite3_context *context){ assert( context->isError<=0 ); context->isError = -1; context->skipFlag = 1; @@ -120130,9 +120130,9 @@ static void sqlite3SkipAccumulatorLoad(sqlite3_context *context){ ** Implementation of the non-aggregate min() and max() functions */ static void minmaxFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ int i; int mask; /* 0 for min() or 0xffffffff for max() */ @@ -120140,32 +120140,32 @@ static void minmaxFunc( CollSeq *pColl; assert( argc>1 ); - mask = sqlite3_user_data(context)==0 ? 0 : -1; - pColl = sqlite3GetFuncCollSeq(context); + mask = tdsqlite3_user_data(context)==0 ? 0 : -1; + pColl = tdsqlite3GetFuncCollSeq(context); assert( pColl ); assert( mask==-1 || mask==0 ); iBest = 0; - if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; + if( tdsqlite3_value_type(argv[0])==SQLITE_NULL ) return; for(i=1; i=0 ){ + if( tdsqlite3_value_type(argv[i])==SQLITE_NULL ) return; + if( (tdsqlite3MemCompare(argv[iBest], argv[i], pColl)^mask)>=0 ){ testcase( mask==0 ); iBest = i; } } - sqlite3_result_value(context, argv[iBest]); + tdsqlite3_result_value(context, argv[iBest]); } /* ** Return the type of the argument. */ static void typeofFunc( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **argv + tdsqlite3_value **argv ){ static const char *azType[] = { "integer", "real", "text", "blob", "null" }; - int i = sqlite3_value_type(argv[0]) - 1; + int i = tdsqlite3_value_type(argv[0]) - 1; UNUSED_PARAMETER(NotUsed); assert( i>=0 && i0 ){ if( typeHaystack==SQLITE_BLOB && typeNeedle==SQLITE_BLOB ){ - zHaystack = sqlite3_value_blob(argv[0]); - zNeedle = sqlite3_value_blob(argv[1]); + zHaystack = tdsqlite3_value_blob(argv[0]); + zNeedle = tdsqlite3_value_blob(argv[1]); isText = 0; }else if( typeHaystack!=SQLITE_BLOB && typeNeedle!=SQLITE_BLOB ){ - zHaystack = sqlite3_value_text(argv[0]); - zNeedle = sqlite3_value_text(argv[1]); + zHaystack = tdsqlite3_value_text(argv[0]); + zNeedle = tdsqlite3_value_text(argv[1]); isText = 1; }else{ - pC1 = sqlite3_value_dup(argv[0]); - zHaystack = sqlite3_value_text(pC1); + pC1 = tdsqlite3_value_dup(argv[0]); + zHaystack = tdsqlite3_value_text(pC1); if( zHaystack==0 ) goto endInstrOOM; - nHaystack = sqlite3_value_bytes(pC1); - pC2 = sqlite3_value_dup(argv[1]); - zNeedle = sqlite3_value_text(pC2); + nHaystack = tdsqlite3_value_bytes(pC1); + pC2 = tdsqlite3_value_dup(argv[1]); + zNeedle = tdsqlite3_value_text(pC2); if( zNeedle==0 ) goto endInstrOOM; - nNeedle = sqlite3_value_bytes(pC2); + nNeedle = tdsqlite3_value_bytes(pC2); isText = 1; } if( zNeedle==0 || (nHaystack && zHaystack==0) ) goto endInstrOOM; @@ -120330,13 +120330,13 @@ static void instrFunc( } if( nNeedle>nHaystack ) N = 0; } - sqlite3_result_int(context, N); + tdsqlite3_result_int(context, N); endInstr: - sqlite3_value_free(pC1); - sqlite3_value_free(pC2); + tdsqlite3_value_free(pC1); + tdsqlite3_value_free(pC2); return; endInstrOOM: - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); goto endInstr; } @@ -120344,25 +120344,25 @@ endInstrOOM: ** Implementation of the printf() function. */ static void printfFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ PrintfArguments x; StrAccum str; const char *zFormat; int n; - sqlite3 *db = sqlite3_context_db_handle(context); + tdsqlite3 *db = tdsqlite3_context_db_handle(context); - if( argc>=1 && (zFormat = (const char*)sqlite3_value_text(argv[0]))!=0 ){ + if( argc>=1 && (zFormat = (const char*)tdsqlite3_value_text(argv[0]))!=0 ){ x.nArg = argc-1; x.nUsed = 0; x.apArg = argv+1; - sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]); + tdsqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]); str.printfFlags = SQLITE_PRINTF_SQLFUNC; - sqlite3_str_appendf(&str, zFormat, &x); + tdsqlite3_str_appendf(&str, zFormat, &x); n = str.nChar; - sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n, + tdsqlite3_result_text(context, tdsqlite3StrAccumFinish(&str), n, SQLITE_DYNAMIC); } } @@ -120380,9 +120380,9 @@ static void printfFunc( ** If p2 is negative, return the p2 characters preceding p1. */ static void substrFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ const unsigned char *z; const unsigned char *z2; @@ -120392,20 +120392,20 @@ static void substrFunc( int negP2 = 0; assert( argc==3 || argc==2 ); - if( sqlite3_value_type(argv[1])==SQLITE_NULL - || (argc==3 && sqlite3_value_type(argv[2])==SQLITE_NULL) + if( tdsqlite3_value_type(argv[1])==SQLITE_NULL + || (argc==3 && tdsqlite3_value_type(argv[2])==SQLITE_NULL) ){ return; } - p0type = sqlite3_value_type(argv[0]); - p1 = sqlite3_value_int(argv[1]); + p0type = tdsqlite3_value_type(argv[0]); + p1 = tdsqlite3_value_int(argv[1]); if( p0type==SQLITE_BLOB ){ - len = sqlite3_value_bytes(argv[0]); - z = sqlite3_value_blob(argv[0]); + len = tdsqlite3_value_bytes(argv[0]); + z = tdsqlite3_value_blob(argv[0]); if( z==0 ) return; - assert( len==sqlite3_value_bytes(argv[0]) ); + assert( len==tdsqlite3_value_bytes(argv[0]) ); }else{ - z = sqlite3_value_text(argv[0]); + z = tdsqlite3_value_text(argv[0]); if( z==0 ) return; len = 0; if( p1<0 ){ @@ -120423,13 +120423,13 @@ static void substrFunc( if( p1==0 ) p1 = 1; /* */ #endif if( argc==3 ){ - p2 = sqlite3_value_int(argv[2]); + p2 = tdsqlite3_value_int(argv[2]); if( p2<0 ){ p2 = -p2; negP2 = 1; } }else{ - p2 = sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH]; + p2 = tdsqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH]; } if( p1<0 ){ p1 += len; @@ -120459,14 +120459,14 @@ static void substrFunc( for(z2=z; *z2 && p2; p2--){ SQLITE_SKIP_UTF8(z2); } - sqlite3_result_text64(context, (char*)z, z2-z, SQLITE_TRANSIENT, + tdsqlite3_result_text64(context, (char*)z, z2-z, SQLITE_TRANSIENT, SQLITE_UTF8); }else{ if( p1+p2>len ){ p2 = len-p1; if( p2<0 ) p2 = 0; } - sqlite3_result_blob64(context, (char*)&z[p1], (u64)p2, SQLITE_TRANSIENT); + tdsqlite3_result_blob64(context, (char*)&z[p1], (u64)p2, SQLITE_TRANSIENT); } } @@ -120474,19 +120474,19 @@ static void substrFunc( ** Implementation of the round() function */ #ifndef SQLITE_OMIT_FLOATING_POINT -static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ +static void roundFunc(tdsqlite3_context *context, int argc, tdsqlite3_value **argv){ int n = 0; double r; char *zBuf; assert( argc==1 || argc==2 ); if( argc==2 ){ - if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return; - n = sqlite3_value_int(argv[1]); + if( SQLITE_NULL==tdsqlite3_value_type(argv[1]) ) return; + n = tdsqlite3_value_int(argv[1]); if( n>30 ) n = 30; if( n<0 ) n = 0; } - if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; - r = sqlite3_value_double(argv[0]); + if( tdsqlite3_value_type(argv[0])==SQLITE_NULL ) return; + r = tdsqlite3_value_double(argv[0]); /* If Y==0 and X will fit in a 64-bit int, ** handle the rounding directly, ** otherwise use printf. @@ -120496,38 +120496,38 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ }else if( n==0 ){ r = (double)((sqlite_int64)(r+(r<0?-0.5:+0.5))); }else{ - zBuf = sqlite3_mprintf("%.*f",n,r); + zBuf = tdsqlite3_mprintf("%.*f",n,r); if( zBuf==0 ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); return; } - sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8); - sqlite3_free(zBuf); + tdsqlite3AtoF(zBuf, &r, tdsqlite3Strlen30(zBuf), SQLITE_UTF8); + tdsqlite3_free(zBuf); } - sqlite3_result_double(context, r); + tdsqlite3_result_double(context, r); } #endif /* -** Allocate nByte bytes of space using sqlite3Malloc(). If the -** allocation fails, call sqlite3_result_error_nomem() to notify +** Allocate nByte bytes of space using tdsqlite3Malloc(). If the +** allocation fails, call tdsqlite3_result_error_nomem() to notify ** the database handle that malloc() has failed and return NULL. ** If nByte is larger than the maximum string or blob length, then ** raise an SQLITE_TOOBIG exception and return NULL. */ -static void *contextMalloc(sqlite3_context *context, i64 nByte){ +static void *contextMalloc(tdsqlite3_context *context, i64 nByte){ char *z; - sqlite3 *db = sqlite3_context_db_handle(context); + tdsqlite3 *db = tdsqlite3_context_db_handle(context); assert( nByte>0 ); testcase( nByte==db->aLimit[SQLITE_LIMIT_LENGTH] ); testcase( nByte==db->aLimit[SQLITE_LIMIT_LENGTH]+1 ); if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){ - sqlite3_result_error_toobig(context); + tdsqlite3_result_error_toobig(context); z = 0; }else{ - z = sqlite3Malloc(nByte); + z = tdsqlite3Malloc(nByte); if( !z ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); } } return z; @@ -120536,41 +120536,41 @@ static void *contextMalloc(sqlite3_context *context, i64 nByte){ /* ** Implementation of the upper() and lower() SQL functions. */ -static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ +static void upperFunc(tdsqlite3_context *context, int argc, tdsqlite3_value **argv){ char *z1; const char *z2; int i, n; UNUSED_PARAMETER(argc); - z2 = (char*)sqlite3_value_text(argv[0]); - n = sqlite3_value_bytes(argv[0]); + z2 = (char*)tdsqlite3_value_text(argv[0]); + n = tdsqlite3_value_bytes(argv[0]); /* Verify that the call to _bytes() does not invalidate the _text() pointer */ - assert( z2==(char*)sqlite3_value_text(argv[0]) ); + assert( z2==(char*)tdsqlite3_value_text(argv[0]) ); if( z2 ){ z1 = contextMalloc(context, ((i64)n)+1); if( z1 ){ for(i=0; imatchSet==0 ){ - c = sqlite3Utf8Read(&zPattern); + c = tdsqlite3Utf8Read(&zPattern); if( c==0 ) return SQLITE_NOWILDCARDMATCH; }else{ /* "[...]" immediately follows the "*". We have to do a slow @@ -120814,8 +120814,8 @@ static int patternCompare( char zStop[3]; int bMatch; if( noCase ){ - zStop[0] = sqlite3Toupper(c); - zStop[1] = sqlite3Tolower(c); + zStop[0] = tdsqlite3Toupper(c); + zStop[1] = tdsqlite3Tolower(c); zStop[2] = 0; }else{ zStop[0] = c; @@ -120840,27 +120840,27 @@ static int patternCompare( } if( c==matchOther ){ if( pInfo->matchSet==0 ){ - c = sqlite3Utf8Read(&zPattern); + c = tdsqlite3Utf8Read(&zPattern); if( c==0 ) return SQLITE_NOMATCH; zEscaped = zPattern; }else{ u32 prior_c = 0; int seen = 0; int invert = 0; - c = sqlite3Utf8Read(&zString); + c = tdsqlite3Utf8Read(&zString); if( c==0 ) return SQLITE_NOMATCH; - c2 = sqlite3Utf8Read(&zPattern); + c2 = tdsqlite3Utf8Read(&zPattern); if( c2=='^' ){ invert = 1; - c2 = sqlite3Utf8Read(&zPattern); + c2 = tdsqlite3Utf8Read(&zPattern); } if( c2==']' ){ if( c==']' ) seen = 1; - c2 = sqlite3Utf8Read(&zPattern); + c2 = tdsqlite3Utf8Read(&zPattern); } while( c2 && c2!=']' ){ if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){ - c2 = sqlite3Utf8Read(&zPattern); + c2 = tdsqlite3Utf8Read(&zPattern); if( c>=prior_c && c<=c2 ) seen = 1; prior_c = 0; }else{ @@ -120869,7 +120869,7 @@ static int patternCompare( } prior_c = c2; } - c2 = sqlite3Utf8Read(&zPattern); + c2 = tdsqlite3Utf8Read(&zPattern); } if( c2==0 || (seen ^ invert)==0 ){ return SQLITE_NOMATCH; @@ -120879,7 +120879,7 @@ static int patternCompare( } c2 = Utf8Read(zString); if( c==c2 ) continue; - if( noCase && sqlite3Tolower(c)==sqlite3Tolower(c2) && c<0x80 && c2<0x80 ){ + if( noCase && tdsqlite3Tolower(c)==tdsqlite3Tolower(c2) && c<0x80 && c2<0x80 ){ continue; } if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue; @@ -120889,18 +120889,18 @@ static int patternCompare( } /* -** The sqlite3_strglob() interface. Return 0 on a match (like strcmp()) and +** The tdsqlite3_strglob() interface. Return 0 on a match (like strcmp()) and ** non-zero if there is no match. */ -SQLITE_API int sqlite3_strglob(const char *zGlobPattern, const char *zString){ +SQLITE_API int tdsqlite3_strglob(const char *zGlobPattern, const char *zString){ return patternCompare((u8*)zGlobPattern, (u8*)zString, &globInfo, '['); } /* -** The sqlite3_strlike() interface. Return 0 on a match and non-zero for +** The tdsqlite3_strlike() interface. Return 0 on a match and non-zero for ** a miss - like strcmp(). */ -SQLITE_API int sqlite3_strlike(const char *zPattern, const char *zStr, unsigned int esc){ +SQLITE_API int tdsqlite3_strlike(const char *zPattern, const char *zStr, unsigned int esc){ return patternCompare((u8*)zPattern, (u8*)zStr, &likeInfoNorm, esc); } @@ -120910,7 +120910,7 @@ SQLITE_API int sqlite3_strlike(const char *zPattern, const char *zStr, unsigned ** only. */ #ifdef SQLITE_TEST -SQLITE_API int sqlite3_like_count = 0; +SQLITE_API int tdsqlite3_like_count = 0; #endif @@ -120927,24 +120927,24 @@ SQLITE_API int sqlite3_like_count = 0; ** the GLOB operator. */ static void likeFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ const unsigned char *zA, *zB; u32 escape; int nPat; - sqlite3 *db = sqlite3_context_db_handle(context); - struct compareInfo *pInfo = sqlite3_user_data(context); + tdsqlite3 *db = tdsqlite3_context_db_handle(context); + struct compareInfo *pInfo = tdsqlite3_user_data(context); #ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS - if( sqlite3_value_type(argv[0])==SQLITE_BLOB - || sqlite3_value_type(argv[1])==SQLITE_BLOB + if( tdsqlite3_value_type(argv[0])==SQLITE_BLOB + || tdsqlite3_value_type(argv[1])==SQLITE_BLOB ){ #ifdef SQLITE_TEST - sqlite3_like_count++; + tdsqlite3_like_count++; #endif - sqlite3_result_int(context, 0); + tdsqlite3_result_int(context, 0); return; } #endif @@ -120952,35 +120952,35 @@ static void likeFunc( /* Limit the length of the LIKE or GLOB pattern to avoid problems ** of deep recursion and N*N behavior in patternCompare(). */ - nPat = sqlite3_value_bytes(argv[0]); + nPat = tdsqlite3_value_bytes(argv[0]); testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ); testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]+1 ); if( nPat > db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ){ - sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1); + tdsqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1); return; } if( argc==3 ){ /* The escape character string must consist of a single UTF-8 character. ** Otherwise, return an error. */ - const unsigned char *zEsc = sqlite3_value_text(argv[2]); + const unsigned char *zEsc = tdsqlite3_value_text(argv[2]); if( zEsc==0 ) return; - if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){ - sqlite3_result_error(context, + if( tdsqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){ + tdsqlite3_result_error(context, "ESCAPE expression must be a single character", -1); return; } - escape = sqlite3Utf8Read(&zEsc); + escape = tdsqlite3Utf8Read(&zEsc); }else{ escape = pInfo->matchSet; } - zB = sqlite3_value_text(argv[0]); - zA = sqlite3_value_text(argv[1]); + zB = tdsqlite3_value_text(argv[0]); + zA = tdsqlite3_value_text(argv[1]); if( zA && zB ){ #ifdef SQLITE_TEST - sqlite3_like_count++; + tdsqlite3_like_count++; #endif - sqlite3_result_int(context, + tdsqlite3_result_int(context, patternCompare(zB, zA, pInfo, escape)==SQLITE_MATCH); } } @@ -120991,14 +120991,14 @@ static void likeFunc( ** arguments are equal to each other. */ static void nullifFunc( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **argv + tdsqlite3_value **argv ){ - CollSeq *pColl = sqlite3GetFuncCollSeq(context); + CollSeq *pColl = tdsqlite3GetFuncCollSeq(context); UNUSED_PARAMETER(NotUsed); - if( sqlite3MemCompare(argv[0], argv[1], pColl)!=0 ){ - sqlite3_result_value(context, argv[0]); + if( tdsqlite3MemCompare(argv[0], argv[1], pColl)!=0 ){ + tdsqlite3_result_value(context, argv[0]); } } @@ -121007,14 +121007,14 @@ static void nullifFunc( ** of the SQLite library that is running. */ static void versionFunc( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **NotUsed2 + tdsqlite3_value **NotUsed2 ){ UNUSED_PARAMETER2(NotUsed, NotUsed2); /* IMP: R-48699-48617 This function is an SQL wrapper around the - ** sqlite3_libversion() C-interface. */ - sqlite3_result_text(context, sqlite3_libversion(), -1, SQLITE_STATIC); + ** tdsqlite3_libversion() C-interface. */ + tdsqlite3_result_text(context, tdsqlite3_libversion(), -1, SQLITE_STATIC); } /* @@ -121023,29 +121023,29 @@ static void versionFunc( ** SQLite. */ static void sourceidFunc( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **NotUsed2 + tdsqlite3_value **NotUsed2 ){ UNUSED_PARAMETER2(NotUsed, NotUsed2); /* IMP: R-24470-31136 This function is an SQL wrapper around the - ** sqlite3_sourceid() C interface. */ - sqlite3_result_text(context, sqlite3_sourceid(), -1, SQLITE_STATIC); + ** tdsqlite3_sourceid() C interface. */ + tdsqlite3_result_text(context, tdsqlite3_sourceid(), -1, SQLITE_STATIC); } /* ** Implementation of the sqlite_log() function. This is a wrapper around -** sqlite3_log(). The return value is NULL. The function exists purely for +** tdsqlite3_log(). The return value is NULL. The function exists purely for ** its side-effects. */ static void errlogFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ UNUSED_PARAMETER(argc); UNUSED_PARAMETER(context); - sqlite3_log(sqlite3_value_int(argv[0]), "%s", sqlite3_value_text(argv[1])); + tdsqlite3_log(tdsqlite3_value_int(argv[0]), "%s", tdsqlite3_value_text(argv[1])); } /* @@ -121055,19 +121055,19 @@ static void errlogFunc( */ #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS static void compileoptionusedFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ const char *zOptName; assert( argc==1 ); UNUSED_PARAMETER(argc); /* IMP: R-39564-36305 The sqlite_compileoption_used() SQL - ** function is a wrapper around the sqlite3_compileoption_used() C/C++ + ** function is a wrapper around the tdsqlite3_compileoption_used() C/C++ ** function. */ - if( (zOptName = (const char*)sqlite3_value_text(argv[0]))!=0 ){ - sqlite3_result_int(context, sqlite3_compileoption_used(zOptName)); + if( (zOptName = (const char*)tdsqlite3_value_text(argv[0]))!=0 ){ + tdsqlite3_result_int(context, tdsqlite3_compileoption_used(zOptName)); } } #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ @@ -121079,18 +121079,18 @@ static void compileoptionusedFunc( */ #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS static void compileoptiongetFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ int n; assert( argc==1 ); UNUSED_PARAMETER(argc); /* IMP: R-04922-24076 The sqlite_compileoption_get() SQL function - ** is a wrapper around the sqlite3_compileoption_get() C/C++ function. + ** is a wrapper around the tdsqlite3_compileoption_get() C/C++ function. */ - n = sqlite3_value_int(argv[0]); - sqlite3_result_text(context, sqlite3_compileoption_get(n), -1, SQLITE_STATIC); + n = tdsqlite3_value_int(argv[0]); + tdsqlite3_result_text(context, tdsqlite3_compileoption_get(n), -1, SQLITE_STATIC); } #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ @@ -121108,31 +121108,31 @@ static const char hexdigits[] = { ** "NULL". Otherwise, the argument is enclosed in single quotes with ** single-quote escapes. */ -static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ +static void quoteFunc(tdsqlite3_context *context, int argc, tdsqlite3_value **argv){ assert( argc==1 ); UNUSED_PARAMETER(argc); - switch( sqlite3_value_type(argv[0]) ){ + switch( tdsqlite3_value_type(argv[0]) ){ case SQLITE_FLOAT: { double r1, r2; char zBuf[50]; - r1 = sqlite3_value_double(argv[0]); - sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1); - sqlite3AtoF(zBuf, &r2, 20, SQLITE_UTF8); + r1 = tdsqlite3_value_double(argv[0]); + tdsqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1); + tdsqlite3AtoF(zBuf, &r2, 20, SQLITE_UTF8); if( r1!=r2 ){ - sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.20e", r1); + tdsqlite3_snprintf(sizeof(zBuf), zBuf, "%!.20e", r1); } - sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); + tdsqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); break; } case SQLITE_INTEGER: { - sqlite3_result_value(context, argv[0]); + tdsqlite3_result_value(context, argv[0]); break; } case SQLITE_BLOB: { char *zText = 0; - char const *zBlob = sqlite3_value_blob(argv[0]); - int nBlob = sqlite3_value_bytes(argv[0]); - assert( zBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */ + char const *zBlob = tdsqlite3_value_blob(argv[0]); + int nBlob = tdsqlite3_value_bytes(argv[0]); + assert( zBlob==tdsqlite3_value_blob(argv[0]) ); /* No encoding change */ zText = (char *)contextMalloc(context, (2*(i64)nBlob)+4); if( zText ){ int i; @@ -121144,15 +121144,15 @@ static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ zText[(nBlob*2)+3] = '\0'; zText[0] = 'X'; zText[1] = '\''; - sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT); - sqlite3_free(zText); + tdsqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT); + tdsqlite3_free(zText); } break; } case SQLITE_TEXT: { int i,j; u64 n; - const unsigned char *zArg = sqlite3_value_text(argv[0]); + const unsigned char *zArg = tdsqlite3_value_text(argv[0]); char *z; if( zArg==0 ) return; @@ -121168,13 +121168,13 @@ static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ } z[j++] = '\''; z[j] = 0; - sqlite3_result_text(context, z, j, sqlite3_free); + tdsqlite3_result_text(context, z, j, tdsqlite3_free); } break; } default: { - assert( sqlite3_value_type(argv[0])==SQLITE_NULL ); - sqlite3_result_text(context, "NULL", 4, SQLITE_STATIC); + assert( tdsqlite3_value_type(argv[0])==SQLITE_NULL ); + tdsqlite3_result_text(context, "NULL", 4, SQLITE_STATIC); break; } } @@ -121185,13 +121185,13 @@ static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ ** for the first character of the input string. */ static void unicodeFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ - const unsigned char *z = sqlite3_value_text(argv[0]); + const unsigned char *z = tdsqlite3_value_text(argv[0]); (void)argc; - if( z && z[0] ) sqlite3_result_int(context, sqlite3Utf8Read(&z)); + if( z && z[0] ) tdsqlite3_result_int(context, tdsqlite3Utf8Read(&z)); } /* @@ -121200,21 +121200,21 @@ static void unicodeFunc( ** is the unicode character for the corresponding integer argument. */ static void charFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ unsigned char *z, *zOut; int i; - zOut = z = sqlite3_malloc64( argc*4+1 ); + zOut = z = tdsqlite3_malloc64( argc*4+1 ); if( z==0 ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); return; } for(i=0; i0x10ffff ) x = 0xfffd; c = (unsigned)(x & 0x1fffff); if( c<0x00080 ){ @@ -121233,7 +121233,7 @@ static void charFunc( *zOut++ = 0x80 + (u8)(c & 0x3F); } \ } - sqlite3_result_text64(context, (char*)z, zOut-z, sqlite3_free, SQLITE_UTF8); + tdsqlite3_result_text64(context, (char*)z, zOut-z, tdsqlite3_free, SQLITE_UTF8); } /* @@ -121241,18 +121241,18 @@ static void charFunc( ** a hexadecimal rendering as text. */ static void hexFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ int i, n; const unsigned char *pBlob; char *zHex, *z; assert( argc==1 ); UNUSED_PARAMETER(argc); - pBlob = sqlite3_value_blob(argv[0]); - n = sqlite3_value_bytes(argv[0]); - assert( pBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */ + pBlob = tdsqlite3_value_blob(argv[0]); + n = tdsqlite3_value_bytes(argv[0]); + assert( pBlob==tdsqlite3_value_blob(argv[0]) ); /* No encoding change */ z = zHex = contextMalloc(context, ((i64)n)*2 + 1); if( zHex ){ for(i=0; imallocFailed ); + assert( tdsqlite3_value_type(argv[1])==SQLITE_NULL + || tdsqlite3_context_db_handle(context)->mallocFailed ); return; } if( zPattern[0]==0 ){ - assert( sqlite3_value_type(argv[1])!=SQLITE_NULL ); - sqlite3_result_value(context, argv[0]); + assert( tdsqlite3_value_type(argv[1])!=SQLITE_NULL ); + tdsqlite3_result_value(context, argv[0]); return; } - nPattern = sqlite3_value_bytes(argv[1]); - assert( zPattern==sqlite3_value_text(argv[1]) ); /* No encoding change */ - zRep = sqlite3_value_text(argv[2]); + nPattern = tdsqlite3_value_bytes(argv[1]); + assert( zPattern==tdsqlite3_value_text(argv[1]) ); /* No encoding change */ + zRep = tdsqlite3_value_text(argv[2]); if( zRep==0 ) return; - nRep = sqlite3_value_bytes(argv[2]); - assert( zRep==sqlite3_value_text(argv[2]) ); + nRep = tdsqlite3_value_bytes(argv[2]); + assert( zRep==tdsqlite3_value_text(argv[2]) ); nOut = nStr + 1; assert( nOutaLimit[SQLITE_LIMIT_LENGTH] ); testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] ); if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){ - sqlite3_result_error_toobig(context); - sqlite3_free(zOut); + tdsqlite3_result_error_toobig(context); + tdsqlite3_free(zOut); return; } cntExpand++; @@ -121359,10 +121359,10 @@ static void replaceFunc( ** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */ u8 *zOld; zOld = zOut; - zOut = sqlite3_realloc64(zOut, (int)nOut + (nOut - nStr - 1)); + zOut = tdsqlite3_realloc64(zOut, (int)nOut + (nOut - nStr - 1)); if( zOut==0 ){ - sqlite3_result_error_nomem(context); - sqlite3_free(zOld); + tdsqlite3_result_error_nomem(context); + tdsqlite3_free(zOld); return; } } @@ -121377,7 +121377,7 @@ static void replaceFunc( j += nStr - i; assert( j<=nOut ); zOut[j] = 0; - sqlite3_result_text(context, (char*)zOut, j, sqlite3_free); + tdsqlite3_result_text(context, (char*)zOut, j, tdsqlite3_free); } /* @@ -121385,9 +121385,9 @@ static void replaceFunc( ** The userdata is 0x1 for left trim, 0x2 for right trim, 0x3 for both. */ static void trimFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ const unsigned char *zIn; /* Input string */ const unsigned char *zCharSet; /* Set of characters to trim */ @@ -121398,13 +121398,13 @@ static void trimFunc( unsigned char **azChar = 0; /* Individual characters in zCharSet */ int nChar; /* Number of characters in zCharSet */ - if( sqlite3_value_type(argv[0])==SQLITE_NULL ){ + if( tdsqlite3_value_type(argv[0])==SQLITE_NULL ){ return; } - zIn = sqlite3_value_text(argv[0]); + zIn = tdsqlite3_value_text(argv[0]); if( zIn==0 ) return; - nIn = sqlite3_value_bytes(argv[0]); - assert( zIn==sqlite3_value_text(argv[0]) ); + nIn = tdsqlite3_value_bytes(argv[0]); + assert( zIn==tdsqlite3_value_text(argv[0]) ); if( argc==1 ){ static const unsigned char lenOne[] = { 1 }; static unsigned char * const azOne[] = { (u8*)" " }; @@ -121412,7 +121412,7 @@ static void trimFunc( aLen = (u8*)lenOne; azChar = (unsigned char **)azOne; zCharSet = 0; - }else if( (zCharSet = sqlite3_value_text(argv[1]))==0 ){ + }else if( (zCharSet = tdsqlite3_value_text(argv[1]))==0 ){ return; }else{ const unsigned char *z; @@ -121433,7 +121433,7 @@ static void trimFunc( } } if( nChar>0 ){ - flags = SQLITE_PTR_TO_INT(sqlite3_user_data(context)); + flags = SQLITE_PTR_TO_INT(tdsqlite3_user_data(context)); if( flags & 1 ){ while( nIn>0 ){ int len = 0; @@ -121458,10 +121458,10 @@ static void trimFunc( } } if( zCharSet ){ - sqlite3_free(azChar); + tdsqlite3_free(azChar); } } - sqlite3_result_text(context, (char*)zIn, nIn, SQLITE_TRANSIENT); + tdsqlite3_result_text(context, (char*)zIn, nIn, SQLITE_TRANSIENT); } @@ -121470,15 +121470,15 @@ static void trimFunc( ** The "unknown" function is automatically substituted in place of ** any unrecognized function name when doing an EXPLAIN or EXPLAIN QUERY PLAN ** when the SQLITE_ENABLE_UNKNOWN_FUNCTION compile-time option is used. -** When the "sqlite3" command-line shell is built using this functionality, +** When the "tdsqlite3" command-line shell is built using this functionality, ** that allows an EXPLAIN or EXPLAIN QUERY PLAN for complex queries ** involving application-defined functions to be examined in a generic -** sqlite3 shell. +** tdsqlite3 shell. */ static void unknownFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ /* no-op */ } @@ -121497,9 +121497,9 @@ static void unknownFunc( ** soundex encoding of the string X. */ static void soundexFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ char zResult[8]; const u8 *zIn; @@ -121515,12 +121515,12 @@ static void soundexFunc( 1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0, }; assert( argc==1 ); - zIn = (u8*)sqlite3_value_text(argv[0]); + zIn = (u8*)tdsqlite3_value_text(argv[0]); if( zIn==0 ) zIn = (u8*)""; - for(i=0; zIn[i] && !sqlite3Isalpha(zIn[i]); i++){} + for(i=0; zIn[i] && !tdsqlite3Isalpha(zIn[i]); i++){} if( zIn[i] ){ u8 prevcode = iCode[zIn[i]&0x7f]; - zResult[0] = sqlite3Toupper(zIn[i]); + zResult[0] = tdsqlite3Toupper(zIn[i]); for(j=1; j<4 && zIn[i]; i++){ int code = iCode[zIn[i]&0x7f]; if( code>0 ){ @@ -121536,11 +121536,11 @@ static void soundexFunc( zResult[j++] = '0'; } zResult[j] = 0; - sqlite3_result_text(context, zResult, 4, SQLITE_TRANSIENT); + tdsqlite3_result_text(context, zResult, 4, SQLITE_TRANSIENT); }else{ /* IMP: R-64894-50321 The string "?000" is returned if the argument ** is NULL or contains no ASCII alphabetic characters. */ - sqlite3_result_text(context, "?000", 4, SQLITE_STATIC); + tdsqlite3_result_text(context, "?000", 4, SQLITE_STATIC); } } #endif /* SQLITE_SOUNDEX */ @@ -121549,28 +121549,28 @@ static void soundexFunc( /* ** A function that loads a shared-library extension then returns NULL. */ -static void loadExt(sqlite3_context *context, int argc, sqlite3_value **argv){ - const char *zFile = (const char *)sqlite3_value_text(argv[0]); +static void loadExt(tdsqlite3_context *context, int argc, tdsqlite3_value **argv){ + const char *zFile = (const char *)tdsqlite3_value_text(argv[0]); const char *zProc; - sqlite3 *db = sqlite3_context_db_handle(context); + tdsqlite3 *db = tdsqlite3_context_db_handle(context); char *zErrMsg = 0; /* Disallow the load_extension() SQL function unless the SQLITE_LoadExtFunc - ** flag is set. See the sqlite3_enable_load_extension() API. + ** flag is set. See the tdsqlite3_enable_load_extension() API. */ if( (db->flags & SQLITE_LoadExtFunc)==0 ){ - sqlite3_result_error(context, "not authorized", -1); + tdsqlite3_result_error(context, "not authorized", -1); return; } if( argc==2 ){ - zProc = (const char *)sqlite3_value_text(argv[1]); + zProc = (const char *)tdsqlite3_value_text(argv[1]); }else{ zProc = 0; } - if( zFile && sqlite3_load_extension(db, zFile, zProc, &zErrMsg) ){ - sqlite3_result_error(context, zErrMsg, -1); - sqlite3_free(zErrMsg); + if( zFile && tdsqlite3_load_extension(db, zFile, zProc, &zErrMsg) ){ + tdsqlite3_result_error(context, zErrMsg, -1); + tdsqlite3_free(zErrMsg); } } #endif @@ -121599,35 +121599,35 @@ struct SumCtx { ** value. TOTAL never fails, but SUM might through an exception if ** it overflows an integer. */ -static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){ +static void sumStep(tdsqlite3_context *context, int argc, tdsqlite3_value **argv){ SumCtx *p; int type; assert( argc==1 ); UNUSED_PARAMETER(argc); - p = sqlite3_aggregate_context(context, sizeof(*p)); - type = sqlite3_value_numeric_type(argv[0]); + p = tdsqlite3_aggregate_context(context, sizeof(*p)); + type = tdsqlite3_value_numeric_type(argv[0]); if( p && type!=SQLITE_NULL ){ p->cnt++; if( type==SQLITE_INTEGER ){ - i64 v = sqlite3_value_int64(argv[0]); + i64 v = tdsqlite3_value_int64(argv[0]); p->rSum += v; - if( (p->approx|p->overflow)==0 && sqlite3AddInt64(&p->iSum, v) ){ + if( (p->approx|p->overflow)==0 && tdsqlite3AddInt64(&p->iSum, v) ){ p->approx = p->overflow = 1; } }else{ - p->rSum += sqlite3_value_double(argv[0]); + p->rSum += tdsqlite3_value_double(argv[0]); p->approx = 1; } } } #ifndef SQLITE_OMIT_WINDOWFUNC -static void sumInverse(sqlite3_context *context, int argc, sqlite3_value**argv){ +static void sumInverse(tdsqlite3_context *context, int argc, tdsqlite3_value**argv){ SumCtx *p; int type; assert( argc==1 ); UNUSED_PARAMETER(argc); - p = sqlite3_aggregate_context(context, sizeof(*p)); - type = sqlite3_value_numeric_type(argv[0]); + p = tdsqlite3_aggregate_context(context, sizeof(*p)); + type = tdsqlite3_value_numeric_type(argv[0]); /* p is always non-NULL because sumStep() will have been called first ** to initialize it */ if( ALWAYS(p) && type!=SQLITE_NULL ){ @@ -121635,42 +121635,42 @@ static void sumInverse(sqlite3_context *context, int argc, sqlite3_value**argv){ p->cnt--; assert( type==SQLITE_INTEGER || p->approx ); if( type==SQLITE_INTEGER && p->approx==0 ){ - i64 v = sqlite3_value_int64(argv[0]); + i64 v = tdsqlite3_value_int64(argv[0]); p->rSum -= v; p->iSum -= v; }else{ - p->rSum -= sqlite3_value_double(argv[0]); + p->rSum -= tdsqlite3_value_double(argv[0]); } } } #else # define sumInverse 0 #endif /* SQLITE_OMIT_WINDOWFUNC */ -static void sumFinalize(sqlite3_context *context){ +static void sumFinalize(tdsqlite3_context *context){ SumCtx *p; - p = sqlite3_aggregate_context(context, 0); + p = tdsqlite3_aggregate_context(context, 0); if( p && p->cnt>0 ){ if( p->overflow ){ - sqlite3_result_error(context,"integer overflow",-1); + tdsqlite3_result_error(context,"integer overflow",-1); }else if( p->approx ){ - sqlite3_result_double(context, p->rSum); + tdsqlite3_result_double(context, p->rSum); }else{ - sqlite3_result_int64(context, p->iSum); + tdsqlite3_result_int64(context, p->iSum); } } } -static void avgFinalize(sqlite3_context *context){ +static void avgFinalize(tdsqlite3_context *context){ SumCtx *p; - p = sqlite3_aggregate_context(context, 0); + p = tdsqlite3_aggregate_context(context, 0); if( p && p->cnt>0 ){ - sqlite3_result_double(context, p->rSum/(double)p->cnt); + tdsqlite3_result_double(context, p->rSum/(double)p->cnt); } } -static void totalFinalize(sqlite3_context *context){ +static void totalFinalize(tdsqlite3_context *context){ SumCtx *p; - p = sqlite3_aggregate_context(context, 0); + p = tdsqlite3_aggregate_context(context, 0); /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ - sqlite3_result_double(context, p ? p->rSum : (double)0); + tdsqlite3_result_double(context, p ? p->rSum : (double)0); } /* @@ -121688,33 +121688,33 @@ struct CountCtx { /* ** Routines to implement the count() aggregate function. */ -static void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){ +static void countStep(tdsqlite3_context *context, int argc, tdsqlite3_value **argv){ CountCtx *p; - p = sqlite3_aggregate_context(context, sizeof(*p)); - if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && p ){ + p = tdsqlite3_aggregate_context(context, sizeof(*p)); + if( (argc==0 || SQLITE_NULL!=tdsqlite3_value_type(argv[0])) && p ){ p->n++; } #ifndef SQLITE_OMIT_DEPRECATED - /* The sqlite3_aggregate_count() function is deprecated. But just to make + /* The tdsqlite3_aggregate_count() function is deprecated. But just to make ** sure it still operates correctly, verify that its count agrees with our ** internal count when using count(*) and when the total count can be ** expressed as a 32-bit integer. */ assert( argc==1 || p==0 || p->n>0x7fffffff || p->bInverse - || p->n==sqlite3_aggregate_count(context) ); + || p->n==tdsqlite3_aggregate_count(context) ); #endif } -static void countFinalize(sqlite3_context *context){ +static void countFinalize(tdsqlite3_context *context){ CountCtx *p; - p = sqlite3_aggregate_context(context, 0); - sqlite3_result_int64(context, p ? p->n : 0); + p = tdsqlite3_aggregate_context(context, 0); + tdsqlite3_result_int64(context, p ? p->n : 0); } #ifndef SQLITE_OMIT_WINDOWFUNC -static void countInverse(sqlite3_context *ctx, int argc, sqlite3_value **argv){ +static void countInverse(tdsqlite3_context *ctx, int argc, tdsqlite3_value **argv){ CountCtx *p; - p = sqlite3_aggregate_context(ctx, sizeof(*p)); + p = tdsqlite3_aggregate_context(ctx, sizeof(*p)); /* p is always non-NULL since countStep() will have been called first */ - if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && ALWAYS(p) ){ + if( (argc==0 || SQLITE_NULL!=tdsqlite3_value_type(argv[0])) && ALWAYS(p) ){ p->n--; #ifdef SQLITE_DEBUG p->bInverse = 1; @@ -121729,61 +121729,61 @@ static void countInverse(sqlite3_context *ctx, int argc, sqlite3_value **argv){ ** Routines to implement min() and max() aggregate functions. */ static void minmaxStep( - sqlite3_context *context, + tdsqlite3_context *context, int NotUsed, - sqlite3_value **argv + tdsqlite3_value **argv ){ Mem *pArg = (Mem *)argv[0]; Mem *pBest; UNUSED_PARAMETER(NotUsed); - pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest)); + pBest = (Mem *)tdsqlite3_aggregate_context(context, sizeof(*pBest)); if( !pBest ) return; - if( sqlite3_value_type(pArg)==SQLITE_NULL ){ - if( pBest->flags ) sqlite3SkipAccumulatorLoad(context); + if( tdsqlite3_value_type(pArg)==SQLITE_NULL ){ + if( pBest->flags ) tdsqlite3SkipAccumulatorLoad(context); }else if( pBest->flags ){ int max; int cmp; - CollSeq *pColl = sqlite3GetFuncCollSeq(context); + CollSeq *pColl = tdsqlite3GetFuncCollSeq(context); /* This step function is used for both the min() and max() aggregates, ** the only difference between the two being that the sense of the ** comparison is inverted. For the max() aggregate, the - ** sqlite3_user_data() function returns (void *)-1. For min() it - ** returns (void *)db, where db is the sqlite3* database pointer. + ** tdsqlite3_user_data() function returns (void *)-1. For min() it + ** returns (void *)db, where db is the tdsqlite3* database pointer. ** Therefore the next statement sets variable 'max' to 1 for the max() ** aggregate, or 0 for min(). */ - max = sqlite3_user_data(context)!=0; - cmp = sqlite3MemCompare(pBest, pArg, pColl); + max = tdsqlite3_user_data(context)!=0; + cmp = tdsqlite3MemCompare(pBest, pArg, pColl); if( (max && cmp<0) || (!max && cmp>0) ){ - sqlite3VdbeMemCopy(pBest, pArg); + tdsqlite3VdbeMemCopy(pBest, pArg); }else{ - sqlite3SkipAccumulatorLoad(context); + tdsqlite3SkipAccumulatorLoad(context); } }else{ - pBest->db = sqlite3_context_db_handle(context); - sqlite3VdbeMemCopy(pBest, pArg); + pBest->db = tdsqlite3_context_db_handle(context); + tdsqlite3VdbeMemCopy(pBest, pArg); } } -static void minMaxValueFinalize(sqlite3_context *context, int bValue){ - sqlite3_value *pRes; - pRes = (sqlite3_value *)sqlite3_aggregate_context(context, 0); +static void minMaxValueFinalize(tdsqlite3_context *context, int bValue){ + tdsqlite3_value *pRes; + pRes = (tdsqlite3_value *)tdsqlite3_aggregate_context(context, 0); if( pRes ){ if( pRes->flags ){ - sqlite3_result_value(context, pRes); + tdsqlite3_result_value(context, pRes); } - if( bValue==0 ) sqlite3VdbeMemRelease(pRes); + if( bValue==0 ) tdsqlite3VdbeMemRelease(pRes); } } #ifndef SQLITE_OMIT_WINDOWFUNC -static void minMaxValue(sqlite3_context *context){ +static void minMaxValue(tdsqlite3_context *context){ minMaxValueFinalize(context, 1); } #else # define minMaxValue 0 #endif /* SQLITE_OMIT_WINDOWFUNC */ -static void minMaxFinalize(sqlite3_context *context){ +static void minMaxFinalize(tdsqlite3_context *context){ minMaxValueFinalize(context, 0); } @@ -121791,54 +121791,54 @@ static void minMaxFinalize(sqlite3_context *context){ ** group_concat(EXPR, ?SEPARATOR?) */ static void groupConcatStep( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ const char *zVal; StrAccum *pAccum; const char *zSep; int nVal, nSep; assert( argc==1 || argc==2 ); - if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; - pAccum = (StrAccum*)sqlite3_aggregate_context(context, sizeof(*pAccum)); + if( tdsqlite3_value_type(argv[0])==SQLITE_NULL ) return; + pAccum = (StrAccum*)tdsqlite3_aggregate_context(context, sizeof(*pAccum)); if( pAccum ){ - sqlite3 *db = sqlite3_context_db_handle(context); + tdsqlite3 *db = tdsqlite3_context_db_handle(context); int firstTerm = pAccum->mxAlloc==0; pAccum->mxAlloc = db->aLimit[SQLITE_LIMIT_LENGTH]; if( !firstTerm ){ if( argc==2 ){ - zSep = (char*)sqlite3_value_text(argv[1]); - nSep = sqlite3_value_bytes(argv[1]); + zSep = (char*)tdsqlite3_value_text(argv[1]); + nSep = tdsqlite3_value_bytes(argv[1]); }else{ zSep = ","; nSep = 1; } - if( zSep ) sqlite3_str_append(pAccum, zSep, nSep); + if( zSep ) tdsqlite3_str_append(pAccum, zSep, nSep); } - zVal = (char*)sqlite3_value_text(argv[0]); - nVal = sqlite3_value_bytes(argv[0]); - if( zVal ) sqlite3_str_append(pAccum, zVal, nVal); + zVal = (char*)tdsqlite3_value_text(argv[0]); + nVal = tdsqlite3_value_bytes(argv[0]); + if( zVal ) tdsqlite3_str_append(pAccum, zVal, nVal); } } #ifndef SQLITE_OMIT_WINDOWFUNC static void groupConcatInverse( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ int n; StrAccum *pAccum; assert( argc==1 || argc==2 ); - if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; - pAccum = (StrAccum*)sqlite3_aggregate_context(context, sizeof(*pAccum)); + if( tdsqlite3_value_type(argv[0])==SQLITE_NULL ) return; + pAccum = (StrAccum*)tdsqlite3_aggregate_context(context, sizeof(*pAccum)); /* pAccum is always non-NULL since groupConcatStep() will have always ** run frist to initialize it */ if( ALWAYS(pAccum) ){ - n = sqlite3_value_bytes(argv[0]); + n = tdsqlite3_value_bytes(argv[0]); if( argc==2 ){ - n += sqlite3_value_bytes(argv[1]); + n += tdsqlite3_value_bytes(argv[1]); }else{ n++; } @@ -121854,32 +121854,32 @@ static void groupConcatInverse( #else # define groupConcatInverse 0 #endif /* SQLITE_OMIT_WINDOWFUNC */ -static void groupConcatFinalize(sqlite3_context *context){ +static void groupConcatFinalize(tdsqlite3_context *context){ StrAccum *pAccum; - pAccum = sqlite3_aggregate_context(context, 0); + pAccum = tdsqlite3_aggregate_context(context, 0); if( pAccum ){ if( pAccum->accError==SQLITE_TOOBIG ){ - sqlite3_result_error_toobig(context); + tdsqlite3_result_error_toobig(context); }else if( pAccum->accError==SQLITE_NOMEM ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); }else{ - sqlite3_result_text(context, sqlite3StrAccumFinish(pAccum), -1, - sqlite3_free); + tdsqlite3_result_text(context, tdsqlite3StrAccumFinish(pAccum), -1, + tdsqlite3_free); } } } #ifndef SQLITE_OMIT_WINDOWFUNC -static void groupConcatValue(sqlite3_context *context){ - sqlite3_str *pAccum; - pAccum = (sqlite3_str*)sqlite3_aggregate_context(context, 0); +static void groupConcatValue(tdsqlite3_context *context){ + tdsqlite3_str *pAccum; + pAccum = (tdsqlite3_str*)tdsqlite3_aggregate_context(context, 0); if( pAccum ){ if( pAccum->accError==SQLITE_TOOBIG ){ - sqlite3_result_error_toobig(context); + tdsqlite3_result_error_toobig(context); }else if( pAccum->accError==SQLITE_NOMEM ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); }else{ - const char *zText = sqlite3_str_value(pAccum); - sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT); + const char *zText = tdsqlite3_str_value(pAccum); + tdsqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT); } } } @@ -121892,18 +121892,18 @@ static void groupConcatValue(sqlite3_context *context){ ** of the built-in functions above are part of the global function set. ** This routine only deals with those that are not global. */ -SQLITE_PRIVATE void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3 *db){ - int rc = sqlite3_overload_function(db, "MATCH", 2); +SQLITE_PRIVATE void tdsqlite3RegisterPerConnectionBuiltinFunctions(tdsqlite3 *db){ + int rc = tdsqlite3_overload_function(db, "MATCH", 2); assert( rc==SQLITE_NOMEM || rc==SQLITE_OK ); if( rc==SQLITE_NOMEM ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); } /* BEGIN SQLCIPHER */ #ifdef SQLITE_HAS_CODEC #ifndef OMIT_EXPORT { - extern void sqlcipher_exportFunc(sqlite3_context *, int, sqlite3_value **); - sqlite3CreateFunc(db, "sqlcipher_export", -1, SQLITE_TEXT, 0, sqlcipher_exportFunc, 0, 0, 0, 0, 0); + extern void sqlcipher_exportFunc(tdsqlite3_context *, int, tdsqlite3_value **); + tdsqlite3CreateFunc(db, "sqlcipher_export", -1, SQLITE_TEXT, 0, sqlcipher_exportFunc, 0, 0, 0, 0, 0); } #endif #ifdef SQLCIPHER_EXT @@ -121918,7 +121918,7 @@ SQLITE_PRIVATE void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3 *db){ ** parameter determines whether or not the LIKE operator is case ** sensitive. */ -SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){ +SQLITE_PRIVATE void tdsqlite3RegisterLikeFunctions(tdsqlite3 *db, int caseSensitive){ struct compareInfo *pInfo; int flags; if( caseSensitive ){ @@ -121928,10 +121928,10 @@ SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive) pInfo = (struct compareInfo*)&likeInfoNorm; flags = SQLITE_FUNC_LIKE; } - sqlite3CreateFunc(db, "like", 2, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0, 0, 0); - sqlite3CreateFunc(db, "like", 3, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0, 0, 0); - sqlite3FindFunction(db, "like", 2, SQLITE_UTF8, 0)->funcFlags |= flags; - sqlite3FindFunction(db, "like", 3, SQLITE_UTF8, 0)->funcFlags |= flags; + tdsqlite3CreateFunc(db, "like", 2, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0, 0, 0); + tdsqlite3CreateFunc(db, "like", 3, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0, 0, 0); + tdsqlite3FindFunction(db, "like", 2, SQLITE_UTF8, 0)->funcFlags |= flags; + tdsqlite3FindFunction(db, "like", 3, SQLITE_UTF8, 0)->funcFlags |= flags; } /* @@ -121951,7 +121951,7 @@ SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive) ** between uppercase and lowercase (as does GLOB) then *pIsNocase is set to ** false. */ -SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){ +SQLITE_PRIVATE int tdsqlite3IsLikeFunction(tdsqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){ FuncDef *pDef; int nExpr; if( pExpr->op!=TK_FUNCTION || !pExpr->x.pList ){ @@ -121959,7 +121959,7 @@ SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocas } assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); nExpr = pExpr->x.pList->nExpr; - pDef = sqlite3FindFunction(db, pExpr->u.zToken, nExpr, SQLITE_UTF8, 0); + pDef = tdsqlite3FindFunction(db, pExpr->u.zToken, nExpr, SQLITE_UTF8, 0); if( NEVER(pDef==0) || (pDef->funcFlags & SQLITE_FUNC_LIKE)==0 ){ return 0; } @@ -121989,11 +121989,11 @@ SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocas /* ** All of the FuncDef structures in the aBuiltinFunc[] array above ** to the global function hash table. This occurs at start-time (as -** a consequence of calling sqlite3_initialize()). +** a consequence of calling tdsqlite3_initialize()). ** ** After this routine runs */ -SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ +SQLITE_PRIVATE void tdsqlite3RegisterBuiltinFunctions(void){ /* ** The following array holds FuncDef structures for all of the functions ** defined in this file. @@ -122021,7 +122021,7 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ SFUNCTION(load_extension, 2, 0, 0, loadExt ), #endif #if SQLITE_USER_AUTHENTICATION - FUNCTION(sqlite_crypt, 2, 0, 0, sqlite3CryptFunc ), + FUNCTION(sqlite_crypt, 2, 0, 0, tdsqlite3CryptFunc ), #endif #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS DFUNCTION(sqlite_compileoption_used,1, 0, 0, compileoptionusedFunc ), @@ -122105,11 +122105,11 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ INLINE_FUNC(coalesce, -1, INLINEFUNC_coalesce, SQLITE_FUNC_COALESCE), }; #ifndef SQLITE_OMIT_ALTERTABLE - sqlite3AlterFunctions(); + tdsqlite3AlterFunctions(); #endif - sqlite3WindowFunctions(); - sqlite3RegisterDateTimeFunctions(); - sqlite3InsertBuiltinFuncs(aBuiltinFunc, ArraySize(aBuiltinFunc)); + tdsqlite3WindowFunctions(); + tdsqlite3RegisterDateTimeFunctions(); + tdsqlite3InsertBuiltinFuncs(aBuiltinFunc, ArraySize(aBuiltinFunc)); #if 0 /* Enable to print out how the built-in functions are hashed */ { @@ -122117,8 +122117,8 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ FuncDef *p; for(i=0; iu.pHash){ - int n = sqlite3Strlen30(p->zName); + for(p=tdsqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash){ + int n = tdsqlite3Strlen30(p->zName); int h = p->zName[0] + n; printf(" %s(%d)", p->zName, h); } @@ -122243,16 +122243,16 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ ** coding an INSERT operation. The functions used by the UPDATE/DELETE ** generation code to query for this information are: ** -** sqlite3FkRequired() - Test to see if FK processing is required. -** sqlite3FkOldmask() - Query for the set of required old.* columns. +** tdsqlite3FkRequired() - Test to see if FK processing is required. +** tdsqlite3FkOldmask() - Query for the set of required old.* columns. ** ** ** Externally accessible module functions ** -------------------------------------- ** -** sqlite3FkCheck() - Check for foreign key violations. -** sqlite3FkActions() - Code triggers for ON UPDATE/ON DELETE actions. -** sqlite3FkDelete() - Delete an FKey structure. +** tdsqlite3FkCheck() - Check for foreign key violations. +** tdsqlite3FkActions() - Code triggers for ON UPDATE/ON DELETE actions. +** tdsqlite3FkDelete() - Delete an FKey structure. */ /* @@ -122312,7 +122312,7 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ ** into pParse. If an OOM error occurs, non-zero is returned and the ** pParse->db->mallocFailed flag is set. */ -SQLITE_PRIVATE int sqlite3FkLocateIndex( +SQLITE_PRIVATE int tdsqlite3FkLocateIndex( Parse *pParse, /* Parse context to store any error in */ Table *pParent, /* Parent table of FK constraint pFKey */ FKey *pFKey, /* Foreign key to find index for */ @@ -122347,11 +122347,11 @@ SQLITE_PRIVATE int sqlite3FkLocateIndex( */ if( pParent->iPKey>=0 ){ if( !zKey ) return 0; - if( !sqlite3StrICmp(pParent->aCol[pParent->iPKey].zName, zKey) ) return 0; + if( !tdsqlite3StrICmp(pParent->aCol[pParent->iPKey].zName, zKey) ) return 0; } }else if( paiCol ){ assert( nCol>1 ); - aiCol = (int *)sqlite3DbMallocRawNN(pParse->db, nCol*sizeof(int)); + aiCol = (int *)tdsqlite3DbMallocRawNN(pParse->db, nCol*sizeof(int)); if( !aiCol ) return 1; *paiCol = aiCol; } @@ -122390,12 +122390,12 @@ SQLITE_PRIVATE int sqlite3FkLocateIndex( ** the default collation sequence for the column, this index is ** unusable. Bail out early in this case. */ zDfltColl = pParent->aCol[iCol].zColl; - if( !zDfltColl ) zDfltColl = sqlite3StrBINARY; - if( sqlite3StrICmp(pIdx->azColl[i], zDfltColl) ) break; + if( !zDfltColl ) zDfltColl = tdsqlite3StrBINARY; + if( tdsqlite3StrICmp(pIdx->azColl[i], zDfltColl) ) break; zIdxCol = pParent->aCol[iCol].zName; for(j=0; jaCol[j].zCol, zIdxCol)==0 ){ + if( tdsqlite3StrICmp(pFKey->aCol[j].zCol, zIdxCol)==0 ){ if( aiCol ) aiCol[i] = pFKey->aCol[j].iFrom; break; } @@ -122409,11 +122409,11 @@ SQLITE_PRIVATE int sqlite3FkLocateIndex( if( !pIdx ){ if( !pParse->disableTriggers ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "foreign key mismatch - \"%w\" referencing \"%w\"", pFKey->pFrom->zName, pFKey->zTo); } - sqlite3DbFree(pParse->db, aiCol); + tdsqlite3DbFree(pParse->db, aiCol); return 1; } @@ -122459,11 +122459,11 @@ static void fkLookupParent( int isIgnore /* If true, pretend pTab contains all NULL values */ ){ int i; /* Iterator variable */ - Vdbe *v = sqlite3GetVdbe(pParse); /* Vdbe to add code to */ + Vdbe *v = tdsqlite3GetVdbe(pParse); /* Vdbe to add code to */ int iCur = pParse->nTab - 1; /* Cursor number to use */ - int iOk = sqlite3VdbeMakeLabel(pParse); /* jump here if parent key found */ + int iOk = tdsqlite3VdbeMakeLabel(pParse); /* jump here if parent key found */ - sqlite3VdbeVerifyAbortable(v, + tdsqlite3VdbeVerifyAbortable(v, (!pFKey->isDeferred && !(pParse->db->flags & SQLITE_DeferFKs) && !pParse->pToplevel @@ -122477,12 +122477,12 @@ static void fkLookupParent( ** any are, then the constraint is considered satisfied. No need to ** search for a matching row in the parent table. */ if( nIncr<0 ){ - sqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, iOk); + tdsqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, iOk); VdbeCoverage(v); } for(i=0; inCol; i++){ - int iReg = sqlite3TableColumnToStorage(pFKey->pFrom,aiCol[i]) + regData + 1; - sqlite3VdbeAddOp2(v, OP_IsNull, iReg, iOk); VdbeCoverage(v); + int iReg = tdsqlite3TableColumnToStorage(pFKey->pFrom,aiCol[i]) + regData + 1; + tdsqlite3VdbeAddOp2(v, OP_IsNull, iReg, iOk); VdbeCoverage(v); } if( isIgnore==0 ){ @@ -122490,16 +122490,16 @@ static void fkLookupParent( /* If pIdx is NULL, then the parent key is the INTEGER PRIMARY KEY ** column of the parent table (table pTab). */ int iMustBeInt; /* Address of MustBeInt instruction */ - int regTemp = sqlite3GetTempReg(pParse); + int regTemp = tdsqlite3GetTempReg(pParse); /* Invoke MustBeInt to coerce the child key value to an integer (i.e. ** apply the affinity of the parent key). If this fails, then there ** is no matching parent key. Before using MustBeInt, make a copy of ** the value. Otherwise, the value inserted into the child key column ** will have INTEGER affinity applied to it, which may not be correct. */ - sqlite3VdbeAddOp2(v, OP_SCopy, - sqlite3TableColumnToStorage(pFKey->pFrom,aiCol[0])+1+regData, regTemp); - iMustBeInt = sqlite3VdbeAddOp2(v, OP_MustBeInt, regTemp, 0); + tdsqlite3VdbeAddOp2(v, OP_SCopy, + tdsqlite3TableColumnToStorage(pFKey->pFrom,aiCol[0])+1+regData, regTemp); + iMustBeInt = tdsqlite3VdbeAddOp2(v, OP_MustBeInt, regTemp, 0); VdbeCoverage(v); /* If the parent table is the same as the child table, and we are about @@ -122507,26 +122507,26 @@ static void fkLookupParent( ** then check if the row being inserted matches itself. If so, do not ** increment the constraint-counter. */ if( pTab==pFKey->pFrom && nIncr==1 ){ - sqlite3VdbeAddOp3(v, OP_Eq, regData, iOk, regTemp); VdbeCoverage(v); - sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); + tdsqlite3VdbeAddOp3(v, OP_Eq, regData, iOk, regTemp); VdbeCoverage(v); + tdsqlite3VdbeChangeP5(v, SQLITE_NOTNULL); } - sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead); - sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, regTemp); VdbeCoverage(v); - sqlite3VdbeGoto(v, iOk); - sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2); - sqlite3VdbeJumpHere(v, iMustBeInt); - sqlite3ReleaseTempReg(pParse, regTemp); + tdsqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead); + tdsqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, regTemp); VdbeCoverage(v); + tdsqlite3VdbeGoto(v, iOk); + tdsqlite3VdbeJumpHere(v, tdsqlite3VdbeCurrentAddr(v)-2); + tdsqlite3VdbeJumpHere(v, iMustBeInt); + tdsqlite3ReleaseTempReg(pParse, regTemp); }else{ int nCol = pFKey->nCol; - int regTemp = sqlite3GetTempRange(pParse, nCol); - int regRec = sqlite3GetTempReg(pParse); + int regTemp = tdsqlite3GetTempRange(pParse, nCol); + int regRec = tdsqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_OpenRead, iCur, pIdx->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); + tdsqlite3VdbeAddOp3(v, OP_OpenRead, iCur, pIdx->tnum, iDb); + tdsqlite3VdbeSetP4KeyInfo(pParse, pIdx); for(i=0; ipFrom, aiCol[i])+1+regData, + tdsqlite3VdbeAddOp2(v, OP_Copy, + tdsqlite3TableColumnToStorage(pFKey->pFrom, aiCol[i])+1+regData, regTemp+i); } @@ -122541,12 +122541,12 @@ static void fkLookupParent( ** none of the child key values are). */ if( pTab==pFKey->pFrom && nIncr==1 ){ - int iJump = sqlite3VdbeCurrentAddr(v) + nCol + 1; + int iJump = tdsqlite3VdbeCurrentAddr(v) + nCol + 1; for(i=0; ipFrom,aiCol[i]) + int iChild = tdsqlite3TableColumnToStorage(pFKey->pFrom,aiCol[i]) +1+regData; int iParent = 1+regData; - iParent += sqlite3TableColumnToStorage(pIdx->pTable, + iParent += tdsqlite3TableColumnToStorage(pIdx->pTable, pIdx->aiColumn[i]); assert( pIdx->aiColumn[i]>=0 ); assert( aiCol[i]!=pTab->iPKey ); @@ -122554,18 +122554,18 @@ static void fkLookupParent( /* The parent key is a composite key that includes the IPK column */ iParent = regData; } - sqlite3VdbeAddOp3(v, OP_Ne, iChild, iJump, iParent); VdbeCoverage(v); - sqlite3VdbeChangeP5(v, SQLITE_JUMPIFNULL); + tdsqlite3VdbeAddOp3(v, OP_Ne, iChild, iJump, iParent); VdbeCoverage(v); + tdsqlite3VdbeChangeP5(v, SQLITE_JUMPIFNULL); } - sqlite3VdbeGoto(v, iOk); + tdsqlite3VdbeGoto(v, iOk); } - sqlite3VdbeAddOp4(v, OP_MakeRecord, regTemp, nCol, regRec, - sqlite3IndexAffinityStr(pParse->db,pIdx), nCol); - sqlite3VdbeAddOp4Int(v, OP_Found, iCur, iOk, regRec, 0); VdbeCoverage(v); + tdsqlite3VdbeAddOp4(v, OP_MakeRecord, regTemp, nCol, regRec, + tdsqlite3IndexAffinityStr(pParse->db,pIdx), nCol); + tdsqlite3VdbeAddOp4Int(v, OP_Found, iCur, iOk, regRec, 0); VdbeCoverage(v); - sqlite3ReleaseTempReg(pParse, regRec); - sqlite3ReleaseTempRange(pParse, regTemp, nCol); + tdsqlite3ReleaseTempReg(pParse, regRec); + tdsqlite3ReleaseTempRange(pParse, regTemp, nCol); } } @@ -122578,17 +122578,17 @@ static void fkLookupParent( ** incrementing a counter. This is necessary as the VM code is being ** generated for will not open a statement transaction. */ assert( nIncr==1 ); - sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_FOREIGNKEY, + tdsqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_FOREIGNKEY, OE_Abort, 0, P4_STATIC, P5_ConstraintFK); }else{ if( nIncr>0 && pFKey->isDeferred==0 ){ - sqlite3MayAbort(pParse); + tdsqlite3MayAbort(pParse); } - sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); + tdsqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); } - sqlite3VdbeResolveLabel(v, iOk); - sqlite3VdbeAddOp1(v, OP_Close, iCur); + tdsqlite3VdbeResolveLabel(v, iOk); + tdsqlite3VdbeAddOp1(v, OP_Close, iCur); } @@ -122609,17 +122609,17 @@ static Expr *exprTableRegister( Expr *pExpr; Column *pCol; const char *zColl; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; - pExpr = sqlite3Expr(db, TK_REGISTER, 0); + pExpr = tdsqlite3Expr(db, TK_REGISTER, 0); if( pExpr ){ if( iCol>=0 && iCol!=pTab->iPKey ){ pCol = &pTab->aCol[iCol]; - pExpr->iTable = regBase + sqlite3TableColumnToStorage(pTab,iCol) + 1; + pExpr->iTable = regBase + tdsqlite3TableColumnToStorage(pTab,iCol) + 1; pExpr->affExpr = pCol->affinity; zColl = pCol->zColl; if( zColl==0 ) zColl = db->pDfltColl->zName; - pExpr = sqlite3ExprAddCollateString(pParse, pExpr, zColl); + pExpr = tdsqlite3ExprAddCollateString(pParse, pExpr, zColl); }else{ pExpr->iTable = regBase; pExpr->affExpr = SQLITE_AFF_INTEGER; @@ -122633,12 +122633,12 @@ static Expr *exprTableRegister( ** has cursor iCur. */ static Expr *exprTableColumn( - sqlite3 *db, /* The database connection */ + tdsqlite3 *db, /* The database connection */ Table *pTab, /* The table whose column is desired */ int iCursor, /* The open cursor on the table */ i16 iCol /* The column that is wanted */ ){ - Expr *pExpr = sqlite3Expr(db, TK_COLUMN, 0); + Expr *pExpr = tdsqlite3Expr(db, TK_COLUMN, 0); if( pExpr ){ pExpr->y.pTab = pTab; pExpr->iTable = iCursor; @@ -122689,13 +122689,13 @@ static void fkScanChildren( int regData, /* Parent row data starts here */ int nIncr /* Amount to increment deferred counter by */ ){ - sqlite3 *db = pParse->db; /* Database handle */ + tdsqlite3 *db = pParse->db; /* Database handle */ int i; /* Iterator variable */ Expr *pWhere = 0; /* WHERE clause to scan with */ NameContext sNameContext; /* Context used to resolve WHERE clause */ - WhereInfo *pWInfo; /* Context used by sqlite3WhereXXX() */ + WhereInfo *pWInfo; /* Context used by tdsqlite3WhereXXX() */ int iFkIfZero = 0; /* Address of OP_FkIfZero */ - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); assert( pIdx==0 || pIdx->pTable==pTab ); assert( pIdx==0 || pIdx->nKeyCol==pFKey->nCol ); @@ -122703,7 +122703,7 @@ static void fkScanChildren( assert( pIdx!=0 || HasRowid(pTab) ); if( nIncr<0 ){ - iFkIfZero = sqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, 0); + iFkIfZero = tdsqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, 0); VdbeCoverage(v); } @@ -122727,9 +122727,9 @@ static void fkScanChildren( iCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom; assert( iCol>=0 ); zCol = pFKey->pFrom->aCol[iCol].zName; - pRight = sqlite3Expr(db, TK_ID, zCol); - pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight); - pWhere = sqlite3ExprAnd(pParse, pWhere, pEq); + pRight = tdsqlite3Expr(db, TK_ID, zCol); + pEq = tdsqlite3PExpr(pParse, TK_EQ, pLeft, pRight); + pWhere = tdsqlite3ExprAnd(pParse, pWhere, pEq); } /* If the child table is the same as the parent table, then add terms @@ -122753,7 +122753,7 @@ static void fkScanChildren( if( HasRowid(pTab) ){ pLeft = exprTableRegister(pParse, pTab, regData, -1); pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, -1); - pNe = sqlite3PExpr(pParse, TK_NE, pLeft, pRight); + pNe = tdsqlite3PExpr(pParse, TK_NE, pLeft, pRight); }else{ Expr *pEq, *pAll = 0; assert( pIdx!=0 ); @@ -122761,36 +122761,36 @@ static void fkScanChildren( i16 iCol = pIdx->aiColumn[i]; assert( iCol>=0 ); pLeft = exprTableRegister(pParse, pTab, regData, iCol); - pRight = sqlite3Expr(db, TK_ID, pTab->aCol[iCol].zName); - pEq = sqlite3PExpr(pParse, TK_IS, pLeft, pRight); - pAll = sqlite3ExprAnd(pParse, pAll, pEq); + pRight = tdsqlite3Expr(db, TK_ID, pTab->aCol[iCol].zName); + pEq = tdsqlite3PExpr(pParse, TK_IS, pLeft, pRight); + pAll = tdsqlite3ExprAnd(pParse, pAll, pEq); } - pNe = sqlite3PExpr(pParse, TK_NOT, pAll, 0); + pNe = tdsqlite3PExpr(pParse, TK_NOT, pAll, 0); } - pWhere = sqlite3ExprAnd(pParse, pWhere, pNe); + pWhere = tdsqlite3ExprAnd(pParse, pWhere, pNe); } /* Resolve the references in the WHERE clause. */ memset(&sNameContext, 0, sizeof(NameContext)); sNameContext.pSrcList = pSrc; sNameContext.pParse = pParse; - sqlite3ResolveExprNames(&sNameContext, pWhere); + tdsqlite3ResolveExprNames(&sNameContext, pWhere); /* Create VDBE to loop through the entries in pSrc that match the WHERE ** clause. For each row found, increment either the deferred or immediate ** foreign key constraint counter. */ if( pParse->nErr==0 ){ - pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0); - sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); + pWInfo = tdsqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0); + tdsqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); if( pWInfo ){ - sqlite3WhereEnd(pWInfo); + tdsqlite3WhereEnd(pWInfo); } } /* Clean up the WHERE clause constructed above. */ - sqlite3ExprDelete(db, pWhere); + tdsqlite3ExprDelete(db, pWhere); if( iFkIfZero ){ - sqlite3VdbeJumpHere(v, iFkIfZero); + tdsqlite3VdbeJumpHere(v, iFkIfZero); } } @@ -122808,8 +122808,8 @@ static void fkScanChildren( ** NULL pointer (as there are no FK constraints for which t2 is the parent ** table). */ -SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *pTab){ - return (FKey *)sqlite3HashFind(&pTab->pSchema->fkeyHash, pTab->zName); +SQLITE_PRIVATE FKey *tdsqlite3FkReferences(Table *pTab){ + return (FKey *)tdsqlite3HashFind(&pTab->pSchema->fkeyHash, pTab->zName); } /* @@ -122820,14 +122820,14 @@ SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *pTab){ ** The Trigger structure or any of its sub-components may be allocated from ** the lookaside buffer belonging to database handle dbMem. */ -static void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){ +static void fkTriggerDelete(tdsqlite3 *dbMem, Trigger *p){ if( p ){ TriggerStep *pStep = p->step_list; - sqlite3ExprDelete(dbMem, pStep->pWhere); - sqlite3ExprListDelete(dbMem, pStep->pExprList); - sqlite3SelectDelete(dbMem, pStep->pSelect); - sqlite3ExprDelete(dbMem, p->pWhen); - sqlite3DbFree(dbMem, p); + tdsqlite3ExprDelete(dbMem, pStep->pWhere); + tdsqlite3ExprListDelete(dbMem, pStep->pExprList); + tdsqlite3SelectDelete(dbMem, pStep->pSelect); + tdsqlite3ExprDelete(dbMem, p->pWhen); + tdsqlite3DbFree(dbMem, p); } } @@ -122848,15 +122848,15 @@ static void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){ ** the table from the database. Triggers are disabled while running this ** DELETE, but foreign key actions are not. */ -SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){ - sqlite3 *db = pParse->db; +SQLITE_PRIVATE void tdsqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){ + tdsqlite3 *db = pParse->db; if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) ){ int iSkip = 0; - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); assert( v ); /* VDBE has already been allocated */ assert( pTab->pSelect==0 ); /* Not a view */ - if( sqlite3FkReferences(pTab)==0 ){ + if( tdsqlite3FkReferences(pTab)==0 ){ /* Search for a deferred foreign key constraint for which this table ** is the child table. If one cannot be found, return without ** generating any VDBE code. If one can be found, then jump over @@ -122867,12 +122867,12 @@ SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTa if( p->isDeferred || (db->flags & SQLITE_DeferFKs) ) break; } if( !p ) return; - iSkip = sqlite3VdbeMakeLabel(pParse); - sqlite3VdbeAddOp2(v, OP_FkIfZero, 1, iSkip); VdbeCoverage(v); + iSkip = tdsqlite3VdbeMakeLabel(pParse); + tdsqlite3VdbeAddOp2(v, OP_FkIfZero, 1, iSkip); VdbeCoverage(v); } pParse->disableTriggers = 1; - sqlite3DeleteFrom(pParse, sqlite3SrcListDup(db, pName, 0), 0, 0, 0); + tdsqlite3DeleteFrom(pParse, tdsqlite3SrcListDup(db, pName, 0), 0, 0, 0); pParse->disableTriggers = 0; /* If the DELETE has generated immediate foreign key constraint @@ -122885,15 +122885,15 @@ SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTa ** constraints are violated. */ if( (db->flags & SQLITE_DeferFKs)==0 ){ - sqlite3VdbeVerifyAbortable(v, OE_Abort); - sqlite3VdbeAddOp2(v, OP_FkIfZero, 0, sqlite3VdbeCurrentAddr(v)+2); + tdsqlite3VdbeVerifyAbortable(v, OE_Abort); + tdsqlite3VdbeAddOp2(v, OP_FkIfZero, 0, tdsqlite3VdbeCurrentAddr(v)+2); VdbeCoverage(v); - sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_FOREIGNKEY, + tdsqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_FOREIGNKEY, OE_Abort, 0, P4_STATIC, P5_ConstraintFK); } if( iSkip ){ - sqlite3VdbeResolveLabel(v, iSkip); + tdsqlite3VdbeResolveLabel(v, iSkip); } } } @@ -122952,7 +122952,7 @@ static int fkParentIsModified( if( aChange[iKey]>=0 || (iKey==pTab->iPKey && bChngRowid) ){ Column *pCol = &pTab->aCol[iKey]; if( zKey ){ - if( 0==sqlite3StrICmp(pCol->zName, zKey) ) return 1; + if( 0==tdsqlite3StrICmp(pCol->zName, zKey) ) return 1; }else if( pCol->colFlags & COLFLAG_PRIMKEY ){ return 1; } @@ -122968,7 +122968,7 @@ static int fkParentIsModified( ** to trigger pFKey. */ static int isSetNullAction(Parse *pParse, FKey *pFKey){ - Parse *pTop = sqlite3ParseToplevel(pParse); + Parse *pTop = tdsqlite3ParseToplevel(pParse); if( pTop->pTriggerPrg ){ Trigger *p = pTop->pTriggerPrg->pTrigger; if( (p==pFKey->apTrigger[0] && pFKey->aAction[0]==OE_SetNull) @@ -123000,7 +123000,7 @@ static int isSetNullAction(Parse *pParse, FKey *pFKey){ ** described for DELETE. Then again after the original record is deleted ** but before the new record is inserted using the INSERT convention. */ -SQLITE_PRIVATE void sqlite3FkCheck( +SQLITE_PRIVATE void tdsqlite3FkCheck( Parse *pParse, /* Parse context */ Table *pTab, /* Row is being deleted from this table */ int regOld, /* Previous row data is stored here */ @@ -123008,7 +123008,7 @@ SQLITE_PRIVATE void sqlite3FkCheck( int *aChange, /* Array indicating UPDATEd columns (or 0) */ int bChngRowid /* True if rowid is UPDATEd */ ){ - sqlite3 *db = pParse->db; /* Database handle */ + tdsqlite3 *db = pParse->db; /* Database handle */ FKey *pFKey; /* Used to iterate through FKs */ int iDb; /* Index of database containing pTab */ const char *zDb; /* Name of database containing pTab */ @@ -123020,7 +123020,7 @@ SQLITE_PRIVATE void sqlite3FkCheck( /* If foreign-keys are disabled, this function is a no-op. */ if( (db->flags&SQLITE_ForeignKeys)==0 ) return; - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); + iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); zDb = db->aDb[iDb].zDbSName; /* Loop through all the foreign key constraints for which pTab is the @@ -123035,7 +123035,7 @@ SQLITE_PRIVATE void sqlite3FkCheck( int bIgnore = 0; if( aChange - && sqlite3_stricmp(pTab->zName, pFKey->zTo)!=0 + && tdsqlite3_stricmp(pTab->zName, pFKey->zTo)!=0 && fkChildIsModified(pTab, pFKey, aChange, bChngRowid)==0 ){ continue; @@ -123046,11 +123046,11 @@ SQLITE_PRIVATE void sqlite3FkCheck( ** schema items cannot be located, set an error in pParse and return ** early. */ if( pParse->disableTriggers ){ - pTo = sqlite3FindTable(db, pFKey->zTo, zDb); + pTo = tdsqlite3FindTable(db, pFKey->zTo, zDb); }else{ - pTo = sqlite3LocateTable(pParse, 0, pFKey->zTo, zDb); + pTo = tdsqlite3LocateTable(pParse, 0, pFKey->zTo, zDb); } - if( !pTo || sqlite3FkLocateIndex(pParse, pTo, pFKey, &pIdx, &aiFree) ){ + if( !pTo || tdsqlite3FkLocateIndex(pParse, pTo, pFKey, &pIdx, &aiFree) ){ assert( isIgnoreErrors==0 || (regOld!=0 && regNew==0) ); if( !isIgnoreErrors || db->mallocFailed ) return; if( pTo==0 ){ @@ -123061,15 +123061,15 @@ SQLITE_PRIVATE void sqlite3FkCheck( ** missing, behave as if it is empty. i.e. decrement the relevant ** FK counter for each row of the current table with non-NULL keys. */ - Vdbe *v = sqlite3GetVdbe(pParse); - int iJump = sqlite3VdbeCurrentAddr(v) + pFKey->nCol + 1; + Vdbe *v = tdsqlite3GetVdbe(pParse); + int iJump = tdsqlite3VdbeCurrentAddr(v) + pFKey->nCol + 1; for(i=0; inCol; i++){ int iFromCol, iReg; iFromCol = pFKey->aCol[i].iFrom; - iReg = sqlite3TableColumnToStorage(pFKey->pFrom,iFromCol) + regOld+1; - sqlite3VdbeAddOp2(v, OP_IsNull, iReg, iJump); VdbeCoverage(v); + iReg = tdsqlite3TableColumnToStorage(pFKey->pFrom,iFromCol) + regOld+1; + tdsqlite3VdbeAddOp2(v, OP_IsNull, iReg, iJump); VdbeCoverage(v); } - sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, -1); + tdsqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, -1); } continue; } @@ -123093,7 +123093,7 @@ SQLITE_PRIVATE void sqlite3FkCheck( if( db->xAuth ){ int rcauth; char *zCol = pTo->aCol[pIdx ? pIdx->aiColumn[i] : pTo->iPKey].zName; - rcauth = sqlite3AuthReadCol(pParse, pTo->zName, zCol, iDb); + rcauth = tdsqlite3AuthReadCol(pParse, pTo->zName, zCol, iDb); bIgnore = (rcauth==SQLITE_IGNORE); } #endif @@ -123102,7 +123102,7 @@ SQLITE_PRIVATE void sqlite3FkCheck( /* Take a shared-cache advisory read-lock on the parent table. Allocate ** a cursor to use to search the unique index on the parent key columns ** in the parent table. */ - sqlite3TableLock(pParse, iDb, pTo->tnum, 0, pTo->zName); + tdsqlite3TableLock(pParse, iDb, pTo->tnum, 0, pTo->zName); pParse->nTab++; if( regOld!=0 ){ @@ -123123,12 +123123,12 @@ SQLITE_PRIVATE void sqlite3FkCheck( fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regNew, +1, bIgnore); } - sqlite3DbFree(db, aiFree); + tdsqlite3DbFree(db, aiFree); } /* Loop through all the foreign key constraints that refer to this table. ** (the "child" constraints) */ - for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){ + for(pFKey = tdsqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){ Index *pIdx = 0; /* Foreign key index for pFKey */ SrcList *pSrc; int *aiCol = 0; @@ -123146,15 +123146,15 @@ SQLITE_PRIVATE void sqlite3FkCheck( continue; } - if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ){ + if( tdsqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ){ if( !isIgnoreErrors || db->mallocFailed ) return; continue; } assert( aiCol || pFKey->nCol==1 ); /* Create a SrcList structure containing the child table. We need the - ** child table as a SrcList for sqlite3WhereBegin() */ - pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0); + ** child table as a SrcList for tdsqlite3WhereBegin() */ + pSrc = tdsqlite3SrcListAppend(pParse, 0, 0, 0); if( pSrc ){ struct SrcList_item *pItem = pSrc->a; pItem->pTab = pFKey->pFrom; @@ -123186,13 +123186,13 @@ SQLITE_PRIVATE void sqlite3FkCheck( ** might be set incorrectly if any OP_FkCounter related scans are ** omitted. */ if( !pFKey->isDeferred && eAction!=OE_Cascade && eAction!=OE_SetNull ){ - sqlite3MayAbort(pParse); + tdsqlite3MayAbort(pParse); } } pItem->zName = 0; - sqlite3SrcListDelete(db, pSrc); + tdsqlite3SrcListDelete(db, pSrc); } - sqlite3DbFree(db, aiCol); + tdsqlite3DbFree(db, aiCol); } } @@ -123202,7 +123202,7 @@ SQLITE_PRIVATE void sqlite3FkCheck( ** This function is called before generating code to update or delete a ** row contained in table pTab. */ -SQLITE_PRIVATE u32 sqlite3FkOldmask( +SQLITE_PRIVATE u32 tdsqlite3FkOldmask( Parse *pParse, /* Parse context */ Table *pTab /* Table being modified */ ){ @@ -123213,9 +123213,9 @@ SQLITE_PRIVATE u32 sqlite3FkOldmask( for(p=pTab->pFKey; p; p=p->pNextFrom){ for(i=0; inCol; i++) mask |= COLUMN_MASK(p->aCol[i].iFrom); } - for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){ + for(p=tdsqlite3FkReferences(pTab); p; p=p->pNextTo){ Index *pIdx = 0; - sqlite3FkLocateIndex(pParse, pTab, p, &pIdx, 0); + tdsqlite3FkLocateIndex(pParse, pTab, p, &pIdx, 0); if( pIdx ){ for(i=0; inKeyCol; i++){ assert( pIdx->aiColumn[i]>=0 ); @@ -123250,7 +123250,7 @@ SQLITE_PRIVATE u32 sqlite3FkOldmask( ** ** Or, assuming some other foreign key processing is required, 1. */ -SQLITE_PRIVATE int sqlite3FkRequired( +SQLITE_PRIVATE int tdsqlite3FkRequired( Parse *pParse, /* Parse context */ Table *pTab, /* Table being modified */ int *aChange, /* Non-NULL for UPDATE operations */ @@ -123262,7 +123262,7 @@ SQLITE_PRIVATE int sqlite3FkRequired( /* A DELETE operation. Foreign key processing is required if the ** table in question is either the child or parent table for any ** foreign key constraint. */ - eRet = (sqlite3FkReferences(pTab) || pTab->pFKey); + eRet = (tdsqlite3FkReferences(pTab) || pTab->pFKey); }else{ /* This is an UPDATE. Foreign key processing is only required if the ** operation modifies one or more child or parent key columns. */ @@ -123270,14 +123270,14 @@ SQLITE_PRIVATE int sqlite3FkRequired( /* Check if any child key columns are being modified. */ for(p=pTab->pFKey; p; p=p->pNextFrom){ - if( 0==sqlite3_stricmp(pTab->zName, p->zTo) ) return 2; + if( 0==tdsqlite3_stricmp(pTab->zName, p->zTo) ) return 2; if( fkChildIsModified(pTab, p, aChange, chngRowid) ){ eRet = 1; } } /* Check if any parent key columns are being modified. */ - for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){ + for(p=tdsqlite3FkReferences(pTab); p; p=p->pNextTo){ if( fkParentIsModified(pTab, p, aChange, chngRowid) ){ if( p->aAction[1]!=OE_None ) return 2; eRet = 1; @@ -123315,7 +123315,7 @@ SQLITE_PRIVATE int sqlite3FkRequired( ** ** The returned pointer is cached as part of the foreign key object. It ** is eventually freed along with the rest of the foreign key object by -** sqlite3FkDelete(). +** tdsqlite3FkDelete(). */ static Trigger *fkActionTrigger( Parse *pParse, /* Parse context */ @@ -123323,7 +123323,7 @@ static Trigger *fkActionTrigger( FKey *pFKey, /* Foreign key to get action for */ ExprList *pChanges /* Change-list for UPDATE, NULL for DELETE */ ){ - sqlite3 *db = pParse->db; /* Database handle */ + tdsqlite3 *db = pParse->db; /* Database handle */ int action; /* One of OE_None, OE_Cascade etc. */ Trigger *pTrigger; /* Trigger definition to return */ int iAction = (pChanges!=0); /* 1 for UPDATE, 0 for DELETE */ @@ -123346,7 +123346,7 @@ static Trigger *fkActionTrigger( int i; /* Iterator variable */ Expr *pWhen = 0; /* WHEN clause for the trigger */ - if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ) return 0; + if( tdsqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ) return 0; assert( aiCol || pFKey->nCol==1 ); for(i=0; inCol; i++){ @@ -123361,21 +123361,21 @@ static Trigger *fkActionTrigger( assert( iFromCol>=0 ); assert( pIdx!=0 || (pTab->iPKey>=0 && pTab->iPKeynCol) ); assert( pIdx==0 || pIdx->aiColumn[i]>=0 ); - sqlite3TokenInit(&tToCol, + tdsqlite3TokenInit(&tToCol, pTab->aCol[pIdx ? pIdx->aiColumn[i] : pTab->iPKey].zName); - sqlite3TokenInit(&tFromCol, pFKey->pFrom->aCol[iFromCol].zName); + tdsqlite3TokenInit(&tFromCol, pFKey->pFrom->aCol[iFromCol].zName); /* Create the expression "OLD.zToCol = zFromCol". It is important ** that the "OLD.zToCol" term is on the LHS of the = operator, so ** that the affinity and collation sequence associated with the ** parent table are used for the comparison. */ - pEq = sqlite3PExpr(pParse, TK_EQ, - sqlite3PExpr(pParse, TK_DOT, - sqlite3ExprAlloc(db, TK_ID, &tOld, 0), - sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)), - sqlite3ExprAlloc(db, TK_ID, &tFromCol, 0) + pEq = tdsqlite3PExpr(pParse, TK_EQ, + tdsqlite3PExpr(pParse, TK_DOT, + tdsqlite3ExprAlloc(db, TK_ID, &tOld, 0), + tdsqlite3ExprAlloc(db, TK_ID, &tToCol, 0)), + tdsqlite3ExprAlloc(db, TK_ID, &tFromCol, 0) ); - pWhere = sqlite3ExprAnd(pParse, pWhere, pEq); + pWhere = tdsqlite3ExprAnd(pParse, pWhere, pEq); /* For ON UPDATE, construct the next term of the WHEN clause. ** The final WHEN clause will be like this: @@ -123383,23 +123383,23 @@ static Trigger *fkActionTrigger( ** WHEN NOT(old.col1 IS new.col1 AND ... AND old.colN IS new.colN) */ if( pChanges ){ - pEq = sqlite3PExpr(pParse, TK_IS, - sqlite3PExpr(pParse, TK_DOT, - sqlite3ExprAlloc(db, TK_ID, &tOld, 0), - sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)), - sqlite3PExpr(pParse, TK_DOT, - sqlite3ExprAlloc(db, TK_ID, &tNew, 0), - sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)) + pEq = tdsqlite3PExpr(pParse, TK_IS, + tdsqlite3PExpr(pParse, TK_DOT, + tdsqlite3ExprAlloc(db, TK_ID, &tOld, 0), + tdsqlite3ExprAlloc(db, TK_ID, &tToCol, 0)), + tdsqlite3PExpr(pParse, TK_DOT, + tdsqlite3ExprAlloc(db, TK_ID, &tNew, 0), + tdsqlite3ExprAlloc(db, TK_ID, &tToCol, 0)) ); - pWhen = sqlite3ExprAnd(pParse, pWhen, pEq); + pWhen = tdsqlite3ExprAnd(pParse, pWhen, pEq); } if( action!=OE_Restrict && (action!=OE_Cascade || pChanges) ){ Expr *pNew; if( action==OE_Cascade ){ - pNew = sqlite3PExpr(pParse, TK_DOT, - sqlite3ExprAlloc(db, TK_ID, &tNew, 0), - sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)); + pNew = tdsqlite3PExpr(pParse, TK_DOT, + tdsqlite3ExprAlloc(db, TK_ID, &tNew, 0), + tdsqlite3ExprAlloc(db, TK_ID, &tToCol, 0)); }else if( action==OE_SetDflt ){ Column *pCol = pFKey->pFrom->aCol + iFromCol; Expr *pDflt; @@ -123411,21 +123411,21 @@ static Trigger *fkActionTrigger( pDflt = pCol->pDflt; } if( pDflt ){ - pNew = sqlite3ExprDup(db, pDflt, 0); + pNew = tdsqlite3ExprDup(db, pDflt, 0); }else{ - pNew = sqlite3ExprAlloc(db, TK_NULL, 0, 0); + pNew = tdsqlite3ExprAlloc(db, TK_NULL, 0, 0); } }else{ - pNew = sqlite3ExprAlloc(db, TK_NULL, 0, 0); + pNew = tdsqlite3ExprAlloc(db, TK_NULL, 0, 0); } - pList = sqlite3ExprListAppend(pParse, pList, pNew); - sqlite3ExprListSetName(pParse, pList, &tFromCol, 0); + pList = tdsqlite3ExprListAppend(pParse, pList, pNew); + tdsqlite3ExprListSetName(pParse, pList, &tFromCol, 0); } } - sqlite3DbFree(db, aiCol); + tdsqlite3DbFree(db, aiCol); zFrom = pFKey->pFrom->zName; - nFrom = sqlite3Strlen30(zFrom); + nFrom = tdsqlite3Strlen30(zFrom); if( action==OE_Restrict ){ Token tFrom; @@ -123433,13 +123433,13 @@ static Trigger *fkActionTrigger( tFrom.z = zFrom; tFrom.n = nFrom; - pRaise = sqlite3Expr(db, TK_RAISE, "FOREIGN KEY constraint failed"); + pRaise = tdsqlite3Expr(db, TK_RAISE, "FOREIGN KEY constraint failed"); if( pRaise ){ pRaise->affExpr = OE_Abort; } - pSelect = sqlite3SelectNew(pParse, - sqlite3ExprListAppend(pParse, 0, pRaise), - sqlite3SrcListAppend(pParse, 0, &tFrom, 0), + pSelect = tdsqlite3SelectNew(pParse, + tdsqlite3ExprListAppend(pParse, 0, pRaise), + tdsqlite3SrcListAppend(pParse, 0, &tFrom, 0), pWhere, 0, 0, 0, 0, 0 ); @@ -123449,7 +123449,7 @@ static Trigger *fkActionTrigger( /* Disable lookaside memory allocation */ DisableLookaside; - pTrigger = (Trigger *)sqlite3DbMallocZero(db, + pTrigger = (Trigger *)tdsqlite3DbMallocZero(db, sizeof(Trigger) + /* struct Trigger */ sizeof(TriggerStep) + /* Single step in trigger program */ nFrom + 1 /* Space for pStep->zTarget */ @@ -123459,22 +123459,22 @@ static Trigger *fkActionTrigger( pStep->zTarget = (char *)&pStep[1]; memcpy((char *)pStep->zTarget, zFrom, nFrom); - pStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); - pStep->pExprList = sqlite3ExprListDup(db, pList, EXPRDUP_REDUCE); - pStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); + pStep->pWhere = tdsqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); + pStep->pExprList = tdsqlite3ExprListDup(db, pList, EXPRDUP_REDUCE); + pStep->pSelect = tdsqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); if( pWhen ){ - pWhen = sqlite3PExpr(pParse, TK_NOT, pWhen, 0); - pTrigger->pWhen = sqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE); + pWhen = tdsqlite3PExpr(pParse, TK_NOT, pWhen, 0); + pTrigger->pWhen = tdsqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE); } } /* Re-enable the lookaside buffer, if it was disabled earlier. */ EnableLookaside; - sqlite3ExprDelete(db, pWhere); - sqlite3ExprDelete(db, pWhen); - sqlite3ExprListDelete(db, pList); - sqlite3SelectDelete(db, pSelect); + tdsqlite3ExprDelete(db, pWhere); + tdsqlite3ExprDelete(db, pWhen); + tdsqlite3ExprListDelete(db, pList); + tdsqlite3SelectDelete(db, pSelect); if( db->mallocFailed==1 ){ fkTriggerDelete(db, pTrigger); return 0; @@ -123508,7 +123508,7 @@ static Trigger *fkActionTrigger( ** This function is called when deleting or updating a row to implement ** any required CASCADE, SET NULL or SET DEFAULT actions. */ -SQLITE_PRIVATE void sqlite3FkActions( +SQLITE_PRIVATE void tdsqlite3FkActions( Parse *pParse, /* Parse context */ Table *pTab, /* Table being updated or deleted from */ ExprList *pChanges, /* Change-list for UPDATE, NULL for DELETE */ @@ -123522,11 +123522,11 @@ SQLITE_PRIVATE void sqlite3FkActions( ** trigger sub-program. */ if( pParse->db->flags&SQLITE_ForeignKeys ){ FKey *pFKey; /* Iterator variable */ - for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){ + for(pFKey = tdsqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){ if( aChange==0 || fkParentIsModified(pTab, pFKey, aChange, bChngRowid) ){ Trigger *pAct = fkActionTrigger(pParse, pTab, pFKey, pChanges); if( pAct ){ - sqlite3CodeRowTriggerDirect(pParse, pAct, pTab, regOld, OE_Abort, 0); + tdsqlite3CodeRowTriggerDirect(pParse, pAct, pTab, regOld, OE_Abort, 0); } } } @@ -123540,12 +123540,12 @@ SQLITE_PRIVATE void sqlite3FkActions( ** table pTab. Remove the deleted foreign keys from the Schema.fkeyHash ** hash table. */ -SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab){ +SQLITE_PRIVATE void tdsqlite3FkDelete(tdsqlite3 *db, Table *pTab){ FKey *pFKey; /* Iterator variable */ FKey *pNext; /* Copy of pFKey->pNextFrom */ assert( db==0 || IsVirtual(pTab) - || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) ); + || tdsqlite3SchemaMutexHeld(db, 0, pTab->pSchema) ); for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){ /* Remove the FK from the fkeyHash hash table. */ @@ -123555,7 +123555,7 @@ SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab){ }else{ void *p = (void *)pFKey->pNextTo; const char *z = (p ? pFKey->pNextTo->zTo : pFKey->zTo); - sqlite3HashInsert(&pTab->pSchema->fkeyHash, z, p); + tdsqlite3HashInsert(&pTab->pSchema->fkeyHash, z, p); } if( pFKey->pNextTo ){ pFKey->pNextTo->pPrevTo = pFKey->pPrevTo; @@ -123574,7 +123574,7 @@ SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab){ #endif pNext = pFKey->pNextFrom; - sqlite3DbFree(db, pFKey); + tdsqlite3DbFree(db, pFKey); } } #endif /* ifndef SQLITE_OMIT_FOREIGN_KEY */ @@ -123606,7 +123606,7 @@ SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab){ ** If pTab is a WITHOUT ROWID table, then it is the PRIMARY KEY index ** for that table that is actually opened. */ -SQLITE_PRIVATE void sqlite3OpenTable( +SQLITE_PRIVATE void tdsqlite3OpenTable( Parse *pParse, /* Generate code into this VDBE */ int iCur, /* The cursor number of the table */ int iDb, /* The database index in sqlite3.aDb[] */ @@ -123615,19 +123615,19 @@ SQLITE_PRIVATE void sqlite3OpenTable( ){ Vdbe *v; assert( !IsVirtual(pTab) ); - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); assert( opcode==OP_OpenWrite || opcode==OP_OpenRead ); - sqlite3TableLock(pParse, iDb, pTab->tnum, + tdsqlite3TableLock(pParse, iDb, pTab->tnum, (opcode==OP_OpenWrite)?1:0, pTab->zName); if( HasRowid(pTab) ){ - sqlite3VdbeAddOp4Int(v, opcode, iCur, pTab->tnum, iDb, pTab->nNVCol); + tdsqlite3VdbeAddOp4Int(v, opcode, iCur, pTab->tnum, iDb, pTab->nNVCol); VdbeComment((v, "%s", pTab->zName)); }else{ - Index *pPk = sqlite3PrimaryKeyIndex(pTab); + Index *pPk = tdsqlite3PrimaryKeyIndex(pTab); assert( pPk!=0 ); assert( pPk->tnum==pTab->tnum ); - sqlite3VdbeAddOp3(v, opcode, iCur, pPk->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pPk); + tdsqlite3VdbeAddOp3(v, opcode, iCur, pPk->tnum, iDb); + tdsqlite3VdbeSetP4KeyInfo(pParse, pPk); VdbeComment((v, "%s", pTab->zName)); } } @@ -123650,9 +123650,9 @@ SQLITE_PRIVATE void sqlite3OpenTable( ** ** Memory for the buffer containing the column index affinity string ** is managed along with the rest of the Index structure. It will be -** released when sqlite3DeleteIndex() is called. +** released when tdsqlite3DeleteIndex() is called. */ -SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){ +SQLITE_PRIVATE const char *tdsqlite3IndexAffinityStr(tdsqlite3 *db, Index *pIdx){ if( !pIdx->zColAff ){ /* The first time a column affinity string for a particular index is ** required, it is allocated and populated here. It is then stored as @@ -123664,9 +123664,9 @@ SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){ */ int n; Table *pTab = pIdx->pTable; - pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1); + pIdx->zColAff = (char *)tdsqlite3DbMallocRaw(0, pIdx->nColumn+1); if( !pIdx->zColAff ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); return 0; } for(n=0; nnColumn; n++){ @@ -123679,7 +123679,7 @@ SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){ }else{ assert( x==XN_EXPR ); assert( pIdx->aColExpr!=0 ); - aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr); + aff = tdsqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr); } if( affSQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC; @@ -123711,14 +123711,14 @@ SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){ ** 'D' INTEGER ** 'E' REAL */ -SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){ +SQLITE_PRIVATE void tdsqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){ int i, j; char *zColAff = pTab->zColAff; if( zColAff==0 ){ - sqlite3 *db = sqlite3VdbeDb(v); - zColAff = (char *)sqlite3DbMallocRaw(0, pTab->nCol+1); + tdsqlite3 *db = tdsqlite3VdbeDb(v); + zColAff = (char *)tdsqlite3DbMallocRaw(0, pTab->nCol+1); if( !zColAff ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); return; } @@ -123734,12 +123734,12 @@ SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){ pTab->zColAff = zColAff; } assert( zColAff!=0 ); - i = sqlite3Strlen30NN(zColAff); + i = tdsqlite3Strlen30NN(zColAff); if( i ){ if( iReg ){ - sqlite3VdbeAddOp4(v, OP_Affinity, iReg, i, 0, zColAff, i); + tdsqlite3VdbeAddOp4(v, OP_Affinity, iReg, i, 0, zColAff, i); }else{ - sqlite3VdbeChangeP4(v, -1, zColAff, i); + tdsqlite3VdbeChangeP4(v, -1, zColAff, i); } } } @@ -123751,15 +123751,15 @@ SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){ ** run without using a temporary table for the results of the SELECT. */ static int readsTable(Parse *p, int iDb, Table *pTab){ - Vdbe *v = sqlite3GetVdbe(p); + Vdbe *v = tdsqlite3GetVdbe(p); int i; - int iEnd = sqlite3VdbeCurrentAddr(v); + int iEnd = tdsqlite3VdbeCurrentAddr(v); #ifndef SQLITE_OMIT_VIRTUALTABLE - VTable *pVTab = IsVirtual(pTab) ? sqlite3GetVTable(p->db, pTab) : 0; + VTable *pVTab = IsVirtual(pTab) ? tdsqlite3GetVTable(p->db, pTab) : 0; #endif for(i=1; iopcode==OP_OpenRead && pOp->p3==iDb ){ Index *pIndex; @@ -123803,7 +123803,7 @@ static int exprColumnFlagUnion(Walker *pWalker, Expr *pExpr){ ** back and computes the values for those columns based on the previously ** computed normal columns. */ -SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns( +SQLITE_PRIVATE void tdsqlite3ComputeGeneratedColumns( Parse *pParse, /* Parsing context */ int iRegStore, /* Register holding the first column */ Table *pTab /* The table */ @@ -123821,9 +123821,9 @@ SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns( /* Before computing generated columns, first go through and make sure ** that appropriate affinity has been applied to the regular columns */ - sqlite3TableAffinity(pParse->pVdbe, pTab, iRegStore); + tdsqlite3TableAffinity(pParse->pVdbe, pTab, iRegStore); if( (pTab->tabFlags & TF_HasStored)!=0 - && (pOp = sqlite3VdbeGetOp(pParse->pVdbe,-1))->opcode==OP_Affinity + && (pOp = tdsqlite3VdbeGetOp(pParse->pVdbe,-1))->opcode==OP_Affinity ){ /* Change the OP_Affinity argument to '@' (NONE) for all stored ** columns. '@' is the no-op affinity and those columns have not @@ -123861,7 +123861,7 @@ SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns( w.xSelectCallback2 = 0; /* On the second pass, compute the value of each NOT-AVAILABLE column. - ** Companion code in the TK_COLUMN case of sqlite3ExprCodeTarget() will + ** Companion code in the TK_COLUMN case of tdsqlite3ExprCodeTarget() will ** compute dependencies and mark remove the COLSPAN_NOTAVAIL mark, as ** they are needed. */ @@ -123875,7 +123875,7 @@ SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns( int x; pCol->colFlags |= COLFLAG_BUSY; w.eCode = 0; - sqlite3WalkExpr(&w, pCol->pDflt); + tdsqlite3WalkExpr(&w, pCol->pDflt); pCol->colFlags &= ~COLFLAG_BUSY; if( w.eCode & COLFLAG_NOTAVAIL ){ pRedo = pCol; @@ -123883,14 +123883,14 @@ SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns( } eProgress = 1; assert( pCol->colFlags & COLFLAG_GENERATED ); - x = sqlite3TableColumnToStorage(pTab, i) + iRegStore; - sqlite3ExprCodeGeneratedColumn(pParse, pCol, x); + x = tdsqlite3TableColumnToStorage(pTab, i) + iRegStore; + tdsqlite3ExprCodeGeneratedColumn(pParse, pCol, x); pCol->colFlags &= ~COLFLAG_NOTAVAIL; } } }while( pRedo && eProgress ); if( pRedo ){ - sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", pRedo->zName); + tdsqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", pRedo->zName); } pParse->iSelfTab = 0; } @@ -123931,7 +123931,7 @@ static int autoIncBegin( if( (pTab->tabFlags & TF_Autoincrement)!=0 && (pParse->db->mDbFlags & DBFLAG_Vacuum)==0 ){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); + Parse *pToplevel = tdsqlite3ParseToplevel(pParse); AutoincInfo *pInfo; Table *pSeqTab = pParse->db->aDb[iDb].pSchema->pSeqTab; @@ -123951,7 +123951,7 @@ static int autoIncBegin( pInfo = pToplevel->pAinc; while( pInfo && pInfo->pTab!=pTab ){ pInfo = pInfo->pNext; } if( pInfo==0 ){ - pInfo = sqlite3DbMallocRawNN(pParse->db, sizeof(*pInfo)); + pInfo = tdsqlite3DbMallocRawNN(pParse->db, sizeof(*pInfo)); if( pInfo==0 ) return 0; pInfo->pNext = pToplevel->pAinc; pToplevel->pAinc = pInfo; @@ -123970,9 +123970,9 @@ static int autoIncBegin( ** This routine generates code that will initialize all of the ** register used by the autoincrement tracker. */ -SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse){ +SQLITE_PRIVATE void tdsqlite3AutoincrementBegin(Parse *pParse){ AutoincInfo *p; /* Information about an AUTOINCREMENT */ - sqlite3 *db = pParse->db; /* The database connection */ + tdsqlite3 *db = pParse->db; /* The database connection */ Db *pDb; /* Database only autoinc table */ int memId; /* Register holding max rowid */ Vdbe *v = pParse->pVdbe; /* VDBE under construction */ @@ -123980,7 +123980,7 @@ SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse){ /* This routine is never called during trigger-generation. It is ** only called from the top-level */ assert( pParse->pTriggerTab==0 ); - assert( sqlite3IsToplevel(pParse) ); + assert( tdsqlite3IsToplevel(pParse) ); assert( v ); /* We failed long ago if this is not so */ for(p = pParse->pAinc; p; p = p->pNext){ @@ -124002,10 +124002,10 @@ SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse){ VdbeOp *aOp; pDb = &db->aDb[p->iDb]; memId = p->regCtr; - assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) ); - sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead); - sqlite3VdbeLoadString(v, memId-1, p->pTab->zName); - aOp = sqlite3VdbeAddOpList(v, ArraySize(autoInc), autoInc, iLn); + assert( tdsqlite3SchemaMutexHeld(db, 0, pDb->pSchema) ); + tdsqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead); + tdsqlite3VdbeLoadString(v, memId-1, p->pTab->zName); + aOp = tdsqlite3VdbeAddOpList(v, ArraySize(autoInc), autoInc, iLn); if( aOp==0 ) break; aOp[0].p2 = memId; aOp[0].p3 = memId+2; @@ -124033,7 +124033,7 @@ SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse){ */ static void autoIncStep(Parse *pParse, int memId, int regRowid){ if( memId>0 ){ - sqlite3VdbeAddOp2(pParse->pVdbe, OP_MemMax, memId, regRowid); + tdsqlite3VdbeAddOp2(pParse->pVdbe, OP_MemMax, memId, regRowid); } } @@ -124047,7 +124047,7 @@ static void autoIncStep(Parse *pParse, int memId, int regRowid){ static SQLITE_NOINLINE void autoIncrementEnd(Parse *pParse){ AutoincInfo *p; Vdbe *v = pParse->pVdbe; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; assert( v ); for(p = pParse->pAinc; p; p = p->pNext){ @@ -124064,12 +124064,12 @@ static SQLITE_NOINLINE void autoIncrementEnd(Parse *pParse){ int iRec; int memId = p->regCtr; - iRec = sqlite3GetTempReg(pParse); - assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) ); - sqlite3VdbeAddOp3(v, OP_Le, memId+2, sqlite3VdbeCurrentAddr(v)+7, memId); + iRec = tdsqlite3GetTempReg(pParse); + assert( tdsqlite3SchemaMutexHeld(db, 0, pDb->pSchema) ); + tdsqlite3VdbeAddOp3(v, OP_Le, memId+2, tdsqlite3VdbeCurrentAddr(v)+7, memId); VdbeCoverage(v); - sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenWrite); - aOp = sqlite3VdbeAddOpList(v, ArraySize(autoIncEnd), autoIncEnd, iLn); + tdsqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenWrite); + aOp = tdsqlite3VdbeAddOpList(v, ArraySize(autoIncEnd), autoIncEnd, iLn); if( aOp==0 ) break; aOp[0].p1 = memId+1; aOp[1].p2 = memId+1; @@ -124078,10 +124078,10 @@ static SQLITE_NOINLINE void autoIncrementEnd(Parse *pParse){ aOp[3].p2 = iRec; aOp[3].p3 = memId+1; aOp[3].p5 = OPFLAG_APPEND; - sqlite3ReleaseTempReg(pParse, iRec); + tdsqlite3ReleaseTempReg(pParse, iRec); } } -SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse){ +SQLITE_PRIVATE void tdsqlite3AutoincrementEnd(Parse *pParse){ if( pParse->pAinc ) autoIncrementEnd(pParse); } #else @@ -124200,7 +124200,7 @@ static int xferOptimization( ** end loop ** D: cleanup */ -SQLITE_PRIVATE void sqlite3Insert( +SQLITE_PRIVATE void tdsqlite3Insert( Parse *pParse, /* Parser context */ SrcList *pTabList, /* Name of table into which we are inserting */ Select *pSelect, /* A SELECT statement to use as the data source */ @@ -124208,7 +124208,7 @@ SQLITE_PRIVATE void sqlite3Insert( int onError, /* How to handle constraint errors */ Upsert *pUpsert /* ON CONFLICT clauses for upsert, or NULL */ ){ - sqlite3 *db; /* The main database structure */ + tdsqlite3 *db; /* The main database structure */ Table *pTab; /* The table to insert into. aka TABLE */ int i, j; /* Loop counters */ Vdbe *v; /* Generate code into this virtual machine */ @@ -124259,20 +124259,20 @@ SQLITE_PRIVATE void sqlite3Insert( if( pSelect && (pSelect->selFlags & SF_Values)!=0 && pSelect->pPrior==0 ){ pList = pSelect->pEList; pSelect->pEList = 0; - sqlite3SelectDelete(db, pSelect); + tdsqlite3SelectDelete(db, pSelect); pSelect = 0; } /* Locate the table into which we will be inserting new information. */ assert( pTabList->nSrc==1 ); - pTab = sqlite3SrcListLookup(pParse, pTabList); + pTab = tdsqlite3SrcListLookup(pParse, pTabList); if( pTab==0 ){ goto insert_cleanup; } - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); + iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); assert( iDbnDb ); - if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, + if( tdsqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, db->aDb[iDb].zDbSName) ){ goto insert_cleanup; } @@ -124282,7 +124282,7 @@ SQLITE_PRIVATE void sqlite3Insert( ** inserted into is a view */ #ifndef SQLITE_OMIT_TRIGGER - pTrigger = sqlite3TriggersExist(pParse, pTab, TK_INSERT, 0, &tmask); + pTrigger = tdsqlite3TriggersExist(pParse, pTab, TK_INSERT, 0, &tmask); isView = pTab->pSelect!=0; #else # define pTrigger 0 @@ -124298,22 +124298,22 @@ SQLITE_PRIVATE void sqlite3Insert( /* If pTab is really a view, make sure it has been initialized. ** ViewGetColumnNames() is a no-op if pTab is not a view. */ - if( sqlite3ViewGetColumnNames(pParse, pTab) ){ + if( tdsqlite3ViewGetColumnNames(pParse, pTab) ){ goto insert_cleanup; } /* Cannot insert into a read-only table. */ - if( sqlite3IsReadOnly(pParse, pTab, tmask) ){ + if( tdsqlite3IsReadOnly(pParse, pTab, tmask) ){ goto insert_cleanup; } /* Allocate a VDBE */ - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( v==0 ) goto insert_cleanup; - if( pParse->nested==0 ) sqlite3VdbeCountChanges(v); - sqlite3BeginWriteOperation(pParse, pSelect || pTrigger, iDb); + if( pParse->nested==0 ) tdsqlite3VdbeCountChanges(v); + tdsqlite3BeginWriteOperation(pParse, pSelect || pTrigger, iDb); #ifndef SQLITE_OMIT_XFER_OPT /* If the statement is of the form @@ -124374,7 +124374,7 @@ SQLITE_PRIVATE void sqlite3Insert( } for(i=0; inId; i++){ for(j=0; jnCol; j++){ - if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zName)==0 ){ + if( tdsqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zName)==0 ){ pColumn->a[i].idx = j; if( i!=j ) bIdListInOrder = 0; if( j==pTab->iPKey ){ @@ -124382,7 +124382,7 @@ SQLITE_PRIVATE void sqlite3Insert( } #ifndef SQLITE_OMIT_GENERATED_COLUMNS if( pTab->aCol[j].colFlags & (COLFLAG_STORED|COLFLAG_VIRTUAL) ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "cannot INSERT into generated column \"%s\"", pTab->aCol[j].zName); goto insert_cleanup; @@ -124392,11 +124392,11 @@ SQLITE_PRIVATE void sqlite3Insert( } } if( j>=pTab->nCol ){ - if( sqlite3IsRowid(pColumn->a[i].zName) && !withoutRowid ){ + if( tdsqlite3IsRowid(pColumn->a[i].zName) && !withoutRowid ){ ipkColumn = i; bIdListInOrder = 0; }else{ - sqlite3ErrorMsg(pParse, "table %S has no column named %s", + tdsqlite3ErrorMsg(pParse, "table %S has no column named %s", pTabList, 0, pColumn->a[i].zName); pParse->checkSchema = 1; goto insert_cleanup; @@ -124418,16 +124418,16 @@ SQLITE_PRIVATE void sqlite3Insert( int rc; /* Result code */ regYield = ++pParse->nMem; - addrTop = sqlite3VdbeCurrentAddr(v) + 1; - sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); - sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield); + addrTop = tdsqlite3VdbeCurrentAddr(v) + 1; + tdsqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); + tdsqlite3SelectDestInit(&dest, SRT_Coroutine, regYield); dest.iSdst = bIdListInOrder ? regData : 0; dest.nSdst = pTab->nCol; - rc = sqlite3Select(pParse, pSelect, &dest); + rc = tdsqlite3Select(pParse, pSelect, &dest); regFromSelect = dest.iSdst; if( rc || db->mallocFailed || pParse->nErr ) goto insert_cleanup; - sqlite3VdbeEndCoroutine(v, regYield); - sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */ + tdsqlite3VdbeEndCoroutine(v, regYield); + tdsqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */ assert( pSelect->pEList ); nColumn = pSelect->pEList->nExpr; @@ -124460,17 +124460,17 @@ SQLITE_PRIVATE void sqlite3Insert( int addrL; /* Label "L" */ srcTab = pParse->nTab++; - regRec = sqlite3GetTempReg(pParse); - regTempRowid = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, srcTab, nColumn); - addrL = sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_MakeRecord, regFromSelect, nColumn, regRec); - sqlite3VdbeAddOp2(v, OP_NewRowid, srcTab, regTempRowid); - sqlite3VdbeAddOp3(v, OP_Insert, srcTab, regRec, regTempRowid); - sqlite3VdbeGoto(v, addrL); - sqlite3VdbeJumpHere(v, addrL); - sqlite3ReleaseTempReg(pParse, regRec); - sqlite3ReleaseTempReg(pParse, regTempRowid); + regRec = tdsqlite3GetTempReg(pParse); + regTempRowid = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, srcTab, nColumn); + addrL = tdsqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm); VdbeCoverage(v); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, regFromSelect, nColumn, regRec); + tdsqlite3VdbeAddOp2(v, OP_NewRowid, srcTab, regTempRowid); + tdsqlite3VdbeAddOp3(v, OP_Insert, srcTab, regRec, regTempRowid); + tdsqlite3VdbeGoto(v, addrL); + tdsqlite3VdbeJumpHere(v, addrL); + tdsqlite3ReleaseTempReg(pParse, regRec); + tdsqlite3ReleaseTempReg(pParse, regTempRowid); } }else{ /* This is the case if the data for the INSERT is coming from a @@ -124483,7 +124483,7 @@ SQLITE_PRIVATE void sqlite3Insert( assert( useTempTable==0 ); if( pList ){ nColumn = pList->nExpr; - if( sqlite3ResolveExprListNames(&sNC, pList) ){ + if( tdsqlite3ResolveExprListNames(&sNC, pList) ){ goto insert_cleanup; } }else{ @@ -124519,13 +124519,13 @@ SQLITE_PRIVATE void sqlite3Insert( if( pTab->aCol[i].colFlags & COLFLAG_NOINSERT ) nHidden++; } if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "table %S has %d columns but %d values were supplied", pTabList, 0, pTab->nCol-nHidden, nColumn); goto insert_cleanup; } if( pColumn!=0 && nColumn!=pColumn->nId ){ - sqlite3ErrorMsg(pParse, "%d values for %d columns", nColumn, pColumn->nId); + tdsqlite3ErrorMsg(pParse, "%d values for %d columns", nColumn, pColumn->nId); goto insert_cleanup; } @@ -124536,15 +124536,15 @@ SQLITE_PRIVATE void sqlite3Insert( && !pParse->pTriggerTab ){ regRowCount = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount); } /* If this is not a view, open the table and and all indices */ if( !isView ){ int nIdx; - nIdx = sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, -1, 0, + nIdx = tdsqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, -1, 0, &iDataCur, &iIdxCur); - aRegIdx = sqlite3DbMallocRawNN(db, sizeof(int)*(nIdx+2)); + aRegIdx = tdsqlite3DbMallocRawNN(db, sizeof(int)*(nIdx+2)); if( aRegIdx==0 ){ goto insert_cleanup; } @@ -124558,15 +124558,15 @@ SQLITE_PRIVATE void sqlite3Insert( #ifndef SQLITE_OMIT_UPSERT if( pUpsert ){ if( IsVirtual(pTab) ){ - sqlite3ErrorMsg(pParse, "UPSERT not implemented for virtual table \"%s\"", + tdsqlite3ErrorMsg(pParse, "UPSERT not implemented for virtual table \"%s\"", pTab->zName); goto insert_cleanup; } if( pTab->pSelect ){ - sqlite3ErrorMsg(pParse, "cannot UPSERT a view"); + tdsqlite3ErrorMsg(pParse, "cannot UPSERT a view"); goto insert_cleanup; } - if( sqlite3HasExplicitNulls(pParse, pUpsert->pUpsertTarget) ){ + if( tdsqlite3HasExplicitNulls(pParse, pUpsert->pUpsertTarget) ){ goto insert_cleanup; } pTabList->a[0].iCursor = iDataCur; @@ -124575,7 +124575,7 @@ SQLITE_PRIVATE void sqlite3Insert( pUpsert->iDataCur = iDataCur; pUpsert->iIdxCur = iIdxCur; if( pUpsert->pUpsertTarget ){ - sqlite3UpsertAnalyzeTarget(pParse, pTabList, pUpsert); + tdsqlite3UpsertAnalyzeTarget(pParse, pTabList, pUpsert); } } #endif @@ -124592,8 +124592,8 @@ SQLITE_PRIVATE void sqlite3Insert( ** end loop ** D: ... */ - addrInsTop = sqlite3VdbeAddOp1(v, OP_Rewind, srcTab); VdbeCoverage(v); - addrCont = sqlite3VdbeCurrentAddr(v); + addrInsTop = tdsqlite3VdbeAddOp1(v, OP_Rewind, srcTab); VdbeCoverage(v); + addrCont = tdsqlite3VdbeCurrentAddr(v); }else if( pSelect ){ /* This block codes the top of loop only. The complete loop is the ** following pseudocode (template 3): @@ -124603,14 +124603,14 @@ SQLITE_PRIVATE void sqlite3Insert( ** goto C ** D: ... */ - sqlite3VdbeReleaseRegisters(pParse, regData, pTab->nCol, 0, 0); - addrInsTop = addrCont = sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm); + tdsqlite3VdbeReleaseRegisters(pParse, regData, pTab->nCol, 0, 0); + addrInsTop = addrCont = tdsqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm); VdbeCoverage(v); if( ipkColumn>=0 ){ /* tag-20191021-001: If the INTEGER PRIMARY KEY is being generated by the ** SELECT, go ahead and copy the value into the rowid slot now, so that ** the value does not get overwritten by a NULL at tag-20191021-002. */ - sqlite3VdbeAddOp2(v, OP_Copy, regFromSelect+ipkColumn, regRowid); + tdsqlite3VdbeAddOp2(v, OP_Copy, regFromSelect+ipkColumn, regRowid); } } @@ -124632,7 +124632,7 @@ SQLITE_PRIVATE void sqlite3Insert( ** using the rowid. So put a NULL in the IPK slot of the record to avoid ** using excess space. The file format definition requires this extra ** NULL - we cannot optimize further by skipping the column completely */ - sqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore); + tdsqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore); continue; } if( ((colFlags = pTab->aCol[i].colFlags) & COLFLAG_NOINSERT)!=0 ){ @@ -124649,13 +124649,13 @@ SQLITE_PRIVATE void sqlite3Insert( ** to a second block of registers, so the register needs to be ** initialized to NULL to avoid an uninitialized register read */ if( tmask & TRIGGER_BEFORE ){ - sqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore); + tdsqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore); } continue; }else if( pColumn==0 ){ /* Hidden columns that are not explicitly named in the INSERT ** get there default value */ - sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); + tdsqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); continue; } } @@ -124664,35 +124664,35 @@ SQLITE_PRIVATE void sqlite3Insert( if( j>=pColumn->nId ){ /* A column not named in the insert column list gets its ** default value */ - sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); + tdsqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); continue; } k = j; }else if( nColumn==0 ){ /* This is INSERT INTO ... DEFAULT VALUES. Load the default value. */ - sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); + tdsqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); continue; }else{ k = i - nHidden; } if( useTempTable ){ - sqlite3VdbeAddOp3(v, OP_Column, srcTab, k, iRegStore); + tdsqlite3VdbeAddOp3(v, OP_Column, srcTab, k, iRegStore); }else if( pSelect ){ if( regFromSelect!=regData ){ - sqlite3VdbeAddOp2(v, OP_SCopy, regFromSelect+k, iRegStore); + tdsqlite3VdbeAddOp2(v, OP_SCopy, regFromSelect+k, iRegStore); } }else{ - sqlite3ExprCode(pParse, pList->a[k].pExpr, iRegStore); + tdsqlite3ExprCode(pParse, pList->a[k].pExpr, iRegStore); } } /* Run the BEFORE and INSTEAD OF triggers, if there are any */ - endOfLoop = sqlite3VdbeMakeLabel(pParse); + endOfLoop = tdsqlite3VdbeMakeLabel(pParse); if( tmask & TRIGGER_BEFORE ){ - int regCols = sqlite3GetTempRange(pParse, pTab->nCol+1); + int regCols = tdsqlite3GetTempRange(pParse, pTab->nCol+1); /* build the NEW.* reference row. Note that if there is an INTEGER ** PRIMARY KEY into which a NULL is being inserted, that NULL will be @@ -124701,20 +124701,20 @@ SQLITE_PRIVATE void sqlite3Insert( ** not happened yet) so we substitute a rowid of -1 */ if( ipkColumn<0 ){ - sqlite3VdbeAddOp2(v, OP_Integer, -1, regCols); + tdsqlite3VdbeAddOp2(v, OP_Integer, -1, regCols); }else{ int addr1; assert( !withoutRowid ); if( useTempTable ){ - sqlite3VdbeAddOp3(v, OP_Column, srcTab, ipkColumn, regCols); + tdsqlite3VdbeAddOp3(v, OP_Column, srcTab, ipkColumn, regCols); }else{ assert( pSelect==0 ); /* Otherwise useTempTable is true */ - sqlite3ExprCode(pParse, pList->a[ipkColumn].pExpr, regCols); + tdsqlite3ExprCode(pParse, pList->a[ipkColumn].pExpr, regCols); } - addr1 = sqlite3VdbeAddOp1(v, OP_NotNull, regCols); VdbeCoverage(v); - sqlite3VdbeAddOp2(v, OP_Integer, -1, regCols); - sqlite3VdbeJumpHere(v, addr1); - sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); VdbeCoverage(v); + addr1 = tdsqlite3VdbeAddOp1(v, OP_NotNull, regCols); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_Integer, -1, regCols); + tdsqlite3VdbeJumpHere(v, addr1); + tdsqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); VdbeCoverage(v); } /* Cannot have triggers on a virtual table. If it were possible, @@ -124724,7 +124724,7 @@ SQLITE_PRIVATE void sqlite3Insert( /* Copy the new data already generated. */ assert( pTab->nNVCol>0 ); - sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1); + tdsqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1); #ifndef SQLITE_OMIT_GENERATED_COLUMNS /* Compute the new value for generated columns after all other @@ -124734,7 +124734,7 @@ SQLITE_PRIVATE void sqlite3Insert( if( pTab->tabFlags & TF_HasGenerated ){ testcase( pTab->tabFlags & TF_HasVirtual ); testcase( pTab->tabFlags & TF_HasStored ); - sqlite3ComputeGeneratedColumns(pParse, regCols+1, pTab); + tdsqlite3ComputeGeneratedColumns(pParse, regCols+1, pTab); } #endif @@ -124744,34 +124744,34 @@ SQLITE_PRIVATE void sqlite3Insert( ** table column affinities. */ if( !isView ){ - sqlite3TableAffinity(v, pTab, regCols+1); + tdsqlite3TableAffinity(v, pTab, regCols+1); } /* Fire BEFORE or INSTEAD OF triggers */ - sqlite3CodeRowTrigger(pParse, pTrigger, TK_INSERT, 0, TRIGGER_BEFORE, + tdsqlite3CodeRowTrigger(pParse, pTrigger, TK_INSERT, 0, TRIGGER_BEFORE, pTab, regCols-pTab->nCol-1, onError, endOfLoop); - sqlite3ReleaseTempRange(pParse, regCols, pTab->nCol+1); + tdsqlite3ReleaseTempRange(pParse, regCols, pTab->nCol+1); } if( !isView ){ if( IsVirtual(pTab) ){ /* The row that the VUpdate opcode will delete: none */ - sqlite3VdbeAddOp2(v, OP_Null, 0, regIns); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, regIns); } if( ipkColumn>=0 ){ /* Compute the new rowid */ if( useTempTable ){ - sqlite3VdbeAddOp3(v, OP_Column, srcTab, ipkColumn, regRowid); + tdsqlite3VdbeAddOp3(v, OP_Column, srcTab, ipkColumn, regRowid); }else if( pSelect ){ /* Rowid already initialized at tag-20191021-001 */ }else{ Expr *pIpk = pList->a[ipkColumn].pExpr; if( pIpk->op==TK_NULL && !IsVirtual(pTab) ){ - sqlite3VdbeAddOp3(v, OP_NewRowid, iDataCur, regRowid, regAutoinc); + tdsqlite3VdbeAddOp3(v, OP_NewRowid, iDataCur, regRowid, regAutoinc); appendFlag = 1; }else{ - sqlite3ExprCode(pParse, pList->a[ipkColumn].pExpr, regRowid); + tdsqlite3ExprCode(pParse, pList->a[ipkColumn].pExpr, regRowid); } } /* If the PRIMARY KEY expression is NULL, then use OP_NewRowid @@ -124780,19 +124780,19 @@ SQLITE_PRIVATE void sqlite3Insert( if( !appendFlag ){ int addr1; if( !IsVirtual(pTab) ){ - addr1 = sqlite3VdbeAddOp1(v, OP_NotNull, regRowid); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_NewRowid, iDataCur, regRowid, regAutoinc); - sqlite3VdbeJumpHere(v, addr1); + addr1 = tdsqlite3VdbeAddOp1(v, OP_NotNull, regRowid); VdbeCoverage(v); + tdsqlite3VdbeAddOp3(v, OP_NewRowid, iDataCur, regRowid, regAutoinc); + tdsqlite3VdbeJumpHere(v, addr1); }else{ - addr1 = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp2(v, OP_IsNull, regRowid, addr1+2); VdbeCoverage(v); + addr1 = tdsqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeAddOp2(v, OP_IsNull, regRowid, addr1+2); VdbeCoverage(v); } - sqlite3VdbeAddOp1(v, OP_MustBeInt, regRowid); VdbeCoverage(v); + tdsqlite3VdbeAddOp1(v, OP_MustBeInt, regRowid); VdbeCoverage(v); } }else if( IsVirtual(pTab) || withoutRowid ){ - sqlite3VdbeAddOp2(v, OP_Null, 0, regRowid); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, regRowid); }else{ - sqlite3VdbeAddOp3(v, OP_NewRowid, iDataCur, regRowid, regAutoinc); + tdsqlite3VdbeAddOp3(v, OP_NewRowid, iDataCur, regRowid, regAutoinc); appendFlag = 1; } autoIncStep(pParse, regAutoinc, regRowid); @@ -124803,7 +124803,7 @@ SQLITE_PRIVATE void sqlite3Insert( ** computing the ROWID in case one of the generated columns ** is derived from the INTEGER PRIMARY KEY. */ if( pTab->tabFlags & TF_HasGenerated ){ - sqlite3ComputeGeneratedColumns(pParse, regRowid+1, pTab); + tdsqlite3ComputeGeneratedColumns(pParse, regRowid+1, pTab); } #endif @@ -124812,20 +124812,20 @@ SQLITE_PRIVATE void sqlite3Insert( */ #ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pTab) ){ - const char *pVTab = (const char *)sqlite3GetVTable(db, pTab); - sqlite3VtabMakeWritable(pParse, pTab); - sqlite3VdbeAddOp4(v, OP_VUpdate, 1, pTab->nCol+2, regIns, pVTab, P4_VTAB); - sqlite3VdbeChangeP5(v, onError==OE_Default ? OE_Abort : onError); - sqlite3MayAbort(pParse); + const char *pVTab = (const char *)tdsqlite3GetVTable(db, pTab); + tdsqlite3VtabMakeWritable(pParse, pTab); + tdsqlite3VdbeAddOp4(v, OP_VUpdate, 1, pTab->nCol+2, regIns, pVTab, P4_VTAB); + tdsqlite3VdbeChangeP5(v, onError==OE_Default ? OE_Abort : onError); + tdsqlite3MayAbort(pParse); }else #endif { int isReplace; /* Set to true if constraints may cause a replace */ int bUseSeek; /* True to use OPFLAG_SEEKRESULT */ - sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur, + tdsqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur, regIns, 0, ipkColumn>=0, onError, endOfLoop, &isReplace, 0, pUpsert ); - sqlite3FkCheck(pParse, pTab, 0, regIns, 0, 0); + tdsqlite3FkCheck(pParse, pTab, 0, regIns, 0, 0); /* Set the OPFLAG_USESEEKRESULT flag if either (a) there are no REPLACE ** constraints or (b) there are no triggers and this table is not a @@ -124835,8 +124835,8 @@ SQLITE_PRIVATE void sqlite3Insert( ** cursor that is disturbed. And these instructions both clear the ** VdbeCursor.seekResult variable, disabling the OPFLAG_USESEEKRESULT ** functionality. */ - bUseSeek = (isReplace==0 || !sqlite3VdbeHasSubProgram(v)); - sqlite3CompleteInsertion(pParse, pTab, iDataCur, iIdxCur, + bUseSeek = (isReplace==0 || !tdsqlite3VdbeHasSubProgram(v)); + tdsqlite3CompleteInsertion(pParse, pTab, iDataCur, iIdxCur, regIns, aRegIdx, 0, appendFlag, bUseSeek ); } @@ -124845,35 +124845,35 @@ SQLITE_PRIVATE void sqlite3Insert( /* Update the count of rows that are inserted */ if( regRowCount ){ - sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1); + tdsqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1); } if( pTrigger ){ /* Code AFTER triggers */ - sqlite3CodeRowTrigger(pParse, pTrigger, TK_INSERT, 0, TRIGGER_AFTER, + tdsqlite3CodeRowTrigger(pParse, pTrigger, TK_INSERT, 0, TRIGGER_AFTER, pTab, regData-2-pTab->nCol, onError, endOfLoop); } /* The bottom of the main insertion loop, if the data source ** is a SELECT statement. */ - sqlite3VdbeResolveLabel(v, endOfLoop); + tdsqlite3VdbeResolveLabel(v, endOfLoop); if( useTempTable ){ - sqlite3VdbeAddOp2(v, OP_Next, srcTab, addrCont); VdbeCoverage(v); - sqlite3VdbeJumpHere(v, addrInsTop); - sqlite3VdbeAddOp1(v, OP_Close, srcTab); + tdsqlite3VdbeAddOp2(v, OP_Next, srcTab, addrCont); VdbeCoverage(v); + tdsqlite3VdbeJumpHere(v, addrInsTop); + tdsqlite3VdbeAddOp1(v, OP_Close, srcTab); }else if( pSelect ){ - sqlite3VdbeGoto(v, addrCont); + tdsqlite3VdbeGoto(v, addrCont); #ifdef SQLITE_DEBUG /* If we are jumping back to an OP_Yield that is preceded by an ** OP_ReleaseReg, set the p5 flag on the OP_Goto so that the ** OP_ReleaseReg will be included in the loop. */ - if( sqlite3VdbeGetOp(v, addrCont-1)->opcode==OP_ReleaseReg ){ - assert( sqlite3VdbeGetOp(v, addrCont)->opcode==OP_Yield ); - sqlite3VdbeChangeP5(v, 1); + if( tdsqlite3VdbeGetOp(v, addrCont-1)->opcode==OP_ReleaseReg ){ + assert( tdsqlite3VdbeGetOp(v, addrCont)->opcode==OP_Yield ); + tdsqlite3VdbeChangeP5(v, 1); } #endif - sqlite3VdbeJumpHere(v, addrInsTop); + tdsqlite3VdbeJumpHere(v, addrInsTop); } insert_end: @@ -124882,27 +124882,27 @@ insert_end: ** autoincrement tables. */ if( pParse->nested==0 && pParse->pTriggerTab==0 ){ - sqlite3AutoincrementEnd(pParse); + tdsqlite3AutoincrementEnd(pParse); } /* ** Return the number of rows inserted. If this routine is - ** generating code because of a call to sqlite3NestedParse(), do not + ** generating code because of a call to tdsqlite3NestedParse(), do not ** invoke the callback function. */ if( regRowCount ){ - sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", SQLITE_STATIC); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1); + tdsqlite3VdbeSetNumCols(v, 1); + tdsqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", SQLITE_STATIC); } insert_cleanup: - sqlite3SrcListDelete(db, pTabList); - sqlite3ExprListDelete(db, pList); - sqlite3UpsertDelete(db, pUpsert); - sqlite3SelectDelete(db, pSelect); - sqlite3IdListDelete(db, pColumn); - sqlite3DbFree(db, aRegIdx); + tdsqlite3SrcListDelete(db, pTabList); + tdsqlite3ExprListDelete(db, pList); + tdsqlite3UpsertDelete(db, pUpsert); + tdsqlite3SelectDelete(db, pSelect); + tdsqlite3IdListDelete(db, pColumn); + tdsqlite3DbFree(db, aRegIdx); } /* Make sure "isView" and other macros defined above are undefined. Otherwise @@ -124920,12 +124920,12 @@ insert_cleanup: /* ** Meanings of bits in of pWalker->eCode for -** sqlite3ExprReferencesUpdatedColumn() +** tdsqlite3ExprReferencesUpdatedColumn() */ #define CKCNSTRNT_COLUMN 0x01 /* CHECK constraint uses a changing column */ #define CKCNSTRNT_ROWID 0x02 /* CHECK constraint references the ROWID */ -/* This is the Walker callback from sqlite3ExprReferencesUpdatedColumn(). +/* This is the Walker callback from tdsqlite3ExprReferencesUpdatedColumn(). * Set bit 0x01 of pWalker->eCode if pWalker->eCode to 0 and if this ** expression node references any of the ** columns that are being modifed by an UPDATE statement. @@ -124959,7 +124959,7 @@ static int checkConstraintExprNode(Walker *pWalker, Expr *pExpr){ ** the expression uses one or more of columns identified by the second and ** third arguments. */ -SQLITE_PRIVATE int sqlite3ExprReferencesUpdatedColumn( +SQLITE_PRIVATE int tdsqlite3ExprReferencesUpdatedColumn( Expr *pExpr, /* The expression to be checked */ int *aiChng, /* aiChng[x]>=0 if column x changed by the UPDATE */ int chngRowid /* True if UPDATE changes the rowid */ @@ -124969,7 +124969,7 @@ SQLITE_PRIVATE int sqlite3ExprReferencesUpdatedColumn( w.eCode = 0; w.xExprCallback = checkConstraintExprNode; w.u.aiCol = aiChng; - sqlite3WalkExpr(&w, pExpr); + tdsqlite3WalkExpr(&w, pExpr); if( !chngRowid ){ testcase( (w.eCode & CKCNSTRNT_ROWID)!=0 ); w.eCode &= ~CKCNSTRNT_ROWID; @@ -125040,12 +125040,12 @@ SQLITE_PRIVATE int sqlite3ExprReferencesUpdatedColumn( ** Constraint type Action What Happens ** --------------- ---------- ---------------------------------------- ** any ROLLBACK The current transaction is rolled back and -** sqlite3_step() returns immediately with a +** tdsqlite3_step() returns immediately with a ** return code of SQLITE_CONSTRAINT. ** ** any ABORT Back out changes from the current command ** only (do not do a complete rollback) then -** cause sqlite3_step() to return immediately +** cause tdsqlite3_step() to return immediately ** with SQLITE_CONSTRAINT. ** ** any FAIL Sqlite3_step() returns immediately with a @@ -125072,7 +125072,7 @@ SQLITE_PRIVATE int sqlite3ExprReferencesUpdatedColumn( ** is used. Or if pParse->onError==OE_Default then the onError value ** for the constraint is used. */ -SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( +SQLITE_PRIVATE void tdsqlite3GenerateConstraintChecks( Parse *pParse, /* The parser context */ Table *pTab, /* The table being inserted or updated */ int *aRegIdx, /* Use register aRegIdx[i] for index i. 0 for unused */ @@ -125090,7 +125090,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( Vdbe *v; /* VDBE under constrution */ Index *pIdx; /* Pointer to one of the indices */ Index *pPk = 0; /* The PRIMARY KEY index */ - sqlite3 *db; /* Database connection */ + tdsqlite3 *db; /* Database connection */ int i; /* loop counter */ int ix; /* Index loop counter */ int nCol; /* Number of columns */ @@ -125114,7 +125114,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( isUpdate = regOldData!=0; db = pParse->db; - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); assert( v!=0 ); assert( pTab->pSelect==0 ); /* This table is not a VIEW */ nCol = pTab->nCol; @@ -125127,7 +125127,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( pPk = 0; nPkField = 1; }else{ - pPk = sqlite3PrimaryKeyIndex(pTab); + pPk = tdsqlite3PrimaryKeyIndex(pTab); nPkField = pPk->nKeyCol; } @@ -125181,35 +125181,35 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( } assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail || onError==OE_Ignore || onError==OE_Replace ); - testcase( i!=sqlite3TableColumnToStorage(pTab, i) ); - iReg = sqlite3TableColumnToStorage(pTab, i) + regNewData + 1; + testcase( i!=tdsqlite3TableColumnToStorage(pTab, i) ); + iReg = tdsqlite3TableColumnToStorage(pTab, i) + regNewData + 1; switch( onError ){ case OE_Replace: { - int addr1 = sqlite3VdbeAddOp1(v, OP_NotNull, iReg); + int addr1 = tdsqlite3VdbeAddOp1(v, OP_NotNull, iReg); VdbeCoverage(v); assert( (pCol->colFlags & COLFLAG_GENERATED)==0 ); nSeenReplace++; - sqlite3ExprCode(pParse, pCol->pDflt, iReg); - sqlite3VdbeJumpHere(v, addr1); + tdsqlite3ExprCode(pParse, pCol->pDflt, iReg); + tdsqlite3VdbeJumpHere(v, addr1); break; } case OE_Abort: - sqlite3MayAbort(pParse); + tdsqlite3MayAbort(pParse); /* Fall through */ case OE_Rollback: case OE_Fail: { - char *zMsg = sqlite3MPrintf(db, "%s.%s", pTab->zName, + char *zMsg = tdsqlite3MPrintf(db, "%s.%s", pTab->zName, pCol->zName); - sqlite3VdbeAddOp3(v, OP_HaltIfNull, SQLITE_CONSTRAINT_NOTNULL, + tdsqlite3VdbeAddOp3(v, OP_HaltIfNull, SQLITE_CONSTRAINT_NOTNULL, onError, iReg); - sqlite3VdbeAppendP4(v, zMsg, P4_DYNAMIC); - sqlite3VdbeChangeP5(v, P5_ConstraintNotNull); + tdsqlite3VdbeAppendP4(v, zMsg, P4_DYNAMIC); + tdsqlite3VdbeChangeP5(v, P5_ConstraintNotNull); VdbeCoverage(v); break; } default: { assert( onError==OE_Ignore ); - sqlite3VdbeAddOp2(v, OP_IsNull, iReg, ignoreDest); + tdsqlite3VdbeAddOp2(v, OP_IsNull, iReg, ignoreDest); VdbeCoverage(v); break; } @@ -125229,7 +125229,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( ** first pass, recomputed values for all generated columns, as ** those values might depend on columns affected by the REPLACE. */ - sqlite3ComputeGeneratedColumns(pParse, regNewData+1, pTab); + tdsqlite3ComputeGeneratedColumns(pParse, regNewData+1, pTab); } #endif } /* end of 2-pass loop */ @@ -125246,26 +125246,26 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( int allOk; Expr *pExpr = pCheck->a[i].pExpr; if( aiChng - && !sqlite3ExprReferencesUpdatedColumn(pExpr, aiChng, pkChng) + && !tdsqlite3ExprReferencesUpdatedColumn(pExpr, aiChng, pkChng) ){ /* The check constraints do not reference any of the columns being ** updated so there is no point it verifying the check constraint */ continue; } - allOk = sqlite3VdbeMakeLabel(pParse); - sqlite3VdbeVerifyAbortable(v, onError); - sqlite3ExprIfTrue(pParse, pExpr, allOk, SQLITE_JUMPIFNULL); + allOk = tdsqlite3VdbeMakeLabel(pParse); + tdsqlite3VdbeVerifyAbortable(v, onError); + tdsqlite3ExprIfTrue(pParse, pExpr, allOk, SQLITE_JUMPIFNULL); if( onError==OE_Ignore ){ - sqlite3VdbeGoto(v, ignoreDest); + tdsqlite3VdbeGoto(v, ignoreDest); }else{ char *zName = pCheck->a[i].zEName; if( zName==0 ) zName = pTab->zName; if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-26383-51744 */ - sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK, + tdsqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK, onError, zName, P4_TRANSIENT, P5_ConstraintCheck); } - sqlite3VdbeResolveLabel(v, allOk); + tdsqlite3VdbeResolveLabel(v, allOk); } pParse->iSelfTab = 0; } @@ -125297,7 +125297,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( ** ** The ordering of (2) and (3) is accomplished by making sure the linked ** list of indexes attached to a table puts all OE_Replace indexes last - ** in the list. See sqlite3CreateIndex() for where that happens. + ** in the list. See tdsqlite3CreateIndex() for where that happens. */ if( pUpsert ){ @@ -125310,7 +125310,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){ /* If the constraint-target uniqueness check must be run first. ** Jump to that uniqueness check now */ - upsertJump = sqlite3VdbeAddOp0(v, OP_Goto); + upsertJump = tdsqlite3VdbeAddOp0(v, OP_Goto); VdbeComment((v, "UPSERT constraint goes first")); } } @@ -125342,19 +125342,19 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( regTrigCnt = 0; }else{ if( db->flags&SQLITE_RecTriggers ){ - pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); - regTrigCnt = pTrigger!=0 || sqlite3FkRequired(pParse, pTab, 0, 0); + pTrigger = tdsqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); + regTrigCnt = pTrigger!=0 || tdsqlite3FkRequired(pParse, pTab, 0, 0); }else{ pTrigger = 0; - regTrigCnt = sqlite3FkRequired(pParse, pTab, 0, 0); + regTrigCnt = tdsqlite3FkRequired(pParse, pTab, 0, 0); } if( regTrigCnt ){ /* Replace triggers might exist. Allocate the counter and ** initialize it to zero. */ regTrigCnt = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Integer, 0, regTrigCnt); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, regTrigCnt); VdbeComment((v, "trigger count")); - lblRecheckOk = sqlite3VdbeMakeLabel(pParse); + lblRecheckOk = tdsqlite3VdbeMakeLabel(pParse); addrRecheck = lblRecheckOk; } } @@ -125363,7 +125363,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( ** exist in the table. */ if( pkChng && pPk==0 ){ - int addrRowidOk = sqlite3VdbeMakeLabel(pParse); + int addrRowidOk = tdsqlite3VdbeMakeLabel(pParse); /* Figure out what action to take in case of a rowid collision */ onError = pTab->keyConf; @@ -125391,7 +125391,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( && onError!=overrideError /* Rules for other contraints are different */ && pTab->pIndex /* There exist other constraints */ ){ - ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1; + ipkTop = tdsqlite3VdbeAddOp0(v, OP_Goto)+1; VdbeComment((v, "defer IPK REPLACE until last")); } @@ -125399,16 +125399,16 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( /* pkChng!=0 does not mean that the rowid has changed, only that ** it might have changed. Skip the conflict logic below if the rowid ** is unchanged. */ - sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData); - sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); + tdsqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData); + tdsqlite3VdbeChangeP5(v, SQLITE_NOTNULL); VdbeCoverage(v); } /* Check to see if the new rowid already exists in the table. Skip ** the following conflict logic if it does not. */ VdbeNoopComment((v, "uniqueness check for ROWID")); - sqlite3VdbeVerifyAbortable(v, onError); - sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData); + tdsqlite3VdbeVerifyAbortable(v, onError); + tdsqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData); VdbeCoverage(v); switch( onError ){ @@ -125422,7 +125422,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( testcase( onError==OE_Rollback ); testcase( onError==OE_Abort ); testcase( onError==OE_Fail ); - sqlite3RowidConstraint(pParse, onError, pTab); + tdsqlite3RowidConstraint(pParse, onError, pTab); break; } case OE_Replace: { @@ -125440,7 +125440,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( ** If either GenerateRowDelete() or GenerateRowIndexDelete() is called, ** also invoke MultiWrite() to indicate that this VDBE may require ** statement rollback (if the statement is aborted after the delete - ** takes place). Earlier versions called sqlite3MultiWrite() regardless, + ** takes place). Earlier versions called tdsqlite3MultiWrite() regardless, ** but being more selective here allows statements like: ** ** REPLACE INTO t(rowid) VALUES($newrowid) @@ -125449,10 +125449,10 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( ** table. */ if( regTrigCnt ){ - sqlite3MultiWrite(pParse); - sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, + tdsqlite3MultiWrite(pParse); + tdsqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, regNewData, 1, 0, OE_Replace, 1, -1); - sqlite3VdbeAddOp2(v, OP_AddImm, regTrigCnt, 1); /* incr trigger cnt */ + tdsqlite3VdbeAddOp2(v, OP_AddImm, regTrigCnt, 1); /* incr trigger cnt */ nReplaceTrig++; }else{ #ifdef SQLITE_ENABLE_PREUPDATE_HOOK @@ -125461,12 +125461,12 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( ** not modify the b-tree. It is more efficient to let the coming ** OP_Insert replace the existing entry than it is to delete the ** existing entry and then insert a new one. */ - sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, OPFLAG_ISNOOP); - sqlite3VdbeAppendP4(v, pTab, P4_TABLE); + tdsqlite3VdbeAddOp2(v, OP_Delete, iDataCur, OPFLAG_ISNOOP); + tdsqlite3VdbeAppendP4(v, pTab, P4_TABLE); #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ if( pTab->pIndex ){ - sqlite3MultiWrite(pParse); - sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,-1); + tdsqlite3MultiWrite(pParse); + tdsqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,-1); } } seenReplace = 1; @@ -125474,20 +125474,20 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( } #ifndef SQLITE_OMIT_UPSERT case OE_Update: { - sqlite3UpsertDoUpdate(pParse, pUpsert, pTab, 0, iDataCur); + tdsqlite3UpsertDoUpdate(pParse, pUpsert, pTab, 0, iDataCur); /* Fall through */ } #endif case OE_Ignore: { testcase( onError==OE_Ignore ); - sqlite3VdbeGoto(v, ignoreDest); + tdsqlite3VdbeGoto(v, ignoreDest); break; } } - sqlite3VdbeResolveLabel(v, addrRowidOk); + tdsqlite3VdbeResolveLabel(v, addrRowidOk); if( ipkTop ){ - ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto); - sqlite3VdbeJumpHere(v, ipkTop-1); + ipkBottom = tdsqlite3VdbeAddOp0(v, OP_Goto); + tdsqlite3VdbeJumpHere(v, ipkTop-1); } } @@ -125508,14 +125508,14 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */ if( pUpIdx==pIdx ){ addrUniqueOk = upsertJump+1; - upsertBypass = sqlite3VdbeGoto(v, 0); + upsertBypass = tdsqlite3VdbeGoto(v, 0); VdbeComment((v, "Skip upsert subroutine")); - sqlite3VdbeJumpHere(v, upsertJump); + tdsqlite3VdbeJumpHere(v, upsertJump); }else{ - addrUniqueOk = sqlite3VdbeMakeLabel(pParse); + addrUniqueOk = tdsqlite3VdbeMakeLabel(pParse); } if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){ - sqlite3TableAffinity(v, pTab, regNewData+1); + tdsqlite3TableAffinity(v, pTab, regNewData+1); bAffinityDone = 1; } VdbeNoopComment((v, "uniqueness check for %s", pIdx->zName)); @@ -125524,9 +125524,9 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( /* Skip partial indices for which the WHERE clause is not true */ if( pIdx->pPartIdxWhere ){ - sqlite3VdbeAddOp2(v, OP_Null, 0, aRegIdx[ix]); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, aRegIdx[ix]); pParse->iSelfTab = -(regNewData+1); - sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, addrUniqueOk, + tdsqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, addrUniqueOk, SQLITE_JUMPIFNULL); pParse->iSelfTab = 0; } @@ -125540,42 +125540,42 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( int x; if( iField==XN_EXPR ){ pParse->iSelfTab = -(regNewData+1); - sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i); + tdsqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i); pParse->iSelfTab = 0; VdbeComment((v, "%s column %d", pIdx->zName, i)); }else if( iField==XN_ROWID || iField==pTab->iPKey ){ x = regNewData; - sqlite3VdbeAddOp2(v, OP_IntCopy, x, regIdx+i); + tdsqlite3VdbeAddOp2(v, OP_IntCopy, x, regIdx+i); VdbeComment((v, "rowid")); }else{ - testcase( sqlite3TableColumnToStorage(pTab, iField)!=iField ); - x = sqlite3TableColumnToStorage(pTab, iField) + regNewData + 1; - sqlite3VdbeAddOp2(v, OP_SCopy, x, regIdx+i); + testcase( tdsqlite3TableColumnToStorage(pTab, iField)!=iField ); + x = tdsqlite3TableColumnToStorage(pTab, iField) + regNewData + 1; + tdsqlite3VdbeAddOp2(v, OP_SCopy, x, regIdx+i); VdbeComment((v, "%s", pTab->aCol[iField].zName)); } } - sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]); VdbeComment((v, "for %s", pIdx->zName)); #ifdef SQLITE_ENABLE_NULL_TRIM if( pIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){ - sqlite3SetMakeRecordP5(v, pIdx->pTable); + tdsqlite3SetMakeRecordP5(v, pIdx->pTable); } #endif - sqlite3VdbeReleaseRegisters(pParse, regIdx, pIdx->nColumn, 0, 0); + tdsqlite3VdbeReleaseRegisters(pParse, regIdx, pIdx->nColumn, 0, 0); /* In an UPDATE operation, if this index is the PRIMARY KEY index ** of a WITHOUT ROWID table and there has been no change the ** primary key, then no collision is possible. The collision detection ** logic below can all be skipped. */ if( isUpdate && pPk==pIdx && pkChng==0 ){ - sqlite3VdbeResolveLabel(v, addrUniqueOk); + tdsqlite3VdbeResolveLabel(v, addrUniqueOk); continue; } /* Find out what action to take in case there is a uniqueness conflict */ onError = pIdx->onError; if( onError==OE_None ){ - sqlite3VdbeResolveLabel(v, addrUniqueOk); + tdsqlite3VdbeResolveLabel(v, addrUniqueOk); continue; /* pIdx is not a UNIQUE index */ } if( overrideError!=OE_Default ){ @@ -125608,31 +125608,31 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( && pPk==pIdx /* Condition 2 */ && onError==OE_Replace /* Condition 1 */ && ( 0==(db->flags&SQLITE_RecTriggers) || /* Condition 4 */ - 0==sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0)) + 0==tdsqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0)) && ( 0==(db->flags&SQLITE_ForeignKeys) || /* Condition 5 */ - (0==pTab->pFKey && 0==sqlite3FkReferences(pTab))) + (0==pTab->pFKey && 0==tdsqlite3FkReferences(pTab))) ){ - sqlite3VdbeResolveLabel(v, addrUniqueOk); + tdsqlite3VdbeResolveLabel(v, addrUniqueOk); continue; } #endif /* ifndef SQLITE_ENABLE_PREUPDATE_HOOK */ /* Check to see if the new index entry will be unique */ - sqlite3VdbeVerifyAbortable(v, onError); + tdsqlite3VdbeVerifyAbortable(v, onError); addrConflictCk = - sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk, + tdsqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk, regIdx, pIdx->nKeyCol); VdbeCoverage(v); /* Generate code to handle collisions */ - regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField); + regR = (pIdx==pPk) ? regIdx : tdsqlite3GetTempRange(pParse, nPkField); if( isUpdate || onError==OE_Replace ){ if( HasRowid(pTab) ){ - sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR); + tdsqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR); /* Conflict only if the rowid of the existing index entry ** is different from old-rowid */ if( isUpdate ){ - sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData); - sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); + tdsqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData); + tdsqlite3VdbeChangeP5(v, SQLITE_NOTNULL); VdbeCoverage(v); } }else{ @@ -125642,8 +125642,8 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( if( pIdx!=pPk ){ for(i=0; inKeyCol; i++){ assert( pPk->aiColumn[i]>=0 ); - x = sqlite3TableColumnToIndex(pIdx, pPk->aiColumn[i]); - sqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i); + x = tdsqlite3TableColumnToIndex(pIdx, pPk->aiColumn[i]); + tdsqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i); VdbeComment((v, "%s.%s", pTab->zName, pTab->aCol[pPk->aiColumn[i]].zName)); } @@ -125656,23 +125656,23 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( ** For a UNIQUE index, only conflict if the PRIMARY KEY values ** of the matched index row are different from the original PRIMARY ** KEY values of this row before the update. */ - int addrJump = sqlite3VdbeCurrentAddr(v)+pPk->nKeyCol; + int addrJump = tdsqlite3VdbeCurrentAddr(v)+pPk->nKeyCol; int op = OP_Ne; int regCmp = (IsPrimaryKeyIndex(pIdx) ? regIdx : regR); for(i=0; inKeyCol; i++){ - char *p4 = (char*)sqlite3LocateCollSeq(pParse, pPk->azColl[i]); + char *p4 = (char*)tdsqlite3LocateCollSeq(pParse, pPk->azColl[i]); x = pPk->aiColumn[i]; assert( x>=0 ); if( i==(pPk->nKeyCol-1) ){ addrJump = addrUniqueOk; op = OP_Eq; } - x = sqlite3TableColumnToStorage(pTab, x); - sqlite3VdbeAddOp4(v, op, + x = tdsqlite3TableColumnToStorage(pTab, x); + tdsqlite3VdbeAddOp4(v, op, regOldData+1+x, addrJump, regCmp+i, p4, P4_COLLSEQ ); - sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); + tdsqlite3VdbeChangeP5(v, SQLITE_NOTNULL); VdbeCoverageIf(v, op==OP_Eq); VdbeCoverageIf(v, op==OP_Ne); } @@ -125690,56 +125690,56 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( testcase( onError==OE_Rollback ); testcase( onError==OE_Abort ); testcase( onError==OE_Fail ); - sqlite3UniqueConstraint(pParse, onError, pIdx); + tdsqlite3UniqueConstraint(pParse, onError, pIdx); break; } #ifndef SQLITE_OMIT_UPSERT case OE_Update: { - sqlite3UpsertDoUpdate(pParse, pUpsert, pTab, pIdx, iIdxCur+ix); + tdsqlite3UpsertDoUpdate(pParse, pUpsert, pTab, pIdx, iIdxCur+ix); /* Fall through */ } #endif case OE_Ignore: { testcase( onError==OE_Ignore ); - sqlite3VdbeGoto(v, ignoreDest); + tdsqlite3VdbeGoto(v, ignoreDest); break; } default: { int nConflictCk; /* Number of opcodes in conflict check logic */ assert( onError==OE_Replace ); - nConflictCk = sqlite3VdbeCurrentAddr(v) - addrConflictCk; + nConflictCk = tdsqlite3VdbeCurrentAddr(v) - addrConflictCk; assert( nConflictCk>0 ); testcase( nConflictCk>1 ); if( regTrigCnt ){ - sqlite3MultiWrite(pParse); + tdsqlite3MultiWrite(pParse); nReplaceTrig++; } if( pTrigger && isUpdate ){ - sqlite3VdbeAddOp1(v, OP_CursorLock, iDataCur); + tdsqlite3VdbeAddOp1(v, OP_CursorLock, iDataCur); } - sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, + tdsqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, regR, nPkField, 0, OE_Replace, (pIdx==pPk ? ONEPASS_SINGLE : ONEPASS_OFF), iThisCur); if( pTrigger && isUpdate ){ - sqlite3VdbeAddOp1(v, OP_CursorUnlock, iDataCur); + tdsqlite3VdbeAddOp1(v, OP_CursorUnlock, iDataCur); } if( regTrigCnt ){ int addrBypass; /* Jump destination to bypass recheck logic */ - sqlite3VdbeAddOp2(v, OP_AddImm, regTrigCnt, 1); /* incr trigger cnt */ - addrBypass = sqlite3VdbeAddOp0(v, OP_Goto); /* Bypass recheck */ + tdsqlite3VdbeAddOp2(v, OP_AddImm, regTrigCnt, 1); /* incr trigger cnt */ + addrBypass = tdsqlite3VdbeAddOp0(v, OP_Goto); /* Bypass recheck */ VdbeComment((v, "bypass recheck")); /* Here we insert code that will be invoked after all constraint ** checks have run, if and only if one or more replace triggers ** fired. */ - sqlite3VdbeResolveLabel(v, lblRecheckOk); - lblRecheckOk = sqlite3VdbeMakeLabel(pParse); + tdsqlite3VdbeResolveLabel(v, lblRecheckOk); + lblRecheckOk = tdsqlite3VdbeMakeLabel(pParse); if( pIdx->pPartIdxWhere ){ /* Bypass the recheck if this partial index is not defined ** for the current row */ - sqlite3VdbeAddOp2(v, OP_IsNull, regIdx-1, lblRecheckOk); + tdsqlite3VdbeAddOp2(v, OP_IsNull, regIdx-1, lblRecheckOk); VdbeCoverage(v); } /* Copy the constraint check code from above, except change @@ -125747,76 +125747,76 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( ** the next retest block */ while( nConflictCk>0 ){ VdbeOp x; /* Conflict check opcode to copy */ - /* The sqlite3VdbeAddOp4() call might reallocate the opcode array. + /* The tdsqlite3VdbeAddOp4() call might reallocate the opcode array. ** Hence, make a complete copy of the opcode, rather than using ** a pointer to the opcode. */ - x = *sqlite3VdbeGetOp(v, addrConflictCk); + x = *tdsqlite3VdbeGetOp(v, addrConflictCk); if( x.opcode!=OP_IdxRowid ){ int p2; /* New P2 value for copied conflict check opcode */ - if( sqlite3OpcodeProperty[x.opcode]&OPFLG_JUMP ){ + if( tdsqlite3OpcodeProperty[x.opcode]&OPFLG_JUMP ){ p2 = lblRecheckOk; }else{ p2 = x.p2; } - sqlite3VdbeAddOp4(v, x.opcode, x.p1, p2, x.p3, x.p4.z, x.p4type); - sqlite3VdbeChangeP5(v, x.p5); + tdsqlite3VdbeAddOp4(v, x.opcode, x.p1, p2, x.p3, x.p4.z, x.p4type); + tdsqlite3VdbeChangeP5(v, x.p5); VdbeCoverageIf(v, p2!=x.p2); } nConflictCk--; addrConflictCk++; } /* If the retest fails, issue an abort */ - sqlite3UniqueConstraint(pParse, OE_Abort, pIdx); + tdsqlite3UniqueConstraint(pParse, OE_Abort, pIdx); - sqlite3VdbeJumpHere(v, addrBypass); /* Terminate the recheck bypass */ + tdsqlite3VdbeJumpHere(v, addrBypass); /* Terminate the recheck bypass */ } seenReplace = 1; break; } } if( pUpIdx==pIdx ){ - sqlite3VdbeGoto(v, upsertJump+1); - sqlite3VdbeJumpHere(v, upsertBypass); + tdsqlite3VdbeGoto(v, upsertJump+1); + tdsqlite3VdbeJumpHere(v, upsertBypass); }else{ - sqlite3VdbeResolveLabel(v, addrUniqueOk); + tdsqlite3VdbeResolveLabel(v, addrUniqueOk); } - if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField); + if( regR!=regIdx ) tdsqlite3ReleaseTempRange(pParse, regR, nPkField); } /* If the IPK constraint is a REPLACE, run it last */ if( ipkTop ){ - sqlite3VdbeGoto(v, ipkTop); + tdsqlite3VdbeGoto(v, ipkTop); VdbeComment((v, "Do IPK REPLACE")); - sqlite3VdbeJumpHere(v, ipkBottom); + tdsqlite3VdbeJumpHere(v, ipkBottom); } /* Recheck all uniqueness constraints after replace triggers have run */ testcase( regTrigCnt!=0 && nReplaceTrig==0 ); assert( regTrigCnt!=0 || nReplaceTrig==0 ); if( nReplaceTrig ){ - sqlite3VdbeAddOp2(v, OP_IfNot, regTrigCnt, lblRecheckOk);VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_IfNot, regTrigCnt, lblRecheckOk);VdbeCoverage(v); if( !pPk ){ if( isUpdate ){ - sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRecheck, regOldData); - sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); + tdsqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRecheck, regOldData); + tdsqlite3VdbeChangeP5(v, SQLITE_NOTNULL); VdbeCoverage(v); } - sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRecheck, regNewData); + tdsqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRecheck, regNewData); VdbeCoverage(v); - sqlite3RowidConstraint(pParse, OE_Abort, pTab); + tdsqlite3RowidConstraint(pParse, OE_Abort, pTab); }else{ - sqlite3VdbeGoto(v, addrRecheck); + tdsqlite3VdbeGoto(v, addrRecheck); } - sqlite3VdbeResolveLabel(v, lblRecheckOk); + tdsqlite3VdbeResolveLabel(v, lblRecheckOk); } /* Generate the table record */ if( HasRowid(pTab) ){ int regRec = aRegIdx[ix]; - sqlite3VdbeAddOp3(v, OP_MakeRecord, regNewData+1, pTab->nNVCol, regRec); - sqlite3SetMakeRecordP5(v, pTab); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, regNewData+1, pTab->nNVCol, regRec); + tdsqlite3SetMakeRecordP5(v, pTab); if( !bAffinityDone ){ - sqlite3TableAffinity(v, pTab, 0); + tdsqlite3TableAffinity(v, pTab, 0); } } @@ -125831,7 +125831,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( ** ** Or if no columns of pTab may be NULL-trimmed, leave P5 at zero. */ -SQLITE_PRIVATE void sqlite3SetMakeRecordP5(Vdbe *v, Table *pTab){ +SQLITE_PRIVATE void tdsqlite3SetMakeRecordP5(Vdbe *v, Table *pTab){ u16 i; /* Records with omitted columns are only allowed for schema format @@ -125842,20 +125842,20 @@ SQLITE_PRIVATE void sqlite3SetMakeRecordP5(Vdbe *v, Table *pTab){ if( pTab->aCol[i].pDflt!=0 ) break; if( pTab->aCol[i].colFlags & COLFLAG_PRIMKEY ) break; } - sqlite3VdbeChangeP5(v, i+1); + tdsqlite3VdbeChangeP5(v, i+1); } #endif /* ** This routine generates code to finish the INSERT or UPDATE operation -** that was started by a prior call to sqlite3GenerateConstraintChecks. +** that was started by a prior call to tdsqlite3GenerateConstraintChecks. ** A consecutive range of registers starting at regNewData contains the ** rowid and the content to be inserted. ** ** The arguments to this routine should be the same as the first six -** arguments to sqlite3GenerateConstraintChecks. +** arguments to tdsqlite3GenerateConstraintChecks. */ -SQLITE_PRIVATE void sqlite3CompleteInsertion( +SQLITE_PRIVATE void tdsqlite3CompleteInsertion( Parse *pParse, /* The parser context */ Table *pTab, /* the table into which we are inserting */ int iDataCur, /* Cursor of the canonical data source */ @@ -125876,7 +125876,7 @@ SQLITE_PRIVATE void sqlite3CompleteInsertion( || update_flags==(OPFLAG_ISUPDATE|OPFLAG_SAVEPOSITION) ); - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); assert( v!=0 ); assert( pTab->pSelect==0 ); /* This table is not a VIEW */ for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ @@ -125886,7 +125886,7 @@ SQLITE_PRIVATE void sqlite3CompleteInsertion( || pIdx->pNext->onError==OE_Replace ); if( aRegIdx[i]==0 ) continue; if( pIdx->pPartIdxWhere ){ - sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2); + tdsqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], tdsqlite3VdbeCurrentAddr(v)+2); VdbeCoverage(v); } pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0); @@ -125896,20 +125896,20 @@ SQLITE_PRIVATE void sqlite3CompleteInsertion( pik_flags |= (update_flags & OPFLAG_SAVEPOSITION); #ifdef SQLITE_ENABLE_PREUPDATE_HOOK if( update_flags==0 ){ - int r = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp2(v, OP_Integer, 0, r); - sqlite3VdbeAddOp4(v, OP_Insert, + int r = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, r); + tdsqlite3VdbeAddOp4(v, OP_Insert, iIdxCur+i, aRegIdx[i], r, (char*)pTab, P4_TABLE ); - sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP); - sqlite3ReleaseTempReg(pParse, r); + tdsqlite3VdbeChangeP5(v, OPFLAG_ISNOOP); + tdsqlite3ReleaseTempReg(pParse, r); } #endif } - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i], + tdsqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i], aRegIdx[i]+1, pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn); - sqlite3VdbeChangeP5(v, pik_flags); + tdsqlite3VdbeChangeP5(v, pik_flags); } if( !HasRowid(pTab) ) return; if( pParse->nested ){ @@ -125924,11 +125924,11 @@ SQLITE_PRIVATE void sqlite3CompleteInsertion( if( useSeekResult ){ pik_flags |= OPFLAG_USESEEKRESULT; } - sqlite3VdbeAddOp3(v, OP_Insert, iDataCur, aRegIdx[i], regNewData); + tdsqlite3VdbeAddOp3(v, OP_Insert, iDataCur, aRegIdx[i], regNewData); if( !pParse->nested ){ - sqlite3VdbeAppendP4(v, pTab, P4_TABLE); + tdsqlite3VdbeAppendP4(v, pTab, P4_TABLE); } - sqlite3VdbeChangeP5(v, pik_flags); + tdsqlite3VdbeChangeP5(v, pik_flags); } /* @@ -125952,7 +125952,7 @@ SQLITE_PRIVATE void sqlite3CompleteInsertion( ** If pTab is a virtual table, then this routine is a no-op and the ** *piDataCur and *piIdxCur values are left uninitialized. */ -SQLITE_PRIVATE int sqlite3OpenTableAndIndices( +SQLITE_PRIVATE int tdsqlite3OpenTableAndIndices( Parse *pParse, /* Parsing context */ Table *pTab, /* Table to be opened */ int op, /* OP_OpenRead or OP_OpenWrite */ @@ -125976,16 +125976,16 @@ SQLITE_PRIVATE int sqlite3OpenTableAndIndices( ** can detect if they are used by mistake in the caller. */ return 0; } - iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - v = sqlite3GetVdbe(pParse); + iDb = tdsqlite3SchemaToIndex(pParse->db, pTab->pSchema); + v = tdsqlite3GetVdbe(pParse); assert( v!=0 ); if( iBase<0 ) iBase = pParse->nTab; iDataCur = iBase++; if( piDataCur ) *piDataCur = iDataCur; if( HasRowid(pTab) && (aToOpen==0 || aToOpen[0]) ){ - sqlite3OpenTable(pParse, iDataCur, iDb, pTab, op); + tdsqlite3OpenTable(pParse, iDataCur, iDb, pTab, op); }else{ - sqlite3TableLock(pParse, iDb, pTab->tnum, op==OP_OpenWrite, pTab->zName); + tdsqlite3TableLock(pParse, iDb, pTab->tnum, op==OP_OpenWrite, pTab->zName); } if( piIdxCur ) *piIdxCur = iBase; for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ @@ -125996,9 +125996,9 @@ SQLITE_PRIVATE int sqlite3OpenTableAndIndices( p5 = 0; } if( aToOpen==0 || aToOpen[i+1] ){ - sqlite3VdbeAddOp3(v, op, iIdxCur, pIdx->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); - sqlite3VdbeChangeP5(v, p5); + tdsqlite3VdbeAddOp3(v, op, iIdxCur, pIdx->tnum, iDb); + tdsqlite3VdbeSetP4KeyInfo(pParse, pIdx); + tdsqlite3VdbeChangeP5(v, p5); VdbeComment((v, "%s", pIdx->zName)); } } @@ -126014,7 +126014,7 @@ SQLITE_PRIVATE int sqlite3OpenTableAndIndices( ** purposes only - to make sure the transfer optimization really ** is happening when it is supposed to. */ -SQLITE_API int sqlite3_xferopt_count; +SQLITE_API int tdsqlite3_xferopt_count; #endif /* SQLITE_TEST */ @@ -126046,7 +126046,7 @@ static int xferCompatibleIndex(Index *pDest, Index *pSrc){ } if( pSrc->aiColumn[i]==XN_EXPR ){ assert( pSrc->aColExpr!=0 && pDest->aColExpr!=0 ); - if( sqlite3ExprCompare(0, pSrc->aColExpr->a[i].pExpr, + if( tdsqlite3ExprCompare(0, pSrc->aColExpr->a[i].pExpr, pDest->aColExpr->a[i].pExpr, -1)!=0 ){ return 0; /* Different expressions in the index */ } @@ -126054,11 +126054,11 @@ static int xferCompatibleIndex(Index *pDest, Index *pSrc){ if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){ return 0; /* Different sort orders */ } - if( sqlite3_stricmp(pSrc->azColl[i],pDest->azColl[i])!=0 ){ + if( tdsqlite3_stricmp(pSrc->azColl[i],pDest->azColl[i])!=0 ){ return 0; /* Different collating sequences */ } } - if( sqlite3ExprCompare(0, pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){ + if( tdsqlite3ExprCompare(0, pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){ return 0; /* Different WHERE clauses */ } @@ -126098,7 +126098,7 @@ static int xferOptimization( int onError, /* How to handle constraint errors */ int iDbDest /* The database of pDest */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; ExprList *pEList; /* The result set of the SELECT */ Table *pSrc; /* The table in the FROM clause of SELECT */ Index *pSrcIdx, *pDestIdx; /* Source and destination indices */ @@ -126123,7 +126123,7 @@ static int xferOptimization( ** error if pSelect reads from a CTE named "xxx". */ return 0; } - if( sqlite3TriggerList(pParse, pDest) ){ + if( tdsqlite3TriggerList(pParse, pDest) ){ return 0; /* tab1 must not have triggers */ } #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -126177,7 +126177,7 @@ static int xferOptimization( ** we have to check the semantics. */ pItem = pSelect->pSrc->a; - pSrc = sqlite3LocateTableItem(pParse, 0, pItem); + pSrc = tdsqlite3LocateTableItem(pParse, 0, pItem); if( pSrc==0 ){ return 0; /* FROM clause does not contain a real table */ } @@ -126238,7 +126238,7 @@ static int xferOptimization( ** This requirement could be relaxed for VIRTUAL columns, I suppose. */ if( (pDestCol->colFlags & COLFLAG_GENERATED)!=0 ){ - if( sqlite3ExprCompare(0, pSrcCol->pDflt, pDestCol->pDflt, -1)!=0 ){ + if( tdsqlite3ExprCompare(0, pSrcCol->pDflt, pDestCol->pDflt, -1)!=0 ){ testcase( pDestCol->colFlags & COLFLAG_VIRTUAL ); testcase( pDestCol->colFlags & COLFLAG_STORED ); return 0; /* Different generator expressions */ @@ -126248,7 +126248,7 @@ static int xferOptimization( if( pDestCol->affinity!=pSrcCol->affinity ){ return 0; /* Affinity must be the same on all columns */ } - if( sqlite3_stricmp(pDestCol->zColl, pSrcCol->zColl)!=0 ){ + if( tdsqlite3_stricmp(pDestCol->zColl, pSrcCol->zColl)!=0 ){ return 0; /* Collating sequence must be the same on all columns */ } if( pDestCol->notNull && !pSrcCol->notNull ){ @@ -126277,15 +126277,15 @@ static int xferOptimization( return 0; /* pDestIdx has no corresponding index in pSrc */ } if( pSrcIdx->tnum==pDestIdx->tnum && pSrc->pSchema==pDest->pSchema - && sqlite3FaultSim(411)==SQLITE_OK ){ - /* The sqlite3FaultSim() call allows this corruption test to be + && tdsqlite3FaultSim(411)==SQLITE_OK ){ + /* The tdsqlite3FaultSim() call allows this corruption test to be ** bypassed during testing, in order to exercise other corruption tests ** further downstream. */ return 0; /* Corrupt schema - two indexes on the same btree */ } } #ifndef SQLITE_OMIT_CHECK - if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){ + if( pDest->pCheck && tdsqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){ return 0; /* Tables have different CHECK constraints. Ticket #2252 */ } #endif @@ -126310,17 +126310,17 @@ static int xferOptimization( ** table (tab1) is initially empty. */ #ifdef SQLITE_TEST - sqlite3_xferopt_count++; + tdsqlite3_xferopt_count++; #endif - iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema); - v = sqlite3GetVdbe(pParse); - sqlite3CodeVerifySchema(pParse, iDbSrc); + iDbSrc = tdsqlite3SchemaToIndex(db, pSrc->pSchema); + v = tdsqlite3GetVdbe(pParse); + tdsqlite3CodeVerifySchema(pParse, iDbSrc); iSrc = pParse->nTab++; iDest = pParse->nTab++; regAutoinc = autoIncBegin(pParse, iDbDest, pDest); - regData = sqlite3GetTempReg(pParse); - regRowid = sqlite3GetTempReg(pParse); - sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite); + regData = tdsqlite3GetTempReg(pParse); + regRowid = tdsqlite3GetTempReg(pParse); + tdsqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite); assert( HasRowid(pDest) || destHasUniqueIdx ); if( (db->mDbFlags & DBFLAG_Vacuum)==0 && ( (pDest->iPKey<0 && pDest->pIndex!=0) /* (1) */ @@ -126344,45 +126344,45 @@ static int xferOptimization( ** ** (3) onError is something other than OE_Abort and OE_Rollback. */ - addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iDest, 0); VdbeCoverage(v); - emptyDestTest = sqlite3VdbeAddOp0(v, OP_Goto); - sqlite3VdbeJumpHere(v, addr1); + addr1 = tdsqlite3VdbeAddOp2(v, OP_Rewind, iDest, 0); VdbeCoverage(v); + emptyDestTest = tdsqlite3VdbeAddOp0(v, OP_Goto); + tdsqlite3VdbeJumpHere(v, addr1); } if( HasRowid(pSrc) ){ u8 insFlags; - sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead); - emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v); + tdsqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead); + emptySrcTest = tdsqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v); if( pDest->iPKey>=0 ){ - addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid); - sqlite3VdbeVerifyAbortable(v, onError); - addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid); + addr1 = tdsqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid); + tdsqlite3VdbeVerifyAbortable(v, onError); + addr2 = tdsqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid); VdbeCoverage(v); - sqlite3RowidConstraint(pParse, onError, pDest); - sqlite3VdbeJumpHere(v, addr2); + tdsqlite3RowidConstraint(pParse, onError, pDest); + tdsqlite3VdbeJumpHere(v, addr2); autoIncStep(pParse, regAutoinc, regRowid); }else if( pDest->pIndex==0 && !(db->mDbFlags & DBFLAG_VacuumInto) ){ - addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid); + addr1 = tdsqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid); }else{ - addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid); + addr1 = tdsqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid); assert( (pDest->tabFlags & TF_Autoincrement)==0 ); } - sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1); + tdsqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1); if( db->mDbFlags & DBFLAG_Vacuum ){ - sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest); + tdsqlite3VdbeAddOp1(v, OP_SeekEnd, iDest); insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID| OPFLAG_APPEND|OPFLAG_USESEEKRESULT; }else{ insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND; } - sqlite3VdbeAddOp4(v, OP_Insert, iDest, regData, regRowid, + tdsqlite3VdbeAddOp4(v, OP_Insert, iDest, regData, regRowid, (char*)pDest, P4_TABLE); - sqlite3VdbeChangeP5(v, insFlags); - sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v); - sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0); - sqlite3VdbeAddOp2(v, OP_Close, iDest, 0); + tdsqlite3VdbeChangeP5(v, insFlags); + tdsqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_Close, iSrc, 0); + tdsqlite3VdbeAddOp2(v, OP_Close, iDest, 0); }else{ - sqlite3TableLock(pParse, iDbDest, pDest->tnum, 1, pDest->zName); - sqlite3TableLock(pParse, iDbSrc, pSrc->tnum, 0, pSrc->zName); + tdsqlite3TableLock(pParse, iDbDest, pDest->tnum, 1, pDest->zName); + tdsqlite3TableLock(pParse, iDbSrc, pSrc->tnum, 0, pSrc->zName); } for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){ u8 idxInsFlags = 0; @@ -126390,15 +126390,15 @@ static int xferOptimization( if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break; } assert( pSrcIdx ); - sqlite3VdbeAddOp3(v, OP_OpenRead, iSrc, pSrcIdx->tnum, iDbSrc); - sqlite3VdbeSetP4KeyInfo(pParse, pSrcIdx); + tdsqlite3VdbeAddOp3(v, OP_OpenRead, iSrc, pSrcIdx->tnum, iDbSrc); + tdsqlite3VdbeSetP4KeyInfo(pParse, pSrcIdx); VdbeComment((v, "%s", pSrcIdx->zName)); - sqlite3VdbeAddOp3(v, OP_OpenWrite, iDest, pDestIdx->tnum, iDbDest); - sqlite3VdbeSetP4KeyInfo(pParse, pDestIdx); - sqlite3VdbeChangeP5(v, OPFLAG_BULKCSR); + tdsqlite3VdbeAddOp3(v, OP_OpenWrite, iDest, pDestIdx->tnum, iDbDest); + tdsqlite3VdbeSetP4KeyInfo(pParse, pDestIdx); + tdsqlite3VdbeChangeP5(v, OPFLAG_BULKCSR); VdbeComment((v, "%s", pDestIdx->zName)); - addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1); + addr1 = tdsqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v); + tdsqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1); if( db->mDbFlags & DBFLAG_Vacuum ){ /* This INSERT command is part of a VACUUM operation, which guarantees ** that the destination table is empty. If all indexed columns use @@ -126416,31 +126416,31 @@ static int xferOptimization( ** sorted order. */ for(i=0; inColumn; i++){ const char *zColl = pSrcIdx->azColl[i]; - if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break; + if( tdsqlite3_stricmp(tdsqlite3StrBINARY, zColl) ) break; } if( i==pSrcIdx->nColumn ){ idxInsFlags = OPFLAG_USESEEKRESULT; - sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest); + tdsqlite3VdbeAddOp1(v, OP_SeekEnd, iDest); } } if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){ idxInsFlags |= OPFLAG_NCHANGE; } - sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData); - sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND); - sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v); - sqlite3VdbeJumpHere(v, addr1); - sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0); - sqlite3VdbeAddOp2(v, OP_Close, iDest, 0); + tdsqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData); + tdsqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND); + tdsqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v); + tdsqlite3VdbeJumpHere(v, addr1); + tdsqlite3VdbeAddOp2(v, OP_Close, iSrc, 0); + tdsqlite3VdbeAddOp2(v, OP_Close, iDest, 0); } - if( emptySrcTest ) sqlite3VdbeJumpHere(v, emptySrcTest); - sqlite3ReleaseTempReg(pParse, regRowid); - sqlite3ReleaseTempReg(pParse, regData); + if( emptySrcTest ) tdsqlite3VdbeJumpHere(v, emptySrcTest); + tdsqlite3ReleaseTempReg(pParse, regRowid); + tdsqlite3ReleaseTempReg(pParse, regData); if( emptyDestTest ){ - sqlite3AutoincrementEnd(pParse); - sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_OK, 0); - sqlite3VdbeJumpHere(v, emptyDestTest); - sqlite3VdbeAddOp2(v, OP_Close, iDest, 0); + tdsqlite3AutoincrementEnd(pParse); + tdsqlite3VdbeAddOp2(v, OP_Halt, SQLITE_OK, 0); + tdsqlite3VdbeJumpHere(v, emptyDestTest); + tdsqlite3VdbeAddOp2(v, OP_Close, iDest, 0); return 0; }else{ return 1; @@ -126479,30 +126479,30 @@ static int xferOptimization( ** argument to xCallback(). If xCallback=NULL then no callback ** is invoked, even for queries. */ -SQLITE_API int sqlite3_exec( - sqlite3 *db, /* The database on which the SQL executes */ +SQLITE_API int tdsqlite3_exec( + tdsqlite3 *db, /* The database on which the SQL executes */ const char *zSql, /* The SQL to be executed */ - sqlite3_callback xCallback, /* Invoke this callback routine */ + tdsqlite3_callback xCallback, /* Invoke this callback routine */ void *pArg, /* First argument to xCallback() */ char **pzErrMsg /* Write error messages here */ ){ int rc = SQLITE_OK; /* Return code */ const char *zLeftover; /* Tail of unprocessed SQL */ - sqlite3_stmt *pStmt = 0; /* The current SQL statement */ + tdsqlite3_stmt *pStmt = 0; /* The current SQL statement */ char **azCols = 0; /* Names of result columns */ int callbackIsInit; /* True if callback data is initialized */ - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; if( zSql==0 ) zSql = ""; - sqlite3_mutex_enter(db->mutex); - sqlite3Error(db, SQLITE_OK); + tdsqlite3_mutex_enter(db->mutex); + tdsqlite3Error(db, SQLITE_OK); while( rc==SQLITE_OK && zSql[0] ){ int nCol = 0; char **azVals = 0; pStmt = 0; - rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover); + rc = tdsqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover); assert( rc==SQLITE_OK || pStmt==0 ); if( rc!=SQLITE_OK ){ continue; @@ -126516,22 +126516,22 @@ SQLITE_API int sqlite3_exec( while( 1 ){ int i; - rc = sqlite3_step(pStmt); + rc = tdsqlite3_step(pStmt); /* Invoke the callback function if required */ if( xCallback && (SQLITE_ROW==rc || (SQLITE_DONE==rc && !callbackIsInit && db->flags&SQLITE_NullCallback)) ){ if( !callbackIsInit ){ - nCol = sqlite3_column_count(pStmt); - azCols = sqlite3DbMallocRaw(db, (2*nCol+1)*sizeof(const char*)); + nCol = tdsqlite3_column_count(pStmt); + azCols = tdsqlite3DbMallocRaw(db, (2*nCol+1)*sizeof(const char*)); if( azCols==0 ){ goto exec_out; } for(i=0; ierrMask)==rc ); - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return rc; } @@ -126610,10 +126610,10 @@ exec_out: */ #ifndef SQLITE_CORE - #define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */ + #define SQLITE_CORE 1 /* Disable the API redefinition in tdsqlite3ext.h */ #endif -/************** Include sqlite3ext.h in the middle of loadext.c **************/ -/************** Begin file sqlite3ext.h **************************************/ +/************** Include tdsqlite3ext.h in the middle of loadext.c **************/ +/************** Begin file tdsqlite3ext.h **************************************/ /* ** 2006 June 7 ** @@ -126645,303 +126645,303 @@ exec_out: ** versions of SQLite will not be able to load each other's shared ** libraries! */ -struct sqlite3_api_routines { - void * (*aggregate_context)(sqlite3_context*,int nBytes); - int (*aggregate_count)(sqlite3_context*); - int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*)); - int (*bind_double)(sqlite3_stmt*,int,double); - int (*bind_int)(sqlite3_stmt*,int,int); - int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64); - int (*bind_null)(sqlite3_stmt*,int); - int (*bind_parameter_count)(sqlite3_stmt*); - int (*bind_parameter_index)(sqlite3_stmt*,const char*zName); - const char * (*bind_parameter_name)(sqlite3_stmt*,int); - int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*)); - int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*)); - int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*); - int (*busy_handler)(sqlite3*,int(*)(void*,int),void*); - int (*busy_timeout)(sqlite3*,int ms); - int (*changes)(sqlite3*); - int (*close)(sqlite3*); - int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*, +struct tdsqlite3_api_routines { + void * (*aggregate_context)(tdsqlite3_context*,int nBytes); + int (*aggregate_count)(tdsqlite3_context*); + int (*bind_blob)(tdsqlite3_stmt*,int,const void*,int n,void(*)(void*)); + int (*bind_double)(tdsqlite3_stmt*,int,double); + int (*bind_int)(tdsqlite3_stmt*,int,int); + int (*bind_int64)(tdsqlite3_stmt*,int,sqlite_int64); + int (*bind_null)(tdsqlite3_stmt*,int); + int (*bind_parameter_count)(tdsqlite3_stmt*); + int (*bind_parameter_index)(tdsqlite3_stmt*,const char*zName); + const char * (*bind_parameter_name)(tdsqlite3_stmt*,int); + int (*bind_text)(tdsqlite3_stmt*,int,const char*,int n,void(*)(void*)); + int (*bind_text16)(tdsqlite3_stmt*,int,const void*,int,void(*)(void*)); + int (*bind_value)(tdsqlite3_stmt*,int,const tdsqlite3_value*); + int (*busy_handler)(tdsqlite3*,int(*)(void*,int),void*); + int (*busy_timeout)(tdsqlite3*,int ms); + int (*changes)(tdsqlite3*); + int (*close)(tdsqlite3*); + int (*collation_needed)(tdsqlite3*,void*,void(*)(void*,tdsqlite3*, int eTextRep,const char*)); - int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*, + int (*collation_needed16)(tdsqlite3*,void*,void(*)(void*,tdsqlite3*, int eTextRep,const void*)); - const void * (*column_blob)(sqlite3_stmt*,int iCol); - int (*column_bytes)(sqlite3_stmt*,int iCol); - int (*column_bytes16)(sqlite3_stmt*,int iCol); - int (*column_count)(sqlite3_stmt*pStmt); - const char * (*column_database_name)(sqlite3_stmt*,int); - const void * (*column_database_name16)(sqlite3_stmt*,int); - const char * (*column_decltype)(sqlite3_stmt*,int i); - const void * (*column_decltype16)(sqlite3_stmt*,int); - double (*column_double)(sqlite3_stmt*,int iCol); - int (*column_int)(sqlite3_stmt*,int iCol); - sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol); - const char * (*column_name)(sqlite3_stmt*,int); - const void * (*column_name16)(sqlite3_stmt*,int); - const char * (*column_origin_name)(sqlite3_stmt*,int); - const void * (*column_origin_name16)(sqlite3_stmt*,int); - const char * (*column_table_name)(sqlite3_stmt*,int); - const void * (*column_table_name16)(sqlite3_stmt*,int); - const unsigned char * (*column_text)(sqlite3_stmt*,int iCol); - const void * (*column_text16)(sqlite3_stmt*,int iCol); - int (*column_type)(sqlite3_stmt*,int iCol); - sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol); - void * (*commit_hook)(sqlite3*,int(*)(void*),void*); + const void * (*column_blob)(tdsqlite3_stmt*,int iCol); + int (*column_bytes)(tdsqlite3_stmt*,int iCol); + int (*column_bytes16)(tdsqlite3_stmt*,int iCol); + int (*column_count)(tdsqlite3_stmt*pStmt); + const char * (*column_database_name)(tdsqlite3_stmt*,int); + const void * (*column_database_name16)(tdsqlite3_stmt*,int); + const char * (*column_decltype)(tdsqlite3_stmt*,int i); + const void * (*column_decltype16)(tdsqlite3_stmt*,int); + double (*column_double)(tdsqlite3_stmt*,int iCol); + int (*column_int)(tdsqlite3_stmt*,int iCol); + sqlite_int64 (*column_int64)(tdsqlite3_stmt*,int iCol); + const char * (*column_name)(tdsqlite3_stmt*,int); + const void * (*column_name16)(tdsqlite3_stmt*,int); + const char * (*column_origin_name)(tdsqlite3_stmt*,int); + const void * (*column_origin_name16)(tdsqlite3_stmt*,int); + const char * (*column_table_name)(tdsqlite3_stmt*,int); + const void * (*column_table_name16)(tdsqlite3_stmt*,int); + const unsigned char * (*column_text)(tdsqlite3_stmt*,int iCol); + const void * (*column_text16)(tdsqlite3_stmt*,int iCol); + int (*column_type)(tdsqlite3_stmt*,int iCol); + tdsqlite3_value* (*column_value)(tdsqlite3_stmt*,int iCol); + void * (*commit_hook)(tdsqlite3*,int(*)(void*),void*); int (*complete)(const char*sql); int (*complete16)(const void*sql); - int (*create_collation)(sqlite3*,const char*,int,void*, + int (*create_collation)(tdsqlite3*,const char*,int,void*, int(*)(void*,int,const void*,int,const void*)); - int (*create_collation16)(sqlite3*,const void*,int,void*, + int (*create_collation16)(tdsqlite3*,const void*,int,void*, int(*)(void*,int,const void*,int,const void*)); - int (*create_function)(sqlite3*,const char*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*)); - int (*create_function16)(sqlite3*,const void*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*)); - int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*); - int (*data_count)(sqlite3_stmt*pStmt); - sqlite3 * (*db_handle)(sqlite3_stmt*); - int (*declare_vtab)(sqlite3*,const char*); + int (*create_function)(tdsqlite3*,const char*,int,int,void*, + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*)); + int (*create_function16)(tdsqlite3*,const void*,int,int,void*, + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*)); + int (*create_module)(tdsqlite3*,const char*,const tdsqlite3_module*,void*); + int (*data_count)(tdsqlite3_stmt*pStmt); + tdsqlite3 * (*db_handle)(tdsqlite3_stmt*); + int (*declare_vtab)(tdsqlite3*,const char*); int (*enable_shared_cache)(int); - int (*errcode)(sqlite3*db); - const char * (*errmsg)(sqlite3*); - const void * (*errmsg16)(sqlite3*); - int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**); - int (*expired)(sqlite3_stmt*); - int (*finalize)(sqlite3_stmt*pStmt); + int (*errcode)(tdsqlite3*db); + const char * (*errmsg)(tdsqlite3*); + const void * (*errmsg16)(tdsqlite3*); + int (*exec)(tdsqlite3*,const char*,tdsqlite3_callback,void*,char**); + int (*expired)(tdsqlite3_stmt*); + int (*finalize)(tdsqlite3_stmt*pStmt); void (*free)(void*); void (*free_table)(char**result); - int (*get_autocommit)(sqlite3*); - void * (*get_auxdata)(sqlite3_context*,int); - int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**); + int (*get_autocommit)(tdsqlite3*); + void * (*get_auxdata)(tdsqlite3_context*,int); + int (*get_table)(tdsqlite3*,const char*,char***,int*,int*,char**); int (*global_recover)(void); - void (*interruptx)(sqlite3*); - sqlite_int64 (*last_insert_rowid)(sqlite3*); + void (*interruptx)(tdsqlite3*); + sqlite_int64 (*last_insert_rowid)(tdsqlite3*); const char * (*libversion)(void); int (*libversion_number)(void); void *(*malloc)(int); char * (*mprintf)(const char*,...); - int (*open)(const char*,sqlite3**); - int (*open16)(const void*,sqlite3**); - int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); - int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); - void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*); - void (*progress_handler)(sqlite3*,int,int(*)(void*),void*); + int (*open)(const char*,tdsqlite3**); + int (*open16)(const void*,tdsqlite3**); + int (*prepare)(tdsqlite3*,const char*,int,tdsqlite3_stmt**,const char**); + int (*prepare16)(tdsqlite3*,const void*,int,tdsqlite3_stmt**,const void**); + void * (*profile)(tdsqlite3*,void(*)(void*,const char*,sqlite_uint64),void*); + void (*progress_handler)(tdsqlite3*,int,int(*)(void*),void*); void *(*realloc)(void*,int); - int (*reset)(sqlite3_stmt*pStmt); - void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_double)(sqlite3_context*,double); - void (*result_error)(sqlite3_context*,const char*,int); - void (*result_error16)(sqlite3_context*,const void*,int); - void (*result_int)(sqlite3_context*,int); - void (*result_int64)(sqlite3_context*,sqlite_int64); - void (*result_null)(sqlite3_context*); - void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*)); - void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_value)(sqlite3_context*,sqlite3_value*); - void * (*rollback_hook)(sqlite3*,void(*)(void*),void*); - int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*, + int (*reset)(tdsqlite3_stmt*pStmt); + void (*result_blob)(tdsqlite3_context*,const void*,int,void(*)(void*)); + void (*result_double)(tdsqlite3_context*,double); + void (*result_error)(tdsqlite3_context*,const char*,int); + void (*result_error16)(tdsqlite3_context*,const void*,int); + void (*result_int)(tdsqlite3_context*,int); + void (*result_int64)(tdsqlite3_context*,sqlite_int64); + void (*result_null)(tdsqlite3_context*); + void (*result_text)(tdsqlite3_context*,const char*,int,void(*)(void*)); + void (*result_text16)(tdsqlite3_context*,const void*,int,void(*)(void*)); + void (*result_text16be)(tdsqlite3_context*,const void*,int,void(*)(void*)); + void (*result_text16le)(tdsqlite3_context*,const void*,int,void(*)(void*)); + void (*result_value)(tdsqlite3_context*,tdsqlite3_value*); + void * (*rollback_hook)(tdsqlite3*,void(*)(void*),void*); + int (*set_authorizer)(tdsqlite3*,int(*)(void*,int,const char*,const char*, const char*,const char*),void*); - void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*)); + void (*set_auxdata)(tdsqlite3_context*,int,void*,void (*)(void*)); char * (*xsnprintf)(int,char*,const char*,...); - int (*step)(sqlite3_stmt*); - int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*, + int (*step)(tdsqlite3_stmt*); + int (*table_column_metadata)(tdsqlite3*,const char*,const char*,const char*, char const**,char const**,int*,int*,int*); void (*thread_cleanup)(void); - int (*total_changes)(sqlite3*); - void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*); - int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*); - void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*, + int (*total_changes)(tdsqlite3*); + void * (*trace)(tdsqlite3*,void(*xTrace)(void*,const char*),void*); + int (*transfer_bindings)(tdsqlite3_stmt*,tdsqlite3_stmt*); + void * (*update_hook)(tdsqlite3*,void(*)(void*,int ,char const*,char const*, sqlite_int64),void*); - void * (*user_data)(sqlite3_context*); - const void * (*value_blob)(sqlite3_value*); - int (*value_bytes)(sqlite3_value*); - int (*value_bytes16)(sqlite3_value*); - double (*value_double)(sqlite3_value*); - int (*value_int)(sqlite3_value*); - sqlite_int64 (*value_int64)(sqlite3_value*); - int (*value_numeric_type)(sqlite3_value*); - const unsigned char * (*value_text)(sqlite3_value*); - const void * (*value_text16)(sqlite3_value*); - const void * (*value_text16be)(sqlite3_value*); - const void * (*value_text16le)(sqlite3_value*); - int (*value_type)(sqlite3_value*); + void * (*user_data)(tdsqlite3_context*); + const void * (*value_blob)(tdsqlite3_value*); + int (*value_bytes)(tdsqlite3_value*); + int (*value_bytes16)(tdsqlite3_value*); + double (*value_double)(tdsqlite3_value*); + int (*value_int)(tdsqlite3_value*); + sqlite_int64 (*value_int64)(tdsqlite3_value*); + int (*value_numeric_type)(tdsqlite3_value*); + const unsigned char * (*value_text)(tdsqlite3_value*); + const void * (*value_text16)(tdsqlite3_value*); + const void * (*value_text16be)(tdsqlite3_value*); + const void * (*value_text16le)(tdsqlite3_value*); + int (*value_type)(tdsqlite3_value*); char *(*vmprintf)(const char*,va_list); /* Added ??? */ - int (*overload_function)(sqlite3*, const char *zFuncName, int nArg); + int (*overload_function)(tdsqlite3*, const char *zFuncName, int nArg); /* Added by 3.3.13 */ - int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); - int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); - int (*clear_bindings)(sqlite3_stmt*); + int (*prepare_v2)(tdsqlite3*,const char*,int,tdsqlite3_stmt**,const char**); + int (*prepare16_v2)(tdsqlite3*,const void*,int,tdsqlite3_stmt**,const void**); + int (*clear_bindings)(tdsqlite3_stmt*); /* Added by 3.4.1 */ - int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*, + int (*create_module_v2)(tdsqlite3*,const char*,const tdsqlite3_module*,void*, void (*xDestroy)(void *)); /* Added by 3.5.0 */ - int (*bind_zeroblob)(sqlite3_stmt*,int,int); - int (*blob_bytes)(sqlite3_blob*); - int (*blob_close)(sqlite3_blob*); - int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64, - int,sqlite3_blob**); - int (*blob_read)(sqlite3_blob*,void*,int,int); - int (*blob_write)(sqlite3_blob*,const void*,int,int); - int (*create_collation_v2)(sqlite3*,const char*,int,void*, + int (*bind_zeroblob)(tdsqlite3_stmt*,int,int); + int (*blob_bytes)(tdsqlite3_blob*); + int (*blob_close)(tdsqlite3_blob*); + int (*blob_open)(tdsqlite3*,const char*,const char*,const char*,tdsqlite3_int64, + int,tdsqlite3_blob**); + int (*blob_read)(tdsqlite3_blob*,void*,int,int); + int (*blob_write)(tdsqlite3_blob*,const void*,int,int); + int (*create_collation_v2)(tdsqlite3*,const char*,int,void*, int(*)(void*,int,const void*,int,const void*), void(*)(void*)); - int (*file_control)(sqlite3*,const char*,int,void*); - sqlite3_int64 (*memory_highwater)(int); - sqlite3_int64 (*memory_used)(void); - sqlite3_mutex *(*mutex_alloc)(int); - void (*mutex_enter)(sqlite3_mutex*); - void (*mutex_free)(sqlite3_mutex*); - void (*mutex_leave)(sqlite3_mutex*); - int (*mutex_try)(sqlite3_mutex*); - int (*open_v2)(const char*,sqlite3**,int,const char*); + int (*file_control)(tdsqlite3*,const char*,int,void*); + tdsqlite3_int64 (*memory_highwater)(int); + tdsqlite3_int64 (*memory_used)(void); + tdsqlite3_mutex *(*mutex_alloc)(int); + void (*mutex_enter)(tdsqlite3_mutex*); + void (*mutex_free)(tdsqlite3_mutex*); + void (*mutex_leave)(tdsqlite3_mutex*); + int (*mutex_try)(tdsqlite3_mutex*); + int (*open_v2)(const char*,tdsqlite3**,int,const char*); int (*release_memory)(int); - void (*result_error_nomem)(sqlite3_context*); - void (*result_error_toobig)(sqlite3_context*); + void (*result_error_nomem)(tdsqlite3_context*); + void (*result_error_toobig)(tdsqlite3_context*); int (*sleep)(int); void (*soft_heap_limit)(int); - sqlite3_vfs *(*vfs_find)(const char*); - int (*vfs_register)(sqlite3_vfs*,int); - int (*vfs_unregister)(sqlite3_vfs*); + tdsqlite3_vfs *(*vfs_find)(const char*); + int (*vfs_register)(tdsqlite3_vfs*,int); + int (*vfs_unregister)(tdsqlite3_vfs*); int (*xthreadsafe)(void); - void (*result_zeroblob)(sqlite3_context*,int); - void (*result_error_code)(sqlite3_context*,int); + void (*result_zeroblob)(tdsqlite3_context*,int); + void (*result_error_code)(tdsqlite3_context*,int); int (*test_control)(int, ...); void (*randomness)(int,void*); - sqlite3 *(*context_db_handle)(sqlite3_context*); - int (*extended_result_codes)(sqlite3*,int); - int (*limit)(sqlite3*,int,int); - sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*); - const char *(*sql)(sqlite3_stmt*); + tdsqlite3 *(*context_db_handle)(tdsqlite3_context*); + int (*extended_result_codes)(tdsqlite3*,int); + int (*limit)(tdsqlite3*,int,int); + tdsqlite3_stmt *(*next_stmt)(tdsqlite3*,tdsqlite3_stmt*); + const char *(*sql)(tdsqlite3_stmt*); int (*status)(int,int*,int*,int); - int (*backup_finish)(sqlite3_backup*); - sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*); - int (*backup_pagecount)(sqlite3_backup*); - int (*backup_remaining)(sqlite3_backup*); - int (*backup_step)(sqlite3_backup*,int); + int (*backup_finish)(tdsqlite3_backup*); + tdsqlite3_backup *(*backup_init)(tdsqlite3*,const char*,tdsqlite3*,const char*); + int (*backup_pagecount)(tdsqlite3_backup*); + int (*backup_remaining)(tdsqlite3_backup*); + int (*backup_step)(tdsqlite3_backup*,int); const char *(*compileoption_get)(int); int (*compileoption_used)(const char*); - int (*create_function_v2)(sqlite3*,const char*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), + int (*create_function_v2)(tdsqlite3*,const char*,int,int,void*, + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*), void(*xDestroy)(void*)); - int (*db_config)(sqlite3*,int,...); - sqlite3_mutex *(*db_mutex)(sqlite3*); - int (*db_status)(sqlite3*,int,int*,int*,int); - int (*extended_errcode)(sqlite3*); + int (*db_config)(tdsqlite3*,int,...); + tdsqlite3_mutex *(*db_mutex)(tdsqlite3*); + int (*db_status)(tdsqlite3*,int,int*,int*,int); + int (*extended_errcode)(tdsqlite3*); void (*log)(int,const char*,...); - sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64); + tdsqlite3_int64 (*soft_heap_limit64)(tdsqlite3_int64); const char *(*sourceid)(void); - int (*stmt_status)(sqlite3_stmt*,int,int); + int (*stmt_status)(tdsqlite3_stmt*,int,int); int (*strnicmp)(const char*,const char*,int); - int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*); - int (*wal_autocheckpoint)(sqlite3*,int); - int (*wal_checkpoint)(sqlite3*,const char*); - void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*); - int (*blob_reopen)(sqlite3_blob*,sqlite3_int64); - int (*vtab_config)(sqlite3*,int op,...); - int (*vtab_on_conflict)(sqlite3*); + int (*unlock_notify)(tdsqlite3*,void(*)(void**,int),void*); + int (*wal_autocheckpoint)(tdsqlite3*,int); + int (*wal_checkpoint)(tdsqlite3*,const char*); + void *(*wal_hook)(tdsqlite3*,int(*)(void*,tdsqlite3*,const char*,int),void*); + int (*blob_reopen)(tdsqlite3_blob*,tdsqlite3_int64); + int (*vtab_config)(tdsqlite3*,int op,...); + int (*vtab_on_conflict)(tdsqlite3*); /* Version 3.7.16 and later */ - int (*close_v2)(sqlite3*); - const char *(*db_filename)(sqlite3*,const char*); - int (*db_readonly)(sqlite3*,const char*); - int (*db_release_memory)(sqlite3*); + int (*close_v2)(tdsqlite3*); + const char *(*db_filename)(tdsqlite3*,const char*); + int (*db_readonly)(tdsqlite3*,const char*); + int (*db_release_memory)(tdsqlite3*); const char *(*errstr)(int); - int (*stmt_busy)(sqlite3_stmt*); - int (*stmt_readonly)(sqlite3_stmt*); + int (*stmt_busy)(tdsqlite3_stmt*); + int (*stmt_readonly)(tdsqlite3_stmt*); int (*stricmp)(const char*,const char*); int (*uri_boolean)(const char*,const char*,int); - sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64); + tdsqlite3_int64 (*uri_int64)(const char*,const char*,tdsqlite3_int64); const char *(*uri_parameter)(const char*,const char*); char *(*xvsnprintf)(int,char*,const char*,va_list); - int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*); + int (*wal_checkpoint_v2)(tdsqlite3*,const char*,int,int*,int*); /* Version 3.8.7 and later */ int (*auto_extension)(void(*)(void)); - int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64, + int (*bind_blob64)(tdsqlite3_stmt*,int,const void*,tdsqlite3_uint64, void(*)(void*)); - int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64, + int (*bind_text64)(tdsqlite3_stmt*,int,const char*,tdsqlite3_uint64, void(*)(void*),unsigned char); int (*cancel_auto_extension)(void(*)(void)); - int (*load_extension)(sqlite3*,const char*,const char*,char**); - void *(*malloc64)(sqlite3_uint64); - sqlite3_uint64 (*msize)(void*); - void *(*realloc64)(void*,sqlite3_uint64); + int (*load_extension)(tdsqlite3*,const char*,const char*,char**); + void *(*malloc64)(tdsqlite3_uint64); + tdsqlite3_uint64 (*msize)(void*); + void *(*realloc64)(void*,tdsqlite3_uint64); void (*reset_auto_extension)(void); - void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64, + void (*result_blob64)(tdsqlite3_context*,const void*,tdsqlite3_uint64, void(*)(void*)); - void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64, + void (*result_text64)(tdsqlite3_context*,const char*,tdsqlite3_uint64, void(*)(void*), unsigned char); int (*strglob)(const char*,const char*); /* Version 3.8.11 and later */ - sqlite3_value *(*value_dup)(const sqlite3_value*); - void (*value_free)(sqlite3_value*); - int (*result_zeroblob64)(sqlite3_context*,sqlite3_uint64); - int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64); + tdsqlite3_value *(*value_dup)(const tdsqlite3_value*); + void (*value_free)(tdsqlite3_value*); + int (*result_zeroblob64)(tdsqlite3_context*,tdsqlite3_uint64); + int (*bind_zeroblob64)(tdsqlite3_stmt*, int, tdsqlite3_uint64); /* Version 3.9.0 and later */ - unsigned int (*value_subtype)(sqlite3_value*); - void (*result_subtype)(sqlite3_context*,unsigned int); + unsigned int (*value_subtype)(tdsqlite3_value*); + void (*result_subtype)(tdsqlite3_context*,unsigned int); /* Version 3.10.0 and later */ - int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int); + int (*status64)(int,tdsqlite3_int64*,tdsqlite3_int64*,int); int (*strlike)(const char*,const char*,unsigned int); - int (*db_cacheflush)(sqlite3*); + int (*db_cacheflush)(tdsqlite3*); /* Version 3.12.0 and later */ - int (*system_errno)(sqlite3*); + int (*system_errno)(tdsqlite3*); /* Version 3.14.0 and later */ - int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*); - char *(*expanded_sql)(sqlite3_stmt*); + int (*trace_v2)(tdsqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*); + char *(*expanded_sql)(tdsqlite3_stmt*); /* Version 3.18.0 and later */ - void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64); + void (*set_last_insert_rowid)(tdsqlite3*,tdsqlite3_int64); /* Version 3.20.0 and later */ - int (*prepare_v3)(sqlite3*,const char*,int,unsigned int, - sqlite3_stmt**,const char**); - int (*prepare16_v3)(sqlite3*,const void*,int,unsigned int, - sqlite3_stmt**,const void**); - int (*bind_pointer)(sqlite3_stmt*,int,void*,const char*,void(*)(void*)); - void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*)); - void *(*value_pointer)(sqlite3_value*,const char*); - int (*vtab_nochange)(sqlite3_context*); - int (*value_nochange)(sqlite3_value*); - const char *(*vtab_collation)(sqlite3_index_info*,int); + int (*prepare_v3)(tdsqlite3*,const char*,int,unsigned int, + tdsqlite3_stmt**,const char**); + int (*prepare16_v3)(tdsqlite3*,const void*,int,unsigned int, + tdsqlite3_stmt**,const void**); + int (*bind_pointer)(tdsqlite3_stmt*,int,void*,const char*,void(*)(void*)); + void (*result_pointer)(tdsqlite3_context*,void*,const char*,void(*)(void*)); + void *(*value_pointer)(tdsqlite3_value*,const char*); + int (*vtab_nochange)(tdsqlite3_context*); + int (*value_nochange)(tdsqlite3_value*); + const char *(*vtab_collation)(tdsqlite3_index_info*,int); /* Version 3.24.0 and later */ int (*keyword_count)(void); int (*keyword_name)(int,const char**,int*); int (*keyword_check)(const char*,int); - sqlite3_str *(*str_new)(sqlite3*); - char *(*str_finish)(sqlite3_str*); - void (*str_appendf)(sqlite3_str*, const char *zFormat, ...); - void (*str_vappendf)(sqlite3_str*, const char *zFormat, va_list); - void (*str_append)(sqlite3_str*, const char *zIn, int N); - void (*str_appendall)(sqlite3_str*, const char *zIn); - void (*str_appendchar)(sqlite3_str*, int N, char C); - void (*str_reset)(sqlite3_str*); - int (*str_errcode)(sqlite3_str*); - int (*str_length)(sqlite3_str*); - char *(*str_value)(sqlite3_str*); + tdsqlite3_str *(*str_new)(tdsqlite3*); + char *(*str_finish)(tdsqlite3_str*); + void (*str_appendf)(tdsqlite3_str*, const char *zFormat, ...); + void (*str_vappendf)(tdsqlite3_str*, const char *zFormat, va_list); + void (*str_append)(tdsqlite3_str*, const char *zIn, int N); + void (*str_appendall)(tdsqlite3_str*, const char *zIn); + void (*str_appendchar)(tdsqlite3_str*, int N, char C); + void (*str_reset)(tdsqlite3_str*); + int (*str_errcode)(tdsqlite3_str*); + int (*str_length)(tdsqlite3_str*); + char *(*str_value)(tdsqlite3_str*); /* Version 3.25.0 and later */ - int (*create_window_function)(sqlite3*,const char*,int,int,void*, - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), - void (*xValue)(sqlite3_context*), - void (*xInv)(sqlite3_context*,int,sqlite3_value**), + int (*create_window_function)(tdsqlite3*,const char*,int,int,void*, + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*), + void (*xValue)(tdsqlite3_context*), + void (*xInv)(tdsqlite3_context*,int,tdsqlite3_value**), void(*xDestroy)(void*)); /* Version 3.26.0 and later */ - const char *(*normalized_sql)(sqlite3_stmt*); + const char *(*normalized_sql)(tdsqlite3_stmt*); /* Version 3.28.0 and later */ - int (*stmt_isexplain)(sqlite3_stmt*); - int (*value_frombind)(sqlite3_value*); + int (*stmt_isexplain)(tdsqlite3_stmt*); + int (*value_frombind)(tdsqlite3_value*); /* Version 3.30.0 and later */ - int (*drop_modules)(sqlite3*,const char**); + int (*drop_modules)(tdsqlite3*,const char**); /* Version 3.31.0 and later */ - sqlite3_int64 (*hard_heap_limit64)(sqlite3_int64); + tdsqlite3_int64 (*hard_heap_limit64)(tdsqlite3_int64); const char *(*uri_key)(const char*,int); const char *(*filename_database)(const char*); const char *(*filename_journal)(const char*); @@ -126952,309 +126952,309 @@ struct sqlite3_api_routines { ** This is the function signature used for all extension entry points. It ** is also defined in the file "loadext.c". */ -typedef int (*sqlite3_loadext_entry)( - sqlite3 *db, /* Handle to the database. */ +typedef int (*tdsqlite3_loadext_entry)( + tdsqlite3 *db, /* Handle to the database. */ char **pzErrMsg, /* Used to set error string on failure. */ - const sqlite3_api_routines *pThunk /* Extension API function pointers. */ + const tdsqlite3_api_routines *pThunk /* Extension API function pointers. */ ); /* ** The following macros redefine the API routines so that they are -** redirected through the global sqlite3_api structure. +** redirected through the global tdsqlite3_api structure. ** ** This header file is also used by the loadext.c source file ** (part of the main SQLite library - not an extension) so that -** it can get access to the sqlite3_api_routines structure +** it can get access to the tdsqlite3_api_routines structure ** definition. But the main library does not want to redefine ** the API. So the redefinition macros are only valid if the ** SQLITE_CORE macros is undefined. */ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) -#define sqlite3_aggregate_context sqlite3_api->aggregate_context +#define tdsqlite3_aggregate_context tdsqlite3_api->aggregate_context #ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_aggregate_count sqlite3_api->aggregate_count +#define tdsqlite3_aggregate_count tdsqlite3_api->aggregate_count #endif -#define sqlite3_bind_blob sqlite3_api->bind_blob -#define sqlite3_bind_double sqlite3_api->bind_double -#define sqlite3_bind_int sqlite3_api->bind_int -#define sqlite3_bind_int64 sqlite3_api->bind_int64 -#define sqlite3_bind_null sqlite3_api->bind_null -#define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count -#define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index -#define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name -#define sqlite3_bind_text sqlite3_api->bind_text -#define sqlite3_bind_text16 sqlite3_api->bind_text16 -#define sqlite3_bind_value sqlite3_api->bind_value -#define sqlite3_busy_handler sqlite3_api->busy_handler -#define sqlite3_busy_timeout sqlite3_api->busy_timeout -#define sqlite3_changes sqlite3_api->changes -#define sqlite3_close sqlite3_api->close -#define sqlite3_collation_needed sqlite3_api->collation_needed -#define sqlite3_collation_needed16 sqlite3_api->collation_needed16 -#define sqlite3_column_blob sqlite3_api->column_blob -#define sqlite3_column_bytes sqlite3_api->column_bytes -#define sqlite3_column_bytes16 sqlite3_api->column_bytes16 -#define sqlite3_column_count sqlite3_api->column_count -#define sqlite3_column_database_name sqlite3_api->column_database_name -#define sqlite3_column_database_name16 sqlite3_api->column_database_name16 -#define sqlite3_column_decltype sqlite3_api->column_decltype -#define sqlite3_column_decltype16 sqlite3_api->column_decltype16 -#define sqlite3_column_double sqlite3_api->column_double -#define sqlite3_column_int sqlite3_api->column_int -#define sqlite3_column_int64 sqlite3_api->column_int64 -#define sqlite3_column_name sqlite3_api->column_name -#define sqlite3_column_name16 sqlite3_api->column_name16 -#define sqlite3_column_origin_name sqlite3_api->column_origin_name -#define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16 -#define sqlite3_column_table_name sqlite3_api->column_table_name -#define sqlite3_column_table_name16 sqlite3_api->column_table_name16 -#define sqlite3_column_text sqlite3_api->column_text -#define sqlite3_column_text16 sqlite3_api->column_text16 -#define sqlite3_column_type sqlite3_api->column_type -#define sqlite3_column_value sqlite3_api->column_value -#define sqlite3_commit_hook sqlite3_api->commit_hook -#define sqlite3_complete sqlite3_api->complete -#define sqlite3_complete16 sqlite3_api->complete16 -#define sqlite3_create_collation sqlite3_api->create_collation -#define sqlite3_create_collation16 sqlite3_api->create_collation16 -#define sqlite3_create_function sqlite3_api->create_function -#define sqlite3_create_function16 sqlite3_api->create_function16 -#define sqlite3_create_module sqlite3_api->create_module -#define sqlite3_create_module_v2 sqlite3_api->create_module_v2 -#define sqlite3_data_count sqlite3_api->data_count -#define sqlite3_db_handle sqlite3_api->db_handle -#define sqlite3_declare_vtab sqlite3_api->declare_vtab -#define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache -#define sqlite3_errcode sqlite3_api->errcode -#define sqlite3_errmsg sqlite3_api->errmsg -#define sqlite3_errmsg16 sqlite3_api->errmsg16 -#define sqlite3_exec sqlite3_api->exec +#define tdsqlite3_bind_blob tdsqlite3_api->bind_blob +#define tdsqlite3_bind_double tdsqlite3_api->bind_double +#define tdsqlite3_bind_int tdsqlite3_api->bind_int +#define tdsqlite3_bind_int64 tdsqlite3_api->bind_int64 +#define tdsqlite3_bind_null tdsqlite3_api->bind_null +#define tdsqlite3_bind_parameter_count tdsqlite3_api->bind_parameter_count +#define tdsqlite3_bind_parameter_index tdsqlite3_api->bind_parameter_index +#define tdsqlite3_bind_parameter_name tdsqlite3_api->bind_parameter_name +#define tdsqlite3_bind_text tdsqlite3_api->bind_text +#define tdsqlite3_bind_text16 tdsqlite3_api->bind_text16 +#define tdsqlite3_bind_value tdsqlite3_api->bind_value +#define tdsqlite3_busy_handler tdsqlite3_api->busy_handler +#define tdsqlite3_busy_timeout tdsqlite3_api->busy_timeout +#define tdsqlite3_changes tdsqlite3_api->changes +#define tdsqlite3_close tdsqlite3_api->close +#define tdsqlite3_collation_needed tdsqlite3_api->collation_needed +#define tdsqlite3_collation_needed16 tdsqlite3_api->collation_needed16 +#define tdsqlite3_column_blob tdsqlite3_api->column_blob +#define tdsqlite3_column_bytes tdsqlite3_api->column_bytes +#define tdsqlite3_column_bytes16 tdsqlite3_api->column_bytes16 +#define tdsqlite3_column_count tdsqlite3_api->column_count +#define tdsqlite3_column_database_name tdsqlite3_api->column_database_name +#define tdsqlite3_column_database_name16 tdsqlite3_api->column_database_name16 +#define tdsqlite3_column_decltype tdsqlite3_api->column_decltype +#define tdsqlite3_column_decltype16 tdsqlite3_api->column_decltype16 +#define tdsqlite3_column_double tdsqlite3_api->column_double +#define tdsqlite3_column_int tdsqlite3_api->column_int +#define tdsqlite3_column_int64 tdsqlite3_api->column_int64 +#define tdsqlite3_column_name tdsqlite3_api->column_name +#define tdsqlite3_column_name16 tdsqlite3_api->column_name16 +#define tdsqlite3_column_origin_name tdsqlite3_api->column_origin_name +#define tdsqlite3_column_origin_name16 tdsqlite3_api->column_origin_name16 +#define tdsqlite3_column_table_name tdsqlite3_api->column_table_name +#define tdsqlite3_column_table_name16 tdsqlite3_api->column_table_name16 +#define tdsqlite3_column_text tdsqlite3_api->column_text +#define tdsqlite3_column_text16 tdsqlite3_api->column_text16 +#define tdsqlite3_column_type tdsqlite3_api->column_type +#define tdsqlite3_column_value tdsqlite3_api->column_value +#define tdsqlite3_commit_hook tdsqlite3_api->commit_hook +#define tdsqlite3_complete tdsqlite3_api->complete +#define tdsqlite3_complete16 tdsqlite3_api->complete16 +#define tdsqlite3_create_collation tdsqlite3_api->create_collation +#define tdsqlite3_create_collation16 tdsqlite3_api->create_collation16 +#define tdsqlite3_create_function tdsqlite3_api->create_function +#define tdsqlite3_create_function16 tdsqlite3_api->create_function16 +#define tdsqlite3_create_module tdsqlite3_api->create_module +#define tdsqlite3_create_module_v2 tdsqlite3_api->create_module_v2 +#define tdsqlite3_data_count tdsqlite3_api->data_count +#define tdsqlite3_db_handle tdsqlite3_api->db_handle +#define tdsqlite3_declare_vtab tdsqlite3_api->declare_vtab +#define tdsqlite3_enable_shared_cache tdsqlite3_api->enable_shared_cache +#define tdsqlite3_errcode tdsqlite3_api->errcode +#define tdsqlite3_errmsg tdsqlite3_api->errmsg +#define tdsqlite3_errmsg16 tdsqlite3_api->errmsg16 +#define tdsqlite3_exec tdsqlite3_api->exec #ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_expired sqlite3_api->expired +#define tdsqlite3_expired tdsqlite3_api->expired #endif -#define sqlite3_finalize sqlite3_api->finalize -#define sqlite3_free sqlite3_api->free -#define sqlite3_free_table sqlite3_api->free_table -#define sqlite3_get_autocommit sqlite3_api->get_autocommit -#define sqlite3_get_auxdata sqlite3_api->get_auxdata -#define sqlite3_get_table sqlite3_api->get_table +#define tdsqlite3_finalize tdsqlite3_api->finalize +#define tdsqlite3_free tdsqlite3_api->free +#define tdsqlite3_free_table tdsqlite3_api->free_table +#define tdsqlite3_get_autocommit tdsqlite3_api->get_autocommit +#define tdsqlite3_get_auxdata tdsqlite3_api->get_auxdata +#define tdsqlite3_get_table tdsqlite3_api->get_table #ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_global_recover sqlite3_api->global_recover +#define tdsqlite3_global_recover tdsqlite3_api->global_recover #endif -#define sqlite3_interrupt sqlite3_api->interruptx -#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid -#define sqlite3_libversion sqlite3_api->libversion -#define sqlite3_libversion_number sqlite3_api->libversion_number -#define sqlite3_malloc sqlite3_api->malloc -#define sqlite3_mprintf sqlite3_api->mprintf -#define sqlite3_open sqlite3_api->open -#define sqlite3_open16 sqlite3_api->open16 -#define sqlite3_prepare sqlite3_api->prepare -#define sqlite3_prepare16 sqlite3_api->prepare16 -#define sqlite3_prepare_v2 sqlite3_api->prepare_v2 -#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2 -#define sqlite3_profile sqlite3_api->profile -#define sqlite3_progress_handler sqlite3_api->progress_handler -#define sqlite3_realloc sqlite3_api->realloc -#define sqlite3_reset sqlite3_api->reset -#define sqlite3_result_blob sqlite3_api->result_blob -#define sqlite3_result_double sqlite3_api->result_double -#define sqlite3_result_error sqlite3_api->result_error -#define sqlite3_result_error16 sqlite3_api->result_error16 -#define sqlite3_result_int sqlite3_api->result_int -#define sqlite3_result_int64 sqlite3_api->result_int64 -#define sqlite3_result_null sqlite3_api->result_null -#define sqlite3_result_text sqlite3_api->result_text -#define sqlite3_result_text16 sqlite3_api->result_text16 -#define sqlite3_result_text16be sqlite3_api->result_text16be -#define sqlite3_result_text16le sqlite3_api->result_text16le -#define sqlite3_result_value sqlite3_api->result_value -#define sqlite3_rollback_hook sqlite3_api->rollback_hook -#define sqlite3_set_authorizer sqlite3_api->set_authorizer -#define sqlite3_set_auxdata sqlite3_api->set_auxdata -#define sqlite3_snprintf sqlite3_api->xsnprintf -#define sqlite3_step sqlite3_api->step -#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata -#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup -#define sqlite3_total_changes sqlite3_api->total_changes -#define sqlite3_trace sqlite3_api->trace +#define tdsqlite3_interrupt tdsqlite3_api->interruptx +#define tdsqlite3_last_insert_rowid tdsqlite3_api->last_insert_rowid +#define tdsqlite3_libversion tdsqlite3_api->libversion +#define tdsqlite3_libversion_number tdsqlite3_api->libversion_number +#define tdsqlite3_malloc tdsqlite3_api->malloc +#define tdsqlite3_mprintf tdsqlite3_api->mprintf +#define tdsqlite3_open tdsqlite3_api->open +#define tdsqlite3_open16 tdsqlite3_api->open16 +#define tdsqlite3_prepare tdsqlite3_api->prepare +#define tdsqlite3_prepare16 tdsqlite3_api->prepare16 +#define tdsqlite3_prepare_v2 tdsqlite3_api->prepare_v2 +#define tdsqlite3_prepare16_v2 tdsqlite3_api->prepare16_v2 +#define tdsqlite3_profile tdsqlite3_api->profile +#define tdsqlite3_progress_handler tdsqlite3_api->progress_handler +#define tdsqlite3_realloc tdsqlite3_api->realloc +#define tdsqlite3_reset tdsqlite3_api->reset +#define tdsqlite3_result_blob tdsqlite3_api->result_blob +#define tdsqlite3_result_double tdsqlite3_api->result_double +#define tdsqlite3_result_error tdsqlite3_api->result_error +#define tdsqlite3_result_error16 tdsqlite3_api->result_error16 +#define tdsqlite3_result_int tdsqlite3_api->result_int +#define tdsqlite3_result_int64 tdsqlite3_api->result_int64 +#define tdsqlite3_result_null tdsqlite3_api->result_null +#define tdsqlite3_result_text tdsqlite3_api->result_text +#define tdsqlite3_result_text16 tdsqlite3_api->result_text16 +#define tdsqlite3_result_text16be tdsqlite3_api->result_text16be +#define tdsqlite3_result_text16le tdsqlite3_api->result_text16le +#define tdsqlite3_result_value tdsqlite3_api->result_value +#define tdsqlite3_rollback_hook tdsqlite3_api->rollback_hook +#define tdsqlite3_set_authorizer tdsqlite3_api->set_authorizer +#define tdsqlite3_set_auxdata tdsqlite3_api->set_auxdata +#define tdsqlite3_snprintf tdsqlite3_api->xsnprintf +#define tdsqlite3_step tdsqlite3_api->step +#define tdsqlite3_table_column_metadata tdsqlite3_api->table_column_metadata +#define tdsqlite3_thread_cleanup tdsqlite3_api->thread_cleanup +#define tdsqlite3_total_changes tdsqlite3_api->total_changes +#define tdsqlite3_trace tdsqlite3_api->trace #ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_transfer_bindings sqlite3_api->transfer_bindings +#define tdsqlite3_transfer_bindings tdsqlite3_api->transfer_bindings #endif -#define sqlite3_update_hook sqlite3_api->update_hook -#define sqlite3_user_data sqlite3_api->user_data -#define sqlite3_value_blob sqlite3_api->value_blob -#define sqlite3_value_bytes sqlite3_api->value_bytes -#define sqlite3_value_bytes16 sqlite3_api->value_bytes16 -#define sqlite3_value_double sqlite3_api->value_double -#define sqlite3_value_int sqlite3_api->value_int -#define sqlite3_value_int64 sqlite3_api->value_int64 -#define sqlite3_value_numeric_type sqlite3_api->value_numeric_type -#define sqlite3_value_text sqlite3_api->value_text -#define sqlite3_value_text16 sqlite3_api->value_text16 -#define sqlite3_value_text16be sqlite3_api->value_text16be -#define sqlite3_value_text16le sqlite3_api->value_text16le -#define sqlite3_value_type sqlite3_api->value_type -#define sqlite3_vmprintf sqlite3_api->vmprintf -#define sqlite3_vsnprintf sqlite3_api->xvsnprintf -#define sqlite3_overload_function sqlite3_api->overload_function -#define sqlite3_prepare_v2 sqlite3_api->prepare_v2 -#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2 -#define sqlite3_clear_bindings sqlite3_api->clear_bindings -#define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob -#define sqlite3_blob_bytes sqlite3_api->blob_bytes -#define sqlite3_blob_close sqlite3_api->blob_close -#define sqlite3_blob_open sqlite3_api->blob_open -#define sqlite3_blob_read sqlite3_api->blob_read -#define sqlite3_blob_write sqlite3_api->blob_write -#define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2 -#define sqlite3_file_control sqlite3_api->file_control -#define sqlite3_memory_highwater sqlite3_api->memory_highwater -#define sqlite3_memory_used sqlite3_api->memory_used -#define sqlite3_mutex_alloc sqlite3_api->mutex_alloc -#define sqlite3_mutex_enter sqlite3_api->mutex_enter -#define sqlite3_mutex_free sqlite3_api->mutex_free -#define sqlite3_mutex_leave sqlite3_api->mutex_leave -#define sqlite3_mutex_try sqlite3_api->mutex_try -#define sqlite3_open_v2 sqlite3_api->open_v2 -#define sqlite3_release_memory sqlite3_api->release_memory -#define sqlite3_result_error_nomem sqlite3_api->result_error_nomem -#define sqlite3_result_error_toobig sqlite3_api->result_error_toobig -#define sqlite3_sleep sqlite3_api->sleep -#define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit -#define sqlite3_vfs_find sqlite3_api->vfs_find -#define sqlite3_vfs_register sqlite3_api->vfs_register -#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister -#define sqlite3_threadsafe sqlite3_api->xthreadsafe -#define sqlite3_result_zeroblob sqlite3_api->result_zeroblob -#define sqlite3_result_error_code sqlite3_api->result_error_code -#define sqlite3_test_control sqlite3_api->test_control -#define sqlite3_randomness sqlite3_api->randomness -#define sqlite3_context_db_handle sqlite3_api->context_db_handle -#define sqlite3_extended_result_codes sqlite3_api->extended_result_codes -#define sqlite3_limit sqlite3_api->limit -#define sqlite3_next_stmt sqlite3_api->next_stmt -#define sqlite3_sql sqlite3_api->sql -#define sqlite3_status sqlite3_api->status -#define sqlite3_backup_finish sqlite3_api->backup_finish -#define sqlite3_backup_init sqlite3_api->backup_init -#define sqlite3_backup_pagecount sqlite3_api->backup_pagecount -#define sqlite3_backup_remaining sqlite3_api->backup_remaining -#define sqlite3_backup_step sqlite3_api->backup_step -#define sqlite3_compileoption_get sqlite3_api->compileoption_get -#define sqlite3_compileoption_used sqlite3_api->compileoption_used -#define sqlite3_create_function_v2 sqlite3_api->create_function_v2 -#define sqlite3_db_config sqlite3_api->db_config -#define sqlite3_db_mutex sqlite3_api->db_mutex -#define sqlite3_db_status sqlite3_api->db_status -#define sqlite3_extended_errcode sqlite3_api->extended_errcode -#define sqlite3_log sqlite3_api->log -#define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64 -#define sqlite3_sourceid sqlite3_api->sourceid -#define sqlite3_stmt_status sqlite3_api->stmt_status -#define sqlite3_strnicmp sqlite3_api->strnicmp -#define sqlite3_unlock_notify sqlite3_api->unlock_notify -#define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint -#define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint -#define sqlite3_wal_hook sqlite3_api->wal_hook -#define sqlite3_blob_reopen sqlite3_api->blob_reopen -#define sqlite3_vtab_config sqlite3_api->vtab_config -#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict +#define tdsqlite3_update_hook tdsqlite3_api->update_hook +#define tdsqlite3_user_data tdsqlite3_api->user_data +#define tdsqlite3_value_blob tdsqlite3_api->value_blob +#define tdsqlite3_value_bytes tdsqlite3_api->value_bytes +#define tdsqlite3_value_bytes16 tdsqlite3_api->value_bytes16 +#define tdsqlite3_value_double tdsqlite3_api->value_double +#define tdsqlite3_value_int tdsqlite3_api->value_int +#define tdsqlite3_value_int64 tdsqlite3_api->value_int64 +#define tdsqlite3_value_numeric_type tdsqlite3_api->value_numeric_type +#define tdsqlite3_value_text tdsqlite3_api->value_text +#define tdsqlite3_value_text16 tdsqlite3_api->value_text16 +#define tdsqlite3_value_text16be tdsqlite3_api->value_text16be +#define tdsqlite3_value_text16le tdsqlite3_api->value_text16le +#define tdsqlite3_value_type tdsqlite3_api->value_type +#define tdsqlite3_vmprintf tdsqlite3_api->vmprintf +#define tdsqlite3_vsnprintf tdsqlite3_api->xvsnprintf +#define tdsqlite3_overload_function tdsqlite3_api->overload_function +#define tdsqlite3_prepare_v2 tdsqlite3_api->prepare_v2 +#define tdsqlite3_prepare16_v2 tdsqlite3_api->prepare16_v2 +#define tdsqlite3_clear_bindings tdsqlite3_api->clear_bindings +#define tdsqlite3_bind_zeroblob tdsqlite3_api->bind_zeroblob +#define tdsqlite3_blob_bytes tdsqlite3_api->blob_bytes +#define tdsqlite3_blob_close tdsqlite3_api->blob_close +#define tdsqlite3_blob_open tdsqlite3_api->blob_open +#define tdsqlite3_blob_read tdsqlite3_api->blob_read +#define tdsqlite3_blob_write tdsqlite3_api->blob_write +#define tdsqlite3_create_collation_v2 tdsqlite3_api->create_collation_v2 +#define tdsqlite3_file_control tdsqlite3_api->file_control +#define tdsqlite3_memory_highwater tdsqlite3_api->memory_highwater +#define tdsqlite3_memory_used tdsqlite3_api->memory_used +#define tdsqlite3_mutex_alloc tdsqlite3_api->mutex_alloc +#define tdsqlite3_mutex_enter tdsqlite3_api->mutex_enter +#define tdsqlite3_mutex_free tdsqlite3_api->mutex_free +#define tdsqlite3_mutex_leave tdsqlite3_api->mutex_leave +#define tdsqlite3_mutex_try tdsqlite3_api->mutex_try +#define tdsqlite3_open_v2 tdsqlite3_api->open_v2 +#define tdsqlite3_release_memory tdsqlite3_api->release_memory +#define tdsqlite3_result_error_nomem tdsqlite3_api->result_error_nomem +#define tdsqlite3_result_error_toobig tdsqlite3_api->result_error_toobig +#define tdsqlite3_sleep tdsqlite3_api->sleep +#define tdsqlite3_soft_heap_limit tdsqlite3_api->soft_heap_limit +#define tdsqlite3_vfs_find tdsqlite3_api->vfs_find +#define tdsqlite3_vfs_register tdsqlite3_api->vfs_register +#define tdsqlite3_vfs_unregister tdsqlite3_api->vfs_unregister +#define tdsqlite3_threadsafe tdsqlite3_api->xthreadsafe +#define tdsqlite3_result_zeroblob tdsqlite3_api->result_zeroblob +#define tdsqlite3_result_error_code tdsqlite3_api->result_error_code +#define tdsqlite3_test_control tdsqlite3_api->test_control +#define tdsqlite3_randomness tdsqlite3_api->randomness +#define tdsqlite3_context_db_handle tdsqlite3_api->context_db_handle +#define tdsqlite3_extended_result_codes tdsqlite3_api->extended_result_codes +#define tdsqlite3_limit tdsqlite3_api->limit +#define tdsqlite3_next_stmt tdsqlite3_api->next_stmt +#define tdsqlite3_sql tdsqlite3_api->sql +#define tdsqlite3_status tdsqlite3_api->status +#define tdsqlite3_backup_finish tdsqlite3_api->backup_finish +#define tdsqlite3_backup_init tdsqlite3_api->backup_init +#define tdsqlite3_backup_pagecount tdsqlite3_api->backup_pagecount +#define tdsqlite3_backup_remaining tdsqlite3_api->backup_remaining +#define tdsqlite3_backup_step tdsqlite3_api->backup_step +#define tdsqlite3_compileoption_get tdsqlite3_api->compileoption_get +#define tdsqlite3_compileoption_used tdsqlite3_api->compileoption_used +#define tdsqlite3_create_function_v2 tdsqlite3_api->create_function_v2 +#define tdsqlite3_db_config tdsqlite3_api->db_config +#define tdsqlite3_db_mutex tdsqlite3_api->db_mutex +#define tdsqlite3_db_status tdsqlite3_api->db_status +#define tdsqlite3_extended_errcode tdsqlite3_api->extended_errcode +#define tdsqlite3_log tdsqlite3_api->log +#define tdsqlite3_soft_heap_limit64 tdsqlite3_api->soft_heap_limit64 +#define tdsqlite3_sourceid tdsqlite3_api->sourceid +#define tdsqlite3_stmt_status tdsqlite3_api->stmt_status +#define tdsqlite3_strnicmp tdsqlite3_api->strnicmp +#define tdsqlite3_unlock_notify tdsqlite3_api->unlock_notify +#define tdsqlite3_wal_autocheckpoint tdsqlite3_api->wal_autocheckpoint +#define tdsqlite3_wal_checkpoint tdsqlite3_api->wal_checkpoint +#define tdsqlite3_wal_hook tdsqlite3_api->wal_hook +#define tdsqlite3_blob_reopen tdsqlite3_api->blob_reopen +#define tdsqlite3_vtab_config tdsqlite3_api->vtab_config +#define tdsqlite3_vtab_on_conflict tdsqlite3_api->vtab_on_conflict /* Version 3.7.16 and later */ -#define sqlite3_close_v2 sqlite3_api->close_v2 -#define sqlite3_db_filename sqlite3_api->db_filename -#define sqlite3_db_readonly sqlite3_api->db_readonly -#define sqlite3_db_release_memory sqlite3_api->db_release_memory -#define sqlite3_errstr sqlite3_api->errstr -#define sqlite3_stmt_busy sqlite3_api->stmt_busy -#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly -#define sqlite3_stricmp sqlite3_api->stricmp -#define sqlite3_uri_boolean sqlite3_api->uri_boolean -#define sqlite3_uri_int64 sqlite3_api->uri_int64 -#define sqlite3_uri_parameter sqlite3_api->uri_parameter -#define sqlite3_uri_vsnprintf sqlite3_api->xvsnprintf -#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2 +#define tdsqlite3_close_v2 tdsqlite3_api->close_v2 +#define tdsqlite3_db_filename tdsqlite3_api->db_filename +#define tdsqlite3_db_readonly tdsqlite3_api->db_readonly +#define tdsqlite3_db_release_memory tdsqlite3_api->db_release_memory +#define tdsqlite3_errstr tdsqlite3_api->errstr +#define tdsqlite3_stmt_busy tdsqlite3_api->stmt_busy +#define tdsqlite3_stmt_readonly tdsqlite3_api->stmt_readonly +#define tdsqlite3_stricmp tdsqlite3_api->stricmp +#define tdsqlite3_uri_boolean tdsqlite3_api->uri_boolean +#define tdsqlite3_uri_int64 tdsqlite3_api->uri_int64 +#define tdsqlite3_uri_parameter tdsqlite3_api->uri_parameter +#define tdsqlite3_uri_vsnprintf tdsqlite3_api->xvsnprintf +#define tdsqlite3_wal_checkpoint_v2 tdsqlite3_api->wal_checkpoint_v2 /* Version 3.8.7 and later */ -#define sqlite3_auto_extension sqlite3_api->auto_extension -#define sqlite3_bind_blob64 sqlite3_api->bind_blob64 -#define sqlite3_bind_text64 sqlite3_api->bind_text64 -#define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension -#define sqlite3_load_extension sqlite3_api->load_extension -#define sqlite3_malloc64 sqlite3_api->malloc64 -#define sqlite3_msize sqlite3_api->msize -#define sqlite3_realloc64 sqlite3_api->realloc64 -#define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension -#define sqlite3_result_blob64 sqlite3_api->result_blob64 -#define sqlite3_result_text64 sqlite3_api->result_text64 -#define sqlite3_strglob sqlite3_api->strglob +#define tdsqlite3_auto_extension tdsqlite3_api->auto_extension +#define tdsqlite3_bind_blob64 tdsqlite3_api->bind_blob64 +#define tdsqlite3_bind_text64 tdsqlite3_api->bind_text64 +#define tdsqlite3_cancel_auto_extension tdsqlite3_api->cancel_auto_extension +#define tdsqlite3_load_extension tdsqlite3_api->load_extension +#define tdsqlite3_malloc64 tdsqlite3_api->malloc64 +#define tdsqlite3_msize tdsqlite3_api->msize +#define tdsqlite3_realloc64 tdsqlite3_api->realloc64 +#define tdsqlite3_reset_auto_extension tdsqlite3_api->reset_auto_extension +#define tdsqlite3_result_blob64 tdsqlite3_api->result_blob64 +#define tdsqlite3_result_text64 tdsqlite3_api->result_text64 +#define tdsqlite3_strglob tdsqlite3_api->strglob /* Version 3.8.11 and later */ -#define sqlite3_value_dup sqlite3_api->value_dup -#define sqlite3_value_free sqlite3_api->value_free -#define sqlite3_result_zeroblob64 sqlite3_api->result_zeroblob64 -#define sqlite3_bind_zeroblob64 sqlite3_api->bind_zeroblob64 +#define tdsqlite3_value_dup tdsqlite3_api->value_dup +#define tdsqlite3_value_free tdsqlite3_api->value_free +#define tdsqlite3_result_zeroblob64 tdsqlite3_api->result_zeroblob64 +#define tdsqlite3_bind_zeroblob64 tdsqlite3_api->bind_zeroblob64 /* Version 3.9.0 and later */ -#define sqlite3_value_subtype sqlite3_api->value_subtype -#define sqlite3_result_subtype sqlite3_api->result_subtype +#define tdsqlite3_value_subtype tdsqlite3_api->value_subtype +#define tdsqlite3_result_subtype tdsqlite3_api->result_subtype /* Version 3.10.0 and later */ -#define sqlite3_status64 sqlite3_api->status64 -#define sqlite3_strlike sqlite3_api->strlike -#define sqlite3_db_cacheflush sqlite3_api->db_cacheflush +#define tdsqlite3_status64 tdsqlite3_api->status64 +#define tdsqlite3_strlike tdsqlite3_api->strlike +#define tdsqlite3_db_cacheflush tdsqlite3_api->db_cacheflush /* Version 3.12.0 and later */ -#define sqlite3_system_errno sqlite3_api->system_errno +#define tdsqlite3_system_errno tdsqlite3_api->system_errno /* Version 3.14.0 and later */ -#define sqlite3_trace_v2 sqlite3_api->trace_v2 -#define sqlite3_expanded_sql sqlite3_api->expanded_sql +#define tdsqlite3_trace_v2 tdsqlite3_api->trace_v2 +#define tdsqlite3_expanded_sql tdsqlite3_api->expanded_sql /* Version 3.18.0 and later */ -#define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid +#define tdsqlite3_set_last_insert_rowid tdsqlite3_api->set_last_insert_rowid /* Version 3.20.0 and later */ -#define sqlite3_prepare_v3 sqlite3_api->prepare_v3 -#define sqlite3_prepare16_v3 sqlite3_api->prepare16_v3 -#define sqlite3_bind_pointer sqlite3_api->bind_pointer -#define sqlite3_result_pointer sqlite3_api->result_pointer -#define sqlite3_value_pointer sqlite3_api->value_pointer +#define tdsqlite3_prepare_v3 tdsqlite3_api->prepare_v3 +#define tdsqlite3_prepare16_v3 tdsqlite3_api->prepare16_v3 +#define tdsqlite3_bind_pointer tdsqlite3_api->bind_pointer +#define tdsqlite3_result_pointer tdsqlite3_api->result_pointer +#define tdsqlite3_value_pointer tdsqlite3_api->value_pointer /* Version 3.22.0 and later */ -#define sqlite3_vtab_nochange sqlite3_api->vtab_nochange -#define sqlite3_value_nochange sqlite3_api->value_nochange -#define sqlite3_vtab_collation sqlite3_api->vtab_collation +#define tdsqlite3_vtab_nochange tdsqlite3_api->vtab_nochange +#define tdsqlite3_value_nochange tdsqlite3_api->value_nochange +#define tdsqlite3_vtab_collation tdsqlite3_api->vtab_collation /* Version 3.24.0 and later */ -#define sqlite3_keyword_count sqlite3_api->keyword_count -#define sqlite3_keyword_name sqlite3_api->keyword_name -#define sqlite3_keyword_check sqlite3_api->keyword_check -#define sqlite3_str_new sqlite3_api->str_new -#define sqlite3_str_finish sqlite3_api->str_finish -#define sqlite3_str_appendf sqlite3_api->str_appendf -#define sqlite3_str_vappendf sqlite3_api->str_vappendf -#define sqlite3_str_append sqlite3_api->str_append -#define sqlite3_str_appendall sqlite3_api->str_appendall -#define sqlite3_str_appendchar sqlite3_api->str_appendchar -#define sqlite3_str_reset sqlite3_api->str_reset -#define sqlite3_str_errcode sqlite3_api->str_errcode -#define sqlite3_str_length sqlite3_api->str_length -#define sqlite3_str_value sqlite3_api->str_value +#define tdsqlite3_keyword_count tdsqlite3_api->keyword_count +#define tdsqlite3_keyword_name tdsqlite3_api->keyword_name +#define tdsqlite3_keyword_check tdsqlite3_api->keyword_check +#define tdsqlite3_str_new tdsqlite3_api->str_new +#define tdsqlite3_str_finish tdsqlite3_api->str_finish +#define tdsqlite3_str_appendf tdsqlite3_api->str_appendf +#define tdsqlite3_str_vappendf tdsqlite3_api->str_vappendf +#define tdsqlite3_str_append tdsqlite3_api->str_append +#define tdsqlite3_str_appendall tdsqlite3_api->str_appendall +#define tdsqlite3_str_appendchar tdsqlite3_api->str_appendchar +#define tdsqlite3_str_reset tdsqlite3_api->str_reset +#define tdsqlite3_str_errcode tdsqlite3_api->str_errcode +#define tdsqlite3_str_length tdsqlite3_api->str_length +#define tdsqlite3_str_value tdsqlite3_api->str_value /* Version 3.25.0 and later */ -#define sqlite3_create_window_function sqlite3_api->create_window_function +#define tdsqlite3_create_window_function tdsqlite3_api->create_window_function /* Version 3.26.0 and later */ -#define sqlite3_normalized_sql sqlite3_api->normalized_sql +#define tdsqlite3_normalized_sql tdsqlite3_api->normalized_sql /* Version 3.28.0 and later */ -#define sqlite3_stmt_isexplain sqlite3_api->isexplain -#define sqlite3_value_frombind sqlite3_api->frombind +#define tdsqlite3_stmt_isexplain tdsqlite3_api->isexplain +#define tdsqlite3_value_frombind tdsqlite3_api->frombind /* Version 3.30.0 and later */ -#define sqlite3_drop_modules sqlite3_api->drop_modules +#define tdsqlite3_drop_modules tdsqlite3_api->drop_modules /* Version 3.31.0 andn later */ -#define sqlite3_hard_heap_limit64 sqlite3_api->hard_heap_limit64 -#define sqlite3_uri_key sqlite3_api->uri_key -#define sqlite3_filename_database sqlite3_api->filename_database -#define sqlite3_filename_journal sqlite3_api->filename_journal -#define sqlite3_filename_wal sqlite3_api->filename_wal +#define tdsqlite3_hard_heap_limit64 tdsqlite3_api->hard_heap_limit64 +#define tdsqlite3_uri_key tdsqlite3_api->uri_key +#define tdsqlite3_filename_database tdsqlite3_api->filename_database +#define tdsqlite3_filename_journal tdsqlite3_api->filename_journal +#define tdsqlite3_filename_wal tdsqlite3_api->filename_wal #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) /* This case when the file really is being compiled as a loadable ** extension */ -# define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0; -# define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v; +# define SQLITE_EXTENSION_INIT1 const tdsqlite3_api_routines *tdsqlite3_api=0; +# define SQLITE_EXTENSION_INIT2(v) tdsqlite3_api=v; # define SQLITE_EXTENSION_INIT3 \ - extern const sqlite3_api_routines *sqlite3_api; + extern const tdsqlite3_api_routines *tdsqlite3_api; #else /* This case when the file is being statically linked into the ** application */ @@ -127265,7 +127265,7 @@ typedef int (*sqlite3_loadext_entry)( #endif /* SQLITE3EXT_H */ -/************** End of sqlite3ext.h ******************************************/ +/************** End of tdsqlite3ext.h ******************************************/ /************** Continuing where we left off in loadext.c ********************/ /* #include "sqliteInt.h" */ @@ -127276,93 +127276,93 @@ typedef int (*sqlite3_loadext_entry)( ** for any missing APIs. */ #ifndef SQLITE_ENABLE_COLUMN_METADATA -# define sqlite3_column_database_name 0 -# define sqlite3_column_database_name16 0 -# define sqlite3_column_table_name 0 -# define sqlite3_column_table_name16 0 -# define sqlite3_column_origin_name 0 -# define sqlite3_column_origin_name16 0 +# define tdsqlite3_column_database_name 0 +# define tdsqlite3_column_database_name16 0 +# define tdsqlite3_column_table_name 0 +# define tdsqlite3_column_table_name16 0 +# define tdsqlite3_column_origin_name 0 +# define tdsqlite3_column_origin_name16 0 #endif #ifdef SQLITE_OMIT_AUTHORIZATION -# define sqlite3_set_authorizer 0 +# define tdsqlite3_set_authorizer 0 #endif #ifdef SQLITE_OMIT_UTF16 -# define sqlite3_bind_text16 0 -# define sqlite3_collation_needed16 0 -# define sqlite3_column_decltype16 0 -# define sqlite3_column_name16 0 -# define sqlite3_column_text16 0 -# define sqlite3_complete16 0 -# define sqlite3_create_collation16 0 -# define sqlite3_create_function16 0 -# define sqlite3_errmsg16 0 -# define sqlite3_open16 0 -# define sqlite3_prepare16 0 -# define sqlite3_prepare16_v2 0 -# define sqlite3_prepare16_v3 0 -# define sqlite3_result_error16 0 -# define sqlite3_result_text16 0 -# define sqlite3_result_text16be 0 -# define sqlite3_result_text16le 0 -# define sqlite3_value_text16 0 -# define sqlite3_value_text16be 0 -# define sqlite3_value_text16le 0 -# define sqlite3_column_database_name16 0 -# define sqlite3_column_table_name16 0 -# define sqlite3_column_origin_name16 0 +# define tdsqlite3_bind_text16 0 +# define tdsqlite3_collation_needed16 0 +# define tdsqlite3_column_decltype16 0 +# define tdsqlite3_column_name16 0 +# define tdsqlite3_column_text16 0 +# define tdsqlite3_complete16 0 +# define tdsqlite3_create_collation16 0 +# define tdsqlite3_create_function16 0 +# define tdsqlite3_errmsg16 0 +# define tdsqlite3_open16 0 +# define tdsqlite3_prepare16 0 +# define tdsqlite3_prepare16_v2 0 +# define tdsqlite3_prepare16_v3 0 +# define tdsqlite3_result_error16 0 +# define tdsqlite3_result_text16 0 +# define tdsqlite3_result_text16be 0 +# define tdsqlite3_result_text16le 0 +# define tdsqlite3_value_text16 0 +# define tdsqlite3_value_text16be 0 +# define tdsqlite3_value_text16le 0 +# define tdsqlite3_column_database_name16 0 +# define tdsqlite3_column_table_name16 0 +# define tdsqlite3_column_origin_name16 0 #endif #ifdef SQLITE_OMIT_COMPLETE -# define sqlite3_complete 0 -# define sqlite3_complete16 0 +# define tdsqlite3_complete 0 +# define tdsqlite3_complete16 0 #endif #ifdef SQLITE_OMIT_DECLTYPE -# define sqlite3_column_decltype16 0 -# define sqlite3_column_decltype 0 +# define tdsqlite3_column_decltype16 0 +# define tdsqlite3_column_decltype 0 #endif #ifdef SQLITE_OMIT_PROGRESS_CALLBACK -# define sqlite3_progress_handler 0 +# define tdsqlite3_progress_handler 0 #endif #ifdef SQLITE_OMIT_VIRTUALTABLE -# define sqlite3_create_module 0 -# define sqlite3_create_module_v2 0 -# define sqlite3_declare_vtab 0 -# define sqlite3_vtab_config 0 -# define sqlite3_vtab_on_conflict 0 -# define sqlite3_vtab_collation 0 +# define tdsqlite3_create_module 0 +# define tdsqlite3_create_module_v2 0 +# define tdsqlite3_declare_vtab 0 +# define tdsqlite3_vtab_config 0 +# define tdsqlite3_vtab_on_conflict 0 +# define tdsqlite3_vtab_collation 0 #endif #ifdef SQLITE_OMIT_SHARED_CACHE -# define sqlite3_enable_shared_cache 0 +# define tdsqlite3_enable_shared_cache 0 #endif #if defined(SQLITE_OMIT_TRACE) || defined(SQLITE_OMIT_DEPRECATED) -# define sqlite3_profile 0 -# define sqlite3_trace 0 +# define tdsqlite3_profile 0 +# define tdsqlite3_trace 0 #endif #ifdef SQLITE_OMIT_GET_TABLE -# define sqlite3_free_table 0 -# define sqlite3_get_table 0 +# define tdsqlite3_free_table 0 +# define tdsqlite3_get_table 0 #endif #ifdef SQLITE_OMIT_INCRBLOB -#define sqlite3_bind_zeroblob 0 -#define sqlite3_blob_bytes 0 -#define sqlite3_blob_close 0 -#define sqlite3_blob_open 0 -#define sqlite3_blob_read 0 -#define sqlite3_blob_write 0 -#define sqlite3_blob_reopen 0 +#define tdsqlite3_bind_zeroblob 0 +#define tdsqlite3_blob_bytes 0 +#define tdsqlite3_blob_close 0 +#define tdsqlite3_blob_open 0 +#define tdsqlite3_blob_read 0 +#define tdsqlite3_blob_write 0 +#define tdsqlite3_blob_reopen 0 #endif #if defined(SQLITE_OMIT_TRACE) -# define sqlite3_trace_v2 0 +# define tdsqlite3_trace_v2 0 #endif /* @@ -127375,178 +127375,178 @@ typedef int (*sqlite3_loadext_entry)( ** in order to preserve backwards compatibility. ** ** Extensions that use newer APIs should first call the -** sqlite3_libversion_number() to make sure that the API they +** tdsqlite3_libversion_number() to make sure that the API they ** intend to use is supported by the library. Extensions should ** also check to make sure that the pointer to the function is ** not NULL before calling it. */ -static const sqlite3_api_routines sqlite3Apis = { - sqlite3_aggregate_context, +static const tdsqlite3_api_routines tdsqlite3Apis = { + tdsqlite3_aggregate_context, #ifndef SQLITE_OMIT_DEPRECATED - sqlite3_aggregate_count, + tdsqlite3_aggregate_count, #else 0, #endif - sqlite3_bind_blob, - sqlite3_bind_double, - sqlite3_bind_int, - sqlite3_bind_int64, - sqlite3_bind_null, - sqlite3_bind_parameter_count, - sqlite3_bind_parameter_index, - sqlite3_bind_parameter_name, - sqlite3_bind_text, - sqlite3_bind_text16, - sqlite3_bind_value, - sqlite3_busy_handler, - sqlite3_busy_timeout, - sqlite3_changes, - sqlite3_close, - sqlite3_collation_needed, - sqlite3_collation_needed16, - sqlite3_column_blob, - sqlite3_column_bytes, - sqlite3_column_bytes16, - sqlite3_column_count, - sqlite3_column_database_name, - sqlite3_column_database_name16, - sqlite3_column_decltype, - sqlite3_column_decltype16, - sqlite3_column_double, - sqlite3_column_int, - sqlite3_column_int64, - sqlite3_column_name, - sqlite3_column_name16, - sqlite3_column_origin_name, - sqlite3_column_origin_name16, - sqlite3_column_table_name, - sqlite3_column_table_name16, - sqlite3_column_text, - sqlite3_column_text16, - sqlite3_column_type, - sqlite3_column_value, - sqlite3_commit_hook, - sqlite3_complete, - sqlite3_complete16, - sqlite3_create_collation, - sqlite3_create_collation16, - sqlite3_create_function, - sqlite3_create_function16, - sqlite3_create_module, - sqlite3_data_count, - sqlite3_db_handle, - sqlite3_declare_vtab, - sqlite3_enable_shared_cache, - sqlite3_errcode, - sqlite3_errmsg, - sqlite3_errmsg16, - sqlite3_exec, + tdsqlite3_bind_blob, + tdsqlite3_bind_double, + tdsqlite3_bind_int, + tdsqlite3_bind_int64, + tdsqlite3_bind_null, + tdsqlite3_bind_parameter_count, + tdsqlite3_bind_parameter_index, + tdsqlite3_bind_parameter_name, + tdsqlite3_bind_text, + tdsqlite3_bind_text16, + tdsqlite3_bind_value, + tdsqlite3_busy_handler, + tdsqlite3_busy_timeout, + tdsqlite3_changes, + tdsqlite3_close, + tdsqlite3_collation_needed, + tdsqlite3_collation_needed16, + tdsqlite3_column_blob, + tdsqlite3_column_bytes, + tdsqlite3_column_bytes16, + tdsqlite3_column_count, + tdsqlite3_column_database_name, + tdsqlite3_column_database_name16, + tdsqlite3_column_decltype, + tdsqlite3_column_decltype16, + tdsqlite3_column_double, + tdsqlite3_column_int, + tdsqlite3_column_int64, + tdsqlite3_column_name, + tdsqlite3_column_name16, + tdsqlite3_column_origin_name, + tdsqlite3_column_origin_name16, + tdsqlite3_column_table_name, + tdsqlite3_column_table_name16, + tdsqlite3_column_text, + tdsqlite3_column_text16, + tdsqlite3_column_type, + tdsqlite3_column_value, + tdsqlite3_commit_hook, + tdsqlite3_complete, + tdsqlite3_complete16, + tdsqlite3_create_collation, + tdsqlite3_create_collation16, + tdsqlite3_create_function, + tdsqlite3_create_function16, + tdsqlite3_create_module, + tdsqlite3_data_count, + tdsqlite3_db_handle, + tdsqlite3_declare_vtab, + tdsqlite3_enable_shared_cache, + tdsqlite3_errcode, + tdsqlite3_errmsg, + tdsqlite3_errmsg16, + tdsqlite3_exec, #ifndef SQLITE_OMIT_DEPRECATED - sqlite3_expired, + tdsqlite3_expired, #else 0, #endif - sqlite3_finalize, - sqlite3_free, - sqlite3_free_table, - sqlite3_get_autocommit, - sqlite3_get_auxdata, - sqlite3_get_table, - 0, /* Was sqlite3_global_recover(), but that function is deprecated */ - sqlite3_interrupt, - sqlite3_last_insert_rowid, - sqlite3_libversion, - sqlite3_libversion_number, - sqlite3_malloc, - sqlite3_mprintf, - sqlite3_open, - sqlite3_open16, - sqlite3_prepare, - sqlite3_prepare16, - sqlite3_profile, - sqlite3_progress_handler, - sqlite3_realloc, - sqlite3_reset, - sqlite3_result_blob, - sqlite3_result_double, - sqlite3_result_error, - sqlite3_result_error16, - sqlite3_result_int, - sqlite3_result_int64, - sqlite3_result_null, - sqlite3_result_text, - sqlite3_result_text16, - sqlite3_result_text16be, - sqlite3_result_text16le, - sqlite3_result_value, - sqlite3_rollback_hook, - sqlite3_set_authorizer, - sqlite3_set_auxdata, - sqlite3_snprintf, - sqlite3_step, - sqlite3_table_column_metadata, + tdsqlite3_finalize, + tdsqlite3_free, + tdsqlite3_free_table, + tdsqlite3_get_autocommit, + tdsqlite3_get_auxdata, + tdsqlite3_get_table, + 0, /* Was tdsqlite3_global_recover(), but that function is deprecated */ + tdsqlite3_interrupt, + tdsqlite3_last_insert_rowid, + tdsqlite3_libversion, + tdsqlite3_libversion_number, + tdsqlite3_malloc, + tdsqlite3_mprintf, + tdsqlite3_open, + tdsqlite3_open16, + tdsqlite3_prepare, + tdsqlite3_prepare16, + tdsqlite3_profile, + tdsqlite3_progress_handler, + tdsqlite3_realloc, + tdsqlite3_reset, + tdsqlite3_result_blob, + tdsqlite3_result_double, + tdsqlite3_result_error, + tdsqlite3_result_error16, + tdsqlite3_result_int, + tdsqlite3_result_int64, + tdsqlite3_result_null, + tdsqlite3_result_text, + tdsqlite3_result_text16, + tdsqlite3_result_text16be, + tdsqlite3_result_text16le, + tdsqlite3_result_value, + tdsqlite3_rollback_hook, + tdsqlite3_set_authorizer, + tdsqlite3_set_auxdata, + tdsqlite3_snprintf, + tdsqlite3_step, + tdsqlite3_table_column_metadata, #ifndef SQLITE_OMIT_DEPRECATED - sqlite3_thread_cleanup, + tdsqlite3_thread_cleanup, #else 0, #endif - sqlite3_total_changes, - sqlite3_trace, + tdsqlite3_total_changes, + tdsqlite3_trace, #ifndef SQLITE_OMIT_DEPRECATED - sqlite3_transfer_bindings, + tdsqlite3_transfer_bindings, #else 0, #endif - sqlite3_update_hook, - sqlite3_user_data, - sqlite3_value_blob, - sqlite3_value_bytes, - sqlite3_value_bytes16, - sqlite3_value_double, - sqlite3_value_int, - sqlite3_value_int64, - sqlite3_value_numeric_type, - sqlite3_value_text, - sqlite3_value_text16, - sqlite3_value_text16be, - sqlite3_value_text16le, - sqlite3_value_type, - sqlite3_vmprintf, + tdsqlite3_update_hook, + tdsqlite3_user_data, + tdsqlite3_value_blob, + tdsqlite3_value_bytes, + tdsqlite3_value_bytes16, + tdsqlite3_value_double, + tdsqlite3_value_int, + tdsqlite3_value_int64, + tdsqlite3_value_numeric_type, + tdsqlite3_value_text, + tdsqlite3_value_text16, + tdsqlite3_value_text16be, + tdsqlite3_value_text16le, + tdsqlite3_value_type, + tdsqlite3_vmprintf, /* ** The original API set ends here. All extensions can call any ** of the APIs above provided that the pointer is not NULL. But ** before calling APIs that follow, extension should check the - ** sqlite3_libversion_number() to make sure they are dealing with + ** tdsqlite3_libversion_number() to make sure they are dealing with ** a library that is new enough to support that API. ************************************************************************* */ - sqlite3_overload_function, + tdsqlite3_overload_function, /* ** Added after 3.3.13 */ - sqlite3_prepare_v2, - sqlite3_prepare16_v2, - sqlite3_clear_bindings, + tdsqlite3_prepare_v2, + tdsqlite3_prepare16_v2, + tdsqlite3_clear_bindings, /* ** Added for 3.4.1 */ - sqlite3_create_module_v2, + tdsqlite3_create_module_v2, /* ** Added for 3.5.0 */ - sqlite3_bind_zeroblob, - sqlite3_blob_bytes, - sqlite3_blob_close, - sqlite3_blob_open, - sqlite3_blob_read, - sqlite3_blob_write, - sqlite3_create_collation_v2, - sqlite3_file_control, - sqlite3_memory_highwater, - sqlite3_memory_used, + tdsqlite3_bind_zeroblob, + tdsqlite3_blob_bytes, + tdsqlite3_blob_close, + tdsqlite3_blob_open, + tdsqlite3_blob_read, + tdsqlite3_blob_write, + tdsqlite3_create_collation_v2, + tdsqlite3_file_control, + tdsqlite3_memory_highwater, + tdsqlite3_memory_used, #ifdef SQLITE_MUTEX_OMIT 0, 0, @@ -127554,204 +127554,204 @@ static const sqlite3_api_routines sqlite3Apis = { 0, 0, #else - sqlite3_mutex_alloc, - sqlite3_mutex_enter, - sqlite3_mutex_free, - sqlite3_mutex_leave, - sqlite3_mutex_try, + tdsqlite3_mutex_alloc, + tdsqlite3_mutex_enter, + tdsqlite3_mutex_free, + tdsqlite3_mutex_leave, + tdsqlite3_mutex_try, #endif - sqlite3_open_v2, - sqlite3_release_memory, - sqlite3_result_error_nomem, - sqlite3_result_error_toobig, - sqlite3_sleep, - sqlite3_soft_heap_limit, - sqlite3_vfs_find, - sqlite3_vfs_register, - sqlite3_vfs_unregister, + tdsqlite3_open_v2, + tdsqlite3_release_memory, + tdsqlite3_result_error_nomem, + tdsqlite3_result_error_toobig, + tdsqlite3_sleep, + tdsqlite3_soft_heap_limit, + tdsqlite3_vfs_find, + tdsqlite3_vfs_register, + tdsqlite3_vfs_unregister, /* ** Added for 3.5.8 */ - sqlite3_threadsafe, - sqlite3_result_zeroblob, - sqlite3_result_error_code, - sqlite3_test_control, - sqlite3_randomness, - sqlite3_context_db_handle, + tdsqlite3_threadsafe, + tdsqlite3_result_zeroblob, + tdsqlite3_result_error_code, + tdsqlite3_test_control, + tdsqlite3_randomness, + tdsqlite3_context_db_handle, /* ** Added for 3.6.0 */ - sqlite3_extended_result_codes, - sqlite3_limit, - sqlite3_next_stmt, - sqlite3_sql, - sqlite3_status, + tdsqlite3_extended_result_codes, + tdsqlite3_limit, + tdsqlite3_next_stmt, + tdsqlite3_sql, + tdsqlite3_status, /* ** Added for 3.7.4 */ - sqlite3_backup_finish, - sqlite3_backup_init, - sqlite3_backup_pagecount, - sqlite3_backup_remaining, - sqlite3_backup_step, + tdsqlite3_backup_finish, + tdsqlite3_backup_init, + tdsqlite3_backup_pagecount, + tdsqlite3_backup_remaining, + tdsqlite3_backup_step, #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS - sqlite3_compileoption_get, - sqlite3_compileoption_used, + tdsqlite3_compileoption_get, + tdsqlite3_compileoption_used, #else 0, 0, #endif - sqlite3_create_function_v2, - sqlite3_db_config, - sqlite3_db_mutex, - sqlite3_db_status, - sqlite3_extended_errcode, - sqlite3_log, - sqlite3_soft_heap_limit64, - sqlite3_sourceid, - sqlite3_stmt_status, - sqlite3_strnicmp, + tdsqlite3_create_function_v2, + tdsqlite3_db_config, + tdsqlite3_db_mutex, + tdsqlite3_db_status, + tdsqlite3_extended_errcode, + tdsqlite3_log, + tdsqlite3_soft_heap_limit64, + tdsqlite3_sourceid, + tdsqlite3_stmt_status, + tdsqlite3_strnicmp, #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY - sqlite3_unlock_notify, + tdsqlite3_unlock_notify, #else 0, #endif #ifndef SQLITE_OMIT_WAL - sqlite3_wal_autocheckpoint, - sqlite3_wal_checkpoint, - sqlite3_wal_hook, + tdsqlite3_wal_autocheckpoint, + tdsqlite3_wal_checkpoint, + tdsqlite3_wal_hook, #else 0, 0, 0, #endif - sqlite3_blob_reopen, - sqlite3_vtab_config, - sqlite3_vtab_on_conflict, - sqlite3_close_v2, - sqlite3_db_filename, - sqlite3_db_readonly, - sqlite3_db_release_memory, - sqlite3_errstr, - sqlite3_stmt_busy, - sqlite3_stmt_readonly, - sqlite3_stricmp, - sqlite3_uri_boolean, - sqlite3_uri_int64, - sqlite3_uri_parameter, - sqlite3_vsnprintf, - sqlite3_wal_checkpoint_v2, + tdsqlite3_blob_reopen, + tdsqlite3_vtab_config, + tdsqlite3_vtab_on_conflict, + tdsqlite3_close_v2, + tdsqlite3_db_filename, + tdsqlite3_db_readonly, + tdsqlite3_db_release_memory, + tdsqlite3_errstr, + tdsqlite3_stmt_busy, + tdsqlite3_stmt_readonly, + tdsqlite3_stricmp, + tdsqlite3_uri_boolean, + tdsqlite3_uri_int64, + tdsqlite3_uri_parameter, + tdsqlite3_vsnprintf, + tdsqlite3_wal_checkpoint_v2, /* Version 3.8.7 and later */ - sqlite3_auto_extension, - sqlite3_bind_blob64, - sqlite3_bind_text64, - sqlite3_cancel_auto_extension, - sqlite3_load_extension, - sqlite3_malloc64, - sqlite3_msize, - sqlite3_realloc64, - sqlite3_reset_auto_extension, - sqlite3_result_blob64, - sqlite3_result_text64, - sqlite3_strglob, + tdsqlite3_auto_extension, + tdsqlite3_bind_blob64, + tdsqlite3_bind_text64, + tdsqlite3_cancel_auto_extension, + tdsqlite3_load_extension, + tdsqlite3_malloc64, + tdsqlite3_msize, + tdsqlite3_realloc64, + tdsqlite3_reset_auto_extension, + tdsqlite3_result_blob64, + tdsqlite3_result_text64, + tdsqlite3_strglob, /* Version 3.8.11 and later */ - (sqlite3_value*(*)(const sqlite3_value*))sqlite3_value_dup, - sqlite3_value_free, - sqlite3_result_zeroblob64, - sqlite3_bind_zeroblob64, + (tdsqlite3_value*(*)(const tdsqlite3_value*))tdsqlite3_value_dup, + tdsqlite3_value_free, + tdsqlite3_result_zeroblob64, + tdsqlite3_bind_zeroblob64, /* Version 3.9.0 and later */ - sqlite3_value_subtype, - sqlite3_result_subtype, + tdsqlite3_value_subtype, + tdsqlite3_result_subtype, /* Version 3.10.0 and later */ - sqlite3_status64, - sqlite3_strlike, - sqlite3_db_cacheflush, + tdsqlite3_status64, + tdsqlite3_strlike, + tdsqlite3_db_cacheflush, /* Version 3.12.0 and later */ - sqlite3_system_errno, + tdsqlite3_system_errno, /* Version 3.14.0 and later */ - sqlite3_trace_v2, - sqlite3_expanded_sql, + tdsqlite3_trace_v2, + tdsqlite3_expanded_sql, /* Version 3.18.0 and later */ - sqlite3_set_last_insert_rowid, + tdsqlite3_set_last_insert_rowid, /* Version 3.20.0 and later */ - sqlite3_prepare_v3, - sqlite3_prepare16_v3, - sqlite3_bind_pointer, - sqlite3_result_pointer, - sqlite3_value_pointer, + tdsqlite3_prepare_v3, + tdsqlite3_prepare16_v3, + tdsqlite3_bind_pointer, + tdsqlite3_result_pointer, + tdsqlite3_value_pointer, /* Version 3.22.0 and later */ - sqlite3_vtab_nochange, - sqlite3_value_nochange, - sqlite3_vtab_collation, + tdsqlite3_vtab_nochange, + tdsqlite3_value_nochange, + tdsqlite3_vtab_collation, /* Version 3.24.0 and later */ - sqlite3_keyword_count, - sqlite3_keyword_name, - sqlite3_keyword_check, - sqlite3_str_new, - sqlite3_str_finish, - sqlite3_str_appendf, - sqlite3_str_vappendf, - sqlite3_str_append, - sqlite3_str_appendall, - sqlite3_str_appendchar, - sqlite3_str_reset, - sqlite3_str_errcode, - sqlite3_str_length, - sqlite3_str_value, + tdsqlite3_keyword_count, + tdsqlite3_keyword_name, + tdsqlite3_keyword_check, + tdsqlite3_str_new, + tdsqlite3_str_finish, + tdsqlite3_str_appendf, + tdsqlite3_str_vappendf, + tdsqlite3_str_append, + tdsqlite3_str_appendall, + tdsqlite3_str_appendchar, + tdsqlite3_str_reset, + tdsqlite3_str_errcode, + tdsqlite3_str_length, + tdsqlite3_str_value, /* Version 3.25.0 and later */ - sqlite3_create_window_function, + tdsqlite3_create_window_function, /* Version 3.26.0 and later */ #ifdef SQLITE_ENABLE_NORMALIZE - sqlite3_normalized_sql, + tdsqlite3_normalized_sql, #else 0, #endif /* Version 3.28.0 and later */ - sqlite3_stmt_isexplain, - sqlite3_value_frombind, + tdsqlite3_stmt_isexplain, + tdsqlite3_value_frombind, /* Version 3.30.0 and later */ #ifndef SQLITE_OMIT_VIRTUALTABLE - sqlite3_drop_modules, + tdsqlite3_drop_modules, #else 0, #endif /* Version 3.31.0 and later */ - sqlite3_hard_heap_limit64, - sqlite3_uri_key, - sqlite3_filename_database, - sqlite3_filename_journal, - sqlite3_filename_wal, + tdsqlite3_hard_heap_limit64, + tdsqlite3_uri_key, + tdsqlite3_filename_database, + tdsqlite3_filename_journal, + tdsqlite3_filename_wal, }; /* ** Attempt to load an SQLite extension library contained in the file ** zFile. The entry point is zProc. zProc may be 0 in which case a -** default entry point name (sqlite3_extension_init) is used. Use +** default entry point name (tdsqlite3_extension_init) is used. Use ** of the default name is recommended. ** ** Return SQLITE_OK on success and SQLITE_ERROR if something goes wrong. ** ** If an error occurs and pzErrMsg is not 0, then fill *pzErrMsg with ** error message text. The calling function should free this memory -** by calling sqlite3DbFree(db, ). +** by calling tdsqlite3DbFree(db, ). */ -static int sqlite3LoadExtension( - sqlite3 *db, /* Load the extension into this database connection */ +static int tdsqlite3LoadExtension( + tdsqlite3 *db, /* Load the extension into this database connection */ const char *zFile, /* Name of the shared library containing extension */ - const char *zProc, /* Entry point. Use "sqlite3_extension_init" if 0 */ + const char *zProc, /* Entry point. Use "tdsqlite3_extension_init" if 0 */ char **pzErrMsg /* Put error message here if not 0 */ ){ - sqlite3_vfs *pVfs = db->pVfs; + tdsqlite3_vfs *pVfs = db->pVfs; void *handle; - sqlite3_loadext_entry xInit; + tdsqlite3_loadext_entry xInit; char *zErrmsg = 0; const char *zEntry; char *zAltEntry = 0; void **aHandle; - u64 nMsg = 300 + sqlite3Strlen30(zFile); + u64 nMsg = 300 + tdsqlite3Strlen30(zFile); int ii; int rc; @@ -127772,124 +127772,124 @@ static int sqlite3LoadExtension( /* Ticket #1863. To avoid a creating security problems for older ** applications that relink against newer versions of SQLite, the ** ability to run load_extension is turned off by default. One - ** must call either sqlite3_enable_load_extension(db) or - ** sqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, 0) + ** must call either tdsqlite3_enable_load_extension(db) or + ** tdsqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, 0) ** to turn on extension loading. */ if( (db->flags & SQLITE_LoadExtension)==0 ){ if( pzErrMsg ){ - *pzErrMsg = sqlite3_mprintf("not authorized"); + *pzErrMsg = tdsqlite3_mprintf("not authorized"); } return SQLITE_ERROR; } - zEntry = zProc ? zProc : "sqlite3_extension_init"; + zEntry = zProc ? zProc : "tdsqlite3_extension_init"; - handle = sqlite3OsDlOpen(pVfs, zFile); + handle = tdsqlite3OsDlOpen(pVfs, zFile); #if SQLITE_OS_UNIX || SQLITE_OS_WIN for(ii=0; ii sqlite3_example_init - ** C:/lib/mathfuncs.dll ==> sqlite3_mathfuncs_init + ** /usr/local/lib/libExample5.4.3.so ==> tdsqlite3_example_init + ** C:/lib/mathfuncs.dll ==> tdsqlite3_mathfuncs_init */ if( xInit==0 && zProc==0 ){ int iFile, iEntry, c; - int ncFile = sqlite3Strlen30(zFile); - zAltEntry = sqlite3_malloc64(ncFile+30); + int ncFile = tdsqlite3Strlen30(zFile); + zAltEntry = tdsqlite3_malloc64(ncFile+30); if( zAltEntry==0 ){ - sqlite3OsDlClose(pVfs, handle); + tdsqlite3OsDlClose(pVfs, handle); return SQLITE_NOMEM_BKPT; } - memcpy(zAltEntry, "sqlite3_", 8); + memcpy(zAltEntry, "tdsqlite3_", 8); for(iFile=ncFile-1; iFile>=0 && zFile[iFile]!='/'; iFile--){} iFile++; - if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3; + if( tdsqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3; for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){ - if( sqlite3Isalpha(c) ){ - zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c]; + if( tdsqlite3Isalpha(c) ){ + zAltEntry[iEntry++] = (char)tdsqlite3UpperToLower[(unsigned)c]; } } memcpy(zAltEntry+iEntry, "_init", 6); zEntry = zAltEntry; - xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry); + xInit = (tdsqlite3_loadext_entry)tdsqlite3OsDlSym(pVfs, handle, zEntry); } if( xInit==0 ){ if( pzErrMsg ){ - nMsg += sqlite3Strlen30(zEntry); - *pzErrMsg = zErrmsg = sqlite3_malloc64(nMsg); + nMsg += tdsqlite3Strlen30(zEntry); + *pzErrMsg = zErrmsg = tdsqlite3_malloc64(nMsg); if( zErrmsg ){ - sqlite3_snprintf(nMsg, zErrmsg, + tdsqlite3_snprintf(nMsg, zErrmsg, "no entry point [%s] in shared library [%s]", zEntry, zFile); - sqlite3OsDlError(pVfs, nMsg-1, zErrmsg); + tdsqlite3OsDlError(pVfs, nMsg-1, zErrmsg); } } - sqlite3OsDlClose(pVfs, handle); - sqlite3_free(zAltEntry); + tdsqlite3OsDlClose(pVfs, handle); + tdsqlite3_free(zAltEntry); return SQLITE_ERROR; } - sqlite3_free(zAltEntry); - rc = xInit(db, &zErrmsg, &sqlite3Apis); + tdsqlite3_free(zAltEntry); + rc = xInit(db, &zErrmsg, &tdsqlite3Apis); if( rc ){ if( rc==SQLITE_OK_LOAD_PERMANENTLY ) return SQLITE_OK; if( pzErrMsg ){ - *pzErrMsg = sqlite3_mprintf("error during initialization: %s", zErrmsg); + *pzErrMsg = tdsqlite3_mprintf("error during initialization: %s", zErrmsg); } - sqlite3_free(zErrmsg); - sqlite3OsDlClose(pVfs, handle); + tdsqlite3_free(zErrmsg); + tdsqlite3OsDlClose(pVfs, handle); return SQLITE_ERROR; } /* Append the new shared library handle to the db->aExtension array. */ - aHandle = sqlite3DbMallocZero(db, sizeof(handle)*(db->nExtension+1)); + aHandle = tdsqlite3DbMallocZero(db, sizeof(handle)*(db->nExtension+1)); if( aHandle==0 ){ return SQLITE_NOMEM_BKPT; } if( db->nExtension>0 ){ memcpy(aHandle, db->aExtension, sizeof(handle)*db->nExtension); } - sqlite3DbFree(db, db->aExtension); + tdsqlite3DbFree(db, db->aExtension); db->aExtension = aHandle; db->aExtension[db->nExtension++] = handle; return SQLITE_OK; } -SQLITE_API int sqlite3_load_extension( - sqlite3 *db, /* Load the extension into this database connection */ +SQLITE_API int tdsqlite3_load_extension( + tdsqlite3 *db, /* Load the extension into this database connection */ const char *zFile, /* Name of the shared library containing extension */ - const char *zProc, /* Entry point. Use "sqlite3_extension_init" if 0 */ + const char *zProc, /* Entry point. Use "tdsqlite3_extension_init" if 0 */ char **pzErrMsg /* Put error message here if not 0 */ ){ int rc; - sqlite3_mutex_enter(db->mutex); - rc = sqlite3LoadExtension(db, zFile, zProc, pzErrMsg); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_enter(db->mutex); + rc = tdsqlite3LoadExtension(db, zFile, zProc, pzErrMsg); + rc = tdsqlite3ApiExit(db, rc); + tdsqlite3_mutex_leave(db->mutex); return rc; } @@ -127897,27 +127897,27 @@ SQLITE_API int sqlite3_load_extension( ** Call this routine when the database connection is closing in order ** to clean up loaded extensions */ -SQLITE_PRIVATE void sqlite3CloseExtensions(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3CloseExtensions(tdsqlite3 *db){ int i; - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); for(i=0; inExtension; i++){ - sqlite3OsDlClose(db->pVfs, db->aExtension[i]); + tdsqlite3OsDlClose(db->pVfs, db->aExtension[i]); } - sqlite3DbFree(db, db->aExtension); + tdsqlite3DbFree(db, db->aExtension); } /* ** Enable or disable extension loading. Extension loading is disabled by ** default so as not to open security holes in older applications. */ -SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff){ - sqlite3_mutex_enter(db->mutex); +SQLITE_API int tdsqlite3_enable_load_extension(tdsqlite3 *db, int onoff){ + tdsqlite3_mutex_enter(db->mutex); if( onoff ){ db->flags |= SQLITE_LoadExtension|SQLITE_LoadExtFunc; }else{ db->flags &= ~(u64)(SQLITE_LoadExtension|SQLITE_LoadExtFunc); } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return SQLITE_OK; } @@ -127930,25 +127930,25 @@ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff){ ** This list is shared across threads. The SQLITE_MUTEX_STATIC_MASTER ** mutex must be held while accessing this list. */ -typedef struct sqlite3AutoExtList sqlite3AutoExtList; -static SQLITE_WSD struct sqlite3AutoExtList { +typedef struct tdsqlite3AutoExtList tdsqlite3AutoExtList; +static SQLITE_WSD struct tdsqlite3AutoExtList { u32 nExt; /* Number of entries in aExt[] */ void (**aExt)(void); /* Pointers to the extension init functions */ -} sqlite3Autoext = { 0, 0 }; +} tdsqlite3Autoext = { 0, 0 }; /* The "wsdAutoext" macro will resolve to the autoextension ** state vector. If writable static data is unsupported on the target, ** we have to locate the state vector at run-time. In the more common ** case where writable static data is supported, wsdStat can refer directly -** to the "sqlite3Autoext" state vector declared above. +** to the "tdsqlite3Autoext" state vector declared above. */ #ifdef SQLITE_OMIT_WSD # define wsdAutoextInit \ - sqlite3AutoExtList *x = &GLOBAL(sqlite3AutoExtList,sqlite3Autoext) + tdsqlite3AutoExtList *x = &GLOBAL(tdsqlite3AutoExtList,tdsqlite3Autoext) # define wsdAutoext x[0] #else # define wsdAutoextInit -# define wsdAutoext sqlite3Autoext +# define wsdAutoext tdsqlite3Autoext #endif @@ -127956,12 +127956,12 @@ static SQLITE_WSD struct sqlite3AutoExtList { ** Register a statically linked extension that is automatically ** loaded by every new database connection. */ -SQLITE_API int sqlite3_auto_extension( +SQLITE_API int tdsqlite3_auto_extension( void (*xInit)(void) ){ int rc = SQLITE_OK; #ifndef SQLITE_OMIT_AUTOINIT - rc = sqlite3_initialize(); + rc = tdsqlite3_initialize(); if( rc ){ return rc; }else @@ -127969,17 +127969,17 @@ SQLITE_API int sqlite3_auto_extension( { u32 i; #if SQLITE_THREADSAFE - sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); + tdsqlite3_mutex *mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); #endif wsdAutoextInit; - sqlite3_mutex_enter(mutex); + tdsqlite3_mutex_enter(mutex); for(i=0; i=0; i--){ if( wsdAutoext.aExt[i]==xInit ){ wsdAutoext.nExt--; @@ -128021,27 +128021,27 @@ SQLITE_API int sqlite3_cancel_auto_extension( break; } } - sqlite3_mutex_leave(mutex); + tdsqlite3_mutex_leave(mutex); return n; } /* ** Reset the automatic extension loading mechanism. */ -SQLITE_API void sqlite3_reset_auto_extension(void){ +SQLITE_API void tdsqlite3_reset_auto_extension(void){ #ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize()==SQLITE_OK ) + if( tdsqlite3_initialize()==SQLITE_OK ) #endif { #if SQLITE_THREADSAFE - sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); + tdsqlite3_mutex *mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); #endif wsdAutoextInit; - sqlite3_mutex_enter(mutex); - sqlite3_free(wsdAutoext.aExt); + tdsqlite3_mutex_enter(mutex); + tdsqlite3_free(wsdAutoext.aExt); wsdAutoext.aExt = 0; wsdAutoext.nExt = 0; - sqlite3_mutex_leave(mutex); + tdsqlite3_mutex_leave(mutex); } } @@ -128050,11 +128050,11 @@ SQLITE_API void sqlite3_reset_auto_extension(void){ ** ** If anything goes wrong, set an error in the database connection. */ -SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3AutoLoadExtensions(tdsqlite3 *db){ u32 i; int go = 1; int rc; - sqlite3_loadext_entry xInit; + tdsqlite3_loadext_entry xInit; wsdAutoextInit; if( wsdAutoext.nExt==0 ){ @@ -128064,28 +128064,28 @@ SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3 *db){ for(i=0; go; i++){ char *zErrmsg; #if SQLITE_THREADSAFE - sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); + tdsqlite3_mutex *mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); #endif #ifdef SQLITE_OMIT_LOAD_EXTENSION - const sqlite3_api_routines *pThunk = 0; + const tdsqlite3_api_routines *pThunk = 0; #else - const sqlite3_api_routines *pThunk = &sqlite3Apis; + const tdsqlite3_api_routines *pThunk = &tdsqlite3Apis; #endif - sqlite3_mutex_enter(mutex); + tdsqlite3_mutex_enter(mutex); if( i>=wsdAutoext.nExt ){ xInit = 0; go = 0; }else{ - xInit = (sqlite3_loadext_entry)wsdAutoext.aExt[i]; + xInit = (tdsqlite3_loadext_entry)wsdAutoext.aExt[i]; } - sqlite3_mutex_leave(mutex); + tdsqlite3_mutex_leave(mutex); zErrmsg = 0; if( xInit && (rc = xInit(db, &zErrmsg, pThunk))!=0 ){ - sqlite3ErrorWithMsg(db, rc, + tdsqlite3ErrorWithMsg(db, rc, "automatic extension loading failed: %s", zErrmsg); go = 0; } - sqlite3_free(zErrmsg); + tdsqlite3_free(zErrmsg); } } @@ -128817,7 +128817,7 @@ static const PragmaName aPragmaName[] = { ** if the omitFull parameter it 1. ** ** Note that the values returned are one less that the values that -** should be passed into sqlite3BtreeSetSafetyLevel(). The is done +** should be passed into tdsqlite3BtreeSetSafetyLevel(). The is done ** to support legacy SQL code. The safety level used to be boolean ** and older scripts may have used numbers 0 for OFF and 1 for ON. */ @@ -128829,12 +128829,12 @@ static u8 getSafetyLevel(const char *z, int omitFull, u8 dflt){ static const u8 iValue[] = {1, 0, 0, 0, 1, 1, 3, 2}; /* on no off false yes true extra full */ int i, n; - if( sqlite3Isdigit(*z) ){ - return (u8)sqlite3Atoi(z); + if( tdsqlite3Isdigit(*z) ){ + return (u8)tdsqlite3Atoi(z); } - n = sqlite3Strlen30(z); + n = tdsqlite3Strlen30(z); for(i=0; i=0&&i<=2)?i:0); } #endif /* ifndef SQLITE_OMIT_AUTOVACUUM */ @@ -128893,9 +128893,9 @@ static int getAutoVacuum(const char *z){ static int getTempStore(const char *z){ if( z[0]>='0' && z[0]<='2' ){ return z[0] - '0'; - }else if( sqlite3StrICmp(z, "file")==0 ){ + }else if( tdsqlite3StrICmp(z, "file")==0 ){ return 1; - }else if( sqlite3StrICmp(z, "memory")==0 ){ + }else if( tdsqlite3StrICmp(z, "memory")==0 ){ return 2; }else{ return 0; @@ -128909,16 +128909,16 @@ static int getTempStore(const char *z){ ** from default, or when 'file' and the temp_store_directory has changed */ static int invalidateTempStorage(Parse *pParse){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; if( db->aDb[1].pBt!=0 ){ - if( !db->autoCommit || sqlite3BtreeIsInReadTrans(db->aDb[1].pBt) ){ - sqlite3ErrorMsg(pParse, "temporary storage cannot be changed " + if( !db->autoCommit || tdsqlite3BtreeIsInReadTrans(db->aDb[1].pBt) ){ + tdsqlite3ErrorMsg(pParse, "temporary storage cannot be changed " "from within a transaction"); return SQLITE_ERROR; } - sqlite3BtreeClose(db->aDb[1].pBt); + tdsqlite3BtreeClose(db->aDb[1].pBt); db->aDb[1].pBt = 0; - sqlite3ResetAllSchemasOfConnection(db); + tdsqlite3ResetAllSchemasOfConnection(db); } return SQLITE_OK; } @@ -128932,7 +128932,7 @@ static int invalidateTempStorage(Parse *pParse){ */ static int changeTempStorage(Parse *pParse, const char *zStorageType){ int ts = getTempStore(zStorageType); - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; if( db->temp_store==ts ) return SQLITE_OK; if( invalidateTempStorage( pParse ) != SQLITE_OK ){ return SQLITE_ERROR; @@ -128950,13 +128950,13 @@ static void setPragmaResultColumnNames( const PragmaName *pPragma /* The pragma */ ){ u8 n = pPragma->nPragCName; - sqlite3VdbeSetNumCols(v, n==0 ? 1 : n); + tdsqlite3VdbeSetNumCols(v, n==0 ? 1 : n); if( n==0 ){ - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, pPragma->zName, SQLITE_STATIC); + tdsqlite3VdbeSetColName(v, 0, COLNAME_NAME, pPragma->zName, SQLITE_STATIC); }else{ int i, j; for(i=0, j=pPragma->iPragCName; iautoCommit ){ Db *pDb = db->aDb; int n = db->nDb; @@ -129000,7 +129000,7 @@ static void setAllPagerFlags(sqlite3 *db){ assert( (pDb->safety_level & PAGER_SYNCHRONOUS_MASK)==pDb->safety_level ); while( (n--) > 0 ){ if( pDb->pBt ){ - sqlite3BtreeSetPagerFlags(pDb->pBt, + tdsqlite3BtreeSetPagerFlags(pDb->pBt, pDb->safety_level | (db->flags & PAGER_FLAGS_MASK) ); } pDb++; @@ -129036,7 +129036,7 @@ static const char *actionName(u8 action){ ** defined in pager.h. This function returns the associated lowercase ** journal-mode name. */ -SQLITE_PRIVATE const char *sqlite3JournalModename(int eMode){ +SQLITE_PRIVATE const char *tdsqlite3JournalModename(int eMode){ static char * const azModeName[] = { "delete", "persist", "off", "truncate", "memory" #ifndef SQLITE_OMIT_WAL @@ -129064,7 +129064,7 @@ static const PragmaName *pragmaLocate(const char *zName){ upr = ArraySize(aPragmaName)-1; while( lwr<=upr ){ mid = (lwr+upr)/2; - rc = sqlite3_stricmp(zName, aPragmaName[mid].zName); + rc = tdsqlite3_stricmp(zName, aPragmaName[mid].zName); if( rc==0 ) break; if( rc<0 ){ upr = mid - 1; @@ -129114,7 +129114,7 @@ static void pragmaFunclistLine( }else{ zType = "s"; } - sqlite3VdbeMultiLoad(v, 1, "sissii", + tdsqlite3VdbeMultiLoad(v, 1, "sissii", p->zName, isBuiltin, zType, azEnc[p->funcFlags&SQLITE_FUNC_ENCMASK], p->nArg, @@ -129133,10 +129133,10 @@ static void pragmaFunclistLine( */ static int integrityCheckResultRow(Vdbe *v){ int addr; - sqlite3VdbeAddOp2(v, OP_ResultRow, 3, 1); - addr = sqlite3VdbeAddOp3(v, OP_IfPos, 1, sqlite3VdbeCurrentAddr(v)+2, 1); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 3, 1); + addr = tdsqlite3VdbeAddOp3(v, OP_IfPos, 1, tdsqlite3VdbeCurrentAddr(v)+2, 1); VdbeCoverage(v); - sqlite3VdbeAddOp0(v, OP_Halt); + tdsqlite3VdbeAddOp0(v, OP_Halt); return addr; } @@ -129155,7 +129155,7 @@ static int integrityCheckResultRow(Vdbe *v){ ** and pId2 is the id. If the left side is just "id" then pId1 is the ** id and pId2 is any empty string. */ -SQLITE_PRIVATE void sqlite3Pragma( +SQLITE_PRIVATE void tdsqlite3Pragma( Parse *pParse, Token *pId1, /* First part of [schema.]id field */ Token *pId2, /* Second part of [schema.]id field, or NULL */ @@ -129169,44 +129169,44 @@ SQLITE_PRIVATE void sqlite3Pragma( char *aFcntl[4]; /* Argument to SQLITE_FCNTL_PRAGMA */ int iDb; /* Database index for */ int rc; /* return value form SQLITE_FCNTL_PRAGMA */ - sqlite3 *db = pParse->db; /* The database connection */ + tdsqlite3 *db = pParse->db; /* The database connection */ Db *pDb; /* The specific database being pragmaed */ - Vdbe *v = sqlite3GetVdbe(pParse); /* Prepared statement */ + Vdbe *v = tdsqlite3GetVdbe(pParse); /* Prepared statement */ const PragmaName *pPragma; /* The pragma */ /* BEGIN SQLCIPHER */ #ifdef SQLITE_HAS_CODEC - extern int sqlcipher_codec_pragma(sqlite3*, int, Parse *, const char *, const char *); + extern int sqlcipher_codec_pragma(tdsqlite3*, int, Parse *, const char *, const char *); #endif /* END SQLCIPHER */ if( v==0 ) return; - sqlite3VdbeRunOnlyOnce(v); + tdsqlite3VdbeRunOnlyOnce(v); pParse->nMem = 2; /* Interpret the [schema.] part of the pragma statement. iDb is the ** index of the database this pragma is being applied to in db.aDb[]. */ - iDb = sqlite3TwoPartName(pParse, pId1, pId2, &pId); + iDb = tdsqlite3TwoPartName(pParse, pId1, pId2, &pId); if( iDb<0 ) return; pDb = &db->aDb[iDb]; /* If the temp database has been explicitly named as part of the ** pragma, make sure it is open. */ - if( iDb==1 && sqlite3OpenTempDatabase(pParse) ){ + if( iDb==1 && tdsqlite3OpenTempDatabase(pParse) ){ return; } - zLeft = sqlite3NameFromToken(db, pId); + zLeft = tdsqlite3NameFromToken(db, pId); if( !zLeft ) return; if( minusFlag ){ - zRight = sqlite3MPrintf(db, "-%T", pValue); + zRight = tdsqlite3MPrintf(db, "-%T", pValue); }else{ - zRight = sqlite3NameFromToken(db, pValue); + zRight = tdsqlite3NameFromToken(db, pValue); } assert( pId2 ); zDb = pId2->n>0 ? pDb->zDbSName : 0; - if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){ + if( tdsqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){ goto pragma_out; } @@ -129215,7 +129215,7 @@ SQLITE_PRIVATE void sqlite3Pragma( ** handled the pragma and generate a no-op prepared statement. ** ** IMPLEMENTATION-OF: R-12238-55120 Whenever a PRAGMA statement is parsed, - ** an SQLITE_FCNTL_PRAGMA file control is sent to the open sqlite3_file + ** an SQLITE_FCNTL_PRAGMA file control is sent to the open tdsqlite3_file ** object corresponding to the database file to which the pragma ** statement refers. ** @@ -129230,18 +129230,18 @@ SQLITE_PRIVATE void sqlite3Pragma( aFcntl[2] = zRight; aFcntl[3] = 0; db->busyHandler.nBusy = 0; - rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_PRAGMA, (void*)aFcntl); + rc = tdsqlite3_file_control(db, zDb, SQLITE_FCNTL_PRAGMA, (void*)aFcntl); if( rc==SQLITE_OK ){ - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, aFcntl[0], SQLITE_TRANSIENT); + tdsqlite3VdbeSetNumCols(v, 1); + tdsqlite3VdbeSetColName(v, 0, COLNAME_NAME, aFcntl[0], SQLITE_TRANSIENT); returnSingleText(v, aFcntl[0]); - sqlite3_free(aFcntl[0]); + tdsqlite3_free(aFcntl[0]); goto pragma_out; } if( rc!=SQLITE_NOTFOUND ){ if( aFcntl[0] ){ - sqlite3ErrorMsg(pParse, "%s", aFcntl[0]); - sqlite3_free(aFcntl[0]); + tdsqlite3ErrorMsg(pParse, "%s", aFcntl[0]); + tdsqlite3_free(aFcntl[0]); } pParse->nErr++; pParse->rc = rc; @@ -129264,7 +129264,7 @@ SQLITE_PRIVATE void sqlite3Pragma( /* Make sure the database schema is loaded if the pragma requires that */ if( (pPragma->mPragFlg & PragFlg_NeedSchema)!=0 ){ - if( sqlite3ReadSchema(pParse) ) goto pragma_out; + if( tdsqlite3ReadSchema(pParse) ) goto pragma_out; } /* Register the result column names for pragmas that return results */ @@ -129308,22 +129308,22 @@ SQLITE_PRIVATE void sqlite3Pragma( { OP_ResultRow, 1, 1, 0}, }; VdbeOp *aOp; - sqlite3VdbeUsesBtree(v, iDb); + tdsqlite3VdbeUsesBtree(v, iDb); if( !zRight ){ pParse->nMem += 2; - sqlite3VdbeVerifyNoMallocRequired(v, ArraySize(getCacheSize)); - aOp = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize, iLn); + tdsqlite3VdbeVerifyNoMallocRequired(v, ArraySize(getCacheSize)); + aOp = tdsqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize, iLn); if( ONLY_IF_REALLOC_STRESS(aOp==0) ) break; aOp[0].p1 = iDb; aOp[1].p1 = iDb; aOp[6].p1 = SQLITE_DEFAULT_CACHE_SIZE; }else{ - int size = sqlite3AbsInt32(sqlite3Atoi(zRight)); - sqlite3BeginWriteOperation(pParse, 0, iDb); - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_DEFAULT_CACHE_SIZE, size); - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + int size = tdsqlite3AbsInt32(tdsqlite3Atoi(zRight)); + tdsqlite3BeginWriteOperation(pParse, 0, iDb); + tdsqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_DEFAULT_CACHE_SIZE, size); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); pDb->pSchema->cache_size = size; - sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); + tdsqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); } break; } @@ -129343,15 +129343,15 @@ SQLITE_PRIVATE void sqlite3Pragma( Btree *pBt = pDb->pBt; assert( pBt!=0 ); if( !zRight ){ - int size = ALWAYS(pBt) ? sqlite3BtreeGetPageSize(pBt) : 0; + int size = ALWAYS(pBt) ? tdsqlite3BtreeGetPageSize(pBt) : 0; returnSingleInt(v, size); }else{ /* Malloc may fail when setting the page-size, as there is an internal - ** buffer that the pager module resizes using sqlite3_realloc(). + ** buffer that the pager module resizes using tdsqlite3_realloc(). */ - db->nextPagesize = sqlite3Atoi(zRight); - if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize,-1,0) ){ - sqlite3OomFault(db); + db->nextPagesize = tdsqlite3Atoi(zRight); + if( SQLITE_NOMEM==tdsqlite3BtreeSetPageSize(pBt, db->nextPagesize,-1,0) ){ + tdsqlite3OomFault(db); } } break; @@ -129370,19 +129370,19 @@ SQLITE_PRIVATE void sqlite3Pragma( int b = -1; assert( pBt!=0 ); if( zRight ){ - if( sqlite3_stricmp(zRight, "fast")==0 ){ + if( tdsqlite3_stricmp(zRight, "fast")==0 ){ b = 2; }else{ - b = sqlite3GetBoolean(zRight, 0); + b = tdsqlite3GetBoolean(zRight, 0); } } if( pId2->n==0 && b>=0 ){ int ii; for(ii=0; iinDb; ii++){ - sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b); + tdsqlite3BtreeSecureDelete(db->aDb[ii].pBt, b); } } - b = sqlite3BtreeSecureDelete(pBt, b); + b = tdsqlite3BtreeSecureDelete(pBt, b); returnSingleInt(v, b); break; } @@ -129398,7 +129398,7 @@ SQLITE_PRIVATE void sqlite3Pragma( ** ** The absolute value of N is used. This is undocumented and might ** change. The only purpose is to provide an easy way to test - ** the sqlite3AbsInt32() function. + ** the tdsqlite3AbsInt32() function. ** ** PRAGMA [schema.]page_count ** @@ -129406,15 +129406,15 @@ SQLITE_PRIVATE void sqlite3Pragma( */ case PragTyp_PAGE_COUNT: { int iReg; - sqlite3CodeVerifySchema(pParse, iDb); + tdsqlite3CodeVerifySchema(pParse, iDb); iReg = ++pParse->nMem; - if( sqlite3Tolower(zLeft[0])=='p' ){ - sqlite3VdbeAddOp2(v, OP_Pagecount, iDb, iReg); + if( tdsqlite3Tolower(zLeft[0])=='p' ){ + tdsqlite3VdbeAddOp2(v, OP_Pagecount, iDb, iReg); }else{ - sqlite3VdbeAddOp3(v, OP_MaxPgcnt, iDb, iReg, - sqlite3AbsInt32(sqlite3Atoi(zRight))); + tdsqlite3VdbeAddOp3(v, OP_MaxPgcnt, iDb, iReg, + tdsqlite3AbsInt32(tdsqlite3Atoi(zRight))); } - sqlite3VdbeAddOp2(v, OP_ResultRow, iReg, 1); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, iReg, 1); break; } @@ -129446,13 +129446,13 @@ SQLITE_PRIVATE void sqlite3Pragma( int ii; assert(pDb==&db->aDb[0]); for(ii=2; iinDb; ii++){ - pPager = sqlite3BtreePager(db->aDb[ii].pBt); - sqlite3PagerLockingMode(pPager, eMode); + pPager = tdsqlite3BtreePager(db->aDb[ii].pBt); + tdsqlite3PagerLockingMode(pPager, eMode); } db->dfltLockMode = (u8)eMode; } - pPager = sqlite3BtreePager(pDb->pBt); - eMode = sqlite3PagerLockingMode(pPager, eMode); + pPager = tdsqlite3BtreePager(pDb->pBt); + eMode = tdsqlite3PagerLockingMode(pPager, eMode); } assert( eMode==PAGER_LOCKINGMODE_NORMAL @@ -129479,9 +129479,9 @@ SQLITE_PRIVATE void sqlite3Pragma( eMode = PAGER_JOURNALMODE_QUERY; }else{ const char *zMode; - int n = sqlite3Strlen30(zRight); - for(eMode=0; (zMode = sqlite3JournalModename(eMode))!=0; eMode++){ - if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break; + int n = tdsqlite3Strlen30(zRight); + for(eMode=0; (zMode = tdsqlite3JournalModename(eMode))!=0; eMode++){ + if( tdsqlite3StrNICmp(zRight, zMode, n)==0 ) break; } if( !zMode ){ /* If the "=MODE" part does not match any known journal mode, @@ -129501,11 +129501,11 @@ SQLITE_PRIVATE void sqlite3Pragma( } for(ii=db->nDb-1; ii>=0; ii--){ if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){ - sqlite3VdbeUsesBtree(v, ii); - sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode); + tdsqlite3VdbeUsesBtree(v, ii); + tdsqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode); } } - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); break; } @@ -129516,13 +129516,13 @@ SQLITE_PRIVATE void sqlite3Pragma( ** Get or set the size limit on rollback journal files. */ case PragTyp_JOURNAL_SIZE_LIMIT: { - Pager *pPager = sqlite3BtreePager(pDb->pBt); + Pager *pPager = tdsqlite3BtreePager(pDb->pBt); i64 iLimit = -2; if( zRight ){ - sqlite3DecOrHexToI64(zRight, &iLimit); + tdsqlite3DecOrHexToI64(zRight, &iLimit); if( iLimit<-1 ) iLimit = -1; } - iLimit = sqlite3PagerJournalSizeLimit(pPager, iLimit); + iLimit = tdsqlite3PagerJournalSizeLimit(pPager, iLimit); returnSingleInt(v, iLimit); break; } @@ -129541,7 +129541,7 @@ SQLITE_PRIVATE void sqlite3Pragma( Btree *pBt = pDb->pBt; assert( pBt!=0 ); if( !zRight ){ - returnSingleInt(v, sqlite3BtreeGetAutoVacuum(pBt)); + returnSingleInt(v, tdsqlite3BtreeGetAutoVacuum(pBt)); }else{ int eAuto = getAutoVacuum(zRight); assert( eAuto>=0 && eAuto<=2 ); @@ -129551,7 +129551,7 @@ SQLITE_PRIVATE void sqlite3Pragma( ** creates the database file. It is important that it is created ** as an auto-vacuum capable db. */ - rc = sqlite3BtreeSetAutoVacuum(pBt, eAuto); + rc = tdsqlite3BtreeSetAutoVacuum(pBt, eAuto); if( rc==SQLITE_OK && (eAuto==1 || eAuto==2) ){ /* When setting the auto_vacuum mode to either "full" or ** "incremental", write the value of meta[6] in the database @@ -129567,16 +129567,16 @@ SQLITE_PRIVATE void sqlite3Pragma( { OP_SetCookie, 0, BTREE_INCR_VACUUM, 0}, /* 4 */ }; VdbeOp *aOp; - int iAddr = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeVerifyNoMallocRequired(v, ArraySize(setMeta6)); - aOp = sqlite3VdbeAddOpList(v, ArraySize(setMeta6), setMeta6, iLn); + int iAddr = tdsqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeVerifyNoMallocRequired(v, ArraySize(setMeta6)); + aOp = tdsqlite3VdbeAddOpList(v, ArraySize(setMeta6), setMeta6, iLn); if( ONLY_IF_REALLOC_STRESS(aOp==0) ) break; aOp[0].p1 = iDb; aOp[1].p1 = iDb; aOp[2].p2 = iAddr+4; aOp[4].p1 = iDb; aOp[4].p3 = eAuto - 1; - sqlite3VdbeUsesBtree(v, iDb); + tdsqlite3VdbeUsesBtree(v, iDb); } } break; @@ -129591,16 +129591,16 @@ SQLITE_PRIVATE void sqlite3Pragma( #ifndef SQLITE_OMIT_AUTOVACUUM case PragTyp_INCREMENTAL_VACUUM: { int iLimit, addr; - if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){ + if( zRight==0 || !tdsqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){ iLimit = 0x7fffffff; } - sqlite3BeginWriteOperation(pParse, 0, iDb); - sqlite3VdbeAddOp2(v, OP_Integer, iLimit, 1); - addr = sqlite3VdbeAddOp1(v, OP_IncrVacuum, iDb); VdbeCoverage(v); - sqlite3VdbeAddOp1(v, OP_ResultRow, 1); - sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); - sqlite3VdbeAddOp2(v, OP_IfPos, 1, addr); VdbeCoverage(v); - sqlite3VdbeJumpHere(v, addr); + tdsqlite3BeginWriteOperation(pParse, 0, iDb); + tdsqlite3VdbeAddOp2(v, OP_Integer, iLimit, 1); + addr = tdsqlite3VdbeAddOp1(v, OP_IncrVacuum, iDb); VdbeCoverage(v); + tdsqlite3VdbeAddOp1(v, OP_ResultRow, 1); + tdsqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); + tdsqlite3VdbeAddOp2(v, OP_IfPos, 1, addr); VdbeCoverage(v); + tdsqlite3VdbeJumpHere(v, addr); break; } #endif @@ -129618,13 +129618,13 @@ SQLITE_PRIVATE void sqlite3Pragma( ** of memory. */ case PragTyp_CACHE_SIZE: { - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); if( !zRight ){ returnSingleInt(v, pDb->pSchema->cache_size); }else{ - int size = sqlite3Atoi(zRight); + int size = tdsqlite3Atoi(zRight); pDb->pSchema->cache_size = size; - sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); + tdsqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); } break; } @@ -129652,17 +129652,17 @@ SQLITE_PRIVATE void sqlite3Pragma( ** not just the schema specified. */ case PragTyp_CACHE_SPILL: { - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); if( !zRight ){ returnSingleInt(v, (db->flags & SQLITE_CacheSpill)==0 ? 0 : - sqlite3BtreeSetSpillSize(pDb->pBt,0)); + tdsqlite3BtreeSetSpillSize(pDb->pBt,0)); }else{ int size = 1; - if( sqlite3GetInt32(zRight, &size) ){ - sqlite3BtreeSetSpillSize(pDb->pBt, size); + if( tdsqlite3GetInt32(zRight, &size) ){ + tdsqlite3BtreeSetSpillSize(pDb->pBt, size); } - if( sqlite3GetBoolean(zRight, size!=0) ){ + if( tdsqlite3GetBoolean(zRight, size!=0) ){ db->flags |= SQLITE_CacheSpill; }else{ db->flags &= ~(u64)SQLITE_CacheSpill; @@ -129679,7 +129679,7 @@ SQLITE_PRIVATE void sqlite3Pragma( ** used to limit the aggregate size of all memory mapped regions of the ** database file. If this parameter is set to zero, then memory mapping ** is not used at all. If N is negative, then the default memory map - ** limit determined by sqlite3_config(SQLITE_CONFIG_MMAP_SIZE) is set. + ** limit determined by tdsqlite3_config(SQLITE_CONFIG_MMAP_SIZE) is set. ** The parameter N is measured in bytes. ** ** This value is advisory. The underlying VFS is free to memory map @@ -129687,22 +129687,22 @@ SQLITE_PRIVATE void sqlite3Pragma( ** upper layers will never invoke the xFetch interfaces to the VFS. */ case PragTyp_MMAP_SIZE: { - sqlite3_int64 sz; + tdsqlite3_int64 sz; #if SQLITE_MAX_MMAP_SIZE>0 - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); if( zRight ){ int ii; - sqlite3DecOrHexToI64(zRight, &sz); - if( sz<0 ) sz = sqlite3GlobalConfig.szMmap; + tdsqlite3DecOrHexToI64(zRight, &sz); + if( sz<0 ) sz = tdsqlite3GlobalConfig.szMmap; if( pId2->n==0 ) db->szMmap = sz; for(ii=db->nDb-1; ii>=0; ii--){ if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){ - sqlite3BtreeSetMmapLimit(db->aDb[ii].pBt, sz); + tdsqlite3BtreeSetMmapLimit(db->aDb[ii].pBt, sz); } } } sz = -1; - rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_MMAP_SIZE, &sz); + rc = tdsqlite3_file_control(db, zDb, SQLITE_FCNTL_MMAP_SIZE, &sz); #else sz = 0; rc = SQLITE_OK; @@ -129748,14 +129748,14 @@ SQLITE_PRIVATE void sqlite3Pragma( */ case PragTyp_TEMP_STORE_DIRECTORY: { if( !zRight ){ - returnSingleText(v, sqlite3_temp_directory); + returnSingleText(v, tdsqlite3_temp_directory); }else{ #ifndef SQLITE_OMIT_WSD if( zRight[0] ){ int res; - rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res); + rc = tdsqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res); if( rc!=SQLITE_OK || res==0 ){ - sqlite3ErrorMsg(pParse, "not a writable directory"); + tdsqlite3ErrorMsg(pParse, "not a writable directory"); goto pragma_out; } } @@ -129765,11 +129765,11 @@ SQLITE_PRIVATE void sqlite3Pragma( ){ invalidateTempStorage(pParse); } - sqlite3_free(sqlite3_temp_directory); + tdsqlite3_free(tdsqlite3_temp_directory); if( zRight[0] ){ - sqlite3_temp_directory = sqlite3_mprintf("%s", zRight); + tdsqlite3_temp_directory = tdsqlite3_mprintf("%s", zRight); }else{ - sqlite3_temp_directory = 0; + tdsqlite3_temp_directory = 0; } #endif /* SQLITE_OMIT_WSD */ } @@ -129792,22 +129792,22 @@ SQLITE_PRIVATE void sqlite3Pragma( */ case PragTyp_DATA_STORE_DIRECTORY: { if( !zRight ){ - returnSingleText(v, sqlite3_data_directory); + returnSingleText(v, tdsqlite3_data_directory); }else{ #ifndef SQLITE_OMIT_WSD if( zRight[0] ){ int res; - rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res); + rc = tdsqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res); if( rc!=SQLITE_OK || res==0 ){ - sqlite3ErrorMsg(pParse, "not a writable directory"); + tdsqlite3ErrorMsg(pParse, "not a writable directory"); goto pragma_out; } } - sqlite3_free(sqlite3_data_directory); + tdsqlite3_free(tdsqlite3_data_directory); if( zRight[0] ){ - sqlite3_data_directory = sqlite3_mprintf("%s", zRight); + tdsqlite3_data_directory = tdsqlite3_mprintf("%s", zRight); }else{ - sqlite3_data_directory = 0; + tdsqlite3_data_directory = 0; } #endif /* SQLITE_OMIT_WSD */ } @@ -129826,25 +129826,25 @@ SQLITE_PRIVATE void sqlite3Pragma( */ case PragTyp_LOCK_PROXY_FILE: { if( !zRight ){ - Pager *pPager = sqlite3BtreePager(pDb->pBt); + Pager *pPager = tdsqlite3BtreePager(pDb->pBt); char *proxy_file_path = NULL; - sqlite3_file *pFile = sqlite3PagerFile(pPager); - sqlite3OsFileControlHint(pFile, SQLITE_GET_LOCKPROXYFILE, + tdsqlite3_file *pFile = tdsqlite3PagerFile(pPager); + tdsqlite3OsFileControlHint(pFile, SQLITE_GET_LOCKPROXYFILE, &proxy_file_path); returnSingleText(v, proxy_file_path); }else{ - Pager *pPager = sqlite3BtreePager(pDb->pBt); - sqlite3_file *pFile = sqlite3PagerFile(pPager); + Pager *pPager = tdsqlite3BtreePager(pDb->pBt); + tdsqlite3_file *pFile = tdsqlite3PagerFile(pPager); int res; if( zRight[0] ){ - res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE, + res=tdsqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE, zRight); } else { - res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE, + res=tdsqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE, NULL); } if( res!=SQLITE_OK ){ - sqlite3ErrorMsg(pParse, "failed to set lock proxy file"); + tdsqlite3ErrorMsg(pParse, "failed to set lock proxy file"); goto pragma_out; } } @@ -129866,7 +129866,7 @@ SQLITE_PRIVATE void sqlite3Pragma( returnSingleInt(v, pDb->safety_level-1); }else{ if( !db->autoCommit ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "Safety level may not be changed inside a transaction"); }else if( iDb!=1 ){ int iLevel = (getSafetyLevel(zRight,0,1)+1) & PAGER_SYNCHRONOUS_MASK; @@ -129899,7 +129899,7 @@ SQLITE_PRIVATE void sqlite3Pragma( } #endif - if( sqlite3GetBoolean(zRight, 0) ){ + if( tdsqlite3GetBoolean(zRight, 0) ){ db->flags |= mask; }else{ db->flags &= ~mask; @@ -129910,7 +129910,7 @@ SQLITE_PRIVATE void sqlite3Pragma( ** compiler (eg. count_changes). So add an opcode to expire all ** compiled SQL statements after modifying a pragma value. */ - sqlite3VdbeAddOp0(v, OP_Expire); + tdsqlite3VdbeAddOp0(v, OP_Expire); setAllPagerFlags(db); } break; @@ -129933,16 +129933,16 @@ SQLITE_PRIVATE void sqlite3Pragma( */ case PragTyp_TABLE_INFO: if( zRight ){ Table *pTab; - pTab = sqlite3LocateTable(pParse, LOCATE_NOERR, zRight, zDb); + pTab = tdsqlite3LocateTable(pParse, LOCATE_NOERR, zRight, zDb); if( pTab ){ - int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema); + int iTabDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); int i, k; int nHidden = 0; Column *pCol; - Index *pPk = sqlite3PrimaryKeyIndex(pTab); + Index *pPk = tdsqlite3PrimaryKeyIndex(pTab); pParse->nMem = 7; - sqlite3CodeVerifySchema(pParse, iTabDb); - sqlite3ViewGetColumnNames(pParse, pTab); + tdsqlite3CodeVerifySchema(pParse, iTabDb); + tdsqlite3ViewGetColumnNames(pParse, pTab); for(i=0, pCol=pTab->aCol; inCol; i++, pCol++){ int isHidden = 0; if( pCol->colFlags & COLFLAG_NOINSERT ){ @@ -129966,10 +129966,10 @@ SQLITE_PRIVATE void sqlite3Pragma( for(k=1; k<=pTab->nCol && pPk->aiColumn[k-1]!=i; k++){} } assert( pCol->pDflt==0 || pCol->pDflt->op==TK_SPAN || isHidden>=2 ); - sqlite3VdbeMultiLoad(v, 1, pPragma->iArg ? "issisii" : "issisi", + tdsqlite3VdbeMultiLoad(v, 1, pPragma->iArg ? "issisii" : "issisi", i-nHidden, pCol->zName, - sqlite3ColumnType(pCol,""), + tdsqlite3ColumnType(pCol,""), pCol->notNull ? 1 : 0, pCol->pDflt && isHidden<2 ? pCol->pDflt->u.zToken : 0, k, @@ -129984,22 +129984,22 @@ SQLITE_PRIVATE void sqlite3Pragma( Index *pIdx; HashElem *i; pParse->nMem = 5; - sqlite3CodeVerifySchema(pParse, iDb); + tdsqlite3CodeVerifySchema(pParse, iDb); for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){ Table *pTab = sqliteHashData(i); - sqlite3VdbeMultiLoad(v, 1, "ssiii", + tdsqlite3VdbeMultiLoad(v, 1, "ssiii", pTab->zName, 0, pTab->szTabRow, pTab->nRowLogEst, pTab->tabFlags); for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - sqlite3VdbeMultiLoad(v, 2, "siiiX", + tdsqlite3VdbeMultiLoad(v, 2, "siiiX", pIdx->zName, pIdx->szIdxRow, pIdx->aiRowLogEst[0], pIdx->hasStat1); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5); } } } @@ -130009,18 +130009,18 @@ SQLITE_PRIVATE void sqlite3Pragma( case PragTyp_INDEX_INFO: if( zRight ){ Index *pIdx; Table *pTab; - pIdx = sqlite3FindIndex(db, zRight, zDb); + pIdx = tdsqlite3FindIndex(db, zRight, zDb); if( pIdx==0 ){ /* If there is no index named zRight, check to see if there is a ** WITHOUT ROWID table named zRight, and if there is, show the ** structure of the PRIMARY KEY index for that table. */ - pTab = sqlite3LocateTable(pParse, LOCATE_NOERR, zRight, zDb); + pTab = tdsqlite3LocateTable(pParse, LOCATE_NOERR, zRight, zDb); if( pTab && !HasRowid(pTab) ){ - pIdx = sqlite3PrimaryKeyIndex(pTab); + pIdx = tdsqlite3PrimaryKeyIndex(pTab); } } if( pIdx ){ - int iIdxDb = sqlite3SchemaToIndex(db, pIdx->pSchema); + int iIdxDb = tdsqlite3SchemaToIndex(db, pIdx->pSchema); int i; int mx; if( pPragma->iArg ){ @@ -130033,19 +130033,19 @@ SQLITE_PRIVATE void sqlite3Pragma( pParse->nMem = 3; } pTab = pIdx->pTable; - sqlite3CodeVerifySchema(pParse, iIdxDb); + tdsqlite3CodeVerifySchema(pParse, iIdxDb); assert( pParse->nMem<=pPragma->nPragCName ); for(i=0; iaiColumn[i]; - sqlite3VdbeMultiLoad(v, 1, "iisX", i, cnum, + tdsqlite3VdbeMultiLoad(v, 1, "iisX", i, cnum, cnum<0 ? 0 : pTab->aCol[cnum].zName); if( pPragma->iArg ){ - sqlite3VdbeMultiLoad(v, 4, "isiX", + tdsqlite3VdbeMultiLoad(v, 4, "isiX", pIdx->aSortOrder[i], pIdx->azColl[i], inKeyCol); } - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, pParse->nMem); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, pParse->nMem); } } } @@ -130055,14 +130055,14 @@ SQLITE_PRIVATE void sqlite3Pragma( Index *pIdx; Table *pTab; int i; - pTab = sqlite3FindTable(db, zRight, zDb); + pTab = tdsqlite3FindTable(db, zRight, zDb); if( pTab ){ - int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema); + int iTabDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); pParse->nMem = 5; - sqlite3CodeVerifySchema(pParse, iTabDb); + tdsqlite3CodeVerifySchema(pParse, iTabDb); for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){ const char *azOrigin[] = { "c", "u", "pk" }; - sqlite3VdbeMultiLoad(v, 1, "isisi", + tdsqlite3VdbeMultiLoad(v, 1, "isisi", i, pIdx->zName, IsUniqueIndex(pIdx), @@ -130079,10 +130079,10 @@ SQLITE_PRIVATE void sqlite3Pragma( for(i=0; inDb; i++){ if( db->aDb[i].pBt==0 ) continue; assert( db->aDb[i].zDbSName!=0 ); - sqlite3VdbeMultiLoad(v, 1, "iss", + tdsqlite3VdbeMultiLoad(v, 1, "iss", i, db->aDb[i].zDbSName, - sqlite3BtreeGetFilename(db->aDb[i].pBt)); + tdsqlite3BtreeGetFilename(db->aDb[i].pBt)); } } break; @@ -130093,7 +130093,7 @@ SQLITE_PRIVATE void sqlite3Pragma( pParse->nMem = 2; for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){ CollSeq *pColl = (CollSeq *)sqliteHashData(p); - sqlite3VdbeMultiLoad(v, 1, "is", i++, pColl->zName); + tdsqlite3VdbeMultiLoad(v, 1, "is", i++, pColl->zName); } } break; @@ -130106,7 +130106,7 @@ SQLITE_PRIVATE void sqlite3Pragma( int showInternFunc = (db->mDbFlags & DBFLAG_InternalFunc)!=0; pParse->nMem = 6; for(i=0; iu.pHash ){ + for(p=tdsqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash ){ pragmaFunclistLine(v, p, 1, showInternFunc); } } @@ -130123,7 +130123,7 @@ SQLITE_PRIVATE void sqlite3Pragma( pParse->nMem = 1; for(j=sqliteHashFirst(&db->aModule); j; j=sqliteHashNext(j)){ Module *pMod = (Module*)sqliteHashData(j); - sqlite3VdbeMultiLoad(v, 1, "s", pMod->zName); + tdsqlite3VdbeMultiLoad(v, 1, "s", pMod->zName); } } break; @@ -130132,7 +130132,7 @@ SQLITE_PRIVATE void sqlite3Pragma( case PragTyp_PRAGMA_LIST: { int i; for(i=0; ipFKey; if( pFK ){ - int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema); + int iTabDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); int i = 0; pParse->nMem = 8; - sqlite3CodeVerifySchema(pParse, iTabDb); + tdsqlite3CodeVerifySchema(pParse, iTabDb); while(pFK){ int j; for(j=0; jnCol; j++){ - sqlite3VdbeMultiLoad(v, 1, "iissssss", + tdsqlite3VdbeMultiLoad(v, 1, "iissssss", i, j, pFK->zTo, @@ -130200,31 +130200,31 @@ SQLITE_PRIVATE void sqlite3Pragma( while( k ){ int iTabDb; if( zRight ){ - pTab = sqlite3LocateTable(pParse, 0, zRight, zDb); + pTab = tdsqlite3LocateTable(pParse, 0, zRight, zDb); k = 0; }else{ pTab = (Table*)sqliteHashData(k); k = sqliteHashNext(k); } if( pTab==0 || pTab->pFKey==0 ) continue; - iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema); - sqlite3CodeVerifySchema(pParse, iTabDb); - sqlite3TableLock(pParse, iTabDb, pTab->tnum, 0, pTab->zName); + iTabDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); + tdsqlite3CodeVerifySchema(pParse, iTabDb); + tdsqlite3TableLock(pParse, iTabDb, pTab->tnum, 0, pTab->zName); if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow; - sqlite3OpenTable(pParse, 0, iTabDb, pTab, OP_OpenRead); - sqlite3VdbeLoadString(v, regResult, pTab->zName); + tdsqlite3OpenTable(pParse, 0, iTabDb, pTab, OP_OpenRead); + tdsqlite3VdbeLoadString(v, regResult, pTab->zName); for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){ - pParent = sqlite3FindTable(db, pFK->zTo, zDb); + pParent = tdsqlite3FindTable(db, pFK->zTo, zDb); if( pParent==0 ) continue; pIdx = 0; - sqlite3TableLock(pParse, iTabDb, pParent->tnum, 0, pParent->zName); - x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, 0); + tdsqlite3TableLock(pParse, iTabDb, pParent->tnum, 0, pParent->zName); + x = tdsqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, 0); if( x==0 ){ if( pIdx==0 ){ - sqlite3OpenTable(pParse, i, iTabDb, pParent, OP_OpenRead); + tdsqlite3OpenTable(pParse, i, iTabDb, pParent, OP_OpenRead); }else{ - sqlite3VdbeAddOp3(v, OP_OpenRead, i, pIdx->tnum, iTabDb); - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); + tdsqlite3VdbeAddOp3(v, OP_OpenRead, i, pIdx->tnum, iTabDb); + tdsqlite3VdbeSetP4KeyInfo(pParse, pIdx); } }else{ k = 0; @@ -130234,16 +130234,16 @@ SQLITE_PRIVATE void sqlite3Pragma( assert( pParse->nErr>0 || pFK==0 ); if( pFK ) break; if( pParse->nTabnTab = i; - addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, 0); VdbeCoverage(v); + addrTop = tdsqlite3VdbeAddOp1(v, OP_Rewind, 0); VdbeCoverage(v); for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){ - pParent = sqlite3FindTable(db, pFK->zTo, zDb); + pParent = tdsqlite3FindTable(db, pFK->zTo, zDb); pIdx = 0; aiCols = 0; if( pParent ){ - x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, &aiCols); + x = tdsqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, &aiCols); assert( x==0 ); } - addrOk = sqlite3VdbeMakeLabel(pParse); + addrOk = tdsqlite3VdbeMakeLabel(pParse); /* Generate code to read the child key values into registers ** regRow..regRow+n. If any of the child key values are NULL, this @@ -130251,37 +130251,37 @@ SQLITE_PRIVATE void sqlite3Pragma( ** this case. */ for(j=0; jnCol; j++){ int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom; - sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j); - sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v); + tdsqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j); + tdsqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v); } /* Generate code to query the parent index for a matching parent ** key. If a match is found, jump to addrOk. */ if( pIdx ){ - sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, pFK->nCol, regKey, - sqlite3IndexAffinityStr(db,pIdx), pFK->nCol); - sqlite3VdbeAddOp4Int(v, OP_Found, i, addrOk, regKey, 0); + tdsqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, pFK->nCol, regKey, + tdsqlite3IndexAffinityStr(db,pIdx), pFK->nCol); + tdsqlite3VdbeAddOp4Int(v, OP_Found, i, addrOk, regKey, 0); VdbeCoverage(v); }else if( pParent ){ - int jmp = sqlite3VdbeCurrentAddr(v)+2; - sqlite3VdbeAddOp3(v, OP_SeekRowid, i, jmp, regRow); VdbeCoverage(v); - sqlite3VdbeGoto(v, addrOk); + int jmp = tdsqlite3VdbeCurrentAddr(v)+2; + tdsqlite3VdbeAddOp3(v, OP_SeekRowid, i, jmp, regRow); VdbeCoverage(v); + tdsqlite3VdbeGoto(v, addrOk); assert( pFK->nCol==1 ); } /* Generate code to report an FK violation to the caller. */ if( HasRowid(pTab) ){ - sqlite3VdbeAddOp2(v, OP_Rowid, 0, regResult+1); + tdsqlite3VdbeAddOp2(v, OP_Rowid, 0, regResult+1); }else{ - sqlite3VdbeAddOp2(v, OP_Null, 0, regResult+1); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, regResult+1); } - sqlite3VdbeMultiLoad(v, regResult+2, "siX", pFK->zTo, i-1); - sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 4); - sqlite3VdbeResolveLabel(v, addrOk); - sqlite3DbFree(db, aiCols); + tdsqlite3VdbeMultiLoad(v, regResult+2, "siX", pFK->zTo, i-1); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 4); + tdsqlite3VdbeResolveLabel(v, addrOk); + tdsqlite3DbFree(db, aiCols); } - sqlite3VdbeAddOp2(v, OP_Next, 0, addrTop+1); VdbeCoverage(v); - sqlite3VdbeJumpHere(v, addrTop); + tdsqlite3VdbeAddOp2(v, OP_Next, 0, addrTop+1); VdbeCoverage(v); + tdsqlite3VdbeJumpHere(v, addrTop); } } break; @@ -130294,7 +130294,7 @@ SQLITE_PRIVATE void sqlite3Pragma( */ case PragTyp_CASE_SENSITIVE_LIKE: { if( zRight ){ - sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0)); + tdsqlite3RegisterLikeFunctions(db, tdsqlite3GetBoolean(zRight, 0)); } } break; @@ -130320,7 +130320,7 @@ SQLITE_PRIVATE void sqlite3Pragma( case PragTyp_INTEGRITY_CHECK: { int i, j, addr, mxErr; - int isQuick = (sqlite3Tolower(zLeft[0])=='q'); + int isQuick = (tdsqlite3Tolower(zLeft[0])=='q'); /* If the PRAGMA command was of the form "PRAGMA .integrity_check", ** then iDb is set to the index of the database identified by . @@ -130341,12 +130341,12 @@ SQLITE_PRIVATE void sqlite3Pragma( /* Set the maximum error count */ mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX; if( zRight ){ - sqlite3GetInt32(zRight, &mxErr); + tdsqlite3GetInt32(zRight, &mxErr); if( mxErr<=0 ){ mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX; } } - sqlite3VdbeAddOp2(v, OP_Integer, mxErr-1, 1); /* reg[1] holds errors left */ + tdsqlite3VdbeAddOp2(v, OP_Integer, mxErr-1, 1); /* reg[1] holds errors left */ /* Do an integrity check on each database file */ for(i=0; inDb; i++){ @@ -130359,14 +130359,14 @@ SQLITE_PRIVATE void sqlite3Pragma( if( OMIT_TEMPDB && i==1 ) continue; if( iDb>=0 && i!=iDb ) continue; - sqlite3CodeVerifySchema(pParse, i); + tdsqlite3CodeVerifySchema(pParse, i); /* Do an integrity check of the B-Tree ** ** Begin by finding the root pages numbers ** for all tables and indices in the database. */ - assert( sqlite3SchemaMutexHeld(db, i, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, i, 0) ); pTbls = &db->aDb[i].pSchema->tblHash; for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){ Table *pTab = sqliteHashData(x); /* Current table */ @@ -130376,7 +130376,7 @@ SQLITE_PRIVATE void sqlite3Pragma( for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ cnt++; } if( nIdx>mxIdx ) mxIdx = nIdx; } - aRoot = sqlite3DbMallocRawNN(db, sizeof(int)*(cnt+1)); + aRoot = tdsqlite3DbMallocRawNN(db, sizeof(int)*(cnt+1)); if( aRoot==0 ) break; for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){ Table *pTab = sqliteHashData(x); @@ -130390,18 +130390,18 @@ SQLITE_PRIVATE void sqlite3Pragma( /* Make sure sufficient number of registers have been allocated */ pParse->nMem = MAX( pParse->nMem, 8+mxIdx ); - sqlite3ClearTempRegCache(pParse); + tdsqlite3ClearTempRegCache(pParse); /* Do the b-tree integrity checks */ - sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY); - sqlite3VdbeChangeP5(v, (u8)i); - addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v); - sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, - sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName), + tdsqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY); + tdsqlite3VdbeChangeP5(v, (u8)i); + addr = tdsqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, + tdsqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName), P4_DYNAMIC); - sqlite3VdbeAddOp3(v, OP_Concat, 2, 3, 3); + tdsqlite3VdbeAddOp3(v, OP_Concat, 2, 3, 3); integrityCheckResultRow(v); - sqlite3VdbeJumpHere(v, addr); + tdsqlite3VdbeJumpHere(v, addr); /* Make sure all the indices are constructed correctly. */ @@ -130414,24 +130414,24 @@ SQLITE_PRIVATE void sqlite3Pragma( int r1 = -1; if( pTab->tnum<1 ) continue; /* Skip VIEWs or VIRTUAL TABLEs */ - pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab); - sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0, + pPk = HasRowid(pTab) ? 0 : tdsqlite3PrimaryKeyIndex(pTab); + tdsqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0, 1, 0, &iDataCur, &iIdxCur); /* reg[7] counts the number of entries in the table. ** reg[8+i] counts the number of entries in the i-th index */ - sqlite3VdbeAddOp2(v, OP_Integer, 0, 7); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, 7); for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){ - sqlite3VdbeAddOp2(v, OP_Integer, 0, 8+j); /* index entries counter */ + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, 8+j); /* index entries counter */ } assert( pParse->nMem>=8+j ); - assert( sqlite3NoTempsInRange(pParse,1,7+j) ); - sqlite3VdbeAddOp2(v, OP_Rewind, iDataCur, 0); VdbeCoverage(v); - loopTop = sqlite3VdbeAddOp2(v, OP_AddImm, 7, 1); + assert( tdsqlite3NoTempsInRange(pParse,1,7+j) ); + tdsqlite3VdbeAddOp2(v, OP_Rewind, iDataCur, 0); VdbeCoverage(v); + loopTop = tdsqlite3VdbeAddOp2(v, OP_AddImm, 7, 1); if( !isQuick ){ /* Sanity check on record header decoding */ - sqlite3VdbeAddOp3(v, OP_Column, iDataCur, pTab->nNVCol-1,3); - sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); + tdsqlite3VdbeAddOp3(v, OP_Column, iDataCur, pTab->nNVCol-1,3); + tdsqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); } /* Verify that all NOT NULL columns really are NOT NULL */ for(j=0; jnCol; j++){ @@ -130439,103 +130439,103 @@ SQLITE_PRIVATE void sqlite3Pragma( int jmp2; if( j==pTab->iPKey ) continue; if( pTab->aCol[j].notNull==0 ) continue; - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3); - if( sqlite3VdbeGetOp(v,-1)->opcode==OP_Column ){ - sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); + tdsqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3); + if( tdsqlite3VdbeGetOp(v,-1)->opcode==OP_Column ){ + tdsqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); } - jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v); - zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName, + jmp2 = tdsqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v); + zErr = tdsqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName, pTab->aCol[j].zName); - sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC); integrityCheckResultRow(v); - sqlite3VdbeJumpHere(v, jmp2); + tdsqlite3VdbeJumpHere(v, jmp2); } /* Verify CHECK constraints */ if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){ - ExprList *pCheck = sqlite3ExprListDup(db, pTab->pCheck, 0); + ExprList *pCheck = tdsqlite3ExprListDup(db, pTab->pCheck, 0); if( db->mallocFailed==0 ){ - int addrCkFault = sqlite3VdbeMakeLabel(pParse); - int addrCkOk = sqlite3VdbeMakeLabel(pParse); + int addrCkFault = tdsqlite3VdbeMakeLabel(pParse); + int addrCkOk = tdsqlite3VdbeMakeLabel(pParse); char *zErr; int k; pParse->iSelfTab = iDataCur + 1; for(k=pCheck->nExpr-1; k>0; k--){ - sqlite3ExprIfFalse(pParse, pCheck->a[k].pExpr, addrCkFault, 0); + tdsqlite3ExprIfFalse(pParse, pCheck->a[k].pExpr, addrCkFault, 0); } - sqlite3ExprIfTrue(pParse, pCheck->a[0].pExpr, addrCkOk, + tdsqlite3ExprIfTrue(pParse, pCheck->a[0].pExpr, addrCkOk, SQLITE_JUMPIFNULL); - sqlite3VdbeResolveLabel(v, addrCkFault); + tdsqlite3VdbeResolveLabel(v, addrCkFault); pParse->iSelfTab = 0; - zErr = sqlite3MPrintf(db, "CHECK constraint failed in %s", + zErr = tdsqlite3MPrintf(db, "CHECK constraint failed in %s", pTab->zName); - sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC); integrityCheckResultRow(v); - sqlite3VdbeResolveLabel(v, addrCkOk); + tdsqlite3VdbeResolveLabel(v, addrCkOk); } - sqlite3ExprListDelete(db, pCheck); + tdsqlite3ExprListDelete(db, pCheck); } if( !isQuick ){ /* Omit the remaining tests for quick_check */ /* Validate index entries for the current row */ for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){ int jmp2, jmp3, jmp4, jmp5; - int ckUniq = sqlite3VdbeMakeLabel(pParse); + int ckUniq = tdsqlite3VdbeMakeLabel(pParse); if( pPk==pIdx ) continue; - r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3, + r1 = tdsqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3, pPrior, r1); pPrior = pIdx; - sqlite3VdbeAddOp2(v, OP_AddImm, 8+j, 1);/* increment entry count */ + tdsqlite3VdbeAddOp2(v, OP_AddImm, 8+j, 1);/* increment entry count */ /* Verify that an index entry exists for the current table row */ - jmp2 = sqlite3VdbeAddOp4Int(v, OP_Found, iIdxCur+j, ckUniq, r1, + jmp2 = tdsqlite3VdbeAddOp4Int(v, OP_Found, iIdxCur+j, ckUniq, r1, pIdx->nColumn); VdbeCoverage(v); - sqlite3VdbeLoadString(v, 3, "row "); - sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3); - sqlite3VdbeLoadString(v, 4, " missing from index "); - sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3); - jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName); - sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3); + tdsqlite3VdbeLoadString(v, 3, "row "); + tdsqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3); + tdsqlite3VdbeLoadString(v, 4, " missing from index "); + tdsqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3); + jmp5 = tdsqlite3VdbeLoadString(v, 4, pIdx->zName); + tdsqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3); jmp4 = integrityCheckResultRow(v); - sqlite3VdbeJumpHere(v, jmp2); + tdsqlite3VdbeJumpHere(v, jmp2); /* For UNIQUE indexes, verify that only one entry exists with the ** current key. The entry is unique if (1) any column is NULL ** or (2) the next entry has a different key */ if( IsUniqueIndex(pIdx) ){ - int uniqOk = sqlite3VdbeMakeLabel(pParse); + int uniqOk = tdsqlite3VdbeMakeLabel(pParse); int jmp6; int kk; for(kk=0; kknKeyCol; kk++){ int iCol = pIdx->aiColumn[kk]; assert( iCol!=XN_ROWID && iColnCol ); if( iCol>=0 && pTab->aCol[iCol].notNull ) continue; - sqlite3VdbeAddOp2(v, OP_IsNull, r1+kk, uniqOk); + tdsqlite3VdbeAddOp2(v, OP_IsNull, r1+kk, uniqOk); VdbeCoverage(v); } - jmp6 = sqlite3VdbeAddOp1(v, OP_Next, iIdxCur+j); VdbeCoverage(v); - sqlite3VdbeGoto(v, uniqOk); - sqlite3VdbeJumpHere(v, jmp6); - sqlite3VdbeAddOp4Int(v, OP_IdxGT, iIdxCur+j, uniqOk, r1, + jmp6 = tdsqlite3VdbeAddOp1(v, OP_Next, iIdxCur+j); VdbeCoverage(v); + tdsqlite3VdbeGoto(v, uniqOk); + tdsqlite3VdbeJumpHere(v, jmp6); + tdsqlite3VdbeAddOp4Int(v, OP_IdxGT, iIdxCur+j, uniqOk, r1, pIdx->nKeyCol); VdbeCoverage(v); - sqlite3VdbeLoadString(v, 3, "non-unique entry in index "); - sqlite3VdbeGoto(v, jmp5); - sqlite3VdbeResolveLabel(v, uniqOk); + tdsqlite3VdbeLoadString(v, 3, "non-unique entry in index "); + tdsqlite3VdbeGoto(v, jmp5); + tdsqlite3VdbeResolveLabel(v, uniqOk); } - sqlite3VdbeJumpHere(v, jmp4); - sqlite3ResolvePartIdxLabel(pParse, jmp3); + tdsqlite3VdbeJumpHere(v, jmp4); + tdsqlite3ResolvePartIdxLabel(pParse, jmp3); } } - sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v); - sqlite3VdbeJumpHere(v, loopTop-1); + tdsqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v); + tdsqlite3VdbeJumpHere(v, loopTop-1); #ifndef SQLITE_OMIT_BTREECOUNT if( !isQuick ){ - sqlite3VdbeLoadString(v, 2, "wrong # of entries in index "); + tdsqlite3VdbeLoadString(v, 2, "wrong # of entries in index "); for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){ if( pPk==pIdx ) continue; - sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3); - addr = sqlite3VdbeAddOp3(v, OP_Eq, 8+j, 0, 3); VdbeCoverage(v); - sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); - sqlite3VdbeLoadString(v, 4, pIdx->zName); - sqlite3VdbeAddOp3(v, OP_Concat, 4, 2, 3); + tdsqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3); + addr = tdsqlite3VdbeAddOp3(v, OP_Eq, 8+j, 0, 3); VdbeCoverage(v); + tdsqlite3VdbeChangeP5(v, SQLITE_NOTNULL); + tdsqlite3VdbeLoadString(v, 4, pIdx->zName); + tdsqlite3VdbeAddOp3(v, OP_Concat, 4, 2, 3); integrityCheckResultRow(v); - sqlite3VdbeJumpHere(v, addr); + tdsqlite3VdbeJumpHere(v, addr); } } #endif /* SQLITE_OMIT_BTREECOUNT */ @@ -130554,15 +130554,15 @@ SQLITE_PRIVATE void sqlite3Pragma( }; VdbeOp *aOp; - aOp = sqlite3VdbeAddOpList(v, ArraySize(endCode), endCode, iLn); + aOp = tdsqlite3VdbeAddOpList(v, ArraySize(endCode), endCode, iLn); if( aOp ){ aOp[0].p2 = 1-mxErr; aOp[2].p4type = P4_STATIC; aOp[2].p4.z = "ok"; aOp[5].p4type = P4_STATIC; - aOp[5].p4.z = (char*)sqlite3ErrStr(SQLITE_CORRUPT); + aOp[5].p4.z = (char*)tdsqlite3ErrStr(SQLITE_CORRUPT); } - sqlite3VdbeChangeP3(v, 0, sqlite3VdbeCurrentAddr(v)-2); + tdsqlite3VdbeChangeP3(v, 0, tdsqlite3VdbeCurrentAddr(v)-2); } } break; @@ -130608,7 +130608,7 @@ SQLITE_PRIVATE void sqlite3Pragma( }; const struct EncName *pEnc; if( !zRight ){ /* "PRAGMA encoding" */ - if( sqlite3ReadSchema(pParse) ) goto pragma_out; + if( tdsqlite3ReadSchema(pParse) ) goto pragma_out; assert( encnames[SQLITE_UTF8].enc==SQLITE_UTF8 ); assert( encnames[SQLITE_UTF16LE].enc==SQLITE_UTF16LE ); assert( encnames[SQLITE_UTF16BE].enc==SQLITE_UTF16BE ); @@ -130631,14 +130631,14 @@ SQLITE_PRIVATE void sqlite3Pragma( } if( canChangeEnc ){ for(pEnc=&encnames[0]; pEnc->zName; pEnc++){ - if( 0==sqlite3StrICmp(zRight, pEnc->zName) ){ + if( 0==tdsqlite3StrICmp(zRight, pEnc->zName) ){ SCHEMA_ENC(db) = ENC(db) = pEnc->enc ? pEnc->enc : SQLITE_UTF16NATIVE; break; } } if( !pEnc->zName ){ - sqlite3ErrorMsg(pParse, "unsupported encoding: %s", zRight); + tdsqlite3ErrorMsg(pParse, "unsupported encoding: %s", zRight); } } } @@ -130681,7 +130681,7 @@ SQLITE_PRIVATE void sqlite3Pragma( */ case PragTyp_HEADER_VALUE: { int iCookie = pPragma->iArg; /* Which cookie to read or write */ - sqlite3VdbeUsesBtree(v, iDb); + tdsqlite3VdbeUsesBtree(v, iDb); if( zRight && (pPragma->mPragFlg & PragFlg_ReadOnly)==0 ){ /* Write the specified cookie value */ static const VdbeOpList setCookie[] = { @@ -130689,13 +130689,13 @@ SQLITE_PRIVATE void sqlite3Pragma( { OP_SetCookie, 0, 0, 0}, /* 1 */ }; VdbeOp *aOp; - sqlite3VdbeVerifyNoMallocRequired(v, ArraySize(setCookie)); - aOp = sqlite3VdbeAddOpList(v, ArraySize(setCookie), setCookie, 0); + tdsqlite3VdbeVerifyNoMallocRequired(v, ArraySize(setCookie)); + aOp = tdsqlite3VdbeAddOpList(v, ArraySize(setCookie), setCookie, 0); if( ONLY_IF_REALLOC_STRESS(aOp==0) ) break; aOp[0].p1 = iDb; aOp[1].p1 = iDb; aOp[1].p2 = iCookie; - aOp[1].p3 = sqlite3Atoi(zRight); + aOp[1].p3 = tdsqlite3Atoi(zRight); }else{ /* Read the specified cookie value */ static const VdbeOpList readCookie[] = { @@ -130704,13 +130704,13 @@ SQLITE_PRIVATE void sqlite3Pragma( { OP_ResultRow, 1, 1, 0} }; VdbeOp *aOp; - sqlite3VdbeVerifyNoMallocRequired(v, ArraySize(readCookie)); - aOp = sqlite3VdbeAddOpList(v, ArraySize(readCookie),readCookie,0); + tdsqlite3VdbeVerifyNoMallocRequired(v, ArraySize(readCookie)); + aOp = tdsqlite3VdbeAddOpList(v, ArraySize(readCookie),readCookie,0); if( ONLY_IF_REALLOC_STRESS(aOp==0) ) break; aOp[0].p1 = iDb; aOp[1].p1 = iDb; aOp[1].p3 = iCookie; - sqlite3VdbeReusable(v); + tdsqlite3VdbeReusable(v); } } break; @@ -130727,11 +130727,11 @@ SQLITE_PRIVATE void sqlite3Pragma( int i = 0; const char *zOpt; pParse->nMem = 1; - while( (zOpt = sqlite3_compileoption_get(i++))!=0 ){ - sqlite3VdbeLoadString(v, 1, zOpt); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); + while( (zOpt = tdsqlite3_compileoption_get(i++))!=0 ){ + tdsqlite3VdbeLoadString(v, 1, zOpt); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); } - sqlite3VdbeReusable(v); + tdsqlite3VdbeReusable(v); } break; #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ @@ -130746,17 +130746,17 @@ SQLITE_PRIVATE void sqlite3Pragma( int iBt = (pId2->z?iDb:SQLITE_MAX_ATTACHED); int eMode = SQLITE_CHECKPOINT_PASSIVE; if( zRight ){ - if( sqlite3StrICmp(zRight, "full")==0 ){ + if( tdsqlite3StrICmp(zRight, "full")==0 ){ eMode = SQLITE_CHECKPOINT_FULL; - }else if( sqlite3StrICmp(zRight, "restart")==0 ){ + }else if( tdsqlite3StrICmp(zRight, "restart")==0 ){ eMode = SQLITE_CHECKPOINT_RESTART; - }else if( sqlite3StrICmp(zRight, "truncate")==0 ){ + }else if( tdsqlite3StrICmp(zRight, "truncate")==0 ){ eMode = SQLITE_CHECKPOINT_TRUNCATE; } } pParse->nMem = 3; - sqlite3VdbeAddOp3(v, OP_Checkpoint, iBt, eMode, 1); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3); + tdsqlite3VdbeAddOp3(v, OP_Checkpoint, iBt, eMode, 1); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3); } break; @@ -130770,10 +130770,10 @@ SQLITE_PRIVATE void sqlite3Pragma( */ case PragTyp_WAL_AUTOCHECKPOINT: { if( zRight ){ - sqlite3_wal_autocheckpoint(db, sqlite3Atoi(zRight)); + tdsqlite3_wal_autocheckpoint(db, tdsqlite3Atoi(zRight)); } returnSingleInt(v, - db->xWalCallback==sqlite3WalDefaultHook ? + db->xWalCallback==tdsqlite3WalDefaultHook ? SQLITE_PTR_TO_INT(db->pWalArg) : 0); } break; @@ -130784,10 +130784,10 @@ SQLITE_PRIVATE void sqlite3Pragma( ** ** IMPLEMENTATION-OF: R-23445-46109 This pragma causes the database ** connection on which it is invoked to free up as much memory as it - ** can, by calling sqlite3_db_release_memory(). + ** can, by calling tdsqlite3_db_release_memory(). */ case PragTyp_SHRINK_MEMORY: { - sqlite3_db_release_memory(db); + tdsqlite3_db_release_memory(db); break; } @@ -130857,7 +130857,7 @@ SQLITE_PRIVATE void sqlite3Pragma( u32 opMask; /* Mask of operations to perform */ if( zRight ){ - opMask = (u32)sqlite3Atoi(zRight); + opMask = (u32)tdsqlite3Atoi(zRight); if( (opMask & 0x02)==0 ) break; }else{ opMask = 0xfffe; @@ -130865,7 +130865,7 @@ SQLITE_PRIVATE void sqlite3Pragma( iTabCur = pParse->nTab++; for(iDbLast = zDb?iDb:db->nDb-1; iDb<=iDbLast; iDb++){ if( iDb==1 ) continue; - sqlite3CodeVerifySchema(pParse, iDb); + tdsqlite3CodeVerifySchema(pParse, iDb); pSchema = db->aDb[iDb].pSchema; for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){ pTab = (Table*)sqliteHashData(k); @@ -130876,7 +130876,7 @@ SQLITE_PRIVATE void sqlite3Pragma( if( (pTab->tabFlags & TF_StatsUsed)==0 ) continue; /* Reanalyze if the table is 25 times larger than the last analysis */ - szThreshold = pTab->nRowLogEst + 46; assert( sqlite3LogEst(25)==46 ); + szThreshold = pTab->nRowLogEst + 46; assert( tdsqlite3LogEst(25)==46 ); for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ if( !pIdx->hasStat1 ){ szThreshold = 0; /* Always analyze if any index lacks statistics */ @@ -130884,23 +130884,23 @@ SQLITE_PRIVATE void sqlite3Pragma( } } if( szThreshold ){ - sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead); - sqlite3VdbeAddOp3(v, OP_IfSmaller, iTabCur, - sqlite3VdbeCurrentAddr(v)+2+(opMask&1), szThreshold); + tdsqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead); + tdsqlite3VdbeAddOp3(v, OP_IfSmaller, iTabCur, + tdsqlite3VdbeCurrentAddr(v)+2+(opMask&1), szThreshold); VdbeCoverage(v); } - zSubSql = sqlite3MPrintf(db, "ANALYZE \"%w\".\"%w\"", + zSubSql = tdsqlite3MPrintf(db, "ANALYZE \"%w\".\"%w\"", db->aDb[iDb].zDbSName, pTab->zName); if( opMask & 0x01 ){ - int r1 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp4(v, OP_String8, 0, r1, 0, zSubSql, P4_DYNAMIC); - sqlite3VdbeAddOp2(v, OP_ResultRow, r1, 1); + int r1 = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, r1, 0, zSubSql, P4_DYNAMIC); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, r1, 1); }else{ - sqlite3VdbeAddOp4(v, OP_SqlExec, 0, 0, 0, zSubSql, P4_DYNAMIC); + tdsqlite3VdbeAddOp4(v, OP_SqlExec, 0, 0, 0, zSubSql, P4_DYNAMIC); } } } - sqlite3VdbeAddOp0(v, OP_Expire); + tdsqlite3VdbeAddOp0(v, OP_Expire); break; } @@ -130908,7 +130908,7 @@ SQLITE_PRIVATE void sqlite3Pragma( ** PRAGMA busy_timeout ** PRAGMA busy_timeout = N ** - ** Call sqlite3_busy_timeout(db, N). Return the current timeout value + ** Call tdsqlite3_busy_timeout(db, N). Return the current timeout value ** if one is set. If no busy handler or a different busy handler is set ** then 0 is returned. Setting the busy_timeout to 0 or negative ** disables the timeout. @@ -130916,7 +130916,7 @@ SQLITE_PRIVATE void sqlite3Pragma( /*case PragTyp_BUSY_TIMEOUT*/ default: { assert( pPragma->ePragTyp==PragTyp_BUSY_TIMEOUT ); if( zRight ){ - sqlite3_busy_timeout(db, sqlite3Atoi(zRight)); + tdsqlite3_busy_timeout(db, tdsqlite3Atoi(zRight)); } returnSingleInt(v, db->busyTimeout); break; @@ -130927,18 +130927,18 @@ SQLITE_PRIVATE void sqlite3Pragma( ** PRAGMA soft_heap_limit = N ** ** IMPLEMENTATION-OF: R-26343-45930 This pragma invokes the - ** sqlite3_soft_heap_limit64() interface with the argument N, if N is + ** tdsqlite3_soft_heap_limit64() interface with the argument N, if N is ** specified and is a non-negative integer. ** IMPLEMENTATION-OF: R-64451-07163 The soft_heap_limit pragma always ** returns the same integer that would be returned by the - ** sqlite3_soft_heap_limit64(-1) C-language function. + ** tdsqlite3_soft_heap_limit64(-1) C-language function. */ case PragTyp_SOFT_HEAP_LIMIT: { - sqlite3_int64 N; - if( zRight && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK ){ - sqlite3_soft_heap_limit64(N); + tdsqlite3_int64 N; + if( zRight && tdsqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK ){ + tdsqlite3_soft_heap_limit64(N); } - returnSingleInt(v, sqlite3_soft_heap_limit64(-1)); + returnSingleInt(v, tdsqlite3_soft_heap_limit64(-1)); break; } @@ -130946,20 +130946,20 @@ SQLITE_PRIVATE void sqlite3Pragma( ** PRAGMA hard_heap_limit ** PRAGMA hard_heap_limit = N ** - ** Invoke sqlite3_hard_heap_limit64() to query or set the hard heap + ** Invoke tdsqlite3_hard_heap_limit64() to query or set the hard heap ** limit. The hard heap limit can be activated or lowered by this ** pragma, but not raised or deactivated. Only the - ** sqlite3_hard_heap_limit64() C-language API can raise or deactivate + ** tdsqlite3_hard_heap_limit64() C-language API can raise or deactivate ** the hard heap limit. This allows an application to set a heap limit ** constraint that cannot be relaxed by an untrusted SQL script. */ case PragTyp_HARD_HEAP_LIMIT: { - sqlite3_int64 N; - if( zRight && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK ){ - sqlite3_int64 iPrior = sqlite3_hard_heap_limit64(-1); - if( N>0 && (iPrior==0 || iPrior>N) ) sqlite3_hard_heap_limit64(N); + tdsqlite3_int64 N; + if( zRight && tdsqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK ){ + tdsqlite3_int64 iPrior = tdsqlite3_hard_heap_limit64(-1); + if( N>0 && (iPrior==0 || iPrior>N) ) tdsqlite3_hard_heap_limit64(N); } - returnSingleInt(v, sqlite3_hard_heap_limit64(-1)); + returnSingleInt(v, tdsqlite3_hard_heap_limit64(-1)); break; } @@ -130971,14 +130971,14 @@ SQLITE_PRIVATE void sqlite3Pragma( ** maximum, which might be less than requested. */ case PragTyp_THREADS: { - sqlite3_int64 N; + tdsqlite3_int64 N; if( zRight - && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK + && tdsqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK && N>=0 ){ - sqlite3_limit(db, SQLITE_LIMIT_WORKER_THREADS, (int)(N&0x7fffffff)); + tdsqlite3_limit(db, SQLITE_LIMIT_WORKER_THREADS, (int)(N&0x7fffffff)); } - returnSingleInt(v, sqlite3_limit(db, SQLITE_LIMIT_WORKER_THREADS, -1)); + returnSingleInt(v, tdsqlite3_limit(db, SQLITE_LIMIT_WORKER_THREADS, -1)); break; } @@ -130998,13 +130998,13 @@ SQLITE_PRIVATE void sqlite3Pragma( int j; if( db->aDb[i].zDbSName==0 ) continue; pBt = db->aDb[i].pBt; - if( pBt==0 || sqlite3BtreePager(pBt)==0 ){ + if( pBt==0 || tdsqlite3BtreePager(pBt)==0 ){ zState = "closed"; - }else if( sqlite3_file_control(db, i ? db->aDb[i].zDbSName : 0, + }else if( tdsqlite3_file_control(db, i ? db->aDb[i].zDbSName : 0, SQLITE_FCNTL_LOCKSTATE, &j)==SQLITE_OK ){ zState = azLockName[j]; } - sqlite3VdbeMultiLoad(v, 1, "ss", db->aDb[i].zDbSName, zState); + tdsqlite3VdbeMultiLoad(v, 1, "ss", db->aDb[i].zDbSName, zState); } break; } @@ -131028,23 +131028,23 @@ SQLITE_PRIVATE void sqlite3Pragma( if( pPragma->iArg==2 || pPragma->iArg==3 ){ u8 iByte; int i; - for(i=0, iByte=0; iiArg<4 ? sqlite3Strlen30(zRight) : -1; + n = pPragma->iArg<4 ? tdsqlite3Strlen30(zRight) : -1; } if( (pPragma->iArg & 1)==0 ){ - rc = sqlite3_key_v2(db, zDb, zKey, n); + rc = tdsqlite3_key_v2(db, zDb, zKey, n); }else{ - rc = sqlite3_rekey_v2(db, zDb, zKey, n); + rc = tdsqlite3_rekey_v2(db, zDb, zKey, n); } if( rc==SQLITE_OK && n!=0 ){ - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "ok", SQLITE_STATIC); + tdsqlite3VdbeSetNumCols(v, 1); + tdsqlite3VdbeSetColName(v, 0, COLNAME_NAME, "ok", SQLITE_STATIC); returnSingleText(v, "ok"); } } @@ -131054,13 +131054,13 @@ SQLITE_PRIVATE void sqlite3Pragma( #if defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD) case PragTyp_ACTIVATE_EXTENSIONS: if( zRight ){ #ifdef SQLITE_HAS_CODEC - if( sqlite3StrNICmp(zRight, "see-", 4)==0 ){ - sqlite3_activate_see(&zRight[4]); + if( tdsqlite3StrNICmp(zRight, "see-", 4)==0 ){ + tdsqlite3_activate_see(&zRight[4]); } #endif #ifdef SQLITE_ENABLE_CEROD - if( sqlite3StrNICmp(zRight, "cerod-", 6)==0 ){ - sqlite3_activate_cerod(&zRight[6]); + if( tdsqlite3StrNICmp(zRight, "cerod-", 6)==0 ){ + tdsqlite3_activate_cerod(&zRight[6]); } #endif } @@ -131075,12 +131075,12 @@ SQLITE_PRIVATE void sqlite3Pragma( ** to the PRAGMA, the implementation has not added any OP_ResultRow ** instructions to the VM. */ if( (pPragma->mPragFlg & PragFlg_NoColumns1) && zRight ){ - sqlite3VdbeVerifyNoResultRow(v); + tdsqlite3VdbeVerifyNoResultRow(v); } pragma_out: - sqlite3DbFree(db, zLeft); - sqlite3DbFree(db, zRight); + tdsqlite3DbFree(db, zLeft); + tdsqlite3DbFree(db, zRight); } #ifndef SQLITE_OMIT_VIRTUALTABLE /***************************************************************************** @@ -131090,15 +131090,15 @@ pragma_out: typedef struct PragmaVtab PragmaVtab; typedef struct PragmaVtabCursor PragmaVtabCursor; struct PragmaVtab { - sqlite3_vtab base; /* Base class. Must be first */ - sqlite3 *db; /* The database connection to which it belongs */ + tdsqlite3_vtab base; /* Base class. Must be first */ + tdsqlite3 *db; /* The database connection to which it belongs */ const PragmaName *pName; /* Name of the pragma */ u8 nHidden; /* Number of hidden columns */ u8 iHidden; /* Index of the first hidden column */ }; struct PragmaVtabCursor { - sqlite3_vtab_cursor base; /* Base class. Must be first */ - sqlite3_stmt *pPragma; /* The pragma statement to run */ + tdsqlite3_vtab_cursor base; /* Base class. Must be first */ + tdsqlite3_stmt *pPragma; /* The pragma statement to run */ sqlite_int64 iRowid; /* Current rowid */ char *azArg[2]; /* Value of the argument and schema */ }; @@ -131107,10 +131107,10 @@ struct PragmaVtabCursor { ** Pragma virtual table module xConnect method. */ static int pragmaVtabConnect( - sqlite3 *db, + tdsqlite3 *db, void *pAux, int argc, const char *const*argv, - sqlite3_vtab **ppVtab, + tdsqlite3_vtab **ppVtab, char **pzErr ){ const PragmaName *pPragma = (const PragmaName*)pAux; @@ -131123,31 +131123,31 @@ static int pragmaVtabConnect( UNUSED_PARAMETER(argc); UNUSED_PARAMETER(argv); - sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); - sqlite3_str_appendall(&acc, "CREATE TABLE x"); + tdsqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); + tdsqlite3_str_appendall(&acc, "CREATE TABLE x"); for(i=0, j=pPragma->iPragCName; inPragCName; i++, j++){ - sqlite3_str_appendf(&acc, "%c\"%s\"", cSep, pragCName[j]); + tdsqlite3_str_appendf(&acc, "%c\"%s\"", cSep, pragCName[j]); cSep = ','; } if( i==0 ){ - sqlite3_str_appendf(&acc, "(\"%s\"", pPragma->zName); + tdsqlite3_str_appendf(&acc, "(\"%s\"", pPragma->zName); i++; } j = 0; if( pPragma->mPragFlg & PragFlg_Result1 ){ - sqlite3_str_appendall(&acc, ",arg HIDDEN"); + tdsqlite3_str_appendall(&acc, ",arg HIDDEN"); j++; } if( pPragma->mPragFlg & (PragFlg_SchemaOpt|PragFlg_SchemaReq) ){ - sqlite3_str_appendall(&acc, ",schema HIDDEN"); + tdsqlite3_str_appendall(&acc, ",schema HIDDEN"); j++; } - sqlite3_str_append(&acc, ")", 1); - sqlite3StrAccumFinish(&acc); + tdsqlite3_str_append(&acc, ")", 1); + tdsqlite3StrAccumFinish(&acc); assert( strlen(zBuf) < sizeof(zBuf)-1 ); - rc = sqlite3_declare_vtab(db, zBuf); + rc = tdsqlite3_declare_vtab(db, zBuf); if( rc==SQLITE_OK ){ - pTab = (PragmaVtab*)sqlite3_malloc(sizeof(PragmaVtab)); + pTab = (PragmaVtab*)tdsqlite3_malloc(sizeof(PragmaVtab)); if( pTab==0 ){ rc = SQLITE_NOMEM; }else{ @@ -131158,19 +131158,19 @@ static int pragmaVtabConnect( pTab->nHidden = j; } }else{ - *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db)); + *pzErr = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(db)); } - *ppVtab = (sqlite3_vtab*)pTab; + *ppVtab = (tdsqlite3_vtab*)pTab; return rc; } /* ** Pragma virtual table module xDisconnect method. */ -static int pragmaVtabDisconnect(sqlite3_vtab *pVtab){ +static int pragmaVtabDisconnect(tdsqlite3_vtab *pVtab){ PragmaVtab *pTab = (PragmaVtab*)pVtab; - sqlite3_free(pTab); + tdsqlite3_free(pTab); return SQLITE_OK; } @@ -131181,9 +131181,9 @@ static int pragmaVtabDisconnect(sqlite3_vtab *pVtab){ ** possible, and especially on the first hidden parameter. So return a ** high cost if hidden parameters are unconstrained. */ -static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ +static int pragmaVtabBestIndex(tdsqlite3_vtab *tab, tdsqlite3_index_info *pIdxInfo){ PragmaVtab *pTab = (PragmaVtab*)tab; - const struct sqlite3_index_constraint *pConstraint; + const struct tdsqlite3_index_constraint *pConstraint; int i, j; int seen[2]; @@ -131218,9 +131218,9 @@ static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ } /* Create a new cursor for the pragma virtual table */ -static int pragmaVtabOpen(sqlite3_vtab *pVtab, sqlite3_vtab_cursor **ppCursor){ +static int pragmaVtabOpen(tdsqlite3_vtab *pVtab, tdsqlite3_vtab_cursor **ppCursor){ PragmaVtabCursor *pCsr; - pCsr = (PragmaVtabCursor*)sqlite3_malloc(sizeof(*pCsr)); + pCsr = (PragmaVtabCursor*)tdsqlite3_malloc(sizeof(*pCsr)); if( pCsr==0 ) return SQLITE_NOMEM; memset(pCsr, 0, sizeof(PragmaVtabCursor)); pCsr->base.pVtab = pVtab; @@ -131231,32 +131231,32 @@ static int pragmaVtabOpen(sqlite3_vtab *pVtab, sqlite3_vtab_cursor **ppCursor){ /* Clear all content from pragma virtual table cursor. */ static void pragmaVtabCursorClear(PragmaVtabCursor *pCsr){ int i; - sqlite3_finalize(pCsr->pPragma); + tdsqlite3_finalize(pCsr->pPragma); pCsr->pPragma = 0; for(i=0; iazArg); i++){ - sqlite3_free(pCsr->azArg[i]); + tdsqlite3_free(pCsr->azArg[i]); pCsr->azArg[i] = 0; } } /* Close a pragma virtual table cursor */ -static int pragmaVtabClose(sqlite3_vtab_cursor *cur){ +static int pragmaVtabClose(tdsqlite3_vtab_cursor *cur){ PragmaVtabCursor *pCsr = (PragmaVtabCursor*)cur; pragmaVtabCursorClear(pCsr); - sqlite3_free(pCsr); + tdsqlite3_free(pCsr); return SQLITE_OK; } /* Advance the pragma virtual table cursor to the next row */ -static int pragmaVtabNext(sqlite3_vtab_cursor *pVtabCursor){ +static int pragmaVtabNext(tdsqlite3_vtab_cursor *pVtabCursor){ PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor; int rc = SQLITE_OK; /* Increment the xRowid value */ pCsr->iRowid++; assert( pCsr->pPragma ); - if( SQLITE_ROW!=sqlite3_step(pCsr->pPragma) ){ - rc = sqlite3_finalize(pCsr->pPragma); + if( SQLITE_ROW!=tdsqlite3_step(pCsr->pPragma) ){ + rc = tdsqlite3_finalize(pCsr->pPragma); pCsr->pPragma = 0; pragmaVtabCursorClear(pCsr); } @@ -131267,9 +131267,9 @@ static int pragmaVtabNext(sqlite3_vtab_cursor *pVtabCursor){ ** Pragma virtual table module xFilter method. */ static int pragmaVtabFilter( - sqlite3_vtab_cursor *pVtabCursor, + tdsqlite3_vtab_cursor *pVtabCursor, int idxNum, const char *idxStr, - int argc, sqlite3_value **argv + int argc, tdsqlite3_value **argv ){ PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor; PragmaVtab *pTab = (PragmaVtab*)(pVtabCursor->pVtab); @@ -131283,31 +131283,31 @@ static int pragmaVtabFilter( pragmaVtabCursorClear(pCsr); j = (pTab->pName->mPragFlg & PragFlg_Result1)!=0 ? 0 : 1; for(i=0; iazArg) ); assert( pCsr->azArg[j]==0 ); if( zText ){ - pCsr->azArg[j] = sqlite3_mprintf("%s", zText); + pCsr->azArg[j] = tdsqlite3_mprintf("%s", zText); if( pCsr->azArg[j]==0 ){ return SQLITE_NOMEM; } } } - sqlite3StrAccumInit(&acc, 0, 0, 0, pTab->db->aLimit[SQLITE_LIMIT_SQL_LENGTH]); - sqlite3_str_appendall(&acc, "PRAGMA "); + tdsqlite3StrAccumInit(&acc, 0, 0, 0, pTab->db->aLimit[SQLITE_LIMIT_SQL_LENGTH]); + tdsqlite3_str_appendall(&acc, "PRAGMA "); if( pCsr->azArg[1] ){ - sqlite3_str_appendf(&acc, "%Q.", pCsr->azArg[1]); + tdsqlite3_str_appendf(&acc, "%Q.", pCsr->azArg[1]); } - sqlite3_str_appendall(&acc, pTab->pName->zName); + tdsqlite3_str_appendall(&acc, pTab->pName->zName); if( pCsr->azArg[0] ){ - sqlite3_str_appendf(&acc, "=%Q", pCsr->azArg[0]); + tdsqlite3_str_appendf(&acc, "=%Q", pCsr->azArg[0]); } - zSql = sqlite3StrAccumFinish(&acc); + zSql = tdsqlite3StrAccumFinish(&acc); if( zSql==0 ) return SQLITE_NOMEM; - rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pPragma, 0); - sqlite3_free(zSql); + rc = tdsqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pPragma, 0); + tdsqlite3_free(zSql); if( rc!=SQLITE_OK ){ - pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db)); + pTab->base.zErrMsg = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(pTab->db)); return rc; } return pragmaVtabNext(pVtabCursor); @@ -131316,7 +131316,7 @@ static int pragmaVtabFilter( /* ** Pragma virtual table module xEof method. */ -static int pragmaVtabEof(sqlite3_vtab_cursor *pVtabCursor){ +static int pragmaVtabEof(tdsqlite3_vtab_cursor *pVtabCursor){ PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor; return (pCsr->pPragma==0); } @@ -131325,16 +131325,16 @@ static int pragmaVtabEof(sqlite3_vtab_cursor *pVtabCursor){ ** the PRAGMA. */ static int pragmaVtabColumn( - sqlite3_vtab_cursor *pVtabCursor, - sqlite3_context *ctx, + tdsqlite3_vtab_cursor *pVtabCursor, + tdsqlite3_context *ctx, int i ){ PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor; PragmaVtab *pTab = (PragmaVtab*)(pVtabCursor->pVtab); if( iiHidden ){ - sqlite3_result_value(ctx, sqlite3_column_value(pCsr->pPragma, i)); + tdsqlite3_result_value(ctx, tdsqlite3_column_value(pCsr->pPragma, i)); }else{ - sqlite3_result_text(ctx, pCsr->azArg[i-pTab->iHidden],-1,SQLITE_TRANSIENT); + tdsqlite3_result_text(ctx, pCsr->azArg[i-pTab->iHidden],-1,SQLITE_TRANSIENT); } return SQLITE_OK; } @@ -131342,14 +131342,14 @@ static int pragmaVtabColumn( /* ** Pragma virtual table module xRowid method. */ -static int pragmaVtabRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *p){ +static int pragmaVtabRowid(tdsqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *p){ PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor; *p = pCsr->iRowid; return SQLITE_OK; } /* The pragma virtual table object */ -static const sqlite3_module pragmaVtabModule = { +static const tdsqlite3_module pragmaVtabModule = { 0, /* iVersion */ 0, /* xCreate - create a table */ pragmaVtabConnect, /* xConnect - connect to an existing table */ @@ -131381,14 +131381,14 @@ static const sqlite3_module pragmaVtabModule = { ** then register an eponymous virtual table for that pragma and return ** a pointer to the Module object for the new virtual table. */ -SQLITE_PRIVATE Module *sqlite3PragmaVtabRegister(sqlite3 *db, const char *zName){ +SQLITE_PRIVATE Module *tdsqlite3PragmaVtabRegister(tdsqlite3 *db, const char *zName){ const PragmaName *pName; - assert( sqlite3_strnicmp(zName, "pragma_", 7)==0 ); + assert( tdsqlite3_strnicmp(zName, "pragma_", 7)==0 ); pName = pragmaLocate(zName+7); if( pName==0 ) return 0; if( (pName->mPragFlg & (PragFlg_Result0|PragFlg_Result1))==0 ) return 0; - assert( sqlite3HashFind(&db->aModule, zName)==0 ); - return sqlite3VtabCreateModule(db, zName, &pragmaVtabModule, (void*)pName, 0); + assert( tdsqlite3HashFind(&db->aModule, zName)==0 ); + return tdsqlite3VtabCreateModule(db, zName, &pragmaVtabModule, (void*)pName, 0); } #endif /* SQLITE_OMIT_VIRTUALTABLE */ @@ -131408,7 +131408,7 @@ SQLITE_PRIVATE Module *sqlite3PragmaVtabRegister(sqlite3 *db, const char *zName) ** May you share freely, never taking more than you give. ** ************************************************************************* -** This file contains the implementation of the sqlite3_prepare() +** This file contains the implementation of the tdsqlite3_prepare() ** interface, and routines that contribute to loading the database schema ** from disk. */ @@ -131423,21 +131423,21 @@ static void corruptSchema( const char *zObj, /* Object being parsed at the point of error */ const char *zExtra /* Error information */ ){ - sqlite3 *db = pData->db; + tdsqlite3 *db = pData->db; if( db->mallocFailed ){ pData->rc = SQLITE_NOMEM_BKPT; }else if( pData->pzErrMsg[0]!=0 ){ /* A error message has already been generated. Do not overwrite it */ }else if( pData->mInitFlags & INITFLAG_AlterTable ){ - *pData->pzErrMsg = sqlite3DbStrDup(db, zExtra); + *pData->pzErrMsg = tdsqlite3DbStrDup(db, zExtra); pData->rc = SQLITE_ERROR; }else if( db->flags & SQLITE_WriteSchema ){ pData->rc = SQLITE_CORRUPT_BKPT; }else{ char *z; if( zObj==0 ) zObj = "?"; - z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj); - if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra); + z = tdsqlite3MPrintf(db, "malformed database schema (%s)", zObj); + if( zExtra && zExtra[0] ) z = tdsqlite3MPrintf(db, "%z - %s", z, zExtra); *pData->pzErrMsg = z; pData->rc = SQLITE_CORRUPT_BKPT; } @@ -131448,7 +131448,7 @@ static void corruptSchema( ** of pIndex has the same root page number, and if it does, return true. ** This would indicate a corrupt schema. */ -SQLITE_PRIVATE int sqlite3IndexHasDuplicateRootPage(Index *pIndex){ +SQLITE_PRIVATE int tdsqlite3IndexHasDuplicateRootPage(Index *pIndex){ Index *p; for(p=pIndex->pTable->pIndex; p; p=p->pNext){ if( p->tnum==pIndex->tnum && p!=pIndex ) return 1; @@ -131457,20 +131457,20 @@ SQLITE_PRIVATE int sqlite3IndexHasDuplicateRootPage(Index *pIndex){ } /* forward declaration */ -static int sqlite3Prepare( - sqlite3 *db, /* Database handle. */ +static int tdsqlite3Prepare( + tdsqlite3 *db, /* Database handle. */ const char *zSql, /* UTF-8 encoded SQL statement. */ int nBytes, /* Length of zSql in bytes. */ u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ Vdbe *pReprepare, /* VM being reprepared */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ + tdsqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ const char **pzTail /* OUT: End of parsed string */ ); /* ** This is the callback routine for the code that initializes the -** database. See sqlite3Init() below for additional information. +** database. See tdsqlite3Init() below for additional information. ** This routine is also called from the OP_ParseSchema opcode of the VDBE. ** ** Each callback contains the following information: @@ -131482,14 +131482,14 @@ static int sqlite3Prepare( ** argv[4] = SQL text for the CREATE statement. ** */ -SQLITE_PRIVATE int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){ +SQLITE_PRIVATE int tdsqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){ InitData *pData = (InitData*)pInit; - sqlite3 *db = pData->db; + tdsqlite3 *db = pData->db; int iDb = pData->iDb; assert( argc==5 ); UNUSED_PARAMETER2(NotUsed, argc); - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); DbClearProperty(db, iDb, DB_Empty); pData->nInitRow++; if( db->mallocFailed ){ @@ -131501,7 +131501,7 @@ SQLITE_PRIVATE int sqlite3InitCallback(void *pInit, int argc, char **argv, char if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */ if( argv[3]==0 ){ corruptSchema(pData, argv[1], 0); - }else if( sqlite3_strnicmp(argv[4],"create ",7)==0 ){ + }else if( tdsqlite3_strnicmp(argv[4],"create ",7)==0 ){ /* Call the parser to process a CREATE TABLE, INDEX or VIEW. ** But because db->init.busy is set to 1, no VDBE code is generated ** or executed. All the parser does is build the internal data @@ -131509,16 +131509,16 @@ SQLITE_PRIVATE int sqlite3InitCallback(void *pInit, int argc, char **argv, char */ int rc; u8 saved_iDb = db->init.iDb; - sqlite3_stmt *pStmt; - TESTONLY(int rcp); /* Return code from sqlite3_prepare() */ + tdsqlite3_stmt *pStmt; + TESTONLY(int rcp); /* Return code from tdsqlite3_prepare() */ assert( db->init.busy ); db->init.iDb = iDb; - db->init.newTnum = sqlite3Atoi(argv[3]); + db->init.newTnum = tdsqlite3Atoi(argv[3]); db->init.orphanTrigger = 0; db->init.azInit = argv; pStmt = 0; - TESTONLY(rcp = ) sqlite3Prepare(db, argv[4], -1, 0, 0, &pStmt, 0); + TESTONLY(rcp = ) tdsqlite3Prepare(db, argv[4], -1, 0, 0, &pStmt, 0); rc = db->errCode; assert( (rc&0xFF)==(rcp&0xFF) ); db->init.iDb = saved_iDb; @@ -131529,13 +131529,13 @@ SQLITE_PRIVATE int sqlite3InitCallback(void *pInit, int argc, char **argv, char }else{ if( rc > pData->rc ) pData->rc = rc; if( rc==SQLITE_NOMEM ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); }else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){ - corruptSchema(pData, argv[1], sqlite3_errmsg(db)); + corruptSchema(pData, argv[1], tdsqlite3_errmsg(db)); } } } - sqlite3_finalize(pStmt); + tdsqlite3_finalize(pStmt); }else if( argv[1]==0 || (argv[4]!=0 && argv[4][0]!=0) ){ corruptSchema(pData, argv[1], 0); }else{ @@ -131546,11 +131546,11 @@ SQLITE_PRIVATE int sqlite3InitCallback(void *pInit, int argc, char **argv, char ** to do here is record the root page number for that index. */ Index *pIndex; - pIndex = sqlite3FindIndex(db, argv[1], db->aDb[iDb].zDbSName); + pIndex = tdsqlite3FindIndex(db, argv[1], db->aDb[iDb].zDbSName); if( pIndex==0 - || sqlite3GetInt32(argv[3],&pIndex->tnum)==0 + || tdsqlite3GetInt32(argv[3],&pIndex->tnum)==0 || pIndex->tnum<2 - || sqlite3IndexHasDuplicateRootPage(pIndex) + || tdsqlite3IndexHasDuplicateRootPage(pIndex) ){ corruptSchema(pData, argv[1], pIndex?"invalid rootpage":"orphan index"); } @@ -131566,7 +131566,7 @@ SQLITE_PRIVATE int sqlite3InitCallback(void *pInit, int argc, char **argv, char ** auxiliary databases. Return one of the SQLITE_ error codes to ** indicate success or failure. */ -SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFlags){ +SQLITE_PRIVATE int tdsqlite3InitOne(tdsqlite3 *db, int iDb, char **pzErrMsg, u32 mFlags){ int rc; int i; #ifndef SQLITE_OMIT_DEPRECATED @@ -131582,8 +131582,8 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl assert( (db->mDbFlags & DBFLAG_SchemaKnownOk)==0 ); assert( iDb>=0 && iDbnDb ); assert( db->aDb[iDb].pSchema ); - assert( sqlite3_mutex_held(db->mutex) ); - assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) ); + assert( tdsqlite3_mutex_held(db->mutex) ); + assert( iDb==1 || tdsqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) ); db->init.busy = 1; @@ -131605,7 +131605,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl initData.pzErrMsg = pzErrMsg; initData.mInitFlags = mFlags; initData.nInitRow = 0; - sqlite3InitCallback(&initData, 5, (char **)azArg, 0); + tdsqlite3InitCallback(&initData, 5, (char **)azArg, 0); if( initData.rc ){ rc = initData.rc; goto error_out; @@ -131624,11 +131624,11 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl /* If there is not already a read-only (or read-write) transaction opened ** on the b-tree database, open one now. If a transaction is opened, it ** will be closed before this function returns. */ - sqlite3BtreeEnter(pDb->pBt); - if( !sqlite3BtreeIsInReadTrans(pDb->pBt) ){ - rc = sqlite3BtreeBeginTrans(pDb->pBt, 0, 0); + tdsqlite3BtreeEnter(pDb->pBt); + if( !tdsqlite3BtreeIsInReadTrans(pDb->pBt) ){ + rc = tdsqlite3BtreeBeginTrans(pDb->pBt, 0, 0); if( rc!=SQLITE_OK ){ - sqlite3SetString(pzErrMsg, db, sqlite3ErrStr(rc)); + tdsqlite3SetString(pzErrMsg, db, tdsqlite3ErrStr(rc)); goto initone_error_out; } openedTransaction = 1; @@ -131652,7 +131652,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl ** the possible values of meta[4]. */ for(i=0; ipBt, i+1, (u32 *)&meta[i]); + tdsqlite3BtreeGetMeta(pDb->pBt, i+1, (u32 *)&meta[i]); } if( (db->flags & SQLITE_ResetDatabase)!=0 ){ memset(meta, 0, sizeof(meta)); @@ -131678,7 +131678,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl }else{ /* If opening an attached database, the encoding much match ENC(db) */ if( meta[BTREE_TEXT_ENCODING-1]!=ENC(db) ){ - sqlite3SetString(pzErrMsg, db, "attached databases must use the same" + tdsqlite3SetString(pzErrMsg, db, "attached databases must use the same" " text encoding as main database"); rc = SQLITE_ERROR; goto initone_error_out; @@ -131691,13 +131691,13 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl if( pDb->pSchema->cache_size==0 ){ #ifndef SQLITE_OMIT_DEPRECATED - size = sqlite3AbsInt32(meta[BTREE_DEFAULT_CACHE_SIZE-1]); + size = tdsqlite3AbsInt32(meta[BTREE_DEFAULT_CACHE_SIZE-1]); if( size==0 ){ size = SQLITE_DEFAULT_CACHE_SIZE; } pDb->pSchema->cache_size = size; #else pDb->pSchema->cache_size = SQLITE_DEFAULT_CACHE_SIZE; #endif - sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); + tdsqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); } /* @@ -131711,7 +131711,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl pDb->pSchema->file_format = 1; } if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){ - sqlite3SetString(pzErrMsg, db, "unsupported file format"); + tdsqlite3SetString(pzErrMsg, db, "unsupported file format"); rc = SQLITE_ERROR; goto initone_error_out; } @@ -131730,36 +131730,36 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl assert( db->init.busy ); { char *zSql; - zSql = sqlite3MPrintf(db, + zSql = tdsqlite3MPrintf(db, "SELECT*FROM\"%w\".%s ORDER BY rowid", db->aDb[iDb].zDbSName, zMasterName); #ifndef SQLITE_OMIT_AUTHORIZATION { - sqlite3_xauth xAuth; + tdsqlite3_xauth xAuth; xAuth = db->xAuth; db->xAuth = 0; #endif - rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0); + rc = tdsqlite3_exec(db, zSql, tdsqlite3InitCallback, &initData, 0); #ifndef SQLITE_OMIT_AUTHORIZATION db->xAuth = xAuth; } #endif if( rc==SQLITE_OK ) rc = initData.rc; - sqlite3DbFree(db, zSql); + tdsqlite3DbFree(db, zSql); #ifndef SQLITE_OMIT_ANALYZE if( rc==SQLITE_OK ){ - sqlite3AnalysisLoad(db, iDb); + tdsqlite3AnalysisLoad(db, iDb); } #endif } if( db->mallocFailed ){ rc = SQLITE_NOMEM_BKPT; - sqlite3ResetAllSchemasOfConnection(db); + tdsqlite3ResetAllSchemasOfConnection(db); } if( rc==SQLITE_OK || (db->flags&SQLITE_NoSchemaError)){ /* Black magic: If the SQLITE_NoSchemaError flag is set, then consider ** the schema loaded, even if errors occurred. In this situation the - ** current sqlite3_prepare() operation will fail, but the following one + ** current tdsqlite3_prepare() operation will fail, but the following one ** will attempt to compile the supplied statement against whatever subset ** of the schema was loaded before the error occurred. The primary ** purpose of this is to allow access to the sqlite_master table @@ -131770,21 +131770,21 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl } /* Jump here for an error that occurs after successfully allocating - ** curMain and calling sqlite3BtreeEnter(). For an error that occurs + ** curMain and calling tdsqlite3BtreeEnter(). For an error that occurs ** before that point, jump to error_out. */ initone_error_out: if( openedTransaction ){ - sqlite3BtreeCommit(pDb->pBt); + tdsqlite3BtreeCommit(pDb->pBt); } - sqlite3BtreeLeave(pDb->pBt); + tdsqlite3BtreeLeave(pDb->pBt); error_out: if( rc ){ if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); } - sqlite3ResetOneSchema(db, iDb); + tdsqlite3ResetOneSchema(db, iDb); } db->init.busy = 0; return rc; @@ -131800,30 +131800,30 @@ error_out: ** bit is set in the flags field of the Db structure. If the database ** file was of zero-length, then the DB_Empty flag is also set. */ -SQLITE_PRIVATE int sqlite3Init(sqlite3 *db, char **pzErrMsg){ +SQLITE_PRIVATE int tdsqlite3Init(tdsqlite3 *db, char **pzErrMsg){ int i, rc; int commit_internal = !(db->mDbFlags&DBFLAG_SchemaChange); - assert( sqlite3_mutex_held(db->mutex) ); - assert( sqlite3BtreeHoldsMutex(db->aDb[0].pBt) ); + assert( tdsqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3BtreeHoldsMutex(db->aDb[0].pBt) ); assert( db->init.busy==0 ); ENC(db) = SCHEMA_ENC(db); assert( db->nDb>0 ); /* Do the main schema first */ if( !DbHasProperty(db, 0, DB_SchemaLoaded) ){ - rc = sqlite3InitOne(db, 0, pzErrMsg, 0); + rc = tdsqlite3InitOne(db, 0, pzErrMsg, 0); if( rc ) return rc; } /* All other schemas after the main schema. The "temp" schema must be last */ for(i=db->nDb-1; i>0; i--){ - assert( i==1 || sqlite3BtreeHoldsMutex(db->aDb[i].pBt) ); + assert( i==1 || tdsqlite3BtreeHoldsMutex(db->aDb[i].pBt) ); if( !DbHasProperty(db, i, DB_SchemaLoaded) ){ - rc = sqlite3InitOne(db, i, pzErrMsg, 0); + rc = tdsqlite3InitOne(db, i, pzErrMsg, 0); if( rc ) return rc; } } if( commit_internal ){ - sqlite3CommitInternalChanges(db); + tdsqlite3CommitInternalChanges(db); } return SQLITE_OK; } @@ -131832,12 +131832,12 @@ SQLITE_PRIVATE int sqlite3Init(sqlite3 *db, char **pzErrMsg){ ** This routine is a no-op if the database schema is already initialized. ** Otherwise, the schema is loaded. An error code is returned. */ -SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse){ +SQLITE_PRIVATE int tdsqlite3ReadSchema(Parse *pParse){ int rc = SQLITE_OK; - sqlite3 *db = pParse->db; - assert( sqlite3_mutex_held(db->mutex) ); + tdsqlite3 *db = pParse->db; + assert( tdsqlite3_mutex_held(db->mutex) ); if( !db->init.busy ){ - rc = sqlite3Init(db, &pParse->zErrMsg); + rc = tdsqlite3Init(db, &pParse->zErrMsg); if( rc!=SQLITE_OK ){ pParse->rc = rc; pParse->nErr++; @@ -131855,13 +131855,13 @@ SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse){ ** make no changes to pParse->rc. */ static void schemaIsValid(Parse *pParse){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; int iDb; int rc; int cookie; assert( pParse->checkSchema ); - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); for(iDb=0; iDbnDb; iDb++){ int openedTransaction = 0; /* True if a transaction is opened */ Btree *pBt = db->aDb[iDb].pBt; /* Btree database to read cookie from */ @@ -131870,10 +131870,10 @@ static void schemaIsValid(Parse *pParse){ /* If there is not already a read-only (or read-write) transaction opened ** on the b-tree database, open one now. If a transaction is opened, it ** will be closed immediately after reading the meta-value. */ - if( !sqlite3BtreeIsInReadTrans(pBt) ){ - rc = sqlite3BtreeBeginTrans(pBt, 0, 0); + if( !tdsqlite3BtreeIsInReadTrans(pBt) ){ + rc = tdsqlite3BtreeBeginTrans(pBt, 0, 0); if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); } if( rc!=SQLITE_OK ) return; openedTransaction = 1; @@ -131882,16 +131882,16 @@ static void schemaIsValid(Parse *pParse){ /* Read the schema cookie from the database. If it does not match the ** value stored as part of the in-memory schema representation, ** set Parse.rc to SQLITE_SCHEMA. */ - sqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&cookie); - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + tdsqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&cookie); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); if( cookie!=db->aDb[iDb].pSchema->schema_cookie ){ - sqlite3ResetOneSchema(db, iDb); + tdsqlite3ResetOneSchema(db, iDb); pParse->rc = SQLITE_SCHEMA; } /* Close the transaction, if one was opened. */ if( openedTransaction ){ - sqlite3BtreeCommit(pBt); + tdsqlite3BtreeCommit(pBt); } } } @@ -131903,7 +131903,7 @@ static void schemaIsValid(Parse *pParse){ ** If the same database is attached more than once, the first ** attached database is returned. */ -SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){ +SQLITE_PRIVATE int tdsqlite3SchemaToIndex(tdsqlite3 *db, Schema *pSchema){ int i = -1000000; /* If pSchema is NULL, then return -1000000. This happens when code in @@ -131916,7 +131916,7 @@ SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){ ** more likely to cause a segfault than -1 (of course there are assert() ** statements too, but it never hurts to play the odds). */ - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); if( pSchema ){ for(i=0; 1; i++){ assert( inDb ); @@ -131932,10 +131932,10 @@ SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){ /* ** Free all memory allocations in the pParse object */ -SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){ - sqlite3 *db = pParse->db; - sqlite3DbFree(db, pParse->aLabel); - sqlite3ExprListDelete(db, pParse->pConstExpr); +SQLITE_PRIVATE void tdsqlite3ParserReset(Parse *pParse){ + tdsqlite3 *db = pParse->db; + tdsqlite3DbFree(db, pParse->aLabel); + tdsqlite3ExprListDelete(db, pParse->pConstExpr); if( db ){ assert( db->lookaside.bDisable >= pParse->disableLookaside ); db->lookaside.bDisable -= pParse->disableLookaside; @@ -131947,13 +131947,13 @@ SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){ /* ** Compile the UTF-8 encoded SQL statement zSql into a statement handle. */ -static int sqlite3Prepare( - sqlite3 *db, /* Database handle. */ +static int tdsqlite3Prepare( + tdsqlite3 *db, /* Database handle. */ const char *zSql, /* UTF-8 encoded SQL statement. */ int nBytes, /* Length of zSql in bytes. */ u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ Vdbe *pReprepare, /* VM being reprepared */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ + tdsqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ const char **pzTail /* OUT: End of parsed string */ ){ char *zErrMsg = 0; /* Error message */ @@ -131966,7 +131966,7 @@ static int sqlite3Prepare( sParse.pReprepare = pReprepare; assert( ppStmt && *ppStmt==0 ); /* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */ - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); /* For a long-term use prepared statement avoid the use of ** lookaside memory. @@ -131990,7 +131990,7 @@ static int sqlite3Prepare( ** the schema change. Disaster would follow. ** ** This thread is currently holding mutexes on all Btrees (because - ** of the sqlite3BtreeEnterAll() in sqlite3LockAndPrepare()) so it + ** of the tdsqlite3BtreeEnterAll() in tdsqlite3LockAndPrepare()) so it ** is not possible for another thread to start a new schema change ** while this routine is running. Hence, we do not need to hold ** locks on the schema, we just need to make sure nobody else is @@ -132004,11 +132004,11 @@ static int sqlite3Prepare( for(i=0; inDb; i++) { Btree *pBt = db->aDb[i].pBt; if( pBt ){ - assert( sqlite3BtreeHoldsMutex(pBt) ); - rc = sqlite3BtreeSchemaLocked(pBt); + assert( tdsqlite3BtreeHoldsMutex(pBt) ); + rc = tdsqlite3BtreeSchemaLocked(pBt); if( rc ){ const char *zDb = db->aDb[i].zDbSName; - sqlite3ErrorWithMsg(db, rc, "database schema is locked: %s", zDb); + tdsqlite3ErrorWithMsg(db, rc, "database schema is locked: %s", zDb); testcase( db->flags & SQLITE_ReadUncommit ); goto end_prepare; } @@ -132016,7 +132016,7 @@ static int sqlite3Prepare( } } - sqlite3VtabUnlockList(db); + tdsqlite3VtabUnlockList(db); sParse.db = db; if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){ @@ -132025,20 +132025,20 @@ static int sqlite3Prepare( testcase( nBytes==mxLen ); testcase( nBytes==mxLen+1 ); if( nBytes>mxLen ){ - sqlite3ErrorWithMsg(db, SQLITE_TOOBIG, "statement too long"); - rc = sqlite3ApiExit(db, SQLITE_TOOBIG); + tdsqlite3ErrorWithMsg(db, SQLITE_TOOBIG, "statement too long"); + rc = tdsqlite3ApiExit(db, SQLITE_TOOBIG); goto end_prepare; } - zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes); + zSqlCopy = tdsqlite3DbStrNDup(db, zSql, nBytes); if( zSqlCopy ){ - sqlite3RunParser(&sParse, zSqlCopy, &zErrMsg); + tdsqlite3RunParser(&sParse, zSqlCopy, &zErrMsg); sParse.zTail = &zSql[sParse.zTail-zSqlCopy]; - sqlite3DbFree(db, zSqlCopy); + tdsqlite3DbFree(db, zSqlCopy); }else{ sParse.zTail = &zSql[nBytes]; } }else{ - sqlite3RunParser(&sParse, zSql, &zErrMsg); + tdsqlite3RunParser(&sParse, zSql, &zErrMsg); } assert( 0==sParse.nQueryLoop ); @@ -132053,45 +132053,45 @@ static int sqlite3Prepare( } if( db->init.busy==0 ){ - sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags); + tdsqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags); } if( db->mallocFailed ){ sParse.rc = SQLITE_NOMEM_BKPT; } rc = sParse.rc; if( rc!=SQLITE_OK ){ - if( sParse.pVdbe ) sqlite3VdbeFinalize(sParse.pVdbe); + if( sParse.pVdbe ) tdsqlite3VdbeFinalize(sParse.pVdbe); assert(!(*ppStmt)); }else{ - *ppStmt = (sqlite3_stmt*)sParse.pVdbe; + *ppStmt = (tdsqlite3_stmt*)sParse.pVdbe; } if( zErrMsg ){ - sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg); - sqlite3DbFree(db, zErrMsg); + tdsqlite3ErrorWithMsg(db, rc, "%s", zErrMsg); + tdsqlite3DbFree(db, zErrMsg); }else{ - sqlite3Error(db, rc); + tdsqlite3Error(db, rc); } /* Delete any TriggerPrg structures allocated while parsing this statement. */ while( sParse.pTriggerPrg ){ TriggerPrg *pT = sParse.pTriggerPrg; sParse.pTriggerPrg = pT->pNext; - sqlite3DbFree(db, pT); + tdsqlite3DbFree(db, pT); } end_prepare: - sqlite3ParserReset(&sParse); + tdsqlite3ParserReset(&sParse); return rc; } -static int sqlite3LockAndPrepare( - sqlite3 *db, /* Database handle. */ +static int tdsqlite3LockAndPrepare( + tdsqlite3 *db, /* Database handle. */ const char *zSql, /* UTF-8 encoded SQL statement. */ int nBytes, /* Length of zSql in bytes. */ u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ Vdbe *pOld, /* VM being reprepared */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ + tdsqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ const char **pzTail /* OUT: End of parsed string */ ){ int rc; @@ -132101,23 +132101,23 @@ static int sqlite3LockAndPrepare( if( ppStmt==0 ) return SQLITE_MISUSE_BKPT; #endif *ppStmt = 0; - if( !sqlite3SafetyCheckOk(db)||zSql==0 ){ + if( !tdsqlite3SafetyCheckOk(db)||zSql==0 ){ return SQLITE_MISUSE_BKPT; } - sqlite3_mutex_enter(db->mutex); - sqlite3BtreeEnterAll(db); + tdsqlite3_mutex_enter(db->mutex); + tdsqlite3BtreeEnterAll(db); do{ /* Make multiple attempts to compile the SQL, until it either succeeds ** or encounters a permanent error. A schema problem after one schema ** reset is considered a permanent error. */ - rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail); + rc = tdsqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail); assert( rc==SQLITE_OK || *ppStmt==0 ); }while( rc==SQLITE_ERROR_RETRY - || (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) ); - sqlite3BtreeLeaveAll(db); - rc = sqlite3ApiExit(db, rc); + || (rc==SQLITE_SCHEMA && (tdsqlite3ResetOneSchema(db,-1), cnt++)==0) ); + tdsqlite3BtreeLeaveAll(db); + rc = tdsqlite3ApiExit(db, rc); assert( (rc&db->errMask)==rc ); - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return rc; } @@ -132127,36 +132127,36 @@ static int sqlite3LockAndPrepare( ** ** If the statement is successfully recompiled, return SQLITE_OK. Otherwise, ** if the statement cannot be recompiled because another connection has -** locked the sqlite3_master table, return SQLITE_LOCKED. If any other error +** locked the tdsqlite3_master table, return SQLITE_LOCKED. If any other error ** occurs, return SQLITE_SCHEMA. */ -SQLITE_PRIVATE int sqlite3Reprepare(Vdbe *p){ +SQLITE_PRIVATE int tdsqlite3Reprepare(Vdbe *p){ int rc; - sqlite3_stmt *pNew; + tdsqlite3_stmt *pNew; const char *zSql; - sqlite3 *db; + tdsqlite3 *db; u8 prepFlags; - assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) ); - zSql = sqlite3_sql((sqlite3_stmt *)p); + assert( tdsqlite3_mutex_held(tdsqlite3VdbeDb(p)->mutex) ); + zSql = tdsqlite3_sql((tdsqlite3_stmt *)p); assert( zSql!=0 ); /* Reprepare only called for prepare_v2() statements */ - db = sqlite3VdbeDb(p); - assert( sqlite3_mutex_held(db->mutex) ); - prepFlags = sqlite3VdbePrepareFlags(p); - rc = sqlite3LockAndPrepare(db, zSql, -1, prepFlags, p, &pNew, 0); + db = tdsqlite3VdbeDb(p); + assert( tdsqlite3_mutex_held(db->mutex) ); + prepFlags = tdsqlite3VdbePrepareFlags(p); + rc = tdsqlite3LockAndPrepare(db, zSql, -1, prepFlags, p, &pNew, 0); if( rc ){ if( rc==SQLITE_NOMEM ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); } assert( pNew==0 ); return rc; }else{ assert( pNew!=0 ); } - sqlite3VdbeSwap((Vdbe*)pNew, p); - sqlite3TransferBindings(pNew, (sqlite3_stmt*)p); - sqlite3VdbeResetStepResult((Vdbe*)pNew); - sqlite3VdbeFinalize((Vdbe*)pNew); + tdsqlite3VdbeSwap((Vdbe*)pNew, p); + tdsqlite3TransferBindings(pNew, (tdsqlite3_stmt*)p); + tdsqlite3VdbeResetStepResult((Vdbe*)pNew); + tdsqlite3VdbeFinalize((Vdbe*)pNew); return SQLITE_OK; } @@ -132165,57 +132165,57 @@ SQLITE_PRIVATE int sqlite3Reprepare(Vdbe *p){ ** Two versions of the official API. Legacy and new use. In the legacy ** version, the original SQL text is not saved in the prepared statement ** and so if a schema change occurs, SQLITE_SCHEMA is returned by -** sqlite3_step(). In the new version, the original SQL text is retained +** tdsqlite3_step(). In the new version, the original SQL text is retained ** and the statement is automatically recompiled if an schema change ** occurs. */ -SQLITE_API int sqlite3_prepare( - sqlite3 *db, /* Database handle. */ +SQLITE_API int tdsqlite3_prepare( + tdsqlite3 *db, /* Database handle. */ const char *zSql, /* UTF-8 encoded SQL statement. */ int nBytes, /* Length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ + tdsqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ const char **pzTail /* OUT: End of parsed string */ ){ int rc; - rc = sqlite3LockAndPrepare(db,zSql,nBytes,0,0,ppStmt,pzTail); + rc = tdsqlite3LockAndPrepare(db,zSql,nBytes,0,0,ppStmt,pzTail); assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ return rc; } -SQLITE_API int sqlite3_prepare_v2( - sqlite3 *db, /* Database handle. */ +SQLITE_API int tdsqlite3_prepare_v2( + tdsqlite3 *db, /* Database handle. */ const char *zSql, /* UTF-8 encoded SQL statement. */ int nBytes, /* Length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ + tdsqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ const char **pzTail /* OUT: End of parsed string */ ){ int rc; - /* EVIDENCE-OF: R-37923-12173 The sqlite3_prepare_v2() interface works - ** exactly the same as sqlite3_prepare_v3() with a zero prepFlags + /* EVIDENCE-OF: R-37923-12173 The tdsqlite3_prepare_v2() interface works + ** exactly the same as tdsqlite3_prepare_v3() with a zero prepFlags ** parameter. ** - ** Proof in that the 5th parameter to sqlite3LockAndPrepare is 0 */ - rc = sqlite3LockAndPrepare(db,zSql,nBytes,SQLITE_PREPARE_SAVESQL,0, + ** Proof in that the 5th parameter to tdsqlite3LockAndPrepare is 0 */ + rc = tdsqlite3LockAndPrepare(db,zSql,nBytes,SQLITE_PREPARE_SAVESQL,0, ppStmt,pzTail); assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); return rc; } -SQLITE_API int sqlite3_prepare_v3( - sqlite3 *db, /* Database handle. */ +SQLITE_API int tdsqlite3_prepare_v3( + tdsqlite3 *db, /* Database handle. */ const char *zSql, /* UTF-8 encoded SQL statement. */ int nBytes, /* Length of zSql in bytes. */ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ + tdsqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ const char **pzTail /* OUT: End of parsed string */ ){ int rc; - /* EVIDENCE-OF: R-56861-42673 sqlite3_prepare_v3() differs from - ** sqlite3_prepare_v2() only in having the extra prepFlags parameter, + /* EVIDENCE-OF: R-56861-42673 tdsqlite3_prepare_v3() differs from + ** tdsqlite3_prepare_v2() only in having the extra prepFlags parameter, ** which is a bit array consisting of zero or more of the ** SQLITE_PREPARE_* flags. ** - ** Proof by comparison to the implementation of sqlite3_prepare_v2() + ** Proof by comparison to the implementation of tdsqlite3_prepare_v2() ** directly above. */ - rc = sqlite3LockAndPrepare(db,zSql,nBytes, + rc = tdsqlite3LockAndPrepare(db,zSql,nBytes, SQLITE_PREPARE_SAVESQL|(prepFlags&SQLITE_PREPARE_MASK), 0,ppStmt,pzTail); assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); @@ -132227,16 +132227,16 @@ SQLITE_API int sqlite3_prepare_v3( /* ** Compile the UTF-16 encoded SQL statement zSql into a statement handle. */ -static int sqlite3Prepare16( - sqlite3 *db, /* Database handle. */ +static int tdsqlite3Prepare16( + tdsqlite3 *db, /* Database handle. */ const void *zSql, /* UTF-16 encoded SQL statement. */ int nBytes, /* Length of zSql in bytes. */ u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ + tdsqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ const void **pzTail /* OUT: End of parsed string */ ){ /* This function currently works by first transforming the UTF-16 - ** encoded string to UTF-8, then invoking sqlite3_prepare(). The + ** encoded string to UTF-8, then invoking tdsqlite3_prepare(). The ** tricky bit is figuring out the pointer to return in *pzTail. */ char *zSql8; @@ -132247,7 +132247,7 @@ static int sqlite3Prepare16( if( ppStmt==0 ) return SQLITE_MISUSE_BKPT; #endif *ppStmt = 0; - if( !sqlite3SafetyCheckOk(db)||zSql==0 ){ + if( !tdsqlite3SafetyCheckOk(db)||zSql==0 ){ return SQLITE_MISUSE_BKPT; } if( nBytes>=0 ){ @@ -132256,24 +132256,24 @@ static int sqlite3Prepare16( for(sz=0; szmutex); - zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE); + tdsqlite3_mutex_enter(db->mutex); + zSql8 = tdsqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE); if( zSql8 ){ - rc = sqlite3LockAndPrepare(db, zSql8, -1, prepFlags, 0, ppStmt, &zTail8); + rc = tdsqlite3LockAndPrepare(db, zSql8, -1, prepFlags, 0, ppStmt, &zTail8); } if( zTail8 && pzTail ){ - /* If sqlite3_prepare returns a tail pointer, we calculate the + /* If tdsqlite3_prepare returns a tail pointer, we calculate the ** equivalent pointer into the UTF-16 string by counting the unicode ** characters between zSql8 and zTail8, and then returning a pointer ** the same number of characters into the UTF-16 string. */ - int chars_parsed = sqlite3Utf8CharLen(zSql8, (int)(zTail8-zSql8)); - *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, chars_parsed); + int chars_parsed = tdsqlite3Utf8CharLen(zSql8, (int)(zTail8-zSql8)); + *pzTail = (u8 *)zSql + tdsqlite3Utf16ByteLen(zSql, chars_parsed); } - sqlite3DbFree(db, zSql8); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); + tdsqlite3DbFree(db, zSql8); + rc = tdsqlite3ApiExit(db, rc); + tdsqlite3_mutex_leave(db->mutex); return rc; } @@ -132281,44 +132281,44 @@ static int sqlite3Prepare16( ** Two versions of the official API. Legacy and new use. In the legacy ** version, the original SQL text is not saved in the prepared statement ** and so if a schema change occurs, SQLITE_SCHEMA is returned by -** sqlite3_step(). In the new version, the original SQL text is retained +** tdsqlite3_step(). In the new version, the original SQL text is retained ** and the statement is automatically recompiled if an schema change ** occurs. */ -SQLITE_API int sqlite3_prepare16( - sqlite3 *db, /* Database handle. */ +SQLITE_API int tdsqlite3_prepare16( + tdsqlite3 *db, /* Database handle. */ const void *zSql, /* UTF-16 encoded SQL statement. */ int nBytes, /* Length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ + tdsqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ const void **pzTail /* OUT: End of parsed string */ ){ int rc; - rc = sqlite3Prepare16(db,zSql,nBytes,0,ppStmt,pzTail); + rc = tdsqlite3Prepare16(db,zSql,nBytes,0,ppStmt,pzTail); assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ return rc; } -SQLITE_API int sqlite3_prepare16_v2( - sqlite3 *db, /* Database handle. */ +SQLITE_API int tdsqlite3_prepare16_v2( + tdsqlite3 *db, /* Database handle. */ const void *zSql, /* UTF-16 encoded SQL statement. */ int nBytes, /* Length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ + tdsqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ const void **pzTail /* OUT: End of parsed string */ ){ int rc; - rc = sqlite3Prepare16(db,zSql,nBytes,SQLITE_PREPARE_SAVESQL,ppStmt,pzTail); + rc = tdsqlite3Prepare16(db,zSql,nBytes,SQLITE_PREPARE_SAVESQL,ppStmt,pzTail); assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ return rc; } -SQLITE_API int sqlite3_prepare16_v3( - sqlite3 *db, /* Database handle. */ +SQLITE_API int tdsqlite3_prepare16_v3( + tdsqlite3 *db, /* Database handle. */ const void *zSql, /* UTF-16 encoded SQL statement. */ int nBytes, /* Length of zSql in bytes. */ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ + tdsqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ const void **pzTail /* OUT: End of parsed string */ ){ int rc; - rc = sqlite3Prepare16(db,zSql,nBytes, + rc = tdsqlite3Prepare16(db,zSql,nBytes, SQLITE_PREPARE_SAVESQL|(prepFlags&SQLITE_PREPARE_MASK), ppStmt,pzTail); assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ @@ -132349,11 +132349,11 @@ SQLITE_API int sqlite3_prepare16_v3( ** Trace output macros */ #if SELECTTRACE_ENABLED -/***/ int sqlite3SelectTrace = 0; +/***/ int tdsqlite3SelectTrace = 0; # define SELECTTRACE(K,P,S,X) \ - if(sqlite3SelectTrace&(K)) \ - sqlite3DebugPrintf("%u/%d/%p: ",(S)->selId,(P)->addrExplain,(S)),\ - sqlite3DebugPrintf X + if(tdsqlite3SelectTrace&(K)) \ + tdsqlite3DebugPrintf("%u/%d/%p: ",(S)->selId,(P)->addrExplain,(S)),\ + tdsqlite3DebugPrintf X #else # define SELECTTRACE(K,P,S,X) #endif @@ -132417,27 +132417,27 @@ struct SortCtx { ** Delete all the content of a Select structure. Deallocate the structure ** itself depending on the value of bFree ** -** If bFree==1, call sqlite3DbFree() on the p object. +** If bFree==1, call tdsqlite3DbFree() on the p object. ** If bFree==0, Leave the first Select object unfreed */ -static void clearSelect(sqlite3 *db, Select *p, int bFree){ +static void clearSelect(tdsqlite3 *db, Select *p, int bFree){ while( p ){ Select *pPrior = p->pPrior; - sqlite3ExprListDelete(db, p->pEList); - sqlite3SrcListDelete(db, p->pSrc); - sqlite3ExprDelete(db, p->pWhere); - sqlite3ExprListDelete(db, p->pGroupBy); - sqlite3ExprDelete(db, p->pHaving); - sqlite3ExprListDelete(db, p->pOrderBy); - sqlite3ExprDelete(db, p->pLimit); + tdsqlite3ExprListDelete(db, p->pEList); + tdsqlite3SrcListDelete(db, p->pSrc); + tdsqlite3ExprDelete(db, p->pWhere); + tdsqlite3ExprListDelete(db, p->pGroupBy); + tdsqlite3ExprDelete(db, p->pHaving); + tdsqlite3ExprListDelete(db, p->pOrderBy); + tdsqlite3ExprDelete(db, p->pLimit); #ifndef SQLITE_OMIT_WINDOWFUNC if( OK_IF_ALWAYS_TRUE(p->pWinDefn) ){ - sqlite3WindowListDelete(db, p->pWinDefn); + tdsqlite3WindowListDelete(db, p->pWinDefn); } assert( p->pWin==0 ); #endif - if( OK_IF_ALWAYS_TRUE(p->pWith) ) sqlite3WithDelete(db, p->pWith); - if( bFree ) sqlite3DbFreeNN(db, p); + if( OK_IF_ALWAYS_TRUE(p->pWith) ) tdsqlite3WithDelete(db, p->pWith); + if( bFree ) tdsqlite3DbFreeNN(db, p); p = pPrior; bFree = 1; } @@ -132446,7 +132446,7 @@ static void clearSelect(sqlite3 *db, Select *p, int bFree){ /* ** Initialize a SelectDest structure. */ -SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest *pDest, int eDest, int iParm){ +SQLITE_PRIVATE void tdsqlite3SelectDestInit(SelectDest *pDest, int eDest, int iParm){ pDest->eDest = (u8)eDest; pDest->iSDParm = iParm; pDest->zAffSdst = 0; @@ -132459,7 +132459,7 @@ SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest *pDest, int eDest, int iPar ** Allocate a new Select structure and return a pointer to that ** structure. */ -SQLITE_PRIVATE Select *sqlite3SelectNew( +SQLITE_PRIVATE Select *tdsqlite3SelectNew( Parse *pParse, /* Parsing context */ ExprList *pEList, /* which columns to include in the result */ SrcList *pSrc, /* the FROM clause -- which tables to scan */ @@ -132472,14 +132472,14 @@ SQLITE_PRIVATE Select *sqlite3SelectNew( ){ Select *pNew; Select standin; - pNew = sqlite3DbMallocRawNN(pParse->db, sizeof(*pNew) ); + pNew = tdsqlite3DbMallocRawNN(pParse->db, sizeof(*pNew) ); if( pNew==0 ){ assert( pParse->db->mallocFailed ); pNew = &standin; } if( pEList==0 ){ - pEList = sqlite3ExprListAppend(pParse, 0, - sqlite3Expr(pParse->db,TK_ASTERISK,0)); + pEList = tdsqlite3ExprListAppend(pParse, 0, + tdsqlite3Expr(pParse->db,TK_ASTERISK,0)); } pNew->pEList = pEList; pNew->op = TK_SELECT; @@ -132490,7 +132490,7 @@ SQLITE_PRIVATE Select *sqlite3SelectNew( pNew->addrOpenEphm[0] = -1; pNew->addrOpenEphm[1] = -1; pNew->nSelectRow = 0; - if( pSrc==0 ) pSrc = sqlite3DbMallocZero(pParse->db, sizeof(*pSrc)); + if( pSrc==0 ) pSrc = tdsqlite3DbMallocZero(pParse->db, sizeof(*pSrc)); pNew->pSrc = pSrc; pNew->pWhere = pWhere; pNew->pGroupBy = pGroupBy; @@ -132518,7 +132518,7 @@ SQLITE_PRIVATE Select *sqlite3SelectNew( /* ** Delete the given Select structure and all of its substructures. */ -SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3 *db, Select *p){ +SQLITE_PRIVATE void tdsqlite3SelectDelete(tdsqlite3 *db, Select *p){ if( OK_IF_ALWAYS_TRUE(p) ) clearSelect(db, p, 1); } @@ -132527,13 +132527,13 @@ SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3 *db, Select *p){ ** p to be a single SELECT where every column of the result set has a ** value of NULL. */ -SQLITE_PRIVATE void sqlite3SelectReset(Parse *pParse, Select *p){ +SQLITE_PRIVATE void tdsqlite3SelectReset(Parse *pParse, Select *p){ if( ALWAYS(p) ){ clearSelect(pParse->db, p, 0); memset(&p->iLimit, 0, sizeof(Select) - offsetof(Select,iLimit)); - p->pEList = sqlite3ExprListAppend(pParse, 0, - sqlite3ExprAlloc(pParse->db,TK_NULL,0,0)); - p->pSrc = sqlite3DbMallocZero(pParse->db, sizeof(SrcList)); + p->pEList = tdsqlite3ExprListAppend(pParse, 0, + tdsqlite3ExprAlloc(pParse->db,TK_NULL,0,0)); + p->pSrc = tdsqlite3DbMallocZero(pParse->db, sizeof(SrcList)); } } @@ -132562,7 +132562,7 @@ static Select *findRightmost(Select *p){ ** If an illegal or unsupported join type is seen, then still return ** a join type, but put an error in the pParse structure. */ -SQLITE_PRIVATE int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){ +SQLITE_PRIVATE int tdsqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){ int jointype = 0; Token *apAll[3]; Token *p; @@ -132589,7 +132589,7 @@ SQLITE_PRIVATE int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *p p = apAll[i]; for(j=0; jn==aKeyword[j].nChar - && sqlite3StrNICmp((char*)p->z, &zKeyText[aKeyword[j].i], p->n)==0 ){ + && tdsqlite3StrNICmp((char*)p->z, &zKeyText[aKeyword[j].i], p->n)==0 ){ jointype |= aKeyword[j].code; break; } @@ -132607,12 +132607,12 @@ SQLITE_PRIVATE int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *p const char *zSp = " "; assert( pB!=0 ); if( pC==0 ){ zSp++; } - sqlite3ErrorMsg(pParse, "unknown or unsupported join type: " + tdsqlite3ErrorMsg(pParse, "unknown or unsupported join type: " "%T %T%s%T", pA, pB, zSp, pC); jointype = JT_INNER; }else if( (jointype & JT_OUTER)!=0 && (jointype & (JT_LEFT|JT_RIGHT))!=JT_LEFT ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "RIGHT and FULL OUTER JOINs are not currently supported"); jointype = JT_INNER; } @@ -132626,7 +132626,7 @@ SQLITE_PRIVATE int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *p static int columnIndex(Table *pTab, const char *zCol){ int i; for(i=0; inCol; i++){ - if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i; + if( tdsqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i; } return -1; } @@ -132688,7 +132688,7 @@ static void addWhereTerm( int isOuterJoin, /* True if this is an OUTER join */ Expr **ppWhere /* IN/OUT: The WHERE clause to add to */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Expr *pE1; Expr *pE2; Expr *pEq; @@ -132698,17 +132698,17 @@ static void addWhereTerm( assert( pSrc->a[iLeft].pTab ); assert( pSrc->a[iRight].pTab ); - pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iColLeft); - pE2 = sqlite3CreateColumnExpr(db, pSrc, iRight, iColRight); + pE1 = tdsqlite3CreateColumnExpr(db, pSrc, iLeft, iColLeft); + pE2 = tdsqlite3CreateColumnExpr(db, pSrc, iRight, iColRight); - pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2); + pEq = tdsqlite3PExpr(pParse, TK_EQ, pE1, pE2); if( pEq && isOuterJoin ){ ExprSetProperty(pEq, EP_FromJoin); assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) ); ExprSetVVAProperty(pEq, EP_NoReduce); pEq->iRightJoinTable = (i16)pE2->iTable; } - *ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq); + *ppWhere = tdsqlite3ExprAnd(pParse, *ppWhere, pEq); } /* @@ -132737,7 +132737,7 @@ static void addWhereTerm( ** after the t1 loop and rows with t1.x!=5 will never appear in ** the output, which is incorrect. */ -SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){ +SQLITE_PRIVATE void tdsqlite3SetJoinExpr(Expr *p, int iTable){ while( p ){ ExprSetProperty(p, EP_FromJoin); assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); @@ -132746,15 +132746,15 @@ SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){ if( p->op==TK_FUNCTION && p->x.pList ){ int i; for(i=0; ix.pList->nExpr; i++){ - sqlite3SetJoinExpr(p->x.pList->a[i].pExpr, iTable); + tdsqlite3SetJoinExpr(p->x.pList->a[i].pExpr, iTable); } } - sqlite3SetJoinExpr(p->pLeft, iTable); + tdsqlite3SetJoinExpr(p->pLeft, iTable); p = p->pRight; } } -/* Undo the work of sqlite3SetJoinExpr(). In the expression p, convert every +/* Undo the work of tdsqlite3SetJoinExpr(). In the expression p, convert every ** term that is marked with EP_FromJoin and iRightJoinTable==iTable into ** an ordinary term that omits the EP_FromJoin mark. ** @@ -132812,7 +132812,7 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){ */ if( pRight->fg.jointype & JT_NATURAL ){ if( pRight->pOn || pRight->pUsing ){ - sqlite3ErrorMsg(pParse, "a NATURAL join may not have " + tdsqlite3ErrorMsg(pParse, "a NATURAL join may not have " "an ON or USING clause", 0); return 1; } @@ -132833,7 +132833,7 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){ /* Disallow both ON and USING clauses in the same join */ if( pRight->pOn && pRight->pUsing ){ - sqlite3ErrorMsg(pParse, "cannot have both ON and USING " + tdsqlite3ErrorMsg(pParse, "cannot have both ON and USING " "clauses in the same join"); return 1; } @@ -132842,8 +132842,8 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){ ** an AND operator. */ if( pRight->pOn ){ - if( isOuter ) sqlite3SetJoinExpr(pRight->pOn, pRight->iCursor); - p->pWhere = sqlite3ExprAnd(pParse, p->pWhere, pRight->pOn); + if( isOuter ) tdsqlite3SetJoinExpr(pRight->pOn, pRight->iCursor); + p->pWhere = tdsqlite3ExprAnd(pParse, p->pWhere, pRight->pOn); pRight->pOn = 0; } @@ -132867,7 +132867,7 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){ if( iRightCol<0 || !tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol, 0) ){ - sqlite3ErrorMsg(pParse, "cannot join using column %s - column " + tdsqlite3ErrorMsg(pParse, "cannot join using column %s - column " "not present in both tables", zName); return 1; } @@ -132902,12 +132902,12 @@ static void innerLoopLoadRow( Select *pSelect, /* The query being coded */ RowLoadInfo *pInfo /* Info needed to complete the row load */ ){ - sqlite3ExprCodeExprList(pParse, pSelect->pEList, pInfo->regResult, + tdsqlite3ExprCodeExprList(pParse, pSelect->pEList, pInfo->regResult, 0, pInfo->ecelFlags); #ifdef SQLITE_ENABLE_SORTER_REFERENCES if( pInfo->pExtra ){ - sqlite3ExprCodeExprList(pParse, pInfo->pExtra, pInfo->regExtraResult, 0, 0); - sqlite3ExprListDelete(pParse->db, pInfo->pExtra); + tdsqlite3ExprCodeExprList(pParse, pInfo->pExtra, pInfo->regExtraResult, 0, 0); + tdsqlite3ExprListDelete(pParse->db, pInfo->pExtra); } #endif } @@ -132931,7 +132931,7 @@ static int makeSorterRecord( if( pSort->pDeferredRowLoad ){ innerLoopLoadRow(pParse, pSelect, pSort->pDeferredRowLoad); } - sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase+nOBSat, nBase-nOBSat, regOut); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, regBase+nOBSat, nBase-nOBSat, regOut); return regOut; } @@ -132985,14 +132985,14 @@ static void pushOntoSorter( } assert( pSelect->iOffset==0 || pSelect->iLimit!=0 ); iLimit = pSelect->iOffset ? pSelect->iOffset+1 : pSelect->iLimit; - pSort->labelDone = sqlite3VdbeMakeLabel(pParse); - sqlite3ExprCodeExprList(pParse, pSort->pOrderBy, regBase, regOrigData, + pSort->labelDone = tdsqlite3VdbeMakeLabel(pParse); + tdsqlite3ExprCodeExprList(pParse, pSort->pOrderBy, regBase, regOrigData, SQLITE_ECEL_DUP | (regOrigData? SQLITE_ECEL_REF : 0)); if( bSeq ){ - sqlite3VdbeAddOp2(v, OP_Sequence, pSort->iECursor, regBase+nExpr); + tdsqlite3VdbeAddOp2(v, OP_Sequence, pSort->iECursor, regBase+nExpr); } if( nPrefixReg==0 && nData>0 ){ - sqlite3ExprCodeMove(pParse, regData, regBase+nExpr+bSeq, nData); + tdsqlite3ExprCodeMove(pParse, regData, regBase+nExpr+bSeq, nData); } if( nOBSat>0 ){ int regPrevKey; /* The first nOBSat columns of the previous row */ @@ -133007,35 +133007,35 @@ static void pushOntoSorter( pParse->nMem += pSort->nOBSat; nKey = nExpr - pSort->nOBSat + bSeq; if( bSeq ){ - addrFirst = sqlite3VdbeAddOp1(v, OP_IfNot, regBase+nExpr); + addrFirst = tdsqlite3VdbeAddOp1(v, OP_IfNot, regBase+nExpr); }else{ - addrFirst = sqlite3VdbeAddOp1(v, OP_SequenceTest, pSort->iECursor); + addrFirst = tdsqlite3VdbeAddOp1(v, OP_SequenceTest, pSort->iECursor); } VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_Compare, regPrevKey, regBase, pSort->nOBSat); - pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex); + tdsqlite3VdbeAddOp3(v, OP_Compare, regPrevKey, regBase, pSort->nOBSat); + pOp = tdsqlite3VdbeGetOp(v, pSort->addrSortIndex); if( pParse->db->mallocFailed ) return; pOp->p2 = nKey + nData; pKI = pOp->p4.pKeyInfo; memset(pKI->aSortFlags, 0, pKI->nKeyField); /* Makes OP_Jump testable */ - sqlite3VdbeChangeP4(v, -1, (char*)pKI, P4_KEYINFO); + tdsqlite3VdbeChangeP4(v, -1, (char*)pKI, P4_KEYINFO); testcase( pKI->nAllField > pKI->nKeyField+2 ); - pOp->p4.pKeyInfo = sqlite3KeyInfoFromExprList(pParse,pSort->pOrderBy,nOBSat, + pOp->p4.pKeyInfo = tdsqlite3KeyInfoFromExprList(pParse,pSort->pOrderBy,nOBSat, pKI->nAllField-pKI->nKeyField-1); pOp = 0; /* Ensure pOp not used after sqltie3VdbeAddOp3() */ - addrJmp = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp3(v, OP_Jump, addrJmp+1, 0, addrJmp+1); VdbeCoverage(v); - pSort->labelBkOut = sqlite3VdbeMakeLabel(pParse); + addrJmp = tdsqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeAddOp3(v, OP_Jump, addrJmp+1, 0, addrJmp+1); VdbeCoverage(v); + pSort->labelBkOut = tdsqlite3VdbeMakeLabel(pParse); pSort->regReturn = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut); - sqlite3VdbeAddOp1(v, OP_ResetSorter, pSort->iECursor); + tdsqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut); + tdsqlite3VdbeAddOp1(v, OP_ResetSorter, pSort->iECursor); if( iLimit ){ - sqlite3VdbeAddOp2(v, OP_IfNot, iLimit, pSort->labelDone); + tdsqlite3VdbeAddOp2(v, OP_IfNot, iLimit, pSort->labelDone); VdbeCoverage(v); } - sqlite3VdbeJumpHere(v, addrFirst); - sqlite3ExprCodeMove(pParse, regBase, regPrevKey, pSort->nOBSat); - sqlite3VdbeJumpHere(v, addrJmp); + tdsqlite3VdbeJumpHere(v, addrFirst); + tdsqlite3ExprCodeMove(pParse, regBase, regPrevKey, pSort->nOBSat); + tdsqlite3VdbeJumpHere(v, addrJmp); } if( iLimit ){ /* At this point the values for the new sorter entry are stored @@ -133051,16 +133051,16 @@ static void pushOntoSorter( ** jump to the next iteration of the loop. If the pSort->labelOBLopt ** value is not zero, then it is a label of where to jump. Otherwise, ** just bypass the row insert logic. See the header comment on the - ** sqlite3WhereOrderByLimitOptLabel() function for additional info. + ** tdsqlite3WhereOrderByLimitOptLabel() function for additional info. */ int iCsr = pSort->iECursor; - sqlite3VdbeAddOp2(v, OP_IfNotZero, iLimit, sqlite3VdbeCurrentAddr(v)+4); + tdsqlite3VdbeAddOp2(v, OP_IfNotZero, iLimit, tdsqlite3VdbeCurrentAddr(v)+4); VdbeCoverage(v); - sqlite3VdbeAddOp2(v, OP_Last, iCsr, 0); - iSkip = sqlite3VdbeAddOp4Int(v, OP_IdxLE, + tdsqlite3VdbeAddOp2(v, OP_Last, iCsr, 0); + iSkip = tdsqlite3VdbeAddOp4Int(v, OP_IdxLE, iCsr, 0, regBase+nOBSat, nExpr-nOBSat); VdbeCoverage(v); - sqlite3VdbeAddOp1(v, OP_Delete, iCsr); + tdsqlite3VdbeAddOp1(v, OP_Delete, iCsr); } if( regRecord==0 ){ regRecord = makeSorterRecord(pParse, pSort, pSelect, regBase, nBase); @@ -133070,11 +133070,11 @@ static void pushOntoSorter( }else{ op = OP_IdxInsert; } - sqlite3VdbeAddOp4Int(v, op, pSort->iECursor, regRecord, + tdsqlite3VdbeAddOp4Int(v, op, pSort->iECursor, regRecord, regBase+nOBSat, nBase-nOBSat); if( iSkip ){ - sqlite3VdbeChangeP2(v, iSkip, - pSort->labelOBLopt ? pSort->labelOBLopt : sqlite3VdbeCurrentAddr(v)); + tdsqlite3VdbeChangeP2(v, iSkip, + pSort->labelOBLopt ? pSort->labelOBLopt : tdsqlite3VdbeCurrentAddr(v)); } } @@ -133087,7 +133087,7 @@ static void codeOffset( int iContinue /* Jump here to skip the current record */ ){ if( iOffset>0 ){ - sqlite3VdbeAddOp3(v, OP_IfPos, iOffset, iContinue, 1); VdbeCoverage(v); + tdsqlite3VdbeAddOp3(v, OP_IfPos, iOffset, iContinue, 1); VdbeCoverage(v); VdbeComment((v, "OFFSET")); } } @@ -133112,12 +133112,12 @@ static void codeDistinct( int r1; v = pParse->pVdbe; - r1 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp4Int(v, OP_Found, iTab, addrRepeat, iMem, N); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_MakeRecord, iMem, N, r1); - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r1, iMem, N); - sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); - sqlite3ReleaseTempReg(pParse, r1); + r1 = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp4Int(v, OP_Found, iTab, addrRepeat, iMem, N); VdbeCoverage(v); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, iMem, N, r1); + tdsqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r1, iMem, N); + tdsqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); + tdsqlite3ReleaseTempReg(pParse, r1); } #ifdef SQLITE_ENABLE_SORTER_REFERENCES @@ -133174,16 +133174,16 @@ static void selectExprDefer( int k; Index *pPk = 0; if( !HasRowid(pTab) ){ - pPk = sqlite3PrimaryKeyIndex(pTab); + pPk = tdsqlite3PrimaryKeyIndex(pTab); nKey = pPk->nKeyCol; } for(k=0; kiTable = pExpr->iTable; pNew->y.pTab = pExpr->y.pTab; pNew->iColumn = pPk ? pPk->aiColumn[k] : -1; - pExtra = sqlite3ExprListAppend(pParse, pExtra, pNew); + pExtra = tdsqlite3ExprListAppend(pParse, pExtra, pNew); } } pSort->aDefer[nDefer].pTab = pExpr->y.pTab; @@ -133270,7 +133270,7 @@ static void selectInnerLoop( regOrig = regResult = pDest->iSdst; if( srcTab>=0 ){ for(i=0; ipEList->a[i].zEName)); } }else if( eDest!=SRT_Exists ){ @@ -133310,7 +133310,7 @@ static void selectInnerLoop( ** instruction to account for the larger records. This is only ** required if there are one or more WITHOUT ROWID tables with ** composite primary keys in the SortCtx.aDefer[] array. */ - VdbeOp *pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex); + VdbeOp *pOp = tdsqlite3VdbeGetOp(v, pSort->addrSortIndex); pOp->p2 += (pExtra->nExpr - pSort->nDefer); pOp->p4.pKeyInfo->nAllField += (pExtra->nExpr - pSort->nDefer); pParse->nMem += pExtra->nExpr; @@ -133380,33 +133380,33 @@ static void selectInnerLoop( ** fail on the first iteration of the loop even if the first ** row is all NULLs. */ - sqlite3VdbeChangeToNoop(v, pDistinct->addrTnct); - pOp = sqlite3VdbeGetOp(v, pDistinct->addrTnct); + tdsqlite3VdbeChangeToNoop(v, pDistinct->addrTnct); + pOp = tdsqlite3VdbeGetOp(v, pDistinct->addrTnct); pOp->opcode = OP_Null; pOp->p1 = 1; pOp->p2 = regPrev; - pOp = 0; /* Ensure pOp is not used after sqlite3VdbeAddOp() */ + pOp = 0; /* Ensure pOp is not used after tdsqlite3VdbeAddOp() */ - iJump = sqlite3VdbeCurrentAddr(v) + nResultCol; + iJump = tdsqlite3VdbeCurrentAddr(v) + nResultCol; for(i=0; ipEList->a[i].pExpr); + CollSeq *pColl = tdsqlite3ExprCollSeq(pParse, p->pEList->a[i].pExpr); if( idb->mallocFailed ); - sqlite3VdbeAddOp3(v, OP_Copy, regResult, regPrev, nResultCol-1); + assert( tdsqlite3VdbeCurrentAddr(v)==iJump || pParse->db->mallocFailed ); + tdsqlite3VdbeAddOp3(v, OP_Copy, regResult, regPrev, nResultCol-1); break; } case WHERE_DISTINCT_UNIQUE: { - sqlite3VdbeChangeToNoop(v, pDistinct->addrTnct); + tdsqlite3VdbeChangeToNoop(v, pDistinct->addrTnct); break; } @@ -133429,10 +133429,10 @@ static void selectInnerLoop( #ifndef SQLITE_OMIT_COMPOUND_SELECT case SRT_Union: { int r1; - r1 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r1); - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, regResult, nResultCol); - sqlite3ReleaseTempReg(pParse, r1); + r1 = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r1); + tdsqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, regResult, nResultCol); + tdsqlite3ReleaseTempReg(pParse, r1); break; } @@ -133441,7 +133441,7 @@ static void selectInnerLoop( ** the temporary table iParm. */ case SRT_Except: { - sqlite3VdbeAddOp3(v, OP_IdxDelete, iParm, regResult, nResultCol); + tdsqlite3VdbeAddOp3(v, OP_IdxDelete, iParm, regResult, nResultCol); break; } #endif /* SQLITE_OMIT_COMPOUND_SELECT */ @@ -133452,12 +133452,12 @@ static void selectInnerLoop( case SRT_DistFifo: case SRT_Table: case SRT_EphemTab: { - int r1 = sqlite3GetTempRange(pParse, nPrefixReg+1); + int r1 = tdsqlite3GetTempRange(pParse, nPrefixReg+1); testcase( eDest==SRT_Table ); testcase( eDest==SRT_EphemTab ); testcase( eDest==SRT_Fifo ); testcase( eDest==SRT_DistFifo ); - sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r1+nPrefixReg); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r1+nPrefixReg); #ifndef SQLITE_OMIT_CTE if( eDest==SRT_DistFifo ){ /* If the destination is DistFifo, then cursor (iParm+1) is open @@ -133465,10 +133465,10 @@ static void selectInnerLoop( ** in the index, do not write it to the output. If not, add the ** current row to the index and proceed with writing it to the ** output table as well. */ - int addr = sqlite3VdbeCurrentAddr(v) + 4; - sqlite3VdbeAddOp4Int(v, OP_Found, iParm+1, addr, r1, 0); + int addr = tdsqlite3VdbeCurrentAddr(v) + 4; + tdsqlite3VdbeAddOp4Int(v, OP_Found, iParm+1, addr, r1, 0); VdbeCoverage(v); - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm+1, r1,regResult,nResultCol); + tdsqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm+1, r1,regResult,nResultCol); assert( pSort==0 ); } #endif @@ -133476,13 +133476,13 @@ static void selectInnerLoop( assert( regResult==regOrig ); pushOntoSorter(pParse, pSort, p, r1+nPrefixReg, regOrig, 1, nPrefixReg); }else{ - int r2 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, r2); - sqlite3VdbeAddOp3(v, OP_Insert, iParm, r1, r2); - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); - sqlite3ReleaseTempReg(pParse, r2); + int r2 = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp2(v, OP_NewRowid, iParm, r2); + tdsqlite3VdbeAddOp3(v, OP_Insert, iParm, r1, r2); + tdsqlite3VdbeChangeP5(v, OPFLAG_APPEND); + tdsqlite3ReleaseTempReg(pParse, r2); } - sqlite3ReleaseTempRange(pParse, r1, nPrefixReg+1); + tdsqlite3ReleaseTempRange(pParse, r1, nPrefixReg+1); break; } @@ -133500,12 +133500,12 @@ static void selectInnerLoop( pushOntoSorter( pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg); }else{ - int r1 = sqlite3GetTempReg(pParse); - assert( sqlite3Strlen30(pDest->zAffSdst)==nResultCol ); - sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult, nResultCol, + int r1 = tdsqlite3GetTempReg(pParse); + assert( tdsqlite3Strlen30(pDest->zAffSdst)==nResultCol ); + tdsqlite3VdbeAddOp4(v, OP_MakeRecord, regResult, nResultCol, r1, pDest->zAffSdst, nResultCol); - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, regResult, nResultCol); - sqlite3ReleaseTempReg(pParse, r1); + tdsqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, regResult, nResultCol); + tdsqlite3ReleaseTempReg(pParse, r1); } break; } @@ -133513,7 +133513,7 @@ static void selectInnerLoop( /* If any row exist in the result set, record that fact and abort. */ case SRT_Exists: { - sqlite3VdbeAddOp2(v, OP_Integer, 1, iParm); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, iParm); /* The LIMIT clause will terminate the loop for us */ break; } @@ -133544,9 +133544,9 @@ static void selectInnerLoop( pushOntoSorter(pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg); }else if( eDest==SRT_Coroutine ){ - sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); + tdsqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); }else{ - sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, nResultCol); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, regResult, nResultCol); } break; } @@ -133567,33 +133567,33 @@ static void selectInnerLoop( pSO = pDest->pOrderBy; assert( pSO ); nKey = pSO->nExpr; - r1 = sqlite3GetTempReg(pParse); - r2 = sqlite3GetTempRange(pParse, nKey+2); + r1 = tdsqlite3GetTempReg(pParse); + r2 = tdsqlite3GetTempRange(pParse, nKey+2); r3 = r2+nKey+1; if( eDest==SRT_DistQueue ){ /* If the destination is DistQueue, then cursor (iParm+1) is open ** on a second ephemeral index that holds all values every previously ** added to the queue. */ - addrTest = sqlite3VdbeAddOp4Int(v, OP_Found, iParm+1, 0, + addrTest = tdsqlite3VdbeAddOp4Int(v, OP_Found, iParm+1, 0, regResult, nResultCol); VdbeCoverage(v); } - sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r3); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r3); if( eDest==SRT_DistQueue ){ - sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm+1, r3); - sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); + tdsqlite3VdbeAddOp2(v, OP_IdxInsert, iParm+1, r3); + tdsqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); } for(i=0; ia[i].u.x.iOrderByCol - 1, r2+i); } - sqlite3VdbeAddOp2(v, OP_Sequence, iParm, r2+nKey); - sqlite3VdbeAddOp3(v, OP_MakeRecord, r2, nKey+2, r1); - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, r2, nKey+2); - if( addrTest ) sqlite3VdbeJumpHere(v, addrTest); - sqlite3ReleaseTempReg(pParse, r1); - sqlite3ReleaseTempRange(pParse, r2, nKey+2); + tdsqlite3VdbeAddOp2(v, OP_Sequence, iParm, r2+nKey); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, r2, nKey+2, r1); + tdsqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, r2, nKey+2); + if( addrTest ) tdsqlite3VdbeJumpHere(v, addrTest); + tdsqlite3ReleaseTempReg(pParse, r1); + tdsqlite3ReleaseTempRange(pParse, r2, nKey+2); break; } #endif /* SQLITE_OMIT_CTE */ @@ -133618,7 +133618,7 @@ static void selectInnerLoop( ** the output for us. */ if( pSort==0 && p->iLimit ){ - sqlite3VdbeAddOp2(v, OP_DecrJumpZero, p->iLimit, iBreak); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_DecrJumpZero, p->iLimit, iBreak); VdbeCoverage(v); } } @@ -133626,9 +133626,9 @@ static void selectInnerLoop( ** Allocate a KeyInfo object sufficient for an index of N key columns and ** X extra columns. */ -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){ +SQLITE_PRIVATE KeyInfo *tdsqlite3KeyInfoAlloc(tdsqlite3 *db, int N, int X){ int nExtra = (N+X)*(sizeof(CollSeq*)+1) - sizeof(CollSeq*); - KeyInfo *p = sqlite3DbMallocRawNN(db, sizeof(KeyInfo) + nExtra); + KeyInfo *p = tdsqlite3DbMallocRawNN(db, sizeof(KeyInfo) + nExtra); if( p ){ p->aSortFlags = (u8*)&p->aColl[N+X]; p->nKeyField = (u16)N; @@ -133638,7 +133638,7 @@ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){ p->nRef = 1; memset(&p[1], 0, nExtra); }else{ - sqlite3OomFault(db); + tdsqlite3OomFault(db); } return p; } @@ -133646,18 +133646,18 @@ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){ /* ** Deallocate a KeyInfo object */ -SQLITE_PRIVATE void sqlite3KeyInfoUnref(KeyInfo *p){ +SQLITE_PRIVATE void tdsqlite3KeyInfoUnref(KeyInfo *p){ if( p ){ assert( p->nRef>0 ); p->nRef--; - if( p->nRef==0 ) sqlite3DbFreeNN(p->db, p); + if( p->nRef==0 ) tdsqlite3DbFreeNN(p->db, p); } } /* ** Make a new pointer to a KeyInfo object */ -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoRef(KeyInfo *p){ +SQLITE_PRIVATE KeyInfo *tdsqlite3KeyInfoRef(KeyInfo *p){ if( p ){ assert( p->nRef>0 ); p->nRef++; @@ -133672,7 +133672,7 @@ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoRef(KeyInfo *p){ ** ** This routine is used only inside of assert() statements. */ -SQLITE_PRIVATE int sqlite3KeyInfoIsWriteable(KeyInfo *p){ return p->nRef==1; } +SQLITE_PRIVATE int tdsqlite3KeyInfoIsWriteable(KeyInfo *p){ return p->nRef==1; } #endif /* SQLITE_DEBUG */ /* @@ -133689,7 +133689,7 @@ SQLITE_PRIVATE int sqlite3KeyInfoIsWriteable(KeyInfo *p){ return p->nRef==1; } ** function is responsible for seeing that this structure is eventually ** freed. */ -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoFromExprList( +SQLITE_PRIVATE KeyInfo *tdsqlite3KeyInfoFromExprList( Parse *pParse, /* Parsing context */ ExprList *pList, /* Form the KeyInfo object from this ExprList */ int iStart, /* Begin with this column of pList */ @@ -133698,15 +133698,15 @@ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoFromExprList( int nExpr; KeyInfo *pInfo; struct ExprList_item *pItem; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; int i; nExpr = pList->nExpr; - pInfo = sqlite3KeyInfoAlloc(db, nExpr-iStart, nExtra+1); + pInfo = tdsqlite3KeyInfoAlloc(db, nExpr-iStart, nExtra+1); if( pInfo ){ - assert( sqlite3KeyInfoIsWriteable(pInfo) ); + assert( tdsqlite3KeyInfoIsWriteable(pInfo) ); for(i=iStart, pItem=pList->a+iStart; iaColl[i-iStart] = sqlite3ExprNNCollSeq(pParse, pItem->pExpr); + pInfo->aColl[i-iStart] = tdsqlite3ExprNNCollSeq(pParse, pItem->pExpr); pInfo->aSortFlags[i-iStart] = pItem->sortFlags; } } @@ -133745,7 +133745,7 @@ static void explainTempTable(Parse *pParse, const char *zUsage){ /* ** Assign expression b to lvalue a. A second, no-op, version of this macro ** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code -** in sqlite3Select() to assign values to structure member variables that +** in tdsqlite3Select() to assign values to structure member variables that ** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the ** code with #ifndef directives. */ @@ -133773,7 +133773,7 @@ static void generateSortTail( ){ Vdbe *v = pParse->pVdbe; /* The prepared statement */ int addrBreak = pSort->labelDone; /* Jump here to exit loop */ - int addrContinue = sqlite3VdbeMakeLabel(pParse);/* Jump here for next cycle */ + int addrContinue = tdsqlite3VdbeMakeLabel(pParse);/* Jump here for next cycle */ int addr; /* Top of output loop. Jump for Next. */ int addrOnce = 0; int iTab; @@ -133792,17 +133792,17 @@ static void generateSortTail( assert( addrBreak<0 ); if( pSort->labelBkOut ){ - sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut); - sqlite3VdbeGoto(v, addrBreak); - sqlite3VdbeResolveLabel(v, pSort->labelBkOut); + tdsqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut); + tdsqlite3VdbeGoto(v, addrBreak); + tdsqlite3VdbeResolveLabel(v, pSort->labelBkOut); } #ifdef SQLITE_ENABLE_SORTER_REFERENCES /* Open any cursors needed for sorter-reference expressions */ for(i=0; inDefer; i++){ Table *pTab = pSort->aDefer[i].pTab; - int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - sqlite3OpenTable(pParse, pSort->aDefer[i].iCsr, iDb, pTab, OP_OpenRead); + int iDb = tdsqlite3SchemaToIndex(pParse->db, pTab->pSchema); + tdsqlite3OpenTable(pParse, pSort->aDefer[i].iCsr, iDb, pTab, OP_OpenRead); nRefKey = MAX(nRefKey, pSort->aDefer[i].nKey); } #endif @@ -133812,12 +133812,12 @@ static void generateSortTail( regRowid = 0; regRow = pDest->iSdst; }else{ - regRowid = sqlite3GetTempReg(pParse); + regRowid = tdsqlite3GetTempReg(pParse); if( eDest==SRT_EphemTab || eDest==SRT_Table ){ - regRow = sqlite3GetTempReg(pParse); + regRow = tdsqlite3GetTempReg(pParse); nColumn = 0; }else{ - regRow = sqlite3GetTempRange(pParse, nColumn); + regRow = tdsqlite3GetTempRange(pParse, nColumn); } } nKey = pOrderBy->nExpr - pSort->nOBSat; @@ -133825,18 +133825,18 @@ static void generateSortTail( int regSortOut = ++pParse->nMem; iSortTab = pParse->nTab++; if( pSort->labelBkOut ){ - addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); + addrOnce = tdsqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } - sqlite3VdbeAddOp3(v, OP_OpenPseudo, iSortTab, regSortOut, + tdsqlite3VdbeAddOp3(v, OP_OpenPseudo, iSortTab, regSortOut, nKey+1+nColumn+nRefKey); - if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce); - addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak); + if( addrOnce ) tdsqlite3VdbeJumpHere(v, addrOnce); + addr = 1 + tdsqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak); VdbeCoverage(v); codeOffset(v, p->iOffset, addrContinue); - sqlite3VdbeAddOp3(v, OP_SorterData, iTab, regSortOut, iSortTab); + tdsqlite3VdbeAddOp3(v, OP_SorterData, iTab, regSortOut, iSortTab); bSeq = 0; }else{ - addr = 1 + sqlite3VdbeAddOp2(v, OP_Sort, iTab, addrBreak); VdbeCoverage(v); + addr = 1 + tdsqlite3VdbeAddOp2(v, OP_Sort, iTab, addrBreak); VdbeCoverage(v); codeOffset(v, p->iOffset, addrContinue); iSortTab = iTab; bSeq = 1; @@ -133850,38 +133850,38 @@ static void generateSortTail( #ifdef SQLITE_ENABLE_SORTER_REFERENCES if( pSort->nDefer ){ int iKey = iCol+1; - int regKey = sqlite3GetTempRange(pParse, nRefKey); + int regKey = tdsqlite3GetTempRange(pParse, nRefKey); for(i=0; inDefer; i++){ int iCsr = pSort->aDefer[i].iCsr; Table *pTab = pSort->aDefer[i].pTab; int nKey = pSort->aDefer[i].nKey; - sqlite3VdbeAddOp1(v, OP_NullRow, iCsr); + tdsqlite3VdbeAddOp1(v, OP_NullRow, iCsr); if( HasRowid(pTab) ){ - sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iKey++, regKey); - sqlite3VdbeAddOp3(v, OP_SeekRowid, iCsr, - sqlite3VdbeCurrentAddr(v)+1, regKey); + tdsqlite3VdbeAddOp3(v, OP_Column, iSortTab, iKey++, regKey); + tdsqlite3VdbeAddOp3(v, OP_SeekRowid, iCsr, + tdsqlite3VdbeCurrentAddr(v)+1, regKey); }else{ int k; int iJmp; - assert( sqlite3PrimaryKeyIndex(pTab)->nKeyCol==nKey ); + assert( tdsqlite3PrimaryKeyIndex(pTab)->nKeyCol==nKey ); for(k=0; k=0; i--){ #ifdef SQLITE_ENABLE_SORTER_REFERENCES if( aOutEx[i].bSorterRef ){ - sqlite3ExprCode(pParse, aOutEx[i].pExpr, regRow+i); + tdsqlite3ExprCode(pParse, aOutEx[i].pExpr, regRow+i); }else #endif { @@ -133891,25 +133891,25 @@ static void generateSortTail( }else{ iRead = iCol--; } - sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iRead, regRow+i); + tdsqlite3VdbeAddOp3(v, OP_Column, iSortTab, iRead, regRow+i); VdbeComment((v, "%s", aOutEx[i].zEName)); } } switch( eDest ){ case SRT_Table: case SRT_EphemTab: { - sqlite3VdbeAddOp3(v, OP_Column, iSortTab, nKey+bSeq, regRow); - sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid); - sqlite3VdbeAddOp3(v, OP_Insert, iParm, regRow, regRowid); - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); + tdsqlite3VdbeAddOp3(v, OP_Column, iSortTab, nKey+bSeq, regRow); + tdsqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid); + tdsqlite3VdbeAddOp3(v, OP_Insert, iParm, regRow, regRowid); + tdsqlite3VdbeChangeP5(v, OPFLAG_APPEND); break; } #ifndef SQLITE_OMIT_SUBQUERY case SRT_Set: { - assert( nColumn==sqlite3Strlen30(pDest->zAffSdst) ); - sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, nColumn, regRowid, + assert( nColumn==tdsqlite3Strlen30(pDest->zAffSdst) ); + tdsqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, nColumn, regRowid, pDest->zAffSdst, nColumn); - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, regRowid, regRow, nColumn); + tdsqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, regRowid, regRow, nColumn); break; } case SRT_Mem: { @@ -133922,31 +133922,31 @@ static void generateSortTail( testcase( eDest==SRT_Output ); testcase( eDest==SRT_Coroutine ); if( eDest==SRT_Output ){ - sqlite3VdbeAddOp2(v, OP_ResultRow, pDest->iSdst, nColumn); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, pDest->iSdst, nColumn); }else{ - sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); + tdsqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); } break; } } if( regRowid ){ if( eDest==SRT_Set ){ - sqlite3ReleaseTempRange(pParse, regRow, nColumn); + tdsqlite3ReleaseTempRange(pParse, regRow, nColumn); }else{ - sqlite3ReleaseTempReg(pParse, regRow); + tdsqlite3ReleaseTempReg(pParse, regRow); } - sqlite3ReleaseTempReg(pParse, regRowid); + tdsqlite3ReleaseTempReg(pParse, regRowid); } /* The bottom of the loop */ - sqlite3VdbeResolveLabel(v, addrContinue); + tdsqlite3VdbeResolveLabel(v, addrContinue); if( pSort->sortFlags & SORTFLAG_UseSorter ){ - sqlite3VdbeAddOp2(v, OP_SorterNext, iTab, addr); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_SorterNext, iTab, addr); VdbeCoverage(v); }else{ - sqlite3VdbeAddOp2(v, OP_Next, iTab, addr); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_Next, iTab, addr); VdbeCoverage(v); } - if( pSort->regReturn ) sqlite3VdbeAddOp1(v, OP_Return, pSort->regReturn); - sqlite3VdbeResolveLabel(v, addrBreak); + if( pSort->regReturn ) tdsqlite3VdbeAddOp1(v, OP_Return, pSort->regReturn); + tdsqlite3VdbeResolveLabel(v, addrBreak); } /* @@ -134069,11 +134069,11 @@ static const char *columnTypeImpl( zOrigCol = "rowid"; }else{ zOrigCol = pTab->aCol[iCol].zName; - zType = sqlite3ColumnType(&pTab->aCol[iCol],0); + zType = tdsqlite3ColumnType(&pTab->aCol[iCol],0); } zOrigTab = pTab->zName; if( pNC->pParse && pTab->pSchema ){ - int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema); + int iDb = tdsqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema); zOrigDb = pNC->pParse->db->aDb[iDb].zDbSName; } #else @@ -134081,7 +134081,7 @@ static const char *columnTypeImpl( if( iCol<0 ){ zType = "INTEGER"; }else{ - zType = sqlite3ColumnType(&pTab->aCol[iCol],0); + zType = tdsqlite3ColumnType(&pTab->aCol[iCol],0); } #endif } @@ -134146,13 +134146,13 @@ static void generateColumnTypes( ** column specific strings, in case the schema is reset before this ** virtual machine is deleted. */ - sqlite3VdbeSetColName(v, i, COLNAME_DATABASE, zOrigDb, SQLITE_TRANSIENT); - sqlite3VdbeSetColName(v, i, COLNAME_TABLE, zOrigTab, SQLITE_TRANSIENT); - sqlite3VdbeSetColName(v, i, COLNAME_COLUMN, zOrigCol, SQLITE_TRANSIENT); + tdsqlite3VdbeSetColName(v, i, COLNAME_DATABASE, zOrigDb, SQLITE_TRANSIENT); + tdsqlite3VdbeSetColName(v, i, COLNAME_TABLE, zOrigTab, SQLITE_TRANSIENT); + tdsqlite3VdbeSetColName(v, i, COLNAME_COLUMN, zOrigCol, SQLITE_TRANSIENT); #else zType = columnType(&sNC, p, 0, 0, 0); #endif - sqlite3VdbeSetColName(v, i, COLNAME_DECLTYPE, zType, SQLITE_TRANSIENT); + tdsqlite3VdbeSetColName(v, i, COLNAME_DECLTYPE, zType, SQLITE_TRANSIENT); } #endif /* !defined(SQLITE_OMIT_DECLTYPE) */ } @@ -134168,7 +134168,7 @@ static void generateColumnTypes( ** and will break if those assumptions changes. Hence, use extreme caution ** when modifying this routine to avoid breaking legacy. ** -** See Also: sqlite3ColumnsFromExprList() +** See Also: tdsqlite3ColumnsFromExprList() ** ** The PRAGMA short_column_names and PRAGMA full_column_names settings are ** deprecated. The default setting is short=ON, full=OFF. 99.9% of all @@ -134197,7 +134197,7 @@ static void generateColumnNames( Table *pTab; SrcList *pTabList; ExprList *pEList; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; int fullName; /* TABLE.COLUMN if no AS clause and is a direct table ref */ int srcName; /* COLUMN or TABLE.COLUMN if no AS clause and is direct */ @@ -134219,7 +134219,7 @@ static void generateColumnNames( pParse->colNamesSet = 1; fullName = (db->flags & SQLITE_FullColNames)!=0; srcName = (db->flags & SQLITE_ShortColNames)!=0 || fullName; - sqlite3VdbeSetNumCols(v, pEList->nExpr); + tdsqlite3VdbeSetNumCols(v, pEList->nExpr); for(i=0; inExpr; i++){ Expr *p = pEList->a[i].pExpr; @@ -134229,7 +134229,7 @@ static void generateColumnNames( if( pEList->a[i].zEName && pEList->a[i].eEName==ENAME_NAME ){ /* An AS clause always takes first priority */ char *zName = pEList->a[i].zEName; - sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT); + tdsqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT); }else if( srcName && p->op==TK_COLUMN ){ char *zCol; int iCol = p->iColumn; @@ -134244,15 +134244,15 @@ static void generateColumnNames( } if( fullName ){ char *zName = 0; - zName = sqlite3MPrintf(db, "%s.%s", pTab->zName, zCol); - sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC); + zName = tdsqlite3MPrintf(db, "%s.%s", pTab->zName, zCol); + tdsqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC); }else{ - sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, SQLITE_TRANSIENT); + tdsqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, SQLITE_TRANSIENT); } }else{ const char *z = pEList->a[i].zEName; - z = z==0 ? sqlite3MPrintf(db, "column%d", i+1) : sqlite3DbStrDup(db, z); - sqlite3VdbeSetColName(v, i, COLNAME_NAME, z, SQLITE_DYNAMIC); + z = z==0 ? tdsqlite3MPrintf(db, "column%d", i+1) : tdsqlite3DbStrDup(db, z); + tdsqlite3VdbeSetColName(v, i, COLNAME_NAME, z, SQLITE_DYNAMIC); } } generateColumnTypes(pParse, pTabList, pEList); @@ -134280,13 +134280,13 @@ static void generateColumnNames( ** ** See Also: generateColumnNames() */ -SQLITE_PRIVATE int sqlite3ColumnsFromExprList( +SQLITE_PRIVATE int tdsqlite3ColumnsFromExprList( Parse *pParse, /* Parsing context */ ExprList *pEList, /* Expr list from which to derive column names */ i16 *pnCol, /* Write the number of columns here */ Column **paCol /* Write the new column list here */ ){ - sqlite3 *db = pParse->db; /* Database connection */ + tdsqlite3 *db = pParse->db; /* Database connection */ int i, j; /* Loop counters */ u32 cnt; /* Index added to make the name unique */ Column *aCol, *pCol; /* For looping over result columns */ @@ -134295,10 +134295,10 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList( int nName; /* Size of name in zName[] */ Hash ht; /* Hash table of column names */ - sqlite3HashInit(&ht); + tdsqlite3HashInit(&ht); if( pEList ){ nCol = pEList->nExpr; - aCol = sqlite3DbMallocZero(db, sizeof(aCol[0])*nCol); + aCol = tdsqlite3DbMallocZero(db, sizeof(aCol[0])*nCol); testcase( aCol==0 ); if( nCol>32767 ) nCol = 32767; }else{ @@ -134315,7 +134315,7 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList( if( (zName = pEList->a[i].zEName)!=0 && pEList->a[i].eEName==ENAME_NAME ){ /* If the column contains an "AS " phrase, use as the name */ }else{ - Expr *pColExpr = sqlite3ExprSkipCollateAndLikely(pEList->a[i].pExpr); + Expr *pColExpr = tdsqlite3ExprSkipCollateAndLikely(pEList->a[i].pExpr); while( pColExpr->op==TK_DOT ){ pColExpr = pColExpr->pRight; assert( pColExpr!=0 ); @@ -134335,37 +134335,37 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList( zName = pEList->a[i].zEName; } } - if( zName && !sqlite3IsTrueOrFalse(zName) ){ - zName = sqlite3DbStrDup(db, zName); + if( zName && !tdsqlite3IsTrueOrFalse(zName) ){ + zName = tdsqlite3DbStrDup(db, zName); }else{ - zName = sqlite3MPrintf(db,"column%d",i+1); + zName = tdsqlite3MPrintf(db,"column%d",i+1); } /* Make sure the column name is unique. If the name is not unique, ** append an integer to the name so that it becomes unique. */ cnt = 0; - while( zName && sqlite3HashFind(&ht, zName)!=0 ){ - nName = sqlite3Strlen30(zName); + while( zName && tdsqlite3HashFind(&ht, zName)!=0 ){ + nName = tdsqlite3Strlen30(zName); if( nName>0 ){ - for(j=nName-1; j>0 && sqlite3Isdigit(zName[j]); j--){} + for(j=nName-1; j>0 && tdsqlite3Isdigit(zName[j]); j--){} if( zName[j]==':' ) nName = j; } - zName = sqlite3MPrintf(db, "%.*z:%u", nName, zName, ++cnt); - if( cnt>3 ) sqlite3_randomness(sizeof(cnt), &cnt); + zName = tdsqlite3MPrintf(db, "%.*z:%u", nName, zName, ++cnt); + if( cnt>3 ) tdsqlite3_randomness(sizeof(cnt), &cnt); } pCol->zName = zName; - sqlite3ColumnPropertiesFromName(0, pCol); - if( zName && sqlite3HashInsert(&ht, zName, pCol)==pCol ){ - sqlite3OomFault(db); + tdsqlite3ColumnPropertiesFromName(0, pCol); + if( zName && tdsqlite3HashInsert(&ht, zName, pCol)==pCol ){ + tdsqlite3OomFault(db); } } - sqlite3HashClear(&ht); + tdsqlite3HashClear(&ht); if( db->mallocFailed ){ for(j=0; jdb; + tdsqlite3 *db = pParse->db; NameContext sNC; Column *pCol; CollSeq *pColl; @@ -134411,20 +134411,20 @@ SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation( p = a[i].pExpr; zType = columnType(&sNC, p, 0, 0, 0); /* pCol->szEst = ... // Column size est for SELECT tables never used */ - pCol->affinity = sqlite3ExprAffinity(p); + pCol->affinity = tdsqlite3ExprAffinity(p); if( zType ){ - m = sqlite3Strlen30(zType); - n = sqlite3Strlen30(pCol->zName); - pCol->zName = sqlite3DbReallocOrFree(db, pCol->zName, n+m+2); + m = tdsqlite3Strlen30(zType); + n = tdsqlite3Strlen30(pCol->zName); + pCol->zName = tdsqlite3DbReallocOrFree(db, pCol->zName, n+m+2); if( pCol->zName ){ memcpy(&pCol->zName[n+1], zType, m+1); pCol->colFlags |= COLFLAG_HASTYPE; } } if( pCol->affinity<=SQLITE_AFF_NONE ) pCol->affinity = aff; - pColl = sqlite3ExprCollSeq(pParse, p); + pColl = tdsqlite3ExprCollSeq(pParse, p); if( pColl && pCol->zColl==0 ){ - pCol->zColl = sqlite3DbStrDup(db, pColl->zName); + pCol->zColl = tdsqlite3DbStrDup(db, pColl->zName); } } pTab->szTabRow = 1; /* Any non-zero value works */ @@ -134434,30 +134434,30 @@ SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation( ** Given a SELECT statement, generate a Table structure that describes ** the result set of that SELECT. */ -SQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect, char aff){ +SQLITE_PRIVATE Table *tdsqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect, char aff){ Table *pTab; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; u64 savedFlags; savedFlags = db->flags; db->flags &= ~(u64)SQLITE_FullColNames; db->flags |= SQLITE_ShortColNames; - sqlite3SelectPrep(pParse, pSelect, 0); + tdsqlite3SelectPrep(pParse, pSelect, 0); db->flags = savedFlags; if( pParse->nErr ) return 0; while( pSelect->pPrior ) pSelect = pSelect->pPrior; - pTab = sqlite3DbMallocZero(db, sizeof(Table) ); + pTab = tdsqlite3DbMallocZero(db, sizeof(Table) ); if( pTab==0 ){ return 0; } pTab->nTabRef = 1; pTab->zName = 0; - pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) ); - sqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol); - sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSelect, aff); + pTab->nRowLogEst = 200; assert( 200==tdsqlite3LogEst(1048576) ); + tdsqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol); + tdsqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSelect, aff); pTab->iPKey = -1; if( db->mallocFailed ){ - sqlite3DeleteTable(db, pTab); + tdsqlite3DeleteTable(db, pTab); return 0; } return pTab; @@ -134467,7 +134467,7 @@ SQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect, c ** Get a VDBE for the given parser context. Create a new one if necessary. ** If an error occurs, return NULL and leave a message in pParse. */ -SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse *pParse){ +SQLITE_PRIVATE Vdbe *tdsqlite3GetVdbe(Parse *pParse){ if( pParse->pVdbe ){ return pParse->pVdbe; } @@ -134476,7 +134476,7 @@ SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse *pParse){ ){ pParse->okConstFactor = 1; } - return sqlite3VdbeCreate(pParse); + return tdsqlite3VdbeCreate(pParse); } @@ -134522,30 +134522,30 @@ static void computeLimitRegisters(Parse *pParse, Select *p, int iBreak){ assert( pLimit->op==TK_LIMIT ); assert( pLimit->pLeft!=0 ); p->iLimit = iLimit = ++pParse->nMem; - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); assert( v!=0 ); - if( sqlite3ExprIsInteger(pLimit->pLeft, &n) ){ - sqlite3VdbeAddOp2(v, OP_Integer, n, iLimit); + if( tdsqlite3ExprIsInteger(pLimit->pLeft, &n) ){ + tdsqlite3VdbeAddOp2(v, OP_Integer, n, iLimit); VdbeComment((v, "LIMIT counter")); if( n==0 ){ - sqlite3VdbeGoto(v, iBreak); - }else if( n>=0 && p->nSelectRow>sqlite3LogEst((u64)n) ){ - p->nSelectRow = sqlite3LogEst((u64)n); + tdsqlite3VdbeGoto(v, iBreak); + }else if( n>=0 && p->nSelectRow>tdsqlite3LogEst((u64)n) ){ + p->nSelectRow = tdsqlite3LogEst((u64)n); p->selFlags |= SF_FixedLimit; } }else{ - sqlite3ExprCode(pParse, pLimit->pLeft, iLimit); - sqlite3VdbeAddOp1(v, OP_MustBeInt, iLimit); VdbeCoverage(v); + tdsqlite3ExprCode(pParse, pLimit->pLeft, iLimit); + tdsqlite3VdbeAddOp1(v, OP_MustBeInt, iLimit); VdbeCoverage(v); VdbeComment((v, "LIMIT counter")); - sqlite3VdbeAddOp2(v, OP_IfNot, iLimit, iBreak); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_IfNot, iLimit, iBreak); VdbeCoverage(v); } if( pLimit->pRight ){ p->iOffset = iOffset = ++pParse->nMem; pParse->nMem++; /* Allocate an extra register for limit+offset */ - sqlite3ExprCode(pParse, pLimit->pRight, iOffset); - sqlite3VdbeAddOp1(v, OP_MustBeInt, iOffset); VdbeCoverage(v); + tdsqlite3ExprCode(pParse, pLimit->pRight, iOffset); + tdsqlite3VdbeAddOp1(v, OP_MustBeInt, iOffset); VdbeCoverage(v); VdbeComment((v, "OFFSET counter")); - sqlite3VdbeAddOp3(v, OP_OffsetLimit, iLimit, iOffset+1, iOffset); + tdsqlite3VdbeAddOp3(v, OP_OffsetLimit, iLimit, iOffset+1, iOffset); VdbeComment((v, "LIMIT+OFFSET")); } } @@ -134572,7 +134572,7 @@ static CollSeq *multiSelectCollSeq(Parse *pParse, Select *p, int iCol){ ** have been thrown during name resolution and we would not have gotten ** this far */ if( pRet==0 && ALWAYS(iColpEList->nExpr) ){ - pRet = sqlite3ExprCollSeq(pParse, p->pEList->a[iCol].pExpr); + pRet = tdsqlite3ExprCollSeq(pParse, p->pEList->a[iCol].pExpr); } return pRet; } @@ -134589,8 +134589,8 @@ static CollSeq *multiSelectCollSeq(Parse *pParse, Select *p, int iCol){ static KeyInfo *multiSelectOrderByKeyInfo(Parse *pParse, Select *p, int nExtra){ ExprList *pOrderBy = p->pOrderBy; int nOrderBy = p->pOrderBy->nExpr; - sqlite3 *db = pParse->db; - KeyInfo *pRet = sqlite3KeyInfoAlloc(db, nOrderBy+nExtra, 1); + tdsqlite3 *db = pParse->db; + KeyInfo *pRet = tdsqlite3KeyInfoAlloc(db, nOrderBy+nExtra, 1); if( pRet ){ int i; for(i=0; iflags & EP_Collate ){ - pColl = sqlite3ExprCollSeq(pParse, pTerm); + pColl = tdsqlite3ExprCollSeq(pParse, pTerm); }else{ pColl = multiSelectCollSeq(pParse, p, pItem->u.x.iOrderByCol-1); if( pColl==0 ) pColl = db->pDfltColl; pOrderBy->a[i].pExpr = - sqlite3ExprAddCollateString(pParse, pTerm, pColl->zName); + tdsqlite3ExprAddCollateString(pParse, pTerm, pColl->zName); } - assert( sqlite3KeyInfoIsWriteable(pRet) ); + assert( tdsqlite3KeyInfoIsWriteable(pRet) ); pRet->aColl[i] = pColl; pRet->aSortFlags[i] = pOrderBy->a[i].sortFlags; } @@ -134677,16 +134677,16 @@ static void generateWithRecursiveQuery( #ifndef SQLITE_OMIT_WINDOWFUNC if( p->pWin ){ - sqlite3ErrorMsg(pParse, "cannot use window functions in recursive queries"); + tdsqlite3ErrorMsg(pParse, "cannot use window functions in recursive queries"); return; } #endif /* Obtain authorization to do a recursive query */ - if( sqlite3AuthCheck(pParse, SQLITE_RECURSIVE, 0, 0, 0) ) return; + if( tdsqlite3AuthCheck(pParse, SQLITE_RECURSIVE, 0, 0, 0) ) return; /* Process the LIMIT and OFFSET clauses, if they exist */ - addrBreak = sqlite3VdbeMakeLabel(pParse); + addrBreak = tdsqlite3VdbeMakeLabel(pParse); p->nSelectRow = 320; /* 4 billion rows */ computeLimitRegisters(pParse, p, addrBreak); pLimit = p->pLimit; @@ -134714,22 +134714,22 @@ static void generateWithRecursiveQuery( }else{ eDest = pOrderBy ? SRT_Queue : SRT_Fifo; } - sqlite3SelectDestInit(&destQueue, eDest, iQueue); + tdsqlite3SelectDestInit(&destQueue, eDest, iQueue); /* Allocate cursors for Current, Queue, and Distinct. */ regCurrent = ++pParse->nMem; - sqlite3VdbeAddOp3(v, OP_OpenPseudo, iCurrent, regCurrent, nCol); + tdsqlite3VdbeAddOp3(v, OP_OpenPseudo, iCurrent, regCurrent, nCol); if( pOrderBy ){ KeyInfo *pKeyInfo = multiSelectOrderByKeyInfo(pParse, p, 1); - sqlite3VdbeAddOp4(v, OP_OpenEphemeral, iQueue, pOrderBy->nExpr+2, 0, + tdsqlite3VdbeAddOp4(v, OP_OpenEphemeral, iQueue, pOrderBy->nExpr+2, 0, (char*)pKeyInfo, P4_KEYINFO); destQueue.pOrderBy = pOrderBy; }else{ - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iQueue, nCol); + tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, iQueue, nCol); } VdbeComment((v, "Queue table")); if( iDistinct ){ - p->addrOpenEphm[0] = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iDistinct, 0); + p->addrOpenEphm[0] = tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, iDistinct, 0); p->selFlags |= SF_UsesEphemeral; } @@ -134739,52 +134739,52 @@ static void generateWithRecursiveQuery( /* Store the results of the setup-query in Queue. */ pSetup->pNext = 0; ExplainQueryPlan((pParse, 1, "SETUP")); - rc = sqlite3Select(pParse, pSetup, &destQueue); + rc = tdsqlite3Select(pParse, pSetup, &destQueue); pSetup->pNext = p; if( rc ) goto end_of_recursive_query; /* Find the next row in the Queue and output that row */ - addrTop = sqlite3VdbeAddOp2(v, OP_Rewind, iQueue, addrBreak); VdbeCoverage(v); + addrTop = tdsqlite3VdbeAddOp2(v, OP_Rewind, iQueue, addrBreak); VdbeCoverage(v); /* Transfer the next row in Queue over to Current */ - sqlite3VdbeAddOp1(v, OP_NullRow, iCurrent); /* To reset column cache */ + tdsqlite3VdbeAddOp1(v, OP_NullRow, iCurrent); /* To reset column cache */ if( pOrderBy ){ - sqlite3VdbeAddOp3(v, OP_Column, iQueue, pOrderBy->nExpr+1, regCurrent); + tdsqlite3VdbeAddOp3(v, OP_Column, iQueue, pOrderBy->nExpr+1, regCurrent); }else{ - sqlite3VdbeAddOp2(v, OP_RowData, iQueue, regCurrent); + tdsqlite3VdbeAddOp2(v, OP_RowData, iQueue, regCurrent); } - sqlite3VdbeAddOp1(v, OP_Delete, iQueue); + tdsqlite3VdbeAddOp1(v, OP_Delete, iQueue); /* Output the single row in Current */ - addrCont = sqlite3VdbeMakeLabel(pParse); + addrCont = tdsqlite3VdbeMakeLabel(pParse); codeOffset(v, regOffset, addrCont); selectInnerLoop(pParse, p, iCurrent, 0, 0, pDest, addrCont, addrBreak); if( regLimit ){ - sqlite3VdbeAddOp2(v, OP_DecrJumpZero, regLimit, addrBreak); + tdsqlite3VdbeAddOp2(v, OP_DecrJumpZero, regLimit, addrBreak); VdbeCoverage(v); } - sqlite3VdbeResolveLabel(v, addrCont); + tdsqlite3VdbeResolveLabel(v, addrCont); /* Execute the recursive SELECT taking the single row in Current as ** the value for the recursive-table. Store the results in the Queue. */ if( p->selFlags & SF_Aggregate ){ - sqlite3ErrorMsg(pParse, "recursive aggregate queries not supported"); + tdsqlite3ErrorMsg(pParse, "recursive aggregate queries not supported"); }else{ p->pPrior = 0; ExplainQueryPlan((pParse, 1, "RECURSIVE STEP")); - sqlite3Select(pParse, p, &destQueue); + tdsqlite3Select(pParse, p, &destQueue); assert( p->pPrior==0 ); p->pPrior = pSetup; } /* Keep running the loop until the Queue is empty */ - sqlite3VdbeGoto(v, addrTop); - sqlite3VdbeResolveLabel(v, addrBreak); + tdsqlite3VdbeGoto(v, addrTop); + tdsqlite3VdbeResolveLabel(v, addrBreak); end_of_recursive_query: - sqlite3ExprListDelete(pParse->db, p->pOrderBy); + tdsqlite3ExprListDelete(pParse->db, p->pOrderBy); p->pOrderBy = pOrderBy; p->pLimit = pLimit; return; @@ -134811,7 +134811,7 @@ static int multiSelectOrderBy( ** ** The "LIMIT of exactly 1" case of condition (1) comes about when a VALUES ** clause occurs within scalar expression (ex: "SELECT (VALUES(1),(2),(3))"). -** The sqlite3CodeSubselect will have added the LIMIT 1 clause in tht case. +** The tdsqlite3CodeSubselect will have added the LIMIT 1 clause in tht case. ** Since the limit is exactly 1, we only need to evalutes the left-most VALUES. */ static int multiSelectValues( @@ -134887,7 +134887,7 @@ static int multiSelect( Vdbe *v; /* Generate code to this VDBE */ SelectDest dest; /* Alternative data destination */ Select *pDelete = 0; /* Chain of simple selects to delete */ - sqlite3 *db; /* Database connection */ + tdsqlite3 *db; /* Database connection */ /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT. @@ -134899,20 +134899,20 @@ static int multiSelect( pPrior = p->pPrior; dest = *pDest; if( pPrior->pOrderBy || pPrior->pLimit ){ - sqlite3ErrorMsg(pParse,"%s clause should come after %s not before", + tdsqlite3ErrorMsg(pParse,"%s clause should come after %s not before", pPrior->pOrderBy!=0 ? "ORDER BY" : "LIMIT", selectOpName(p->op)); rc = 1; goto multi_select_end; } - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); assert( v!=0 ); /* The VDBE already created by calling function */ /* Create the destination temporary table if necessary */ if( dest.eDest==SRT_EphemTab ){ assert( p->pEList ); - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, dest.iSDParm, p->pEList->nExpr); + tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, dest.iSDParm, p->pEList->nExpr); dest.eDest = SRT_Table; } @@ -134959,7 +134959,7 @@ static int multiSelect( pPrior->iLimit = p->iLimit; pPrior->iOffset = p->iOffset; pPrior->pLimit = p->pLimit; - rc = sqlite3Select(pParse, pPrior, &dest); + rc = tdsqlite3Select(pParse, pPrior, &dest); p->pLimit = 0; if( rc ){ goto multi_select_end; @@ -134968,27 +134968,27 @@ static int multiSelect( p->iLimit = pPrior->iLimit; p->iOffset = pPrior->iOffset; if( p->iLimit ){ - addr = sqlite3VdbeAddOp1(v, OP_IfNot, p->iLimit); VdbeCoverage(v); + addr = tdsqlite3VdbeAddOp1(v, OP_IfNot, p->iLimit); VdbeCoverage(v); VdbeComment((v, "Jump ahead if LIMIT reached")); if( p->iOffset ){ - sqlite3VdbeAddOp3(v, OP_OffsetLimit, + tdsqlite3VdbeAddOp3(v, OP_OffsetLimit, p->iLimit, p->iOffset+1, p->iOffset); } } ExplainQueryPlan((pParse, 1, "UNION ALL")); - rc = sqlite3Select(pParse, p, &dest); + rc = tdsqlite3Select(pParse, p, &dest); testcase( rc!=SQLITE_OK ); pDelete = p->pPrior; p->pPrior = pPrior; - p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow); + p->nSelectRow = tdsqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow); if( pPrior->pLimit - && sqlite3ExprIsInteger(pPrior->pLimit->pLeft, &nLimit) - && nLimit>0 && p->nSelectRow > sqlite3LogEst((u64)nLimit) + && tdsqlite3ExprIsInteger(pPrior->pLimit->pLeft, &nLimit) + && nLimit>0 && p->nSelectRow > tdsqlite3LogEst((u64)nLimit) ){ - p->nSelectRow = sqlite3LogEst((u64)nLimit); + p->nSelectRow = tdsqlite3LogEst((u64)nLimit); } if( addr ){ - sqlite3VdbeJumpHere(v, addr); + tdsqlite3VdbeJumpHere(v, addr); } break; } @@ -135016,7 +135016,7 @@ static int multiSelect( */ unionTab = pParse->nTab++; assert( p->pOrderBy==0 ); - addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, unionTab, 0); + addr = tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, unionTab, 0); assert( p->addrOpenEphm[0] == -1 ); p->addrOpenEphm[0] = addr; findRightmost(p)->selFlags |= SF_UsesEphemeral; @@ -135026,8 +135026,8 @@ static int multiSelect( /* Code the SELECT statements to our left */ assert( !pPrior->pOrderBy ); - sqlite3SelectDestInit(&uniondest, priorOp, unionTab); - rc = sqlite3Select(pParse, pPrior, &uniondest); + tdsqlite3SelectDestInit(&uniondest, priorOp, unionTab); + rc = tdsqlite3Select(pParse, pPrior, &uniondest); if( rc ){ goto multi_select_end; } @@ -135046,18 +135046,18 @@ static int multiSelect( uniondest.eDest = op; ExplainQueryPlan((pParse, 1, "%s USING TEMP B-TREE", selectOpName(p->op))); - rc = sqlite3Select(pParse, p, &uniondest); + rc = tdsqlite3Select(pParse, p, &uniondest); testcase( rc!=SQLITE_OK ); - /* Query flattening in sqlite3Select() might refill p->pOrderBy. + /* Query flattening in tdsqlite3Select() might refill p->pOrderBy. ** Be sure to delete p->pOrderBy, therefore, to avoid a memory leak. */ - sqlite3ExprListDelete(db, p->pOrderBy); + tdsqlite3ExprListDelete(db, p->pOrderBy); pDelete = p->pPrior; p->pPrior = pPrior; p->pOrderBy = 0; if( p->op==TK_UNION ){ - p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow); + p->nSelectRow = tdsqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow); } - sqlite3ExprDelete(db, p->pLimit); + tdsqlite3ExprDelete(db, p->pLimit); p->pLimit = pLimit; p->iLimit = 0; p->iOffset = 0; @@ -135069,17 +135069,17 @@ static int multiSelect( assert( p->pEList || db->mallocFailed ); if( dest.eDest!=priorOp && db->mallocFailed==0 ){ int iCont, iBreak, iStart; - iBreak = sqlite3VdbeMakeLabel(pParse); - iCont = sqlite3VdbeMakeLabel(pParse); + iBreak = tdsqlite3VdbeMakeLabel(pParse); + iCont = tdsqlite3VdbeMakeLabel(pParse); computeLimitRegisters(pParse, p, iBreak); - sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v); - iStart = sqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v); + iStart = tdsqlite3VdbeCurrentAddr(v); selectInnerLoop(pParse, p, unionTab, 0, 0, &dest, iCont, iBreak); - sqlite3VdbeResolveLabel(v, iCont); - sqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart); VdbeCoverage(v); - sqlite3VdbeResolveLabel(v, iBreak); - sqlite3VdbeAddOp2(v, OP_Close, unionTab, 0); + tdsqlite3VdbeResolveLabel(v, iCont); + tdsqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart); VdbeCoverage(v); + tdsqlite3VdbeResolveLabel(v, iBreak); + tdsqlite3VdbeAddOp2(v, OP_Close, unionTab, 0); } break; } @@ -135099,7 +135099,7 @@ static int multiSelect( tab2 = pParse->nTab++; assert( p->pOrderBy==0 ); - addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab1, 0); + addr = tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab1, 0); assert( p->addrOpenEphm[0] == -1 ); p->addrOpenEphm[0] = addr; findRightmost(p)->selFlags |= SF_UsesEphemeral; @@ -135107,15 +135107,15 @@ static int multiSelect( /* Code the SELECTs to our left into temporary table "tab1". */ - sqlite3SelectDestInit(&intersectdest, SRT_Union, tab1); - rc = sqlite3Select(pParse, pPrior, &intersectdest); + tdsqlite3SelectDestInit(&intersectdest, SRT_Union, tab1); + rc = tdsqlite3Select(pParse, pPrior, &intersectdest); if( rc ){ goto multi_select_end; } /* Code the current SELECT into temporary table "tab2" */ - addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab2, 0); + addr = tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab2, 0); assert( p->addrOpenEphm[1] == -1 ); p->addrOpenEphm[1] = addr; p->pPrior = 0; @@ -135124,36 +135124,36 @@ static int multiSelect( intersectdest.iSDParm = tab2; ExplainQueryPlan((pParse, 1, "%s USING TEMP B-TREE", selectOpName(p->op))); - rc = sqlite3Select(pParse, p, &intersectdest); + rc = tdsqlite3Select(pParse, p, &intersectdest); testcase( rc!=SQLITE_OK ); pDelete = p->pPrior; p->pPrior = pPrior; if( p->nSelectRow>pPrior->nSelectRow ){ p->nSelectRow = pPrior->nSelectRow; } - sqlite3ExprDelete(db, p->pLimit); + tdsqlite3ExprDelete(db, p->pLimit); p->pLimit = pLimit; /* Generate code to take the intersection of the two temporary ** tables. */ assert( p->pEList ); - iBreak = sqlite3VdbeMakeLabel(pParse); - iCont = sqlite3VdbeMakeLabel(pParse); + iBreak = tdsqlite3VdbeMakeLabel(pParse); + iCont = tdsqlite3VdbeMakeLabel(pParse); computeLimitRegisters(pParse, p, iBreak); - sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak); VdbeCoverage(v); - r1 = sqlite3GetTempReg(pParse); - iStart = sqlite3VdbeAddOp2(v, OP_RowData, tab1, r1); - sqlite3VdbeAddOp4Int(v, OP_NotFound, tab2, iCont, r1, 0); + tdsqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak); VdbeCoverage(v); + r1 = tdsqlite3GetTempReg(pParse); + iStart = tdsqlite3VdbeAddOp2(v, OP_RowData, tab1, r1); + tdsqlite3VdbeAddOp4Int(v, OP_NotFound, tab2, iCont, r1, 0); VdbeCoverage(v); - sqlite3ReleaseTempReg(pParse, r1); + tdsqlite3ReleaseTempReg(pParse, r1); selectInnerLoop(pParse, p, tab1, 0, 0, &dest, iCont, iBreak); - sqlite3VdbeResolveLabel(v, iCont); - sqlite3VdbeAddOp2(v, OP_Next, tab1, iStart); VdbeCoverage(v); - sqlite3VdbeResolveLabel(v, iBreak); - sqlite3VdbeAddOp2(v, OP_Close, tab2, 0); - sqlite3VdbeAddOp2(v, OP_Close, tab1, 0); + tdsqlite3VdbeResolveLabel(v, iCont); + tdsqlite3VdbeAddOp2(v, OP_Next, tab1, iStart); VdbeCoverage(v); + tdsqlite3VdbeResolveLabel(v, iBreak); + tdsqlite3VdbeAddOp2(v, OP_Close, tab2, 0); + tdsqlite3VdbeAddOp2(v, OP_Close, tab1, 0); break; } } @@ -135184,7 +135184,7 @@ static int multiSelect( assert( p->pNext==0 ); nCol = p->pEList->nExpr; - pKeyInfo = sqlite3KeyInfoAlloc(db, nCol, 1); + pKeyInfo = tdsqlite3KeyInfoAlloc(db, nCol, 1); if( !pKeyInfo ){ rc = SQLITE_NOMEM_BKPT; goto multi_select_end; @@ -135205,19 +135205,19 @@ static int multiSelect( assert( pLoop->addrOpenEphm[1]<0 ); break; } - sqlite3VdbeChangeP2(v, addr, nCol); - sqlite3VdbeChangeP4(v, addr, (char*)sqlite3KeyInfoRef(pKeyInfo), + tdsqlite3VdbeChangeP2(v, addr, nCol); + tdsqlite3VdbeChangeP4(v, addr, (char*)tdsqlite3KeyInfoRef(pKeyInfo), P4_KEYINFO); pLoop->addrOpenEphm[i] = -1; } } - sqlite3KeyInfoUnref(pKeyInfo); + tdsqlite3KeyInfoUnref(pKeyInfo); } multi_select_end: pDest->iSdst = dest.iSdst; pDest->nSdst = dest.nSdst; - sqlite3SelectDelete(db, pDelete); + tdsqlite3SelectDelete(db, pDelete); return rc; } #endif /* SQLITE_OMIT_COMPOUND_SELECT */ @@ -135226,11 +135226,11 @@ multi_select_end: ** Error message for when two or more terms of a compound select have different ** size result sets. */ -SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p){ +SQLITE_PRIVATE void tdsqlite3SelectWrongNumTermsError(Parse *pParse, Select *p){ if( p->selFlags & SF_Values ){ - sqlite3ErrorMsg(pParse, "all VALUES must have the same number of terms"); + tdsqlite3ErrorMsg(pParse, "all VALUES must have the same number of terms"); }else{ - sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s" + tdsqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s" " do not have the same number of result columns", selectOpName(p->op)); } } @@ -135269,20 +135269,20 @@ static int generateOutputSubroutine( int iContinue; int addr; - addr = sqlite3VdbeCurrentAddr(v); - iContinue = sqlite3VdbeMakeLabel(pParse); + addr = tdsqlite3VdbeCurrentAddr(v); + iContinue = tdsqlite3VdbeMakeLabel(pParse); /* Suppress duplicates for UNION, EXCEPT, and INTERSECT */ if( regPrev ){ int addr1, addr2; - addr1 = sqlite3VdbeAddOp1(v, OP_IfNot, regPrev); VdbeCoverage(v); - addr2 = sqlite3VdbeAddOp4(v, OP_Compare, pIn->iSdst, regPrev+1, pIn->nSdst, - (char*)sqlite3KeyInfoRef(pKeyInfo), P4_KEYINFO); - sqlite3VdbeAddOp3(v, OP_Jump, addr2+2, iContinue, addr2+2); VdbeCoverage(v); - sqlite3VdbeJumpHere(v, addr1); - sqlite3VdbeAddOp3(v, OP_Copy, pIn->iSdst, regPrev+1, pIn->nSdst-1); - sqlite3VdbeAddOp2(v, OP_Integer, 1, regPrev); + addr1 = tdsqlite3VdbeAddOp1(v, OP_IfNot, regPrev); VdbeCoverage(v); + addr2 = tdsqlite3VdbeAddOp4(v, OP_Compare, pIn->iSdst, regPrev+1, pIn->nSdst, + (char*)tdsqlite3KeyInfoRef(pKeyInfo), P4_KEYINFO); + tdsqlite3VdbeAddOp3(v, OP_Jump, addr2+2, iContinue, addr2+2); VdbeCoverage(v); + tdsqlite3VdbeJumpHere(v, addr1); + tdsqlite3VdbeAddOp3(v, OP_Copy, pIn->iSdst, regPrev+1, pIn->nSdst-1); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, regPrev); } if( pParse->db->mallocFailed ) return 0; @@ -135296,14 +135296,14 @@ static int generateOutputSubroutine( /* Store the result as data using a unique key. */ case SRT_EphemTab: { - int r1 = sqlite3GetTempReg(pParse); - int r2 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst, r1); - sqlite3VdbeAddOp2(v, OP_NewRowid, pDest->iSDParm, r2); - sqlite3VdbeAddOp3(v, OP_Insert, pDest->iSDParm, r1, r2); - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); - sqlite3ReleaseTempReg(pParse, r2); - sqlite3ReleaseTempReg(pParse, r1); + int r1 = tdsqlite3GetTempReg(pParse); + int r2 = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst, r1); + tdsqlite3VdbeAddOp2(v, OP_NewRowid, pDest->iSDParm, r2); + tdsqlite3VdbeAddOp3(v, OP_Insert, pDest->iSDParm, r1, r2); + tdsqlite3VdbeChangeP5(v, OPFLAG_APPEND); + tdsqlite3ReleaseTempReg(pParse, r2); + tdsqlite3ReleaseTempReg(pParse, r1); break; } @@ -135313,12 +135313,12 @@ static int generateOutputSubroutine( case SRT_Set: { int r1; testcase( pIn->nSdst>1 ); - r1 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst, + r1 = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst, r1, pDest->zAffSdst, pIn->nSdst); - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, pDest->iSDParm, r1, + tdsqlite3VdbeAddOp4Int(v, OP_IdxInsert, pDest->iSDParm, r1, pIn->iSdst, pIn->nSdst); - sqlite3ReleaseTempReg(pParse, r1); + tdsqlite3ReleaseTempReg(pParse, r1); break; } @@ -135330,7 +135330,7 @@ static int generateOutputSubroutine( case SRT_Mem: { if( pParse->nErr==0 ){ testcase( pIn->nSdst>1 ); - sqlite3ExprCodeMove(pParse, pIn->iSdst, pDest->iSDParm, pIn->nSdst); + tdsqlite3ExprCodeMove(pParse, pIn->iSdst, pDest->iSDParm, pIn->nSdst); } /* The LIMIT clause will jump out of the loop for us */ break; @@ -135342,11 +135342,11 @@ static int generateOutputSubroutine( */ case SRT_Coroutine: { if( pDest->iSdst==0 ){ - pDest->iSdst = sqlite3GetTempRange(pParse, pIn->nSdst); + pDest->iSdst = tdsqlite3GetTempRange(pParse, pIn->nSdst); pDest->nSdst = pIn->nSdst; } - sqlite3ExprCodeMove(pParse, pIn->iSdst, pDest->iSdst, pIn->nSdst); - sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); + tdsqlite3ExprCodeMove(pParse, pIn->iSdst, pDest->iSdst, pIn->nSdst); + tdsqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); break; } @@ -135355,12 +135355,12 @@ static int generateOutputSubroutine( ** destination other than the ones handled above or SRT_Output. ** ** For SRT_Output, results are stored in a sequence of registers. - ** Then the OP_ResultRow opcode is used to cause sqlite3_step() to + ** Then the OP_ResultRow opcode is used to cause tdsqlite3_step() to ** return the next row of result. */ default: { assert( pDest->eDest==SRT_Output ); - sqlite3VdbeAddOp2(v, OP_ResultRow, pIn->iSdst, pIn->nSdst); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, pIn->iSdst, pIn->nSdst); break; } } @@ -135368,13 +135368,13 @@ static int generateOutputSubroutine( /* Jump to the end of the loop if the LIMIT is reached. */ if( p->iLimit ){ - sqlite3VdbeAddOp2(v, OP_DecrJumpZero, p->iLimit, iBreak); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_DecrJumpZero, p->iLimit, iBreak); VdbeCoverage(v); } /* Generate the subroutine return */ - sqlite3VdbeResolveLabel(v, iContinue); - sqlite3VdbeAddOp1(v, OP_Return, regReturn); + tdsqlite3VdbeResolveLabel(v, iContinue); + tdsqlite3VdbeAddOp1(v, OP_Return, regReturn); return addr; } @@ -135500,7 +135500,7 @@ static int multiSelectOrderBy( int op; /* One of TK_ALL, TK_UNION, TK_EXCEPT, TK_INTERSECT */ KeyInfo *pKeyDup = 0; /* Comparison information for duplicate removal */ KeyInfo *pKeyMerge; /* Comparison information for merging rows */ - sqlite3 *db; /* Database connection */ + tdsqlite3 *db; /* Database connection */ ExprList *pOrderBy; /* The ORDER BY clause */ int nOrderBy; /* Number of terms in the ORDER BY clause */ int *aPermute; /* Mapping from ORDER BY terms to result set columns */ @@ -135510,8 +135510,8 @@ static int multiSelectOrderBy( db = pParse->db; v = pParse->pVdbe; assert( v!=0 ); /* Already thrown the error if VDBE alloc failed */ - labelEnd = sqlite3VdbeMakeLabel(pParse); - labelCmpr = sqlite3VdbeMakeLabel(pParse); + labelEnd = tdsqlite3VdbeMakeLabel(pParse); + labelCmpr = tdsqlite3VdbeMakeLabel(pParse); /* Patch up the ORDER BY clause @@ -135535,11 +135535,11 @@ static int multiSelectOrderBy( if( pItem->u.x.iOrderByCol==i ) break; } if( j==nOrderBy ){ - Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0); + Expr *pNew = tdsqlite3Expr(db, TK_INTEGER, 0); if( pNew==0 ) return SQLITE_NOMEM_BKPT; pNew->flags |= EP_IntValue; pNew->u.iValue = i; - p->pOrderBy = pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew); + p->pOrderBy = pOrderBy = tdsqlite3ExprListAppend(pParse, pOrderBy, pNew); if( pOrderBy ) pOrderBy->a[nOrderBy++].u.x.iOrderByCol = (u16)i; } } @@ -135552,7 +135552,7 @@ static int multiSelectOrderBy( ** to the right and the left are evaluated, they use the correct ** collation. */ - aPermute = sqlite3DbMallocRawNN(db, sizeof(int)*(nOrderBy + 1)); + aPermute = tdsqlite3DbMallocRawNN(db, sizeof(int)*(nOrderBy + 1)); if( aPermute ){ struct ExprList_item *pItem; aPermute[0] = nOrderBy; @@ -135569,7 +135569,7 @@ static int multiSelectOrderBy( /* Reattach the ORDER BY clause to the query. */ p->pOrderBy = pOrderBy; - pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0); + pPrior->pOrderBy = tdsqlite3ExprListDup(pParse->db, pOrderBy, 0); /* Allocate a range of temporary registers and the KeyInfo needed ** for the logic that removes duplicate result rows when the @@ -135582,10 +135582,10 @@ static int multiSelectOrderBy( assert( nOrderBy>=nExpr || db->mallocFailed ); regPrev = pParse->nMem+1; pParse->nMem += nExpr+1; - sqlite3VdbeAddOp2(v, OP_Integer, 0, regPrev); - pKeyDup = sqlite3KeyInfoAlloc(db, nExpr, 1); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, regPrev); + pKeyDup = tdsqlite3KeyInfoAlloc(db, nExpr, 1); if( pKeyDup ){ - assert( sqlite3KeyInfoIsWriteable(pKeyDup) ); + assert( tdsqlite3KeyInfoIsWriteable(pKeyDup) ); for(i=0; iaColl[i] = multiSelectCollSeq(pParse, p, i); pKeyDup->aSortFlags[i] = 0; @@ -135597,9 +135597,9 @@ static int multiSelectOrderBy( */ p->pPrior = 0; pPrior->pNext = 0; - sqlite3ResolveOrderGroupBy(pParse, p, p->pOrderBy, "ORDER"); + tdsqlite3ResolveOrderGroupBy(pParse, p, p->pOrderBy, "ORDER"); if( pPrior->pPrior==0 ){ - sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER"); + tdsqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER"); } /* Compute the limit registers */ @@ -135607,51 +135607,51 @@ static int multiSelectOrderBy( if( p->iLimit && op==TK_ALL ){ regLimitA = ++pParse->nMem; regLimitB = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Copy, p->iOffset ? p->iOffset+1 : p->iLimit, + tdsqlite3VdbeAddOp2(v, OP_Copy, p->iOffset ? p->iOffset+1 : p->iLimit, regLimitA); - sqlite3VdbeAddOp2(v, OP_Copy, regLimitA, regLimitB); + tdsqlite3VdbeAddOp2(v, OP_Copy, regLimitA, regLimitB); }else{ regLimitA = regLimitB = 0; } - sqlite3ExprDelete(db, p->pLimit); + tdsqlite3ExprDelete(db, p->pLimit); p->pLimit = 0; regAddrA = ++pParse->nMem; regAddrB = ++pParse->nMem; regOutA = ++pParse->nMem; regOutB = ++pParse->nMem; - sqlite3SelectDestInit(&destA, SRT_Coroutine, regAddrA); - sqlite3SelectDestInit(&destB, SRT_Coroutine, regAddrB); + tdsqlite3SelectDestInit(&destA, SRT_Coroutine, regAddrA); + tdsqlite3SelectDestInit(&destB, SRT_Coroutine, regAddrB); ExplainQueryPlan((pParse, 1, "MERGE (%s)", selectOpName(p->op))); /* Generate a coroutine to evaluate the SELECT statement to the ** left of the compound operator - the "A" select. */ - addrSelectA = sqlite3VdbeCurrentAddr(v) + 1; - addr1 = sqlite3VdbeAddOp3(v, OP_InitCoroutine, regAddrA, 0, addrSelectA); + addrSelectA = tdsqlite3VdbeCurrentAddr(v) + 1; + addr1 = tdsqlite3VdbeAddOp3(v, OP_InitCoroutine, regAddrA, 0, addrSelectA); VdbeComment((v, "left SELECT")); pPrior->iLimit = regLimitA; ExplainQueryPlan((pParse, 1, "LEFT")); - sqlite3Select(pParse, pPrior, &destA); - sqlite3VdbeEndCoroutine(v, regAddrA); - sqlite3VdbeJumpHere(v, addr1); + tdsqlite3Select(pParse, pPrior, &destA); + tdsqlite3VdbeEndCoroutine(v, regAddrA); + tdsqlite3VdbeJumpHere(v, addr1); /* Generate a coroutine to evaluate the SELECT statement on ** the right - the "B" select */ - addrSelectB = sqlite3VdbeCurrentAddr(v) + 1; - addr1 = sqlite3VdbeAddOp3(v, OP_InitCoroutine, regAddrB, 0, addrSelectB); + addrSelectB = tdsqlite3VdbeCurrentAddr(v) + 1; + addr1 = tdsqlite3VdbeAddOp3(v, OP_InitCoroutine, regAddrB, 0, addrSelectB); VdbeComment((v, "right SELECT")); savedLimit = p->iLimit; savedOffset = p->iOffset; p->iLimit = regLimitB; p->iOffset = 0; ExplainQueryPlan((pParse, 1, "RIGHT")); - sqlite3Select(pParse, p, &destB); + tdsqlite3Select(pParse, p, &destB); p->iLimit = savedLimit; p->iOffset = savedOffset; - sqlite3VdbeEndCoroutine(v, regAddrB); + tdsqlite3VdbeEndCoroutine(v, regAddrB); /* Generate a subroutine that outputs the current row of the A ** select as the next output row of the compound select. @@ -135670,7 +135670,7 @@ static int multiSelectOrderBy( p, &destB, pDest, regOutB, regPrev, pKeyDup, labelEnd); } - sqlite3KeyInfoUnref(pKeyDup); + tdsqlite3KeyInfoUnref(pKeyDup); /* Generate a subroutine to run when the results from select A ** are exhausted and only data in select B remains. @@ -135679,11 +135679,11 @@ static int multiSelectOrderBy( addrEofA_noB = addrEofA = labelEnd; }else{ VdbeNoopComment((v, "eof-A subroutine")); - addrEofA = sqlite3VdbeAddOp2(v, OP_Gosub, regOutB, addrOutB); - addrEofA_noB = sqlite3VdbeAddOp2(v, OP_Yield, regAddrB, labelEnd); + addrEofA = tdsqlite3VdbeAddOp2(v, OP_Gosub, regOutB, addrOutB); + addrEofA_noB = tdsqlite3VdbeAddOp2(v, OP_Yield, regAddrB, labelEnd); VdbeCoverage(v); - sqlite3VdbeGoto(v, addrEofA); - p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow); + tdsqlite3VdbeGoto(v, addrEofA); + p->nSelectRow = tdsqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow); } /* Generate a subroutine to run when the results from select B @@ -135694,17 +135694,17 @@ static int multiSelectOrderBy( if( p->nSelectRow > pPrior->nSelectRow ) p->nSelectRow = pPrior->nSelectRow; }else{ VdbeNoopComment((v, "eof-B subroutine")); - addrEofB = sqlite3VdbeAddOp2(v, OP_Gosub, regOutA, addrOutA); - sqlite3VdbeAddOp2(v, OP_Yield, regAddrA, labelEnd); VdbeCoverage(v); - sqlite3VdbeGoto(v, addrEofB); + addrEofB = tdsqlite3VdbeAddOp2(v, OP_Gosub, regOutA, addrOutA); + tdsqlite3VdbeAddOp2(v, OP_Yield, regAddrA, labelEnd); VdbeCoverage(v); + tdsqlite3VdbeGoto(v, addrEofB); } /* Generate code to handle the case of AB */ VdbeNoopComment((v, "A-gt-B subroutine")); - addrAgtB = sqlite3VdbeCurrentAddr(v); + addrAgtB = tdsqlite3VdbeCurrentAddr(v); if( op==TK_ALL || op==TK_UNION ){ - sqlite3VdbeAddOp2(v, OP_Gosub, regOutB, addrOutB); + tdsqlite3VdbeAddOp2(v, OP_Gosub, regOutB, addrOutB); } - sqlite3VdbeAddOp2(v, OP_Yield, regAddrB, addrEofB); VdbeCoverage(v); - sqlite3VdbeGoto(v, labelCmpr); + tdsqlite3VdbeAddOp2(v, OP_Yield, regAddrB, addrEofB); VdbeCoverage(v); + tdsqlite3VdbeGoto(v, labelCmpr); /* This code runs once to initialize everything. */ - sqlite3VdbeJumpHere(v, addr1); - sqlite3VdbeAddOp2(v, OP_Yield, regAddrA, addrEofA_noB); VdbeCoverage(v); - sqlite3VdbeAddOp2(v, OP_Yield, regAddrB, addrEofB); VdbeCoverage(v); + tdsqlite3VdbeJumpHere(v, addr1); + tdsqlite3VdbeAddOp2(v, OP_Yield, regAddrA, addrEofA_noB); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_Yield, regAddrB, addrEofB); VdbeCoverage(v); /* Implement the main merge loop */ - sqlite3VdbeResolveLabel(v, labelCmpr); - sqlite3VdbeAddOp4(v, OP_Permutation, 0, 0, 0, (char*)aPermute, P4_INTARRAY); - sqlite3VdbeAddOp4(v, OP_Compare, destA.iSdst, destB.iSdst, nOrderBy, + tdsqlite3VdbeResolveLabel(v, labelCmpr); + tdsqlite3VdbeAddOp4(v, OP_Permutation, 0, 0, 0, (char*)aPermute, P4_INTARRAY); + tdsqlite3VdbeAddOp4(v, OP_Compare, destA.iSdst, destB.iSdst, nOrderBy, (char*)pKeyMerge, P4_KEYINFO); - sqlite3VdbeChangeP5(v, OPFLAG_PERMUTE); - sqlite3VdbeAddOp3(v, OP_Jump, addrAltB, addrAeqB, addrAgtB); VdbeCoverage(v); + tdsqlite3VdbeChangeP5(v, OPFLAG_PERMUTE); + tdsqlite3VdbeAddOp3(v, OP_Jump, addrAltB, addrAeqB, addrAgtB); VdbeCoverage(v); /* Jump to the this point in order to terminate the query. */ - sqlite3VdbeResolveLabel(v, labelEnd); + tdsqlite3VdbeResolveLabel(v, labelEnd); /* Reassembly the compound query so that it will be freed correctly ** by the calling function */ if( p->pPrior ){ - sqlite3SelectDelete(db, p->pPrior); + tdsqlite3SelectDelete(db, p->pPrior); } p->pPrior = pPrior; pPrior->pNext = p; @@ -135816,10 +135816,10 @@ static Expr *substExpr( Expr ifNullRow; assert( pSubst->pEList!=0 && pExpr->iColumnpEList->nExpr ); assert( pExpr->pRight==0 ); - if( sqlite3ExprIsVector(pCopy) ){ - sqlite3VectorErrorMsg(pSubst->pParse, pCopy); + if( tdsqlite3ExprIsVector(pCopy) ){ + tdsqlite3VectorErrorMsg(pSubst->pParse, pCopy); }else{ - sqlite3 *db = pSubst->pParse->db; + tdsqlite3 *db = pSubst->pParse->db; if( pSubst->isLeftJoin && pCopy->op!=TK_COLUMN ){ memset(&ifNullRow, 0, sizeof(ifNullRow)); ifNullRow.op = TK_IF_NULL_ROW; @@ -135828,7 +135828,7 @@ static Expr *substExpr( pCopy = &ifNullRow; } testcase( ExprHasProperty(pCopy, EP_Subquery) ); - pNew = sqlite3ExprDup(db, pCopy, 0); + pNew = tdsqlite3ExprDup(db, pCopy, 0); if( pNew && pSubst->isLeftJoin ){ ExprSetProperty(pNew, EP_CanBeNull); } @@ -135836,15 +135836,15 @@ static Expr *substExpr( pNew->iRightJoinTable = pExpr->iRightJoinTable; ExprSetProperty(pNew, EP_FromJoin); } - sqlite3ExprDelete(db, pExpr); + tdsqlite3ExprDelete(db, pExpr); pExpr = pNew; /* Ensure that the expression now has an implicit collation sequence, ** just as it did when it was a column of a view or sub-query. */ if( pExpr ){ if( pExpr->op!=TK_COLUMN && pExpr->op!=TK_COLLATE ){ - CollSeq *pColl = sqlite3ExprCollSeq(pSubst->pParse, pExpr); - pExpr = sqlite3ExprAddCollateString(pSubst->pParse, pExpr, + CollSeq *pColl = tdsqlite3ExprCollSeq(pSubst->pParse, pExpr); + pExpr = tdsqlite3ExprAddCollateString(pSubst->pParse, pExpr, (pColl ? pColl->zName : "BINARY") ); } @@ -136085,7 +136085,7 @@ static int flattenSubquery( int i; /* Loop counter */ Expr *pWhere; /* The WHERE clause */ struct SrcList_item *pSubitem; /* The subquery */ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; /* Check to see if flattening is permitted. Return 0 if not. */ @@ -136224,7 +136224,7 @@ static int flattenSubquery( /* Authorize the subquery */ pParse->zAuthContext = pSubitem->zName; - TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0); + TESTONLY(i =) tdsqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0); testcase( i==SQLITE_DENY ); pParse->zAuthContext = zSavedAuthContext; @@ -136270,7 +136270,7 @@ static int flattenSubquery( p->pSrc = 0; p->pPrior = 0; p->pLimit = 0; - pNew = sqlite3SelectDup(db, p, 0); + pNew = tdsqlite3SelectDup(db, p, 0); p->pLimit = pLimit; p->pOrderBy = pOrderBy; p->pSrc = pSrc; @@ -136296,9 +136296,9 @@ static int flattenSubquery( /* Delete the transient table structure associated with the ** subquery */ - sqlite3DbFree(db, pSubitem->zDatabase); - sqlite3DbFree(db, pSubitem->zName); - sqlite3DbFree(db, pSubitem->zAlias); + tdsqlite3DbFree(db, pSubitem->zDatabase); + tdsqlite3DbFree(db, pSubitem->zName); + tdsqlite3DbFree(db, pSubitem->zAlias); pSubitem->zDatabase = 0; pSubitem->zName = 0; pSubitem->zAlias = 0; @@ -136314,7 +136314,7 @@ static int flattenSubquery( if( ALWAYS(pSubitem->pTab!=0) ){ Table *pTabToDel = pSubitem->pTab; if( pTabToDel->nTabRef==1 ){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); + Parse *pToplevel = tdsqlite3ParseToplevel(pParse); pTabToDel->pNextZombie = pToplevel->pZombieTab; pToplevel->pZombieTab = pTabToDel; }else{ @@ -136349,7 +136349,7 @@ static int flattenSubquery( jointype = pSubitem->fg.jointype; }else{ assert( pParent!=p ); /* 2nd and subsequent times through the loop */ - pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0); + pSrc = tdsqlite3SrcListAppend(pParse, 0, 0, 0); if( pSrc==0 ) break; pParent->pSrc = pSrc; } @@ -136370,7 +136370,7 @@ static int flattenSubquery( ** for the two elements in the FROM clause of the subquery. */ if( nSubSrc>1 ){ - pSrc = sqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1); + pSrc = tdsqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1); if( pSrc==0 ) break; pParent->pSrc = pSrc; } @@ -136379,7 +136379,7 @@ static int flattenSubquery( ** outer query. */ for(i=0; ia[i+iFrom].pUsing); + tdsqlite3IdListDelete(db, pSrc->a[i+iFrom].pUsing); assert( pSrc->a[i+iFrom].fg.isTabFunc==0 ); pSrc->a[i+iFrom] = pSubSrc->a[i]; iNewParent = pSubSrc->a[i].iCursor; @@ -136421,9 +136421,9 @@ static int flattenSubquery( pWhere = pSub->pWhere; pSub->pWhere = 0; if( isLeftJoin>0 ){ - sqlite3SetJoinExpr(pWhere, iNewParent); + tdsqlite3SetJoinExpr(pWhere, iNewParent); } - pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere); + pParent->pWhere = tdsqlite3ExprAnd(pParse, pWhere, pParent->pWhere); if( db->mallocFailed==0 ){ SubstContext x; x.pParse = pParse; @@ -136454,12 +136454,12 @@ static int flattenSubquery( /* Finially, delete what is left of the subquery and return ** success. */ - sqlite3SelectDelete(db, pSub1); + tdsqlite3SelectDelete(db, pSub1); #if SELECTTRACE_ENABLED - if( sqlite3SelectTrace & 0x100 ){ + if( tdsqlite3SelectTrace & 0x100 ){ SELECTTRACE(0x100,pParse,p,("After flattening:\n")); - sqlite3TreeViewSelect(0, p, 0); + tdsqlite3TreeViewSelect(0, p, 0); } #endif @@ -136495,12 +136495,12 @@ static void constInsert( ){ int i; assert( pColumn->op==TK_COLUMN ); - assert( sqlite3ExprIsConstant(pValue) ); + assert( tdsqlite3ExprIsConstant(pValue) ); - if( !ExprHasProperty(pValue, EP_FixedCol) && sqlite3ExprAffinity(pValue)!=0 ){ + if( !ExprHasProperty(pValue, EP_FixedCol) && tdsqlite3ExprAffinity(pValue)!=0 ){ return; } - if( !sqlite3IsBinary(sqlite3ExprCompareCollSeq(pConst->pParse,pExpr)) ){ + if( !tdsqlite3IsBinary(tdsqlite3ExprCompareCollSeq(pConst->pParse,pExpr)) ){ return; } @@ -136517,7 +136517,7 @@ static void constInsert( } pConst->nConst++; - pConst->apExpr = sqlite3DbReallocOrFree(pConst->pParse->db, pConst->apExpr, + pConst->apExpr = tdsqlite3DbReallocOrFree(pConst->pParse->db, pConst->apExpr, pConst->nConst*2*sizeof(Expr*)); if( pConst->apExpr==0 ){ pConst->nConst = 0; @@ -136550,10 +136550,10 @@ static void findConstInWhere(WhereConst *pConst, Expr *pExpr){ pLeft = pExpr->pLeft; assert( pRight!=0 ); assert( pLeft!=0 ); - if( pRight->op==TK_COLUMN && sqlite3ExprIsConstant(pLeft) ){ + if( pRight->op==TK_COLUMN && tdsqlite3ExprIsConstant(pLeft) ){ constInsert(pConst,pRight,pLeft,pExpr); } - if( pLeft->op==TK_COLUMN && sqlite3ExprIsConstant(pRight) ){ + if( pLeft->op==TK_COLUMN && tdsqlite3ExprIsConstant(pRight) ){ constInsert(pConst,pLeft,pRight,pExpr); } } @@ -136584,7 +136584,7 @@ static int propagateConstantExprRewrite(Walker *pWalker, Expr *pExpr){ ExprClearProperty(pExpr, EP_Leaf); ExprSetProperty(pExpr, EP_FixedCol); assert( pExpr->pLeft==0 ); - pExpr->pLeft = sqlite3ExprDup(pConst->pParse->db, pConst->apExpr[i*2+1], 0); + pExpr->pLeft = tdsqlite3ExprDup(pConst->pParse->db, pConst->apExpr[i*2+1], 0); break; } return WRC_Prune; @@ -136643,12 +136643,12 @@ static int propagateConstants( memset(&w, 0, sizeof(w)); w.pParse = pParse; w.xExprCallback = propagateConstantExprRewrite; - w.xSelectCallback = sqlite3SelectWalkNoop; + w.xSelectCallback = tdsqlite3SelectWalkNoop; w.xSelectCallback2 = 0; w.walkerDepth = 0; w.u.pConst = &x; - sqlite3WalkExpr(&w, p->pWhere); - sqlite3DbFree(x.pParse->db, x.apExpr); + tdsqlite3WalkExpr(&w, p->pWhere); + tdsqlite3DbFree(x.pParse->db, x.apExpr); nChng += x.nChng; } }while( x.nChng ); @@ -136755,11 +136755,11 @@ static int pushDownWhereTerms( if( ExprHasProperty(pWhere,EP_FromJoin) && pWhere->iRightJoinTable!=iCursor ){ return 0; /* restriction (5) */ } - if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){ + if( tdsqlite3ExprIsTableConstant(pWhere, iCursor) ){ nChng++; while( pSubq ){ SubstContext x; - pNew = sqlite3ExprDup(pParse->db, pWhere, 0); + pNew = tdsqlite3ExprDup(pParse->db, pWhere, 0); unsetJoinExpr(pNew, -1); x.pParse = pParse; x.iTable = iCursor; @@ -136768,9 +136768,9 @@ static int pushDownWhereTerms( x.pEList = pSubq->pEList; pNew = substExpr(&x, pNew); if( pSubq->selFlags & SF_Aggregate ){ - pSubq->pHaving = sqlite3ExprAnd(pParse, pSubq->pHaving, pNew); + pSubq->pHaving = tdsqlite3ExprAnd(pParse, pSubq->pHaving, pNew); }else{ - pSubq->pWhere = sqlite3ExprAnd(pParse, pSubq->pWhere, pNew); + pSubq->pWhere = tdsqlite3ExprAnd(pParse, pSubq->pWhere, pNew); } pSubq = pSubq->pPrior; } @@ -136795,7 +136795,7 @@ static int pushDownWhereTerms( ** located but before their arguments have been subjected to aggregate ** analysis. */ -static u8 minMaxQuery(sqlite3 *db, Expr *pFunc, ExprList **ppMinMax){ +static u8 minMaxQuery(tdsqlite3 *db, Expr *pFunc, ExprList **ppMinMax){ int eRet = WHERE_ORDERBY_NORMAL; /* Return value */ ExprList *pEList = pFunc->x.pList; /* Arguments to agg function */ const char *zFunc; /* Name of aggregate function pFunc */ @@ -136809,16 +136809,16 @@ static u8 minMaxQuery(sqlite3 *db, Expr *pFunc, ExprList **ppMinMax){ return eRet; } zFunc = pFunc->u.zToken; - if( sqlite3StrICmp(zFunc, "min")==0 ){ + if( tdsqlite3StrICmp(zFunc, "min")==0 ){ eRet = WHERE_ORDERBY_MIN; sortFlags = KEYINFO_ORDER_BIGNULL; - }else if( sqlite3StrICmp(zFunc, "max")==0 ){ + }else if( tdsqlite3StrICmp(zFunc, "max")==0 ){ eRet = WHERE_ORDERBY_MAX; sortFlags = KEYINFO_ORDER_DESC; }else{ return eRet; } - *ppMinMax = pOrderBy = sqlite3ExprListDup(db, pEList, 0); + *ppMinMax = pOrderBy = tdsqlite3ExprListDup(db, pEList, 0); assert( pOrderBy!=0 || db->mallocFailed ); if( pOrderBy ) pOrderBy->a[0].sortFlags = sortFlags; return eRet; @@ -136866,17 +136866,17 @@ static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){ ** SQLITE_ERROR and leave an error in pParse. Otherwise, populate ** pFrom->pIndex and return SQLITE_OK. */ -SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *pParse, struct SrcList_item *pFrom){ +SQLITE_PRIVATE int tdsqlite3IndexedByLookup(Parse *pParse, struct SrcList_item *pFrom){ if( pFrom->pTab && pFrom->fg.isIndexedBy ){ Table *pTab = pFrom->pTab; char *zIndexedBy = pFrom->u1.zIndexedBy; Index *pIdx; for(pIdx=pTab->pIndex; - pIdx && sqlite3StrICmp(pIdx->zName, zIndexedBy); + pIdx && tdsqlite3StrICmp(pIdx->zName, zIndexedBy); pIdx=pIdx->pNext ); if( !pIdx ){ - sqlite3ErrorMsg(pParse, "no such index: %s", zIndexedBy, 0); + tdsqlite3ErrorMsg(pParse, "no such index: %s", zIndexedBy, 0); pParse->checkSchema = 1; return SQLITE_ERROR; } @@ -136909,7 +136909,7 @@ static int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){ int i; Select *pNew; Select *pX; - sqlite3 *db; + tdsqlite3 *db; struct ExprList_item *a; SrcList *pNewSrc; Parse *pParse; @@ -136929,14 +136929,14 @@ static int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){ pParse = pWalker->pParse; db = pParse->db; - pNew = sqlite3DbMallocZero(db, sizeof(*pNew) ); + pNew = tdsqlite3DbMallocZero(db, sizeof(*pNew) ); if( pNew==0 ) return WRC_Abort; memset(&dummy, 0, sizeof(dummy)); - pNewSrc = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&dummy,pNew,0,0); + pNewSrc = tdsqlite3SrcListAppendFromTerm(pParse,0,0,0,&dummy,pNew,0,0); if( pNewSrc==0 ) return WRC_Abort; *pNew = *p; p->pSrc = pNewSrc; - p->pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ASTERISK, 0)); + p->pEList = tdsqlite3ExprListAppend(pParse, 0, tdsqlite3Expr(db, TK_ASTERISK, 0)); p->op = TK_SELECT; p->pWhere = 0; pNew->pGroupBy = 0; @@ -136964,7 +136964,7 @@ static int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){ */ static int cannotBeFunction(Parse *pParse, struct SrcList_item *pFrom){ if( pFrom->fg.isTabFunc ){ - sqlite3ErrorMsg(pParse, "'%s' is not a function", pFrom->zName); + tdsqlite3ErrorMsg(pParse, "'%s' is not a function", pFrom->zName); return 1; } return 0; @@ -136992,7 +136992,7 @@ static struct Cte *searchWith( for(p=pWith; p; p=p->pOuter){ int i; for(i=0; inCte; i++){ - if( sqlite3StrICmp(zName, p->a[i].zName)==0 ){ + if( tdsqlite3StrICmp(zName, p->a[i].zName)==0 ){ *ppContext = p; return &p->a[i]; } @@ -137012,7 +137012,7 @@ static struct Cte *searchWith( ** bFree==0, the With object will be freed along with the SELECT ** statement with which it is associated. */ -SQLITE_PRIVATE void sqlite3WithPush(Parse *pParse, With *pWith, u8 bFree){ +SQLITE_PRIVATE void tdsqlite3WithPush(Parse *pParse, With *pWith, u8 bFree){ assert( bFree==0 || (pParse->pWith==0 && pParse->pWithToFree==0) ); if( pWith ){ assert( pParse->pWith!=pWith ); @@ -137042,7 +137042,7 @@ static int withExpand( struct SrcList_item *pFrom ){ Parse *pParse = pWalker->pParse; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; struct Cte *pCte; /* Matched CTE (or NULL if no match) */ With *pWith; /* WITH clause that pCte belongs to */ @@ -137065,20 +137065,20 @@ static int withExpand( ** early. If pCte->zCteErr is NULL, then this is not a recursive reference. ** In this case, proceed. */ if( pCte->zCteErr ){ - sqlite3ErrorMsg(pParse, pCte->zCteErr, pCte->zName); + tdsqlite3ErrorMsg(pParse, pCte->zCteErr, pCte->zName); return SQLITE_ERROR; } if( cannotBeFunction(pParse, pFrom) ) return SQLITE_ERROR; assert( pFrom->pTab==0 ); - pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table)); + pFrom->pTab = pTab = tdsqlite3DbMallocZero(db, sizeof(Table)); if( pTab==0 ) return WRC_Abort; pTab->nTabRef = 1; - pTab->zName = sqlite3DbStrDup(db, pCte->zName); + pTab->zName = tdsqlite3DbStrDup(db, pCte->zName); pTab->iPKey = -1; - pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) ); + pTab->nRowLogEst = 200; assert( 200==tdsqlite3LogEst(1048576) ); pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid; - pFrom->pSelect = sqlite3SelectDup(db, pCte->pSelect, 0); + pFrom->pSelect = tdsqlite3SelectDup(db, pCte->pSelect, 0); if( db->mallocFailed ) return SQLITE_NOMEM_BKPT; assert( pFrom->pSelect ); @@ -137092,7 +137092,7 @@ static int withExpand( struct SrcList_item *pItem = &pSrc->a[i]; if( pItem->zDatabase==0 && pItem->zName!=0 - && 0==sqlite3StrICmp(pItem->zName, pCte->zName) + && 0==tdsqlite3StrICmp(pItem->zName, pCte->zName) ){ pItem->pTab = pTab; pItem->fg.isRecursive = 1; @@ -137104,7 +137104,7 @@ static int withExpand( /* Only one recursive reference is permitted. */ if( pTab->nTabRef>2 ){ - sqlite3ErrorMsg( + tdsqlite3ErrorMsg( pParse, "multiple references to recursive table: %s", pCte->zName ); return SQLITE_ERROR; @@ -137119,10 +137119,10 @@ static int withExpand( Select *pPrior = pSel->pPrior; assert( pPrior->pWith==0 ); pPrior->pWith = pSel->pWith; - sqlite3WalkSelect(pWalker, pPrior); + tdsqlite3WalkSelect(pWalker, pPrior); pPrior->pWith = 0; }else{ - sqlite3WalkSelect(pWalker, pSel); + tdsqlite3WalkSelect(pWalker, pSel); } pParse->pWith = pWith; @@ -137130,7 +137130,7 @@ static int withExpand( pEList = pLeft->pEList; if( pCte->pCols ){ if( pEList && pEList->nExpr!=pCte->pCols->nExpr ){ - sqlite3ErrorMsg(pParse, "table %s has %d values for %d columns", + tdsqlite3ErrorMsg(pParse, "table %s has %d values for %d columns", pCte->zName, pEList->nExpr, pCte->pCols->nExpr ); pParse->pWith = pSavedWith; @@ -137139,14 +137139,14 @@ static int withExpand( pEList = pCte->pCols; } - sqlite3ColumnsFromExprList(pParse, pEList, &pTab->nCol, &pTab->aCol); + tdsqlite3ColumnsFromExprList(pParse, pEList, &pTab->nCol, &pTab->aCol); if( bMayRecursive ){ if( pSel->selFlags & SF_Recursive ){ pCte->zCteErr = "multiple recursive references: %s"; }else{ pCte->zCteErr = "recursive reference in a subquery: %s"; } - sqlite3WalkSelect(pWalker, pSel); + tdsqlite3WalkSelect(pWalker, pSel); } pCte->zCteErr = 0; pParse->pWith = pSavedWith; @@ -137162,7 +137162,7 @@ static int withExpand( ** clause, pop it from the stack stored as part of the Parse object. ** ** This function is used as the xSelectCallback2() callback by -** sqlite3SelectExpand() when walking a SELECT tree to resolve table +** tdsqlite3SelectExpand() when walking a SELECT tree to resolve table ** names and other FROM clause elements. */ static void selectPopWith(Walker *pWalker, Select *p){ @@ -137186,23 +137186,23 @@ static void selectPopWith(Walker *pWalker, Select *p){ ** SQLITE_OK is returned. Otherwise, if an OOM error is encountered, ** SQLITE_NOMEM. */ -SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse *pParse, struct SrcList_item *pFrom){ +SQLITE_PRIVATE int tdsqlite3ExpandSubquery(Parse *pParse, struct SrcList_item *pFrom){ Select *pSel = pFrom->pSelect; Table *pTab; assert( pSel ); - pFrom->pTab = pTab = sqlite3DbMallocZero(pParse->db, sizeof(Table)); + pFrom->pTab = pTab = tdsqlite3DbMallocZero(pParse->db, sizeof(Table)); if( pTab==0 ) return SQLITE_NOMEM; pTab->nTabRef = 1; if( pFrom->zAlias ){ - pTab->zName = sqlite3DbStrDup(pParse->db, pFrom->zAlias); + pTab->zName = tdsqlite3DbStrDup(pParse->db, pFrom->zAlias); }else{ - pTab->zName = sqlite3MPrintf(pParse->db, "subquery_%u", pSel->selId); + pTab->zName = tdsqlite3MPrintf(pParse->db, "subquery_%u", pSel->selId); } while( pSel->pPrior ){ pSel = pSel->pPrior; } - sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol); + tdsqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol); pTab->iPKey = -1; - pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) ); + pTab->nRowLogEst = 200; assert( 200==tdsqlite3LogEst(1048576) ); pTab->tabFlags |= TF_Ephemeral; return pParse->nErr ? SQLITE_ERROR : SQLITE_OK; @@ -137238,7 +137238,7 @@ static int selectExpander(Walker *pWalker, Select *p){ SrcList *pTabList; ExprList *pEList; struct SrcList_item *pFrom; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Expr *pE, *pRight, *pExpr; u16 selFlags = p->selFlags; u32 elistFlags = 0; @@ -137257,12 +137257,12 @@ static int selectExpander(Walker *pWalker, Select *p){ } pTabList = p->pSrc; pEList = p->pEList; - sqlite3WithPush(pParse, p->pWith, 0); + tdsqlite3WithPush(pParse, p->pWith, 0); /* Make sure cursor numbers have been assigned to all entries in ** the FROM clause of the SELECT statement. */ - sqlite3SrcListAssignCursors(pParse, pTabList); + tdsqlite3SrcListAssignCursors(pParse, pTabList); /* Look up every table named in the FROM clause of the select. If ** an entry of the FROM clause is a subquery instead of a table or view, @@ -137283,16 +137283,16 @@ static int selectExpander(Walker *pWalker, Select *p){ /* A sub-query in the FROM clause of a SELECT */ assert( pSel!=0 ); assert( pFrom->pTab==0 ); - if( sqlite3WalkSelect(pWalker, pSel) ) return WRC_Abort; - if( sqlite3ExpandSubquery(pParse, pFrom) ) return WRC_Abort; + if( tdsqlite3WalkSelect(pWalker, pSel) ) return WRC_Abort; + if( tdsqlite3ExpandSubquery(pParse, pFrom) ) return WRC_Abort; #endif }else{ /* An ordinary table or view name in the FROM clause */ assert( pFrom->pTab==0 ); - pFrom->pTab = pTab = sqlite3LocateTableItem(pParse, 0, pFrom); + pFrom->pTab = pTab = tdsqlite3LocateTableItem(pParse, 0, pFrom); if( pTab==0 ) return WRC_Abort; if( pTab->nTabRef>=0xffff ){ - sqlite3ErrorMsg(pParse, "too many references to \"%s\": max 65535", + tdsqlite3ErrorMsg(pParse, "too many references to \"%s\": max 65535", pTab->zName); pFrom->pTab = 0; return WRC_Abort; @@ -137305,10 +137305,10 @@ static int selectExpander(Walker *pWalker, Select *p){ if( IsVirtual(pTab) || pTab->pSelect ){ i16 nCol; u8 eCodeOrig = pWalker->eCode; - if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort; + if( tdsqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort; assert( pFrom->pSelect==0 ); if( pTab->pSelect && (db->flags & SQLITE_EnableView)==0 ){ - sqlite3ErrorMsg(pParse, "access to view \"%s\" prohibited", + tdsqlite3ErrorMsg(pParse, "access to view \"%s\" prohibited", pTab->zName); } #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -137317,15 +137317,15 @@ static int selectExpander(Walker *pWalker, Select *p){ && ALWAYS(pTab->pVTable!=0) && pTab->pVTable->eVtabRisk > ((db->flags & SQLITE_TrustedSchema)!=0) ){ - sqlite3ErrorMsg(pParse, "unsafe use of virtual table \"%s\"", + tdsqlite3ErrorMsg(pParse, "unsafe use of virtual table \"%s\"", pTab->zName); } #endif - pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0); + pFrom->pSelect = tdsqlite3SelectDup(db, pTab->pSelect, 0); nCol = pTab->nCol; pTab->nCol = -1; pWalker->eCode = 1; /* Turn on Select.selId renumbering */ - sqlite3WalkSelect(pWalker, pFrom->pSelect); + tdsqlite3WalkSelect(pWalker, pFrom->pSelect); pWalker->eCode = eCodeOrig; pTab->nCol = nCol; } @@ -137333,7 +137333,7 @@ static int selectExpander(Walker *pWalker, Select *p){ } /* Locate the index named by the INDEXED BY clause, if any. */ - if( sqlite3IndexedByLookup(pParse, pFrom) ){ + if( tdsqlite3IndexedByLookup(pParse, pFrom) ){ return WRC_Abort; } } @@ -137385,7 +137385,7 @@ static int selectExpander(Walker *pWalker, Select *p){ ){ /* This particular expression does not need to be expanded. */ - pNew = sqlite3ExprListAppend(pParse, pNew, a[k].pExpr); + pNew = tdsqlite3ExprListAppend(pParse, pNew, a[k].pExpr); if( pNew ){ pNew->a[pNew->nExpr-1].zEName = a[k].zEName; pNew->a[pNew->nExpr-1].eEName = a[k].eEName; @@ -137414,10 +137414,10 @@ static int selectExpander(Walker *pWalker, Select *p){ if( db->mallocFailed ) break; if( pSub==0 || (pSub->selFlags & SF_NestedFrom)==0 ){ pSub = 0; - if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){ + if( zTName && tdsqlite3StrICmp(zTName, zTabName)!=0 ){ continue; } - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); + iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); zSchemaName = iDb>=0 ? db->aDb[iDb].zDbSName : "*"; } for(j=0; jnCol; j++){ @@ -137428,7 +137428,7 @@ static int selectExpander(Walker *pWalker, Select *p){ assert( zName ); if( zTName && pSub - && sqlite3MatchEName(&pSub->pEList->a[j], 0, zTName, 0)==0 + && tdsqlite3MatchEName(&pSub->pEList->a[j], 0, zTName, 0)==0 ){ continue; } @@ -137452,64 +137452,64 @@ static int selectExpander(Walker *pWalker, Select *p){ ** table to the right of the join */ continue; } - if( sqlite3IdListIndex(pFrom->pUsing, zName)>=0 ){ + if( tdsqlite3IdListIndex(pFrom->pUsing, zName)>=0 ){ /* In a join with a USING clause, omit columns in the ** using clause from the table on the right. */ continue; } } - pRight = sqlite3Expr(db, TK_ID, zName); + pRight = tdsqlite3Expr(db, TK_ID, zName); zColname = zName; zToFree = 0; if( longNames || pTabList->nSrc>1 ){ Expr *pLeft; - pLeft = sqlite3Expr(db, TK_ID, zTabName); - pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight); + pLeft = tdsqlite3Expr(db, TK_ID, zTabName); + pExpr = tdsqlite3PExpr(pParse, TK_DOT, pLeft, pRight); if( zSchemaName ){ - pLeft = sqlite3Expr(db, TK_ID, zSchemaName); - pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pExpr); + pLeft = tdsqlite3Expr(db, TK_ID, zSchemaName); + pExpr = tdsqlite3PExpr(pParse, TK_DOT, pLeft, pExpr); } if( longNames ){ - zColname = sqlite3MPrintf(db, "%s.%s", zTabName, zName); + zColname = tdsqlite3MPrintf(db, "%s.%s", zTabName, zName); zToFree = zColname; } }else{ pExpr = pRight; } - pNew = sqlite3ExprListAppend(pParse, pNew, pExpr); - sqlite3TokenInit(&sColname, zColname); - sqlite3ExprListSetName(pParse, pNew, &sColname, 0); + pNew = tdsqlite3ExprListAppend(pParse, pNew, pExpr); + tdsqlite3TokenInit(&sColname, zColname); + tdsqlite3ExprListSetName(pParse, pNew, &sColname, 0); if( pNew && (p->selFlags & SF_NestedFrom)!=0 ){ struct ExprList_item *pX = &pNew->a[pNew->nExpr-1]; - sqlite3DbFree(db, pX->zEName); + tdsqlite3DbFree(db, pX->zEName); if( pSub ){ - pX->zEName = sqlite3DbStrDup(db, pSub->pEList->a[j].zEName); + pX->zEName = tdsqlite3DbStrDup(db, pSub->pEList->a[j].zEName); testcase( pX->zEName==0 ); }else{ - pX->zEName = sqlite3MPrintf(db, "%s.%s.%s", + pX->zEName = tdsqlite3MPrintf(db, "%s.%s.%s", zSchemaName, zTabName, zColname); testcase( pX->zEName==0 ); } pX->eEName = ENAME_TAB; } - sqlite3DbFree(db, zToFree); + tdsqlite3DbFree(db, zToFree); } } if( !tableSeen ){ if( zTName ){ - sqlite3ErrorMsg(pParse, "no such table: %s", zTName); + tdsqlite3ErrorMsg(pParse, "no such table: %s", zTName); }else{ - sqlite3ErrorMsg(pParse, "no tables specified"); + tdsqlite3ErrorMsg(pParse, "no tables specified"); } } } } - sqlite3ExprListDelete(db, pEList); + tdsqlite3ExprListDelete(db, pEList); p->pEList = pNew; } if( p->pEList ){ if( p->pEList->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){ - sqlite3ErrorMsg(pParse, "too many columns in result set"); + tdsqlite3ErrorMsg(pParse, "too many columns in result set"); return WRC_Abort; } if( (elistFlags & (EP_HasFunc|EP_Subquery))!=0 ){ @@ -137528,7 +137528,7 @@ static int selectExpander(Walker *pWalker, Select *p){ ** Walker.xSelectCallback is set to do something useful for every ** subquery in the parser tree. */ -SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){ +SQLITE_PRIVATE int tdsqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){ UNUSED_PARAMETER2(NotUsed, NotUsed2); return WRC_Continue; } @@ -137537,7 +137537,7 @@ SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){ ** No-op routine for the parse-tree walker for SELECT statements. ** subquery in the parser tree. */ -SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){ +SQLITE_PRIVATE int tdsqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){ UNUSED_PARAMETER2(NotUsed, NotUsed2); return WRC_Continue; } @@ -137547,7 +137547,7 @@ SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){ ** Always assert. This xSelectCallback2 implementation proves that the ** xSelectCallback2 is never invoked. */ -SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker *NotUsed, Select *NotUsed2){ +SQLITE_PRIVATE void tdsqlite3SelectWalkAssert2(Walker *NotUsed, Select *NotUsed2){ UNUSED_PARAMETER2(NotUsed, NotUsed2); assert( 0 ); } @@ -137565,25 +137565,25 @@ SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker *NotUsed, Select *NotUsed2){ ** The calling function can detect the problem by looking at pParse->nErr ** and/or pParse->db->mallocFailed. */ -static void sqlite3SelectExpand(Parse *pParse, Select *pSelect){ +static void tdsqlite3SelectExpand(Parse *pParse, Select *pSelect){ Walker w; - w.xExprCallback = sqlite3ExprWalkNoop; + w.xExprCallback = tdsqlite3ExprWalkNoop; w.pParse = pParse; if( OK_IF_ALWAYS_TRUE(pParse->hasCompound) ){ w.xSelectCallback = convertCompoundSelectToSubquery; w.xSelectCallback2 = 0; - sqlite3WalkSelect(&w, pSelect); + tdsqlite3WalkSelect(&w, pSelect); } w.xSelectCallback = selectExpander; w.xSelectCallback2 = selectPopWith; w.eCode = 0; - sqlite3WalkSelect(&w, pSelect); + tdsqlite3WalkSelect(&w, pSelect); } #ifndef SQLITE_OMIT_SUBQUERY /* -** This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo() +** This is a Walker.xSelectCallback callback for the tdsqlite3SelectTypeInfo() ** interface. ** ** For each FROM-clause subquery, add Column.zType and Column.zColl @@ -137614,7 +137614,7 @@ static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){ Select *pSel = pFrom->pSelect; if( pSel ){ while( pSel->pPrior ) pSel = pSel->pPrior; - sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSel, + tdsqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSel, SQLITE_AFF_NONE); } } @@ -137630,14 +137630,14 @@ static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){ ** ** Use this routine after name resolution. */ -static void sqlite3SelectAddTypeInfo(Parse *pParse, Select *pSelect){ +static void tdsqlite3SelectAddTypeInfo(Parse *pParse, Select *pSelect){ #ifndef SQLITE_OMIT_SUBQUERY Walker w; - w.xSelectCallback = sqlite3SelectWalkNoop; + w.xSelectCallback = tdsqlite3SelectWalkNoop; w.xSelectCallback2 = selectAddSubqueryTypeInfo; - w.xExprCallback = sqlite3ExprWalkNoop; + w.xExprCallback = tdsqlite3ExprWalkNoop; w.pParse = pParse; - sqlite3WalkSelect(&w, pSelect); + tdsqlite3WalkSelect(&w, pSelect); #endif } @@ -137654,7 +137654,7 @@ static void sqlite3SelectAddTypeInfo(Parse *pParse, Select *pSelect){ ** ** This routine acts recursively on all subqueries within the SELECT. */ -SQLITE_PRIVATE void sqlite3SelectPrep( +SQLITE_PRIVATE void tdsqlite3SelectPrep( Parse *pParse, /* The parser context */ Select *p, /* The SELECT statement being coded. */ NameContext *pOuterNC /* Name context for container */ @@ -137662,11 +137662,11 @@ SQLITE_PRIVATE void sqlite3SelectPrep( assert( p!=0 || pParse->db->mallocFailed ); if( pParse->db->mallocFailed ) return; if( p->selFlags & SF_HasTypeInfo ) return; - sqlite3SelectExpand(pParse, p); + tdsqlite3SelectExpand(pParse, p); if( pParse->nErr || pParse->db->mallocFailed ) return; - sqlite3ResolveSelectNames(pParse, p, pOuterNC); + tdsqlite3ResolveSelectNames(pParse, p, pOuterNC); if( pParse->nErr || pParse->db->mallocFailed ) return; - sqlite3SelectAddTypeInfo(pParse, p); + tdsqlite3SelectAddTypeInfo(pParse, p); } /* @@ -137696,18 +137696,18 @@ static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){ && pAggInfo->aFunc[i].iMem<=pAggInfo->mxReg ); } #endif - sqlite3VdbeAddOp3(v, OP_Null, 0, pAggInfo->mnReg, pAggInfo->mxReg); + tdsqlite3VdbeAddOp3(v, OP_Null, 0, pAggInfo->mnReg, pAggInfo->mxReg); for(pFunc=pAggInfo->aFunc, i=0; inFunc; i++, pFunc++){ if( pFunc->iDistinct>=0 ){ Expr *pE = pFunc->pExpr; assert( !ExprHasProperty(pE, EP_xIsSelect) ); if( pE->x.pList==0 || pE->x.pList->nExpr!=1 ){ - sqlite3ErrorMsg(pParse, "DISTINCT aggregates must have exactly one " + tdsqlite3ErrorMsg(pParse, "DISTINCT aggregates must have exactly one " "argument"); pFunc->iDistinct = -1; }else{ - KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pE->x.pList,0,0); - sqlite3VdbeAddOp4(v, OP_OpenEphemeral, pFunc->iDistinct, 0, 0, + KeyInfo *pKeyInfo = tdsqlite3KeyInfoFromExprList(pParse, pE->x.pList,0,0); + tdsqlite3VdbeAddOp4(v, OP_OpenEphemeral, pFunc->iDistinct, 0, 0, (char*)pKeyInfo, P4_KEYINFO); } } @@ -137725,8 +137725,8 @@ static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ for(i=0, pF=pAggInfo->aFunc; inFunc; i++, pF++){ ExprList *pList = pF->pExpr->x.pList; assert( !ExprHasProperty(pF->pExpr, EP_xIsSelect) ); - sqlite3VdbeAddOp2(v, OP_AggFinal, pF->iMem, pList ? pList->nExpr : 0); - sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); + tdsqlite3VdbeAddOp2(v, OP_AggFinal, pF->iMem, pList ? pList->nExpr : 0); + tdsqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); } } @@ -137769,22 +137769,22 @@ static void updateAccumulator(Parse *pParse, int regAcc, AggInfo *pAggInfo){ ** the first row (regAcc==1), set the magnet register so that the ** accumulators are not populated unless the min()/max() is invoked and ** indicates that they should be. */ - sqlite3VdbeAddOp2(v, OP_Copy, regAcc, regHit); + tdsqlite3VdbeAddOp2(v, OP_Copy, regAcc, regHit); } - addrNext = sqlite3VdbeMakeLabel(pParse); - sqlite3ExprIfFalse(pParse, pFilter, addrNext, SQLITE_JUMPIFNULL); + addrNext = tdsqlite3VdbeMakeLabel(pParse); + tdsqlite3ExprIfFalse(pParse, pFilter, addrNext, SQLITE_JUMPIFNULL); } if( pList ){ nArg = pList->nExpr; - regAgg = sqlite3GetTempRange(pParse, nArg); - sqlite3ExprCodeExprList(pParse, pList, regAgg, 0, SQLITE_ECEL_DUP); + regAgg = tdsqlite3GetTempRange(pParse, nArg); + tdsqlite3ExprCodeExprList(pParse, pList, regAgg, 0, SQLITE_ECEL_DUP); }else{ nArg = 0; regAgg = 0; } if( pF->iDistinct>=0 ){ if( addrNext==0 ){ - addrNext = sqlite3VdbeMakeLabel(pParse); + addrNext = tdsqlite3VdbeMakeLabel(pParse); } testcase( nArg==0 ); /* Error condition */ testcase( nArg>1 ); /* Also an error */ @@ -137796,35 +137796,35 @@ static void updateAccumulator(Parse *pParse, int regAcc, AggInfo *pAggInfo){ int j; assert( pList!=0 ); /* pList!=0 if pF->pFunc has NEEDCOLL */ for(j=0, pItem=pList->a; !pColl && jpExpr); + pColl = tdsqlite3ExprCollSeq(pParse, pItem->pExpr); } if( !pColl ){ pColl = pParse->db->pDfltColl; } if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem; - sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ); + tdsqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ); } - sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, pF->iMem); - sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); - sqlite3VdbeChangeP5(v, (u8)nArg); - sqlite3ReleaseTempRange(pParse, regAgg, nArg); + tdsqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, pF->iMem); + tdsqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); + tdsqlite3VdbeChangeP5(v, (u8)nArg); + tdsqlite3ReleaseTempRange(pParse, regAgg, nArg); if( addrNext ){ - sqlite3VdbeResolveLabel(v, addrNext); + tdsqlite3VdbeResolveLabel(v, addrNext); } } if( regHit==0 && pAggInfo->nAccumulator ){ regHit = regAcc; } if( regHit ){ - addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit); VdbeCoverage(v); + addrHitTest = tdsqlite3VdbeAddOp1(v, OP_If, regHit); VdbeCoverage(v); } for(i=0, pC=pAggInfo->aCol; inAccumulator; i++, pC++){ - sqlite3ExprCode(pParse, pC->pExpr, pC->iMem); + tdsqlite3ExprCode(pParse, pC->pExpr, pC->iMem); } pAggInfo->directMode = 0; if( addrHitTest ){ - sqlite3VdbeJumpHere(v, addrHitTest); + tdsqlite3VdbeJumpHere(v, addrHitTest); } } @@ -137840,7 +137840,7 @@ static void explainSimpleCount( ){ if( pParse->explain==2 ){ int bCover = (pIdx!=0 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pIdx))); - sqlite3VdbeExplain(pParse, 0, "SCAN TABLE %s%s%s", + tdsqlite3VdbeExplain(pParse, 0, "SCAN TABLE %s%s%s", pTab->zName, bCover ? " USING COVERING INDEX " : "", bCover ? pIdx->zName : "" @@ -137852,10 +137852,10 @@ static void explainSimpleCount( #endif /* -** sqlite3WalkExpr() callback used by havingToWhere(). +** tdsqlite3WalkExpr() callback used by havingToWhere(). ** ** If the node passed to the callback is a TK_AND node, return -** WRC_Continue to tell sqlite3WalkExpr() to iterate through child nodes. +** WRC_Continue to tell tdsqlite3WalkExpr() to iterate through child nodes. ** ** Otherwise, return WRC_Prune. In this case, also check if the ** sub-expression matches the criteria for being moved to the WHERE @@ -137865,13 +137865,13 @@ static void explainSimpleCount( static int havingToWhereExprCb(Walker *pWalker, Expr *pExpr){ if( pExpr->op!=TK_AND ){ Select *pS = pWalker->u.pSelect; - if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) ){ - sqlite3 *db = pWalker->pParse->db; - Expr *pNew = sqlite3Expr(db, TK_INTEGER, "1"); + if( tdsqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) ){ + tdsqlite3 *db = pWalker->pParse->db; + Expr *pNew = tdsqlite3Expr(db, TK_INTEGER, "1"); if( pNew ){ Expr *pWhere = pS->pWhere; SWAP(Expr, *pNew, *pExpr); - pNew = sqlite3ExprAnd(pWalker->pParse, pWhere, pNew); + pNew = tdsqlite3ExprAnd(pWalker->pParse, pWhere, pNew); pS->pWhere = pNew; pWalker->eCode = 1; } @@ -137902,11 +137902,11 @@ static void havingToWhere(Parse *pParse, Select *p){ sWalker.pParse = pParse; sWalker.xExprCallback = havingToWhereExprCb; sWalker.u.pSelect = p; - sqlite3WalkExpr(&sWalker, p->pHaving); + tdsqlite3WalkExpr(&sWalker, p->pHaving); #if SELECTTRACE_ENABLED - if( sWalker.eCode && (sqlite3SelectTrace & 0x100)!=0 ){ + if( sWalker.eCode && (tdsqlite3SelectTrace & 0x100)!=0 ){ SELECTTRACE(0x100,pParse,p,("Move HAVING terms into WHERE:\n")); - sqlite3TreeViewSelect(0, p, 0); + tdsqlite3TreeViewSelect(0, p, 0); } #endif } @@ -137929,15 +137929,15 @@ static struct SrcList_item *isSelfJoinView( assert( pItem->pTab!=0 ); assert( pThis->pTab!=0 ); if( pItem->pTab->pSchema!=pThis->pTab->pSchema ) continue; - if( sqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue; + if( tdsqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue; pS1 = pItem->pSelect; if( pItem->pTab->pSchema==0 && pThis->pSelect->selId!=pS1->selId ){ /* The query flattener left two different CTE tables with identical ** names in the same FROM clause. */ continue; } - if( sqlite3ExprCompare(0, pThis->pSelect->pWhere, pS1->pWhere, -1) - || sqlite3ExprCompare(0, pThis->pSelect->pHaving, pS1->pHaving, -1) + if( tdsqlite3ExprCompare(0, pThis->pSelect->pWhere, pS1->pWhere, -1) + || tdsqlite3ExprCompare(0, pThis->pSelect->pHaving, pS1->pHaving, -1) ){ /* The view was modified by some other optimization such as ** pushDownWhereTerms() */ @@ -137972,14 +137972,14 @@ static int countOfViewOptimization(Parse *pParse, Select *p){ Select *pSub, *pPrior; Expr *pExpr; Expr *pCount; - sqlite3 *db; + tdsqlite3 *db; if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate */ if( p->pEList->nExpr!=1 ) return 0; /* Single result column */ if( p->pWhere ) return 0; if( p->pGroupBy ) return 0; pExpr = p->pEList->a[0].pExpr; if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */ - if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0; /* Is count() */ + if( tdsqlite3_stricmp(pExpr->u.zToken,"count") ) return 0; /* Is count() */ if( pExpr->x.pList!=0 ) return 0; /* Must be count(*) */ if( p->pSrc->nSrc!=1 ) return 0; /* One table in FROM */ pSub = p->pSrc->a[0].pSelect; @@ -138000,8 +138000,8 @@ static int countOfViewOptimization(Parse *pParse, Select *p){ pExpr = 0; pSub = p->pSrc->a[0].pSelect; p->pSrc->a[0].pSelect = 0; - sqlite3SrcListDelete(db, p->pSrc); - p->pSrc = sqlite3DbMallocZero(pParse->db, sizeof(*p->pSrc)); + tdsqlite3SrcListDelete(db, p->pSrc); + p->pSrc = tdsqlite3DbMallocZero(pParse->db, sizeof(*p->pSrc)); while( pSub ){ Expr *pTerm; pPrior = pSub->pPrior; @@ -138010,15 +138010,15 @@ static int countOfViewOptimization(Parse *pParse, Select *p){ pSub->selFlags |= SF_Aggregate; pSub->selFlags &= ~SF_Compound; pSub->nSelectRow = 0; - sqlite3ExprListDelete(db, pSub->pEList); - pTerm = pPrior ? sqlite3ExprDup(db, pCount, 0) : pCount; - pSub->pEList = sqlite3ExprListAppend(pParse, 0, pTerm); - pTerm = sqlite3PExpr(pParse, TK_SELECT, 0, 0); - sqlite3PExprAddSelect(pParse, pTerm, pSub); + tdsqlite3ExprListDelete(db, pSub->pEList); + pTerm = pPrior ? tdsqlite3ExprDup(db, pCount, 0) : pCount; + pSub->pEList = tdsqlite3ExprListAppend(pParse, 0, pTerm); + pTerm = tdsqlite3PExpr(pParse, TK_SELECT, 0, 0); + tdsqlite3PExprAddSelect(pParse, pTerm, pSub); if( pExpr==0 ){ pExpr = pTerm; }else{ - pExpr = sqlite3PExpr(pParse, TK_PLUS, pTerm, pExpr); + pExpr = tdsqlite3PExpr(pParse, TK_PLUS, pTerm, pExpr); } pSub = pPrior; } @@ -138026,9 +138026,9 @@ static int countOfViewOptimization(Parse *pParse, Select *p){ p->selFlags &= ~SF_Aggregate; #if SELECTTRACE_ENABLED - if( sqlite3SelectTrace & 0x400 ){ + if( tdsqlite3SelectTrace & 0x400 ){ SELECTTRACE(0x400,pParse,p,("After count-of-view optimization:\n")); - sqlite3TreeViewSelect(0, p, 0); + tdsqlite3TreeViewSelect(0, p, 0); } #endif return 1; @@ -138048,13 +138048,13 @@ static int countOfViewOptimization(Parse *pParse, Select *p){ ** This routine does NOT free the Select structure passed in. The ** calling function needs to do that. */ -SQLITE_PRIVATE int sqlite3Select( +SQLITE_PRIVATE int tdsqlite3Select( Parse *pParse, /* The parser context */ Select *p, /* The SELECT statement being coded. */ SelectDest *pDest /* What to do with the query results */ ){ int i, j; /* Loop counters */ - WhereInfo *pWInfo; /* Return from sqlite3WhereBegin() */ + WhereInfo *pWInfo; /* Return from tdsqlite3WhereBegin() */ Vdbe *v; /* The virtual machine under construction */ int isAgg; /* True for select lists like "count(*)" */ ExprList *pEList = 0; /* List of columns to extract. */ @@ -138067,21 +138067,21 @@ SQLITE_PRIVATE int sqlite3Select( SortCtx sSort; /* Info on how to code the ORDER BY clause */ AggInfo sAggInfo; /* Information used by aggregate queries */ int iEnd; /* Address of the end of the query */ - sqlite3 *db; /* The database connection */ + tdsqlite3 *db; /* The database connection */ ExprList *pMinMaxOrderBy = 0; /* Added ORDER BY for min/max queries */ u8 minMaxFlag; /* Flag for min/max queries */ db = pParse->db; - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( p==0 || db->mallocFailed || pParse->nErr ){ return 1; } - if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; + if( tdsqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; memset(&sAggInfo, 0, sizeof(sAggInfo)); #if SELECTTRACE_ENABLED SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain)); - if( sqlite3SelectTrace & 0x100 ){ - sqlite3TreeViewSelect(0, p, 0); + if( tdsqlite3SelectTrace & 0x100 ){ + tdsqlite3TreeViewSelect(0, p, 0); } #endif @@ -138096,19 +138096,19 @@ SQLITE_PRIVATE int sqlite3Select( pDest->eDest==SRT_DistQueue || pDest->eDest==SRT_Fifo); /* If ORDER BY makes no difference in the output then neither does ** DISTINCT so it can be removed too. */ - sqlite3ExprListDelete(db, p->pOrderBy); + tdsqlite3ExprListDelete(db, p->pOrderBy); p->pOrderBy = 0; p->selFlags &= ~SF_Distinct; } - sqlite3SelectPrep(pParse, p, 0); + tdsqlite3SelectPrep(pParse, p, 0); if( pParse->nErr || db->mallocFailed ){ goto select_end; } assert( p->pEList!=0 ); #if SELECTTRACE_ENABLED - if( sqlite3SelectTrace & 0x104 ){ + if( tdsqlite3SelectTrace & 0x104 ){ SELECTTRACE(0x104,pParse,p, ("after name resolution:\n")); - sqlite3TreeViewSelect(0, p, 0); + tdsqlite3TreeViewSelect(0, p, 0); } #endif @@ -138117,15 +138117,15 @@ SQLITE_PRIVATE int sqlite3Select( } #ifndef SQLITE_OMIT_WINDOWFUNC - rc = sqlite3WindowRewrite(pParse, p); + rc = tdsqlite3WindowRewrite(pParse, p); if( rc ){ assert( db->mallocFailed || pParse->nErr>0 ); goto select_end; } #if SELECTTRACE_ENABLED - if( p->pWin && (sqlite3SelectTrace & 0x108)!=0 ){ + if( p->pWin && (tdsqlite3SelectTrace & 0x108)!=0 ){ SELECTTRACE(0x104,pParse,p, ("after window rewrite:\n")); - sqlite3TreeViewSelect(0, p, 0); + tdsqlite3TreeViewSelect(0, p, 0); } #endif #endif /* SQLITE_OMIT_WINDOWFUNC */ @@ -138147,7 +138147,7 @@ SQLITE_PRIVATE int sqlite3Select( ** of the LEFT JOIN used in the WHERE clause. */ if( (pItem->fg.jointype & JT_LEFT)!=0 - && sqlite3ExprImpliesNonNullRow(p->pWhere, pItem->iCursor) + && tdsqlite3ExprImpliesNonNullRow(p->pWhere, pItem->iCursor) && OptimizationEnabled(db, SQLITE_SimplifyJoin) ){ SELECTTRACE(0x100,pParse,p, @@ -138162,7 +138162,7 @@ SQLITE_PRIVATE int sqlite3Select( /* Catch mismatch in the declared columns of a view and the number of ** columns in the SELECT on the RHS */ if( pTab->nCol!=pSub->pEList->nExpr ){ - sqlite3ErrorMsg(pParse, "expected %d columns for '%s' but got %d", + tdsqlite3ErrorMsg(pParse, "expected %d columns for '%s' but got %d", pTab->nCol, pTab->zName, pSub->pEList->nExpr); goto select_end; } @@ -138225,8 +138225,8 @@ SQLITE_PRIVATE int sqlite3Select( rc = multiSelect(pParse, p, pDest); #if SELECTTRACE_ENABLED SELECTTRACE(0x1,pParse,p,("end compound-select processing\n")); - if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){ - sqlite3TreeViewSelect(0, p, 0); + if( (tdsqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){ + tdsqlite3TreeViewSelect(0, p, 0); } #endif if( p->pNext==0 ) ExplainQueryPlanPop(pParse); @@ -138237,16 +138237,16 @@ SQLITE_PRIVATE int sqlite3Select( /* Do the WHERE-clause constant propagation optimization if this is ** a join. No need to speed time on this operation for non-join queries ** as the equivalent optimization will be handled by query planner in - ** sqlite3WhereBegin(). + ** tdsqlite3WhereBegin(). */ if( pTabList->nSrc>1 && OptimizationEnabled(db, SQLITE_PropagateConst) && propagateConstants(pParse, p) ){ #if SELECTTRACE_ENABLED - if( sqlite3SelectTrace & 0x100 ){ + if( tdsqlite3SelectTrace & 0x100 ){ SELECTTRACE(0x100,pParse,p,("After constant propagation:\n")); - sqlite3TreeViewSelect(0, p, 0); + tdsqlite3TreeViewSelect(0, p, 0); } #endif }else{ @@ -138292,7 +138292,7 @@ SQLITE_PRIVATE int sqlite3Select( ** string for the fake column name seems safer. */ if( pItem->colUsed==0 && pItem->zName!=0 ){ - sqlite3AuthCheck(pParse, SQLITE_READ, pItem->zName, "", pItem->zDatabase); + tdsqlite3AuthCheck(pParse, SQLITE_READ, pItem->zName, "", pItem->zDatabase); } #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) @@ -138322,7 +138322,7 @@ SQLITE_PRIVATE int sqlite3Select( ** more conservative than necessary, but much easier than enforcing ** an exact limit. */ - pParse->nHeight += sqlite3SelectExprHeight(p); + pParse->nHeight += tdsqlite3SelectExprHeight(p); /* Make copies of constant WHERE-clause terms in the outer query down ** inside the subquery. This can help the subquery to run more efficiently. @@ -138332,10 +138332,10 @@ SQLITE_PRIVATE int sqlite3Select( (pItem->fg.jointype & JT_OUTER)!=0) ){ #if SELECTTRACE_ENABLED - if( sqlite3SelectTrace & 0x100 ){ + if( tdsqlite3SelectTrace & 0x100 ){ SELECTTRACE(0x100,pParse,p, ("After WHERE-clause push-down into subquery %d:\n", pSub->selId)); - sqlite3TreeViewSelect(0, p, 0); + tdsqlite3TreeViewSelect(0, p, 0); } #endif }else{ @@ -138361,21 +138361,21 @@ SQLITE_PRIVATE int sqlite3Select( /* Implement a co-routine that will return a single row of the result ** set on each invocation. */ - int addrTop = sqlite3VdbeCurrentAddr(v)+1; + int addrTop = tdsqlite3VdbeCurrentAddr(v)+1; pItem->regReturn = ++pParse->nMem; - sqlite3VdbeAddOp3(v, OP_InitCoroutine, pItem->regReturn, 0, addrTop); + tdsqlite3VdbeAddOp3(v, OP_InitCoroutine, pItem->regReturn, 0, addrTop); VdbeComment((v, "%s", pItem->pTab->zName)); pItem->addrFillSub = addrTop; - sqlite3SelectDestInit(&dest, SRT_Coroutine, pItem->regReturn); + tdsqlite3SelectDestInit(&dest, SRT_Coroutine, pItem->regReturn); ExplainQueryPlan((pParse, 1, "CO-ROUTINE %u", pSub->selId)); - sqlite3Select(pParse, pSub, &dest); + tdsqlite3Select(pParse, pSub, &dest); pItem->pTab->nRowLogEst = pSub->nSelectRow; pItem->fg.viaCoroutine = 1; pItem->regResult = dest.iSdst; - sqlite3VdbeEndCoroutine(v, pItem->regReturn); - sqlite3VdbeJumpHere(v, addrTop-1); - sqlite3ClearTempRegCache(pParse); + tdsqlite3VdbeEndCoroutine(v, pItem->regReturn); + tdsqlite3VdbeJumpHere(v, addrTop-1); + tdsqlite3ClearTempRegCache(pParse); }else{ /* Generate a subroutine that will fill an ephemeral table with ** the content of this subquery. pItem->addrFillSub will point @@ -138389,36 +138389,36 @@ SQLITE_PRIVATE int sqlite3Select( testcase( pItem->addrFillSub==0 ); /* Ticket c52b09c7f38903b1311 */ pItem->regReturn = ++pParse->nMem; - topAddr = sqlite3VdbeAddOp2(v, OP_Integer, 0, pItem->regReturn); + topAddr = tdsqlite3VdbeAddOp2(v, OP_Integer, 0, pItem->regReturn); pItem->addrFillSub = topAddr+1; if( pItem->fg.isCorrelated==0 ){ /* If the subquery is not correlated and if we are not inside of ** a trigger, then we only need to compute the value of the subquery ** once. */ - onceAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); + onceAddr = tdsqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); VdbeComment((v, "materialize \"%s\"", pItem->pTab->zName)); }else{ VdbeNoopComment((v, "materialize \"%s\"", pItem->pTab->zName)); } pPrior = isSelfJoinView(pTabList, pItem); if( pPrior ){ - sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pPrior->iCursor); + tdsqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pPrior->iCursor); assert( pPrior->pSelect!=0 ); pSub->nSelectRow = pPrior->pSelect->nSelectRow; }else{ - sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor); + tdsqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor); ExplainQueryPlan((pParse, 1, "MATERIALIZE %u", pSub->selId)); - sqlite3Select(pParse, pSub, &dest); + tdsqlite3Select(pParse, pSub, &dest); } pItem->pTab->nRowLogEst = pSub->nSelectRow; - if( onceAddr ) sqlite3VdbeJumpHere(v, onceAddr); - retAddr = sqlite3VdbeAddOp1(v, OP_Return, pItem->regReturn); + if( onceAddr ) tdsqlite3VdbeJumpHere(v, onceAddr); + retAddr = tdsqlite3VdbeAddOp1(v, OP_Return, pItem->regReturn); VdbeComment((v, "end %s", pItem->pTab->zName)); - sqlite3VdbeChangeP1(v, topAddr, retAddr); - sqlite3ClearTempRegCache(pParse); + tdsqlite3VdbeChangeP1(v, topAddr, retAddr); + tdsqlite3ClearTempRegCache(pParse); } if( db->mallocFailed ) goto select_end; - pParse->nHeight -= sqlite3SelectExprHeight(p); + pParse->nHeight -= tdsqlite3SelectExprHeight(p); pParse->zAuthContext = zSavedAuthContext; #endif } @@ -138432,9 +138432,9 @@ SQLITE_PRIVATE int sqlite3Select( sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0; #if SELECTTRACE_ENABLED - if( sqlite3SelectTrace & 0x400 ){ + if( tdsqlite3SelectTrace & 0x400 ){ SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n")); - sqlite3TreeViewSelect(0, p, 0); + tdsqlite3TreeViewSelect(0, p, 0); } #endif @@ -138454,13 +138454,13 @@ SQLITE_PRIVATE int sqlite3Select( ** BY and DISTINCT, and an index or separate temp-table for the other. */ if( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct - && sqlite3ExprListCompare(sSort.pOrderBy, pEList, -1)==0 + && tdsqlite3ExprListCompare(sSort.pOrderBy, pEList, -1)==0 #ifndef SQLITE_OMIT_WINDOWFUNC && p->pWin==0 #endif ){ p->selFlags &= ~SF_Distinct; - pGroupBy = p->pGroupBy = sqlite3ExprListDup(db, pEList, 0); + pGroupBy = p->pGroupBy = tdsqlite3ExprListDup(db, pEList, 0); p->selFlags |= SF_Aggregate; /* Notice that even thought SF_Distinct has been cleared from p->selFlags, ** the sDistinct.isTnct is still set. Hence, isTnct represents the @@ -138468,9 +138468,9 @@ SQLITE_PRIVATE int sqlite3Select( assert( sDistinct.isTnct ); #if SELECTTRACE_ENABLED - if( sqlite3SelectTrace & 0x400 ){ + if( tdsqlite3SelectTrace & 0x400 ){ SELECTTRACE(0x400,pParse,p,("Transform DISTINCT into GROUP BY:\n")); - sqlite3TreeViewSelect(0, p, 0); + tdsqlite3TreeViewSelect(0, p, 0); } #endif } @@ -138485,11 +138485,11 @@ SQLITE_PRIVATE int sqlite3Select( */ if( sSort.pOrderBy ){ KeyInfo *pKeyInfo; - pKeyInfo = sqlite3KeyInfoFromExprList( + pKeyInfo = tdsqlite3KeyInfoFromExprList( pParse, sSort.pOrderBy, 0, pEList->nExpr); sSort.iECursor = pParse->nTab++; sSort.addrSortIndex = - sqlite3VdbeAddOp4(v, OP_OpenEphemeral, + tdsqlite3VdbeAddOp4(v, OP_OpenEphemeral, sSort.iECursor, sSort.pOrderBy->nExpr+1+pEList->nExpr, 0, (char*)pKeyInfo, P4_KEYINFO ); @@ -138500,18 +138500,18 @@ SQLITE_PRIVATE int sqlite3Select( /* If the output is destined for a temporary table, open that table. */ if( pDest->eDest==SRT_EphemTab ){ - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pDest->iSDParm, pEList->nExpr); + tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, pDest->iSDParm, pEList->nExpr); } /* Set the limiter. */ - iEnd = sqlite3VdbeMakeLabel(pParse); + iEnd = tdsqlite3VdbeMakeLabel(pParse); if( (p->selFlags & SF_FixedLimit)==0 ){ p->nSelectRow = 320; /* 4 billion rows */ } computeLimitRegisters(pParse, p, iEnd); if( p->iLimit==0 && sSort.addrSortIndex>=0 ){ - sqlite3VdbeChangeOpcode(v, sSort.addrSortIndex, OP_SorterOpen); + tdsqlite3VdbeChangeOpcode(v, sSort.addrSortIndex, OP_SorterOpen); sSort.sortFlags |= SORTFLAG_UseSorter; } @@ -138519,11 +138519,11 @@ SQLITE_PRIVATE int sqlite3Select( */ if( p->selFlags & SF_Distinct ){ sDistinct.tabTnct = pParse->nTab++; - sDistinct.addrTnct = sqlite3VdbeAddOp4(v, OP_OpenEphemeral, + sDistinct.addrTnct = tdsqlite3VdbeAddOp4(v, OP_OpenEphemeral, sDistinct.tabTnct, 0, 0, - (char*)sqlite3KeyInfoFromExprList(pParse, p->pEList,0,0), + (char*)tdsqlite3KeyInfoFromExprList(pParse, p->pEList,0,0), P4_KEYINFO); - sqlite3VdbeChangeP5(v, BTREE_UNORDERED); + tdsqlite3VdbeChangeP5(v, BTREE_UNORDERED); sDistinct.eTnctType = WHERE_DISTINCT_UNORDERED; }else{ sDistinct.eTnctType = WHERE_DISTINCT_NOOP; @@ -138536,7 +138536,7 @@ SQLITE_PRIVATE int sqlite3Select( #ifndef SQLITE_OMIT_WINDOWFUNC Window *pWin = p->pWin; /* Master window object (or NULL) */ if( pWin ){ - sqlite3WindowCodeInit(pParse, p); + tdsqlite3WindowCodeInit(pParse, p); } #endif assert( WHERE_USE_LIMIT==SF_FixedLimit ); @@ -138544,18 +138544,18 @@ SQLITE_PRIVATE int sqlite3Select( /* Begin the database scan. */ SELECTTRACE(1,pParse,p,("WhereBegin\n")); - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, sSort.pOrderBy, + pWInfo = tdsqlite3WhereBegin(pParse, pTabList, pWhere, sSort.pOrderBy, p->pEList, wctrlFlags, p->nSelectRow); if( pWInfo==0 ) goto select_end; - if( sqlite3WhereOutputRowCount(pWInfo) < p->nSelectRow ){ - p->nSelectRow = sqlite3WhereOutputRowCount(pWInfo); + if( tdsqlite3WhereOutputRowCount(pWInfo) < p->nSelectRow ){ + p->nSelectRow = tdsqlite3WhereOutputRowCount(pWInfo); } - if( sDistinct.isTnct && sqlite3WhereIsDistinct(pWInfo) ){ - sDistinct.eTnctType = sqlite3WhereIsDistinct(pWInfo); + if( sDistinct.isTnct && tdsqlite3WhereIsDistinct(pWInfo) ){ + sDistinct.eTnctType = tdsqlite3WhereIsDistinct(pWInfo); } if( sSort.pOrderBy ){ - sSort.nOBSat = sqlite3WhereIsOrdered(pWInfo); - sSort.labelOBLopt = sqlite3WhereOrderByLimitOptLabel(pWInfo); + sSort.nOBSat = tdsqlite3WhereIsOrdered(pWInfo); + sSort.labelOBLopt = tdsqlite3WhereOrderByLimitOptLabel(pWInfo); if( sSort.nOBSat==sSort.pOrderBy->nExpr ){ sSort.pOrderBy = 0; } @@ -138566,39 +138566,39 @@ SQLITE_PRIVATE int sqlite3Select( ** into an OP_Noop. */ if( sSort.addrSortIndex>=0 && sSort.pOrderBy==0 ){ - sqlite3VdbeChangeToNoop(v, sSort.addrSortIndex); + tdsqlite3VdbeChangeToNoop(v, sSort.addrSortIndex); } assert( p->pEList==pEList ); #ifndef SQLITE_OMIT_WINDOWFUNC if( pWin ){ - int addrGosub = sqlite3VdbeMakeLabel(pParse); - int iCont = sqlite3VdbeMakeLabel(pParse); - int iBreak = sqlite3VdbeMakeLabel(pParse); + int addrGosub = tdsqlite3VdbeMakeLabel(pParse); + int iCont = tdsqlite3VdbeMakeLabel(pParse); + int iBreak = tdsqlite3VdbeMakeLabel(pParse); int regGosub = ++pParse->nMem; - sqlite3WindowCodeStep(pParse, p, pWInfo, regGosub, addrGosub); + tdsqlite3WindowCodeStep(pParse, p, pWInfo, regGosub, addrGosub); - sqlite3VdbeAddOp2(v, OP_Goto, 0, iBreak); - sqlite3VdbeResolveLabel(v, addrGosub); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, iBreak); + tdsqlite3VdbeResolveLabel(v, addrGosub); VdbeNoopComment((v, "inner-loop subroutine")); sSort.labelOBLopt = 0; selectInnerLoop(pParse, p, -1, &sSort, &sDistinct, pDest, iCont, iBreak); - sqlite3VdbeResolveLabel(v, iCont); - sqlite3VdbeAddOp1(v, OP_Return, regGosub); + tdsqlite3VdbeResolveLabel(v, iCont); + tdsqlite3VdbeAddOp1(v, OP_Return, regGosub); VdbeComment((v, "end inner-loop subroutine")); - sqlite3VdbeResolveLabel(v, iBreak); + tdsqlite3VdbeResolveLabel(v, iBreak); }else #endif /* SQLITE_OMIT_WINDOWFUNC */ { /* Use the standard inner loop. */ selectInnerLoop(pParse, p, -1, &sSort, &sDistinct, pDest, - sqlite3WhereContinueLabel(pWInfo), - sqlite3WhereBreakLabel(pWInfo)); + tdsqlite3WhereContinueLabel(pWInfo), + tdsqlite3WhereBreakLabel(pWInfo)); /* End the database scan loop. */ - sqlite3WhereEnd(pWInfo); + tdsqlite3WhereEnd(pWInfo); } }else{ /* This case when there exist aggregate functions or a GROUP BY clause @@ -138629,7 +138629,7 @@ SQLITE_PRIVATE int sqlite3Select( for(k=pGroupBy->nExpr, pItem=pGroupBy->a; k>0; k--, pItem++){ pItem->u.x.iAlias = 0; } - assert( 66==sqlite3LogEst(100) ); + assert( 66==tdsqlite3LogEst(100) ); if( p->nSelectRow>66 ) p->nSelectRow = 66; /* If there is both a GROUP BY and an ORDER BY clause and they are @@ -138651,17 +138651,17 @@ SQLITE_PRIVATE int sqlite3Select( u8 sortFlags = sSort.pOrderBy->a[ii].sortFlags & KEYINFO_ORDER_DESC; pGroupBy->a[ii].sortFlags = sortFlags; } - if( sqlite3ExprListCompare(pGroupBy, sSort.pOrderBy, -1)==0 ){ + if( tdsqlite3ExprListCompare(pGroupBy, sSort.pOrderBy, -1)==0 ){ orderByGrp = 1; } } }else{ - assert( 0==sqlite3LogEst(1) ); + assert( 0==tdsqlite3LogEst(1) ); p->nSelectRow = 0; } /* Create a label to jump to when we want to abort the query */ - addrEnd = sqlite3VdbeMakeLabel(pParse); + addrEnd = tdsqlite3VdbeMakeLabel(pParse); /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the @@ -138675,8 +138675,8 @@ SQLITE_PRIVATE int sqlite3Select( sAggInfo.mnReg = pParse->nMem+1; sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr : 0; sAggInfo.pGroupBy = pGroupBy; - sqlite3ExprAnalyzeAggList(&sNC, pEList); - sqlite3ExprAnalyzeAggList(&sNC, sSort.pOrderBy); + tdsqlite3ExprAnalyzeAggList(&sNC, pEList); + tdsqlite3ExprAnalyzeAggList(&sNC, sSort.pOrderBy); if( pHaving ){ if( pGroupBy ){ assert( pWhere==p->pWhere ); @@ -138685,7 +138685,7 @@ SQLITE_PRIVATE int sqlite3Select( havingToWhere(pParse, p); pWhere = p->pWhere; } - sqlite3ExprAnalyzeAggregates(&sNC, pHaving); + tdsqlite3ExprAnalyzeAggregates(&sNC, pHaving); } sAggInfo.nAccumulator = sAggInfo.nColumn; if( p->pGroupBy==0 && p->pHaving==0 && sAggInfo.nFunc==1 ){ @@ -138697,11 +138697,11 @@ SQLITE_PRIVATE int sqlite3Select( Expr *pExpr = sAggInfo.aFunc[i].pExpr; assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); sNC.ncFlags |= NC_InAggFunc; - sqlite3ExprAnalyzeAggList(&sNC, pExpr->x.pList); + tdsqlite3ExprAnalyzeAggList(&sNC, pExpr->x.pList); #ifndef SQLITE_OMIT_WINDOWFUNC assert( !IsWindowFunc(pExpr) ); if( ExprHasProperty(pExpr, EP_WinFunc) ){ - sqlite3ExprAnalyzeAggregates(&sNC, pExpr->y.pWin->pFilter); + tdsqlite3ExprAnalyzeAggregates(&sNC, pExpr->y.pWin->pFilter); } #endif sNC.ncFlags &= ~NC_InAggFunc; @@ -138709,19 +138709,19 @@ SQLITE_PRIVATE int sqlite3Select( sAggInfo.mxReg = pParse->nMem; if( db->mallocFailed ) goto select_end; #if SELECTTRACE_ENABLED - if( sqlite3SelectTrace & 0x400 ){ + if( tdsqlite3SelectTrace & 0x400 ){ int ii; SELECTTRACE(0x400,pParse,p,("After aggregate analysis:\n")); - sqlite3TreeViewSelect(0, p, 0); + tdsqlite3TreeViewSelect(0, p, 0); for(ii=0; iinTab++; - pKeyInfo = sqlite3KeyInfoFromExprList(pParse,pGroupBy,0,sAggInfo.nColumn); - addrSortingIdx = sqlite3VdbeAddOp4(v, OP_SorterOpen, + pKeyInfo = tdsqlite3KeyInfoFromExprList(pParse,pGroupBy,0,sAggInfo.nColumn); + addrSortingIdx = tdsqlite3VdbeAddOp4(v, OP_SorterOpen, sAggInfo.sortingIdx, sAggInfo.nSortingColumn, 0, (char*)pKeyInfo, P4_KEYINFO); @@ -138757,29 +138757,29 @@ SQLITE_PRIVATE int sqlite3Select( iUseFlag = ++pParse->nMem; iAbortFlag = ++pParse->nMem; regOutputRow = ++pParse->nMem; - addrOutputRow = sqlite3VdbeMakeLabel(pParse); + addrOutputRow = tdsqlite3VdbeMakeLabel(pParse); regReset = ++pParse->nMem; - addrReset = sqlite3VdbeMakeLabel(pParse); + addrReset = tdsqlite3VdbeMakeLabel(pParse); iAMem = pParse->nMem + 1; pParse->nMem += pGroupBy->nExpr; iBMem = pParse->nMem + 1; pParse->nMem += pGroupBy->nExpr; - sqlite3VdbeAddOp2(v, OP_Integer, 0, iAbortFlag); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, iAbortFlag); VdbeComment((v, "clear abort flag")); - sqlite3VdbeAddOp3(v, OP_Null, 0, iAMem, iAMem+pGroupBy->nExpr-1); + tdsqlite3VdbeAddOp3(v, OP_Null, 0, iAMem, iAMem+pGroupBy->nExpr-1); /* Begin a loop that will extract all source rows in GROUP BY order. ** This might involve two separate loops with an OP_Sort in between, or ** it might be a single loop that uses an index to extract information ** in the right order to begin with. */ - sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset); + tdsqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset); SELECTTRACE(1,pParse,p,("WhereBegin\n")); - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, 0, + pWInfo = tdsqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, 0, WHERE_GROUPBY | (orderByGrp ? WHERE_SORTBYGROUP : 0), 0 ); if( pWInfo==0 ) goto select_end; - if( sqlite3WhereIsOrdered(pWInfo)==pGroupBy->nExpr ){ + if( tdsqlite3WhereIsOrdered(pWInfo)==pGroupBy->nExpr ){ /* The optimizer is able to deliver rows in group by order so ** we do not have to sort. The OP_OpenEphemeral table will be ** cancelled later because we still need to use the pKeyInfo @@ -138810,28 +138810,28 @@ SQLITE_PRIVATE int sqlite3Select( j++; } } - regBase = sqlite3GetTempRange(pParse, nCol); - sqlite3ExprCodeExprList(pParse, pGroupBy, regBase, 0, 0); + regBase = tdsqlite3GetTempRange(pParse, nCol); + tdsqlite3ExprCodeExprList(pParse, pGroupBy, regBase, 0, 0); j = nGroupBy; for(i=0; iiSorterColumn>=j ){ int r1 = j + regBase; - sqlite3ExprCodeGetColumnOfTable(v, + tdsqlite3ExprCodeGetColumnOfTable(v, pCol->pTab, pCol->iTable, pCol->iColumn, r1); j++; } } - regRecord = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord); - sqlite3VdbeAddOp2(v, OP_SorterInsert, sAggInfo.sortingIdx, regRecord); - sqlite3ReleaseTempReg(pParse, regRecord); - sqlite3ReleaseTempRange(pParse, regBase, nCol); - sqlite3WhereEnd(pWInfo); + regRecord = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord); + tdsqlite3VdbeAddOp2(v, OP_SorterInsert, sAggInfo.sortingIdx, regRecord); + tdsqlite3ReleaseTempReg(pParse, regRecord); + tdsqlite3ReleaseTempRange(pParse, regBase, nCol); + tdsqlite3WhereEnd(pWInfo); sAggInfo.sortingIdxPTab = sortPTab = pParse->nTab++; - sortOut = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol); - sqlite3VdbeAddOp2(v, OP_SorterSort, sAggInfo.sortingIdx, addrEnd); + sortOut = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol); + tdsqlite3VdbeAddOp2(v, OP_SorterSort, sAggInfo.sortingIdx, addrEnd); VdbeComment((v, "GROUP BY sort")); VdbeCoverage(v); sAggInfo.useSortingIdx = 1; } @@ -138844,10 +138844,10 @@ SQLITE_PRIVATE int sqlite3Select( ** Use the SQLITE_GroupByOrder flag with SQLITE_TESTCTRL_OPTIMIZER to ** disable this optimization for testing purposes. */ if( orderByGrp && OptimizationEnabled(db, SQLITE_GroupByOrder) - && (groupBySort || sqlite3WhereIsSorted(pWInfo)) + && (groupBySort || tdsqlite3WhereIsSorted(pWInfo)) ){ sSort.pOrderBy = 0; - sqlite3VdbeChangeToNoop(v, sSort.addrSortIndex); + tdsqlite3VdbeChangeToNoop(v, sSort.addrSortIndex); } /* Evaluate the current GROUP BY terms and store in b0, b1, b2... @@ -138855,23 +138855,23 @@ SQLITE_PRIVATE int sqlite3Select( ** Then compare the current GROUP BY terms against the GROUP BY terms ** from the previous row currently stored in a0, a1, a2... */ - addrTopOfLoop = sqlite3VdbeCurrentAddr(v); + addrTopOfLoop = tdsqlite3VdbeCurrentAddr(v); if( groupBySort ){ - sqlite3VdbeAddOp3(v, OP_SorterData, sAggInfo.sortingIdx, + tdsqlite3VdbeAddOp3(v, OP_SorterData, sAggInfo.sortingIdx, sortOut, sortPTab); } for(j=0; jnExpr; j++){ if( groupBySort ){ - sqlite3VdbeAddOp3(v, OP_Column, sortPTab, j, iBMem+j); + tdsqlite3VdbeAddOp3(v, OP_Column, sortPTab, j, iBMem+j); }else{ sAggInfo.directMode = 1; - sqlite3ExprCode(pParse, pGroupBy->a[j].pExpr, iBMem+j); + tdsqlite3ExprCode(pParse, pGroupBy->a[j].pExpr, iBMem+j); } } - sqlite3VdbeAddOp4(v, OP_Compare, iAMem, iBMem, pGroupBy->nExpr, - (char*)sqlite3KeyInfoRef(pKeyInfo), P4_KEYINFO); - addr1 = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp3(v, OP_Jump, addr1+1, 0, addr1+1); VdbeCoverage(v); + tdsqlite3VdbeAddOp4(v, OP_Compare, iAMem, iBMem, pGroupBy->nExpr, + (char*)tdsqlite3KeyInfoRef(pKeyInfo), P4_KEYINFO); + addr1 = tdsqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeAddOp3(v, OP_Jump, addr1+1, 0, addr1+1); VdbeCoverage(v); /* Generate code that runs whenever the GROUP BY changes. ** Changes in the GROUP BY are detected by the previous code @@ -138882,40 +138882,40 @@ SQLITE_PRIVATE int sqlite3Select( ** and resets the aggregate accumulator registers in preparation ** for the next GROUP BY batch. */ - sqlite3ExprCodeMove(pParse, iBMem, iAMem, pGroupBy->nExpr); - sqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow); + tdsqlite3ExprCodeMove(pParse, iBMem, iAMem, pGroupBy->nExpr); + tdsqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow); VdbeComment((v, "output one row")); - sqlite3VdbeAddOp2(v, OP_IfPos, iAbortFlag, addrEnd); VdbeCoverage(v); + tdsqlite3VdbeAddOp2(v, OP_IfPos, iAbortFlag, addrEnd); VdbeCoverage(v); VdbeComment((v, "check abort flag")); - sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset); + tdsqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset); VdbeComment((v, "reset accumulator")); /* Update the aggregate accumulators based on the content of ** the current row */ - sqlite3VdbeJumpHere(v, addr1); + tdsqlite3VdbeJumpHere(v, addr1); updateAccumulator(pParse, iUseFlag, &sAggInfo); - sqlite3VdbeAddOp2(v, OP_Integer, 1, iUseFlag); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, iUseFlag); VdbeComment((v, "indicate data in accumulator")); /* End of the loop */ if( groupBySort ){ - sqlite3VdbeAddOp2(v, OP_SorterNext, sAggInfo.sortingIdx, addrTopOfLoop); + tdsqlite3VdbeAddOp2(v, OP_SorterNext, sAggInfo.sortingIdx, addrTopOfLoop); VdbeCoverage(v); }else{ - sqlite3WhereEnd(pWInfo); - sqlite3VdbeChangeToNoop(v, addrSortingIdx); + tdsqlite3WhereEnd(pWInfo); + tdsqlite3VdbeChangeToNoop(v, addrSortingIdx); } /* Output the final row of result */ - sqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow); + tdsqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow); VdbeComment((v, "output final row")); /* Jump over the subroutines */ - sqlite3VdbeGoto(v, addrEnd); + tdsqlite3VdbeGoto(v, addrEnd); /* Generate a subroutine that outputs a single row of the result ** set. This subroutine first looks at the iUseFlag. If iUseFlag @@ -138924,31 +138924,31 @@ SQLITE_PRIVATE int sqlite3Select( ** increments the iAbortFlag memory location before returning in ** order to signal the caller to abort. */ - addrSetAbort = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp2(v, OP_Integer, 1, iAbortFlag); + addrSetAbort = tdsqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, iAbortFlag); VdbeComment((v, "set abort flag")); - sqlite3VdbeAddOp1(v, OP_Return, regOutputRow); - sqlite3VdbeResolveLabel(v, addrOutputRow); - addrOutputRow = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp2(v, OP_IfPos, iUseFlag, addrOutputRow+2); + tdsqlite3VdbeAddOp1(v, OP_Return, regOutputRow); + tdsqlite3VdbeResolveLabel(v, addrOutputRow); + addrOutputRow = tdsqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeAddOp2(v, OP_IfPos, iUseFlag, addrOutputRow+2); VdbeCoverage(v); VdbeComment((v, "Groupby result generator entry point")); - sqlite3VdbeAddOp1(v, OP_Return, regOutputRow); + tdsqlite3VdbeAddOp1(v, OP_Return, regOutputRow); finalizeAggFunctions(pParse, &sAggInfo); - sqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, SQLITE_JUMPIFNULL); + tdsqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, SQLITE_JUMPIFNULL); selectInnerLoop(pParse, p, -1, &sSort, &sDistinct, pDest, addrOutputRow+1, addrSetAbort); - sqlite3VdbeAddOp1(v, OP_Return, regOutputRow); + tdsqlite3VdbeAddOp1(v, OP_Return, regOutputRow); VdbeComment((v, "end groupby result generator")); /* Generate a subroutine that will reset the group-by accumulator */ - sqlite3VdbeResolveLabel(v, addrReset); + tdsqlite3VdbeResolveLabel(v, addrReset); resetAccumulator(pParse, &sAggInfo); - sqlite3VdbeAddOp2(v, OP_Integer, 0, iUseFlag); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, iUseFlag); VdbeComment((v, "indicate accumulator empty")); - sqlite3VdbeAddOp1(v, OP_Return, regReset); + tdsqlite3VdbeAddOp1(v, OP_Return, regReset); } /* endif pGroupBy. Begin aggregate queries without GROUP BY: */ else { @@ -138968,15 +138968,15 @@ SQLITE_PRIVATE int sqlite3Select( ** is better to execute the op on an index, as indexes are almost ** always spread across less pages than their corresponding tables. */ - const int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); + const int iDb = tdsqlite3SchemaToIndex(pParse->db, pTab->pSchema); const int iCsr = pParse->nTab++; /* Cursor to scan b-tree */ Index *pIdx; /* Iterator variable */ KeyInfo *pKeyInfo = 0; /* Keyinfo for scanned index */ Index *pBest = 0; /* Best index found so far */ int iRoot = pTab->tnum; /* Root page of scanned b-tree */ - sqlite3CodeVerifySchema(pParse, iDb); - sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); + tdsqlite3CodeVerifySchema(pParse, iDb); + tdsqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); /* Search for the index that has the lowest scan cost. ** @@ -138987,7 +138987,7 @@ SQLITE_PRIVATE int sqlite3Select( ** In practice the KeyInfo structure will not be used. It is only ** passed to keep OP_OpenRead happy. */ - if( !HasRowid(pTab) ) pBest = sqlite3PrimaryKeyIndex(pTab); + if( !HasRowid(pTab) ) pBest = tdsqlite3PrimaryKeyIndex(pTab); for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ if( pIdx->bUnordered==0 && pIdx->szIdxRowszTabRow @@ -138999,16 +138999,16 @@ SQLITE_PRIVATE int sqlite3Select( } if( pBest ){ iRoot = pBest->tnum; - pKeyInfo = sqlite3KeyInfoOfIndex(pParse, pBest); + pKeyInfo = tdsqlite3KeyInfoOfIndex(pParse, pBest); } /* Open a read-only cursor, execute the OP_Count, close the cursor. */ - sqlite3VdbeAddOp4Int(v, OP_OpenRead, iCsr, iRoot, iDb, 1); + tdsqlite3VdbeAddOp4Int(v, OP_OpenRead, iCsr, iRoot, iDb, 1); if( pKeyInfo ){ - sqlite3VdbeChangeP4(v, -1, (char *)pKeyInfo, P4_KEYINFO); + tdsqlite3VdbeChangeP4(v, -1, (char *)pKeyInfo, P4_KEYINFO); } - sqlite3VdbeAddOp2(v, OP_Count, iCsr, sAggInfo.aFunc[0].iMem); - sqlite3VdbeAddOp1(v, OP_Close, iCsr); + tdsqlite3VdbeAddOp2(v, OP_Count, iCsr, sAggInfo.aFunc[0].iMem); + tdsqlite3VdbeAddOp1(v, OP_Close, iCsr); explainSimpleCount(pParse, pTab, pBest); }else #endif /* SQLITE_OMIT_BTREECOUNT */ @@ -139031,7 +139031,7 @@ SQLITE_PRIVATE int sqlite3Select( } if( i==sAggInfo.nFunc ){ regAcc = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Integer, 0, regAcc); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, regAcc); } } @@ -139051,28 +139051,28 @@ SQLITE_PRIVATE int sqlite3Select( assert( pMinMaxOrderBy==0 || pMinMaxOrderBy->nExpr==1 ); SELECTTRACE(1,pParse,p,("WhereBegin\n")); - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMaxOrderBy, + pWInfo = tdsqlite3WhereBegin(pParse, pTabList, pWhere, pMinMaxOrderBy, 0, minMaxFlag, 0); if( pWInfo==0 ){ goto select_end; } updateAccumulator(pParse, regAcc, &sAggInfo); - if( regAcc ) sqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc); - if( sqlite3WhereIsOrdered(pWInfo)>0 ){ - sqlite3VdbeGoto(v, sqlite3WhereBreakLabel(pWInfo)); + if( regAcc ) tdsqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc); + if( tdsqlite3WhereIsOrdered(pWInfo)>0 ){ + tdsqlite3VdbeGoto(v, tdsqlite3WhereBreakLabel(pWInfo)); VdbeComment((v, "%s() by index", (minMaxFlag==WHERE_ORDERBY_MIN?"min":"max"))); } - sqlite3WhereEnd(pWInfo); + tdsqlite3WhereEnd(pWInfo); finalizeAggFunctions(pParse, &sAggInfo); } sSort.pOrderBy = 0; - sqlite3ExprIfFalse(pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL); + tdsqlite3ExprIfFalse(pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL); selectInnerLoop(pParse, p, -1, 0, 0, pDest, addrEnd, addrEnd); } - sqlite3VdbeResolveLabel(v, addrEnd); + tdsqlite3VdbeResolveLabel(v, addrEnd); } /* endif aggregate query */ @@ -139092,7 +139092,7 @@ SQLITE_PRIVATE int sqlite3Select( /* Jump here to skip this query */ - sqlite3VdbeResolveLabel(v, iEnd); + tdsqlite3VdbeResolveLabel(v, iEnd); /* The SELECT has been coded. If there is an error in the Parse structure, ** set the return code to 1. Otherwise 0. */ @@ -139102,13 +139102,13 @@ SQLITE_PRIVATE int sqlite3Select( ** successful coding of the SELECT. */ select_end: - sqlite3ExprListDelete(db, pMinMaxOrderBy); - sqlite3DbFree(db, sAggInfo.aCol); - sqlite3DbFree(db, sAggInfo.aFunc); + tdsqlite3ExprListDelete(db, pMinMaxOrderBy); + tdsqlite3DbFree(db, sAggInfo.aCol); + tdsqlite3DbFree(db, sAggInfo.aFunc); #if SELECTTRACE_ENABLED SELECTTRACE(0x1,pParse,p,("end processing\n")); - if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){ - sqlite3TreeViewSelect(0, p, 0); + if( (tdsqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){ + tdsqlite3TreeViewSelect(0, p, 0); } #endif ExplainQueryPlanPop(pParse); @@ -139128,9 +139128,9 @@ select_end: ** May you share freely, never taking more than you give. ** ************************************************************************* -** This file contains the sqlite3_get_table() and sqlite3_free_table() +** This file contains the tdsqlite3_get_table() and tdsqlite3_free_table() ** interface routines. These are just wrappers around the main -** interface routine of sqlite3_exec(). +** interface routine of tdsqlite3_exec(). ** ** These routines are in a separate files so that they will not be linked ** if they are not used. @@ -139140,7 +139140,7 @@ select_end: #ifndef SQLITE_OMIT_GET_TABLE /* -** This structure is used to pass data from sqlite3_get_table() through +** This structure is used to pass data from tdsqlite3_get_table() through ** to the callback function is uses to build the result. */ typedef struct TabResult { @@ -139150,7 +139150,7 @@ typedef struct TabResult { u32 nRow; /* Number of rows in the result */ u32 nColumn; /* Number of columns in the result */ u32 nData; /* Slots used in azResult[]. (nRow+1)*nColumn */ - int rc; /* Return code from sqlite3_exec() */ + int rc; /* Return code from tdsqlite3_exec() */ } TabResult; /* @@ -139158,7 +139158,7 @@ typedef struct TabResult { ** is to fill in the TabResult structure appropriately, allocating new ** memory as necessary. */ -static int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){ +static int tdsqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){ TabResult *p = (TabResult*)pArg; /* Result accumulator */ int need; /* Slots needed in p->azResult[] */ int i; /* Loop counter */ @@ -139175,7 +139175,7 @@ static int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){ if( p->nData + need > p->nAlloc ){ char **azNew; p->nAlloc = p->nAlloc*2 + need; - azNew = sqlite3_realloc64( p->azResult, sizeof(char*)*p->nAlloc ); + azNew = tdsqlite3_realloc64( p->azResult, sizeof(char*)*p->nAlloc ); if( azNew==0 ) goto malloc_failed; p->azResult = azNew; } @@ -139186,14 +139186,14 @@ static int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){ if( p->nRow==0 ){ p->nColumn = nCol; for(i=0; iazResult[p->nData++] = z; } }else if( (int)p->nColumn!=nCol ){ - sqlite3_free(p->zErrMsg); - p->zErrMsg = sqlite3_mprintf( - "sqlite3_get_table() called with two or more incompatible queries" + tdsqlite3_free(p->zErrMsg); + p->zErrMsg = tdsqlite3_mprintf( + "tdsqlite3_get_table() called with two or more incompatible queries" ); p->rc = SQLITE_ERROR; return 1; @@ -139206,8 +139206,8 @@ static int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){ if( argv[i]==0 ){ z = 0; }else{ - int n = sqlite3Strlen30(argv[i])+1; - z = sqlite3_malloc64( n ); + int n = tdsqlite3Strlen30(argv[i])+1; + z = tdsqlite3_malloc64( n ); if( z==0 ) goto malloc_failed; memcpy(z, argv[i], n); } @@ -139229,11 +139229,11 @@ malloc_failed: ** ** The result that is written to ***pazResult is held in memory obtained ** from malloc(). But the caller cannot free this memory directly. -** Instead, the entire table should be passed to sqlite3_free_table() when +** Instead, the entire table should be passed to tdsqlite3_free_table() when ** the calling procedure is finished using it. */ -SQLITE_API int sqlite3_get_table( - sqlite3 *db, /* The database on which the SQL executes */ +SQLITE_API int tdsqlite3_get_table( + tdsqlite3 *db, /* The database on which the SQL executes */ const char *zSql, /* The SQL to be executed */ char ***pazResult, /* Write the result table here */ int *pnRow, /* Write the number of rows in the result here */ @@ -139244,7 +139244,7 @@ SQLITE_API int sqlite3_get_table( TabResult res; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || pazResult==0 ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) || pazResult==0 ) return SQLITE_MISUSE_BKPT; #endif *pazResult = 0; if( pnColumn ) *pnColumn = 0; @@ -139256,37 +139256,37 @@ SQLITE_API int sqlite3_get_table( res.nData = 1; res.nAlloc = 20; res.rc = SQLITE_OK; - res.azResult = sqlite3_malloc64(sizeof(char*)*res.nAlloc ); + res.azResult = tdsqlite3_malloc64(sizeof(char*)*res.nAlloc ); if( res.azResult==0 ){ db->errCode = SQLITE_NOMEM; return SQLITE_NOMEM_BKPT; } res.azResult[0] = 0; - rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg); + rc = tdsqlite3_exec(db, zSql, tdsqlite3_get_table_cb, &res, pzErrMsg); assert( sizeof(res.azResult[0])>= sizeof(res.nData) ); res.azResult[0] = SQLITE_INT_TO_PTR(res.nData); if( (rc&0xff)==SQLITE_ABORT ){ - sqlite3_free_table(&res.azResult[1]); + tdsqlite3_free_table(&res.azResult[1]); if( res.zErrMsg ){ if( pzErrMsg ){ - sqlite3_free(*pzErrMsg); - *pzErrMsg = sqlite3_mprintf("%s",res.zErrMsg); + tdsqlite3_free(*pzErrMsg); + *pzErrMsg = tdsqlite3_mprintf("%s",res.zErrMsg); } - sqlite3_free(res.zErrMsg); + tdsqlite3_free(res.zErrMsg); } db->errCode = res.rc; /* Assume 32-bit assignment is atomic */ return res.rc; } - sqlite3_free(res.zErrMsg); + tdsqlite3_free(res.zErrMsg); if( rc!=SQLITE_OK ){ - sqlite3_free_table(&res.azResult[1]); + tdsqlite3_free_table(&res.azResult[1]); return rc; } if( res.nAlloc>res.nData ){ char **azNew; - azNew = sqlite3_realloc64( res.azResult, sizeof(char*)*res.nData ); + azNew = tdsqlite3_realloc64( res.azResult, sizeof(char*)*res.nData ); if( azNew==0 ){ - sqlite3_free_table(&res.azResult[1]); + tdsqlite3_free_table(&res.azResult[1]); db->errCode = SQLITE_NOMEM; return SQLITE_NOMEM_BKPT; } @@ -139299,18 +139299,18 @@ SQLITE_API int sqlite3_get_table( } /* -** This routine frees the space the sqlite3_get_table() malloced. +** This routine frees the space the tdsqlite3_get_table() malloced. */ -SQLITE_API void sqlite3_free_table( - char **azResult /* Result returned from sqlite3_get_table() */ +SQLITE_API void tdsqlite3_free_table( + char **azResult /* Result returned from tdsqlite3_get_table() */ ){ if( azResult ){ int i, n; azResult--; assert( azResult!=0 ); n = SQLITE_PTR_TO_INT(azResult[0]); - for(i=1; ipNext; - sqlite3ExprDelete(db, pTmp->pWhere); - sqlite3ExprListDelete(db, pTmp->pExprList); - sqlite3SelectDelete(db, pTmp->pSelect); - sqlite3IdListDelete(db, pTmp->pIdList); - sqlite3UpsertDelete(db, pTmp->pUpsert); - sqlite3DbFree(db, pTmp->zSpan); + tdsqlite3ExprDelete(db, pTmp->pWhere); + tdsqlite3ExprListDelete(db, pTmp->pExprList); + tdsqlite3SelectDelete(db, pTmp->pSelect); + tdsqlite3IdListDelete(db, pTmp->pIdList); + tdsqlite3UpsertDelete(db, pTmp->pUpsert); + tdsqlite3DbFree(db, pTmp->zSpan); - sqlite3DbFree(db, pTmp); + tdsqlite3DbFree(db, pTmp); } } @@ -139366,7 +139366,7 @@ SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3 *db, TriggerStep *pTriggerS ** that fire off of pTab. The list will include any TEMP triggers on ** pTab as well as the triggers lised in pTab->pTrigger. */ -SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){ +SQLITE_PRIVATE Trigger *tdsqlite3TriggerList(Parse *pParse, Table *pTab){ Schema * const pTmpSchema = pParse->db->aDb[1].pSchema; Trigger *pList = 0; /* List of triggers to return */ @@ -139376,11 +139376,11 @@ SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){ if( pTmpSchema!=pTab->pSchema ){ HashElem *p; - assert( sqlite3SchemaMutexHeld(pParse->db, 0, pTmpSchema) ); + assert( tdsqlite3SchemaMutexHeld(pParse->db, 0, pTmpSchema) ); for(p=sqliteHashFirst(&pTmpSchema->trigHash); p; p=sqliteHashNext(p)){ Trigger *pTrig = (Trigger *)sqliteHashData(p); if( pTrig->pTabSchema==pTab->pSchema - && 0==sqlite3StrICmp(pTrig->table, pTab->zName) + && 0==tdsqlite3StrICmp(pTrig->table, pTab->zName) ){ pTrig->pNext = (pList ? pList : pTab->pTrigger); pList = pTrig; @@ -139396,10 +139396,10 @@ SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){ ** up to the point of the BEGIN before the trigger actions. A Trigger ** structure is generated based on the information available and stored ** in pParse->pNewTrigger. After the trigger actions have been parsed, the -** sqlite3FinishTrigger() function is called to complete the trigger +** tdsqlite3FinishTrigger() function is called to complete the trigger ** construction process. */ -SQLITE_PRIVATE void sqlite3BeginTrigger( +SQLITE_PRIVATE void tdsqlite3BeginTrigger( Parse *pParse, /* The parse context of the CREATE TRIGGER statement */ Token *pName1, /* The name of the trigger */ Token *pName2, /* The name of the trigger */ @@ -139414,7 +139414,7 @@ SQLITE_PRIVATE void sqlite3BeginTrigger( Trigger *pTrigger = 0; /* The new trigger */ Table *pTab; /* Table that the trigger fires off of */ char *zName = 0; /* Name of the trigger */ - sqlite3 *db = pParse->db; /* The database connection */ + tdsqlite3 *db = pParse->db; /* The database connection */ int iDb; /* The database to store the trigger in */ Token *pName; /* The unqualified db name */ DbFixer sFix; /* State vector for the DB fixer */ @@ -139426,14 +139426,14 @@ SQLITE_PRIVATE void sqlite3BeginTrigger( if( isTemp ){ /* If TEMP was specified, then the trigger name may not be qualified. */ if( pName2->n>0 ){ - sqlite3ErrorMsg(pParse, "temporary trigger may not have qualified name"); + tdsqlite3ErrorMsg(pParse, "temporary trigger may not have qualified name"); goto trigger_cleanup; } iDb = 1; pName = pName1; }else{ /* Figure out the db that the trigger will be created in */ - iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName); + iDb = tdsqlite3TwoPartName(pParse, pName1, pName2, &pName); if( iDb<0 ){ goto trigger_cleanup; } @@ -139451,16 +139451,16 @@ SQLITE_PRIVATE void sqlite3BeginTrigger( ** name on pTableName if we are reparsing out of SQLITE_MASTER. */ if( db->init.busy && iDb!=1 ){ - sqlite3DbFree(db, pTableName->a[0].zDatabase); + tdsqlite3DbFree(db, pTableName->a[0].zDatabase); pTableName->a[0].zDatabase = 0; } /* If the trigger name was unqualified, and the table is a temp table, ** then set iDb to 1 to create the trigger in the temporary database. - ** If sqlite3SrcListLookup() returns 0, indicating the table does not + ** If tdsqlite3SrcListLookup() returns 0, indicating the table does not ** exist, the error is caught by the block below. */ - pTab = sqlite3SrcListLookup(pParse, pTableName); + pTab = tdsqlite3SrcListLookup(pParse, pTableName); if( db->init.busy==0 && pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){ iDb = 1; @@ -139469,11 +139469,11 @@ SQLITE_PRIVATE void sqlite3BeginTrigger( /* Ensure the table name matches database name and that the table exists */ if( db->mallocFailed ) goto trigger_cleanup; assert( pTableName->nSrc==1 ); - sqlite3FixInit(&sFix, pParse, iDb, "trigger", pName); - if( sqlite3FixSrcList(&sFix, pTableName) ){ + tdsqlite3FixInit(&sFix, pParse, iDb, "trigger", pName); + if( tdsqlite3FixSrcList(&sFix, pTableName) ){ goto trigger_cleanup; } - pTab = sqlite3SrcListLookup(pParse, pTableName); + pTab = tdsqlite3SrcListLookup(pParse, pTableName); if( !pTab ){ /* The table does not exist. */ if( db->init.iDb==1 ){ @@ -139490,36 +139490,36 @@ SQLITE_PRIVATE void sqlite3BeginTrigger( goto trigger_cleanup; } if( IsVirtual(pTab) ){ - sqlite3ErrorMsg(pParse, "cannot create triggers on virtual tables"); + tdsqlite3ErrorMsg(pParse, "cannot create triggers on virtual tables"); goto trigger_cleanup; } /* Check that the trigger name is not reserved and that no trigger of the ** specified name exists */ - zName = sqlite3NameFromToken(db, pName); + zName = tdsqlite3NameFromToken(db, pName); if( zName==0 ){ assert( db->mallocFailed ); goto trigger_cleanup; } - if( sqlite3CheckObjectName(pParse, zName, "trigger", pTab->zName) ){ + if( tdsqlite3CheckObjectName(pParse, zName, "trigger", pTab->zName) ){ goto trigger_cleanup; } - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); if( !IN_RENAME_OBJECT ){ - if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),zName) ){ + if( tdsqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),zName) ){ if( !noErr ){ - sqlite3ErrorMsg(pParse, "trigger %T already exists", pName); + tdsqlite3ErrorMsg(pParse, "trigger %T already exists", pName); }else{ assert( !db->init.busy ); - sqlite3CodeVerifySchema(pParse, iDb); + tdsqlite3CodeVerifySchema(pParse, iDb); } goto trigger_cleanup; } } /* Do not create a trigger on a system table */ - if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){ - sqlite3ErrorMsg(pParse, "cannot create trigger on system table"); + if( tdsqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){ + tdsqlite3ErrorMsg(pParse, "cannot create trigger on system table"); goto trigger_cleanup; } @@ -139527,27 +139527,27 @@ SQLITE_PRIVATE void sqlite3BeginTrigger( ** of triggers. */ if( pTab->pSelect && tr_tm!=TK_INSTEAD ){ - sqlite3ErrorMsg(pParse, "cannot create %s trigger on view: %S", + tdsqlite3ErrorMsg(pParse, "cannot create %s trigger on view: %S", (tr_tm == TK_BEFORE)?"BEFORE":"AFTER", pTableName, 0); goto trigger_cleanup; } if( !pTab->pSelect && tr_tm==TK_INSTEAD ){ - sqlite3ErrorMsg(pParse, "cannot create INSTEAD OF" + tdsqlite3ErrorMsg(pParse, "cannot create INSTEAD OF" " trigger on table: %S", pTableName, 0); goto trigger_cleanup; } #ifndef SQLITE_OMIT_AUTHORIZATION if( !IN_RENAME_OBJECT ){ - int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema); + int iTabDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); int code = SQLITE_CREATE_TRIGGER; const char *zDb = db->aDb[iTabDb].zDbSName; const char *zDbTrig = isTemp ? db->aDb[1].zDbSName : zDb; if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER; - if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){ + if( tdsqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){ goto trigger_cleanup; } - if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iTabDb),0,zDb)){ + if( tdsqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iTabDb),0,zDb)){ goto trigger_cleanup; } } @@ -139563,21 +139563,21 @@ SQLITE_PRIVATE void sqlite3BeginTrigger( } /* Build the Trigger object */ - pTrigger = (Trigger*)sqlite3DbMallocZero(db, sizeof(Trigger)); + pTrigger = (Trigger*)tdsqlite3DbMallocZero(db, sizeof(Trigger)); if( pTrigger==0 ) goto trigger_cleanup; pTrigger->zName = zName; zName = 0; - pTrigger->table = sqlite3DbStrDup(db, pTableName->a[0].zName); + pTrigger->table = tdsqlite3DbStrDup(db, pTableName->a[0].zName); pTrigger->pSchema = db->aDb[iDb].pSchema; pTrigger->pTabSchema = pTab->pSchema; pTrigger->op = (u8)op; pTrigger->tr_tm = tr_tm==TK_BEFORE ? TRIGGER_BEFORE : TRIGGER_AFTER; if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenRemap(pParse, pTrigger->table, pTableName->a[0].zName); + tdsqlite3RenameTokenRemap(pParse, pTrigger->table, pTableName->a[0].zName); pTrigger->pWhen = pWhen; pWhen = 0; }else{ - pTrigger->pWhen = sqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE); + pTrigger->pWhen = tdsqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE); } pTrigger->pColumns = pColumns; pColumns = 0; @@ -139585,12 +139585,12 @@ SQLITE_PRIVATE void sqlite3BeginTrigger( pParse->pNewTrigger = pTrigger; trigger_cleanup: - sqlite3DbFree(db, zName); - sqlite3SrcListDelete(db, pTableName); - sqlite3IdListDelete(db, pColumns); - sqlite3ExprDelete(db, pWhen); + tdsqlite3DbFree(db, zName); + tdsqlite3SrcListDelete(db, pTableName); + tdsqlite3IdListDelete(db, pColumns); + tdsqlite3ExprDelete(db, pWhen); if( !pParse->pNewTrigger ){ - sqlite3DeleteTrigger(db, pTrigger); + tdsqlite3DeleteTrigger(db, pTrigger); }else{ assert( pParse->pNewTrigger==pTrigger ); } @@ -139600,14 +139600,14 @@ trigger_cleanup: ** This routine is called after all of the trigger actions have been parsed ** in order to complete the process of building the trigger. */ -SQLITE_PRIVATE void sqlite3FinishTrigger( +SQLITE_PRIVATE void tdsqlite3FinishTrigger( Parse *pParse, /* Parser context */ TriggerStep *pStepList, /* The triggered program */ Token *pAll /* Token that describes the complete CREATE TRIGGER */ ){ Trigger *pTrig = pParse->pNewTrigger; /* Trigger being finished */ char *zName; /* Name of trigger */ - sqlite3 *db = pParse->db; /* The database */ + tdsqlite3 *db = pParse->db; /* The database */ DbFixer sFix; /* Fixer object */ int iDb; /* Database containing the trigger */ Token nameToken; /* Trigger name for error reporting */ @@ -139615,16 +139615,16 @@ SQLITE_PRIVATE void sqlite3FinishTrigger( pParse->pNewTrigger = 0; if( NEVER(pParse->nErr) || !pTrig ) goto triggerfinish_cleanup; zName = pTrig->zName; - iDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema); + iDb = tdsqlite3SchemaToIndex(pParse->db, pTrig->pSchema); pTrig->step_list = pStepList; while( pStepList ){ pStepList->pTrig = pTrig; pStepList = pStepList->pNext; } - sqlite3TokenInit(&nameToken, pTrig->zName); - sqlite3FixInit(&sFix, pParse, iDb, "trigger", &nameToken); - if( sqlite3FixTriggerStep(&sFix, pTrig->step_list) - || sqlite3FixExpr(&sFix, pTrig->pWhen) + tdsqlite3TokenInit(&nameToken, pTrig->zName); + tdsqlite3FixInit(&sFix, pParse, iDb, "trigger", &nameToken); + if( tdsqlite3FixTriggerStep(&sFix, pTrig->step_list) + || tdsqlite3FixExpr(&sFix, pTrig->pWhen) ){ goto triggerfinish_cleanup; } @@ -139645,32 +139645,32 @@ SQLITE_PRIVATE void sqlite3FinishTrigger( char *z; /* Make an entry in the sqlite_master table */ - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( v==0 ) goto triggerfinish_cleanup; - sqlite3BeginWriteOperation(pParse, 0, iDb); - z = sqlite3DbStrNDup(db, (char*)pAll->z, pAll->n); + tdsqlite3BeginWriteOperation(pParse, 0, iDb); + z = tdsqlite3DbStrNDup(db, (char*)pAll->z, pAll->n); testcase( z==0 ); - sqlite3NestedParse(pParse, + tdsqlite3NestedParse(pParse, "INSERT INTO %Q.%s VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')", db->aDb[iDb].zDbSName, MASTER_NAME, zName, pTrig->table, z); - sqlite3DbFree(db, z); - sqlite3ChangeCookie(pParse, iDb); - sqlite3VdbeAddParseSchemaOp(v, iDb, - sqlite3MPrintf(db, "type='trigger' AND name='%q'", zName)); + tdsqlite3DbFree(db, z); + tdsqlite3ChangeCookie(pParse, iDb); + tdsqlite3VdbeAddParseSchemaOp(v, iDb, + tdsqlite3MPrintf(db, "type='trigger' AND name='%q'", zName)); } if( db->init.busy ){ Trigger *pLink = pTrig; Hash *pHash = &db->aDb[iDb].pSchema->trigHash; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); assert( pLink!=0 ); - pTrig = sqlite3HashInsert(pHash, zName, pTrig); + pTrig = tdsqlite3HashInsert(pHash, zName, pTrig); if( pTrig ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); }else if( pLink->pSchema==pLink->pTabSchema ){ Table *pTab; - pTab = sqlite3HashFind(&pLink->pTabSchema->tblHash, pLink->table); + pTab = tdsqlite3HashFind(&pLink->pTabSchema->tblHash, pLink->table); assert( pTab!=0 ); pLink->pNext = pTab->pTrigger; pTab->pTrigger = pLink; @@ -139678,19 +139678,19 @@ SQLITE_PRIVATE void sqlite3FinishTrigger( } triggerfinish_cleanup: - sqlite3DeleteTrigger(db, pTrig); + tdsqlite3DeleteTrigger(db, pTrig); assert( IN_RENAME_OBJECT || !pParse->pNewTrigger ); - sqlite3DeleteTriggerStep(db, pStepList); + tdsqlite3DeleteTriggerStep(db, pStepList); } /* ** Duplicate a range of text from an SQL statement, then convert all ** whitespace characters into ordinary space characters. */ -static char *triggerSpanDup(sqlite3 *db, const char *zStart, const char *zEnd){ - char *z = sqlite3DbSpanDup(db, zStart, zEnd); +static char *triggerSpanDup(tdsqlite3 *db, const char *zStart, const char *zEnd){ + char *z = tdsqlite3DbSpanDup(db, zStart, zEnd); int i; - if( z ) for(i=0; z[i]; i++) if( sqlite3Isspace(z[i]) ) z[i] = ' '; + if( z ) for(i=0; z[i]; i++) if( tdsqlite3Isspace(z[i]) ) z[i] = ' '; return z; } @@ -139701,15 +139701,15 @@ static char *triggerSpanDup(sqlite3 *db, const char *zStart, const char *zEnd){ ** The parser calls this routine when it finds a SELECT statement in ** body of a TRIGGER. */ -SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep( - sqlite3 *db, /* Database connection */ +SQLITE_PRIVATE TriggerStep *tdsqlite3TriggerSelectStep( + tdsqlite3 *db, /* Database connection */ Select *pSelect, /* The SELECT statement */ const char *zStart, /* Start of SQL text */ const char *zEnd /* End of SQL text */ ){ - TriggerStep *pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep)); + TriggerStep *pTriggerStep = tdsqlite3DbMallocZero(db, sizeof(TriggerStep)); if( pTriggerStep==0 ) { - sqlite3SelectDelete(db, pSelect); + tdsqlite3SelectDelete(db, pSelect); return 0; } pTriggerStep->op = TK_SELECT; @@ -139732,19 +139732,19 @@ static TriggerStep *triggerStepAllocate( const char *zStart, /* Start of SQL text */ const char *zEnd /* End of SQL text */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; TriggerStep *pTriggerStep; - pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n + 1); + pTriggerStep = tdsqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n + 1); if( pTriggerStep ){ char *z = (char*)&pTriggerStep[1]; memcpy(z, pName->z, pName->n); - sqlite3Dequote(z); + tdsqlite3Dequote(z); pTriggerStep->zTarget = z; pTriggerStep->op = op; pTriggerStep->zSpan = triggerSpanDup(db, zStart, zEnd); if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenMap(pParse, pTriggerStep->zTarget, pName); + tdsqlite3RenameTokenMap(pParse, pTriggerStep->zTarget, pName); } } return pTriggerStep; @@ -139757,7 +139757,7 @@ static TriggerStep *triggerStepAllocate( ** The parser calls this routine when it sees an INSERT inside the ** body of a trigger. */ -SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep( +SQLITE_PRIVATE TriggerStep *tdsqlite3TriggerInsertStep( Parse *pParse, /* Parser */ Token *pTableName, /* Name of the table into which we insert */ IdList *pColumn, /* List of columns in pTableName to insert into */ @@ -139767,7 +139767,7 @@ SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep( const char *zStart, /* Start of SQL text */ const char *zEnd /* End of SQL text */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; TriggerStep *pTriggerStep; assert(pSelect != 0 || db->mallocFailed); @@ -139778,21 +139778,21 @@ SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep( pTriggerStep->pSelect = pSelect; pSelect = 0; }else{ - pTriggerStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); + pTriggerStep->pSelect = tdsqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); } pTriggerStep->pIdList = pColumn; pTriggerStep->pUpsert = pUpsert; pTriggerStep->orconf = orconf; if( pUpsert ){ - sqlite3HasExplicitNulls(pParse, pUpsert->pUpsertTarget); + tdsqlite3HasExplicitNulls(pParse, pUpsert->pUpsertTarget); } }else{ testcase( pColumn ); - sqlite3IdListDelete(db, pColumn); + tdsqlite3IdListDelete(db, pColumn); testcase( pUpsert ); - sqlite3UpsertDelete(db, pUpsert); + tdsqlite3UpsertDelete(db, pUpsert); } - sqlite3SelectDelete(db, pSelect); + tdsqlite3SelectDelete(db, pSelect); return pTriggerStep; } @@ -139802,7 +139802,7 @@ SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep( ** a pointer to that trigger step. The parser calls this routine when it ** sees an UPDATE statement inside the body of a CREATE TRIGGER. */ -SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep( +SQLITE_PRIVATE TriggerStep *tdsqlite3TriggerUpdateStep( Parse *pParse, /* Parser */ Token *pTableName, /* Name of the table to be updated */ ExprList *pEList, /* The SET clause: list of column and new values */ @@ -139811,7 +139811,7 @@ SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep( const char *zStart, /* Start of SQL text */ const char *zEnd /* End of SQL text */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; TriggerStep *pTriggerStep; pTriggerStep = triggerStepAllocate(pParse, TK_UPDATE, pTableName,zStart,zEnd); @@ -139822,13 +139822,13 @@ SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep( pEList = 0; pWhere = 0; }else{ - pTriggerStep->pExprList = sqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE); - pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); + pTriggerStep->pExprList = tdsqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE); + pTriggerStep->pWhere = tdsqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); } pTriggerStep->orconf = orconf; } - sqlite3ExprListDelete(db, pEList); - sqlite3ExprDelete(db, pWhere); + tdsqlite3ExprListDelete(db, pEList); + tdsqlite3ExprDelete(db, pWhere); return pTriggerStep; } @@ -139837,14 +139837,14 @@ SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep( ** a pointer to that trigger step. The parser calls this routine when it ** sees a DELETE statement inside the body of a CREATE TRIGGER. */ -SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep( +SQLITE_PRIVATE TriggerStep *tdsqlite3TriggerDeleteStep( Parse *pParse, /* Parser */ Token *pTableName, /* The table from which rows are deleted */ Expr *pWhere, /* The WHERE clause */ const char *zStart, /* Start of SQL text */ const char *zEnd /* End of SQL text */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; TriggerStep *pTriggerStep; pTriggerStep = triggerStepAllocate(pParse, TK_DELETE, pTableName,zStart,zEnd); @@ -139853,71 +139853,71 @@ SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep( pTriggerStep->pWhere = pWhere; pWhere = 0; }else{ - pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); + pTriggerStep->pWhere = tdsqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); } pTriggerStep->orconf = OE_Default; } - sqlite3ExprDelete(db, pWhere); + tdsqlite3ExprDelete(db, pWhere); return pTriggerStep; } /* ** Recursively delete a Trigger structure */ -SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3 *db, Trigger *pTrigger){ +SQLITE_PRIVATE void tdsqlite3DeleteTrigger(tdsqlite3 *db, Trigger *pTrigger){ if( pTrigger==0 ) return; - sqlite3DeleteTriggerStep(db, pTrigger->step_list); - sqlite3DbFree(db, pTrigger->zName); - sqlite3DbFree(db, pTrigger->table); - sqlite3ExprDelete(db, pTrigger->pWhen); - sqlite3IdListDelete(db, pTrigger->pColumns); - sqlite3DbFree(db, pTrigger); + tdsqlite3DeleteTriggerStep(db, pTrigger->step_list); + tdsqlite3DbFree(db, pTrigger->zName); + tdsqlite3DbFree(db, pTrigger->table); + tdsqlite3ExprDelete(db, pTrigger->pWhen); + tdsqlite3IdListDelete(db, pTrigger->pColumns); + tdsqlite3DbFree(db, pTrigger); } /* ** This function is called to drop a trigger from the database schema. ** ** This may be called directly from the parser and therefore identifies -** the trigger by name. The sqlite3DropTriggerPtr() routine does the +** the trigger by name. The tdsqlite3DropTriggerPtr() routine does the ** same job as this routine except it takes a pointer to the trigger ** instead of the trigger name. **/ -SQLITE_PRIVATE void sqlite3DropTrigger(Parse *pParse, SrcList *pName, int noErr){ +SQLITE_PRIVATE void tdsqlite3DropTrigger(Parse *pParse, SrcList *pName, int noErr){ Trigger *pTrigger = 0; int i; const char *zDb; const char *zName; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; if( db->mallocFailed ) goto drop_trigger_cleanup; - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ + if( SQLITE_OK!=tdsqlite3ReadSchema(pParse) ){ goto drop_trigger_cleanup; } assert( pName->nSrc==1 ); zDb = pName->a[0].zDatabase; zName = pName->a[0].zName; - assert( zDb!=0 || sqlite3BtreeHoldsAllMutexes(db) ); + assert( zDb!=0 || tdsqlite3BtreeHoldsAllMutexes(db) ); for(i=OMIT_TEMPDB; inDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ - if( zDb && sqlite3StrICmp(db->aDb[j].zDbSName, zDb) ) continue; - assert( sqlite3SchemaMutexHeld(db, j, 0) ); - pTrigger = sqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName); + if( zDb && tdsqlite3StrICmp(db->aDb[j].zDbSName, zDb) ) continue; + assert( tdsqlite3SchemaMutexHeld(db, j, 0) ); + pTrigger = tdsqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName); if( pTrigger ) break; } if( !pTrigger ){ if( !noErr ){ - sqlite3ErrorMsg(pParse, "no such trigger: %S", pName, 0); + tdsqlite3ErrorMsg(pParse, "no such trigger: %S", pName, 0); }else{ - sqlite3CodeVerifyNamedSchema(pParse, zDb); + tdsqlite3CodeVerifyNamedSchema(pParse, zDb); } pParse->checkSchema = 1; goto drop_trigger_cleanup; } - sqlite3DropTriggerPtr(pParse, pTrigger); + tdsqlite3DropTriggerPtr(pParse, pTrigger); drop_trigger_cleanup: - sqlite3SrcListDelete(db, pName); + tdsqlite3SrcListDelete(db, pName); } /* @@ -139925,20 +139925,20 @@ drop_trigger_cleanup: ** is set on. */ static Table *tableOfTrigger(Trigger *pTrigger){ - return sqlite3HashFind(&pTrigger->pTabSchema->tblHash, pTrigger->table); + return tdsqlite3HashFind(&pTrigger->pTabSchema->tblHash, pTrigger->table); } /* ** Drop a trigger given a pointer to that trigger. */ -SQLITE_PRIVATE void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){ +SQLITE_PRIVATE void tdsqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){ Table *pTable; Vdbe *v; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; int iDb; - iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema); + iDb = tdsqlite3SchemaToIndex(pParse->db, pTrigger->pSchema); assert( iDb>=0 && iDbnDb ); pTable = tableOfTrigger(pTrigger); assert( (pTable && pTable->pSchema==pTrigger->pSchema) || iDb==1 ); @@ -139948,8 +139948,8 @@ SQLITE_PRIVATE void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){ const char *zDb = db->aDb[iDb].zDbSName; const char *zTab = SCHEMA_TABLE(iDb); if( iDb==1 ) code = SQLITE_DROP_TEMP_TRIGGER; - if( sqlite3AuthCheck(pParse, code, pTrigger->zName, pTable->zName, zDb) || - sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){ + if( tdsqlite3AuthCheck(pParse, code, pTrigger->zName, pTable->zName, zDb) || + tdsqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){ return; } } @@ -139957,26 +139957,26 @@ SQLITE_PRIVATE void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){ /* Generate code to destroy the database record of the trigger. */ - if( (v = sqlite3GetVdbe(pParse))!=0 ){ - sqlite3NestedParse(pParse, + if( (v = tdsqlite3GetVdbe(pParse))!=0 ){ + tdsqlite3NestedParse(pParse, "DELETE FROM %Q.%s WHERE name=%Q AND type='trigger'", db->aDb[iDb].zDbSName, MASTER_NAME, pTrigger->zName ); - sqlite3ChangeCookie(pParse, iDb); - sqlite3VdbeAddOp4(v, OP_DropTrigger, iDb, 0, 0, pTrigger->zName, 0); + tdsqlite3ChangeCookie(pParse, iDb); + tdsqlite3VdbeAddOp4(v, OP_DropTrigger, iDb, 0, 0, pTrigger->zName, 0); } } /* ** Remove a trigger from the hash tables of the sqlite* pointer. */ -SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3 *db, int iDb, const char *zName){ +SQLITE_PRIVATE void tdsqlite3UnlinkAndDeleteTrigger(tdsqlite3 *db, int iDb, const char *zName){ Trigger *pTrigger; Hash *pHash; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + assert( tdsqlite3SchemaMutexHeld(db, iDb, 0) ); pHash = &(db->aDb[iDb].pSchema->trigHash); - pTrigger = sqlite3HashInsert(pHash, zName, 0); + pTrigger = tdsqlite3HashInsert(pHash, zName, 0); if( ALWAYS(pTrigger) ){ if( pTrigger->pSchema==pTrigger->pTabSchema ){ Table *pTab = tableOfTrigger(pTrigger); @@ -139990,7 +139990,7 @@ SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3 *db, int iDb, const ch } } } - sqlite3DeleteTrigger(db, pTrigger); + tdsqlite3DeleteTrigger(db, pTrigger); db->mDbFlags |= DBFLAG_SchemaChange; } } @@ -140008,7 +140008,7 @@ static int checkColumnOverlap(IdList *pIdList, ExprList *pEList){ int e; if( pIdList==0 || NEVER(pEList==0) ) return 1; for(e=0; enExpr; e++){ - if( sqlite3IdListIndex(pIdList, pEList->a[e].zEName)>=0 ) return 1; + if( tdsqlite3IdListIndex(pIdList, pEList->a[e].zEName)>=0 ) return 1; } return 0; } @@ -140019,7 +140019,7 @@ static int checkColumnOverlap(IdList *pIdList, ExprList *pEList){ ** performed on the table, and, if that operation is an UPDATE, if at ** least one of the columns in pChanges is being modified. */ -SQLITE_PRIVATE Trigger *sqlite3TriggersExist( +SQLITE_PRIVATE Trigger *tdsqlite3TriggersExist( Parse *pParse, /* Parse context */ Table *pTab, /* The table the contains the triggers */ int op, /* one of TK_DELETE, TK_INSERT, TK_UPDATE */ @@ -140031,7 +140031,7 @@ SQLITE_PRIVATE Trigger *sqlite3TriggersExist( Trigger *p; if( (pParse->db->flags & SQLITE_EnableTrigger)!=0 ){ - pList = sqlite3TriggerList(pParse, pTab); + pList = tdsqlite3TriggerList(pParse, pTab); } assert( pList==0 || IsVirtual(pTab)==0 ); for(p=pList; p; p=p->pNext){ @@ -140059,20 +140059,20 @@ static SrcList *targetSrcList( Parse *pParse, /* The parsing context */ TriggerStep *pStep /* The trigger containing the target token */ ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; int iDb; /* Index of the database to use */ SrcList *pSrc; /* SrcList to be returned */ - pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0); + pSrc = tdsqlite3SrcListAppend(pParse, 0, 0, 0); if( pSrc ){ assert( pSrc->nSrc>0 ); - pSrc->a[pSrc->nSrc-1].zName = sqlite3DbStrDup(db, pStep->zTarget); - iDb = sqlite3SchemaToIndex(db, pStep->pTrig->pSchema); + pSrc->a[pSrc->nSrc-1].zName = tdsqlite3DbStrDup(db, pStep->zTarget); + iDb = tdsqlite3SchemaToIndex(db, pStep->pTrig->pSchema); if( iDb==0 || iDb>=2 ){ const char *zDb; assert( iDbnDb ); zDb = db->aDb[iDb].zDbSName; - pSrc->a[pSrc->nSrc-1].zDatabase = sqlite3DbStrDup(db, zDb); + pSrc->a[pSrc->nSrc-1].zDatabase = tdsqlite3DbStrDup(db, zDb); } } return pSrc; @@ -140089,7 +140089,7 @@ static int codeTriggerProgram( ){ TriggerStep *pStep; Vdbe *v = pParse->pVdbe; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; assert( pParse->pTriggerTab && pParse->pToplevel ); assert( pStepList ); @@ -140113,50 +140113,50 @@ static int codeTriggerProgram( #ifndef SQLITE_OMIT_TRACE if( pStep->zSpan ){ - sqlite3VdbeAddOp4(v, OP_Trace, 0x7fffffff, 1, 0, - sqlite3MPrintf(db, "-- %s", pStep->zSpan), + tdsqlite3VdbeAddOp4(v, OP_Trace, 0x7fffffff, 1, 0, + tdsqlite3MPrintf(db, "-- %s", pStep->zSpan), P4_DYNAMIC); } #endif switch( pStep->op ){ case TK_UPDATE: { - sqlite3Update(pParse, + tdsqlite3Update(pParse, targetSrcList(pParse, pStep), - sqlite3ExprListDup(db, pStep->pExprList, 0), - sqlite3ExprDup(db, pStep->pWhere, 0), + tdsqlite3ExprListDup(db, pStep->pExprList, 0), + tdsqlite3ExprDup(db, pStep->pWhere, 0), pParse->eOrconf, 0, 0, 0 ); break; } case TK_INSERT: { - sqlite3Insert(pParse, + tdsqlite3Insert(pParse, targetSrcList(pParse, pStep), - sqlite3SelectDup(db, pStep->pSelect, 0), - sqlite3IdListDup(db, pStep->pIdList), + tdsqlite3SelectDup(db, pStep->pSelect, 0), + tdsqlite3IdListDup(db, pStep->pIdList), pParse->eOrconf, - sqlite3UpsertDup(db, pStep->pUpsert) + tdsqlite3UpsertDup(db, pStep->pUpsert) ); break; } case TK_DELETE: { - sqlite3DeleteFrom(pParse, + tdsqlite3DeleteFrom(pParse, targetSrcList(pParse, pStep), - sqlite3ExprDup(db, pStep->pWhere, 0), 0, 0 + tdsqlite3ExprDup(db, pStep->pWhere, 0), 0, 0 ); break; } default: assert( pStep->op==TK_SELECT ); { SelectDest sDest; - Select *pSelect = sqlite3SelectDup(db, pStep->pSelect, 0); - sqlite3SelectDestInit(&sDest, SRT_Discard, 0); - sqlite3Select(pParse, pSelect, &sDest); - sqlite3SelectDelete(db, pSelect); + Select *pSelect = tdsqlite3SelectDup(db, pStep->pSelect, 0); + tdsqlite3SelectDestInit(&sDest, SRT_Discard, 0); + tdsqlite3Select(pParse, pSelect, &sDest); + tdsqlite3SelectDelete(db, pSelect); break; } } if( pStep->op!=TK_SELECT ){ - sqlite3VdbeAddOp0(v, OP_ResetCount); + tdsqlite3VdbeAddOp0(v, OP_ResetCount); } } @@ -140194,7 +140194,7 @@ static void transferParseError(Parse *pTo, Parse *pFrom){ pTo->nErr = pFrom->nErr; pTo->rc = pFrom->rc; }else{ - sqlite3DbFree(pFrom->db, pFrom->zErrMsg); + tdsqlite3DbFree(pFrom->db, pFrom->zErrMsg); } } @@ -140208,8 +140208,8 @@ static TriggerPrg *codeRowTrigger( Table *pTab, /* The table pTrigger is attached to */ int orconf /* ON CONFLICT policy to code trigger program with */ ){ - Parse *pTop = sqlite3ParseToplevel(pParse); - sqlite3 *db = pParse->db; /* Database handle */ + Parse *pTop = tdsqlite3ParseToplevel(pParse); + tdsqlite3 *db = pParse->db; /* Database handle */ TriggerPrg *pPrg; /* Value to return */ Expr *pWhen = 0; /* Duplicate of trigger WHEN expression */ Vdbe *v; /* Temporary VM */ @@ -140224,13 +140224,13 @@ static TriggerPrg *codeRowTrigger( /* Allocate the TriggerPrg and SubProgram objects. To ensure that they ** are freed if an error occurs, link them into the Parse.pTriggerPrg ** list of the top-level Parse object sooner rather than later. */ - pPrg = sqlite3DbMallocZero(db, sizeof(TriggerPrg)); + pPrg = tdsqlite3DbMallocZero(db, sizeof(TriggerPrg)); if( !pPrg ) return 0; pPrg->pNext = pTop->pTriggerPrg; pTop->pTriggerPrg = pPrg; - pPrg->pProgram = pProgram = sqlite3DbMallocZero(db, sizeof(SubProgram)); + pPrg->pProgram = pProgram = tdsqlite3DbMallocZero(db, sizeof(SubProgram)); if( !pProgram ) return 0; - sqlite3VdbeLinkSubProgram(pTop->pVdbe, pProgram); + tdsqlite3VdbeLinkSubProgram(pTop->pVdbe, pProgram); pPrg->pTrigger = pTrigger; pPrg->orconf = orconf; pPrg->aColmask[0] = 0xffffffff; @@ -140238,7 +140238,7 @@ static TriggerPrg *codeRowTrigger( /* Allocate and populate a new Parse context to use for coding the ** trigger sub-program. */ - pSubParse = sqlite3StackAllocZero(db, sizeof(Parse)); + pSubParse = tdsqlite3StackAllocZero(db, sizeof(Parse)); if( !pSubParse ) return 0; memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pSubParse; @@ -140250,7 +140250,7 @@ static TriggerPrg *codeRowTrigger( pSubParse->nQueryLoop = pParse->nQueryLoop; pSubParse->disableVtab = pParse->disableVtab; - v = sqlite3GetVdbe(pSubParse); + v = tdsqlite3GetVdbe(pSubParse); if( v ){ VdbeComment((v, "Start: %s.%s (%s %s%s%s ON %s)", pTrigger->zName, onErrorText(orconf), @@ -140262,8 +140262,8 @@ static TriggerPrg *codeRowTrigger( )); #ifndef SQLITE_OMIT_TRACE if( pTrigger->zName ){ - sqlite3VdbeChangeP4(v, -1, - sqlite3MPrintf(db, "-- TRIGGER %s", pTrigger->zName), P4_DYNAMIC + tdsqlite3VdbeChangeP4(v, -1, + tdsqlite3MPrintf(db, "-- TRIGGER %s", pTrigger->zName), P4_DYNAMIC ); } #endif @@ -140272,14 +140272,14 @@ static TriggerPrg *codeRowTrigger( ** (or NULL) the sub-vdbe is immediately halted by jumping to the ** OP_Halt inserted at the end of the program. */ if( pTrigger->pWhen ){ - pWhen = sqlite3ExprDup(db, pTrigger->pWhen, 0); - if( SQLITE_OK==sqlite3ResolveExprNames(&sNC, pWhen) + pWhen = tdsqlite3ExprDup(db, pTrigger->pWhen, 0); + if( SQLITE_OK==tdsqlite3ResolveExprNames(&sNC, pWhen) && db->mallocFailed==0 ){ - iEndTrigger = sqlite3VdbeMakeLabel(pSubParse); - sqlite3ExprIfFalse(pSubParse, pWhen, iEndTrigger, SQLITE_JUMPIFNULL); + iEndTrigger = tdsqlite3VdbeMakeLabel(pSubParse); + tdsqlite3ExprIfFalse(pSubParse, pWhen, iEndTrigger, SQLITE_JUMPIFNULL); } - sqlite3ExprDelete(db, pWhen); + tdsqlite3ExprDelete(db, pWhen); } /* Code the trigger program into the sub-vdbe. */ @@ -140287,27 +140287,27 @@ static TriggerPrg *codeRowTrigger( /* Insert an OP_Halt at the end of the sub-program. */ if( iEndTrigger ){ - sqlite3VdbeResolveLabel(v, iEndTrigger); + tdsqlite3VdbeResolveLabel(v, iEndTrigger); } - sqlite3VdbeAddOp0(v, OP_Halt); + tdsqlite3VdbeAddOp0(v, OP_Halt); VdbeComment((v, "End: %s.%s", pTrigger->zName, onErrorText(orconf))); transferParseError(pParse, pSubParse); if( db->mallocFailed==0 && pParse->nErr==0 ){ - pProgram->aOp = sqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg); + pProgram->aOp = tdsqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg); } pProgram->nMem = pSubParse->nMem; pProgram->nCsr = pSubParse->nTab; pProgram->token = (void *)pTrigger; pPrg->aColmask[0] = pSubParse->oldmask; pPrg->aColmask[1] = pSubParse->newmask; - sqlite3VdbeDelete(v); + tdsqlite3VdbeDelete(v); } assert( !pSubParse->pAinc && !pSubParse->pZombieTab ); assert( !pSubParse->pTriggerPrg && !pSubParse->nMaxArg ); - sqlite3ParserReset(pSubParse); - sqlite3StackFree(db, pSubParse); + tdsqlite3ParserReset(pSubParse); + tdsqlite3StackFree(db, pSubParse); return pPrg; } @@ -140324,7 +140324,7 @@ static TriggerPrg *getRowTrigger( Table *pTab, /* The table trigger pTrigger is attached to */ int orconf /* ON CONFLICT algorithm. */ ){ - Parse *pRoot = sqlite3ParseToplevel(pParse); + Parse *pRoot = tdsqlite3ParseToplevel(pParse); TriggerPrg *pPrg; assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) ); @@ -140350,9 +140350,9 @@ static TriggerPrg *getRowTrigger( ** Generate code for the trigger program associated with trigger p on ** table pTab. The reg, orconf and ignoreJump parameters passed to this ** function are the same as those described in the header function for -** sqlite3CodeRowTrigger() +** tdsqlite3CodeRowTrigger() */ -SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect( +SQLITE_PRIVATE void tdsqlite3CodeRowTriggerDirect( Parse *pParse, /* Parse context */ Trigger *p, /* Trigger to code */ Table *pTab, /* The table to code triggers from */ @@ -140360,7 +140360,7 @@ SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect( int orconf, /* ON CONFLICT policy */ int ignoreJump /* Instruction to jump to for RAISE(IGNORE) */ ){ - Vdbe *v = sqlite3GetVdbe(pParse); /* Main VM */ + Vdbe *v = tdsqlite3GetVdbe(pParse); /* Main VM */ TriggerPrg *pPrg; pPrg = getRowTrigger(pParse, p, pTab, orconf); assert( pPrg || pParse->nErr || pParse->db->mallocFailed ); @@ -140370,7 +140370,7 @@ SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect( if( pPrg ){ int bRecursive = (p->zName && 0==(pParse->db->flags&SQLITE_RecTriggers)); - sqlite3VdbeAddOp4(v, OP_Program, reg, ignoreJump, ++pParse->nMem, + tdsqlite3VdbeAddOp4(v, OP_Program, reg, ignoreJump, ++pParse->nMem, (const char *)pPrg->pProgram, P4_SUBPROGRAM); VdbeComment( (v, "Call: %s.%s", (p->zName?p->zName:"fkey"), onErrorText(orconf))); @@ -140380,7 +140380,7 @@ SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect( ** invocation is disallowed if (a) the sub-program is really a trigger, ** not a foreign key action, and (b) the flag to enable recursive triggers ** is clear. */ - sqlite3VdbeChangeP5(v, (u8)bRecursive); + tdsqlite3VdbeChangeP5(v, (u8)bRecursive); } } @@ -140424,7 +140424,7 @@ SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect( ** is the instruction that control should jump to if a trigger program ** raises an IGNORE exception. */ -SQLITE_PRIVATE void sqlite3CodeRowTrigger( +SQLITE_PRIVATE void tdsqlite3CodeRowTrigger( Parse *pParse, /* Parse context */ Trigger *pTrigger, /* List of triggers on table pTab */ int op, /* One of TK_UPDATE, TK_INSERT, TK_DELETE */ @@ -140456,7 +140456,7 @@ SQLITE_PRIVATE void sqlite3CodeRowTrigger( && p->tr_tm==tr_tm && checkColumnOverlap(p->pColumns, pChanges) ){ - sqlite3CodeRowTriggerDirect(pParse, p, pTab, reg, orconf, ignoreJump); + tdsqlite3CodeRowTriggerDirect(pParse, p, pTab, reg, orconf, ignoreJump); } } } @@ -140486,7 +140486,7 @@ SQLITE_PRIVATE void sqlite3CodeRowTrigger( ** tr_tm parameter. Similarly, values accessed by AFTER triggers are only ** included in the returned mask if the TRIGGER_AFTER bit is set in tr_tm. */ -SQLITE_PRIVATE u32 sqlite3TriggerColmask( +SQLITE_PRIVATE u32 tdsqlite3TriggerColmask( Parse *pParse, /* Parse context */ Trigger *pTrigger, /* List of triggers on table pTab */ ExprList *pChanges, /* Changes list for any UPDATE OF triggers */ @@ -140570,32 +140570,32 @@ static void updateVirtualTable( ** into the sqlite_master table.) ** ** Therefore, the P4 parameter is only required if the default value for -** the column is a literal number, string or null. The sqlite3ValueFromExpr() +** the column is a literal number, string or null. The tdsqlite3ValueFromExpr() ** function is capable of transforming these types of expressions into -** sqlite3_value objects. +** tdsqlite3_value objects. ** ** If parameter iReg is not negative, code an OP_RealAffinity instruction ** on register iReg. This is used when an equivalent integer value is ** stored in place of an 8-byte floating point value in order to save ** space. */ -SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i, int iReg){ +SQLITE_PRIVATE void tdsqlite3ColumnDefault(Vdbe *v, Table *pTab, int i, int iReg){ assert( pTab!=0 ); if( !pTab->pSelect ){ - sqlite3_value *pValue = 0; - u8 enc = ENC(sqlite3VdbeDb(v)); + tdsqlite3_value *pValue = 0; + u8 enc = ENC(tdsqlite3VdbeDb(v)); Column *pCol = &pTab->aCol[i]; VdbeComment((v, "%s.%s", pTab->zName, pCol->zName)); assert( inCol ); - sqlite3ValueFromExpr(sqlite3VdbeDb(v), pCol->pDflt, enc, + tdsqlite3ValueFromExpr(tdsqlite3VdbeDb(v), pCol->pDflt, enc, pCol->affinity, &pValue); if( pValue ){ - sqlite3VdbeAppendP4(v, pValue, P4_MEM); + tdsqlite3VdbeAppendP4(v, pValue, P4_MEM); } } #ifndef SQLITE_OMIT_FLOATING_POINT if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){ - sqlite3VdbeAddOp1(v, OP_RealAffinity, iReg); + tdsqlite3VdbeAddOp1(v, OP_RealAffinity, iReg); } #endif } @@ -140625,7 +140625,7 @@ static int indexColumnIsBeingUpdated( assert( iIdxCol==XN_EXPR ); assert( pIdx->aColExpr!=0 ); assert( pIdx->aColExpr->a[iCol].pExpr!=0 ); - return sqlite3ExprReferencesUpdatedColumn(pIdx->aColExpr->a[iCol].pExpr, + return tdsqlite3ExprReferencesUpdatedColumn(pIdx->aColExpr->a[iCol].pExpr, aXRef,chngRowid); } @@ -140647,7 +140647,7 @@ static int indexWhereClauseMightChange( int chngRowid /* true if the rowid is being updated */ ){ if( pIdx->pPartIdxWhere==0 ) return 0; - return sqlite3ExprReferencesUpdatedColumn(pIdx->pPartIdxWhere, + return tdsqlite3ExprReferencesUpdatedColumn(pIdx->pPartIdxWhere, aXRef, chngRowid); } @@ -140658,7 +140658,7 @@ static int indexWhereClauseMightChange( ** \_______/ \________/ \______/ \________________/ * onError pTabList pChanges pWhere */ -SQLITE_PRIVATE void sqlite3Update( +SQLITE_PRIVATE void tdsqlite3Update( Parse *pParse, /* The parser context */ SrcList *pTabList, /* The table in which we should change things */ ExprList *pChanges, /* Things to be changed */ @@ -140680,7 +140680,7 @@ SQLITE_PRIVATE void sqlite3Update( int iBaseCur; /* Base cursor number */ int iDataCur; /* Cursor for the canonical data btree */ int iIdxCur; /* Cursor for the first index */ - sqlite3 *db; /* The database structure */ + tdsqlite3 *db; /* The database structure */ int *aRegIdx = 0; /* Registers for to each index and the main table */ int *aXRef = 0; /* aXRef[i] is the index in pChanges->a[] of the ** an expression for the i-th column of the table. @@ -140697,7 +140697,7 @@ SQLITE_PRIVATE void sqlite3Update( int hasFK; /* True if foreign key processing is required */ int labelBreak; /* Jump here to break out of UPDATE loop */ int labelContinue; /* Jump here to continue next step of UPDATE loop */ - int flags; /* Flags for sqlite3WhereBegin() */ + int flags; /* Flags for tdsqlite3WhereBegin() */ #ifndef SQLITE_OMIT_TRIGGER int isView; /* True when updating a view (INSTEAD OF trigger) */ @@ -140732,15 +140732,15 @@ SQLITE_PRIVATE void sqlite3Update( /* Locate the table which we want to update. */ - pTab = sqlite3SrcListLookup(pParse, pTabList); + pTab = tdsqlite3SrcListLookup(pParse, pTabList); if( pTab==0 ) goto update_cleanup; - iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); + iDb = tdsqlite3SchemaToIndex(pParse->db, pTab->pSchema); /* Figure out if we have any triggers and if the table being ** updated is a view. */ #ifndef SQLITE_OMIT_TRIGGER - pTrigger = sqlite3TriggersExist(pParse, pTab, TK_UPDATE, pChanges, &tmask); + pTrigger = tdsqlite3TriggersExist(pParse, pTab, TK_UPDATE, pChanges, &tmask); isView = pTab->pSelect!=0; assert( pTrigger || tmask==0 ); #else @@ -140755,7 +140755,7 @@ SQLITE_PRIVATE void sqlite3Update( #ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT if( !isView ){ - pWhere = sqlite3LimitWhere( + pWhere = tdsqlite3LimitWhere( pParse, pTabList, pWhere, pOrderBy, pLimit, "UPDATE" ); pOrderBy = 0; @@ -140763,10 +140763,10 @@ SQLITE_PRIVATE void sqlite3Update( } #endif - if( sqlite3ViewGetColumnNames(pParse, pTab) ){ + if( tdsqlite3ViewGetColumnNames(pParse, pTab) ){ goto update_cleanup; } - if( sqlite3IsReadOnly(pParse, pTab, tmask) ){ + if( tdsqlite3IsReadOnly(pParse, pTab, tmask) ){ goto update_cleanup; } @@ -140777,7 +140777,7 @@ SQLITE_PRIVATE void sqlite3Update( */ iBaseCur = iDataCur = pParse->nTab++; iIdxCur = iDataCur+1; - pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab); + pPk = HasRowid(pTab) ? 0 : tdsqlite3PrimaryKeyIndex(pTab); testcase( pPk!=0 && pPk!=pTab->pIndex ); for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ if( pPk==pIdx ){ @@ -140796,7 +140796,7 @@ SQLITE_PRIVATE void sqlite3Update( /* Allocate space for aXRef[], aRegIdx[], and aToOpen[]. ** Initialize aXRef[] and aToOpen[] to their default values. */ - aXRef = sqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx+1) + nIdx+2 ); + aXRef = tdsqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx+1) + nIdx+2 ); if( aXRef==0 ) goto update_cleanup; aRegIdx = aXRef+pTab->nCol; aToOpen = (u8*)(aRegIdx+nIdx+1); @@ -140812,7 +140812,7 @@ SQLITE_PRIVATE void sqlite3Update( sNC.ncFlags = NC_UUpsert; /* Begin generating code. */ - v = sqlite3GetVdbe(pParse); + v = tdsqlite3GetVdbe(pParse); if( v==0 ) goto update_cleanup; /* Resolve the column names in all the expressions of the @@ -140823,11 +140823,11 @@ SQLITE_PRIVATE void sqlite3Update( */ chngRowid = chngPk = 0; for(i=0; inExpr; i++){ - if( sqlite3ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){ + if( tdsqlite3ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){ goto update_cleanup; } for(j=0; jnCol; j++){ - if( sqlite3StrICmp(pTab->aCol[j].zName, pChanges->a[i].zEName)==0 ){ + if( tdsqlite3StrICmp(pTab->aCol[j].zName, pChanges->a[i].zEName)==0 ){ if( j==pTab->iPKey ){ chngRowid = 1; pRowidExpr = pChanges->a[i].pExpr; @@ -140838,7 +140838,7 @@ SQLITE_PRIVATE void sqlite3Update( else if( pTab->aCol[j].colFlags & COLFLAG_GENERATED ){ testcase( pTab->aCol[j].colFlags & COLFLAG_VIRTUAL ); testcase( pTab->aCol[j].colFlags & COLFLAG_STORED ); - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "cannot UPDATE generated column \"%s\"", pTab->aCol[j].zName); goto update_cleanup; @@ -140849,12 +140849,12 @@ SQLITE_PRIVATE void sqlite3Update( } } if( j>=pTab->nCol ){ - if( pPk==0 && sqlite3IsRowid(pChanges->a[i].zEName) ){ + if( pPk==0 && tdsqlite3IsRowid(pChanges->a[i].zEName) ){ j = -1; chngRowid = 1; pRowidExpr = pChanges->a[i].pExpr; }else{ - sqlite3ErrorMsg(pParse, "no such column: %s", pChanges->a[i].zEName); + tdsqlite3ErrorMsg(pParse, "no such column: %s", pChanges->a[i].zEName); pParse->checkSchema = 1; goto update_cleanup; } @@ -140862,7 +140862,7 @@ SQLITE_PRIVATE void sqlite3Update( #ifndef SQLITE_OMIT_AUTHORIZATION { int rc; - rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName, + rc = tdsqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName, j<0 ? "ROWID" : pTab->aCol[j].zName, db->aDb[iDb].zDbSName); if( rc==SQLITE_DENY ){ @@ -140895,7 +140895,7 @@ SQLITE_PRIVATE void sqlite3Update( for(i=0; inCol; i++){ if( aXRef[i]>=0 ) continue; if( (pTab->aCol[i].colFlags & COLFLAG_GENERATED)==0 ) continue; - if( sqlite3ExprReferencesUpdatedColumn(pTab->aCol[i].pDflt, + if( tdsqlite3ExprReferencesUpdatedColumn(pTab->aCol[i].pDflt, aXRef, chngRowid) ){ aXRef[i] = 99999; bProgress = 1; @@ -140912,7 +140912,7 @@ SQLITE_PRIVATE void sqlite3Update( */ pTabList->a[0].colUsed = IsVirtual(pTab) ? ALLBITS : 0; - hasFK = sqlite3FkRequired(pParse, pTab, aXRef, chngKey); + hasFK = tdsqlite3FkRequired(pParse, pTab, aXRef, chngKey); /* There is one entry in the aRegIdx[] array for each index on the table ** being updated. Fill in aRegIdx[] with a register number that will hold @@ -140949,8 +140949,8 @@ SQLITE_PRIVATE void sqlite3Update( memset(aToOpen, 1, nIdx+1); } - if( pParse->nested==0 ) sqlite3VdbeCountChanges(v); - sqlite3BeginWriteOperation(pParse, pTrigger || hasFK, iDb); + if( pParse->nested==0 ) tdsqlite3VdbeCountChanges(v); + tdsqlite3BeginWriteOperation(pParse, pTrigger || hasFK, iDb); /* Allocate required registers. */ if( !IsVirtual(pTab) ){ @@ -140975,7 +140975,7 @@ SQLITE_PRIVATE void sqlite3Update( /* Start the view context. */ if( isView ){ - sqlite3AuthContextPush(pParse, &sContext, pTab->zName); + tdsqlite3AuthContextPush(pParse, &sContext, pTab->zName); } /* If we are trying to update a view, realize that view into @@ -140983,7 +140983,7 @@ SQLITE_PRIVATE void sqlite3Update( */ #if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) if( isView ){ - sqlite3MaterializeView(pParse, pTab, + tdsqlite3MaterializeView(pParse, pTab, pWhere, pOrderBy, pLimit, iDataCur ); pOrderBy = 0; @@ -140994,7 +140994,7 @@ SQLITE_PRIVATE void sqlite3Update( /* Resolve the column names in all the expressions in the ** WHERE clause. */ - if( sqlite3ResolveExprNames(&sNC, pWhere) ){ + if( tdsqlite3ResolveExprNames(&sNC, pWhere) ){ goto update_cleanup; } @@ -141008,7 +141008,7 @@ SQLITE_PRIVATE void sqlite3Update( #endif /* Jump to labelBreak to abandon further processing of this UPDATE */ - labelContinue = labelBreak = sqlite3VdbeMakeLabel(pParse); + labelContinue = labelBreak = tdsqlite3VdbeMakeLabel(pParse); /* Not an UPSERT. Normal processing. Begin by ** initialize the count of updated rows */ @@ -141018,11 +141018,11 @@ SQLITE_PRIVATE void sqlite3Update( && pUpsert==0 ){ regRowCount = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount); } if( HasRowid(pTab) ){ - sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid); + tdsqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid); }else{ assert( pPk!=0 ); nPk = pPk->nKeyCol; @@ -141031,9 +141031,9 @@ SQLITE_PRIVATE void sqlite3Update( regKey = ++pParse->nMem; if( pUpsert==0 ){ iEph = pParse->nTab++; - sqlite3VdbeAddOp3(v, OP_Null, 0, iPk, iPk+nPk-1); - addrOpen = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEph, nPk); - sqlite3VdbeSetP4KeyInfo(pParse, pPk); + tdsqlite3VdbeAddOp3(v, OP_Null, 0, iPk, iPk+nPk-1); + addrOpen = tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEph, nPk); + tdsqlite3VdbeSetP4KeyInfo(pParse, pPk); } } @@ -141045,7 +141045,7 @@ SQLITE_PRIVATE void sqlite3Update( */ pWInfo = 0; eOnePass = ONEPASS_SINGLE; - sqlite3ExprIfFalse(pParse, pWhere, labelBreak, SQLITE_JUMPIFNULL); + tdsqlite3ExprIfFalse(pParse, pWhere, labelBreak, SQLITE_JUMPIFNULL); bFinishSeek = 0; }else{ /* Begin the database scan. @@ -141059,7 +141059,7 @@ SQLITE_PRIVATE void sqlite3Update( if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){ flags |= WHERE_ONEPASS_MULTIROW; } - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, flags, iIdxCur); + pWInfo = tdsqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, flags, iIdxCur); if( pWInfo==0 ) goto update_cleanup; /* A one-pass strategy that might update more than one row may not @@ -141072,10 +141072,10 @@ SQLITE_PRIVATE void sqlite3Update( ** Fall back to ONEPASS_OFF if where.c has selected a ONEPASS_MULTI ** strategy that uses an index for which one or more columns are being ** updated. */ - eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); - bFinishSeek = sqlite3WhereUsesDeferredSeek(pWInfo); + eOnePass = tdsqlite3WhereOkOnePass(pWInfo, aiCurOnePass); + bFinishSeek = tdsqlite3WhereUsesDeferredSeek(pWInfo); if( eOnePass!=ONEPASS_SINGLE ){ - sqlite3MultiWrite(pParse); + tdsqlite3MultiWrite(pParse); if( eOnePass==ONEPASS_MULTI ){ int iCur = aiCurOnePass[1]; if( iCur>=0 && iCur!=iDataCur && aToOpen[iCur-iBaseCur] ){ @@ -141090,11 +141090,11 @@ SQLITE_PRIVATE void sqlite3Update( /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF ** mode, write the rowid into the FIFO. In either of the one-pass modes, ** leave it in register regOldRowid. */ - sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid); + tdsqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid); if( eOnePass==ONEPASS_OFF ){ /* We need to use regRowSet, so reallocate aRegIdx[nAllIdx] */ aRegIdx[nAllIdx] = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_RowSetAdd, regRowSet, regOldRowid); + tdsqlite3VdbeAddOp2(v, OP_RowSetAdd, regRowSet, regOldRowid); } }else{ /* Read the PK of the current row into an array of registers. In @@ -141104,23 +141104,23 @@ SQLITE_PRIVATE void sqlite3Update( ** is not required) and leave the PK fields in the array of registers. */ for(i=0; iaiColumn[i]>=0 ); - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, + tdsqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, pPk->aiColumn[i], iPk+i); } if( eOnePass ){ - if( addrOpen ) sqlite3VdbeChangeToNoop(v, addrOpen); + if( addrOpen ) tdsqlite3VdbeChangeToNoop(v, addrOpen); nKey = nPk; regKey = iPk; }else{ - sqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, regKey, - sqlite3IndexAffinityStr(db, pPk), nPk); - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iEph, regKey, iPk, nPk); + tdsqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, regKey, + tdsqlite3IndexAffinityStr(db, pPk), nPk); + tdsqlite3VdbeAddOp4Int(v, OP_IdxInsert, iEph, regKey, iPk, nPk); } } if( pUpsert==0 ){ if( eOnePass!=ONEPASS_MULTI ){ - sqlite3WhereEnd(pWInfo); + tdsqlite3WhereEnd(pWInfo); } if( !isView ){ @@ -141133,37 +141133,37 @@ SQLITE_PRIVATE void sqlite3Update( } if( eOnePass==ONEPASS_MULTI && (nIdx-(aiCurOnePass[1]>=0))>0 ){ - addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); + addrOnce = tdsqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } - sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, iBaseCur, + tdsqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, iBaseCur, aToOpen, 0, 0); - if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce); + if( addrOnce ) tdsqlite3VdbeJumpHere(v, addrOnce); } /* Top of the update loop */ if( eOnePass!=ONEPASS_OFF ){ if( !isView && aiCurOnePass[0]!=iDataCur && aiCurOnePass[1]!=iDataCur ){ assert( pPk ); - sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelBreak, regKey,nKey); + tdsqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelBreak, regKey,nKey); VdbeCoverage(v); } if( eOnePass!=ONEPASS_SINGLE ){ - labelContinue = sqlite3VdbeMakeLabel(pParse); + labelContinue = tdsqlite3VdbeMakeLabel(pParse); } - sqlite3VdbeAddOp2(v, OP_IsNull, pPk ? regKey : regOldRowid, labelBreak); + tdsqlite3VdbeAddOp2(v, OP_IsNull, pPk ? regKey : regOldRowid, labelBreak); VdbeCoverageIf(v, pPk==0); VdbeCoverageIf(v, pPk!=0); }else if( pPk ){ - labelContinue = sqlite3VdbeMakeLabel(pParse); - sqlite3VdbeAddOp2(v, OP_Rewind, iEph, labelBreak); VdbeCoverage(v); - addrTop = sqlite3VdbeAddOp2(v, OP_RowData, iEph, regKey); - sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue, regKey, 0); + labelContinue = tdsqlite3VdbeMakeLabel(pParse); + tdsqlite3VdbeAddOp2(v, OP_Rewind, iEph, labelBreak); VdbeCoverage(v); + addrTop = tdsqlite3VdbeAddOp2(v, OP_RowData, iEph, regKey); + tdsqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue, regKey, 0); VdbeCoverage(v); }else{ - labelContinue = sqlite3VdbeAddOp3(v, OP_RowSetRead, regRowSet,labelBreak, + labelContinue = tdsqlite3VdbeAddOp3(v, OP_RowSetRead, regRowSet,labelBreak, regOldRowid); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid); + tdsqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid); VdbeCoverage(v); } } @@ -141174,32 +141174,32 @@ SQLITE_PRIVATE void sqlite3Update( ** already populated. */ assert( chngKey || pTrigger || hasFK || regOldRowid==regNewRowid ); if( chngRowid ){ - sqlite3ExprCode(pParse, pRowidExpr, regNewRowid); - sqlite3VdbeAddOp1(v, OP_MustBeInt, regNewRowid); VdbeCoverage(v); + tdsqlite3ExprCode(pParse, pRowidExpr, regNewRowid); + tdsqlite3VdbeAddOp1(v, OP_MustBeInt, regNewRowid); VdbeCoverage(v); } /* Compute the old pre-UPDATE content of the row being changed, if that ** information is needed */ if( chngPk || hasFK || pTrigger ){ - u32 oldmask = (hasFK ? sqlite3FkOldmask(pParse, pTab) : 0); - oldmask |= sqlite3TriggerColmask(pParse, + u32 oldmask = (hasFK ? tdsqlite3FkOldmask(pParse, pTab) : 0); + oldmask |= tdsqlite3TriggerColmask(pParse, pTrigger, pChanges, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onError ); for(i=0; inCol; i++){ u32 colFlags = pTab->aCol[i].colFlags; - k = sqlite3TableColumnToStorage(pTab, i) + regOld; + k = tdsqlite3TableColumnToStorage(pTab, i) + regOld; if( oldmask==0xffffffff || (i<32 && (oldmask & MASKBIT32(i))!=0) || (colFlags & COLFLAG_PRIMKEY)!=0 ){ testcase( oldmask!=0xffffffff && i==31 ); - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, k); + tdsqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, k); }else{ - sqlite3VdbeAddOp2(v, OP_Null, 0, k); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, k); } } if( chngRowid==0 && pPk==0 ){ - sqlite3VdbeAddOp2(v, OP_Copy, regOldRowid, regNewRowid); + tdsqlite3VdbeAddOp2(v, OP_Copy, regOldRowid, regNewRowid); } } @@ -141216,18 +141216,18 @@ SQLITE_PRIVATE void sqlite3Update( ** may have modified them). So not loading those that are not going to ** be used eliminates some redundant opcodes. */ - newmask = sqlite3TriggerColmask( + newmask = tdsqlite3TriggerColmask( pParse, pTrigger, pChanges, 1, TRIGGER_BEFORE, pTab, onError ); for(i=0, k=regNew; inCol; i++, k++){ if( i==pTab->iPKey ){ - sqlite3VdbeAddOp2(v, OP_Null, 0, k); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, k); }else if( (pTab->aCol[i].colFlags & COLFLAG_GENERATED)!=0 ){ if( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL ) k--; }else{ j = aXRef[i]; if( j>=0 ){ - sqlite3ExprCode(pParse, pChanges->a[j].pExpr, k); + tdsqlite3ExprCode(pParse, pChanges->a[j].pExpr, k); }else if( 0==(tmask&TRIGGER_BEFORE) || i>31 || (newmask & MASKBIT32(i)) ){ /* This branch loads the value of a column that will not be changed ** into a register. This is done if there are no BEFORE triggers, or @@ -141236,10 +141236,10 @@ SQLITE_PRIVATE void sqlite3Update( */ testcase( i==31 ); testcase( i==32 ); - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, k); + tdsqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, k); bFinishSeek = 0; }else{ - sqlite3VdbeAddOp2(v, OP_Null, 0, k); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, k); } } } @@ -141247,7 +141247,7 @@ SQLITE_PRIVATE void sqlite3Update( if( pTab->tabFlags & TF_HasGenerated ){ testcase( pTab->tabFlags & TF_HasVirtual ); testcase( pTab->tabFlags & TF_HasStored ); - sqlite3ComputeGeneratedColumns(pParse, regNew, pTab); + tdsqlite3ComputeGeneratedColumns(pParse, regNew, pTab); } #endif @@ -141255,8 +141255,8 @@ SQLITE_PRIVATE void sqlite3Update( ** verified. One could argue that this is wrong. */ if( tmask&TRIGGER_BEFORE ){ - sqlite3TableAffinity(v, pTab, regNew); - sqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges, + tdsqlite3TableAffinity(v, pTab, regNew); + tdsqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges, TRIGGER_BEFORE, pTab, regOldRowid, onError, labelContinue); /* The row-trigger may have deleted the row being updated. In this @@ -141266,10 +141266,10 @@ SQLITE_PRIVATE void sqlite3Update( ** documentation. */ if( pPk ){ - sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue,regKey,nKey); + tdsqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue,regKey,nKey); VdbeCoverage(v); }else{ - sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid); + tdsqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid); VdbeCoverage(v); } @@ -141286,14 +141286,14 @@ SQLITE_PRIVATE void sqlite3Update( if( pTab->aCol[i].colFlags & COLFLAG_GENERATED ){ if( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL ) k--; }else if( aXRef[i]<0 && i!=pTab->iPKey ){ - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, k); + tdsqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, k); } } #ifndef SQLITE_OMIT_GENERATED_COLUMNS if( pTab->tabFlags & TF_HasGenerated ){ testcase( pTab->tabFlags & TF_HasVirtual ); testcase( pTab->tabFlags & TF_HasStored ); - sqlite3ComputeGeneratedColumns(pParse, regNew, pTab); + tdsqlite3ComputeGeneratedColumns(pParse, regNew, pTab); } #endif } @@ -141301,7 +141301,7 @@ SQLITE_PRIVATE void sqlite3Update( if( !isView ){ /* Do constraint checks. */ assert( regOldRowid>0 ); - sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur, + tdsqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur, regNewRowid, regOldRowid, chngKey, onError, labelContinue, &bReplace, aXRef, 0); @@ -141310,20 +141310,20 @@ SQLITE_PRIVATE void sqlite3Update( ** moved cursor iDataCur. Reseek it. */ if( bReplace || chngKey ){ if( pPk ){ - sqlite3VdbeAddOp4Int(v, OP_NotFound,iDataCur,labelContinue,regKey,nKey); + tdsqlite3VdbeAddOp4Int(v, OP_NotFound,iDataCur,labelContinue,regKey,nKey); }else{ - sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue,regOldRowid); + tdsqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue,regOldRowid); } VdbeCoverageNeverTaken(v); } /* Do FK constraint checks. */ if( hasFK ){ - sqlite3FkCheck(pParse, pTab, regOldRowid, 0, aXRef, chngKey); + tdsqlite3FkCheck(pParse, pTab, regOldRowid, 0, aXRef, chngKey); } /* Delete the index entries associated with the current record. */ - sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur, aRegIdx, -1); + tdsqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur, aRegIdx, -1); /* We must run the OP_FinishSeek opcode to resolve a prior ** OP_DeferredSeek if there is any possibility that there have been @@ -141331,7 +141331,7 @@ SQLITE_PRIVATE void sqlite3Update( ** we want to avoid the OP_FinishSeek if possible, as running it ** costs CPU cycles. */ if( bFinishSeek ){ - sqlite3VdbeAddOp1(v, OP_FinishSeek, iDataCur); + tdsqlite3VdbeAddOp1(v, OP_FinishSeek, iDataCur); } /* If changing the rowid value, or if there are foreign key constraints @@ -141345,29 +141345,29 @@ SQLITE_PRIVATE void sqlite3Update( */ assert( regNew==regNewRowid+1 ); #ifdef SQLITE_ENABLE_PREUPDATE_HOOK - sqlite3VdbeAddOp3(v, OP_Delete, iDataCur, + tdsqlite3VdbeAddOp3(v, OP_Delete, iDataCur, OPFLAG_ISUPDATE | ((hasFK>1 || chngKey) ? 0 : OPFLAG_ISNOOP), regNewRowid ); if( eOnePass==ONEPASS_MULTI ){ assert( hasFK==0 && chngKey==0 ); - sqlite3VdbeChangeP5(v, OPFLAG_SAVEPOSITION); + tdsqlite3VdbeChangeP5(v, OPFLAG_SAVEPOSITION); } if( !pParse->nested ){ - sqlite3VdbeAppendP4(v, pTab, P4_TABLE); + tdsqlite3VdbeAppendP4(v, pTab, P4_TABLE); } #else if( hasFK>1 || chngKey ){ - sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, 0); + tdsqlite3VdbeAddOp2(v, OP_Delete, iDataCur, 0); } #endif if( hasFK ){ - sqlite3FkCheck(pParse, pTab, 0, regNewRowid, aXRef, chngKey); + tdsqlite3FkCheck(pParse, pTab, 0, regNewRowid, aXRef, chngKey); } /* Insert the new index entries and the new record. */ - sqlite3CompleteInsertion( + tdsqlite3CompleteInsertion( pParse, pTab, iDataCur, iIdxCur, regNewRowid, aRegIdx, OPFLAG_ISUPDATE | (eOnePass==ONEPASS_MULTI ? OPFLAG_SAVEPOSITION : 0), 0, 0 @@ -141377,17 +141377,17 @@ SQLITE_PRIVATE void sqlite3Update( ** handle rows (possibly in other tables) that refer via a foreign key ** to the row just updated. */ if( hasFK ){ - sqlite3FkActions(pParse, pTab, pChanges, regOldRowid, aXRef, chngKey); + tdsqlite3FkActions(pParse, pTab, pChanges, regOldRowid, aXRef, chngKey); } } /* Increment the row counter */ if( regRowCount ){ - sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1); + tdsqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1); } - sqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges, + tdsqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges, TRIGGER_AFTER, pTab, regOldRowid, onError, labelContinue); /* Repeat the above with the next record to be updated, until @@ -141396,22 +141396,22 @@ SQLITE_PRIVATE void sqlite3Update( if( eOnePass==ONEPASS_SINGLE ){ /* Nothing to do at end-of-loop for a single-pass */ }else if( eOnePass==ONEPASS_MULTI ){ - sqlite3VdbeResolveLabel(v, labelContinue); - sqlite3WhereEnd(pWInfo); + tdsqlite3VdbeResolveLabel(v, labelContinue); + tdsqlite3WhereEnd(pWInfo); }else if( pPk ){ - sqlite3VdbeResolveLabel(v, labelContinue); - sqlite3VdbeAddOp2(v, OP_Next, iEph, addrTop); VdbeCoverage(v); + tdsqlite3VdbeResolveLabel(v, labelContinue); + tdsqlite3VdbeAddOp2(v, OP_Next, iEph, addrTop); VdbeCoverage(v); }else{ - sqlite3VdbeGoto(v, labelContinue); + tdsqlite3VdbeGoto(v, labelContinue); } - sqlite3VdbeResolveLabel(v, labelBreak); + tdsqlite3VdbeResolveLabel(v, labelBreak); /* Update the sqlite_sequence table by storing the content of the ** maximum rowid counter values recorded while inserting into ** autoincrement tables. */ if( pParse->nested==0 && pParse->pTriggerTab==0 && pUpsert==0 ){ - sqlite3AutoincrementEnd(pParse); + tdsqlite3AutoincrementEnd(pParse); } /* @@ -141419,20 +141419,20 @@ SQLITE_PRIVATE void sqlite3Update( ** that information. */ if( regRowCount ){ - sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", SQLITE_STATIC); + tdsqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1); + tdsqlite3VdbeSetNumCols(v, 1); + tdsqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", SQLITE_STATIC); } update_cleanup: - sqlite3AuthContextPop(&sContext); - sqlite3DbFree(db, aXRef); /* Also frees aRegIdx[] and aToOpen[] */ - sqlite3SrcListDelete(db, pTabList); - sqlite3ExprListDelete(db, pChanges); - sqlite3ExprDelete(db, pWhere); + tdsqlite3AuthContextPop(&sContext); + tdsqlite3DbFree(db, aXRef); /* Also frees aRegIdx[] and aToOpen[] */ + tdsqlite3SrcListDelete(db, pTabList); + tdsqlite3ExprListDelete(db, pChanges); + tdsqlite3ExprDelete(db, pWhere); #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) - sqlite3ExprListDelete(db, pOrderBy); - sqlite3ExprDelete(db, pLimit); + tdsqlite3ExprListDelete(db, pOrderBy); + tdsqlite3ExprDelete(db, pLimit); #endif return; } @@ -141481,15 +141481,15 @@ static void updateVirtualTable( Vdbe *v = pParse->pVdbe; /* Virtual machine under construction */ int ephemTab; /* Table holding the result of the SELECT */ int i; /* Loop counter */ - sqlite3 *db = pParse->db; /* Database connection */ - const char *pVTab = (const char*)sqlite3GetVTable(db, pTab); + tdsqlite3 *db = pParse->db; /* Database connection */ + const char *pVTab = (const char*)tdsqlite3GetVTable(db, pTab); WhereInfo *pWInfo; int nArg = 2 + pTab->nCol; /* Number of arguments to VUpdate */ int regArg; /* First register in VUpdate arg array */ int regRec; /* Register in which to assemble record */ int regRowid; /* Register for ephem table rowid */ int iCsr = pSrc->a[0].iCursor; /* Cursor used for virtual table scan */ - int aDummy[2]; /* Unused arg for sqlite3WhereOkOnePass() */ + int aDummy[2]; /* Unused arg for tdsqlite3WhereOkOnePass() */ int eOnePass; /* True to use onepass strategy */ int addr; /* Address of OP_OpenEphemeral */ @@ -141498,45 +141498,45 @@ static void updateVirtualTable( ** these arguments will be temporarily stored. */ assert( v ); ephemTab = pParse->nTab++; - addr= sqlite3VdbeAddOp2(v, OP_OpenEphemeral, ephemTab, nArg); + addr= tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, ephemTab, nArg); regArg = pParse->nMem + 1; pParse->nMem += nArg; regRec = ++pParse->nMem; regRowid = ++pParse->nMem; /* Start scanning the virtual table */ - pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0,0,WHERE_ONEPASS_DESIRED,0); + pWInfo = tdsqlite3WhereBegin(pParse, pSrc, pWhere, 0,0,WHERE_ONEPASS_DESIRED,0); if( pWInfo==0 ) return; /* Populate the argument registers. */ for(i=0; inCol; i++){ assert( (pTab->aCol[i].colFlags & COLFLAG_GENERATED)==0 ); if( aXRef[i]>=0 ){ - sqlite3ExprCode(pParse, pChanges->a[aXRef[i]].pExpr, regArg+2+i); + tdsqlite3ExprCode(pParse, pChanges->a[aXRef[i]].pExpr, regArg+2+i); }else{ - sqlite3VdbeAddOp3(v, OP_VColumn, iCsr, i, regArg+2+i); - sqlite3VdbeChangeP5(v, OPFLAG_NOCHNG);/* Enable sqlite3_vtab_nochange() */ + tdsqlite3VdbeAddOp3(v, OP_VColumn, iCsr, i, regArg+2+i); + tdsqlite3VdbeChangeP5(v, OPFLAG_NOCHNG);/* Enable tdsqlite3_vtab_nochange() */ } } if( HasRowid(pTab) ){ - sqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg); + tdsqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg); if( pRowid ){ - sqlite3ExprCode(pParse, pRowid, regArg+1); + tdsqlite3ExprCode(pParse, pRowid, regArg+1); }else{ - sqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg+1); + tdsqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg+1); } }else{ Index *pPk; /* PRIMARY KEY index */ i16 iPk; /* PRIMARY KEY column */ - pPk = sqlite3PrimaryKeyIndex(pTab); + pPk = tdsqlite3PrimaryKeyIndex(pTab); assert( pPk!=0 ); assert( pPk->nKeyCol==1 ); iPk = pPk->aiColumn[0]; - sqlite3VdbeAddOp3(v, OP_VColumn, iCsr, iPk, regArg); - sqlite3VdbeAddOp2(v, OP_SCopy, regArg+2+iPk, regArg+1); + tdsqlite3VdbeAddOp3(v, OP_VColumn, iCsr, iPk, regArg); + tdsqlite3VdbeAddOp2(v, OP_SCopy, regArg+2+iPk, regArg+1); } - eOnePass = sqlite3WhereOkOnePass(pWInfo, aDummy); + eOnePass = tdsqlite3WhereOkOnePass(pWInfo, aDummy); /* There is no ONEPASS_MULTI on virtual tables */ assert( eOnePass==ONEPASS_OFF || eOnePass==ONEPASS_SINGLE ); @@ -141544,49 +141544,49 @@ static void updateVirtualTable( if( eOnePass ){ /* If using the onepass strategy, no-op out the OP_OpenEphemeral coded ** above. */ - sqlite3VdbeChangeToNoop(v, addr); - sqlite3VdbeAddOp1(v, OP_Close, iCsr); + tdsqlite3VdbeChangeToNoop(v, addr); + tdsqlite3VdbeAddOp1(v, OP_Close, iCsr); }else{ /* Create a record from the argument register contents and insert it into ** the ephemeral table. */ - sqlite3MultiWrite(pParse); - sqlite3VdbeAddOp3(v, OP_MakeRecord, regArg, nArg, regRec); + tdsqlite3MultiWrite(pParse); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, regArg, nArg, regRec); #ifdef SQLITE_DEBUG /* Signal an assert() within OP_MakeRecord that it is allowed to ** accept no-change records with serial_type 10 */ - sqlite3VdbeChangeP5(v, OPFLAG_NOCHNG_MAGIC); + tdsqlite3VdbeChangeP5(v, OPFLAG_NOCHNG_MAGIC); #endif - sqlite3VdbeAddOp2(v, OP_NewRowid, ephemTab, regRowid); - sqlite3VdbeAddOp3(v, OP_Insert, ephemTab, regRec, regRowid); + tdsqlite3VdbeAddOp2(v, OP_NewRowid, ephemTab, regRowid); + tdsqlite3VdbeAddOp3(v, OP_Insert, ephemTab, regRec, regRowid); } if( eOnePass==ONEPASS_OFF ){ /* End the virtual table scan */ - sqlite3WhereEnd(pWInfo); + tdsqlite3WhereEnd(pWInfo); /* Begin scannning through the ephemeral table. */ - addr = sqlite3VdbeAddOp1(v, OP_Rewind, ephemTab); VdbeCoverage(v); + addr = tdsqlite3VdbeAddOp1(v, OP_Rewind, ephemTab); VdbeCoverage(v); /* Extract arguments from the current row of the ephemeral table and ** invoke the VUpdate method. */ for(i=0; ipUpsertTarget); - sqlite3ExprDelete(db, p->pUpsertTargetWhere); - sqlite3ExprListDelete(db, p->pUpsertSet); - sqlite3ExprDelete(db, p->pUpsertWhere); - sqlite3DbFree(db, p); + tdsqlite3ExprListDelete(db, p->pUpsertTarget); + tdsqlite3ExprDelete(db, p->pUpsertTargetWhere); + tdsqlite3ExprListDelete(db, p->pUpsertSet); + tdsqlite3ExprDelete(db, p->pUpsertWhere); + tdsqlite3DbFree(db, p); } } /* ** Duplicate an Upsert object. */ -SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3 *db, Upsert *p){ +SQLITE_PRIVATE Upsert *tdsqlite3UpsertDup(tdsqlite3 *db, Upsert *p){ if( p==0 ) return 0; - return sqlite3UpsertNew(db, - sqlite3ExprListDup(db, p->pUpsertTarget, 0), - sqlite3ExprDup(db, p->pUpsertTargetWhere, 0), - sqlite3ExprListDup(db, p->pUpsertSet, 0), - sqlite3ExprDup(db, p->pUpsertWhere, 0) + return tdsqlite3UpsertNew(db, + tdsqlite3ExprListDup(db, p->pUpsertTarget, 0), + tdsqlite3ExprDup(db, p->pUpsertTargetWhere, 0), + tdsqlite3ExprListDup(db, p->pUpsertSet, 0), + tdsqlite3ExprDup(db, p->pUpsertWhere, 0) ); } /* ** Create a new Upsert object. */ -SQLITE_PRIVATE Upsert *sqlite3UpsertNew( - sqlite3 *db, /* Determines which memory allocator to use */ +SQLITE_PRIVATE Upsert *tdsqlite3UpsertNew( + tdsqlite3 *db, /* Determines which memory allocator to use */ ExprList *pTarget, /* Target argument to ON CONFLICT, or NULL */ Expr *pTargetWhere, /* Optional WHERE clause on the target */ ExprList *pSet, /* UPDATE columns, or NULL for a DO NOTHING */ Expr *pWhere /* WHERE clause for the ON CONFLICT UPDATE */ ){ Upsert *pNew; - pNew = sqlite3DbMallocRaw(db, sizeof(Upsert)); + pNew = tdsqlite3DbMallocRaw(db, sizeof(Upsert)); if( pNew==0 ){ - sqlite3ExprListDelete(db, pTarget); - sqlite3ExprDelete(db, pTargetWhere); - sqlite3ExprListDelete(db, pSet); - sqlite3ExprDelete(db, pWhere); + tdsqlite3ExprListDelete(db, pTarget); + tdsqlite3ExprDelete(db, pTargetWhere); + tdsqlite3ExprListDelete(db, pSet); + tdsqlite3ExprDelete(db, pWhere); return 0; }else{ pNew->pUpsertTarget = pTarget; @@ -141671,7 +141671,7 @@ SQLITE_PRIVATE Upsert *sqlite3UpsertNew( ** Return SQLITE_OK if everything works, or an error code is something ** is wrong. */ -SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget( +SQLITE_PRIVATE int tdsqlite3UpsertAnalyzeTarget( Parse *pParse, /* The parsing context */ SrcList *pTabList, /* Table into which we are inserting */ Upsert *pUpsert /* The ON CONFLICT clauses */ @@ -141697,9 +141697,9 @@ SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget( memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pParse; sNC.pSrcList = pTabList; - rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget); + rc = tdsqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget); if( rc ) return rc; - rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere); + rc = tdsqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere); if( rc ) return rc; /* Check to see if the conflict target matches the rowid. */ @@ -141735,7 +141735,7 @@ SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget( if( pTarget->nExpr!=pIdx->nKeyCol ) continue; if( pIdx->pPartIdxWhere ){ if( pUpsert->pUpsertTargetWhere==0 ) continue; - if( sqlite3ExprCompare(pParse, pUpsert->pUpsertTargetWhere, + if( tdsqlite3ExprCompare(pParse, pUpsert->pUpsertTargetWhere, pIdx->pPartIdxWhere, iCursor)!=0 ){ continue; } @@ -141758,7 +141758,7 @@ SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget( pExpr = &sCol[0]; } for(jj=0; jja[jj].pExpr, pExpr,iCursor)<2 ){ + if( tdsqlite3ExprCompare(pParse, pTarget->a[jj].pExpr, pExpr,iCursor)<2 ){ break; /* Column ii of the index matches column jj of target */ } } @@ -141775,7 +141775,7 @@ SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget( pUpsert->pUpsertIdx = pIdx; return SQLITE_OK; } - sqlite3ErrorMsg(pParse, "ON CONFLICT clause does not match any " + tdsqlite3ErrorMsg(pParse, "ON CONFLICT clause does not match any " "PRIMARY KEY or UNIQUE constraint"); return SQLITE_ERROR; } @@ -141789,7 +141789,7 @@ SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget( ** is not NULL, then pIdx is the constraint that failed and iCur is a ** cursor points to the conflicting row. */ -SQLITE_PRIVATE void sqlite3UpsertDoUpdate( +SQLITE_PRIVATE void tdsqlite3UpsertDoUpdate( Parse *pParse, /* The parsing and code-generating context */ Upsert *pUpsert, /* The ON CONFLICT clause for the upsert */ Table *pTab, /* The table being updated */ @@ -141797,7 +141797,7 @@ SQLITE_PRIVATE void sqlite3UpsertDoUpdate( int iCur /* Cursor for pIdx (or pTab if pIdx==NULL) */ ){ Vdbe *v = pParse->pVdbe; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; SrcList *pSrc; /* FROM clause for the UPDATE */ int iDataCur; int i; @@ -141808,46 +141808,46 @@ SQLITE_PRIVATE void sqlite3UpsertDoUpdate( iDataCur = pUpsert->iDataCur; if( pIdx && iCur!=iDataCur ){ if( HasRowid(pTab) ){ - int regRowid = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp2(v, OP_IdxRowid, iCur, regRowid); - sqlite3VdbeAddOp3(v, OP_SeekRowid, iDataCur, 0, regRowid); + int regRowid = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp2(v, OP_IdxRowid, iCur, regRowid); + tdsqlite3VdbeAddOp3(v, OP_SeekRowid, iDataCur, 0, regRowid); VdbeCoverage(v); - sqlite3ReleaseTempReg(pParse, regRowid); + tdsqlite3ReleaseTempReg(pParse, regRowid); }else{ - Index *pPk = sqlite3PrimaryKeyIndex(pTab); + Index *pPk = tdsqlite3PrimaryKeyIndex(pTab); int nPk = pPk->nKeyCol; int iPk = pParse->nMem+1; pParse->nMem += nPk; for(i=0; iaiColumn[i]>=0 ); - k = sqlite3TableColumnToIndex(pIdx, pPk->aiColumn[i]); - sqlite3VdbeAddOp3(v, OP_Column, iCur, k, iPk+i); + k = tdsqlite3TableColumnToIndex(pIdx, pPk->aiColumn[i]); + tdsqlite3VdbeAddOp3(v, OP_Column, iCur, k, iPk+i); VdbeComment((v, "%s.%s", pIdx->zName, pTab->aCol[pPk->aiColumn[i]].zName)); } - sqlite3VdbeVerifyAbortable(v, OE_Abort); - i = sqlite3VdbeAddOp4Int(v, OP_Found, iDataCur, 0, iPk, nPk); + tdsqlite3VdbeVerifyAbortable(v, OE_Abort); + i = tdsqlite3VdbeAddOp4Int(v, OP_Found, iDataCur, 0, iPk, nPk); VdbeCoverage(v); - sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0, + tdsqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0, "corrupt database", P4_STATIC); - sqlite3MayAbort(pParse); - sqlite3VdbeJumpHere(v, i); + tdsqlite3MayAbort(pParse); + tdsqlite3VdbeJumpHere(v, i); } } /* pUpsert does not own pUpsertSrc - the outer INSERT statement does. So - ** we have to make a copy before passing it down into sqlite3Update() */ - pSrc = sqlite3SrcListDup(db, pUpsert->pUpsertSrc, 0); + ** we have to make a copy before passing it down into tdsqlite3Update() */ + pSrc = tdsqlite3SrcListDup(db, pUpsert->pUpsertSrc, 0); /* excluded.* columns of type REAL need to be converted to a hard real */ for(i=0; inCol; i++){ if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){ - sqlite3VdbeAddOp1(v, OP_RealAffinity, pUpsert->regData+i); + tdsqlite3VdbeAddOp1(v, OP_RealAffinity, pUpsert->regData+i); } } - sqlite3Update(pParse, pSrc, pUpsert->pUpsertSet, + tdsqlite3Update(pParse, pSrc, pUpsert->pUpsertSet, pUpsert->pUpsertWhere, OE_Abort, 0, 0, pUpsert); - pUpsert->pUpsertSet = 0; /* Will have been deleted by sqlite3Update() */ - pUpsert->pUpsertWhere = 0; /* Will have been deleted by sqlite3Update() */ + pUpsert->pUpsertSet = 0; /* Will have been deleted by tdsqlite3Update() */ + pUpsert->pUpsertWhere = 0; /* Will have been deleted by tdsqlite3Update() */ VdbeNoopComment((v, "End DO UPDATE of UPSERT")); } @@ -141886,16 +141886,16 @@ SQLITE_PRIVATE void sqlite3UpsertDoUpdate( ** The execSqlF() routine does the same thing, except it accepts ** a format string as its third argument */ -static int execSql(sqlite3 *db, char **pzErrMsg, const char *zSql){ - sqlite3_stmt *pStmt; +static int execSql(tdsqlite3 *db, char **pzErrMsg, const char *zSql){ + tdsqlite3_stmt *pStmt; int rc; /* printf("SQL: [%s]\n", zSql); fflush(stdout); */ - rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); + rc = tdsqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); if( rc!=SQLITE_OK ) return rc; - while( SQLITE_ROW==(rc = sqlite3_step(pStmt)) ){ - const char *zSubSql = (const char*)sqlite3_column_text(pStmt,0); - assert( sqlite3_strnicmp(zSql,"SELECT",6)==0 ); + while( SQLITE_ROW==(rc = tdsqlite3_step(pStmt)) ){ + const char *zSubSql = (const char*)tdsqlite3_column_text(pStmt,0); + assert( tdsqlite3_strnicmp(zSql,"SELECT",6)==0 ); /* The secondary SQL must be one of CREATE TABLE, CREATE INDEX, ** or INSERT. Historically there have been attacks that first ** corrupt the sqlite_master.sql field with other kinds of statements @@ -141911,21 +141911,21 @@ static int execSql(sqlite3 *db, char **pzErrMsg, const char *zSql){ assert( rc!=SQLITE_ROW ); if( rc==SQLITE_DONE ) rc = SQLITE_OK; if( rc ){ - sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db)); + tdsqlite3SetString(pzErrMsg, db, tdsqlite3_errmsg(db)); } - (void)sqlite3_finalize(pStmt); + (void)tdsqlite3_finalize(pStmt); return rc; } -static int execSqlF(sqlite3 *db, char **pzErrMsg, const char *zSql, ...){ +static int execSqlF(tdsqlite3 *db, char **pzErrMsg, const char *zSql, ...){ char *z; va_list ap; int rc; va_start(ap, zSql); - z = sqlite3VMPrintf(db, zSql, ap); + z = tdsqlite3VMPrintf(db, zSql, ap); va_end(ap); if( z==0 ) return SQLITE_NOMEM; rc = execSql(db, pzErrMsg, z); - sqlite3DbFree(db, z); + tdsqlite3DbFree(db, z); return rc; } @@ -141959,8 +141959,8 @@ static int execSqlF(sqlite3 *db, char **pzErrMsg, const char *zSql, ...){ ** transient would cause the database file to appear to be deleted ** following reboot. */ -SQLITE_PRIVATE void sqlite3Vacuum(Parse *pParse, Token *pNm, Expr *pInto){ - Vdbe *v = sqlite3GetVdbe(pParse); +SQLITE_PRIVATE void tdsqlite3Vacuum(Parse *pParse, Token *pNm, Expr *pInto){ + Vdbe *v = tdsqlite3GetVdbe(pParse); int iDb = 0; if( v==0 ) goto build_vacuum_end; if( pParse->nErr ) goto build_vacuum_end; @@ -141968,7 +141968,7 @@ SQLITE_PRIVATE void sqlite3Vacuum(Parse *pParse, Token *pNm, Expr *pInto){ #ifndef SQLITE_BUG_COMPATIBLE_20160819 /* Default behavior: Report an error if the argument to VACUUM is ** not recognized */ - iDb = sqlite3TwoPartName(pParse, pNm, pNm, &pNm); + iDb = tdsqlite3TwoPartName(pParse, pNm, pNm, &pNm); if( iDb<0 ) goto build_vacuum_end; #else /* When SQLITE_BUG_COMPATIBLE_20160819 is defined, unrecognized arguments @@ -141976,32 +141976,32 @@ SQLITE_PRIVATE void sqlite3Vacuum(Parse *pParse, Token *pNm, Expr *pInto){ ** occurred on 2016-08-19 (https://www.sqlite.org/src/info/083f9e6270). ** The buggy behavior is required for binary compatibility with some ** legacy applications. */ - iDb = sqlite3FindDb(pParse->db, pNm); + iDb = tdsqlite3FindDb(pParse->db, pNm); if( iDb<0 ) iDb = 0; #endif } if( iDb!=1 ){ int iIntoReg = 0; - if( pInto && sqlite3ResolveSelfReference(pParse,0,0,pInto,0)==0 ){ + if( pInto && tdsqlite3ResolveSelfReference(pParse,0,0,pInto,0)==0 ){ iIntoReg = ++pParse->nMem; - sqlite3ExprCode(pParse, pInto, iIntoReg); + tdsqlite3ExprCode(pParse, pInto, iIntoReg); } - sqlite3VdbeAddOp2(v, OP_Vacuum, iDb, iIntoReg); - sqlite3VdbeUsesBtree(v, iDb); + tdsqlite3VdbeAddOp2(v, OP_Vacuum, iDb, iIntoReg); + tdsqlite3VdbeUsesBtree(v, iDb); } build_vacuum_end: - sqlite3ExprDelete(pParse->db, pInto); + tdsqlite3ExprDelete(pParse->db, pInto); return; } /* ** This routine implements the OP_Vacuum opcode of the VDBE. */ -SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum( +SQLITE_PRIVATE SQLITE_NOINLINE int tdsqlite3RunVacuum( char **pzErrMsg, /* Write error message here */ - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ int iDb, /* Which attached DB to vacuum */ - sqlite3_value *pOut /* Write results here, if not NULL. VACUUM INTO */ + tdsqlite3_value *pOut /* Write results here, if not NULL. VACUUM INTO */ ){ int rc = SQLITE_OK; /* Return code from service routines */ Btree *pMain; /* The database being vacuumed */ @@ -142020,20 +142020,20 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum( const char *zOut; /* Name of output file */ if( !db->autoCommit ){ - sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction"); + tdsqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction"); return SQLITE_ERROR; /* IMP: R-12218-18073 */ } if( db->nVdbeActive>1 ){ - sqlite3SetString(pzErrMsg, db,"cannot VACUUM - SQL statements in progress"); + tdsqlite3SetString(pzErrMsg, db,"cannot VACUUM - SQL statements in progress"); return SQLITE_ERROR; /* IMP: R-15610-35227 */ } saved_openFlags = db->openFlags; if( pOut ){ - if( sqlite3_value_type(pOut)!=SQLITE_TEXT ){ - sqlite3SetString(pzErrMsg, db, "non-text filename"); + if( tdsqlite3_value_type(pOut)!=SQLITE_TEXT ){ + tdsqlite3SetString(pzErrMsg, db, "non-text filename"); return SQLITE_ERROR; } - zOut = (const char*)sqlite3_value_text(pOut); + zOut = (const char*)tdsqlite3_value_text(pOut); db->openFlags &= ~SQLITE_OPEN_READONLY; db->openFlags |= SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE; }else{ @@ -142056,13 +142056,13 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum( zDbMain = db->aDb[iDb].zDbSName; pMain = db->aDb[iDb].pBt; - isMemDb = sqlite3PagerIsMemdb(sqlite3BtreePager(pMain)); + isMemDb = tdsqlite3PagerIsMemdb(tdsqlite3BtreePager(pMain)); /* Attach the temporary database as 'vacuum_db'. The synchronous pragma ** can be set to 'off' for this file, as it is not recovered if a crash ** occurs anyway. The integrity of the database is maintained by a ** (possibly synchronous) transaction opened on the main database before - ** sqlite3BtreeCopyFile() is called. + ** tdsqlite3BtreeCopyFile() is called. ** ** An optimisation would be to use a non-journaled pager. ** (Later:) I tried setting "PRAGMA vacuum_db.journal_mode=OFF" but @@ -142081,49 +142081,49 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum( assert( strcmp(pDb->zDbSName,"vacuum_db")==0 ); pTemp = pDb->pBt; if( pOut ){ - sqlite3_file *id = sqlite3PagerFile(sqlite3BtreePager(pTemp)); + tdsqlite3_file *id = tdsqlite3PagerFile(tdsqlite3BtreePager(pTemp)); i64 sz = 0; - if( id->pMethods!=0 && (sqlite3OsFileSize(id, &sz)!=SQLITE_OK || sz>0) ){ + if( id->pMethods!=0 && (tdsqlite3OsFileSize(id, &sz)!=SQLITE_OK || sz>0) ){ rc = SQLITE_ERROR; - sqlite3SetString(pzErrMsg, db, "output file already exists"); + tdsqlite3SetString(pzErrMsg, db, "output file already exists"); goto end_of_vacuum; } db->mDbFlags |= DBFLAG_VacuumInto; } - nRes = sqlite3BtreeGetOptimalReserve(pMain); + nRes = tdsqlite3BtreeGetOptimalReserve(pMain); /* A VACUUM cannot change the pagesize of an encrypted database. */ #ifdef SQLITE_HAS_CODEC if( db->nextPagesize ){ - extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*); + extern void tdsqlite3CodecGetKey(tdsqlite3*, int, void**, int*); int nKey; char *zKey; - sqlite3CodecGetKey(db, iDb, (void**)&zKey, &nKey); + tdsqlite3CodecGetKey(db, iDb, (void**)&zKey, &nKey); if( nKey ) db->nextPagesize = 0; } #endif - sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size); - sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0)); - sqlite3BtreeSetPagerFlags(pTemp, PAGER_SYNCHRONOUS_OFF|PAGER_CACHESPILL); + tdsqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size); + tdsqlite3BtreeSetSpillSize(pTemp, tdsqlite3BtreeSetSpillSize(pMain,0)); + tdsqlite3BtreeSetPagerFlags(pTemp, PAGER_SYNCHRONOUS_OFF|PAGER_CACHESPILL); /* Begin a transaction and take an exclusive lock on the main database - ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, + ** file. This is done before the tdsqlite3BtreeGetPageSize(pMain) call below, ** to ensure that we do not try to change the page-size on a WAL database. */ rc = execSql(db, pzErrMsg, "BEGIN"); if( rc!=SQLITE_OK ) goto end_of_vacuum; - rc = sqlite3BtreeBeginTrans(pMain, pOut==0 ? 2 : 0, 0); + rc = tdsqlite3BtreeBeginTrans(pMain, pOut==0 ? 2 : 0, 0); if( rc!=SQLITE_OK ) goto end_of_vacuum; /* Do not attempt to change the page size for a WAL database */ - if( sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain)) + if( tdsqlite3PagerGetJournalMode(tdsqlite3BtreePager(pMain)) ==PAGER_JOURNALMODE_WAL ){ db->nextPagesize = 0; } - if( sqlite3BtreeSetPageSize(pTemp, sqlite3BtreeGetPageSize(pMain), nRes, 0) - || (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0)) + if( tdsqlite3BtreeSetPageSize(pTemp, tdsqlite3BtreeGetPageSize(pMain), nRes, 0) + || (!isMemDb && tdsqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0)) || NEVER(db->mallocFailed) ){ rc = SQLITE_NOMEM_BKPT; @@ -142131,8 +142131,8 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum( } #ifndef SQLITE_OMIT_AUTOVACUUM - sqlite3BtreeSetAutoVacuum(pTemp, db->nextAutovac>=0 ? db->nextAutovac : - sqlite3BtreeGetAutoVacuum(pMain)); + tdsqlite3BtreeSetAutoVacuum(pTemp, db->nextAutovac>=0 ? db->nextAutovac : + tdsqlite3BtreeGetAutoVacuum(pMain)); #endif /* Query the schema of the main database. Create a mirror schema @@ -142186,8 +142186,8 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum( /* At this point, there is a write transaction open on both the ** vacuum database and the main database. Assuming no error occurs, ** both transactions are closed by this block - the main database - ** transaction by sqlite3BtreeCopyFile() and the other by an explicit - ** call to sqlite3BtreeCommit(). + ** transaction by tdsqlite3BtreeCopyFile() and the other by an explicit + ** call to tdsqlite3BtreeCommit(). */ { u32 meta; @@ -142207,34 +142207,34 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum( BTREE_APPLICATION_ID, 0, /* Preserve the application id */ }; - assert( 1==sqlite3BtreeIsInTrans(pTemp) ); - assert( pOut!=0 || 1==sqlite3BtreeIsInTrans(pMain) ); + assert( 1==tdsqlite3BtreeIsInTrans(pTemp) ); + assert( pOut!=0 || 1==tdsqlite3BtreeIsInTrans(pMain) ); /* Copy Btree meta values */ for(i=0; inChange = saved_nChange; db->nTotalChange = saved_nTotalChange; db->mTrace = saved_mTrace; - sqlite3BtreeSetPageSize(pMain, -1, -1, 1); + tdsqlite3BtreeSetPageSize(pMain, -1, -1, 1); /* Currently there is an SQL level transaction open on the vacuum ** database. No locks are held on any other files (since the main file @@ -142257,14 +142257,14 @@ end_of_vacuum: db->autoCommit = 1; if( pDb ){ - sqlite3BtreeClose(pDb->pBt); + tdsqlite3BtreeClose(pDb->pBt); pDb->pBt = 0; pDb->pSchema = 0; } /* This both clears the schemas and reduces the size of the db->aDb[] ** array. */ - sqlite3ResetAllSchemasOfConnection(db); + tdsqlite3ResetAllSchemasOfConnection(db); return rc; } @@ -142293,14 +142293,14 @@ end_of_vacuum: ** Before a virtual table xCreate() or xConnect() method is invoked, the ** sqlite3.pVtabCtx member variable is set to point to an instance of ** this struct allocated on the stack. It is used by the implementation of -** the sqlite3_declare_vtab() and sqlite3_vtab_config() APIs, both of which +** the tdsqlite3_declare_vtab() and tdsqlite3_vtab_config() APIs, both of which ** are invoked only from within xCreate and xConnect methods. */ struct VtabCtx { VTable *pVTable; /* The virtual table being constructed */ Table *pTab; /* The Table object to which the virtual table belongs */ VtabCtx *pPrior; /* Parent context (if any) */ - int bDeclared; /* True after sqlite3_declare_vtab() is called */ + int bDeclared; /* True after tdsqlite3_declare_vtab() is called */ }; /* @@ -142311,10 +142311,10 @@ struct VtabCtx { ** If there already exists a module with zName, replace it with the new one. ** If pModule==0, then delete the module zName if it exists. */ -SQLITE_PRIVATE Module *sqlite3VtabCreateModule( - sqlite3 *db, /* Database in which module is registered */ +SQLITE_PRIVATE Module *tdsqlite3VtabCreateModule( + tdsqlite3 *db, /* Database in which module is registered */ const char *zName, /* Name assigned to this module */ - const sqlite3_module *pModule, /* The definition of the module */ + const tdsqlite3_module *pModule, /* The definition of the module */ void *pAux, /* Context pointer for xCreate/xConnect */ void (*xDestroy)(void *) /* Module destructor function */ ){ @@ -142325,10 +142325,10 @@ SQLITE_PRIVATE Module *sqlite3VtabCreateModule( zCopy = (char*)zName; pMod = 0; }else{ - int nName = sqlite3Strlen30(zName); - pMod = (Module *)sqlite3Malloc(sizeof(Module) + nName + 1); + int nName = tdsqlite3Strlen30(zName); + pMod = (Module *)tdsqlite3Malloc(sizeof(Module) + nName + 1); if( pMod==0 ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); return 0; } zCopy = (char *)(&pMod[1]); @@ -142340,15 +142340,15 @@ SQLITE_PRIVATE Module *sqlite3VtabCreateModule( pMod->pEpoTab = 0; pMod->nRefModule = 1; } - pDel = (Module *)sqlite3HashInsert(&db->aModule,zCopy,(void*)pMod); + pDel = (Module *)tdsqlite3HashInsert(&db->aModule,zCopy,(void*)pMod); if( pDel ){ if( pDel==pMod ){ - sqlite3OomFault(db); - sqlite3DbFree(db, pDel); + tdsqlite3OomFault(db); + tdsqlite3DbFree(db, pDel); pMod = 0; }else{ - sqlite3VtabEponymousTableClear(db, pDel); - sqlite3VtabModuleUnref(db, pDel); + tdsqlite3VtabEponymousTableClear(db, pDel); + tdsqlite3VtabModuleUnref(db, pDel); } } return pMod; @@ -142356,23 +142356,23 @@ SQLITE_PRIVATE Module *sqlite3VtabCreateModule( /* ** The actual function that does the work of creating a new module. -** This function implements the sqlite3_create_module() and -** sqlite3_create_module_v2() interfaces. +** This function implements the tdsqlite3_create_module() and +** tdsqlite3_create_module_v2() interfaces. */ static int createModule( - sqlite3 *db, /* Database in which module is registered */ + tdsqlite3 *db, /* Database in which module is registered */ const char *zName, /* Name assigned to this module */ - const sqlite3_module *pModule, /* The definition of the module */ + const tdsqlite3_module *pModule, /* The definition of the module */ void *pAux, /* Context pointer for xCreate/xConnect */ void (*xDestroy)(void *) /* Module destructor function */ ){ int rc = SQLITE_OK; - sqlite3_mutex_enter(db->mutex); - (void)sqlite3VtabCreateModule(db, zName, pModule, pAux, xDestroy); - rc = sqlite3ApiExit(db, rc); + tdsqlite3_mutex_enter(db->mutex); + (void)tdsqlite3VtabCreateModule(db, zName, pModule, pAux, xDestroy); + rc = tdsqlite3ApiExit(db, rc); if( rc!=SQLITE_OK && xDestroy ) xDestroy(pAux); - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return rc; } @@ -142380,14 +142380,14 @@ static int createModule( /* ** External API function used to create a new virtual-table module. */ -SQLITE_API int sqlite3_create_module( - sqlite3 *db, /* Database in which module is registered */ +SQLITE_API int tdsqlite3_create_module( + tdsqlite3 *db, /* Database in which module is registered */ const char *zName, /* Name assigned to this module */ - const sqlite3_module *pModule, /* The definition of the module */ + const tdsqlite3_module *pModule, /* The definition of the module */ void *pAux /* Context pointer for xCreate/xConnect */ ){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT; #endif return createModule(db, zName, pModule, pAux, 0); } @@ -142395,15 +142395,15 @@ SQLITE_API int sqlite3_create_module( /* ** External API function used to create a new virtual-table module. */ -SQLITE_API int sqlite3_create_module_v2( - sqlite3 *db, /* Database in which module is registered */ +SQLITE_API int tdsqlite3_create_module_v2( + tdsqlite3 *db, /* Database in which module is registered */ const char *zName, /* Name assigned to this module */ - const sqlite3_module *pModule, /* The definition of the module */ + const tdsqlite3_module *pModule, /* The definition of the module */ void *pAux, /* Context pointer for xCreate/xConnect */ void (*xDestroy)(void *) /* Module destructor function */ ){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT; #endif return createModule(db, zName, pModule, pAux, xDestroy); } @@ -142412,10 +142412,10 @@ SQLITE_API int sqlite3_create_module_v2( ** External API to drop all virtual-table modules, except those named ** on the azNames list. */ -SQLITE_API int sqlite3_drop_modules(sqlite3 *db, const char** azNames){ +SQLITE_API int tdsqlite3_drop_modules(tdsqlite3 *db, const char** azNames){ HashElem *pThis, *pNext; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif for(pThis=sqliteHashFirst(&db->aModule); pThis; pThis=pNext){ Module *pMod = (Module*)sqliteHashData(pThis); @@ -142434,7 +142434,7 @@ SQLITE_API int sqlite3_drop_modules(sqlite3 *db, const char** azNames){ ** Decrement the reference count on a Module object. Destroy the ** module when the reference count reaches zero. */ -SQLITE_PRIVATE void sqlite3VtabModuleUnref(sqlite3 *db, Module *pMod){ +SQLITE_PRIVATE void tdsqlite3VtabModuleUnref(tdsqlite3 *db, Module *pMod){ assert( pMod->nRefModule>0 ); pMod->nRefModule--; if( pMod->nRefModule==0 ){ @@ -142442,7 +142442,7 @@ SQLITE_PRIVATE void sqlite3VtabModuleUnref(sqlite3 *db, Module *pMod){ pMod->xDestroy(pMod->pAux); } assert( pMod->pEpoTab==0 ); - sqlite3DbFree(db, pMod); + tdsqlite3DbFree(db, pMod); } } @@ -142454,7 +142454,7 @@ SQLITE_PRIVATE void sqlite3VtabModuleUnref(sqlite3 *db, Module *pMod){ ** If a disconnect is attempted while a virtual table is locked, ** the disconnect is deferred until all locks have been removed. */ -SQLITE_PRIVATE void sqlite3VtabLock(VTable *pVTab){ +SQLITE_PRIVATE void tdsqlite3VtabLock(VTable *pVTab){ pVTab->nRef++; } @@ -142464,7 +142464,7 @@ SQLITE_PRIVATE void sqlite3VtabLock(VTable *pVTab){ ** Return a pointer to the VTable object used by connection db to access ** this virtual-table, if one has been created, or NULL otherwise. */ -SQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3 *db, Table *pTab){ +SQLITE_PRIVATE VTable *tdsqlite3GetVTable(tdsqlite3 *db, Table *pTab){ VTable *pVtab; assert( IsVirtual(pTab) ); for(pVtab=pTab->pVTable; pVtab && pVtab->db!=db; pVtab=pVtab->pNext); @@ -142475,8 +142475,8 @@ SQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3 *db, Table *pTab){ ** Decrement the ref-count on a virtual table object. When the ref-count ** reaches zero, call the xDisconnect() method to delete the object. */ -SQLITE_PRIVATE void sqlite3VtabUnlock(VTable *pVTab){ - sqlite3 *db = pVTab->db; +SQLITE_PRIVATE void tdsqlite3VtabUnlock(VTable *pVTab){ + tdsqlite3 *db = pVTab->db; assert( db ); assert( pVTab->nRef>0 ); @@ -142484,12 +142484,12 @@ SQLITE_PRIVATE void sqlite3VtabUnlock(VTable *pVTab){ pVTab->nRef--; if( pVTab->nRef==0 ){ - sqlite3_vtab *p = pVTab->pVtab; - sqlite3VtabModuleUnref(pVTab->db, pVTab->pMod); + tdsqlite3_vtab *p = pVTab->pVtab; + tdsqlite3VtabModuleUnref(pVTab->db, pVTab->pMod); if( p ){ p->pModule->xDisconnect(p); } - sqlite3DbFree(db, pVTab); + tdsqlite3DbFree(db, pVTab); } } @@ -142500,21 +142500,21 @@ SQLITE_PRIVATE void sqlite3VtabUnlock(VTable *pVTab){ ** Except, if argument db is not NULL, then the entry associated with ** connection db is left in the p->pVTable list. */ -static VTable *vtabDisconnectAll(sqlite3 *db, Table *p){ +static VTable *vtabDisconnectAll(tdsqlite3 *db, Table *p){ VTable *pRet = 0; VTable *pVTable = p->pVTable; p->pVTable = 0; /* Assert that the mutex (if any) associated with the BtShared database ** that contains table p is held by the caller. See header comments - ** above function sqlite3VtabUnlockList() for an explanation of why + ** above function tdsqlite3VtabUnlockList() for an explanation of why ** this makes it safe to access the sqlite3.pDisconnect list of any ** database connection that may have an entry in the p->pVTable list. */ - assert( db==0 || sqlite3SchemaMutexHeld(db, 0, p->pSchema) ); + assert( db==0 || tdsqlite3SchemaMutexHeld(db, 0, p->pSchema) ); while( pVTable ){ - sqlite3 *db2 = pVTable->db; + tdsqlite3 *db2 = pVTable->db; VTable *pNext = pVTable->pNext; assert( db2 ); if( db2==db ){ @@ -142540,18 +142540,18 @@ static VTable *vtabDisconnectAll(sqlite3 *db, Table *p){ ** objects without disturbing the rest of the Schema object (which may ** be being used by other shared-cache connections). */ -SQLITE_PRIVATE void sqlite3VtabDisconnect(sqlite3 *db, Table *p){ +SQLITE_PRIVATE void tdsqlite3VtabDisconnect(tdsqlite3 *db, Table *p){ VTable **ppVTab; assert( IsVirtual(p) ); - assert( sqlite3BtreeHoldsAllMutexes(db) ); - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3BtreeHoldsAllMutexes(db) ); + assert( tdsqlite3_mutex_held(db->mutex) ); for(ppVTab=&p->pVTable; *ppVTab; ppVTab=&(*ppVTab)->pNext){ if( (*ppVTab)->db==db ){ VTable *pVTab = *ppVTab; *ppVTab = pVTab->pNext; - sqlite3VtabUnlock(pVTab); + tdsqlite3VtabUnlock(pVTab); break; } } @@ -142578,18 +142578,18 @@ SQLITE_PRIVATE void sqlite3VtabDisconnect(sqlite3 *db, Table *p){ ** As a result, a sqlite3.pDisconnect cannot be accessed simultaneously ** by multiple threads. It is thread-safe. */ -SQLITE_PRIVATE void sqlite3VtabUnlockList(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3VtabUnlockList(tdsqlite3 *db){ VTable *p = db->pDisconnect; - assert( sqlite3BtreeHoldsAllMutexes(db) ); - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3BtreeHoldsAllMutexes(db) ); + assert( tdsqlite3_mutex_held(db->mutex) ); if( p ){ db->pDisconnect = 0; - sqlite3ExpirePreparedStatements(db, 0); + tdsqlite3ExpirePreparedStatements(db, 0); do { VTable *pNext = p->pNext; - sqlite3VtabUnlock(p); + tdsqlite3VtabUnlock(p); p = pNext; }while( p ); } @@ -142602,21 +142602,21 @@ SQLITE_PRIVATE void sqlite3VtabUnlockList(sqlite3 *db){ ** ** Since it is a virtual-table, the Table structure contains a pointer ** to the head of a linked list of VTable structures. Each VTable -** structure is associated with a single sqlite3* user of the schema. +** structure is associated with a single tdsqlite3* user of the schema. ** The reference count of the VTable structure associated with database ** connection db is decremented immediately (which may lead to the ** structure being xDisconnected and free). Any other VTable structures ** in the list are moved to the sqlite3.pDisconnect list of the associated ** database connection. */ -SQLITE_PRIVATE void sqlite3VtabClear(sqlite3 *db, Table *p){ +SQLITE_PRIVATE void tdsqlite3VtabClear(tdsqlite3 *db, Table *p){ if( !db || db->pnBytesFreed==0 ) vtabDisconnectAll(0, p); if( p->azModuleArg ){ int i; for(i=0; inModuleArg; i++){ - if( i!=1 ) sqlite3DbFree(db, p->azModuleArg[i]); + if( i!=1 ) tdsqlite3DbFree(db, p->azModuleArg[i]); } - sqlite3DbFree(db, p->azModuleArg); + tdsqlite3DbFree(db, p->azModuleArg); } } @@ -142627,15 +142627,15 @@ SQLITE_PRIVATE void sqlite3VtabClear(sqlite3 *db, Table *p){ ** deleted. */ static void addModuleArgument(Parse *pParse, Table *pTable, char *zArg){ - sqlite3_int64 nBytes = sizeof(char *)*(2+pTable->nModuleArg); + tdsqlite3_int64 nBytes = sizeof(char *)*(2+pTable->nModuleArg); char **azModuleArg; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; if( pTable->nModuleArg+3>=db->aLimit[SQLITE_LIMIT_COLUMN] ){ - sqlite3ErrorMsg(pParse, "too many columns on %s", pTable->zName); + tdsqlite3ErrorMsg(pParse, "too many columns on %s", pTable->zName); } - azModuleArg = sqlite3DbRealloc(db, pTable->azModuleArg, nBytes); + azModuleArg = tdsqlite3DbRealloc(db, pTable->azModuleArg, nBytes); if( azModuleArg==0 ){ - sqlite3DbFree(db, zArg); + tdsqlite3DbFree(db, zArg); }else{ int i = pTable->nModuleArg++; azModuleArg[i] = zArg; @@ -142649,7 +142649,7 @@ static void addModuleArgument(Parse *pParse, Table *pTable, char *zArg){ ** statement. The module name has been parsed, but the optional list ** of parameters that follow the module name are still pending. */ -SQLITE_PRIVATE void sqlite3VtabBeginParse( +SQLITE_PRIVATE void tdsqlite3VtabBeginParse( Parse *pParse, /* Parsing context */ Token *pName1, /* Name of new table, or database name */ Token *pName2, /* Name of new table or NULL */ @@ -142657,9 +142657,9 @@ SQLITE_PRIVATE void sqlite3VtabBeginParse( int ifNotExists /* No error if the table already exists */ ){ Table *pTable; /* The new virtual table */ - sqlite3 *db; /* Database connection */ + tdsqlite3 *db; /* Database connection */ - sqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, ifNotExists); + tdsqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, ifNotExists); pTable = pParse->pNewTable; if( pTable==0 ) return; assert( 0==pTable->pIndex ); @@ -142667,9 +142667,9 @@ SQLITE_PRIVATE void sqlite3VtabBeginParse( db = pParse->db; assert( pTable->nModuleArg==0 ); - addModuleArgument(pParse, pTable, sqlite3NameFromToken(db, pModuleName)); + addModuleArgument(pParse, pTable, tdsqlite3NameFromToken(db, pModuleName)); addModuleArgument(pParse, pTable, 0); - addModuleArgument(pParse, pTable, sqlite3DbStrDup(db, pTable->zName)); + addModuleArgument(pParse, pTable, tdsqlite3DbStrDup(db, pTable->zName)); assert( (pParse->sNameToken.z==pName2->z && pName2->z!=0) || (pParse->sNameToken.z==pName1->z && pName2->z==0) ); @@ -142680,13 +142680,13 @@ SQLITE_PRIVATE void sqlite3VtabBeginParse( #ifndef SQLITE_OMIT_AUTHORIZATION /* Creating a virtual table invokes the authorization callback twice. ** The first invocation, to obtain permission to INSERT a row into the - ** sqlite_master table, has already been made by sqlite3StartTable(). + ** sqlite_master table, has already been made by tdsqlite3StartTable(). ** The second call, to obtain permission to create the table, is made now. */ if( pTable->azModuleArg ){ - int iDb = sqlite3SchemaToIndex(db, pTable->pSchema); + int iDb = tdsqlite3SchemaToIndex(db, pTable->pSchema); assert( iDb>=0 ); /* The database the table is being created in */ - sqlite3AuthCheck(pParse, SQLITE_CREATE_VTABLE, pTable->zName, + tdsqlite3AuthCheck(pParse, SQLITE_CREATE_VTABLE, pTable->zName, pTable->azModuleArg[0], pParse->db->aDb[iDb].zDbSName); } #endif @@ -142701,8 +142701,8 @@ static void addArgumentToVtab(Parse *pParse){ if( pParse->sArg.z && pParse->pNewTable ){ const char *z = (const char*)pParse->sArg.z; int n = pParse->sArg.n; - sqlite3 *db = pParse->db; - addModuleArgument(pParse, pParse->pNewTable, sqlite3DbStrNDup(db, z, n)); + tdsqlite3 *db = pParse->db; + addModuleArgument(pParse, pParse->pNewTable, tdsqlite3DbStrNDup(db, z, n)); } } @@ -142710,9 +142710,9 @@ static void addArgumentToVtab(Parse *pParse){ ** The parser calls this routine after the CREATE VIRTUAL TABLE statement ** has been completely parsed. */ -SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ +SQLITE_PRIVATE void tdsqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ Table *pTab = pParse->pNewTable; /* The table being constructed */ - sqlite3 *db = pParse->db; /* The database connection */ + tdsqlite3 *db = pParse->db; /* The database connection */ if( pTab==0 ) return; addArgumentToVtab(pParse); @@ -142732,13 +142732,13 @@ SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ int iReg; Vdbe *v; - sqlite3MayAbort(pParse); + tdsqlite3MayAbort(pParse); /* Compute the complete text of the CREATE VIRTUAL TABLE statement */ if( pEnd ){ pParse->sNameToken.n = (int)(pEnd->z - pParse->sNameToken.z) + pEnd->n; } - zStmt = sqlite3MPrintf(db, "CREATE VIRTUAL TABLE %T", &pParse->sNameToken); + zStmt = tdsqlite3MPrintf(db, "CREATE VIRTUAL TABLE %T", &pParse->sNameToken); /* A slot for the record has already been allocated in the ** SQLITE_MASTER table. We just need to update that slot with all @@ -142746,10 +142746,10 @@ SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ ** ** The VM register number pParse->regRowid holds the rowid of an ** entry in the sqlite_master table tht was created for this vtab - ** by sqlite3StartTable(). + ** by tdsqlite3StartTable(). */ - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - sqlite3NestedParse(pParse, + iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); + tdsqlite3NestedParse(pParse, "UPDATE %Q.%s " "SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q " "WHERE rowid=#%d", @@ -142759,17 +142759,17 @@ SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ zStmt, pParse->regRowid ); - v = sqlite3GetVdbe(pParse); - sqlite3ChangeCookie(pParse, iDb); + v = tdsqlite3GetVdbe(pParse); + tdsqlite3ChangeCookie(pParse, iDb); - sqlite3VdbeAddOp0(v, OP_Expire); - zWhere = sqlite3MPrintf(db, "name=%Q AND sql=%Q", pTab->zName, zStmt); - sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere); - sqlite3DbFree(db, zStmt); + tdsqlite3VdbeAddOp0(v, OP_Expire); + zWhere = tdsqlite3MPrintf(db, "name=%Q AND sql=%Q", pTab->zName, zStmt); + tdsqlite3VdbeAddParseSchemaOp(v, iDb, zWhere); + tdsqlite3DbFree(db, zStmt); iReg = ++pParse->nMem; - sqlite3VdbeLoadString(v, iReg, pTab->zName); - sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg); + tdsqlite3VdbeLoadString(v, iReg, pTab->zName); + tdsqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg); } /* If we are rereading the sqlite_master table create the in-memory @@ -142781,10 +142781,10 @@ SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ Table *pOld; Schema *pSchema = pTab->pSchema; const char *zName = pTab->zName; - assert( sqlite3SchemaMutexHeld(db, 0, pSchema) ); - pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab); + assert( tdsqlite3SchemaMutexHeld(db, 0, pSchema) ); + pOld = tdsqlite3HashInsert(&pSchema->tblHash, zName, pTab); if( pOld ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); assert( pTab==pOld ); /* Malloc must have failed inside HashInsert() */ return; } @@ -142796,7 +142796,7 @@ SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ ** The parser calls this routine when it sees the first token ** of an argument to the module name in a CREATE VIRTUAL TABLE statement. */ -SQLITE_PRIVATE void sqlite3VtabArgInit(Parse *pParse){ +SQLITE_PRIVATE void tdsqlite3VtabArgInit(Parse *pParse){ addArgumentToVtab(pParse); pParse->sArg.z = 0; pParse->sArg.n = 0; @@ -142806,7 +142806,7 @@ SQLITE_PRIVATE void sqlite3VtabArgInit(Parse *pParse){ ** The parser calls this routine for each token after the first token ** in an argument to the module name in a CREATE VIRTUAL TABLE statement. */ -SQLITE_PRIVATE void sqlite3VtabArgExtend(Parse *pParse, Token *p){ +SQLITE_PRIVATE void tdsqlite3VtabArgExtend(Parse *pParse, Token *p){ Token *pArg = &pParse->sArg; if( pArg->z==0 ){ pArg->z = p->z; @@ -142823,10 +142823,10 @@ SQLITE_PRIVATE void sqlite3VtabArgExtend(Parse *pParse, Token *p){ ** to this procedure. */ static int vtabCallConstructor( - sqlite3 *db, + tdsqlite3 *db, Table *pTab, Module *pMod, - int (*xConstruct)(sqlite3*,void*,int,const char*const*,sqlite3_vtab**,char**), + int (*xConstruct)(tdsqlite3*,void*,int,const char*const*,tdsqlite3_vtab**,char**), char **pzErr ){ VtabCtx sCtx; @@ -142842,29 +142842,29 @@ static int vtabCallConstructor( /* Check that the virtual-table is not already being initialized */ for(pCtx=db->pVtabCtx; pCtx; pCtx=pCtx->pPrior){ if( pCtx->pTab==pTab ){ - *pzErr = sqlite3MPrintf(db, + *pzErr = tdsqlite3MPrintf(db, "vtable constructor called recursively: %s", pTab->zName ); return SQLITE_LOCKED; } } - zModuleName = sqlite3DbStrDup(db, pTab->zName); + zModuleName = tdsqlite3DbStrDup(db, pTab->zName); if( !zModuleName ){ return SQLITE_NOMEM_BKPT; } - pVTable = sqlite3MallocZero(sizeof(VTable)); + pVTable = tdsqlite3MallocZero(sizeof(VTable)); if( !pVTable ){ - sqlite3OomFault(db); - sqlite3DbFree(db, zModuleName); + tdsqlite3OomFault(db); + tdsqlite3DbFree(db, zModuleName); return SQLITE_NOMEM_BKPT; } pVTable->db = db; pVTable->pMod = pMod; pVTable->eVtabRisk = SQLITE_VTABRISK_Normal; - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); + iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); pTab->azModuleArg[1] = db->aDb[iDb].zDbSName; /* Invoke the virtual table constructor */ @@ -142877,28 +142877,28 @@ static int vtabCallConstructor( db->pVtabCtx = &sCtx; rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr); db->pVtabCtx = sCtx.pPrior; - if( rc==SQLITE_NOMEM ) sqlite3OomFault(db); + if( rc==SQLITE_NOMEM ) tdsqlite3OomFault(db); assert( sCtx.pTab==pTab ); if( SQLITE_OK!=rc ){ if( zErr==0 ){ - *pzErr = sqlite3MPrintf(db, "vtable constructor failed: %s", zModuleName); + *pzErr = tdsqlite3MPrintf(db, "vtable constructor failed: %s", zModuleName); }else { - *pzErr = sqlite3MPrintf(db, "%s", zErr); - sqlite3_free(zErr); + *pzErr = tdsqlite3MPrintf(db, "%s", zErr); + tdsqlite3_free(zErr); } - sqlite3DbFree(db, pVTable); + tdsqlite3DbFree(db, pVTable); }else if( ALWAYS(pVTable->pVtab) ){ /* Justification of ALWAYS(): A correct vtab constructor must allocate - ** the sqlite3_vtab object if successful. */ + ** the tdsqlite3_vtab object if successful. */ memset(pVTable->pVtab, 0, sizeof(pVTable->pVtab[0])); pVTable->pVtab->pModule = pMod->pModule; pMod->nRefModule++; pVTable->nRef = 1; if( sCtx.bDeclared==0 ){ const char *zFormat = "vtable constructor did not declare schema: %s"; - *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName); - sqlite3VtabUnlock(pVTable); + *pzErr = tdsqlite3MPrintf(db, zFormat, pTab->zName); + tdsqlite3VtabUnlock(pVTable); rc = SQLITE_ERROR; }else{ int iCol; @@ -142912,12 +142912,12 @@ static int vtabCallConstructor( pTab->pVTable = pVTable; for(iCol=0; iColnCol; iCol++){ - char *zType = sqlite3ColumnType(&pTab->aCol[iCol], ""); + char *zType = tdsqlite3ColumnType(&pTab->aCol[iCol], ""); int nType; int i = 0; - nType = sqlite3Strlen30(zType); + nType = tdsqlite3Strlen30(zType); for(i=0; idb; +SQLITE_PRIVATE int tdsqlite3VtabCallConnect(Parse *pParse, Table *pTab){ + tdsqlite3 *db = pParse->db; const char *zMod; Module *pMod; int rc; assert( pTab ); - if( !IsVirtual(pTab) || sqlite3GetVTable(db, pTab) ){ + if( !IsVirtual(pTab) || tdsqlite3GetVTable(db, pTab) ){ return SQLITE_OK; } /* Locate the required virtual table module */ zMod = pTab->azModuleArg[0]; - pMod = (Module*)sqlite3HashFind(&db->aModule, zMod); + pMod = (Module*)tdsqlite3HashFind(&db->aModule, zMod); if( !pMod ){ const char *zModule = pTab->azModuleArg[0]; - sqlite3ErrorMsg(pParse, "no such module: %s", zModule); + tdsqlite3ErrorMsg(pParse, "no such module: %s", zModule); rc = SQLITE_ERROR; }else{ char *zErr = 0; rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr); if( rc!=SQLITE_OK ){ - sqlite3ErrorMsg(pParse, "%s", zErr); + tdsqlite3ErrorMsg(pParse, "%s", zErr); pParse->rc = rc; } - sqlite3DbFree(db, zErr); + tdsqlite3DbFree(db, zErr); } return rc; @@ -142989,19 +142989,19 @@ SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse *pParse, Table *pTab){ ** Grow the db->aVTrans[] array so that there is room for at least one ** more v-table. Return SQLITE_NOMEM if a malloc fails, or SQLITE_OK otherwise. */ -static int growVTrans(sqlite3 *db){ +static int growVTrans(tdsqlite3 *db){ const int ARRAY_INCR = 5; /* Grow the sqlite3.aVTrans array if required */ if( (db->nVTrans%ARRAY_INCR)==0 ){ VTable **aVTrans; - sqlite3_int64 nBytes = sizeof(sqlite3_vtab*)* - ((sqlite3_int64)db->nVTrans + ARRAY_INCR); - aVTrans = sqlite3DbRealloc(db, (void *)db->aVTrans, nBytes); + tdsqlite3_int64 nBytes = sizeof(tdsqlite3_vtab*)* + ((tdsqlite3_int64)db->nVTrans + ARRAY_INCR); + aVTrans = tdsqlite3DbRealloc(db, (void *)db->aVTrans, nBytes); if( !aVTrans ){ return SQLITE_NOMEM_BKPT; } - memset(&aVTrans[db->nVTrans], 0, sizeof(sqlite3_vtab *)*ARRAY_INCR); + memset(&aVTrans[db->nVTrans], 0, sizeof(tdsqlite3_vtab *)*ARRAY_INCR); db->aVTrans = aVTrans; } @@ -143012,10 +143012,10 @@ static int growVTrans(sqlite3 *db){ ** Add the virtual table pVTab to the array sqlite3.aVTrans[]. Space should ** have already been reserved using growVTrans(). */ -static void addToVTrans(sqlite3 *db, VTable *pVTab){ +static void addToVTrans(tdsqlite3 *db, VTable *pVTab){ /* Add pVtab to the end of sqlite3.aVTrans */ db->aVTrans[db->nVTrans++] = pVTab; - sqlite3VtabLock(pVTab); + tdsqlite3VtabLock(pVTab); } /* @@ -143024,38 +143024,38 @@ static void addToVTrans(sqlite3 *db, VTable *pVTab){ ** ** If an error occurs, *pzErr is set to point to an English language ** description of the error and an SQLITE_XXX error code is returned. -** In this case the caller must call sqlite3DbFree(db, ) on *pzErr. +** In this case the caller must call tdsqlite3DbFree(db, ) on *pzErr. */ -SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, char **pzErr){ +SQLITE_PRIVATE int tdsqlite3VtabCallCreate(tdsqlite3 *db, int iDb, const char *zTab, char **pzErr){ int rc = SQLITE_OK; Table *pTab; Module *pMod; const char *zMod; - pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zDbSName); + pTab = tdsqlite3FindTable(db, zTab, db->aDb[iDb].zDbSName); assert( pTab && IsVirtual(pTab) && !pTab->pVTable ); /* Locate the required virtual table module */ zMod = pTab->azModuleArg[0]; - pMod = (Module*)sqlite3HashFind(&db->aModule, zMod); + pMod = (Module*)tdsqlite3HashFind(&db->aModule, zMod); /* If the module has been registered and includes a Create method, ** invoke it now. If the module has not been registered, return an ** error. Otherwise, do nothing. */ if( pMod==0 || pMod->pModule->xCreate==0 || pMod->pModule->xDestroy==0 ){ - *pzErr = sqlite3MPrintf(db, "no such module: %s", zMod); + *pzErr = tdsqlite3MPrintf(db, "no such module: %s", zMod); rc = SQLITE_ERROR; }else{ rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xCreate, pzErr); } /* Justification of ALWAYS(): The xConstructor method is required to - ** create a valid sqlite3_vtab if it returns SQLITE_OK. */ - if( rc==SQLITE_OK && ALWAYS(sqlite3GetVTable(db, pTab)) ){ + ** create a valid tdsqlite3_vtab if it returns SQLITE_OK. */ + if( rc==SQLITE_OK && ALWAYS(tdsqlite3GetVTable(db, pTab)) ){ rc = growVTrans(db); if( rc==SQLITE_OK ){ - addToVTrans(db, sqlite3GetVTable(db, pTab)); + addToVTrans(db, tdsqlite3GetVTable(db, pTab)); } } @@ -143067,7 +143067,7 @@ SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, ** valid to call this function from within the xCreate() or xConnect() of a ** virtual table module. */ -SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ +SQLITE_API int tdsqlite3_declare_vtab(tdsqlite3 *db, const char *zCreateTable){ VtabCtx *pCtx; int rc = SQLITE_OK; Table *pTab; @@ -143075,15 +143075,15 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ Parse sParse; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || zCreateTable==0 ){ + if( !tdsqlite3SafetyCheckOk(db) || zCreateTable==0 ){ return SQLITE_MISUSE_BKPT; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); pCtx = db->pVtabCtx; if( !pCtx || pCtx->bDeclared ){ - sqlite3Error(db, SQLITE_MISUSE); - sqlite3_mutex_leave(db->mutex); + tdsqlite3Error(db, SQLITE_MISUSE); + tdsqlite3_mutex_leave(db->mutex); return SQLITE_MISUSE_BKPT; } pTab = pCtx->pTab; @@ -143093,7 +143093,7 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ sParse.eParseMode = PARSE_MODE_DECLARE_VTAB; sParse.db = db; sParse.nQueryLoop = 1; - if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr) + if( SQLITE_OK==tdsqlite3RunParser(&sParse, zCreateTable, &zErr) && sParse.pNewTable && !db->mallocFailed && !sParse.pNewTable->pSelect @@ -143108,10 +143108,10 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ pNew->nCol = 0; pNew->aCol = 0; assert( pTab->pIndex==0 ); - assert( HasRowid(pNew) || sqlite3PrimaryKeyIndex(pNew)!=0 ); + assert( HasRowid(pNew) || tdsqlite3PrimaryKeyIndex(pNew)!=0 ); if( !HasRowid(pNew) && pCtx->pVTable->pMod->pModule->xUpdate!=0 - && sqlite3PrimaryKeyIndex(pNew)->nKeyCol!=1 + && tdsqlite3PrimaryKeyIndex(pNew)->nKeyCol!=1 ){ /* WITHOUT ROWID virtual tables must either be read-only (xUpdate==0) ** or else must have a single-column PRIMARY KEY */ @@ -143127,21 +143127,21 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ } pCtx->bDeclared = 1; }else{ - sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr); - sqlite3DbFree(db, zErr); + tdsqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr); + tdsqlite3DbFree(db, zErr); rc = SQLITE_ERROR; } sParse.eParseMode = PARSE_MODE_NORMAL; if( sParse.pVdbe ){ - sqlite3VdbeFinalize(sParse.pVdbe); + tdsqlite3VdbeFinalize(sParse.pVdbe); } - sqlite3DeleteTable(db, sParse.pNewTable); - sqlite3ParserReset(&sParse); + tdsqlite3DeleteTable(db, sParse.pNewTable); + tdsqlite3ParserReset(&sParse); assert( (rc&0xff)==rc ); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); + rc = tdsqlite3ApiExit(db, rc); + tdsqlite3_mutex_leave(db->mutex); return rc; } @@ -143152,14 +143152,14 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ ** ** This call is a no-op if zTab is not a virtual table. */ -SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){ +SQLITE_PRIVATE int tdsqlite3VtabCallDestroy(tdsqlite3 *db, int iDb, const char *zTab){ int rc = SQLITE_OK; Table *pTab; - pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zDbSName); + pTab = tdsqlite3FindTable(db, zTab, db->aDb[iDb].zDbSName); if( pTab!=0 && ALWAYS(pTab->pVTable!=0) ){ VTable *p; - int (*xDestroy)(sqlite3_vtab *); + int (*xDestroy)(tdsqlite3_vtab *); for(p=pTab->pVTable; p; p=p->pNext){ assert( p->pVtab ); if( p->pVtab->nRef>0 ){ @@ -143172,14 +143172,14 @@ SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab assert( xDestroy!=0 ); pTab->nTabRef++; rc = xDestroy(p->pVtab); - /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */ + /* Remove the tdsqlite3_vtab* from the aVTrans[] array, if applicable */ if( rc==SQLITE_OK ){ assert( pTab->pVTable==p && p->pNext==0 ); p->pVtab = 0; pTab->pVTable = 0; - sqlite3VtabUnlock(p); + tdsqlite3VtabUnlock(p); } - sqlite3DeleteTable(db, pTab); + tdsqlite3DeleteTable(db, pTab); } return rc; @@ -143189,27 +143189,27 @@ SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab ** This function invokes either the xRollback or xCommit method ** of each of the virtual tables in the sqlite3.aVTrans array. The method ** called is identified by the second argument, "offset", which is -** the offset of the method to call in the sqlite3_module structure. +** the offset of the method to call in the tdsqlite3_module structure. ** ** The array is cleared after invoking the callbacks. */ -static void callFinaliser(sqlite3 *db, int offset){ +static void callFinaliser(tdsqlite3 *db, int offset){ int i; if( db->aVTrans ){ VTable **aVTrans = db->aVTrans; db->aVTrans = 0; for(i=0; inVTrans; i++){ VTable *pVTab = aVTrans[i]; - sqlite3_vtab *p = pVTab->pVtab; + tdsqlite3_vtab *p = pVTab->pVtab; if( p ){ - int (*x)(sqlite3_vtab *); - x = *(int (**)(sqlite3_vtab *))((char *)p->pModule + offset); + int (*x)(tdsqlite3_vtab *); + x = *(int (**)(tdsqlite3_vtab *))((char *)p->pModule + offset); if( x ) x(p); } pVTab->iSavepoint = 0; - sqlite3VtabUnlock(pVTab); + tdsqlite3VtabUnlock(pVTab); } - sqlite3DbFree(db, aVTrans); + tdsqlite3DbFree(db, aVTrans); db->nVTrans = 0; } } @@ -143221,18 +143221,18 @@ static void callFinaliser(sqlite3 *db, int offset){ ** ** If an error message is available, leave it in p->zErrMsg. */ -SQLITE_PRIVATE int sqlite3VtabSync(sqlite3 *db, Vdbe *p){ +SQLITE_PRIVATE int tdsqlite3VtabSync(tdsqlite3 *db, Vdbe *p){ int i; int rc = SQLITE_OK; VTable **aVTrans = db->aVTrans; db->aVTrans = 0; for(i=0; rc==SQLITE_OK && inVTrans; i++){ - int (*x)(sqlite3_vtab *); - sqlite3_vtab *pVtab = aVTrans[i]->pVtab; + int (*x)(tdsqlite3_vtab *); + tdsqlite3_vtab *pVtab = aVTrans[i]->pVtab; if( pVtab && (x = pVtab->pModule->xSync)!=0 ){ rc = x(pVtab); - sqlite3VtabImportErrmsg(p, pVtab); + tdsqlite3VtabImportErrmsg(p, pVtab); } } db->aVTrans = aVTrans; @@ -143243,8 +143243,8 @@ SQLITE_PRIVATE int sqlite3VtabSync(sqlite3 *db, Vdbe *p){ ** Invoke the xRollback method of all virtual tables in the ** sqlite3.aVTrans array. Then clear the array itself. */ -SQLITE_PRIVATE int sqlite3VtabRollback(sqlite3 *db){ - callFinaliser(db, offsetof(sqlite3_module,xRollback)); +SQLITE_PRIVATE int tdsqlite3VtabRollback(tdsqlite3 *db){ + callFinaliser(db, offsetof(tdsqlite3_module,xRollback)); return SQLITE_OK; } @@ -143252,8 +143252,8 @@ SQLITE_PRIVATE int sqlite3VtabRollback(sqlite3 *db){ ** Invoke the xCommit method of all virtual tables in the ** sqlite3.aVTrans array. Then clear the array itself. */ -SQLITE_PRIVATE int sqlite3VtabCommit(sqlite3 *db){ - callFinaliser(db, offsetof(sqlite3_module,xCommit)); +SQLITE_PRIVATE int tdsqlite3VtabCommit(tdsqlite3 *db){ + callFinaliser(db, offsetof(tdsqlite3_module,xCommit)); return SQLITE_OK; } @@ -143262,19 +143262,19 @@ SQLITE_PRIVATE int sqlite3VtabCommit(sqlite3 *db){ ** (xBegin/xRollback/xCommit and optionally xSync) and a transaction is ** not currently open, invoke the xBegin method now. ** -** If the xBegin call is successful, place the sqlite3_vtab pointer +** If the xBegin call is successful, place the tdsqlite3_vtab pointer ** in the sqlite3.aVTrans array. */ -SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){ +SQLITE_PRIVATE int tdsqlite3VtabBegin(tdsqlite3 *db, VTable *pVTab){ int rc = SQLITE_OK; - const sqlite3_module *pModule; + const tdsqlite3_module *pModule; /* Special case: If db->aVTrans is NULL and db->nVTrans is greater ** than zero, then this function is being called from within a ** virtual module xSync() callback. It is illegal to write to ** virtual module tables in this case, so return SQLITE_LOCKED. */ - if( sqlite3VtabInSync(db) ){ + if( tdsqlite3VtabInSync(db) ){ return SQLITE_LOCKED; } if( !pVTab ){ @@ -143325,7 +143325,7 @@ SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){ ** function immediately. If all calls to virtual table methods are successful, ** SQLITE_OK is returned. */ -SQLITE_PRIVATE int sqlite3VtabSavepoint(sqlite3 *db, int op, int iSavepoint){ +SQLITE_PRIVATE int tdsqlite3VtabSavepoint(tdsqlite3 *db, int op, int iSavepoint){ int rc = SQLITE_OK; assert( op==SAVEPOINT_RELEASE||op==SAVEPOINT_ROLLBACK||op==SAVEPOINT_BEGIN ); @@ -143334,10 +143334,10 @@ SQLITE_PRIVATE int sqlite3VtabSavepoint(sqlite3 *db, int op, int iSavepoint){ int i; for(i=0; rc==SQLITE_OK && inVTrans; i++){ VTable *pVTab = db->aVTrans[i]; - const sqlite3_module *pMod = pVTab->pMod->pModule; + const tdsqlite3_module *pMod = pVTab->pMod->pModule; if( pVTab->pVtab && pMod->iVersion>=2 ){ - int (*xMethod)(sqlite3_vtab *, int); - sqlite3VtabLock(pVTab); + int (*xMethod)(tdsqlite3_vtab *, int); + tdsqlite3VtabLock(pVTab); switch( op ){ case SAVEPOINT_BEGIN: xMethod = pMod->xSavepoint; @@ -143353,7 +143353,7 @@ SQLITE_PRIVATE int sqlite3VtabSavepoint(sqlite3 *db, int op, int iSavepoint){ if( xMethod && pVTab->iSavepoint>iSavepoint ){ rc = xMethod(pVTab->pVtab, iSavepoint); } - sqlite3VtabUnlock(pVTab); + tdsqlite3VtabUnlock(pVTab); } } } @@ -143373,16 +143373,16 @@ SQLITE_PRIVATE int sqlite3VtabSavepoint(sqlite3 *db, int op, int iSavepoint){ ** new FuncDef structure that is marked as ephemeral using the ** SQLITE_FUNC_EPHEM flag. */ -SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction( - sqlite3 *db, /* Database connection for reporting malloc problems */ +SQLITE_PRIVATE FuncDef *tdsqlite3VtabOverloadFunction( + tdsqlite3 *db, /* Database connection for reporting malloc problems */ FuncDef *pDef, /* Function to possibly overload */ int nArg, /* Number of arguments to the function */ Expr *pExpr /* First argument to the function */ ){ Table *pTab; - sqlite3_vtab *pVtab; - sqlite3_module *pMod; - void (*xSFunc)(sqlite3_context*,int,sqlite3_value**) = 0; + tdsqlite3_vtab *pVtab; + tdsqlite3_module *pMod; + void (*xSFunc)(tdsqlite3_context*,int,tdsqlite3_value**) = 0; void *pArg = 0; FuncDef *pNew; int rc = 0; @@ -143393,10 +143393,10 @@ SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction( pTab = pExpr->y.pTab; if( pTab==0 ) return pDef; if( !IsVirtual(pTab) ) return pDef; - pVtab = sqlite3GetVTable(db, pTab)->pVtab; + pVtab = tdsqlite3GetVTable(db, pTab)->pVtab; assert( pVtab!=0 ); assert( pVtab->pModule!=0 ); - pMod = (sqlite3_module *)pVtab->pModule; + pMod = (tdsqlite3_module *)pVtab->pModule; if( pMod->xFindFunction==0 ) return pDef; /* Call the xFindFunction method on the virtual table implementation @@ -143411,7 +143411,7 @@ SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction( int i; for(i=0; pDef->zName[i]; i++){ unsigned char x = (unsigned char)pDef->zName[i]; - assert( x==sqlite3UpperToLower[x] ); + assert( x==tdsqlite3UpperToLower[x] ); } } #endif @@ -143422,14 +143422,14 @@ SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction( /* Create a new ephemeral function definition for the overloaded ** function */ - pNew = sqlite3DbMallocZero(db, sizeof(*pNew) - + sqlite3Strlen30(pDef->zName) + 1); + pNew = tdsqlite3DbMallocZero(db, sizeof(*pNew) + + tdsqlite3Strlen30(pDef->zName) + 1); if( pNew==0 ){ return pDef; } *pNew = *pDef; pNew->zName = (const char*)&pNew[1]; - memcpy((char*)&pNew[1], pDef->zName, sqlite3Strlen30(pDef->zName)+1); + memcpy((char*)&pNew[1], pDef->zName, tdsqlite3Strlen30(pDef->zName)+1); pNew->xSFunc = xSFunc; pNew->pUserData = pArg; pNew->funcFlags |= SQLITE_FUNC_EPHEM; @@ -143442,8 +143442,8 @@ SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction( ** array if it is missing. If pTab is already in the array, this routine ** is a no-op. */ -SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); +SQLITE_PRIVATE void tdsqlite3VtabMakeWritable(Parse *pParse, Table *pTab){ + Parse *pToplevel = tdsqlite3ParseToplevel(pParse); int i, n; Table **apVtabLock; @@ -143452,12 +143452,12 @@ SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){ if( pTab==pToplevel->apVtabLock[i] ) return; } n = (pToplevel->nVtabLock+1)*sizeof(pToplevel->apVtabLock[0]); - apVtabLock = sqlite3_realloc64(pToplevel->apVtabLock, n); + apVtabLock = tdsqlite3_realloc64(pToplevel->apVtabLock, n); if( apVtabLock ){ pToplevel->apVtabLock = apVtabLock; pToplevel->apVtabLock[pToplevel->nVtabLock++] = pTab; }else{ - sqlite3OomFault(pToplevel->db); + tdsqlite3OomFault(pToplevel->db); } } @@ -143475,19 +143475,19 @@ SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){ ** Any virtual table module for which xConnect and xCreate are the same ** method can have an eponymous virtual table instance. */ -SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){ - const sqlite3_module *pModule = pMod->pModule; +SQLITE_PRIVATE int tdsqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){ + const tdsqlite3_module *pModule = pMod->pModule; Table *pTab; char *zErr = 0; int rc; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; if( pMod->pEpoTab ) return 1; if( pModule->xCreate!=0 && pModule->xCreate!=pModule->xConnect ) return 0; - pTab = sqlite3DbMallocZero(db, sizeof(Table)); + pTab = tdsqlite3DbMallocZero(db, sizeof(Table)); if( pTab==0 ) return 0; - pTab->zName = sqlite3DbStrDup(db, pMod->zName); + pTab->zName = tdsqlite3DbStrDup(db, pMod->zName); if( pTab->zName==0 ){ - sqlite3DbFree(db, pTab); + tdsqlite3DbFree(db, pTab); return 0; } pMod->pEpoTab = pTab; @@ -143495,14 +143495,14 @@ SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){ pTab->pSchema = db->aDb[0].pSchema; assert( pTab->nModuleArg==0 ); pTab->iPKey = -1; - addModuleArgument(pParse, pTab, sqlite3DbStrDup(db, pTab->zName)); + addModuleArgument(pParse, pTab, tdsqlite3DbStrDup(db, pTab->zName)); addModuleArgument(pParse, pTab, 0); - addModuleArgument(pParse, pTab, sqlite3DbStrDup(db, pTab->zName)); + addModuleArgument(pParse, pTab, tdsqlite3DbStrDup(db, pTab->zName)); rc = vtabCallConstructor(db, pTab, pMod, pModule->xConnect, &zErr); if( rc ){ - sqlite3ErrorMsg(pParse, "%s", zErr); - sqlite3DbFree(db, zErr); - sqlite3VtabEponymousTableClear(db, pMod); + tdsqlite3ErrorMsg(pParse, "%s", zErr); + tdsqlite3DbFree(db, zErr); + tdsqlite3VtabEponymousTableClear(db, pMod); return 0; } return 1; @@ -143512,14 +143512,14 @@ SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){ ** Erase the eponymous virtual table instance associated with ** virtual table module pMod, if it exists. */ -SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3 *db, Module *pMod){ +SQLITE_PRIVATE void tdsqlite3VtabEponymousTableClear(tdsqlite3 *db, Module *pMod){ Table *pTab = pMod->pEpoTab; if( pTab!=0 ){ /* Mark the table as Ephemeral prior to deleting it, so that the - ** sqlite3DeleteTable() routine will know that it is not stored in + ** tdsqlite3DeleteTable() routine will know that it is not stored in ** the schema. */ pTab->tabFlags |= TF_Ephemeral; - sqlite3DeleteTable(db, pTab); + tdsqlite3DeleteTable(db, pTab); pMod->pEpoTab = 0; } } @@ -143531,12 +143531,12 @@ SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3 *db, Module *pMod){ ** The results of this routine are undefined unless it is called from ** within an xUpdate method. */ -SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *db){ +SQLITE_API int tdsqlite3_vtab_on_conflict(tdsqlite3 *db){ static const unsigned char aMap[] = { SQLITE_ROLLBACK, SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE }; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif assert( OE_Rollback==1 && OE_Abort==2 && OE_Fail==3 ); assert( OE_Ignore==4 && OE_Replace==5 ); @@ -143549,15 +143549,15 @@ SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *db){ ** the SQLite core with additional information about the behavior ** of the virtual table being implemented. */ -SQLITE_API int sqlite3_vtab_config(sqlite3 *db, int op, ...){ +SQLITE_API int tdsqlite3_vtab_config(tdsqlite3 *db, int op, ...){ va_list ap; int rc = SQLITE_OK; VtabCtx *p; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); p = db->pVtabCtx; if( !p ){ rc = SQLITE_MISUSE_BKPT; @@ -143585,8 +143585,8 @@ SQLITE_API int sqlite3_vtab_config(sqlite3 *db, int op, ...){ va_end(ap); } - if( rc!=SQLITE_OK ) sqlite3Error(db, rc); - sqlite3_mutex_leave(db->mutex); + if( rc!=SQLITE_OK ) tdsqlite3Error(db, rc); + tdsqlite3_mutex_leave(db->mutex); return rc; } @@ -143639,11 +143639,11 @@ SQLITE_API int sqlite3_vtab_config(sqlite3 *db, int op, ...){ ** Trace output macros */ #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) -/***/ extern int sqlite3WhereTrace; +/***/ extern int tdsqlite3WhereTrace; #endif #if defined(SQLITE_DEBUG) \ && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE)) -# define WHERETRACE(K,X) if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X +# define WHERETRACE(K,X) if(tdsqlite3WhereTrace&(K)) tdsqlite3DebugPrintf X # define WHERETRACE_ENABLED 1 #else # define WHERETRACE(K,X) @@ -143753,7 +143753,7 @@ struct WhereLoop { } btree; struct { /* Information for virtual tables */ int idxNum; /* Index number */ - u8 needFree; /* True if sqlite3_free(idxStr) is needed */ + u8 needFree; /* True if tdsqlite3_free(idxStr) is needed */ i8 isOrdered; /* True if satisfies ORDER BY */ u16 omitMask; /* Terms that may be omitted */ char *idxStr; /* Index identifier string */ @@ -143892,7 +143892,7 @@ struct WhereTerm { /* ** Allowed values of WhereTerm.wtFlags */ -#define TERM_DYNAMIC 0x0001 /* Need to call sqlite3ExprDelete(db, pExpr) */ +#define TERM_DYNAMIC 0x0001 /* Need to call tdsqlite3ExprDelete(db, pExpr) */ #define TERM_VIRTUAL 0x0002 /* Added by the optimizer. Do not code */ #define TERM_CODED 0x0004 /* This term is already coded */ #define TERM_COPIED 0x0008 /* Has a child */ @@ -143999,7 +143999,7 @@ struct WhereAndInfo { ** no gaps. */ struct WhereMaskSet { - int bVarSelect; /* Used by sqlite3WhereExprUsage() */ + int bVarSelect; /* Used by tdsqlite3WhereExprUsage() */ int n; /* Number of assigned cursor values */ int ix[BMS]; /* Cursor assigned to each bit */ }; @@ -144034,7 +144034,7 @@ struct WhereLoopBuilder { /* The WhereLoopBuilder.iPlanLimit is used to limit the number of ** index+constraint combinations the query planner will consider for a ** particular query. If this parameter is unlimited, then certain -** pathological queries can spend excess time in the sqlite3WhereBegin() +** pathological queries can spend excess time in the tdsqlite3WhereBegin() ** routine. The limit is high enough that is should not impact real-world ** queries. ** @@ -144085,7 +144085,7 @@ struct WhereInfo { int iContinue; /* Jump here to continue with next record */ int iBreak; /* Jump here to break out of the loop */ int savedNQueryLoop; /* pParse->nQueryLoop outside the WHERE loop */ - u16 wctrlFlags; /* Flags originally passed to sqlite3WhereBegin() */ + u16 wctrlFlags; /* Flags originally passed to tdsqlite3WhereBegin() */ LogEst iLimit; /* LIMIT if wctrlFlags has WHERE_USE_LIMIT */ u8 nLevel; /* Number of nested loop */ i8 nOBSat; /* Number of ORDER BY terms satisfied by indices */ @@ -144110,13 +144110,13 @@ struct WhereInfo { ** ** where.c: */ -SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet*,int); +SQLITE_PRIVATE Bitmask tdsqlite3WhereGetMask(WhereMaskSet*,int); #ifdef WHERETRACE_ENABLED -SQLITE_PRIVATE void sqlite3WhereClausePrint(WhereClause *pWC); -SQLITE_PRIVATE void sqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm); -SQLITE_PRIVATE void sqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC); +SQLITE_PRIVATE void tdsqlite3WhereClausePrint(WhereClause *pWC); +SQLITE_PRIVATE void tdsqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm); +SQLITE_PRIVATE void tdsqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC); #endif -SQLITE_PRIVATE WhereTerm *sqlite3WhereFindTerm( +SQLITE_PRIVATE WhereTerm *tdsqlite3WhereFindTerm( WhereClause *pWC, /* The WHERE clause to be searched */ int iCur, /* Cursor number of LHS */ int iColumn, /* Column number of LHS */ @@ -144127,26 +144127,26 @@ SQLITE_PRIVATE WhereTerm *sqlite3WhereFindTerm( /* wherecode.c: */ #ifndef SQLITE_OMIT_EXPLAIN -SQLITE_PRIVATE int sqlite3WhereExplainOneScan( +SQLITE_PRIVATE int tdsqlite3WhereExplainOneScan( Parse *pParse, /* Parse context */ SrcList *pTabList, /* Table list this loop refers to */ WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */ - u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */ + u16 wctrlFlags /* Flags passed to tdsqlite3WhereBegin() */ ); #else -# define sqlite3WhereExplainOneScan(u,v,w,x) 0 +# define tdsqlite3WhereExplainOneScan(u,v,w,x) 0 #endif /* SQLITE_OMIT_EXPLAIN */ #ifdef SQLITE_ENABLE_STMT_SCANSTATUS -SQLITE_PRIVATE void sqlite3WhereAddScanStatus( +SQLITE_PRIVATE void tdsqlite3WhereAddScanStatus( Vdbe *v, /* Vdbe to add scanstatus entry to */ SrcList *pSrclist, /* FROM clause pLvl reads data from */ WhereLevel *pLvl, /* Level to add scanstatus() entry for */ int addrExplain /* Address of OP_Explain (or 0) */ ); #else -# define sqlite3WhereAddScanStatus(a, b, c, d) ((void)d) +# define tdsqlite3WhereAddScanStatus(a, b, c, d) ((void)d) #endif -SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( +SQLITE_PRIVATE Bitmask tdsqlite3WhereCodeOneLoopStart( Parse *pParse, /* Parsing context */ Vdbe *v, /* Prepared statement under construction */ WhereInfo *pWInfo, /* Complete information about the WHERE clause */ @@ -144156,14 +144156,14 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ); /* whereexpr.c: */ -SQLITE_PRIVATE void sqlite3WhereClauseInit(WhereClause*,WhereInfo*); -SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause*); -SQLITE_PRIVATE void sqlite3WhereSplit(WhereClause*,Expr*,u8); -SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet*, Expr*); -SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet*, Expr*); -SQLITE_PRIVATE Bitmask sqlite3WhereExprListUsage(WhereMaskSet*, ExprList*); -SQLITE_PRIVATE void sqlite3WhereExprAnalyze(SrcList*, WhereClause*); -SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(Parse*, struct SrcList_item*, WhereClause*); +SQLITE_PRIVATE void tdsqlite3WhereClauseInit(WhereClause*,WhereInfo*); +SQLITE_PRIVATE void tdsqlite3WhereClauseClear(WhereClause*); +SQLITE_PRIVATE void tdsqlite3WhereSplit(WhereClause*,Expr*,u8); +SQLITE_PRIVATE Bitmask tdsqlite3WhereExprUsage(WhereMaskSet*, Expr*); +SQLITE_PRIVATE Bitmask tdsqlite3WhereExprUsageNN(WhereMaskSet*, Expr*); +SQLITE_PRIVATE Bitmask tdsqlite3WhereExprListUsage(WhereMaskSet*, ExprList*); +SQLITE_PRIVATE void tdsqlite3WhereExprAnalyze(SrcList*, WhereClause*); +SQLITE_PRIVATE void tdsqlite3WhereTabFuncArgs(Parse*, struct SrcList_item*, WhereClause*); @@ -144262,23 +144262,23 @@ static void explainAppendTerm( int i; assert( nTerm>=1 ); - if( bAnd ) sqlite3_str_append(pStr, " AND ", 5); + if( bAnd ) tdsqlite3_str_append(pStr, " AND ", 5); - if( nTerm>1 ) sqlite3_str_append(pStr, "(", 1); + if( nTerm>1 ) tdsqlite3_str_append(pStr, "(", 1); for(i=0; i1 ) sqlite3_str_append(pStr, ")", 1); + if( nTerm>1 ) tdsqlite3_str_append(pStr, ")", 1); - sqlite3_str_append(pStr, zOp, 1); + tdsqlite3_str_append(pStr, zOp, 1); - if( nTerm>1 ) sqlite3_str_append(pStr, "(", 1); + if( nTerm>1 ) tdsqlite3_str_append(pStr, "(", 1); for(i=0; i1 ) sqlite3_str_append(pStr, ")", 1); + if( nTerm>1 ) tdsqlite3_str_append(pStr, ")", 1); } /* @@ -144302,11 +144302,11 @@ static void explainIndexRange(StrAccum *pStr, WhereLoop *pLoop){ int i, j; if( nEq==0 && (pLoop->wsFlags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ) return; - sqlite3_str_append(pStr, " (", 2); + tdsqlite3_str_append(pStr, " (", 2); for(i=0; i=nSkip ? "%s=?" : "ANY(%s)", z); + if( i ) tdsqlite3_str_append(pStr, " AND ", 5); + tdsqlite3_str_appendf(pStr, i>=nSkip ? "%s=?" : "ANY(%s)", z); } j = i; @@ -144317,7 +144317,7 @@ static void explainIndexRange(StrAccum *pStr, WhereLoop *pLoop){ if( pLoop->wsFlags&WHERE_TOP_LIMIT ){ explainAppendTerm(pStr, pIndex, pLoop->u.btree.nTop, j, i, "<"); } - sqlite3_str_append(pStr, ")", 1); + tdsqlite3_str_append(pStr, ")", 1); } /* @@ -144329,20 +144329,20 @@ static void explainIndexRange(StrAccum *pStr, WhereLoop *pLoop){ ** If an OP_Explain opcode is added to the VM, its address is returned. ** Otherwise, if no OP_Explain is coded, zero is returned. */ -SQLITE_PRIVATE int sqlite3WhereExplainOneScan( +SQLITE_PRIVATE int tdsqlite3WhereExplainOneScan( Parse *pParse, /* Parse context */ SrcList *pTabList, /* Table list this loop refers to */ WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */ - u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */ + u16 wctrlFlags /* Flags passed to tdsqlite3WhereBegin() */ ){ int ret = 0; #if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS) - if( sqlite3ParseToplevel(pParse)->explain==2 ) + if( tdsqlite3ParseToplevel(pParse)->explain==2 ) #endif { struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom]; Vdbe *v = pParse->pVdbe; /* VM being constructed */ - sqlite3 *db = pParse->db; /* Database handle */ + tdsqlite3 *db = pParse->db; /* Database handle */ int isSearch; /* True for a SEARCH. False for SCAN. */ WhereLoop *pLoop; /* The controlling WhereLoop object */ u32 flags; /* Flags that describe this loop */ @@ -144358,16 +144358,16 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan( || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0)) || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX)); - sqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), SQLITE_MAX_LENGTH); - sqlite3_str_appendall(&str, isSearch ? "SEARCH" : "SCAN"); + tdsqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), SQLITE_MAX_LENGTH); + tdsqlite3_str_appendall(&str, isSearch ? "SEARCH" : "SCAN"); if( pItem->pSelect ){ - sqlite3_str_appendf(&str, " SUBQUERY %u", pItem->pSelect->selId); + tdsqlite3_str_appendf(&str, " SUBQUERY %u", pItem->pSelect->selId); }else{ - sqlite3_str_appendf(&str, " TABLE %s", pItem->zName); + tdsqlite3_str_appendf(&str, " TABLE %s", pItem->zName); } if( pItem->zAlias ){ - sqlite3_str_appendf(&str, " AS %s", pItem->zAlias); + tdsqlite3_str_appendf(&str, " AS %s", pItem->zAlias); } if( (flags & (WHERE_IPK|WHERE_VIRTUALTABLE))==0 ){ const char *zFmt = 0; @@ -144390,8 +144390,8 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan( zFmt = "INDEX %s"; } if( zFmt ){ - sqlite3_str_append(&str, " USING ", 7); - sqlite3_str_appendf(&str, zFmt, pIdx->zName); + tdsqlite3_str_append(&str, " USING ", 7); + tdsqlite3_str_appendf(&str, zFmt, pIdx->zName); explainIndexRange(&str, pLoop); } }else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){ @@ -144406,26 +144406,26 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan( assert( flags&WHERE_TOP_LIMIT); zRangeOp = "<"; } - sqlite3_str_appendf(&str, + tdsqlite3_str_appendf(&str, " USING INTEGER PRIMARY KEY (rowid%s?)",zRangeOp); } #ifndef SQLITE_OMIT_VIRTUALTABLE else if( (flags & WHERE_VIRTUALTABLE)!=0 ){ - sqlite3_str_appendf(&str, " VIRTUAL TABLE INDEX %d:%s", + tdsqlite3_str_appendf(&str, " VIRTUAL TABLE INDEX %d:%s", pLoop->u.vtab.idxNum, pLoop->u.vtab.idxStr); } #endif #ifdef SQLITE_EXPLAIN_ESTIMATED_ROWS if( pLoop->nOut>=10 ){ - sqlite3_str_appendf(&str, " (~%llu rows)", - sqlite3LogEstToInt(pLoop->nOut)); + tdsqlite3_str_appendf(&str, " (~%llu rows)", + tdsqlite3LogEstToInt(pLoop->nOut)); }else{ - sqlite3_str_append(&str, " (~1 row)", 9); + tdsqlite3_str_append(&str, " (~1 row)", 9); } #endif - zMsg = sqlite3StrAccumFinish(&str); - sqlite3ExplainBreakpoint("",zMsg); - ret = sqlite3VdbeAddOp4(v, OP_Explain, sqlite3VdbeCurrentAddr(v), + zMsg = tdsqlite3StrAccumFinish(&str); + tdsqlite3ExplainBreakpoint("",zMsg); + ret = tdsqlite3VdbeAddOp4(v, OP_Explain, tdsqlite3VdbeCurrentAddr(v), pParse->addrExplain, 0, zMsg,P4_DYNAMIC); } return ret; @@ -144435,14 +144435,14 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan( #ifdef SQLITE_ENABLE_STMT_SCANSTATUS /* ** Configure the VM passed as the first argument with an -** sqlite3_stmt_scanstatus() entry corresponding to the scan used to +** tdsqlite3_stmt_scanstatus() entry corresponding to the scan used to ** implement level pLvl. Argument pSrclist is a pointer to the FROM ** clause that the scan reads data from. ** ** If argument addrExplain is not 0, it must be the address of an ** OP_Explain instruction that describes the same loop. */ -SQLITE_PRIVATE void sqlite3WhereAddScanStatus( +SQLITE_PRIVATE void tdsqlite3WhereAddScanStatus( Vdbe *v, /* Vdbe to add scanstatus entry to */ SrcList *pSrclist, /* FROM clause pLvl reads data from */ WhereLevel *pLvl, /* Level to add scanstatus() entry for */ @@ -144455,7 +144455,7 @@ SQLITE_PRIVATE void sqlite3WhereAddScanStatus( }else{ zObj = pSrclist->a[pLvl->iFrom].zName; } - sqlite3VdbeScanStatus( + tdsqlite3VdbeScanStatus( v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj ); } @@ -144559,7 +144559,7 @@ static void codeApplyAffinity(Parse *pParse, int base, int n, char *zAff){ /* Code the OP_Affinity opcode if there is anything left to do. */ if( n>0 ){ - sqlite3VdbeAddOp4(v, OP_Affinity, base, n, 0, zAff, n); + tdsqlite3VdbeAddOp4(v, OP_Affinity, base, n, 0, zAff, n); } } @@ -144580,9 +144580,9 @@ static void updateRangeAffinityStr( ){ int i; for(i=0; idb; + tdsqlite3 *db = pParse->db; Expr *pNew; - pNew = sqlite3ExprDup(db, pX, 0); + pNew = tdsqlite3ExprDup(db, pX, 0); if( db->mallocFailed==0 ){ ExprList *pOrigRhs = pNew->x.pSelect->pEList; /* Original unmodified RHS */ ExprList *pOrigLhs = pNew->pLeft->x.pList; /* Original unmodified LHS */ @@ -144640,15 +144640,15 @@ static Expr *removeUnindexableInClauseTerms( if( pLoop->aLTerm[i]->pExpr==pX ){ int iField = pLoop->aLTerm[i]->iField - 1; if( pOrigRhs->a[iField].pExpr==0 ) continue; /* Duplicate PK column */ - pRhs = sqlite3ExprListAppend(pParse, pRhs, pOrigRhs->a[iField].pExpr); + pRhs = tdsqlite3ExprListAppend(pParse, pRhs, pOrigRhs->a[iField].pExpr); pOrigRhs->a[iField].pExpr = 0; assert( pOrigLhs->a[iField].pExpr!=0 ); - pLhs = sqlite3ExprListAppend(pParse, pLhs, pOrigLhs->a[iField].pExpr); + pLhs = tdsqlite3ExprListAppend(pParse, pLhs, pOrigLhs->a[iField].pExpr); pOrigLhs->a[iField].pExpr = 0; } } - sqlite3ExprListDelete(db, pOrigRhs); - sqlite3ExprListDelete(db, pOrigLhs); + tdsqlite3ExprListDelete(db, pOrigRhs); + tdsqlite3ExprListDelete(db, pOrigLhs); pNew->pLeft->x.pList = pLhs; pNew->x.pSelect->pEList = pRhs; if( pLhs && pLhs->nExpr==1 ){ @@ -144657,7 +144657,7 @@ static Expr *removeUnindexableInClauseTerms( ** of the subroutines do not handle this case. */ Expr *p = pLhs->a[0].pExpr; pLhs->a[0].pExpr = 0; - sqlite3ExprDelete(db, pNew->pLeft); + tdsqlite3ExprDelete(db, pNew->pLeft); pNew->pLeft = p; } pSelect = pNew->x.pSelect; @@ -144677,9 +144677,9 @@ static Expr *removeUnindexableInClauseTerms( #if 0 printf("For indexing, change the IN expr:\n"); - sqlite3TreeViewExpr(0, pX, 0); + tdsqlite3TreeViewExpr(0, pX, 0); printf("Into:\n"); - sqlite3TreeViewExpr(0, pNew, 0); + tdsqlite3TreeViewExpr(0, pNew, 0); #endif } return pNew; @@ -144716,10 +144716,10 @@ static int codeEqualityTerm( assert( pLevel->pWLoop->aLTerm[iEq]==pTerm ); assert( iTarget>0 ); if( pX->op==TK_EQ || pX->op==TK_IS ){ - iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget); + iReg = tdsqlite3ExprCodeTarget(pParse, pX->pRight, iTarget); }else if( pX->op==TK_ISNULL ){ iReg = iTarget; - sqlite3VdbeAddOp2(v, OP_Null, 0, iReg); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, iReg); #ifndef SQLITE_OMIT_SUBQUERY }else{ int eType = IN_INDEX_NOOP; @@ -144754,17 +144754,17 @@ static int codeEqualityTerm( iTab = 0; if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){ - eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab); + eType = tdsqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab); }else{ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX); if( !db->mallocFailed ){ - aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq); - eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab); + aiMap = (int*)tdsqlite3DbMallocZero(pParse->db, sizeof(int)*nEq); + eType = tdsqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab); pTerm->pExpr->iTable = iTab; } - sqlite3ExprDelete(db, pX); + tdsqlite3ExprDelete(db, pX); pX = pTerm->pExpr; } @@ -144772,20 +144772,20 @@ static int codeEqualityTerm( testcase( bRev ); bRev = !bRev; } - sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0); + tdsqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0); VdbeCoverageIf(v, bRev); VdbeCoverageIf(v, !bRev); assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 ); pLoop->wsFlags |= WHERE_IN_ABLE; if( pLevel->u.in.nIn==0 ){ - pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse); + pLevel->addrNxt = tdsqlite3VdbeMakeLabel(pParse); } i = pLevel->u.in.nIn; pLevel->u.in.nIn += nEq; pLevel->u.in.aInLoop = - sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop, + tdsqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop, sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn); pIn = pLevel->u.in.aInLoop; if( pIn ){ @@ -144795,12 +144795,12 @@ static int codeEqualityTerm( if( pLoop->aLTerm[i]->pExpr==pX ){ int iOut = iReg + i - iEq; if( eType==IN_INDEX_ROWID ){ - pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut); + pIn->addrInTop = tdsqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut); }else{ int iCol = aiMap ? aiMap[iMap++] : 0; - pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut); + pIn->addrInTop = tdsqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut); } - sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v); + tdsqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v); if( i==iEq ){ pIn->iCur = iTab; pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next; @@ -144820,7 +144820,7 @@ static int codeEqualityTerm( }else{ pLevel->u.in.nIn = 0; } - sqlite3DbFree(pParse->db, aiMap); + tdsqlite3DbFree(pParse->db, aiMap); #endif } disableTerm(pLevel, pTerm); @@ -144859,7 +144859,7 @@ static int codeEqualityTerm( ** ** Before returning, *pzAff is set to point to a buffer containing a ** copy of the column affinity string of the index allocated using -** sqlite3DbMalloc(). Except, entries in the copy of the string associated +** tdsqlite3DbMalloc(). Except, entries in the copy of the string associated ** with equality constraints that use BLOB or NONE affinity are set to ** SQLITE_AFF_BLOB. This is to deal with SQL such as the following: ** @@ -144904,23 +144904,23 @@ static int codeAllEqualityTerms( nReg = pLoop->u.btree.nEq + nExtraReg; pParse->nMem += nReg; - zAff = sqlite3DbStrDup(pParse->db,sqlite3IndexAffinityStr(pParse->db,pIdx)); + zAff = tdsqlite3DbStrDup(pParse->db,tdsqlite3IndexAffinityStr(pParse->db,pIdx)); assert( zAff!=0 || pParse->db->mallocFailed ); if( nSkip ){ int iIdxCur = pLevel->iIdxCur; - sqlite3VdbeAddOp1(v, (bRev?OP_Last:OP_Rewind), iIdxCur); + tdsqlite3VdbeAddOp1(v, (bRev?OP_Last:OP_Rewind), iIdxCur); VdbeCoverageIf(v, bRev==0); VdbeCoverageIf(v, bRev!=0); VdbeComment((v, "begin skip-scan on %s", pIdx->zName)); - j = sqlite3VdbeAddOp0(v, OP_Goto); - pLevel->addrSkip = sqlite3VdbeAddOp4Int(v, (bRev?OP_SeekLT:OP_SeekGT), + j = tdsqlite3VdbeAddOp0(v, OP_Goto); + pLevel->addrSkip = tdsqlite3VdbeAddOp4Int(v, (bRev?OP_SeekLT:OP_SeekGT), iIdxCur, 0, regBase, nSkip); VdbeCoverageIf(v, bRev==0); VdbeCoverageIf(v, bRev!=0); - sqlite3VdbeJumpHere(v, j); + tdsqlite3VdbeJumpHere(v, j); for(j=0; jaiColumn[j]==XN_EXPR ); VdbeComment((v, "%s", explainIndexColumnName(pIdx, j))); } @@ -144940,31 +144940,31 @@ static int codeAllEqualityTerms( r1 = codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, regBase+j); if( r1!=regBase+j ){ if( nReg==1 ){ - sqlite3ReleaseTempReg(pParse, regBase); + tdsqlite3ReleaseTempReg(pParse, regBase); regBase = r1; }else{ - sqlite3VdbeAddOp2(v, OP_SCopy, r1, regBase+j); + tdsqlite3VdbeAddOp2(v, OP_SCopy, r1, regBase+j); } } if( pTerm->eOperator & WO_IN ){ if( pTerm->pExpr->flags & EP_xIsSelect ){ /* No affinity ever needs to be (or should be) applied to a value ** from the RHS of an "? IN (SELECT ...)" expression. The - ** sqlite3FindInIndex() routine has already ensured that the + ** tdsqlite3FindInIndex() routine has already ensured that the ** affinity of the comparison has been applied to the value. */ if( zAff ) zAff[j] = SQLITE_AFF_BLOB; } }else if( (pTerm->eOperator & WO_ISNULL)==0 ){ Expr *pRight = pTerm->pExpr->pRight; - if( (pTerm->wtFlags & TERM_IS)==0 && sqlite3ExprCanBeNull(pRight) ){ - sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk); + if( (pTerm->wtFlags & TERM_IS)==0 && tdsqlite3ExprCanBeNull(pRight) ){ + tdsqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk); VdbeCoverage(v); } if( zAff ){ - if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){ + if( tdsqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){ zAff[j] = SQLITE_AFF_BLOB; } - if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[j]) ){ + if( tdsqlite3ExprNeedsNoAffinityChange(pRight, zAff[j]) ){ zAff[j] = SQLITE_AFF_BLOB; } } @@ -145000,7 +145000,7 @@ static void whereLikeOptimizationStringFixup( if( pTerm->wtFlags & TERM_LIKEOPT ){ VdbeOp *pOp; assert( pLevel->iLikeRepCntr>0 ); - pOp = sqlite3VdbeGetOp(v, -1); + pOp = tdsqlite3VdbeGetOp(v, -1); assert( pOp!=0 ); assert( pOp->opcode==OP_String8 || pTerm->pWC->pWInfo->pParse->db->mallocFailed ); @@ -145015,7 +145015,7 @@ static void whereLikeOptimizationStringFixup( #ifdef SQLITE_ENABLE_CURSOR_HINTS /* ** Information is passed from codeCursorHint() down to individual nodes of -** the expression tree (by sqlite3WalkExpr()) using an instance of this +** the expression tree (by tdsqlite3WalkExpr()) using an instance of this ** structure. */ struct CCurHint { @@ -145035,7 +145035,7 @@ static int codeCursorHintCheckExpr(Walker *pWalker, Expr *pExpr){ assert( pHint->pIdx!=0 ); if( pExpr->op==TK_COLUMN && pExpr->iTable==pHint->iTabCur - && sqlite3TableColumnToIndex(pHint->pIdx, pExpr->iColumn)<0 + && tdsqlite3TableColumnToIndex(pHint->pIdx, pExpr->iColumn)<0 ){ pWalker->eCode = 1; } @@ -145066,7 +145066,7 @@ static int codeCursorHintIsOrFunction(Walker *pWalker, Expr *pExpr){ }else if( pExpr->op==TK_FUNCTION ){ int d1; char d2[4]; - if( 0==sqlite3IsLikeFunction(pWalker->pParse->db, pExpr, &d1, d2) ){ + if( 0==tdsqlite3IsLikeFunction(pWalker->pParse->db, pExpr, &d1, d2) ){ pWalker->eCode = 1; } } @@ -145098,12 +145098,12 @@ static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){ if( pExpr->op==TK_COLUMN ){ if( pExpr->iTable!=pHint->iTabCur ){ int reg = ++pWalker->pParse->nMem; /* Register for column value */ - sqlite3ExprCode(pWalker->pParse, pExpr, reg); + tdsqlite3ExprCode(pWalker->pParse, pExpr, reg); pExpr->op = TK_REGISTER; pExpr->iTable = reg; }else if( pHint->pIdx!=0 ){ pExpr->iTable = pHint->iIdxCur; - pExpr->iColumn = sqlite3TableColumnToIndex(pHint->pIdx, pExpr->iColumn); + pExpr->iColumn = tdsqlite3TableColumnToIndex(pHint->pIdx, pExpr->iColumn); assert( pExpr->iColumn>=0 ); } }else if( pExpr->op==TK_AGG_FUNCTION ){ @@ -145129,7 +145129,7 @@ static void codeCursorHint( WhereTerm *pEndRange /* Hint this end-of-scan boundary term if not NULL */ ){ Parse *pParse = pWInfo->pParse; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Vdbe *v = pParse->pVdbe; Expr *pExpr = 0; WhereLoop *pLoop = pLevel->pWLoop; @@ -145184,7 +145184,7 @@ static void codeCursorHint( ){ sWalker.eCode = 0; sWalker.xExprCallback = codeCursorHintIsOrFunction; - sqlite3WalkExpr(&sWalker, pTerm->pExpr); + tdsqlite3WalkExpr(&sWalker, pTerm->pExpr); if( sWalker.eCode ) continue; } }else{ @@ -145200,24 +145200,24 @@ static void codeCursorHint( } /* No subqueries or non-deterministic functions allowed */ - if( sqlite3ExprContainsSubquery(pTerm->pExpr) ) continue; + if( tdsqlite3ExprContainsSubquery(pTerm->pExpr) ) continue; /* For an index scan, make sure referenced columns are actually in ** the index. */ if( sHint.pIdx!=0 ){ sWalker.eCode = 0; sWalker.xExprCallback = codeCursorHintCheckExpr; - sqlite3WalkExpr(&sWalker, pTerm->pExpr); + tdsqlite3WalkExpr(&sWalker, pTerm->pExpr); if( sWalker.eCode ) continue; } /* If we survive all prior tests, that means this term is worth hinting */ - pExpr = sqlite3ExprAnd(pParse, pExpr, sqlite3ExprDup(db, pTerm->pExpr, 0)); + pExpr = tdsqlite3ExprAnd(pParse, pExpr, tdsqlite3ExprDup(db, pTerm->pExpr, 0)); } if( pExpr!=0 ){ sWalker.xExprCallback = codeCursorHintFixExpr; - sqlite3WalkExpr(&sWalker, pExpr); - sqlite3VdbeAddOp4(v, OP_CursorHint, + tdsqlite3WalkExpr(&sWalker, pExpr); + tdsqlite3VdbeAddOp4(v, OP_CursorHint, (sHint.pIdx ? sHint.iIdxCur : sHint.iTabCur), 0, 0, (const char*)pExpr, P4_EXPR); } @@ -145257,24 +145257,24 @@ static void codeDeferredSeek( assert( pIdx->aiColumn[pIdx->nColumn-1]==-1 ); pWInfo->bDeferredSeek = 1; - sqlite3VdbeAddOp3(v, OP_DeferredSeek, iIdxCur, 0, iCur); + tdsqlite3VdbeAddOp3(v, OP_DeferredSeek, iIdxCur, 0, iCur); if( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE) - && DbMaskAllZero(sqlite3ParseToplevel(pParse)->writeMask) + && DbMaskAllZero(tdsqlite3ParseToplevel(pParse)->writeMask) ){ int i; Table *pTab = pIdx->pTable; - int *ai = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*(pTab->nCol+1)); + int *ai = (int*)tdsqlite3DbMallocZero(pParse->db, sizeof(int)*(pTab->nCol+1)); if( ai ){ ai[0] = pTab->nCol; for(i=0; inColumn-1; i++){ int x1, x2; assert( pIdx->aiColumn[i]nCol ); x1 = pIdx->aiColumn[i]; - x2 = sqlite3TableColumnToStorage(pTab, x1); + x2 = tdsqlite3TableColumnToStorage(pTab, x1); testcase( x1!=x2 ); if( x1>=0 ) ai[x2+1] = i+1; } - sqlite3VdbeChangeP4(v, -1, (char*)ai, P4_INTARRAY); + tdsqlite3VdbeChangeP4(v, -1, (char*)ai, P4_INTARRAY); } } } @@ -145290,14 +145290,14 @@ static void codeDeferredSeek( */ static void codeExprOrVector(Parse *pParse, Expr *p, int iReg, int nReg){ assert( nReg>0 ); - if( p && sqlite3ExprIsVector(p) ){ + if( p && tdsqlite3ExprIsVector(p) ){ #ifndef SQLITE_OMIT_SUBQUERY if( (p->flags & EP_xIsSelect) ){ Vdbe *v = pParse->pVdbe; int iSelect; assert( p->op==TK_SELECT ); - iSelect = sqlite3CodeSubselect(pParse, p); - sqlite3VdbeAddOp3(v, OP_Copy, iSelect, iReg, nReg-1); + iSelect = tdsqlite3CodeSubselect(pParse, p); + tdsqlite3VdbeAddOp3(v, OP_Copy, iSelect, iReg, nReg-1); }else #endif { @@ -145305,12 +145305,12 @@ static void codeExprOrVector(Parse *pParse, Expr *p, int iReg, int nReg){ ExprList *pList = p->x.pList; assert( nReg<=pList->nExpr ); for(i=0; ia[i].pExpr, iReg+i); + tdsqlite3ExprCode(pParse, pList->a[i].pExpr, iReg+i); } } }else{ assert( nReg==1 ); - sqlite3ExprCode(pParse, p, iReg); + tdsqlite3ExprCode(pParse, p, iReg); } } @@ -145325,7 +145325,7 @@ typedef struct IdxExprTrans { int iIdxCol; /* The column for the index */ int iTabCol; /* The column for the table */ WhereInfo *pWInfo; /* Complete WHERE clause information */ - sqlite3 *db; /* Database connection (for malloc()) */ + tdsqlite3 *db; /* Database connection (for malloc()) */ } IdxExprTrans; /* @@ -145333,7 +145333,7 @@ typedef struct IdxExprTrans { */ static void preserveExpr(IdxExprTrans *pTrans, Expr *pExpr){ WhereExprMod *pNew; - pNew = sqlite3DbMallocRaw(pTrans->db, sizeof(*pNew)); + pNew = tdsqlite3DbMallocRaw(pTrans->db, sizeof(*pNew)); if( pNew==0 ) return; pNew->pNext = pTrans->pWInfo->pExprMods; pTrans->pWInfo->pExprMods = pNew; @@ -145349,9 +145349,9 @@ static void preserveExpr(IdxExprTrans *pTrans, Expr *pExpr){ */ static int whereIndexExprTransNode(Walker *p, Expr *pExpr){ IdxExprTrans *pX = p->u.pIdxTrans; - if( sqlite3ExprCompare(0, pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){ + if( tdsqlite3ExprCompare(0, pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){ preserveExpr(pX, pExpr); - pExpr->affExpr = sqlite3ExprAffinity(pExpr); + pExpr->affExpr = tdsqlite3ExprAffinity(pExpr); pExpr->op = TK_COLUMN; pExpr->iTable = pX->iIdxCur; pExpr->iColumn = pX->iIdxCol; @@ -145375,7 +145375,7 @@ static int whereIndexExprTransColumn(Walker *p, Expr *pExpr){ if( pExpr->iTable==pX->iTabCur && pExpr->iColumn==pX->iTabCol ){ assert( pExpr->y.pTab!=0 ); preserveExpr(pX, pExpr); - pExpr->affExpr = sqlite3TableColumnAffinity(pExpr->y.pTab,pExpr->iColumn); + pExpr->affExpr = tdsqlite3TableColumnAffinity(pExpr->y.pTab,pExpr->iColumn); pExpr->iTable = pX->iIdxCur; pExpr->iColumn = pX->iIdxCol; pExpr->y.pTab = 0; @@ -145423,13 +145423,13 @@ static void whereIndexExprTrans( if( iRef==XN_EXPR ){ assert( aColExpr->a[iIdxCol].pExpr!=0 ); x.pIdxExpr = aColExpr->a[iIdxCol].pExpr; - if( sqlite3ExprIsConstant(x.pIdxExpr) ) continue; + if( tdsqlite3ExprIsConstant(x.pIdxExpr) ) continue; w.xExprCallback = whereIndexExprTransNode; #ifndef SQLITE_OMIT_GENERATED_COLUMNS }else if( iRef>=0 && (pTab->aCol[iRef].colFlags & COLFLAG_VIRTUAL)!=0 && (pTab->aCol[iRef].zColl==0 - || sqlite3StrICmp(pTab->aCol[iRef].zColl, sqlite3StrBINARY)==0) + || tdsqlite3StrICmp(pTab->aCol[iRef].zColl, tdsqlite3StrBINARY)==0) ){ /* Check to see if there are direct references to generated columns ** that are contained in the index. Pulling the generated column @@ -145444,9 +145444,9 @@ static void whereIndexExprTrans( continue; } x.iIdxCol = iIdxCol; - sqlite3WalkExpr(&w, pWInfo->pWhere); - sqlite3WalkExprList(&w, pWInfo->pOrderBy); - sqlite3WalkExprList(&w, pWInfo->pResultSet); + tdsqlite3WalkExpr(&w, pWInfo->pWhere); + tdsqlite3WalkExprList(&w, pWInfo->pOrderBy); + tdsqlite3WalkExprList(&w, pWInfo->pResultSet); } } @@ -145472,7 +145472,7 @@ static void whereApplyPartialIndexConstraints( Expr *pExpr; if( pTerm->wtFlags & TERM_CODED ) continue; pExpr = pTerm->pExpr; - if( sqlite3ExprCompare(0, pExpr, pTruth, iTabCur)==0 ){ + if( tdsqlite3ExprCompare(0, pExpr, pTruth, iTabCur)==0 ){ pTerm->wtFlags |= TERM_CODED; } } @@ -145482,7 +145482,7 @@ static void whereApplyPartialIndexConstraints( ** Generate code for the start of the iLevel-th loop in the WHERE clause ** implementation described by pWInfo. */ -SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( +SQLITE_PRIVATE Bitmask tdsqlite3WhereCodeOneLoopStart( Parse *pParse, /* Parsing context */ Vdbe *v, /* Prepared statement under construction */ WhereInfo *pWInfo, /* Complete information about the WHERE clause */ @@ -145497,7 +145497,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( WhereLoop *pLoop; /* The WhereLoop object being coded */ WhereClause *pWC; /* Decomposition of the entire WHERE clause */ WhereTerm *pTerm; /* A WHERE clause term */ - sqlite3 *db; /* Database connection */ + tdsqlite3 *db; /* Database connection */ struct SrcList_item *pTabItem; /* FROM clause term being coded */ int addrBrk; /* Jump here to break out of the loop */ int addrHalt; /* addrBrk for the outermost loop */ @@ -145512,22 +145512,22 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( pLoop = pLevel->pWLoop; pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; iCur = pTabItem->iCursor; - pLevel->notReady = notReady & ~sqlite3WhereGetMask(&pWInfo->sMaskSet, iCur); + pLevel->notReady = notReady & ~tdsqlite3WhereGetMask(&pWInfo->sMaskSet, iCur); bRev = (pWInfo->revMask>>iLevel)&1; VdbeModuleComment((v, "Begin WHERE-loop%d: %s",iLevel,pTabItem->pTab->zName)); #if WHERETRACE_ENABLED /* 0x20800 */ - if( sqlite3WhereTrace & 0x800 ){ - sqlite3DebugPrintf("Coding level %d of %d: notReady=%llx iFrom=%d\n", + if( tdsqlite3WhereTrace & 0x800 ){ + tdsqlite3DebugPrintf("Coding level %d of %d: notReady=%llx iFrom=%d\n", iLevel, pWInfo->nLevel, (u64)notReady, pLevel->iFrom); - sqlite3WhereLoopPrint(pLoop, pWC); + tdsqlite3WhereLoopPrint(pLoop, pWC); } - if( sqlite3WhereTrace & 0x20000 ){ + if( tdsqlite3WhereTrace & 0x20000 ){ if( iLevel==0 ){ - sqlite3DebugPrintf("WHERE clause being coded:\n"); - sqlite3TreeViewExpr(0, pWInfo->pWhere, 0); + tdsqlite3DebugPrintf("WHERE clause being coded:\n"); + tdsqlite3TreeViewExpr(0, pWInfo->pWhere, 0); } - sqlite3DebugPrintf("All WHERE-clause terms before coding:\n"); - sqlite3WhereClausePrint(pWC); + tdsqlite3DebugPrintf("All WHERE-clause terms before coding:\n"); + tdsqlite3WhereClausePrint(pWC); } #endif @@ -145541,8 +145541,8 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** there are no IN operators in the constraints, the "addrNxt" label ** is the same as "addrBrk". */ - addrBrk = pLevel->addrBrk = pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse); - addrCont = pLevel->addrCont = sqlite3VdbeMakeLabel(pParse); + addrBrk = pLevel->addrBrk = pLevel->addrNxt = tdsqlite3VdbeMakeLabel(pParse); + addrCont = pLevel->addrCont = tdsqlite3VdbeMakeLabel(pParse); /* If this is the right table of a LEFT OUTER JOIN, allocate and ** initialize a memory cell that records if this table matches any @@ -145553,7 +145553,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ); if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){ pLevel->iLeftJoin = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin); VdbeComment((v, "init LEFT JOIN no-match flag")); } @@ -145565,8 +145565,8 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( /* Special case of a FROM clause subquery implemented as a co-routine */ if( pTabItem->fg.viaCoroutine ){ int regYield = pTabItem->regReturn; - sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub); - pLevel->p2 = sqlite3VdbeAddOp2(v, OP_Yield, regYield, addrBrk); + tdsqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub); + pLevel->p2 = tdsqlite3VdbeAddOp2(v, OP_Yield, regYield, addrBrk); VdbeCoverage(v); VdbeComment((v, "next row of %s", pTabItem->pTab->zName)); pLevel->op = OP_Goto; @@ -145582,7 +145582,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( int nConstraint = pLoop->nLTerm; int iIn; /* Counter for IN constraints */ - iReg = sqlite3GetTempRange(pParse, nConstraint+2); + iReg = tdsqlite3GetTempRange(pParse, nConstraint+2); addrNotFound = pLevel->addrBrk; for(j=0; ju.vtab.idxNum, iReg); - sqlite3VdbeAddOp2(v, OP_Integer, nConstraint, iReg+1); - sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg, + tdsqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg); + tdsqlite3VdbeAddOp2(v, OP_Integer, nConstraint, iReg+1); + tdsqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg, pLoop->u.vtab.idxStr, pLoop->u.vtab.needFree ? P4_DYNAMIC : P4_STATIC); VdbeCoverage(v); pLoop->u.vtab.needFree = 0; pLevel->p1 = iCur; pLevel->op = pWInfo->eOnePass ? OP_Noop : OP_VNext; - pLevel->p2 = sqlite3VdbeCurrentAddr(v); + pLevel->p2 = tdsqlite3VdbeCurrentAddr(v); iIn = pLevel->u.in.nIn; for(j=nConstraint-1; j>=0; j--){ pTerm = pLoop->aLTerm[j]; @@ -145613,7 +145613,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){ disableTerm(pLevel, pTerm); }else if( (pTerm->eOperator & WO_IN)!=0 - && sqlite3ExprVectorSize(pTerm->pExpr->pLeft)==1 + && tdsqlite3ExprVectorSize(pTerm->pExpr->pLeft)==1 ){ Expr *pCompare; /* The comparison operator */ Expr *pRight; /* RHS of the comparison */ @@ -145626,27 +145626,27 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( assert( pLevel->u.in.aInLoop!=0 || db->mallocFailed ); if( !db->mallocFailed ){ assert( iIn>=0 && iInu.in.nIn ); - pOp = sqlite3VdbeGetOp(v, pLevel->u.in.aInLoop[iIn].addrInTop); + pOp = tdsqlite3VdbeGetOp(v, pLevel->u.in.aInLoop[iIn].addrInTop); assert( pOp->opcode==OP_Column || pOp->opcode==OP_Rowid ); assert( pOp->opcode!=OP_Column || pOp->p3==iReg+j+2 ); assert( pOp->opcode!=OP_Rowid || pOp->p2==iReg+j+2 ); testcase( pOp->opcode==OP_Rowid ); - sqlite3VdbeAddOp3(v, pOp->opcode, pOp->p1, pOp->p2, pOp->p3); + tdsqlite3VdbeAddOp3(v, pOp->opcode, pOp->p1, pOp->p2, pOp->p3); } /* Generate code that will continue to the next row if ** the IN constraint is not satisfied */ - pCompare = sqlite3PExpr(pParse, TK_EQ, 0, 0); + pCompare = tdsqlite3PExpr(pParse, TK_EQ, 0, 0); assert( pCompare!=0 || db->mallocFailed ); if( pCompare ){ pCompare->pLeft = pTerm->pExpr->pLeft; - pCompare->pRight = pRight = sqlite3Expr(db, TK_REGISTER, 0); + pCompare->pRight = pRight = tdsqlite3Expr(db, TK_REGISTER, 0); if( pRight ){ pRight->iTable = iReg+j+2; - sqlite3ExprIfFalse(pParse, pCompare, pLevel->addrCont, 0); + tdsqlite3ExprIfFalse(pParse, pCompare, pLevel->addrCont, 0); } pCompare->pLeft = 0; - sqlite3ExprDelete(db, pCompare); + tdsqlite3ExprDelete(db, pCompare); } } } @@ -145656,7 +145656,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0. But it seems ** simpler and safer to simply not reuse the registers. ** - ** sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2); + ** tdsqlite3ReleaseTempRange(pParse, iReg, nConstraint+2); */ }else #endif /* SQLITE_OMIT_VIRTUALTABLE */ @@ -145676,9 +145676,9 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( testcase( pTerm->wtFlags & TERM_VIRTUAL ); iReleaseReg = ++pParse->nMem; iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); - if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); + if( iRowidReg!=iReleaseReg ) tdsqlite3ReleaseTempReg(pParse, iReleaseReg); addrNxt = pLevel->addrNxt; - sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); + tdsqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); VdbeCoverage(v); pLevel->op = OP_Noop; if( (pTerm->prereqAll & pLevel->notReady)==0 ){ @@ -145728,8 +145728,8 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( pX = pStart->pExpr; assert( pX!=0 ); testcase( pStart->leftCursor!=iCur ); /* transitive constraints */ - if( sqlite3ExprIsVector(pX->pRight) ){ - r1 = rTemp = sqlite3GetTempReg(pParse); + if( tdsqlite3ExprIsVector(pX->pRight) ){ + r1 = rTemp = tdsqlite3GetTempReg(pParse); codeExprOrVector(pParse, pX->pRight, r1, 1); testcase( pX->op==TK_GT ); testcase( pX->op==TK_GE ); @@ -145741,19 +145741,19 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( assert( pX->op!=TK_LT || op==OP_SeekLE ); assert( pX->op!=TK_LE || op==OP_SeekLE ); }else{ - r1 = sqlite3ExprCodeTemp(pParse, pX->pRight, &rTemp); + r1 = tdsqlite3ExprCodeTemp(pParse, pX->pRight, &rTemp); disableTerm(pLevel, pStart); op = aMoveOp[(pX->op - TK_GT)]; } - sqlite3VdbeAddOp3(v, op, iCur, addrBrk, r1); + tdsqlite3VdbeAddOp3(v, op, iCur, addrBrk, r1); VdbeComment((v, "pk")); VdbeCoverageIf(v, pX->op==TK_GT); VdbeCoverageIf(v, pX->op==TK_LE); VdbeCoverageIf(v, pX->op==TK_LT); VdbeCoverageIf(v, pX->op==TK_GE); - sqlite3ReleaseTempReg(pParse, rTemp); + tdsqlite3ReleaseTempReg(pParse, rTemp); }else{ - sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrHalt); + tdsqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrHalt); VdbeCoverageIf(v, bRev==0); VdbeCoverageIf(v, bRev!=0); } @@ -145766,31 +145766,31 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( testcase( pEnd->wtFlags & TERM_VIRTUAL ); memEndValue = ++pParse->nMem; codeExprOrVector(pParse, pX->pRight, memEndValue, 1); - if( 0==sqlite3ExprIsVector(pX->pRight) + if( 0==tdsqlite3ExprIsVector(pX->pRight) && (pX->op==TK_LT || pX->op==TK_GT) ){ testOp = bRev ? OP_Le : OP_Ge; }else{ testOp = bRev ? OP_Lt : OP_Gt; } - if( 0==sqlite3ExprIsVector(pX->pRight) ){ + if( 0==tdsqlite3ExprIsVector(pX->pRight) ){ disableTerm(pLevel, pEnd); } } - start = sqlite3VdbeCurrentAddr(v); + start = tdsqlite3VdbeCurrentAddr(v); pLevel->op = bRev ? OP_Prev : OP_Next; pLevel->p1 = iCur; pLevel->p2 = start; assert( pLevel->p5==0 ); if( testOp!=OP_Noop ){ iRowidReg = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Rowid, iCur, iRowidReg); - sqlite3VdbeAddOp3(v, testOp, memEndValue, addrBrk, iRowidReg); + tdsqlite3VdbeAddOp2(v, OP_Rowid, iCur, iRowidReg); + tdsqlite3VdbeAddOp3(v, testOp, memEndValue, addrBrk, iRowidReg); VdbeCoverageIf(v, testOp==OP_Le); VdbeCoverageIf(v, testOp==OP_Lt); VdbeCoverageIf(v, testOp==OP_Ge); VdbeCoverageIf(v, testOp==OP_Gt); - sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL); + tdsqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL); } }else if( pLoop->wsFlags & WHERE_INDEXED ){ /* Case 4: A scan using an index. @@ -145883,9 +145883,9 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( assert( pRangeStart!=0 ); /* LIKE opt constraints */ assert( pRangeStart->wtFlags & TERM_LIKEOPT ); /* occur in pairs */ pLevel->iLikeRepCntr = (u32)++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Integer, 1, (int)pLevel->iLikeRepCntr); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, (int)pLevel->iLikeRepCntr); VdbeComment((v, "LIKE loop counter")); - pLevel->addrLikeRep = sqlite3VdbeCurrentAddr(v); + pLevel->addrLikeRep = tdsqlite3VdbeCurrentAddr(v); /* iLikeRepCntr actually stores 2x the counter register number. The ** bottom bit indicates whether the search order is ASC or DESC. */ testcase( bRev ); @@ -145920,7 +145920,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( nExtraReg = 1; bSeekPastNull = 1; pLevel->regBignull = regBignull = ++pParse->nMem; - pLevel->addrBignull = sqlite3VdbeMakeLabel(pParse); + pLevel->addrBignull = tdsqlite3VdbeMakeLabel(pParse); } /* If we are doing a reverse order scan on an ascending index, or @@ -145941,9 +145941,9 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( */ codeCursorHint(pTabItem, pWInfo, pLevel, pRangeEnd); regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); - assert( zStartAff==0 || sqlite3Strlen30(zStartAff)>=nEq ); + assert( zStartAff==0 || tdsqlite3Strlen30(zStartAff)>=nEq ); if( zStartAff && nTop ){ - zEndAff = sqlite3DbStrDup(db, &zStartAff[nEq]); + zEndAff = tdsqlite3DbStrDup(db, &zStartAff[nEq]); } addrNxt = (regBignull ? pLevel->addrBignull : pLevel->addrNxt); @@ -145962,9 +145962,9 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( codeExprOrVector(pParse, pRight, regBase+nEq, nBtm); whereLikeOptimizationStringFixup(v, pLevel, pRangeStart); if( (pRangeStart->wtFlags & TERM_VNULL)==0 - && sqlite3ExprCanBeNull(pRight) + && tdsqlite3ExprCanBeNull(pRight) ){ - sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt); + tdsqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt); VdbeCoverage(v); } if( zStartAff ){ @@ -145972,7 +145972,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( } nConstraint += nBtm; testcase( pRangeStart->wtFlags & TERM_VIRTUAL ); - if( sqlite3ExprIsVector(pRight)==0 ){ + if( tdsqlite3ExprIsVector(pRight)==0 ){ disableTerm(pLevel, pRangeStart); }else{ startEq = 1; @@ -145980,11 +145980,11 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( bSeekPastNull = 0; }else if( bSeekPastNull ){ startEq = 0; - sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); start_constraints = 1; nConstraint++; }else if( regBignull ){ - sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); start_constraints = 1; nConstraint++; } @@ -145995,16 +145995,16 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** so no further seeking is needed */ }else{ if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){ - sqlite3VdbeAddOp1(v, OP_SeekHit, iIdxCur); + tdsqlite3VdbeAddOp1(v, OP_SeekHit, iIdxCur); } if( regBignull ){ - sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull); VdbeComment((v, "NULL-scan pass ctr")); } op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev]; assert( op!=0 ); - sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); + tdsqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); VdbeCoverage(v); VdbeCoverageIf(v, op==OP_Rewind); testcase( op==OP_Rewind ); VdbeCoverageIf(v, op==OP_Last); testcase( op==OP_Last ); @@ -146018,9 +146018,9 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( assert( bSeekPastNull==1 || bStopAtNull==1 ); assert( bSeekPastNull==!bStopAtNull ); assert( bStopAtNull==startEq ); - sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, tdsqlite3VdbeCurrentAddr(v)+2); op = aStartOp[(nConstraint>1)*4 + 2 + bRev]; - sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, + tdsqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint-startEq); VdbeCoverage(v); VdbeCoverageIf(v, op==OP_Rewind); testcase( op==OP_Rewind ); @@ -146040,9 +146040,9 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( codeExprOrVector(pParse, pRight, regBase+nEq, nTop); whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd); if( (pRangeEnd->wtFlags & TERM_VNULL)==0 - && sqlite3ExprCanBeNull(pRight) + && tdsqlite3ExprCanBeNull(pRight) ){ - sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt); + tdsqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt); VdbeCoverage(v); } if( zEndAff ){ @@ -146054,34 +146054,34 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( nConstraint += nTop; testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); - if( sqlite3ExprIsVector(pRight)==0 ){ + if( tdsqlite3ExprIsVector(pRight)==0 ){ disableTerm(pLevel, pRangeEnd); }else{ endEq = 1; } }else if( bStopAtNull ){ if( regBignull==0 ){ - sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); endEq = 0; } nConstraint++; } - sqlite3DbFree(db, zStartAff); - sqlite3DbFree(db, zEndAff); + tdsqlite3DbFree(db, zStartAff); + tdsqlite3DbFree(db, zEndAff); /* Top of the loop body */ - pLevel->p2 = sqlite3VdbeCurrentAddr(v); + pLevel->p2 = tdsqlite3VdbeCurrentAddr(v); /* Check if the index cursor is past the end of the range. */ if( nConstraint ){ if( regBignull ){ /* Except, skip the end-of-range check while doing the NULL-scan */ - sqlite3VdbeAddOp2(v, OP_IfNot, regBignull, sqlite3VdbeCurrentAddr(v)+3); + tdsqlite3VdbeAddOp2(v, OP_IfNot, regBignull, tdsqlite3VdbeCurrentAddr(v)+3); VdbeComment((v, "If NULL-scan 2nd pass")); VdbeCoverage(v); } op = aEndOp[bRev*2 + endEq]; - sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); + tdsqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); testcase( op==OP_IdxGT ); VdbeCoverageIf(v, op==OP_IdxGT ); testcase( op==OP_IdxGE ); VdbeCoverageIf(v, op==OP_IdxGE ); testcase( op==OP_IdxLT ); VdbeCoverageIf(v, op==OP_IdxLT ); @@ -146093,11 +146093,11 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( assert( bSeekPastNull==!bStopAtNull ); assert( bSeekPastNull+bStopAtNull==1 ); assert( nConstraint+bSeekPastNull>0 ); - sqlite3VdbeAddOp2(v, OP_If, regBignull, sqlite3VdbeCurrentAddr(v)+2); + tdsqlite3VdbeAddOp2(v, OP_If, regBignull, tdsqlite3VdbeCurrentAddr(v)+2); VdbeComment((v, "If NULL-scan 1st pass")); VdbeCoverage(v); op = aEndOp[bRev*2 + bSeekPastNull]; - sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, + tdsqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint+bSeekPastNull); testcase( op==OP_IdxGT ); VdbeCoverageIf(v, op==OP_IdxGT ); testcase( op==OP_IdxGE ); VdbeCoverageIf(v, op==OP_IdxGE ); @@ -146106,7 +146106,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( } if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){ - sqlite3VdbeAddOp2(v, OP_SeekHit, iIdxCur, 1); + tdsqlite3VdbeAddOp2(v, OP_SeekHit, iIdxCur, 1); } /* Seek the table cursor, if required */ @@ -146120,20 +146120,20 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( && (pWInfo->eOnePass==ONEPASS_SINGLE || pLoop->nLTerm==0) ) ){ iRowidReg = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg); - sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg); + tdsqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg); + tdsqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg); VdbeCoverage(v); }else{ codeDeferredSeek(pWInfo, pIdx, iCur, iIdxCur); } }else if( iCur!=iIdxCur ){ - Index *pPk = sqlite3PrimaryKeyIndex(pIdx->pTable); - iRowidReg = sqlite3GetTempRange(pParse, pPk->nKeyCol); + Index *pPk = tdsqlite3PrimaryKeyIndex(pIdx->pTable); + iRowidReg = tdsqlite3GetTempRange(pParse, pPk->nKeyCol); for(j=0; jnKeyCol; j++){ - k = sqlite3TableColumnToIndex(pIdx, pPk->aiColumn[j]); - sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, k, iRowidReg+j); + k = tdsqlite3TableColumnToIndex(pIdx, pPk->aiColumn[j]); + tdsqlite3VdbeAddOp3(v, OP_Column, iIdxCur, k, iRowidReg+j); } - sqlite3VdbeAddOp4Int(v, OP_NotFound, iCur, addrCont, + tdsqlite3VdbeAddOp4Int(v, OP_NotFound, iCur, addrCont, iRowidReg, pPk->nKeyCol); VdbeCoverage(v); } @@ -146218,10 +146218,10 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** into the RowSet. If it is already present, control skips the ** Gosub opcode and jumps straight to the code generated by WhereEnd(). ** - ** sqlite3WhereBegin() + ** tdsqlite3WhereBegin() ** RowSetTest # Insert rowid into rowset ** Gosub 2 A - ** sqlite3WhereEnd() + ** tdsqlite3WhereEnd() ** ** Following the above, code to terminate the loop. Label A, the target ** of the Gosub above, jumps to the instruction right after the Goto. @@ -146248,7 +146248,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( int regReturn = ++pParse->nMem; /* Register used with OP_Gosub */ int regRowset = 0; /* Register for RowSet object */ int regRowid = 0; /* Register holding rowid */ - int iLoopBody = sqlite3VdbeMakeLabel(pParse);/* Start of loop body */ + int iLoopBody = tdsqlite3VdbeMakeLabel(pParse);/* Start of loop body */ int iRetInit; /* Address of regReturn init */ int untestedTerms = 0; /* Some terms not completely tested */ int ii; /* Loop counter */ @@ -146266,13 +146266,13 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( /* Set up a new SrcList in pOrTab containing the table being scanned ** by this loop in the a[0] slot and all notReady tables in a[1..] slots. - ** This becomes the SrcList in the recursive call to sqlite3WhereBegin(). + ** This becomes the SrcList in the recursive call to tdsqlite3WhereBegin(). */ if( pWInfo->nLevel>1 ){ int nNotReady; /* The number of notReady tables */ struct SrcList_item *origSrc; /* Original list of tables */ nNotReady = pWInfo->nLevel - iLevel - 1; - pOrTab = sqlite3StackAllocRaw(db, + pOrTab = tdsqlite3StackAllocRaw(db, sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0])); if( pOrTab==0 ) return notReady; pOrTab->nAlloc = (u8)(nNotReady + 1); @@ -146301,21 +146301,21 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){ if( HasRowid(pTab) ){ regRowset = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Null, 0, regRowset); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, regRowset); }else{ - Index *pPk = sqlite3PrimaryKeyIndex(pTab); + Index *pPk = tdsqlite3PrimaryKeyIndex(pTab); regRowset = pParse->nTab++; - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, regRowset, pPk->nKeyCol); - sqlite3VdbeSetP4KeyInfo(pParse, pPk); + tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, regRowset, pPk->nKeyCol); + tdsqlite3VdbeSetP4KeyInfo(pParse, pPk); } regRowid = ++pParse->nMem; } - iRetInit = sqlite3VdbeAddOp2(v, OP_Integer, 0, regReturn); + iRetInit = tdsqlite3VdbeAddOp2(v, OP_Integer, 0, regReturn); /* If the original WHERE clause is z of the form: (x1 OR x2 OR ...) AND y ** Then for every term xN, evaluate as the subexpression: xN AND z ** That way, terms in y that are factored into the disjunction will - ** be picked up by the recursive calls to sqlite3WhereBegin() below. + ** be picked up by the recursive calls to tdsqlite3WhereBegin() below. ** ** Actually, each subexpression is converted to "xN AND w" where w is ** the "interesting" terms of z - terms that did not originate in the @@ -146336,16 +146336,16 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue; if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO ); - pExpr = sqlite3ExprDup(db, pExpr, 0); - pAndExpr = sqlite3ExprAnd(pParse, pAndExpr, pExpr); + pExpr = tdsqlite3ExprDup(db, pExpr, 0); + pAndExpr = tdsqlite3ExprAnd(pParse, pAndExpr, pExpr); } if( pAndExpr ){ /* The extra 0x10000 bit on the opcode is masked off and does not ** become part of the new Expr.op. However, it does make the - ** op==TK_AND comparison inside of sqlite3PExpr() false, and this - ** prevents sqlite3PExpr() from implementing AND short-circuit + ** op==TK_AND comparison inside of tdsqlite3PExpr() false, and this + ** prevents tdsqlite3PExpr() from implementing AND short-circuit ** optimization, which we do not want here. */ - pAndExpr = sqlite3PExpr(pParse, TK_AND|0x10000, 0, pAndExpr); + pAndExpr = tdsqlite3PExpr(pParse, TK_AND|0x10000, 0, pAndExpr); } } @@ -146371,15 +146371,15 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( /* Loop through table entries that match term pOrTerm. */ ExplainQueryPlan((pParse, 1, "INDEX %d", ii+1)); WHERETRACE(0xffff, ("Subplan for OR-clause:\n")); - pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, + pSubWInfo = tdsqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, wctrlFlags, iCovCur); assert( pSubWInfo || pParse->nErr || db->mallocFailed ); if( pSubWInfo ){ WhereLoop *pSubLoop; - int addrExplain = sqlite3WhereExplainOneScan( + int addrExplain = tdsqlite3WhereExplainOneScan( pParse, pOrTab, &pSubWInfo->a[0], 0 ); - sqlite3WhereAddScanStatus(v, pOrTab, &pSubWInfo->a[0], addrExplain); + tdsqlite3WhereAddScanStatus(v, pOrTab, &pSubWInfo->a[0], addrExplain); /* This is the sub-WHERE clause body. First skip over ** duplicate rows from prior sub-WHERE clauses, and record the @@ -146389,21 +146389,21 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){ int iSet = ((ii==pOrWc->nTerm-1)?-1:ii); if( HasRowid(pTab) ){ - sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, -1, regRowid); - jmp1 = sqlite3VdbeAddOp4Int(v, OP_RowSetTest, regRowset, 0, + tdsqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, -1, regRowid); + jmp1 = tdsqlite3VdbeAddOp4Int(v, OP_RowSetTest, regRowset, 0, regRowid, iSet); VdbeCoverage(v); }else{ - Index *pPk = sqlite3PrimaryKeyIndex(pTab); + Index *pPk = tdsqlite3PrimaryKeyIndex(pTab); int nPk = pPk->nKeyCol; int iPk; int r; /* Read the PK into an array of temp registers. */ - r = sqlite3GetTempRange(pParse, nPk); + r = tdsqlite3GetTempRange(pParse, nPk); for(iPk=0; iPkaiColumn[iPk]; - sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, iCol,r+iPk); + tdsqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, iCol,r+iPk); } /* Check if the temp table already contains this key. If so, @@ -146418,27 +146418,27 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** need to insert the key into the temp table, as it will never ** be tested for. */ if( iSet ){ - jmp1 = sqlite3VdbeAddOp4Int(v, OP_Found, regRowset, 0, r, nPk); + jmp1 = tdsqlite3VdbeAddOp4Int(v, OP_Found, regRowset, 0, r, nPk); VdbeCoverage(v); } if( iSet>=0 ){ - sqlite3VdbeAddOp3(v, OP_MakeRecord, r, nPk, regRowid); - sqlite3VdbeAddOp4Int(v, OP_IdxInsert, regRowset, regRowid, + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, r, nPk, regRowid); + tdsqlite3VdbeAddOp4Int(v, OP_IdxInsert, regRowset, regRowid, r, nPk); - if( iSet ) sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); + if( iSet ) tdsqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); } /* Release the array of temp registers */ - sqlite3ReleaseTempRange(pParse, r, nPk); + tdsqlite3ReleaseTempRange(pParse, r, nPk); } } /* Invoke the main loop body as a subroutine */ - sqlite3VdbeAddOp2(v, OP_Gosub, regReturn, iLoopBody); + tdsqlite3VdbeAddOp2(v, OP_Gosub, regReturn, iLoopBody); /* Jump here (skipping the main loop body subroutine) if the ** current sub-WHERE row is a duplicate from prior sub-WHEREs. */ - if( jmp1 ) sqlite3VdbeJumpHere(v, jmp1); + if( jmp1 ) tdsqlite3VdbeJumpHere(v, jmp1); /* The pSubWInfo->untestedTerms flag means that this OR term ** contained one or more AND term from a notReady table. The @@ -146449,10 +146449,10 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( /* If all of the OR-connected terms are optimized using the same ** index, and the index is opened using the same cursor number - ** by each call to sqlite3WhereBegin() made by this loop, it may + ** by each call to tdsqlite3WhereBegin() made by this loop, it may ** be possible to use that index as a covering index. ** - ** If the call to sqlite3WhereBegin() above resulted in a scan that + ** If the call to tdsqlite3WhereBegin() above resulted in a scan that ** uses an index, and this is either the first OR-connected term ** processed or the index is the same as that used by all previous ** terms, set pCov to the candidate covering index. Otherwise, set @@ -146472,7 +146472,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( } /* Finish the loop through table entries that match term pOrTerm. */ - sqlite3WhereEnd(pSubWInfo); + tdsqlite3WhereEnd(pSubWInfo); ExplainQueryPlanPop(pParse); } } @@ -146482,13 +146482,13 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( if( pCov ) pLevel->iIdxCur = iCovCur; if( pAndExpr ){ pAndExpr->pLeft = 0; - sqlite3ExprDelete(db, pAndExpr); + tdsqlite3ExprDelete(db, pAndExpr); } - sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); - sqlite3VdbeGoto(v, pLevel->addrBrk); - sqlite3VdbeResolveLabel(v, iLoopBody); + tdsqlite3VdbeChangeP1(v, iRetInit, tdsqlite3VdbeCurrentAddr(v)); + tdsqlite3VdbeGoto(v, pLevel->addrBrk); + tdsqlite3VdbeResolveLabel(v, iLoopBody); - if( pWInfo->nLevel>1 ){ sqlite3StackFree(db, pOrTab); } + if( pWInfo->nLevel>1 ){ tdsqlite3StackFree(db, pOrTab); } if( !untestedTerms ) disableTerm(pLevel, pTerm); }else #endif /* SQLITE_OMIT_OR_OPTIMIZATION */ @@ -146508,7 +146508,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( codeCursorHint(pTabItem, pWInfo, pLevel, 0); pLevel->op = aStep[bRev]; pLevel->p1 = iCur; - pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrHalt); + pLevel->p2 = 1 + tdsqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrHalt); VdbeCoverageIf(v, bRev==0); VdbeCoverageIf(v, bRev!=0); pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP; @@ -146516,7 +146516,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( } #ifdef SQLITE_ENABLE_STMT_SCANSTATUS - pLevel->addrVisit = sqlite3VdbeCurrentAddr(v); + pLevel->addrVisit = tdsqlite3VdbeCurrentAddr(v); #endif /* Insert code to test every subexpression that can be completely @@ -146554,7 +146554,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( continue; } - if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){ + if( iLoop==1 && !tdsqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){ iNext = 2; continue; } @@ -146574,24 +146574,24 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( #else u32 x = pLevel->iLikeRepCntr; if( x>0 ){ - skipLikeAddr = sqlite3VdbeAddOp1(v, (x&1)?OP_IfNot:OP_If,(int)(x>>1)); + skipLikeAddr = tdsqlite3VdbeAddOp1(v, (x&1)?OP_IfNot:OP_If,(int)(x>>1)); VdbeCoverageIf(v, (x&1)==1); VdbeCoverageIf(v, (x&1)==0); } #endif } #ifdef WHERETRACE_ENABLED /* 0xffff */ - if( sqlite3WhereTrace ){ + if( tdsqlite3WhereTrace ){ VdbeNoopComment((v, "WhereTerm[%d] (%p) priority=%d", pWC->nTerm-j, pTerm, iLoop)); } - if( sqlite3WhereTrace & 0x800 ){ - sqlite3DebugPrintf("Coding auxiliary constraint:\n"); - sqlite3WhereTermPrint(pTerm, pWC->nTerm-j); + if( tdsqlite3WhereTrace & 0x800 ){ + tdsqlite3DebugPrintf("Coding auxiliary constraint:\n"); + tdsqlite3WhereTermPrint(pTerm, pWC->nTerm-j); } #endif - sqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL); - if( skipLikeAddr ) sqlite3VdbeJumpHere(v, skipLikeAddr); + tdsqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL); + if( skipLikeAddr ) tdsqlite3VdbeJumpHere(v, skipLikeAddr); pTerm->wtFlags |= TERM_CODED; } iLoop = iNext; @@ -146615,14 +146615,14 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( if( pTabItem->fg.jointype & JT_LEFT ) continue; pE = pTerm->pExpr; #ifdef WHERETRACE_ENABLED /* 0x800 */ - if( sqlite3WhereTrace & 0x800 ){ - sqlite3DebugPrintf("Coding transitive constraint:\n"); - sqlite3WhereTermPrint(pTerm, pWC->nTerm-j); + if( tdsqlite3WhereTrace & 0x800 ){ + tdsqlite3DebugPrintf("Coding transitive constraint:\n"); + tdsqlite3WhereTermPrint(pTerm, pWC->nTerm-j); } #endif assert( !ExprHasProperty(pE, EP_FromJoin) ); assert( (pTerm->prereqRight & pLevel->notReady)!=0 ); - pAlt = sqlite3WhereFindTerm(pWC, iCur, pTerm->u.leftColumn, notReady, + pAlt = tdsqlite3WhereFindTerm(pWC, iCur, pTerm->u.leftColumn, notReady, WO_EQ|WO_IN|WO_IS, 0); if( pAlt==0 ) continue; if( pAlt->wtFlags & (TERM_CODED) ) continue; @@ -146638,15 +146638,15 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( VdbeModuleComment((v, "begin transitive constraint")); sEAlt = *pAlt->pExpr; sEAlt.pLeft = pE->pLeft; - sqlite3ExprIfFalse(pParse, &sEAlt, addrCont, SQLITE_JUMPIFNULL); + tdsqlite3ExprIfFalse(pParse, &sEAlt, addrCont, SQLITE_JUMPIFNULL); } /* For a LEFT OUTER JOIN, generate code that will record the fact that ** at least one row of the right table has matched the left table. */ if( pLevel->iLeftJoin ){ - pLevel->addrFirst = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin); + pLevel->addrFirst = tdsqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin); VdbeComment((v, "record LEFT JOIN hit")); for(pTerm=pWC->a, j=0; jnTerm; j++, pTerm++){ testcase( pTerm->wtFlags & TERM_VIRTUAL ); @@ -146657,19 +146657,19 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( continue; } assert( pTerm->pExpr ); - sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL); + tdsqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL); pTerm->wtFlags |= TERM_CODED; } } #if WHERETRACE_ENABLED /* 0x20800 */ - if( sqlite3WhereTrace & 0x20000 ){ - sqlite3DebugPrintf("All WHERE-clause terms after coding level %d:\n", + if( tdsqlite3WhereTrace & 0x20000 ){ + tdsqlite3DebugPrintf("All WHERE-clause terms after coding level %d:\n", iLevel); - sqlite3WhereClausePrint(pWC); + tdsqlite3WhereClausePrint(pWC); } - if( sqlite3WhereTrace & 0x800 ){ - sqlite3DebugPrintf("End Coding level %d: notReady=%llx\n", + if( tdsqlite3WhereTrace & 0x800 ){ + tdsqlite3DebugPrintf("End Coding level %d: notReady=%llx\n", iLevel, (u64)pLevel->notReady); } #endif @@ -146705,17 +146705,17 @@ static void exprAnalyze(SrcList*, WhereClause*, int); /* ** Deallocate all memory associated with a WhereOrInfo object. */ -static void whereOrInfoDelete(sqlite3 *db, WhereOrInfo *p){ - sqlite3WhereClauseClear(&p->wc); - sqlite3DbFree(db, p); +static void whereOrInfoDelete(tdsqlite3 *db, WhereOrInfo *p){ + tdsqlite3WhereClauseClear(&p->wc); + tdsqlite3DbFree(db, p); } /* ** Deallocate all memory associated with a WhereAndInfo object. */ -static void whereAndInfoDelete(sqlite3 *db, WhereAndInfo *p){ - sqlite3WhereClauseClear(&p->wc); - sqlite3DbFree(db, p); +static void whereAndInfoDelete(tdsqlite3 *db, WhereAndInfo *p){ + tdsqlite3WhereClauseClear(&p->wc); + tdsqlite3DbFree(db, p); } /* @@ -146743,28 +146743,28 @@ static int whereClauseInsert(WhereClause *pWC, Expr *p, u16 wtFlags){ testcase( wtFlags & TERM_VIRTUAL ); if( pWC->nTerm>=pWC->nSlot ){ WhereTerm *pOld = pWC->a; - sqlite3 *db = pWC->pWInfo->pParse->db; - pWC->a = sqlite3DbMallocRawNN(db, sizeof(pWC->a[0])*pWC->nSlot*2 ); + tdsqlite3 *db = pWC->pWInfo->pParse->db; + pWC->a = tdsqlite3DbMallocRawNN(db, sizeof(pWC->a[0])*pWC->nSlot*2 ); if( pWC->a==0 ){ if( wtFlags & TERM_DYNAMIC ){ - sqlite3ExprDelete(db, p); + tdsqlite3ExprDelete(db, p); } pWC->a = pOld; return 0; } memcpy(pWC->a, pOld, sizeof(pWC->a[0])*pWC->nTerm); if( pOld!=pWC->aStatic ){ - sqlite3DbFree(db, pOld); + tdsqlite3DbFree(db, pOld); } - pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]); + pWC->nSlot = tdsqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]); } pTerm = &pWC->a[idx = pWC->nTerm++]; if( p && ExprHasProperty(p, EP_Unlikely) ){ - pTerm->truthProb = sqlite3LogEst(p->iTable) - 270; + pTerm->truthProb = tdsqlite3LogEst(p->iTable) - 270; }else{ pTerm->truthProb = 1; } - pTerm->pExpr = sqlite3ExprSkipCollateAndLikely(p); + pTerm->pExpr = tdsqlite3ExprSkipCollateAndLikely(p); pTerm->wtFlags = wtFlags; pTerm->pWC = pWC; pTerm->iParent = -1; @@ -146793,8 +146793,8 @@ static int allowedOp(int op){ static u16 exprCommute(Parse *pParse, Expr *pExpr){ if( pExpr->pLeft->op==TK_VECTOR || pExpr->pRight->op==TK_VECTOR - || sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight) != - sqlite3BinaryCompareCollSeq(pParse, pExpr->pRight, pExpr->pLeft) + || tdsqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight) != + tdsqlite3BinaryCompareCollSeq(pParse, pExpr->pRight, pExpr->pLeft) ){ pExpr->flags ^= EP_Commuted; } @@ -146864,12 +146864,12 @@ static int isLikeOrGlob( u8 c; /* One character in z[] */ int cnt; /* Number of non-wildcard prefix characters */ u8 wc[4]; /* Wildcard characters */ - sqlite3 *db = pParse->db; /* Database connection */ - sqlite3_value *pVal = 0; + tdsqlite3 *db = pParse->db; /* Database connection */ + tdsqlite3_value *pVal = 0; int op; /* Opcode of pRight */ int rc; /* Result code to return */ - if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, (char*)wc) ){ + if( !tdsqlite3IsLikeFunction(db, pExpr, pnoCase, (char*)wc) ){ return 0; } #ifdef SQLITE_EBCDIC @@ -146878,16 +146878,16 @@ static int isLikeOrGlob( pList = pExpr->x.pList; pLeft = pList->a[1].pExpr; - pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr); + pRight = tdsqlite3ExprSkipCollate(pList->a[0].pExpr); op = pRight->op; if( op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){ Vdbe *pReprepare = pParse->pReprepare; int iCol = pRight->iColumn; - pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB); - if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){ - z = sqlite3_value_text(pVal); + pVal = tdsqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB); + if( pVal && tdsqlite3_value_type(pVal)==SQLITE_TEXT ){ + z = tdsqlite3_value_text(pVal); } - sqlite3VdbeSetVarmask(pParse->pVdbe, iCol); + tdsqlite3VdbeSetVarmask(pParse->pVdbe, iCol); assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER ); }else if( op==TK_STRING ){ z = (u8*)pRight->u.zToken; @@ -146916,7 +146916,7 @@ static int isLikeOrGlob( *pisComplete = c==wc[0] && z[cnt+1]==0; /* Get the pattern prefix. Remove all escapes from the prefix. */ - pPrefix = sqlite3Expr(db, TK_STRING, (char*)z); + pPrefix = tdsqlite3Expr(db, TK_STRING, (char*)z); if( pPrefix ){ int iFrom, iTo; char *zNew = pPrefix->u.zToken; @@ -146942,24 +146942,24 @@ static int isLikeOrGlob( ** 2019-09-03 https://sqlite.org/src/info/0f0428096f17252a */ if( pLeft->op!=TK_COLUMN - || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT + || tdsqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT || IsVirtual(pLeft->y.pTab) /* Value might be numeric */ ){ int isNum; double rDummy; - isNum = sqlite3AtoF(zNew, &rDummy, iTo, SQLITE_UTF8); + isNum = tdsqlite3AtoF(zNew, &rDummy, iTo, SQLITE_UTF8); if( isNum<=0 ){ if( iTo==1 && zNew[0]=='-' ){ isNum = +1; }else{ zNew[iTo-1]++; - isNum = sqlite3AtoF(zNew, &rDummy, iTo, SQLITE_UTF8); + isNum = tdsqlite3AtoF(zNew, &rDummy, iTo, SQLITE_UTF8); zNew[iTo-1]--; } } if( isNum>0 ){ - sqlite3ExprDelete(db, pPrefix); - sqlite3ValueFree(pVal); + tdsqlite3ExprDelete(db, pPrefix); + tdsqlite3ValueFree(pVal); return 0; } } @@ -146970,18 +146970,18 @@ static int isLikeOrGlob( ** reprepare the statement when that parameter is rebound */ if( op==TK_VARIABLE ){ Vdbe *v = pParse->pVdbe; - sqlite3VdbeSetVarmask(v, pRight->iColumn); + tdsqlite3VdbeSetVarmask(v, pRight->iColumn); if( *pisComplete && pRight->u.zToken[1] ){ /* If the rhs of the LIKE expression is a variable, and the current ** value of the variable means there is no need to invoke the LIKE ** function, then no OP_Variable will be added to the program. - ** This causes problems for the sqlite3_bind_parameter_name() + ** This causes problems for the tdsqlite3_bind_parameter_name() ** API. To work around them, add a dummy OP_Variable here. */ - int r1 = sqlite3GetTempReg(pParse); - sqlite3ExprCodeTarget(pParse, pRight, r1); - sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0); - sqlite3ReleaseTempReg(pParse, r1); + int r1 = tdsqlite3GetTempReg(pParse); + tdsqlite3ExprCodeTarget(pParse, pRight, r1); + tdsqlite3VdbeChangeP3(v, tdsqlite3VdbeCurrentAddr(v)-1, 0); + tdsqlite3ReleaseTempReg(pParse, r1); } } }else{ @@ -146990,7 +146990,7 @@ static int isLikeOrGlob( } rc = (z!=0); - sqlite3ValueFree(pVal); + tdsqlite3ValueFree(pVal); return rc; } #endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */ @@ -147024,7 +147024,7 @@ static int isLikeOrGlob( ** If the expression matches none of the patterns above, return 0. */ static int isAuxiliaryVtabOperator( - sqlite3 *db, /* Parsing context */ + tdsqlite3 *db, /* Parsing context */ Expr *pExpr, /* Test this expression */ unsigned char *peOp2, /* OUT: 0 for MATCH, or else an op2 value */ Expr **ppLeft, /* Column expression to left of MATCH/op2 */ @@ -147059,7 +147059,7 @@ static int isAuxiliaryVtabOperator( pCol = pList->a[1].pExpr; if( pCol->op==TK_COLUMN && IsVirtual(pCol->y.pTab) ){ for(i=0; iu.zToken, aOp[i].zOp)==0 ){ + if( tdsqlite3StrICmp(pExpr->u.zToken, aOp[i].zOp)==0 ){ *peOp2 = aOp[i].eOp2; *ppRight = pList->a[0].pExpr; *ppLeft = pCol; @@ -147080,14 +147080,14 @@ static int isAuxiliaryVtabOperator( */ pCol = pList->a[0].pExpr; if( pCol->op==TK_COLUMN && IsVirtual(pCol->y.pTab) ){ - sqlite3_vtab *pVtab; - sqlite3_module *pMod; - void (*xNotUsed)(sqlite3_context*,int,sqlite3_value**); + tdsqlite3_vtab *pVtab; + tdsqlite3_module *pMod; + void (*xNotUsed)(tdsqlite3_context*,int,tdsqlite3_value**); void *pNotUsed; - pVtab = sqlite3GetVTable(db, pCol->y.pTab)->pVtab; + pVtab = tdsqlite3GetVTable(db, pCol->y.pTab)->pVtab; assert( pVtab!=0 ); assert( pVtab->pModule!=0 ); - pMod = (sqlite3_module *)pVtab->pModule; + pMod = (tdsqlite3_module *)pVtab->pModule; if( pMod->xFindFunction!=0 ){ i = pMod->xFindFunction(pVtab,2, pExpr->u.zToken, &xNotUsed, &pNotUsed); if( i>=SQLITE_INDEX_CONSTRAINT_FUNCTION ){ @@ -147182,7 +147182,7 @@ static void whereCombineDisjuncts( WhereTerm *pTwo /* Second disjunct */ ){ u16 eOp = pOne->eOperator | pTwo->eOperator; - sqlite3 *db; /* Database connection (for malloc) */ + tdsqlite3 *db; /* Database connection (for malloc) */ Expr *pNew; /* New virtual expression */ int op; /* Operator for the combined expression */ int idxNew; /* Index in pWC of the next virtual term */ @@ -147193,8 +147193,8 @@ static void whereCombineDisjuncts( && (eOp & (WO_EQ|WO_GT|WO_GE))!=eOp ) return; assert( pOne->pExpr->pLeft!=0 && pOne->pExpr->pRight!=0 ); assert( pTwo->pExpr->pLeft!=0 && pTwo->pExpr->pRight!=0 ); - if( sqlite3ExprCompare(0,pOne->pExpr->pLeft, pTwo->pExpr->pLeft, -1) ) return; - if( sqlite3ExprCompare(0,pOne->pExpr->pRight, pTwo->pExpr->pRight,-1) )return; + if( tdsqlite3ExprCompare(0,pOne->pExpr->pLeft, pTwo->pExpr->pLeft, -1) ) return; + if( tdsqlite3ExprCompare(0,pOne->pExpr->pRight, pTwo->pExpr->pRight,-1) )return; /* If we reach this point, it means the two subterms can be combined */ if( (eOp & (eOp-1))!=0 ){ if( eOp & (WO_LT|WO_LE) ){ @@ -147205,7 +147205,7 @@ static void whereCombineDisjuncts( } } db = pWC->pWInfo->pParse->db; - pNew = sqlite3ExprDup(db, pOne->pExpr, 0); + pNew = tdsqlite3ExprDup(db, pOne->pExpr, 0); if( pNew==0 ) return; for(op=TK_EQ; eOp!=(WO_EQ<<(op-TK_EQ)); op++){ assert( opop = op; @@ -147308,7 +147308,7 @@ static void exprAnalyzeOrTerm( ){ WhereInfo *pWInfo = pWC->pWInfo; /* WHERE clause processing context */ Parse *pParse = pWInfo->pParse; /* Parser context */ - sqlite3 *db = pParse->db; /* Database connection */ + tdsqlite3 *db = pParse->db; /* Database connection */ WhereTerm *pTerm = &pWC->a[idxTerm]; /* The term to be analyzed */ Expr *pExpr = pTerm->pExpr; /* The expression of the term */ int i; /* Loop counters */ @@ -147325,14 +147325,14 @@ static void exprAnalyzeOrTerm( */ assert( (pTerm->wtFlags & (TERM_DYNAMIC|TERM_ORINFO|TERM_ANDINFO))==0 ); assert( pExpr->op==TK_OR ); - pTerm->u.pOrInfo = pOrInfo = sqlite3DbMallocZero(db, sizeof(*pOrInfo)); + pTerm->u.pOrInfo = pOrInfo = tdsqlite3DbMallocZero(db, sizeof(*pOrInfo)); if( pOrInfo==0 ) return; pTerm->wtFlags |= TERM_ORINFO; pOrWc = &pOrInfo->wc; memset(pOrWc->aStatic, 0, sizeof(pOrWc->aStatic)); - sqlite3WhereClauseInit(pOrWc, pWInfo); - sqlite3WhereSplit(pOrWc, pExpr, TK_OR); - sqlite3WhereExprAnalyze(pSrc, pOrWc); + tdsqlite3WhereClauseInit(pOrWc, pWInfo); + tdsqlite3WhereSplit(pOrWc, pExpr, TK_OR); + tdsqlite3WhereExprAnalyze(pSrc, pOrWc); if( db->mallocFailed ) return; assert( pOrWc->nTerm>=2 ); @@ -147346,7 +147346,7 @@ static void exprAnalyzeOrTerm( WhereAndInfo *pAndInfo; assert( (pOrTerm->wtFlags & (TERM_ANDINFO|TERM_ORINFO))==0 ); chngToIN = 0; - pAndInfo = sqlite3DbMallocRawNN(db, sizeof(*pAndInfo)); + pAndInfo = tdsqlite3DbMallocRawNN(db, sizeof(*pAndInfo)); if( pAndInfo ){ WhereClause *pAndWC; WhereTerm *pAndTerm; @@ -147357,9 +147357,9 @@ static void exprAnalyzeOrTerm( pOrTerm->eOperator = WO_AND; pAndWC = &pAndInfo->wc; memset(pAndWC->aStatic, 0, sizeof(pAndWC->aStatic)); - sqlite3WhereClauseInit(pAndWC, pWC->pWInfo); - sqlite3WhereSplit(pAndWC, pOrTerm->pExpr, TK_AND); - sqlite3WhereExprAnalyze(pSrc, pAndWC); + tdsqlite3WhereClauseInit(pAndWC, pWC->pWInfo); + tdsqlite3WhereSplit(pAndWC, pOrTerm->pExpr, TK_AND); + tdsqlite3WhereExprAnalyze(pSrc, pAndWC); pAndWC->pOuter = pWC; if( !db->mallocFailed ){ for(j=0, pAndTerm=pAndWC->a; jnTerm; j++, pAndTerm++){ @@ -147367,7 +147367,7 @@ static void exprAnalyzeOrTerm( if( allowedOp(pAndTerm->pExpr->op) || pAndTerm->eOperator==WO_AUX ){ - b |= sqlite3WhereGetMask(&pWInfo->sMaskSet, pAndTerm->leftCursor); + b |= tdsqlite3WhereGetMask(&pWInfo->sMaskSet, pAndTerm->leftCursor); } } } @@ -147378,10 +147378,10 @@ static void exprAnalyzeOrTerm( ** corresponding TERM_VIRTUAL term */ }else{ Bitmask b; - b = sqlite3WhereGetMask(&pWInfo->sMaskSet, pOrTerm->leftCursor); + b = tdsqlite3WhereGetMask(&pWInfo->sMaskSet, pOrTerm->leftCursor); if( pOrTerm->wtFlags & TERM_VIRTUAL ){ WhereTerm *pOther = &pOrWc->a[pOrTerm->iParent]; - b |= sqlite3WhereGetMask(&pWInfo->sMaskSet, pOther->leftCursor); + b |= tdsqlite3WhereGetMask(&pWInfo->sMaskSet, pOther->leftCursor); } indexable &= b; if( (pOrTerm->eOperator & WO_EQ)==0 ){ @@ -147463,7 +147463,7 @@ static void exprAnalyzeOrTerm( assert( j==1 ); continue; } - if( (chngToIN & sqlite3WhereGetMask(&pWInfo->sMaskSet, + if( (chngToIN & tdsqlite3WhereGetMask(&pWInfo->sMaskSet, pOrTerm->leftCursor))==0 ){ /* This term must be of the form t1.a==t2.b where t2 is in the ** chngToIN set but t1 is not. This term will be either preceded @@ -147484,7 +147484,7 @@ static void exprAnalyzeOrTerm( ** on the second iteration */ assert( j==1 ); assert( IsPowerOfTwo(chngToIN) ); - assert( chngToIN==sqlite3WhereGetMask(&pWInfo->sMaskSet, iCursor) ); + assert( chngToIN==tdsqlite3WhereGetMask(&pWInfo->sMaskSet, iCursor) ); break; } testcase( j==1 ); @@ -147497,7 +147497,7 @@ static void exprAnalyzeOrTerm( if( pOrTerm->leftCursor!=iCursor ){ pOrTerm->wtFlags &= ~TERM_OR_OK; }else if( pOrTerm->u.leftColumn!=iColumn || (iColumn==XN_EXPR - && sqlite3ExprCompare(pParse, pOrTerm->pExpr->pLeft, pLeft, -1) + && tdsqlite3ExprCompare(pParse, pOrTerm->pExpr->pLeft, pLeft, -1) )){ okToChngToIN = 0; }else{ @@ -147506,8 +147506,8 @@ static void exprAnalyzeOrTerm( ** of both right and left sides must be such that no type ** conversions are required on the right. (Ticket #2249) */ - affRight = sqlite3ExprAffinity(pOrTerm->pExpr->pRight); - affLeft = sqlite3ExprAffinity(pOrTerm->pExpr->pLeft); + affRight = tdsqlite3ExprAffinity(pOrTerm->pExpr->pRight); + affLeft = tdsqlite3ExprAffinity(pOrTerm->pExpr->pLeft); if( affRight!=0 && affRight!=affLeft ){ okToChngToIN = 0; }else{ @@ -147532,13 +147532,13 @@ static void exprAnalyzeOrTerm( assert( pOrTerm->eOperator & WO_EQ ); assert( pOrTerm->leftCursor==iCursor ); assert( pOrTerm->u.leftColumn==iColumn ); - pDup = sqlite3ExprDup(db, pOrTerm->pExpr->pRight, 0); - pList = sqlite3ExprListAppend(pWInfo->pParse, pList, pDup); + pDup = tdsqlite3ExprDup(db, pOrTerm->pExpr->pRight, 0); + pList = tdsqlite3ExprListAppend(pWInfo->pParse, pList, pDup); pLeft = pOrTerm->pExpr->pLeft; } assert( pLeft!=0 ); - pDup = sqlite3ExprDup(db, pLeft, 0); - pNew = sqlite3PExpr(pParse, TK_IN, pDup, 0); + pDup = tdsqlite3ExprDup(db, pLeft, 0); + pNew = tdsqlite3PExpr(pParse, TK_IN, pDup, 0); if( pNew ){ int idxNew; transferJoinMarkings(pNew, pExpr); @@ -147550,7 +147550,7 @@ static void exprAnalyzeOrTerm( /* pTerm = &pWC->a[idxTerm]; // would be needed if pTerm where used again */ markTermAsChild(pWC, idxNew, idxTerm); }else{ - sqlite3ExprListDelete(db, pList); + tdsqlite3ExprListDelete(db, pList); } } } @@ -147578,16 +147578,16 @@ static int termIsEquivalence(Parse *pParse, Expr *pExpr){ if( !OptimizationEnabled(pParse->db, SQLITE_Transitive) ) return 0; if( pExpr->op!=TK_EQ && pExpr->op!=TK_IS ) return 0; if( ExprHasProperty(pExpr, EP_FromJoin) ) return 0; - aff1 = sqlite3ExprAffinity(pExpr->pLeft); - aff2 = sqlite3ExprAffinity(pExpr->pRight); + aff1 = tdsqlite3ExprAffinity(pExpr->pLeft); + aff2 = tdsqlite3ExprAffinity(pExpr->pRight); if( aff1!=aff2 - && (!sqlite3IsNumericAffinity(aff1) || !sqlite3IsNumericAffinity(aff2)) + && (!tdsqlite3IsNumericAffinity(aff1) || !tdsqlite3IsNumericAffinity(aff2)) ){ return 0; } - pColl = sqlite3ExprCompareCollSeq(pParse, pExpr); - if( sqlite3IsBinary(pColl) ) return 1; - return sqlite3ExprCollSeqMatch(pParse, pExpr->pLeft, pExpr->pRight); + pColl = tdsqlite3ExprCompareCollSeq(pParse, pExpr); + if( tdsqlite3IsBinary(pColl) ) return 1; + return tdsqlite3ExprCollSeqMatch(pParse, pExpr->pLeft, pExpr->pRight); } /* @@ -147599,18 +147599,18 @@ static Bitmask exprSelectUsage(WhereMaskSet *pMaskSet, Select *pS){ Bitmask mask = 0; while( pS ){ SrcList *pSrc = pS->pSrc; - mask |= sqlite3WhereExprListUsage(pMaskSet, pS->pEList); - mask |= sqlite3WhereExprListUsage(pMaskSet, pS->pGroupBy); - mask |= sqlite3WhereExprListUsage(pMaskSet, pS->pOrderBy); - mask |= sqlite3WhereExprUsage(pMaskSet, pS->pWhere); - mask |= sqlite3WhereExprUsage(pMaskSet, pS->pHaving); + mask |= tdsqlite3WhereExprListUsage(pMaskSet, pS->pEList); + mask |= tdsqlite3WhereExprListUsage(pMaskSet, pS->pGroupBy); + mask |= tdsqlite3WhereExprListUsage(pMaskSet, pS->pOrderBy); + mask |= tdsqlite3WhereExprUsage(pMaskSet, pS->pWhere); + mask |= tdsqlite3WhereExprUsage(pMaskSet, pS->pHaving); if( ALWAYS(pSrc!=0) ){ int i; for(i=0; inSrc; i++){ mask |= exprSelectUsage(pMaskSet, pSrc->a[i].pSelect); - mask |= sqlite3WhereExprUsage(pMaskSet, pSrc->a[i].pOn); + mask |= tdsqlite3WhereExprUsage(pMaskSet, pSrc->a[i].pOn); if( pSrc->a[i].fg.isTabFunc ){ - mask |= sqlite3WhereExprListUsage(pMaskSet, pSrc->a[i].u1.pFuncArg); + mask |= tdsqlite3WhereExprListUsage(pMaskSet, pSrc->a[i].u1.pFuncArg); } } } @@ -147647,7 +147647,7 @@ static SQLITE_NOINLINE int exprMightBeIndexed2( if( pIdx->aColExpr==0 ) continue; for(i=0; inKeyCol; i++){ if( pIdx->aiColumn[i]!=XN_EXPR ) continue; - if( sqlite3ExprCompareSkip(pExpr, pIdx->aColExpr->a[i].pExpr, iCur)==0 ){ + if( tdsqlite3ExprCompareSkip(pExpr, pIdx->aColExpr->a[i].pExpr, iCur)==0 ){ aiCurCol[0] = iCur; aiCurCol[1] = XN_EXPR; return 1; @@ -147718,7 +147718,7 @@ static void exprAnalyze( int noCase = 0; /* uppercase equivalent to lowercase */ int op; /* Top-level operator. pExpr->op */ Parse *pParse = pWInfo->pParse; /* Parsing context */ - sqlite3 *db = pParse->db; /* Database connection */ + tdsqlite3 *db = pParse->db; /* Database connection */ unsigned char eOp2 = 0; /* op2 value for LIKE/REGEXP/GLOB */ int nLeft; /* Number of elements on left side vector */ @@ -147729,31 +147729,31 @@ static void exprAnalyze( pMaskSet = &pWInfo->sMaskSet; pExpr = pTerm->pExpr; assert( pExpr->op!=TK_AS && pExpr->op!=TK_COLLATE ); - prereqLeft = sqlite3WhereExprUsage(pMaskSet, pExpr->pLeft); + prereqLeft = tdsqlite3WhereExprUsage(pMaskSet, pExpr->pLeft); op = pExpr->op; if( op==TK_IN ){ assert( pExpr->pRight==0 ); - if( sqlite3ExprCheckIN(pParse, pExpr) ) return; + if( tdsqlite3ExprCheckIN(pParse, pExpr) ) return; if( ExprHasProperty(pExpr, EP_xIsSelect) ){ pTerm->prereqRight = exprSelectUsage(pMaskSet, pExpr->x.pSelect); }else{ - pTerm->prereqRight = sqlite3WhereExprListUsage(pMaskSet, pExpr->x.pList); + pTerm->prereqRight = tdsqlite3WhereExprListUsage(pMaskSet, pExpr->x.pList); } }else if( op==TK_ISNULL ){ pTerm->prereqRight = 0; }else{ - pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight); + pTerm->prereqRight = tdsqlite3WhereExprUsage(pMaskSet, pExpr->pRight); } pMaskSet->bVarSelect = 0; - prereqAll = sqlite3WhereExprUsageNN(pMaskSet, pExpr); + prereqAll = tdsqlite3WhereExprUsageNN(pMaskSet, pExpr); if( pMaskSet->bVarSelect ) pTerm->wtFlags |= TERM_VARSELECT; if( ExprHasProperty(pExpr, EP_FromJoin) ){ - Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable); + Bitmask x = tdsqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable); prereqAll |= x; extraRight = x-1; /* ON clause terms may not be used with an index ** on left table of a LEFT JOIN. Ticket #3015 */ if( (prereqAll>>1)>=x ){ - sqlite3ErrorMsg(pParse, "ON clause references tables to its right"); + tdsqlite3ErrorMsg(pParse, "ON clause references tables to its right"); return; } } @@ -147763,8 +147763,8 @@ static void exprAnalyze( pTerm->eOperator = 0; if( allowedOp(op) ){ int aiCurCol[2]; - Expr *pLeft = sqlite3ExprSkipCollate(pExpr->pLeft); - Expr *pRight = sqlite3ExprSkipCollate(pExpr->pRight); + Expr *pLeft = tdsqlite3ExprSkipCollate(pExpr->pLeft); + Expr *pRight = tdsqlite3ExprSkipCollate(pExpr->pRight); u16 opMask = (pTerm->prereqRight & prereqLeft)==0 ? WO_ALL : WO_EQUIV; if( pTerm->iField>0 ){ @@ -147788,9 +147788,9 @@ static void exprAnalyze( assert( pTerm->iField==0 ); if( pTerm->leftCursor>=0 ){ int idxNew; - pDup = sqlite3ExprDup(db, pExpr, 0); + pDup = tdsqlite3ExprDup(db, pExpr, 0); if( db->mallocFailed ){ - sqlite3ExprDelete(db, pDup); + tdsqlite3ExprDelete(db, pDup); return; } idxNew = whereClauseInsert(pWC, pDup, TERM_VIRTUAL|TERM_DYNAMIC); @@ -147844,9 +147844,9 @@ static void exprAnalyze( for(i=0; i<2; i++){ Expr *pNewExpr; int idxNew; - pNewExpr = sqlite3PExpr(pParse, ops[i], - sqlite3ExprDup(db, pExpr->pLeft, 0), - sqlite3ExprDup(db, pList->a[i].pExpr, 0)); + pNewExpr = tdsqlite3PExpr(pParse, ops[i], + tdsqlite3ExprDup(db, pExpr->pLeft, 0), + tdsqlite3ExprDup(db, pList->a[i].pExpr, 0)); transferJoinMarkings(pNewExpr, pExpr); idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC); testcase( idxNew==0 ); @@ -147895,7 +147895,7 @@ static void exprAnalyze( const u16 wtFlags = TERM_LIKEOPT | TERM_VIRTUAL | TERM_DYNAMIC; pLeft = pExpr->x.pList->a[1].pExpr; - pStr2 = sqlite3ExprDup(db, pStr1, 0); + pStr2 = tdsqlite3ExprDup(db, pStr1, 0); /* Convert the lower bound to upper-case and the upper bound to ** lower-case (upper-case is less than lower-case in ASCII) so that @@ -147906,14 +147906,14 @@ static void exprAnalyze( char c; pTerm->wtFlags |= TERM_LIKE; for(i=0; (c = pStr1->u.zToken[i])!=0; i++){ - pStr1->u.zToken[i] = sqlite3Toupper(c); - pStr2->u.zToken[i] = sqlite3Tolower(c); + pStr1->u.zToken[i] = tdsqlite3Toupper(c); + pStr2->u.zToken[i] = tdsqlite3Tolower(c); } } if( !db->mallocFailed ){ u8 c, *pC; /* Last character before the first wildcard */ - pC = (u8*)&pStr2->u.zToken[sqlite3Strlen30(pStr2->u.zToken)-1]; + pC = (u8*)&pStr2->u.zToken[tdsqlite3Strlen30(pStr2->u.zToken)-1]; c = *pC; if( noCase ){ /* The point is to increment the last character before the first @@ -147923,22 +147923,22 @@ static void exprAnalyze( ** LIKE on all candidate expressions by clearing the isComplete flag */ if( c=='A'-1 ) isComplete = 0; - c = sqlite3UpperToLower[c]; + c = tdsqlite3UpperToLower[c]; } *pC = c + 1; } - zCollSeqName = noCase ? "NOCASE" : sqlite3StrBINARY; - pNewExpr1 = sqlite3ExprDup(db, pLeft, 0); - pNewExpr1 = sqlite3PExpr(pParse, TK_GE, - sqlite3ExprAddCollateString(pParse,pNewExpr1,zCollSeqName), + zCollSeqName = noCase ? "NOCASE" : tdsqlite3StrBINARY; + pNewExpr1 = tdsqlite3ExprDup(db, pLeft, 0); + pNewExpr1 = tdsqlite3PExpr(pParse, TK_GE, + tdsqlite3ExprAddCollateString(pParse,pNewExpr1,zCollSeqName), pStr1); transferJoinMarkings(pNewExpr1, pExpr); idxNew1 = whereClauseInsert(pWC, pNewExpr1, wtFlags); testcase( idxNew1==0 ); exprAnalyze(pSrc, pWC, idxNew1); - pNewExpr2 = sqlite3ExprDup(db, pLeft, 0); - pNewExpr2 = sqlite3PExpr(pParse, TK_LT, - sqlite3ExprAddCollateString(pParse,pNewExpr2,zCollSeqName), + pNewExpr2 = tdsqlite3ExprDup(db, pLeft, 0); + pNewExpr2 = tdsqlite3PExpr(pParse, TK_LT, + tdsqlite3ExprAddCollateString(pParse,pNewExpr2,zCollSeqName), pStr2); transferJoinMarkings(pNewExpr2, pExpr); idxNew2 = whereClauseInsert(pWC, pNewExpr2, wtFlags); @@ -147970,12 +147970,12 @@ static void exprAnalyze( WhereTerm *pNewTerm; Bitmask prereqColumn, prereqExpr; - prereqExpr = sqlite3WhereExprUsage(pMaskSet, pRight); - prereqColumn = sqlite3WhereExprUsage(pMaskSet, pLeft); + prereqExpr = tdsqlite3WhereExprUsage(pMaskSet, pRight); + prereqColumn = tdsqlite3WhereExprUsage(pMaskSet, pLeft); if( (prereqExpr & prereqColumn)==0 ){ Expr *pNewExpr; - pNewExpr = sqlite3PExpr(pParse, TK_MATCH, - 0, sqlite3ExprDup(db, pRight, 0)); + pNewExpr = tdsqlite3PExpr(pParse, TK_MATCH, + 0, tdsqlite3ExprDup(db, pRight, 0)); if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){ ExprSetProperty(pNewExpr, EP_FromJoin); pNewExpr->iRightJoinTable = pExpr->iRightJoinTable; @@ -148007,8 +148007,8 @@ static void exprAnalyze( ** is not a sub-select. */ if( pWC->op==TK_AND && (pExpr->op==TK_EQ || pExpr->op==TK_IS) - && (nLeft = sqlite3ExprVectorSize(pExpr->pLeft))>1 - && sqlite3ExprVectorSize(pExpr->pRight)==nLeft + && (nLeft = tdsqlite3ExprVectorSize(pExpr->pLeft))>1 + && tdsqlite3ExprVectorSize(pExpr->pRight)==nLeft && ( (pExpr->pLeft->flags & EP_xIsSelect)==0 || (pExpr->pRight->flags & EP_xIsSelect)==0) ){ @@ -148016,10 +148016,10 @@ static void exprAnalyze( for(i=0; ipLeft, i); - Expr *pRight = sqlite3ExprForVectorField(pParse, pExpr->pRight, i); + Expr *pLeft = tdsqlite3ExprForVectorField(pParse, pExpr->pLeft, i); + Expr *pRight = tdsqlite3ExprForVectorField(pParse, pExpr->pRight, i); - pNew = sqlite3PExpr(pParse, pExpr->op, pLeft, pRight); + pNew = tdsqlite3PExpr(pParse, pExpr->op, pLeft, pRight); transferJoinMarkings(pNew, pExpr); idxNew = whereClauseInsert(pWC, pNew, TERM_DYNAMIC); exprAnalyze(pSrc, pWC, idxNew); @@ -148046,7 +148046,7 @@ static void exprAnalyze( #endif ){ int i; - for(i=0; ipLeft); i++){ + for(i=0; ipLeft); i++){ int idxNew; idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL); pWC->a[idxNew].iField = i+1; @@ -148074,9 +148074,9 @@ static void exprAnalyze( int idxNew; WhereTerm *pNewTerm; - pNewExpr = sqlite3PExpr(pParse, TK_GT, - sqlite3ExprDup(db, pLeft, 0), - sqlite3ExprAlloc(db, TK_NULL, 0, 0)); + pNewExpr = tdsqlite3PExpr(pParse, TK_GT, + tdsqlite3ExprDup(db, pLeft, 0), + tdsqlite3ExprAlloc(db, TK_NULL, 0, 0)); idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC|TERM_VNULL); @@ -148124,22 +148124,22 @@ static void exprAnalyze( ** the WhereClause.a[] array. The slot[] array grows as needed to contain ** all terms of the WHERE clause. */ -SQLITE_PRIVATE void sqlite3WhereSplit(WhereClause *pWC, Expr *pExpr, u8 op){ - Expr *pE2 = sqlite3ExprSkipCollateAndLikely(pExpr); +SQLITE_PRIVATE void tdsqlite3WhereSplit(WhereClause *pWC, Expr *pExpr, u8 op){ + Expr *pE2 = tdsqlite3ExprSkipCollateAndLikely(pExpr); pWC->op = op; if( pE2==0 ) return; if( pE2->op!=op ){ whereClauseInsert(pWC, pExpr, 0); }else{ - sqlite3WhereSplit(pWC, pE2->pLeft, op); - sqlite3WhereSplit(pWC, pE2->pRight, op); + tdsqlite3WhereSplit(pWC, pE2->pLeft, op); + tdsqlite3WhereSplit(pWC, pE2->pRight, op); } } /* ** Initialize a preallocated WhereClause structure. */ -SQLITE_PRIVATE void sqlite3WhereClauseInit( +SQLITE_PRIVATE void tdsqlite3WhereClauseInit( WhereClause *pWC, /* The WhereClause to be initialized */ WhereInfo *pWInfo /* The WHERE processing context */ ){ @@ -148154,15 +148154,15 @@ SQLITE_PRIVATE void sqlite3WhereClauseInit( /* ** Deallocate a WhereClause structure. The WhereClause structure ** itself is not freed. This routine is the inverse of -** sqlite3WhereClauseInit(). +** tdsqlite3WhereClauseInit(). */ -SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause *pWC){ +SQLITE_PRIVATE void tdsqlite3WhereClauseClear(WhereClause *pWC){ int i; WhereTerm *a; - sqlite3 *db = pWC->pWInfo->pParse->db; + tdsqlite3 *db = pWC->pWInfo->pParse->db; for(i=pWC->nTerm-1, a=pWC->a; i>=0; i--, a++){ if( a->wtFlags & TERM_DYNAMIC ){ - sqlite3ExprDelete(db, a->pExpr); + tdsqlite3ExprDelete(db, a->pExpr); } if( a->wtFlags & TERM_ORINFO ){ whereOrInfoDelete(db, a->u.pOrInfo); @@ -148171,7 +148171,7 @@ SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause *pWC){ } } if( pWC->a!=pWC->aStatic ){ - sqlite3DbFree(db, pWC->a); + tdsqlite3DbFree(db, pWC->a); } } @@ -148181,43 +148181,43 @@ SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause *pWC){ ** a bitmask indicating which tables are used in that expression ** tree. */ -SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){ +SQLITE_PRIVATE Bitmask tdsqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){ Bitmask mask; if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){ - return sqlite3WhereGetMask(pMaskSet, p->iTable); + return tdsqlite3WhereGetMask(pMaskSet, p->iTable); }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){ assert( p->op!=TK_IF_NULL_ROW ); return 0; } - mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0; - if( p->pLeft ) mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pLeft); + mask = (p->op==TK_IF_NULL_ROW) ? tdsqlite3WhereGetMask(pMaskSet, p->iTable) : 0; + if( p->pLeft ) mask |= tdsqlite3WhereExprUsageNN(pMaskSet, p->pLeft); if( p->pRight ){ - mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pRight); + mask |= tdsqlite3WhereExprUsageNN(pMaskSet, p->pRight); assert( p->x.pList==0 ); }else if( ExprHasProperty(p, EP_xIsSelect) ){ if( ExprHasProperty(p, EP_VarSelect) ) pMaskSet->bVarSelect = 1; mask |= exprSelectUsage(pMaskSet, p->x.pSelect); }else if( p->x.pList ){ - mask |= sqlite3WhereExprListUsage(pMaskSet, p->x.pList); + mask |= tdsqlite3WhereExprListUsage(pMaskSet, p->x.pList); } #ifndef SQLITE_OMIT_WINDOWFUNC if( (p->op==TK_FUNCTION || p->op==TK_AGG_FUNCTION) && p->y.pWin ){ - mask |= sqlite3WhereExprListUsage(pMaskSet, p->y.pWin->pPartition); - mask |= sqlite3WhereExprListUsage(pMaskSet, p->y.pWin->pOrderBy); - mask |= sqlite3WhereExprUsage(pMaskSet, p->y.pWin->pFilter); + mask |= tdsqlite3WhereExprListUsage(pMaskSet, p->y.pWin->pPartition); + mask |= tdsqlite3WhereExprListUsage(pMaskSet, p->y.pWin->pOrderBy); + mask |= tdsqlite3WhereExprUsage(pMaskSet, p->y.pWin->pFilter); } #endif return mask; } -SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet *pMaskSet, Expr *p){ - return p ? sqlite3WhereExprUsageNN(pMaskSet,p) : 0; +SQLITE_PRIVATE Bitmask tdsqlite3WhereExprUsage(WhereMaskSet *pMaskSet, Expr *p){ + return p ? tdsqlite3WhereExprUsageNN(pMaskSet,p) : 0; } -SQLITE_PRIVATE Bitmask sqlite3WhereExprListUsage(WhereMaskSet *pMaskSet, ExprList *pList){ +SQLITE_PRIVATE Bitmask tdsqlite3WhereExprListUsage(WhereMaskSet *pMaskSet, ExprList *pList){ int i; Bitmask mask = 0; if( pList ){ for(i=0; inExpr; i++){ - mask |= sqlite3WhereExprUsage(pMaskSet, pList->a[i].pExpr); + mask |= tdsqlite3WhereExprUsage(pMaskSet, pList->a[i].pExpr); } } return mask; @@ -148232,7 +148232,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereExprListUsage(WhereMaskSet *pMaskSet, ExprLis ** virtual terms, so start analyzing at the end and work forward ** so that the added virtual terms are never processed. */ -SQLITE_PRIVATE void sqlite3WhereExprAnalyze( +SQLITE_PRIVATE void tdsqlite3WhereExprAnalyze( SrcList *pTabList, /* the FROM clause */ WhereClause *pWC /* the WHERE clause to be analyzed */ ){ @@ -148249,7 +148249,7 @@ SQLITE_PRIVATE void sqlite3WhereExprAnalyze( ** Each function argument translates into an equality constraint against ** a HIDDEN column in the table. */ -SQLITE_PRIVATE void sqlite3WhereTabFuncArgs( +SQLITE_PRIVATE void tdsqlite3WhereTabFuncArgs( Parse *pParse, /* Parsing context */ struct SrcList_item *pItem, /* The FROM clause term to process */ WhereClause *pWC /* Xfer function arguments to here */ @@ -148268,20 +148268,20 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs( Expr *pRhs; while( knCol && (pTab->aCol[k].colFlags & COLFLAG_HIDDEN)==0 ){k++;} if( k>=pTab->nCol ){ - sqlite3ErrorMsg(pParse, "too many arguments on %s() - max %d", + tdsqlite3ErrorMsg(pParse, "too many arguments on %s() - max %d", pTab->zName, j); return; } - pColRef = sqlite3ExprAlloc(pParse->db, TK_COLUMN, 0, 0); + pColRef = tdsqlite3ExprAlloc(pParse->db, TK_COLUMN, 0, 0); if( pColRef==0 ) return; pColRef->iTable = pItem->iCursor; pColRef->iColumn = k++; pColRef->y.pTab = pTab; - pRhs = sqlite3PExpr(pParse, TK_UPLUS, - sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0); - pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs); + pRhs = tdsqlite3PExpr(pParse, TK_UPLUS, + tdsqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0); + pTerm = tdsqlite3PExpr(pParse, TK_EQ, pColRef, pRhs); if( pItem->fg.jointype & JT_LEFT ){ - sqlite3SetJoinExpr(pTerm, pItem->iCursor); + tdsqlite3SetJoinExpr(pTerm, pItem->iCursor); } whereClauseInsert(pWC, pTerm, TERM_DYNAMIC); } @@ -148311,12 +148311,12 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs( /* #include "whereInt.h" */ /* -** Extra information appended to the end of sqlite3_index_info but not +** Extra information appended to the end of tdsqlite3_index_info but not ** visible to the xBestIndex function, at least not directly. The -** sqlite3_vtab_collation() interface knows how to reach it, however. +** tdsqlite3_vtab_collation() interface knows how to reach it, however. ** ** This object is not an API and can be changed from one release to the -** next. As long as allocateIndexInfo() and sqlite3_vtab_collation() +** next. As long as allocateIndexInfo() and tdsqlite3_vtab_collation() ** agree on the structure, all will be well. */ typedef struct HiddenIndexInfo HiddenIndexInfo; @@ -148326,18 +148326,18 @@ struct HiddenIndexInfo { }; /* Forward declaration of methods */ -static int whereLoopResize(sqlite3*, WhereLoop*, int); +static int whereLoopResize(tdsqlite3*, WhereLoop*, int); /* Test variable that can be set to enable WHERE tracing */ #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) -/***/ int sqlite3WhereTrace = 0; +/***/ int tdsqlite3WhereTrace = 0; #endif /* ** Return the estimated number of output rows from a WHERE clause */ -SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo *pWInfo){ +SQLITE_PRIVATE LogEst tdsqlite3WhereOutputRowCount(WhereInfo *pWInfo){ return pWInfo->nRowOut; } @@ -148345,7 +148345,7 @@ SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo *pWInfo){ ** Return one of the WHERE_DISTINCT_xxxxx values to indicate how this ** WHERE clause returns outputs for DISTINCT processing. */ -SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo *pWInfo){ +SQLITE_PRIVATE int tdsqlite3WhereIsDistinct(WhereInfo *pWInfo){ return pWInfo->eDistinct; } @@ -148353,7 +148353,7 @@ SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo *pWInfo){ ** Return TRUE if the WHERE clause returns rows in ORDER BY order. ** Return FALSE if the output needs to be sorted. */ -SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo *pWInfo){ +SQLITE_PRIVATE int tdsqlite3WhereIsOrdered(WhereInfo *pWInfo){ return pWInfo->nOBSat; } @@ -148380,7 +148380,7 @@ SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo *pWInfo){ ** that might make the code run a little faster, but should not change ** the final answer. */ -SQLITE_PRIVATE int sqlite3WhereOrderByLimitOptLabel(WhereInfo *pWInfo){ +SQLITE_PRIVATE int tdsqlite3WhereOrderByLimitOptLabel(WhereInfo *pWInfo){ WhereLevel *pInner; if( !pWInfo->bOrderedInnerLoop ){ /* The ORDER BY LIMIT optimization does not apply. Jump to the @@ -148396,7 +148396,7 @@ SQLITE_PRIVATE int sqlite3WhereOrderByLimitOptLabel(WhereInfo *pWInfo){ ** Return the VDBE address or label to jump to in order to continue ** immediately with the next row of a WHERE clause. */ -SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo *pWInfo){ +SQLITE_PRIVATE int tdsqlite3WhereContinueLabel(WhereInfo *pWInfo){ assert( pWInfo->iContinue!=0 ); return pWInfo->iContinue; } @@ -148405,7 +148405,7 @@ SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo *pWInfo){ ** Return the VDBE address or label to jump to in order to break ** out of a WHERE loop. */ -SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo *pWInfo){ +SQLITE_PRIVATE int tdsqlite3WhereBreakLabel(WhereInfo *pWInfo){ return pWInfo->iBreak; } @@ -148426,11 +148426,11 @@ SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo *pWInfo){ ** aiCur[0] and aiCur[1] both get -1 if the where-clause logic is ** unable to use the ONEPASS optimization. */ -SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo *pWInfo, int *aiCur){ +SQLITE_PRIVATE int tdsqlite3WhereOkOnePass(WhereInfo *pWInfo, int *aiCur){ memcpy(aiCur, pWInfo->aiCurOnePass, sizeof(int)*2); #ifdef WHERETRACE_ENABLED - if( sqlite3WhereTrace && pWInfo->eOnePass!=ONEPASS_OFF ){ - sqlite3DebugPrintf("%s cursors: %d %d\n", + if( tdsqlite3WhereTrace && pWInfo->eOnePass!=ONEPASS_OFF ){ + tdsqlite3DebugPrintf("%s cursors: %d %d\n", pWInfo->eOnePass==ONEPASS_SINGLE ? "ONEPASS_SINGLE" : "ONEPASS_MULTI", aiCur[0], aiCur[1]); } @@ -148442,7 +148442,7 @@ SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo *pWInfo, int *aiCur){ ** Return TRUE if the WHERE loop uses the OP_DeferredSeek opcode to move ** the data cursor to the row selected by the index cursor. */ -SQLITE_PRIVATE int sqlite3WhereUsesDeferredSeek(WhereInfo *pWInfo){ +SQLITE_PRIVATE int tdsqlite3WhereUsesDeferredSeek(WhereInfo *pWInfo){ return pWInfo->bDeferredSeek; } @@ -148498,7 +148498,7 @@ whereOrInsert_done: ** Return the bitmask for the given cursor number. Return 0 if ** iCursor is not in the set. */ -SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet *pMaskSet, int iCursor){ +SQLITE_PRIVATE Bitmask tdsqlite3WhereGetMask(WhereMaskSet *pMaskSet, int iCursor){ int i; assert( pMaskSet->n<=(int)sizeof(Bitmask)*8 ); for(i=0; in; i++){ @@ -148514,7 +148514,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet *pMaskSet, int iCursor){ ** ** There is one cursor per table in the FROM clause. The number of ** tables in the FROM clause is limited by a test early in the -** sqlite3WhereBegin() routine. So we know that the pMaskSet->ix[] +** tdsqlite3WhereBegin() routine. So we know that the pMaskSet->ix[] ** array will never overflow. */ static void createMask(WhereMaskSet *pMaskSet, int iCursor){ @@ -148546,13 +148546,13 @@ static WhereTerm *whereScanNext(WhereScan *pScan){ if( pTerm->leftCursor==iCur && pTerm->u.leftColumn==iColumn && (iColumn!=XN_EXPR - || sqlite3ExprCompareSkip(pTerm->pExpr->pLeft, + || tdsqlite3ExprCompareSkip(pTerm->pExpr->pLeft, pScan->pIdxExpr,iCur)==0) && (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin)) ){ if( (pTerm->eOperator & WO_EQUIV)!=0 && pScan->nEquivaiCur) - && (pX = sqlite3ExprSkipCollateAndLikely(pTerm->pExpr->pRight))->op + && (pX = tdsqlite3ExprSkipCollateAndLikely(pTerm->pExpr->pRight))->op ==TK_COLUMN ){ int j; @@ -148574,13 +148574,13 @@ static WhereTerm *whereScanNext(WhereScan *pScan){ CollSeq *pColl; Parse *pParse = pWC->pWInfo->pParse; pX = pTerm->pExpr; - if( !sqlite3IndexAffinityOk(pX, pScan->idxaff) ){ + if( !tdsqlite3IndexAffinityOk(pX, pScan->idxaff) ){ continue; } assert(pX->pLeft); - pColl = sqlite3ExprCompareCollSeq(pParse, pX); + pColl = tdsqlite3ExprCompareCollSeq(pParse, pX); if( pColl==0 ) pColl = pParse->db->pDfltColl; - if( sqlite3StrICmp(pColl->zName, pScan->zCollName) ){ + if( tdsqlite3StrICmp(pColl->zName, pScan->zCollName) ){ continue; } } @@ -148616,7 +148616,7 @@ static WhereTerm *whereScanNext(WhereScan *pScan){ ** need to push registers onto the stack as part of its prologue. */ static SQLITE_NOINLINE WhereTerm *whereScanInitIndexExpr(WhereScan *pScan){ - pScan->idxaff = sqlite3ExprAffinity(pScan->pIdxExpr); + pScan->idxaff = tdsqlite3ExprAffinity(pScan->pIdxExpr); return whereScanNext(pScan); } @@ -148703,7 +148703,7 @@ static WhereTerm *whereScanInit( ** the form "X " exist. If no terms with a constant RHS ** exist, try to return a term that does not use WO_EQUIV. */ -SQLITE_PRIVATE WhereTerm *sqlite3WhereFindTerm( +SQLITE_PRIVATE WhereTerm *tdsqlite3WhereFindTerm( WhereClause *pWC, /* The WHERE clause to be searched */ int iCur, /* Cursor number of LHS */ int iColumn, /* Column number of LHS */ @@ -148748,13 +148748,13 @@ static int findIndexCol( const char *zColl = pIdx->azColl[iCol]; for(i=0; inExpr; i++){ - Expr *p = sqlite3ExprSkipCollateAndLikely(pList->a[i].pExpr); + Expr *p = tdsqlite3ExprSkipCollateAndLikely(pList->a[i].pExpr); if( p->op==TK_COLUMN && p->iColumn==pIdx->aiColumn[iCol] && p->iTable==iBase ){ - CollSeq *pColl = sqlite3ExprNNCollSeq(pParse, pList->a[i].pExpr); - if( 0==sqlite3StrICmp(pColl->zName, zColl) ){ + CollSeq *pColl = tdsqlite3ExprNNCollSeq(pParse, pList->a[i].pExpr); + if( 0==tdsqlite3StrICmp(pColl->zName, zColl) ){ return i; } } @@ -148812,7 +148812,7 @@ static int isDistinctRedundant( ** current SELECT is a correlated sub-query. */ for(i=0; inExpr; i++){ - Expr *p = sqlite3ExprSkipCollateAndLikely(pDistinct->a[i].pExpr); + Expr *p = tdsqlite3ExprSkipCollateAndLikely(pDistinct->a[i].pExpr); if( p->op==TK_COLUMN && p->iTable==iBase && p->iColumn<0 ) return 1; } @@ -148832,7 +148832,7 @@ static int isDistinctRedundant( for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ if( !IsUniqueIndex(pIdx) ) continue; for(i=0; inKeyCol; i++){ - if( 0==sqlite3WhereFindTerm(pWC, iBase, i, ~(Bitmask)0, WO_EQ, pIdx) ){ + if( 0==tdsqlite3WhereFindTerm(pWC, iBase, i, ~(Bitmask)0, WO_EQ, pIdx) ){ if( findIndexCol(pParse, pDistinct, iBase, pIdx, i)<0 ) break; if( indexColumnNotNull(pIdx, i)==0 ) break; } @@ -148851,7 +148851,7 @@ static int isDistinctRedundant( ** Estimate the logarithm of the input value to base 2. */ static LogEst estLog(LogEst N){ - return N<=10 ? 0 : sqlite3LogEst(N) - 33; + return N<=10 ? 0 : tdsqlite3LogEst(N) - 33; } /* @@ -148874,8 +148874,8 @@ static void translateColumnToCopy( int iAutoidxCur /* If non-zero, cursor of autoindex being generated */ ){ Vdbe *v = pParse->pVdbe; - VdbeOp *pOp = sqlite3VdbeGetOp(v, iStart); - int iEnd = sqlite3VdbeCurrentAddr(v); + VdbeOp *pOp = tdsqlite3VdbeGetOp(v, iStart); + int iEnd = tdsqlite3VdbeCurrentAddr(v); if( pParse->db->mallocFailed ) return; for(; iStartp1!=iTabCur ) continue; @@ -148898,17 +148898,17 @@ static void translateColumnToCopy( } /* -** Two routines for printing the content of an sqlite3_index_info +** Two routines for printing the content of an tdsqlite3_index_info ** structure. Used for testing and debugging only. If neither ** SQLITE_TEST or SQLITE_DEBUG are defined, then these routines ** are no-ops. */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(WHERETRACE_ENABLED) -static void whereTraceIndexInfoInputs(sqlite3_index_info *p){ +static void whereTraceIndexInfoInputs(tdsqlite3_index_info *p){ int i; - if( !sqlite3WhereTrace ) return; + if( !tdsqlite3WhereTrace ) return; for(i=0; inConstraint; i++){ - sqlite3DebugPrintf(" constraint[%d]: col=%d termid=%d op=%d usabled=%d\n", + tdsqlite3DebugPrintf(" constraint[%d]: col=%d termid=%d op=%d usabled=%d\n", i, p->aConstraint[i].iColumn, p->aConstraint[i].iTermOffset, @@ -148916,26 +148916,26 @@ static void whereTraceIndexInfoInputs(sqlite3_index_info *p){ p->aConstraint[i].usable); } for(i=0; inOrderBy; i++){ - sqlite3DebugPrintf(" orderby[%d]: col=%d desc=%d\n", + tdsqlite3DebugPrintf(" orderby[%d]: col=%d desc=%d\n", i, p->aOrderBy[i].iColumn, p->aOrderBy[i].desc); } } -static void whereTraceIndexInfoOutputs(sqlite3_index_info *p){ +static void whereTraceIndexInfoOutputs(tdsqlite3_index_info *p){ int i; - if( !sqlite3WhereTrace ) return; + if( !tdsqlite3WhereTrace ) return; for(i=0; inConstraint; i++){ - sqlite3DebugPrintf(" usage[%d]: argvIdx=%d omit=%d\n", + tdsqlite3DebugPrintf(" usage[%d]: argvIdx=%d omit=%d\n", i, p->aConstraintUsage[i].argvIndex, p->aConstraintUsage[i].omit); } - sqlite3DebugPrintf(" idxNum=%d\n", p->idxNum); - sqlite3DebugPrintf(" idxStr=%s\n", p->idxStr); - sqlite3DebugPrintf(" orderByConsumed=%d\n", p->orderByConsumed); - sqlite3DebugPrintf(" estimatedCost=%g\n", p->estimatedCost); - sqlite3DebugPrintf(" estimatedRows=%lld\n", p->estimatedRows); + tdsqlite3DebugPrintf(" idxNum=%d\n", p->idxNum); + tdsqlite3DebugPrintf(" idxStr=%s\n", p->idxStr); + tdsqlite3DebugPrintf(" orderByConsumed=%d\n", p->orderByConsumed); + tdsqlite3DebugPrintf(" estimatedCost=%g\n", p->estimatedCost); + tdsqlite3DebugPrintf(" estimatedRows=%lld\n", p->estimatedRows); } #else #define whereTraceIndexInfoInputs(A) @@ -148968,7 +148968,7 @@ static int termCanDriveIndex( if( (pTerm->prereqRight & notReady)!=0 ) return 0; if( pTerm->u.leftColumn<0 ) return 0; aff = pSrc->pTab->aCol[pTerm->u.leftColumn].affinity; - if( !sqlite3IndexAffinityOk(pTerm->pExpr, aff) ) return 0; + if( !tdsqlite3IndexAffinityOk(pTerm->pExpr, aff) ) return 0; testcase( pTerm->pExpr->op==TK_IS ); return 1; } @@ -149016,7 +149016,7 @@ static void constructAutomaticIndex( ** transient index on 2nd and subsequent iterations of the loop. */ v = pParse->pVdbe; assert( v!=0 ); - addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); + addrInit = tdsqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); /* Count the number of columns that will be added to the index ** and used to match WHERE clause constraints */ @@ -149033,9 +149033,9 @@ static void constructAutomaticIndex( if( pLoop->prereq==0 && (pTerm->wtFlags & TERM_VIRTUAL)==0 && !ExprHasProperty(pExpr, EP_FromJoin) - && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){ - pPartial = sqlite3ExprAnd(pParse, pPartial, - sqlite3ExprDup(pParse->db, pExpr, 0)); + && tdsqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){ + pPartial = tdsqlite3ExprAnd(pParse, pPartial, + tdsqlite3ExprDup(pParse->db, pExpr, 0)); } if( termCanDriveIndex(pTerm, pSrc, notReady) ){ int iCol = pTerm->u.leftColumn; @@ -149043,7 +149043,7 @@ static void constructAutomaticIndex( testcase( iCol==BMS ); testcase( iCol==BMS-1 ); if( !sentWarning ){ - sqlite3_log(SQLITE_WARNING_AUTOINDEX, + tdsqlite3_log(SQLITE_WARNING_AUTOINDEX, "automatic index on %s(%s)", pTable->zName, pTable->aCol[iCol].zName); sentWarning = 1; @@ -149082,7 +149082,7 @@ static void constructAutomaticIndex( } /* Construct the Index object to describe this index */ - pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed); + pIdx = tdsqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed); if( pIdx==0 ) goto end_auto_index_create; pLoop->u.btree.pIndex = pIdx; pIdx->zName = "auto-index"; @@ -149099,9 +149099,9 @@ static void constructAutomaticIndex( Expr *pX = pTerm->pExpr; idxCols |= cMask; pIdx->aiColumn[n] = pTerm->u.leftColumn; - pColl = sqlite3ExprCompareCollSeq(pParse, pX); + pColl = tdsqlite3ExprCompareCollSeq(pParse, pX); assert( pColl!=0 || pParse->nErr>0 ); /* TH3 collate01.800 */ - pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY; + pIdx->azColl[n] = pColl ? pColl->zName : tdsqlite3StrBINARY; n++; } } @@ -149113,82 +149113,82 @@ static void constructAutomaticIndex( for(i=0; iaiColumn[n] = i; - pIdx->azColl[n] = sqlite3StrBINARY; + pIdx->azColl[n] = tdsqlite3StrBINARY; n++; } } if( pSrc->colUsed & MASKBIT(BMS-1) ){ for(i=BMS-1; inCol; i++){ pIdx->aiColumn[n] = i; - pIdx->azColl[n] = sqlite3StrBINARY; + pIdx->azColl[n] = tdsqlite3StrBINARY; n++; } } assert( n==nKeyCol ); pIdx->aiColumn[n] = XN_ROWID; - pIdx->azColl[n] = sqlite3StrBINARY; + pIdx->azColl[n] = tdsqlite3StrBINARY; /* Create the automatic index */ assert( pLevel->iIdxCur>=0 ); pLevel->iIdxCur = pParse->nTab++; - sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1); - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); + tdsqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1); + tdsqlite3VdbeSetP4KeyInfo(pParse, pIdx); VdbeComment((v, "for %s", pTable->zName)); /* Fill the automatic index with content */ pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom]; if( pTabItem->fg.viaCoroutine ){ int regYield = pTabItem->regReturn; - addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0); - sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub); - addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield); + addrCounter = tdsqlite3VdbeAddOp2(v, OP_Integer, 0, 0); + tdsqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub); + addrTop = tdsqlite3VdbeAddOp1(v, OP_Yield, regYield); VdbeCoverage(v); VdbeComment((v, "next row of %s", pTabItem->pTab->zName)); }else{ - addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v); + addrTop = tdsqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v); } if( pPartial ){ - iContinue = sqlite3VdbeMakeLabel(pParse); - sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL); + iContinue = tdsqlite3VdbeMakeLabel(pParse); + tdsqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL); pLoop->wsFlags |= WHERE_PARTIALIDX; } - regRecord = sqlite3GetTempReg(pParse); - regBase = sqlite3GenerateIndexKey( + regRecord = tdsqlite3GetTempReg(pParse); + regBase = tdsqlite3GenerateIndexKey( pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0 ); - sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); - sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); - if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue); + tdsqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); + tdsqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); + if( pPartial ) tdsqlite3VdbeResolveLabel(v, iContinue); if( pTabItem->fg.viaCoroutine ){ - sqlite3VdbeChangeP2(v, addrCounter, regBase+n); + tdsqlite3VdbeChangeP2(v, addrCounter, regBase+n); testcase( pParse->db->mallocFailed ); assert( pLevel->iIdxCur>0 ); translateColumnToCopy(pParse, addrTop, pLevel->iTabCur, pTabItem->regResult, pLevel->iIdxCur); - sqlite3VdbeGoto(v, addrTop); + tdsqlite3VdbeGoto(v, addrTop); pTabItem->fg.viaCoroutine = 0; }else{ - sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v); - sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX); + tdsqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v); + tdsqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX); } - sqlite3VdbeJumpHere(v, addrTop); - sqlite3ReleaseTempReg(pParse, regRecord); + tdsqlite3VdbeJumpHere(v, addrTop); + tdsqlite3ReleaseTempReg(pParse, regRecord); /* Jump here when skipping the initialization */ - sqlite3VdbeJumpHere(v, addrInit); + tdsqlite3VdbeJumpHere(v, addrInit); end_auto_index_create: - sqlite3ExprDelete(pParse->db, pPartial); + tdsqlite3ExprDelete(pParse->db, pPartial); } #endif /* SQLITE_OMIT_AUTOMATIC_INDEX */ #ifndef SQLITE_OMIT_VIRTUALTABLE /* -** Allocate and populate an sqlite3_index_info structure. It is the +** Allocate and populate an tdsqlite3_index_info structure. It is the ** responsibility of the caller to eventually release the structure -** by passing the pointer returned by this function to sqlite3_free(). +** by passing the pointer returned by this function to tdsqlite3_free(). */ -static sqlite3_index_info *allocateIndexInfo( +static tdsqlite3_index_info *allocateIndexInfo( Parse *pParse, /* The parsing context */ WhereClause *pWC, /* The WHERE clause being analyzed */ Bitmask mUnusable, /* Ignore terms with these prereqs */ @@ -149198,13 +149198,13 @@ static sqlite3_index_info *allocateIndexInfo( ){ int i, j; int nTerm; - struct sqlite3_index_constraint *pIdxCons; - struct sqlite3_index_orderby *pIdxOrderBy; - struct sqlite3_index_constraint_usage *pUsage; + struct tdsqlite3_index_constraint *pIdxCons; + struct tdsqlite3_index_orderby *pIdxOrderBy; + struct tdsqlite3_index_constraint_usage *pUsage; struct HiddenIndexInfo *pHidden; WhereTerm *pTerm; int nOrderBy; - sqlite3_index_info *pIdxInfo; + tdsqlite3_index_info *pIdxInfo; u16 mNoOmit = 0; /* Count the number of possible WHERE clause constraints referring @@ -149225,7 +149225,7 @@ static sqlite3_index_info *allocateIndexInfo( /* If the ORDER BY clause contains only columns in the current ** virtual table then allocate space for the aOrderBy part of - ** the sqlite3_index_info structure. + ** the tdsqlite3_index_info structure. */ nOrderBy = 0; if( pOrderBy ){ @@ -149240,19 +149240,19 @@ static sqlite3_index_info *allocateIndexInfo( } } - /* Allocate the sqlite3_index_info structure + /* Allocate the tdsqlite3_index_info structure */ - pIdxInfo = sqlite3DbMallocZero(pParse->db, sizeof(*pIdxInfo) + pIdxInfo = tdsqlite3DbMallocZero(pParse->db, sizeof(*pIdxInfo) + (sizeof(*pIdxCons) + sizeof(*pUsage))*nTerm + sizeof(*pIdxOrderBy)*nOrderBy + sizeof(*pHidden) ); if( pIdxInfo==0 ){ - sqlite3ErrorMsg(pParse, "out of memory"); + tdsqlite3ErrorMsg(pParse, "out of memory"); return 0; } pHidden = (struct HiddenIndexInfo*)&pIdxInfo[1]; - pIdxCons = (struct sqlite3_index_constraint*)&pHidden[1]; - pIdxOrderBy = (struct sqlite3_index_orderby*)&pIdxCons[nTerm]; - pUsage = (struct sqlite3_index_constraint_usage*)&pIdxOrderBy[nOrderBy]; + pIdxCons = (struct tdsqlite3_index_constraint*)&pHidden[1]; + pIdxOrderBy = (struct tdsqlite3_index_orderby*)&pIdxCons[nTerm]; + pUsage = (struct tdsqlite3_index_constraint_usage*)&pIdxOrderBy[nOrderBy]; pIdxInfo->nOrderBy = nOrderBy; pIdxInfo->aConstraint = pIdxCons; pIdxInfo->aOrderBy = pIdxOrderBy; @@ -149305,7 +149305,7 @@ static sqlite3_index_info *allocateIndexInfo( assert( pTerm->eOperator&(WO_IN|WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_AUX) ); if( op & (WO_LT|WO_LE|WO_GT|WO_GE) - && sqlite3ExprIsVector(pTerm->pExpr->pRight) + && tdsqlite3ExprIsVector(pTerm->pExpr->pRight) ){ testcase( j!=i ); if( j<16 ) mNoOmit |= (1 << j); @@ -149330,21 +149330,21 @@ static sqlite3_index_info *allocateIndexInfo( /* ** The table object reference passed as the second argument to this function ** must represent a virtual table. This function invokes the xBestIndex() -** method of the virtual table with the sqlite3_index_info object that +** method of the virtual table with the tdsqlite3_index_info object that ** comes in as the 3rd argument to this function. ** ** If an error occurs, pParse is populated with an error message and an ** appropriate error code is returned. A return of SQLITE_CONSTRAINT from ** xBestIndex is not considered an error. SQLITE_CONSTRAINT indicates that -** the current configuration of "unusable" flags in sqlite3_index_info can +** the current configuration of "unusable" flags in tdsqlite3_index_info can ** not result in a valid plan. ** ** Whether or not an error is returned, it is the responsibility of the ** caller to eventually free p->idxStr if p->needToFreeIdxStr indicates ** that this is required. */ -static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){ - sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab; +static int vtabBestIndex(Parse *pParse, Table *pTab, tdsqlite3_index_info *p){ + tdsqlite3_vtab *pVtab = tdsqlite3GetVTable(pParse->db, pTab)->pVtab; int rc; whereTraceIndexInfoInputs(p); @@ -149353,14 +149353,14 @@ static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){ if( rc!=SQLITE_OK && rc!=SQLITE_CONSTRAINT ){ if( rc==SQLITE_NOMEM ){ - sqlite3OomFault(pParse->db); + tdsqlite3OomFault(pParse->db); }else if( !pVtab->zErrMsg ){ - sqlite3ErrorMsg(pParse, "%s", sqlite3ErrStr(rc)); + tdsqlite3ErrorMsg(pParse, "%s", tdsqlite3ErrStr(rc)); }else{ - sqlite3ErrorMsg(pParse, "%s", pVtab->zErrMsg); + tdsqlite3ErrorMsg(pParse, "%s", pVtab->zErrMsg); } } - sqlite3_free(pVtab->zErrMsg); + tdsqlite3_free(pVtab->zErrMsg); pVtab->zErrMsg = 0; return rc; } @@ -149469,7 +149469,7 @@ static int whereKeyStats( } pRec->nField = n; - res = sqlite3VdbeRecordCompare(aSample[iSamp].n, aSample[iSamp].p, pRec); + res = tdsqlite3VdbeRecordCompare(aSample[iSamp].n, aSample[iSamp].p, pRec); if( res<0 ){ iLower = aSample[iSamp].anLt[n-1] + aSample[iSamp].anEq[n-1]; iMin = iTest+1; @@ -149494,7 +149494,7 @@ static int whereKeyStats( assert( inSample ); assert( iCol==nField-1 ); pRec->nField = nField; - assert( 0==sqlite3VdbeRecordCompare(aSample[i].n, aSample[i].p, pRec) + assert( 0==tdsqlite3VdbeRecordCompare(aSample[i].n, aSample[i].p, pRec) || pParse->db->mallocFailed ); }else{ @@ -149504,7 +149504,7 @@ static int whereKeyStats( assert( i<=pIdx->nSample && i>=0 ); pRec->nField = iCol+1; assert( i==pIdx->nSample - || sqlite3VdbeRecordCompare(aSample[i].n, aSample[i].p, pRec)>0 + || tdsqlite3VdbeRecordCompare(aSample[i].n, aSample[i].p, pRec)>0 || pParse->db->mallocFailed ); /* if i==0 and iCol==0, then record pRec is smaller than all samples @@ -149513,12 +149513,12 @@ static int whereKeyStats( ** If (i>0), then pRec must also be greater than sample (i-1). */ if( iCol>0 ){ pRec->nField = iCol; - assert( sqlite3VdbeRecordCompare(aSample[i].n, aSample[i].p, pRec)<=0 + assert( tdsqlite3VdbeRecordCompare(aSample[i].n, aSample[i].p, pRec)<=0 || pParse->db->mallocFailed ); } if( i>0 ){ pRec->nField = nField; - assert( sqlite3VdbeRecordCompare(aSample[i-1].n, aSample[i-1].p, pRec)<0 + assert( tdsqlite3VdbeRecordCompare(aSample[i-1].n, aSample[i-1].p, pRec)<0 || pParse->db->mallocFailed ); } } @@ -149536,7 +149536,7 @@ static int whereKeyStats( ** is larger than all samples in the array. */ tRowcnt iUpper, iGap; if( i>=pIdx->nSample ){ - iUpper = sqlite3LogEstToInt(pIdx->aiRowLogEst[0]); + iUpper = tdsqlite3LogEstToInt(pIdx->aiRowLogEst[0]); }else{ iUpper = aSample[i].anLt[iCol]; } @@ -149578,7 +149578,7 @@ static LogEst whereRangeAdjust(WhereTerm *pTerm, LogEst nNew){ if( pTerm->truthProb<=0 ){ nRet += pTerm->truthProb; }else if( (pTerm->wtFlags & TERM_VNULL)==0 ){ - nRet -= 20; assert( 20==sqlite3LogEst(4) ); + nRet -= 20; assert( 20==tdsqlite3LogEst(4) ); } } return nRet; @@ -149589,10 +149589,10 @@ static LogEst whereRangeAdjust(WhereTerm *pTerm, LogEst nNew){ /* ** Return the affinity for a single column of an index. */ -SQLITE_PRIVATE char sqlite3IndexColumnAffinity(sqlite3 *db, Index *pIdx, int iCol){ +SQLITE_PRIVATE char tdsqlite3IndexColumnAffinity(tdsqlite3 *db, Index *pIdx, int iCol){ assert( iCol>=0 && iColnColumn ); if( !pIdx->zColAff ){ - if( sqlite3IndexAffinityStr(db, pIdx)==0 ) return SQLITE_AFF_BLOB; + if( tdsqlite3IndexAffinityStr(db, pIdx)==0 ) return SQLITE_AFF_BLOB; } assert( pIdx->zColAff[iCol]!=0 ); return pIdx->zColAff[iCol]; @@ -149645,24 +149645,24 @@ static int whereRangeSkipScanEst( ){ Index *p = pLoop->u.btree.pIndex; int nEq = pLoop->u.btree.nEq; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; int nLower = -1; int nUpper = p->nSample+1; int rc = SQLITE_OK; - u8 aff = sqlite3IndexColumnAffinity(db, p, nEq); + u8 aff = tdsqlite3IndexColumnAffinity(db, p, nEq); CollSeq *pColl; - sqlite3_value *p1 = 0; /* Value extracted from pLower */ - sqlite3_value *p2 = 0; /* Value extracted from pUpper */ - sqlite3_value *pVal = 0; /* Value extracted from record */ + tdsqlite3_value *p1 = 0; /* Value extracted from pLower */ + tdsqlite3_value *p2 = 0; /* Value extracted from pUpper */ + tdsqlite3_value *pVal = 0; /* Value extracted from record */ - pColl = sqlite3LocateCollSeq(pParse, p->azColl[nEq]); + pColl = tdsqlite3LocateCollSeq(pParse, p->azColl[nEq]); if( pLower ){ - rc = sqlite3Stat4ValueFromExpr(pParse, pLower->pExpr->pRight, aff, &p1); + rc = tdsqlite3Stat4ValueFromExpr(pParse, pLower->pExpr->pRight, aff, &p1); nLower = 0; } if( pUpper && rc==SQLITE_OK ){ - rc = sqlite3Stat4ValueFromExpr(pParse, pUpper->pExpr->pRight, aff, &p2); + rc = tdsqlite3Stat4ValueFromExpr(pParse, pUpper->pExpr->pRight, aff, &p2); nUpper = p2 ? 0 : p->nSample; } @@ -149670,13 +149670,13 @@ static int whereRangeSkipScanEst( int i; int nDiff; for(i=0; rc==SQLITE_OK && inSample; i++){ - rc = sqlite3Stat4Column(db, p->aSample[i].p, p->aSample[i].n, nEq, &pVal); + rc = tdsqlite3Stat4Column(db, p->aSample[i].p, p->aSample[i].n, nEq, &pVal); if( rc==SQLITE_OK && p1 ){ - int res = sqlite3MemCompare(p1, pVal, pColl); + int res = tdsqlite3MemCompare(p1, pVal, pColl); if( res>=0 ) nLower++; } if( rc==SQLITE_OK && p2 ){ - int res = sqlite3MemCompare(p2, pVal, pColl); + int res = tdsqlite3MemCompare(p2, pVal, pColl); if( res>=0 ) nUpper++; } } @@ -149689,7 +149689,7 @@ static int whereRangeSkipScanEst( ** the number of rows visited. Otherwise, estimate the number of rows ** using the method described in the header comment for this function. */ if( nDiff!=1 || pUpper==0 || pLower==0 ){ - int nAdjust = (sqlite3LogEst(p->nSample) - sqlite3LogEst(nDiff)); + int nAdjust = (tdsqlite3LogEst(p->nSample) - tdsqlite3LogEst(nDiff)); pLoop->nOut -= nAdjust; *pbDone = 1; WHERETRACE(0x10, ("range skip-scan regions: %u..%u adjust=%d est=%d\n", @@ -149700,9 +149700,9 @@ static int whereRangeSkipScanEst( assert( *pbDone==0 ); } - sqlite3ValueFree(p1); - sqlite3ValueFree(p2); - sqlite3ValueFree(pVal); + tdsqlite3ValueFree(p1); + tdsqlite3ValueFree(p2); + tdsqlite3ValueFree(pVal); return rc; } @@ -149737,7 +149737,7 @@ static int whereRangeSkipScanEst( ** ** then nEq is set to 0. ** -** When this function is called, *pnOut is set to the sqlite3LogEst() of the +** When this function is called, *pnOut is set to the tdsqlite3LogEst() of the ** number of rows that the index scan is expected to visit without ** considering the range constraints. If nEq is 0, then *pnOut is the number of ** rows in the index. Assuming no error occurs, *pnOut is adjusted (reduced) @@ -149825,11 +149825,11 @@ static int whereRangeScanEst( if( pLower ){ int n; /* Values extracted from pExpr */ Expr *pExpr = pLower->pExpr->pRight; - rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, nBtm, nEq, &n); + rc = tdsqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, nBtm, nEq, &n); if( rc==SQLITE_OK && n ){ tRowcnt iNew; u16 mask = WO_GT|WO_LE; - if( sqlite3ExprVectorSize(pExpr)>n ) mask = (WO_LE|WO_LT); + if( tdsqlite3ExprVectorSize(pExpr)>n ) mask = (WO_LE|WO_LT); iLwrIdx = whereKeyStats(pParse, p, pRec, 0, a); iNew = a[0] + ((pLower->eOperator & mask) ? a[1] : 0); if( iNew>iLower ) iLower = iNew; @@ -149842,11 +149842,11 @@ static int whereRangeScanEst( if( pUpper ){ int n; /* Values extracted from pExpr */ Expr *pExpr = pUpper->pExpr->pRight; - rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, nTop, nEq, &n); + rc = tdsqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, nTop, nEq, &n); if( rc==SQLITE_OK && n ){ tRowcnt iNew; u16 mask = WO_GT|WO_LE; - if( sqlite3ExprVectorSize(pExpr)>n ) mask = (WO_LE|WO_LT); + if( tdsqlite3ExprVectorSize(pExpr)>n ) mask = (WO_LE|WO_LT); iUprIdx = whereKeyStats(pParse, p, pRec, 1, a); iNew = a[0] + ((pUpper->eOperator & mask) ? a[1] : 0); if( iNewpRec = pRec; if( rc==SQLITE_OK ){ if( iUpper>iLower ){ - nNew = sqlite3LogEst(iUpper - iLower); + nNew = tdsqlite3LogEst(iUpper - iLower); /* TUNING: If both iUpper and iLower are derived from the same ** sample, then assume they are 4x more selective. This brings ** the estimated selectivity more in line with what it would be ** if estimated without the use of STAT4 tables. */ - if( iLwrIdx==iUprIdx ) nNew -= 20; assert( 20==sqlite3LogEst(4) ); + if( iLwrIdx==iUprIdx ) nNew -= 20; assert( 20==tdsqlite3LogEst(4) ); }else{ - nNew = 10; assert( 10==sqlite3LogEst(2) ); + nNew = 10; assert( 10==tdsqlite3LogEst(2) ); } if( nNew=p->nColumn ){ *pnRow = 1; return SQLITE_OK; } - rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, 1, nEq-1, &bOk); + rc = tdsqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, 1, nEq-1, &bOk); pBuilder->pRec = pRec; if( rc!=SQLITE_OK ) return rc; if( bOk==0 ) return SQLITE_NOTFOUND; @@ -150000,7 +150000,7 @@ static int whereInScanEst( tRowcnt *pnRow /* Write the revised row estimate here */ ){ Index *p = pBuilder->pNew->u.btree.pIndex; - i64 nRow0 = sqlite3LogEstToInt(p->aiRowLogEst[0]); + i64 nRow0 = tdsqlite3LogEstToInt(p->aiRowLogEst[0]); int nRecValid = pBuilder->nRecValid; int rc = SQLITE_OK; /* Subfunction return code */ tRowcnt nEst; /* Number of rows for a single term */ @@ -150030,9 +150030,9 @@ static int whereInScanEst( /* ** Print the content of a WhereTerm object */ -SQLITE_PRIVATE void sqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm){ +SQLITE_PRIVATE void tdsqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm){ if( pTerm==0 ){ - sqlite3DebugPrintf("TERM-%-3d NULL\n", iTerm); + tdsqlite3DebugPrintf("TERM-%-3d NULL\n", iTerm); }else{ char zType[8]; char zLeft[50]; @@ -150042,31 +150042,31 @@ SQLITE_PRIVATE void sqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm){ if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) zType[2] = 'L'; if( pTerm->wtFlags & TERM_CODED ) zType[3] = 'C'; if( pTerm->eOperator & WO_SINGLE ){ - sqlite3_snprintf(sizeof(zLeft),zLeft,"left={%d:%d}", + tdsqlite3_snprintf(sizeof(zLeft),zLeft,"left={%d:%d}", pTerm->leftCursor, pTerm->u.leftColumn); }else if( (pTerm->eOperator & WO_OR)!=0 && pTerm->u.pOrInfo!=0 ){ - sqlite3_snprintf(sizeof(zLeft),zLeft,"indexable=0x%lld", + tdsqlite3_snprintf(sizeof(zLeft),zLeft,"indexable=0x%lld", pTerm->u.pOrInfo->indexable); }else{ - sqlite3_snprintf(sizeof(zLeft),zLeft,"left=%d", pTerm->leftCursor); + tdsqlite3_snprintf(sizeof(zLeft),zLeft,"left=%d", pTerm->leftCursor); } - sqlite3DebugPrintf( + tdsqlite3DebugPrintf( "TERM-%-3d %p %s %-12s op=%03x wtFlags=%04x", iTerm, pTerm, zType, zLeft, pTerm->eOperator, pTerm->wtFlags); /* The 0x10000 .wheretrace flag causes extra information to be ** shown about each Term */ - if( sqlite3WhereTrace & 0x10000 ){ - sqlite3DebugPrintf(" prob=%-3d prereq=%llx,%llx", + if( tdsqlite3WhereTrace & 0x10000 ){ + tdsqlite3DebugPrintf(" prob=%-3d prereq=%llx,%llx", pTerm->truthProb, (u64)pTerm->prereqAll, (u64)pTerm->prereqRight); } if( pTerm->iField ){ - sqlite3DebugPrintf(" iField=%d", pTerm->iField); + tdsqlite3DebugPrintf(" iField=%d", pTerm->iField); } if( pTerm->iParent>=0 ){ - sqlite3DebugPrintf(" iParent=%d", pTerm->iParent); + tdsqlite3DebugPrintf(" iParent=%d", pTerm->iParent); } - sqlite3DebugPrintf("\n"); - sqlite3TreeViewExpr(0, pTerm->pExpr, 0); + tdsqlite3DebugPrintf("\n"); + tdsqlite3TreeViewExpr(0, pTerm->pExpr, 0); } } #endif @@ -150075,10 +150075,10 @@ SQLITE_PRIVATE void sqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm){ /* ** Show the complete content of a WhereClause */ -SQLITE_PRIVATE void sqlite3WhereClausePrint(WhereClause *pWC){ +SQLITE_PRIVATE void tdsqlite3WhereClausePrint(WhereClause *pWC){ int i; for(i=0; inTerm; i++){ - sqlite3WhereTermPrint(&pWC->a[i], i); + tdsqlite3WhereTermPrint(&pWC->a[i], i); } } #endif @@ -150087,49 +150087,49 @@ SQLITE_PRIVATE void sqlite3WhereClausePrint(WhereClause *pWC){ /* ** Print a WhereLoop object for debugging purposes */ -SQLITE_PRIVATE void sqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC){ +SQLITE_PRIVATE void tdsqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC){ WhereInfo *pWInfo = pWC->pWInfo; int nb = 1+(pWInfo->pTabList->nSrc+3)/4; struct SrcList_item *pItem = pWInfo->pTabList->a + p->iTab; Table *pTab = pItem->pTab; Bitmask mAll = (((Bitmask)1)<<(nb*4)) - 1; - sqlite3DebugPrintf("%c%2d.%0*llx.%0*llx", p->cId, + tdsqlite3DebugPrintf("%c%2d.%0*llx.%0*llx", p->cId, p->iTab, nb, p->maskSelf, nb, p->prereq & mAll); - sqlite3DebugPrintf(" %12s", + tdsqlite3DebugPrintf(" %12s", pItem->zAlias ? pItem->zAlias : pTab->zName); if( (p->wsFlags & WHERE_VIRTUALTABLE)==0 ){ const char *zName; if( p->u.btree.pIndex && (zName = p->u.btree.pIndex->zName)!=0 ){ if( strncmp(zName, "sqlite_autoindex_", 17)==0 ){ - int i = sqlite3Strlen30(zName) - 1; + int i = tdsqlite3Strlen30(zName) - 1; while( zName[i]!='_' ) i--; zName += i; } - sqlite3DebugPrintf(".%-16s %2d", zName, p->u.btree.nEq); + tdsqlite3DebugPrintf(".%-16s %2d", zName, p->u.btree.nEq); }else{ - sqlite3DebugPrintf("%20s",""); + tdsqlite3DebugPrintf("%20s",""); } }else{ char *z; if( p->u.vtab.idxStr ){ - z = sqlite3_mprintf("(%d,\"%s\",%#x)", + z = tdsqlite3_mprintf("(%d,\"%s\",%#x)", p->u.vtab.idxNum, p->u.vtab.idxStr, p->u.vtab.omitMask); }else{ - z = sqlite3_mprintf("(%d,%x)", p->u.vtab.idxNum, p->u.vtab.omitMask); + z = tdsqlite3_mprintf("(%d,%x)", p->u.vtab.idxNum, p->u.vtab.omitMask); } - sqlite3DebugPrintf(" %-19s", z); - sqlite3_free(z); + tdsqlite3DebugPrintf(" %-19s", z); + tdsqlite3_free(z); } if( p->wsFlags & WHERE_SKIPSCAN ){ - sqlite3DebugPrintf(" f %05x %d-%d", p->wsFlags, p->nLTerm,p->nSkip); + tdsqlite3DebugPrintf(" f %05x %d-%d", p->wsFlags, p->nLTerm,p->nSkip); }else{ - sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm); + tdsqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm); } - sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut); - if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){ + tdsqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut); + if( p->nLTerm && (tdsqlite3WhereTrace & 0x100)!=0 ){ int i; for(i=0; inLTerm; i++){ - sqlite3WhereTermPrint(p->aLTerm[i], i); + tdsqlite3WhereTermPrint(p->aLTerm[i], i); } } } @@ -150149,15 +150149,15 @@ static void whereLoopInit(WhereLoop *p){ /* ** Clear the WhereLoop.u union. Leave WhereLoop.pLTerm intact. */ -static void whereLoopClearUnion(sqlite3 *db, WhereLoop *p){ +static void whereLoopClearUnion(tdsqlite3 *db, WhereLoop *p){ if( p->wsFlags & (WHERE_VIRTUALTABLE|WHERE_AUTO_INDEX) ){ if( (p->wsFlags & WHERE_VIRTUALTABLE)!=0 && p->u.vtab.needFree ){ - sqlite3_free(p->u.vtab.idxStr); + tdsqlite3_free(p->u.vtab.idxStr); p->u.vtab.needFree = 0; p->u.vtab.idxStr = 0; }else if( (p->wsFlags & WHERE_AUTO_INDEX)!=0 && p->u.btree.pIndex!=0 ){ - sqlite3DbFree(db, p->u.btree.pIndex->zColAff); - sqlite3DbFreeNN(db, p->u.btree.pIndex); + tdsqlite3DbFree(db, p->u.btree.pIndex->zColAff); + tdsqlite3DbFreeNN(db, p->u.btree.pIndex); p->u.btree.pIndex = 0; } } @@ -150166,8 +150166,8 @@ static void whereLoopClearUnion(sqlite3 *db, WhereLoop *p){ /* ** Deallocate internal memory used by a WhereLoop object */ -static void whereLoopClear(sqlite3 *db, WhereLoop *p){ - if( p->aLTerm!=p->aLTermSpace ) sqlite3DbFreeNN(db, p->aLTerm); +static void whereLoopClear(tdsqlite3 *db, WhereLoop *p){ + if( p->aLTerm!=p->aLTermSpace ) tdsqlite3DbFreeNN(db, p->aLTerm); whereLoopClearUnion(db, p); whereLoopInit(p); } @@ -150175,14 +150175,14 @@ static void whereLoopClear(sqlite3 *db, WhereLoop *p){ /* ** Increase the memory allocation for pLoop->aLTerm[] to be at least n. */ -static int whereLoopResize(sqlite3 *db, WhereLoop *p, int n){ +static int whereLoopResize(tdsqlite3 *db, WhereLoop *p, int n){ WhereTerm **paNew; if( p->nLSlot>=n ) return SQLITE_OK; n = (n+7)&~7; - paNew = sqlite3DbMallocRawNN(db, sizeof(p->aLTerm[0])*n); + paNew = tdsqlite3DbMallocRawNN(db, sizeof(p->aLTerm[0])*n); if( paNew==0 ) return SQLITE_NOMEM_BKPT; memcpy(paNew, p->aLTerm, sizeof(p->aLTerm[0])*p->nLSlot); - if( p->aLTerm!=p->aLTermSpace ) sqlite3DbFreeNN(db, p->aLTerm); + if( p->aLTerm!=p->aLTermSpace ) tdsqlite3DbFreeNN(db, p->aLTerm); p->aLTerm = paNew; p->nLSlot = n; return SQLITE_OK; @@ -150191,7 +150191,7 @@ static int whereLoopResize(sqlite3 *db, WhereLoop *p, int n){ /* ** Transfer content from the second pLoop into the first. */ -static int whereLoopXfer(sqlite3 *db, WhereLoop *pTo, WhereLoop *pFrom){ +static int whereLoopXfer(tdsqlite3 *db, WhereLoop *pTo, WhereLoop *pFrom){ whereLoopClearUnion(db, pTo); if( whereLoopResize(db, pTo, pFrom->nLTerm) ){ memset(&pTo->u, 0, sizeof(pTo->u)); @@ -150210,31 +150210,31 @@ static int whereLoopXfer(sqlite3 *db, WhereLoop *pTo, WhereLoop *pFrom){ /* ** Delete a WhereLoop object */ -static void whereLoopDelete(sqlite3 *db, WhereLoop *p){ +static void whereLoopDelete(tdsqlite3 *db, WhereLoop *p){ whereLoopClear(db, p); - sqlite3DbFreeNN(db, p); + tdsqlite3DbFreeNN(db, p); } /* ** Free a WhereInfo structure */ -static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){ +static void whereInfoFree(tdsqlite3 *db, WhereInfo *pWInfo){ int i; assert( pWInfo!=0 ); for(i=0; inLevel; i++){ WhereLevel *pLevel = &pWInfo->a[i]; if( pLevel->pWLoop && (pLevel->pWLoop->wsFlags & WHERE_IN_ABLE) ){ - sqlite3DbFree(db, pLevel->u.in.aInLoop); + tdsqlite3DbFree(db, pLevel->u.in.aInLoop); } } - sqlite3WhereClauseClear(&pWInfo->sWC); + tdsqlite3WhereClauseClear(&pWInfo->sWC); while( pWInfo->pLoops ){ WhereLoop *p = pWInfo->pLoops; pWInfo->pLoops = p->pNextLoop; whereLoopDelete(db, p); } assert( pWInfo->pExprMods==0 ); - sqlite3DbFreeNN(db, pWInfo); + tdsqlite3DbFreeNN(db, pWInfo); } /* @@ -150424,7 +150424,7 @@ static WhereLoop **whereLoopFindLesser( static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){ WhereLoop **ppPrev, *p; WhereInfo *pWInfo = pBuilder->pWInfo; - sqlite3 *db = pWInfo->pParse->db; + tdsqlite3 *db = pWInfo->pParse->db; int rc; /* Stop the search once we hit the query planner search limit */ @@ -150449,9 +150449,9 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){ whereOrInsert(pBuilder->pOrSet, pTemplate->prereq, pTemplate->rRun, pTemplate->nOut); #if WHERETRACE_ENABLED /* 0x8 */ - if( sqlite3WhereTrace & 0x8 ){ - sqlite3DebugPrintf(x?" or-%d: ":" or-X: ", n); - sqlite3WhereLoopPrint(pTemplate, pBuilder->pWC); + if( tdsqlite3WhereTrace & 0x8 ){ + tdsqlite3DebugPrintf(x?" or-%d: ":" or-X: ", n); + tdsqlite3WhereLoopPrint(pTemplate, pBuilder->pWC); } #endif } @@ -150466,9 +150466,9 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){ /* There already exists a WhereLoop on the list that is better ** than pTemplate, so just ignore pTemplate */ #if WHERETRACE_ENABLED /* 0x8 */ - if( sqlite3WhereTrace & 0x8 ){ - sqlite3DebugPrintf(" skip: "); - sqlite3WhereLoopPrint(pTemplate, pBuilder->pWC); + if( tdsqlite3WhereTrace & 0x8 ){ + tdsqlite3DebugPrintf(" skip: "); + tdsqlite3WhereLoopPrint(pTemplate, pBuilder->pWC); } #endif return SQLITE_OK; @@ -150481,20 +150481,20 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){ ** WhereLoop and insert it. */ #if WHERETRACE_ENABLED /* 0x8 */ - if( sqlite3WhereTrace & 0x8 ){ + if( tdsqlite3WhereTrace & 0x8 ){ if( p!=0 ){ - sqlite3DebugPrintf("replace: "); - sqlite3WhereLoopPrint(p, pBuilder->pWC); - sqlite3DebugPrintf(" with: "); + tdsqlite3DebugPrintf("replace: "); + tdsqlite3WhereLoopPrint(p, pBuilder->pWC); + tdsqlite3DebugPrintf(" with: "); }else{ - sqlite3DebugPrintf(" add: "); + tdsqlite3DebugPrintf(" add: "); } - sqlite3WhereLoopPrint(pTemplate, pBuilder->pWC); + tdsqlite3WhereLoopPrint(pTemplate, pBuilder->pWC); } #endif if( p==0 ){ /* Allocate a new WhereLoop to add to the end of the list */ - *ppPrev = p = sqlite3DbMallocRawNN(db, sizeof(WhereLoop)); + *ppPrev = p = tdsqlite3DbMallocRawNN(db, sizeof(WhereLoop)); if( p==0 ) return SQLITE_NOMEM_BKPT; whereLoopInit(p); p->pNextLoop = 0; @@ -150511,9 +150511,9 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){ if( pToDel==0 ) break; *ppTail = pToDel->pNextLoop; #if WHERETRACE_ENABLED /* 0x8 */ - if( sqlite3WhereTrace & 0x8 ){ - sqlite3DebugPrintf(" delete: "); - sqlite3WhereLoopPrint(pToDel, pBuilder->pWC); + if( tdsqlite3WhereTrace & 0x8 ){ + tdsqlite3DebugPrintf(" delete: "); + tdsqlite3WhereLoopPrint(pToDel, pBuilder->pWC); } #endif whereLoopDelete(db, pToDel); @@ -150593,7 +150593,7 @@ static void whereLoopOutputAdjust( Expr *pRight = pTerm->pExpr->pRight; int k = 0; testcase( pTerm->pExpr->op==TK_IS ); - if( sqlite3ExprIsInteger(pRight, &k) && k>=(-1) && k<=1 ){ + if( tdsqlite3ExprIsInteger(pRight, &k) && k>=(-1) && k<=1 ){ k = 10; }else{ k = 20; @@ -150630,7 +150630,7 @@ static int whereRangeVectorLen( int nEq, /* Number of prior equality constraints on same index */ WhereTerm *pTerm /* The vector inequality constraint */ ){ - int nCmp = sqlite3ExprVectorSize(pTerm->pExpr->pLeft); + int nCmp = tdsqlite3ExprVectorSize(pTerm->pExpr->pLeft); int i; nCmp = MIN(nCmp, (pIdx->nColumn - nEq)); @@ -150661,13 +150661,13 @@ static int whereRangeVectorLen( } testcase( pLhs->iColumn==XN_ROWID ); - aff = sqlite3CompareAffinity(pRhs, sqlite3ExprAffinity(pLhs)); - idxaff = sqlite3TableColumnAffinity(pIdx->pTable, pLhs->iColumn); + aff = tdsqlite3CompareAffinity(pRhs, tdsqlite3ExprAffinity(pLhs)); + idxaff = tdsqlite3TableColumnAffinity(pIdx->pTable, pLhs->iColumn); if( aff!=idxaff ) break; - pColl = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs); + pColl = tdsqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs); if( pColl==0 ) break; - if( sqlite3StrICmp(pColl->zName, pIdx->azColl[i+nEq]) ) break; + if( tdsqlite3StrICmp(pColl->zName, pIdx->azColl[i+nEq]) ) break; } return i; } @@ -150702,7 +150702,7 @@ static int whereLoopAddBtreeIndex( ){ WhereInfo *pWInfo = pBuilder->pWInfo; /* WHERE analyse context */ Parse *pParse = pWInfo->pParse; /* Parsing context */ - sqlite3 *db = pParse->db; /* Database connection malloc context */ + tdsqlite3 *db = pParse->db; /* Database connection malloc context */ WhereLoop *pNew; /* Template WhereLoop under construction */ WhereTerm *pTerm; /* A WhereTerm under consideration */ int opMask; /* Valid operators for constraints */ @@ -150804,7 +150804,7 @@ static int whereLoopAddBtreeIndex( if( ExprHasProperty(pExpr, EP_xIsSelect) ){ /* "x IN (SELECT ...)": TUNING: the SELECT returns 25 rows */ int i; - nIn = 46; assert( 46==sqlite3LogEst(25) ); + nIn = 46; assert( 46==tdsqlite3LogEst(25) ); /* The expression may actually be of the form (x, y) IN (SELECT...). ** In this case there is a separate term for each of (x) and (y). @@ -150816,7 +150816,7 @@ static int whereLoopAddBtreeIndex( } }else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){ /* "x IN (value, value, ...)" */ - nIn = sqlite3LogEst(pExpr->x.pList->nExpr); + nIn = tdsqlite3LogEst(pExpr->x.pList->nExpr); } if( pProbe->hasStat1 ){ LogEst M, logK, safetyMargin; @@ -150946,7 +150946,7 @@ static int whereLoopAddBtreeIndex( if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK; if( rc!=SQLITE_OK ) break; /* Jump out of the pTerm loop */ if( nOut ){ - pNew->nOut = sqlite3LogEst(nOut); + pNew->nOut = tdsqlite3LogEst(nOut); if( pNew->nOut>saved_nOut ) pNew->nOut = saved_nOut; pNew->nOut -= nIn; } @@ -150971,9 +150971,9 @@ static int whereLoopAddBtreeIndex( ** visiting the rows in the main table. */ assert( pSrc->pTab->szTabRow>0 ); rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow; - pNew->rRun = sqlite3LogEstAdd(rLogSize, rCostIdx); + pNew->rRun = tdsqlite3LogEstAdd(rLogSize, rCostIdx); if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK))==0 ){ - pNew->rRun = sqlite3LogEstAdd(pNew->rRun, pNew->nOut + 16); + pNew->rRun = tdsqlite3LogEstAdd(pNew->rRun, pNew->nOut + 16); } ApplyCostMultiplier(pNew->rRun, pProbe->pTable->costMult); @@ -151018,7 +151018,7 @@ static int whereLoopAddBtreeIndex( ** the code). And, even if it is not, it should not be too much slower. ** On the other hand, the extra seeks could end up being significantly ** more expensive. */ - assert( 42==sqlite3LogEst(18) ); + assert( 42==tdsqlite3LogEst(18) ); if( saved_nEq==saved_nSkip && saved_nEq+1nKeyCol && saved_nEq==pNew->nLTerm @@ -151069,7 +151069,7 @@ static int indexMightHelpWithOrderBy( if( pIndex->bUnordered ) return 0; if( (pOB = pBuilder->pWInfo->pOrderBy)==0 ) return 0; for(ii=0; iinExpr; ii++){ - Expr *pExpr = sqlite3ExprSkipCollateAndLikely(pOB->a[ii].pExpr); + Expr *pExpr = tdsqlite3ExprSkipCollateAndLikely(pOB->a[ii].pExpr); if( pExpr->op==TK_COLUMN && pExpr->iTable==iCursor ){ if( pExpr->iColumn<0 ) return 1; for(jj=0; jjnKeyCol; jj++){ @@ -151078,7 +151078,7 @@ static int indexMightHelpWithOrderBy( }else if( (aColExpr = pIndex->aColExpr)!=0 ){ for(jj=0; jjnKeyCol; jj++){ if( pIndex->aiColumn[jj]!=XN_EXPR ) continue; - if( sqlite3ExprCompareSkip(pExpr,aColExpr->a[jj].pExpr,iCursor)==0 ){ + if( tdsqlite3ExprCompareSkip(pExpr,aColExpr->a[jj].pExpr,iCursor)==0 ){ return 1; } } @@ -151109,7 +151109,7 @@ static int whereUsablePartialIndex( pExpr = pTerm->pExpr; if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab) && (isLeft==0 || ExprHasProperty(pExpr, EP_FromJoin)) - && sqlite3ExprImpliesExpr(pParse, pExpr, pWhere, iTab) + && tdsqlite3ExprImpliesExpr(pParse, pExpr, pWhere, iTab) ){ return 1; } @@ -151256,8 +151256,8 @@ static int whereLoopAddBtree( ** is more than the usual guess of 10 rows, since we have no way ** of knowing how selective the index will ultimately be. It would ** not be unreasonable to make this value much larger. */ - pNew->nOut = 43; assert( 43==sqlite3LogEst(20) ); - pNew->rRun = sqlite3LogEstAdd(rLogSize,pNew->nOut); + pNew->nOut = 43; assert( 43==tdsqlite3LogEst(20) ); + pNew->rRun = tdsqlite3LogEstAdd(rLogSize,pNew->nOut); pNew->wsFlags = WHERE_AUTO_INDEX; pNew->prereq = mPrereq | pTerm->prereqRight; rc = whereLoopInsert(pBuilder, pNew); @@ -151325,7 +151325,7 @@ static int whereLoopAddBtree( && pProbe->bUnordered==0 && (pProbe->szIdxRowszTabRow) && (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 - && sqlite3GlobalConfig.bUseCis + && tdsqlite3GlobalConfig.bUseCis && OptimizationEnabled(pWInfo->pParse->db, SQLITE_CoverIdxScan) ) ){ @@ -151347,7 +151347,7 @@ static int whereLoopAddBtree( WhereClause *pWC2 = &pWInfo->sWC; for(ii=0; iinTerm; ii++){ WhereTerm *pTerm = &pWC2->a[ii]; - if( !sqlite3ExprCoveredByIndex(pTerm->pExpr, iCur, pProbe) ){ + if( !tdsqlite3ExprCoveredByIndex(pTerm->pExpr, iCur, pProbe) ){ break; } /* pTerm can be evaluated using just the index. So reduce @@ -151360,7 +151360,7 @@ static int whereLoopAddBtree( } } - pNew->rRun = sqlite3LogEstAdd(pNew->rRun, nLookup); + pNew->rRun = tdsqlite3LogEstAdd(pNew->rRun, nLookup); } ApplyCostMultiplier(pNew->rRun, pTab->costMult); whereLoopOutputAdjust(pWC, pNew, rSize); @@ -151380,7 +151380,7 @@ static int whereLoopAddBtree( pTab->tabFlags |= TF_StatsUsed; } #ifdef SQLITE_ENABLE_STAT4 - sqlite3Stat4ProbeFree(pBuilder->pRec); + tdsqlite3Stat4ProbeFree(pBuilder->pRec); pBuilder->nRecValid = 0; pBuilder->pRec = 0; #endif @@ -151415,13 +151415,13 @@ static int whereLoopAddVirtualOne( Bitmask mPrereq, /* Mask of tables that must be used. */ Bitmask mUsable, /* Mask of usable tables */ u16 mExclude, /* Exclude terms using these operators */ - sqlite3_index_info *pIdxInfo, /* Populated object for xBestIndex */ + tdsqlite3_index_info *pIdxInfo, /* Populated object for xBestIndex */ u16 mNoOmit, /* Do not omit these constraints */ int *pbIn /* OUT: True if plan uses an IN(...) op */ ){ WhereClause *pWC = pBuilder->pWC; - struct sqlite3_index_constraint *pIdxCons; - struct sqlite3_index_constraint_usage *pUsage = pIdxInfo->aConstraintUsage; + struct tdsqlite3_index_constraint *pIdxCons; + struct tdsqlite3_index_constraint_usage *pUsage = pIdxInfo->aConstraintUsage; int i; int mxTerm; int rc = SQLITE_OK; @@ -151436,7 +151436,7 @@ static int whereLoopAddVirtualOne( /* Set the usable flag on the subset of constraints identified by ** arguments mUsable and mExclude. */ - pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; + pIdxCons = *(struct tdsqlite3_index_constraint**)&pIdxInfo->aConstraint; for(i=0; ia[pIdxCons->iTermOffset]; pIdxCons->usable = 0; @@ -151447,7 +151447,7 @@ static int whereLoopAddVirtualOne( } } - /* Initialize the output fields of the sqlite3_index_info structure */ + /* Initialize the output fields of the tdsqlite3_index_info structure */ memset(pUsage, 0, sizeof(pUsage[0])*nConstraint); assert( pIdxInfo->needToFreeIdxStr==0 ); pIdxInfo->idxStr = 0; @@ -151456,7 +151456,7 @@ static int whereLoopAddVirtualOne( pIdxInfo->estimatedCost = SQLITE_BIG_DBL / (double)2; pIdxInfo->estimatedRows = 25; pIdxInfo->idxFlags = 0; - pIdxInfo->colUsed = (sqlite3_int64)pSrc->colUsed; + pIdxInfo->colUsed = (tdsqlite3_int64)pSrc->colUsed; /* Invoke the virtual table xBestIndex() method */ rc = vtabBestIndex(pParse, pSrc->pTab, pIdxInfo); @@ -151476,7 +151476,7 @@ static int whereLoopAddVirtualOne( assert( pNew->nLSlot>=nConstraint ); for(i=0; iaLTerm[i] = 0; pNew->u.vtab.omitMask = 0; - pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; + pIdxCons = *(struct tdsqlite3_index_constraint**)&pIdxInfo->aConstraint; for(i=0; i=0 ){ @@ -151488,7 +151488,7 @@ static int whereLoopAddVirtualOne( || pNew->aLTerm[iTerm]!=0 || pIdxCons->usable==0 ){ - sqlite3ErrorMsg(pParse,"%s.xBestIndex malfunction",pSrc->pTab->zName); + tdsqlite3ErrorMsg(pParse,"%s.xBestIndex malfunction",pSrc->pTab->zName); testcase( pIdxInfo->needToFreeIdxStr ); return SQLITE_ERROR; } @@ -151528,7 +151528,7 @@ static int whereLoopAddVirtualOne( if( pNew->aLTerm[i]==0 ){ /* The non-zero argvIdx values must be contiguous. Raise an ** error if they are not */ - sqlite3ErrorMsg(pParse,"%s.xBestIndex malfunction",pSrc->pTab->zName); + tdsqlite3ErrorMsg(pParse,"%s.xBestIndex malfunction",pSrc->pTab->zName); testcase( pIdxInfo->needToFreeIdxStr ); return SQLITE_ERROR; } @@ -151541,8 +151541,8 @@ static int whereLoopAddVirtualOne( pNew->u.vtab.isOrdered = (i8)(pIdxInfo->orderByConsumed ? pIdxInfo->nOrderBy : 0); pNew->rSetup = 0; - pNew->rRun = sqlite3LogEstFromDouble(pIdxInfo->estimatedCost); - pNew->nOut = sqlite3LogEst(pIdxInfo->estimatedRows); + pNew->rRun = tdsqlite3LogEstFromDouble(pIdxInfo->estimatedCost); + pNew->nOut = tdsqlite3LogEst(pIdxInfo->estimatedRows); /* Set the WHERE_ONEROW flag if the xBestIndex() method indicated ** that the scan will visit at most one row. Clear it otherwise. */ @@ -151553,12 +151553,12 @@ static int whereLoopAddVirtualOne( } rc = whereLoopInsert(pBuilder, pNew); if( pNew->u.vtab.needFree ){ - sqlite3_free(pNew->u.vtab.idxStr); + tdsqlite3_free(pNew->u.vtab.idxStr); pNew->u.vtab.needFree = 0; } WHERETRACE(0xffff, (" bIn=%d prereqIn=%04llx prereqOut=%04llx\n", - *pbIn, (sqlite3_uint64)mPrereq, - (sqlite3_uint64)(pNew->prereq & ~mPrereq))); + *pbIn, (tdsqlite3_uint64)mPrereq, + (tdsqlite3_uint64)(pNew->prereq & ~mPrereq))); return rc; } @@ -151566,11 +151566,11 @@ static int whereLoopAddVirtualOne( /* ** If this function is invoked from within an xBestIndex() callback, it ** returns a pointer to a buffer containing the name of the collation -** sequence associated with element iCons of the sqlite3_index_info.aConstraint +** sequence associated with element iCons of the tdsqlite3_index_info.aConstraint ** array. Or, if iCons is out of range or there is no active xBestIndex ** call, return NULL. */ -SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info *pIdxInfo, int iCons){ +SQLITE_API const char *tdsqlite3_vtab_collation(tdsqlite3_index_info *pIdxInfo, int iCons){ HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; const char *zRet = 0; if( iCons>=0 && iConsnConstraint ){ @@ -151578,9 +151578,9 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info *pIdxInfo, int int iTerm = pIdxInfo->aConstraint[iCons].iTermOffset; Expr *pX = pHidden->pWC->a[iTerm].pExpr; if( pX->pLeft ){ - pC = sqlite3ExprCompareCollSeq(pHidden->pParse, pX); + pC = tdsqlite3ExprCompareCollSeq(pHidden->pParse, pX); } - zRet = (pC ? pC->zName : sqlite3StrBINARY); + zRet = (pC ? pC->zName : tdsqlite3StrBINARY); } return zRet; } @@ -151620,7 +151620,7 @@ static int whereLoopAddVirtual( Parse *pParse; /* The parsing context */ WhereClause *pWC; /* The WHERE clause */ struct SrcList_item *pSrc; /* The FROM clause term to search */ - sqlite3_index_info *p; /* Object to pass to xBestIndex() */ + tdsqlite3_index_info *p; /* Object to pass to xBestIndex() */ int nConstraint; /* Number of constraints in p */ int bIn; /* True if plan uses IN(...) operator */ WhereLoop *pNew; @@ -151643,7 +151643,7 @@ static int whereLoopAddVirtual( pNew->u.vtab.needFree = 0; nConstraint = p->nConstraint; if( whereLoopResize(pParse->db, pNew, nConstraint) ){ - sqlite3DbFree(pParse->db, p); + tdsqlite3DbFree(pParse->db, p); return SQLITE_NOMEM_BKPT; } @@ -151693,7 +151693,7 @@ static int whereLoopAddVirtual( if( mNext==ALLBITS ) break; if( mNext==mBest || mNext==mBestNoIn ) continue; WHERETRACE(0x40, (" VirtualOne: mPrev=%04llx mNext=%04llx\n", - (sqlite3_uint64)mPrev, (sqlite3_uint64)mNext)); + (tdsqlite3_uint64)mPrev, (tdsqlite3_uint64)mNext)); rc = whereLoopAddVirtualOne( pBuilder, mPrereq, mNext|mPrereq, 0, p, mNoOmit, &bIn); if( pNew->prereq==mPrereq ){ @@ -151722,8 +151722,8 @@ static int whereLoopAddVirtual( } } - if( p->needToFreeIdxStr ) sqlite3_free(p->idxStr); - sqlite3DbFreeNN(pParse->db, p); + if( p->needToFreeIdxStr ) tdsqlite3_free(p->idxStr); + tdsqlite3DbFreeNN(pParse->db, p); WHERETRACE(0x800, ("END %s.addVirtual(), rc=%d\n", pSrc->pTab->zName, rc)); return rc; } @@ -151788,8 +151788,8 @@ static int whereLoopAddOr( #ifdef WHERETRACE_ENABLED WHERETRACE(0x200, ("OR-term %d of %p has %d subterms:\n", (int)(pOrTerm-pOrWC->a), pTerm, sSubBuild.pWC->nTerm)); - if( sqlite3WhereTrace & 0x400 ){ - sqlite3WhereClausePrint(sSubBuild.pWC); + if( tdsqlite3WhereTrace & 0x400 ){ + tdsqlite3WhereClausePrint(sSubBuild.pWC); } #endif #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -151818,8 +151818,8 @@ static int whereLoopAddOr( for(i=0; ipTabList; struct SrcList_item *pItem; struct SrcList_item *pEnd = &pTabList->a[pWInfo->nLevel]; - sqlite3 *db = pWInfo->pParse->db; + tdsqlite3 *db = pWInfo->pParse->db; int rc = SQLITE_OK; WhereLoop *pNew; u8 priorJointype = 0; @@ -151878,7 +151878,7 @@ static int whereLoopAddAll(WhereLoopBuilder *pBuilder){ Bitmask mUnusable = 0; pNew->iTab = iTab; pBuilder->iPlanLimit += SQLITE_QUERY_PLANNER_LIMIT_INCR; - pNew->maskSelf = sqlite3WhereGetMask(&pWInfo->sMaskSet, pItem->iCursor); + pNew->maskSelf = tdsqlite3WhereGetMask(&pWInfo->sMaskSet, pItem->iCursor); if( ((pItem->fg.jointype|priorJointype) & (JT_LEFT|JT_CROSS))!=0 ){ /* This condition is true when pItem is the FROM clause term on the ** right-hand-side of a LEFT or CROSS JOIN. */ @@ -151890,7 +151890,7 @@ static int whereLoopAddAll(WhereLoopBuilder *pBuilder){ struct SrcList_item *p; for(p=&pItem[1]; pfg.jointype & (JT_LEFT|JT_CROSS)) ){ - mUnusable |= sqlite3WhereGetMask(&pWInfo->sMaskSet, p->iCursor); + mUnusable |= tdsqlite3WhereGetMask(&pWInfo->sMaskSet, p->iCursor); } } rc = whereLoopAddVirtual(pBuilder, mPrereq, mUnusable); @@ -151906,7 +151906,7 @@ static int whereLoopAddAll(WhereLoopBuilder *pBuilder){ if( rc || db->mallocFailed ){ if( rc==SQLITE_DONE ){ /* We hit the query planner search limit set by iPlanLimit */ - sqlite3_log(SQLITE_WARNING, "abbreviated query algorithm search"); + tdsqlite3_log(SQLITE_WARNING, "abbreviated query algorithm search"); rc = SQLITE_OK; }else{ break; @@ -151963,7 +151963,7 @@ static i8 wherePathSatisfiesOrderBy( Expr *pOBExpr; /* An expression from the ORDER BY clause */ CollSeq *pColl; /* COLLATE function from an ORDER BY clause term */ Index *pIndex; /* The index associated with pLoop */ - sqlite3 *db = pWInfo->pParse->db; /* Database connection */ + tdsqlite3 *db = pWInfo->pParse->db; /* Database connection */ Bitmask obSat = 0; /* Mask of ORDER BY terms satisfied so far */ Bitmask obDone; /* Mask of all ORDER BY terms */ Bitmask orderDistinctMask; /* Mask of all well-ordered loops */ @@ -152028,10 +152028,10 @@ static i8 wherePathSatisfiesOrderBy( */ for(i=0; ia[i].pExpr); + pOBExpr = tdsqlite3ExprSkipCollateAndLikely(pOrderBy->a[i].pExpr); if( pOBExpr->op!=TK_COLUMN ) continue; if( pOBExpr->iTable!=iCur ) continue; - pTerm = sqlite3WhereFindTerm(&pWInfo->sWC, iCur, pOBExpr->iColumn, + pTerm = tdsqlite3WhereFindTerm(&pWInfo->sWC, iCur, pOBExpr->iColumn, ~ready, eqOpMask, 0); if( pTerm==0 ) continue; if( pTerm->eOperator==WO_IN ){ @@ -152043,7 +152043,7 @@ static i8 wherePathSatisfiesOrderBy( if( j>=pLoop->nLTerm ) continue; } if( (pTerm->eOperator&(WO_EQ|WO_IS))!=0 && pOBExpr->iColumn>=0 ){ - if( sqlite3ExprCollSeqMatch(pWInfo->pParse, + if( tdsqlite3ExprCollSeqMatch(pWInfo->pParse, pOrderBy->a[i].pExpr, pTerm->pExpr)==0 ){ continue; } @@ -152148,7 +152148,7 @@ static i8 wherePathSatisfiesOrderBy( isMatch = 0; for(i=0; bOnce && ia[i].pExpr); + pOBExpr = tdsqlite3ExprSkipCollateAndLikely(pOrderBy->a[i].pExpr); testcase( wctrlFlags & WHERE_GROUPBY ); testcase( wctrlFlags & WHERE_DISTINCTBY ); if( (wctrlFlags & (WHERE_GROUPBY|WHERE_DISTINCTBY))==0 ) bOnce = 0; @@ -152158,13 +152158,13 @@ static i8 wherePathSatisfiesOrderBy( if( pOBExpr->iColumn!=iColumn ) continue; }else{ Expr *pIdxExpr = pIndex->aColExpr->a[j].pExpr; - if( sqlite3ExprCompareSkip(pOBExpr, pIdxExpr, iCur) ){ + if( tdsqlite3ExprCompareSkip(pOBExpr, pIdxExpr, iCur) ){ continue; } } if( iColumn!=XN_ROWID ){ - pColl = sqlite3ExprNNCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr); - if( sqlite3StrICmp(pColl->zName, pIndex->azColl[j])!=0 ) continue; + pColl = tdsqlite3ExprNNCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr); + if( tdsqlite3StrICmp(pColl->zName, pIndex->azColl[j])!=0 ) continue; } if( wctrlFlags & WHERE_DISTINCTBY ){ pLoop->u.btree.nDistinctCol = j+1; @@ -152221,8 +152221,8 @@ static i8 wherePathSatisfiesOrderBy( Bitmask mTerm; if( MASKBIT(i) & obSat ) continue; p = pOrderBy->a[i].pExpr; - mTerm = sqlite3WhereExprUsage(&pWInfo->sMaskSet,p); - if( mTerm==0 && !sqlite3ExprIsConstant(p) ) continue; + mTerm = tdsqlite3WhereExprUsage(&pWInfo->sMaskSet,p); + if( mTerm==0 && !tdsqlite3ExprIsConstant(p) ) continue; if( (mTerm&~orderDistinctMask)==0 ){ obSat |= MASKBIT(i); } @@ -152242,7 +152242,7 @@ static i8 wherePathSatisfiesOrderBy( /* -** If the WHERE_GROUPBY flag is set in the mask passed to sqlite3WhereBegin(), +** If the WHERE_GROUPBY flag is set in the mask passed to tdsqlite3WhereBegin(), ** the planner assumes that the specified pOrderBy list is actually a GROUP ** BY clause - and so any order that groups rows as required satisfies the ** request. @@ -152250,7 +152250,7 @@ static i8 wherePathSatisfiesOrderBy( ** Normally, in this case it is not possible for the caller to determine ** whether or not the rows are really being delivered in sorted order, or ** just in some other order that provides the required grouping. However, -** if the WHERE_SORTBYGROUP flag is also passed to sqlite3WhereBegin(), then +** if the WHERE_SORTBYGROUP flag is also passed to tdsqlite3WhereBegin(), then ** this function may be called on the returned WhereInfo object. It returns ** true if the rows really will be sorted in the specified order, or false ** otherwise. @@ -152264,7 +152264,7 @@ static i8 wherePathSatisfiesOrderBy( ** SELECT * FROM t1 GROUP BY x,y ORDER BY x,y; -- IsSorted()==1 ** SELECT * FROM t1 GROUP BY y,x ORDER BY y,x; -- IsSorted()==0 */ -SQLITE_PRIVATE int sqlite3WhereIsSorted(WhereInfo *pWInfo){ +SQLITE_PRIVATE int tdsqlite3WhereIsSorted(WhereInfo *pWInfo){ assert( pWInfo->wctrlFlags & WHERE_GROUPBY ); assert( pWInfo->wctrlFlags & WHERE_SORTBYGROUP ); return pWInfo->sorted; @@ -152307,8 +152307,8 @@ static LogEst whereSortingCost( ** The (Y/X) term is implemented using stack variable rScale ** below. */ LogEst rScale, rSortCost; - assert( nOrderBy>0 && 66==sqlite3LogEst(100) ); - rScale = sqlite3LogEst((nOrderBy-nSorted)*100/nOrderBy) - 66; + assert( nOrderBy>0 && 66==tdsqlite3LogEst(100) ); + rScale = tdsqlite3LogEst((nOrderBy-nSorted)*100/nOrderBy) - 66; rSortCost = nRow + rScale + 16; /* Multiple by log(M) where M is the number of output rows. @@ -152336,7 +152336,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ int mxChoice; /* Maximum number of simultaneous paths tracked */ int nLoop; /* Number of terms in the join */ Parse *pParse; /* Parsing context */ - sqlite3 *db; /* The database connection */ + tdsqlite3 *db; /* The database connection */ int iLoop; /* Loop counter over the terms of the join */ int ii, jj; /* Loop counters */ int mxI = 0; /* Index of next entry to replace */ @@ -152378,7 +152378,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ /* Allocate and initialize space for aTo, aFrom and aSortCost[] */ nSpace = (sizeof(WherePath)+sizeof(WhereLoop*)*nLoop)*mxChoice*2; nSpace += sizeof(LogEst) * nOrderBy; - pSpace = sqlite3DbMallocRawNN(db, nSpace); + pSpace = tdsqlite3DbMallocRawNN(db, nSpace); if( pSpace==0 ) return SQLITE_NOMEM_BKPT; aTo = (WherePath*)pSpace; aFrom = aTo+mxChoice; @@ -152405,7 +152405,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ ** TUNING: Do not let the number of iterations go above 28. If the cost ** of computing an automatic index is not paid back within the first 28 ** rows, then do not use the automatic index. */ - aFrom[0].nRow = MIN(pParse->nQueryLoop, 48); assert( 48==sqlite3LogEst(28) ); + aFrom[0].nRow = MIN(pParse->nQueryLoop, 48); assert( 48==tdsqlite3LogEst(28) ); nFrom = 1; assert( aFrom[0].isOrdered==0 ); if( nOrderBy ){ @@ -152439,14 +152439,14 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ ** to run less than 1.25 times. It is tempting to also exclude ** automatic index usage on an outer loop, but sometimes an automatic ** index is useful in the outer loop of a correlated subquery. */ - assert( 10==sqlite3LogEst(2) ); + assert( 10==tdsqlite3LogEst(2) ); continue; } /* At this point, pWLoop is a candidate to be the next loop. ** Compute its cost */ - rUnsorted = sqlite3LogEstAdd(pWLoop->rSetup,pWLoop->rRun + pFrom->nRow); - rUnsorted = sqlite3LogEstAdd(rUnsorted, pFrom->rUnsorted); + rUnsorted = tdsqlite3LogEstAdd(pWLoop->rSetup,pWLoop->rRun + pFrom->nRow); + rUnsorted = tdsqlite3LogEstAdd(rUnsorted, pFrom->rUnsorted); nOut = pFrom->nRow + pWLoop->nOut; maskNew = pFrom->maskLoop | pWLoop->maskSelf; if( isOrdered<0 ){ @@ -152466,7 +152466,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ ** extra encouragment to the query planner to select a plan ** where the rows emerge in the correct order without any sorting ** required. */ - rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]) + 5; + rCost = tdsqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]) + 5; WHERETRACE(0x002, ("---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\n", @@ -152505,8 +152505,8 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ ** paths currently in the best-so-far buffer. So discard ** this candidate as not viable. */ #ifdef WHERETRACE_ENABLED /* 0x4 */ - if( sqlite3WhereTrace&0x4 ){ - sqlite3DebugPrintf("Skip %s cost=%-3d,%3d,%3d order=%c\n", + if( tdsqlite3WhereTrace&0x4 ){ + tdsqlite3DebugPrintf("Skip %s cost=%-3d,%3d,%3d order=%c\n", wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted, isOrdered>=0 ? isOrdered+'0' : '?'); } @@ -152524,8 +152524,8 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ } pTo = &aTo[jj]; #ifdef WHERETRACE_ENABLED /* 0x4 */ - if( sqlite3WhereTrace&0x4 ){ - sqlite3DebugPrintf("New %s cost=%-3d,%3d,%3d order=%c\n", + if( tdsqlite3WhereTrace&0x4 ){ + tdsqlite3DebugPrintf("New %s cost=%-3d,%3d,%3d order=%c\n", wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted, isOrdered>=0 ? isOrdered+'0' : '?'); } @@ -152547,12 +152547,12 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ ) ){ #ifdef WHERETRACE_ENABLED /* 0x4 */ - if( sqlite3WhereTrace&0x4 ){ - sqlite3DebugPrintf( + if( tdsqlite3WhereTrace&0x4 ){ + tdsqlite3DebugPrintf( "Skip %s cost=%-3d,%3d,%3d order=%c", wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted, isOrdered>=0 ? isOrdered+'0' : '?'); - sqlite3DebugPrintf(" vs %s cost=%-3d,%3d,%3d order=%c\n", + tdsqlite3DebugPrintf(" vs %s cost=%-3d,%3d,%3d order=%c\n", wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow, pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?'); } @@ -152565,12 +152565,12 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ /* Control reaches here if the candidate path is better than the ** pTo path. Replace pTo with the candidate. */ #ifdef WHERETRACE_ENABLED /* 0x4 */ - if( sqlite3WhereTrace&0x4 ){ - sqlite3DebugPrintf( + if( tdsqlite3WhereTrace&0x4 ){ + tdsqlite3DebugPrintf( "Update %s cost=%-3d,%3d,%3d order=%c", wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted, isOrdered>=0 ? isOrdered+'0' : '?'); - sqlite3DebugPrintf(" was %s cost=%-3d,%3d,%3d order=%c\n", + tdsqlite3DebugPrintf(" was %s cost=%-3d,%3d,%3d order=%c\n", wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow, pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?'); } @@ -152603,16 +152603,16 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ } #ifdef WHERETRACE_ENABLED /* >=2 */ - if( sqlite3WhereTrace & 0x02 ){ - sqlite3DebugPrintf("---- after round %d ----\n", iLoop); + if( tdsqlite3WhereTrace & 0x02 ){ + tdsqlite3DebugPrintf("---- after round %d ----\n", iLoop); for(ii=0, pTo=aTo; iirCost, pTo->nRow, pTo->isOrdered>=0 ? (pTo->isOrdered+'0') : '?'); if( pTo->isOrdered>0 ){ - sqlite3DebugPrintf(" rev=0x%llx\n", pTo->revLoop); + tdsqlite3DebugPrintf(" rev=0x%llx\n", pTo->revLoop); }else{ - sqlite3DebugPrintf("\n"); + tdsqlite3DebugPrintf("\n"); } } } @@ -152626,8 +152626,8 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ } if( nFrom==0 ){ - sqlite3ErrorMsg(pParse, "no query solution"); - sqlite3DbFreeNN(db, pSpace); + tdsqlite3ErrorMsg(pParse, "no query solution"); + tdsqlite3DbFreeNN(db, pSpace); return SQLITE_ERROR; } @@ -152704,7 +152704,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ pWInfo->nRowOut = pFrom->nRow; /* Free temporary memory and return success */ - sqlite3DbFreeNN(db, pSpace); + tdsqlite3DbFreeNN(db, pSpace); return SQLITE_OK; } @@ -152712,7 +152712,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ ** Most queries use only a single table (they are not joins) and have ** simple == constraints against indexed fields. This routine attempts ** to plan those simple cases using much less ceremony than the -** general-purpose query planner, and thereby yield faster sqlite3_prepare() +** general-purpose query planner, and thereby yield faster tdsqlite3_prepare() ** times for the common case. ** ** Return non-zero on success, if this query can be handled by this @@ -152742,7 +152742,7 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){ pLoop = pBuilder->pNew; pLoop->wsFlags = 0; pLoop->nSkip = 0; - pTerm = sqlite3WhereFindTerm(pWC, iCur, -1, 0, WO_EQ|WO_IS, 0); + pTerm = tdsqlite3WhereFindTerm(pWC, iCur, -1, 0, WO_EQ|WO_IS, 0); if( pTerm ){ testcase( pTerm->eOperator & WO_IS ); pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_IPK|WHERE_ONEROW; @@ -152750,7 +152750,7 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){ pLoop->nLTerm = 1; pLoop->u.btree.nEq = 1; /* TUNING: Cost of a rowid lookup is 10 */ - pLoop->rRun = 33; /* 33==sqlite3LogEst(10) */ + pLoop->rRun = 33; /* 33==tdsqlite3LogEst(10) */ }else{ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int opMask; @@ -152761,7 +152761,7 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){ ) continue; opMask = pIdx->uniqNotNull ? (WO_EQ|WO_IS) : WO_EQ; for(j=0; jnKeyCol; j++){ - pTerm = sqlite3WhereFindTerm(pWC, iCur, j, 0, opMask, pIdx); + pTerm = tdsqlite3WhereFindTerm(pWC, iCur, j, 0, opMask, pIdx); if( pTerm==0 ) break; testcase( pTerm->eOperator & WO_IS ); pLoop->aLTerm[j] = pTerm; @@ -152775,7 +152775,7 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){ pLoop->u.btree.nEq = j; pLoop->u.btree.pIndex = pIdx; /* TUNING: Cost of a unique index lookup is 15 */ - pLoop->rRun = 39; /* 39==sqlite3LogEst(15) */ + pLoop->rRun = 39; /* 39==tdsqlite3LogEst(15) */ break; } } @@ -152783,7 +152783,7 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){ pLoop->nOut = (LogEst)1; pWInfo->a[0].pWLoop = pLoop; assert( pWInfo->sMaskSet.n==1 && iCur==pWInfo->sMaskSet.ix[0] ); - pLoop->maskSelf = 1; /* sqlite3WhereGetMask(&pWInfo->sMaskSet, iCur); */ + pLoop->maskSelf = 1; /* tdsqlite3WhereGetMask(&pWInfo->sMaskSet, iCur); */ pWInfo->a[0].iTabCur = iCur; pWInfo->nRowOut = 1; if( pWInfo->pOrderBy ) pWInfo->nOBSat = pWInfo->pOrderBy->nExpr; @@ -152819,8 +152819,8 @@ static int exprIsDeterministic(Expr *p){ memset(&w, 0, sizeof(w)); w.eCode = 1; w.xExprCallback = exprNodeIsDeterministic; - w.xSelectCallback = sqlite3SelectWalkFail; - sqlite3WalkExpr(&w, p); + w.xSelectCallback = tdsqlite3SelectWalkFail; + tdsqlite3WalkExpr(&w, p); return w.eCode; } @@ -152828,7 +152828,7 @@ static int exprIsDeterministic(Expr *p){ ** Generate the beginning of the loop used for WHERE clause processing. ** The return value is a pointer to an opaque structure that contains ** information needed to terminate the loop. Later, the calling routine -** should invoke sqlite3WhereEnd() with the return value of this function +** should invoke tdsqlite3WhereEnd() with the return value of this function ** in order to complete the WHERE clause processing. ** ** If an error occurs, this routine returns NULL. @@ -152843,11 +152843,11 @@ static int exprIsDeterministic(Expr *p){ ** Then the code generated is conceptually like the following: ** ** foreach row1 in t1 do \ Code generated -** foreach row2 in t2 do |-- by sqlite3WhereBegin() +** foreach row2 in t2 do |-- by tdsqlite3WhereBegin() ** foreach row3 in t3 do / ** ... ** end \ Code generated -** end |-- by sqlite3WhereEnd() +** end |-- by tdsqlite3WhereEnd() ** end / ** ** Note that the loops might not be nested in the order in which they @@ -152859,9 +152859,9 @@ static int exprIsDeterministic(Expr *p){ ** There are Btree cursors associated with each table. t1 uses cursor ** number pTabList->a[0].iCursor. t2 uses the cursor pTabList->a[1].iCursor. ** And so forth. This routine generates code to open those VDBE cursors -** and sqlite3WhereEnd() generates the code to close them. +** and tdsqlite3WhereEnd() generates the code to close them. ** -** The code that sqlite3WhereBegin() generates leaves the cursors named +** The code that tdsqlite3WhereBegin() generates leaves the cursors named ** in pTabList pointing at their appropriate entries. The [...] code ** can use OP_Column and OP_Rowid opcodes on these cursors to extract ** data from the various tables of the loop. @@ -152912,7 +152912,7 @@ static int exprIsDeterministic(Expr *p){ ** be used to compute the appropriate cursor depending on which index is ** used. */ -SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( +SQLITE_PRIVATE WhereInfo *tdsqlite3WhereBegin( Parse *pParse, /* The parser context */ SrcList *pTabList, /* FROM clause: A list of all tables to be scanned */ Expr *pWhere, /* The WHERE clause */ @@ -152932,7 +152932,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( WhereLevel *pLevel; /* A single level in pWInfo->a[] */ WhereLoop *pLoop; /* Pointer to a single WhereLoop object */ int ii; /* Loop counter */ - sqlite3 *db; /* Database connection */ + tdsqlite3 *db; /* Database connection */ int rc; /* Return code */ u8 bFordelete = 0; /* OPFLAG_FORDELETE or zero, as appropriate */ @@ -152955,7 +152955,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( sWLB.pOrderBy = pOrderBy; /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via - ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */ + ** tdsqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */ if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){ wctrlFlags &= ~WHERE_WANT_DISTINCT; } @@ -152965,7 +152965,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( */ testcase( pTabList->nSrc==BMS ); if( pTabList->nSrc>BMS ){ - sqlite3ErrorMsg(pParse, "at most %d tables in a join", BMS); + tdsqlite3ErrorMsg(pParse, "at most %d tables in a join", BMS); return 0; } @@ -152984,9 +152984,9 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( ** some architectures. Hence the ROUND8() below. */ nByteWInfo = ROUND8(sizeof(WhereInfo)+(nTabList-1)*sizeof(WhereLevel)); - pWInfo = sqlite3DbMallocRawNN(db, nByteWInfo + sizeof(WhereLoop)); + pWInfo = tdsqlite3DbMallocRawNN(db, nByteWInfo + sizeof(WhereLoop)); if( db->mallocFailed ){ - sqlite3DbFree(db, pWInfo); + tdsqlite3DbFree(db, pWInfo); pWInfo = 0; goto whereBeginError; } @@ -152997,7 +152997,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( pWInfo->pResultSet = pResultSet; pWInfo->aiCurOnePass[0] = pWInfo->aiCurOnePass[1] = -1; pWInfo->nLevel = nTabList; - pWInfo->iBreak = pWInfo->iContinue = sqlite3VdbeMakeLabel(pParse); + pWInfo->iBreak = pWInfo->iContinue = tdsqlite3VdbeMakeLabel(pParse); pWInfo->wctrlFlags = wctrlFlags; pWInfo->iLimit = iAuxArg; pWInfo->savedNQueryLoop = pParse->nQueryLoop; @@ -153019,8 +153019,8 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( ** subexpression is separated by an AND operator. */ initMaskSet(pMaskSet); - sqlite3WhereClauseInit(&pWInfo->sWC, pWInfo); - sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND); + tdsqlite3WhereClauseInit(&pWInfo->sWC, pWInfo); + tdsqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND); /* Special case: No FROM clause */ @@ -153048,13 +153048,13 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( ii = 0; do{ createMask(pMaskSet, pTabList->a[ii].iCursor); - sqlite3WhereTabFuncArgs(pParse, &pTabList->a[ii], &pWInfo->sWC); + tdsqlite3WhereTabFuncArgs(pParse, &pTabList->a[ii], &pWInfo->sWC); }while( (++ii)nSrc ); #ifdef SQLITE_DEBUG { Bitmask mx = 0; for(ii=0; iinSrc; ii++){ - Bitmask m = sqlite3WhereGetMask(pMaskSet, pTabList->a[ii].iCursor); + Bitmask m = tdsqlite3WhereGetMask(pMaskSet, pTabList->a[ii].iCursor); assert( m>=mx ); mx = m; } @@ -153063,7 +153063,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( } /* Analyze all of the subexpressions. */ - sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC); + tdsqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC); if( db->mallocFailed ) goto whereBeginError; /* Special case: WHERE terms that do not refer to any tables in the join @@ -153081,7 +153081,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( WhereTerm *pT = &sWLB.pWC->a[ii]; if( pT->wtFlags & TERM_VIRTUAL ) continue; if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){ - sqlite3ExprIfFalse(pParse, pT->pExpr, pWInfo->iBreak, SQLITE_JUMPIFNULL); + tdsqlite3ExprIfFalse(pParse, pT->pExpr, pWInfo->iBreak, SQLITE_JUMPIFNULL); pT->wtFlags |= TERM_CODED; } } @@ -153099,13 +153099,13 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( /* Construct the WhereLoop objects */ #if defined(WHERETRACE_ENABLED) - if( sqlite3WhereTrace & 0xffff ){ - sqlite3DebugPrintf("*** Optimizer Start *** (wctrlFlags: 0x%x",wctrlFlags); + if( tdsqlite3WhereTrace & 0xffff ){ + tdsqlite3DebugPrintf("*** Optimizer Start *** (wctrlFlags: 0x%x",wctrlFlags); if( wctrlFlags & WHERE_USE_LIMIT ){ - sqlite3DebugPrintf(", limit: %d", iAuxArg); + tdsqlite3DebugPrintf(", limit: %d", iAuxArg); } - sqlite3DebugPrintf(")\n"); - if( sqlite3WhereTrace & 0x100 ){ + tdsqlite3DebugPrintf(")\n"); + if( tdsqlite3WhereTrace & 0x100 ){ Select sSelect; memset(&sSelect, 0, sizeof(sSelect)); sSelect.selFlags = SF_WhereBegin; @@ -153113,12 +153113,12 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( sSelect.pWhere = pWhere; sSelect.pOrderBy = pOrderBy; sSelect.pEList = pResultSet; - sqlite3TreeViewSelect(0, &sSelect, 0); + tdsqlite3TreeViewSelect(0, &sSelect, 0); } } - if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */ - sqlite3DebugPrintf("---- WHERE clause at start of analysis:\n"); - sqlite3WhereClausePrint(sWLB.pWC); + if( tdsqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */ + tdsqlite3DebugPrintf("---- WHERE clause at start of analysis:\n"); + tdsqlite3WhereClausePrint(sWLB.pWC); } #endif @@ -153127,14 +153127,14 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( if( rc ) goto whereBeginError; #ifdef WHERETRACE_ENABLED - if( sqlite3WhereTrace ){ /* Display all of the WhereLoop objects */ + if( tdsqlite3WhereTrace ){ /* Display all of the WhereLoop objects */ WhereLoop *p; int i; static const char zLabel[] = "0123456789abcdefghijklmnopqrstuvwyxz" "ABCDEFGHIJKLMNOPQRSTUVWYXZ"; for(p=pWInfo->pLoops, i=0; p; p=p->pNextLoop, i++){ p->cId = zLabel[i%(sizeof(zLabel)-1)]; - sqlite3WhereLoopPrint(p, sWLB.pWC); + tdsqlite3WhereLoopPrint(p, sWLB.pWC); } } #endif @@ -153153,28 +153153,28 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( goto whereBeginError; } #ifdef WHERETRACE_ENABLED - if( sqlite3WhereTrace ){ - sqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut); + if( tdsqlite3WhereTrace ){ + tdsqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut); if( pWInfo->nOBSat>0 ){ - sqlite3DebugPrintf(" ORDERBY=%d,0x%llx", pWInfo->nOBSat, pWInfo->revMask); + tdsqlite3DebugPrintf(" ORDERBY=%d,0x%llx", pWInfo->nOBSat, pWInfo->revMask); } switch( pWInfo->eDistinct ){ case WHERE_DISTINCT_UNIQUE: { - sqlite3DebugPrintf(" DISTINCT=unique"); + tdsqlite3DebugPrintf(" DISTINCT=unique"); break; } case WHERE_DISTINCT_ORDERED: { - sqlite3DebugPrintf(" DISTINCT=ordered"); + tdsqlite3DebugPrintf(" DISTINCT=ordered"); break; } case WHERE_DISTINCT_UNORDERED: { - sqlite3DebugPrintf(" DISTINCT=unordered"); + tdsqlite3DebugPrintf(" DISTINCT=unordered"); break; } } - sqlite3DebugPrintf("\n"); + tdsqlite3DebugPrintf("\n"); for(ii=0; iinLevel; ii++){ - sqlite3WhereLoopPrint(pWInfo->a[ii].pWLoop, sWLB.pWC); + tdsqlite3WhereLoopPrint(pWInfo->a[ii].pWLoop, sWLB.pWC); } } #endif @@ -153214,9 +153214,9 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( && OptimizationEnabled(db, SQLITE_OmitNoopJoin) ){ int i; - Bitmask tabUsed = sqlite3WhereExprListUsage(pMaskSet, pResultSet); + Bitmask tabUsed = tdsqlite3WhereExprListUsage(pMaskSet, pResultSet); if( sWLB.pOrderBy ){ - tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy); + tabUsed |= tdsqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy); } for(i=pWInfo->nLevel-1; i>=1; i--){ WhereTerm *pTerm, *pEnd; @@ -153257,9 +153257,9 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( } } #if defined(WHERETRACE_ENABLED) - if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */ - sqlite3DebugPrintf("---- WHERE clause at end of analysis:\n"); - sqlite3WhereClausePrint(sWLB.pWC); + if( tdsqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */ + tdsqlite3DebugPrintf("---- WHERE clause at end of analysis:\n"); + tdsqlite3WhereClausePrint(sWLB.pWC); } WHERETRACE(0xffff,("*** Optimizer Finished ***\n")); #endif @@ -153314,16 +153314,16 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( pTabItem = &pTabList->a[pLevel->iFrom]; pTab = pTabItem->pTab; - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); + iDb = tdsqlite3SchemaToIndex(db, pTab->pSchema); pLoop = pLevel->pWLoop; if( (pTab->tabFlags & TF_Ephemeral)!=0 || pTab->pSelect ){ /* Do nothing */ }else #ifndef SQLITE_OMIT_VIRTUALTABLE if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)!=0 ){ - const char *pVTab = (const char *)sqlite3GetVTable(db, pTab); + const char *pVTab = (const char *)tdsqlite3GetVTable(db, pTab); int iCur = pTabItem->iCursor; - sqlite3VdbeAddOp4(v, OP_VOpen, iCur, 0, 0, pVTab, P4_VTAB); + tdsqlite3VdbeAddOp4(v, OP_VOpen, iCur, 0, 0, pVTab, P4_VTAB); }else if( IsVirtual(pTab) ){ /* noop */ }else @@ -153335,7 +153335,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( op = OP_OpenWrite; pWInfo->aiCurOnePass[0] = pTabItem->iCursor; }; - sqlite3OpenTable(pParse, pTabItem->iCursor, iDb, pTab, op); + tdsqlite3OpenTable(pParse, pTabItem->iCursor, iDb, pTab, op); assert( pTabItem->iCursor==pLevel->iTabCur ); testcase( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol==BMS-1 ); testcase( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol==BMS ); @@ -153349,23 +153349,23 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( Bitmask b = pTabItem->colUsed; int n = 0; for(; b; b=b>>1, n++){} - sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32); + tdsqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32); assert( n<=pTab->nCol ); } #ifdef SQLITE_ENABLE_CURSOR_HINTS if( pLoop->u.btree.pIndex!=0 ){ - sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete); + tdsqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete); }else #endif { - sqlite3VdbeChangeP5(v, bFordelete); + tdsqlite3VdbeChangeP5(v, bFordelete); } #ifdef SQLITE_ENABLE_COLUMN_USED_MASK - sqlite3VdbeAddOp4Dup8(v, OP_ColumnsUsed, pTabItem->iCursor, 0, 0, + tdsqlite3VdbeAddOp4Dup8(v, OP_ColumnsUsed, pTabItem->iCursor, 0, 0, (const u8*)&pTabItem->colUsed, P4_INT64); #endif }else{ - sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); + tdsqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); } if( pLoop->wsFlags & WHERE_INDEXED ){ Index *pIx = pLoop->u.btree.pIndex; @@ -153400,15 +153400,15 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( assert( pIx->pSchema==pTab->pSchema ); assert( iIndexCur>=0 ); if( op ){ - sqlite3VdbeAddOp3(v, op, iIndexCur, pIx->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pIx); + tdsqlite3VdbeAddOp3(v, op, iIndexCur, pIx->tnum, iDb); + tdsqlite3VdbeSetP4KeyInfo(pParse, pIx); if( (pLoop->wsFlags & WHERE_CONSTRAINT)!=0 && (pLoop->wsFlags & (WHERE_COLUMN_RANGE|WHERE_SKIPSCAN))==0 && (pLoop->wsFlags & WHERE_BIGNULL_SORT)==0 && (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0 && pWInfo->eDistinct!=WHERE_DISTINCT_ORDERED ){ - sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ); /* Hint to COMDB2 */ + tdsqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ); /* Hint to COMDB2 */ } VdbeComment((v, "%s", pIx->zName)); #ifdef SQLITE_ENABLE_COLUMN_USED_MASK @@ -153422,15 +153422,15 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( if( (pTabItem->colUsed & MASKBIT(jj))==0 ) continue; colUsed |= ((u64)1)<<(ii<63 ? ii : 63); } - sqlite3VdbeAddOp4Dup8(v, OP_ColumnsUsed, iIndexCur, 0, 0, + tdsqlite3VdbeAddOp4Dup8(v, OP_ColumnsUsed, iIndexCur, 0, 0, (u8*)&colUsed, P4_INT64); } #endif /* SQLITE_ENABLE_COLUMN_USED_MASK */ } } - if( iDb>=0 ) sqlite3CodeVerifySchema(pParse, iDb); + if( iDb>=0 ) tdsqlite3CodeVerifySchema(pParse, iDb); } - pWInfo->iTop = sqlite3VdbeCurrentAddr(v); + pWInfo->iTop = tdsqlite3VdbeCurrentAddr(v); if( db->mallocFailed ) goto whereBeginError; /* Generate the code to do the search. Each iteration of the for @@ -153449,14 +153449,14 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( if( db->mallocFailed ) goto whereBeginError; } #endif - addrExplain = sqlite3WhereExplainOneScan( + addrExplain = tdsqlite3WhereExplainOneScan( pParse, pTabList, pLevel, wctrlFlags ); - pLevel->addrBody = sqlite3VdbeCurrentAddr(v); - notReady = sqlite3WhereCodeOneLoopStart(pParse,v,pWInfo,ii,pLevel,notReady); + pLevel->addrBody = tdsqlite3VdbeCurrentAddr(v); + notReady = tdsqlite3WhereCodeOneLoopStart(pParse,v,pWInfo,ii,pLevel,notReady); pWInfo->iContinue = pLevel->addrCont; if( (wsFlags&WHERE_MULTI_OR)==0 && (wctrlFlags&WHERE_OR_SUBCLAUSE)==0 ){ - sqlite3WhereAddScanStatus(v, pTabList, pLevel, addrExplain); + tdsqlite3WhereAddScanStatus(v, pTabList, pLevel, addrExplain); } } @@ -153474,7 +153474,7 @@ whereBeginError: } /* -** Part of sqlite3WhereEnd() will rewrite opcodes to reference the +** Part of tdsqlite3WhereEnd() will rewrite opcodes to reference the ** index rather than the main table. In SQLITE_DEBUG mode, we want ** to trace those changes if PRAGMA vdbe_addoptrace=on. This routine ** does that. @@ -153482,29 +153482,29 @@ whereBeginError: #ifndef SQLITE_DEBUG # define OpcodeRewriteTrace(D,K,P) /* no-op */ #else -# define OpcodeRewriteTrace(D,K,P) sqlite3WhereOpcodeRewriteTrace(D,K,P) - static void sqlite3WhereOpcodeRewriteTrace( - sqlite3 *db, +# define OpcodeRewriteTrace(D,K,P) tdsqlite3WhereOpcodeRewriteTrace(D,K,P) + static void tdsqlite3WhereOpcodeRewriteTrace( + tdsqlite3 *db, int pc, VdbeOp *pOp ){ if( (db->flags & SQLITE_VdbeAddopTrace)==0 ) return; - sqlite3VdbePrintOp(0, pc, pOp); + tdsqlite3VdbePrintOp(0, pc, pOp); } #endif /* ** Generate the end of the WHERE loop. See comments on -** sqlite3WhereBegin() for additional information. +** tdsqlite3WhereBegin() for additional information. */ -SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ +SQLITE_PRIVATE void tdsqlite3WhereEnd(WhereInfo *pWInfo){ Parse *pParse = pWInfo->pParse; Vdbe *v = pParse->pVdbe; int i; WhereLevel *pLevel; WhereLoop *pLoop; SrcList *pTabList = pWInfo->pTabList; - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; /* Generate loop termination code. */ @@ -153528,47 +153528,47 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ int r1 = pParse->nMem+1; int j, op; for(j=0; jiIdxCur, j, r1+j); + tdsqlite3VdbeAddOp3(v, OP_Column, pLevel->iIdxCur, j, r1+j); } pParse->nMem += n+1; op = pLevel->op==OP_Prev ? OP_SeekLT : OP_SeekGT; - addrSeek = sqlite3VdbeAddOp4Int(v, op, pLevel->iIdxCur, 0, r1, n); + addrSeek = tdsqlite3VdbeAddOp4Int(v, op, pLevel->iIdxCur, 0, r1, n); VdbeCoverageIf(v, op==OP_SeekLT); VdbeCoverageIf(v, op==OP_SeekGT); - sqlite3VdbeAddOp2(v, OP_Goto, 1, pLevel->p2); + tdsqlite3VdbeAddOp2(v, OP_Goto, 1, pLevel->p2); } #endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */ /* The common case: Advance to the next row */ - sqlite3VdbeResolveLabel(v, pLevel->addrCont); - sqlite3VdbeAddOp3(v, pLevel->op, pLevel->p1, pLevel->p2, pLevel->p3); - sqlite3VdbeChangeP5(v, pLevel->p5); + tdsqlite3VdbeResolveLabel(v, pLevel->addrCont); + tdsqlite3VdbeAddOp3(v, pLevel->op, pLevel->p1, pLevel->p2, pLevel->p3); + tdsqlite3VdbeChangeP5(v, pLevel->p5); VdbeCoverage(v); VdbeCoverageIf(v, pLevel->op==OP_Next); VdbeCoverageIf(v, pLevel->op==OP_Prev); VdbeCoverageIf(v, pLevel->op==OP_VNext); if( pLevel->regBignull ){ - sqlite3VdbeResolveLabel(v, pLevel->addrBignull); - sqlite3VdbeAddOp2(v, OP_DecrJumpZero, pLevel->regBignull, pLevel->p2-1); + tdsqlite3VdbeResolveLabel(v, pLevel->addrBignull); + tdsqlite3VdbeAddOp2(v, OP_DecrJumpZero, pLevel->regBignull, pLevel->p2-1); VdbeCoverage(v); } #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT - if( addrSeek ) sqlite3VdbeJumpHere(v, addrSeek); + if( addrSeek ) tdsqlite3VdbeJumpHere(v, addrSeek); #endif }else{ - sqlite3VdbeResolveLabel(v, pLevel->addrCont); + tdsqlite3VdbeResolveLabel(v, pLevel->addrCont); } if( pLoop->wsFlags & WHERE_IN_ABLE && pLevel->u.in.nIn>0 ){ struct InLoop *pIn; int j; - sqlite3VdbeResolveLabel(v, pLevel->addrNxt); + tdsqlite3VdbeResolveLabel(v, pLevel->addrNxt); for(j=pLevel->u.in.nIn, pIn=&pLevel->u.in.aInLoop[j-1]; j>0; j--, pIn--){ - sqlite3VdbeJumpHere(v, pIn->addrInTop+1); + tdsqlite3VdbeJumpHere(v, pIn->addrInTop+1); if( pIn->eEndLoopOp!=OP_Noop ){ if( pIn->nPrefix ){ assert( pLoop->wsFlags & WHERE_IN_EARLYOUT ); if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){ - sqlite3VdbeAddOp4Int(v, OP_IfNoHope, pLevel->iIdxCur, - sqlite3VdbeCurrentAddr(v)+2+(pLevel->iLeftJoin!=0), + tdsqlite3VdbeAddOp4Int(v, OP_IfNoHope, pLevel->iIdxCur, + tdsqlite3VdbeCurrentAddr(v)+2+(pLevel->iLeftJoin!=0), pIn->iBase, pIn->nPrefix); VdbeCoverage(v); } @@ -153581,53 +153581,53 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ ** return the null-row. So, if the cursor is not open yet, ** jump over the OP_Next or OP_Prev instruction about to ** be coded. */ - sqlite3VdbeAddOp2(v, OP_IfNotOpen, pIn->iCur, - sqlite3VdbeCurrentAddr(v) + 2 + tdsqlite3VdbeAddOp2(v, OP_IfNotOpen, pIn->iCur, + tdsqlite3VdbeCurrentAddr(v) + 2 ); VdbeCoverage(v); } } - sqlite3VdbeAddOp2(v, pIn->eEndLoopOp, pIn->iCur, pIn->addrInTop); + tdsqlite3VdbeAddOp2(v, pIn->eEndLoopOp, pIn->iCur, pIn->addrInTop); VdbeCoverage(v); VdbeCoverageIf(v, pIn->eEndLoopOp==OP_Prev); VdbeCoverageIf(v, pIn->eEndLoopOp==OP_Next); } - sqlite3VdbeJumpHere(v, pIn->addrInTop-1); + tdsqlite3VdbeJumpHere(v, pIn->addrInTop-1); } } - sqlite3VdbeResolveLabel(v, pLevel->addrBrk); + tdsqlite3VdbeResolveLabel(v, pLevel->addrBrk); if( pLevel->addrSkip ){ - sqlite3VdbeGoto(v, pLevel->addrSkip); + tdsqlite3VdbeGoto(v, pLevel->addrSkip); VdbeComment((v, "next skip-scan on %s", pLoop->u.btree.pIndex->zName)); - sqlite3VdbeJumpHere(v, pLevel->addrSkip); - sqlite3VdbeJumpHere(v, pLevel->addrSkip-2); + tdsqlite3VdbeJumpHere(v, pLevel->addrSkip); + tdsqlite3VdbeJumpHere(v, pLevel->addrSkip-2); } #ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS if( pLevel->addrLikeRep ){ - sqlite3VdbeAddOp2(v, OP_DecrJumpZero, (int)(pLevel->iLikeRepCntr>>1), + tdsqlite3VdbeAddOp2(v, OP_DecrJumpZero, (int)(pLevel->iLikeRepCntr>>1), pLevel->addrLikeRep); VdbeCoverage(v); } #endif if( pLevel->iLeftJoin ){ int ws = pLoop->wsFlags; - addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); VdbeCoverage(v); + addr = tdsqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); VdbeCoverage(v); assert( (ws & WHERE_IDX_ONLY)==0 || (ws & WHERE_INDEXED)!=0 ); if( (ws & WHERE_IDX_ONLY)==0 ){ assert( pLevel->iTabCur==pTabList->a[pLevel->iFrom].iCursor ); - sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iTabCur); + tdsqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iTabCur); } if( (ws & WHERE_INDEXED) || ((ws & WHERE_MULTI_OR) && pLevel->u.pCovidx) ){ - sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur); + tdsqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur); } if( pLevel->op==OP_Return ){ - sqlite3VdbeAddOp2(v, OP_Gosub, pLevel->p1, pLevel->addrFirst); + tdsqlite3VdbeAddOp2(v, OP_Gosub, pLevel->p1, pLevel->addrFirst); }else{ - sqlite3VdbeGoto(v, pLevel->addrFirst); + tdsqlite3VdbeGoto(v, pLevel->addrFirst); } - sqlite3VdbeJumpHere(v, addr); + tdsqlite3VdbeJumpHere(v, addr); } VdbeModuleComment((v, "End WHERE-loop%d: %s", i, pWInfo->pTabList->a[pLevel->iFrom].pTab->zName)); @@ -153636,7 +153636,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ /* The "break" point is here, just past the end of the outer loop. ** Set it. */ - sqlite3VdbeResolveLabel(v, pWInfo->iBreak); + tdsqlite3VdbeResolveLabel(v, pWInfo->iBreak); assert( pWInfo->nLevel<=pTabList->nSrc ); for(i=0, pLevel=pWInfo->a; inLevel; i++, pLevel++){ @@ -153660,7 +153660,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ } #ifdef SQLITE_ENABLE_EARLY_CURSOR_CLOSE - /* Close all of the cursors that were opened by sqlite3WhereBegin. + /* Close all of the cursors that were opened by tdsqlite3WhereBegin. ** Except, do not close cursors that will be reused by the OR optimization ** (WHERE_OR_SUBCLAUSE). And do not close the OP_OpenWrite cursors ** created for the ONEPASS optimization. @@ -153671,13 +153671,13 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ ){ int ws = pLoop->wsFlags; if( pWInfo->eOnePass==ONEPASS_OFF && (ws & WHERE_IDX_ONLY)==0 ){ - sqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor); + tdsqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor); } if( (ws & WHERE_INDEXED)!=0 && (ws & (WHERE_IPK|WHERE_AUTO_INDEX))==0 && pLevel->iIdxCur!=pWInfo->aiCurOnePass[1] ){ - sqlite3VdbeAddOp1(v, OP_Close, pLevel->iIdxCur); + tdsqlite3VdbeAddOp1(v, OP_Close, pLevel->iIdxCur); } } #endif @@ -153687,8 +153687,8 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ ** this optimization prevents the table from ever being read, which can ** yield a significant performance boost. ** - ** Calls to the code generator in between sqlite3WhereBegin and - ** sqlite3WhereEnd will have created code that references the table + ** Calls to the code generator in between tdsqlite3WhereBegin and + ** tdsqlite3WhereEnd will have created code that references the table ** directly. This loop scans all that code looking for opcodes ** that reference the table and converts them into opcodes that ** reference the index. @@ -153702,14 +153702,14 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ && (pWInfo->eOnePass==ONEPASS_OFF || !HasRowid(pIdx->pTable)) && !db->mallocFailed ){ - last = sqlite3VdbeCurrentAddr(v); + last = tdsqlite3VdbeCurrentAddr(v); k = pLevel->addrBody; #ifdef SQLITE_DEBUG if( db->flags & SQLITE_VdbeAddopTrace ){ printf("TRANSLATE opcodes in range %d..%d\n", k, last-1); } #endif - pOp = sqlite3VdbeGetOp(v, k); + pOp = tdsqlite3VdbeGetOp(v, k); for(; kp1!=pLevel->iTabCur ) continue; if( pOp->opcode==OP_Column @@ -153720,14 +153720,14 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ int x = pOp->p2; assert( pIdx->pTable==pTab ); if( !HasRowid(pTab) ){ - Index *pPk = sqlite3PrimaryKeyIndex(pTab); + Index *pPk = tdsqlite3PrimaryKeyIndex(pTab); x = pPk->aiColumn[x]; assert( x>=0 ); }else{ - testcase( x!=sqlite3StorageColumnToTable(pTab,x) ); - x = sqlite3StorageColumnToTable(pTab,x); + testcase( x!=tdsqlite3StorageColumnToTable(pTab,x) ); + x = tdsqlite3StorageColumnToTable(pTab,x); } - x = sqlite3TableColumnToIndex(pIdx, x); + x = tdsqlite3TableColumnToIndex(pIdx, x); if( x>=0 ){ pOp->p2 = x; pOp->p1 = pLevel->iIdxCur; @@ -153755,7 +153755,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ WhereExprMod *p = pWInfo->pExprMods; pWInfo->pExprMods = p->pNext; memcpy(p->pExpr, &p->orig, sizeof(p->orig)); - sqlite3DbFree(db, p); + tdsqlite3DbFree(db, p); } /* Final cleanup @@ -153788,7 +153788,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ ** ** Any SELECT statement that contains one or more window functions in ** either the select list or ORDER BY clause (the only two places window -** functions may be used) is transformed by function sqlite3WindowRewrite() +** functions may be used) is transformed by function tdsqlite3WindowRewrite() ** in order to support window function processing. For example, with the ** schema: ** @@ -153847,12 +153847,12 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ ** INTERFACE WITH SELECT.C ** ** When processing the rewritten SELECT statement, code in select.c calls -** sqlite3WhereBegin() to begin iterating through the results of the +** tdsqlite3WhereBegin() to begin iterating through the results of the ** sub-query, which is always implemented as a co-routine. It then calls -** sqlite3WindowCodeStep() to process rows and finish the scan by calling -** sqlite3WhereEnd(). +** tdsqlite3WindowCodeStep() to process rows and finish the scan by calling +** tdsqlite3WhereEnd(). ** -** sqlite3WindowCodeStep() generates VM code so that, for each row returned +** tdsqlite3WindowCodeStep() generates VM code so that, for each row returned ** by the sub-query a sub-routine (OP_Gosub) coded by select.c is invoked. ** When the sub-routine is invoked: ** @@ -153863,7 +153863,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ ** temp table Window.iEphCsr. ** ** In some cases, depending on the window frame and the specific window -** functions invoked, sqlite3WindowCodeStep() caches each entire partition +** functions invoked, tdsqlite3WindowCodeStep() caches each entire partition ** in a temp table before returning any rows. In other cases it does not. ** This detail is encapsulated within this file, the code generated by ** select.c is the same in either case. @@ -153899,7 +153899,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ ** ** ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ** -** See sqlite3WindowUpdate() for details. +** See tdsqlite3WindowUpdate() for details. ** ** As well as some of the built-in window functions, aggregate window ** functions min() and max() are implemented using VDBE instructions if @@ -153914,18 +153914,18 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ ** ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW */ static void row_numberStepFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ - i64 *p = (i64*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + i64 *p = (i64*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ) (*p)++; UNUSED_PARAMETER(nArg); UNUSED_PARAMETER(apArg); } -static void row_numberValueFunc(sqlite3_context *pCtx){ - i64 *p = (i64*)sqlite3_aggregate_context(pCtx, sizeof(*p)); - sqlite3_result_int64(pCtx, (p ? *p : 0)); +static void row_numberValueFunc(tdsqlite3_context *pCtx){ + i64 *p = (i64*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); + tdsqlite3_result_int64(pCtx, (p ? *p : 0)); } /* @@ -153945,25 +153945,25 @@ struct CallCount { ** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW */ static void dense_rankStepFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ struct CallCount *p; - p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct CallCount*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ) p->nStep = 1; UNUSED_PARAMETER(nArg); UNUSED_PARAMETER(apArg); } -static void dense_rankValueFunc(sqlite3_context *pCtx){ +static void dense_rankValueFunc(tdsqlite3_context *pCtx){ struct CallCount *p; - p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct CallCount*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ if( p->nStep ){ p->nValue++; p->nStep = 0; } - sqlite3_result_int64(pCtx, p->nValue); + tdsqlite3_result_int64(pCtx, p->nValue); } } @@ -153974,23 +153974,23 @@ static void dense_rankValueFunc(sqlite3_context *pCtx){ */ struct NthValueCtx { i64 nStep; - sqlite3_value *pValue; + tdsqlite3_value *pValue; }; static void nth_valueStepFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ struct NthValueCtx *p; - p = (struct NthValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct NthValueCtx*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ i64 iVal; - switch( sqlite3_value_numeric_type(apArg[1]) ){ + switch( tdsqlite3_value_numeric_type(apArg[1]) ){ case SQLITE_INTEGER: - iVal = sqlite3_value_int64(apArg[1]); + iVal = tdsqlite3_value_int64(apArg[1]); break; case SQLITE_FLOAT: { - double fVal = sqlite3_value_double(apArg[1]); + double fVal = tdsqlite3_value_double(apArg[1]); if( ((i64)fVal)!=fVal ) goto error_out; iVal = (i64)fVal; break; @@ -154002,9 +154002,9 @@ static void nth_valueStepFunc( p->nStep++; if( iVal==p->nStep ){ - p->pValue = sqlite3_value_dup(apArg[0]); + p->pValue = tdsqlite3_value_dup(apArg[0]); if( !p->pValue ){ - sqlite3_result_error_nomem(pCtx); + tdsqlite3_result_error_nomem(pCtx); } } } @@ -154013,16 +154013,16 @@ static void nth_valueStepFunc( return; error_out: - sqlite3_result_error( + tdsqlite3_result_error( pCtx, "second argument to nth_value must be a positive integer", -1 ); } -static void nth_valueFinalizeFunc(sqlite3_context *pCtx){ +static void nth_valueFinalizeFunc(tdsqlite3_context *pCtx){ struct NthValueCtx *p; - p = (struct NthValueCtx*)sqlite3_aggregate_context(pCtx, 0); + p = (struct NthValueCtx*)tdsqlite3_aggregate_context(pCtx, 0); if( p && p->pValue ){ - sqlite3_result_value(pCtx, p->pValue); - sqlite3_value_free(p->pValue); + tdsqlite3_result_value(pCtx, p->pValue); + tdsqlite3_value_free(p->pValue); p->pValue = 0; } } @@ -154030,27 +154030,27 @@ static void nth_valueFinalizeFunc(sqlite3_context *pCtx){ #define nth_valueValueFunc noopValueFunc static void first_valueStepFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ struct NthValueCtx *p; - p = (struct NthValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct NthValueCtx*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p && p->pValue==0 ){ - p->pValue = sqlite3_value_dup(apArg[0]); + p->pValue = tdsqlite3_value_dup(apArg[0]); if( !p->pValue ){ - sqlite3_result_error_nomem(pCtx); + tdsqlite3_result_error_nomem(pCtx); } } UNUSED_PARAMETER(nArg); UNUSED_PARAMETER(apArg); } -static void first_valueFinalizeFunc(sqlite3_context *pCtx){ +static void first_valueFinalizeFunc(tdsqlite3_context *pCtx){ struct NthValueCtx *p; - p = (struct NthValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct NthValueCtx*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p && p->pValue ){ - sqlite3_result_value(pCtx, p->pValue); - sqlite3_value_free(p->pValue); + tdsqlite3_result_value(pCtx, p->pValue); + tdsqlite3_value_free(p->pValue); p->pValue = 0; } } @@ -154064,12 +154064,12 @@ static void first_valueFinalizeFunc(sqlite3_context *pCtx){ ** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW */ static void rankStepFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ struct CallCount *p; - p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct CallCount*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ p->nStep++; if( p->nValue==0 ){ @@ -154079,11 +154079,11 @@ static void rankStepFunc( UNUSED_PARAMETER(nArg); UNUSED_PARAMETER(apArg); } -static void rankValueFunc(sqlite3_context *pCtx){ +static void rankValueFunc(tdsqlite3_context *pCtx){ struct CallCount *p; - p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct CallCount*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ - sqlite3_result_int64(pCtx, p->nValue); + tdsqlite3_result_int64(pCtx, p->nValue); p->nValue = 0; } } @@ -154095,39 +154095,39 @@ static void rankValueFunc(sqlite3_context *pCtx){ ** GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING */ static void percent_rankStepFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ struct CallCount *p; UNUSED_PARAMETER(nArg); assert( nArg==0 ); UNUSED_PARAMETER(apArg); - p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct CallCount*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ p->nTotal++; } } static void percent_rankInvFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ struct CallCount *p; UNUSED_PARAMETER(nArg); assert( nArg==0 ); UNUSED_PARAMETER(apArg); - p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct CallCount*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); p->nStep++; } -static void percent_rankValueFunc(sqlite3_context *pCtx){ +static void percent_rankValueFunc(tdsqlite3_context *pCtx){ struct CallCount *p; - p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct CallCount*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ p->nValue = p->nStep; if( p->nTotal>1 ){ double r = (double)p->nValue / (double)(p->nTotal-1); - sqlite3_result_double(pCtx, r); + tdsqlite3_result_double(pCtx, r); }else{ - sqlite3_result_double(pCtx, 0.0); + tdsqlite3_result_double(pCtx, 0.0); } } } @@ -154140,35 +154140,35 @@ static void percent_rankValueFunc(sqlite3_context *pCtx){ ** GROUPS BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING */ static void cume_distStepFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ struct CallCount *p; UNUSED_PARAMETER(nArg); assert( nArg==0 ); UNUSED_PARAMETER(apArg); - p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct CallCount*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ p->nTotal++; } } static void cume_distInvFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ struct CallCount *p; UNUSED_PARAMETER(nArg); assert( nArg==0 ); UNUSED_PARAMETER(apArg); - p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct CallCount*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); p->nStep++; } -static void cume_distValueFunc(sqlite3_context *pCtx){ +static void cume_distValueFunc(tdsqlite3_context *pCtx){ struct CallCount *p; - p = (struct CallCount*)sqlite3_aggregate_context(pCtx, 0); + p = (struct CallCount*)tdsqlite3_aggregate_context(pCtx, 0); if( p ){ double r = (double)(p->nStep) / (double)(p->nTotal); - sqlite3_result_double(pCtx, r); + tdsqlite3_result_double(pCtx, r); } } #define cume_distFinalizeFunc cume_distValueFunc @@ -154189,18 +154189,18 @@ struct NtileCtx { ** ROWS CURRENT ROW AND UNBOUNDED FOLLOWING */ static void ntileStepFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ struct NtileCtx *p; assert( nArg==1 ); UNUSED_PARAMETER(nArg); - p = (struct NtileCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct NtileCtx*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ if( p->nTotal==0 ){ - p->nParam = sqlite3_value_int64(apArg[0]); + p->nParam = tdsqlite3_value_int64(apArg[0]); if( p->nParam<=0 ){ - sqlite3_result_error( + tdsqlite3_result_error( pCtx, "argument of ntile must be a positive integer", -1 ); } @@ -154209,23 +154209,23 @@ static void ntileStepFunc( } } static void ntileInvFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ struct NtileCtx *p; assert( nArg==1 ); UNUSED_PARAMETER(nArg); UNUSED_PARAMETER(apArg); - p = (struct NtileCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct NtileCtx*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); p->iRow++; } -static void ntileValueFunc(sqlite3_context *pCtx){ +static void ntileValueFunc(tdsqlite3_context *pCtx){ struct NtileCtx *p; - p = (struct NtileCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct NtileCtx*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p && p->nParam>0 ){ int nSize = (p->nTotal / p->nParam); if( nSize==0 ){ - sqlite3_result_int64(pCtx, p->iRow+1); + tdsqlite3_result_int64(pCtx, p->iRow+1); }else{ i64 nLarge = p->nTotal - p->nParam*nSize; i64 iSmall = nLarge*(nSize+1); @@ -154234,9 +154234,9 @@ static void ntileValueFunc(sqlite3_context *pCtx){ assert( (nLarge*(nSize+1) + (p->nParam-nLarge)*nSize)==p->nTotal ); if( iRowpVal); - p->pVal = sqlite3_value_dup(apArg[0]); + tdsqlite3_value_free(p->pVal); + p->pVal = tdsqlite3_value_dup(apArg[0]); if( p->pVal==0 ){ - sqlite3_result_error_nomem(pCtx); + tdsqlite3_result_error_nomem(pCtx); }else{ p->nVal++; } } } static void last_valueInvFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ struct LastValueCtx *p; UNUSED_PARAMETER(nArg); UNUSED_PARAMETER(apArg); - p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct LastValueCtx*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( ALWAYS(p) ){ p->nVal--; if( p->nVal==0 ){ - sqlite3_value_free(p->pVal); + tdsqlite3_value_free(p->pVal); p->pVal = 0; } } } -static void last_valueValueFunc(sqlite3_context *pCtx){ +static void last_valueValueFunc(tdsqlite3_context *pCtx){ struct LastValueCtx *p; - p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, 0); + p = (struct LastValueCtx*)tdsqlite3_aggregate_context(pCtx, 0); if( p && p->pVal ){ - sqlite3_result_value(pCtx, p->pVal); + tdsqlite3_result_value(pCtx, p->pVal); } } -static void last_valueFinalizeFunc(sqlite3_context *pCtx){ +static void last_valueFinalizeFunc(tdsqlite3_context *pCtx){ struct LastValueCtx *p; - p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); + p = (struct LastValueCtx*)tdsqlite3_aggregate_context(pCtx, sizeof(*p)); if( p && p->pVal ){ - sqlite3_result_value(pCtx, p->pVal); - sqlite3_value_free(p->pVal); + tdsqlite3_result_value(pCtx, p->pVal); + tdsqlite3_value_free(p->pVal); p->pVal = 0; } } @@ -154336,16 +154336,16 @@ static const char lagName[] = "lag"; ** invoked. */ static void noopStepFunc( /*NO_TEST*/ - sqlite3_context *p, /*NO_TEST*/ + tdsqlite3_context *p, /*NO_TEST*/ int n, /*NO_TEST*/ - sqlite3_value **a /*NO_TEST*/ + tdsqlite3_value **a /*NO_TEST*/ ){ /*NO_TEST*/ UNUSED_PARAMETER(p); /*NO_TEST*/ UNUSED_PARAMETER(n); /*NO_TEST*/ UNUSED_PARAMETER(a); /*NO_TEST*/ assert(0); /*NO_TEST*/ } /*NO_TEST*/ -static void noopValueFunc(sqlite3_context *p){ UNUSED_PARAMETER(p); /*no-op*/ } +static void noopValueFunc(tdsqlite3_context *p){ UNUSED_PARAMETER(p); /*no-op*/ } /* Window functions that use all window interfaces: xStep, xFinal, ** xValue, and xInverse */ @@ -154376,7 +154376,7 @@ static void noopValueFunc(sqlite3_context *p){ UNUSED_PARAMETER(p); /*no-op*/ } /* ** Register those built-in window functions that are not also aggregates. */ -SQLITE_PRIVATE void sqlite3WindowFunctions(void){ +SQLITE_PRIVATE void tdsqlite3WindowFunctions(void){ static FuncDef aWindowFuncs[] = { WINDOWFUNCX(row_number, 0, 0), WINDOWFUNCX(dense_rank, 0, 0), @@ -154394,16 +154394,16 @@ SQLITE_PRIVATE void sqlite3WindowFunctions(void){ WINDOWFUNCNOOP(lag, 2, 0), WINDOWFUNCNOOP(lag, 3, 0), }; - sqlite3InsertBuiltinFuncs(aWindowFuncs, ArraySize(aWindowFuncs)); + tdsqlite3InsertBuiltinFuncs(aWindowFuncs, ArraySize(aWindowFuncs)); } static Window *windowFind(Parse *pParse, Window *pList, const char *zName){ Window *p; for(p=pList; p; p=p->pNextWin){ - if( sqlite3StrICmp(p->zName, zName)==0 ) break; + if( tdsqlite3StrICmp(p->zName, zName)==0 ) break; } if( p==0 ){ - sqlite3ErrorMsg(pParse, "no such window: %s", zName); + tdsqlite3ErrorMsg(pParse, "no such window: %s", zName); } return p; } @@ -154425,7 +154425,7 @@ static Window *windowFind(Parse *pParse, Window *pList, const char *zName){ ** window to be coerced (see "BUILT-IN WINDOW FUNCTIONS" at the top ** of this file), pWin is updated here. */ -SQLITE_PRIVATE void sqlite3WindowUpdate( +SQLITE_PRIVATE void tdsqlite3WindowUpdate( Parse *pParse, Window *pList, /* List of named windows for this SELECT */ Window *pWin, /* Window frame to update */ @@ -154434,29 +154434,29 @@ SQLITE_PRIVATE void sqlite3WindowUpdate( if( pWin->zName && pWin->eFrmType==0 ){ Window *p = windowFind(pParse, pList, pWin->zName); if( p==0 ) return; - pWin->pPartition = sqlite3ExprListDup(pParse->db, p->pPartition, 0); - pWin->pOrderBy = sqlite3ExprListDup(pParse->db, p->pOrderBy, 0); - pWin->pStart = sqlite3ExprDup(pParse->db, p->pStart, 0); - pWin->pEnd = sqlite3ExprDup(pParse->db, p->pEnd, 0); + pWin->pPartition = tdsqlite3ExprListDup(pParse->db, p->pPartition, 0); + pWin->pOrderBy = tdsqlite3ExprListDup(pParse->db, p->pOrderBy, 0); + pWin->pStart = tdsqlite3ExprDup(pParse->db, p->pStart, 0); + pWin->pEnd = tdsqlite3ExprDup(pParse->db, p->pEnd, 0); pWin->eStart = p->eStart; pWin->eEnd = p->eEnd; pWin->eFrmType = p->eFrmType; pWin->eExclude = p->eExclude; }else{ - sqlite3WindowChain(pParse, pWin, pList); + tdsqlite3WindowChain(pParse, pWin, pList); } if( (pWin->eFrmType==TK_RANGE) && (pWin->pStart || pWin->pEnd) && (pWin->pOrderBy==0 || pWin->pOrderBy->nExpr!=1) ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression" ); }else if( pFunc->funcFlags & SQLITE_FUNC_WINDOW ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; if( pWin->pFilter ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "FILTER clause may only be used with aggregate window functions" ); }else{ @@ -154478,15 +154478,15 @@ SQLITE_PRIVATE void sqlite3WindowUpdate( int i; for(i=0; izName==aUp[i].zFunc ){ - sqlite3ExprDelete(db, pWin->pStart); - sqlite3ExprDelete(db, pWin->pEnd); + tdsqlite3ExprDelete(db, pWin->pStart); + tdsqlite3ExprDelete(db, pWin->pEnd); pWin->pEnd = pWin->pStart = 0; pWin->eFrmType = aUp[i].eFrmType; pWin->eStart = aUp[i].eStart; pWin->eEnd = aUp[i].eEnd; pWin->eExclude = 0; if( pWin->eStart==TK_FOLLOWING ){ - pWin->pStart = sqlite3Expr(db, TK_INTEGER, "1"); + pWin->pStart = tdsqlite3Expr(db, TK_INTEGER, "1"); } break; } @@ -154497,7 +154497,7 @@ SQLITE_PRIVATE void sqlite3WindowUpdate( } /* -** Context object passed through sqlite3WalkExprList() to +** Context object passed through tdsqlite3WalkExprList() to ** selectWindowRewriteExprCb() by selectWindowRewriteEList(). */ typedef struct WindowRewrite WindowRewrite; @@ -154560,21 +154560,21 @@ static int selectWindowRewriteExprCb(Walker *pWalker, Expr *pExpr){ if( p->pSub ){ int i; for(i=0; ipSub->nExpr; i++){ - if( 0==sqlite3ExprCompare(0, p->pSub->a[i].pExpr, pExpr, -1) ){ + if( 0==tdsqlite3ExprCompare(0, p->pSub->a[i].pExpr, pExpr, -1) ){ iCol = i; break; } } } if( iCol<0 ){ - Expr *pDup = sqlite3ExprDup(pParse->db, pExpr, 0); + Expr *pDup = tdsqlite3ExprDup(pParse->db, pExpr, 0); if( pDup && pDup->op==TK_AGG_FUNCTION ) pDup->op = TK_FUNCTION; - p->pSub = sqlite3ExprListAppend(pParse, p->pSub, pDup); + p->pSub = tdsqlite3ExprListAppend(pParse, p->pSub, pDup); } if( p->pSub ){ assert( ExprHasProperty(pExpr, EP_Static)==0 ); ExprSetProperty(pExpr, EP_Static); - sqlite3ExprDelete(pParse->db, pExpr); + tdsqlite3ExprDelete(pParse->db, pExpr); ExprClearProperty(pExpr, EP_Static); memset(pExpr, 0, sizeof(Expr)); @@ -154600,7 +154600,7 @@ static int selectWindowRewriteSelectCb(Walker *pWalker, Select *pSelect){ return WRC_Continue; }else{ p->pSubSelect = pSelect; - sqlite3WalkSelect(pWalker, pSelect); + tdsqlite3WalkSelect(pWalker, pSelect); p->pSubSelect = pSave; } return WRC_Prune; @@ -154645,7 +154645,7 @@ static void selectWindowRewriteEList( sWalker.xSelectCallback = selectWindowRewriteSelectCb; sWalker.u.pRewrite = &sRewrite; - (void)sqlite3WalkExprList(&sWalker, pEList); + (void)tdsqlite3WalkExprList(&sWalker, pEList); *ppSub = sRewrite.pSub; } @@ -154665,14 +154665,14 @@ static ExprList *exprListAppendList( int nInit = pList ? pList->nExpr : 0; for(i=0; inExpr; i++){ int iDummy; - Expr *pDup = sqlite3ExprDup(pParse->db, pAppend->a[i].pExpr, 0); + Expr *pDup = tdsqlite3ExprDup(pParse->db, pAppend->a[i].pExpr, 0); assert( pDup==0 || !ExprHasProperty(pDup, EP_MemToken) ); - if( bIntToNull && pDup && sqlite3ExprIsInteger(pDup, &iDummy) ){ + if( bIntToNull && pDup && tdsqlite3ExprIsInteger(pDup, &iDummy) ){ pDup->op = TK_NULL; pDup->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse); pDup->u.zToken = 0; } - pList = sqlite3ExprListAppend(pParse, pList, pDup); + pList = tdsqlite3ExprListAppend(pParse, pList, pDup); if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags; } } @@ -154686,11 +154686,11 @@ static ExprList *exprListAppendList( ** are invoked in the correct order as described under "SELECT REWRITING" ** at the top of this file. */ -SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ +SQLITE_PRIVATE int tdsqlite3WindowRewrite(Parse *pParse, Select *p){ int rc = SQLITE_OK; if( p->pWin && p->pPrior==0 && (p->selFlags & SF_WinRewrite)==0 ){ - Vdbe *v = sqlite3GetVdbe(pParse); - sqlite3 *db = pParse->db; + Vdbe *v = tdsqlite3GetVdbe(pParse); + tdsqlite3 *db = pParse->db; Select *pSub = 0; /* The subquery */ SrcList *pSrc = p->pSrc; Expr *pWhere = p->pWhere; @@ -154703,9 +154703,9 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ Window *pWin; /* Window object iterator */ Table *pTab; - pTab = sqlite3DbMallocZero(db, sizeof(Table)); + pTab = tdsqlite3DbMallocZero(db, sizeof(Table)); if( pTab==0 ){ - return sqlite3ErrorToParser(db, SQLITE_NOMEM); + return tdsqlite3ErrorToParser(db, SQLITE_NOMEM); } p->pSrc = 0; @@ -154723,8 +154723,8 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ if( pSort && p->pOrderBy && p->pOrderBy->nExpr<=pSort->nExpr ){ int nSave = pSort->nExpr; pSort->nExpr = p->pOrderBy->nExpr; - if( sqlite3ExprListCompare(pSort, p->pOrderBy, -1)==0 ){ - sqlite3ExprListDelete(db, p->pOrderBy); + if( tdsqlite3ExprListCompare(pSort, p->pOrderBy, -1)==0 ){ + tdsqlite3ExprListDelete(db, p->pOrderBy); p->pOrderBy = 0; } pSort->nExpr = nSave; @@ -154761,12 +154761,12 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ pSublist = exprListAppendList(pParse, pSublist, pArgs, 0); } if( pWin->pFilter ){ - Expr *pFilter = sqlite3ExprDup(db, pWin->pFilter, 0); - pSublist = sqlite3ExprListAppend(pParse, pSublist, pFilter); + Expr *pFilter = tdsqlite3ExprDup(db, pWin->pFilter, 0); + pSublist = tdsqlite3ExprListAppend(pParse, pSublist, pFilter); } pWin->regAccum = ++pParse->nMem; pWin->regResult = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum); } /* If there is no ORDER BY or PARTITION BY clause, and the window @@ -154776,21 +154776,21 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ ** keep everything legal in this case. */ if( pSublist==0 ){ - pSublist = sqlite3ExprListAppend(pParse, 0, - sqlite3Expr(db, TK_INTEGER, "0") + pSublist = tdsqlite3ExprListAppend(pParse, 0, + tdsqlite3Expr(db, TK_INTEGER, "0") ); } - pSub = sqlite3SelectNew( + pSub = tdsqlite3SelectNew( pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0 ); - p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0); + p->pSrc = tdsqlite3SrcListAppend(pParse, 0, 0, 0); if( p->pSrc ){ Table *pTab2; p->pSrc->a[0].pSelect = pSub; - sqlite3SrcListAssignCursors(pParse, p->pSrc); + tdsqlite3SrcListAssignCursors(pParse, p->pSrc); pSub->selFlags |= SF_Expanded; - pTab2 = sqlite3ResultSetOfSelect(pParse, pSub, SQLITE_AFF_NONE); + pTab2 = tdsqlite3ResultSetOfSelect(pParse, pSub, SQLITE_AFF_NONE); if( pTab2==0 ){ /* Might actually be some other kind of error, but in that case ** pParse->nErr will be set, so if SQLITE_NOMEM is set, we will get @@ -154803,18 +154803,18 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ pTab = pTab2; } }else{ - sqlite3SelectDelete(db, pSub); + tdsqlite3SelectDelete(db, pSub); } if( db->mallocFailed ) rc = SQLITE_NOMEM; - sqlite3DbFree(db, pTab); + tdsqlite3DbFree(db, pTab); } if( rc ){ if( pParse->nErr==0 ){ assert( pParse->db->mallocFailed ); - sqlite3ErrorToParser(pParse->db, SQLITE_NOMEM); + tdsqlite3ErrorToParser(pParse->db, SQLITE_NOMEM); } - sqlite3SelectReset(pParse, p); + tdsqlite3SelectReset(pParse, p); } return rc; } @@ -154823,7 +154823,7 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ ** Unlink the Window object from the Select to which it is attached, ** if it is attached. */ -SQLITE_PRIVATE void sqlite3WindowUnlinkFromSelect(Window *p){ +SQLITE_PRIVATE void tdsqlite3WindowUnlinkFromSelect(Window *p){ if( p->ppThis ){ *p->ppThis = p->pNextWin; if( p->pNextWin ) p->pNextWin->ppThis = p->ppThis; @@ -154834,27 +154834,27 @@ SQLITE_PRIVATE void sqlite3WindowUnlinkFromSelect(Window *p){ /* ** Free the Window object passed as the second argument. */ -SQLITE_PRIVATE void sqlite3WindowDelete(sqlite3 *db, Window *p){ +SQLITE_PRIVATE void tdsqlite3WindowDelete(tdsqlite3 *db, Window *p){ if( p ){ - sqlite3WindowUnlinkFromSelect(p); - sqlite3ExprDelete(db, p->pFilter); - sqlite3ExprListDelete(db, p->pPartition); - sqlite3ExprListDelete(db, p->pOrderBy); - sqlite3ExprDelete(db, p->pEnd); - sqlite3ExprDelete(db, p->pStart); - sqlite3DbFree(db, p->zName); - sqlite3DbFree(db, p->zBase); - sqlite3DbFree(db, p); + tdsqlite3WindowUnlinkFromSelect(p); + tdsqlite3ExprDelete(db, p->pFilter); + tdsqlite3ExprListDelete(db, p->pPartition); + tdsqlite3ExprListDelete(db, p->pOrderBy); + tdsqlite3ExprDelete(db, p->pEnd); + tdsqlite3ExprDelete(db, p->pStart); + tdsqlite3DbFree(db, p->zName); + tdsqlite3DbFree(db, p->zBase); + tdsqlite3DbFree(db, p); } } /* ** Free the linked list of Window objects starting at the second argument. */ -SQLITE_PRIVATE void sqlite3WindowListDelete(sqlite3 *db, Window *p){ +SQLITE_PRIVATE void tdsqlite3WindowListDelete(tdsqlite3 *db, Window *p){ while( p ){ Window *pNext = p->pNextWin; - sqlite3WindowDelete(db, p); + tdsqlite3WindowDelete(db, p); p = pNext; } } @@ -154866,11 +154866,11 @@ SQLITE_PRIVATE void sqlite3WindowListDelete(sqlite3 *db, Window *p){ ** integer will be caught later. But it is important not to leave ** variable values in the expression tree. */ -static Expr *sqlite3WindowOffsetExpr(Parse *pParse, Expr *pExpr){ - if( 0==sqlite3ExprIsConstant(pExpr) ){ - if( IN_RENAME_OBJECT ) sqlite3RenameExprUnmap(pParse, pExpr); - sqlite3ExprDelete(pParse->db, pExpr); - pExpr = sqlite3ExprAlloc(pParse->db, TK_NULL, 0, 0); +static Expr *tdsqlite3WindowOffsetExpr(Parse *pParse, Expr *pExpr){ + if( 0==tdsqlite3ExprIsConstant(pExpr) ){ + if( IN_RENAME_OBJECT ) tdsqlite3RenameExprUnmap(pParse, pExpr); + tdsqlite3ExprDelete(pParse->db, pExpr); + pExpr = tdsqlite3ExprAlloc(pParse->db, TK_NULL, 0, 0); } return pExpr; } @@ -154878,7 +154878,7 @@ static Expr *sqlite3WindowOffsetExpr(Parse *pParse, Expr *pExpr){ /* ** Allocate and return a new Window object describing a Window Definition. */ -SQLITE_PRIVATE Window *sqlite3WindowAlloc( +SQLITE_PRIVATE Window *tdsqlite3WindowAlloc( Parse *pParse, /* Parsing context */ int eType, /* Frame type. TK_RANGE, TK_ROWS, TK_GROUPS, or 0 */ int eStart, /* Start type: CURRENT, PRECEDING, FOLLOWING, UNBOUNDED */ @@ -154921,11 +154921,11 @@ SQLITE_PRIVATE Window *sqlite3WindowAlloc( if( (eStart==TK_CURRENT && eEnd==TK_PRECEDING) || (eStart==TK_FOLLOWING && (eEnd==TK_PRECEDING || eEnd==TK_CURRENT)) ){ - sqlite3ErrorMsg(pParse, "unsupported frame specification"); + tdsqlite3ErrorMsg(pParse, "unsupported frame specification"); goto windowAllocErr; } - pWin = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); + pWin = (Window*)tdsqlite3DbMallocZero(pParse->db, sizeof(Window)); if( pWin==0 ) goto windowAllocErr; pWin->eFrmType = eType; pWin->eStart = eStart; @@ -154935,13 +154935,13 @@ SQLITE_PRIVATE Window *sqlite3WindowAlloc( } pWin->eExclude = eExclude; pWin->bImplicitFrame = bImplicitFrame; - pWin->pEnd = sqlite3WindowOffsetExpr(pParse, pEnd); - pWin->pStart = sqlite3WindowOffsetExpr(pParse, pStart); + pWin->pEnd = tdsqlite3WindowOffsetExpr(pParse, pEnd); + pWin->pStart = tdsqlite3WindowOffsetExpr(pParse, pStart); return pWin; windowAllocErr: - sqlite3ExprDelete(pParse->db, pEnd); - sqlite3ExprDelete(pParse->db, pStart); + tdsqlite3ExprDelete(pParse->db, pEnd); + tdsqlite3ExprDelete(pParse->db, pStart); return 0; } @@ -154950,7 +154950,7 @@ windowAllocErr: ** pWin. Also, if parameter pBase is not NULL, set pWin->zBase to the ** equivalent nul-terminated string. */ -SQLITE_PRIVATE Window *sqlite3WindowAssemble( +SQLITE_PRIVATE Window *tdsqlite3WindowAssemble( Parse *pParse, Window *pWin, ExprList *pPartition, @@ -154961,11 +154961,11 @@ SQLITE_PRIVATE Window *sqlite3WindowAssemble( pWin->pPartition = pPartition; pWin->pOrderBy = pOrderBy; if( pBase ){ - pWin->zBase = sqlite3DbStrNDup(pParse->db, pBase->z, pBase->n); + pWin->zBase = tdsqlite3DbStrNDup(pParse->db, pBase->z, pBase->n); } }else{ - sqlite3ExprListDelete(pParse->db, pPartition); - sqlite3ExprListDelete(pParse->db, pOrderBy); + tdsqlite3ExprListDelete(pParse->db, pPartition); + tdsqlite3ExprListDelete(pParse->db, pOrderBy); } return pWin; } @@ -154977,9 +154977,9 @@ SQLITE_PRIVATE Window *sqlite3WindowAssemble( ** either updates *pWin according to the base specification, or else ** leaves an error in pParse. */ -SQLITE_PRIVATE void sqlite3WindowChain(Parse *pParse, Window *pWin, Window *pList){ +SQLITE_PRIVATE void tdsqlite3WindowChain(Parse *pParse, Window *pWin, Window *pList){ if( pWin->zBase ){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; Window *pExist = windowFind(pParse, pList, pWin->zBase); if( pExist ){ const char *zErr = 0; @@ -154992,16 +154992,16 @@ SQLITE_PRIVATE void sqlite3WindowChain(Parse *pParse, Window *pWin, Window *pLis zErr = "frame specification"; } if( zErr ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "cannot override %s of window: %s", zErr, pWin->zBase ); }else{ - pWin->pPartition = sqlite3ExprListDup(db, pExist->pPartition, 0); + pWin->pPartition = tdsqlite3ExprListDup(db, pExist->pPartition, 0); if( pExist->pOrderBy ){ assert( pWin->pOrderBy==0 ); - pWin->pOrderBy = sqlite3ExprListDup(db, pExist->pOrderBy, 0); + pWin->pOrderBy = tdsqlite3ExprListDup(db, pExist->pOrderBy, 0); } - sqlite3DbFree(db, pWin->zBase); + tdsqlite3DbFree(db, pWin->zBase); pWin->zBase = 0; } } @@ -155011,7 +155011,7 @@ SQLITE_PRIVATE void sqlite3WindowChain(Parse *pParse, Window *pWin, Window *pLis /* ** Attach window object pWin to expression p. */ -SQLITE_PRIVATE void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){ +SQLITE_PRIVATE void tdsqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){ if( p ){ assert( p->op==TK_FUNCTION ); assert( pWin ); @@ -155019,12 +155019,12 @@ SQLITE_PRIVATE void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){ ExprSetProperty(p, EP_WinFunc); pWin->pOwner = p; if( (p->flags & EP_Distinct) && pWin->eFrmType!=TK_FILTER ){ - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "DISTINCT is not supported for window functions" ); } }else{ - sqlite3WindowDelete(pParse->db, pWin); + tdsqlite3WindowDelete(pParse->db, pWin); } } @@ -155034,9 +155034,9 @@ SQLITE_PRIVATE void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){ ** in if either (a) there are no other windows already linked to this ** SELECT, or (b) the windows already linked use a compatible window frame. */ -SQLITE_PRIVATE void sqlite3WindowLink(Select *pSel, Window *pWin){ +SQLITE_PRIVATE void tdsqlite3WindowLink(Select *pSel, Window *pWin){ if( pSel!=0 - && (0==pSel->pWin || 0==sqlite3WindowCompare(0, pSel->pWin, pWin, 0)) + && (0==pSel->pWin || 0==tdsqlite3WindowCompare(0, pSel->pWin, pWin, 0)) ){ pWin->pNextWin = pSel->pWin; if( pSel->pWin ){ @@ -155052,23 +155052,23 @@ SQLITE_PRIVATE void sqlite3WindowLink(Select *pSel, Window *pWin){ ** different, or 2 if it cannot be determined if the objects are identical ** or not. Identical window objects can be processed in a single scan. */ -SQLITE_PRIVATE int sqlite3WindowCompare(Parse *pParse, Window *p1, Window *p2, int bFilter){ +SQLITE_PRIVATE int tdsqlite3WindowCompare(Parse *pParse, Window *p1, Window *p2, int bFilter){ int res; if( NEVER(p1==0) || NEVER(p2==0) ) return 1; if( p1->eFrmType!=p2->eFrmType ) return 1; if( p1->eStart!=p2->eStart ) return 1; if( p1->eEnd!=p2->eEnd ) return 1; if( p1->eExclude!=p2->eExclude ) return 1; - if( sqlite3ExprCompare(pParse, p1->pStart, p2->pStart, -1) ) return 1; - if( sqlite3ExprCompare(pParse, p1->pEnd, p2->pEnd, -1) ) return 1; - if( (res = sqlite3ExprListCompare(p1->pPartition, p2->pPartition, -1)) ){ + if( tdsqlite3ExprCompare(pParse, p1->pStart, p2->pStart, -1) ) return 1; + if( tdsqlite3ExprCompare(pParse, p1->pEnd, p2->pEnd, -1) ) return 1; + if( (res = tdsqlite3ExprListCompare(p1->pPartition, p2->pPartition, -1)) ){ return res; } - if( (res = sqlite3ExprListCompare(p1->pOrderBy, p2->pOrderBy, -1)) ){ + if( (res = tdsqlite3ExprListCompare(p1->pOrderBy, p2->pOrderBy, -1)) ){ return res; } if( bFilter ){ - if( (res = sqlite3ExprCompare(pParse, p1->pFilter, p2->pFilter, -1)) ){ + if( (res = tdsqlite3ExprCompare(pParse, p1->pFilter, p2->pFilter, -1)) ){ return res; } } @@ -155077,20 +155077,20 @@ SQLITE_PRIVATE int sqlite3WindowCompare(Parse *pParse, Window *p1, Window *p2, i /* -** This is called by code in select.c before it calls sqlite3WhereBegin() +** This is called by code in select.c before it calls tdsqlite3WhereBegin() ** to begin iterating through the sub-query results. It is used to allocate -** and initialize registers and cursors used by sqlite3WindowCodeStep(). +** and initialize registers and cursors used by tdsqlite3WindowCodeStep(). */ -SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse *pParse, Select *pSelect){ +SQLITE_PRIVATE void tdsqlite3WindowCodeInit(Parse *pParse, Select *pSelect){ int nEphExpr = pSelect->pSrc->a[0].pSelect->pEList->nExpr; Window *pMWin = pSelect->pWin; Window *pWin; - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pMWin->iEphCsr, nEphExpr); - sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+1, pMWin->iEphCsr); - sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+2, pMWin->iEphCsr); - sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+3, pMWin->iEphCsr); + tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, pMWin->iEphCsr, nEphExpr); + tdsqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+1, pMWin->iEphCsr); + tdsqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+2, pMWin->iEphCsr); + tdsqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+3, pMWin->iEphCsr); /* Allocate registers to use for PARTITION BY values, if any. Initialize ** said registers to NULL. */ @@ -155098,19 +155098,19 @@ SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse *pParse, Select *pSelect){ int nExpr = pMWin->pPartition->nExpr; pMWin->regPart = pParse->nMem+1; pParse->nMem += nExpr; - sqlite3VdbeAddOp3(v, OP_Null, 0, pMWin->regPart, pMWin->regPart+nExpr-1); + tdsqlite3VdbeAddOp3(v, OP_Null, 0, pMWin->regPart, pMWin->regPart+nExpr-1); } pMWin->regOne = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Integer, 1, pMWin->regOne); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, pMWin->regOne); if( pMWin->eExclude ){ pMWin->regStartRowid = ++pParse->nMem; pMWin->regEndRowid = ++pParse->nMem; pMWin->csrApp = pParse->nTab++; - sqlite3VdbeAddOp2(v, OP_Integer, 1, pMWin->regStartRowid); - sqlite3VdbeAddOp2(v, OP_Integer, 0, pMWin->regEndRowid); - sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->csrApp, pMWin->iEphCsr); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, pMWin->regStartRowid); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, pMWin->regEndRowid); + tdsqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->csrApp, pMWin->iEphCsr); return; } @@ -155125,7 +155125,7 @@ SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse *pParse, Select *pSelect){ ** regApp+2: output of MakeRecord */ ExprList *pList = pWin->pOwner->x.pList; - KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pList, 0, 0); + KeyInfo *pKeyInfo = tdsqlite3KeyInfoFromExprList(pParse, pList, 0, 0); pWin->csrApp = pParse->nTab++; pWin->regApp = pParse->nMem+1; pParse->nMem += 3; @@ -155133,9 +155133,9 @@ SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse *pParse, Select *pSelect){ assert( pKeyInfo->aSortFlags[0]==0 ); pKeyInfo->aSortFlags[0] = KEYINFO_ORDER_DESC; } - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pWin->csrApp, 2); - sqlite3VdbeAppendP4(v, pKeyInfo, P4_KEYINFO); - sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1); + tdsqlite3VdbeAddOp2(v, OP_OpenEphemeral, pWin->csrApp, 2); + tdsqlite3VdbeAppendP4(v, pKeyInfo, P4_KEYINFO); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1); } else if( p->zName==nth_valueName || p->zName==first_valueName ){ /* Allocate two registers at pWin->regApp. These will be used to @@ -155143,11 +155143,11 @@ SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse *pParse, Select *pSelect){ pWin->regApp = pParse->nMem+1; pWin->csrApp = pParse->nTab++; pParse->nMem += 2; - sqlite3VdbeAddOp2(v, OP_OpenDup, pWin->csrApp, pMWin->iEphCsr); + tdsqlite3VdbeAddOp2(v, OP_OpenDup, pWin->csrApp, pMWin->iEphCsr); } else if( p->zName==leadName || p->zName==lagName ){ pWin->csrApp = pParse->nTab++; - sqlite3VdbeAddOp2(v, OP_OpenDup, pWin->csrApp, pMWin->iEphCsr); + tdsqlite3VdbeAddOp2(v, OP_OpenDup, pWin->csrApp, pMWin->iEphCsr); } } } @@ -155174,37 +155174,37 @@ static void windowCheckValue(Parse *pParse, int reg, int eCond){ "frame ending offset must be a non-negative number", }; static int aOp[] = { OP_Ge, OP_Ge, OP_Gt, OP_Ge, OP_Ge }; - Vdbe *v = sqlite3GetVdbe(pParse); - int regZero = sqlite3GetTempReg(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); + int regZero = tdsqlite3GetTempReg(pParse); assert( eCond>=0 && eCond=WINDOW_STARTING_NUM ){ - int regString = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp4(v, OP_String8, 0, regString, 0, "", P4_STATIC); - sqlite3VdbeAddOp3(v, OP_Ge, regString, sqlite3VdbeCurrentAddr(v)+2, reg); - sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC|SQLITE_JUMPIFNULL); + int regString = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, regString, 0, "", P4_STATIC); + tdsqlite3VdbeAddOp3(v, OP_Ge, regString, tdsqlite3VdbeCurrentAddr(v)+2, reg); + tdsqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC|SQLITE_JUMPIFNULL); VdbeCoverage(v); assert( eCond==3 || eCond==4 ); VdbeCoverageIf(v, eCond==3); VdbeCoverageIf(v, eCond==4); }else{ - sqlite3VdbeAddOp2(v, OP_MustBeInt, reg, sqlite3VdbeCurrentAddr(v)+2); + tdsqlite3VdbeAddOp2(v, OP_MustBeInt, reg, tdsqlite3VdbeCurrentAddr(v)+2); VdbeCoverage(v); assert( eCond==0 || eCond==1 || eCond==2 ); VdbeCoverageIf(v, eCond==0); VdbeCoverageIf(v, eCond==1); VdbeCoverageIf(v, eCond==2); } - sqlite3VdbeAddOp3(v, aOp[eCond], regZero, sqlite3VdbeCurrentAddr(v)+2, reg); + tdsqlite3VdbeAddOp3(v, aOp[eCond], regZero, tdsqlite3VdbeCurrentAddr(v)+2, reg); VdbeCoverageNeverNullIf(v, eCond==0); /* NULL case captured by */ VdbeCoverageNeverNullIf(v, eCond==1); /* the OP_MustBeInt */ VdbeCoverageNeverNullIf(v, eCond==2); VdbeCoverageNeverNullIf(v, eCond==3); /* NULL case caught by */ VdbeCoverageNeverNullIf(v, eCond==4); /* the OP_Ge */ - sqlite3MayAbort(pParse); - sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_ERROR, OE_Abort); - sqlite3VdbeAppendP4(v, (void*)azErr[eCond], P4_STATIC); - sqlite3ReleaseTempReg(pParse, regZero); + tdsqlite3MayAbort(pParse); + tdsqlite3VdbeAddOp2(v, OP_Halt, SQLITE_ERROR, OE_Abort); + tdsqlite3VdbeAppendP4(v, (void*)azErr[eCond], P4_STATIC); + tdsqlite3ReleaseTempReg(pParse, regZero); } /* @@ -155229,7 +155229,7 @@ struct WindowCsrAndReg { /* ** A single instance of this structure is allocated on the stack by -** sqlite3WindowCodeStep() and a pointer to it passed to the various helper +** tdsqlite3WindowCodeStep() and a pointer to it passed to the various helper ** routines. This is to reduce the number of arguments required by each ** helper function. ** @@ -155308,12 +155308,12 @@ static void windowReadPeerValues( Window *pMWin = p->pMWin; ExprList *pOrderBy = pMWin->pOrderBy; if( pOrderBy ){ - Vdbe *v = sqlite3GetVdbe(p->pParse); + Vdbe *v = tdsqlite3GetVdbe(p->pParse); ExprList *pPart = pMWin->pPartition; int iColOff = pMWin->nBufferCol + (pPart ? pPart->nExpr : 0); int i; for(i=0; inExpr; i++){ - sqlite3VdbeAddOp3(v, OP_Column, csr, iColOff+i, reg+i); + tdsqlite3VdbeAddOp3(v, OP_Column, csr, iColOff+i, reg+i); } } } @@ -155345,7 +155345,7 @@ static void windowAggStep( int reg /* Array of registers */ ){ Parse *pParse = p->pParse; - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); Window *pWin; for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ FuncDef *pFunc = pWin->pFunc; @@ -155357,13 +155357,13 @@ static void windowAggStep( /* All OVER clauses in the same window function aggregate step must ** be the same. */ - assert( pWin==pMWin || sqlite3WindowCompare(pParse,pWin,pMWin,0)!=1 ); + assert( pWin==pMWin || tdsqlite3WindowCompare(pParse,pWin,pMWin,0)!=1 ); for(i=0; izName!=nth_valueName ){ - sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+i, reg+i); + tdsqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+i, reg+i); }else{ - sqlite3VdbeAddOp3(v, OP_Column, pMWin->iEphCsr, pWin->iArgCol+i, reg+i); + tdsqlite3VdbeAddOp3(v, OP_Column, pMWin->iEphCsr, pWin->iArgCol+i, reg+i); } } regArg = reg; @@ -155372,49 +155372,49 @@ static void windowAggStep( && (pFunc->funcFlags & SQLITE_FUNC_MINMAX) && (pWin->eStart!=TK_UNBOUNDED) ){ - int addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regArg); + int addrIsNull = tdsqlite3VdbeAddOp1(v, OP_IsNull, regArg); VdbeCoverage(v); if( bInverse==0 ){ - sqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1, 1); - sqlite3VdbeAddOp2(v, OP_SCopy, regArg, pWin->regApp); - sqlite3VdbeAddOp3(v, OP_MakeRecord, pWin->regApp, 2, pWin->regApp+2); - sqlite3VdbeAddOp2(v, OP_IdxInsert, pWin->csrApp, pWin->regApp+2); + tdsqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1, 1); + tdsqlite3VdbeAddOp2(v, OP_SCopy, regArg, pWin->regApp); + tdsqlite3VdbeAddOp3(v, OP_MakeRecord, pWin->regApp, 2, pWin->regApp+2); + tdsqlite3VdbeAddOp2(v, OP_IdxInsert, pWin->csrApp, pWin->regApp+2); }else{ - sqlite3VdbeAddOp4Int(v, OP_SeekGE, pWin->csrApp, 0, regArg, 1); + tdsqlite3VdbeAddOp4Int(v, OP_SeekGE, pWin->csrApp, 0, regArg, 1); VdbeCoverageNeverTaken(v); - sqlite3VdbeAddOp1(v, OP_Delete, pWin->csrApp); - sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2); + tdsqlite3VdbeAddOp1(v, OP_Delete, pWin->csrApp); + tdsqlite3VdbeJumpHere(v, tdsqlite3VdbeCurrentAddr(v)-2); } - sqlite3VdbeJumpHere(v, addrIsNull); + tdsqlite3VdbeJumpHere(v, addrIsNull); }else if( pWin->regApp ){ assert( pFunc->zName==nth_valueName || pFunc->zName==first_valueName ); assert( bInverse==0 || bInverse==1 ); - sqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1-bInverse, 1); + tdsqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1-bInverse, 1); }else if( pFunc->xSFunc!=noopStepFunc ){ int addrIf = 0; if( pWin->pFilter ){ int regTmp; assert( pWin->bExprArgs || !nArg ||nArg==pWin->pOwner->x.pList->nExpr ); assert( pWin->bExprArgs || nArg ||pWin->pOwner->x.pList==0 ); - regTmp = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+nArg,regTmp); - addrIf = sqlite3VdbeAddOp3(v, OP_IfNot, regTmp, 0, 1); + regTmp = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+nArg,regTmp); + addrIf = tdsqlite3VdbeAddOp3(v, OP_IfNot, regTmp, 0, 1); VdbeCoverage(v); - sqlite3ReleaseTempReg(pParse, regTmp); + tdsqlite3ReleaseTempReg(pParse, regTmp); } if( pWin->bExprArgs ){ - int iStart = sqlite3VdbeCurrentAddr(v); + int iStart = tdsqlite3VdbeCurrentAddr(v); VdbeOp *pOp, *pEnd; nArg = pWin->pOwner->x.pList->nExpr; - regArg = sqlite3GetTempRange(pParse, nArg); - sqlite3ExprCodeExprList(pParse, pWin->pOwner->x.pList, regArg, 0, 0); + regArg = tdsqlite3GetTempRange(pParse, nArg); + tdsqlite3ExprCodeExprList(pParse, pWin->pOwner->x.pList, regArg, 0, 0); - pEnd = sqlite3VdbeGetOp(v, -1); - for(pOp=sqlite3VdbeGetOp(v, iStart); pOp<=pEnd; pOp++){ + pEnd = tdsqlite3VdbeGetOp(v, -1); + for(pOp=tdsqlite3VdbeGetOp(v, iStart); pOp<=pEnd; pOp++){ if( pOp->opcode==OP_Column && pOp->p1==pWin->iEphCsr ){ pOp->p1 = csr; } @@ -155423,17 +155423,17 @@ static void windowAggStep( if( pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){ CollSeq *pColl; assert( nArg>0 ); - pColl = sqlite3ExprNNCollSeq(pParse, pWin->pOwner->x.pList->a[0].pExpr); - sqlite3VdbeAddOp4(v, OP_CollSeq, 0,0,0, (const char*)pColl, P4_COLLSEQ); + pColl = tdsqlite3ExprNNCollSeq(pParse, pWin->pOwner->x.pList->a[0].pExpr); + tdsqlite3VdbeAddOp4(v, OP_CollSeq, 0,0,0, (const char*)pColl, P4_COLLSEQ); } - sqlite3VdbeAddOp3(v, bInverse? OP_AggInverse : OP_AggStep, + tdsqlite3VdbeAddOp3(v, bInverse? OP_AggInverse : OP_AggStep, bInverse, regArg, pWin->regAccum); - sqlite3VdbeAppendP4(v, pFunc, P4_FUNCDEF); - sqlite3VdbeChangeP5(v, (u8)nArg); + tdsqlite3VdbeAppendP4(v, pFunc, P4_FUNCDEF); + tdsqlite3VdbeChangeP5(v, (u8)nArg); if( pWin->bExprArgs ){ - sqlite3ReleaseTempRange(pParse, regArg, nArg); + tdsqlite3ReleaseTempRange(pParse, regArg, nArg); } - if( addrIf ) sqlite3VdbeJumpHere(v, addrIf); + if( addrIf ) tdsqlite3VdbeJumpHere(v, addrIf); } } } @@ -155454,7 +155454,7 @@ static void windowAggStep( static void windowAggFinal(WindowCodeArg *p, int bFin){ Parse *pParse = p->pParse; Window *pMWin = p->pMWin; - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); Window *pWin; for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ @@ -155462,23 +155462,23 @@ static void windowAggFinal(WindowCodeArg *p, int bFin){ && (pWin->pFunc->funcFlags & SQLITE_FUNC_MINMAX) && (pWin->eStart!=TK_UNBOUNDED) ){ - sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult); - sqlite3VdbeAddOp1(v, OP_Last, pWin->csrApp); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult); + tdsqlite3VdbeAddOp1(v, OP_Last, pWin->csrApp); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_Column, pWin->csrApp, 0, pWin->regResult); - sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2); + tdsqlite3VdbeAddOp3(v, OP_Column, pWin->csrApp, 0, pWin->regResult); + tdsqlite3VdbeJumpHere(v, tdsqlite3VdbeCurrentAddr(v)-2); }else if( pWin->regApp ){ assert( pMWin->regStartRowid==0 ); }else{ int nArg = windowArgCount(pWin); if( bFin ){ - sqlite3VdbeAddOp2(v, OP_AggFinal, pWin->regAccum, nArg); - sqlite3VdbeAppendP4(v, pWin->pFunc, P4_FUNCDEF); - sqlite3VdbeAddOp2(v, OP_Copy, pWin->regAccum, pWin->regResult); - sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum); + tdsqlite3VdbeAddOp2(v, OP_AggFinal, pWin->regAccum, nArg); + tdsqlite3VdbeAppendP4(v, pWin->pFunc, P4_FUNCDEF); + tdsqlite3VdbeAddOp2(v, OP_Copy, pWin->regAccum, pWin->regResult); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum); }else{ - sqlite3VdbeAddOp3(v, OP_AggValue,pWin->regAccum,nArg,pWin->regResult); - sqlite3VdbeAppendP4(v, pWin->pFunc, P4_FUNCDEF); + tdsqlite3VdbeAddOp3(v, OP_AggValue,pWin->regAccum,nArg,pWin->regResult); + tdsqlite3VdbeAppendP4(v, pWin->pFunc, P4_FUNCDEF); } } } @@ -155513,32 +155513,32 @@ static void windowFullScan(WindowCodeArg *p){ csr = pMWin->csrApp; nPeer = (pMWin->pOrderBy ? pMWin->pOrderBy->nExpr : 0); - lblNext = sqlite3VdbeMakeLabel(pParse); - lblBrk = sqlite3VdbeMakeLabel(pParse); + lblNext = tdsqlite3VdbeMakeLabel(pParse); + lblBrk = tdsqlite3VdbeMakeLabel(pParse); - regCRowid = sqlite3GetTempReg(pParse); - regRowid = sqlite3GetTempReg(pParse); + regCRowid = tdsqlite3GetTempReg(pParse); + regRowid = tdsqlite3GetTempReg(pParse); if( nPeer ){ - regCPeer = sqlite3GetTempRange(pParse, nPeer); - regPeer = sqlite3GetTempRange(pParse, nPeer); + regCPeer = tdsqlite3GetTempRange(pParse, nPeer); + regPeer = tdsqlite3GetTempRange(pParse, nPeer); } - sqlite3VdbeAddOp2(v, OP_Rowid, pMWin->iEphCsr, regCRowid); + tdsqlite3VdbeAddOp2(v, OP_Rowid, pMWin->iEphCsr, regCRowid); windowReadPeerValues(p, pMWin->iEphCsr, regCPeer); for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ - sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum); } - sqlite3VdbeAddOp3(v, OP_SeekGE, csr, lblBrk, pMWin->regStartRowid); + tdsqlite3VdbeAddOp3(v, OP_SeekGE, csr, lblBrk, pMWin->regStartRowid); VdbeCoverage(v); - addrNext = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp2(v, OP_Rowid, csr, regRowid); - sqlite3VdbeAddOp3(v, OP_Gt, pMWin->regEndRowid, lblBrk, regRowid); + addrNext = tdsqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeAddOp2(v, OP_Rowid, csr, regRowid); + tdsqlite3VdbeAddOp3(v, OP_Gt, pMWin->regEndRowid, lblBrk, regRowid); VdbeCoverageNeverNull(v); if( pMWin->eExclude==TK_CURRENT ){ - sqlite3VdbeAddOp3(v, OP_Eq, regCRowid, lblNext, regRowid); + tdsqlite3VdbeAddOp3(v, OP_Eq, regCRowid, lblNext, regRowid); VdbeCoverageNeverNull(v); }else if( pMWin->eExclude!=TK_NO ){ int addr; @@ -155546,37 +155546,37 @@ static void windowFullScan(WindowCodeArg *p){ KeyInfo *pKeyInfo = 0; if( pMWin->pOrderBy ){ - pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pMWin->pOrderBy, 0, 0); + pKeyInfo = tdsqlite3KeyInfoFromExprList(pParse, pMWin->pOrderBy, 0, 0); } if( pMWin->eExclude==TK_TIES ){ - addrEq = sqlite3VdbeAddOp3(v, OP_Eq, regCRowid, 0, regRowid); + addrEq = tdsqlite3VdbeAddOp3(v, OP_Eq, regCRowid, 0, regRowid); VdbeCoverageNeverNull(v); } if( pKeyInfo ){ windowReadPeerValues(p, csr, regPeer); - sqlite3VdbeAddOp3(v, OP_Compare, regPeer, regCPeer, nPeer); - sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); - addr = sqlite3VdbeCurrentAddr(v)+1; - sqlite3VdbeAddOp3(v, OP_Jump, addr, lblNext, addr); + tdsqlite3VdbeAddOp3(v, OP_Compare, regPeer, regCPeer, nPeer); + tdsqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); + addr = tdsqlite3VdbeCurrentAddr(v)+1; + tdsqlite3VdbeAddOp3(v, OP_Jump, addr, lblNext, addr); VdbeCoverageEqNe(v); }else{ - sqlite3VdbeAddOp2(v, OP_Goto, 0, lblNext); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, lblNext); } - if( addrEq ) sqlite3VdbeJumpHere(v, addrEq); + if( addrEq ) tdsqlite3VdbeJumpHere(v, addrEq); } windowAggStep(p, pMWin, csr, 0, p->regArg); - sqlite3VdbeResolveLabel(v, lblNext); - sqlite3VdbeAddOp2(v, OP_Next, csr, addrNext); + tdsqlite3VdbeResolveLabel(v, lblNext); + tdsqlite3VdbeAddOp2(v, OP_Next, csr, addrNext); VdbeCoverage(v); - sqlite3VdbeJumpHere(v, addrNext-1); - sqlite3VdbeJumpHere(v, addrNext+1); - sqlite3ReleaseTempReg(pParse, regRowid); - sqlite3ReleaseTempReg(pParse, regCRowid); + tdsqlite3VdbeJumpHere(v, addrNext-1); + tdsqlite3VdbeJumpHere(v, addrNext+1); + tdsqlite3ReleaseTempReg(pParse, regRowid); + tdsqlite3ReleaseTempReg(pParse, regCRowid); if( nPeer ){ - sqlite3ReleaseTempRange(pParse, regPeer, nPeer); - sqlite3ReleaseTempRange(pParse, regCPeer, nPeer); + tdsqlite3ReleaseTempRange(pParse, regPeer, nPeer); + tdsqlite3ReleaseTempRange(pParse, regCPeer, nPeer); } windowAggFinal(p, 1); @@ -155612,58 +155612,58 @@ static void windowReturnOneRow(WindowCodeArg *p){ || pFunc->zName==first_valueName ){ int csr = pWin->csrApp; - int lbl = sqlite3VdbeMakeLabel(pParse); - int tmpReg = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult); + int lbl = tdsqlite3VdbeMakeLabel(pParse); + int tmpReg = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult); if( pFunc->zName==nth_valueName ){ - sqlite3VdbeAddOp3(v, OP_Column,pMWin->iEphCsr,pWin->iArgCol+1,tmpReg); + tdsqlite3VdbeAddOp3(v, OP_Column,pMWin->iEphCsr,pWin->iArgCol+1,tmpReg); windowCheckValue(pParse, tmpReg, 2); }else{ - sqlite3VdbeAddOp2(v, OP_Integer, 1, tmpReg); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, tmpReg); } - sqlite3VdbeAddOp3(v, OP_Add, tmpReg, pWin->regApp, tmpReg); - sqlite3VdbeAddOp3(v, OP_Gt, pWin->regApp+1, lbl, tmpReg); + tdsqlite3VdbeAddOp3(v, OP_Add, tmpReg, pWin->regApp, tmpReg); + tdsqlite3VdbeAddOp3(v, OP_Gt, pWin->regApp+1, lbl, tmpReg); VdbeCoverageNeverNull(v); - sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, 0, tmpReg); + tdsqlite3VdbeAddOp3(v, OP_SeekRowid, csr, 0, tmpReg); VdbeCoverageNeverTaken(v); - sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult); - sqlite3VdbeResolveLabel(v, lbl); - sqlite3ReleaseTempReg(pParse, tmpReg); + tdsqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult); + tdsqlite3VdbeResolveLabel(v, lbl); + tdsqlite3ReleaseTempReg(pParse, tmpReg); } else if( pFunc->zName==leadName || pFunc->zName==lagName ){ int nArg = pWin->pOwner->x.pList->nExpr; int csr = pWin->csrApp; - int lbl = sqlite3VdbeMakeLabel(pParse); - int tmpReg = sqlite3GetTempReg(pParse); + int lbl = tdsqlite3VdbeMakeLabel(pParse); + int tmpReg = tdsqlite3GetTempReg(pParse); int iEph = pMWin->iEphCsr; if( nArg<3 ){ - sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult); }else{ - sqlite3VdbeAddOp3(v, OP_Column, iEph,pWin->iArgCol+2,pWin->regResult); + tdsqlite3VdbeAddOp3(v, OP_Column, iEph,pWin->iArgCol+2,pWin->regResult); } - sqlite3VdbeAddOp2(v, OP_Rowid, iEph, tmpReg); + tdsqlite3VdbeAddOp2(v, OP_Rowid, iEph, tmpReg); if( nArg<2 ){ int val = (pFunc->zName==leadName ? 1 : -1); - sqlite3VdbeAddOp2(v, OP_AddImm, tmpReg, val); + tdsqlite3VdbeAddOp2(v, OP_AddImm, tmpReg, val); }else{ int op = (pFunc->zName==leadName ? OP_Add : OP_Subtract); - int tmpReg2 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_Column, iEph, pWin->iArgCol+1, tmpReg2); - sqlite3VdbeAddOp3(v, op, tmpReg2, tmpReg, tmpReg); - sqlite3ReleaseTempReg(pParse, tmpReg2); + int tmpReg2 = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp3(v, OP_Column, iEph, pWin->iArgCol+1, tmpReg2); + tdsqlite3VdbeAddOp3(v, op, tmpReg2, tmpReg, tmpReg); + tdsqlite3ReleaseTempReg(pParse, tmpReg2); } - sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, lbl, tmpReg); + tdsqlite3VdbeAddOp3(v, OP_SeekRowid, csr, lbl, tmpReg); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult); - sqlite3VdbeResolveLabel(v, lbl); - sqlite3ReleaseTempReg(pParse, tmpReg); + tdsqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult); + tdsqlite3VdbeResolveLabel(v, lbl); + tdsqlite3ReleaseTempReg(pParse, tmpReg); } } } - sqlite3VdbeAddOp2(v, OP_Gosub, p->regGosub, p->addrGosub); + tdsqlite3VdbeAddOp2(v, OP_Gosub, p->regGosub, p->addrGosub); } /* @@ -155673,24 +155673,24 @@ static void windowReturnOneRow(WindowCodeArg *p){ ** in the list. */ static int windowInitAccum(Parse *pParse, Window *pMWin){ - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); int regArg; int nArg = 0; Window *pWin; for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ FuncDef *pFunc = pWin->pFunc; - sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum); + tdsqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum); nArg = MAX(nArg, windowArgCount(pWin)); if( pMWin->regStartRowid==0 ){ if( pFunc->zName==nth_valueName || pFunc->zName==first_valueName ){ - sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp); - sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1); } if( (pFunc->funcFlags & SQLITE_FUNC_MINMAX) && pWin->csrApp ){ assert( pWin->eStart!=TK_UNBOUNDED ); - sqlite3VdbeAddOp1(v, OP_ResetSorter, pWin->csrApp); - sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1); + tdsqlite3VdbeAddOp1(v, OP_ResetSorter, pWin->csrApp); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1); } } } @@ -155736,19 +155736,19 @@ static void windowIfNewPeer( int regOld, /* First in array of old values */ int addr /* Jump here */ ){ - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); if( pOrderBy ){ int nVal = pOrderBy->nExpr; - KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pOrderBy, 0, 0); - sqlite3VdbeAddOp3(v, OP_Compare, regOld, regNew, nVal); - sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); - sqlite3VdbeAddOp3(v, OP_Jump, - sqlite3VdbeCurrentAddr(v)+1, addr, sqlite3VdbeCurrentAddr(v)+1 + KeyInfo *pKeyInfo = tdsqlite3KeyInfoFromExprList(pParse, pOrderBy, 0, 0); + tdsqlite3VdbeAddOp3(v, OP_Compare, regOld, regNew, nVal); + tdsqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); + tdsqlite3VdbeAddOp3(v, OP_Jump, + tdsqlite3VdbeCurrentAddr(v)+1, addr, tdsqlite3VdbeCurrentAddr(v)+1 ); VdbeCoverageEqNe(v); - sqlite3VdbeAddOp3(v, OP_Copy, regNew, regOld, nVal-1); + tdsqlite3VdbeAddOp3(v, OP_Copy, regNew, regOld, nVal-1); }else{ - sqlite3VdbeAddOp2(v, OP_Goto, 0, addr); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, addr); } } @@ -155784,10 +155784,10 @@ static void windowCodeRangeTest( int lbl /* Jump destination if condition is true */ ){ Parse *pParse = p->pParse; - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); ExprList *pOrderBy = p->pMWin->pOrderBy; /* ORDER BY clause for window */ - int reg1 = sqlite3GetTempReg(pParse); /* Reg. for csr1.peerVal+regVal */ - int reg2 = sqlite3GetTempReg(pParse); /* Reg. for csr2.peerVal */ + int reg1 = tdsqlite3GetTempReg(pParse); /* Reg. for csr1.peerVal+regVal */ + int reg2 = tdsqlite3GetTempReg(pParse); /* Reg. for csr2.peerVal */ int regString = ++pParse->nMem; /* Reg. for constant value '' */ int arith = OP_Add; /* OP_Add or OP_Subtract */ int addrGe; /* Jump destination */ @@ -155825,11 +155825,11 @@ static void windowCodeRangeTest( ** the add/subtract is skipped for these, as required. If reg1 is a NULL, ** then the arithmetic is performed, but since adding or subtracting from ** NULL is always NULL anyway, this case is handled as required too. */ - sqlite3VdbeAddOp4(v, OP_String8, 0, regString, 0, "", P4_STATIC); - addrGe = sqlite3VdbeAddOp3(v, OP_Ge, regString, 0, reg1); + tdsqlite3VdbeAddOp4(v, OP_String8, 0, regString, 0, "", P4_STATIC); + addrGe = tdsqlite3VdbeAddOp3(v, OP_Ge, regString, 0, reg1); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, arith, regVal, reg1, reg1); - sqlite3VdbeJumpHere(v, addrGe); + tdsqlite3VdbeAddOp3(v, arith, regVal, reg1, reg1); + tdsqlite3VdbeJumpHere(v, addrGe); /* If the BIGNULL flag is set for the ORDER BY, then it is required to ** consider NULL values to be larger than all other values, instead of @@ -155852,52 +155852,52 @@ static void windowCodeRangeTest( ** block. */ if( pOrderBy->a[0].sortFlags & KEYINFO_ORDER_BIGNULL ){ /* This block runs if reg1 contains a NULL. */ - int addr = sqlite3VdbeAddOp1(v, OP_NotNull, reg1); VdbeCoverage(v); + int addr = tdsqlite3VdbeAddOp1(v, OP_NotNull, reg1); VdbeCoverage(v); switch( op ){ case OP_Ge: - sqlite3VdbeAddOp2(v, OP_Goto, 0, lbl); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, lbl); break; case OP_Gt: - sqlite3VdbeAddOp2(v, OP_NotNull, reg2, lbl); + tdsqlite3VdbeAddOp2(v, OP_NotNull, reg2, lbl); VdbeCoverage(v); break; case OP_Le: - sqlite3VdbeAddOp2(v, OP_IsNull, reg2, lbl); + tdsqlite3VdbeAddOp2(v, OP_IsNull, reg2, lbl); VdbeCoverage(v); break; default: assert( op==OP_Lt ); /* no-op */ break; } - sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+3); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, tdsqlite3VdbeCurrentAddr(v)+3); /* This block runs if reg1 is not NULL, but reg2 is. */ - sqlite3VdbeJumpHere(v, addr); - sqlite3VdbeAddOp2(v, OP_IsNull, reg2, lbl); VdbeCoverage(v); + tdsqlite3VdbeJumpHere(v, addr); + tdsqlite3VdbeAddOp2(v, OP_IsNull, reg2, lbl); VdbeCoverage(v); if( op==OP_Gt || op==OP_Ge ){ - sqlite3VdbeChangeP2(v, -1, sqlite3VdbeCurrentAddr(v)+1); + tdsqlite3VdbeChangeP2(v, -1, tdsqlite3VdbeCurrentAddr(v)+1); } } /* Compare registers reg2 and reg1, taking the jump if required. Note that ** control skips over this test if the BIGNULL flag is set and either ** reg1 or reg2 contain a NULL value. */ - sqlite3VdbeAddOp3(v, op, reg2, lbl, reg1); VdbeCoverage(v); - sqlite3VdbeChangeP5(v, SQLITE_NULLEQ); + tdsqlite3VdbeAddOp3(v, op, reg2, lbl, reg1); VdbeCoverage(v); + tdsqlite3VdbeChangeP5(v, SQLITE_NULLEQ); assert( op==OP_Ge || op==OP_Gt || op==OP_Lt || op==OP_Le ); testcase(op==OP_Ge); VdbeCoverageIf(v, op==OP_Ge); testcase(op==OP_Lt); VdbeCoverageIf(v, op==OP_Lt); testcase(op==OP_Le); VdbeCoverageIf(v, op==OP_Le); testcase(op==OP_Gt); VdbeCoverageIf(v, op==OP_Gt); - sqlite3ReleaseTempReg(pParse, reg1); - sqlite3ReleaseTempReg(pParse, reg2); + tdsqlite3ReleaseTempReg(pParse, reg1); + tdsqlite3ReleaseTempReg(pParse, reg2); VdbeModuleComment((v, "CodeRangeTest: end")); } /* -** Helper function for sqlite3WindowCodeStep(). Each call to this function +** Helper function for tdsqlite3WindowCodeStep(). Each call to this function ** generates VM code for a single RETURN_ROW, AGGSTEP or AGGINVERSE -** operation. Refer to the header comment for sqlite3WindowCodeStep() for +** operation. Refer to the header comment for tdsqlite3WindowCodeStep() for ** details. */ static int windowCodeOp( @@ -155914,7 +155914,7 @@ static int windowCodeOp( int addrContinue = 0; int bPeer = (pMWin->eFrmType!=TK_ROWS); - int lblDone = sqlite3VdbeMakeLabel(pParse); + int lblDone = tdsqlite3VdbeMakeLabel(pParse); int addrNextRange = 0; /* Special case - WINDOW_AGGINVERSE is always a no-op if the frame @@ -155926,7 +155926,7 @@ static int windowCodeOp( if( regCountdown>0 ){ if( pMWin->eFrmType==TK_RANGE ){ - addrNextRange = sqlite3VdbeCurrentAddr(v); + addrNextRange = tdsqlite3VdbeCurrentAddr(v); assert( op==WINDOW_AGGINVERSE || op==WINDOW_AGGSTEP ); if( op==WINDOW_AGGINVERSE ){ if( pMWin->eStart==TK_FOLLOWING ){ @@ -155944,7 +155944,7 @@ static int windowCodeOp( ); } }else{ - sqlite3VdbeAddOp3(v, OP_IfPos, regCountdown, lblDone, 1); + tdsqlite3VdbeAddOp3(v, OP_IfPos, regCountdown, lblDone, 1); VdbeCoverage(v); } } @@ -155952,7 +155952,7 @@ static int windowCodeOp( if( op==WINDOW_RETURN_ROW && pMWin->regStartRowid==0 ){ windowAggFinal(p, 0); } - addrContinue = sqlite3VdbeCurrentAddr(v); + addrContinue = tdsqlite3VdbeCurrentAddr(v); /* If this is a (RANGE BETWEEN a FOLLOWING AND b FOLLOWING) or ** (RANGE BETWEEN b PRECEDING AND a PRECEDING) frame, ensure the @@ -155961,14 +155961,14 @@ static int windowCodeOp( if( pMWin->eStart==pMWin->eEnd && regCountdown && pMWin->eFrmType==TK_RANGE && op==WINDOW_AGGINVERSE ){ - int regRowid1 = sqlite3GetTempReg(pParse); - int regRowid2 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp2(v, OP_Rowid, p->start.csr, regRowid1); - sqlite3VdbeAddOp2(v, OP_Rowid, p->end.csr, regRowid2); - sqlite3VdbeAddOp3(v, OP_Ge, regRowid2, lblDone, regRowid1); + int regRowid1 = tdsqlite3GetTempReg(pParse); + int regRowid2 = tdsqlite3GetTempReg(pParse); + tdsqlite3VdbeAddOp2(v, OP_Rowid, p->start.csr, regRowid1); + tdsqlite3VdbeAddOp2(v, OP_Rowid, p->end.csr, regRowid2); + tdsqlite3VdbeAddOp3(v, OP_Ge, regRowid2, lblDone, regRowid1); VdbeCoverage(v); - sqlite3ReleaseTempReg(pParse, regRowid1); - sqlite3ReleaseTempReg(pParse, regRowid2); + tdsqlite3ReleaseTempReg(pParse, regRowid1); + tdsqlite3ReleaseTempReg(pParse, regRowid2); assert( pMWin->eStart==TK_PRECEDING || pMWin->eStart==TK_FOLLOWING ); } @@ -155984,7 +155984,7 @@ static int windowCodeOp( reg = p->start.reg; if( pMWin->regStartRowid ){ assert( pMWin->regEndRowid ); - sqlite3VdbeAddOp2(v, OP_AddImm, pMWin->regStartRowid, 1); + tdsqlite3VdbeAddOp2(v, OP_AddImm, pMWin->regStartRowid, 1); }else{ windowAggStep(p, pMWin, csr, 1, p->regArg); } @@ -155996,7 +155996,7 @@ static int windowCodeOp( reg = p->end.reg; if( pMWin->regStartRowid ){ assert( pMWin->regEndRowid ); - sqlite3VdbeAddOp2(v, OP_AddImm, pMWin->regEndRowid, 1); + tdsqlite3VdbeAddOp2(v, OP_AddImm, pMWin->regEndRowid, 1); }else{ windowAggStep(p, pMWin, csr, 0, p->regArg); } @@ -156004,34 +156004,34 @@ static int windowCodeOp( } if( op==p->eDelete ){ - sqlite3VdbeAddOp1(v, OP_Delete, csr); - sqlite3VdbeChangeP5(v, OPFLAG_SAVEPOSITION); + tdsqlite3VdbeAddOp1(v, OP_Delete, csr); + tdsqlite3VdbeChangeP5(v, OPFLAG_SAVEPOSITION); } if( jumpOnEof ){ - sqlite3VdbeAddOp2(v, OP_Next, csr, sqlite3VdbeCurrentAddr(v)+2); + tdsqlite3VdbeAddOp2(v, OP_Next, csr, tdsqlite3VdbeCurrentAddr(v)+2); VdbeCoverage(v); - ret = sqlite3VdbeAddOp0(v, OP_Goto); + ret = tdsqlite3VdbeAddOp0(v, OP_Goto); }else{ - sqlite3VdbeAddOp2(v, OP_Next, csr, sqlite3VdbeCurrentAddr(v)+1+bPeer); + tdsqlite3VdbeAddOp2(v, OP_Next, csr, tdsqlite3VdbeCurrentAddr(v)+1+bPeer); VdbeCoverage(v); if( bPeer ){ - sqlite3VdbeAddOp2(v, OP_Goto, 0, lblDone); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, lblDone); } } if( bPeer ){ int nReg = (pMWin->pOrderBy ? pMWin->pOrderBy->nExpr : 0); - int regTmp = (nReg ? sqlite3GetTempRange(pParse, nReg) : 0); + int regTmp = (nReg ? tdsqlite3GetTempRange(pParse, nReg) : 0); windowReadPeerValues(p, csr, regTmp); windowIfNewPeer(pParse, pMWin->pOrderBy, regTmp, reg, addrContinue); - sqlite3ReleaseTempRange(pParse, regTmp, nReg); + tdsqlite3ReleaseTempRange(pParse, regTmp, nReg); } if( addrNextRange ){ - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrNextRange); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, addrNextRange); } - sqlite3VdbeResolveLabel(v, lblDone); + tdsqlite3VdbeResolveLabel(v, lblDone); return ret; } @@ -156041,24 +156041,24 @@ static int windowCodeOp( ** third argument. Set the Window.pOwner field of the new object to ** pOwner. */ -SQLITE_PRIVATE Window *sqlite3WindowDup(sqlite3 *db, Expr *pOwner, Window *p){ +SQLITE_PRIVATE Window *tdsqlite3WindowDup(tdsqlite3 *db, Expr *pOwner, Window *p){ Window *pNew = 0; if( ALWAYS(p) ){ - pNew = sqlite3DbMallocZero(db, sizeof(Window)); + pNew = tdsqlite3DbMallocZero(db, sizeof(Window)); if( pNew ){ - pNew->zName = sqlite3DbStrDup(db, p->zName); - pNew->zBase = sqlite3DbStrDup(db, p->zBase); - pNew->pFilter = sqlite3ExprDup(db, p->pFilter, 0); + pNew->zName = tdsqlite3DbStrDup(db, p->zName); + pNew->zBase = tdsqlite3DbStrDup(db, p->zBase); + pNew->pFilter = tdsqlite3ExprDup(db, p->pFilter, 0); pNew->pFunc = p->pFunc; - pNew->pPartition = sqlite3ExprListDup(db, p->pPartition, 0); - pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy, 0); + pNew->pPartition = tdsqlite3ExprListDup(db, p->pPartition, 0); + pNew->pOrderBy = tdsqlite3ExprListDup(db, p->pOrderBy, 0); pNew->eFrmType = p->eFrmType; pNew->eEnd = p->eEnd; pNew->eStart = p->eStart; pNew->eExclude = p->eExclude; pNew->regResult = p->regResult; - pNew->pStart = sqlite3ExprDup(db, p->pStart, 0); - pNew->pEnd = sqlite3ExprDup(db, p->pEnd, 0); + pNew->pStart = tdsqlite3ExprDup(db, p->pStart, 0); + pNew->pEnd = tdsqlite3ExprDup(db, p->pEnd, 0); pNew->pOwner = pOwner; pNew->bImplicitFrame = p->bImplicitFrame; } @@ -156070,13 +156070,13 @@ SQLITE_PRIVATE Window *sqlite3WindowDup(sqlite3 *db, Expr *pOwner, Window *p){ ** Return a copy of the linked list of Window objects passed as the ** second argument. */ -SQLITE_PRIVATE Window *sqlite3WindowListDup(sqlite3 *db, Window *p){ +SQLITE_PRIVATE Window *tdsqlite3WindowListDup(tdsqlite3 *db, Window *p){ Window *pWin; Window *pRet = 0; Window **pp = &pRet; for(pWin=p; pWin; pWin=pWin->pNextWin){ - *pp = sqlite3WindowDup(db, 0, pWin); + *pp = tdsqlite3WindowDup(db, 0, pWin); if( *pp==0 ) break; pp = &((*pp)->pNextWin); } @@ -156094,22 +156094,22 @@ SQLITE_PRIVATE Window *sqlite3WindowListDup(sqlite3 *db, Window *p){ */ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ int ret = 0; - sqlite3 *db = pParse->db; - sqlite3_value *pVal = 0; - sqlite3ValueFromExpr(db, pExpr, db->enc, SQLITE_AFF_NUMERIC, &pVal); - if( pVal && sqlite3_value_int(pVal)>0 ){ + tdsqlite3 *db = pParse->db; + tdsqlite3_value *pVal = 0; + tdsqlite3ValueFromExpr(db, pExpr, db->enc, SQLITE_AFF_NUMERIC, &pVal); + if( pVal && tdsqlite3_value_int(pVal)>0 ){ ret = 1; } - sqlite3ValueFree(pVal); + tdsqlite3ValueFree(pVal); return ret; } /* -** sqlite3WhereBegin() has already been called for the SELECT statement +** tdsqlite3WhereBegin() has already been called for the SELECT statement ** passed as the second argument when this function is invoked. It generates ** code to populate the Window.regResult register for each window function ** and invoke the sub-routine at instruction addrGosub once for each row. -** sqlite3WhereEnd() is always called before returning. +** tdsqlite3WhereEnd() is always called before returning. ** ** This function handles several different types of window frames, which ** require slightly different processing. The following pseudo code is @@ -156119,7 +156119,7 @@ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ ** ** Other window frame types use variants of the following: ** -** ... loop started by sqlite3WhereBegin() ... +** ... loop started by tdsqlite3WhereBegin() ... ** if( new partition ){ ** Gosub flush ** } @@ -156161,7 +156161,7 @@ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ ** ** AGGSTEP: invoke the aggregate xStep() function for each window function ** with arguments read from the current row of cursor csrEnd, then -** step cursor csrEnd forward one row (i.e. sqlite3BtreeNext()). +** step cursor csrEnd forward one row (i.e. tdsqlite3BtreeNext()). ** ** RETURN_ROW: return a row to the caller based on the contents of the ** current row of csrCurrent and the current state of all @@ -156181,7 +156181,7 @@ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ ** ** ROWS BETWEEN PRECEDING AND PRECEDING ** -** ... loop started by sqlite3WhereBegin() ... +** ... loop started by tdsqlite3WhereBegin() ... ** if( new partition ){ ** Gosub flush ** } @@ -156209,7 +156209,7 @@ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ ** ** ROWS BETWEEN FOLLOWING AND FOLLOWING ** -** ... loop started by sqlite3WhereBegin() ... +** ... loop started by tdsqlite3WhereBegin() ... ** if( new partition ){ ** Gosub flush ** } @@ -156253,7 +156253,7 @@ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ ** ** ROWS BETWEEN FOLLOWING AND UNBOUNDED FOLLOWING ** -** ... loop started by sqlite3WhereBegin() ... +** ... loop started by tdsqlite3WhereBegin() ... ** if( new partition ){ ** Gosub flush ** } @@ -156287,7 +156287,7 @@ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ ** To handle this case, the pseudo-code programs depicted above are modified ** slightly to be: ** -** ... loop started by sqlite3WhereBegin() ... +** ... loop started by tdsqlite3WhereBegin() ... ** if( new partition ){ ** Gosub flush ** } @@ -156304,7 +156304,7 @@ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ ** ... ** ** The new "continue" statement in the above jumps to the next iteration -** of the outer loop - the one started by sqlite3WhereBegin(). +** of the outer loop - the one started by tdsqlite3WhereBegin(). ** ** The various GROUPS cases are implemented using the same patterns as ** ROWS. The VM code is modified slightly so that: @@ -156313,7 +156313,7 @@ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ ** added to the ephemeral table is the start of a new group. In ** other words, it becomes: ** -** ... loop started by sqlite3WhereBegin() ... +** ... loop started by tdsqlite3WhereBegin() ... ** if( new partition ){ ** Gosub flush ** } @@ -156338,7 +156338,7 @@ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ ** ** RANGE BETWEEN PRECEDING AND FOLLOWING ** -** ... loop started by sqlite3WhereBegin() ... +** ... loop started by tdsqlite3WhereBegin() ... ** if( new partition ){ ** Gosub flush ** } @@ -156374,7 +156374,7 @@ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ ** ** RANGE BETWEEN PRECEDING AND PRECEDING ** -** ... loop started by sqlite3WhereBegin() ... +** ... loop started by tdsqlite3WhereBegin() ... ** if( new partition ){ ** Gosub flush ** } @@ -156404,7 +156404,7 @@ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ ** ** RANGE BETWEEN FOLLOWING AND FOLLOWING ** -** ... loop started by sqlite3WhereBegin() ... +** ... loop started by tdsqlite3WhereBegin() ... ** if( new partition ){ ** Gosub flush ** } @@ -156439,16 +156439,16 @@ static int windowExprGtZero(Parse *pParse, Expr *pExpr){ ** The text above leaves out many details. Refer to the code and comments ** below for a more complete picture. */ -SQLITE_PRIVATE void sqlite3WindowCodeStep( +SQLITE_PRIVATE void tdsqlite3WindowCodeStep( Parse *pParse, /* Parse context */ Select *p, /* Rewritten SELECT statement */ - WhereInfo *pWInfo, /* Context returned by sqlite3WhereBegin() */ + WhereInfo *pWInfo, /* Context returned by tdsqlite3WhereBegin() */ int regGosub, /* Register for OP_Gosub */ int addrGosub /* OP_Gosub here to return each row */ ){ Window *pMWin = p->pWin; ExprList *pOrderBy = pMWin->pOrderBy; - Vdbe *v = sqlite3GetVdbe(pParse); + Vdbe *v = tdsqlite3GetVdbe(pParse); int csrWrite; /* Cursor used to write to eph. table */ int csrInput = p->pSrc->a[0].iCursor; /* Cursor of sub-select */ int nInput = p->pSrc->a[0].pTab->nCol; /* Number of cols returned by sub */ @@ -156464,7 +156464,7 @@ SQLITE_PRIVATE void sqlite3WindowCodeStep( int regPeer = 0; /* Peer values for current row */ int regFlushPart = 0; /* Register for "Gosub flush_partition" */ WindowCodeArg s; /* Context object for sub-routines */ - int lblWhereEnd; /* Label just before sqlite3WhereEnd() code */ + int lblWhereEnd; /* Label just before tdsqlite3WhereEnd() code */ int regStart = 0; /* Value of PRECEDING */ int regEnd = 0; /* Value of FOLLOWING */ @@ -156479,7 +156479,7 @@ SQLITE_PRIVATE void sqlite3WindowCodeStep( || pMWin->eExclude==TK_NO ); - lblWhereEnd = sqlite3VdbeMakeLabel(pParse); + lblWhereEnd = tdsqlite3VdbeMakeLabel(pParse); /* Fill in the context object */ memset(&s, 0, sizeof(WindowCodeArg)); @@ -156560,9 +156560,9 @@ SQLITE_PRIVATE void sqlite3WindowCodeStep( ** into an array of registers starting at regNew. Assemble them into ** a record in register regRecord. */ for(iInput=0; iInputpPartition; int nPart = pPart->nExpr; int regNewPart = regNew + pMWin->nBufferCol; - KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pPart, 0, 0); + KeyInfo *pKeyInfo = tdsqlite3KeyInfoFromExprList(pParse, pPart, 0, 0); regFlushPart = ++pParse->nMem; - addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPart, pMWin->regPart, nPart); - sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); - sqlite3VdbeAddOp3(v, OP_Jump, addr+2, addr+4, addr+2); + addr = tdsqlite3VdbeAddOp3(v, OP_Compare, regNewPart, pMWin->regPart, nPart); + tdsqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); + tdsqlite3VdbeAddOp3(v, OP_Jump, addr+2, addr+4, addr+2); VdbeCoverageEqNe(v); - addrGosubFlush = sqlite3VdbeAddOp1(v, OP_Gosub, regFlushPart); + addrGosubFlush = tdsqlite3VdbeAddOp1(v, OP_Gosub, regFlushPart); VdbeComment((v, "call flush_partition")); - sqlite3VdbeAddOp3(v, OP_Copy, regNewPart, pMWin->regPart, nPart-1); + tdsqlite3VdbeAddOp3(v, OP_Copy, regNewPart, pMWin->regPart, nPart-1); } /* Insert the new row into the ephemeral table */ - sqlite3VdbeAddOp2(v, OP_NewRowid, csrWrite, regRowid); - sqlite3VdbeAddOp3(v, OP_Insert, csrWrite, regRecord, regRowid); - addrNe = sqlite3VdbeAddOp3(v, OP_Ne, pMWin->regOne, 0, regRowid); + tdsqlite3VdbeAddOp2(v, OP_NewRowid, csrWrite, regRowid); + tdsqlite3VdbeAddOp3(v, OP_Insert, csrWrite, regRecord, regRowid); + addrNe = tdsqlite3VdbeAddOp3(v, OP_Ne, pMWin->regOne, 0, regRowid); VdbeCoverageNeverNull(v); /* This block is run for the first row of each partition */ s.regArg = windowInitAccum(pParse, pMWin); if( regStart ){ - sqlite3ExprCode(pParse, pMWin->pStart, regStart); + tdsqlite3ExprCode(pParse, pMWin->pStart, regStart); windowCheckValue(pParse, regStart, 0 + (pMWin->eFrmType==TK_RANGE?3:0)); } if( regEnd ){ - sqlite3ExprCode(pParse, pMWin->pEnd, regEnd); + tdsqlite3ExprCode(pParse, pMWin->pEnd, regEnd); windowCheckValue(pParse, regEnd, 1 + (pMWin->eFrmType==TK_RANGE?3:0)); } if( pMWin->eFrmType!=TK_RANGE && pMWin->eStart==pMWin->eEnd && regStart ){ int op = ((pMWin->eStart==TK_FOLLOWING) ? OP_Ge : OP_Le); - int addrGe = sqlite3VdbeAddOp3(v, op, regStart, 0, regEnd); + int addrGe = tdsqlite3VdbeAddOp3(v, op, regStart, 0, regEnd); VdbeCoverageNeverNullIf(v, op==OP_Ge); /* NeverNull because bound */ VdbeCoverageNeverNullIf(v, op==OP_Le); /* values previously checked */ windowAggFinal(&s, 0); - sqlite3VdbeAddOp2(v, OP_Rewind, s.current.csr, 1); + tdsqlite3VdbeAddOp2(v, OP_Rewind, s.current.csr, 1); VdbeCoverageNeverTaken(v); windowReturnOneRow(&s); - sqlite3VdbeAddOp1(v, OP_ResetSorter, s.current.csr); - sqlite3VdbeAddOp2(v, OP_Goto, 0, lblWhereEnd); - sqlite3VdbeJumpHere(v, addrGe); + tdsqlite3VdbeAddOp1(v, OP_ResetSorter, s.current.csr); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, lblWhereEnd); + tdsqlite3VdbeJumpHere(v, addrGe); } if( pMWin->eStart==TK_FOLLOWING && pMWin->eFrmType!=TK_RANGE && regEnd ){ assert( pMWin->eEnd==TK_FOLLOWING ); - sqlite3VdbeAddOp3(v, OP_Subtract, regStart, regEnd, regStart); + tdsqlite3VdbeAddOp3(v, OP_Subtract, regStart, regEnd, regStart); } if( pMWin->eStart!=TK_UNBOUNDED ){ - sqlite3VdbeAddOp2(v, OP_Rewind, s.start.csr, 1); + tdsqlite3VdbeAddOp2(v, OP_Rewind, s.start.csr, 1); VdbeCoverageNeverTaken(v); } - sqlite3VdbeAddOp2(v, OP_Rewind, s.current.csr, 1); + tdsqlite3VdbeAddOp2(v, OP_Rewind, s.current.csr, 1); VdbeCoverageNeverTaken(v); - sqlite3VdbeAddOp2(v, OP_Rewind, s.end.csr, 1); + tdsqlite3VdbeAddOp2(v, OP_Rewind, s.end.csr, 1); VdbeCoverageNeverTaken(v); if( regPeer && pOrderBy ){ - sqlite3VdbeAddOp3(v, OP_Copy, regNewPeer, regPeer, pOrderBy->nExpr-1); - sqlite3VdbeAddOp3(v, OP_Copy, regPeer, s.start.reg, pOrderBy->nExpr-1); - sqlite3VdbeAddOp3(v, OP_Copy, regPeer, s.current.reg, pOrderBy->nExpr-1); - sqlite3VdbeAddOp3(v, OP_Copy, regPeer, s.end.reg, pOrderBy->nExpr-1); + tdsqlite3VdbeAddOp3(v, OP_Copy, regNewPeer, regPeer, pOrderBy->nExpr-1); + tdsqlite3VdbeAddOp3(v, OP_Copy, regPeer, s.start.reg, pOrderBy->nExpr-1); + tdsqlite3VdbeAddOp3(v, OP_Copy, regPeer, s.current.reg, pOrderBy->nExpr-1); + tdsqlite3VdbeAddOp3(v, OP_Copy, regPeer, s.end.reg, pOrderBy->nExpr-1); } - sqlite3VdbeAddOp2(v, OP_Goto, 0, lblWhereEnd); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, lblWhereEnd); - sqlite3VdbeJumpHere(v, addrNe); + tdsqlite3VdbeJumpHere(v, addrNe); /* Beginning of the block executed for the second and subsequent rows. */ if( regPeer ){ @@ -156649,13 +156649,13 @@ SQLITE_PRIVATE void sqlite3WindowCodeStep( windowCodeOp(&s, WINDOW_AGGSTEP, 0, 0); if( pMWin->eEnd!=TK_UNBOUNDED ){ if( pMWin->eFrmType==TK_RANGE ){ - int lbl = sqlite3VdbeMakeLabel(pParse); - int addrNext = sqlite3VdbeCurrentAddr(v); + int lbl = tdsqlite3VdbeMakeLabel(pParse); + int addrNext = tdsqlite3VdbeCurrentAddr(v); windowCodeRangeTest(&s, OP_Ge, s.current.csr, regEnd, s.end.csr, lbl); windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 0); - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrNext); - sqlite3VdbeResolveLabel(v, lbl); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, addrNext); + tdsqlite3VdbeResolveLabel(v, lbl); }else{ windowCodeOp(&s, WINDOW_RETURN_ROW, regEnd, 0); windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); @@ -156674,40 +156674,40 @@ SQLITE_PRIVATE void sqlite3WindowCodeStep( if( pMWin->eEnd!=TK_UNBOUNDED ){ if( pMWin->eFrmType==TK_RANGE ){ int lbl = 0; - addr = sqlite3VdbeCurrentAddr(v); + addr = tdsqlite3VdbeCurrentAddr(v); if( regEnd ){ - lbl = sqlite3VdbeMakeLabel(pParse); + lbl = tdsqlite3VdbeMakeLabel(pParse); windowCodeRangeTest(&s, OP_Ge, s.current.csr, regEnd, s.end.csr, lbl); } windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 0); windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); if( regEnd ){ - sqlite3VdbeAddOp2(v, OP_Goto, 0, addr); - sqlite3VdbeResolveLabel(v, lbl); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, addr); + tdsqlite3VdbeResolveLabel(v, lbl); } }else{ if( regEnd ){ - addr = sqlite3VdbeAddOp3(v, OP_IfPos, regEnd, 0, 1); + addr = tdsqlite3VdbeAddOp3(v, OP_IfPos, regEnd, 0, 1); VdbeCoverage(v); } windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 0); windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); - if( regEnd ) sqlite3VdbeJumpHere(v, addr); + if( regEnd ) tdsqlite3VdbeJumpHere(v, addr); } } } /* End of the main input loop */ - sqlite3VdbeResolveLabel(v, lblWhereEnd); - sqlite3WhereEnd(pWInfo); + tdsqlite3VdbeResolveLabel(v, lblWhereEnd); + tdsqlite3WhereEnd(pWInfo); /* Fall through */ if( pMWin->pPartition ){ - addrInteger = sqlite3VdbeAddOp2(v, OP_Integer, 0, regFlushPart); - sqlite3VdbeJumpHere(v, addrGosubFlush); + addrInteger = tdsqlite3VdbeAddOp2(v, OP_Integer, 0, regFlushPart); + tdsqlite3VdbeJumpHere(v, addrGosubFlush); } - addrEmpty = sqlite3VdbeAddOp1(v, OP_Rewind, csrWrite); + addrEmpty = tdsqlite3VdbeAddOp1(v, OP_Rewind, csrWrite); VdbeCoverage(v); if( pMWin->eEnd==TK_PRECEDING ){ int bRPS = (pMWin->eStart==TK_PRECEDING && pMWin->eFrmType==TK_RANGE); @@ -156721,47 +156721,47 @@ SQLITE_PRIVATE void sqlite3WindowCodeStep( int addrBreak3; windowCodeOp(&s, WINDOW_AGGSTEP, 0, 0); if( pMWin->eFrmType==TK_RANGE ){ - addrStart = sqlite3VdbeCurrentAddr(v); + addrStart = tdsqlite3VdbeCurrentAddr(v); addrBreak2 = windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 1); addrBreak1 = windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 1); }else if( pMWin->eEnd==TK_UNBOUNDED ){ - addrStart = sqlite3VdbeCurrentAddr(v); + addrStart = tdsqlite3VdbeCurrentAddr(v); addrBreak1 = windowCodeOp(&s, WINDOW_RETURN_ROW, regStart, 1); addrBreak2 = windowCodeOp(&s, WINDOW_AGGINVERSE, 0, 1); }else{ assert( pMWin->eEnd==TK_FOLLOWING ); - addrStart = sqlite3VdbeCurrentAddr(v); + addrStart = tdsqlite3VdbeCurrentAddr(v); addrBreak1 = windowCodeOp(&s, WINDOW_RETURN_ROW, regEnd, 1); addrBreak2 = windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 1); } - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrStart); - sqlite3VdbeJumpHere(v, addrBreak2); - addrStart = sqlite3VdbeCurrentAddr(v); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, addrStart); + tdsqlite3VdbeJumpHere(v, addrBreak2); + addrStart = tdsqlite3VdbeCurrentAddr(v); addrBreak3 = windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 1); - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrStart); - sqlite3VdbeJumpHere(v, addrBreak1); - sqlite3VdbeJumpHere(v, addrBreak3); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, addrStart); + tdsqlite3VdbeJumpHere(v, addrBreak1); + tdsqlite3VdbeJumpHere(v, addrBreak3); }else{ int addrBreak; int addrStart; windowCodeOp(&s, WINDOW_AGGSTEP, 0, 0); - addrStart = sqlite3VdbeCurrentAddr(v); + addrStart = tdsqlite3VdbeCurrentAddr(v); addrBreak = windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 1); windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrStart); - sqlite3VdbeJumpHere(v, addrBreak); + tdsqlite3VdbeAddOp2(v, OP_Goto, 0, addrStart); + tdsqlite3VdbeJumpHere(v, addrBreak); } - sqlite3VdbeJumpHere(v, addrEmpty); + tdsqlite3VdbeJumpHere(v, addrEmpty); - sqlite3VdbeAddOp1(v, OP_ResetSorter, s.current.csr); + tdsqlite3VdbeAddOp1(v, OP_ResetSorter, s.current.csr); if( pMWin->pPartition ){ if( pMWin->regStartRowid ){ - sqlite3VdbeAddOp2(v, OP_Integer, 1, pMWin->regStartRowid); - sqlite3VdbeAddOp2(v, OP_Integer, 0, pMWin->regEndRowid); + tdsqlite3VdbeAddOp2(v, OP_Integer, 1, pMWin->regStartRowid); + tdsqlite3VdbeAddOp2(v, OP_Integer, 0, pMWin->regEndRowid); } - sqlite3VdbeChangeP1(v, addrInteger, sqlite3VdbeCurrentAddr(v)); - sqlite3VdbeAddOp1(v, OP_Return, regFlushPart); + tdsqlite3VdbeChangeP1(v, addrInteger, tdsqlite3VdbeCurrentAddr(v)); + tdsqlite3VdbeAddOp1(v, OP_Return, regFlushPart); } } @@ -156811,27 +156811,27 @@ SQLITE_PRIVATE void sqlite3WindowCodeStep( #define yytestcase(X) testcase(X) /* -** Indicate that sqlite3ParserFree() will never be called with a null +** Indicate that tdsqlite3ParserFree() will never be called with a null ** pointer. */ #define YYPARSEFREENEVERNULL 1 /* ** In the amalgamation, the parse.c file generated by lemon and the -** tokenize.c file are concatenated. In that case, sqlite3RunParser() +** tokenize.c file are concatenated. In that case, tdsqlite3RunParser() ** has access to the the size of the yyParser object and so the parser ** engine can be allocated from stack. In that case, only the -** sqlite3ParserInit() and sqlite3ParserFinalize() routines are invoked -** and the sqlite3ParserAlloc() and sqlite3ParserFree() routines can be +** tdsqlite3ParserInit() and tdsqlite3ParserFinalize() routines are invoked +** and the tdsqlite3ParserAlloc() and tdsqlite3ParserFree() routines can be ** omitted. */ #ifdef SQLITE_AMALGAMATION -# define sqlite3Parser_ENGINEALWAYSONSTACK 1 +# define tdsqlite3Parser_ENGINEALWAYSONSTACK 1 #endif /* ** Alternative datatype for the argument to the malloc() routine passed -** into sqlite3ParserAlloc(). The default is size_t. +** into tdsqlite3ParserAlloc(). The default is size_t. */ #define YYMALLOCARGTYPE u64 @@ -156853,7 +156853,7 @@ struct FrameBound { int eType; Expr *pExpr; }; ** shared across database connections. */ static void disableLookaside(Parse *pParse){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; pParse->disableLookaside++; DisableLookaside; } @@ -156877,7 +156877,7 @@ static void disableLookaside(Parse *pParse){ (mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT])>0 && cnt>mxSelect ){ - sqlite3ErrorMsg(pParse, "too many terms in compound SELECT"); + tdsqlite3ErrorMsg(pParse, "too many terms in compound SELECT"); } } } @@ -156888,7 +156888,7 @@ static void disableLookaside(Parse *pParse){ ** that created the expression. */ static Expr *tokenExpr(Parse *pParse, int op, Token t){ - Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1); + Expr *p = tdsqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1); if( p ){ /* memset(p, 0, sizeof(Expr)); */ p->op = (u8)op; @@ -156905,14 +156905,14 @@ static void disableLookaside(Parse *pParse){ p->u.zToken = (char*)&p[1]; memcpy(p->u.zToken, t.z, t.n); p->u.zToken[t.n] = 0; - if( sqlite3Isquote(p->u.zToken[0]) ){ - sqlite3DequoteExpr(p); + if( tdsqlite3Isquote(p->u.zToken[0]) ){ + tdsqlite3DequoteExpr(p); } #if SQLITE_MAX_EXPR_DEPTH>0 p->nHeight = 1; #endif if( IN_RENAME_OBJECT ){ - return (Expr*)sqlite3RenameTokenMap(pParse, (void*)p, &t); + return (Expr*)tdsqlite3RenameTokenMap(pParse, (void*)p, &t); } } return p; @@ -156922,10 +156922,10 @@ static void disableLookaside(Parse *pParse){ /* A routine to convert a binary TK_IS or TK_ISNOT expression into a ** unary TK_ISNULL or TK_NOTNULL expression. */ static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){ - sqlite3 *db = pParse->db; + tdsqlite3 *db = pParse->db; if( pA && pY && pY->op==TK_NULL && !IN_RENAME_OBJECT ){ pA->op = (u8)op; - sqlite3ExprDelete(db, pA->pRight); + tdsqlite3ExprDelete(db, pA->pRight); pA->pRight = 0; } } @@ -156942,14 +156942,14 @@ static void disableLookaside(Parse *pParse){ int hasCollate, int sortOrder ){ - ExprList *p = sqlite3ExprListAppend(pParse, pPrior, 0); + ExprList *p = tdsqlite3ExprListAppend(pParse, pPrior, 0); if( (hasCollate || sortOrder!=SQLITE_SO_UNDEFINED) && pParse->db->init.busy==0 ){ - sqlite3ErrorMsg(pParse, "syntax error after column name \"%.*s\"", + tdsqlite3ErrorMsg(pParse, "syntax error after column name \"%.*s\"", pIdToken->n, pIdToken->z); } - sqlite3ExprListSetName(pParse, p, pIdToken, 1); + tdsqlite3ExprListSetName(pParse, p, pIdToken, 1); return p; } @@ -156979,7 +156979,7 @@ static void disableLookaside(Parse *pParse){ ** YYACTIONTYPE is the data type used for "action codes" - numbers ** that indicate what to do in response to the next ** token. -** sqlite3ParserTOKENTYPE is the data type used for minor type for terminal +** tdsqlite3ParserTOKENTYPE is the data type used for minor type for terminal ** symbols. Background: A "minor type" is a semantic ** value associated with a terminal or non-terminal ** symbols. For example, for an "ID" terminal symbol, @@ -156990,16 +156990,16 @@ static void disableLookaside(Parse *pParse){ ** symbols. ** YYMINORTYPE is the data type used for all minor types. ** This is typically a union of many types, one of -** which is sqlite3ParserTOKENTYPE. The entry in the union +** which is tdsqlite3ParserTOKENTYPE. The entry in the union ** for terminal symbols is called "yy0". ** YYSTACKDEPTH is the maximum depth of the parser's stack. If ** zero the stack is dynamically sized using realloc() -** sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument -** sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument -** sqlite3ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter -** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser -** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser -** sqlite3ParserCTX_* As sqlite3ParserARG_ except for %extra_context +** tdsqlite3ParserARG_SDECL A static variable declaration for the %extra_argument +** tdsqlite3ParserARG_PDECL A parameter declaration for the %extra_argument +** tdsqlite3ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter +** tdsqlite3ParserARG_STORE Code to store %extra_argument into yypParser +** tdsqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser +** tdsqlite3ParserCTX_* As tdsqlite3ParserARG_ except for %extra_context ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. @@ -157022,10 +157022,10 @@ static void disableLookaside(Parse *pParse){ #define YYNOCODE 310 #define YYACTIONTYPE unsigned short int #define YYWILDCARD 100 -#define sqlite3ParserTOKENTYPE Token +#define tdsqlite3ParserTOKENTYPE Token typedef union { int yyinit; - sqlite3ParserTOKENTYPE yy0; + tdsqlite3ParserTOKENTYPE yy0; SrcList* yy47; u8 yy58; struct FrameBound yy77; @@ -157045,16 +157045,16 @@ typedef union { #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif -#define sqlite3ParserARG_SDECL -#define sqlite3ParserARG_PDECL -#define sqlite3ParserARG_PARAM -#define sqlite3ParserARG_FETCH -#define sqlite3ParserARG_STORE -#define sqlite3ParserCTX_SDECL Parse *pParse; -#define sqlite3ParserCTX_PDECL ,Parse *pParse -#define sqlite3ParserCTX_PARAM ,pParse -#define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; -#define sqlite3ParserCTX_STORE yypParser->pParse=pParse; +#define tdsqlite3ParserARG_SDECL +#define tdsqlite3ParserARG_PDECL +#define tdsqlite3ParserARG_PARAM +#define tdsqlite3ParserARG_FETCH +#define tdsqlite3ParserARG_STORE +#define tdsqlite3ParserCTX_SDECL Parse *pParse; +#define tdsqlite3ParserCTX_PDECL ,Parse *pParse +#define tdsqlite3ParserCTX_PARAM ,pParse +#define tdsqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; +#define tdsqlite3ParserCTX_STORE yypParser->pParse=pParse; #define YYFALLBACK 1 #define YYNSTATE 551 #define YYNRULE 385 @@ -157949,8 +157949,8 @@ struct yyParser { #ifndef YYNOERRORRECOVERY int yyerrcnt; /* Shifts left before out of the error */ #endif - sqlite3ParserARG_SDECL /* A place to hold %extra_argument */ - sqlite3ParserCTX_SDECL /* A place to hold %extra_context */ + tdsqlite3ParserARG_SDECL /* A place to hold %extra_argument */ + tdsqlite3ParserCTX_SDECL /* A place to hold %extra_context */ #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ @@ -157986,7 +157986,7 @@ static char *yyTracePrompt = 0; ** Outputs: ** None. */ -SQLITE_PRIVATE void sqlite3ParserTrace(FILE *TraceFILE, char *zTracePrompt){ +SQLITE_PRIVATE void tdsqlite3ParserTrace(FILE *TraceFILE, char *zTracePrompt){ yyTraceFILE = TraceFILE; yyTracePrompt = zTracePrompt; if( yyTraceFILE==0 ) yyTracePrompt = 0; @@ -158738,7 +158738,7 @@ static int yyGrowStack(yyParser *p){ #endif /* Datatype of the argument to the memory allocated passed as the -** second argument to sqlite3ParserAlloc() below. This can be changed by +** second argument to tdsqlite3ParserAlloc() below. This can be changed by ** putting an appropriate #define in the %include section of the input ** grammar. */ @@ -158748,9 +158748,9 @@ static int yyGrowStack(yyParser *p){ /* Initialize a new parser that has already been allocated. */ -SQLITE_PRIVATE void sqlite3ParserInit(void *yypRawParser sqlite3ParserCTX_PDECL){ +SQLITE_PRIVATE void tdsqlite3ParserInit(void *yypRawParser tdsqlite3ParserCTX_PDECL){ yyParser *yypParser = (yyParser*)yypRawParser; - sqlite3ParserCTX_STORE + tdsqlite3ParserCTX_STORE #ifdef YYTRACKMAXSTACKDEPTH yypParser->yyhwm = 0; #endif @@ -158774,7 +158774,7 @@ SQLITE_PRIVATE void sqlite3ParserInit(void *yypRawParser sqlite3ParserCTX_PDECL) #endif } -#ifndef sqlite3Parser_ENGINEALWAYSONSTACK +#ifndef tdsqlite3Parser_ENGINEALWAYSONSTACK /* ** This function allocates a new parser. ** The only argument is a pointer to a function which works like @@ -158785,18 +158785,18 @@ SQLITE_PRIVATE void sqlite3ParserInit(void *yypRawParser sqlite3ParserCTX_PDECL) ** ** Outputs: ** A pointer to a parser. This pointer is used in subsequent calls -** to sqlite3Parser and sqlite3ParserFree. +** to tdsqlite3Parser and tdsqlite3ParserFree. */ -SQLITE_PRIVATE void *sqlite3ParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) sqlite3ParserCTX_PDECL){ +SQLITE_PRIVATE void *tdsqlite3ParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) tdsqlite3ParserCTX_PDECL){ yyParser *yypParser; yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); if( yypParser ){ - sqlite3ParserCTX_STORE - sqlite3ParserInit(yypParser sqlite3ParserCTX_PARAM); + tdsqlite3ParserCTX_STORE + tdsqlite3ParserInit(yypParser tdsqlite3ParserCTX_PARAM); } return (void*)yypParser; } -#endif /* sqlite3Parser_ENGINEALWAYSONSTACK */ +#endif /* tdsqlite3Parser_ENGINEALWAYSONSTACK */ /* The following function deletes the "minor type" or semantic value @@ -158811,8 +158811,8 @@ static void yy_destructor( YYCODETYPE yymajor, /* Type code for object to destroy */ YYMINORTYPE *yypminor /* The object to be destroyed */ ){ - sqlite3ParserARG_FETCH - sqlite3ParserCTX_FETCH + tdsqlite3ParserARG_FETCH + tdsqlite3ParserCTX_FETCH switch( yymajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen @@ -158830,7 +158830,7 @@ static void yy_destructor( case 235: /* oneselect */ case 247: /* values */ { -sqlite3SelectDelete(pParse->db, (yypminor->yy539)); +tdsqlite3SelectDelete(pParse->db, (yypminor->yy539)); } break; case 211: /* term */ @@ -158845,7 +158845,7 @@ sqlite3SelectDelete(pParse->db, (yypminor->yy539)); case 288: /* key_opt */ case 302: /* filter_clause */ { -sqlite3ExprDelete(pParse->db, (yypminor->yy202)); +tdsqlite3ExprDelete(pParse->db, (yypminor->yy202)); } break; case 216: /* eidlist_opt */ @@ -158862,7 +158862,7 @@ sqlite3ExprDelete(pParse->db, (yypminor->yy202)); case 272: /* case_exprlist */ case 301: /* part_opt */ { -sqlite3ExprListDelete(pParse->db, (yypminor->yy242)); +tdsqlite3ExprListDelete(pParse->db, (yypminor->yy242)); } break; case 233: /* fullname */ @@ -158871,25 +158871,25 @@ sqlite3ExprListDelete(pParse->db, (yypminor->yy242)); case 252: /* stl_prefix */ case 258: /* xfullname */ { -sqlite3SrcListDelete(pParse->db, (yypminor->yy47)); +tdsqlite3SrcListDelete(pParse->db, (yypminor->yy47)); } break; case 236: /* wqlist */ { -sqlite3WithDelete(pParse->db, (yypminor->yy131)); +tdsqlite3WithDelete(pParse->db, (yypminor->yy131)); } break; case 246: /* window_clause */ case 297: /* windowdefn_list */ { -sqlite3WindowListDelete(pParse->db, (yypminor->yy303)); +tdsqlite3WindowListDelete(pParse->db, (yypminor->yy303)); } break; case 256: /* using_opt */ case 259: /* idlist */ case 264: /* idlist_opt */ { -sqlite3IdListDelete(pParse->db, (yypminor->yy600)); +tdsqlite3IdListDelete(pParse->db, (yypminor->yy600)); } break; case 266: /* filter_over */ @@ -158898,25 +158898,25 @@ sqlite3IdListDelete(pParse->db, (yypminor->yy600)); case 300: /* frame_opt */ case 303: /* over_clause */ { -sqlite3WindowDelete(pParse->db, (yypminor->yy303)); +tdsqlite3WindowDelete(pParse->db, (yypminor->yy303)); } break; case 279: /* trigger_cmd_list */ case 284: /* trigger_cmd */ { -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy447)); +tdsqlite3DeleteTriggerStep(pParse->db, (yypminor->yy447)); } break; case 281: /* trigger_event */ { -sqlite3IdListDelete(pParse->db, (yypminor->yy230).b); +tdsqlite3IdListDelete(pParse->db, (yypminor->yy230).b); } break; case 305: /* frame_bound */ case 306: /* frame_bound_s */ case 307: /* frame_bound_e */ { -sqlite3ExprDelete(pParse->db, (yypminor->yy77).pExpr); +tdsqlite3ExprDelete(pParse->db, (yypminor->yy77).pExpr); } break; /********* End destructor definitions *****************************************/ @@ -158948,7 +158948,7 @@ static void yy_pop_parser_stack(yyParser *pParser){ /* ** Clear all secondary memory allocations from the parser */ -SQLITE_PRIVATE void sqlite3ParserFinalize(void *p){ +SQLITE_PRIVATE void tdsqlite3ParserFinalize(void *p){ yyParser *pParser = (yyParser*)p; while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); #if YYSTACKDEPTH<=0 @@ -158956,7 +158956,7 @@ SQLITE_PRIVATE void sqlite3ParserFinalize(void *p){ #endif } -#ifndef sqlite3Parser_ENGINEALWAYSONSTACK +#ifndef tdsqlite3Parser_ENGINEALWAYSONSTACK /* ** Deallocate and destroy a parser. Destructors are called for ** all stack elements before shutting the parser down. @@ -158965,23 +158965,23 @@ SQLITE_PRIVATE void sqlite3ParserFinalize(void *p){ ** is defined in a %include section of the input grammar) then it is ** assumed that the input pointer is never NULL. */ -SQLITE_PRIVATE void sqlite3ParserFree( +SQLITE_PRIVATE void tdsqlite3ParserFree( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ #ifndef YYPARSEFREENEVERNULL if( p==0 ) return; #endif - sqlite3ParserFinalize(p); + tdsqlite3ParserFinalize(p); (*freeProc)(p); } -#endif /* sqlite3Parser_ENGINEALWAYSONSTACK */ +#endif /* tdsqlite3Parser_ENGINEALWAYSONSTACK */ /* ** Return the peak depth of the stack for a parser. */ #ifdef YYTRACKMAXSTACKDEPTH -SQLITE_PRIVATE int sqlite3ParserStackPeak(void *p){ +SQLITE_PRIVATE int tdsqlite3ParserStackPeak(void *p){ yyParser *pParser = (yyParser*)p; return pParser->yyhwm; } @@ -159005,7 +159005,7 @@ static unsigned char yycoverage[YYNSTATE][YYNTOKEN]; ** Return the number of missed state/lookahead combinations. */ #if defined(YYCOVERAGE) -SQLITE_PRIVATE int sqlite3ParserCoverage(FILE *out){ +SQLITE_PRIVATE int tdsqlite3ParserCoverage(FILE *out){ int stateno, iLookAhead, i; int nMissed = 0; for(stateno=0; statenoyytos++; @@ -160000,14 +160000,14 @@ static YYACTIONTYPE yy_reduce( yyParser *yypParser, /* The parser */ unsigned int yyruleno, /* Number of the rule by which to reduce */ int yyLookahead, /* Lookahead token, or YYNOCODE if none */ - sqlite3ParserTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ - sqlite3ParserCTX_PDECL /* %extra_context */ + tdsqlite3ParserTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ + tdsqlite3ParserCTX_PDECL /* %extra_context */ ){ int yygoto; /* The next state */ YYACTIONTYPE yyact; /* The next action */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ - sqlite3ParserARG_FETCH + tdsqlite3ParserARG_FETCH (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; @@ -160078,10 +160078,10 @@ static YYACTIONTYPE yy_reduce( { pParse->explain = 2; } break; case 2: /* cmdx ::= cmd */ -{ sqlite3FinishCoding(pParse); } +{ tdsqlite3FinishCoding(pParse); } break; case 3: /* cmd ::= BEGIN transtype trans_opt */ -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy192);} +{tdsqlite3BeginTransaction(pParse, yymsp[-1].minor.yy192);} break; case 4: /* transtype ::= */ {yymsp[1].minor.yy192 = TK_DEFERRED;} @@ -160094,26 +160094,26 @@ static YYACTIONTYPE yy_reduce( break; case 8: /* cmd ::= COMMIT|END trans_opt */ case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9); -{sqlite3EndTransaction(pParse,yymsp[-1].major);} +{tdsqlite3EndTransaction(pParse,yymsp[-1].major);} break; case 10: /* cmd ::= SAVEPOINT nm */ { - sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0); + tdsqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0); } break; case 11: /* cmd ::= RELEASE savepoint_opt nm */ { - sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0); + tdsqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0); } break; case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ { - sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0); + tdsqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0); } break; case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ { - sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy192,0,0,yymsp[-2].minor.yy192); + tdsqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy192,0,0,yymsp[-2].minor.yy192); } break; case 14: /* createkw ::= CREATE */ @@ -160139,27 +160139,27 @@ static YYACTIONTYPE yy_reduce( break; case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */ { - sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy192,0); + tdsqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy192,0); } break; case 20: /* create_table_args ::= AS select */ { - sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy539); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy539); + tdsqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy539); + tdsqlite3SelectDelete(pParse->db, yymsp[0].minor.yy539); } break; case 22: /* table_options ::= WITHOUT nm */ { - if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ + if( yymsp[0].minor.yy0.n==5 && tdsqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ yymsp[-1].minor.yy192 = TF_WithoutRowid | TF_NoVisibleRowid; }else{ yymsp[-1].minor.yy192 = 0; - sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); + tdsqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); } } break; case 23: /* columnname ::= nm typetoken */ -{sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);} +{tdsqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);} break; case 24: /* typetoken ::= */ case 63: /* conslist_opt ::= */ yytestcase(yyruleno==63); @@ -160196,57 +160196,57 @@ static YYACTIONTYPE yy_reduce( {pParse->constraintName = yymsp[0].minor.yy0;} break; case 31: /* ccons ::= DEFAULT scantok term */ -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy202,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} +{tdsqlite3AddDefaultValue(pParse,yymsp[0].minor.yy202,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} break; case 32: /* ccons ::= DEFAULT LP expr RP */ -{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy202,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} +{tdsqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy202,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} break; case 33: /* ccons ::= DEFAULT PLUS scantok term */ -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy202,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} +{tdsqlite3AddDefaultValue(pParse,yymsp[0].minor.yy202,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} break; case 34: /* ccons ::= DEFAULT MINUS scantok term */ { - Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy202, 0); - sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]); + Expr *p = tdsqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy202, 0); + tdsqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]); } break; case 35: /* ccons ::= DEFAULT scantok ID|INDEXED */ { Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0); if( p ){ - sqlite3ExprIdToTrueFalse(p); - testcase( p->op==TK_TRUEFALSE && sqlite3ExprTruthValue(p) ); + tdsqlite3ExprIdToTrueFalse(p); + testcase( p->op==TK_TRUEFALSE && tdsqlite3ExprTruthValue(p) ); } - sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n); + tdsqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n); } break; case 36: /* ccons ::= NOT NULL onconf */ -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy192);} +{tdsqlite3AddNotNull(pParse, yymsp[0].minor.yy192);} break; case 37: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy192,yymsp[0].minor.yy192,yymsp[-2].minor.yy192);} +{tdsqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy192,yymsp[0].minor.yy192,yymsp[-2].minor.yy192);} break; case 38: /* ccons ::= UNIQUE onconf */ -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy192,0,0,0,0, +{tdsqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy192,0,0,0,0, SQLITE_IDXTYPE_UNIQUE);} break; case 39: /* ccons ::= CHECK LP expr RP */ -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy202);} +{tdsqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy202);} break; case 40: /* ccons ::= REFERENCES nm eidlist_opt refargs */ -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy242,yymsp[0].minor.yy192);} +{tdsqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy242,yymsp[0].minor.yy192);} break; case 41: /* ccons ::= defer_subclause */ -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy192);} +{tdsqlite3DeferForeignKey(pParse,yymsp[0].minor.yy192);} break; case 42: /* ccons ::= COLLATE ID|STRING */ -{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} +{tdsqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} break; case 43: /* generated ::= LP expr RP */ -{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy202,0);} +{tdsqlite3AddGenerated(pParse,yymsp[-1].minor.yy202,0);} break; case 44: /* generated ::= LP expr RP ID */ -{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy202,&yymsp[0].minor.yy0);} +{tdsqlite3AddGenerated(pParse,yymsp[-2].minor.yy202,&yymsp[0].minor.yy0);} break; case 47: /* refargs ::= */ { yymsp[1].minor.yy192 = OE_None*0x0101; /* EV: R-19803-45884 */} @@ -160303,19 +160303,19 @@ static YYACTIONTYPE yy_reduce( {pParse->constraintName.n = 0;} break; case 66: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy242,yymsp[0].minor.yy192,yymsp[-2].minor.yy192,0);} +{tdsqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy242,yymsp[0].minor.yy192,yymsp[-2].minor.yy192,0);} break; case 67: /* tcons ::= UNIQUE LP sortlist RP onconf */ -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy242,yymsp[0].minor.yy192,0,0,0,0, +{tdsqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy242,yymsp[0].minor.yy192,0,0,0,0, SQLITE_IDXTYPE_UNIQUE);} break; case 68: /* tcons ::= CHECK LP expr RP onconf */ -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy202);} +{tdsqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy202);} break; case 69: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ { - sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy242, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy242, yymsp[-1].minor.yy192); - sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy192); + tdsqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy242, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy242, yymsp[-1].minor.yy192); + tdsqlite3DeferForeignKey(pParse, yymsp[0].minor.yy192); } break; case 71: /* onconf ::= */ @@ -160334,24 +160334,24 @@ static YYACTIONTYPE yy_reduce( break; case 77: /* cmd ::= DROP TABLE ifexists fullname */ { - sqlite3DropTable(pParse, yymsp[0].minor.yy47, 0, yymsp[-1].minor.yy192); + tdsqlite3DropTable(pParse, yymsp[0].minor.yy47, 0, yymsp[-1].minor.yy192); } break; case 80: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ { - sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy242, yymsp[0].minor.yy539, yymsp[-7].minor.yy192, yymsp[-5].minor.yy192); + tdsqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy242, yymsp[0].minor.yy539, yymsp[-7].minor.yy192, yymsp[-5].minor.yy192); } break; case 81: /* cmd ::= DROP VIEW ifexists fullname */ { - sqlite3DropTable(pParse, yymsp[0].minor.yy47, 1, yymsp[-1].minor.yy192); + tdsqlite3DropTable(pParse, yymsp[0].minor.yy47, 1, yymsp[-1].minor.yy192); } break; case 82: /* cmd ::= select */ { SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0}; - sqlite3Select(pParse, yymsp[0].minor.yy539, &dest); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy539); + tdsqlite3Select(pParse, yymsp[0].minor.yy539, &dest); + tdsqlite3SelectDelete(pParse->db, yymsp[0].minor.yy539); } break; case 83: /* select ::= WITH wqlist selectnowith */ @@ -160361,7 +160361,7 @@ static YYACTIONTYPE yy_reduce( p->pWith = yymsp[-1].minor.yy131; parserDoubleLinkSelect(pParse, p); }else{ - sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy131); + tdsqlite3WithDelete(pParse->db, yymsp[-1].minor.yy131); } yymsp[-2].minor.yy539 = p; } @@ -160373,7 +160373,7 @@ static YYACTIONTYPE yy_reduce( p->pWith = yymsp[-1].minor.yy131; parserDoubleLinkSelect(pParse, p); }else{ - sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy131); + tdsqlite3WithDelete(pParse->db, yymsp[-1].minor.yy131); } yymsp[-3].minor.yy539 = p; } @@ -160396,8 +160396,8 @@ static YYACTIONTYPE yy_reduce( Token x; x.n = 0; parserDoubleLinkSelect(pParse, pRhs); - pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0); - pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0); + pFrom = tdsqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0); + pRhs = tdsqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0); } if( pRhs ){ pRhs->op = (u8)yymsp[-1].minor.yy192; @@ -160406,7 +160406,7 @@ static YYACTIONTYPE yy_reduce( pRhs->selFlags &= ~SF_MultiValue; if( yymsp[-1].minor.yy192!=TK_ALL ) pParse->hasCompound = 1; }else{ - sqlite3SelectDelete(pParse->db, pLhs); + tdsqlite3SelectDelete(pParse->db, pLhs); } yymsp[-2].minor.yy539 = pRhs; } @@ -160420,28 +160420,28 @@ static YYACTIONTYPE yy_reduce( break; case 90: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ { - yymsp[-8].minor.yy539 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy242,yymsp[-5].minor.yy47,yymsp[-4].minor.yy202,yymsp[-3].minor.yy242,yymsp[-2].minor.yy202,yymsp[-1].minor.yy242,yymsp[-7].minor.yy192,yymsp[0].minor.yy202); + yymsp[-8].minor.yy539 = tdsqlite3SelectNew(pParse,yymsp[-6].minor.yy242,yymsp[-5].minor.yy47,yymsp[-4].minor.yy202,yymsp[-3].minor.yy242,yymsp[-2].minor.yy202,yymsp[-1].minor.yy242,yymsp[-7].minor.yy192,yymsp[0].minor.yy202); } break; case 91: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ { - yymsp[-9].minor.yy539 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy242,yymsp[-6].minor.yy47,yymsp[-5].minor.yy202,yymsp[-4].minor.yy242,yymsp[-3].minor.yy202,yymsp[-1].minor.yy242,yymsp[-8].minor.yy192,yymsp[0].minor.yy202); + yymsp[-9].minor.yy539 = tdsqlite3SelectNew(pParse,yymsp[-7].minor.yy242,yymsp[-6].minor.yy47,yymsp[-5].minor.yy202,yymsp[-4].minor.yy242,yymsp[-3].minor.yy202,yymsp[-1].minor.yy242,yymsp[-8].minor.yy192,yymsp[0].minor.yy202); if( yymsp[-9].minor.yy539 ){ yymsp[-9].minor.yy539->pWinDefn = yymsp[-2].minor.yy303; }else{ - sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy303); + tdsqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy303); } } break; case 92: /* values ::= VALUES LP nexprlist RP */ { - yymsp[-3].minor.yy539 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy242,0,0,0,0,0,SF_Values,0); + yymsp[-3].minor.yy539 = tdsqlite3SelectNew(pParse,yymsp[-1].minor.yy242,0,0,0,0,0,SF_Values,0); } break; case 93: /* values ::= values COMMA LP nexprlist RP */ { Select *pRight, *pLeft = yymsp[-4].minor.yy539; - pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy242,0,0,0,0,0,SF_Values|SF_MultiValue,0); + pRight = tdsqlite3SelectNew(pParse,yymsp[-1].minor.yy242,0,0,0,0,0,SF_Values|SF_MultiValue,0); if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; if( pRight ){ pRight->op = TK_ALL; @@ -160468,23 +160468,23 @@ static YYACTIONTYPE yy_reduce( break; case 98: /* selcollist ::= sclp scanpt expr scanpt as */ { - yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy242, yymsp[-2].minor.yy202); - if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy242, &yymsp[0].minor.yy0, 1); - sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy242,yymsp[-3].minor.yy436,yymsp[-1].minor.yy436); + yymsp[-4].minor.yy242 = tdsqlite3ExprListAppend(pParse, yymsp[-4].minor.yy242, yymsp[-2].minor.yy202); + if( yymsp[0].minor.yy0.n>0 ) tdsqlite3ExprListSetName(pParse, yymsp[-4].minor.yy242, &yymsp[0].minor.yy0, 1); + tdsqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy242,yymsp[-3].minor.yy436,yymsp[-1].minor.yy436); } break; case 99: /* selcollist ::= sclp scanpt STAR */ { - Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); - yymsp[-2].minor.yy242 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy242, p); + Expr *p = tdsqlite3Expr(pParse->db, TK_ASTERISK, 0); + yymsp[-2].minor.yy242 = tdsqlite3ExprListAppend(pParse, yymsp[-2].minor.yy242, p); } break; case 100: /* selcollist ::= sclp scanpt nm DOT STAR */ { - Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0); - Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); - Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight); - yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, pDot); + Expr *pRight = tdsqlite3PExpr(pParse, TK_ASTERISK, 0, 0); + Expr *pLeft = tdsqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); + Expr *pDot = tdsqlite3PExpr(pParse, TK_DOT, pLeft, pRight); + yymsp[-4].minor.yy242 = tdsqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, pDot); } break; case 101: /* as ::= AS nm */ @@ -160494,12 +160494,12 @@ static YYACTIONTYPE yy_reduce( {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} break; case 103: /* from ::= */ -{yymsp[1].minor.yy47 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy47));} +{yymsp[1].minor.yy47 = tdsqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy47));} break; case 104: /* from ::= FROM seltablist */ { yymsp[-1].minor.yy47 = yymsp[0].minor.yy47; - sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy47); + tdsqlite3SrcListShiftJoinType(yymsp[-1].minor.yy47); } break; case 105: /* stl_prefix ::= seltablist joinop */ @@ -160512,19 +160512,19 @@ static YYACTIONTYPE yy_reduce( break; case 107: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ { - yymsp[-6].minor.yy47 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy47,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); - sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy47, &yymsp[-2].minor.yy0); + yymsp[-6].minor.yy47 = tdsqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy47,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); + tdsqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy47, &yymsp[-2].minor.yy0); } break; case 108: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ { - yymsp[-8].minor.yy47 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy47,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); - sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy47, yymsp[-4].minor.yy242); + yymsp[-8].minor.yy47 = tdsqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy47,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); + tdsqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy47, yymsp[-4].minor.yy242); } break; case 109: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ { - yymsp[-6].minor.yy47 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy47,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy539,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); + yymsp[-6].minor.yy47 = tdsqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy47,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy539,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); } break; case 110: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ @@ -160532,7 +160532,7 @@ static YYACTIONTYPE yy_reduce( if( yymsp[-6].minor.yy47==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy202==0 && yymsp[0].minor.yy600==0 ){ yymsp[-6].minor.yy47 = yymsp[-4].minor.yy47; }else if( yymsp[-4].minor.yy47->nSrc==1 ){ - yymsp[-6].minor.yy47 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy47,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); + yymsp[-6].minor.yy47 = tdsqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy47,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); if( yymsp[-6].minor.yy47 ){ struct SrcList_item *pNew = &yymsp[-6].minor.yy47->a[yymsp[-6].minor.yy47->nSrc-1]; struct SrcList_item *pOld = yymsp[-4].minor.yy47->a; @@ -160548,12 +160548,12 @@ static YYACTIONTYPE yy_reduce( pOld->zName = pOld->zDatabase = 0; pOld->pSelect = 0; } - sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy47); + tdsqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy47); }else{ Select *pSubquery; - sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy47); - pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy47,0,0,0,0,SF_NestedFrom,0); - yymsp[-6].minor.yy47 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy47,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); + tdsqlite3SrcListShiftJoinType(yymsp[-4].minor.yy47); + pSubquery = tdsqlite3SelectNew(pParse,0,yymsp[-4].minor.yy47,0,0,0,0,SF_NestedFrom,0); + yymsp[-6].minor.yy47 = tdsqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy47,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); } } break; @@ -160563,47 +160563,47 @@ static YYACTIONTYPE yy_reduce( break; case 113: /* fullname ::= nm */ { - yylhsminor.yy47 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); - if( IN_RENAME_OBJECT && yylhsminor.yy47 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy47->a[0].zName, &yymsp[0].minor.yy0); + yylhsminor.yy47 = tdsqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); + if( IN_RENAME_OBJECT && yylhsminor.yy47 ) tdsqlite3RenameTokenMap(pParse, yylhsminor.yy47->a[0].zName, &yymsp[0].minor.yy0); } yymsp[0].minor.yy47 = yylhsminor.yy47; break; case 114: /* fullname ::= nm DOT nm */ { - yylhsminor.yy47 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); - if( IN_RENAME_OBJECT && yylhsminor.yy47 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy47->a[0].zName, &yymsp[0].minor.yy0); + yylhsminor.yy47 = tdsqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); + if( IN_RENAME_OBJECT && yylhsminor.yy47 ) tdsqlite3RenameTokenMap(pParse, yylhsminor.yy47->a[0].zName, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy47 = yylhsminor.yy47; break; case 115: /* xfullname ::= nm */ -{yymsp[0].minor.yy47 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} +{yymsp[0].minor.yy47 = tdsqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} break; case 116: /* xfullname ::= nm DOT nm */ -{yymsp[-2].minor.yy47 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} +{yymsp[-2].minor.yy47 = tdsqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 117: /* xfullname ::= nm DOT nm AS nm */ { - yymsp[-4].minor.yy47 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ - if( yymsp[-4].minor.yy47 ) yymsp[-4].minor.yy47->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); + yymsp[-4].minor.yy47 = tdsqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ + if( yymsp[-4].minor.yy47 ) yymsp[-4].minor.yy47->a[0].zAlias = tdsqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } break; case 118: /* xfullname ::= nm AS nm */ { - yymsp[-2].minor.yy47 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ - if( yymsp[-2].minor.yy47 ) yymsp[-2].minor.yy47->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); + yymsp[-2].minor.yy47 = tdsqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ + if( yymsp[-2].minor.yy47 ) yymsp[-2].minor.yy47->a[0].zAlias = tdsqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } break; case 119: /* joinop ::= COMMA|JOIN */ { yymsp[0].minor.yy192 = JT_INNER; } break; case 120: /* joinop ::= JOIN_KW JOIN */ -{yymsp[-1].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} +{yymsp[-1].minor.yy192 = tdsqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} break; case 121: /* joinop ::= JOIN_KW nm JOIN */ -{yymsp[-2].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} +{yymsp[-2].minor.yy192 = tdsqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} break; case 122: /* joinop ::= JOIN_KW nm nm JOIN */ -{yymsp[-3].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} +{yymsp[-3].minor.yy192 = tdsqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} break; case 123: /* on_opt ::= ON expr */ case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143); @@ -160640,14 +160640,14 @@ static YYACTIONTYPE yy_reduce( break; case 132: /* sortlist ::= sortlist COMMA expr sortorder nulls */ { - yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242,yymsp[-2].minor.yy202); - sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy242,yymsp[-1].minor.yy192,yymsp[0].minor.yy192); + yymsp[-4].minor.yy242 = tdsqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242,yymsp[-2].minor.yy202); + tdsqlite3ExprListSetSortOrder(yymsp[-4].minor.yy242,yymsp[-1].minor.yy192,yymsp[0].minor.yy192); } break; case 133: /* sortlist ::= expr sortorder nulls */ { - yymsp[-2].minor.yy242 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy202); /*A-overwrites-Y*/ - sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy242,yymsp[-1].minor.yy192,yymsp[0].minor.yy192); + yymsp[-2].minor.yy242 = tdsqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy202); /*A-overwrites-Y*/ + tdsqlite3ExprListSetSortOrder(yymsp[-2].minor.yy242,yymsp[-1].minor.yy192,yymsp[0].minor.yy192); } break; case 134: /* sortorder ::= ASC */ @@ -160667,80 +160667,80 @@ static YYACTIONTYPE yy_reduce( {yymsp[-1].minor.yy192 = SQLITE_SO_DESC;} break; case 145: /* limit_opt ::= LIMIT expr */ -{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy202,0);} +{yymsp[-1].minor.yy202 = tdsqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy202,0);} break; case 146: /* limit_opt ::= LIMIT expr OFFSET expr */ -{yymsp[-3].minor.yy202 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);} +{yymsp[-3].minor.yy202 = tdsqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);} break; case 147: /* limit_opt ::= LIMIT expr COMMA expr */ -{yymsp[-3].minor.yy202 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy202,yymsp[-2].minor.yy202);} +{yymsp[-3].minor.yy202 = tdsqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy202,yymsp[-2].minor.yy202);} break; case 148: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ { - sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy47, &yymsp[-1].minor.yy0); - sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy47,yymsp[0].minor.yy202,0,0); + tdsqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy47, &yymsp[-1].minor.yy0); + tdsqlite3DeleteFrom(pParse,yymsp[-2].minor.yy47,yymsp[0].minor.yy202,0,0); } break; case 151: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ { - sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy47, &yymsp[-3].minor.yy0); - sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy242,"set list"); - sqlite3Update(pParse,yymsp[-4].minor.yy47,yymsp[-1].minor.yy242,yymsp[0].minor.yy202,yymsp[-5].minor.yy192,0,0,0); + tdsqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy47, &yymsp[-3].minor.yy0); + tdsqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy242,"set list"); + tdsqlite3Update(pParse,yymsp[-4].minor.yy47,yymsp[-1].minor.yy242,yymsp[0].minor.yy202,yymsp[-5].minor.yy192,0,0,0); } break; case 152: /* setlist ::= setlist COMMA nm EQ expr */ { - yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy242, yymsp[0].minor.yy202); - sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy242, &yymsp[-2].minor.yy0, 1); + yymsp[-4].minor.yy242 = tdsqlite3ExprListAppend(pParse, yymsp[-4].minor.yy242, yymsp[0].minor.yy202); + tdsqlite3ExprListSetName(pParse, yymsp[-4].minor.yy242, &yymsp[-2].minor.yy0, 1); } break; case 153: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ { - yymsp[-6].minor.yy242 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy242, yymsp[-3].minor.yy600, yymsp[0].minor.yy202); + yymsp[-6].minor.yy242 = tdsqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy242, yymsp[-3].minor.yy600, yymsp[0].minor.yy202); } break; case 154: /* setlist ::= nm EQ expr */ { - yylhsminor.yy242 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy202); - sqlite3ExprListSetName(pParse, yylhsminor.yy242, &yymsp[-2].minor.yy0, 1); + yylhsminor.yy242 = tdsqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy202); + tdsqlite3ExprListSetName(pParse, yylhsminor.yy242, &yymsp[-2].minor.yy0, 1); } yymsp[-2].minor.yy242 = yylhsminor.yy242; break; case 155: /* setlist ::= LP idlist RP EQ expr */ { - yymsp[-4].minor.yy242 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy600, yymsp[0].minor.yy202); + yymsp[-4].minor.yy242 = tdsqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy600, yymsp[0].minor.yy202); } break; case 156: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ { - sqlite3Insert(pParse, yymsp[-3].minor.yy47, yymsp[-1].minor.yy539, yymsp[-2].minor.yy600, yymsp[-5].minor.yy192, yymsp[0].minor.yy318); + tdsqlite3Insert(pParse, yymsp[-3].minor.yy47, yymsp[-1].minor.yy539, yymsp[-2].minor.yy600, yymsp[-5].minor.yy192, yymsp[0].minor.yy318); } break; case 157: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ { - sqlite3Insert(pParse, yymsp[-3].minor.yy47, 0, yymsp[-2].minor.yy600, yymsp[-5].minor.yy192, 0); + tdsqlite3Insert(pParse, yymsp[-3].minor.yy47, 0, yymsp[-2].minor.yy600, yymsp[-5].minor.yy192, 0); } break; case 158: /* upsert ::= */ { yymsp[1].minor.yy318 = 0; } break; case 159: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ -{ yymsp[-10].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy242,yymsp[-5].minor.yy202,yymsp[-1].minor.yy242,yymsp[0].minor.yy202);} +{ yymsp[-10].minor.yy318 = tdsqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy242,yymsp[-5].minor.yy202,yymsp[-1].minor.yy242,yymsp[0].minor.yy202);} break; case 160: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ -{ yymsp[-7].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy242,yymsp[-2].minor.yy202,0,0); } +{ yymsp[-7].minor.yy318 = tdsqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy242,yymsp[-2].minor.yy202,0,0); } break; case 161: /* upsert ::= ON CONFLICT DO NOTHING */ -{ yymsp[-3].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,0,0); } +{ yymsp[-3].minor.yy318 = tdsqlite3UpsertNew(pParse->db,0,0,0,0); } break; case 165: /* idlist_opt ::= LP idlist RP */ {yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600;} break; case 166: /* idlist ::= idlist COMMA nm */ -{yymsp[-2].minor.yy600 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy600,&yymsp[0].minor.yy0);} +{yymsp[-2].minor.yy600 = tdsqlite3IdListAppend(pParse,yymsp[-2].minor.yy600,&yymsp[0].minor.yy0);} break; case 167: /* idlist ::= nm */ -{yymsp[0].minor.yy600 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} +{yymsp[0].minor.yy600 = tdsqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} break; case 168: /* expr ::= LP expr RP */ {yymsp[-2].minor.yy202 = yymsp[-1].minor.yy202;} @@ -160751,27 +160751,27 @@ static YYACTIONTYPE yy_reduce( break; case 171: /* expr ::= nm DOT nm */ { - Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); - Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); + Expr *temp1 = tdsqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); + Expr *temp2 = tdsqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0); - sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0); + tdsqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0); + tdsqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0); } - yylhsminor.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); + yylhsminor.yy202 = tdsqlite3PExpr(pParse, TK_DOT, temp1, temp2); } yymsp[-2].minor.yy202 = yylhsminor.yy202; break; case 172: /* expr ::= nm DOT nm DOT nm */ { - Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1); - Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); - Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); - Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3); + Expr *temp1 = tdsqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1); + Expr *temp2 = tdsqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); + Expr *temp3 = tdsqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); + Expr *temp4 = tdsqlite3PExpr(pParse, TK_DOT, temp2, temp3); if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0); - sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0); + tdsqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0); + tdsqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0); } - yylhsminor.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); + yylhsminor.yy202 = tdsqlite3PExpr(pParse, TK_DOT, temp1, temp4); } yymsp[-4].minor.yy202 = yylhsminor.yy202; break; @@ -160781,16 +160781,16 @@ static YYACTIONTYPE yy_reduce( break; case 175: /* term ::= INTEGER */ { - yylhsminor.yy202 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); + yylhsminor.yy202 = tdsqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); } yymsp[0].minor.yy202 = yylhsminor.yy202; break; case 176: /* expr ::= VARIABLE */ { - if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ + if( !(yymsp[0].minor.yy0.z[0]=='#' && tdsqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ u32 n = yymsp[0].minor.yy0.n; yymsp[0].minor.yy202 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); - sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy202, n); + tdsqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy202, n); }else{ /* When doing a nested parse, one can include terms in an expression ** that look like this: #1 #2 ... These terms refer to registers @@ -160798,74 +160798,74 @@ static YYACTIONTYPE yy_reduce( Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/ assert( t.n>=2 ); if( pParse->nested==0 ){ - sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); + tdsqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); yymsp[0].minor.yy202 = 0; }else{ - yymsp[0].minor.yy202 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); - if( yymsp[0].minor.yy202 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy202->iTable); + yymsp[0].minor.yy202 = tdsqlite3PExpr(pParse, TK_REGISTER, 0, 0); + if( yymsp[0].minor.yy202 ) tdsqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy202->iTable); } } } break; case 177: /* expr ::= expr COLLATE ID|STRING */ { - yymsp[-2].minor.yy202 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy202, &yymsp[0].minor.yy0, 1); + yymsp[-2].minor.yy202 = tdsqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy202, &yymsp[0].minor.yy0, 1); } break; case 178: /* expr ::= CAST LP expr AS typetoken RP */ { - yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); - sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy202, yymsp[-3].minor.yy202, 0); + yymsp[-5].minor.yy202 = tdsqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); + tdsqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy202, yymsp[-3].minor.yy202, 0); } break; case 179: /* expr ::= ID|INDEXED LP distinct exprlist RP */ { - yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy192); + yylhsminor.yy202 = tdsqlite3ExprFunction(pParse, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy192); } yymsp[-4].minor.yy202 = yylhsminor.yy202; break; case 180: /* expr ::= ID|INDEXED LP STAR RP */ { - yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); + yylhsminor.yy202 = tdsqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); } yymsp[-3].minor.yy202 = yylhsminor.yy202; break; case 181: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ { - yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy242, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy192); - sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303); + yylhsminor.yy202 = tdsqlite3ExprFunction(pParse, yymsp[-2].minor.yy242, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy192); + tdsqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303); } yymsp[-5].minor.yy202 = yylhsminor.yy202; break; case 182: /* expr ::= ID|INDEXED LP STAR RP filter_over */ { - yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); - sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303); + yylhsminor.yy202 = tdsqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); + tdsqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303); } yymsp[-4].minor.yy202 = yylhsminor.yy202; break; case 183: /* term ::= CTIME_KW */ { - yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); + yylhsminor.yy202 = tdsqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); } yymsp[0].minor.yy202 = yylhsminor.yy202; break; case 184: /* expr ::= LP nexprlist COMMA expr RP */ { - ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202); - yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); + ExprList *pList = tdsqlite3ExprListAppend(pParse, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202); + yymsp[-4].minor.yy202 = tdsqlite3PExpr(pParse, TK_VECTOR, 0, 0); if( yymsp[-4].minor.yy202 ){ yymsp[-4].minor.yy202->x.pList = pList; if( ALWAYS(pList->nExpr) ){ yymsp[-4].minor.yy202->flags |= pList->a[0].pExpr->flags & EP_Propagate; } }else{ - sqlite3ExprListDelete(pParse->db, pList); + tdsqlite3ExprListDelete(pParse->db, pList); } } break; case 185: /* expr ::= expr AND expr */ -{yymsp[-2].minor.yy202=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);} +{yymsp[-2].minor.yy202=tdsqlite3ExprAnd(pParse,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);} break; case 186: /* expr ::= expr OR expr */ case 187: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==187); @@ -160874,7 +160874,7 @@ static YYACTIONTYPE yy_reduce( case 190: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==190); case 191: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==191); case 192: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==192); -{yymsp[-2].minor.yy202=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);} +{yymsp[-2].minor.yy202=tdsqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);} break; case 193: /* likeop ::= NOT LIKE_KW|MATCH */ {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/} @@ -160884,10 +160884,10 @@ static YYACTIONTYPE yy_reduce( ExprList *pList; int bNot = yymsp[-1].minor.yy0.n & 0x80000000; yymsp[-1].minor.yy0.n &= 0x7fffffff; - pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy202); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy202); - yymsp[-2].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); - if( bNot ) yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy202, 0); + pList = tdsqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy202); + pList = tdsqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy202); + yymsp[-2].minor.yy202 = tdsqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); + if( bNot ) yymsp[-2].minor.yy202 = tdsqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy202, 0); if( yymsp[-2].minor.yy202 ) yymsp[-2].minor.yy202->flags |= EP_InfixFunc; } break; @@ -160896,39 +160896,39 @@ static YYACTIONTYPE yy_reduce( ExprList *pList; int bNot = yymsp[-3].minor.yy0.n & 0x80000000; yymsp[-3].minor.yy0.n &= 0x7fffffff; - pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy202); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202); - yymsp[-4].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); - if( bNot ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); + pList = tdsqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202); + pList = tdsqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy202); + pList = tdsqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202); + yymsp[-4].minor.yy202 = tdsqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); + if( bNot ) yymsp[-4].minor.yy202 = tdsqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); if( yymsp[-4].minor.yy202 ) yymsp[-4].minor.yy202->flags |= EP_InfixFunc; } break; case 196: /* expr ::= expr ISNULL|NOTNULL */ -{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy202,0);} +{yymsp[-1].minor.yy202 = tdsqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy202,0);} break; case 197: /* expr ::= expr NOT NULL */ -{yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy202,0);} +{yymsp[-2].minor.yy202 = tdsqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy202,0);} break; case 198: /* expr ::= expr IS expr */ { - yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy202,yymsp[0].minor.yy202); + yymsp[-2].minor.yy202 = tdsqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy202,yymsp[0].minor.yy202); binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-2].minor.yy202, TK_ISNULL); } break; case 199: /* expr ::= expr IS NOT expr */ { - yymsp[-3].minor.yy202 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy202,yymsp[0].minor.yy202); + yymsp[-3].minor.yy202 = tdsqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy202,yymsp[0].minor.yy202); binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-3].minor.yy202, TK_NOTNULL); } break; case 200: /* expr ::= NOT expr */ case 201: /* expr ::= BITNOT expr */ yytestcase(yyruleno==201); -{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy202, 0);/*A-overwrites-B*/} +{yymsp[-1].minor.yy202 = tdsqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy202, 0);/*A-overwrites-B*/} break; case 202: /* expr ::= PLUS|MINUS expr */ { - yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy202, 0); + yymsp[-1].minor.yy202 = tdsqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy202, 0); /*A-overwrites-B*/ } break; @@ -160938,15 +160938,15 @@ static YYACTIONTYPE yy_reduce( break; case 205: /* expr ::= expr between_op expr AND expr */ { - ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202); - yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy202, 0); + ExprList *pList = tdsqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202); + pList = tdsqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202); + yymsp[-4].minor.yy202 = tdsqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy202, 0); if( yymsp[-4].minor.yy202 ){ yymsp[-4].minor.yy202->x.pList = pList; }else{ - sqlite3ExprListDelete(pParse->db, pList); + tdsqlite3ExprListDelete(pParse->db, pList); } - if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); + if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = tdsqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); } break; case 208: /* expr ::= expr in_op LP exprlist RP */ @@ -160960,82 +160960,82 @@ static YYACTIONTYPE yy_reduce( ** simplify to constants 0 (false) and 1 (true), respectively, ** regardless of the value of expr1. */ - sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy202); - yymsp[-4].minor.yy202 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy192 ? "1" : "0"); + tdsqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy202); + yymsp[-4].minor.yy202 = tdsqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy192 ? "1" : "0"); }else{ - yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0); + yymsp[-4].minor.yy202 = tdsqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0); if( yymsp[-4].minor.yy202 ){ yymsp[-4].minor.yy202->x.pList = yymsp[-1].minor.yy242; - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy202); + tdsqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy202); }else{ - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy242); + tdsqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy242); } - if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); + if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = tdsqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); } } break; case 209: /* expr ::= LP select RP */ { - yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); - sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy202, yymsp[-1].minor.yy539); + yymsp[-2].minor.yy202 = tdsqlite3PExpr(pParse, TK_SELECT, 0, 0); + tdsqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy202, yymsp[-1].minor.yy539); } break; case 210: /* expr ::= expr in_op LP select RP */ { - yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, yymsp[-1].minor.yy539); - if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); + yymsp[-4].minor.yy202 = tdsqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0); + tdsqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, yymsp[-1].minor.yy539); + if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = tdsqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); } break; case 211: /* expr ::= expr in_op nm dbnm paren_exprlist */ { - SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); - Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0); - if( yymsp[0].minor.yy242 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy242); - yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, pSelect); - if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); + SrcList *pSrc = tdsqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); + Select *pSelect = tdsqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0); + if( yymsp[0].minor.yy242 ) tdsqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy242); + yymsp[-4].minor.yy202 = tdsqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0); + tdsqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, pSelect); + if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = tdsqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); } break; case 212: /* expr ::= EXISTS LP select RP */ { Expr *p; - p = yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); - sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy539); + p = yymsp[-3].minor.yy202 = tdsqlite3PExpr(pParse, TK_EXISTS, 0, 0); + tdsqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy539); } break; case 213: /* expr ::= CASE case_operand case_exprlist case_else END */ { - yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy202, 0); + yymsp[-4].minor.yy202 = tdsqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy202, 0); if( yymsp[-4].minor.yy202 ){ - yymsp[-4].minor.yy202->x.pList = yymsp[-1].minor.yy202 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202) : yymsp[-2].minor.yy242; - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy202); + yymsp[-4].minor.yy202->x.pList = yymsp[-1].minor.yy202 ? tdsqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202) : yymsp[-2].minor.yy242; + tdsqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy202); }else{ - sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy242); - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy202); + tdsqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy242); + tdsqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy202); } } break; case 214: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ { - yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[-2].minor.yy202); - yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[0].minor.yy202); + yymsp[-4].minor.yy242 = tdsqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[-2].minor.yy202); + yymsp[-4].minor.yy242 = tdsqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[0].minor.yy202); } break; case 215: /* case_exprlist ::= WHEN expr THEN expr */ { - yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202); - yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy242, yymsp[0].minor.yy202); + yymsp[-3].minor.yy242 = tdsqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202); + yymsp[-3].minor.yy242 = tdsqlite3ExprListAppend(pParse,yymsp[-3].minor.yy242, yymsp[0].minor.yy202); } break; case 218: /* case_operand ::= expr */ {yymsp[0].minor.yy202 = yymsp[0].minor.yy202; /*A-overwrites-X*/} break; case 221: /* nexprlist ::= nexprlist COMMA expr */ -{yymsp[-2].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[0].minor.yy202);} +{yymsp[-2].minor.yy242 = tdsqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[0].minor.yy202);} break; case 222: /* nexprlist ::= expr */ -{yymsp[0].minor.yy242 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy202); /*A-overwrites-Y*/} +{yymsp[0].minor.yy242 = tdsqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy202); /*A-overwrites-Y*/} break; case 224: /* paren_exprlist ::= LP exprlist RP */ case 229: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==229); @@ -161043,11 +161043,11 @@ static YYACTIONTYPE yy_reduce( break; case 225: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ { - sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, - sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy242, yymsp[-10].minor.yy192, + tdsqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, + tdsqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy242, yymsp[-10].minor.yy192, &yymsp[-11].minor.yy0, yymsp[0].minor.yy202, SQLITE_SO_ASC, yymsp[-8].minor.yy192, SQLITE_IDXTYPE_APPDEF); if( IN_RENAME_OBJECT && pParse->pNewIndex ){ - sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); + tdsqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); } } break; @@ -161069,40 +161069,40 @@ static YYACTIONTYPE yy_reduce( } break; case 234: /* cmd ::= DROP INDEX ifexists fullname */ -{sqlite3DropIndex(pParse, yymsp[0].minor.yy47, yymsp[-1].minor.yy192);} +{tdsqlite3DropIndex(pParse, yymsp[0].minor.yy47, yymsp[-1].minor.yy192);} break; case 235: /* cmd ::= VACUUM vinto */ -{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy202);} +{tdsqlite3Vacuum(pParse,0,yymsp[0].minor.yy202);} break; case 236: /* cmd ::= VACUUM nm vinto */ -{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy202);} +{tdsqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy202);} break; case 239: /* cmd ::= PRAGMA nm dbnm */ -{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} +{tdsqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} break; case 240: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ -{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} +{tdsqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} break; case 241: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ -{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} +{tdsqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} break; case 242: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ -{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} +{tdsqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} break; case 243: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ -{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} +{tdsqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} break; case 246: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ { Token all; all.z = yymsp[-3].minor.yy0.z; all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; - sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy447, &all); + tdsqlite3FinishTrigger(pParse, yymsp[-1].minor.yy447, &all); } break; case 247: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ { - sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy192, yymsp[-4].minor.yy230.a, yymsp[-4].minor.yy230.b, yymsp[-2].minor.yy47, yymsp[0].minor.yy202, yymsp[-10].minor.yy192, yymsp[-8].minor.yy192); + tdsqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy192, yymsp[-4].minor.yy230.a, yymsp[-4].minor.yy230.b, yymsp[-2].minor.yy47, yymsp[0].minor.yy202, yymsp[-10].minor.yy192, yymsp[-8].minor.yy192); yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ } break; @@ -161146,46 +161146,46 @@ static YYACTIONTYPE yy_reduce( case 258: /* trnm ::= nm DOT nm */ { yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "qualified table names are not allowed on INSERT, UPDATE, and DELETE " "statements within triggers"); } break; case 259: /* tridxby ::= INDEXED BY nm */ { - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; case 260: /* tridxby ::= NOT INDEXED */ { - sqlite3ErrorMsg(pParse, + tdsqlite3ErrorMsg(pParse, "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; case 261: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ -{yylhsminor.yy447 = sqlite3TriggerUpdateStep(pParse, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy242, yymsp[-1].minor.yy202, yymsp[-6].minor.yy192, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy436);} +{yylhsminor.yy447 = tdsqlite3TriggerUpdateStep(pParse, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy242, yymsp[-1].minor.yy202, yymsp[-6].minor.yy192, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy436);} yymsp[-7].minor.yy447 = yylhsminor.yy447; break; case 262: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ { - yylhsminor.yy447 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy600,yymsp[-2].minor.yy539,yymsp[-6].minor.yy192,yymsp[-1].minor.yy318,yymsp[-7].minor.yy436,yymsp[0].minor.yy436);/*yylhsminor.yy447-overwrites-yymsp[-6].minor.yy192*/ + yylhsminor.yy447 = tdsqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy600,yymsp[-2].minor.yy539,yymsp[-6].minor.yy192,yymsp[-1].minor.yy318,yymsp[-7].minor.yy436,yymsp[0].minor.yy436);/*yylhsminor.yy447-overwrites-yymsp[-6].minor.yy192*/ } yymsp[-7].minor.yy447 = yylhsminor.yy447; break; case 263: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ -{yylhsminor.yy447 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy202, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy436);} +{yylhsminor.yy447 = tdsqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy202, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy436);} yymsp[-5].minor.yy447 = yylhsminor.yy447; break; case 264: /* trigger_cmd ::= scanpt select scanpt */ -{yylhsminor.yy447 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy539, yymsp[-2].minor.yy436, yymsp[0].minor.yy436); /*yylhsminor.yy447-overwrites-yymsp[-1].minor.yy539*/} +{yylhsminor.yy447 = tdsqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy539, yymsp[-2].minor.yy436, yymsp[0].minor.yy436); /*yylhsminor.yy447-overwrites-yymsp[-1].minor.yy539*/} yymsp[-2].minor.yy447 = yylhsminor.yy447; break; case 265: /* expr ::= RAISE LP IGNORE RP */ { - yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); + yymsp[-3].minor.yy202 = tdsqlite3PExpr(pParse, TK_RAISE, 0, 0); if( yymsp[-3].minor.yy202 ){ yymsp[-3].minor.yy202->affExpr = OE_Ignore; } @@ -161193,7 +161193,7 @@ static YYACTIONTYPE yy_reduce( break; case 266: /* expr ::= RAISE LP raisetype COMMA nm RP */ { - yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); + yymsp[-5].minor.yy202 = tdsqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); if( yymsp[-5].minor.yy202 ) { yymsp[-5].minor.yy202->affExpr = (char)yymsp[-3].minor.yy192; } @@ -161207,84 +161207,84 @@ static YYACTIONTYPE yy_reduce( break; case 270: /* cmd ::= DROP TRIGGER ifexists fullname */ { - sqlite3DropTrigger(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy192); + tdsqlite3DropTrigger(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy192); } break; case 271: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ { - sqlite3Attach(pParse, yymsp[-3].minor.yy202, yymsp[-1].minor.yy202, yymsp[0].minor.yy202); + tdsqlite3Attach(pParse, yymsp[-3].minor.yy202, yymsp[-1].minor.yy202, yymsp[0].minor.yy202); } break; case 272: /* cmd ::= DETACH database_kw_opt expr */ { - sqlite3Detach(pParse, yymsp[0].minor.yy202); + tdsqlite3Detach(pParse, yymsp[0].minor.yy202); } break; case 275: /* cmd ::= REINDEX */ -{sqlite3Reindex(pParse, 0, 0);} +{tdsqlite3Reindex(pParse, 0, 0);} break; case 276: /* cmd ::= REINDEX nm dbnm */ -{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} +{tdsqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; case 277: /* cmd ::= ANALYZE */ -{sqlite3Analyze(pParse, 0, 0);} +{tdsqlite3Analyze(pParse, 0, 0);} break; case 278: /* cmd ::= ANALYZE nm dbnm */ -{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} +{tdsqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; case 279: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ { - sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy47,&yymsp[0].minor.yy0); + tdsqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy47,&yymsp[0].minor.yy0); } break; case 280: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ { yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; - sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); + tdsqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); } break; case 281: /* add_column_fullname ::= fullname */ { disableLookaside(pParse); - sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy47); + tdsqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy47); } break; case 282: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ { - sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy47, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + tdsqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy47, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; case 283: /* cmd ::= create_vtab */ -{sqlite3VtabFinishParse(pParse,0);} +{tdsqlite3VtabFinishParse(pParse,0);} break; case 284: /* cmd ::= create_vtab LP vtabarglist RP */ -{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} +{tdsqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} break; case 285: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ { - sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy192); + tdsqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy192); } break; case 286: /* vtabarg ::= */ -{sqlite3VtabArgInit(pParse);} +{tdsqlite3VtabArgInit(pParse);} break; case 287: /* vtabargtoken ::= ANY */ case 288: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==288); case 289: /* lp ::= LP */ yytestcase(yyruleno==289); -{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} +{tdsqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} break; case 290: /* with ::= WITH wqlist */ case 291: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==291); -{ sqlite3WithPush(pParse, yymsp[0].minor.yy131, 1); } +{ tdsqlite3WithPush(pParse, yymsp[0].minor.yy131, 1); } break; case 292: /* wqlist ::= nm eidlist_opt AS LP select RP */ { - yymsp[-5].minor.yy131 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539); /*A-overwrites-X*/ + yymsp[-5].minor.yy131 = tdsqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539); /*A-overwrites-X*/ } break; case 293: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ { - yymsp[-7].minor.yy131 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy131, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539); + yymsp[-7].minor.yy131 = tdsqlite3WithAdd(pParse, yymsp[-7].minor.yy131, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539); } break; case 294: /* windowdefn_list ::= windowdefn */ @@ -161294,7 +161294,7 @@ static YYACTIONTYPE yy_reduce( case 295: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ { assert( yymsp[0].minor.yy303!=0 ); - sqlite3WindowChain(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy303); + tdsqlite3WindowChain(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy303); yymsp[0].minor.yy303->pNextWin = yymsp[-2].minor.yy303; yylhsminor.yy303 = yymsp[0].minor.yy303; } @@ -161303,7 +161303,7 @@ static YYACTIONTYPE yy_reduce( case 296: /* windowdefn ::= nm AS LP window RP */ { if( ALWAYS(yymsp[-1].minor.yy303) ){ - yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); + yymsp[-1].minor.yy303->zName = tdsqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); } yylhsminor.yy303 = yymsp[-1].minor.yy303; } @@ -161311,23 +161311,23 @@ static YYACTIONTYPE yy_reduce( break; case 297: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ { - yymsp[-4].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, 0); + yymsp[-4].minor.yy303 = tdsqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, 0); } break; case 298: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ { - yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, &yymsp[-5].minor.yy0); + yylhsminor.yy303 = tdsqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, &yymsp[-5].minor.yy0); } yymsp[-5].minor.yy303 = yylhsminor.yy303; break; case 299: /* window ::= ORDER BY sortlist frame_opt */ { - yymsp[-3].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, 0); + yymsp[-3].minor.yy303 = tdsqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, 0); } break; case 300: /* window ::= nm ORDER BY sortlist frame_opt */ { - yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0); + yylhsminor.yy303 = tdsqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0); } yymsp[-4].minor.yy303 = yylhsminor.yy303; break; @@ -161340,24 +161340,24 @@ static YYACTIONTYPE yy_reduce( break; case 302: /* window ::= nm frame_opt */ { - yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, 0, &yymsp[-1].minor.yy0); + yylhsminor.yy303 = tdsqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, 0, &yymsp[-1].minor.yy0); } yymsp[-1].minor.yy303 = yylhsminor.yy303; break; case 303: /* frame_opt ::= */ { - yymsp[1].minor.yy303 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); + yymsp[1].minor.yy303 = tdsqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); } break; case 304: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ { - yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy192, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy58); + yylhsminor.yy303 = tdsqlite3WindowAlloc(pParse, yymsp[-2].minor.yy192, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy58); } yymsp[-2].minor.yy303 = yylhsminor.yy303; break; case 305: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ { - yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy192, yymsp[-3].minor.yy77.eType, yymsp[-3].minor.yy77.pExpr, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, yymsp[0].minor.yy58); + yylhsminor.yy303 = tdsqlite3WindowAlloc(pParse, yymsp[-5].minor.yy192, yymsp[-3].minor.yy77.eType, yymsp[-3].minor.yy77.pExpr, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, yymsp[0].minor.yy58); } yymsp[-5].minor.yy303 = yylhsminor.yy303; break; @@ -161401,12 +161401,12 @@ static YYACTIONTYPE yy_reduce( break; case 321: /* filter_over ::= filter_clause */ { - yylhsminor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); + yylhsminor.yy303 = (Window*)tdsqlite3DbMallocZero(pParse->db, sizeof(Window)); if( yylhsminor.yy303 ){ yylhsminor.yy303->eFrmType = TK_FILTER; yylhsminor.yy303->pFilter = yymsp[0].minor.yy202; }else{ - sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy202); + tdsqlite3ExprDelete(pParse->db, yymsp[0].minor.yy202); } } yymsp[0].minor.yy303 = yylhsminor.yy303; @@ -161419,9 +161419,9 @@ static YYACTIONTYPE yy_reduce( break; case 323: /* over_clause ::= OVER nm */ { - yymsp[-1].minor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); + yymsp[-1].minor.yy303 = (Window*)tdsqlite3DbMallocZero(pParse->db, sizeof(Window)); if( yymsp[-1].minor.yy303 ){ - yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); + yymsp[-1].minor.yy303->zName = tdsqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); } } break; @@ -161519,8 +161519,8 @@ static YYACTIONTYPE yy_reduce( static void yy_parse_failed( yyParser *yypParser /* The parser */ ){ - sqlite3ParserARG_FETCH - sqlite3ParserCTX_FETCH + tdsqlite3ParserARG_FETCH + tdsqlite3ParserCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); @@ -161531,8 +161531,8 @@ static void yy_parse_failed( ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ - sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ - sqlite3ParserCTX_STORE + tdsqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ + tdsqlite3ParserCTX_STORE } #endif /* YYNOERRORRECOVERY */ @@ -161542,22 +161542,22 @@ static void yy_parse_failed( static void yy_syntax_error( yyParser *yypParser, /* The parser */ int yymajor, /* The major type of the error token */ - sqlite3ParserTOKENTYPE yyminor /* The minor type of the error token */ + tdsqlite3ParserTOKENTYPE yyminor /* The minor type of the error token */ ){ - sqlite3ParserARG_FETCH - sqlite3ParserCTX_FETCH + tdsqlite3ParserARG_FETCH + tdsqlite3ParserCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */ if( TOKEN.z[0] ){ - sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN); + tdsqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN); }else{ - sqlite3ErrorMsg(pParse, "incomplete input"); + tdsqlite3ErrorMsg(pParse, "incomplete input"); } /************ End %syntax_error code ******************************************/ - sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ - sqlite3ParserCTX_STORE + tdsqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ + tdsqlite3ParserCTX_STORE } /* @@ -161566,8 +161566,8 @@ static void yy_syntax_error( static void yy_accept( yyParser *yypParser /* The parser */ ){ - sqlite3ParserARG_FETCH - sqlite3ParserCTX_FETCH + tdsqlite3ParserARG_FETCH + tdsqlite3ParserCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); @@ -161581,13 +161581,13 @@ static void yy_accept( ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ - sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ - sqlite3ParserCTX_STORE + tdsqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ + tdsqlite3ParserCTX_STORE } /* The main parser program. ** The first argument is a pointer to a structure obtained from -** "sqlite3ParserAlloc" which describes the current state of the parser. +** "tdsqlite3ParserAlloc" which describes the current state of the parser. ** The second argument is the major token number. The third is ** the minor token. The fourth optional argument is whatever the ** user wants (and specified in the grammar) and is available for @@ -161604,11 +161604,11 @@ static void yy_accept( ** Outputs: ** None. */ -SQLITE_PRIVATE void sqlite3Parser( +SQLITE_PRIVATE void tdsqlite3Parser( void *yyp, /* The parser */ int yymajor, /* The major token code number */ - sqlite3ParserTOKENTYPE yyminor /* The value for the token */ - sqlite3ParserARG_PDECL /* Optional %extra_argument parameter */ + tdsqlite3ParserTOKENTYPE yyminor /* The value for the token */ + tdsqlite3ParserARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; YYACTIONTYPE yyact; /* The parser action. */ @@ -161619,8 +161619,8 @@ SQLITE_PRIVATE void sqlite3Parser( int yyerrorhit = 0; /* True if yymajor has invoked an error */ #endif yyParser *yypParser = (yyParser*)yyp; /* The parser */ - sqlite3ParserCTX_FETCH - sqlite3ParserARG_STORE + tdsqlite3ParserCTX_FETCH + tdsqlite3ParserARG_STORE assert( yypParser->yytos!=0 ); #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) @@ -161645,7 +161645,7 @@ SQLITE_PRIVATE void sqlite3Parser( yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, - yyminor sqlite3ParserCTX_PARAM); + yyminor tdsqlite3ParserCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); #ifndef YYNOERRORRECOVERY @@ -161778,7 +161778,7 @@ SQLITE_PRIVATE void sqlite3Parser( ** Return the fallback token corresponding to canonical token iToken, or ** 0 if iToken has no fallback. */ -SQLITE_PRIVATE int sqlite3ParserFallback(int iToken){ +SQLITE_PRIVATE int tdsqlite3ParserFallback(int iToken){ #ifdef YYFALLBACK assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); return yyFallback[iToken]; @@ -161812,7 +161812,7 @@ SQLITE_PRIVATE int sqlite3ParserFallback(int iToken){ /* Character classes for tokenizing ** -** In the sqlite3GetToken() function, a switch() on aiClass[c] is implemented +** In the tdsqlite3GetToken() function, a switch() on aiClass[c] is implemented ** using a lookup table, whereas a switch() directly on c uses a binary search. ** The lookup table is much faster. To maximize speed, and to ensure that ** a lookup table is used, all of the classes need to be small integers and @@ -161899,7 +161899,7 @@ static const unsigned char aiClass[] = { ** Used by keywordhash.h */ #ifdef SQLITE_ASCII -# define charMap(X) sqlite3UpperToLower[(unsigned char)X] +# define charMap(X) tdsqlite3UpperToLower[(unsigned char)X] #endif #ifdef SQLITE_EBCDIC # define charMap(X) ebcdicToAscii[(unsigned char)X] @@ -161925,7 +161925,7 @@ const unsigned char ebcdicToAscii[] = { #endif /* -** The sqlite3KeywordCode function looks up an identifier to determine if +** The tdsqlite3KeywordCode function looks up an identifier to determine if ** it is a keyword. If it is a keyword, the token code of that keyword is ** returned. If the input is not a keyword, TK_ID is returned. ** @@ -162393,21 +162393,21 @@ static int keywordCode(const char *z, int n, int *pType){ } return n; } -SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char *z, int n){ +SQLITE_PRIVATE int tdsqlite3KeywordCode(const unsigned char *z, int n){ int id = TK_ID; keywordCode((char*)z, n, &id); return id; } #define SQLITE_N_KEYWORD 145 -SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){ +SQLITE_API int tdsqlite3_keyword_name(int i,const char **pzName,int *pnName){ if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR; *pzName = zKWText + aKWOffset[i]; *pnName = aKWLen[i]; return SQLITE_OK; } -SQLITE_API int sqlite3_keyword_count(void){ return SQLITE_N_KEYWORD; } -SQLITE_API int sqlite3_keyword_check(const char *zName, int nName){ - return TK_ID!=sqlite3KeywordCode((const u8*)zName, nName); +SQLITE_API int tdsqlite3_keyword_count(void){ return SQLITE_N_KEYWORD; } +SQLITE_API int tdsqlite3_keyword_check(const char *zName, int nName){ + return TK_ID!=tdsqlite3KeywordCode((const u8*)zName, nName); } /************** End of keywordhash.h *****************************************/ @@ -162420,7 +162420,7 @@ SQLITE_API int sqlite3_keyword_check(const char *zName, int nName){ ** ** For ASCII, any character with the high-order bit set is ** allowed in an identifier. For 7-bit characters, -** sqlite3IsIdChar[X] must be 1. +** tdsqlite3IsIdChar[X] must be 1. ** ** For EBCDIC, the rules are more complex but have the same ** end result. @@ -162431,10 +162431,10 @@ SQLITE_API int sqlite3_keyword_check(const char *zName, int nName){ ** But the feature is undocumented. */ #ifdef SQLITE_ASCII -#define IdChar(C) ((sqlite3CtypeMap[(unsigned char)C]&0x46)!=0) +#define IdChar(C) ((tdsqlite3CtypeMap[(unsigned char)C]&0x46)!=0) #endif #ifdef SQLITE_EBCDIC -SQLITE_PRIVATE const char sqlite3IsEbcdicIdChar[] = { +SQLITE_PRIVATE const char tdsqlite3IsEbcdicIdChar[] = { /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* 4x */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, /* 5x */ @@ -162449,11 +162449,11 @@ SQLITE_PRIVATE const char sqlite3IsEbcdicIdChar[] = { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, /* Ex */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, /* Fx */ }; -#define IdChar(C) (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40])) +#define IdChar(C) (((c=C)>=0x42 && tdsqlite3IsEbcdicIdChar[c-0x40])) #endif /* Make the IdChar function accessible from ctime.c and alter.c */ -SQLITE_PRIVATE int sqlite3IsIdChar(u8 c){ return IdChar(c); } +SQLITE_PRIVATE int tdsqlite3IsIdChar(u8 c){ return IdChar(c); } #ifndef SQLITE_OMIT_WINDOWFUNC /* @@ -162464,14 +162464,14 @@ static int getToken(const unsigned char **pz){ const unsigned char *z = *pz; int t; /* Token type to return */ do { - z += sqlite3GetToken(z, &t); + z += tdsqlite3GetToken(z, &t); }while( t==TK_SPACE ); if( t==TK_ID || t==TK_STRING || t==TK_JOIN_KW || t==TK_WINDOW || t==TK_OVER - || sqlite3ParserFallback(t)==TK_ID + || tdsqlite3ParserFallback(t)==TK_ID ){ t = TK_ID; } @@ -162536,7 +162536,7 @@ static int analyzeFilterKeyword(const unsigned char *z, int lastToken){ ** Return the length (in bytes) of the token that begins at z[0]. ** Store the token type in *tokenType before returning. */ -SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ +SQLITE_PRIVATE int tdsqlite3GetToken(const unsigned char *z, int *tokenType){ int i, c; switch( aiClass[*z] ){ /* Switch on the character-class of the first byte ** of the token. See the comment on the CC_ defines @@ -162547,7 +162547,7 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ testcase( z[0]=='\n' ); testcase( z[0]=='\f' ); testcase( z[0]=='\r' ); - for(i=1; sqlite3Isspace(z[i]); i++){} + for(i=1; tdsqlite3Isspace(z[i]); i++){} *tokenType = TK_SPACE; return i; } @@ -162682,7 +162682,7 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ } case CC_DOT: { #ifndef SQLITE_OMIT_FLOATING_POINT - if( !sqlite3Isdigit(z[1]) ) + if( !tdsqlite3Isdigit(z[1]) ) #endif { *tokenType = TK_DOT; @@ -162698,25 +162698,25 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ testcase( z[0]=='9' ); *tokenType = TK_INTEGER; #ifndef SQLITE_OMIT_HEX_INTEGER - if( z[0]=='0' && (z[1]=='x' || z[1]=='X') && sqlite3Isxdigit(z[2]) ){ - for(i=3; sqlite3Isxdigit(z[i]); i++){} + if( z[0]=='0' && (z[1]=='x' || z[1]=='X') && tdsqlite3Isxdigit(z[2]) ){ + for(i=3; tdsqlite3Isxdigit(z[i]); i++){} return i; } #endif - for(i=0; sqlite3Isdigit(z[i]); i++){} + for(i=0; tdsqlite3Isdigit(z[i]); i++){} #ifndef SQLITE_OMIT_FLOATING_POINT if( z[i]=='.' ){ i++; - while( sqlite3Isdigit(z[i]) ){ i++; } + while( tdsqlite3Isdigit(z[i]) ){ i++; } *tokenType = TK_FLOAT; } if( (z[i]=='e' || z[i]=='E') && - ( sqlite3Isdigit(z[i+1]) - || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2])) + ( tdsqlite3Isdigit(z[i+1]) + || ((z[i+1]=='+' || z[i+1]=='-') && tdsqlite3Isdigit(z[i+2])) ) ){ i += 2; - while( sqlite3Isdigit(z[i]) ){ i++; } + while( tdsqlite3Isdigit(z[i]) ){ i++; } *tokenType = TK_FLOAT; } #endif @@ -162733,7 +162733,7 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ } case CC_VARNUM: { *tokenType = TK_VARIABLE; - for(i=1; sqlite3Isdigit(z[i]); i++){} + for(i=1; tdsqlite3Isdigit(z[i]); i++){} return i; } case CC_DOLLAR: @@ -162749,7 +162749,7 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ }else if( c=='(' && n>0 ){ do{ i++; - }while( (c=z[i])!=0 && !sqlite3Isspace(c) && c!=')' ); + }while( (c=z[i])!=0 && !tdsqlite3Isspace(c) && c!=')' ); if( c==')' ){ i++; }else{ @@ -162783,7 +162783,7 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ testcase( z[0]=='x' ); testcase( z[0]=='X' ); if( z[1]=='\'' ){ *tokenType = TK_BLOB; - for(i=2; sqlite3Isxdigit(z[i]); i++){} + for(i=2; tdsqlite3Isxdigit(z[i]); i++){} if( z[i]!='\'' || i%2 ){ *tokenType = TK_ILLEGAL; while( z[i] && z[i]!='\'' ){ i++; } @@ -162817,18 +162817,18 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ ** Run the parser on the given SQL string. The parser structure is ** passed in. An SQLITE_ status code is returned. If an error occurs ** then an and attempt is made to write an error message into -** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that +** memory obtained from tdsqlite3_malloc() and to make *pzErrMsg point to that ** error message. */ -SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ +SQLITE_PRIVATE int tdsqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ int nErr = 0; /* Number of errors encountered */ void *pEngine; /* The LEMON-generated LALR(1) parser */ int n = 0; /* Length of the next token token */ int tokenType; /* type of the next token */ int lastTokenParsed = -1; /* type of the previous token */ - sqlite3 *db = pParse->db; /* The database connection */ + tdsqlite3 *db = pParse->db; /* The database connection */ int mxSqlLen; /* Max length of an SQL string */ -#ifdef sqlite3Parser_ENGINEALWAYSONSTACK +#ifdef tdsqlite3Parser_ENGINEALWAYSONSTACK yyParser sEngine; /* Space to hold the Lemon-generated Parser object */ #endif VVA_ONLY( u8 startedWithOom = db->mallocFailed ); @@ -162844,18 +162844,18 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr #ifdef SQLITE_DEBUG if( db->flags & SQLITE_ParserTrace ){ printf("parser: [[[%s]]]\n", zSql); - sqlite3ParserTrace(stdout, "parser: "); + tdsqlite3ParserTrace(stdout, "parser: "); }else{ - sqlite3ParserTrace(0, 0); + tdsqlite3ParserTrace(0, 0); } #endif -#ifdef sqlite3Parser_ENGINEALWAYSONSTACK +#ifdef tdsqlite3Parser_ENGINEALWAYSONSTACK pEngine = &sEngine; - sqlite3ParserInit(pEngine, pParse); + tdsqlite3ParserInit(pEngine, pParse); #else - pEngine = sqlite3ParserAlloc(sqlite3Malloc, pParse); + pEngine = tdsqlite3ParserAlloc(tdsqlite3Malloc, pParse); if( pEngine==0 ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); return SQLITE_NOMEM_BKPT; } #endif @@ -162866,7 +162866,7 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr pParse->pParentParse = db->pParse; db->pParse = pParse; while( 1 ){ - n = sqlite3GetToken((u8*)zSql, &tokenType); + n = tdsqlite3GetToken((u8*)zSql, &tokenType); mxSqlLen -= n; if( mxSqlLen<0 ){ pParse->rc = SQLITE_TOOBIG; @@ -162912,13 +162912,13 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr tokenType = analyzeFilterKeyword((const u8*)&zSql[6], lastTokenParsed); #endif /* SQLITE_OMIT_WINDOWFUNC */ }else{ - sqlite3ErrorMsg(pParse, "unrecognized token: \"%.*s\"", n, zSql); + tdsqlite3ErrorMsg(pParse, "unrecognized token: \"%.*s\"", n, zSql); break; } } pParse->sLastToken.z = zSql; pParse->sLastToken.n = n; - sqlite3Parser(pEngine, tokenType, pParse->sLastToken); + tdsqlite3Parser(pEngine, tokenType, pParse->sLastToken); lastTokenParsed = tokenType; zSql += n; assert( db->mallocFailed==0 || pParse->rc!=SQLITE_OK || startedWithOom ); @@ -162926,45 +162926,45 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr } assert( nErr==0 ); #ifdef YYTRACKMAXSTACKDEPTH - sqlite3_mutex_enter(sqlite3MallocMutex()); - sqlite3StatusHighwater(SQLITE_STATUS_PARSER_STACK, - sqlite3ParserStackPeak(pEngine) + tdsqlite3_mutex_enter(tdsqlite3MallocMutex()); + tdsqlite3StatusHighwater(SQLITE_STATUS_PARSER_STACK, + tdsqlite3ParserStackPeak(pEngine) ); - sqlite3_mutex_leave(sqlite3MallocMutex()); + tdsqlite3_mutex_leave(tdsqlite3MallocMutex()); #endif /* YYDEBUG */ -#ifdef sqlite3Parser_ENGINEALWAYSONSTACK - sqlite3ParserFinalize(pEngine); +#ifdef tdsqlite3Parser_ENGINEALWAYSONSTACK + tdsqlite3ParserFinalize(pEngine); #else - sqlite3ParserFree(pEngine, sqlite3_free); + tdsqlite3ParserFree(pEngine, tdsqlite3_free); #endif if( db->mallocFailed ){ pParse->rc = SQLITE_NOMEM_BKPT; } if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){ - pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc)); + pParse->zErrMsg = tdsqlite3MPrintf(db, "%s", tdsqlite3ErrStr(pParse->rc)); } assert( pzErrMsg!=0 ); if( pParse->zErrMsg ){ *pzErrMsg = pParse->zErrMsg; - sqlite3_log(pParse->rc, "%s in \"%s\"", + tdsqlite3_log(pParse->rc, "%s in \"%s\"", *pzErrMsg, pParse->zTail); pParse->zErrMsg = 0; nErr++; } pParse->zTail = zSql; if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){ - sqlite3VdbeDelete(pParse->pVdbe); + tdsqlite3VdbeDelete(pParse->pVdbe); pParse->pVdbe = 0; } #ifndef SQLITE_OMIT_SHARED_CACHE if( pParse->nested==0 ){ - sqlite3DbFree(db, pParse->aTableLock); + tdsqlite3DbFree(db, pParse->aTableLock); pParse->aTableLock = 0; pParse->nTableLock = 0; } #endif #ifndef SQLITE_OMIT_VIRTUALTABLE - sqlite3_free(pParse->apVtabLock); + tdsqlite3_free(pParse->apVtabLock); #endif if( !IN_SPECIAL_PARSE ){ @@ -162972,23 +162972,23 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr ** structure built up in pParse->pNewTable. The calling code (see vtab.c) ** will take responsibility for freeing the Table structure. */ - sqlite3DeleteTable(db, pParse->pNewTable); + tdsqlite3DeleteTable(db, pParse->pNewTable); } if( !IN_RENAME_OBJECT ){ - sqlite3DeleteTrigger(db, pParse->pNewTrigger); + tdsqlite3DeleteTrigger(db, pParse->pNewTrigger); } - if( pParse->pWithToFree ) sqlite3WithDelete(db, pParse->pWithToFree); - sqlite3DbFree(db, pParse->pVList); + if( pParse->pWithToFree ) tdsqlite3WithDelete(db, pParse->pWithToFree); + tdsqlite3DbFree(db, pParse->pVList); while( pParse->pAinc ){ AutoincInfo *p = pParse->pAinc; pParse->pAinc = p->pNext; - sqlite3DbFreeNN(db, p); + tdsqlite3DbFreeNN(db, p); } while( pParse->pZombieTab ){ Table *p = pParse->pZombieTab; pParse->pZombieTab = p->pNextZombie; - sqlite3DeleteTable(db, p); + tdsqlite3DeleteTable(db, p); } db->pParse = pParse->pParentParse; pParse->pParentParse = 0; @@ -163002,22 +163002,22 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr ** Insert a single space character into pStr if the current string ** ends with an identifier */ -static void addSpaceSeparator(sqlite3_str *pStr){ - if( pStr->nChar && sqlite3IsIdChar(pStr->zText[pStr->nChar-1]) ){ - sqlite3_str_append(pStr, " ", 1); +static void addSpaceSeparator(tdsqlite3_str *pStr){ + if( pStr->nChar && tdsqlite3IsIdChar(pStr->zText[pStr->nChar-1]) ){ + tdsqlite3_str_append(pStr, " ", 1); } } /* ** Compute a normalization of the SQL given by zSql[0..nSql-1]. Return -** the normalization in space obtained from sqlite3DbMalloc(). Or return +** the normalization in space obtained from tdsqlite3DbMalloc(). Or return ** NULL if anything goes wrong or if zSql is NULL. */ -SQLITE_PRIVATE char *sqlite3Normalize( +SQLITE_PRIVATE char *tdsqlite3Normalize( Vdbe *pVdbe, /* VM being reprepared */ const char *zSql /* The original SQL string */ ){ - sqlite3 *db; /* The database connection */ + tdsqlite3 *db; /* The database connection */ int i; /* Next unread byte of zSql[] */ int n; /* length of current token */ int tokenType; /* type of current token */ @@ -163026,18 +163026,18 @@ SQLITE_PRIVATE char *sqlite3Normalize( int iStartIN; /* Start of RHS of IN operator in z[] */ int nParenAtIN; /* Value of nParent at start of RHS of IN operator */ u32 j; /* Bytes of normalized SQL generated so far */ - sqlite3_str *pStr; /* The normalized SQL string under construction */ + tdsqlite3_str *pStr; /* The normalized SQL string under construction */ - db = sqlite3VdbeDb(pVdbe); + db = tdsqlite3VdbeDb(pVdbe); tokenType = -1; nParen = iStartIN = nParenAtIN = 0; - pStr = sqlite3_str_new(db); - assert( pStr!=0 ); /* sqlite3_str_new() never returns NULL */ + pStr = tdsqlite3_str_new(db); + assert( pStr!=0 ); /* tdsqlite3_str_new() never returns NULL */ for(i=0; zSql[i] && pStr->accError==0; i+=n){ if( tokenType!=TK_SPACE ){ prevType = tokenType; } - n = sqlite3GetToken((unsigned char*)zSql+i, &tokenType); + n = tdsqlite3GetToken((unsigned char*)zSql+i, &tokenType); if( NEVER(n<=0) ) break; switch( tokenType ){ case TK_SPACE: { @@ -163045,7 +163045,7 @@ SQLITE_PRIVATE char *sqlite3Normalize( } case TK_NULL: { if( prevType==TK_IS || prevType==TK_NOT ){ - sqlite3_str_append(pStr, " NULL", 5); + tdsqlite3_str_append(pStr, " NULL", 5); break; } /* Fall through */ @@ -163055,7 +163055,7 @@ SQLITE_PRIVATE char *sqlite3Normalize( case TK_FLOAT: case TK_VARIABLE: case TK_BLOB: { - sqlite3_str_append(pStr, "?", 1); + tdsqlite3_str_append(pStr, "?", 1); break; } case TK_LP: { @@ -163064,48 +163064,48 @@ SQLITE_PRIVATE char *sqlite3Normalize( iStartIN = pStr->nChar; nParenAtIN = nParen; } - sqlite3_str_append(pStr, "(", 1); + tdsqlite3_str_append(pStr, "(", 1); break; } case TK_RP: { if( iStartIN>0 && nParen==nParenAtIN ){ assert( pStr->nChar>=(u32)iStartIN ); pStr->nChar = iStartIN+1; - sqlite3_str_append(pStr, "?,?,?", 5); + tdsqlite3_str_append(pStr, "?,?,?", 5); iStartIN = 0; } nParen--; - sqlite3_str_append(pStr, ")", 1); + tdsqlite3_str_append(pStr, ")", 1); break; } case TK_ID: { iStartIN = 0; j = pStr->nChar; - if( sqlite3Isquote(zSql[i]) ){ - char *zId = sqlite3DbStrNDup(db, zSql+i, n); + if( tdsqlite3Isquote(zSql[i]) ){ + char *zId = tdsqlite3DbStrNDup(db, zSql+i, n); int nId; int eType = 0; if( zId==0 ) break; - sqlite3Dequote(zId); - if( zSql[i]=='"' && sqlite3VdbeUsesDoubleQuotedString(pVdbe, zId) ){ - sqlite3_str_append(pStr, "?", 1); - sqlite3DbFree(db, zId); + tdsqlite3Dequote(zId); + if( zSql[i]=='"' && tdsqlite3VdbeUsesDoubleQuotedString(pVdbe, zId) ){ + tdsqlite3_str_append(pStr, "?", 1); + tdsqlite3DbFree(db, zId); break; } - nId = sqlite3Strlen30(zId); - if( sqlite3GetToken((u8*)zId, &eType)==nId && eType==TK_ID ){ + nId = tdsqlite3Strlen30(zId); + if( tdsqlite3GetToken((u8*)zId, &eType)==nId && eType==TK_ID ){ addSpaceSeparator(pStr); - sqlite3_str_append(pStr, zId, nId); + tdsqlite3_str_append(pStr, zId, nId); }else{ - sqlite3_str_appendf(pStr, "\"%w\"", zId); + tdsqlite3_str_appendf(pStr, "\"%w\"", zId); } - sqlite3DbFree(db, zId); + tdsqlite3DbFree(db, zId); }else{ addSpaceSeparator(pStr); - sqlite3_str_append(pStr, zSql+i, n); + tdsqlite3_str_append(pStr, zSql+i, n); } while( jnChar ){ - pStr->zText[j] = sqlite3Tolower(pStr->zText[j]); + pStr->zText[j] = tdsqlite3Tolower(pStr->zText[j]); j++; } break; @@ -163115,19 +163115,19 @@ SQLITE_PRIVATE char *sqlite3Normalize( /* fall through */ } default: { - if( sqlite3IsIdChar(zSql[i]) ) addSpaceSeparator(pStr); + if( tdsqlite3IsIdChar(zSql[i]) ) addSpaceSeparator(pStr); j = pStr->nChar; - sqlite3_str_append(pStr, zSql+i, n); + tdsqlite3_str_append(pStr, zSql+i, n); while( jnChar ){ - pStr->zText[j] = sqlite3Toupper(pStr->zText[j]); + pStr->zText[j] = tdsqlite3Toupper(pStr->zText[j]); j++; } break; } } } - if( tokenType!=TK_SEMI ) sqlite3_str_append(pStr, ";", 1); - return sqlite3_str_finish(pStr); + if( tokenType!=TK_SEMI ) tdsqlite3_str_append(pStr, ";", 1); + return tdsqlite3_str_finish(pStr); } #endif /* SQLITE_ENABLE_NORMALIZE */ @@ -163146,7 +163146,7 @@ SQLITE_PRIVATE char *sqlite3Normalize( ************************************************************************* ** An tokenizer for SQL ** -** This file contains C code that implements the sqlite3_complete() API. +** This file contains C code that implements the tdsqlite3_complete() API. ** This code used to be part of the tokenizer.c source file. But by ** separating it out, the code will be automatically omitted from ** static links that do not use it. @@ -163159,17 +163159,17 @@ SQLITE_PRIVATE char *sqlite3Normalize( */ #ifndef SQLITE_AMALGAMATION #ifdef SQLITE_ASCII -#define IdChar(C) ((sqlite3CtypeMap[(unsigned char)C]&0x46)!=0) +#define IdChar(C) ((tdsqlite3CtypeMap[(unsigned char)C]&0x46)!=0) #endif #ifdef SQLITE_EBCDIC -SQLITE_PRIVATE const char sqlite3IsEbcdicIdChar[]; -#define IdChar(C) (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40])) +SQLITE_PRIVATE const char tdsqlite3IsEbcdicIdChar[]; +#define IdChar(C) (((c=C)>=0x42 && tdsqlite3IsEbcdicIdChar[c-0x40])) #endif #endif /* SQLITE_AMALGAMATION */ /* -** Token types used by the sqlite3_complete() routine. See the header +** Token types used by the tdsqlite3_complete() routine. See the header ** comments on that procedure for additional information. */ #define tkSEMI 0 @@ -163236,7 +163236,7 @@ SQLITE_PRIVATE const char sqlite3IsEbcdicIdChar[]; ** to recognize the end of a trigger can be omitted. All we have to do ** is look for a semicolon that is not part of an string or comment. */ -SQLITE_API int sqlite3_complete(const char *zSql){ +SQLITE_API int tdsqlite3_complete(const char *zSql){ u8 state = 0; /* Current state, using numbers defined in header comment */ u8 token; /* Value of the next token */ @@ -163342,7 +163342,7 @@ SQLITE_API int sqlite3_complete(const char *zSql){ #else switch( *zSql ){ case 'c': case 'C': { - if( nId==6 && sqlite3StrNICmp(zSql, "create", 6)==0 ){ + if( nId==6 && tdsqlite3StrNICmp(zSql, "create", 6)==0 ){ token = tkCREATE; }else{ token = tkOTHER; @@ -163350,11 +163350,11 @@ SQLITE_API int sqlite3_complete(const char *zSql){ break; } case 't': case 'T': { - if( nId==7 && sqlite3StrNICmp(zSql, "trigger", 7)==0 ){ + if( nId==7 && tdsqlite3StrNICmp(zSql, "trigger", 7)==0 ){ token = tkTRIGGER; - }else if( nId==4 && sqlite3StrNICmp(zSql, "temp", 4)==0 ){ + }else if( nId==4 && tdsqlite3StrNICmp(zSql, "temp", 4)==0 ){ token = tkTEMP; - }else if( nId==9 && sqlite3StrNICmp(zSql, "temporary", 9)==0 ){ + }else if( nId==9 && tdsqlite3StrNICmp(zSql, "temporary", 9)==0 ){ token = tkTEMP; }else{ token = tkOTHER; @@ -163362,11 +163362,11 @@ SQLITE_API int sqlite3_complete(const char *zSql){ break; } case 'e': case 'E': { - if( nId==3 && sqlite3StrNICmp(zSql, "end", 3)==0 ){ + if( nId==3 && tdsqlite3StrNICmp(zSql, "end", 3)==0 ){ token = tkEND; }else #ifndef SQLITE_OMIT_EXPLAIN - if( nId==7 && sqlite3StrNICmp(zSql, "explain", 7)==0 ){ + if( nId==7 && tdsqlite3StrNICmp(zSql, "explain", 7)==0 ){ token = tkEXPLAIN; }else #endif @@ -163397,28 +163397,28 @@ SQLITE_API int sqlite3_complete(const char *zSql){ #ifndef SQLITE_OMIT_UTF16 /* -** This routine is the same as the sqlite3_complete() routine described +** This routine is the same as the tdsqlite3_complete() routine described ** above, except that the parameter is required to be UTF-16 encoded, not ** UTF-8. */ -SQLITE_API int sqlite3_complete16(const void *zSql){ - sqlite3_value *pVal; +SQLITE_API int tdsqlite3_complete16(const void *zSql){ + tdsqlite3_value *pVal; char const *zSql8; int rc; #ifndef SQLITE_OMIT_AUTOINIT - rc = sqlite3_initialize(); + rc = tdsqlite3_initialize(); if( rc ) return rc; #endif - pVal = sqlite3ValueNew(0); - sqlite3ValueSetStr(pVal, -1, zSql, SQLITE_UTF16NATIVE, SQLITE_STATIC); - zSql8 = sqlite3ValueText(pVal, SQLITE_UTF8); + pVal = tdsqlite3ValueNew(0); + tdsqlite3ValueSetStr(pVal, -1, zSql, SQLITE_UTF16NATIVE, SQLITE_STATIC); + zSql8 = tdsqlite3ValueText(pVal, SQLITE_UTF8); if( zSql8 ){ - rc = sqlite3_complete(zSql8); + rc = tdsqlite3_complete(zSql8); }else{ rc = SQLITE_NOMEM_BKPT; } - sqlite3ValueFree(pVal); + tdsqlite3ValueFree(pVal); return rc & 0xff; } #endif /* SQLITE_OMIT_UTF16 */ @@ -163460,7 +163460,7 @@ SQLITE_API int sqlite3_complete16(const void *zSql){ ****************************************************************************** ** ** This header file is used by programs that want to link against the -** FTS3 library. All it does is declare the sqlite3Fts3Init() interface. +** FTS3 library. All it does is declare the tdsqlite3Fts3Init() interface. */ /* #include "sqlite3.h" */ @@ -163468,7 +163468,7 @@ SQLITE_API int sqlite3_complete16(const void *zSql){ extern "C" { #endif /* __cplusplus */ -SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db); +SQLITE_PRIVATE int tdsqlite3Fts3Init(tdsqlite3 *db); #if 0 } /* extern "C" */ @@ -163493,7 +163493,7 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db); ****************************************************************************** ** ** This header file is used by programs that want to link against the -** RTREE library. All it does is declare the sqlite3RtreeInit() interface. +** RTREE library. All it does is declare the tdsqlite3RtreeInit() interface. */ /* #include "sqlite3.h" */ @@ -163505,7 +163505,7 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db); extern "C" { #endif /* __cplusplus */ -SQLITE_PRIVATE int sqlite3RtreeInit(sqlite3 *db); +SQLITE_PRIVATE int tdsqlite3RtreeInit(tdsqlite3 *db); #if 0 } /* extern "C" */ @@ -163530,7 +163530,7 @@ SQLITE_PRIVATE int sqlite3RtreeInit(sqlite3 *db); ****************************************************************************** ** ** This header file is used by programs that want to link against the -** ICU extension. All it does is declare the sqlite3IcuInit() interface. +** ICU extension. All it does is declare the tdsqlite3IcuInit() interface. */ /* #include "sqlite3.h" */ @@ -163538,7 +163538,7 @@ SQLITE_PRIVATE int sqlite3RtreeInit(sqlite3 *db); extern "C" { #endif /* __cplusplus */ -SQLITE_PRIVATE int sqlite3IcuInit(sqlite3 *db); +SQLITE_PRIVATE int tdsqlite3IcuInit(tdsqlite3 *db); #if 0 } /* extern "C" */ @@ -163549,45 +163549,45 @@ SQLITE_PRIVATE int sqlite3IcuInit(sqlite3 *db); /************** Continuing where we left off in main.c ***********************/ #endif #ifdef SQLITE_ENABLE_JSON1 -SQLITE_PRIVATE int sqlite3Json1Init(sqlite3*); +SQLITE_PRIVATE int tdsqlite3Json1Init(tdsqlite3*); #endif #ifdef SQLITE_ENABLE_STMTVTAB -SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3*); +SQLITE_PRIVATE int tdsqlite3StmtVtabInit(tdsqlite3*); #endif #ifdef SQLITE_ENABLE_FTS5 -SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3*); +SQLITE_PRIVATE int tdsqlite3Fts5Init(tdsqlite3*); #endif #ifndef SQLITE_AMALGAMATION -/* IMPLEMENTATION-OF: R-46656-45156 The sqlite3_version[] string constant +/* IMPLEMENTATION-OF: R-46656-45156 The tdsqlite3_version[] string constant ** contains the text of SQLITE_VERSION macro. */ -SQLITE_API const char sqlite3_version[] = SQLITE_VERSION; +SQLITE_API const char tdsqlite3_version[] = SQLITE_VERSION; #endif -/* IMPLEMENTATION-OF: R-53536-42575 The sqlite3_libversion() function returns -** a pointer to the to the sqlite3_version[] string constant. +/* IMPLEMENTATION-OF: R-53536-42575 The tdsqlite3_libversion() function returns +** a pointer to the to the tdsqlite3_version[] string constant. */ -SQLITE_API const char *sqlite3_libversion(void){ return sqlite3_version; } +SQLITE_API const char *tdsqlite3_libversion(void){ return tdsqlite3_version; } -/* IMPLEMENTATION-OF: R-25063-23286 The sqlite3_sourceid() function returns a +/* IMPLEMENTATION-OF: R-25063-23286 The tdsqlite3_sourceid() function returns a ** pointer to a string constant whose value is the same as the ** SQLITE_SOURCE_ID C preprocessor macro. Except if SQLite is built using ** an edited copy of the amalgamation, then the last four characters of ** the hash might be different from SQLITE_SOURCE_ID. */ -/* SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } */ +/* SQLITE_API const char *tdsqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } */ -/* IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function +/* IMPLEMENTATION-OF: R-35210-63508 The tdsqlite3_libversion_number() function ** returns an integer equal to SQLITE_VERSION_NUMBER. */ -SQLITE_API int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; } +SQLITE_API int tdsqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; } -/* IMPLEMENTATION-OF: R-20790-14025 The sqlite3_threadsafe() function returns +/* IMPLEMENTATION-OF: R-20790-14025 The tdsqlite3_threadsafe() function returns ** zero if and only if SQLite was compiled with mutexing code omitted due to ** the SQLITE_THREADSAFE compile-time option being set to 0. */ -SQLITE_API int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; } +SQLITE_API int tdsqlite3_threadsafe(void){ return SQLITE_THREADSAFE; } /* ** When compiling the test fixture or with debugging enabled (on Win32), @@ -163598,7 +163598,7 @@ SQLITE_API int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; } # ifndef SQLITE_DEBUG_OS_TRACE # define SQLITE_DEBUG_OS_TRACE 0 # endif - int sqlite3OSTrace = SQLITE_DEBUG_OS_TRACE; + int tdsqlite3OSTrace = SQLITE_DEBUG_OS_TRACE; #endif #if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE) @@ -163608,7 +163608,7 @@ SQLITE_API int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; } ** I/O active are written using this function. These messages ** are intended for debugging activity only. */ -SQLITE_API void (SQLITE_CDECL *sqlite3IoTrace)(const char*, ...) = 0; +SQLITE_API void (SQLITE_CDECL *tdsqlite3IoTrace)(const char*, ...) = 0; #endif /* @@ -163618,7 +163618,7 @@ SQLITE_API void (SQLITE_CDECL *sqlite3IoTrace)(const char*, ...) = 0; ** ** See also the "PRAGMA temp_store_directory" SQL command. */ -SQLITE_API char *sqlite3_temp_directory = 0; +SQLITE_API char *tdsqlite3_temp_directory = 0; /* ** If the following global variable points to a string which is the @@ -163627,7 +163627,7 @@ SQLITE_API char *sqlite3_temp_directory = 0; ** ** See also the "PRAGMA data_store_directory" SQL command. */ -SQLITE_API char *sqlite3_data_directory = 0; +SQLITE_API char *tdsqlite3_data_directory = 0; /* ** Initialize SQLite. @@ -163636,10 +163636,10 @@ SQLITE_API char *sqlite3_data_directory = 0; ** VFS, and mutex subsystems prior to doing any serious work with ** SQLite. But as long as you do not compile with SQLITE_OMIT_AUTOINIT ** this routine will be called automatically by key routines such as -** sqlite3_open(). +** tdsqlite3_open(). ** ** This routine is a no-op except on its very first call for the process, -** or for the first call after a call to sqlite3_shutdown. +** or for the first call after a call to tdsqlite3_shutdown. ** ** The first thread to call this routine runs the initialization to ** completion. If subsequent threads call this routine before the first @@ -163660,15 +163660,15 @@ SQLITE_API char *sqlite3_data_directory = 0; ** * Recursive calls to this routine from thread X return immediately ** without blocking. */ -SQLITE_API int sqlite3_initialize(void){ - MUTEX_LOGIC( sqlite3_mutex *pMaster; ) /* The main static mutex */ +SQLITE_API int tdsqlite3_initialize(void){ + MUTEX_LOGIC( tdsqlite3_mutex *pMaster; ) /* The main static mutex */ int rc; /* Result code */ #ifdef SQLITE_EXTRA_INIT int bRunExtraInit = 0; /* Extra initialization needed */ #endif #ifdef SQLITE_OMIT_WSD - rc = sqlite3_wsd_init(4096, 24); + rc = tdsqlite3_wsd_init(4096, 24); if( rc!=SQLITE_OK ){ return rc; } @@ -163680,11 +163680,11 @@ SQLITE_API int sqlite3_initialize(void){ assert( SQLITE_PTRSIZE==sizeof(char*) ); /* If SQLite is already completely initialized, then this call - ** to sqlite3_initialize() should be a no-op. But the initialization + ** to tdsqlite3_initialize() should be a no-op. But the initialization ** must be complete. So isInit must not be set until the very end ** of this routine. */ - if( sqlite3GlobalConfig.isInit ) return SQLITE_OK; + if( tdsqlite3GlobalConfig.isInit ) return SQLITE_OK; /* Make sure the mutex subsystem is initialized. If unable to ** initialize the mutex subsystem, return early with the error. @@ -163694,7 +163694,7 @@ SQLITE_API int sqlite3_initialize(void){ ** The mutex subsystem must take care of serializing its own ** initialization. */ - rc = sqlite3MutexInit(); + rc = tdsqlite3MutexInit(); if( rc ) return rc; /* Initialize the malloc() system and the recursive pInitMutex mutex. @@ -163703,26 +163703,26 @@ SQLITE_API int sqlite3_initialize(void){ ** malloc subsystem - this implies that the allocation of a static ** mutex must not require support from the malloc subsystem. */ - MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) - sqlite3_mutex_enter(pMaster); - sqlite3GlobalConfig.isMutexInit = 1; - if( !sqlite3GlobalConfig.isMallocInit ){ - rc = sqlite3MallocInit(); + MUTEX_LOGIC( pMaster = tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) + tdsqlite3_mutex_enter(pMaster); + tdsqlite3GlobalConfig.isMutexInit = 1; + if( !tdsqlite3GlobalConfig.isMallocInit ){ + rc = tdsqlite3MallocInit(); } if( rc==SQLITE_OK ){ - sqlite3GlobalConfig.isMallocInit = 1; - if( !sqlite3GlobalConfig.pInitMutex ){ - sqlite3GlobalConfig.pInitMutex = - sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE); - if( sqlite3GlobalConfig.bCoreMutex && !sqlite3GlobalConfig.pInitMutex ){ + tdsqlite3GlobalConfig.isMallocInit = 1; + if( !tdsqlite3GlobalConfig.pInitMutex ){ + tdsqlite3GlobalConfig.pInitMutex = + tdsqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE); + if( tdsqlite3GlobalConfig.bCoreMutex && !tdsqlite3GlobalConfig.pInitMutex ){ rc = SQLITE_NOMEM_BKPT; } } } if( rc==SQLITE_OK ){ - sqlite3GlobalConfig.nRefInitMutex++; + tdsqlite3GlobalConfig.nRefInitMutex++; } - sqlite3_mutex_leave(pMaster); + tdsqlite3_mutex_leave(pMaster); /* If rc is not SQLITE_OK at this point, then either the malloc ** subsystem could not be initialized or the system failed to allocate @@ -163733,63 +163733,63 @@ SQLITE_API int sqlite3_initialize(void){ /* Do the rest of the initialization under the recursive mutex so ** that we will be able to handle recursive calls into - ** sqlite3_initialize(). The recursive calls normally come through - ** sqlite3_os_init() when it invokes sqlite3_vfs_register(), but other + ** tdsqlite3_initialize(). The recursive calls normally come through + ** tdsqlite3_os_init() when it invokes tdsqlite3_vfs_register(), but other ** recursive calls might also be possible. ** ** IMPLEMENTATION-OF: R-00140-37445 SQLite automatically serializes calls ** to the xInit method, so the xInit method need not be threadsafe. ** ** The following mutex is what serializes access to the appdef pcache xInit - ** methods. The sqlite3_pcache_methods.xInit() all is embedded in the - ** call to sqlite3PcacheInitialize(). + ** methods. The tdsqlite3_pcache_methods.xInit() all is embedded in the + ** call to tdsqlite3PcacheInitialize(). */ - sqlite3_mutex_enter(sqlite3GlobalConfig.pInitMutex); - if( sqlite3GlobalConfig.isInit==0 && sqlite3GlobalConfig.inProgress==0 ){ - sqlite3GlobalConfig.inProgress = 1; + tdsqlite3_mutex_enter(tdsqlite3GlobalConfig.pInitMutex); + if( tdsqlite3GlobalConfig.isInit==0 && tdsqlite3GlobalConfig.inProgress==0 ){ + tdsqlite3GlobalConfig.inProgress = 1; #ifdef SQLITE_ENABLE_SQLLOG { - extern void sqlite3_init_sqllog(void); - sqlite3_init_sqllog(); + extern void tdsqlite3_init_sqllog(void); + tdsqlite3_init_sqllog(); } #endif - memset(&sqlite3BuiltinFunctions, 0, sizeof(sqlite3BuiltinFunctions)); - sqlite3RegisterBuiltinFunctions(); - if( sqlite3GlobalConfig.isPCacheInit==0 ){ - rc = sqlite3PcacheInitialize(); + memset(&tdsqlite3BuiltinFunctions, 0, sizeof(tdsqlite3BuiltinFunctions)); + tdsqlite3RegisterBuiltinFunctions(); + if( tdsqlite3GlobalConfig.isPCacheInit==0 ){ + rc = tdsqlite3PcacheInitialize(); } if( rc==SQLITE_OK ){ - sqlite3GlobalConfig.isPCacheInit = 1; - rc = sqlite3OsInit(); + tdsqlite3GlobalConfig.isPCacheInit = 1; + rc = tdsqlite3OsInit(); } #ifdef SQLITE_ENABLE_DESERIALIZE if( rc==SQLITE_OK ){ - rc = sqlite3MemdbInit(); + rc = tdsqlite3MemdbInit(); } #endif if( rc==SQLITE_OK ){ - sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage, - sqlite3GlobalConfig.szPage, sqlite3GlobalConfig.nPage); - sqlite3GlobalConfig.isInit = 1; + tdsqlite3PCacheBufferSetup( tdsqlite3GlobalConfig.pPage, + tdsqlite3GlobalConfig.szPage, tdsqlite3GlobalConfig.nPage); + tdsqlite3GlobalConfig.isInit = 1; #ifdef SQLITE_EXTRA_INIT bRunExtraInit = 1; #endif } - sqlite3GlobalConfig.inProgress = 0; + tdsqlite3GlobalConfig.inProgress = 0; } - sqlite3_mutex_leave(sqlite3GlobalConfig.pInitMutex); + tdsqlite3_mutex_leave(tdsqlite3GlobalConfig.pInitMutex); /* Go back under the static mutex and clean up the recursive ** mutex to prevent a resource leak. */ - sqlite3_mutex_enter(pMaster); - sqlite3GlobalConfig.nRefInitMutex--; - if( sqlite3GlobalConfig.nRefInitMutex<=0 ){ - assert( sqlite3GlobalConfig.nRefInitMutex==0 ); - sqlite3_mutex_free(sqlite3GlobalConfig.pInitMutex); - sqlite3GlobalConfig.pInitMutex = 0; + tdsqlite3_mutex_enter(pMaster); + tdsqlite3GlobalConfig.nRefInitMutex--; + if( tdsqlite3GlobalConfig.nRefInitMutex<=0 ){ + assert( tdsqlite3GlobalConfig.nRefInitMutex==0 ); + tdsqlite3_mutex_free(tdsqlite3GlobalConfig.pInitMutex); + tdsqlite3GlobalConfig.pInitMutex = 0; } - sqlite3_mutex_leave(pMaster); + tdsqlite3_mutex_leave(pMaster); /* The following is just a sanity check to make sure SQLite has ** been compiled correctly. It is important to run this code, but @@ -163805,7 +163805,7 @@ SQLITE_API int sqlite3_initialize(void){ assert(sizeof(x)==8); assert(sizeof(x)==sizeof(y)); memcpy(&y, &x, 8); - assert( sqlite3IsNaN(y) ); + assert( tdsqlite3IsNaN(y) ); } #endif #endif @@ -163824,53 +163824,53 @@ SQLITE_API int sqlite3_initialize(void){ } /* -** Undo the effects of sqlite3_initialize(). Must not be called while +** Undo the effects of tdsqlite3_initialize(). Must not be called while ** there are outstanding database connections or memory allocations or ** while any part of SQLite is otherwise in use in any thread. This ** routine is not threadsafe. But it is safe to invoke this routine ** on when SQLite is already shut down. If SQLite is already shut down ** when this routine is invoked, then this routine is a harmless no-op. */ -SQLITE_API int sqlite3_shutdown(void){ +SQLITE_API int tdsqlite3_shutdown(void){ #ifdef SQLITE_OMIT_WSD - int rc = sqlite3_wsd_init(4096, 24); + int rc = tdsqlite3_wsd_init(4096, 24); if( rc!=SQLITE_OK ){ return rc; } #endif - if( sqlite3GlobalConfig.isInit ){ + if( tdsqlite3GlobalConfig.isInit ){ #ifdef SQLITE_EXTRA_SHUTDOWN void SQLITE_EXTRA_SHUTDOWN(void); SQLITE_EXTRA_SHUTDOWN(); #endif - sqlite3_os_end(); - sqlite3_reset_auto_extension(); - sqlite3GlobalConfig.isInit = 0; + tdsqlite3_os_end(); + tdsqlite3_reset_auto_extension(); + tdsqlite3GlobalConfig.isInit = 0; } - if( sqlite3GlobalConfig.isPCacheInit ){ - sqlite3PcacheShutdown(); - sqlite3GlobalConfig.isPCacheInit = 0; + if( tdsqlite3GlobalConfig.isPCacheInit ){ + tdsqlite3PcacheShutdown(); + tdsqlite3GlobalConfig.isPCacheInit = 0; } - if( sqlite3GlobalConfig.isMallocInit ){ - sqlite3MallocEnd(); - sqlite3GlobalConfig.isMallocInit = 0; + if( tdsqlite3GlobalConfig.isMallocInit ){ + tdsqlite3MallocEnd(); + tdsqlite3GlobalConfig.isMallocInit = 0; #ifndef SQLITE_OMIT_SHUTDOWN_DIRECTORIES /* The heap subsystem has now been shutdown and these values are supposed - ** to be NULL or point to memory that was obtained from sqlite3_malloc(), + ** to be NULL or point to memory that was obtained from tdsqlite3_malloc(), ** which would rely on that heap subsystem; therefore, make sure these ** values cannot refer to heap memory that was just invalidated when the ** heap subsystem was shutdown. This is only done if the current call to ** this function resulted in the heap subsystem actually being shutdown. */ - sqlite3_data_directory = 0; - sqlite3_temp_directory = 0; + tdsqlite3_data_directory = 0; + tdsqlite3_temp_directory = 0; #endif } - if( sqlite3GlobalConfig.isMutexInit ){ - sqlite3MutexEnd(); - sqlite3GlobalConfig.isMutexInit = 0; + if( tdsqlite3GlobalConfig.isMutexInit ){ + tdsqlite3MutexEnd(); + tdsqlite3GlobalConfig.isMutexInit = 0; } return SQLITE_OK; @@ -163885,13 +163885,13 @@ SQLITE_API int sqlite3_shutdown(void){ ** threadsafe. Failure to heed these warnings can lead to unpredictable ** behavior. */ -SQLITE_API int sqlite3_config(int op, ...){ +SQLITE_API int tdsqlite3_config(int op, ...){ va_list ap; int rc = SQLITE_OK; - /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while + /* tdsqlite3_config() shall return SQLITE_MISUSE if it is invoked while ** the SQLite library is in use. */ - if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT; + if( tdsqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT; va_start(ap, op); switch( op ){ @@ -163903,8 +163903,8 @@ SQLITE_API int sqlite3_config(int op, ...){ case SQLITE_CONFIG_SINGLETHREAD: { /* EVIDENCE-OF: R-02748-19096 This option sets the threading mode to ** Single-thread. */ - sqlite3GlobalConfig.bCoreMutex = 0; /* Disable mutex on core */ - sqlite3GlobalConfig.bFullMutex = 0; /* Disable mutex on connections */ + tdsqlite3GlobalConfig.bCoreMutex = 0; /* Disable mutex on core */ + tdsqlite3GlobalConfig.bFullMutex = 0; /* Disable mutex on connections */ break; } #endif @@ -163912,8 +163912,8 @@ SQLITE_API int sqlite3_config(int op, ...){ case SQLITE_CONFIG_MULTITHREAD: { /* EVIDENCE-OF: R-14374-42468 This option sets the threading mode to ** Multi-thread. */ - sqlite3GlobalConfig.bCoreMutex = 1; /* Enable mutex on core */ - sqlite3GlobalConfig.bFullMutex = 0; /* Disable mutex on connections */ + tdsqlite3GlobalConfig.bCoreMutex = 1; /* Enable mutex on core */ + tdsqlite3GlobalConfig.bFullMutex = 0; /* Disable mutex on connections */ break; } #endif @@ -163921,22 +163921,22 @@ SQLITE_API int sqlite3_config(int op, ...){ case SQLITE_CONFIG_SERIALIZED: { /* EVIDENCE-OF: R-41220-51800 This option sets the threading mode to ** Serialized. */ - sqlite3GlobalConfig.bCoreMutex = 1; /* Enable mutex on core */ - sqlite3GlobalConfig.bFullMutex = 1; /* Enable mutex on connections */ + tdsqlite3GlobalConfig.bCoreMutex = 1; /* Enable mutex on core */ + tdsqlite3GlobalConfig.bFullMutex = 1; /* Enable mutex on connections */ break; } #endif #if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-63666-48755 */ case SQLITE_CONFIG_MUTEX: { /* Specify an alternative mutex implementation */ - sqlite3GlobalConfig.mutex = *va_arg(ap, sqlite3_mutex_methods*); + tdsqlite3GlobalConfig.mutex = *va_arg(ap, tdsqlite3_mutex_methods*); break; } #endif #if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-14450-37597 */ case SQLITE_CONFIG_GETMUTEX: { /* Retrieve the current mutex implementation */ - *va_arg(ap, sqlite3_mutex_methods*) = sqlite3GlobalConfig.mutex; + *va_arg(ap, tdsqlite3_mutex_methods*) = tdsqlite3GlobalConfig.mutex; break; } #endif @@ -163944,30 +163944,30 @@ SQLITE_API int sqlite3_config(int op, ...){ case SQLITE_CONFIG_MALLOC: { /* EVIDENCE-OF: R-55594-21030 The SQLITE_CONFIG_MALLOC option takes a ** single argument which is a pointer to an instance of the - ** sqlite3_mem_methods structure. The argument specifies alternative + ** tdsqlite3_mem_methods structure. The argument specifies alternative ** low-level memory allocation routines to be used in place of the memory ** allocation routines built into SQLite. */ - sqlite3GlobalConfig.m = *va_arg(ap, sqlite3_mem_methods*); + tdsqlite3GlobalConfig.m = *va_arg(ap, tdsqlite3_mem_methods*); break; } case SQLITE_CONFIG_GETMALLOC: { /* EVIDENCE-OF: R-51213-46414 The SQLITE_CONFIG_GETMALLOC option takes a ** single argument which is a pointer to an instance of the - ** sqlite3_mem_methods structure. The sqlite3_mem_methods structure is + ** tdsqlite3_mem_methods structure. The tdsqlite3_mem_methods structure is ** filled with the currently defined memory allocation routines. */ - if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault(); - *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m; + if( tdsqlite3GlobalConfig.m.xMalloc==0 ) tdsqlite3MemSetDefault(); + *va_arg(ap, tdsqlite3_mem_methods*) = tdsqlite3GlobalConfig.m; break; } case SQLITE_CONFIG_MEMSTATUS: { /* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes ** single argument of type int, interpreted as a boolean, which enables ** or disables the collection of memory allocation statistics. */ - sqlite3GlobalConfig.bMemstat = va_arg(ap, int); + tdsqlite3GlobalConfig.bMemstat = va_arg(ap, int); break; } case SQLITE_CONFIG_SMALL_MALLOC: { - sqlite3GlobalConfig.bSmallMalloc = va_arg(ap, int); + tdsqlite3GlobalConfig.bSmallMalloc = va_arg(ap, int); break; } case SQLITE_CONFIG_PAGECACHE: { @@ -163975,9 +163975,9 @@ SQLITE_API int sqlite3_config(int op, ...){ ** SQLITE_CONFIG_PAGECACHE: A pointer to 8-byte aligned memory (pMem), ** the size of each page cache line (sz), and the number of cache lines ** (N). */ - sqlite3GlobalConfig.pPage = va_arg(ap, void*); - sqlite3GlobalConfig.szPage = va_arg(ap, int); - sqlite3GlobalConfig.nPage = va_arg(ap, int); + tdsqlite3GlobalConfig.pPage = va_arg(ap, void*); + tdsqlite3GlobalConfig.szPage = va_arg(ap, int); + tdsqlite3GlobalConfig.nPage = va_arg(ap, int); break; } case SQLITE_CONFIG_PCACHE_HDRSZ: { @@ -163986,9 +163986,9 @@ SQLITE_API int sqlite3_config(int op, ...){ ** that integer the number of extra bytes per page required for each page ** in SQLITE_CONFIG_PAGECACHE. */ *va_arg(ap, int*) = - sqlite3HeaderSizeBtree() + - sqlite3HeaderSizePcache() + - sqlite3HeaderSizePcache1(); + tdsqlite3HeaderSizeBtree() + + tdsqlite3HeaderSizePcache() + + tdsqlite3HeaderSizePcache1(); break; } @@ -164004,21 +164004,21 @@ SQLITE_API int sqlite3_config(int op, ...){ case SQLITE_CONFIG_PCACHE2: { /* EVIDENCE-OF: R-63325-48378 The SQLITE_CONFIG_PCACHE2 option takes a - ** single argument which is a pointer to an sqlite3_pcache_methods2 + ** single argument which is a pointer to an tdsqlite3_pcache_methods2 ** object. This object specifies the interface to a custom page cache ** implementation. */ - sqlite3GlobalConfig.pcache2 = *va_arg(ap, sqlite3_pcache_methods2*); + tdsqlite3GlobalConfig.pcache2 = *va_arg(ap, tdsqlite3_pcache_methods2*); break; } case SQLITE_CONFIG_GETPCACHE2: { /* EVIDENCE-OF: R-22035-46182 The SQLITE_CONFIG_GETPCACHE2 option takes a - ** single argument which is a pointer to an sqlite3_pcache_methods2 + ** single argument which is a pointer to an tdsqlite3_pcache_methods2 ** object. SQLite copies of the current page cache implementation into ** that object. */ - if( sqlite3GlobalConfig.pcache2.xInit==0 ){ - sqlite3PCacheSetDefault(); + if( tdsqlite3GlobalConfig.pcache2.xInit==0 ){ + tdsqlite3PCacheSetDefault(); } - *va_arg(ap, sqlite3_pcache_methods2*) = sqlite3GlobalConfig.pcache2; + *va_arg(ap, tdsqlite3_pcache_methods2*) = tdsqlite3GlobalConfig.pcache2; break; } @@ -164031,36 +164031,36 @@ SQLITE_API int sqlite3_config(int op, ...){ ** SQLITE_CONFIG_HEAP: An 8-byte aligned pointer to the memory, the ** number of bytes in the memory buffer, and the minimum allocation size. */ - sqlite3GlobalConfig.pHeap = va_arg(ap, void*); - sqlite3GlobalConfig.nHeap = va_arg(ap, int); - sqlite3GlobalConfig.mnReq = va_arg(ap, int); + tdsqlite3GlobalConfig.pHeap = va_arg(ap, void*); + tdsqlite3GlobalConfig.nHeap = va_arg(ap, int); + tdsqlite3GlobalConfig.mnReq = va_arg(ap, int); - if( sqlite3GlobalConfig.mnReq<1 ){ - sqlite3GlobalConfig.mnReq = 1; - }else if( sqlite3GlobalConfig.mnReq>(1<<12) ){ + if( tdsqlite3GlobalConfig.mnReq<1 ){ + tdsqlite3GlobalConfig.mnReq = 1; + }else if( tdsqlite3GlobalConfig.mnReq>(1<<12) ){ /* cap min request size at 2^12 */ - sqlite3GlobalConfig.mnReq = (1<<12); + tdsqlite3GlobalConfig.mnReq = (1<<12); } - if( sqlite3GlobalConfig.pHeap==0 ){ + if( tdsqlite3GlobalConfig.pHeap==0 ){ /* EVIDENCE-OF: R-49920-60189 If the first pointer (the memory pointer) ** is NULL, then SQLite reverts to using its default memory allocator ** (the system malloc() implementation), undoing any prior invocation of ** SQLITE_CONFIG_MALLOC. ** - ** Setting sqlite3GlobalConfig.m to all zeros will cause malloc to - ** revert to its default implementation when sqlite3_initialize() is run + ** Setting tdsqlite3GlobalConfig.m to all zeros will cause malloc to + ** revert to its default implementation when tdsqlite3_initialize() is run */ - memset(&sqlite3GlobalConfig.m, 0, sizeof(sqlite3GlobalConfig.m)); + memset(&tdsqlite3GlobalConfig.m, 0, sizeof(tdsqlite3GlobalConfig.m)); }else{ /* EVIDENCE-OF: R-61006-08918 If the memory pointer is not NULL then the ** alternative memory allocator is engaged to handle all of SQLites ** memory allocation needs. */ #ifdef SQLITE_ENABLE_MEMSYS3 - sqlite3GlobalConfig.m = *sqlite3MemGetMemsys3(); + tdsqlite3GlobalConfig.m = *tdsqlite3MemGetMemsys3(); #endif #ifdef SQLITE_ENABLE_MEMSYS5 - sqlite3GlobalConfig.m = *sqlite3MemGetMemsys5(); + tdsqlite3GlobalConfig.m = *tdsqlite3MemGetMemsys5(); #endif } break; @@ -164068,8 +164068,8 @@ SQLITE_API int sqlite3_config(int op, ...){ #endif case SQLITE_CONFIG_LOOKASIDE: { - sqlite3GlobalConfig.szLookaside = va_arg(ap, int); - sqlite3GlobalConfig.nLookaside = va_arg(ap, int); + tdsqlite3GlobalConfig.szLookaside = va_arg(ap, int); + tdsqlite3GlobalConfig.nLookaside = va_arg(ap, int); break; } @@ -164080,25 +164080,25 @@ SQLITE_API int sqlite3_config(int op, ...){ case SQLITE_CONFIG_LOG: { /* MSVC is picky about pulling func ptrs from va lists. ** http://support.microsoft.com/kb/47961 - ** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*)); + ** tdsqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*)); */ typedef void(*LOGFUNC_t)(void*,int,const char*); - sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t); - sqlite3GlobalConfig.pLogArg = va_arg(ap, void*); + tdsqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t); + tdsqlite3GlobalConfig.pLogArg = va_arg(ap, void*); break; } /* EVIDENCE-OF: R-55548-33817 The compile-time setting for URI filenames ** can be changed at start-time using the - ** sqlite3_config(SQLITE_CONFIG_URI,1) or - ** sqlite3_config(SQLITE_CONFIG_URI,0) configuration calls. + ** tdsqlite3_config(SQLITE_CONFIG_URI,1) or + ** tdsqlite3_config(SQLITE_CONFIG_URI,0) configuration calls. */ case SQLITE_CONFIG_URI: { /* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single ** argument of type int. If non-zero, then URI handling is globally ** enabled. If the parameter is zero, then URI handling is globally ** disabled. */ - sqlite3GlobalConfig.bOpenUri = va_arg(ap, int); + tdsqlite3GlobalConfig.bOpenUri = va_arg(ap, int); break; } @@ -164107,26 +164107,26 @@ SQLITE_API int sqlite3_config(int op, ...){ ** option takes a single integer argument which is interpreted as a ** boolean in order to enable or disable the use of covering indices for ** full table scans in the query optimizer. */ - sqlite3GlobalConfig.bUseCis = va_arg(ap, int); + tdsqlite3GlobalConfig.bUseCis = va_arg(ap, int); break; } #ifdef SQLITE_ENABLE_SQLLOG case SQLITE_CONFIG_SQLLOG: { - typedef void(*SQLLOGFUNC_t)(void*, sqlite3*, const char*, int); - sqlite3GlobalConfig.xSqllog = va_arg(ap, SQLLOGFUNC_t); - sqlite3GlobalConfig.pSqllogArg = va_arg(ap, void *); + typedef void(*SQLLOGFUNC_t)(void*, tdsqlite3*, const char*, int); + tdsqlite3GlobalConfig.xSqllog = va_arg(ap, SQLLOGFUNC_t); + tdsqlite3GlobalConfig.pSqllogArg = va_arg(ap, void *); break; } #endif case SQLITE_CONFIG_MMAP_SIZE: { /* EVIDENCE-OF: R-58063-38258 SQLITE_CONFIG_MMAP_SIZE takes two 64-bit - ** integer (sqlite3_int64) values that are the default mmap size limit + ** integer (tdsqlite3_int64) values that are the default mmap size limit ** (the default setting for PRAGMA mmap_size) and the maximum allowed ** mmap size limit. */ - sqlite3_int64 szMmap = va_arg(ap, sqlite3_int64); - sqlite3_int64 mxMmap = va_arg(ap, sqlite3_int64); + tdsqlite3_int64 szMmap = va_arg(ap, tdsqlite3_int64); + tdsqlite3_int64 mxMmap = va_arg(ap, tdsqlite3_int64); /* EVIDENCE-OF: R-53367-43190 If either argument to this option is ** negative, then that argument is changed to its compile-time default. ** @@ -164140,8 +164140,8 @@ SQLITE_API int sqlite3_config(int op, ...){ } if( szMmap<0 ) szMmap = SQLITE_DEFAULT_MMAP_SIZE; if( szMmap>mxMmap) szMmap = mxMmap; - sqlite3GlobalConfig.mxMmap = mxMmap; - sqlite3GlobalConfig.szMmap = szMmap; + tdsqlite3GlobalConfig.mxMmap = mxMmap; + tdsqlite3GlobalConfig.szMmap = szMmap; break; } @@ -164150,18 +164150,18 @@ SQLITE_API int sqlite3_config(int op, ...){ /* EVIDENCE-OF: R-34926-03360 SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit ** unsigned integer value that specifies the maximum size of the created ** heap. */ - sqlite3GlobalConfig.nHeap = va_arg(ap, int); + tdsqlite3GlobalConfig.nHeap = va_arg(ap, int); break; } #endif case SQLITE_CONFIG_PMASZ: { - sqlite3GlobalConfig.szPma = va_arg(ap, unsigned int); + tdsqlite3GlobalConfig.szPma = va_arg(ap, unsigned int); break; } case SQLITE_CONFIG_STMTJRNL_SPILL: { - sqlite3GlobalConfig.nStmtSpill = va_arg(ap, int); + tdsqlite3GlobalConfig.nStmtSpill = va_arg(ap, int); break; } @@ -164171,14 +164171,14 @@ SQLITE_API int sqlite3_config(int op, ...){ if( iVal<0 ){ iVal = SQLITE_DEFAULT_SORTERREF_SIZE; } - sqlite3GlobalConfig.szSorterRef = (u32)iVal; + tdsqlite3GlobalConfig.szSorterRef = (u32)iVal; break; } #endif /* SQLITE_ENABLE_SORTER_REFERENCES */ #ifdef SQLITE_ENABLE_DESERIALIZE case SQLITE_CONFIG_MEMDB_MAXSIZE: { - sqlite3GlobalConfig.mxMemdbSize = va_arg(ap, sqlite3_int64); + tdsqlite3GlobalConfig.mxMemdbSize = va_arg(ap, tdsqlite3_int64); break; } #endif /* SQLITE_ENABLE_DESERIALIZE */ @@ -164199,18 +164199,18 @@ SQLITE_API int sqlite3_config(int op, ...){ ** ** The sz parameter is the number of bytes in each lookaside slot. ** The cnt parameter is the number of slots. If pStart is NULL the -** space for the lookaside memory is obtained from sqlite3_malloc(). +** space for the lookaside memory is obtained from tdsqlite3_malloc(). ** If pStart is not NULL then it is sz*cnt bytes of memory to use for ** the lookaside memory. */ -static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ +static int setupLookaside(tdsqlite3 *db, void *pBuf, int sz, int cnt){ #ifndef SQLITE_OMIT_LOOKASIDE void *pStart; - sqlite3_int64 szAlloc = sz*(sqlite3_int64)cnt; + tdsqlite3_int64 szAlloc = sz*(tdsqlite3_int64)cnt; int nBig; /* Number of full-size slots */ int nSm; /* Number smaller LOOKASIDE_SMALL-byte slots */ - if( sqlite3LookasideUsed(db,0)>0 ){ + if( tdsqlite3LookasideUsed(db,0)>0 ){ return SQLITE_BUSY; } /* Free any existing lookaside buffer for this handle before @@ -164218,7 +164218,7 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ ** both at the same time. */ if( db->lookaside.bMalloced ){ - sqlite3_free(db->lookaside.pStart); + tdsqlite3_free(db->lookaside.pStart); } /* The size of a lookaside slot after ROUNDDOWN8 needs to be larger ** than a pointer to be useful. @@ -164230,10 +164230,10 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ sz = 0; pStart = 0; }else if( pBuf==0 ){ - sqlite3BeginBenignMalloc(); - pStart = sqlite3Malloc( szAlloc ); /* IMP: R-61949-35727 */ - sqlite3EndBenignMalloc(); - if( pStart ) szAlloc = sqlite3MallocSize(pStart); + tdsqlite3BeginBenignMalloc(); + pStart = tdsqlite3Malloc( szAlloc ); /* IMP: R-61949-35727 */ + tdsqlite3EndBenignMalloc(); + if( pStart ) szAlloc = tdsqlite3MallocSize(pStart); }else{ pStart = pBuf; } @@ -164295,7 +164295,7 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ db->lookaside.bMalloced = 0; db->lookaside.nSlot = 0; } - assert( sqlite3LookasideUsed(db,0)==0 ); + assert( tdsqlite3LookasideUsed(db,0)==0 ); #endif /* SQLITE_OMIT_LOOKASIDE */ return SQLITE_OK; } @@ -164303,9 +164303,9 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ /* ** Return the mutex associated with a database connection. */ -SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3 *db){ +SQLITE_API tdsqlite3_mutex *tdsqlite3_db_mutex(tdsqlite3 *db){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } @@ -164317,23 +164317,23 @@ SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3 *db){ ** Free up as much memory as we can from the given database ** connection. */ -SQLITE_API int sqlite3_db_release_memory(sqlite3 *db){ +SQLITE_API int tdsqlite3_db_release_memory(tdsqlite3 *db){ int i; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); - sqlite3BtreeEnterAll(db); + tdsqlite3_mutex_enter(db->mutex); + tdsqlite3BtreeEnterAll(db); for(i=0; inDb; i++){ Btree *pBt = db->aDb[i].pBt; if( pBt ){ - Pager *pPager = sqlite3BtreePager(pBt); - sqlite3PagerShrink(pPager); + Pager *pPager = tdsqlite3BtreePager(pBt); + tdsqlite3PagerShrink(pPager); } } - sqlite3BtreeLeaveAll(db); - sqlite3_mutex_leave(db->mutex); + tdsqlite3BtreeLeaveAll(db); + tdsqlite3_mutex_leave(db->mutex); return SQLITE_OK; } @@ -164341,36 +164341,36 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3 *db){ ** Flush any dirty pages in the pager-cache for any attached database ** to disk. */ -SQLITE_API int sqlite3_db_cacheflush(sqlite3 *db){ +SQLITE_API int tdsqlite3_db_cacheflush(tdsqlite3 *db){ int i; int rc = SQLITE_OK; int bSeenBusy = 0; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); - sqlite3BtreeEnterAll(db); + tdsqlite3_mutex_enter(db->mutex); + tdsqlite3BtreeEnterAll(db); for(i=0; rc==SQLITE_OK && inDb; i++){ Btree *pBt = db->aDb[i].pBt; - if( pBt && sqlite3BtreeIsInTrans(pBt) ){ - Pager *pPager = sqlite3BtreePager(pBt); - rc = sqlite3PagerFlush(pPager); + if( pBt && tdsqlite3BtreeIsInTrans(pBt) ){ + Pager *pPager = tdsqlite3BtreePager(pBt); + rc = tdsqlite3PagerFlush(pPager); if( rc==SQLITE_BUSY ){ bSeenBusy = 1; rc = SQLITE_OK; } } } - sqlite3BtreeLeaveAll(db); - sqlite3_mutex_leave(db->mutex); + tdsqlite3BtreeLeaveAll(db); + tdsqlite3_mutex_leave(db->mutex); return ((rc==SQLITE_OK && bSeenBusy) ? SQLITE_BUSY : rc); } /* ** Configuration settings for an individual database connection */ -SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){ +SQLITE_API int tdsqlite3_db_config(tdsqlite3 *db, int op, ...){ va_list ap; int rc; va_start(ap, op); @@ -164425,7 +164425,7 @@ SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){ db->flags &= ~(u64)aFlagOp[i].mask; } if( oldFlags!=db->flags ){ - sqlite3ExpirePreparedStatements(db, 0); + tdsqlite3ExpirePreparedStatements(db, 0); } if( pRes ){ *pRes = (db->flags & aFlagOp[i].mask)!=0; @@ -164483,7 +164483,7 @@ static int rtrimCollFunc( /* ** Return true if CollSeq is the default built-in BINARY. */ -SQLITE_PRIVATE int sqlite3IsBinary(const CollSeq *p){ +SQLITE_PRIVATE int tdsqlite3IsBinary(const CollSeq *p){ assert( p==0 || p->xCmp!=binCollFunc || strcmp(p->zName,"BINARY")==0 ); return p==0 || p->xCmp==binCollFunc; } @@ -164502,7 +164502,7 @@ static int nocaseCollatingFunc( int nKey1, const void *pKey1, int nKey2, const void *pKey2 ){ - int r = sqlite3StrNICmp( + int r = tdsqlite3StrNICmp( (const char *)pKey1, (const char *)pKey2, (nKey1mutex); + tdsqlite3_mutex_enter(db->mutex); db->lastRowid = iRowid; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); } /* -** Return the number of changes in the most recent call to sqlite3_exec(). +** Return the number of changes in the most recent call to tdsqlite3_exec(). */ -SQLITE_API int sqlite3_changes(sqlite3 *db){ +SQLITE_API int tdsqlite3_changes(tdsqlite3 *db){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } @@ -164555,9 +164555,9 @@ SQLITE_API int sqlite3_changes(sqlite3 *db){ /* ** Return the number of changes since the database handle was opened. */ -SQLITE_API int sqlite3_total_changes(sqlite3 *db){ +SQLITE_API int tdsqlite3_total_changes(tdsqlite3 *db){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } @@ -164570,11 +164570,11 @@ SQLITE_API int sqlite3_total_changes(sqlite3 *db){ ** database handle object, it does not close any savepoints that may be open ** at the b-tree/pager level. */ -SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3CloseSavepoints(tdsqlite3 *db){ while( db->pSavepoint ){ Savepoint *pTmp = db->pSavepoint; db->pSavepoint = pTmp->pNext; - sqlite3DbFree(db, pTmp); + tdsqlite3DbFree(db, pTmp); } db->nSavepoint = 0; db->nStatement = 0; @@ -164587,43 +164587,43 @@ SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *db){ ** copies of a single function are created when create_function() is called ** with SQLITE_ANY as the encoding. */ -static void functionDestroy(sqlite3 *db, FuncDef *p){ +static void functionDestroy(tdsqlite3 *db, FuncDef *p){ FuncDestructor *pDestructor = p->u.pDestructor; if( pDestructor ){ pDestructor->nRef--; if( pDestructor->nRef==0 ){ pDestructor->xDestroy(pDestructor->pUserData); - sqlite3DbFree(db, pDestructor); + tdsqlite3DbFree(db, pDestructor); } } } /* -** Disconnect all sqlite3_vtab objects that belong to database connection +** Disconnect all tdsqlite3_vtab objects that belong to database connection ** db. This is called when db is being closed. */ -static void disconnectAllVtab(sqlite3 *db){ +static void disconnectAllVtab(tdsqlite3 *db){ #ifndef SQLITE_OMIT_VIRTUALTABLE int i; HashElem *p; - sqlite3BtreeEnterAll(db); + tdsqlite3BtreeEnterAll(db); for(i=0; inDb; i++){ Schema *pSchema = db->aDb[i].pSchema; if( pSchema ){ for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){ Table *pTab = (Table *)sqliteHashData(p); - if( IsVirtual(pTab) ) sqlite3VtabDisconnect(db, pTab); + if( IsVirtual(pTab) ) tdsqlite3VtabDisconnect(db, pTab); } } } for(p=sqliteHashFirst(&db->aModule); p; p=sqliteHashNext(p)){ Module *pMod = (Module *)sqliteHashData(p); if( pMod->pEpoTab ){ - sqlite3VtabDisconnect(db, pMod->pEpoTab); + tdsqlite3VtabDisconnect(db, pMod->pEpoTab); } } - sqlite3VtabUnlockList(db); - sqlite3BtreeLeaveAll(db); + tdsqlite3VtabUnlockList(db); + tdsqlite3BtreeLeaveAll(db); #else UNUSED_PARAMETER(db); #endif @@ -164631,15 +164631,15 @@ static void disconnectAllVtab(sqlite3 *db){ /* ** Return TRUE if database connection db has unfinalized prepared -** statements or unfinished sqlite3_backup objects. +** statements or unfinished tdsqlite3_backup objects. */ -static int connectionIsBusy(sqlite3 *db){ +static int connectionIsBusy(tdsqlite3 *db){ int j; - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); if( db->pVdbe ) return 1; for(j=0; jnDb; j++){ Btree *pBt = db->aDb[j].pBt; - if( pBt && sqlite3BtreeIsInBackup(pBt) ) return 1; + if( pBt && tdsqlite3BtreeIsInBackup(pBt) ) return 1; } return 0; } @@ -164647,16 +164647,16 @@ static int connectionIsBusy(sqlite3 *db){ /* ** Close an existing SQLite database */ -static int sqlite3Close(sqlite3 *db, int forceZombie){ +static int tdsqlite3Close(tdsqlite3 *db, int forceZombie){ if( !db ){ - /* EVIDENCE-OF: R-63257-11740 Calling sqlite3_close() or - ** sqlite3_close_v2() with a NULL pointer argument is a harmless no-op. */ + /* EVIDENCE-OF: R-63257-11740 Calling tdsqlite3_close() or + ** tdsqlite3_close_v2() with a NULL pointer argument is a harmless no-op. */ return SQLITE_OK; } - if( !sqlite3SafetyCheckSickOrOk(db) ){ + if( !tdsqlite3SafetyCheckSickOrOk(db) ){ return SQLITE_MISUSE_BKPT; } - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); if( db->mTrace & SQLITE_TRACE_CLOSE ){ db->xTrace(SQLITE_TRACE_CLOSE, db->pTraceArg, db, 0); } @@ -164666,74 +164666,74 @@ static int sqlite3Close(sqlite3 *db, int forceZombie){ /* If a transaction is open, the disconnectAllVtab() call above ** will not have called the xDisconnect() method on any virtual - ** tables in the db->aVTrans[] array. The following sqlite3VtabRollback() + ** tables in the db->aVTrans[] array. The following tdsqlite3VtabRollback() ** call will do so. We need to do this before the check for active ** SQL statements below, as the v-table implementation may be storing ** some prepared statements internally. */ - sqlite3VtabRollback(db); + tdsqlite3VtabRollback(db); - /* Legacy behavior (sqlite3_close() behavior) is to return + /* Legacy behavior (tdsqlite3_close() behavior) is to return ** SQLITE_BUSY if the connection can not be closed immediately. */ if( !forceZombie && connectionIsBusy(db) ){ - sqlite3ErrorWithMsg(db, SQLITE_BUSY, "unable to close due to unfinalized " + tdsqlite3ErrorWithMsg(db, SQLITE_BUSY, "unable to close due to unfinalized " "statements or unfinished backups"); - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return SQLITE_BUSY; } #ifdef SQLITE_ENABLE_SQLLOG - if( sqlite3GlobalConfig.xSqllog ){ + if( tdsqlite3GlobalConfig.xSqllog ){ /* Closing the handle. Fourth parameter is passed the value 2. */ - sqlite3GlobalConfig.xSqllog(sqlite3GlobalConfig.pSqllogArg, db, 0, 2); + tdsqlite3GlobalConfig.xSqllog(tdsqlite3GlobalConfig.pSqllogArg, db, 0, 2); } #endif /* Convert the connection into a zombie and then close it. */ db->magic = SQLITE_MAGIC_ZOMBIE; - sqlite3LeaveMutexAndCloseZombie(db); + tdsqlite3LeaveMutexAndCloseZombie(db); return SQLITE_OK; } /* ** Two variations on the public interface for closing a database -** connection. The sqlite3_close() version returns SQLITE_BUSY and +** connection. The tdsqlite3_close() version returns SQLITE_BUSY and ** leaves the connection option if there are unfinalized prepared -** statements or unfinished sqlite3_backups. The sqlite3_close_v2() +** statements or unfinished tdsqlite3_backups. The tdsqlite3_close_v2() ** version forces the connection to become a zombie if there are ** unclosed resources, and arranges for deallocation when the last -** prepare statement or sqlite3_backup closes. +** prepare statement or tdsqlite3_backup closes. */ -SQLITE_API int sqlite3_close(sqlite3 *db){ return sqlite3Close(db,0); } -SQLITE_API int sqlite3_close_v2(sqlite3 *db){ return sqlite3Close(db,1); } +SQLITE_API int tdsqlite3_close(tdsqlite3 *db){ return tdsqlite3Close(db,0); } +SQLITE_API int tdsqlite3_close_v2(tdsqlite3 *db){ return tdsqlite3Close(db,1); } /* ** Close the mutex on database connection db. ** ** Furthermore, if database connection db is a zombie (meaning that there -** has been a prior call to sqlite3_close(db) or sqlite3_close_v2(db)) and -** every sqlite3_stmt has now been finalized and every sqlite3_backup has +** has been a prior call to tdsqlite3_close(db) or tdsqlite3_close_v2(db)) and +** every tdsqlite3_stmt has now been finalized and every tdsqlite3_backup has ** finished, then free all resources. */ -SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3LeaveMutexAndCloseZombie(tdsqlite3 *db){ HashElem *i; /* Hash table iterator */ int j; - /* If there are outstanding sqlite3_stmt or sqlite3_backup objects - ** or if the connection has not yet been closed by sqlite3_close_v2(), + /* If there are outstanding tdsqlite3_stmt or tdsqlite3_backup objects + ** or if the connection has not yet been closed by tdsqlite3_close_v2(), ** then just leave the mutex and return. */ if( db->magic!=SQLITE_MAGIC_ZOMBIE || connectionIsBusy(db) ){ - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return; } /* If we reach this point, it means that the database connection has - ** closed all sqlite3_stmt and sqlite3_backup objects and has been - ** passed to sqlite3_close (meaning that it is a zombie). Therefore, + ** closed all tdsqlite3_stmt and tdsqlite3_backup objects and has been + ** passed to tdsqlite3_close (meaning that it is a zombie). Therefore, ** go ahead and free all resources. */ @@ -164741,16 +164741,16 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){ ** any database schemas have been modified by an uncommitted transaction ** they are reset. And that the required b-tree mutex is held to make ** the pager rollback and schema reset an atomic operation. */ - sqlite3RollbackAll(db, SQLITE_OK); + tdsqlite3RollbackAll(db, SQLITE_OK); /* Free any outstanding Savepoint structures. */ - sqlite3CloseSavepoints(db); + tdsqlite3CloseSavepoints(db); /* Close all database connections */ for(j=0; jnDb; j++){ struct Db *pDb = &db->aDb[j]; if( pDb->pBt ){ - sqlite3BtreeClose(pDb->pBt); + tdsqlite3BtreeClose(pDb->pBt); pDb->pBt = 0; if( j!=1 ){ pDb->pSchema = 0; @@ -164759,19 +164759,19 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){ } /* Clear the TEMP schema separately and last */ if( db->aDb[1].pSchema ){ - sqlite3SchemaClear(db->aDb[1].pSchema); + tdsqlite3SchemaClear(db->aDb[1].pSchema); } - sqlite3VtabUnlockList(db); + tdsqlite3VtabUnlockList(db); /* Free up the array of auxiliary databases */ - sqlite3CollapseDatabaseArray(db); + tdsqlite3CollapseDatabaseArray(db); assert( db->nDb<=2 ); assert( db->aDb==db->aDbStatic ); /* Tell the code in notify.c that the connection no longer holds any ** locks and does not require any further unlock-notify callbacks. */ - sqlite3ConnectionClosed(db); + tdsqlite3ConnectionClosed(db); for(i=sqliteHashFirst(&db->aFunc); i; i=sqliteHashNext(i)){ FuncDef *pNext, *p; @@ -164779,11 +164779,11 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){ do{ functionDestroy(db, p); pNext = p->pNext; - sqlite3DbFree(db, p); + tdsqlite3DbFree(db, p); p = pNext; }while( p ); } - sqlite3HashClear(&db->aFunc); + tdsqlite3HashClear(&db->aFunc); for(i=sqliteHashFirst(&db->aCollSeq); i; i=sqliteHashNext(i)){ CollSeq *pColl = (CollSeq *)sqliteHashData(i); /* Invoke any destructors registered for collation sequence user data. */ @@ -164792,43 +164792,43 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){ pColl[j].xDel(pColl[j].pUser); } } - sqlite3DbFree(db, pColl); + tdsqlite3DbFree(db, pColl); } - sqlite3HashClear(&db->aCollSeq); + tdsqlite3HashClear(&db->aCollSeq); #ifndef SQLITE_OMIT_VIRTUALTABLE for(i=sqliteHashFirst(&db->aModule); i; i=sqliteHashNext(i)){ Module *pMod = (Module *)sqliteHashData(i); - sqlite3VtabEponymousTableClear(db, pMod); - sqlite3VtabModuleUnref(db, pMod); + tdsqlite3VtabEponymousTableClear(db, pMod); + tdsqlite3VtabModuleUnref(db, pMod); } - sqlite3HashClear(&db->aModule); + tdsqlite3HashClear(&db->aModule); #endif - sqlite3Error(db, SQLITE_OK); /* Deallocates any cached error strings. */ - sqlite3ValueFree(db->pErr); - sqlite3CloseExtensions(db); + tdsqlite3Error(db, SQLITE_OK); /* Deallocates any cached error strings. */ + tdsqlite3ValueFree(db->pErr); + tdsqlite3CloseExtensions(db); #if SQLITE_USER_AUTHENTICATION - sqlite3_free(db->auth.zAuthUser); - sqlite3_free(db->auth.zAuthPW); + tdsqlite3_free(db->auth.zAuthUser); + tdsqlite3_free(db->auth.zAuthPW); #endif db->magic = SQLITE_MAGIC_ERROR; /* The temp-database schema is allocated differently from the other schema - ** objects (using sqliteMalloc() directly, instead of sqlite3BtreeSchema()). + ** objects (using sqliteMalloc() directly, instead of tdsqlite3BtreeSchema()). ** So it needs to be freed here. Todo: Why not roll the temp schema into ** the same sqliteMalloc() as the one that allocates the database ** structure? */ - sqlite3DbFree(db, db->aDb[1].pSchema); - sqlite3_mutex_leave(db->mutex); + tdsqlite3DbFree(db, db->aDb[1].pSchema); + tdsqlite3_mutex_leave(db->mutex); db->magic = SQLITE_MAGIC_CLOSED; - sqlite3_mutex_free(db->mutex); - assert( sqlite3LookasideUsed(db,0)==0 ); + tdsqlite3_mutex_free(db->mutex); + assert( tdsqlite3LookasideUsed(db,0)==0 ); if( db->lookaside.bMalloced ){ - sqlite3_free(db->lookaside.pStart); + tdsqlite3_free(db->lookaside.pStart); } - sqlite3_free(db); + tdsqlite3_free(db); } /* @@ -164838,12 +164838,12 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){ ** attempts to use that cursor. Read cursors remain open and valid ** but are "saved" in case the table pages are moved around. */ -SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){ +SQLITE_PRIVATE void tdsqlite3RollbackAll(tdsqlite3 *db, int tripCode){ int i; int inTrans = 0; int schemaChange; - assert( sqlite3_mutex_held(db->mutex) ); - sqlite3BeginBenignMalloc(); + assert( tdsqlite3_mutex_held(db->mutex) ); + tdsqlite3BeginBenignMalloc(); /* Obtain all b-tree mutexes before making any calls to BtreeRollback(). ** This is important in case the transaction being rolled back has @@ -164851,26 +164851,26 @@ SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){ ** here, then another shared-cache connection might sneak in between ** the database rollback and schema reset, which can cause false ** corruption reports in some cases. */ - sqlite3BtreeEnterAll(db); + tdsqlite3BtreeEnterAll(db); schemaChange = (db->mDbFlags & DBFLAG_SchemaChange)!=0 && db->init.busy==0; for(i=0; inDb; i++){ Btree *p = db->aDb[i].pBt; if( p ){ - if( sqlite3BtreeIsInTrans(p) ){ + if( tdsqlite3BtreeIsInTrans(p) ){ inTrans = 1; } - sqlite3BtreeRollback(p, tripCode, !schemaChange); + tdsqlite3BtreeRollback(p, tripCode, !schemaChange); } } - sqlite3VtabRollback(db); - sqlite3EndBenignMalloc(); + tdsqlite3VtabRollback(db); + tdsqlite3EndBenignMalloc(); if( schemaChange ){ - sqlite3ExpirePreparedStatements(db, 0); - sqlite3ResetAllSchemasOfConnection(db); + tdsqlite3ExpirePreparedStatements(db, 0); + tdsqlite3ResetAllSchemasOfConnection(db); } - sqlite3BtreeLeaveAll(db); + tdsqlite3BtreeLeaveAll(db); /* Any deferred constraint violations have now been resolved. */ db->nDeferredCons = 0; @@ -164888,7 +164888,7 @@ SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){ ** specified in the argument. */ #if defined(SQLITE_NEED_ERR_NAME) -SQLITE_PRIVATE const char *sqlite3ErrName(int rc){ +SQLITE_PRIVATE const char *tdsqlite3ErrName(int rc){ const char *zName = 0; int i, origRc = rc; for(i=0; i<2 && zName==0; i++, rc &= 0xff){ @@ -164988,7 +164988,7 @@ SQLITE_PRIVATE const char *sqlite3ErrName(int rc){ } if( zName==0 ){ static char zBuf[50]; - sqlite3_snprintf(sizeof(zBuf), zBuf, "SQLITE_UNKNOWN(%d)", origRc); + tdsqlite3_snprintf(sizeof(zBuf), zBuf, "SQLITE_UNKNOWN(%d)", origRc); zName = zBuf; } return zName; @@ -164999,7 +164999,7 @@ SQLITE_PRIVATE const char *sqlite3ErrName(int rc){ ** Return a static string that describes the kind of error specified in the ** argument. */ -SQLITE_PRIVATE const char *sqlite3ErrStr(int rc){ +SQLITE_PRIVATE const char *tdsqlite3ErrStr(int rc){ static const char* const aMsg[] = { /* SQLITE_OK */ "not an error", /* SQLITE_ERROR */ "SQL logic error", @@ -165072,7 +165072,7 @@ SQLITE_PRIVATE const char *sqlite3ErrStr(int rc){ static int sqliteDefaultBusyCallback( void *ptr, /* Database connection */ int count, /* Number of times table has been busy */ - sqlite3_file *pFile /* The file on which the lock occurred */ + tdsqlite3_file *pFile /* The file on which the lock occurred */ ){ #if SQLITE_OS_WIN || HAVE_USLEEP /* This case is for systems that have support for sleeping for fractions of @@ -165082,15 +165082,15 @@ static int sqliteDefaultBusyCallback( static const u8 totals[] = { 0, 1, 3, 8, 18, 33, 53, 78, 103, 128, 178, 228 }; # define NDELAY ArraySize(delays) - sqlite3 *db = (sqlite3 *)ptr; + tdsqlite3 *db = (tdsqlite3 *)ptr; int tmout = db->busyTimeout; int delay, prior; #ifdef SQLITE_ENABLE_SETLK_TIMEOUT - if( sqlite3OsFileControl(pFile,SQLITE_FCNTL_LOCK_TIMEOUT,&tmout)==SQLITE_OK ){ + if( tdsqlite3OsFileControl(pFile,SQLITE_FCNTL_LOCK_TIMEOUT,&tmout)==SQLITE_OK ){ if( count ){ tmout = 0; - sqlite3OsFileControl(pFile, SQLITE_FCNTL_LOCK_TIMEOUT, &tmout); + tdsqlite3OsFileControl(pFile, SQLITE_FCNTL_LOCK_TIMEOUT, &tmout); return 0; }else{ return 1; @@ -165111,18 +165111,18 @@ static int sqliteDefaultBusyCallback( delay = tmout - prior; if( delay<=0 ) return 0; } - sqlite3OsSleep(db->pVfs, delay*1000); + tdsqlite3OsSleep(db->pVfs, delay*1000); return 1; #else /* This case for unix systems that lack usleep() support. Sleeping ** must be done in increments of whole seconds */ - sqlite3 *db = (sqlite3 *)ptr; - int tmout = ((sqlite3 *)ptr)->busyTimeout; + tdsqlite3 *db = (tdsqlite3 *)ptr; + int tmout = ((tdsqlite3 *)ptr)->busyTimeout; UNUSED_PARAMETER(pFile); if( (count+1)*1000 > tmout ){ return 0; } - sqlite3OsSleep(db->pVfs, 1000000); + tdsqlite3OsSleep(db->pVfs, 1000000); return 1; #endif } @@ -165136,14 +165136,14 @@ static int sqliteDefaultBusyCallback( ** If this routine returns non-zero, the lock is retried. If it ** returns 0, the operation aborts with an SQLITE_BUSY error. */ -SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler *p, sqlite3_file *pFile){ +SQLITE_PRIVATE int tdsqlite3InvokeBusyHandler(BusyHandler *p, tdsqlite3_file *pFile){ int rc; if( p->xBusyHandler==0 || p->nBusy<0 ) return 0; if( p->bExtraFileArg ){ /* Add an extra parameter with the pFile pointer to the end of the ** callback argument list */ - int (*xTra)(void*,int,sqlite3_file*); - xTra = (int(*)(void*,int,sqlite3_file*))p->xBusyHandler; + int (*xTra)(void*,int,tdsqlite3_file*); + xTra = (int(*)(void*,int,tdsqlite3_file*))p->xBusyHandler; rc = xTra(p->pBusyArg, p->nBusy, pFile); }else{ /* Legacy style busy handler callback */ @@ -165161,21 +165161,21 @@ SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler *p, sqlite3_file *pFile) ** This routine sets the busy callback for an Sqlite database to the ** given callback function with the given argument. */ -SQLITE_API int sqlite3_busy_handler( - sqlite3 *db, +SQLITE_API int tdsqlite3_busy_handler( + tdsqlite3 *db, int (*xBusy)(void*,int), void *pArg ){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); db->busyHandler.xBusyHandler = xBusy; db->busyHandler.pBusyArg = pArg; db->busyHandler.nBusy = 0; db->busyHandler.bExtraFileArg = 0; db->busyTimeout = 0; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return SQLITE_OK; } @@ -165185,19 +165185,19 @@ SQLITE_API int sqlite3_busy_handler( ** given callback function with the given argument. The progress callback will ** be invoked every nOps opcodes. */ -SQLITE_API void sqlite3_progress_handler( - sqlite3 *db, +SQLITE_API void tdsqlite3_progress_handler( + tdsqlite3 *db, int nOps, int (*xProgress)(void*), void *pArg ){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); if( nOps>0 ){ db->xProgress = xProgress; db->nProgressOps = (unsigned)nOps; @@ -165207,7 +165207,7 @@ SQLITE_API void sqlite3_progress_handler( db->nProgressOps = 0; db->pProgressArg = 0; } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); } #endif @@ -165216,17 +165216,17 @@ SQLITE_API void sqlite3_progress_handler( ** This routine installs a default busy handler that waits for the ** specified number of milliseconds before returning 0. */ -SQLITE_API int sqlite3_busy_timeout(sqlite3 *db, int ms){ +SQLITE_API int tdsqlite3_busy_timeout(tdsqlite3 *db, int ms){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif if( ms>0 ){ - sqlite3_busy_handler(db, (int(*)(void*,int))sqliteDefaultBusyCallback, + tdsqlite3_busy_handler(db, (int(*)(void*,int))sqliteDefaultBusyCallback, (void*)db); db->busyTimeout = ms; db->busyHandler.bExtraFileArg = 1; }else{ - sqlite3_busy_handler(db, 0, 0); + tdsqlite3_busy_handler(db, 0, 0); } return SQLITE_OK; } @@ -165234,9 +165234,9 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3 *db, int ms){ /* ** Cause any pending operation to stop at its earliest opportunity. */ -SQLITE_API void sqlite3_interrupt(sqlite3 *db){ +SQLITE_API void tdsqlite3_interrupt(tdsqlite3 *db){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) && (db==0 || db->magic!=SQLITE_MAGIC_ZOMBIE) ){ + if( !tdsqlite3SafetyCheckOk(db) && (db==0 || db->magic!=SQLITE_MAGIC_ZOMBIE) ){ (void)SQLITE_MISUSE_BKPT; return; } @@ -165246,36 +165246,36 @@ SQLITE_API void sqlite3_interrupt(sqlite3 *db){ /* -** This function is exactly the same as sqlite3_create_function(), except +** This function is exactly the same as tdsqlite3_create_function(), except ** that it is designed to be called by internal code. The difference is -** that if a malloc() fails in sqlite3_create_function(), an error code +** that if a malloc() fails in tdsqlite3_create_function(), an error code ** is returned and the mallocFailed flag cleared. */ -SQLITE_PRIVATE int sqlite3CreateFunc( - sqlite3 *db, +SQLITE_PRIVATE int tdsqlite3CreateFunc( + tdsqlite3 *db, const char *zFunctionName, int nArg, int enc, void *pUserData, - void (*xSFunc)(sqlite3_context*,int,sqlite3_value **), - void (*xStep)(sqlite3_context*,int,sqlite3_value **), - void (*xFinal)(sqlite3_context*), - void (*xValue)(sqlite3_context*), - void (*xInverse)(sqlite3_context*,int,sqlite3_value **), + void (*xSFunc)(tdsqlite3_context*,int,tdsqlite3_value **), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value **), + void (*xFinal)(tdsqlite3_context*), + void (*xValue)(tdsqlite3_context*), + void (*xInverse)(tdsqlite3_context*,int,tdsqlite3_value **), FuncDestructor *pDestructor ){ FuncDef *p; int nName; int extraFlags; - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); assert( xValue==0 || xSFunc==0 ); if( zFunctionName==0 /* Must have a valid name */ || (xSFunc!=0 && xFinal!=0) /* Not both xSFunc and xFinal */ || ((xFinal==0)!=(xStep==0)) /* Both or neither of xFinal and xStep */ || ((xValue==0)!=(xInverse==0)) /* Both or neither of xValue, xInverse */ || (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG) - || (255<(nName = sqlite3Strlen30( zFunctionName))) + || (255<(nName = tdsqlite3Strlen30( zFunctionName))) ){ return SQLITE_MISUSE_BKPT; } @@ -165304,11 +165304,11 @@ SQLITE_PRIVATE int sqlite3CreateFunc( enc = SQLITE_UTF16NATIVE; }else if( enc==SQLITE_ANY ){ int rc; - rc = sqlite3CreateFunc(db, zFunctionName, nArg, + rc = tdsqlite3CreateFunc(db, zFunctionName, nArg, (SQLITE_UTF8|extraFlags)^SQLITE_FUNC_UNSAFE, pUserData, xSFunc, xStep, xFinal, xValue, xInverse, pDestructor); if( rc==SQLITE_OK ){ - rc = sqlite3CreateFunc(db, zFunctionName, nArg, + rc = tdsqlite3CreateFunc(db, zFunctionName, nArg, (SQLITE_UTF16LE|extraFlags)^SQLITE_FUNC_UNSAFE, pUserData, xSFunc, xStep, xFinal, xValue, xInverse, pDestructor); } @@ -165326,19 +165326,19 @@ SQLITE_PRIVATE int sqlite3CreateFunc( ** is being overridden/deleted but there are no active VMs, allow the ** operation to continue but invalidate all precompiled statements. */ - p = sqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 0); + p = tdsqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 0); if( p && (p->funcFlags & SQLITE_FUNC_ENCMASK)==(u32)enc && p->nArg==nArg ){ if( db->nVdbeActive ){ - sqlite3ErrorWithMsg(db, SQLITE_BUSY, + tdsqlite3ErrorWithMsg(db, SQLITE_BUSY, "unable to delete/modify user-function due to active statements"); assert( !db->mallocFailed ); return SQLITE_BUSY; }else{ - sqlite3ExpirePreparedStatements(db, 0); + tdsqlite3ExpirePreparedStatements(db, 0); } } - p = sqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 1); + p = tdsqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 1); assert(p || db->mallocFailed); if( !p ){ return SQLITE_NOMEM_BKPT; @@ -165367,36 +165367,36 @@ SQLITE_PRIVATE int sqlite3CreateFunc( /* ** Worker function used by utf-8 APIs that create new functions: ** -** sqlite3_create_function() -** sqlite3_create_function_v2() -** sqlite3_create_window_function() +** tdsqlite3_create_function() +** tdsqlite3_create_function_v2() +** tdsqlite3_create_window_function() */ static int createFunctionApi( - sqlite3 *db, + tdsqlite3 *db, const char *zFunc, int nArg, int enc, void *p, - void (*xSFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), - void (*xValue)(sqlite3_context*), - void (*xInverse)(sqlite3_context*,int,sqlite3_value**), + void (*xSFunc)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*), + void (*xValue)(tdsqlite3_context*), + void (*xInverse)(tdsqlite3_context*,int,tdsqlite3_value**), void(*xDestroy)(void*) ){ int rc = SQLITE_ERROR; FuncDestructor *pArg = 0; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ return SQLITE_MISUSE_BKPT; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); if( xDestroy ){ - pArg = (FuncDestructor *)sqlite3Malloc(sizeof(FuncDestructor)); + pArg = (FuncDestructor *)tdsqlite3Malloc(sizeof(FuncDestructor)); if( !pArg ){ - sqlite3OomFault(db); + tdsqlite3OomFault(db); xDestroy(p); goto out; } @@ -165404,61 +165404,61 @@ static int createFunctionApi( pArg->xDestroy = xDestroy; pArg->pUserData = p; } - rc = sqlite3CreateFunc(db, zFunc, nArg, enc, p, + rc = tdsqlite3CreateFunc(db, zFunc, nArg, enc, p, xSFunc, xStep, xFinal, xValue, xInverse, pArg ); if( pArg && pArg->nRef==0 ){ assert( rc!=SQLITE_OK ); xDestroy(p); - sqlite3_free(pArg); + tdsqlite3_free(pArg); } out: - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); + rc = tdsqlite3ApiExit(db, rc); + tdsqlite3_mutex_leave(db->mutex); return rc; } /* ** Create new user functions. */ -SQLITE_API int sqlite3_create_function( - sqlite3 *db, +SQLITE_API int tdsqlite3_create_function( + tdsqlite3 *db, const char *zFunc, int nArg, int enc, void *p, - void (*xSFunc)(sqlite3_context*,int,sqlite3_value **), - void (*xStep)(sqlite3_context*,int,sqlite3_value **), - void (*xFinal)(sqlite3_context*) + void (*xSFunc)(tdsqlite3_context*,int,tdsqlite3_value **), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value **), + void (*xFinal)(tdsqlite3_context*) ){ return createFunctionApi(db, zFunc, nArg, enc, p, xSFunc, xStep, xFinal, 0, 0, 0); } -SQLITE_API int sqlite3_create_function_v2( - sqlite3 *db, +SQLITE_API int tdsqlite3_create_function_v2( + tdsqlite3 *db, const char *zFunc, int nArg, int enc, void *p, - void (*xSFunc)(sqlite3_context*,int,sqlite3_value **), - void (*xStep)(sqlite3_context*,int,sqlite3_value **), - void (*xFinal)(sqlite3_context*), + void (*xSFunc)(tdsqlite3_context*,int,tdsqlite3_value **), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value **), + void (*xFinal)(tdsqlite3_context*), void (*xDestroy)(void *) ){ return createFunctionApi(db, zFunc, nArg, enc, p, xSFunc, xStep, xFinal, 0, 0, xDestroy); } -SQLITE_API int sqlite3_create_window_function( - sqlite3 *db, +SQLITE_API int tdsqlite3_create_window_function( + tdsqlite3 *db, const char *zFunc, int nArg, int enc, void *p, - void (*xStep)(sqlite3_context*,int,sqlite3_value **), - void (*xFinal)(sqlite3_context*), - void (*xValue)(sqlite3_context*), - void (*xInverse)(sqlite3_context*,int,sqlite3_value **), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value **), + void (*xFinal)(tdsqlite3_context*), + void (*xValue)(tdsqlite3_context*), + void (*xInverse)(tdsqlite3_context*,int,tdsqlite3_value **), void (*xDestroy)(void *) ){ return createFunctionApi(db, zFunc, nArg, enc, p, 0, xStep, @@ -165466,29 +165466,29 @@ SQLITE_API int sqlite3_create_window_function( } #ifndef SQLITE_OMIT_UTF16 -SQLITE_API int sqlite3_create_function16( - sqlite3 *db, +SQLITE_API int tdsqlite3_create_function16( + tdsqlite3 *db, const void *zFunctionName, int nArg, int eTextRep, void *p, - void (*xSFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*) + void (*xSFunc)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*) ){ int rc; char *zFunc8; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || zFunctionName==0 ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) || zFunctionName==0 ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); assert( !db->mallocFailed ); - zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1, SQLITE_UTF16NATIVE); - rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xSFunc,xStep,xFinal,0,0,0); - sqlite3DbFree(db, zFunc8); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); + zFunc8 = tdsqlite3Utf16to8(db, zFunctionName, -1, SQLITE_UTF16NATIVE); + rc = tdsqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xSFunc,xStep,xFinal,0,0,0); + tdsqlite3DbFree(db, zFunc8); + rc = tdsqlite3ApiExit(db, rc); + tdsqlite3_mutex_leave(db->mutex); return rc; } #endif @@ -165497,23 +165497,23 @@ SQLITE_API int sqlite3_create_function16( /* ** The following is the implementation of an SQL function that always ** fails with an error message stating that the function is used in the -** wrong context. The sqlite3_overload_function() API might construct +** wrong context. The tdsqlite3_overload_function() API might construct ** SQL function that use this routine so that the functions will exist ** for name resolution but are actually overloaded by the xFindFunction ** method of virtual tables. */ -static void sqlite3InvalidFunction( - sqlite3_context *context, /* The function calling context */ +static void tdsqlite3InvalidFunction( + tdsqlite3_context *context, /* The function calling context */ int NotUsed, /* Number of arguments to the function */ - sqlite3_value **NotUsed2 /* Value of each argument */ + tdsqlite3_value **NotUsed2 /* Value of each argument */ ){ - const char *zName = (const char*)sqlite3_user_data(context); + const char *zName = (const char*)tdsqlite3_user_data(context); char *zErr; UNUSED_PARAMETER2(NotUsed, NotUsed2); - zErr = sqlite3_mprintf( + zErr = tdsqlite3_mprintf( "unable to use function %s in the requested context", zName); - sqlite3_result_error(context, zErr, -1); - sqlite3_free(zErr); + tdsqlite3_result_error(context, zErr, -1); + tdsqlite3_free(zErr); } /* @@ -165528,8 +165528,8 @@ static void sqlite3InvalidFunction( ** A global function must exist in order for name resolution to work ** properly. */ -SQLITE_API int sqlite3_overload_function( - sqlite3 *db, +SQLITE_API int tdsqlite3_overload_function( + tdsqlite3 *db, const char *zName, int nArg ){ @@ -165537,18 +165537,18 @@ SQLITE_API int sqlite3_overload_function( char *zCopy; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || zName==0 || nArg<-2 ){ + if( !tdsqlite3SafetyCheckOk(db) || zName==0 || nArg<-2 ){ return SQLITE_MISUSE_BKPT; } #endif - sqlite3_mutex_enter(db->mutex); - rc = sqlite3FindFunction(db, zName, nArg, SQLITE_UTF8, 0)!=0; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_enter(db->mutex); + rc = tdsqlite3FindFunction(db, zName, nArg, SQLITE_UTF8, 0)!=0; + tdsqlite3_mutex_leave(db->mutex); if( rc ) return SQLITE_OK; - zCopy = sqlite3_mprintf(zName); + zCopy = tdsqlite3_mprintf(zName); if( zCopy==0 ) return SQLITE_NOMEM; - return sqlite3_create_function_v2(db, zName, nArg, SQLITE_UTF8, - zCopy, sqlite3InvalidFunction, 0, 0, sqlite3_free); + return tdsqlite3_create_function_v2(db, zName, nArg, SQLITE_UTF8, + zCopy, tdsqlite3InvalidFunction, 0, 0, tdsqlite3_free); } #ifndef SQLITE_OMIT_TRACE @@ -165561,45 +165561,45 @@ SQLITE_API int sqlite3_overload_function( ** SQL statement. */ #ifndef SQLITE_OMIT_DEPRECATED -SQLITE_API void *sqlite3_trace(sqlite3 *db, void(*xTrace)(void*,const char*), void *pArg){ +SQLITE_API void *tdsqlite3_trace(tdsqlite3 *db, void(*xTrace)(void*,const char*), void *pArg){ void *pOld; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); pOld = db->pTraceArg; db->mTrace = xTrace ? SQLITE_TRACE_LEGACY : 0; db->xTrace = (int(*)(u32,void*,void*,void*))xTrace; db->pTraceArg = pArg; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return pOld; } #endif /* SQLITE_OMIT_DEPRECATED */ /* Register a trace callback using the version-2 interface. */ -SQLITE_API int sqlite3_trace_v2( - sqlite3 *db, /* Trace this connection */ +SQLITE_API int tdsqlite3_trace_v2( + tdsqlite3 *db, /* Trace this connection */ unsigned mTrace, /* Mask of events to be traced */ int(*xTrace)(unsigned,void*,void*,void*), /* Callback to invoke */ void *pArg /* Context */ ){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ return SQLITE_MISUSE_BKPT; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); if( mTrace==0 ) xTrace = 0; if( xTrace==0 ) mTrace = 0; db->mTrace = mTrace; db->xTrace = xTrace; db->pTraceArg = pArg; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return SQLITE_OK; } @@ -165612,26 +165612,26 @@ SQLITE_API int sqlite3_trace_v2( ** profile is a pointer to a function that is invoked at the conclusion of ** each SQL statement that is run. */ -SQLITE_API void *sqlite3_profile( - sqlite3 *db, +SQLITE_API void *tdsqlite3_profile( + tdsqlite3 *db, void (*xProfile)(void*,const char*,sqlite_uint64), void *pArg ){ void *pOld; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); pOld = db->pProfileArg; db->xProfile = xProfile; db->pProfileArg = pArg; db->mTrace &= SQLITE_TRACE_NONLEGACY_MASK; if( db->xProfile ) db->mTrace |= SQLITE_TRACE_XPROFILE; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return pOld; } #endif /* SQLITE_OMIT_DEPRECATED */ @@ -165642,24 +165642,24 @@ SQLITE_API void *sqlite3_profile( ** If the invoked function returns non-zero, then the commit becomes a ** rollback. */ -SQLITE_API void *sqlite3_commit_hook( - sqlite3 *db, /* Attach the hook to this database */ +SQLITE_API void *tdsqlite3_commit_hook( + tdsqlite3 *db, /* Attach the hook to this database */ int (*xCallback)(void*), /* Function to invoke on each commit */ void *pArg /* Argument to the function */ ){ void *pOld; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); pOld = db->pCommitArg; db->xCommitCallback = xCallback; db->pCommitArg = pArg; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return pOld; } @@ -165667,24 +165667,24 @@ SQLITE_API void *sqlite3_commit_hook( ** Register a callback to be invoked each time a row is updated, ** inserted or deleted using this database connection. */ -SQLITE_API void *sqlite3_update_hook( - sqlite3 *db, /* Attach the hook to this database */ +SQLITE_API void *tdsqlite3_update_hook( + tdsqlite3 *db, /* Attach the hook to this database */ void (*xCallback)(void*,int,char const *,char const *,sqlite_int64), void *pArg /* Argument to the function */ ){ void *pRet; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); pRet = db->pUpdateArg; db->xUpdateCallback = xCallback; db->pUpdateArg = pArg; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return pRet; } @@ -165692,24 +165692,24 @@ SQLITE_API void *sqlite3_update_hook( ** Register a callback to be invoked each time a transaction is rolled ** back by this database connection. */ -SQLITE_API void *sqlite3_rollback_hook( - sqlite3 *db, /* Attach the hook to this database */ +SQLITE_API void *tdsqlite3_rollback_hook( + tdsqlite3 *db, /* Attach the hook to this database */ void (*xCallback)(void*), /* Callback function */ void *pArg /* Argument to the function */ ){ void *pRet; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); pRet = db->pRollbackArg; db->xRollbackCallback = xCallback; db->pRollbackArg = pArg; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return pRet; } @@ -165718,67 +165718,67 @@ SQLITE_API void *sqlite3_rollback_hook( ** Register a callback to be invoked each time a row is updated, ** inserted or deleted using this database connection. */ -SQLITE_API void *sqlite3_preupdate_hook( - sqlite3 *db, /* Attach the hook to this database */ +SQLITE_API void *tdsqlite3_preupdate_hook( + tdsqlite3 *db, /* Attach the hook to this database */ void(*xCallback)( /* Callback function */ - void*,sqlite3*,int,char const*,char const*,sqlite3_int64,sqlite3_int64), + void*,tdsqlite3*,int,char const*,char const*,tdsqlite3_int64,tdsqlite3_int64), void *pArg /* First callback argument */ ){ void *pRet; - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); pRet = db->pPreUpdateArg; db->xPreUpdateCallback = xCallback; db->pPreUpdateArg = pArg; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return pRet; } #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ #ifndef SQLITE_OMIT_WAL /* -** The sqlite3_wal_hook() callback registered by sqlite3_wal_autocheckpoint(). -** Invoke sqlite3_wal_checkpoint if the number of frames in the log file +** The tdsqlite3_wal_hook() callback registered by tdsqlite3_wal_autocheckpoint(). +** Invoke tdsqlite3_wal_checkpoint if the number of frames in the log file ** is greater than sqlite3.pWalArg cast to an integer (the value configured by ** wal_autocheckpoint()). */ -SQLITE_PRIVATE int sqlite3WalDefaultHook( +SQLITE_PRIVATE int tdsqlite3WalDefaultHook( void *pClientData, /* Argument */ - sqlite3 *db, /* Connection */ + tdsqlite3 *db, /* Connection */ const char *zDb, /* Database */ int nFrame /* Size of WAL */ ){ if( nFrame>=SQLITE_PTR_TO_INT(pClientData) ){ - sqlite3BeginBenignMalloc(); - sqlite3_wal_checkpoint(db, zDb); - sqlite3EndBenignMalloc(); + tdsqlite3BeginBenignMalloc(); + tdsqlite3_wal_checkpoint(db, zDb); + tdsqlite3EndBenignMalloc(); } return SQLITE_OK; } #endif /* SQLITE_OMIT_WAL */ /* -** Configure an sqlite3_wal_hook() callback to automatically checkpoint +** Configure an tdsqlite3_wal_hook() callback to automatically checkpoint ** a database after committing a transaction if there are nFrame or ** more frames in the log file. Passing zero or a negative value as the ** nFrame parameter disables automatic checkpoints entirely. ** ** The callback registered by this function replaces any existing callback -** registered using sqlite3_wal_hook(). Likewise, registering a callback -** using sqlite3_wal_hook() disables the automatic checkpoint mechanism +** registered using tdsqlite3_wal_hook(). Likewise, registering a callback +** using tdsqlite3_wal_hook() disables the automatic checkpoint mechanism ** configured by this function. */ -SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){ +SQLITE_API int tdsqlite3_wal_autocheckpoint(tdsqlite3 *db, int nFrame){ #ifdef SQLITE_OMIT_WAL UNUSED_PARAMETER(db); UNUSED_PARAMETER(nFrame); #else #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif if( nFrame>0 ){ - sqlite3_wal_hook(db, sqlite3WalDefaultHook, SQLITE_INT_TO_PTR(nFrame)); + tdsqlite3_wal_hook(db, tdsqlite3WalDefaultHook, SQLITE_INT_TO_PTR(nFrame)); }else{ - sqlite3_wal_hook(db, 0, 0); + tdsqlite3_wal_hook(db, 0, 0); } #endif return SQLITE_OK; @@ -165788,24 +165788,24 @@ SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){ ** Register a callback to be invoked each time a transaction is written ** into the write-ahead-log by this database connection. */ -SQLITE_API void *sqlite3_wal_hook( - sqlite3 *db, /* Attach the hook to this db handle */ - int(*xCallback)(void *, sqlite3*, const char*, int), +SQLITE_API void *tdsqlite3_wal_hook( + tdsqlite3 *db, /* Attach the hook to this db handle */ + int(*xCallback)(void *, tdsqlite3*, const char*, int), void *pArg /* First argument passed to xCallback() */ ){ #ifndef SQLITE_OMIT_WAL void *pRet; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); pRet = db->pWalArg; db->xWalCallback = xCallback; db->pWalArg = pArg; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return pRet; #else return 0; @@ -165815,8 +165815,8 @@ SQLITE_API void *sqlite3_wal_hook( /* ** Checkpoint database zDb. */ -SQLITE_API int sqlite3_wal_checkpoint_v2( - sqlite3 *db, /* Database handle */ +SQLITE_API int tdsqlite3_wal_checkpoint_v2( + tdsqlite3 *db, /* Database handle */ const char *zDb, /* Name of attached database (or NULL) */ int eMode, /* SQLITE_CHECKPOINT_* value */ int *pnLog, /* OUT: Size of WAL log in frames */ @@ -165829,7 +165829,7 @@ SQLITE_API int sqlite3_wal_checkpoint_v2( int iDb = SQLITE_MAX_ATTACHED; /* sqlite3.aDb[] index of db to checkpoint */ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif /* Initialize the output variables to -1 in case an error occurs. */ @@ -165846,19 +165846,19 @@ SQLITE_API int sqlite3_wal_checkpoint_v2( return SQLITE_MISUSE; } - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); if( zDb && zDb[0] ){ - iDb = sqlite3FindDbName(db, zDb); + iDb = tdsqlite3FindDbName(db, zDb); } if( iDb<0 ){ rc = SQLITE_ERROR; - sqlite3ErrorWithMsg(db, SQLITE_ERROR, "unknown database: %s", zDb); + tdsqlite3ErrorWithMsg(db, SQLITE_ERROR, "unknown database: %s", zDb); }else{ db->busyHandler.nBusy = 0; - rc = sqlite3Checkpoint(db, iDb, eMode, pnLog, pnCkpt); - sqlite3Error(db, rc); + rc = tdsqlite3Checkpoint(db, iDb, eMode, pnLog, pnCkpt); + tdsqlite3Error(db, rc); } - rc = sqlite3ApiExit(db, rc); + rc = tdsqlite3ApiExit(db, rc); /* If there are no active statements, clear the interrupt flag at this ** point. */ @@ -165866,7 +165866,7 @@ SQLITE_API int sqlite3_wal_checkpoint_v2( db->u1.isInterrupted = 0; } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return rc; #endif } @@ -165877,10 +165877,10 @@ SQLITE_API int sqlite3_wal_checkpoint_v2( ** to contains a zero-length string, all attached databases are ** checkpointed. */ -SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){ - /* EVIDENCE-OF: R-41613-20553 The sqlite3_wal_checkpoint(D,X) is equivalent to - ** sqlite3_wal_checkpoint_v2(D,X,SQLITE_CHECKPOINT_PASSIVE,0,0). */ - return sqlite3_wal_checkpoint_v2(db,zDb,SQLITE_CHECKPOINT_PASSIVE,0,0); +SQLITE_API int tdsqlite3_wal_checkpoint(tdsqlite3 *db, const char *zDb){ + /* EVIDENCE-OF: R-41613-20553 The tdsqlite3_wal_checkpoint(D,X) is equivalent to + ** tdsqlite3_wal_checkpoint_v2(D,X,SQLITE_CHECKPOINT_PASSIVE,0,0). */ + return tdsqlite3_wal_checkpoint_v2(db,zDb,SQLITE_CHECKPOINT_PASSIVE,0,0); } #ifndef SQLITE_OMIT_WAL @@ -165904,18 +165904,18 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){ ** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL, RESTART ** or TRUNCATE. */ -SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3 *db, int iDb, int eMode, int *pnLog, int *pnCkpt){ +SQLITE_PRIVATE int tdsqlite3Checkpoint(tdsqlite3 *db, int iDb, int eMode, int *pnLog, int *pnCkpt){ int rc = SQLITE_OK; /* Return code */ int i; /* Used to iterate through attached dbs */ int bBusy = 0; /* True if SQLITE_BUSY has been encountered */ - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); assert( !pnLog || *pnLog==-1 ); assert( !pnCkpt || *pnCkpt==-1 ); for(i=0; inDb && rc==SQLITE_OK; i++){ if( i==iDb || iDb==SQLITE_MAX_ATTACHED ){ - rc = sqlite3BtreeCheckpoint(db->aDb[i].pBt, eMode, pnLog, pnCkpt); + rc = tdsqlite3BtreeCheckpoint(db->aDb[i].pBt, eMode, pnLog, pnCkpt); pnLog = 0; pnCkpt = 0; if( rc==SQLITE_BUSY ){ @@ -165948,7 +165948,7 @@ SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3 *db, int iDb, int eMode, int *pnLog ** 2 0 memory (return 1) ** 3 any memory (return 1) */ -SQLITE_PRIVATE int sqlite3TempInMemory(const sqlite3 *db){ +SQLITE_PRIVATE int tdsqlite3TempInMemory(const tdsqlite3 *db){ #if SQLITE_TEMP_STORE==1 return ( db->temp_store==2 ); #endif @@ -165969,26 +165969,26 @@ SQLITE_PRIVATE int sqlite3TempInMemory(const sqlite3 *db){ ** Return UTF-8 encoded English language explanation of the most recent ** error. */ -SQLITE_API const char *sqlite3_errmsg(sqlite3 *db){ +SQLITE_API const char *tdsqlite3_errmsg(tdsqlite3 *db){ const char *z; if( !db ){ - return sqlite3ErrStr(SQLITE_NOMEM_BKPT); + return tdsqlite3ErrStr(SQLITE_NOMEM_BKPT); } - if( !sqlite3SafetyCheckSickOrOk(db) ){ - return sqlite3ErrStr(SQLITE_MISUSE_BKPT); + if( !tdsqlite3SafetyCheckSickOrOk(db) ){ + return tdsqlite3ErrStr(SQLITE_MISUSE_BKPT); } - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); if( db->mallocFailed ){ - z = sqlite3ErrStr(SQLITE_NOMEM_BKPT); + z = tdsqlite3ErrStr(SQLITE_NOMEM_BKPT); }else{ testcase( db->pErr==0 ); - z = db->errCode ? (char*)sqlite3_value_text(db->pErr) : 0; + z = db->errCode ? (char*)tdsqlite3_value_text(db->pErr) : 0; assert( !db->mallocFailed ); if( z==0 ){ - z = sqlite3ErrStr(db->errCode); + z = tdsqlite3ErrStr(db->errCode); } } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return z; } @@ -165997,7 +165997,7 @@ SQLITE_API const char *sqlite3_errmsg(sqlite3 *db){ ** Return UTF-16 encoded English language explanation of the most recent ** error. */ -SQLITE_API const void *sqlite3_errmsg16(sqlite3 *db){ +SQLITE_API const void *tdsqlite3_errmsg16(tdsqlite3 *db){ static const u16 outOfMem[] = { 'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0 }; @@ -166011,36 +166011,36 @@ SQLITE_API const void *sqlite3_errmsg16(sqlite3 *db){ if( !db ){ return (void *)outOfMem; } - if( !sqlite3SafetyCheckSickOrOk(db) ){ + if( !tdsqlite3SafetyCheckSickOrOk(db) ){ return (void *)misuse; } - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); if( db->mallocFailed ){ z = (void *)outOfMem; }else{ - z = sqlite3_value_text16(db->pErr); + z = tdsqlite3_value_text16(db->pErr); if( z==0 ){ - sqlite3ErrorWithMsg(db, db->errCode, sqlite3ErrStr(db->errCode)); - z = sqlite3_value_text16(db->pErr); + tdsqlite3ErrorWithMsg(db, db->errCode, tdsqlite3ErrStr(db->errCode)); + z = tdsqlite3_value_text16(db->pErr); } - /* A malloc() may have failed within the call to sqlite3_value_text16() + /* A malloc() may have failed within the call to tdsqlite3_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 - ** sqlite3ApiExit(), to avoid setting the database handle error message. + ** tdsqlite3ApiExit(), to avoid setting the database handle error message. */ - sqlite3OomClear(db); + tdsqlite3OomClear(db); } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return z; } #endif /* SQLITE_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 sqlite3_open(). +** passed to this function, we assume a malloc() failed during tdsqlite3_open(). */ -SQLITE_API int sqlite3_errcode(sqlite3 *db){ - if( db && !sqlite3SafetyCheckSickOrOk(db) ){ +SQLITE_API int tdsqlite3_errcode(tdsqlite3 *db){ + if( db && !tdsqlite3SafetyCheckSickOrOk(db) ){ return SQLITE_MISUSE_BKPT; } if( !db || db->mallocFailed ){ @@ -166048,8 +166048,8 @@ SQLITE_API int sqlite3_errcode(sqlite3 *db){ } return db->errCode & db->errMask; } -SQLITE_API int sqlite3_extended_errcode(sqlite3 *db){ - if( db && !sqlite3SafetyCheckSickOrOk(db) ){ +SQLITE_API int tdsqlite3_extended_errcode(tdsqlite3 *db){ + if( db && !tdsqlite3SafetyCheckSickOrOk(db) ){ return SQLITE_MISUSE_BKPT; } if( !db || db->mallocFailed ){ @@ -166057,17 +166057,17 @@ SQLITE_API int sqlite3_extended_errcode(sqlite3 *db){ } return db->errCode; } -SQLITE_API int sqlite3_system_errno(sqlite3 *db){ +SQLITE_API int tdsqlite3_system_errno(tdsqlite3 *db){ return db ? db->iSysErrno : 0; } /* ** Return a string that describes the kind of error specified in the -** argument. For now, this simply calls the internal sqlite3ErrStr() +** argument. For now, this simply calls the internal tdsqlite3ErrStr() ** function. */ -SQLITE_API const char *sqlite3_errstr(int rc){ - return sqlite3ErrStr(rc); +SQLITE_API const char *tdsqlite3_errstr(int rc){ + return tdsqlite3ErrStr(rc); } /* @@ -166075,7 +166075,7 @@ SQLITE_API const char *sqlite3_errstr(int rc){ ** and the encoding is enc. */ static int createCollation( - sqlite3* db, + tdsqlite3* db, const char *zName, u8 enc, void* pCtx, @@ -166085,7 +166085,7 @@ static int createCollation( CollSeq *pColl; int enc2; - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); /* If SQLITE_UTF16 is specified as the encoding type, transform this ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the @@ -166105,23 +166105,23 @@ static int createCollation( ** sequence. If so, and there are active VMs, return busy. If there ** are no active VMs, invalidate any pre-compiled statements. */ - pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 0); + pColl = tdsqlite3FindCollSeq(db, (u8)enc2, zName, 0); if( pColl && pColl->xCmp ){ if( db->nVdbeActive ){ - sqlite3ErrorWithMsg(db, SQLITE_BUSY, + tdsqlite3ErrorWithMsg(db, SQLITE_BUSY, "unable to delete/modify collation sequence due to active statements"); return SQLITE_BUSY; } - sqlite3ExpirePreparedStatements(db, 0); + tdsqlite3ExpirePreparedStatements(db, 0); /* If collation sequence pColl was created directly by a call to - ** sqlite3_create_collation, and not generated by synthCollSeq(), + ** tdsqlite3_create_collation, and not generated by synthCollSeq(), ** then any copies made by synthCollSeq() need to be invalidated. ** Also, collation destructor - CollSeq.xDel() - function may need ** to be called. */ if( (pColl->enc & ~SQLITE_UTF16_ALIGNED)==enc2 ){ - CollSeq *aColl = sqlite3HashFind(&db->aCollSeq, zName); + CollSeq *aColl = tdsqlite3HashFind(&db->aCollSeq, zName); int j; for(j=0; j<3; j++){ CollSeq *p = &aColl[j]; @@ -166135,13 +166135,13 @@ static int createCollation( } } - pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 1); + pColl = tdsqlite3FindCollSeq(db, (u8)enc2, zName, 1); if( pColl==0 ) return SQLITE_NOMEM_BKPT; pColl->xCmp = xCompare; pColl->pUser = pCtx; pColl->xDel = xDel; pColl->enc = (u8)(enc2 | (enc & SQLITE_UTF16_ALIGNED)); - sqlite3Error(db, SQLITE_OK); + tdsqlite3Error(db, SQLITE_OK); return SQLITE_OK; } @@ -166214,11 +166214,11 @@ static const int aHardLimit[] = { ** It merely prevents new constructs that exceed the limit ** from forming. */ -SQLITE_API int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){ +SQLITE_API int tdsqlite3_limit(tdsqlite3 *db, int limitId, int newLimit){ int oldLimit; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return -1; } @@ -166260,7 +166260,7 @@ SQLITE_API int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){ /* ** This function is used to parse both URIs and non-URI filenames passed by the -** user to API functions sqlite3_open() or sqlite3_open_v2(), and for database +** user to API functions tdsqlite3_open() or tdsqlite3_open_v2(), and for database ** URIs specified as part of ATTACH statements. ** ** The first argument to this function is the name of the VFS to use (or @@ -166274,19 +166274,19 @@ SQLITE_API int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){ ** If successful, SQLITE_OK is returned. In this case *ppVfs is set to point to ** the VFS that should be used to open the database file. *pzFile is set to ** point to a buffer containing the name of the file to open. It is the -** responsibility of the caller to eventually call sqlite3_free() to release +** responsibility of the caller to eventually call tdsqlite3_free() to release ** this buffer. ** ** If an error occurs, then an SQLite error code is returned and *pzErrMsg ** may be set to point to a buffer containing an English language error ** message. It is the responsibility of the caller to eventually release -** this buffer by calling sqlite3_free(). +** this buffer by calling tdsqlite3_free(). */ -SQLITE_PRIVATE int sqlite3ParseUri( +SQLITE_PRIVATE int tdsqlite3ParseUri( const char *zDefaultVfs, /* VFS to use if no "vfs=xxx" query option */ const char *zUri, /* Nul-terminated URI to parse */ unsigned int *pFlags, /* IN/OUT: SQLITE_OPEN_XXX flags */ - sqlite3_vfs **ppVfs, /* OUT: VFS to use */ + tdsqlite3_vfs **ppVfs, /* OUT: VFS to use */ char **pzFile, /* OUT: Filename component of URI */ char **pzErrMsg /* OUT: Error message (if rc!=SQLITE_OK) */ ){ @@ -166295,12 +166295,12 @@ SQLITE_PRIVATE int sqlite3ParseUri( const char *zVfs = zDefaultVfs; char *zFile; char c; - int nUri = sqlite3Strlen30(zUri); + int nUri = tdsqlite3Strlen30(zUri); assert( *pzErrMsg==0 ); if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */ - || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */ + || tdsqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */ && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */ ){ char *zOpt; @@ -166314,7 +166314,7 @@ SQLITE_PRIVATE int sqlite3ParseUri( flags |= SQLITE_OPEN_URI; for(iIn=0; iIn=0 && octet<256 ); if( octet==0 ){ @@ -166381,7 +166381,7 @@ SQLITE_PRIVATE int sqlite3ParseUri( continue; #else /* If ENABLE_URI_00_ERROR is defined, "%00" in a URI is an error. */ - *pzErrMsg = sqlite3_mprintf("unexpected %%00 in uri"); + *pzErrMsg = tdsqlite3_mprintf("unexpected %%00 in uri"); rc = SQLITE_ERROR; goto parse_uri_out; #endif @@ -166411,13 +166411,13 @@ SQLITE_PRIVATE int sqlite3ParseUri( /* Check if there were any options specified that should be interpreted ** here. Options that are interpreted here include "vfs" and those that - ** correspond to flags that may be passed to the sqlite3_open_v2() + ** correspond to flags that may be passed to the tdsqlite3_open_v2() ** method. */ - zOpt = &zFile[sqlite3Strlen30(zFile)+1]; + zOpt = &zFile[tdsqlite3Strlen30(zFile)+1]; while( zOpt[0] ){ - int nOpt = sqlite3Strlen30(zOpt); + int nOpt = tdsqlite3Strlen30(zOpt); char *zVal = &zOpt[nOpt+1]; - int nVal = sqlite3Strlen30(zVal); + int nVal = tdsqlite3Strlen30(zVal); if( nOpt==3 && memcmp("vfs", zOpt, 3)==0 ){ zVfs = zVal; @@ -166463,18 +166463,18 @@ SQLITE_PRIVATE int sqlite3ParseUri( int mode = 0; for(i=0; aMode[i].z; i++){ const char *z = aMode[i].z; - if( nVal==sqlite3Strlen30(z) && 0==memcmp(zVal, z, nVal) ){ + if( nVal==tdsqlite3Strlen30(z) && 0==memcmp(zVal, z, nVal) ){ mode = aMode[i].mode; break; } } if( mode==0 ){ - *pzErrMsg = sqlite3_mprintf("no such %s mode: %s", zModeType, zVal); + *pzErrMsg = tdsqlite3_mprintf("no such %s mode: %s", zModeType, zVal); rc = SQLITE_ERROR; goto parse_uri_out; } if( (mode & ~SQLITE_OPEN_MEMORY)>limit ){ - *pzErrMsg = sqlite3_mprintf("%s mode not allowed: %s", + *pzErrMsg = tdsqlite3_mprintf("%s mode not allowed: %s", zModeType, zVal); rc = SQLITE_PERM; goto parse_uri_out; @@ -166487,7 +166487,7 @@ SQLITE_PRIVATE int sqlite3ParseUri( } }else{ - zFile = sqlite3_malloc64(nUri+2); + zFile = tdsqlite3_malloc64(nUri+2); if( !zFile ) return SQLITE_NOMEM_BKPT; if( nUri ){ memcpy(zFile, zUri, nUri); @@ -166497,14 +166497,14 @@ SQLITE_PRIVATE int sqlite3ParseUri( flags &= ~SQLITE_OPEN_URI; } - *ppVfs = sqlite3_vfs_find(zVfs); + *ppVfs = tdsqlite3_vfs_find(zVfs); if( *ppVfs==0 ){ - *pzErrMsg = sqlite3_mprintf("no such vfs: %s", zVfs); + *pzErrMsg = tdsqlite3_mprintf("no such vfs: %s", zVfs); rc = SQLITE_ERROR; } parse_uri_out: if( rc!=SQLITE_OK ){ - sqlite3_free(zFile); + tdsqlite3_free(zFile); zFile = 0; } *pFlags = flags; @@ -166518,27 +166518,27 @@ SQLITE_PRIVATE int sqlite3ParseUri( ** Extension. Return true if any of the relevant query parameters are ** seen and return false if not. */ -SQLITE_PRIVATE int sqlite3CodecQueryParameters( - sqlite3 *db, /* Database connection */ +SQLITE_PRIVATE int tdsqlite3CodecQueryParameters( + tdsqlite3 *db, /* Database connection */ const char *zDb, /* Which schema is being created/attached */ const char *zUri /* URI filename */ ){ const char *zKey; - if( (zKey = sqlite3_uri_parameter(zUri, "hexkey"))!=0 && zKey[0] ){ + if( (zKey = tdsqlite3_uri_parameter(zUri, "hexkey"))!=0 && zKey[0] ){ u8 iByte; int i; char zDecoded[40]; - for(i=0, iByte=0; imutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE); + db->mutex = tdsqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE); if( db->mutex==0 ){ - sqlite3_free(db); + tdsqlite3_free(db); db = 0; goto opendb_out; } if( isThreadsafe==0 ){ - sqlite3MutexWarnOnContention(db->mutex); + tdsqlite3MutexWarnOnContention(db->mutex); } } - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); db->errMask = 0xff; db->nDb = 2; db->magic = SQLITE_MAGIC_BUSY; @@ -166643,7 +166643,7 @@ static int openDatabase( db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS; db->autoCommit = 1; db->nextAutovac = -1; - db->szMmap = sqlite3GlobalConfig.szMmap; + db->szMmap = tdsqlite3GlobalConfig.szMmap; db->nextPagesize = 0; db->nMaxSorterMmap = 0x7FFFFFFF; db->flags |= SQLITE_ShortColNames @@ -166712,9 +166712,9 @@ static int openDatabase( | SQLITE_Defensive #endif ; - sqlite3HashInit(&db->aCollSeq); + tdsqlite3HashInit(&db->aCollSeq); #ifndef SQLITE_OMIT_VIRTUALTABLE - sqlite3HashInit(&db->aModule); + tdsqlite3HashInit(&db->aModule); #endif /* Add the default collation sequence BINARY. BINARY works for both UTF-8 @@ -166724,9 +166724,9 @@ static int openDatabase( ** EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating ** functions: */ - createCollation(db, sqlite3StrBINARY, SQLITE_UTF8, 0, binCollFunc, 0); - createCollation(db, sqlite3StrBINARY, SQLITE_UTF16BE, 0, binCollFunc, 0); - createCollation(db, sqlite3StrBINARY, SQLITE_UTF16LE, 0, binCollFunc, 0); + createCollation(db, tdsqlite3StrBINARY, SQLITE_UTF8, 0, binCollFunc, 0); + createCollation(db, tdsqlite3StrBINARY, SQLITE_UTF16BE, 0, binCollFunc, 0); + createCollation(db, tdsqlite3StrBINARY, SQLITE_UTF16LE, 0, binCollFunc, 0); createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0); createCollation(db, "RTRIM", SQLITE_UTF8, 0, rtrimCollFunc, 0); if( db->mallocFailed ){ @@ -166735,7 +166735,7 @@ static int openDatabase( /* EVIDENCE-OF: R-08308-17224 The default collating function for all ** strings is BINARY. */ - db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, sqlite3StrBINARY, 0); + db->pDfltColl = tdsqlite3FindCollSeq(db, SQLITE_UTF8, tdsqlite3StrBINARY, 0); assert( db->pDfltColl!=0 ); /* Parse the filename/URI argument @@ -166760,30 +166760,30 @@ static int openDatabase( if( ((1<<(flags&7)) & 0x46)==0 ){ rc = SQLITE_MISUSE_BKPT; /* IMP: R-65497-44594 */ }else{ - rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg); + rc = tdsqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg); } if( rc!=SQLITE_OK ){ - if( rc==SQLITE_NOMEM ) sqlite3OomFault(db); - sqlite3ErrorWithMsg(db, rc, zErrMsg ? "%s" : 0, zErrMsg); - sqlite3_free(zErrMsg); + if( rc==SQLITE_NOMEM ) tdsqlite3OomFault(db); + tdsqlite3ErrorWithMsg(db, rc, zErrMsg ? "%s" : 0, zErrMsg); + tdsqlite3_free(zErrMsg); goto opendb_out; } /* Open the backend database driver */ - rc = sqlite3BtreeOpen(db->pVfs, zOpen, db, &db->aDb[0].pBt, 0, + rc = tdsqlite3BtreeOpen(db->pVfs, zOpen, db, &db->aDb[0].pBt, 0, flags | SQLITE_OPEN_MAIN_DB); if( rc!=SQLITE_OK ){ if( rc==SQLITE_IOERR_NOMEM ){ rc = SQLITE_NOMEM_BKPT; } - sqlite3Error(db, rc); + tdsqlite3Error(db, rc); goto opendb_out; } - sqlite3BtreeEnter(db->aDb[0].pBt); - db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt); + tdsqlite3BtreeEnter(db->aDb[0].pBt); + db->aDb[0].pSchema = tdsqlite3SchemaGet(db, db->aDb[0].pBt); if( !db->mallocFailed ) ENC(db) = SCHEMA_ENC(db); - sqlite3BtreeLeave(db->aDb[0].pBt); - db->aDb[1].pSchema = sqlite3SchemaGet(db, 0); + tdsqlite3BtreeLeave(db->aDb[0].pBt); + db->aDb[1].pSchema = tdsqlite3SchemaGet(db, 0); /* The default safety_level for the main database is FULL; for the temp ** database it is OFF. This matches the pager layer defaults. @@ -166802,25 +166802,25 @@ static int openDatabase( ** database schema yet. This is delayed until the first time the database ** is accessed. */ - sqlite3Error(db, SQLITE_OK); - sqlite3RegisterPerConnectionBuiltinFunctions(db); - rc = sqlite3_errcode(db); + tdsqlite3Error(db, SQLITE_OK); + tdsqlite3RegisterPerConnectionBuiltinFunctions(db); + rc = tdsqlite3_errcode(db); #ifdef SQLITE_ENABLE_FTS5 /* Register any built-in FTS5 module before loading the automatic ** extensions. This allows automatic extensions to register FTS5 ** tokenizers and auxiliary functions. */ if( !db->mallocFailed && rc==SQLITE_OK ){ - rc = sqlite3Fts5Init(db); + rc = tdsqlite3Fts5Init(db); } #endif /* Load automatic extensions - extensions that have been registered - ** using the sqlite3_automatic_extension() API. + ** using the tdsqlite3_automatic_extension() API. */ if( rc==SQLITE_OK ){ - sqlite3AutoLoadExtensions(db); - rc = sqlite3_errcode(db); + tdsqlite3AutoLoadExtensions(db); + rc = tdsqlite3_errcode(db); if( rc!=SQLITE_OK ){ goto opendb_out; } @@ -166828,63 +166828,63 @@ static int openDatabase( #ifdef SQLITE_ENABLE_FTS1 if( !db->mallocFailed ){ - extern int sqlite3Fts1Init(sqlite3*); - rc = sqlite3Fts1Init(db); + extern int tdsqlite3Fts1Init(tdsqlite3*); + rc = tdsqlite3Fts1Init(db); } #endif #ifdef SQLITE_ENABLE_FTS2 if( !db->mallocFailed && rc==SQLITE_OK ){ - extern int sqlite3Fts2Init(sqlite3*); - rc = sqlite3Fts2Init(db); + extern int tdsqlite3Fts2Init(tdsqlite3*); + rc = tdsqlite3Fts2Init(db); } #endif #ifdef SQLITE_ENABLE_FTS3 /* automatically defined by SQLITE_ENABLE_FTS4 */ if( !db->mallocFailed && rc==SQLITE_OK ){ - rc = sqlite3Fts3Init(db); + rc = tdsqlite3Fts3Init(db); } #endif #if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS) if( !db->mallocFailed && rc==SQLITE_OK ){ - rc = sqlite3IcuInit(db); + rc = tdsqlite3IcuInit(db); } #endif #ifdef SQLITE_ENABLE_RTREE if( !db->mallocFailed && rc==SQLITE_OK){ - rc = sqlite3RtreeInit(db); + rc = tdsqlite3RtreeInit(db); } #endif #ifdef SQLITE_ENABLE_DBPAGE_VTAB if( !db->mallocFailed && rc==SQLITE_OK){ - rc = sqlite3DbpageRegister(db); + rc = tdsqlite3DbpageRegister(db); } #endif #ifdef SQLITE_ENABLE_DBSTAT_VTAB if( !db->mallocFailed && rc==SQLITE_OK){ - rc = sqlite3DbstatRegister(db); + rc = tdsqlite3DbstatRegister(db); } #endif #ifdef SQLITE_ENABLE_JSON1 if( !db->mallocFailed && rc==SQLITE_OK){ - rc = sqlite3Json1Init(db); + rc = tdsqlite3Json1Init(db); } #endif #ifdef SQLITE_ENABLE_STMTVTAB if( !db->mallocFailed && rc==SQLITE_OK){ - rc = sqlite3StmtVtabInit(db); + rc = tdsqlite3StmtVtabInit(db); } #endif #ifdef SQLCIPHER_EXT if( !db->mallocFailed && rc==SQLITE_OK ){ - extern int sqlcipherVtabInit(sqlite3 *); + extern int sqlcipherVtabInit(tdsqlite3 *); rc = sqlcipherVtabInit(db); } #endif @@ -166902,44 +166902,44 @@ static int openDatabase( */ #ifdef SQLITE_DEFAULT_LOCKING_MODE db->dfltLockMode = SQLITE_DEFAULT_LOCKING_MODE; - sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt), + tdsqlite3PagerLockingMode(tdsqlite3BtreePager(db->aDb[0].pBt), SQLITE_DEFAULT_LOCKING_MODE); #endif - if( rc ) sqlite3Error(db, rc); + if( rc ) tdsqlite3Error(db, rc); /* Enable the lookaside-malloc subsystem */ - setupLookaside(db, 0, sqlite3GlobalConfig.szLookaside, - sqlite3GlobalConfig.nLookaside); + setupLookaside(db, 0, tdsqlite3GlobalConfig.szLookaside, + tdsqlite3GlobalConfig.nLookaside); - sqlite3_wal_autocheckpoint(db, SQLITE_DEFAULT_WAL_AUTOCHECKPOINT); + tdsqlite3_wal_autocheckpoint(db, SQLITE_DEFAULT_WAL_AUTOCHECKPOINT); opendb_out: if( db ){ assert( db->mutex!=0 || isThreadsafe==0 - || sqlite3GlobalConfig.bFullMutex==0 ); - sqlite3_mutex_leave(db->mutex); + || tdsqlite3GlobalConfig.bFullMutex==0 ); + tdsqlite3_mutex_leave(db->mutex); } - rc = sqlite3_errcode(db); + rc = tdsqlite3_errcode(db); assert( db!=0 || rc==SQLITE_NOMEM ); if( rc==SQLITE_NOMEM ){ - sqlite3_close(db); + tdsqlite3_close(db); db = 0; }else if( rc!=SQLITE_OK ){ db->magic = SQLITE_MAGIC_SICK; } *ppDb = db; #ifdef SQLITE_ENABLE_SQLLOG - if( sqlite3GlobalConfig.xSqllog ){ + if( tdsqlite3GlobalConfig.xSqllog ){ /* Opening a db handle. Fourth parameter is passed 0. */ - void *pArg = sqlite3GlobalConfig.pSqllogArg; - sqlite3GlobalConfig.xSqllog(pArg, db, zFilename, 0); + void *pArg = tdsqlite3GlobalConfig.pSqllogArg; + tdsqlite3GlobalConfig.xSqllog(pArg, db, zFilename, 0); } #endif #if defined(SQLITE_HAS_CODEC) - if( rc==SQLITE_OK ) sqlite3CodecQueryParameters(db, 0, zOpen); + if( rc==SQLITE_OK ) tdsqlite3CodecQueryParameters(db, 0, zOpen); #endif - sqlite3_free(zOpen); + tdsqlite3_free(zOpen); return rc & 0xff; } @@ -166947,16 +166947,16 @@ opendb_out: /* ** Open a new database handle. */ -SQLITE_API int sqlite3_open( +SQLITE_API int tdsqlite3_open( const char *zFilename, - sqlite3 **ppDb + tdsqlite3 **ppDb ){ return openDatabase(zFilename, ppDb, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); } -SQLITE_API int sqlite3_open_v2( +SQLITE_API int tdsqlite3_open_v2( const char *filename, /* Database filename (UTF-8) */ - sqlite3 **ppDb, /* OUT: SQLite db handle */ + tdsqlite3 **ppDb, /* OUT: SQLite db handle */ int flags, /* Flags */ const char *zVfs /* Name of VFS module to use */ ){ @@ -166967,12 +166967,12 @@ SQLITE_API int sqlite3_open_v2( /* ** Open a new database handle. */ -SQLITE_API int sqlite3_open16( +SQLITE_API int tdsqlite3_open16( const void *zFilename, - sqlite3 **ppDb + tdsqlite3 **ppDb ){ char const *zFilename8; /* zFilename encoded in UTF-8 instead of UTF-16 */ - sqlite3_value *pVal; + tdsqlite3_value *pVal; int rc; #ifdef SQLITE_ENABLE_API_ARMOR @@ -166980,13 +166980,13 @@ SQLITE_API int sqlite3_open16( #endif *ppDb = 0; #ifndef SQLITE_OMIT_AUTOINIT - rc = sqlite3_initialize(); + rc = tdsqlite3_initialize(); if( rc ) return rc; #endif if( zFilename==0 ) zFilename = "\000\000"; - pVal = sqlite3ValueNew(0); - sqlite3ValueSetStr(pVal, -1, zFilename, SQLITE_UTF16NATIVE, SQLITE_STATIC); - zFilename8 = sqlite3ValueText(pVal, SQLITE_UTF8); + pVal = tdsqlite3ValueNew(0); + tdsqlite3ValueSetStr(pVal, -1, zFilename, SQLITE_UTF16NATIVE, SQLITE_STATIC); + zFilename8 = tdsqlite3ValueText(pVal, SQLITE_UTF8); if( zFilename8 ){ rc = openDatabase(zFilename8, ppDb, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); @@ -166997,7 +166997,7 @@ SQLITE_API int sqlite3_open16( }else{ rc = SQLITE_NOMEM_BKPT; } - sqlite3ValueFree(pVal); + tdsqlite3ValueFree(pVal); return rc & 0xff; } @@ -167006,21 +167006,21 @@ SQLITE_API int sqlite3_open16( /* ** Register a new collation sequence with the database handle db. */ -SQLITE_API int sqlite3_create_collation( - sqlite3* db, +SQLITE_API int tdsqlite3_create_collation( + tdsqlite3* db, const char *zName, int enc, void* pCtx, int(*xCompare)(void*,int,const void*,int,const void*) ){ - return sqlite3_create_collation_v2(db, zName, enc, pCtx, xCompare, 0); + return tdsqlite3_create_collation_v2(db, zName, enc, pCtx, xCompare, 0); } /* ** Register a new collation sequence with the database handle db. */ -SQLITE_API int sqlite3_create_collation_v2( - sqlite3* db, +SQLITE_API int tdsqlite3_create_collation_v2( + tdsqlite3* db, const char *zName, int enc, void* pCtx, @@ -167030,13 +167030,13 @@ SQLITE_API int sqlite3_create_collation_v2( int rc; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); assert( !db->mallocFailed ); rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, xDel); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); + rc = tdsqlite3ApiExit(db, rc); + tdsqlite3_mutex_leave(db->mutex); return rc; } @@ -167044,8 +167044,8 @@ SQLITE_API int sqlite3_create_collation_v2( /* ** Register a new collation sequence with the database handle db. */ -SQLITE_API int sqlite3_create_collation16( - sqlite3* db, +SQLITE_API int tdsqlite3_create_collation16( + tdsqlite3* db, const void *zName, int enc, void* pCtx, @@ -167055,17 +167055,17 @@ SQLITE_API int sqlite3_create_collation16( char *zName8; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); assert( !db->mallocFailed ); - zName8 = sqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE); + zName8 = tdsqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE); if( zName8 ){ rc = createCollation(db, zName8, (u8)enc, pCtx, xCompare, 0); - sqlite3DbFree(db, zName8); + tdsqlite3DbFree(db, zName8); } - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); + rc = tdsqlite3ApiExit(db, rc); + tdsqlite3_mutex_leave(db->mutex); return rc; } #endif /* SQLITE_OMIT_UTF16 */ @@ -167074,19 +167074,19 @@ SQLITE_API int sqlite3_create_collation16( ** Register a collation sequence factory callback with the database handle ** db. Replace any previously installed collation sequence factory. */ -SQLITE_API int sqlite3_collation_needed( - sqlite3 *db, +SQLITE_API int tdsqlite3_collation_needed( + tdsqlite3 *db, void *pCollNeededArg, - void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*) + void(*xCollNeeded)(void*,tdsqlite3*,int eTextRep,const char*) ){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); db->xCollNeeded = xCollNeeded; db->xCollNeeded16 = 0; db->pCollNeededArg = pCollNeededArg; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return SQLITE_OK; } @@ -167095,19 +167095,19 @@ SQLITE_API int sqlite3_collation_needed( ** Register a collation sequence factory callback with the database handle ** db. Replace any previously installed collation sequence factory. */ -SQLITE_API int sqlite3_collation_needed16( - sqlite3 *db, +SQLITE_API int tdsqlite3_collation_needed16( + tdsqlite3 *db, void *pCollNeededArg, - void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*) + void(*xCollNeeded16)(void*,tdsqlite3*,int eTextRep,const void*) ){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); db->xCollNeeded = 0; db->xCollNeeded16 = xCollNeeded16; db->pCollNeededArg = pCollNeededArg; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return SQLITE_OK; } #endif /* SQLITE_OMIT_UTF16 */ @@ -167117,7 +167117,7 @@ SQLITE_API int sqlite3_collation_needed16( ** This function is now an anachronism. It used to be used to recover from a ** malloc() failure, but SQLite now does this automatically. */ -SQLITE_API int sqlite3_global_recover(void){ +SQLITE_API int tdsqlite3_global_recover(void){ return SQLITE_OK; } #endif @@ -167128,9 +167128,9 @@ SQLITE_API int sqlite3_global_recover(void){ ** by default. Autocommit is disabled by a BEGIN statement and reenabled ** by the next COMMIT or ROLLBACK. */ -SQLITE_API int sqlite3_get_autocommit(sqlite3 *db){ +SQLITE_API int tdsqlite3_get_autocommit(tdsqlite3 *db){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } @@ -167146,40 +167146,40 @@ SQLITE_API int sqlite3_get_autocommit(sqlite3 *db){ ** 1. Serve as a convenient place to set a breakpoint in a debugger ** to detect when version error conditions occurs. ** -** 2. Invoke sqlite3_log() to provide the source code location where +** 2. Invoke tdsqlite3_log() to provide the source code location where ** a low-level error is first detected. */ -SQLITE_PRIVATE int sqlite3ReportError(int iErr, int lineno, const char *zType){ - sqlite3_log(iErr, "%s at line %d of [%.10s]", - zType, lineno, 20+sqlite3_sourceid()); +SQLITE_PRIVATE int tdsqlite3ReportError(int iErr, int lineno, const char *zType){ + tdsqlite3_log(iErr, "%s at line %d of [%.10s]", + zType, lineno, 20+tdsqlite3_sourceid()); return iErr; } -SQLITE_PRIVATE int sqlite3CorruptError(int lineno){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - return sqlite3ReportError(SQLITE_CORRUPT, lineno, "database corruption"); +SQLITE_PRIVATE int tdsqlite3CorruptError(int lineno){ + testcase( tdsqlite3GlobalConfig.xLog!=0 ); + return tdsqlite3ReportError(SQLITE_CORRUPT, lineno, "database corruption"); } -SQLITE_PRIVATE int sqlite3MisuseError(int lineno){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - return sqlite3ReportError(SQLITE_MISUSE, lineno, "misuse"); +SQLITE_PRIVATE int tdsqlite3MisuseError(int lineno){ + testcase( tdsqlite3GlobalConfig.xLog!=0 ); + return tdsqlite3ReportError(SQLITE_MISUSE, lineno, "misuse"); } -SQLITE_PRIVATE int sqlite3CantopenError(int lineno){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - return sqlite3ReportError(SQLITE_CANTOPEN, lineno, "cannot open file"); +SQLITE_PRIVATE int tdsqlite3CantopenError(int lineno){ + testcase( tdsqlite3GlobalConfig.xLog!=0 ); + return tdsqlite3ReportError(SQLITE_CANTOPEN, lineno, "cannot open file"); } #ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3CorruptPgnoError(int lineno, Pgno pgno){ +SQLITE_PRIVATE int tdsqlite3CorruptPgnoError(int lineno, Pgno pgno){ char zMsg[100]; - sqlite3_snprintf(sizeof(zMsg), zMsg, "database corruption page %d", pgno); - testcase( sqlite3GlobalConfig.xLog!=0 ); - return sqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg); + tdsqlite3_snprintf(sizeof(zMsg), zMsg, "database corruption page %d", pgno); + testcase( tdsqlite3GlobalConfig.xLog!=0 ); + return tdsqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg); } -SQLITE_PRIVATE int sqlite3NomemError(int lineno){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - return sqlite3ReportError(SQLITE_NOMEM, lineno, "OOM"); +SQLITE_PRIVATE int tdsqlite3NomemError(int lineno){ + testcase( tdsqlite3GlobalConfig.xLog!=0 ); + return tdsqlite3ReportError(SQLITE_NOMEM, lineno, "OOM"); } -SQLITE_PRIVATE int sqlite3IoerrnomemError(int lineno){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - return sqlite3ReportError(SQLITE_IOERR_NOMEM, lineno, "I/O OOM error"); +SQLITE_PRIVATE int tdsqlite3IoerrnomemError(int lineno){ + testcase( tdsqlite3GlobalConfig.xLog!=0 ); + return tdsqlite3ReportError(SQLITE_IOERR_NOMEM, lineno, "I/O OOM error"); } #endif @@ -167191,7 +167191,7 @@ SQLITE_PRIVATE int sqlite3IoerrnomemError(int lineno){ ** SQLite no longer uses thread-specific data so this routine is now a ** no-op. It is retained for historical compatibility. */ -SQLITE_API void sqlite3_thread_cleanup(void){ +SQLITE_API void tdsqlite3_thread_cleanup(void){ } #endif @@ -167199,8 +167199,8 @@ SQLITE_API void sqlite3_thread_cleanup(void){ ** Return meta information about a specific column of a database table. ** See comment in sqlite3.h (sqlite.h.in) for details. */ -SQLITE_API int sqlite3_table_column_metadata( - sqlite3 *db, /* Connection handle */ +SQLITE_API int tdsqlite3_table_column_metadata( + tdsqlite3 *db, /* Connection handle */ const char *zDbName, /* Database name or NULL */ const char *zTableName, /* Table name */ const char *zColumnName, /* Column name */ @@ -167223,21 +167223,21 @@ SQLITE_API int sqlite3_table_column_metadata( #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || zTableName==0 ){ + if( !tdsqlite3SafetyCheckOk(db) || zTableName==0 ){ return SQLITE_MISUSE_BKPT; } #endif /* Ensure the database schema has been loaded */ - sqlite3_mutex_enter(db->mutex); - sqlite3BtreeEnterAll(db); - rc = sqlite3Init(db, &zErrMsg); + tdsqlite3_mutex_enter(db->mutex); + tdsqlite3BtreeEnterAll(db); + rc = tdsqlite3Init(db, &zErrMsg); if( SQLITE_OK!=rc ){ goto error_out; } /* Locate the table in question */ - pTab = sqlite3FindTable(db, zTableName, zDbName); + pTab = tdsqlite3FindTable(db, zTableName, zDbName); if( !pTab || pTab->pSelect ){ pTab = 0; goto error_out; @@ -167249,12 +167249,12 @@ SQLITE_API int sqlite3_table_column_metadata( }else{ for(iCol=0; iColnCol; iCol++){ pCol = &pTab->aCol[iCol]; - if( 0==sqlite3StrICmp(pCol->zName, zColumnName) ){ + if( 0==tdsqlite3StrICmp(pCol->zName, zColumnName) ){ break; } } if( iCol==pTab->nCol ){ - if( HasRowid(pTab) && sqlite3IsRowid(zColumnName) ){ + if( HasRowid(pTab) && tdsqlite3IsRowid(zColumnName) ){ iCol = pTab->iPKey; pCol = iCol>=0 ? &pTab->aCol[iCol] : 0; }else{ @@ -167275,7 +167275,7 @@ SQLITE_API int sqlite3_table_column_metadata( ** explicitly declared column. Copy meta information from *pCol. */ if( pCol ){ - zDataType = sqlite3ColumnType(pCol,0); + zDataType = tdsqlite3ColumnType(pCol,0); zCollSeq = pCol->zColl; notnull = pCol->notNull!=0; primarykey = (pCol->colFlags & COLFLAG_PRIMKEY)!=0; @@ -167285,11 +167285,11 @@ SQLITE_API int sqlite3_table_column_metadata( primarykey = 1; } if( !zCollSeq ){ - zCollSeq = sqlite3StrBINARY; + zCollSeq = tdsqlite3StrBINARY; } error_out: - sqlite3BtreeLeaveAll(db); + tdsqlite3BtreeLeaveAll(db); /* Whether the function call succeeded or failed, set the output parameters ** to whatever their local counterparts contain. If an error did occur, @@ -167302,92 +167302,92 @@ error_out: if( pAutoinc ) *pAutoinc = autoinc; if( SQLITE_OK==rc && !pTab ){ - sqlite3DbFree(db, zErrMsg); - zErrMsg = sqlite3MPrintf(db, "no such table column: %s.%s", zTableName, + tdsqlite3DbFree(db, zErrMsg); + zErrMsg = tdsqlite3MPrintf(db, "no such table column: %s.%s", zTableName, zColumnName); rc = SQLITE_ERROR; } - sqlite3ErrorWithMsg(db, rc, (zErrMsg?"%s":0), zErrMsg); - sqlite3DbFree(db, zErrMsg); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); + tdsqlite3ErrorWithMsg(db, rc, (zErrMsg?"%s":0), zErrMsg); + tdsqlite3DbFree(db, zErrMsg); + rc = tdsqlite3ApiExit(db, rc); + tdsqlite3_mutex_leave(db->mutex); return rc; } /* ** Sleep for a little while. Return the amount of time slept. */ -SQLITE_API int sqlite3_sleep(int ms){ - sqlite3_vfs *pVfs; +SQLITE_API int tdsqlite3_sleep(int ms){ + tdsqlite3_vfs *pVfs; int rc; - pVfs = sqlite3_vfs_find(0); + pVfs = tdsqlite3_vfs_find(0); if( pVfs==0 ) return 0; /* This function works in milliseconds, but the underlying OsSleep() ** API uses microseconds. Hence the 1000's. */ - rc = (sqlite3OsSleep(pVfs, 1000*ms)/1000); + rc = (tdsqlite3OsSleep(pVfs, 1000*ms)/1000); return rc; } /* ** Enable or disable the extended result codes. */ -SQLITE_API int sqlite3_extended_result_codes(sqlite3 *db, int onoff){ +SQLITE_API int tdsqlite3_extended_result_codes(tdsqlite3 *db, int onoff){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); db->errMask = onoff ? 0xffffffff : 0xff; - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return SQLITE_OK; } /* ** Invoke the xFileControl method on a particular database. */ -SQLITE_API int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){ +SQLITE_API int tdsqlite3_file_control(tdsqlite3 *db, const char *zDbName, int op, void *pArg){ int rc = SQLITE_ERROR; Btree *pBtree; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; + if( !tdsqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; #endif - sqlite3_mutex_enter(db->mutex); - pBtree = sqlite3DbNameToBtree(db, zDbName); + tdsqlite3_mutex_enter(db->mutex); + pBtree = tdsqlite3DbNameToBtree(db, zDbName); if( pBtree ){ Pager *pPager; - sqlite3_file *fd; - sqlite3BtreeEnter(pBtree); - pPager = sqlite3BtreePager(pBtree); + tdsqlite3_file *fd; + tdsqlite3BtreeEnter(pBtree); + pPager = tdsqlite3BtreePager(pBtree); assert( pPager!=0 ); - fd = sqlite3PagerFile(pPager); + fd = tdsqlite3PagerFile(pPager); assert( fd!=0 ); if( op==SQLITE_FCNTL_FILE_POINTER ){ - *(sqlite3_file**)pArg = fd; + *(tdsqlite3_file**)pArg = fd; rc = SQLITE_OK; }else if( op==SQLITE_FCNTL_VFS_POINTER ){ - *(sqlite3_vfs**)pArg = sqlite3PagerVfs(pPager); + *(tdsqlite3_vfs**)pArg = tdsqlite3PagerVfs(pPager); rc = SQLITE_OK; }else if( op==SQLITE_FCNTL_JOURNAL_POINTER ){ - *(sqlite3_file**)pArg = sqlite3PagerJrnlFile(pPager); + *(tdsqlite3_file**)pArg = tdsqlite3PagerJrnlFile(pPager); rc = SQLITE_OK; }else if( op==SQLITE_FCNTL_DATA_VERSION ){ - *(unsigned int*)pArg = sqlite3PagerDataVersion(pPager); + *(unsigned int*)pArg = tdsqlite3PagerDataVersion(pPager); rc = SQLITE_OK; }else{ - rc = sqlite3OsFileControl(fd, op, pArg); + rc = tdsqlite3OsFileControl(fd, op, pArg); } - sqlite3BtreeLeave(pBtree); + tdsqlite3BtreeLeave(pBtree); } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); return rc; } /* ** Interface to the testing logic. */ -SQLITE_API int sqlite3_test_control(int op, ...){ +SQLITE_API int tdsqlite3_test_control(int op, ...){ int rc = 0; #ifdef SQLITE_UNTESTABLE UNUSED_PARAMETER(op); @@ -167400,7 +167400,7 @@ SQLITE_API int sqlite3_test_control(int op, ...){ ** Save the current state of the PRNG. */ case SQLITE_TESTCTRL_PRNG_SAVE: { - sqlite3PrngSaveState(); + tdsqlite3PrngSaveState(); break; } @@ -167410,11 +167410,11 @@ SQLITE_API int sqlite3_test_control(int op, ...){ ** this verb acts like PRNG_RESET. */ case SQLITE_TESTCTRL_PRNG_RESTORE: { - sqlite3PrngRestoreState(); + tdsqlite3PrngRestoreState(); break; } - /* sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SEED, int x, sqlite3 *db); + /* tdsqlite3_test_control(SQLITE_TESTCTRL_PRNG_SEED, int x, tdsqlite3 *db); ** ** Control the seed for the pseudo-random number generator (PRNG) that ** is built into SQLite. Cases: @@ -167432,60 +167432,60 @@ SQLITE_API int sqlite3_test_control(int op, ...){ ** xRandomness method on the primary VFS. ** ** This test-control also resets the PRNG so that the new seed will - ** be used for the next call to sqlite3_randomness(). + ** be used for the next call to tdsqlite3_randomness(). */ #ifndef SQLITE_OMIT_WSD case SQLITE_TESTCTRL_PRNG_SEED: { int x = va_arg(ap, int); int y; - sqlite3 *db = va_arg(ap, sqlite3*); + tdsqlite3 *db = va_arg(ap, tdsqlite3*); assert( db==0 || db->aDb[0].pSchema!=0 ); if( db && (y = db->aDb[0].pSchema->schema_cookie)!=0 ){ x = y; } - sqlite3Config.iPrngSeed = x; - sqlite3_randomness(0,0); + tdsqlite3Config.iPrngSeed = x; + tdsqlite3_randomness(0,0); break; } #endif /* - ** sqlite3_test_control(BITVEC_TEST, size, program) + ** tdsqlite3_test_control(BITVEC_TEST, size, program) ** ** Run a test against a Bitvec object of size. The program argument ** is an array of integers that defines the test. Return -1 on a ** memory allocation error, 0 on success, or non-zero for an error. - ** See the sqlite3BitvecBuiltinTest() for additional information. + ** See the tdsqlite3BitvecBuiltinTest() for additional information. */ case SQLITE_TESTCTRL_BITVEC_TEST: { int sz = va_arg(ap, int); int *aProg = va_arg(ap, int*); - rc = sqlite3BitvecBuiltinTest(sz, aProg); + rc = tdsqlite3BitvecBuiltinTest(sz, aProg); break; } /* - ** sqlite3_test_control(FAULT_INSTALL, xCallback) + ** tdsqlite3_test_control(FAULT_INSTALL, xCallback) ** - ** Arrange to invoke xCallback() whenever sqlite3FaultSim() is called, + ** Arrange to invoke xCallback() whenever tdsqlite3FaultSim() is called, ** if xCallback is not NULL. ** - ** As a test of the fault simulator mechanism itself, sqlite3FaultSim(0) + ** As a test of the fault simulator mechanism itself, tdsqlite3FaultSim(0) ** is called immediately after installing the new callback and the return - ** value from sqlite3FaultSim(0) becomes the return from - ** sqlite3_test_control(). + ** value from tdsqlite3FaultSim(0) becomes the return from + ** tdsqlite3_test_control(). */ case SQLITE_TESTCTRL_FAULT_INSTALL: { /* MSVC is picky about pulling func ptrs from va lists. ** http://support.microsoft.com/kb/47961 - ** sqlite3GlobalConfig.xTestCallback = va_arg(ap, int(*)(int)); + ** tdsqlite3GlobalConfig.xTestCallback = va_arg(ap, int(*)(int)); */ typedef int(*TESTCALLBACKFUNC_t)(int); - sqlite3GlobalConfig.xTestCallback = va_arg(ap, TESTCALLBACKFUNC_t); - rc = sqlite3FaultSim(0); + tdsqlite3GlobalConfig.xTestCallback = va_arg(ap, TESTCALLBACKFUNC_t); + rc = tdsqlite3FaultSim(0); break; } /* - ** sqlite3_test_control(BENIGN_MALLOC_HOOKS, xBegin, xEnd) + ** tdsqlite3_test_control(BENIGN_MALLOC_HOOKS, xBegin, xEnd) ** ** Register hooks to call to indicate which malloc() failures ** are benign. @@ -167496,12 +167496,12 @@ SQLITE_API int sqlite3_test_control(int op, ...){ void_function xBenignEnd; xBenignBegin = va_arg(ap, void_function); xBenignEnd = va_arg(ap, void_function); - sqlite3BenignMallocHooks(xBenignBegin, xBenignEnd); + tdsqlite3BenignMallocHooks(xBenignBegin, xBenignEnd); break; } /* - ** sqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, unsigned int X) + ** tdsqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, unsigned int X) ** ** Set the PENDING byte to the value in the argument, if X>0. ** Make no changes if X==0. Return the value of the pending byte @@ -167517,14 +167517,14 @@ SQLITE_API int sqlite3_test_control(int op, ...){ #ifndef SQLITE_OMIT_WSD { unsigned int newVal = va_arg(ap, unsigned int); - if( newVal ) sqlite3PendingByte = newVal; + if( newVal ) tdsqlite3PendingByte = newVal; } #endif break; } /* - ** sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, int X) + ** tdsqlite3_test_control(SQLITE_TESTCTRL_ASSERT, int X) ** ** This action provides a run-time test to see whether or not ** assert() was enabled at compile-time. If X is true and assert() @@ -167543,7 +167543,7 @@ SQLITE_API int sqlite3_test_control(int op, ...){ /* - ** sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, int X) + ** tdsqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, int X) ** ** This action provides a run-time test to see how the ALWAYS and ** NEVER macros were defined at compile-time. @@ -167561,9 +167561,9 @@ SQLITE_API int sqlite3_test_control(int op, ...){ ** ** The run-time test procedure might look something like this: ** - ** if( sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, 2)==2 ){ + ** if( tdsqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, 2)==2 ){ ** // ALWAYS() and NEVER() are no-op pass-through macros - ** }else if( sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, 1) ){ + ** }else if( tdsqlite3_test_control(SQLITE_TESTCTRL_ASSERT, 1) ){ ** // ALWAYS(x) asserts that x is true. NEVER(x) asserts x is false. ** }else{ ** // ALWAYS(x) is a constant 1. NEVER(x) is a constant 0. @@ -167576,7 +167576,7 @@ SQLITE_API int sqlite3_test_control(int op, ...){ } /* - ** sqlite3_test_control(SQLITE_TESTCTRL_BYTEORDER); + ** tdsqlite3_test_control(SQLITE_TESTCTRL_BYTEORDER); ** ** The integer returned reveals the byte-order of the computer on which ** SQLite is running: @@ -167591,21 +167591,21 @@ SQLITE_API int sqlite3_test_control(int op, ...){ break; } - /* sqlite3_test_control(SQLITE_TESTCTRL_RESERVE, sqlite3 *db, int N) + /* tdsqlite3_test_control(SQLITE_TESTCTRL_RESERVE, tdsqlite3 *db, int N) ** ** Set the nReserve size to N for the main database on the database ** connection db. */ case SQLITE_TESTCTRL_RESERVE: { - sqlite3 *db = va_arg(ap, sqlite3*); + tdsqlite3 *db = va_arg(ap, tdsqlite3*); int x = va_arg(ap,int); - sqlite3_mutex_enter(db->mutex); - sqlite3BtreeSetPageSize(db->aDb[0].pBt, 0, x, 0); - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_enter(db->mutex); + tdsqlite3BtreeSetPageSize(db->aDb[0].pBt, 0, x, 0); + tdsqlite3_mutex_leave(db->mutex); break; } - /* sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, sqlite3 *db, int N) + /* tdsqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, tdsqlite3 *db, int N) ** ** Enable or disable various optimizations for testing purposes. The ** argument N is a bitmask of optimizations to be disabled. For normal @@ -167615,33 +167615,33 @@ SQLITE_API int sqlite3_test_control(int op, ...){ ** is obtained in every case. */ case SQLITE_TESTCTRL_OPTIMIZATIONS: { - sqlite3 *db = va_arg(ap, sqlite3*); + tdsqlite3 *db = va_arg(ap, tdsqlite3*); db->dbOptFlags = (u16)(va_arg(ap, int) & 0xffff); break; } - /* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff); + /* tdsqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff); ** ** If parameter onoff is non-zero, subsequent calls to localtime() ** and its variants fail. If onoff is zero, undo this setting. */ case SQLITE_TESTCTRL_LOCALTIME_FAULT: { - sqlite3GlobalConfig.bLocaltimeFault = va_arg(ap, int); + tdsqlite3GlobalConfig.bLocaltimeFault = va_arg(ap, int); break; } - /* sqlite3_test_control(SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, sqlite3*); + /* tdsqlite3_test_control(SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, tdsqlite3*); ** ** Toggle the ability to use internal functions on or off for ** the database connection given in the argument. */ case SQLITE_TESTCTRL_INTERNAL_FUNCTIONS: { - sqlite3 *db = va_arg(ap, sqlite3*); + tdsqlite3 *db = va_arg(ap, tdsqlite3*); db->mDbFlags ^= DBFLAG_InternalFunc; break; } - /* sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, int); + /* tdsqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, int); ** ** Set or clear a flag that indicates that the database file is always well- ** formed and never corrupt. This flag is clear by default, indicating that @@ -167650,18 +167650,18 @@ SQLITE_API int sqlite3_test_control(int op, ...){ ** that demonstrat invariants on well-formed database files. */ case SQLITE_TESTCTRL_NEVER_CORRUPT: { - sqlite3GlobalConfig.neverCorrupt = va_arg(ap, int); + tdsqlite3GlobalConfig.neverCorrupt = va_arg(ap, int); break; } - /* sqlite3_test_control(SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS, int); + /* tdsqlite3_test_control(SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS, int); ** ** Set or clear a flag that causes SQLite to verify that type, name, ** and tbl_name fields of the sqlite_master table. This is normally ** on, but it is sometimes useful to turn it off for testing. */ case SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS: { - sqlite3GlobalConfig.bExtraSchemaChecks = va_arg(ap, int); + tdsqlite3GlobalConfig.bExtraSchemaChecks = va_arg(ap, int); break; } @@ -167671,11 +167671,11 @@ SQLITE_API int sqlite3_test_control(int op, ...){ ** provided to set a small and easily reachable reset value. */ case SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD: { - sqlite3GlobalConfig.iOnceResetThreshold = va_arg(ap, int); + tdsqlite3GlobalConfig.iOnceResetThreshold = va_arg(ap, int); break; } - /* sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE, xCallback, ptr); + /* tdsqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE, xCallback, ptr); ** ** Set the VDBE coverage callback function to xCallback with context ** pointer ptr. @@ -167684,30 +167684,30 @@ SQLITE_API int sqlite3_test_control(int op, ...){ #ifdef SQLITE_VDBE_COVERAGE typedef void (*branch_callback)(void*,unsigned int, unsigned char,unsigned char); - sqlite3GlobalConfig.xVdbeBranch = va_arg(ap,branch_callback); - sqlite3GlobalConfig.pVdbeBranchArg = va_arg(ap,void*); + tdsqlite3GlobalConfig.xVdbeBranch = va_arg(ap,branch_callback); + tdsqlite3GlobalConfig.pVdbeBranchArg = va_arg(ap,void*); #endif break; } - /* sqlite3_test_control(SQLITE_TESTCTRL_SORTER_MMAP, db, nMax); */ + /* tdsqlite3_test_control(SQLITE_TESTCTRL_SORTER_MMAP, db, nMax); */ case SQLITE_TESTCTRL_SORTER_MMAP: { - sqlite3 *db = va_arg(ap, sqlite3*); + tdsqlite3 *db = va_arg(ap, tdsqlite3*); db->nMaxSorterMmap = va_arg(ap, int); break; } - /* sqlite3_test_control(SQLITE_TESTCTRL_ISINIT); + /* tdsqlite3_test_control(SQLITE_TESTCTRL_ISINIT); ** ** Return SQLITE_OK if SQLite has been initialized and SQLITE_ERROR if ** not. */ case SQLITE_TESTCTRL_ISINIT: { - if( sqlite3GlobalConfig.isInit==0 ) rc = SQLITE_ERROR; + if( tdsqlite3GlobalConfig.isInit==0 ) rc = SQLITE_ERROR; break; } - /* sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, db, dbName, onOff, tnum); + /* tdsqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, db, dbName, onOff, tnum); ** ** This test control is used to create imposter tables. "db" is a pointer ** to the database connection. dbName is the database name (ex: "main" or @@ -167724,20 +167724,20 @@ SQLITE_API int sqlite3_test_control(int op, ...){ ** effect of erasing all imposter tables. */ case SQLITE_TESTCTRL_IMPOSTER: { - sqlite3 *db = va_arg(ap, sqlite3*); - sqlite3_mutex_enter(db->mutex); - db->init.iDb = sqlite3FindDbName(db, va_arg(ap,const char*)); + tdsqlite3 *db = va_arg(ap, tdsqlite3*); + tdsqlite3_mutex_enter(db->mutex); + db->init.iDb = tdsqlite3FindDbName(db, va_arg(ap,const char*)); db->init.busy = db->init.imposterTable = va_arg(ap,int); db->init.newTnum = va_arg(ap,int); if( db->init.busy==0 && db->init.newTnum>0 ){ - sqlite3ResetAllSchemasOfConnection(db); + tdsqlite3ResetAllSchemasOfConnection(db); } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); break; } #if defined(YYCOVERAGE) - /* sqlite3_test_control(SQLITE_TESTCTRL_PARSER_COVERAGE, FILE *out) + /* tdsqlite3_test_control(SQLITE_TESTCTRL_PARSER_COVERAGE, FILE *out) ** ** This test control (only available when SQLite is compiled with ** -DYYCOVERAGE) writes a report onto "out" that shows all @@ -167747,14 +167747,14 @@ SQLITE_API int sqlite3_test_control(int op, ...){ */ case SQLITE_TESTCTRL_PARSER_COVERAGE: { FILE *out = va_arg(ap, FILE*); - if( sqlite3ParserCoverage(out) ) rc = SQLITE_ERROR; + if( tdsqlite3ParserCoverage(out) ) rc = SQLITE_ERROR; break; } #endif /* defined(YYCOVERAGE) */ - /* sqlite3_test_control(SQLITE_TESTCTRL_RESULT_INTREAL, sqlite3_context*); + /* tdsqlite3_test_control(SQLITE_TESTCTRL_RESULT_INTREAL, tdsqlite3_context*); ** - ** This test-control causes the most recent sqlite3_result_int64() value + ** This test-control causes the most recent tdsqlite3_result_int64() value ** to be interpreted as a MEM_IntReal instead of as an MEM_Int. Normally, ** MEM_IntReal values only arise during an INSERT operation of integer ** values into a REAL column, so they can be challenging to test. This @@ -167763,8 +167763,8 @@ SQLITE_API int sqlite3_test_control(int op, ...){ ** for testing purposes. */ case SQLITE_TESTCTRL_RESULT_INTREAL: { - sqlite3_context *pCtx = va_arg(ap, sqlite3_context*); - sqlite3ResultIntReal(pCtx); + tdsqlite3_context *pCtx = va_arg(ap, tdsqlite3_context*); + tdsqlite3ResultIntReal(pCtx); break; } } @@ -167784,14 +167784,14 @@ SQLITE_API int sqlite3_test_control(int op, ...){ ** parameter if it exists. If the parameter does not exist, this routine ** returns a NULL pointer. */ -SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam){ +SQLITE_API const char *tdsqlite3_uri_parameter(const char *zFilename, const char *zParam){ if( zFilename==0 || zParam==0 ) return 0; - zFilename += sqlite3Strlen30(zFilename) + 1; + zFilename += tdsqlite3Strlen30(zFilename) + 1; while( zFilename[0] ){ int x = strcmp(zFilename, zParam); - zFilename += sqlite3Strlen30(zFilename) + 1; + zFilename += tdsqlite3Strlen30(zFilename) + 1; if( x==0 ) return zFilename; - zFilename += sqlite3Strlen30(zFilename) + 1; + zFilename += tdsqlite3Strlen30(zFilename) + 1; } return 0; } @@ -167799,12 +167799,12 @@ SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char * /* ** Return a pointer to the name of Nth query parameter of the filename. */ -SQLITE_API const char *sqlite3_uri_key(const char *zFilename, int N){ +SQLITE_API const char *tdsqlite3_uri_key(const char *zFilename, int N){ if( zFilename==0 || N<0 ) return 0; - zFilename += sqlite3Strlen30(zFilename) + 1; + zFilename += tdsqlite3Strlen30(zFilename) + 1; while( zFilename[0] && (N--)>0 ){ - zFilename += sqlite3Strlen30(zFilename) + 1; - zFilename += sqlite3Strlen30(zFilename) + 1; + zFilename += tdsqlite3Strlen30(zFilename) + 1; + zFilename += tdsqlite3Strlen30(zFilename) + 1; } return zFilename[0] ? zFilename : 0; } @@ -167812,23 +167812,23 @@ SQLITE_API const char *sqlite3_uri_key(const char *zFilename, int N){ /* ** Return a boolean value for a query parameter. */ -SQLITE_API int sqlite3_uri_boolean(const char *zFilename, const char *zParam, int bDflt){ - const char *z = sqlite3_uri_parameter(zFilename, zParam); +SQLITE_API int tdsqlite3_uri_boolean(const char *zFilename, const char *zParam, int bDflt){ + const char *z = tdsqlite3_uri_parameter(zFilename, zParam); bDflt = bDflt!=0; - return z ? sqlite3GetBoolean(z, bDflt) : bDflt; + return z ? tdsqlite3GetBoolean(z, bDflt) : bDflt; } /* ** Return a 64-bit integer value for a query parameter. */ -SQLITE_API sqlite3_int64 sqlite3_uri_int64( +SQLITE_API tdsqlite3_int64 tdsqlite3_uri_int64( const char *zFilename, /* Filename as passed to xOpen */ const char *zParam, /* URI parameter sought */ - sqlite3_int64 bDflt /* return if parameter is missing */ + tdsqlite3_int64 bDflt /* return if parameter is missing */ ){ - const char *z = sqlite3_uri_parameter(zFilename, zParam); - sqlite3_int64 v; - if( z && sqlite3DecOrHexToI64(z, &v)==0 ){ + const char *z = tdsqlite3_uri_parameter(zFilename, zParam); + tdsqlite3_int64 v; + if( z && tdsqlite3DecOrHexToI64(z, &v)==0 ){ bDflt = v; } return bDflt; @@ -167863,22 +167863,22 @@ static const char *startOfNameList(const char *zName){ ** an error that we cannot easily detect but that will likely cause memory ** corruption. */ -SQLITE_API const char *sqlite3_filename_database(const char *zFilename){ - return sqlite3_uri_parameter(zFilename - 3, "\003"); +SQLITE_API const char *tdsqlite3_filename_database(const char *zFilename){ + return tdsqlite3_uri_parameter(zFilename - 3, "\003"); } -SQLITE_API const char *sqlite3_filename_journal(const char *zFilename){ - const char *z = sqlite3_uri_parameter(startOfNameList(zFilename), "\001"); +SQLITE_API const char *tdsqlite3_filename_journal(const char *zFilename){ + const char *z = tdsqlite3_uri_parameter(startOfNameList(zFilename), "\001"); return ALWAYS(z) && z[0] ? z : 0; } -SQLITE_API const char *sqlite3_filename_wal(const char *zFilename){ - return sqlite3_uri_parameter(startOfNameList(zFilename), "\002"); +SQLITE_API const char *tdsqlite3_filename_wal(const char *zFilename){ + return tdsqlite3_uri_parameter(startOfNameList(zFilename), "\002"); } /* ** Return the Btree pointer identified by zDbName. Return NULL if not found. */ -SQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbName){ - int iDb = zDbName ? sqlite3FindDbName(db, zDbName) : 0; +SQLITE_PRIVATE Btree *tdsqlite3DbNameToBtree(tdsqlite3 *db, const char *zDbName){ + int iDb = zDbName ? tdsqlite3FindDbName(db, zDbName) : 0; return iDb<0 ? 0 : db->aDb[iDb].pBt; } @@ -167886,32 +167886,32 @@ SQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbName){ ** Return the filename of the database associated with a database ** connection. */ -SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){ +SQLITE_API const char *tdsqlite3_db_filename(tdsqlite3 *db, const char *zDbName){ Btree *pBt; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } #endif - pBt = sqlite3DbNameToBtree(db, zDbName); - return pBt ? sqlite3BtreeGetFilename(pBt) : 0; + pBt = tdsqlite3DbNameToBtree(db, zDbName); + return pBt ? tdsqlite3BtreeGetFilename(pBt) : 0; } /* ** Return 1 if database is read-only or 0 if read/write. Return -1 if ** no such database exists. */ -SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){ +SQLITE_API int tdsqlite3_db_readonly(tdsqlite3 *db, const char *zDbName){ Btree *pBt; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return -1; } #endif - pBt = sqlite3DbNameToBtree(db, zDbName); - return pBt ? sqlite3BtreeIsReadonly(pBt) : -1; + pBt = tdsqlite3DbNameToBtree(db, zDbName); + return pBt ? tdsqlite3BtreeIsReadonly(pBt) : -1; } #ifdef SQLITE_ENABLE_SNAPSHOT @@ -167919,35 +167919,35 @@ SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){ ** Obtain a snapshot handle for the snapshot of database zDb currently ** being read by handle db. */ -SQLITE_API int sqlite3_snapshot_get( - sqlite3 *db, +SQLITE_API int tdsqlite3_snapshot_get( + tdsqlite3 *db, const char *zDb, - sqlite3_snapshot **ppSnapshot + tdsqlite3_snapshot **ppSnapshot ){ int rc = SQLITE_ERROR; #ifndef SQLITE_OMIT_WAL #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ return SQLITE_MISUSE_BKPT; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); if( db->autoCommit==0 ){ - int iDb = sqlite3FindDbName(db, zDb); + int iDb = tdsqlite3FindDbName(db, zDb); if( iDb==0 || iDb>1 ){ Btree *pBt = db->aDb[iDb].pBt; - if( 0==sqlite3BtreeIsInTrans(pBt) ){ - rc = sqlite3BtreeBeginTrans(pBt, 0, 0); + if( 0==tdsqlite3BtreeIsInTrans(pBt) ){ + rc = tdsqlite3BtreeBeginTrans(pBt, 0, 0); if( rc==SQLITE_OK ){ - rc = sqlite3PagerSnapshotGet(sqlite3BtreePager(pBt), ppSnapshot); + rc = tdsqlite3PagerSnapshotGet(tdsqlite3BtreePager(pBt), ppSnapshot); } } } } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); #endif /* SQLITE_OMIT_WAL */ return rc; } @@ -167955,54 +167955,54 @@ SQLITE_API int sqlite3_snapshot_get( /* ** Open a read-transaction on the snapshot idendified by pSnapshot. */ -SQLITE_API int sqlite3_snapshot_open( - sqlite3 *db, +SQLITE_API int tdsqlite3_snapshot_open( + tdsqlite3 *db, const char *zDb, - sqlite3_snapshot *pSnapshot + tdsqlite3_snapshot *pSnapshot ){ int rc = SQLITE_ERROR; #ifndef SQLITE_OMIT_WAL #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ return SQLITE_MISUSE_BKPT; } #endif - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); if( db->autoCommit==0 ){ int iDb; - iDb = sqlite3FindDbName(db, zDb); + iDb = tdsqlite3FindDbName(db, zDb); if( iDb==0 || iDb>1 ){ Btree *pBt = db->aDb[iDb].pBt; - if( sqlite3BtreeIsInTrans(pBt)==0 ){ - Pager *pPager = sqlite3BtreePager(pBt); + if( tdsqlite3BtreeIsInTrans(pBt)==0 ){ + Pager *pPager = tdsqlite3BtreePager(pBt); int bUnlock = 0; - if( sqlite3BtreeIsInReadTrans(pBt) ){ + if( tdsqlite3BtreeIsInReadTrans(pBt) ){ if( db->nVdbeActive==0 ){ - rc = sqlite3PagerSnapshotCheck(pPager, pSnapshot); + rc = tdsqlite3PagerSnapshotCheck(pPager, pSnapshot); if( rc==SQLITE_OK ){ bUnlock = 1; - rc = sqlite3BtreeCommit(pBt); + rc = tdsqlite3BtreeCommit(pBt); } } }else{ rc = SQLITE_OK; } if( rc==SQLITE_OK ){ - rc = sqlite3PagerSnapshotOpen(pPager, pSnapshot); + rc = tdsqlite3PagerSnapshotOpen(pPager, pSnapshot); } if( rc==SQLITE_OK ){ - rc = sqlite3BtreeBeginTrans(pBt, 0, 0); - sqlite3PagerSnapshotOpen(pPager, 0); + rc = tdsqlite3BtreeBeginTrans(pBt, 0, 0); + tdsqlite3PagerSnapshotOpen(pPager, 0); } if( bUnlock ){ - sqlite3PagerSnapshotUnlock(pPager); + tdsqlite3PagerSnapshotUnlock(pPager); } } } } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); #endif /* SQLITE_OMIT_WAL */ return rc; } @@ -168011,39 +168011,39 @@ SQLITE_API int sqlite3_snapshot_open( ** Recover as many snapshots as possible from the wal file associated with ** schema zDb of database db. */ -SQLITE_API int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb){ +SQLITE_API int tdsqlite3_snapshot_recover(tdsqlite3 *db, const char *zDb){ int rc = SQLITE_ERROR; int iDb; #ifndef SQLITE_OMIT_WAL #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !tdsqlite3SafetyCheckOk(db) ){ return SQLITE_MISUSE_BKPT; } #endif - sqlite3_mutex_enter(db->mutex); - iDb = sqlite3FindDbName(db, zDb); + tdsqlite3_mutex_enter(db->mutex); + iDb = tdsqlite3FindDbName(db, zDb); if( iDb==0 || iDb>1 ){ Btree *pBt = db->aDb[iDb].pBt; - if( 0==sqlite3BtreeIsInReadTrans(pBt) ){ - rc = sqlite3BtreeBeginTrans(pBt, 0, 0); + if( 0==tdsqlite3BtreeIsInReadTrans(pBt) ){ + rc = tdsqlite3BtreeBeginTrans(pBt, 0, 0); if( rc==SQLITE_OK ){ - rc = sqlite3PagerSnapshotRecover(sqlite3BtreePager(pBt)); - sqlite3BtreeCommit(pBt); + rc = tdsqlite3PagerSnapshotRecover(tdsqlite3BtreePager(pBt)); + tdsqlite3BtreeCommit(pBt); } } } - sqlite3_mutex_leave(db->mutex); + tdsqlite3_mutex_leave(db->mutex); #endif /* SQLITE_OMIT_WAL */ return rc; } /* -** Free a snapshot handle obtained from sqlite3_snapshot_get(). +** Free a snapshot handle obtained from tdsqlite3_snapshot_get(). */ -SQLITE_API void sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot){ - sqlite3_free(pSnapshot); +SQLITE_API void tdsqlite3_snapshot_free(tdsqlite3_snapshot *pSnapshot){ + tdsqlite3_free(pSnapshot); } #endif /* SQLITE_ENABLE_SNAPSHOT */ @@ -168055,7 +168055,7 @@ SQLITE_API void sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot){ ** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix ** is not required for a match. */ -SQLITE_API int sqlite3_compileoption_used(const char *zOptName){ +SQLITE_API int tdsqlite3_compileoption_used(const char *zOptName){ int i, n; int nOpt; const char **azCompileOpt; @@ -168067,16 +168067,16 @@ SQLITE_API int sqlite3_compileoption_used(const char *zOptName){ } #endif - azCompileOpt = sqlite3CompileOptions(&nOpt); + azCompileOpt = tdsqlite3CompileOptions(&nOpt); - if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7; - n = sqlite3Strlen30(zOptName); + if( tdsqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7; + n = tdsqlite3Strlen30(zOptName); /* Since nOpt is normally in single digits, a linear search is ** adequate. No need for a binary search. */ for(i=0; i=0 && NpNextBlocked){ +static void checkListProperties(tdsqlite3 *db){ + tdsqlite3 *p; + for(p=tdsqlite3BlockedList; p; p=p->pNextBlocked){ int seen = 0; - sqlite3 *p2; + tdsqlite3 *p2; /* Verify property (1) */ assert( p->pUnlockConnection || p->pBlockingConnection ); /* Verify property (2) */ - for(p2=sqlite3BlockedList; p2!=p; p2=p2->pNextBlocked){ + for(p2=tdsqlite3BlockedList; p2!=p; p2=p2->pNextBlocked){ if( p2->xUnlockNotify==p->xUnlockNotify ) seen = 1; assert( p2->xUnlockNotify==p->xUnlockNotify || !seen ); assert( db==0 || p->pUnlockConnection!=db ); @@ -168183,10 +168183,10 @@ static void checkListProperties(sqlite3 *db){ ** Remove connection db from the blocked connections list. If connection ** db is not currently a part of the list, this function is a no-op. */ -static void removeFromBlockedList(sqlite3 *db){ - sqlite3 **pp; +static void removeFromBlockedList(tdsqlite3 *db){ + tdsqlite3 **pp; assertMutexHeld(); - for(pp=&sqlite3BlockedList; *pp; pp = &(*pp)->pNextBlocked){ + for(pp=&tdsqlite3BlockedList; *pp; pp = &(*pp)->pNextBlocked){ if( *pp==db ){ *pp = (*pp)->pNextBlocked; break; @@ -168198,11 +168198,11 @@ static void removeFromBlockedList(sqlite3 *db){ ** Add connection db to the blocked connections list. It is assumed ** that it is not already a part of the list. */ -static void addToBlockedList(sqlite3 *db){ - sqlite3 **pp; +static void addToBlockedList(tdsqlite3 *db){ + tdsqlite3 **pp; assertMutexHeld(); for( - pp=&sqlite3BlockedList; + pp=&tdsqlite3BlockedList; *pp && (*pp)->xUnlockNotify!=db->xUnlockNotify; pp=&(*pp)->pNextBlocked ); @@ -168214,7 +168214,7 @@ static void addToBlockedList(sqlite3 *db){ ** Obtain the STATIC_MASTER mutex. */ static void enterMutex(void){ - sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); + tdsqlite3_mutex_enter(tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); checkListProperties(0); } @@ -168224,7 +168224,7 @@ static void enterMutex(void){ static void leaveMutex(void){ assertMutexHeld(); checkListProperties(0); - sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); + tdsqlite3_mutex_leave(tdsqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); } /* @@ -168248,14 +168248,14 @@ static void leaveMutex(void){ ** on the same "db". If xNotify==0 then any prior callbacks are immediately ** cancelled. */ -SQLITE_API int sqlite3_unlock_notify( - sqlite3 *db, +SQLITE_API int tdsqlite3_unlock_notify( + tdsqlite3 *db, void (*xNotify)(void **, int), void *pArg ){ int rc = SQLITE_OK; - sqlite3_mutex_enter(db->mutex); + tdsqlite3_mutex_enter(db->mutex); enterMutex(); if( xNotify==0 ){ @@ -168271,7 +168271,7 @@ SQLITE_API int sqlite3_unlock_notify( */ xNotify(&pArg, 1); }else{ - sqlite3 *p; + tdsqlite3 *p; for(p=db->pBlockingConnection; p && p!=db; p=p->pUnlockConnection){} if( p ){ @@ -168287,8 +168287,8 @@ SQLITE_API int sqlite3_unlock_notify( leaveMutex(); assert( !db->mallocFailed ); - sqlite3ErrorWithMsg(db, rc, (rc?"database is deadlocked":0)); - sqlite3_mutex_leave(db->mutex); + tdsqlite3ErrorWithMsg(db, rc, (rc?"database is deadlocked":0)); + tdsqlite3_mutex_leave(db->mutex); return rc; } @@ -168298,7 +168298,7 @@ SQLITE_API int sqlite3_unlock_notify( ** to the user because it requires a lock that will not be available ** until connection pBlocker concludes its current transaction. */ -SQLITE_PRIVATE void sqlite3ConnectionBlocked(sqlite3 *db, sqlite3 *pBlocker){ +SQLITE_PRIVATE void tdsqlite3ConnectionBlocked(tdsqlite3 *db, tdsqlite3 *pBlocker){ enterMutex(); if( db->pBlockingConnection==0 && db->pUnlockConnection==0 ){ addToBlockedList(db); @@ -168326,10 +168326,10 @@ SQLITE_PRIVATE void sqlite3ConnectionBlocked(sqlite3 *db, sqlite3 *pBlocker){ ** pUnlockConnection==0, remove the entry from the blocked connections ** list. */ -SQLITE_PRIVATE void sqlite3ConnectionUnlocked(sqlite3 *db){ +SQLITE_PRIVATE void tdsqlite3ConnectionUnlocked(tdsqlite3 *db){ void (*xUnlockNotify)(void **, int) = 0; /* Unlock-notify cb to invoke */ int nArg = 0; /* Number of entries in aArg[] */ - sqlite3 **pp; /* Iterator variable */ + tdsqlite3 **pp; /* Iterator variable */ void **aArg; /* Arguments to the unlock callback */ void **aDyn = 0; /* Dynamically allocated space for aArg[] */ void *aStatic[16]; /* Starter space for aArg[]. No malloc required */ @@ -168338,8 +168338,8 @@ SQLITE_PRIVATE void sqlite3ConnectionUnlocked(sqlite3 *db){ enterMutex(); /* Enter STATIC_MASTER mutex */ /* This loop runs once for each entry in the blocked-connections list. */ - for(pp=&sqlite3BlockedList; *pp; /* no-op */ ){ - sqlite3 *p = *pp; + for(pp=&tdsqlite3BlockedList; *pp; /* no-op */ ){ + tdsqlite3 *p = *pp; /* Step 1. */ if( p->pBlockingConnection==db ){ @@ -168354,17 +168354,17 @@ SQLITE_PRIVATE void sqlite3ConnectionUnlocked(sqlite3 *db){ nArg = 0; } - sqlite3BeginBenignMalloc(); + tdsqlite3BeginBenignMalloc(); assert( aArg==aDyn || (aDyn==0 && aArg==aStatic) ); assert( nArg<=(int)ArraySize(aStatic) || aArg==aDyn ); if( (!aDyn && nArg==(int)ArraySize(aStatic)) - || (aDyn && nArg==(int)(sqlite3MallocSize(aDyn)/sizeof(void*))) + || (aDyn && nArg==(int)(tdsqlite3MallocSize(aDyn)/sizeof(void*))) ){ /* The aArg[] array needs to grow. */ - void **pNew = (void **)sqlite3Malloc(nArg*sizeof(void *)*2); + void **pNew = (void **)tdsqlite3Malloc(nArg*sizeof(void *)*2); if( pNew ){ memcpy(pNew, aArg, nArg*sizeof(void *)); - sqlite3_free(aDyn); + tdsqlite3_free(aDyn); aDyn = aArg = pNew; }else{ /* This occurs when the array of context pointers that need to @@ -168395,7 +168395,7 @@ SQLITE_PRIVATE void sqlite3ConnectionUnlocked(sqlite3 *db){ nArg = 0; } } - sqlite3EndBenignMalloc(); + tdsqlite3EndBenignMalloc(); aArg[nArg++] = p->pUnlockArg; xUnlockNotify = p->xUnlockNotify; @@ -168417,7 +168417,7 @@ SQLITE_PRIVATE void sqlite3ConnectionUnlocked(sqlite3 *db){ if( nArg!=0 ){ xUnlockNotify(aArg, nArg); } - sqlite3_free(aDyn); + tdsqlite3_free(aDyn); leaveMutex(); /* Leave STATIC_MASTER mutex */ } @@ -168425,8 +168425,8 @@ SQLITE_PRIVATE void sqlite3ConnectionUnlocked(sqlite3 *db){ ** This is called when the database connection passed as an argument is ** being closed. The connection is removed from the blocked list. */ -SQLITE_PRIVATE void sqlite3ConnectionClosed(sqlite3 *db){ - sqlite3ConnectionUnlocked(db); +SQLITE_PRIVATE void tdsqlite3ConnectionClosed(tdsqlite3 *db){ + tdsqlite3ConnectionUnlocked(db); enterMutex(); removeFromBlockedList(db); checkListProperties(db); @@ -168765,9 +168765,9 @@ SQLITE_PRIVATE void sqlite3ConnectionClosed(sqlite3 *db){ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -/* If not building as part of the core, include sqlite3ext.h. */ +/* If not building as part of the core, include tdsqlite3ext.h. */ #ifndef SQLITE_CORE -/* # include "sqlite3ext.h" */ +/* # include "tdsqlite3ext.h" */ SQLITE_EXTENSION_INIT3 #endif @@ -168783,21 +168783,21 @@ SQLITE_EXTENSION_INIT3 ** Defines the interface to tokenizers used by fulltext-search. There ** are three basic components: ** -** sqlite3_tokenizer_module is a singleton defining the tokenizer +** tdsqlite3_tokenizer_module is a singleton defining the tokenizer ** interface functions. This is essentially the class structure for ** tokenizers. ** -** sqlite3_tokenizer is used to define a particular tokenizer, perhaps +** tdsqlite3_tokenizer is used to define a particular tokenizer, perhaps ** including customization information defined at creation time. ** -** sqlite3_tokenizer_cursor is generated by a tokenizer to generate +** tdsqlite3_tokenizer_cursor is generated by a tokenizer to generate ** tokens from a particular input. */ #ifndef _FTS3_TOKENIZER_H_ #define _FTS3_TOKENIZER_H_ /* TODO(shess) Only used for SQLITE_OK and SQLITE_DONE at this time. -** If tokenizers are to be allowed to call sqlite3_*() functions, then +** If tokenizers are to be allowed to call tdsqlite3_*() functions, then ** we will need a way to register the API consistently. */ /* #include "sqlite3.h" */ @@ -168805,27 +168805,27 @@ SQLITE_EXTENSION_INIT3 /* ** Structures used by the tokenizer interface. When a new tokenizer ** implementation is registered, the caller provides a pointer to -** an sqlite3_tokenizer_module containing pointers to the callback +** an tdsqlite3_tokenizer_module containing pointers to the callback ** functions that make up an implementation. ** ** When an fts3 table is created, it passes any arguments passed to ** the tokenizer clause of the CREATE VIRTUAL TABLE statement to the -** sqlite3_tokenizer_module.xCreate() function of the requested tokenizer +** tdsqlite3_tokenizer_module.xCreate() function of the requested tokenizer ** implementation. The xCreate() function in turn returns an -** sqlite3_tokenizer structure representing the specific tokenizer to +** tdsqlite3_tokenizer structure representing the specific tokenizer to ** be used for the fts3 table (customized by the tokenizer clause arguments). ** -** To tokenize an input buffer, the sqlite3_tokenizer_module.xOpen() -** method is called. It returns an sqlite3_tokenizer_cursor object +** To tokenize an input buffer, the tdsqlite3_tokenizer_module.xOpen() +** method is called. It returns an tdsqlite3_tokenizer_cursor object ** that may be used to tokenize a specific input buffer based on -** the tokenization rules supplied by a specific sqlite3_tokenizer +** the tokenization rules supplied by a specific tdsqlite3_tokenizer ** object. */ -typedef struct sqlite3_tokenizer_module sqlite3_tokenizer_module; -typedef struct sqlite3_tokenizer sqlite3_tokenizer; -typedef struct sqlite3_tokenizer_cursor sqlite3_tokenizer_cursor; +typedef struct tdsqlite3_tokenizer_module tdsqlite3_tokenizer_module; +typedef struct tdsqlite3_tokenizer tdsqlite3_tokenizer; +typedef struct tdsqlite3_tokenizer_cursor tdsqlite3_tokenizer_cursor; -struct sqlite3_tokenizer_module { +struct tdsqlite3_tokenizer_module { /* ** Structure version. Should always be set to 0 or 1. @@ -168846,20 +168846,20 @@ struct sqlite3_tokenizer_module { ** This method should return either SQLITE_OK (0), or an SQLite error ** code. If SQLITE_OK is returned, then *ppTokenizer should be set ** to point at the newly created tokenizer structure. The generic - ** sqlite3_tokenizer.pModule variable should not be initialized by + ** tdsqlite3_tokenizer.pModule variable should not be initialized by ** this callback. The caller will do so. */ int (*xCreate)( int argc, /* Size of argv array */ const char *const*argv, /* Tokenizer argument strings */ - sqlite3_tokenizer **ppTokenizer /* OUT: Created tokenizer */ + tdsqlite3_tokenizer **ppTokenizer /* OUT: Created tokenizer */ ); /* ** Destroy an existing tokenizer. The fts3 module calls this method ** exactly once for each successful call to xCreate(). */ - int (*xDestroy)(sqlite3_tokenizer *pTokenizer); + int (*xDestroy)(tdsqlite3_tokenizer *pTokenizer); /* ** Create a tokenizer cursor to tokenize an input buffer. The caller @@ -168867,16 +168867,16 @@ struct sqlite3_tokenizer_module { ** until the cursor is closed (using the xClose() method). */ int (*xOpen)( - sqlite3_tokenizer *pTokenizer, /* Tokenizer object */ + tdsqlite3_tokenizer *pTokenizer, /* Tokenizer object */ const char *pInput, int nBytes, /* Input buffer */ - sqlite3_tokenizer_cursor **ppCursor /* OUT: Created tokenizer cursor */ + tdsqlite3_tokenizer_cursor **ppCursor /* OUT: Created tokenizer cursor */ ); /* ** Destroy an existing tokenizer cursor. The fts3 module calls this ** method exactly once for each successful call to xOpen(). */ - int (*xClose)(sqlite3_tokenizer_cursor *pCursor); + int (*xClose)(tdsqlite3_tokenizer_cursor *pCursor); /* ** Retrieve the next token from the tokenizer cursor pCursor. This @@ -168903,7 +168903,7 @@ struct sqlite3_tokenizer_module { ** should be converted to zInput. */ int (*xNext)( - sqlite3_tokenizer_cursor *pCursor, /* Tokenizer cursor */ + tdsqlite3_tokenizer_cursor *pCursor, /* Tokenizer cursor */ const char **ppToken, int *pnBytes, /* OUT: Normalized text for token */ int *piStartOffset, /* OUT: Byte offset of token in input buffer */ int *piEndOffset, /* OUT: Byte offset of end of token in input buffer */ @@ -168917,16 +168917,16 @@ struct sqlite3_tokenizer_module { /* ** Configure the language id of a tokenizer cursor. */ - int (*xLanguageid)(sqlite3_tokenizer_cursor *pCsr, int iLangid); + int (*xLanguageid)(tdsqlite3_tokenizer_cursor *pCsr, int iLangid); }; -struct sqlite3_tokenizer { - const sqlite3_tokenizer_module *pModule; /* The module for this tokenizer */ +struct tdsqlite3_tokenizer { + const tdsqlite3_tokenizer_module *pModule; /* The module for this tokenizer */ /* Tokenizer implementations will typically add additional fields */ }; -struct sqlite3_tokenizer_cursor { - sqlite3_tokenizer *pTokenizer; /* Tokenizer for this cursor. */ +struct tdsqlite3_tokenizer_cursor { + tdsqlite3_tokenizer *pTokenizer; /* Tokenizer for this cursor. */ /* Tokenizer implementations will typically add additional fields */ }; @@ -169013,20 +169013,20 @@ struct Fts3HashElem { /* ** Access routines. To delete, insert a NULL pointer. */ -SQLITE_PRIVATE void sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey); -SQLITE_PRIVATE void *sqlite3Fts3HashInsert(Fts3Hash*, const void *pKey, int nKey, void *pData); -SQLITE_PRIVATE void *sqlite3Fts3HashFind(const Fts3Hash*, const void *pKey, int nKey); -SQLITE_PRIVATE void sqlite3Fts3HashClear(Fts3Hash*); -SQLITE_PRIVATE Fts3HashElem *sqlite3Fts3HashFindElem(const Fts3Hash *, const void *, int); +SQLITE_PRIVATE void tdsqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey); +SQLITE_PRIVATE void *tdsqlite3Fts3HashInsert(Fts3Hash*, const void *pKey, int nKey, void *pData); +SQLITE_PRIVATE void *tdsqlite3Fts3HashFind(const Fts3Hash*, const void *pKey, int nKey); +SQLITE_PRIVATE void tdsqlite3Fts3HashClear(Fts3Hash*); +SQLITE_PRIVATE Fts3HashElem *tdsqlite3Fts3HashFindElem(const Fts3Hash *, const void *, int); /* ** Shorthand for the functions above */ -#define fts3HashInit sqlite3Fts3HashInit -#define fts3HashInsert sqlite3Fts3HashInsert -#define fts3HashFind sqlite3Fts3HashFind -#define fts3HashClear sqlite3Fts3HashClear -#define fts3HashFindElem sqlite3Fts3HashFindElem +#define fts3HashInit tdsqlite3Fts3HashInit +#define fts3HashInsert tdsqlite3Fts3HashInsert +#define fts3HashFind tdsqlite3Fts3HashFind +#define fts3HashClear tdsqlite3Fts3HashClear +#define fts3HashFindElem tdsqlite3Fts3HashFindElem /* ** Macros for looping over all elements of a hash table. The idiom is @@ -169146,8 +169146,8 @@ SQLITE_PRIVATE Fts3HashElem *sqlite3Fts3HashFindElem(const Fts3Hash *, const voi ** guranteed that the database is not corrupt. */ #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_fts3_may_be_corrupt; -# define assert_fts3_nc(x) assert(sqlite3_fts3_may_be_corrupt || (x)) +SQLITE_API extern int tdsqlite3_fts3_may_be_corrupt; +# define assert_fts3_nc(x) assert(tdsqlite3_fts3_may_be_corrupt || (x)) #else # define assert_fts3_nc(x) assert(x) #endif @@ -169166,10 +169166,10 @@ SQLITE_API extern int sqlite3_fts3_may_be_corrupt; # define ALWAYS(x) (1) # define NEVER(X) (0) #elif defined(SQLITE_DEBUG) -# define ALWAYS(x) sqlite3Fts3Always((x)!=0) -# define NEVER(x) sqlite3Fts3Never((x)!=0) -SQLITE_PRIVATE int sqlite3Fts3Always(int b); -SQLITE_PRIVATE int sqlite3Fts3Never(int b); +# define ALWAYS(x) tdsqlite3Fts3Always((x)!=0) +# define NEVER(x) tdsqlite3Fts3Never((x)!=0) +SQLITE_PRIVATE int tdsqlite3Fts3Always(int b); +SQLITE_PRIVATE int tdsqlite3Fts3Never(int b); #else # define ALWAYS(x) (x) # define NEVER(x) (x) @@ -169181,8 +169181,8 @@ SQLITE_PRIVATE int sqlite3Fts3Never(int b); typedef unsigned char u8; /* 1-byte (or larger) unsigned integer */ typedef short int i16; /* 2-byte (or larger) signed integer */ typedef unsigned int u32; /* 4-byte unsigned integer */ -typedef sqlite3_uint64 u64; /* 8-byte unsigned integer */ -typedef sqlite3_int64 i64; /* 8-byte signed integer */ +typedef tdsqlite3_uint64 u64; /* 8-byte unsigned integer */ +typedef tdsqlite3_int64 i64; /* 8-byte signed integer */ /* ** Macro used to suppress compiler warnings for unused parameters. @@ -169213,8 +169213,8 @@ typedef sqlite3_int64 i64; /* 8-byte signed integer */ #endif /* SQLITE_AMALGAMATION */ #ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3Fts3Corrupt(void); -# define FTS_CORRUPT_VTAB sqlite3Fts3Corrupt() +SQLITE_PRIVATE int tdsqlite3Fts3Corrupt(void); +# define FTS_CORRUPT_VTAB tdsqlite3Fts3Corrupt() #else # define FTS_CORRUPT_VTAB SQLITE_CORRUPT_VTAB #endif @@ -169241,14 +169241,14 @@ typedef struct MatchinfoBuffer MatchinfoBuffer; ** arguments. */ struct Fts3Table { - sqlite3_vtab base; /* Base class used by SQLite core */ - sqlite3 *db; /* The database connection */ + tdsqlite3_vtab base; /* Base class used by SQLite core */ + tdsqlite3 *db; /* The database connection */ const char *zDb; /* logical database name */ const char *zName; /* virtual table name */ int nColumn; /* number of named columns in virtual table */ char **azColumn; /* column names. malloced */ u8 *abNotindexed; /* True for 'notindexed' columns */ - sqlite3_tokenizer *pTokenizer; /* tokenizer for inserts and queries */ + tdsqlite3_tokenizer *pTokenizer; /* tokenizer for inserts and queries */ char *zContentTbl; /* content=xxx option, or NULL */ char *zLanguageid; /* languageid=xxx option, or NULL */ int nAutoincrmerge; /* Value configured by 'automerge' */ @@ -169258,8 +169258,8 @@ struct Fts3Table { /* Precompiled statements used by the implementation. Each of these ** statements is run and reset within a single virtual table API call. */ - sqlite3_stmt *aStmt[40]; - sqlite3_stmt *pSeekStmt; /* Cache for fts3CursorSeekStmt() */ + tdsqlite3_stmt *aStmt[40]; + tdsqlite3_stmt *pSeekStmt; /* Cache for fts3CursorSeekStmt() */ char *zReadExprlist; char *zWriteExprlist; @@ -169272,7 +169272,7 @@ struct Fts3Table { u8 bIgnoreSavepoint; /* True to ignore xSavepoint invocations */ int nPgsz; /* Page size for host database */ char *zSegmentsTbl; /* Name of %_segments table */ - sqlite3_blob *pSegments; /* Blob handle open on %_segments table */ + tdsqlite3_blob *pSegments; /* Blob handle open on %_segments table */ /* ** The following array of hash tables is used to buffer pending index @@ -169335,24 +169335,24 @@ struct Fts3Table { ** the xOpen method. Cursors are destroyed using the xClose method. */ struct Fts3Cursor { - sqlite3_vtab_cursor base; /* Base class used by SQLite core */ + tdsqlite3_vtab_cursor base; /* Base class used by SQLite core */ i16 eSearch; /* Search strategy (see below) */ u8 isEof; /* True if at End Of Results */ u8 isRequireSeek; /* True if must seek pStmt to %_content row */ u8 bSeekStmt; /* True if pStmt is a seek */ - sqlite3_stmt *pStmt; /* Prepared statement in use by the cursor */ + tdsqlite3_stmt *pStmt; /* Prepared statement in use by the cursor */ Fts3Expr *pExpr; /* Parsed MATCH query string */ int iLangid; /* Language being queried for */ int nPhrase; /* Number of matchable phrases in query */ Fts3DeferredToken *pDeferred; /* Deferred search tokens, if any */ - sqlite3_int64 iPrevId; /* Previous id read from aDoclist */ + tdsqlite3_int64 iPrevId; /* Previous id read from aDoclist */ char *pNextId; /* Pointer into the body of aDoclist */ char *aDoclist; /* List of docids for full-text queries */ int nDoclist; /* Size of buffer at aDoclist */ u8 bDesc; /* True to sort in descending order */ int eEvalmode; /* An FTS3_EVAL_XX constant */ int nRowAvg; /* Average size of database rows, in pages */ - sqlite3_int64 nDoc; /* Documents in table */ + tdsqlite3_int64 nDoc; /* Documents in table */ i64 iMinDocid; /* Minimum docid to return */ i64 iMaxDocid; /* Maximum docid to return */ int isMatchinfoNeeded; /* True when aMatchinfo[] needs filling in */ @@ -169383,7 +169383,7 @@ struct Fts3Cursor { #define FTS3_FULLTEXT_SEARCH 2 /* Full-text index search */ /* -** The lower 16-bits of the sqlite3_index_info.idxNum value set by +** The lower 16-bits of the tdsqlite3_index_info.idxNum value set by ** the xBestIndex() method contains the Fts3Cursor.eSearch value described ** above. The upper 16-bits contain a combination of the following ** bits, used to describe extra constraints on full-text searches. @@ -169397,8 +169397,8 @@ struct Fts3Doclist { int nAll; /* Size of a[] in bytes */ char *pNextDocid; /* Pointer to next docid */ - sqlite3_int64 iDocid; /* Current docid (if pList!=0) */ - int bFreeList; /* True if pList should be sqlite3_free()d */ + tdsqlite3_int64 iDocid; /* Current docid (if pList!=0) */ + int bFreeList; /* True if pList should be tdsqlite3_free()d */ char *pList; /* Pointer to position list following iDocid */ int nList; /* Length of position list */ }; @@ -169428,7 +169428,7 @@ struct Fts3Phrase { int bIncr; /* True if doclist is loaded incrementally */ int iDoclistToken; - /* Used by sqlite3Fts3EvalPhrasePoslist() if this is a descendent of an + /* Used by tdsqlite3Fts3EvalPhrasePoslist() if this is a descendent of an ** OR condition. */ char *pOrPoslist; i64 iOrDocid; @@ -169459,7 +169459,7 @@ struct Fts3Phrase { ** aMI[iCol*3 + 1] = Number of occurrences ** aMI[iCol*3 + 2] = Number of rows containing at least one instance ** -** The aMI array is allocated using sqlite3_malloc(). It should be freed +** The aMI array is allocated using tdsqlite3_malloc(). It should be freed ** when the expression node is. */ struct Fts3Expr { @@ -169471,7 +169471,7 @@ struct Fts3Expr { Fts3Phrase *pPhrase; /* Valid if eType==FTSQUERY_PHRASE */ /* The following are used by the fts3_eval.c module. */ - sqlite3_int64 iDocid; /* Current docid */ + tdsqlite3_int64 iDocid; /* Current docid */ u8 bEof; /* True this expression is at EOF already */ u8 bStart; /* True if iDocid is valid */ u8 bDeferred; /* True if this expression is entirely deferred */ @@ -169500,47 +169500,47 @@ struct Fts3Expr { /* fts3_write.c */ -SQLITE_PRIVATE int sqlite3Fts3UpdateMethod(sqlite3_vtab*,int,sqlite3_value**,sqlite3_int64*); -SQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *); -SQLITE_PRIVATE void sqlite3Fts3PendingTermsClear(Fts3Table *); -SQLITE_PRIVATE int sqlite3Fts3Optimize(Fts3Table *); -SQLITE_PRIVATE int sqlite3Fts3SegReaderNew(int, int, sqlite3_int64, - sqlite3_int64, sqlite3_int64, const char *, int, Fts3SegReader**); -SQLITE_PRIVATE int sqlite3Fts3SegReaderPending( +SQLITE_PRIVATE int tdsqlite3Fts3UpdateMethod(tdsqlite3_vtab*,int,tdsqlite3_value**,tdsqlite3_int64*); +SQLITE_PRIVATE int tdsqlite3Fts3PendingTermsFlush(Fts3Table *); +SQLITE_PRIVATE void tdsqlite3Fts3PendingTermsClear(Fts3Table *); +SQLITE_PRIVATE int tdsqlite3Fts3Optimize(Fts3Table *); +SQLITE_PRIVATE int tdsqlite3Fts3SegReaderNew(int, int, tdsqlite3_int64, + tdsqlite3_int64, tdsqlite3_int64, const char *, int, Fts3SegReader**); +SQLITE_PRIVATE int tdsqlite3Fts3SegReaderPending( Fts3Table*,int,const char*,int,int,Fts3SegReader**); -SQLITE_PRIVATE void sqlite3Fts3SegReaderFree(Fts3SegReader *); -SQLITE_PRIVATE int sqlite3Fts3AllSegdirs(Fts3Table*, int, int, int, sqlite3_stmt **); -SQLITE_PRIVATE int sqlite3Fts3ReadBlock(Fts3Table*, sqlite3_int64, char **, int*, int*); +SQLITE_PRIVATE void tdsqlite3Fts3SegReaderFree(Fts3SegReader *); +SQLITE_PRIVATE int tdsqlite3Fts3AllSegdirs(Fts3Table*, int, int, int, tdsqlite3_stmt **); +SQLITE_PRIVATE int tdsqlite3Fts3ReadBlock(Fts3Table*, tdsqlite3_int64, char **, int*, int*); -SQLITE_PRIVATE int sqlite3Fts3SelectDoctotal(Fts3Table *, sqlite3_stmt **); -SQLITE_PRIVATE int sqlite3Fts3SelectDocsize(Fts3Table *, sqlite3_int64, sqlite3_stmt **); +SQLITE_PRIVATE int tdsqlite3Fts3SelectDoctotal(Fts3Table *, tdsqlite3_stmt **); +SQLITE_PRIVATE int tdsqlite3Fts3SelectDocsize(Fts3Table *, tdsqlite3_int64, tdsqlite3_stmt **); #ifndef SQLITE_DISABLE_FTS4_DEFERRED -SQLITE_PRIVATE void sqlite3Fts3FreeDeferredTokens(Fts3Cursor *); -SQLITE_PRIVATE int sqlite3Fts3DeferToken(Fts3Cursor *, Fts3PhraseToken *, int); -SQLITE_PRIVATE int sqlite3Fts3CacheDeferredDoclists(Fts3Cursor *); -SQLITE_PRIVATE void sqlite3Fts3FreeDeferredDoclists(Fts3Cursor *); -SQLITE_PRIVATE int sqlite3Fts3DeferredTokenList(Fts3DeferredToken *, char **, int *); +SQLITE_PRIVATE void tdsqlite3Fts3FreeDeferredTokens(Fts3Cursor *); +SQLITE_PRIVATE int tdsqlite3Fts3DeferToken(Fts3Cursor *, Fts3PhraseToken *, int); +SQLITE_PRIVATE int tdsqlite3Fts3CacheDeferredDoclists(Fts3Cursor *); +SQLITE_PRIVATE void tdsqlite3Fts3FreeDeferredDoclists(Fts3Cursor *); +SQLITE_PRIVATE int tdsqlite3Fts3DeferredTokenList(Fts3DeferredToken *, char **, int *); #else -# define sqlite3Fts3FreeDeferredTokens(x) -# define sqlite3Fts3DeferToken(x,y,z) SQLITE_OK -# define sqlite3Fts3CacheDeferredDoclists(x) SQLITE_OK -# define sqlite3Fts3FreeDeferredDoclists(x) -# define sqlite3Fts3DeferredTokenList(x,y,z) SQLITE_OK +# define tdsqlite3Fts3FreeDeferredTokens(x) +# define tdsqlite3Fts3DeferToken(x,y,z) SQLITE_OK +# define tdsqlite3Fts3CacheDeferredDoclists(x) SQLITE_OK +# define tdsqlite3Fts3FreeDeferredDoclists(x) +# define tdsqlite3Fts3DeferredTokenList(x,y,z) SQLITE_OK #endif -SQLITE_PRIVATE void sqlite3Fts3SegmentsClose(Fts3Table *); -SQLITE_PRIVATE int sqlite3Fts3MaxLevel(Fts3Table *, int *); +SQLITE_PRIVATE void tdsqlite3Fts3SegmentsClose(Fts3Table *); +SQLITE_PRIVATE int tdsqlite3Fts3MaxLevel(Fts3Table *, int *); -/* Special values interpreted by sqlite3SegReaderCursor() */ +/* Special values interpreted by tdsqlite3SegReaderCursor() */ #define FTS3_SEGCURSOR_PENDING -1 #define FTS3_SEGCURSOR_ALL -2 -SQLITE_PRIVATE int sqlite3Fts3SegReaderStart(Fts3Table*, Fts3MultiSegReader*, Fts3SegFilter*); -SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(Fts3Table *, Fts3MultiSegReader *); -SQLITE_PRIVATE void sqlite3Fts3SegReaderFinish(Fts3MultiSegReader *); +SQLITE_PRIVATE int tdsqlite3Fts3SegReaderStart(Fts3Table*, Fts3MultiSegReader*, Fts3SegFilter*); +SQLITE_PRIVATE int tdsqlite3Fts3SegReaderStep(Fts3Table *, Fts3MultiSegReader *); +SQLITE_PRIVATE void tdsqlite3Fts3SegReaderFinish(Fts3MultiSegReader *); -SQLITE_PRIVATE int sqlite3Fts3SegReaderCursor(Fts3Table *, +SQLITE_PRIVATE int tdsqlite3Fts3SegReaderCursor(Fts3Table *, int, int, int, const char *, int, int, int, Fts3MultiSegReader *); /* Flags allowed as part of the 4th argument to SegmentReaderIterate() */ @@ -169560,7 +169560,7 @@ struct Fts3SegFilter { }; struct Fts3MultiSegReader { - /* Used internally by sqlite3Fts3SegReaderXXX() calls */ + /* Used internally by tdsqlite3Fts3SegReaderXXX() calls */ Fts3SegReader **apSegment; /* Array of Fts3SegReader objects */ int nSegment; /* Size of apSegment array */ int nAdvance; /* How many seg-readers to advance */ @@ -169582,78 +169582,78 @@ struct Fts3MultiSegReader { int nDoclist; /* Size of aDoclist[] in bytes */ }; -SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table*,int,int); +SQLITE_PRIVATE int tdsqlite3Fts3Incrmerge(Fts3Table*,int,int); #define fts3GetVarint32(p, piVal) ( \ - (*(u8*)(p)&0x80) ? sqlite3Fts3GetVarint32(p, piVal) : (*piVal=*(u8*)(p), 1) \ + (*(u8*)(p)&0x80) ? tdsqlite3Fts3GetVarint32(p, piVal) : (*piVal=*(u8*)(p), 1) \ ) /* fts3.c */ -SQLITE_PRIVATE void sqlite3Fts3ErrMsg(char**,const char*,...); -SQLITE_PRIVATE int sqlite3Fts3PutVarint(char *, sqlite3_int64); -SQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *, sqlite_int64 *); -SQLITE_PRIVATE int sqlite3Fts3GetVarintU(const char *, sqlite_uint64 *); -SQLITE_PRIVATE int sqlite3Fts3GetVarintBounded(const char*,const char*,sqlite3_int64*); -SQLITE_PRIVATE int sqlite3Fts3GetVarint32(const char *, int *); -SQLITE_PRIVATE int sqlite3Fts3VarintLen(sqlite3_uint64); -SQLITE_PRIVATE void sqlite3Fts3Dequote(char *); -SQLITE_PRIVATE void sqlite3Fts3DoclistPrev(int,char*,int,char**,sqlite3_int64*,int*,u8*); -SQLITE_PRIVATE int sqlite3Fts3EvalPhraseStats(Fts3Cursor *, Fts3Expr *, u32 *); -SQLITE_PRIVATE int sqlite3Fts3FirstFilter(sqlite3_int64, char *, int, char *); -SQLITE_PRIVATE void sqlite3Fts3CreateStatTable(int*, Fts3Table*); -SQLITE_PRIVATE int sqlite3Fts3EvalTestDeferred(Fts3Cursor *pCsr, int *pRc); +SQLITE_PRIVATE void tdsqlite3Fts3ErrMsg(char**,const char*,...); +SQLITE_PRIVATE int tdsqlite3Fts3PutVarint(char *, tdsqlite3_int64); +SQLITE_PRIVATE int tdsqlite3Fts3GetVarint(const char *, sqlite_int64 *); +SQLITE_PRIVATE int tdsqlite3Fts3GetVarintU(const char *, sqlite_uint64 *); +SQLITE_PRIVATE int tdsqlite3Fts3GetVarintBounded(const char*,const char*,tdsqlite3_int64*); +SQLITE_PRIVATE int tdsqlite3Fts3GetVarint32(const char *, int *); +SQLITE_PRIVATE int tdsqlite3Fts3VarintLen(tdsqlite3_uint64); +SQLITE_PRIVATE void tdsqlite3Fts3Dequote(char *); +SQLITE_PRIVATE void tdsqlite3Fts3DoclistPrev(int,char*,int,char**,tdsqlite3_int64*,int*,u8*); +SQLITE_PRIVATE int tdsqlite3Fts3EvalPhraseStats(Fts3Cursor *, Fts3Expr *, u32 *); +SQLITE_PRIVATE int tdsqlite3Fts3FirstFilter(tdsqlite3_int64, char *, int, char *); +SQLITE_PRIVATE void tdsqlite3Fts3CreateStatTable(int*, Fts3Table*); +SQLITE_PRIVATE int tdsqlite3Fts3EvalTestDeferred(Fts3Cursor *pCsr, int *pRc); /* fts3_tokenizer.c */ -SQLITE_PRIVATE const char *sqlite3Fts3NextToken(const char *, int *); -SQLITE_PRIVATE int sqlite3Fts3InitHashTable(sqlite3 *, Fts3Hash *, const char *); -SQLITE_PRIVATE int sqlite3Fts3InitTokenizer(Fts3Hash *pHash, const char *, - sqlite3_tokenizer **, char ** +SQLITE_PRIVATE const char *tdsqlite3Fts3NextToken(const char *, int *); +SQLITE_PRIVATE int tdsqlite3Fts3InitHashTable(tdsqlite3 *, Fts3Hash *, const char *); +SQLITE_PRIVATE int tdsqlite3Fts3InitTokenizer(Fts3Hash *pHash, const char *, + tdsqlite3_tokenizer **, char ** ); -SQLITE_PRIVATE int sqlite3Fts3IsIdChar(char); +SQLITE_PRIVATE int tdsqlite3Fts3IsIdChar(char); /* fts3_snippet.c */ -SQLITE_PRIVATE void sqlite3Fts3Offsets(sqlite3_context*, Fts3Cursor*); -SQLITE_PRIVATE void sqlite3Fts3Snippet(sqlite3_context *, Fts3Cursor *, const char *, +SQLITE_PRIVATE void tdsqlite3Fts3Offsets(tdsqlite3_context*, Fts3Cursor*); +SQLITE_PRIVATE void tdsqlite3Fts3Snippet(tdsqlite3_context *, Fts3Cursor *, const char *, const char *, const char *, int, int ); -SQLITE_PRIVATE void sqlite3Fts3Matchinfo(sqlite3_context *, Fts3Cursor *, const char *); -SQLITE_PRIVATE void sqlite3Fts3MIBufferFree(MatchinfoBuffer *p); +SQLITE_PRIVATE void tdsqlite3Fts3Matchinfo(tdsqlite3_context *, Fts3Cursor *, const char *); +SQLITE_PRIVATE void tdsqlite3Fts3MIBufferFree(MatchinfoBuffer *p); /* fts3_expr.c */ -SQLITE_PRIVATE int sqlite3Fts3ExprParse(sqlite3_tokenizer *, int, +SQLITE_PRIVATE int tdsqlite3Fts3ExprParse(tdsqlite3_tokenizer *, int, char **, int, int, int, const char *, int, Fts3Expr **, char ** ); -SQLITE_PRIVATE void sqlite3Fts3ExprFree(Fts3Expr *); +SQLITE_PRIVATE void tdsqlite3Fts3ExprFree(Fts3Expr *); #ifdef SQLITE_TEST -SQLITE_PRIVATE int sqlite3Fts3ExprInitTestInterface(sqlite3 *db, Fts3Hash*); -SQLITE_PRIVATE int sqlite3Fts3InitTerm(sqlite3 *db); +SQLITE_PRIVATE int tdsqlite3Fts3ExprInitTestInterface(tdsqlite3 *db, Fts3Hash*); +SQLITE_PRIVATE int tdsqlite3Fts3InitTerm(tdsqlite3 *db); #endif -SQLITE_PRIVATE int sqlite3Fts3OpenTokenizer(sqlite3_tokenizer *, int, const char *, int, - sqlite3_tokenizer_cursor ** +SQLITE_PRIVATE int tdsqlite3Fts3OpenTokenizer(tdsqlite3_tokenizer *, int, const char *, int, + tdsqlite3_tokenizer_cursor ** ); /* fts3_aux.c */ -SQLITE_PRIVATE int sqlite3Fts3InitAux(sqlite3 *db); +SQLITE_PRIVATE int tdsqlite3Fts3InitAux(tdsqlite3 *db); -SQLITE_PRIVATE void sqlite3Fts3EvalPhraseCleanup(Fts3Phrase *); +SQLITE_PRIVATE void tdsqlite3Fts3EvalPhraseCleanup(Fts3Phrase *); -SQLITE_PRIVATE int sqlite3Fts3MsrIncrStart( +SQLITE_PRIVATE int tdsqlite3Fts3MsrIncrStart( Fts3Table*, Fts3MultiSegReader*, int, const char*, int); -SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext( - Fts3Table *, Fts3MultiSegReader *, sqlite3_int64 *, char **, int *); -SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **); -SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *); -SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr); +SQLITE_PRIVATE int tdsqlite3Fts3MsrIncrNext( + Fts3Table *, Fts3MultiSegReader *, tdsqlite3_int64 *, char **, int *); +SQLITE_PRIVATE int tdsqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **); +SQLITE_PRIVATE int tdsqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *); +SQLITE_PRIVATE int tdsqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr); /* fts3_tokenize_vtab.c */ -SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *); +SQLITE_PRIVATE int tdsqlite3Fts3InitTok(tdsqlite3*, Fts3Hash *); /* fts3_unicode2.c (functions generated by parsing unicode text files) */ #ifndef SQLITE_DISABLE_FTS3_UNICODE -SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int, int); -SQLITE_PRIVATE int sqlite3FtsUnicodeIsalnum(int); -SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int); +SQLITE_PRIVATE int tdsqlite3FtsUnicodeFold(int, int); +SQLITE_PRIVATE int tdsqlite3FtsUnicodeIsalnum(int); +SQLITE_PRIVATE int tdsqlite3FtsUnicodeIsdiacritic(int); #endif #endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */ @@ -169676,7 +169676,7 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int); /* #include "fts3.h" */ #ifndef SQLITE_CORE -/* # include "sqlite3ext.h" */ +/* # include "tdsqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #endif @@ -169687,8 +169687,8 @@ static int fts3TermSegReaderCursor( #ifndef SQLITE_AMALGAMATION # if defined(SQLITE_DEBUG) -SQLITE_PRIVATE int sqlite3Fts3Always(int b) { assert( b ); return b; } -SQLITE_PRIVATE int sqlite3Fts3Never(int b) { assert( !b ); return b; } +SQLITE_PRIVATE int tdsqlite3Fts3Always(int b) { assert( b ); return b; } +SQLITE_PRIVATE int tdsqlite3Fts3Never(int b) { assert( !b ); return b; } # endif #endif @@ -169698,14 +169698,14 @@ SQLITE_PRIVATE int sqlite3Fts3Never(int b) { assert( !b ); return b; } ** assert() conditions in the fts3 code are activated - conditions that are ** only true if it is guaranteed that the fts3 database is not corrupt. */ -SQLITE_API int sqlite3_fts3_may_be_corrupt = 1; +SQLITE_API int tdsqlite3_fts3_may_be_corrupt = 1; /* ** Write a 64-bit variable-length integer to memory starting at p[0]. ** The length of data written will be between 1 and FTS3_VARINT_MAX bytes. ** The number of bytes written is returned. */ -SQLITE_PRIVATE int sqlite3Fts3PutVarint(char *p, sqlite_int64 v){ +SQLITE_PRIVATE int tdsqlite3Fts3PutVarint(char *p, sqlite_int64 v){ unsigned char *q = (unsigned char *) p; sqlite_uint64 vu = v; do{ @@ -169724,7 +169724,7 @@ SQLITE_PRIVATE int sqlite3Fts3PutVarint(char *p, sqlite_int64 v){ v = (*ptr++); \ if( (v & mask2)==0 ){ var = v; return ret; } -SQLITE_PRIVATE int sqlite3Fts3GetVarintU(const char *pBuf, sqlite_uint64 *v){ +SQLITE_PRIVATE int tdsqlite3Fts3GetVarintU(const char *pBuf, sqlite_uint64 *v){ const unsigned char *p = (const unsigned char*)pBuf; const unsigned char *pStart = p; u32 a; @@ -169751,8 +169751,8 @@ SQLITE_PRIVATE int sqlite3Fts3GetVarintU(const char *pBuf, sqlite_uint64 *v){ ** Return the number of bytes read, or 0 on error. ** The value is stored in *v. */ -SQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *pBuf, sqlite_int64 *v){ - return sqlite3Fts3GetVarintU(pBuf, (sqlite3_uint64*)v); +SQLITE_PRIVATE int tdsqlite3Fts3GetVarint(const char *pBuf, sqlite_int64 *v){ + return tdsqlite3Fts3GetVarintU(pBuf, (tdsqlite3_uint64*)v); } /* @@ -169761,7 +169761,7 @@ SQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *pBuf, sqlite_int64 *v){ ** Return the number of bytes read, or 0 on error. ** The value is stored in *v. */ -SQLITE_PRIVATE int sqlite3Fts3GetVarintBounded( +SQLITE_PRIVATE int tdsqlite3Fts3GetVarintBounded( const char *pBuf, const char *pEnd, sqlite_int64 *v @@ -169782,10 +169782,10 @@ SQLITE_PRIVATE int sqlite3Fts3GetVarintBounded( } /* -** Similar to sqlite3Fts3GetVarint(), except that the output is truncated to +** Similar to tdsqlite3Fts3GetVarint(), except that the output is truncated to ** a non-negative 32-bit integer before it is returned. */ -SQLITE_PRIVATE int sqlite3Fts3GetVarint32(const char *p, int *pi){ +SQLITE_PRIVATE int tdsqlite3Fts3GetVarint32(const char *p, int *pi){ const unsigned char *ptr = (const unsigned char*)p; u32 a; @@ -169809,7 +169809,7 @@ SQLITE_PRIVATE int sqlite3Fts3GetVarint32(const char *p, int *pi){ /* ** Return the number of bytes required to encode v as a varint */ -SQLITE_PRIVATE int sqlite3Fts3VarintLen(sqlite3_uint64 v){ +SQLITE_PRIVATE int tdsqlite3Fts3VarintLen(tdsqlite3_uint64 v){ int i = 0; do{ i++; @@ -169832,7 +169832,7 @@ SQLITE_PRIVATE int sqlite3Fts3VarintLen(sqlite3_uint64 v){ ** `mno` becomes mno ** */ -SQLITE_PRIVATE void sqlite3Fts3Dequote(char *z){ +SQLITE_PRIVATE void tdsqlite3Fts3Dequote(char *z){ char quote; /* Quote character (if any ) */ quote = z[0]; @@ -169861,9 +169861,9 @@ SQLITE_PRIVATE void sqlite3Fts3Dequote(char *z){ ** to the first byte past the end of the varint. Add the value of the varint ** to *pVal. */ -static void fts3GetDeltaVarint(char **pp, sqlite3_int64 *pVal){ - sqlite3_int64 iVal; - *pp += sqlite3Fts3GetVarint(*pp, &iVal); +static void fts3GetDeltaVarint(char **pp, tdsqlite3_int64 *pVal){ + tdsqlite3_int64 iVal; + *pp += tdsqlite3Fts3GetVarint(*pp, &iVal); *pVal += iVal; } @@ -169879,9 +169879,9 @@ static void fts3GetDeltaVarint(char **pp, sqlite3_int64 *pVal){ static void fts3GetReverseVarint( char **pp, char *pStart, - sqlite3_int64 *pVal + tdsqlite3_int64 *pVal ){ - sqlite3_int64 iVal; + tdsqlite3_int64 iVal; char *p; /* Pointer p now points at the first byte past the varint we are @@ -169891,14 +169891,14 @@ static void fts3GetReverseVarint( p++; *pp = p; - sqlite3Fts3GetVarint(p, &iVal); + tdsqlite3Fts3GetVarint(p, &iVal); *pVal = iVal; } /* ** The xDisconnect() virtual table method. */ -static int fts3DisconnectMethod(sqlite3_vtab *pVtab){ +static int fts3DisconnectMethod(tdsqlite3_vtab *pVtab){ Fts3Table *p = (Fts3Table *)pVtab; int i; @@ -169906,31 +169906,31 @@ static int fts3DisconnectMethod(sqlite3_vtab *pVtab){ assert( p->pSegments==0 ); /* Free any prepared statements held */ - sqlite3_finalize(p->pSeekStmt); + tdsqlite3_finalize(p->pSeekStmt); for(i=0; iaStmt); i++){ - sqlite3_finalize(p->aStmt[i]); + tdsqlite3_finalize(p->aStmt[i]); } - sqlite3_free(p->zSegmentsTbl); - sqlite3_free(p->zReadExprlist); - sqlite3_free(p->zWriteExprlist); - sqlite3_free(p->zContentTbl); - sqlite3_free(p->zLanguageid); + tdsqlite3_free(p->zSegmentsTbl); + tdsqlite3_free(p->zReadExprlist); + tdsqlite3_free(p->zWriteExprlist); + tdsqlite3_free(p->zContentTbl); + tdsqlite3_free(p->zLanguageid); /* Invoke the tokenizer destructor to free the tokenizer. */ p->pTokenizer->pModule->xDestroy(p->pTokenizer); - sqlite3_free(p); + tdsqlite3_free(p); return SQLITE_OK; } /* ** Write an error message into *pzErr */ -SQLITE_PRIVATE void sqlite3Fts3ErrMsg(char **pzErr, const char *zFormat, ...){ +SQLITE_PRIVATE void tdsqlite3Fts3ErrMsg(char **pzErr, const char *zFormat, ...){ va_list ap; - sqlite3_free(*pzErr); + tdsqlite3_free(*pzErr); va_start(ap, zFormat); - *pzErr = sqlite3_vmprintf(zFormat, ap); + *pzErr = tdsqlite3_vmprintf(zFormat, ap); va_end(ap); } @@ -169943,7 +169943,7 @@ SQLITE_PRIVATE void sqlite3Fts3ErrMsg(char **pzErr, const char *zFormat, ...){ */ static void fts3DbExec( int *pRc, /* Success code */ - sqlite3 *db, /* Database in which to run SQL */ + tdsqlite3 *db, /* Database in which to run SQL */ const char *zFormat, /* Format string for SQL */ ... /* Arguments to the format string */ ){ @@ -169951,24 +169951,24 @@ static void fts3DbExec( char *zSql; if( *pRc ) return; va_start(ap, zFormat); - zSql = sqlite3_vmprintf(zFormat, ap); + zSql = tdsqlite3_vmprintf(zFormat, ap); va_end(ap); if( zSql==0 ){ *pRc = SQLITE_NOMEM; }else{ - *pRc = sqlite3_exec(db, zSql, 0, 0, 0); - sqlite3_free(zSql); + *pRc = tdsqlite3_exec(db, zSql, 0, 0, 0); + tdsqlite3_free(zSql); } } /* ** The xDestroy() virtual table method. */ -static int fts3DestroyMethod(sqlite3_vtab *pVtab){ +static int fts3DestroyMethod(tdsqlite3_vtab *pVtab){ Fts3Table *p = (Fts3Table *)pVtab; int rc = SQLITE_OK; /* Return code */ const char *zDb = p->zDb; /* Name of database (e.g. "main", "temp") */ - sqlite3 *db = p->db; /* Database handle */ + tdsqlite3 *db = p->db; /* Database handle */ /* Drop the shadow tables */ fts3DbExec(&rc, db, @@ -169993,7 +169993,7 @@ static int fts3DestroyMethod(sqlite3_vtab *pVtab){ /* -** Invoke sqlite3_declare_vtab() to declare the schema for the FTS3 table +** Invoke tdsqlite3_declare_vtab() to declare the schema for the FTS3 table ** passed as the first argument. This is done as part of the xConnect() ** and xCreate() methods. ** @@ -170010,27 +170010,27 @@ static void fts3DeclareVtab(int *pRc, Fts3Table *p){ const char *zLanguageid; zLanguageid = (p->zLanguageid ? p->zLanguageid : "__langid"); - sqlite3_vtab_config(p->db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); + tdsqlite3_vtab_config(p->db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); /* Create a list of user columns for the virtual table */ - zCols = sqlite3_mprintf("%Q, ", p->azColumn[0]); + zCols = tdsqlite3_mprintf("%Q, ", p->azColumn[0]); for(i=1; zCols && inColumn; i++){ - zCols = sqlite3_mprintf("%z%Q, ", zCols, p->azColumn[i]); + zCols = tdsqlite3_mprintf("%z%Q, ", zCols, p->azColumn[i]); } /* Create the whole "CREATE TABLE" statement to pass to SQLite */ - zSql = sqlite3_mprintf( + zSql = tdsqlite3_mprintf( "CREATE TABLE x(%s %Q HIDDEN, docid HIDDEN, %Q HIDDEN)", zCols, p->zName, zLanguageid ); if( !zCols || !zSql ){ rc = SQLITE_NOMEM; }else{ - rc = sqlite3_declare_vtab(p->db, zSql); + rc = tdsqlite3_declare_vtab(p->db, zSql); } - sqlite3_free(zSql); - sqlite3_free(zCols); + tdsqlite3_free(zSql); + tdsqlite3_free(zCols); *pRc = rc; } } @@ -170038,7 +170038,7 @@ static void fts3DeclareVtab(int *pRc, Fts3Table *p){ /* ** Create the %_stat table if it does not already exist. */ -SQLITE_PRIVATE void sqlite3Fts3CreateStatTable(int *pRc, Fts3Table *p){ +SQLITE_PRIVATE void tdsqlite3Fts3CreateStatTable(int *pRc, Fts3Table *p){ fts3DbExec(pRc, p->db, "CREATE TABLE IF NOT EXISTS %Q.'%q_stat'" "(id INTEGER PRIMARY KEY, value BLOB);", @@ -170059,20 +170059,20 @@ SQLITE_PRIVATE void sqlite3Fts3CreateStatTable(int *pRc, Fts3Table *p){ static int fts3CreateTables(Fts3Table *p){ int rc = SQLITE_OK; /* Return code */ int i; /* Iterator variable */ - sqlite3 *db = p->db; /* The database connection */ + tdsqlite3 *db = p->db; /* The database connection */ if( p->zContentTbl==0 ){ const char *zLanguageid = p->zLanguageid; char *zContentCols; /* Columns of %_content table */ /* Create a list of user columns for the content table */ - zContentCols = sqlite3_mprintf("docid INTEGER PRIMARY KEY"); + zContentCols = tdsqlite3_mprintf("docid INTEGER PRIMARY KEY"); for(i=0; zContentCols && inColumn; i++){ char *z = p->azColumn[i]; - zContentCols = sqlite3_mprintf("%z, 'c%d%q'", zContentCols, i, z); + zContentCols = tdsqlite3_mprintf("%z, 'c%d%q'", zContentCols, i, z); } if( zLanguageid && zContentCols ){ - zContentCols = sqlite3_mprintf("%z, langid", zContentCols, zLanguageid); + zContentCols = tdsqlite3_mprintf("%z, langid", zContentCols, zLanguageid); } if( zContentCols==0 ) rc = SQLITE_NOMEM; @@ -170081,7 +170081,7 @@ static int fts3CreateTables(Fts3Table *p){ "CREATE TABLE %Q.'%q_content'(%s)", p->zDb, p->zName, zContentCols ); - sqlite3_free(zContentCols); + tdsqlite3_free(zContentCols); } /* Create other tables */ @@ -170109,7 +170109,7 @@ static int fts3CreateTables(Fts3Table *p){ } assert( p->bHasStat==p->bFts4 ); if( p->bHasStat ){ - sqlite3Fts3CreateStatTable(&rc, p); + tdsqlite3Fts3CreateStatTable(&rc, p); } return rc; } @@ -170125,24 +170125,24 @@ static void fts3DatabasePageSize(int *pRc, Fts3Table *p){ if( *pRc==SQLITE_OK ){ int rc; /* Return code */ char *zSql; /* SQL text "PRAGMA %Q.page_size" */ - sqlite3_stmt *pStmt; /* Compiled "PRAGMA %Q.page_size" statement */ + tdsqlite3_stmt *pStmt; /* Compiled "PRAGMA %Q.page_size" statement */ - zSql = sqlite3_mprintf("PRAGMA %Q.page_size", p->zDb); + zSql = tdsqlite3_mprintf("PRAGMA %Q.page_size", p->zDb); if( !zSql ){ rc = SQLITE_NOMEM; }else{ - rc = sqlite3_prepare(p->db, zSql, -1, &pStmt, 0); + rc = tdsqlite3_prepare(p->db, zSql, -1, &pStmt, 0); if( rc==SQLITE_OK ){ - sqlite3_step(pStmt); - p->nPgsz = sqlite3_column_int(pStmt, 0); - rc = sqlite3_finalize(pStmt); + tdsqlite3_step(pStmt); + p->nPgsz = tdsqlite3_column_int(pStmt, 0); + rc = tdsqlite3_finalize(pStmt); }else if( rc==SQLITE_AUTH ){ p->nPgsz = 1024; rc = SQLITE_OK; } } assert( p->nPgsz>0 || rc!=SQLITE_OK ); - sqlite3_free(zSql); + tdsqlite3_free(zSql); *pRc = rc; } } @@ -170169,9 +170169,9 @@ static int fts3IsSpecialColumn( } *pnKey = (int)(zCsr-z); - zValue = sqlite3_mprintf("%s", &zCsr[1]); + zValue = tdsqlite3_mprintf("%s", &zCsr[1]); if( zValue ){ - sqlite3Fts3Dequote(zValue); + tdsqlite3Fts3Dequote(zValue); } *pzValue = zValue; return 1; @@ -170190,15 +170190,15 @@ static void fts3Appendf( va_list ap; char *z; va_start(ap, zFormat); - z = sqlite3_vmprintf(zFormat, ap); + z = tdsqlite3_vmprintf(zFormat, ap); va_end(ap); if( z && *pz ){ - char *z2 = sqlite3_mprintf("%s%s", *pz, z); - sqlite3_free(z); + char *z2 = tdsqlite3_mprintf("%s%s", *pz, z); + tdsqlite3_free(z); z = z2; } if( z==0 ) *pRc = SQLITE_NOMEM; - sqlite3_free(*pz); + tdsqlite3_free(*pz); *pz = z; } } @@ -170209,15 +170209,15 @@ static void fts3Appendf( ** ** fts3QuoteId("un \"zip\"") -> "un \"\"zip\"\"" ** -** The pointer returned points to memory obtained from sqlite3_malloc(). It -** is the callers responsibility to call sqlite3_free() to release this +** The pointer returned points to memory obtained from tdsqlite3_malloc(). It +** is the callers responsibility to call tdsqlite3_free() to release this ** memory. */ static char *fts3QuoteId(char const *zInput){ - sqlite3_int64 nRet; + tdsqlite3_int64 nRet; char *zRet; nRet = 2 + (int)strlen(zInput)*2 + 1; - zRet = sqlite3_malloc64(nRet); + zRet = tdsqlite3_malloc64(nRet); if( zRet ){ int i; char *z = zRet; @@ -170247,7 +170247,7 @@ static char *fts3QuoteId(char const *zInput){ ** ** "docid, unzip(x.'a'), unzip(x.'b'), unzip(x.'c') FROM %_content AS x" ** -** The pointer returned points to a buffer allocated by sqlite3_malloc(). It +** The pointer returned points to a buffer allocated by tdsqlite3_malloc(). It ** is the responsibility of the caller to eventually free it. ** ** If *pRc is not SQLITE_OK when this function is called, it is a no-op (and @@ -170274,7 +170274,7 @@ static char *fts3ReadExprList(Fts3Table *p, const char *zFunc, int *pRc){ if( p->zLanguageid ){ fts3Appendf(pRc, &zRet, ", x.%Q", "langid"); } - sqlite3_free(zFree); + tdsqlite3_free(zFree); }else{ fts3Appendf(pRc, &zRet, "rowid"); for(i=0; inColumn; i++){ @@ -170304,7 +170304,7 @@ static char *fts3ReadExprList(Fts3Table *p, const char *zFunc, int *pRc){ ** ** "?, zip(?), zip(?), zip(?)" ** -** The pointer returned points to a buffer allocated by sqlite3_malloc(). It +** The pointer returned points to a buffer allocated by tdsqlite3_malloc(). It ** is the responsibility of the caller to eventually free it. ** ** If *pRc is not SQLITE_OK when this function is called, it is a no-op (and @@ -170330,7 +170330,7 @@ static char *fts3WriteExprList(Fts3Table *p, const char *zFunc, int *pRc){ if( p->zLanguageid ){ fts3Appendf(pRc, &zRet, ", ?"); } - sqlite3_free(zFree); + tdsqlite3_free(zFree); return zRet; } @@ -170380,7 +170380,7 @@ static int fts3GobbleInt(const char **pp, int *pnOut){ ** array. If an error does occur, an SQLite error code is returned. ** ** Regardless of whether or not an error is returned, it is the responsibility -** of the caller to call sqlite3_free() on the output array to free it. +** of the caller to call tdsqlite3_free() on the output array to free it. */ static int fts3PrefixParameter( const char *zParam, /* ABC in prefix=ABC parameter to parse */ @@ -170398,7 +170398,7 @@ static int fts3PrefixParameter( } } - aIndex = sqlite3_malloc64(sizeof(struct Fts3Index) * nIndex); + aIndex = tdsqlite3_malloc64(sizeof(struct Fts3Index) * nIndex); *apIndex = aIndex; if( !aIndex ){ return SQLITE_NOMEM; @@ -170445,14 +170445,14 @@ static int fts3PrefixParameter( ** the name of the corresponding column in table xxx. The array ** and its contents are allocated using a single allocation. It ** is the responsibility of the caller to free this allocation -** by eventually passing the *pazCol value to sqlite3_free(). +** by eventually passing the *pazCol value to tdsqlite3_free(). ** ** If the table cannot be found, an error code is returned and the output ** variables are undefined. Or, if an OOM is encountered, SQLITE_NOMEM is ** returned (and the output variables are undefined). */ static int fts3ContentColumns( - sqlite3 *db, /* Database handle */ + tdsqlite3 *db, /* Database handle */ const char *zDb, /* Name of db (i.e. "main", "temp" etc.) */ const char *zTbl, /* Name of content table */ const char ***pazCol, /* OUT: Malloc'd array of column names */ @@ -170462,49 +170462,49 @@ static int fts3ContentColumns( ){ int rc = SQLITE_OK; /* Return code */ char *zSql; /* "SELECT *" statement on zTbl */ - sqlite3_stmt *pStmt = 0; /* Compiled version of zSql */ + tdsqlite3_stmt *pStmt = 0; /* Compiled version of zSql */ - zSql = sqlite3_mprintf("SELECT * FROM %Q.%Q", zDb, zTbl); + zSql = tdsqlite3_mprintf("SELECT * FROM %Q.%Q", zDb, zTbl); if( !zSql ){ rc = SQLITE_NOMEM; }else{ - rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0); + rc = tdsqlite3_prepare(db, zSql, -1, &pStmt, 0); if( rc!=SQLITE_OK ){ - sqlite3Fts3ErrMsg(pzErr, "%s", sqlite3_errmsg(db)); + tdsqlite3Fts3ErrMsg(pzErr, "%s", tdsqlite3_errmsg(db)); } } - sqlite3_free(zSql); + tdsqlite3_free(zSql); if( rc==SQLITE_OK ){ const char **azCol; /* Output array */ - sqlite3_int64 nStr = 0; /* Size of all column names (incl. 0x00) */ + tdsqlite3_int64 nStr = 0; /* Size of all column names (incl. 0x00) */ int nCol; /* Number of table columns */ int i; /* Used to iterate through columns */ /* Loop through the returned columns. Set nStr to the number of bytes of ** space required to store a copy of each column name, including the ** nul-terminator byte. */ - nCol = sqlite3_column_count(pStmt); + nCol = tdsqlite3_column_count(pStmt); for(i=0; i8 - && 0==sqlite3_strnicmp(z, "tokenize", 8) - && 0==sqlite3Fts3IsIdChar(z[8]) + && 0==tdsqlite3_strnicmp(z, "tokenize", 8) + && 0==tdsqlite3Fts3IsIdChar(z[8]) ){ - rc = sqlite3Fts3InitTokenizer(pHash, &z[9], &pTokenizer, pzErr); + rc = tdsqlite3Fts3InitTokenizer(pHash, &z[9], &pTokenizer, pzErr); } /* Check if it is an FTS4 special argument. */ @@ -170633,56 +170633,56 @@ static int fts3InitVtab( }else{ for(iOpt=0; iOptnOpt && !sqlite3_strnicmp(z, pOp->zOpt, pOp->nOpt) ){ + if( nKey==pOp->nOpt && !tdsqlite3_strnicmp(z, pOp->zOpt, pOp->nOpt) ){ break; } } switch( iOpt ){ case 0: /* MATCHINFO */ - if( strlen(zVal)!=4 || sqlite3_strnicmp(zVal, "fts3", 4) ){ - sqlite3Fts3ErrMsg(pzErr, "unrecognized matchinfo: %s", zVal); + if( strlen(zVal)!=4 || tdsqlite3_strnicmp(zVal, "fts3", 4) ){ + tdsqlite3Fts3ErrMsg(pzErr, "unrecognized matchinfo: %s", zVal); rc = SQLITE_ERROR; } bNoDocsize = 1; break; case 1: /* PREFIX */ - sqlite3_free(zPrefix); + tdsqlite3_free(zPrefix); zPrefix = zVal; zVal = 0; break; case 2: /* COMPRESS */ - sqlite3_free(zCompress); + tdsqlite3_free(zCompress); zCompress = zVal; zVal = 0; break; case 3: /* UNCOMPRESS */ - sqlite3_free(zUncompress); + tdsqlite3_free(zUncompress); zUncompress = zVal; zVal = 0; break; case 4: /* ORDER */ - if( (strlen(zVal)!=3 || sqlite3_strnicmp(zVal, "asc", 3)) - && (strlen(zVal)!=4 || sqlite3_strnicmp(zVal, "desc", 4)) + if( (strlen(zVal)!=3 || tdsqlite3_strnicmp(zVal, "asc", 3)) + && (strlen(zVal)!=4 || tdsqlite3_strnicmp(zVal, "desc", 4)) ){ - sqlite3Fts3ErrMsg(pzErr, "unrecognized order: %s", zVal); + tdsqlite3Fts3ErrMsg(pzErr, "unrecognized order: %s", zVal); rc = SQLITE_ERROR; } bDescIdx = (zVal[0]=='d' || zVal[0]=='D'); break; case 5: /* CONTENT */ - sqlite3_free(zContent); + tdsqlite3_free(zContent); zContent = zVal; zVal = 0; break; case 6: /* LANGUAGEID */ assert( iOpt==6 ); - sqlite3_free(zLanguageid); + tdsqlite3_free(zLanguageid); zLanguageid = zVal; zVal = 0; break; @@ -170694,11 +170694,11 @@ static int fts3InitVtab( default: assert( iOpt==SizeofArray(aFts4Opt) ); - sqlite3Fts3ErrMsg(pzErr, "unrecognized parameter: %s", z); + tdsqlite3Fts3ErrMsg(pzErr, "unrecognized parameter: %s", z); rc = SQLITE_ERROR; break; } - sqlite3_free(zVal); + tdsqlite3_free(zVal); } } @@ -170717,12 +170717,12 @@ static int fts3InitVtab( ** TABLE statement, use all columns from the content table. */ if( rc==SQLITE_OK && zContent ){ - sqlite3_free(zCompress); - sqlite3_free(zUncompress); + tdsqlite3_free(zCompress); + tdsqlite3_free(zUncompress); zCompress = 0; zUncompress = 0; if( nCol==0 ){ - sqlite3_free((void*)aCol); + tdsqlite3_free((void*)aCol); aCol = 0; rc = fts3ContentColumns(db, argv[1], zContent,&aCol,&nCol,&nString,pzErr); @@ -170731,7 +170731,7 @@ static int fts3InitVtab( if( rc==SQLITE_OK && zLanguageid ){ int j; for(j=0; j0 ){ memcpy(zCsr, z, n); } zCsr[n] = '\0'; - sqlite3Fts3Dequote(zCsr); + tdsqlite3Fts3Dequote(zCsr); p->azColumn[iCol] = zCsr; zCsr += n+1; assert( zCsr <= &((char *)p)[nByte] ); @@ -170833,17 +170833,17 @@ static int fts3InitVtab( for(i=0; iazColumn[iCol], zNot, n) + && 0==tdsqlite3_strnicmp(p->azColumn[iCol], zNot, n) ){ p->abNotindexed[iCol] = 1; - sqlite3_free(zNot); + tdsqlite3_free(zNot); azNotindexed[i] = 0; } } } for(i=0; izReadExprlist = fts3ReadExprList(p, zUncompress, &rc); p->zWriteExprlist = fts3WriteExprList(p, zCompress, &rc); @@ -170884,18 +170884,18 @@ static int fts3InitVtab( fts3DeclareVtab(&rc, p); fts3_init_out: - sqlite3_free(zPrefix); - sqlite3_free(aIndex); - sqlite3_free(zCompress); - sqlite3_free(zUncompress); - sqlite3_free(zContent); - sqlite3_free(zLanguageid); - for(i=0; ipModule->xDestroy(pTokenizer); } @@ -170911,22 +170911,22 @@ fts3_init_out: ** work is done in function fts3InitVtab(). */ static int fts3ConnectMethod( - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ void *pAux, /* Pointer to tokenizer hash table */ int argc, /* Number of elements in argv array */ const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ - char **pzErr /* OUT: sqlite3_malloc'd error message */ + tdsqlite3_vtab **ppVtab, /* OUT: New tdsqlite3_vtab object */ + char **pzErr /* OUT: tdsqlite3_malloc'd error message */ ){ return fts3InitVtab(0, db, pAux, argc, argv, ppVtab, pzErr); } static int fts3CreateMethod( - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ void *pAux, /* Pointer to tokenizer hash table */ int argc, /* Number of elements in argv array */ const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ - char **pzErr /* OUT: sqlite3_malloc'd error message */ + tdsqlite3_vtab **ppVtab, /* OUT: New tdsqlite3_vtab object */ + char **pzErr /* OUT: tdsqlite3_malloc'd error message */ ){ return fts3InitVtab(1, db, pAux, argc, argv, ppVtab, pzErr); } @@ -170936,9 +170936,9 @@ static int fts3CreateMethod( ** extension is currently being used by a version of SQLite too old to ** support estimatedRows. In that case this function is a no-op. */ -static void fts3SetEstimatedRows(sqlite3_index_info *pIdxInfo, i64 nRow){ +static void fts3SetEstimatedRows(tdsqlite3_index_info *pIdxInfo, i64 nRow){ #if SQLITE_VERSION_NUMBER>=3008002 - if( sqlite3_libversion_number()>=3008002 ){ + if( tdsqlite3_libversion_number()>=3008002 ){ pIdxInfo->estimatedRows = nRow; } #endif @@ -170949,9 +170949,9 @@ static void fts3SetEstimatedRows(sqlite3_index_info *pIdxInfo, i64 nRow){ ** extension is currently being used by a version of SQLite too old to ** support index-info flags. In that case this function is a no-op. */ -static void fts3SetUniqueFlag(sqlite3_index_info *pIdxInfo){ +static void fts3SetUniqueFlag(tdsqlite3_index_info *pIdxInfo){ #if SQLITE_VERSION_NUMBER>=3008012 - if( sqlite3_libversion_number()>=3008012 ){ + if( tdsqlite3_libversion_number()>=3008012 ){ pIdxInfo->idxFlags |= SQLITE_INDEX_SCAN_UNIQUE; } #endif @@ -170965,7 +170965,7 @@ static void fts3SetUniqueFlag(sqlite3_index_info *pIdxInfo){ ** 2. Full-text search using a MATCH operator on a non-docid column. ** 3. Linear scan of %_content table. */ -static int fts3BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){ +static int fts3BestIndexMethod(tdsqlite3_vtab *pVTab, tdsqlite3_index_info *pInfo){ Fts3Table *p = (Fts3Table *)pVTab; int i; /* Iterator variable */ int iCons = -1; /* Index of constraint to use */ @@ -170987,7 +170987,7 @@ static int fts3BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){ pInfo->estimatedCost = 5000000; for(i=0; inConstraint; i++){ int bDocid; /* True if this constraint is on docid */ - struct sqlite3_index_constraint *pCons = &pInfo->aConstraint[i]; + struct tdsqlite3_index_constraint *pCons = &pInfo->aConstraint[i]; if( pCons->usable==0 ){ if( pCons->op==SQLITE_INDEX_CONSTRAINT_MATCH ){ /* There exists an unusable MATCH constraint. This means that if @@ -170997,7 +170997,7 @@ static int fts3BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){ ** this, return a very high cost here. */ pInfo->idxNum = FTS3_FULLSCAN_SEARCH; pInfo->estimatedCost = 1e50; - fts3SetEstimatedRows(pInfo, ((sqlite3_int64)1) << 50); + fts3SetEstimatedRows(pInfo, ((tdsqlite3_int64)1) << 50); return SQLITE_OK; } continue; @@ -171076,7 +171076,7 @@ static int fts3BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){ ** docid) order. Both ascending and descending are possible. */ if( pInfo->nOrderBy==1 ){ - struct sqlite3_index_orderby *pOrder = &pInfo->aOrderBy[0]; + struct tdsqlite3_index_orderby *pOrder = &pInfo->aOrderBy[0]; if( pOrder->iColumn<0 || pOrder->iColumn==p->nColumn+1 ){ if( pOrder->desc ){ pInfo->idxStr = "DESC"; @@ -171094,8 +171094,8 @@ static int fts3BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){ /* ** Implementation of xOpen method. */ -static int fts3OpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){ - sqlite3_vtab_cursor *pCsr; /* Allocated cursor */ +static int fts3OpenMethod(tdsqlite3_vtab *pVTab, tdsqlite3_vtab_cursor **ppCsr){ + tdsqlite3_vtab_cursor *pCsr; /* Allocated cursor */ UNUSED_PARAMETER(pVTab); @@ -171103,7 +171103,7 @@ static int fts3OpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){ ** allocation succeeds, zero it and return SQLITE_OK. Otherwise, ** if the allocation fails, return SQLITE_NOMEM. */ - *ppCsr = pCsr = (sqlite3_vtab_cursor *)sqlite3_malloc(sizeof(Fts3Cursor)); + *ppCsr = pCsr = (tdsqlite3_vtab_cursor *)tdsqlite3_malloc(sizeof(Fts3Cursor)); if( !pCsr ){ return SQLITE_NOMEM; } @@ -171123,12 +171123,12 @@ static void fts3CursorFinalizeStmt(Fts3Cursor *pCsr){ Fts3Table *p = (Fts3Table *)pCsr->base.pVtab; if( p->pSeekStmt==0 ){ p->pSeekStmt = pCsr->pStmt; - sqlite3_reset(pCsr->pStmt); + tdsqlite3_reset(pCsr->pStmt); pCsr->pStmt = 0; } pCsr->bSeekStmt = 0; } - sqlite3_finalize(pCsr->pStmt); + tdsqlite3_finalize(pCsr->pStmt); } /* @@ -171137,23 +171137,23 @@ static void fts3CursorFinalizeStmt(Fts3Cursor *pCsr){ */ static void fts3ClearCursor(Fts3Cursor *pCsr){ fts3CursorFinalizeStmt(pCsr); - sqlite3Fts3FreeDeferredTokens(pCsr); - sqlite3_free(pCsr->aDoclist); - sqlite3Fts3MIBufferFree(pCsr->pMIBuffer); - sqlite3Fts3ExprFree(pCsr->pExpr); - memset(&(&pCsr->base)[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor)); + tdsqlite3Fts3FreeDeferredTokens(pCsr); + tdsqlite3_free(pCsr->aDoclist); + tdsqlite3Fts3MIBufferFree(pCsr->pMIBuffer); + tdsqlite3Fts3ExprFree(pCsr->pExpr); + memset(&(&pCsr->base)[1], 0, sizeof(Fts3Cursor)-sizeof(tdsqlite3_vtab_cursor)); } /* ** Close the cursor. For additional information see the documentation ** on the xClose method of the virtual table interface. */ -static int fts3CloseMethod(sqlite3_vtab_cursor *pCursor){ +static int fts3CloseMethod(tdsqlite3_vtab_cursor *pCursor){ Fts3Cursor *pCsr = (Fts3Cursor *)pCursor; assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 ); fts3ClearCursor(pCsr); assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 ); - sqlite3_free(pCsr); + tdsqlite3_free(pCsr); return SQLITE_OK; } @@ -171175,14 +171175,14 @@ static int fts3CursorSeekStmt(Fts3Cursor *pCsr){ pCsr->pStmt = p->pSeekStmt; p->pSeekStmt = 0; }else{ - zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist); + zSql = tdsqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist); if( !zSql ) return SQLITE_NOMEM; p->bLock++; - rc = sqlite3_prepare_v3( + rc = tdsqlite3_prepare_v3( p->db, zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0 ); p->bLock--; - sqlite3_free(zSql); + tdsqlite3_free(zSql); } if( rc==SQLITE_OK ) pCsr->bSeekStmt = 1; } @@ -171194,21 +171194,21 @@ static int fts3CursorSeekStmt(Fts3Cursor *pCsr){ ** of the %_content table that contains the last match. Return ** SQLITE_OK on success. */ -static int fts3CursorSeek(sqlite3_context *pContext, Fts3Cursor *pCsr){ +static int fts3CursorSeek(tdsqlite3_context *pContext, Fts3Cursor *pCsr){ int rc = SQLITE_OK; if( pCsr->isRequireSeek ){ rc = fts3CursorSeekStmt(pCsr); if( rc==SQLITE_OK ){ Fts3Table *pTab = (Fts3Table*)pCsr->base.pVtab; pTab->bLock++; - sqlite3_bind_int64(pCsr->pStmt, 1, pCsr->iPrevId); + tdsqlite3_bind_int64(pCsr->pStmt, 1, pCsr->iPrevId); pCsr->isRequireSeek = 0; - if( SQLITE_ROW==sqlite3_step(pCsr->pStmt) ){ + if( SQLITE_ROW==tdsqlite3_step(pCsr->pStmt) ){ pTab->bLock--; return SQLITE_OK; }else{ pTab->bLock--; - rc = sqlite3_reset(pCsr->pStmt); + rc = tdsqlite3_reset(pCsr->pStmt); if( rc==SQLITE_OK && ((Fts3Table *)pCsr->base.pVtab)->zContentTbl==0 ){ /* If no row was found and no error has occurred, then the %_content ** table is missing a row that is present in the full-text index. @@ -171221,7 +171221,7 @@ static int fts3CursorSeek(sqlite3_context *pContext, Fts3Cursor *pCsr){ } if( rc!=SQLITE_OK && pContext ){ - sqlite3_result_error_code(pContext, rc); + tdsqlite3_result_error_code(pContext, rc); } return rc; } @@ -171246,8 +171246,8 @@ static int fts3ScanInteriorNode( int nTerm, /* Size of term zTerm in bytes */ const char *zNode, /* Buffer containing segment interior node */ int nNode, /* Size of buffer at zNode */ - sqlite3_int64 *piFirst, /* OUT: Selected child node */ - sqlite3_int64 *piLast /* OUT: Selected child node */ + tdsqlite3_int64 *piFirst, /* OUT: Selected child node */ + tdsqlite3_int64 *piLast /* OUT: Selected child node */ ){ int rc = SQLITE_OK; /* Return code */ const char *zCsr = zNode; /* Cursor to iterate through node */ @@ -171255,7 +171255,7 @@ static int fts3ScanInteriorNode( char *zBuffer = 0; /* Buffer to load terms into */ i64 nAlloc = 0; /* Size of allocated buffer */ int isFirstTerm = 1; /* True when processing first term on page */ - sqlite3_int64 iChild; /* Block id of child node to descend to */ + tdsqlite3_int64 iChild; /* Block id of child node to descend to */ /* Skip over the 'height' varint that occurs at the start of every ** interior node. Then load the blockid of the left-child of the b-tree @@ -171268,10 +171268,10 @@ static int fts3ScanInteriorNode( ** either more than 20 bytes of allocated space following the nNode bytes of ** contents, or two zero bytes. Or, if the node is read from the %_segments ** table, then there are always 20 bytes of zeroed padding following the - ** nNode bytes of content (see sqlite3Fts3ReadBlock() for details). + ** nNode bytes of content (see tdsqlite3Fts3ReadBlock() for details). */ - zCsr += sqlite3Fts3GetVarint(zCsr, &iChild); - zCsr += sqlite3Fts3GetVarint(zCsr, &iChild); + zCsr += tdsqlite3Fts3GetVarint(zCsr, &iChild); + zCsr += tdsqlite3Fts3GetVarint(zCsr, &iChild); if( zCsr>zEnd ){ return FTS_CORRUPT_VTAB; } @@ -171298,7 +171298,7 @@ static int fts3ScanInteriorNode( if( (i64)nPrefix+nSuffix>nAlloc ){ char *zNew; nAlloc = ((i64)nPrefix+nSuffix) * 2; - zNew = (char *)sqlite3_realloc64(zBuffer, nAlloc); + zNew = (char *)tdsqlite3_realloc64(zBuffer, nAlloc); if( !zNew ){ rc = SQLITE_NOMEM; goto finish_scan; @@ -171337,7 +171337,7 @@ static int fts3ScanInteriorNode( if( piLast ) *piLast = iChild; finish_scan: - sqlite3_free(zBuffer); + tdsqlite3_free(zBuffer); return rc; } @@ -171369,8 +171369,8 @@ static int fts3SelectLeaf( int nTerm, /* Size of term zTerm in bytes */ const char *zNode, /* Buffer containing segment interior node */ int nNode, /* Size of buffer at zNode */ - sqlite3_int64 *piLeaf, /* Selected leaf node */ - sqlite3_int64 *piLeaf2 /* Selected leaf node */ + tdsqlite3_int64 *piLeaf, /* Selected leaf node */ + tdsqlite3_int64 *piLeaf2 /* Selected leaf node */ ){ int rc = SQLITE_OK; /* Return code */ int iHeight; /* Height of this node in tree */ @@ -171386,17 +171386,17 @@ static int fts3SelectLeaf( int nBlob = 0; /* Size of zBlob in bytes */ if( piLeaf && piLeaf2 && (*piLeaf!=*piLeaf2) ){ - rc = sqlite3Fts3ReadBlock(p, *piLeaf, &zBlob, &nBlob, 0); + rc = tdsqlite3Fts3ReadBlock(p, *piLeaf, &zBlob, &nBlob, 0); if( rc==SQLITE_OK ){ rc = fts3SelectLeaf(p, zTerm, nTerm, zBlob, nBlob, piLeaf, 0); } - sqlite3_free(zBlob); + tdsqlite3_free(zBlob); piLeaf = 0; zBlob = 0; } if( rc==SQLITE_OK ){ - rc = sqlite3Fts3ReadBlock(p, piLeaf?*piLeaf:*piLeaf2, &zBlob, &nBlob, 0); + rc = tdsqlite3Fts3ReadBlock(p, piLeaf?*piLeaf:*piLeaf2, &zBlob, &nBlob, 0); } if( rc==SQLITE_OK ){ int iNewHeight = 0; @@ -171407,7 +171407,7 @@ static int fts3SelectLeaf( rc = fts3SelectLeaf(p, zTerm, nTerm, zBlob, nBlob, piLeaf, piLeaf2); } } - sqlite3_free(zBlob); + tdsqlite3_free(zBlob); } return rc; @@ -171419,11 +171419,11 @@ static int fts3SelectLeaf( */ static void fts3PutDeltaVarint( char **pp, /* IN/OUT: Output pointer */ - sqlite3_int64 *piPrev, /* IN/OUT: Previous value written to list */ - sqlite3_int64 iVal /* Write this value to the list */ + tdsqlite3_int64 *piPrev, /* IN/OUT: Previous value written to list */ + tdsqlite3_int64 iVal /* Write this value to the list */ ){ assert( iVal-*piPrev > 0 || (*piPrev==0 && iVal==0) ); - *pp += sqlite3Fts3PutVarint(*pp, iVal-*piPrev); + *pp += tdsqlite3Fts3PutVarint(*pp, iVal-*piPrev); *piPrev = iVal; } @@ -171536,7 +171536,7 @@ static void fts3ColumnlistCopy(char **pp, char **ppPoslist){ */ static void fts3ReadNextPos( char **pp, /* IN/OUT: Pointer into position-list buffer */ - sqlite3_int64 *pi /* IN/OUT: Value read from position-list */ + tdsqlite3_int64 *pi /* IN/OUT: Value read from position-list */ ){ if( (**pp)&0xFE ){ fts3GetDeltaVarint(pp, pi); @@ -171559,7 +171559,7 @@ static int fts3PutColNumber(char **pp, int iCol){ int n = 0; /* Number of bytes written */ if( iCol ){ char *p = *pp; /* Output pointer */ - n = 1 + sqlite3Fts3PutVarint(&p[1], iCol); + n = 1 + tdsqlite3Fts3PutVarint(&p[1], iCol); *p = 0x01; *pp = &p[n]; } @@ -171601,9 +171601,9 @@ static int fts3PoslistMerge( else iCol2 = 0; if( iCol1==iCol2 ){ - sqlite3_int64 i1 = 0; /* Last position from pp1 */ - sqlite3_int64 i2 = 0; /* Last position from pp2 */ - sqlite3_int64 iPrev = 0; + tdsqlite3_int64 i1 = 0; /* Last position from pp1 */ + tdsqlite3_int64 i2 = 0; /* Last position from pp2 */ + tdsqlite3_int64 iPrev = 0; int n = fts3PutColNumber(&p, iCol1); p1 += n; p2 += n; @@ -171700,13 +171700,13 @@ static int fts3PoslistPhraseMerge( while( 1 ){ if( iCol1==iCol2 ){ char *pSave = p; - sqlite3_int64 iPrev = 0; - sqlite3_int64 iPos1 = 0; - sqlite3_int64 iPos2 = 0; + tdsqlite3_int64 iPrev = 0; + tdsqlite3_int64 iPos1 = 0; + tdsqlite3_int64 iPos2 = 0; if( iCol1 ){ *p++ = POS_COLUMN; - p += sqlite3Fts3PutVarint(p, iCol1); + p += tdsqlite3Fts3PutVarint(p, iCol1); } fts3GetDeltaVarint(&p1, &iPos1); iPos1 -= 2; @@ -171717,7 +171717,7 @@ static int fts3PoslistPhraseMerge( if( iPos2==iPos1+nToken || (isExact==0 && iPos2>iPos1 && iPos2<=iPos1+nToken) ){ - sqlite3_int64 iSave; + tdsqlite3_int64 iSave; iSave = isSaveLeft ? iPos1 : iPos2; fts3PutDeltaVarint(&p, &iPrev, iSave+2); iPrev -= 2; pSave = 0; @@ -171855,13 +171855,13 @@ static void fts3GetDeltaVarint3( char **pp, /* IN/OUT: Point to read varint from */ char *pEnd, /* End of buffer */ int bDescIdx, /* True if docids are descending */ - sqlite3_int64 *pVal /* IN/OUT: Integer value */ + tdsqlite3_int64 *pVal /* IN/OUT: Integer value */ ){ if( *pp>=pEnd ){ *pp = 0; }else{ u64 iVal; - *pp += sqlite3Fts3GetVarintU(*pp, &iVal); + *pp += tdsqlite3Fts3GetVarintU(*pp, &iVal); if( bDescIdx ){ *pVal = (i64)((u64)*pVal - iVal); }else{ @@ -171888,11 +171888,11 @@ static void fts3GetDeltaVarint3( static void fts3PutDeltaVarint3( char **pp, /* IN/OUT: Output pointer */ int bDescIdx, /* True for descending docids */ - sqlite3_int64 *piPrev, /* IN/OUT: Previous value written to list */ + tdsqlite3_int64 *piPrev, /* IN/OUT: Previous value written to list */ int *pbFirst, /* IN/OUT: True after first int written */ - sqlite3_int64 iVal /* Write this value to the list */ + tdsqlite3_int64 iVal /* Write this value to the list */ ){ - sqlite3_uint64 iWrite; + tdsqlite3_uint64 iWrite; if( bDescIdx==0 || *pbFirst==0 ){ assert_fts3_nc( *pbFirst==0 || iVal>=*piPrev ); iWrite = (u64)iVal - (u64)*piPrev; @@ -171902,7 +171902,7 @@ static void fts3PutDeltaVarint3( } assert( *pbFirst || *piPrev==0 ); assert_fts3_nc( *pbFirst==0 || iWrite>0 ); - *pp += sqlite3Fts3PutVarint(*pp, iWrite); + *pp += tdsqlite3Fts3PutVarint(*pp, iWrite); *piPrev = iVal; *pbFirst = 1; } @@ -171927,7 +171927,7 @@ static void fts3PutDeltaVarint3( ** should be false. If they are sorted in ascending order, it should be ** passed a non-zero value. ** -** If no error occurs, *paOut is set to point at an sqlite3_malloc'd buffer +** If no error occurs, *paOut is set to point at an tdsqlite3_malloc'd buffer ** containing the output doclist and SQLITE_OK is returned. In this case ** *pnOut is set to the number of bytes in the output doclist. ** @@ -171941,9 +171941,9 @@ static int fts3DoclistOrMerge( char **paOut, int *pnOut /* OUT: Malloc'd doclist */ ){ int rc = SQLITE_OK; - sqlite3_int64 i1 = 0; - sqlite3_int64 i2 = 0; - sqlite3_int64 iPrev = 0; + tdsqlite3_int64 i1 = 0; + tdsqlite3_int64 i2 = 0; + tdsqlite3_int64 iPrev = 0; char *pEnd1 = &a1[n1]; char *pEnd2 = &a2[n2]; char *p1 = a1; @@ -171984,14 +171984,14 @@ static int fts3DoclistOrMerge( ** A symetric argument may be made if the doclists are in descending ** order. */ - aOut = sqlite3_malloc64((i64)n1+n2+FTS3_VARINT_MAX-1+FTS3_BUFFER_PADDING); + aOut = tdsqlite3_malloc64((i64)n1+n2+FTS3_VARINT_MAX-1+FTS3_BUFFER_PADDING); if( !aOut ) return SQLITE_NOMEM; p = aOut; fts3GetDeltaVarint3(&p1, pEnd1, 0, &i1); fts3GetDeltaVarint3(&p2, pEnd2, 0, &i2); while( p1 || p2 ){ - sqlite3_int64 iDiff = DOCID_CMP(i1, i2); + tdsqlite3_int64 iDiff = DOCID_CMP(i1, i2); if( p2 && p1 && iDiff==0 ){ fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i1); @@ -172013,7 +172013,7 @@ static int fts3DoclistOrMerge( } if( rc!=SQLITE_OK ){ - sqlite3_free(aOut); + tdsqlite3_free(aOut); p = aOut = 0; }else{ assert( (p-aOut)<=n1+n2+FTS3_VARINT_MAX-1 ); @@ -172042,9 +172042,9 @@ static int fts3DoclistPhraseMerge( char *aLeft, int nLeft, /* Left doclist */ char **paRight, int *pnRight /* IN/OUT: Right/output doclist */ ){ - sqlite3_int64 i1 = 0; - sqlite3_int64 i2 = 0; - sqlite3_int64 iPrev = 0; + tdsqlite3_int64 i1 = 0; + tdsqlite3_int64 i2 = 0; + tdsqlite3_int64 iPrev = 0; char *aRight = *paRight; char *pEnd1 = &aLeft[nLeft]; char *pEnd2 = &aRight[*pnRight]; @@ -172056,7 +172056,7 @@ static int fts3DoclistPhraseMerge( assert( nDist>0 ); if( bDescDoclist ){ - aOut = sqlite3_malloc64((sqlite3_int64)*pnRight + FTS3_VARINT_MAX); + aOut = tdsqlite3_malloc64((tdsqlite3_int64)*pnRight + FTS3_VARINT_MAX); if( aOut==0 ) return SQLITE_NOMEM; }else{ aOut = aRight; @@ -172067,10 +172067,10 @@ static int fts3DoclistPhraseMerge( fts3GetDeltaVarint3(&p2, pEnd2, 0, &i2); while( p1 && p2 ){ - sqlite3_int64 iDiff = DOCID_CMP(i1, i2); + tdsqlite3_int64 iDiff = DOCID_CMP(i1, i2); if( iDiff==0 ){ char *pSave = p; - sqlite3_int64 iPrevSave = iPrev; + tdsqlite3_int64 iPrevSave = iPrev; int bFirstOutSave = bFirstOut; fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i1); @@ -172092,7 +172092,7 @@ static int fts3DoclistPhraseMerge( *pnRight = (int)(p - aOut); if( bDescDoclist ){ - sqlite3_free(aRight); + tdsqlite3_free(aRight); *paRight = aOut; } @@ -172107,8 +172107,8 @@ static int fts3DoclistPhraseMerge( ** of the entries from pList at position 0, and terminated by an 0x00 byte. ** The value returned is the number of bytes written to pOut (if any). */ -SQLITE_PRIVATE int sqlite3Fts3FirstFilter( - sqlite3_int64 iDelta, /* Varint that may be written to pOut */ +SQLITE_PRIVATE int tdsqlite3Fts3FirstFilter( + tdsqlite3_int64 iDelta, /* Varint that may be written to pOut */ char *pList, /* Position list (no 0x00 term) */ int nList, /* Size of pList in bytes */ char *pOut /* Write output here */ @@ -172120,7 +172120,7 @@ SQLITE_PRIVATE int sqlite3Fts3FirstFilter( if( *p!=0x01 ){ if( *p==0x02 ){ - nOut += sqlite3Fts3PutVarint(&pOut[nOut], iDelta); + nOut += tdsqlite3Fts3PutVarint(&pOut[nOut], iDelta); pOut[nOut++] = 0x02; bWritten = 1; } @@ -172128,16 +172128,16 @@ SQLITE_PRIVATE int sqlite3Fts3FirstFilter( } while( paaOutput[i], pTS->anOutput[i], aOut, nOut, &aNew, &nNew ); if( rc!=SQLITE_OK ){ - sqlite3_free(aOut); + tdsqlite3_free(aOut); return rc; } - sqlite3_free(pTS->aaOutput[i]); - sqlite3_free(aOut); + tdsqlite3_free(pTS->aaOutput[i]); + tdsqlite3_free(aOut); pTS->aaOutput[i] = 0; aOut = aNew; nOut = nNew; @@ -172236,7 +172236,7 @@ static int fts3TermSelectMerge( ** ** Similar padding is added in the fts3DoclistOrMerge() function. */ - pTS->aaOutput[0] = sqlite3_malloc(nDoclist + FTS3_VARINT_MAX + 1); + pTS->aaOutput[0] = tdsqlite3_malloc(nDoclist + FTS3_VARINT_MAX + 1); pTS->anOutput[0] = nDoclist; if( pTS->aaOutput[0] ){ memcpy(pTS->aaOutput[0], aDoclist, nDoclist); @@ -172263,12 +172263,12 @@ static int fts3TermSelectMerge( pTS->aaOutput[iOut], pTS->anOutput[iOut], &aNew, &nNew ); if( rc!=SQLITE_OK ){ - if( aMerge!=aDoclist ) sqlite3_free(aMerge); + if( aMerge!=aDoclist ) tdsqlite3_free(aMerge); return rc; } - if( aMerge!=aDoclist ) sqlite3_free(aMerge); - sqlite3_free(pTS->aaOutput[iOut]); + if( aMerge!=aDoclist ) tdsqlite3_free(aMerge); + tdsqlite3_free(pTS->aaOutput[iOut]); pTS->aaOutput[iOut] = 0; aMerge = aNew; @@ -172292,10 +172292,10 @@ static int fts3SegReaderCursorAppend( ){ if( (pCsr->nSegment%16)==0 ){ Fts3SegReader **apNew; - sqlite3_int64 nByte = (pCsr->nSegment + 16)*sizeof(Fts3SegReader*); - apNew = (Fts3SegReader **)sqlite3_realloc64(pCsr->apSegment, nByte); + tdsqlite3_int64 nByte = (pCsr->nSegment + 16)*sizeof(Fts3SegReader*); + apNew = (Fts3SegReader **)tdsqlite3_realloc64(pCsr->apSegment, nByte); if( !apNew ){ - sqlite3Fts3SegReaderFree(pNew); + tdsqlite3Fts3SegReaderFree(pNew); return SQLITE_NOMEM; } pCsr->apSegment = apNew; @@ -172323,8 +172323,8 @@ static int fts3SegReaderCursor( Fts3MultiSegReader *pCsr /* Cursor object to populate */ ){ int rc = SQLITE_OK; /* Error code */ - sqlite3_stmt *pStmt = 0; /* Statement to iterate through segments */ - int rc2; /* Result of sqlite3_reset() */ + tdsqlite3_stmt *pStmt = 0; /* Statement to iterate through segments */ + int rc2; /* Result of tdsqlite3_reset() */ /* If iLevel is less than 0 and this is not a scan, include a seg-reader ** for the pending-terms. If this is a scan, then this call must be being @@ -172334,7 +172334,7 @@ static int fts3SegReaderCursor( ** calls out here. */ if( iLevel<0 && p->aIndex && p->iPrevLangid==iLangid ){ Fts3SegReader *pSeg = 0; - rc = sqlite3Fts3SegReaderPending(p, iIndex, zTerm, nTerm, isPrefix||isScan, &pSeg); + rc = tdsqlite3Fts3SegReaderPending(p, iIndex, zTerm, nTerm, isPrefix||isScan, &pSeg); if( rc==SQLITE_OK && pSeg ){ rc = fts3SegReaderCursorAppend(pCsr, pSeg); } @@ -172342,29 +172342,29 @@ static int fts3SegReaderCursor( if( iLevel!=FTS3_SEGCURSOR_PENDING ){ if( rc==SQLITE_OK ){ - rc = sqlite3Fts3AllSegdirs(p, iLangid, iIndex, iLevel, &pStmt); + rc = tdsqlite3Fts3AllSegdirs(p, iLangid, iIndex, iLevel, &pStmt); } - while( rc==SQLITE_OK && SQLITE_ROW==(rc = sqlite3_step(pStmt)) ){ + while( rc==SQLITE_OK && SQLITE_ROW==(rc = tdsqlite3_step(pStmt)) ){ Fts3SegReader *pSeg = 0; /* Read the values returned by the SELECT into local variables. */ - sqlite3_int64 iStartBlock = sqlite3_column_int64(pStmt, 1); - sqlite3_int64 iLeavesEndBlock = sqlite3_column_int64(pStmt, 2); - sqlite3_int64 iEndBlock = sqlite3_column_int64(pStmt, 3); - int nRoot = sqlite3_column_bytes(pStmt, 4); - char const *zRoot = sqlite3_column_blob(pStmt, 4); + tdsqlite3_int64 iStartBlock = tdsqlite3_column_int64(pStmt, 1); + tdsqlite3_int64 iLeavesEndBlock = tdsqlite3_column_int64(pStmt, 2); + tdsqlite3_int64 iEndBlock = tdsqlite3_column_int64(pStmt, 3); + int nRoot = tdsqlite3_column_bytes(pStmt, 4); + char const *zRoot = tdsqlite3_column_blob(pStmt, 4); /* If zTerm is not NULL, and this segment is not stored entirely on its ** root node, the range of leaves scanned can be reduced. Do this. */ if( iStartBlock && zTerm && zRoot ){ - sqlite3_int64 *pi = (isPrefix ? &iLeavesEndBlock : 0); + tdsqlite3_int64 *pi = (isPrefix ? &iLeavesEndBlock : 0); rc = fts3SelectLeaf(p, zTerm, nTerm, zRoot, nRoot, &iStartBlock, pi); if( rc!=SQLITE_OK ) goto finished; if( isPrefix==0 && isScan==0 ) iLeavesEndBlock = iStartBlock; } - rc = sqlite3Fts3SegReaderNew(pCsr->nSegment+1, + rc = tdsqlite3Fts3SegReaderNew(pCsr->nSegment+1, (isPrefix==0 && isScan==0), iStartBlock, iLeavesEndBlock, iEndBlock, zRoot, nRoot, &pSeg @@ -172375,7 +172375,7 @@ static int fts3SegReaderCursor( } finished: - rc2 = sqlite3_reset(pStmt); + rc2 = tdsqlite3_reset(pStmt); if( rc==SQLITE_DONE ) rc = rc2; return rc; @@ -172385,7 +172385,7 @@ static int fts3SegReaderCursor( ** Set up a cursor object for iterating through a full-text index or a ** single level therein. */ -SQLITE_PRIVATE int sqlite3Fts3SegReaderCursor( +SQLITE_PRIVATE int tdsqlite3Fts3SegReaderCursor( Fts3Table *p, /* FTS3 table handle */ int iLangid, /* Language-id to search */ int iIndex, /* Index to search (from 0 to p->nIndex-1) */ @@ -172452,7 +172452,7 @@ static int fts3TermSegReaderCursor( Fts3MultiSegReader *pSegcsr; /* Object to allocate and return */ int rc = SQLITE_NOMEM; /* Return code */ - pSegcsr = sqlite3_malloc(sizeof(Fts3MultiSegReader)); + pSegcsr = tdsqlite3_malloc(sizeof(Fts3MultiSegReader)); if( pSegcsr ){ int i; int bFound = 0; /* True once an index has been found */ @@ -172462,7 +172462,7 @@ static int fts3TermSegReaderCursor( for(i=1; bFound==0 && inIndex; i++){ if( p->aIndex[i].nPrefix==nTerm ){ bFound = 1; - rc = sqlite3Fts3SegReaderCursor(p, pCsr->iLangid, + rc = tdsqlite3Fts3SegReaderCursor(p, pCsr->iLangid, i, FTS3_SEGCURSOR_ALL, zTerm, nTerm, 0, 0, pSegcsr ); pSegcsr->bLookup = 1; @@ -172472,7 +172472,7 @@ static int fts3TermSegReaderCursor( for(i=1; bFound==0 && inIndex; i++){ if( p->aIndex[i].nPrefix==nTerm+1 ){ bFound = 1; - rc = sqlite3Fts3SegReaderCursor(p, pCsr->iLangid, + rc = tdsqlite3Fts3SegReaderCursor(p, pCsr->iLangid, i, FTS3_SEGCURSOR_ALL, zTerm, nTerm, 1, 0, pSegcsr ); if( rc==SQLITE_OK ){ @@ -172485,7 +172485,7 @@ static int fts3TermSegReaderCursor( } if( bFound==0 ){ - rc = sqlite3Fts3SegReaderCursor(p, pCsr->iLangid, + rc = tdsqlite3Fts3SegReaderCursor(p, pCsr->iLangid, 0, FTS3_SEGCURSOR_ALL, zTerm, nTerm, isPrefix, 0, pSegcsr ); pSegcsr->bLookup = !isPrefix; @@ -172500,8 +172500,8 @@ static int fts3TermSegReaderCursor( ** Free an Fts3MultiSegReader allocated by fts3TermSegReaderCursor(). */ static void fts3SegReaderCursorFree(Fts3MultiSegReader *pSegcsr){ - sqlite3Fts3SegReaderFinish(pSegcsr); - sqlite3_free(pSegcsr); + tdsqlite3Fts3SegReaderFinish(pSegcsr); + tdsqlite3_free(pSegcsr); } /* @@ -172531,9 +172531,9 @@ static int fts3TermSelect( filter.zTerm = pTok->z; filter.nTerm = pTok->n; - rc = sqlite3Fts3SegReaderStart(p, pSegcsr, &filter); + rc = tdsqlite3Fts3SegReaderStart(p, pSegcsr, &filter); while( SQLITE_OK==rc - && SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, pSegcsr)) + && SQLITE_ROW==(rc = tdsqlite3Fts3SegReaderStep(p, pSegcsr)) ){ rc = fts3TermSelectMerge(p, &tsc, pSegcsr->aDoclist, pSegcsr->nDoclist); } @@ -172547,7 +172547,7 @@ static int fts3TermSelect( }else{ int i; for(i=0; ieSearch==FTS3_DOCID_SEARCH || pCsr->eSearch==FTS3_FULLSCAN_SEARCH ){ Fts3Table *pTab = (Fts3Table*)pCursor->pVtab; pTab->bLock++; - if( SQLITE_ROW!=sqlite3_step(pCsr->pStmt) ){ + if( SQLITE_ROW!=tdsqlite3_step(pCsr->pStmt) ){ pCsr->isEof = 1; - rc = sqlite3_reset(pCsr->pStmt); + rc = tdsqlite3_reset(pCsr->pStmt); }else{ - pCsr->iPrevId = sqlite3_column_int64(pCsr->pStmt, 0); + pCsr->iPrevId = tdsqlite3_column_int64(pCsr->pStmt, 0); rc = SQLITE_OK; } pTab->bLock--; @@ -172617,11 +172617,11 @@ static int fts3NextMethod(sqlite3_vtab_cursor *pCursor){ ** converted to a 64-bit signed integer. Otherwise, return a copy of ** the second parameter, iDefault. */ -static sqlite3_int64 fts3DocidRange(sqlite3_value *pVal, i64 iDefault){ +static tdsqlite3_int64 fts3DocidRange(tdsqlite3_value *pVal, i64 iDefault){ if( pVal ){ - int eType = sqlite3_value_numeric_type(pVal); + int eType = tdsqlite3_value_numeric_type(pVal); if( eType==SQLITE_INTEGER ){ - return sqlite3_value_int64(pVal); + return tdsqlite3_value_int64(pVal); } } return iDefault; @@ -172644,11 +172644,11 @@ static sqlite3_int64 fts3DocidRange(sqlite3_value *pVal, i64 iDefault){ ** side of the MATCH operator. */ static int fts3FilterMethod( - sqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ + tdsqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ int idxNum, /* Strategy index */ const char *idxStr, /* Unused */ int nVal, /* Number of elements in apVal */ - sqlite3_value **apVal /* Arguments for the indexing scheme */ + tdsqlite3_value **apVal /* Arguments for the indexing scheme */ ){ int rc = SQLITE_OK; char *zSql; /* SQL statement used to access %_content */ @@ -172656,10 +172656,10 @@ static int fts3FilterMethod( Fts3Table *p = (Fts3Table *)pCursor->pVtab; Fts3Cursor *pCsr = (Fts3Cursor *)pCursor; - sqlite3_value *pCons = 0; /* The MATCH or rowid constraint, if any */ - sqlite3_value *pLangid = 0; /* The "langid = ?" constraint, if any */ - sqlite3_value *pDocidGe = 0; /* The "docid >= ?" constraint, if any */ - sqlite3_value *pDocidLe = 0; /* The "docid <= ?" constraint, if any */ + tdsqlite3_value *pCons = 0; /* The MATCH or rowid constraint, if any */ + tdsqlite3_value *pLangid = 0; /* The "langid = ?" constraint, if any */ + tdsqlite3_value *pDocidGe = 0; /* The "docid >= ?" constraint, if any */ + tdsqlite3_value *pDocidLe = 0; /* The "docid <= ?" constraint, if any */ int iIdx; UNUSED_PARAMETER(idxStr); @@ -172697,17 +172697,17 @@ static int fts3FilterMethod( if( eSearch!=FTS3_DOCID_SEARCH && eSearch!=FTS3_FULLSCAN_SEARCH ){ int iCol = eSearch-FTS3_FULLTEXT_SEARCH; - const char *zQuery = (const char *)sqlite3_value_text(pCons); + const char *zQuery = (const char *)tdsqlite3_value_text(pCons); - if( zQuery==0 && sqlite3_value_type(pCons)!=SQLITE_NULL ){ + if( zQuery==0 && tdsqlite3_value_type(pCons)!=SQLITE_NULL ){ return SQLITE_NOMEM; } pCsr->iLangid = 0; - if( pLangid ) pCsr->iLangid = sqlite3_value_int(pLangid); + if( pLangid ) pCsr->iLangid = tdsqlite3_value_int(pLangid); assert( p->base.zErrMsg==0 ); - rc = sqlite3Fts3ExprParse(p->pTokenizer, pCsr->iLangid, + rc = tdsqlite3Fts3ExprParse(p->pTokenizer, pCsr->iLangid, p->azColumn, p->bFts4, p->nColumn, iCol, zQuery, -1, &pCsr->pExpr, &p->base.zErrMsg ); @@ -172716,7 +172716,7 @@ static int fts3FilterMethod( } rc = fts3EvalStart(pCsr); - sqlite3Fts3SegmentsClose(p); + tdsqlite3Fts3SegmentsClose(p); if( rc!=SQLITE_OK ) return rc; pCsr->pNextId = pCsr->aDoclist; pCsr->iPrevId = 0; @@ -172729,30 +172729,30 @@ static int fts3FilterMethod( */ if( eSearch==FTS3_FULLSCAN_SEARCH ){ if( pDocidGe || pDocidLe ){ - zSql = sqlite3_mprintf( + zSql = tdsqlite3_mprintf( "SELECT %s WHERE rowid BETWEEN %lld AND %lld ORDER BY rowid %s", p->zReadExprlist, pCsr->iMinDocid, pCsr->iMaxDocid, (pCsr->bDesc ? "DESC" : "ASC") ); }else{ - zSql = sqlite3_mprintf("SELECT %s ORDER BY rowid %s", + zSql = tdsqlite3_mprintf("SELECT %s ORDER BY rowid %s", p->zReadExprlist, (pCsr->bDesc ? "DESC" : "ASC") ); } if( zSql ){ p->bLock++; - rc = sqlite3_prepare_v3( + rc = tdsqlite3_prepare_v3( p->db,zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0 ); p->bLock--; - sqlite3_free(zSql); + tdsqlite3_free(zSql); }else{ rc = SQLITE_NOMEM; } }else if( eSearch==FTS3_DOCID_SEARCH ){ rc = fts3CursorSeekStmt(pCsr); if( rc==SQLITE_OK ){ - rc = sqlite3_bind_value(pCsr->pStmt, 1, pCons); + rc = tdsqlite3_bind_value(pCsr->pStmt, 1, pCons); } } if( rc!=SQLITE_OK ) return rc; @@ -172764,7 +172764,7 @@ static int fts3FilterMethod( ** This is the xEof method of the virtual table. SQLite calls this ** routine to find out if it has reached the end of a result set. */ -static int fts3EofMethod(sqlite3_vtab_cursor *pCursor){ +static int fts3EofMethod(tdsqlite3_vtab_cursor *pCursor){ Fts3Cursor *pCsr = (Fts3Cursor*)pCursor; if( pCsr->isEof ){ fts3ClearCursor(pCsr); @@ -172779,7 +172779,7 @@ static int fts3EofMethod(sqlite3_vtab_cursor *pCursor){ ** exposes %_content.docid as the rowid for the virtual table. The ** rowid should be written to *pRowid. */ -static int fts3RowidMethod(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ +static int fts3RowidMethod(tdsqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ Fts3Cursor *pCsr = (Fts3Cursor *) pCursor; *pRowid = pCsr->iPrevId; return SQLITE_OK; @@ -172797,8 +172797,8 @@ static int fts3RowidMethod(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ ** (iCol == p->nColumn+2) -> Langid column */ static int fts3ColumnMethod( - sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ - sqlite3_context *pCtx, /* Context for sqlite3_result_xxx() calls */ + tdsqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ + tdsqlite3_context *pCtx, /* Context for tdsqlite3_result_xxx() calls */ int iCol /* Index of column to read value from */ ){ int rc = SQLITE_OK; /* Return Code */ @@ -172811,20 +172811,20 @@ static int fts3ColumnMethod( switch( iCol-p->nColumn ){ case 0: /* The special 'table-name' column */ - sqlite3_result_pointer(pCtx, pCsr, "fts3cursor", 0); + tdsqlite3_result_pointer(pCtx, pCsr, "fts3cursor", 0); break; case 1: /* The docid column */ - sqlite3_result_int64(pCtx, pCsr->iPrevId); + tdsqlite3_result_int64(pCtx, pCsr->iPrevId); break; case 2: if( pCsr->pExpr ){ - sqlite3_result_int64(pCtx, pCsr->iLangid); + tdsqlite3_result_int64(pCtx, pCsr->iLangid); break; }else if( p->zLanguageid==0 ){ - sqlite3_result_int(pCtx, 0); + tdsqlite3_result_int(pCtx, 0); break; }else{ iCol = p->nColumn; @@ -172835,8 +172835,8 @@ static int fts3ColumnMethod( /* A user column. Or, if this is a full-table scan, possibly the ** language-id column. Seek the cursor. */ rc = fts3CursorSeek(0, pCsr); - if( rc==SQLITE_OK && sqlite3_data_count(pCsr->pStmt)-1>iCol ){ - sqlite3_result_value(pCtx, sqlite3_column_value(pCsr->pStmt, iCol+1)); + if( rc==SQLITE_OK && tdsqlite3_data_count(pCsr->pStmt)-1>iCol ){ + tdsqlite3_result_value(pCtx, tdsqlite3_column_value(pCsr->pStmt, iCol+1)); } break; } @@ -172851,19 +172851,19 @@ static int fts3ColumnMethod( ** inserted, updated or deleted. */ static int fts3UpdateMethod( - sqlite3_vtab *pVtab, /* Virtual table handle */ + tdsqlite3_vtab *pVtab, /* Virtual table handle */ int nArg, /* Size of argument array */ - sqlite3_value **apVal, /* Array of arguments */ + tdsqlite3_value **apVal, /* Array of arguments */ sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */ ){ - return sqlite3Fts3UpdateMethod(pVtab, nArg, apVal, pRowid); + return tdsqlite3Fts3UpdateMethod(pVtab, nArg, apVal, pRowid); } /* ** Implementation of xSync() method. Flush the contents of the pending-terms ** hash-table to the database. */ -static int fts3SyncMethod(sqlite3_vtab *pVtab){ +static int fts3SyncMethod(tdsqlite3_vtab *pVtab){ /* Following an incremental-merge operation, assuming that the input ** segments are not completely consumed (the usual case), they are updated @@ -172888,9 +172888,9 @@ static int fts3SyncMethod(sqlite3_vtab *pVtab){ Fts3Table *p = (Fts3Table*)pVtab; int rc; - i64 iLastRowid = sqlite3_last_insert_rowid(p->db); + i64 iLastRowid = tdsqlite3_last_insert_rowid(p->db); - rc = sqlite3Fts3PendingTermsFlush(p); + rc = tdsqlite3Fts3PendingTermsFlush(p); if( rc==SQLITE_OK && p->nLeafAdd>(nMinMerge/16) && p->nAutoincrmerge && p->nAutoincrmerge!=0xff @@ -172898,14 +172898,14 @@ static int fts3SyncMethod(sqlite3_vtab *pVtab){ int mxLevel = 0; /* Maximum relative level value in db */ int A; /* Incr-merge parameter A */ - rc = sqlite3Fts3MaxLevel(p, &mxLevel); + rc = tdsqlite3Fts3MaxLevel(p, &mxLevel); assert( rc==SQLITE_OK || mxLevel==0 ); A = p->nLeafAdd * mxLevel; A += (A/2); - if( A>(int)nMinMerge ) rc = sqlite3Fts3Incrmerge(p, A, p->nAutoincrmerge); + if( A>(int)nMinMerge ) rc = tdsqlite3Fts3Incrmerge(p, A, p->nAutoincrmerge); } - sqlite3Fts3SegmentsClose(p); - sqlite3_set_last_insert_rowid(p->db, iLastRowid); + tdsqlite3Fts3SegmentsClose(p); + tdsqlite3_set_last_insert_rowid(p->db, iLastRowid); return rc; } @@ -172918,10 +172918,10 @@ static int fts3SyncMethod(sqlite3_vtab *pVtab){ static int fts3SetHasStat(Fts3Table *p){ int rc = SQLITE_OK; if( p->bHasStat==2 ){ - char *zTbl = sqlite3_mprintf("%s_stat", p->zName); + char *zTbl = tdsqlite3_mprintf("%s_stat", p->zName); if( zTbl ){ - int res = sqlite3_table_column_metadata(p->db, p->zDb, zTbl, 0,0,0,0,0,0); - sqlite3_free(zTbl); + int res = tdsqlite3_table_column_metadata(p->db, p->zDb, zTbl, 0,0,0,0,0,0); + tdsqlite3_free(zTbl); p->bHasStat = (res==SQLITE_OK); }else{ rc = SQLITE_NOMEM; @@ -172933,7 +172933,7 @@ static int fts3SetHasStat(Fts3Table *p){ /* ** Implementation of xBegin() method. */ -static int fts3BeginMethod(sqlite3_vtab *pVtab){ +static int fts3BeginMethod(tdsqlite3_vtab *pVtab){ Fts3Table *p = (Fts3Table*)pVtab; UNUSED_PARAMETER(pVtab); assert( p->pSegments==0 ); @@ -172950,7 +172950,7 @@ static int fts3BeginMethod(sqlite3_vtab *pVtab){ ** the pending-terms hash-table have already been flushed into the database ** by fts3SyncMethod(). */ -static int fts3CommitMethod(sqlite3_vtab *pVtab){ +static int fts3CommitMethod(tdsqlite3_vtab *pVtab){ TESTONLY( Fts3Table *p = (Fts3Table*)pVtab ); UNUSED_PARAMETER(pVtab); assert( p->nPendingData==0 ); @@ -172965,9 +172965,9 @@ static int fts3CommitMethod(sqlite3_vtab *pVtab){ ** Implementation of xRollback(). Discard the contents of the pending-terms ** hash-table. Any changes made to the database are reverted by SQLite. */ -static int fts3RollbackMethod(sqlite3_vtab *pVtab){ +static int fts3RollbackMethod(tdsqlite3_vtab *pVtab){ Fts3Table *p = (Fts3Table*)pVtab; - sqlite3Fts3PendingTermsClear(p); + tdsqlite3Fts3PendingTermsClear(p); assert( p->inTransaction!=0 ); TESTONLY( p->inTransaction = 0 ); TESTONLY( p->mxSavepoint = -1; ); @@ -173024,19 +173024,19 @@ static void fts3ReversePoslist(char *pStart, char **ppPoslist){ ** string passed via zFunc is used as part of the error message. */ static int fts3FunctionArg( - sqlite3_context *pContext, /* SQL function call context */ + tdsqlite3_context *pContext, /* SQL function call context */ const char *zFunc, /* Function name */ - sqlite3_value *pVal, /* argv[0] passed to function */ + tdsqlite3_value *pVal, /* argv[0] passed to function */ Fts3Cursor **ppCsr /* OUT: Store cursor handle here */ ){ int rc; - *ppCsr = (Fts3Cursor*)sqlite3_value_pointer(pVal, "fts3cursor"); + *ppCsr = (Fts3Cursor*)tdsqlite3_value_pointer(pVal, "fts3cursor"); if( (*ppCsr)!=0 ){ rc = SQLITE_OK; }else{ - char *zErr = sqlite3_mprintf("illegal first argument to %s", zFunc); - sqlite3_result_error(pContext, zErr, -1); - sqlite3_free(zErr); + char *zErr = tdsqlite3_mprintf("illegal first argument to %s", zFunc); + tdsqlite3_result_error(pContext, zErr, -1); + tdsqlite3_free(zErr); rc = SQLITE_ERROR; } return rc; @@ -173046,9 +173046,9 @@ static int fts3FunctionArg( ** Implementation of the snippet() function for FTS3 */ static void fts3SnippetFunc( - sqlite3_context *pContext, /* SQLite function call context */ + tdsqlite3_context *pContext, /* SQLite function call context */ int nVal, /* Size of apVal[] array */ - sqlite3_value **apVal /* Array of arguments */ + tdsqlite3_value **apVal /* Array of arguments */ ){ Fts3Cursor *pCsr; /* Cursor handle passed through apVal[0] */ const char *zStart = ""; @@ -173063,25 +173063,25 @@ static void fts3SnippetFunc( assert( nVal>=1 ); if( nVal>6 ){ - sqlite3_result_error(pContext, + tdsqlite3_result_error(pContext, "wrong number of arguments to function snippet()", -1); return; } if( fts3FunctionArg(pContext, "snippet", apVal[0], &pCsr) ) return; switch( nVal ){ - case 6: nToken = sqlite3_value_int(apVal[5]); - case 5: iCol = sqlite3_value_int(apVal[4]); - case 4: zEllipsis = (const char*)sqlite3_value_text(apVal[3]); - case 3: zEnd = (const char*)sqlite3_value_text(apVal[2]); - case 2: zStart = (const char*)sqlite3_value_text(apVal[1]); + case 6: nToken = tdsqlite3_value_int(apVal[5]); + case 5: iCol = tdsqlite3_value_int(apVal[4]); + case 4: zEllipsis = (const char*)tdsqlite3_value_text(apVal[3]); + case 3: zEnd = (const char*)tdsqlite3_value_text(apVal[2]); + case 2: zStart = (const char*)tdsqlite3_value_text(apVal[1]); } if( !zEllipsis || !zEnd || !zStart ){ - sqlite3_result_error_nomem(pContext); + tdsqlite3_result_error_nomem(pContext); }else if( nToken==0 ){ - sqlite3_result_text(pContext, "", -1, SQLITE_STATIC); + tdsqlite3_result_text(pContext, "", -1, SQLITE_STATIC); }else if( SQLITE_OK==fts3CursorSeek(pContext, pCsr) ){ - sqlite3Fts3Snippet(pContext, pCsr, zStart, zEnd, zEllipsis, iCol, nToken); + tdsqlite3Fts3Snippet(pContext, pCsr, zStart, zEnd, zEllipsis, iCol, nToken); } } @@ -173089,9 +173089,9 @@ static void fts3SnippetFunc( ** Implementation of the offsets() function for FTS3 */ static void fts3OffsetsFunc( - sqlite3_context *pContext, /* SQLite function call context */ + tdsqlite3_context *pContext, /* SQLite function call context */ int nVal, /* Size of argument array */ - sqlite3_value **apVal /* Array of arguments */ + tdsqlite3_value **apVal /* Array of arguments */ ){ Fts3Cursor *pCsr; /* Cursor handle passed through apVal[0] */ @@ -173101,7 +173101,7 @@ static void fts3OffsetsFunc( if( fts3FunctionArg(pContext, "offsets", apVal[0], &pCsr) ) return; assert( pCsr ); if( SQLITE_OK==fts3CursorSeek(pContext, pCsr) ){ - sqlite3Fts3Offsets(pContext, pCsr); + tdsqlite3Fts3Offsets(pContext, pCsr); } } @@ -173115,9 +173115,9 @@ static void fts3OffsetsFunc( ** where 't' is the name of an FTS3 table. */ static void fts3OptimizeFunc( - sqlite3_context *pContext, /* SQLite function call context */ + tdsqlite3_context *pContext, /* SQLite function call context */ int nVal, /* Size of argument array */ - sqlite3_value **apVal /* Array of arguments */ + tdsqlite3_value **apVal /* Array of arguments */ ){ int rc; /* Return code */ Fts3Table *p; /* Virtual table handle */ @@ -173130,17 +173130,17 @@ static void fts3OptimizeFunc( p = (Fts3Table *)pCursor->base.pVtab; assert( p ); - rc = sqlite3Fts3Optimize(p); + rc = tdsqlite3Fts3Optimize(p); switch( rc ){ case SQLITE_OK: - sqlite3_result_text(pContext, "Index optimized", -1, SQLITE_STATIC); + tdsqlite3_result_text(pContext, "Index optimized", -1, SQLITE_STATIC); break; case SQLITE_DONE: - sqlite3_result_text(pContext, "Index already optimal", -1, SQLITE_STATIC); + tdsqlite3_result_text(pContext, "Index already optimal", -1, SQLITE_STATIC); break; default: - sqlite3_result_error_code(pContext, rc); + tdsqlite3_result_error_code(pContext, rc); break; } } @@ -173149,18 +173149,18 @@ static void fts3OptimizeFunc( ** Implementation of the matchinfo() function for FTS3 */ static void fts3MatchinfoFunc( - sqlite3_context *pContext, /* SQLite function call context */ + tdsqlite3_context *pContext, /* SQLite function call context */ int nVal, /* Size of argument array */ - sqlite3_value **apVal /* Array of arguments */ + tdsqlite3_value **apVal /* Array of arguments */ ){ Fts3Cursor *pCsr; /* Cursor handle passed through apVal[0] */ assert( nVal==1 || nVal==2 ); if( SQLITE_OK==fts3FunctionArg(pContext, "matchinfo", apVal[0], &pCsr) ){ const char *zArg = 0; if( nVal>1 ){ - zArg = (const char *)sqlite3_value_text(apVal[1]); + zArg = (const char *)tdsqlite3_value_text(apVal[1]); } - sqlite3Fts3Matchinfo(pContext, pCsr, zArg); + tdsqlite3Fts3Matchinfo(pContext, pCsr, zArg); } } @@ -173169,15 +173169,15 @@ static void fts3MatchinfoFunc( ** virtual table. */ static int fts3FindFunctionMethod( - sqlite3_vtab *pVtab, /* Virtual table handle */ + tdsqlite3_vtab *pVtab, /* Virtual table handle */ int nArg, /* Number of SQL function arguments */ const char *zName, /* Name of SQL function */ - void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), /* OUT: Result */ + void (**pxFunc)(tdsqlite3_context*,int,tdsqlite3_value**), /* OUT: Result */ void **ppArg /* Unused */ ){ struct Overloaded { const char *zName; - void (*xFunc)(sqlite3_context*,int,sqlite3_value**); + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**); } aOverload[] = { { "snippet", fts3SnippetFunc }, { "offsets", fts3OffsetsFunc }, @@ -173205,11 +173205,11 @@ static int fts3FindFunctionMethod( ** Implementation of FTS3 xRename method. Rename an fts3 table. */ static int fts3RenameMethod( - sqlite3_vtab *pVtab, /* Virtual table handle */ + tdsqlite3_vtab *pVtab, /* Virtual table handle */ const char *zName /* New name of table */ ){ Fts3Table *p = (Fts3Table *)pVtab; - sqlite3 *db = p->db; /* Database connection */ + tdsqlite3 *db = p->db; /* Database connection */ int rc; /* Return Code */ /* At this point it must be known if the %_stat table exists or not. @@ -173224,7 +173224,7 @@ static int fts3RenameMethod( */ assert( p->nPendingData==0 ); if( rc==SQLITE_OK ){ - rc = sqlite3Fts3PendingTermsFlush(p); + rc = tdsqlite3Fts3PendingTermsFlush(p); } if( p->zContentTbl==0 ){ @@ -173262,7 +173262,7 @@ static int fts3RenameMethod( ** ** Flush the contents of the pending-terms table to disk. */ -static int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ +static int fts3SavepointMethod(tdsqlite3_vtab *pVtab, int iSavepoint){ int rc = SQLITE_OK; UNUSED_PARAMETER(iSavepoint); assert( ((Fts3Table *)pVtab)->inTransaction ); @@ -173279,7 +173279,7 @@ static int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ ** ** This is a no-op. */ -static int fts3ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ +static int fts3ReleaseMethod(tdsqlite3_vtab *pVtab, int iSavepoint){ TESTONLY( Fts3Table *p = (Fts3Table*)pVtab ); UNUSED_PARAMETER(iSavepoint); UNUSED_PARAMETER(pVtab); @@ -173294,12 +173294,12 @@ static int fts3ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ ** ** Discard the contents of the pending terms table. */ -static int fts3RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){ +static int fts3RollbackToMethod(tdsqlite3_vtab *pVtab, int iSavepoint){ Fts3Table *p = (Fts3Table*)pVtab; UNUSED_PARAMETER(iSavepoint); assert( p->inTransaction ); TESTONLY( p->mxSavepoint = iSavepoint ); - sqlite3Fts3PendingTermsClear(p); + tdsqlite3Fts3PendingTermsClear(p); return SQLITE_OK; } @@ -173313,12 +173313,12 @@ static int fts3ShadowName(const char *zName){ }; unsigned int i; for(i=0; idoclist.aAll/nAll. ** ** This function assumes that pList points to a buffer allocated using -** sqlite3_malloc(). This function takes responsibility for eventually +** tdsqlite3_malloc(). This function takes responsibility for eventually ** freeing the buffer. ** ** SQLITE_OK is returned if successful, or SQLITE_NOMEM if an error occurs. @@ -173544,7 +173544,7 @@ static int fts3EvalPhraseMergeToken( assert( iToken!=p->iDoclistToken ); if( pList==0 ){ - sqlite3_free(p->doclist.aAll); + tdsqlite3_free(p->doclist.aAll); p->doclist.aAll = 0; p->doclist.nAll = 0; } @@ -173555,7 +173555,7 @@ static int fts3EvalPhraseMergeToken( } else if( p->doclist.aAll==0 ){ - sqlite3_free(pList); + tdsqlite3_free(pList); } else { @@ -173582,7 +173582,7 @@ static int fts3EvalPhraseMergeToken( rc = fts3DoclistPhraseMerge( pTab->bDescIdx, nDiff, pLeft, nLeft, &pRight, &nRight ); - sqlite3_free(pLeft); + tdsqlite3_free(pLeft); p->doclist.aAll = pRight; p->doclist.nAll = nRight; } @@ -173649,11 +173649,11 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){ if( pDeferred ){ char *pList; int nList; - int rc = sqlite3Fts3DeferredTokenList(pDeferred, &pList, &nList); + int rc = tdsqlite3Fts3DeferredTokenList(pDeferred, &pList, &nList); if( rc!=SQLITE_OK ) return rc; if( pList==0 ){ - sqlite3_free(aPoslist); + tdsqlite3_free(aPoslist); pPhrase->doclist.pList = 0; pPhrase->doclist.nList = 0; return SQLITE_OK; @@ -173669,11 +173669,11 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){ assert( iPrev>=0 ); fts3PoslistPhraseMerge(&aOut, iToken-iPrev, 0, 1, &p1, &p2); - sqlite3_free(aPoslist); + tdsqlite3_free(aPoslist); aPoslist = pList; nPoslist = (int)(aOut - aPoslist); if( nPoslist==0 ){ - sqlite3_free(aPoslist); + tdsqlite3_free(aPoslist); pPhrase->doclist.pList = 0; pPhrase->doclist.nList = 0; return SQLITE_OK; @@ -173706,9 +173706,9 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){ nDistance = iPrev - nMaxUndeferred; } - aOut = (char *)sqlite3_malloc(nPoslist+8); + aOut = (char *)tdsqlite3_malloc(nPoslist+8); if( !aOut ){ - sqlite3_free(aPoslist); + tdsqlite3_free(aPoslist); return SQLITE_NOMEM; } @@ -173717,11 +173717,11 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){ pPhrase->doclist.bFreeList = 1; pPhrase->doclist.nList = (int)(aOut - pPhrase->doclist.pList); }else{ - sqlite3_free(aOut); + tdsqlite3_free(aOut); pPhrase->doclist.pList = 0; pPhrase->doclist.nList = 0; } - sqlite3_free(aPoslist); + tdsqlite3_free(aPoslist); } } @@ -173780,7 +173780,7 @@ static int fts3EvalPhraseStart(Fts3Cursor *pCsr, int bOptOk, Fts3Phrase *p){ Fts3PhraseToken *pToken = &p->aToken[i]; Fts3MultiSegReader *pSegcsr = pToken->pSegcsr; if( pSegcsr ){ - rc = sqlite3Fts3MsrIncrStart(pTab, pSegcsr, iCol, pToken->z, pToken->n); + rc = tdsqlite3Fts3MsrIncrStart(pTab, pSegcsr, iCol, pToken->z, pToken->n); } } p->bIncr = 1; @@ -173804,12 +173804,12 @@ static int fts3EvalPhraseStart(Fts3Cursor *pCsr, int bOptOk, Fts3Phrase *p){ ** descending (parameter bDescIdx==1) order of docid. Regardless, this ** function iterates from the end of the doclist to the beginning. */ -SQLITE_PRIVATE void sqlite3Fts3DoclistPrev( +SQLITE_PRIVATE void tdsqlite3Fts3DoclistPrev( int bDescIdx, /* True if the doclist is desc */ char *aDoclist, /* Pointer to entire doclist */ int nDoclist, /* Length of aDoclist in bytes */ char **ppIter, /* IN/OUT: Iterator pointer */ - sqlite3_int64 *piDocid, /* IN/OUT: Docid pointer */ + tdsqlite3_int64 *piDocid, /* IN/OUT: Docid pointer */ int *pnList, /* OUT: List length pointer */ u8 *pbEof /* OUT: End-of-file flag */ ){ @@ -173821,15 +173821,15 @@ SQLITE_PRIVATE void sqlite3Fts3DoclistPrev( assert( !p || (p>aDoclist && p<&aDoclist[nDoclist]) ); if( p==0 ){ - sqlite3_int64 iDocid = 0; + tdsqlite3_int64 iDocid = 0; char *pNext = 0; char *pDocid = aDoclist; char *pEnd = &aDoclist[nDoclist]; int iMul = 1; while( pDocid=&aDoclist[nDoclist] ){ *pbEof = 1; }else{ - sqlite3_int64 iVar; - p += sqlite3Fts3GetVarint(p, &iVar); + tdsqlite3_int64 iVar; + p += tdsqlite3Fts3GetVarint(p, &iVar); *piDocid += ((bDescIdx ? -1 : 1) * iVar); } } @@ -173916,8 +173916,8 @@ static void fts3EvalDlPhraseNext( /* We have already reached the end of this doclist. EOF. */ *pbEof = 1; }else{ - sqlite3_int64 iDelta; - pIter += sqlite3Fts3GetVarint(pIter, &iDelta); + tdsqlite3_int64 iDelta; + pIter += tdsqlite3Fts3GetVarint(pIter, &iDelta); if( pTab->bDescIdx==0 || pDL->pNextDocid==0 ){ pDL->iDocid += iDelta; }else{ @@ -173947,7 +173947,7 @@ static void fts3EvalDlPhraseNext( typedef struct TokenDoclist TokenDoclist; struct TokenDoclist { int bIgnore; - sqlite3_int64 iDocid; + tdsqlite3_int64 iDocid; char *pList; int nList; }; @@ -173983,7 +173983,7 @@ static int incrPhraseTokenNext( assert( pToken->pSegcsr || pPhrase->iDoclistToken>=0 ); if( pToken->pSegcsr ){ assert( p->bIgnore==0 ); - rc = sqlite3Fts3MsrIncrNext( + rc = tdsqlite3Fts3MsrIncrNext( pTab, pToken->pSegcsr, &p->iDocid, &p->pList, &p->nList ); if( p->pList==0 ) *pbEof = 1; @@ -174028,7 +174028,7 @@ static int fts3EvalIncrPhraseNext( assert( p->bIncr==1 ); if( p->nToken==1 ){ - rc = sqlite3Fts3MsrIncrNext(pTab, p->aToken[0].pSegcsr, + rc = tdsqlite3Fts3MsrIncrNext(pTab, p->aToken[0].pSegcsr, &pDL->iDocid, &pDL->pList, &pDL->nList ); if( pDL->pList==0 ) bEof = 1; @@ -174042,7 +174042,7 @@ static int fts3EvalIncrPhraseNext( while( bEof==0 ){ int bMaxSet = 0; - sqlite3_int64 iMax = 0; /* Largest docid for all iterators */ + tdsqlite3_int64 iMax = 0; /* Largest docid for all iterators */ int i; /* Used to iterate through tokens */ /* Advance the iterator for each token in the phrase once. */ @@ -174073,7 +174073,7 @@ static int fts3EvalIncrPhraseNext( if( bEof==0 ){ int nList = 0; int nByte = a[p->nToken-1].nList; - char *aDoclist = sqlite3_malloc(nByte+FTS3_BUFFER_PADDING); + char *aDoclist = tdsqlite3_malloc(nByte+FTS3_BUFFER_PADDING); if( !aDoclist ) return SQLITE_NOMEM; memcpy(aDoclist, a[p->nToken-1].pList, nByte+1); memset(&aDoclist[nByte], 0, FTS3_BUFFER_PADDING); @@ -174096,7 +174096,7 @@ static int fts3EvalIncrPhraseNext( pDL->bFreeList = 1; break; } - sqlite3_free(aDoclist); + tdsqlite3_free(aDoclist); } } } @@ -174126,7 +174126,7 @@ static int fts3EvalPhraseNext( if( p->bIncr ){ rc = fts3EvalIncrPhraseNext(pCsr, p, pbEof); }else if( pCsr->bDesc!=pTab->bDescIdx && pDL->nAll ){ - sqlite3Fts3DoclistPrev(pTab->bDescIdx, pDL->aAll, pDL->nAll, + tdsqlite3Fts3DoclistPrev(pTab->bDescIdx, pDL->aAll, pDL->nAll, &pDL->pNextDocid, &pDL->iDocid, &pDL->nList, pbEof ); pDL->pList = pDL->pNextDocid; @@ -174225,7 +174225,7 @@ static void fts3EvalTokenCosts( pTC->pRoot = pRoot; pTC->pToken = &pPhrase->aToken[i]; pTC->iCol = pPhrase->iColumn; - *pRc = sqlite3Fts3MsrOvfl(pCsr, pTC->pToken->pSegcsr, &pTC->nOvfl); + *pRc = tdsqlite3Fts3MsrOvfl(pCsr, pTC->pToken->pSegcsr, &pTC->nOvfl); } }else if( pExpr->eType!=FTSQUERY_NOT ){ assert( pExpr->eType==FTSQUERY_OR @@ -174275,32 +174275,32 @@ static int fts3EvalAverageDocsize(Fts3Cursor *pCsr, int *pnPage){ ** to right. */ Fts3Table *p = (Fts3Table*)pCsr->base.pVtab; - sqlite3_stmt *pStmt; - sqlite3_int64 nDoc = 0; - sqlite3_int64 nByte = 0; + tdsqlite3_stmt *pStmt; + tdsqlite3_int64 nDoc = 0; + tdsqlite3_int64 nByte = 0; const char *pEnd; const char *a; - rc = sqlite3Fts3SelectDoctotal(p, &pStmt); + rc = tdsqlite3Fts3SelectDoctotal(p, &pStmt); if( rc!=SQLITE_OK ) return rc; - a = sqlite3_column_blob(pStmt, 0); + a = tdsqlite3_column_blob(pStmt, 0); testcase( a==0 ); /* If %_stat.value set to X'' */ if( a ){ - pEnd = &a[sqlite3_column_bytes(pStmt, 0)]; - a += sqlite3Fts3GetVarintBounded(a, pEnd, &nDoc); + pEnd = &a[tdsqlite3_column_bytes(pStmt, 0)]; + a += tdsqlite3Fts3GetVarintBounded(a, pEnd, &nDoc); while( anDoc = nDoc; pCsr->nRowAvg = (int)(((nByte / nDoc) + p->nPgsz) / p->nPgsz); assert( pCsr->nRowAvg>0 ); - rc = sqlite3_reset(pStmt); + rc = tdsqlite3_reset(pStmt); } *pnPage = pCsr->nRowAvg; @@ -174317,7 +174317,7 @@ static int fts3EvalAverageDocsize(Fts3Cursor *pCsr, int *pnPage){ ** the cluster with root node pRoot. See comments above the definition ** of struct Fts3TokenAndCost for more details. ** -** If no error occurs, SQLITE_OK is returned and sqlite3Fts3DeferToken() +** If no error occurs, SQLITE_OK is returned and tdsqlite3Fts3DeferToken() ** called on each token to defer. Otherwise, an SQLite error code is ** returned. */ @@ -174404,7 +174404,7 @@ static int fts3EvalSelectDeferred( ** that will be loaded if all subsequent tokens are deferred. */ Fts3PhraseToken *pToken = pTC->pToken; - rc = sqlite3Fts3DeferToken(pCsr, pToken, pTC->iCol); + rc = tdsqlite3Fts3DeferToken(pCsr, pToken, pTC->iCol); fts3SegReaderCursorFree(pToken->pSegcsr); pToken->pSegcsr = 0; }else{ @@ -174468,7 +174468,7 @@ static int fts3EvalStart(Fts3Cursor *pCsr){ if( rc==SQLITE_OK && nToken>1 && pTab->bFts4 ){ Fts3TokenAndCost *aTC; Fts3Expr **apOr; - aTC = (Fts3TokenAndCost *)sqlite3_malloc64( + aTC = (Fts3TokenAndCost *)tdsqlite3_malloc64( sizeof(Fts3TokenAndCost) * nToken + sizeof(Fts3Expr *) * nOr * 2 ); @@ -174492,7 +174492,7 @@ static int fts3EvalStart(Fts3Cursor *pCsr){ } } - sqlite3_free(aTC); + tdsqlite3_free(aTC); } } #endif @@ -174506,7 +174506,7 @@ static int fts3EvalStart(Fts3Cursor *pCsr){ */ static void fts3EvalInvalidatePoslist(Fts3Phrase *pPhrase){ if( pPhrase->doclist.bFreeList ){ - sqlite3_free(pPhrase->doclist.pList); + tdsqlite3_free(pPhrase->doclist.pList); } pPhrase->doclist.pList = 0; pPhrase->doclist.nList = 0; @@ -174606,7 +174606,7 @@ static int fts3EvalNearTrim( ** 2. NEAR is treated as AND. If the expression is "x NEAR y", it is ** advanced to point to the next row that matches "x AND y". ** -** See sqlite3Fts3EvalTestDeferred() for details on testing if a row is +** See tdsqlite3Fts3EvalTestDeferred() for details on testing if a row is ** really a match, taking into account deferred tokens and NEAR operators. */ static void fts3EvalNextRow( @@ -174643,7 +174643,7 @@ static void fts3EvalNextRow( fts3EvalNextRow(pCsr, pLeft, pRc); fts3EvalNextRow(pCsr, pRight, pRc); while( !pLeft->bEof && !pRight->bEof && *pRc==SQLITE_OK ){ - sqlite3_int64 iDiff = DOCID_CMP(pLeft->iDocid, pRight->iDocid); + tdsqlite3_int64 iDiff = DOCID_CMP(pLeft->iDocid, pRight->iDocid); if( iDiff==0 ) break; if( iDiff<0 ){ fts3EvalNextRow(pCsr, pLeft, pRc); @@ -174677,7 +174677,7 @@ static void fts3EvalNextRow( case FTSQUERY_OR: { Fts3Expr *pLeft = pExpr->pLeft; Fts3Expr *pRight = pExpr->pRight; - sqlite3_int64 iCmp = DOCID_CMP(pLeft->iDocid, pRight->iDocid); + tdsqlite3_int64 iCmp = DOCID_CMP(pLeft->iDocid, pRight->iDocid); assert( pLeft->bStart || pLeft->iDocid==pRight->iDocid ); assert( pRight->bStart || pLeft->iDocid==pRight->iDocid ); @@ -174779,7 +174779,7 @@ static int fts3EvalNearTest(Fts3Expr *pExpr, int *pRc){ && (pExpr->pParent==0 || pExpr->pParent->eType!=FTSQUERY_NEAR) ){ Fts3Expr *p; - sqlite3_int64 nTmp = 0; /* Bytes of temp space */ + tdsqlite3_int64 nTmp = 0; /* Bytes of temp space */ char *aTmp; /* Temp space for PoslistNearMerge() */ /* Allocate temporary working space. */ @@ -174788,7 +174788,7 @@ static int fts3EvalNearTest(Fts3Expr *pExpr, int *pRc){ nTmp += p->pRight->pPhrase->doclist.nList; } nTmp += p->pPhrase->doclist.nList; - aTmp = sqlite3_malloc64(nTmp*2); + aTmp = tdsqlite3_malloc64(nTmp*2); if( !aTmp ){ *pRc = SQLITE_NOMEM; res = 0; @@ -174816,14 +174816,14 @@ static int fts3EvalNearTest(Fts3Expr *pExpr, int *pRc){ } } - sqlite3_free(aTmp); + tdsqlite3_free(aTmp); } return res; } /* -** This function is a helper function for sqlite3Fts3EvalTestDeferred(). +** This function is a helper function for tdsqlite3Fts3EvalTestDeferred(). ** Assuming no error occurs or has occurred, It returns non-zero if the ** expression passed as the second argument matches the row that pCsr ** currently points to, or zero if it does not. @@ -174944,7 +174944,7 @@ static int fts3EvalTestExpr( ** Or, if no error occurs and it seems the current row does match the FTS ** query, return 0. */ -SQLITE_PRIVATE int sqlite3Fts3EvalTestDeferred(Fts3Cursor *pCsr, int *pRc){ +SQLITE_PRIVATE int tdsqlite3Fts3EvalTestDeferred(Fts3Cursor *pCsr, int *pRc){ int rc = *pRc; int bMiss = 0; if( rc==SQLITE_OK ){ @@ -174958,13 +174958,13 @@ SQLITE_PRIVATE int sqlite3Fts3EvalTestDeferred(Fts3Cursor *pCsr, int *pRc){ if( pCsr->pDeferred ){ rc = fts3CursorSeek(0, pCsr); if( rc==SQLITE_OK ){ - rc = sqlite3Fts3CacheDeferredDoclists(pCsr); + rc = tdsqlite3Fts3CacheDeferredDoclists(pCsr); } } bMiss = (0==fts3EvalTestExpr(pCsr, pCsr->pExpr, &rc)); /* Free the position-lists accumulated for each deferred token above. */ - sqlite3Fts3FreeDeferredDoclists(pCsr); + tdsqlite3Fts3FreeDeferredDoclists(pCsr); *pRc = rc; } return (rc==SQLITE_OK && bMiss); @@ -174983,15 +174983,15 @@ static int fts3EvalNext(Fts3Cursor *pCsr){ }else{ do { if( pCsr->isRequireSeek==0 ){ - sqlite3_reset(pCsr->pStmt); + tdsqlite3_reset(pCsr->pStmt); } - assert( sqlite3_data_count(pCsr->pStmt)==0 ); + assert( tdsqlite3_data_count(pCsr->pStmt)==0 ); fts3EvalNextRow(pCsr, pExpr, &rc); pCsr->isEof = pExpr->bEof; pCsr->isRequireSeek = 1; pCsr->isMatchinfoNeeded = 1; pCsr->iPrevId = pExpr->iDocid; - }while( pCsr->isEof==0 && sqlite3Fts3EvalTestDeferred(pCsr, &rc) ); + }while( pCsr->isEof==0 && tdsqlite3Fts3EvalTestDeferred(pCsr, &rc) ); } /* Check if the cursor is past the end of the docid range specified @@ -175031,7 +175031,7 @@ static void fts3EvalRestart( Fts3PhraseToken *pToken = &pPhrase->aToken[i]; assert( pToken->pDeferred==0 ); if( pToken->pSegcsr ){ - sqlite3Fts3MsrIncrRestart(pToken->pSegcsr); + tdsqlite3Fts3MsrIncrRestart(pToken->pSegcsr); } } *pRc = fts3EvalPhraseStart(pCsr, 0, pPhrase); @@ -175112,8 +175112,8 @@ static int fts3EvalGatherStats( Fts3Expr *pRoot; /* Root of NEAR expression */ Fts3Expr *p; /* Iterator used for several purposes */ - sqlite3_int64 iPrevId = pCsr->iPrevId; - sqlite3_int64 iDocid; + tdsqlite3_int64 iPrevId = pCsr->iPrevId; + tdsqlite3_int64 iDocid; u8 bEof; /* Find the root of the NEAR expression */ @@ -175129,7 +175129,7 @@ static int fts3EvalGatherStats( for(p=pRoot; p; p=p->pLeft){ Fts3Expr *pE = (p->eType==FTSQUERY_PHRASE?p:p->pRight); assert( pE->aMI==0 ); - pE->aMI = (u32 *)sqlite3_malloc64(pTab->nColumn * 3 * sizeof(u32)); + pE->aMI = (u32 *)tdsqlite3_malloc64(pTab->nColumn * 3 * sizeof(u32)); if( !pE->aMI ) return SQLITE_NOMEM; memset(pE->aMI, 0, pTab->nColumn * 3 * sizeof(u32)); } @@ -175140,8 +175140,8 @@ static int fts3EvalGatherStats( do { /* Ensure the %_content statement is reset. */ - if( pCsr->isRequireSeek==0 ) sqlite3_reset(pCsr->pStmt); - assert( sqlite3_data_count(pCsr->pStmt)==0 ); + if( pCsr->isRequireSeek==0 ) tdsqlite3_reset(pCsr->pStmt); + assert( tdsqlite3_data_count(pCsr->pStmt)==0 ); /* Advance to the next document */ fts3EvalNextRow(pCsr, pRoot, &rc); @@ -175151,7 +175151,7 @@ static int fts3EvalGatherStats( pCsr->iPrevId = pRoot->iDocid; }while( pCsr->isEof==0 && pRoot->eType==FTSQUERY_NEAR - && sqlite3Fts3EvalTestDeferred(pCsr, &rc) + && tdsqlite3Fts3EvalTestDeferred(pCsr, &rc) ); if( rc==SQLITE_OK && pCsr->isEof==0 ){ @@ -175211,7 +175211,7 @@ static int fts3EvalGatherStats( ** * If the phrase is part of a NEAR expression, then only phrase instances ** that meet the NEAR constraint are included in the counts. */ -SQLITE_PRIVATE int sqlite3Fts3EvalPhraseStats( +SQLITE_PRIVATE int tdsqlite3Fts3EvalPhraseStats( Fts3Cursor *pCsr, /* FTS cursor handle */ Fts3Expr *pExpr, /* Phrase expression */ u32 *aiOut /* Array to write results into (see above) */ @@ -175259,7 +175259,7 @@ SQLITE_PRIVATE int sqlite3Fts3EvalPhraseStats( ** This function works regardless of whether or not the phrase is deferred, ** incremental, or neither. */ -SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist( +SQLITE_PRIVATE int tdsqlite3Fts3EvalPhrasePoslist( Fts3Cursor *pCsr, /* FTS3 cursor object */ Fts3Expr *pExpr, /* Phrase to return doclist for */ int iCol, /* Column to return position list for */ @@ -175269,7 +175269,7 @@ SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist( Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; char *pIter; int iThis; - sqlite3_int64 iDocid; + tdsqlite3_int64 iDocid; /* If this phrase is applies specifically to some column other than ** column iCol, return a NULL pointer. */ @@ -175338,7 +175338,7 @@ SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist( bEof = !pPh->doclist.nAll || (pIter >= (pPh->doclist.aAll + pPh->doclist.nAll)); while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){ - sqlite3Fts3DoclistNext( + tdsqlite3Fts3DoclistNext( bDescDoclist, pPh->doclist.aAll, pPh->doclist.nAll, &pIter, &iDocid, &bEof ); @@ -175347,7 +175347,7 @@ SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist( bEof = !pPh->doclist.nAll || (pIter && pIter<=pPh->doclist.aAll); while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){ int dummy; - sqlite3Fts3DoclistPrev( + tdsqlite3Fts3DoclistPrev( bDescDoclist, pPh->doclist.aAll, pPh->doclist.nAll, &pIter, &iDocid, &dummy, &bEof ); @@ -175393,10 +175393,10 @@ SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist( ** * the contents of pPhrase->doclist, and ** * any Fts3MultiSegReader objects held by phrase tokens. */ -SQLITE_PRIVATE void sqlite3Fts3EvalPhraseCleanup(Fts3Phrase *pPhrase){ +SQLITE_PRIVATE void tdsqlite3Fts3EvalPhraseCleanup(Fts3Phrase *pPhrase){ if( pPhrase ){ int i; - sqlite3_free(pPhrase->doclist.aAll); + tdsqlite3_free(pPhrase->doclist.aAll); fts3EvalInvalidatePoslist(pPhrase); memset(&pPhrase->doclist, 0, sizeof(Fts3Doclist)); for(i=0; inToken; i++){ @@ -175411,7 +175411,7 @@ SQLITE_PRIVATE void sqlite3Fts3EvalPhraseCleanup(Fts3Phrase *pPhrase){ ** Return SQLITE_CORRUPT_VTAB. */ #ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3Fts3Corrupt(){ +SQLITE_PRIVATE int tdsqlite3Fts3Corrupt(){ return SQLITE_CORRUPT_VTAB; } #endif @@ -175423,13 +175423,13 @@ SQLITE_PRIVATE int sqlite3Fts3Corrupt(){ #ifdef _WIN32 __declspec(dllexport) #endif -SQLITE_API int sqlite3_fts3_init( - sqlite3 *db, +SQLITE_API int tdsqlite3_fts3_init( + tdsqlite3 *db, char **pzErrMsg, - const sqlite3_api_routines *pApi + const tdsqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi) - return sqlite3Fts3Init(db); + return tdsqlite3Fts3Init(db); } #endif @@ -175460,25 +175460,25 @@ typedef struct Fts3auxTable Fts3auxTable; typedef struct Fts3auxCursor Fts3auxCursor; struct Fts3auxTable { - sqlite3_vtab base; /* Base class used by SQLite core */ + tdsqlite3_vtab base; /* Base class used by SQLite core */ Fts3Table *pFts3Tab; }; struct Fts3auxCursor { - sqlite3_vtab_cursor base; /* Base class used by SQLite core */ + tdsqlite3_vtab_cursor base; /* Base class used by SQLite core */ Fts3MultiSegReader csr; /* Must be right after "base" */ Fts3SegFilter filter; char *zStop; int nStop; /* Byte-length of string zStop */ int iLangid; /* Language id to query */ int isEof; /* True if cursor is at EOF */ - sqlite3_int64 iRowid; /* Current rowid */ + tdsqlite3_int64 iRowid; /* Current rowid */ int iCol; /* Current value of 'col' column */ int nStat; /* Size of aStat[] array */ struct Fts3auxColstats { - sqlite3_int64 nDoc; /* 'documents' values for current csr row */ - sqlite3_int64 nOcc; /* 'occurrences' values for current csr row */ + tdsqlite3_int64 nDoc; /* 'documents' values for current csr row */ + tdsqlite3_int64 nOcc; /* 'occurrences' values for current csr row */ } *aStat; }; @@ -175494,18 +175494,18 @@ struct Fts3auxCursor { ** and xCreate are identical operations. */ static int fts3auxConnectMethod( - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ void *pUnused, /* Unused */ int argc, /* Number of elements in argv array */ const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ - char **pzErr /* OUT: sqlite3_malloc'd error message */ + tdsqlite3_vtab **ppVtab, /* OUT: New tdsqlite3_vtab object */ + char **pzErr /* OUT: tdsqlite3_malloc'd error message */ ){ char const *zDb; /* Name of database (e.g. "main") */ char const *zFts3; /* Name of fts3 table */ int nDb; /* Result of strlen(zDb) */ int nFts3; /* Result of strlen(zFts3) */ - sqlite3_int64 nByte; /* Bytes of space to allocate here */ + tdsqlite3_int64 nByte; /* Bytes of space to allocate here */ int rc; /* value returned by declare_vtab() */ Fts3auxTable *p; /* Virtual table object to return */ @@ -175521,7 +175521,7 @@ static int fts3auxConnectMethod( zDb = argv[1]; nDb = (int)strlen(zDb); if( argc==5 ){ - if( nDb==4 && 0==sqlite3_strnicmp("temp", zDb, 4) ){ + if( nDb==4 && 0==tdsqlite3_strnicmp("temp", zDb, 4) ){ zDb = argv[3]; nDb = (int)strlen(zDb); zFts3 = argv[4]; @@ -175533,11 +175533,11 @@ static int fts3auxConnectMethod( } nFts3 = (int)strlen(zFts3); - rc = sqlite3_declare_vtab(db, FTS3_AUX_SCHEMA); + rc = tdsqlite3_declare_vtab(db, FTS3_AUX_SCHEMA); if( rc!=SQLITE_OK ) return rc; nByte = sizeof(Fts3auxTable) + sizeof(Fts3Table) + nDb + nFts3 + 2; - p = (Fts3auxTable *)sqlite3_malloc64(nByte); + p = (Fts3auxTable *)tdsqlite3_malloc64(nByte); if( !p ) return SQLITE_NOMEM; memset(p, 0, nByte); @@ -175549,13 +175549,13 @@ static int fts3auxConnectMethod( memcpy((char *)p->pFts3Tab->zDb, zDb, nDb); memcpy((char *)p->pFts3Tab->zName, zFts3, nFts3); - sqlite3Fts3Dequote((char *)p->pFts3Tab->zName); + tdsqlite3Fts3Dequote((char *)p->pFts3Tab->zName); - *ppVtab = (sqlite3_vtab *)p; + *ppVtab = (tdsqlite3_vtab *)p; return SQLITE_OK; bad_args: - sqlite3Fts3ErrMsg(pzErr, "invalid arguments to fts4aux constructor"); + tdsqlite3Fts3ErrMsg(pzErr, "invalid arguments to fts4aux constructor"); return SQLITE_ERROR; } @@ -175564,17 +175564,17 @@ static int fts3auxConnectMethod( ** These tables have no persistent representation of their own, so xDisconnect ** and xDestroy are identical operations. */ -static int fts3auxDisconnectMethod(sqlite3_vtab *pVtab){ +static int fts3auxDisconnectMethod(tdsqlite3_vtab *pVtab){ Fts3auxTable *p = (Fts3auxTable *)pVtab; Fts3Table *pFts3 = p->pFts3Tab; int i; /* Free any prepared statements held */ for(i=0; iaStmt); i++){ - sqlite3_finalize(pFts3->aStmt[i]); + tdsqlite3_finalize(pFts3->aStmt[i]); } - sqlite3_free(pFts3->zSegmentsTbl); - sqlite3_free(p); + tdsqlite3_free(pFts3->zSegmentsTbl); + tdsqlite3_free(p); return SQLITE_OK; } @@ -175586,8 +175586,8 @@ static int fts3auxDisconnectMethod(sqlite3_vtab *pVtab){ ** xBestIndex - Analyze a WHERE and ORDER BY clause. */ static int fts3auxBestIndexMethod( - sqlite3_vtab *pVTab, - sqlite3_index_info *pInfo + tdsqlite3_vtab *pVTab, + tdsqlite3_index_info *pInfo ){ int i; int iEq = -1; @@ -175655,39 +175655,39 @@ static int fts3auxBestIndexMethod( /* ** xOpen - Open a cursor. */ -static int fts3auxOpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){ +static int fts3auxOpenMethod(tdsqlite3_vtab *pVTab, tdsqlite3_vtab_cursor **ppCsr){ Fts3auxCursor *pCsr; /* Pointer to cursor object to return */ UNUSED_PARAMETER(pVTab); - pCsr = (Fts3auxCursor *)sqlite3_malloc(sizeof(Fts3auxCursor)); + pCsr = (Fts3auxCursor *)tdsqlite3_malloc(sizeof(Fts3auxCursor)); if( !pCsr ) return SQLITE_NOMEM; memset(pCsr, 0, sizeof(Fts3auxCursor)); - *ppCsr = (sqlite3_vtab_cursor *)pCsr; + *ppCsr = (tdsqlite3_vtab_cursor *)pCsr; return SQLITE_OK; } /* ** xClose - Close a cursor. */ -static int fts3auxCloseMethod(sqlite3_vtab_cursor *pCursor){ +static int fts3auxCloseMethod(tdsqlite3_vtab_cursor *pCursor){ Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab; Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor; - sqlite3Fts3SegmentsClose(pFts3); - sqlite3Fts3SegReaderFinish(&pCsr->csr); - sqlite3_free((void *)pCsr->filter.zTerm); - sqlite3_free(pCsr->zStop); - sqlite3_free(pCsr->aStat); - sqlite3_free(pCsr); + tdsqlite3Fts3SegmentsClose(pFts3); + tdsqlite3Fts3SegReaderFinish(&pCsr->csr); + tdsqlite3_free((void *)pCsr->filter.zTerm); + tdsqlite3_free(pCsr->zStop); + tdsqlite3_free(pCsr->aStat); + tdsqlite3_free(pCsr); return SQLITE_OK; } static int fts3auxGrowStatArray(Fts3auxCursor *pCsr, int nSize){ if( nSize>pCsr->nStat ){ struct Fts3auxColstats *aNew; - aNew = (struct Fts3auxColstats *)sqlite3_realloc64(pCsr->aStat, + aNew = (struct Fts3auxColstats *)tdsqlite3_realloc64(pCsr->aStat, sizeof(struct Fts3auxColstats) * nSize ); if( aNew==0 ) return SQLITE_NOMEM; @@ -175703,7 +175703,7 @@ static int fts3auxGrowStatArray(Fts3auxCursor *pCsr, int nSize){ /* ** xNext - Advance the cursor to the next row, if any. */ -static int fts3auxNextMethod(sqlite3_vtab_cursor *pCursor){ +static int fts3auxNextMethod(tdsqlite3_vtab_cursor *pCursor){ Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor; Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab; int rc; @@ -175715,7 +175715,7 @@ static int fts3auxNextMethod(sqlite3_vtab_cursor *pCursor){ if( pCsr->aStat[pCsr->iCol].nDoc>0 ) return SQLITE_OK; } - rc = sqlite3Fts3SegReaderStep(pFts3, &pCsr->csr); + rc = tdsqlite3Fts3SegReaderStep(pFts3, &pCsr->csr); if( rc==SQLITE_ROW ){ int i = 0; int nDoclist = pCsr->csr.nDoclist; @@ -175738,9 +175738,9 @@ static int fts3auxNextMethod(sqlite3_vtab_cursor *pCursor){ iCol = 0; while( ipVtab)->pFts3Tab; @@ -175842,32 +175842,32 @@ static int fts3auxFilterMethod( /* In case this cursor is being reused, close and zero it. */ testcase(pCsr->filter.zTerm); - sqlite3Fts3SegReaderFinish(&pCsr->csr); - sqlite3_free((void *)pCsr->filter.zTerm); - sqlite3_free(pCsr->aStat); + tdsqlite3Fts3SegReaderFinish(&pCsr->csr); + tdsqlite3_free((void *)pCsr->filter.zTerm); + tdsqlite3_free(pCsr->aStat); memset(&pCsr->csr, 0, ((u8*)&pCsr[1]) - (u8*)&pCsr->csr); pCsr->filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY; if( isScan ) pCsr->filter.flags |= FTS3_SEGMENT_SCAN; if( iEq>=0 || iGe>=0 ){ - const unsigned char *zStr = sqlite3_value_text(apVal[0]); + const unsigned char *zStr = tdsqlite3_value_text(apVal[0]); assert( (iEq==0 && iGe==-1) || (iEq==-1 && iGe==0) ); if( zStr ){ - pCsr->filter.zTerm = sqlite3_mprintf("%s", zStr); + pCsr->filter.zTerm = tdsqlite3_mprintf("%s", zStr); if( pCsr->filter.zTerm==0 ) return SQLITE_NOMEM; pCsr->filter.nTerm = (int)strlen(pCsr->filter.zTerm); } } if( iLe>=0 ){ - pCsr->zStop = sqlite3_mprintf("%s", sqlite3_value_text(apVal[iLe])); + pCsr->zStop = tdsqlite3_mprintf("%s", tdsqlite3_value_text(apVal[iLe])); if( pCsr->zStop==0 ) return SQLITE_NOMEM; pCsr->nStop = (int)strlen(pCsr->zStop); } if( iLangid>=0 ){ - iLangVal = sqlite3_value_int(apVal[iLangid]); + iLangVal = tdsqlite3_value_int(apVal[iLangid]); /* If the user specified a negative value for the languageid, use zero ** instead. This works, as the "languageid=?" constraint will also @@ -175878,11 +175878,11 @@ static int fts3auxFilterMethod( } pCsr->iLangid = iLangVal; - rc = sqlite3Fts3SegReaderCursor(pFts3, iLangVal, 0, FTS3_SEGCURSOR_ALL, + rc = tdsqlite3Fts3SegReaderCursor(pFts3, iLangVal, 0, FTS3_SEGCURSOR_ALL, pCsr->filter.zTerm, pCsr->filter.nTerm, 0, isScan, &pCsr->csr ); if( rc==SQLITE_OK ){ - rc = sqlite3Fts3SegReaderStart(pFts3, &pCsr->csr, &pCsr->filter); + rc = tdsqlite3Fts3SegReaderStart(pFts3, &pCsr->csr, &pCsr->filter); } if( rc==SQLITE_OK ) rc = fts3auxNextMethod(pCursor); @@ -175892,7 +175892,7 @@ static int fts3auxFilterMethod( /* ** xEof - Return true if the cursor is at EOF, or false otherwise. */ -static int fts3auxEofMethod(sqlite3_vtab_cursor *pCursor){ +static int fts3auxEofMethod(tdsqlite3_vtab_cursor *pCursor){ Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor; return pCsr->isEof; } @@ -175901,8 +175901,8 @@ static int fts3auxEofMethod(sqlite3_vtab_cursor *pCursor){ ** xColumn - Return a column value. */ static int fts3auxColumnMethod( - sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ - sqlite3_context *pCtx, /* Context for sqlite3_result_xxx() calls */ + tdsqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ + tdsqlite3_context *pCtx, /* Context for tdsqlite3_result_xxx() calls */ int iCol /* Index of column to read value from */ ){ Fts3auxCursor *p = (Fts3auxCursor *)pCursor; @@ -175910,28 +175910,28 @@ static int fts3auxColumnMethod( assert( p->isEof==0 ); switch( iCol ){ case 0: /* term */ - sqlite3_result_text(pCtx, p->csr.zTerm, p->csr.nTerm, SQLITE_TRANSIENT); + tdsqlite3_result_text(pCtx, p->csr.zTerm, p->csr.nTerm, SQLITE_TRANSIENT); break; case 1: /* col */ if( p->iCol ){ - sqlite3_result_int(pCtx, p->iCol-1); + tdsqlite3_result_int(pCtx, p->iCol-1); }else{ - sqlite3_result_text(pCtx, "*", -1, SQLITE_STATIC); + tdsqlite3_result_text(pCtx, "*", -1, SQLITE_STATIC); } break; case 2: /* documents */ - sqlite3_result_int64(pCtx, p->aStat[p->iCol].nDoc); + tdsqlite3_result_int64(pCtx, p->aStat[p->iCol].nDoc); break; case 3: /* occurrences */ - sqlite3_result_int64(pCtx, p->aStat[p->iCol].nOcc); + tdsqlite3_result_int64(pCtx, p->aStat[p->iCol].nOcc); break; default: /* languageid */ assert( iCol==4 ); - sqlite3_result_int(pCtx, p->iLangid); + tdsqlite3_result_int(pCtx, p->iLangid); break; } @@ -175942,7 +175942,7 @@ static int fts3auxColumnMethod( ** xRowid - Return the current rowid for the cursor. */ static int fts3auxRowidMethod( - sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ + tdsqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ sqlite_int64 *pRowid /* OUT: Rowid value */ ){ Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor; @@ -175952,10 +175952,10 @@ static int fts3auxRowidMethod( /* ** Register the fts3aux module with database connection db. Return SQLITE_OK -** if successful or an error code if sqlite3_create_module() fails. +** if successful or an error code if tdsqlite3_create_module() fails. */ -SQLITE_PRIVATE int sqlite3Fts3InitAux(sqlite3 *db){ - static const sqlite3_module fts3aux_module = { +SQLITE_PRIVATE int tdsqlite3Fts3InitAux(tdsqlite3 *db){ + static const tdsqlite3_module fts3aux_module = { 0, /* iVersion */ fts3auxConnectMethod, /* xCreate */ fts3auxConnectMethod, /* xConnect */ @@ -175983,7 +175983,7 @@ SQLITE_PRIVATE int sqlite3Fts3InitAux(sqlite3 *db){ }; int rc; /* Return code */ - rc = sqlite3_create_module(db, "fts4aux", &fts3aux_module, 0); + rc = tdsqlite3_create_module(db, "fts4aux", &fts3aux_module, 0); return rc; } @@ -176029,7 +176029,7 @@ SQLITE_PRIVATE int sqlite3Fts3InitAux(sqlite3 *db){ ** AND operators have a higher precedence than OR. ** ** If compiled with SQLITE_TEST defined, then this module exports the -** symbol "int sqlite3_fts3_enable_parentheses". Setting this variable +** symbol "int tdsqlite3_fts3_enable_parentheses". Setting this variable ** to zero causes the module to use the old syntax. If it is set to ** non-zero the new syntax is activated. This is so both syntaxes can ** be tested using a single build of testfixture. @@ -176057,12 +176057,12 @@ SQLITE_PRIVATE int sqlite3Fts3InitAux(sqlite3 *db){ */ #ifdef SQLITE_TEST -SQLITE_API int sqlite3_fts3_enable_parentheses = 0; +SQLITE_API int tdsqlite3_fts3_enable_parentheses = 0; #else # ifdef SQLITE_ENABLE_FTS3_PARENTHESIS -# define sqlite3_fts3_enable_parentheses 1 +# define tdsqlite3_fts3_enable_parentheses 1 # else -# define sqlite3_fts3_enable_parentheses 0 +# define tdsqlite3_fts3_enable_parentheses 0 # endif #endif @@ -176084,14 +176084,14 @@ SQLITE_API int sqlite3_fts3_enable_parentheses = 0; */ typedef struct ParseContext ParseContext; struct ParseContext { - sqlite3_tokenizer *pTokenizer; /* Tokenizer module */ + tdsqlite3_tokenizer *pTokenizer; /* Tokenizer module */ int iLangid; /* Language id used with tokenizer */ const char **azCol; /* Array of column names for fts3 table */ int bFts4; /* True to allow FTS4-only syntax */ int nCol; /* Number of entries in azCol[] */ int iDefaultCol; /* Default column to query */ int isNot; /* True if getNextNode() sees a unary - */ - sqlite3_context *pCtx; /* Write error message here */ + tdsqlite3_context *pCtx; /* Write error message here */ int nNest; /* Number of nested brackets */ }; @@ -176111,25 +176111,25 @@ static int fts3isspace(char c){ } /* -** Allocate nByte bytes of memory using sqlite3_malloc(). If successful, +** Allocate nByte bytes of memory using tdsqlite3_malloc(). If successful, ** zero the memory before returning a pointer to it. If unsuccessful, ** return NULL. */ -static void *fts3MallocZero(sqlite3_int64 nByte){ - void *pRet = sqlite3_malloc64(nByte); +static void *fts3MallocZero(tdsqlite3_int64 nByte){ + void *pRet = tdsqlite3_malloc64(nByte); if( pRet ) memset(pRet, 0, nByte); return pRet; } -SQLITE_PRIVATE int sqlite3Fts3OpenTokenizer( - sqlite3_tokenizer *pTokenizer, +SQLITE_PRIVATE int tdsqlite3Fts3OpenTokenizer( + tdsqlite3_tokenizer *pTokenizer, int iLangid, const char *z, int n, - sqlite3_tokenizer_cursor **ppCsr + tdsqlite3_tokenizer_cursor **ppCsr ){ - sqlite3_tokenizer_module const *pModule = pTokenizer->pModule; - sqlite3_tokenizer_cursor *pCsr = 0; + tdsqlite3_tokenizer_module const *pModule = pTokenizer->pModule; + tdsqlite3_tokenizer_cursor *pCsr = 0; int rc; rc = pModule->xOpen(pTokenizer, z, n, &pCsr); @@ -176161,7 +176161,7 @@ static int fts3ExprParse(ParseContext *, const char *, int, Fts3Expr **, int *); ** single token and set *ppExpr to point to it. If the end of the buffer is ** reached before a token is found, set *ppExpr to zero. It is the ** responsibility of the caller to eventually deallocate the allocated -** Fts3Expr structure (if any) by passing it to sqlite3_free(). +** Fts3Expr structure (if any) by passing it to tdsqlite3_free(). ** ** Return SQLITE_OK if successful, or SQLITE_NOMEM if a memory allocation ** fails. @@ -176173,25 +176173,25 @@ static int getNextToken( Fts3Expr **ppExpr, /* OUT: expression */ int *pnConsumed /* OUT: Number of bytes consumed */ ){ - sqlite3_tokenizer *pTokenizer = pParse->pTokenizer; - sqlite3_tokenizer_module const *pModule = pTokenizer->pModule; + tdsqlite3_tokenizer *pTokenizer = pParse->pTokenizer; + tdsqlite3_tokenizer_module const *pModule = pTokenizer->pModule; int rc; - sqlite3_tokenizer_cursor *pCursor; + tdsqlite3_tokenizer_cursor *pCursor; Fts3Expr *pRet = 0; int i = 0; /* Set variable i to the maximum number of bytes of input to tokenize. */ for(i=0; iiLangid, z, i, &pCursor); + rc = tdsqlite3Fts3OpenTokenizer(pTokenizer, pParse->iLangid, z, i, &pCursor); if( rc==SQLITE_OK ){ const char *zToken; int nToken = 0, iStart = 0, iEnd = 0, iPosition = 0; - sqlite3_int64 nByte; /* total space to allocate */ + tdsqlite3_int64 nByte; /* total space to allocate */ rc = pModule->xNext(pCursor, &zToken, &nToken, &iStart, &iEnd, &iPosition); if( rc==SQLITE_OK ){ @@ -176214,7 +176214,7 @@ static int getNextToken( } while( 1 ){ - if( !sqlite3_fts3_enable_parentheses + if( !tdsqlite3_fts3_enable_parentheses && iStart>0 && z[iStart-1]=='-' ){ pParse->isNot = 1; @@ -176245,10 +176245,10 @@ static int getNextToken( ** Enlarge a memory allocation. If an out-of-memory allocation occurs, ** then free the old allocation. */ -static void *fts3ReallocOrFree(void *pOrig, sqlite3_int64 nNew){ - void *pRet = sqlite3_realloc64(pOrig, nNew); +static void *fts3ReallocOrFree(void *pOrig, tdsqlite3_int64 nNew){ + void *pRet = tdsqlite3_realloc64(pOrig, nNew); if( !pRet ){ - sqlite3_free(pOrig); + tdsqlite3_free(pOrig); } return pRet; } @@ -176270,11 +176270,11 @@ static int getNextString( const char *zInput, int nInput, /* Input string */ Fts3Expr **ppExpr /* OUT: expression */ ){ - sqlite3_tokenizer *pTokenizer = pParse->pTokenizer; - sqlite3_tokenizer_module const *pModule = pTokenizer->pModule; + tdsqlite3_tokenizer *pTokenizer = pParse->pTokenizer; + tdsqlite3_tokenizer_module const *pModule = pTokenizer->pModule; int rc; Fts3Expr *p = 0; - sqlite3_tokenizer_cursor *pCursor = 0; + tdsqlite3_tokenizer_cursor *pCursor = 0; char *zTemp = 0; int nTemp = 0; @@ -176284,7 +176284,7 @@ static int getNextString( /* The final Fts3Expr data structure, including the Fts3Phrase, ** Fts3PhraseToken structures token buffers are all stored as a single ** allocation so that the expression can be freed with a single call to - ** sqlite3_free(). Setting this up requires a two pass approach. + ** tdsqlite3_free(). Setting this up requires a two pass approach. ** ** The first pass, in the block below, uses a tokenizer cursor to iterate ** through the tokens in the expression. This pass uses fts3ReallocOrFree() @@ -176300,7 +176300,7 @@ static int getNextString( ** appends buffer zTemp to buffer p, and fills in the Fts3Expr and Fts3Phrase ** structures. */ - rc = sqlite3Fts3OpenTokenizer( + rc = tdsqlite3Fts3OpenTokenizer( pTokenizer, pParse->iLangid, zInput, nInput, &pCursor); if( rc==SQLITE_OK ){ int ii; @@ -176350,7 +176350,7 @@ static int getNextString( zBuf = (char *)&p->pPhrase->aToken[nToken]; if( zTemp ){ memcpy(zBuf, zTemp, nTemp); - sqlite3_free(zTemp); + tdsqlite3_free(zTemp); }else{ assert( nTemp==0 ); } @@ -176369,8 +176369,8 @@ no_mem: if( pCursor ){ pModule->xClose(pCursor); } - sqlite3_free(zTemp); - sqlite3_free(p); + tdsqlite3_free(zTemp); + tdsqlite3_free(p); *ppExpr = 0; return SQLITE_NOMEM; } @@ -176426,7 +176426,7 @@ static int getNextNode( for(ii=0; ii<(int)(sizeof(aKeyword)/sizeof(struct Fts3Keyword)); ii++){ const struct Fts3Keyword *pKey = &aKeyword[ii]; - if( (pKey->parenOnly & ~sqlite3_fts3_enable_parentheses)!=0 ){ + if( (pKey->parenOnly & ~tdsqlite3_fts3_enable_parentheses)!=0 ){ continue; } @@ -176485,7 +176485,7 @@ static int getNextNode( return getNextString(pParse, &zInput[1], ii-1, ppExpr); } - if( sqlite3_fts3_enable_parentheses ){ + if( tdsqlite3_fts3_enable_parentheses ){ if( *zInput=='(' ){ int nConsumed = 0; pParse->nNest++; @@ -176501,7 +176501,7 @@ static int getNextNode( } /* If control flows to this point, this must be a regular token, or - ** the end of the input. Read a regular token using the sqlite3_tokenizer + ** the end of the input. Read a regular token using the tdsqlite3_tokenizer ** interface. Before doing so, figure out if there is an explicit ** column specifier for the token. ** @@ -176517,7 +176517,7 @@ static int getNextNode( const char *zStr = pParse->azCol[ii]; int nStr = (int)strlen(zStr); if( nInput>nStr && zInput[nStr]==':' - && sqlite3_strnicmp(zStr, zInput, nStr)==0 + && tdsqlite3_strnicmp(zStr, zInput, nStr)==0 ){ iCol = ii; iColLen = (int)((zInput - z) + nStr + 1); @@ -176550,7 +176550,7 @@ static int getNextNode( */ static int opPrecedence(Fts3Expr *p){ assert( p->eType!=FTSQUERY_PHRASE ); - if( sqlite3_fts3_enable_parentheses ){ + if( tdsqlite3_fts3_enable_parentheses ){ return p->eType; }else if( p->eType==FTSQUERY_NEAR ){ return 1; @@ -176624,13 +176624,13 @@ static int fts3ExprParse( if( p ){ int isPhrase; - if( !sqlite3_fts3_enable_parentheses + if( !tdsqlite3_fts3_enable_parentheses && p->eType==FTSQUERY_PHRASE && pParse->isNot ){ /* Create an implicit NOT operator. */ Fts3Expr *pNot = fts3MallocZero(sizeof(Fts3Expr)); if( !pNot ){ - sqlite3Fts3ExprFree(p); + tdsqlite3Fts3ExprFree(p); rc = SQLITE_NOMEM; goto exprparse_out; } @@ -176653,7 +176653,7 @@ static int fts3ExprParse( ** isRequirePhrase is set, this is a syntax error. */ if( !isPhrase && isRequirePhrase ){ - sqlite3Fts3ExprFree(p); + tdsqlite3Fts3ExprFree(p); rc = SQLITE_ERROR; goto exprparse_out; } @@ -176664,7 +176664,7 @@ static int fts3ExprParse( assert( pRet && pPrev ); pAnd = fts3MallocZero(sizeof(Fts3Expr)); if( !pAnd ){ - sqlite3Fts3ExprFree(p); + tdsqlite3Fts3ExprFree(p); rc = SQLITE_NOMEM; goto exprparse_out; } @@ -176686,7 +176686,7 @@ static int fts3ExprParse( (eType==FTSQUERY_NEAR && !isPhrase && pPrev->eType!=FTSQUERY_PHRASE) || (eType!=FTSQUERY_PHRASE && isPhrase && pPrev->eType==FTSQUERY_NEAR) )){ - sqlite3Fts3ExprFree(p); + tdsqlite3Fts3ExprFree(p); rc = SQLITE_ERROR; goto exprparse_out; } @@ -176719,7 +176719,7 @@ static int fts3ExprParse( if( rc==SQLITE_DONE ){ rc = SQLITE_OK; - if( !sqlite3_fts3_enable_parentheses && pNotBranch ){ + if( !tdsqlite3_fts3_enable_parentheses && pNotBranch ){ if( !pRet ){ rc = SQLITE_ERROR; }else{ @@ -176737,8 +176737,8 @@ static int fts3ExprParse( exprparse_out: if( rc!=SQLITE_OK ){ - sqlite3Fts3ExprFree(pRet); - sqlite3Fts3ExprFree(pNotBranch); + tdsqlite3Fts3ExprFree(pRet); + tdsqlite3Fts3ExprFree(pNotBranch); pRet = 0; } *ppExpr = pRet; @@ -176788,7 +176788,7 @@ static int fts3ExprBalance(Fts3Expr **pp, int nMaxDepth){ if( rc==SQLITE_OK ){ if( (eType==FTSQUERY_AND || eType==FTSQUERY_OR) ){ Fts3Expr **apLeaf; - apLeaf = (Fts3Expr **)sqlite3_malloc64(sizeof(Fts3Expr *) * nMaxDepth); + apLeaf = (Fts3Expr **)tdsqlite3_malloc64(sizeof(Fts3Expr *) * nMaxDepth); if( 0==apLeaf ){ rc = SQLITE_NOMEM; }else{ @@ -176838,7 +176838,7 @@ static int fts3ExprBalance(Fts3Expr **pp, int nMaxDepth){ } } if( p ){ - sqlite3Fts3ExprFree(p); + tdsqlite3Fts3ExprFree(p); rc = SQLITE_TOOBIG; break; } @@ -176889,19 +176889,19 @@ static int fts3ExprBalance(Fts3Expr **pp, int nMaxDepth){ }else{ /* An error occurred. Delete the contents of the apLeaf[] array ** and pFree list. Everything else is cleaned up by the call to - ** sqlite3Fts3ExprFree(pRoot) below. */ + ** tdsqlite3Fts3ExprFree(pRoot) below. */ Fts3Expr *pDel; for(i=0; ipParent; - sqlite3_free(pDel); + tdsqlite3_free(pDel); } } assert( pFree==0 ); - sqlite3_free( apLeaf ); + tdsqlite3_free( apLeaf ); } }else if( eType==FTSQUERY_NOT ){ Fts3Expr *pLeft = pRoot->pLeft; @@ -176918,8 +176918,8 @@ static int fts3ExprBalance(Fts3Expr **pp, int nMaxDepth){ } if( rc!=SQLITE_OK ){ - sqlite3Fts3ExprFree(pRight); - sqlite3Fts3ExprFree(pLeft); + tdsqlite3Fts3ExprFree(pRight); + tdsqlite3Fts3ExprFree(pLeft); }else{ assert( pLeft && pRight ); pRoot->pLeft = pLeft; @@ -176931,7 +176931,7 @@ static int fts3ExprBalance(Fts3Expr **pp, int nMaxDepth){ } if( rc!=SQLITE_OK ){ - sqlite3Fts3ExprFree(pRoot); + tdsqlite3Fts3ExprFree(pRoot); pRoot = 0; } *pp = pRoot; @@ -176939,18 +176939,18 @@ static int fts3ExprBalance(Fts3Expr **pp, int nMaxDepth){ } /* -** This function is similar to sqlite3Fts3ExprParse(), with the following +** This function is similar to tdsqlite3Fts3ExprParse(), with the following ** differences: ** ** 1. It does not do expression rebalancing. ** 2. It does not check that the expression does not exceed the ** maximum allowable depth. ** 3. Even if it fails, *ppExpr may still be set to point to an -** expression tree. It should be deleted using sqlite3Fts3ExprFree() +** expression tree. It should be deleted using tdsqlite3Fts3ExprFree() ** in this case. */ static int fts3ExprParseUnbalanced( - sqlite3_tokenizer *pTokenizer, /* Tokenizer module */ + tdsqlite3_tokenizer *pTokenizer, /* Tokenizer module */ int iLangid, /* Language id for tokenizer */ char **azCol, /* Array of column names for fts3 table */ int bFts4, /* True to allow FTS4-only syntax */ @@ -177012,8 +177012,8 @@ static int fts3ExprParseUnbalanced( ** specified as part of the query string), or -1 if tokens may by default ** match any table column. */ -SQLITE_PRIVATE int sqlite3Fts3ExprParse( - sqlite3_tokenizer *pTokenizer, /* Tokenizer module */ +SQLITE_PRIVATE int tdsqlite3Fts3ExprParse( + tdsqlite3_tokenizer *pTokenizer, /* Tokenizer module */ int iLangid, /* Language id for tokenizer */ char **azCol, /* Array of column names for fts3 table */ int bFts4, /* True to allow FTS4-only syntax */ @@ -177021,7 +177021,7 @@ SQLITE_PRIVATE int sqlite3Fts3ExprParse( int iDefaultCol, /* Default column to query */ const char *z, int n, /* Text of MATCH query */ Fts3Expr **ppExpr, /* OUT: Parsed query structure */ - char **pzErr /* OUT: Error message (sqlite3_malloc) */ + char **pzErr /* OUT: Error message (tdsqlite3_malloc) */ ){ int rc = fts3ExprParseUnbalanced( pTokenizer, iLangid, azCol, bFts4, nCol, iDefaultCol, z, n, ppExpr @@ -177037,16 +177037,16 @@ SQLITE_PRIVATE int sqlite3Fts3ExprParse( } if( rc!=SQLITE_OK ){ - sqlite3Fts3ExprFree(*ppExpr); + tdsqlite3Fts3ExprFree(*ppExpr); *ppExpr = 0; if( rc==SQLITE_TOOBIG ){ - sqlite3Fts3ErrMsg(pzErr, + tdsqlite3Fts3ErrMsg(pzErr, "FTS expression tree is too large (maximum depth %d)", SQLITE_FTS3_MAX_EXPR_DEPTH ); rc = SQLITE_ERROR; }else if( rc==SQLITE_ERROR ){ - sqlite3Fts3ErrMsg(pzErr, "malformed MATCH expression: [%s]", z); + tdsqlite3Fts3ErrMsg(pzErr, "malformed MATCH expression: [%s]", z); } } @@ -177058,19 +177058,19 @@ SQLITE_PRIVATE int sqlite3Fts3ExprParse( */ static void fts3FreeExprNode(Fts3Expr *p){ assert( p->eType==FTSQUERY_PHRASE || p->pPhrase==0 ); - sqlite3Fts3EvalPhraseCleanup(p->pPhrase); - sqlite3_free(p->aMI); - sqlite3_free(p); + tdsqlite3Fts3EvalPhraseCleanup(p->pPhrase); + tdsqlite3_free(p->aMI); + tdsqlite3_free(p); } /* -** Free a parsed fts3 query expression allocated by sqlite3Fts3ExprParse(). +** Free a parsed fts3 query expression allocated by tdsqlite3Fts3ExprParse(). ** ** This function would be simpler if it recursively called itself. But ** that would mean passing a sufficiently large expression to ExprParse() ** could cause a stack overflow. */ -SQLITE_PRIVATE void sqlite3Fts3ExprFree(Fts3Expr *pDel){ +SQLITE_PRIVATE void tdsqlite3Fts3ExprFree(Fts3Expr *pDel){ Fts3Expr *p; assert( pDel==0 || pDel->pParent==0 ); for(p=pDel; p && (p->pLeft||p->pRight); p=(p->pLeft ? p->pLeft : p->pRight)){ @@ -177103,25 +177103,25 @@ SQLITE_PRIVATE void sqlite3Fts3ExprFree(Fts3Expr *pDel){ /* ** Return a pointer to a buffer containing a text representation of the ** expression passed as the first argument. The buffer is obtained from -** sqlite3_malloc(). It is the responsibility of the caller to use -** sqlite3_free() to release the memory. If an OOM condition is encountered, +** tdsqlite3_malloc(). It is the responsibility of the caller to use +** tdsqlite3_free() to release the memory. If an OOM condition is encountered, ** NULL is returned. ** ** If the second argument is not NULL, then its contents are prepended to -** the returned expression text and then freed using sqlite3_free(). +** the returned expression text and then freed using tdsqlite3_free(). */ static char *exprToString(Fts3Expr *pExpr, char *zBuf){ if( pExpr==0 ){ - return sqlite3_mprintf(""); + return tdsqlite3_mprintf(""); } switch( pExpr->eType ){ case FTSQUERY_PHRASE: { Fts3Phrase *pPhrase = pExpr->pPhrase; int i; - zBuf = sqlite3_mprintf( + zBuf = tdsqlite3_mprintf( "%zPHRASE %d 0", zBuf, pPhrase->iColumn); for(i=0; zBuf && inToken; i++){ - zBuf = sqlite3_mprintf("%z %.*s%s", zBuf, + zBuf = tdsqlite3_mprintf("%z %.*s%s", zBuf, pPhrase->aToken[i].n, pPhrase->aToken[i].z, (pPhrase->aToken[i].isPrefix?"+":"") ); @@ -177130,25 +177130,25 @@ static char *exprToString(Fts3Expr *pExpr, char *zBuf){ } case FTSQUERY_NEAR: - zBuf = sqlite3_mprintf("%zNEAR/%d ", zBuf, pExpr->nNear); + zBuf = tdsqlite3_mprintf("%zNEAR/%d ", zBuf, pExpr->nNear); break; case FTSQUERY_NOT: - zBuf = sqlite3_mprintf("%zNOT ", zBuf); + zBuf = tdsqlite3_mprintf("%zNOT ", zBuf); break; case FTSQUERY_AND: - zBuf = sqlite3_mprintf("%zAND ", zBuf); + zBuf = tdsqlite3_mprintf("%zAND ", zBuf); break; case FTSQUERY_OR: - zBuf = sqlite3_mprintf("%zOR ", zBuf); + zBuf = tdsqlite3_mprintf("%zOR ", zBuf); break; } - if( zBuf ) zBuf = sqlite3_mprintf("%z{", zBuf); + if( zBuf ) zBuf = tdsqlite3_mprintf("%z{", zBuf); if( zBuf ) zBuf = exprToString(pExpr->pLeft, zBuf); - if( zBuf ) zBuf = sqlite3_mprintf("%z} {", zBuf); + if( zBuf ) zBuf = tdsqlite3_mprintf("%z} {", zBuf); if( zBuf ) zBuf = exprToString(pExpr->pRight, zBuf); - if( zBuf ) zBuf = sqlite3_mprintf("%z}", zBuf); + if( zBuf ) zBuf = tdsqlite3_mprintf("%z}", zBuf); return zBuf; } @@ -177169,11 +177169,11 @@ static char *exprToString(Fts3Expr *pExpr, char *zBuf){ */ static void fts3ExprTestCommon( int bRebalance, - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ - sqlite3_tokenizer *pTokenizer = 0; + tdsqlite3_tokenizer *pTokenizer = 0; int rc; char **azCol = 0; const char *zExpr; @@ -177182,48 +177182,48 @@ static void fts3ExprTestCommon( int ii; Fts3Expr *pExpr; char *zBuf = 0; - Fts3Hash *pHash = (Fts3Hash*)sqlite3_user_data(context); + Fts3Hash *pHash = (Fts3Hash*)tdsqlite3_user_data(context); const char *zTokenizer = 0; char *zErr = 0; if( argc<3 ){ - sqlite3_result_error(context, + tdsqlite3_result_error(context, "Usage: fts3_exprtest(tokenizer, expr, col1, ...", -1 ); return; } - zTokenizer = (const char*)sqlite3_value_text(argv[0]); - rc = sqlite3Fts3InitTokenizer(pHash, zTokenizer, &pTokenizer, &zErr); + zTokenizer = (const char*)tdsqlite3_value_text(argv[0]); + rc = tdsqlite3Fts3InitTokenizer(pHash, zTokenizer, &pTokenizer, &zErr); if( rc!=SQLITE_OK ){ if( rc==SQLITE_NOMEM ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); }else{ - sqlite3_result_error(context, zErr, -1); + tdsqlite3_result_error(context, zErr, -1); } - sqlite3_free(zErr); + tdsqlite3_free(zErr); return; } - zExpr = (const char *)sqlite3_value_text(argv[1]); - nExpr = sqlite3_value_bytes(argv[1]); + zExpr = (const char *)tdsqlite3_value_text(argv[1]); + nExpr = tdsqlite3_value_bytes(argv[1]); nCol = argc-2; - azCol = (char **)sqlite3_malloc64(nCol*sizeof(char *)); + azCol = (char **)tdsqlite3_malloc64(nCol*sizeof(char *)); if( !azCol ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); goto exprtest_out; } for(ii=0; iipModule->xDestroy(pTokenizer); } - sqlite3_free(azCol); + tdsqlite3_free(azCol); } static void fts3ExprTest( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ fts3ExprTestCommon(0, context, argc, argv); } static void fts3ExprTestRebalance( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ fts3ExprTestCommon(1, context, argc, argv); } @@ -177268,12 +177268,12 @@ static void fts3ExprTestRebalance( ** Register the query expression parser test function fts3_exprtest() ** with database connection db. */ -SQLITE_PRIVATE int sqlite3Fts3ExprInitTestInterface(sqlite3 *db, Fts3Hash *pHash){ - int rc = sqlite3_create_function( +SQLITE_PRIVATE int tdsqlite3Fts3ExprInitTestInterface(tdsqlite3 *db, Fts3Hash *pHash){ + int rc = tdsqlite3_create_function( db, "fts3_exprtest", -1, SQLITE_UTF8, (void*)pHash, fts3ExprTest, 0, 0 ); if( rc==SQLITE_OK ){ - rc = sqlite3_create_function(db, "fts3_exprtest_rebalance", + rc = tdsqlite3_create_function(db, "fts3_exprtest_rebalance", -1, SQLITE_UTF8, (void*)pHash, fts3ExprTestRebalance, 0, 0 ); } @@ -177322,15 +177322,15 @@ SQLITE_PRIVATE int sqlite3Fts3ExprInitTestInterface(sqlite3 *db, Fts3Hash *pHash /* ** Malloc and Free functions */ -static void *fts3HashMalloc(sqlite3_int64 n){ - void *p = sqlite3_malloc64(n); +static void *fts3HashMalloc(tdsqlite3_int64 n){ + void *p = tdsqlite3_malloc64(n); if( p ){ memset(p, 0, n); } return p; } static void fts3HashFree(void *p){ - sqlite3_free(p); + tdsqlite3_free(p); } /* Turn bulk memory into a hash table object by initializing the @@ -177343,7 +177343,7 @@ static void fts3HashFree(void *p){ ** true if the hash table should make its own private copy of keys and ** false if it should just use the supplied pointer. */ -SQLITE_PRIVATE void sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey){ +SQLITE_PRIVATE void tdsqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey){ assert( pNew!=0 ); assert( keyClass>=FTS3_HASH_STRING && keyClass<=FTS3_HASH_BINARY ); pNew->keyClass = keyClass; @@ -177358,7 +177358,7 @@ SQLITE_PRIVATE void sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copy ** Call this routine to delete a hash table or to reset a hash table ** to the empty state. */ -SQLITE_PRIVATE void sqlite3Fts3HashClear(Fts3Hash *pH){ +SQLITE_PRIVATE void tdsqlite3Fts3HashClear(Fts3Hash *pH){ Fts3HashElem *elem; /* For looping over all elements of the table */ assert( pH!=0 ); @@ -177566,7 +177566,7 @@ static void fts3RemoveElementByHash( } } -SQLITE_PRIVATE Fts3HashElem *sqlite3Fts3HashFindElem( +SQLITE_PRIVATE Fts3HashElem *tdsqlite3Fts3HashFindElem( const Fts3Hash *pH, const void *pKey, int nKey @@ -177587,10 +177587,10 @@ SQLITE_PRIVATE Fts3HashElem *sqlite3Fts3HashFindElem( ** that matches pKey,nKey. Return the data for this element if it is ** found, or NULL if there is no match. */ -SQLITE_PRIVATE void *sqlite3Fts3HashFind(const Fts3Hash *pH, const void *pKey, int nKey){ +SQLITE_PRIVATE void *tdsqlite3Fts3HashFind(const Fts3Hash *pH, const void *pKey, int nKey){ Fts3HashElem *pElem; /* The element that matches key (if any) */ - pElem = sqlite3Fts3HashFindElem(pH, pKey, nKey); + pElem = tdsqlite3Fts3HashFindElem(pH, pKey, nKey); return pElem ? pElem->data : 0; } @@ -177609,7 +177609,7 @@ SQLITE_PRIVATE void *sqlite3Fts3HashFind(const Fts3Hash *pH, const void *pKey, i ** If the "data" parameter to this function is NULL, then the ** element corresponding to "key" is removed from the hash table. */ -SQLITE_PRIVATE void *sqlite3Fts3HashInsert( +SQLITE_PRIVATE void *tdsqlite3Fts3HashInsert( Fts3Hash *pH, /* The hash table to insert into */ const void *pKey, /* The key */ int nKey, /* Number of bytes in the key */ @@ -177706,17 +177706,17 @@ SQLITE_PRIVATE void *sqlite3Fts3HashInsert( /* #include "fts3_tokenizer.h" */ /* -** Class derived from sqlite3_tokenizer +** Class derived from tdsqlite3_tokenizer */ typedef struct porter_tokenizer { - sqlite3_tokenizer base; /* Base class */ + tdsqlite3_tokenizer base; /* Base class */ } porter_tokenizer; /* -** Class derived from sqlite3_tokenizer_cursor +** Class derived from tdsqlite3_tokenizer_cursor */ typedef struct porter_tokenizer_cursor { - sqlite3_tokenizer_cursor base; + tdsqlite3_tokenizer_cursor base; const char *zInput; /* input we are tokenizing */ int nInput; /* size of the input */ int iOffset; /* current position in zInput */ @@ -177731,14 +177731,14 @@ typedef struct porter_tokenizer_cursor { */ static int porterCreate( int argc, const char * const *argv, - sqlite3_tokenizer **ppTokenizer + tdsqlite3_tokenizer **ppTokenizer ){ porter_tokenizer *t; UNUSED_PARAMETER(argc); UNUSED_PARAMETER(argv); - t = (porter_tokenizer *) sqlite3_malloc(sizeof(*t)); + t = (porter_tokenizer *) tdsqlite3_malloc(sizeof(*t)); if( t==NULL ) return SQLITE_NOMEM; memset(t, 0, sizeof(*t)); *ppTokenizer = &t->base; @@ -177748,8 +177748,8 @@ static int porterCreate( /* ** Destroy a tokenizer */ -static int porterDestroy(sqlite3_tokenizer *pTokenizer){ - sqlite3_free(pTokenizer); +static int porterDestroy(tdsqlite3_tokenizer *pTokenizer){ + tdsqlite3_free(pTokenizer); return SQLITE_OK; } @@ -177760,15 +177760,15 @@ static int porterDestroy(sqlite3_tokenizer *pTokenizer){ ** *ppCursor. */ static int porterOpen( - sqlite3_tokenizer *pTokenizer, /* The tokenizer */ + tdsqlite3_tokenizer *pTokenizer, /* The tokenizer */ const char *zInput, int nInput, /* String to be tokenized */ - sqlite3_tokenizer_cursor **ppCursor /* OUT: Tokenization cursor */ + tdsqlite3_tokenizer_cursor **ppCursor /* OUT: Tokenization cursor */ ){ porter_tokenizer_cursor *c; UNUSED_PARAMETER(pTokenizer); - c = (porter_tokenizer_cursor *) sqlite3_malloc(sizeof(*c)); + c = (porter_tokenizer_cursor *) tdsqlite3_malloc(sizeof(*c)); if( c==NULL ) return SQLITE_NOMEM; c->zInput = zInput; @@ -177792,10 +177792,10 @@ static int porterOpen( ** Close a tokenization cursor previously opened by a call to ** porterOpen() above. */ -static int porterClose(sqlite3_tokenizer_cursor *pCursor){ +static int porterClose(tdsqlite3_tokenizer_cursor *pCursor){ porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor; - sqlite3_free(c->zToken); - sqlite3_free(c); + tdsqlite3_free(c->zToken); + tdsqlite3_free(c); return SQLITE_OK; } /* @@ -178265,7 +178265,7 @@ static const char porterIdChar[] = { ** have been opened by a prior call to porterOpen(). */ static int porterNext( - sqlite3_tokenizer_cursor *pCursor, /* Cursor returned by porterOpen */ + tdsqlite3_tokenizer_cursor *pCursor, /* Cursor returned by porterOpen */ const char **pzToken, /* OUT: *pzToken is the token text */ int *pnBytes, /* OUT: Number of bytes in token */ int *piStartOffset, /* OUT: Starting offset of token */ @@ -178294,7 +178294,7 @@ static int porterNext( if( n>c->nAllocated ){ char *pNew; c->nAllocated = n+20; - pNew = sqlite3_realloc(c->zToken, c->nAllocated); + pNew = tdsqlite3_realloc(c->zToken, c->nAllocated); if( !pNew ) return SQLITE_NOMEM; c->zToken = pNew; } @@ -178312,7 +178312,7 @@ static int porterNext( /* ** The set of routines that implement the porter-stemmer tokenizer */ -static const sqlite3_tokenizer_module porterTokenizerModule = { +static const tdsqlite3_tokenizer_module porterTokenizerModule = { 0, porterCreate, porterDestroy, @@ -178326,8 +178326,8 @@ static const sqlite3_tokenizer_module porterTokenizerModule = { ** Allocate a new porter tokenizer. Return a pointer to the new ** tokenizer in *ppModule */ -SQLITE_PRIVATE void sqlite3Fts3PorterTokenizerModule( - sqlite3_tokenizer_module const**ppModule +SQLITE_PRIVATE void tdsqlite3Fts3PorterTokenizerModule( + tdsqlite3_tokenizer_module const**ppModule ){ *ppModule = &porterTokenizerModule; } @@ -178369,13 +178369,13 @@ SQLITE_PRIVATE void sqlite3Fts3PorterTokenizerModule( /* ** Return true if the two-argument version of fts3_tokenizer() -** has been activated via a prior call to sqlite3_db_config(db, +** has been activated via a prior call to tdsqlite3_db_config(db, ** SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, 0); */ -static int fts3TokenizerEnabled(sqlite3_context *context){ - sqlite3 *db = sqlite3_context_db_handle(context); +static int fts3TokenizerEnabled(tdsqlite3_context *context){ + tdsqlite3 *db = tdsqlite3_context_db_handle(context); int isEnabled = 0; - sqlite3_db_config(db,SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER,-1,&isEnabled); + tdsqlite3_db_config(db,SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER,-1,&isEnabled); return isEnabled; } @@ -178387,7 +178387,7 @@ static int fts3TokenizerEnabled(sqlite3_context *context){ ** SELECT (, ); ** ** where is the name passed as the second argument -** to the sqlite3Fts3InitHashTable() function (e.g. 'fts3_tokenizer'). +** to the tdsqlite3Fts3InitHashTable() function (e.g. 'fts3_tokenizer'). ** ** If the argument is specified, it must be a blob value ** containing a pointer to be stored as the hash data corresponding @@ -178400,9 +178400,9 @@ static int fts3TokenizerEnabled(sqlite3_context *context){ ** to string (after the hash-table is updated, if applicable). */ static void fts3TokenizerFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ Fts3Hash *pHash; void *pPtr = 0; @@ -178411,45 +178411,45 @@ static void fts3TokenizerFunc( assert( argc==1 || argc==2 ); - pHash = (Fts3Hash *)sqlite3_user_data(context); + pHash = (Fts3Hash *)tdsqlite3_user_data(context); - zName = sqlite3_value_text(argv[0]); - nName = sqlite3_value_bytes(argv[0])+1; + zName = tdsqlite3_value_text(argv[0]); + nName = tdsqlite3_value_bytes(argv[0])+1; if( argc==2 ){ - if( fts3TokenizerEnabled(context) || sqlite3_value_frombind(argv[1]) ){ + if( fts3TokenizerEnabled(context) || tdsqlite3_value_frombind(argv[1]) ){ void *pOld; - int n = sqlite3_value_bytes(argv[1]); + int n = tdsqlite3_value_bytes(argv[1]); if( zName==0 || n!=sizeof(pPtr) ){ - sqlite3_result_error(context, "argument type mismatch", -1); + tdsqlite3_result_error(context, "argument type mismatch", -1); return; } - pPtr = *(void **)sqlite3_value_blob(argv[1]); - pOld = sqlite3Fts3HashInsert(pHash, (void *)zName, nName, pPtr); + pPtr = *(void **)tdsqlite3_value_blob(argv[1]); + pOld = tdsqlite3Fts3HashInsert(pHash, (void *)zName, nName, pPtr); if( pOld==pPtr ){ - sqlite3_result_error(context, "out of memory", -1); + tdsqlite3_result_error(context, "out of memory", -1); } }else{ - sqlite3_result_error(context, "fts3tokenize disabled", -1); + tdsqlite3_result_error(context, "fts3tokenize disabled", -1); return; } }else{ if( zName ){ - pPtr = sqlite3Fts3HashFind(pHash, zName, nName); + pPtr = tdsqlite3Fts3HashFind(pHash, zName, nName); } if( !pPtr ){ - char *zErr = sqlite3_mprintf("unknown tokenizer: %s", zName); - sqlite3_result_error(context, zErr, -1); - sqlite3_free(zErr); + char *zErr = tdsqlite3_mprintf("unknown tokenizer: %s", zName); + tdsqlite3_result_error(context, zErr, -1); + tdsqlite3_free(zErr); return; } } - if( fts3TokenizerEnabled(context) || sqlite3_value_frombind(argv[0]) ){ - sqlite3_result_blob(context, (void *)&pPtr, sizeof(pPtr), SQLITE_TRANSIENT); + if( fts3TokenizerEnabled(context) || tdsqlite3_value_frombind(argv[0]) ){ + tdsqlite3_result_blob(context, (void *)&pPtr, sizeof(pPtr), SQLITE_TRANSIENT); } } -SQLITE_PRIVATE int sqlite3Fts3IsIdChar(char c){ +SQLITE_PRIVATE int tdsqlite3Fts3IsIdChar(char c){ static const char isFtsIdChar[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1x */ @@ -178463,7 +178463,7 @@ SQLITE_PRIVATE int sqlite3Fts3IsIdChar(char c){ return (c&0x80 || isFtsIdChar[(int)(c)]); } -SQLITE_PRIVATE const char *sqlite3Fts3NextToken(const char *zStr, int *pn){ +SQLITE_PRIVATE const char *tdsqlite3Fts3NextToken(const char *zStr, int *pn){ const char *z1; const char *z2 = 0; @@ -178487,9 +178487,9 @@ SQLITE_PRIVATE const char *sqlite3Fts3NextToken(const char *zStr, int *pn){ break; default: - if( sqlite3Fts3IsIdChar(*z1) ){ + if( tdsqlite3Fts3IsIdChar(*z1) ){ z2 = &z1[1]; - while( sqlite3Fts3IsIdChar(*z2) ) z2++; + while( tdsqlite3Fts3IsIdChar(*z2) ) z2++; }else{ z1++; } @@ -178500,10 +178500,10 @@ SQLITE_PRIVATE const char *sqlite3Fts3NextToken(const char *zStr, int *pn){ return z1; } -SQLITE_PRIVATE int sqlite3Fts3InitTokenizer( +SQLITE_PRIVATE int tdsqlite3Fts3InitTokenizer( Fts3Hash *pHash, /* Tokenizer hash table */ const char *zArg, /* Tokenizer name */ - sqlite3_tokenizer **ppTok, /* OUT: Tokenizer (if applicable) */ + tdsqlite3_tokenizer **ppTok, /* OUT: Tokenizer (if applicable) */ char **pzErr /* OUT: Set to malloced error message */ ){ int rc; @@ -178511,53 +178511,53 @@ SQLITE_PRIVATE int sqlite3Fts3InitTokenizer( int n = 0; char *zCopy; char *zEnd; /* Pointer to nul-term of zCopy */ - sqlite3_tokenizer_module *m; + tdsqlite3_tokenizer_module *m; - zCopy = sqlite3_mprintf("%s", zArg); + zCopy = tdsqlite3_mprintf("%s", zArg); if( !zCopy ) return SQLITE_NOMEM; zEnd = &zCopy[strlen(zCopy)]; - z = (char *)sqlite3Fts3NextToken(zCopy, &n); + z = (char *)tdsqlite3Fts3NextToken(zCopy, &n); if( z==0 ){ assert( n==0 ); z = zCopy; } z[n] = '\0'; - sqlite3Fts3Dequote(z); + tdsqlite3Fts3Dequote(z); - m = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash,z,(int)strlen(z)+1); + m = (tdsqlite3_tokenizer_module *)tdsqlite3Fts3HashFind(pHash,z,(int)strlen(z)+1); if( !m ){ - sqlite3Fts3ErrMsg(pzErr, "unknown tokenizer: %s", z); + tdsqlite3Fts3ErrMsg(pzErr, "unknown tokenizer: %s", z); rc = SQLITE_ERROR; }else{ char const **aArg = 0; int iArg = 0; z = &z[n+1]; - while( zxCreate(iArg, aArg, ppTok); assert( rc!=SQLITE_OK || *ppTok ); if( rc!=SQLITE_OK ){ - sqlite3Fts3ErrMsg(pzErr, "unknown tokenizer"); + tdsqlite3Fts3ErrMsg(pzErr, "unknown tokenizer"); }else{ (*ppTok)->pModule = m; } - sqlite3_free((void *)aArg); + tdsqlite3_free((void *)aArg); } - sqlite3_free(zCopy); + tdsqlite3_free(zCopy); return rc; } @@ -178579,7 +178579,7 @@ SQLITE_PRIVATE int sqlite3Fts3InitTokenizer( ** SELECT (, ..., ); ** ** where is the name passed as the second argument -** to the sqlite3Fts3InitHashTable() function (e.g. 'fts3_tokenizer') +** to the tdsqlite3Fts3InitHashTable() function (e.g. 'fts3_tokenizer') ** concatenated with the string '_test' (e.g. 'fts3_tokenizer_test'). ** ** The return value is a string that may be interpreted as a Tcl @@ -178597,14 +178597,14 @@ SQLITE_PRIVATE int sqlite3Fts3InitTokenizer( ** */ static void testFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ Fts3Hash *pHash; - sqlite3_tokenizer_module *p; - sqlite3_tokenizer *pTokenizer = 0; - sqlite3_tokenizer_cursor *pCsr = 0; + tdsqlite3_tokenizer_module *p; + tdsqlite3_tokenizer *pTokenizer = 0; + tdsqlite3_tokenizer_cursor *pCsr = 0; const char *zErr = 0; @@ -178625,22 +178625,22 @@ static void testFunc( Tcl_Obj *pRet; if( argc<2 ){ - sqlite3_result_error(context, "insufficient arguments", -1); + tdsqlite3_result_error(context, "insufficient arguments", -1); return; } - nName = sqlite3_value_bytes(argv[0]); - zName = (const char *)sqlite3_value_text(argv[0]); - nInput = sqlite3_value_bytes(argv[argc-1]); - zInput = (const char *)sqlite3_value_text(argv[argc-1]); + nName = tdsqlite3_value_bytes(argv[0]); + zName = (const char *)tdsqlite3_value_text(argv[0]); + nInput = tdsqlite3_value_bytes(argv[argc-1]); + zInput = (const char *)tdsqlite3_value_text(argv[argc-1]); - pHash = (Fts3Hash *)sqlite3_user_data(context); - p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1); + pHash = (Fts3Hash *)tdsqlite3_user_data(context); + p = (tdsqlite3_tokenizer_module *)tdsqlite3Fts3HashFind(pHash, zName, nName+1); if( !p ){ - char *zErr2 = sqlite3_mprintf("unknown tokenizer: %s", zName); - sqlite3_result_error(context, zErr2, -1); - sqlite3_free(zErr2); + char *zErr2 = tdsqlite3_mprintf("unknown tokenizer: %s", zName); + tdsqlite3_result_error(context, zErr2, -1); + tdsqlite3_free(zErr2); return; } @@ -178648,7 +178648,7 @@ static void testFunc( Tcl_IncrRefCount(pRet); for(i=1; ixCreate(argc-2, azArg, &pTokenizer) ){ @@ -178656,7 +178656,7 @@ static void testFunc( goto finish; } pTokenizer->pModule = p; - if( sqlite3Fts3OpenTokenizer(pTokenizer, 0, zInput, nInput, &pCsr) ){ + if( tdsqlite3Fts3OpenTokenizer(pTokenizer, 0, zInput, nInput, &pCsr) ){ zErr = "error in xOpen()"; goto finish; } @@ -178680,65 +178680,65 @@ static void testFunc( finish: if( zErr ){ - sqlite3_result_error(context, zErr, -1); + tdsqlite3_result_error(context, zErr, -1); }else{ - sqlite3_result_text(context, Tcl_GetString(pRet), -1, SQLITE_TRANSIENT); + tdsqlite3_result_text(context, Tcl_GetString(pRet), -1, SQLITE_TRANSIENT); } Tcl_DecrRefCount(pRet); } static int registerTokenizer( - sqlite3 *db, + tdsqlite3 *db, char *zName, - const sqlite3_tokenizer_module *p + const tdsqlite3_tokenizer_module *p ){ int rc; - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; const char zSql[] = "SELECT fts3_tokenizer(?, ?)"; - rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); + rc = tdsqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); if( rc!=SQLITE_OK ){ return rc; } - sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC); - sqlite3_bind_blob(pStmt, 2, &p, sizeof(p), SQLITE_STATIC); - sqlite3_step(pStmt); + tdsqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC); + tdsqlite3_bind_blob(pStmt, 2, &p, sizeof(p), SQLITE_STATIC); + tdsqlite3_step(pStmt); - return sqlite3_finalize(pStmt); + return tdsqlite3_finalize(pStmt); } static int queryTokenizer( - sqlite3 *db, + tdsqlite3 *db, char *zName, - const sqlite3_tokenizer_module **pp + const tdsqlite3_tokenizer_module **pp ){ int rc; - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; const char zSql[] = "SELECT fts3_tokenizer(?)"; *pp = 0; - rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); + rc = tdsqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); if( rc!=SQLITE_OK ){ return rc; } - sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC); - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB - && sqlite3_column_bytes(pStmt, 0)==sizeof(*pp) + tdsqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC); + if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + if( tdsqlite3_column_type(pStmt, 0)==SQLITE_BLOB + && tdsqlite3_column_bytes(pStmt, 0)==sizeof(*pp) ){ - memcpy((void *)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp)); + memcpy((void *)pp, tdsqlite3_column_blob(pStmt, 0), sizeof(*pp)); } } - return sqlite3_finalize(pStmt); + return tdsqlite3_finalize(pStmt); } -SQLITE_PRIVATE void sqlite3Fts3SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule); +SQLITE_PRIVATE void tdsqlite3Fts3SimpleTokenizerModule(tdsqlite3_tokenizer_module const**ppModule); /* ** Implementation of the scalar function fts3_tokenizer_internal_test(). @@ -178759,27 +178759,27 @@ SQLITE_PRIVATE void sqlite3Fts3SimpleTokenizerModule(sqlite3_tokenizer_module co ** */ static void intTestFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ int rc; - const sqlite3_tokenizer_module *p1; - const sqlite3_tokenizer_module *p2; - sqlite3 *db = (sqlite3 *)sqlite3_user_data(context); + const tdsqlite3_tokenizer_module *p1; + const tdsqlite3_tokenizer_module *p2; + tdsqlite3 *db = (tdsqlite3 *)tdsqlite3_user_data(context); UNUSED_PARAMETER(argc); UNUSED_PARAMETER(argv); /* Test the query function */ - sqlite3Fts3SimpleTokenizerModule(&p1); + tdsqlite3Fts3SimpleTokenizerModule(&p1); rc = queryTokenizer(db, "simple", &p2); assert( rc==SQLITE_OK ); assert( p1==p2 ); rc = queryTokenizer(db, "nosuchtokenizer", &p2); assert( rc==SQLITE_ERROR ); assert( p2==0 ); - assert( 0==strcmp(sqlite3_errmsg(db), "unknown tokenizer: nosuchtokenizer") ); + assert( 0==strcmp(tdsqlite3_errmsg(db), "unknown tokenizer: nosuchtokenizer") ); /* Test the storage function */ if( fts3TokenizerEnabled(context) ){ @@ -178790,7 +178790,7 @@ static void intTestFunc( assert( p2==p1 ); } - sqlite3_result_text(context, "ok", -1, SQLITE_STATIC); + tdsqlite3_result_text(context, "ok", -1, SQLITE_STATIC); } #endif @@ -178801,7 +178801,7 @@ static void intTestFunc( ** been initialized to use string keys, and to take a private copy ** of the key when a value is inserted. i.e. by a call similar to: ** -** sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1); +** tdsqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1); ** ** This function adds a scalar function (see header comment above ** fts3TokenizerFunc() in this file for details) and, if ENABLE_TABLE is @@ -178812,8 +178812,8 @@ static void intTestFunc( ** The third argument to this function, zName, is used as the name ** of both the scalar and, if created, the virtual table. */ -SQLITE_PRIVATE int sqlite3Fts3InitHashTable( - sqlite3 *db, +SQLITE_PRIVATE int tdsqlite3Fts3InitHashTable( + tdsqlite3 *db, Fts3Hash *pHash, const char *zName ){ @@ -178825,31 +178825,31 @@ SQLITE_PRIVATE int sqlite3Fts3InitHashTable( char *zTest = 0; char *zTest2 = 0; void *pdb = (void *)db; - zTest = sqlite3_mprintf("%s_test", zName); - zTest2 = sqlite3_mprintf("%s_internal_test", zName); + zTest = tdsqlite3_mprintf("%s_test", zName); + zTest2 = tdsqlite3_mprintf("%s_internal_test", zName); if( !zTest || !zTest2 ){ rc = SQLITE_NOMEM; } #endif if( SQLITE_OK==rc ){ - rc = sqlite3_create_function(db, zName, 1, any, p, fts3TokenizerFunc, 0, 0); + rc = tdsqlite3_create_function(db, zName, 1, any, p, fts3TokenizerFunc, 0, 0); } if( SQLITE_OK==rc ){ - rc = sqlite3_create_function(db, zName, 2, any, p, fts3TokenizerFunc, 0, 0); + rc = tdsqlite3_create_function(db, zName, 2, any, p, fts3TokenizerFunc, 0, 0); } #ifdef SQLITE_TEST if( SQLITE_OK==rc ){ - rc = sqlite3_create_function(db, zTest, -1, any, p, testFunc, 0, 0); + rc = tdsqlite3_create_function(db, zTest, -1, any, p, testFunc, 0, 0); } if( SQLITE_OK==rc ){ - rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0); + rc = tdsqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0); } #endif #ifdef SQLITE_TEST - sqlite3_free(zTest); - sqlite3_free(zTest2); + tdsqlite3_free(zTest); + tdsqlite3_free(zTest2); #endif return rc; @@ -178894,12 +178894,12 @@ SQLITE_PRIVATE int sqlite3Fts3InitHashTable( /* #include "fts3_tokenizer.h" */ typedef struct simple_tokenizer { - sqlite3_tokenizer base; + tdsqlite3_tokenizer base; char delim[128]; /* flag ASCII delimiters */ } simple_tokenizer; typedef struct simple_tokenizer_cursor { - sqlite3_tokenizer_cursor base; + tdsqlite3_tokenizer_cursor base; const char *pInput; /* input we are tokenizing */ int nBytes; /* size of the input */ int iOffset; /* current position in pInput */ @@ -178921,11 +178921,11 @@ static int fts3_isalnum(int x){ */ static int simpleCreate( int argc, const char * const *argv, - sqlite3_tokenizer **ppTokenizer + tdsqlite3_tokenizer **ppTokenizer ){ simple_tokenizer *t; - t = (simple_tokenizer *) sqlite3_malloc(sizeof(*t)); + t = (simple_tokenizer *) tdsqlite3_malloc(sizeof(*t)); if( t==NULL ) return SQLITE_NOMEM; memset(t, 0, sizeof(*t)); @@ -178940,7 +178940,7 @@ static int simpleCreate( unsigned char ch = argv[1][i]; /* We explicitly don't support UTF-8 delimiters for now. */ if( ch>=0x80 ){ - sqlite3_free(t); + tdsqlite3_free(t); return SQLITE_ERROR; } t->delim[ch] = 1; @@ -178960,8 +178960,8 @@ static int simpleCreate( /* ** Destroy a tokenizer */ -static int simpleDestroy(sqlite3_tokenizer *pTokenizer){ - sqlite3_free(pTokenizer); +static int simpleDestroy(tdsqlite3_tokenizer *pTokenizer){ + tdsqlite3_free(pTokenizer); return SQLITE_OK; } @@ -178972,15 +178972,15 @@ static int simpleDestroy(sqlite3_tokenizer *pTokenizer){ ** *ppCursor. */ static int simpleOpen( - sqlite3_tokenizer *pTokenizer, /* The tokenizer */ + tdsqlite3_tokenizer *pTokenizer, /* The tokenizer */ const char *pInput, int nBytes, /* String to be tokenized */ - sqlite3_tokenizer_cursor **ppCursor /* OUT: Tokenization cursor */ + tdsqlite3_tokenizer_cursor **ppCursor /* OUT: Tokenization cursor */ ){ simple_tokenizer_cursor *c; UNUSED_PARAMETER(pTokenizer); - c = (simple_tokenizer_cursor *) sqlite3_malloc(sizeof(*c)); + c = (simple_tokenizer_cursor *) tdsqlite3_malloc(sizeof(*c)); if( c==NULL ) return SQLITE_NOMEM; c->pInput = pInput; @@ -179004,10 +179004,10 @@ static int simpleOpen( ** Close a tokenization cursor previously opened by a call to ** simpleOpen() above. */ -static int simpleClose(sqlite3_tokenizer_cursor *pCursor){ +static int simpleClose(tdsqlite3_tokenizer_cursor *pCursor){ simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor; - sqlite3_free(c->pToken); - sqlite3_free(c); + tdsqlite3_free(c->pToken); + tdsqlite3_free(c); return SQLITE_OK; } @@ -179016,7 +179016,7 @@ static int simpleClose(sqlite3_tokenizer_cursor *pCursor){ ** have been opened by a prior call to simpleOpen(). */ static int simpleNext( - sqlite3_tokenizer_cursor *pCursor, /* Cursor returned by simpleOpen */ + tdsqlite3_tokenizer_cursor *pCursor, /* Cursor returned by simpleOpen */ const char **ppToken, /* OUT: *ppToken is the token text */ int *pnBytes, /* OUT: Number of bytes in token */ int *piStartOffset, /* OUT: Starting offset of token */ @@ -179046,7 +179046,7 @@ static int simpleNext( if( n>c->nTokenAllocated ){ char *pNew; c->nTokenAllocated = n+20; - pNew = sqlite3_realloc(c->pToken, c->nTokenAllocated); + pNew = tdsqlite3_realloc(c->pToken, c->nTokenAllocated); if( !pNew ) return SQLITE_NOMEM; c->pToken = pNew; } @@ -179072,7 +179072,7 @@ static int simpleNext( /* ** The set of routines that implement the simple tokenizer */ -static const sqlite3_tokenizer_module simpleTokenizerModule = { +static const tdsqlite3_tokenizer_module simpleTokenizerModule = { 0, simpleCreate, simpleDestroy, @@ -179086,8 +179086,8 @@ static const sqlite3_tokenizer_module simpleTokenizerModule = { ** Allocate a new simple tokenizer. Return a pointer to the new ** tokenizer in *ppModule */ -SQLITE_PRIVATE void sqlite3Fts3SimpleTokenizerModule( - sqlite3_tokenizer_module const**ppModule +SQLITE_PRIVATE void tdsqlite3Fts3SimpleTokenizerModule( + tdsqlite3_tokenizer_module const**ppModule ){ *ppModule = &simpleTokenizerModule; } @@ -179149,18 +179149,18 @@ typedef struct Fts3tokCursor Fts3tokCursor; ** Virtual table structure. */ struct Fts3tokTable { - sqlite3_vtab base; /* Base class used by SQLite core */ - const sqlite3_tokenizer_module *pMod; - sqlite3_tokenizer *pTok; + tdsqlite3_vtab base; /* Base class used by SQLite core */ + const tdsqlite3_tokenizer_module *pMod; + tdsqlite3_tokenizer *pTok; }; /* ** Virtual table cursor structure. */ struct Fts3tokCursor { - sqlite3_vtab_cursor base; /* Base class used by SQLite core */ + tdsqlite3_vtab_cursor base; /* Base class used by SQLite core */ char *zInput; /* Input string */ - sqlite3_tokenizer_cursor *pCsr; /* Cursor to iterate through zInput */ + tdsqlite3_tokenizer_cursor *pCsr; /* Cursor to iterate through zInput */ int iRowid; /* Current 'rowid' value */ const char *zToken; /* Current 'token' value */ int nToken; /* Size of zToken in bytes */ @@ -179175,15 +179175,15 @@ struct Fts3tokCursor { static int fts3tokQueryTokenizer( Fts3Hash *pHash, const char *zName, - const sqlite3_tokenizer_module **pp, + const tdsqlite3_tokenizer_module **pp, char **pzErr ){ - sqlite3_tokenizer_module *p; + tdsqlite3_tokenizer_module *p; int nName = (int)strlen(zName); - p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1); + p = (tdsqlite3_tokenizer_module *)tdsqlite3Fts3HashFind(pHash, zName, nName+1); if( !p ){ - sqlite3Fts3ErrMsg(pzErr, "unknown tokenizer: %s", zName); + tdsqlite3Fts3ErrMsg(pzErr, "unknown tokenizer: %s", zName); return SQLITE_ERROR; } @@ -179199,7 +179199,7 @@ static int fts3tokQueryTokenizer( ** ** If successful, output parameter *pazDequote is set to point at the ** array of dequoted strings and SQLITE_OK is returned. The caller is -** responsible for eventually calling sqlite3_free() to free the array +** responsible for eventually calling tdsqlite3_free() to free the array ** in this case. Or, if an error occurs, an SQLite error code is returned. ** The final value of *pazDequote is undefined in this case. */ @@ -179220,7 +179220,7 @@ static int fts3tokDequoteArray( nByte += (int)(strlen(argv[i]) + 1); } - *pazDequote = azDequote = sqlite3_malloc64(sizeof(char *)*argc + nByte); + *pazDequote = azDequote = tdsqlite3_malloc64(sizeof(char *)*argc + nByte); if( azDequote==0 ){ rc = SQLITE_NOMEM; }else{ @@ -179229,7 +179229,7 @@ static int fts3tokDequoteArray( int n = (int)strlen(argv[i]); azDequote[i] = pSpace; memcpy(pSpace, argv[i], n+1); - sqlite3Fts3Dequote(pSpace); + tdsqlite3Fts3Dequote(pSpace); pSpace += (n+1); } } @@ -179254,21 +179254,21 @@ static int fts3tokDequoteArray( ** argv[3]: first argument (tokenizer name) */ static int fts3tokConnectMethod( - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ void *pHash, /* Hash table of tokenizers */ int argc, /* Number of elements in argv array */ const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ - char **pzErr /* OUT: sqlite3_malloc'd error message */ + tdsqlite3_vtab **ppVtab, /* OUT: New tdsqlite3_vtab object */ + char **pzErr /* OUT: tdsqlite3_malloc'd error message */ ){ Fts3tokTable *pTab = 0; - const sqlite3_tokenizer_module *pMod = 0; - sqlite3_tokenizer *pTok = 0; + const tdsqlite3_tokenizer_module *pMod = 0; + tdsqlite3_tokenizer *pTok = 0; int rc; char **azDequote = 0; int nDequote; - rc = sqlite3_declare_vtab(db, FTS3_TOK_SCHEMA); + rc = tdsqlite3_declare_vtab(db, FTS3_TOK_SCHEMA); if( rc!=SQLITE_OK ) return rc; nDequote = argc-3; @@ -179291,7 +179291,7 @@ static int fts3tokConnectMethod( } if( rc==SQLITE_OK ){ - pTab = (Fts3tokTable *)sqlite3_malloc(sizeof(Fts3tokTable)); + pTab = (Fts3tokTable *)tdsqlite3_malloc(sizeof(Fts3tokTable)); if( pTab==0 ){ rc = SQLITE_NOMEM; } @@ -179308,7 +179308,7 @@ static int fts3tokConnectMethod( } } - sqlite3_free(azDequote); + tdsqlite3_free(azDequote); return rc; } @@ -179317,11 +179317,11 @@ static int fts3tokConnectMethod( ** These tables have no persistent representation of their own, so xDisconnect ** and xDestroy are identical operations. */ -static int fts3tokDisconnectMethod(sqlite3_vtab *pVtab){ +static int fts3tokDisconnectMethod(tdsqlite3_vtab *pVtab){ Fts3tokTable *pTab = (Fts3tokTable *)pVtab; pTab->pMod->xDestroy(pTab->pTok); - sqlite3_free(pTab); + tdsqlite3_free(pTab); return SQLITE_OK; } @@ -179329,8 +179329,8 @@ static int fts3tokDisconnectMethod(sqlite3_vtab *pVtab){ ** xBestIndex - Analyze a WHERE and ORDER BY clause. */ static int fts3tokBestIndexMethod( - sqlite3_vtab *pVTab, - sqlite3_index_info *pInfo + tdsqlite3_vtab *pVTab, + tdsqlite3_index_info *pInfo ){ int i; UNUSED_PARAMETER(pVTab); @@ -179357,17 +179357,17 @@ static int fts3tokBestIndexMethod( /* ** xOpen - Open a cursor. */ -static int fts3tokOpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){ +static int fts3tokOpenMethod(tdsqlite3_vtab *pVTab, tdsqlite3_vtab_cursor **ppCsr){ Fts3tokCursor *pCsr; UNUSED_PARAMETER(pVTab); - pCsr = (Fts3tokCursor *)sqlite3_malloc(sizeof(Fts3tokCursor)); + pCsr = (Fts3tokCursor *)tdsqlite3_malloc(sizeof(Fts3tokCursor)); if( pCsr==0 ){ return SQLITE_NOMEM; } memset(pCsr, 0, sizeof(Fts3tokCursor)); - *ppCsr = (sqlite3_vtab_cursor *)pCsr; + *ppCsr = (tdsqlite3_vtab_cursor *)pCsr; return SQLITE_OK; } @@ -179381,7 +179381,7 @@ static void fts3tokResetCursor(Fts3tokCursor *pCsr){ pTab->pMod->xClose(pCsr->pCsr); pCsr->pCsr = 0; } - sqlite3_free(pCsr->zInput); + tdsqlite3_free(pCsr->zInput); pCsr->zInput = 0; pCsr->zToken = 0; pCsr->nToken = 0; @@ -179394,18 +179394,18 @@ static void fts3tokResetCursor(Fts3tokCursor *pCsr){ /* ** xClose - Close a cursor. */ -static int fts3tokCloseMethod(sqlite3_vtab_cursor *pCursor){ +static int fts3tokCloseMethod(tdsqlite3_vtab_cursor *pCursor){ Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor; fts3tokResetCursor(pCsr); - sqlite3_free(pCsr); + tdsqlite3_free(pCsr); return SQLITE_OK; } /* ** xNext - Advance the cursor to the next row, if any. */ -static int fts3tokNextMethod(sqlite3_vtab_cursor *pCursor){ +static int fts3tokNextMethod(tdsqlite3_vtab_cursor *pCursor){ Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor; Fts3tokTable *pTab = (Fts3tokTable *)(pCursor->pVtab); int rc; /* Return code */ @@ -179428,11 +179428,11 @@ static int fts3tokNextMethod(sqlite3_vtab_cursor *pCursor){ ** xFilter - Initialize a cursor to point at the start of its data. */ static int fts3tokFilterMethod( - sqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ + tdsqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ int idxNum, /* Strategy index */ const char *idxStr, /* Unused */ int nVal, /* Number of elements in apVal */ - sqlite3_value **apVal /* Arguments for the indexing scheme */ + tdsqlite3_value **apVal /* Arguments for the indexing scheme */ ){ int rc = SQLITE_ERROR; Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor; @@ -179442,9 +179442,9 @@ static int fts3tokFilterMethod( fts3tokResetCursor(pCsr); if( idxNum==1 ){ - const char *zByte = (const char *)sqlite3_value_text(apVal[0]); - int nByte = sqlite3_value_bytes(apVal[0]); - pCsr->zInput = sqlite3_malloc64(nByte+1); + const char *zByte = (const char *)tdsqlite3_value_text(apVal[0]); + int nByte = tdsqlite3_value_bytes(apVal[0]); + pCsr->zInput = tdsqlite3_malloc64(nByte+1); if( pCsr->zInput==0 ){ rc = SQLITE_NOMEM; }else{ @@ -179464,7 +179464,7 @@ static int fts3tokFilterMethod( /* ** xEof - Return true if the cursor is at EOF, or false otherwise. */ -static int fts3tokEofMethod(sqlite3_vtab_cursor *pCursor){ +static int fts3tokEofMethod(tdsqlite3_vtab_cursor *pCursor){ Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor; return (pCsr->zToken==0); } @@ -179473,8 +179473,8 @@ static int fts3tokEofMethod(sqlite3_vtab_cursor *pCursor){ ** xColumn - Return a column value. */ static int fts3tokColumnMethod( - sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ - sqlite3_context *pCtx, /* Context for sqlite3_result_xxx() calls */ + tdsqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ + tdsqlite3_context *pCtx, /* Context for tdsqlite3_result_xxx() calls */ int iCol /* Index of column to read value from */ ){ Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor; @@ -179482,20 +179482,20 @@ static int fts3tokColumnMethod( /* CREATE TABLE x(input, token, start, end, position) */ switch( iCol ){ case 0: - sqlite3_result_text(pCtx, pCsr->zInput, -1, SQLITE_TRANSIENT); + tdsqlite3_result_text(pCtx, pCsr->zInput, -1, SQLITE_TRANSIENT); break; case 1: - sqlite3_result_text(pCtx, pCsr->zToken, pCsr->nToken, SQLITE_TRANSIENT); + tdsqlite3_result_text(pCtx, pCsr->zToken, pCsr->nToken, SQLITE_TRANSIENT); break; case 2: - sqlite3_result_int(pCtx, pCsr->iStart); + tdsqlite3_result_int(pCtx, pCsr->iStart); break; case 3: - sqlite3_result_int(pCtx, pCsr->iEnd); + tdsqlite3_result_int(pCtx, pCsr->iEnd); break; default: assert( iCol==4 ); - sqlite3_result_int(pCtx, pCsr->iPos); + tdsqlite3_result_int(pCtx, pCsr->iPos); break; } return SQLITE_OK; @@ -179505,20 +179505,20 @@ static int fts3tokColumnMethod( ** xRowid - Return the current rowid for the cursor. */ static int fts3tokRowidMethod( - sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ + tdsqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ sqlite_int64 *pRowid /* OUT: Rowid value */ ){ Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor; - *pRowid = (sqlite3_int64)pCsr->iRowid; + *pRowid = (tdsqlite3_int64)pCsr->iRowid; return SQLITE_OK; } /* ** Register the fts3tok module with database connection db. Return SQLITE_OK -** if successful or an error code if sqlite3_create_module() fails. +** if successful or an error code if tdsqlite3_create_module() fails. */ -SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){ - static const sqlite3_module fts3tok_module = { +SQLITE_PRIVATE int tdsqlite3Fts3InitTok(tdsqlite3 *db, Fts3Hash *pHash){ + static const tdsqlite3_module fts3tok_module = { 0, /* iVersion */ fts3tokConnectMethod, /* xCreate */ fts3tokConnectMethod, /* xConnect */ @@ -179546,7 +179546,7 @@ SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){ }; int rc; /* Return code */ - rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, (void*)pHash); + rc = tdsqlite3_create_module(db, "fts3tokenize", &fts3tok_module, (void*)pHash); return rc; } @@ -179631,14 +179631,14 @@ int test_fts3_node_chunk_threshold = (4*1024)*4; #define FTS_STAT_AUTOINCRMERGE 2 /* -** If FTS_LOG_MERGES is defined, call sqlite3_log() to report each automatic +** If FTS_LOG_MERGES is defined, call tdsqlite3_log() to report each automatic ** and incremental merge operation that takes place. This is used for ** debugging FTS only, it should not usually be turned on in production ** systems. */ #ifdef FTS3_LOG_MERGES -static void fts3LogMerge(int nMerge, sqlite3_int64 iAbsLevel){ - sqlite3_log(SQLITE_OK, "%d-way merge from level %d", nMerge, (int)iAbsLevel); +static void fts3LogMerge(int nMerge, tdsqlite3_int64 iAbsLevel){ + tdsqlite3_log(SQLITE_OK, "%d-way merge from level %d", nMerge, (int)iAbsLevel); } #else #define fts3LogMerge(x, y) @@ -179657,9 +179657,9 @@ struct PendingList { int nData; char *aData; int nSpace; - sqlite3_int64 iLastDocid; - sqlite3_int64 iLastCol; - sqlite3_int64 iLastPos; + tdsqlite3_int64 iLastDocid; + tdsqlite3_int64 iLastCol; + tdsqlite3_int64 iLastPos; }; @@ -179680,9 +179680,9 @@ struct Fts3DeferredToken { ** of type Fts3SegReader* are also used by code in fts3.c to iterate through ** terms when querying the full-text index. See functions: ** -** sqlite3Fts3SegReaderNew() -** sqlite3Fts3SegReaderFree() -** sqlite3Fts3SegReaderIterate() +** tdsqlite3Fts3SegReaderNew() +** tdsqlite3Fts3SegReaderFree() +** tdsqlite3Fts3SegReaderIterate() ** ** Methods used to manipulate Fts3SegReader structures: ** @@ -179695,15 +179695,15 @@ struct Fts3SegReader { u8 bLookup; /* True for a lookup only */ u8 rootOnly; /* True for a root-only reader */ - sqlite3_int64 iStartBlock; /* Rowid of first leaf block to traverse */ - sqlite3_int64 iLeafEndBlock; /* Rowid of final leaf block to traverse */ - sqlite3_int64 iEndBlock; /* Rowid of final block in segment (or 0) */ - sqlite3_int64 iCurrentBlock; /* Current leaf block (or 0) */ + tdsqlite3_int64 iStartBlock; /* Rowid of first leaf block to traverse */ + tdsqlite3_int64 iLeafEndBlock; /* Rowid of final leaf block to traverse */ + tdsqlite3_int64 iEndBlock; /* Rowid of final block in segment (or 0) */ + tdsqlite3_int64 iCurrentBlock; /* Current leaf block (or 0) */ char *aNode; /* Pointer to node data (or NULL) */ int nNode; /* Size of buffer at aNode (or 0) */ int nPopulate; /* If >0, bytes of buffer aNode[] loaded */ - sqlite3_blob *pBlob; /* If not NULL, blob handle to read node */ + tdsqlite3_blob *pBlob; /* If not NULL, blob handle to read node */ Fts3HashElem **ppNextElem; @@ -179723,7 +179723,7 @@ struct Fts3SegReader { */ char *pOffsetList; int nOffsetList; /* For descending pending seg-readers only */ - sqlite3_int64 iDocid; + tdsqlite3_int64 iDocid; }; #define fts3SegReaderIsPending(p) ((p)->ppNextElem!=0) @@ -179740,8 +179740,8 @@ struct Fts3SegReader { */ struct SegmentWriter { SegmentNode *pTree; /* Pointer to interior tree structure */ - sqlite3_int64 iFirst; /* First slot in %_segments written */ - sqlite3_int64 iFree; /* Next free slot in %_segments */ + tdsqlite3_int64 iFirst; /* First slot in %_segments written */ + tdsqlite3_int64 iFree; /* Next free slot in %_segments */ char *zTerm; /* Pointer to previous term buffer */ int nTerm; /* Number of bytes in zTerm */ int nMalloc; /* Size of malloc'd buffer at zMalloc */ @@ -179843,8 +179843,8 @@ struct SegmentNode { static int fts3SqlStmt( Fts3Table *p, /* Virtual table handle */ int eStmt, /* One of the SQL_XXX constants above */ - sqlite3_stmt **pp, /* OUT: Statement handle */ - sqlite3_value **apVal /* Values to bind to statement */ + tdsqlite3_stmt **pp, /* OUT: Statement handle */ + tdsqlite3_value **apVal /* Values to bind to statement */ ){ const char *azSql[] = { /* 0 */ "DELETE FROM %Q.'%q_content' WHERE rowid = ?", @@ -179895,7 +179895,7 @@ static int fts3SqlStmt( /* Estimate the upper limit on the number of leaf nodes in a new segment ** created by merging the oldest :2 segments from absolute level :1. See -** function sqlite3Fts3Incrmerge() for details. */ +** function tdsqlite3Fts3Incrmerge() for details. */ /* 29 */ "SELECT 2 * total(1 + leaves_end_block - start_block) " " FROM %Q.'%q_segdir' WHERE level = ? AND idx < ?", @@ -179945,7 +179945,7 @@ static int fts3SqlStmt( }; int rc = SQLITE_OK; - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; assert( SizeofArray(azSql)==SizeofArray(p->aStmt) ); assert( eStmt=0 ); @@ -179955,27 +179955,27 @@ static int fts3SqlStmt( int f = SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_NO_VTAB; char *zSql; if( eStmt==SQL_CONTENT_INSERT ){ - zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName, p->zWriteExprlist); + zSql = tdsqlite3_mprintf(azSql[eStmt], p->zDb, p->zName, p->zWriteExprlist); }else if( eStmt==SQL_SELECT_CONTENT_BY_ROWID ){ f &= ~SQLITE_PREPARE_NO_VTAB; - zSql = sqlite3_mprintf(azSql[eStmt], p->zReadExprlist); + zSql = tdsqlite3_mprintf(azSql[eStmt], p->zReadExprlist); }else{ - zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName); + zSql = tdsqlite3_mprintf(azSql[eStmt], p->zDb, p->zName); } if( !zSql ){ rc = SQLITE_NOMEM; }else{ - rc = sqlite3_prepare_v3(p->db, zSql, -1, f, &pStmt, NULL); - sqlite3_free(zSql); + rc = tdsqlite3_prepare_v3(p->db, zSql, -1, f, &pStmt, NULL); + tdsqlite3_free(zSql); assert( rc==SQLITE_OK || pStmt==0 ); p->aStmt[eStmt] = pStmt; } } if( apVal ){ int i; - int nParam = sqlite3_bind_parameter_count(pStmt); + int nParam = tdsqlite3_bind_parameter_count(pStmt); for(i=0; rc==SQLITE_OK && inPendingData==0 ){ - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_LEVEL, &pStmt, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_null(pStmt, 1); - sqlite3_step(pStmt); - rc = sqlite3_reset(pStmt); + tdsqlite3_bind_null(pStmt, 1); + tdsqlite3_step(pStmt); + rc = tdsqlite3_reset(pStmt); } } @@ -180116,18 +180116,18 @@ static int fts3Writelock(Fts3Table *p){ ** absolute levels that corresponds to language-id iLangid and index ** iIndex starts at absolute level ((iLangid * (nPrefix+1) + iIndex) * 1024). */ -static sqlite3_int64 getAbsoluteLevel( +static tdsqlite3_int64 getAbsoluteLevel( Fts3Table *p, /* FTS3 table handle */ int iLangid, /* Language id */ int iIndex, /* Index in p->aIndex[] */ int iLevel /* Level of segments */ ){ - sqlite3_int64 iBase; /* First absolute level for iLangid/iIndex */ + tdsqlite3_int64 iBase; /* First absolute level for iLangid/iIndex */ assert_fts3_nc( iLangid>=0 ); assert( p->nIndex>0 ); assert( iIndex>=0 && iIndexnIndex ); - iBase = ((sqlite3_int64)iLangid * p->nIndex + iIndex) * FTS3_SEGDIR_MAXLEVEL; + iBase = ((tdsqlite3_int64)iLangid * p->nIndex + iIndex) * FTS3_SEGDIR_MAXLEVEL; return iBase + iLevel; } @@ -180148,15 +180148,15 @@ static sqlite3_int64 getAbsoluteLevel( ** 3: end_block ** 4: root */ -SQLITE_PRIVATE int sqlite3Fts3AllSegdirs( +SQLITE_PRIVATE int tdsqlite3Fts3AllSegdirs( Fts3Table *p, /* FTS3 table */ int iLangid, /* Language being queried */ int iIndex, /* Index for p->aIndex[] */ int iLevel, /* Level to select (relative level) */ - sqlite3_stmt **ppStmt /* OUT: Compiled statement */ + tdsqlite3_stmt **ppStmt /* OUT: Compiled statement */ ){ int rc; - sqlite3_stmt *pStmt = 0; + tdsqlite3_stmt *pStmt = 0; assert( iLevel==FTS3_SEGCURSOR_ALL || iLevel>=0 ); assert( iLevelnData+FTS3_VARINT_MAX+1>p->nSpace ){ int nNew = p->nSpace * 2; - p = sqlite3_realloc(p, sizeof(*p) + nNew); + p = tdsqlite3_realloc(p, sizeof(*p) + nNew); if( !p ){ - sqlite3_free(*pp); + tdsqlite3_free(*pp); *pp = 0; return SQLITE_NOMEM; } @@ -180224,7 +180224,7 @@ static int fts3PendingListAppendVarint( } /* Append the new serialized varint to the end of the list. */ - p->nData += sqlite3Fts3PutVarint(&p->aData[p->nData], i); + p->nData += tdsqlite3Fts3PutVarint(&p->aData[p->nData], i); p->aData[p->nData] = '\0'; *pp = p; return SQLITE_OK; @@ -180232,7 +180232,7 @@ static int fts3PendingListAppendVarint( /* ** Add a docid/column/position entry to a PendingList structure. Non-zero -** is returned if the structure is sqlite3_realloced as part of adding +** is returned if the structure is tdsqlite3_realloced as part of adding ** the entry. Otherwise, zero. ** ** If an OOM error occurs, *pRc is set to SQLITE_NOMEM before returning. @@ -180241,9 +180241,9 @@ static int fts3PendingListAppendVarint( */ static int fts3PendingListAppend( PendingList **pp, /* IN/OUT: PendingList structure */ - sqlite3_int64 iDocid, /* Docid for entry to add */ - sqlite3_int64 iCol, /* Column for entry to add */ - sqlite3_int64 iPos, /* Position of term for entry to add */ + tdsqlite3_int64 iDocid, /* Docid for entry to add */ + tdsqlite3_int64 iCol, /* Column for entry to add */ + tdsqlite3_int64 iPos, /* Position of term for entry to add */ int *pRc /* OUT: Return code */ ){ PendingList *p = *pp; @@ -180295,7 +180295,7 @@ static int fts3PendingListAppend( ** Free a PendingList object allocated by fts3PendingListAppend(). */ static void fts3PendingListDelete(PendingList *pList){ - sqlite3_free(pList); + tdsqlite3_free(pList); } /* @@ -180322,7 +180322,7 @@ static int fts3PendingTermsAddOne( ** happen if there was no previous entry for this token. */ assert( 0==fts3HashFind(pHash, zToken, nToken) ); - sqlite3_free(pList); + tdsqlite3_free(pList); rc = SQLITE_NOMEM; } } @@ -180355,10 +180355,10 @@ static int fts3PendingTermsAdd( char const *zToken; int nToken = 0; - sqlite3_tokenizer *pTokenizer = p->pTokenizer; - sqlite3_tokenizer_module const *pModule = pTokenizer->pModule; - sqlite3_tokenizer_cursor *pCsr; - int (*xNext)(sqlite3_tokenizer_cursor *pCursor, + tdsqlite3_tokenizer *pTokenizer = p->pTokenizer; + tdsqlite3_tokenizer_module const *pModule = pTokenizer->pModule; + tdsqlite3_tokenizer_cursor *pCsr; + int (*xNext)(tdsqlite3_tokenizer_cursor *pCursor, const char**,int*,int*,int*,int*); assert( pTokenizer && pModule ); @@ -180371,7 +180371,7 @@ static int fts3PendingTermsAdd( return SQLITE_OK; } - rc = sqlite3Fts3OpenTokenizer(pTokenizer, iLangid, zText, -1, &pCsr); + rc = tdsqlite3Fts3OpenTokenizer(pTokenizer, iLangid, zText, -1, &pCsr); if( rc!=SQLITE_OK ){ return rc; } @@ -180437,7 +180437,7 @@ static int fts3PendingTermsDocid( || p->iPrevLangid!=iLangid || p->nPendingData>p->nMaxPendingData ){ - int rc = sqlite3Fts3PendingTermsFlush(p); + int rc = tdsqlite3Fts3PendingTermsFlush(p); if( rc!=SQLITE_OK ) return rc; } p->iPrevDocid = iDocid; @@ -180449,7 +180449,7 @@ static int fts3PendingTermsDocid( /* ** Discard the contents of the pending-terms hash tables. */ -SQLITE_PRIVATE void sqlite3Fts3PendingTermsClear(Fts3Table *p){ +SQLITE_PRIVATE void tdsqlite3Fts3PendingTermsClear(Fts3Table *p){ int i; for(i=0; inIndex; i++){ Fts3HashElem *pElem; @@ -180474,19 +180474,19 @@ SQLITE_PRIVATE void sqlite3Fts3PendingTermsClear(Fts3Table *p){ static int fts3InsertTerms( Fts3Table *p, int iLangid, - sqlite3_value **apVal, + tdsqlite3_value **apVal, u32 *aSz ){ int i; /* Iterator variable */ for(i=2; inColumn+2; i++){ int iCol = i-2; if( p->abNotindexed[iCol]==0 ){ - const char *zText = (const char *)sqlite3_value_text(apVal[i]); + const char *zText = (const char *)tdsqlite3_value_text(apVal[i]); int rc = fts3PendingTermsAdd(p, iLangid, zText, iCol, &aSz[iCol]); if( rc!=SQLITE_OK ){ return rc; } - aSz[p->nColumn] += sqlite3_value_bytes(apVal[i]); + aSz[p->nColumn] += tdsqlite3_value_bytes(apVal[i]); } } return SQLITE_OK; @@ -180508,21 +180508,21 @@ static int fts3InsertTerms( */ static int fts3InsertData( Fts3Table *p, /* Full-text table */ - sqlite3_value **apVal, /* Array of values to insert */ - sqlite3_int64 *piDocid /* OUT: Docid for row just inserted */ + tdsqlite3_value **apVal, /* Array of values to insert */ + tdsqlite3_int64 *piDocid /* OUT: Docid for row just inserted */ ){ int rc; /* Return code */ - sqlite3_stmt *pContentInsert; /* INSERT INTO %_content VALUES(...) */ + tdsqlite3_stmt *pContentInsert; /* INSERT INTO %_content VALUES(...) */ if( p->zContentTbl ){ - sqlite3_value *pRowid = apVal[p->nColumn+3]; - if( sqlite3_value_type(pRowid)==SQLITE_NULL ){ + tdsqlite3_value *pRowid = apVal[p->nColumn+3]; + if( tdsqlite3_value_type(pRowid)==SQLITE_NULL ){ pRowid = apVal[1]; } - if( sqlite3_value_type(pRowid)!=SQLITE_INTEGER ){ + if( tdsqlite3_value_type(pRowid)!=SQLITE_INTEGER ){ return SQLITE_CONSTRAINT; } - *piDocid = sqlite3_value_int64(pRowid); + *piDocid = tdsqlite3_value_int64(pRowid); return SQLITE_OK; } @@ -180536,9 +180536,9 @@ static int fts3InsertData( */ rc = fts3SqlStmt(p, SQL_CONTENT_INSERT, &pContentInsert, &apVal[1]); if( rc==SQLITE_OK && p->zLanguageid ){ - rc = sqlite3_bind_int( + rc = tdsqlite3_bind_int( pContentInsert, p->nColumn+2, - sqlite3_value_int(apVal[p->nColumn+4]) + tdsqlite3_value_int(apVal[p->nColumn+4]) ); } if( rc!=SQLITE_OK ) return rc; @@ -180553,24 +180553,24 @@ static int fts3InsertData( ** In FTS3, this is an error. It is an error to specify non-NULL values ** for both docid and some other rowid alias. */ - if( SQLITE_NULL!=sqlite3_value_type(apVal[3+p->nColumn]) ){ - if( SQLITE_NULL==sqlite3_value_type(apVal[0]) - && SQLITE_NULL!=sqlite3_value_type(apVal[1]) + if( SQLITE_NULL!=tdsqlite3_value_type(apVal[3+p->nColumn]) ){ + if( SQLITE_NULL==tdsqlite3_value_type(apVal[0]) + && SQLITE_NULL!=tdsqlite3_value_type(apVal[1]) ){ /* A rowid/docid conflict. */ return SQLITE_ERROR; } - rc = sqlite3_bind_value(pContentInsert, 1, apVal[3+p->nColumn]); + rc = tdsqlite3_bind_value(pContentInsert, 1, apVal[3+p->nColumn]); if( rc!=SQLITE_OK ) return rc; } /* Execute the statement to insert the record. Set *piDocid to the ** new docid value. */ - sqlite3_step(pContentInsert); - rc = sqlite3_reset(pContentInsert); + tdsqlite3_step(pContentInsert); + rc = tdsqlite3_reset(pContentInsert); - *piDocid = sqlite3_last_insert_rowid(p->db); + *piDocid = tdsqlite3_last_insert_rowid(p->db); return rc; } @@ -180584,7 +180584,7 @@ static int fts3DeleteAll(Fts3Table *p, int bContent){ int rc = SQLITE_OK; /* Return code */ /* Discard the contents of the pending-terms hash table. */ - sqlite3Fts3PendingTermsClear(p); + tdsqlite3Fts3PendingTermsClear(p); /* Delete everything from the shadow tables. Except, leave %_content as ** is if bContent is false. */ @@ -180604,9 +180604,9 @@ static int fts3DeleteAll(Fts3Table *p, int bContent){ /* ** */ -static int langidFromSelect(Fts3Table *p, sqlite3_stmt *pSelect){ +static int langidFromSelect(Fts3Table *p, tdsqlite3_stmt *pSelect){ int iLangid = 0; - if( p->zLanguageid ) iLangid = sqlite3_column_int(pSelect, p->nColumn+1); + if( p->zLanguageid ) iLangid = tdsqlite3_column_int(pSelect, p->nColumn+1); return iLangid; } @@ -180618,40 +180618,40 @@ static int langidFromSelect(Fts3Table *p, sqlite3_stmt *pSelect){ static void fts3DeleteTerms( int *pRC, /* Result code */ Fts3Table *p, /* The FTS table to delete from */ - sqlite3_value *pRowid, /* The docid to be deleted */ + tdsqlite3_value *pRowid, /* The docid to be deleted */ u32 *aSz, /* Sizes of deleted document written here */ int *pbFound /* OUT: Set to true if row really does exist */ ){ int rc; - sqlite3_stmt *pSelect; + tdsqlite3_stmt *pSelect; assert( *pbFound==0 ); if( *pRC ) return; rc = fts3SqlStmt(p, SQL_SELECT_CONTENT_BY_ROWID, &pSelect, &pRowid); if( rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pSelect) ){ + if( SQLITE_ROW==tdsqlite3_step(pSelect) ){ int i; int iLangid = langidFromSelect(p, pSelect); - i64 iDocid = sqlite3_column_int64(pSelect, 0); + i64 iDocid = tdsqlite3_column_int64(pSelect, 0); rc = fts3PendingTermsDocid(p, 1, iLangid, iDocid); for(i=1; rc==SQLITE_OK && i<=p->nColumn; i++){ int iCol = i-1; if( p->abNotindexed[iCol]==0 ){ - const char *zText = (const char *)sqlite3_column_text(pSelect, i); + const char *zText = (const char *)tdsqlite3_column_text(pSelect, i); rc = fts3PendingTermsAdd(p, iLangid, zText, -1, &aSz[iCol]); - aSz[p->nColumn] += sqlite3_column_bytes(pSelect, i); + aSz[p->nColumn] += tdsqlite3_column_bytes(pSelect, i); } } if( rc!=SQLITE_OK ){ - sqlite3_reset(pSelect); + tdsqlite3_reset(pSelect); *pRC = rc; return; } *pbFound = 1; } - rc = sqlite3_reset(pSelect); + rc = tdsqlite3_reset(pSelect); }else{ - sqlite3_reset(pSelect); + tdsqlite3_reset(pSelect); } *pRC = rc; } @@ -180685,7 +180685,7 @@ static int fts3AllocateSegdirIdx( int *piIdx ){ int rc; /* Return Code */ - sqlite3_stmt *pNextIdx; /* Query for next idx at level iLevel */ + tdsqlite3_stmt *pNextIdx; /* Query for next idx at level iLevel */ int iNext = 0; /* Result of query pNextIdx */ assert( iLangid>=0 ); @@ -180694,13 +180694,13 @@ static int fts3AllocateSegdirIdx( /* Set variable iNext to the next available segdir index at level iLevel. */ rc = fts3SqlStmt(p, SQL_NEXT_SEGMENT_INDEX, &pNextIdx, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int64( + tdsqlite3_bind_int64( pNextIdx, 1, getAbsoluteLevel(p, iLangid, iIndex, iLevel) ); - if( SQLITE_ROW==sqlite3_step(pNextIdx) ){ - iNext = sqlite3_column_int(pNextIdx, 0); + if( SQLITE_ROW==tdsqlite3_step(pNextIdx) ){ + iNext = tdsqlite3_column_int(pNextIdx, 0); } - rc = sqlite3_reset(pNextIdx); + rc = tdsqlite3_reset(pNextIdx); } if( rc==SQLITE_OK ){ @@ -180728,7 +180728,7 @@ static int fts3AllocateSegdirIdx( ** ** This function reads data from a single row of the %_segments table. The ** specific row is identified by the iBlockid parameter. If paBlob is not -** NULL, then a buffer is allocated using sqlite3_malloc() and populated +** NULL, then a buffer is allocated using tdsqlite3_malloc() and populated ** with the contents of the blob stored in the "block" column of the ** identified table row is. Whether or not paBlob is NULL, *pnBlob is set ** to the size of the blob in bytes before returning. @@ -180738,19 +180738,19 @@ static int fts3AllocateSegdirIdx( ** paBlob is non-NULL, then it is the responsibility of the caller to ** eventually free the returned buffer. ** -** This function may leave an open sqlite3_blob* handle in the +** This function may leave an open tdsqlite3_blob* handle in the ** Fts3Table.pSegments variable. This handle is reused by subsequent calls ** to this function. The handle may be closed by calling the -** sqlite3Fts3SegmentsClose() function. Reusing a blob handle is a handy +** tdsqlite3Fts3SegmentsClose() function. Reusing a blob handle is a handy ** performance improvement, but the blob handle should always be closed ** before control is returned to the user (to prevent a lock being held ** on the database file for longer than necessary). Thus, any virtual table ** method (xFilter etc.) that may directly or indirectly call this function -** must call sqlite3Fts3SegmentsClose() before returning. +** must call tdsqlite3Fts3SegmentsClose() before returning. */ -SQLITE_PRIVATE int sqlite3Fts3ReadBlock( +SQLITE_PRIVATE int tdsqlite3Fts3ReadBlock( Fts3Table *p, /* FTS3 table handle */ - sqlite3_int64 iBlockid, /* Access the row with blockid=$iBlockid */ + tdsqlite3_int64 iBlockid, /* Access the row with blockid=$iBlockid */ char **paBlob, /* OUT: Blob data in malloc'd buffer */ int *pnBlob, /* OUT: Size of blob data */ int *pnLoad /* OUT: Bytes actually loaded */ @@ -180761,22 +180761,22 @@ SQLITE_PRIVATE int sqlite3Fts3ReadBlock( assert( pnBlob ); if( p->pSegments ){ - rc = sqlite3_blob_reopen(p->pSegments, iBlockid); + rc = tdsqlite3_blob_reopen(p->pSegments, iBlockid); }else{ if( 0==p->zSegmentsTbl ){ - p->zSegmentsTbl = sqlite3_mprintf("%s_segments", p->zName); + p->zSegmentsTbl = tdsqlite3_mprintf("%s_segments", p->zName); if( 0==p->zSegmentsTbl ) return SQLITE_NOMEM; } - rc = sqlite3_blob_open( + rc = tdsqlite3_blob_open( p->db, p->zDb, p->zSegmentsTbl, "block", iBlockid, 0, &p->pSegments ); } if( rc==SQLITE_OK ){ - int nByte = sqlite3_blob_bytes(p->pSegments); + int nByte = tdsqlite3_blob_bytes(p->pSegments); *pnBlob = nByte; if( paBlob ){ - char *aByte = sqlite3_malloc(nByte + FTS3_NODE_PADDING); + char *aByte = tdsqlite3_malloc(nByte + FTS3_NODE_PADDING); if( !aByte ){ rc = SQLITE_NOMEM; }else{ @@ -180784,10 +180784,10 @@ SQLITE_PRIVATE int sqlite3Fts3ReadBlock( nByte = FTS3_NODE_CHUNKSIZE; *pnLoad = nByte; } - rc = sqlite3_blob_read(p->pSegments, aByte, nByte, 0); + rc = tdsqlite3_blob_read(p->pSegments, aByte, nByte, 0); memset(&aByte[nByte], 0, FTS3_NODE_PADDING); if( rc!=SQLITE_OK ){ - sqlite3_free(aByte); + tdsqlite3_free(aByte); aByte = 0; } } @@ -180802,10 +180802,10 @@ SQLITE_PRIVATE int sqlite3Fts3ReadBlock( /* ** Close the blob handle at p->pSegments, if it is open. See comments above -** the sqlite3Fts3ReadBlock() function for details. +** the tdsqlite3Fts3ReadBlock() function for details. */ -SQLITE_PRIVATE void sqlite3Fts3SegmentsClose(Fts3Table *p){ - sqlite3_blob_close(p->pSegments); +SQLITE_PRIVATE void tdsqlite3Fts3SegmentsClose(Fts3Table *p){ + tdsqlite3_blob_close(p->pSegments); p->pSegments = 0; } @@ -180814,7 +180814,7 @@ static int fts3SegReaderIncrRead(Fts3SegReader *pReader){ int rc; /* Return code */ nRead = MIN(pReader->nNode - pReader->nPopulate, FTS3_NODE_CHUNKSIZE); - rc = sqlite3_blob_read( + rc = tdsqlite3_blob_read( pReader->pBlob, &pReader->aNode[pReader->nPopulate], nRead, @@ -180825,7 +180825,7 @@ static int fts3SegReaderIncrRead(Fts3SegReader *pReader){ pReader->nPopulate += nRead; memset(&pReader->aNode[pReader->nPopulate], 0, FTS3_NODE_PADDING); if( pReader->nPopulate==pReader->nNode ){ - sqlite3_blob_close(pReader->pBlob); + tdsqlite3_blob_close(pReader->pBlob); pReader->pBlob = 0; pReader->nPopulate = 0; } @@ -180851,8 +180851,8 @@ static int fts3SegReaderRequire(Fts3SegReader *pReader, char *pFrom, int nByte){ */ static void fts3SegReaderSetEof(Fts3SegReader *pSeg){ if( !fts3SegReaderIsRootOnly(pSeg) ){ - sqlite3_free(pSeg->aNode); - sqlite3_blob_close(pSeg->pBlob); + tdsqlite3_free(pSeg->aNode); + tdsqlite3_blob_close(pSeg->pBlob); pSeg->pBlob = 0; } pSeg->aNode = 0; @@ -180883,7 +180883,7 @@ static int fts3SegReaderNext( if( fts3SegReaderIsPending(pReader) ){ Fts3HashElem *pElem = *(pReader->ppNextElem); - sqlite3_free(pReader->aNode); + tdsqlite3_free(pReader->aNode); pReader->aNode = 0; if( pElem ){ char *aCopy; @@ -180891,7 +180891,7 @@ static int fts3SegReaderNext( int nCopy = pList->nData+1; pReader->zTerm = (char *)fts3HashKey(pElem); pReader->nTerm = fts3HashKeysize(pElem); - aCopy = (char*)sqlite3_malloc(nCopy); + aCopy = (char*)tdsqlite3_malloc(nCopy); if( !aCopy ) return SQLITE_NOMEM; memcpy(aCopy, pList->aData, nCopy); pReader->nNode = pReader->nDoclist = nCopy; @@ -180913,7 +180913,7 @@ static int fts3SegReaderNext( return SQLITE_OK; } - rc = sqlite3Fts3ReadBlock( + rc = tdsqlite3Fts3ReadBlock( p, ++pReader->iCurrentBlock, &pReader->aNode, &pReader->nNode, (bIncr ? &pReader->nPopulate : 0) ); @@ -180947,7 +180947,7 @@ static int fts3SegReaderNext( ** overflow - hence the (i64) casts. */ if( (i64)nPrefix+nSuffix>(i64)pReader->nTermAlloc ){ i64 nNew = ((i64)nPrefix+nSuffix)*2; - char *zNew = sqlite3_realloc64(pReader->zTerm, nNew); + char *zNew = tdsqlite3_realloc64(pReader->zTerm, nNew); if( !zNew ){ return SQLITE_NOMEM; } @@ -180989,14 +180989,14 @@ static int fts3SegReaderFirstDocid(Fts3Table *pTab, Fts3SegReader *pReader){ u8 bEof = 0; pReader->iDocid = 0; pReader->nOffsetList = 0; - sqlite3Fts3DoclistPrev(0, + tdsqlite3Fts3DoclistPrev(0, pReader->aDoclist, pReader->nDoclist, &pReader->pOffsetList, &pReader->iDocid, &pReader->nOffsetList, &bEof ); }else{ rc = fts3SegReaderRequire(pReader, pReader->aDoclist, FTS3_VARINT_MAX); if( rc==SQLITE_OK ){ - int n = sqlite3Fts3GetVarint(pReader->aDoclist, &pReader->iDocid); + int n = tdsqlite3Fts3GetVarint(pReader->aDoclist, &pReader->iDocid); pReader->pOffsetList = &pReader->aDoclist[n]; } } @@ -181034,7 +181034,7 @@ static int fts3SegReaderNextDocid( *ppOffsetList = pReader->pOffsetList; *pnOffsetList = pReader->nOffsetList - 1; } - sqlite3Fts3DoclistPrev(0, + tdsqlite3Fts3DoclistPrev(0, pReader->aDoclist, pReader->nDoclist, &p, &pReader->iDocid, &pReader->nOffsetList, &bEof ); @@ -181088,7 +181088,7 @@ static int fts3SegReaderNextDocid( rc = fts3SegReaderRequire(pReader, p, FTS3_VARINT_MAX); if( rc==SQLITE_OK ){ u64 iDelta; - pReader->pOffsetList = p + sqlite3Fts3GetVarintU(p, &iDelta); + pReader->pOffsetList = p + tdsqlite3Fts3GetVarintU(p, &iDelta); if( pTab->bDescIdx ){ pReader->iDocid = (i64)((u64)pReader->iDocid - iDelta); }else{ @@ -181102,7 +181102,7 @@ static int fts3SegReaderNextDocid( } -SQLITE_PRIVATE int sqlite3Fts3MsrOvfl( +SQLITE_PRIVATE int tdsqlite3Fts3MsrOvfl( Fts3Cursor *pCsr, Fts3MultiSegReader *pMsr, int *pnOvfl @@ -181121,10 +181121,10 @@ SQLITE_PRIVATE int sqlite3Fts3MsrOvfl( if( !fts3SegReaderIsPending(pReader) && !fts3SegReaderIsRootOnly(pReader) ){ - sqlite3_int64 jj; + tdsqlite3_int64 jj; for(jj=pReader->iStartBlock; jj<=pReader->iLeafEndBlock; jj++){ int nBlob; - rc = sqlite3Fts3ReadBlock(p, jj, 0, &nBlob, 0); + rc = tdsqlite3Fts3ReadBlock(p, jj, 0, &nBlob, 0); if( rc!=SQLITE_OK ) break; if( (nBlob+35)>pgsz ){ nOvfl += (nBlob + 34)/pgsz; @@ -181140,28 +181140,28 @@ SQLITE_PRIVATE int sqlite3Fts3MsrOvfl( ** Free all allocations associated with the iterator passed as the ** second argument. */ -SQLITE_PRIVATE void sqlite3Fts3SegReaderFree(Fts3SegReader *pReader){ +SQLITE_PRIVATE void tdsqlite3Fts3SegReaderFree(Fts3SegReader *pReader){ if( pReader ){ if( !fts3SegReaderIsPending(pReader) ){ - sqlite3_free(pReader->zTerm); + tdsqlite3_free(pReader->zTerm); } if( !fts3SegReaderIsRootOnly(pReader) ){ - sqlite3_free(pReader->aNode); + tdsqlite3_free(pReader->aNode); } - sqlite3_blob_close(pReader->pBlob); + tdsqlite3_blob_close(pReader->pBlob); } - sqlite3_free(pReader); + tdsqlite3_free(pReader); } /* ** Allocate a new SegReader object. */ -SQLITE_PRIVATE int sqlite3Fts3SegReaderNew( +SQLITE_PRIVATE int tdsqlite3Fts3SegReaderNew( int iAge, /* Segment "age". */ int bLookup, /* True for a lookup only */ - sqlite3_int64 iStartLeaf, /* First leaf to traverse */ - sqlite3_int64 iEndLeaf, /* Final leaf to traverse */ - sqlite3_int64 iEndBlock, /* Final block of segment */ + tdsqlite3_int64 iStartLeaf, /* First leaf to traverse */ + tdsqlite3_int64 iEndLeaf, /* Final leaf to traverse */ + tdsqlite3_int64 iEndBlock, /* Final block of segment */ const char *zRoot, /* Buffer containing root node */ int nRoot, /* Size of buffer containing root node */ Fts3SegReader **ppReader /* OUT: Allocated Fts3SegReader */ @@ -181179,7 +181179,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderNew( nExtra = nRoot + FTS3_NODE_PADDING; } - pReader = (Fts3SegReader *)sqlite3_malloc(sizeof(Fts3SegReader) + nExtra); + pReader = (Fts3SegReader *)tdsqlite3_malloc(sizeof(Fts3SegReader) + nExtra); if( !pReader ){ return SQLITE_NOMEM; } @@ -181245,7 +181245,7 @@ static int SQLITE_CDECL fts3CompareElemByTerm( ** ** firebird mysql sqlite */ -SQLITE_PRIVATE int sqlite3Fts3SegReaderPending( +SQLITE_PRIVATE int tdsqlite3Fts3SegReaderPending( Fts3Table *p, /* Virtual table handle */ int iIndex, /* Index for p->aIndex */ const char *zTerm, /* Term to search for */ @@ -181271,7 +181271,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderPending( if( nElem==nAlloc ){ Fts3HashElem **aElem2; nAlloc += 16; - aElem2 = (Fts3HashElem **)sqlite3_realloc( + aElem2 = (Fts3HashElem **)tdsqlite3_realloc( aElem, nAlloc*sizeof(Fts3HashElem *) ); if( !aElem2 ){ @@ -181310,9 +181310,9 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderPending( } if( nElem>0 ){ - sqlite3_int64 nByte; + tdsqlite3_int64 nByte; nByte = sizeof(Fts3SegReader) + (nElem+1)*sizeof(Fts3HashElem *); - pReader = (Fts3SegReader *)sqlite3_malloc64(nByte); + pReader = (Fts3SegReader *)tdsqlite3_malloc64(nByte); if( !pReader ){ rc = SQLITE_NOMEM; }else{ @@ -181324,7 +181324,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderPending( } if( bPrefix ){ - sqlite3_free(aElem); + tdsqlite3_free(aElem); } *ppReader = pReader; return rc; @@ -181468,18 +181468,18 @@ static void fts3SegReaderSort( */ static int fts3WriteSegment( Fts3Table *p, /* Virtual table handle */ - sqlite3_int64 iBlock, /* Block id for new block */ + tdsqlite3_int64 iBlock, /* Block id for new block */ char *z, /* Pointer to buffer containing block data */ int n /* Size of buffer z in bytes */ ){ - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; int rc = fts3SqlStmt(p, SQL_INSERT_SEGMENTS, &pStmt, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pStmt, 1, iBlock); - sqlite3_bind_blob(pStmt, 2, z, n, SQLITE_STATIC); - sqlite3_step(pStmt); - rc = sqlite3_reset(pStmt); - sqlite3_bind_null(pStmt, 2); + tdsqlite3_bind_int64(pStmt, 1, iBlock); + tdsqlite3_bind_blob(pStmt, 2, z, n, SQLITE_STATIC); + tdsqlite3_step(pStmt); + rc = tdsqlite3_reset(pStmt); + tdsqlite3_bind_null(pStmt, 2); } return rc; } @@ -181489,17 +181489,17 @@ static int fts3WriteSegment( ** *pnMax to this value and return SQLITE_OK. Otherwise, if an error occurs, ** set *pnMax to zero and return an SQLite error code. */ -SQLITE_PRIVATE int sqlite3Fts3MaxLevel(Fts3Table *p, int *pnMax){ +SQLITE_PRIVATE int tdsqlite3Fts3MaxLevel(Fts3Table *p, int *pnMax){ int rc; int mxLevel = 0; - sqlite3_stmt *pStmt = 0; + tdsqlite3_stmt *pStmt = 0; rc = fts3SqlStmt(p, SQL_SELECT_MXLEVEL, &pStmt, 0); if( rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - mxLevel = sqlite3_column_int(pStmt, 0); + if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + mxLevel = tdsqlite3_column_int(pStmt, 0); } - rc = sqlite3_reset(pStmt); + rc = tdsqlite3_reset(pStmt); } *pnMax = mxLevel; return rc; @@ -181510,33 +181510,33 @@ SQLITE_PRIVATE int sqlite3Fts3MaxLevel(Fts3Table *p, int *pnMax){ */ static int fts3WriteSegdir( Fts3Table *p, /* Virtual table handle */ - sqlite3_int64 iLevel, /* Value for "level" field (absolute level) */ + tdsqlite3_int64 iLevel, /* Value for "level" field (absolute level) */ int iIdx, /* Value for "idx" field */ - sqlite3_int64 iStartBlock, /* Value for "start_block" field */ - sqlite3_int64 iLeafEndBlock, /* Value for "leaves_end_block" field */ - sqlite3_int64 iEndBlock, /* Value for "end_block" field */ - sqlite3_int64 nLeafData, /* Bytes of leaf data in segment */ + tdsqlite3_int64 iStartBlock, /* Value for "start_block" field */ + tdsqlite3_int64 iLeafEndBlock, /* Value for "leaves_end_block" field */ + tdsqlite3_int64 iEndBlock, /* Value for "end_block" field */ + tdsqlite3_int64 nLeafData, /* Bytes of leaf data in segment */ char *zRoot, /* Blob value for "root" field */ int nRoot /* Number of bytes in buffer zRoot */ ){ - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; int rc = fts3SqlStmt(p, SQL_INSERT_SEGDIR, &pStmt, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pStmt, 1, iLevel); - sqlite3_bind_int(pStmt, 2, iIdx); - sqlite3_bind_int64(pStmt, 3, iStartBlock); - sqlite3_bind_int64(pStmt, 4, iLeafEndBlock); + tdsqlite3_bind_int64(pStmt, 1, iLevel); + tdsqlite3_bind_int(pStmt, 2, iIdx); + tdsqlite3_bind_int64(pStmt, 3, iStartBlock); + tdsqlite3_bind_int64(pStmt, 4, iLeafEndBlock); if( nLeafData==0 ){ - sqlite3_bind_int64(pStmt, 5, iEndBlock); + tdsqlite3_bind_int64(pStmt, 5, iEndBlock); }else{ - char *zEnd = sqlite3_mprintf("%lld %lld", iEndBlock, nLeafData); + char *zEnd = tdsqlite3_mprintf("%lld %lld", iEndBlock, nLeafData); if( !zEnd ) return SQLITE_NOMEM; - sqlite3_bind_text(pStmt, 5, zEnd, -1, sqlite3_free); + tdsqlite3_bind_text(pStmt, 5, zEnd, -1, tdsqlite3_free); } - sqlite3_bind_blob(pStmt, 6, zRoot, nRoot, SQLITE_STATIC); - sqlite3_step(pStmt); - rc = sqlite3_reset(pStmt); - sqlite3_bind_null(pStmt, 6); + tdsqlite3_bind_blob(pStmt, 6, zRoot, nRoot, SQLITE_STATIC); + tdsqlite3_step(pStmt); + rc = tdsqlite3_reset(pStmt); + tdsqlite3_bind_null(pStmt, 6); } return rc; } @@ -181593,7 +181593,7 @@ static int fts3NodeAddTerm( ** compared with BINARY collation. This indicates corruption. */ if( nSuffix<=0 ) return FTS_CORRUPT_VTAB; - nReq += sqlite3Fts3VarintLen(nPrefix)+sqlite3Fts3VarintLen(nSuffix)+nSuffix; + nReq += tdsqlite3Fts3VarintLen(nPrefix)+tdsqlite3Fts3VarintLen(nSuffix)+nSuffix; if( nReq<=p->nNodeSize || !pTree->zTerm ){ if( nReq>p->nNodeSize ){ @@ -181605,7 +181605,7 @@ static int fts3NodeAddTerm( ** this is not expected to be a serious problem. */ assert( pTree->aData==(char *)&pTree[1] ); - pTree->aData = (char *)sqlite3_malloc(nReq); + pTree->aData = (char *)tdsqlite3_malloc(nReq); if( !pTree->aData ){ return SQLITE_NOMEM; } @@ -181613,17 +181613,17 @@ static int fts3NodeAddTerm( if( pTree->zTerm ){ /* There is no prefix-length field for first term in a node */ - nData += sqlite3Fts3PutVarint(&pTree->aData[nData], nPrefix); + nData += tdsqlite3Fts3PutVarint(&pTree->aData[nData], nPrefix); } - nData += sqlite3Fts3PutVarint(&pTree->aData[nData], nSuffix); + nData += tdsqlite3Fts3PutVarint(&pTree->aData[nData], nSuffix); memcpy(&pTree->aData[nData], &zTerm[nPrefix], nSuffix); pTree->nData = nData + nSuffix; pTree->nEntry++; if( isCopyTerm ){ if( pTree->nMalloczMalloc, nTerm*2); + char *zNew = tdsqlite3_realloc(pTree->zMalloc, nTerm*2); if( !zNew ){ return SQLITE_NOMEM; } @@ -181649,7 +181649,7 @@ static int fts3NodeAddTerm( ** now. Instead, the term is inserted into the parent of pTree. If pTree ** has no parent, one is created here. */ - pNew = (SegmentNode *)sqlite3_malloc(sizeof(SegmentNode) + p->nNodeSize); + pNew = (SegmentNode *)tdsqlite3_malloc(sizeof(SegmentNode) + p->nNodeSize); if( !pNew ){ return SQLITE_NOMEM; } @@ -181684,13 +181684,13 @@ static int fts3NodeAddTerm( static int fts3TreeFinishNode( SegmentNode *pTree, int iHeight, - sqlite3_int64 iLeftChild + tdsqlite3_int64 iLeftChild ){ int nStart; assert( iHeight>=1 && iHeight<128 ); - nStart = FTS3_VARINT_MAX - sqlite3Fts3VarintLen(iLeftChild); + nStart = FTS3_VARINT_MAX - tdsqlite3Fts3VarintLen(iLeftChild); pTree->aData[nStart] = (char)iHeight; - sqlite3Fts3PutVarint(&pTree->aData[nStart+1], iLeftChild); + tdsqlite3Fts3PutVarint(&pTree->aData[nStart+1], iLeftChild); return nStart; } @@ -181711,9 +181711,9 @@ static int fts3NodeWrite( Fts3Table *p, /* Virtual table handle */ SegmentNode *pTree, /* SegmentNode handle */ int iHeight, /* Height of this node in tree */ - sqlite3_int64 iLeaf, /* Block id of first leaf node */ - sqlite3_int64 iFree, /* Block id of next free slot in %_segments */ - sqlite3_int64 *piLast, /* OUT: Block id of last entry written */ + tdsqlite3_int64 iLeaf, /* Block id of first leaf node */ + tdsqlite3_int64 iFree, /* Block id of next free slot in %_segments */ + tdsqlite3_int64 *piLast, /* OUT: Block id of last entry written */ char **paRoot, /* OUT: Data for root node */ int *pnRoot /* OUT: Size of root node in bytes */ ){ @@ -181727,8 +181727,8 @@ static int fts3NodeWrite( *paRoot = &pTree->aData[nStart]; }else{ SegmentNode *pIter; - sqlite3_int64 iNextFree = iFree; - sqlite3_int64 iNextLeaf = iLeaf; + tdsqlite3_int64 iNextFree = iFree; + tdsqlite3_int64 iNextLeaf = iLeaf; for(pIter=pTree->pLeftmost; pIter && rc==SQLITE_OK; pIter=pIter->pRight){ int nStart = fts3TreeFinishNode(pIter, iHeight, iNextLeaf); int nWrite = pIter->nData - nStart; @@ -181758,11 +181758,11 @@ static void fts3NodeFree(SegmentNode *pTree){ while( p ){ SegmentNode *pRight = p->pRight; if( p->aData!=(char *)&p[1] ){ - sqlite3_free(p->aData); + tdsqlite3_free(p->aData); } assert( pRight==0 || p->zMalloc==0 ); - sqlite3_free(p->zMalloc); - sqlite3_free(p); + tdsqlite3_free(p->zMalloc); + tdsqlite3_free(p); p = pRight; } } @@ -181793,27 +181793,27 @@ static int fts3SegWriterAdd( if( !pWriter ){ int rc; - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; /* Allocate the SegmentWriter structure */ - pWriter = (SegmentWriter *)sqlite3_malloc(sizeof(SegmentWriter)); + pWriter = (SegmentWriter *)tdsqlite3_malloc(sizeof(SegmentWriter)); if( !pWriter ) return SQLITE_NOMEM; memset(pWriter, 0, sizeof(SegmentWriter)); *ppWriter = pWriter; /* Allocate a buffer in which to accumulate data */ - pWriter->aData = (char *)sqlite3_malloc(p->nNodeSize); + pWriter->aData = (char *)tdsqlite3_malloc(p->nNodeSize); if( !pWriter->aData ) return SQLITE_NOMEM; pWriter->nSize = p->nNodeSize; /* Find the next free blockid in the %_segments table */ rc = fts3SqlStmt(p, SQL_NEXT_SEGMENTS_ID, &pStmt, 0); if( rc!=SQLITE_OK ) return rc; - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - pWriter->iFree = sqlite3_column_int64(pStmt, 0); + if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + pWriter->iFree = tdsqlite3_column_int64(pStmt, 0); pWriter->iFirst = pWriter->iFree; } - rc = sqlite3_reset(pStmt); + rc = tdsqlite3_reset(pStmt); if( rc!=SQLITE_OK ) return rc; } nData = pWriter->nData; @@ -181827,10 +181827,10 @@ static int fts3SegWriterAdd( if( nSuffix<=0 ) return FTS_CORRUPT_VTAB; /* Figure out how many bytes are required by this new entry */ - nReq = sqlite3Fts3VarintLen(nPrefix) + /* varint containing prefix size */ - sqlite3Fts3VarintLen(nSuffix) + /* varint containing suffix size */ + nReq = tdsqlite3Fts3VarintLen(nPrefix) + /* varint containing prefix size */ + tdsqlite3Fts3VarintLen(nSuffix) + /* varint containing suffix size */ nSuffix + /* Term suffix */ - sqlite3Fts3VarintLen(nDoclist) + /* Size of doclist */ + tdsqlite3Fts3VarintLen(nDoclist) + /* Size of doclist */ nDoclist; /* Doclist data */ if( nData>0 && nData+nReq>p->nNodeSize ){ @@ -181864,9 +181864,9 @@ static int fts3SegWriterAdd( nPrefix = 0; nSuffix = nTerm; nReq = 1 + /* varint containing prefix size */ - sqlite3Fts3VarintLen(nTerm) + /* varint containing suffix size */ + tdsqlite3Fts3VarintLen(nTerm) + /* varint containing suffix size */ nTerm + /* Term suffix */ - sqlite3Fts3VarintLen(nDoclist) + /* Size of doclist */ + tdsqlite3Fts3VarintLen(nDoclist) + /* Size of doclist */ nDoclist; /* Doclist data */ } @@ -181877,7 +181877,7 @@ static int fts3SegWriterAdd( ** the buffer to make it large enough. */ if( nReq>pWriter->nSize ){ - char *aNew = sqlite3_realloc(pWriter->aData, nReq); + char *aNew = tdsqlite3_realloc(pWriter->aData, nReq); if( !aNew ) return SQLITE_NOMEM; pWriter->aData = aNew; pWriter->nSize = nReq; @@ -181885,12 +181885,12 @@ static int fts3SegWriterAdd( assert( nData+nReq<=pWriter->nSize ); /* Append the prefix-compressed term and doclist to the buffer. */ - nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nPrefix); - nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nSuffix); + nData += tdsqlite3Fts3PutVarint(&pWriter->aData[nData], nPrefix); + nData += tdsqlite3Fts3PutVarint(&pWriter->aData[nData], nSuffix); assert( nSuffix>0 ); memcpy(&pWriter->aData[nData], &zTerm[nPrefix], nSuffix); nData += nSuffix; - nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nDoclist); + nData += tdsqlite3Fts3PutVarint(&pWriter->aData[nData], nDoclist); assert( nDoclist>0 ); memcpy(&pWriter->aData[nData], aDoclist, nDoclist); pWriter->nData = nData + nDoclist; @@ -181902,7 +181902,7 @@ static int fts3SegWriterAdd( */ if( isCopyTerm ){ if( nTerm>pWriter->nMalloc ){ - char *zNew = sqlite3_realloc(pWriter->zMalloc, nTerm*2); + char *zNew = tdsqlite3_realloc(pWriter->zMalloc, nTerm*2); if( !zNew ){ return SQLITE_NOMEM; } @@ -181930,13 +181930,13 @@ static int fts3SegWriterAdd( static int fts3SegWriterFlush( Fts3Table *p, /* Virtual table handle */ SegmentWriter *pWriter, /* SegmentWriter to flush to the db */ - sqlite3_int64 iLevel, /* Value for 'level' column of %_segdir */ + tdsqlite3_int64 iLevel, /* Value for 'level' column of %_segdir */ int iIdx /* Value for 'idx' column of %_segdir */ ){ int rc; /* Return code */ if( pWriter->pTree ){ - sqlite3_int64 iLast = 0; /* Largest block id written to database */ - sqlite3_int64 iLastLeaf; /* Largest leaf block id written to db */ + tdsqlite3_int64 iLast = 0; /* Largest block id written to database */ + tdsqlite3_int64 iLastLeaf; /* Largest leaf block id written to db */ char *zRoot = NULL; /* Pointer to buffer containing root node */ int nRoot = 0; /* Size of buffer zRoot */ @@ -181965,10 +181965,10 @@ static int fts3SegWriterFlush( */ static void fts3SegWriterFree(SegmentWriter *pWriter){ if( pWriter ){ - sqlite3_free(pWriter->aData); - sqlite3_free(pWriter->zMalloc); + tdsqlite3_free(pWriter->aData); + tdsqlite3_free(pWriter->zMalloc); fts3NodeFree(pWriter->pTree); - sqlite3_free(pWriter); + tdsqlite3_free(pWriter); } } @@ -181982,8 +181982,8 @@ static void fts3SegWriterFree(SegmentWriter *pWriter){ ** document pRowid, or false otherwise, and SQLITE_OK is returned. If an ** error occurs, an SQLite error code is returned. */ -static int fts3IsEmpty(Fts3Table *p, sqlite3_value *pRowid, int *pisEmpty){ - sqlite3_stmt *pStmt; +static int fts3IsEmpty(Fts3Table *p, tdsqlite3_value *pRowid, int *pisEmpty){ + tdsqlite3_stmt *pStmt; int rc; if( p->zContentTbl ){ /* If using the content=xxx option, assume the table is never empty */ @@ -181992,10 +181992,10 @@ static int fts3IsEmpty(Fts3Table *p, sqlite3_value *pRowid, int *pisEmpty){ }else{ rc = fts3SqlStmt(p, SQL_IS_EMPTY, &pStmt, &pRowid); if( rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - *pisEmpty = sqlite3_column_int(pStmt, 0); + if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + *pisEmpty = tdsqlite3_column_int(pStmt, 0); } - rc = sqlite3_reset(pStmt); + rc = tdsqlite3_reset(pStmt); } } return rc; @@ -182013,9 +182013,9 @@ static int fts3SegmentMaxLevel( Fts3Table *p, int iLangid, int iIndex, - sqlite3_int64 *pnMax + tdsqlite3_int64 *pnMax ){ - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; int rc; assert( iIndex>=0 && iIndexnIndex ); @@ -182027,14 +182027,14 @@ static int fts3SegmentMaxLevel( */ rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR_MAX_LEVEL, &pStmt, 0); if( rc!=SQLITE_OK ) return rc; - sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); - sqlite3_bind_int64(pStmt, 2, + tdsqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); + tdsqlite3_bind_int64(pStmt, 2, getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) ); - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - *pnMax = sqlite3_column_int64(pStmt, 0); + if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + *pnMax = tdsqlite3_column_int64(pStmt, 0); } - return sqlite3_reset(pStmt); + return tdsqlite3_reset(pStmt); } /* @@ -182053,19 +182053,19 @@ static int fts3SegmentIsMaxLevel(Fts3Table *p, i64 iAbsLevel, int *pbMax){ ** ** (1024 is actually the value of macro FTS3_SEGDIR_PREFIXLEVEL_STR). */ - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; int rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR_MAX_LEVEL, &pStmt, 0); if( rc!=SQLITE_OK ) return rc; - sqlite3_bind_int64(pStmt, 1, iAbsLevel+1); - sqlite3_bind_int64(pStmt, 2, + tdsqlite3_bind_int64(pStmt, 1, iAbsLevel+1); + tdsqlite3_bind_int64(pStmt, 2, ((iAbsLevel/FTS3_SEGDIR_MAXLEVEL)+1) * FTS3_SEGDIR_MAXLEVEL ); *pbMax = 0; - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - *pbMax = sqlite3_column_type(pStmt, 0)==SQLITE_NULL; + if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + *pbMax = tdsqlite3_column_type(pStmt, 0)==SQLITE_NULL; } - return sqlite3_reset(pStmt); + return tdsqlite3_reset(pStmt); } /* @@ -182079,13 +182079,13 @@ static int fts3DeleteSegment( ){ int rc = SQLITE_OK; /* Return code */ if( pSeg->iStartBlock ){ - sqlite3_stmt *pDelete; /* SQL statement to delete rows */ + tdsqlite3_stmt *pDelete; /* SQL statement to delete rows */ rc = fts3SqlStmt(p, SQL_DELETE_SEGMENTS_RANGE, &pDelete, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pDelete, 1, pSeg->iStartBlock); - sqlite3_bind_int64(pDelete, 2, pSeg->iEndBlock); - sqlite3_step(pDelete); - rc = sqlite3_reset(pDelete); + tdsqlite3_bind_int64(pDelete, 1, pSeg->iStartBlock); + tdsqlite3_bind_int64(pDelete, 2, pSeg->iEndBlock); + tdsqlite3_step(pDelete); + rc = tdsqlite3_reset(pDelete); } } return rc; @@ -182115,7 +182115,7 @@ static int fts3DeleteSegdir( ){ int rc = SQLITE_OK; /* Return Code */ int i; /* Iterator variable */ - sqlite3_stmt *pDelete = 0; /* SQL statement to delete rows */ + tdsqlite3_stmt *pDelete = 0; /* SQL statement to delete rows */ for(i=0; rc==SQLITE_OK && ipMsr->nBuffer ){ char *pNew; pMsr->nBuffer = nList*2; - pNew = (char *)sqlite3_realloc(pMsr->aBuffer, pMsr->nBuffer); + pNew = (char *)tdsqlite3_realloc(pMsr->aBuffer, pMsr->nBuffer); if( !pNew ) return SQLITE_NOMEM; pMsr->aBuffer = pNew; } @@ -182225,10 +182225,10 @@ static int fts3MsrBufferData( return SQLITE_OK; } -SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext( +SQLITE_PRIVATE int tdsqlite3Fts3MsrIncrNext( Fts3Table *p, /* Virtual table handle */ Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */ - sqlite3_int64 *piDocid, /* OUT: Docid value */ + tdsqlite3_int64 *piDocid, /* OUT: Docid value */ char **paPoslist, /* OUT: Pointer to position list */ int *pnPoslist /* OUT: Size of position list in bytes */ ){ @@ -182255,7 +182255,7 @@ SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext( char *pList; int nList; int j; - sqlite3_int64 iDocid = apSegment[0]->iDocid; + tdsqlite3_int64 iDocid = apSegment[0]->iDocid; rc = fts3SegReaderNextDocid(p, apSegment[0], &pList, &nList); j = 1; @@ -182325,7 +182325,7 @@ static int fts3SegReaderStart( return SQLITE_OK; } -SQLITE_PRIVATE int sqlite3Fts3SegReaderStart( +SQLITE_PRIVATE int tdsqlite3Fts3SegReaderStart( Fts3Table *p, /* Virtual table handle */ Fts3MultiSegReader *pCsr, /* Cursor object */ Fts3SegFilter *pFilter /* Restrictions on range of iteration */ @@ -182334,7 +182334,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStart( return fts3SegReaderStart(p, pCsr, pFilter->zTerm, pFilter->nTerm); } -SQLITE_PRIVATE int sqlite3Fts3MsrIncrStart( +SQLITE_PRIVATE int tdsqlite3Fts3MsrIncrStart( Fts3Table *p, /* Virtual table handle */ Fts3MultiSegReader *pCsr, /* Cursor object */ int iCol, /* Column to match on. */ @@ -182379,17 +182379,17 @@ SQLITE_PRIVATE int sqlite3Fts3MsrIncrStart( /* ** This function is called on a MultiSegReader that has been started using -** sqlite3Fts3MsrIncrStart(). One or more calls to MsrIncrNext() may also +** tdsqlite3Fts3MsrIncrStart(). One or more calls to MsrIncrNext() may also ** have been made. Calling this function puts the MultiSegReader in such ** a state that if the next two calls are: ** -** sqlite3Fts3SegReaderStart() -** sqlite3Fts3SegReaderStep() +** tdsqlite3Fts3SegReaderStart() +** tdsqlite3Fts3SegReaderStep() ** ** then the entire doclist for the term is available in ** MultiSegReader.aDoclist/nDoclist. */ -SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr){ +SQLITE_PRIVATE int tdsqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr){ int i; /* Used to iterate through segment-readers */ assert( pCsr->zTerm==0 ); @@ -182409,7 +182409,7 @@ SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr){ } -SQLITE_PRIVATE int sqlite3Fts3SegReaderStep( +SQLITE_PRIVATE int tdsqlite3Fts3SegReaderStep( Fts3Table *p, /* Virtual table handle */ Fts3MultiSegReader *pCsr /* Cursor object */ ){ @@ -182498,7 +182498,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep( if( rc==SQLITE_OK ) rc = SQLITE_ROW; }else{ int nDoclist = 0; /* Size of doclist */ - sqlite3_int64 iPrev = 0; /* Previous docid stored in doclist */ + tdsqlite3_int64 iPrev = 0; /* Previous docid stored in doclist */ /* The current term of the first nMerge entries in the array ** of Fts3SegReader objects is the same. The doclists must be merged @@ -182513,7 +182513,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep( char *pList = 0; int nList = 0; int nByte; - sqlite3_int64 iDocid = apSegment[0]->iDocid; + tdsqlite3_int64 iDocid = apSegment[0]->iDocid; fts3SegReaderNextDocid(p, apSegment[0], &pList, &nList); j = 1; while( jbDescIdx && nDoclist>0 ){ if( iPrev<=iDocid ) return FTS_CORRUPT_VTAB; iDelta = (i64)((u64)iPrev - (u64)iDocid); @@ -182541,11 +182541,11 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep( iDelta = (i64)((u64)iDocid - (u64)iPrev); } - nByte = sqlite3Fts3VarintLen(iDelta) + (isRequirePos?nList+1:0); + nByte = tdsqlite3Fts3VarintLen(iDelta) + (isRequirePos?nList+1:0); if( nDoclist+nByte>pCsr->nBuffer ){ char *aNew; pCsr->nBuffer = (nDoclist+nByte)*2; - aNew = sqlite3_realloc(pCsr->aBuffer, pCsr->nBuffer); + aNew = tdsqlite3_realloc(pCsr->aBuffer, pCsr->nBuffer); if( !aNew ){ return SQLITE_NOMEM; } @@ -182556,13 +182556,13 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep( char *a = &pCsr->aBuffer[nDoclist]; int nWrite; - nWrite = sqlite3Fts3FirstFilter(iDelta, pList, nList, a); + nWrite = tdsqlite3Fts3FirstFilter(iDelta, pList, nList, a); if( nWrite ){ iPrev = iDocid; nDoclist += nWrite; } }else{ - nDoclist += sqlite3Fts3PutVarint(&pCsr->aBuffer[nDoclist], iDelta); + nDoclist += tdsqlite3Fts3PutVarint(&pCsr->aBuffer[nDoclist], iDelta); iPrev = iDocid; if( isRequirePos ){ memcpy(&pCsr->aBuffer[nDoclist], pList, nList); @@ -182587,16 +182587,16 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep( } -SQLITE_PRIVATE void sqlite3Fts3SegReaderFinish( +SQLITE_PRIVATE void tdsqlite3Fts3SegReaderFinish( Fts3MultiSegReader *pCsr /* Cursor object */ ){ if( pCsr ){ int i; for(i=0; inSegment; i++){ - sqlite3Fts3SegReaderFree(pCsr->apSegment[i]); + tdsqlite3Fts3SegReaderFree(pCsr->apSegment[i]); } - sqlite3_free(pCsr->apSegment); - sqlite3_free(pCsr->aBuffer); + tdsqlite3_free(pCsr->apSegment); + tdsqlite3_free(pCsr->aBuffer); pCsr->nSegment = 0; pCsr->apSegment = 0; @@ -182615,12 +182615,12 @@ SQLITE_PRIVATE void sqlite3Fts3SegReaderFinish( ** set *piEndBlock to the first value and *pnByte to the second. */ static void fts3ReadEndBlockField( - sqlite3_stmt *pStmt, + tdsqlite3_stmt *pStmt, int iCol, i64 *piEndBlock, i64 *pnByte ){ - const unsigned char *zText = sqlite3_column_text(pStmt, iCol); + const unsigned char *zText = tdsqlite3_column_text(pStmt, iCol); if( zText ){ int i; int iMul = 1; @@ -182649,11 +182649,11 @@ static void fts3ReadEndBlockField( */ static int fts3PromoteSegments( Fts3Table *p, /* FTS table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level just updated */ - sqlite3_int64 nByte /* Size of new segment at iAbsLevel */ + tdsqlite3_int64 iAbsLevel, /* Absolute level just updated */ + tdsqlite3_int64 nByte /* Size of new segment at iAbsLevel */ ){ int rc = SQLITE_OK; - sqlite3_stmt *pRange; + tdsqlite3_stmt *pRange; rc = fts3SqlStmt(p, SQL_SELECT_LEVEL_RANGE2, &pRange, 0); @@ -182667,9 +182667,9 @@ static int fts3PromoteSegments( ** at least one such segment, and it is possible to determine that all ** such segments are smaller than nLimit bytes in size, they will be ** promoted to level iAbsLevel. */ - sqlite3_bind_int64(pRange, 1, iAbsLevel+1); - sqlite3_bind_int64(pRange, 2, iLast); - while( SQLITE_ROW==sqlite3_step(pRange) ){ + tdsqlite3_bind_int64(pRange, 1, iAbsLevel+1); + tdsqlite3_bind_int64(pRange, 2, iLast); + while( SQLITE_ROW==tdsqlite3_step(pRange) ){ i64 nSize = 0, dummy; fts3ReadEndBlockField(pRange, 2, &dummy, &nSize); if( nSize<=0 || nSize>nLimit ){ @@ -182683,12 +182683,12 @@ static int fts3PromoteSegments( } bOk = 1; } - rc = sqlite3_reset(pRange); + rc = tdsqlite3_reset(pRange); if( bOk ){ int iIdx = 0; - sqlite3_stmt *pUpdate1 = 0; - sqlite3_stmt *pUpdate2 = 0; + tdsqlite3_stmt *pUpdate1 = 0; + tdsqlite3_stmt *pUpdate2 = 0; if( rc==SQLITE_OK ){ rc = fts3SqlStmt(p, SQL_UPDATE_LEVEL_IDX, &pUpdate1, 0); @@ -182708,28 +182708,28 @@ static int fts3PromoteSegments( ** setting the "idx" fields as appropriate to keep them in the same ** order. The contents of level -1 (which is never used, except ** transiently here), will be moved back to level iAbsLevel below. */ - sqlite3_bind_int64(pRange, 1, iAbsLevel); - while( SQLITE_ROW==sqlite3_step(pRange) ){ - sqlite3_bind_int(pUpdate1, 1, iIdx++); - sqlite3_bind_int(pUpdate1, 2, sqlite3_column_int(pRange, 0)); - sqlite3_bind_int(pUpdate1, 3, sqlite3_column_int(pRange, 1)); - sqlite3_step(pUpdate1); - rc = sqlite3_reset(pUpdate1); + tdsqlite3_bind_int64(pRange, 1, iAbsLevel); + while( SQLITE_ROW==tdsqlite3_step(pRange) ){ + tdsqlite3_bind_int(pUpdate1, 1, iIdx++); + tdsqlite3_bind_int(pUpdate1, 2, tdsqlite3_column_int(pRange, 0)); + tdsqlite3_bind_int(pUpdate1, 3, tdsqlite3_column_int(pRange, 1)); + tdsqlite3_step(pUpdate1); + rc = tdsqlite3_reset(pUpdate1); if( rc!=SQLITE_OK ){ - sqlite3_reset(pRange); + tdsqlite3_reset(pRange); break; } } } if( rc==SQLITE_OK ){ - rc = sqlite3_reset(pRange); + rc = tdsqlite3_reset(pRange); } /* Move level -1 to level iAbsLevel */ if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pUpdate2, 1, iAbsLevel); - sqlite3_step(pUpdate2); - rc = sqlite3_reset(pUpdate2); + tdsqlite3_bind_int64(pUpdate2, 1, iAbsLevel); + tdsqlite3_step(pUpdate2); + rc = tdsqlite3_reset(pUpdate2); } } } @@ -182757,7 +182757,7 @@ static int fts3SegmentMerge( ){ int rc; /* Return code */ int iIdx = 0; /* Index of new segment */ - sqlite3_int64 iNewLevel = 0; /* Level/index to create new segment at */ + tdsqlite3_int64 iNewLevel = 0; /* Level/index to create new segment at */ SegmentWriter *pWriter = 0; /* Used to write the new, merged, segment */ Fts3SegFilter filter; /* Segment term filter condition */ Fts3MultiSegReader csr; /* Cursor to iterate through level(s) */ @@ -182771,7 +182771,7 @@ static int fts3SegmentMerge( assert( iLevel=0 && iIndexnIndex ); - rc = sqlite3Fts3SegReaderCursor(p, iLangid, iIndex, iLevel, 0, 0, 1, 0, &csr); + rc = tdsqlite3Fts3SegReaderCursor(p, iLangid, iIndex, iLevel, 0, 0, 1, 0, &csr); if( rc!=SQLITE_OK || csr.nSegment==0 ) goto finished; if( iLevel!=FTS3_SEGCURSOR_PENDING ){ @@ -182813,9 +182813,9 @@ static int fts3SegmentMerge( filter.flags = FTS3_SEGMENT_REQUIRE_POS; filter.flags |= (bIgnoreEmpty ? FTS3_SEGMENT_IGNORE_EMPTY : 0); - rc = sqlite3Fts3SegReaderStart(p, &csr, &filter); + rc = tdsqlite3Fts3SegReaderStart(p, &csr, &filter); while( SQLITE_OK==rc ){ - rc = sqlite3Fts3SegReaderStep(p, &csr); + rc = tdsqlite3Fts3SegReaderStep(p, &csr); if( rc!=SQLITE_ROW ) break; rc = fts3SegWriterAdd(p, &pWriter, 1, csr.zTerm, csr.nTerm, csr.aDoclist, csr.nDoclist); @@ -182840,7 +182840,7 @@ static int fts3SegmentMerge( finished: fts3SegWriterFree(pWriter); - sqlite3Fts3SegReaderFinish(&csr); + tdsqlite3Fts3SegReaderFinish(&csr); return rc; } @@ -182848,7 +182848,7 @@ static int fts3SegmentMerge( /* ** Flush the contents of pendingTerms to level 0 segments. */ -SQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *p){ +SQLITE_PRIVATE int tdsqlite3Fts3PendingTermsFlush(Fts3Table *p){ int rc = SQLITE_OK; int i; @@ -182856,7 +182856,7 @@ SQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *p){ rc = fts3SegmentMerge(p, p->iPrevLangid, i, FTS3_SEGCURSOR_PENDING); if( rc==SQLITE_DONE ) rc = SQLITE_OK; } - sqlite3Fts3PendingTermsClear(p); + tdsqlite3Fts3PendingTermsClear(p); /* Determine the auto-incr-merge setting if unknown. If enabled, ** estimate the number of leaf blocks of content to be written @@ -182864,18 +182864,18 @@ SQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *p){ if( rc==SQLITE_OK && p->bHasStat && p->nAutoincrmerge==0xff && p->nLeafAdd>0 ){ - sqlite3_stmt *pStmt = 0; + tdsqlite3_stmt *pStmt = 0; rc = fts3SqlStmt(p, SQL_SELECT_STAT, &pStmt, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int(pStmt, 1, FTS_STAT_AUTOINCRMERGE); - rc = sqlite3_step(pStmt); + tdsqlite3_bind_int(pStmt, 1, FTS_STAT_AUTOINCRMERGE); + rc = tdsqlite3_step(pStmt); if( rc==SQLITE_ROW ){ - p->nAutoincrmerge = sqlite3_column_int(pStmt, 0); + p->nAutoincrmerge = tdsqlite3_column_int(pStmt, 0); if( p->nAutoincrmerge==1 ) p->nAutoincrmerge = 8; }else if( rc==SQLITE_DONE ){ p->nAutoincrmerge = 0; } - rc = sqlite3_reset(pStmt); + rc = tdsqlite3_reset(pStmt); } } return rc; @@ -182892,7 +182892,7 @@ static void fts3EncodeIntArray( ){ int i, j; for(i=j=0; inColumn ); + pBlob = tdsqlite3_malloc64( 10*(tdsqlite3_int64)p->nColumn ); if( pBlob==0 ){ *pRC = SQLITE_NOMEM; return; @@ -182942,14 +182942,14 @@ static void fts3InsertDocsize( fts3EncodeIntArray(p->nColumn, aSz, pBlob, &nBlob); rc = fts3SqlStmt(p, SQL_REPLACE_DOCSIZE, &pStmt, 0); if( rc ){ - sqlite3_free(pBlob); + tdsqlite3_free(pBlob); *pRC = rc; return; } - sqlite3_bind_int64(pStmt, 1, p->iPrevDocid); - sqlite3_bind_blob(pStmt, 2, pBlob, nBlob, sqlite3_free); - sqlite3_step(pStmt); - *pRC = sqlite3_reset(pStmt); + tdsqlite3_bind_int64(pStmt, 1, p->iPrevDocid); + tdsqlite3_bind_blob(pStmt, 2, pBlob, nBlob, tdsqlite3_free); + tdsqlite3_step(pStmt); + *pRC = tdsqlite3_reset(pStmt); } /* @@ -182977,14 +182977,14 @@ static void fts3UpdateDocTotals( char *pBlob; /* Storage for BLOB written into %_stat */ int nBlob; /* Size of BLOB written into %_stat */ u32 *a; /* Array of integers that becomes the BLOB */ - sqlite3_stmt *pStmt; /* Statement for reading and writing */ + tdsqlite3_stmt *pStmt; /* Statement for reading and writing */ int i; /* Loop counter */ int rc; /* Result code from subfunctions */ const int nStat = p->nColumn+2; if( *pRC ) return; - a = sqlite3_malloc64( (sizeof(u32)+10)*(sqlite3_int64)nStat ); + a = tdsqlite3_malloc64( (sizeof(u32)+10)*(tdsqlite3_int64)nStat ); if( a==0 ){ *pRC = SQLITE_NOMEM; return; @@ -182992,21 +182992,21 @@ static void fts3UpdateDocTotals( pBlob = (char*)&a[nStat]; rc = fts3SqlStmt(p, SQL_SELECT_STAT, &pStmt, 0); if( rc ){ - sqlite3_free(a); + tdsqlite3_free(a); *pRC = rc; return; } - sqlite3_bind_int(pStmt, 1, FTS_STAT_DOCTOTAL); - if( sqlite3_step(pStmt)==SQLITE_ROW ){ + tdsqlite3_bind_int(pStmt, 1, FTS_STAT_DOCTOTAL); + if( tdsqlite3_step(pStmt)==SQLITE_ROW ){ fts3DecodeIntArray(nStat, a, - sqlite3_column_blob(pStmt, 0), - sqlite3_column_bytes(pStmt, 0)); + tdsqlite3_column_blob(pStmt, 0), + tdsqlite3_column_bytes(pStmt, 0)); }else{ memset(a, 0, sizeof(u32)*(nStat) ); } - rc = sqlite3_reset(pStmt); + rc = tdsqlite3_reset(pStmt); if( rc!=SQLITE_OK ){ - sqlite3_free(a); + tdsqlite3_free(a); *pRC = rc; return; } @@ -183027,16 +183027,16 @@ static void fts3UpdateDocTotals( fts3EncodeIntArray(nStat, a, pBlob, &nBlob); rc = fts3SqlStmt(p, SQL_REPLACE_STAT, &pStmt, 0); if( rc ){ - sqlite3_free(a); + tdsqlite3_free(a); *pRC = rc; return; } - sqlite3_bind_int(pStmt, 1, FTS_STAT_DOCTOTAL); - sqlite3_bind_blob(pStmt, 2, pBlob, nBlob, SQLITE_STATIC); - sqlite3_step(pStmt); - *pRC = sqlite3_reset(pStmt); - sqlite3_bind_null(pStmt, 2); - sqlite3_free(a); + tdsqlite3_bind_int(pStmt, 1, FTS_STAT_DOCTOTAL); + tdsqlite3_bind_blob(pStmt, 2, pBlob, nBlob, SQLITE_STATIC); + tdsqlite3_step(pStmt); + *pRC = tdsqlite3_reset(pStmt); + tdsqlite3_bind_null(pStmt, 2); + tdsqlite3_free(a); } /* @@ -183046,19 +183046,19 @@ static void fts3UpdateDocTotals( static int fts3DoOptimize(Fts3Table *p, int bReturnDone){ int bSeenDone = 0; int rc; - sqlite3_stmt *pAllLangid = 0; + tdsqlite3_stmt *pAllLangid = 0; - rc = sqlite3Fts3PendingTermsFlush(p); + rc = tdsqlite3Fts3PendingTermsFlush(p); if( rc==SQLITE_OK ){ rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0); } if( rc==SQLITE_OK ){ int rc2; - sqlite3_bind_int(pAllLangid, 1, p->iPrevLangid); - sqlite3_bind_int(pAllLangid, 2, p->nIndex); - while( sqlite3_step(pAllLangid)==SQLITE_ROW ){ + tdsqlite3_bind_int(pAllLangid, 1, p->iPrevLangid); + tdsqlite3_bind_int(pAllLangid, 2, p->nIndex); + while( tdsqlite3_step(pAllLangid)==SQLITE_ROW ){ int i; - int iLangid = sqlite3_column_int(pAllLangid, 0); + int iLangid = tdsqlite3_column_int(pAllLangid, 0); for(i=0; rc==SQLITE_OK && inIndex; i++){ rc = fts3SegmentMerge(p, iLangid, i, FTS3_SEGCURSOR_ALL); if( rc==SQLITE_DONE ){ @@ -183067,11 +183067,11 @@ static int fts3DoOptimize(Fts3Table *p, int bReturnDone){ } } } - rc2 = sqlite3_reset(pAllLangid); + rc2 = tdsqlite3_reset(pAllLangid); if( rc==SQLITE_OK ) rc = rc2; } - sqlite3Fts3SegmentsClose(p); + tdsqlite3Fts3SegmentsClose(p); return (rc==SQLITE_OK && bReturnDone && bSeenDone) ? SQLITE_DONE : rc; } @@ -183094,21 +183094,21 @@ static int fts3DoRebuild(Fts3Table *p){ u32 *aSz = 0; u32 *aSzIns = 0; u32 *aSzDel = 0; - sqlite3_stmt *pStmt = 0; + tdsqlite3_stmt *pStmt = 0; int nEntry = 0; /* Compose and prepare an SQL statement to loop through the content table */ - char *zSql = sqlite3_mprintf("SELECT %s" , p->zReadExprlist); + char *zSql = tdsqlite3_mprintf("SELECT %s" , p->zReadExprlist); if( !zSql ){ rc = SQLITE_NOMEM; }else{ - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); - sqlite3_free(zSql); + rc = tdsqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); + tdsqlite3_free(zSql); } if( rc==SQLITE_OK ){ - sqlite3_int64 nByte = sizeof(u32) * ((sqlite3_int64)p->nColumn+1)*3; - aSz = (u32 *)sqlite3_malloc64(nByte); + tdsqlite3_int64 nByte = sizeof(u32) * ((tdsqlite3_int64)p->nColumn+1)*3; + aSz = (u32 *)tdsqlite3_malloc64(nByte); if( aSz==0 ){ rc = SQLITE_NOMEM; }else{ @@ -183118,23 +183118,23 @@ static int fts3DoRebuild(Fts3Table *p){ } } - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ + while( rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pStmt) ){ int iCol; int iLangid = langidFromSelect(p, pStmt); - rc = fts3PendingTermsDocid(p, 0, iLangid, sqlite3_column_int64(pStmt, 0)); + rc = fts3PendingTermsDocid(p, 0, iLangid, tdsqlite3_column_int64(pStmt, 0)); memset(aSz, 0, sizeof(aSz[0]) * (p->nColumn+1)); for(iCol=0; rc==SQLITE_OK && iColnColumn; iCol++){ if( p->abNotindexed[iCol]==0 ){ - const char *z = (const char *) sqlite3_column_text(pStmt, iCol+1); + const char *z = (const char *) tdsqlite3_column_text(pStmt, iCol+1); rc = fts3PendingTermsAdd(p, iLangid, z, iCol, &aSz[iCol]); - aSz[p->nColumn] += sqlite3_column_bytes(pStmt, iCol+1); + aSz[p->nColumn] += tdsqlite3_column_bytes(pStmt, iCol+1); } } if( p->bHasDocsize ){ fts3InsertDocsize(&rc, p, aSz); } if( rc!=SQLITE_OK ){ - sqlite3_finalize(pStmt); + tdsqlite3_finalize(pStmt); pStmt = 0; }else{ nEntry++; @@ -183146,10 +183146,10 @@ static int fts3DoRebuild(Fts3Table *p){ if( p->bFts4 ){ fts3UpdateDocTotals(&rc, p, aSzIns, aSzDel, nEntry); } - sqlite3_free(aSz); + tdsqlite3_free(aSz); if( pStmt ){ - int rc2 = sqlite3_finalize(pStmt); + int rc2 = tdsqlite3_finalize(pStmt); if( rc==SQLITE_OK ){ rc = rc2; } @@ -183168,18 +183168,18 @@ static int fts3DoRebuild(Fts3Table *p){ */ static int fts3IncrmergeCsr( Fts3Table *p, /* FTS3 table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level to open */ + tdsqlite3_int64 iAbsLevel, /* Absolute level to open */ int nSeg, /* Number of segments to merge */ Fts3MultiSegReader *pCsr /* Cursor object to populate */ ){ int rc; /* Return Code */ - sqlite3_stmt *pStmt = 0; /* Statement used to read %_segdir entry */ - sqlite3_int64 nByte; /* Bytes allocated at pCsr->apSegment[] */ + tdsqlite3_stmt *pStmt = 0; /* Statement used to read %_segdir entry */ + tdsqlite3_int64 nByte; /* Bytes allocated at pCsr->apSegment[] */ /* Allocate space for the Fts3MultiSegReader.aCsr[] array */ memset(pCsr, 0, sizeof(*pCsr)); nByte = sizeof(Fts3SegReader *) * nSeg; - pCsr->apSegment = (Fts3SegReader **)sqlite3_malloc64(nByte); + pCsr->apSegment = (Fts3SegReader **)tdsqlite3_malloc64(nByte); if( pCsr->apSegment==0 ){ rc = SQLITE_NOMEM; @@ -183190,20 +183190,20 @@ static int fts3IncrmergeCsr( if( rc==SQLITE_OK ){ int i; int rc2; - sqlite3_bind_int64(pStmt, 1, iAbsLevel); + tdsqlite3_bind_int64(pStmt, 1, iAbsLevel); assert( pCsr->nSegment==0 ); - for(i=0; rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW && iapSegment[i] ); pCsr->nSegment++; } - rc2 = sqlite3_reset(pStmt); + rc2 = tdsqlite3_reset(pStmt); if( rc==SQLITE_OK ) rc = rc2; } @@ -183232,7 +183232,7 @@ struct Blob { ** nodes (blocks). */ struct NodeWriter { - sqlite3_int64 iBlock; /* Current block id */ + tdsqlite3_int64 iBlock; /* Current block id */ Blob key; /* Last key written to the current block */ Blob block; /* Current block image */ }; @@ -183244,11 +183244,11 @@ struct NodeWriter { struct IncrmergeWriter { int nLeafEst; /* Space allocated for leaf blocks */ int nWork; /* Number of leaf pages flushed */ - sqlite3_int64 iAbsLevel; /* Absolute level of input segments */ + tdsqlite3_int64 iAbsLevel; /* Absolute level of input segments */ int iIdx; /* Index of *output* segment in iAbsLevel+1 */ - sqlite3_int64 iStart; /* Block number of first allocated block */ - sqlite3_int64 iEnd; /* Block number of last allocated block */ - sqlite3_int64 nLeafData; /* Bytes of leaf page data so far */ + tdsqlite3_int64 iStart; /* Block number of first allocated block */ + tdsqlite3_int64 iEnd; /* Block number of last allocated block */ + tdsqlite3_int64 nLeafData; /* Bytes of leaf page data so far */ u8 bNoLeafData; /* If true, store 0 for segment size */ NodeWriter aNodeWriter[FTS_MAX_APPENDABLE_HEIGHT]; }; @@ -183267,7 +183267,7 @@ struct NodeReader { int iOff; /* Current offset within aNode[] */ /* Output variables. Containing the current node entry. */ - sqlite3_int64 iChild; /* Pointer to child node */ + tdsqlite3_int64 iChild; /* Pointer to child node */ Blob term; /* Current term */ const char *aDoclist; /* Pointer to doclist */ int nDoclist; /* Size of doclist in bytes */ @@ -183285,7 +183285,7 @@ struct NodeReader { static void blobGrowBuffer(Blob *pBlob, int nMin, int *pRc){ if( *pRc==SQLITE_OK && nMin>pBlob->nAlloc ){ int nAlloc = nMin; - char *a = (char *)sqlite3_realloc(pBlob->a, nAlloc); + char *a = (char *)tdsqlite3_realloc(pBlob->a, nAlloc); if( a ){ pBlob->nAlloc = nAlloc; pBlob->a = a; @@ -183349,7 +183349,7 @@ static int nodeReaderNext(NodeReader *p){ ** Release all dynamic resources held by node-reader object *p. */ static void nodeReaderRelease(NodeReader *p){ - sqlite3_free(p->term.a); + tdsqlite3_free(p->term.a); } /* @@ -183367,7 +183367,7 @@ static int nodeReaderInit(NodeReader *p, const char *aNode, int nNode){ /* Figure out if this is a leaf or an internal node. */ if( aNode && aNode[0] ){ /* An internal node. */ - p->iOff = 1 + sqlite3Fts3GetVarint(&p->aNode[1], &p->iChild); + p->iOff = 1 + tdsqlite3Fts3GetVarint(&p->aNode[1], &p->iChild); }else{ p->iOff = 1; } @@ -183391,12 +183391,12 @@ static int fts3IncrmergePush( const char *zTerm, /* Term to write to internal node */ int nTerm /* Bytes at zTerm */ ){ - sqlite3_int64 iPtr = pWriter->aNodeWriter[0].iBlock; + tdsqlite3_int64 iPtr = pWriter->aNodeWriter[0].iBlock; int iLayer; assert( nTerm>0 ); for(iLayer=1; ALWAYS(iLayeraNodeWriter[iLayer]; int rc = SQLITE_OK; int nPrefix; @@ -183410,8 +183410,8 @@ static int fts3IncrmergePush( nPrefix = fts3PrefixCompress(pNode->key.a, pNode->key.n, zTerm, nTerm); nSuffix = nTerm - nPrefix; if(nSuffix<=0 ) return FTS_CORRUPT_VTAB; - nSpace = sqlite3Fts3VarintLen(nPrefix); - nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix; + nSpace = tdsqlite3Fts3VarintLen(nPrefix); + nSpace += tdsqlite3Fts3VarintLen(nSuffix) + nSuffix; if( pNode->key.n==0 || (pNode->block.n + nSpace)<=p->nNodeSize ){ /* If the current node of layer iLayer contains zero keys, or if adding @@ -183423,7 +183423,7 @@ static int fts3IncrmergePush( blobGrowBuffer(pBlk, p->nNodeSize, &rc); if( rc==SQLITE_OK ){ pBlk->a[0] = (char)iLayer; - pBlk->n = 1 + sqlite3Fts3PutVarint(&pBlk->a[1], iPtr); + pBlk->n = 1 + tdsqlite3Fts3PutVarint(&pBlk->a[1], iPtr); } } blobGrowBuffer(pBlk, pBlk->n + nSpace, &rc); @@ -183431,9 +183431,9 @@ static int fts3IncrmergePush( if( rc==SQLITE_OK ){ if( pNode->key.n ){ - pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nPrefix); + pBlk->n += tdsqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nPrefix); } - pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nSuffix); + pBlk->n += tdsqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nSuffix); memcpy(&pBlk->a[pBlk->n], &zTerm[nPrefix], nSuffix); pBlk->n += nSuffix; @@ -183448,7 +183448,7 @@ static int fts3IncrmergePush( assert( pNode->block.nAlloc>=p->nNodeSize ); pNode->block.a[0] = (char)iLayer; - pNode->block.n = 1 + sqlite3Fts3PutVarint(&pNode->block.a[1], iPtr+1); + pNode->block.n = 1 + tdsqlite3Fts3PutVarint(&pNode->block.a[1], iPtr+1); iNextPtr = pNode->iBlock; pNode->iBlock++; @@ -183515,14 +183515,14 @@ static int fts3AppendToNode( pPrev->n = nTerm; if( bFirst==0 ){ - pNode->n += sqlite3Fts3PutVarint(&pNode->a[pNode->n], nPrefix); + pNode->n += tdsqlite3Fts3PutVarint(&pNode->a[pNode->n], nPrefix); } - pNode->n += sqlite3Fts3PutVarint(&pNode->a[pNode->n], nSuffix); + pNode->n += tdsqlite3Fts3PutVarint(&pNode->a[pNode->n], nSuffix); memcpy(&pNode->a[pNode->n], &zTerm[nPrefix], nSuffix); pNode->n += nSuffix; if( aDoclist ){ - pNode->n += sqlite3Fts3PutVarint(&pNode->a[pNode->n], nDoclist); + pNode->n += tdsqlite3Fts3PutVarint(&pNode->a[pNode->n], nDoclist); memcpy(&pNode->a[pNode->n], aDoclist, nDoclist); pNode->n += nDoclist; } @@ -183557,9 +183557,9 @@ static int fts3IncrmergeAppend( nPrefix = fts3PrefixCompress(pLeaf->key.a, pLeaf->key.n, zTerm, nTerm); nSuffix = nTerm - nPrefix; - nSpace = sqlite3Fts3VarintLen(nPrefix); - nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix; - nSpace += sqlite3Fts3VarintLen(nDoclist) + nDoclist; + nSpace = tdsqlite3Fts3VarintLen(nPrefix); + nSpace += tdsqlite3Fts3VarintLen(nSuffix) + nSuffix; + nSpace += tdsqlite3Fts3VarintLen(nDoclist) + nDoclist; /* If the current block is not empty, and if adding this term/doclist ** to the current block would make it larger than Fts3Table.nNodeSize @@ -183591,8 +183591,8 @@ static int fts3IncrmergeAppend( nSuffix = nTerm; nSpace = 1; - nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix; - nSpace += sqlite3Fts3VarintLen(nDoclist) + nDoclist; + nSpace += tdsqlite3Fts3VarintLen(nSuffix) + nSuffix; + nSpace += tdsqlite3Fts3VarintLen(nDoclist) + nDoclist; } pWriter->nLeafData += nSpace; @@ -183642,8 +183642,8 @@ static void fts3IncrmergeRelease( if( pNode->block.n>0 ) break; assert( *pRc || pNode->block.nAlloc==0 ); assert( *pRc || pNode->key.nAlloc==0 ); - sqlite3_free(pNode->block.a); - sqlite3_free(pNode->key.a); + tdsqlite3_free(pNode->block.a); + tdsqlite3_free(pNode->key.a); } /* Empty output segment. This is a no-op. */ @@ -183669,7 +183669,7 @@ static void fts3IncrmergeRelease( blobGrowBuffer(pBlock, 1 + FTS3_VARINT_MAX, &rc); if( rc==SQLITE_OK ){ pBlock->a[0] = 0x01; - pBlock->n = 1 + sqlite3Fts3PutVarint( + pBlock->n = 1 + tdsqlite3Fts3PutVarint( &pBlock->a[1], pWriter->aNodeWriter[0].iBlock ); } @@ -183683,8 +183683,8 @@ static void fts3IncrmergeRelease( if( pNode->block.n>0 && rc==SQLITE_OK ){ rc = fts3WriteSegment(p, pNode->iBlock, pNode->block.a, pNode->block.n); } - sqlite3_free(pNode->block.a); - sqlite3_free(pNode->key.a); + tdsqlite3_free(pNode->block.a); + tdsqlite3_free(pNode->key.a); } /* Write the %_segdir record. */ @@ -183699,8 +183699,8 @@ static void fts3IncrmergeRelease( pRoot->block.a, pRoot->block.n /* root */ ); } - sqlite3_free(pRoot->block.a); - sqlite3_free(pRoot->key.a); + tdsqlite3_free(pRoot->block.a); + tdsqlite3_free(pRoot->key.a); *pRc = rc; } @@ -183739,16 +183739,16 @@ static int fts3TermCmp( ** is, then a NULL entry has been inserted into the %_segments table ** with blockid %_segdir.end_block. */ -static int fts3IsAppendable(Fts3Table *p, sqlite3_int64 iEnd, int *pbRes){ +static int fts3IsAppendable(Fts3Table *p, tdsqlite3_int64 iEnd, int *pbRes){ int bRes = 0; /* Result to set *pbRes to */ - sqlite3_stmt *pCheck = 0; /* Statement to query database with */ + tdsqlite3_stmt *pCheck = 0; /* Statement to query database with */ int rc; /* Return code */ rc = fts3SqlStmt(p, SQL_SEGMENT_IS_APPENDABLE, &pCheck, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pCheck, 1, iEnd); - if( SQLITE_ROW==sqlite3_step(pCheck) ) bRes = 1; - rc = sqlite3_reset(pCheck); + tdsqlite3_bind_int64(pCheck, 1, iEnd); + if( SQLITE_ROW==tdsqlite3_step(pCheck) ) bRes = 1; + rc = tdsqlite3_reset(pCheck); } *pbRes = bRes; @@ -183772,44 +183772,44 @@ static int fts3IsAppendable(Fts3Table *p, sqlite3_int64 iEnd, int *pbRes){ */ static int fts3IncrmergeLoad( Fts3Table *p, /* Fts3 table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level of input segments */ + tdsqlite3_int64 iAbsLevel, /* Absolute level of input segments */ int iIdx, /* Index of candidate output segment */ const char *zKey, /* First key to write */ int nKey, /* Number of bytes in nKey */ IncrmergeWriter *pWriter /* Populate this object */ ){ int rc; /* Return code */ - sqlite3_stmt *pSelect = 0; /* SELECT to read %_segdir entry */ + tdsqlite3_stmt *pSelect = 0; /* SELECT to read %_segdir entry */ rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR, &pSelect, 0); if( rc==SQLITE_OK ){ - sqlite3_int64 iStart = 0; /* Value of %_segdir.start_block */ - sqlite3_int64 iLeafEnd = 0; /* Value of %_segdir.leaves_end_block */ - sqlite3_int64 iEnd = 0; /* Value of %_segdir.end_block */ + tdsqlite3_int64 iStart = 0; /* Value of %_segdir.start_block */ + tdsqlite3_int64 iLeafEnd = 0; /* Value of %_segdir.leaves_end_block */ + tdsqlite3_int64 iEnd = 0; /* Value of %_segdir.end_block */ const char *aRoot = 0; /* Pointer to %_segdir.root buffer */ int nRoot = 0; /* Size of aRoot[] in bytes */ - int rc2; /* Return code from sqlite3_reset() */ + int rc2; /* Return code from tdsqlite3_reset() */ int bAppendable = 0; /* Set to true if segment is appendable */ /* Read the %_segdir entry for index iIdx absolute level (iAbsLevel+1) */ - sqlite3_bind_int64(pSelect, 1, iAbsLevel+1); - sqlite3_bind_int(pSelect, 2, iIdx); - if( sqlite3_step(pSelect)==SQLITE_ROW ){ - iStart = sqlite3_column_int64(pSelect, 1); - iLeafEnd = sqlite3_column_int64(pSelect, 2); + tdsqlite3_bind_int64(pSelect, 1, iAbsLevel+1); + tdsqlite3_bind_int(pSelect, 2, iIdx); + if( tdsqlite3_step(pSelect)==SQLITE_ROW ){ + iStart = tdsqlite3_column_int64(pSelect, 1); + iLeafEnd = tdsqlite3_column_int64(pSelect, 2); fts3ReadEndBlockField(pSelect, 3, &iEnd, &pWriter->nLeafData); if( pWriter->nLeafData<0 ){ pWriter->nLeafData = pWriter->nLeafData * -1; } pWriter->bNoLeafData = (pWriter->nLeafData==0); - nRoot = sqlite3_column_bytes(pSelect, 4); - aRoot = sqlite3_column_blob(pSelect, 4); + nRoot = tdsqlite3_column_bytes(pSelect, 4); + aRoot = tdsqlite3_column_blob(pSelect, 4); if( aRoot==0 ){ - sqlite3_reset(pSelect); + tdsqlite3_reset(pSelect); return nRoot ? SQLITE_NOMEM : FTS_CORRUPT_VTAB; } }else{ - return sqlite3_reset(pSelect); + return tdsqlite3_reset(pSelect); } /* Check for the zero-length marker in the %_segments table */ @@ -183820,7 +183820,7 @@ static int fts3IncrmergeLoad( char *aLeaf = 0; int nLeaf = 0; - rc = sqlite3Fts3ReadBlock(p, iLeafEnd, &aLeaf, &nLeaf, 0); + rc = tdsqlite3Fts3ReadBlock(p, iLeafEnd, &aLeaf, &nLeaf, 0); if( rc==SQLITE_OK ){ NodeReader reader; for(rc = nodeReaderInit(&reader, aLeaf, nLeaf); @@ -183834,7 +183834,7 @@ static int fts3IncrmergeLoad( } nodeReaderRelease(&reader); } - sqlite3_free(aLeaf); + tdsqlite3_free(aLeaf); } if( rc==SQLITE_OK && bAppendable ){ @@ -183844,7 +183844,7 @@ static int fts3IncrmergeLoad( int nHeight = (int)aRoot[0]; NodeWriter *pNode; if( nHeight<1 || nHeight>FTS_MAX_APPENDABLE_HEIGHT ){ - sqlite3_reset(pSelect); + tdsqlite3_reset(pSelect); return FTS_CORRUPT_VTAB; } @@ -183885,7 +183885,7 @@ static int fts3IncrmergeLoad( int nBlock = 0; pNode = &pWriter->aNodeWriter[i-1]; pNode->iBlock = reader.iChild; - rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock, 0); + rc = tdsqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock, 0); blobGrowBuffer(&pNode->block, MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc ); @@ -183894,7 +183894,7 @@ static int fts3IncrmergeLoad( pNode->block.n = nBlock; memset(&pNode->block.a[nBlock], 0, FTS3_NODE_PADDING); } - sqlite3_free(aBlock); + tdsqlite3_free(aBlock); } } } @@ -183902,7 +183902,7 @@ static int fts3IncrmergeLoad( } } - rc2 = sqlite3_reset(pSelect); + rc2 = tdsqlite3_reset(pSelect); if( rc==SQLITE_OK ) rc = rc2; } @@ -183920,18 +183920,18 @@ static int fts3IncrmergeLoad( */ static int fts3IncrmergeOutputIdx( Fts3Table *p, /* FTS Table handle */ - sqlite3_int64 iAbsLevel, /* Absolute index of input segments */ + tdsqlite3_int64 iAbsLevel, /* Absolute index of input segments */ int *piIdx /* OUT: Next free index at iAbsLevel+1 */ ){ int rc; - sqlite3_stmt *pOutputIdx = 0; /* SQL used to find output index */ + tdsqlite3_stmt *pOutputIdx = 0; /* SQL used to find output index */ rc = fts3SqlStmt(p, SQL_NEXT_SEGMENT_INDEX, &pOutputIdx, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pOutputIdx, 1, iAbsLevel+1); - sqlite3_step(pOutputIdx); - *piIdx = sqlite3_column_int(pOutputIdx, 0); - rc = sqlite3_reset(pOutputIdx); + tdsqlite3_bind_int64(pOutputIdx, 1, iAbsLevel+1); + tdsqlite3_step(pOutputIdx); + *piIdx = tdsqlite3_column_int(pOutputIdx, 0); + rc = tdsqlite3_reset(pOutputIdx); } return rc; @@ -183965,7 +183965,7 @@ static int fts3IncrmergeOutputIdx( */ static int fts3IncrmergeWriter( Fts3Table *p, /* Fts3 table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level of input segments */ + tdsqlite3_int64 iAbsLevel, /* Absolute level of input segments */ int iIdx, /* Index of new output segment */ Fts3MultiSegReader *pCsr, /* Cursor that data will be read from */ IncrmergeWriter *pWriter /* Populate this object */ @@ -183973,30 +183973,30 @@ static int fts3IncrmergeWriter( int rc; /* Return Code */ int i; /* Iterator variable */ int nLeafEst = 0; /* Blocks allocated for leaf nodes */ - sqlite3_stmt *pLeafEst = 0; /* SQL used to determine nLeafEst */ - sqlite3_stmt *pFirstBlock = 0; /* SQL used to determine first block */ + tdsqlite3_stmt *pLeafEst = 0; /* SQL used to determine nLeafEst */ + tdsqlite3_stmt *pFirstBlock = 0; /* SQL used to determine first block */ /* Calculate nLeafEst. */ rc = fts3SqlStmt(p, SQL_MAX_LEAF_NODE_ESTIMATE, &pLeafEst, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pLeafEst, 1, iAbsLevel); - sqlite3_bind_int64(pLeafEst, 2, pCsr->nSegment); - if( SQLITE_ROW==sqlite3_step(pLeafEst) ){ - nLeafEst = sqlite3_column_int(pLeafEst, 0); + tdsqlite3_bind_int64(pLeafEst, 1, iAbsLevel); + tdsqlite3_bind_int64(pLeafEst, 2, pCsr->nSegment); + if( SQLITE_ROW==tdsqlite3_step(pLeafEst) ){ + nLeafEst = tdsqlite3_column_int(pLeafEst, 0); } - rc = sqlite3_reset(pLeafEst); + rc = tdsqlite3_reset(pLeafEst); } if( rc!=SQLITE_OK ) return rc; /* Calculate the first block to use in the output segment */ rc = fts3SqlStmt(p, SQL_NEXT_SEGMENTS_ID, &pFirstBlock, 0); if( rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pFirstBlock) ){ - pWriter->iStart = sqlite3_column_int64(pFirstBlock, 0); + if( SQLITE_ROW==tdsqlite3_step(pFirstBlock) ){ + pWriter->iStart = tdsqlite3_column_int64(pFirstBlock, 0); pWriter->iEnd = pWriter->iStart - 1; pWriter->iEnd += nLeafEst * FTS_MAX_APPENDABLE_HEIGHT; } - rc = sqlite3_reset(pFirstBlock); + rc = tdsqlite3_reset(pFirstBlock); } if( rc!=SQLITE_OK ) return rc; @@ -184030,18 +184030,18 @@ static int fts3IncrmergeWriter( */ static int fts3RemoveSegdirEntry( Fts3Table *p, /* FTS3 table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level to delete from */ + tdsqlite3_int64 iAbsLevel, /* Absolute level to delete from */ int iIdx /* Index of %_segdir entry to delete */ ){ int rc; /* Return code */ - sqlite3_stmt *pDelete = 0; /* DELETE statement */ + tdsqlite3_stmt *pDelete = 0; /* DELETE statement */ rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_ENTRY, &pDelete, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pDelete, 1, iAbsLevel); - sqlite3_bind_int(pDelete, 2, iIdx); - sqlite3_step(pDelete); - rc = sqlite3_reset(pDelete); + tdsqlite3_bind_int64(pDelete, 1, iAbsLevel); + tdsqlite3_bind_int(pDelete, 2, iIdx); + tdsqlite3_step(pDelete); + rc = tdsqlite3_reset(pDelete); } return rc; @@ -184054,34 +184054,34 @@ static int fts3RemoveSegdirEntry( */ static int fts3RepackSegdirLevel( Fts3Table *p, /* FTS3 table handle */ - sqlite3_int64 iAbsLevel /* Absolute level to repack */ + tdsqlite3_int64 iAbsLevel /* Absolute level to repack */ ){ int rc; /* Return code */ int *aIdx = 0; /* Array of remaining idx values */ int nIdx = 0; /* Valid entries in aIdx[] */ int nAlloc = 0; /* Allocated size of aIdx[] */ int i; /* Iterator variable */ - sqlite3_stmt *pSelect = 0; /* Select statement to read idx values */ - sqlite3_stmt *pUpdate = 0; /* Update statement to modify idx values */ + tdsqlite3_stmt *pSelect = 0; /* Select statement to read idx values */ + tdsqlite3_stmt *pUpdate = 0; /* Update statement to modify idx values */ rc = fts3SqlStmt(p, SQL_SELECT_INDEXES, &pSelect, 0); if( rc==SQLITE_OK ){ int rc2; - sqlite3_bind_int64(pSelect, 1, iAbsLevel); - while( SQLITE_ROW==sqlite3_step(pSelect) ){ + tdsqlite3_bind_int64(pSelect, 1, iAbsLevel); + while( SQLITE_ROW==tdsqlite3_step(pSelect) ){ if( nIdx>=nAlloc ){ int *aNew; nAlloc += 16; - aNew = sqlite3_realloc(aIdx, nAlloc*sizeof(int)); + aNew = tdsqlite3_realloc(aIdx, nAlloc*sizeof(int)); if( !aNew ){ rc = SQLITE_NOMEM; break; } aIdx = aNew; } - aIdx[nIdx++] = sqlite3_column_int(pSelect, 0); + aIdx[nIdx++] = tdsqlite3_column_int(pSelect, 0); } - rc2 = sqlite3_reset(pSelect); + rc2 = tdsqlite3_reset(pSelect); if( rc==SQLITE_OK ) rc = rc2; } @@ -184089,30 +184089,30 @@ static int fts3RepackSegdirLevel( rc = fts3SqlStmt(p, SQL_SHIFT_SEGDIR_ENTRY, &pUpdate, 0); } if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pUpdate, 2, iAbsLevel); + tdsqlite3_bind_int64(pUpdate, 2, iAbsLevel); } assert( p->bIgnoreSavepoint==0 ); p->bIgnoreSavepoint = 1; for(i=0; rc==SQLITE_OK && ibIgnoreSavepoint = 0; - sqlite3_free(aIdx); + tdsqlite3_free(aIdx); return rc; } -static void fts3StartNode(Blob *pNode, int iHeight, sqlite3_int64 iChild){ +static void fts3StartNode(Blob *pNode, int iHeight, tdsqlite3_int64 iChild){ pNode->a[0] = (char)iHeight; if( iChild ){ - assert( pNode->nAlloc>=1+sqlite3Fts3VarintLen(iChild) ); - pNode->n = 1 + sqlite3Fts3PutVarint(&pNode->a[1], iChild); + assert( pNode->nAlloc>=1+tdsqlite3Fts3VarintLen(iChild) ); + pNode->n = 1 + tdsqlite3Fts3PutVarint(&pNode->a[1], iChild); }else{ assert( pNode->nAlloc>=1 ); pNode->n = 1; @@ -184133,7 +184133,7 @@ static int fts3TruncateNode( Blob *pNew, /* OUT: Write new node image here */ const char *zTerm, /* Omit all terms smaller than this */ int nTerm, /* Size of zTerm in bytes */ - sqlite3_int64 *piBlock /* OUT: Block number in next layer down */ + tdsqlite3_int64 *piBlock /* OUT: Block number in next layer down */ ){ NodeReader reader; /* Reader object */ Blob prev = {0, 0, 0}; /* Previous term written to new node */ @@ -184172,7 +184172,7 @@ static int fts3TruncateNode( assert( pNew->n<=pNew->nAlloc ); nodeReaderRelease(&reader); - sqlite3_free(prev.a); + tdsqlite3_free(prev.a); return rc; } @@ -184187,7 +184187,7 @@ static int fts3TruncateNode( */ static int fts3TruncateSegment( Fts3Table *p, /* FTS3 table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level of segment to modify */ + tdsqlite3_int64 iAbsLevel, /* Absolute level of segment to modify */ int iIdx, /* Index within level of segment to modify */ const char *zTerm, /* Remove terms smaller than this */ int nTerm /* Number of bytes in buffer zTerm */ @@ -184195,23 +184195,23 @@ static int fts3TruncateSegment( int rc = SQLITE_OK; /* Return code */ Blob root = {0,0,0}; /* New root page image */ Blob block = {0,0,0}; /* Buffer used for any other block */ - sqlite3_int64 iBlock = 0; /* Block id */ - sqlite3_int64 iNewStart = 0; /* New value for iStartBlock */ - sqlite3_int64 iOldStart = 0; /* Old value for iStartBlock */ - sqlite3_stmt *pFetch = 0; /* Statement used to fetch segdir */ + tdsqlite3_int64 iBlock = 0; /* Block id */ + tdsqlite3_int64 iNewStart = 0; /* New value for iStartBlock */ + tdsqlite3_int64 iOldStart = 0; /* Old value for iStartBlock */ + tdsqlite3_stmt *pFetch = 0; /* Statement used to fetch segdir */ rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR, &pFetch, 0); if( rc==SQLITE_OK ){ - int rc2; /* sqlite3_reset() return code */ - sqlite3_bind_int64(pFetch, 1, iAbsLevel); - sqlite3_bind_int(pFetch, 2, iIdx); - if( SQLITE_ROW==sqlite3_step(pFetch) ){ - const char *aRoot = sqlite3_column_blob(pFetch, 4); - int nRoot = sqlite3_column_bytes(pFetch, 4); - iOldStart = sqlite3_column_int64(pFetch, 1); + int rc2; /* tdsqlite3_reset() return code */ + tdsqlite3_bind_int64(pFetch, 1, iAbsLevel); + tdsqlite3_bind_int(pFetch, 2, iIdx); + if( SQLITE_ROW==tdsqlite3_step(pFetch) ){ + const char *aRoot = tdsqlite3_column_blob(pFetch, 4); + int nRoot = tdsqlite3_column_bytes(pFetch, 4); + iOldStart = tdsqlite3_column_int64(pFetch, 1); rc = fts3TruncateNode(aRoot, nRoot, &root, zTerm, nTerm, &iBlock); } - rc2 = sqlite3_reset(pFetch); + rc2 = tdsqlite3_reset(pFetch); if( rc==SQLITE_OK ) rc = rc2; } @@ -184220,44 +184220,44 @@ static int fts3TruncateSegment( int nBlock = 0; iNewStart = iBlock; - rc = sqlite3Fts3ReadBlock(p, iBlock, &aBlock, &nBlock, 0); + rc = tdsqlite3Fts3ReadBlock(p, iBlock, &aBlock, &nBlock, 0); if( rc==SQLITE_OK ){ rc = fts3TruncateNode(aBlock, nBlock, &block, zTerm, nTerm, &iBlock); } if( rc==SQLITE_OK ){ rc = fts3WriteSegment(p, iNewStart, block.a, block.n); } - sqlite3_free(aBlock); + tdsqlite3_free(aBlock); } /* Variable iNewStart now contains the first valid leaf node. */ if( rc==SQLITE_OK && iNewStart ){ - sqlite3_stmt *pDel = 0; + tdsqlite3_stmt *pDel = 0; rc = fts3SqlStmt(p, SQL_DELETE_SEGMENTS_RANGE, &pDel, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pDel, 1, iOldStart); - sqlite3_bind_int64(pDel, 2, iNewStart-1); - sqlite3_step(pDel); - rc = sqlite3_reset(pDel); + tdsqlite3_bind_int64(pDel, 1, iOldStart); + tdsqlite3_bind_int64(pDel, 2, iNewStart-1); + tdsqlite3_step(pDel); + rc = tdsqlite3_reset(pDel); } } if( rc==SQLITE_OK ){ - sqlite3_stmt *pChomp = 0; + tdsqlite3_stmt *pChomp = 0; rc = fts3SqlStmt(p, SQL_CHOMP_SEGDIR, &pChomp, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pChomp, 1, iNewStart); - sqlite3_bind_blob(pChomp, 2, root.a, root.n, SQLITE_STATIC); - sqlite3_bind_int64(pChomp, 3, iAbsLevel); - sqlite3_bind_int(pChomp, 4, iIdx); - sqlite3_step(pChomp); - rc = sqlite3_reset(pChomp); - sqlite3_bind_null(pChomp, 2); + tdsqlite3_bind_int64(pChomp, 1, iNewStart); + tdsqlite3_bind_blob(pChomp, 2, root.a, root.n, SQLITE_STATIC); + tdsqlite3_bind_int64(pChomp, 3, iAbsLevel); + tdsqlite3_bind_int(pChomp, 4, iIdx); + tdsqlite3_step(pChomp); + rc = tdsqlite3_reset(pChomp); + tdsqlite3_bind_null(pChomp, 2); } } - sqlite3_free(root.a); - sqlite3_free(block.a); + tdsqlite3_free(root.a); + tdsqlite3_free(block.a); return rc; } @@ -184273,7 +184273,7 @@ static int fts3TruncateSegment( */ static int fts3IncrmergeChomp( Fts3Table *p, /* FTS table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level containing segments */ + tdsqlite3_int64 iAbsLevel, /* Absolute level containing segments */ Fts3MultiSegReader *pCsr, /* Chomp all segments opened by this cursor */ int *pnRem /* Number of segments not deleted */ ){ @@ -184323,16 +184323,16 @@ static int fts3IncrmergeChomp( ** Store an incr-merge hint in the database. */ static int fts3IncrmergeHintStore(Fts3Table *p, Blob *pHint){ - sqlite3_stmt *pReplace = 0; + tdsqlite3_stmt *pReplace = 0; int rc; /* Return code */ rc = fts3SqlStmt(p, SQL_REPLACE_STAT, &pReplace, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int(pReplace, 1, FTS_STAT_INCRMERGEHINT); - sqlite3_bind_blob(pReplace, 2, pHint->a, pHint->n, SQLITE_STATIC); - sqlite3_step(pReplace); - rc = sqlite3_reset(pReplace); - sqlite3_bind_null(pReplace, 2); + tdsqlite3_bind_int(pReplace, 1, FTS_STAT_INCRMERGEHINT); + tdsqlite3_bind_blob(pReplace, 2, pHint->a, pHint->n, SQLITE_STATIC); + tdsqlite3_step(pReplace); + rc = tdsqlite3_reset(pReplace); + tdsqlite3_bind_null(pReplace, 2); } return rc; @@ -184347,17 +184347,17 @@ static int fts3IncrmergeHintStore(Fts3Table *p, Blob *pHint){ ** SQLite error code. */ static int fts3IncrmergeHintLoad(Fts3Table *p, Blob *pHint){ - sqlite3_stmt *pSelect = 0; + tdsqlite3_stmt *pSelect = 0; int rc; pHint->n = 0; rc = fts3SqlStmt(p, SQL_SELECT_STAT, &pSelect, 0); if( rc==SQLITE_OK ){ int rc2; - sqlite3_bind_int(pSelect, 1, FTS_STAT_INCRMERGEHINT); - if( SQLITE_ROW==sqlite3_step(pSelect) ){ - const char *aHint = sqlite3_column_blob(pSelect, 0); - int nHint = sqlite3_column_bytes(pSelect, 0); + tdsqlite3_bind_int(pSelect, 1, FTS_STAT_INCRMERGEHINT); + if( SQLITE_ROW==tdsqlite3_step(pSelect) ){ + const char *aHint = tdsqlite3_column_blob(pSelect, 0); + int nHint = tdsqlite3_column_bytes(pSelect, 0); if( aHint ){ blobGrowBuffer(pHint, nHint, &rc); if( rc==SQLITE_OK ){ @@ -184366,7 +184366,7 @@ static int fts3IncrmergeHintLoad(Fts3Table *p, Blob *pHint){ } } } - rc2 = sqlite3_reset(pSelect); + rc2 = tdsqlite3_reset(pSelect); if( rc==SQLITE_OK ) rc = rc2; } @@ -184390,8 +184390,8 @@ static void fts3IncrmergeHintPush( ){ blobGrowBuffer(pHint, pHint->n + 2*FTS3_VARINT_MAX, pRc); if( *pRc==SQLITE_OK ){ - pHint->n += sqlite3Fts3PutVarint(&pHint->a[pHint->n], iAbsLevel); - pHint->n += sqlite3Fts3PutVarint(&pHint->a[pHint->n], (i64)nInput); + pHint->n += tdsqlite3Fts3PutVarint(&pHint->a[pHint->n], iAbsLevel); + pHint->n += tdsqlite3Fts3PutVarint(&pHint->a[pHint->n], (i64)nInput); } } @@ -184415,7 +184415,7 @@ static int fts3IncrmergeHintPop(Blob *pHint, i64 *piAbsLevel, int *pnInput){ while( i>0 && (pHint->a[i-1] & 0x80) ) i--; pHint->n = i; - i += sqlite3Fts3GetVarint(&pHint->a[i], piAbsLevel); + i += tdsqlite3Fts3GetVarint(&pHint->a[i], piAbsLevel); i += fts3GetVarint32(&pHint->a[i], pnInput); assert( i<=nHint ); if( i!=nHint ) return FTS_CORRUPT_VTAB; @@ -184433,20 +184433,20 @@ static int fts3IncrmergeHintPop(Blob *pHint, i64 *piAbsLevel, int *pnInput){ ** at least nMin segments. Multiple merges might occur in an attempt to ** write the quota of nMerge leaf blocks. */ -SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ +SQLITE_PRIVATE int tdsqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ int rc; /* Return code */ int nRem = nMerge; /* Number of leaf pages yet to be written */ Fts3MultiSegReader *pCsr; /* Cursor used to read input data */ Fts3SegFilter *pFilter; /* Filter used with cursor pCsr */ IncrmergeWriter *pWriter; /* Writer object */ int nSeg = 0; /* Number of input segments */ - sqlite3_int64 iAbsLevel = 0; /* Absolute level number to work on */ + tdsqlite3_int64 iAbsLevel = 0; /* Absolute level number to work on */ Blob hint = {0, 0, 0}; /* Hint read from %_stat table */ int bDirtyHint = 0; /* True if blob 'hint' has been modified */ /* Allocate space for the cursor, filter and writer objects */ const int nAlloc = sizeof(*pCsr) + sizeof(*pFilter) + sizeof(*pWriter); - pWriter = (IncrmergeWriter *)sqlite3_malloc(nAlloc); + pWriter = (IncrmergeWriter *)tdsqlite3_malloc(nAlloc); if( !pWriter ) return SQLITE_NOMEM; pFilter = (Fts3SegFilter *)&pWriter[1]; pCsr = (Fts3MultiSegReader *)&pFilter[1]; @@ -184454,7 +184454,7 @@ SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ rc = fts3IncrmergeHintLoad(p, &hint); while( rc==SQLITE_OK && nRem>0 ){ const i64 nMod = FTS3_SEGDIR_MAXLEVEL * p->nIndex; - sqlite3_stmt *pFindLevel = 0; /* SQL used to determine iAbsLevel */ + tdsqlite3_stmt *pFindLevel = 0; /* SQL used to determine iAbsLevel */ int bUseHint = 0; /* True if attempting to append */ int iIdx = 0; /* Largest idx in level (iAbsLevel+1) */ @@ -184465,15 +184465,15 @@ SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ ** set nSeg to -1. */ rc = fts3SqlStmt(p, SQL_FIND_MERGE_LEVEL, &pFindLevel, 0); - sqlite3_bind_int(pFindLevel, 1, MAX(2, nMin)); - if( sqlite3_step(pFindLevel)==SQLITE_ROW ){ - iAbsLevel = sqlite3_column_int64(pFindLevel, 0); - nSeg = sqlite3_column_int(pFindLevel, 1); + tdsqlite3_bind_int(pFindLevel, 1, MAX(2, nMin)); + if( tdsqlite3_step(pFindLevel)==SQLITE_ROW ){ + iAbsLevel = tdsqlite3_column_int64(pFindLevel, 0); + nSeg = tdsqlite3_column_int(pFindLevel, 1); assert( nSeg>=2 ); }else{ nSeg = -1; } - rc = sqlite3_reset(pFindLevel); + rc = tdsqlite3_reset(pFindLevel); /* If the hint read from the %_stat table is not empty, check if the ** last entry in it specifies a relative level smaller than or equal @@ -184482,7 +184482,7 @@ SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ */ if( rc==SQLITE_OK && hint.n ){ int nHint = hint.n; - sqlite3_int64 iHintAbsLevel = 0; /* Hint level */ + tdsqlite3_int64 iHintAbsLevel = 0; /* Hint level */ int nHintSeg = 0; /* Hint number of segments */ rc = fts3IncrmergeHintPop(&hint, &iHintAbsLevel, &nHintSeg); @@ -184534,14 +184534,14 @@ SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ rc = fts3IncrmergeCsr(p, iAbsLevel, nSeg, pCsr); } if( SQLITE_OK==rc && pCsr->nSegment==nSeg - && SQLITE_OK==(rc = sqlite3Fts3SegReaderStart(p, pCsr, pFilter)) + && SQLITE_OK==(rc = tdsqlite3Fts3SegReaderStart(p, pCsr, pFilter)) ){ int bEmpty = 0; - rc = sqlite3Fts3SegReaderStep(p, pCsr); + rc = tdsqlite3Fts3SegReaderStep(p, pCsr); if( rc==SQLITE_OK ){ bEmpty = 1; }else if( rc!=SQLITE_ROW ){ - sqlite3Fts3SegReaderFinish(pCsr); + tdsqlite3Fts3SegReaderFinish(pCsr); break; } if( bUseHint && iIdx>0 ){ @@ -184557,7 +184557,7 @@ SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ if( bEmpty==0 ){ do { rc = fts3IncrmergeAppend(p, pWriter, pCsr); - if( rc==SQLITE_OK ) rc = sqlite3Fts3SegReaderStep(p, pCsr); + if( rc==SQLITE_OK ) rc = tdsqlite3Fts3SegReaderStep(p, pCsr); if( pWriter->nWork>=nRem && rc==SQLITE_ROW ) rc = SQLITE_OK; }while( rc==SQLITE_ROW ); } @@ -184582,7 +184582,7 @@ SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ } } - sqlite3Fts3SegReaderFinish(pCsr); + tdsqlite3Fts3SegReaderFinish(pCsr); } /* Write the hint values into the %_stat table for the next incr-merger */ @@ -184590,8 +184590,8 @@ SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ rc = fts3IncrmergeHintStore(p, &hint); } - sqlite3_free(pWriter); - sqlite3_free(hint.a); + tdsqlite3_free(pWriter); + tdsqlite3_free(hint.a); return rc; } @@ -184645,12 +184645,12 @@ static int fts3DoIncrmerge( rc = SQLITE_OK; if( !p->bHasStat ){ assert( p->bFts4==0 ); - sqlite3Fts3CreateStatTable(&rc, p); + tdsqlite3Fts3CreateStatTable(&rc, p); } if( rc==SQLITE_OK ){ - rc = sqlite3Fts3Incrmerge(p, nMerge, nMin); + rc = tdsqlite3Fts3Incrmerge(p, nMerge, nMin); } - sqlite3Fts3SegmentsClose(p); + tdsqlite3Fts3SegmentsClose(p); } return rc; } @@ -184668,22 +184668,22 @@ static int fts3DoAutoincrmerge( const char *zParam /* Nul-terminated string containing boolean */ ){ int rc = SQLITE_OK; - sqlite3_stmt *pStmt = 0; + tdsqlite3_stmt *pStmt = 0; p->nAutoincrmerge = fts3Getint(&zParam); if( p->nAutoincrmerge==1 || p->nAutoincrmerge>MergeCount(p) ){ p->nAutoincrmerge = 8; } if( !p->bHasStat ){ assert( p->bFts4==0 ); - sqlite3Fts3CreateStatTable(&rc, p); + tdsqlite3Fts3CreateStatTable(&rc, p); if( rc ) return rc; } rc = fts3SqlStmt(p, SQL_REPLACE_STAT, &pStmt, 0); if( rc ) return rc; - sqlite3_bind_int(pStmt, 1, FTS_STAT_AUTOINCRMERGE); - sqlite3_bind_int(pStmt, 2, p->nAutoincrmerge); - sqlite3_step(pStmt); - rc = sqlite3_reset(pStmt); + tdsqlite3_bind_int(pStmt, 1, FTS_STAT_AUTOINCRMERGE); + tdsqlite3_bind_int(pStmt, 2, p->nAutoincrmerge); + tdsqlite3_step(pStmt); + rc = tdsqlite3_reset(pStmt); return rc; } @@ -184739,15 +184739,15 @@ static u64 fts3ChecksumIndex( filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY; filter.flags |= FTS3_SEGMENT_SCAN; - rc = sqlite3Fts3SegReaderCursor( + rc = tdsqlite3Fts3SegReaderCursor( p, iLangid, iIndex, FTS3_SEGCURSOR_ALL, 0, 0, 0, 1,&csr ); if( rc==SQLITE_OK ){ - rc = sqlite3Fts3SegReaderStart(p, &csr, &filter); + rc = tdsqlite3Fts3SegReaderStart(p, &csr, &filter); } if( rc==SQLITE_OK ){ - while( SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, &csr)) ){ + while( SQLITE_ROW==(rc = tdsqlite3Fts3SegReaderStep(p, &csr)) ){ char *pCsr = csr.aDoclist; char *pEnd = &pCsr[csr.nDoclist]; @@ -184755,18 +184755,18 @@ static u64 fts3ChecksumIndex( i64 iCol = 0; u64 iPos = 0; - pCsr += sqlite3Fts3GetVarint(pCsr, &iDocid); + pCsr += tdsqlite3Fts3GetVarint(pCsr, &iDocid); while( pCsrbDescIdx ){ iDocid = (i64)((u64)iDocid - iVal); }else{ @@ -184784,7 +184784,7 @@ static u64 fts3ChecksumIndex( } } } - sqlite3Fts3SegReaderFinish(&csr); + tdsqlite3Fts3SegReaderFinish(&csr); *pRc = rc; return cksum; @@ -184803,50 +184803,50 @@ static int fts3IntegrityCheck(Fts3Table *p, int *pbOk){ int rc = SQLITE_OK; /* Return code */ u64 cksum1 = 0; /* Checksum based on FTS index contents */ u64 cksum2 = 0; /* Checksum based on %_content contents */ - sqlite3_stmt *pAllLangid = 0; /* Statement to return all language-ids */ + tdsqlite3_stmt *pAllLangid = 0; /* Statement to return all language-ids */ /* This block calculates the checksum according to the FTS index. */ rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0); if( rc==SQLITE_OK ){ int rc2; - sqlite3_bind_int(pAllLangid, 1, p->iPrevLangid); - sqlite3_bind_int(pAllLangid, 2, p->nIndex); - while( rc==SQLITE_OK && sqlite3_step(pAllLangid)==SQLITE_ROW ){ - int iLangid = sqlite3_column_int(pAllLangid, 0); + tdsqlite3_bind_int(pAllLangid, 1, p->iPrevLangid); + tdsqlite3_bind_int(pAllLangid, 2, p->nIndex); + while( rc==SQLITE_OK && tdsqlite3_step(pAllLangid)==SQLITE_ROW ){ + int iLangid = tdsqlite3_column_int(pAllLangid, 0); int i; for(i=0; inIndex; i++){ cksum1 = cksum1 ^ fts3ChecksumIndex(p, iLangid, i, &rc); } } - rc2 = sqlite3_reset(pAllLangid); + rc2 = tdsqlite3_reset(pAllLangid); if( rc==SQLITE_OK ) rc = rc2; } /* This block calculates the checksum according to the %_content table */ if( rc==SQLITE_OK ){ - sqlite3_tokenizer_module const *pModule = p->pTokenizer->pModule; - sqlite3_stmt *pStmt = 0; + tdsqlite3_tokenizer_module const *pModule = p->pTokenizer->pModule; + tdsqlite3_stmt *pStmt = 0; char *zSql; - zSql = sqlite3_mprintf("SELECT %s" , p->zReadExprlist); + zSql = tdsqlite3_mprintf("SELECT %s" , p->zReadExprlist); if( !zSql ){ rc = SQLITE_NOMEM; }else{ - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); - sqlite3_free(zSql); + rc = tdsqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); + tdsqlite3_free(zSql); } - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ - i64 iDocid = sqlite3_column_int64(pStmt, 0); + while( rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pStmt) ){ + i64 iDocid = tdsqlite3_column_int64(pStmt, 0); int iLang = langidFromSelect(p, pStmt); int iCol; for(iCol=0; rc==SQLITE_OK && iColnColumn; iCol++){ if( p->abNotindexed[iCol]==0 ){ - const char *zText = (const char *)sqlite3_column_text(pStmt, iCol+1); - sqlite3_tokenizer_cursor *pT = 0; + const char *zText = (const char *)tdsqlite3_column_text(pStmt, iCol+1); + tdsqlite3_tokenizer_cursor *pT = 0; - rc = sqlite3Fts3OpenTokenizer(p->pTokenizer, iLang, zText, -1, &pT); + rc = tdsqlite3Fts3OpenTokenizer(p->pTokenizer, iLang, zText, -1, &pT); while( rc==SQLITE_OK ){ char const *zToken; /* Buffer containing token */ int nToken = 0; /* Number of bytes in token */ @@ -184874,7 +184874,7 @@ static int fts3IntegrityCheck(Fts3Table *p, int *pbOk){ } } - sqlite3_finalize(pStmt); + tdsqlite3_finalize(pStmt); } *pbOk = (cksum1==cksum2); @@ -184930,38 +184930,38 @@ static int fts3DoIntegrityCheck( ** Argument pVal contains the result of . Currently the only ** meaningful value to insert is the text 'optimize'. */ -static int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){ +static int fts3SpecialInsert(Fts3Table *p, tdsqlite3_value *pVal){ int rc = SQLITE_ERROR; /* Return Code */ - const char *zVal = (const char *)sqlite3_value_text(pVal); - int nVal = sqlite3_value_bytes(pVal); + const char *zVal = (const char *)tdsqlite3_value_text(pVal); + int nVal = tdsqlite3_value_bytes(pVal); if( !zVal ){ return SQLITE_NOMEM; - }else if( nVal==8 && 0==sqlite3_strnicmp(zVal, "optimize", 8) ){ + }else if( nVal==8 && 0==tdsqlite3_strnicmp(zVal, "optimize", 8) ){ rc = fts3DoOptimize(p, 0); - }else if( nVal==7 && 0==sqlite3_strnicmp(zVal, "rebuild", 7) ){ + }else if( nVal==7 && 0==tdsqlite3_strnicmp(zVal, "rebuild", 7) ){ rc = fts3DoRebuild(p); - }else if( nVal==15 && 0==sqlite3_strnicmp(zVal, "integrity-check", 15) ){ + }else if( nVal==15 && 0==tdsqlite3_strnicmp(zVal, "integrity-check", 15) ){ rc = fts3DoIntegrityCheck(p); - }else if( nVal>6 && 0==sqlite3_strnicmp(zVal, "merge=", 6) ){ + }else if( nVal>6 && 0==tdsqlite3_strnicmp(zVal, "merge=", 6) ){ rc = fts3DoIncrmerge(p, &zVal[6]); - }else if( nVal>10 && 0==sqlite3_strnicmp(zVal, "automerge=", 10) ){ + }else if( nVal>10 && 0==tdsqlite3_strnicmp(zVal, "automerge=", 10) ){ rc = fts3DoAutoincrmerge(p, &zVal[10]); #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) }else{ int v; - if( nVal>9 && 0==sqlite3_strnicmp(zVal, "nodesize=", 9) ){ + if( nVal>9 && 0==tdsqlite3_strnicmp(zVal, "nodesize=", 9) ){ v = atoi(&zVal[9]); if( v>=24 && v<=p->nPgsz-35 ) p->nNodeSize = v; rc = SQLITE_OK; - }else if( nVal>11 && 0==sqlite3_strnicmp(zVal, "maxpending=", 9) ){ + }else if( nVal>11 && 0==tdsqlite3_strnicmp(zVal, "maxpending=", 9) ){ v = atoi(&zVal[11]); if( v>=64 && v<=FTS3_MAX_PENDING_DATA ) p->nMaxPendingData = v; rc = SQLITE_OK; - }else if( nVal>21 && 0==sqlite3_strnicmp(zVal,"test-no-incr-doclist=",21) ){ + }else if( nVal>21 && 0==tdsqlite3_strnicmp(zVal,"test-no-incr-doclist=",21) ){ p->bNoIncrDoclist = atoi(&zVal[21]); rc = SQLITE_OK; - }else if( nVal>11 && 0==sqlite3_strnicmp(zVal,"mergecount=",11) ){ + }else if( nVal>11 && 0==tdsqlite3_strnicmp(zVal,"mergecount=",11) ){ v = atoi(&zVal[11]); if( v>=4 && v<=FTS3_MERGE_COUNT && (v&1)==0 ) p->nMergeCount = v; rc = SQLITE_OK; @@ -184974,9 +184974,9 @@ static int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){ #ifndef SQLITE_DISABLE_FTS4_DEFERRED /* ** Delete all cached deferred doclists. Deferred doclists are cached -** (allocated) by the sqlite3Fts3CacheDeferredDoclists() function. +** (allocated) by the tdsqlite3Fts3CacheDeferredDoclists() function. */ -SQLITE_PRIVATE void sqlite3Fts3FreeDeferredDoclists(Fts3Cursor *pCsr){ +SQLITE_PRIVATE void tdsqlite3Fts3FreeDeferredDoclists(Fts3Cursor *pCsr){ Fts3DeferredToken *pDef; for(pDef=pCsr->pDeferred; pDef; pDef=pDef->pNext){ fts3PendingListDelete(pDef->pList); @@ -184986,15 +184986,15 @@ SQLITE_PRIVATE void sqlite3Fts3FreeDeferredDoclists(Fts3Cursor *pCsr){ /* ** Free all entries in the pCsr->pDeffered list. Entries are added to -** this list using sqlite3Fts3DeferToken(). +** this list using tdsqlite3Fts3DeferToken(). */ -SQLITE_PRIVATE void sqlite3Fts3FreeDeferredTokens(Fts3Cursor *pCsr){ +SQLITE_PRIVATE void tdsqlite3Fts3FreeDeferredTokens(Fts3Cursor *pCsr){ Fts3DeferredToken *pDef; Fts3DeferredToken *pNext; for(pDef=pCsr->pDeferred; pDef; pDef=pNext){ pNext = pDef->pNext; fts3PendingListDelete(pDef->pList); - sqlite3_free(pDef); + tdsqlite3_free(pDef); } pCsr->pDeferred = 0; } @@ -185007,26 +185007,26 @@ SQLITE_PRIVATE void sqlite3Fts3FreeDeferredTokens(Fts3Cursor *pCsr){ ** included, except that it only contains entries for a single row of the ** table, not for all rows. */ -SQLITE_PRIVATE int sqlite3Fts3CacheDeferredDoclists(Fts3Cursor *pCsr){ +SQLITE_PRIVATE int tdsqlite3Fts3CacheDeferredDoclists(Fts3Cursor *pCsr){ int rc = SQLITE_OK; /* Return code */ if( pCsr->pDeferred ){ int i; /* Used to iterate through table columns */ - sqlite3_int64 iDocid; /* Docid of the row pCsr points to */ + tdsqlite3_int64 iDocid; /* Docid of the row pCsr points to */ Fts3DeferredToken *pDef; /* Used to iterate through deferred tokens */ Fts3Table *p = (Fts3Table *)pCsr->base.pVtab; - sqlite3_tokenizer *pT = p->pTokenizer; - sqlite3_tokenizer_module const *pModule = pT->pModule; + tdsqlite3_tokenizer *pT = p->pTokenizer; + tdsqlite3_tokenizer_module const *pModule = pT->pModule; assert( pCsr->isRequireSeek==0 ); - iDocid = sqlite3_column_int64(pCsr->pStmt, 0); + iDocid = tdsqlite3_column_int64(pCsr->pStmt, 0); for(i=0; inColumn && rc==SQLITE_OK; i++){ if( p->abNotindexed[i]==0 ){ - const char *zText = (const char *)sqlite3_column_text(pCsr->pStmt, i+1); - sqlite3_tokenizer_cursor *pTC = 0; + const char *zText = (const char *)tdsqlite3_column_text(pCsr->pStmt, i+1); + tdsqlite3_tokenizer_cursor *pTC = 0; - rc = sqlite3Fts3OpenTokenizer(pT, pCsr->iLangid, zText, -1, &pTC); + rc = tdsqlite3Fts3OpenTokenizer(pT, pCsr->iLangid, zText, -1, &pTC); while( rc==SQLITE_OK ){ char const *zToken; /* Buffer containing token */ int nToken = 0; /* Number of bytes in token */ @@ -185060,14 +185060,14 @@ SQLITE_PRIVATE int sqlite3Fts3CacheDeferredDoclists(Fts3Cursor *pCsr){ return rc; } -SQLITE_PRIVATE int sqlite3Fts3DeferredTokenList( +SQLITE_PRIVATE int tdsqlite3Fts3DeferredTokenList( Fts3DeferredToken *p, char **ppData, int *pnData ){ char *pRet; int nSkip; - sqlite3_int64 dummy; + tdsqlite3_int64 dummy; *ppData = 0; *pnData = 0; @@ -185076,10 +185076,10 @@ SQLITE_PRIVATE int sqlite3Fts3DeferredTokenList( return SQLITE_OK; } - pRet = (char *)sqlite3_malloc(p->pList->nData); + pRet = (char *)tdsqlite3_malloc(p->pList->nData); if( !pRet ) return SQLITE_NOMEM; - nSkip = sqlite3Fts3GetVarint(p->pList->aData, &dummy); + nSkip = tdsqlite3Fts3GetVarint(p->pList->aData, &dummy); *pnData = p->pList->nData - nSkip; *ppData = pRet; @@ -185090,13 +185090,13 @@ SQLITE_PRIVATE int sqlite3Fts3DeferredTokenList( /* ** Add an entry for token pToken to the pCsr->pDeferred list. */ -SQLITE_PRIVATE int sqlite3Fts3DeferToken( +SQLITE_PRIVATE int tdsqlite3Fts3DeferToken( Fts3Cursor *pCsr, /* Fts3 table cursor */ Fts3PhraseToken *pToken, /* Token to defer */ int iCol /* Column that token must appear in (or -1) */ ){ Fts3DeferredToken *pDeferred; - pDeferred = sqlite3_malloc(sizeof(*pDeferred)); + pDeferred = tdsqlite3_malloc(sizeof(*pDeferred)); if( !pDeferred ){ return SQLITE_NOMEM; } @@ -185120,7 +185120,7 @@ SQLITE_PRIVATE int sqlite3Fts3DeferToken( */ static int fts3DeleteByRowid( Fts3Table *p, - sqlite3_value *pRowid, + tdsqlite3_value *pRowid, int *pnChng, /* IN/OUT: Decrement if row is deleted */ u32 *aSzDel ){ @@ -185167,10 +185167,10 @@ static int fts3DeleteByRowid( ** ** */ -SQLITE_PRIVATE int sqlite3Fts3UpdateMethod( - sqlite3_vtab *pVtab, /* FTS3 vtab object */ +SQLITE_PRIVATE int tdsqlite3Fts3UpdateMethod( + tdsqlite3_vtab *pVtab, /* FTS3 vtab object */ int nArg, /* Size of argument array */ - sqlite3_value **apVal, /* Array of arguments */ + tdsqlite3_value **apVal, /* Array of arguments */ sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */ ){ Fts3Table *p = (Fts3Table *)pVtab; @@ -185195,20 +185195,20 @@ SQLITE_PRIVATE int sqlite3Fts3UpdateMethod( ** INSERT INTO xyz(xyz) VALUES('command'); */ if( nArg>1 - && sqlite3_value_type(apVal[0])==SQLITE_NULL - && sqlite3_value_type(apVal[p->nColumn+2])!=SQLITE_NULL + && tdsqlite3_value_type(apVal[0])==SQLITE_NULL + && tdsqlite3_value_type(apVal[p->nColumn+2])!=SQLITE_NULL ){ rc = fts3SpecialInsert(p, apVal[p->nColumn+2]); goto update_out; } - if( nArg>1 && sqlite3_value_int(apVal[2 + p->nColumn + 2])<0 ){ + if( nArg>1 && tdsqlite3_value_int(apVal[2 + p->nColumn + 2])<0 ){ rc = SQLITE_CONSTRAINT; goto update_out; } /* Allocate space to hold the change in document sizes */ - aSzDel = sqlite3_malloc64(sizeof(aSzDel[0])*((sqlite3_int64)p->nColumn+1)*2); + aSzDel = tdsqlite3_malloc64(sizeof(aSzDel[0])*((tdsqlite3_int64)p->nColumn+1)*2); if( aSzDel==0 ){ rc = SQLITE_NOMEM; goto update_out; @@ -185230,14 +185230,14 @@ SQLITE_PRIVATE int sqlite3Fts3UpdateMethod( */ if( nArg>1 && p->zContentTbl==0 ){ /* Find the value object that holds the new rowid value. */ - sqlite3_value *pNewRowid = apVal[3+p->nColumn]; - if( sqlite3_value_type(pNewRowid)==SQLITE_NULL ){ + tdsqlite3_value *pNewRowid = apVal[3+p->nColumn]; + if( tdsqlite3_value_type(pNewRowid)==SQLITE_NULL ){ pNewRowid = apVal[1]; } - if( sqlite3_value_type(pNewRowid)!=SQLITE_NULL && ( - sqlite3_value_type(apVal[0])==SQLITE_NULL - || sqlite3_value_int64(apVal[0])!=sqlite3_value_int64(pNewRowid) + if( tdsqlite3_value_type(pNewRowid)!=SQLITE_NULL && ( + tdsqlite3_value_type(apVal[0])==SQLITE_NULL + || tdsqlite3_value_int64(apVal[0])!=tdsqlite3_value_int64(pNewRowid) )){ /* The new rowid is not NULL (in this case the rowid will be ** automatically assigned and there is no chance of a conflict), and @@ -185256,7 +185256,7 @@ SQLITE_PRIVATE int sqlite3Fts3UpdateMethod( ** invoked, it will delete zero rows (since no row will have ** docid=$pNewRowid if $pNewRowid is not an integer value). */ - if( sqlite3_vtab_on_conflict(p->db)==SQLITE_REPLACE ){ + if( tdsqlite3_vtab_on_conflict(p->db)==SQLITE_REPLACE ){ rc = fts3DeleteByRowid(p, pNewRowid, &nChng, aSzDel); }else{ rc = fts3InsertData(p, apVal, pRowid); @@ -185269,14 +185269,14 @@ SQLITE_PRIVATE int sqlite3Fts3UpdateMethod( } /* If this is a DELETE or UPDATE operation, remove the old record. */ - if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){ - assert( sqlite3_value_type(apVal[0])==SQLITE_INTEGER ); + if( tdsqlite3_value_type(apVal[0])!=SQLITE_NULL ){ + assert( tdsqlite3_value_type(apVal[0])==SQLITE_INTEGER ); rc = fts3DeleteByRowid(p, apVal[0], &nChng, aSzDel); } /* If this is an INSERT or UPDATE operation, insert the new record. */ if( nArg>1 && rc==SQLITE_OK ){ - int iLangid = sqlite3_value_int(apVal[2 + p->nColumn + 2]); + int iLangid = tdsqlite3_value_int(apVal[2 + p->nColumn + 2]); if( bInsertDone==0 ){ rc = fts3InsertData(p, apVal, pRowid); if( rc==SQLITE_CONSTRAINT && p->zContentTbl==0 ){ @@ -185301,8 +185301,8 @@ SQLITE_PRIVATE int sqlite3Fts3UpdateMethod( } update_out: - sqlite3_free(aSzDel); - sqlite3Fts3SegmentsClose(p); + tdsqlite3_free(aSzDel); + tdsqlite3Fts3SegmentsClose(p); return rc; } @@ -185311,20 +185311,20 @@ SQLITE_PRIVATE int sqlite3Fts3UpdateMethod( ** merge all segments in the database (including the new segment, if ** there was any data to flush) into a single segment. */ -SQLITE_PRIVATE int sqlite3Fts3Optimize(Fts3Table *p){ +SQLITE_PRIVATE int tdsqlite3Fts3Optimize(Fts3Table *p){ int rc; - rc = sqlite3_exec(p->db, "SAVEPOINT fts3", 0, 0, 0); + rc = tdsqlite3_exec(p->db, "SAVEPOINT fts3", 0, 0, 0); if( rc==SQLITE_OK ){ rc = fts3DoOptimize(p, 1); if( rc==SQLITE_OK || rc==SQLITE_DONE ){ - int rc2 = sqlite3_exec(p->db, "RELEASE fts3", 0, 0, 0); + int rc2 = tdsqlite3_exec(p->db, "RELEASE fts3", 0, 0, 0); if( rc2!=SQLITE_OK ) rc = rc2; }else{ - sqlite3_exec(p->db, "ROLLBACK TO fts3", 0, 0, 0); - sqlite3_exec(p->db, "RELEASE fts3", 0, 0, 0); + tdsqlite3_exec(p->db, "ROLLBACK TO fts3", 0, 0, 0); + tdsqlite3_exec(p->db, "RELEASE fts3", 0, 0, 0); } } - sqlite3Fts3SegmentsClose(p); + tdsqlite3Fts3SegmentsClose(p); return rc; } @@ -185423,7 +185423,7 @@ struct MatchInfo { Fts3Cursor *pCursor; /* FTS3 Cursor */ int nCol; /* Number of columns in table */ int nPhrase; /* Number of matchable phrases in query */ - sqlite3_int64 nDoc; /* Number of docs in database */ + tdsqlite3_int64 nDoc; /* Number of docs in database */ char flag; u32 *aMatchinfo; /* Pre-allocated buffer */ }; @@ -185464,11 +185464,11 @@ struct StrBuffer { */ static MatchinfoBuffer *fts3MIBufferNew(size_t nElem, const char *zMatchinfo){ MatchinfoBuffer *pRet; - sqlite3_int64 nByte = sizeof(u32) * (2*(sqlite3_int64)nElem + 1) + tdsqlite3_int64 nByte = sizeof(u32) * (2*(tdsqlite3_int64)nElem + 1) + sizeof(MatchinfoBuffer); - sqlite3_int64 nStr = strlen(zMatchinfo); + tdsqlite3_int64 nStr = strlen(zMatchinfo); - pRet = sqlite3_malloc64(nByte + nStr+1); + pRet = tdsqlite3_malloc64(nByte + nStr+1); if( pRet ){ memset(pRet, 0, nByte); pRet->aMatchinfo[0] = (u8*)(&pRet->aMatchinfo[1]) - (u8*)pRet; @@ -185496,7 +185496,7 @@ static void fts3MIBufferFree(void *p){ } if( pBuf->aRef[0]==0 && pBuf->aRef[1]==0 && pBuf->aRef[2]==0 ){ - sqlite3_free(pBuf); + tdsqlite3_free(pBuf); } } @@ -185514,9 +185514,9 @@ static void (*fts3MIBufferAlloc(MatchinfoBuffer *p, u32 **paOut))(void*){ aOut = &p->aMatchinfo[p->nElem+2]; xRet = fts3MIBufferFree; }else{ - aOut = (u32*)sqlite3_malloc64(p->nElem * sizeof(u32)); + aOut = (u32*)tdsqlite3_malloc64(p->nElem * sizeof(u32)); if( aOut ){ - xRet = sqlite3_free; + xRet = tdsqlite3_free; if( p->bGlobal ) memcpy(aOut, &p->aMatchinfo[1], p->nElem*sizeof(u32)); } } @@ -185533,12 +185533,12 @@ static void fts3MIBufferSetGlobal(MatchinfoBuffer *p){ /* ** Free a MatchinfoBuffer object allocated using fts3MIBufferNew() */ -SQLITE_PRIVATE void sqlite3Fts3MIBufferFree(MatchinfoBuffer *p){ +SQLITE_PRIVATE void tdsqlite3Fts3MIBufferFree(MatchinfoBuffer *p){ if( p ){ assert( p->aRef[0]==1 ); p->aRef[0] = 0; if( p->aRef[0]==0 && p->aRef[1]==0 && p->aRef[2]==0 ){ - sqlite3_free(p); + tdsqlite3_free(p); } } } @@ -185806,7 +185806,7 @@ static int fts3SnippetFindPositions(Fts3Expr *pExpr, int iPhrase, void *ctx){ int rc; pPhrase->nToken = pExpr->pPhrase->nToken; - rc = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pCsr); + rc = tdsqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pCsr); assert( rc==SQLITE_OK || pCsr==0 ); if( pCsr ){ int iFirst = 0; @@ -185856,7 +185856,7 @@ static int fts3BestSnippet( int rc; /* Return Code */ int nList; /* Number of phrases in expression */ SnippetIter sIter; /* Iterates through snippet candidates */ - sqlite3_int64 nByte; /* Number of bytes of space to allocate */ + tdsqlite3_int64 nByte; /* Number of bytes of space to allocate */ int iBestScore = -1; /* Best snippet score found so far */ int i; /* Loop counter */ @@ -185874,7 +185874,7 @@ static int fts3BestSnippet( ** the required space using malloc(). */ nByte = sizeof(SnippetPhrase) * nList; - sIter.aPhrase = (SnippetPhrase *)sqlite3_malloc64(nByte); + sIter.aPhrase = (SnippetPhrase *)tdsqlite3_malloc64(nByte); if( !sIter.aPhrase ){ return SQLITE_NOMEM; } @@ -185919,7 +185919,7 @@ static int fts3BestSnippet( *piScore = iBestScore; } - sqlite3_free(sIter.aPhrase); + tdsqlite3_free(sIter.aPhrase); return rc; } @@ -185944,8 +185944,8 @@ static int fts3StringAppend( ** appended data. */ if( pStr->n+nAppend+1>=pStr->nAlloc ){ - sqlite3_int64 nAlloc = pStr->nAlloc+(sqlite3_int64)nAppend+100; - char *zNew = sqlite3_realloc64(pStr->z, nAlloc); + tdsqlite3_int64 nAlloc = pStr->nAlloc+(tdsqlite3_int64)nAppend+100; + char *zNew = tdsqlite3_realloc64(pStr->z, nAlloc); if( !zNew ){ return SQLITE_NOMEM; } @@ -186014,14 +186014,14 @@ static int fts3SnippetShift( int nShift; /* Number of tokens to shift snippet by */ int iCurrent = 0; /* Token counter */ int rc; /* Return Code */ - sqlite3_tokenizer_module *pMod; - sqlite3_tokenizer_cursor *pC; - pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule; + tdsqlite3_tokenizer_module *pMod; + tdsqlite3_tokenizer_cursor *pC; + pMod = (tdsqlite3_tokenizer_module *)pTab->pTokenizer->pModule; /* Open a cursor on zDoc/nDoc. Check if there are (nSnippet+nDesired) ** or more tokens in zDoc/nDoc. */ - rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, iLangid, zDoc, nDoc, &pC); + rc = tdsqlite3Fts3OpenTokenizer(pTab->pTokenizer, iLangid, zDoc, nDoc, &pC); if( rc!=SQLITE_OK ){ return rc; } @@ -186068,21 +186068,21 @@ static int fts3SnippetText( int iPos = pFragment->iPos; /* First token of snippet */ u64 hlmask = pFragment->hlmask; /* Highlight-mask for snippet */ int iCol = pFragment->iCol+1; /* Query column to extract text from */ - sqlite3_tokenizer_module *pMod; /* Tokenizer module methods object */ - sqlite3_tokenizer_cursor *pC; /* Tokenizer cursor open on zDoc/nDoc */ + tdsqlite3_tokenizer_module *pMod; /* Tokenizer module methods object */ + tdsqlite3_tokenizer_cursor *pC; /* Tokenizer cursor open on zDoc/nDoc */ - zDoc = (const char *)sqlite3_column_text(pCsr->pStmt, iCol); + zDoc = (const char *)tdsqlite3_column_text(pCsr->pStmt, iCol); if( zDoc==0 ){ - if( sqlite3_column_type(pCsr->pStmt, iCol)!=SQLITE_NULL ){ + if( tdsqlite3_column_type(pCsr->pStmt, iCol)!=SQLITE_NULL ){ return SQLITE_NOMEM; } return SQLITE_OK; } - nDoc = sqlite3_column_bytes(pCsr->pStmt, iCol); + nDoc = tdsqlite3_column_bytes(pCsr->pStmt, iCol); /* Open a token cursor on the document. */ - pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule; - rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid, zDoc,nDoc,&pC); + pMod = (tdsqlite3_tokenizer_module *)pTab->pTokenizer->pModule; + rc = tdsqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid, zDoc,nDoc,&pC); if( rc!=SQLITE_OK ){ return rc; } @@ -186281,7 +186281,7 @@ static int fts3ExprGlobalHitsCb( void *pCtx /* Pointer to MatchInfo structure */ ){ MatchInfo *p = (MatchInfo *)pCtx; - return sqlite3Fts3EvalPhraseStats( + return tdsqlite3Fts3EvalPhraseStats( p->pCursor, pExpr, &p->aMatchinfo[3*iPhrase*p->nCol] ); } @@ -186303,7 +186303,7 @@ static int fts3ExprLocalHitsCb( for(i=0; inCol && rc==SQLITE_OK; i++){ char *pCsr; - rc = sqlite3Fts3EvalPhrasePoslist(p->pCursor, pExpr, i, &pCsr); + rc = tdsqlite3Fts3EvalPhrasePoslist(p->pCursor, pExpr, i, &pCsr); if( pCsr ){ p->aMatchinfo[iStart+i*3] = fts3ColumnlistCount(&pCsr); }else{ @@ -186331,7 +186331,7 @@ static int fts3MatchinfoCheck( ){ return SQLITE_OK; } - sqlite3Fts3ErrMsg(pzErr, "unrecognized matchinfo request: %c", cArg); + tdsqlite3Fts3ErrMsg(pzErr, "unrecognized matchinfo request: %c", cArg); return SQLITE_ERROR; } @@ -186370,32 +186370,32 @@ static size_t fts3MatchinfoSize(MatchInfo *pInfo, char cArg){ static int fts3MatchinfoSelectDoctotal( Fts3Table *pTab, - sqlite3_stmt **ppStmt, - sqlite3_int64 *pnDoc, + tdsqlite3_stmt **ppStmt, + tdsqlite3_int64 *pnDoc, const char **paLen, const char **ppEnd ){ - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; const char *a; const char *pEnd; - sqlite3_int64 nDoc; + tdsqlite3_int64 nDoc; int n; if( !*ppStmt ){ - int rc = sqlite3Fts3SelectDoctotal(pTab, ppStmt); + int rc = tdsqlite3Fts3SelectDoctotal(pTab, ppStmt); if( rc!=SQLITE_OK ) return rc; } pStmt = *ppStmt; - assert( sqlite3_data_count(pStmt)==1 ); + assert( tdsqlite3_data_count(pStmt)==1 ); - n = sqlite3_column_bytes(pStmt, 0); - a = sqlite3_column_blob(pStmt, 0); + n = tdsqlite3_column_bytes(pStmt, 0); + a = tdsqlite3_column_blob(pStmt, 0); if( a==0 ){ return FTS_CORRUPT_VTAB; } pEnd = a + n; - a += sqlite3Fts3GetVarintBounded(a, pEnd, &nDoc); + a += tdsqlite3Fts3GetVarintBounded(a, pEnd, &nDoc); if( nDoc<=0 || a>pEnd ){ return FTS_CORRUPT_VTAB; } @@ -186443,10 +186443,10 @@ static int fts3MatchinfoLcsCb( */ static int fts3LcsIteratorAdvance(LcsIterator *pIter){ char *pRead = pIter->pRead; - sqlite3_int64 iRead; + tdsqlite3_int64 iRead; int rc = 0; - pRead += sqlite3Fts3GetVarint(pRead, &iRead); + pRead += tdsqlite3Fts3GetVarint(pRead, &iRead); if( iRead==0 || iRead==1 ){ pRead = 0; rc = 1; @@ -186479,7 +186479,7 @@ static int fts3MatchinfoLcs(Fts3Cursor *pCsr, MatchInfo *pInfo){ /* Allocate and populate the array of LcsIterator objects. The array ** contains one element for each matchable phrase in the query. **/ - aIter = sqlite3_malloc64(sizeof(LcsIterator) * pCsr->nPhrase); + aIter = tdsqlite3_malloc64(sizeof(LcsIterator) * pCsr->nPhrase); if( !aIter ) return SQLITE_NOMEM; memset(aIter, 0, sizeof(LcsIterator) * pCsr->nPhrase); (void)fts3ExprIterate(pCsr->pExpr, fts3MatchinfoLcsCb, (void*)aIter); @@ -186496,7 +186496,7 @@ static int fts3MatchinfoLcs(Fts3Cursor *pCsr, MatchInfo *pInfo){ for(i=0; inPhrase; i++){ LcsIterator *pIt = &aIter[i]; - rc = sqlite3Fts3EvalPhrasePoslist(pCsr, pIt->pExpr, iCol, &pIt->pRead); + rc = tdsqlite3Fts3EvalPhrasePoslist(pCsr, pIt->pExpr, iCol, &pIt->pRead); if( rc!=SQLITE_OK ) goto matchinfo_lcs_out; if( pIt->pRead ){ pIt->iPos = pIt->iPosOffset; @@ -186537,7 +186537,7 @@ static int fts3MatchinfoLcs(Fts3Cursor *pCsr, MatchInfo *pInfo){ } matchinfo_lcs_out: - sqlite3_free(aIter); + tdsqlite3_free(aIter); return rc; } @@ -186567,7 +186567,7 @@ static int fts3MatchinfoValues( int rc = SQLITE_OK; int i; Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - sqlite3_stmt *pSelect = 0; + tdsqlite3_stmt *pSelect = 0; for(i=0; rc==SQLITE_OK && zArg[i]; i++){ pInfo->flag = zArg[i]; @@ -186582,7 +186582,7 @@ static int fts3MatchinfoValues( case FTS3_MATCHINFO_NDOC: if( bGlobal ){ - sqlite3_int64 nDoc = 0; + tdsqlite3_int64 nDoc = 0; rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, 0, 0); pInfo->aMatchinfo[0] = (u32)nDoc; } @@ -186590,7 +186590,7 @@ static int fts3MatchinfoValues( case FTS3_MATCHINFO_AVGLENGTH: if( bGlobal ){ - sqlite3_int64 nDoc; /* Number of rows in table */ + tdsqlite3_int64 nDoc; /* Number of rows in table */ const char *a; /* Aggregate column length array */ const char *pEnd; /* First byte past end of length array */ @@ -186599,8 +186599,8 @@ static int fts3MatchinfoValues( int iCol; for(iCol=0; iColnCol; iCol++){ u32 iVal; - sqlite3_int64 nToken; - a += sqlite3Fts3GetVarint(a, &nToken); + tdsqlite3_int64 nToken; + a += tdsqlite3Fts3GetVarint(a, &nToken); if( a>pEnd ){ rc = SQLITE_CORRUPT_VTAB; break; @@ -186613,15 +186613,15 @@ static int fts3MatchinfoValues( break; case FTS3_MATCHINFO_LENGTH: { - sqlite3_stmt *pSelectDocsize = 0; - rc = sqlite3Fts3SelectDocsize(pTab, pCsr->iPrevId, &pSelectDocsize); + tdsqlite3_stmt *pSelectDocsize = 0; + rc = tdsqlite3Fts3SelectDocsize(pTab, pCsr->iPrevId, &pSelectDocsize); if( rc==SQLITE_OK ){ int iCol; - const char *a = sqlite3_column_blob(pSelectDocsize, 0); - const char *pEnd = a + sqlite3_column_bytes(pSelectDocsize, 0); + const char *a = tdsqlite3_column_blob(pSelectDocsize, 0); + const char *pEnd = a + tdsqlite3_column_bytes(pSelectDocsize, 0); for(iCol=0; iColnCol; iCol++){ - sqlite3_int64 nToken; - a += sqlite3Fts3GetVarintBounded(a, pEnd, &nToken); + tdsqlite3_int64 nToken; + a += tdsqlite3Fts3GetVarintBounded(a, pEnd, &nToken); if( a>pEnd ){ rc = SQLITE_CORRUPT_VTAB; break; @@ -186629,7 +186629,7 @@ static int fts3MatchinfoValues( pInfo->aMatchinfo[iCol] = (u32)nToken; } } - sqlite3_reset(pSelectDocsize); + tdsqlite3_reset(pSelectDocsize); break; } @@ -186660,7 +186660,7 @@ static int fts3MatchinfoValues( if( rc!=SQLITE_OK ) break; } rc = fts3ExprIterate(pExpr, fts3ExprGlobalHitsCb,(void*)pInfo); - sqlite3Fts3EvalTestDeferred(pCsr, &rc); + tdsqlite3Fts3EvalTestDeferred(pCsr, &rc); if( rc!=SQLITE_OK ) break; } (void)fts3ExprIterate(pExpr, fts3ExprLocalHitsCb,(void*)pInfo); @@ -186671,7 +186671,7 @@ static int fts3MatchinfoValues( pInfo->aMatchinfo += fts3MatchinfoSize(pInfo, zArg[i]); } - sqlite3_reset(pSelect); + tdsqlite3_reset(pSelect); return rc; } @@ -186681,7 +186681,7 @@ static int fts3MatchinfoValues( ** 'matchinfo' data is an array of 32-bit unsigned integers (C type u32). */ static void fts3GetMatchinfo( - sqlite3_context *pCtx, /* Return results here */ + tdsqlite3_context *pCtx, /* Return results here */ Fts3Cursor *pCsr, /* FTS3 Cursor object */ const char *zArg /* Second argument to matchinfo() function */ ){ @@ -186701,7 +186701,7 @@ static void fts3GetMatchinfo( ** cache does not match the format string for this request, discard ** the cached data. */ if( pCsr->pMIBuffer && strcmp(pCsr->pMIBuffer->zMatchinfo, zArg) ){ - sqlite3Fts3MIBufferFree(pCsr->pMIBuffer); + tdsqlite3Fts3MIBufferFree(pCsr->pMIBuffer); pCsr->pMIBuffer = 0; } @@ -186722,8 +186722,8 @@ static void fts3GetMatchinfo( for(i=0; zArg[i]; i++){ char *zErr = 0; if( fts3MatchinfoCheck(pTab, zArg[i], &zErr) ){ - sqlite3_result_error(pCtx, zErr, -1); - sqlite3_free(zErr); + tdsqlite3_result_error(pCtx, zErr, -1); + tdsqlite3_free(zErr); return; } nMatchinfo += fts3MatchinfoSize(&sInfo, zArg[i]); @@ -186754,19 +186754,19 @@ static void fts3GetMatchinfo( } if( rc!=SQLITE_OK ){ - sqlite3_result_error_code(pCtx, rc); + tdsqlite3_result_error_code(pCtx, rc); if( xDestroyOut ) xDestroyOut(aOut); }else{ int n = pCsr->pMIBuffer->nElem * sizeof(u32); - sqlite3_result_blob(pCtx, aOut, n, xDestroyOut); + tdsqlite3_result_blob(pCtx, aOut, n, xDestroyOut); } } /* ** Implementation of snippet() function. */ -SQLITE_PRIVATE void sqlite3Fts3Snippet( - sqlite3_context *pCtx, /* SQLite function call context */ +SQLITE_PRIVATE void tdsqlite3Fts3Snippet( + tdsqlite3_context *pCtx, /* SQLite function call context */ Fts3Cursor *pCsr, /* Cursor object */ const char *zStart, /* Snippet start text - "" */ const char *zEnd, /* Snippet end text - "" */ @@ -186792,7 +186792,7 @@ SQLITE_PRIVATE void sqlite3Fts3Snippet( int nFToken = -1; /* Number of tokens in each fragment */ if( !pCsr->pExpr ){ - sqlite3_result_text(pCtx, "", 0, SQLITE_STATIC); + tdsqlite3_result_text(pCtx, "", 0, SQLITE_STATIC); return; } @@ -186858,12 +186858,12 @@ SQLITE_PRIVATE void sqlite3Fts3Snippet( } snippet_out: - sqlite3Fts3SegmentsClose(pTab); + tdsqlite3Fts3SegmentsClose(pTab); if( rc!=SQLITE_OK ){ - sqlite3_result_error_code(pCtx, rc); - sqlite3_free(res.z); + tdsqlite3_result_error_code(pCtx, rc); + tdsqlite3_free(res.z); }else{ - sqlite3_result_text(pCtx, res.z, -1, sqlite3_free); + tdsqlite3_result_text(pCtx, res.z, -1, tdsqlite3_free); } } @@ -186881,12 +186881,12 @@ struct TermOffsetCtx { Fts3Cursor *pCsr; int iCol; /* Column of table to populate aTerm for */ int iTerm; - sqlite3_int64 iDocid; + tdsqlite3_int64 iDocid; TermOffset *aTerm; }; /* -** This function is an fts3ExprIterate() callback used by sqlite3Fts3Offsets(). +** This function is an fts3ExprIterate() callback used by tdsqlite3Fts3Offsets(). */ static int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){ TermOffsetCtx *p = (TermOffsetCtx *)ctx; @@ -186897,7 +186897,7 @@ static int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){ int rc; UNUSED_PARAMETER(iPhrase); - rc = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pList); + rc = tdsqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pList); nTerm = pExpr->pPhrase->nToken; if( pList ){ fts3GetDeltaPosition(&pList, &iPos); @@ -186917,12 +186917,12 @@ static int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){ /* ** Implementation of offsets() function. */ -SQLITE_PRIVATE void sqlite3Fts3Offsets( - sqlite3_context *pCtx, /* SQLite function call context */ +SQLITE_PRIVATE void tdsqlite3Fts3Offsets( + tdsqlite3_context *pCtx, /* SQLite function call context */ Fts3Cursor *pCsr /* Cursor object */ ){ Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - sqlite3_tokenizer_module const *pMod = pTab->pTokenizer->pModule; + tdsqlite3_tokenizer_module const *pMod = pTab->pTokenizer->pModule; int rc; /* Return Code */ int nToken; /* Number of tokens in query */ int iCol; /* Column currently being processed */ @@ -186930,7 +186930,7 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets( TermOffsetCtx sCtx; /* Context for fts3ExprTermOffsetInit() */ if( !pCsr->pExpr ){ - sqlite3_result_text(pCtx, "", 0, SQLITE_STATIC); + tdsqlite3_result_text(pCtx, "", 0, SQLITE_STATIC); return; } @@ -186942,7 +186942,7 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets( if( rc!=SQLITE_OK ) goto offsets_out; /* Allocate the array of TermOffset iterators. */ - sCtx.aTerm = (TermOffset *)sqlite3_malloc64(sizeof(TermOffset)*nToken); + sCtx.aTerm = (TermOffset *)tdsqlite3_malloc64(sizeof(TermOffset)*nToken); if( 0==sCtx.aTerm ){ rc = SQLITE_NOMEM; goto offsets_out; @@ -186954,7 +186954,7 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets( ** string-buffer res for each column. */ for(iCol=0; iColnColumn; iCol++){ - sqlite3_tokenizer_cursor *pC; /* Tokenizer cursor */ + tdsqlite3_tokenizer_cursor *pC; /* Tokenizer cursor */ const char *ZDUMMY; /* Dummy argument used with xNext() */ int NDUMMY = 0; /* Dummy argument used with xNext() */ int iStart = 0; @@ -186977,10 +186977,10 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets( ** needs to transform the data from utf-16 to utf-8), return SQLITE_NOMEM ** to the caller. */ - zDoc = (const char *)sqlite3_column_text(pCsr->pStmt, iCol+1); - nDoc = sqlite3_column_bytes(pCsr->pStmt, iCol+1); + zDoc = (const char *)tdsqlite3_column_text(pCsr->pStmt, iCol+1); + nDoc = tdsqlite3_column_bytes(pCsr->pStmt, iCol+1); if( zDoc==0 ){ - if( sqlite3_column_type(pCsr->pStmt, iCol+1)==SQLITE_NULL ){ + if( tdsqlite3_column_type(pCsr->pStmt, iCol+1)==SQLITE_NULL ){ continue; } rc = SQLITE_NOMEM; @@ -186988,7 +186988,7 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets( } /* Initialize a tokenizer iterator to iterate through column iCol. */ - rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid, + rc = tdsqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid, zDoc, nDoc, &pC ); if( rc!=SQLITE_OK ) goto offsets_out; @@ -187022,7 +187022,7 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets( } if( rc==SQLITE_OK ){ char aBuffer[64]; - sqlite3_snprintf(sizeof(aBuffer), aBuffer, + tdsqlite3_snprintf(sizeof(aBuffer), aBuffer, "%d %d %d %d ", iCol, pTerm-sCtx.aTerm, iStart, iEnd-iStart ); rc = fts3StringAppend(&res, aBuffer, -1); @@ -187040,14 +187040,14 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets( } offsets_out: - sqlite3_free(sCtx.aTerm); + tdsqlite3_free(sCtx.aTerm); assert( rc!=SQLITE_DONE ); - sqlite3Fts3SegmentsClose(pTab); + tdsqlite3Fts3SegmentsClose(pTab); if( rc!=SQLITE_OK ){ - sqlite3_result_error_code(pCtx, rc); - sqlite3_free(res.z); + tdsqlite3_result_error_code(pCtx, rc); + tdsqlite3_free(res.z); }else{ - sqlite3_result_text(pCtx, res.z, res.n-1, sqlite3_free); + tdsqlite3_result_text(pCtx, res.z, res.n-1, tdsqlite3_free); } return; } @@ -187055,8 +187055,8 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets( /* ** Implementation of matchinfo() function. */ -SQLITE_PRIVATE void sqlite3Fts3Matchinfo( - sqlite3_context *pContext, /* Function call context */ +SQLITE_PRIVATE void tdsqlite3Fts3Matchinfo( + tdsqlite3_context *pContext, /* Function call context */ Fts3Cursor *pCsr, /* FTS3 table cursor */ const char *zArg /* Second arg to matchinfo() function */ ){ @@ -187070,12 +187070,12 @@ SQLITE_PRIVATE void sqlite3Fts3Matchinfo( } if( !pCsr->pExpr ){ - sqlite3_result_blob(pContext, "", 0, SQLITE_STATIC); + tdsqlite3_result_blob(pContext, "", 0, SQLITE_STATIC); return; }else{ /* Retrieve matchinfo() data. */ fts3GetMatchinfo(pContext, pCsr, zFormat); - sqlite3Fts3SegmentsClose(pTab); + tdsqlite3Fts3SegmentsClose(pTab); } } @@ -187112,12 +187112,12 @@ SQLITE_PRIVATE void sqlite3Fts3Matchinfo( /* ** The following two macros - READ_UTF8 and WRITE_UTF8 - have been copied -** from the sqlite3 source file utf.c. If this file is compiled as part +** from the tdsqlite3 source file utf.c. If this file is compiled as part ** of the amalgamation, they are not required. */ #ifndef SQLITE_AMALGAMATION -static const unsigned char sqlite3Utf8Trans1[] = { +static const unsigned char tdsqlite3Utf8Trans1[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -187131,7 +187131,7 @@ static const unsigned char sqlite3Utf8Trans1[] = { #define READ_UTF8(zIn, zTerm, c) \ c = *(zIn++); \ if( c>=0xc0 ){ \ - c = sqlite3Utf8Trans1[c-0xc0]; \ + c = tdsqlite3Utf8Trans1[c-0xc0]; \ while( zIn!=zTerm && (*zIn & 0xc0)==0x80 ){ \ c = (c<<6) + (0x3f & *(zIn++)); \ } \ @@ -187166,14 +187166,14 @@ typedef struct unicode_tokenizer unicode_tokenizer; typedef struct unicode_cursor unicode_cursor; struct unicode_tokenizer { - sqlite3_tokenizer base; + tdsqlite3_tokenizer base; int eRemoveDiacritic; int nException; int *aiException; }; struct unicode_cursor { - sqlite3_tokenizer_cursor base; + tdsqlite3_tokenizer_cursor base; const unsigned char *aInput; /* Input text being tokenized */ int nInput; /* Size of aInput[] in bytes */ int iOff; /* Current offset within aInput[] */ @@ -187186,11 +187186,11 @@ struct unicode_cursor { /* ** Destroy a tokenizer allocated by unicodeCreate(). */ -static int unicodeDestroy(sqlite3_tokenizer *pTokenizer){ +static int unicodeDestroy(tdsqlite3_tokenizer *pTokenizer){ if( pTokenizer ){ unicode_tokenizer *p = (unicode_tokenizer *)pTokenizer; - sqlite3_free(p->aiException); - sqlite3_free(p); + tdsqlite3_free(p->aiException); + tdsqlite3_free(p); } return SQLITE_OK; } @@ -187202,13 +187202,13 @@ static int unicodeDestroy(sqlite3_tokenizer *pTokenizer){ ** token characters (if bAlnum==1). ** ** For each codepoint in the zIn/nIn string, this function checks if the -** sqlite3FtsUnicodeIsalnum() function already returns the desired result. +** tdsqlite3FtsUnicodeIsalnum() function already returns the desired result. ** If so, no action is taken. Otherwise, the codepoint is added to the ** unicode_tokenizer.aiException[] array. For the purposes of tokenization, -** the return value of sqlite3FtsUnicodeIsalnum() is inverted for all +** the return value of tdsqlite3FtsUnicodeIsalnum() is inverted for all ** codepoints in the aiException[] array. ** -** If a standalone diacritic mark (one that sqlite3FtsUnicodeIsdiacritic() +** If a standalone diacritic mark (one that tdsqlite3FtsUnicodeIsdiacritic() ** identifies as a diacritic) occurs in the zIn/nIn string it is ignored. ** It is not possible to change the behavior of the tokenizer with respect ** to these codepoints. @@ -187228,9 +187228,9 @@ static int unicodeAddExceptions( while( zaiException,(p->nException+nEntry)*sizeof(int)); + aNew = tdsqlite3_realloc64(p->aiException,(p->nException+nEntry)*sizeof(int)); if( aNew==0 ) return SQLITE_NOMEM; nNew = p->nException; z = (const unsigned char *)zIn; while( zeRemoveDiacritic = 1; @@ -187340,10 +187340,10 @@ static int unicodeCreate( } if( rc!=SQLITE_OK ){ - unicodeDestroy((sqlite3_tokenizer *)pNew); + unicodeDestroy((tdsqlite3_tokenizer *)pNew); pNew = 0; } - *pp = (sqlite3_tokenizer *)pNew; + *pp = (tdsqlite3_tokenizer *)pNew; return rc; } @@ -187354,14 +187354,14 @@ static int unicodeCreate( ** *ppCursor. */ static int unicodeOpen( - sqlite3_tokenizer *p, /* The tokenizer */ + tdsqlite3_tokenizer *p, /* The tokenizer */ const char *aInput, /* Input string */ int nInput, /* Size of string aInput in bytes */ - sqlite3_tokenizer_cursor **pp /* OUT: New cursor object */ + tdsqlite3_tokenizer_cursor **pp /* OUT: New cursor object */ ){ unicode_cursor *pCsr; - pCsr = (unicode_cursor *)sqlite3_malloc(sizeof(unicode_cursor)); + pCsr = (unicode_cursor *)tdsqlite3_malloc(sizeof(unicode_cursor)); if( pCsr==0 ){ return SQLITE_NOMEM; } @@ -187385,10 +187385,10 @@ static int unicodeOpen( ** Close a tokenization cursor previously opened by a call to ** simpleOpen() above. */ -static int unicodeClose(sqlite3_tokenizer_cursor *pCursor){ +static int unicodeClose(tdsqlite3_tokenizer_cursor *pCursor){ unicode_cursor *pCsr = (unicode_cursor *) pCursor; - sqlite3_free(pCsr->zToken); - sqlite3_free(pCsr); + tdsqlite3_free(pCsr->zToken); + tdsqlite3_free(pCsr); return SQLITE_OK; } @@ -187397,7 +187397,7 @@ static int unicodeClose(sqlite3_tokenizer_cursor *pCursor){ ** have been opened by a prior call to simpleOpen(). */ static int unicodeNext( - sqlite3_tokenizer_cursor *pC, /* Cursor returned by simpleOpen */ + tdsqlite3_tokenizer_cursor *pC, /* Cursor returned by simpleOpen */ const char **paToken, /* OUT: Token text */ int *pnToken, /* OUT: Number of bytes at *paToken */ int *piStart, /* OUT: Starting offset of token */ @@ -187429,7 +187429,7 @@ static int unicodeNext( /* Grow the output buffer if required. */ if( (zOut-pCsr->zToken)>=(pCsr->nAlloc-4) ){ - char *zNew = sqlite3_realloc64(pCsr->zToken, pCsr->nAlloc+64); + char *zNew = tdsqlite3_realloc64(pCsr->zToken, pCsr->nAlloc+64); if( !zNew ) return SQLITE_NOMEM; zOut = &zNew[zOut - pCsr->zToken]; pCsr->zToken = zNew; @@ -187438,7 +187438,7 @@ static int unicodeNext( /* Write the folded case of the last character read to the output */ zEnd = z; - iOut = sqlite3FtsUnicodeFold((int)iCode, p->eRemoveDiacritic); + iOut = tdsqlite3FtsUnicodeFold((int)iCode, p->eRemoveDiacritic); if( iOut ){ WRITE_UTF8(zOut, iOut); } @@ -187447,7 +187447,7 @@ static int unicodeNext( if( z>=zTerm ) break; READ_UTF8(z, zTerm, iCode); }while( unicodeIsAlnum(p, (int)iCode) - || sqlite3FtsUnicodeIsdiacritic((int)iCode) + || tdsqlite3FtsUnicodeIsdiacritic((int)iCode) ); /* Set the output variables and return. */ @@ -187461,11 +187461,11 @@ static int unicodeNext( } /* -** Set *ppModule to a pointer to the sqlite3_tokenizer_module +** Set *ppModule to a pointer to the tdsqlite3_tokenizer_module ** structure for the unicode tokenizer. */ -SQLITE_PRIVATE void sqlite3Fts3UnicodeTokenizer(sqlite3_tokenizer_module const **ppModule){ - static const sqlite3_tokenizer_module module = { +SQLITE_PRIVATE void tdsqlite3Fts3UnicodeTokenizer(tdsqlite3_tokenizer_module const **ppModule){ + static const tdsqlite3_tokenizer_module module = { 0, unicodeCreate, unicodeDestroy, @@ -187511,7 +187511,7 @@ SQLITE_PRIVATE void sqlite3Fts3UnicodeTokenizer(sqlite3_tokenizer_module const * ** The results are undefined if the value passed to this function ** is less than zero. */ -SQLITE_PRIVATE int sqlite3FtsUnicodeIsalnum(int c){ +SQLITE_PRIVATE int tdsqlite3FtsUnicodeIsalnum(int c){ /* Each unsigned integer in the following array corresponds to a contiguous ** range of unicode codepoints that are not either letters or numbers (i.e. ** codepoints for which this function should return 0). @@ -187710,7 +187710,7 @@ static int remove_diacritic(int c, int bComplex){ ** Return true if the argument interpreted as a unicode codepoint ** is a diacritical modifier character. */ -SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int c){ +SQLITE_PRIVATE int tdsqlite3FtsUnicodeIsdiacritic(int c){ unsigned int mask0 = 0x08029FDF; unsigned int mask1 = 0x000361F8; if( c<768 || c>817 ) return 0; @@ -187729,7 +187729,7 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int c){ ** The results are undefined if the value passed to this function ** is less than zero. */ -SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){ +SQLITE_PRIVATE int tdsqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){ /* Each entry in the following array defines a rule for folding a range ** of codepoints to lower case. The rule applies to a range of nRange ** codepoints starting at codepoint iCode. @@ -187893,7 +187893,7 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){ */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1) #if !defined(SQLITEINT_H) -/* #include "sqlite3ext.h" */ +/* #include "tdsqlite3ext.h" */ #endif SQLITE_EXTENSION_INIT1 /* #include */ @@ -187908,20 +187908,20 @@ SQLITE_EXTENSION_INIT1 #endif #ifndef LARGEST_INT64 -# define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32)) -# define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64) +# define LARGEST_INT64 (0xffffffff|(((tdsqlite3_int64)0x7fffffff)<<32)) +# define SMALLEST_INT64 (((tdsqlite3_int64)-1) - LARGEST_INT64) #endif /* ** Versions of isspace(), isalnum() and isdigit() to which it is safe ** to pass signed char values. */ -#ifdef sqlite3Isdigit +#ifdef tdsqlite3Isdigit /* Use the SQLite core versions if this routine is part of the ** SQLite amalgamation */ -# define safe_isdigit(x) sqlite3Isdigit(x) -# define safe_isalnum(x) sqlite3Isalnum(x) -# define safe_isxdigit(x) sqlite3Isxdigit(x) +# define safe_isdigit(x) tdsqlite3Isdigit(x) +# define safe_isalnum(x) tdsqlite3Isalnum(x) +# define safe_isxdigit(x) tdsqlite3Isxdigit(x) #else /* Use the standard library for separate compilation */ #include /* amalgamator: keep */ @@ -187958,7 +187958,7 @@ static const char jsonIsSpace[] = { #ifndef SQLITE_AMALGAMATION /* Unsigned integer types. These are already defined in the sqliteInt.h, ** but the definitions need to be repeated for separate compilation. */ - typedef sqlite3_uint64 u64; + typedef tdsqlite3_uint64 u64; typedef unsigned int u32; typedef unsigned short int u16; typedef unsigned char u8; @@ -187974,7 +187974,7 @@ typedef struct JsonParse JsonParse; ** that can be and is used to create strings other than JSON. */ struct JsonString { - sqlite3_context *pCtx; /* Function context - put error messages here */ + tdsqlite3_context *pCtx; /* Function context - put error messages here */ char *zBuf; /* Append JSON content here */ u64 nAlloc; /* Bytes of storage available in zBuf[] */ u64 nUsed; /* Bytes of zBuf[] currently used */ @@ -188069,7 +188069,7 @@ static void jsonZero(JsonString *p){ /* Initialize the JsonString object */ -static void jsonInit(JsonString *p, sqlite3_context *pCtx){ +static void jsonInit(JsonString *p, tdsqlite3_context *pCtx){ p->pCtx = pCtx; p->bErr = 0; jsonZero(p); @@ -188080,7 +188080,7 @@ static void jsonInit(JsonString *p, sqlite3_context *pCtx){ ** initial state. */ static void jsonReset(JsonString *p){ - if( !p->bStatic ) sqlite3_free(p->zBuf); + if( !p->bStatic ) tdsqlite3_free(p->zBuf); jsonZero(p); } @@ -188089,7 +188089,7 @@ static void jsonReset(JsonString *p){ */ static void jsonOom(JsonString *p){ p->bErr = 1; - sqlite3_result_error_nomem(p->pCtx); + tdsqlite3_result_error_nomem(p->pCtx); jsonReset(p); } @@ -188101,7 +188101,7 @@ static int jsonGrow(JsonString *p, u32 N){ char *zNew; if( p->bStatic ){ if( p->bErr ) return 1; - zNew = sqlite3_malloc64(nTotal); + zNew = tdsqlite3_malloc64(nTotal); if( zNew==0 ){ jsonOom(p); return SQLITE_NOMEM; @@ -188110,7 +188110,7 @@ static int jsonGrow(JsonString *p, u32 N){ p->zBuf = zNew; p->bStatic = 0; }else{ - zNew = sqlite3_realloc64(p->zBuf, nTotal); + zNew = tdsqlite3_realloc64(p->zBuf, nTotal); if( zNew==0 ){ jsonOom(p); return SQLITE_NOMEM; @@ -188135,7 +188135,7 @@ static void jsonPrintf(int N, JsonString *p, const char *zFormat, ...){ va_list ap; if( (p->nUsed + N >= p->nAlloc) && jsonGrow(p, N) ) return; va_start(ap, zFormat); - sqlite3_vsnprintf(N, p->zBuf+p->nUsed, zFormat, ap); + tdsqlite3_vsnprintf(N, p->zBuf+p->nUsed, zFormat, ap); va_end(ap); p->nUsed += (int)strlen(p->zBuf+p->nUsed); } @@ -188207,24 +188207,24 @@ static void jsonAppendString(JsonString *p, const char *zIn, u32 N){ */ static void jsonAppendValue( JsonString *p, /* Append to this JSON string */ - sqlite3_value *pValue /* Value to append */ + tdsqlite3_value *pValue /* Value to append */ ){ - switch( sqlite3_value_type(pValue) ){ + switch( tdsqlite3_value_type(pValue) ){ case SQLITE_NULL: { jsonAppendRaw(p, "null", 4); break; } case SQLITE_INTEGER: case SQLITE_FLOAT: { - const char *z = (const char*)sqlite3_value_text(pValue); - u32 n = (u32)sqlite3_value_bytes(pValue); + const char *z = (const char*)tdsqlite3_value_text(pValue); + u32 n = (u32)tdsqlite3_value_bytes(pValue); jsonAppendRaw(p, z, n); break; } case SQLITE_TEXT: { - const char *z = (const char*)sqlite3_value_text(pValue); - u32 n = (u32)sqlite3_value_bytes(pValue); - if( sqlite3_value_subtype(pValue)==JSON_SUBTYPE ){ + const char *z = (const char*)tdsqlite3_value_text(pValue); + u32 n = (u32)tdsqlite3_value_bytes(pValue); + if( tdsqlite3_value_subtype(pValue)==JSON_SUBTYPE ){ jsonAppendRaw(p, z, n); }else{ jsonAppendString(p, z, n); @@ -188233,7 +188233,7 @@ static void jsonAppendValue( } default: { if( p->bErr==0 ){ - sqlite3_result_error(p->pCtx, "JSON cannot hold BLOB values", -1); + tdsqlite3_result_error(p->pCtx, "JSON cannot hold BLOB values", -1); p->bErr = 2; jsonReset(p); } @@ -188247,8 +188247,8 @@ static void jsonAppendValue( */ static void jsonResult(JsonString *p){ if( p->bErr==0 ){ - sqlite3_result_text64(p->pCtx, p->zBuf, p->nUsed, - p->bStatic ? SQLITE_TRANSIENT : sqlite3_free, + tdsqlite3_result_text64(p->pCtx, p->zBuf, p->nUsed, + p->bStatic ? SQLITE_TRANSIENT : tdsqlite3_free, SQLITE_UTF8); jsonZero(p); } @@ -188277,20 +188277,20 @@ static u32 jsonNodeSize(JsonNode *pNode){ ** delete the JsonParse object itself. */ static void jsonParseReset(JsonParse *pParse){ - sqlite3_free(pParse->aNode); + tdsqlite3_free(pParse->aNode); pParse->aNode = 0; pParse->nNode = 0; pParse->nAlloc = 0; - sqlite3_free(pParse->aUp); + tdsqlite3_free(pParse->aUp); pParse->aUp = 0; } /* -** Free a JsonParse object that was obtained from sqlite3_malloc(). +** Free a JsonParse object that was obtained from tdsqlite3_malloc(). */ static void jsonParseFree(JsonParse *pParse){ jsonParseReset(pParse); - sqlite3_free(pParse); + tdsqlite3_free(pParse); } /* @@ -188301,7 +188301,7 @@ static void jsonParseFree(JsonParse *pParse){ static void jsonRenderNode( JsonNode *pNode, /* The node to render */ JsonString *pOut, /* Write JSON here */ - sqlite3_value **aReplace /* Replacement values */ + tdsqlite3_value **aReplace /* Replacement values */ ){ if( pNode->jnFlags & (JNODE_REPLACE|JNODE_PATCH) ){ if( pNode->jnFlags & JNODE_REPLACE ){ @@ -188382,14 +188382,14 @@ static void jsonRenderNode( */ static void jsonReturnJson( JsonNode *pNode, /* Node to return */ - sqlite3_context *pCtx, /* Return value for this function */ - sqlite3_value **aReplace /* Array of replacement values */ + tdsqlite3_context *pCtx, /* Return value for this function */ + tdsqlite3_value **aReplace /* Array of replacement values */ ){ JsonString s; jsonInit(&s, pCtx); jsonRenderNode(pNode, &s, aReplace); jsonResult(&s); - sqlite3_result_subtype(pCtx, JSON_SUBTYPE); + tdsqlite3_result_subtype(pCtx, JSON_SUBTYPE); } /* @@ -188428,25 +188428,25 @@ static u32 jsonHexToInt4(const char *z){ */ static void jsonReturn( JsonNode *pNode, /* Node to return */ - sqlite3_context *pCtx, /* Return value for this function */ - sqlite3_value **aReplace /* Array of replacement values */ + tdsqlite3_context *pCtx, /* Return value for this function */ + tdsqlite3_value **aReplace /* Array of replacement values */ ){ switch( pNode->eType ){ default: { assert( pNode->eType==JSON_NULL ); - sqlite3_result_null(pCtx); + tdsqlite3_result_null(pCtx); break; } case JSON_TRUE: { - sqlite3_result_int(pCtx, 1); + tdsqlite3_result_int(pCtx, 1); break; } case JSON_FALSE: { - sqlite3_result_int(pCtx, 0); + tdsqlite3_result_int(pCtx, 0); break; } case JSON_INT: { - sqlite3_int64 i = 0; + tdsqlite3_int64 i = 0; const char *z = pNode->u.zJContent; if( z[0]=='-' ){ z++; } while( z[0]>='0' && z[0]<='9' ){ @@ -188457,7 +188457,7 @@ static void jsonReturn( if( v==9 ) goto int_as_real; if( v==8 ){ if( pNode->u.zJContent[0]=='-' ){ - sqlite3_result_int64(pCtx, SMALLEST_INT64); + tdsqlite3_result_int64(pCtx, SMALLEST_INT64); goto int_done; }else{ goto int_as_real; @@ -188467,7 +188467,7 @@ static void jsonReturn( i = i*10 + v; } if( pNode->u.zJContent[0]=='-' ){ i = -i; } - sqlite3_result_int64(pCtx, i); + tdsqlite3_result_int64(pCtx, i); int_done: break; int_as_real: /* fall through to real */; @@ -188476,11 +188476,11 @@ static void jsonReturn( double r; #ifdef SQLITE_AMALGAMATION const char *z = pNode->u.zJContent; - sqlite3AtoF(z, &r, sqlite3Strlen30(z), SQLITE_UTF8); + tdsqlite3AtoF(z, &r, tdsqlite3Strlen30(z), SQLITE_UTF8); #else r = strtod(pNode->u.zJContent, 0); #endif - sqlite3_result_double(pCtx, r); + tdsqlite3_result_double(pCtx, r); break; } case JSON_STRING: { @@ -188488,14 +188488,14 @@ static void jsonReturn( ** json_insert() and json_replace() and those routines do not ** call jsonReturn() */ if( pNode->jnFlags & JNODE_RAW ){ - sqlite3_result_text(pCtx, pNode->u.zJContent, pNode->n, + tdsqlite3_result_text(pCtx, pNode->u.zJContent, pNode->n, SQLITE_TRANSIENT); }else #endif assert( (pNode->jnFlags & JNODE_RAW)==0 ); if( (pNode->jnFlags & JNODE_ESCAPE)==0 ){ /* JSON formatted without any backslash-escapes */ - sqlite3_result_text(pCtx, pNode->u.zJContent+1, pNode->n-2, + tdsqlite3_result_text(pCtx, pNode->u.zJContent+1, pNode->n-2, SQLITE_TRANSIENT); }else{ /* Translate JSON formatted string into raw text */ @@ -188504,9 +188504,9 @@ static void jsonReturn( const char *z = pNode->u.zJContent; char *zOut; u32 j; - zOut = sqlite3_malloc( n+1 ); + zOut = tdsqlite3_malloc( n+1 ); if( zOut==0 ){ - sqlite3_result_error_nomem(pCtx); + tdsqlite3_result_error_nomem(pCtx); break; } for(i=1, j=0; inNode>=pParse->nAlloc ); if( pParse->oom ) return -1; nNew = pParse->nAlloc*2 + 10; - pNew = sqlite3_realloc64(pParse->aNode, sizeof(JsonNode)*nNew); + pNew = tdsqlite3_realloc64(pParse->aNode, sizeof(JsonNode)*nNew); if( pNew==0 ){ pParse->oom = 1; return -1; @@ -188814,7 +188814,7 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ */ static int jsonParse( JsonParse *pParse, /* Initialize and fill this JsonParse object */ - sqlite3_context *pCtx, /* Report errors here */ + tdsqlite3_context *pCtx, /* Report errors here */ const char *zJson /* Input JSON text to be parsed */ ){ int i; @@ -188831,9 +188831,9 @@ static int jsonParse( if( i<=0 ){ if( pCtx!=0 ){ if( pParse->oom ){ - sqlite3_result_error_nomem(pCtx); + tdsqlite3_result_error_nomem(pCtx); }else{ - sqlite3_result_error(pCtx, "malformed JSON", -1); + tdsqlite3_result_error(pCtx, "malformed JSON", -1); } } jsonParseReset(pParse); @@ -188875,7 +188875,7 @@ static void jsonParseFillInParentage(JsonParse *pParse, u32 i, u32 iParent){ static int jsonParseFindParents(JsonParse *pParse){ u32 *aUp; assert( pParse->aUp==0 ); - aUp = pParse->aUp = sqlite3_malloc64( sizeof(u32)*pParse->nNode ); + aUp = pParse->aUp = tdsqlite3_malloc64( sizeof(u32)*pParse->nNode ); if( aUp==0 ){ pParse->oom = 1; return SQLITE_NOMEM; @@ -188885,26 +188885,26 @@ static int jsonParseFindParents(JsonParse *pParse){ } /* -** Magic number used for the JSON parse cache in sqlite3_get_auxdata() +** Magic number used for the JSON parse cache in tdsqlite3_get_auxdata() */ #define JSON_CACHE_ID (-429938) /* First cache entry */ #define JSON_CACHE_SZ 4 /* Max number of cache entries */ /* ** Obtain a complete parse of the JSON found in the first argument -** of the argv array. Use the sqlite3_get_auxdata() cache for this +** of the argv array. Use the tdsqlite3_get_auxdata() cache for this ** parse if it is available. If the cache is not available or if it ** is no longer valid, parse the JSON again and return the new parse, ** and also register the new parse so that it will be available for -** future sqlite3_get_auxdata() calls. +** future tdsqlite3_get_auxdata() calls. */ static JsonParse *jsonParseCached( - sqlite3_context *pCtx, - sqlite3_value **argv, - sqlite3_context *pErrCtx + tdsqlite3_context *pCtx, + tdsqlite3_value **argv, + tdsqlite3_context *pErrCtx ){ - const char *zJson = (const char*)sqlite3_value_text(argv[0]); - int nJson = sqlite3_value_bytes(argv[0]); + const char *zJson = (const char*)tdsqlite3_value_text(argv[0]); + int nJson = tdsqlite3_value_bytes(argv[0]); JsonParse *p; JsonParse *pMatch = 0; int iKey; @@ -188913,7 +188913,7 @@ static JsonParse *jsonParseCached( u32 iMaxHold = 0; if( zJson==0 ) return 0; for(iKey=0; iKeyiHold = iMaxHold+1; return pMatch; } - p = sqlite3_malloc64( sizeof(*p) + nJson + 1 ); + p = tdsqlite3_malloc64( sizeof(*p) + nJson + 1 ); if( p==0 ){ - sqlite3_result_error_nomem(pCtx); + tdsqlite3_result_error_nomem(pCtx); return 0; } memset(p, 0, sizeof(*p)); p->zJson = (char*)&p[1]; memcpy((char*)p->zJson, zJson, nJson+1); if( jsonParse(p, pErrCtx, p->zJson) ){ - sqlite3_free(p); + tdsqlite3_free(p); return 0; } p->nJson = nJson; p->iHold = iMaxHold+1; - sqlite3_set_auxdata(pCtx, JSON_CACHE_ID+iMinKey, p, + tdsqlite3_set_auxdata(pCtx, JSON_CACHE_ID+iMinKey, p, (void(*)(void*))jsonParseFree); - return (JsonParse*)sqlite3_get_auxdata(pCtx, JSON_CACHE_ID+iMinKey); + return (JsonParse*)tdsqlite3_get_auxdata(pCtx, JSON_CACHE_ID+iMinKey); } /* @@ -189151,10 +189151,10 @@ static JsonNode *jsonLookupAppend( /* ** Return the text of a syntax error message on a JSON path. Space is -** obtained from sqlite3_malloc(). +** obtained from tdsqlite3_malloc(). */ static char *jsonPathSyntaxError(const char *zErr){ - return sqlite3_mprintf("JSON path error near '%q'", zErr); + return tdsqlite3_mprintf("JSON path error near '%q'", zErr); } /* @@ -189171,7 +189171,7 @@ static JsonNode *jsonLookup( JsonParse *pParse, /* The JSON to search */ const char *zPath, /* The path to search */ int *pApnd, /* Append nodes to complete path if not NULL */ - sqlite3_context *pCtx /* Report errors here, if not NULL */ + tdsqlite3_context *pCtx /* Report errors here, if not NULL */ ){ const char *zErr = 0; JsonNode *pNode = 0; @@ -189191,10 +189191,10 @@ lookup_err: assert( zErr!=0 && pCtx!=0 ); zMsg = jsonPathSyntaxError(zErr); if( zMsg ){ - sqlite3_result_error(pCtx, zMsg, -1); - sqlite3_free(zMsg); + tdsqlite3_result_error(pCtx, zMsg, -1); + tdsqlite3_free(zMsg); }else{ - sqlite3_result_error_nomem(pCtx); + tdsqlite3_result_error_nomem(pCtx); } return 0; } @@ -189205,13 +189205,13 @@ lookup_err: ** or json_set(). */ static void jsonWrongNumArgs( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, const char *zFuncName ){ - char *zMsg = sqlite3_mprintf("json_%s() needs an odd number of arguments", + char *zMsg = tdsqlite3_mprintf("json_%s() needs an odd number of arguments", zFuncName); - sqlite3_result_error(pCtx, zMsg, -1); - sqlite3_free(zMsg); + tdsqlite3_result_error(pCtx, zMsg, -1); + tdsqlite3_free(zMsg); } /* @@ -189245,16 +189245,16 @@ static void jsonRemoveAllNulls(JsonNode *pNode){ ** well-formed. */ static void jsonParseFunc( - sqlite3_context *ctx, + tdsqlite3_context *ctx, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ JsonString s; /* Output string - not real JSON */ JsonParse x; /* The parse */ u32 i; assert( argc==1 ); - if( jsonParse(&x, ctx, (const char*)sqlite3_value_text(argv[0])) ) return; + if( jsonParse(&x, ctx, (const char*)tdsqlite3_value_text(argv[0])) ) return; jsonParseFindParents(&x); jsonInit(&s, ctx); for(i=0; inNode ); if( argc==2 ){ - const char *zPath = (const char*)sqlite3_value_text(argv[1]); + const char *zPath = (const char*)tdsqlite3_value_text(argv[1]); pNode = jsonLookup(p, zPath, 0, ctx); }else{ pNode = p->aNode; @@ -189376,7 +189376,7 @@ static void jsonArrayLengthFunc( i += jsonNodeSize(&pNode[i]); } } - sqlite3_result_int64(ctx, n); + tdsqlite3_result_int64(ctx, n); } /* @@ -189388,9 +189388,9 @@ static void jsonArrayLengthFunc( ** is malformed. */ static void jsonExtractFunc( - sqlite3_context *ctx, + tdsqlite3_context *ctx, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ JsonParse *p; /* The parse */ JsonNode *pNode; @@ -189404,7 +189404,7 @@ static void jsonExtractFunc( jsonInit(&jx, ctx); jsonAppendChar(&jx, '['); for(i=1; inErr ) break; if( argc>2 ){ @@ -189421,7 +189421,7 @@ static void jsonExtractFunc( if( argc>2 && i==argc ){ jsonAppendChar(&jx, ']'); jsonResult(&jx); - sqlite3_result_subtype(ctx, JSON_SUBTYPE); + tdsqlite3_result_subtype(ctx, JSON_SUBTYPE); } jsonReset(&jx); } @@ -189499,17 +189499,17 @@ static JsonNode *jsonMergePatch( ** on the two arguments. */ static void jsonPatchFunc( - sqlite3_context *ctx, + tdsqlite3_context *ctx, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ JsonParse x; /* The JSON that is being patched */ JsonParse y; /* The patch */ JsonNode *pResult; /* The result of the merge */ UNUSED_PARAM(argc); - if( jsonParse(&x, ctx, (const char*)sqlite3_value_text(argv[0])) ) return; - if( jsonParse(&y, ctx, (const char*)sqlite3_value_text(argv[1])) ){ + if( jsonParse(&x, ctx, (const char*)tdsqlite3_value_text(argv[0])) ) return; + if( jsonParse(&y, ctx, (const char*)tdsqlite3_value_text(argv[1])) ){ jsonParseReset(&x); return; } @@ -189518,7 +189518,7 @@ static void jsonPatchFunc( if( pResult ){ jsonReturnJson(pResult, ctx, 0); }else{ - sqlite3_result_error_nomem(ctx); + tdsqlite3_result_error_nomem(ctx); } jsonParseReset(&x); jsonParseReset(&y); @@ -189531,9 +189531,9 @@ static void jsonPatchFunc( ** is not a string or if any value is a BLOB, throw an error. */ static void jsonObjectFunc( - sqlite3_context *ctx, + tdsqlite3_context *ctx, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ int i; JsonString jx; @@ -189541,28 +189541,28 @@ static void jsonObjectFunc( u32 n; if( argc&1 ){ - sqlite3_result_error(ctx, "json_object() requires an even number " + tdsqlite3_result_error(ctx, "json_object() requires an even number " "of arguments", -1); return; } jsonInit(&jx, ctx); jsonAppendChar(&jx, '{'); for(i=0; iaNode; } if( pNode ){ - sqlite3_result_text(ctx, jsonType[pNode->eType], -1, SQLITE_STATIC); + tdsqlite3_result_text(ctx, jsonType[pNode->eType], -1, SQLITE_STATIC); } } @@ -189730,14 +189730,14 @@ static void jsonTypeFunc( ** Return 0 otherwise. */ static void jsonValidFunc( - sqlite3_context *ctx, + tdsqlite3_context *ctx, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ JsonParse *p; /* The parse */ UNUSED_PARAM(argc); p = jsonParseCached(ctx, argv, 0); - sqlite3_result_int(ctx, p!=0); + tdsqlite3_result_int(ctx, p!=0); } @@ -189750,13 +189750,13 @@ static void jsonValidFunc( ** Return a JSON array composed of all values in the aggregate. */ static void jsonArrayStep( - sqlite3_context *ctx, + tdsqlite3_context *ctx, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ JsonString *pStr; UNUSED_PARAM(argc); - pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr)); + pStr = (JsonString*)tdsqlite3_aggregate_context(ctx, sizeof(*pStr)); if( pStr ){ if( pStr->zBuf==0 ){ jsonInit(pStr, ctx); @@ -189768,32 +189768,32 @@ static void jsonArrayStep( jsonAppendValue(pStr, argv[0]); } } -static void jsonArrayCompute(sqlite3_context *ctx, int isFinal){ +static void jsonArrayCompute(tdsqlite3_context *ctx, int isFinal){ JsonString *pStr; - pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0); + pStr = (JsonString*)tdsqlite3_aggregate_context(ctx, 0); if( pStr ){ pStr->pCtx = ctx; jsonAppendChar(pStr, ']'); if( pStr->bErr ){ - if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx); + if( pStr->bErr==1 ) tdsqlite3_result_error_nomem(ctx); assert( pStr->bStatic ); }else if( isFinal ){ - sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, - pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free); + tdsqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, + pStr->bStatic ? SQLITE_TRANSIENT : tdsqlite3_free); pStr->bStatic = 1; }else{ - sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT); + tdsqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT); pStr->nUsed--; } }else{ - sqlite3_result_text(ctx, "[]", 2, SQLITE_STATIC); + tdsqlite3_result_text(ctx, "[]", 2, SQLITE_STATIC); } - sqlite3_result_subtype(ctx, JSON_SUBTYPE); + tdsqlite3_result_subtype(ctx, JSON_SUBTYPE); } -static void jsonArrayValue(sqlite3_context *ctx){ +static void jsonArrayValue(tdsqlite3_context *ctx){ jsonArrayCompute(ctx, 0); } -static void jsonArrayFinal(sqlite3_context *ctx){ +static void jsonArrayFinal(tdsqlite3_context *ctx){ jsonArrayCompute(ctx, 1); } @@ -189805,9 +189805,9 @@ static void jsonArrayFinal(sqlite3_context *ctx){ ** text through that comma. */ static void jsonGroupInverse( - sqlite3_context *ctx, + tdsqlite3_context *ctx, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ unsigned int i; int inStr = 0; @@ -189817,7 +189817,7 @@ static void jsonGroupInverse( JsonString *pStr; UNUSED_PARAM(argc); UNUSED_PARAM(argv); - pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0); + pStr = (JsonString*)tdsqlite3_aggregate_context(ctx, 0); #ifdef NEVER /* pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will ** always have been called to initalize it */ @@ -189852,15 +189852,15 @@ static void jsonGroupInverse( ** Return a JSON object composed of all names and values in the aggregate. */ static void jsonObjectStep( - sqlite3_context *ctx, + tdsqlite3_context *ctx, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ JsonString *pStr; const char *z; u32 n; UNUSED_PARAM(argc); - pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr)); + pStr = (JsonString*)tdsqlite3_aggregate_context(ctx, sizeof(*pStr)); if( pStr ){ if( pStr->zBuf==0 ){ jsonInit(pStr, ctx); @@ -189869,38 +189869,38 @@ static void jsonObjectStep( jsonAppendChar(pStr, ','); pStr->pCtx = ctx; } - z = (const char*)sqlite3_value_text(argv[0]); - n = (u32)sqlite3_value_bytes(argv[0]); + z = (const char*)tdsqlite3_value_text(argv[0]); + n = (u32)tdsqlite3_value_bytes(argv[0]); jsonAppendString(pStr, z, n); jsonAppendChar(pStr, ':'); jsonAppendValue(pStr, argv[1]); } } -static void jsonObjectCompute(sqlite3_context *ctx, int isFinal){ +static void jsonObjectCompute(tdsqlite3_context *ctx, int isFinal){ JsonString *pStr; - pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0); + pStr = (JsonString*)tdsqlite3_aggregate_context(ctx, 0); if( pStr ){ jsonAppendChar(pStr, '}'); if( pStr->bErr ){ - if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx); + if( pStr->bErr==1 ) tdsqlite3_result_error_nomem(ctx); assert( pStr->bStatic ); }else if( isFinal ){ - sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, - pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free); + tdsqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, + pStr->bStatic ? SQLITE_TRANSIENT : tdsqlite3_free); pStr->bStatic = 1; }else{ - sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT); + tdsqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT); pStr->nUsed--; } }else{ - sqlite3_result_text(ctx, "{}", 2, SQLITE_STATIC); + tdsqlite3_result_text(ctx, "{}", 2, SQLITE_STATIC); } - sqlite3_result_subtype(ctx, JSON_SUBTYPE); + tdsqlite3_result_subtype(ctx, JSON_SUBTYPE); } -static void jsonObjectValue(sqlite3_context *ctx){ +static void jsonObjectValue(tdsqlite3_context *ctx){ jsonObjectCompute(ctx, 0); } -static void jsonObjectFinal(sqlite3_context *ctx){ +static void jsonObjectFinal(tdsqlite3_context *ctx){ jsonObjectCompute(ctx, 1); } @@ -189912,7 +189912,7 @@ static void jsonObjectFinal(sqlite3_context *ctx){ ****************************************************************************/ typedef struct JsonEachCursor JsonEachCursor; struct JsonEachCursor { - sqlite3_vtab_cursor base; /* Base class - must be first */ + tdsqlite3_vtab_cursor base; /* Base class - must be first */ u32 iRowid; /* The rowid */ u32 iBegin; /* The first node of the scan */ u32 i; /* Index in sParse.aNode[] of current row */ @@ -189926,13 +189926,13 @@ struct JsonEachCursor { /* Constructor for the json_each virtual table */ static int jsonEachConnect( - sqlite3 *db, + tdsqlite3 *db, void *pAux, int argc, const char *const*argv, - sqlite3_vtab **ppVtab, + tdsqlite3_vtab **ppVtab, char **pzErr ){ - sqlite3_vtab *pNew; + tdsqlite3_vtab *pNew; int rc; /* Column numbers */ @@ -189954,30 +189954,30 @@ static int jsonEachConnect( UNUSED_PARAM(argv); UNUSED_PARAM(argc); UNUSED_PARAM(pAux); - rc = sqlite3_declare_vtab(db, + rc = tdsqlite3_declare_vtab(db, "CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path," "json HIDDEN,root HIDDEN)"); if( rc==SQLITE_OK ){ - pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) ); + pNew = *ppVtab = tdsqlite3_malloc( sizeof(*pNew) ); if( pNew==0 ) return SQLITE_NOMEM; memset(pNew, 0, sizeof(*pNew)); - sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS); + tdsqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS); } return rc; } /* destructor for json_each virtual table */ -static int jsonEachDisconnect(sqlite3_vtab *pVtab){ - sqlite3_free(pVtab); +static int jsonEachDisconnect(tdsqlite3_vtab *pVtab){ + tdsqlite3_free(pVtab); return SQLITE_OK; } /* constructor for a JsonEachCursor object for json_each(). */ -static int jsonEachOpenEach(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ +static int jsonEachOpenEach(tdsqlite3_vtab *p, tdsqlite3_vtab_cursor **ppCursor){ JsonEachCursor *pCur; UNUSED_PARAM(p); - pCur = sqlite3_malloc( sizeof(*pCur) ); + pCur = tdsqlite3_malloc( sizeof(*pCur) ); if( pCur==0 ) return SQLITE_NOMEM; memset(pCur, 0, sizeof(*pCur)); *ppCursor = &pCur->base; @@ -189985,7 +189985,7 @@ static int jsonEachOpenEach(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ } /* constructor for a JsonEachCursor object for json_tree(). */ -static int jsonEachOpenTree(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ +static int jsonEachOpenTree(tdsqlite3_vtab *p, tdsqlite3_vtab_cursor **ppCursor){ int rc = jsonEachOpenEach(p, ppCursor); if( rc==SQLITE_OK ){ JsonEachCursor *pCur = (JsonEachCursor*)*ppCursor; @@ -189997,8 +189997,8 @@ static int jsonEachOpenTree(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ /* Reset a JsonEachCursor back to its original state. Free any memory ** held. */ static void jsonEachCursorReset(JsonEachCursor *p){ - sqlite3_free(p->zJson); - sqlite3_free(p->zRoot); + tdsqlite3_free(p->zJson); + tdsqlite3_free(p->zRoot); jsonParseReset(&p->sParse); p->iRowid = 0; p->i = 0; @@ -190009,22 +190009,22 @@ static void jsonEachCursorReset(JsonEachCursor *p){ } /* Destructor for a jsonEachCursor object */ -static int jsonEachClose(sqlite3_vtab_cursor *cur){ +static int jsonEachClose(tdsqlite3_vtab_cursor *cur){ JsonEachCursor *p = (JsonEachCursor*)cur; jsonEachCursorReset(p); - sqlite3_free(cur); + tdsqlite3_free(cur); return SQLITE_OK; } /* Return TRUE if the jsonEachCursor object has been advanced off the end ** of the JSON object */ -static int jsonEachEof(sqlite3_vtab_cursor *cur){ +static int jsonEachEof(tdsqlite3_vtab_cursor *cur){ JsonEachCursor *p = (JsonEachCursor*)cur; return p->i >= p->iEnd; } /* Advance the cursor to the next element for json_tree() */ -static int jsonEachNext(sqlite3_vtab_cursor *cur){ +static int jsonEachNext(tdsqlite3_vtab_cursor *cur){ JsonEachCursor *p = (JsonEachCursor*)cur; if( p->bRecursive ){ if( p->sParse.aNode[p->i].jnFlags & JNODE_LABEL ) p->i++; @@ -190093,8 +190093,8 @@ static void jsonEachComputePath( /* Return the value of a column */ static int jsonEachColumn( - sqlite3_vtab_cursor *cur, /* The cursor */ - sqlite3_context *ctx, /* First argument to sqlite3_result_...() */ + tdsqlite3_vtab_cursor *cur, /* The cursor */ + tdsqlite3_context *ctx, /* First argument to tdsqlite3_result_...() */ int i /* Which column to return */ ){ JsonEachCursor *p = (JsonEachCursor*)cur; @@ -190112,7 +190112,7 @@ static int jsonEachColumn( }else{ iKey = p->iRowid; } - sqlite3_result_int64(ctx, (sqlite3_int64)iKey); + tdsqlite3_result_int64(ctx, (tdsqlite3_int64)iKey); } break; } @@ -190123,7 +190123,7 @@ static int jsonEachColumn( } case JEACH_TYPE: { if( pThis->jnFlags & JNODE_LABEL ) pThis++; - sqlite3_result_text(ctx, jsonType[pThis->eType], -1, SQLITE_STATIC); + tdsqlite3_result_text(ctx, jsonType[pThis->eType], -1, SQLITE_STATIC); break; } case JEACH_ATOM: { @@ -190133,13 +190133,13 @@ static int jsonEachColumn( break; } case JEACH_ID: { - sqlite3_result_int64(ctx, - (sqlite3_int64)p->i + ((pThis->jnFlags & JNODE_LABEL)!=0)); + tdsqlite3_result_int64(ctx, + (tdsqlite3_int64)p->i + ((pThis->jnFlags & JNODE_LABEL)!=0)); break; } case JEACH_PARENT: { if( p->i>p->iBegin && p->bRecursive ){ - sqlite3_result_int64(ctx, (sqlite3_int64)p->sParse.aUp[p->i]); + tdsqlite3_result_int64(ctx, (tdsqlite3_int64)p->sParse.aUp[p->i]); } break; } @@ -190177,12 +190177,12 @@ static int jsonEachColumn( default: { const char *zRoot = p->zRoot; if( zRoot==0 ) zRoot = "$"; - sqlite3_result_text(ctx, zRoot, -1, SQLITE_STATIC); + tdsqlite3_result_text(ctx, zRoot, -1, SQLITE_STATIC); break; } case JEACH_JSON: { assert( i==JEACH_JSON ); - sqlite3_result_text(ctx, p->sParse.zJson, -1, SQLITE_STATIC); + tdsqlite3_result_text(ctx, p->sParse.zJson, -1, SQLITE_STATIC); break; } } @@ -190190,7 +190190,7 @@ static int jsonEachColumn( } /* Return the current rowid value */ -static int jsonEachRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ +static int jsonEachRowid(tdsqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ JsonEachCursor *p = (JsonEachCursor*)cur; *pRowid = p->iRowid; return SQLITE_OK; @@ -190202,14 +190202,14 @@ static int jsonEachRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ ** and 0 otherwise. */ static int jsonEachBestIndex( - sqlite3_vtab *tab, - sqlite3_index_info *pIdxInfo + tdsqlite3_vtab *tab, + tdsqlite3_index_info *pIdxInfo ){ int i; /* Loop counter or computed array index */ int aIdx[2]; /* Index of constraints for JSON and ROOT */ int unusableMask = 0; /* Mask of unusable JSON and ROOT constraints */ int idxMask = 0; /* Mask of usable == constraints JSON and ROOT */ - const struct sqlite3_index_constraint *pConstraint; + const struct tdsqlite3_index_constraint *pConstraint; /* This implementation assumes that JSON and ROOT are the last two ** columns in the table */ @@ -190260,30 +190260,30 @@ static int jsonEachBestIndex( /* Start a search on a new JSON string */ static int jsonEachFilter( - sqlite3_vtab_cursor *cur, + tdsqlite3_vtab_cursor *cur, int idxNum, const char *idxStr, - int argc, sqlite3_value **argv + int argc, tdsqlite3_value **argv ){ JsonEachCursor *p = (JsonEachCursor*)cur; const char *z; const char *zRoot = 0; - sqlite3_int64 n; + tdsqlite3_int64 n; UNUSED_PARAM(idxStr); UNUSED_PARAM(argc); jsonEachCursorReset(p); if( idxNum==0 ) return SQLITE_OK; - z = (const char*)sqlite3_value_text(argv[0]); + z = (const char*)tdsqlite3_value_text(argv[0]); if( z==0 ) return SQLITE_OK; - n = sqlite3_value_bytes(argv[0]); - p->zJson = sqlite3_malloc64( n+1 ); + n = tdsqlite3_value_bytes(argv[0]); + p->zJson = tdsqlite3_malloc64( n+1 ); if( p->zJson==0 ) return SQLITE_NOMEM; memcpy(p->zJson, z, (size_t)n+1); if( jsonParse(&p->sParse, 0, p->zJson) ){ int rc = SQLITE_NOMEM; if( p->sParse.oom==0 ){ - sqlite3_free(cur->pVtab->zErrMsg); - cur->pVtab->zErrMsg = sqlite3_mprintf("malformed JSON"); + tdsqlite3_free(cur->pVtab->zErrMsg); + cur->pVtab->zErrMsg = tdsqlite3_mprintf("malformed JSON"); if( cur->pVtab->zErrMsg ) rc = SQLITE_ERROR; } jsonEachCursorReset(p); @@ -190295,10 +190295,10 @@ static int jsonEachFilter( JsonNode *pNode = 0; if( idxNum==3 ){ const char *zErr = 0; - zRoot = (const char*)sqlite3_value_text(argv[1]); + zRoot = (const char*)tdsqlite3_value_text(argv[1]); if( zRoot==0 ) return SQLITE_OK; - n = sqlite3_value_bytes(argv[1]); - p->zRoot = sqlite3_malloc64( n+1 ); + n = tdsqlite3_value_bytes(argv[1]); + p->zRoot = tdsqlite3_malloc64( n+1 ); if( p->zRoot==0 ) return SQLITE_NOMEM; memcpy(p->zRoot, zRoot, (size_t)n+1); if( zRoot[0]!='$' ){ @@ -190307,7 +190307,7 @@ static int jsonEachFilter( pNode = jsonLookupStep(&p->sParse, 0, p->zRoot+1, 0, &zErr); } if( zErr ){ - sqlite3_free(cur->pVtab->zErrMsg); + tdsqlite3_free(cur->pVtab->zErrMsg); cur->pVtab->zErrMsg = jsonPathSyntaxError(zErr); jsonEachCursorReset(p); return cur->pVtab->zErrMsg ? SQLITE_ERROR : SQLITE_NOMEM; @@ -190338,7 +190338,7 @@ static int jsonEachFilter( } /* The methods of the json_each virtual table */ -static sqlite3_module jsonEachModule = { +static tdsqlite3_module jsonEachModule = { 0, /* iVersion */ 0, /* xCreate */ jsonEachConnect, /* xConnect */ @@ -190366,7 +190366,7 @@ static sqlite3_module jsonEachModule = { }; /* The methods of the json_tree virtual table. */ -static sqlite3_module jsonTreeModule = { +static tdsqlite3_module jsonTreeModule = { 0, /* iVersion */ 0, /* xCreate */ jsonEachConnect, /* xConnect */ @@ -190400,14 +190400,14 @@ static sqlite3_module jsonTreeModule = { ** functions and the virtual table implemented by this file. ****************************************************************************/ -SQLITE_PRIVATE int sqlite3Json1Init(sqlite3 *db){ +SQLITE_PRIVATE int tdsqlite3Json1Init(tdsqlite3 *db){ int rc = SQLITE_OK; unsigned int i; static const struct { const char *zName; int nArg; int flag; - void (*xFunc)(sqlite3_context*,int,sqlite3_value**); + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**); } aFunc[] = { { "json", 1, 0, jsonRemoveFunc }, { "json_array", -1, 0, jsonArrayFunc }, @@ -190434,9 +190434,9 @@ SQLITE_PRIVATE int sqlite3Json1Init(sqlite3 *db){ static const struct { const char *zName; int nArg; - void (*xStep)(sqlite3_context*,int,sqlite3_value**); - void (*xFinal)(sqlite3_context*); - void (*xValue)(sqlite3_context*); + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**); + void (*xFinal)(tdsqlite3_context*); + void (*xValue)(tdsqlite3_context*); } aAgg[] = { { "json_group_array", 1, jsonArrayStep, jsonArrayFinal, jsonArrayValue }, @@ -190446,7 +190446,7 @@ SQLITE_PRIVATE int sqlite3Json1Init(sqlite3 *db){ #ifndef SQLITE_OMIT_VIRTUALTABLE static const struct { const char *zName; - sqlite3_module *pModule; + tdsqlite3_module *pModule; } aMod[] = { { "json_each", &jsonEachModule }, { "json_tree", &jsonTreeModule }, @@ -190457,13 +190457,13 @@ SQLITE_PRIVATE int sqlite3Json1Init(sqlite3 *db){ SQLITE_DETERMINISTIC | SQLITE_INNOCUOUS; for(i=0; iiNodeSize); + pNode = (RtreeNode *)tdsqlite3_malloc64(sizeof(RtreeNode) + pRtree->iNodeSize); if( pNode ){ memset(pNode, 0, sizeof(RtreeNode) + pRtree->iNodeSize); pNode->zData = (u8 *)&pNode[1]; @@ -191140,9 +191140,9 @@ static RtreeNode *nodeNew(Rtree *pRtree, RtreeNode *pParent){ */ static void nodeBlobReset(Rtree *pRtree){ if( pRtree->pNodeBlob && pRtree->inWrTrans==0 && pRtree->nCursor==0 ){ - sqlite3_blob *pBlob = pRtree->pNodeBlob; + tdsqlite3_blob *pBlob = pRtree->pNodeBlob; pRtree->pNodeBlob = 0; - sqlite3_blob_close(pBlob); + tdsqlite3_blob_close(pBlob); } } @@ -191191,9 +191191,9 @@ static int nodeAcquire( } if( pRtree->pNodeBlob ){ - sqlite3_blob *pBlob = pRtree->pNodeBlob; + tdsqlite3_blob *pBlob = pRtree->pNodeBlob; pRtree->pNodeBlob = 0; - rc = sqlite3_blob_reopen(pBlob, iNode); + rc = tdsqlite3_blob_reopen(pBlob, iNode); pRtree->pNodeBlob = pBlob; if( rc ){ nodeBlobReset(pRtree); @@ -191201,23 +191201,23 @@ static int nodeAcquire( } } if( pRtree->pNodeBlob==0 ){ - char *zTab = sqlite3_mprintf("%s_node", pRtree->zName); + char *zTab = tdsqlite3_mprintf("%s_node", pRtree->zName); if( zTab==0 ) return SQLITE_NOMEM; - rc = sqlite3_blob_open(pRtree->db, pRtree->zDb, zTab, "data", iNode, 0, + rc = tdsqlite3_blob_open(pRtree->db, pRtree->zDb, zTab, "data", iNode, 0, &pRtree->pNodeBlob); - sqlite3_free(zTab); + tdsqlite3_free(zTab); } if( rc ){ nodeBlobReset(pRtree); *ppNode = 0; - /* If unable to open an sqlite3_blob on the desired row, that can only + /* If unable to open an tdsqlite3_blob on the desired row, that can only ** be because the shadow tables hold erroneous data. */ if( rc==SQLITE_ERROR ){ rc = SQLITE_CORRUPT_VTAB; RTREE_IS_CORRUPT(pRtree); } - }else if( pRtree->iNodeSize==sqlite3_blob_bytes(pRtree->pNodeBlob) ){ - pNode = (RtreeNode *)sqlite3_malloc64(sizeof(RtreeNode)+pRtree->iNodeSize); + }else if( pRtree->iNodeSize==tdsqlite3_blob_bytes(pRtree->pNodeBlob) ){ + pNode = (RtreeNode *)tdsqlite3_malloc64(sizeof(RtreeNode)+pRtree->iNodeSize); if( !pNode ){ rc = SQLITE_NOMEM; }else{ @@ -191228,7 +191228,7 @@ static int nodeAcquire( pNode->iNode = iNode; pNode->isDirty = 0; pNode->pNext = 0; - rc = sqlite3_blob_read(pRtree->pNodeBlob, pNode->zData, + rc = tdsqlite3_blob_read(pRtree->pNodeBlob, pNode->zData, pRtree->iNodeSize, 0); } } @@ -191270,7 +191270,7 @@ static int nodeAcquire( }else{ if( pNode ){ pRtree->nNodeRef--; - sqlite3_free(pNode); + tdsqlite3_free(pNode); } *ppNode = 0; } @@ -191341,19 +191341,19 @@ static int nodeInsertCell( static int nodeWrite(Rtree *pRtree, RtreeNode *pNode){ int rc = SQLITE_OK; if( pNode->isDirty ){ - sqlite3_stmt *p = pRtree->pWriteNode; + tdsqlite3_stmt *p = pRtree->pWriteNode; if( pNode->iNode ){ - sqlite3_bind_int64(p, 1, pNode->iNode); + tdsqlite3_bind_int64(p, 1, pNode->iNode); }else{ - sqlite3_bind_null(p, 1); + tdsqlite3_bind_null(p, 1); } - sqlite3_bind_blob(p, 2, pNode->zData, pRtree->iNodeSize, SQLITE_STATIC); - sqlite3_step(p); + tdsqlite3_bind_blob(p, 2, pNode->zData, pRtree->iNodeSize, SQLITE_STATIC); + tdsqlite3_step(p); pNode->isDirty = 0; - rc = sqlite3_reset(p); - sqlite3_bind_null(p, 2); + rc = tdsqlite3_reset(p); + tdsqlite3_bind_null(p, 2); if( pNode->iNode==0 && rc==SQLITE_OK ){ - pNode->iNode = sqlite3_last_insert_rowid(pRtree->db); + pNode->iNode = tdsqlite3_last_insert_rowid(pRtree->db); nodeHashInsert(pRtree, pNode); } } @@ -191382,7 +191382,7 @@ static int nodeRelease(Rtree *pRtree, RtreeNode *pNode){ rc = nodeWrite(pRtree, pNode); } nodeHashDelete(pRtree, pNode); - sqlite3_free(pNode); + tdsqlite3_free(pNode); } } return rc; @@ -191444,17 +191444,17 @@ static void nodeGetCell( ** the virtual table module xCreate() and xConnect() methods. */ static int rtreeInit( - sqlite3 *, void *, int, const char *const*, sqlite3_vtab **, char **, int + tdsqlite3 *, void *, int, const char *const*, tdsqlite3_vtab **, char **, int ); /* ** Rtree virtual table module xCreate method. */ static int rtreeCreate( - sqlite3 *db, + tdsqlite3 *db, void *pAux, int argc, const char *const*argv, - sqlite3_vtab **ppVtab, + tdsqlite3_vtab **ppVtab, char **pzErr ){ return rtreeInit(db, pAux, argc, argv, ppVtab, pzErr, 1); @@ -191464,10 +191464,10 @@ static int rtreeCreate( ** Rtree virtual table module xConnect method. */ static int rtreeConnect( - sqlite3 *db, + tdsqlite3 *db, void *pAux, int argc, const char *const*argv, - sqlite3_vtab **ppVtab, + tdsqlite3_vtab **ppVtab, char **pzErr ){ return rtreeInit(db, pAux, argc, argv, ppVtab, pzErr, 0); @@ -191491,24 +191491,24 @@ static void rtreeRelease(Rtree *pRtree){ assert( pRtree->nCursor==0 ); nodeBlobReset(pRtree); assert( pRtree->nNodeRef==0 || pRtree->bCorrupt ); - sqlite3_finalize(pRtree->pWriteNode); - sqlite3_finalize(pRtree->pDeleteNode); - sqlite3_finalize(pRtree->pReadRowid); - sqlite3_finalize(pRtree->pWriteRowid); - sqlite3_finalize(pRtree->pDeleteRowid); - sqlite3_finalize(pRtree->pReadParent); - sqlite3_finalize(pRtree->pWriteParent); - sqlite3_finalize(pRtree->pDeleteParent); - sqlite3_finalize(pRtree->pWriteAux); - sqlite3_free(pRtree->zReadAuxSql); - sqlite3_free(pRtree); + tdsqlite3_finalize(pRtree->pWriteNode); + tdsqlite3_finalize(pRtree->pDeleteNode); + tdsqlite3_finalize(pRtree->pReadRowid); + tdsqlite3_finalize(pRtree->pWriteRowid); + tdsqlite3_finalize(pRtree->pDeleteRowid); + tdsqlite3_finalize(pRtree->pReadParent); + tdsqlite3_finalize(pRtree->pWriteParent); + tdsqlite3_finalize(pRtree->pDeleteParent); + tdsqlite3_finalize(pRtree->pWriteAux); + tdsqlite3_free(pRtree->zReadAuxSql); + tdsqlite3_free(pRtree); } } /* ** Rtree virtual table module xDisconnect method. */ -static int rtreeDisconnect(sqlite3_vtab *pVtab){ +static int rtreeDisconnect(tdsqlite3_vtab *pVtab){ rtreeRelease((Rtree *)pVtab); return SQLITE_OK; } @@ -191516,10 +191516,10 @@ static int rtreeDisconnect(sqlite3_vtab *pVtab){ /* ** Rtree virtual table module xDestroy method. */ -static int rtreeDestroy(sqlite3_vtab *pVtab){ +static int rtreeDestroy(tdsqlite3_vtab *pVtab){ Rtree *pRtree = (Rtree *)pVtab; int rc; - char *zCreate = sqlite3_mprintf( + char *zCreate = tdsqlite3_mprintf( "DROP TABLE '%q'.'%q_node';" "DROP TABLE '%q'.'%q_rowid';" "DROP TABLE '%q'.'%q_parent';", @@ -191531,8 +191531,8 @@ static int rtreeDestroy(sqlite3_vtab *pVtab){ rc = SQLITE_NOMEM; }else{ nodeBlobReset(pRtree); - rc = sqlite3_exec(pRtree->db, zCreate, 0, 0, 0); - sqlite3_free(zCreate); + rc = tdsqlite3_exec(pRtree->db, zCreate, 0, 0, 0); + tdsqlite3_free(zCreate); } if( rc==SQLITE_OK ){ rtreeRelease(pRtree); @@ -191544,19 +191544,19 @@ static int rtreeDestroy(sqlite3_vtab *pVtab){ /* ** Rtree virtual table module xOpen method. */ -static int rtreeOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ +static int rtreeOpen(tdsqlite3_vtab *pVTab, tdsqlite3_vtab_cursor **ppCursor){ int rc = SQLITE_NOMEM; Rtree *pRtree = (Rtree *)pVTab; RtreeCursor *pCsr; - pCsr = (RtreeCursor *)sqlite3_malloc64(sizeof(RtreeCursor)); + pCsr = (RtreeCursor *)tdsqlite3_malloc64(sizeof(RtreeCursor)); if( pCsr ){ memset(pCsr, 0, sizeof(RtreeCursor)); pCsr->base.pVtab = pVTab; rc = SQLITE_OK; pRtree->nCursor++; } - *ppCursor = (sqlite3_vtab_cursor *)pCsr; + *ppCursor = (tdsqlite3_vtab_cursor *)pCsr; return rc; } @@ -191568,24 +191568,24 @@ static int rtreeOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ static void resetCursor(RtreeCursor *pCsr){ Rtree *pRtree = (Rtree *)(pCsr->base.pVtab); int ii; - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; if( pCsr->aConstraint ){ int i; /* Used to iterate through constraint array */ for(i=0; inConstraint; i++){ - sqlite3_rtree_query_info *pInfo = pCsr->aConstraint[i].pInfo; + tdsqlite3_rtree_query_info *pInfo = pCsr->aConstraint[i].pInfo; if( pInfo ){ if( pInfo->xDelUser ) pInfo->xDelUser(pInfo->pUser); - sqlite3_free(pInfo); + tdsqlite3_free(pInfo); } } - sqlite3_free(pCsr->aConstraint); + tdsqlite3_free(pCsr->aConstraint); pCsr->aConstraint = 0; } for(ii=0; iiaNode[ii]); - sqlite3_free(pCsr->aPoint); + tdsqlite3_free(pCsr->aPoint); pStmt = pCsr->pReadAux; memset(pCsr, 0, sizeof(RtreeCursor)); - pCsr->base.pVtab = (sqlite3_vtab*)pRtree; + pCsr->base.pVtab = (tdsqlite3_vtab*)pRtree; pCsr->pReadAux = pStmt; } @@ -191593,13 +191593,13 @@ static void resetCursor(RtreeCursor *pCsr){ /* ** Rtree virtual table module xClose method. */ -static int rtreeClose(sqlite3_vtab_cursor *cur){ +static int rtreeClose(tdsqlite3_vtab_cursor *cur){ Rtree *pRtree = (Rtree *)(cur->pVtab); RtreeCursor *pCsr = (RtreeCursor *)cur; assert( pRtree->nCursor>0 ); resetCursor(pCsr); - sqlite3_finalize(pCsr->pReadAux); - sqlite3_free(pCsr); + tdsqlite3_finalize(pCsr->pReadAux); + tdsqlite3_free(pCsr); pRtree->nCursor--; nodeBlobReset(pRtree); return SQLITE_OK; @@ -191611,7 +191611,7 @@ static int rtreeClose(sqlite3_vtab_cursor *cur){ ** Return non-zero if the cursor does not currently point to a valid ** record (i.e if the scan has finished), or zero otherwise. */ -static int rtreeEof(sqlite3_vtab_cursor *cur){ +static int rtreeEof(tdsqlite3_vtab_cursor *cur){ RtreeCursor *pCsr = (RtreeCursor *)cur; return pCsr->atEOF; } @@ -191631,13 +191631,13 @@ static int rtreeEof(sqlite3_vtab_cursor *cur){ #define RTREE_DECODE_COORD(eInt, a, r) { \ RtreeCoord c; /* Coordinate decoded */ \ c.u = _byteswap_ulong(*(u32*)a); \ - r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \ + r = eInt ? (tdsqlite3_rtree_dbl)c.i : (tdsqlite3_rtree_dbl)c.f; \ } #elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000 #define RTREE_DECODE_COORD(eInt, a, r) { \ RtreeCoord c; /* Coordinate decoded */ \ c.u = __builtin_bswap32(*(u32*)a); \ - r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \ + r = eInt ? (tdsqlite3_rtree_dbl)c.i : (tdsqlite3_rtree_dbl)c.f; \ } #elif SQLITE_BYTEORDER==1234 #define RTREE_DECODE_COORD(eInt, a, r) { \ @@ -191645,20 +191645,20 @@ static int rtreeEof(sqlite3_vtab_cursor *cur){ memcpy(&c.u,a,4); \ c.u = ((c.u>>24)&0xff)|((c.u>>8)&0xff00)| \ ((c.u&0xff)<<24)|((c.u&0xff00)<<8); \ - r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \ + r = eInt ? (tdsqlite3_rtree_dbl)c.i : (tdsqlite3_rtree_dbl)c.f; \ } #elif SQLITE_BYTEORDER==4321 #define RTREE_DECODE_COORD(eInt, a, r) { \ RtreeCoord c; /* Coordinate decoded */ \ memcpy(&c.u,a,4); \ - r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \ + r = eInt ? (tdsqlite3_rtree_dbl)c.i : (tdsqlite3_rtree_dbl)c.f; \ } #else #define RTREE_DECODE_COORD(eInt, a, r) { \ RtreeCoord c; /* Coordinate decoded */ \ c.u = ((u32)a[0]<<24) + ((u32)a[1]<<16) \ +((u32)a[2]<<8) + a[3]; \ - r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \ + r = eInt ? (tdsqlite3_rtree_dbl)c.i : (tdsqlite3_rtree_dbl)c.f; \ } #endif @@ -191671,14 +191671,14 @@ static int rtreeCallbackConstraint( int eInt, /* True if RTree holding integer coordinates */ u8 *pCellData, /* Raw cell content */ RtreeSearchPoint *pSearch, /* Container of this cell */ - sqlite3_rtree_dbl *prScore, /* OUT: score for the cell */ + tdsqlite3_rtree_dbl *prScore, /* OUT: score for the cell */ int *peWithin /* OUT: visibility of the cell */ ){ - sqlite3_rtree_query_info *pInfo = pConstraint->pInfo; /* Callback info */ + tdsqlite3_rtree_query_info *pInfo = pConstraint->pInfo; /* Callback info */ int nCoord = pInfo->nCoord; /* No. of coordinates */ int rc; /* Callback return code */ RtreeCoord c; /* Translator union */ - sqlite3_rtree_dbl aCoord[RTREE_MAX_DIMENSIONS*2]; /* Decoded coordinates */ + tdsqlite3_rtree_dbl aCoord[RTREE_MAX_DIMENSIONS*2]; /* Decoded coordinates */ assert( pConstraint->op==RTREE_MATCH || pConstraint->op==RTREE_QUERY ); assert( nCoord==2 || nCoord==4 || nCoord==6 || nCoord==8 || nCoord==10 ); @@ -191719,7 +191719,7 @@ static int rtreeCallbackConstraint( } if( pConstraint->op==RTREE_MATCH ){ int eWithin = 0; - rc = pConstraint->u.xGeom((sqlite3_rtree_geometry*)pInfo, + rc = pConstraint->u.xGeom((tdsqlite3_rtree_geometry*)pInfo, nCoord, aCoord, &eWithin); if( eWithin==0 ) *peWithin = NOT_WITHIN; *prScore = RTREE_ZERO; @@ -191748,7 +191748,7 @@ static void rtreeNonleafConstraint( u8 *pCellData, /* Raw cell content as appears on disk */ int *peWithin /* Adjust downward, as appropriate */ ){ - sqlite3_rtree_dbl val; /* Coordinate value convert to a double */ + tdsqlite3_rtree_dbl val; /* Coordinate value convert to a double */ /* p->iCoord might point to either a lower or upper bound coordinate ** in a coordinate pair. But make pCellData point to the lower bound. @@ -191905,7 +191905,7 @@ static RtreeSearchPoint *rtreeSearchPointFirst(RtreeCursor *pCur){ ** Get the RtreeNode for the search point with the lowest score. */ static RtreeNode *rtreeNodeOfFirstSearchPoint(RtreeCursor *pCur, int *pRC){ - sqlite3_int64 id; + tdsqlite3_int64 id; int ii = 1 - pCur->bPoint; assert( ii==0 || ii==1 ); assert( pCur->bPoint || pCur->nPoint ); @@ -191929,7 +191929,7 @@ static RtreeSearchPoint *rtreeEnqueue( RtreeSearchPoint *pNew; if( pCur->nPoint>=pCur->nPointAlloc ){ int nNew = pCur->nPointAlloc*2 + 8; - pNew = sqlite3_realloc64(pCur->aPoint, nNew*sizeof(pCur->aPoint[0])); + pNew = tdsqlite3_realloc64(pCur->aPoint, nNew*sizeof(pCur->aPoint[0])); if( pNew==0 ) return 0; pCur->aPoint = pNew; pCur->nPointAlloc = nNew; @@ -192091,7 +192091,7 @@ static int rtreeStepToLeaf(RtreeCursor *pCur){ assert( nCell<200 ); pCellData = pNode->zData + (4+pRtree->nBytesPerCell*p->iCell); while( p->iCellaConstraint + ii; @@ -192151,7 +192151,7 @@ static int rtreeStepToLeaf(RtreeCursor *pCur){ /* ** Rtree virtual table module xNext method. */ -static int rtreeNext(sqlite3_vtab_cursor *pVtabCursor){ +static int rtreeNext(tdsqlite3_vtab_cursor *pVtabCursor){ RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor; int rc = SQLITE_OK; @@ -192159,7 +192159,7 @@ static int rtreeNext(sqlite3_vtab_cursor *pVtabCursor){ RTREE_QUEUE_TRACE(pCsr, "POP-Nx:"); if( pCsr->bAuxValid ){ pCsr->bAuxValid = 0; - sqlite3_reset(pCsr->pReadAux); + tdsqlite3_reset(pCsr->pReadAux); } rtreeSearchPointPop(pCsr); rc = rtreeStepToLeaf(pCsr); @@ -192169,7 +192169,7 @@ static int rtreeNext(sqlite3_vtab_cursor *pVtabCursor){ /* ** Rtree virtual table module xRowid method. */ -static int rtreeRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *pRowid){ +static int rtreeRowid(tdsqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *pRowid){ RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor; RtreeSearchPoint *p = rtreeSearchPointFirst(pCsr); int rc = SQLITE_OK; @@ -192183,7 +192183,7 @@ static int rtreeRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *pRowid){ /* ** Rtree virtual table module xColumn method. */ -static int rtreeColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ +static int rtreeColumn(tdsqlite3_vtab_cursor *cur, tdsqlite3_context *ctx, int i){ Rtree *pRtree = (Rtree *)cur->pVtab; RtreeCursor *pCsr = (RtreeCursor *)cur; RtreeSearchPoint *p = rtreeSearchPointFirst(pCsr); @@ -192194,38 +192194,38 @@ static int rtreeColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ if( rc ) return rc; if( p==0 ) return SQLITE_OK; if( i==0 ){ - sqlite3_result_int64(ctx, nodeGetRowid(pRtree, pNode, p->iCell)); + tdsqlite3_result_int64(ctx, nodeGetRowid(pRtree, pNode, p->iCell)); }else if( i<=pRtree->nDim2 ){ nodeGetCoord(pRtree, pNode, p->iCell, i-1, &c); #ifndef SQLITE_RTREE_INT_ONLY if( pRtree->eCoordType==RTREE_COORD_REAL32 ){ - sqlite3_result_double(ctx, c.f); + tdsqlite3_result_double(ctx, c.f); }else #endif { assert( pRtree->eCoordType==RTREE_COORD_INT32 ); - sqlite3_result_int(ctx, c.i); + tdsqlite3_result_int(ctx, c.i); } }else{ if( !pCsr->bAuxValid ){ if( pCsr->pReadAux==0 ){ - rc = sqlite3_prepare_v3(pRtree->db, pRtree->zReadAuxSql, -1, 0, + rc = tdsqlite3_prepare_v3(pRtree->db, pRtree->zReadAuxSql, -1, 0, &pCsr->pReadAux, 0); if( rc ) return rc; } - sqlite3_bind_int64(pCsr->pReadAux, 1, + tdsqlite3_bind_int64(pCsr->pReadAux, 1, nodeGetRowid(pRtree, pNode, p->iCell)); - rc = sqlite3_step(pCsr->pReadAux); + rc = tdsqlite3_step(pCsr->pReadAux); if( rc==SQLITE_ROW ){ pCsr->bAuxValid = 1; }else{ - sqlite3_reset(pCsr->pReadAux); + tdsqlite3_reset(pCsr->pReadAux); if( rc==SQLITE_DONE ) rc = SQLITE_OK; return rc; } } - sqlite3_result_value(ctx, - sqlite3_column_value(pCsr->pReadAux, i - pRtree->nDim2 + 1)); + tdsqlite3_result_value(ctx, + tdsqlite3_column_value(pCsr->pReadAux, i - pRtree->nDim2 + 1)); } return SQLITE_OK; } @@ -192241,18 +192241,18 @@ static int findLeafNode( Rtree *pRtree, /* RTree to search */ i64 iRowid, /* The rowid searching for */ RtreeNode **ppLeaf, /* Write the node here */ - sqlite3_int64 *piNode /* Write the node-id here */ + tdsqlite3_int64 *piNode /* Write the node-id here */ ){ int rc; *ppLeaf = 0; - sqlite3_bind_int64(pRtree->pReadRowid, 1, iRowid); - if( sqlite3_step(pRtree->pReadRowid)==SQLITE_ROW ){ - i64 iNode = sqlite3_column_int64(pRtree->pReadRowid, 0); + tdsqlite3_bind_int64(pRtree->pReadRowid, 1, iRowid); + if( tdsqlite3_step(pRtree->pReadRowid)==SQLITE_ROW ){ + i64 iNode = tdsqlite3_column_int64(pRtree->pReadRowid, 0); if( piNode ) *piNode = iNode; rc = nodeAcquire(pRtree, iNode, 0, ppLeaf); - sqlite3_reset(pRtree->pReadRowid); + tdsqlite3_reset(pRtree->pReadRowid); }else{ - rc = sqlite3_reset(pRtree->pReadRowid); + rc = tdsqlite3_reset(pRtree->pReadRowid); } return rc; } @@ -192263,14 +192263,14 @@ static int findLeafNode( ** first argument to this function is the right-hand operand to the MATCH ** operator. */ -static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){ +static int deserializeGeometry(tdsqlite3_value *pValue, RtreeConstraint *pCons){ RtreeMatchArg *pBlob, *pSrc; /* BLOB returned by geometry function */ - sqlite3_rtree_query_info *pInfo; /* Callback information */ + tdsqlite3_rtree_query_info *pInfo; /* Callback information */ - pSrc = sqlite3_value_pointer(pValue, "RtreeMatchArg"); + pSrc = tdsqlite3_value_pointer(pValue, "RtreeMatchArg"); if( pSrc==0 ) return SQLITE_ERROR; - pInfo = (sqlite3_rtree_query_info*) - sqlite3_malloc64( sizeof(*pInfo)+pSrc->iSize ); + pInfo = (tdsqlite3_rtree_query_info*) + tdsqlite3_malloc64( sizeof(*pInfo)+pSrc->iSize ); if( !pInfo ) return SQLITE_NOMEM; memset(pInfo, 0, sizeof(*pInfo)); pBlob = (RtreeMatchArg*)&pInfo[1]; @@ -192294,9 +192294,9 @@ static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){ ** Rtree virtual table module xFilter method. */ static int rtreeFilter( - sqlite3_vtab_cursor *pVtabCursor, + tdsqlite3_vtab_cursor *pVtabCursor, int idxNum, const char *idxStr, - int argc, sqlite3_value **argv + int argc, tdsqlite3_value **argv ){ Rtree *pRtree = (Rtree *)pVtabCursor->pVtab; RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor; @@ -192315,11 +192315,11 @@ static int rtreeFilter( /* Special case - lookup by rowid. */ RtreeNode *pLeaf; /* Leaf on which the required cell resides */ RtreeSearchPoint *p; /* Search point for the leaf */ - i64 iRowid = sqlite3_value_int64(argv[0]); + i64 iRowid = tdsqlite3_value_int64(argv[0]); i64 iNode = 0; - int eType = sqlite3_value_numeric_type(argv[0]); + int eType = tdsqlite3_value_numeric_type(argv[0]); if( eType==SQLITE_INTEGER - || (eType==SQLITE_FLOAT && sqlite3_value_double(argv[0])==iRowid) + || (eType==SQLITE_FLOAT && tdsqlite3_value_double(argv[0])==iRowid) ){ rc = findLeafNode(pRtree, iRowid, &pLeaf, &iNode); }else{ @@ -192344,7 +192344,7 @@ static int rtreeFilter( */ rc = nodeAcquire(pRtree, 1, 0, &pRoot); if( rc==SQLITE_OK && argc>0 ){ - pCsr->aConstraint = sqlite3_malloc64(sizeof(RtreeConstraint)*argc); + pCsr->aConstraint = tdsqlite3_malloc64(sizeof(RtreeConstraint)*argc); pCsr->nConstraint = argc; if( !pCsr->aConstraint ){ rc = SQLITE_NOMEM; @@ -192355,13 +192355,13 @@ static int rtreeFilter( || (idxStr && (int)strlen(idxStr)==argc*2) ); for(ii=0; iiaConstraint[ii]; - int eType = sqlite3_value_numeric_type(argv[ii]); + int eType = tdsqlite3_value_numeric_type(argv[ii]); p->op = idxStr[ii*2]; p->iCoord = idxStr[ii*2+1]-'0'; if( p->op>=RTREE_MATCH ){ /* A MATCH operator. The right-hand-side must be a blob that ** can be cast into an RtreeMatchArg object. One created using - ** an sqlite3_rtree_geometry_callback() SQL user function. + ** an tdsqlite3_rtree_geometry_callback() SQL user function. */ rc = deserializeGeometry(argv[ii], p); if( rc!=SQLITE_OK ){ @@ -192372,9 +192372,9 @@ static int rtreeFilter( p->pInfo->mxLevel = pRtree->iDepth + 1; }else if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){ #ifdef SQLITE_RTREE_INT_ONLY - p->u.rValue = sqlite3_value_int64(argv[ii]); + p->u.rValue = tdsqlite3_value_int64(argv[ii]); #else - p->u.rValue = sqlite3_value_double(argv[ii]); + p->u.rValue = tdsqlite3_value_double(argv[ii]); #endif }else{ p->u.rValue = RTREE_ZERO; @@ -192423,7 +192423,7 @@ static int rtreeFilter( ** If strategy 1 is used, then idxStr is not meaningful. If strategy ** 2 is used, idxStr is formatted to contain 2 bytes for each ** constraint used. The first two bytes of idxStr correspond to -** the constraint in sqlite3_index_info.aConstraintUsage[] with +** the constraint in tdsqlite3_index_info.aConstraintUsage[] with ** (argvIndex==1) etc. ** ** The first of each pair of bytes in idxStr identifies the constraint @@ -192443,7 +192443,7 @@ static int rtreeFilter( ** to which the constraint applies. The leftmost coordinate column ** is 'a', the second from the left 'b' etc. */ -static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ +static int rtreeBestIndex(tdsqlite3_vtab *tab, tdsqlite3_index_info *pIdxInfo){ Rtree *pRtree = (Rtree*)tab; int rc = SQLITE_OK; int ii; @@ -192466,7 +192466,7 @@ static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ assert( pIdxInfo->idxStr==0 ); for(ii=0; iinConstraint && iIdx<(int)(sizeof(zIdxStr)-1); ii++){ - struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii]; + struct tdsqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii]; if( bMatch==0 && p->usable && p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ @@ -192518,7 +192518,7 @@ static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ pIdxInfo->idxNum = 2; pIdxInfo->needToFreeIdxStr = 1; - if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){ + if( iIdx>0 && 0==(pIdxInfo->idxStr = tdsqlite3_mprintf("%s", zIdxStr)) ){ return SQLITE_NOMEM; } @@ -192668,7 +192668,7 @@ static int ChooseLeaf( for(ii=0; rc==SQLITE_OK && ii<(pRtree->iDepth-iHeight); ii++){ int iCell; - sqlite3_int64 iBest = 0; + tdsqlite3_int64 iBest = 0; RtreeDValue fMinGrowth = RTREE_ZERO; RtreeDValue fMinArea = RTREE_ZERO; @@ -192700,7 +192700,7 @@ static int ChooseLeaf( } } - sqlite3_free(aCell); + tdsqlite3_free(aCell); rc = nodeAcquire(pRtree, iBest, pNode, &pChild); nodeRelease(pRtree, pNode); pNode = pChild; @@ -192746,21 +192746,21 @@ static int AdjustTree( /* ** Write mapping (iRowid->iNode) to the _rowid table. */ -static int rowidWrite(Rtree *pRtree, sqlite3_int64 iRowid, sqlite3_int64 iNode){ - sqlite3_bind_int64(pRtree->pWriteRowid, 1, iRowid); - sqlite3_bind_int64(pRtree->pWriteRowid, 2, iNode); - sqlite3_step(pRtree->pWriteRowid); - return sqlite3_reset(pRtree->pWriteRowid); +static int rowidWrite(Rtree *pRtree, tdsqlite3_int64 iRowid, tdsqlite3_int64 iNode){ + tdsqlite3_bind_int64(pRtree->pWriteRowid, 1, iRowid); + tdsqlite3_bind_int64(pRtree->pWriteRowid, 2, iNode); + tdsqlite3_step(pRtree->pWriteRowid); + return tdsqlite3_reset(pRtree->pWriteRowid); } /* ** Write mapping (iNode->iPar) to the _parent table. */ -static int parentWrite(Rtree *pRtree, sqlite3_int64 iNode, sqlite3_int64 iPar){ - sqlite3_bind_int64(pRtree->pWriteParent, 1, iNode); - sqlite3_bind_int64(pRtree->pWriteParent, 2, iPar); - sqlite3_step(pRtree->pWriteParent); - return sqlite3_reset(pRtree->pWriteParent); +static int parentWrite(Rtree *pRtree, tdsqlite3_int64 iNode, tdsqlite3_int64 iPar){ + tdsqlite3_bind_int64(pRtree->pWriteParent, 1, iNode); + tdsqlite3_bind_int64(pRtree->pWriteParent, 2, iPar); + tdsqlite3_step(pRtree->pWriteParent); + return tdsqlite3_reset(pRtree->pWriteParent); } static int rtreeInsertCell(Rtree *, RtreeNode *, RtreeCell *, int); @@ -192925,9 +192925,9 @@ static int splitNodeStartree( int iBestSplit = 0; RtreeDValue fBestMargin = RTREE_ZERO; - sqlite3_int64 nByte = (pRtree->nDim+1)*(sizeof(int*)+nCell*sizeof(int)); + tdsqlite3_int64 nByte = (pRtree->nDim+1)*(sizeof(int*)+nCell*sizeof(int)); - aaSorted = (int **)sqlite3_malloc64(nByte); + aaSorted = (int **)tdsqlite3_malloc64(nByte); if( !aaSorted ){ return SQLITE_NOMEM; } @@ -193001,7 +193001,7 @@ static int splitNodeStartree( cellUnion(pRtree, pBbox, pCell); } - sqlite3_free(aaSorted); + tdsqlite3_free(aaSorted); return SQLITE_OK; } @@ -193012,7 +193012,7 @@ static int updateMapping( RtreeNode *pNode, int iHeight ){ - int (*xSetMapping)(Rtree *, sqlite3_int64, sqlite3_int64); + int (*xSetMapping)(Rtree *, tdsqlite3_int64, tdsqlite3_int64); xSetMapping = ((iHeight==0)?rowidWrite:parentWrite); if( iHeight>0 ){ RtreeNode *pChild = nodeHashLookup(pRtree, iRowid); @@ -193048,7 +193048,7 @@ static int SplitNode( /* Allocate an array and populate it with a copy of pCell and ** all cells from node pLeft. Then zero the original node. */ - aCell = sqlite3_malloc64((sizeof(RtreeCell)+sizeof(int))*(nCell+1)); + aCell = tdsqlite3_malloc64((sizeof(RtreeCell)+sizeof(int))*(nCell+1)); if( !aCell ){ rc = SQLITE_NOMEM; goto splitnode_out; @@ -193157,7 +193157,7 @@ static int SplitNode( splitnode_out: nodeRelease(pRtree, pRight); nodeRelease(pRtree, pLeft); - sqlite3_free(aCell); + tdsqlite3_free(aCell); return rc; } @@ -193176,9 +193176,9 @@ static int fixLeafParent(Rtree *pRtree, RtreeNode *pLeaf){ int rc = SQLITE_OK; RtreeNode *pChild = pLeaf; while( rc==SQLITE_OK && pChild->iNode!=1 && pChild->pParent==0 ){ - int rc2 = SQLITE_OK; /* sqlite3_reset() return code */ - sqlite3_bind_int64(pRtree->pReadParent, 1, pChild->iNode); - rc = sqlite3_step(pRtree->pReadParent); + int rc2 = SQLITE_OK; /* tdsqlite3_reset() return code */ + tdsqlite3_bind_int64(pRtree->pReadParent, 1, pChild->iNode); + rc = tdsqlite3_step(pRtree->pReadParent); if( rc==SQLITE_ROW ){ RtreeNode *pTest; /* Used to test for reference loops */ i64 iNode; /* Node number of parent node */ @@ -193188,13 +193188,13 @@ static int fixLeafParent(Rtree *pRtree, RtreeNode *pLeaf){ ** want to do this as it leads to a memory leak when trying to delete ** the referenced counted node structures. */ - iNode = sqlite3_column_int64(pRtree->pReadParent, 0); + iNode = tdsqlite3_column_int64(pRtree->pReadParent, 0); for(pTest=pLeaf; pTest && pTest->iNode!=iNode; pTest=pTest->pParent); if( !pTest ){ rc2 = nodeAcquire(pRtree, iNode, 0, &pChild->pParent); } } - rc = sqlite3_reset(pRtree->pReadParent); + rc = tdsqlite3_reset(pRtree->pReadParent); if( rc==SQLITE_OK ) rc = rc2; if( rc==SQLITE_OK && !pChild->pParent ){ RTREE_IS_CORRUPT(pRtree); @@ -193231,16 +193231,16 @@ static int removeNode(Rtree *pRtree, RtreeNode *pNode, int iHeight){ } /* Remove the xxx_node entry. */ - sqlite3_bind_int64(pRtree->pDeleteNode, 1, pNode->iNode); - sqlite3_step(pRtree->pDeleteNode); - if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteNode)) ){ + tdsqlite3_bind_int64(pRtree->pDeleteNode, 1, pNode->iNode); + tdsqlite3_step(pRtree->pDeleteNode); + if( SQLITE_OK!=(rc = tdsqlite3_reset(pRtree->pDeleteNode)) ){ return rc; } /* Remove the xxx_parent entry. */ - sqlite3_bind_int64(pRtree->pDeleteParent, 1, pNode->iNode); - sqlite3_step(pRtree->pDeleteParent); - if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteParent)) ){ + tdsqlite3_bind_int64(pRtree->pDeleteParent, 1, pNode->iNode); + tdsqlite3_step(pRtree->pDeleteParent); + if( SQLITE_OK!=(rc = tdsqlite3_reset(pRtree->pDeleteParent)) ){ return rc; } @@ -193339,7 +193339,7 @@ static int Reinsert( /* Allocate the buffers used by this operation. The allocation is ** relinquished before this function returns. */ - aCell = (RtreeCell *)sqlite3_malloc64(n * ( + aCell = (RtreeCell *)tdsqlite3_malloc64(n * ( sizeof(RtreeCell) + /* aCell array */ sizeof(int) + /* aOrder array */ sizeof(int) + /* aSpare array */ @@ -193411,7 +193411,7 @@ static int Reinsert( } } - sqlite3_free(aCell); + tdsqlite3_free(aCell); return rc; } @@ -193485,18 +193485,18 @@ static int reinsertNodeContent(Rtree *pRtree, RtreeNode *pNode){ */ static int rtreeNewRowid(Rtree *pRtree, i64 *piRowid){ int rc; - sqlite3_bind_null(pRtree->pWriteRowid, 1); - sqlite3_bind_null(pRtree->pWriteRowid, 2); - sqlite3_step(pRtree->pWriteRowid); - rc = sqlite3_reset(pRtree->pWriteRowid); - *piRowid = sqlite3_last_insert_rowid(pRtree->db); + tdsqlite3_bind_null(pRtree->pWriteRowid, 1); + tdsqlite3_bind_null(pRtree->pWriteRowid, 2); + tdsqlite3_step(pRtree->pWriteRowid); + rc = tdsqlite3_reset(pRtree->pWriteRowid); + *piRowid = tdsqlite3_last_insert_rowid(pRtree->db); return rc; } /* ** Remove the entry with rowid=iDelete from the r-tree structure. */ -static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){ +static int rtreeDeleteRowid(Rtree *pRtree, tdsqlite3_int64 iDelete){ int rc; /* Return code */ RtreeNode *pLeaf = 0; /* Leaf node containing record iDelete */ int iCell; /* Index of iDelete cell in pLeaf */ @@ -193532,9 +193532,9 @@ static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){ /* Delete the corresponding entry in the _rowid table. */ if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pRtree->pDeleteRowid, 1, iDelete); - sqlite3_step(pRtree->pDeleteRowid); - rc = sqlite3_reset(pRtree->pDeleteRowid); + tdsqlite3_bind_int64(pRtree->pDeleteRowid, 1, iDelete); + tdsqlite3_step(pRtree->pDeleteRowid); + rc = tdsqlite3_reset(pRtree->pDeleteRowid); } /* Check if the root node now has exactly one child. If so, remove @@ -193569,7 +193569,7 @@ static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){ } pRtree->pDeleted = pLeaf->pNext; pRtree->nNodeRef--; - sqlite3_free(pLeaf); + tdsqlite3_free(pLeaf); } /* Release the reference to the root node. */ @@ -193590,19 +193590,19 @@ static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){ #if !defined(SQLITE_RTREE_INT_ONLY) /* -** Convert an sqlite3_value into an RtreeValue (presumably a float) +** Convert an tdsqlite3_value into an RtreeValue (presumably a float) ** while taking care to round toward negative or positive, respectively. */ -static RtreeValue rtreeValueDown(sqlite3_value *v){ - double d = sqlite3_value_double(v); +static RtreeValue rtreeValueDown(tdsqlite3_value *v){ + double d = tdsqlite3_value_double(v); float f = (float)d; if( f>d ){ f = (float)(d*(d<0 ? RNDAWAY : RNDTOWARDS)); } return f; } -static RtreeValue rtreeValueUp(sqlite3_value *v){ - double d = sqlite3_value_double(v); +static RtreeValue rtreeValueUp(tdsqlite3_value *v){ + double d = tdsqlite3_value_double(v); float f = (float)d; if( fzDb, pRtree->zName); + zSql = tdsqlite3_mprintf("SELECT * FROM %Q.%Q", pRtree->zDb, pRtree->zName); if( zSql ){ - rc = sqlite3_prepare_v2(pRtree->db, zSql, -1, &pStmt, 0); + rc = tdsqlite3_prepare_v2(pRtree->db, zSql, -1, &pStmt, 0); }else{ rc = SQLITE_NOMEM; } - sqlite3_free(zSql); + tdsqlite3_free(zSql); if( rc==SQLITE_OK ){ if( iCol==0 ){ - const char *zCol = sqlite3_column_name(pStmt, 0); - pRtree->base.zErrMsg = sqlite3_mprintf( + const char *zCol = tdsqlite3_column_name(pStmt, 0); + pRtree->base.zErrMsg = tdsqlite3_mprintf( "UNIQUE constraint failed: %s.%s", pRtree->zName, zCol ); }else{ - const char *zCol1 = sqlite3_column_name(pStmt, iCol); - const char *zCol2 = sqlite3_column_name(pStmt, iCol+1); - pRtree->base.zErrMsg = sqlite3_mprintf( + const char *zCol1 = tdsqlite3_column_name(pStmt, iCol); + const char *zCol2 = tdsqlite3_column_name(pStmt, iCol+1); + pRtree->base.zErrMsg = tdsqlite3_mprintf( "rtree constraint failed: %s.(%s<=%s)", pRtree->zName, zCol1, zCol2 ); } } - sqlite3_finalize(pStmt); + tdsqlite3_finalize(pStmt); return (rc==SQLITE_OK ? SQLITE_CONSTRAINT : rc); } @@ -193663,9 +193663,9 @@ static int rtreeConstraintError(Rtree *pRtree, int iCol){ ** The xUpdate method for rtree module virtual tables. */ static int rtreeUpdate( - sqlite3_vtab *pVtab, + tdsqlite3_vtab *pVtab, int nData, - sqlite3_value **aData, + tdsqlite3_value **aData, sqlite_int64 *pRowid ){ Rtree *pRtree = (Rtree *)pVtab; @@ -193723,8 +193723,8 @@ static int rtreeUpdate( #endif { for(ii=0; iicell.aCoord[ii+1].i ){ rc = rtreeConstraintError(pRtree, ii+1); goto constraint; @@ -193734,17 +193734,17 @@ static int rtreeUpdate( /* If a rowid value was supplied, check if it is already present in ** the table. If so, the constraint has failed. */ - if( sqlite3_value_type(aData[2])!=SQLITE_NULL ){ - cell.iRowid = sqlite3_value_int64(aData[2]); - if( sqlite3_value_type(aData[0])==SQLITE_NULL - || sqlite3_value_int64(aData[0])!=cell.iRowid + if( tdsqlite3_value_type(aData[2])!=SQLITE_NULL ){ + cell.iRowid = tdsqlite3_value_int64(aData[2]); + if( tdsqlite3_value_type(aData[0])==SQLITE_NULL + || tdsqlite3_value_int64(aData[0])!=cell.iRowid ){ int steprc; - sqlite3_bind_int64(pRtree->pReadRowid, 1, cell.iRowid); - steprc = sqlite3_step(pRtree->pReadRowid); - rc = sqlite3_reset(pRtree->pReadRowid); + tdsqlite3_bind_int64(pRtree->pReadRowid, 1, cell.iRowid); + steprc = tdsqlite3_step(pRtree->pReadRowid); + rc = tdsqlite3_reset(pRtree->pReadRowid); if( SQLITE_ROW==steprc ){ - if( sqlite3_vtab_on_conflict(pRtree->db)==SQLITE_REPLACE ){ + if( tdsqlite3_vtab_on_conflict(pRtree->db)==SQLITE_REPLACE ){ rc = rtreeDeleteRowid(pRtree, cell.iRowid); }else{ rc = rtreeConstraintError(pRtree, 0); @@ -193760,8 +193760,8 @@ static int rtreeUpdate( ** record to delete from the r-tree table. The following block does ** just that. */ - if( sqlite3_value_type(aData[0])!=SQLITE_NULL ){ - rc = rtreeDeleteRowid(pRtree, sqlite3_value_int64(aData[0])); + if( tdsqlite3_value_type(aData[0])!=SQLITE_NULL ){ + rc = rtreeDeleteRowid(pRtree, tdsqlite3_value_int64(aData[0])); } /* If the aData[] array contains more than one element, elements @@ -193791,14 +193791,14 @@ static int rtreeUpdate( } } if( rc==SQLITE_OK && pRtree->nAux ){ - sqlite3_stmt *pUp = pRtree->pWriteAux; + tdsqlite3_stmt *pUp = pRtree->pWriteAux; int jj; - sqlite3_bind_int64(pUp, 1, *pRowid); + tdsqlite3_bind_int64(pUp, 1, *pRowid); for(jj=0; jjnAux; jj++){ - sqlite3_bind_value(pUp, jj+2, aData[pRtree->nDim2+3+jj]); + tdsqlite3_bind_value(pUp, jj+2, aData[pRtree->nDim2+3+jj]); } - sqlite3_step(pUp); - rc = sqlite3_reset(pUp); + tdsqlite3_step(pUp); + rc = tdsqlite3_reset(pUp); } } @@ -193810,7 +193810,7 @@ constraint: /* ** Called when a transaction starts. */ -static int rtreeBeginTransaction(sqlite3_vtab *pVtab){ +static int rtreeBeginTransaction(tdsqlite3_vtab *pVtab){ Rtree *pRtree = (Rtree *)pVtab; assert( pRtree->inWrTrans==0 ); pRtree->inWrTrans++; @@ -193819,9 +193819,9 @@ static int rtreeBeginTransaction(sqlite3_vtab *pVtab){ /* ** Called when a transaction completes (either by COMMIT or ROLLBACK). -** The sqlite3_blob object should be released at this point. +** The tdsqlite3_blob object should be released at this point. */ -static int rtreeEndTransaction(sqlite3_vtab *pVtab){ +static int rtreeEndTransaction(tdsqlite3_vtab *pVtab){ Rtree *pRtree = (Rtree *)pVtab; pRtree->inWrTrans = 0; nodeBlobReset(pRtree); @@ -193831,10 +193831,10 @@ static int rtreeEndTransaction(sqlite3_vtab *pVtab){ /* ** The xRename method for rtree module virtual tables. */ -static int rtreeRename(sqlite3_vtab *pVtab, const char *zNewName){ +static int rtreeRename(tdsqlite3_vtab *pVtab, const char *zNewName){ Rtree *pRtree = (Rtree *)pVtab; int rc = SQLITE_NOMEM; - char *zSql = sqlite3_mprintf( + char *zSql = tdsqlite3_mprintf( "ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";" "ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";" "ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";" @@ -193844,8 +193844,8 @@ static int rtreeRename(sqlite3_vtab *pVtab, const char *zNewName){ ); if( zSql ){ nodeBlobReset(pRtree); - rc = sqlite3_exec(pRtree->db, zSql, 0, 0, 0); - sqlite3_free(zSql); + rc = tdsqlite3_exec(pRtree->db, zSql, 0, 0, 0); + tdsqlite3_free(zSql); } return rc; } @@ -193864,7 +193864,7 @@ static int rtreeRename(sqlite3_vtab *pVtab, const char *zNewName){ ** DROP TABLE ; -- Would fail with SQLITE_LOCKED ** COMMIT; */ -static int rtreeSavepoint(sqlite3_vtab *pVtab, int iSavepoint){ +static int rtreeSavepoint(tdsqlite3_vtab *pVtab, int iSavepoint){ Rtree *pRtree = (Rtree *)pVtab; u8 iwt = pRtree->inWrTrans; UNUSED_PARAMETER(iSavepoint); @@ -193879,28 +193879,28 @@ static int rtreeSavepoint(sqlite3_vtab *pVtab, int iSavepoint){ ** of the number of rows in the virtual table. If possible, this is based ** on sqlite_stat1 data. Otherwise, use RTREE_DEFAULT_ROWEST. */ -static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){ +static int rtreeQueryStat1(tdsqlite3 *db, Rtree *pRtree){ const char *zFmt = "SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'"; char *zSql; - sqlite3_stmt *p; + tdsqlite3_stmt *p; int rc; i64 nRow = 0; - rc = sqlite3_table_column_metadata( + rc = tdsqlite3_table_column_metadata( db, pRtree->zDb, "sqlite_stat1",0,0,0,0,0,0 ); if( rc!=SQLITE_OK ){ pRtree->nRowEst = RTREE_DEFAULT_ROWEST; return rc==SQLITE_ERROR ? SQLITE_OK : rc; } - zSql = sqlite3_mprintf(zFmt, pRtree->zDb, pRtree->zName); + zSql = tdsqlite3_mprintf(zFmt, pRtree->zDb, pRtree->zName); if( zSql==0 ){ rc = SQLITE_NOMEM; }else{ - rc = sqlite3_prepare_v2(db, zSql, -1, &p, 0); + rc = tdsqlite3_prepare_v2(db, zSql, -1, &p, 0); if( rc==SQLITE_OK ){ - if( sqlite3_step(p)==SQLITE_ROW ) nRow = sqlite3_column_int64(p, 0); - rc = sqlite3_finalize(p); + if( tdsqlite3_step(p)==SQLITE_ROW ) nRow = tdsqlite3_column_int64(p, 0); + rc = tdsqlite3_finalize(p); }else if( rc!=SQLITE_NOMEM ){ rc = SQLITE_OK; } @@ -193912,7 +193912,7 @@ static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){ pRtree->nRowEst = MAX(nRow, RTREE_MIN_ROWEST); } } - sqlite3_free(zSql); + tdsqlite3_free(zSql); } return rc; @@ -193929,12 +193929,12 @@ static int rtreeShadowName(const char *zName){ }; unsigned int i; for(i=0; inAux; ii++){ - sqlite3_str_appendf(p,",a%d",ii); + tdsqlite3_str_appendf(p,",a%d",ii); } - sqlite3_str_appendf(p, + tdsqlite3_str_appendf(p, ");CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);", zDb, zPrefix); - sqlite3_str_appendf(p, + tdsqlite3_str_appendf(p, "CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);", zDb, zPrefix); - sqlite3_str_appendf(p, + tdsqlite3_str_appendf(p, "INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))", zDb, zPrefix, pRtree->iNodeSize); - zCreate = sqlite3_str_finish(p); + zCreate = tdsqlite3_str_finish(p); if( !zCreate ){ return SQLITE_NOMEM; } - rc = sqlite3_exec(db, zCreate, 0, 0, 0); - sqlite3_free(zCreate); + rc = tdsqlite3_exec(db, zCreate, 0, 0, 0); + tdsqlite3_free(zCreate); if( rc!=SQLITE_OK ){ return rc; } @@ -194043,40 +194043,40 @@ static int rtreeSqlInit( zFormat = "INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)" "ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno"; } - zSql = sqlite3_mprintf(zFormat, zDb, zPrefix); + zSql = tdsqlite3_mprintf(zFormat, zDb, zPrefix); if( zSql ){ - rc = sqlite3_prepare_v3(db, zSql, -1, f, appStmt[i], 0); + rc = tdsqlite3_prepare_v3(db, zSql, -1, f, appStmt[i], 0); }else{ rc = SQLITE_NOMEM; } - sqlite3_free(zSql); + tdsqlite3_free(zSql); } if( pRtree->nAux ){ - pRtree->zReadAuxSql = sqlite3_mprintf( + pRtree->zReadAuxSql = tdsqlite3_mprintf( "SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1", zDb, zPrefix); if( pRtree->zReadAuxSql==0 ){ rc = SQLITE_NOMEM; }else{ - sqlite3_str *p = sqlite3_str_new(db); + tdsqlite3_str *p = tdsqlite3_str_new(db); int ii; char *zSql; - sqlite3_str_appendf(p, "UPDATE \"%w\".\"%w_rowid\"SET ", zDb, zPrefix); + tdsqlite3_str_appendf(p, "UPDATE \"%w\".\"%w_rowid\"SET ", zDb, zPrefix); for(ii=0; iinAux; ii++){ - if( ii ) sqlite3_str_append(p, ",", 1); + if( ii ) tdsqlite3_str_append(p, ",", 1); if( iinAuxNotNull ){ - sqlite3_str_appendf(p,"a%d=coalesce(?%d,a%d)",ii,ii+2,ii); + tdsqlite3_str_appendf(p,"a%d=coalesce(?%d,a%d)",ii,ii+2,ii); }else{ - sqlite3_str_appendf(p,"a%d=?%d",ii,ii+2); + tdsqlite3_str_appendf(p,"a%d=?%d",ii,ii+2); } } - sqlite3_str_appendf(p, " WHERE rowid=?1"); - zSql = sqlite3_str_finish(p); + tdsqlite3_str_appendf(p, " WHERE rowid=?1"); + zSql = tdsqlite3_str_finish(p); if( zSql==0 ){ rc = SQLITE_NOMEM; }else{ - rc = sqlite3_prepare_v3(db, zSql, -1, f, &pRtree->pWriteAux, 0); - sqlite3_free(zSql); + rc = tdsqlite3_prepare_v3(db, zSql, -1, f, &pRtree->pWriteAux, 0); + tdsqlite3_free(zSql); } } } @@ -194091,16 +194091,16 @@ static int rtreeSqlInit( ** is written to *piVal and SQLITE_OK returned. Otherwise, an SQLite error ** code is returned and the value of *piVal after returning is not defined. */ -static int getIntFromStmt(sqlite3 *db, const char *zSql, int *piVal){ +static int getIntFromStmt(tdsqlite3 *db, const char *zSql, int *piVal){ int rc = SQLITE_NOMEM; if( zSql ){ - sqlite3_stmt *pStmt = 0; - rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); + tdsqlite3_stmt *pStmt = 0; + rc = tdsqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); if( rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - *piVal = sqlite3_column_int(pStmt, 0); + if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + *piVal = tdsqlite3_column_int(pStmt, 0); } - rc = sqlite3_finalize(pStmt); + rc = tdsqlite3_finalize(pStmt); } } return rc; @@ -194122,7 +194122,7 @@ static int getIntFromStmt(sqlite3 *db, const char *zSql, int *piVal){ ** would fit in a single node, use a smaller node-size. */ static int getNodeSize( - sqlite3 *db, /* Database handle */ + tdsqlite3 *db, /* Database handle */ Rtree *pRtree, /* Rtree handle */ int isCreate, /* True for xCreate, false for xConnect */ char **pzErr /* OUT: Error message, if any */ @@ -194131,7 +194131,7 @@ static int getNodeSize( char *zSql; if( isCreate ){ int iPageSize = 0; - zSql = sqlite3_mprintf("PRAGMA %Q.page_size", pRtree->zDb); + zSql = tdsqlite3_mprintf("PRAGMA %Q.page_size", pRtree->zDb); rc = getIntFromStmt(db, zSql, &iPageSize); if( rc==SQLITE_OK ){ pRtree->iNodeSize = iPageSize-64; @@ -194139,25 +194139,25 @@ static int getNodeSize( pRtree->iNodeSize = 4+pRtree->nBytesPerCell*RTREE_MAXCELLS; } }else{ - *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db)); + *pzErr = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(db)); } }else{ - zSql = sqlite3_mprintf( + zSql = tdsqlite3_mprintf( "SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1", pRtree->zDb, pRtree->zName ); rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize); if( rc!=SQLITE_OK ){ - *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db)); + *pzErr = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(db)); }else if( pRtree->iNodeSize<(512-64) ){ rc = SQLITE_CORRUPT_VTAB; RTREE_IS_CORRUPT(pRtree); - *pzErr = sqlite3_mprintf("undersize RTree blobs in \"%q_node\"", + *pzErr = tdsqlite3_mprintf("undersize RTree blobs in \"%q_node\"", pRtree->zName); } } - sqlite3_free(zSql); + tdsqlite3_free(zSql); return rc; } @@ -194166,7 +194166,7 @@ static int getNodeSize( */ static int rtreeTokenLength(const char *z){ int dummy = 0; - return sqlite3GetToken((const unsigned char*)z,&dummy); + return tdsqlite3GetToken((const unsigned char*)z,&dummy); } /* @@ -194179,10 +194179,10 @@ static int rtreeTokenLength(const char *z){ ** argv[...] -> column names... */ static int rtreeInit( - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ void *pAux, /* One of the RTREE_COORD_* constants */ int argc, const char *const*argv, /* Parameters to CREATE TABLE statement */ - sqlite3_vtab **ppVtab, /* OUT: New virtual table */ + tdsqlite3_vtab **ppVtab, /* OUT: New virtual table */ char **pzErr, /* OUT: Error message, if any */ int isCreate /* True for xCreate, false for xConnect */ ){ @@ -194191,7 +194191,7 @@ static int rtreeInit( int nDb; /* Length of string argv[1] */ int nName; /* Length of string argv[2] */ int eCoordType = (pAux ? RTREE_COORD_INT32 : RTREE_COORD_REAL32); - sqlite3_str *pSql; + tdsqlite3_str *pSql; char *zSql; int ii = 4; int iErr; @@ -194206,16 +194206,16 @@ static int rtreeInit( assert( RTREE_MAX_AUX_COLUMN<256 ); /* Aux columns counted by a u8 */ if( argc<6 || argc>RTREE_MAX_AUX_COLUMN+3 ){ - *pzErr = sqlite3_mprintf("%s", aErrMsg[2 + (argc>=6)]); + *pzErr = tdsqlite3_mprintf("%s", aErrMsg[2 + (argc>=6)]); return SQLITE_ERROR; } - sqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); + tdsqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); - /* Allocate the sqlite3_vtab structure */ + /* Allocate the tdsqlite3_vtab structure */ nDb = (int)strlen(argv[1]); nName = (int)strlen(argv[2]); - pRtree = (Rtree *)sqlite3_malloc64(sizeof(Rtree)+nDb+nName+2); + pRtree = (Rtree *)tdsqlite3_malloc64(sizeof(Rtree)+nDb+nName+2); if( !pRtree ){ return SQLITE_NOMEM; } @@ -194230,35 +194230,35 @@ static int rtreeInit( /* Create/Connect to the underlying relational database schema. If - ** that is successful, call sqlite3_declare_vtab() to configure + ** that is successful, call tdsqlite3_declare_vtab() to configure ** the r-tree table schema. */ - pSql = sqlite3_str_new(db); - sqlite3_str_appendf(pSql, "CREATE TABLE x(%.*s INT", + pSql = tdsqlite3_str_new(db); + tdsqlite3_str_appendf(pSql, "CREATE TABLE x(%.*s INT", rtreeTokenLength(argv[3]), argv[3]); for(ii=4; iinAux++; - sqlite3_str_appendf(pSql, ",%.*s", rtreeTokenLength(zArg+1), zArg+1); + tdsqlite3_str_appendf(pSql, ",%.*s", rtreeTokenLength(zArg+1), zArg+1); }else if( pRtree->nAux>0 ){ break; }else{ pRtree->nDim2++; - sqlite3_str_appendf(pSql, ",%.*s NUM", rtreeTokenLength(zArg), zArg); + tdsqlite3_str_appendf(pSql, ",%.*s NUM", rtreeTokenLength(zArg), zArg); } } - sqlite3_str_appendf(pSql, ");"); - zSql = sqlite3_str_finish(pSql); + tdsqlite3_str_appendf(pSql, ");"); + zSql = tdsqlite3_str_finish(pSql); if( !zSql ){ rc = SQLITE_NOMEM; }else if( iinDim = pRtree->nDim2/2; if( pRtree->nDim<1 ){ @@ -194271,7 +194271,7 @@ static int rtreeInit( iErr = 0; } if( iErr ){ - *pzErr = sqlite3_mprintf("%s", aErrMsg[iErr]); + *pzErr = tdsqlite3_mprintf("%s", aErrMsg[iErr]); goto rtreeInit_fail; } pRtree->nBytesPerCell = 8 + pRtree->nDim2*4; @@ -194281,11 +194281,11 @@ static int rtreeInit( if( rc ) goto rtreeInit_fail; rc = rtreeSqlInit(pRtree, db, argv[1], argv[2], isCreate); if( rc ){ - *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db)); + *pzErr = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(db)); goto rtreeInit_fail; } - *ppVtab = (sqlite3_vtab *)pRtree; + *ppVtab = (tdsqlite3_vtab *)pRtree; return SQLITE_OK; rtreeInit_fail: @@ -194313,46 +194313,46 @@ rtreeInit_fail: ** list, containing the 8-byte rowid/pageno followed by the ** *2 coordinates. */ -static void rtreenode(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){ +static void rtreenode(tdsqlite3_context *ctx, int nArg, tdsqlite3_value **apArg){ RtreeNode node; Rtree tree; int ii; int nData; int errCode; - sqlite3_str *pOut; + tdsqlite3_str *pOut; UNUSED_PARAMETER(nArg); memset(&node, 0, sizeof(RtreeNode)); memset(&tree, 0, sizeof(Rtree)); - tree.nDim = (u8)sqlite3_value_int(apArg[0]); + tree.nDim = (u8)tdsqlite3_value_int(apArg[0]); if( tree.nDim<1 || tree.nDim>5 ) return; tree.nDim2 = tree.nDim*2; tree.nBytesPerCell = 8 + 8 * tree.nDim; - node.zData = (u8 *)sqlite3_value_blob(apArg[1]); - nData = sqlite3_value_bytes(apArg[1]); + node.zData = (u8 *)tdsqlite3_value_blob(apArg[1]); + nData = tdsqlite3_value_bytes(apArg[1]); if( nData<4 ) return; if( nData0 ) sqlite3_str_append(pOut, " ", 1); - sqlite3_str_appendf(pOut, "{%lld", cell.iRowid); + if( ii>0 ) tdsqlite3_str_append(pOut, " ", 1); + tdsqlite3_str_appendf(pOut, "{%lld", cell.iRowid); for(jj=0; jjrc==SQLITE_OK ) pCheck->rc = rc; } @@ -194415,26 +194415,26 @@ static void rtreeCheckReset(RtreeCheck *pCheck, sqlite3_stmt *pStmt){ ** If successful, a pointer to the new SQL statement is returned. Otherwise, ** NULL is returned and an error code left in RtreeCheck.rc. */ -static sqlite3_stmt *rtreeCheckPrepare( +static tdsqlite3_stmt *rtreeCheckPrepare( RtreeCheck *pCheck, /* RtreeCheck object */ const char *zFmt, ... /* Format string and trailing args */ ){ va_list ap; char *z; - sqlite3_stmt *pRet = 0; + tdsqlite3_stmt *pRet = 0; va_start(ap, zFmt); - z = sqlite3_vmprintf(zFmt, ap); + z = tdsqlite3_vmprintf(zFmt, ap); if( pCheck->rc==SQLITE_OK ){ if( z==0 ){ pCheck->rc = SQLITE_NOMEM; }else{ - pCheck->rc = sqlite3_prepare_v2(pCheck->db, z, -1, &pRet, 0); + pCheck->rc = tdsqlite3_prepare_v2(pCheck->db, z, -1, &pRet, 0); } } - sqlite3_free(z); + tdsqlite3_free(z); va_end(ap); return pRet; } @@ -194448,11 +194448,11 @@ static void rtreeCheckAppendMsg(RtreeCheck *pCheck, const char *zFmt, ...){ va_list ap; va_start(ap, zFmt); if( pCheck->rc==SQLITE_OK && pCheck->nErrrc = SQLITE_NOMEM; }else{ - pCheck->zReport = sqlite3_mprintf("%z%s%z", + pCheck->zReport = tdsqlite3_mprintf("%z%s%z", pCheck->zReport, (pCheck->zReport ? "\n" : ""), z ); if( pCheck->zReport==0 ){ @@ -194470,7 +194470,7 @@ static void rtreeCheckAppendMsg(RtreeCheck *pCheck, const char *zFmt, ...){ ** returned in this case. ** ** Otherwise, the contents of rtree table node iNode are loaded from -** the database and copied into a buffer obtained from sqlite3_malloc(). +** the database and copied into a buffer obtained from tdsqlite3_malloc(). ** If no error occurs, a pointer to the buffer is returned and (*pnNode) ** is set to the size of the buffer in bytes. ** @@ -194489,11 +194489,11 @@ static u8 *rtreeCheckGetNode(RtreeCheck *pCheck, i64 iNode, int *pnNode){ } if( pCheck->rc==SQLITE_OK ){ - sqlite3_bind_int64(pCheck->pGetNode, 1, iNode); - if( sqlite3_step(pCheck->pGetNode)==SQLITE_ROW ){ - int nNode = sqlite3_column_bytes(pCheck->pGetNode, 0); - const u8 *pNode = (const u8*)sqlite3_column_blob(pCheck->pGetNode, 0); - pRet = sqlite3_malloc64(nNode); + tdsqlite3_bind_int64(pCheck->pGetNode, 1, iNode); + if( tdsqlite3_step(pCheck->pGetNode)==SQLITE_ROW ){ + int nNode = tdsqlite3_column_bytes(pCheck->pGetNode, 0); + const u8 *pNode = (const u8*)tdsqlite3_column_blob(pCheck->pGetNode, 0); + pRet = tdsqlite3_malloc64(nNode); if( pRet==0 ){ pCheck->rc = SQLITE_NOMEM; }else{ @@ -194529,7 +194529,7 @@ static void rtreeCheckMapping( i64 iVal /* Expected value for mapping */ ){ int rc; - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; const char *azSql[2] = { "SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1", "SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1" @@ -194544,14 +194544,14 @@ static void rtreeCheckMapping( if( pCheck->rc!=SQLITE_OK ) return; pStmt = pCheck->aCheckMapping[bLeaf]; - sqlite3_bind_int64(pStmt, 1, iKey); - rc = sqlite3_step(pStmt); + tdsqlite3_bind_int64(pStmt, 1, iKey); + rc = tdsqlite3_step(pStmt); if( rc==SQLITE_DONE ){ rtreeCheckAppendMsg(pCheck, "Mapping (%lld -> %lld) missing from %s table", iKey, iVal, (bLeaf ? "%_rowid" : "%_parent") ); }else if( rc==SQLITE_ROW ){ - i64 ii = sqlite3_column_int64(pStmt, 0); + i64 ii = tdsqlite3_column_int64(pStmt, 0); if( ii!=iVal ){ rtreeCheckAppendMsg(pCheck, "Found (%lld -> %lld) in %s table, expected (%lld -> %lld)", @@ -194645,7 +194645,7 @@ static void rtreeCheckNode( iDepth = readInt16(aNode); if( iDepth>RTREE_MAX_DEPTH ){ rtreeCheckAppendMsg(pCheck, "Rtree depth out of range (%d)", iDepth); - sqlite3_free(aNode); + tdsqlite3_free(aNode); return; } } @@ -194672,7 +194672,7 @@ static void rtreeCheckNode( } } } - sqlite3_free(aNode); + tdsqlite3_free(aNode); } } @@ -194685,20 +194685,20 @@ static void rtreeCheckNode( */ static void rtreeCheckCount(RtreeCheck *pCheck, const char *zTbl, i64 nExpect){ if( pCheck->rc==SQLITE_OK ){ - sqlite3_stmt *pCount; + tdsqlite3_stmt *pCount; pCount = rtreeCheckPrepare(pCheck, "SELECT count(*) FROM %Q.'%q%s'", pCheck->zDb, pCheck->zTab, zTbl ); if( pCount ){ - if( sqlite3_step(pCount)==SQLITE_ROW ){ - i64 nActual = sqlite3_column_int64(pCount, 0); + if( tdsqlite3_step(pCount)==SQLITE_ROW ){ + i64 nActual = tdsqlite3_column_int64(pCount, 0); if( nActual!=nExpect ){ rtreeCheckAppendMsg(pCheck, "Wrong number of entries in %%%s table" " - expected %lld, actual %lld" , zTbl, nExpect, nActual ); } } - pCheck->rc = sqlite3_finalize(pCount); + pCheck->rc = tdsqlite3_finalize(pCount); } } } @@ -194708,13 +194708,13 @@ static void rtreeCheckCount(RtreeCheck *pCheck, const char *zTbl, i64 nExpect){ ** It is called by rtreecheck(), which is the SQL function implementation. */ static int rtreeCheckTable( - sqlite3 *db, /* Database handle to access db through */ + tdsqlite3 *db, /* Database handle to access db through */ const char *zDb, /* Name of db ("main", "temp" etc.) */ const char *zTab, /* Name of rtree table to check */ - char **pzReport /* OUT: sqlite3_malloc'd report text */ + char **pzReport /* OUT: tdsqlite3_malloc'd report text */ ){ RtreeCheck check; /* Common context for various routines */ - sqlite3_stmt *pStmt = 0; /* Used to find column count of rtree table */ + tdsqlite3_stmt *pStmt = 0; /* Used to find column count of rtree table */ int bEnd = 0; /* True if transaction should be closed */ int nAux = 0; /* Number of extra columns. */ @@ -194727,8 +194727,8 @@ static int rtreeCheckTable( /* If there is not already an open transaction, open one now. This is ** to ensure that the queries run as part of this integrity-check operate ** on a consistent snapshot. */ - if( sqlite3_get_autocommit(db) ){ - check.rc = sqlite3_exec(db, "BEGIN", 0, 0, 0); + if( tdsqlite3_get_autocommit(db) ){ + check.rc = tdsqlite3_exec(db, "BEGIN", 0, 0, 0); bEnd = 1; } @@ -194736,8 +194736,8 @@ static int rtreeCheckTable( if( check.rc==SQLITE_OK ){ pStmt = rtreeCheckPrepare(&check, "SELECT * FROM %Q.'%q_rowid'", zDb, zTab); if( pStmt ){ - nAux = sqlite3_column_count(pStmt) - 2; - sqlite3_finalize(pStmt); + nAux = tdsqlite3_column_count(pStmt) - 2; + tdsqlite3_finalize(pStmt); } check.rc = SQLITE_OK; } @@ -194746,13 +194746,13 @@ static int rtreeCheckTable( pStmt = rtreeCheckPrepare(&check, "SELECT * FROM %Q.%Q", zDb, zTab); if( pStmt ){ int rc; - check.nDim = (sqlite3_column_count(pStmt) - 1 - nAux) / 2; + check.nDim = (tdsqlite3_column_count(pStmt) - 1 - nAux) / 2; if( check.nDim<1 ){ rtreeCheckAppendMsg(&check, "Schema corrupt or not an rtree"); - }else if( SQLITE_ROW==sqlite3_step(pStmt) ){ - check.bInt = (sqlite3_column_type(pStmt, 1)==SQLITE_INTEGER); + }else if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + check.bInt = (tdsqlite3_column_type(pStmt, 1)==SQLITE_INTEGER); } - rc = sqlite3_finalize(pStmt); + rc = tdsqlite3_finalize(pStmt); if( rc!=SQLITE_CORRUPT ) check.rc = rc; } @@ -194766,13 +194766,13 @@ static int rtreeCheckTable( } /* Finalize SQL statements used by the integrity-check */ - sqlite3_finalize(check.pGetNode); - sqlite3_finalize(check.aCheckMapping[0]); - sqlite3_finalize(check.aCheckMapping[1]); + tdsqlite3_finalize(check.pGetNode); + tdsqlite3_finalize(check.aCheckMapping[0]); + tdsqlite3_finalize(check.aCheckMapping[1]); /* If one was opened, close the transaction */ if( bEnd ){ - int rc = sqlite3_exec(db, "END", 0, 0, 0); + int rc = tdsqlite3_exec(db, "END", 0, 0, 0); if( check.rc==SQLITE_OK ) check.rc = rc; } *pzReport = check.zReport; @@ -194813,32 +194813,32 @@ static int rtreeCheckTable( ** %_parent table. */ static void rtreecheck( - sqlite3_context *ctx, + tdsqlite3_context *ctx, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ if( nArg!=1 && nArg!=2 ){ - sqlite3_result_error(ctx, + tdsqlite3_result_error(ctx, "wrong number of arguments to function rtreecheck()", -1 ); }else{ int rc; char *zReport = 0; - const char *zDb = (const char*)sqlite3_value_text(apArg[0]); + const char *zDb = (const char*)tdsqlite3_value_text(apArg[0]); const char *zTab; if( nArg==1 ){ zTab = zDb; zDb = "main"; }else{ - zTab = (const char*)sqlite3_value_text(apArg[1]); + zTab = (const char*)tdsqlite3_value_text(apArg[1]); } - rc = rtreeCheckTable(sqlite3_context_db_handle(ctx), zDb, zTab, &zReport); + rc = rtreeCheckTable(tdsqlite3_context_db_handle(ctx), zDb, zTab, &zReport); if( rc==SQLITE_OK ){ - sqlite3_result_text(ctx, zReport ? zReport : "ok", -1, SQLITE_TRANSIENT); + tdsqlite3_result_text(ctx, zReport ? zReport : "ok", -1, SQLITE_TRANSIENT); }else{ - sqlite3_result_error_code(ctx, rc); + tdsqlite3_result_error_code(ctx, rc); } - sqlite3_free(zReport); + tdsqlite3_free(zReport); } } @@ -194879,12 +194879,12 @@ static void rtreecheck( ** Versions of isspace(), isalnum() and isdigit() to which it is safe ** to pass signed char values. */ -#ifdef sqlite3Isdigit +#ifdef tdsqlite3Isdigit /* Use the SQLite core versions if this routine is part of the ** SQLite amalgamation */ -# define safe_isdigit(x) sqlite3Isdigit(x) -# define safe_isalnum(x) sqlite3Isalnum(x) -# define safe_isxdigit(x) sqlite3Isxdigit(x) +# define safe_isdigit(x) tdsqlite3Isdigit(x) +# define safe_isalnum(x) tdsqlite3Isalnum(x) +# define safe_isxdigit(x) tdsqlite3Isxdigit(x) #else /* Use the standard library for separate compilation */ #include /* amalgamator: keep */ @@ -194989,7 +194989,7 @@ struct GeoParse { int nVertex; /* Number of vertexes in a[] */ int nAlloc; /* Space allocated to a[] */ int nErr; /* Number of errors encountered */ - GeoCoord *a; /* Array of vertexes. From sqlite3_malloc64() */ + GeoCoord *a; /* Array of vertexes. From tdsqlite3_malloc64() */ }; /* Do a 4-byte byte swap */ @@ -195048,10 +195048,10 @@ static int geopolyParseNumber(GeoParse *p, GeoCoord *pVal){ if( z[j-1]<'0' ) return 0; if( pVal ){ #ifdef SQLITE_AMALGAMATION - /* The sqlite3AtoF() routine is much much faster than atof(), if it + /* The tdsqlite3AtoF() routine is much much faster than atof(), if it ** is available */ double r; - (void)sqlite3AtoF((const char*)p->z, &r, j, SQLITE_UTF8); + (void)tdsqlite3AtoF((const char*)p->z, &r, j, SQLITE_UTF8); *pVal = r; #else *pVal = (GeoCoord)atof((const char*)p->z); @@ -195083,7 +195083,7 @@ static GeoPoly *geopolyParseJson(const unsigned char *z, int *pRc){ if( s.nVertex>=s.nAlloc ){ GeoCoord *aNew; s.nAlloc = s.nAlloc*2 + 16; - aNew = sqlite3_realloc64(s.a, s.nAlloc*sizeof(GeoCoord)*2 ); + aNew = tdsqlite3_realloc64(s.a, s.nAlloc*sizeof(GeoCoord)*2 ); if( aNew==0 ){ rc = SQLITE_NOMEM; s.nErr++; @@ -195117,7 +195117,7 @@ static GeoPoly *geopolyParseJson(const unsigned char *z, int *pRc){ GeoPoly *pOut; int x = 1; s.nVertex--; /* Remove the redundant vertex at the end */ - pOut = sqlite3_malloc64( GEOPOLY_SZ((sqlite3_int64)s.nVertex) ); + pOut = tdsqlite3_malloc64( GEOPOLY_SZ((tdsqlite3_int64)s.nVertex) ); x = 1; if( pOut==0 ) goto parse_json_err; pOut->nVertex = s.nVertex; @@ -195126,7 +195126,7 @@ static GeoPoly *geopolyParseJson(const unsigned char *z, int *pRc){ pOut->hdr[1] = (s.nVertex>>16)&0xff; pOut->hdr[2] = (s.nVertex>>8)&0xff; pOut->hdr[3] = s.nVertex&0xff; - sqlite3_free(s.a); + tdsqlite3_free(s.a); if( pRc ) *pRc = SQLITE_OK; return pOut; }else{ @@ -195136,7 +195136,7 @@ static GeoPoly *geopolyParseJson(const unsigned char *z, int *pRc){ } parse_json_err: if( pRc ) *pRc = rc; - sqlite3_free(s.a); + tdsqlite3_free(s.a); return 0; } @@ -195144,28 +195144,28 @@ parse_json_err: ** Given a function parameter, try to interpret it as a polygon, either ** in the binary format or JSON text. Compute a GeoPoly object and ** return a pointer to that object. Or if the input is not a well-formed -** polygon, put an error message in sqlite3_context and return NULL. +** polygon, put an error message in tdsqlite3_context and return NULL. */ static GeoPoly *geopolyFuncParam( - sqlite3_context *pCtx, /* Context for error messages */ - sqlite3_value *pVal, /* The value to decode */ + tdsqlite3_context *pCtx, /* Context for error messages */ + tdsqlite3_value *pVal, /* The value to decode */ int *pRc /* Write error here */ ){ GeoPoly *p = 0; int nByte; - if( sqlite3_value_type(pVal)==SQLITE_BLOB - && (nByte = sqlite3_value_bytes(pVal))>=(4+6*sizeof(GeoCoord)) + if( tdsqlite3_value_type(pVal)==SQLITE_BLOB + && (nByte = tdsqlite3_value_bytes(pVal))>=(4+6*sizeof(GeoCoord)) ){ - const unsigned char *a = sqlite3_value_blob(pVal); + const unsigned char *a = tdsqlite3_value_blob(pVal); int nVertex; nVertex = (a[1]<<16) + (a[2]<<8) + a[3]; if( (a[0]==0 || a[0]==1) && (nVertex*2*sizeof(GeoCoord) + 4)==(unsigned int)nByte ){ - p = sqlite3_malloc64( sizeof(*p) + (nVertex-1)*2*sizeof(GeoCoord) ); + p = tdsqlite3_malloc64( sizeof(*p) + (nVertex-1)*2*sizeof(GeoCoord) ); if( p==0 ){ if( pRc ) *pRc = SQLITE_NOMEM; - if( pCtx ) sqlite3_result_error_nomem(pCtx); + if( pCtx ) tdsqlite3_result_error_nomem(pCtx); }else{ int x = 1; p->nVertex = nVertex; @@ -195182,8 +195182,8 @@ static GeoPoly *geopolyFuncParam( } if( pRc ) *pRc = SQLITE_OK; return p; - }else if( sqlite3_value_type(pVal)==SQLITE_TEXT ){ - const unsigned char *zJson = sqlite3_value_text(pVal); + }else if( tdsqlite3_value_type(pVal)==SQLITE_TEXT ){ + const unsigned char *zJson = tdsqlite3_value_text(pVal); if( zJson==0 ){ if( pRc ) *pRc = SQLITE_NOMEM; return 0; @@ -195203,15 +195203,15 @@ static GeoPoly *geopolyFuncParam( ** return NULL. */ static void geopolyBlobFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ GeoPoly *p = geopolyFuncParam(context, argv[0], 0); if( p ){ - sqlite3_result_blob(context, p->hdr, + tdsqlite3_result_blob(context, p->hdr, 4+8*p->nVertex, SQLITE_TRANSIENT); - sqlite3_free(p); + tdsqlite3_free(p); } } @@ -195222,22 +195222,22 @@ static void geopolyBlobFunc( ** of coordinates. Or, if X is not a valid polygon, return NULL. */ static void geopolyJsonFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ GeoPoly *p = geopolyFuncParam(context, argv[0], 0); if( p ){ - sqlite3 *db = sqlite3_context_db_handle(context); - sqlite3_str *x = sqlite3_str_new(db); + tdsqlite3 *db = tdsqlite3_context_db_handle(context); + tdsqlite3_str *x = tdsqlite3_str_new(db); int i; - sqlite3_str_append(x, "[", 1); + tdsqlite3_str_append(x, "[", 1); for(i=0; inVertex; i++){ - sqlite3_str_appendf(x, "[%!g,%!g],", GeoX(p,i), GeoY(p,i)); + tdsqlite3_str_appendf(x, "[%!g,%!g],", GeoX(p,i), GeoY(p,i)); } - sqlite3_str_appendf(x, "[%!g,%!g]]", GeoX(p,0), GeoY(p,0)); - sqlite3_result_text(context, sqlite3_str_finish(x), -1, sqlite3_free); - sqlite3_free(p); + tdsqlite3_str_appendf(x, "[%!g,%!g]]", GeoX(p,0), GeoY(p,0)); + tdsqlite3_result_text(context, tdsqlite3_str_finish(x), -1, tdsqlite3_free); + tdsqlite3_free(p); } } @@ -195248,33 +195248,33 @@ static void geopolyJsonFunc( ** Additional arguments are added as attributes to the . */ static void geopolySvgFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ GeoPoly *p; if( argc<1 ) return; p = geopolyFuncParam(context, argv[0], 0); if( p ){ - sqlite3 *db = sqlite3_context_db_handle(context); - sqlite3_str *x = sqlite3_str_new(db); + tdsqlite3 *db = tdsqlite3_context_db_handle(context); + tdsqlite3_str *x = tdsqlite3_str_new(db); int i; char cSep = '\''; - sqlite3_str_appendf(x, ""); - sqlite3_result_text(context, sqlite3_str_finish(x), -1, sqlite3_free); - sqlite3_free(p); + tdsqlite3_str_appendf(x, ">"); + tdsqlite3_result_text(context, tdsqlite3_str_finish(x), -1, tdsqlite3_free); + tdsqlite3_free(p); } } @@ -195295,17 +195295,17 @@ static void geopolySvgFunc( ** geopoly_xform(poly, cos(R), sin(R), -sin(R), cos(R), 0, 0) */ static void geopolyXformFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ GeoPoly *p = geopolyFuncParam(context, argv[0], 0); - double A = sqlite3_value_double(argv[1]); - double B = sqlite3_value_double(argv[2]); - double C = sqlite3_value_double(argv[3]); - double D = sqlite3_value_double(argv[4]); - double E = sqlite3_value_double(argv[5]); - double F = sqlite3_value_double(argv[6]); + double A = tdsqlite3_value_double(argv[1]); + double B = tdsqlite3_value_double(argv[2]); + double C = tdsqlite3_value_double(argv[3]); + double D = tdsqlite3_value_double(argv[4]); + double E = tdsqlite3_value_double(argv[5]); + double F = tdsqlite3_value_double(argv[6]); GeoCoord x1, y1, x0, y0; int ii; if( p ){ @@ -195317,9 +195317,9 @@ static void geopolyXformFunc( GeoX(p,ii) = x1; GeoY(p,ii) = y1; } - sqlite3_result_blob(context, p->hdr, + tdsqlite3_result_blob(context, p->hdr, 4+8*p->nVertex, SQLITE_TRANSIENT); - sqlite3_free(p); + tdsqlite3_free(p); } } @@ -195353,14 +195353,14 @@ static double geopolyArea(GeoPoly *p){ ** enclosed area. Otherwise return NULL. */ static void geopolyAreaFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ GeoPoly *p = geopolyFuncParam(context, argv[0], 0); if( p ){ - sqlite3_result_double(context, geopolyArea(p)); - sqlite3_free(p); + tdsqlite3_result_double(context, geopolyArea(p)); + tdsqlite3_free(p); } } @@ -195378,9 +195378,9 @@ static void geopolyAreaFunc( ** contain polygons that wind in the wrong direction. */ static void geopolyCcwFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ GeoPoly *p = geopolyFuncParam(context, argv[0], 0); if( p ){ @@ -195395,9 +195395,9 @@ static void geopolyCcwFunc( GeoY(p,jj) = t; } } - sqlite3_result_blob(context, p->hdr, + tdsqlite3_result_blob(context, p->hdr, 4+8*p->nVertex, SQLITE_TRANSIENT); - sqlite3_free(p); + tdsqlite3_free(p); } } @@ -195427,22 +195427,22 @@ static double geopolySine(double r){ ** with circumradius R and with N sides. */ static void geopolyRegularFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ - double x = sqlite3_value_double(argv[0]); - double y = sqlite3_value_double(argv[1]); - double r = sqlite3_value_double(argv[2]); - int n = sqlite3_value_int(argv[3]); + double x = tdsqlite3_value_double(argv[0]); + double y = tdsqlite3_value_double(argv[1]); + double r = tdsqlite3_value_double(argv[2]); + int n = tdsqlite3_value_int(argv[3]); int i; GeoPoly *p; if( n<3 || r<=0.0 ) return; if( n>1000 ) n = 1000; - p = sqlite3_malloc64( sizeof(*p) + (n-1)*2*sizeof(GeoCoord) ); + p = tdsqlite3_malloc64( sizeof(*p) + (n-1)*2*sizeof(GeoCoord) ); if( p==0 ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); return; } i = 1; @@ -195455,8 +195455,8 @@ static void geopolyRegularFunc( GeoX(p,i) = x - r*geopolySine(rAngle-0.5*GEOPOLY_PI); GeoY(p,i) = y + r*geopolySine(rAngle); } - sqlite3_result_blob(context, p->hdr, 4+8*n, SQLITE_TRANSIENT); - sqlite3_free(p); + tdsqlite3_result_blob(context, p->hdr, 4+8*n, SQLITE_TRANSIENT); + tdsqlite3_free(p); } /* @@ -195470,8 +195470,8 @@ static void geopolyRegularFunc( ** the bounding box in aCoord and return a pointer to that GeoPoly. */ static GeoPoly *geopolyBBox( - sqlite3_context *context, /* For recording the error */ - sqlite3_value *pPoly, /* The polygon */ + tdsqlite3_context *context, /* For recording the error */ + tdsqlite3_value *pPoly, /* The polygon */ RtreeCoord *aCoord, /* Results here */ int *pRc /* Error code here */ ){ @@ -195503,10 +195503,10 @@ static GeoPoly *geopolyBBox( if( pRc ) *pRc = SQLITE_OK; if( aCoord==0 ){ geopolyBboxFill: - pOut = sqlite3_realloc64(p, GEOPOLY_SZ(4)); + pOut = tdsqlite3_realloc64(p, GEOPOLY_SZ(4)); if( pOut==0 ){ - sqlite3_free(p); - if( context ) sqlite3_result_error_nomem(context); + tdsqlite3_free(p); + if( context ) tdsqlite3_result_error_nomem(context); if( pRc ) *pRc = SQLITE_NOMEM; return 0; } @@ -195525,7 +195525,7 @@ static GeoPoly *geopolyBBox( GeoX(pOut,3) = mnX; GeoY(pOut,3) = mxY; }else{ - sqlite3_free(p); + tdsqlite3_free(p); aCoord[0].f = mnX; aCoord[1].f = mxX; aCoord[2].f = mnY; @@ -195539,15 +195539,15 @@ static GeoPoly *geopolyBBox( ** Implementation of the geopoly_bbox(X) SQL function. */ static void geopolyBBoxFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ GeoPoly *p = geopolyBBox(context, argv[0], 0, 0); if( p ){ - sqlite3_result_blob(context, p->hdr, + tdsqlite3_result_blob(context, p->hdr, 4+8*p->nVertex, SQLITE_TRANSIENT); - sqlite3_free(p); + tdsqlite3_free(p); } } @@ -195565,16 +195565,16 @@ struct GeoBBox { ** Implementation of the geopoly_group_bbox(X) aggregate SQL function. */ static void geopolyBBoxStep( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ RtreeCoord a[4]; int rc = SQLITE_OK; (void)geopolyBBox(context, argv[0], a, &rc); if( rc==SQLITE_OK ){ GeoBBox *pBBox; - pBBox = (GeoBBox*)sqlite3_aggregate_context(context, sizeof(*pBBox)); + pBBox = (GeoBBox*)tdsqlite3_aggregate_context(context, sizeof(*pBBox)); if( pBBox==0 ) return; if( pBBox->isInit==0 ){ pBBox->isInit = 1; @@ -195588,17 +195588,17 @@ static void geopolyBBoxStep( } } static void geopolyBBoxFinal( - sqlite3_context *context + tdsqlite3_context *context ){ GeoPoly *p; GeoBBox *pBBox; - pBBox = (GeoBBox*)sqlite3_aggregate_context(context, 0); + pBBox = (GeoBBox*)tdsqlite3_aggregate_context(context, 0); if( pBBox==0 ) return; p = geopolyBBox(context, 0, pBBox->a, 0); if( p ){ - sqlite3_result_blob(context, p->hdr, + tdsqlite3_result_blob(context, p->hdr, 4+8*p->nVertex, SQLITE_TRANSIENT); - sqlite3_free(p); + tdsqlite3_free(p); } } @@ -195649,13 +195649,13 @@ static int pointBeneathLine( ** Return 0 if point X,Y is outside the polygon */ static void geopolyContainsPointFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ GeoPoly *p1 = geopolyFuncParam(context, argv[0], 0); - double x0 = sqlite3_value_double(argv[1]); - double y0 = sqlite3_value_double(argv[2]); + double x0 = tdsqlite3_value_double(argv[1]); + double y0 = tdsqlite3_value_double(argv[2]); int v = 0; int cnt = 0; int ii; @@ -195671,13 +195671,13 @@ static void geopolyContainsPointFunc( GeoX(p1,0), GeoY(p1,0)); } if( v==2 ){ - sqlite3_result_int(context, 1); + tdsqlite3_result_int(context, 1); }else if( ((v+cnt)&1)==0 ){ - sqlite3_result_int(context, 0); + tdsqlite3_result_int(context, 0); }else{ - sqlite3_result_int(context, 2); + tdsqlite3_result_int(context, 2); } - sqlite3_free(p1); + tdsqlite3_free(p1); } /* Forward declaration */ @@ -195692,22 +195692,22 @@ static int geopolyOverlap(GeoPoly *p1, GeoPoly *p2); ** */ static void geopolyWithinFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ GeoPoly *p1 = geopolyFuncParam(context, argv[0], 0); GeoPoly *p2 = geopolyFuncParam(context, argv[1], 0); if( p1 && p2 ){ int x = geopolyOverlap(p1, p2); if( x<0 ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); }else{ - sqlite3_result_int(context, x==2 ? 1 : x==4 ? 2 : 0); + tdsqlite3_result_int(context, x==2 ? 1 : x==4 ? 2 : 0); } } - sqlite3_free(p1); - sqlite3_free(p2); + tdsqlite3_free(p1); + tdsqlite3_free(p2); } /* Objects used by the overlap algorihm. */ @@ -195899,9 +195899,9 @@ static GeoSegment *geopolySortSegmentsByYAndC(GeoSegment *pList){ ** Determine the overlap between two polygons */ static int geopolyOverlap(GeoPoly *p1, GeoPoly *p2){ - sqlite3_int64 nVertex = p1->nVertex + p2->nVertex + 2; + tdsqlite3_int64 nVertex = p1->nVertex + p2->nVertex + 2; GeoOverlap *p; - sqlite3_int64 nByte; + tdsqlite3_int64 nByte; GeoEvent *pThisEvent; double rX; int rc = 0; @@ -195913,7 +195913,7 @@ static int geopolyOverlap(GeoPoly *p1, GeoPoly *p2){ nByte = sizeof(GeoEvent)*nVertex*2 + sizeof(GeoSegment)*nVertex + sizeof(GeoOverlap); - p = sqlite3_malloc64( nByte ); + p = tdsqlite3_malloc64( nByte ); if( p==0 ) return -1; p->aEvent = (GeoEvent*)&p[1]; p->aSegment = (GeoSegment*)&p->aEvent[nVertex*2]; @@ -196005,7 +196005,7 @@ static int geopolyOverlap(GeoPoly *p1, GeoPoly *p2){ } geopolyOverlapDone: - sqlite3_free(p); + tdsqlite3_free(p); return rc; } @@ -196022,34 +196022,34 @@ geopolyOverlapDone: ** NULL Either P1 or P2 or both are not valid polygons */ static void geopolyOverlapFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ GeoPoly *p1 = geopolyFuncParam(context, argv[0], 0); GeoPoly *p2 = geopolyFuncParam(context, argv[1], 0); if( p1 && p2 ){ int x = geopolyOverlap(p1, p2); if( x<0 ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); }else{ - sqlite3_result_int(context, x); + tdsqlite3_result_int(context, x); } } - sqlite3_free(p1); - sqlite3_free(p2); + tdsqlite3_free(p1); + tdsqlite3_free(p2); } /* ** Enable or disable debugging output */ static void geopolyDebugFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ #ifdef GEOPOLY_ENABLE_DEBUG - geo_debug = sqlite3_value_int(argv[0]); + geo_debug = tdsqlite3_value_int(argv[0]); #endif } @@ -196063,27 +196063,27 @@ static void geopolyDebugFunc( ** argv[...] -> column names... */ static int geopolyInit( - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ void *pAux, /* One of the RTREE_COORD_* constants */ int argc, const char *const*argv, /* Parameters to CREATE TABLE statement */ - sqlite3_vtab **ppVtab, /* OUT: New virtual table */ + tdsqlite3_vtab **ppVtab, /* OUT: New virtual table */ char **pzErr, /* OUT: Error message, if any */ int isCreate /* True for xCreate, false for xConnect */ ){ int rc = SQLITE_OK; Rtree *pRtree; - sqlite3_int64 nDb; /* Length of string argv[1] */ - sqlite3_int64 nName; /* Length of string argv[2] */ - sqlite3_str *pSql; + tdsqlite3_int64 nDb; /* Length of string argv[1] */ + tdsqlite3_int64 nName; /* Length of string argv[2] */ + tdsqlite3_str *pSql; char *zSql; int ii; - sqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); + tdsqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); - /* Allocate the sqlite3_vtab structure */ + /* Allocate the tdsqlite3_vtab structure */ nDb = strlen(argv[1]); nName = strlen(argv[2]); - pRtree = (Rtree *)sqlite3_malloc64(sizeof(Rtree)+nDb+nName+2); + pRtree = (Rtree *)tdsqlite3_malloc64(sizeof(Rtree)+nDb+nName+2); if( !pRtree ){ return SQLITE_NOMEM; } @@ -196100,25 +196100,25 @@ static int geopolyInit( /* Create/Connect to the underlying relational database schema. If - ** that is successful, call sqlite3_declare_vtab() to configure + ** that is successful, call tdsqlite3_declare_vtab() to configure ** the r-tree table schema. */ - pSql = sqlite3_str_new(db); - sqlite3_str_appendf(pSql, "CREATE TABLE x(_shape"); + pSql = tdsqlite3_str_new(db); + tdsqlite3_str_appendf(pSql, "CREATE TABLE x(_shape"); pRtree->nAux = 1; /* Add one for _shape */ pRtree->nAuxNotNull = 1; /* The _shape column is always not-null */ for(ii=3; iinAux++; - sqlite3_str_appendf(pSql, ",%s", argv[ii]); + tdsqlite3_str_appendf(pSql, ",%s", argv[ii]); } - sqlite3_str_appendf(pSql, ");"); - zSql = sqlite3_str_finish(pSql); + tdsqlite3_str_appendf(pSql, ");"); + zSql = tdsqlite3_str_finish(pSql); if( !zSql ){ rc = SQLITE_NOMEM; - }else if( SQLITE_OK!=(rc = sqlite3_declare_vtab(db, zSql)) ){ - *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db)); + }else if( SQLITE_OK!=(rc = tdsqlite3_declare_vtab(db, zSql)) ){ + *pzErr = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(db)); } - sqlite3_free(zSql); + tdsqlite3_free(zSql); if( rc ) goto geopolyInit_fail; pRtree->nBytesPerCell = 8 + pRtree->nDim2*4; @@ -196127,11 +196127,11 @@ static int geopolyInit( if( rc ) goto geopolyInit_fail; rc = rtreeSqlInit(pRtree, db, argv[1], argv[2], isCreate); if( rc ){ - *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db)); + *pzErr = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(db)); goto geopolyInit_fail; } - *ppVtab = (sqlite3_vtab *)pRtree; + *ppVtab = (tdsqlite3_vtab *)pRtree; return SQLITE_OK; geopolyInit_fail: @@ -196147,10 +196147,10 @@ geopolyInit_fail: ** GEOPOLY virtual table module xCreate method. */ static int geopolyCreate( - sqlite3 *db, + tdsqlite3 *db, void *pAux, int argc, const char *const*argv, - sqlite3_vtab **ppVtab, + tdsqlite3_vtab **ppVtab, char **pzErr ){ return geopolyInit(db, pAux, argc, argv, ppVtab, pzErr, 1); @@ -196160,10 +196160,10 @@ static int geopolyCreate( ** GEOPOLY virtual table module xConnect method. */ static int geopolyConnect( - sqlite3 *db, + tdsqlite3 *db, void *pAux, int argc, const char *const*argv, - sqlite3_vtab **ppVtab, + tdsqlite3_vtab **ppVtab, char **pzErr ){ return geopolyInit(db, pAux, argc, argv, ppVtab, pzErr, 0); @@ -196183,10 +196183,10 @@ static int geopolyConnect( ** 4 full table scan */ static int geopolyFilter( - sqlite3_vtab_cursor *pVtabCursor, /* The cursor to initialize */ + tdsqlite3_vtab_cursor *pVtabCursor, /* The cursor to initialize */ int idxNum, /* Query plan */ const char *idxStr, /* Not Used */ - int argc, sqlite3_value **argv /* Parameters to the query plan */ + int argc, tdsqlite3_value **argv /* Parameters to the query plan */ ){ Rtree *pRtree = (Rtree *)pVtabCursor->pVtab; RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor; @@ -196204,7 +196204,7 @@ static int geopolyFilter( /* Special case - lookup by rowid. */ RtreeNode *pLeaf; /* Leaf on which the required cell resides */ RtreeSearchPoint *p; /* Search point for the leaf */ - i64 iRowid = sqlite3_value_int64(argv[0]); + i64 iRowid = tdsqlite3_value_int64(argv[0]); i64 iNode = 0; rc = findLeafNode(pRtree, iRowid, &pLeaf, &iNode); if( rc==SQLITE_OK && pLeaf!=0 ){ @@ -196232,7 +196232,7 @@ static int geopolyFilter( if( rc ){ goto geopoly_filter_end; } - pCsr->aConstraint = p = sqlite3_malloc(sizeof(RtreeConstraint)*4); + pCsr->aConstraint = p = tdsqlite3_malloc(sizeof(RtreeConstraint)*4); pCsr->nConstraint = 4; if( p==0 ){ rc = SQLITE_NOMEM; @@ -196313,14 +196313,14 @@ geopoly_filter_end: ** 4 "fullscan" full-table scan. ** ------------------------------------------------ */ -static int geopolyBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ +static int geopolyBestIndex(tdsqlite3_vtab *tab, tdsqlite3_index_info *pIdxInfo){ int ii; int iRowidTerm = -1; int iFuncTerm = -1; int idxNum = 0; for(ii=0; iinConstraint; ii++){ - struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii]; + struct tdsqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii]; if( !p->usable ) continue; if( p->iColumn<0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ ){ iRowidTerm = ii; @@ -196365,7 +196365,7 @@ static int geopolyBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ /* ** GEOPOLY virtual table module xColumn method. */ -static int geopolyColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ +static int geopolyColumn(tdsqlite3_vtab_cursor *cur, tdsqlite3_context *ctx, int i){ Rtree *pRtree = (Rtree *)cur->pVtab; RtreeCursor *pCsr = (RtreeCursor *)cur; RtreeSearchPoint *p = rtreeSearchPointFirst(pCsr); @@ -196374,26 +196374,26 @@ static int geopolyColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ if( rc ) return rc; if( p==0 ) return SQLITE_OK; - if( i==0 && sqlite3_vtab_nochange(ctx) ) return SQLITE_OK; + if( i==0 && tdsqlite3_vtab_nochange(ctx) ) return SQLITE_OK; if( i<=pRtree->nAux ){ if( !pCsr->bAuxValid ){ if( pCsr->pReadAux==0 ){ - rc = sqlite3_prepare_v3(pRtree->db, pRtree->zReadAuxSql, -1, 0, + rc = tdsqlite3_prepare_v3(pRtree->db, pRtree->zReadAuxSql, -1, 0, &pCsr->pReadAux, 0); if( rc ) return rc; } - sqlite3_bind_int64(pCsr->pReadAux, 1, + tdsqlite3_bind_int64(pCsr->pReadAux, 1, nodeGetRowid(pRtree, pNode, p->iCell)); - rc = sqlite3_step(pCsr->pReadAux); + rc = tdsqlite3_step(pCsr->pReadAux); if( rc==SQLITE_ROW ){ pCsr->bAuxValid = 1; }else{ - sqlite3_reset(pCsr->pReadAux); + tdsqlite3_reset(pCsr->pReadAux); if( rc==SQLITE_DONE ) rc = SQLITE_OK; return rc; } } - sqlite3_result_value(ctx, sqlite3_column_value(pCsr->pReadAux, i+2)); + tdsqlite3_result_value(ctx, tdsqlite3_column_value(pCsr->pReadAux, i+2)); } return SQLITE_OK; } @@ -196421,9 +196421,9 @@ static int geopolyColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ ** argv[3] = new value for first application-defined column.... */ static int geopolyUpdate( - sqlite3_vtab *pVtab, + tdsqlite3_vtab *pVtab, int nData, - sqlite3_value **aData, + tdsqlite3_value **aData, sqlite_int64 *pRowid ){ Rtree *pRtree = (Rtree *)pVtab; @@ -196444,22 +196444,22 @@ static int geopolyUpdate( rtreeReference(pRtree); assert(nData>=1); - oldRowidValid = sqlite3_value_type(aData[0])!=SQLITE_NULL;; - oldRowid = oldRowidValid ? sqlite3_value_int64(aData[0]) : 0; - newRowidValid = nData>1 && sqlite3_value_type(aData[1])!=SQLITE_NULL; - newRowid = newRowidValid ? sqlite3_value_int64(aData[1]) : 0; + oldRowidValid = tdsqlite3_value_type(aData[0])!=SQLITE_NULL;; + oldRowid = oldRowidValid ? tdsqlite3_value_int64(aData[0]) : 0; + newRowidValid = nData>1 && tdsqlite3_value_type(aData[1])!=SQLITE_NULL; + newRowid = newRowidValid ? tdsqlite3_value_int64(aData[1]) : 0; cell.iRowid = newRowid; if( nData>1 /* not a DELETE */ && (!oldRowidValid /* INSERT */ - || !sqlite3_value_nochange(aData[2]) /* UPDATE _shape */ + || !tdsqlite3_value_nochange(aData[2]) /* UPDATE _shape */ || oldRowid!=newRowid) /* Rowid change */ ){ geopolyBBox(0, aData[2], cell.aCoord, &rc); if( rc ){ if( rc==SQLITE_ERROR ){ pVtab->zErrMsg = - sqlite3_mprintf("_shape does not contain a valid polygon"); + tdsqlite3_mprintf("_shape does not contain a valid polygon"); } goto geopoly_update_end; } @@ -196469,11 +196469,11 @@ static int geopolyUpdate( ** the table. If so, the constraint has failed. */ if( newRowidValid && (!oldRowidValid || oldRowid!=newRowid) ){ int steprc; - sqlite3_bind_int64(pRtree->pReadRowid, 1, cell.iRowid); - steprc = sqlite3_step(pRtree->pReadRowid); - rc = sqlite3_reset(pRtree->pReadRowid); + tdsqlite3_bind_int64(pRtree->pReadRowid, 1, cell.iRowid); + steprc = tdsqlite3_step(pRtree->pReadRowid); + rc = tdsqlite3_reset(pRtree->pReadRowid); if( SQLITE_ROW==steprc ){ - if( sqlite3_vtab_on_conflict(pRtree->db)==SQLITE_REPLACE ){ + if( tdsqlite3_vtab_on_conflict(pRtree->db)==SQLITE_REPLACE ){ rc = rtreeDeleteRowid(pRtree, cell.iRowid); }else{ rc = rtreeConstraintError(pRtree, 0); @@ -196517,33 +196517,33 @@ static int geopolyUpdate( /* Change the data */ if( rc==SQLITE_OK && nData>1 ){ - sqlite3_stmt *pUp = pRtree->pWriteAux; + tdsqlite3_stmt *pUp = pRtree->pWriteAux; int jj; int nChange = 0; - sqlite3_bind_int64(pUp, 1, cell.iRowid); + tdsqlite3_bind_int64(pUp, 1, cell.iRowid); assert( pRtree->nAux>=1 ); - if( sqlite3_value_nochange(aData[2]) ){ - sqlite3_bind_null(pUp, 2); + if( tdsqlite3_value_nochange(aData[2]) ){ + tdsqlite3_bind_null(pUp, 2); }else{ GeoPoly *p = 0; - if( sqlite3_value_type(aData[2])==SQLITE_TEXT + if( tdsqlite3_value_type(aData[2])==SQLITE_TEXT && (p = geopolyFuncParam(0, aData[2], &rc))!=0 && rc==SQLITE_OK ){ - sqlite3_bind_blob(pUp, 2, p->hdr, 4+8*p->nVertex, SQLITE_TRANSIENT); + tdsqlite3_bind_blob(pUp, 2, p->hdr, 4+8*p->nVertex, SQLITE_TRANSIENT); }else{ - sqlite3_bind_value(pUp, 2, aData[2]); + tdsqlite3_bind_value(pUp, 2, aData[2]); } - sqlite3_free(p); + tdsqlite3_free(p); nChange = 1; } for(jj=1; jjnAux; jj++){ nChange++; - sqlite3_bind_value(pUp, jj+2, aData[jj+2]); + tdsqlite3_bind_value(pUp, jj+2, aData[jj+2]); } if( nChange ){ - sqlite3_step(pUp); - rc = sqlite3_reset(pUp); + tdsqlite3_step(pUp); + rc = tdsqlite3_reset(pUp); } } @@ -196557,18 +196557,18 @@ geopoly_update_end: ** for use in xBestIndex. */ static int geopolyFindFunction( - sqlite3_vtab *pVtab, + tdsqlite3_vtab *pVtab, int nArg, const char *zName, - void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), + void (**pxFunc)(tdsqlite3_context*,int,tdsqlite3_value**), void **ppArg ){ - if( sqlite3_stricmp(zName, "geopoly_overlap")==0 ){ + if( tdsqlite3_stricmp(zName, "geopoly_overlap")==0 ){ *pxFunc = geopolyOverlapFunc; *ppArg = 0; return SQLITE_INDEX_CONSTRAINT_FUNCTION; } - if( sqlite3_stricmp(zName, "geopoly_within")==0 ){ + if( tdsqlite3_stricmp(zName, "geopoly_within")==0 ){ *pxFunc = geopolyWithinFunc; *ppArg = 0; return SQLITE_INDEX_CONSTRAINT_FUNCTION+1; @@ -196577,7 +196577,7 @@ static int geopolyFindFunction( } -static sqlite3_module geopolyModule = { +static tdsqlite3_module geopolyModule = { 3, /* iVersion */ geopolyCreate, /* xCreate - create a table */ geopolyConnect, /* xConnect - connect to an existing table */ @@ -196604,10 +196604,10 @@ static sqlite3_module geopolyModule = { rtreeShadowName /* xShadowName */ }; -static int sqlite3_geopoly_init(sqlite3 *db){ +static int tdsqlite3_geopoly_init(tdsqlite3 *db){ int rc = SQLITE_OK; static const struct { - void (*xFunc)(sqlite3_context*,int,sqlite3_value**); + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**); signed char nArg; unsigned char bPure; const char *zName; @@ -196626,8 +196626,8 @@ static int sqlite3_geopoly_init(sqlite3 *db){ { geopolyCcwFunc, 1, 1, "geopoly_ccw" }, }; static const struct { - void (*xStep)(sqlite3_context*,int,sqlite3_value**); - void (*xFinal)(sqlite3_context*); + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**); + void (*xFinal)(tdsqlite3_context*); const char *zName; } aAgg[] = { { geopolyBBoxStep, geopolyBBoxFinal, "geopoly_group_bbox" }, @@ -196640,17 +196640,17 @@ static int sqlite3_geopoly_init(sqlite3 *db){ }else{ enc = SQLITE_UTF8|SQLITE_DIRECTONLY; } - rc = sqlite3_create_function(db, aFunc[i].zName, aFunc[i].nArg, + rc = tdsqlite3_create_function(db, aFunc[i].zName, aFunc[i].nArg, enc, 0, aFunc[i].xFunc, 0, 0); } for(i=0; ixDestructor ) pInfo->xDestructor(pInfo->pContext); - sqlite3_free(p); + tdsqlite3_free(p); } /* @@ -196716,14 +196716,14 @@ static void rtreeMatchArgFree(void *pArg){ int i; RtreeMatchArg *p = (RtreeMatchArg*)pArg; for(i=0; inParam; i++){ - sqlite3_value_free(p->apSqlParam[i]); + tdsqlite3_value_free(p->apSqlParam[i]); } - sqlite3_free(p); + tdsqlite3_free(p); } /* -** Each call to sqlite3_rtree_geometry_callback() or -** sqlite3_rtree_query_callback() creates an ordinary SQLite +** Each call to tdsqlite3_rtree_geometry_callback() or +** tdsqlite3_rtree_query_callback() creates an ordinary SQLite ** scalar function that is implemented by this routine. ** ** All this function does is construct an RtreeMatchArg object that @@ -196735,37 +196735,37 @@ static void rtreeMatchArgFree(void *pArg){ ** the RtreeMatchArg object, and use the RtreeMatchArg object to figure ** out which elements of the R-Tree should be returned by the query. */ -static void geomCallback(sqlite3_context *ctx, int nArg, sqlite3_value **aArg){ - RtreeGeomCallback *pGeomCtx = (RtreeGeomCallback *)sqlite3_user_data(ctx); +static void geomCallback(tdsqlite3_context *ctx, int nArg, tdsqlite3_value **aArg){ + RtreeGeomCallback *pGeomCtx = (RtreeGeomCallback *)tdsqlite3_user_data(ctx); RtreeMatchArg *pBlob; - sqlite3_int64 nBlob; + tdsqlite3_int64 nBlob; int memErr = 0; nBlob = sizeof(RtreeMatchArg) + (nArg-1)*sizeof(RtreeDValue) - + nArg*sizeof(sqlite3_value*); - pBlob = (RtreeMatchArg *)sqlite3_malloc64(nBlob); + + nArg*sizeof(tdsqlite3_value*); + pBlob = (RtreeMatchArg *)tdsqlite3_malloc64(nBlob); if( !pBlob ){ - sqlite3_result_error_nomem(ctx); + tdsqlite3_result_error_nomem(ctx); }else{ int i; pBlob->iSize = nBlob; pBlob->cb = pGeomCtx[0]; - pBlob->apSqlParam = (sqlite3_value**)&pBlob->aParam[nArg]; + pBlob->apSqlParam = (tdsqlite3_value**)&pBlob->aParam[nArg]; pBlob->nParam = nArg; for(i=0; iapSqlParam[i] = sqlite3_value_dup(aArg[i]); + pBlob->apSqlParam[i] = tdsqlite3_value_dup(aArg[i]); if( pBlob->apSqlParam[i]==0 ) memErr = 1; #ifdef SQLITE_RTREE_INT_ONLY - pBlob->aParam[i] = sqlite3_value_int64(aArg[i]); + pBlob->aParam[i] = tdsqlite3_value_int64(aArg[i]); #else - pBlob->aParam[i] = sqlite3_value_double(aArg[i]); + pBlob->aParam[i] = tdsqlite3_value_double(aArg[i]); #endif } if( memErr ){ - sqlite3_result_error_nomem(ctx); + tdsqlite3_result_error_nomem(ctx); rtreeMatchArgFree(pBlob); }else{ - sqlite3_result_pointer(ctx, pBlob, "RtreeMatchArg", rtreeMatchArgFree); + tdsqlite3_result_pointer(ctx, pBlob, "RtreeMatchArg", rtreeMatchArgFree); } } } @@ -196773,22 +196773,22 @@ static void geomCallback(sqlite3_context *ctx, int nArg, sqlite3_value **aArg){ /* ** Register a new geometry function for use with the r-tree MATCH operator. */ -SQLITE_API int sqlite3_rtree_geometry_callback( - sqlite3 *db, /* Register SQL function on this connection */ +SQLITE_API int tdsqlite3_rtree_geometry_callback( + tdsqlite3 *db, /* Register SQL function on this connection */ const char *zGeom, /* Name of the new SQL function */ - int (*xGeom)(sqlite3_rtree_geometry*,int,RtreeDValue*,int*), /* Callback */ + int (*xGeom)(tdsqlite3_rtree_geometry*,int,RtreeDValue*,int*), /* Callback */ void *pContext /* Extra data associated with the callback */ ){ RtreeGeomCallback *pGeomCtx; /* Context object for new user-function */ /* Allocate and populate the context object. */ - pGeomCtx = (RtreeGeomCallback *)sqlite3_malloc(sizeof(RtreeGeomCallback)); + pGeomCtx = (RtreeGeomCallback *)tdsqlite3_malloc(sizeof(RtreeGeomCallback)); if( !pGeomCtx ) return SQLITE_NOMEM; pGeomCtx->xGeom = xGeom; pGeomCtx->xQueryFunc = 0; pGeomCtx->xDestructor = 0; pGeomCtx->pContext = pContext; - return sqlite3_create_function_v2(db, zGeom, -1, SQLITE_ANY, + return tdsqlite3_create_function_v2(db, zGeom, -1, SQLITE_ANY, (void *)pGeomCtx, geomCallback, 0, 0, rtreeFreeCallback ); } @@ -196797,23 +196797,23 @@ SQLITE_API int sqlite3_rtree_geometry_callback( ** Register a new 2nd-generation geometry function for use with the ** r-tree MATCH operator. */ -SQLITE_API int sqlite3_rtree_query_callback( - sqlite3 *db, /* Register SQL function on this connection */ +SQLITE_API int tdsqlite3_rtree_query_callback( + tdsqlite3 *db, /* Register SQL function on this connection */ const char *zQueryFunc, /* Name of new SQL function */ - int (*xQueryFunc)(sqlite3_rtree_query_info*), /* Callback */ + int (*xQueryFunc)(tdsqlite3_rtree_query_info*), /* Callback */ void *pContext, /* Extra data passed into the callback */ void (*xDestructor)(void*) /* Destructor for the extra data */ ){ RtreeGeomCallback *pGeomCtx; /* Context object for new user-function */ /* Allocate and populate the context object. */ - pGeomCtx = (RtreeGeomCallback *)sqlite3_malloc(sizeof(RtreeGeomCallback)); + pGeomCtx = (RtreeGeomCallback *)tdsqlite3_malloc(sizeof(RtreeGeomCallback)); if( !pGeomCtx ) return SQLITE_NOMEM; pGeomCtx->xGeom = 0; pGeomCtx->xQueryFunc = xQueryFunc; pGeomCtx->xDestructor = xDestructor; pGeomCtx->pContext = pContext; - return sqlite3_create_function_v2(db, zQueryFunc, -1, SQLITE_ANY, + return tdsqlite3_create_function_v2(db, zQueryFunc, -1, SQLITE_ANY, (void *)pGeomCtx, geomCallback, 0, 0, rtreeFreeCallback ); } @@ -196822,13 +196822,13 @@ SQLITE_API int sqlite3_rtree_query_callback( #ifdef _WIN32 __declspec(dllexport) #endif -SQLITE_API int sqlite3_rtree_init( - sqlite3 *db, +SQLITE_API int tdsqlite3_rtree_init( + tdsqlite3 *db, char **pzErrMsg, - const sqlite3_api_routines *pApi + const tdsqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi) - return sqlite3RtreeInit(db); + return tdsqlite3RtreeInit(db); } #endif @@ -196879,7 +196879,7 @@ SQLITE_API int sqlite3_rtree_init( /* #include */ #ifndef SQLITE_CORE -/* #include "sqlite3ext.h" */ +/* #include "tdsqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #else /* #include "sqlite3.h" */ @@ -196893,14 +196893,14 @@ SQLITE_API int sqlite3_rtree_init( ** loaded with an error message based on the following two args. */ static void icuFunctionError( - sqlite3_context *pCtx, /* SQLite scalar function context */ + tdsqlite3_context *pCtx, /* SQLite scalar function context */ const char *zName, /* Name of ICU function that failed */ UErrorCode e /* Error code returned by ICU function */ ){ char zBuf[128]; - sqlite3_snprintf(128, zBuf, "ICU error: %s(): %s", zName, u_errorName(e)); + tdsqlite3_snprintf(128, zBuf, "ICU error: %s(): %s", zName, u_errorName(e)); zBuf[127] = '\0'; - sqlite3_result_error(pCtx, zBuf, -1); + tdsqlite3_result_error(pCtx, zBuf, -1); } #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU) @@ -196914,10 +196914,10 @@ static void icuFunctionError( #endif /* -** Version of sqlite3_free() that is always a function, never a macro. +** Version of tdsqlite3_free() that is always a function, never a macro. */ static void xFree(void *p){ - sqlite3_free(p); + tdsqlite3_free(p); } /* @@ -197046,19 +197046,19 @@ static int icuLikeCompare( ** is mapped to like(B, A, E). */ static void icuLikeFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ - const unsigned char *zA = sqlite3_value_text(argv[0]); - const unsigned char *zB = sqlite3_value_text(argv[1]); + const unsigned char *zA = tdsqlite3_value_text(argv[0]); + const unsigned char *zB = tdsqlite3_value_text(argv[1]); UChar32 uEsc = 0; /* Limit the length of the LIKE or GLOB pattern to avoid problems ** of deep recursion and N*N behavior in patternCompare(). */ - if( sqlite3_value_bytes(argv[0])>SQLITE_MAX_LIKE_PATTERN_LENGTH ){ - sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1); + if( tdsqlite3_value_bytes(argv[0])>SQLITE_MAX_LIKE_PATTERN_LENGTH ){ + tdsqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1); return; } @@ -197067,26 +197067,26 @@ static void icuLikeFunc( /* The escape character string must consist of a single UTF-8 character. ** Otherwise, return an error. */ - int nE= sqlite3_value_bytes(argv[2]); - const unsigned char *zE = sqlite3_value_text(argv[2]); + int nE= tdsqlite3_value_bytes(argv[2]); + const unsigned char *zE = tdsqlite3_value_text(argv[2]); int i = 0; if( zE==0 ) return; U8_NEXT(zE, i, nE, uEsc); if( i!=nE){ - sqlite3_result_error(context, + tdsqlite3_result_error(context, "ESCAPE expression must be a single character", -1); return; } } if( zA && zB ){ - sqlite3_result_int(context, icuLikeCompare(zA, zB, uEsc)); + tdsqlite3_result_int(context, icuLikeCompare(zA, zB, uEsc)); } } /* ** Function to delete compiled regexp objects. Registered as -** a destructor function with sqlite3_set_auxdata(). +** a destructor function with tdsqlite3_set_auxdata(). */ static void icuRegexpDelete(void *p){ URegularExpression *pExpr = (URegularExpression *)p; @@ -197112,11 +197112,11 @@ static void icuRegexpDelete(void *p){ ** uregex_matches() ** uregex_close() */ -static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){ +static void icuRegexpFunc(tdsqlite3_context *p, int nArg, tdsqlite3_value **apArg){ UErrorCode status = U_ZERO_ERROR; URegularExpression *pExpr; UBool res; - const UChar *zString = sqlite3_value_text16(apArg[1]); + const UChar *zString = tdsqlite3_value_text16(apArg[1]); (void)nArg; /* Unused parameter */ @@ -197127,16 +197127,16 @@ static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){ return; } - pExpr = sqlite3_get_auxdata(p, 0); + pExpr = tdsqlite3_get_auxdata(p, 0); if( !pExpr ){ - const UChar *zPattern = sqlite3_value_text16(apArg[0]); + const UChar *zPattern = tdsqlite3_value_text16(apArg[0]); if( !zPattern ){ return; } pExpr = uregex_open(zPattern, -1, 0, 0, &status); if( U_SUCCESS(status) ){ - sqlite3_set_auxdata(p, 0, pExpr, icuRegexpDelete); + tdsqlite3_set_auxdata(p, 0, pExpr, icuRegexpDelete); }else{ assert(!pExpr); icuFunctionError(p, "uregex_open", status); @@ -197166,7 +197166,7 @@ static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){ uregex_setText(pExpr, 0, 0, &status); /* Return 1 or 0. */ - sqlite3_result_int(p, res ? 1 : 0); + tdsqlite3_result_int(p, res ? 1 : 0); } /* @@ -197195,7 +197195,7 @@ static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){ ** ** http://www.icu-project.org/userguide/posix.html#case_mappings */ -static void icuCaseFunc16(sqlite3_context *p, int nArg, sqlite3_value **apArg){ +static void icuCaseFunc16(tdsqlite3_context *p, int nArg, tdsqlite3_value **apArg){ const UChar *zInput; /* Pointer to input string */ UChar *zOutput = 0; /* Pointer to output buffer */ int nInput; /* Size of utf-16 input string in bytes */ @@ -197206,26 +197206,26 @@ static void icuCaseFunc16(sqlite3_context *p, int nArg, sqlite3_value **apArg){ const char *zLocale = 0; assert(nArg==1 || nArg==2); - bToUpper = (sqlite3_user_data(p)!=0); + bToUpper = (tdsqlite3_user_data(p)!=0); if( nArg==2 ){ - zLocale = (const char *)sqlite3_value_text(apArg[1]); + zLocale = (const char *)tdsqlite3_value_text(apArg[1]); } - zInput = sqlite3_value_text16(apArg[0]); + zInput = tdsqlite3_value_text16(apArg[0]); if( !zInput ){ return; } - nOut = nInput = sqlite3_value_bytes16(apArg[0]); + nOut = nInput = tdsqlite3_value_bytes16(apArg[0]); if( nOut==0 ){ - sqlite3_result_text16(p, "", 0, SQLITE_STATIC); + tdsqlite3_result_text16(p, "", 0, SQLITE_STATIC); return; } for(cnt=0; cnt<2; cnt++){ - UChar *zNew = sqlite3_realloc(zOutput, nOut); + UChar *zNew = tdsqlite3_realloc(zOutput, nOut); if( zNew==0 ){ - sqlite3_free(zOutput); - sqlite3_result_error_nomem(p); + tdsqlite3_free(zOutput); + tdsqlite3_result_error_nomem(p); return; } zOutput = zNew; @@ -197237,7 +197237,7 @@ static void icuCaseFunc16(sqlite3_context *p, int nArg, sqlite3_value **apArg){ } if( U_SUCCESS(status) ){ - sqlite3_result_text16(p, zOutput, nOut, xFree); + tdsqlite3_result_text16(p, zOutput, nOut, xFree); }else if( status==U_BUFFER_OVERFLOW_ERROR ){ assert( cnt==0 ); continue; @@ -197297,21 +197297,21 @@ static int icuCollationColl( ** collation sequence to create. */ static void icuLoadCollation( - sqlite3_context *p, + tdsqlite3_context *p, int nArg, - sqlite3_value **apArg + tdsqlite3_value **apArg ){ - sqlite3 *db = (sqlite3 *)sqlite3_user_data(p); + tdsqlite3 *db = (tdsqlite3 *)tdsqlite3_user_data(p); UErrorCode status = U_ZERO_ERROR; const char *zLocale; /* Locale identifier - (eg. "jp_JP") */ const char *zName; /* SQL Collation sequence name (eg. "japanese") */ UCollator *pUCollator; /* ICU library collation object */ - int rc; /* Return code from sqlite3_create_collation_x() */ + int rc; /* Return code from tdsqlite3_create_collation_x() */ assert(nArg==2); (void)nArg; /* Unused parameter */ - zLocale = (const char *)sqlite3_value_text(apArg[0]); - zName = (const char *)sqlite3_value_text(apArg[1]); + zLocale = (const char *)tdsqlite3_value_text(apArg[0]); + zName = (const char *)tdsqlite3_value_text(apArg[1]); if( !zLocale || !zName ){ return; @@ -197324,26 +197324,26 @@ static void icuLoadCollation( } assert(p); - rc = sqlite3_create_collation_v2(db, zName, SQLITE_UTF16, (void *)pUCollator, + rc = tdsqlite3_create_collation_v2(db, zName, SQLITE_UTF16, (void *)pUCollator, icuCollationColl, icuCollationDel ); if( rc!=SQLITE_OK ){ ucol_close(pUCollator); - sqlite3_result_error(p, "Error registering collation function", -1); + tdsqlite3_result_error(p, "Error registering collation function", -1); } } /* ** Register the ICU extension functions with database db. */ -SQLITE_PRIVATE int sqlite3IcuInit(sqlite3 *db){ +SQLITE_PRIVATE int tdsqlite3IcuInit(tdsqlite3 *db){ # define SQLITEICU_EXTRAFLAGS (SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS) static const struct IcuScalar { const char *zName; /* Function name */ unsigned char nArg; /* Number of arguments */ unsigned int enc; /* Optimal text encoding */ - unsigned char iContext; /* sqlite3_user_data() context */ - void (*xFunc)(sqlite3_context*,int,sqlite3_value**); + unsigned char iContext; /* tdsqlite3_user_data() context */ + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**); } scalars[] = { {"icu_load_collation",2,SQLITE_UTF8|SQLITE_DIRECTONLY,1, icuLoadCollation}, #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU) @@ -197365,7 +197365,7 @@ SQLITE_PRIVATE int sqlite3IcuInit(sqlite3 *db){ for(i=0; rc==SQLITE_OK && i<(int)(sizeof(scalars)/sizeof(scalars[0])); i++){ const struct IcuScalar *p = &scalars[i]; - rc = sqlite3_create_function( + rc = tdsqlite3_create_function( db, p->zName, p->nArg, p->enc, p->iContext ? (void*)db : (void*)0, p->xFunc, 0, 0 @@ -197379,13 +197379,13 @@ SQLITE_PRIVATE int sqlite3IcuInit(sqlite3 *db){ #ifdef _WIN32 __declspec(dllexport) #endif -SQLITE_API int sqlite3_icu_init( - sqlite3 *db, +SQLITE_API int tdsqlite3_icu_init( + tdsqlite3 *db, char **pzErrMsg, - const sqlite3_api_routines *pApi + const tdsqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi) - return sqlite3IcuInit(db); + return tdsqlite3IcuInit(db); } #endif @@ -197423,12 +197423,12 @@ typedef struct IcuTokenizer IcuTokenizer; typedef struct IcuCursor IcuCursor; struct IcuTokenizer { - sqlite3_tokenizer base; + tdsqlite3_tokenizer base; char *zLocale; }; struct IcuCursor { - sqlite3_tokenizer_cursor base; + tdsqlite3_tokenizer_cursor base; UBreakIterator *pIter; /* ICU break-iterator object */ int nChar; /* Number of UChar elements in pInput */ @@ -197447,7 +197447,7 @@ struct IcuCursor { static int icuCreate( int argc, /* Number of entries in argv[] */ const char * const *argv, /* Tokenizer creation arguments */ - sqlite3_tokenizer **ppTokenizer /* OUT: Created tokenizer */ + tdsqlite3_tokenizer **ppTokenizer /* OUT: Created tokenizer */ ){ IcuTokenizer *p; int n = 0; @@ -197455,7 +197455,7 @@ static int icuCreate( if( argc>0 ){ n = strlen(argv[0])+1; } - p = (IcuTokenizer *)sqlite3_malloc64(sizeof(IcuTokenizer)+n); + p = (IcuTokenizer *)tdsqlite3_malloc64(sizeof(IcuTokenizer)+n); if( !p ){ return SQLITE_NOMEM; } @@ -197466,7 +197466,7 @@ static int icuCreate( memcpy(p->zLocale, argv[0], n); } - *ppTokenizer = (sqlite3_tokenizer *)p; + *ppTokenizer = (tdsqlite3_tokenizer *)p; return SQLITE_OK; } @@ -197474,9 +197474,9 @@ static int icuCreate( /* ** Destroy a tokenizer */ -static int icuDestroy(sqlite3_tokenizer *pTokenizer){ +static int icuDestroy(tdsqlite3_tokenizer *pTokenizer){ IcuTokenizer *p = (IcuTokenizer *)pTokenizer; - sqlite3_free(p); + tdsqlite3_free(p); return SQLITE_OK; } @@ -197487,10 +197487,10 @@ static int icuDestroy(sqlite3_tokenizer *pTokenizer){ ** *ppCursor. */ static int icuOpen( - sqlite3_tokenizer *pTokenizer, /* The tokenizer */ + tdsqlite3_tokenizer *pTokenizer, /* The tokenizer */ const char *zInput, /* Input string */ int nInput, /* Length of zInput in bytes */ - sqlite3_tokenizer_cursor **ppCursor /* OUT: Tokenization cursor */ + tdsqlite3_tokenizer_cursor **ppCursor /* OUT: Tokenization cursor */ ){ IcuTokenizer *p = (IcuTokenizer *)pTokenizer; IcuCursor *pCsr; @@ -197512,7 +197512,7 @@ static int icuOpen( nInput = strlen(zInput); } nChar = nInput+1; - pCsr = (IcuCursor *)sqlite3_malloc64( + pCsr = (IcuCursor *)tdsqlite3_malloc64( sizeof(IcuCursor) + /* IcuCursor */ ((nChar+3)&~3) * sizeof(UChar) + /* IcuCursor.aChar[] */ (nChar+1) * sizeof(int) /* IcuCursor.aOffset[] */ @@ -197531,7 +197531,7 @@ static int icuOpen( c = u_foldCase(c, opt); U16_APPEND(pCsr->aChar, iOut, nChar, c, isError); if( isError ){ - sqlite3_free(pCsr); + tdsqlite3_free(pCsr); return SQLITE_ERROR; } pCsr->aOffset[iOut] = iInput; @@ -197545,24 +197545,24 @@ static int icuOpen( pCsr->pIter = ubrk_open(UBRK_WORD, p->zLocale, pCsr->aChar, iOut, &status); if( !U_SUCCESS(status) ){ - sqlite3_free(pCsr); + tdsqlite3_free(pCsr); return SQLITE_ERROR; } pCsr->nChar = iOut; ubrk_first(pCsr->pIter); - *ppCursor = (sqlite3_tokenizer_cursor *)pCsr; + *ppCursor = (tdsqlite3_tokenizer_cursor *)pCsr; return SQLITE_OK; } /* ** Close a tokenization cursor previously opened by a call to icuOpen(). */ -static int icuClose(sqlite3_tokenizer_cursor *pCursor){ +static int icuClose(tdsqlite3_tokenizer_cursor *pCursor){ IcuCursor *pCsr = (IcuCursor *)pCursor; ubrk_close(pCsr->pIter); - sqlite3_free(pCsr->zBuffer); - sqlite3_free(pCsr); + tdsqlite3_free(pCsr->zBuffer); + tdsqlite3_free(pCsr); return SQLITE_OK; } @@ -197570,7 +197570,7 @@ static int icuClose(sqlite3_tokenizer_cursor *pCursor){ ** Extract the next token from a tokenization cursor. */ static int icuNext( - sqlite3_tokenizer_cursor *pCursor, /* Cursor returned by simpleOpen */ + tdsqlite3_tokenizer_cursor *pCursor, /* Cursor returned by simpleOpen */ const char **ppToken, /* OUT: *ppToken is the token text */ int *pnBytes, /* OUT: Number of bytes in token */ int *piStartOffset, /* OUT: Starting offset of token */ @@ -197607,7 +197607,7 @@ static int icuNext( do { UErrorCode status = U_ZERO_ERROR; if( nByte ){ - char *zNew = sqlite3_realloc(pCsr->zBuffer, nByte); + char *zNew = tdsqlite3_realloc(pCsr->zBuffer, nByte); if( !zNew ){ return SQLITE_NOMEM; } @@ -197634,7 +197634,7 @@ static int icuNext( /* ** The set of routines that implement the simple tokenizer */ -static const sqlite3_tokenizer_module icuTokenizerModule = { +static const tdsqlite3_tokenizer_module icuTokenizerModule = { 0, /* iVersion */ icuCreate, /* xCreate */ icuDestroy, /* xCreate */ @@ -197647,8 +197647,8 @@ static const sqlite3_tokenizer_module icuTokenizerModule = { /* ** Set *ppModule to point at the implementation of the ICU tokenizer. */ -SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule( - sqlite3_tokenizer_module const**ppModule +SQLITE_PRIVATE void tdsqlite3Fts3IcuTokenizerModule( + tdsqlite3_tokenizer_module const**ppModule ){ *ppModule = &icuTokenizerModule; } @@ -197657,7 +197657,7 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule( #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ /************** End of fts3_icu.c ********************************************/ -/************** Begin file sqlite3rbu.c **************************************/ +/************** Begin file tdsqlite3rbu.c **************************************/ /* ** 2014 August 30 ** @@ -197675,7 +197675,7 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule( ** ** The RBU extension requires that the RBU update be packaged as an ** SQLite database. The tables it expects to find are described in -** sqlite3rbu.h. Essentially, for each table xyz in the target database +** tdsqlite3rbu.h. Essentially, for each table xyz in the target database ** that the user wishes to write to, a corresponding data_xyz table is ** created in the RBU database and populated with one row for each row to ** update, insert or delete from the target table. @@ -197708,7 +197708,7 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule( ** ** 3) The new *-wal file is checkpointed. This proceeds in the same way ** as a regular database checkpoint, except that a single frame is -** checkpointed each time sqlite3rbu_step() is called. If the RBU +** checkpointed each time tdsqlite3rbu_step() is called. If the RBU ** handle is closed before the entire *-wal file is checkpointed, ** the checkpoint progress is saved in the RBU database and the ** checkpoint can be resumed by another RBU client at some point in @@ -197747,8 +197747,8 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule( /* #include "sqlite3.h" */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) -/************** Include sqlite3rbu.h in the middle of sqlite3rbu.c ***********/ -/************** Begin file sqlite3rbu.h **************************************/ +/************** Include tdsqlite3rbu.h in the middle of tdsqlite3rbu.c ***********/ +/************** Begin file tdsqlite3rbu.h **************************************/ /* ** 2014 August 30 ** @@ -197972,19 +197972,19 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule( ** stored on disk to an existing target database. Essentially, the ** application: ** -** 1) Opens an RBU handle using the sqlite3rbu_open() function. +** 1) Opens an RBU handle using the tdsqlite3rbu_open() function. ** ** 2) Registers any required virtual table modules with the database -** handle returned by sqlite3rbu_db(). Also, if required, register +** handle returned by tdsqlite3rbu_db(). Also, if required, register ** the rbu_delta() implementation. ** -** 3) Calls the sqlite3rbu_step() function one or more times on -** the new handle. Each call to sqlite3rbu_step() performs a single +** 3) Calls the tdsqlite3rbu_step() function one or more times on +** the new handle. Each call to tdsqlite3rbu_step() performs a single ** b-tree operation, so thousands of calls may be required to apply ** a complete update. ** -** 4) Calls sqlite3rbu_close() to close the RBU update handle. If -** sqlite3rbu_step() has been called enough times to completely +** 4) Calls tdsqlite3rbu_close() to close the RBU update handle. If +** tdsqlite3rbu_step() has been called enough times to completely ** apply the update to the target database, then the RBU database ** is marked as fully applied. Otherwise, the state of the RBU ** update application is saved in the RBU database for later @@ -197993,7 +197993,7 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule( ** See comments below for more detail on APIs. ** ** If an update is only partially applied to the target database by the -** time sqlite3rbu_close() is called, various state information is saved +** time tdsqlite3rbu_close() is called, various state information is saved ** within the RBU database. This allows subsequent processes to automatically ** resume the RBU update from where it left off. ** @@ -198024,15 +198024,15 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule( extern "C" { #endif -typedef struct sqlite3rbu sqlite3rbu; +typedef struct tdsqlite3rbu tdsqlite3rbu; /* ** Open an RBU handle. ** ** Argument zTarget is the path to the target database. Argument zRbu is ** the path to the RBU database. Each call to this function must be matched -** by a call to sqlite3rbu_close(). When opening the databases, RBU passes -** the SQLITE_CONFIG_URI flag to sqlite3_open_v2(). So if either zTarget +** by a call to tdsqlite3rbu_close(). When opening the databases, RBU passes +** the SQLITE_CONFIG_URI flag to tdsqlite3_open_v2(). So if either zTarget ** or zRbu begin with "file:", it will be interpreted as an SQLite ** database URI, not a regular file name. ** @@ -198059,7 +198059,7 @@ typedef struct sqlite3rbu sqlite3rbu; ** not work out of the box with zipvfs. Refer to the comment describing ** the zipvfs_create_vfs() API below for details on using RBU with zipvfs. */ -SQLITE_API sqlite3rbu *sqlite3rbu_open( +SQLITE_API tdsqlite3rbu *tdsqlite3rbu_open( const char *zTarget, const char *zRbu, const char *zState @@ -198072,10 +198072,10 @@ SQLITE_API sqlite3rbu *sqlite3rbu_open( ** ** The second argument to this function identifies a database in which ** to store the state of the RBU vacuum operation if it is suspended. The -** first time sqlite3rbu_vacuum() is called, to start an RBU vacuum +** first time tdsqlite3rbu_vacuum() is called, to start an RBU vacuum ** operation, the state database should either not exist or be empty ** (contain no tables). If an RBU vacuum is suspended by calling -** sqlite3rbu_close() on the RBU handle before sqlite3rbu_step() has +** tdsqlite3rbu_close() on the RBU handle before tdsqlite3rbu_step() has ** returned SQLITE_DONE, the vacuum state is stored in the state database. ** The vacuum can be resumed by calling this function to open a new RBU ** handle specifying the same target and state databases. @@ -198092,17 +198092,17 @@ SQLITE_API sqlite3rbu *sqlite3rbu_open( ** ** This function does not delete the state database after an RBU vacuum ** is completed, even if it created it. However, if the call to -** sqlite3rbu_close() returns any value other than SQLITE_OK, the contents +** tdsqlite3rbu_close() returns any value other than SQLITE_OK, the contents ** of the state tables within the state database are zeroed. This way, -** the next call to sqlite3rbu_vacuum() opens a handle that starts a +** the next call to tdsqlite3rbu_vacuum() opens a handle that starts a ** new RBU vacuum operation. ** -** As with sqlite3rbu_open(), Zipvfs users should rever to the comment -** describing the sqlite3rbu_create_vfs() API function below for +** As with tdsqlite3rbu_open(), Zipvfs users should rever to the comment +** describing the tdsqlite3rbu_create_vfs() API function below for ** a description of the complications associated with using RBU with ** zipvfs databases. */ -SQLITE_API sqlite3rbu *sqlite3rbu_vacuum( +SQLITE_API tdsqlite3rbu *tdsqlite3rbu_vacuum( const char *zTarget, const char *zState ); @@ -198121,13 +198121,13 @@ SQLITE_API sqlite3rbu *sqlite3rbu_vacuum( ** If the temp space limit is exceeded during operation, an SQLITE_FULL ** error is returned. */ -SQLITE_API sqlite3_int64 sqlite3rbu_temp_size_limit(sqlite3rbu*, sqlite3_int64); +SQLITE_API tdsqlite3_int64 tdsqlite3rbu_temp_size_limit(tdsqlite3rbu*, tdsqlite3_int64); /* ** Return the current amount of temp file space, in bytes, currently used by ** the RBU handle passed as the only argument. */ -SQLITE_API sqlite3_int64 sqlite3rbu_temp_size(sqlite3rbu*); +SQLITE_API tdsqlite3_int64 tdsqlite3rbu_temp_size(tdsqlite3rbu*); /* ** Internally, each RBU connection uses a separate SQLite database @@ -198141,26 +198141,26 @@ SQLITE_API sqlite3_int64 sqlite3rbu_temp_size(sqlite3rbu*); ** following scenarios: ** ** * If any target tables are virtual tables, it may be necessary to -** call sqlite3_create_module() on the target database handle to +** call tdsqlite3_create_module() on the target database handle to ** register the required virtual table implementations. ** ** * If the data_xxx tables in the RBU source database are virtual -** tables, the application may need to call sqlite3_create_module() on +** tables, the application may need to call tdsqlite3_create_module() on ** the rbu update db handle to any required virtual table ** implementations. ** ** * If the application uses the "rbu_delta()" feature described above, -** it must use sqlite3_create_function() or similar to register the +** it must use tdsqlite3_create_function() or similar to register the ** rbu_delta() implementation with the target database handle. ** ** If an error has occurred, either while opening or stepping the RBU object, ** this function may return NULL. The error code and message may be collected -** when sqlite3rbu_close() is called. +** when tdsqlite3rbu_close() is called. ** ** Database handles returned by this function remain valid until the next -** call to any sqlite3rbu_xxx() function other than sqlite3rbu_db(). +** call to any tdsqlite3rbu_xxx() function other than tdsqlite3rbu_db(). */ -SQLITE_API sqlite3 *sqlite3rbu_db(sqlite3rbu*, int bRbu); +SQLITE_API tdsqlite3 *tdsqlite3rbu_db(tdsqlite3rbu*, int bRbu); /* ** Do some work towards applying the RBU update to the target db. @@ -198170,11 +198170,11 @@ SQLITE_API sqlite3 *sqlite3rbu_db(sqlite3rbu*, int bRbu); ** the RBU update. If an error does occur, some other error code is ** returned. ** -** Once a call to sqlite3rbu_step() has returned a value other than +** Once a call to tdsqlite3rbu_step() has returned a value other than ** SQLITE_OK, all subsequent calls on the same RBU handle are no-ops ** that immediately return the same value. */ -SQLITE_API int sqlite3rbu_step(sqlite3rbu *pRbu); +SQLITE_API int tdsqlite3rbu_step(tdsqlite3rbu *pRbu); /* ** Force RBU to save its state to disk. @@ -198182,11 +198182,11 @@ SQLITE_API int sqlite3rbu_step(sqlite3rbu *pRbu); ** If a power failure or application crash occurs during an update, following ** system recovery RBU may resume the update from the point at which the state ** was last saved. In other words, from the most recent successful call to -** sqlite3rbu_close() or this function. +** tdsqlite3rbu_close() or this function. ** ** SQLITE_OK is returned if successful, or an SQLite error code otherwise. */ -SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *pRbu); +SQLITE_API int tdsqlite3rbu_savestate(tdsqlite3rbu *pRbu); /* ** Close an RBU handle. @@ -198195,25 +198195,25 @@ SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *pRbu); ** as fully applied. Otherwise, assuming no error has occurred, save the ** current state of the RBU update appliation to the RBU database. ** -** If an error has already occurred as part of an sqlite3rbu_step() -** or sqlite3rbu_open() call, or if one occurs within this function, an +** If an error has already occurred as part of an tdsqlite3rbu_step() +** or tdsqlite3rbu_open() call, or if one occurs within this function, an ** SQLite error code is returned. Additionally, if pzErrmsg is not NULL, ** *pzErrmsg may be set to point to a buffer containing a utf-8 formatted ** English language error message. It is the responsibility of the caller to -** eventually free any such buffer using sqlite3_free(). +** eventually free any such buffer using tdsqlite3_free(). ** ** Otherwise, if no error occurs, this function returns SQLITE_OK if the ** update has been partially applied, or SQLITE_DONE if it has been ** completely applied. */ -SQLITE_API int sqlite3rbu_close(sqlite3rbu *pRbu, char **pzErrmsg); +SQLITE_API int tdsqlite3rbu_close(tdsqlite3rbu *pRbu, char **pzErrmsg); /* ** Return the total number of key-value operations (inserts, deletes or ** updates) that have been performed on the target database since the ** current RBU update was started. */ -SQLITE_API sqlite3_int64 sqlite3rbu_progress(sqlite3rbu *pRbu); +SQLITE_API tdsqlite3_int64 tdsqlite3rbu_progress(tdsqlite3rbu *pRbu); /* ** Obtain permyriadage (permyriadage is to 10000 as percentage is to 100) @@ -198255,7 +198255,7 @@ SQLITE_API sqlite3_int64 sqlite3rbu_progress(sqlite3rbu *pRbu); ** table exists but is not correctly populated, the value of the *pnOne ** output variable during stage 1 is undefined. */ -SQLITE_API void sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int*pnTwo); +SQLITE_API void tdsqlite3rbu_bp_progress(tdsqlite3rbu *pRbu, int *pnOne, int*pnTwo); /* ** Obtain an indication as to the current stage of an RBU update or vacuum. @@ -198263,28 +198263,28 @@ SQLITE_API void sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int*pnTwo); ** defined in this file. Return values should be interpreted as follows: ** ** SQLITE_RBU_STATE_OAL: -** RBU is currently building a *-oal file. The next call to sqlite3rbu_step() +** RBU is currently building a *-oal file. The next call to tdsqlite3rbu_step() ** may either add further data to the *-oal file, or compute data that will ** be added by a subsequent call. ** ** SQLITE_RBU_STATE_MOVE: -** RBU has finished building the *-oal file. The next call to sqlite3rbu_step() +** RBU has finished building the *-oal file. The next call to tdsqlite3rbu_step() ** will move the *-oal file to the equivalent *-wal path. If the current ** operation is an RBU update, then the updated version of the database ** file will become visible to ordinary SQLite clients following the next -** call to sqlite3rbu_step(). +** call to tdsqlite3rbu_step(). ** ** SQLITE_RBU_STATE_CHECKPOINT: ** RBU is currently performing an incremental checkpoint. The next call to -** sqlite3rbu_step() will copy a page of data from the *-wal file into +** tdsqlite3rbu_step() will copy a page of data from the *-wal file into ** the target database file. ** ** SQLITE_RBU_STATE_DONE: -** The RBU operation has finished. Any subsequent calls to sqlite3rbu_step() +** The RBU operation has finished. Any subsequent calls to tdsqlite3rbu_step() ** will immediately return SQLITE_DONE. ** ** SQLITE_RBU_STATE_ERROR: -** An error has occurred. Any subsequent calls to sqlite3rbu_step() will +** An error has occurred. Any subsequent calls to tdsqlite3rbu_step() will ** immediately return the SQLite error code associated with the error. */ #define SQLITE_RBU_STATE_OAL 1 @@ -198293,7 +198293,7 @@ SQLITE_API void sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int*pnTwo); #define SQLITE_RBU_STATE_DONE 4 #define SQLITE_RBU_STATE_ERROR 5 -SQLITE_API int sqlite3rbu_state(sqlite3rbu *pRbu); +SQLITE_API int tdsqlite3rbu_state(tdsqlite3rbu *pRbu); /* ** Create an RBU VFS named zName that accesses the underlying file-system @@ -198314,19 +198314,19 @@ SQLITE_API int sqlite3rbu_state(sqlite3rbu *pRbu); ** multiplexor (error checking omitted): ** ** // Create a VFS named "multiplex" (not the default). -** sqlite3_multiplex_initialize(0, 0); +** tdsqlite3_multiplex_initialize(0, 0); ** ** // Create an rbu VFS named "rbu" that uses multiplexor. If the ** // second argument were replaced with NULL, the "rbu" VFS would ** // access the file-system via the system default VFS, bypassing the ** // multiplexor. -** sqlite3rbu_create_vfs("rbu", "multiplex"); +** tdsqlite3rbu_create_vfs("rbu", "multiplex"); ** ** // Create a zipvfs VFS named "zipvfs" that uses rbu. ** zipvfs_create_vfs_v3("zipvfs", "rbu", 0, xCompressorAlgorithmDetector); ** ** // Make zipvfs the default VFS. -** sqlite3_vfs_register(sqlite3_vfs_find("zipvfs"), 1); +** tdsqlite3_vfs_register(tdsqlite3_vfs_find("zipvfs"), 1); ** ** Because the default VFS created above includes a RBU functionality, it ** may be used by RBU clients. Attempting to use RBU with a zipvfs VFS stack @@ -198337,17 +198337,17 @@ SQLITE_API int sqlite3rbu_state(sqlite3rbu *pRbu); ** file-system via "rbu" all the time, even if it only uses RBU functionality ** occasionally. */ -SQLITE_API int sqlite3rbu_create_vfs(const char *zName, const char *zParent); +SQLITE_API int tdsqlite3rbu_create_vfs(const char *zName, const char *zParent); /* ** Deregister and destroy an RBU vfs created by an earlier call to -** sqlite3rbu_create_vfs(). +** tdsqlite3rbu_create_vfs(). ** ** VFS objects are not reference counted. If a VFS object is destroyed ** before all database handles that use it have been closed, the results ** are undefined. */ -SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName); +SQLITE_API void tdsqlite3rbu_destroy_vfs(const char *zName); #if 0 } /* end of the 'extern "C"' block */ @@ -198355,8 +198355,8 @@ SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName); #endif /* _SQLITE3RBU_H */ -/************** End of sqlite3rbu.h ******************************************/ -/************** Continuing where we left off in sqlite3rbu.c *****************/ +/************** End of tdsqlite3rbu.h ******************************************/ +/************** Continuing where we left off in tdsqlite3rbu.c *****************/ #if defined(_WIN32_WCE) /* #include "windows.h" */ @@ -198406,7 +198406,7 @@ SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName); ** table/index. ** ** RBU_STATE_PROGRESS: -** Trbul number of sqlite3rbu_step() calls made so far as part of this +** Trbul number of tdsqlite3rbu_step() calls made so far as part of this ** rbu update. ** ** RBU_STATE_CKPT: @@ -198460,7 +198460,7 @@ typedef struct RbuUpdateStmt RbuUpdateStmt; typedef unsigned int u32; typedef unsigned short u16; typedef unsigned char u8; -typedef sqlite3_int64 i64; +typedef tdsqlite3_int64 i64; #endif /* @@ -198492,7 +198492,7 @@ struct RbuState { struct RbuUpdateStmt { char *zMask; /* Copy of update mask used with pUpdate */ - sqlite3_stmt *pUpdate; /* Last update statement (or NULL) */ + tdsqlite3_stmt *pUpdate; /* Last update statement (or NULL) */ RbuUpdateStmt *pNext; }; @@ -198523,8 +198523,8 @@ struct RbuSpan { ** */ struct RbuObjIter { - sqlite3_stmt *pTblIter; /* Iterate through tables */ - sqlite3_stmt *pIdxIter; /* Index iterator */ + tdsqlite3_stmt *pTblIter; /* Iterate through tables */ + tdsqlite3_stmt *pIdxIter; /* Index iterator */ int nTblCol; /* Size of azTblCol[] array */ char **azTblCol; /* Array of unquoted target column names */ char **azTblType; /* Array of target column types */ @@ -198546,10 +198546,10 @@ struct RbuObjIter { /* Statements created by rbuObjIterPrepareAll() */ int nCol; /* Number of columns in current object */ - sqlite3_stmt *pSelect; /* Source data */ - sqlite3_stmt *pInsert; /* Statement for INSERT operations */ - sqlite3_stmt *pDelete; /* Statement for DELETE ops */ - sqlite3_stmt *pTmpInsert; /* Insert into rbu_tmp_$zDataTbl */ + tdsqlite3_stmt *pSelect; /* Source data */ + tdsqlite3_stmt *pInsert; /* Statement for INSERT operations */ + tdsqlite3_stmt *pDelete; /* Statement for DELETE ops */ + tdsqlite3_stmt *pTmpInsert; /* Insert into rbu_tmp_$zDataTbl */ int nIdxCol; RbuSpan *aIdxCol; char *zIdxSql; @@ -198577,7 +198577,7 @@ struct RbuObjIter { /* -** Within the RBU_STAGE_OAL stage, each call to sqlite3rbu_step() performs +** Within the RBU_STAGE_OAL stage, each call to tdsqlite3rbu_step() performs ** one of the following operations. */ #define RBU_INSERT 1 /* Insert on a main table b-tree */ @@ -198603,7 +198603,7 @@ struct RbuFrame { ** nPhaseOneStep: ** If the RBU database contains an rbu_count table, this value is set to ** a running estimate of the number of b-tree operations required to -** finish populating the *-oal file. This allows the sqlite3_bp_progress() +** finish populating the *-oal file. This allows the tdsqlite3_bp_progress() ** API to calculate the permyriadage progress of populating the *-oal file ** using the formula: ** @@ -198637,10 +198637,10 @@ struct RbuFrame { ** first pass of each source table. The updated nPhaseOneStep value is ** stored in the rbu_state table if the RBU update is suspended. */ -struct sqlite3rbu { +struct tdsqlite3rbu { int eStage; /* Value of RBU_STATE_STAGE field */ - sqlite3 *dbMain; /* target database handle */ - sqlite3 *dbRbu; /* rbu database handle */ + tdsqlite3 *dbMain; /* target database handle */ + tdsqlite3 *dbRbu; /* rbu database handle */ char *zTarget; /* Path to target db */ char *zRbu; /* Path to rbu db */ char *zState; /* Path to state db (or NULL if zRbu) */ @@ -198680,14 +198680,14 @@ struct sqlite3rbu { ** ** Variable pRbu is only non-NULL for automatically created RBU VFS objects. ** It is NULL for RBU VFS objects created explicitly using -** sqlite3rbu_create_vfs(). It is used to track the total amount of temp +** tdsqlite3rbu_create_vfs(). It is used to track the total amount of temp ** space used by the RBU handle. */ struct rbu_vfs { - sqlite3_vfs base; /* rbu VFS shim methods */ - sqlite3_vfs *pRealVfs; /* Underlying VFS */ - sqlite3_mutex *mutex; /* Mutex to protect pMain */ - sqlite3rbu *pRbu; /* Owner RBU object */ + tdsqlite3_vfs base; /* rbu VFS shim methods */ + tdsqlite3_vfs *pRealVfs; /* Underlying VFS */ + tdsqlite3_mutex *mutex; /* Mutex to protect pMain */ + tdsqlite3rbu *pRbu; /* Owner RBU object */ rbu_file *pMain; /* List of main db files */ rbu_file *pMainRbu; /* List of main db files with pRbu!=0 */ }; @@ -198700,10 +198700,10 @@ struct rbu_vfs { ** "sz" is set to the current size of the database file. */ struct rbu_file { - sqlite3_file base; /* sqlite3_file methods */ - sqlite3_file *pReal; /* Underlying file handle */ + tdsqlite3_file base; /* tdsqlite3_file methods */ + tdsqlite3_file *pReal; /* Underlying file handle */ rbu_vfs *pRbuVfs; /* Pointer to the rbu_vfs object */ - sqlite3rbu *pRbu; /* Pointer to rbu object (rbu target only) */ + tdsqlite3rbu *pRbu; /* Pointer to rbu object (rbu target only) */ i64 sz; /* Size of file in bytes (temp only) */ int openFlags; /* Flags this file was opened with */ @@ -198934,9 +198934,9 @@ static int rbuDeltaOutputSize(const char *zDelta, int lenDelta){ ** function returns the patched blob. */ static void rbuFossilDeltaFunc( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ const char *aDelta; int nDelta; @@ -198949,28 +198949,28 @@ static void rbuFossilDeltaFunc( assert( argc==2 ); - nOrig = sqlite3_value_bytes(argv[0]); - aOrig = (const char*)sqlite3_value_blob(argv[0]); - nDelta = sqlite3_value_bytes(argv[1]); - aDelta = (const char*)sqlite3_value_blob(argv[1]); + nOrig = tdsqlite3_value_bytes(argv[0]); + aOrig = (const char*)tdsqlite3_value_blob(argv[0]); + nDelta = tdsqlite3_value_bytes(argv[1]); + aDelta = (const char*)tdsqlite3_value_blob(argv[1]); /* Figure out the size of the output */ nOut = rbuDeltaOutputSize(aDelta, nDelta); if( nOut<0 ){ - sqlite3_result_error(context, "corrupt fossil delta", -1); + tdsqlite3_result_error(context, "corrupt fossil delta", -1); return; } - aOut = sqlite3_malloc(nOut+1); + aOut = tdsqlite3_malloc(nOut+1); if( aOut==0 ){ - sqlite3_result_error_nomem(context); + tdsqlite3_result_error_nomem(context); }else{ nOut2 = rbuDeltaApply(aOrig, nOrig, aDelta, nDelta, aOut); if( nOut2!=nOut ){ - sqlite3_free(aOut); - sqlite3_result_error(context, "corrupt fossil delta", -1); + tdsqlite3_free(aOut); + tdsqlite3_result_error(context, "corrupt fossil delta", -1); }else{ - sqlite3_result_blob(context, aOut, nOut, sqlite3_free); + tdsqlite3_result_blob(context, aOut, nOut, tdsqlite3_free); } } } @@ -198984,17 +198984,17 @@ static void rbuFossilDeltaFunc( ** Otherwise, if an error does occur, set *ppStmt to NULL and return ** an SQLite error code. Additionally, set output variable *pzErrmsg to ** point to a buffer containing an error message. It is the responsibility -** of the caller to (eventually) free this buffer using sqlite3_free(). +** of the caller to (eventually) free this buffer using tdsqlite3_free(). */ static int prepareAndCollectError( - sqlite3 *db, - sqlite3_stmt **ppStmt, + tdsqlite3 *db, + tdsqlite3_stmt **ppStmt, char **pzErrmsg, const char *zSql ){ - int rc = sqlite3_prepare_v2(db, zSql, -1, ppStmt, 0); + int rc = tdsqlite3_prepare_v2(db, zSql, -1, ppStmt, 0); if( rc!=SQLITE_OK ){ - *pzErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(db)); + *pzErrmsg = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(db)); *ppStmt = 0; } return rc; @@ -199002,23 +199002,23 @@ static int prepareAndCollectError( /* ** Reset the SQL statement passed as the first argument. Return a copy -** of the value returned by sqlite3_reset(). +** of the value returned by tdsqlite3_reset(). ** ** If an error has occurred, then set *pzErrmsg to point to a buffer ** containing an error message. It is the responsibility of the caller -** to eventually free this buffer using sqlite3_free(). +** to eventually free this buffer using tdsqlite3_free(). */ -static int resetAndCollectError(sqlite3_stmt *pStmt, char **pzErrmsg){ - int rc = sqlite3_reset(pStmt); +static int resetAndCollectError(tdsqlite3_stmt *pStmt, char **pzErrmsg){ + int rc = tdsqlite3_reset(pStmt); if( rc!=SQLITE_OK ){ - *pzErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(sqlite3_db_handle(pStmt))); + *pzErrmsg = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(tdsqlite3_db_handle(pStmt))); } return rc; } /* ** Unless it is NULL, argument zSql points to a buffer allocated using -** sqlite3_malloc containing an SQL statement. This function prepares the SQL +** tdsqlite3_malloc containing an SQL statement. This function prepares the SQL ** statement against database db and frees the buffer. If statement ** compilation is successful, *ppStmt is set to point to the new statement ** handle and SQLITE_OK is returned. @@ -199026,14 +199026,14 @@ static int resetAndCollectError(sqlite3_stmt *pStmt, char **pzErrmsg){ ** Otherwise, if an error occurs, *ppStmt is set to NULL and an error code ** returned. In this case, *pzErrmsg may also be set to point to an error ** message. It is the responsibility of the caller to free this error message -** buffer using sqlite3_free(). +** buffer using tdsqlite3_free(). ** ** If argument zSql is NULL, this function assumes that an OOM has occurred. ** In this case SQLITE_NOMEM is returned and *ppStmt set to NULL. */ static int prepareFreeAndCollectError( - sqlite3 *db, - sqlite3_stmt **ppStmt, + tdsqlite3 *db, + tdsqlite3_stmt **ppStmt, char **pzErrmsg, char *zSql ){ @@ -199044,7 +199044,7 @@ static int prepareFreeAndCollectError( *ppStmt = 0; }else{ rc = prepareAndCollectError(db, ppStmt, pzErrmsg, zSql); - sqlite3_free(zSql); + tdsqlite3_free(zSql); } return rc; } @@ -199056,10 +199056,10 @@ static int prepareFreeAndCollectError( static void rbuObjIterFreeCols(RbuObjIter *pIter){ int i; for(i=0; inTblCol; i++){ - sqlite3_free(pIter->azTblCol[i]); - sqlite3_free(pIter->azTblType[i]); + tdsqlite3_free(pIter->azTblCol[i]); + tdsqlite3_free(pIter->azTblType[i]); } - sqlite3_free(pIter->azTblCol); + tdsqlite3_free(pIter->azTblCol); pIter->azTblCol = 0; pIter->azTblType = 0; pIter->aiSrcOrder = 0; @@ -199076,19 +199076,19 @@ static void rbuObjIterFreeCols(RbuObjIter *pIter){ static void rbuObjIterClearStatements(RbuObjIter *pIter){ RbuUpdateStmt *pUp; - sqlite3_finalize(pIter->pSelect); - sqlite3_finalize(pIter->pInsert); - sqlite3_finalize(pIter->pDelete); - sqlite3_finalize(pIter->pTmpInsert); + tdsqlite3_finalize(pIter->pSelect); + tdsqlite3_finalize(pIter->pInsert); + tdsqlite3_finalize(pIter->pDelete); + tdsqlite3_finalize(pIter->pTmpInsert); pUp = pIter->pRbuUpdate; while( pUp ){ RbuUpdateStmt *pTmp = pUp->pNext; - sqlite3_finalize(pUp->pUpdate); - sqlite3_free(pUp); + tdsqlite3_finalize(pUp->pUpdate); + tdsqlite3_free(pUp); pUp = pTmp; } - sqlite3_free(pIter->aIdxCol); - sqlite3_free(pIter->zIdxSql); + tdsqlite3_free(pIter->aIdxCol); + tdsqlite3_free(pIter->zIdxSql); pIter->pSelect = 0; pIter->pInsert = 0; @@ -199107,8 +199107,8 @@ static void rbuObjIterClearStatements(RbuObjIter *pIter){ */ static void rbuObjIterFinalize(RbuObjIter *pIter){ rbuObjIterClearStatements(pIter); - sqlite3_finalize(pIter->pTblIter); - sqlite3_finalize(pIter->pIdxIter); + tdsqlite3_finalize(pIter->pTblIter); + tdsqlite3_finalize(pIter->pIdxIter); rbuObjIterFreeCols(pIter); memset(pIter, 0, sizeof(RbuObjIter)); } @@ -199121,14 +199121,14 @@ static void rbuObjIterFinalize(RbuObjIter *pIter){ ** left in the RBU handle passed as the first argument. A copy of the ** error code is returned. */ -static int rbuObjIterNext(sqlite3rbu *p, RbuObjIter *pIter){ +static int rbuObjIterNext(tdsqlite3rbu *p, RbuObjIter *pIter){ int rc = p->rc; if( rc==SQLITE_OK ){ /* Free any SQLite statements used while processing the previous object */ rbuObjIterClearStatements(pIter); if( pIter->zIdx==0 ){ - rc = sqlite3_exec(p->dbMain, + rc = tdsqlite3_exec(p->dbMain, "DROP TRIGGER IF EXISTS temp.rbu_insert_tr;" "DROP TRIGGER IF EXISTS temp.rbu_update1_tr;" "DROP TRIGGER IF EXISTS temp.rbu_update2_tr;" @@ -199141,30 +199141,30 @@ static int rbuObjIterNext(sqlite3rbu *p, RbuObjIter *pIter){ if( pIter->bCleanup ){ rbuObjIterFreeCols(pIter); pIter->bCleanup = 0; - rc = sqlite3_step(pIter->pTblIter); + rc = tdsqlite3_step(pIter->pTblIter); if( rc!=SQLITE_ROW ){ rc = resetAndCollectError(pIter->pTblIter, &p->zErrmsg); pIter->zTbl = 0; }else{ - pIter->zTbl = (const char*)sqlite3_column_text(pIter->pTblIter, 0); - pIter->zDataTbl = (const char*)sqlite3_column_text(pIter->pTblIter,1); + pIter->zTbl = (const char*)tdsqlite3_column_text(pIter->pTblIter, 0); + pIter->zDataTbl = (const char*)tdsqlite3_column_text(pIter->pTblIter,1); rc = (pIter->zDataTbl && pIter->zTbl) ? SQLITE_OK : SQLITE_NOMEM; } }else{ if( pIter->zIdx==0 ){ - sqlite3_stmt *pIdx = pIter->pIdxIter; - rc = sqlite3_bind_text(pIdx, 1, pIter->zTbl, -1, SQLITE_STATIC); + tdsqlite3_stmt *pIdx = pIter->pIdxIter; + rc = tdsqlite3_bind_text(pIdx, 1, pIter->zTbl, -1, SQLITE_STATIC); } if( rc==SQLITE_OK ){ - rc = sqlite3_step(pIter->pIdxIter); + rc = tdsqlite3_step(pIter->pIdxIter); if( rc!=SQLITE_ROW ){ rc = resetAndCollectError(pIter->pIdxIter, &p->zErrmsg); pIter->bCleanup = 1; pIter->zIdx = 0; }else{ - pIter->zIdx = (const char*)sqlite3_column_text(pIter->pIdxIter, 0); - pIter->iTnum = sqlite3_column_int(pIter->pIdxIter, 1); - pIter->bUnique = sqlite3_column_int(pIter->pIdxIter, 2); + pIter->zIdx = (const char*)tdsqlite3_column_text(pIter->pIdxIter, 0); + pIter->iTnum = tdsqlite3_column_int(pIter->pIdxIter, 1); + pIter->bUnique = tdsqlite3_column_int(pIter->pIdxIter, 2); rc = pIter->zIdx ? SQLITE_OK : SQLITE_NOMEM; } } @@ -199202,27 +199202,27 @@ static int rbuObjIterNext(sqlite3rbu *p, RbuObjIter *pIter){ ** the second argument is either missing or 0 (not a view). */ static void rbuTargetNameFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ - sqlite3rbu *p = sqlite3_user_data(pCtx); + tdsqlite3rbu *p = tdsqlite3_user_data(pCtx); const char *zIn; assert( argc==1 || argc==2 ); - zIn = (const char*)sqlite3_value_text(argv[0]); + zIn = (const char*)tdsqlite3_value_text(argv[0]); if( zIn ){ if( rbuIsVacuum(p) ){ assert( argc==2 || argc==1 ); - if( argc==1 || 0==sqlite3_value_int(argv[1]) ){ - sqlite3_result_text(pCtx, zIn, -1, SQLITE_STATIC); + if( argc==1 || 0==tdsqlite3_value_int(argv[1]) ){ + tdsqlite3_result_text(pCtx, zIn, -1, SQLITE_STATIC); } }else{ if( strlen(zIn)>4 && memcmp("data", zIn, 4)==0 ){ int i; for(i=4; zIn[i]>='0' && zIn[i]<='9'; i++); if( zIn[i]=='_' && zIn[i+1] ){ - sqlite3_result_text(pCtx, &zIn[i+1], -1, SQLITE_STATIC); + tdsqlite3_result_text(pCtx, &zIn[i+1], -1, SQLITE_STATIC); } } } @@ -199237,12 +199237,12 @@ static void rbuTargetNameFunc( ** left in the RBU handle passed as the first argument. A copy of the ** error code is returned. */ -static int rbuObjIterFirst(sqlite3rbu *p, RbuObjIter *pIter){ +static int rbuObjIterFirst(tdsqlite3rbu *p, RbuObjIter *pIter){ int rc; memset(pIter, 0, sizeof(RbuObjIter)); rc = prepareFreeAndCollectError(p->dbRbu, &pIter->pTblIter, &p->zErrmsg, - sqlite3_mprintf( + tdsqlite3_mprintf( "SELECT rbu_target_name(name, type='view') AS target, name " "FROM sqlite_master " "WHERE type IN ('table', 'view') AND target IS NOT NULL " @@ -199264,23 +199264,23 @@ static int rbuObjIterFirst(sqlite3rbu *p, RbuObjIter *pIter){ } /* -** This is a wrapper around "sqlite3_mprintf(zFmt, ...)". If an OOM occurs, +** This is a wrapper around "tdsqlite3_mprintf(zFmt, ...)". If an OOM occurs, ** an error code is stored in the RBU handle passed as the first argument. ** ** If an error has already occurred (p->rc is already set to something other ** than SQLITE_OK), then this function returns NULL without modifying the -** stored error code. In this case it still calls sqlite3_free() on any +** stored error code. In this case it still calls tdsqlite3_free() on any ** printf() parameters associated with %z conversions. */ -static char *rbuMPrintf(sqlite3rbu *p, const char *zFmt, ...){ +static char *rbuMPrintf(tdsqlite3rbu *p, const char *zFmt, ...){ char *zSql = 0; va_list ap; va_start(ap, zFmt); - zSql = sqlite3_vmprintf(zFmt, ap); + zSql = tdsqlite3_vmprintf(zFmt, ap); if( p->rc==SQLITE_OK ){ if( zSql==0 ) p->rc = SQLITE_NOMEM; }else{ - sqlite3_free(zSql); + tdsqlite3_free(zSql); zSql = 0; } va_end(ap); @@ -199288,7 +199288,7 @@ static char *rbuMPrintf(sqlite3rbu *p, const char *zFmt, ...){ } /* -** Argument zFmt is a sqlite3_mprintf() style format string. The trailing +** Argument zFmt is a tdsqlite3_mprintf() style format string. The trailing ** arguments are the usual subsitution values. This function performs ** the printf() style substitutions and executes the result as an SQL ** statement on the RBU handles database. @@ -199297,19 +199297,19 @@ static char *rbuMPrintf(sqlite3rbu *p, const char *zFmt, ...){ ** RBU handle. If an error has already occurred when this function is ** called, it is a no-op. */ -static int rbuMPrintfExec(sqlite3rbu *p, sqlite3 *db, const char *zFmt, ...){ +static int rbuMPrintfExec(tdsqlite3rbu *p, tdsqlite3 *db, const char *zFmt, ...){ va_list ap; char *zSql; va_start(ap, zFmt); - zSql = sqlite3_vmprintf(zFmt, ap); + zSql = tdsqlite3_vmprintf(zFmt, ap); if( p->rc==SQLITE_OK ){ if( zSql==0 ){ p->rc = SQLITE_NOMEM; }else{ - p->rc = sqlite3_exec(db, zSql, 0, 0, &p->zErrmsg); + p->rc = tdsqlite3_exec(db, zSql, 0, 0, &p->zErrmsg); } } - sqlite3_free(zSql); + tdsqlite3_free(zSql); va_end(ap); return p->rc; } @@ -199324,11 +199324,11 @@ static int rbuMPrintfExec(sqlite3rbu *p, sqlite3 *db, const char *zFmt, ...){ ** immediately without attempting the allocation or modifying the stored ** error code. */ -static void *rbuMalloc(sqlite3rbu *p, sqlite3_int64 nByte){ +static void *rbuMalloc(tdsqlite3rbu *p, tdsqlite3_int64 nByte){ void *pRet = 0; if( p->rc==SQLITE_OK ){ assert( nByte>0 ); - pRet = sqlite3_malloc64(nByte); + pRet = tdsqlite3_malloc64(nByte); if( pRet==0 ){ p->rc = SQLITE_NOMEM; }else{ @@ -199344,8 +199344,8 @@ static void *rbuMalloc(sqlite3rbu *p, sqlite3_int64 nByte){ ** there is room for at least nCol elements. If an OOM occurs, store an ** error code in the RBU handle passed as the first argument. */ -static void rbuAllocateIterArrays(sqlite3rbu *p, RbuObjIter *pIter, int nCol){ - sqlite3_int64 nByte = (2*sizeof(char*) + sizeof(int) + 3*sizeof(u8)) * nCol; +static void rbuAllocateIterArrays(tdsqlite3rbu *p, RbuObjIter *pIter, int nCol){ + tdsqlite3_int64 nByte = (2*sizeof(char*) + sizeof(int) + 3*sizeof(u8)) * nCol; char **azNew; azNew = (char**)rbuMalloc(p, nByte); @@ -199361,9 +199361,9 @@ static void rbuAllocateIterArrays(sqlite3rbu *p, RbuObjIter *pIter, int nCol){ /* ** The first argument must be a nul-terminated string. This function -** returns a copy of the string in memory obtained from sqlite3_malloc(). +** returns a copy of the string in memory obtained from tdsqlite3_malloc(). ** It is the responsibility of the caller to eventually free this memory -** using sqlite3_free(). +** using tdsqlite3_free(). ** ** If an OOM condition is encountered when attempting to allocate memory, ** output variable (*pRc) is set to SQLITE_NOMEM before returning. Otherwise, @@ -199375,7 +199375,7 @@ static char *rbuStrndup(const char *zStr, int *pRc){ if( *pRc==SQLITE_OK ){ if( zStr ){ size_t nCopy = strlen(zStr) + 1; - zRet = (char*)sqlite3_malloc64(nCopy); + zRet = (char*)tdsqlite3_malloc64(nCopy); if( zRet ){ memcpy(zRet, zStr, nCopy); }else{ @@ -199390,16 +199390,16 @@ static char *rbuStrndup(const char *zStr, int *pRc){ /* ** Finalize the statement passed as the second argument. ** -** If the sqlite3_finalize() call indicates that an error occurs, and the +** If the tdsqlite3_finalize() call indicates that an error occurs, and the ** rbu handle error code is not already set, set the error code and error ** message accordingly. */ -static void rbuFinalize(sqlite3rbu *p, sqlite3_stmt *pStmt){ - sqlite3 *db = sqlite3_db_handle(pStmt); - int rc = sqlite3_finalize(pStmt); +static void rbuFinalize(tdsqlite3rbu *p, tdsqlite3_stmt *pStmt){ + tdsqlite3 *db = tdsqlite3_db_handle(pStmt); + int rc = tdsqlite3_finalize(pStmt); if( p->rc==SQLITE_OK && rc!=SQLITE_OK ){ p->rc = rc; - p->zErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(db)); + p->zErrmsg = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(db)); } } @@ -199443,7 +199443,7 @@ static void rbuFinalize(sqlite3rbu *p, sqlite3_stmt *pStmt){ ** } */ static void rbuTableType( - sqlite3rbu *p, + tdsqlite3rbu *p, const char *zTab, int *peType, int *piTnum, @@ -199455,43 +199455,43 @@ static void rbuTableType( ** 2) SELECT count(*) FROM sqlite_master where name=%Q ** 3) PRAGMA table_info = ? */ - sqlite3_stmt *aStmt[4] = {0, 0, 0, 0}; + tdsqlite3_stmt *aStmt[4] = {0, 0, 0, 0}; *peType = RBU_PK_NOTABLE; *piPk = 0; assert( p->rc==SQLITE_OK ); p->rc = prepareFreeAndCollectError(p->dbMain, &aStmt[0], &p->zErrmsg, - sqlite3_mprintf( + tdsqlite3_mprintf( "SELECT (sql LIKE 'create virtual%%'), rootpage" " FROM sqlite_master" " WHERE name=%Q", zTab )); - if( p->rc!=SQLITE_OK || sqlite3_step(aStmt[0])!=SQLITE_ROW ){ + if( p->rc!=SQLITE_OK || tdsqlite3_step(aStmt[0])!=SQLITE_ROW ){ /* Either an error, or no such table. */ goto rbuTableType_end; } - if( sqlite3_column_int(aStmt[0], 0) ){ + if( tdsqlite3_column_int(aStmt[0], 0) ){ *peType = RBU_PK_VTAB; /* virtual table */ goto rbuTableType_end; } - *piTnum = sqlite3_column_int(aStmt[0], 1); + *piTnum = tdsqlite3_column_int(aStmt[0], 1); p->rc = prepareFreeAndCollectError(p->dbMain, &aStmt[1], &p->zErrmsg, - sqlite3_mprintf("PRAGMA index_list=%Q",zTab) + tdsqlite3_mprintf("PRAGMA index_list=%Q",zTab) ); if( p->rc ) goto rbuTableType_end; - while( sqlite3_step(aStmt[1])==SQLITE_ROW ){ - const u8 *zOrig = sqlite3_column_text(aStmt[1], 3); - const u8 *zIdx = sqlite3_column_text(aStmt[1], 1); + while( tdsqlite3_step(aStmt[1])==SQLITE_ROW ){ + const u8 *zOrig = tdsqlite3_column_text(aStmt[1], 3); + const u8 *zIdx = tdsqlite3_column_text(aStmt[1], 1); if( zOrig && zIdx && zOrig[0]=='p' ){ p->rc = prepareFreeAndCollectError(p->dbMain, &aStmt[2], &p->zErrmsg, - sqlite3_mprintf( + tdsqlite3_mprintf( "SELECT rootpage FROM sqlite_master WHERE name = %Q", zIdx )); if( p->rc==SQLITE_OK ){ - if( sqlite3_step(aStmt[2])==SQLITE_ROW ){ - *piPk = sqlite3_column_int(aStmt[2], 0); + if( tdsqlite3_step(aStmt[2])==SQLITE_ROW ){ + *piPk = tdsqlite3_column_int(aStmt[2], 0); *peType = RBU_PK_EXTERNAL; }else{ *peType = RBU_PK_WITHOUT_ROWID; @@ -199502,11 +199502,11 @@ static void rbuTableType( } p->rc = prepareFreeAndCollectError(p->dbMain, &aStmt[3], &p->zErrmsg, - sqlite3_mprintf("PRAGMA table_info=%Q",zTab) + tdsqlite3_mprintf("PRAGMA table_info=%Q",zTab) ); if( p->rc==SQLITE_OK ){ - while( sqlite3_step(aStmt[3])==SQLITE_ROW ){ - if( sqlite3_column_int(aStmt[3],5)>0 ){ + while( tdsqlite3_step(aStmt[3])==SQLITE_ROW ){ + if( tdsqlite3_column_int(aStmt[3],5)>0 ){ *peType = RBU_PK_IPK; /* explicit IPK column */ goto rbuTableType_end; } @@ -199526,31 +199526,31 @@ rbuTableType_end: { ** This is a helper function for rbuObjIterCacheTableInfo(). It populates ** the pIter->abIndexed[] array. */ -static void rbuObjIterCacheIndexedCols(sqlite3rbu *p, RbuObjIter *pIter){ - sqlite3_stmt *pList = 0; +static void rbuObjIterCacheIndexedCols(tdsqlite3rbu *p, RbuObjIter *pIter){ + tdsqlite3_stmt *pList = 0; int bIndex = 0; if( p->rc==SQLITE_OK ){ memcpy(pIter->abIndexed, pIter->abTblPk, sizeof(u8)*pIter->nTblCol); p->rc = prepareFreeAndCollectError(p->dbMain, &pList, &p->zErrmsg, - sqlite3_mprintf("PRAGMA main.index_list = %Q", pIter->zTbl) + tdsqlite3_mprintf("PRAGMA main.index_list = %Q", pIter->zTbl) ); } pIter->nIndex = 0; - while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pList) ){ - const char *zIdx = (const char*)sqlite3_column_text(pList, 1); - int bPartial = sqlite3_column_int(pList, 4); - sqlite3_stmt *pXInfo = 0; + while( p->rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pList) ){ + const char *zIdx = (const char*)tdsqlite3_column_text(pList, 1); + int bPartial = tdsqlite3_column_int(pList, 4); + tdsqlite3_stmt *pXInfo = 0; if( zIdx==0 ) break; if( bPartial ){ memset(pIter->abIndexed, 0x01, sizeof(u8)*pIter->nTblCol); } p->rc = prepareFreeAndCollectError(p->dbMain, &pXInfo, &p->zErrmsg, - sqlite3_mprintf("PRAGMA main.index_xinfo = %Q", zIdx) + tdsqlite3_mprintf("PRAGMA main.index_xinfo = %Q", zIdx) ); - while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXInfo) ){ - int iCid = sqlite3_column_int(pXInfo, 1); + while( p->rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pXInfo) ){ + int iCid = tdsqlite3_column_int(pXInfo, 1); if( iCid>=0 ) pIter->abIndexed[iCid] = 1; if( iCid==-2 ){ memset(pIter->abIndexed, 0x01, sizeof(u8)*pIter->nTblCol); @@ -199580,9 +199580,9 @@ static void rbuObjIterCacheIndexedCols(sqlite3rbu *p, RbuObjIter *pIter){ ** an error does occur, an error code and error message are also left in ** the RBU handle. */ -static int rbuObjIterCacheTableInfo(sqlite3rbu *p, RbuObjIter *pIter){ +static int rbuObjIterCacheTableInfo(tdsqlite3rbu *p, RbuObjIter *pIter){ if( pIter->azTblCol==0 ){ - sqlite3_stmt *pStmt = 0; + tdsqlite3_stmt *pStmt = 0; int nCol = 0; int i; /* for() loop iterator variable */ int bRbuRowid = 0; /* If input table has column "rbu_rowid" */ @@ -199594,7 +199594,7 @@ static int rbuObjIterCacheTableInfo(sqlite3rbu *p, RbuObjIter *pIter){ rbuTableType(p, pIter->zTbl, &pIter->eType, &iTnum, &pIter->iPkTnum); if( p->rc==SQLITE_OK && pIter->eType==RBU_PK_NOTABLE ){ p->rc = SQLITE_ERROR; - p->zErrmsg = sqlite3_mprintf("no such table: %s", pIter->zTbl); + p->zErrmsg = tdsqlite3_mprintf("no such table: %s", pIter->zTbl); } if( p->rc ) return p->rc; if( pIter->zIdx==0 ) pIter->iTnum = iTnum; @@ -199608,24 +199608,24 @@ static int rbuObjIterCacheTableInfo(sqlite3rbu *p, RbuObjIter *pIter){ ** of the input table. Ignore any input table columns that begin with ** "rbu_". */ p->rc = prepareFreeAndCollectError(p->dbRbu, &pStmt, &p->zErrmsg, - sqlite3_mprintf("SELECT * FROM '%q'", pIter->zDataTbl) + tdsqlite3_mprintf("SELECT * FROM '%q'", pIter->zDataTbl) ); if( p->rc==SQLITE_OK ){ - nCol = sqlite3_column_count(pStmt); + nCol = tdsqlite3_column_count(pStmt); rbuAllocateIterArrays(p, pIter, nCol); } for(i=0; p->rc==SQLITE_OK && irc); pIter->aiSrcOrder[pIter->nTblCol] = pIter->nTblCol; pIter->azTblCol[pIter->nTblCol++] = zCopy; } - else if( 0==sqlite3_stricmp("rbu_rowid", zName) ){ + else if( 0==tdsqlite3_stricmp("rbu_rowid", zName) ){ bRbuRowid = 1; } } - sqlite3_finalize(pStmt); + tdsqlite3_finalize(pStmt); pStmt = 0; if( p->rc==SQLITE_OK @@ -199633,7 +199633,7 @@ static int rbuObjIterCacheTableInfo(sqlite3rbu *p, RbuObjIter *pIter){ && bRbuRowid!=(pIter->eType==RBU_PK_VTAB || pIter->eType==RBU_PK_NONE) ){ p->rc = SQLITE_ERROR; - p->zErrmsg = sqlite3_mprintf( + p->zErrmsg = tdsqlite3_mprintf( "table %q %s rbu_rowid column", pIter->zDataTbl, (bRbuRowid ? "may not have" : "requires") ); @@ -199644,24 +199644,24 @@ static int rbuObjIterCacheTableInfo(sqlite3rbu *p, RbuObjIter *pIter){ ** aiTblOrder[] arrays at the same time. */ if( p->rc==SQLITE_OK ){ p->rc = prepareFreeAndCollectError(p->dbMain, &pStmt, &p->zErrmsg, - sqlite3_mprintf("PRAGMA table_info(%Q)", pIter->zTbl) + tdsqlite3_mprintf("PRAGMA table_info(%Q)", pIter->zTbl) ); } - while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ - const char *zName = (const char*)sqlite3_column_text(pStmt, 1); + while( p->rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pStmt) ){ + const char *zName = (const char*)tdsqlite3_column_text(pStmt, 1); if( zName==0 ) break; /* An OOM - finalize() below returns S_NOMEM */ for(i=iOrder; inTblCol; i++){ if( 0==strcmp(zName, pIter->azTblCol[i]) ) break; } if( i==pIter->nTblCol ){ p->rc = SQLITE_ERROR; - p->zErrmsg = sqlite3_mprintf("column missing from %q: %s", + p->zErrmsg = tdsqlite3_mprintf("column missing from %q: %s", pIter->zDataTbl, zName ); }else{ - int iPk = sqlite3_column_int(pStmt, 5); - int bNotNull = sqlite3_column_int(pStmt, 3); - const char *zType = (const char*)sqlite3_column_text(pStmt, 2); + int iPk = tdsqlite3_column_int(pStmt, 5); + int bNotNull = tdsqlite3_column_int(pStmt, 3); + const char *zType = (const char*)tdsqlite3_column_text(pStmt, 2); if( i!=iOrder ){ SWAP(int, pIter->aiSrcOrder[i], pIter->aiSrcOrder[iOrder]); @@ -199691,7 +199691,7 @@ static int rbuObjIterCacheTableInfo(sqlite3rbu *p, RbuObjIter *pIter){ ** column names currently stored in the pIter->azTblCol[] array. */ static char *rbuObjIterGetCollist( - sqlite3rbu *p, /* RBU object */ + tdsqlite3rbu *p, /* RBU object */ RbuObjIter *pIter /* Object iterator for column names */ ){ char *zList = 0; @@ -199712,7 +199712,7 @@ static char *rbuObjIterGetCollist( ** the separator text (usually ", "). */ static char *rbuObjIterGetPkList( - sqlite3rbu *p, /* RBU object */ + tdsqlite3rbu *p, /* RBU object */ RbuObjIter *pIter, /* Object iterator for column names */ const char *zPre, /* Before each quoted column name */ const char *zSeparator, /* Separator to use between columns */ @@ -199757,21 +199757,21 @@ static char *rbuObjIterGetPkList( ** this function contain literal SQL values. */ static char *rbuVacuumTableStart( - sqlite3rbu *p, /* RBU handle */ + tdsqlite3rbu *p, /* RBU handle */ RbuObjIter *pIter, /* RBU iterator object */ int bRowid, /* True for a rowid table */ const char *zWrite /* Target table name prefix */ ){ - sqlite3_stmt *pMax = 0; + tdsqlite3_stmt *pMax = 0; char *zRet = 0; if( bRowid ){ p->rc = prepareFreeAndCollectError(p->dbMain, &pMax, &p->zErrmsg, - sqlite3_mprintf( + tdsqlite3_mprintf( "SELECT max(_rowid_) FROM \"%s%w\"", zWrite, pIter->zTbl ) ); - if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pMax) ){ - sqlite3_int64 iMax = sqlite3_column_int64(pMax, 0); + if( p->rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pMax) ){ + tdsqlite3_int64 iMax = tdsqlite3_column_int64(pMax, 0); zRet = rbuMPrintf(p, " WHERE _rowid_ > %lld ", iMax); } rbuFinalize(p, pMax); @@ -199782,21 +199782,21 @@ static char *rbuVacuumTableStart( if( p->rc==SQLITE_OK ){ p->rc = prepareFreeAndCollectError(p->dbMain, &pMax, &p->zErrmsg, - sqlite3_mprintf( + tdsqlite3_mprintf( "SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1", zSelect, zWrite, pIter->zTbl, zOrder ) ); - if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pMax) ){ - const char *zVal = (const char*)sqlite3_column_text(pMax, 0); + if( p->rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pMax) ){ + const char *zVal = (const char*)tdsqlite3_column_text(pMax, 0); zRet = rbuMPrintf(p, " WHERE (%s) > (%s) ", zList, zVal); } rbuFinalize(p, pMax); } - sqlite3_free(zOrder); - sqlite3_free(zSelect); - sqlite3_free(zList); + tdsqlite3_free(zOrder); + tdsqlite3_free(zSelect); + tdsqlite3_free(zList); } return zRet; } @@ -199824,7 +199824,7 @@ static char *rbuVacuumTableStart( ** rows from the sourct table, just as it does for an RBU update operation. */ char *rbuVacuumIndexStart( - sqlite3rbu *p, /* RBU handle */ + tdsqlite3rbu *p, /* RBU handle */ RbuObjIter *pIter /* RBU iterator object */ ){ char *zOrder = 0; @@ -199835,16 +199835,16 @@ char *rbuVacuumIndexStart( int bFailed = 0; const char *zSep = ""; int iCol = 0; - sqlite3_stmt *pXInfo = 0; + tdsqlite3_stmt *pXInfo = 0; p->rc = prepareFreeAndCollectError(p->dbMain, &pXInfo, &p->zErrmsg, - sqlite3_mprintf("PRAGMA main.index_xinfo = %Q", pIter->zIdx) + tdsqlite3_mprintf("PRAGMA main.index_xinfo = %Q", pIter->zIdx) ); - while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXInfo) ){ - int iCid = sqlite3_column_int(pXInfo, 1); - const char *zCollate = (const char*)sqlite3_column_text(pXInfo, 4); + while( p->rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pXInfo) ){ + int iCid = tdsqlite3_column_int(pXInfo, 1); + const char *zCollate = (const char*)tdsqlite3_column_text(pXInfo, 4); const char *zCol; - if( sqlite3_column_int(pXInfo, 3) ){ + if( tdsqlite3_column_int(pXInfo, 3) ){ bFailed = 1; break; } @@ -199878,17 +199878,17 @@ char *rbuVacuumIndexStart( if( bFailed ) goto index_start_out; if( p->rc==SQLITE_OK ){ - sqlite3_stmt *pSel = 0; + tdsqlite3_stmt *pSel = 0; p->rc = prepareFreeAndCollectError(p->dbMain, &pSel, &p->zErrmsg, - sqlite3_mprintf("SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1", + tdsqlite3_mprintf("SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1", zSelect, pIter->zTbl, zOrder ) ); - if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSel) ){ + if( p->rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pSel) ){ zSep = ""; for(iCol=0; iColnCol; iCol++){ - const char *zQuoted = (const char*)sqlite3_column_text(pSel, iCol); + const char *zQuoted = (const char*)tdsqlite3_column_text(pSel, iCol); if( zQuoted[0]=='N' ){ bFailed = 1; break; @@ -199905,10 +199905,10 @@ char *rbuVacuumIndexStart( } index_start_out: - sqlite3_free(zOrder); - sqlite3_free(zSelect); - sqlite3_free(zVector); - sqlite3_free(zLhs); + tdsqlite3_free(zOrder); + tdsqlite3_free(zSelect); + tdsqlite3_free(zVector); + tdsqlite3_free(zLhs); return zRet; } @@ -199937,7 +199937,7 @@ char *rbuVacuumIndexStart( ** pzWhere: ... */ static char *rbuObjIterGetIndexCols( - sqlite3rbu *p, /* RBU object */ + tdsqlite3rbu *p, /* RBU object */ RbuObjIter *pIter, /* Object iterator for column names */ char **pzImposterCols, /* OUT: Columns for imposter table */ char **pzImposterPk, /* OUT: Imposter PK clause */ @@ -199945,7 +199945,7 @@ static char *rbuObjIterGetIndexCols( int *pnBind /* OUT: Trbul number of columns */ ){ int rc = p->rc; /* Error code */ - int rc2; /* sqlite3_finalize() return code */ + int rc2; /* tdsqlite3_finalize() return code */ char *zRet = 0; /* String to return */ char *zImpCols = 0; /* String to return via *pzImposterCols */ char *zImpPK = 0; /* String to return via *pzImposterPK */ @@ -199953,25 +199953,25 @@ static char *rbuObjIterGetIndexCols( int nBind = 0; /* Value to return via *pnBind */ const char *zCom = ""; /* Set to ", " later on */ const char *zAnd = ""; /* Set to " AND " later on */ - sqlite3_stmt *pXInfo = 0; /* PRAGMA index_xinfo = ? */ + tdsqlite3_stmt *pXInfo = 0; /* PRAGMA index_xinfo = ? */ if( rc==SQLITE_OK ){ assert( p->zErrmsg==0 ); rc = prepareFreeAndCollectError(p->dbMain, &pXInfo, &p->zErrmsg, - sqlite3_mprintf("PRAGMA main.index_xinfo = %Q", pIter->zIdx) + tdsqlite3_mprintf("PRAGMA main.index_xinfo = %Q", pIter->zIdx) ); } - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXInfo) ){ - int iCid = sqlite3_column_int(pXInfo, 1); - int bDesc = sqlite3_column_int(pXInfo, 3); - const char *zCollate = (const char*)sqlite3_column_text(pXInfo, 4); + while( rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pXInfo) ){ + int iCid = tdsqlite3_column_int(pXInfo, 1); + int bDesc = tdsqlite3_column_int(pXInfo, 3); + const char *zCollate = (const char*)tdsqlite3_column_text(pXInfo, 4); const char *zCol = 0; const char *zType; if( iCid==-2 ){ - int iSeq = sqlite3_column_int(pXInfo, 0); - zRet = sqlite3_mprintf("%z%s(%.*s) COLLATE %Q", zRet, zCom, + int iSeq = tdsqlite3_column_int(pXInfo, 0); + zRet = tdsqlite3_mprintf("%z%s(%.*s) COLLATE %Q", zRet, zCom, pIter->aIdxCol[iSeq].nSpan, pIter->aIdxCol[iSeq].zSpan, zCollate ); zType = ""; @@ -199994,19 +199994,19 @@ static char *rbuObjIterGetIndexCols( zCol = pIter->azTblCol[iCid]; zType = pIter->azTblType[iCid]; } - zRet = sqlite3_mprintf("%z%s\"%w\" COLLATE %Q", zRet, zCom,zCol,zCollate); + zRet = tdsqlite3_mprintf("%z%s\"%w\" COLLATE %Q", zRet, zCom,zCol,zCollate); } - if( pIter->bUnique==0 || sqlite3_column_int(pXInfo, 5) ){ + if( pIter->bUnique==0 || tdsqlite3_column_int(pXInfo, 5) ){ const char *zOrder = (bDesc ? " DESC" : ""); - zImpPK = sqlite3_mprintf("%z%s\"rbu_imp_%d%w\"%s", + zImpPK = tdsqlite3_mprintf("%z%s\"rbu_imp_%d%w\"%s", zImpPK, zCom, nBind, zCol, zOrder ); } - zImpCols = sqlite3_mprintf("%z%s\"rbu_imp_%d%w\" %s COLLATE %Q", + zImpCols = tdsqlite3_mprintf("%z%s\"rbu_imp_%d%w\" %s COLLATE %Q", zImpCols, zCom, nBind, zCol, zType, zCollate ); - zWhere = sqlite3_mprintf( + zWhere = tdsqlite3_mprintf( "%z%s\"rbu_imp_%d%w\" IS ?", zWhere, zAnd, nBind, zCol ); if( zRet==0 || zImpPK==0 || zImpCols==0 || zWhere==0 ) rc = SQLITE_NOMEM; @@ -200015,14 +200015,14 @@ static char *rbuObjIterGetIndexCols( nBind++; } - rc2 = sqlite3_finalize(pXInfo); + rc2 = tdsqlite3_finalize(pXInfo); if( rc==SQLITE_OK ) rc = rc2; if( rc!=SQLITE_OK ){ - sqlite3_free(zRet); - sqlite3_free(zImpCols); - sqlite3_free(zImpPK); - sqlite3_free(zWhere); + tdsqlite3_free(zRet); + tdsqlite3_free(zImpCols); + tdsqlite3_free(zImpPK); + tdsqlite3_free(zWhere); zRet = 0; zImpCols = 0; zImpPK = 0; @@ -200049,7 +200049,7 @@ static char *rbuObjIterGetIndexCols( ** the text ", old._rowid_" to the returned value. */ static char *rbuObjIterGetOldlist( - sqlite3rbu *p, + tdsqlite3rbu *p, RbuObjIter *pIter, const char *zObj ){ @@ -200060,9 +200060,9 @@ static char *rbuObjIterGetOldlist( for(i=0; inTblCol; i++){ if( pIter->abIndexed[i] ){ const char *zCol = pIter->azTblCol[i]; - zList = sqlite3_mprintf("%z%s%s.\"%w\"", zList, zS, zObj, zCol); + zList = tdsqlite3_mprintf("%z%s%s.\"%w\"", zList, zS, zObj, zCol); }else{ - zList = sqlite3_mprintf("%z%sNULL", zList, zS); + zList = tdsqlite3_mprintf("%z%sNULL", zList, zS); } zS = ", "; if( zList==0 ){ @@ -200090,7 +200090,7 @@ static char *rbuObjIterGetOldlist( ** "b = ?1 AND c = ?2" */ static char *rbuObjIterGetWhere( - sqlite3rbu *p, + tdsqlite3rbu *p, RbuObjIter *pIter ){ char *zList = 0; @@ -200130,9 +200130,9 @@ static char *rbuObjIterGetWhere( ** stored in the (p->nCol+1)'th column. Set the error code and error message ** of the RBU handle to something reflecting this. */ -static void rbuBadControlError(sqlite3rbu *p){ +static void rbuBadControlError(tdsqlite3rbu *p){ p->rc = SQLITE_ERROR; - p->zErrmsg = sqlite3_mprintf("invalid rbu_control value"); + p->zErrmsg = tdsqlite3_mprintf("invalid rbu_control value"); } @@ -200143,9 +200143,9 @@ static void rbuBadControlError(sqlite3rbu *p){ ** passed as the second argument currently points to if the rbu_control ** column of the data_xxx table entry is set to zMask. ** -** The memory for the returned string is obtained from sqlite3_malloc(). +** The memory for the returned string is obtained from tdsqlite3_malloc(). ** It is the responsibility of the caller to eventually free it using -** sqlite3_free(). +** tdsqlite3_free(). ** ** If an OOM error is encountered when allocating space for the new ** string, an error code is left in the rbu handle passed as the first @@ -200154,7 +200154,7 @@ static void rbuBadControlError(sqlite3rbu *p){ ** attempting the allocation or modifying the stored error code. */ static char *rbuObjIterGetSetlist( - sqlite3rbu *p, + tdsqlite3rbu *p, RbuObjIter *pIter, const char *zMask ){ @@ -200197,9 +200197,9 @@ static char *rbuObjIterGetSetlist( ** "?" expressions. For example, if nByte is 3, return a pointer to ** a buffer containing the string "?,?,?". ** -** The memory for the returned string is obtained from sqlite3_malloc(). +** The memory for the returned string is obtained from tdsqlite3_malloc(). ** It is the responsibility of the caller to eventually free it using -** sqlite3_free(). +** tdsqlite3_free(). ** ** If an OOM error is encountered when allocating space for the new ** string, an error code is left in the rbu handle passed as the first @@ -200207,9 +200207,9 @@ static char *rbuObjIterGetSetlist( ** when this function is called, NULL is returned immediately, without ** attempting the allocation or modifying the stored error code. */ -static char *rbuObjIterGetBindlist(sqlite3rbu *p, int nBind){ +static char *rbuObjIterGetBindlist(tdsqlite3rbu *p, int nBind){ char *zRet = 0; - sqlite3_int64 nByte = 2*(sqlite3_int64)nBind + 1; + tdsqlite3_int64 nByte = 2*(tdsqlite3_int64)nBind + 1; zRet = (char*)rbuMalloc(p, nByte); if( zRet ){ @@ -200234,24 +200234,24 @@ static char *rbuObjIterGetBindlist(sqlite3rbu *p, int nBind){ ** ** PRIMARY KEY("b", "a" DESC) */ -static char *rbuWithoutRowidPK(sqlite3rbu *p, RbuObjIter *pIter){ +static char *rbuWithoutRowidPK(tdsqlite3rbu *p, RbuObjIter *pIter){ char *z = 0; assert( pIter->zIdx==0 ); if( p->rc==SQLITE_OK ){ const char *zSep = "PRIMARY KEY("; - sqlite3_stmt *pXList = 0; /* PRAGMA index_list = (pIter->zTbl) */ - sqlite3_stmt *pXInfo = 0; /* PRAGMA index_xinfo = */ + tdsqlite3_stmt *pXList = 0; /* PRAGMA index_list = (pIter->zTbl) */ + tdsqlite3_stmt *pXInfo = 0; /* PRAGMA index_xinfo = */ p->rc = prepareFreeAndCollectError(p->dbMain, &pXList, &p->zErrmsg, - sqlite3_mprintf("PRAGMA main.index_list = %Q", pIter->zTbl) + tdsqlite3_mprintf("PRAGMA main.index_list = %Q", pIter->zTbl) ); - while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXList) ){ - const char *zOrig = (const char*)sqlite3_column_text(pXList,3); + while( p->rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pXList) ){ + const char *zOrig = (const char*)tdsqlite3_column_text(pXList,3); if( zOrig && strcmp(zOrig, "pk")==0 ){ - const char *zIdx = (const char*)sqlite3_column_text(pXList,1); + const char *zIdx = (const char*)tdsqlite3_column_text(pXList,1); if( zIdx ){ p->rc = prepareFreeAndCollectError(p->dbMain, &pXInfo, &p->zErrmsg, - sqlite3_mprintf("PRAGMA main.index_xinfo = %Q", zIdx) + tdsqlite3_mprintf("PRAGMA main.index_xinfo = %Q", zIdx) ); } break; @@ -200259,11 +200259,11 @@ static char *rbuWithoutRowidPK(sqlite3rbu *p, RbuObjIter *pIter){ } rbuFinalize(p, pXList); - while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXInfo) ){ - if( sqlite3_column_int(pXInfo, 5) ){ - /* int iCid = sqlite3_column_int(pXInfo, 0); */ - const char *zCol = (const char*)sqlite3_column_text(pXInfo, 2); - const char *zDesc = sqlite3_column_int(pXInfo, 3) ? " DESC" : ""; + while( p->rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pXInfo) ){ + if( tdsqlite3_column_int(pXInfo, 5) ){ + /* int iCid = tdsqlite3_column_int(pXInfo, 0); */ + const char *zCol = (const char*)tdsqlite3_column_text(pXInfo, 2); + const char *zDesc = tdsqlite3_column_int(pXInfo, 3) ? " DESC" : ""; z = rbuMPrintf(p, "%z%s\"%w\"%s", z, zSep, zCol, zDesc); zSep = ", "; } @@ -200293,12 +200293,12 @@ static char *rbuWithoutRowidPK(sqlite3rbu *p, RbuObjIter *pIter){ ** CREATE TABLE rbu_imposter2(c1 TEXT, c2 REAL, id INTEGER) WITHOUT ROWID; ** */ -static void rbuCreateImposterTable2(sqlite3rbu *p, RbuObjIter *pIter){ +static void rbuCreateImposterTable2(tdsqlite3rbu *p, RbuObjIter *pIter){ if( p->rc==SQLITE_OK && pIter->eType==RBU_PK_EXTERNAL ){ int tnum = pIter->iPkTnum; /* Root page of PK index */ - sqlite3_stmt *pQuery = 0; /* SELECT name ... WHERE rootpage = $tnum */ + tdsqlite3_stmt *pQuery = 0; /* SELECT name ... WHERE rootpage = $tnum */ const char *zIdx = 0; /* Name of PK index */ - sqlite3_stmt *pXInfo = 0; /* PRAGMA main.index_xinfo = $zIdx */ + tdsqlite3_stmt *pXInfo = 0; /* PRAGMA main.index_xinfo = $zIdx */ const char *zComma = ""; char *zCols = 0; /* Used to build up list of table cols */ char *zPk = 0; /* Used to build up table PK declaration */ @@ -200310,24 +200310,24 @@ static void rbuCreateImposterTable2(sqlite3rbu *p, RbuObjIter *pIter){ "SELECT name FROM sqlite_master WHERE rootpage = ?" ); if( p->rc==SQLITE_OK ){ - sqlite3_bind_int(pQuery, 1, tnum); - if( SQLITE_ROW==sqlite3_step(pQuery) ){ - zIdx = (const char*)sqlite3_column_text(pQuery, 0); + tdsqlite3_bind_int(pQuery, 1, tnum); + if( SQLITE_ROW==tdsqlite3_step(pQuery) ){ + zIdx = (const char*)tdsqlite3_column_text(pQuery, 0); } } if( zIdx ){ p->rc = prepareFreeAndCollectError(p->dbMain, &pXInfo, &p->zErrmsg, - sqlite3_mprintf("PRAGMA main.index_xinfo = %Q", zIdx) + tdsqlite3_mprintf("PRAGMA main.index_xinfo = %Q", zIdx) ); } rbuFinalize(p, pQuery); - while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXInfo) ){ - int bKey = sqlite3_column_int(pXInfo, 5); + while( p->rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pXInfo) ){ + int bKey = tdsqlite3_column_int(pXInfo, 5); if( bKey ){ - int iCid = sqlite3_column_int(pXInfo, 1); - int bDesc = sqlite3_column_int(pXInfo, 3); - const char *zCollate = (const char*)sqlite3_column_text(pXInfo, 4); + int iCid = tdsqlite3_column_int(pXInfo, 1); + int bDesc = tdsqlite3_column_int(pXInfo, 3); + const char *zCollate = (const char*)tdsqlite3_column_text(pXInfo, 4); zCols = rbuMPrintf(p, "%z%sc%d %s COLLATE %Q", zCols, zComma, iCid, pIter->azTblType[iCid], zCollate ); @@ -200338,12 +200338,12 @@ static void rbuCreateImposterTable2(sqlite3rbu *p, RbuObjIter *pIter){ zCols = rbuMPrintf(p, "%z, id INTEGER", zCols); rbuFinalize(p, pXInfo); - sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 1, tnum); + tdsqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 1, tnum); rbuMPrintfExec(p, p->dbMain, "CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID", zCols, zPk ); - sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 0, 0); + tdsqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 0, 0); } } @@ -200351,7 +200351,7 @@ static void rbuCreateImposterTable2(sqlite3rbu *p, RbuObjIter *pIter){ ** If an error has already occurred when this function is called, it ** immediately returns zero (without doing any work). Or, if an error ** occurs during the execution of this function, it sets the error code -** in the sqlite3rbu object indicated by the first argument and returns +** in the tdsqlite3rbu object indicated by the first argument and returns ** zero. ** ** The iterator passed as the second argument is guaranteed to point to @@ -200367,20 +200367,20 @@ static void rbuCreateImposterTable2(sqlite3rbu *p, RbuObjIter *pIter){ ** collation sequences. For tables that do not have an external PRIMARY ** KEY, it also means the same PRIMARY KEY declaration. */ -static void rbuCreateImposterTable(sqlite3rbu *p, RbuObjIter *pIter){ +static void rbuCreateImposterTable(tdsqlite3rbu *p, RbuObjIter *pIter){ if( p->rc==SQLITE_OK && pIter->eType!=RBU_PK_VTAB ){ int tnum = pIter->iTnum; const char *zComma = ""; char *zSql = 0; int iCol; - sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 0, 1); + tdsqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 0, 1); for(iCol=0; p->rc==SQLITE_OK && iColnTblCol; iCol++){ const char *zPk = ""; const char *zCol = pIter->azTblCol[iCol]; const char *zColl = 0; - p->rc = sqlite3_table_column_metadata( + p->rc = tdsqlite3_table_column_metadata( p->dbMain, "main", pIter->zTbl, zCol, 0, &zColl, 0, 0, 0 ); @@ -200403,12 +200403,12 @@ static void rbuCreateImposterTable(sqlite3rbu *p, RbuObjIter *pIter){ } } - sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 1, tnum); + tdsqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 1, tnum); rbuMPrintfExec(p, p->dbMain, "CREATE TABLE \"rbu_imp_%w\"(%z)%s", pIter->zTbl, zSql, (pIter->eType==RBU_PK_WITHOUT_ROWID ? " WITHOUT ROWID" : "") ); - sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 0, 0); + tdsqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 0, 0); } } @@ -200424,7 +200424,7 @@ static void rbuCreateImposterTable(sqlite3rbu *p, RbuObjIter *pIter){ ** virtual table. */ static void rbuObjIterPrepareTmpInsert( - sqlite3rbu *p, + tdsqlite3rbu *p, RbuObjIter *pIter, const char *zCollist, const char *zRbuRowid @@ -200434,7 +200434,7 @@ static void rbuObjIterPrepareTmpInsert( if( zBind ){ assert( pIter->pTmpInsert==0 ); p->rc = prepareFreeAndCollectError( - p->dbRbu, &pIter->pTmpInsert, &p->zErrmsg, sqlite3_mprintf( + p->dbRbu, &pIter->pTmpInsert, &p->zErrmsg, tdsqlite3_mprintf( "INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)", p->zStateDb, pIter->zDataTbl, zCollist, zRbuRowid, zBind )); @@ -200442,37 +200442,37 @@ static void rbuObjIterPrepareTmpInsert( } static void rbuTmpInsertFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nVal, - sqlite3_value **apVal + tdsqlite3_value **apVal ){ - sqlite3rbu *p = sqlite3_user_data(pCtx); + tdsqlite3rbu *p = tdsqlite3_user_data(pCtx); int rc = SQLITE_OK; int i; - assert( sqlite3_value_int(apVal[0])!=0 + assert( tdsqlite3_value_int(apVal[0])!=0 || p->objiter.eType==RBU_PK_EXTERNAL || p->objiter.eType==RBU_PK_NONE ); - if( sqlite3_value_int(apVal[0])!=0 ){ + if( tdsqlite3_value_int(apVal[0])!=0 ){ p->nPhaseOneStep += p->objiter.nIndex; } for(i=0; rc==SQLITE_OK && iobjiter.pTmpInsert, i+1, apVal[i]); + rc = tdsqlite3_bind_value(p->objiter.pTmpInsert, i+1, apVal[i]); } if( rc==SQLITE_OK ){ - sqlite3_step(p->objiter.pTmpInsert); - rc = sqlite3_reset(p->objiter.pTmpInsert); + tdsqlite3_step(p->objiter.pTmpInsert); + rc = tdsqlite3_reset(p->objiter.pTmpInsert); } if( rc!=SQLITE_OK ){ - sqlite3_result_error_code(pCtx, rc); + tdsqlite3_result_error_code(pCtx, rc); } } -static char *rbuObjIterGetIndexWhere(sqlite3rbu *p, RbuObjIter *pIter){ - sqlite3_stmt *pStmt = 0; +static char *rbuObjIterGetIndexWhere(tdsqlite3rbu *p, RbuObjIter *pIter){ + tdsqlite3_stmt *pStmt = 0; int rc = p->rc; char *zRet = 0; @@ -200485,9 +200485,9 @@ static char *rbuObjIterGetIndexWhere(sqlite3rbu *p, RbuObjIter *pIter){ } if( rc==SQLITE_OK ){ int rc2; - rc = sqlite3_bind_text(pStmt, 1, pIter->zIdx, -1, SQLITE_STATIC); - if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ - char *zSql = (char*)sqlite3_column_text(pStmt, 0); + rc = tdsqlite3_bind_text(pStmt, 1, pIter->zIdx, -1, SQLITE_STATIC); + if( rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pStmt) ){ + char *zSql = (char*)tdsqlite3_column_text(pStmt, 0); if( zSql ){ pIter->zIdxSql = zSql = rbuStrndup(zSql, &rc); } @@ -200501,7 +200501,7 @@ static char *rbuObjIterGetIndexWhere(sqlite3rbu *p, RbuObjIter *pIter){ /* If necessary, grow the pIter->aIdxCol[] array */ if( iIdxCol==nIdxAlloc ){ - RbuSpan *aIdxCol = (RbuSpan*)sqlite3_realloc( + RbuSpan *aIdxCol = (RbuSpan*)tdsqlite3_realloc( pIter->aIdxCol, (nIdxAlloc+16)*sizeof(RbuSpan) ); if( aIdxCol==0 ){ @@ -200558,7 +200558,7 @@ static char *rbuObjIterGetIndexWhere(sqlite3rbu *p, RbuObjIter *pIter){ } } - rc2 = sqlite3_finalize(pStmt); + rc2 = tdsqlite3_finalize(pStmt); if( rc==SQLITE_OK ) rc = rc2; } @@ -200572,7 +200572,7 @@ static char *rbuObjIterGetIndexWhere(sqlite3rbu *p, RbuObjIter *pIter){ ** as the second argument are available. */ static int rbuObjIterPrepareAll( - sqlite3rbu *p, + tdsqlite3rbu *p, RbuObjIter *pIter, int nOffset /* Add "LIMIT -1 OFFSET $nOffset" to SELECT */ ){ @@ -200585,7 +200585,7 @@ static int rbuObjIterPrepareAll( char *zLimit = 0; if( nOffset ){ - zLimit = sqlite3_mprintf(" LIMIT -1 OFFSET %d", nOffset); + zLimit = tdsqlite3_mprintf(" LIMIT -1 OFFSET %d", nOffset); if( !zLimit ) p->rc = SQLITE_NOMEM; } @@ -200606,20 +200606,20 @@ static int rbuObjIterPrepareAll( zBind = rbuObjIterGetBindlist(p, nBind); /* Create the imposter table used to write to this index. */ - sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 0, 1); - sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 1,tnum); + tdsqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 0, 1); + tdsqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 1,tnum); rbuMPrintfExec(p, p->dbMain, "CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID", zTbl, zImposterCols, zImposterPK ); - sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 0, 0); + tdsqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, "main", 0, 0); /* Create the statement to insert index entries */ pIter->nCol = nBind; if( p->rc==SQLITE_OK ){ p->rc = prepareFreeAndCollectError( p->dbMain, &pIter->pInsert, &p->zErrmsg, - sqlite3_mprintf("INSERT INTO \"rbu_imp_%w\" VALUES(%s)", zTbl, zBind) + tdsqlite3_mprintf("INSERT INTO \"rbu_imp_%w\" VALUES(%s)", zTbl, zBind) ); } @@ -200627,7 +200627,7 @@ static int rbuObjIterPrepareAll( if( rbuIsVacuum(p)==0 && p->rc==SQLITE_OK ){ p->rc = prepareFreeAndCollectError( p->dbMain, &pIter->pDelete, &p->zErrmsg, - sqlite3_mprintf("DELETE FROM \"rbu_imp_%w\" WHERE %s", zTbl, zWhere) + tdsqlite3_mprintf("DELETE FROM \"rbu_imp_%w\" WHERE %s", zTbl, zWhere) ); } @@ -200639,12 +200639,12 @@ static int rbuObjIterPrepareAll( if( nOffset ){ zStart = rbuVacuumIndexStart(p, pIter); if( zStart ){ - sqlite3_free(zLimit); + tdsqlite3_free(zLimit); zLimit = 0; } } - zSql = sqlite3_mprintf( + zSql = tdsqlite3_mprintf( "SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s", zCollist, pIter->zDataTbl, @@ -200652,17 +200652,17 @@ static int rbuObjIterPrepareAll( (zStart ? (zPart ? "AND" : "WHERE") : ""), zStart, zCollist, zLimit ); - sqlite3_free(zStart); + tdsqlite3_free(zStart); }else if( pIter->eType==RBU_PK_EXTERNAL || pIter->eType==RBU_PK_NONE ){ - zSql = sqlite3_mprintf( + zSql = tdsqlite3_mprintf( "SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s", zCollist, p->zStateDb, pIter->zDataTbl, zPart, zCollist, zLimit ); }else{ - zSql = sqlite3_mprintf( + zSql = tdsqlite3_mprintf( "SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s " "UNION ALL " "SELECT %s, rbu_control FROM '%q' " @@ -200678,15 +200678,15 @@ static int rbuObjIterPrepareAll( if( p->rc==SQLITE_OK ){ p->rc = prepareFreeAndCollectError(p->dbRbu,&pIter->pSelect,pz,zSql); }else{ - sqlite3_free(zSql); + tdsqlite3_free(zSql); } } - sqlite3_free(zImposterCols); - sqlite3_free(zImposterPK); - sqlite3_free(zWhere); - sqlite3_free(zBind); - sqlite3_free(zPart); + tdsqlite3_free(zImposterCols); + tdsqlite3_free(zImposterPK); + tdsqlite3_free(zWhere); + tdsqlite3_free(zBind); + tdsqlite3_free(zPart); }else{ int bRbuRowid = (pIter->eType==RBU_PK_VTAB) ||(pIter->eType==RBU_PK_NONE) @@ -200710,7 +200710,7 @@ static int rbuObjIterPrepareAll( /* Create the INSERT statement to write to the target PK b-tree */ if( p->rc==SQLITE_OK ){ p->rc = prepareFreeAndCollectError(p->dbMain, &pIter->pInsert, pz, - sqlite3_mprintf( + tdsqlite3_mprintf( "INSERT INTO \"%s%w\"(%s%s) VALUES(%s)", zWrite, zTbl, zCollist, (bRbuRowid ? ", _rowid_" : ""), zBindings ) @@ -200722,7 +200722,7 @@ static int rbuObjIterPrepareAll( ** an rbu vacuum handle. */ if( rbuIsVacuum(p)==0 && p->rc==SQLITE_OK ){ p->rc = prepareFreeAndCollectError(p->dbMain, &pIter->pDelete, pz, - sqlite3_mprintf( + tdsqlite3_mprintf( "DELETE FROM \"%s%w\" WHERE %s", zWrite, zTbl, zWhere ) ); @@ -200789,7 +200789,7 @@ static int rbuObjIterPrepareAll( if( nOffset ){ zStart = rbuVacuumTableStart(p, pIter, bRbuRowid, zWrite); if( zStart ){ - sqlite3_free(zLimit); + tdsqlite3_free(zLimit); zLimit = 0; } } @@ -200802,7 +200802,7 @@ static int rbuObjIterPrepareAll( if( p->rc==SQLITE_OK ){ p->rc = prepareFreeAndCollectError(p->dbRbu, &pIter->pSelect, pz, - sqlite3_mprintf( + tdsqlite3_mprintf( "SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s", zCollist, (rbuIsVacuum(p) ? "0 AS " : ""), @@ -200813,17 +200813,17 @@ static int rbuObjIterPrepareAll( ) ); } - sqlite3_free(zStart); - sqlite3_free(zOrder); + tdsqlite3_free(zStart); + tdsqlite3_free(zOrder); } - sqlite3_free(zWhere); - sqlite3_free(zOldlist); - sqlite3_free(zNewlist); - sqlite3_free(zBindings); + tdsqlite3_free(zWhere); + tdsqlite3_free(zOldlist); + tdsqlite3_free(zNewlist); + tdsqlite3_free(zBindings); } - sqlite3_free(zCollist); - sqlite3_free(zLimit); + tdsqlite3_free(zCollist); + tdsqlite3_free(zLimit); } return p->rc; @@ -200839,10 +200839,10 @@ static int rbuObjIterPrepareAll( ** is not an error. Output variable *ppStmt is set to NULL in this case. */ static int rbuGetUpdateStmt( - sqlite3rbu *p, /* RBU handle */ + tdsqlite3rbu *p, /* RBU handle */ RbuObjIter *pIter, /* Object iterator */ const char *zMask, /* rbu_control value ('x.x.') */ - sqlite3_stmt **ppStmt /* OUT: UPDATE statement handle */ + tdsqlite3_stmt **ppStmt /* OUT: UPDATE statement handle */ ){ RbuUpdateStmt **pp; RbuUpdateStmt *pUp = 0; @@ -200871,7 +200871,7 @@ static int rbuGetUpdateStmt( if( nUp>=SQLITE_RBU_UPDATE_CACHESIZE ){ for(pp=&pIter->pRbuUpdate; *pp!=pUp; pp=&((*pp)->pNext)); *pp = 0; - sqlite3_finalize(pUp->pUpdate); + tdsqlite3_finalize(pUp->pUpdate); pUp->pUpdate = 0; }else{ pUp = (RbuUpdateStmt*)rbuMalloc(p, sizeof(RbuUpdateStmt)+pIter->nTblCol+1); @@ -200891,7 +200891,7 @@ static int rbuGetUpdateStmt( const char *zPrefix = ""; if( pIter->eType!=RBU_PK_VTAB ) zPrefix = "rbu_imp_"; - zUpdate = sqlite3_mprintf("UPDATE \"%s%w\" SET %s WHERE %s", + zUpdate = tdsqlite3_mprintf("UPDATE \"%s%w\" SET %s WHERE %s", zPrefix, pIter->zTbl, zSet, zWhere ); p->rc = prepareFreeAndCollectError( @@ -200899,25 +200899,25 @@ static int rbuGetUpdateStmt( ); *ppStmt = pUp->pUpdate; } - sqlite3_free(zWhere); - sqlite3_free(zSet); + tdsqlite3_free(zWhere); + tdsqlite3_free(zSet); } return p->rc; } -static sqlite3 *rbuOpenDbhandle( - sqlite3rbu *p, +static tdsqlite3 *rbuOpenDbhandle( + tdsqlite3rbu *p, const char *zName, int bUseVfs ){ - sqlite3 *db = 0; + tdsqlite3 *db = 0; if( p->rc==SQLITE_OK ){ const int flags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_URI; - p->rc = sqlite3_open_v2(zName, &db, flags, bUseVfs ? p->zVfsName : 0); + p->rc = tdsqlite3_open_v2(zName, &db, flags, bUseVfs ? p->zVfsName : 0); if( p->rc ){ - p->zErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(db)); - sqlite3_close(db); + p->zErrmsg = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(db)); + tdsqlite3_close(db); db = 0; } } @@ -200929,10 +200929,10 @@ static sqlite3 *rbuOpenDbhandle( */ static void rbuFreeState(RbuState *p){ if( p ){ - sqlite3_free(p->zTbl); - sqlite3_free(p->zDataTbl); - sqlite3_free(p->zIdx); - sqlite3_free(p); + tdsqlite3_free(p->zTbl); + tdsqlite3_free(p->zDataTbl); + tdsqlite3_free(p->zIdx); + tdsqlite3_free(p); } } @@ -200940,14 +200940,14 @@ static void rbuFreeState(RbuState *p){ ** Allocate an RbuState object and load the contents of the rbu_state ** table into it. Return a pointer to the new object. It is the ** responsibility of the caller to eventually free the object using -** sqlite3_free(). +** tdsqlite3_free(). ** ** If an error occurs, leave an error code and message in the rbu handle ** and return NULL. */ -static RbuState *rbuLoadState(sqlite3rbu *p){ +static RbuState *rbuLoadState(tdsqlite3rbu *p){ RbuState *pRet = 0; - sqlite3_stmt *pStmt = 0; + tdsqlite3_stmt *pStmt = 0; int rc; int rc2; @@ -200955,12 +200955,12 @@ static RbuState *rbuLoadState(sqlite3rbu *p){ if( pRet==0 ) return 0; rc = prepareFreeAndCollectError(p->dbRbu, &pStmt, &p->zErrmsg, - sqlite3_mprintf("SELECT k, v FROM %s.rbu_state", p->zStateDb) + tdsqlite3_mprintf("SELECT k, v FROM %s.rbu_state", p->zStateDb) ); - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ - switch( sqlite3_column_int(pStmt, 0) ){ + while( rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pStmt) ){ + switch( tdsqlite3_column_int(pStmt, 0) ){ case RBU_STATE_STAGE: - pRet->eStage = sqlite3_column_int(pStmt, 1); + pRet->eStage = tdsqlite3_column_int(pStmt, 1); if( pRet->eStage!=RBU_STAGE_OAL && pRet->eStage!=RBU_STAGE_MOVE && pRet->eStage!=RBU_STAGE_CKPT @@ -200970,39 +200970,39 @@ static RbuState *rbuLoadState(sqlite3rbu *p){ break; case RBU_STATE_TBL: - pRet->zTbl = rbuStrndup((char*)sqlite3_column_text(pStmt, 1), &rc); + pRet->zTbl = rbuStrndup((char*)tdsqlite3_column_text(pStmt, 1), &rc); break; case RBU_STATE_IDX: - pRet->zIdx = rbuStrndup((char*)sqlite3_column_text(pStmt, 1), &rc); + pRet->zIdx = rbuStrndup((char*)tdsqlite3_column_text(pStmt, 1), &rc); break; case RBU_STATE_ROW: - pRet->nRow = sqlite3_column_int(pStmt, 1); + pRet->nRow = tdsqlite3_column_int(pStmt, 1); break; case RBU_STATE_PROGRESS: - pRet->nProgress = sqlite3_column_int64(pStmt, 1); + pRet->nProgress = tdsqlite3_column_int64(pStmt, 1); break; case RBU_STATE_CKPT: - pRet->iWalCksum = sqlite3_column_int64(pStmt, 1); + pRet->iWalCksum = tdsqlite3_column_int64(pStmt, 1); break; case RBU_STATE_COOKIE: - pRet->iCookie = (u32)sqlite3_column_int64(pStmt, 1); + pRet->iCookie = (u32)tdsqlite3_column_int64(pStmt, 1); break; case RBU_STATE_OALSZ: - pRet->iOalSz = (u32)sqlite3_column_int64(pStmt, 1); + pRet->iOalSz = (u32)tdsqlite3_column_int64(pStmt, 1); break; case RBU_STATE_PHASEONESTEP: - pRet->nPhaseOneStep = sqlite3_column_int64(pStmt, 1); + pRet->nPhaseOneStep = tdsqlite3_column_int64(pStmt, 1); break; case RBU_STATE_DATATBL: - pRet->zDataTbl = rbuStrndup((char*)sqlite3_column_text(pStmt, 1), &rc); + pRet->zDataTbl = rbuStrndup((char*)tdsqlite3_column_text(pStmt, 1), &rc); break; default: @@ -201010,7 +201010,7 @@ static RbuState *rbuLoadState(sqlite3rbu *p){ break; } } - rc2 = sqlite3_finalize(pStmt); + rc2 = tdsqlite3_finalize(pStmt); if( rc==SQLITE_OK ) rc = rc2; p->rc = rc; @@ -201022,7 +201022,7 @@ static RbuState *rbuLoadState(sqlite3rbu *p){ ** Open the database handle and attach the RBU database as "rbu". If an ** error occurs, leave an error code and message in the RBU handle. */ -static void rbuOpenDatabase(sqlite3rbu *p, int *pbRetry){ +static void rbuOpenDatabase(tdsqlite3rbu *p, int *pbRetry){ assert( p->rc || (p->dbMain==0 && p->dbRbu==0) ); assert( p->rc || rbuIsVacuum(p) || p->zTarget!=0 ); @@ -201030,9 +201030,9 @@ static void rbuOpenDatabase(sqlite3rbu *p, int *pbRetry){ p->dbRbu = rbuOpenDbhandle(p, p->zRbu, 1); if( p->rc==SQLITE_OK && rbuIsVacuum(p) ){ - sqlite3_file_control(p->dbRbu, "main", SQLITE_FCNTL_RBUCNT, (void*)p); + tdsqlite3_file_control(p->dbRbu, "main", SQLITE_FCNTL_RBUCNT, (void*)p); if( p->zState==0 ){ - const char *zFile = sqlite3_db_filename(p->dbRbu, "main"); + const char *zFile = tdsqlite3_db_filename(p->dbRbu, "main"); p->zState = rbuMPrintf(p, "file://%s-vacuum?modeof=%s", zFile, zFile); } } @@ -201048,7 +201048,7 @@ static void rbuOpenDatabase(sqlite3rbu *p, int *pbRetry){ #if 0 if( p->rc==SQLITE_OK && rbuIsVacuum(p) ){ - p->rc = sqlite3_exec(p->dbRbu, "BEGIN", 0, 0, 0); + p->rc = tdsqlite3_exec(p->dbRbu, "BEGIN", 0, 0, 0); } #endif @@ -201060,26 +201060,26 @@ static void rbuOpenDatabase(sqlite3rbu *p, int *pbRetry){ if( p->rc==SQLITE_OK ){ int rc2; int bOk = 0; - sqlite3_stmt *pCnt = 0; + tdsqlite3_stmt *pCnt = 0; p->rc = prepareAndCollectError(p->dbRbu, &pCnt, &p->zErrmsg, "SELECT count(*) FROM stat.sqlite_master" ); if( p->rc==SQLITE_OK - && sqlite3_step(pCnt)==SQLITE_ROW - && 1==sqlite3_column_int(pCnt, 0) + && tdsqlite3_step(pCnt)==SQLITE_ROW + && 1==tdsqlite3_column_int(pCnt, 0) ){ bOk = 1; } - rc2 = sqlite3_finalize(pCnt); + rc2 = tdsqlite3_finalize(pCnt); if( p->rc==SQLITE_OK ) p->rc = rc2; if( p->rc==SQLITE_OK && bOk==0 ){ p->rc = SQLITE_ERROR; - p->zErrmsg = sqlite3_mprintf("invalid state database"); + p->zErrmsg = tdsqlite3_mprintf("invalid state database"); } if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_exec(p->dbRbu, "COMMIT", 0, 0, 0); + p->rc = tdsqlite3_exec(p->dbRbu, "COMMIT", 0, 0, 0); } } } @@ -201090,7 +201090,7 @@ static void rbuOpenDatabase(sqlite3rbu *p, int *pbRetry){ int rc; p->nRbu = 0; p->pRbuFd = 0; - rc = sqlite3_file_control(p->dbRbu, "main", SQLITE_FCNTL_RBUCNT, (void*)p); + rc = tdsqlite3_file_control(p->dbRbu, "main", SQLITE_FCNTL_RBUCNT, (void*)p); if( rc!=SQLITE_NOTFOUND ) p->rc = rc; if( p->eStage>=RBU_STAGE_MOVE ){ bOpen = 1; @@ -201111,15 +201111,15 @@ static void rbuOpenDatabase(sqlite3rbu *p, int *pbRetry){ }else if( p->pRbuFd->pWalFd ){ if( pbRetry ){ p->pRbuFd->bNolock = 0; - sqlite3_close(p->dbRbu); - sqlite3_close(p->dbMain); + tdsqlite3_close(p->dbRbu); + tdsqlite3_close(p->dbMain); p->dbMain = 0; p->dbRbu = 0; *pbRetry = 1; return; } p->rc = SQLITE_ERROR; - p->zErrmsg = sqlite3_mprintf("cannot vacuum wal mode database"); + p->zErrmsg = tdsqlite3_mprintf("cannot vacuum wal mode database"); }else{ char *zTarget; char *zExtra = 0; @@ -201131,8 +201131,8 @@ static void rbuOpenDatabase(sqlite3rbu *p, int *pbRetry){ if( *zExtra=='\0' ) zExtra = 0; } - zTarget = sqlite3_mprintf("file:%s-vactmp?rbu_memory=1%s%s", - sqlite3_db_filename(p->dbRbu, "main"), + zTarget = tdsqlite3_mprintf("file:%s-vactmp?rbu_memory=1%s%s", + tdsqlite3_db_filename(p->dbRbu, "main"), (zExtra==0 ? "" : "&"), (zExtra==0 ? "" : zExtra) ); @@ -201141,30 +201141,30 @@ static void rbuOpenDatabase(sqlite3rbu *p, int *pbRetry){ return; } p->dbMain = rbuOpenDbhandle(p, zTarget, p->nRbu<=1); - sqlite3_free(zTarget); + tdsqlite3_free(zTarget); } } if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_create_function(p->dbMain, + p->rc = tdsqlite3_create_function(p->dbMain, "rbu_tmp_insert", -1, SQLITE_UTF8, (void*)p, rbuTmpInsertFunc, 0, 0 ); } if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_create_function(p->dbMain, + p->rc = tdsqlite3_create_function(p->dbMain, "rbu_fossil_delta", 2, SQLITE_UTF8, 0, rbuFossilDeltaFunc, 0, 0 ); } if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_create_function(p->dbRbu, + p->rc = tdsqlite3_create_function(p->dbRbu, "rbu_target_name", -1, SQLITE_UTF8, (void*)p, rbuTargetNameFunc, 0, 0 ); } if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_file_control(p->dbMain, "main", SQLITE_FCNTL_RBU, (void*)p); + p->rc = tdsqlite3_file_control(p->dbMain, "main", SQLITE_FCNTL_RBU, (void*)p); } rbuMPrintfExec(p, p->dbMain, "SELECT * FROM sqlite_master"); @@ -201172,17 +201172,17 @@ static void rbuOpenDatabase(sqlite3rbu *p, int *pbRetry){ ** this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. ** This is an error. */ if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_file_control(p->dbMain, "main", SQLITE_FCNTL_RBU, (void*)p); + p->rc = tdsqlite3_file_control(p->dbMain, "main", SQLITE_FCNTL_RBU, (void*)p); } if( p->rc==SQLITE_NOTFOUND ){ p->rc = SQLITE_ERROR; - p->zErrmsg = sqlite3_mprintf("rbu vfs not found"); + p->zErrmsg = tdsqlite3_mprintf("rbu vfs not found"); } } /* -** This routine is a copy of the sqlite3FileSuffix3() routine from the core. +** This routine is a copy of the tdsqlite3FileSuffix3() routine from the core. ** It is a no-op unless SQLITE_ENABLE_8_3_NAMES is defined. ** ** If SQLITE_ENABLE_8_3_NAMES is set at compile-time and if the database @@ -201204,7 +201204,7 @@ static void rbuOpenDatabase(sqlite3rbu *p, int *pbRetry){ static void rbuFileSuffix3(const char *zBase, char *z){ #ifdef SQLITE_ENABLE_8_3_NAMES #if SQLITE_ENABLE_8_3_NAMES<2 - if( sqlite3_uri_boolean(zBase, "8_3_names", 0) ) + if( tdsqlite3_uri_boolean(zBase, "8_3_names", 0) ) #endif { int i, sz; @@ -201222,10 +201222,10 @@ static void rbuFileSuffix3(const char *zBase, char *z){ ** The checksum is store in the first page of xShmMap memory as an 8-byte ** blob starting at byte offset 40. */ -static i64 rbuShmChecksum(sqlite3rbu *p){ +static i64 rbuShmChecksum(tdsqlite3rbu *p){ i64 iRet = 0; if( p->rc==SQLITE_OK ){ - sqlite3_file *pDb = p->pTargetFd->pReal; + tdsqlite3_file *pDb = p->pTargetFd->pReal; u32 volatile *ptr; p->rc = pDb->pMethods->xShmMap(pDb, 0, 32*1024, 0, (void volatile**)&ptr); if( p->rc==SQLITE_OK ){ @@ -201239,7 +201239,7 @@ static i64 rbuShmChecksum(sqlite3rbu *p){ ** This function is called as part of initializing or reinitializing an ** incremental checkpoint. ** -** It populates the sqlite3rbu.aFrame[] array with the set of +** It populates the tdsqlite3rbu.aFrame[] array with the set of ** (wal frame -> db page) copy operations required to checkpoint the ** current wal file, and obtains the set of shm locks required to safely ** perform the copy operations directly on the file-system. @@ -201251,7 +201251,7 @@ static i64 rbuShmChecksum(sqlite3rbu *p){ ** other client appends a transaction to the wal file in the middle of ** an incremental checkpoint. */ -static void rbuSetupCheckpoint(sqlite3rbu *p, RbuState *pState){ +static void rbuSetupCheckpoint(tdsqlite3rbu *p, RbuState *pState){ /* If pState is NULL, then the wal file may not have been opened and ** recovered. Running a read-statement here to ensure that doing so @@ -201259,12 +201259,12 @@ static void rbuSetupCheckpoint(sqlite3rbu *p, RbuState *pState){ if( pState==0 ){ p->eStage = 0; if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_exec(p->dbMain, "SELECT * FROM sqlite_master", 0, 0, 0); + p->rc = tdsqlite3_exec(p->dbMain, "SELECT * FROM sqlite_master", 0, 0, 0); } } /* Assuming no error has occurred, run a "restart" checkpoint with the - ** sqlite3rbu.eStage variable set to CAPTURE. This turns on the following + ** tdsqlite3rbu.eStage variable set to CAPTURE. This turns on the following ** special behaviour in the rbu VFS: ** ** * If the exclusive shm WRITER or READ0 lock cannot be obtained, @@ -201273,7 +201273,7 @@ static void rbuSetupCheckpoint(sqlite3rbu *p, RbuState *pState){ ** ** * Attempts to read from the *-wal file or write to the database file ** do not perform any IO. Instead, the frame/page combinations that - ** would be read/written are recorded in the sqlite3rbu.aFrame[] + ** would be read/written are recorded in the tdsqlite3rbu.aFrame[] ** array. ** ** * Calls to xShmLock(UNLOCK) to release the exclusive shm WRITER, @@ -201294,7 +201294,7 @@ static void rbuSetupCheckpoint(sqlite3rbu *p, RbuState *pState){ if( p->rc==SQLITE_OK ){ int rc2; p->eStage = RBU_STAGE_CAPTURE; - rc2 = sqlite3_exec(p->dbMain, "PRAGMA main.wal_checkpoint=restart", 0, 0,0); + rc2 = tdsqlite3_exec(p->dbMain, "PRAGMA main.wal_checkpoint=restart", 0, 0,0); if( rc2!=SQLITE_INTERNAL ) p->rc = rc2; } @@ -201311,8 +201311,8 @@ static void rbuSetupCheckpoint(sqlite3rbu *p, RbuState *pState){ p->eStage = RBU_STAGE_DONE; }else{ int nSectorSize; - sqlite3_file *pDb = p->pTargetFd->pReal; - sqlite3_file *pWal = p->pTargetFd->pWalFd->pReal; + tdsqlite3_file *pDb = p->pTargetFd->pReal; + tdsqlite3_file *pWal = p->pTargetFd->pWalFd->pReal; assert( p->nPagePerSector==0 ); nSectorSize = pDb->pMethods->xSectorSize(pDb); if( nSectorSize>p->pgsz ){ @@ -201335,7 +201335,7 @@ static void rbuSetupCheckpoint(sqlite3rbu *p, RbuState *pState){ ** the rbu object is in capture mode. Record the frame number of the frame ** being read in the aFrame[] array. */ -static int rbuCaptureWalRead(sqlite3rbu *pRbu, i64 iOff, int iAmt){ +static int rbuCaptureWalRead(tdsqlite3rbu *pRbu, i64 iOff, int iAmt){ const u32 mReq = (1<nFrame==pRbu->nFrameAlloc ){ int nNew = (pRbu->nFrameAlloc ? pRbu->nFrameAlloc : 64) * 2; RbuFrame *aNew; - aNew = (RbuFrame*)sqlite3_realloc64(pRbu->aFrame, nNew * sizeof(RbuFrame)); + aNew = (RbuFrame*)tdsqlite3_realloc64(pRbu->aFrame, nNew * sizeof(RbuFrame)); if( aNew==0 ) return SQLITE_NOMEM; pRbu->aFrame = aNew; pRbu->nFrameAlloc = nNew; @@ -201367,7 +201367,7 @@ static int rbuCaptureWalRead(sqlite3rbu *pRbu, i64 iOff, int iAmt){ ** file while the rbu handle is in capture mode. Record the page number ** of the page being written in the aFrame[] array. */ -static int rbuCaptureDbWrite(sqlite3rbu *pRbu, i64 iOff){ +static int rbuCaptureDbWrite(tdsqlite3rbu *pRbu, i64 iOff){ pRbu->aFrame[pRbu->nFrame-1].iDbPage = (u32)(iOff / pRbu->pgsz) + 1; return SQLITE_OK; } @@ -201377,9 +201377,9 @@ static int rbuCaptureDbWrite(sqlite3rbu *pRbu, i64 iOff){ ** a single frame of data from the wal file into the database file, as ** indicated by the RbuFrame object. */ -static void rbuCheckpointFrame(sqlite3rbu *p, RbuFrame *pFrame){ - sqlite3_file *pWal = p->pTargetFd->pWalFd->pReal; - sqlite3_file *pDb = p->pTargetFd->pReal; +static void rbuCheckpointFrame(tdsqlite3rbu *p, RbuFrame *pFrame){ + tdsqlite3_file *pWal = p->pTargetFd->pWalFd->pReal; + tdsqlite3_file *pDb = p->pTargetFd->pReal; i64 iOff; assert( p->rc==SQLITE_OK ); @@ -201395,8 +201395,8 @@ static void rbuCheckpointFrame(sqlite3rbu *p, RbuFrame *pFrame){ /* ** Take an EXCLUSIVE lock on the database file. */ -static void rbuLockDatabase(sqlite3rbu *p){ - sqlite3_file *pReal = p->pTargetFd->pReal; +static void rbuLockDatabase(tdsqlite3rbu *p){ + tdsqlite3_file *pReal = p->pTargetFd->pReal; assert( p->rc==SQLITE_OK ); p->rc = pReal->pMethods->xLock(pReal, SQLITE_LOCK_SHARED); if( p->rc==SQLITE_OK ){ @@ -201413,7 +201413,7 @@ static LPWSTR rbuWinUtf8ToUnicode(const char *zFilename){ if( nChar==0 ){ return 0; } - zWideFilename = sqlite3_malloc64( nChar*sizeof(zWideFilename[0]) ); + zWideFilename = tdsqlite3_malloc64( nChar*sizeof(zWideFilename[0]) ); if( zWideFilename==0 ){ return 0; } @@ -201421,7 +201421,7 @@ static LPWSTR rbuWinUtf8ToUnicode(const char *zFilename){ nChar = MultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename, nChar); if( nChar==0 ){ - sqlite3_free(zWideFilename); + tdsqlite3_free(zWideFilename); zWideFilename = 0; } return zWideFilename; @@ -201435,17 +201435,17 @@ static LPWSTR rbuWinUtf8ToUnicode(const char *zFilename){ ** If an error occurs, leave an error code and error message in the rbu ** handle. */ -static void rbuMoveOalFile(sqlite3rbu *p){ - const char *zBase = sqlite3_db_filename(p->dbMain, "main"); +static void rbuMoveOalFile(tdsqlite3rbu *p){ + const char *zBase = tdsqlite3_db_filename(p->dbMain, "main"); const char *zMove = zBase; char *zOal; char *zWal; if( rbuIsVacuum(p) ){ - zMove = sqlite3_db_filename(p->dbRbu, "main"); + zMove = tdsqlite3_db_filename(p->dbRbu, "main"); } - zOal = sqlite3_mprintf("%s-oal", zMove); - zWal = sqlite3_mprintf("%s-wal", zMove); + zOal = tdsqlite3_mprintf("%s-oal", zMove); + zWal = tdsqlite3_mprintf("%s-wal", zMove); assert( p->eStage==RBU_STAGE_MOVE ); assert( p->rc==SQLITE_OK && p->zErrmsg==0 ); @@ -201466,8 +201466,8 @@ static void rbuMoveOalFile(sqlite3rbu *p){ /* Re-open the databases. */ rbuObjIterFinalize(&p->objiter); - sqlite3_close(p->dbRbu); - sqlite3_close(p->dbMain); + tdsqlite3_close(p->dbRbu); + tdsqlite3_close(p->dbMain); p->dbMain = 0; p->dbRbu = 0; @@ -201485,11 +201485,11 @@ static void rbuMoveOalFile(sqlite3rbu *p){ }else{ p->rc = SQLITE_IOERR; } - sqlite3_free(zWideWal); + tdsqlite3_free(zWideWal); }else{ p->rc = SQLITE_IOERR_NOMEM; } - sqlite3_free(zWideOal); + tdsqlite3_free(zWideOal); }else{ p->rc = SQLITE_IOERR_NOMEM; } @@ -201505,8 +201505,8 @@ static void rbuMoveOalFile(sqlite3rbu *p){ } } - sqlite3_free(zWal); - sqlite3_free(zOal); + tdsqlite3_free(zWal); + tdsqlite3_free(zOal); } /* @@ -201526,13 +201526,13 @@ static void rbuMoveOalFile(sqlite3rbu *p){ ** If the rbu_control field contains an invalid value, an error code and ** message are left in the RBU handle and zero returned. */ -static int rbuStepType(sqlite3rbu *p, const char **pzMask){ +static int rbuStepType(tdsqlite3rbu *p, const char **pzMask){ int iCol = p->objiter.nCol; /* Index of rbu_control column */ int res = 0; /* Return value */ - switch( sqlite3_column_type(p->objiter.pSelect, iCol) ){ + switch( tdsqlite3_column_type(p->objiter.pSelect, iCol) ){ case SQLITE_INTEGER: { - int iVal = sqlite3_column_int(p->objiter.pSelect, iCol); + int iVal = tdsqlite3_column_int(p->objiter.pSelect, iCol); switch( iVal ){ case 0: res = RBU_INSERT; break; case 1: res = RBU_DELETE; break; @@ -201544,7 +201544,7 @@ static int rbuStepType(sqlite3rbu *p, const char **pzMask){ } case SQLITE_TEXT: { - const unsigned char *z = sqlite3_column_text(p->objiter.pSelect, iCol); + const unsigned char *z = tdsqlite3_column_text(p->objiter.pSelect, iCol); if( z==0 ){ p->rc = SQLITE_NOMEM; }else{ @@ -201569,9 +201569,9 @@ static int rbuStepType(sqlite3rbu *p, const char **pzMask){ /* ** Assert that column iCol of statement pStmt is named zName. */ -static void assertColumnName(sqlite3_stmt *pStmt, int iCol, const char *zName){ - const char *zCol = sqlite3_column_name(pStmt, iCol); - assert( 0==sqlite3_stricmp(zName, zCol) ); +static void assertColumnName(tdsqlite3_stmt *pStmt, int iCol, const char *zName){ + const char *zCol = tdsqlite3_column_name(pStmt, iCol); + assert( 0==tdsqlite3_stricmp(zName, zCol) ); } #else # define assertColumnName(x,y,z) @@ -201580,12 +201580,12 @@ static void assertColumnName(sqlite3_stmt *pStmt, int iCol, const char *zName){ /* ** Argument eType must be one of RBU_INSERT, RBU_DELETE, RBU_IDX_INSERT or ** RBU_IDX_DELETE. This function performs the work of a single -** sqlite3rbu_step() call for the type of operation specified by eType. +** tdsqlite3rbu_step() call for the type of operation specified by eType. */ -static void rbuStepOneOp(sqlite3rbu *p, int eType){ +static void rbuStepOneOp(tdsqlite3rbu *p, int eType){ RbuObjIter *pIter = &p->objiter; - sqlite3_value *pVal; - sqlite3_stmt *pWriter; + tdsqlite3_value *pVal; + tdsqlite3_stmt *pWriter; int i; assert( p->rc==SQLITE_OK ); @@ -201614,10 +201614,10 @@ static void rbuStepOneOp(sqlite3rbu *p, int eType){ ** to write a NULL into the IPK column. That is not permitted. */ if( eType==RBU_INSERT && pIter->zIdx==0 && pIter->eType==RBU_PK_IPK && pIter->abTblPk[i] - && sqlite3_column_type(pIter->pSelect, i)==SQLITE_NULL + && tdsqlite3_column_type(pIter->pSelect, i)==SQLITE_NULL ){ p->rc = SQLITE_MISMATCH; - p->zErrmsg = sqlite3_mprintf("datatype mismatch"); + p->zErrmsg = tdsqlite3_mprintf("datatype mismatch"); return; } @@ -201625,8 +201625,8 @@ static void rbuStepOneOp(sqlite3rbu *p, int eType){ continue; } - pVal = sqlite3_column_value(pIter->pSelect, i); - p->rc = sqlite3_bind_value(pWriter, i+1, pVal); + pVal = tdsqlite3_column_value(pIter->pSelect, i); + p->rc = tdsqlite3_bind_value(pWriter, i+1, pVal); if( p->rc ) return; } if( pIter->zIdx==0 ){ @@ -201644,18 +201644,18 @@ static void rbuStepOneOp(sqlite3rbu *p, int eType){ assertColumnName(pIter->pSelect, pIter->nCol+1, rbuIsVacuum(p) ? "rowid" : "rbu_rowid" ); - pVal = sqlite3_column_value(pIter->pSelect, pIter->nCol+1); - p->rc = sqlite3_bind_value(pWriter, pIter->nCol+1, pVal); + pVal = tdsqlite3_column_value(pIter->pSelect, pIter->nCol+1); + p->rc = tdsqlite3_bind_value(pWriter, pIter->nCol+1, pVal); } } if( p->rc==SQLITE_OK ){ - sqlite3_step(pWriter); + tdsqlite3_step(pWriter); p->rc = resetAndCollectError(pWriter, &p->zErrmsg); } } /* -** This function does the work for an sqlite3rbu_step() call. +** This function does the work for an tdsqlite3rbu_step() call. ** ** The object-iterator (p->objiter) currently points to a valid object, ** and the input cursor (p->objiter.pSelect) currently points to a valid @@ -201665,7 +201665,7 @@ static void rbuStepOneOp(sqlite3rbu *p, int eType){ ** and message is left in the RBU handle and a copy of the error code ** returned. */ -static int rbuStep(sqlite3rbu *p){ +static int rbuStep(tdsqlite3rbu *p){ RbuObjIter *pIter = &p->objiter; const char *zMask = 0; int eType = rbuStepType(p, &zMask); @@ -201691,8 +201691,8 @@ static int rbuStep(sqlite3rbu *p){ rbuStepOneOp(p, eType); } else{ - sqlite3_value *pVal; - sqlite3_stmt *pUpdate = 0; + tdsqlite3_value *pVal; + tdsqlite3_stmt *pUpdate = 0; assert( eType==RBU_UPDATE ); p->nPhaseOneStep -= p->objiter.nIndex; rbuGetUpdateStmt(p, pIter, zMask, &pUpdate); @@ -201700,9 +201700,9 @@ static int rbuStep(sqlite3rbu *p){ int i; for(i=0; p->rc==SQLITE_OK && inCol; i++){ char c = zMask[pIter->aiSrcOrder[i]]; - pVal = sqlite3_column_value(pIter->pSelect, i); + pVal = tdsqlite3_column_value(pIter->pSelect, i); if( pIter->abTblPk[i] || c!='.' ){ - p->rc = sqlite3_bind_value(pUpdate, i+1, pVal); + p->rc = tdsqlite3_bind_value(pUpdate, i+1, pVal); } } if( p->rc==SQLITE_OK @@ -201710,11 +201710,11 @@ static int rbuStep(sqlite3rbu *p){ ){ /* Bind the rbu_rowid value to column _rowid_ */ assertColumnName(pIter->pSelect, pIter->nCol+1, "rbu_rowid"); - pVal = sqlite3_column_value(pIter->pSelect, pIter->nCol+1); - p->rc = sqlite3_bind_value(pUpdate, pIter->nCol+1, pVal); + pVal = tdsqlite3_column_value(pIter->pSelect, pIter->nCol+1); + p->rc = tdsqlite3_bind_value(pUpdate, pIter->nCol+1, pVal); } if( p->rc==SQLITE_OK ){ - sqlite3_step(pUpdate); + tdsqlite3_step(pUpdate); p->rc = resetAndCollectError(pUpdate, &p->zErrmsg); } } @@ -201730,23 +201730,23 @@ static int rbuStep(sqlite3rbu *p){ ** opened by p->dbMain to one more than the schema cookie of the main ** db opened by p->dbRbu. */ -static void rbuIncrSchemaCookie(sqlite3rbu *p){ +static void rbuIncrSchemaCookie(tdsqlite3rbu *p){ if( p->rc==SQLITE_OK ){ - sqlite3 *dbread = (rbuIsVacuum(p) ? p->dbRbu : p->dbMain); + tdsqlite3 *dbread = (rbuIsVacuum(p) ? p->dbRbu : p->dbMain); int iCookie = 1000000; - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; p->rc = prepareAndCollectError(dbread, &pStmt, &p->zErrmsg, "PRAGMA schema_version" ); if( p->rc==SQLITE_OK ){ - /* Coverage: it may be that this sqlite3_step() cannot fail. There + /* Coverage: it may be that this tdsqlite3_step() cannot fail. There ** is already a transaction open, so the prepared statement cannot ** throw an SQLITE_SCHEMA exception. The only database page the ** statement reads is page 1, which is guaranteed to be in the cache. ** And no memory allocations are required. */ - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - iCookie = sqlite3_column_int(pStmt, 0); + if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + iCookie = tdsqlite3_column_int(pStmt, 0); } rbuFinalize(p, pStmt); } @@ -201761,15 +201761,15 @@ static void rbuIncrSchemaCookie(sqlite3rbu *p){ ** value stored in the RBU_STATE_STAGE column is eStage. All other values ** are determined by inspecting the rbu handle passed as the first argument. */ -static void rbuSaveState(sqlite3rbu *p, int eStage){ +static void rbuSaveState(tdsqlite3rbu *p, int eStage){ if( p->rc==SQLITE_OK || p->rc==SQLITE_DONE ){ - sqlite3_stmt *pInsert = 0; + tdsqlite3_stmt *pInsert = 0; rbu_file *pFd = (rbuIsVacuum(p) ? p->pRbuFd : p->pTargetFd); int rc; assert( p->zErrmsg==0 ); rc = prepareFreeAndCollectError(p->dbRbu, &pInsert, &p->zErrmsg, - sqlite3_mprintf( + tdsqlite3_mprintf( "INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES " "(%d, %d), " "(%d, %Q), " @@ -201797,8 +201797,8 @@ static void rbuSaveState(sqlite3rbu *p, int eStage){ assert( pInsert==0 || rc==SQLITE_OK ); if( rc==SQLITE_OK ){ - sqlite3_step(pInsert); - rc = sqlite3_finalize(pInsert); + tdsqlite3_step(pInsert); + rc = tdsqlite3_finalize(pInsert); } if( rc!=SQLITE_OK ) p->rc = rc; } @@ -201808,12 +201808,12 @@ static void rbuSaveState(sqlite3rbu *p, int eStage){ /* ** The second argument passed to this function is the name of a PRAGMA ** setting - "page_size", "auto_vacuum", "user_version" or "application_id". -** This function executes the following on sqlite3rbu.dbRbu: +** This function executes the following on tdsqlite3rbu.dbRbu: ** ** "PRAGMA main.$zPragma" ** ** where $zPragma is the string passed as the second argument, then -** on sqlite3rbu.dbMain: +** on tdsqlite3rbu.dbMain: ** ** "PRAGMA main.$zPragma = $val" ** @@ -201822,15 +201822,15 @@ static void rbuSaveState(sqlite3rbu *p, int eStage){ ** In short, it copies the value of the specified PRAGMA setting from ** dbRbu to dbMain. */ -static void rbuCopyPragma(sqlite3rbu *p, const char *zPragma){ +static void rbuCopyPragma(tdsqlite3rbu *p, const char *zPragma){ if( p->rc==SQLITE_OK ){ - sqlite3_stmt *pPragma = 0; + tdsqlite3_stmt *pPragma = 0; p->rc = prepareFreeAndCollectError(p->dbRbu, &pPragma, &p->zErrmsg, - sqlite3_mprintf("PRAGMA main.%s", zPragma) + tdsqlite3_mprintf("PRAGMA main.%s", zPragma) ); - if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pPragma) ){ + if( p->rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pPragma) ){ p->rc = rbuMPrintfExec(p, p->dbMain, "PRAGMA main.%s = %d", - zPragma, sqlite3_column_int(pPragma, 0) + zPragma, tdsqlite3_column_int(pPragma, 0) ); } rbuFinalize(p, pPragma); @@ -201842,12 +201842,12 @@ static void rbuCopyPragma(sqlite3rbu *p, const char *zPragma){ ** the state database is empty. If this RBU handle was opened for an ** RBU vacuum operation, create the schema in the target db. */ -static void rbuCreateTargetSchema(sqlite3rbu *p){ - sqlite3_stmt *pSql = 0; - sqlite3_stmt *pInsert = 0; +static void rbuCreateTargetSchema(tdsqlite3rbu *p){ + tdsqlite3_stmt *pSql = 0; + tdsqlite3_stmt *pInsert = 0; assert( rbuIsVacuum(p) ); - p->rc = sqlite3_exec(p->dbMain, "PRAGMA writable_schema=1", 0,0, &p->zErrmsg); + p->rc = tdsqlite3_exec(p->dbMain, "PRAGMA writable_schema=1", 0,0, &p->zErrmsg); if( p->rc==SQLITE_OK ){ p->rc = prepareAndCollectError(p->dbRbu, &pSql, &p->zErrmsg, "SELECT sql FROM sqlite_master WHERE sql!='' AND rootpage!=0" @@ -201856,9 +201856,9 @@ static void rbuCreateTargetSchema(sqlite3rbu *p){ ); } - while( p->rc==SQLITE_OK && sqlite3_step(pSql)==SQLITE_ROW ){ - const char *zSql = (const char*)sqlite3_column_text(pSql, 0); - p->rc = sqlite3_exec(p->dbMain, zSql, 0, 0, &p->zErrmsg); + while( p->rc==SQLITE_OK && tdsqlite3_step(pSql)==SQLITE_ROW ){ + const char *zSql = (const char*)tdsqlite3_column_text(pSql, 0); + p->rc = tdsqlite3_exec(p->dbMain, zSql, 0, 0, &p->zErrmsg); } rbuFinalize(p, pSql); if( p->rc!=SQLITE_OK ) return; @@ -201875,16 +201875,16 @@ static void rbuCreateTargetSchema(sqlite3rbu *p){ ); } - while( p->rc==SQLITE_OK && sqlite3_step(pSql)==SQLITE_ROW ){ + while( p->rc==SQLITE_OK && tdsqlite3_step(pSql)==SQLITE_ROW ){ int i; for(i=0; i<5; i++){ - sqlite3_bind_value(pInsert, i+1, sqlite3_column_value(pSql, i)); + tdsqlite3_bind_value(pInsert, i+1, tdsqlite3_column_value(pSql, i)); } - sqlite3_step(pInsert); - p->rc = sqlite3_reset(pInsert); + tdsqlite3_step(pInsert); + p->rc = tdsqlite3_reset(pInsert); } if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_exec(p->dbMain, "PRAGMA writable_schema=0",0,0,&p->zErrmsg); + p->rc = tdsqlite3_exec(p->dbMain, "PRAGMA writable_schema=0",0,0,&p->zErrmsg); } rbuFinalize(p, pSql); @@ -201894,7 +201894,7 @@ static void rbuCreateTargetSchema(sqlite3rbu *p){ /* ** Step the RBU object. */ -SQLITE_API int sqlite3rbu_step(sqlite3rbu *p){ +SQLITE_API int tdsqlite3rbu_step(tdsqlite3rbu *p){ if( p ){ switch( p->eStage ){ case RBU_STAGE_OAL: { @@ -201924,13 +201924,13 @@ SQLITE_API int sqlite3rbu_step(sqlite3rbu *p){ /* Advance to the next row to process. */ if( p->rc==SQLITE_OK ){ - int rc = sqlite3_step(pIter->pSelect); + int rc = tdsqlite3_step(pIter->pSelect); if( rc==SQLITE_ROW ){ p->nProgress++; p->nStep++; return rbuStep(p); } - p->rc = sqlite3_reset(pIter->pSelect); + p->rc = tdsqlite3_reset(pIter->pSelect); p->nStep = 0; } } @@ -201943,10 +201943,10 @@ SQLITE_API int sqlite3rbu_step(sqlite3rbu *p){ rbuSaveState(p, RBU_STAGE_MOVE); rbuIncrSchemaCookie(p); if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_exec(p->dbMain, "COMMIT", 0, 0, &p->zErrmsg); + p->rc = tdsqlite3_exec(p->dbMain, "COMMIT", 0, 0, &p->zErrmsg); } if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_exec(p->dbRbu, "COMMIT", 0, 0, &p->zErrmsg); + p->rc = tdsqlite3_exec(p->dbRbu, "COMMIT", 0, 0, &p->zErrmsg); } p->eStage = RBU_STAGE_MOVE; } @@ -201964,7 +201964,7 @@ SQLITE_API int sqlite3rbu_step(sqlite3rbu *p){ case RBU_STAGE_CKPT: { if( p->rc==SQLITE_OK ){ if( p->nStep>=p->nFrame ){ - sqlite3_file *pDb = p->pTargetFd->pReal; + tdsqlite3_file *pDb = p->pTargetFd->pReal; /* Sync the db file */ p->rc = pDb->pMethods->xSync(pDb, SQLITE_SYNC_NORMAL); @@ -201984,11 +201984,11 @@ SQLITE_API int sqlite3rbu_step(sqlite3rbu *p){ } }else{ /* At one point the following block copied a single frame from the - ** wal file to the database file. So that one call to sqlite3rbu_step() + ** wal file to the database file. So that one call to tdsqlite3rbu_step() ** checkpointed a single frame. ** ** However, if the sector-size is larger than the page-size, and the - ** application calls sqlite3rbu_savestate() or close() immediately + ** application calls tdsqlite3rbu_savestate() or close() immediately ** after this step, then rbu_step() again, then a power failure occurs, ** then the database page written here may be damaged. Work around ** this by checkpointing frames until the next page in the aFrame[] @@ -202026,20 +202026,20 @@ SQLITE_API int sqlite3rbu_step(sqlite3rbu *p){ static int rbuStrCompare(const char *z1, const char *z2){ if( z1==0 && z2==0 ) return 0; if( z1==0 || z2==0 ) return 1; - return (sqlite3_stricmp(z1, z2)!=0); + return (tdsqlite3_stricmp(z1, z2)!=0); } /* -** This function is called as part of sqlite3rbu_open() when initializing +** This function is called as part of tdsqlite3rbu_open() when initializing ** an rbu handle in OAL stage. If the rbu update has not started (i.e. ** the rbu_state table was empty) it is a no-op. Otherwise, it arranges -** things so that the next call to sqlite3rbu_step() continues on from +** things so that the next call to tdsqlite3rbu_step() continues on from ** where the previous rbu handle left off. ** ** If an error occurs, an error code and error message are left in the ** rbu handle passed as the first argument. */ -static void rbuSetupOal(sqlite3rbu *p, RbuState *pState){ +static void rbuSetupOal(tdsqlite3rbu *p, RbuState *pState){ assert( p->rc==SQLITE_OK ); if( pState->zTbl ){ RbuObjIter *pIter = &p->objiter; @@ -202055,7 +202055,7 @@ static void rbuSetupOal(sqlite3rbu *p, RbuState *pState){ if( rc==SQLITE_OK && !pIter->zTbl ){ rc = SQLITE_ERROR; - p->zErrmsg = sqlite3_mprintf("rbu_state mismatch error"); + p->zErrmsg = tdsqlite3_mprintf("rbu_state mismatch error"); } if( rc==SQLITE_OK ){ @@ -202072,32 +202072,32 @@ static void rbuSetupOal(sqlite3rbu *p, RbuState *pState){ ** target database in the file-system, delete it. If an error occurs, ** leave an error code and error message in the rbu handle. */ -static void rbuDeleteOalFile(sqlite3rbu *p){ +static void rbuDeleteOalFile(tdsqlite3rbu *p){ char *zOal = rbuMPrintf(p, "%s-oal", p->zTarget); if( zOal ){ - sqlite3_vfs *pVfs = sqlite3_vfs_find(0); + tdsqlite3_vfs *pVfs = tdsqlite3_vfs_find(0); assert( pVfs && p->rc==SQLITE_OK && p->zErrmsg==0 ); pVfs->xDelete(pVfs, zOal, 0); - sqlite3_free(zOal); + tdsqlite3_free(zOal); } } /* ** Allocate a private rbu VFS for the rbu handle passed as the only -** argument. This VFS will be used unless the call to sqlite3rbu_open() +** argument. This VFS will be used unless the call to tdsqlite3rbu_open() ** specified a URI with a vfs=? option in place of a target database ** file name. */ -static void rbuCreateVfs(sqlite3rbu *p){ +static void rbuCreateVfs(tdsqlite3rbu *p){ int rnd; char zRnd[64]; assert( p->rc==SQLITE_OK ); - sqlite3_randomness(sizeof(int), (void*)&rnd); - sqlite3_snprintf(sizeof(zRnd), zRnd, "rbu_vfs_%d", rnd); - p->rc = sqlite3rbu_create_vfs(zRnd, 0); + tdsqlite3_randomness(sizeof(int), (void*)&rnd); + tdsqlite3_snprintf(sizeof(zRnd), zRnd, "rbu_vfs_%d", rnd); + p->rc = tdsqlite3rbu_create_vfs(zRnd, 0); if( p->rc==SQLITE_OK ){ - sqlite3_vfs *pVfs = sqlite3_vfs_find(zRnd); + tdsqlite3_vfs *pVfs = tdsqlite3_vfs_find(zRnd); assert( pVfs ); p->zVfsName = pVfs->zName; ((rbu_vfs*)pVfs)->pRbu = p; @@ -202108,9 +202108,9 @@ static void rbuCreateVfs(sqlite3rbu *p){ ** Destroy the private VFS created for the rbu handle passed as the only ** argument by an earlier call to rbuCreateVfs(). */ -static void rbuDeleteVfs(sqlite3rbu *p){ +static void rbuDeleteVfs(tdsqlite3rbu *p){ if( p->zVfsName ){ - sqlite3rbu_destroy_vfs(p->zVfsName); + tdsqlite3rbu_destroy_vfs(p->zVfsName); p->zVfsName = 0; } } @@ -202121,43 +202121,43 @@ static void rbuDeleteVfs(sqlite3rbu *p){ ** the number of auxilliary indexes on the table. */ static void rbuIndexCntFunc( - sqlite3_context *pCtx, + tdsqlite3_context *pCtx, int nVal, - sqlite3_value **apVal + tdsqlite3_value **apVal ){ - sqlite3rbu *p = (sqlite3rbu*)sqlite3_user_data(pCtx); - sqlite3_stmt *pStmt = 0; + tdsqlite3rbu *p = (tdsqlite3rbu*)tdsqlite3_user_data(pCtx); + tdsqlite3_stmt *pStmt = 0; char *zErrmsg = 0; int rc; - sqlite3 *db = (rbuIsVacuum(p) ? p->dbRbu : p->dbMain); + tdsqlite3 *db = (rbuIsVacuum(p) ? p->dbRbu : p->dbMain); assert( nVal==1 ); rc = prepareFreeAndCollectError(db, &pStmt, &zErrmsg, - sqlite3_mprintf("SELECT count(*) FROM sqlite_master " - "WHERE type='index' AND tbl_name = %Q", sqlite3_value_text(apVal[0])) + tdsqlite3_mprintf("SELECT count(*) FROM sqlite_master " + "WHERE type='index' AND tbl_name = %Q", tdsqlite3_value_text(apVal[0])) ); if( rc!=SQLITE_OK ){ - sqlite3_result_error(pCtx, zErrmsg, -1); + tdsqlite3_result_error(pCtx, zErrmsg, -1); }else{ int nIndex = 0; - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - nIndex = sqlite3_column_int(pStmt, 0); + if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + nIndex = tdsqlite3_column_int(pStmt, 0); } - rc = sqlite3_finalize(pStmt); + rc = tdsqlite3_finalize(pStmt); if( rc==SQLITE_OK ){ - sqlite3_result_int(pCtx, nIndex); + tdsqlite3_result_int(pCtx, nIndex); }else{ - sqlite3_result_error(pCtx, sqlite3_errmsg(db), -1); + tdsqlite3_result_error(pCtx, tdsqlite3_errmsg(db), -1); } } - sqlite3_free(zErrmsg); + tdsqlite3_free(zErrmsg); } /* ** If the RBU database contains the rbu_count table, use it to initialize -** the sqlite3rbu.nPhaseOneStep variable. The schema of the rbu_count table +** the tdsqlite3rbu.nPhaseOneStep variable. The schema of the rbu_count table ** is assumed to contain the same columns as: ** ** CREATE TABLE rbu_count(tbl TEXT PRIMARY KEY, cnt INTEGER) WITHOUT ROWID; @@ -202166,18 +202166,18 @@ static void rbuIndexCntFunc( ** database. The 'tbl' column should contain the name of a data_xxx table, ** and the cnt column the number of rows it contains. ** -** sqlite3rbu.nPhaseOneStep is initialized to the sum of (1 + nIndex) * cnt +** tdsqlite3rbu.nPhaseOneStep is initialized to the sum of (1 + nIndex) * cnt ** for all rows in the rbu_count table, where nIndex is the number of ** indexes on the corresponding target database table. */ -static void rbuInitPhaseOneSteps(sqlite3rbu *p){ +static void rbuInitPhaseOneSteps(tdsqlite3rbu *p){ if( p->rc==SQLITE_OK ){ - sqlite3_stmt *pStmt = 0; + tdsqlite3_stmt *pStmt = 0; int bExists = 0; /* True if rbu_count exists */ p->nPhaseOneStep = -1; - p->rc = sqlite3_create_function(p->dbRbu, + p->rc = tdsqlite3_create_function(p->dbRbu, "rbu_index_cnt", 1, SQLITE_UTF8, (void*)p, rbuIndexCntFunc, 0, 0 ); @@ -202189,10 +202189,10 @@ static void rbuInitPhaseOneSteps(sqlite3rbu *p){ ); } if( p->rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pStmt) ){ + if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ bExists = 1; } - p->rc = sqlite3_finalize(pStmt); + p->rc = tdsqlite3_finalize(pStmt); } if( p->rc==SQLITE_OK && bExists ){ @@ -202201,32 +202201,32 @@ static void rbuInitPhaseOneSteps(sqlite3rbu *p){ "FROM rbu_count" ); if( p->rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - p->nPhaseOneStep = sqlite3_column_int64(pStmt, 0); + if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + p->nPhaseOneStep = tdsqlite3_column_int64(pStmt, 0); } - p->rc = sqlite3_finalize(pStmt); + p->rc = tdsqlite3_finalize(pStmt); } } } } -static sqlite3rbu *openRbuHandle( +static tdsqlite3rbu *openRbuHandle( const char *zTarget, const char *zRbu, const char *zState ){ - sqlite3rbu *p; + tdsqlite3rbu *p; size_t nTarget = zTarget ? strlen(zTarget) : 0; size_t nRbu = strlen(zRbu); - size_t nByte = sizeof(sqlite3rbu) + nTarget+1 + nRbu+1; + size_t nByte = sizeof(tdsqlite3rbu) + nTarget+1 + nRbu+1; - p = (sqlite3rbu*)sqlite3_malloc64(nByte); + p = (tdsqlite3rbu*)tdsqlite3_malloc64(nByte); if( p ){ RbuState *pState = 0; /* Create the custom VFS. */ - memset(p, 0, sizeof(sqlite3rbu)); + memset(p, 0, sizeof(tdsqlite3rbu)); rbuCreateVfs(p); /* Open the target, RBU and state databases */ @@ -202280,7 +202280,7 @@ static sqlite3rbu *openRbuHandle( if( p->rc==SQLITE_OK && p->pTargetFd->pWalFd ){ if( p->eStage==RBU_STAGE_OAL ){ p->rc = SQLITE_ERROR; - p->zErrmsg = sqlite3_mprintf("cannot update wal mode database"); + p->zErrmsg = tdsqlite3_mprintf("cannot update wal mode database"); }else if( p->eStage==RBU_STAGE_MOVE ){ p->eStage = RBU_STAGE_CKPT; p->nStep = 0; @@ -202298,7 +202298,7 @@ static sqlite3rbu *openRbuHandle( ** transaction is committed in rollback mode) currently stored on ** page 1 of the database file. */ p->rc = SQLITE_BUSY; - p->zErrmsg = sqlite3_mprintf("database modified during rbu %s", + p->zErrmsg = tdsqlite3_mprintf("database modified during rbu %s", (rbuIsVacuum(p) ? "vacuum" : "update") ); } @@ -202306,8 +202306,8 @@ static sqlite3rbu *openRbuHandle( if( p->rc==SQLITE_OK ){ if( p->eStage==RBU_STAGE_OAL ){ - sqlite3 *db = p->dbMain; - p->rc = sqlite3_exec(p->dbRbu, "BEGIN", 0, 0, &p->zErrmsg); + tdsqlite3 *db = p->dbMain; + p->rc = tdsqlite3_exec(p->dbRbu, "BEGIN", 0, 0, &p->zErrmsg); /* Point the object iterator at the first object */ if( p->rc==SQLITE_OK ){ @@ -202328,16 +202328,16 @@ static sqlite3rbu *openRbuHandle( /* Open transactions both databases. The *-oal file is opened or ** created at this point. */ if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_exec(db, "BEGIN IMMEDIATE", 0, 0, &p->zErrmsg); + p->rc = tdsqlite3_exec(db, "BEGIN IMMEDIATE", 0, 0, &p->zErrmsg); } /* Check if the main database is a zipvfs db. If it is, set the upper ** level pager to use "journal_mode=off". This prevents it from ** generating a large journal using a temp file. */ if( p->rc==SQLITE_OK ){ - int frc = sqlite3_file_control(db, "main", SQLITE_FCNTL_ZIPVFS, 0); + int frc = tdsqlite3_file_control(db, "main", SQLITE_FCNTL_ZIPVFS, 0); if( frc==SQLITE_OK ){ - p->rc = sqlite3_exec( + p->rc = tdsqlite3_exec( db, "PRAGMA journal_mode=off",0,0,&p->zErrmsg); } } @@ -202367,11 +202367,11 @@ static sqlite3rbu *openRbuHandle( ** Allocate and return an RBU handle with all fields zeroed except for the ** error code, which is set to SQLITE_MISUSE. */ -static sqlite3rbu *rbuMisuseError(void){ - sqlite3rbu *pRet; - pRet = sqlite3_malloc64(sizeof(sqlite3rbu)); +static tdsqlite3rbu *rbuMisuseError(void){ + tdsqlite3rbu *pRet; + pRet = tdsqlite3_malloc64(sizeof(tdsqlite3rbu)); if( pRet ){ - memset(pRet, 0, sizeof(sqlite3rbu)); + memset(pRet, 0, sizeof(tdsqlite3rbu)); pRet->rc = SQLITE_MISUSE; } return pRet; @@ -202380,7 +202380,7 @@ static sqlite3rbu *rbuMisuseError(void){ /* ** Open and return a new RBU handle. */ -SQLITE_API sqlite3rbu *sqlite3rbu_open( +SQLITE_API tdsqlite3rbu *tdsqlite3rbu_open( const char *zTarget, const char *zRbu, const char *zState @@ -202393,7 +202393,7 @@ SQLITE_API sqlite3rbu *sqlite3rbu_open( /* ** Open a handle to begin or resume an RBU VACUUM operation. */ -SQLITE_API sqlite3rbu *sqlite3rbu_vacuum( +SQLITE_API tdsqlite3rbu *tdsqlite3rbu_vacuum( const char *zTarget, const char *zState ){ @@ -202411,8 +202411,8 @@ SQLITE_API sqlite3rbu *sqlite3rbu_vacuum( /* ** Return the database handle used by pRbu. */ -SQLITE_API sqlite3 *sqlite3rbu_db(sqlite3rbu *pRbu, int bRbu){ - sqlite3 *db = 0; +SQLITE_API tdsqlite3 *tdsqlite3rbu_db(tdsqlite3rbu *pRbu, int bRbu){ + tdsqlite3 *db = 0; if( pRbu ){ db = (bRbu ? pRbu->dbRbu : pRbu->dbMain); } @@ -202425,7 +202425,7 @@ SQLITE_API sqlite3 *sqlite3rbu_db(sqlite3rbu *pRbu, int bRbu){ ** then edit any error message string so as to remove all occurrences of ** the pattern "rbu_imp_[0-9]*". */ -static void rbuEditErrmsg(sqlite3rbu *p){ +static void rbuEditErrmsg(tdsqlite3rbu *p){ if( p->rc==SQLITE_CONSTRAINT && p->zErrmsg ){ unsigned int i; size_t nErrmsg = strlen(p->zErrmsg); @@ -202443,25 +202443,25 @@ static void rbuEditErrmsg(sqlite3rbu *p){ /* ** Close the RBU handle. */ -SQLITE_API int sqlite3rbu_close(sqlite3rbu *p, char **pzErrmsg){ +SQLITE_API int tdsqlite3rbu_close(tdsqlite3rbu *p, char **pzErrmsg){ int rc; if( p ){ /* Commit the transaction to the *-oal file. */ if( p->rc==SQLITE_OK && p->eStage==RBU_STAGE_OAL ){ - p->rc = sqlite3_exec(p->dbMain, "COMMIT", 0, 0, &p->zErrmsg); + p->rc = tdsqlite3_exec(p->dbMain, "COMMIT", 0, 0, &p->zErrmsg); } /* Sync the db file if currently doing an incremental checkpoint */ if( p->rc==SQLITE_OK && p->eStage==RBU_STAGE_CKPT ){ - sqlite3_file *pDb = p->pTargetFd->pReal; + tdsqlite3_file *pDb = p->pTargetFd->pReal; p->rc = pDb->pMethods->xSync(pDb, SQLITE_SYNC_NORMAL); } rbuSaveState(p, p->eStage); if( p->rc==SQLITE_OK && p->eStage==RBU_STAGE_OAL ){ - p->rc = sqlite3_exec(p->dbRbu, "COMMIT", 0, 0, &p->zErrmsg); + p->rc = tdsqlite3_exec(p->dbRbu, "COMMIT", 0, 0, &p->zErrmsg); } /* Close any open statement handles. */ @@ -202469,31 +202469,31 @@ SQLITE_API int sqlite3rbu_close(sqlite3rbu *p, char **pzErrmsg){ /* If this is an RBU vacuum handle and the vacuum has either finished ** successfully or encountered an error, delete the contents of the - ** state table. This causes the next call to sqlite3rbu_vacuum() + ** state table. This causes the next call to tdsqlite3rbu_vacuum() ** specifying the current target and state databases to start a new ** vacuum from scratch. */ if( rbuIsVacuum(p) && p->rc!=SQLITE_OK && p->dbRbu ){ - int rc2 = sqlite3_exec(p->dbRbu, "DELETE FROM stat.rbu_state", 0, 0, 0); + int rc2 = tdsqlite3_exec(p->dbRbu, "DELETE FROM stat.rbu_state", 0, 0, 0); if( p->rc==SQLITE_DONE && rc2!=SQLITE_OK ) p->rc = rc2; } /* Close the open database handle and VFS object. */ - sqlite3_close(p->dbRbu); - sqlite3_close(p->dbMain); + tdsqlite3_close(p->dbRbu); + tdsqlite3_close(p->dbMain); assert( p->szTemp==0 ); rbuDeleteVfs(p); - sqlite3_free(p->aBuf); - sqlite3_free(p->aFrame); + tdsqlite3_free(p->aBuf); + tdsqlite3_free(p->aFrame); rbuEditErrmsg(p); rc = p->rc; if( pzErrmsg ){ *pzErrmsg = p->zErrmsg; }else{ - sqlite3_free(p->zErrmsg); + tdsqlite3_free(p->zErrmsg); } - sqlite3_free(p->zState); - sqlite3_free(p); + tdsqlite3_free(p->zState); + tdsqlite3_free(p); }else{ rc = SQLITE_NOMEM; *pzErrmsg = 0; @@ -202506,7 +202506,7 @@ SQLITE_API int sqlite3rbu_close(sqlite3rbu *p, char **pzErrmsg){ ** updates) that have been performed on the target database since the ** current RBU update was started. */ -SQLITE_API sqlite3_int64 sqlite3rbu_progress(sqlite3rbu *pRbu){ +SQLITE_API tdsqlite3_int64 tdsqlite3rbu_progress(tdsqlite3rbu *pRbu){ return pRbu->nProgress; } @@ -202514,7 +202514,7 @@ SQLITE_API sqlite3_int64 sqlite3rbu_progress(sqlite3rbu *pRbu){ ** Return permyriadage progress indications for the two main stages of ** an RBU update. */ -SQLITE_API void sqlite3rbu_bp_progress(sqlite3rbu *p, int *pnOne, int *pnTwo){ +SQLITE_API void tdsqlite3rbu_bp_progress(tdsqlite3rbu *p, int *pnOne, int *pnTwo){ const int MAX_PROGRESS = 10000; switch( p->eStage ){ case RBU_STAGE_OAL: @@ -202549,7 +202549,7 @@ SQLITE_API void sqlite3rbu_bp_progress(sqlite3rbu *p, int *pnOne, int *pnTwo){ /* ** Return the current state of the RBU vacuum or update operation. */ -SQLITE_API int sqlite3rbu_state(sqlite3rbu *p){ +SQLITE_API int tdsqlite3rbu_state(tdsqlite3rbu *p){ int aRes[] = { 0, SQLITE_RBU_STATE_OAL, SQLITE_RBU_STATE_MOVE, 0, SQLITE_RBU_STATE_CHECKPOINT, SQLITE_RBU_STATE_DONE @@ -202577,19 +202577,19 @@ SQLITE_API int sqlite3rbu_state(sqlite3rbu *p){ } } -SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *p){ +SQLITE_API int tdsqlite3rbu_savestate(tdsqlite3rbu *p){ int rc = p->rc; if( rc==SQLITE_DONE ) return SQLITE_OK; assert( p->eStage>=RBU_STAGE_OAL && p->eStage<=RBU_STAGE_DONE ); if( p->eStage==RBU_STAGE_OAL ){ assert( rc!=SQLITE_DONE ); - if( rc==SQLITE_OK ) rc = sqlite3_exec(p->dbMain, "COMMIT", 0, 0, 0); + if( rc==SQLITE_OK ) rc = tdsqlite3_exec(p->dbMain, "COMMIT", 0, 0, 0); } /* Sync the db file */ if( rc==SQLITE_OK && p->eStage==RBU_STAGE_CKPT ){ - sqlite3_file *pDb = p->pTargetFd->pReal; + tdsqlite3_file *pDb = p->pTargetFd->pReal; rc = pDb->pMethods->xSync(pDb, SQLITE_SYNC_NORMAL); } @@ -202599,12 +202599,12 @@ SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *p){ if( p->eStage==RBU_STAGE_OAL ){ assert( rc!=SQLITE_DONE ); - if( rc==SQLITE_OK ) rc = sqlite3_exec(p->dbRbu, "COMMIT", 0, 0, 0); + if( rc==SQLITE_OK ) rc = tdsqlite3_exec(p->dbRbu, "COMMIT", 0, 0, 0); if( rc==SQLITE_OK ){ const char *zBegin = rbuIsVacuum(p) ? "BEGIN" : "BEGIN IMMEDIATE"; - rc = sqlite3_exec(p->dbRbu, zBegin, 0, 0, 0); + rc = tdsqlite3_exec(p->dbRbu, zBegin, 0, 0, 0); } - if( rc==SQLITE_OK ) rc = sqlite3_exec(p->dbMain, "BEGIN IMMEDIATE", 0, 0,0); + if( rc==SQLITE_OK ) rc = tdsqlite3_exec(p->dbMain, "BEGIN IMMEDIATE", 0, 0,0); } p->rc = rc; @@ -202657,7 +202657,7 @@ SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *p){ ** mode except RBU_STAGE_DONE (all work completed and checkpointed), it ** fails with an SQLITE_BUSY error. This is to stop RBU connections ** from automatically checkpointing a *-wal (or *-oal) file from within -** sqlite3_close(). +** tdsqlite3_close(). ** ** 3d. In RBU_STAGE_CAPTURE mode, all xRead() calls on the wal file, and ** all xWrite() calls on the target database file perform no IO. @@ -202673,7 +202673,7 @@ SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *p){ static void rbuUnlockShm(rbu_file *p){ assert( p->openFlags & SQLITE_OPEN_MAIN_DB ); if( p->pRbu ){ - int (*xShmLock)(sqlite3_file*,int,int,int) = p->pReal->pMethods->xShmLock; + int (*xShmLock)(tdsqlite3_file*,int,int,int) = p->pReal->pMethods->xShmLock; int i; for(i=0; ipRbu->mLock ){ @@ -202686,8 +202686,8 @@ static void rbuUnlockShm(rbu_file *p){ /* */ -static int rbuUpdateTempSize(rbu_file *pFd, sqlite3_int64 nNew){ - sqlite3rbu *pRbu = pFd->pRbu; +static int rbuUpdateTempSize(rbu_file *pFd, tdsqlite3_int64 nNew){ + tdsqlite3rbu *pRbu = pFd->pRbu; i64 nDiff = nNew - pFd->sz; pRbu->szTemp += nDiff; pFd->sz = nNew; @@ -202708,7 +202708,7 @@ static void rbuMainlistAdd(rbu_file *p){ rbu_vfs *pRbuVfs = p->pRbuVfs; rbu_file *pIter; assert( (p->openFlags & SQLITE_OPEN_MAIN_DB) ); - sqlite3_mutex_enter(pRbuVfs->mutex); + tdsqlite3_mutex_enter(pRbuVfs->mutex); if( p->pRbu==0 ){ for(pIter=pRbuVfs->pMain; pIter; pIter=pIter->pMainNext); p->pMainNext = pRbuVfs->pMain; @@ -202720,7 +202720,7 @@ static void rbuMainlistAdd(rbu_file *p){ pRbuVfs->pMainRbu = p; } } - sqlite3_mutex_leave(pRbuVfs->mutex); + tdsqlite3_mutex_leave(pRbuVfs->mutex); } /* @@ -202728,14 +202728,14 @@ static void rbuMainlistAdd(rbu_file *p){ */ static void rbuMainlistRemove(rbu_file *p){ rbu_file **pp; - sqlite3_mutex_enter(p->pRbuVfs->mutex); + tdsqlite3_mutex_enter(p->pRbuVfs->mutex); for(pp=&p->pRbuVfs->pMain; *pp && *pp!=p; pp=&((*pp)->pMainNext)){} if( *pp ) *pp = p->pMainNext; p->pMainNext = 0; for(pp=&p->pRbuVfs->pMainRbu; *pp && *pp!=p; pp=&((*pp)->pMainRbuNext)){} if( *pp ) *pp = p->pMainRbuNext; p->pMainRbuNext = 0; - sqlite3_mutex_leave(p->pRbuVfs->mutex); + tdsqlite3_mutex_leave(p->pRbuVfs->mutex); } /* @@ -202749,31 +202749,31 @@ static void rbuMainlistRemove(rbu_file *p){ */ static rbu_file *rbuFindMaindb(rbu_vfs *pRbuVfs, const char *zWal, int bRbu){ rbu_file *pDb; - sqlite3_mutex_enter(pRbuVfs->mutex); + tdsqlite3_mutex_enter(pRbuVfs->mutex); if( bRbu ){ for(pDb=pRbuVfs->pMainRbu; pDb && pDb->zWal!=zWal; pDb=pDb->pMainRbuNext){} }else{ for(pDb=pRbuVfs->pMain; pDb && pDb->zWal!=zWal; pDb=pDb->pMainNext){} } - sqlite3_mutex_leave(pRbuVfs->mutex); + tdsqlite3_mutex_leave(pRbuVfs->mutex); return pDb; } /* ** Close an rbu file. */ -static int rbuVfsClose(sqlite3_file *pFile){ +static int rbuVfsClose(tdsqlite3_file *pFile){ rbu_file *p = (rbu_file*)pFile; int rc; int i; /* Free the contents of the apShm[] array. And the array itself. */ for(i=0; inShm; i++){ - sqlite3_free(p->apShm[i]); + tdsqlite3_free(p->apShm[i]); } - sqlite3_free(p->apShm); + tdsqlite3_free(p->apShm); p->apShm = 0; - sqlite3_free(p->zDel); + tdsqlite3_free(p->zDel); if( p->openFlags & SQLITE_OPEN_MAIN_DB ){ rbuMainlistRemove(p); @@ -202822,13 +202822,13 @@ static void rbuPutU16(u8 *aBuf, u16 iVal){ ** Read data from an rbuVfs-file. */ static int rbuVfsRead( - sqlite3_file *pFile, + tdsqlite3_file *pFile, void *zBuf, int iAmt, sqlite_int64 iOfst ){ rbu_file *p = (rbu_file*)pFile; - sqlite3rbu *pRbu = p->pRbu; + tdsqlite3rbu *pRbu = p->pRbu; int rc; if( pRbu && pRbu->eStage==RBU_STAGE_CAPTURE ){ @@ -202853,7 +202853,7 @@ static int rbuVfsRead( && (p->openFlags & SQLITE_OPEN_MAIN_DB) && pRbu->rc==SQLITE_OK ){ - sqlite3_file *pFd = (sqlite3_file*)pRbu->pRbuFd; + tdsqlite3_file *pFd = (tdsqlite3_file*)pRbu->pRbuFd; rc = pFd->pMethods->xRead(pFd, zBuf, iAmt, iOfst); if( rc==SQLITE_OK ){ u8 *aBuf = (u8*)zBuf; @@ -202888,13 +202888,13 @@ static int rbuVfsRead( ** Write data to an rbuVfs-file. */ static int rbuVfsWrite( - sqlite3_file *pFile, + tdsqlite3_file *pFile, const void *zBuf, int iAmt, sqlite_int64 iOfst ){ rbu_file *p = (rbu_file*)pFile; - sqlite3rbu *pRbu = p->pRbu; + tdsqlite3rbu *pRbu = p->pRbu; int rc; if( pRbu && pRbu->eStage==RBU_STAGE_CAPTURE ){ @@ -202930,7 +202930,7 @@ static int rbuVfsWrite( /* ** Truncate an rbuVfs-file. */ -static int rbuVfsTruncate(sqlite3_file *pFile, sqlite_int64 size){ +static int rbuVfsTruncate(tdsqlite3_file *pFile, sqlite_int64 size){ rbu_file *p = (rbu_file*)pFile; if( (p->openFlags & SQLITE_OPEN_DELETEONCLOSE) && p->pRbu ){ int rc = rbuUpdateTempSize(p, size); @@ -202942,7 +202942,7 @@ static int rbuVfsTruncate(sqlite3_file *pFile, sqlite_int64 size){ /* ** Sync an rbuVfs-file. */ -static int rbuVfsSync(sqlite3_file *pFile, int flags){ +static int rbuVfsSync(tdsqlite3_file *pFile, int flags){ rbu_file *p = (rbu_file *)pFile; if( p->pRbu && p->pRbu->eStage==RBU_STAGE_CAPTURE ){ if( p->openFlags & SQLITE_OPEN_MAIN_DB ){ @@ -202956,7 +202956,7 @@ static int rbuVfsSync(sqlite3_file *pFile, int flags){ /* ** Return the current file-size of an rbuVfs-file. */ -static int rbuVfsFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){ +static int rbuVfsFileSize(tdsqlite3_file *pFile, sqlite_int64 *pSize){ rbu_file *p = (rbu_file *)pFile; int rc; rc = p->pReal->pMethods->xFileSize(p->pReal, pSize); @@ -202977,9 +202977,9 @@ static int rbuVfsFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){ /* ** Lock an rbuVfs-file. */ -static int rbuVfsLock(sqlite3_file *pFile, int eLock){ +static int rbuVfsLock(tdsqlite3_file *pFile, int eLock){ rbu_file *p = (rbu_file*)pFile; - sqlite3rbu *pRbu = p->pRbu; + tdsqlite3rbu *pRbu = p->pRbu; int rc = SQLITE_OK; assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) ); @@ -202987,7 +202987,7 @@ static int rbuVfsLock(sqlite3_file *pFile, int eLock){ && (p->bNolock || (pRbu && pRbu->eStage!=RBU_STAGE_DONE)) ){ /* Do not allow EXCLUSIVE locks. Preventing SQLite from taking this - ** prevents it from checkpointing the database from sqlite3_close(). */ + ** prevents it from checkpointing the database from tdsqlite3_close(). */ rc = SQLITE_BUSY; }else{ rc = p->pReal->pMethods->xLock(p->pReal, eLock); @@ -202999,7 +202999,7 @@ static int rbuVfsLock(sqlite3_file *pFile, int eLock){ /* ** Unlock an rbuVfs-file. */ -static int rbuVfsUnlock(sqlite3_file *pFile, int eLock){ +static int rbuVfsUnlock(tdsqlite3_file *pFile, int eLock){ rbu_file *p = (rbu_file *)pFile; return p->pReal->pMethods->xUnlock(p->pReal, eLock); } @@ -203007,7 +203007,7 @@ static int rbuVfsUnlock(sqlite3_file *pFile, int eLock){ /* ** Check if another file-handle holds a RESERVED lock on an rbuVfs-file. */ -static int rbuVfsCheckReservedLock(sqlite3_file *pFile, int *pResOut){ +static int rbuVfsCheckReservedLock(tdsqlite3_file *pFile, int *pResOut){ rbu_file *p = (rbu_file *)pFile; return p->pReal->pMethods->xCheckReservedLock(p->pReal, pResOut); } @@ -203015,16 +203015,16 @@ static int rbuVfsCheckReservedLock(sqlite3_file *pFile, int *pResOut){ /* ** File control method. For custom operations on an rbuVfs-file. */ -static int rbuVfsFileControl(sqlite3_file *pFile, int op, void *pArg){ +static int rbuVfsFileControl(tdsqlite3_file *pFile, int op, void *pArg){ rbu_file *p = (rbu_file *)pFile; - int (*xControl)(sqlite3_file*,int,void*) = p->pReal->pMethods->xFileControl; + int (*xControl)(tdsqlite3_file*,int,void*) = p->pReal->pMethods->xFileControl; int rc; assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) || p->openFlags & (SQLITE_OPEN_TRANSIENT_DB|SQLITE_OPEN_TEMP_JOURNAL) ); if( op==SQLITE_FCNTL_RBU ){ - sqlite3rbu *pRbu = (sqlite3rbu*)pArg; + tdsqlite3rbu *pRbu = (tdsqlite3rbu*)pArg; /* First try to find another RBU vfs lower down in the vfs stack. If ** one is found, this vfs will operate in pass-through mode. The lower @@ -203038,7 +203038,7 @@ static int rbuVfsFileControl(sqlite3_file *pFile, int op, void *pArg){ rc = xControl(p->pReal, SQLITE_FCNTL_ZIPVFS, &dummy); if( rc==SQLITE_OK ){ rc = SQLITE_ERROR; - pRbu->zErrmsg = sqlite3_mprintf("rbu/zipvfs setup error"); + pRbu->zErrmsg = tdsqlite3_mprintf("rbu/zipvfs setup error"); }else if( rc==SQLITE_NOTFOUND ){ pRbu->pTargetFd = p; p->pRbu = pRbu; @@ -203050,7 +203050,7 @@ static int rbuVfsFileControl(sqlite3_file *pFile, int op, void *pArg){ return rc; } else if( op==SQLITE_FCNTL_RBUCNT ){ - sqlite3rbu *pRbu = (sqlite3rbu*)pArg; + tdsqlite3rbu *pRbu = (tdsqlite3rbu*)pArg; pRbu->nRbu++; pRbu->pRbuFd = p; p->bNolock = 1; @@ -203060,7 +203060,7 @@ static int rbuVfsFileControl(sqlite3_file *pFile, int op, void *pArg){ if( rc==SQLITE_OK && op==SQLITE_FCNTL_VFSNAME ){ rbu_vfs *pRbuVfs = p->pRbuVfs; char *zIn = *(char**)pArg; - char *zOut = sqlite3_mprintf("rbu(%s)/%z", pRbuVfs->base.zName, zIn); + char *zOut = tdsqlite3_mprintf("rbu(%s)/%z", pRbuVfs->base.zName, zIn); *(char**)pArg = zOut; if( zOut==0 ) rc = SQLITE_NOMEM; } @@ -203071,7 +203071,7 @@ static int rbuVfsFileControl(sqlite3_file *pFile, int op, void *pArg){ /* ** Return the sector-size in bytes for an rbuVfs-file. */ -static int rbuVfsSectorSize(sqlite3_file *pFile){ +static int rbuVfsSectorSize(tdsqlite3_file *pFile){ rbu_file *p = (rbu_file *)pFile; return p->pReal->pMethods->xSectorSize(p->pReal); } @@ -203079,7 +203079,7 @@ static int rbuVfsSectorSize(sqlite3_file *pFile){ /* ** Return the device characteristic flags supported by an rbuVfs-file. */ -static int rbuVfsDeviceCharacteristics(sqlite3_file *pFile){ +static int rbuVfsDeviceCharacteristics(tdsqlite3_file *pFile){ rbu_file *p = (rbu_file *)pFile; return p->pReal->pMethods->xDeviceCharacteristics(p->pReal); } @@ -203087,9 +203087,9 @@ static int rbuVfsDeviceCharacteristics(sqlite3_file *pFile){ /* ** Take or release a shared-memory lock. */ -static int rbuVfsShmLock(sqlite3_file *pFile, int ofst, int n, int flags){ +static int rbuVfsShmLock(tdsqlite3_file *pFile, int ofst, int n, int flags){ rbu_file *p = (rbu_file*)pFile; - sqlite3rbu *pRbu = p->pRbu; + tdsqlite3rbu *pRbu = p->pRbu; int rc = SQLITE_OK; #ifdef SQLITE_AMALGAMATION @@ -203124,7 +203124,7 @@ static int rbuVfsShmLock(sqlite3_file *pFile, int ofst, int n, int flags){ ** Obtain a pointer to a mapping of a single 32KiB page of the *-shm file. */ static int rbuVfsShmMap( - sqlite3_file *pFile, + tdsqlite3_file *pFile, int iRegion, int szRegion, int isWrite, @@ -203139,8 +203139,8 @@ static int rbuVfsShmMap( ** instead of a file on disk. */ assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) ); if( eStage==RBU_STAGE_OAL ){ - sqlite3_int64 nByte = (iRegion+1) * sizeof(char*); - char **apNew = (char**)sqlite3_realloc64(p->apShm, nByte); + tdsqlite3_int64 nByte = (iRegion+1) * sizeof(char*); + char **apNew = (char**)tdsqlite3_realloc64(p->apShm, nByte); /* This is an RBU connection that uses its own heap memory for the ** pages of the *-shm file. Since no other process can have run @@ -203156,7 +203156,7 @@ static int rbuVfsShmMap( } if( rc==SQLITE_OK ){ - char *pNew = (char*)sqlite3_malloc64(szRegion); + char *pNew = (char*)tdsqlite3_malloc64(szRegion); if( pNew==0 ){ rc = SQLITE_NOMEM; }else{ @@ -203181,7 +203181,7 @@ static int rbuVfsShmMap( /* ** Memory barrier. */ -static void rbuVfsShmBarrier(sqlite3_file *pFile){ +static void rbuVfsShmBarrier(tdsqlite3_file *pFile){ rbu_file *p = (rbu_file *)pFile; p->pReal->pMethods->xShmBarrier(p->pReal); } @@ -203189,7 +203189,7 @@ static void rbuVfsShmBarrier(sqlite3_file *pFile){ /* ** The xShmUnmap method. */ -static int rbuVfsShmUnmap(sqlite3_file *pFile, int delFlag){ +static int rbuVfsShmUnmap(tdsqlite3_file *pFile, int delFlag){ rbu_file *p = (rbu_file*)pFile; int rc = SQLITE_OK; int eStage = (p->pRbu ? p->pRbu->eStage : 0); @@ -203209,13 +203209,13 @@ static int rbuVfsShmUnmap(sqlite3_file *pFile, int delFlag){ ** Open an rbu file handle. */ static int rbuVfsOpen( - sqlite3_vfs *pVfs, + tdsqlite3_vfs *pVfs, const char *zName, - sqlite3_file *pFile, + tdsqlite3_file *pFile, int flags, int *pOutFlags ){ - static sqlite3_io_methods rbuvfs_io_methods = { + static tdsqlite3_io_methods rbuvfs_io_methods = { 2, /* iVersion */ rbuVfsClose, /* xClose */ rbuVfsRead, /* xRead */ @@ -203236,14 +203236,14 @@ static int rbuVfsOpen( 0, 0 /* xFetch, xUnfetch */ }; rbu_vfs *pRbuVfs = (rbu_vfs*)pVfs; - sqlite3_vfs *pRealVfs = pRbuVfs->pRealVfs; + tdsqlite3_vfs *pRealVfs = pRbuVfs->pRealVfs; rbu_file *pFd = (rbu_file *)pFile; int rc = SQLITE_OK; const char *zOpen = zName; int oflags = flags; memset(pFd, 0, sizeof(rbu_file)); - pFd->pReal = (sqlite3_file*)&pFd[1]; + pFd->pReal = (tdsqlite3_file*)&pFd[1]; pFd->pRbuVfs = pRbuVfs; pFd->openFlags = flags; if( zName ){ @@ -203253,7 +203253,7 @@ static int rbuVfsOpen( ** the name of the *-wal file this db connection will use. SQLite ** happens to pass a pointer to this buffer when using xAccess() ** or xOpen() to operate on the *-wal file. */ - pFd->zWal = sqlite3_filename_wal(zName); + pFd->zWal = tdsqlite3_filename_wal(zName); } else if( flags & SQLITE_OPEN_WAL ){ rbu_file *pDb = rbuFindMaindb(pRbuVfs, zName, 0); @@ -203267,11 +203267,11 @@ static int rbuVfsOpen( size_t nCopy; char *zCopy; if( rbuIsVacuum(pDb->pRbu) ){ - zBase = sqlite3_db_filename(pDb->pRbu->dbRbu, "main"); - zBase = sqlite3_filename_wal(zBase); + zBase = tdsqlite3_db_filename(pDb->pRbu->dbRbu, "main"); + zBase = tdsqlite3_filename_wal(zBase); } nCopy = strlen(zBase); - zCopy = sqlite3_malloc64(nCopy+2); + zCopy = tdsqlite3_malloc64(nCopy+2); if( zCopy ){ memcpy(zCopy, zBase, nCopy); zCopy[nCopy-3] = 'o'; @@ -203291,7 +203291,7 @@ static int rbuVfsOpen( } if( oflags & SQLITE_OPEN_MAIN_DB - && sqlite3_uri_boolean(zName, "rbu_memory", 0) + && tdsqlite3_uri_boolean(zName, "rbu_memory", 0) ){ assert( oflags & SQLITE_OPEN_MAIN_DB ); oflags = SQLITE_OPEN_TEMP_DB | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | @@ -203303,7 +203303,7 @@ static int rbuVfsOpen( rc = pRealVfs->xOpen(pRealVfs, zOpen, pFd->pReal, oflags, pOutFlags); } if( pFd->pReal->pMethods ){ - /* The xOpen() operation has succeeded. Set the sqlite3_file.pMethods + /* The xOpen() operation has succeeded. Set the tdsqlite3_file.pMethods ** pointer and, if the file is a main database file, link it into the ** mutex protected linked list of all such files. */ pFile->pMethods = &rbuvfs_io_methods; @@ -203311,7 +203311,7 @@ static int rbuVfsOpen( rbuMainlistAdd(pFd); } }else{ - sqlite3_free(pFd->zDel); + tdsqlite3_free(pFd->zDel); } return rc; @@ -203320,8 +203320,8 @@ static int rbuVfsOpen( /* ** Delete the file located at zPath. */ -static int rbuVfsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ - sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; +static int rbuVfsDelete(tdsqlite3_vfs *pVfs, const char *zPath, int dirSync){ + tdsqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; return pRealVfs->xDelete(pRealVfs, zPath, dirSync); } @@ -203330,13 +203330,13 @@ static int rbuVfsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ ** is available, or false otherwise. */ static int rbuVfsAccess( - sqlite3_vfs *pVfs, + tdsqlite3_vfs *pVfs, const char *zPath, int flags, int *pResOut ){ rbu_vfs *pRbuVfs = (rbu_vfs*)pVfs; - sqlite3_vfs *pRealVfs = pRbuVfs->pRealVfs; + tdsqlite3_vfs *pRealVfs = pRbuVfs->pRealVfs; int rc; rc = pRealVfs->xAccess(pRealVfs, zPath, flags, pResOut); @@ -203362,7 +203362,7 @@ static int rbuVfsAccess( if( *pResOut ){ rc = SQLITE_CANTOPEN; }else{ - sqlite3_int64 sz = 0; + tdsqlite3_int64 sz = 0; rc = rbuVfsFileSize(&pDb->base, &sz); *pResOut = (sz>0); } @@ -203378,12 +203378,12 @@ static int rbuVfsAccess( ** of at least (DEVSYM_MAX_PATHNAME+1) bytes. */ static int rbuVfsFullPathname( - sqlite3_vfs *pVfs, + tdsqlite3_vfs *pVfs, const char *zPath, int nOut, char *zOut ){ - sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; + tdsqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; return pRealVfs->xFullPathname(pRealVfs, zPath, nOut, zOut); } @@ -203391,8 +203391,8 @@ static int rbuVfsFullPathname( /* ** Open the dynamic library located at zPath and return a handle. */ -static void *rbuVfsDlOpen(sqlite3_vfs *pVfs, const char *zPath){ - sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; +static void *rbuVfsDlOpen(tdsqlite3_vfs *pVfs, const char *zPath){ + tdsqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; return pRealVfs->xDlOpen(pRealVfs, zPath); } @@ -203401,8 +203401,8 @@ static void *rbuVfsDlOpen(sqlite3_vfs *pVfs, const char *zPath){ ** utf-8 string describing the most recent error encountered associated ** with dynamic libraries. */ -static void rbuVfsDlError(sqlite3_vfs *pVfs, int nByte, char *zErrMsg){ - sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; +static void rbuVfsDlError(tdsqlite3_vfs *pVfs, int nByte, char *zErrMsg){ + tdsqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; pRealVfs->xDlError(pRealVfs, nByte, zErrMsg); } @@ -203410,19 +203410,19 @@ static void rbuVfsDlError(sqlite3_vfs *pVfs, int nByte, char *zErrMsg){ ** Return a pointer to the symbol zSymbol in the dynamic library pHandle. */ static void (*rbuVfsDlSym( - sqlite3_vfs *pVfs, + tdsqlite3_vfs *pVfs, void *pArg, const char *zSym ))(void){ - sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; + tdsqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; return pRealVfs->xDlSym(pRealVfs, pArg, zSym); } /* ** Close the dynamic library handle pHandle. */ -static void rbuVfsDlClose(sqlite3_vfs *pVfs, void *pHandle){ - sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; +static void rbuVfsDlClose(tdsqlite3_vfs *pVfs, void *pHandle){ + tdsqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; pRealVfs->xDlClose(pRealVfs, pHandle); } #endif /* SQLITE_OMIT_LOAD_EXTENSION */ @@ -203431,8 +203431,8 @@ static void rbuVfsDlClose(sqlite3_vfs *pVfs, void *pHandle){ ** Populate the buffer pointed to by zBufOut with nByte bytes of ** random data. */ -static int rbuVfsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){ - sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; +static int rbuVfsRandomness(tdsqlite3_vfs *pVfs, int nByte, char *zBufOut){ + tdsqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; return pRealVfs->xRandomness(pRealVfs, nByte, zBufOut); } @@ -203440,36 +203440,36 @@ static int rbuVfsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){ ** Sleep for nMicro microseconds. Return the number of microseconds ** actually slept. */ -static int rbuVfsSleep(sqlite3_vfs *pVfs, int nMicro){ - sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; +static int rbuVfsSleep(tdsqlite3_vfs *pVfs, int nMicro){ + tdsqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; return pRealVfs->xSleep(pRealVfs, nMicro); } /* ** Return the current time as a Julian Day number in *pTimeOut. */ -static int rbuVfsCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){ - sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; +static int rbuVfsCurrentTime(tdsqlite3_vfs *pVfs, double *pTimeOut){ + tdsqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs; return pRealVfs->xCurrentTime(pRealVfs, pTimeOut); } /* ** No-op. */ -static int rbuVfsGetLastError(sqlite3_vfs *pVfs, int a, char *b){ +static int rbuVfsGetLastError(tdsqlite3_vfs *pVfs, int a, char *b){ return 0; } /* ** Deregister and destroy an RBU vfs created by an earlier call to -** sqlite3rbu_create_vfs(). +** tdsqlite3rbu_create_vfs(). */ -SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName){ - sqlite3_vfs *pVfs = sqlite3_vfs_find(zName); +SQLITE_API void tdsqlite3rbu_destroy_vfs(const char *zName){ + tdsqlite3_vfs *pVfs = tdsqlite3_vfs_find(zName); if( pVfs && pVfs->xOpen==rbuVfsOpen ){ - sqlite3_mutex_free(((rbu_vfs*)pVfs)->mutex); - sqlite3_vfs_unregister(pVfs); - sqlite3_free(pVfs); + tdsqlite3_mutex_free(((rbu_vfs*)pVfs)->mutex); + tdsqlite3_vfs_unregister(pVfs); + tdsqlite3_free(pVfs); } } @@ -203478,10 +203478,10 @@ SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName){ ** via existing VFS zParent. The new object is registered as a non-default ** VFS with SQLite before returning. */ -SQLITE_API int sqlite3rbu_create_vfs(const char *zName, const char *zParent){ +SQLITE_API int tdsqlite3rbu_create_vfs(const char *zName, const char *zParent){ /* Template for VFS */ - static sqlite3_vfs vfs_template = { + static tdsqlite3_vfs vfs_template = { 1, /* iVersion */ 0, /* szOsFile */ 0, /* mxPathname */ @@ -203517,18 +203517,18 @@ SQLITE_API int sqlite3rbu_create_vfs(const char *zName, const char *zParent){ nName = strlen(zName); nByte = sizeof(rbu_vfs) + nName + 1; - pNew = (rbu_vfs*)sqlite3_malloc64(nByte); + pNew = (rbu_vfs*)tdsqlite3_malloc64(nByte); if( pNew==0 ){ rc = SQLITE_NOMEM; }else{ - sqlite3_vfs *pParent; /* Parent VFS */ + tdsqlite3_vfs *pParent; /* Parent VFS */ memset(pNew, 0, nByte); - pParent = sqlite3_vfs_find(zParent); + pParent = tdsqlite3_vfs_find(zParent); if( pParent==0 ){ rc = SQLITE_NOTFOUND; }else{ char *zSpace; - memcpy(&pNew->base, &vfs_template, sizeof(sqlite3_vfs)); + memcpy(&pNew->base, &vfs_template, sizeof(tdsqlite3_vfs)); pNew->base.mxPathname = pParent->mxPathname; pNew->base.szOsFile = sizeof(rbu_file) + pParent->szOsFile; pNew->pRealVfs = pParent; @@ -203536,17 +203536,17 @@ SQLITE_API int sqlite3rbu_create_vfs(const char *zName, const char *zParent){ memcpy(zSpace, zName, nName); /* Allocate the mutex and register the new VFS (not as the default) */ - pNew->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_RECURSIVE); + pNew->mutex = tdsqlite3_mutex_alloc(SQLITE_MUTEX_RECURSIVE); if( pNew->mutex==0 ){ rc = SQLITE_NOMEM; }else{ - rc = sqlite3_vfs_register(&pNew->base, 0); + rc = tdsqlite3_vfs_register(&pNew->base, 0); } } if( rc!=SQLITE_OK ){ - sqlite3_mutex_free(pNew->mutex); - sqlite3_free(pNew); + tdsqlite3_mutex_free(pNew->mutex); + tdsqlite3_free(pNew); } } @@ -203556,14 +203556,14 @@ SQLITE_API int sqlite3rbu_create_vfs(const char *zName, const char *zParent){ /* ** Configure the aggregate temp file size limit for this RBU handle. */ -SQLITE_API sqlite3_int64 sqlite3rbu_temp_size_limit(sqlite3rbu *pRbu, sqlite3_int64 n){ +SQLITE_API tdsqlite3_int64 tdsqlite3rbu_temp_size_limit(tdsqlite3rbu *pRbu, tdsqlite3_int64 n){ if( n>=0 ){ pRbu->szTempLimit = n; } return pRbu->szTempLimit; } -SQLITE_API sqlite3_int64 sqlite3rbu_temp_size(sqlite3rbu *pRbu){ +SQLITE_API tdsqlite3_int64 tdsqlite3rbu_temp_size(tdsqlite3rbu *pRbu){ return pRbu->szTemp; } @@ -203572,7 +203572,7 @@ SQLITE_API sqlite3_int64 sqlite3rbu_temp_size(sqlite3rbu *pRbu){ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) */ -/************** End of sqlite3rbu.c ******************************************/ +/************** End of tdsqlite3rbu.c ******************************************/ /************** Begin file dbstat.c ******************************************/ /* ** 2010 July 12 @@ -203590,7 +203590,7 @@ SQLITE_API sqlite3_int64 sqlite3rbu_temp_size(sqlite3rbu *pRbu){ ** ** The dbstat virtual table is used to extract low-level storage ** information from an SQLite database in order to implement the -** "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script +** "tdsqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script ** for an example implementation. ** ** Additional information is available on the "dbstat.html" page of the @@ -203684,8 +203684,8 @@ struct StatPage { /* The cursor for scanning the dbstat virtual table */ struct StatCursor { - sqlite3_vtab_cursor base; /* base class. MUST BE FIRST! */ - sqlite3_stmt *pStmt; /* Iterates through set of root pages */ + tdsqlite3_vtab_cursor base; /* base class. MUST BE FIRST! */ + tdsqlite3_stmt *pStmt; /* Iterates through set of root pages */ u8 isEof; /* After pStmt has returned SQLITE_DONE */ u8 isAgg; /* Aggregate results for each table */ int iDb; /* Schema used for this query */ @@ -203709,8 +203709,8 @@ struct StatCursor { /* An instance of the DBSTAT virtual table */ struct StatTable { - sqlite3_vtab base; /* base class. MUST BE FIRST! */ - sqlite3 *db; /* Database connection that owns this vtab */ + tdsqlite3_vtab base; /* base class. MUST BE FIRST! */ + tdsqlite3 *db; /* Database connection that owns this vtab */ int iDb; /* Index of database to analyze */ }; @@ -203722,10 +203722,10 @@ struct StatTable { ** Connect to or create a new DBSTAT virtual table. */ static int statConnect( - sqlite3 *db, + tdsqlite3 *db, void *pAux, int argc, const char *const*argv, - sqlite3_vtab **ppVtab, + tdsqlite3_vtab **ppVtab, char **pzErr ){ StatTable *pTab = 0; @@ -203734,19 +203734,19 @@ static int statConnect( if( argc>=4 ){ Token nm; - sqlite3TokenInit(&nm, (char*)argv[3]); - iDb = sqlite3FindDb(db, &nm); + tdsqlite3TokenInit(&nm, (char*)argv[3]); + iDb = tdsqlite3FindDb(db, &nm); if( iDb<0 ){ - *pzErr = sqlite3_mprintf("no such database: %s", argv[3]); + *pzErr = tdsqlite3_mprintf("no such database: %s", argv[3]); return SQLITE_ERROR; } }else{ iDb = 0; } - sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY); - rc = sqlite3_declare_vtab(db, zDbstatSchema); + tdsqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY); + rc = tdsqlite3_declare_vtab(db, zDbstatSchema); if( rc==SQLITE_OK ){ - pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable)); + pTab = (StatTable *)tdsqlite3_malloc64(sizeof(StatTable)); if( pTab==0 ) rc = SQLITE_NOMEM_BKPT; } @@ -203757,15 +203757,15 @@ static int statConnect( pTab->iDb = iDb; } - *ppVtab = (sqlite3_vtab*)pTab; + *ppVtab = (tdsqlite3_vtab*)pTab; return rc; } /* ** Disconnect from or destroy the DBSTAT virtual table. */ -static int statDisconnect(sqlite3_vtab *pVtab){ - sqlite3_free(pVtab); +static int statDisconnect(tdsqlite3_vtab *pVtab){ + tdsqlite3_free(pVtab); return SQLITE_OK; } @@ -203779,7 +203779,7 @@ static int statDisconnect(sqlite3_vtab *pVtab){ ** 0x04 There is an aggregate=? term in the WHERE clause ** 0x08 Output should be ordered by name and path */ -static int statBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ +static int statBestIndex(tdsqlite3_vtab *tab, tdsqlite3_index_info *pIdxInfo){ int i; int iSchema = -1; int iName = -1; @@ -203851,11 +203851,11 @@ static int statBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ /* ** Open a new DBSTAT cursor. */ -static int statOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ +static int statOpen(tdsqlite3_vtab *pVTab, tdsqlite3_vtab_cursor **ppCursor){ StatTable *pTab = (StatTable *)pVTab; StatCursor *pCsr; - pCsr = (StatCursor *)sqlite3_malloc64(sizeof(StatCursor)); + pCsr = (StatCursor *)tdsqlite3_malloc64(sizeof(StatCursor)); if( pCsr==0 ){ return SQLITE_NOMEM_BKPT; }else{ @@ -203864,7 +203864,7 @@ static int statOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ pCsr->iDb = pTab->iDb; } - *ppCursor = (sqlite3_vtab_cursor *)pCsr; + *ppCursor = (tdsqlite3_vtab_cursor *)pCsr; return SQLITE_OK; } @@ -203872,9 +203872,9 @@ static void statClearCells(StatPage *p){ int i; if( p->aCell ){ for(i=0; inCell; i++){ - sqlite3_free(p->aCell[i].aOvfl); + tdsqlite3_free(p->aCell[i].aOvfl); } - sqlite3_free(p->aCell); + tdsqlite3_free(p->aCell); } p->nCell = 0; p->aCell = 0; @@ -203882,19 +203882,19 @@ static void statClearCells(StatPage *p){ static void statClearPage(StatPage *p){ statClearCells(p); - sqlite3PagerUnref(p->pPg); - sqlite3_free(p->zPath); + tdsqlite3PagerUnref(p->pPg); + tdsqlite3_free(p->zPath); memset(p, 0, sizeof(StatPage)); } static void statResetCsr(StatCursor *pCsr){ int i; - sqlite3_reset(pCsr->pStmt); + tdsqlite3_reset(pCsr->pStmt); for(i=0; iaPage); i++){ statClearPage(&pCsr->aPage[i]); } pCsr->iPage = 0; - sqlite3_free(pCsr->zPath); + tdsqlite3_free(pCsr->zPath); pCsr->zPath = 0; pCsr->isEof = 0; } @@ -203912,11 +203912,11 @@ static void statResetCounts(StatCursor *pCsr){ /* ** Close a DBSTAT cursor. */ -static int statClose(sqlite3_vtab_cursor *pCursor){ +static int statClose(tdsqlite3_vtab_cursor *pCursor){ StatCursor *pCsr = (StatCursor *)pCursor; statResetCsr(pCsr); - sqlite3_finalize(pCsr->pStmt); - sqlite3_free(pCsr); + tdsqlite3_finalize(pCsr->pStmt); + tdsqlite3_free(pCsr); return SQLITE_OK; } @@ -203957,7 +203957,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){ int isLeaf; int szPage; - u8 *aData = sqlite3PagerGetData(p->pPg); + u8 *aData = tdsqlite3PagerGetData(p->pPg); u8 *aHdr = &aData[p->iPgno==1 ? 100 : 0]; p->flags = aHdr[0]; @@ -203973,7 +203973,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){ if( p->iPgno==1 ) nHdr += 100; p->nCell = get2byte(&aHdr[3]); p->nMxPayload = 0; - szPage = sqlite3BtreeGetPageSize(pBt); + szPage = tdsqlite3BtreeGetPageSize(pBt); nUnused = get2byte(&aHdr[5]) - nHdr - 2*p->nCell; nUnused += (int)aHdr[7]; @@ -203987,16 +203987,16 @@ static int statDecodePage(Btree *pBt, StatPage *p){ iOff = iNext; } p->nUnused = nUnused; - p->iRightChildPg = isLeaf ? 0 : sqlite3Get4byte(&aHdr[8]); + p->iRightChildPg = isLeaf ? 0 : tdsqlite3Get4byte(&aHdr[8]); if( p->nCell ){ int i; /* Used to iterate through cells */ int nUsable; /* Usable bytes per page */ - sqlite3BtreeEnter(pBt); - nUsable = szPage - sqlite3BtreeGetReserveNoMutex(pBt); - sqlite3BtreeLeave(pBt); - p->aCell = sqlite3_malloc64((p->nCell+1) * sizeof(StatCell)); + tdsqlite3BtreeEnter(pBt); + nUsable = szPage - tdsqlite3BtreeGetReserveNoMutex(pBt); + tdsqlite3BtreeLeave(pBt); + p->aCell = tdsqlite3_malloc64((p->nCell+1) * sizeof(StatCell)); if( p->aCell==0 ) return SQLITE_NOMEM_BKPT; memset(p->aCell, 0, (p->nCell+1) * sizeof(StatCell)); @@ -204006,7 +204006,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){ iOff = get2byte(&aData[nHdr+i*2]); if( iOff=szPage ) goto statPageIsCorrupt; if( !isLeaf ){ - pCell->iChildPg = sqlite3Get4byte(&aData[iOff]); + pCell->iChildPg = tdsqlite3Get4byte(&aData[iOff]); iOff += 4; } if( p->flags==0x05 ){ @@ -204017,7 +204017,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){ iOff += getVarint32(&aData[iOff], nPayload); if( p->flags==0x0D ){ u64 dummy; - iOff += sqlite3GetVarint(&aData[iOff], &dummy); + iOff += tdsqlite3GetVarint(&aData[iOff], &dummy); } if( nPayload>(u32)p->nMxPayload ) p->nMxPayload = nPayload; nLocal = getLocalPayload(nUsable, p->flags, nPayload); @@ -204031,20 +204031,20 @@ static int statDecodePage(Btree *pBt, StatPage *p){ if( iOff+nLocal>nUsable ) goto statPageIsCorrupt; pCell->nLastOvfl = (nPayload-nLocal) - (nOvfl-1) * (nUsable-4); pCell->nOvfl = nOvfl; - pCell->aOvfl = sqlite3_malloc64(sizeof(u32)*nOvfl); + pCell->aOvfl = tdsqlite3_malloc64(sizeof(u32)*nOvfl); if( pCell->aOvfl==0 ) return SQLITE_NOMEM_BKPT; - pCell->aOvfl[0] = sqlite3Get4byte(&aData[iOff+nLocal]); + pCell->aOvfl[0] = tdsqlite3Get4byte(&aData[iOff+nLocal]); for(j=1; jaOvfl[j-1]; DbPage *pPg = 0; - rc = sqlite3PagerGet(sqlite3BtreePager(pBt), iPrev, &pPg, 0); + rc = tdsqlite3PagerGet(tdsqlite3BtreePager(pBt), iPrev, &pPg, 0); if( rc!=SQLITE_OK ){ assert( pPg==0 ); return rc; } - pCell->aOvfl[j] = sqlite3Get4byte(sqlite3PagerGetData(pPg)); - sqlite3PagerUnref(pPg); + pCell->aOvfl[j] = tdsqlite3Get4byte(tdsqlite3PagerGetData(pPg)); + tdsqlite3PagerUnref(pPg); } } } @@ -204064,23 +204064,23 @@ statPageIsCorrupt: ** the current value of pCsr->iPageno. */ static void statSizeAndOffset(StatCursor *pCsr){ - StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab; + StatTable *pTab = (StatTable *)((tdsqlite3_vtab_cursor *)pCsr)->pVtab; Btree *pBt = pTab->db->aDb[pTab->iDb].pBt; - Pager *pPager = sqlite3BtreePager(pBt); - sqlite3_file *fd; - sqlite3_int64 x[2]; + Pager *pPager = tdsqlite3BtreePager(pBt); + tdsqlite3_file *fd; + tdsqlite3_int64 x[2]; /* If connected to a ZIPVFS backend, find the page size and ** offset from ZIPVFS. */ - fd = sqlite3PagerFile(pPager); + fd = tdsqlite3PagerFile(pPager); x[0] = pCsr->iPageno; - if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){ + if( tdsqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){ pCsr->iOffset = x[0]; pCsr->szPage += x[1]; }else{ /* Not ZIPVFS: The default page size and offset */ - pCsr->szPage += sqlite3BtreeGetPageSize(pBt); + pCsr->szPage += tdsqlite3BtreeGetPageSize(pBt); pCsr->iOffset = (i64)pCsr->szPage * (pCsr->iPageno - 1); } } @@ -204090,43 +204090,43 @@ static void statSizeAndOffset(StatCursor *pCsr){ ** entry will be the next page, but in aggregated mode (pCsr->isAgg!=0), ** the next entry is the next btree. */ -static int statNext(sqlite3_vtab_cursor *pCursor){ +static int statNext(tdsqlite3_vtab_cursor *pCursor){ int rc; int nPayload; char *z; StatCursor *pCsr = (StatCursor *)pCursor; StatTable *pTab = (StatTable *)pCursor->pVtab; Btree *pBt = pTab->db->aDb[pCsr->iDb].pBt; - Pager *pPager = sqlite3BtreePager(pBt); + Pager *pPager = tdsqlite3BtreePager(pBt); - sqlite3_free(pCsr->zPath); + tdsqlite3_free(pCsr->zPath); pCsr->zPath = 0; statNextRestart: if( pCsr->aPage[0].pPg==0 ){ /* Start measuring space on the next btree */ statResetCounts(pCsr); - rc = sqlite3_step(pCsr->pStmt); + rc = tdsqlite3_step(pCsr->pStmt); if( rc==SQLITE_ROW ){ int nPage; - u32 iRoot = (u32)sqlite3_column_int64(pCsr->pStmt, 1); - sqlite3PagerPagecount(pPager, &nPage); + u32 iRoot = (u32)tdsqlite3_column_int64(pCsr->pStmt, 1); + tdsqlite3PagerPagecount(pPager, &nPage); if( nPage==0 ){ pCsr->isEof = 1; - return sqlite3_reset(pCsr->pStmt); + return tdsqlite3_reset(pCsr->pStmt); } - rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg, 0); + rc = tdsqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg, 0); pCsr->aPage[0].iPgno = iRoot; pCsr->aPage[0].iCell = 0; if( !pCsr->isAgg ){ - pCsr->aPage[0].zPath = z = sqlite3_mprintf("/"); + pCsr->aPage[0].zPath = z = tdsqlite3_mprintf("/"); if( z==0 ) rc = SQLITE_NOMEM_BKPT; } pCsr->iPage = 0; pCsr->nPage = 1; }else{ pCsr->isEof = 1; - return sqlite3_reset(pCsr->pStmt); + return tdsqlite3_reset(pCsr->pStmt); } }else{ /* Continue analyzing the btree previously started */ @@ -204136,10 +204136,10 @@ statNextRestart: StatCell *pCell = &p->aCell[p->iCell]; while( pCell->iOvflnOvfl ){ int nUsable, iOvfl; - sqlite3BtreeEnter(pBt); - nUsable = sqlite3BtreeGetPageSize(pBt) - - sqlite3BtreeGetReserveNoMutex(pBt); - sqlite3BtreeLeave(pBt); + tdsqlite3BtreeEnter(pBt); + nUsable = tdsqlite3BtreeGetPageSize(pBt) - + tdsqlite3BtreeGetReserveNoMutex(pBt); + tdsqlite3BtreeLeave(pBt); pCsr->nPage++; statSizeAndOffset(pCsr); if( pCell->iOvflnOvfl-1 ){ @@ -204151,10 +204151,10 @@ statNextRestart: iOvfl = pCell->iOvfl; pCell->iOvfl++; if( !pCsr->isAgg ){ - pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0); + pCsr->zName = (char *)tdsqlite3_column_text(pCsr->pStmt, 0); pCsr->iPageno = pCell->aOvfl[iOvfl]; pCsr->zPagetype = "overflow"; - pCsr->zPath = z = sqlite3_mprintf( + pCsr->zPath = z = tdsqlite3_mprintf( "%s%.3x+%.6x", p->zPath, p->iCell, iOvfl ); return z==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK; @@ -204187,11 +204187,11 @@ statNextRestart: }else{ p[1].iPgno = p->aCell[p->iCell].iChildPg; } - rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg, 0); + rc = tdsqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg, 0); pCsr->nPage++; p[1].iCell = 0; if( !pCsr->isAgg ){ - p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell); + p[1].zPath = z = tdsqlite3_mprintf("%s%.3x/", p->zPath, p->iCell); if( z==0 ) rc = SQLITE_NOMEM_BKPT; } p->iCell++; @@ -204204,7 +204204,7 @@ statNextRestart: if( rc==SQLITE_OK ){ int i; StatPage *p = &pCsr->aPage[pCsr->iPage]; - pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0); + pCsr->zName = (char *)tdsqlite3_column_text(pCsr->pStmt, 0); pCsr->iPageno = p->iPgno; rc = statDecodePage(pBt, p); @@ -204228,7 +204228,7 @@ statNextRestart: pCsr->nUnused += p->nUnused; if( p->nMxPayload>pCsr->nMxPayload ) pCsr->nMxPayload = p->nMxPayload; if( !pCsr->isAgg ){ - pCsr->zPath = z = sqlite3_mprintf("%s", p->zPath); + pCsr->zPath = z = tdsqlite3_mprintf("%s", p->zPath); if( z==0 ) rc = SQLITE_NOMEM_BKPT; } nPayload = 0; @@ -204247,7 +204247,7 @@ statNextRestart: return rc; } -static int statEof(sqlite3_vtab_cursor *pCursor){ +static int statEof(tdsqlite3_vtab_cursor *pCursor){ StatCursor *pCsr = (StatCursor *)pCursor; return pCsr->isEof; } @@ -204257,25 +204257,25 @@ static int statEof(sqlite3_vtab_cursor *pCursor){ ** meaning of the bits in idxNum. */ static int statFilter( - sqlite3_vtab_cursor *pCursor, + tdsqlite3_vtab_cursor *pCursor, int idxNum, const char *idxStr, - int argc, sqlite3_value **argv + int argc, tdsqlite3_value **argv ){ StatCursor *pCsr = (StatCursor *)pCursor; StatTable *pTab = (StatTable*)(pCursor->pVtab); - sqlite3_str *pSql; /* Query of btrees to analyze */ + tdsqlite3_str *pSql; /* Query of btrees to analyze */ char *zSql; /* String value of pSql */ int iArg = 0; /* Count of argv[] parameters used so far */ int rc = SQLITE_OK; /* Result of this operation */ const char *zName = 0; /* Only provide analysis of this table */ statResetCsr(pCsr); - sqlite3_finalize(pCsr->pStmt); + tdsqlite3_finalize(pCsr->pStmt); pCsr->pStmt = 0; if( idxNum & 0x01 ){ /* schema=? constraint is present. Get its value */ - const char *zDbase = (const char*)sqlite3_value_text(argv[iArg++]); - pCsr->iDb = sqlite3FindDbName(pTab->db, zDbase); + const char *zDbase = (const char*)tdsqlite3_value_text(argv[iArg++]); + pCsr->iDb = tdsqlite3FindDbName(pTab->db, zDbase); if( pCsr->iDb<0 ){ pCsr->iDb = 0; pCsr->isEof = 1; @@ -204286,16 +204286,16 @@ static int statFilter( } if( idxNum & 0x02 ){ /* name=? constraint is present */ - zName = (const char*)sqlite3_value_text(argv[iArg++]); + zName = (const char*)tdsqlite3_value_text(argv[iArg++]); } if( idxNum & 0x04 ){ /* aggregate=? constraint is present */ - pCsr->isAgg = sqlite3_value_double(argv[iArg++])!=0.0; + pCsr->isAgg = tdsqlite3_value_double(argv[iArg++])!=0.0; }else{ pCsr->isAgg = 0; } - pSql = sqlite3_str_new(pTab->db); - sqlite3_str_appendf(pSql, + pSql = tdsqlite3_str_new(pTab->db); + tdsqlite3_str_appendf(pSql, "SELECT * FROM (" "SELECT 'sqlite_master' AS name,1 AS rootpage,'table' AS type" " UNION ALL " @@ -204303,17 +204303,17 @@ static int statFilter( " FROM \"%w\".sqlite_master WHERE rootpage!=0)", pTab->db->aDb[pCsr->iDb].zDbSName); if( zName ){ - sqlite3_str_appendf(pSql, "WHERE name=%Q", zName); + tdsqlite3_str_appendf(pSql, "WHERE name=%Q", zName); } if( idxNum & 0x08 ){ - sqlite3_str_appendf(pSql, " ORDER BY name"); + tdsqlite3_str_appendf(pSql, " ORDER BY name"); } - zSql = sqlite3_str_finish(pSql); + zSql = tdsqlite3_str_finish(pSql); if( zSql==0 ){ return SQLITE_NOMEM_BKPT; }else{ - rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0); - sqlite3_free(zSql); + rc = tdsqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0); + tdsqlite3_free(zSql); } if( rc==SQLITE_OK ){ @@ -204323,67 +204323,67 @@ static int statFilter( } static int statColumn( - sqlite3_vtab_cursor *pCursor, - sqlite3_context *ctx, + tdsqlite3_vtab_cursor *pCursor, + tdsqlite3_context *ctx, int i ){ StatCursor *pCsr = (StatCursor *)pCursor; switch( i ){ case 0: /* name */ - sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_TRANSIENT); + tdsqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_TRANSIENT); break; case 1: /* path */ if( !pCsr->isAgg ){ - sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT); + tdsqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT); } break; case 2: /* pageno */ if( pCsr->isAgg ){ - sqlite3_result_int64(ctx, pCsr->nPage); + tdsqlite3_result_int64(ctx, pCsr->nPage); }else{ - sqlite3_result_int64(ctx, pCsr->iPageno); + tdsqlite3_result_int64(ctx, pCsr->iPageno); } break; case 3: /* pagetype */ if( !pCsr->isAgg ){ - sqlite3_result_text(ctx, pCsr->zPagetype, -1, SQLITE_STATIC); + tdsqlite3_result_text(ctx, pCsr->zPagetype, -1, SQLITE_STATIC); } break; case 4: /* ncell */ - sqlite3_result_int(ctx, pCsr->nCell); + tdsqlite3_result_int(ctx, pCsr->nCell); break; case 5: /* payload */ - sqlite3_result_int(ctx, pCsr->nPayload); + tdsqlite3_result_int(ctx, pCsr->nPayload); break; case 6: /* unused */ - sqlite3_result_int(ctx, pCsr->nUnused); + tdsqlite3_result_int(ctx, pCsr->nUnused); break; case 7: /* mx_payload */ - sqlite3_result_int(ctx, pCsr->nMxPayload); + tdsqlite3_result_int(ctx, pCsr->nMxPayload); break; case 8: /* pgoffset */ if( !pCsr->isAgg ){ - sqlite3_result_int64(ctx, pCsr->iOffset); + tdsqlite3_result_int64(ctx, pCsr->iOffset); } break; case 9: /* pgsize */ - sqlite3_result_int(ctx, pCsr->szPage); + tdsqlite3_result_int(ctx, pCsr->szPage); break; case 10: { /* schema */ - sqlite3 *db = sqlite3_context_db_handle(ctx); + tdsqlite3 *db = tdsqlite3_context_db_handle(ctx); int iDb = pCsr->iDb; - sqlite3_result_text(ctx, db->aDb[iDb].zDbSName, -1, SQLITE_STATIC); + tdsqlite3_result_text(ctx, db->aDb[iDb].zDbSName, -1, SQLITE_STATIC); break; } default: { /* aggregate */ - sqlite3_result_int(ctx, pCsr->isAgg); + tdsqlite3_result_int(ctx, pCsr->isAgg); break; } } return SQLITE_OK; } -static int statRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ +static int statRowid(tdsqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ StatCursor *pCsr = (StatCursor *)pCursor; *pRowid = pCsr->iPageno; return SQLITE_OK; @@ -204392,8 +204392,8 @@ static int statRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ /* ** Invoke this routine to register the "dbstat" virtual table module */ -SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){ - static sqlite3_module dbstat_module = { +SQLITE_PRIVATE int tdsqlite3DbstatRegister(tdsqlite3 *db){ + static tdsqlite3_module dbstat_module = { 0, /* iVersion */ statConnect, /* xCreate */ statConnect, /* xConnect */ @@ -204419,10 +204419,10 @@ SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){ 0, /* xRollbackTo */ 0 /* xShadowName */ }; - return sqlite3_create_module(db, "dbstat", &dbstat_module, 0); + return tdsqlite3_create_module(db, "dbstat", &dbstat_module, 0); } #elif defined(SQLITE_ENABLE_DBSTAT_VTAB) -SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){ return SQLITE_OK; } +SQLITE_PRIVATE int tdsqlite3DbstatRegister(tdsqlite3 *db){ return SQLITE_OK; } #endif /* SQLITE_ENABLE_DBSTAT_VTAB */ /************** End of dbstat.c **********************************************/ @@ -204468,7 +204468,7 @@ typedef struct DbpageTable DbpageTable; typedef struct DbpageCursor DbpageCursor; struct DbpageCursor { - sqlite3_vtab_cursor base; /* Base class. Must be first */ + tdsqlite3_vtab_cursor base; /* Base class. Must be first */ int pgno; /* Current page number */ int mxPgno; /* Last page to visit on this scan */ Pager *pPager; /* Pager being read/written */ @@ -204478,8 +204478,8 @@ struct DbpageCursor { }; struct DbpageTable { - sqlite3_vtab base; /* Base class. Must be first */ - sqlite3 *db; /* The database */ + tdsqlite3_vtab base; /* Base class. Must be first */ + tdsqlite3 *db; /* The database */ }; /* Columns */ @@ -204493,20 +204493,20 @@ struct DbpageTable { ** Connect to or create a dbpagevfs virtual table. */ static int dbpageConnect( - sqlite3 *db, + tdsqlite3 *db, void *pAux, int argc, const char *const*argv, - sqlite3_vtab **ppVtab, + tdsqlite3_vtab **ppVtab, char **pzErr ){ DbpageTable *pTab = 0; int rc = SQLITE_OK; - sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY); - rc = sqlite3_declare_vtab(db, + tdsqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY); + rc = tdsqlite3_declare_vtab(db, "CREATE TABLE x(pgno INTEGER PRIMARY KEY, data BLOB, schema HIDDEN)"); if( rc==SQLITE_OK ){ - pTab = (DbpageTable *)sqlite3_malloc64(sizeof(DbpageTable)); + pTab = (DbpageTable *)tdsqlite3_malloc64(sizeof(DbpageTable)); if( pTab==0 ) rc = SQLITE_NOMEM_BKPT; } @@ -204516,15 +204516,15 @@ static int dbpageConnect( pTab->db = db; } - *ppVtab = (sqlite3_vtab*)pTab; + *ppVtab = (tdsqlite3_vtab*)pTab; return rc; } /* ** Disconnect from or destroy a dbpagevfs virtual table. */ -static int dbpageDisconnect(sqlite3_vtab *pVtab){ - sqlite3_free(pVtab); +static int dbpageDisconnect(tdsqlite3_vtab *pVtab){ + tdsqlite3_free(pVtab); return SQLITE_OK; } @@ -204536,7 +204536,7 @@ static int dbpageDisconnect(sqlite3_vtab *pVtab){ ** 2 schema=?1, full table scan ** 3 schema=?1, pgno=?2 */ -static int dbpageBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ +static int dbpageBestIndex(tdsqlite3_vtab *tab, tdsqlite3_index_info *pIdxInfo){ int i; int iPlan = 0; @@ -204545,7 +204545,7 @@ static int dbpageBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ ** unavailable */ for(i=0; inConstraint; i++){ - struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[i]; + struct tdsqlite3_index_constraint *p = &pIdxInfo->aConstraint[i]; if( p->iColumn!=DBPAGE_COLUMN_SCHEMA ) continue; if( p->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue; if( !p->usable ){ @@ -204566,7 +204566,7 @@ static int dbpageBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ /* Check for constraints against pgno */ for(i=0; inConstraint; i++){ - struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[i]; + struct tdsqlite3_index_constraint *p = &pIdxInfo->aConstraint[i]; if( p->usable && p->iColumn<=0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ ){ pIdxInfo->estimatedRows = 1; pIdxInfo->idxFlags = SQLITE_INDEX_SCAN_UNIQUE; @@ -204591,10 +204591,10 @@ static int dbpageBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ /* ** Open a new dbpagevfs cursor. */ -static int dbpageOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ +static int dbpageOpen(tdsqlite3_vtab *pVTab, tdsqlite3_vtab_cursor **ppCursor){ DbpageCursor *pCsr; - pCsr = (DbpageCursor *)sqlite3_malloc64(sizeof(DbpageCursor)); + pCsr = (DbpageCursor *)tdsqlite3_malloc64(sizeof(DbpageCursor)); if( pCsr==0 ){ return SQLITE_NOMEM_BKPT; }else{ @@ -204603,31 +204603,31 @@ static int dbpageOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ pCsr->pgno = -1; } - *ppCursor = (sqlite3_vtab_cursor *)pCsr; + *ppCursor = (tdsqlite3_vtab_cursor *)pCsr; return SQLITE_OK; } /* ** Close a dbpagevfs cursor. */ -static int dbpageClose(sqlite3_vtab_cursor *pCursor){ +static int dbpageClose(tdsqlite3_vtab_cursor *pCursor){ DbpageCursor *pCsr = (DbpageCursor *)pCursor; - if( pCsr->pPage1 ) sqlite3PagerUnrefPageOne(pCsr->pPage1); - sqlite3_free(pCsr); + if( pCsr->pPage1 ) tdsqlite3PagerUnrefPageOne(pCsr->pPage1); + tdsqlite3_free(pCsr); return SQLITE_OK; } /* ** Move a dbpagevfs cursor to the next entry in the file. */ -static int dbpageNext(sqlite3_vtab_cursor *pCursor){ +static int dbpageNext(tdsqlite3_vtab_cursor *pCursor){ int rc = SQLITE_OK; DbpageCursor *pCsr = (DbpageCursor *)pCursor; pCsr->pgno++; return rc; } -static int dbpageEof(sqlite3_vtab_cursor *pCursor){ +static int dbpageEof(tdsqlite3_vtab_cursor *pCursor){ DbpageCursor *pCsr = (DbpageCursor *)pCursor; return pCsr->pgno > pCsr->mxPgno; } @@ -204643,14 +204643,14 @@ static int dbpageEof(sqlite3_vtab_cursor *pCursor){ ** idxStr is not used */ static int dbpageFilter( - sqlite3_vtab_cursor *pCursor, + tdsqlite3_vtab_cursor *pCursor, int idxNum, const char *idxStr, - int argc, sqlite3_value **argv + int argc, tdsqlite3_value **argv ){ DbpageCursor *pCsr = (DbpageCursor *)pCursor; DbpageTable *pTab = (DbpageTable *)pCursor->pVtab; int rc; - sqlite3 *db = pTab->db; + tdsqlite3 *db = pTab->db; Btree *pBt; /* Default setting is no rows of result */ @@ -204660,20 +204660,20 @@ static int dbpageFilter( if( idxNum & 2 ){ const char *zSchema; assert( argc>=1 ); - zSchema = (const char*)sqlite3_value_text(argv[0]); - pCsr->iDb = sqlite3FindDbName(db, zSchema); + zSchema = (const char*)tdsqlite3_value_text(argv[0]); + pCsr->iDb = tdsqlite3FindDbName(db, zSchema); if( pCsr->iDb<0 ) return SQLITE_OK; }else{ pCsr->iDb = 0; } pBt = db->aDb[pCsr->iDb].pBt; if( pBt==0 ) return SQLITE_OK; - pCsr->pPager = sqlite3BtreePager(pBt); - pCsr->szPage = sqlite3BtreeGetPageSize(pBt); - pCsr->mxPgno = sqlite3BtreeLastPage(pBt); + pCsr->pPager = tdsqlite3BtreePager(pBt); + pCsr->szPage = tdsqlite3BtreeGetPageSize(pBt); + pCsr->mxPgno = tdsqlite3BtreeLastPage(pBt); if( idxNum & 1 ){ assert( argc>(idxNum>>1) ); - pCsr->pgno = sqlite3_value_int(argv[idxNum>>1]); + pCsr->pgno = tdsqlite3_value_int(argv[idxNum>>1]); if( pCsr->pgno<1 || pCsr->pgno>pCsr->mxPgno ){ pCsr->pgno = 1; pCsr->mxPgno = 0; @@ -204683,52 +204683,52 @@ static int dbpageFilter( }else{ assert( pCsr->pgno==1 ); } - if( pCsr->pPage1 ) sqlite3PagerUnrefPageOne(pCsr->pPage1); - rc = sqlite3PagerGet(pCsr->pPager, 1, &pCsr->pPage1, 0); + if( pCsr->pPage1 ) tdsqlite3PagerUnrefPageOne(pCsr->pPage1); + rc = tdsqlite3PagerGet(pCsr->pPager, 1, &pCsr->pPage1, 0); return rc; } static int dbpageColumn( - sqlite3_vtab_cursor *pCursor, - sqlite3_context *ctx, + tdsqlite3_vtab_cursor *pCursor, + tdsqlite3_context *ctx, int i ){ DbpageCursor *pCsr = (DbpageCursor *)pCursor; int rc = SQLITE_OK; switch( i ){ case 0: { /* pgno */ - sqlite3_result_int(ctx, pCsr->pgno); + tdsqlite3_result_int(ctx, pCsr->pgno); break; } case 1: { /* data */ DbPage *pDbPage = 0; - rc = sqlite3PagerGet(pCsr->pPager, pCsr->pgno, (DbPage**)&pDbPage, 0); + rc = tdsqlite3PagerGet(pCsr->pPager, pCsr->pgno, (DbPage**)&pDbPage, 0); if( rc==SQLITE_OK ){ - sqlite3_result_blob(ctx, sqlite3PagerGetData(pDbPage), pCsr->szPage, + tdsqlite3_result_blob(ctx, tdsqlite3PagerGetData(pDbPage), pCsr->szPage, SQLITE_TRANSIENT); } - sqlite3PagerUnref(pDbPage); + tdsqlite3PagerUnref(pDbPage); break; } default: { /* schema */ - sqlite3 *db = sqlite3_context_db_handle(ctx); - sqlite3_result_text(ctx, db->aDb[pCsr->iDb].zDbSName, -1, SQLITE_STATIC); + tdsqlite3 *db = tdsqlite3_context_db_handle(ctx); + tdsqlite3_result_text(ctx, db->aDb[pCsr->iDb].zDbSName, -1, SQLITE_STATIC); break; } } return SQLITE_OK; } -static int dbpageRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ +static int dbpageRowid(tdsqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ DbpageCursor *pCsr = (DbpageCursor *)pCursor; *pRowid = pCsr->pgno; return SQLITE_OK; } static int dbpageUpdate( - sqlite3_vtab *pVtab, + tdsqlite3_vtab *pVtab, int argc, - sqlite3_value **argv, + tdsqlite3_value **argv, sqlite_int64 *pRowid ){ DbpageTable *pTab = (DbpageTable *)pVtab; @@ -204750,45 +204750,45 @@ static int dbpageUpdate( zErr = "cannot delete"; goto update_fail; } - pgno = sqlite3_value_int(argv[0]); - if( (Pgno)sqlite3_value_int(argv[1])!=pgno ){ + pgno = tdsqlite3_value_int(argv[0]); + if( (Pgno)tdsqlite3_value_int(argv[1])!=pgno ){ zErr = "cannot insert"; goto update_fail; } - zSchema = (const char*)sqlite3_value_text(argv[4]); - iDb = zSchema ? sqlite3FindDbName(pTab->db, zSchema) : -1; + zSchema = (const char*)tdsqlite3_value_text(argv[4]); + iDb = zSchema ? tdsqlite3FindDbName(pTab->db, zSchema) : -1; if( iDb<0 ){ zErr = "no such schema"; goto update_fail; } pBt = pTab->db->aDb[iDb].pBt; - if( pgno<1 || pBt==0 || pgno>(int)sqlite3BtreeLastPage(pBt) ){ + if( pgno<1 || pBt==0 || pgno>(int)tdsqlite3BtreeLastPage(pBt) ){ zErr = "bad page number"; goto update_fail; } - szPage = sqlite3BtreeGetPageSize(pBt); - if( sqlite3_value_type(argv[3])!=SQLITE_BLOB - || sqlite3_value_bytes(argv[3])!=szPage + szPage = tdsqlite3BtreeGetPageSize(pBt); + if( tdsqlite3_value_type(argv[3])!=SQLITE_BLOB + || tdsqlite3_value_bytes(argv[3])!=szPage ){ zErr = "bad page value"; goto update_fail; } - pPager = sqlite3BtreePager(pBt); - rc = sqlite3PagerGet(pPager, pgno, (DbPage**)&pDbPage, 0); + pPager = tdsqlite3BtreePager(pBt); + rc = tdsqlite3PagerGet(pPager, pgno, (DbPage**)&pDbPage, 0); if( rc==SQLITE_OK ){ - rc = sqlite3PagerWrite(pDbPage); + rc = tdsqlite3PagerWrite(pDbPage); if( rc==SQLITE_OK ){ - memcpy(sqlite3PagerGetData(pDbPage), - sqlite3_value_blob(argv[3]), + memcpy(tdsqlite3PagerGetData(pDbPage), + tdsqlite3_value_blob(argv[3]), szPage); } } - sqlite3PagerUnref(pDbPage); + tdsqlite3PagerUnref(pDbPage); return rc; update_fail: - sqlite3_free(pVtab->zErrMsg); - pVtab->zErrMsg = sqlite3_mprintf("%s", zErr); + tdsqlite3_free(pVtab->zErrMsg); + pVtab->zErrMsg = tdsqlite3_mprintf("%s", zErr); return SQLITE_ERROR; } @@ -204796,13 +204796,13 @@ update_fail: ** written by the sqlite_dbpage virtual table, start a write transaction ** on them all. */ -static int dbpageBegin(sqlite3_vtab *pVtab){ +static int dbpageBegin(tdsqlite3_vtab *pVtab){ DbpageTable *pTab = (DbpageTable *)pVtab; - sqlite3 *db = pTab->db; + tdsqlite3 *db = pTab->db; int i; for(i=0; inDb; i++){ Btree *pBt = db->aDb[i].pBt; - if( pBt ) sqlite3BtreeBeginTrans(pBt, 1, 0); + if( pBt ) tdsqlite3BtreeBeginTrans(pBt, 1, 0); } return SQLITE_OK; } @@ -204811,8 +204811,8 @@ static int dbpageBegin(sqlite3_vtab *pVtab){ /* ** Invoke this routine to register the "dbpage" virtual table module */ -SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){ - static sqlite3_module dbpage_module = { +SQLITE_PRIVATE int tdsqlite3DbpageRegister(tdsqlite3 *db){ + static tdsqlite3_module dbpage_module = { 0, /* iVersion */ dbpageConnect, /* xCreate */ dbpageConnect, /* xConnect */ @@ -204838,17 +204838,17 @@ SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){ 0, /* xRollbackTo */ 0 /* xShadowName */ }; - return sqlite3_create_module(db, "sqlite_dbpage", &dbpage_module, 0); + return tdsqlite3_create_module(db, "sqlite_dbpage", &dbpage_module, 0); } #elif defined(SQLITE_ENABLE_DBPAGE_VTAB) -SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){ return SQLITE_OK; } +SQLITE_PRIVATE int tdsqlite3DbpageRegister(tdsqlite3 *db){ return SQLITE_OK; } #endif /* SQLITE_ENABLE_DBSTAT_VTAB */ /************** End of dbpage.c **********************************************/ -/************** Begin file sqlite3session.c **********************************/ +/************** Begin file tdsqlite3session.c **********************************/ #if defined(SQLITE_ENABLE_SESSION) && defined(SQLITE_ENABLE_PREUPDATE_HOOK) -/* #include "sqlite3session.h" */ +/* #include "tdsqlite3session.h" */ /* #include */ /* #include */ @@ -204878,8 +204878,8 @@ static int sessions_strm_chunk_size = SESSIONS_STRM_CHUNK_SIZE; typedef struct SessionHook SessionHook; struct SessionHook { void *pCtx; - int (*xOld)(void*,int,sqlite3_value**); - int (*xNew)(void*,int,sqlite3_value**); + int (*xOld)(void*,int,tdsqlite3_value**); + int (*xNew)(void*,int,tdsqlite3_value**); int (*xCount)(void*); int (*xDepth)(void*); }; @@ -204887,8 +204887,8 @@ struct SessionHook { /* ** Session handle structure. */ -struct sqlite3_session { - sqlite3 *db; /* Database handle session is attached to */ +struct tdsqlite3_session { + tdsqlite3 *db; /* Database handle session is attached to */ char *zDb; /* Name of database session is attached to */ int bEnable; /* True if currently recording */ int bIndirect; /* True if all changes are indirect */ @@ -204896,8 +204896,8 @@ struct sqlite3_session { int rc; /* Non-zero if an error has occurred */ void *pFilterCtx; /* First argument to pass to xTableFilter */ int (*xTableFilter)(void *pCtx, const char *zTab); - sqlite3_value *pZeroBlob; /* Value containing X'' */ - sqlite3_session *pNext; /* Next session object on same db. */ + tdsqlite3_value *pZeroBlob; /* Value containing X'' */ + tdsqlite3_session *pNext; /* Next session object on same db. */ SessionTable *pTable; /* List of attached tables */ SessionHook hook; /* APIs to grab new and old data with */ }; @@ -204914,8 +204914,8 @@ struct SessionBuffer { /* ** An object of this type is used internally as an abstraction for ** input data. Input data may be supplied either as a single large buffer -** (e.g. sqlite3changeset_start()) or using a stream function (e.g. -** sqlite3changeset_start_strm()). +** (e.g. tdsqlite3changeset_start()) or using a stream function (e.g. +** tdsqlite3changeset_start_strm()). */ struct SessionInput { int bNoDiscard; /* If true, do not discard in InputBuffer() */ @@ -204933,25 +204933,25 @@ struct SessionInput { /* ** Structure for changeset iterators. */ -struct sqlite3_changeset_iter { +struct tdsqlite3_changeset_iter { SessionInput in; /* Input buffer or stream */ SessionBuffer tblhdr; /* Buffer to hold apValue/zTab/abPK/ */ int bPatchset; /* True if this is a patchset */ int bInvert; /* True to invert changeset */ int rc; /* Iterator error code */ - sqlite3_stmt *pConflict; /* Points to conflicting row, if any */ + tdsqlite3_stmt *pConflict; /* Points to conflicting row, if any */ char *zTab; /* Current table */ int nCol; /* Number of columns in zTab */ int op; /* Current operation */ int bIndirect; /* True if current change was indirect */ u8 *abPK; /* Primary key array */ - sqlite3_value **apValue; /* old.* and new.* values */ + tdsqlite3_value **apValue; /* old.* and new.* values */ }; /* ** Each session object maintains a set of the following structures, one ** for each table the session object is monitoring. The structures are -** stored in a linked list starting at sqlite3_session.pTable. +** stored in a linked list starting at tdsqlite3_session.pTable. ** ** The keys of the SessionTable.aChange[] hash table are all rows that have ** been modified in any way since the session object was attached to the @@ -205097,8 +205097,8 @@ struct SessionTable { ** ** REBASE BLOB FORMAT: ** -** A rebase blob may be output by sqlite3changeset_apply_v2() and its -** streaming equivalent for use with the sqlite3_rebaser APIs to rebase +** A rebase blob may be output by tdsqlite3changeset_apply_v2() and its +** streaming equivalent for use with the tdsqlite3_rebaser APIs to rebase ** existing changesets. A rebase blob contains one entry for each conflict ** resolved using either the OMIT or REPLACE strategies within the apply_v2() ** call. @@ -205156,7 +205156,7 @@ static int sessionVarintPut(u8 *aBuf, int iVal){ ** Return the number of bytes required to store value iVal as a varint. */ static int sessionVarintLen(int iVal){ - return sqlite3VarintLen(iVal); + return tdsqlite3VarintLen(iVal); } /* @@ -205174,17 +205174,17 @@ static int sessionVarintGet(u8 *aBuf, int *piVal){ ** Read a 64-bit big-endian integer value from buffer aRec[]. Return ** the value read. */ -static sqlite3_int64 sessionGetI64(u8 *aRec){ +static tdsqlite3_int64 sessionGetI64(u8 *aRec){ u64 x = SESSION_UINT32(aRec); u32 y = SESSION_UINT32(aRec+4); x = (x<<32) + y; - return (sqlite3_int64)x; + return (tdsqlite3_int64)x; } /* ** Write a 64-bit big-endian integer value to the buffer aBuf[]. */ -static void sessionPutI64(u8 *aBuf, sqlite3_int64 i){ +static void sessionPutI64(u8 *aBuf, tdsqlite3_int64 i){ aBuf[0] = (i>>56) & 0xFF; aBuf[1] = (i>>48) & 0xFF; aBuf[2] = (i>>40) & 0xFF; @@ -205205,20 +205205,20 @@ static void sessionPutI64(u8 *aBuf, sqlite3_int64 i){ ** set *pnWrite. ** ** If no error occurs, SQLITE_OK is returned. Or, if an OOM error occurs -** within a call to sqlite3_value_text() (may fail if the db is utf-16)) +** within a call to tdsqlite3_value_text() (may fail if the db is utf-16)) ** SQLITE_NOMEM is returned. */ static int sessionSerializeValue( u8 *aBuf, /* If non-NULL, write serialized value here */ - sqlite3_value *pValue, /* Value to serialize */ - sqlite3_int64 *pnWrite /* IN/OUT: Increment by bytes written */ + tdsqlite3_value *pValue, /* Value to serialize */ + tdsqlite3_int64 *pnWrite /* IN/OUT: Increment by bytes written */ ){ int nByte; /* Size of serialized value in bytes */ if( pValue ){ int eType; /* Value type (SQLITE_NULL, TEXT etc.) */ - eType = sqlite3_value_type(pValue); + eType = tdsqlite3_value_type(pValue); if( aBuf ) aBuf[0] = eType; switch( eType ){ @@ -205234,11 +205234,11 @@ static int sessionSerializeValue( ** too. */ u64 i; if( eType==SQLITE_INTEGER ){ - i = (u64)sqlite3_value_int64(pValue); + i = (u64)tdsqlite3_value_int64(pValue); }else{ double r; assert( sizeof(double)==8 && sizeof(u64)==8 ); - r = sqlite3_value_double(pValue); + r = tdsqlite3_value_double(pValue); memcpy(&i, &r, 8); } sessionPutI64(&aBuf[1], i); @@ -205253,11 +205253,11 @@ static int sessionSerializeValue( assert( eType==SQLITE_TEXT || eType==SQLITE_BLOB ); if( eType==SQLITE_TEXT ){ - z = (u8 *)sqlite3_value_text(pValue); + z = (u8 *)tdsqlite3_value_text(pValue); }else{ - z = (u8 *)sqlite3_value_blob(pValue); + z = (u8 *)tdsqlite3_value_blob(pValue); } - n = sqlite3_value_bytes(pValue); + n = tdsqlite3_value_bytes(pValue); if( z==0 && (eType!=SQLITE_BLOB || n>0) ) return SQLITE_NOMEM; nVarint = sessionVarintLen(n); @@ -205336,7 +205336,7 @@ static unsigned int sessionHashAppendType(unsigned int h, int eType){ ** and the output variables are set as described above. */ static int sessionPreupdateHash( - sqlite3_session *pSession, /* Session object that owns pTab */ + tdsqlite3_session *pSession, /* Session object that owns pTab */ SessionTable *pTab, /* Session table handle */ int bNew, /* True to hash the new.* PK */ int *piHash, /* OUT: Hash value */ @@ -205351,7 +205351,7 @@ static int sessionPreupdateHash( if( pTab->abPK[i] ){ int rc; int eType; - sqlite3_value *pVal; + tdsqlite3_value *pVal; if( bNew ){ rc = pSession->hook.xNew(pSession->hook.pCtx, i, &pVal); @@ -205360,14 +205360,14 @@ static int sessionPreupdateHash( } if( rc!=SQLITE_OK ) return rc; - eType = sqlite3_value_type(pVal); + eType = tdsqlite3_value_type(pVal); h = sessionHashAppendType(h, eType); if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){ i64 iVal; if( eType==SQLITE_INTEGER ){ - iVal = sqlite3_value_int64(pVal); + iVal = tdsqlite3_value_int64(pVal); }else{ - double rVal = sqlite3_value_double(pVal); + double rVal = tdsqlite3_value_double(pVal); assert( sizeof(iVal)==8 && sizeof(rVal)==8 ); memcpy(&iVal, &rVal, 8); } @@ -205376,11 +205376,11 @@ static int sessionPreupdateHash( const u8 *z; int n; if( eType==SQLITE_TEXT ){ - z = (const u8 *)sqlite3_value_text(pVal); + z = (const u8 *)tdsqlite3_value_text(pVal); }else{ - z = (const u8 *)sqlite3_value_blob(pVal); + z = (const u8 *)tdsqlite3_value_blob(pVal); } - n = sqlite3_value_bytes(pVal); + n = tdsqlite3_value_bytes(pVal); if( !z && (eType!=SQLITE_BLOB || n>0) ) return SQLITE_NOMEM; h = sessionHashAppendBlob(h, n, z); }else{ @@ -205668,7 +205668,7 @@ static int sessionMergeUpdate( ** false. */ static int sessionPreupdateEqual( - sqlite3_session *pSession, /* Session object that owns SessionTable */ + tdsqlite3_session *pSession, /* Session object that owns SessionTable */ SessionTable *pTab, /* Table associated with change */ SessionChange *pChange, /* Change to compare to */ int op /* Current pre-update operation */ @@ -205681,7 +205681,7 @@ static int sessionPreupdateEqual( if( !pTab->abPK[iCol] ){ a += sessionSerialLen(a); }else{ - sqlite3_value *pVal; /* Value returned by preupdate_new/old */ + tdsqlite3_value *pVal; /* Value returned by preupdate_new/old */ int rc; /* Error code from preupdate_new/old */ int eType = *a++; /* Type of value from change record */ @@ -205698,7 +205698,7 @@ static int sessionPreupdateEqual( rc = pSession->hook.xOld(pSession->hook.pCtx, iCol, &pVal); } assert( rc==SQLITE_OK ); - if( sqlite3_value_type(pVal)!=eType ) return 0; + if( tdsqlite3_value_type(pVal)!=eType ) return 0; /* A SessionChange object never has a NULL value in a PK column */ assert( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT @@ -205709,22 +205709,22 @@ static int sessionPreupdateEqual( i64 iVal = sessionGetI64(a); a += 8; if( eType==SQLITE_INTEGER ){ - if( sqlite3_value_int64(pVal)!=iVal ) return 0; + if( tdsqlite3_value_int64(pVal)!=iVal ) return 0; }else{ double rVal; assert( sizeof(iVal)==8 && sizeof(rVal)==8 ); memcpy(&rVal, &iVal, 8); - if( sqlite3_value_double(pVal)!=rVal ) return 0; + if( tdsqlite3_value_double(pVal)!=rVal ) return 0; } }else{ int n; const u8 *z; a += sessionVarintGet(a, &n); - if( sqlite3_value_bytes(pVal)!=n ) return 0; + if( tdsqlite3_value_bytes(pVal)!=n ) return 0; if( eType==SQLITE_TEXT ){ - z = sqlite3_value_text(pVal); + z = tdsqlite3_value_text(pVal); }else{ - z = sqlite3_value_blob(pVal); + z = tdsqlite3_value_blob(pVal); } if( n>0 && memcmp(a, z, n) ) return 0; a += n; @@ -205750,9 +205750,9 @@ static int sessionGrowHash(int bPatchset, SessionTable *pTab){ if( pTab->nChange==0 || pTab->nEntry>=(pTab->nChange/2) ){ int i; SessionChange **apNew; - sqlite3_int64 nNew = 2*(sqlite3_int64)(pTab->nChange ? pTab->nChange : 128); + tdsqlite3_int64 nNew = 2*(tdsqlite3_int64)(pTab->nChange ? pTab->nChange : 128); - apNew = (SessionChange **)sqlite3_malloc64(sizeof(SessionChange *) * nNew); + apNew = (SessionChange **)tdsqlite3_malloc64(sizeof(SessionChange *) * nNew); if( apNew==0 ){ if( pTab->nChange==0 ){ return SQLITE_ERROR; @@ -205773,7 +205773,7 @@ static int sessionGrowHash(int bPatchset, SessionTable *pTab){ } } - sqlite3_free(pTab->apChange); + tdsqlite3_free(pTab->apChange); pTab->nChange = nNew; pTab->apChange = apNew; } @@ -205804,10 +205804,10 @@ static int sessionGrowHash(int bPatchset, SessionTable *pTab){ ** *pabPK = {1, 0, 0, 1} ** ** All returned buffers are part of the same single allocation, which must -** be freed using sqlite3_free() by the caller +** be freed using tdsqlite3_free() by the caller */ static int sessionTableInfo( - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ const char *zDb, /* Name of attached database (e.g. "main") */ const char *zThis, /* Table name */ int *pnCol, /* OUT: number of columns */ @@ -205816,9 +205816,9 @@ static int sessionTableInfo( u8 **pabPK /* OUT: Array of booleans - true for PK col */ ){ char *zPragma; - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; int rc; - sqlite3_int64 nByte; + tdsqlite3_int64 nByte; int nDbCol = 0; int nThis; int i; @@ -205828,40 +205828,40 @@ static int sessionTableInfo( assert( pazCol && pabPK ); - nThis = sqlite3Strlen30(zThis); - if( nThis==12 && 0==sqlite3_stricmp("sqlite_stat1", zThis) ){ - rc = sqlite3_table_column_metadata(db, zDb, zThis, 0, 0, 0, 0, 0, 0); + nThis = tdsqlite3Strlen30(zThis); + if( nThis==12 && 0==tdsqlite3_stricmp("sqlite_stat1", zThis) ){ + rc = tdsqlite3_table_column_metadata(db, zDb, zThis, 0, 0, 0, 0, 0, 0); if( rc==SQLITE_OK ){ /* For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. */ - zPragma = sqlite3_mprintf( + zPragma = tdsqlite3_mprintf( "SELECT 0, 'tbl', '', 0, '', 1 UNION ALL " "SELECT 1, 'idx', '', 0, '', 2 UNION ALL " "SELECT 2, 'stat', '', 0, '', 0" ); }else if( rc==SQLITE_ERROR ){ - zPragma = sqlite3_mprintf(""); + zPragma = tdsqlite3_mprintf(""); }else{ return rc; } }else{ - zPragma = sqlite3_mprintf("PRAGMA '%q'.table_info('%q')", zDb, zThis); + zPragma = tdsqlite3_mprintf("PRAGMA '%q'.table_info('%q')", zDb, zThis); } if( !zPragma ) return SQLITE_NOMEM; - rc = sqlite3_prepare_v2(db, zPragma, -1, &pStmt, 0); - sqlite3_free(zPragma); + rc = tdsqlite3_prepare_v2(db, zPragma, -1, &pStmt, 0); + tdsqlite3_free(zPragma); if( rc!=SQLITE_OK ) return rc; nByte = nThis + 1; - while( SQLITE_ROW==sqlite3_step(pStmt) ){ - nByte += sqlite3_column_bytes(pStmt, 1); + while( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + nByte += tdsqlite3_column_bytes(pStmt, 1); nDbCol++; } - rc = sqlite3_reset(pStmt); + rc = tdsqlite3_reset(pStmt); if( rc==SQLITE_OK ){ nByte += nDbCol * (sizeof(const char *) + sizeof(u8) + 1); - pAlloc = sqlite3_malloc64(nByte); + pAlloc = tdsqlite3_malloc64(nByte); if( pAlloc==0 ){ rc = SQLITE_NOMEM; } @@ -205878,17 +205878,17 @@ static int sessionTableInfo( } i = 0; - while( SQLITE_ROW==sqlite3_step(pStmt) ){ - int nName = sqlite3_column_bytes(pStmt, 1); - const unsigned char *zName = sqlite3_column_text(pStmt, 1); + while( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + int nName = tdsqlite3_column_bytes(pStmt, 1); + const unsigned char *zName = tdsqlite3_column_text(pStmt, 1); if( zName==0 ) break; memcpy(pAlloc, zName, nName+1); azCol[i] = (char *)pAlloc; pAlloc += nName+1; - abPK[i] = sqlite3_column_int(pStmt, 5); + abPK[i] = tdsqlite3_column_int(pStmt, 5); i++; } - rc = sqlite3_reset(pStmt); + rc = tdsqlite3_reset(pStmt); } @@ -205904,9 +205904,9 @@ static int sessionTableInfo( *pabPK = 0; *pnCol = 0; if( pzTab ) *pzTab = 0; - sqlite3_free(azCol); + tdsqlite3_free(azCol); } - sqlite3_finalize(pStmt); + tdsqlite3_finalize(pStmt); return rc; } @@ -205916,13 +205916,13 @@ static int sessionTableInfo( ** write to this table, initalize the SessionTable.nCol, azCol[] and ** abPK[] arrays accordingly. ** -** If an error occurs, an error code is stored in sqlite3_session.rc and +** If an error occurs, an error code is stored in tdsqlite3_session.rc and ** non-zero returned. Or, if no error occurs but the table has no primary -** key, sqlite3_session.rc is left set to SQLITE_OK and non-zero returned to +** key, tdsqlite3_session.rc is left set to SQLITE_OK and non-zero returned to ** indicate that updates on this table should be ignored. SessionTable.abPK ** is set to NULL in this case. */ -static int sessionInitTable(sqlite3_session *pSession, SessionTable *pTab){ +static int sessionInitTable(tdsqlite3_session *pSession, SessionTable *pTab){ if( pTab->nCol==0 ){ u8 *abPK; assert( pTab->azCol==0 || pTab->abPK==0 ); @@ -205937,7 +205937,7 @@ static int sessionInitTable(sqlite3_session *pSession, SessionTable *pTab){ break; } } - if( 0==sqlite3_stricmp("sqlite_stat1", pTab->zName) ){ + if( 0==tdsqlite3_stricmp("sqlite_stat1", pTab->zName) ){ pTab->bStat1 = 1; } } @@ -205954,23 +205954,23 @@ static int sessionInitTable(sqlite3_session *pSession, SessionTable *pTab){ typedef struct SessionStat1Ctx SessionStat1Ctx; struct SessionStat1Ctx { SessionHook hook; - sqlite3_session *pSession; + tdsqlite3_session *pSession; }; -static int sessionStat1Old(void *pCtx, int iCol, sqlite3_value **ppVal){ +static int sessionStat1Old(void *pCtx, int iCol, tdsqlite3_value **ppVal){ SessionStat1Ctx *p = (SessionStat1Ctx*)pCtx; - sqlite3_value *pVal = 0; + tdsqlite3_value *pVal = 0; int rc = p->hook.xOld(p->hook.pCtx, iCol, &pVal); - if( rc==SQLITE_OK && iCol==1 && sqlite3_value_type(pVal)==SQLITE_NULL ){ + if( rc==SQLITE_OK && iCol==1 && tdsqlite3_value_type(pVal)==SQLITE_NULL ){ pVal = p->pSession->pZeroBlob; } *ppVal = pVal; return rc; } -static int sessionStat1New(void *pCtx, int iCol, sqlite3_value **ppVal){ +static int sessionStat1New(void *pCtx, int iCol, tdsqlite3_value **ppVal){ SessionStat1Ctx *p = (SessionStat1Ctx*)pCtx; - sqlite3_value *pVal = 0; + tdsqlite3_value *pVal = 0; int rc = p->hook.xNew(p->hook.pCtx, iCol, &pVal); - if( rc==SQLITE_OK && iCol==1 && sqlite3_value_type(pVal)==SQLITE_NULL ){ + if( rc==SQLITE_OK && iCol==1 && tdsqlite3_value_type(pVal)==SQLITE_NULL ){ pVal = p->pSession->pZeroBlob; } *ppVal = pVal; @@ -205996,7 +205996,7 @@ static int sessionStat1Depth(void *pCtx){ */ static void sessionPreupdateOneChange( int op, /* One of SQLITE_UPDATE, INSERT, DELETE */ - sqlite3_session *pSession, /* Session object pTab is attached to */ + tdsqlite3_session *pSession, /* Session object pTab is attached to */ SessionTable *pTab /* Table that change applies to */ ){ int iHash; @@ -206031,12 +206031,12 @@ static void sessionPreupdateOneChange( pSession->hook.xCount = sessionStat1Count; pSession->hook.xDepth = sessionStat1Depth; if( pSession->pZeroBlob==0 ){ - sqlite3_value *p = sqlite3ValueNew(0); + tdsqlite3_value *p = tdsqlite3ValueNew(0); if( p==0 ){ rc = SQLITE_NOMEM; goto error_out; } - sqlite3ValueSetStr(p, 0, "", 0, SQLITE_STATIC); + tdsqlite3ValueSetStr(p, 0, "", 0, SQLITE_STATIC); pSession->pZeroBlob = p; } } @@ -206059,7 +206059,7 @@ static void sessionPreupdateOneChange( ** this is an SQLITE_UPDATE or SQLITE_DELETE), or just the PK ** values (if this is an INSERT). */ SessionChange *pChange; /* New change object */ - sqlite3_int64 nByte; /* Number of bytes to allocate */ + tdsqlite3_int64 nByte; /* Number of bytes to allocate */ int i; /* Used to iterate through columns */ assert( rc==SQLITE_OK ); @@ -206068,7 +206068,7 @@ static void sessionPreupdateOneChange( /* Figure out how large an allocation is required */ nByte = sizeof(SessionChange); for(i=0; inCol; i++){ - sqlite3_value *p = 0; + tdsqlite3_value *p = 0; if( op!=SQLITE_INSERT ){ TESTONLY(int trc = ) pSession->hook.xOld(pSession->hook.pCtx, i, &p); assert( trc==SQLITE_OK ); @@ -206084,7 +206084,7 @@ static void sessionPreupdateOneChange( } /* Allocate the change object */ - pChange = (SessionChange *)sqlite3_malloc64(nByte); + pChange = (SessionChange *)tdsqlite3_malloc64(nByte); if( !pChange ){ rc = SQLITE_NOMEM; goto error_out; @@ -206099,7 +206099,7 @@ static void sessionPreupdateOneChange( ** It is not possible for an OOM to occur in this block. */ nByte = 0; for(i=0; inCol; i++){ - sqlite3_value *p = 0; + tdsqlite3_value *p = 0; if( op!=SQLITE_INSERT ){ pSession->hook.xOld(pSession->hook.pCtx, i, &p); }else if( pTab->abPK[i] ){ @@ -206139,17 +206139,17 @@ static void sessionPreupdateOneChange( } static int sessionFindTable( - sqlite3_session *pSession, + tdsqlite3_session *pSession, const char *zName, SessionTable **ppTab ){ int rc = SQLITE_OK; - int nName = sqlite3Strlen30(zName); + int nName = tdsqlite3Strlen30(zName); SessionTable *pRet; /* Search for an existing table */ for(pRet=pSession->pTable; pRet; pRet=pRet->pNext){ - if( 0==sqlite3_strnicmp(pRet->zName, zName, nName+1) ) break; + if( 0==tdsqlite3_strnicmp(pRet->zName, zName, nName+1) ) break; } if( pRet==0 && pSession->bAutoAttach ){ @@ -206158,10 +206158,10 @@ static int sessionFindTable( if( pSession->xTableFilter==0 || pSession->xTableFilter(pSession->pFilterCtx, zName) ){ - rc = sqlite3session_attach(pSession, zName); + rc = tdsqlite3session_attach(pSession, zName); if( rc==SQLITE_OK ){ for(pRet=pSession->pTable; pRet->pNext; pRet=pRet->pNext); - assert( 0==sqlite3_strnicmp(pRet->zName, zName, nName+1) ); + assert( 0==tdsqlite3_strnicmp(pRet->zName, zName, nName+1) ); } } } @@ -206176,19 +206176,19 @@ static int sessionFindTable( */ static void xPreUpdate( void *pCtx, /* Copy of third arg to preupdate_hook() */ - sqlite3 *db, /* Database handle */ + tdsqlite3 *db, /* Database handle */ int op, /* SQLITE_UPDATE, DELETE or INSERT */ char const *zDb, /* Database name */ char const *zName, /* Table name */ - sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */ - sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */ + tdsqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */ + tdsqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */ ){ - sqlite3_session *pSession; - int nDb = sqlite3Strlen30(zDb); + tdsqlite3_session *pSession; + int nDb = tdsqlite3Strlen30(zDb); - assert( sqlite3_mutex_held(db->mutex) ); + assert( tdsqlite3_mutex_held(db->mutex) ); - for(pSession=(sqlite3_session *)pCtx; pSession; pSession=pSession->pNext){ + for(pSession=(tdsqlite3_session *)pCtx; pSession; pSession=pSession->pNext){ SessionTable *pTab; /* If this session is attached to a different database ("main", "temp" @@ -206196,7 +206196,7 @@ static void xPreUpdate( ** to the next session object attached to this database. */ if( pSession->bEnable==0 ) continue; if( pSession->rc ) continue; - if( sqlite3_strnicmp(zDb, pSession->zDb, nDb+1) ) continue; + if( tdsqlite3_strnicmp(zDb, pSession->zDb, nDb+1) ) continue; pSession->rc = sessionFindTable(pSession, zName, &pTab); if( pTab ){ @@ -206212,17 +206212,17 @@ static void xPreUpdate( /* ** The pre-update hook implementations. */ -static int sessionPreupdateOld(void *pCtx, int iVal, sqlite3_value **ppVal){ - return sqlite3_preupdate_old((sqlite3*)pCtx, iVal, ppVal); +static int sessionPreupdateOld(void *pCtx, int iVal, tdsqlite3_value **ppVal){ + return tdsqlite3_preupdate_old((tdsqlite3*)pCtx, iVal, ppVal); } -static int sessionPreupdateNew(void *pCtx, int iVal, sqlite3_value **ppVal){ - return sqlite3_preupdate_new((sqlite3*)pCtx, iVal, ppVal); +static int sessionPreupdateNew(void *pCtx, int iVal, tdsqlite3_value **ppVal){ + return tdsqlite3_preupdate_new((tdsqlite3*)pCtx, iVal, ppVal); } static int sessionPreupdateCount(void *pCtx){ - return sqlite3_preupdate_count((sqlite3*)pCtx); + return tdsqlite3_preupdate_count((tdsqlite3*)pCtx); } static int sessionPreupdateDepth(void *pCtx){ - return sqlite3_preupdate_depth((sqlite3*)pCtx); + return tdsqlite3_preupdate_depth((tdsqlite3*)pCtx); } /* @@ -206230,7 +206230,7 @@ static int sessionPreupdateDepth(void *pCtx){ ** argument. */ static void sessionPreupdateHooks( - sqlite3_session *pSession + tdsqlite3_session *pSession ){ pSession->hook.pCtx = (void*)pSession->db; pSession->hook.xOld = sessionPreupdateOld; @@ -206241,26 +206241,26 @@ static void sessionPreupdateHooks( typedef struct SessionDiffCtx SessionDiffCtx; struct SessionDiffCtx { - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; int nOldOff; }; /* ** The diff hook implementations. */ -static int sessionDiffOld(void *pCtx, int iVal, sqlite3_value **ppVal){ +static int sessionDiffOld(void *pCtx, int iVal, tdsqlite3_value **ppVal){ SessionDiffCtx *p = (SessionDiffCtx*)pCtx; - *ppVal = sqlite3_column_value(p->pStmt, iVal+p->nOldOff); + *ppVal = tdsqlite3_column_value(p->pStmt, iVal+p->nOldOff); return SQLITE_OK; } -static int sessionDiffNew(void *pCtx, int iVal, sqlite3_value **ppVal){ +static int sessionDiffNew(void *pCtx, int iVal, tdsqlite3_value **ppVal){ SessionDiffCtx *p = (SessionDiffCtx*)pCtx; - *ppVal = sqlite3_column_value(p->pStmt, iVal); + *ppVal = tdsqlite3_column_value(p->pStmt, iVal); return SQLITE_OK; } static int sessionDiffCount(void *pCtx){ SessionDiffCtx *p = (SessionDiffCtx*)pCtx; - return p->nOldOff ? p->nOldOff : sqlite3_column_count(p->pStmt); + return p->nOldOff ? p->nOldOff : tdsqlite3_column_count(p->pStmt); } static int sessionDiffDepth(void *pCtx){ return 0; @@ -206271,7 +206271,7 @@ static int sessionDiffDepth(void *pCtx){ ** argument. */ static void sessionDiffHooks( - sqlite3_session *pSession, + tdsqlite3_session *pSession, SessionDiffCtx *pDiffCtx ){ pSession->hook.pCtx = (void*)pDiffCtx; @@ -206293,7 +206293,7 @@ static char *sessionExprComparePK( for(i=0; idb, zStmt, -1, &pStmt, 0); + tdsqlite3_stmt *pStmt; + rc = tdsqlite3_prepare(pSession->db, zStmt, -1, &pStmt, 0); if( rc==SQLITE_OK ){ SessionDiffCtx *pDiffCtx = (SessionDiffCtx*)pSession->hook.pCtx; pDiffCtx->pStmt = pStmt; pDiffCtx->nOldOff = 0; - while( SQLITE_ROW==sqlite3_step(pStmt) ){ + while( SQLITE_ROW==tdsqlite3_step(pStmt) ){ sessionPreupdateOneChange(op, pSession, pTab); } - rc = sqlite3_finalize(pStmt); + rc = tdsqlite3_finalize(pStmt); } - sqlite3_free(zStmt); + tdsqlite3_free(zStmt); } return rc; } static int sessionDiffFindModified( - sqlite3_session *pSession, + tdsqlite3_session *pSession, SessionTable *pTab, const char *zFrom, const char *zExpr @@ -206396,34 +206396,34 @@ static int sessionDiffFindModified( if( zExpr2==0 ){ rc = SQLITE_NOMEM; }else{ - char *zStmt = sqlite3_mprintf( + char *zStmt = tdsqlite3_mprintf( "SELECT * FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)", pSession->zDb, pTab->zName, zFrom, pTab->zName, zExpr, zExpr2 ); if( zStmt==0 ){ rc = SQLITE_NOMEM; }else{ - sqlite3_stmt *pStmt; - rc = sqlite3_prepare(pSession->db, zStmt, -1, &pStmt, 0); + tdsqlite3_stmt *pStmt; + rc = tdsqlite3_prepare(pSession->db, zStmt, -1, &pStmt, 0); if( rc==SQLITE_OK ){ SessionDiffCtx *pDiffCtx = (SessionDiffCtx*)pSession->hook.pCtx; pDiffCtx->pStmt = pStmt; pDiffCtx->nOldOff = pTab->nCol; - while( SQLITE_ROW==sqlite3_step(pStmt) ){ + while( SQLITE_ROW==tdsqlite3_step(pStmt) ){ sessionPreupdateOneChange(SQLITE_UPDATE, pSession, pTab); } - rc = sqlite3_finalize(pStmt); + rc = tdsqlite3_finalize(pStmt); } - sqlite3_free(zStmt); + tdsqlite3_free(zStmt); } } return rc; } -SQLITE_API int sqlite3session_diff( - sqlite3_session *pSession, +SQLITE_API int tdsqlite3session_diff( + tdsqlite3_session *pSession, const char *zFrom, const char *zTbl, char **pzErrMsg @@ -206435,11 +206435,11 @@ SQLITE_API int sqlite3session_diff( memset(&d, 0, sizeof(d)); sessionDiffHooks(pSession, &d); - sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db)); + tdsqlite3_mutex_enter(tdsqlite3_db_mutex(pSession->db)); if( pzErrMsg ) *pzErrMsg = 0; if( rc==SQLITE_OK ){ char *zExpr = 0; - sqlite3 *db = pSession->db; + tdsqlite3 *db = pSession->db; SessionTable *pTo; /* Table zTbl */ /* Locate and if necessary initialize the target table object */ @@ -206465,15 +206465,15 @@ SQLITE_API int sqlite3session_diff( int i; for(i=0; iabPK[i]!=abPK[i] ) bMismatch = 1; - if( sqlite3_stricmp(azCol[i], pTo->azCol[i]) ) bMismatch = 1; + if( tdsqlite3_stricmp(azCol[i], pTo->azCol[i]) ) bMismatch = 1; if( abPK[i] ) bHasPk = 1; } } } - sqlite3_free((char*)azCol); + tdsqlite3_free((char*)azCol); if( bMismatch ){ if( pzErrMsg ){ - *pzErrMsg = sqlite3_mprintf("table schemas do not match"); + *pzErrMsg = tdsqlite3_mprintf("table schemas do not match"); } rc = SQLITE_SCHEMA; } @@ -206504,12 +206504,12 @@ SQLITE_API int sqlite3session_diff( rc = sessionDiffFindModified(pSession, pTo, zFrom, zExpr); } - sqlite3_free(zExpr); + tdsqlite3_free(zExpr); } diff_out: sessionPreupdateHooks(pSession); - sqlite3_mutex_leave(sqlite3_db_mutex(pSession->db)); + tdsqlite3_mutex_leave(tdsqlite3_db_mutex(pSession->db)); return rc; } @@ -206517,22 +206517,22 @@ SQLITE_API int sqlite3session_diff( ** Create a session object. This session object will record changes to ** database zDb attached to connection db. */ -SQLITE_API int sqlite3session_create( - sqlite3 *db, /* Database handle */ +SQLITE_API int tdsqlite3session_create( + tdsqlite3 *db, /* Database handle */ const char *zDb, /* Name of db (e.g. "main") */ - sqlite3_session **ppSession /* OUT: New session object */ + tdsqlite3_session **ppSession /* OUT: New session object */ ){ - sqlite3_session *pNew; /* Newly allocated session object */ - sqlite3_session *pOld; /* Session object already attached to db */ - int nDb = sqlite3Strlen30(zDb); /* Length of zDb in bytes */ + tdsqlite3_session *pNew; /* Newly allocated session object */ + tdsqlite3_session *pOld; /* Session object already attached to db */ + int nDb = tdsqlite3Strlen30(zDb); /* Length of zDb in bytes */ /* Zero the output value in case an error occurs. */ *ppSession = 0; /* Allocate and populate the new session object. */ - pNew = (sqlite3_session *)sqlite3_malloc64(sizeof(sqlite3_session) + nDb + 1); + pNew = (tdsqlite3_session *)tdsqlite3_malloc64(sizeof(tdsqlite3_session) + nDb + 1); if( !pNew ) return SQLITE_NOMEM; - memset(pNew, 0, sizeof(sqlite3_session)); + memset(pNew, 0, sizeof(tdsqlite3_session)); pNew->db = db; pNew->zDb = (char *)&pNew[1]; pNew->bEnable = 1; @@ -206542,10 +206542,10 @@ SQLITE_API int sqlite3session_create( /* Add the new session object to the linked list of session objects ** attached to database handle $db. Do this under the cover of the db ** handle mutex. */ - sqlite3_mutex_enter(sqlite3_db_mutex(db)); - pOld = (sqlite3_session*)sqlite3_preupdate_hook(db, xPreUpdate, (void*)pNew); + tdsqlite3_mutex_enter(tdsqlite3_db_mutex(db)); + pOld = (tdsqlite3_session*)tdsqlite3_preupdate_hook(db, xPreUpdate, (void*)pNew); pNew->pNext = pOld; - sqlite3_mutex_leave(sqlite3_db_mutex(db)); + tdsqlite3_mutex_leave(tdsqlite3_db_mutex(db)); *ppSession = pNew; return SQLITE_OK; @@ -206567,50 +206567,50 @@ static void sessionDeleteTable(SessionTable *pList){ SessionChange *pNextChange; for(p=pTab->apChange[i]; p; p=pNextChange){ pNextChange = p->pNext; - sqlite3_free(p); + tdsqlite3_free(p); } } - sqlite3_free((char*)pTab->azCol); /* cast works around VC++ bug */ - sqlite3_free(pTab->apChange); - sqlite3_free(pTab); + tdsqlite3_free((char*)pTab->azCol); /* cast works around VC++ bug */ + tdsqlite3_free(pTab->apChange); + tdsqlite3_free(pTab); } } /* -** Delete a session object previously allocated using sqlite3session_create(). +** Delete a session object previously allocated using tdsqlite3session_create(). */ -SQLITE_API void sqlite3session_delete(sqlite3_session *pSession){ - sqlite3 *db = pSession->db; - sqlite3_session *pHead; - sqlite3_session **pp; +SQLITE_API void tdsqlite3session_delete(tdsqlite3_session *pSession){ + tdsqlite3 *db = pSession->db; + tdsqlite3_session *pHead; + tdsqlite3_session **pp; /* Unlink the session from the linked list of sessions attached to the ** database handle. Hold the db mutex while doing so. */ - sqlite3_mutex_enter(sqlite3_db_mutex(db)); - pHead = (sqlite3_session*)sqlite3_preupdate_hook(db, 0, 0); + tdsqlite3_mutex_enter(tdsqlite3_db_mutex(db)); + pHead = (tdsqlite3_session*)tdsqlite3_preupdate_hook(db, 0, 0); for(pp=&pHead; ALWAYS((*pp)!=0); pp=&((*pp)->pNext)){ if( (*pp)==pSession ){ *pp = (*pp)->pNext; - if( pHead ) sqlite3_preupdate_hook(db, xPreUpdate, (void*)pHead); + if( pHead ) tdsqlite3_preupdate_hook(db, xPreUpdate, (void*)pHead); break; } } - sqlite3_mutex_leave(sqlite3_db_mutex(db)); - sqlite3ValueFree(pSession->pZeroBlob); + tdsqlite3_mutex_leave(tdsqlite3_db_mutex(db)); + tdsqlite3ValueFree(pSession->pZeroBlob); /* Delete all attached table objects. And the contents of their ** associated hash-tables. */ sessionDeleteTable(pSession->pTable); /* Free the session object itself. */ - sqlite3_free(pSession); + tdsqlite3_free(pSession); } /* ** Set a table filter on a Session Object. */ -SQLITE_API void sqlite3session_table_filter( - sqlite3_session *pSession, +SQLITE_API void tdsqlite3session_table_filter( + tdsqlite3_session *pSession, int(*xFilter)(void*, const char*), void *pCtx /* First argument passed to xFilter */ ){ @@ -206627,12 +206627,12 @@ SQLITE_API void sqlite3session_table_filter( ** not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) ** or not. */ -SQLITE_API int sqlite3session_attach( - sqlite3_session *pSession, /* Session object */ +SQLITE_API int tdsqlite3session_attach( + tdsqlite3_session *pSession, /* Session object */ const char *zName /* Table name */ ){ int rc = SQLITE_OK; - sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db)); + tdsqlite3_mutex_enter(tdsqlite3_db_mutex(pSession->db)); if( !zName ){ pSession->bAutoAttach = 1; @@ -206642,14 +206642,14 @@ SQLITE_API int sqlite3session_attach( /* First search for an existing entry. If one is found, this call is ** a no-op. Return early. */ - nName = sqlite3Strlen30(zName); + nName = tdsqlite3Strlen30(zName); for(pTab=pSession->pTable; pTab; pTab=pTab->pNext){ - if( 0==sqlite3_strnicmp(pTab->zName, zName, nName+1) ) break; + if( 0==tdsqlite3_strnicmp(pTab->zName, zName, nName+1) ) break; } if( !pTab ){ /* Allocate new SessionTable object. */ - pTab = (SessionTable *)sqlite3_malloc64(sizeof(SessionTable) + nName + 1); + pTab = (SessionTable *)tdsqlite3_malloc64(sizeof(SessionTable) + nName + 1); if( !pTab ){ rc = SQLITE_NOMEM; }else{ @@ -206668,13 +206668,13 @@ SQLITE_API int sqlite3session_attach( } } - sqlite3_mutex_leave(sqlite3_db_mutex(pSession->db)); + tdsqlite3_mutex_leave(tdsqlite3_db_mutex(pSession->db)); return rc; } /* ** Ensure that there is room in the buffer to append nByte bytes of data. -** If not, use sqlite3_realloc() to grow the buffer so that there is. +** If not, use tdsqlite3_realloc() to grow the buffer so that there is. ** ** If successful, return zero. Otherwise, if an OOM condition is encountered, ** set *pRc to SQLITE_NOMEM and return non-zero. @@ -206687,7 +206687,7 @@ static int sessionBufferGrow(SessionBuffer *p, size_t nByte, int *pRc){ nNew = nNew*2; }while( (size_t)(nNew-p->nBuf)aBuf, nNew); + aNew = (u8 *)tdsqlite3_realloc64(p->aBuf, nNew); if( 0==aNew ){ *pRc = SQLITE_NOMEM; }else{ @@ -206706,10 +206706,10 @@ static int sessionBufferGrow(SessionBuffer *p, size_t nByte, int *pRc){ ** Otherwise, if an error occurs, *pRc is set to an SQLite error code ** before returning. */ -static void sessionAppendValue(SessionBuffer *p, sqlite3_value *pVal, int *pRc){ +static void sessionAppendValue(SessionBuffer *p, tdsqlite3_value *pVal, int *pRc){ int rc = *pRc; if( rc==SQLITE_OK ){ - sqlite3_int64 nByte = 0; + tdsqlite3_int64 nByte = 0; rc = sessionSerializeValue(0, pVal, &nByte); sessionBufferGrow(p, nByte, &rc); if( rc==SQLITE_OK ){ @@ -206779,7 +206779,7 @@ static void sessionAppendStr( const char *zStr, int *pRc ){ - int nStr = sqlite3Strlen30(zStr); + int nStr = tdsqlite3Strlen30(zStr); if( 0==sessionBufferGrow(p, nStr, pRc) ){ memcpy(&p->aBuf[p->nBuf], zStr, nStr); p->nBuf += nStr; @@ -206800,7 +206800,7 @@ static void sessionAppendInteger( int *pRc /* IN/OUT: Error code */ ){ char aBuf[24]; - sqlite3_snprintf(sizeof(aBuf)-1, aBuf, "%d", iVal); + tdsqlite3_snprintf(sizeof(aBuf)-1, aBuf, "%d", iVal); sessionAppendStr(p, aBuf, pRc); } @@ -206818,7 +206818,7 @@ static void sessionAppendIdent( const char *zStr, /* String to quote, escape and append */ int *pRc /* IN/OUT: Error code */ ){ - int nStr = sqlite3Strlen30(zStr)*2 + 2 + 1; + int nStr = tdsqlite3Strlen30(zStr)*2 + 2 + 1; if( 0==sessionBufferGrow(p, nStr, pRc) ){ char *zOut = (char *)&p->aBuf[p->nBuf]; const char *zIn = zStr; @@ -206840,20 +206840,20 @@ static void sessionAppendIdent( */ static void sessionAppendCol( SessionBuffer *p, /* Buffer to append to */ - sqlite3_stmt *pStmt, /* Handle pointing to row containing value */ + tdsqlite3_stmt *pStmt, /* Handle pointing to row containing value */ int iCol, /* Column to read value from */ int *pRc /* IN/OUT: Error code */ ){ if( *pRc==SQLITE_OK ){ - int eType = sqlite3_column_type(pStmt, iCol); + int eType = tdsqlite3_column_type(pStmt, iCol); sessionAppendByte(p, (u8)eType, pRc); if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){ - sqlite3_int64 i; + tdsqlite3_int64 i; u8 aBuf[8]; if( eType==SQLITE_INTEGER ){ - i = sqlite3_column_int64(pStmt, iCol); + i = tdsqlite3_column_int64(pStmt, iCol); }else{ - double r = sqlite3_column_double(pStmt, iCol); + double r = tdsqlite3_column_double(pStmt, iCol); memcpy(&i, &r, 8); } sessionPutI64(aBuf, i); @@ -206863,11 +206863,11 @@ static void sessionAppendCol( u8 *z; int nByte; if( eType==SQLITE_BLOB ){ - z = (u8 *)sqlite3_column_blob(pStmt, iCol); + z = (u8 *)tdsqlite3_column_blob(pStmt, iCol); }else{ - z = (u8 *)sqlite3_column_text(pStmt, iCol); + z = (u8 *)tdsqlite3_column_text(pStmt, iCol); } - nByte = sqlite3_column_bytes(pStmt, iCol); + nByte = tdsqlite3_column_bytes(pStmt, iCol); if( z || (eType==SQLITE_BLOB && nByte==0) ){ sessionAppendVarint(p, nByte, pRc); sessionAppendBlob(p, z, nByte, pRc); @@ -206903,7 +206903,7 @@ static void sessionAppendCol( static int sessionAppendUpdate( SessionBuffer *pBuf, /* Buffer to append to */ int bPatchset, /* True for "patchset", 0 for "changeset" */ - sqlite3_stmt *pStmt, /* Statement handle pointing at new row */ + tdsqlite3_stmt *pStmt, /* Statement handle pointing at new row */ SessionChange *p, /* Object containing old values */ u8 *abPK /* Boolean array - true for PK columns */ ){ @@ -206916,14 +206916,14 @@ static int sessionAppendUpdate( sessionAppendByte(pBuf, SQLITE_UPDATE, &rc); sessionAppendByte(pBuf, p->bIndirect, &rc); - for(i=0; idb; /* Source database handle */ + tdsqlite3 *db = pSession->db; /* Source database handle */ SessionTable *pTab; /* Used to iterate through attached tables */ SessionBuffer buf = {0,0,0}; /* Buffer in which to accumlate changeset */ int rc; /* Return code */ @@ -207221,7 +207221,7 @@ static int sessionGenerateChangeset( assert( xOutput==0 || (pnChangeset==0 && ppChangeset==0 ) ); /* Zero the output variables in case an error occurs. If this session - ** object is already in the error state (sqlite3_session.rc != SQLITE_OK), + ** object is already in the error state (tdsqlite3_session.rc != SQLITE_OK), ** this call will be a no-op. */ if( xOutput==0 ){ *pnChangeset = 0; @@ -207229,10 +207229,10 @@ static int sessionGenerateChangeset( } if( pSession->rc ) return pSession->rc; - rc = sqlite3_exec(pSession->db, "SAVEPOINT changeset", 0, 0, 0); + rc = tdsqlite3_exec(pSession->db, "SAVEPOINT changeset", 0, 0, 0); if( rc!=SQLITE_OK ) return rc; - sqlite3_mutex_enter(sqlite3_db_mutex(db)); + tdsqlite3_mutex_enter(tdsqlite3_db_mutex(db)); for(pTab=pSession->pTable; rc==SQLITE_OK && pTab; pTab=pTab->pNext){ if( pTab->nEntry ){ @@ -207241,7 +207241,7 @@ static int sessionGenerateChangeset( u8 *abPK; /* Primary key array */ const char **azCol = 0; /* Table columns */ int i; /* Used to iterate through hash buckets */ - sqlite3_stmt *pSel = 0; /* SELECT statement to query table pTab */ + tdsqlite3_stmt *pSel = 0; /* SELECT statement to query table pTab */ int nRewind = buf.nBuf; /* Initial size of write buffer */ int nNoop; /* Size of buffer after writing tbl header */ @@ -207267,7 +207267,7 @@ static int sessionGenerateChangeset( for(p=pTab->apChange[i]; rc==SQLITE_OK && p; p=p->pNext){ rc = sessionSelectBind(pSel, nCol, abPK, p); if( rc!=SQLITE_OK ) continue; - if( sqlite3_step(pSel)==SQLITE_ROW ){ + if( tdsqlite3_step(pSel)==SQLITE_ROW ){ if( p->op==SQLITE_INSERT ){ int iCol; sessionAppendByte(&buf, SQLITE_INSERT, &rc); @@ -207282,7 +207282,7 @@ static int sessionGenerateChangeset( rc = sessionAppendDelete(&buf, bPatchset, p, nCol, abPK); } if( rc==SQLITE_OK ){ - rc = sqlite3_reset(pSel); + rc = tdsqlite3_reset(pSel); } /* If the buffer is now larger than sessions_strm_chunk_size, pass @@ -207300,11 +207300,11 @@ static int sessionGenerateChangeset( } } - sqlite3_finalize(pSel); + tdsqlite3_finalize(pSel); if( buf.nBuf==nNoop ){ buf.nBuf = nRewind; } - sqlite3_free((char*)azCol); /* cast works around VC++ bug */ + tdsqlite3_free((char*)azCol); /* cast works around VC++ bug */ } } @@ -207318,9 +207318,9 @@ static int sessionGenerateChangeset( } } - sqlite3_free(buf.aBuf); - sqlite3_exec(db, "RELEASE changeset", 0, 0, 0); - sqlite3_mutex_leave(sqlite3_db_mutex(db)); + tdsqlite3_free(buf.aBuf); + tdsqlite3_exec(db, "RELEASE changeset", 0, 0, 0); + tdsqlite3_mutex_leave(tdsqlite3_db_mutex(db)); return rc; } @@ -207329,10 +207329,10 @@ static int sessionGenerateChangeset( ** session object passed as the first argument. ** ** It is the responsibility of the caller to eventually free the buffer -** using sqlite3_free(). +** using tdsqlite3_free(). */ -SQLITE_API int sqlite3session_changeset( - sqlite3_session *pSession, /* Session object */ +SQLITE_API int tdsqlite3session_changeset( + tdsqlite3_session *pSession, /* Session object */ int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */ void **ppChangeset /* OUT: Buffer containing changeset */ ){ @@ -207340,10 +207340,10 @@ SQLITE_API int sqlite3session_changeset( } /* -** Streaming version of sqlite3session_changeset(). +** Streaming version of tdsqlite3session_changeset(). */ -SQLITE_API int sqlite3session_changeset_strm( - sqlite3_session *pSession, +SQLITE_API int tdsqlite3session_changeset_strm( + tdsqlite3_session *pSession, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ){ @@ -207351,10 +207351,10 @@ SQLITE_API int sqlite3session_changeset_strm( } /* -** Streaming version of sqlite3session_patchset(). +** Streaming version of tdsqlite3session_patchset(). */ -SQLITE_API int sqlite3session_patchset_strm( - sqlite3_session *pSession, +SQLITE_API int tdsqlite3session_patchset_strm( + tdsqlite3_session *pSession, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ){ @@ -207366,10 +207366,10 @@ SQLITE_API int sqlite3session_patchset_strm( ** session object passed as the first argument. ** ** It is the responsibility of the caller to eventually free the buffer -** using sqlite3_free(). +** using tdsqlite3_free(). */ -SQLITE_API int sqlite3session_patchset( - sqlite3_session *pSession, /* Session object */ +SQLITE_API int tdsqlite3session_patchset( + tdsqlite3_session *pSession, /* Session object */ int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */ void **ppPatchset /* OUT: Buffer containing changeset */ ){ @@ -207379,28 +207379,28 @@ SQLITE_API int sqlite3session_patchset( /* ** Enable or disable the session object passed as the first argument. */ -SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable){ +SQLITE_API int tdsqlite3session_enable(tdsqlite3_session *pSession, int bEnable){ int ret; - sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db)); + tdsqlite3_mutex_enter(tdsqlite3_db_mutex(pSession->db)); if( bEnable>=0 ){ pSession->bEnable = bEnable; } ret = pSession->bEnable; - sqlite3_mutex_leave(sqlite3_db_mutex(pSession->db)); + tdsqlite3_mutex_leave(tdsqlite3_db_mutex(pSession->db)); return ret; } /* ** Enable or disable the session object passed as the first argument. */ -SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect){ +SQLITE_API int tdsqlite3session_indirect(tdsqlite3_session *pSession, int bIndirect){ int ret; - sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db)); + tdsqlite3_mutex_enter(tdsqlite3_db_mutex(pSession->db)); if( bIndirect>=0 ){ pSession->bIndirect = bIndirect; } ret = pSession->bIndirect; - sqlite3_mutex_leave(sqlite3_db_mutex(pSession->db)); + tdsqlite3_mutex_leave(tdsqlite3_db_mutex(pSession->db)); return ret; } @@ -207408,31 +207408,31 @@ SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect) ** Return true if there have been no changes to monitored tables recorded ** by the session object passed as the only argument. */ -SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession){ +SQLITE_API int tdsqlite3session_isempty(tdsqlite3_session *pSession){ int ret = 0; SessionTable *pTab; - sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db)); + tdsqlite3_mutex_enter(tdsqlite3_db_mutex(pSession->db)); for(pTab=pSession->pTable; pTab && ret==0; pTab=pTab->pNext){ ret = (pTab->nEntry>0); } - sqlite3_mutex_leave(sqlite3_db_mutex(pSession->db)); + tdsqlite3_mutex_leave(tdsqlite3_db_mutex(pSession->db)); return (ret==0); } /* -** Do the work for either sqlite3changeset_start() or start_strm(). +** Do the work for either tdsqlite3changeset_start() or start_strm(). */ static int sessionChangesetStart( - sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */ + tdsqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */ int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int nChangeset, /* Size of buffer pChangeset in bytes */ void *pChangeset, /* Pointer to buffer containing changeset */ int bInvert /* True to invert changeset */ ){ - sqlite3_changeset_iter *pRet; /* Iterator to return */ + tdsqlite3_changeset_iter *pRet; /* Iterator to return */ int nByte; /* Number of bytes to allocate for iterator */ assert( xInput==0 || (pChangeset==0 && nChangeset==0) ); @@ -207441,10 +207441,10 @@ static int sessionChangesetStart( *pp = 0; /* Allocate and initialize the iterator structure. */ - nByte = sizeof(sqlite3_changeset_iter); - pRet = (sqlite3_changeset_iter *)sqlite3_malloc(nByte); + nByte = sizeof(tdsqlite3_changeset_iter); + pRet = (tdsqlite3_changeset_iter *)tdsqlite3_malloc(nByte); if( !pRet ) return SQLITE_NOMEM; - memset(pRet, 0, sizeof(sqlite3_changeset_iter)); + memset(pRet, 0, sizeof(tdsqlite3_changeset_iter)); pRet->in.aData = (u8 *)pChangeset; pRet->in.nData = nChangeset; pRet->in.xInput = xInput; @@ -207460,15 +207460,15 @@ static int sessionChangesetStart( /* ** Create an iterator used to iterate through the contents of a changeset. */ -SQLITE_API int sqlite3changeset_start( - sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */ +SQLITE_API int tdsqlite3changeset_start( + tdsqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */ int nChangeset, /* Size of buffer pChangeset in bytes */ void *pChangeset /* Pointer to buffer containing changeset */ ){ return sessionChangesetStart(pp, 0, 0, nChangeset, pChangeset, 0); } -SQLITE_API int sqlite3changeset_start_v2( - sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */ +SQLITE_API int tdsqlite3changeset_start_v2( + tdsqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */ int nChangeset, /* Size of buffer pChangeset in bytes */ void *pChangeset, /* Pointer to buffer containing changeset */ int flags @@ -207478,17 +207478,17 @@ SQLITE_API int sqlite3changeset_start_v2( } /* -** Streaming version of sqlite3changeset_start(). +** Streaming version of tdsqlite3changeset_start(). */ -SQLITE_API int sqlite3changeset_start_strm( - sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */ +SQLITE_API int tdsqlite3changeset_start_strm( + tdsqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */ int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn ){ return sessionChangesetStart(pp, xInput, pIn, 0, 0, 0); } -SQLITE_API int sqlite3changeset_start_v2_strm( - sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */ +SQLITE_API int tdsqlite3changeset_start_v2_strm( + tdsqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */ int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int flags @@ -207570,25 +207570,25 @@ static void sessionSkipRecord( } /* -** This function sets the value of the sqlite3_value object passed as the +** This function sets the value of the tdsqlite3_value object passed as the ** first argument to a copy of the string or blob held in the aData[] ** buffer. SQLITE_OK is returned if successful, or SQLITE_NOMEM if an OOM ** error occurs. */ static int sessionValueSetStr( - sqlite3_value *pVal, /* Set the value of this object */ + tdsqlite3_value *pVal, /* Set the value of this object */ u8 *aData, /* Buffer containing string or blob data */ int nData, /* Size of buffer aData[] in bytes */ u8 enc /* String encoding (0 for blobs) */ ){ /* In theory this code could just pass SQLITE_TRANSIENT as the final - ** argument to sqlite3ValueSetStr() and have the copy created + ** argument to tdsqlite3ValueSetStr() and have the copy created ** automatically. But doing so makes it difficult to detect any OOM ** error. Hence the code to create the copy externally. */ - u8 *aCopy = sqlite3_malloc64((sqlite3_int64)nData+1); + u8 *aCopy = tdsqlite3_malloc64((tdsqlite3_int64)nData+1); if( aCopy==0 ) return SQLITE_NOMEM; memcpy(aCopy, aData, nData); - sqlite3ValueSetStr(pVal, nData, (char*)aCopy, enc, sqlite3_free); + tdsqlite3ValueSetStr(pVal, nData, (char*)aCopy, enc, tdsqlite3_free); return SQLITE_OK; } @@ -207604,14 +207604,14 @@ static int sessionValueSetStr( ** (in other words, it is a patchset DELETE record). ** ** If successful, each element of the apOut[] array (allocated by the caller) -** is set to point to an sqlite3_value object containing the value read +** is set to point to an tdsqlite3_value object containing the value read ** from the corresponding position in the record. If that value is not ** included in the record (i.e. because the record is part of an UPDATE change ** and the field was not modified), the corresponding element of apOut[] is ** set to NULL. ** ** It is the responsibility of the caller to free all sqlite_value structures -** using sqlite3_free(). +** using tdsqlite3_free(). ** ** If an error occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. ** The apOut[] array may have been partially populated in this case. @@ -207620,7 +207620,7 @@ static int sessionReadRecord( SessionInput *pIn, /* Input data */ int nCol, /* Number of values in record */ u8 *abPK, /* Array of primary key flags, or NULL */ - sqlite3_value **apOut /* Write values to this array */ + tdsqlite3_value **apOut /* Write values to this array */ ){ int i; /* Used to iterate through columns */ int rc = SQLITE_OK; @@ -207636,7 +207636,7 @@ static int sessionReadRecord( eType = pIn->aData[pIn->iNext++]; assert( apOut[i]==0 ); if( eType ){ - apOut[i] = sqlite3ValueNew(0); + apOut[i] = tdsqlite3ValueNew(0); if( !apOut[i] ) rc = SQLITE_NOMEM; } } @@ -207659,13 +207659,13 @@ static int sessionReadRecord( } } if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){ - sqlite3_int64 v = sessionGetI64(aVal); + tdsqlite3_int64 v = sessionGetI64(aVal); if( eType==SQLITE_INTEGER ){ - sqlite3VdbeMemSetInt64(apOut[i], v); + tdsqlite3VdbeMemSetInt64(apOut[i], v); }else{ double d; memcpy(&d, &v, 8); - sqlite3VdbeMemSetDouble(apOut[i], d); + tdsqlite3VdbeMemSetDouble(apOut[i], d); } pIn->iNext += 8; } @@ -207775,7 +207775,7 @@ static int sessionChangesetBufferRecord( ** is returned and the final values of the various fields enumerated above ** are undefined. */ -static int sessionChangesetReadTblhdr(sqlite3_changeset_iter *p){ +static int sessionChangesetReadTblhdr(tdsqlite3_changeset_iter *p){ int rc; int nCopy; assert( p->rc==SQLITE_OK ); @@ -207788,7 +207788,7 @@ static int sessionChangesetReadTblhdr(sqlite3_changeset_iter *p){ if( p->nCol>0 ){ nCopy -= nVarint; p->in.iNext += nVarint; - nByte = p->nCol * sizeof(sqlite3_value*) * 2 + nCopy; + nByte = p->nCol * sizeof(tdsqlite3_value*) * 2 + nCopy; p->tblhdr.nBuf = 0; sessionBufferGrow(&p->tblhdr, nByte, &rc); }else{ @@ -207797,13 +207797,13 @@ static int sessionChangesetReadTblhdr(sqlite3_changeset_iter *p){ } if( rc==SQLITE_OK ){ - size_t iPK = sizeof(sqlite3_value*)*p->nCol*2; + size_t iPK = sizeof(tdsqlite3_value*)*p->nCol*2; memset(p->tblhdr.aBuf, 0, iPK); memcpy(&p->tblhdr.aBuf[iPK], &p->in.aData[p->in.iNext], nCopy); p->in.iNext += nCopy; } - p->apValue = (sqlite3_value**)p->tblhdr.aBuf; + p->apValue = (tdsqlite3_value**)p->tblhdr.aBuf; p->abPK = (u8*)&p->apValue[p->nCol*2]; p->zTab = (char*)&p->abPK[p->nCol]; return (p->rc = rc); @@ -207813,8 +207813,8 @@ static int sessionChangesetReadTblhdr(sqlite3_changeset_iter *p){ ** Advance the changeset iterator to the next change. ** ** If both paRec and pnRec are NULL, then this function works like the public -** API sqlite3changeset_next(). If SQLITE_ROW is returned, then the -** sqlite3changeset_new() and old() APIs may be used to query for values. +** API tdsqlite3changeset_next(). If SQLITE_ROW is returned, then the +** tdsqlite3changeset_new() and old() APIs may be used to query for values. ** ** Otherwise, if paRec and pnRec are not NULL, then a pointer to the change ** record is written to *paRec before returning and the number of bytes in @@ -207826,7 +207826,7 @@ static int sessionChangesetReadTblhdr(sqlite3_changeset_iter *p){ ** changes in the changeset. */ static int sessionChangesetNext( - sqlite3_changeset_iter *p, /* Changeset iterator */ + tdsqlite3_changeset_iter *p, /* Changeset iterator */ u8 **paRec, /* If non-NULL, store record pointer here */ int *pnRec, /* If non-NULL, store size of record here */ int *pbNew /* If non-NULL, true if new table */ @@ -207842,9 +207842,9 @@ static int sessionChangesetNext( /* Free the current contents of p->apValue[], if any. */ if( p->apValue ){ for(i=0; inCol*2; i++){ - sqlite3ValueFree(p->apValue[i]); + tdsqlite3ValueFree(p->apValue[i]); } - memset(p->apValue, 0, sizeof(sqlite3_value*)*p->nCol*2); + memset(p->apValue, 0, sizeof(tdsqlite3_value*)*p->nCol*2); } /* Make sure the buffer contains at least 10 bytes of input data, or all @@ -207901,8 +207901,8 @@ static int sessionChangesetNext( *paRec = &p->in.aData[p->in.iNext]; p->in.iNext += *pnRec; }else{ - sqlite3_value **apOld = (p->bInvert ? &p->apValue[p->nCol] : p->apValue); - sqlite3_value **apNew = (p->bInvert ? p->apValue : &p->apValue[p->nCol]); + tdsqlite3_value **apOld = (p->bInvert ? &p->apValue[p->nCol] : p->apValue); + tdsqlite3_value **apNew = (p->bInvert ? p->apValue : &p->apValue[p->nCol]); /* If this is an UPDATE or DELETE, read the old.* record. */ if( p->op!=SQLITE_INSERT && (p->bPatchset==0 || p->op==SQLITE_DELETE) ){ @@ -207941,14 +207941,14 @@ static int sessionChangesetNext( } /* -** Advance an iterator created by sqlite3changeset_start() to the next +** Advance an iterator created by tdsqlite3changeset_start() to the next ** change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE ** or SQLITE_CORRUPT. ** ** This function may not be called on iterators passed to a conflict handler ** callback by changeset_apply(). */ -SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *p){ +SQLITE_API int tdsqlite3changeset_next(tdsqlite3_changeset_iter *p){ return sessionChangesetNext(p, 0, 0, 0); } @@ -207957,8 +207957,8 @@ SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *p){ ** from a changeset iterator. It may only be called after changeset_next() ** has returned SQLITE_ROW. */ -SQLITE_API int sqlite3changeset_op( - sqlite3_changeset_iter *pIter, /* Iterator handle */ +SQLITE_API int tdsqlite3changeset_op( + tdsqlite3_changeset_iter *pIter, /* Iterator handle */ const char **pzTab, /* OUT: Pointer to table name */ int *pnCol, /* OUT: Number of columns in table */ int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */ @@ -207977,8 +207977,8 @@ SQLITE_API int sqlite3changeset_op( ** to. This function may only be called after changeset_next() returns ** SQLITE_ROW. */ -SQLITE_API int sqlite3changeset_pk( - sqlite3_changeset_iter *pIter, /* Iterator object */ +SQLITE_API int tdsqlite3changeset_pk( + tdsqlite3_changeset_iter *pIter, /* Iterator object */ unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */ int *pnCol /* OUT: Number of entries in output array */ ){ @@ -207989,10 +207989,10 @@ SQLITE_API int sqlite3changeset_pk( /* ** This function may only be called while the iterator is pointing to an -** SQLITE_UPDATE or SQLITE_DELETE change (see sqlite3changeset_op()). +** SQLITE_UPDATE or SQLITE_DELETE change (see tdsqlite3changeset_op()). ** Otherwise, SQLITE_MISUSE is returned. ** -** It sets *ppValue to point to an sqlite3_value structure containing the +** It sets *ppValue to point to an tdsqlite3_value structure containing the ** iVal'th value in the old.* record. Or, if that particular value is not ** included in the record (because the change is an UPDATE and the field ** was not modified and is not a PK column), set *ppValue to NULL. @@ -208000,10 +208000,10 @@ SQLITE_API int sqlite3changeset_pk( ** If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is ** not modified. Otherwise, SQLITE_OK. */ -SQLITE_API int sqlite3changeset_old( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +SQLITE_API int tdsqlite3changeset_old( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Index of old.* value to retrieve */ - sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ + tdsqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ ){ if( pIter->op!=SQLITE_UPDATE && pIter->op!=SQLITE_DELETE ){ return SQLITE_MISUSE; @@ -208017,10 +208017,10 @@ SQLITE_API int sqlite3changeset_old( /* ** This function may only be called while the iterator is pointing to an -** SQLITE_UPDATE or SQLITE_INSERT change (see sqlite3changeset_op()). +** SQLITE_UPDATE or SQLITE_INSERT change (see tdsqlite3changeset_op()). ** Otherwise, SQLITE_MISUSE is returned. ** -** It sets *ppValue to point to an sqlite3_value structure containing the +** It sets *ppValue to point to an tdsqlite3_value structure containing the ** iVal'th value in the new.* record. Or, if that particular value is not ** included in the record (because the change is an UPDATE and the field ** was not modified), set *ppValue to NULL. @@ -208028,10 +208028,10 @@ SQLITE_API int sqlite3changeset_old( ** If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is ** not modified. Otherwise, SQLITE_OK. */ -SQLITE_API int sqlite3changeset_new( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +SQLITE_API int tdsqlite3changeset_new( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Index of new.* value to retrieve */ - sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ + tdsqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ ){ if( pIter->op!=SQLITE_UPDATE && pIter->op!=SQLITE_INSERT ){ return SQLITE_MISUSE; @@ -208045,7 +208045,7 @@ SQLITE_API int sqlite3changeset_new( /* ** The following two macros are used internally. They are similar to the -** sqlite3changeset_new() and sqlite3changeset_old() functions, except that +** tdsqlite3changeset_new() and tdsqlite3changeset_old() functions, except that ** they omit all error checking and return a pointer to the requested value. */ #define sessionChangesetNew(pIter, iVal) (pIter)->apValue[(pIter)->nCol+(iVal)] @@ -208056,16 +208056,16 @@ SQLITE_API int sqlite3changeset_new( ** passed to an SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT ** conflict-handler function. Otherwise, SQLITE_MISUSE is returned. ** -** If successful, *ppValue is set to point to an sqlite3_value structure +** If successful, *ppValue is set to point to an tdsqlite3_value structure ** containing the iVal'th value of the conflicting record. ** ** If value iVal is out-of-range or some other error occurs, an SQLite error ** code is returned. Otherwise, SQLITE_OK. */ -SQLITE_API int sqlite3changeset_conflict( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +SQLITE_API int tdsqlite3changeset_conflict( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Index of conflict record value to fetch */ - sqlite3_value **ppValue /* OUT: Value from conflicting row */ + tdsqlite3_value **ppValue /* OUT: Value from conflicting row */ ){ if( !pIter->pConflict ){ return SQLITE_MISUSE; @@ -208073,7 +208073,7 @@ SQLITE_API int sqlite3changeset_conflict( if( iVal<0 || iVal>=pIter->nCol ){ return SQLITE_RANGE; } - *ppValue = sqlite3_column_value(pIter->pConflict, iVal); + *ppValue = tdsqlite3_column_value(pIter->pConflict, iVal); return SQLITE_OK; } @@ -208085,8 +208085,8 @@ SQLITE_API int sqlite3changeset_conflict( ** ** In all other cases this function returns SQLITE_MISUSE. */ -SQLITE_API int sqlite3changeset_fk_conflicts( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +SQLITE_API int tdsqlite3changeset_fk_conflicts( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int *pnOut /* OUT: Number of FK violations */ ){ if( pIter->pConflict || pIter->apValue ){ @@ -208098,22 +208098,22 @@ SQLITE_API int sqlite3changeset_fk_conflicts( /* -** Finalize an iterator allocated with sqlite3changeset_start(). +** Finalize an iterator allocated with tdsqlite3changeset_start(). ** ** This function may not be called on iterators passed to a conflict handler ** callback by changeset_apply(). */ -SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *p){ +SQLITE_API int tdsqlite3changeset_finalize(tdsqlite3_changeset_iter *p){ int rc = SQLITE_OK; if( p ){ int i; /* Used to iterate through p->apValue[] */ rc = p->rc; if( p->apValue ){ - for(i=0; inCol*2; i++) sqlite3ValueFree(p->apValue[i]); + for(i=0; inCol*2; i++) tdsqlite3ValueFree(p->apValue[i]); } - sqlite3_free(p->tblhdr.aBuf); - sqlite3_free(p->in.buf.aBuf); - sqlite3_free(p); + tdsqlite3_free(p->tblhdr.aBuf); + tdsqlite3_free(p->in.buf.aBuf); + tdsqlite3_free(p); } return rc; } @@ -208129,7 +208129,7 @@ static int sessionChangesetInvert( SessionBuffer sOut; /* Output buffer */ int nCol = 0; /* Number of cols in current table */ u8 *abPK = 0; /* PK array for current table */ - sqlite3_value **apVal = 0; /* Space for values for UPDATE inversion */ + tdsqlite3_value **apVal = 0; /* Space for values for UPDATE inversion */ SessionBuffer sPK = {0, 0, 0}; /* PK array for current table */ /* Initialize the output buffer */ @@ -208172,7 +208172,7 @@ static int sessionChangesetInvert( if( rc ) goto finished_invert; pInput->iNext += nByte; - sqlite3_free(apVal); + tdsqlite3_free(apVal); apVal = 0; abPK = sPK.aBuf; break; @@ -208198,7 +208198,7 @@ static int sessionChangesetInvert( int iCol; if( 0==apVal ){ - apVal = (sqlite3_value **)sqlite3_malloc64(sizeof(apVal[0])*nCol*2); + apVal = (tdsqlite3_value **)tdsqlite3_malloc64(sizeof(apVal[0])*nCol*2); if( 0==apVal ){ rc = SQLITE_NOMEM; goto finished_invert; @@ -208221,7 +208221,7 @@ static int sessionChangesetInvert( ** original old.* record, and the other values from the original ** new.* record. */ for(iCol=0; iColpDelete, 0); + rc = tdsqlite3_prepare_v2(db, (char *)buf.aBuf, buf.nBuf, &p->pDelete, 0); } - sqlite3_free(buf.aBuf); + tdsqlite3_free(buf.aBuf); return rc; } @@ -208434,7 +208434,7 @@ static int sessionDeleteRow( ** pointing to the prepared version of the SQL statement. */ static int sessionUpdateRow( - sqlite3 *db, /* Database handle */ + tdsqlite3 *db, /* Database handle */ const char *zTab, /* Table name */ SessionApplyCtx *p /* Session changeset-apply context */ ){ @@ -208491,9 +208491,9 @@ static int sessionUpdateRow( sessionAppendStr(&buf, ")", &rc); if( rc==SQLITE_OK ){ - rc = sqlite3_prepare_v2(db, (char *)buf.aBuf, buf.nBuf, &p->pUpdate, 0); + rc = tdsqlite3_prepare_v2(db, (char *)buf.aBuf, buf.nBuf, &p->pUpdate, 0); } - sqlite3_free(buf.aBuf); + tdsqlite3_free(buf.aBuf); return rc; } @@ -208513,7 +208513,7 @@ static int sessionUpdateRow( ** pointing to the prepared version of the SQL statement. */ static int sessionSelectRow( - sqlite3 *db, /* Database handle */ + tdsqlite3 *db, /* Database handle */ const char *zTab, /* Table name */ SessionApplyCtx *p /* Session changeset-apply context */ ){ @@ -208531,7 +208531,7 @@ static int sessionSelectRow( ** pointing to the prepared version of the SQL statement. */ static int sessionInsertRow( - sqlite3 *db, /* Database handle */ + tdsqlite3 *db, /* Database handle */ const char *zTab, /* Table name */ SessionApplyCtx *p /* Session changeset-apply context */ ){ @@ -208554,14 +208554,14 @@ static int sessionInsertRow( sessionAppendStr(&buf, ")", &rc); if( rc==SQLITE_OK ){ - rc = sqlite3_prepare_v2(db, (char *)buf.aBuf, buf.nBuf, &p->pInsert, 0); + rc = tdsqlite3_prepare_v2(db, (char *)buf.aBuf, buf.nBuf, &p->pInsert, 0); } - sqlite3_free(buf.aBuf); + tdsqlite3_free(buf.aBuf); return rc; } -static int sessionPrepare(sqlite3 *db, sqlite3_stmt **pp, const char *zSql){ - return sqlite3_prepare_v2(db, zSql, -1, pp, 0); +static int sessionPrepare(tdsqlite3 *db, tdsqlite3_stmt **pp, const char *zSql){ + return tdsqlite3_prepare_v2(db, zSql, -1, pp, 0); } /* @@ -208570,7 +208570,7 @@ static int sessionPrepare(sqlite3 *db, sqlite3_stmt **pp, const char *zSql){ ** sessionInsertRow(), sessionUpdateRow() and sessionDeleteRow() for ** other tables. */ -static int sessionStat1Sql(sqlite3 *db, SessionApplyCtx *p){ +static int sessionStat1Sql(tdsqlite3 *db, SessionApplyCtx *p){ int rc = sessionSelectRow(db, "sqlite_stat1", p); if( rc==SQLITE_OK ){ rc = sessionPrepare(db, &p->pInsert, @@ -208601,26 +208601,26 @@ static int sessionStat1Sql(sqlite3 *db, SessionApplyCtx *p){ } /* -** A wrapper around sqlite3_bind_value() that detects an extra problem. +** A wrapper around tdsqlite3_bind_value() that detects an extra problem. ** See comments in the body of this function for details. */ static int sessionBindValue( - sqlite3_stmt *pStmt, /* Statement to bind value to */ + tdsqlite3_stmt *pStmt, /* Statement to bind value to */ int i, /* Parameter number to bind to */ - sqlite3_value *pVal /* Value to bind */ + tdsqlite3_value *pVal /* Value to bind */ ){ - int eType = sqlite3_value_type(pVal); + int eType = tdsqlite3_value_type(pVal); /* COVERAGE: The (pVal->z==0) branch is never true using current versions - ** of SQLite. If a malloc fails in an sqlite3_value_xxx() function, either + ** of SQLite. If a malloc fails in an tdsqlite3_value_xxx() function, either ** the (pVal->z) variable remains as it was or the type of the value is ** set to SQLITE_NULL. */ if( (eType==SQLITE_TEXT || eType==SQLITE_BLOB) && pVal->z==0 ){ /* This condition occurs when an earlier OOM in a call to - ** sqlite3_value_text() or sqlite3_value_blob() (perhaps from within + ** tdsqlite3_value_text() or tdsqlite3_value_blob() (perhaps from within ** a conflict-handler) has zeroed the pVal->z pointer. Return NOMEM. */ return SQLITE_NOMEM; } - return sqlite3_bind_value(pStmt, i, pVal); + return tdsqlite3_bind_value(pStmt, i, pVal); } /* @@ -208638,24 +208638,24 @@ static int sessionBindValue( ** An SQLite error code is returned if an error occurs. Otherwise, SQLITE_OK. */ static int sessionBindRow( - sqlite3_changeset_iter *pIter, /* Iterator to read values from */ - int(*xValue)(sqlite3_changeset_iter *, int, sqlite3_value **), + tdsqlite3_changeset_iter *pIter, /* Iterator to read values from */ + int(*xValue)(tdsqlite3_changeset_iter *, int, tdsqlite3_value **), int nCol, /* Number of columns */ u8 *abPK, /* If not NULL, bind only if true */ - sqlite3_stmt *pStmt /* Bind values to this statement */ + tdsqlite3_stmt *pStmt /* Bind values to this statement */ ){ int i; int rc = SQLITE_OK; - /* Neither sqlite3changeset_old or sqlite3changeset_new can fail if the + /* Neither tdsqlite3changeset_old or tdsqlite3changeset_new can fail if the ** argument iterator points to a suitable entry. Make sure that xValue ** is one of these to guarantee that it is safe to ignore the return ** in the code below. */ - assert( xValue==sqlite3changeset_old || xValue==sqlite3changeset_new ); + assert( xValue==tdsqlite3changeset_old || xValue==tdsqlite3changeset_new ); for(i=0; rc==SQLITE_OK && ibRebase ){ @@ -208748,11 +208748,11 @@ static int sessionRebaseAdd( ); sessionAppendByte(&p->rebase, (eType==SQLITE_CHANGESET_REPLACE), &rc); for(i=0; inCol; i++){ - sqlite3_value *pVal = 0; + tdsqlite3_value *pVal = 0; if( eOp==SQLITE_DELETE || (eOp==SQLITE_UPDATE && p->abPK[i]) ){ - sqlite3changeset_old(pIter, i, &pVal); + tdsqlite3changeset_old(pIter, i, &pVal); }else{ - sqlite3changeset_new(pIter, i, &pVal); + tdsqlite3changeset_new(pIter, i, &pVal); } sessionAppendValue(&p->rebase, pVal, &rc); } @@ -208798,8 +208798,8 @@ static int sessionRebaseAdd( static int sessionConflictHandler( int eType, /* Either CHANGESET_DATA or CONFLICT */ SessionApplyCtx *p, /* changeset_apply() context */ - sqlite3_changeset_iter *pIter, /* Changeset iterator */ - int(*xConflict)(void *, int, sqlite3_changeset_iter*), + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ + int(*xConflict)(void *, int, tdsqlite3_changeset_iter*), void *pCtx, /* First argument for conflict handler */ int *pbReplace /* OUT: Set to true if PK row is found */ ){ @@ -208809,7 +208809,7 @@ static int sessionConflictHandler( int op; const char *zDummy; - sqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0); + tdsqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0); assert( eType==SQLITE_CHANGESET_CONFLICT || eType==SQLITE_CHANGESET_DATA ); assert( SQLITE_CHANGESET_CONFLICT+1==SQLITE_CHANGESET_CONSTRAINT ); @@ -208827,7 +208827,7 @@ static int sessionConflictHandler( pIter->pConflict = p->pSelect; res = xConflict(pCtx, eType, pIter); pIter->pConflict = 0; - rc = sqlite3_reset(p->pSelect); + rc = tdsqlite3_reset(p->pSelect); }else if( rc==SQLITE_OK ){ if( p->bDeferConstraints && eType==SQLITE_CHANGESET_CONFLICT ){ /* Instead of invoking the conflict handler, append the change blob @@ -208894,9 +208894,9 @@ static int sessionConflictHandler( ** returned. */ static int sessionApplyOneOp( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ SessionApplyCtx *p, /* changeset_apply() context */ - int(*xConflict)(void *, int, sqlite3_changeset_iter *), + int(*xConflict)(void *, int, tdsqlite3_changeset_iter *), void *pCtx, /* First argument for the conflict handler */ int *pbReplace, /* OUT: True to remove PK row and retry */ int *pbRetry /* OUT: True to retry. */ @@ -208910,7 +208910,7 @@ static int sessionApplyOneOp( assert( p->azCol && p->abPK ); assert( !pbReplace || *pbReplace==0 ); - sqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0); + tdsqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0); if( op==SQLITE_DELETE ){ @@ -208926,15 +208926,15 @@ static int sessionApplyOneOp( ** no (nCol+1) variable to bind to). */ u8 *abPK = (pIter->bPatchset ? p->abPK : 0); - rc = sessionBindRow(pIter, sqlite3changeset_old, nCol, abPK, p->pDelete); - if( rc==SQLITE_OK && sqlite3_bind_parameter_count(p->pDelete)>nCol ){ - rc = sqlite3_bind_int(p->pDelete, nCol+1, (pbRetry==0 || abPK)); + rc = sessionBindRow(pIter, tdsqlite3changeset_old, nCol, abPK, p->pDelete); + if( rc==SQLITE_OK && tdsqlite3_bind_parameter_count(p->pDelete)>nCol ){ + rc = tdsqlite3_bind_int(p->pDelete, nCol+1, (pbRetry==0 || abPK)); } if( rc!=SQLITE_OK ) return rc; - sqlite3_step(p->pDelete); - rc = sqlite3_reset(p->pDelete); - if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 ){ + tdsqlite3_step(p->pDelete); + rc = tdsqlite3_reset(p->pDelete); + if( rc==SQLITE_OK && tdsqlite3_changes(p->db)==0 ){ rc = sessionConflictHandler( SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry ); @@ -208949,10 +208949,10 @@ static int sessionApplyOneOp( /* Bind values to the UPDATE statement. */ for(i=0; rc==SQLITE_OK && ipUpdate, i*3+2, !!pNew); + tdsqlite3_bind_int(p->pUpdate, i*3+2, !!pNew); if( pOld ){ rc = sessionBindValue(p->pUpdate, i*3+1, pOld); } @@ -208961,16 +208961,16 @@ static int sessionApplyOneOp( } } if( rc==SQLITE_OK ){ - sqlite3_bind_int(p->pUpdate, nCol*3+1, pbRetry==0 || pIter->bPatchset); + tdsqlite3_bind_int(p->pUpdate, nCol*3+1, pbRetry==0 || pIter->bPatchset); } if( rc!=SQLITE_OK ) return rc; /* Attempt the UPDATE. In the case of a NOTFOUND or DATA conflict, ** the result will be SQLITE_OK with 0 rows modified. */ - sqlite3_step(p->pUpdate); - rc = sqlite3_reset(p->pUpdate); + tdsqlite3_step(p->pUpdate); + rc = tdsqlite3_reset(p->pUpdate); - if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 ){ + if( rc==SQLITE_OK && tdsqlite3_changes(p->db)==0 ){ /* A NOTFOUND or DATA error. Search the table to see if it contains ** a row with a matching primary key. If so, this is a DATA conflict. ** Otherwise, if there is no primary key match, it is a NOTFOUND. */ @@ -208995,16 +208995,16 @@ static int sessionApplyOneOp( rc = sessionSeekToRow(p->db, pIter, p->abPK, p->pSelect); if( rc==SQLITE_ROW ){ rc = SQLITE_CONSTRAINT; - sqlite3_reset(p->pSelect); + tdsqlite3_reset(p->pSelect); } } if( rc==SQLITE_OK ){ - rc = sessionBindRow(pIter, sqlite3changeset_new, nCol, 0, p->pInsert); + rc = sessionBindRow(pIter, tdsqlite3changeset_new, nCol, 0, p->pInsert); if( rc!=SQLITE_OK ) return rc; - sqlite3_step(p->pInsert); - rc = sqlite3_reset(p->pInsert); + tdsqlite3_step(p->pInsert); + rc = tdsqlite3_reset(p->pInsert); } if( (rc&0xff)==SQLITE_CONSTRAINT ){ @@ -209028,10 +209028,10 @@ static int sessionApplyOneOp( ** retried in some manner. */ static int sessionApplyOneWithRetry( - sqlite3 *db, /* Apply change to "main" db of this handle */ - sqlite3_changeset_iter *pIter, /* Changeset iterator to read change from */ + tdsqlite3 *db, /* Apply change to "main" db of this handle */ + tdsqlite3_changeset_iter *pIter, /* Changeset iterator to read change from */ SessionApplyCtx *pApply, /* Apply context */ - int(*xConflict)(void*, int, sqlite3_changeset_iter*), + int(*xConflict)(void*, int, tdsqlite3_changeset_iter*), void *pCtx /* First argument passed to xConflict */ ){ int bReplace = 0; @@ -209059,21 +209059,21 @@ static int sessionApplyOneWithRetry( ** before reattempting the INSERT. */ else if( bReplace ){ assert( pIter->op==SQLITE_INSERT ); - rc = sqlite3_exec(db, "SAVEPOINT replace_op", 0, 0, 0); + rc = tdsqlite3_exec(db, "SAVEPOINT replace_op", 0, 0, 0); if( rc==SQLITE_OK ){ rc = sessionBindRow(pIter, - sqlite3changeset_new, pApply->nCol, pApply->abPK, pApply->pDelete); - sqlite3_bind_int(pApply->pDelete, pApply->nCol+1, 1); + tdsqlite3changeset_new, pApply->nCol, pApply->abPK, pApply->pDelete); + tdsqlite3_bind_int(pApply->pDelete, pApply->nCol+1, 1); } if( rc==SQLITE_OK ){ - sqlite3_step(pApply->pDelete); - rc = sqlite3_reset(pApply->pDelete); + tdsqlite3_step(pApply->pDelete); + rc = tdsqlite3_reset(pApply->pDelete); } if( rc==SQLITE_OK ){ rc = sessionApplyOneOp(pIter, pApply, xConflict, pCtx, 0, 0); } if( rc==SQLITE_OK ){ - rc = sqlite3_exec(db, "RELEASE replace_op", 0, 0, 0); + rc = tdsqlite3_exec(db, "RELEASE replace_op", 0, 0, 0); } } } @@ -209085,42 +209085,42 @@ static int sessionApplyOneWithRetry( ** Retry the changes accumulated in the pApply->constraints buffer. */ static int sessionRetryConstraints( - sqlite3 *db, + tdsqlite3 *db, int bPatchset, const char *zTab, SessionApplyCtx *pApply, - int(*xConflict)(void*, int, sqlite3_changeset_iter*), + int(*xConflict)(void*, int, tdsqlite3_changeset_iter*), void *pCtx /* First argument passed to xConflict */ ){ int rc = SQLITE_OK; while( pApply->constraints.nBuf ){ - sqlite3_changeset_iter *pIter2 = 0; + tdsqlite3_changeset_iter *pIter2 = 0; SessionBuffer cons = pApply->constraints; memset(&pApply->constraints, 0, sizeof(SessionBuffer)); rc = sessionChangesetStart(&pIter2, 0, 0, cons.nBuf, cons.aBuf, 0); if( rc==SQLITE_OK ){ - size_t nByte = 2*pApply->nCol*sizeof(sqlite3_value*); + size_t nByte = 2*pApply->nCol*sizeof(tdsqlite3_value*); int rc2; pIter2->bPatchset = bPatchset; pIter2->zTab = (char*)zTab; pIter2->nCol = pApply->nCol; pIter2->abPK = pApply->abPK; sessionBufferGrow(&pIter2->tblhdr, nByte, &rc); - pIter2->apValue = (sqlite3_value**)pIter2->tblhdr.aBuf; + pIter2->apValue = (tdsqlite3_value**)pIter2->tblhdr.aBuf; if( rc==SQLITE_OK ) memset(pIter2->apValue, 0, nByte); - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3changeset_next(pIter2) ){ + while( rc==SQLITE_OK && SQLITE_ROW==tdsqlite3changeset_next(pIter2) ){ rc = sessionApplyOneWithRetry(db, pIter2, pApply, xConflict, pCtx); } - rc2 = sqlite3changeset_finalize(pIter2); + rc2 = tdsqlite3changeset_finalize(pIter2); if( rc==SQLITE_OK ) rc = rc2; } assert( pApply->bDeferConstraints || pApply->constraints.nBuf==0 ); - sqlite3_free(cons.aBuf); + tdsqlite3_free(cons.aBuf); if( rc!=SQLITE_OK ) break; if( pApply->constraints.nBuf>=cons.nBuf ){ /* No progress was made on the last round. */ @@ -209133,14 +209133,14 @@ static int sessionRetryConstraints( /* ** Argument pIter is a changeset iterator that has been initialized, but -** not yet passed to sqlite3changeset_next(). This function applies the +** not yet passed to tdsqlite3changeset_next(). This function applies the ** changeset to the main database attached to handle "db". The supplied ** conflict handler callback is invoked to resolve any conflicts encountered ** while applying the change. */ static int sessionChangesetApply( - sqlite3 *db, /* Apply change to "main" db of this handle */ - sqlite3_changeset_iter *pIter, /* Changeset to apply */ + tdsqlite3 *db, /* Apply change to "main" db of this handle */ + tdsqlite3_changeset_iter *pIter, /* Changeset to apply */ int(*xFilter)( void *pCtx, /* Copy of sixth arg to _apply() */ const char *zTab /* Table name */ @@ -209148,7 +209148,7 @@ static int sessionChangesetApply( int(*xConflict)( void *pCtx, /* Copy of fifth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx, /* First argument passed to xConflict */ void **ppRebase, int *pnRebase, /* OUT: Rebase information */ @@ -209157,7 +209157,7 @@ static int sessionChangesetApply( int schemaMismatch = 0; int rc = SQLITE_OK; /* Return code */ const char *zTab = 0; /* Name of current table */ - int nTab = 0; /* Result of sqlite3Strlen30(zTab) */ + int nTab = 0; /* Result of tdsqlite3Strlen30(zTab) */ SessionApplyCtx sApply; /* changeset_apply() context object */ int bPatchset; @@ -209166,21 +209166,21 @@ static int sessionChangesetApply( pIter->in.bNoDiscard = 1; memset(&sApply, 0, sizeof(sApply)); sApply.bRebase = (ppRebase && pnRebase); - sqlite3_mutex_enter(sqlite3_db_mutex(db)); + tdsqlite3_mutex_enter(tdsqlite3_db_mutex(db)); if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){ - rc = sqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0); + rc = tdsqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0); } if( rc==SQLITE_OK ){ - rc = sqlite3_exec(db, "PRAGMA defer_foreign_keys = 1", 0, 0, 0); + rc = tdsqlite3_exec(db, "PRAGMA defer_foreign_keys = 1", 0, 0, 0); } - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3changeset_next(pIter) ){ + while( rc==SQLITE_OK && SQLITE_ROW==tdsqlite3changeset_next(pIter) ){ int nCol; int op; const char *zNew; - sqlite3changeset_op(pIter, &zNew, &nCol, &op, 0); + tdsqlite3changeset_op(pIter, &zNew, &nCol, &op, 0); - if( zTab==0 || sqlite3_strnicmp(zNew, zTab, nTab+1) ){ + if( zTab==0 || tdsqlite3_strnicmp(zNew, zTab, nTab+1) ){ u8 *abPK; rc = sessionRetryConstraints( @@ -209188,11 +209188,11 @@ static int sessionChangesetApply( ); if( rc!=SQLITE_OK ) break; - sqlite3_free((char*)sApply.azCol); /* cast works around VC++ bug */ - sqlite3_finalize(sApply.pDelete); - sqlite3_finalize(sApply.pUpdate); - sqlite3_finalize(sApply.pInsert); - sqlite3_finalize(sApply.pSelect); + tdsqlite3_free((char*)sApply.azCol); /* cast works around VC++ bug */ + tdsqlite3_finalize(sApply.pDelete); + tdsqlite3_finalize(sApply.pUpdate); + tdsqlite3_finalize(sApply.pInsert); + tdsqlite3_finalize(sApply.pSelect); sApply.db = db; sApply.pDelete = 0; sApply.pUpdate = 0; @@ -209211,7 +209211,7 @@ static int sessionChangesetApply( ** non-zero, proceed. */ schemaMismatch = (xFilter && (0==xFilter(pCtx, zNew))); if( schemaMismatch ){ - zTab = sqlite3_mprintf("%s", zNew); + zTab = tdsqlite3_mprintf("%s", zNew); if( zTab==0 ){ rc = SQLITE_NOMEM; break; @@ -209222,7 +209222,7 @@ static int sessionChangesetApply( int nMinCol = 0; int i; - sqlite3changeset_pk(pIter, &abPK, 0); + tdsqlite3changeset_pk(pIter, &abPK, 0); rc = sessionTableInfo( db, "main", zNew, &sApply.nCol, &zTab, &sApply.azCol, &sApply.abPK ); @@ -209233,27 +209233,27 @@ static int sessionChangesetApply( if( sApply.nCol==0 ){ schemaMismatch = 1; - sqlite3_log(SQLITE_SCHEMA, - "sqlite3changeset_apply(): no such table: %s", zTab + tdsqlite3_log(SQLITE_SCHEMA, + "tdsqlite3changeset_apply(): no such table: %s", zTab ); } else if( sApply.nColbPatchset; if( rc==SQLITE_OK ){ - rc = sqlite3changeset_finalize(pIter); + rc = tdsqlite3changeset_finalize(pIter); }else{ - sqlite3changeset_finalize(pIter); + tdsqlite3changeset_finalize(pIter); } if( rc==SQLITE_OK ){ @@ -209293,10 +209293,10 @@ static int sessionChangesetApply( if( rc==SQLITE_OK ){ int nFk, notUsed; - sqlite3_db_status(db, SQLITE_DBSTATUS_DEFERRED_FKS, &nFk, ¬Used, 0); + tdsqlite3_db_status(db, SQLITE_DBSTATUS_DEFERRED_FKS, &nFk, ¬Used, 0); if( nFk!=0 ){ int res = SQLITE_CHANGESET_ABORT; - sqlite3_changeset_iter sIter; + tdsqlite3_changeset_iter sIter; memset(&sIter, 0, sizeof(sIter)); sIter.nCol = nFk; res = xConflict(pCtx, SQLITE_CHANGESET_FOREIGN_KEY, &sIter); @@ -209305,14 +209305,14 @@ static int sessionChangesetApply( } } } - sqlite3_exec(db, "PRAGMA defer_foreign_keys = 0", 0, 0, 0); + tdsqlite3_exec(db, "PRAGMA defer_foreign_keys = 0", 0, 0, 0); if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){ if( rc==SQLITE_OK ){ - rc = sqlite3_exec(db, "RELEASE changeset_apply", 0, 0, 0); + rc = tdsqlite3_exec(db, "RELEASE changeset_apply", 0, 0, 0); }else{ - sqlite3_exec(db, "ROLLBACK TO changeset_apply", 0, 0, 0); - sqlite3_exec(db, "RELEASE changeset_apply", 0, 0, 0); + tdsqlite3_exec(db, "ROLLBACK TO changeset_apply", 0, 0, 0); + tdsqlite3_exec(db, "RELEASE changeset_apply", 0, 0, 0); } } @@ -209322,14 +209322,14 @@ static int sessionChangesetApply( *pnRebase = sApply.rebase.nBuf; sApply.rebase.aBuf = 0; } - sqlite3_finalize(sApply.pInsert); - sqlite3_finalize(sApply.pDelete); - sqlite3_finalize(sApply.pUpdate); - sqlite3_finalize(sApply.pSelect); - sqlite3_free((char*)sApply.azCol); /* cast works around VC++ bug */ - sqlite3_free((char*)sApply.constraints.aBuf); - sqlite3_free((char*)sApply.rebase.aBuf); - sqlite3_mutex_leave(sqlite3_db_mutex(db)); + tdsqlite3_finalize(sApply.pInsert); + tdsqlite3_finalize(sApply.pDelete); + tdsqlite3_finalize(sApply.pUpdate); + tdsqlite3_finalize(sApply.pSelect); + tdsqlite3_free((char*)sApply.azCol); /* cast works around VC++ bug */ + tdsqlite3_free((char*)sApply.constraints.aBuf); + tdsqlite3_free((char*)sApply.rebase.aBuf); + tdsqlite3_mutex_leave(tdsqlite3_db_mutex(db)); return rc; } @@ -209337,8 +209337,8 @@ static int sessionChangesetApply( ** Apply the changeset passed via pChangeset/nChangeset to the main ** database attached to handle "db". */ -SQLITE_API int sqlite3changeset_apply_v2( - sqlite3 *db, /* Apply change to "main" db of this handle */ +SQLITE_API int tdsqlite3changeset_apply_v2( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int nChangeset, /* Size of changeset in bytes */ void *pChangeset, /* Changeset blob */ int(*xFilter)( @@ -209348,13 +209348,13 @@ SQLITE_API int sqlite3changeset_apply_v2( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx, /* First argument passed to xConflict */ void **ppRebase, int *pnRebase, int flags ){ - sqlite3_changeset_iter *pIter; /* Iterator to skip through changeset */ + tdsqlite3_changeset_iter *pIter; /* Iterator to skip through changeset */ int bInverse = !!(flags & SQLITE_CHANGESETAPPLY_INVERT); int rc = sessionChangesetStart(&pIter, 0, 0, nChangeset, pChangeset,bInverse); if( rc==SQLITE_OK ){ @@ -209370,8 +209370,8 @@ SQLITE_API int sqlite3changeset_apply_v2( ** attached to handle "db". Invoke the supplied conflict handler callback ** to resolve any conflicts encountered while applying the change. */ -SQLITE_API int sqlite3changeset_apply( - sqlite3 *db, /* Apply change to "main" db of this handle */ +SQLITE_API int tdsqlite3changeset_apply( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int nChangeset, /* Size of changeset in bytes */ void *pChangeset, /* Changeset blob */ int(*xFilter)( @@ -209381,11 +209381,11 @@ SQLITE_API int sqlite3changeset_apply( int(*xConflict)( void *pCtx, /* Copy of fifth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx /* First argument passed to xConflict */ ){ - return sqlite3changeset_apply_v2( + return tdsqlite3changeset_apply_v2( db, nChangeset, pChangeset, xFilter, xConflict, pCtx, 0, 0, 0 ); } @@ -209395,8 +209395,8 @@ SQLITE_API int sqlite3changeset_apply( ** attached to handle "db". Invoke the supplied conflict handler callback ** to resolve any conflicts encountered while applying the change. */ -SQLITE_API int sqlite3changeset_apply_v2_strm( - sqlite3 *db, /* Apply change to "main" db of this handle */ +SQLITE_API int tdsqlite3changeset_apply_v2_strm( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ void *pIn, /* First arg for xInput */ int(*xFilter)( @@ -209406,13 +209406,13 @@ SQLITE_API int sqlite3changeset_apply_v2_strm( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx, /* First argument passed to xConflict */ void **ppRebase, int *pnRebase, int flags ){ - sqlite3_changeset_iter *pIter; /* Iterator to skip through changeset */ + tdsqlite3_changeset_iter *pIter; /* Iterator to skip through changeset */ int bInverse = !!(flags & SQLITE_CHANGESETAPPLY_INVERT); int rc = sessionChangesetStart(&pIter, xInput, pIn, 0, 0, bInverse); if( rc==SQLITE_OK ){ @@ -209422,8 +209422,8 @@ SQLITE_API int sqlite3changeset_apply_v2_strm( } return rc; } -SQLITE_API int sqlite3changeset_apply_strm( - sqlite3 *db, /* Apply change to "main" db of this handle */ +SQLITE_API int tdsqlite3changeset_apply_strm( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ void *pIn, /* First arg for xInput */ int(*xFilter)( @@ -209433,19 +209433,19 @@ SQLITE_API int sqlite3changeset_apply_strm( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx /* First argument passed to xConflict */ ){ - return sqlite3changeset_apply_v2_strm( + return tdsqlite3changeset_apply_v2_strm( db, xInput, pIn, xFilter, xConflict, pCtx, 0, 0, 0 ); } /* -** sqlite3_changegroup handle. +** tdsqlite3_changegroup handle. */ -struct sqlite3_changegroup { +struct tdsqlite3_changegroup { int rc; /* Error code */ int bPatch; /* True to accumulate patchsets */ SessionTable *pList; /* List of tables in current patch */ @@ -209453,7 +209453,7 @@ struct sqlite3_changegroup { /* ** This function is called to merge two changes to the same row together as -** part of an sqlite3changeset_concat() operation. A new change object is +** part of an tdsqlite3changeset_concat() operation. A new change object is ** allocated and a pointer to it stored in *ppNew. */ static int sessionChangeMerge( @@ -209471,7 +209471,7 @@ static int sessionChangeMerge( int rc = SQLITE_OK; if( !pExist ){ - pNew = (SessionChange *)sqlite3_malloc64(sizeof(SessionChange) + nRec); + pNew = (SessionChange *)tdsqlite3_malloc64(sizeof(SessionChange) + nRec); if( !pNew ){ return SQLITE_NOMEM; } @@ -209504,8 +209504,8 @@ static int sessionChangeMerge( if( pExist->op==SQLITE_DELETE && pExist->bIndirect ){ *ppNew = pExist; }else{ - sqlite3_int64 nByte = nRec + pExist->nRecord + sizeof(SessionChange); - pNew = (SessionChange*)sqlite3_malloc64(nByte); + tdsqlite3_int64 nByte = nRec + pExist->nRecord + sizeof(SessionChange); + pNew = (SessionChange*)tdsqlite3_malloc64(nByte); if( pNew==0 ){ rc = SQLITE_NOMEM; }else{ @@ -209536,7 +209536,7 @@ static int sessionChangeMerge( } pNew->nRecord = pOut - pNew->aRecord; } - sqlite3_free(pExist); + tdsqlite3_free(pExist); } }else{ int op1 = pExist->op; @@ -209561,20 +209561,20 @@ static int sessionChangeMerge( ){ pNew = pExist; }else if( op1==SQLITE_INSERT && op2==SQLITE_DELETE ){ - sqlite3_free(pExist); + tdsqlite3_free(pExist); assert( pNew==0 ); }else{ u8 *aExist = pExist->aRecord; - sqlite3_int64 nByte; + tdsqlite3_int64 nByte; u8 *aCsr; /* Allocate a new SessionChange object. Ensure that the aRecord[] ** buffer of the new object is large enough to hold any record that ** may be generated by combining the input records. */ nByte = sizeof(SessionChange) + pExist->nRecord + nRec; - pNew = (SessionChange *)sqlite3_malloc64(nByte); + pNew = (SessionChange *)tdsqlite3_malloc64(nByte); if( !pNew ){ - sqlite3_free(pExist); + tdsqlite3_free(pExist); return SQLITE_NOMEM; } memset(pNew, 0, sizeof(SessionChange)); @@ -209595,7 +209595,7 @@ static int sessionChangeMerge( aCsr += nRec; }else{ if( 0==sessionMergeUpdate(&aCsr, pTab, bPatchset, aExist, 0,aRec,0) ){ - sqlite3_free(pNew); + tdsqlite3_free(pNew); pNew = 0; } } @@ -209609,7 +209609,7 @@ static int sessionChangeMerge( } pNew->op = SQLITE_UPDATE; if( 0==sessionMergeUpdate(&aCsr, pTab, bPatchset, aRec, aExist,a1,a2) ){ - sqlite3_free(pNew); + tdsqlite3_free(pNew); pNew = 0; } }else{ /* UPDATE + DELETE */ @@ -209626,7 +209626,7 @@ static int sessionChangeMerge( if( pNew ){ pNew->nRecord = (int)(aCsr - pNew->aRecord); } - sqlite3_free(pExist); + tdsqlite3_free(pExist); } } @@ -209639,8 +209639,8 @@ static int sessionChangeMerge( ** the first argument to the changegroup hash tables. */ static int sessionChangesetToHash( - sqlite3_changeset_iter *pIter, /* Iterator to read from */ - sqlite3_changegroup *pGrp, /* Changegroup object to add changeset to */ + tdsqlite3_changeset_iter *pIter, /* Iterator to read from */ + tdsqlite3_changegroup *pGrp, /* Changegroup object to add changeset to */ int bRebase /* True if hash table is for rebasing */ ){ u8 *aRec; @@ -209665,20 +209665,20 @@ static int sessionChangesetToHash( break; } - sqlite3changeset_op(pIter, &zNew, &nCol, &op, &bIndirect); - if( !pTab || sqlite3_stricmp(zNew, pTab->zName) ){ + tdsqlite3changeset_op(pIter, &zNew, &nCol, &op, &bIndirect); + if( !pTab || tdsqlite3_stricmp(zNew, pTab->zName) ){ /* Search the list for a matching table */ int nNew = (int)strlen(zNew); u8 *abPK; - sqlite3changeset_pk(pIter, &abPK, 0); + tdsqlite3changeset_pk(pIter, &abPK, 0); for(pTab = pGrp->pList; pTab; pTab=pTab->pNext){ - if( 0==sqlite3_strnicmp(pTab->zName, zNew, nNew+1) ) break; + if( 0==tdsqlite3_strnicmp(pTab->zName, zNew, nNew+1) ) break; } if( !pTab ){ SessionTable **ppTab; - pTab = sqlite3_malloc64(sizeof(SessionTable) + nCol + nNew+1); + pTab = tdsqlite3_malloc64(sizeof(SessionTable) + nCol + nNew+1); if( !pTab ){ rc = SQLITE_NOMEM; break; @@ -209692,7 +209692,7 @@ static int sessionChangesetToHash( /* The new object must be linked on to the end of the list, not ** simply added to the start of it. This is to ensure that the - ** tables within the output of sqlite3changegroup_output() are in + ** tables within the output of tdsqlite3changegroup_output() are in ** the right order. */ for(ppTab=&pGrp->pList; *ppTab; ppTab=&(*ppTab)->pNext); *ppTab = pTab; @@ -209755,14 +209755,14 @@ static int sessionChangesetToHash( ** buffer containing the output changeset before this function returns. In ** this case (*pnOut) is set to the size of the output buffer in bytes. It ** is the responsibility of the caller to free the output buffer using -** sqlite3_free() when it is no longer required. +** tdsqlite3_free() when it is no longer required. ** ** If successful, SQLITE_OK is returned. Or, if an error occurs, an SQLite ** error code. If an error occurs and xOutput is NULL, (*ppOut) and (*pnOut) ** are both set to 0 before returning. */ static int sessionChangegroupOutput( - sqlite3_changegroup *pGrp, + tdsqlite3_changegroup *pGrp, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut, int *pnOut, @@ -209804,22 +209804,22 @@ static int sessionChangegroupOutput( buf.aBuf = 0; } } - sqlite3_free(buf.aBuf); + tdsqlite3_free(buf.aBuf); return rc; } /* -** Allocate a new, empty, sqlite3_changegroup. +** Allocate a new, empty, tdsqlite3_changegroup. */ -SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp){ +SQLITE_API int tdsqlite3changegroup_new(tdsqlite3_changegroup **pp){ int rc = SQLITE_OK; /* Return code */ - sqlite3_changegroup *p; /* New object */ - p = (sqlite3_changegroup*)sqlite3_malloc(sizeof(sqlite3_changegroup)); + tdsqlite3_changegroup *p; /* New object */ + p = (tdsqlite3_changegroup*)tdsqlite3_malloc(sizeof(tdsqlite3_changegroup)); if( p==0 ){ rc = SQLITE_NOMEM; }else{ - memset(p, 0, sizeof(sqlite3_changegroup)); + memset(p, 0, sizeof(tdsqlite3_changegroup)); } *pp = p; return rc; @@ -209829,15 +209829,15 @@ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp){ ** Add the changeset currently stored in buffer pData, size nData bytes, ** to changeset-group p. */ -SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup *pGrp, int nData, void *pData){ - sqlite3_changeset_iter *pIter; /* Iterator opened on pData/nData */ +SQLITE_API int tdsqlite3changegroup_add(tdsqlite3_changegroup *pGrp, int nData, void *pData){ + tdsqlite3_changeset_iter *pIter; /* Iterator opened on pData/nData */ int rc; /* Return code */ - rc = sqlite3changeset_start(&pIter, nData, pData); + rc = tdsqlite3changeset_start(&pIter, nData, pData); if( rc==SQLITE_OK ){ rc = sessionChangesetToHash(pIter, pGrp, 0); } - sqlite3changeset_finalize(pIter); + tdsqlite3changeset_finalize(pIter); return rc; } @@ -209845,8 +209845,8 @@ SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup *pGrp, int nData, void ** Obtain a buffer containing a changeset representing the concatenation ** of all changesets added to the group so far. */ -SQLITE_API int sqlite3changegroup_output( - sqlite3_changegroup *pGrp, +SQLITE_API int tdsqlite3changegroup_output( + tdsqlite3_changegroup *pGrp, int *pnData, void **ppData ){ @@ -209856,27 +209856,27 @@ SQLITE_API int sqlite3changegroup_output( /* ** Streaming versions of changegroup_add(). */ -SQLITE_API int sqlite3changegroup_add_strm( - sqlite3_changegroup *pGrp, +SQLITE_API int tdsqlite3changegroup_add_strm( + tdsqlite3_changegroup *pGrp, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn ){ - sqlite3_changeset_iter *pIter; /* Iterator opened on pData/nData */ + tdsqlite3_changeset_iter *pIter; /* Iterator opened on pData/nData */ int rc; /* Return code */ - rc = sqlite3changeset_start_strm(&pIter, xInput, pIn); + rc = tdsqlite3changeset_start_strm(&pIter, xInput, pIn); if( rc==SQLITE_OK ){ rc = sessionChangesetToHash(pIter, pGrp, 0); } - sqlite3changeset_finalize(pIter); + tdsqlite3changeset_finalize(pIter); return rc; } /* ** Streaming versions of changegroup_output(). */ -SQLITE_API int sqlite3changegroup_output_strm( - sqlite3_changegroup *pGrp, +SQLITE_API int tdsqlite3changegroup_output_strm( + tdsqlite3_changegroup *pGrp, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ){ @@ -209886,17 +209886,17 @@ SQLITE_API int sqlite3changegroup_output_strm( /* ** Delete a changegroup object. */ -SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup *pGrp){ +SQLITE_API void tdsqlite3changegroup_delete(tdsqlite3_changegroup *pGrp){ if( pGrp ){ sessionDeleteTable(pGrp->pList); - sqlite3_free(pGrp); + tdsqlite3_free(pGrp); } } /* ** Combine two changesets together. */ -SQLITE_API int sqlite3changeset_concat( +SQLITE_API int tdsqlite3changeset_concat( int nLeft, /* Number of bytes in lhs input */ void *pLeft, /* Lhs input changeset */ int nRight /* Number of bytes in rhs input */, @@ -209904,28 +209904,28 @@ SQLITE_API int sqlite3changeset_concat( int *pnOut, /* OUT: Number of bytes in output changeset */ void **ppOut /* OUT: changeset (left right) */ ){ - sqlite3_changegroup *pGrp; + tdsqlite3_changegroup *pGrp; int rc; - rc = sqlite3changegroup_new(&pGrp); + rc = tdsqlite3changegroup_new(&pGrp); if( rc==SQLITE_OK ){ - rc = sqlite3changegroup_add(pGrp, nLeft, pLeft); + rc = tdsqlite3changegroup_add(pGrp, nLeft, pLeft); } if( rc==SQLITE_OK ){ - rc = sqlite3changegroup_add(pGrp, nRight, pRight); + rc = tdsqlite3changegroup_add(pGrp, nRight, pRight); } if( rc==SQLITE_OK ){ - rc = sqlite3changegroup_output(pGrp, pnOut, ppOut); + rc = tdsqlite3changegroup_output(pGrp, pnOut, ppOut); } - sqlite3changegroup_delete(pGrp); + tdsqlite3changegroup_delete(pGrp); return rc; } /* -** Streaming version of sqlite3changeset_concat(). +** Streaming version of tdsqlite3changeset_concat(). */ -SQLITE_API int sqlite3changeset_concat_strm( +SQLITE_API int tdsqlite3changeset_concat_strm( int (*xInputA)(void *pIn, void *pData, int *pnData), void *pInA, int (*xInputB)(void *pIn, void *pData, int *pnData), @@ -209933,20 +209933,20 @@ SQLITE_API int sqlite3changeset_concat_strm( int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ){ - sqlite3_changegroup *pGrp; + tdsqlite3_changegroup *pGrp; int rc; - rc = sqlite3changegroup_new(&pGrp); + rc = tdsqlite3changegroup_new(&pGrp); if( rc==SQLITE_OK ){ - rc = sqlite3changegroup_add_strm(pGrp, xInputA, pInA); + rc = tdsqlite3changegroup_add_strm(pGrp, xInputA, pInA); } if( rc==SQLITE_OK ){ - rc = sqlite3changegroup_add_strm(pGrp, xInputB, pInB); + rc = tdsqlite3changegroup_add_strm(pGrp, xInputB, pInB); } if( rc==SQLITE_OK ){ - rc = sqlite3changegroup_output_strm(pGrp, xOutput, pOut); + rc = tdsqlite3changegroup_output_strm(pGrp, xOutput, pOut); } - sqlite3changegroup_delete(pGrp); + tdsqlite3changegroup_delete(pGrp); return rc; } @@ -209954,8 +209954,8 @@ SQLITE_API int sqlite3changeset_concat_strm( /* ** Changeset rebaser handle. */ -struct sqlite3_rebaser { - sqlite3_changegroup grp; /* Hash table */ +struct tdsqlite3_rebaser { + tdsqlite3_changegroup grp; /* Hash table */ }; /* @@ -210015,7 +210015,7 @@ static void sessionAppendRecordMerge( */ static void sessionAppendPartialUpdate( SessionBuffer *pBuf, /* Append record here */ - sqlite3_changeset_iter *pIter, /* Iterator pointed at local change */ + tdsqlite3_changeset_iter *pIter, /* Iterator pointed at local change */ u8 *aRec, int nRec, /* Local change */ u8 *aChange, int nChange, /* Record to rebase against */ int *pRc /* IN/OUT: Return Code */ @@ -210075,15 +210075,15 @@ static void sessionAppendPartialUpdate( ** then (*ppOut) is set to point to a buffer containing the rebased changeset ** before this function returns. In this case (*pnOut) is set to the size of ** the buffer in bytes. It is the responsibility of the caller to eventually -** free the (*ppOut) buffer using sqlite3_free(). +** free the (*ppOut) buffer using tdsqlite3_free(). ** ** If an error occurs, an SQLite error code is returned. If ppOut and ** pnOut are not NULL, then the two output parameters are set to 0 before ** returning. */ static int sessionRebase( - sqlite3_rebaser *p, /* Rebaser hash table */ - sqlite3_changeset_iter *pIter, /* Input data */ + tdsqlite3_rebaser *p, /* Rebaser hash table */ + tdsqlite3_changeset_iter *pIter, /* Input data */ int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut, /* Context for xOutput callback */ int *pnOut, /* OUT: Number of bytes in output changeset */ @@ -210103,7 +210103,7 @@ static int sessionRebase( if( bNew ){ const char *zTab = pIter->zTab; for(pTab=p->grp.pList; pTab; pTab=pTab->pNext){ - if( 0==sqlite3_stricmp(pTab->zName, zTab) ) break; + if( 0==tdsqlite3_stricmp(pTab->zName, zTab) ) break; } bNew = 0; @@ -210191,7 +210191,7 @@ static int sessionRebase( } if( rc!=SQLITE_OK ){ - sqlite3_free(sOut.aBuf); + tdsqlite3_free(sOut.aBuf); memset(&sOut, 0, sizeof(sOut)); } @@ -210206,22 +210206,22 @@ static int sessionRebase( sOut.aBuf = 0; } } - sqlite3_free(sOut.aBuf); + tdsqlite3_free(sOut.aBuf); return rc; } /* ** Create a new rebaser object. */ -SQLITE_API int sqlite3rebaser_create(sqlite3_rebaser **ppNew){ +SQLITE_API int tdsqlite3rebaser_create(tdsqlite3_rebaser **ppNew){ int rc = SQLITE_OK; - sqlite3_rebaser *pNew; + tdsqlite3_rebaser *pNew; - pNew = sqlite3_malloc(sizeof(sqlite3_rebaser)); + pNew = tdsqlite3_malloc(sizeof(tdsqlite3_rebaser)); if( pNew==0 ){ rc = SQLITE_NOMEM; }else{ - memset(pNew, 0, sizeof(sqlite3_rebaser)); + memset(pNew, 0, sizeof(tdsqlite3_rebaser)); } *ppNew = pNew; return rc; @@ -210230,34 +210230,34 @@ SQLITE_API int sqlite3rebaser_create(sqlite3_rebaser **ppNew){ /* ** Call this one or more times to configure a rebaser. */ -SQLITE_API int sqlite3rebaser_configure( - sqlite3_rebaser *p, +SQLITE_API int tdsqlite3rebaser_configure( + tdsqlite3_rebaser *p, int nRebase, const void *pRebase ){ - sqlite3_changeset_iter *pIter = 0; /* Iterator opened on pData/nData */ + tdsqlite3_changeset_iter *pIter = 0; /* Iterator opened on pData/nData */ int rc; /* Return code */ - rc = sqlite3changeset_start(&pIter, nRebase, (void*)pRebase); + rc = tdsqlite3changeset_start(&pIter, nRebase, (void*)pRebase); if( rc==SQLITE_OK ){ rc = sessionChangesetToHash(pIter, &p->grp, 1); } - sqlite3changeset_finalize(pIter); + tdsqlite3changeset_finalize(pIter); return rc; } /* ** Rebase a changeset according to current rebaser configuration */ -SQLITE_API int sqlite3rebaser_rebase( - sqlite3_rebaser *p, +SQLITE_API int tdsqlite3rebaser_rebase( + tdsqlite3_rebaser *p, int nIn, const void *pIn, int *pnOut, void **ppOut ){ - sqlite3_changeset_iter *pIter = 0; /* Iterator to skip through input */ - int rc = sqlite3changeset_start(&pIter, nIn, (void*)pIn); + tdsqlite3_changeset_iter *pIter = 0; /* Iterator to skip through input */ + int rc = tdsqlite3changeset_start(&pIter, nIn, (void*)pIn); if( rc==SQLITE_OK ){ rc = sessionRebase(p, pIter, 0, 0, pnOut, ppOut); - sqlite3changeset_finalize(pIter); + tdsqlite3changeset_finalize(pIter); } return rc; @@ -210266,19 +210266,19 @@ SQLITE_API int sqlite3rebaser_rebase( /* ** Rebase a changeset according to current rebaser configuration */ -SQLITE_API int sqlite3rebaser_rebase_strm( - sqlite3_rebaser *p, +SQLITE_API int tdsqlite3rebaser_rebase_strm( + tdsqlite3_rebaser *p, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ){ - sqlite3_changeset_iter *pIter = 0; /* Iterator to skip through input */ - int rc = sqlite3changeset_start_strm(&pIter, xInput, pIn); + tdsqlite3_changeset_iter *pIter = 0; /* Iterator to skip through input */ + int rc = tdsqlite3changeset_start_strm(&pIter, xInput, pIn); if( rc==SQLITE_OK ){ rc = sessionRebase(p, pIter, xOutput, pOut, 0, 0); - sqlite3changeset_finalize(pIter); + tdsqlite3changeset_finalize(pIter); } return rc; @@ -210287,17 +210287,17 @@ SQLITE_API int sqlite3rebaser_rebase_strm( /* ** Destroy a rebaser object */ -SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p){ +SQLITE_API void tdsqlite3rebaser_delete(tdsqlite3_rebaser *p){ if( p ){ sessionDeleteTable(p->grp.pList); - sqlite3_free(p); + tdsqlite3_free(p); } } /* ** Global configuration */ -SQLITE_API int sqlite3session_config(int op, void *pArg){ +SQLITE_API int tdsqlite3session_config(int op, void *pArg){ int rc = SQLITE_OK; switch( op ){ case SQLITE_SESSION_CONFIG_STRMSIZE: { @@ -210317,7 +210317,7 @@ SQLITE_API int sqlite3session_config(int op, void *pArg){ #endif /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */ -/************** End of sqlite3session.c **************************************/ +/************** End of tdsqlite3session.c **************************************/ /************** Begin file fts5.c ********************************************/ @@ -210363,7 +210363,7 @@ extern "C" { ** CUSTOM AUXILIARY FUNCTIONS ** ** Virtual table implementations may overload SQL functions by implementing -** the sqlite3_module.xFindFunction() method. +** the tdsqlite3_module.xFindFunction() method. */ typedef struct Fts5ExtensionApi Fts5ExtensionApi; @@ -210373,9 +210373,9 @@ typedef struct Fts5PhraseIter Fts5PhraseIter; typedef void (*fts5_extension_function)( const Fts5ExtensionApi *pApi, /* API offered by current FTS version */ Fts5Context *pFts, /* First arg to pass to pApi functions */ - sqlite3_context *pCtx, /* Context for returning result/error */ + tdsqlite3_context *pCtx, /* Context for returning result/error */ int nVal, /* Number of values in apVal[] array */ - sqlite3_value **apVal /* Array of trailing arguments */ + tdsqlite3_value **apVal /* Array of trailing arguments */ ); struct Fts5PhraseIter { @@ -210600,8 +210600,8 @@ struct Fts5ExtensionApi { void *(*xUserData)(Fts5Context*); int (*xColumnCount)(Fts5Context*); - int (*xRowCount)(Fts5Context*, sqlite3_int64 *pnRow); - int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64 *pnToken); + int (*xRowCount)(Fts5Context*, tdsqlite3_int64 *pnRow); + int (*xColumnTotalSize)(Fts5Context*, int iCol, tdsqlite3_int64 *pnToken); int (*xTokenize)(Fts5Context*, const char *pText, int nText, /* Text to tokenize */ @@ -210615,7 +210615,7 @@ struct Fts5ExtensionApi { int (*xInstCount)(Fts5Context*, int *pnInst); int (*xInst)(Fts5Context*, int iIdx, int *piPhrase, int *piCol, int *piOff); - sqlite3_int64 (*xRowid)(Fts5Context*); + tdsqlite3_int64 (*xRowid)(Fts5Context*); int (*xColumnText)(Fts5Context*, int iCol, const char **pz, int *pn); int (*xColumnSize)(Fts5Context*, int iCol, int *pnToken); @@ -210923,7 +210923,7 @@ struct fts5_api { #define _FTS5INT_H /* #include "fts5.h" */ -/* #include "sqlite3ext.h" */ +/* #include "tdsqlite3ext.h" */ SQLITE_EXTENSION_INIT1 /* #include */ @@ -210935,8 +210935,8 @@ typedef unsigned char u8; typedef unsigned int u32; typedef unsigned short u16; typedef short i16; -typedef sqlite3_int64 i64; -typedef sqlite3_uint64 u64; +typedef tdsqlite3_int64 i64; +typedef tdsqlite3_uint64 u64; #ifndef ArraySize # define ArraySize(x) ((int)(sizeof(x) / sizeof(x[0]))) @@ -210982,8 +210982,8 @@ typedef sqlite3_uint64 u64; #define FTS5_ROWID_NAME "rowid" #ifdef SQLITE_DEBUG -# define FTS5_CORRUPT sqlite3Fts5Corrupt() -static int sqlite3Fts5Corrupt(void); +# define FTS5_CORRUPT tdsqlite3Fts5Corrupt() +static int tdsqlite3Fts5Corrupt(void); #else # define FTS5_CORRUPT SQLITE_CORRUPT_VTAB #endif @@ -210994,8 +210994,8 @@ static int sqlite3Fts5Corrupt(void); ** guranteed that the database is not corrupt. */ #ifdef SQLITE_DEBUG -SQLITE_API extern int sqlite3_fts5_may_be_corrupt; -# define assert_nc(x) assert(sqlite3_fts5_may_be_corrupt || (x)) +SQLITE_API extern int tdsqlite3_fts5_may_be_corrupt; +# define assert_nc(x) assert(tdsqlite3_fts5_may_be_corrupt || (x)) #else # define assert_nc(x) assert(x) #endif @@ -211075,7 +211075,7 @@ typedef struct Fts5Config Fts5Config; ** */ struct Fts5Config { - sqlite3 *db; /* Database handle */ + tdsqlite3 *db; /* Database handle */ char *zDb; /* Database holding FTS index (e.g. "main") */ char *zName; /* Name of FTS index */ int nCol; /* Number of columns */ @@ -211103,7 +211103,7 @@ struct Fts5Config { char *zRank; /* Name of rank function */ char *zRankArgs; /* Arguments to rank function */ - /* If non-NULL, points to sqlite3_vtab.base.zErrmsg. Often NULL. */ + /* If non-NULL, points to tdsqlite3_vtab.base.zErrmsg. Often NULL. */ char **pzErrmsg; #ifdef SQLITE_DEBUG @@ -211124,14 +211124,14 @@ struct Fts5Config { -static int sqlite3Fts5ConfigParse( - Fts5Global*, sqlite3*, int, const char **, Fts5Config**, char** +static int tdsqlite3Fts5ConfigParse( + Fts5Global*, tdsqlite3*, int, const char **, Fts5Config**, char** ); -static void sqlite3Fts5ConfigFree(Fts5Config*); +static void tdsqlite3Fts5ConfigFree(Fts5Config*); -static int sqlite3Fts5ConfigDeclareVtab(Fts5Config *pConfig); +static int tdsqlite3Fts5ConfigDeclareVtab(Fts5Config *pConfig); -static int sqlite3Fts5Tokenize( +static int tdsqlite3Fts5Tokenize( Fts5Config *pConfig, /* FTS5 Configuration object */ int flags, /* FTS5_TOKENIZE_* flags */ const char *pText, int nText, /* Text to tokenize */ @@ -211139,15 +211139,15 @@ static int sqlite3Fts5Tokenize( int (*xToken)(void*, int, const char*, int, int, int) /* Callback */ ); -static void sqlite3Fts5Dequote(char *z); +static void tdsqlite3Fts5Dequote(char *z); /* Load the contents of the %_config table */ -static int sqlite3Fts5ConfigLoad(Fts5Config*, int); +static int tdsqlite3Fts5ConfigLoad(Fts5Config*, int); /* Set the value of a single config attribute */ -static int sqlite3Fts5ConfigSetValue(Fts5Config*, const char*, sqlite3_value*, int*); +static int tdsqlite3Fts5ConfigSetValue(Fts5Config*, const char*, tdsqlite3_value*, int*); -static int sqlite3Fts5ConfigParseRank(const char*, char**, char**); +static int tdsqlite3Fts5ConfigParseRank(const char*, char**, char**); /* ** End of interface to code in fts5_config.c. @@ -211167,38 +211167,38 @@ struct Fts5Buffer { int nSpace; }; -static int sqlite3Fts5BufferSize(int*, Fts5Buffer*, u32); -static void sqlite3Fts5BufferAppendVarint(int*, Fts5Buffer*, i64); -static void sqlite3Fts5BufferAppendBlob(int*, Fts5Buffer*, u32, const u8*); -static void sqlite3Fts5BufferAppendString(int *, Fts5Buffer*, const char*); -static void sqlite3Fts5BufferFree(Fts5Buffer*); -static void sqlite3Fts5BufferZero(Fts5Buffer*); -static void sqlite3Fts5BufferSet(int*, Fts5Buffer*, int, const u8*); -static void sqlite3Fts5BufferAppendPrintf(int *, Fts5Buffer*, char *zFmt, ...); +static int tdsqlite3Fts5BufferSize(int*, Fts5Buffer*, u32); +static void tdsqlite3Fts5BufferAppendVarint(int*, Fts5Buffer*, i64); +static void tdsqlite3Fts5BufferAppendBlob(int*, Fts5Buffer*, u32, const u8*); +static void tdsqlite3Fts5BufferAppendString(int *, Fts5Buffer*, const char*); +static void tdsqlite3Fts5BufferFree(Fts5Buffer*); +static void tdsqlite3Fts5BufferZero(Fts5Buffer*); +static void tdsqlite3Fts5BufferSet(int*, Fts5Buffer*, int, const u8*); +static void tdsqlite3Fts5BufferAppendPrintf(int *, Fts5Buffer*, char *zFmt, ...); -static char *sqlite3Fts5Mprintf(int *pRc, const char *zFmt, ...); +static char *tdsqlite3Fts5Mprintf(int *pRc, const char *zFmt, ...); -#define fts5BufferZero(x) sqlite3Fts5BufferZero(x) -#define fts5BufferAppendVarint(a,b,c) sqlite3Fts5BufferAppendVarint(a,b,c) -#define fts5BufferFree(a) sqlite3Fts5BufferFree(a) -#define fts5BufferAppendBlob(a,b,c,d) sqlite3Fts5BufferAppendBlob(a,b,c,d) -#define fts5BufferSet(a,b,c,d) sqlite3Fts5BufferSet(a,b,c,d) +#define fts5BufferZero(x) tdsqlite3Fts5BufferZero(x) +#define fts5BufferAppendVarint(a,b,c) tdsqlite3Fts5BufferAppendVarint(a,b,c) +#define fts5BufferFree(a) tdsqlite3Fts5BufferFree(a) +#define fts5BufferAppendBlob(a,b,c,d) tdsqlite3Fts5BufferAppendBlob(a,b,c,d) +#define fts5BufferSet(a,b,c,d) tdsqlite3Fts5BufferSet(a,b,c,d) #define fts5BufferGrow(pRc,pBuf,nn) ( \ (u32)((pBuf)->n) + (u32)(nn) <= (u32)((pBuf)->nSpace) ? 0 : \ - sqlite3Fts5BufferSize((pRc),(pBuf),(nn)+(pBuf)->n) \ + tdsqlite3Fts5BufferSize((pRc),(pBuf),(nn)+(pBuf)->n) \ ) /* Write and decode big-endian 32-bit integer values */ -static void sqlite3Fts5Put32(u8*, int); -static int sqlite3Fts5Get32(const u8*); +static void tdsqlite3Fts5Put32(u8*, int); +static int tdsqlite3Fts5Get32(const u8*); #define FTS5_POS2COLUMN(iPos) (int)(iPos >> 32) #define FTS5_POS2OFFSET(iPos) (int)(iPos & 0x7FFFFFFF) typedef struct Fts5PoslistReader Fts5PoslistReader; struct Fts5PoslistReader { - /* Variables used only by sqlite3Fts5PoslistIterXXX() functions. */ + /* Variables used only by tdsqlite3Fts5PoslistIterXXX() functions. */ const u8 *a; /* Position list to iterate through */ int n; /* Size of buffer at a[] in bytes */ int i; /* Current offset in a[] */ @@ -211209,38 +211209,38 @@ struct Fts5PoslistReader { u8 bEof; /* Set to true at EOF */ i64 iPos; /* (iCol<<32) + iPos */ }; -static int sqlite3Fts5PoslistReaderInit( +static int tdsqlite3Fts5PoslistReaderInit( const u8 *a, int n, /* Poslist buffer to iterate through */ Fts5PoslistReader *pIter /* Iterator object to initialize */ ); -static int sqlite3Fts5PoslistReaderNext(Fts5PoslistReader*); +static int tdsqlite3Fts5PoslistReaderNext(Fts5PoslistReader*); typedef struct Fts5PoslistWriter Fts5PoslistWriter; struct Fts5PoslistWriter { i64 iPrev; }; -static int sqlite3Fts5PoslistWriterAppend(Fts5Buffer*, Fts5PoslistWriter*, i64); -static void sqlite3Fts5PoslistSafeAppend(Fts5Buffer*, i64*, i64); +static int tdsqlite3Fts5PoslistWriterAppend(Fts5Buffer*, Fts5PoslistWriter*, i64); +static void tdsqlite3Fts5PoslistSafeAppend(Fts5Buffer*, i64*, i64); -static int sqlite3Fts5PoslistNext64( +static int tdsqlite3Fts5PoslistNext64( const u8 *a, int n, /* Buffer containing poslist */ int *pi, /* IN/OUT: Offset within a[] */ i64 *piOff /* IN/OUT: Current offset */ ); /* Malloc utility */ -static void *sqlite3Fts5MallocZero(int *pRc, sqlite3_int64 nByte); -static char *sqlite3Fts5Strndup(int *pRc, const char *pIn, int nIn); +static void *tdsqlite3Fts5MallocZero(int *pRc, tdsqlite3_int64 nByte); +static char *tdsqlite3Fts5Strndup(int *pRc, const char *pIn, int nIn); /* Character set tests (like isspace(), isalpha() etc.) */ -static int sqlite3Fts5IsBareword(char t); +static int tdsqlite3Fts5IsBareword(char t); /* Bucket of terms object used by the integrity-check in offsets=0 mode. */ typedef struct Fts5Termset Fts5Termset; -static int sqlite3Fts5TermsetNew(Fts5Termset**); -static int sqlite3Fts5TermsetAdd(Fts5Termset*, int, const char*, int, int *pbPresent); -static void sqlite3Fts5TermsetFree(Fts5Termset*); +static int tdsqlite3Fts5TermsetNew(Fts5Termset**); +static int tdsqlite3Fts5TermsetAdd(Fts5Termset*, int, const char*, int, int *pbPresent); +static void tdsqlite3Fts5TermsetFree(Fts5Termset*); /* ** End of interface to code in fts5_buffer.c. @@ -211261,7 +211261,7 @@ struct Fts5IndexIter { u8 bEof; }; -#define sqlite3Fts5IterEof(x) ((x)->bEof) +#define tdsqlite3Fts5IterEof(x) ((x)->bEof) /* ** Values used as part of the flags argument passed to IndexQuery(). @@ -211280,13 +211280,13 @@ struct Fts5IndexIter { /* ** Create/destroy an Fts5Index object. */ -static int sqlite3Fts5IndexOpen(Fts5Config *pConfig, int bCreate, Fts5Index**, char**); -static int sqlite3Fts5IndexClose(Fts5Index *p); +static int tdsqlite3Fts5IndexOpen(Fts5Config *pConfig, int bCreate, Fts5Index**, char**); +static int tdsqlite3Fts5IndexClose(Fts5Index *p); /* ** Return a simple checksum value based on the arguments. */ -static u64 sqlite3Fts5IndexEntryCksum( +static u64 tdsqlite3Fts5IndexEntryCksum( i64 iRowid, int iCol, int iPos, @@ -211300,7 +211300,7 @@ static u64 sqlite3Fts5IndexEntryCksum( ** size. Return the number of bytes in the nChar character prefix of the ** buffer, or 0 if there are less than nChar characters in total. */ -static int sqlite3Fts5IndexCharlenToBytelen( +static int tdsqlite3Fts5IndexCharlenToBytelen( const char *p, int nByte, int nChar @@ -211310,7 +211310,7 @@ static int sqlite3Fts5IndexCharlenToBytelen( ** Open a new iterator to iterate though all rowids that match the ** specified token or token prefix. */ -static int sqlite3Fts5IndexQuery( +static int tdsqlite3Fts5IndexQuery( Fts5Index *p, /* FTS index to query */ const char *pToken, int nToken, /* Token (or prefix) to query for */ int flags, /* Mask of FTS5INDEX_QUERY_X flags */ @@ -211320,26 +211320,26 @@ static int sqlite3Fts5IndexQuery( /* ** The various operations on open token or token prefix iterators opened -** using sqlite3Fts5IndexQuery(). +** using tdsqlite3Fts5IndexQuery(). */ -static int sqlite3Fts5IterNext(Fts5IndexIter*); -static int sqlite3Fts5IterNextFrom(Fts5IndexIter*, i64 iMatch); +static int tdsqlite3Fts5IterNext(Fts5IndexIter*); +static int tdsqlite3Fts5IterNextFrom(Fts5IndexIter*, i64 iMatch); /* -** Close an iterator opened by sqlite3Fts5IndexQuery(). +** Close an iterator opened by tdsqlite3Fts5IndexQuery(). */ -static void sqlite3Fts5IterClose(Fts5IndexIter*); +static void tdsqlite3Fts5IterClose(Fts5IndexIter*); /* ** Close the reader blob handle, if it is open. */ -static void sqlite3Fts5IndexCloseReader(Fts5Index*); +static void tdsqlite3Fts5IndexCloseReader(Fts5Index*); /* ** This interface is used by the fts5vocab module. */ -static const char *sqlite3Fts5IterTerm(Fts5IndexIter*, int*); -static int sqlite3Fts5IterNextScan(Fts5IndexIter*); +static const char *tdsqlite3Fts5IterTerm(Fts5IndexIter*, int*); +static int tdsqlite3Fts5IterNextScan(Fts5IndexIter*); /* @@ -211352,7 +211352,7 @@ static int sqlite3Fts5IterNextScan(Fts5IndexIter*); ** unique token in the document with an iCol value less than zero. The iPos ** argument is ignored for a delete. */ -static int sqlite3Fts5IndexWrite( +static int tdsqlite3Fts5IndexWrite( Fts5Index *p, /* Index to write to */ int iCol, /* Column token appears in (-ve -> delete) */ int iPos, /* Position of token within column */ @@ -211360,10 +211360,10 @@ static int sqlite3Fts5IndexWrite( ); /* -** Indicate that subsequent calls to sqlite3Fts5IndexWrite() pertain to +** Indicate that subsequent calls to tdsqlite3Fts5IndexWrite() pertain to ** document iDocid. */ -static int sqlite3Fts5IndexBeginWrite( +static int tdsqlite3Fts5IndexBeginWrite( Fts5Index *p, /* Index to write to */ int bDelete, /* True if current operation is a delete */ i64 iDocid /* Docid to add or remove data from */ @@ -211373,7 +211373,7 @@ static int sqlite3Fts5IndexBeginWrite( ** Flush any data stored in the in-memory hash tables to the database. ** Also close any open blob handles. */ -static int sqlite3Fts5IndexSync(Fts5Index *p); +static int tdsqlite3Fts5IndexSync(Fts5Index *p); /* ** Discard any data stored in the in-memory hash tables. Do not write it @@ -211381,39 +211381,39 @@ static int sqlite3Fts5IndexSync(Fts5Index *p); ** table may have changed on disk. So any in-memory caches of %_data ** records must be invalidated. */ -static int sqlite3Fts5IndexRollback(Fts5Index *p); +static int tdsqlite3Fts5IndexRollback(Fts5Index *p); /* ** Get or set the "averages" values. */ -static int sqlite3Fts5IndexGetAverages(Fts5Index *p, i64 *pnRow, i64 *anSize); -static int sqlite3Fts5IndexSetAverages(Fts5Index *p, const u8*, int); +static int tdsqlite3Fts5IndexGetAverages(Fts5Index *p, i64 *pnRow, i64 *anSize); +static int tdsqlite3Fts5IndexSetAverages(Fts5Index *p, const u8*, int); /* ** Functions called by the storage module as part of integrity-check. */ -static int sqlite3Fts5IndexIntegrityCheck(Fts5Index*, u64 cksum); +static int tdsqlite3Fts5IndexIntegrityCheck(Fts5Index*, u64 cksum); /* ** Called during virtual module initialization to register UDF ** fts5_decode() with SQLite */ -static int sqlite3Fts5IndexInit(sqlite3*); +static int tdsqlite3Fts5IndexInit(tdsqlite3*); -static int sqlite3Fts5IndexSetCookie(Fts5Index*, int); +static int tdsqlite3Fts5IndexSetCookie(Fts5Index*, int); /* ** Return the total number of entries read from the %_data table by ** this connection since it was created. */ -static int sqlite3Fts5IndexReads(Fts5Index *p); +static int tdsqlite3Fts5IndexReads(Fts5Index *p); -static int sqlite3Fts5IndexReinit(Fts5Index *p); -static int sqlite3Fts5IndexOptimize(Fts5Index *p); -static int sqlite3Fts5IndexMerge(Fts5Index *p, int nMerge); -static int sqlite3Fts5IndexReset(Fts5Index *p); +static int tdsqlite3Fts5IndexReinit(Fts5Index *p); +static int tdsqlite3Fts5IndexOptimize(Fts5Index *p); +static int tdsqlite3Fts5IndexMerge(Fts5Index *p, int nMerge); +static int tdsqlite3Fts5IndexReset(Fts5Index *p); -static int sqlite3Fts5IndexLoadConfig(Fts5Index *p); +static int tdsqlite3Fts5IndexLoadConfig(Fts5Index *p); /* ** End of interface to code in fts5_index.c. @@ -211422,13 +211422,13 @@ static int sqlite3Fts5IndexLoadConfig(Fts5Index *p); /************************************************************************** ** Interface to code in fts5_varint.c. */ -static int sqlite3Fts5GetVarint32(const unsigned char *p, u32 *v); -static int sqlite3Fts5GetVarintLen(u32 iVal); -static u8 sqlite3Fts5GetVarint(const unsigned char*, u64*); -static int sqlite3Fts5PutVarint(unsigned char *p, u64 v); +static int tdsqlite3Fts5GetVarint32(const unsigned char *p, u32 *v); +static int tdsqlite3Fts5GetVarintLen(u32 iVal); +static u8 tdsqlite3Fts5GetVarint(const unsigned char*, u64*); +static int tdsqlite3Fts5PutVarint(unsigned char *p, u64 v); -#define fts5GetVarint32(a,b) sqlite3Fts5GetVarint32(a,(u32*)&b) -#define fts5GetVarint sqlite3Fts5GetVarint +#define fts5GetVarint32(a,b) tdsqlite3Fts5GetVarint32(a,(u32*)&b) +#define fts5GetVarint tdsqlite3Fts5GetVarint #define fts5FastGetVarint32(a, iOff, nVal) { \ nVal = (a)[iOff++]; \ @@ -211453,12 +211453,12 @@ static int sqlite3Fts5PutVarint(unsigned char *p, u64 v); */ typedef struct Fts5Table Fts5Table; struct Fts5Table { - sqlite3_vtab base; /* Base class used by SQLite core */ + tdsqlite3_vtab base; /* Base class used by SQLite core */ Fts5Config *pConfig; /* Virtual table configuration */ Fts5Index *pIndex; /* Full-text index */ }; -static int sqlite3Fts5GetTokenizer( +static int tdsqlite3Fts5GetTokenizer( Fts5Global*, const char **azArg, int nArg, @@ -211467,9 +211467,9 @@ static int sqlite3Fts5GetTokenizer( char **pzErr ); -static Fts5Table *sqlite3Fts5TableFromCsrid(Fts5Global*, i64); +static Fts5Table *tdsqlite3Fts5TableFromCsrid(Fts5Global*, i64); -static int sqlite3Fts5FlushToDisk(Fts5Table*); +static int tdsqlite3Fts5FlushToDisk(Fts5Table*); /* ** End of interface to code in fts5.c. @@ -211483,10 +211483,10 @@ typedef struct Fts5Hash Fts5Hash; /* ** Create a hash table, free a hash table. */ -static int sqlite3Fts5HashNew(Fts5Config*, Fts5Hash**, int *pnSize); -static void sqlite3Fts5HashFree(Fts5Hash*); +static int tdsqlite3Fts5HashNew(Fts5Config*, Fts5Hash**, int *pnSize); +static void tdsqlite3Fts5HashFree(Fts5Hash*); -static int sqlite3Fts5HashWrite( +static int tdsqlite3Fts5HashWrite( Fts5Hash*, i64 iRowid, /* Rowid for this entry */ int iCol, /* Column token appears in (-ve -> delete) */ @@ -211498,9 +211498,9 @@ static int sqlite3Fts5HashWrite( /* ** Empty (but do not delete) a hash table. */ -static void sqlite3Fts5HashClear(Fts5Hash*); +static void tdsqlite3Fts5HashClear(Fts5Hash*); -static int sqlite3Fts5HashQuery( +static int tdsqlite3Fts5HashQuery( Fts5Hash*, /* Hash table to query */ int nPre, const char *pTerm, int nTerm, /* Query term */ @@ -211508,13 +211508,13 @@ static int sqlite3Fts5HashQuery( int *pnDoclist /* OUT: Size of doclist in bytes */ ); -static int sqlite3Fts5HashScanInit( +static int tdsqlite3Fts5HashScanInit( Fts5Hash*, /* Hash table to query */ const char *pTerm, int nTerm /* Query prefix */ ); -static void sqlite3Fts5HashScanNext(Fts5Hash*); -static int sqlite3Fts5HashScanEof(Fts5Hash*); -static void sqlite3Fts5HashScanEntry(Fts5Hash *, +static void tdsqlite3Fts5HashScanNext(Fts5Hash*); +static int tdsqlite3Fts5HashScanEof(Fts5Hash*); +static void tdsqlite3Fts5HashScanEntry(Fts5Hash *, const char **pzTerm, /* OUT: term (nul-terminated) */ const u8 **ppDoclist, /* OUT: pointer to doclist */ int *pnDoclist /* OUT: size of doclist in bytes */ @@ -211536,38 +211536,38 @@ static void sqlite3Fts5HashScanEntry(Fts5Hash *, typedef struct Fts5Storage Fts5Storage; -static int sqlite3Fts5StorageOpen(Fts5Config*, Fts5Index*, int, Fts5Storage**, char**); -static int sqlite3Fts5StorageClose(Fts5Storage *p); -static int sqlite3Fts5StorageRename(Fts5Storage*, const char *zName); +static int tdsqlite3Fts5StorageOpen(Fts5Config*, Fts5Index*, int, Fts5Storage**, char**); +static int tdsqlite3Fts5StorageClose(Fts5Storage *p); +static int tdsqlite3Fts5StorageRename(Fts5Storage*, const char *zName); -static int sqlite3Fts5DropAll(Fts5Config*); -static int sqlite3Fts5CreateTable(Fts5Config*, const char*, const char*, int, char **); +static int tdsqlite3Fts5DropAll(Fts5Config*); +static int tdsqlite3Fts5CreateTable(Fts5Config*, const char*, const char*, int, char **); -static int sqlite3Fts5StorageDelete(Fts5Storage *p, i64, sqlite3_value**); -static int sqlite3Fts5StorageContentInsert(Fts5Storage *p, sqlite3_value**, i64*); -static int sqlite3Fts5StorageIndexInsert(Fts5Storage *p, sqlite3_value**, i64); +static int tdsqlite3Fts5StorageDelete(Fts5Storage *p, i64, tdsqlite3_value**); +static int tdsqlite3Fts5StorageContentInsert(Fts5Storage *p, tdsqlite3_value**, i64*); +static int tdsqlite3Fts5StorageIndexInsert(Fts5Storage *p, tdsqlite3_value**, i64); -static int sqlite3Fts5StorageIntegrity(Fts5Storage *p); +static int tdsqlite3Fts5StorageIntegrity(Fts5Storage *p); -static int sqlite3Fts5StorageStmt(Fts5Storage *p, int eStmt, sqlite3_stmt**, char**); -static void sqlite3Fts5StorageStmtRelease(Fts5Storage *p, int eStmt, sqlite3_stmt*); +static int tdsqlite3Fts5StorageStmt(Fts5Storage *p, int eStmt, tdsqlite3_stmt**, char**); +static void tdsqlite3Fts5StorageStmtRelease(Fts5Storage *p, int eStmt, tdsqlite3_stmt*); -static int sqlite3Fts5StorageDocsize(Fts5Storage *p, i64 iRowid, int *aCol); -static int sqlite3Fts5StorageSize(Fts5Storage *p, int iCol, i64 *pnAvg); -static int sqlite3Fts5StorageRowCount(Fts5Storage *p, i64 *pnRow); +static int tdsqlite3Fts5StorageDocsize(Fts5Storage *p, i64 iRowid, int *aCol); +static int tdsqlite3Fts5StorageSize(Fts5Storage *p, int iCol, i64 *pnAvg); +static int tdsqlite3Fts5StorageRowCount(Fts5Storage *p, i64 *pnRow); -static int sqlite3Fts5StorageSync(Fts5Storage *p); -static int sqlite3Fts5StorageRollback(Fts5Storage *p); +static int tdsqlite3Fts5StorageSync(Fts5Storage *p); +static int tdsqlite3Fts5StorageRollback(Fts5Storage *p); -static int sqlite3Fts5StorageConfigValue( - Fts5Storage *p, const char*, sqlite3_value*, int +static int tdsqlite3Fts5StorageConfigValue( + Fts5Storage *p, const char*, tdsqlite3_value*, int ); -static int sqlite3Fts5StorageDeleteAll(Fts5Storage *p); -static int sqlite3Fts5StorageRebuild(Fts5Storage *p); -static int sqlite3Fts5StorageOptimize(Fts5Storage *p); -static int sqlite3Fts5StorageMerge(Fts5Storage *p, int nMerge); -static int sqlite3Fts5StorageReset(Fts5Storage *p); +static int tdsqlite3Fts5StorageDeleteAll(Fts5Storage *p); +static int tdsqlite3Fts5StorageRebuild(Fts5Storage *p); +static int tdsqlite3Fts5StorageOptimize(Fts5Storage *p); +static int tdsqlite3Fts5StorageMerge(Fts5Storage *p, int nMerge); +static int tdsqlite3Fts5StorageReset(Fts5Storage *p); /* ** End of interface to code in fts5_storage.c. @@ -211590,7 +211590,7 @@ struct Fts5Token { }; /* Parse a MATCH expression. */ -static int sqlite3Fts5ExprNew( +static int tdsqlite3Fts5ExprNew( Fts5Config *pConfig, int iCol, /* Column on LHS of MATCH operator */ const char *zExpr, @@ -211599,48 +211599,48 @@ static int sqlite3Fts5ExprNew( ); /* -** for(rc = sqlite3Fts5ExprFirst(pExpr, pIdx, bDesc); -** rc==SQLITE_OK && 0==sqlite3Fts5ExprEof(pExpr); -** rc = sqlite3Fts5ExprNext(pExpr) +** for(rc = tdsqlite3Fts5ExprFirst(pExpr, pIdx, bDesc); +** rc==SQLITE_OK && 0==tdsqlite3Fts5ExprEof(pExpr); +** rc = tdsqlite3Fts5ExprNext(pExpr) ** ){ ** // The document with rowid iRowid matches the expression! -** i64 iRowid = sqlite3Fts5ExprRowid(pExpr); +** i64 iRowid = tdsqlite3Fts5ExprRowid(pExpr); ** } */ -static int sqlite3Fts5ExprFirst(Fts5Expr*, Fts5Index *pIdx, i64 iMin, int bDesc); -static int sqlite3Fts5ExprNext(Fts5Expr*, i64 iMax); -static int sqlite3Fts5ExprEof(Fts5Expr*); -static i64 sqlite3Fts5ExprRowid(Fts5Expr*); +static int tdsqlite3Fts5ExprFirst(Fts5Expr*, Fts5Index *pIdx, i64 iMin, int bDesc); +static int tdsqlite3Fts5ExprNext(Fts5Expr*, i64 iMax); +static int tdsqlite3Fts5ExprEof(Fts5Expr*); +static i64 tdsqlite3Fts5ExprRowid(Fts5Expr*); -static void sqlite3Fts5ExprFree(Fts5Expr*); -static int sqlite3Fts5ExprAnd(Fts5Expr **pp1, Fts5Expr *p2); +static void tdsqlite3Fts5ExprFree(Fts5Expr*); +static int tdsqlite3Fts5ExprAnd(Fts5Expr **pp1, Fts5Expr *p2); /* Called during startup to register a UDF with SQLite */ -static int sqlite3Fts5ExprInit(Fts5Global*, sqlite3*); +static int tdsqlite3Fts5ExprInit(Fts5Global*, tdsqlite3*); -static int sqlite3Fts5ExprPhraseCount(Fts5Expr*); -static int sqlite3Fts5ExprPhraseSize(Fts5Expr*, int iPhrase); -static int sqlite3Fts5ExprPoslist(Fts5Expr*, int, const u8 **); +static int tdsqlite3Fts5ExprPhraseCount(Fts5Expr*); +static int tdsqlite3Fts5ExprPhraseSize(Fts5Expr*, int iPhrase); +static int tdsqlite3Fts5ExprPoslist(Fts5Expr*, int, const u8 **); typedef struct Fts5PoslistPopulator Fts5PoslistPopulator; -static Fts5PoslistPopulator *sqlite3Fts5ExprClearPoslists(Fts5Expr*, int); -static int sqlite3Fts5ExprPopulatePoslists( +static Fts5PoslistPopulator *tdsqlite3Fts5ExprClearPoslists(Fts5Expr*, int); +static int tdsqlite3Fts5ExprPopulatePoslists( Fts5Config*, Fts5Expr*, Fts5PoslistPopulator*, int, const char*, int ); -static void sqlite3Fts5ExprCheckPoslists(Fts5Expr*, i64); +static void tdsqlite3Fts5ExprCheckPoslists(Fts5Expr*, i64); -static int sqlite3Fts5ExprClonePhrase(Fts5Expr*, int, Fts5Expr**); +static int tdsqlite3Fts5ExprClonePhrase(Fts5Expr*, int, Fts5Expr**); -static int sqlite3Fts5ExprPhraseCollist(Fts5Expr *, int, const u8 **, int *); +static int tdsqlite3Fts5ExprPhraseCollist(Fts5Expr *, int, const u8 **, int *); /******************************************* ** The fts5_expr.c API above this point is used by the other hand-written ** C code in this module. The interfaces below this point are called by ** the parser code in fts5parse.y. */ -static void sqlite3Fts5ParseError(Fts5Parse *pParse, const char *zFmt, ...); +static void tdsqlite3Fts5ParseError(Fts5Parse *pParse, const char *zFmt, ...); -static Fts5ExprNode *sqlite3Fts5ParseNode( +static Fts5ExprNode *tdsqlite3Fts5ParseNode( Fts5Parse *pParse, int eType, Fts5ExprNode *pLeft, @@ -211648,42 +211648,42 @@ static Fts5ExprNode *sqlite3Fts5ParseNode( Fts5ExprNearset *pNear ); -static Fts5ExprNode *sqlite3Fts5ParseImplicitAnd( +static Fts5ExprNode *tdsqlite3Fts5ParseImplicitAnd( Fts5Parse *pParse, Fts5ExprNode *pLeft, Fts5ExprNode *pRight ); -static Fts5ExprPhrase *sqlite3Fts5ParseTerm( +static Fts5ExprPhrase *tdsqlite3Fts5ParseTerm( Fts5Parse *pParse, Fts5ExprPhrase *pPhrase, Fts5Token *pToken, int bPrefix ); -static void sqlite3Fts5ParseSetCaret(Fts5ExprPhrase*); +static void tdsqlite3Fts5ParseSetCaret(Fts5ExprPhrase*); -static Fts5ExprNearset *sqlite3Fts5ParseNearset( +static Fts5ExprNearset *tdsqlite3Fts5ParseNearset( Fts5Parse*, Fts5ExprNearset*, Fts5ExprPhrase* ); -static Fts5Colset *sqlite3Fts5ParseColset( +static Fts5Colset *tdsqlite3Fts5ParseColset( Fts5Parse*, Fts5Colset*, Fts5Token * ); -static void sqlite3Fts5ParsePhraseFree(Fts5ExprPhrase*); -static void sqlite3Fts5ParseNearsetFree(Fts5ExprNearset*); -static void sqlite3Fts5ParseNodeFree(Fts5ExprNode*); +static void tdsqlite3Fts5ParsePhraseFree(Fts5ExprPhrase*); +static void tdsqlite3Fts5ParseNearsetFree(Fts5ExprNearset*); +static void tdsqlite3Fts5ParseNodeFree(Fts5ExprNode*); -static void sqlite3Fts5ParseSetDistance(Fts5Parse*, Fts5ExprNearset*, Fts5Token*); -static void sqlite3Fts5ParseSetColset(Fts5Parse*, Fts5ExprNode*, Fts5Colset*); -static Fts5Colset *sqlite3Fts5ParseColsetInvert(Fts5Parse*, Fts5Colset*); -static void sqlite3Fts5ParseFinished(Fts5Parse *pParse, Fts5ExprNode *p); -static void sqlite3Fts5ParseNear(Fts5Parse *pParse, Fts5Token*); +static void tdsqlite3Fts5ParseSetDistance(Fts5Parse*, Fts5ExprNearset*, Fts5Token*); +static void tdsqlite3Fts5ParseSetColset(Fts5Parse*, Fts5ExprNode*, Fts5Colset*); +static Fts5Colset *tdsqlite3Fts5ParseColsetInvert(Fts5Parse*, Fts5Colset*); +static void tdsqlite3Fts5ParseFinished(Fts5Parse *pParse, Fts5ExprNode *p); +static void tdsqlite3Fts5ParseNear(Fts5Parse *pParse, Fts5Token*); /* ** End of interface to code in fts5_expr.c. @@ -211695,7 +211695,7 @@ static void sqlite3Fts5ParseNear(Fts5Parse *pParse, Fts5Token*); ** Interface to code in fts5_aux.c. */ -static int sqlite3Fts5AuxInit(fts5_api*); +static int tdsqlite3Fts5AuxInit(fts5_api*); /* ** End of interface to code in fts5_aux.c. **************************************************************************/ @@ -211704,7 +211704,7 @@ static int sqlite3Fts5AuxInit(fts5_api*); ** Interface to code in fts5_tokenizer.c. */ -static int sqlite3Fts5TokenizerInit(fts5_api*); +static int tdsqlite3Fts5TokenizerInit(fts5_api*); /* ** End of interface to code in fts5_tokenizer.c. **************************************************************************/ @@ -211713,7 +211713,7 @@ static int sqlite3Fts5TokenizerInit(fts5_api*); ** Interface to code in fts5_vocab.c. */ -static int sqlite3Fts5VocabInit(Fts5Global*, sqlite3*); +static int tdsqlite3Fts5VocabInit(Fts5Global*, tdsqlite3*); /* ** End of interface to code in fts5_vocab.c. @@ -211723,12 +211723,12 @@ static int sqlite3Fts5VocabInit(Fts5Global*, sqlite3*); /************************************************************************** ** Interface to automatically generated code in fts5_unicode2.c. */ -static int sqlite3Fts5UnicodeIsdiacritic(int c); -static int sqlite3Fts5UnicodeFold(int c, int bRemoveDiacritic); +static int tdsqlite3Fts5UnicodeIsdiacritic(int c); +static int tdsqlite3Fts5UnicodeFold(int c, int bRemoveDiacritic); -static int sqlite3Fts5UnicodeCatParse(const char*, u8*); -static int sqlite3Fts5UnicodeCategory(u32 iCode); -static void sqlite3Fts5UnicodeAscii(u8*, u8*); +static int tdsqlite3Fts5UnicodeCatParse(const char*, u8*); +static int tdsqlite3Fts5UnicodeCategory(u32 iCode); +static void tdsqlite3Fts5UnicodeAscii(u8*, u8*); /* ** End of interface to code in fts5_unicode2.c. **************************************************************************/ @@ -211794,14 +211794,14 @@ static void sqlite3Fts5UnicodeAscii(u8*, u8*); #define fts5yytestcase(X) testcase(X) /* -** Indicate that sqlite3ParserFree() will never be called with a null +** Indicate that tdsqlite3ParserFree() will never be called with a null ** pointer. */ #define fts5YYPARSEFREENOTNULL 1 /* ** Alternative datatype for the argument to the malloc() routine passed -** into sqlite3ParserAlloc(). The default is size_t. +** into tdsqlite3ParserAlloc(). The default is size_t. */ #define fts5YYMALLOCARGTYPE u64 @@ -211828,7 +211828,7 @@ static void sqlite3Fts5UnicodeAscii(u8*, u8*); ** fts5YYACTIONTYPE is the data type used for "action codes" - numbers ** that indicate what to do in response to the next ** token. -** sqlite3Fts5ParserFTS5TOKENTYPE is the data type used for minor type for terminal +** tdsqlite3Fts5ParserFTS5TOKENTYPE is the data type used for minor type for terminal ** symbols. Background: A "minor type" is a semantic ** value associated with a terminal or non-terminal ** symbols. For example, for an "ID" terminal symbol, @@ -211839,16 +211839,16 @@ static void sqlite3Fts5UnicodeAscii(u8*, u8*); ** symbols. ** fts5YYMINORTYPE is the data type used for all minor types. ** This is typically a union of many types, one of -** which is sqlite3Fts5ParserFTS5TOKENTYPE. The entry in the union +** which is tdsqlite3Fts5ParserFTS5TOKENTYPE. The entry in the union ** for terminal symbols is called "fts5yy0". ** fts5YYSTACKDEPTH is the maximum depth of the parser's stack. If ** zero the stack is dynamically sized using realloc() -** sqlite3Fts5ParserARG_SDECL A static variable declaration for the %extra_argument -** sqlite3Fts5ParserARG_PDECL A parameter declaration for the %extra_argument -** sqlite3Fts5ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter -** sqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser -** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser -** sqlite3Fts5ParserCTX_* As sqlite3Fts5ParserARG_ except for %extra_context +** tdsqlite3Fts5ParserARG_SDECL A static variable declaration for the %extra_argument +** tdsqlite3Fts5ParserARG_PDECL A parameter declaration for the %extra_argument +** tdsqlite3Fts5ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter +** tdsqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser +** tdsqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser +** tdsqlite3Fts5ParserCTX_* As tdsqlite3Fts5ParserARG_ except for %extra_context ** fts5YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** fts5YYNSTATE the combined number of states. @@ -211870,10 +211870,10 @@ static void sqlite3Fts5UnicodeAscii(u8*, u8*); #define fts5YYCODETYPE unsigned char #define fts5YYNOCODE 27 #define fts5YYACTIONTYPE unsigned char -#define sqlite3Fts5ParserFTS5TOKENTYPE Fts5Token +#define tdsqlite3Fts5ParserFTS5TOKENTYPE Fts5Token typedef union { int fts5yyinit; - sqlite3Fts5ParserFTS5TOKENTYPE fts5yy0; + tdsqlite3Fts5ParserFTS5TOKENTYPE fts5yy0; int fts5yy4; Fts5Colset* fts5yy11; Fts5ExprNode* fts5yy24; @@ -211883,16 +211883,16 @@ typedef union { #ifndef fts5YYSTACKDEPTH #define fts5YYSTACKDEPTH 100 #endif -#define sqlite3Fts5ParserARG_SDECL Fts5Parse *pParse; -#define sqlite3Fts5ParserARG_PDECL ,Fts5Parse *pParse -#define sqlite3Fts5ParserARG_PARAM ,pParse -#define sqlite3Fts5ParserARG_FETCH Fts5Parse *pParse=fts5yypParser->pParse; -#define sqlite3Fts5ParserARG_STORE fts5yypParser->pParse=pParse; -#define sqlite3Fts5ParserCTX_SDECL -#define sqlite3Fts5ParserCTX_PDECL -#define sqlite3Fts5ParserCTX_PARAM -#define sqlite3Fts5ParserCTX_FETCH -#define sqlite3Fts5ParserCTX_STORE +#define tdsqlite3Fts5ParserARG_SDECL Fts5Parse *pParse; +#define tdsqlite3Fts5ParserARG_PDECL ,Fts5Parse *pParse +#define tdsqlite3Fts5ParserARG_PARAM ,pParse +#define tdsqlite3Fts5ParserARG_FETCH Fts5Parse *pParse=fts5yypParser->pParse; +#define tdsqlite3Fts5ParserARG_STORE fts5yypParser->pParse=pParse; +#define tdsqlite3Fts5ParserCTX_SDECL +#define tdsqlite3Fts5ParserCTX_PDECL +#define tdsqlite3Fts5ParserCTX_PARAM +#define tdsqlite3Fts5ParserCTX_FETCH +#define tdsqlite3Fts5ParserCTX_STORE #define fts5YYNSTATE 35 #define fts5YYNRULE 28 #define fts5YYNRULE_WITH_ACTION 28 @@ -212078,8 +212078,8 @@ struct fts5yyParser { #ifndef fts5YYNOERRORRECOVERY int fts5yyerrcnt; /* Shifts left before out of the error */ #endif - sqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */ - sqlite3Fts5ParserCTX_SDECL /* A place to hold %extra_context */ + tdsqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */ + tdsqlite3Fts5ParserCTX_SDECL /* A place to hold %extra_context */ #if fts5YYSTACKDEPTH<=0 int fts5yystksz; /* Current side of the stack */ fts5yyStackEntry *fts5yystack; /* The parser's stack */ @@ -212115,7 +212115,7 @@ static char *fts5yyTracePrompt = 0; ** Outputs: ** None. */ -static void sqlite3Fts5ParserTrace(FILE *TraceFILE, char *zTracePrompt){ +static void tdsqlite3Fts5ParserTrace(FILE *TraceFILE, char *zTracePrompt){ fts5yyTraceFILE = TraceFILE; fts5yyTracePrompt = zTracePrompt; if( fts5yyTraceFILE==0 ) fts5yyTracePrompt = 0; @@ -212227,7 +212227,7 @@ static int fts5yyGrowStack(fts5yyParser *p){ #endif /* Datatype of the argument to the memory allocated passed as the -** second argument to sqlite3Fts5ParserAlloc() below. This can be changed by +** second argument to tdsqlite3Fts5ParserAlloc() below. This can be changed by ** putting an appropriate #define in the %include section of the input ** grammar. */ @@ -212237,9 +212237,9 @@ static int fts5yyGrowStack(fts5yyParser *p){ /* Initialize a new parser that has already been allocated. */ -static void sqlite3Fts5ParserInit(void *fts5yypRawParser sqlite3Fts5ParserCTX_PDECL){ +static void tdsqlite3Fts5ParserInit(void *fts5yypRawParser tdsqlite3Fts5ParserCTX_PDECL){ fts5yyParser *fts5yypParser = (fts5yyParser*)fts5yypRawParser; - sqlite3Fts5ParserCTX_STORE + tdsqlite3Fts5ParserCTX_STORE #ifdef fts5YYTRACKMAXSTACKDEPTH fts5yypParser->fts5yyhwm = 0; #endif @@ -212263,7 +212263,7 @@ static void sqlite3Fts5ParserInit(void *fts5yypRawParser sqlite3Fts5ParserCTX_PD #endif } -#ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK +#ifndef tdsqlite3Fts5Parser_ENGINEALWAYSONSTACK /* ** This function allocates a new parser. ** The only argument is a pointer to a function which works like @@ -212274,18 +212274,18 @@ static void sqlite3Fts5ParserInit(void *fts5yypRawParser sqlite3Fts5ParserCTX_PD ** ** Outputs: ** A pointer to a parser. This pointer is used in subsequent calls -** to sqlite3Fts5Parser and sqlite3Fts5ParserFree. +** to tdsqlite3Fts5Parser and tdsqlite3Fts5ParserFree. */ -static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(fts5YYMALLOCARGTYPE) sqlite3Fts5ParserCTX_PDECL){ +static void *tdsqlite3Fts5ParserAlloc(void *(*mallocProc)(fts5YYMALLOCARGTYPE) tdsqlite3Fts5ParserCTX_PDECL){ fts5yyParser *fts5yypParser; fts5yypParser = (fts5yyParser*)(*mallocProc)( (fts5YYMALLOCARGTYPE)sizeof(fts5yyParser) ); if( fts5yypParser ){ - sqlite3Fts5ParserCTX_STORE - sqlite3Fts5ParserInit(fts5yypParser sqlite3Fts5ParserCTX_PARAM); + tdsqlite3Fts5ParserCTX_STORE + tdsqlite3Fts5ParserInit(fts5yypParser tdsqlite3Fts5ParserCTX_PARAM); } return (void*)fts5yypParser; } -#endif /* sqlite3Fts5Parser_ENGINEALWAYSONSTACK */ +#endif /* tdsqlite3Fts5Parser_ENGINEALWAYSONSTACK */ /* The following function deletes the "minor type" or semantic value @@ -212300,8 +212300,8 @@ static void fts5yy_destructor( fts5YYCODETYPE fts5yymajor, /* Type code for object to destroy */ fts5YYMINORTYPE *fts5yypminor /* The object to be destroyed */ ){ - sqlite3Fts5ParserARG_FETCH - sqlite3Fts5ParserCTX_FETCH + tdsqlite3Fts5ParserARG_FETCH + tdsqlite3Fts5ParserCTX_FETCH switch( fts5yymajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen @@ -212323,24 +212323,24 @@ static void fts5yy_destructor( case 18: /* cnearset */ case 19: /* exprlist */ { - sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy24)); + tdsqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy24)); } break; case 20: /* colset */ case 21: /* colsetlist */ { - sqlite3_free((fts5yypminor->fts5yy11)); + tdsqlite3_free((fts5yypminor->fts5yy11)); } break; case 22: /* nearset */ case 23: /* nearphrases */ { - sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy46)); + tdsqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy46)); } break; case 24: /* phrase */ { - sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy53)); + tdsqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy53)); } break; /********* End destructor definitions *****************************************/ @@ -212372,7 +212372,7 @@ static void fts5yy_pop_parser_stack(fts5yyParser *pParser){ /* ** Clear all secondary memory allocations from the parser */ -static void sqlite3Fts5ParserFinalize(void *p){ +static void tdsqlite3Fts5ParserFinalize(void *p){ fts5yyParser *pParser = (fts5yyParser*)p; while( pParser->fts5yytos>pParser->fts5yystack ) fts5yy_pop_parser_stack(pParser); #if fts5YYSTACKDEPTH<=0 @@ -212380,7 +212380,7 @@ static void sqlite3Fts5ParserFinalize(void *p){ #endif } -#ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK +#ifndef tdsqlite3Fts5Parser_ENGINEALWAYSONSTACK /* ** Deallocate and destroy a parser. Destructors are called for ** all stack elements before shutting the parser down. @@ -212389,23 +212389,23 @@ static void sqlite3Fts5ParserFinalize(void *p){ ** is defined in a %include section of the input grammar) then it is ** assumed that the input pointer is never NULL. */ -static void sqlite3Fts5ParserFree( +static void tdsqlite3Fts5ParserFree( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ ){ #ifndef fts5YYPARSEFREENEVERNULL if( p==0 ) return; #endif - sqlite3Fts5ParserFinalize(p); + tdsqlite3Fts5ParserFinalize(p); (*freeProc)(p); } -#endif /* sqlite3Fts5Parser_ENGINEALWAYSONSTACK */ +#endif /* tdsqlite3Fts5Parser_ENGINEALWAYSONSTACK */ /* ** Return the peak depth of the stack for a parser. */ #ifdef fts5YYTRACKMAXSTACKDEPTH -static int sqlite3Fts5ParserStackPeak(void *p){ +static int tdsqlite3Fts5ParserStackPeak(void *p){ fts5yyParser *pParser = (fts5yyParser*)p; return pParser->fts5yyhwm; } @@ -212429,7 +212429,7 @@ static unsigned char fts5yycoverage[fts5YYNSTATE][fts5YYNFTS5TOKEN]; ** Return the number of missed state/lookahead combinations. */ #if defined(fts5YYCOVERAGE) -static int sqlite3Fts5ParserCoverage(FILE *out){ +static int tdsqlite3Fts5ParserCoverage(FILE *out){ int stateno, iLookAhead, i; int nMissed = 0; for(stateno=0; statenofts5yytos++; @@ -212710,14 +212710,14 @@ static fts5YYACTIONTYPE fts5yy_reduce( fts5yyParser *fts5yypParser, /* The parser */ unsigned int fts5yyruleno, /* Number of the rule by which to reduce */ int fts5yyLookahead, /* Lookahead token, or fts5YYNOCODE if none */ - sqlite3Fts5ParserFTS5TOKENTYPE fts5yyLookaheadToken /* Value of the lookahead token */ - sqlite3Fts5ParserCTX_PDECL /* %extra_context */ + tdsqlite3Fts5ParserFTS5TOKENTYPE fts5yyLookaheadToken /* Value of the lookahead token */ + tdsqlite3Fts5ParserCTX_PDECL /* %extra_context */ ){ int fts5yygoto; /* The next state */ fts5YYACTIONTYPE fts5yyact; /* The next action */ fts5yyStackEntry *fts5yymsp; /* The top of the parser's stack */ int fts5yysize; /* Amount to pop the stack */ - sqlite3Fts5ParserARG_FETCH + tdsqlite3Fts5ParserARG_FETCH (void)fts5yyLookahead; (void)fts5yyLookaheadToken; fts5yymsp = fts5yypParser->fts5yytos; @@ -212782,11 +212782,11 @@ static fts5YYACTIONTYPE fts5yy_reduce( /********** Begin reduce actions **********************************************/ fts5YYMINORTYPE fts5yylhsminor; case 0: /* input ::= expr */ -{ sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy24); } +{ tdsqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy24); } break; case 1: /* colset ::= MINUS LCP colsetlist RCP */ { - fts5yymsp[-3].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11); + fts5yymsp[-3].minor.fts5yy11 = tdsqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11); } break; case 2: /* colset ::= LCP colsetlist RCP */ @@ -212794,48 +212794,48 @@ static fts5YYACTIONTYPE fts5yy_reduce( break; case 3: /* colset ::= STRING */ { - fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); + fts5yylhsminor.fts5yy11 = tdsqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); } fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11; break; case 4: /* colset ::= MINUS STRING */ { - fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); - fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11); + fts5yymsp[-1].minor.fts5yy11 = tdsqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); + fts5yymsp[-1].minor.fts5yy11 = tdsqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11); } break; case 5: /* colsetlist ::= colsetlist STRING */ { - fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy11, &fts5yymsp[0].minor.fts5yy0); } + fts5yylhsminor.fts5yy11 = tdsqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy11, &fts5yymsp[0].minor.fts5yy0); } fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11; break; case 6: /* colsetlist ::= STRING */ { - fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); + fts5yylhsminor.fts5yy11 = tdsqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); } fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11; break; case 7: /* expr ::= expr AND expr */ { - fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0); + fts5yylhsminor.fts5yy24 = tdsqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0); } fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 8: /* expr ::= expr OR expr */ { - fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0); + fts5yylhsminor.fts5yy24 = tdsqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0); } fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 9: /* expr ::= expr NOT expr */ { - fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0); + fts5yylhsminor.fts5yy24 = tdsqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0); } fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 10: /* expr ::= colset COLON LP expr RP */ { - sqlite3Fts5ParseSetColset(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[-4].minor.fts5yy11); + tdsqlite3Fts5ParseSetColset(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[-4].minor.fts5yy11); fts5yylhsminor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24; } fts5yymsp[-4].minor.fts5yy24 = fts5yylhsminor.fts5yy24; @@ -212850,50 +212850,50 @@ static fts5YYACTIONTYPE fts5yy_reduce( break; case 14: /* exprlist ::= exprlist cnearset */ { - fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24); + fts5yylhsminor.fts5yy24 = tdsqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24); } fts5yymsp[-1].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 15: /* cnearset ::= nearset */ { - fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46); + fts5yylhsminor.fts5yy24 = tdsqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46); } fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 16: /* cnearset ::= colset COLON nearset */ { - fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46); - sqlite3Fts5ParseSetColset(pParse, fts5yylhsminor.fts5yy24, fts5yymsp[-2].minor.fts5yy11); + fts5yylhsminor.fts5yy24 = tdsqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46); + tdsqlite3Fts5ParseSetColset(pParse, fts5yylhsminor.fts5yy24, fts5yymsp[-2].minor.fts5yy11); } fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 17: /* nearset ::= phrase */ -{ fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); } +{ fts5yylhsminor.fts5yy46 = tdsqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); } fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46; break; case 18: /* nearset ::= CARET phrase */ { - sqlite3Fts5ParseSetCaret(fts5yymsp[0].minor.fts5yy53); - fts5yymsp[-1].minor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); + tdsqlite3Fts5ParseSetCaret(fts5yymsp[0].minor.fts5yy53); + fts5yymsp[-1].minor.fts5yy46 = tdsqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); } break; case 19: /* nearset ::= STRING LP nearphrases neardist_opt RP */ { - sqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0); - sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy46, &fts5yymsp[-1].minor.fts5yy0); + tdsqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0); + tdsqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy46, &fts5yymsp[-1].minor.fts5yy0); fts5yylhsminor.fts5yy46 = fts5yymsp[-2].minor.fts5yy46; } fts5yymsp[-4].minor.fts5yy46 = fts5yylhsminor.fts5yy46; break; case 20: /* nearphrases ::= phrase */ { - fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); + fts5yylhsminor.fts5yy46 = tdsqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); } fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46; break; case 21: /* nearphrases ::= nearphrases phrase */ { - fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy46, fts5yymsp[0].minor.fts5yy53); + fts5yylhsminor.fts5yy46 = tdsqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy46, fts5yymsp[0].minor.fts5yy53); } fts5yymsp[-1].minor.fts5yy46 = fts5yylhsminor.fts5yy46; break; @@ -212905,13 +212905,13 @@ static fts5YYACTIONTYPE fts5yy_reduce( break; case 24: /* phrase ::= phrase PLUS STRING star_opt */ { - fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy53, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4); + fts5yylhsminor.fts5yy53 = tdsqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy53, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4); } fts5yymsp[-3].minor.fts5yy53 = fts5yylhsminor.fts5yy53; break; case 25: /* phrase ::= STRING star_opt */ { - fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4); + fts5yylhsminor.fts5yy53 = tdsqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4); } fts5yymsp[-1].minor.fts5yy53 = fts5yylhsminor.fts5yy53; break; @@ -212952,8 +212952,8 @@ static fts5YYACTIONTYPE fts5yy_reduce( static void fts5yy_parse_failed( fts5yyParser *fts5yypParser /* The parser */ ){ - sqlite3Fts5ParserARG_FETCH - sqlite3Fts5ParserCTX_FETCH + tdsqlite3Fts5ParserARG_FETCH + tdsqlite3Fts5ParserCTX_FETCH #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sFail!\n",fts5yyTracePrompt); @@ -212964,8 +212964,8 @@ static void fts5yy_parse_failed( ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ - sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ - sqlite3Fts5ParserCTX_STORE + tdsqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ + tdsqlite3Fts5ParserCTX_STORE } #endif /* fts5YYNOERRORRECOVERY */ @@ -212975,20 +212975,20 @@ static void fts5yy_parse_failed( static void fts5yy_syntax_error( fts5yyParser *fts5yypParser, /* The parser */ int fts5yymajor, /* The major type of the error token */ - sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The minor type of the error token */ + tdsqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The minor type of the error token */ ){ - sqlite3Fts5ParserARG_FETCH - sqlite3Fts5ParserCTX_FETCH + tdsqlite3Fts5ParserARG_FETCH + tdsqlite3Fts5ParserCTX_FETCH #define FTS5TOKEN fts5yyminor /************ Begin %syntax_error code ****************************************/ UNUSED_PARAM(fts5yymajor); /* Silence a compiler warning */ - sqlite3Fts5ParseError( + tdsqlite3Fts5ParseError( pParse, "fts5: syntax error near \"%.*s\"",FTS5TOKEN.n,FTS5TOKEN.p ); /************ End %syntax_error code ******************************************/ - sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ - sqlite3Fts5ParserCTX_STORE + tdsqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ + tdsqlite3Fts5ParserCTX_STORE } /* @@ -212997,8 +212997,8 @@ static void fts5yy_syntax_error( static void fts5yy_accept( fts5yyParser *fts5yypParser /* The parser */ ){ - sqlite3Fts5ParserARG_FETCH - sqlite3Fts5ParserCTX_FETCH + tdsqlite3Fts5ParserARG_FETCH + tdsqlite3Fts5ParserCTX_FETCH #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sAccept!\n",fts5yyTracePrompt); @@ -213012,13 +213012,13 @@ static void fts5yy_accept( ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ - sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ - sqlite3Fts5ParserCTX_STORE + tdsqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ + tdsqlite3Fts5ParserCTX_STORE } /* The main parser program. ** The first argument is a pointer to a structure obtained from -** "sqlite3Fts5ParserAlloc" which describes the current state of the parser. +** "tdsqlite3Fts5ParserAlloc" which describes the current state of the parser. ** The second argument is the major token number. The third is ** the minor token. The fourth optional argument is whatever the ** user wants (and specified in the grammar) and is available for @@ -213035,11 +213035,11 @@ static void fts5yy_accept( ** Outputs: ** None. */ -static void sqlite3Fts5Parser( +static void tdsqlite3Fts5Parser( void *fts5yyp, /* The parser */ int fts5yymajor, /* The major token code number */ - sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The value for the token */ - sqlite3Fts5ParserARG_PDECL /* Optional %extra_argument parameter */ + tdsqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The value for the token */ + tdsqlite3Fts5ParserARG_PDECL /* Optional %extra_argument parameter */ ){ fts5YYMINORTYPE fts5yyminorunion; fts5YYACTIONTYPE fts5yyact; /* The parser action. */ @@ -213050,8 +213050,8 @@ static void sqlite3Fts5Parser( int fts5yyerrorhit = 0; /* True if fts5yymajor has invoked an error */ #endif fts5yyParser *fts5yypParser = (fts5yyParser*)fts5yyp; /* The parser */ - sqlite3Fts5ParserCTX_FETCH - sqlite3Fts5ParserARG_STORE + tdsqlite3Fts5ParserCTX_FETCH + tdsqlite3Fts5ParserARG_STORE assert( fts5yypParser->fts5yytos!=0 ); #if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY) @@ -213076,7 +213076,7 @@ static void sqlite3Fts5Parser( fts5yyact = fts5yy_find_shift_action((fts5YYCODETYPE)fts5yymajor,fts5yyact); if( fts5yyact >= fts5YY_MIN_REDUCE ){ fts5yyact = fts5yy_reduce(fts5yypParser,fts5yyact-fts5YY_MIN_REDUCE,fts5yymajor, - fts5yyminor sqlite3Fts5ParserCTX_PARAM); + fts5yyminor tdsqlite3Fts5ParserCTX_PARAM); }else if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){ fts5yy_shift(fts5yypParser,fts5yyact,(fts5YYCODETYPE)fts5yymajor,fts5yyminor); #ifndef fts5YYNOERRORRECOVERY @@ -213209,7 +213209,7 @@ static void sqlite3Fts5Parser( ** Return the fallback token corresponding to canonical token iToken, or ** 0 if iToken has no fallback. */ -static int sqlite3Fts5ParserFallback(int iToken){ +static int tdsqlite3Fts5ParserFallback(int iToken){ #ifdef fts5YYFALLBACK assert( iToken<(int)(sizeof(fts5yyFallback)/sizeof(fts5yyFallback[0])) ); return fts5yyFallback[iToken]; @@ -213359,7 +213359,7 @@ static void fts5HighlightAppend( ){ if( *pRc==SQLITE_OK && z ){ if( n<0 ) n = (int)strlen(z); - p->zOut = sqlite3_mprintf("%z%.*s", p->zOut, n, z); + p->zOut = tdsqlite3_mprintf("%z%.*s", p->zOut, n, z); if( p->zOut==0 ) *pRc = SQLITE_NOMEM; } } @@ -213424,9 +213424,9 @@ static int fts5HighlightCb( static void fts5HighlightFunction( const Fts5ExtensionApi *pApi, /* API offered by current FTS version */ Fts5Context *pFts, /* First arg to pass to pApi functions */ - sqlite3_context *pCtx, /* Context for returning result/error */ + tdsqlite3_context *pCtx, /* Context for returning result/error */ int nVal, /* Number of values in apVal[] array */ - sqlite3_value **apVal /* Array of trailing arguments */ + tdsqlite3_value **apVal /* Array of trailing arguments */ ){ HighlightContext ctx; int rc; @@ -213434,14 +213434,14 @@ static void fts5HighlightFunction( if( nVal!=3 ){ const char *zErr = "wrong number of arguments to function highlight()"; - sqlite3_result_error(pCtx, zErr, -1); + tdsqlite3_result_error(pCtx, zErr, -1); return; } - iCol = sqlite3_value_int(apVal[0]); + iCol = tdsqlite3_value_int(apVal[0]); memset(&ctx, 0, sizeof(HighlightContext)); - ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]); - ctx.zClose = (const char*)sqlite3_value_text(apVal[2]); + ctx.zOpen = (const char*)tdsqlite3_value_text(apVal[1]); + ctx.zClose = (const char*)tdsqlite3_value_text(apVal[2]); rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn); if( ctx.zIn ){ @@ -213455,12 +213455,12 @@ static void fts5HighlightFunction( fts5HighlightAppend(&rc, &ctx, &ctx.zIn[ctx.iOff], ctx.nIn - ctx.iOff); if( rc==SQLITE_OK ){ - sqlite3_result_text(pCtx, (const char*)ctx.zOut, -1, SQLITE_TRANSIENT); + tdsqlite3_result_text(pCtx, (const char*)ctx.zOut, -1, SQLITE_TRANSIENT); } - sqlite3_free(ctx.zOut); + tdsqlite3_free(ctx.zOut); } if( rc!=SQLITE_OK ){ - sqlite3_result_error_code(pCtx, rc); + tdsqlite3_result_error_code(pCtx, rc); } } /* @@ -213489,7 +213489,7 @@ static int fts5SentenceFinderAdd(Fts5SFinder *p, int iAdd){ int nNew = p->nFirstAlloc ? p->nFirstAlloc*2 : 64; int *aNew; - aNew = (int*)sqlite3_realloc64(p->aFirst, nNew*sizeof(int)); + aNew = (int*)tdsqlite3_realloc64(p->aFirst, nNew*sizeof(int)); if( aNew==0 ) return SQLITE_NOMEM; p->aFirst = aNew; p->nFirstAlloc = nNew; @@ -213556,7 +213556,7 @@ static int fts5SnippetScore( int nInst; int nScore = 0; int iLast = 0; - sqlite3_int64 iEnd = (sqlite3_int64)iPos + nToken; + tdsqlite3_int64 iEnd = (tdsqlite3_int64)iPos + nToken; rc = pApi->xInstCount(pFts, &nInst); for(i=0; inDocsize ) iAdj = nDocsize - nToken; if( iAdj<0 ) iAdj = 0; *piPos = (int)iAdj; @@ -213585,8 +213585,8 @@ static int fts5SnippetScore( ** contains a NULL value, return a pointer to a static string zero ** bytes in length instead of a NULL pointer. */ -static const char *fts5ValueToText(sqlite3_value *pVal){ - const char *zRet = (const char*)sqlite3_value_text(pVal); +static const char *fts5ValueToText(tdsqlite3_value *pVal){ + const char *zRet = (const char*)tdsqlite3_value_text(pVal); return zRet ? zRet : ""; } @@ -213596,9 +213596,9 @@ static const char *fts5ValueToText(sqlite3_value *pVal){ static void fts5SnippetFunction( const Fts5ExtensionApi *pApi, /* API offered by current FTS version */ Fts5Context *pFts, /* First arg to pass to pApi functions */ - sqlite3_context *pCtx, /* Context for returning result/error */ + tdsqlite3_context *pCtx, /* Context for returning result/error */ int nVal, /* Number of values in apVal[] array */ - sqlite3_value **apVal /* Array of trailing arguments */ + tdsqlite3_value **apVal /* Array of trailing arguments */ ){ HighlightContext ctx; int rc = SQLITE_OK; /* Return code */ @@ -213618,21 +213618,21 @@ static void fts5SnippetFunction( if( nVal!=5 ){ const char *zErr = "wrong number of arguments to function snippet()"; - sqlite3_result_error(pCtx, zErr, -1); + tdsqlite3_result_error(pCtx, zErr, -1); return; } nCol = pApi->xColumnCount(pFts); memset(&ctx, 0, sizeof(HighlightContext)); - iCol = sqlite3_value_int(apVal[0]); + iCol = tdsqlite3_value_int(apVal[0]); ctx.zOpen = fts5ValueToText(apVal[1]); ctx.zClose = fts5ValueToText(apVal[2]); zEllips = fts5ValueToText(apVal[3]); - nToken = sqlite3_value_int(apVal[4]); + nToken = tdsqlite3_value_int(apVal[4]); iBestCol = (iCol>=0 ? iCol : 0); nPhrase = pApi->xPhraseCount(pFts); - aSeen = sqlite3_malloc(nPhrase); + aSeen = tdsqlite3_malloc(nPhrase); if( aSeen==0 ){ rc = SQLITE_NOMEM; } @@ -213736,13 +213736,13 @@ static void fts5SnippetFunction( } } if( rc==SQLITE_OK ){ - sqlite3_result_text(pCtx, (const char*)ctx.zOut, -1, SQLITE_TRANSIENT); + tdsqlite3_result_text(pCtx, (const char*)ctx.zOut, -1, SQLITE_TRANSIENT); }else{ - sqlite3_result_error_code(pCtx, rc); + tdsqlite3_result_error_code(pCtx, rc); } - sqlite3_free(ctx.zOut); - sqlite3_free(aSeen); - sqlite3_free(sFinder.aFirst); + tdsqlite3_free(ctx.zOut); + tdsqlite3_free(aSeen); + tdsqlite3_free(sFinder.aFirst); } /************************************************************************/ @@ -213766,9 +213766,9 @@ struct Fts5Bm25Data { static int fts5CountCb( const Fts5ExtensionApi *pApi, Fts5Context *pFts, - void *pUserData /* Pointer to sqlite3_int64 variable */ + void *pUserData /* Pointer to tdsqlite3_int64 variable */ ){ - sqlite3_int64 *pn = (sqlite3_int64*)pUserData; + tdsqlite3_int64 *pn = (tdsqlite3_int64*)pUserData; UNUSED_PARAM2(pApi, pFts); (*pn)++; return SQLITE_OK; @@ -213790,15 +213790,15 @@ static int fts5Bm25GetData( p = pApi->xGetAuxdata(pFts, 0); if( p==0 ){ int nPhrase; /* Number of phrases in query */ - sqlite3_int64 nRow = 0; /* Number of rows in table */ - sqlite3_int64 nToken = 0; /* Number of tokens in table */ - sqlite3_int64 nByte; /* Bytes of space to allocate */ + tdsqlite3_int64 nRow = 0; /* Number of rows in table */ + tdsqlite3_int64 nToken = 0; /* Number of tokens in table */ + tdsqlite3_int64 nByte; /* Bytes of space to allocate */ int i; /* Allocate the Fts5Bm25Data object */ nPhrase = pApi->xPhraseCount(pFts); nByte = sizeof(Fts5Bm25Data) + nPhrase*2*sizeof(double); - p = (Fts5Bm25Data*)sqlite3_malloc64(nByte); + p = (Fts5Bm25Data*)tdsqlite3_malloc64(nByte); if( p==0 ){ rc = SQLITE_NOMEM; }else{ @@ -213816,7 +213816,7 @@ static int fts5Bm25GetData( /* Calculate an IDF for each phrase in the query */ for(i=0; rc==SQLITE_OK && ixQueryPhrase(pFts, i, (void*)&nHit, fts5CountCb); if( rc==SQLITE_OK ){ /* Calculate the IDF (Inverse Document Frequency) for phrase i. @@ -213839,9 +213839,9 @@ static int fts5Bm25GetData( } if( rc!=SQLITE_OK ){ - sqlite3_free(p); + tdsqlite3_free(p); }else{ - rc = pApi->xSetAuxdata(pFts, p, sqlite3_free); + rc = pApi->xSetAuxdata(pFts, p, tdsqlite3_free); } if( rc!=SQLITE_OK ) p = 0; } @@ -213855,9 +213855,9 @@ static int fts5Bm25GetData( static void fts5Bm25Function( const Fts5ExtensionApi *pApi, /* API offered by current FTS version */ Fts5Context *pFts, /* First arg to pass to pApi functions */ - sqlite3_context *pCtx, /* Context for returning result/error */ + tdsqlite3_context *pCtx, /* Context for returning result/error */ int nVal, /* Number of values in apVal[] array */ - sqlite3_value **apVal /* Array of trailing arguments */ + tdsqlite3_value **apVal /* Array of trailing arguments */ ){ const double k1 = 1.2; /* Constant "k1" from BM25 formula */ const double b = 0.75; /* Constant "b" from BM25 formula */ @@ -213881,7 +213881,7 @@ static void fts5Bm25Function( int ip; int ic; int io; rc = pApi->xInst(pFts, i, &ip, &ic, &io); if( rc==SQLITE_OK ){ - double w = (nVal > ic) ? sqlite3_value_double(apVal[ic]) : 1.0; + double w = (nVal > ic) ? tdsqlite3_value_double(apVal[ic]) : 1.0; aFreq[ip] += w; } } @@ -213904,13 +213904,13 @@ static void fts5Bm25Function( /* If no error has occurred, return the calculated score. Otherwise, ** throw an SQL exception. */ if( rc==SQLITE_OK ){ - sqlite3_result_double(pCtx, -1.0 * score); + tdsqlite3_result_double(pCtx, -1.0 * score); }else{ - sqlite3_result_error_code(pCtx, rc); + tdsqlite3_result_error_code(pCtx, rc); } } -static int sqlite3Fts5AuxInit(fts5_api *pApi){ +static int tdsqlite3Fts5AuxInit(fts5_api *pApi){ struct Builtin { const char *zFunc; /* Function name (nul-terminated) */ void *pUserData; /* User-data pointer */ @@ -213953,14 +213953,14 @@ static int sqlite3Fts5AuxInit(fts5_api *pApi){ /* #include "fts5Int.h" */ -static int sqlite3Fts5BufferSize(int *pRc, Fts5Buffer *pBuf, u32 nByte){ +static int tdsqlite3Fts5BufferSize(int *pRc, Fts5Buffer *pBuf, u32 nByte){ if( (u32)pBuf->nSpacenSpace ? pBuf->nSpace : 64; u8 *pNew; while( nNewp, nNew); + pNew = tdsqlite3_realloc64(pBuf->p, nNew); if( pNew==0 ){ *pRc = SQLITE_NOMEM; return 1; @@ -213977,19 +213977,19 @@ static int sqlite3Fts5BufferSize(int *pRc, Fts5Buffer *pBuf, u32 nByte){ ** Encode value iVal as an SQLite varint and append it to the buffer object ** pBuf. If an OOM error occurs, set the error code in p. */ -static void sqlite3Fts5BufferAppendVarint(int *pRc, Fts5Buffer *pBuf, i64 iVal){ +static void tdsqlite3Fts5BufferAppendVarint(int *pRc, Fts5Buffer *pBuf, i64 iVal){ if( fts5BufferGrow(pRc, pBuf, 9) ) return; - pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iVal); + pBuf->n += tdsqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iVal); } -static void sqlite3Fts5Put32(u8 *aBuf, int iVal){ +static void tdsqlite3Fts5Put32(u8 *aBuf, int iVal){ aBuf[0] = (iVal>>24) & 0x00FF; aBuf[1] = (iVal>>16) & 0x00FF; aBuf[2] = (iVal>> 8) & 0x00FF; aBuf[3] = (iVal>> 0) & 0x00FF; } -static int sqlite3Fts5Get32(const u8 *aBuf){ +static int tdsqlite3Fts5Get32(const u8 *aBuf){ return (int)((((u32)aBuf[0])<<24) + (aBuf[1]<<16) + (aBuf[2]<<8) + aBuf[3]); } @@ -213998,7 +213998,7 @@ static int sqlite3Fts5Get32(const u8 *aBuf){ ** the error code in p. If an error has already occurred when this function ** is called, it is a no-op. */ -static void sqlite3Fts5BufferAppendBlob( +static void tdsqlite3Fts5BufferAppendBlob( int *pRc, Fts5Buffer *pBuf, u32 nData, @@ -214017,13 +214017,13 @@ static void sqlite3Fts5BufferAppendBlob( ** ensures that the byte following the buffer data is set to 0x00, even ** though this byte is not included in the pBuf->n count. */ -static void sqlite3Fts5BufferAppendString( +static void tdsqlite3Fts5BufferAppendString( int *pRc, Fts5Buffer *pBuf, const char *zStr ){ int nStr = (int)strlen(zStr); - sqlite3Fts5BufferAppendBlob(pRc, pBuf, nStr+1, (const u8*)zStr); + tdsqlite3Fts5BufferAppendBlob(pRc, pBuf, nStr+1, (const u8*)zStr); pBuf->n--; } @@ -214031,11 +214031,11 @@ static void sqlite3Fts5BufferAppendString( ** Argument zFmt is a printf() style format string. This function performs ** the printf() style processing, then appends the results to buffer pBuf. ** -** Like sqlite3Fts5BufferAppendString(), this function ensures that the byte +** Like tdsqlite3Fts5BufferAppendString(), this function ensures that the byte ** following the buffer data is set to 0x00, even though this byte is not ** included in the pBuf->n count. */ -static void sqlite3Fts5BufferAppendPrintf( +static void tdsqlite3Fts5BufferAppendPrintf( int *pRc, Fts5Buffer *pBuf, char *zFmt, ... @@ -214044,24 +214044,24 @@ static void sqlite3Fts5BufferAppendPrintf( char *zTmp; va_list ap; va_start(ap, zFmt); - zTmp = sqlite3_vmprintf(zFmt, ap); + zTmp = tdsqlite3_vmprintf(zFmt, ap); va_end(ap); if( zTmp==0 ){ *pRc = SQLITE_NOMEM; }else{ - sqlite3Fts5BufferAppendString(pRc, pBuf, zTmp); - sqlite3_free(zTmp); + tdsqlite3Fts5BufferAppendString(pRc, pBuf, zTmp); + tdsqlite3_free(zTmp); } } } -static char *sqlite3Fts5Mprintf(int *pRc, const char *zFmt, ...){ +static char *tdsqlite3Fts5Mprintf(int *pRc, const char *zFmt, ...){ char *zRet = 0; if( *pRc==SQLITE_OK ){ va_list ap; va_start(ap, zFmt); - zRet = sqlite3_vmprintf(zFmt, ap); + zRet = tdsqlite3_vmprintf(zFmt, ap); va_end(ap); if( zRet==0 ){ *pRc = SQLITE_NOMEM; @@ -214074,8 +214074,8 @@ static char *sqlite3Fts5Mprintf(int *pRc, const char *zFmt, ...){ /* ** Free any buffer allocated by pBuf. Zero the structure before returning. */ -static void sqlite3Fts5BufferFree(Fts5Buffer *pBuf){ - sqlite3_free(pBuf->p); +static void tdsqlite3Fts5BufferFree(Fts5Buffer *pBuf){ + tdsqlite3_free(pBuf->p); memset(pBuf, 0, sizeof(Fts5Buffer)); } @@ -214083,7 +214083,7 @@ static void sqlite3Fts5BufferFree(Fts5Buffer *pBuf){ ** Zero the contents of the buffer object. But do not free the associated ** memory allocation. */ -static void sqlite3Fts5BufferZero(Fts5Buffer *pBuf){ +static void tdsqlite3Fts5BufferZero(Fts5Buffer *pBuf){ pBuf->n = 0; } @@ -214092,17 +214092,17 @@ static void sqlite3Fts5BufferZero(Fts5Buffer *pBuf){ ** the error code in p. If an error has already occurred when this function ** is called, it is a no-op. */ -static void sqlite3Fts5BufferSet( +static void tdsqlite3Fts5BufferSet( int *pRc, Fts5Buffer *pBuf, int nData, const u8 *pData ){ pBuf->n = 0; - sqlite3Fts5BufferAppendBlob(pRc, pBuf, nData, pData); + tdsqlite3Fts5BufferAppendBlob(pRc, pBuf, nData, pData); } -static int sqlite3Fts5PoslistNext64( +static int tdsqlite3Fts5PoslistNext64( const u8 *a, int n, /* Buffer containing poslist */ int *pi, /* IN/OUT: Offset within a[] */ i64 *piOff /* IN/OUT: Current offset */ @@ -214141,21 +214141,21 @@ static int sqlite3Fts5PoslistNext64( ** Advance the iterator object passed as the only argument. Return true ** if the iterator reaches EOF, or false otherwise. */ -static int sqlite3Fts5PoslistReaderNext(Fts5PoslistReader *pIter){ - if( sqlite3Fts5PoslistNext64(pIter->a, pIter->n, &pIter->i, &pIter->iPos) ){ +static int tdsqlite3Fts5PoslistReaderNext(Fts5PoslistReader *pIter){ + if( tdsqlite3Fts5PoslistNext64(pIter->a, pIter->n, &pIter->i, &pIter->iPos) ){ pIter->bEof = 1; } return pIter->bEof; } -static int sqlite3Fts5PoslistReaderInit( +static int tdsqlite3Fts5PoslistReaderInit( const u8 *a, int n, /* Poslist buffer to iterate through */ Fts5PoslistReader *pIter /* Iterator object to initialize */ ){ memset(pIter, 0, sizeof(*pIter)); pIter->a = a; pIter->n = n; - sqlite3Fts5PoslistReaderNext(pIter); + tdsqlite3Fts5PoslistReaderNext(pIter); return pIter->bEof; } @@ -214165,7 +214165,7 @@ static int sqlite3Fts5PoslistReaderInit( ** The previous position written to this list is *piPrev. *piPrev is set ** to iPos before returning. */ -static void sqlite3Fts5PoslistSafeAppend( +static void tdsqlite3Fts5PoslistSafeAppend( Fts5Buffer *pBuf, i64 *piPrev, i64 iPos @@ -214173,28 +214173,28 @@ static void sqlite3Fts5PoslistSafeAppend( static const i64 colmask = ((i64)(0x7FFFFFFF)) << 32; if( (iPos & colmask) != (*piPrev & colmask) ){ pBuf->p[pBuf->n++] = 1; - pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], (iPos>>32)); + pBuf->n += tdsqlite3Fts5PutVarint(&pBuf->p[pBuf->n], (iPos>>32)); *piPrev = (iPos & colmask); } - pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], (iPos-*piPrev)+2); + pBuf->n += tdsqlite3Fts5PutVarint(&pBuf->p[pBuf->n], (iPos-*piPrev)+2); *piPrev = iPos; } -static int sqlite3Fts5PoslistWriterAppend( +static int tdsqlite3Fts5PoslistWriterAppend( Fts5Buffer *pBuf, Fts5PoslistWriter *pWriter, i64 iPos ){ int rc = 0; /* Initialized only to suppress erroneous warning from Clang */ if( fts5BufferGrow(&rc, pBuf, 5+5+5) ) return rc; - sqlite3Fts5PoslistSafeAppend(pBuf, &pWriter->iPrev, iPos); + tdsqlite3Fts5PoslistSafeAppend(pBuf, &pWriter->iPrev, iPos); return SQLITE_OK; } -static void *sqlite3Fts5MallocZero(int *pRc, sqlite3_int64 nByte){ +static void *tdsqlite3Fts5MallocZero(int *pRc, tdsqlite3_int64 nByte){ void *pRet = 0; if( *pRc==SQLITE_OK ){ - pRet = sqlite3_malloc64(nByte); + pRet = tdsqlite3_malloc64(nByte); if( pRet==0 ){ if( nByte>0 ) *pRc = SQLITE_NOMEM; }else{ @@ -214210,15 +214210,15 @@ static void *sqlite3Fts5MallocZero(int *pRc, sqlite3_int64 nByte){ ** the length of the string is determined using strlen(). ** ** It is the responsibility of the caller to eventually free the returned -** buffer using sqlite3_free(). If an OOM error occurs, NULL is returned. +** buffer using tdsqlite3_free(). If an OOM error occurs, NULL is returned. */ -static char *sqlite3Fts5Strndup(int *pRc, const char *pIn, int nIn){ +static char *tdsqlite3Fts5Strndup(int *pRc, const char *pIn, int nIn){ char *zRet = 0; if( *pRc==SQLITE_OK ){ if( nIn<0 ){ nIn = (int)strlen(pIn); } - zRet = (char*)sqlite3_malloc(nIn+1); + zRet = (char*)tdsqlite3_malloc(nIn+1); if( zRet ){ memcpy(zRet, pIn, nIn); zRet[nIn] = '\0'; @@ -214240,7 +214240,7 @@ static char *sqlite3Fts5Strndup(int *pRc, const char *pIn, int nIn){ ** * The underscore character "_" (0x5F). ** * The unicode "subsitute" character (0x1A). */ -static int sqlite3Fts5IsBareword(char t){ +static int tdsqlite3Fts5IsBareword(char t){ u8 aBareword[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 .. 0x0F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, /* 0x10 .. 0x1F */ @@ -214270,13 +214270,13 @@ struct Fts5Termset { Fts5TermsetEntry *apHash[512]; }; -static int sqlite3Fts5TermsetNew(Fts5Termset **pp){ +static int tdsqlite3Fts5TermsetNew(Fts5Termset **pp){ int rc = SQLITE_OK; - *pp = sqlite3Fts5MallocZero(&rc, sizeof(Fts5Termset)); + *pp = tdsqlite3Fts5MallocZero(&rc, sizeof(Fts5Termset)); return rc; } -static int sqlite3Fts5TermsetAdd( +static int tdsqlite3Fts5TermsetAdd( Fts5Termset *p, int iIdx, const char *pTerm, int nTerm, @@ -214310,7 +214310,7 @@ static int sqlite3Fts5TermsetAdd( } if( pEntry==0 ){ - pEntry = sqlite3Fts5MallocZero(&rc, sizeof(Fts5TermsetEntry) + nTerm); + pEntry = tdsqlite3Fts5MallocZero(&rc, sizeof(Fts5TermsetEntry) + nTerm); if( pEntry ){ pEntry->pTerm = (char*)&pEntry[1]; pEntry->nTerm = nTerm; @@ -214325,7 +214325,7 @@ static int sqlite3Fts5TermsetAdd( return rc; } -static void sqlite3Fts5TermsetFree(Fts5Termset *p){ +static void tdsqlite3Fts5TermsetFree(Fts5Termset *p){ if( p ){ u32 i; for(i=0; iapHash); i++){ @@ -214333,10 +214333,10 @@ static void sqlite3Fts5TermsetFree(Fts5Termset *p){ while( pEntry ){ Fts5TermsetEntry *pDel = pEntry; pEntry = pEntry->pNext; - sqlite3_free(pDel); + tdsqlite3_free(pDel); } } - sqlite3_free(p); + tdsqlite3_free(p); } } @@ -214395,7 +214395,7 @@ static const char *fts5ConfigSkipWhitespace(const char *pIn){ */ static const char *fts5ConfigSkipBareword(const char *pIn){ const char *p = pIn; - while ( sqlite3Fts5IsBareword(*p) ) p++; + while ( tdsqlite3Fts5IsBareword(*p) ) p++; if( p==pIn ) p = 0; return p; } @@ -214410,7 +214410,7 @@ static const char *fts5ConfigSkipLiteral(const char *pIn){ const char *p = pIn; switch( *p ){ case 'n': case 'N': - if( sqlite3_strnicmp("null", p, 4)==0 ){ + if( tdsqlite3_strnicmp("null", p, 4)==0 ){ p = &p[4]; }else{ p = 0; @@ -214527,7 +214527,7 @@ static int fts5Dequote(char *z){ ** [pqr] becomes pqr ** `mno` becomes mno */ -static void sqlite3Fts5Dequote(char *z){ +static void tdsqlite3Fts5Dequote(char *z){ char quote; /* Quote character (if any ) */ assert( 0==fts5_iswhitespace(z[0]) ); @@ -214554,7 +214554,7 @@ static int fts5ConfigSetEnum( int iVal = -1; for(i=0; aEnum[i].zName; i++){ - if( sqlite3_strnicmp(aEnum[i].zName, zEnum, nEnum)==0 ){ + if( tdsqlite3_strnicmp(aEnum[i].zName, zEnum, nEnum)==0 ){ if( iVal>=0 ) return SQLITE_ERROR; iVal = aEnum[i].eVal; } @@ -214571,7 +214571,7 @@ static int fts5ConfigSetEnum( ** If successful, object pConfig is updated and SQLITE_OK returned. If ** an error occurs, an SQLite error code is returned and an error message ** may be left in *pzErr. It is the responsibility of the caller to -** eventually free any such error message using sqlite3_free(). +** eventually free any such error message using tdsqlite3_free(). */ static int fts5ConfigParseSpecial( Fts5Global *pGlobal, @@ -214582,12 +214582,12 @@ static int fts5ConfigParseSpecial( ){ int rc = SQLITE_OK; int nCmd = (int)strlen(zCmd); - if( sqlite3_strnicmp("prefix", zCmd, nCmd)==0 ){ + if( tdsqlite3_strnicmp("prefix", zCmd, nCmd)==0 ){ const int nByte = sizeof(int) * FTS5_MAX_PREFIX_INDEXES; const char *p; int bFirst = 1; if( pConfig->aPrefix==0 ){ - pConfig->aPrefix = sqlite3Fts5MallocZero(&rc, nByte); + pConfig->aPrefix = tdsqlite3Fts5MallocZero(&rc, nByte); if( rc ) return rc; } @@ -214603,13 +214603,13 @@ static int fts5ConfigParseSpecial( break; } if( p[0]<'0' || p[0]>'9' ){ - *pzErr = sqlite3_mprintf("malformed prefix=... directive"); + *pzErr = tdsqlite3_mprintf("malformed prefix=... directive"); rc = SQLITE_ERROR; break; } if( pConfig->nPrefix==FTS5_MAX_PREFIX_INDEXES ){ - *pzErr = sqlite3_mprintf( + *pzErr = tdsqlite3_mprintf( "too many prefix indexes (max %d)", FTS5_MAX_PREFIX_INDEXES ); rc = SQLITE_ERROR; @@ -214622,7 +214622,7 @@ static int fts5ConfigParseSpecial( } if( nPre<=0 || nPre>=1000 ){ - *pzErr = sqlite3_mprintf("prefix length out of range (max 999)"); + *pzErr = tdsqlite3_mprintf("prefix length out of range (max 999)"); rc = SQLITE_ERROR; break; } @@ -214635,16 +214635,16 @@ static int fts5ConfigParseSpecial( return rc; } - if( sqlite3_strnicmp("tokenize", zCmd, nCmd)==0 ){ + if( tdsqlite3_strnicmp("tokenize", zCmd, nCmd)==0 ){ const char *p = (const char*)zArg; - sqlite3_int64 nArg = strlen(zArg) + 1; - char **azArg = sqlite3Fts5MallocZero(&rc, sizeof(char*) * nArg); - char *pDel = sqlite3Fts5MallocZero(&rc, nArg * 2); + tdsqlite3_int64 nArg = strlen(zArg) + 1; + char **azArg = tdsqlite3Fts5MallocZero(&rc, sizeof(char*) * nArg); + char *pDel = tdsqlite3Fts5MallocZero(&rc, nArg * 2); char *pSpace = pDel; if( azArg && pSpace ){ if( pConfig->pTok ){ - *pzErr = sqlite3_mprintf("multiple tokenize=... directives"); + *pzErr = tdsqlite3_mprintf("multiple tokenize=... directives"); rc = SQLITE_ERROR; }else{ for(nArg=0; p && *p; nArg++){ @@ -214657,16 +214657,16 @@ static int fts5ConfigParseSpecial( if( p ){ memcpy(pSpace, p2, p-p2); azArg[nArg] = pSpace; - sqlite3Fts5Dequote(pSpace); + tdsqlite3Fts5Dequote(pSpace); pSpace += (p - p2) + 1; p = fts5ConfigSkipWhitespace(p); } } if( p==0 ){ - *pzErr = sqlite3_mprintf("parse error in tokenize directive"); + *pzErr = tdsqlite3_mprintf("parse error in tokenize directive"); rc = SQLITE_ERROR; }else{ - rc = sqlite3Fts5GetTokenizer(pGlobal, + rc = tdsqlite3Fts5GetTokenizer(pGlobal, (const char**)azArg, (int)nArg, &pConfig->pTok, &pConfig->pTokApi, pzErr ); @@ -214674,19 +214674,19 @@ static int fts5ConfigParseSpecial( } } - sqlite3_free(azArg); - sqlite3_free(pDel); + tdsqlite3_free(azArg); + tdsqlite3_free(pDel); return rc; } - if( sqlite3_strnicmp("content", zCmd, nCmd)==0 ){ + if( tdsqlite3_strnicmp("content", zCmd, nCmd)==0 ){ if( pConfig->eContent!=FTS5_CONTENT_NORMAL ){ - *pzErr = sqlite3_mprintf("multiple content=... directives"); + *pzErr = tdsqlite3_mprintf("multiple content=... directives"); rc = SQLITE_ERROR; }else{ if( zArg[0] ){ pConfig->eContent = FTS5_CONTENT_EXTERNAL; - pConfig->zContent = sqlite3Fts5Mprintf(&rc, "%Q.%Q", pConfig->zDb,zArg); + pConfig->zContent = tdsqlite3Fts5Mprintf(&rc, "%Q.%Q", pConfig->zDb,zArg); }else{ pConfig->eContent = FTS5_CONTENT_NONE; } @@ -214694,19 +214694,19 @@ static int fts5ConfigParseSpecial( return rc; } - if( sqlite3_strnicmp("content_rowid", zCmd, nCmd)==0 ){ + if( tdsqlite3_strnicmp("content_rowid", zCmd, nCmd)==0 ){ if( pConfig->zContentRowid ){ - *pzErr = sqlite3_mprintf("multiple content_rowid=... directives"); + *pzErr = tdsqlite3_mprintf("multiple content_rowid=... directives"); rc = SQLITE_ERROR; }else{ - pConfig->zContentRowid = sqlite3Fts5Strndup(&rc, zArg, -1); + pConfig->zContentRowid = tdsqlite3Fts5Strndup(&rc, zArg, -1); } return rc; } - if( sqlite3_strnicmp("columnsize", zCmd, nCmd)==0 ){ + if( tdsqlite3_strnicmp("columnsize", zCmd, nCmd)==0 ){ if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1]!='\0' ){ - *pzErr = sqlite3_mprintf("malformed columnsize=... directive"); + *pzErr = tdsqlite3_mprintf("malformed columnsize=... directive"); rc = SQLITE_ERROR; }else{ pConfig->bColumnsize = (zArg[0]=='1'); @@ -214714,7 +214714,7 @@ static int fts5ConfigParseSpecial( return rc; } - if( sqlite3_strnicmp("detail", zCmd, nCmd)==0 ){ + if( tdsqlite3_strnicmp("detail", zCmd, nCmd)==0 ){ const Fts5Enum aDetail[] = { { "none", FTS5_DETAIL_NONE }, { "full", FTS5_DETAIL_FULL }, @@ -214723,12 +214723,12 @@ static int fts5ConfigParseSpecial( }; if( (rc = fts5ConfigSetEnum(aDetail, zArg, &pConfig->eDetail)) ){ - *pzErr = sqlite3_mprintf("malformed detail=... directive"); + *pzErr = tdsqlite3_mprintf("malformed detail=... directive"); } return rc; } - *pzErr = sqlite3_mprintf("unrecognized option: \"%.*s\"", nCmd, zCmd); + *pzErr = tdsqlite3_mprintf("unrecognized option: \"%.*s\"", nCmd, zCmd); return SQLITE_ERROR; } @@ -214739,7 +214739,7 @@ static int fts5ConfigParseSpecial( */ static int fts5ConfigDefaultTokenizer(Fts5Global *pGlobal, Fts5Config *pConfig){ assert( pConfig->pTok==0 && pConfig->pTokApi==0 ); - return sqlite3Fts5GetTokenizer( + return tdsqlite3Fts5GetTokenizer( pGlobal, 0, 0, &pConfig->pTok, &pConfig->pTokApi, 0 ); } @@ -214767,8 +214767,8 @@ static const char *fts5ConfigGobbleWord( ){ const char *zRet = 0; - sqlite3_int64 nIn = strlen(zIn); - char *zOut = sqlite3_malloc64(nIn+1); + tdsqlite3_int64 nIn = strlen(zIn); + char *zOut = tdsqlite3_malloc64(nIn+1); assert( *pRc==SQLITE_OK ); *pbQuoted = 0; @@ -214791,7 +214791,7 @@ static const char *fts5ConfigGobbleWord( } if( zRet==0 ){ - sqlite3_free(zOut); + tdsqlite3_free(zOut); }else{ *pzOut = zOut; } @@ -214806,16 +214806,16 @@ static int fts5ConfigParseColumn( char **pzErr ){ int rc = SQLITE_OK; - if( 0==sqlite3_stricmp(zCol, FTS5_RANK_NAME) - || 0==sqlite3_stricmp(zCol, FTS5_ROWID_NAME) + if( 0==tdsqlite3_stricmp(zCol, FTS5_RANK_NAME) + || 0==tdsqlite3_stricmp(zCol, FTS5_ROWID_NAME) ){ - *pzErr = sqlite3_mprintf("reserved fts5 column name: %s", zCol); + *pzErr = tdsqlite3_mprintf("reserved fts5 column name: %s", zCol); rc = SQLITE_ERROR; }else if( zArg ){ - if( 0==sqlite3_stricmp(zArg, "unindexed") ){ + if( 0==tdsqlite3_stricmp(zArg, "unindexed") ){ p->abUnindexed[p->nCol] = 1; }else{ - *pzErr = sqlite3_mprintf("unrecognized column option: %s", zArg); + *pzErr = tdsqlite3_mprintf("unrecognized column option: %s", zArg); rc = SQLITE_ERROR; } } @@ -214832,13 +214832,13 @@ static int fts5ConfigMakeExprlist(Fts5Config *p){ int rc = SQLITE_OK; Fts5Buffer buf = {0, 0, 0}; - sqlite3Fts5BufferAppendPrintf(&rc, &buf, "T.%Q", p->zContentRowid); + tdsqlite3Fts5BufferAppendPrintf(&rc, &buf, "T.%Q", p->zContentRowid); if( p->eContent!=FTS5_CONTENT_NONE ){ for(i=0; inCol; i++){ if( p->eContent==FTS5_CONTENT_EXTERNAL ){ - sqlite3Fts5BufferAppendPrintf(&rc, &buf, ", T.%Q", p->azCol[i]); + tdsqlite3Fts5BufferAppendPrintf(&rc, &buf, ", T.%Q", p->azCol[i]); }else{ - sqlite3Fts5BufferAppendPrintf(&rc, &buf, ", T.c%d", i); + tdsqlite3Fts5BufferAppendPrintf(&rc, &buf, ", T.c%d", i); } } } @@ -214858,11 +214858,11 @@ static int fts5ConfigMakeExprlist(Fts5Config *p){ ** new Fts5Config object. If an error occurs, an SQLite error code is ** returned, *ppOut is set to NULL and an error message may be left in ** *pzErr. It is the responsibility of the caller to eventually free any -** such error message using sqlite3_free(). +** such error message using tdsqlite3_free(). */ -static int sqlite3Fts5ConfigParse( +static int tdsqlite3Fts5ConfigParse( Fts5Global *pGlobal, - sqlite3 *db, + tdsqlite3 *db, int nArg, /* Number of arguments */ const char **azArg, /* Array of nArg CREATE VIRTUAL TABLE args */ Fts5Config **ppOut, /* OUT: Results of parse */ @@ -214871,26 +214871,26 @@ static int sqlite3Fts5ConfigParse( int rc = SQLITE_OK; /* Return code */ Fts5Config *pRet; /* New object to return */ int i; - sqlite3_int64 nByte; + tdsqlite3_int64 nByte; - *ppOut = pRet = (Fts5Config*)sqlite3_malloc(sizeof(Fts5Config)); + *ppOut = pRet = (Fts5Config*)tdsqlite3_malloc(sizeof(Fts5Config)); if( pRet==0 ) return SQLITE_NOMEM; memset(pRet, 0, sizeof(Fts5Config)); pRet->db = db; pRet->iCookie = -1; nByte = nArg * (sizeof(char*) + sizeof(u8)); - pRet->azCol = (char**)sqlite3Fts5MallocZero(&rc, nByte); + pRet->azCol = (char**)tdsqlite3Fts5MallocZero(&rc, nByte); pRet->abUnindexed = (u8*)&pRet->azCol[nArg]; - pRet->zDb = sqlite3Fts5Strndup(&rc, azArg[1], -1); - pRet->zName = sqlite3Fts5Strndup(&rc, azArg[2], -1); + pRet->zDb = tdsqlite3Fts5Strndup(&rc, azArg[1], -1); + pRet->zName = tdsqlite3Fts5Strndup(&rc, azArg[2], -1); pRet->bColumnsize = 1; pRet->eDetail = FTS5_DETAIL_FULL; #ifdef SQLITE_DEBUG pRet->bPrefixIndex = 1; #endif - if( rc==SQLITE_OK && sqlite3_stricmp(pRet->zName, FTS5_RANK_NAME)==0 ){ - *pzErr = sqlite3_mprintf("reserved fts5 table name: %s", pRet->zName); + if( rc==SQLITE_OK && tdsqlite3_stricmp(pRet->zName, FTS5_RANK_NAME)==0 ){ + *pzErr = tdsqlite3_mprintf("reserved fts5 table name: %s", pRet->zName); rc = SQLITE_ERROR; } @@ -214918,7 +214918,7 @@ static int sqlite3Fts5ConfigParse( if( rc==SQLITE_OK ){ if( z==0 ){ - *pzErr = sqlite3_mprintf("parse error in \"%s\"", zOrig); + *pzErr = tdsqlite3_mprintf("parse error in \"%s\"", zOrig); rc = SQLITE_ERROR; }else{ if( bOption ){ @@ -214930,8 +214930,8 @@ static int sqlite3Fts5ConfigParse( } } - sqlite3_free(zOne); - sqlite3_free(zTwo); + tdsqlite3_free(zOne); + tdsqlite3_free(zTwo); } /* If a tokenizer= option was successfully parsed, the tokenizer has @@ -214954,14 +214954,14 @@ static int sqlite3Fts5ConfigParse( } if( zTail ){ - pRet->zContent = sqlite3Fts5Mprintf( + pRet->zContent = tdsqlite3Fts5Mprintf( &rc, "%Q.'%q_%s'", pRet->zDb, pRet->zName, zTail ); } } if( rc==SQLITE_OK && pRet->zContentRowid==0 ){ - pRet->zContentRowid = sqlite3Fts5Strndup(&rc, "rowid", -1); + pRet->zContentRowid = tdsqlite3Fts5Strndup(&rc, "rowid", -1); } /* Formulate the zContentExprlist text */ @@ -214970,7 +214970,7 @@ static int sqlite3Fts5ConfigParse( } if( rc!=SQLITE_OK ){ - sqlite3Fts5ConfigFree(pRet); + tdsqlite3Fts5ConfigFree(pRet); *ppOut = 0; } return rc; @@ -214979,51 +214979,51 @@ static int sqlite3Fts5ConfigParse( /* ** Free the configuration object passed as the only argument. */ -static void sqlite3Fts5ConfigFree(Fts5Config *pConfig){ +static void tdsqlite3Fts5ConfigFree(Fts5Config *pConfig){ if( pConfig ){ int i; if( pConfig->pTok ){ pConfig->pTokApi->xDelete(pConfig->pTok); } - sqlite3_free(pConfig->zDb); - sqlite3_free(pConfig->zName); + tdsqlite3_free(pConfig->zDb); + tdsqlite3_free(pConfig->zName); for(i=0; inCol; i++){ - sqlite3_free(pConfig->azCol[i]); + tdsqlite3_free(pConfig->azCol[i]); } - sqlite3_free(pConfig->azCol); - sqlite3_free(pConfig->aPrefix); - sqlite3_free(pConfig->zRank); - sqlite3_free(pConfig->zRankArgs); - sqlite3_free(pConfig->zContent); - sqlite3_free(pConfig->zContentRowid); - sqlite3_free(pConfig->zContentExprlist); - sqlite3_free(pConfig); + tdsqlite3_free(pConfig->azCol); + tdsqlite3_free(pConfig->aPrefix); + tdsqlite3_free(pConfig->zRank); + tdsqlite3_free(pConfig->zRankArgs); + tdsqlite3_free(pConfig->zContent); + tdsqlite3_free(pConfig->zContentRowid); + tdsqlite3_free(pConfig->zContentExprlist); + tdsqlite3_free(pConfig); } } /* -** Call sqlite3_declare_vtab() based on the contents of the configuration +** Call tdsqlite3_declare_vtab() based on the contents of the configuration ** object passed as the only argument. Return SQLITE_OK if successful, or ** an SQLite error code if an error occurs. */ -static int sqlite3Fts5ConfigDeclareVtab(Fts5Config *pConfig){ +static int tdsqlite3Fts5ConfigDeclareVtab(Fts5Config *pConfig){ int i; int rc = SQLITE_OK; char *zSql; - zSql = sqlite3Fts5Mprintf(&rc, "CREATE TABLE x("); + zSql = tdsqlite3Fts5Mprintf(&rc, "CREATE TABLE x("); for(i=0; zSql && inCol; i++){ const char *zSep = (i==0?"":", "); - zSql = sqlite3Fts5Mprintf(&rc, "%z%s%Q", zSql, zSep, pConfig->azCol[i]); + zSql = tdsqlite3Fts5Mprintf(&rc, "%z%s%Q", zSql, zSep, pConfig->azCol[i]); } - zSql = sqlite3Fts5Mprintf(&rc, "%z, %Q HIDDEN, %s HIDDEN)", + zSql = tdsqlite3Fts5Mprintf(&rc, "%z, %Q HIDDEN, %s HIDDEN)", zSql, pConfig->zName, FTS5_RANK_NAME ); assert( zSql || rc==SQLITE_NOMEM ); if( zSql ){ - rc = sqlite3_declare_vtab(pConfig->db, zSql); - sqlite3_free(zSql); + rc = tdsqlite3_declare_vtab(pConfig->db, zSql); + tdsqlite3_free(zSql); } return rc; @@ -215035,7 +215035,7 @@ static int sqlite3Fts5ConfigDeclareVtab(Fts5Config *pConfig){ ** The callback is invoked once for each token in the input text. The ** arguments passed to it are, in order: ** -** void *pCtx // Copy of 4th argument to sqlite3Fts5Tokenize() +** void *pCtx // Copy of 4th argument to tdsqlite3Fts5Tokenize() ** const char *pToken // Pointer to buffer containing token ** int nToken // Size of token in bytes ** int iStart // Byte offset of start of token within input text @@ -215052,7 +215052,7 @@ static int sqlite3Fts5ConfigDeclareVtab(Fts5Config *pConfig){ ** because the callback returned another non-zero value, it is assumed ** to be an SQLite error code and returned to the caller. */ -static int sqlite3Fts5Tokenize( +static int tdsqlite3Fts5Tokenize( Fts5Config *pConfig, /* FTS5 Configuration object */ int flags, /* FTS5_TOKENIZE_* flags */ const char *pText, int nText, /* Text to tokenize */ @@ -215098,7 +215098,7 @@ static const char *fts5ConfigSkipArgs(const char *pIn){ ** + Zero or more SQL literals in a comma separated list ** + Close parenthesis - ")" */ -static int sqlite3Fts5ConfigParseRank( +static int tdsqlite3Fts5ConfigParseRank( const char *zIn, /* Input string */ char **pzRank, /* OUT: Rank function name */ char **pzRankArgs /* OUT: Rank function arguments */ @@ -215120,7 +215120,7 @@ static int sqlite3Fts5ConfigParseRank( p = fts5ConfigSkipBareword(p); if( p ){ - zRank = sqlite3Fts5MallocZero(&rc, 1 + p - pRank); + zRank = tdsqlite3Fts5MallocZero(&rc, 1 + p - pRank); if( zRank ) memcpy(zRank, pRank, p-pRank); }else{ rc = SQLITE_ERROR; @@ -215140,7 +215140,7 @@ static int sqlite3Fts5ConfigParseRank( if( p==0 ){ rc = SQLITE_ERROR; }else{ - zRankArgs = sqlite3Fts5MallocZero(&rc, 1 + p - pArgs); + zRankArgs = tdsqlite3Fts5MallocZero(&rc, 1 + p - pArgs); if( zRankArgs ) memcpy(zRankArgs, pArgs, p-pArgs); } } @@ -215148,7 +215148,7 @@ static int sqlite3Fts5ConfigParseRank( } if( rc!=SQLITE_OK ){ - sqlite3_free(zRank); + tdsqlite3_free(zRank); assert( zRankArgs==0 ); }else{ *pzRank = zRank; @@ -215157,18 +215157,18 @@ static int sqlite3Fts5ConfigParseRank( return rc; } -static int sqlite3Fts5ConfigSetValue( +static int tdsqlite3Fts5ConfigSetValue( Fts5Config *pConfig, const char *zKey, - sqlite3_value *pVal, + tdsqlite3_value *pVal, int *pbBadkey ){ int rc = SQLITE_OK; - if( 0==sqlite3_stricmp(zKey, "pgsz") ){ + if( 0==tdsqlite3_stricmp(zKey, "pgsz") ){ int pgsz = 0; - if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){ - pgsz = sqlite3_value_int(pVal); + if( SQLITE_INTEGER==tdsqlite3_value_numeric_type(pVal) ){ + pgsz = tdsqlite3_value_int(pVal); } if( pgsz<32 || pgsz>FTS5_MAX_PAGE_SIZE ){ *pbBadkey = 1; @@ -215177,10 +215177,10 @@ static int sqlite3Fts5ConfigSetValue( } } - else if( 0==sqlite3_stricmp(zKey, "hashsize") ){ + else if( 0==tdsqlite3_stricmp(zKey, "hashsize") ){ int nHashSize = -1; - if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){ - nHashSize = sqlite3_value_int(pVal); + if( SQLITE_INTEGER==tdsqlite3_value_numeric_type(pVal) ){ + nHashSize = tdsqlite3_value_int(pVal); } if( nHashSize<=0 ){ *pbBadkey = 1; @@ -215189,10 +215189,10 @@ static int sqlite3Fts5ConfigSetValue( } } - else if( 0==sqlite3_stricmp(zKey, "automerge") ){ + else if( 0==tdsqlite3_stricmp(zKey, "automerge") ){ int nAutomerge = -1; - if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){ - nAutomerge = sqlite3_value_int(pVal); + if( SQLITE_INTEGER==tdsqlite3_value_numeric_type(pVal) ){ + nAutomerge = tdsqlite3_value_int(pVal); } if( nAutomerge<0 || nAutomerge>64 ){ *pbBadkey = 1; @@ -215202,10 +215202,10 @@ static int sqlite3Fts5ConfigSetValue( } } - else if( 0==sqlite3_stricmp(zKey, "usermerge") ){ + else if( 0==tdsqlite3_stricmp(zKey, "usermerge") ){ int nUsermerge = -1; - if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){ - nUsermerge = sqlite3_value_int(pVal); + if( SQLITE_INTEGER==tdsqlite3_value_numeric_type(pVal) ){ + nUsermerge = tdsqlite3_value_int(pVal); } if( nUsermerge<2 || nUsermerge>16 ){ *pbBadkey = 1; @@ -215214,10 +215214,10 @@ static int sqlite3Fts5ConfigSetValue( } } - else if( 0==sqlite3_stricmp(zKey, "crisismerge") ){ + else if( 0==tdsqlite3_stricmp(zKey, "crisismerge") ){ int nCrisisMerge = -1; - if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){ - nCrisisMerge = sqlite3_value_int(pVal); + if( SQLITE_INTEGER==tdsqlite3_value_numeric_type(pVal) ){ + nCrisisMerge = tdsqlite3_value_int(pVal); } if( nCrisisMerge<0 ){ *pbBadkey = 1; @@ -215228,14 +215228,14 @@ static int sqlite3Fts5ConfigSetValue( } } - else if( 0==sqlite3_stricmp(zKey, "rank") ){ - const char *zIn = (const char*)sqlite3_value_text(pVal); + else if( 0==tdsqlite3_stricmp(zKey, "rank") ){ + const char *zIn = (const char*)tdsqlite3_value_text(pVal); char *zRank; char *zRankArgs; - rc = sqlite3Fts5ConfigParseRank(zIn, &zRank, &zRankArgs); + rc = tdsqlite3Fts5ConfigParseRank(zIn, &zRank, &zRankArgs); if( rc==SQLITE_OK ){ - sqlite3_free(pConfig->zRank); - sqlite3_free(pConfig->zRankArgs); + tdsqlite3_free(pConfig->zRank); + tdsqlite3_free(pConfig->zRankArgs); pConfig->zRank = zRank; pConfig->zRankArgs = zRankArgs; }else if( rc==SQLITE_ERROR ){ @@ -215251,10 +215251,10 @@ static int sqlite3Fts5ConfigSetValue( /* ** Load the contents of the %_config table into memory. */ -static int sqlite3Fts5ConfigLoad(Fts5Config *pConfig, int iCookie){ +static int tdsqlite3Fts5ConfigLoad(Fts5Config *pConfig, int iCookie){ const char *zSelect = "SELECT k, v FROM %Q.'%q_config'"; char *zSql; - sqlite3_stmt *p = 0; + tdsqlite3_stmt *p = 0; int rc = SQLITE_OK; int iVersion = 0; @@ -215265,32 +215265,32 @@ static int sqlite3Fts5ConfigLoad(Fts5Config *pConfig, int iCookie){ pConfig->nCrisisMerge = FTS5_DEFAULT_CRISISMERGE; pConfig->nHashSize = FTS5_DEFAULT_HASHSIZE; - zSql = sqlite3Fts5Mprintf(&rc, zSelect, pConfig->zDb, pConfig->zName); + zSql = tdsqlite3Fts5Mprintf(&rc, zSelect, pConfig->zDb, pConfig->zName); if( zSql ){ - rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &p, 0); - sqlite3_free(zSql); + rc = tdsqlite3_prepare_v2(pConfig->db, zSql, -1, &p, 0); + tdsqlite3_free(zSql); } assert( rc==SQLITE_OK || p==0 ); if( rc==SQLITE_OK ){ - while( SQLITE_ROW==sqlite3_step(p) ){ - const char *zK = (const char*)sqlite3_column_text(p, 0); - sqlite3_value *pVal = sqlite3_column_value(p, 1); - if( 0==sqlite3_stricmp(zK, "version") ){ - iVersion = sqlite3_value_int(pVal); + while( SQLITE_ROW==tdsqlite3_step(p) ){ + const char *zK = (const char*)tdsqlite3_column_text(p, 0); + tdsqlite3_value *pVal = tdsqlite3_column_value(p, 1); + if( 0==tdsqlite3_stricmp(zK, "version") ){ + iVersion = tdsqlite3_value_int(pVal); }else{ int bDummy = 0; - sqlite3Fts5ConfigSetValue(pConfig, zK, pVal, &bDummy); + tdsqlite3Fts5ConfigSetValue(pConfig, zK, pVal, &bDummy); } } - rc = sqlite3_finalize(p); + rc = tdsqlite3_finalize(p); } if( rc==SQLITE_OK && iVersion!=FTS5_CURRENT_VERSION ){ rc = SQLITE_ERROR; if( pConfig->pzErrmsg ){ assert( 0==*pConfig->pzErrmsg ); - *pConfig->pzErrmsg = sqlite3_mprintf( + *pConfig->pzErrmsg = tdsqlite3_mprintf( "invalid fts5 file format (found %d, expected %d) - run 'rebuild'", iVersion, FTS5_CURRENT_VERSION ); @@ -215334,14 +215334,14 @@ typedef struct Fts5ExprTerm Fts5ExprTerm; /* ** Functions generated by lemon from fts5parse.y. */ -static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(u64)); -static void sqlite3Fts5ParserFree(void*, void (*freeProc)(void*)); -static void sqlite3Fts5Parser(void*, int, Fts5Token, Fts5Parse*); +static void *tdsqlite3Fts5ParserAlloc(void *(*mallocProc)(u64)); +static void tdsqlite3Fts5ParserFree(void*, void (*freeProc)(void*)); +static void tdsqlite3Fts5Parser(void*, int, Fts5Token, Fts5Parse*); #ifndef NDEBUG /* #include */ -static void sqlite3Fts5ParserTrace(FILE*, char*); +static void tdsqlite3Fts5ParserTrace(FILE*, char*); #endif -static int sqlite3Fts5ParserFallback(int); +static int tdsqlite3Fts5ParserFallback(int); struct Fts5Expr { @@ -215435,11 +215435,11 @@ struct Fts5Parse { Fts5ExprNode *pExpr; /* Result of a successful parse */ }; -static void sqlite3Fts5ParseError(Fts5Parse *pParse, const char *zFmt, ...){ +static void tdsqlite3Fts5ParseError(Fts5Parse *pParse, const char *zFmt, ...){ va_list ap; va_start(ap, zFmt); if( pParse->rc==SQLITE_OK ){ - pParse->zErr = sqlite3_vmprintf(zFmt, ap); + pParse->zErr = tdsqlite3_vmprintf(zFmt, ap); pParse->rc = SQLITE_ERROR; } va_end(ap); @@ -215488,7 +215488,7 @@ static int fts5ExprGetToken( if( z2[0]!='"' ) break; } if( z2[0]=='\0' ){ - sqlite3Fts5ParseError(pParse, "unterminated string"); + tdsqlite3Fts5ParseError(pParse, "unterminated string"); return FTS5_EOF; } } @@ -215498,12 +215498,12 @@ static int fts5ExprGetToken( default: { const char *z2; - if( sqlite3Fts5IsBareword(z[0])==0 ){ - sqlite3Fts5ParseError(pParse, "fts5: syntax error near \"%.1s\"", z); + if( tdsqlite3Fts5IsBareword(z[0])==0 ){ + tdsqlite3Fts5ParseError(pParse, "fts5: syntax error near \"%.1s\"", z); return FTS5_EOF; } tok = FTS5_STRING; - for(z2=&z[1]; sqlite3Fts5IsBareword(*z2); z2++); + for(z2=&z[1]; tdsqlite3Fts5IsBareword(*z2); z2++); pToken->n = (z2 - z); if( pToken->n==2 && memcmp(pToken->p, "OR", 2)==0 ) tok = FTS5_OR; if( pToken->n==3 && memcmp(pToken->p, "NOT", 3)==0 ) tok = FTS5_NOT; @@ -215516,10 +215516,10 @@ static int fts5ExprGetToken( return tok; } -static void *fts5ParseAlloc(u64 t){ return sqlite3_malloc64((sqlite3_int64)t);} -static void fts5ParseFree(void *p){ sqlite3_free(p); } +static void *fts5ParseAlloc(u64 t){ return tdsqlite3_malloc64((tdsqlite3_int64)t);} +static void fts5ParseFree(void *p){ tdsqlite3_free(p); } -static int sqlite3Fts5ExprNew( +static int tdsqlite3Fts5ExprNew( Fts5Config *pConfig, /* FTS5 Configuration */ int iCol, const char *zExpr, /* Expression text */ @@ -215536,38 +215536,38 @@ static int sqlite3Fts5ExprNew( *ppNew = 0; *pzErr = 0; memset(&sParse, 0, sizeof(sParse)); - pEngine = sqlite3Fts5ParserAlloc(fts5ParseAlloc); + pEngine = tdsqlite3Fts5ParserAlloc(fts5ParseAlloc); if( pEngine==0 ){ return SQLITE_NOMEM; } sParse.pConfig = pConfig; do { t = fts5ExprGetToken(&sParse, &z, &token); - sqlite3Fts5Parser(pEngine, t, token, &sParse); + tdsqlite3Fts5Parser(pEngine, t, token, &sParse); }while( sParse.rc==SQLITE_OK && t!=FTS5_EOF ); - sqlite3Fts5ParserFree(pEngine, fts5ParseFree); + tdsqlite3Fts5ParserFree(pEngine, fts5ParseFree); /* If the LHS of the MATCH expression was a user column, apply the ** implicit column-filter. */ if( iColnCol && sParse.pExpr && sParse.rc==SQLITE_OK ){ int n = sizeof(Fts5Colset); - Fts5Colset *pColset = (Fts5Colset*)sqlite3Fts5MallocZero(&sParse.rc, n); + Fts5Colset *pColset = (Fts5Colset*)tdsqlite3Fts5MallocZero(&sParse.rc, n); if( pColset ){ pColset->nCol = 1; pColset->aiCol[0] = iCol; - sqlite3Fts5ParseSetColset(&sParse, sParse.pExpr, pColset); + tdsqlite3Fts5ParseSetColset(&sParse, sParse.pExpr, pColset); } } assert( sParse.rc!=SQLITE_OK || sParse.zErr==0 ); if( sParse.rc==SQLITE_OK ){ - *ppNew = pNew = sqlite3_malloc(sizeof(Fts5Expr)); + *ppNew = pNew = tdsqlite3_malloc(sizeof(Fts5Expr)); if( pNew==0 ){ sParse.rc = SQLITE_NOMEM; - sqlite3Fts5ParseNodeFree(sParse.pExpr); + tdsqlite3Fts5ParseNodeFree(sParse.pExpr); }else{ if( !sParse.pExpr ){ const int nByte = sizeof(Fts5ExprNode); - pNew->pRoot = (Fts5ExprNode*)sqlite3Fts5MallocZero(&sParse.rc, nByte); + pNew->pRoot = (Fts5ExprNode*)tdsqlite3Fts5MallocZero(&sParse.rc, nByte); if( pNew->pRoot ){ pNew->pRoot->bEof = 1; } @@ -215581,10 +215581,10 @@ static int sqlite3Fts5ExprNew( sParse.apPhrase = 0; } }else{ - sqlite3Fts5ParseNodeFree(sParse.pExpr); + tdsqlite3Fts5ParseNodeFree(sParse.pExpr); } - sqlite3_free(sParse.apPhrase); + tdsqlite3_free(sParse.apPhrase); *pzErr = sParse.zErr; return sParse.rc; } @@ -215592,29 +215592,29 @@ static int sqlite3Fts5ExprNew( /* ** Free the expression node object passed as the only argument. */ -static void sqlite3Fts5ParseNodeFree(Fts5ExprNode *p){ +static void tdsqlite3Fts5ParseNodeFree(Fts5ExprNode *p){ if( p ){ int i; for(i=0; inChild; i++){ - sqlite3Fts5ParseNodeFree(p->apChild[i]); + tdsqlite3Fts5ParseNodeFree(p->apChild[i]); } - sqlite3Fts5ParseNearsetFree(p->pNear); - sqlite3_free(p); + tdsqlite3Fts5ParseNearsetFree(p->pNear); + tdsqlite3_free(p); } } /* ** Free the expression object passed as the only argument. */ -static void sqlite3Fts5ExprFree(Fts5Expr *p){ +static void tdsqlite3Fts5ExprFree(Fts5Expr *p){ if( p ){ - sqlite3Fts5ParseNodeFree(p->pRoot); - sqlite3_free(p->apExprPhrase); - sqlite3_free(p); + tdsqlite3Fts5ParseNodeFree(p->pRoot); + tdsqlite3_free(p->apExprPhrase); + tdsqlite3_free(p); } } -static int sqlite3Fts5ExprAnd(Fts5Expr **pp1, Fts5Expr *p2){ +static int tdsqlite3Fts5ExprAnd(Fts5Expr **pp1, Fts5Expr *p2){ Fts5Parse sParse; memset(&sParse, 0, sizeof(sParse)); @@ -215622,11 +215622,11 @@ static int sqlite3Fts5ExprAnd(Fts5Expr **pp1, Fts5Expr *p2){ Fts5Expr *p1 = *pp1; int nPhrase = p1->nPhrase + p2->nPhrase; - p1->pRoot = sqlite3Fts5ParseNode(&sParse, FTS5_AND, p1->pRoot, p2->pRoot,0); + p1->pRoot = tdsqlite3Fts5ParseNode(&sParse, FTS5_AND, p1->pRoot, p2->pRoot,0); p2->pRoot = 0; if( sParse.rc==SQLITE_OK ){ - Fts5ExprPhrase **ap = (Fts5ExprPhrase**)sqlite3_realloc( + Fts5ExprPhrase **ap = (Fts5ExprPhrase**)tdsqlite3_realloc( p1->apExprPhrase, nPhrase * sizeof(Fts5ExprPhrase*) ); if( ap==0 ){ @@ -215641,8 +215641,8 @@ static int sqlite3Fts5ExprAnd(Fts5Expr **pp1, Fts5Expr *p2){ p1->apExprPhrase = ap; } } - sqlite3_free(p2->apExprPhrase); - sqlite3_free(p2); + tdsqlite3_free(p2->apExprPhrase); + tdsqlite3_free(p2); }else{ *pp1 = p2; } @@ -215662,7 +215662,7 @@ static i64 fts5ExprSynonymRowid(Fts5ExprTerm *pTerm, int bDesc, int *pbEof){ assert( pTerm->pSynonym ); assert( bDesc==0 || bDesc==1 ); for(p=pTerm; p; p=p->pSynonym){ - if( 0==sqlite3Fts5IterEof(p->pIter) ){ + if( 0==tdsqlite3Fts5IterEof(p->pIter) ){ i64 iRowid = p->pIter->iRowid; if( bRetValid==0 || (bDesc!=(iRowidpSynonym ); for(p=pTerm; p; p=p->pSynonym){ Fts5IndexIter *pIter = p->pIter; - if( sqlite3Fts5IterEof(pIter)==0 && pIter->iRowid==iRowid ){ + if( tdsqlite3Fts5IterEof(pIter)==0 && pIter->iRowid==iRowid ){ if( pIter->nData==0 ) continue; if( nIter==nAlloc ){ - sqlite3_int64 nByte = sizeof(Fts5PoslistReader) * nAlloc * 2; - Fts5PoslistReader *aNew = (Fts5PoslistReader*)sqlite3_malloc64(nByte); + tdsqlite3_int64 nByte = sizeof(Fts5PoslistReader) * nAlloc * 2; + Fts5PoslistReader *aNew = (Fts5PoslistReader*)tdsqlite3_malloc64(nByte); if( aNew==0 ){ rc = SQLITE_NOMEM; goto synonym_poslist_out; } memcpy(aNew, aIter, sizeof(Fts5PoslistReader) * nIter); nAlloc = nAlloc*2; - if( aIter!=aStatic ) sqlite3_free(aIter); + if( aIter!=aStatic ) tdsqlite3_free(aIter); aIter = aNew; } - sqlite3Fts5PoslistReaderInit(pIter->pData, pIter->nData, &aIter[nIter]); + tdsqlite3Fts5PoslistReaderInit(pIter->pData, pIter->nData, &aIter[nIter]); assert( aIter[nIter].bEof==0 ); nIter++; } @@ -215727,7 +215727,7 @@ static int fts5ExprSynonymList( for(i=0; iposlist); /* If the aStatic[] array is not large enough, allocate a large array - ** using sqlite3_malloc(). This approach could be improved upon. */ + ** using tdsqlite3_malloc(). This approach could be improved upon. */ if( pPhrase->nTerm>ArraySize(aStatic) ){ - sqlite3_int64 nByte = sizeof(Fts5PoslistReader) * pPhrase->nTerm; - aIter = (Fts5PoslistReader*)sqlite3_malloc64(nByte); + tdsqlite3_int64 nByte = sizeof(Fts5PoslistReader) * pPhrase->nTerm; + aIter = (Fts5PoslistReader*)tdsqlite3_malloc64(nByte); if( !aIter ) return SQLITE_NOMEM; } memset(aIter, 0, sizeof(Fts5PoslistReader) * pPhrase->nTerm); @@ -215794,7 +215794,7 @@ static int fts5ExprPhraseIsMatch( Fts5Buffer buf = {0, 0, 0}; rc = fts5ExprSynonymList(pTerm, pNode->iRowid, &buf, &a, &n); if( rc ){ - sqlite3_free(a); + tdsqlite3_free(a); goto ismatch_out; } if( a==buf.p ) bFlag = 1; @@ -215802,7 +215802,7 @@ static int fts5ExprPhraseIsMatch( a = (u8*)pTerm->pIter->pData; n = pTerm->pIter->nData; } - sqlite3Fts5PoslistReaderInit(a, n, &aIter[i]); + tdsqlite3Fts5PoslistReaderInit(a, n, &aIter[i]); aIter[i].bFlag = (u8)bFlag; if( aIter[i].bEof ) goto ismatch_out; } @@ -215818,7 +215818,7 @@ static int fts5ExprPhraseIsMatch( if( pPos->iPos!=iAdj ){ bMatch = 0; while( pPos->iPosiPos>iAdj ) iPos = pPos->iPos-i; } @@ -215827,21 +215827,21 @@ static int fts5ExprPhraseIsMatch( /* Append position iPos to the output */ if( bFirst==0 || FTS5_POS2OFFSET(iPos)==0 ){ - rc = sqlite3Fts5PoslistWriterAppend(&pPhrase->poslist, &writer, iPos); + rc = tdsqlite3Fts5PoslistWriterAppend(&pPhrase->poslist, &writer, iPos); if( rc!=SQLITE_OK ) goto ismatch_out; } for(i=0; inTerm; i++){ - if( sqlite3Fts5PoslistReaderNext(&aIter[i]) ) goto ismatch_out; + if( tdsqlite3Fts5PoslistReaderNext(&aIter[i]) ) goto ismatch_out; } } ismatch_out: *pbMatch = (pPhrase->poslist.n>0); for(i=0; inTerm; i++){ - if( aIter[i].bFlag ) sqlite3_free((u8*)aIter[i].a); + if( aIter[i].bFlag ) tdsqlite3_free((u8*)aIter[i].a); } - if( aIter!=aStatic ) sqlite3_free(aIter); + if( aIter!=aStatic ) tdsqlite3_free(aIter); return rc; } @@ -215858,7 +215858,7 @@ struct Fts5LookaheadReader { static int fts5LookaheadReaderNext(Fts5LookaheadReader *p){ p->iPos = p->iLookahead; - if( sqlite3Fts5PoslistNext64(p->a, p->n, &p->i, &p->iLookahead) ){ + if( tdsqlite3Fts5PoslistNext64(p->a, p->n, &p->i, &p->iLookahead) ){ p->iLookahead = FTS5_LOOKAHEAD_EOF; } return (p->iPos==FTS5_LOOKAHEAD_EOF); @@ -215911,10 +215911,10 @@ static int fts5ExprNearIsMatch(int *pRc, Fts5ExprNearset *pNear){ assert( pNear->nPhrase>1 ); /* If the aStatic[] array is not large enough, allocate a large array - ** using sqlite3_malloc(). This approach could be improved upon. */ + ** using tdsqlite3_malloc(). This approach could be improved upon. */ if( pNear->nPhrase>ArraySize(aStatic) ){ - sqlite3_int64 nByte = sizeof(Fts5NearTrimmer) * pNear->nPhrase; - a = (Fts5NearTrimmer*)sqlite3Fts5MallocZero(&rc, nByte); + tdsqlite3_int64 nByte = sizeof(Fts5NearTrimmer) * pNear->nPhrase; + a = (Fts5NearTrimmer*)tdsqlite3Fts5MallocZero(&rc, nByte); }else{ memset(aStatic, 0, sizeof(aStatic)); } @@ -215966,7 +215966,7 @@ static int fts5ExprNearIsMatch(int *pRc, Fts5ExprNearset *pNear){ i64 iPos = a[i].reader.iPos; Fts5PoslistWriter *pWriter = &a[i].writer; if( a[i].pOut->n==0 || iPos!=pWriter->iPrev ){ - sqlite3Fts5PoslistWriterAppend(a[i].pOut, pWriter, iPos); + tdsqlite3Fts5PoslistWriterAppend(a[i].pOut, pWriter, iPos); } } @@ -215984,7 +215984,7 @@ static int fts5ExprNearIsMatch(int *pRc, Fts5ExprNearset *pNear){ ismatch_out: { int bRet = a[0].pOut->n>0; *pRc = rc; - if( a!=aStatic ) sqlite3_free(a); + if( a!=aStatic ) tdsqlite3_free(a); return bRet; } } @@ -216010,8 +216010,8 @@ static int fts5ExprAdvanceto( iRowid = pIter->iRowid; if( (bDesc==0 && iLast>iRowid) || (bDesc && iLastpSynonym){ - if( sqlite3Fts5IterEof(p->pIter)==0 ){ + if( tdsqlite3Fts5IterEof(p->pIter)==0 ){ i64 iRowid = p->pIter->iRowid; if( (bDesc==0 && iLast>iRowid) || (bDesc && iLastpIter, iLast); + rc = tdsqlite3Fts5IterNextFrom(p->pIter, iLast); } } } @@ -216068,7 +216068,7 @@ static int fts5ExprNearTest( pPhrase->poslist.n = 0; for(pTerm=&pPhrase->aTerm[0]; pTerm; pTerm=pTerm->pSynonym){ Fts5IndexIter *pIter = pTerm->pIter; - if( sqlite3Fts5IterEof(pIter)==0 ){ + if( tdsqlite3Fts5IterEof(pIter)==0 ){ if( pIter->iRowid==pNode->iRowid && pIter->nData>0 ){ pPhrase->poslist.n = 1; } @@ -216136,10 +216136,10 @@ static int fts5ExprNearInitAll( for(p=pTerm; p; p=p->pSynonym){ int rc; if( p->pIter ){ - sqlite3Fts5IterClose(p->pIter); + tdsqlite3Fts5IterClose(p->pIter); p->pIter = 0; } - rc = sqlite3Fts5IndexQuery( + rc = tdsqlite3Fts5IndexQuery( pExpr->pIndex, p->zTerm, (int)strlen(p->zTerm), (pTerm->bPrefix ? FTS5INDEX_QUERY_PREFIX : 0) | (pExpr->bDesc ? FTS5INDEX_QUERY_DESC : 0), @@ -216148,7 +216148,7 @@ static int fts5ExprNearInitAll( ); assert( (rc==SQLITE_OK)==(p->pIter!=0) ); if( rc!=SQLITE_OK ) return rc; - if( 0==sqlite3Fts5IterEof(p->pIter) ){ + if( 0==tdsqlite3Fts5IterEof(p->pIter) ){ bHit = 1; } } @@ -216340,18 +216340,18 @@ static int fts5ExprNodeNext_STRING( /* Advance each iterator that currently points to iRowid. Or, if iFrom ** is valid - each iterator that points to a rowid before iFrom. */ for(p=pTerm; p; p=p->pSynonym){ - if( sqlite3Fts5IterEof(p->pIter)==0 ){ + if( tdsqlite3Fts5IterEof(p->pIter)==0 ){ i64 ii = p->pIter->iRowid; if( ii==iRowid || (bFromValid && ii!=iFrom && (ii>iFrom)==pExpr->bDesc) ){ if( bFromValid ){ - rc = sqlite3Fts5IterNextFrom(p->pIter, iFrom); + rc = tdsqlite3Fts5IterNextFrom(p->pIter, iFrom); }else{ - rc = sqlite3Fts5IterNext(p->pIter); + rc = tdsqlite3Fts5IterNext(p->pIter); } if( rc!=SQLITE_OK ) break; - if( sqlite3Fts5IterEof(p->pIter)==0 ){ + if( tdsqlite3Fts5IterEof(p->pIter)==0 ){ bEof = 0; } }else{ @@ -216368,12 +216368,12 @@ static int fts5ExprNodeNext_STRING( assert( Fts5NodeIsString(pNode) ); if( bFromValid ){ - rc = sqlite3Fts5IterNextFrom(pIter, iFrom); + rc = tdsqlite3Fts5IterNextFrom(pIter, iFrom); }else{ - rc = sqlite3Fts5IterNext(pIter); + rc = tdsqlite3Fts5IterNext(pIter); } - pNode->bEof = (rc || sqlite3Fts5IterEof(pIter)); + pNode->bEof = (rc || tdsqlite3Fts5IterEof(pIter)); } if( pNode->bEof==0 ){ @@ -216424,11 +216424,11 @@ static int fts5ExprNodeNext_TERM( assert( pNode->bEof==0 ); if( bFromValid ){ - rc = sqlite3Fts5IterNextFrom(pIter, iFrom); + rc = tdsqlite3Fts5IterNextFrom(pIter, iFrom); }else{ - rc = sqlite3Fts5IterNext(pIter); + rc = tdsqlite3Fts5IterNext(pIter); } - if( rc==SQLITE_OK && sqlite3Fts5IterEof(pIter)==0 ){ + if( rc==SQLITE_OK && tdsqlite3Fts5IterEof(pIter)==0 ){ rc = fts5ExprNodeTest_TERM(pExpr, pNode); }else{ pNode->bEof = 1; @@ -216708,7 +216708,7 @@ static int fts5ExprNodeFirst(Fts5Expr *pExpr, Fts5ExprNode *pNode){ ** Return SQLITE_OK if successful, or an SQLite error code otherwise. It ** is not considered an error if the query does not match any documents. */ -static int sqlite3Fts5ExprFirst(Fts5Expr *p, Fts5Index *pIdx, i64 iFirst, int bDesc){ +static int tdsqlite3Fts5ExprFirst(Fts5Expr *p, Fts5Index *pIdx, i64 iFirst, int bDesc){ Fts5ExprNode *pRoot = p->pRoot; int rc; /* Return code */ @@ -216739,7 +216739,7 @@ static int sqlite3Fts5ExprFirst(Fts5Expr *p, Fts5Index *pIdx, i64 iFirst, int bD ** Return SQLITE_OK if successful, or an SQLite error code otherwise. It ** is not considered an error if the query does not match any documents. */ -static int sqlite3Fts5ExprNext(Fts5Expr *p, i64 iLast){ +static int tdsqlite3Fts5ExprNext(Fts5Expr *p, i64 iLast){ int rc; Fts5ExprNode *pRoot = p->pRoot; assert( pRoot->bEof==0 && pRoot->bNomatch==0 ); @@ -216753,17 +216753,17 @@ static int sqlite3Fts5ExprNext(Fts5Expr *p, i64 iLast){ return rc; } -static int sqlite3Fts5ExprEof(Fts5Expr *p){ +static int tdsqlite3Fts5ExprEof(Fts5Expr *p){ return p->pRoot->bEof; } -static i64 sqlite3Fts5ExprRowid(Fts5Expr *p){ +static i64 tdsqlite3Fts5ExprRowid(Fts5Expr *p){ return p->pRoot->iRowid; } static int fts5ParseStringFromToken(Fts5Token *pToken, char **pz){ int rc = SQLITE_OK; - *pz = sqlite3Fts5Strndup(&rc, pToken->p, pToken->n); + *pz = tdsqlite3Fts5Strndup(&rc, pToken->p, pToken->n); return rc; } @@ -216777,17 +216777,17 @@ static void fts5ExprPhraseFree(Fts5ExprPhrase *pPhrase){ Fts5ExprTerm *pSyn; Fts5ExprTerm *pNext; Fts5ExprTerm *pTerm = &pPhrase->aTerm[i]; - sqlite3_free(pTerm->zTerm); - sqlite3Fts5IterClose(pTerm->pIter); + tdsqlite3_free(pTerm->zTerm); + tdsqlite3Fts5IterClose(pTerm->pIter); for(pSyn=pTerm->pSynonym; pSyn; pSyn=pNext){ pNext = pSyn->pSynonym; - sqlite3Fts5IterClose(pSyn->pIter); + tdsqlite3Fts5IterClose(pSyn->pIter); fts5BufferFree((Fts5Buffer*)&pSyn[1]); - sqlite3_free(pSyn); + tdsqlite3_free(pSyn); } } if( pPhrase->poslist.nSpace>0 ) fts5BufferFree(&pPhrase->poslist); - sqlite3_free(pPhrase); + tdsqlite3_free(pPhrase); } } @@ -216795,7 +216795,7 @@ static void fts5ExprPhraseFree(Fts5ExprPhrase *pPhrase){ ** Set the "bFirst" flag on the first token of the phrase passed as the ** only argument. */ -static void sqlite3Fts5ParseSetCaret(Fts5ExprPhrase *pPhrase){ +static void tdsqlite3Fts5ParseSetCaret(Fts5ExprPhrase *pPhrase){ if( pPhrase && pPhrase->nTerm ){ pPhrase->aTerm[0].bFirst = 1; } @@ -216809,7 +216809,7 @@ static void sqlite3Fts5ParseSetCaret(Fts5ExprPhrase *pPhrase){ ** If an OOM error occurs, both the pNear and pPhrase objects are freed and ** NULL returned. */ -static Fts5ExprNearset *sqlite3Fts5ParseNearset( +static Fts5ExprNearset *tdsqlite3Fts5ParseNearset( Fts5Parse *pParse, /* Parse context */ Fts5ExprNearset *pNear, /* Existing nearset, or NULL */ Fts5ExprPhrase *pPhrase /* Recently parsed phrase */ @@ -216822,9 +216822,9 @@ static Fts5ExprNearset *sqlite3Fts5ParseNearset( return pNear; } if( pNear==0 ){ - sqlite3_int64 nByte; + tdsqlite3_int64 nByte; nByte = sizeof(Fts5ExprNearset) + SZALLOC * sizeof(Fts5ExprPhrase*); - pRet = sqlite3_malloc64(nByte); + pRet = tdsqlite3_malloc64(nByte); if( pRet==0 ){ pParse->rc = SQLITE_NOMEM; }else{ @@ -216832,10 +216832,10 @@ static Fts5ExprNearset *sqlite3Fts5ParseNearset( } }else if( (pNear->nPhrase % SZALLOC)==0 ){ int nNew = pNear->nPhrase + SZALLOC; - sqlite3_int64 nByte; + tdsqlite3_int64 nByte; nByte = sizeof(Fts5ExprNearset) + nNew * sizeof(Fts5ExprPhrase*); - pRet = (Fts5ExprNearset*)sqlite3_realloc64(pNear, nByte); + pRet = (Fts5ExprNearset*)tdsqlite3_realloc64(pNear, nByte); if( pRet==0 ){ pParse->rc = SQLITE_NOMEM; } @@ -216846,8 +216846,8 @@ static Fts5ExprNearset *sqlite3Fts5ParseNearset( if( pRet==0 ){ assert( pParse->rc!=SQLITE_OK ); - sqlite3Fts5ParseNearsetFree(pNear); - sqlite3Fts5ParsePhraseFree(pPhrase); + tdsqlite3Fts5ParseNearsetFree(pNear); + tdsqlite3Fts5ParsePhraseFree(pPhrase); }else{ if( pRet->nPhrase>0 ){ Fts5ExprPhrase *pLast = pRet->apPhrase[pRet->nPhrase-1]; @@ -216899,8 +216899,8 @@ static int fts5ParseTokenize( if( pPhrase && pPhrase->nTerm>0 && (tflags & FTS5_TOKEN_COLOCATED) ){ Fts5ExprTerm *pSyn; - sqlite3_int64 nByte = sizeof(Fts5ExprTerm) + sizeof(Fts5Buffer) + nToken+1; - pSyn = (Fts5ExprTerm*)sqlite3_malloc64(nByte); + tdsqlite3_int64 nByte = sizeof(Fts5ExprTerm) + sizeof(Fts5Buffer) + nToken+1; + pSyn = (Fts5ExprTerm*)tdsqlite3_malloc64(nByte); if( pSyn==0 ){ rc = SQLITE_NOMEM; }else{ @@ -216916,7 +216916,7 @@ static int fts5ParseTokenize( Fts5ExprPhrase *pNew; int nNew = SZALLOC + (pPhrase ? pPhrase->nTerm : 0); - pNew = (Fts5ExprPhrase*)sqlite3_realloc64(pPhrase, + pNew = (Fts5ExprPhrase*)tdsqlite3_realloc64(pPhrase, sizeof(Fts5ExprPhrase) + sizeof(Fts5ExprTerm) * nNew ); if( pNew==0 ){ @@ -216931,7 +216931,7 @@ static int fts5ParseTokenize( if( rc==SQLITE_OK ){ pTerm = &pPhrase->aTerm[pPhrase->nTerm++]; memset(pTerm, 0, sizeof(Fts5ExprTerm)); - pTerm->zTerm = sqlite3Fts5Strndup(&rc, pToken, nToken); + pTerm->zTerm = tdsqlite3Fts5Strndup(&rc, pToken, nToken); } } @@ -216943,25 +216943,25 @@ static int fts5ParseTokenize( /* ** Free the phrase object passed as the only argument. */ -static void sqlite3Fts5ParsePhraseFree(Fts5ExprPhrase *pPhrase){ +static void tdsqlite3Fts5ParsePhraseFree(Fts5ExprPhrase *pPhrase){ fts5ExprPhraseFree(pPhrase); } /* ** Free the phrase object passed as the second argument. */ -static void sqlite3Fts5ParseNearsetFree(Fts5ExprNearset *pNear){ +static void tdsqlite3Fts5ParseNearsetFree(Fts5ExprNearset *pNear){ if( pNear ){ int i; for(i=0; inPhrase; i++){ fts5ExprPhraseFree(pNear->apPhrase[i]); } - sqlite3_free(pNear->pColset); - sqlite3_free(pNear); + tdsqlite3_free(pNear->pColset); + tdsqlite3_free(pNear); } } -static void sqlite3Fts5ParseFinished(Fts5Parse *pParse, Fts5ExprNode *p){ +static void tdsqlite3Fts5ParseFinished(Fts5Parse *pParse, Fts5ExprNode *p){ assert( pParse->pExpr==0 ); pParse->pExpr = p; } @@ -216971,7 +216971,7 @@ static void sqlite3Fts5ParseFinished(Fts5Parse *pParse, Fts5ExprNode *p){ ** string may or may not be quoted. In any case it is tokenized and a ** phrase object consisting of all tokens returned. */ -static Fts5ExprPhrase *sqlite3Fts5ParseTerm( +static Fts5ExprPhrase *tdsqlite3Fts5ParseTerm( Fts5Parse *pParse, /* Parse context */ Fts5ExprPhrase *pAppend, /* Phrase to append to */ Fts5Token *pToken, /* String to tokenize */ @@ -216989,11 +216989,11 @@ static Fts5ExprPhrase *sqlite3Fts5ParseTerm( if( rc==SQLITE_OK ){ int flags = FTS5_TOKENIZE_QUERY | (bPrefix ? FTS5_TOKENIZE_PREFIX : 0); int n; - sqlite3Fts5Dequote(z); + tdsqlite3Fts5Dequote(z); n = (int)strlen(z); - rc = sqlite3Fts5Tokenize(pConfig, flags, z, n, &sCtx, fts5ParseTokenize); + rc = tdsqlite3Fts5Tokenize(pConfig, flags, z, n, &sCtx, fts5ParseTokenize); } - sqlite3_free(z); + tdsqlite3_free(z); if( rc || (rc = sCtx.rc) ){ pParse->rc = rc; fts5ExprPhraseFree(sCtx.pPhrase); @@ -217002,9 +217002,9 @@ static Fts5ExprPhrase *sqlite3Fts5ParseTerm( if( pAppend==0 ){ if( (pParse->nPhrase % 8)==0 ){ - sqlite3_int64 nByte = sizeof(Fts5ExprPhrase*) * (pParse->nPhrase + 8); + tdsqlite3_int64 nByte = sizeof(Fts5ExprPhrase*) * (pParse->nPhrase + 8); Fts5ExprPhrase **apNew; - apNew = (Fts5ExprPhrase**)sqlite3_realloc64(pParse->apPhrase, nByte); + apNew = (Fts5ExprPhrase**)tdsqlite3_realloc64(pParse->apPhrase, nByte); if( apNew==0 ){ pParse->rc = SQLITE_NOMEM; fts5ExprPhraseFree(sCtx.pPhrase); @@ -217018,7 +217018,7 @@ static Fts5ExprPhrase *sqlite3Fts5ParseTerm( if( sCtx.pPhrase==0 ){ /* This happens when parsing a token or quoted phrase that contains ** no token characters at all. (e.g ... MATCH '""'). */ - sCtx.pPhrase = sqlite3Fts5MallocZero(&pParse->rc, sizeof(Fts5ExprPhrase)); + sCtx.pPhrase = tdsqlite3Fts5MallocZero(&pParse->rc, sizeof(Fts5ExprPhrase)); }else if( sCtx.pPhrase->nTerm ){ sCtx.pPhrase->aTerm[sCtx.pPhrase->nTerm-1].bPrefix = (u8)bPrefix; } @@ -217032,7 +217032,7 @@ static Fts5ExprPhrase *sqlite3Fts5ParseTerm( ** Create a new FTS5 expression by cloning phrase iPhrase of the ** expression passed as the second argument. */ -static int sqlite3Fts5ExprClonePhrase( +static int tdsqlite3Fts5ExprClonePhrase( Fts5Expr *pExpr, int iPhrase, Fts5Expr **ppNew @@ -217043,26 +217043,26 @@ static int sqlite3Fts5ExprClonePhrase( TokenCtx sCtx = {0,0}; /* Context object for fts5ParseTokenize */ pOrig = pExpr->apExprPhrase[iPhrase]; - pNew = (Fts5Expr*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Expr)); + pNew = (Fts5Expr*)tdsqlite3Fts5MallocZero(&rc, sizeof(Fts5Expr)); if( rc==SQLITE_OK ){ - pNew->apExprPhrase = (Fts5ExprPhrase**)sqlite3Fts5MallocZero(&rc, + pNew->apExprPhrase = (Fts5ExprPhrase**)tdsqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprPhrase*)); } if( rc==SQLITE_OK ){ - pNew->pRoot = (Fts5ExprNode*)sqlite3Fts5MallocZero(&rc, + pNew->pRoot = (Fts5ExprNode*)tdsqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprNode)); } if( rc==SQLITE_OK ){ - pNew->pRoot->pNear = (Fts5ExprNearset*)sqlite3Fts5MallocZero(&rc, + pNew->pRoot->pNear = (Fts5ExprNearset*)tdsqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprNearset) + sizeof(Fts5ExprPhrase*)); } if( rc==SQLITE_OK ){ Fts5Colset *pColsetOrig = pOrig->pNode->pNear->pColset; if( pColsetOrig ){ - sqlite3_int64 nByte; + tdsqlite3_int64 nByte; Fts5Colset *pColset; nByte = sizeof(Fts5Colset) + (pColsetOrig->nCol-1) * sizeof(int); - pColset = (Fts5Colset*)sqlite3Fts5MallocZero(&rc, nByte); + pColset = (Fts5Colset*)tdsqlite3Fts5MallocZero(&rc, nByte); if( pColset ){ memcpy(pColset, pColsetOrig, (size_t)nByte); } @@ -217089,7 +217089,7 @@ static int sqlite3Fts5ExprClonePhrase( }else{ /* This happens when parsing a token or quoted phrase that contains ** no token characters at all. (e.g ... MATCH '""'). */ - sCtx.pPhrase = sqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprPhrase)); + sCtx.pPhrase = tdsqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprPhrase)); } if( rc==SQLITE_OK ){ @@ -217113,7 +217113,7 @@ static int sqlite3Fts5ExprClonePhrase( pNew->pRoot->xNext = fts5ExprNodeNext_STRING; } }else{ - sqlite3Fts5ExprFree(pNew); + tdsqlite3Fts5ExprFree(pNew); fts5ExprPhraseFree(sCtx.pPhrase); pNew = 0; } @@ -217128,15 +217128,15 @@ static int sqlite3Fts5ExprClonePhrase( ** is expected. If token pTok does not contain "NEAR", store an error ** in the pParse object. */ -static void sqlite3Fts5ParseNear(Fts5Parse *pParse, Fts5Token *pTok){ +static void tdsqlite3Fts5ParseNear(Fts5Parse *pParse, Fts5Token *pTok){ if( pTok->n!=4 || memcmp("NEAR", pTok->p, 4) ){ - sqlite3Fts5ParseError( + tdsqlite3Fts5ParseError( pParse, "fts5: syntax error near \"%.*s\"", pTok->n, pTok->p ); } } -static void sqlite3Fts5ParseSetDistance( +static void tdsqlite3Fts5ParseSetDistance( Fts5Parse *pParse, Fts5ExprNearset *pNear, Fts5Token *p @@ -217148,7 +217148,7 @@ static void sqlite3Fts5ParseSetDistance( for(i=0; in; i++){ char c = (char)p->p[i]; if( c<'0' || c>'9' ){ - sqlite3Fts5ParseError( + tdsqlite3Fts5ParseError( pParse, "expected integer, got \"%.*s\"", p->n, p->p ); return; @@ -217182,7 +217182,7 @@ static Fts5Colset *fts5ParseColset( assert( pParse->rc==SQLITE_OK ); assert( iCol>=0 && iColpConfig->nCol ); - pNew = sqlite3_realloc64(p, sizeof(Fts5Colset) + sizeof(int)*nCol); + pNew = tdsqlite3_realloc64(p, sizeof(Fts5Colset) + sizeof(int)*nCol); if( pNew==0 ){ pParse->rc = SQLITE_NOMEM; }else{ @@ -217212,11 +217212,11 @@ static Fts5Colset *fts5ParseColset( ** the colset passed as the second argument. Free the colset passed ** as the second argument before returning. */ -static Fts5Colset *sqlite3Fts5ParseColsetInvert(Fts5Parse *pParse, Fts5Colset *p){ +static Fts5Colset *tdsqlite3Fts5ParseColsetInvert(Fts5Parse *pParse, Fts5Colset *p){ Fts5Colset *pRet; int nCol = pParse->pConfig->nCol; - pRet = (Fts5Colset*)sqlite3Fts5MallocZero(&pParse->rc, + pRet = (Fts5Colset*)tdsqlite3Fts5MallocZero(&pParse->rc, sizeof(Fts5Colset) + sizeof(int)*nCol ); if( pRet ){ @@ -217231,11 +217231,11 @@ static Fts5Colset *sqlite3Fts5ParseColsetInvert(Fts5Parse *pParse, Fts5Colset *p } } - sqlite3_free(p); + tdsqlite3_free(p); return pRet; } -static Fts5Colset *sqlite3Fts5ParseColset( +static Fts5Colset *tdsqlite3Fts5ParseColset( Fts5Parse *pParse, /* Store SQLITE_NOMEM here if required */ Fts5Colset *pColset, /* Existing colset object */ Fts5Token *p @@ -217244,24 +217244,24 @@ static Fts5Colset *sqlite3Fts5ParseColset( int iCol; char *z; /* Dequoted copy of token p */ - z = sqlite3Fts5Strndup(&pParse->rc, p->p, p->n); + z = tdsqlite3Fts5Strndup(&pParse->rc, p->p, p->n); if( pParse->rc==SQLITE_OK ){ Fts5Config *pConfig = pParse->pConfig; - sqlite3Fts5Dequote(z); + tdsqlite3Fts5Dequote(z); for(iCol=0; iColnCol; iCol++){ - if( 0==sqlite3_stricmp(pConfig->azCol[iCol], z) ) break; + if( 0==tdsqlite3_stricmp(pConfig->azCol[iCol], z) ) break; } if( iCol==pConfig->nCol ){ - sqlite3Fts5ParseError(pParse, "no such column: %s", z); + tdsqlite3Fts5ParseError(pParse, "no such column: %s", z); }else{ pRet = fts5ParseColset(pParse, pColset, iCol); } - sqlite3_free(z); + tdsqlite3_free(z); } if( pRet==0 ){ assert( pParse->rc!=SQLITE_OK ); - sqlite3_free(pColset); + tdsqlite3_free(pColset); } return pRet; @@ -217272,14 +217272,14 @@ static Fts5Colset *sqlite3Fts5ParseColset( ** SQLITE_OK when this function is called, NULL is returned. ** ** Otherwise, a copy of (*pOrig) is made into memory obtained from -** sqlite3Fts5MallocZero() and a pointer to it returned. If the allocation +** tdsqlite3Fts5MallocZero() and a pointer to it returned. If the allocation ** fails, (*pRc) is set to SQLITE_NOMEM and NULL is returned. */ static Fts5Colset *fts5CloneColset(int *pRc, Fts5Colset *pOrig){ Fts5Colset *pRet; if( pOrig ){ - sqlite3_int64 nByte = sizeof(Fts5Colset) + (pOrig->nCol-1) * sizeof(int); - pRet = (Fts5Colset*)sqlite3Fts5MallocZero(pRc, nByte); + tdsqlite3_int64 nByte = sizeof(Fts5Colset) + (pOrig->nCol-1) * sizeof(int); + pRet = (Fts5Colset*)tdsqlite3Fts5MallocZero(pRc, nByte); if( pRet ){ memcpy(pRet, pOrig, (size_t)nByte); } @@ -217356,7 +217356,7 @@ static void fts5ParseSetColset( /* ** Apply colset pColset to expression node pExpr and all of its descendents. */ -static void sqlite3Fts5ParseSetColset( +static void tdsqlite3Fts5ParseSetColset( Fts5Parse *pParse, Fts5ExprNode *pExpr, Fts5Colset *pColset @@ -217364,13 +217364,13 @@ static void sqlite3Fts5ParseSetColset( Fts5Colset *pFree = pColset; if( pParse->pConfig->eDetail==FTS5_DETAIL_NONE ){ pParse->rc = SQLITE_ERROR; - pParse->zErr = sqlite3_mprintf( + pParse->zErr = tdsqlite3_mprintf( "fts5: column queries are not supported (detail=none)" ); }else{ fts5ParseSetColset(pParse, pExpr, pColset, &pFree); } - sqlite3_free(pFree); + tdsqlite3_free(pFree); } static void fts5ExprAssignXNext(Fts5ExprNode *pNode){ @@ -217411,7 +217411,7 @@ static void fts5ExprAddChildren(Fts5ExprNode *p, Fts5ExprNode *pSub){ int nByte = sizeof(Fts5ExprNode*) * pSub->nChild; memcpy(&p->apChild[p->nChild], pSub->apChild, nByte); p->nChild += pSub->nChild; - sqlite3_free(pSub); + tdsqlite3_free(pSub); }else{ p->apChild[p->nChild++] = pSub; } @@ -217421,7 +217421,7 @@ static void fts5ExprAddChildren(Fts5ExprNode *p, Fts5ExprNode *pSub){ ** Allocate and return a new expression object. If anything goes wrong (i.e. ** OOM error), leave an error code in pParse and return NULL. */ -static Fts5ExprNode *sqlite3Fts5ParseNode( +static Fts5ExprNode *tdsqlite3Fts5ParseNode( Fts5Parse *pParse, /* Parse context */ int eType, /* FTS5_STRING, AND, OR or NOT */ Fts5ExprNode *pLeft, /* Left hand child expression */ @@ -217432,7 +217432,7 @@ static Fts5ExprNode *sqlite3Fts5ParseNode( if( pParse->rc==SQLITE_OK ){ int nChild = 0; /* Number of children of returned node */ - sqlite3_int64 nByte; /* Bytes of space to allocate for this node */ + tdsqlite3_int64 nByte; /* Bytes of space to allocate for this node */ assert( (eType!=FTS5_STRING && !pNear) || (eType==FTS5_STRING && !pLeft && !pRight) @@ -217450,7 +217450,7 @@ static Fts5ExprNode *sqlite3Fts5ParseNode( } nByte = sizeof(Fts5ExprNode) + sizeof(Fts5ExprNode*)*(nChild-1); - pRet = (Fts5ExprNode*)sqlite3Fts5MallocZero(&pParse->rc, nByte); + pRet = (Fts5ExprNode*)tdsqlite3Fts5MallocZero(&pParse->rc, nByte); if( pRet ){ pRet->eType = eType; @@ -217475,11 +217475,11 @@ static Fts5ExprNode *sqlite3Fts5ParseNode( assert( pParse->rc==SQLITE_OK ); pParse->rc = SQLITE_ERROR; assert( pParse->zErr==0 ); - pParse->zErr = sqlite3_mprintf( + pParse->zErr = tdsqlite3_mprintf( "fts5: %s queries are not supported (detail!=full)", pNear->nPhrase==1 ? "phrase": "NEAR" ); - sqlite3_free(pRet); + tdsqlite3_free(pRet); pRet = 0; } } @@ -217492,14 +217492,14 @@ static Fts5ExprNode *sqlite3Fts5ParseNode( if( pRet==0 ){ assert( pParse->rc!=SQLITE_OK ); - sqlite3Fts5ParseNodeFree(pLeft); - sqlite3Fts5ParseNodeFree(pRight); - sqlite3Fts5ParseNearsetFree(pNear); + tdsqlite3Fts5ParseNodeFree(pLeft); + tdsqlite3Fts5ParseNodeFree(pRight); + tdsqlite3Fts5ParseNearsetFree(pNear); } return pRet; } -static Fts5ExprNode *sqlite3Fts5ParseImplicitAnd( +static Fts5ExprNode *tdsqlite3Fts5ParseImplicitAnd( Fts5Parse *pParse, /* Parse context */ Fts5ExprNode *pLeft, /* Left hand child expression */ Fts5ExprNode *pRight /* Right hand child expression */ @@ -217508,8 +217508,8 @@ static Fts5ExprNode *sqlite3Fts5ParseImplicitAnd( Fts5ExprNode *pPrev; if( pParse->rc ){ - sqlite3Fts5ParseNodeFree(pLeft); - sqlite3Fts5ParseNodeFree(pRight); + tdsqlite3Fts5ParseNodeFree(pLeft); + tdsqlite3Fts5ParseNodeFree(pRight); }else{ assert( pLeft->eType==FTS5_STRING @@ -217534,7 +217534,7 @@ static Fts5ExprNode *sqlite3Fts5ParseImplicitAnd( if( pRight->eType==FTS5_EOF ){ assert( pParse->apPhrase[pParse->nPhrase-1]==pRight->pNear->apPhrase[0] ); - sqlite3Fts5ParseNodeFree(pRight); + tdsqlite3Fts5ParseNodeFree(pRight); pRet = pLeft; pParse->nPhrase--; } @@ -217553,10 +217553,10 @@ static Fts5ExprNode *sqlite3Fts5ParseImplicitAnd( memmove(ap, &ap[1], sizeof(Fts5ExprPhrase*)*pRight->pNear->nPhrase); pParse->nPhrase--; - sqlite3Fts5ParseNodeFree(pPrev); + tdsqlite3Fts5ParseNodeFree(pPrev); } else{ - pRet = sqlite3Fts5ParseNode(pParse, FTS5_AND, pLeft, pRight, 0); + pRet = tdsqlite3Fts5ParseNode(pParse, FTS5_AND, pLeft, pRight, 0); } } @@ -217564,7 +217564,7 @@ static Fts5ExprNode *sqlite3Fts5ParseImplicitAnd( } static char *fts5ExprTermPrint(Fts5ExprTerm *pTerm){ - sqlite3_int64 nByte = 0; + tdsqlite3_int64 nByte = 0; Fts5ExprTerm *p; char *zQuoted; @@ -217572,7 +217572,7 @@ static char *fts5ExprTermPrint(Fts5ExprTerm *pTerm){ for(p=pTerm; p; p=p->pSynonym){ nByte += (int)strlen(pTerm->zTerm) * 2 + 3 + 2; } - zQuoted = sqlite3_malloc64(nByte); + zQuoted = tdsqlite3_malloc64(nByte); if( zQuoted ){ int i = 0; @@ -217599,14 +217599,14 @@ static char *fts5PrintfAppend(char *zApp, const char *zFmt, ...){ char *zNew; va_list ap; va_start(ap, zFmt); - zNew = sqlite3_vmprintf(zFmt, ap); + zNew = tdsqlite3_vmprintf(zFmt, ap); va_end(ap); if( zApp && zNew ){ - char *zNew2 = sqlite3_mprintf("%s%s", zApp, zNew); - sqlite3_free(zNew); + char *zNew2 = tdsqlite3_mprintf("%s%s", zApp, zNew); + tdsqlite3_free(zNew); zNew = zNew2; } - sqlite3_free(zApp); + tdsqlite3_free(zApp); return zNew; } @@ -217614,7 +217614,7 @@ static char *fts5PrintfAppend(char *zApp, const char *zFmt, ...){ ** Compose a tcl-readable representation of expression pExpr. Return a ** pointer to a buffer containing that representation. It is the ** responsibility of the caller to at some point free the buffer using -** sqlite3_free(). +** tdsqlite3_free(). */ static char *fts5ExprPrintTcl( Fts5Config *pConfig, @@ -217680,11 +217680,11 @@ static char *fts5ExprPrintTcl( break; } - zRet = sqlite3_mprintf("%s", zOp); + zRet = tdsqlite3_mprintf("%s", zOp); for(i=0; zRet && inChild; i++){ char *z = fts5ExprPrintTcl(pConfig, zNearsetCmd, pExpr->apChild[i]); if( !z ){ - sqlite3_free(zRet); + tdsqlite3_free(zRet); zRet = 0; }else{ zRet = fts5PrintfAppend(zRet, " [%z]", z); @@ -217698,7 +217698,7 @@ static char *fts5ExprPrintTcl( static char *fts5ExprPrint(Fts5Config *pConfig, Fts5ExprNode *pExpr){ char *zRet = 0; if( pExpr->eType==0 ){ - return sqlite3_mprintf("\"\""); + return tdsqlite3_mprintf("\"\""); }else if( pExpr->eType==FTS5_STRING || pExpr->eType==FTS5_TERM ){ Fts5ExprNearset *pNear = pExpr->pNear; @@ -217726,10 +217726,10 @@ static char *fts5ExprPrint(Fts5Config *pConfig, Fts5ExprNode *pExpr){ char *zTerm = fts5ExprTermPrint(&pPhrase->aTerm[iTerm]); if( zTerm ){ zRet = fts5PrintfAppend(zRet, "%s%s", iTerm==0?"":" + ", zTerm); - sqlite3_free(zTerm); + tdsqlite3_free(zTerm); } if( zTerm==0 || zRet==0 ){ - sqlite3_free(zRet); + tdsqlite3_free(zRet); return 0; } } @@ -217756,7 +217756,7 @@ static char *fts5ExprPrint(Fts5Config *pConfig, Fts5ExprNode *pExpr){ for(i=0; inChild; i++){ char *z = fts5ExprPrint(pConfig, pExpr->apChild[i]); if( z==0 ){ - sqlite3_free(zRet); + tdsqlite3_free(zRet); zRet = 0; }else{ int e = pExpr->apChild[i]->eType; @@ -217778,13 +217778,13 @@ static char *fts5ExprPrint(Fts5Config *pConfig, Fts5ExprNode *pExpr){ ** and fts5_expr_tcl() (bTcl!=0). */ static void fts5ExprFunction( - sqlite3_context *pCtx, /* Function call context */ + tdsqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ - sqlite3_value **apVal, /* Function arguments */ + tdsqlite3_value **apVal, /* Function arguments */ int bTcl ){ - Fts5Global *pGlobal = (Fts5Global*)sqlite3_user_data(pCtx); - sqlite3 *db = sqlite3_context_db_handle(pCtx); + Fts5Global *pGlobal = (Fts5Global*)tdsqlite3_user_data(pCtx); + tdsqlite3 *db = tdsqlite3_context_db_handle(pCtx); const char *zExpr = 0; char *zErr = 0; Fts5Expr *pExpr = 0; @@ -217798,44 +217798,44 @@ static void fts5ExprFunction( int iArg = 1; if( nArg<1 ){ - zErr = sqlite3_mprintf("wrong number of arguments to function %s", + zErr = tdsqlite3_mprintf("wrong number of arguments to function %s", bTcl ? "fts5_expr_tcl" : "fts5_expr" ); - sqlite3_result_error(pCtx, zErr, -1); - sqlite3_free(zErr); + tdsqlite3_result_error(pCtx, zErr, -1); + tdsqlite3_free(zErr); return; } if( bTcl && nArg>1 ){ - zNearsetCmd = (const char*)sqlite3_value_text(apVal[1]); + zNearsetCmd = (const char*)tdsqlite3_value_text(apVal[1]); iArg = 2; } nConfig = 3 + (nArg-iArg); - azConfig = (const char**)sqlite3_malloc64(sizeof(char*) * nConfig); + azConfig = (const char**)tdsqlite3_malloc64(sizeof(char*) * nConfig); if( azConfig==0 ){ - sqlite3_result_error_nomem(pCtx); + tdsqlite3_result_error_nomem(pCtx); return; } azConfig[0] = 0; azConfig[1] = "main"; azConfig[2] = "tbl"; for(i=3; iArgnCol, zExpr, &pExpr, &zErr); + rc = tdsqlite3Fts5ExprNew(pConfig, pConfig->nCol, zExpr, &pExpr, &zErr); } if( rc==SQLITE_OK ){ char *zText; if( pExpr->pRoot->xNext==0 ){ - zText = sqlite3_mprintf(""); + zText = tdsqlite3_mprintf(""); }else if( bTcl ){ zText = fts5ExprPrintTcl(pConfig, zNearsetCmd, pExpr->pRoot); }else{ @@ -217844,35 +217844,35 @@ static void fts5ExprFunction( if( zText==0 ){ rc = SQLITE_NOMEM; }else{ - sqlite3_result_text(pCtx, zText, -1, SQLITE_TRANSIENT); - sqlite3_free(zText); + tdsqlite3_result_text(pCtx, zText, -1, SQLITE_TRANSIENT); + tdsqlite3_free(zText); } } if( rc!=SQLITE_OK ){ if( zErr ){ - sqlite3_result_error(pCtx, zErr, -1); - sqlite3_free(zErr); + tdsqlite3_result_error(pCtx, zErr, -1); + tdsqlite3_free(zErr); }else{ - sqlite3_result_error_code(pCtx, rc); + tdsqlite3_result_error_code(pCtx, rc); } } - sqlite3_free((void *)azConfig); - sqlite3Fts5ConfigFree(pConfig); - sqlite3Fts5ExprFree(pExpr); + tdsqlite3_free((void *)azConfig); + tdsqlite3Fts5ConfigFree(pConfig); + tdsqlite3Fts5ExprFree(pExpr); } static void fts5ExprFunctionHr( - sqlite3_context *pCtx, /* Function call context */ + tdsqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ - sqlite3_value **apVal /* Function arguments */ + tdsqlite3_value **apVal /* Function arguments */ ){ fts5ExprFunction(pCtx, nArg, apVal, 0); } static void fts5ExprFunctionTcl( - sqlite3_context *pCtx, /* Function call context */ + tdsqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ - sqlite3_value **apVal /* Function arguments */ + tdsqlite3_value **apVal /* Function arguments */ ){ fts5ExprFunction(pCtx, nArg, apVal, 1); } @@ -217883,41 +217883,41 @@ static void fts5ExprFunctionTcl( ** unicode code point, 1 is returned. Otherwise 0. */ static void fts5ExprIsAlnum( - sqlite3_context *pCtx, /* Function call context */ + tdsqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ - sqlite3_value **apVal /* Function arguments */ + tdsqlite3_value **apVal /* Function arguments */ ){ int iCode; u8 aArr[32]; if( nArg!=1 ){ - sqlite3_result_error(pCtx, + tdsqlite3_result_error(pCtx, "wrong number of arguments to function fts5_isalnum", -1 ); return; } memset(aArr, 0, sizeof(aArr)); - sqlite3Fts5UnicodeCatParse("L*", aArr); - sqlite3Fts5UnicodeCatParse("N*", aArr); - sqlite3Fts5UnicodeCatParse("Co", aArr); - iCode = sqlite3_value_int(apVal[0]); - sqlite3_result_int(pCtx, aArr[sqlite3Fts5UnicodeCategory((u32)iCode)]); + tdsqlite3Fts5UnicodeCatParse("L*", aArr); + tdsqlite3Fts5UnicodeCatParse("N*", aArr); + tdsqlite3Fts5UnicodeCatParse("Co", aArr); + iCode = tdsqlite3_value_int(apVal[0]); + tdsqlite3_result_int(pCtx, aArr[tdsqlite3Fts5UnicodeCategory((u32)iCode)]); } static void fts5ExprFold( - sqlite3_context *pCtx, /* Function call context */ + tdsqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ - sqlite3_value **apVal /* Function arguments */ + tdsqlite3_value **apVal /* Function arguments */ ){ if( nArg!=1 && nArg!=2 ){ - sqlite3_result_error(pCtx, + tdsqlite3_result_error(pCtx, "wrong number of arguments to function fts5_fold", -1 ); }else{ int iCode; int bRemoveDiacritics = 0; - iCode = sqlite3_value_int(apVal[0]); - if( nArg==2 ) bRemoveDiacritics = sqlite3_value_int(apVal[1]); - sqlite3_result_int(pCtx, sqlite3Fts5UnicodeFold(iCode, bRemoveDiacritics)); + iCode = tdsqlite3_value_int(apVal[0]); + if( nArg==2 ) bRemoveDiacritics = tdsqlite3_value_int(apVal[1]); + tdsqlite3_result_int(pCtx, tdsqlite3Fts5UnicodeFold(iCode, bRemoveDiacritics)); } } @@ -217925,10 +217925,10 @@ static void fts5ExprFold( ** This is called during initialization to register the fts5_expr() scalar ** UDF with the SQLite handle passed as the only argument. */ -static int sqlite3Fts5ExprInit(Fts5Global *pGlobal, sqlite3 *db){ +static int tdsqlite3Fts5ExprInit(Fts5Global *pGlobal, tdsqlite3 *db){ struct Fts5ExprFunc { const char *z; - void (*x)(sqlite3_context*,int,sqlite3_value**); + void (*x)(tdsqlite3_context*,int,tdsqlite3_value**); } aFunc[] = { { "fts5_expr", fts5ExprFunctionHr }, { "fts5_expr_tcl", fts5ExprFunctionTcl }, @@ -217941,15 +217941,15 @@ static int sqlite3Fts5ExprInit(Fts5Global *pGlobal, sqlite3 *db){ for(i=0; rc==SQLITE_OK && iz, -1, SQLITE_UTF8, pCtx, p->x, 0, 0); + rc = tdsqlite3_create_function(db, p->z, -1, SQLITE_UTF8, pCtx, p->x, 0, 0); } - /* Avoid warnings indicating that sqlite3Fts5ParserTrace() and - ** sqlite3Fts5ParserFallback() are unused */ + /* Avoid warnings indicating that tdsqlite3Fts5ParserTrace() and + ** tdsqlite3Fts5ParserFallback() are unused */ #ifndef NDEBUG - (void)sqlite3Fts5ParserTrace; + (void)tdsqlite3Fts5ParserTrace; #endif - (void)sqlite3Fts5ParserFallback; + (void)tdsqlite3Fts5ParserFallback; return rc; } @@ -217957,14 +217957,14 @@ static int sqlite3Fts5ExprInit(Fts5Global *pGlobal, sqlite3 *db){ /* ** Return the number of phrases in expression pExpr. */ -static int sqlite3Fts5ExprPhraseCount(Fts5Expr *pExpr){ +static int tdsqlite3Fts5ExprPhraseCount(Fts5Expr *pExpr){ return (pExpr ? pExpr->nPhrase : 0); } /* ** Return the number of terms in the iPhrase'th phrase in pExpr. */ -static int sqlite3Fts5ExprPhraseSize(Fts5Expr *pExpr, int iPhrase){ +static int tdsqlite3Fts5ExprPhraseSize(Fts5Expr *pExpr, int iPhrase){ if( iPhrase<0 || iPhrase>=pExpr->nPhrase ) return 0; return pExpr->apExprPhrase[iPhrase]->nTerm; } @@ -217973,7 +217973,7 @@ static int sqlite3Fts5ExprPhraseSize(Fts5Expr *pExpr, int iPhrase){ ** This function is used to access the current position list for phrase ** iPhrase. */ -static int sqlite3Fts5ExprPoslist(Fts5Expr *pExpr, int iPhrase, const u8 **pa){ +static int tdsqlite3Fts5ExprPoslist(Fts5Expr *pExpr, int iPhrase, const u8 **pa){ int nRet; Fts5ExprPhrase *pPhrase = pExpr->apExprPhrase[iPhrase]; Fts5ExprNode *pNode = pPhrase->pNode; @@ -217993,9 +217993,9 @@ struct Fts5PoslistPopulator { int bMiss; }; -static Fts5PoslistPopulator *sqlite3Fts5ExprClearPoslists(Fts5Expr *pExpr, int bLive){ +static Fts5PoslistPopulator *tdsqlite3Fts5ExprClearPoslists(Fts5Expr *pExpr, int bLive){ Fts5PoslistPopulator *pRet; - pRet = sqlite3_malloc64(sizeof(Fts5PoslistPopulator)*pExpr->nPhrase); + pRet = tdsqlite3_malloc64(sizeof(Fts5PoslistPopulator)*pExpr->nPhrase); if( pRet ){ int i; memset(pRet, 0, sizeof(Fts5PoslistPopulator)*pExpr->nPhrase); @@ -218057,7 +218057,7 @@ static int fts5ExprPopulatePoslistsCb( if( (nTerm==nToken || (nTermbPrefix)) && memcmp(pTerm->zTerm, pToken, nTerm)==0 ){ - int rc = sqlite3Fts5PoslistWriterAppend( + int rc = tdsqlite3Fts5PoslistWriterAppend( &pExpr->apExprPhrase[i]->poslist, &p->aPopulator[i].writer, p->iOff ); if( rc ) return rc; @@ -218068,7 +218068,7 @@ static int fts5ExprPopulatePoslistsCb( return SQLITE_OK; } -static int sqlite3Fts5ExprPopulatePoslists( +static int tdsqlite3Fts5ExprPopulatePoslists( Fts5Config *pConfig, Fts5Expr *pExpr, Fts5PoslistPopulator *aPopulator, @@ -218093,7 +218093,7 @@ static int sqlite3Fts5ExprPopulatePoslists( } } - return sqlite3Fts5Tokenize(pConfig, + return tdsqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT, z, n, (void*)&sCtx, fts5ExprPopulatePoslistsCb ); } @@ -218153,14 +218153,14 @@ static int fts5ExprCheckPoslists(Fts5ExprNode *pNode, i64 iRowid){ return 1; } -static void sqlite3Fts5ExprCheckPoslists(Fts5Expr *pExpr, i64 iRowid){ +static void tdsqlite3Fts5ExprCheckPoslists(Fts5Expr *pExpr, i64 iRowid){ fts5ExprCheckPoslists(pExpr->pRoot, iRowid); } /* ** This function is only called for detail=columns tables. */ -static int sqlite3Fts5ExprPhraseCollist( +static int tdsqlite3Fts5ExprPhraseCollist( Fts5Expr *pExpr, int iPhrase, const u8 **ppCollist, @@ -218279,24 +218279,24 @@ struct Fts5HashEntry { /* ** Allocate a new hash table. */ -static int sqlite3Fts5HashNew(Fts5Config *pConfig, Fts5Hash **ppNew, int *pnByte){ +static int tdsqlite3Fts5HashNew(Fts5Config *pConfig, Fts5Hash **ppNew, int *pnByte){ int rc = SQLITE_OK; Fts5Hash *pNew; - *ppNew = pNew = (Fts5Hash*)sqlite3_malloc(sizeof(Fts5Hash)); + *ppNew = pNew = (Fts5Hash*)tdsqlite3_malloc(sizeof(Fts5Hash)); if( pNew==0 ){ rc = SQLITE_NOMEM; }else{ - sqlite3_int64 nByte; + tdsqlite3_int64 nByte; memset(pNew, 0, sizeof(Fts5Hash)); pNew->pnByte = pnByte; pNew->eDetail = pConfig->eDetail; pNew->nSlot = 1024; nByte = sizeof(Fts5HashEntry*) * pNew->nSlot; - pNew->aSlot = (Fts5HashEntry**)sqlite3_malloc64(nByte); + pNew->aSlot = (Fts5HashEntry**)tdsqlite3_malloc64(nByte); if( pNew->aSlot==0 ){ - sqlite3_free(pNew); + tdsqlite3_free(pNew); *ppNew = 0; rc = SQLITE_NOMEM; }else{ @@ -218309,25 +218309,25 @@ static int sqlite3Fts5HashNew(Fts5Config *pConfig, Fts5Hash **ppNew, int *pnByte /* ** Free a hash table object. */ -static void sqlite3Fts5HashFree(Fts5Hash *pHash){ +static void tdsqlite3Fts5HashFree(Fts5Hash *pHash){ if( pHash ){ - sqlite3Fts5HashClear(pHash); - sqlite3_free(pHash->aSlot); - sqlite3_free(pHash); + tdsqlite3Fts5HashClear(pHash); + tdsqlite3_free(pHash->aSlot); + tdsqlite3_free(pHash); } } /* ** Empty (but do not delete) a hash table. */ -static void sqlite3Fts5HashClear(Fts5Hash *pHash){ +static void tdsqlite3Fts5HashClear(Fts5Hash *pHash){ int i; for(i=0; inSlot; i++){ Fts5HashEntry *pNext; Fts5HashEntry *pSlot; for(pSlot=pHash->aSlot[i]; pSlot; pSlot=pNext){ pNext = pSlot->pHashNext; - sqlite3_free(pSlot); + tdsqlite3_free(pSlot); } } memset(pHash->aSlot, 0, pHash->nSlot * sizeof(Fts5HashEntry*)); @@ -218362,7 +218362,7 @@ static int fts5HashResize(Fts5Hash *pHash){ Fts5HashEntry **apNew; Fts5HashEntry **apOld = pHash->aSlot; - apNew = (Fts5HashEntry**)sqlite3_malloc64(nNew*sizeof(Fts5HashEntry*)); + apNew = (Fts5HashEntry**)tdsqlite3_malloc64(nNew*sizeof(Fts5HashEntry*)); if( !apNew ) return SQLITE_NOMEM; memset(apNew, 0, nNew*sizeof(Fts5HashEntry*)); @@ -218378,7 +218378,7 @@ static int fts5HashResize(Fts5Hash *pHash){ } } - sqlite3_free(apOld); + tdsqlite3_free(apOld); pHash->nSlot = nNew; pHash->aSlot = apNew; return SQLITE_OK; @@ -218409,9 +218409,9 @@ static int fts5HashAddPoslistSize( if( nPos<=127 ){ pPtr[p->iSzPoslist] = (u8)nPos; }else{ - int nByte = sqlite3Fts5GetVarintLen((u32)nPos); + int nByte = tdsqlite3Fts5GetVarintLen((u32)nPos); memmove(&pPtr[p->iSzPoslist + nByte], &pPtr[p->iSzPoslist + 1], nSz); - sqlite3Fts5PutVarint(&pPtr[p->iSzPoslist], nPos); + tdsqlite3Fts5PutVarint(&pPtr[p->iSzPoslist], nPos); nData += (nByte-1); } } @@ -218435,7 +218435,7 @@ static int fts5HashAddPoslistSize( ** ** Or, if iCol is negative, then the value is a delete marker. */ -static int sqlite3Fts5HashWrite( +static int tdsqlite3Fts5HashWrite( Fts5Hash *pHash, i64 iRowid, /* Rowid for this entry */ int iCol, /* Column token appears in (-ve -> delete) */ @@ -218467,7 +218467,7 @@ static int sqlite3Fts5HashWrite( if( p==0 ){ /* Figure out how much space to allocate */ char *zKey; - sqlite3_int64 nByte = sizeof(Fts5HashEntry) + (nToken+1) + 1 + 64; + tdsqlite3_int64 nByte = sizeof(Fts5HashEntry) + (nToken+1) + 1 + 64; if( nByte<128 ) nByte = 128; /* Grow the Fts5Hash.aSlot[] array if necessary. */ @@ -218478,7 +218478,7 @@ static int sqlite3Fts5HashWrite( } /* Allocate new Fts5HashEntry and add it to the hash table. */ - p = (Fts5HashEntry*)sqlite3_malloc64(nByte); + p = (Fts5HashEntry*)tdsqlite3_malloc64(nByte); if( !p ) return SQLITE_NOMEM; memset(p, 0, sizeof(Fts5HashEntry)); p->nAlloc = (int)nByte; @@ -218494,7 +218494,7 @@ static int sqlite3Fts5HashWrite( pHash->nEntry++; /* Add the first rowid field to the hash-entry */ - p->nData += sqlite3Fts5PutVarint(&((u8*)p)[p->nData], iRowid); + p->nData += tdsqlite3Fts5PutVarint(&((u8*)p)[p->nData], iRowid); p->iRowid = iRowid; p->iSzPoslist = p->nData; @@ -218517,10 +218517,10 @@ static int sqlite3Fts5HashWrite( ** + 5 bytes for the new position offset (32-bit max). */ if( (p->nAlloc - p->nData) < (9 + 4 + 1 + 3 + 5) ){ - sqlite3_int64 nNew = p->nAlloc * 2; + tdsqlite3_int64 nNew = p->nAlloc * 2; Fts5HashEntry *pNew; Fts5HashEntry **pp; - pNew = (Fts5HashEntry*)sqlite3_realloc64(p, nNew); + pNew = (Fts5HashEntry*)tdsqlite3_realloc64(p, nNew); if( pNew==0 ) return SQLITE_NOMEM; pNew->nAlloc = (int)nNew; for(pp=&pHash->aSlot[iHash]; *pp!=p; pp=&(*pp)->pHashNext); @@ -218537,7 +218537,7 @@ static int sqlite3Fts5HashWrite( ** entry, and the new rowid for this entry. */ if( iRowid!=p->iRowid ){ fts5HashAddPoslistSize(pHash, p, 0); - p->nData += sqlite3Fts5PutVarint(&pPtr[p->nData], iRowid - p->iRowid); + p->nData += tdsqlite3Fts5PutVarint(&pPtr[p->nData], iRowid - p->iRowid); p->iRowid = iRowid; bNew = 1; p->iSzPoslist = p->nData; @@ -218557,7 +218557,7 @@ static int sqlite3Fts5HashWrite( if( iCol!=p->iCol ){ if( pHash->eDetail==FTS5_DETAIL_FULL ){ pPtr[p->nData++] = 0x01; - p->nData += sqlite3Fts5PutVarint(&pPtr[p->nData], iCol); + p->nData += tdsqlite3Fts5PutVarint(&pPtr[p->nData], iCol); p->iCol = (i16)iCol; p->iPos = 0; }else{ @@ -218568,7 +218568,7 @@ static int sqlite3Fts5HashWrite( /* Append the new position offset, if necessary */ if( bNew ){ - p->nData += sqlite3Fts5PutVarint(&pPtr[p->nData], iPos - p->iPos + 2); + p->nData += tdsqlite3Fts5PutVarint(&pPtr[p->nData], iPos - p->iPos + 2); p->iPos = iPos; } } @@ -218646,7 +218646,7 @@ static int fts5HashEntrySort( int i; *ppSorted = 0; - ap = sqlite3_malloc64(sizeof(Fts5HashEntry*) * nMergeSlot); + ap = tdsqlite3_malloc64(sizeof(Fts5HashEntry*) * nMergeSlot); if( !ap ) return SQLITE_NOMEM; memset(ap, 0, sizeof(Fts5HashEntry*) * nMergeSlot); @@ -218673,7 +218673,7 @@ static int fts5HashEntrySort( } pHash->nEntry = 0; - sqlite3_free(ap); + tdsqlite3_free(ap); *ppSorted = pList; return SQLITE_OK; } @@ -218681,7 +218681,7 @@ static int fts5HashEntrySort( /* ** Query the hash table for a doclist associated with term pTerm/nTerm. */ -static int sqlite3Fts5HashQuery( +static int tdsqlite3Fts5HashQuery( Fts5Hash *pHash, /* Hash table to query */ int nPre, const char *pTerm, int nTerm, /* Query term */ @@ -218701,7 +218701,7 @@ static int sqlite3Fts5HashQuery( if( p ){ int nHashPre = sizeof(Fts5HashEntry) + nTerm + 1; int nList = p->nData - nHashPre; - u8 *pRet = (u8*)(*ppOut = sqlite3_malloc64(nPre + nList + 10)); + u8 *pRet = (u8*)(*ppOut = tdsqlite3_malloc64(nPre + nList + 10)); if( pRet ){ Fts5HashEntry *pFaux = (Fts5HashEntry*)&pRet[nPre-nHashPre]; memcpy(&pRet[nPre], &((u8*)p)[nHashPre], nList); @@ -218719,23 +218719,23 @@ static int sqlite3Fts5HashQuery( return SQLITE_OK; } -static int sqlite3Fts5HashScanInit( +static int tdsqlite3Fts5HashScanInit( Fts5Hash *p, /* Hash table to query */ const char *pTerm, int nTerm /* Query prefix */ ){ return fts5HashEntrySort(p, pTerm, nTerm, &p->pScan); } -static void sqlite3Fts5HashScanNext(Fts5Hash *p){ - assert( !sqlite3Fts5HashScanEof(p) ); +static void tdsqlite3Fts5HashScanNext(Fts5Hash *p){ + assert( !tdsqlite3Fts5HashScanEof(p) ); p->pScan = p->pScan->pScanNext; } -static int sqlite3Fts5HashScanEof(Fts5Hash *p){ +static int tdsqlite3Fts5HashScanEof(Fts5Hash *p){ return (p->pScan==0); } -static void sqlite3Fts5HashScanEntry( +static void tdsqlite3Fts5HashScanEntry( Fts5Hash *pHash, const char **pzTerm, /* OUT: term (nul-terminated) */ const u8 **ppDoclist, /* OUT: pointer to doclist */ @@ -218998,7 +218998,7 @@ static void sqlite3Fts5HashScanEntry( #define FTS5_DLIDX_ROWID(segid, height, pgno) fts5_dri(segid, 1, height, pgno) #ifdef SQLITE_DEBUG -static int sqlite3Fts5Corrupt() { return SQLITE_CORRUPT_VTAB; } +static int tdsqlite3Fts5Corrupt() { return SQLITE_CORRUPT_VTAB; } #endif @@ -219050,15 +219050,15 @@ struct Fts5Index { int rc; /* Current error code */ /* State used by the fts5DataXXX() functions. */ - sqlite3_blob *pReader; /* RO incr-blob open on %_data table */ - sqlite3_stmt *pWriter; /* "INSERT ... %_data VALUES(?,?)" */ - sqlite3_stmt *pDeleter; /* "DELETE FROM %_data ... id>=? AND id<=?" */ - sqlite3_stmt *pIdxWriter; /* "INSERT ... %_idx VALUES(?,?,?,?)" */ - sqlite3_stmt *pIdxDeleter; /* "DELETE FROM %_idx WHERE segid=? */ - sqlite3_stmt *pIdxSelect; + tdsqlite3_blob *pReader; /* RO incr-blob open on %_data table */ + tdsqlite3_stmt *pWriter; /* "INSERT ... %_data VALUES(?,?)" */ + tdsqlite3_stmt *pDeleter; /* "DELETE FROM %_data ... id>=? AND id<=?" */ + tdsqlite3_stmt *pIdxWriter; /* "INSERT ... %_idx VALUES(?,?,?,?)" */ + tdsqlite3_stmt *pIdxDeleter; /* "DELETE FROM %_idx WHERE segid=? */ + tdsqlite3_stmt *pIdxSelect; int nRead; /* Total number of blocks read */ - sqlite3_stmt *pDataVersion; + tdsqlite3_stmt *pDataVersion; i64 iStructVersion; /* data_version when pStruct read */ Fts5Structure *pStruct; /* Current db structure (or NULL) */ }; @@ -219258,7 +219258,7 @@ struct Fts5SegIter { ** the smallest key overall. aFirst[0] is unused. ** ** poslist: -** Used by sqlite3Fts5IterPoslist() when the poslist needs to be buffered. +** Used by tdsqlite3Fts5IterPoslist() when the poslist needs to be buffered. ** There is no way to tell if this is populated or not. */ struct Fts5Iter { @@ -219325,8 +219325,8 @@ static u16 fts5GetU16(const u8 *aIn){ ** If an OOM error is encountered, return NULL and set the error code in ** the Fts5Index handle passed as the first argument. */ -static void *fts5IdxMalloc(Fts5Index *p, sqlite3_int64 nByte){ - return sqlite3Fts5MallocZero(&p->rc, nByte); +static void *fts5IdxMalloc(Fts5Index *p, tdsqlite3_int64 nByte){ + return tdsqlite3Fts5MallocZero(&p->rc, nByte); } /* @@ -219372,11 +219372,11 @@ static int fts5LeafFirstTermOff(Fts5Data *pLeaf){ /* ** Close the read-only blob handle, if it is open. */ -static void sqlite3Fts5IndexCloseReader(Fts5Index *p){ +static void tdsqlite3Fts5IndexCloseReader(Fts5Index *p){ if( p->pReader ){ - sqlite3_blob *pReader = p->pReader; + tdsqlite3_blob *pReader = p->pReader; p->pReader = 0; - sqlite3_blob_close(pReader); + tdsqlite3_blob_close(pReader); } } @@ -219395,13 +219395,13 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){ /* This call may return SQLITE_ABORT if there has been a savepoint ** rollback since it was last used. In this case a new blob handle ** is required. */ - sqlite3_blob *pBlob = p->pReader; + tdsqlite3_blob *pBlob = p->pReader; p->pReader = 0; - rc = sqlite3_blob_reopen(pBlob, iRowid); + rc = tdsqlite3_blob_reopen(pBlob, iRowid); assert( p->pReader==0 ); p->pReader = pBlob; if( rc!=SQLITE_OK ){ - sqlite3Fts5IndexCloseReader(p); + tdsqlite3Fts5IndexCloseReader(p); } if( rc==SQLITE_ABORT ) rc = SQLITE_OK; } @@ -219410,12 +219410,12 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){ ** to the requested entry. */ if( p->pReader==0 && rc==SQLITE_OK ){ Fts5Config *pConfig = p->pConfig; - rc = sqlite3_blob_open(pConfig->db, + rc = tdsqlite3_blob_open(pConfig->db, pConfig->zDb, p->zDataTbl, "block", iRowid, 0, &p->pReader ); } - /* If either of the sqlite3_blob_open() or sqlite3_blob_reopen() calls + /* If either of the tdsqlite3_blob_open() or tdsqlite3_blob_reopen() calls ** above returned SQLITE_ERROR, return SQLITE_CORRUPT_VTAB instead. ** All the reasons those functions might return SQLITE_ERROR - missing ** table, missing row, non-blob/text in block column - indicate @@ -219424,9 +219424,9 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){ if( rc==SQLITE_OK ){ u8 *aOut = 0; /* Read blob data into this buffer */ - int nByte = sqlite3_blob_bytes(p->pReader); - sqlite3_int64 nAlloc = sizeof(Fts5Data) + nByte + FTS5_DATA_PADDING; - pRet = (Fts5Data*)sqlite3_malloc64(nAlloc); + int nByte = tdsqlite3_blob_bytes(p->pReader); + tdsqlite3_int64 nAlloc = sizeof(Fts5Data) + nByte + FTS5_DATA_PADDING; + pRet = (Fts5Data*)tdsqlite3_malloc64(nAlloc); if( pRet ){ pRet->nn = nByte; aOut = pRet->p = (u8*)&pRet[1]; @@ -219435,10 +219435,10 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){ } if( rc==SQLITE_OK ){ - rc = sqlite3_blob_read(p->pReader, aOut, nByte, 0); + rc = tdsqlite3_blob_read(p->pReader, aOut, nByte, 0); } if( rc!=SQLITE_OK ){ - sqlite3_free(pRet); + tdsqlite3_free(pRet); pRet = 0; }else{ /* TODO1: Fix this */ @@ -219460,7 +219460,7 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){ ** fts5DataRead(). */ static void fts5DataRelease(Fts5Data *pData){ - sqlite3_free(pData); + tdsqlite3_free(pData); } static Fts5Data *fts5LeafRead(Fts5Index *p, i64 iRowid){ @@ -219477,19 +219477,19 @@ static Fts5Data *fts5LeafRead(Fts5Index *p, i64 iRowid){ static int fts5IndexPrepareStmt( Fts5Index *p, - sqlite3_stmt **ppStmt, + tdsqlite3_stmt **ppStmt, char *zSql ){ if( p->rc==SQLITE_OK ){ if( zSql ){ - p->rc = sqlite3_prepare_v3(p->pConfig->db, zSql, -1, + p->rc = tdsqlite3_prepare_v3(p->pConfig->db, zSql, -1, SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_NO_VTAB, ppStmt, 0); }else{ p->rc = SQLITE_NOMEM; } } - sqlite3_free(zSql); + tdsqlite3_free(zSql); return p->rc; } @@ -219502,18 +219502,18 @@ static void fts5DataWrite(Fts5Index *p, i64 iRowid, const u8 *pData, int nData){ if( p->pWriter==0 ){ Fts5Config *pConfig = p->pConfig; - fts5IndexPrepareStmt(p, &p->pWriter, sqlite3_mprintf( + fts5IndexPrepareStmt(p, &p->pWriter, tdsqlite3_mprintf( "REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)", pConfig->zDb, pConfig->zName )); if( p->rc ) return; } - sqlite3_bind_int64(p->pWriter, 1, iRowid); - sqlite3_bind_blob(p->pWriter, 2, pData, nData, SQLITE_STATIC); - sqlite3_step(p->pWriter); - p->rc = sqlite3_reset(p->pWriter); - sqlite3_bind_null(p->pWriter, 2); + tdsqlite3_bind_int64(p->pWriter, 1, iRowid); + tdsqlite3_bind_blob(p->pWriter, 2, pData, nData, SQLITE_STATIC); + tdsqlite3_step(p->pWriter); + p->rc = tdsqlite3_reset(p->pWriter); + tdsqlite3_bind_null(p->pWriter, 2); } /* @@ -219526,17 +219526,17 @@ static void fts5DataDelete(Fts5Index *p, i64 iFirst, i64 iLast){ if( p->pDeleter==0 ){ Fts5Config *pConfig = p->pConfig; - char *zSql = sqlite3_mprintf( + char *zSql = tdsqlite3_mprintf( "DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?", pConfig->zDb, pConfig->zName ); if( fts5IndexPrepareStmt(p, &p->pDeleter, zSql) ) return; } - sqlite3_bind_int64(p->pDeleter, 1, iFirst); - sqlite3_bind_int64(p->pDeleter, 2, iLast); - sqlite3_step(p->pDeleter); - p->rc = sqlite3_reset(p->pDeleter); + tdsqlite3_bind_int64(p->pDeleter, 1, iFirst); + tdsqlite3_bind_int64(p->pDeleter, 2, iLast); + tdsqlite3_step(p->pDeleter); + p->rc = tdsqlite3_reset(p->pDeleter); } /* @@ -219548,15 +219548,15 @@ static void fts5DataRemoveSegment(Fts5Index *p, int iSegid){ fts5DataDelete(p, iFirst, iLast); if( p->pIdxDeleter==0 ){ Fts5Config *pConfig = p->pConfig; - fts5IndexPrepareStmt(p, &p->pIdxDeleter, sqlite3_mprintf( + fts5IndexPrepareStmt(p, &p->pIdxDeleter, tdsqlite3_mprintf( "DELETE FROM '%q'.'%q_idx' WHERE segid=?", pConfig->zDb, pConfig->zName )); } if( p->rc==SQLITE_OK ){ - sqlite3_bind_int(p->pIdxDeleter, 1, iSegid); - sqlite3_step(p->pIdxDeleter); - p->rc = sqlite3_reset(p->pIdxDeleter); + tdsqlite3_bind_int(p->pIdxDeleter, 1, iSegid); + tdsqlite3_step(p->pIdxDeleter); + p->rc = tdsqlite3_reset(p->pIdxDeleter); } } @@ -219569,9 +219569,9 @@ static void fts5StructureRelease(Fts5Structure *pStruct){ int i; assert( pStruct->nRef==0 ); for(i=0; inLevel; i++){ - sqlite3_free(pStruct->aLevel[i].aSeg); + tdsqlite3_free(pStruct->aLevel[i].aSeg); } - sqlite3_free(pStruct); + tdsqlite3_free(pStruct); } } @@ -219602,11 +219602,11 @@ static int fts5StructureDecode( int iLvl; int nLevel = 0; int nSegment = 0; - sqlite3_int64 nByte; /* Bytes of space to allocate at pRet */ + tdsqlite3_int64 nByte; /* Bytes of space to allocate at pRet */ Fts5Structure *pRet = 0; /* Structure object to return */ /* Grab the cookie value */ - if( piCookie ) *piCookie = sqlite3Fts5Get32(pData); + if( piCookie ) *piCookie = tdsqlite3Fts5Get32(pData); i = 4; /* Read the total number of levels and segments from the start of the @@ -219622,13 +219622,13 @@ static int fts5StructureDecode( sizeof(Fts5Structure) + /* Main structure */ sizeof(Fts5StructureLevel) * (nLevel-1) /* aLevel[] array */ ); - pRet = (Fts5Structure*)sqlite3Fts5MallocZero(&rc, nByte); + pRet = (Fts5Structure*)tdsqlite3Fts5MallocZero(&rc, nByte); if( pRet ){ pRet->nRef = 1; pRet->nLevel = nLevel; pRet->nSegment = nSegment; - i += sqlite3Fts5GetVarint(&pData[i], &pRet->nWriteCounter); + i += tdsqlite3Fts5GetVarint(&pData[i], &pRet->nWriteCounter); for(iLvl=0; rc==SQLITE_OK && iLvlaLevel[iLvl]; @@ -219641,7 +219641,7 @@ static int fts5StructureDecode( i += fts5GetVarint32(&pData[i], pLvl->nMerge); i += fts5GetVarint32(&pData[i], nTotal); if( nTotalnMerge ) rc = FTS5_CORRUPT; - pLvl->aSeg = (Fts5StructureSegment*)sqlite3Fts5MallocZero(&rc, + pLvl->aSeg = (Fts5StructureSegment*)tdsqlite3Fts5MallocZero(&rc, nTotal * sizeof(Fts5StructureSegment) ); nSegment -= nTotal; @@ -219686,12 +219686,12 @@ static void fts5StructureAddLevel(int *pRc, Fts5Structure **ppStruct){ if( *pRc==SQLITE_OK ){ Fts5Structure *pStruct = *ppStruct; int nLevel = pStruct->nLevel; - sqlite3_int64 nByte = ( + tdsqlite3_int64 nByte = ( sizeof(Fts5Structure) + /* Main structure */ sizeof(Fts5StructureLevel) * (nLevel+1) /* aLevel[] array */ ); - pStruct = sqlite3_realloc64(pStruct, nByte); + pStruct = tdsqlite3_realloc64(pStruct, nByte); if( pStruct ){ memset(&pStruct->aLevel[nLevel], 0, sizeof(Fts5StructureLevel)); pStruct->nLevel++; @@ -219716,10 +219716,10 @@ static void fts5StructureExtendLevel( if( *pRc==SQLITE_OK ){ Fts5StructureLevel *pLvl = &pStruct->aLevel[iLvl]; Fts5StructureSegment *aNew; - sqlite3_int64 nByte; + tdsqlite3_int64 nByte; nByte = (pLvl->nSeg + nExtra) * sizeof(Fts5StructureSegment); - aNew = sqlite3_realloc64(pLvl->aSeg, nByte); + aNew = tdsqlite3_realloc64(pLvl->aSeg, nByte); if( aNew ){ if( bInsert==0 ){ memset(&aNew[pLvl->nSeg], 0, sizeof(Fts5StructureSegment) * nExtra); @@ -219747,7 +219747,7 @@ static Fts5Structure *fts5StructureReadUncached(Fts5Index *p){ memset(&pData->p[pData->nn], 0, FTS5_DATA_PADDING); p->rc = fts5StructureDecode(pData->p, pData->nn, &iCookie, &pRet); if( p->rc==SQLITE_OK && (pConfig->pgsz==0 || pConfig->iCookie!=iCookie) ){ - p->rc = sqlite3Fts5ConfigLoad(pConfig, iCookie); + p->rc = tdsqlite3Fts5ConfigLoad(pConfig, iCookie); } fts5DataRelease(pData); if( p->rc!=SQLITE_OK ){ @@ -219765,15 +219765,15 @@ static i64 fts5IndexDataVersion(Fts5Index *p){ if( p->rc==SQLITE_OK ){ if( p->pDataVersion==0 ){ p->rc = fts5IndexPrepareStmt(p, &p->pDataVersion, - sqlite3_mprintf("PRAGMA %Q.data_version", p->pConfig->zDb) + tdsqlite3_mprintf("PRAGMA %Q.data_version", p->pConfig->zDb) ); if( p->rc ) return 0; } - if( SQLITE_ROW==sqlite3_step(p->pDataVersion) ){ - iVersion = sqlite3_column_int64(p->pDataVersion, 0); + if( SQLITE_ROW==tdsqlite3_step(p->pDataVersion) ){ + iVersion = tdsqlite3_column_int64(p->pDataVersion, 0); } - p->rc = sqlite3_reset(p->pDataVersion); + p->rc = tdsqlite3_reset(p->pDataVersion); } return iVersion; @@ -219861,7 +219861,7 @@ static int fts5StructureCountSegments(Fts5Structure *pStruct){ } #define fts5BufferSafeAppendVarint(pBuf, iVal) { \ - (pBuf)->n += sqlite3Fts5PutVarint(&(pBuf)->p[(pBuf)->n], (iVal)); \ + (pBuf)->n += tdsqlite3Fts5PutVarint(&(pBuf)->p[(pBuf)->n], (iVal)); \ assert( (pBuf)->nSpace>=(pBuf)->n ); \ } @@ -219885,8 +219885,8 @@ static void fts5StructureWrite(Fts5Index *p, Fts5Structure *pStruct){ iCookie = p->pConfig->iCookie; if( iCookie<0 ) iCookie = 0; - if( 0==sqlite3Fts5BufferSize(&p->rc, &buf, 4+9+9+9) ){ - sqlite3Fts5Put32(buf.p, iCookie); + if( 0==tdsqlite3Fts5BufferSize(&p->rc, &buf, 4+9+9+9) ){ + tdsqlite3Fts5Put32(buf.p, iCookie); buf.n = 4; fts5BufferSafeAppendVarint(&buf, pStruct->nLevel); fts5BufferSafeAppendVarint(&buf, pStruct->nSegment); @@ -220218,7 +220218,7 @@ static void fts5DlidxIterFree(Fts5DlidxIter *pIter){ for(i=0; inLvl; i++){ fts5DataRelease(pIter->aLvl[i].pData); } - sqlite3_free(pIter); + tdsqlite3_free(pIter); } } @@ -220233,10 +220233,10 @@ static Fts5DlidxIter *fts5DlidxIterInit( int bDone = 0; for(i=0; p->rc==SQLITE_OK && bDone==0; i++){ - sqlite3_int64 nByte = sizeof(Fts5DlidxIter) + i * sizeof(Fts5DlidxLvl); + tdsqlite3_int64 nByte = sizeof(Fts5DlidxIter) + i * sizeof(Fts5DlidxLvl); Fts5DlidxIter *pNew; - pNew = (Fts5DlidxIter*)sqlite3_realloc64(pIter, nByte); + pNew = (Fts5DlidxIter*)tdsqlite3_realloc64(pIter, nByte); if( pNew==0 ){ p->rc = SQLITE_NOMEM; }else{ @@ -220381,7 +220381,7 @@ static void fts5SegIterLoadRowid(Fts5Index *p, Fts5SegIter *pIter){ iOff = 4; a = pIter->pLeaf->p; } - iOff += sqlite3Fts5GetVarint(&a[iOff], (u64*)&pIter->iRowid); + iOff += tdsqlite3Fts5GetVarint(&a[iOff], (u64*)&pIter->iRowid); pIter->iLeafOffset = iOff; } @@ -220533,7 +220533,7 @@ static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){ /* If necessary, grow the pIter->aRowidOffset[] array. */ if( iRowidOffset>=pIter->nRowidOffset ){ int nNew = pIter->nRowidOffset + 8; - int *aNew = (int*)sqlite3_realloc64(pIter->aRowidOffset,nNew*sizeof(int)); + int *aNew = (int*)tdsqlite3_realloc64(pIter->aRowidOffset,nNew*sizeof(int)); if( aNew==0 ){ p->rc = SQLITE_NOMEM; break; @@ -220673,7 +220673,7 @@ static void fts5SegIterNext_None( if( iOffiEndofDoclist ){ /* Next entry is on the current page */ i64 iDelta; - iOff += sqlite3Fts5GetVarint(&pIter->pLeaf->p[iOff], (u64*)&iDelta); + iOff += tdsqlite3Fts5GetVarint(&pIter->pLeaf->p[iOff], (u64*)&iDelta); pIter->iLeafOffset = iOff; pIter->iRowid += iDelta; }else if( (pIter->flags & FTS5_SEGITER_ONETERM)==0 ){ @@ -220688,14 +220688,14 @@ static void fts5SegIterNext_None( const u8 *pList = 0; const char *zTerm = 0; int nList; - sqlite3Fts5HashScanNext(p->pHash); - sqlite3Fts5HashScanEntry(p->pHash, &zTerm, &pList, &nList); + tdsqlite3Fts5HashScanNext(p->pHash); + tdsqlite3Fts5HashScanEntry(p->pHash, &zTerm, &pList, &nList); if( pList==0 ) goto next_none_eof; pIter->pLeaf->p = (u8*)pList; pIter->pLeaf->nn = nList; pIter->pLeaf->szLeaf = nList; pIter->iEndofDoclist = nList; - sqlite3Fts5BufferSet(&p->rc,&pIter->term, (int)strlen(zTerm), (u8*)zTerm); + tdsqlite3Fts5BufferSet(&p->rc,&pIter->term, (int)strlen(zTerm), (u8*)zTerm); pIter->iLeafOffset = fts5GetVarint(pList, (u64*)&pIter->iRowid); } @@ -220752,7 +220752,7 @@ static void fts5SegIterNext( } }else{ u64 iDelta; - iOff += sqlite3Fts5GetVarint(&a[iOff], &iDelta); + iOff += tdsqlite3Fts5GetVarint(&a[iOff], &iDelta); pIter->iRowid += iDelta; assert_nc( iDelta>0 ); } @@ -220764,8 +220764,8 @@ static void fts5SegIterNext( int nList = 0; assert( (pIter->flags & FTS5_SEGITER_ONETERM) || pbNewTerm ); if( 0==(pIter->flags & FTS5_SEGITER_ONETERM) ){ - sqlite3Fts5HashScanNext(p->pHash); - sqlite3Fts5HashScanEntry(p->pHash, &zTerm, &pList, &nList); + tdsqlite3Fts5HashScanNext(p->pHash); + tdsqlite3Fts5HashScanEntry(p->pHash, &zTerm, &pList, &nList); } if( pList==0 ){ fts5DataRelease(pIter->pLeaf); @@ -220775,7 +220775,7 @@ static void fts5SegIterNext( pIter->pLeaf->nn = nList; pIter->pLeaf->szLeaf = nList; pIter->iEndofDoclist = nList+1; - sqlite3Fts5BufferSet(&p->rc, &pIter->term, (int)strlen(zTerm), + tdsqlite3Fts5BufferSet(&p->rc, &pIter->term, (int)strlen(zTerm), (u8*)zTerm); pIter->iLeafOffset = fts5GetVarint(pList, (u64*)&pIter->iRowid); *pbNewTerm = 1; @@ -220789,7 +220789,7 @@ static void fts5SegIterNext( if( pLeaf==0 ) break; ASSERT_SZLEAF_OK(pLeaf); if( (iOff = fts5LeafFirstRowidOff(pLeaf)) && iOffszLeaf ){ - iOff += sqlite3Fts5GetVarint(&pLeaf->p[iOff], (u64*)&pIter->iRowid); + iOff += tdsqlite3Fts5GetVarint(&pLeaf->p[iOff], (u64*)&pIter->iRowid); pIter->iLeafOffset = iOff; if( pLeaf->nn>pLeaf->szLeaf ){ @@ -221103,10 +221103,10 @@ static void fts5LeafSeek( fts5SegIterLoadNPos(p, pIter); } -static sqlite3_stmt *fts5IdxSelectStmt(Fts5Index *p){ +static tdsqlite3_stmt *fts5IdxSelectStmt(Fts5Index *p){ if( p->pIdxSelect==0 ){ Fts5Config *pConfig = p->pConfig; - fts5IndexPrepareStmt(p, &p->pIdxSelect, sqlite3_mprintf( + fts5IndexPrepareStmt(p, &p->pIdxSelect, tdsqlite3_mprintf( "SELECT pgno FROM '%q'.'%q_idx' WHERE " "segid=? AND term<=? ORDER BY term DESC LIMIT 1", pConfig->zDb, pConfig->zName @@ -221132,7 +221132,7 @@ static void fts5SegIterSeekInit( int iPg = 1; int bGe = (flags & FTS5INDEX_QUERY_SCAN); int bDlidx = 0; /* True if there is a doclist-index */ - sqlite3_stmt *pIdxSelect = 0; + tdsqlite3_stmt *pIdxSelect = 0; assert( bGe==0 || (flags & FTS5INDEX_QUERY_DESC)==0 ); assert( pTerm && nTerm ); @@ -221143,15 +221143,15 @@ static void fts5SegIterSeekInit( ** contain term (pTerm/nTerm), if it is present in the segment. */ pIdxSelect = fts5IdxSelectStmt(p); if( p->rc ) return; - sqlite3_bind_int(pIdxSelect, 1, pSeg->iSegid); - sqlite3_bind_blob(pIdxSelect, 2, pTerm, nTerm, SQLITE_STATIC); - if( SQLITE_ROW==sqlite3_step(pIdxSelect) ){ - i64 val = sqlite3_column_int(pIdxSelect, 0); + tdsqlite3_bind_int(pIdxSelect, 1, pSeg->iSegid); + tdsqlite3_bind_blob(pIdxSelect, 2, pTerm, nTerm, SQLITE_STATIC); + if( SQLITE_ROW==tdsqlite3_step(pIdxSelect) ){ + i64 val = tdsqlite3_column_int(pIdxSelect, 0); iPg = (int)(val>>1); bDlidx = (val & 0x0001); } - p->rc = sqlite3_reset(pIdxSelect); - sqlite3_bind_null(pIdxSelect, 2); + p->rc = tdsqlite3_reset(pIdxSelect); + tdsqlite3_bind_null(pIdxSelect, 2); if( iPgpgnoFirst ){ iPg = pSeg->pgnoFirst; @@ -221222,8 +221222,8 @@ static void fts5SegIterHashInit( if( pTerm==0 || (flags & FTS5INDEX_QUERY_SCAN) ){ const u8 *pList = 0; - p->rc = sqlite3Fts5HashScanInit(p->pHash, (const char*)pTerm, nTerm); - sqlite3Fts5HashScanEntry(p->pHash, (const char**)&z, &pList, &nList); + p->rc = tdsqlite3Fts5HashScanInit(p->pHash, (const char*)pTerm, nTerm); + tdsqlite3Fts5HashScanEntry(p->pHash, (const char**)&z, &pList, &nList); n = (z ? (int)strlen((const char*)z) : 0); if( pList ){ pLeaf = fts5IdxMalloc(p, sizeof(Fts5Data)); @@ -221232,7 +221232,7 @@ static void fts5SegIterHashInit( } } }else{ - p->rc = sqlite3Fts5HashQuery(p->pHash, sizeof(Fts5Data), + p->rc = tdsqlite3Fts5HashQuery(p->pHash, sizeof(Fts5Data), (const char*)pTerm, nTerm, (void**)&pLeaf, &nList ); if( pLeaf ){ @@ -221244,7 +221244,7 @@ static void fts5SegIterHashInit( } if( pLeaf ){ - sqlite3Fts5BufferSet(&p->rc, &pIter->term, n, z); + tdsqlite3Fts5BufferSet(&p->rc, &pIter->term, n, z); pLeaf->nn = pLeaf->szLeaf = nList; pIter->pLeaf = pLeaf; pIter->iLeafOffset = fts5GetVarint(pLeaf->p, (u64*)&pIter->iRowid); @@ -221269,7 +221269,7 @@ static void fts5SegIterClear(Fts5SegIter *pIter){ fts5DataRelease(pIter->pLeaf); fts5DataRelease(pIter->pNextLeaf); fts5DlidxIterFree(pIter->pDlidx); - sqlite3_free(pIter->aRowidOffset); + tdsqlite3_free(pIter->aRowidOffset); memset(pIter, 0, sizeof(Fts5SegIter)); } @@ -221521,7 +221521,7 @@ static void fts5MultiIterFree(Fts5Iter *pIter){ fts5SegIterClear(&pIter->aSeg[i]); } fts5BufferFree(&pIter->poslist); - sqlite3_free(pIter); + tdsqlite3_free(pIter); } } @@ -222114,7 +222114,7 @@ static void fts5IterSetOutputCb(int *pRc, Fts5Iter *pIter){ assert( pConfig->eDetail==FTS5_DETAIL_COLUMNS ); if( pConfig->nCol<=100 ){ pIter->xSetOutputs = fts5IterSetOutputs_Col100; - sqlite3Fts5BufferSize(pRc, &pIter->poslist, pConfig->nCol); + tdsqlite3Fts5BufferSize(pRc, &pIter->poslist, pConfig->nCol); }else{ pIter->xSetOutputs = fts5IterSetOutputs_Col; } @@ -222364,14 +222364,14 @@ static int fts5AllocateSegid(Fts5Index *p, Fts5Structure *pStruct){ assert_nc( iSegid>0 && iSegid<=FTS5_MAX_SEGMENT ); { - sqlite3_stmt *pIdxSelect = fts5IdxSelectStmt(p); + tdsqlite3_stmt *pIdxSelect = fts5IdxSelectStmt(p); if( p->rc==SQLITE_OK ){ u8 aBlob[2] = {0xff, 0xff}; - sqlite3_bind_int(pIdxSelect, 1, iSegid); - sqlite3_bind_blob(pIdxSelect, 2, aBlob, 2, SQLITE_STATIC); - assert_nc( sqlite3_step(pIdxSelect)!=SQLITE_ROW ); - p->rc = sqlite3_reset(pIdxSelect); - sqlite3_bind_null(pIdxSelect, 2); + tdsqlite3_bind_int(pIdxSelect, 1, iSegid); + tdsqlite3_bind_blob(pIdxSelect, 2, aBlob, 2, SQLITE_STATIC); + assert_nc( tdsqlite3_step(pIdxSelect)!=SQLITE_ROW ); + p->rc = tdsqlite3_reset(pIdxSelect); + tdsqlite3_bind_null(pIdxSelect, 2); } } #endif @@ -222387,7 +222387,7 @@ static int fts5AllocateSegid(Fts5Index *p, Fts5Structure *pStruct){ static void fts5IndexDiscardData(Fts5Index *p){ assert( p->pHash || p->nPendingData==0 ); if( p->pHash ){ - sqlite3Fts5HashClear(p->pHash); + tdsqlite3Fts5HashClear(p->pHash); p->nPendingData = 0; } } @@ -222424,7 +222424,7 @@ static void fts5WriteDlidxClear( pDlidx->buf.p, pDlidx->buf.n ); } - sqlite3Fts5BufferZero(&pDlidx->buf); + tdsqlite3Fts5BufferZero(&pDlidx->buf); pDlidx->bPrevValid = 0; } } @@ -222439,7 +222439,7 @@ static int fts5WriteDlidxGrow( int nLvl ){ if( p->rc==SQLITE_OK && nLvl>=pWriter->nDlidx ){ - Fts5DlidxWriter *aDlidx = (Fts5DlidxWriter*)sqlite3_realloc64( + Fts5DlidxWriter *aDlidx = (Fts5DlidxWriter*)tdsqlite3_realloc64( pWriter->aDlidx, sizeof(Fts5DlidxWriter) * nLvl ); if( aDlidx==0 ){ @@ -222493,12 +222493,12 @@ static void fts5WriteFlushBtree(Fts5Index *p, Fts5SegWriter *pWriter){ if( p->rc==SQLITE_OK ){ const char *z = (pWriter->btterm.n>0?(const char*)pWriter->btterm.p:""); /* The following was already done in fts5WriteInit(): */ - /* sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); */ - sqlite3_bind_blob(p->pIdxWriter, 2, z, pWriter->btterm.n, SQLITE_STATIC); - sqlite3_bind_int64(p->pIdxWriter, 3, bFlag + ((i64)pWriter->iBtPage<<1)); - sqlite3_step(p->pIdxWriter); - p->rc = sqlite3_reset(p->pIdxWriter); - sqlite3_bind_null(p->pIdxWriter, 2); + /* tdsqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); */ + tdsqlite3_bind_blob(p->pIdxWriter, 2, z, pWriter->btterm.n, SQLITE_STATIC); + tdsqlite3_bind_int64(p->pIdxWriter, 3, bFlag + ((i64)pWriter->iBtPage<<1)); + tdsqlite3_step(p->pIdxWriter); + p->rc = tdsqlite3_reset(p->pIdxWriter); + tdsqlite3_bind_null(p->pIdxWriter, 2); } pWriter->iBtPage = 0; } @@ -222537,7 +222537,7 @@ static void fts5WriteBtreeNoTerm( if( pWriter->bFirstRowidInPage && pWriter->aDlidx[0].buf.n>0 ){ Fts5DlidxWriter *pDlidx = &pWriter->aDlidx[0]; assert( pDlidx->bPrevValid ); - sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, 0); + tdsqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, 0); } /* Increment the "number of sequential leaves without a term" counter. */ @@ -222588,14 +222588,14 @@ static void fts5WriteDlidxAppend( /* This was the root node. Push its first rowid up to the new root. */ pDlidx[1].pgno = pDlidx->pgno; - sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx[1].buf, 0); - sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx[1].buf, pDlidx->pgno); - sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx[1].buf, iFirst); + tdsqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx[1].buf, 0); + tdsqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx[1].buf, pDlidx->pgno); + tdsqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx[1].buf, iFirst); pDlidx[1].bPrevValid = 1; pDlidx[1].iPrev = iFirst; } - sqlite3Fts5BufferZero(&pDlidx->buf); + tdsqlite3Fts5BufferZero(&pDlidx->buf); pDlidx->bPrevValid = 0; pDlidx->pgno++; }else{ @@ -222607,12 +222607,12 @@ static void fts5WriteDlidxAppend( }else{ i64 iPgno = (i==0 ? pWriter->writer.pgno : pDlidx[-1].pgno); assert( pDlidx->buf.n==0 ); - sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, !bDone); - sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, iPgno); + tdsqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, !bDone); + tdsqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, iPgno); iVal = iRowid; } - sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, iVal); + tdsqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, iVal); pDlidx->bPrevValid = 1; pDlidx->iPrev = iRowid; } @@ -222688,7 +222688,7 @@ static void fts5WriteAppendTerm( } /* TODO1: Updating pgidx here. */ - pPgidx->n += sqlite3Fts5PutVarint( + pPgidx->n += tdsqlite3Fts5PutVarint( &pPgidx->p[pPgidx->n], pPage->buf.n - pPage->iPrevPgidx ); pPage->iPrevPgidx = pPage->buf.n; @@ -222835,9 +222835,9 @@ static void fts5WriteFinish( fts5BufferFree(&pWriter->btterm); for(i=0; inDlidx; i++){ - sqlite3Fts5BufferFree(&pWriter->aDlidx[i].buf); + tdsqlite3Fts5BufferFree(&pWriter->aDlidx[i].buf); } - sqlite3_free(pWriter->aDlidx); + tdsqlite3_free(pWriter->aDlidx); } static void fts5WriteInit( @@ -222859,12 +222859,12 @@ static void fts5WriteInit( assert( pWriter->writer.pgidx.n==0 ); /* Grow the two buffers to pgsz + padding bytes in size. */ - sqlite3Fts5BufferSize(&p->rc, &pWriter->writer.pgidx, nBuffer); - sqlite3Fts5BufferSize(&p->rc, &pWriter->writer.buf, nBuffer); + tdsqlite3Fts5BufferSize(&p->rc, &pWriter->writer.pgidx, nBuffer); + tdsqlite3Fts5BufferSize(&p->rc, &pWriter->writer.buf, nBuffer); if( p->pIdxWriter==0 ){ Fts5Config *pConfig = p->pConfig; - fts5IndexPrepareStmt(p, &p->pIdxWriter, sqlite3_mprintf( + fts5IndexPrepareStmt(p, &p->pIdxWriter, tdsqlite3_mprintf( "INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)", pConfig->zDb, pConfig->zName )); @@ -222878,7 +222878,7 @@ static void fts5WriteInit( /* Bind the current output segment id to the index-writer. This is an ** optimization over binding the same value over and over as rows are ** inserted into %_idx by the current writer. */ - sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); + tdsqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); } } @@ -223283,15 +223283,15 @@ static void fts5FlushOneHash(Fts5Index *p){ /* Begin scanning through hash table entries. This loop runs once for each ** term/doclist currently stored within the hash table. */ if( p->rc==SQLITE_OK ){ - p->rc = sqlite3Fts5HashScanInit(pHash, 0, 0); + p->rc = tdsqlite3Fts5HashScanInit(pHash, 0, 0); } - while( p->rc==SQLITE_OK && 0==sqlite3Fts5HashScanEof(pHash) ){ + while( p->rc==SQLITE_OK && 0==tdsqlite3Fts5HashScanEof(pHash) ){ const char *zTerm; /* Buffer containing term */ const u8 *pDoclist; /* Pointer to doclist for this term */ int nDoclist; /* Size of doclist in bytes */ /* Write the term for this entry to disk. */ - sqlite3Fts5HashScanEntry(pHash, &zTerm, &pDoclist, &nDoclist); + tdsqlite3Fts5HashScanEntry(pHash, &zTerm, &pDoclist, &nDoclist); fts5WriteAppendTerm(p, &writer, (int)strlen(zTerm), (const u8*)zTerm); if( p->rc!=SQLITE_OK ) break; @@ -223313,12 +223313,12 @@ static void fts5FlushOneHash(Fts5Index *p){ if( writer.bFirstRowidInPage ){ fts5PutU16(&pBuf->p[0], (u16)pBuf->n); /* first rowid on page */ - pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid); + pBuf->n += tdsqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid); writer.bFirstRowidInPage = 0; fts5WriteDlidxAppend(p, &writer, iRowid); if( p->rc!=SQLITE_OK ) break; }else{ - pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iDelta); + pBuf->n += tdsqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iDelta); } assert( pBuf->n<=pBuf->nSpace ); @@ -223374,9 +223374,9 @@ static void fts5FlushOneHash(Fts5Index *p){ /* TODO2: Doclist terminator written here. */ /* pBuf->p[pBuf->n++] = '\0'; */ assert( pBuf->n<=pBuf->nSpace ); - if( p->rc==SQLITE_OK ) sqlite3Fts5HashScanNext(pHash); + if( p->rc==SQLITE_OK ) tdsqlite3Fts5HashScanNext(pHash); } - sqlite3Fts5HashClear(pHash); + tdsqlite3Fts5HashClear(pHash); fts5WriteFinish(p, &writer, &pgnoLast); /* Update the Fts5Structure. It is written back to the database by the @@ -223418,7 +223418,7 @@ static Fts5Structure *fts5IndexOptimizeStruct( Fts5Structure *pStruct ){ Fts5Structure *pNew = 0; - sqlite3_int64 nByte = sizeof(Fts5Structure); + tdsqlite3_int64 nByte = sizeof(Fts5Structure); int nSeg = pStruct->nSegment; int i; @@ -223443,7 +223443,7 @@ static Fts5Structure *fts5IndexOptimizeStruct( } nByte += (pStruct->nLevel+1) * sizeof(Fts5StructureLevel); - pNew = (Fts5Structure*)sqlite3Fts5MallocZero(&p->rc, nByte); + pNew = (Fts5Structure*)tdsqlite3Fts5MallocZero(&p->rc, nByte); if( pNew ){ Fts5StructureLevel *pLvl; @@ -223452,7 +223452,7 @@ static Fts5Structure *fts5IndexOptimizeStruct( pNew->nRef = 1; pNew->nWriteCounter = pStruct->nWriteCounter; pLvl = &pNew->aLevel[pStruct->nLevel]; - pLvl->aSeg = (Fts5StructureSegment*)sqlite3Fts5MallocZero(&p->rc, nByte); + pLvl->aSeg = (Fts5StructureSegment*)tdsqlite3Fts5MallocZero(&p->rc, nByte); if( pLvl->aSeg ){ int iLvl, iSeg; int iSegOut = 0; @@ -223467,7 +223467,7 @@ static Fts5Structure *fts5IndexOptimizeStruct( } pNew->nSegment = pLvl->nSeg = nSeg; }else{ - sqlite3_free(pNew); + tdsqlite3_free(pNew); pNew = 0; } } @@ -223475,7 +223475,7 @@ static Fts5Structure *fts5IndexOptimizeStruct( return pNew; } -static int sqlite3Fts5IndexOptimize(Fts5Index *p){ +static int tdsqlite3Fts5IndexOptimize(Fts5Index *p){ Fts5Structure *pStruct; Fts5Structure *pNew = 0; @@ -223509,7 +223509,7 @@ static int sqlite3Fts5IndexOptimize(Fts5Index *p){ ** This is called to implement the special "VALUES('merge', $nMerge)" ** INSERT command. */ -static int sqlite3Fts5IndexMerge(Fts5Index *p, int nMerge){ +static int tdsqlite3Fts5IndexMerge(Fts5Index *p, int nMerge){ Fts5Structure *pStruct = fts5StructureRead(p); if( pStruct ){ int nMin = p->pConfig->nUsermerge; @@ -223634,7 +223634,7 @@ static void fts5NextRowid(Fts5Buffer *pBuf, int *piOff, i64 *piRowid){ *piOff = -1; }else{ u64 iVal; - *piOff = i + sqlite3Fts5GetVarint(&pBuf->p[i], &iVal); + *piOff = i + tdsqlite3Fts5GetVarint(&pBuf->p[i], &iVal); *piRowid += iVal; } } @@ -223656,7 +223656,7 @@ static void fts5MergeRowidLists( Fts5Buffer out; memset(&out, 0, sizeof(out)); - sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n); + tdsqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n); if( p->rc ) return; fts5NextRowid(p1, &i1, &iRowid1); @@ -223714,7 +223714,7 @@ static void fts5MergePrefixLists( ** (the value PoslistNext64() uses for EOF) as a position and appending ** it to the output. This can happen at most once for each input ** position-list, hence two 10 byte paddings. */ - if( sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n + 9+10+10) ) return; + if( tdsqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n + 9+10+10) ) return; fts5DoclistIterInit(p1, &i1); fts5DoclistIterInit(p2, &i2); @@ -223755,32 +223755,32 @@ static void fts5MergePrefixLists( ** at most 20 bytes of unexpected space. */ fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid); fts5BufferZero(&tmp); - sqlite3Fts5BufferSize(&p->rc, &tmp, i1.nPoslist + i2.nPoslist + 10 + 10); + tdsqlite3Fts5BufferSize(&p->rc, &tmp, i1.nPoslist + i2.nPoslist + 10 + 10); if( p->rc ) break; - sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1); - sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2); + tdsqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1); + tdsqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2); assert_nc( iPos1>=0 && iPos2>=0 ); if( iPos1=0 && iPos2>=0 ){ while( 1 ){ if( iPos1=0 ){ if( iPos1!=iPrev ){ - sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1); + tdsqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1); } aCopy = &a1[iOff1]; nCopy = i1.nPoslist - iOff1; }else{ assert_nc( iPos2>=0 && iPos2!=iPrev ); - sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2); + tdsqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2); aCopy = &a2[iOff2]; nCopy = i2.nPoslist - iOff2; } @@ -223927,20 +223927,20 @@ static void fts5SetupPrefixIter( } fts5StructureRelease(pStruct); - sqlite3_free(aBuf); + tdsqlite3_free(aBuf); } /* -** Indicate that all subsequent calls to sqlite3Fts5IndexWrite() pertain +** Indicate that all subsequent calls to tdsqlite3Fts5IndexWrite() pertain ** to the document with rowid iRowid. */ -static int sqlite3Fts5IndexBeginWrite(Fts5Index *p, int bDelete, i64 iRowid){ +static int tdsqlite3Fts5IndexBeginWrite(Fts5Index *p, int bDelete, i64 iRowid){ assert( p->rc==SQLITE_OK ); /* Allocate the hash table if it has not already been allocated */ if( p->pHash==0 ){ - p->rc = sqlite3Fts5HashNew(p->pConfig, &p->pHash, &p->nPendingData); + p->rc = tdsqlite3Fts5HashNew(p->pConfig, &p->pHash, &p->nPendingData); } /* Flush the hash table to disk if required */ @@ -223959,10 +223959,10 @@ static int sqlite3Fts5IndexBeginWrite(Fts5Index *p, int bDelete, i64 iRowid){ /* ** Commit data to disk. */ -static int sqlite3Fts5IndexSync(Fts5Index *p){ +static int tdsqlite3Fts5IndexSync(Fts5Index *p){ assert( p->rc==SQLITE_OK ); fts5IndexFlush(p); - sqlite3Fts5IndexCloseReader(p); + tdsqlite3Fts5IndexCloseReader(p); return fts5IndexReturn(p); } @@ -223972,8 +223972,8 @@ static int sqlite3Fts5IndexSync(Fts5Index *p){ ** table may have changed on disk. So any in-memory caches of %_data ** records must be invalidated. */ -static int sqlite3Fts5IndexRollback(Fts5Index *p){ - sqlite3Fts5IndexCloseReader(p); +static int tdsqlite3Fts5IndexRollback(Fts5Index *p){ + tdsqlite3Fts5IndexCloseReader(p); fts5IndexDiscardData(p); fts5StructureInvalidate(p); /* assert( p->rc==SQLITE_OK ); */ @@ -223985,7 +223985,7 @@ static int sqlite3Fts5IndexRollback(Fts5Index *p){ ** function populates it with the initial structure objects for each index, ** and the initial version of the "averages" record (a zero-byte blob). */ -static int sqlite3Fts5IndexReinit(Fts5Index *p){ +static int tdsqlite3Fts5IndexReinit(Fts5Index *p){ Fts5Structure s; fts5StructureInvalidate(p); fts5IndexDiscardData(p); @@ -224002,7 +224002,7 @@ static int sqlite3Fts5IndexReinit(Fts5Index *p){ ** If successful, set *pp to point to the new object and return SQLITE_OK. ** Otherwise, set *pp to NULL and return an SQLite error code. */ -static int sqlite3Fts5IndexOpen( +static int tdsqlite3Fts5IndexOpen( Fts5Config *pConfig, int bCreate, Fts5Index **pp, @@ -224011,52 +224011,52 @@ static int sqlite3Fts5IndexOpen( int rc = SQLITE_OK; Fts5Index *p; /* New object */ - *pp = p = (Fts5Index*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Index)); + *pp = p = (Fts5Index*)tdsqlite3Fts5MallocZero(&rc, sizeof(Fts5Index)); if( rc==SQLITE_OK ){ p->pConfig = pConfig; p->nWorkUnit = FTS5_WORK_UNIT; - p->zDataTbl = sqlite3Fts5Mprintf(&rc, "%s_data", pConfig->zName); + p->zDataTbl = tdsqlite3Fts5Mprintf(&rc, "%s_data", pConfig->zName); if( p->zDataTbl && bCreate ){ - rc = sqlite3Fts5CreateTable( + rc = tdsqlite3Fts5CreateTable( pConfig, "data", "id INTEGER PRIMARY KEY, block BLOB", 0, pzErr ); if( rc==SQLITE_OK ){ - rc = sqlite3Fts5CreateTable(pConfig, "idx", + rc = tdsqlite3Fts5CreateTable(pConfig, "idx", "segid, term, pgno, PRIMARY KEY(segid, term)", 1, pzErr ); } if( rc==SQLITE_OK ){ - rc = sqlite3Fts5IndexReinit(p); + rc = tdsqlite3Fts5IndexReinit(p); } } } assert( rc!=SQLITE_OK || p->rc==SQLITE_OK ); if( rc ){ - sqlite3Fts5IndexClose(p); + tdsqlite3Fts5IndexClose(p); *pp = 0; } return rc; } /* -** Close a handle opened by an earlier call to sqlite3Fts5IndexOpen(). +** Close a handle opened by an earlier call to tdsqlite3Fts5IndexOpen(). */ -static int sqlite3Fts5IndexClose(Fts5Index *p){ +static int tdsqlite3Fts5IndexClose(Fts5Index *p){ int rc = SQLITE_OK; if( p ){ assert( p->pReader==0 ); fts5StructureInvalidate(p); - sqlite3_finalize(p->pWriter); - sqlite3_finalize(p->pDeleter); - sqlite3_finalize(p->pIdxWriter); - sqlite3_finalize(p->pIdxDeleter); - sqlite3_finalize(p->pIdxSelect); - sqlite3_finalize(p->pDataVersion); - sqlite3Fts5HashFree(p->pHash); - sqlite3_free(p->zDataTbl); - sqlite3_free(p); + tdsqlite3_finalize(p->pWriter); + tdsqlite3_finalize(p->pDeleter); + tdsqlite3_finalize(p->pIdxWriter); + tdsqlite3_finalize(p->pIdxDeleter); + tdsqlite3_finalize(p->pIdxSelect); + tdsqlite3_finalize(p->pDataVersion); + tdsqlite3Fts5HashFree(p->pHash); + tdsqlite3_free(p->zDataTbl); + tdsqlite3_free(p); } return rc; } @@ -224066,7 +224066,7 @@ static int sqlite3Fts5IndexClose(Fts5Index *p){ ** size. Return the number of bytes in the nChar character prefix of the ** buffer, or 0 if there are less than nChar characters in total. */ -static int sqlite3Fts5IndexCharlenToBytelen( +static int tdsqlite3Fts5IndexCharlenToBytelen( const char *p, int nByte, int nChar @@ -224115,7 +224115,7 @@ static int fts5IndexCharlen(const char *pIn, int nIn){ ** unique token in the document with an iCol value less than zero. The iPos ** argument is ignored for a delete. */ -static int sqlite3Fts5IndexWrite( +static int tdsqlite3Fts5IndexWrite( Fts5Index *p, /* Index to write to */ int iCol, /* Column token appears in (-ve -> delete) */ int iPos, /* Position of token within column */ @@ -224129,15 +224129,15 @@ static int sqlite3Fts5IndexWrite( assert( (iCol<0)==p->bDelete ); /* Add the entry to the main terms index. */ - rc = sqlite3Fts5HashWrite( + rc = tdsqlite3Fts5HashWrite( p->pHash, p->iWriteRowid, iCol, iPos, FTS5_MAIN_PREFIX, pToken, nToken ); for(i=0; inPrefix && rc==SQLITE_OK; i++){ const int nChar = pConfig->aPrefix[i]; - int nByte = sqlite3Fts5IndexCharlenToBytelen(pToken, nToken, nChar); + int nByte = tdsqlite3Fts5IndexCharlenToBytelen(pToken, nToken, nChar); if( nByte ){ - rc = sqlite3Fts5HashWrite(p->pHash, + rc = tdsqlite3Fts5HashWrite(p->pHash, p->iWriteRowid, iCol, iPos, (char)(FTS5_MAIN_PREFIX+i+1), pToken, nByte ); @@ -224151,7 +224151,7 @@ static int sqlite3Fts5IndexWrite( ** Open a new iterator to iterate though all rowid that match the ** specified token or token prefix. */ -static int sqlite3Fts5IndexQuery( +static int tdsqlite3Fts5IndexQuery( Fts5Index *p, /* FTS index to query */ const char *pToken, int nToken, /* Token (or prefix) to query for */ int flags, /* Mask of FTS5INDEX_QUERY_X flags */ @@ -224165,7 +224165,7 @@ static int sqlite3Fts5IndexQuery( /* If the QUERY_SCAN flag is set, all other flags must be clear. */ assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN ); - if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){ + if( tdsqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){ int iIdx = 0; /* Index to search */ if( nToken ) memcpy(&buf.p[1], pToken, nToken); @@ -224216,13 +224216,13 @@ static int sqlite3Fts5IndexQuery( } if( p->rc ){ - sqlite3Fts5IterClose((Fts5IndexIter*)pRet); + tdsqlite3Fts5IterClose((Fts5IndexIter*)pRet); pRet = 0; - sqlite3Fts5IndexCloseReader(p); + tdsqlite3Fts5IndexCloseReader(p); } *ppIter = (Fts5IndexIter*)pRet; - sqlite3Fts5BufferFree(&buf); + tdsqlite3Fts5BufferFree(&buf); } return fts5IndexReturn(p); } @@ -224233,7 +224233,7 @@ static int sqlite3Fts5IndexQuery( /* ** Move to the next matching rowid. */ -static int sqlite3Fts5IterNext(Fts5IndexIter *pIndexIter){ +static int tdsqlite3Fts5IterNext(Fts5IndexIter *pIndexIter){ Fts5Iter *pIter = (Fts5Iter*)pIndexIter; assert( pIter->pIndex->rc==SQLITE_OK ); fts5MultiIterNext(pIter->pIndex, pIter, 0, 0); @@ -224243,7 +224243,7 @@ static int sqlite3Fts5IterNext(Fts5IndexIter *pIndexIter){ /* ** Move to the next matching term/rowid. Used by the fts5vocab module. */ -static int sqlite3Fts5IterNextScan(Fts5IndexIter *pIndexIter){ +static int tdsqlite3Fts5IterNextScan(Fts5IndexIter *pIndexIter){ Fts5Iter *pIter = (Fts5Iter*)pIndexIter; Fts5Index *p = pIter->pIndex; @@ -224267,7 +224267,7 @@ static int sqlite3Fts5IterNextScan(Fts5IndexIter *pIndexIter){ ** definition of "at or after" depends on whether this iterator iterates ** in ascending or descending rowid order. */ -static int sqlite3Fts5IterNextFrom(Fts5IndexIter *pIndexIter, i64 iMatch){ +static int tdsqlite3Fts5IterNextFrom(Fts5IndexIter *pIndexIter, i64 iMatch){ Fts5Iter *pIter = (Fts5Iter*)pIndexIter; fts5MultiIterNextFrom(pIter->pIndex, pIter, iMatch); return fts5IndexReturn(pIter->pIndex); @@ -224276,7 +224276,7 @@ static int sqlite3Fts5IterNextFrom(Fts5IndexIter *pIndexIter, i64 iMatch){ /* ** Return the current term. */ -static const char *sqlite3Fts5IterTerm(Fts5IndexIter *pIndexIter, int *pn){ +static const char *tdsqlite3Fts5IterTerm(Fts5IndexIter *pIndexIter, int *pn){ int n; const char *z = (const char*)fts5MultiIterTerm((Fts5Iter*)pIndexIter, &n); *pn = n-1; @@ -224284,14 +224284,14 @@ static const char *sqlite3Fts5IterTerm(Fts5IndexIter *pIndexIter, int *pn){ } /* -** Close an iterator opened by an earlier call to sqlite3Fts5IndexQuery(). +** Close an iterator opened by an earlier call to tdsqlite3Fts5IndexQuery(). */ -static void sqlite3Fts5IterClose(Fts5IndexIter *pIndexIter){ +static void tdsqlite3Fts5IterClose(Fts5IndexIter *pIndexIter){ if( pIndexIter ){ Fts5Iter *pIter = (Fts5Iter*)pIndexIter; Fts5Index *pIndex = pIter->pIndex; fts5MultiIterFree(pIter); - sqlite3Fts5IndexCloseReader(pIndex); + tdsqlite3Fts5IndexCloseReader(pIndex); } } @@ -224301,7 +224301,7 @@ static void sqlite3Fts5IterClose(Fts5IndexIter *pIndexIter){ ** Parameter anSize must point to an array of size nCol, where nCol is ** the number of user defined columns in the FTS table. */ -static int sqlite3Fts5IndexGetAverages(Fts5Index *p, i64 *pnRow, i64 *anSize){ +static int tdsqlite3Fts5IndexGetAverages(Fts5Index *p, i64 *pnRow, i64 *anSize){ int nCol = p->pConfig->nCol; Fts5Data *pData; @@ -224325,7 +224325,7 @@ static int sqlite3Fts5IndexGetAverages(Fts5Index *p, i64 *pnRow, i64 *anSize){ ** Replace the current "averages" record with the contents of the buffer ** supplied as the second argument. */ -static int sqlite3Fts5IndexSetAverages(Fts5Index *p, const u8 *pData, int nData){ +static int tdsqlite3Fts5IndexSetAverages(Fts5Index *p, const u8 *pData, int nData){ assert( p->rc==SQLITE_OK ); fts5DataWrite(p, FTS5_AVERAGES_ROWID, pData, nData); return fts5IndexReturn(p); @@ -224335,7 +224335,7 @@ static int sqlite3Fts5IndexSetAverages(Fts5Index *p, const u8 *pData, int nData) ** Return the total number of blocks this module has read from the %_data ** table since it was created. */ -static int sqlite3Fts5IndexReads(Fts5Index *p){ +static int tdsqlite3Fts5IndexReads(Fts5Index *p){ return p->nRead; } @@ -224346,27 +224346,27 @@ static int sqlite3Fts5IndexReads(Fts5Index *p){ ** Return SQLITE_OK if successful, or an SQLite error code if an error ** occurs. */ -static int sqlite3Fts5IndexSetCookie(Fts5Index *p, int iNew){ +static int tdsqlite3Fts5IndexSetCookie(Fts5Index *p, int iNew){ int rc; /* Return code */ Fts5Config *pConfig = p->pConfig; /* Configuration object */ u8 aCookie[4]; /* Binary representation of iNew */ - sqlite3_blob *pBlob = 0; + tdsqlite3_blob *pBlob = 0; assert( p->rc==SQLITE_OK ); - sqlite3Fts5Put32(aCookie, iNew); + tdsqlite3Fts5Put32(aCookie, iNew); - rc = sqlite3_blob_open(pConfig->db, pConfig->zDb, p->zDataTbl, + rc = tdsqlite3_blob_open(pConfig->db, pConfig->zDb, p->zDataTbl, "block", FTS5_STRUCTURE_ROWID, 1, &pBlob ); if( rc==SQLITE_OK ){ - sqlite3_blob_write(pBlob, aCookie, 4, 0); - rc = sqlite3_blob_close(pBlob); + tdsqlite3_blob_write(pBlob, aCookie, 4, 0); + rc = tdsqlite3_blob_close(pBlob); } return rc; } -static int sqlite3Fts5IndexLoadConfig(Fts5Index *p){ +static int tdsqlite3Fts5IndexLoadConfig(Fts5Index *p){ Fts5Structure *pStruct; pStruct = fts5StructureRead(p); fts5StructureRelease(pStruct); @@ -224383,7 +224383,7 @@ static int sqlite3Fts5IndexLoadConfig(Fts5Index *p){ /* ** Return a simple checksum value based on the arguments. */ -static u64 sqlite3Fts5IndexEntryCksum( +static u64 tdsqlite3Fts5IndexEntryCksum( i64 iRowid, int iCol, int iPos, @@ -224456,29 +224456,29 @@ static int fts5QueryCksum( int eDetail = p->pConfig->eDetail; u64 cksum = *pCksum; Fts5IndexIter *pIter = 0; - int rc = sqlite3Fts5IndexQuery(p, z, n, flags, 0, &pIter); + int rc = tdsqlite3Fts5IndexQuery(p, z, n, flags, 0, &pIter); - while( rc==SQLITE_OK && 0==sqlite3Fts5IterEof(pIter) ){ + while( rc==SQLITE_OK && 0==tdsqlite3Fts5IterEof(pIter) ){ i64 rowid = pIter->iRowid; if( eDetail==FTS5_DETAIL_NONE ){ - cksum ^= sqlite3Fts5IndexEntryCksum(rowid, 0, 0, iIdx, z, n); + cksum ^= tdsqlite3Fts5IndexEntryCksum(rowid, 0, 0, iIdx, z, n); }else{ Fts5PoslistReader sReader; - for(sqlite3Fts5PoslistReaderInit(pIter->pData, pIter->nData, &sReader); + for(tdsqlite3Fts5PoslistReaderInit(pIter->pData, pIter->nData, &sReader); sReader.bEof==0; - sqlite3Fts5PoslistReaderNext(&sReader) + tdsqlite3Fts5PoslistReaderNext(&sReader) ){ int iCol = FTS5_POS2COLUMN(sReader.iPos); int iOff = FTS5_POS2OFFSET(sReader.iPos); - cksum ^= sqlite3Fts5IndexEntryCksum(rowid, iCol, iOff, iIdx, z, n); + cksum ^= tdsqlite3Fts5IndexEntryCksum(rowid, iCol, iOff, iIdx, z, n); } } if( rc==SQLITE_OK ){ - rc = sqlite3Fts5IterNext(pIter); + rc = tdsqlite3Fts5IterNext(pIter); } } - sqlite3Fts5IterClose(pIter); + tdsqlite3Fts5IterClose(pIter); *pCksum = cksum; return rc; @@ -224677,28 +224677,28 @@ static void fts5IndexIntegrityCheckSegment( Fts5StructureSegment *pSeg /* Segment to check internal consistency */ ){ Fts5Config *pConfig = p->pConfig; - sqlite3_stmt *pStmt = 0; + tdsqlite3_stmt *pStmt = 0; int rc2; int iIdxPrevLeaf = pSeg->pgnoFirst-1; int iDlidxPrevLeaf = pSeg->pgnoLast; if( pSeg->pgnoFirst==0 ) return; - fts5IndexPrepareStmt(p, &pStmt, sqlite3_mprintf( + fts5IndexPrepareStmt(p, &pStmt, tdsqlite3_mprintf( "SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d " "ORDER BY 1, 2", pConfig->zDb, pConfig->zName, pSeg->iSegid )); /* Iterate through the b-tree hierarchy. */ - while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ + while( p->rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pStmt) ){ i64 iRow; /* Rowid for this leaf */ Fts5Data *pLeaf; /* Data for this leaf */ - const char *zIdxTerm = (const char*)sqlite3_column_blob(pStmt, 1); - int nIdxTerm = sqlite3_column_bytes(pStmt, 1); - int iIdxLeaf = sqlite3_column_int(pStmt, 2); - int bIdxDlidx = sqlite3_column_int(pStmt, 3); + const char *zIdxTerm = (const char*)tdsqlite3_column_blob(pStmt, 1); + int nIdxTerm = tdsqlite3_column_bytes(pStmt, 1); + int iIdxLeaf = tdsqlite3_column_int(pStmt, 2); + int bIdxDlidx = tdsqlite3_column_int(pStmt, 3); /* If the leaf in question has already been trimmed from the segment, ** ignore this b-tree entry. Otherwise, load it into memory. */ @@ -224795,7 +224795,7 @@ static void fts5IndexIntegrityCheckSegment( iIdxPrevLeaf = iIdxLeaf; } - rc2 = sqlite3_finalize(pStmt); + rc2 = tdsqlite3_finalize(pStmt); if( p->rc==SQLITE_OK ) p->rc = rc2; /* Page iter.iLeaf must now be the rightmost leaf-page in the segment */ @@ -224810,14 +224810,14 @@ static void fts5IndexIntegrityCheckSegment( /* ** Run internal checks to ensure that the FTS index (a) is internally ** consistent and (b) contains entries for which the XOR of the checksums -** as calculated by sqlite3Fts5IndexEntryCksum() is cksum. +** as calculated by tdsqlite3Fts5IndexEntryCksum() is cksum. ** ** Return SQLITE_CORRUPT if any of the internal checks fail, or if the ** checksum does not match. Return SQLITE_OK if all checks pass without ** error, or some other SQLite error code if another error (e.g. OOM) ** occurs. */ -static int sqlite3Fts5IndexIntegrityCheck(Fts5Index *p, u64 cksum){ +static int tdsqlite3Fts5IndexIntegrityCheck(Fts5Index *p, u64 cksum){ int eDetail = p->pConfig->eDetail; u64 cksum2 = 0; /* Checksum based on contents of indexes */ Fts5Buffer poslist = {0,0,0}; /* Buffer used to hold a poslist */ @@ -224873,15 +224873,15 @@ static int sqlite3Fts5IndexIntegrityCheck(Fts5Index *p, u64 cksum){ if( eDetail==FTS5_DETAIL_NONE ){ if( 0==fts5MultiIterIsEmpty(p, pIter) ){ - cksum2 ^= sqlite3Fts5IndexEntryCksum(iRowid, 0, 0, -1, z, n); + cksum2 ^= tdsqlite3Fts5IndexEntryCksum(iRowid, 0, 0, -1, z, n); } }else{ poslist.n = 0; fts5SegiterPoslist(p, &pIter->aSeg[pIter->aFirst[1].iFirst], 0, &poslist); - while( 0==sqlite3Fts5PoslistNext64(poslist.p, poslist.n, &iOff, &iPos) ){ + while( 0==tdsqlite3Fts5PoslistNext64(poslist.p, poslist.n, &iOff, &iPos) ){ int iCol = FTS5_POS2COLUMN(iPos); int iTokOff = FTS5_POS2OFFSET(iPos); - cksum2 ^= sqlite3Fts5IndexEntryCksum(iRowid, iCol, iTokOff, -1, z, n); + cksum2 ^= tdsqlite3Fts5IndexEntryCksum(iRowid, iCol, iTokOff, -1, z, n); } } } @@ -224933,13 +224933,13 @@ static void fts5DebugRowid(int *pRc, Fts5Buffer *pBuf, i64 iKey){ if( iSegid==0 ){ if( iKey==FTS5_AVERAGES_ROWID ){ - sqlite3Fts5BufferAppendPrintf(pRc, pBuf, "{averages} "); + tdsqlite3Fts5BufferAppendPrintf(pRc, pBuf, "{averages} "); }else{ - sqlite3Fts5BufferAppendPrintf(pRc, pBuf, "{structure}"); + tdsqlite3Fts5BufferAppendPrintf(pRc, pBuf, "{structure}"); } } else{ - sqlite3Fts5BufferAppendPrintf(pRc, pBuf, "{%ssegid=%d h=%d pgno=%d}", + tdsqlite3Fts5BufferAppendPrintf(pRc, pBuf, "{%ssegid=%d h=%d pgno=%d}", bDlidx ? "dlidx " : "", iSegid, iHeight, iPgno ); } @@ -224954,16 +224954,16 @@ static void fts5DebugStructure( for(iLvl=0; iLvlnLevel; iLvl++){ Fts5StructureLevel *pLvl = &p->aLevel[iLvl]; - sqlite3Fts5BufferAppendPrintf(pRc, pBuf, + tdsqlite3Fts5BufferAppendPrintf(pRc, pBuf, " {lvl=%d nMerge=%d nSeg=%d", iLvl, pLvl->nMerge, pLvl->nSeg ); for(iSeg=0; iSegnSeg; iSeg++){ Fts5StructureSegment *pSeg = &pLvl->aSeg[iSeg]; - sqlite3Fts5BufferAppendPrintf(pRc, pBuf, " {id=%d leaves=%d..%d}", + tdsqlite3Fts5BufferAppendPrintf(pRc, pBuf, " {id=%d leaves=%d..%d}", pSeg->iSegid, pSeg->pgnoFirst, pSeg->pgnoLast ); } - sqlite3Fts5BufferAppendPrintf(pRc, pBuf, "}"); + tdsqlite3Fts5BufferAppendPrintf(pRc, pBuf, "}"); } } @@ -225009,8 +225009,8 @@ static void fts5DecodeAverages( while( i0 ){ - iOff = sqlite3Fts5GetVarint(a, (u64*)&iDocid); - sqlite3Fts5BufferAppendPrintf(pRc, pBuf, " id=%lld", iDocid); + iOff = tdsqlite3Fts5GetVarint(a, (u64*)&iDocid); + tdsqlite3Fts5BufferAppendPrintf(pRc, pBuf, " id=%lld", iDocid); } while( iOff0 ) memcpy(a, aBlob, n); @@ -225153,7 +225153,7 @@ static void fts5DecodeFunction( lvl.iLeafPgno = iPgno; for(fts5DlidxLvlNext(&lvl); lvl.bEof==0; fts5DlidxLvlNext(&lvl)){ - sqlite3Fts5BufferAppendPrintf(&rc, &s, + tdsqlite3Fts5BufferAppendPrintf(&rc, &s, " %d(%lld)", lvl.iLeafPgno, lvl.iRowid ); } @@ -225189,7 +225189,7 @@ static void fts5DecodeFunction( iOff += fts5GetVarint32(&a[iOff], nAppend); term.n = nKeep; fts5BufferAppendBlob(&rc, &term, nAppend, &a[iOff]); - sqlite3Fts5BufferAppendPrintf( + tdsqlite3Fts5BufferAppendPrintf( &rc, &s, " term=%.*s", term.n, (const char*)term.p ); iOff += nAppend; @@ -225224,7 +225224,7 @@ static void fts5DecodeFunction( memset(&term, 0, sizeof(Fts5Buffer)); if( n<4 ){ - sqlite3Fts5BufferSet(&rc, &s, 7, (const u8*)"corrupt"); + tdsqlite3Fts5BufferSet(&rc, &s, 7, (const u8*)"corrupt"); goto decode_out; }else{ iRowidOff = fts5GetU16(&a[0]); @@ -225296,7 +225296,7 @@ static void fts5DecodeFunction( fts5BufferAppendBlob(&rc, &term, nByte, &a[iOff]); iOff += nByte; - sqlite3Fts5BufferAppendPrintf( + tdsqlite3Fts5BufferAppendPrintf( &rc, &s, " term=%.*s", term.n, (const char*)term.p ); iOff += fts5DecodeDoclist(&rc, &s, &a[iOff], iEnd-iOff); @@ -225306,11 +225306,11 @@ static void fts5DecodeFunction( } decode_out: - sqlite3_free(a); + tdsqlite3_free(a); if( rc==SQLITE_OK ){ - sqlite3_result_text(pCtx, (const char*)s.p, s.n, SQLITE_TRANSIENT); + tdsqlite3_result_text(pCtx, (const char*)s.p, s.n, SQLITE_TRANSIENT); }else{ - sqlite3_result_error_code(pCtx, rc); + tdsqlite3_result_error_code(pCtx, rc); } fts5BufferFree(&s); } @@ -225319,30 +225319,30 @@ static void fts5DecodeFunction( ** The implementation of user-defined scalar function fts5_rowid(). */ static void fts5RowidFunction( - sqlite3_context *pCtx, /* Function call context */ + tdsqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args (always 2) */ - sqlite3_value **apVal /* Function arguments */ + tdsqlite3_value **apVal /* Function arguments */ ){ const char *zArg; if( nArg==0 ){ - sqlite3_result_error(pCtx, "should be: fts5_rowid(subject, ....)", -1); + tdsqlite3_result_error(pCtx, "should be: fts5_rowid(subject, ....)", -1); }else{ - zArg = (const char*)sqlite3_value_text(apVal[0]); - if( 0==sqlite3_stricmp(zArg, "segment") ){ + zArg = (const char*)tdsqlite3_value_text(apVal[0]); + if( 0==tdsqlite3_stricmp(zArg, "segment") ){ i64 iRowid; int segid, pgno; if( nArg!=3 ){ - sqlite3_result_error(pCtx, + tdsqlite3_result_error(pCtx, "should be: fts5_rowid('segment', segid, pgno))", -1 ); }else{ - segid = sqlite3_value_int(apVal[1]); - pgno = sqlite3_value_int(apVal[2]); + segid = tdsqlite3_value_int(apVal[1]); + pgno = tdsqlite3_value_int(apVal[2]); iRowid = FTS5_SEGMENT_ROWID(segid, pgno); - sqlite3_result_int64(pCtx, iRowid); + tdsqlite3_result_int64(pCtx, iRowid); } }else{ - sqlite3_result_error(pCtx, + tdsqlite3_result_error(pCtx, "first arg to fts5_rowid() must be 'segment'" , -1 ); } @@ -225357,20 +225357,20 @@ static void fts5RowidFunction( ** If successful, SQLITE_OK is returned. If an error occurs, some other ** SQLite error code is returned instead. */ -static int sqlite3Fts5IndexInit(sqlite3 *db){ - int rc = sqlite3_create_function( +static int tdsqlite3Fts5IndexInit(tdsqlite3 *db){ + int rc = tdsqlite3_create_function( db, "fts5_decode", 2, SQLITE_UTF8, 0, fts5DecodeFunction, 0, 0 ); if( rc==SQLITE_OK ){ - rc = sqlite3_create_function( + rc = tdsqlite3_create_function( db, "fts5_decode_none", 2, SQLITE_UTF8, (void*)db, fts5DecodeFunction, 0, 0 ); } if( rc==SQLITE_OK ){ - rc = sqlite3_create_function( + rc = tdsqlite3_create_function( db, "fts5_rowid", -1, SQLITE_UTF8, 0, fts5RowidFunction, 0, 0 ); } @@ -225378,7 +225378,7 @@ static int sqlite3Fts5IndexInit(sqlite3 *db){ } -static int sqlite3Fts5IndexReset(Fts5Index *p){ +static int tdsqlite3Fts5IndexReset(Fts5Index *p){ assert( p->pStruct==0 || p->iStructVersion!=0 ); if( fts5IndexDataVersion(p)!=p->iStructVersion ){ fts5StructureInvalidate(p); @@ -225410,7 +225410,7 @@ static int sqlite3Fts5IndexReset(Fts5Index *p){ ** assert() conditions in the fts5 code are activated - conditions that are ** only true if it is guaranteed that the fts5 database is not corrupt. */ -SQLITE_API int sqlite3_fts5_may_be_corrupt = 1; +SQLITE_API int tdsqlite3_fts5_may_be_corrupt = 1; typedef struct Fts5Auxdata Fts5Auxdata; @@ -225463,7 +225463,7 @@ struct Fts5TransactionState { */ struct Fts5Global { fts5_api api; /* User visible part of object (see fts5.h) */ - sqlite3 *db; /* Associated database connection */ + tdsqlite3 *db; /* Associated database connection */ i64 iNextId; /* Used to allocate unique cursor ids */ Fts5Auxiliary *pAux; /* First in list of all aux. functions */ Fts5TokenizerModule *pTok; /* First in list of all tokenizer modules */ @@ -225523,7 +225523,7 @@ struct Fts5MatchPhrase { ** byte of the position list for the corresponding phrase. */ struct Fts5Sorter { - sqlite3_stmt *pStmt; + tdsqlite3_stmt *pStmt; i64 iRowid; /* Current rowid */ const u8 *aPoslist; /* Position lists for current row */ int nIdx; /* Number of entries in aIdx[] */ @@ -225551,7 +225551,7 @@ struct Fts5Sorter { ** the lower. */ struct Fts5Cursor { - sqlite3_vtab_cursor base; /* Base class used by SQLite core */ + tdsqlite3_vtab_cursor base; /* Base class used by SQLite core */ Fts5Cursor *pNext; /* Next cursor in Fts5Cursor.pCsr list */ int *aColumnSize; /* Values for xColumnSize() */ i64 iCsrId; /* Cursor id */ @@ -225561,7 +225561,7 @@ struct Fts5Cursor { int bDesc; /* True for "ORDER BY rowid DESC" queries */ i64 iFirstRowid; /* Return no rowids earlier than this */ i64 iLastRowid; /* Return no rowids later than this */ - sqlite3_stmt *pStmt; /* Statement used to read %_content */ + tdsqlite3_stmt *pStmt; /* Statement used to read %_content */ Fts5Expr *pExpr; /* Expression for MATCH queries */ Fts5Sorter *pSorter; /* Sorter for "ORDER BY rank" queries */ int csrflags; /* Mask of cursor flags (see below) */ @@ -225572,8 +225572,8 @@ struct Fts5Cursor { char *zRankArgs; /* Custom rank function args */ Fts5Auxiliary *pRank; /* Rank callback (or NULL) */ int nRankArg; /* Number of trailing arguments for rank() */ - sqlite3_value **apRankArg; /* Array of trailing arguments */ - sqlite3_stmt *pRankArgStmt; /* Origin of objects in apRankArg[] */ + tdsqlite3_value **apRankArg; /* Array of trailing arguments */ + tdsqlite3_stmt *pRankArgStmt; /* Origin of objects in apRankArg[] */ /* Auxiliary data storage */ Fts5Auxiliary *pAux; /* Currently executing extension function */ @@ -225701,17 +225701,17 @@ static int fts5IsContentless(Fts5FullTable *pTab){ */ static void fts5FreeVtab(Fts5FullTable *pTab){ if( pTab ){ - sqlite3Fts5IndexClose(pTab->p.pIndex); - sqlite3Fts5StorageClose(pTab->pStorage); - sqlite3Fts5ConfigFree(pTab->p.pConfig); - sqlite3_free(pTab); + tdsqlite3Fts5IndexClose(pTab->p.pIndex); + tdsqlite3Fts5StorageClose(pTab->pStorage); + tdsqlite3Fts5ConfigFree(pTab->p.pConfig); + tdsqlite3_free(pTab); } } /* ** The xDisconnect() virtual table method. */ -static int fts5DisconnectMethod(sqlite3_vtab *pVtab){ +static int fts5DisconnectMethod(tdsqlite3_vtab *pVtab){ fts5FreeVtab((Fts5FullTable*)pVtab); return SQLITE_OK; } @@ -225719,9 +225719,9 @@ static int fts5DisconnectMethod(sqlite3_vtab *pVtab){ /* ** The xDestroy() virtual table method. */ -static int fts5DestroyMethod(sqlite3_vtab *pVtab){ +static int fts5DestroyMethod(tdsqlite3_vtab *pVtab){ Fts5Table *pTab = (Fts5Table*)pVtab; - int rc = sqlite3Fts5DropAll(pTab->pConfig); + int rc = tdsqlite3Fts5DropAll(pTab->pConfig); if( rc==SQLITE_OK ){ fts5FreeVtab((Fts5FullTable*)pVtab); } @@ -225741,11 +225741,11 @@ static int fts5DestroyMethod(sqlite3_vtab *pVtab){ */ static int fts5InitVtab( int bCreate, /* True for xCreate, false for xConnect */ - sqlite3 *db, /* The SQLite database connection */ + tdsqlite3 *db, /* The SQLite database connection */ void *pAux, /* Hash table containing tokenizers */ int argc, /* Number of elements in argv array */ const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVTab, /* Write the resulting vtab structure here */ + tdsqlite3_vtab **ppVTab, /* Write the resulting vtab structure here */ char **pzErr /* Write any error message here */ ){ Fts5Global *pGlobal = (Fts5Global*)pAux; @@ -225755,9 +225755,9 @@ static int fts5InitVtab( Fts5FullTable *pTab = 0; /* New virtual table object */ /* Allocate the new vtab object and parse the configuration */ - pTab = (Fts5FullTable*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5FullTable)); + pTab = (Fts5FullTable*)tdsqlite3Fts5MallocZero(&rc, sizeof(Fts5FullTable)); if( rc==SQLITE_OK ){ - rc = sqlite3Fts5ConfigParse(pGlobal, db, argc, azConfig, &pConfig, pzErr); + rc = tdsqlite3Fts5ConfigParse(pGlobal, db, argc, azConfig, &pConfig, pzErr); assert( (rc==SQLITE_OK && *pzErr==0) || pConfig==0 ); } if( rc==SQLITE_OK ){ @@ -225767,27 +225767,27 @@ static int fts5InitVtab( /* Open the index sub-system */ if( rc==SQLITE_OK ){ - rc = sqlite3Fts5IndexOpen(pConfig, bCreate, &pTab->p.pIndex, pzErr); + rc = tdsqlite3Fts5IndexOpen(pConfig, bCreate, &pTab->p.pIndex, pzErr); } /* Open the storage sub-system */ if( rc==SQLITE_OK ){ - rc = sqlite3Fts5StorageOpen( + rc = tdsqlite3Fts5StorageOpen( pConfig, pTab->p.pIndex, bCreate, &pTab->pStorage, pzErr ); } - /* Call sqlite3_declare_vtab() */ + /* Call tdsqlite3_declare_vtab() */ if( rc==SQLITE_OK ){ - rc = sqlite3Fts5ConfigDeclareVtab(pConfig); + rc = tdsqlite3Fts5ConfigDeclareVtab(pConfig); } /* Load the initial configuration */ if( rc==SQLITE_OK ){ assert( pConfig->pzErrmsg==0 ); pConfig->pzErrmsg = pzErr; - rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex); - sqlite3Fts5IndexRollback(pTab->p.pIndex); + rc = tdsqlite3Fts5IndexLoadConfig(pTab->p.pIndex); + tdsqlite3Fts5IndexRollback(pTab->p.pIndex); pConfig->pzErrmsg = 0; } @@ -225797,7 +225797,7 @@ static int fts5InitVtab( }else if( bCreate ){ fts5CheckTransactionState(pTab, FTS5_BEGIN, 0); } - *ppVTab = (sqlite3_vtab*)pTab; + *ppVTab = (tdsqlite3_vtab*)pTab; return rc; } @@ -225806,22 +225806,22 @@ static int fts5InitVtab( ** work is done in function fts5InitVtab(). */ static int fts5ConnectMethod( - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ void *pAux, /* Pointer to tokenizer hash table */ int argc, /* Number of elements in argv array */ const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ - char **pzErr /* OUT: sqlite3_malloc'd error message */ + tdsqlite3_vtab **ppVtab, /* OUT: New tdsqlite3_vtab object */ + char **pzErr /* OUT: tdsqlite3_malloc'd error message */ ){ return fts5InitVtab(0, db, pAux, argc, argv, ppVtab, pzErr); } static int fts5CreateMethod( - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ void *pAux, /* Pointer to tokenizer hash table */ int argc, /* Number of elements in argv array */ const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ - char **pzErr /* OUT: sqlite3_malloc'd error message */ + tdsqlite3_vtab **ppVtab, /* OUT: New tdsqlite3_vtab object */ + char **pzErr /* OUT: tdsqlite3_malloc'd error message */ ){ return fts5InitVtab(1, db, pAux, argc, argv, ppVtab, pzErr); } @@ -225841,10 +225841,10 @@ static int fts5CreateMethod( ** extension is currently being used by a version of SQLite too old to ** support index-info flags. In that case this function is a no-op. */ -static void fts5SetUniqueFlag(sqlite3_index_info *pIdxInfo){ +static void fts5SetUniqueFlag(tdsqlite3_index_info *pIdxInfo){ #if SQLITE_VERSION_NUMBER>=3008012 #ifndef SQLITE_CORE - if( sqlite3_libversion_number()>=3008012 ) + if( tdsqlite3_libversion_number()>=3008012 ) #endif { pIdxInfo->idxFlags |= SQLITE_INDEX_SCAN_UNIQUE; @@ -225911,7 +225911,7 @@ static void fts5SetUniqueFlag(sqlite3_index_info *pIdxInfo){ ** ** Costs are not modified by the ORDER BY clause. */ -static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){ +static int fts5BestIndexMethod(tdsqlite3_vtab *pVTab, tdsqlite3_index_info *pInfo){ Fts5Table *pTab = (Fts5Table*)pVTab; Fts5Config *pConfig = pTab->pConfig; const int nCol = pConfig->nCol; @@ -225936,19 +225936,19 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){ assert( SQLITE_INDEX_CONSTRAINT_LEbLock ){ - pTab->base.zErrMsg = sqlite3_mprintf( + pTab->base.zErrMsg = tdsqlite3_mprintf( "recursively defined fts5 content table" ); return SQLITE_ERROR; } - idxStr = (char*)sqlite3_malloc(pInfo->nConstraint * 6 + 1); + idxStr = (char*)tdsqlite3_malloc(pInfo->nConstraint * 6 + 1); if( idxStr==0 ) return SQLITE_NOMEM; pInfo->idxStr = idxStr; pInfo->needToFreeIdxStr = 1; for(i=0; inConstraint; i++){ - struct sqlite3_index_constraint *p = &pInfo->aConstraint[i]; + struct tdsqlite3_index_constraint *p = &pInfo->aConstraint[i]; int iCol = p->iColumn; if( p->op==SQLITE_INDEX_CONSTRAINT_MATCH || (p->op==SQLITE_INDEX_CONSTRAINT_EQ && iCol>=nCol) @@ -225970,7 +225970,7 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){ bSeenMatch = 1; idxStr[iIdxStr++] = 'm'; if( iColnConstraint; i++){ - struct sqlite3_index_constraint *p = &pInfo->aConstraint[i]; + struct tdsqlite3_index_constraint *p = &pInfo->aConstraint[i]; if( p->iColumn<0 && p->usable ){ int op = p->op; if( op==SQLITE_INDEX_CONSTRAINT_LT || op==SQLITE_INDEX_CONSTRAINT_LE ){ @@ -226045,25 +226045,25 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){ static int fts5NewTransaction(Fts5FullTable *pTab){ Fts5Cursor *pCsr; for(pCsr=pTab->pGlobal->pCsr; pCsr; pCsr=pCsr->pNext){ - if( pCsr->base.pVtab==(sqlite3_vtab*)pTab ) return SQLITE_OK; + if( pCsr->base.pVtab==(tdsqlite3_vtab*)pTab ) return SQLITE_OK; } - return sqlite3Fts5StorageReset(pTab->pStorage); + return tdsqlite3Fts5StorageReset(pTab->pStorage); } /* ** Implementation of xOpen method. */ -static int fts5OpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){ +static int fts5OpenMethod(tdsqlite3_vtab *pVTab, tdsqlite3_vtab_cursor **ppCsr){ Fts5FullTable *pTab = (Fts5FullTable*)pVTab; Fts5Config *pConfig = pTab->p.pConfig; Fts5Cursor *pCsr = 0; /* New cursor object */ - sqlite3_int64 nByte; /* Bytes of space to allocate */ + tdsqlite3_int64 nByte; /* Bytes of space to allocate */ int rc; /* Return code */ rc = fts5NewTransaction(pTab); if( rc==SQLITE_OK ){ nByte = sizeof(Fts5Cursor) + pConfig->nCol * sizeof(int); - pCsr = (Fts5Cursor*)sqlite3_malloc64(nByte); + pCsr = (Fts5Cursor*)tdsqlite3_malloc64(nByte); if( pCsr ){ Fts5Global *pGlobal = pTab->pGlobal; memset(pCsr, 0, (size_t)nByte); @@ -226075,7 +226075,7 @@ static int fts5OpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){ rc = SQLITE_NOMEM; } } - *ppCsr = (sqlite3_vtab_cursor*)pCsr; + *ppCsr = (tdsqlite3_vtab_cursor*)pCsr; return rc; } @@ -226105,37 +226105,37 @@ static void fts5FreeCursorComponents(Fts5Cursor *pCsr){ Fts5Auxdata *pData; Fts5Auxdata *pNext; - sqlite3_free(pCsr->aInstIter); - sqlite3_free(pCsr->aInst); + tdsqlite3_free(pCsr->aInstIter); + tdsqlite3_free(pCsr->aInst); if( pCsr->pStmt ){ int eStmt = fts5StmtType(pCsr); - sqlite3Fts5StorageStmtRelease(pTab->pStorage, eStmt, pCsr->pStmt); + tdsqlite3Fts5StorageStmtRelease(pTab->pStorage, eStmt, pCsr->pStmt); } if( pCsr->pSorter ){ Fts5Sorter *pSorter = pCsr->pSorter; - sqlite3_finalize(pSorter->pStmt); - sqlite3_free(pSorter); + tdsqlite3_finalize(pSorter->pStmt); + tdsqlite3_free(pSorter); } if( pCsr->ePlan!=FTS5_PLAN_SOURCE ){ - sqlite3Fts5ExprFree(pCsr->pExpr); + tdsqlite3Fts5ExprFree(pCsr->pExpr); } for(pData=pCsr->pAuxdata; pData; pData=pNext){ pNext = pData->pNext; if( pData->xDelete ) pData->xDelete(pData->pPtr); - sqlite3_free(pData); + tdsqlite3_free(pData); } - sqlite3_finalize(pCsr->pRankArgStmt); - sqlite3_free(pCsr->apRankArg); + tdsqlite3_finalize(pCsr->pRankArgStmt); + tdsqlite3_free(pCsr->apRankArg); if( CsrFlagTest(pCsr, FTS5CSR_FREE_ZRANK) ){ - sqlite3_free(pCsr->zRank); - sqlite3_free(pCsr->zRankArgs); + tdsqlite3_free(pCsr->zRank); + tdsqlite3_free(pCsr->zRankArgs); } - sqlite3Fts5IndexCloseReader(pTab->p.pIndex); + tdsqlite3Fts5IndexCloseReader(pTab->p.pIndex); memset(&pCsr->ePlan, 0, sizeof(Fts5Cursor) - ((u8*)&pCsr->ePlan - (u8*)pCsr)); } @@ -226144,7 +226144,7 @@ static void fts5FreeCursorComponents(Fts5Cursor *pCsr){ ** Close the cursor. For additional information see the documentation ** on the xClose method of the virtual table interface. */ -static int fts5CloseMethod(sqlite3_vtab_cursor *pCursor){ +static int fts5CloseMethod(tdsqlite3_vtab_cursor *pCursor){ if( pCursor ){ Fts5FullTable *pTab = (Fts5FullTable*)(pCursor->pVtab); Fts5Cursor *pCsr = (Fts5Cursor*)pCursor; @@ -226155,7 +226155,7 @@ static int fts5CloseMethod(sqlite3_vtab_cursor *pCursor){ for(pp=&pTab->pGlobal->pCsr; (*pp)!=pCsr; pp=&(*pp)->pNext); *pp = pCsr->pNext; - sqlite3_free(pCsr); + tdsqlite3_free(pCsr); } return SQLITE_OK; } @@ -226164,7 +226164,7 @@ static int fts5SorterNext(Fts5Cursor *pCsr){ Fts5Sorter *pSorter = pCsr->pSorter; int rc; - rc = sqlite3_step(pSorter->pStmt); + rc = tdsqlite3_step(pSorter->pStmt); if( rc==SQLITE_DONE ){ rc = SQLITE_OK; CsrFlagSet(pCsr, FTS5CSR_EOF); @@ -226176,9 +226176,9 @@ static int fts5SorterNext(Fts5Cursor *pCsr){ int iOff = 0; rc = SQLITE_OK; - pSorter->iRowid = sqlite3_column_int64(pSorter->pStmt, 0); - nBlob = sqlite3_column_bytes(pSorter->pStmt, 1); - aBlob = a = sqlite3_column_blob(pSorter->pStmt, 1); + pSorter->iRowid = tdsqlite3_column_int64(pSorter->pStmt, 0); + nBlob = tdsqlite3_column_bytes(pSorter->pStmt, 1); + aBlob = a = tdsqlite3_column_blob(pSorter->pStmt, 1); /* nBlob==0 in detail=none mode. */ if( nBlob>0 ){ @@ -226207,7 +226207,7 @@ static void fts5TripCursors(Fts5FullTable *pTab){ Fts5Cursor *pCsr; for(pCsr=pTab->pGlobal->pCsr; pCsr; pCsr=pCsr->pNext){ if( pCsr->ePlan==FTS5_PLAN_MATCH - && pCsr->base.pVtab==(sqlite3_vtab*)pTab + && pCsr->base.pVtab==(tdsqlite3_vtab*)pTab ){ CsrFlagSet(pCsr, FTS5CSR_REQUIRE_RESEEK); } @@ -226232,16 +226232,16 @@ static int fts5CursorReseek(Fts5Cursor *pCsr, int *pbSkip){ if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_RESEEK) ){ Fts5FullTable *pTab = (Fts5FullTable*)(pCsr->base.pVtab); int bDesc = pCsr->bDesc; - i64 iRowid = sqlite3Fts5ExprRowid(pCsr->pExpr); + i64 iRowid = tdsqlite3Fts5ExprRowid(pCsr->pExpr); - rc = sqlite3Fts5ExprFirst(pCsr->pExpr, pTab->p.pIndex, iRowid, bDesc); - if( rc==SQLITE_OK && iRowid!=sqlite3Fts5ExprRowid(pCsr->pExpr) ){ + rc = tdsqlite3Fts5ExprFirst(pCsr->pExpr, pTab->p.pIndex, iRowid, bDesc); + if( rc==SQLITE_OK && iRowid!=tdsqlite3Fts5ExprRowid(pCsr->pExpr) ){ *pbSkip = 1; } CsrFlagClear(pCsr, FTS5CSR_REQUIRE_RESEEK); fts5CsrNewrow(pCsr); - if( sqlite3Fts5ExprEof(pCsr->pExpr) ){ + if( tdsqlite3Fts5ExprEof(pCsr->pExpr) ){ CsrFlagSet(pCsr, FTS5CSR_EOF); *pbSkip = 1; } @@ -226258,7 +226258,7 @@ static int fts5CursorReseek(Fts5Cursor *pCsr, int *pbSkip){ ** even if we reach end-of-file. The fts5EofMethod() will be called ** subsequently to determine whether or not an EOF was hit. */ -static int fts5NextMethod(sqlite3_vtab_cursor *pCursor){ +static int fts5NextMethod(tdsqlite3_vtab_cursor *pCursor){ Fts5Cursor *pCsr = (Fts5Cursor*)pCursor; int rc; @@ -226270,8 +226270,8 @@ static int fts5NextMethod(sqlite3_vtab_cursor *pCursor){ if( pCsr->ePlan<3 ){ int bSkip = 0; if( (rc = fts5CursorReseek(pCsr, &bSkip)) || bSkip ) return rc; - rc = sqlite3Fts5ExprNext(pCsr->pExpr, pCsr->iLastRowid); - CsrFlagSet(pCsr, sqlite3Fts5ExprEof(pCsr->pExpr)); + rc = tdsqlite3Fts5ExprNext(pCsr->pExpr, pCsr->iLastRowid); + CsrFlagSet(pCsr, tdsqlite3Fts5ExprEof(pCsr->pExpr)); fts5CsrNewrow(pCsr); }else{ switch( pCsr->ePlan ){ @@ -226289,14 +226289,14 @@ static int fts5NextMethod(sqlite3_vtab_cursor *pCursor){ default: { Fts5Config *pConfig = ((Fts5Table*)pCursor->pVtab)->pConfig; pConfig->bLock++; - rc = sqlite3_step(pCsr->pStmt); + rc = tdsqlite3_step(pCsr->pStmt); pConfig->bLock--; if( rc!=SQLITE_ROW ){ CsrFlagSet(pCsr, FTS5CSR_EOF); - rc = sqlite3_reset(pCsr->pStmt); + rc = tdsqlite3_reset(pCsr->pStmt); if( rc!=SQLITE_OK ){ - pCursor->pVtab->zErrMsg = sqlite3_mprintf( - "%s", sqlite3_errmsg(pConfig->db) + pCursor->pVtab->zErrMsg = tdsqlite3_mprintf( + "%s", tdsqlite3_errmsg(pConfig->db) ); } }else{ @@ -226312,27 +226312,27 @@ static int fts5NextMethod(sqlite3_vtab_cursor *pCursor){ static int fts5PrepareStatement( - sqlite3_stmt **ppStmt, + tdsqlite3_stmt **ppStmt, Fts5Config *pConfig, const char *zFmt, ... ){ - sqlite3_stmt *pRet = 0; + tdsqlite3_stmt *pRet = 0; int rc; char *zSql; va_list ap; va_start(ap, zFmt); - zSql = sqlite3_vmprintf(zFmt, ap); + zSql = tdsqlite3_vmprintf(zFmt, ap); if( zSql==0 ){ rc = SQLITE_NOMEM; }else{ - rc = sqlite3_prepare_v3(pConfig->db, zSql, -1, + rc = tdsqlite3_prepare_v3(pConfig->db, zSql, -1, SQLITE_PREPARE_PERSISTENT, &pRet, 0); if( rc!=SQLITE_OK ){ - *pConfig->pzErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(pConfig->db)); + *pConfig->pzErrmsg = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(pConfig->db)); } - sqlite3_free(zSql); + tdsqlite3_free(zSql); } va_end(ap); @@ -226348,14 +226348,14 @@ static int fts5CursorFirstSorted( Fts5Config *pConfig = pTab->p.pConfig; Fts5Sorter *pSorter; int nPhrase; - sqlite3_int64 nByte; + tdsqlite3_int64 nByte; int rc; const char *zRank = pCsr->zRank; const char *zRankArgs = pCsr->zRankArgs; - nPhrase = sqlite3Fts5ExprPhraseCount(pCsr->pExpr); + nPhrase = tdsqlite3Fts5ExprPhraseCount(pCsr->pExpr); nByte = sizeof(Fts5Sorter) + sizeof(int) * (nPhrase-1); - pSorter = (Fts5Sorter*)sqlite3_malloc64(nByte); + pSorter = (Fts5Sorter*)tdsqlite3_malloc64(nByte); if( pSorter==0 ) return SQLITE_NOMEM; memset(pSorter, 0, (size_t)nByte); pSorter->nIdx = nPhrase; @@ -226384,8 +226384,8 @@ static int fts5CursorFirstSorted( } if( rc!=SQLITE_OK ){ - sqlite3_finalize(pSorter->pStmt); - sqlite3_free(pSorter); + tdsqlite3_finalize(pSorter->pStmt); + tdsqlite3_free(pSorter); pCsr->pSorter = 0; } @@ -226395,8 +226395,8 @@ static int fts5CursorFirstSorted( static int fts5CursorFirst(Fts5FullTable *pTab, Fts5Cursor *pCsr, int bDesc){ int rc; Fts5Expr *pExpr = pCsr->pExpr; - rc = sqlite3Fts5ExprFirst(pExpr, pTab->p.pIndex, pCsr->iFirstRowid, bDesc); - if( sqlite3Fts5ExprEof(pExpr) ){ + rc = tdsqlite3Fts5ExprFirst(pExpr, pTab->p.pIndex, pCsr->iFirstRowid, bDesc); + if( tdsqlite3Fts5ExprEof(pExpr) ){ CsrFlagSet(pCsr, FTS5CSR_EOF); } fts5CsrNewrow(pCsr); @@ -226424,15 +226424,15 @@ static int fts5SpecialMatch( assert( pTab->p.base.zErrMsg==0 ); pCsr->ePlan = FTS5_PLAN_SPECIAL; - if( n==5 && 0==sqlite3_strnicmp("reads", z, n) ){ - pCsr->iSpecial = sqlite3Fts5IndexReads(pTab->p.pIndex); + if( n==5 && 0==tdsqlite3_strnicmp("reads", z, n) ){ + pCsr->iSpecial = tdsqlite3Fts5IndexReads(pTab->p.pIndex); } - else if( n==2 && 0==sqlite3_strnicmp("id", z, n) ){ + else if( n==2 && 0==tdsqlite3_strnicmp("id", z, n) ){ pCsr->iSpecial = pCsr->iCsrId; } else{ /* An unrecognized directive. Return an error message. */ - pTab->p.base.zErrMsg = sqlite3_mprintf("unknown special query: %.*s", n, z); + pTab->p.base.zErrMsg = tdsqlite3_mprintf("unknown special query: %.*s", n, z); rc = SQLITE_ERROR; } @@ -226448,7 +226448,7 @@ static Fts5Auxiliary *fts5FindAuxiliary(Fts5FullTable *pTab, const char *zName){ Fts5Auxiliary *pAux; for(pAux=pTab->pGlobal->pAux; pAux; pAux=pAux->pNext){ - if( sqlite3_stricmp(zName, pAux->zFunc)==0 ) return pAux; + if( tdsqlite3_stricmp(zName, pAux->zFunc)==0 ) return pAux; } /* No function of the specified name was found. Return 0. */ @@ -226465,28 +226465,28 @@ static int fts5FindRankFunction(Fts5Cursor *pCsr){ const char *zRankArgs = pCsr->zRankArgs; if( zRankArgs ){ - char *zSql = sqlite3Fts5Mprintf(&rc, "SELECT %s", zRankArgs); + char *zSql = tdsqlite3Fts5Mprintf(&rc, "SELECT %s", zRankArgs); if( zSql ){ - sqlite3_stmt *pStmt = 0; - rc = sqlite3_prepare_v3(pConfig->db, zSql, -1, + tdsqlite3_stmt *pStmt = 0; + rc = tdsqlite3_prepare_v3(pConfig->db, zSql, -1, SQLITE_PREPARE_PERSISTENT, &pStmt, 0); - sqlite3_free(zSql); + tdsqlite3_free(zSql); assert( rc==SQLITE_OK || pCsr->pRankArgStmt==0 ); if( rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - sqlite3_int64 nByte; - pCsr->nRankArg = sqlite3_column_count(pStmt); - nByte = sizeof(sqlite3_value*)*pCsr->nRankArg; - pCsr->apRankArg = (sqlite3_value**)sqlite3Fts5MallocZero(&rc, nByte); + if( SQLITE_ROW==tdsqlite3_step(pStmt) ){ + tdsqlite3_int64 nByte; + pCsr->nRankArg = tdsqlite3_column_count(pStmt); + nByte = sizeof(tdsqlite3_value*)*pCsr->nRankArg; + pCsr->apRankArg = (tdsqlite3_value**)tdsqlite3Fts5MallocZero(&rc, nByte); if( rc==SQLITE_OK ){ int i; for(i=0; inRankArg; i++){ - pCsr->apRankArg[i] = sqlite3_column_value(pStmt, i); + pCsr->apRankArg[i] = tdsqlite3_column_value(pStmt, i); } } pCsr->pRankArgStmt = pStmt; }else{ - rc = sqlite3_finalize(pStmt); + rc = tdsqlite3_finalize(pStmt); assert( rc!=SQLITE_OK ); } } @@ -226497,7 +226497,7 @@ static int fts5FindRankFunction(Fts5Cursor *pCsr){ pAux = fts5FindAuxiliary(pTab, zRank); if( pAux==0 ){ assert( pTab->p.base.zErrMsg==0 ); - pTab->p.base.zErrMsg = sqlite3_mprintf("no such function: %s", zRank); + pTab->p.base.zErrMsg = tdsqlite3_mprintf("no such function: %s", zRank); rc = SQLITE_ERROR; } } @@ -226510,25 +226510,25 @@ static int fts5FindRankFunction(Fts5Cursor *pCsr){ static int fts5CursorParseRank( Fts5Config *pConfig, Fts5Cursor *pCsr, - sqlite3_value *pRank + tdsqlite3_value *pRank ){ int rc = SQLITE_OK; if( pRank ){ - const char *z = (const char*)sqlite3_value_text(pRank); + const char *z = (const char*)tdsqlite3_value_text(pRank); char *zRank = 0; char *zRankArgs = 0; if( z==0 ){ - if( sqlite3_value_type(pRank)==SQLITE_NULL ) rc = SQLITE_ERROR; + if( tdsqlite3_value_type(pRank)==SQLITE_NULL ) rc = SQLITE_ERROR; }else{ - rc = sqlite3Fts5ConfigParseRank(z, &zRank, &zRankArgs); + rc = tdsqlite3Fts5ConfigParseRank(z, &zRank, &zRankArgs); } if( rc==SQLITE_OK ){ pCsr->zRank = zRank; pCsr->zRankArgs = zRankArgs; CsrFlagSet(pCsr, FTS5CSR_FREE_ZRANK); }else if( rc==SQLITE_ERROR ){ - pCsr->base.pVtab->zErrMsg = sqlite3_mprintf( + pCsr->base.pVtab->zErrMsg = tdsqlite3_mprintf( "parse error in rank function: %s", z ); } @@ -226544,11 +226544,11 @@ static int fts5CursorParseRank( return rc; } -static i64 fts5GetRowidLimit(sqlite3_value *pVal, i64 iDefault){ +static i64 fts5GetRowidLimit(tdsqlite3_value *pVal, i64 iDefault){ if( pVal ){ - int eType = sqlite3_value_numeric_type(pVal); + int eType = tdsqlite3_value_numeric_type(pVal); if( eType==SQLITE_INTEGER ){ - return sqlite3_value_int64(pVal); + return tdsqlite3_value_int64(pVal); } } return iDefault; @@ -226566,11 +226566,11 @@ static i64 fts5GetRowidLimit(sqlite3_value *pVal, i64 iDefault){ ** 3. A full-table scan. */ static int fts5FilterMethod( - sqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ + tdsqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ int idxNum, /* Strategy index */ const char *idxStr, /* Unused */ int nVal, /* Number of elements in apVal */ - sqlite3_value **apVal /* Arguments for the indexing scheme */ + tdsqlite3_value **apVal /* Arguments for the indexing scheme */ ){ Fts5FullTable *pTab = (Fts5FullTable*)(pCursor->pVtab); Fts5Config *pConfig = pTab->p.pConfig; @@ -226578,10 +226578,10 @@ static int fts5FilterMethod( int rc = SQLITE_OK; /* Error code */ int bDesc; /* True if ORDER BY [rank|rowid] DESC */ int bOrderByRank; /* True if ORDER BY rank */ - sqlite3_value *pRank = 0; /* rank MATCH ? expression (or NULL) */ - sqlite3_value *pRowidEq = 0; /* rowid = ? expression (or NULL) */ - sqlite3_value *pRowidLe = 0; /* rowid <= ? expression (or NULL) */ - sqlite3_value *pRowidGe = 0; /* rowid >= ? expression (or NULL) */ + tdsqlite3_value *pRank = 0; /* rank MATCH ? expression (or NULL) */ + tdsqlite3_value *pRowidEq = 0; /* rowid = ? expression (or NULL) */ + tdsqlite3_value *pRowidLe = 0; /* rowid <= ? expression (or NULL) */ + tdsqlite3_value *pRowidGe = 0; /* rowid >= ? expression (or NULL) */ int iCol; /* Column on LHS of MATCH operator */ char **pzErrmsg = pConfig->pzErrmsg; int i; @@ -226589,7 +226589,7 @@ static int fts5FilterMethod( Fts5Expr *pExpr = 0; if( pConfig->bLock ){ - pTab->p.base.zErrMsg = sqlite3_mprintf( + pTab->p.base.zErrMsg = tdsqlite3_mprintf( "recursively defined fts5 content table" ); return SQLITE_ERROR; @@ -226618,7 +226618,7 @@ static int fts5FilterMethod( pRank = apVal[i]; break; case 'm': { - const char *zText = (const char*)sqlite3_value_text(apVal[i]); + const char *zText = (const char*)tdsqlite3_value_text(apVal[i]); if( zText==0 ) zText = ""; if( idxStr[iIdxStr]>='0' && idxStr[iIdxStr]<='9' ){ @@ -226639,9 +226639,9 @@ static int fts5FilterMethod( goto filter_out; }else{ char **pzErr = &pTab->p.base.zErrMsg; - rc = sqlite3Fts5ExprNew(pConfig, iCol, zText, &pExpr, pzErr); + rc = tdsqlite3Fts5ExprNew(pConfig, iCol, zText, &pExpr, pzErr); if( rc==SQLITE_OK ){ - rc = sqlite3Fts5ExprAnd(&pCsr->pExpr, pExpr); + rc = tdsqlite3Fts5ExprAnd(&pCsr->pExpr, pExpr); pExpr = 0; } if( rc!=SQLITE_OK ) goto filter_out; @@ -226665,7 +226665,7 @@ static int fts5FilterMethod( /* Set the cursor upper and lower rowid limits. Only some strategies ** actually use them. This is ok, as the xBestIndex() method leaves the - ** sqlite3_index_constraint.omit flag clear for range constraints + ** tdsqlite3_index_constraint.omit flag clear for range constraints ** on the rowid field. */ if( pRowidEq ){ pRowidLe = pRowidGe = pRowidEq; @@ -226711,7 +226711,7 @@ static int fts5FilterMethod( } } }else if( pConfig->zContent==0 ){ - *pConfig->pzErrmsg = sqlite3_mprintf( + *pConfig->pzErrmsg = tdsqlite3_mprintf( "%s: table does not support scanning", pConfig->zName ); rc = SQLITE_ERROR; @@ -226719,22 +226719,22 @@ static int fts5FilterMethod( /* This is either a full-table scan (ePlan==FTS5_PLAN_SCAN) or a lookup ** by rowid (ePlan==FTS5_PLAN_ROWID). */ pCsr->ePlan = (pRowidEq ? FTS5_PLAN_ROWID : FTS5_PLAN_SCAN); - rc = sqlite3Fts5StorageStmt( + rc = tdsqlite3Fts5StorageStmt( pTab->pStorage, fts5StmtType(pCsr), &pCsr->pStmt, &pTab->p.base.zErrMsg ); if( rc==SQLITE_OK ){ if( pCsr->ePlan==FTS5_PLAN_ROWID ){ - sqlite3_bind_value(pCsr->pStmt, 1, pRowidEq); + tdsqlite3_bind_value(pCsr->pStmt, 1, pRowidEq); }else{ - sqlite3_bind_int64(pCsr->pStmt, 1, pCsr->iFirstRowid); - sqlite3_bind_int64(pCsr->pStmt, 2, pCsr->iLastRowid); + tdsqlite3_bind_int64(pCsr->pStmt, 1, pCsr->iFirstRowid); + tdsqlite3_bind_int64(pCsr->pStmt, 2, pCsr->iLastRowid); } rc = fts5NextMethod(pCursor); } } filter_out: - sqlite3Fts5ExprFree(pExpr); + tdsqlite3Fts5ExprFree(pExpr); pConfig->pzErrmsg = pzErrmsg; return rc; } @@ -226743,7 +226743,7 @@ static int fts5FilterMethod( ** This is the xEof method of the virtual table. SQLite calls this ** routine to find out if it has reached the end of a result set. */ -static int fts5EofMethod(sqlite3_vtab_cursor *pCursor){ +static int fts5EofMethod(tdsqlite3_vtab_cursor *pCursor){ Fts5Cursor *pCsr = (Fts5Cursor*)pCursor; return (CsrFlagTest(pCsr, FTS5CSR_EOF) ? 1 : 0); } @@ -226759,7 +226759,7 @@ static i64 fts5CursorRowid(Fts5Cursor *pCsr){ if( pCsr->pSorter ){ return pCsr->pSorter->iRowid; }else{ - return sqlite3Fts5ExprRowid(pCsr->pExpr); + return tdsqlite3Fts5ExprRowid(pCsr->pExpr); } } @@ -226769,7 +226769,7 @@ static i64 fts5CursorRowid(Fts5Cursor *pCsr){ ** exposes %_content.rowid as the rowid for the virtual table. The ** rowid should be written to *pRowid. */ -static int fts5RowidMethod(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ +static int fts5RowidMethod(tdsqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ Fts5Cursor *pCsr = (Fts5Cursor*)pCursor; int ePlan = pCsr->ePlan; @@ -226786,7 +226786,7 @@ static int fts5RowidMethod(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ break; default: - *pRowid = sqlite3_column_int64(pCsr->pStmt, 0); + *pRowid = tdsqlite3_column_int64(pCsr->pStmt, 0); break; } @@ -226798,7 +226798,7 @@ static int fts5RowidMethod(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ ** Return SQLITE_OK if no error occurs, or an SQLite error code otherwise. ** ** If argument bErrormsg is true and an error occurs, an error message may -** be left in sqlite3_vtab.zErrMsg. +** be left in tdsqlite3_vtab.zErrMsg. */ static int fts5SeekCursor(Fts5Cursor *pCsr, int bErrormsg){ int rc = SQLITE_OK; @@ -226807,7 +226807,7 @@ static int fts5SeekCursor(Fts5Cursor *pCsr, int bErrormsg){ if( pCsr->pStmt==0 ){ Fts5FullTable *pTab = (Fts5FullTable*)(pCsr->base.pVtab); int eStmt = fts5StmtType(pCsr); - rc = sqlite3Fts5StorageStmt( + rc = tdsqlite3Fts5StorageStmt( pTab->pStorage, eStmt, &pCsr->pStmt, (bErrormsg?&pTab->p.base.zErrMsg:0) ); assert( rc!=SQLITE_OK || pTab->p.base.zErrMsg==0 ); @@ -226817,21 +226817,21 @@ static int fts5SeekCursor(Fts5Cursor *pCsr, int bErrormsg){ if( rc==SQLITE_OK && CsrFlagTest(pCsr, FTS5CSR_REQUIRE_CONTENT) ){ Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab); assert( pCsr->pExpr ); - sqlite3_reset(pCsr->pStmt); - sqlite3_bind_int64(pCsr->pStmt, 1, fts5CursorRowid(pCsr)); + tdsqlite3_reset(pCsr->pStmt); + tdsqlite3_bind_int64(pCsr->pStmt, 1, fts5CursorRowid(pCsr)); pTab->pConfig->bLock++; - rc = sqlite3_step(pCsr->pStmt); + rc = tdsqlite3_step(pCsr->pStmt); pTab->pConfig->bLock--; if( rc==SQLITE_ROW ){ rc = SQLITE_OK; CsrFlagClear(pCsr, FTS5CSR_REQUIRE_CONTENT); }else{ - rc = sqlite3_reset(pCsr->pStmt); + rc = tdsqlite3_reset(pCsr->pStmt); if( rc==SQLITE_OK ){ rc = FTS5_CORRUPT; }else if( pTab->pConfig->pzErrmsg ){ - *pTab->pConfig->pzErrmsg = sqlite3_mprintf( - "%s", sqlite3_errmsg(pTab->pConfig->db) + *pTab->pConfig->pzErrmsg = tdsqlite3_mprintf( + "%s", tdsqlite3_errmsg(pTab->pConfig->db) ); } } @@ -226843,7 +226843,7 @@ static void fts5SetVtabError(Fts5FullTable *p, const char *zFormat, ...){ va_list ap; /* ... printf arguments */ va_start(ap, zFormat); assert( p->p.base.zErrMsg==0 ); - p->p.base.zErrMsg = sqlite3_vmprintf(zFormat, ap); + p->p.base.zErrMsg = tdsqlite3_vmprintf(zFormat, ap); va_end(ap); } @@ -226865,13 +226865,13 @@ static void fts5SetVtabError(Fts5FullTable *p, const char *zFormat, ...){ static int fts5SpecialInsert( Fts5FullTable *pTab, /* Fts5 table object */ const char *zCmd, /* Text inserted into table-name column */ - sqlite3_value *pVal /* Value inserted into rank column */ + tdsqlite3_value *pVal /* Value inserted into rank column */ ){ Fts5Config *pConfig = pTab->p.pConfig; int rc = SQLITE_OK; int bError = 0; - if( 0==sqlite3_stricmp("delete-all", zCmd) ){ + if( 0==tdsqlite3_stricmp("delete-all", zCmd) ){ if( pConfig->eContent==FTS5_CONTENT_NORMAL ){ fts5SetVtabError(pTab, "'delete-all' may only be used with a " @@ -226879,38 +226879,38 @@ static int fts5SpecialInsert( ); rc = SQLITE_ERROR; }else{ - rc = sqlite3Fts5StorageDeleteAll(pTab->pStorage); + rc = tdsqlite3Fts5StorageDeleteAll(pTab->pStorage); } - }else if( 0==sqlite3_stricmp("rebuild", zCmd) ){ + }else if( 0==tdsqlite3_stricmp("rebuild", zCmd) ){ if( pConfig->eContent==FTS5_CONTENT_NONE ){ fts5SetVtabError(pTab, "'rebuild' may not be used with a contentless fts5 table" ); rc = SQLITE_ERROR; }else{ - rc = sqlite3Fts5StorageRebuild(pTab->pStorage); + rc = tdsqlite3Fts5StorageRebuild(pTab->pStorage); } - }else if( 0==sqlite3_stricmp("optimize", zCmd) ){ - rc = sqlite3Fts5StorageOptimize(pTab->pStorage); - }else if( 0==sqlite3_stricmp("merge", zCmd) ){ - int nMerge = sqlite3_value_int(pVal); - rc = sqlite3Fts5StorageMerge(pTab->pStorage, nMerge); - }else if( 0==sqlite3_stricmp("integrity-check", zCmd) ){ - rc = sqlite3Fts5StorageIntegrity(pTab->pStorage); + }else if( 0==tdsqlite3_stricmp("optimize", zCmd) ){ + rc = tdsqlite3Fts5StorageOptimize(pTab->pStorage); + }else if( 0==tdsqlite3_stricmp("merge", zCmd) ){ + int nMerge = tdsqlite3_value_int(pVal); + rc = tdsqlite3Fts5StorageMerge(pTab->pStorage, nMerge); + }else if( 0==tdsqlite3_stricmp("integrity-check", zCmd) ){ + rc = tdsqlite3Fts5StorageIntegrity(pTab->pStorage); #ifdef SQLITE_DEBUG - }else if( 0==sqlite3_stricmp("prefix-index", zCmd) ){ - pConfig->bPrefixIndex = sqlite3_value_int(pVal); + }else if( 0==tdsqlite3_stricmp("prefix-index", zCmd) ){ + pConfig->bPrefixIndex = tdsqlite3_value_int(pVal); #endif }else{ - rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex); + rc = tdsqlite3Fts5IndexLoadConfig(pTab->p.pIndex); if( rc==SQLITE_OK ){ - rc = sqlite3Fts5ConfigSetValue(pTab->p.pConfig, zCmd, pVal, &bError); + rc = tdsqlite3Fts5ConfigSetValue(pTab->p.pConfig, zCmd, pVal, &bError); } if( rc==SQLITE_OK ){ if( bError ){ rc = SQLITE_ERROR; }else{ - rc = sqlite3Fts5StorageConfigValue(pTab->pStorage, zCmd, pVal, 0); + rc = tdsqlite3Fts5StorageConfigValue(pTab->pStorage, zCmd, pVal, 0); } } } @@ -226919,13 +226919,13 @@ static int fts5SpecialInsert( static int fts5SpecialDelete( Fts5FullTable *pTab, - sqlite3_value **apVal + tdsqlite3_value **apVal ){ int rc = SQLITE_OK; - int eType1 = sqlite3_value_type(apVal[1]); + int eType1 = tdsqlite3_value_type(apVal[1]); if( eType1==SQLITE_INTEGER ){ - sqlite3_int64 iDel = sqlite3_value_int64(apVal[1]); - rc = sqlite3Fts5StorageDelete(pTab->pStorage, iDel, &apVal[2]); + tdsqlite3_int64 iDel = tdsqlite3_value_int64(apVal[1]); + rc = tdsqlite3Fts5StorageDelete(pTab->pStorage, iDel, &apVal[2]); } return rc; } @@ -226933,15 +226933,15 @@ static int fts5SpecialDelete( static void fts5StorageInsert( int *pRc, Fts5FullTable *pTab, - sqlite3_value **apVal, + tdsqlite3_value **apVal, i64 *piRowid ){ int rc = *pRc; if( rc==SQLITE_OK ){ - rc = sqlite3Fts5StorageContentInsert(pTab->pStorage, apVal, piRowid); + rc = tdsqlite3Fts5StorageContentInsert(pTab->pStorage, apVal, piRowid); } if( rc==SQLITE_OK ){ - rc = sqlite3Fts5StorageIndexInsert(pTab->pStorage, apVal, *piRowid); + rc = tdsqlite3Fts5StorageIndexInsert(pTab->pStorage, apVal, *piRowid); } *pRc = rc; } @@ -226961,9 +226961,9 @@ static void fts5StorageInsert( ** 4. Values for the two hidden columns ( and "rank"). */ static int fts5UpdateMethod( - sqlite3_vtab *pVtab, /* Virtual table handle */ + tdsqlite3_vtab *pVtab, /* Virtual table handle */ int nArg, /* Size of argument array */ - sqlite3_value **apVal, /* Array of arguments */ + tdsqlite3_value **apVal, /* Array of arguments */ sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */ ){ Fts5FullTable *pTab = (Fts5FullTable*)pVtab; @@ -226976,8 +226976,8 @@ static int fts5UpdateMethod( assert( pVtab->zErrMsg==0 ); assert( nArg==1 || nArg==(2+pConfig->nCol+2) ); - assert( sqlite3_value_type(apVal[0])==SQLITE_INTEGER - || sqlite3_value_type(apVal[0])==SQLITE_NULL + assert( tdsqlite3_value_type(apVal[0])==SQLITE_INTEGER + || tdsqlite3_value_type(apVal[0])==SQLITE_NULL ); assert( pTab->p.pConfig->pzErrmsg==0 ); pTab->p.pConfig->pzErrmsg = &pTab->p.base.zErrMsg; @@ -226985,14 +226985,14 @@ static int fts5UpdateMethod( /* Put any active cursors into REQUIRE_SEEK state. */ fts5TripCursors(pTab); - eType0 = sqlite3_value_type(apVal[0]); + eType0 = tdsqlite3_value_type(apVal[0]); if( eType0==SQLITE_NULL - && sqlite3_value_type(apVal[2+pConfig->nCol])!=SQLITE_NULL + && tdsqlite3_value_type(apVal[2+pConfig->nCol])!=SQLITE_NULL ){ /* A "special" INSERT op. These are handled separately. */ - const char *z = (const char*)sqlite3_value_text(apVal[2+pConfig->nCol]); + const char *z = (const char*)tdsqlite3_value_text(apVal[2+pConfig->nCol]); if( pConfig->eContent!=FTS5_CONTENT_NORMAL - && 0==sqlite3_stricmp("delete", z) + && 0==tdsqlite3_stricmp("delete", z) ){ rc = fts5SpecialDelete(pTab, apVal); }else{ @@ -227012,7 +227012,7 @@ static int fts5UpdateMethod( */ int eConflict = SQLITE_ABORT; if( pConfig->eContent==FTS5_CONTENT_NORMAL ){ - eConflict = sqlite3_vtab_on_conflict(pConfig->db); + eConflict = tdsqlite3_vtab_on_conflict(pConfig->db); } assert( eType0==SQLITE_INTEGER || eType0==SQLITE_NULL ); @@ -227021,7 +227021,7 @@ static int fts5UpdateMethod( /* Filter out attempts to run UPDATE or DELETE on contentless tables. ** This is not suported. */ if( eType0==SQLITE_INTEGER && fts5IsContentless(pTab) ){ - pTab->p.base.zErrMsg = sqlite3_mprintf( + pTab->p.base.zErrMsg = tdsqlite3_mprintf( "cannot %s contentless fts5 table: %s", (nArg>1 ? "UPDATE" : "DELETE from"), pConfig->zName ); @@ -227030,13 +227030,13 @@ static int fts5UpdateMethod( /* DELETE */ else if( nArg==1 ){ - i64 iDel = sqlite3_value_int64(apVal[0]); /* Rowid to delete */ - rc = sqlite3Fts5StorageDelete(pTab->pStorage, iDel, 0); + i64 iDel = tdsqlite3_value_int64(apVal[0]); /* Rowid to delete */ + rc = tdsqlite3Fts5StorageDelete(pTab->pStorage, iDel, 0); } /* INSERT or UPDATE */ else{ - int eType1 = sqlite3_value_numeric_type(apVal[1]); + int eType1 = tdsqlite3_value_numeric_type(apVal[1]); if( eType1!=SQLITE_INTEGER && eType1!=SQLITE_NULL ){ rc = SQLITE_MISMATCH; @@ -227045,34 +227045,34 @@ static int fts5UpdateMethod( else if( eType0!=SQLITE_INTEGER ){ /* If this is a REPLACE, first remove the current entry (if any) */ if( eConflict==SQLITE_REPLACE && eType1==SQLITE_INTEGER ){ - i64 iNew = sqlite3_value_int64(apVal[1]); /* Rowid to delete */ - rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew, 0); + i64 iNew = tdsqlite3_value_int64(apVal[1]); /* Rowid to delete */ + rc = tdsqlite3Fts5StorageDelete(pTab->pStorage, iNew, 0); } fts5StorageInsert(&rc, pTab, apVal, pRowid); } /* UPDATE */ else{ - i64 iOld = sqlite3_value_int64(apVal[0]); /* Old rowid */ - i64 iNew = sqlite3_value_int64(apVal[1]); /* New rowid */ + i64 iOld = tdsqlite3_value_int64(apVal[0]); /* Old rowid */ + i64 iNew = tdsqlite3_value_int64(apVal[1]); /* New rowid */ if( eType1==SQLITE_INTEGER && iOld!=iNew ){ if( eConflict==SQLITE_REPLACE ){ - rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld, 0); + rc = tdsqlite3Fts5StorageDelete(pTab->pStorage, iOld, 0); if( rc==SQLITE_OK ){ - rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew, 0); + rc = tdsqlite3Fts5StorageDelete(pTab->pStorage, iNew, 0); } fts5StorageInsert(&rc, pTab, apVal, pRowid); }else{ - rc = sqlite3Fts5StorageContentInsert(pTab->pStorage, apVal, pRowid); + rc = tdsqlite3Fts5StorageContentInsert(pTab->pStorage, apVal, pRowid); if( rc==SQLITE_OK ){ - rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld, 0); + rc = tdsqlite3Fts5StorageDelete(pTab->pStorage, iOld, 0); } if( rc==SQLITE_OK ){ - rc = sqlite3Fts5StorageIndexInsert(pTab->pStorage, apVal,*pRowid); + rc = tdsqlite3Fts5StorageIndexInsert(pTab->pStorage, apVal,*pRowid); } } }else{ - rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld, 0); + rc = tdsqlite3Fts5StorageDelete(pTab->pStorage, iOld, 0); fts5StorageInsert(&rc, pTab, apVal, pRowid); } } @@ -227086,13 +227086,13 @@ static int fts5UpdateMethod( /* ** Implementation of xSync() method. */ -static int fts5SyncMethod(sqlite3_vtab *pVtab){ +static int fts5SyncMethod(tdsqlite3_vtab *pVtab){ int rc; Fts5FullTable *pTab = (Fts5FullTable*)pVtab; fts5CheckTransactionState(pTab, FTS5_SYNC, 0); pTab->p.pConfig->pzErrmsg = &pTab->p.base.zErrMsg; fts5TripCursors(pTab); - rc = sqlite3Fts5StorageSync(pTab->pStorage); + rc = tdsqlite3Fts5StorageSync(pTab->pStorage); pTab->p.pConfig->pzErrmsg = 0; return rc; } @@ -227100,7 +227100,7 @@ static int fts5SyncMethod(sqlite3_vtab *pVtab){ /* ** Implementation of xBegin() method. */ -static int fts5BeginMethod(sqlite3_vtab *pVtab){ +static int fts5BeginMethod(tdsqlite3_vtab *pVtab){ fts5CheckTransactionState((Fts5FullTable*)pVtab, FTS5_BEGIN, 0); fts5NewTransaction((Fts5FullTable*)pVtab); return SQLITE_OK; @@ -227111,7 +227111,7 @@ static int fts5BeginMethod(sqlite3_vtab *pVtab){ ** the pending-terms hash-table have already been flushed into the database ** by fts5SyncMethod(). */ -static int fts5CommitMethod(sqlite3_vtab *pVtab){ +static int fts5CommitMethod(tdsqlite3_vtab *pVtab){ UNUSED_PARAM(pVtab); /* Call below is a no-op for NDEBUG builds */ fts5CheckTransactionState((Fts5FullTable*)pVtab, FTS5_COMMIT, 0); return SQLITE_OK; @@ -227121,11 +227121,11 @@ static int fts5CommitMethod(sqlite3_vtab *pVtab){ ** Implementation of xRollback(). Discard the contents of the pending-terms ** hash-table. Any changes made to the database are reverted by SQLite. */ -static int fts5RollbackMethod(sqlite3_vtab *pVtab){ +static int fts5RollbackMethod(tdsqlite3_vtab *pVtab){ int rc; Fts5FullTable *pTab = (Fts5FullTable*)pVtab; fts5CheckTransactionState(pTab, FTS5_ROLLBACK, 0); - rc = sqlite3Fts5StorageRollback(pTab->pStorage); + rc = tdsqlite3Fts5StorageRollback(pTab->pStorage); return rc; } @@ -227144,17 +227144,17 @@ static int fts5ApiColumnCount(Fts5Context *pCtx){ static int fts5ApiColumnTotalSize( Fts5Context *pCtx, int iCol, - sqlite3_int64 *pnToken + tdsqlite3_int64 *pnToken ){ Fts5Cursor *pCsr = (Fts5Cursor*)pCtx; Fts5FullTable *pTab = (Fts5FullTable*)(pCsr->base.pVtab); - return sqlite3Fts5StorageSize(pTab->pStorage, iCol, pnToken); + return tdsqlite3Fts5StorageSize(pTab->pStorage, iCol, pnToken); } static int fts5ApiRowCount(Fts5Context *pCtx, i64 *pnRow){ Fts5Cursor *pCsr = (Fts5Cursor*)pCtx; Fts5FullTable *pTab = (Fts5FullTable*)(pCsr->base.pVtab); - return sqlite3Fts5StorageRowCount(pTab->pStorage, pnRow); + return tdsqlite3Fts5StorageRowCount(pTab->pStorage, pnRow); } static int fts5ApiTokenize( @@ -227165,19 +227165,19 @@ static int fts5ApiTokenize( ){ Fts5Cursor *pCsr = (Fts5Cursor*)pCtx; Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab); - return sqlite3Fts5Tokenize( + return tdsqlite3Fts5Tokenize( pTab->pConfig, FTS5_TOKENIZE_AUX, pText, nText, pUserData, xToken ); } static int fts5ApiPhraseCount(Fts5Context *pCtx){ Fts5Cursor *pCsr = (Fts5Cursor*)pCtx; - return sqlite3Fts5ExprPhraseCount(pCsr->pExpr); + return tdsqlite3Fts5ExprPhraseCount(pCsr->pExpr); } static int fts5ApiPhraseSize(Fts5Context *pCtx, int iPhrase){ Fts5Cursor *pCsr = (Fts5Cursor*)pCtx; - return sqlite3Fts5ExprPhraseSize(pCsr->pExpr, iPhrase); + return tdsqlite3Fts5ExprPhraseSize(pCsr->pExpr, iPhrase); } static int fts5ApiColumnText( @@ -227196,8 +227196,8 @@ static int fts5ApiColumnText( }else{ rc = fts5SeekCursor(pCsr, 0); if( rc==SQLITE_OK ){ - *pz = (const char*)sqlite3_column_text(pCsr->pStmt, iCol+1); - *pn = sqlite3_column_bytes(pCsr->pStmt, iCol+1); + *pz = (const char*)tdsqlite3_column_text(pCsr->pStmt, iCol+1); + *pn = tdsqlite3_column_bytes(pCsr->pStmt, iCol+1); } } return rc; @@ -227218,21 +227218,21 @@ static int fts5CsrPoslist( if( pConfig->eDetail!=FTS5_DETAIL_FULL ){ Fts5PoslistPopulator *aPopulator; int i; - aPopulator = sqlite3Fts5ExprClearPoslists(pCsr->pExpr, bLive); + aPopulator = tdsqlite3Fts5ExprClearPoslists(pCsr->pExpr, bLive); if( aPopulator==0 ) rc = SQLITE_NOMEM; for(i=0; inCol && rc==SQLITE_OK; i++){ int n; const char *z; rc = fts5ApiColumnText((Fts5Context*)pCsr, i, &z, &n); if( rc==SQLITE_OK ){ - rc = sqlite3Fts5ExprPopulatePoslists( + rc = tdsqlite3Fts5ExprPopulatePoslists( pConfig, pCsr->pExpr, aPopulator, i, z, n ); } } - sqlite3_free(aPopulator); + tdsqlite3_free(aPopulator); if( pCsr->pSorter ){ - sqlite3Fts5ExprCheckPoslists(pCsr->pExpr, pCsr->pSorter->iRowid); + tdsqlite3Fts5ExprCheckPoslists(pCsr->pExpr, pCsr->pSorter->iRowid); } } CsrFlagClear(pCsr, FTS5CSR_REQUIRE_POSLIST); @@ -227244,7 +227244,7 @@ static int fts5CsrPoslist( *pn = pSorter->aIdx[iPhrase] - i1; *pa = &pSorter->aPoslist[i1]; }else{ - *pn = sqlite3Fts5ExprPoslist(pCsr->pExpr, iPhrase, pa); + *pn = tdsqlite3Fts5ExprPoslist(pCsr->pExpr, iPhrase, pa); } return rc; @@ -227261,10 +227261,10 @@ static int fts5CacheInstArray(Fts5Cursor *pCsr){ int nIter; /* Number of iterators/phrases */ int nCol = ((Fts5Table*)pCsr->base.pVtab)->pConfig->nCol; - nIter = sqlite3Fts5ExprPhraseCount(pCsr->pExpr); + nIter = tdsqlite3Fts5ExprPhraseCount(pCsr->pExpr); if( pCsr->aInstIter==0 ){ - sqlite3_int64 nByte = sizeof(Fts5PoslistReader) * nIter; - pCsr->aInstIter = (Fts5PoslistReader*)sqlite3Fts5MallocZero(&rc, nByte); + tdsqlite3_int64 nByte = sizeof(Fts5PoslistReader) * nIter; + pCsr->aInstIter = (Fts5PoslistReader*)tdsqlite3Fts5MallocZero(&rc, nByte); } aIter = pCsr->aInstIter; @@ -227278,7 +227278,7 @@ static int fts5CacheInstArray(Fts5Cursor *pCsr){ int n; rc = fts5CsrPoslist(pCsr, i, &a, &n); if( rc==SQLITE_OK ){ - sqlite3Fts5PoslistReaderInit(a, n, &aIter[i]); + tdsqlite3Fts5PoslistReaderInit(a, n, &aIter[i]); } } @@ -227298,7 +227298,7 @@ static int fts5CacheInstArray(Fts5Cursor *pCsr){ nInst++; if( nInst>=pCsr->nInstAlloc ){ pCsr->nInstAlloc = pCsr->nInstAlloc ? pCsr->nInstAlloc*2 : 32; - aInst = (int*)sqlite3_realloc64( + aInst = (int*)tdsqlite3_realloc64( pCsr->aInst, pCsr->nInstAlloc*sizeof(int)*3 ); if( aInst ){ @@ -227317,7 +227317,7 @@ static int fts5CacheInstArray(Fts5Cursor *pCsr){ rc = FTS5_CORRUPT; break; } - sqlite3Fts5PoslistReaderNext(&aIter[iBest]); + tdsqlite3Fts5PoslistReaderNext(&aIter[iBest]); } } @@ -227366,7 +227366,7 @@ static int fts5ApiInst( return rc; } -static sqlite3_int64 fts5ApiRowid(Fts5Context *pCtx){ +static tdsqlite3_int64 fts5ApiRowid(Fts5Context *pCtx){ return fts5CursorRowid((Fts5Cursor*)pCtx); } @@ -227396,7 +227396,7 @@ static int fts5ApiColumnSize(Fts5Context *pCtx, int iCol, int *pnToken){ if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_DOCSIZE) ){ if( pConfig->bColumnsize ){ i64 iRowid = fts5CursorRowid(pCsr); - rc = sqlite3Fts5StorageDocsize(pTab->pStorage, iRowid, pCsr->aColumnSize); + rc = tdsqlite3Fts5StorageDocsize(pTab->pStorage, iRowid, pCsr->aColumnSize); }else if( pConfig->zContent==0 ){ int i; for(i=0; inCol; i++){ @@ -227413,7 +227413,7 @@ static int fts5ApiColumnSize(Fts5Context *pCtx, int iCol, int *pnToken){ pCsr->aColumnSize[i] = 0; rc = fts5ApiColumnText(pCtx, i, &z, &n); if( rc==SQLITE_OK ){ - rc = sqlite3Fts5Tokenize( + rc = tdsqlite3Fts5Tokenize( pConfig, FTS5_TOKENIZE_AUX, z, n, p, fts5ColumnSizeCb ); } @@ -227460,7 +227460,7 @@ static int fts5ApiSetAuxdata( } }else{ int rc = SQLITE_OK; - pData = (Fts5Auxdata*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Auxdata)); + pData = (Fts5Auxdata*)tdsqlite3Fts5MallocZero(&rc, sizeof(Fts5Auxdata)); if( pData==0 ){ if( xDelete ) xDelete(pPtr); return rc; @@ -227583,7 +227583,7 @@ static int fts5ApiPhraseFirstColumn( n = pSorter->aIdx[iPhrase] - i1; pIter->a = &pSorter->aPoslist[i1]; }else{ - rc = sqlite3Fts5ExprPhraseCollist(pCsr->pExpr, iPhrase, &pIter->a, &n); + rc = tdsqlite3Fts5ExprPhraseCollist(pCsr->pExpr, iPhrase, &pIter->a, &n); } if( rc==SQLITE_OK ){ pIter->b = &pIter->a[n]; @@ -227650,19 +227650,19 @@ static int fts5ApiQueryPhrase( int rc; Fts5Cursor *pNew = 0; - rc = fts5OpenMethod(pCsr->base.pVtab, (sqlite3_vtab_cursor**)&pNew); + rc = fts5OpenMethod(pCsr->base.pVtab, (tdsqlite3_vtab_cursor**)&pNew); if( rc==SQLITE_OK ){ pNew->ePlan = FTS5_PLAN_MATCH; pNew->iFirstRowid = SMALLEST_INT64; pNew->iLastRowid = LARGEST_INT64; - pNew->base.pVtab = (sqlite3_vtab*)pTab; - rc = sqlite3Fts5ExprClonePhrase(pCsr->pExpr, iPhrase, &pNew->pExpr); + pNew->base.pVtab = (tdsqlite3_vtab*)pTab; + rc = tdsqlite3Fts5ExprClonePhrase(pCsr->pExpr, iPhrase, &pNew->pExpr); } if( rc==SQLITE_OK ){ for(rc = fts5CursorFirst(pTab, pNew, 0); rc==SQLITE_OK && CsrFlagTest(pNew, FTS5CSR_EOF)==0; - rc = fts5NextMethod((sqlite3_vtab_cursor*)pNew) + rc = fts5NextMethod((tdsqlite3_vtab_cursor*)pNew) ){ rc = xCallback(&sFts5Api, (Fts5Context*)pNew, pUserData); if( rc!=SQLITE_OK ){ @@ -227672,16 +227672,16 @@ static int fts5ApiQueryPhrase( } } - fts5CloseMethod((sqlite3_vtab_cursor*)pNew); + fts5CloseMethod((tdsqlite3_vtab_cursor*)pNew); return rc; } static void fts5ApiInvoke( Fts5Auxiliary *pAux, Fts5Cursor *pCsr, - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ assert( pCsr->pAux==0 ); pCsr->pAux = pAux; @@ -227698,9 +227698,9 @@ static Fts5Cursor *fts5CursorFromCsrid(Fts5Global *pGlobal, i64 iCsrId){ } static void fts5ApiCallback( - sqlite3_context *context, + tdsqlite3_context *context, int argc, - sqlite3_value **argv + tdsqlite3_value **argv ){ Fts5Auxiliary *pAux; @@ -227708,14 +227708,14 @@ static void fts5ApiCallback( i64 iCsrId; assert( argc>=1 ); - pAux = (Fts5Auxiliary*)sqlite3_user_data(context); - iCsrId = sqlite3_value_int64(argv[0]); + pAux = (Fts5Auxiliary*)tdsqlite3_user_data(context); + iCsrId = tdsqlite3_value_int64(argv[0]); pCsr = fts5CursorFromCsrid(pAux->pGlobal, iCsrId); if( pCsr==0 || pCsr->ePlan==0 ){ - char *zErr = sqlite3_mprintf("no such cursor: %lld", iCsrId); - sqlite3_result_error(context, zErr, -1); - sqlite3_free(zErr); + char *zErr = tdsqlite3_mprintf("no such cursor: %lld", iCsrId); + tdsqlite3_result_error(context, zErr, -1); + tdsqlite3_free(zErr); }else{ fts5ApiInvoke(pAux, pCsr, context, argc-1, &argv[1]); } @@ -227726,7 +227726,7 @@ static void fts5ApiCallback( ** Given cursor id iId, return a pointer to the corresponding Fts5Table ** object. Or NULL If the cursor id does not exist. */ -static Fts5Table *sqlite3Fts5TableFromCsrid( +static Fts5Table *tdsqlite3Fts5TableFromCsrid( Fts5Global *pGlobal, /* FTS5 global context for db handle */ i64 iCsrId /* Id of cursor to find */ ){ @@ -227740,7 +227740,7 @@ static Fts5Table *sqlite3Fts5TableFromCsrid( /* ** Return a "position-list blob" corresponding to the current position of -** cursor pCsr via sqlite3_result_blob(). A position-list blob contains +** cursor pCsr via tdsqlite3_result_blob(). A position-list blob contains ** the current position-list for each phrase in the query associated with ** cursor pCsr. ** @@ -227753,10 +227753,10 @@ static Fts5Table *sqlite3Fts5TableFromCsrid( ** list 1. And so on. There is no size field for the final position list, ** as it can be derived from the total size of the blob. */ -static int fts5PoslistBlob(sqlite3_context *pCtx, Fts5Cursor *pCsr){ +static int fts5PoslistBlob(tdsqlite3_context *pCtx, Fts5Cursor *pCsr){ int i; int rc = SQLITE_OK; - int nPhrase = sqlite3Fts5ExprPhraseCount(pCsr->pExpr); + int nPhrase = tdsqlite3Fts5ExprPhraseCount(pCsr->pExpr); Fts5Buffer val; memset(&val, 0, sizeof(Fts5Buffer)); @@ -227766,16 +227766,16 @@ static int fts5PoslistBlob(sqlite3_context *pCtx, Fts5Cursor *pCsr){ /* Append the varints */ for(i=0; i<(nPhrase-1); i++){ const u8 *dummy; - int nByte = sqlite3Fts5ExprPoslist(pCsr->pExpr, i, &dummy); - sqlite3Fts5BufferAppendVarint(&rc, &val, nByte); + int nByte = tdsqlite3Fts5ExprPoslist(pCsr->pExpr, i, &dummy); + tdsqlite3Fts5BufferAppendVarint(&rc, &val, nByte); } /* Append the position lists */ for(i=0; ipExpr, i, &pPoslist); - sqlite3Fts5BufferAppendBlob(&rc, &val, nPoslist, pPoslist); + nPoslist = tdsqlite3Fts5ExprPoslist(pCsr->pExpr, i, &pPoslist); + tdsqlite3Fts5BufferAppendBlob(&rc, &val, nPoslist, pPoslist); } break; @@ -227785,16 +227785,16 @@ static int fts5PoslistBlob(sqlite3_context *pCtx, Fts5Cursor *pCsr){ for(i=0; rc==SQLITE_OK && i<(nPhrase-1); i++){ const u8 *dummy; int nByte; - rc = sqlite3Fts5ExprPhraseCollist(pCsr->pExpr, i, &dummy, &nByte); - sqlite3Fts5BufferAppendVarint(&rc, &val, nByte); + rc = tdsqlite3Fts5ExprPhraseCollist(pCsr->pExpr, i, &dummy, &nByte); + tdsqlite3Fts5BufferAppendVarint(&rc, &val, nByte); } /* Append the position lists */ for(i=0; rc==SQLITE_OK && ipExpr, i, &pPoslist, &nPoslist); - sqlite3Fts5BufferAppendBlob(&rc, &val, nPoslist, pPoslist); + rc = tdsqlite3Fts5ExprPhraseCollist(pCsr->pExpr, i, &pPoslist, &nPoslist); + tdsqlite3Fts5BufferAppendBlob(&rc, &val, nPoslist, pPoslist); } break; @@ -227802,7 +227802,7 @@ static int fts5PoslistBlob(sqlite3_context *pCtx, Fts5Cursor *pCsr){ break; } - sqlite3_result_blob(pCtx, val.p, val.n, sqlite3_free); + tdsqlite3_result_blob(pCtx, val.p, val.n, tdsqlite3_free); return rc; } @@ -227811,8 +227811,8 @@ static int fts5PoslistBlob(sqlite3_context *pCtx, Fts5Cursor *pCsr){ ** the row that the supplied cursor currently points to. */ static int fts5ColumnMethod( - sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ - sqlite3_context *pCtx, /* Context for sqlite3_result_xxx() calls */ + tdsqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ + tdsqlite3_context *pCtx, /* Context for tdsqlite3_result_xxx() calls */ int iCol /* Index of column to read value from */ ){ Fts5FullTable *pTab = (Fts5FullTable*)(pCursor->pVtab); @@ -227824,7 +227824,7 @@ static int fts5ColumnMethod( if( pCsr->ePlan==FTS5_PLAN_SPECIAL ){ if( iCol==pConfig->nCol ){ - sqlite3_result_int64(pCtx, pCsr->iSpecial); + tdsqlite3_result_int64(pCtx, pCsr->iSpecial); } }else @@ -227833,7 +227833,7 @@ static int fts5ColumnMethod( ** as the table. Return the cursor integer id number. This value is only ** useful in that it may be passed as the first argument to an FTS5 ** auxiliary function. */ - sqlite3_result_int64(pCtx, pCsr->iCsrId); + tdsqlite3_result_int64(pCtx, pCsr->iCsrId); }else if( iCol==pConfig->nCol+1 ){ /* The value of the "rank" column. */ @@ -227851,7 +227851,7 @@ static int fts5ColumnMethod( pConfig->pzErrmsg = &pTab->p.base.zErrMsg; rc = fts5SeekCursor(pCsr, 1); if( rc==SQLITE_OK ){ - sqlite3_result_value(pCtx, sqlite3_column_value(pCsr->pStmt, iCol+1)); + tdsqlite3_result_value(pCtx, tdsqlite3_column_value(pCsr->pStmt, iCol+1)); } pConfig->pzErrmsg = 0; } @@ -227864,10 +227864,10 @@ static int fts5ColumnMethod( ** virtual table. */ static int fts5FindFunctionMethod( - sqlite3_vtab *pVtab, /* Virtual table handle */ + tdsqlite3_vtab *pVtab, /* Virtual table handle */ int nUnused, /* Number of SQL function arguments */ const char *zName, /* Name of SQL function */ - void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), /* OUT: Result */ + void (**pxFunc)(tdsqlite3_context*,int,tdsqlite3_value**), /* OUT: Result */ void **ppArg /* OUT: User data for *pxFunc */ ){ Fts5FullTable *pTab = (Fts5FullTable*)pVtab; @@ -227889,16 +227889,16 @@ static int fts5FindFunctionMethod( ** Implementation of FTS5 xRename method. Rename an fts5 table. */ static int fts5RenameMethod( - sqlite3_vtab *pVtab, /* Virtual table handle */ + tdsqlite3_vtab *pVtab, /* Virtual table handle */ const char *zName /* New name of table */ ){ Fts5FullTable *pTab = (Fts5FullTable*)pVtab; - return sqlite3Fts5StorageRename(pTab->pStorage, zName); + return tdsqlite3Fts5StorageRename(pTab->pStorage, zName); } -static int sqlite3Fts5FlushToDisk(Fts5Table *pTab){ +static int tdsqlite3Fts5FlushToDisk(Fts5Table *pTab){ fts5TripCursors((Fts5FullTable*)pTab); - return sqlite3Fts5StorageSync(((Fts5FullTable*)pTab)->pStorage); + return tdsqlite3Fts5StorageSync(((Fts5FullTable*)pTab)->pStorage); } /* @@ -227906,10 +227906,10 @@ static int sqlite3Fts5FlushToDisk(Fts5Table *pTab){ ** ** Flush the contents of the pending-terms table to disk. */ -static int fts5SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ +static int fts5SavepointMethod(tdsqlite3_vtab *pVtab, int iSavepoint){ UNUSED_PARAM(iSavepoint); /* Call below is a no-op for NDEBUG builds */ fts5CheckTransactionState((Fts5FullTable*)pVtab, FTS5_SAVEPOINT, iSavepoint); - return sqlite3Fts5FlushToDisk((Fts5Table*)pVtab); + return tdsqlite3Fts5FlushToDisk((Fts5Table*)pVtab); } /* @@ -227917,10 +227917,10 @@ static int fts5SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ ** ** This is a no-op. */ -static int fts5ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ +static int fts5ReleaseMethod(tdsqlite3_vtab *pVtab, int iSavepoint){ UNUSED_PARAM(iSavepoint); /* Call below is a no-op for NDEBUG builds */ fts5CheckTransactionState((Fts5FullTable*)pVtab, FTS5_RELEASE, iSavepoint); - return sqlite3Fts5FlushToDisk((Fts5Table*)pVtab); + return tdsqlite3Fts5FlushToDisk((Fts5Table*)pVtab); } /* @@ -227928,12 +227928,12 @@ static int fts5ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ ** ** Discard the contents of the pending terms table. */ -static int fts5RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){ +static int fts5RollbackToMethod(tdsqlite3_vtab *pVtab, int iSavepoint){ Fts5FullTable *pTab = (Fts5FullTable*)pVtab; UNUSED_PARAM(iSavepoint); /* Call below is a no-op for NDEBUG builds */ fts5CheckTransactionState(pTab, FTS5_ROLLBACKTO, iSavepoint); fts5TripCursors(pTab); - return sqlite3Fts5StorageRollback(pTab->pStorage); + return tdsqlite3Fts5StorageRollback(pTab->pStorage); } /* @@ -227947,15 +227947,15 @@ static int fts5CreateAux( void(*xDestroy)(void*) /* Destructor for pUserData */ ){ Fts5Global *pGlobal = (Fts5Global*)pApi; - int rc = sqlite3_overload_function(pGlobal->db, zName, -1); + int rc = tdsqlite3_overload_function(pGlobal->db, zName, -1); if( rc==SQLITE_OK ){ Fts5Auxiliary *pAux; - sqlite3_int64 nName; /* Size of zName in bytes, including \0 */ - sqlite3_int64 nByte; /* Bytes of space to allocate */ + tdsqlite3_int64 nName; /* Size of zName in bytes, including \0 */ + tdsqlite3_int64 nByte; /* Bytes of space to allocate */ nName = strlen(zName) + 1; nByte = sizeof(Fts5Auxiliary) + nName; - pAux = (Fts5Auxiliary*)sqlite3_malloc64(nByte); + pAux = (Fts5Auxiliary*)tdsqlite3_malloc64(nByte); if( pAux ){ memset(pAux, 0, (size_t)nByte); pAux->zFunc = (char*)&pAux[1]; @@ -227987,13 +227987,13 @@ static int fts5CreateTokenizer( ){ Fts5Global *pGlobal = (Fts5Global*)pApi; Fts5TokenizerModule *pNew; - sqlite3_int64 nName; /* Size of zName and its \0 terminator */ - sqlite3_int64 nByte; /* Bytes of space to allocate */ + tdsqlite3_int64 nName; /* Size of zName and its \0 terminator */ + tdsqlite3_int64 nByte; /* Bytes of space to allocate */ int rc = SQLITE_OK; nName = strlen(zName) + 1; nByte = sizeof(Fts5TokenizerModule) + nName; - pNew = (Fts5TokenizerModule*)sqlite3_malloc64(nByte); + pNew = (Fts5TokenizerModule*)tdsqlite3_malloc64(nByte); if( pNew ){ memset(pNew, 0, (size_t)nByte); pNew->zName = (char*)&pNew[1]; @@ -228023,7 +228023,7 @@ static Fts5TokenizerModule *fts5LocateTokenizer( pMod = pGlobal->pDfltTok; }else{ for(pMod=pGlobal->pTok; pMod; pMod=pMod->pNext){ - if( sqlite3_stricmp(zName, pMod->zName)==0 ) break; + if( tdsqlite3_stricmp(zName, pMod->zName)==0 ) break; } } @@ -228055,7 +228055,7 @@ static int fts5FindTokenizer( return rc; } -static int sqlite3Fts5GetTokenizer( +static int tdsqlite3Fts5GetTokenizer( Fts5Global *pGlobal, const char **azArg, int nArg, @@ -228070,12 +228070,12 @@ static int sqlite3Fts5GetTokenizer( if( pMod==0 ){ assert( nArg>0 ); rc = SQLITE_ERROR; - *pzErr = sqlite3_mprintf("no such tokenizer: %s", azArg[0]); + *pzErr = tdsqlite3_mprintf("no such tokenizer: %s", azArg[0]); }else{ rc = pMod->x.xCreate(pMod->pUserData, &azArg[1], (nArg?nArg-1:0), ppTok); *ppTokApi = &pMod->x; if( rc!=SQLITE_OK && pzErr ){ - *pzErr = sqlite3_mprintf("error in tokenizer constructor"); + *pzErr = tdsqlite3_mprintf("error in tokenizer constructor"); } } @@ -228095,28 +228095,28 @@ static void fts5ModuleDestroy(void *pCtx){ for(pAux=pGlobal->pAux; pAux; pAux=pNextAux){ pNextAux = pAux->pNext; if( pAux->xDestroy ) pAux->xDestroy(pAux->pUserData); - sqlite3_free(pAux); + tdsqlite3_free(pAux); } for(pTok=pGlobal->pTok; pTok; pTok=pNextTok){ pNextTok = pTok->pNext; if( pTok->xDestroy ) pTok->xDestroy(pTok->pUserData); - sqlite3_free(pTok); + tdsqlite3_free(pTok); } - sqlite3_free(pGlobal); + tdsqlite3_free(pGlobal); } static void fts5Fts5Func( - sqlite3_context *pCtx, /* Function call context */ + tdsqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ - sqlite3_value **apArg /* Function arguments */ + tdsqlite3_value **apArg /* Function arguments */ ){ - Fts5Global *pGlobal = (Fts5Global*)sqlite3_user_data(pCtx); + Fts5Global *pGlobal = (Fts5Global*)tdsqlite3_user_data(pCtx); fts5_api **ppApi; UNUSED_PARAM(nArg); assert( nArg==1 ); - ppApi = (fts5_api**)sqlite3_value_pointer(apArg[0], "fts5_api_ptr"); + ppApi = (fts5_api**)tdsqlite3_value_pointer(apArg[0], "fts5_api_ptr"); if( ppApi ) *ppApi = &pGlobal->api; } @@ -228124,13 +228124,13 @@ static void fts5Fts5Func( ** Implementation of fts5_source_id() function. */ static void fts5SourceIdFunc( - sqlite3_context *pCtx, /* Function call context */ + tdsqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ - sqlite3_value **apUnused /* Function arguments */ + tdsqlite3_value **apUnused /* Function arguments */ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - sqlite3_result_text(pCtx, "fts5: 2020-01-22 18:38:59 f6affdd41608946fcfcea914ece149038a8b25a62bbe719ed2561c649b86d824", -1, SQLITE_TRANSIENT); + tdsqlite3_result_text(pCtx, "fts5: 2020-01-22 18:38:59 f6affdd41608946fcfcea914ece149038a8b25a62bbe719ed2561c649b86d824", -1, SQLITE_TRANSIENT); } /* @@ -228143,13 +228143,13 @@ static int fts5ShadowName(const char *zName){ }; unsigned int i; for(i=0; iapi.xCreateFunction = fts5CreateAux; pGlobal->api.xCreateTokenizer = fts5CreateTokenizer; pGlobal->api.xFindTokenizer = fts5FindTokenizer; - rc = sqlite3_create_module_v2(db, "fts5", &fts5Mod, p, fts5ModuleDestroy); - if( rc==SQLITE_OK ) rc = sqlite3Fts5IndexInit(db); - if( rc==SQLITE_OK ) rc = sqlite3Fts5ExprInit(pGlobal, db); - if( rc==SQLITE_OK ) rc = sqlite3Fts5AuxInit(&pGlobal->api); - if( rc==SQLITE_OK ) rc = sqlite3Fts5TokenizerInit(&pGlobal->api); - if( rc==SQLITE_OK ) rc = sqlite3Fts5VocabInit(pGlobal, db); + rc = tdsqlite3_create_module_v2(db, "fts5", &fts5Mod, p, fts5ModuleDestroy); + if( rc==SQLITE_OK ) rc = tdsqlite3Fts5IndexInit(db); + if( rc==SQLITE_OK ) rc = tdsqlite3Fts5ExprInit(pGlobal, db); + if( rc==SQLITE_OK ) rc = tdsqlite3Fts5AuxInit(&pGlobal->api); + if( rc==SQLITE_OK ) rc = tdsqlite3Fts5TokenizerInit(&pGlobal->api); + if( rc==SQLITE_OK ) rc = tdsqlite3Fts5VocabInit(pGlobal, db); if( rc==SQLITE_OK ){ - rc = sqlite3_create_function( + rc = tdsqlite3_create_function( db, "fts5", 1, SQLITE_UTF8, p, fts5Fts5Func, 0, 0 ); } if( rc==SQLITE_OK ){ - rc = sqlite3_create_function( + rc = tdsqlite3_create_function( db, "fts5_source_id", 0, SQLITE_UTF8, p, fts5SourceIdFunc, 0, 0 ); } @@ -228213,8 +228213,8 @@ static int fts5Init(sqlite3 *db){ ** its entry point to enable the matchinfo() demo. */ #ifdef SQLITE_FTS5_ENABLE_TEST_MI if( rc==SQLITE_OK ){ - extern int sqlite3Fts5TestRegisterMatchinfo(sqlite3*); - rc = sqlite3Fts5TestRegisterMatchinfo(db); + extern int tdsqlite3Fts5TestRegisterMatchinfo(tdsqlite3*); + rc = tdsqlite3Fts5TestRegisterMatchinfo(db); } #endif @@ -228224,20 +228224,20 @@ static int fts5Init(sqlite3 *db){ /* ** The following functions are used to register the module with SQLite. If ** this module is being built as part of the SQLite core (SQLITE_CORE is -** defined), then sqlite3_open() will call sqlite3Fts5Init() directly. +** defined), then tdsqlite3_open() will call tdsqlite3Fts5Init() directly. ** ** Or, if this module is being built as a loadable extension, -** sqlite3Fts5Init() is omitted and the two standard entry points -** sqlite3_fts_init() and sqlite3_fts5_init() defined instead. +** tdsqlite3Fts5Init() is omitted and the two standard entry points +** tdsqlite3_fts_init() and tdsqlite3_fts5_init() defined instead. */ #ifndef SQLITE_CORE #ifdef _WIN32 __declspec(dllexport) #endif -SQLITE_API int sqlite3_fts_init( - sqlite3 *db, +SQLITE_API int tdsqlite3_fts_init( + tdsqlite3 *db, char **pzErrMsg, - const sqlite3_api_routines *pApi + const tdsqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi); (void)pzErrMsg; /* Unused parameter */ @@ -228247,17 +228247,17 @@ SQLITE_API int sqlite3_fts_init( #ifdef _WIN32 __declspec(dllexport) #endif -SQLITE_API int sqlite3_fts5_init( - sqlite3 *db, +SQLITE_API int tdsqlite3_fts5_init( + tdsqlite3 *db, char **pzErrMsg, - const sqlite3_api_routines *pApi + const tdsqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi); (void)pzErrMsg; /* Unused parameter */ return fts5Init(db); } #else -SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3 *db){ +SQLITE_PRIVATE int tdsqlite3Fts5Init(tdsqlite3 *db){ return fts5Init(db); } #endif @@ -228286,7 +228286,7 @@ struct Fts5Storage { int bTotalsValid; /* True if nTotalRow/aTotalSize[] are valid */ i64 nTotalRow; /* Total number of rows in FTS table */ i64 *aTotalSize; /* Total sizes of each column */ - sqlite3_stmt *aStmt[11]; + tdsqlite3_stmt *aStmt[11]; }; @@ -228318,7 +228318,7 @@ struct Fts5Storage { static int fts5StorageGetStmt( Fts5Storage *p, /* Storage handle */ int eStmt, /* FTS5_STMT_XXX constant */ - sqlite3_stmt **ppStmt, /* OUT: Prepared statement handle */ + tdsqlite3_stmt **ppStmt, /* OUT: Prepared statement handle */ char **pzErrMsg /* OUT: Error message (if any) */ ){ int rc = SQLITE_OK; @@ -228354,21 +228354,21 @@ static int fts5StorageGetStmt( switch( eStmt ){ case FTS5_STMT_SCAN: - zSql = sqlite3_mprintf(azStmt[eStmt], + zSql = tdsqlite3_mprintf(azStmt[eStmt], pC->zContentExprlist, pC->zContent ); break; case FTS5_STMT_SCAN_ASC: case FTS5_STMT_SCAN_DESC: - zSql = sqlite3_mprintf(azStmt[eStmt], pC->zContentExprlist, + zSql = tdsqlite3_mprintf(azStmt[eStmt], pC->zContentExprlist, pC->zContent, pC->zContentRowid, pC->zContentRowid, pC->zContentRowid ); break; case FTS5_STMT_LOOKUP: - zSql = sqlite3_mprintf(azStmt[eStmt], + zSql = tdsqlite3_mprintf(azStmt[eStmt], pC->zContentExprlist, pC->zContent, pC->zContentRowid ); break; @@ -228379,21 +228379,21 @@ static int fts5StorageGetStmt( char *zBind; int i; - zBind = sqlite3_malloc64(1 + nCol*2); + zBind = tdsqlite3_malloc64(1 + nCol*2); if( zBind ){ for(i=0; izDb, pC->zName, zBind); - sqlite3_free(zBind); + zSql = tdsqlite3_mprintf(azStmt[eStmt], pC->zDb, pC->zName, zBind); + tdsqlite3_free(zBind); } break; } default: - zSql = sqlite3_mprintf(azStmt[eStmt], pC->zDb, pC->zName); + zSql = tdsqlite3_mprintf(azStmt[eStmt], pC->zDb, pC->zName); break; } @@ -228403,23 +228403,23 @@ static int fts5StorageGetStmt( int f = SQLITE_PREPARE_PERSISTENT; if( eStmt>FTS5_STMT_LOOKUP ) f |= SQLITE_PREPARE_NO_VTAB; p->pConfig->bLock++; - rc = sqlite3_prepare_v3(pC->db, zSql, -1, f, &p->aStmt[eStmt], 0); + rc = tdsqlite3_prepare_v3(pC->db, zSql, -1, f, &p->aStmt[eStmt], 0); p->pConfig->bLock--; - sqlite3_free(zSql); + tdsqlite3_free(zSql); if( rc!=SQLITE_OK && pzErrMsg ){ - *pzErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pC->db)); + *pzErrMsg = tdsqlite3_mprintf("%s", tdsqlite3_errmsg(pC->db)); } } } *ppStmt = p->aStmt[eStmt]; - sqlite3_reset(*ppStmt); + tdsqlite3_reset(*ppStmt); return rc; } static int fts5ExecPrintf( - sqlite3 *db, + tdsqlite3 *db, char **pzErr, const char *zFormat, ... @@ -228429,13 +228429,13 @@ static int fts5ExecPrintf( char *zSql; va_start(ap, zFormat); - zSql = sqlite3_vmprintf(zFormat, ap); + zSql = tdsqlite3_vmprintf(zFormat, ap); if( zSql==0 ){ rc = SQLITE_NOMEM; }else{ - rc = sqlite3_exec(db, zSql, 0, 0, pzErr); - sqlite3_free(zSql); + rc = tdsqlite3_exec(db, zSql, 0, 0, pzErr); + tdsqlite3_free(zSql); } va_end(ap); @@ -228446,7 +228446,7 @@ static int fts5ExecPrintf( ** Drop all shadow tables. Return SQLITE_OK if successful or an SQLite error ** code otherwise. */ -static int sqlite3Fts5DropAll(Fts5Config *pConfig){ +static int tdsqlite3Fts5DropAll(Fts5Config *pConfig){ int rc = fts5ExecPrintf(pConfig->db, 0, "DROP TABLE IF EXISTS %Q.'%q_data';" "DROP TABLE IF EXISTS %Q.'%q_idx';" @@ -228484,9 +228484,9 @@ static void fts5StorageRenameOne( } } -static int sqlite3Fts5StorageRename(Fts5Storage *pStorage, const char *zName){ +static int tdsqlite3Fts5StorageRename(Fts5Storage *pStorage, const char *zName){ Fts5Config *pConfig = pStorage->pConfig; - int rc = sqlite3Fts5StorageSync(pStorage); + int rc = tdsqlite3Fts5StorageSync(pStorage); fts5StorageRenameOne(pConfig, &rc, "data", zName); fts5StorageRenameOne(pConfig, &rc, "idx", zName); @@ -228504,7 +228504,7 @@ static int sqlite3Fts5StorageRename(Fts5Storage *pStorage, const char *zName){ ** Create the shadow table named zPost, with definition zDefn. Return ** SQLITE_OK if successful, or an SQLite error code otherwise. */ -static int sqlite3Fts5CreateTable( +static int tdsqlite3Fts5CreateTable( Fts5Config *pConfig, /* FTS5 configuration */ const char *zPost, /* Shadow table to create (e.g. "content") */ const char *zDefn, /* Columns etc. for shadow table */ @@ -228522,11 +228522,11 @@ static int sqlite3Fts5CreateTable( "" ); if( zErr ){ - *pzErr = sqlite3_mprintf( + *pzErr = tdsqlite3_mprintf( "fts5: error creating shadow table %q_%s: %s", pConfig->zName, zPost, zErr ); - sqlite3_free(zErr); + tdsqlite3_free(zErr); } return rc; @@ -228539,7 +228539,7 @@ static int sqlite3Fts5CreateTable( ** If successful, set *pp to point to the new object and return SQLITE_OK. ** Otherwise, set *pp to NULL and return an SQLite error code. */ -static int sqlite3Fts5StorageOpen( +static int tdsqlite3Fts5StorageOpen( Fts5Config *pConfig, Fts5Index *pIndex, int bCreate, @@ -228548,11 +228548,11 @@ static int sqlite3Fts5StorageOpen( ){ int rc = SQLITE_OK; Fts5Storage *p; /* New object */ - sqlite3_int64 nByte; /* Bytes of space to allocate */ + tdsqlite3_int64 nByte; /* Bytes of space to allocate */ nByte = sizeof(Fts5Storage) /* Fts5Storage object */ + pConfig->nCol * sizeof(i64); /* Fts5Storage.aTotalSize[] */ - *pp = p = (Fts5Storage*)sqlite3_malloc64(nByte); + *pp = p = (Fts5Storage*)tdsqlite3_malloc64(nByte); if( !p ) return SQLITE_NOMEM; memset(p, 0, (size_t)nByte); @@ -228563,59 +228563,59 @@ static int sqlite3Fts5StorageOpen( if( bCreate ){ if( pConfig->eContent==FTS5_CONTENT_NORMAL ){ int nDefn = 32 + pConfig->nCol*10; - char *zDefn = sqlite3_malloc64(32 + (sqlite3_int64)pConfig->nCol * 10); + char *zDefn = tdsqlite3_malloc64(32 + (tdsqlite3_int64)pConfig->nCol * 10); if( zDefn==0 ){ rc = SQLITE_NOMEM; }else{ int i; int iOff; - sqlite3_snprintf(nDefn, zDefn, "id INTEGER PRIMARY KEY"); + tdsqlite3_snprintf(nDefn, zDefn, "id INTEGER PRIMARY KEY"); iOff = (int)strlen(zDefn); for(i=0; inCol; i++){ - sqlite3_snprintf(nDefn-iOff, &zDefn[iOff], ", c%d", i); + tdsqlite3_snprintf(nDefn-iOff, &zDefn[iOff], ", c%d", i); iOff += (int)strlen(&zDefn[iOff]); } - rc = sqlite3Fts5CreateTable(pConfig, "content", zDefn, 0, pzErr); + rc = tdsqlite3Fts5CreateTable(pConfig, "content", zDefn, 0, pzErr); } - sqlite3_free(zDefn); + tdsqlite3_free(zDefn); } if( rc==SQLITE_OK && pConfig->bColumnsize ){ - rc = sqlite3Fts5CreateTable( + rc = tdsqlite3Fts5CreateTable( pConfig, "docsize", "id INTEGER PRIMARY KEY, sz BLOB", 0, pzErr ); } if( rc==SQLITE_OK ){ - rc = sqlite3Fts5CreateTable( + rc = tdsqlite3Fts5CreateTable( pConfig, "config", "k PRIMARY KEY, v", 1, pzErr ); } if( rc==SQLITE_OK ){ - rc = sqlite3Fts5StorageConfigValue(p, "version", 0, FTS5_CURRENT_VERSION); + rc = tdsqlite3Fts5StorageConfigValue(p, "version", 0, FTS5_CURRENT_VERSION); } } if( rc ){ - sqlite3Fts5StorageClose(p); + tdsqlite3Fts5StorageClose(p); *pp = 0; } return rc; } /* -** Close a handle opened by an earlier call to sqlite3Fts5StorageOpen(). +** Close a handle opened by an earlier call to tdsqlite3Fts5StorageOpen(). */ -static int sqlite3Fts5StorageClose(Fts5Storage *p){ +static int tdsqlite3Fts5StorageClose(Fts5Storage *p){ int rc = SQLITE_OK; if( p ){ int i; /* Finalize all SQL statements */ for(i=0; iaStmt); i++){ - sqlite3_finalize(p->aStmt[i]); + tdsqlite3_finalize(p->aStmt[i]); } - sqlite3_free(p); + tdsqlite3_free(p); } return rc; } @@ -228645,7 +228645,7 @@ static int fts5StorageInsertCallback( if( (tflags & FTS5_TOKEN_COLOCATED)==0 || pCtx->szCol==0 ){ pCtx->szCol++; } - return sqlite3Fts5IndexWrite(pIdx, pCtx->iCol, pCtx->szCol-1, pToken, nToken); + return tdsqlite3Fts5IndexWrite(pIdx, pCtx->iCol, pCtx->szCol-1, pToken, nToken); } /* @@ -228656,40 +228656,40 @@ static int fts5StorageInsertCallback( static int fts5StorageDeleteFromIndex( Fts5Storage *p, i64 iDel, - sqlite3_value **apVal + tdsqlite3_value **apVal ){ Fts5Config *pConfig = p->pConfig; - sqlite3_stmt *pSeek = 0; /* SELECT to read row iDel from %_data */ + tdsqlite3_stmt *pSeek = 0; /* SELECT to read row iDel from %_data */ int rc; /* Return code */ - int rc2; /* sqlite3_reset() return code */ + int rc2; /* tdsqlite3_reset() return code */ int iCol; Fts5InsertCtx ctx; if( apVal==0 ){ rc = fts5StorageGetStmt(p, FTS5_STMT_LOOKUP, &pSeek, 0); if( rc!=SQLITE_OK ) return rc; - sqlite3_bind_int64(pSeek, 1, iDel); - if( sqlite3_step(pSeek)!=SQLITE_ROW ){ - return sqlite3_reset(pSeek); + tdsqlite3_bind_int64(pSeek, 1, iDel); + if( tdsqlite3_step(pSeek)!=SQLITE_ROW ){ + return tdsqlite3_reset(pSeek); } } ctx.pStorage = p; ctx.iCol = -1; - rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 1, iDel); + rc = tdsqlite3Fts5IndexBeginWrite(p->pIndex, 1, iDel); for(iCol=1; rc==SQLITE_OK && iCol<=pConfig->nCol; iCol++){ if( pConfig->abUnindexed[iCol-1]==0 ){ const char *zText; int nText; if( pSeek ){ - zText = (const char*)sqlite3_column_text(pSeek, iCol); - nText = sqlite3_column_bytes(pSeek, iCol); + zText = (const char*)tdsqlite3_column_text(pSeek, iCol); + nText = tdsqlite3_column_bytes(pSeek, iCol); }else{ - zText = (const char*)sqlite3_value_text(apVal[iCol-1]); - nText = sqlite3_value_bytes(apVal[iCol-1]); + zText = (const char*)tdsqlite3_value_text(apVal[iCol-1]); + nText = tdsqlite3_value_bytes(apVal[iCol-1]); } ctx.szCol = 0; - rc = sqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT, + rc = tdsqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT, zText, nText, (void*)&ctx, fts5StorageInsertCallback ); p->aTotalSize[iCol-1] -= (i64)ctx.szCol; @@ -228697,7 +228697,7 @@ static int fts5StorageDeleteFromIndex( } p->nTotalRow--; - rc2 = sqlite3_reset(pSeek); + rc2 = tdsqlite3_reset(pSeek); if( rc==SQLITE_OK ) rc = rc2; return rc; } @@ -228718,14 +228718,14 @@ static int fts5StorageInsertDocsize( ){ int rc = SQLITE_OK; if( p->pConfig->bColumnsize ){ - sqlite3_stmt *pReplace = 0; + tdsqlite3_stmt *pReplace = 0; rc = fts5StorageGetStmt(p, FTS5_STMT_REPLACE_DOCSIZE, &pReplace, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pReplace, 1, iRowid); - sqlite3_bind_blob(pReplace, 2, pBuf->p, pBuf->n, SQLITE_STATIC); - sqlite3_step(pReplace); - rc = sqlite3_reset(pReplace); - sqlite3_bind_null(pReplace, 2); + tdsqlite3_bind_int64(pReplace, 1, iRowid); + tdsqlite3_bind_blob(pReplace, 2, pBuf->p, pBuf->n, SQLITE_STATIC); + tdsqlite3_step(pReplace); + rc = tdsqlite3_reset(pReplace); + tdsqlite3_bind_null(pReplace, 2); } } return rc; @@ -228744,7 +228744,7 @@ static int fts5StorageInsertDocsize( static int fts5StorageLoadTotals(Fts5Storage *p, int bCache){ int rc = SQLITE_OK; if( p->bTotalsValid==0 ){ - rc = sqlite3Fts5IndexGetAverages(p->pIndex, &p->nTotalRow, p->aTotalSize); + rc = tdsqlite3Fts5IndexGetAverages(p->pIndex, &p->nTotalRow, p->aTotalSize); p->bTotalsValid = bCache; } return rc; @@ -228764,14 +228764,14 @@ static int fts5StorageSaveTotals(Fts5Storage *p){ int rc = SQLITE_OK; memset(&buf, 0, sizeof(buf)); - sqlite3Fts5BufferAppendVarint(&rc, &buf, p->nTotalRow); + tdsqlite3Fts5BufferAppendVarint(&rc, &buf, p->nTotalRow); for(i=0; iaTotalSize[i]); + tdsqlite3Fts5BufferAppendVarint(&rc, &buf, p->aTotalSize[i]); } if( rc==SQLITE_OK ){ - rc = sqlite3Fts5IndexSetAverages(p->pIndex, buf.p, buf.n); + rc = tdsqlite3Fts5IndexSetAverages(p->pIndex, buf.p, buf.n); } - sqlite3_free(buf.p); + tdsqlite3_free(buf.p); return rc; } @@ -228779,10 +228779,10 @@ static int fts5StorageSaveTotals(Fts5Storage *p){ /* ** Remove a row from the FTS table. */ -static int sqlite3Fts5StorageDelete(Fts5Storage *p, i64 iDel, sqlite3_value **apVal){ +static int tdsqlite3Fts5StorageDelete(Fts5Storage *p, i64 iDel, tdsqlite3_value **apVal){ Fts5Config *pConfig = p->pConfig; int rc; - sqlite3_stmt *pDel = 0; + tdsqlite3_stmt *pDel = 0; assert( pConfig->eContent!=FTS5_CONTENT_NORMAL || apVal==0 ); rc = fts5StorageLoadTotals(p, 1); @@ -228796,9 +228796,9 @@ static int sqlite3Fts5StorageDelete(Fts5Storage *p, i64 iDel, sqlite3_value **ap if( rc==SQLITE_OK && pConfig->bColumnsize ){ rc = fts5StorageGetStmt(p, FTS5_STMT_DELETE_DOCSIZE, &pDel, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pDel, 1, iDel); - sqlite3_step(pDel); - rc = sqlite3_reset(pDel); + tdsqlite3_bind_int64(pDel, 1, iDel); + tdsqlite3_step(pDel); + rc = tdsqlite3_reset(pDel); } } @@ -228808,9 +228808,9 @@ static int sqlite3Fts5StorageDelete(Fts5Storage *p, i64 iDel, sqlite3_value **ap rc = fts5StorageGetStmt(p, FTS5_STMT_DELETE_CONTENT, &pDel, 0); } if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pDel, 1, iDel); - sqlite3_step(pDel); - rc = sqlite3_reset(pDel); + tdsqlite3_bind_int64(pDel, 1, iDel); + tdsqlite3_step(pDel); + rc = tdsqlite3_reset(pDel); } } @@ -228820,7 +228820,7 @@ static int sqlite3Fts5StorageDelete(Fts5Storage *p, i64 iDel, sqlite3_value **ap /* ** Delete all entries in the FTS5 index. */ -static int sqlite3Fts5StorageDeleteAll(Fts5Storage *p){ +static int tdsqlite3Fts5StorageDeleteAll(Fts5Storage *p){ Fts5Config *pConfig = p->pConfig; int rc; @@ -228843,24 +228843,24 @@ static int sqlite3Fts5StorageDeleteAll(Fts5Storage *p){ /* Reinitialize the %_data table. This call creates the initial structure ** and averages records. */ if( rc==SQLITE_OK ){ - rc = sqlite3Fts5IndexReinit(p->pIndex); + rc = tdsqlite3Fts5IndexReinit(p->pIndex); } if( rc==SQLITE_OK ){ - rc = sqlite3Fts5StorageConfigValue(p, "version", 0, FTS5_CURRENT_VERSION); + rc = tdsqlite3Fts5StorageConfigValue(p, "version", 0, FTS5_CURRENT_VERSION); } return rc; } -static int sqlite3Fts5StorageRebuild(Fts5Storage *p){ +static int tdsqlite3Fts5StorageRebuild(Fts5Storage *p){ Fts5Buffer buf = {0,0,0}; Fts5Config *pConfig = p->pConfig; - sqlite3_stmt *pScan = 0; + tdsqlite3_stmt *pScan = 0; Fts5InsertCtx ctx; int rc, rc2; memset(&ctx, 0, sizeof(Fts5InsertCtx)); ctx.pStorage = p; - rc = sqlite3Fts5StorageDeleteAll(p); + rc = tdsqlite3Fts5StorageDeleteAll(p); if( rc==SQLITE_OK ){ rc = fts5StorageLoadTotals(p, 1); } @@ -228869,24 +228869,24 @@ static int sqlite3Fts5StorageRebuild(Fts5Storage *p){ rc = fts5StorageGetStmt(p, FTS5_STMT_SCAN, &pScan, 0); } - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pScan) ){ - i64 iRowid = sqlite3_column_int64(pScan, 0); + while( rc==SQLITE_OK && SQLITE_ROW==tdsqlite3_step(pScan) ){ + i64 iRowid = tdsqlite3_column_int64(pScan, 0); - sqlite3Fts5BufferZero(&buf); - rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid); + tdsqlite3Fts5BufferZero(&buf); + rc = tdsqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid); for(ctx.iCol=0; rc==SQLITE_OK && ctx.iColnCol; ctx.iCol++){ ctx.szCol = 0; if( pConfig->abUnindexed[ctx.iCol]==0 ){ - const char *zText = (const char*)sqlite3_column_text(pScan, ctx.iCol+1); - int nText = sqlite3_column_bytes(pScan, ctx.iCol+1); - rc = sqlite3Fts5Tokenize(pConfig, + const char *zText = (const char*)tdsqlite3_column_text(pScan, ctx.iCol+1); + int nText = tdsqlite3_column_bytes(pScan, ctx.iCol+1); + rc = tdsqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT, zText, nText, (void*)&ctx, fts5StorageInsertCallback ); } - sqlite3Fts5BufferAppendVarint(&rc, &buf, ctx.szCol); + tdsqlite3Fts5BufferAppendVarint(&rc, &buf, ctx.szCol); p->aTotalSize[ctx.iCol] += (i64)ctx.szCol; } p->nTotalRow++; @@ -228895,8 +228895,8 @@ static int sqlite3Fts5StorageRebuild(Fts5Storage *p){ rc = fts5StorageInsertDocsize(p, iRowid, &buf); } } - sqlite3_free(buf.p); - rc2 = sqlite3_reset(pScan); + tdsqlite3_free(buf.p); + rc2 = tdsqlite3_reset(pScan); if( rc==SQLITE_OK ) rc = rc2; /* Write the averages record */ @@ -228906,16 +228906,16 @@ static int sqlite3Fts5StorageRebuild(Fts5Storage *p){ return rc; } -static int sqlite3Fts5StorageOptimize(Fts5Storage *p){ - return sqlite3Fts5IndexOptimize(p->pIndex); +static int tdsqlite3Fts5StorageOptimize(Fts5Storage *p){ + return tdsqlite3Fts5IndexOptimize(p->pIndex); } -static int sqlite3Fts5StorageMerge(Fts5Storage *p, int nMerge){ - return sqlite3Fts5IndexMerge(p->pIndex, nMerge); +static int tdsqlite3Fts5StorageMerge(Fts5Storage *p, int nMerge){ + return tdsqlite3Fts5IndexMerge(p->pIndex, nMerge); } -static int sqlite3Fts5StorageReset(Fts5Storage *p){ - return sqlite3Fts5IndexReset(p->pIndex); +static int tdsqlite3Fts5StorageReset(Fts5Storage *p){ + return tdsqlite3Fts5IndexReset(p->pIndex); } /* @@ -228930,16 +228930,16 @@ static int sqlite3Fts5StorageReset(Fts5Storage *p){ static int fts5StorageNewRowid(Fts5Storage *p, i64 *piRowid){ int rc = SQLITE_MISMATCH; if( p->pConfig->bColumnsize ){ - sqlite3_stmt *pReplace = 0; + tdsqlite3_stmt *pReplace = 0; rc = fts5StorageGetStmt(p, FTS5_STMT_REPLACE_DOCSIZE, &pReplace, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_null(pReplace, 1); - sqlite3_bind_null(pReplace, 2); - sqlite3_step(pReplace); - rc = sqlite3_reset(pReplace); + tdsqlite3_bind_null(pReplace, 1); + tdsqlite3_bind_null(pReplace, 2); + tdsqlite3_step(pReplace); + rc = tdsqlite3_reset(pReplace); } if( rc==SQLITE_OK ){ - *piRowid = sqlite3_last_insert_rowid(p->pConfig->db); + *piRowid = tdsqlite3_last_insert_rowid(p->pConfig->db); } } return rc; @@ -228948,9 +228948,9 @@ static int fts5StorageNewRowid(Fts5Storage *p, i64 *piRowid){ /* ** Insert a new row into the FTS content table. */ -static int sqlite3Fts5StorageContentInsert( +static int tdsqlite3Fts5StorageContentInsert( Fts5Storage *p, - sqlite3_value **apVal, + tdsqlite3_value **apVal, i64 *piRowid ){ Fts5Config *pConfig = p->pConfig; @@ -228958,23 +228958,23 @@ static int sqlite3Fts5StorageContentInsert( /* Insert the new row into the %_content table. */ if( pConfig->eContent!=FTS5_CONTENT_NORMAL ){ - if( sqlite3_value_type(apVal[1])==SQLITE_INTEGER ){ - *piRowid = sqlite3_value_int64(apVal[1]); + if( tdsqlite3_value_type(apVal[1])==SQLITE_INTEGER ){ + *piRowid = tdsqlite3_value_int64(apVal[1]); }else{ rc = fts5StorageNewRowid(p, piRowid); } }else{ - sqlite3_stmt *pInsert = 0; /* Statement to write %_content table */ + tdsqlite3_stmt *pInsert = 0; /* Statement to write %_content table */ int i; /* Counter variable */ rc = fts5StorageGetStmt(p, FTS5_STMT_INSERT_CONTENT, &pInsert, 0); for(i=1; rc==SQLITE_OK && i<=pConfig->nCol+1; i++){ - rc = sqlite3_bind_value(pInsert, i, apVal[i]); + rc = tdsqlite3_bind_value(pInsert, i, apVal[i]); } if( rc==SQLITE_OK ){ - sqlite3_step(pInsert); - rc = sqlite3_reset(pInsert); + tdsqlite3_step(pInsert); + rc = tdsqlite3_reset(pInsert); } - *piRowid = sqlite3_last_insert_rowid(pConfig->db); + *piRowid = tdsqlite3_last_insert_rowid(pConfig->db); } return rc; @@ -228983,9 +228983,9 @@ static int sqlite3Fts5StorageContentInsert( /* ** Insert new entries into the FTS index and %_docsize table. */ -static int sqlite3Fts5StorageIndexInsert( +static int tdsqlite3Fts5StorageIndexInsert( Fts5Storage *p, - sqlite3_value **apVal, + tdsqlite3_value **apVal, i64 iRowid ){ Fts5Config *pConfig = p->pConfig; @@ -228998,21 +228998,21 @@ static int sqlite3Fts5StorageIndexInsert( rc = fts5StorageLoadTotals(p, 1); if( rc==SQLITE_OK ){ - rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid); + rc = tdsqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid); } for(ctx.iCol=0; rc==SQLITE_OK && ctx.iColnCol; ctx.iCol++){ ctx.szCol = 0; if( pConfig->abUnindexed[ctx.iCol]==0 ){ - const char *zText = (const char*)sqlite3_value_text(apVal[ctx.iCol+2]); - int nText = sqlite3_value_bytes(apVal[ctx.iCol+2]); - rc = sqlite3Fts5Tokenize(pConfig, + const char *zText = (const char*)tdsqlite3_value_text(apVal[ctx.iCol+2]); + int nText = tdsqlite3_value_bytes(apVal[ctx.iCol+2]); + rc = tdsqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT, zText, nText, (void*)&ctx, fts5StorageInsertCallback ); } - sqlite3Fts5BufferAppendVarint(&rc, &buf, ctx.szCol); + tdsqlite3Fts5BufferAppendVarint(&rc, &buf, ctx.szCol); p->aTotalSize[ctx.iCol] += (i64)ctx.szCol; } p->nTotalRow++; @@ -229021,7 +229021,7 @@ static int sqlite3Fts5StorageIndexInsert( if( rc==SQLITE_OK ){ rc = fts5StorageInsertDocsize(p, iRowid, &buf); } - sqlite3_free(buf.p); + tdsqlite3_free(buf.p); return rc; } @@ -229031,28 +229031,28 @@ static int fts5StorageCount(Fts5Storage *p, const char *zSuffix, i64 *pnRow){ char *zSql; int rc; - zSql = sqlite3_mprintf("SELECT count(*) FROM %Q.'%q_%s'", + zSql = tdsqlite3_mprintf("SELECT count(*) FROM %Q.'%q_%s'", pConfig->zDb, pConfig->zName, zSuffix ); if( zSql==0 ){ rc = SQLITE_NOMEM; }else{ - sqlite3_stmt *pCnt = 0; - rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pCnt, 0); + tdsqlite3_stmt *pCnt = 0; + rc = tdsqlite3_prepare_v2(pConfig->db, zSql, -1, &pCnt, 0); if( rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pCnt) ){ - *pnRow = sqlite3_column_int64(pCnt, 0); + if( SQLITE_ROW==tdsqlite3_step(pCnt) ){ + *pnRow = tdsqlite3_column_int64(pCnt, 0); } - rc = sqlite3_finalize(pCnt); + rc = tdsqlite3_finalize(pCnt); } } - sqlite3_free(zSql); + tdsqlite3_free(zSql); return rc; } /* -** Context object used by sqlite3Fts5StorageIntegrity(). +** Context object used by tdsqlite3Fts5StorageIntegrity(). */ typedef struct Fts5IntegrityCtx Fts5IntegrityCtx; struct Fts5IntegrityCtx { @@ -229109,20 +229109,20 @@ static int fts5StorageIntegrityCallback( break; } - rc = sqlite3Fts5TermsetAdd(pTermset, 0, pToken, nToken, &bPresent); + rc = tdsqlite3Fts5TermsetAdd(pTermset, 0, pToken, nToken, &bPresent); if( rc==SQLITE_OK && bPresent==0 ){ - pCtx->cksum ^= sqlite3Fts5IndexEntryCksum( + pCtx->cksum ^= tdsqlite3Fts5IndexEntryCksum( pCtx->iRowid, iCol, iPos, 0, pToken, nToken ); } for(ii=0; rc==SQLITE_OK && iipConfig->nPrefix; ii++){ const int nChar = pCtx->pConfig->aPrefix[ii]; - int nByte = sqlite3Fts5IndexCharlenToBytelen(pToken, nToken, nChar); + int nByte = tdsqlite3Fts5IndexCharlenToBytelen(pToken, nToken, nChar); if( nByte ){ - rc = sqlite3Fts5TermsetAdd(pTermset, ii+1, pToken, nByte, &bPresent); + rc = tdsqlite3Fts5TermsetAdd(pTermset, ii+1, pToken, nByte, &bPresent); if( bPresent==0 ){ - pCtx->cksum ^= sqlite3Fts5IndexEntryCksum( + pCtx->cksum ^= tdsqlite3Fts5IndexEntryCksum( pCtx->iRowid, iCol, iPos, ii+1, pToken, nByte ); } @@ -229138,17 +229138,17 @@ static int fts5StorageIntegrityCallback( ** some other SQLite error code if an error occurs while attempting to ** determine this. */ -static int sqlite3Fts5StorageIntegrity(Fts5Storage *p){ +static int tdsqlite3Fts5StorageIntegrity(Fts5Storage *p){ Fts5Config *pConfig = p->pConfig; int rc; /* Return code */ int *aColSize; /* Array of size pConfig->nCol */ i64 *aTotalSize; /* Array of size pConfig->nCol */ Fts5IntegrityCtx ctx; - sqlite3_stmt *pScan; + tdsqlite3_stmt *pScan; memset(&ctx, 0, sizeof(Fts5IntegrityCtx)); ctx.pConfig = p->pConfig; - aTotalSize = (i64*)sqlite3_malloc64(pConfig->nCol*(sizeof(int)+sizeof(i64))); + aTotalSize = (i64*)tdsqlite3_malloc64(pConfig->nCol*(sizeof(int)+sizeof(i64))); if( !aTotalSize ) return SQLITE_NOMEM; aColSize = (int*)&aTotalSize[pConfig->nCol]; memset(aTotalSize, 0, sizeof(i64) * pConfig->nCol); @@ -229158,27 +229158,27 @@ static int sqlite3Fts5StorageIntegrity(Fts5Storage *p){ rc = fts5StorageGetStmt(p, FTS5_STMT_SCAN, &pScan, 0); if( rc==SQLITE_OK ){ int rc2; - while( SQLITE_ROW==sqlite3_step(pScan) ){ + while( SQLITE_ROW==tdsqlite3_step(pScan) ){ int i; - ctx.iRowid = sqlite3_column_int64(pScan, 0); + ctx.iRowid = tdsqlite3_column_int64(pScan, 0); ctx.szCol = 0; if( pConfig->bColumnsize ){ - rc = sqlite3Fts5StorageDocsize(p, ctx.iRowid, aColSize); + rc = tdsqlite3Fts5StorageDocsize(p, ctx.iRowid, aColSize); } if( rc==SQLITE_OK && pConfig->eDetail==FTS5_DETAIL_NONE ){ - rc = sqlite3Fts5TermsetNew(&ctx.pTermset); + rc = tdsqlite3Fts5TermsetNew(&ctx.pTermset); } for(i=0; rc==SQLITE_OK && inCol; i++){ if( pConfig->abUnindexed[i] ) continue; ctx.iCol = i; ctx.szCol = 0; if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){ - rc = sqlite3Fts5TermsetNew(&ctx.pTermset); + rc = tdsqlite3Fts5TermsetNew(&ctx.pTermset); } if( rc==SQLITE_OK ){ - const char *zText = (const char*)sqlite3_column_text(pScan, i+1); - int nText = sqlite3_column_bytes(pScan, i+1); - rc = sqlite3Fts5Tokenize(pConfig, + const char *zText = (const char*)tdsqlite3_column_text(pScan, i+1); + int nText = tdsqlite3_column_bytes(pScan, i+1); + rc = tdsqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT, zText, nText, (void*)&ctx, @@ -229190,16 +229190,16 @@ static int sqlite3Fts5StorageIntegrity(Fts5Storage *p){ } aTotalSize[i] += ctx.szCol; if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){ - sqlite3Fts5TermsetFree(ctx.pTermset); + tdsqlite3Fts5TermsetFree(ctx.pTermset); ctx.pTermset = 0; } } - sqlite3Fts5TermsetFree(ctx.pTermset); + tdsqlite3Fts5TermsetFree(ctx.pTermset); ctx.pTermset = 0; if( rc!=SQLITE_OK ) break; } - rc2 = sqlite3_reset(pScan); + rc2 = tdsqlite3_reset(pScan); if( rc==SQLITE_OK ) rc = rc2; } @@ -229229,10 +229229,10 @@ static int sqlite3Fts5StorageIntegrity(Fts5Storage *p){ ** verify, amongst other things, that it matches the checksum generated by ** inspecting the index itself. */ if( rc==SQLITE_OK ){ - rc = sqlite3Fts5IndexIntegrityCheck(p->pIndex, ctx.cksum); + rc = tdsqlite3Fts5IndexIntegrityCheck(p->pIndex, ctx.cksum); } - sqlite3_free(aTotalSize); + tdsqlite3_free(aTotalSize); return rc; } @@ -229240,10 +229240,10 @@ static int sqlite3Fts5StorageIntegrity(Fts5Storage *p){ ** Obtain an SQLite statement handle that may be used to read data from the ** %_content table. */ -static int sqlite3Fts5StorageStmt( +static int tdsqlite3Fts5StorageStmt( Fts5Storage *p, int eStmt, - sqlite3_stmt **pp, + tdsqlite3_stmt **pp, char **pzErrMsg ){ int rc; @@ -229261,23 +229261,23 @@ static int sqlite3Fts5StorageStmt( /* ** Release an SQLite statement handle obtained via an earlier call to -** sqlite3Fts5StorageStmt(). The eStmt parameter passed to this function -** must match that passed to the sqlite3Fts5StorageStmt() call. +** tdsqlite3Fts5StorageStmt(). The eStmt parameter passed to this function +** must match that passed to the tdsqlite3Fts5StorageStmt() call. */ -static void sqlite3Fts5StorageStmtRelease( +static void tdsqlite3Fts5StorageStmtRelease( Fts5Storage *p, int eStmt, - sqlite3_stmt *pStmt + tdsqlite3_stmt *pStmt ){ assert( eStmt==FTS5_STMT_SCAN_ASC || eStmt==FTS5_STMT_SCAN_DESC || eStmt==FTS5_STMT_LOOKUP ); if( p->aStmt[eStmt]==0 ){ - sqlite3_reset(pStmt); + tdsqlite3_reset(pStmt); p->aStmt[eStmt] = pStmt; }else{ - sqlite3_finalize(pStmt); + tdsqlite3_finalize(pStmt); } } @@ -229302,24 +229302,24 @@ static int fts5StorageDecodeSizeArray( ** An SQLite error code is returned if an error occurs, or SQLITE_OK ** otherwise. */ -static int sqlite3Fts5StorageDocsize(Fts5Storage *p, i64 iRowid, int *aCol){ +static int tdsqlite3Fts5StorageDocsize(Fts5Storage *p, i64 iRowid, int *aCol){ int nCol = p->pConfig->nCol; /* Number of user columns in table */ - sqlite3_stmt *pLookup = 0; /* Statement to query %_docsize */ + tdsqlite3_stmt *pLookup = 0; /* Statement to query %_docsize */ int rc; /* Return Code */ assert( p->pConfig->bColumnsize ); rc = fts5StorageGetStmt(p, FTS5_STMT_LOOKUP_DOCSIZE, &pLookup, 0); if( rc==SQLITE_OK ){ int bCorrupt = 1; - sqlite3_bind_int64(pLookup, 1, iRowid); - if( SQLITE_ROW==sqlite3_step(pLookup) ){ - const u8 *aBlob = sqlite3_column_blob(pLookup, 0); - int nBlob = sqlite3_column_bytes(pLookup, 0); + tdsqlite3_bind_int64(pLookup, 1, iRowid); + if( SQLITE_ROW==tdsqlite3_step(pLookup) ){ + const u8 *aBlob = tdsqlite3_column_blob(pLookup, 0); + int nBlob = tdsqlite3_column_bytes(pLookup, 0); if( 0==fts5StorageDecodeSizeArray(aCol, nCol, aBlob, nBlob) ){ bCorrupt = 0; } } - rc = sqlite3_reset(pLookup); + rc = tdsqlite3_reset(pLookup); if( bCorrupt && rc==SQLITE_OK ){ rc = FTS5_CORRUPT; } @@ -229328,7 +229328,7 @@ static int sqlite3Fts5StorageDocsize(Fts5Storage *p, i64 iRowid, int *aCol){ return rc; } -static int sqlite3Fts5StorageSize(Fts5Storage *p, int iCol, i64 *pnToken){ +static int tdsqlite3Fts5StorageSize(Fts5Storage *p, int iCol, i64 *pnToken){ int rc = fts5StorageLoadTotals(p, 0); if( rc==SQLITE_OK ){ *pnToken = 0; @@ -229346,7 +229346,7 @@ static int sqlite3Fts5StorageSize(Fts5Storage *p, int iCol, i64 *pnToken){ return rc; } -static int sqlite3Fts5StorageRowCount(Fts5Storage *p, i64 *pnRow){ +static int tdsqlite3Fts5StorageRowCount(Fts5Storage *p, i64 *pnRow){ int rc = fts5StorageLoadTotals(p, 0); if( rc==SQLITE_OK ){ /* nTotalRow being zero does not necessarily indicate a corrupt @@ -229363,47 +229363,47 @@ static int sqlite3Fts5StorageRowCount(Fts5Storage *p, i64 *pnRow){ /* ** Flush any data currently held in-memory to disk. */ -static int sqlite3Fts5StorageSync(Fts5Storage *p){ +static int tdsqlite3Fts5StorageSync(Fts5Storage *p){ int rc = SQLITE_OK; - i64 iLastRowid = sqlite3_last_insert_rowid(p->pConfig->db); + i64 iLastRowid = tdsqlite3_last_insert_rowid(p->pConfig->db); if( p->bTotalsValid ){ rc = fts5StorageSaveTotals(p); p->bTotalsValid = 0; } if( rc==SQLITE_OK ){ - rc = sqlite3Fts5IndexSync(p->pIndex); + rc = tdsqlite3Fts5IndexSync(p->pIndex); } - sqlite3_set_last_insert_rowid(p->pConfig->db, iLastRowid); + tdsqlite3_set_last_insert_rowid(p->pConfig->db, iLastRowid); return rc; } -static int sqlite3Fts5StorageRollback(Fts5Storage *p){ +static int tdsqlite3Fts5StorageRollback(Fts5Storage *p){ p->bTotalsValid = 0; - return sqlite3Fts5IndexRollback(p->pIndex); + return tdsqlite3Fts5IndexRollback(p->pIndex); } -static int sqlite3Fts5StorageConfigValue( +static int tdsqlite3Fts5StorageConfigValue( Fts5Storage *p, const char *z, - sqlite3_value *pVal, + tdsqlite3_value *pVal, int iVal ){ - sqlite3_stmt *pReplace = 0; + tdsqlite3_stmt *pReplace = 0; int rc = fts5StorageGetStmt(p, FTS5_STMT_REPLACE_CONFIG, &pReplace, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_text(pReplace, 1, z, -1, SQLITE_STATIC); + tdsqlite3_bind_text(pReplace, 1, z, -1, SQLITE_STATIC); if( pVal ){ - sqlite3_bind_value(pReplace, 2, pVal); + tdsqlite3_bind_value(pReplace, 2, pVal); }else{ - sqlite3_bind_int(pReplace, 2, iVal); + tdsqlite3_bind_int(pReplace, 2, iVal); } - sqlite3_step(pReplace); - rc = sqlite3_reset(pReplace); - sqlite3_bind_null(pReplace, 1); + tdsqlite3_step(pReplace); + rc = tdsqlite3_reset(pReplace); + tdsqlite3_bind_null(pReplace, 1); } if( rc==SQLITE_OK && pVal ){ int iNew = p->pConfig->iCookie + 1; - rc = sqlite3Fts5IndexSetCookie(p->pIndex, iNew); + rc = tdsqlite3Fts5IndexSetCookie(p->pIndex, iNew); if( rc==SQLITE_OK ){ p->pConfig->iCookie = iNew; } @@ -229468,7 +229468,7 @@ static void fts5AsciiAddExceptions( ** Delete a "ascii" tokenizer. */ static void fts5AsciiDelete(Fts5Tokenizer *p){ - sqlite3_free(p); + tdsqlite3_free(p); } /* @@ -229485,7 +229485,7 @@ static int fts5AsciiCreate( if( nArg%2 ){ rc = SQLITE_ERROR; }else{ - p = sqlite3_malloc(sizeof(AsciiTokenizer)); + p = tdsqlite3_malloc(sizeof(AsciiTokenizer)); if( p==0 ){ rc = SQLITE_NOMEM; }else{ @@ -229494,10 +229494,10 @@ static int fts5AsciiCreate( memcpy(p->aTokenChar, aAsciiTokenChar, sizeof(aAsciiTokenChar)); for(i=0; rc==SQLITE_OK && inFold ){ - if( pFold!=aFold ) sqlite3_free(pFold); - pFold = sqlite3_malloc64((sqlite3_int64)nByte*2); + if( pFold!=aFold ) tdsqlite3_free(pFold); + pFold = tdsqlite3_malloc64((tdsqlite3_int64)nByte*2); if( pFold==0 ){ rc = SQLITE_NOMEM; break; @@ -229579,7 +229579,7 @@ static int fts5AsciiTokenize( is = ie+1; } - if( pFold!=aFold ) sqlite3_free(pFold); + if( pFold!=aFold ) tdsqlite3_free(pFold); if( rc==SQLITE_DONE ) rc = SQLITE_OK; return rc; } @@ -229591,12 +229591,12 @@ static int fts5AsciiTokenize( /* ** The following two macros - READ_UTF8 and WRITE_UTF8 - have been copied -** from the sqlite3 source file utf.c. If this file is compiled as part +** from the tdsqlite3 source file utf.c. If this file is compiled as part ** of the amalgamation, they are not required. */ #ifndef SQLITE_AMALGAMATION -static const unsigned char sqlite3Utf8Trans1[] = { +static const unsigned char tdsqlite3Utf8Trans1[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -229610,7 +229610,7 @@ static const unsigned char sqlite3Utf8Trans1[] = { #define READ_UTF8(zIn, zTerm, c) \ c = *(zIn++); \ if( c>=0xc0 ){ \ - c = sqlite3Utf8Trans1[c-0xc0]; \ + c = tdsqlite3Utf8Trans1[c-0xc0]; \ while( zIn!=zTerm && (*zIn & 0xc0)==0x80 ){ \ c = (c<<6) + (0x3f & *(zIn++)); \ } \ @@ -229669,7 +229669,7 @@ static int fts5UnicodeAddExceptions( int *aNew; if( n>0 ){ - aNew = (int*)sqlite3_realloc64(p->aiException, + aNew = (int*)tdsqlite3_realloc64(p->aiException, (n+p->nException)*sizeof(int)); if( aNew ){ int nNew = p->nException; @@ -229682,10 +229682,10 @@ static int fts5UnicodeAddExceptions( if( iCode<128 ){ p->aTokenChar[iCode] = (unsigned char)bTokenChars; }else{ - bToken = p->aCategory[sqlite3Fts5UnicodeCategory(iCode)]; + bToken = p->aCategory[tdsqlite3Fts5UnicodeCategory(iCode)]; assert( (bToken==0 || bToken==1) ); assert( (bTokenChars==0 || bTokenChars==1) ); - if( bToken!=bTokenChars && sqlite3Fts5UnicodeIsdiacritic(iCode)==0 ){ + if( bToken!=bTokenChars && tdsqlite3Fts5UnicodeIsdiacritic(iCode)==0 ){ int i; for(i=0; iiCode ) break; @@ -229736,9 +229736,9 @@ static int fts5UnicodeIsException(Unicode61Tokenizer *p, int iCode){ static void fts5UnicodeDelete(Fts5Tokenizer *pTok){ if( pTok ){ Unicode61Tokenizer *p = (Unicode61Tokenizer*)pTok; - sqlite3_free(p->aiException); - sqlite3_free(p->aFold); - sqlite3_free(p); + tdsqlite3_free(p->aiException); + tdsqlite3_free(p->aFold); + tdsqlite3_free(p); } return; } @@ -229748,13 +229748,13 @@ static int unicodeSetCategories(Unicode61Tokenizer *p, const char *zCat){ while( *z ){ while( *z==' ' || *z=='\t' ) z++; - if( *z && sqlite3Fts5UnicodeCatParse(z, p->aCategory) ){ + if( *z && tdsqlite3Fts5UnicodeCatParse(z, p->aCategory) ){ return SQLITE_ERROR; } while( *z!=' ' && *z!='\t' && *z!='\0' ) z++; } - sqlite3Fts5UnicodeAscii(p->aCategory, p->aTokenChar); + tdsqlite3Fts5UnicodeAscii(p->aCategory, p->aTokenChar); return SQLITE_OK; } @@ -229774,7 +229774,7 @@ static int fts5UnicodeCreate( if( nArg%2 ){ rc = SQLITE_ERROR; }else{ - p = (Unicode61Tokenizer*)sqlite3_malloc(sizeof(Unicode61Tokenizer)); + p = (Unicode61Tokenizer*)tdsqlite3_malloc(sizeof(Unicode61Tokenizer)); if( p ){ const char *zCat = "L* N* Co"; int i; @@ -229782,14 +229782,14 @@ static int fts5UnicodeCreate( p->eRemoveDiacritic = FTS5_REMOVE_DIACRITICS_SIMPLE; p->nFold = 64; - p->aFold = sqlite3_malloc64(p->nFold * sizeof(char)); + p->aFold = tdsqlite3_malloc64(p->nFold * sizeof(char)); if( p->aFold==0 ){ rc = SQLITE_NOMEM; } /* Search for a "categories" argument */ for(i=0; rc==SQLITE_OK && iaCategory[sqlite3Fts5UnicodeCategory((u32)iCode)] + p->aCategory[tdsqlite3Fts5UnicodeCategory((u32)iCode)] ^ fts5UnicodeIsException(p, iCode) ); } @@ -229904,14 +229904,14 @@ static int fts5UnicodeTokenize( /* Grow the output buffer so that there is sufficient space to fit the ** largest possible utf-8 character. */ if( zOut>pEnd ){ - aFold = sqlite3_malloc64((sqlite3_int64)nFold*2); + aFold = tdsqlite3_malloc64((tdsqlite3_int64)nFold*2); if( aFold==0 ){ rc = SQLITE_NOMEM; goto tokenize_done; } zOut = &aFold[zOut - p->aFold]; memcpy(aFold, p->aFold, nFold); - sqlite3_free(p->aFold); + tdsqlite3_free(p->aFold); p->aFold = aFold; p->nFold = nFold = nFold*2; pEnd = &aFold[nFold-6]; @@ -229921,9 +229921,9 @@ static int fts5UnicodeTokenize( /* An non-ascii-range character. Fold it into the output buffer if ** it is a token character, or break out of the loop if it is not. */ READ_UTF8(zCsr, zTerm, iCode); - if( fts5UnicodeIsAlnum(p,iCode)||sqlite3Fts5UnicodeIsdiacritic(iCode) ){ + if( fts5UnicodeIsAlnum(p,iCode)||tdsqlite3Fts5UnicodeIsdiacritic(iCode) ){ non_ascii_tokenchar: - iCode = sqlite3Fts5UnicodeFold(iCode, p->eRemoveDiacritic); + iCode = tdsqlite3Fts5UnicodeFold(iCode, p->eRemoveDiacritic); if( iCode ) WRITE_UTF8(zOut, iCode); }else{ break; @@ -229976,7 +229976,7 @@ static void fts5PorterDelete(Fts5Tokenizer *pTok){ if( p->pTokenizer ){ p->tokenizer.xDelete(p->pTokenizer); } - sqlite3_free(p); + tdsqlite3_free(p); } } @@ -229998,7 +229998,7 @@ static int fts5PorterCreate( zBase = azArg[0]; } - pRet = (PorterTokenizer*)sqlite3_malloc(sizeof(PorterTokenizer)); + pRet = (PorterTokenizer*)tdsqlite3_malloc(sizeof(PorterTokenizer)); if( pRet ){ memset(pRet, 0, sizeof(PorterTokenizer)); rc = pApi->xFindTokenizer(pApi, zBase, &pUserdata, &pRet->tokenizer); @@ -230674,7 +230674,7 @@ static int fts5PorterTokenize( /* ** Register all built-in tokenizers with FTS5. */ -static int sqlite3Fts5TokenizerInit(fts5_api *pApi){ +static int tdsqlite3Fts5TokenizerInit(fts5_api *pApi){ struct BuiltinTokenizer { const char *zName; fts5_tokenizer x; @@ -230796,7 +230796,7 @@ static int fts5_remove_diacritic(int c, int bComplex){ ** Return true if the argument interpreted as a unicode codepoint ** is a diacritical modifier character. */ -static int sqlite3Fts5UnicodeIsdiacritic(int c){ +static int tdsqlite3Fts5UnicodeIsdiacritic(int c){ unsigned int mask0 = 0x08029FDF; unsigned int mask1 = 0x000361F8; if( c<768 || c>817 ) return 0; @@ -230815,7 +230815,7 @@ static int sqlite3Fts5UnicodeIsdiacritic(int c){ ** The results are undefined if the value passed to this function ** is less than zero. */ -static int sqlite3Fts5UnicodeFold(int c, int eRemoveDiacritic){ +static int tdsqlite3Fts5UnicodeFold(int c, int eRemoveDiacritic){ /* Each entry in the following array defines a rule for folding a range ** of codepoints to lower case. The rule applies to a range of nRange ** codepoints starting at codepoint iCode. @@ -230951,7 +230951,7 @@ static int sqlite3Fts5UnicodeFold(int c, int eRemoveDiacritic){ } -static int sqlite3Fts5UnicodeCatParse(const char *zCat, u8 *aArray){ +static int tdsqlite3Fts5UnicodeCatParse(const char *zCat, u8 *aArray){ aArray[0] = 1; switch( zCat[0] ){ case 'C': @@ -231432,7 +231432,7 @@ static u16 aFts5UnicodeData[] = { 34, 3074, 7692, 63, 63, }; -static int sqlite3Fts5UnicodeCategory(u32 iCode) { +static int tdsqlite3Fts5UnicodeCategory(u32 iCode) { int iRes = -1; int iHi; int iLo; @@ -231463,7 +231463,7 @@ static int sqlite3Fts5UnicodeCategory(u32 iCode) { return ((iKey - aFts5UnicodeMap[iRes]) & 0x01) ? 5 : 9; } -static void sqlite3Fts5UnicodeAscii(u8 *aArray, u8 *aAscii){ +static void tdsqlite3Fts5UnicodeAscii(u8 *aArray, u8 *aAscii){ int i = 0; int iTbl = 0; while( i<128 ){ @@ -231495,11 +231495,11 @@ static void sqlite3Fts5UnicodeAscii(u8 *aArray, u8 *aAscii){ /* #include "fts5Int.h" */ /* -** This is a copy of the sqlite3GetVarint32() routine from the SQLite core. +** This is a copy of the tdsqlite3GetVarint32() routine from the SQLite core. ** Except, this version does handle the single byte case that the core ** version depends on being handled before its function is called. */ -static int sqlite3Fts5GetVarint32(const unsigned char *p, u32 *v){ +static int tdsqlite3Fts5GetVarint32(const unsigned char *p, u32 *v){ u32 a,b; /* The 1-byte case. Overwhelmingly the most common. */ @@ -231553,7 +231553,7 @@ static int sqlite3Fts5GetVarint32(const unsigned char *p, u32 *v){ u64 v64; u8 n; p -= 2; - n = sqlite3Fts5GetVarint(p, &v64); + n = tdsqlite3Fts5GetVarint(p, &v64); *v = ((u32)v64) & 0x7FFFFFFF; assert( n>3 && n<=9 ); return n; @@ -231562,7 +231562,7 @@ static int sqlite3Fts5GetVarint32(const unsigned char *p, u32 *v){ /* -** Bitmasks used by sqlite3GetVarint(). These precomputed constants +** Bitmasks used by tdsqlite3GetVarint(). These precomputed constants ** are defined here rather than simply putting the constant expressions ** inline in order to work around bugs in the RVT compiler. ** @@ -231577,7 +231577,7 @@ static int sqlite3Fts5GetVarint32(const unsigned char *p, u32 *v){ ** Read a 64-bit variable-length integer from memory starting at p[0]. ** Return the number of bytes read. The value is stored in *v. */ -static u8 sqlite3Fts5GetVarint(const unsigned char *p, u64 *v){ +static u8 tdsqlite3Fts5GetVarint(const unsigned char *p, u64 *v){ u32 a,b,s; a = *p; @@ -231796,7 +231796,7 @@ static int FTS5_NOINLINE fts5PutVarint64(unsigned char *p, u64 v){ return n; } -static int sqlite3Fts5PutVarint(unsigned char *p, u64 v){ +static int tdsqlite3Fts5PutVarint(unsigned char *p, u64 v){ if( v<=0x7f ){ p[0] = v&0x7f; return 1; @@ -231810,7 +231810,7 @@ static int sqlite3Fts5PutVarint(unsigned char *p, u64 v){ } -static int sqlite3Fts5GetVarintLen(u32 iVal){ +static int tdsqlite3Fts5GetVarintLen(u32 iVal){ #if 0 if( iVal<(1 << 7 ) ) return 1; #endif @@ -231867,17 +231867,17 @@ typedef struct Fts5VocabTable Fts5VocabTable; typedef struct Fts5VocabCursor Fts5VocabCursor; struct Fts5VocabTable { - sqlite3_vtab base; + tdsqlite3_vtab base; char *zFts5Tbl; /* Name of fts5 table */ char *zFts5Db; /* Db containing fts5 table */ - sqlite3 *db; /* Database handle */ + tdsqlite3 *db; /* Database handle */ Fts5Global *pGlobal; /* FTS5 global object for this database */ int eType; /* FTS5_VOCAB_COL, ROW or INSTANCE */ }; struct Fts5VocabCursor { - sqlite3_vtab_cursor base; - sqlite3_stmt *pStmt; /* Statement holding lock on pIndex */ + tdsqlite3_vtab_cursor base; + tdsqlite3_stmt *pStmt; /* Statement holding lock on pIndex */ Fts5Table *pFts5; /* Associated FTS5 table */ int bEof; /* True if this cursor is at EOF */ @@ -231924,24 +231924,24 @@ struct Fts5VocabCursor { */ static int fts5VocabTableType(const char *zType, char **pzErr, int *peType){ int rc = SQLITE_OK; - char *zCopy = sqlite3Fts5Strndup(&rc, zType, -1); + char *zCopy = tdsqlite3Fts5Strndup(&rc, zType, -1); if( rc==SQLITE_OK ){ - sqlite3Fts5Dequote(zCopy); - if( sqlite3_stricmp(zCopy, "col")==0 ){ + tdsqlite3Fts5Dequote(zCopy); + if( tdsqlite3_stricmp(zCopy, "col")==0 ){ *peType = FTS5_VOCAB_COL; }else - if( sqlite3_stricmp(zCopy, "row")==0 ){ + if( tdsqlite3_stricmp(zCopy, "row")==0 ){ *peType = FTS5_VOCAB_ROW; }else - if( sqlite3_stricmp(zCopy, "instance")==0 ){ + if( tdsqlite3_stricmp(zCopy, "instance")==0 ){ *peType = FTS5_VOCAB_INSTANCE; }else { - *pzErr = sqlite3_mprintf("fts5vocab: unknown table type: %Q", zCopy); + *pzErr = tdsqlite3_mprintf("fts5vocab: unknown table type: %Q", zCopy); rc = SQLITE_ERROR; } - sqlite3_free(zCopy); + tdsqlite3_free(zCopy); } return rc; @@ -231951,18 +231951,18 @@ static int fts5VocabTableType(const char *zType, char **pzErr, int *peType){ /* ** The xDisconnect() virtual table method. */ -static int fts5VocabDisconnectMethod(sqlite3_vtab *pVtab){ +static int fts5VocabDisconnectMethod(tdsqlite3_vtab *pVtab){ Fts5VocabTable *pTab = (Fts5VocabTable*)pVtab; - sqlite3_free(pTab); + tdsqlite3_free(pTab); return SQLITE_OK; } /* ** The xDestroy() virtual table method. */ -static int fts5VocabDestroyMethod(sqlite3_vtab *pVtab){ +static int fts5VocabDestroyMethod(tdsqlite3_vtab *pVtab){ Fts5VocabTable *pTab = (Fts5VocabTable*)pVtab; - sqlite3_free(pTab); + tdsqlite3_free(pTab); return SQLITE_OK; } @@ -231988,11 +231988,11 @@ static int fts5VocabDestroyMethod(sqlite3_vtab *pVtab){ ** argv[5] -> type of fts5vocab table */ static int fts5VocabInitVtab( - sqlite3 *db, /* The SQLite database connection */ + tdsqlite3 *db, /* The SQLite database connection */ void *pAux, /* Pointer to Fts5Global object */ int argc, /* Number of elements in argv array */ const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVTab, /* Write the resulting vtab structure here */ + tdsqlite3_vtab **ppVTab, /* Write the resulting vtab structure here */ char **pzErr /* Write any error message here */ ){ const char *azSchema[] = { @@ -232008,7 +232008,7 @@ static int fts5VocabInitVtab( bDb = (argc==6 && strlen(argv[1])==4 && memcmp("temp", argv[1], 4)==0); if( argc!=5 && bDb==0 ){ - *pzErr = sqlite3_mprintf("wrong number of vtable arguments"); + *pzErr = tdsqlite3_mprintf("wrong number of vtable arguments"); rc = SQLITE_ERROR; }else{ int nByte; /* Bytes of space to allocate */ @@ -232022,11 +232022,11 @@ static int fts5VocabInitVtab( rc = fts5VocabTableType(zType, pzErr, &eType); if( rc==SQLITE_OK ){ assert( eType>=0 && eTypepGlobal = (Fts5Global*)pAux; pRet->eType = eType; @@ -232035,12 +232035,12 @@ static int fts5VocabInitVtab( pRet->zFts5Db = &pRet->zFts5Tbl[nTab]; memcpy(pRet->zFts5Tbl, zTab, nTab); memcpy(pRet->zFts5Db, zDb, nDb); - sqlite3Fts5Dequote(pRet->zFts5Tbl); - sqlite3Fts5Dequote(pRet->zFts5Db); + tdsqlite3Fts5Dequote(pRet->zFts5Tbl); + tdsqlite3Fts5Dequote(pRet->zFts5Db); } } - *ppVTab = (sqlite3_vtab*)pRet; + *ppVTab = (tdsqlite3_vtab*)pRet; return rc; } @@ -232050,22 +232050,22 @@ static int fts5VocabInitVtab( ** work is done in function fts5VocabInitVtab(). */ static int fts5VocabConnectMethod( - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ void *pAux, /* Pointer to tokenizer hash table */ int argc, /* Number of elements in argv array */ const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ - char **pzErr /* OUT: sqlite3_malloc'd error message */ + tdsqlite3_vtab **ppVtab, /* OUT: New tdsqlite3_vtab object */ + char **pzErr /* OUT: tdsqlite3_malloc'd error message */ ){ return fts5VocabInitVtab(db, pAux, argc, argv, ppVtab, pzErr); } static int fts5VocabCreateMethod( - sqlite3 *db, /* Database connection */ + tdsqlite3 *db, /* Database connection */ void *pAux, /* Pointer to tokenizer hash table */ int argc, /* Number of elements in argv array */ const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ - char **pzErr /* OUT: sqlite3_malloc'd error message */ + tdsqlite3_vtab **ppVtab, /* OUT: New tdsqlite3_vtab object */ + char **pzErr /* OUT: tdsqlite3_malloc'd error message */ ){ return fts5VocabInitVtab(db, pAux, argc, argv, ppVtab, pzErr); } @@ -232083,8 +232083,8 @@ static int fts5VocabCreateMethod( ** identically, as are greater-than and greater-than-or-equal. */ static int fts5VocabBestIndexMethod( - sqlite3_vtab *pUnused, - sqlite3_index_info *pInfo + tdsqlite3_vtab *pUnused, + tdsqlite3_index_info *pInfo ){ int i; int iTermEq = -1; @@ -232096,7 +232096,7 @@ static int fts5VocabBestIndexMethod( UNUSED_PARAM(pUnused); for(i=0; inConstraint; i++){ - struct sqlite3_index_constraint *p = &pInfo->aConstraint[i]; + struct tdsqlite3_index_constraint *p = &pInfo->aConstraint[i]; if( p->usable==0 ) continue; if( p->iColumn==0 ){ /* term column */ if( p->op==SQLITE_INDEX_CONSTRAINT_EQ ) iTermEq = i; @@ -232128,7 +232128,7 @@ static int fts5VocabBestIndexMethod( /* This virtual table always delivers results in ascending order of ** the "term" column (column 0). So if the user has requested this ** specifically - "ORDER BY term" or "ORDER BY term ASC" - set the - ** sqlite3_index_info.orderByConsumed flag to tell the core the results + ** tdsqlite3_index_info.orderByConsumed flag to tell the core the results ** are already in sorted order. */ if( pInfo->nOrderBy==1 && pInfo->aOrderBy[0].iColumn==0 @@ -232145,50 +232145,50 @@ static int fts5VocabBestIndexMethod( ** Implementation of xOpen method. */ static int fts5VocabOpenMethod( - sqlite3_vtab *pVTab, - sqlite3_vtab_cursor **ppCsr + tdsqlite3_vtab *pVTab, + tdsqlite3_vtab_cursor **ppCsr ){ Fts5VocabTable *pTab = (Fts5VocabTable*)pVTab; Fts5Table *pFts5 = 0; Fts5VocabCursor *pCsr = 0; int rc = SQLITE_OK; - sqlite3_stmt *pStmt = 0; + tdsqlite3_stmt *pStmt = 0; char *zSql = 0; - zSql = sqlite3Fts5Mprintf(&rc, + zSql = tdsqlite3Fts5Mprintf(&rc, "SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'", pTab->zFts5Tbl, pTab->zFts5Db, pTab->zFts5Tbl, pTab->zFts5Tbl ); if( zSql ){ - rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pStmt, 0); + rc = tdsqlite3_prepare_v2(pTab->db, zSql, -1, &pStmt, 0); } - sqlite3_free(zSql); + tdsqlite3_free(zSql); assert( rc==SQLITE_OK || pStmt==0 ); if( rc==SQLITE_ERROR ) rc = SQLITE_OK; - if( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){ - i64 iId = sqlite3_column_int64(pStmt, 0); - pFts5 = sqlite3Fts5TableFromCsrid(pTab->pGlobal, iId); + if( pStmt && tdsqlite3_step(pStmt)==SQLITE_ROW ){ + i64 iId = tdsqlite3_column_int64(pStmt, 0); + pFts5 = tdsqlite3Fts5TableFromCsrid(pTab->pGlobal, iId); } if( rc==SQLITE_OK ){ if( pFts5==0 ){ - rc = sqlite3_finalize(pStmt); + rc = tdsqlite3_finalize(pStmt); pStmt = 0; if( rc==SQLITE_OK ){ - pVTab->zErrMsg = sqlite3_mprintf( + pVTab->zErrMsg = tdsqlite3_mprintf( "no such fts5 table: %s.%s", pTab->zFts5Db, pTab->zFts5Tbl ); rc = SQLITE_ERROR; } }else{ - rc = sqlite3Fts5FlushToDisk(pFts5); + rc = tdsqlite3Fts5FlushToDisk(pFts5); } } if( rc==SQLITE_OK ){ int nByte = pFts5->pConfig->nCol * sizeof(i64)*2 + sizeof(Fts5VocabCursor); - pCsr = (Fts5VocabCursor*)sqlite3Fts5MallocZero(&rc, nByte); + pCsr = (Fts5VocabCursor*)tdsqlite3Fts5MallocZero(&rc, nByte); } if( pCsr ){ @@ -232197,18 +232197,18 @@ static int fts5VocabOpenMethod( pCsr->aCnt = (i64*)&pCsr[1]; pCsr->aDoc = &pCsr->aCnt[pFts5->pConfig->nCol]; }else{ - sqlite3_finalize(pStmt); + tdsqlite3_finalize(pStmt); } - *ppCsr = (sqlite3_vtab_cursor*)pCsr; + *ppCsr = (tdsqlite3_vtab_cursor*)pCsr; return rc; } static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){ pCsr->rowid = 0; - sqlite3Fts5IterClose(pCsr->pIter); + tdsqlite3Fts5IterClose(pCsr->pIter); pCsr->pIter = 0; - sqlite3_free(pCsr->zLeTerm); + tdsqlite3_free(pCsr->zLeTerm); pCsr->nLeTerm = -1; pCsr->zLeTerm = 0; pCsr->bEof = 0; @@ -232218,24 +232218,24 @@ static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){ ** Close the cursor. For additional information see the documentation ** on the xClose method of the virtual table interface. */ -static int fts5VocabCloseMethod(sqlite3_vtab_cursor *pCursor){ +static int fts5VocabCloseMethod(tdsqlite3_vtab_cursor *pCursor){ Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor; fts5VocabResetCursor(pCsr); - sqlite3Fts5BufferFree(&pCsr->term); - sqlite3_finalize(pCsr->pStmt); - sqlite3_free(pCsr); + tdsqlite3Fts5BufferFree(&pCsr->term); + tdsqlite3_finalize(pCsr->pStmt); + tdsqlite3_free(pCsr); return SQLITE_OK; } static int fts5VocabInstanceNewTerm(Fts5VocabCursor *pCsr){ int rc = SQLITE_OK; - if( sqlite3Fts5IterEof(pCsr->pIter) ){ + if( tdsqlite3Fts5IterEof(pCsr->pIter) ){ pCsr->bEof = 1; }else{ const char *zTerm; int nTerm; - zTerm = sqlite3Fts5IterTerm(pCsr->pIter, &nTerm); + zTerm = tdsqlite3Fts5IterTerm(pCsr->pIter, &nTerm); if( pCsr->nLeTerm>=0 ){ int nCmp = MIN(nTerm, pCsr->nLeTerm); int bCmp = memcmp(pCsr->zLeTerm, zTerm, nCmp); @@ -232244,7 +232244,7 @@ static int fts5VocabInstanceNewTerm(Fts5VocabCursor *pCsr){ } } - sqlite3Fts5BufferSet(&rc, &pCsr->term, nTerm, (const u8*)zTerm); + tdsqlite3Fts5BufferSet(&rc, &pCsr->term, nTerm, (const u8*)zTerm); } return rc; } @@ -232256,15 +232256,15 @@ static int fts5VocabInstanceNext(Fts5VocabCursor *pCsr){ i64 *pp = &pCsr->iInstPos; int *po = &pCsr->iInstOff; - assert( sqlite3Fts5IterEof(pIter)==0 ); + assert( tdsqlite3Fts5IterEof(pIter)==0 ); assert( pCsr->bEof==0 ); while( eDetail==FTS5_DETAIL_NONE - || sqlite3Fts5PoslistNext64(pIter->pData, pIter->nData, po, pp) + || tdsqlite3Fts5PoslistNext64(pIter->pData, pIter->nData, po, pp) ){ pCsr->iInstPos = 0; pCsr->iInstOff = 0; - rc = sqlite3Fts5IterNextScan(pCsr->pIter); + rc = tdsqlite3Fts5IterNextScan(pCsr->pIter); if( rc==SQLITE_OK ){ rc = fts5VocabInstanceNewTerm(pCsr); if( pCsr->bEof || eDetail==FTS5_DETAIL_NONE ) break; @@ -232281,7 +232281,7 @@ static int fts5VocabInstanceNext(Fts5VocabCursor *pCsr){ /* ** Advance the cursor to the next row in the table. */ -static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){ +static int fts5VocabNextMethod(tdsqlite3_vtab_cursor *pCursor){ Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor; Fts5VocabTable *pTab = (Fts5VocabTable*)pCursor->pVtab; int rc = SQLITE_OK; @@ -232300,13 +232300,13 @@ static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){ } if( pTab->eType!=FTS5_VOCAB_COL || pCsr->iCol>=nCol ){ - if( sqlite3Fts5IterEof(pCsr->pIter) ){ + if( tdsqlite3Fts5IterEof(pCsr->pIter) ){ pCsr->bEof = 1; }else{ const char *zTerm; int nTerm; - zTerm = sqlite3Fts5IterTerm(pCsr->pIter, &nTerm); + zTerm = tdsqlite3Fts5IterTerm(pCsr->pIter, &nTerm); assert( nTerm>=0 ); if( pCsr->nLeTerm>=0 ){ int nCmp = MIN(nTerm, pCsr->nLeTerm); @@ -232317,7 +232317,7 @@ static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){ } } - sqlite3Fts5BufferSet(&rc, &pCsr->term, nTerm, (const u8*)zTerm); + tdsqlite3Fts5BufferSet(&rc, &pCsr->term, nTerm, (const u8*)zTerm); memset(pCsr->aCnt, 0, nCol * sizeof(i64)); memset(pCsr->aDoc, 0, nCol * sizeof(i64)); pCsr->iCol = 0; @@ -232335,7 +232335,7 @@ static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){ switch( pTab->eType ){ case FTS5_VOCAB_ROW: if( eDetail==FTS5_DETAIL_FULL ){ - while( 0==sqlite3Fts5PoslistNext64(pPos, nPos, &iOff, &iPos) ){ + while( 0==tdsqlite3Fts5PoslistNext64(pPos, nPos, &iOff, &iPos) ){ pCsr->aCnt[0]++; } } @@ -232345,7 +232345,7 @@ static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){ case FTS5_VOCAB_COL: if( eDetail==FTS5_DETAIL_FULL ){ int iCol = -1; - while( 0==sqlite3Fts5PoslistNext64(pPos, nPos, &iOff, &iPos) ){ + while( 0==tdsqlite3Fts5PoslistNext64(pPos, nPos, &iOff, &iPos) ){ int ii = FTS5_POS2COLUMN(iPos); if( iCol!=ii ){ if( ii>=nCol ){ @@ -232358,7 +232358,7 @@ static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){ pCsr->aCnt[ii]++; } }else if( eDetail==FTS5_DETAIL_COLUMNS ){ - while( 0==sqlite3Fts5PoslistNext64(pPos, nPos, &iOff,&iPos) ){ + while( 0==tdsqlite3Fts5PoslistNext64(pPos, nPos, &iOff,&iPos) ){ assert_nc( iPos>=0 && iPos=nCol ){ rc = FTS5_CORRUPT; @@ -232378,18 +232378,18 @@ static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){ } if( rc==SQLITE_OK ){ - rc = sqlite3Fts5IterNextScan(pCsr->pIter); + rc = tdsqlite3Fts5IterNextScan(pCsr->pIter); } if( pTab->eType==FTS5_VOCAB_INSTANCE ) break; if( rc==SQLITE_OK ){ - zTerm = sqlite3Fts5IterTerm(pCsr->pIter, &nTerm); + zTerm = tdsqlite3Fts5IterTerm(pCsr->pIter, &nTerm); if( nTerm!=pCsr->term.n || (nTerm>0 && memcmp(zTerm, pCsr->term.p, nTerm)) ){ break; } - if( sqlite3Fts5IterEof(pCsr->pIter) ) break; + if( tdsqlite3Fts5IterEof(pCsr->pIter) ) break; } } } @@ -232408,11 +232408,11 @@ static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){ ** This is the xFilter implementation for the virtual table. */ static int fts5VocabFilterMethod( - sqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ + tdsqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ int idxNum, /* Strategy index */ const char *zUnused, /* Unused */ int nUnused, /* Number of elements in apVal */ - sqlite3_value **apVal /* Arguments for the indexing scheme */ + tdsqlite3_value **apVal /* Arguments for the indexing scheme */ ){ Fts5VocabTable *pTab = (Fts5VocabTable*)pCursor->pVtab; Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor; @@ -232424,9 +232424,9 @@ static int fts5VocabFilterMethod( const char *zTerm = 0; int nTerm = 0; - sqlite3_value *pEq = 0; - sqlite3_value *pGe = 0; - sqlite3_value *pLe = 0; + tdsqlite3_value *pEq = 0; + tdsqlite3_value *pGe = 0; + tdsqlite3_value *pLe = 0; UNUSED_PARAM2(zUnused, nUnused); @@ -232436,19 +232436,19 @@ static int fts5VocabFilterMethod( if( idxNum & FTS5_VOCAB_TERM_LE ) pLe = apVal[iVal++]; if( pEq ){ - zTerm = (const char *)sqlite3_value_text(pEq); - nTerm = sqlite3_value_bytes(pEq); + zTerm = (const char *)tdsqlite3_value_text(pEq); + nTerm = tdsqlite3_value_bytes(pEq); f = 0; }else{ if( pGe ){ - zTerm = (const char *)sqlite3_value_text(pGe); - nTerm = sqlite3_value_bytes(pGe); + zTerm = (const char *)tdsqlite3_value_text(pGe); + nTerm = tdsqlite3_value_bytes(pGe); } if( pLe ){ - const char *zCopy = (const char *)sqlite3_value_text(pLe); + const char *zCopy = (const char *)tdsqlite3_value_text(pLe); if( zCopy==0 ) zCopy = ""; - pCsr->nLeTerm = sqlite3_value_bytes(pLe); - pCsr->zLeTerm = sqlite3_malloc(pCsr->nLeTerm+1); + pCsr->nLeTerm = tdsqlite3_value_bytes(pLe); + pCsr->zLeTerm = tdsqlite3_malloc(pCsr->nLeTerm+1); if( pCsr->zLeTerm==0 ){ rc = SQLITE_NOMEM; }else{ @@ -232459,7 +232459,7 @@ static int fts5VocabFilterMethod( if( rc==SQLITE_OK ){ Fts5Index *pIndex = pCsr->pFts5->pIndex; - rc = sqlite3Fts5IndexQuery(pIndex, zTerm, nTerm, f, 0, &pCsr->pIter); + rc = tdsqlite3Fts5IndexQuery(pIndex, zTerm, nTerm, f, 0, &pCsr->pIter); } if( rc==SQLITE_OK && eType==FTS5_VOCAB_INSTANCE ){ rc = fts5VocabInstanceNewTerm(pCsr); @@ -232478,14 +232478,14 @@ static int fts5VocabFilterMethod( ** This is the xEof method of the virtual table. SQLite calls this ** routine to find out if it has reached the end of a result set. */ -static int fts5VocabEofMethod(sqlite3_vtab_cursor *pCursor){ +static int fts5VocabEofMethod(tdsqlite3_vtab_cursor *pCursor){ Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor; return pCsr->bEof; } static int fts5VocabColumnMethod( - sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ - sqlite3_context *pCtx, /* Context for sqlite3_result_xxx() calls */ + tdsqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ + tdsqlite3_context *pCtx, /* Context for tdsqlite3_result_xxx() calls */ int iCol /* Index of column to read value from */ ){ Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor; @@ -232494,7 +232494,7 @@ static int fts5VocabColumnMethod( i64 iVal = 0; if( iCol==0 ){ - sqlite3_result_text( + tdsqlite3_result_text( pCtx, (const char*)pCsr->term.p, pCsr->term.n, SQLITE_TRANSIENT ); }else if( eType==FTS5_VOCAB_COL ){ @@ -232502,7 +232502,7 @@ static int fts5VocabColumnMethod( if( iCol==1 ){ if( eDetail!=FTS5_DETAIL_NONE ){ const char *z = pCsr->pFts5->pConfig->azCol[pCsr->iCol]; - sqlite3_result_text(pCtx, z, -1, SQLITE_STATIC); + tdsqlite3_result_text(pCtx, z, -1, SQLITE_STATIC); } }else if( iCol==2 ){ iVal = pCsr->aDoc[pCsr->iCol]; @@ -232520,7 +232520,7 @@ static int fts5VocabColumnMethod( assert( eType==FTS5_VOCAB_INSTANCE ); switch( iCol ){ case 1: - sqlite3_result_int64(pCtx, pCsr->pIter->iRowid); + tdsqlite3_result_int64(pCtx, pCsr->pIter->iRowid); break; case 2: { int ii = -1; @@ -232531,7 +232531,7 @@ static int fts5VocabColumnMethod( } if( ii>=0 && iipFts5->pConfig->nCol ){ const char *z = pCsr->pFts5->pConfig->azCol[ii]; - sqlite3_result_text(pCtx, z, -1, SQLITE_STATIC); + tdsqlite3_result_text(pCtx, z, -1, SQLITE_STATIC); } break; } @@ -232539,14 +232539,14 @@ static int fts5VocabColumnMethod( assert( iCol==3 ); if( eDetail==FTS5_DETAIL_FULL ){ int ii = FTS5_POS2OFFSET(pCsr->iInstPos); - sqlite3_result_int(pCtx, ii); + tdsqlite3_result_int(pCtx, ii); } break; } } } - if( iVal>0 ) sqlite3_result_int64(pCtx, iVal); + if( iVal>0 ) tdsqlite3_result_int64(pCtx, iVal); return SQLITE_OK; } @@ -232556,7 +232556,7 @@ static int fts5VocabColumnMethod( ** rowid should be written to *pRowid. */ static int fts5VocabRowidMethod( - sqlite3_vtab_cursor *pCursor, + tdsqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid ){ Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor; @@ -232564,8 +232564,8 @@ static int fts5VocabRowidMethod( return SQLITE_OK; } -static int sqlite3Fts5VocabInit(Fts5Global *pGlobal, sqlite3 *db){ - static const sqlite3_module fts5Vocab = { +static int tdsqlite3Fts5VocabInit(Fts5Global *pGlobal, tdsqlite3 *db){ + static const tdsqlite3_module fts5Vocab = { /* iVersion */ 2, /* xCreate */ fts5VocabCreateMethod, /* xConnect */ fts5VocabConnectMethod, @@ -232593,7 +232593,7 @@ static int sqlite3Fts5VocabInit(Fts5Global *pGlobal, sqlite3 *db){ }; void *p = (void*)pGlobal; - return sqlite3_create_module_v2(db, "fts5vocab", &fts5Vocab, p, 0); + return tdsqlite3_create_module_v2(db, "fts5vocab", &fts5Vocab, p, 0); } @@ -232626,7 +232626,7 @@ static int sqlite3Fts5VocabInit(Fts5Global *pGlobal, sqlite3 *db){ */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) #if !defined(SQLITEINT_H) -/* #include "sqlite3ext.h" */ +/* #include "tdsqlite3ext.h" */ #endif SQLITE_EXTENSION_INIT1 /* #include */ @@ -232634,25 +232634,25 @@ SQLITE_EXTENSION_INIT1 #ifndef SQLITE_OMIT_VIRTUALTABLE -/* stmt_vtab is a subclass of sqlite3_vtab which will +/* stmt_vtab is a subclass of tdsqlite3_vtab which will ** serve as the underlying representation of a stmt virtual table */ typedef struct stmt_vtab stmt_vtab; struct stmt_vtab { - sqlite3_vtab base; /* Base class - must be first */ - sqlite3 *db; /* Database connection for this stmt vtab */ + tdsqlite3_vtab base; /* Base class - must be first */ + tdsqlite3 *db; /* Database connection for this stmt vtab */ }; -/* stmt_cursor is a subclass of sqlite3_vtab_cursor which will +/* stmt_cursor is a subclass of tdsqlite3_vtab_cursor which will ** serve as the underlying representation of a cursor that scans ** over rows of the result */ typedef struct stmt_cursor stmt_cursor; struct stmt_cursor { - sqlite3_vtab_cursor base; /* Base class - must be first */ - sqlite3 *db; /* Database connection for this cursor */ - sqlite3_stmt *pStmt; /* Statement cursor is currently pointing at */ - sqlite3_int64 iRowid; /* The rowid */ + tdsqlite3_vtab_cursor base; /* Base class - must be first */ + tdsqlite3 *db; /* Database connection for this cursor */ + tdsqlite3_stmt *pStmt; /* Statement cursor is currently pointing at */ + tdsqlite3_int64 iRowid; /* The rowid */ }; /* @@ -232665,14 +232665,14 @@ struct stmt_cursor { ** ** (1) Allocate the stmt_vtab object and initialize all fields. ** -** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the +** (2) Tell SQLite (via the tdsqlite3_declare_vtab() interface) what the ** result set of queries against stmt will look like. */ static int stmtConnect( - sqlite3 *db, + tdsqlite3 *db, void *pAux, int argc, const char *const*argv, - sqlite3_vtab **ppVtab, + tdsqlite3_vtab **ppVtab, char **pzErr ){ stmt_vtab *pNew; @@ -232692,12 +232692,12 @@ static int stmtConnect( #define STMT_COLUMN_MEM 10 /* SQLITE_STMTSTATUS_MEMUSED */ - rc = sqlite3_declare_vtab(db, + rc = tdsqlite3_declare_vtab(db, "CREATE TABLE x(sql,ncol,ro,busy,nscan,nsort,naidx,nstep," "reprep,run,mem)"); if( rc==SQLITE_OK ){ - pNew = sqlite3_malloc( sizeof(*pNew) ); - *ppVtab = (sqlite3_vtab*)pNew; + pNew = tdsqlite3_malloc( sizeof(*pNew) ); + *ppVtab = (tdsqlite3_vtab*)pNew; if( pNew==0 ) return SQLITE_NOMEM; memset(pNew, 0, sizeof(*pNew)); pNew->db = db; @@ -232708,17 +232708,17 @@ static int stmtConnect( /* ** This method is the destructor for stmt_cursor objects. */ -static int stmtDisconnect(sqlite3_vtab *pVtab){ - sqlite3_free(pVtab); +static int stmtDisconnect(tdsqlite3_vtab *pVtab){ + tdsqlite3_free(pVtab); return SQLITE_OK; } /* ** Constructor for a new stmt_cursor object. */ -static int stmtOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ +static int stmtOpen(tdsqlite3_vtab *p, tdsqlite3_vtab_cursor **ppCursor){ stmt_cursor *pCur; - pCur = sqlite3_malloc( sizeof(*pCur) ); + pCur = tdsqlite3_malloc( sizeof(*pCur) ); if( pCur==0 ) return SQLITE_NOMEM; memset(pCur, 0, sizeof(*pCur)); pCur->db = ((stmt_vtab*)p)->db; @@ -232729,8 +232729,8 @@ static int stmtOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ /* ** Destructor for a stmt_cursor. */ -static int stmtClose(sqlite3_vtab_cursor *cur){ - sqlite3_free(cur); +static int stmtClose(tdsqlite3_vtab_cursor *cur){ + tdsqlite3_free(cur); return SQLITE_OK; } @@ -232738,10 +232738,10 @@ static int stmtClose(sqlite3_vtab_cursor *cur){ /* ** Advance a stmt_cursor to its next row of output. */ -static int stmtNext(sqlite3_vtab_cursor *cur){ +static int stmtNext(tdsqlite3_vtab_cursor *cur){ stmt_cursor *pCur = (stmt_cursor*)cur; pCur->iRowid++; - pCur->pStmt = sqlite3_next_stmt(pCur->db, pCur->pStmt); + pCur->pStmt = tdsqlite3_next_stmt(pCur->db, pCur->pStmt); return SQLITE_OK; } @@ -232750,26 +232750,26 @@ static int stmtNext(sqlite3_vtab_cursor *cur){ ** is currently pointing. */ static int stmtColumn( - sqlite3_vtab_cursor *cur, /* The cursor */ - sqlite3_context *ctx, /* First argument to sqlite3_result_...() */ + tdsqlite3_vtab_cursor *cur, /* The cursor */ + tdsqlite3_context *ctx, /* First argument to tdsqlite3_result_...() */ int i /* Which column to return */ ){ stmt_cursor *pCur = (stmt_cursor*)cur; switch( i ){ case STMT_COLUMN_SQL: { - sqlite3_result_text(ctx, sqlite3_sql(pCur->pStmt), -1, SQLITE_TRANSIENT); + tdsqlite3_result_text(ctx, tdsqlite3_sql(pCur->pStmt), -1, SQLITE_TRANSIENT); break; } case STMT_COLUMN_NCOL: { - sqlite3_result_int(ctx, sqlite3_column_count(pCur->pStmt)); + tdsqlite3_result_int(ctx, tdsqlite3_column_count(pCur->pStmt)); break; } case STMT_COLUMN_RO: { - sqlite3_result_int(ctx, sqlite3_stmt_readonly(pCur->pStmt)); + tdsqlite3_result_int(ctx, tdsqlite3_stmt_readonly(pCur->pStmt)); break; } case STMT_COLUMN_BUSY: { - sqlite3_result_int(ctx, sqlite3_stmt_busy(pCur->pStmt)); + tdsqlite3_result_int(ctx, tdsqlite3_stmt_busy(pCur->pStmt)); break; } case STMT_COLUMN_MEM: { @@ -232783,7 +232783,7 @@ static int stmtColumn( case STMT_COLUMN_NSTEP: case STMT_COLUMN_REPREP: case STMT_COLUMN_RUN: { - sqlite3_result_int(ctx, sqlite3_stmt_status(pCur->pStmt, + tdsqlite3_result_int(ctx, tdsqlite3_stmt_status(pCur->pStmt, i-STMT_COLUMN_NSCAN+SQLITE_STMTSTATUS_FULLSCAN_STEP, 0)); break; } @@ -232795,7 +232795,7 @@ static int stmtColumn( ** Return the rowid for the current row. In this implementation, the ** rowid is the same as the output value. */ -static int stmtRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ +static int stmtRowid(tdsqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ stmt_cursor *pCur = (stmt_cursor*)cur; *pRowid = pCur->iRowid; return SQLITE_OK; @@ -232805,7 +232805,7 @@ static int stmtRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ ** Return TRUE if the cursor has been moved off of the last ** row of output. */ -static int stmtEof(sqlite3_vtab_cursor *cur){ +static int stmtEof(tdsqlite3_vtab_cursor *cur){ stmt_cursor *pCur = (stmt_cursor*)cur; return pCur->pStmt==0; } @@ -232817,9 +232817,9 @@ static int stmtEof(sqlite3_vtab_cursor *cur){ ** stmtEof(). */ static int stmtFilter( - sqlite3_vtab_cursor *pVtabCursor, + tdsqlite3_vtab_cursor *pVtabCursor, int idxNum, const char *idxStr, - int argc, sqlite3_value **argv + int argc, tdsqlite3_value **argv ){ stmt_cursor *pCur = (stmt_cursor *)pVtabCursor; pCur->pStmt = 0; @@ -232834,8 +232834,8 @@ static int stmtFilter( ** plan. */ static int stmtBestIndex( - sqlite3_vtab *tab, - sqlite3_index_info *pIdxInfo + tdsqlite3_vtab *tab, + tdsqlite3_index_info *pIdxInfo ){ pIdxInfo->estimatedCost = (double)500; pIdxInfo->estimatedRows = 500; @@ -232846,7 +232846,7 @@ static int stmtBestIndex( ** This following structure defines all the methods for the ** stmt virtual table. */ -static sqlite3_module stmtModule = { +static tdsqlite3_module stmtModule = { 0, /* iVersion */ 0, /* xCreate */ stmtConnect, /* xConnect */ @@ -232875,10 +232875,10 @@ static sqlite3_module stmtModule = { #endif /* SQLITE_OMIT_VIRTUALTABLE */ -SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3 *db){ +SQLITE_PRIVATE int tdsqlite3StmtVtabInit(tdsqlite3 *db){ int rc = SQLITE_OK; #ifndef SQLITE_OMIT_VIRTUALTABLE - rc = sqlite3_create_module(db, "sqlite_stmt", &stmtModule, 0); + rc = tdsqlite3_create_module(db, "sqlite_stmt", &stmtModule, 0); #endif return rc; } @@ -232887,15 +232887,15 @@ SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3 *db){ #ifdef _WIN32 __declspec(dllexport) #endif -SQLITE_API int sqlite3_stmt_init( - sqlite3 *db, +SQLITE_API int tdsqlite3_stmt_init( + tdsqlite3 *db, char **pzErrMsg, - const sqlite3_api_routines *pApi + const tdsqlite3_api_routines *pApi ){ int rc = SQLITE_OK; SQLITE_EXTENSION_INIT2(pApi); #ifndef SQLITE_OMIT_VIRTUALTABLE - rc = sqlite3StmtVtabInit(db); + rc = tdsqlite3StmtVtabInit(db); #endif return rc; } @@ -232908,5 +232908,5 @@ SQLITE_API int sqlite3_stmt_init( #define SQLITE_SOURCE_ID "2020-01-22 18:38:59 f6affdd41608946fcfcea914ece149038a8b25a62bbe719ed2561c649b86alt2" #endif /* Return the source-id for this library */ -SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } +SQLITE_API const char *tdsqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } /************************** End of sqlite3.c ******************************/ diff --git a/sqlite/sqlite/sqlite3.h b/sqlite/sqlite/sqlite3.h index 65b3e6e19..44de2ee21 100644 --- a/sqlite/sqlite/sqlite3.h +++ b/sqlite/sqlite/sqlite3.h @@ -119,8 +119,8 @@ extern "C" { ** been edited in any way since it was last checked in, then the last ** four hexadecimal digits of the hash may be modified. ** -** See also: [sqlite3_libversion()], -** [sqlite3_libversion_number()], [sqlite3_sourceid()], +** See also: [tdsqlite3_libversion()], +** [tdsqlite3_libversion_number()], [tdsqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.31.0" @@ -129,7 +129,7 @@ extern "C" { /* ** CAPI3REF: Run-Time Library Version Numbers -** KEYWORDS: sqlite3_version sqlite3_sourceid +** KEYWORDS: tdsqlite3_version tdsqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros @@ -140,18 +140,18 @@ extern "C" { ** compiled with matching library and header files. ** **
-** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
-** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
-** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
+** assert( tdsqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
+** assert( strncmp(tdsqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
+** assert( strcmp(tdsqlite3_libversion(),SQLITE_VERSION)==0 );
 ** 
)^ ** -** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] -** macro. ^The sqlite3_libversion() function returns a pointer to the -** to the sqlite3_version[] string constant. The sqlite3_libversion() +** ^The tdsqlite3_version[] string constant contains the text of [SQLITE_VERSION] +** macro. ^The tdsqlite3_libversion() function returns a pointer to the +** to the tdsqlite3_version[] string constant. The tdsqlite3_libversion() ** function is provided for use in DLLs since DLL users usually do not have ** direct access to string constants within the DLL. ^The -** sqlite3_libversion_number() function returns an integer equal to -** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns +** tdsqlite3_libversion_number() function returns an integer equal to +** [SQLITE_VERSION_NUMBER]. ^(The tdsqlite3_sourceid() function returns ** a pointer to a string constant whose value is the same as the ** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built ** using an edited copy of [the amalgamation], then the last four characters @@ -159,45 +159,45 @@ extern "C" { ** ** See also: [sqlite_version()] and [sqlite_source_id()]. */ -SQLITE_API SQLITE_EXTERN const char sqlite3_version[]; -SQLITE_API const char *sqlite3_libversion(void); -SQLITE_API const char *sqlite3_sourceid(void); -SQLITE_API int sqlite3_libversion_number(void); +SQLITE_API SQLITE_EXTERN const char tdsqlite3_version[]; +SQLITE_API const char *tdsqlite3_libversion(void); +SQLITE_API const char *tdsqlite3_sourceid(void); +SQLITE_API int tdsqlite3_libversion_number(void); /* ** CAPI3REF: Run-Time Library Compilation Options Diagnostics ** -** ^The sqlite3_compileoption_used() function returns 0 or 1 +** ^The tdsqlite3_compileoption_used() function returns 0 or 1 ** indicating whether the specified option was defined at ** compile time. ^The SQLITE_ prefix may be omitted from the -** option name passed to sqlite3_compileoption_used(). +** option name passed to tdsqlite3_compileoption_used(). ** -** ^The sqlite3_compileoption_get() function allows iterating +** ^The tdsqlite3_compileoption_get() function allows iterating ** over the list of options that were defined at compile time by ** returning the N-th compile time option string. ^If N is out of range, -** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ +** tdsqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ ** prefix is omitted from any strings returned by -** sqlite3_compileoption_get(). +** tdsqlite3_compileoption_get(). ** -** ^Support for the diagnostic functions sqlite3_compileoption_used() -** and sqlite3_compileoption_get() may be omitted by specifying the +** ^Support for the diagnostic functions tdsqlite3_compileoption_used() +** and tdsqlite3_compileoption_get() may be omitted by specifying the ** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time. ** ** See also: SQL functions [sqlite_compileoption_used()] and ** [sqlite_compileoption_get()] and the [compile_options pragma]. */ #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS -SQLITE_API int sqlite3_compileoption_used(const char *zOptName); -SQLITE_API const char *sqlite3_compileoption_get(int N); +SQLITE_API int tdsqlite3_compileoption_used(const char *zOptName); +SQLITE_API const char *tdsqlite3_compileoption_get(int N); #else -# define sqlite3_compileoption_used(X) 0 -# define sqlite3_compileoption_get(X) ((void*)0) +# define tdsqlite3_compileoption_used(X) 0 +# define tdsqlite3_compileoption_get(X) ((void*)0) #endif /* ** CAPI3REF: Test To See If The Library Is Threadsafe ** -** ^The sqlite3_threadsafe() function returns zero if and only if +** ^The tdsqlite3_threadsafe() function returns zero if and only if ** SQLite was compiled with mutexing code omitted due to the ** [SQLITE_THREADSAFE] compile-time option being set to 0. ** @@ -220,33 +220,33 @@ SQLITE_API const char *sqlite3_compileoption_get(int N); ** This interface only reports on the compile-time mutex setting ** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with ** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but -** can be fully or partially disabled using a call to [sqlite3_config()] +** can be fully or partially disabled using a call to [tdsqlite3_config()] ** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], ** or [SQLITE_CONFIG_SERIALIZED]. ^(The return value of the -** sqlite3_threadsafe() function shows only the compile-time setting of +** tdsqlite3_threadsafe() function shows only the compile-time setting of ** thread safety, not any run-time changes to that setting made by -** sqlite3_config(). In other words, the return value from sqlite3_threadsafe() -** is unchanged by calls to sqlite3_config().)^ +** tdsqlite3_config(). In other words, the return value from tdsqlite3_threadsafe() +** is unchanged by calls to tdsqlite3_config().)^ ** ** See the [threading mode] documentation for additional information. */ -SQLITE_API int sqlite3_threadsafe(void); +SQLITE_API int tdsqlite3_threadsafe(void); /* ** CAPI3REF: Database Connection Handle ** KEYWORDS: {database connection} {database connections} ** ** Each open SQLite database is represented by a pointer to an instance of -** the opaque structure named "sqlite3". It is useful to think of an sqlite3 -** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and -** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] -** and [sqlite3_close_v2()] are its destructors. There are many other +** the opaque structure named "tdsqlite3". It is useful to think of an tdsqlite3 +** pointer as an object. The [tdsqlite3_open()], [tdsqlite3_open16()], and +** [tdsqlite3_open_v2()] interfaces are its constructors, and [tdsqlite3_close()] +** and [tdsqlite3_close_v2()] are its destructors. There are many other ** interfaces (such as -** [sqlite3_prepare_v2()], [sqlite3_create_function()], and -** [sqlite3_busy_timeout()] to name but three) that are methods on an -** sqlite3 object. +** [tdsqlite3_prepare_v2()], [tdsqlite3_create_function()], and +** [tdsqlite3_busy_timeout()] to name but three) that are methods on an +** tdsqlite3 object. */ -typedef struct sqlite3 sqlite3; +typedef struct tdsqlite3 tdsqlite3; /* ** CAPI3REF: 64-Bit Integer Types @@ -255,13 +255,13 @@ typedef struct sqlite3 sqlite3; ** Because there is no cross-platform way to specify 64-bit integer types ** SQLite includes typedefs for 64-bit signed and unsigned integers. ** -** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions. +** The tdsqlite3_int64 and tdsqlite3_uint64 are the preferred type definitions. ** The sqlite_int64 and sqlite_uint64 types are supported for backwards ** compatibility only. ** -** ^The sqlite3_int64 and sqlite_int64 types can store integer values +** ^The tdsqlite3_int64 and sqlite_int64 types can store integer values ** between -9223372036854775808 and +9223372036854775807 inclusive. ^The -** sqlite3_uint64 and sqlite_uint64 types can store integer values +** tdsqlite3_uint64 and sqlite_uint64 types can store integer values ** between 0 and +18446744073709551615 inclusive. */ #ifdef SQLITE_INT64_TYPE @@ -278,116 +278,116 @@ typedef struct sqlite3 sqlite3; typedef long long int sqlite_int64; typedef unsigned long long int sqlite_uint64; #endif -typedef sqlite_int64 sqlite3_int64; -typedef sqlite_uint64 sqlite3_uint64; +typedef sqlite_int64 tdsqlite3_int64; +typedef sqlite_uint64 tdsqlite3_uint64; /* ** If compiling for a processor that lacks floating point support, ** substitute integer for floating-point. */ #ifdef SQLITE_OMIT_FLOATING_POINT -# define double sqlite3_int64 +# define double tdsqlite3_int64 #endif /* ** CAPI3REF: Closing A Database Connection -** DESTRUCTOR: sqlite3 +** DESTRUCTOR: tdsqlite3 ** -** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors -** for the [sqlite3] object. -** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if -** the [sqlite3] object is successfully destroyed and all associated +** ^The tdsqlite3_close() and tdsqlite3_close_v2() routines are destructors +** for the [tdsqlite3] object. +** ^Calls to tdsqlite3_close() and tdsqlite3_close_v2() return [SQLITE_OK] if +** the [tdsqlite3] object is successfully destroyed and all associated ** resources are deallocated. ** ** ^If the database connection is associated with unfinalized prepared -** statements or unfinished sqlite3_backup objects then sqlite3_close() +** statements or unfinished tdsqlite3_backup objects then tdsqlite3_close() ** will leave the database connection open and return [SQLITE_BUSY]. -** ^If sqlite3_close_v2() is called with unfinalized prepared statements -** and/or unfinished sqlite3_backups, then the database connection becomes +** ^If tdsqlite3_close_v2() is called with unfinalized prepared statements +** and/or unfinished tdsqlite3_backups, then the database connection becomes ** an unusable "zombie" which will automatically be deallocated when the -** last prepared statement is finalized or the last sqlite3_backup is -** finished. The sqlite3_close_v2() interface is intended for use with +** last prepared statement is finalized or the last tdsqlite3_backup is +** finished. The tdsqlite3_close_v2() interface is intended for use with ** host languages that are garbage collected, and where the order in which ** destructors are called is arbitrary. ** -** Applications should [sqlite3_finalize | finalize] all [prepared statements], -** [sqlite3_blob_close | close] all [BLOB handles], and -** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated -** with the [sqlite3] object prior to attempting to close the object. ^If -** sqlite3_close_v2() is called on a [database connection] that still has +** Applications should [tdsqlite3_finalize | finalize] all [prepared statements], +** [tdsqlite3_blob_close | close] all [BLOB handles], and +** [tdsqlite3_backup_finish | finish] all [tdsqlite3_backup] objects associated +** with the [tdsqlite3] object prior to attempting to close the object. ^If +** tdsqlite3_close_v2() is called on a [database connection] that still has ** outstanding [prepared statements], [BLOB handles], and/or -** [sqlite3_backup] objects then it returns [SQLITE_OK] and the deallocation +** [tdsqlite3_backup] objects then it returns [SQLITE_OK] and the deallocation ** of resources is deferred until all [prepared statements], [BLOB handles], -** and [sqlite3_backup] objects are also destroyed. +** and [tdsqlite3_backup] objects are also destroyed. ** -** ^If an [sqlite3] object is destroyed while a transaction is open, +** ^If an [tdsqlite3] object is destroyed while a transaction is open, ** the transaction is automatically rolled back. ** -** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)] +** The C parameter to [tdsqlite3_close(C)] and [tdsqlite3_close_v2(C)] ** must be either a NULL -** pointer or an [sqlite3] object pointer obtained -** from [sqlite3_open()], [sqlite3_open16()], or -** [sqlite3_open_v2()], and not previously closed. -** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer +** pointer or an [tdsqlite3] object pointer obtained +** from [tdsqlite3_open()], [tdsqlite3_open16()], or +** [tdsqlite3_open_v2()], and not previously closed. +** ^Calling tdsqlite3_close() or tdsqlite3_close_v2() with a NULL pointer ** argument is a harmless no-op. */ -SQLITE_API int sqlite3_close(sqlite3*); -SQLITE_API int sqlite3_close_v2(sqlite3*); +SQLITE_API int tdsqlite3_close(tdsqlite3*); +SQLITE_API int tdsqlite3_close_v2(tdsqlite3*); /* ** The type for a callback function. ** This is legacy and deprecated. It is included for historical ** compatibility and is not documented. */ -typedef int (*sqlite3_callback)(void*,int,char**, char**); +typedef int (*tdsqlite3_callback)(void*,int,char**, char**); /* ** CAPI3REF: One-Step Query Execution Interface -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** The sqlite3_exec() interface is a convenience wrapper around -** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], +** The tdsqlite3_exec() interface is a convenience wrapper around +** [tdsqlite3_prepare_v2()], [tdsqlite3_step()], and [tdsqlite3_finalize()], ** that allows an application to run multiple statements of SQL ** without having to use a lot of C code. ** -** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, +** ^The tdsqlite3_exec() interface runs zero or more UTF-8 encoded, ** semicolon-separate SQL statements passed into its 2nd argument, ** in the context of the [database connection] passed in as its 1st ** argument. ^If the callback function of the 3rd argument to -** sqlite3_exec() is not NULL, then it is invoked for each result row +** tdsqlite3_exec() is not NULL, then it is invoked for each result row ** coming out of the evaluated SQL statements. ^The 4th argument to -** sqlite3_exec() is relayed through to the 1st argument of each -** callback invocation. ^If the callback pointer to sqlite3_exec() +** tdsqlite3_exec() is relayed through to the 1st argument of each +** callback invocation. ^If the callback pointer to tdsqlite3_exec() ** is NULL, then no callback is ever invoked and result rows are ** ignored. ** ** ^If an error occurs while evaluating the SQL statements passed into -** sqlite3_exec(), then execution of the current statement stops and -** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec() +** tdsqlite3_exec(), then execution of the current statement stops and +** subsequent statements are skipped. ^If the 5th parameter to tdsqlite3_exec() ** is not NULL then any error message is written into memory obtained -** from [sqlite3_malloc()] and passed back through the 5th parameter. -** To avoid memory leaks, the application should invoke [sqlite3_free()] +** from [tdsqlite3_malloc()] and passed back through the 5th parameter. +** To avoid memory leaks, the application should invoke [tdsqlite3_free()] ** on error message strings returned through the 5th parameter of -** sqlite3_exec() after the error message string is no longer needed. -** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors -** occur, then sqlite3_exec() sets the pointer in its 5th parameter to +** tdsqlite3_exec() after the error message string is no longer needed. +** ^If the 5th parameter to tdsqlite3_exec() is not NULL and no errors +** occur, then tdsqlite3_exec() sets the pointer in its 5th parameter to ** NULL before returning. ** -** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec() +** ^If an tdsqlite3_exec() callback returns non-zero, the tdsqlite3_exec() ** routine returns SQLITE_ABORT without invoking the callback again and ** without running any subsequent SQL statements. ** -** ^The 2nd argument to the sqlite3_exec() callback function is the -** number of columns in the result. ^The 3rd argument to the sqlite3_exec() +** ^The 2nd argument to the tdsqlite3_exec() callback function is the +** number of columns in the result. ^The 3rd argument to the tdsqlite3_exec() ** callback is an array of pointers to strings obtained as if from -** [sqlite3_column_text()], one for each column. ^If an element of a +** [tdsqlite3_column_text()], one for each column. ^If an element of a ** result row is NULL then the corresponding string pointer for the -** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the -** sqlite3_exec() callback is an array of pointers to strings where each +** tdsqlite3_exec() callback is a NULL pointer. ^The 4th argument to the +** tdsqlite3_exec() callback is an array of pointers to strings where each ** entry represents the name of corresponding result column as obtained -** from [sqlite3_column_name()]. +** from [tdsqlite3_column_name()]. ** -** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer +** ^If the 2nd parameter to tdsqlite3_exec() is a NULL pointer, a pointer ** to an empty string, or a pointer that contains only whitespace and/or ** SQL comments, then no SQL statements are evaluated and the database ** is not changed. @@ -395,16 +395,16 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**); ** Restrictions: ** **
    -**
  • The application must ensure that the 1st parameter to sqlite3_exec() +**
  • The application must ensure that the 1st parameter to tdsqlite3_exec() ** is a valid and open [database connection]. **
  • The application must not close the [database connection] specified by -** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. +** the 1st parameter to tdsqlite3_exec() while tdsqlite3_exec() is running. **
  • The application must not modify the SQL statement text passed into -** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. +** the 2nd parameter of tdsqlite3_exec() while tdsqlite3_exec() is running. **
*/ -SQLITE_API int sqlite3_exec( - sqlite3*, /* An open database */ +SQLITE_API int tdsqlite3_exec( + tdsqlite3*, /* An open database */ const char *sql, /* SQL to be evaluated */ int (*callback)(void*,int,char**,char**), /* Callback function */ void *, /* 1st argument to callback */ @@ -432,10 +432,10 @@ SQLITE_API int sqlite3_exec( #define SQLITE_LOCKED 6 /* A table in the database is locked */ #define SQLITE_NOMEM 7 /* A malloc() failed */ #define SQLITE_READONLY 8 /* Attempt to write a readonly database */ -#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ +#define SQLITE_INTERRUPT 9 /* Operation terminated by tdsqlite3_interrupt()*/ #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ #define SQLITE_CORRUPT 11 /* The database disk image is malformed */ -#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */ +#define SQLITE_NOTFOUND 12 /* Unknown opcode in tdsqlite3_file_control() */ #define SQLITE_FULL 13 /* Insertion failed because database is full */ #define SQLITE_CANTOPEN 14 /* Unable to open the database file */ #define SQLITE_PROTOCOL 15 /* Database lock protocol error */ @@ -448,12 +448,12 @@ SQLITE_API int sqlite3_exec( #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ #define SQLITE_AUTH 23 /* Authorization denied */ #define SQLITE_FORMAT 24 /* Not used */ -#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ +#define SQLITE_RANGE 25 /* 2nd parameter to tdsqlite3_bind out of range */ #define SQLITE_NOTADB 26 /* File opened that is not a database file */ -#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */ -#define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */ -#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */ -#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */ +#define SQLITE_NOTICE 27 /* Notifications from tdsqlite3_log() */ +#define SQLITE_WARNING 28 /* Warnings from tdsqlite3_log() */ +#define SQLITE_ROW 100 /* tdsqlite3_step() has another row ready */ +#define SQLITE_DONE 101 /* tdsqlite3_step() has finished executing */ /* end-of-error-codes */ /* @@ -469,9 +469,9 @@ SQLITE_API int sqlite3_exec( ** support for additional result codes that provide more detailed information ** about errors. These [extended result codes] are enabled or disabled ** on a per database connection basis using the -** [sqlite3_extended_result_codes()] API. Or, the extended code for +** [tdsqlite3_extended_result_codes()] API. Or, the extended code for ** the most recent error can be obtained using -** [sqlite3_extended_errcode()]. +** [tdsqlite3_extended_errcode()]. */ #define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8)) #define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8)) @@ -548,17 +548,17 @@ SQLITE_API int sqlite3_exec( ** CAPI3REF: Flags For File Open Operations ** ** These bit values are intended for use in the -** 3rd parameter to the [sqlite3_open_v2()] interface and -** in the 4th parameter to the [sqlite3_vfs.xOpen] method. +** 3rd parameter to the [tdsqlite3_open_v2()] interface and +** in the 4th parameter to the [tdsqlite3_vfs.xOpen] method. */ -#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for tdsqlite3_open_v2() */ +#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for tdsqlite3_open_v2() */ +#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for tdsqlite3_open_v2() */ #define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */ #define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */ #define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */ -#define SQLITE_OPEN_URI 0x00000040 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_MEMORY 0x00000080 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_URI 0x00000040 /* Ok for tdsqlite3_open_v2() */ +#define SQLITE_OPEN_MEMORY 0x00000080 /* Ok for tdsqlite3_open_v2() */ #define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */ #define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */ #define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */ @@ -566,22 +566,22 @@ SQLITE_API int sqlite3_exec( #define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */ #define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */ #define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */ -#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for tdsqlite3_open_v2() */ +#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for tdsqlite3_open_v2() */ +#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for tdsqlite3_open_v2() */ +#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for tdsqlite3_open_v2() */ #define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ -#define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for tdsqlite3_open_v2() */ /* Reserved: 0x00F00000 */ /* ** CAPI3REF: Device Characteristics ** -** The xDeviceCharacteristics method of the [sqlite3_io_methods] +** The xDeviceCharacteristics method of the [tdsqlite3_io_methods] ** object returns an integer which is a vector of these ** bit values expressing I/O characteristics of the mass storage -** device that holds the file that the [sqlite3_io_methods] +** device that holds the file that the [tdsqlite3_io_methods] ** refers to. ** ** The SQLITE_IOCAP_ATOMIC property means that all writes of @@ -629,7 +629,7 @@ SQLITE_API int sqlite3_exec( ** ** SQLite uses one of these integer values as the second ** argument to calls it makes to the xLock() and xUnlock() methods -** of an [sqlite3_io_methods] object. +** of an [tdsqlite3_io_methods] object. */ #define SQLITE_LOCK_NONE 0 #define SQLITE_LOCK_SHARED 1 @@ -641,7 +641,7 @@ SQLITE_API int sqlite3_exec( ** CAPI3REF: Synchronization Type Flags ** ** When SQLite invokes the xSync() method of an -** [sqlite3_io_methods] object it uses a combination of +** [tdsqlite3_io_methods] object it uses a combination of ** these integer values as the second argument. ** ** When the SQLITE_SYNC_DATAONLY flag is used, it means that the @@ -670,33 +670,33 @@ SQLITE_API int sqlite3_exec( /* ** CAPI3REF: OS Interface Open File Handle ** -** An [sqlite3_file] object represents an open file in the -** [sqlite3_vfs | OS interface layer]. Individual OS interface +** An [tdsqlite3_file] object represents an open file in the +** [tdsqlite3_vfs | OS interface layer]. Individual OS interface ** implementations will ** want to subclass this object by appending additional fields ** for their own use. The pMethods entry is a pointer to an -** [sqlite3_io_methods] object that defines methods for performing +** [tdsqlite3_io_methods] object that defines methods for performing ** I/O operations on the open file. */ -typedef struct sqlite3_file sqlite3_file; -struct sqlite3_file { - const struct sqlite3_io_methods *pMethods; /* Methods for an open file */ +typedef struct tdsqlite3_file tdsqlite3_file; +struct tdsqlite3_file { + const struct tdsqlite3_io_methods *pMethods; /* Methods for an open file */ }; /* ** CAPI3REF: OS Interface File Virtual Methods Object ** -** Every file opened by the [sqlite3_vfs.xOpen] method populates an -** [sqlite3_file] object (or, more commonly, a subclass of the -** [sqlite3_file] object) with a pointer to an instance of this object. +** Every file opened by the [tdsqlite3_vfs.xOpen] method populates an +** [tdsqlite3_file] object (or, more commonly, a subclass of the +** [tdsqlite3_file] object) with a pointer to an instance of this object. ** This object defines the methods used to perform various operations -** against the open file represented by the [sqlite3_file] object. +** against the open file represented by the [tdsqlite3_file] object. ** -** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element -** to a non-NULL pointer, then the sqlite3_io_methods.xClose method -** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The -** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen] -** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element +** If the [tdsqlite3_vfs.xOpen] method sets the tdsqlite3_file.pMethods element +** to a non-NULL pointer, then the tdsqlite3_io_methods.xClose method +** may be invoked even if the [tdsqlite3_vfs.xOpen] reported that it failed. The +** only way to prevent a call to xClose following a failed [tdsqlite3_vfs.xOpen] +** is for the [tdsqlite3_vfs.xOpen] to set the tdsqlite3_file.pMethods element ** to NULL. ** ** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or @@ -721,7 +721,7 @@ struct sqlite3_file { ** ** The xFileControl() method is a generic interface that allows custom ** VFS implementations to directly control an open file using the -** [sqlite3_file_control()] interface. The second "op" argument is an +** [tdsqlite3_file_control()] interface. The second "op" argument is an ** integer opcode. The third argument is a generic pointer intended to ** point to a structure that may contain arguments or space in which to ** write return values. Potential uses for xFileControl() might be @@ -777,29 +777,29 @@ struct sqlite3_file { ** failure to zero-fill short reads will eventually lead to ** database corruption. */ -typedef struct sqlite3_io_methods sqlite3_io_methods; -struct sqlite3_io_methods { +typedef struct tdsqlite3_io_methods tdsqlite3_io_methods; +struct tdsqlite3_io_methods { int iVersion; - int (*xClose)(sqlite3_file*); - int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst); - int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst); - int (*xTruncate)(sqlite3_file*, sqlite3_int64 size); - int (*xSync)(sqlite3_file*, int flags); - int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize); - int (*xLock)(sqlite3_file*, int); - int (*xUnlock)(sqlite3_file*, int); - int (*xCheckReservedLock)(sqlite3_file*, int *pResOut); - int (*xFileControl)(sqlite3_file*, int op, void *pArg); - int (*xSectorSize)(sqlite3_file*); - int (*xDeviceCharacteristics)(sqlite3_file*); + int (*xClose)(tdsqlite3_file*); + int (*xRead)(tdsqlite3_file*, void*, int iAmt, tdsqlite3_int64 iOfst); + int (*xWrite)(tdsqlite3_file*, const void*, int iAmt, tdsqlite3_int64 iOfst); + int (*xTruncate)(tdsqlite3_file*, tdsqlite3_int64 size); + int (*xSync)(tdsqlite3_file*, int flags); + int (*xFileSize)(tdsqlite3_file*, tdsqlite3_int64 *pSize); + int (*xLock)(tdsqlite3_file*, int); + int (*xUnlock)(tdsqlite3_file*, int); + int (*xCheckReservedLock)(tdsqlite3_file*, int *pResOut); + int (*xFileControl)(tdsqlite3_file*, int op, void *pArg); + int (*xSectorSize)(tdsqlite3_file*); + int (*xDeviceCharacteristics)(tdsqlite3_file*); /* Methods above are valid for version 1 */ - int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**); - int (*xShmLock)(sqlite3_file*, int offset, int n, int flags); - void (*xShmBarrier)(sqlite3_file*); - int (*xShmUnmap)(sqlite3_file*, int deleteFlag); + int (*xShmMap)(tdsqlite3_file*, int iPg, int pgsz, int, void volatile**); + int (*xShmLock)(tdsqlite3_file*, int offset, int n, int flags); + void (*xShmBarrier)(tdsqlite3_file*); + int (*xShmUnmap)(tdsqlite3_file*, int deleteFlag); /* Methods above are valid for version 2 */ - int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp); - int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p); + int (*xFetch)(tdsqlite3_file*, tdsqlite3_int64 iOfst, int iAmt, void **pp); + int (*xUnfetch)(tdsqlite3_file*, tdsqlite3_int64 iOfst, void *p); /* Methods above are valid for version 3 */ /* Additional methods may be added in future releases */ }; @@ -809,7 +809,7 @@ struct sqlite3_io_methods { ** KEYWORDS: {file control opcodes} {file control opcode} ** ** These integer constants are opcodes for the xFileControl method -** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()] +** of the [tdsqlite3_io_methods] object and for the [tdsqlite3_file_control()] ** interface. ** **
    @@ -832,8 +832,8 @@ struct sqlite3_io_methods { ** **
  • [[SQLITE_FCNTL_SIZE_LIMIT]] ** The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that -** implements [sqlite3_deserialize()] to set an upper bound on the size -** of the in-memory database. The argument is a pointer to a [sqlite3_int64]. +** implements [tdsqlite3_deserialize()] to set an upper bound on the size +** of the in-memory database. The argument is a pointer to a [tdsqlite3_int64]. ** If the integer pointed to is negative, then it is filled in with the ** current limit. Otherwise the limit is set to the larger of the value ** of the integer pointed to and the current database size. The integer @@ -842,7 +842,7 @@ struct sqlite3_io_methods { **
  • [[SQLITE_FCNTL_CHUNK_SIZE]] ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS ** extends and truncates the database file in chunks of a size specified -** by the user. The fourth argument to [sqlite3_file_control()] should +** by the user. The fourth argument to [tdsqlite3_file_control()] should ** point to an integer (type int) containing the new chunk-size to use ** for the nominated database. Allocating database file space in large ** chunks (say 1MB at a time), may reduce file-system fragmentation and @@ -850,12 +850,12 @@ struct sqlite3_io_methods { ** **
  • [[SQLITE_FCNTL_FILE_POINTER]] ** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer -** to the [sqlite3_file] object associated with a particular database +** to the [tdsqlite3_file] object associated with a particular database ** connection. See also [SQLITE_FCNTL_JOURNAL_POINTER]. ** **
  • [[SQLITE_FCNTL_JOURNAL_POINTER]] ** The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer -** to the [sqlite3_file] object associated with the journal file (either +** to the [tdsqlite3_file] object associated with the journal file (either ** the [rollback journal] or the [write-ahead log]) for a particular database ** connection. See also [SQLITE_FCNTL_FILE_POINTER]. ** @@ -873,7 +873,7 @@ struct sqlite3_io_methods { ** as part of a multi-database commit, the argument points to a nul-terminated ** string containing the transactions master-journal file name. VFSes that ** do not need this signal should silently ignore this opcode. Applications -** should not call [sqlite3_file_control()] with this opcode as doing so may +** should not call [tdsqlite3_file_control()] with this opcode as doing so may ** disrupt the operation of the specialized VFSes that do require it. ** **
  • [[SQLITE_FCNTL_COMMIT_PHASETWO]] @@ -881,7 +881,7 @@ struct sqlite3_io_methods { ** and sent to the VFS after a transaction has been committed immediately ** but before the database is unlocked. VFSes that do not need this signal ** should silently ignore this opcode. Applications should not call -** [sqlite3_file_control()] with this opcode as doing so may disrupt the +** [tdsqlite3_file_control()] with this opcode as doing so may disrupt the ** operation of the specialized VFSes that do require it. ** **
  • [[SQLITE_FCNTL_WIN32_AV_RETRY]] @@ -912,7 +912,7 @@ struct sqlite3_io_methods { ** have write permission on the directory containing the database file want ** to read the database file, as the WAL and shared memory files must exist ** in order for the database to be readable. The fourth parameter to -** [sqlite3_file_control()] for this opcode should be a pointer to an integer. +** [tdsqlite3_file_control()] for this opcode should be a pointer to an integer. ** That integer is 0 to disable persistent WAL mode or 1 to enable persistent ** WAL mode. If the integer is -1, then it is overwritten with the current ** WAL persistence setting. @@ -922,7 +922,7 @@ struct sqlite3_io_methods { ** persistent "powersafe-overwrite" or "PSOW" setting. The PSOW setting ** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the ** xDeviceCharacteristics methods. The fourth parameter to -** [sqlite3_file_control()] for this opcode should be a pointer to an integer. +** [tdsqlite3_file_control()] for this opcode should be a pointer to an integer. ** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage ** mode. If the integer is -1, then it is overwritten with the current ** zero-damage mode setting. @@ -937,8 +937,8 @@ struct sqlite3_io_methods { ** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of ** all [VFSes] in the VFS stack. The names are of all VFS shims and the ** final bottom-level VFS are written into memory obtained from -** [sqlite3_malloc()] and the result is stored in the char* variable -** that the fourth parameter of [sqlite3_file_control()] points to. +** [tdsqlite3_malloc()] and the result is stored in the char* variable +** that the fourth parameter of [tdsqlite3_file_control()] points to. ** The caller is responsible for freeing the memory when done. As with ** all file-control actions, there is no guarantee that this will actually ** do anything. Callers should initialize the char* variable to a NULL @@ -948,22 +948,22 @@ struct sqlite3_io_methods { **
  • [[SQLITE_FCNTL_VFS_POINTER]] ** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level ** [VFSes] currently in use. ^(The argument X in -** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be -** of type "[sqlite3_vfs] **". This opcodes will set *X +** tdsqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be +** of type "[tdsqlite3_vfs] **". This opcodes will set *X ** to a pointer to the top-level VFS.)^ ** ^When there are multiple VFS shims in the stack, this opcode finds the ** upper-most shim only. ** **
  • [[SQLITE_FCNTL_PRAGMA]] ** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] -** file control is sent to the open [sqlite3_file] object corresponding +** file control is sent to the open [tdsqlite3_file] object corresponding ** to the database file to which the pragma statement refers. ^The argument ** to the [SQLITE_FCNTL_PRAGMA] file control is an array of ** pointers to strings (char**) in which the second element of the array ** is the name of the pragma and the third element is the argument to the ** pragma or NULL if the pragma has no argument. ^The handler for an ** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element -** of the char** argument point to a string obtained from [sqlite3_mprintf()] +** of the char** argument point to a string obtained from [tdsqlite3_mprintf()] ** or the equivalent and that string will become the result of the pragma or ** the error message if the pragma fails. ^If the ** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal @@ -997,13 +997,13 @@ struct sqlite3_io_methods { ** temporary filename using the same algorithm that is followed to generate ** temporary filenames for TEMP tables and other internal uses. The ** argument should be a char** which will be filled with the filename -** written into memory obtained from [sqlite3_malloc()]. The caller should -** invoke [sqlite3_free()] on the result to avoid a memory leak. +** written into memory obtained from [tdsqlite3_malloc()]. The caller should +** invoke [tdsqlite3_free()] on the result to avoid a memory leak. ** **
  • [[SQLITE_FCNTL_MMAP_SIZE]] ** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the ** maximum number of bytes that will be used for memory-mapped I/O. -** The argument is a pointer to a value of type sqlite3_int64 that +** The argument is a pointer to a value of type tdsqlite3_int64 that ** is an advisory maximum number of bytes in the file to memory map. The ** pointer is overwritten with the old value. The limit is not changed if ** the value originally pointed to is negative, and so the current limit @@ -1061,7 +1061,7 @@ struct sqlite3_io_methods { ** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to ** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or ** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make -** no VFS interface calls on the same [sqlite3_file] file descriptor +** no VFS interface calls on the same [tdsqlite3_file] file descriptor ** except for calls to the xWrite method and the xFileControl method ** with [SQLITE_FCNTL_SIZE_HINT]. ** @@ -1099,11 +1099,11 @@ struct sqlite3_io_methods { ** "data version" changes whenever any change occurs to the corresponding ** database file, either through SQL statements on the same database ** connection or through transactions committed by separate database -** connections possibly in other processes. The [sqlite3_total_changes()] +** connections possibly in other processes. The [tdsqlite3_total_changes()] ** interface can be used to find if any database on the connection has changed, ** but that interface responds to changes on TEMP as well as MAIN and does ** not provide a mechanism to detect changes to MAIN only. Also, the -** [sqlite3_total_changes()] interface responds to internal changes only and +** [tdsqlite3_total_changes()] interface responds to internal changes only and ** omits changes made by other database connections. The ** [PRAGMA data_version] command provides a mechanism to detect changes to ** a single attached database that occur due to other database connections, @@ -1165,29 +1165,29 @@ struct sqlite3_io_methods { /* ** CAPI3REF: Mutex Handle ** -** The mutex module within SQLite defines [sqlite3_mutex] to be an +** The mutex module within SQLite defines [tdsqlite3_mutex] to be an ** abstract type for a mutex object. The SQLite core never looks -** at the internal representation of an [sqlite3_mutex]. It only -** deals with pointers to the [sqlite3_mutex] object. +** at the internal representation of an [tdsqlite3_mutex]. It only +** deals with pointers to the [tdsqlite3_mutex] object. ** -** Mutexes are created using [sqlite3_mutex_alloc()]. +** Mutexes are created using [tdsqlite3_mutex_alloc()]. */ -typedef struct sqlite3_mutex sqlite3_mutex; +typedef struct tdsqlite3_mutex tdsqlite3_mutex; /* ** CAPI3REF: Loadable Extension Thunk ** -** A pointer to the opaque sqlite3_api_routines structure is passed as +** A pointer to the opaque tdsqlite3_api_routines structure is passed as ** the third parameter to entry points of [loadable extensions]. This ** structure must be typedefed in order to work around compiler warnings ** on some platforms. */ -typedef struct sqlite3_api_routines sqlite3_api_routines; +typedef struct tdsqlite3_api_routines tdsqlite3_api_routines; /* ** CAPI3REF: OS Interface Object ** -** An instance of the sqlite3_vfs object defines the interface between +** An instance of the tdsqlite3_vfs object defines the interface between ** the SQLite core and the underlying operating system. The "vfs" ** in the name of the object stands for "virtual file system". See ** the [VFS | VFS documentation] for further information. @@ -1198,34 +1198,34 @@ typedef struct sqlite3_api_routines sqlite3_api_routines; ** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2 ** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased ** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields -** may be appended to the sqlite3_vfs object and the iVersion value +** may be appended to the tdsqlite3_vfs object and the iVersion value ** may increase again in future versions of SQLite. ** Note that due to an oversight, the structure -** of the sqlite3_vfs object changed in the transition from +** of the tdsqlite3_vfs object changed in the transition from ** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0] ** and yet the iVersion field was not increased. ** -** The szOsFile field is the size of the subclassed [sqlite3_file] +** The szOsFile field is the size of the subclassed [tdsqlite3_file] ** structure used by this VFS. mxPathname is the maximum length of ** a pathname in this VFS. ** -** Registered sqlite3_vfs objects are kept on a linked list formed by -** the pNext pointer. The [sqlite3_vfs_register()] -** and [sqlite3_vfs_unregister()] interfaces manage this list -** in a thread-safe way. The [sqlite3_vfs_find()] interface +** Registered tdsqlite3_vfs objects are kept on a linked list formed by +** the pNext pointer. The [tdsqlite3_vfs_register()] +** and [tdsqlite3_vfs_unregister()] interfaces manage this list +** in a thread-safe way. The [tdsqlite3_vfs_find()] interface ** searches the list. Neither the application code nor the VFS ** implementation should use the pNext pointer. ** -** The pNext field is the only field in the sqlite3_vfs +** The pNext field is the only field in the tdsqlite3_vfs ** structure that SQLite will ever modify. SQLite will only access ** or modify this field while holding a particular static mutex. -** The application should never modify anything within the sqlite3_vfs +** The application should never modify anything within the tdsqlite3_vfs ** object once the object has been registered. ** ** The zName field holds the name of the VFS module. The name must ** be unique across all VFS modules. ** -** [[sqlite3_vfs.xOpen]] +** [[tdsqlite3_vfs.xOpen]] ** ^SQLite guarantees that the zFilename parameter to xOpen ** is either a NULL pointer or string obtained ** from xFullPathname() with an optional suffix added. @@ -1235,7 +1235,7 @@ typedef struct sqlite3_api_routines sqlite3_api_routines; ** ^SQLite further guarantees that ** the string will be valid and unchanged until xClose() is ** called. Because of the previous sentence, -** the [sqlite3_file] can safely store a pointer to the +** the [tdsqlite3_file] can safely store a pointer to the ** filename if it needs to remember the filename for some reason. ** If the zFilename parameter to xOpen is a NULL pointer then xOpen ** must invent its own temporary name for the file. ^Whenever the @@ -1243,8 +1243,8 @@ typedef struct sqlite3_api_routines sqlite3_api_routines; ** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE]. ** ** The flags argument to xOpen() includes all bits set in -** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()] -** or [sqlite3_open16()] is used, then flags includes at least +** the flags argument to [tdsqlite3_open_v2()]. Or if [tdsqlite3_open()] +** or [tdsqlite3_open16()] is used, then flags includes at least ** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. ** If xOpen() opens a file read-only then it sets *pOutFlags to ** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set. @@ -1294,16 +1294,16 @@ typedef struct sqlite3_api_routines sqlite3_api_routines; ** for exclusive access. ** ** ^At least szOsFile bytes of memory are allocated by SQLite -** to hold the [sqlite3_file] structure passed as the third +** to hold the [tdsqlite3_file] structure passed as the third ** argument to xOpen. The xOpen method does not have to ** allocate the structure; it should just fill it in. Note that -** the xOpen method must set the sqlite3_file.pMethods to either -** a valid [sqlite3_io_methods] object or to NULL. xOpen must do -** this even if the open fails. SQLite expects that the sqlite3_file.pMethods +** the xOpen method must set the tdsqlite3_file.pMethods to either +** a valid [tdsqlite3_io_methods] object or to NULL. xOpen must do +** this even if the open fails. SQLite expects that the tdsqlite3_file.pMethods ** element will be valid after xOpen returns regardless of the success ** or failure of the xOpen call. ** -** [[sqlite3_vfs.xAccess]] +** [[tdsqlite3_vfs.xAccess]] ** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] @@ -1353,40 +1353,40 @@ typedef struct sqlite3_api_routines sqlite3_api_routines; ** from one release to the next. Applications must not attempt to access ** any of these methods if the iVersion of the VFS is less than 3. */ -typedef struct sqlite3_vfs sqlite3_vfs; -typedef void (*sqlite3_syscall_ptr)(void); -struct sqlite3_vfs { +typedef struct tdsqlite3_vfs tdsqlite3_vfs; +typedef void (*tdsqlite3_syscall_ptr)(void); +struct tdsqlite3_vfs { int iVersion; /* Structure version number (currently 3) */ - int szOsFile; /* Size of subclassed sqlite3_file */ + int szOsFile; /* Size of subclassed tdsqlite3_file */ int mxPathname; /* Maximum file pathname length */ - sqlite3_vfs *pNext; /* Next registered VFS */ + tdsqlite3_vfs *pNext; /* Next registered VFS */ const char *zName; /* Name of this virtual file system */ void *pAppData; /* Pointer to application-specific data */ - int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*, + int (*xOpen)(tdsqlite3_vfs*, const char *zName, tdsqlite3_file*, int flags, int *pOutFlags); - int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir); - int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut); - int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut); - void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename); - void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg); - void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void); - void (*xDlClose)(sqlite3_vfs*, void*); - int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut); - int (*xSleep)(sqlite3_vfs*, int microseconds); - int (*xCurrentTime)(sqlite3_vfs*, double*); - int (*xGetLastError)(sqlite3_vfs*, int, char *); + int (*xDelete)(tdsqlite3_vfs*, const char *zName, int syncDir); + int (*xAccess)(tdsqlite3_vfs*, const char *zName, int flags, int *pResOut); + int (*xFullPathname)(tdsqlite3_vfs*, const char *zName, int nOut, char *zOut); + void *(*xDlOpen)(tdsqlite3_vfs*, const char *zFilename); + void (*xDlError)(tdsqlite3_vfs*, int nByte, char *zErrMsg); + void (*(*xDlSym)(tdsqlite3_vfs*,void*, const char *zSymbol))(void); + void (*xDlClose)(tdsqlite3_vfs*, void*); + int (*xRandomness)(tdsqlite3_vfs*, int nByte, char *zOut); + int (*xSleep)(tdsqlite3_vfs*, int microseconds); + int (*xCurrentTime)(tdsqlite3_vfs*, double*); + int (*xGetLastError)(tdsqlite3_vfs*, int, char *); /* ** The methods above are in version 1 of the sqlite_vfs object ** definition. Those that follow are added in version 2 or later */ - int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*); + int (*xCurrentTimeInt64)(tdsqlite3_vfs*, tdsqlite3_int64*); /* ** The methods above are in versions 1 and 2 of the sqlite_vfs object. ** Those below are for version 3 and greater. */ - int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr); - sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName); - const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName); + int (*xSetSystemCall)(tdsqlite3_vfs*, const char *zName, tdsqlite3_syscall_ptr); + tdsqlite3_syscall_ptr (*xGetSystemCall)(tdsqlite3_vfs*, const char *zName); + const char *(*xNextSystemCall)(tdsqlite3_vfs*, const char *zName); /* ** The methods above are in versions 1 through 3 of the sqlite_vfs object. ** New fields may be appended in future versions. The iVersion @@ -1398,7 +1398,7 @@ struct sqlite3_vfs { ** CAPI3REF: Flags for the xAccess VFS method ** ** These integer constants can be used as the third parameter to -** the xAccess method of an [sqlite3_vfs] object. They determine +** the xAccess method of an [tdsqlite3_vfs] object. They determine ** what kind of permissions the xAccess method is looking for. ** With SQLITE_ACCESS_EXISTS, the xAccess method ** simply checks whether the file exists. @@ -1422,7 +1422,7 @@ struct sqlite3_vfs { ** CAPI3REF: Flags for the xShmLock VFS method ** ** These integer constants define the various locking operations -** allowed by the xShmLock method of [sqlite3_io_methods]. The +** allowed by the xShmLock method of [tdsqlite3_io_methods]. The ** following are the only legal combinations of flags to the ** xShmLock method: ** @@ -1448,7 +1448,7 @@ struct sqlite3_vfs { /* ** CAPI3REF: Maximum xShmLock index ** -** The xShmLock method on [sqlite3_io_methods] may use values +** The xShmLock method on [tdsqlite3_io_methods] may use values ** between 0 and this upper bound as its "offset" argument. ** The SQLite core will never attempt to acquire or release a ** lock outside of this range @@ -1459,134 +1459,134 @@ struct sqlite3_vfs { /* ** CAPI3REF: Initialize The SQLite Library ** -** ^The sqlite3_initialize() routine initializes the -** SQLite library. ^The sqlite3_shutdown() routine -** deallocates any resources that were allocated by sqlite3_initialize(). +** ^The tdsqlite3_initialize() routine initializes the +** SQLite library. ^The tdsqlite3_shutdown() routine +** deallocates any resources that were allocated by tdsqlite3_initialize(). ** These routines are designed to aid in process initialization and ** shutdown on embedded systems. Workstation applications using ** SQLite normally do not need to invoke either of these routines. ** -** A call to sqlite3_initialize() is an "effective" call if it is -** the first time sqlite3_initialize() is invoked during the lifetime of -** the process, or if it is the first time sqlite3_initialize() is invoked -** following a call to sqlite3_shutdown(). ^(Only an effective call -** of sqlite3_initialize() does any initialization. All other calls +** A call to tdsqlite3_initialize() is an "effective" call if it is +** the first time tdsqlite3_initialize() is invoked during the lifetime of +** the process, or if it is the first time tdsqlite3_initialize() is invoked +** following a call to tdsqlite3_shutdown(). ^(Only an effective call +** of tdsqlite3_initialize() does any initialization. All other calls ** are harmless no-ops.)^ ** -** A call to sqlite3_shutdown() is an "effective" call if it is the first -** call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only -** an effective call to sqlite3_shutdown() does any deinitialization. -** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^ +** A call to tdsqlite3_shutdown() is an "effective" call if it is the first +** call to tdsqlite3_shutdown() since the last tdsqlite3_initialize(). ^(Only +** an effective call to tdsqlite3_shutdown() does any deinitialization. +** All other valid calls to tdsqlite3_shutdown() are harmless no-ops.)^ ** -** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown() -** is not. The sqlite3_shutdown() interface must only be called from a +** The tdsqlite3_initialize() interface is threadsafe, but tdsqlite3_shutdown() +** is not. The tdsqlite3_shutdown() interface must only be called from a ** single thread. All open [database connections] must be closed and all ** other SQLite resources must be deallocated prior to invoking -** sqlite3_shutdown(). +** tdsqlite3_shutdown(). ** -** Among other things, ^sqlite3_initialize() will invoke -** sqlite3_os_init(). Similarly, ^sqlite3_shutdown() -** will invoke sqlite3_os_end(). +** Among other things, ^tdsqlite3_initialize() will invoke +** tdsqlite3_os_init(). Similarly, ^tdsqlite3_shutdown() +** will invoke tdsqlite3_os_end(). ** -** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success. -** ^If for some reason, sqlite3_initialize() is unable to initialize +** ^The tdsqlite3_initialize() routine returns [SQLITE_OK] on success. +** ^If for some reason, tdsqlite3_initialize() is unable to initialize ** the library (perhaps it is unable to allocate a needed resource such ** as a mutex) it returns an [error code] other than [SQLITE_OK]. ** -** ^The sqlite3_initialize() routine is called internally by many other +** ^The tdsqlite3_initialize() routine is called internally by many other ** SQLite interfaces so that an application usually does not need to -** invoke sqlite3_initialize() directly. For example, [sqlite3_open()] -** calls sqlite3_initialize() so the SQLite library will be automatically -** initialized when [sqlite3_open()] is called if it has not be initialized +** invoke tdsqlite3_initialize() directly. For example, [tdsqlite3_open()] +** calls tdsqlite3_initialize() so the SQLite library will be automatically +** initialized when [tdsqlite3_open()] is called if it has not be initialized ** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT] -** compile-time option, then the automatic calls to sqlite3_initialize() -** are omitted and the application must call sqlite3_initialize() directly +** compile-time option, then the automatic calls to tdsqlite3_initialize() +** are omitted and the application must call tdsqlite3_initialize() directly ** prior to using any other SQLite interface. For maximum portability, -** it is recommended that applications always invoke sqlite3_initialize() +** it is recommended that applications always invoke tdsqlite3_initialize() ** directly prior to using any other SQLite interface. Future releases ** of SQLite may require this. In other words, the behavior exhibited ** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the ** default behavior in some future release of SQLite. ** -** The sqlite3_os_init() routine does operating-system specific -** initialization of the SQLite library. The sqlite3_os_end() -** routine undoes the effect of sqlite3_os_init(). Typical tasks +** The tdsqlite3_os_init() routine does operating-system specific +** initialization of the SQLite library. The tdsqlite3_os_end() +** routine undoes the effect of tdsqlite3_os_init(). Typical tasks ** performed by these routines include allocation or deallocation ** of static resources, initialization of global variables, -** setting up a default [sqlite3_vfs] module, or setting up -** a default configuration using [sqlite3_config()]. +** setting up a default [tdsqlite3_vfs] module, or setting up +** a default configuration using [tdsqlite3_config()]. ** -** The application should never invoke either sqlite3_os_init() -** or sqlite3_os_end() directly. The application should only invoke -** sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init() -** interface is called automatically by sqlite3_initialize() and -** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate -** implementations for sqlite3_os_init() and sqlite3_os_end() +** The application should never invoke either tdsqlite3_os_init() +** or tdsqlite3_os_end() directly. The application should only invoke +** tdsqlite3_initialize() and tdsqlite3_shutdown(). The tdsqlite3_os_init() +** interface is called automatically by tdsqlite3_initialize() and +** tdsqlite3_os_end() is called by tdsqlite3_shutdown(). Appropriate +** implementations for tdsqlite3_os_init() and tdsqlite3_os_end() ** are built into SQLite when it is compiled for Unix, Windows, or OS/2. ** When [custom builds | built for other platforms] ** (using the [SQLITE_OS_OTHER=1] compile-time ** option) the application must supply a suitable implementation for -** sqlite3_os_init() and sqlite3_os_end(). An application-supplied -** implementation of sqlite3_os_init() or sqlite3_os_end() +** tdsqlite3_os_init() and tdsqlite3_os_end(). An application-supplied +** implementation of tdsqlite3_os_init() or tdsqlite3_os_end() ** must return [SQLITE_OK] on success and some other [error code] upon ** failure. */ -SQLITE_API int sqlite3_initialize(void); -SQLITE_API int sqlite3_shutdown(void); -SQLITE_API int sqlite3_os_init(void); -SQLITE_API int sqlite3_os_end(void); +SQLITE_API int tdsqlite3_initialize(void); +SQLITE_API int tdsqlite3_shutdown(void); +SQLITE_API int tdsqlite3_os_init(void); +SQLITE_API int tdsqlite3_os_end(void); /* ** CAPI3REF: Configuring The SQLite Library ** -** The sqlite3_config() interface is used to make global configuration +** The tdsqlite3_config() interface is used to make global configuration ** changes to SQLite in order to tune SQLite to the specific needs of ** the application. The default configuration is recommended for most ** applications and so this routine is usually not necessary. It is ** provided to support rare applications with unusual needs. ** -** The sqlite3_config() interface is not threadsafe. The application +** The tdsqlite3_config() interface is not threadsafe. The application ** must ensure that no other SQLite interfaces are invoked by other -** threads while sqlite3_config() is running. +** threads while tdsqlite3_config() is running. ** -** The sqlite3_config() interface +** The tdsqlite3_config() interface ** may only be invoked prior to library initialization using -** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()]. -** ^If sqlite3_config() is called after [sqlite3_initialize()] and before -** [sqlite3_shutdown()] then it will return SQLITE_MISUSE. -** Note, however, that ^sqlite3_config() can be called as part of the -** implementation of an application-defined [sqlite3_os_init()]. +** [tdsqlite3_initialize()] or after shutdown by [tdsqlite3_shutdown()]. +** ^If tdsqlite3_config() is called after [tdsqlite3_initialize()] and before +** [tdsqlite3_shutdown()] then it will return SQLITE_MISUSE. +** Note, however, that ^tdsqlite3_config() can be called as part of the +** implementation of an application-defined [tdsqlite3_os_init()]. ** -** The first argument to sqlite3_config() is an integer +** The first argument to tdsqlite3_config() is an integer ** [configuration option] that determines ** what property of SQLite is to be configured. Subsequent arguments ** vary depending on the [configuration option] ** in the first argument. ** -** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK]. +** ^When a configuration option is set, tdsqlite3_config() returns [SQLITE_OK]. ** ^If the option is unknown or SQLite is unable to set the option ** then this routine returns a non-zero [error code]. */ -SQLITE_API int sqlite3_config(int, ...); +SQLITE_API int tdsqlite3_config(int, ...); /* ** CAPI3REF: Configure database connections -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** The sqlite3_db_config() interface is used to make configuration +** The tdsqlite3_db_config() interface is used to make configuration ** changes to a [database connection]. The interface is similar to -** [sqlite3_config()] except that the changes apply to a single +** [tdsqlite3_config()] except that the changes apply to a single ** [database connection] (specified in the first argument). ** -** The second argument to sqlite3_db_config(D,V,...) is the +** The second argument to tdsqlite3_db_config(D,V,...) is the ** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code ** that indicates what aspect of the [database connection] is being configured. ** Subsequent arguments vary depending on the configuration verb. ** -** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if +** ^Calls to tdsqlite3_db_config() return SQLITE_OK if and only if ** the call is considered successful. */ -SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); +SQLITE_API int tdsqlite3_db_config(tdsqlite3*, int op, ...); /* ** CAPI3REF: Memory Allocation Routines @@ -1596,10 +1596,10 @@ SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); ** ** This object is used in only one place in the SQLite interface. ** A pointer to an instance of this object is the argument to -** [sqlite3_config()] when the configuration option is +** [tdsqlite3_config()] when the configuration option is ** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. ** By creating an instance of this object -** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC]) +** and passing it to [tdsqlite3_config]([SQLITE_CONFIG_MALLOC]) ** during configuration, an application can specify an alternative ** memory allocation subsystem for SQLite to use for all of its ** dynamic memory needs. @@ -1626,20 +1626,20 @@ SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); ** a memory allocation given a particular requested size. Most memory ** allocators round up memory allocations at least to the next multiple ** of 8. Some allocators round up to a larger multiple or to a power of 2. -** Every memory allocation request coming in through [sqlite3_malloc()] -** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, +** Every memory allocation request coming in through [tdsqlite3_malloc()] +** or [tdsqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, ** that causes the corresponding memory allocation to fail. ** ** The xInit method initializes the memory allocator. For example, ** it might allocate any required mutexes or initialize internal data ** structures. The xShutdown method is invoked (indirectly) by -** [sqlite3_shutdown()] and should deallocate any resources acquired +** [tdsqlite3_shutdown()] and should deallocate any resources acquired ** by xInit. The pAppData pointer is used as the only parameter to ** xInit and xShutdown. ** ** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes ** the xInit method, so the xInit method need not be threadsafe. The -** xShutdown method is only called from [sqlite3_shutdown()] so it does +** xShutdown method is only called from [tdsqlite3_shutdown()] so it does ** not need to be threadsafe either. For all other methods, SQLite ** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the ** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which @@ -1651,8 +1651,8 @@ SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); ** SQLite will never invoke xInit() more than once without an intervening ** call to xShutdown(). */ -typedef struct sqlite3_mem_methods sqlite3_mem_methods; -struct sqlite3_mem_methods { +typedef struct tdsqlite3_mem_methods tdsqlite3_mem_methods; +struct tdsqlite3_mem_methods { void *(*xMalloc)(int); /* Memory allocation function */ void (*xFree)(void*); /* Free a prior allocation */ void *(*xRealloc)(void*,int); /* Resize an allocation */ @@ -1668,12 +1668,12 @@ struct sqlite3_mem_methods { ** KEYWORDS: {configuration option} ** ** These constants are the available integer configuration options that -** can be passed as the first argument to the [sqlite3_config()] interface. +** can be passed as the first argument to the [tdsqlite3_config()] interface. ** ** New configuration options may be added in future releases of SQLite. ** Existing configuration options might be discontinued. Applications -** should check the return code from [sqlite3_config()] to make sure that -** the call worked. The [sqlite3_config()] interface will return a +** should check the return code from [tdsqlite3_config()] to make sure that +** the call worked. The [tdsqlite3_config()] interface will return a ** non-zero [error code] if a discontinued or unsupported configuration option ** is invoked. ** @@ -1685,7 +1685,7 @@ struct sqlite3_mem_methods { ** by a single thread. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** it is not possible to change the [threading mode] from its default -** value of Single-thread and so [sqlite3_config()] will return +** value of Single-thread and so [tdsqlite3_config()] will return ** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD ** configuration option. ** @@ -1700,7 +1700,7 @@ struct sqlite3_mem_methods { ** [database connection] at the same time. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** it is not possible to set the Multi-thread [threading mode] and -** [sqlite3_config()] will return [SQLITE_ERROR] if called with the +** [tdsqlite3_config()] will return [SQLITE_ERROR] if called with the ** SQLITE_CONFIG_MULTITHREAD configuration option. ** ** [[SQLITE_CONFIG_SERIALIZED]]
    SQLITE_CONFIG_SERIALIZED
    @@ -1716,22 +1716,22 @@ struct sqlite3_mem_methods { ** ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** it is not possible to set the Serialized [threading mode] and -** [sqlite3_config()] will return [SQLITE_ERROR] if called with the +** [tdsqlite3_config()] will return [SQLITE_ERROR] if called with the ** SQLITE_CONFIG_SERIALIZED configuration option. ** ** [[SQLITE_CONFIG_MALLOC]]
    SQLITE_CONFIG_MALLOC
    **
    ^(The SQLITE_CONFIG_MALLOC option takes a single argument which is -** a pointer to an instance of the [sqlite3_mem_methods] structure. +** a pointer to an instance of the [tdsqlite3_mem_methods] structure. ** The argument specifies ** alternative low-level memory allocation routines to be used in place of ** the memory allocation routines built into SQLite.)^ ^SQLite makes -** its own private copy of the content of the [sqlite3_mem_methods] structure -** before the [sqlite3_config()] call returns.
    +** its own private copy of the content of the [tdsqlite3_mem_methods] structure +** before the [tdsqlite3_config()] call returns. ** ** [[SQLITE_CONFIG_GETMALLOC]]
    SQLITE_CONFIG_GETMALLOC
    **
    ^(The SQLITE_CONFIG_GETMALLOC option takes a single argument which -** is a pointer to an instance of the [sqlite3_mem_methods] structure. -** The [sqlite3_mem_methods] +** is a pointer to an instance of the [tdsqlite3_mem_methods] structure. +** The [tdsqlite3_mem_methods] ** structure is filled with the currently defined memory allocation routines.)^ ** This option can be used to overload the default memory allocation ** routines with a wrapper that simulations memory allocation failure or @@ -1753,11 +1753,11 @@ struct sqlite3_mem_methods { ** memory allocation statistics. ^(When memory allocation statistics are ** disabled, the following SQLite interfaces become non-operational: **
      -**
    • [sqlite3_hard_heap_limit64()] -**
    • [sqlite3_memory_used()] -**
    • [sqlite3_memory_highwater()] -**
    • [sqlite3_soft_heap_limit64()] -**
    • [sqlite3_status64()] +**
    • [tdsqlite3_hard_heap_limit64()] +**
    • [tdsqlite3_memory_used()] +**
    • [tdsqlite3_memory_highwater()] +**
    • [tdsqlite3_soft_heap_limit64()] +**
    • [tdsqlite3_status64()] **
    )^ ** ^Memory allocation statistics are enabled by default unless SQLite is ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory @@ -1787,15 +1787,15 @@ struct sqlite3_mem_methods { ** aligned block of memory of at least sz*N bytes, otherwise ** subsequent behavior is undefined. ** ^When pMem is not NULL, SQLite will strive to use the memory provided -** to satisfy page cache needs, falling back to [sqlite3_malloc()] if +** to satisfy page cache needs, falling back to [tdsqlite3_malloc()] if ** a page cache line is larger than sz bytes or if all of the pMem buffer ** is exhausted. ** ^If pMem is NULL and N is non-zero, then each database connection ** does an initial bulk allocation for page cache memory -** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or +** from [tdsqlite3_malloc()] sufficient for N cache lines if N is positive or ** of -1024*N bytes if N is negative, . ^If additional ** page cache memory is needed beyond what is provided by the initial -** allocation, then SQLite goes to [sqlite3_malloc()] separately for each +** allocation, then SQLite goes to [tdsqlite3_malloc()] separately for each ** additional cache line.
    ** ** [[SQLITE_CONFIG_HEAP]]
    SQLITE_CONFIG_HEAP
    @@ -1820,27 +1820,27 @@ struct sqlite3_mem_methods { ** ** [[SQLITE_CONFIG_MUTEX]]
    SQLITE_CONFIG_MUTEX
    **
    ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a -** pointer to an instance of the [sqlite3_mutex_methods] structure. +** pointer to an instance of the [tdsqlite3_mutex_methods] structure. ** The argument specifies alternative low-level mutex routines to be used ** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of -** the content of the [sqlite3_mutex_methods] structure before the call to -** [sqlite3_config()] returns. ^If SQLite is compiled with +** the content of the [tdsqlite3_mutex_methods] structure before the call to +** [tdsqlite3_config()] returns. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** the entire mutexing subsystem is omitted from the build and hence calls to -** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will +** [tdsqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will ** return [SQLITE_ERROR].
    ** ** [[SQLITE_CONFIG_GETMUTEX]]
    SQLITE_CONFIG_GETMUTEX
    **
    ^(The SQLITE_CONFIG_GETMUTEX option takes a single argument which -** is a pointer to an instance of the [sqlite3_mutex_methods] structure. The -** [sqlite3_mutex_methods] +** is a pointer to an instance of the [tdsqlite3_mutex_methods] structure. The +** [tdsqlite3_mutex_methods] ** structure is filled with the currently defined mutex routines.)^ ** This option can be used to overload the default mutex allocation ** routines with a wrapper used to track mutex usage for performance ** profiling or testing, for example. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** the entire mutexing subsystem is omitted from the build and hence calls to -** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will +** [tdsqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will ** return [SQLITE_ERROR].
    ** ** [[SQLITE_CONFIG_LOOKASIDE]]
    SQLITE_CONFIG_LOOKASIDE
    @@ -1850,18 +1850,18 @@ struct sqlite3_mem_methods { ** size of each lookaside buffer slot and the second is the number of ** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE ** sets the default lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] -** option to [sqlite3_db_config()] can be used to change the lookaside +** option to [tdsqlite3_db_config()] can be used to change the lookaside ** configuration on individual connections.)^ ** ** [[SQLITE_CONFIG_PCACHE2]]
    SQLITE_CONFIG_PCACHE2
    **
    ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is -** a pointer to an [sqlite3_pcache_methods2] object. This object specifies +** a pointer to an [tdsqlite3_pcache_methods2] object. This object specifies ** the interface to a custom page cache implementation.)^ -** ^SQLite makes a copy of the [sqlite3_pcache_methods2] object.
    +** ^SQLite makes a copy of the [tdsqlite3_pcache_methods2] object. ** ** [[SQLITE_CONFIG_GETPCACHE2]]
    SQLITE_CONFIG_GETPCACHE2
    **
    ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which -** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies of +** is a pointer to an [tdsqlite3_pcache_methods2] object. SQLite copies of ** the current page cache implementation into that object.)^
    ** ** [[SQLITE_CONFIG_LOG]]
    SQLITE_CONFIG_LOG
    @@ -1870,15 +1870,15 @@ struct sqlite3_mem_methods { ** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a ** function with a call signature of void(*)(void*,int,const char*), ** and a pointer to void. ^If the function pointer is not NULL, it is -** invoked by [sqlite3_log()] to process each logging event. ^If the -** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op. +** invoked by [tdsqlite3_log()] to process each logging event. ^If the +** function pointer is NULL, the [tdsqlite3_log()] interface becomes a no-op. ** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is ** passed through as the first parameter to the application-defined logger ** function whenever that function is invoked. ^The second parameter to ** the logger function is a copy of the first parameter to the corresponding -** [sqlite3_log()] call and is intended to be a [result code] or an +** [tdsqlite3_log()] call and is intended to be a [result code] or an ** [extended result code]. ^The third parameter passed to the logger is -** log message after formatting via [sqlite3_snprintf()]. +** log message after formatting via [tdsqlite3_snprintf()]. ** The SQLite logging interface is not reentrant; the logger function ** supplied by the application must not invoke any SQLite interface. ** In a multi-threaded application, the application-defined logger @@ -1888,8 +1888,8 @@ struct sqlite3_mem_methods { **
    ^(The SQLITE_CONFIG_URI option takes a single argument of type int. ** If non-zero, then URI handling is globally enabled. If the parameter is zero, ** then URI handling is globally disabled.)^ ^If URI handling is globally -** enabled, all filenames passed to [sqlite3_open()], [sqlite3_open_v2()], -** [sqlite3_open16()] or +** enabled, all filenames passed to [tdsqlite3_open()], [tdsqlite3_open_v2()], +** [tdsqlite3_open16()] or ** specified as part of [ATTACH] commands are interpreted as URIs, regardless ** of whether or not the [SQLITE_OPEN_URI] flag is set when the database ** connection is opened. ^If it is globally disabled, filenames are @@ -1921,7 +1921,7 @@ struct sqlite3_mem_methods { **
    SQLITE_CONFIG_SQLLOG **
    This option is only available if sqlite is compiled with the ** [SQLITE_ENABLE_SQLLOG] pre-processor macro defined. The first argument should -** be a pointer to a function of type void(*)(void*,sqlite3*,const char*, int). +** be a pointer to a function of type void(*)(void*,tdsqlite3*,const char*, int). ** The second should be of type (void*). The callback is invoked by the library ** in three separate circumstances, identified by the value passed as the ** fourth parameter. If the fourth parameter is 0, then the database connection @@ -1936,7 +1936,7 @@ struct sqlite3_mem_methods { ** ** [[SQLITE_CONFIG_MMAP_SIZE]] **
    SQLITE_CONFIG_MMAP_SIZE -**
    ^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values +**
    ^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (tdsqlite3_int64) values ** that are the default mmap size limit (the default setting for ** [PRAGMA mmap_size]) and the maximum allowed mmap size limit. ** ^The default setting can be overridden by each database connection using @@ -2007,10 +2007,10 @@ struct sqlite3_mem_methods { ** [[SQLITE_CONFIG_MEMDB_MAXSIZE]] **
    SQLITE_CONFIG_MEMDB_MAXSIZE **
    The SQLITE_CONFIG_MEMDB_MAXSIZE option accepts a single parameter -** [sqlite3_int64] parameter which is the default maximum size for an in-memory -** database created using [sqlite3_deserialize()]. This default maximum +** [tdsqlite3_int64] parameter which is the default maximum size for an in-memory +** database created using [tdsqlite3_deserialize()]. This default maximum ** size can be adjusted up or down for individual databases using the -** [SQLITE_FCNTL_SIZE_LIMIT] [sqlite3_file_control|file-control]. If this +** [SQLITE_FCNTL_SIZE_LIMIT] [tdsqlite3_file_control|file-control]. If this ** configuration setting is never used, then the default maximum is determined ** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that ** compile-time option is not set, then the default maximum is 1073741824. @@ -2019,43 +2019,43 @@ struct sqlite3_mem_methods { #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ -#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ -#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ +#define SQLITE_CONFIG_MALLOC 4 /* tdsqlite3_mem_methods* */ +#define SQLITE_CONFIG_GETMALLOC 5 /* tdsqlite3_mem_methods* */ #define SQLITE_CONFIG_SCRATCH 6 /* No longer used */ #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ -#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ -#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ +#define SQLITE_CONFIG_MUTEX 10 /* tdsqlite3_mutex_methods* */ +#define SQLITE_CONFIG_GETMUTEX 11 /* tdsqlite3_mutex_methods* */ /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */ #define SQLITE_CONFIG_PCACHE 14 /* no-op */ #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ #define SQLITE_CONFIG_URI 17 /* int */ -#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */ -#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */ +#define SQLITE_CONFIG_PCACHE2 18 /* tdsqlite3_pcache_methods2* */ +#define SQLITE_CONFIG_GETPCACHE2 19 /* tdsqlite3_pcache_methods2* */ #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */ #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */ -#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ +#define SQLITE_CONFIG_MMAP_SIZE 22 /* tdsqlite3_int64, tdsqlite3_int64 */ #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */ -#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */ +#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* tdsqlite3_int64 */ /* ** CAPI3REF: Database Connection Configuration Options ** ** These constants are the available integer configuration options that -** can be passed as the second argument to the [sqlite3_db_config()] interface. +** can be passed as the second argument to the [tdsqlite3_db_config()] interface. ** ** New configuration options may be added in future releases of SQLite. ** Existing configuration options might be discontinued. Applications -** should check the return code from [sqlite3_db_config()] to make sure that -** the call worked. ^The [sqlite3_db_config()] interface will return a +** should check the return code from [tdsqlite3_db_config()] to make sure that +** the call worked. ^The [tdsqlite3_db_config()] interface will return a ** non-zero [error code] if a discontinued or unsupported configuration option ** is invoked. ** @@ -2064,11 +2064,11 @@ struct sqlite3_mem_methods { **
    SQLITE_DBCONFIG_LOOKASIDE
    **
    ^This option takes three additional arguments that determine the ** [lookaside memory allocator] configuration for the [database connection]. -** ^The first argument (the third parameter to [sqlite3_db_config()] is a +** ^The first argument (the third parameter to [tdsqlite3_db_config()] is a ** pointer to a memory buffer to use for lookaside memory. ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb ** may be NULL in which case SQLite will allocate the -** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the +** lookaside buffer itself using [tdsqlite3_malloc()]. ^The second argument is the ** size of each lookaside buffer slot. ^The third argument is the number of ** slots. The size of the buffer in the first argument must be greater than ** or equal to the product of the second and third arguments. The buffer @@ -2078,7 +2078,7 @@ struct sqlite3_mem_methods { ** configuration for a database connection can only be changed when that ** connection is not currently using lookaside memory, or in other words ** when the "current value" returned by -** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero. +** [tdsqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero. ** Any attempt to change the lookaside memory configuration when lookaside ** memory is in use leaves the configuration unchanged and returns ** [SQLITE_BUSY].)^
    @@ -2132,10 +2132,10 @@ struct sqlite3_mem_methods { ** ** [[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION]] **
    SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
    -**
    ^This option is used to enable or disable the [sqlite3_load_extension()] +**
    ^This option is used to enable or disable the [tdsqlite3_load_extension()] ** interface independently of the [load_extension()] SQL function. -** The [sqlite3_enable_load_extension()] API enables or disables both the -** C-API [sqlite3_load_extension()] and the SQL function [load_extension()]. +** The [tdsqlite3_enable_load_extension()] API enables or disables both the +** C-API [tdsqlite3_load_extension()] and the SQL function [load_extension()]. ** There should be two additional arguments. ** When the first argument to this interface is 1, then only the C-API is ** enabled and the SQL function remains disabled. If the first argument to @@ -2143,7 +2143,7 @@ struct sqlite3_mem_methods { ** If the first argument is -1, then no changes are made to state of either the ** C-API or the SQL function. ** The second parameter is a pointer to an integer into which -** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface +** is written 0 or 1 to indicate whether [tdsqlite3_load_extension()] interface ** is disabled or enabled following this call. The second parameter may ** be a NULL pointer, in which case the new setting is not reported back. **
    @@ -2207,13 +2207,13 @@ struct sqlite3_mem_methods { **
      **
    1. If the database connection is newly opened, make sure it has read the ** database schema by preparing then discarding some query against the -** database, or calling sqlite3_table_column_metadata(), ignoring any +** database, or calling tdsqlite3_table_column_metadata(), ignoring any ** errors. This step is only necessary if the application desires to keep ** the database in WAL mode after the reset if it was in WAL mode before ** the reset. -**
    2. sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 1, 0); -**
    3. [sqlite3_exec](db, "[VACUUM]", 0, 0, 0); -**
    4. sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0); +**
    5. tdsqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 1, 0); +**
    6. [tdsqlite3_exec](db, "[VACUUM]", 0, 0, 0); +**
    7. tdsqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0); **
    ** Because resetting a database is destructive and irreversible, the ** process requires the use of this obscure API and multiple steps to help @@ -2338,17 +2338,17 @@ struct sqlite3_mem_methods { /* ** CAPI3REF: Enable Or Disable Extended Result Codes -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The sqlite3_extended_result_codes() routine enables or disables the +** ^The tdsqlite3_extended_result_codes() routine enables or disables the ** [extended result codes] feature of SQLite. ^The extended result ** codes are disabled by default for historical compatibility. */ -SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); +SQLITE_API int tdsqlite3_extended_result_codes(tdsqlite3*, int onoff); /* ** CAPI3REF: Last Insert Rowid -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables) ** has a unique 64-bit signed @@ -2358,16 +2358,16 @@ SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); ** the table has a column of type [INTEGER PRIMARY KEY] then that column ** is another alias for the rowid. ** -** ^The sqlite3_last_insert_rowid(D) interface usually returns the [rowid] of +** ^The tdsqlite3_last_insert_rowid(D) interface usually returns the [rowid] of ** the most recent successful [INSERT] into a rowid table or [virtual table] ** on database connection D. ^Inserts into [WITHOUT ROWID] tables are not ** recorded. ^If no successful [INSERT]s into rowid tables have ever occurred -** on the database connection D, then sqlite3_last_insert_rowid(D) returns +** on the database connection D, then tdsqlite3_last_insert_rowid(D) returns ** zero. ** ** As well as being set automatically as rows are inserted into database ** tables, the value returned by this function may be set explicitly by -** [sqlite3_set_last_insert_rowid()] +** [tdsqlite3_set_last_insert_rowid()] ** ** Some virtual table implementations may INSERT rows into rowid tables as ** part of committing a transaction (e.g. to flush data accumulated in memory @@ -2375,7 +2375,7 @@ SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); ** associated with these internal INSERT operations, which leads to ** unintuitive results. Virtual table implementations that do write to rowid ** tables in this way can avoid this problem by restoring the original -** rowid value using [sqlite3_set_last_insert_rowid()] before returning +** rowid value using [tdsqlite3_set_last_insert_rowid()] before returning ** control to the user. ** ** ^(If an [INSERT] occurs within a trigger then this routine will @@ -2400,27 +2400,27 @@ SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); ** [last_insert_rowid() SQL function]. ** ** If a separate thread performs a new [INSERT] on the same -** database connection while the [sqlite3_last_insert_rowid()] +** database connection while the [tdsqlite3_last_insert_rowid()] ** function is running and thus changes the last insert [rowid], -** then the value returned by [sqlite3_last_insert_rowid()] is +** then the value returned by [tdsqlite3_last_insert_rowid()] is ** unpredictable and might not equal either the old or the new ** last insert [rowid]. */ -SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); +SQLITE_API tdsqlite3_int64 tdsqlite3_last_insert_rowid(tdsqlite3*); /* ** CAPI3REF: Set the Last Insert Rowid value. -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** The sqlite3_set_last_insert_rowid(D, R) method allows the application to -** set the value returned by calling sqlite3_last_insert_rowid(D) to R +** The tdsqlite3_set_last_insert_rowid(D, R) method allows the application to +** set the value returned by calling tdsqlite3_last_insert_rowid(D) to R ** without inserting a row into the database. */ -SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64); +SQLITE_API void tdsqlite3_set_last_insert_rowid(tdsqlite3*,tdsqlite3_int64); /* ** CAPI3REF: Count The Number Of Rows Modified -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^This function returns the number of rows modified, inserted or ** deleted by the most recently completed INSERT, UPDATE or DELETE @@ -2434,24 +2434,24 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64); ** ** Changes to a view that are intercepted by ** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value -** returned by sqlite3_changes() immediately after an INSERT, UPDATE or +** returned by tdsqlite3_changes() immediately after an INSERT, UPDATE or ** DELETE statement run on a view is always zero. Only changes made to real ** tables are counted. ** -** Things are more complicated if the sqlite3_changes() function is +** Things are more complicated if the tdsqlite3_changes() function is ** executed while a trigger program is running. This may happen if the ** program uses the [changes() SQL function], or if some other callback -** function invokes sqlite3_changes() directly. Essentially: +** function invokes tdsqlite3_changes() directly. Essentially: ** **
      **
    • ^(Before entering a trigger program the value returned by -** sqlite3_changes() function is saved. After the trigger program +** tdsqlite3_changes() function is saved. After the trigger program ** has finished, the original value is restored.)^ ** **
    • ^(Within a trigger program each INSERT, UPDATE and DELETE -** statement sets the value returned by sqlite3_changes() +** statement sets the value returned by tdsqlite3_changes() ** upon completion as normal. Of course, this value will not include -** any changes performed by sub-triggers, as the sqlite3_changes() +** any changes performed by sub-triggers, as the tdsqlite3_changes() ** value will be saved and restored after each sub-trigger has run.)^ **
    ** @@ -2463,35 +2463,35 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64); ** previous INSERT, UPDATE or DELETE statement within the same trigger. ** ** If a separate thread makes changes on the same database connection -** while [sqlite3_changes()] is running then the value returned +** while [tdsqlite3_changes()] is running then the value returned ** is unpredictable and not meaningful. ** ** See also: **
      -**
    • the [sqlite3_total_changes()] interface +**
    • the [tdsqlite3_total_changes()] interface **
    • the [count_changes pragma] **
    • the [changes() SQL function] **
    • the [data_version pragma] **
    */ -SQLITE_API int sqlite3_changes(sqlite3*); +SQLITE_API int tdsqlite3_changes(tdsqlite3*); /* ** CAPI3REF: Total Number Of Rows Modified -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^This function returns the total number of rows inserted, modified or ** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed ** since the database connection was opened, including those executed as ** part of trigger programs. ^Executing any other type of SQL statement -** does not affect the value returned by sqlite3_total_changes(). +** does not affect the value returned by tdsqlite3_total_changes(). ** ** ^Changes made as part of [foreign key actions] are included in the ** count, but those made as part of REPLACE constraint resolution are ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers ** are not counted. ** -** The [sqlite3_total_changes(D)] interface only reports the number +** The [tdsqlite3_total_changes(D)] interface only reports the number ** of rows that changed due to SQL statement run against database ** connection D. Any changes by other database connections are ignored. ** To detect changes against a database file from other database @@ -2499,23 +2499,23 @@ SQLITE_API int sqlite3_changes(sqlite3*); ** [SQLITE_FCNTL_DATA_VERSION] [file control]. ** ** If a separate thread makes changes on the same database connection -** while [sqlite3_total_changes()] is running then the value +** while [tdsqlite3_total_changes()] is running then the value ** returned is unpredictable and not meaningful. ** ** See also: **
      -**
    • the [sqlite3_changes()] interface +**
    • the [tdsqlite3_changes()] interface **
    • the [count_changes pragma] **
    • the [changes() SQL function] **
    • the [data_version pragma] **
    • the [SQLITE_FCNTL_DATA_VERSION] [file control] **
    */ -SQLITE_API int sqlite3_total_changes(sqlite3*); +SQLITE_API int tdsqlite3_total_changes(tdsqlite3*); /* ** CAPI3REF: Interrupt A Long-Running Query -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^This function causes any pending database operation to abort and ** return at its earliest opportunity. This routine is typically @@ -2526,10 +2526,10 @@ SQLITE_API int sqlite3_total_changes(sqlite3*); ** ^It is safe to call this routine from a thread different from the ** thread that is currently running the database operation. But it ** is not safe to call this routine with a [database connection] that -** is closed or might close before sqlite3_interrupt() returns. +** is closed or might close before tdsqlite3_interrupt() returns. ** ** ^If an SQL operation is very nearly finished at the time when -** sqlite3_interrupt() is called, then it might not have an opportunity +** tdsqlite3_interrupt() is called, then it might not have an opportunity ** to be interrupted and might continue to completion. ** ** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT]. @@ -2537,18 +2537,18 @@ SQLITE_API int sqlite3_total_changes(sqlite3*); ** that is inside an explicit transaction, then the entire transaction ** will be rolled back automatically. ** -** ^The sqlite3_interrupt(D) call is in effect until all currently running +** ^The tdsqlite3_interrupt(D) call is in effect until all currently running ** SQL statements on [database connection] D complete. ^Any new SQL statements -** that are started after the sqlite3_interrupt() call and before the +** that are started after the tdsqlite3_interrupt() call and before the ** running statement count reaches zero are interrupted as if they had been -** running prior to the sqlite3_interrupt() call. ^New SQL statements +** running prior to the tdsqlite3_interrupt() call. ^New SQL statements ** that are started after the running statement count reaches zero are -** not effected by the sqlite3_interrupt(). -** ^A call to sqlite3_interrupt(D) that occurs when there are no running +** not effected by the tdsqlite3_interrupt(). +** ^A call to tdsqlite3_interrupt(D) that occurs when there are no running ** SQL statements is a no-op and has no effect on SQL statements -** that are started after the sqlite3_interrupt() call returns. +** that are started after the tdsqlite3_interrupt() call returns. */ -SQLITE_API void sqlite3_interrupt(sqlite3*); +SQLITE_API void tdsqlite3_interrupt(tdsqlite3*); /* ** CAPI3REF: Determine If An SQL Statement Is Complete @@ -2571,40 +2571,40 @@ SQLITE_API void sqlite3_interrupt(sqlite3*); ** ^These routines do not parse the SQL statements thus ** will not detect syntactically incorrect SQL. ** -** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior -** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked -** automatically by sqlite3_complete16(). If that initialization fails, -** then the return value from sqlite3_complete16() will be non-zero +** ^(If SQLite has not been initialized using [tdsqlite3_initialize()] prior +** to invoking tdsqlite3_complete16() then tdsqlite3_initialize() is invoked +** automatically by tdsqlite3_complete16(). If that initialization fails, +** then the return value from tdsqlite3_complete16() will be non-zero ** regardless of whether or not the input SQL is complete.)^ ** -** The input to [sqlite3_complete()] must be a zero-terminated +** The input to [tdsqlite3_complete()] must be a zero-terminated ** UTF-8 string. ** -** The input to [sqlite3_complete16()] must be a zero-terminated +** The input to [tdsqlite3_complete16()] must be a zero-terminated ** UTF-16 string in native byte order. */ -SQLITE_API int sqlite3_complete(const char *sql); -SQLITE_API int sqlite3_complete16(const void *sql); +SQLITE_API int tdsqlite3_complete(const char *sql); +SQLITE_API int tdsqlite3_complete16(const void *sql); /* ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors ** KEYWORDS: {busy-handler callback} {busy handler} -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X +** ^The tdsqlite3_busy_handler(D,X,P) routine sets a callback function X ** that might be invoked with argument P whenever ** an attempt is made to access a database table associated with ** [database connection] D when another thread ** or process has the table locked. -** The sqlite3_busy_handler() interface is used to implement -** [sqlite3_busy_timeout()] and [PRAGMA busy_timeout]. +** The tdsqlite3_busy_handler() interface is used to implement +** [tdsqlite3_busy_timeout()] and [PRAGMA busy_timeout]. ** ** ^If the busy callback is NULL, then [SQLITE_BUSY] ** is returned immediately upon encountering the lock. ^If the busy callback ** is not NULL, then the callback might be invoked with two arguments. ** ** ^The first argument to the busy handler is a copy of the void* pointer which -** is the third argument to sqlite3_busy_handler(). ^The second argument to +** is the third argument to tdsqlite3_busy_handler(). ^The second argument to ** the busy handler callback is the number of times that the busy handler has ** been invoked previously for the same locking event. ^If the ** busy callback returns 0, then no additional attempts are made to @@ -2633,7 +2633,7 @@ SQLITE_API int sqlite3_complete16(const void *sql); ** ** ^(There can only be a single busy handler defined for each ** [database connection]. Setting a new busy handler clears any -** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()] +** previously set handler.)^ ^Note that calling [tdsqlite3_busy_timeout()] ** or evaluating [PRAGMA busy_timeout=N] will change the ** busy handler and thus clear any previously set busy handler. ** @@ -2645,17 +2645,17 @@ SQLITE_API int sqlite3_complete16(const void *sql); ** A busy handler must not close the database connection ** or [prepared statement] that invoked the busy handler. */ -SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*); +SQLITE_API int tdsqlite3_busy_handler(tdsqlite3*,int(*)(void*,int),void*); /* ** CAPI3REF: Set A Busy Timeout -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps +** ^This routine sets a [tdsqlite3_busy_handler | busy handler] that sleeps ** for a specified amount of time when a table is locked. ^The handler ** will sleep multiple times until at least "ms" milliseconds of sleeping ** have accumulated. ^After at least "ms" milliseconds of sleeping, -** the handler returns 0 which causes [sqlite3_step()] to return +** the handler returns 0 which causes [tdsqlite3_step()] to return ** [SQLITE_BUSY]. ** ** ^Calling this routine with an argument less than or equal to zero @@ -2663,22 +2663,22 @@ SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*); ** ** ^(There can only be a single busy handler for a particular ** [database connection] at any given moment. If another busy handler -** was defined (using [sqlite3_busy_handler()]) prior to calling +** was defined (using [tdsqlite3_busy_handler()]) prior to calling ** this routine, that other busy handler is cleared.)^ ** ** See also: [PRAGMA busy_timeout] */ -SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); +SQLITE_API int tdsqlite3_busy_timeout(tdsqlite3*, int ms); /* ** CAPI3REF: Convenience Routines For Running Queries -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** This is a legacy interface that is preserved for backwards compatibility. ** Use of this interface is not recommended. ** ** Definition: A result table is memory data structure created by the -** [sqlite3_get_table()] interface. A result table records the +** [tdsqlite3_get_table()] interface. A result table records the ** complete query results from one or more queries. ** ** The table conceptually has a number of rows and columns. But @@ -2691,11 +2691,11 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); ** to zero-terminated strings that contain the names of the columns. ** The remaining entries all point to query results. NULL values result ** in NULL pointers. All other values are in their UTF-8 zero-terminated -** string representation as returned by [sqlite3_column_text()]. +** string representation as returned by [tdsqlite3_column_text()]. ** ** A result table might consist of one or more memory allocations. -** It is not safe to pass a result table directly to [sqlite3_free()]. -** A result table should be deallocated using [sqlite3_free_table()]. +** It is not safe to pass a result table directly to [tdsqlite3_free()]. +** A result table should be deallocated using [tdsqlite3_free_table()]. ** ** ^(As an example of the result table format, suppose a query result ** is as follows: @@ -2723,35 +2723,35 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); ** azResult[7] = "21"; ** )^ ** -** ^The sqlite3_get_table() function evaluates one or more +** ^The tdsqlite3_get_table() function evaluates one or more ** semicolon-separated SQL statements in the zero-terminated UTF-8 ** string of its 2nd parameter and returns a result table to the ** pointer given in its 3rd parameter. ** -** After the application has finished with the result from sqlite3_get_table(), -** it must pass the result table pointer to sqlite3_free_table() in order to +** After the application has finished with the result from tdsqlite3_get_table(), +** it must pass the result table pointer to tdsqlite3_free_table() in order to ** release the memory that was malloced. Because of the way the -** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling -** function must not try to call [sqlite3_free()] directly. Only -** [sqlite3_free_table()] is able to release the memory properly and safely. +** [tdsqlite3_malloc()] happens within tdsqlite3_get_table(), the calling +** function must not try to call [tdsqlite3_free()] directly. Only +** [tdsqlite3_free_table()] is able to release the memory properly and safely. ** -** The sqlite3_get_table() interface is implemented as a wrapper around -** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access +** The tdsqlite3_get_table() interface is implemented as a wrapper around +** [tdsqlite3_exec()]. The tdsqlite3_get_table() routine does not have access ** to any internal data structures of SQLite. It uses only the public ** interface defined here. As a consequence, errors that occur in the -** wrapper layer outside of the internal [sqlite3_exec()] call are not -** reflected in subsequent calls to [sqlite3_errcode()] or -** [sqlite3_errmsg()]. +** wrapper layer outside of the internal [tdsqlite3_exec()] call are not +** reflected in subsequent calls to [tdsqlite3_errcode()] or +** [tdsqlite3_errmsg()]. */ -SQLITE_API int sqlite3_get_table( - sqlite3 *db, /* An open database */ +SQLITE_API int tdsqlite3_get_table( + tdsqlite3 *db, /* An open database */ const char *zSql, /* SQL to be evaluated */ char ***pazResult, /* Results of the query */ int *pnRow, /* Number of result rows written here */ int *pnColumn, /* Number of result columns written here */ char **pzErrmsg /* Error msg written here */ ); -SQLITE_API void sqlite3_free_table(char **result); +SQLITE_API void tdsqlite3_free_table(char **result); /* ** CAPI3REF: Formatted String Printing Functions @@ -2763,40 +2763,40 @@ SQLITE_API void sqlite3_free_table(char **result); ** plus some additional non-standard formats ([%q], [%Q], [%w], and [%z]). ** See the [built-in printf()] documentation for details. ** -** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their -** results into memory obtained from [sqlite3_malloc64()]. +** ^The tdsqlite3_mprintf() and tdsqlite3_vmprintf() routines write their +** results into memory obtained from [tdsqlite3_malloc64()]. ** The strings returned by these two routines should be -** released by [sqlite3_free()]. ^Both routines return a -** NULL pointer if [sqlite3_malloc64()] is unable to allocate enough +** released by [tdsqlite3_free()]. ^Both routines return a +** NULL pointer if [tdsqlite3_malloc64()] is unable to allocate enough ** memory to hold the resulting string. ** -** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from +** ^(The tdsqlite3_snprintf() routine is similar to "snprintf()" from ** the standard C library. The result is written into the ** buffer supplied as the second parameter whose size is given by ** the first parameter. Note that the order of the ** first two parameters is reversed from snprintf().)^ This is an ** historical accident that cannot be fixed without breaking -** backwards compatibility. ^(Note also that sqlite3_snprintf() +** backwards compatibility. ^(Note also that tdsqlite3_snprintf() ** returns a pointer to its buffer instead of the number of ** characters actually written into the buffer.)^ We admit that ** the number of characters written would be a more useful return -** value but we cannot change the implementation of sqlite3_snprintf() +** value but we cannot change the implementation of tdsqlite3_snprintf() ** now without breaking compatibility. ** -** ^As long as the buffer size is greater than zero, sqlite3_snprintf() +** ^As long as the buffer size is greater than zero, tdsqlite3_snprintf() ** guarantees that the buffer is always zero-terminated. ^The first ** parameter "n" is the total size of the buffer, including space for ** the zero terminator. So the longest string that can be completely ** written will be n-1 characters. ** -** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf(). +** ^The tdsqlite3_vsnprintf() routine is a varargs version of tdsqlite3_snprintf(). ** ** See also: [built-in printf()], [printf() SQL function] */ -SQLITE_API char *sqlite3_mprintf(const char*,...); -SQLITE_API char *sqlite3_vmprintf(const char*, va_list); -SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...); -SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list); +SQLITE_API char *tdsqlite3_mprintf(const char*,...); +SQLITE_API char *tdsqlite3_vmprintf(const char*, va_list); +SQLITE_API char *tdsqlite3_snprintf(int,char*,const char*, ...); +SQLITE_API char *tdsqlite3_vsnprintf(int,char*,const char*, va_list); /* ** CAPI3REF: Memory Allocation Subsystem @@ -2806,105 +2806,105 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list); ** does not include operating-system specific [VFS] implementation. The ** Windows VFS uses native malloc() and free() for some operations. ** -** ^The sqlite3_malloc() routine returns a pointer to a block +** ^The tdsqlite3_malloc() routine returns a pointer to a block ** of memory at least N bytes in length, where N is the parameter. -** ^If sqlite3_malloc() is unable to obtain sufficient free +** ^If tdsqlite3_malloc() is unable to obtain sufficient free ** memory, it returns a NULL pointer. ^If the parameter N to -** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns +** tdsqlite3_malloc() is zero or negative then tdsqlite3_malloc() returns ** a NULL pointer. ** -** ^The sqlite3_malloc64(N) routine works just like -** sqlite3_malloc(N) except that N is an unsigned 64-bit integer instead +** ^The tdsqlite3_malloc64(N) routine works just like +** tdsqlite3_malloc(N) except that N is an unsigned 64-bit integer instead ** of a signed 32-bit integer. ** -** ^Calling sqlite3_free() with a pointer previously returned -** by sqlite3_malloc() or sqlite3_realloc() releases that memory so -** that it might be reused. ^The sqlite3_free() routine is +** ^Calling tdsqlite3_free() with a pointer previously returned +** by tdsqlite3_malloc() or tdsqlite3_realloc() releases that memory so +** that it might be reused. ^The tdsqlite3_free() routine is ** a no-op if is called with a NULL pointer. Passing a NULL pointer -** to sqlite3_free() is harmless. After being freed, memory +** to tdsqlite3_free() is harmless. After being freed, memory ** should neither be read nor written. Even reading previously freed ** memory might result in a segmentation fault or other severe error. ** Memory corruption, a segmentation fault, or other severe error -** might result if sqlite3_free() is called with a non-NULL pointer that -** was not obtained from sqlite3_malloc() or sqlite3_realloc(). +** might result if tdsqlite3_free() is called with a non-NULL pointer that +** was not obtained from tdsqlite3_malloc() or tdsqlite3_realloc(). ** -** ^The sqlite3_realloc(X,N) interface attempts to resize a +** ^The tdsqlite3_realloc(X,N) interface attempts to resize a ** prior memory allocation X to be at least N bytes. -** ^If the X parameter to sqlite3_realloc(X,N) +** ^If the X parameter to tdsqlite3_realloc(X,N) ** is a NULL pointer then its behavior is identical to calling -** sqlite3_malloc(N). -** ^If the N parameter to sqlite3_realloc(X,N) is zero or +** tdsqlite3_malloc(N). +** ^If the N parameter to tdsqlite3_realloc(X,N) is zero or ** negative then the behavior is exactly the same as calling -** sqlite3_free(X). -** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation +** tdsqlite3_free(X). +** ^tdsqlite3_realloc(X,N) returns a pointer to a memory allocation ** of at least N bytes in size or NULL if insufficient memory is available. ** ^If M is the size of the prior allocation, then min(N,M) bytes ** of the prior allocation are copied into the beginning of buffer returned -** by sqlite3_realloc(X,N) and the prior allocation is freed. -** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the +** by tdsqlite3_realloc(X,N) and the prior allocation is freed. +** ^If tdsqlite3_realloc(X,N) returns NULL and N is positive, then the ** prior allocation is not freed. ** -** ^The sqlite3_realloc64(X,N) interfaces works the same as -** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead +** ^The tdsqlite3_realloc64(X,N) interfaces works the same as +** tdsqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead ** of a 32-bit signed integer. ** -** ^If X is a memory allocation previously obtained from sqlite3_malloc(), -** sqlite3_malloc64(), sqlite3_realloc(), or sqlite3_realloc64(), then -** sqlite3_msize(X) returns the size of that memory allocation in bytes. -** ^The value returned by sqlite3_msize(X) might be larger than the number +** ^If X is a memory allocation previously obtained from tdsqlite3_malloc(), +** tdsqlite3_malloc64(), tdsqlite3_realloc(), or tdsqlite3_realloc64(), then +** tdsqlite3_msize(X) returns the size of that memory allocation in bytes. +** ^The value returned by tdsqlite3_msize(X) might be larger than the number ** of bytes requested when X was allocated. ^If X is a NULL pointer then -** sqlite3_msize(X) returns zero. If X points to something that is not +** tdsqlite3_msize(X) returns zero. If X points to something that is not ** the beginning of memory allocation, or if it points to a formerly ** valid memory allocation that has now been freed, then the behavior -** of sqlite3_msize(X) is undefined and possibly harmful. +** of tdsqlite3_msize(X) is undefined and possibly harmful. ** -** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(), -** sqlite3_malloc64(), and sqlite3_realloc64() +** ^The memory returned by tdsqlite3_malloc(), tdsqlite3_realloc(), +** tdsqlite3_malloc64(), and tdsqlite3_realloc64() ** is always aligned to at least an 8 byte boundary, or to a ** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time ** option is used. ** -** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()] +** The pointer arguments to [tdsqlite3_free()] and [tdsqlite3_realloc()] ** must be either NULL or else pointers obtained from a prior -** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have +** invocation of [tdsqlite3_malloc()] or [tdsqlite3_realloc()] that have ** not yet been released. ** ** The application must not read or write any part of ** a block of memory after it has been released using -** [sqlite3_free()] or [sqlite3_realloc()]. +** [tdsqlite3_free()] or [tdsqlite3_realloc()]. */ -SQLITE_API void *sqlite3_malloc(int); -SQLITE_API void *sqlite3_malloc64(sqlite3_uint64); -SQLITE_API void *sqlite3_realloc(void*, int); -SQLITE_API void *sqlite3_realloc64(void*, sqlite3_uint64); -SQLITE_API void sqlite3_free(void*); -SQLITE_API sqlite3_uint64 sqlite3_msize(void*); +SQLITE_API void *tdsqlite3_malloc(int); +SQLITE_API void *tdsqlite3_malloc64(tdsqlite3_uint64); +SQLITE_API void *tdsqlite3_realloc(void*, int); +SQLITE_API void *tdsqlite3_realloc64(void*, tdsqlite3_uint64); +SQLITE_API void tdsqlite3_free(void*); +SQLITE_API tdsqlite3_uint64 tdsqlite3_msize(void*); /* ** CAPI3REF: Memory Allocator Statistics ** ** SQLite provides these two interfaces for reporting on the status -** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()] +** of the [tdsqlite3_malloc()], [tdsqlite3_free()], and [tdsqlite3_realloc()] ** routines, which form the built-in memory allocation subsystem. ** -** ^The [sqlite3_memory_used()] routine returns the number of bytes +** ^The [tdsqlite3_memory_used()] routine returns the number of bytes ** of memory currently outstanding (malloced but not freed). -** ^The [sqlite3_memory_highwater()] routine returns the maximum -** value of [sqlite3_memory_used()] since the high-water mark -** was last reset. ^The values returned by [sqlite3_memory_used()] and -** [sqlite3_memory_highwater()] include any overhead -** added by SQLite in its implementation of [sqlite3_malloc()], +** ^The [tdsqlite3_memory_highwater()] routine returns the maximum +** value of [tdsqlite3_memory_used()] since the high-water mark +** was last reset. ^The values returned by [tdsqlite3_memory_used()] and +** [tdsqlite3_memory_highwater()] include any overhead +** added by SQLite in its implementation of [tdsqlite3_malloc()], ** but not overhead added by the any underlying system library -** routines that [sqlite3_malloc()] may call. +** routines that [tdsqlite3_malloc()] may call. ** ** ^The memory high-water mark is reset to the current value of -** [sqlite3_memory_used()] if and only if the parameter to -** [sqlite3_memory_highwater()] is true. ^The value returned -** by [sqlite3_memory_highwater(1)] is the high-water mark +** [tdsqlite3_memory_used()] if and only if the parameter to +** [tdsqlite3_memory_highwater()] is true. ^The value returned +** by [tdsqlite3_memory_highwater(1)] is the high-water mark ** prior to the reset. */ -SQLITE_API sqlite3_int64 sqlite3_memory_used(void); -SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag); +SQLITE_API tdsqlite3_int64 tdsqlite3_memory_used(void); +SQLITE_API tdsqlite3_int64 tdsqlite3_memory_highwater(int resetFlag); /* ** CAPI3REF: Pseudo-Random Number Generator @@ -2921,25 +2921,25 @@ SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag); ** ^If this routine has not been previously called or if the previous ** call had N less than one or a NULL pointer for P, then the PRNG is ** seeded using randomness obtained from the xRandomness method of -** the default [sqlite3_vfs] object. +** the default [tdsqlite3_vfs] object. ** ^If the previous call to this routine had an N of 1 or more and a ** non-NULL P then the pseudo-randomness is generated -** internally and without recourse to the [sqlite3_vfs] xRandomness +** internally and without recourse to the [tdsqlite3_vfs] xRandomness ** method. */ -SQLITE_API void sqlite3_randomness(int N, void *P); +SQLITE_API void tdsqlite3_randomness(int N, void *P); /* ** CAPI3REF: Compile-Time Authorization Callbacks -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** KEYWORDS: {authorizer callback} ** ** ^This routine registers an authorizer callback with a particular ** [database connection], supplied in the first argument. ** ^The authorizer callback is invoked as SQL statements are being compiled -** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], -** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()], -** and [sqlite3_prepare16_v3()]. ^At various +** by [tdsqlite3_prepare()] or its variants [tdsqlite3_prepare_v2()], +** [tdsqlite3_prepare_v3()], [tdsqlite3_prepare16()], [tdsqlite3_prepare16_v2()], +** and [tdsqlite3_prepare16_v3()]. ^At various ** points during the compilation process, as logic is being created ** to perform various actions, the authorizer callback is invoked to ** see if those actions are allowed. ^The authorizer callback should @@ -2948,17 +2948,17 @@ SQLITE_API void sqlite3_randomness(int N, void *P); ** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be ** rejected with an error. ^If the authorizer callback returns ** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY] -** then the [sqlite3_prepare_v2()] or equivalent call that triggered +** then the [tdsqlite3_prepare_v2()] or equivalent call that triggered ** the authorizer will fail with an error message. ** ** When the callback returns [SQLITE_OK], that means the operation ** requested is ok. ^When the callback returns [SQLITE_DENY], the -** [sqlite3_prepare_v2()] or equivalent call that triggered the +** [tdsqlite3_prepare_v2()] or equivalent call that triggered the ** authorizer will fail with an error message explaining that ** access is denied. ** ** ^The first parameter to the authorizer callback is a copy of the third -** parameter to the sqlite3_set_authorizer() interface. ^The second parameter +** parameter to the tdsqlite3_set_authorizer() interface. ^The second parameter ** to the callback is an integer [SQLITE_COPY | action code] that specifies ** the particular action to be authorized. ^The third through sixth parameters ** to the callback are either NULL pointers or zero-terminated strings @@ -2981,7 +2981,7 @@ SQLITE_API void sqlite3_randomness(int N, void *P); ** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the ** [truncate optimization] is disabled and all rows are deleted individually. ** -** An authorizer is used when [sqlite3_prepare | preparing] +** An authorizer is used when [tdsqlite3_prepare | preparing] ** SQL statements from an untrusted source, to ensure that the SQL statements ** do not try to access data they are not allowed to see, or that they do not ** try to execute malicious statements that damage the database. For @@ -2989,37 +2989,37 @@ SQLITE_API void sqlite3_randomness(int N, void *P); ** SQL queries for evaluation by a database. But the application does ** not want the user to be able to make arbitrary changes to the ** database. An authorizer could then be put in place while the -** user-entered SQL is being [sqlite3_prepare | prepared] that +** user-entered SQL is being [tdsqlite3_prepare | prepared] that ** disallows everything except [SELECT] statements. ** ** Applications that need to process SQL from untrusted sources -** might also consider lowering resource limits using [sqlite3_limit()] +** might also consider lowering resource limits using [tdsqlite3_limit()] ** and limiting database size using the [max_page_count] [PRAGMA] ** in addition to using an authorizer. ** ** ^(Only a single authorizer can be in place on a database connection -** at a time. Each call to sqlite3_set_authorizer overrides the +** at a time. Each call to tdsqlite3_set_authorizer overrides the ** previous call.)^ ^Disable the authorizer by installing a NULL callback. ** The authorizer is disabled by default. ** ** The authorizer callback must not do anything that will modify ** the database connection that invoked the authorizer callback. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their +** Note that [tdsqlite3_prepare_v2()] and [tdsqlite3_step()] both modify their ** database connections for the meaning of "modify" in this paragraph. ** -** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the -** statement might be re-prepared during [sqlite3_step()] due to a +** ^When [tdsqlite3_prepare_v2()] is used to prepare a statement, the +** statement might be re-prepared during [tdsqlite3_step()] due to a ** schema change. Hence, the application should ensure that the -** correct authorizer callback remains in place during the [sqlite3_step()]. +** correct authorizer callback remains in place during the [tdsqlite3_step()]. ** ** ^Note that the authorizer callback is invoked only during -** [sqlite3_prepare()] or its variants. Authorization is not -** performed during statement evaluation in [sqlite3_step()], unless -** as stated in the previous paragraph, sqlite3_step() invokes -** sqlite3_prepare_v2() to reprepare a statement after a schema change. +** [tdsqlite3_prepare()] or its variants. Authorization is not +** performed during statement evaluation in [tdsqlite3_step()], unless +** as stated in the previous paragraph, tdsqlite3_step() invokes +** tdsqlite3_prepare_v2() to reprepare a statement after a schema change. */ -SQLITE_API int sqlite3_set_authorizer( - sqlite3*, +SQLITE_API int tdsqlite3_set_authorizer( + tdsqlite3*, int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), void *pUserData ); @@ -3027,14 +3027,14 @@ SQLITE_API int sqlite3_set_authorizer( /* ** CAPI3REF: Authorizer Return Codes ** -** The [sqlite3_set_authorizer | authorizer callback function] must +** The [tdsqlite3_set_authorizer | authorizer callback function] must ** return either [SQLITE_OK] or one of these two constants in order ** to signal SQLite whether or not the action is permitted. See the -** [sqlite3_set_authorizer | authorizer documentation] for additional +** [tdsqlite3_set_authorizer | authorizer documentation] for additional ** information. ** ** Note that SQLITE_IGNORE is also used as a [conflict resolution mode] -** returned from the [sqlite3_vtab_on_conflict()] interface. +** returned from the [tdsqlite3_vtab_on_conflict()] interface. */ #define SQLITE_DENY 1 /* Abort the SQL statement with an error */ #define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */ @@ -3042,7 +3042,7 @@ SQLITE_API int sqlite3_set_authorizer( /* ** CAPI3REF: Authorizer Action Codes ** -** The [sqlite3_set_authorizer()] interface registers a callback function +** The [tdsqlite3_set_authorizer()] interface registers a callback function ** that is invoked to authorize certain SQL statement actions. The ** second parameter to the callback is an integer code that specifies ** what action is being authorized. These are the integer action codes that @@ -3096,26 +3096,26 @@ SQLITE_API int sqlite3_set_authorizer( /* ** CAPI3REF: Tracing And Profiling Functions -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** These routines are deprecated. Use the [sqlite3_trace_v2()] interface +** These routines are deprecated. Use the [tdsqlite3_trace_v2()] interface ** instead of the routines described here. ** ** These routines register callback functions that can be used for ** tracing and profiling the execution of SQL statements. ** -** ^The callback function registered by sqlite3_trace() is invoked at -** various times when an SQL statement is being run by [sqlite3_step()]. -** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the +** ^The callback function registered by tdsqlite3_trace() is invoked at +** various times when an SQL statement is being run by [tdsqlite3_step()]. +** ^The tdsqlite3_trace() callback is invoked with a UTF-8 rendering of the ** SQL statement text as the statement first begins executing. -** ^(Additional sqlite3_trace() callbacks might occur +** ^(Additional tdsqlite3_trace() callbacks might occur ** as each triggered subprogram is entered. The callbacks for triggers ** contain a UTF-8 SQL comment that identifies the trigger.)^ ** ** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit -** the length of [bound parameter] expansion in the output of sqlite3_trace(). +** the length of [bound parameter] expansion in the output of tdsqlite3_trace(). ** -** ^The callback function registered by sqlite3_profile() is invoked +** ^The callback function registered by tdsqlite3_profile() is invoked ** as each SQL statement finishes. ^The profile callback contains ** the original statement text and an estimate of wall-clock time ** of how long that statement took to run. ^The profile callback @@ -3123,21 +3123,21 @@ SQLITE_API int sqlite3_set_authorizer( ** is only capable of millisecond resolution so the six least significant ** digits in the time are meaningless. Future versions of SQLite ** might provide greater resolution on the profiler callback. Invoking -** either [sqlite3_trace()] or [sqlite3_trace_v2()] will cancel the +** either [tdsqlite3_trace()] or [tdsqlite3_trace_v2()] will cancel the ** profile callback. */ -SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*, +SQLITE_API SQLITE_DEPRECATED void *tdsqlite3_trace(tdsqlite3*, void(*xTrace)(void*,const char*), void*); -SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*, - void(*xProfile)(void*,const char*,sqlite3_uint64), void*); +SQLITE_API SQLITE_DEPRECATED void *tdsqlite3_profile(tdsqlite3*, + void(*xProfile)(void*,const char*,tdsqlite3_uint64), void*); /* ** CAPI3REF: SQL Trace Event Codes ** KEYWORDS: SQLITE_TRACE ** ** These constants identify classes of events that can be monitored -** using the [sqlite3_trace_v2()] tracing logic. The M argument -** to [sqlite3_trace_v2(D,M,X,P)] is an OR-ed combination of one or more of +** using the [tdsqlite3_trace_v2()] tracing logic. The M argument +** to [tdsqlite3_trace_v2(D,M,X,P)] is an OR-ed combination of one or more of ** the following constants. ^The first argument to the trace callback ** is one of the following constants. ** @@ -3146,7 +3146,7 @@ SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*, ** ^A trace callback has four arguments: xCallback(T,C,P,X). ** ^The T argument is one of the integer type codes above. ** ^The C argument is a copy of the context pointer passed in as the -** fourth argument to [sqlite3_trace_v2()]. +** fourth argument to [tdsqlite3_trace_v2()]. ** The P and X arguments are pointers whose meanings depend on T. ** **
    @@ -3158,13 +3158,13 @@ SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*, ** [prepared statement]. ^The X argument is a pointer to a string which ** is the unexpanded SQL text of the prepared statement or an SQL comment ** that indicates the invocation of a trigger. ^The callback can compute -** the same text that would have been returned by the legacy [sqlite3_trace()] +** the same text that would have been returned by the legacy [tdsqlite3_trace()] ** interface by using the X argument when X begins with "--" and invoking -** [sqlite3_expanded_sql(P)] otherwise. +** [tdsqlite3_expanded_sql(P)] otherwise. ** ** [[SQLITE_TRACE_PROFILE]]
    SQLITE_TRACE_PROFILE
    **
    ^An SQLITE_TRACE_PROFILE callback provides approximately the same -** information as is provided by the [sqlite3_profile()] callback. +** information as is provided by the [tdsqlite3_profile()] callback. ** ^The P argument is a pointer to the [prepared statement] and the ** X argument points to a 64-bit integer which is the estimated of ** the number of nanosecond that the prepared statement took to run. @@ -3190,17 +3190,17 @@ SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*, /* ** CAPI3REF: SQL Trace Hook -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback +** ^The tdsqlite3_trace_v2(D,M,X,P) interface registers a trace callback ** function X against [database connection] D, using property mask M ** and context pointer P. ^If the X callback is ** NULL or if the M mask is zero, then tracing is disabled. The ** M argument should be the bitwise OR-ed combination of ** zero or more [SQLITE_TRACE] constants. ** -** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides -** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2(). +** ^Each call to either tdsqlite3_trace() or tdsqlite3_trace_v2() overrides +** (cancels) any prior calls to tdsqlite3_trace() or tdsqlite3_trace_v2(). ** ** ^The X callback is invoked whenever any of the events identified by ** mask M occur. ^The integer return value from the callback is currently @@ -3213,12 +3213,12 @@ SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*, ** ^The C argument is a copy of the context pointer. ** The P and X arguments are pointers whose meanings depend on T. ** -** The sqlite3_trace_v2() interface is intended to replace the legacy -** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which +** The tdsqlite3_trace_v2() interface is intended to replace the legacy +** interfaces [tdsqlite3_trace()] and [tdsqlite3_profile()], both of which ** are deprecated. */ -SQLITE_API int sqlite3_trace_v2( - sqlite3*, +SQLITE_API int tdsqlite3_trace_v2( + tdsqlite3*, unsigned uMask, int(*xCallback)(unsigned,void*,void*,void*), void *pCtx @@ -3226,11 +3226,11 @@ SQLITE_API int sqlite3_trace_v2( /* ** CAPI3REF: Query Progress Callbacks -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback +** ^The tdsqlite3_progress_handler(D,N,X,P) interface causes the callback ** function X to be invoked periodically during long running calls to -** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for +** [tdsqlite3_exec()], [tdsqlite3_step()] and [tdsqlite3_get_table()] for ** database connection D. An example use for this ** interface is to keep a GUI updated during a large query. ** @@ -3252,41 +3252,41 @@ SQLITE_API int sqlite3_trace_v2( ** ** The progress handler callback must not do anything that will modify ** the database connection that invoked the progress handler. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their +** Note that [tdsqlite3_prepare_v2()] and [tdsqlite3_step()] both modify their ** database connections for the meaning of "modify" in this paragraph. ** */ -SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); +SQLITE_API void tdsqlite3_progress_handler(tdsqlite3*, int, int(*)(void*), void*); /* ** CAPI3REF: Opening A New Database Connection -** CONSTRUCTOR: sqlite3 +** CONSTRUCTOR: tdsqlite3 ** ** ^These routines open an SQLite database file as specified by the ** filename argument. ^The filename argument is interpreted as UTF-8 for -** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte -** order for sqlite3_open16(). ^(A [database connection] handle is usually +** tdsqlite3_open() and tdsqlite3_open_v2() and as UTF-16 in the native byte +** order for tdsqlite3_open16(). ^(A [database connection] handle is usually ** returned in *ppDb, even if an error occurs. The only exception is that -** if SQLite is unable to allocate memory to hold the [sqlite3] object, -** a NULL will be written into *ppDb instead of a pointer to the [sqlite3] +** if SQLite is unable to allocate memory to hold the [tdsqlite3] object, +** a NULL will be written into *ppDb instead of a pointer to the [tdsqlite3] ** object.)^ ^(If the database is opened (and/or created) successfully, then ** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The -** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain +** [tdsqlite3_errmsg()] or [tdsqlite3_errmsg16()] routines can be used to obtain ** an English language description of the error following a failure of any -** of the sqlite3_open() routines. +** of the tdsqlite3_open() routines. ** ** ^The default encoding will be UTF-8 for databases created using -** sqlite3_open() or sqlite3_open_v2(). ^The default encoding for databases -** created using sqlite3_open16() will be UTF-16 in the native byte order. +** tdsqlite3_open() or tdsqlite3_open_v2(). ^The default encoding for databases +** created using tdsqlite3_open16() will be UTF-16 in the native byte order. ** ** Whether or not an error occurs when it is opened, resources ** associated with the [database connection] handle should be released by -** passing it to [sqlite3_close()] when it is no longer required. +** passing it to [tdsqlite3_close()] when it is no longer required. ** -** The sqlite3_open_v2() interface works like sqlite3_open() +** The tdsqlite3_open_v2() interface works like tdsqlite3_open() ** except that it accepts two additional parameters for additional control ** over the new database connection. ^(The flags parameter to -** sqlite3_open_v2() must include, at a minimum, one of the following +** tdsqlite3_open_v2() must include, at a minimum, one of the following ** three flag combinations:)^ ** **
    @@ -3302,7 +3302,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** ^(
    [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]
    **
    The database is opened for reading and writing, and is created if ** it does not already exist. This is the behavior that is always used for -** sqlite3_open() and sqlite3_open16().
    )^ +** tdsqlite3_open() and tdsqlite3_open16().
    )^ **
    ** ** In addition to the required flags, the following optional flags are @@ -3334,26 +3334,26 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** ^(
    [SQLITE_OPEN_SHAREDCACHE]
    **
    The database is opened [shared cache] enabled, overriding ** the default shared cache setting provided by -** [sqlite3_enable_shared_cache()].)^ +** [tdsqlite3_enable_shared_cache()].)^ ** ** ^(
    [SQLITE_OPEN_PRIVATECACHE]
    **
    The database is opened [shared cache] disabled, overriding ** the default shared cache setting provided by -** [sqlite3_enable_shared_cache()].)^ +** [tdsqlite3_enable_shared_cache()].)^ ** ** [[OPEN_NOFOLLOW]] ^(
    [SQLITE_OPEN_NOFOLLOW]
    **
    The database filename is not allowed to be a symbolic link
    ** )^ ** -** If the 3rd parameter to sqlite3_open_v2() is not one of the +** If the 3rd parameter to tdsqlite3_open_v2() is not one of the ** required combinations shown above optionally combined with other ** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits] ** then the behavior is undefined. ** -** ^The fourth parameter to sqlite3_open_v2() is the name of the -** [sqlite3_vfs] object that defines the operating system interface that +** ^The fourth parameter to tdsqlite3_open_v2() is the name of the +** [tdsqlite3_vfs] object that defines the operating system interface that ** the new database connection should use. ^If the fourth parameter is -** a NULL pointer then the default [sqlite3_vfs] object is used. +** a NULL pointer then the default [tdsqlite3_vfs] object is used. ** ** ^If the filename is ":memory:", then a private, temporary in-memory database ** is created for the connection. ^This in-memory database will vanish when @@ -3367,14 +3367,14 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** on-disk database will be created. ^This private database will be ** automatically deleted as soon as the database connection is closed. ** -** [[URI filenames in sqlite3_open()]]

    URI Filenames

    +** [[URI filenames in tdsqlite3_open()]]

    URI Filenames

    ** ** ^If [URI filename] interpretation is enabled, and the filename argument ** begins with "file:", then the filename is interpreted as a URI. ^URI ** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is -** set in the third argument to sqlite3_open_v2(), or if it has +** set in the third argument to tdsqlite3_open_v2(), or if it has ** been enabled globally using the [SQLITE_CONFIG_URI] option with the -** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option. +** [tdsqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option. ** URI filename interpretation is turned off ** by default, but future releases of SQLite might enable URI filename ** interpretation by default. See "[URI filenames]" for additional @@ -3405,16 +3405,16 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** a VFS object that provides the operating system interface that should ** be used to access the database file on disk. ^If this option is set to ** an empty string the default VFS object is used. ^Specifying an unknown -** VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is +** VFS is an error. ^If tdsqlite3_open_v2() is used and the vfs option is ** present, then the VFS specified by the option takes precedence over -** the value passed as the fourth parameter to sqlite3_open_v2(). +** the value passed as the fourth parameter to tdsqlite3_open_v2(). ** **
  • mode: ^(The mode parameter may be set to either "ro", "rw", ** "rwc", or "memory". Attempting to set it to any other value is ** an error)^. ** ^If "ro" is specified, then the database is opened for read-only ** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the -** third argument to sqlite3_open_v2(). ^If the mode option is set to +** third argument to tdsqlite3_open_v2(). ^If the mode option is set to ** "rw", then the database is opened for read-write (but not create) ** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had ** been set. ^Value "rwc" is equivalent to setting both @@ -3422,14 +3422,14 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** set to "memory" then a pure [in-memory database] that never reads ** or writes from disk is used. ^It is an error to specify a value for ** the mode parameter that is less restrictive than that specified by -** the flags passed in the third parameter to sqlite3_open_v2(). +** the flags passed in the third parameter to tdsqlite3_open_v2(). ** **
  • cache: ^The cache parameter may be set to either "shared" or ** "private". ^Setting it to "shared" is equivalent to setting the ** SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to -** sqlite3_open_v2(). ^Setting the cache parameter to "private" is +** tdsqlite3_open_v2(). ^Setting the cache parameter to "private" is ** equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit. -** ^If sqlite3_open_v2() is used and the "cache" parameter is present in +** ^If tdsqlite3_open_v2() is used and the "cache" parameter is present in ** a URI filename, its value overrides any behavior requested by setting ** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag. ** @@ -3500,28 +3500,28 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** the results are undefined. ** ** Note to Windows users: The encoding used for the filename argument -** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever +** of tdsqlite3_open() and tdsqlite3_open_v2() must be UTF-8, not whatever ** codepage is currently defined. Filenames containing international ** characters must be converted to UTF-8 prior to passing them into -** sqlite3_open() or sqlite3_open_v2(). +** tdsqlite3_open() or tdsqlite3_open_v2(). ** ** Note to Windows Runtime users: The temporary directory must be set -** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various +** prior to calling tdsqlite3_open() or tdsqlite3_open_v2(). Otherwise, various ** features that require the use of temporary files may fail. ** -** See also: [sqlite3_temp_directory] +** See also: [tdsqlite3_temp_directory] */ -SQLITE_API int sqlite3_open( +SQLITE_API int tdsqlite3_open( const char *filename, /* Database filename (UTF-8) */ - sqlite3 **ppDb /* OUT: SQLite db handle */ + tdsqlite3 **ppDb /* OUT: SQLite db handle */ ); -SQLITE_API int sqlite3_open16( +SQLITE_API int tdsqlite3_open16( const void *filename, /* Database filename (UTF-16) */ - sqlite3 **ppDb /* OUT: SQLite db handle */ + tdsqlite3 **ppDb /* OUT: SQLite db handle */ ); -SQLITE_API int sqlite3_open_v2( +SQLITE_API int tdsqlite3_open_v2( const char *filename, /* Database filename (UTF-8) */ - sqlite3 **ppDb, /* OUT: SQLite db handle */ + tdsqlite3 **ppDb, /* OUT: SQLite db handle */ int flags, /* Flags */ const char *zVfs /* Name of VFS module to use */ ); @@ -3534,39 +3534,39 @@ SQLITE_API int sqlite3_open_v2( ** parameter, and if so obtains the value of that query parameter. ** ** If F is the database filename pointer passed into the xOpen() method of -** a VFS implementation or it is the return value of [sqlite3_db_filename()] +** a VFS implementation or it is the return value of [tdsqlite3_db_filename()] ** and if P is the name of the query parameter, then -** sqlite3_uri_parameter(F,P) returns the value of the P +** tdsqlite3_uri_parameter(F,P) returns the value of the P ** parameter if it exists or a NULL pointer if P does not appear as a ** query parameter on F. If P is a query parameter of F and it -** has no explicit value, then sqlite3_uri_parameter(F,P) returns +** has no explicit value, then tdsqlite3_uri_parameter(F,P) returns ** a pointer to an empty string. ** -** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean +** The tdsqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean ** parameter and returns true (1) or false (0) according to the value -** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the +** of P. The tdsqlite3_uri_boolean(F,P,B) routine returns true (1) if the ** value of query parameter P is one of "yes", "true", or "on" in any ** case or if the value begins with a non-zero number. The -** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of +** tdsqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of ** query parameter P is one of "no", "false", or "off" in any case or ** if the value begins with a numeric zero. If P is not a query ** parameter on F or if the value of P does not match any of the -** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0). +** above, then tdsqlite3_uri_boolean(F,P,B) returns (B!=0). ** -** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a +** The tdsqlite3_uri_int64(F,P,D) routine converts the value of P into a ** 64-bit signed integer and returns that integer, or D if P does not ** exist. If the value of P is something other than an integer, then ** zero is returned. ** -** The sqlite3_uri_key(F,N) returns a pointer to the name (not +** The tdsqlite3_uri_key(F,N) returns a pointer to the name (not ** the value) of the N-th query parameter for filename F, or a NULL ** pointer if N is less than zero or greater than the number of query ** parameters minus 1. The N value is zero-based so N should be 0 to obtain ** the name of the first query parameter, 1 for the second parameter, and ** so forth. ** -** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and -** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and +** If F is a NULL pointer, then tdsqlite3_uri_parameter(F,P) returns NULL and +** tdsqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and ** is not a database file pathname pointer that the SQLite core passed ** into the xOpen VFS method, then the behavior of this routine is undefined ** and probably undesirable. @@ -3581,10 +3581,10 @@ SQLITE_API int sqlite3_open_v2( ** ** See the [URI filename] documentation for additional information. */ -SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam); -SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault); -SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64); -SQLITE_API const char *sqlite3_uri_key(const char *zFilename, int N); +SQLITE_API const char *tdsqlite3_uri_parameter(const char *zFilename, const char *zParam); +SQLITE_API int tdsqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault); +SQLITE_API tdsqlite3_int64 tdsqlite3_uri_int64(const char*, const char*, tdsqlite3_int64); +SQLITE_API const char *tdsqlite3_uri_key(const char *zFilename, int N); /* ** CAPI3REF: Translate filenames @@ -3594,64 +3594,64 @@ SQLITE_API const char *sqlite3_uri_key(const char *zFilename, int N); ** and the WAL file. ** ** If F is the name of an sqlite database file, journal file, or WAL file -** passed by the SQLite core into the VFS, then sqlite3_filename_database(F) +** passed by the SQLite core into the VFS, then tdsqlite3_filename_database(F) ** returns the name of the corresponding database file. ** ** If F is the name of an sqlite database file, journal file, or WAL file ** passed by the SQLite core into the VFS, or if F is a database filename -** obtained from [sqlite3_db_filename()], then sqlite3_filename_journal(F) +** obtained from [tdsqlite3_db_filename()], then tdsqlite3_filename_journal(F) ** returns the name of the corresponding rollback journal file. ** ** If F is the name of an sqlite database file, journal file, or WAL file ** that was passed by the SQLite core into the VFS, or if F is a database -** filename obtained from [sqlite3_db_filename()], then -** sqlite3_filename_wal(F) returns the name of the corresponding +** filename obtained from [tdsqlite3_db_filename()], then +** tdsqlite3_filename_wal(F) returns the name of the corresponding ** WAL file. ** ** In all of the above, if F is not the name of a database, journal or WAL ** filename passed into the VFS from the SQLite core and F is not the -** return value from [sqlite3_db_filename()], then the result is +** return value from [tdsqlite3_db_filename()], then the result is ** undefined and is likely a memory access violation. */ -SQLITE_API const char *sqlite3_filename_database(const char*); -SQLITE_API const char *sqlite3_filename_journal(const char*); -SQLITE_API const char *sqlite3_filename_wal(const char*); +SQLITE_API const char *tdsqlite3_filename_database(const char*); +SQLITE_API const char *tdsqlite3_filename_journal(const char*); +SQLITE_API const char *tdsqlite3_filename_wal(const char*); /* ** CAPI3REF: Error Codes And Messages -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^If the most recent sqlite3_* API call associated with -** [database connection] D failed, then the sqlite3_errcode(D) interface +** ^If the most recent tdsqlite3_* API call associated with +** [database connection] D failed, then the tdsqlite3_errcode(D) interface ** returns the numeric [result code] or [extended result code] for that ** API call. -** ^The sqlite3_extended_errcode() +** ^The tdsqlite3_extended_errcode() ** interface is the same except that it always returns the ** [extended result code] even when extended result codes are ** disabled. ** -** The values returned by sqlite3_errcode() and/or -** sqlite3_extended_errcode() might change with each API call. +** The values returned by tdsqlite3_errcode() and/or +** tdsqlite3_extended_errcode() might change with each API call. ** Except, there are some interfaces that are guaranteed to never ** change the value of the error code. The error-code preserving ** interfaces are: ** **
      -**
    • sqlite3_errcode() -**
    • sqlite3_extended_errcode() -**
    • sqlite3_errmsg() -**
    • sqlite3_errmsg16() +**
    • tdsqlite3_errcode() +**
    • tdsqlite3_extended_errcode() +**
    • tdsqlite3_errmsg() +**
    • tdsqlite3_errmsg16() **
    ** -** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language +** ^The tdsqlite3_errmsg() and tdsqlite3_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 sqlite3_errstr() interface returns the English-language text +** ^The tdsqlite3_errstr() interface returns the English-language text ** that describes the [result code], as UTF-8. ** ^(Memory to hold the error message string is managed internally ** and must not be freed by the application)^. @@ -3662,19 +3662,19 @@ SQLITE_API const char *sqlite3_filename_wal(const char*); ** 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 [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning -** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after +** by invoking [tdsqlite3_mutex_enter]([tdsqlite3_db_mutex](D)) before beginning +** to use D and invoking [tdsqlite3_mutex_leave]([tdsqlite3_db_mutex](D)) after ** all calls to the interfaces listed here are completed. ** ** If an interface fails with SQLITE_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. */ -SQLITE_API int sqlite3_errcode(sqlite3 *db); -SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); -SQLITE_API const char *sqlite3_errmsg(sqlite3*); -SQLITE_API const void *sqlite3_errmsg16(sqlite3*); -SQLITE_API const char *sqlite3_errstr(int); +SQLITE_API int tdsqlite3_errcode(tdsqlite3 *db); +SQLITE_API int tdsqlite3_extended_errcode(tdsqlite3 *db); +SQLITE_API const char *tdsqlite3_errmsg(tdsqlite3*); +SQLITE_API const void *tdsqlite3_errmsg16(tdsqlite3*); +SQLITE_API const char *tdsqlite3_errstr(int); /* ** CAPI3REF: Prepared Statement Object @@ -3691,20 +3691,20 @@ SQLITE_API const char *sqlite3_errstr(int); ** The life-cycle of a prepared statement object usually goes like this: ** **
      -**
    1. Create the prepared statement object using [sqlite3_prepare_v2()]. -**
    2. Bind values to [parameters] using the sqlite3_bind_*() +**
    3. Create the prepared statement object using [tdsqlite3_prepare_v2()]. +**
    4. Bind values to [parameters] using the tdsqlite3_bind_*() ** interfaces. -**
    5. Run the SQL by calling [sqlite3_step()] one or more times. -**
    6. Reset the prepared statement using [sqlite3_reset()] then go back +**
    7. Run the SQL by calling [tdsqlite3_step()] one or more times. +**
    8. Reset the prepared statement using [tdsqlite3_reset()] then go back ** to step 2. Do this zero or more times. -**
    9. Destroy the object using [sqlite3_finalize()]. +**
    10. Destroy the object using [tdsqlite3_finalize()]. **
    */ -typedef struct sqlite3_stmt sqlite3_stmt; +typedef struct tdsqlite3_stmt tdsqlite3_stmt; /* ** CAPI3REF: Run-time Limits -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^(This interface allows the size of various constructs to be limited ** on a connection by connection basis. The first parameter is the @@ -3723,7 +3723,7 @@ typedef struct sqlite3_stmt sqlite3_stmt; ** silently truncated to the hard upper bound. ** ** ^Regardless of whether or not the limit was changed, the -** [sqlite3_limit()] interface returns the prior value of the limit. +** [tdsqlite3_limit()] interface returns the prior value of the limit. ** ^Hence, to find the current value of a limit without changing it, ** simply invoke this interface with the third parameter set to -1. ** @@ -3735,21 +3735,21 @@ typedef struct sqlite3_stmt sqlite3_stmt; ** off the Internet. The internal databases can be given the ** large, default limits. Databases managed by external sources can ** be given much smaller limits designed to prevent a denial of service -** attack. Developers might also want to use the [sqlite3_set_authorizer()] +** attack. Developers might also want to use the [tdsqlite3_set_authorizer()] ** interface to further control untrusted SQL. The size of the database ** created by an untrusted script can be contained using the ** [max_page_count] [PRAGMA]. ** ** New run-time limit categories may be added in future releases. */ -SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); +SQLITE_API int tdsqlite3_limit(tdsqlite3*, int id, int newVal); /* ** CAPI3REF: Run-Time Limit Categories ** KEYWORDS: {limit category} {*limit categories} ** ** These constants define various performance limits -** that can be lowered at run-time using [sqlite3_limit()]. +** that can be lowered at run-time using [tdsqlite3_limit()]. ** The synopsis of the meanings of the various limits is shown below. ** Additional information is available at [limits | Limits in SQLite]. ** @@ -3773,7 +3773,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); ** ** [[SQLITE_LIMIT_VDBE_OP]] ^(
    SQLITE_LIMIT_VDBE_OP
    **
    The maximum number of instructions in a virtual machine program -** used to implement an SQL statement. If [sqlite3_prepare_v2()] or +** used to implement an SQL statement. If [tdsqlite3_prepare_v2()] or ** the equivalent tries to allocate space for more than this many opcodes ** in a single prepared statement, an SQLITE_NOMEM error is returned.
    )^ ** @@ -3817,8 +3817,8 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); ** CAPI3REF: Prepare Flags ** ** These constants define various flags that can be passed into -** "prepFlags" parameter of the [sqlite3_prepare_v3()] and -** [sqlite3_prepare16_v3()] interfaces. +** "prepFlags" parameter of the [tdsqlite3_prepare_v3()] and +** [tdsqlite3_prepare16_v3()] interfaces. ** ** New flags may be added in future releases of SQLite. ** @@ -3826,10 +3826,10 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); ** [[SQLITE_PREPARE_PERSISTENT]] ^(
    SQLITE_PREPARE_PERSISTENT
    **
    The SQLITE_PREPARE_PERSISTENT flag is a hint to the query planner ** that the prepared statement will be retained for a long time and -** probably reused many times.)^ ^Without this flag, [sqlite3_prepare_v3()] -** and [sqlite3_prepare16_v3()] assume that the prepared statement will +** probably reused many times.)^ ^Without this flag, [tdsqlite3_prepare_v3()] +** and [tdsqlite3_prepare16_v3()] assume that the prepared statement will ** be used just once or at most a few times and then destroyed using -** [sqlite3_finalize()] relatively soon. The current implementation acts +** [tdsqlite3_finalize()] relatively soon. The current implementation acts ** on this hint by avoiding the use of [lookaside memory] so as not to ** deplete the limited store of lookaside memory. Future versions of ** SQLite may act on this hint differently. @@ -3837,8 +3837,8 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); ** [[SQLITE_PREPARE_NORMALIZE]]
    SQLITE_PREPARE_NORMALIZE
    **
    The SQLITE_PREPARE_NORMALIZE flag is a no-op. This flag used ** to be required for any prepared statement that wanted to use the -** [sqlite3_normalized_sql()] interface. However, the -** [sqlite3_normalized_sql()] interface is now available to all +** [tdsqlite3_normalized_sql()] interface. However, the +** [tdsqlite3_normalized_sql()] interface is now available to all ** prepared statements, regardless of whether or not they use this ** flag. ** @@ -3855,16 +3855,16 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); /* ** CAPI3REF: Compiling An SQL Statement ** KEYWORDS: {SQL statement compiler} -** METHOD: sqlite3 -** CONSTRUCTOR: sqlite3_stmt +** METHOD: tdsqlite3 +** CONSTRUCTOR: tdsqlite3_stmt ** ** To execute an SQL statement, it must first be compiled into a byte-code ** program using one of these routines. Or, in other words, these routines ** are constructors for the [prepared statement] object. ** -** The preferred routine to use is [sqlite3_prepare_v2()]. The -** [sqlite3_prepare()] interface is legacy and should be avoided. -** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used +** The preferred routine to use is [tdsqlite3_prepare_v2()]. The +** [tdsqlite3_prepare()] interface is legacy and should be avoided. +** [tdsqlite3_prepare_v3()] has an extra "prepFlags" option that is used ** for special purposes. ** ** The use of the UTF-8 interfaces is preferred, as SQLite currently @@ -3873,14 +3873,14 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); ** input text into UTF-8, then invoking the corresponding UTF-8 interface. ** ** The first argument, "db", is a [database connection] obtained from a -** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or -** [sqlite3_open16()]. The database connection must not have been closed. +** prior successful call to [tdsqlite3_open()], [tdsqlite3_open_v2()] or +** [tdsqlite3_open16()]. The database connection must not have been closed. ** ** The second argument, "zSql", is the statement to be compiled, encoded -** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(), -** and sqlite3_prepare_v3() -** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(), -** and sqlite3_prepare16_v3() use UTF-16. +** as either UTF-8 or UTF-16. The tdsqlite3_prepare(), tdsqlite3_prepare_v2(), +** and tdsqlite3_prepare_v3() +** interfaces use UTF-8, and tdsqlite3_prepare16(), tdsqlite3_prepare16_v2(), +** and tdsqlite3_prepare16_v3() use UTF-16. ** ** ^If the nByte argument is negative, then zSql is read up to the ** first zero terminator. ^If nByte is positive, then it is the @@ -3897,38 +3897,38 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); ** what remains uncompiled. ** ** ^*ppStmt is left pointing to a compiled [prepared statement] that can be -** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set +** executed using [tdsqlite3_step()]. ^If there is an error, *ppStmt is set ** to NULL. ^If the input text contains no SQL (if the input is an empty ** string or a comment) then *ppStmt is set to NULL. ** The calling procedure is responsible for deleting the compiled -** SQL statement using [sqlite3_finalize()] after it has finished with it. +** SQL statement using [tdsqlite3_finalize()] after it has finished with it. ** ppStmt may not be NULL. ** -** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; +** ^On success, the tdsqlite3_prepare() family of routines return [SQLITE_OK]; ** otherwise an [error code] is returned. ** -** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(), -** and sqlite3_prepare16_v3() interfaces are recommended for all new programs. -** The older interfaces (sqlite3_prepare() and sqlite3_prepare16()) +** The tdsqlite3_prepare_v2(), tdsqlite3_prepare_v3(), tdsqlite3_prepare16_v2(), +** and tdsqlite3_prepare16_v3() interfaces are recommended for all new programs. +** The older interfaces (tdsqlite3_prepare() and tdsqlite3_prepare16()) ** are retained for backwards compatibility, but their use is discouraged. ** ^In the "vX" interfaces, the prepared statement -** that is returned (the [sqlite3_stmt] object) contains a copy of the -** original SQL text. This causes the [sqlite3_step()] interface to +** that is returned (the [tdsqlite3_stmt] object) contains a copy of the +** original SQL text. This causes the [tdsqlite3_step()] interface to ** behave differently in three ways: ** **
      **
    1. ** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it -** always used to do, [sqlite3_step()] will automatically recompile the SQL +** always used to do, [tdsqlite3_step()] will automatically recompile the SQL ** statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY] -** retries will occur before sqlite3_step() gives up and returns an error. +** retries will occur before tdsqlite3_step() gives up and returns an error. **
    2. ** **
    3. -** ^When an error occurs, [sqlite3_step()] will return one of the detailed +** ^When an error occurs, [tdsqlite3_step()] will return one of the detailed ** [error codes] or [extended error codes]. ^The legacy behavior was that -** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code -** and the application would have to make a second call to [sqlite3_reset()] +** [tdsqlite3_step()] would only return a generic [SQLITE_ERROR] result code +** and the application would have to make a second call to [tdsqlite3_reset()] ** in order to find the underlying cause of the problem. With the "v2" prepare ** interfaces, the underlying reason for the error is returned immediately. **
    4. @@ -3937,8 +3937,8 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); ** ^If the specific value bound to a [parameter | host parameter] in the ** WHERE clause might influence the choice of query plan for a statement, ** then the statement will be automatically recompiled, as if there had been -** a schema change, on the first [sqlite3_step()] call following any change -** to the [sqlite3_bind_text | bindings] of that [parameter]. +** a schema change, on the first [tdsqlite3_step()] call following any change +** to the [tdsqlite3_bind_text | bindings] of that [parameter]. ** ^The specific value of a WHERE-clause [parameter] might influence the ** choice of query plan if the parameter is the left-hand side of a [LIKE] ** or [GLOB] operator or if the parameter is compared to an indexed column @@ -3946,69 +3946,69 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); ** **
    ** -**

    ^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having +**

    ^tdsqlite3_prepare_v3() differs from tdsqlite3_prepare_v2() only in having ** the extra prepFlags parameter, which is a bit array consisting of zero or ** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The -** sqlite3_prepare_v2() interface works exactly the same as -** sqlite3_prepare_v3() with a zero prepFlags parameter. +** tdsqlite3_prepare_v2() interface works exactly the same as +** tdsqlite3_prepare_v3() with a zero prepFlags parameter. */ -SQLITE_API int sqlite3_prepare( - sqlite3 *db, /* Database handle */ +SQLITE_API int tdsqlite3_prepare( + tdsqlite3 *db, /* Database handle */ const char *zSql, /* SQL statement, UTF-8 encoded */ int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + tdsqlite3_stmt **ppStmt, /* OUT: Statement handle */ const char **pzTail /* OUT: Pointer to unused portion of zSql */ ); -SQLITE_API int sqlite3_prepare_v2( - sqlite3 *db, /* Database handle */ +SQLITE_API int tdsqlite3_prepare_v2( + tdsqlite3 *db, /* Database handle */ const char *zSql, /* SQL statement, UTF-8 encoded */ int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + tdsqlite3_stmt **ppStmt, /* OUT: Statement handle */ const char **pzTail /* OUT: Pointer to unused portion of zSql */ ); -SQLITE_API int sqlite3_prepare_v3( - sqlite3 *db, /* Database handle */ +SQLITE_API int tdsqlite3_prepare_v3( + tdsqlite3 *db, /* Database handle */ const char *zSql, /* SQL statement, UTF-8 encoded */ int nByte, /* Maximum length of zSql in bytes. */ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + tdsqlite3_stmt **ppStmt, /* OUT: Statement handle */ const char **pzTail /* OUT: Pointer to unused portion of zSql */ ); -SQLITE_API int sqlite3_prepare16( - sqlite3 *db, /* Database handle */ +SQLITE_API int tdsqlite3_prepare16( + tdsqlite3 *db, /* Database handle */ const void *zSql, /* SQL statement, UTF-16 encoded */ int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + tdsqlite3_stmt **ppStmt, /* OUT: Statement handle */ const void **pzTail /* OUT: Pointer to unused portion of zSql */ ); -SQLITE_API int sqlite3_prepare16_v2( - sqlite3 *db, /* Database handle */ +SQLITE_API int tdsqlite3_prepare16_v2( + tdsqlite3 *db, /* Database handle */ const void *zSql, /* SQL statement, UTF-16 encoded */ int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + tdsqlite3_stmt **ppStmt, /* OUT: Statement handle */ const void **pzTail /* OUT: Pointer to unused portion of zSql */ ); -SQLITE_API int sqlite3_prepare16_v3( - sqlite3 *db, /* Database handle */ +SQLITE_API int tdsqlite3_prepare16_v3( + tdsqlite3 *db, /* Database handle */ const void *zSql, /* SQL statement, UTF-16 encoded */ int nByte, /* Maximum length of zSql in bytes. */ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + tdsqlite3_stmt **ppStmt, /* OUT: Statement handle */ const void **pzTail /* OUT: Pointer to unused portion of zSql */ ); /* ** CAPI3REF: Retrieving Statement SQL -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** -** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 +** ^The tdsqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 ** SQL text used to create [prepared statement] P if P was -** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], -** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. -** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 +** created by [tdsqlite3_prepare_v2()], [tdsqlite3_prepare_v3()], +** [tdsqlite3_prepare16_v2()], or [tdsqlite3_prepare16_v3()]. +** ^The tdsqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 ** string containing the SQL text of prepared statement P with ** [bound parameters] expanded. -** ^The sqlite3_normalized_sql(P) interface returns a pointer to a UTF-8 +** ^The tdsqlite3_normalized_sql(P) interface returns a pointer to a UTF-8 ** string containing the normalized SQL text of prepared statement P. The ** semantics used to normalize a SQL statement are unspecified and subject ** to change. At a minimum, literal values will be replaced with suitable @@ -4016,41 +4016,41 @@ SQLITE_API int sqlite3_prepare16_v3( ** ** ^(For example, if a prepared statement is created using the SQL ** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 -** and parameter :xyz is unbound, then sqlite3_sql() will return -** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql() +** and parameter :xyz is unbound, then tdsqlite3_sql() will return +** the original string, "SELECT $abc,:xyz" but tdsqlite3_expanded_sql() ** will return "SELECT 2345,NULL".)^ ** -** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory +** ^The tdsqlite3_expanded_sql() interface returns NULL if insufficient memory ** is available to hold the result, or if the result would exceed the ** the maximum string length determined by the [SQLITE_LIMIT_LENGTH]. ** ** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of ** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time -** option causes sqlite3_expanded_sql() to always return NULL. +** option causes tdsqlite3_expanded_sql() to always return NULL. ** -** ^The strings returned by sqlite3_sql(P) and sqlite3_normalized_sql(P) +** ^The strings returned by tdsqlite3_sql(P) and tdsqlite3_normalized_sql(P) ** are managed by SQLite and are automatically freed when the prepared ** statement is finalized. -** ^The string returned by sqlite3_expanded_sql(P), on the other hand, -** is obtained from [sqlite3_malloc()] and must be free by the application -** by passing it to [sqlite3_free()]. +** ^The string returned by tdsqlite3_expanded_sql(P), on the other hand, +** is obtained from [tdsqlite3_malloc()] and must be free by the application +** by passing it to [tdsqlite3_free()]. */ -SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); -SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt); -SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt); +SQLITE_API const char *tdsqlite3_sql(tdsqlite3_stmt *pStmt); +SQLITE_API char *tdsqlite3_expanded_sql(tdsqlite3_stmt *pStmt); +SQLITE_API const char *tdsqlite3_normalized_sql(tdsqlite3_stmt *pStmt); /* ** CAPI3REF: Determine If An SQL Statement Writes The Database -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** -** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if +** ^The tdsqlite3_stmt_readonly(X) interface returns true (non-zero) if ** and only if the [prepared statement] X makes no direct changes to ** the content of the database file. ** ** Note that [application-defined SQL functions] or ** [virtual tables] might change the database indirectly as a side effect. ** ^(For example, if an application defines a function "eval()" that -** calls [sqlite3_exec()], then the following SQL statement would +** calls [tdsqlite3_exec()], then the following SQL statement would ** change the database file through side-effects: ** **

    @@ -4058,119 +4058,119 @@ SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
     ** 
    ** ** But because the [SELECT] statement does not change the database file -** directly, sqlite3_stmt_readonly() would still return true.)^ +** directly, tdsqlite3_stmt_readonly() would still return true.)^ ** ** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK], -** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true, +** [SAVEPOINT], and [RELEASE] cause tdsqlite3_stmt_readonly() to return true, ** since the statements themselves do not actually modify the database but ** rather they control the timing of when other statements modify the ** database. ^The [ATTACH] and [DETACH] statements also cause -** sqlite3_stmt_readonly() to return true since, while those statements +** tdsqlite3_stmt_readonly() to return true since, while those statements ** change the configuration of a database connection, they do not make ** changes to the content of the database files on disk. -** ^The sqlite3_stmt_readonly() interface returns true for [BEGIN] since +** ^The tdsqlite3_stmt_readonly() interface returns true for [BEGIN] since ** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and ** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so -** sqlite3_stmt_readonly() returns false for those commands. +** tdsqlite3_stmt_readonly() returns false for those commands. */ -SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); +SQLITE_API int tdsqlite3_stmt_readonly(tdsqlite3_stmt *pStmt); /* ** CAPI3REF: Query The EXPLAIN Setting For A Prepared Statement -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** -** ^The sqlite3_stmt_isexplain(S) interface returns 1 if the +** ^The tdsqlite3_stmt_isexplain(S) interface returns 1 if the ** prepared statement S is an EXPLAIN statement, or 2 if the ** statement S is an EXPLAIN QUERY PLAN. -** ^The sqlite3_stmt_isexplain(S) interface returns 0 if S is +** ^The tdsqlite3_stmt_isexplain(S) interface returns 0 if S is ** an ordinary statement or a NULL pointer. */ -SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt); +SQLITE_API int tdsqlite3_stmt_isexplain(tdsqlite3_stmt *pStmt); /* ** CAPI3REF: Determine If A Prepared Statement Has Been Reset -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** -** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the +** ^The tdsqlite3_stmt_busy(S) interface returns true (non-zero) if the ** [prepared statement] S has been stepped at least once using -** [sqlite3_step(S)] but has neither run to completion (returned -** [SQLITE_DONE] from [sqlite3_step(S)]) nor -** been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S) +** [tdsqlite3_step(S)] but has neither run to completion (returned +** [SQLITE_DONE] from [tdsqlite3_step(S)]) nor +** been reset using [tdsqlite3_reset(S)]. ^The tdsqlite3_stmt_busy(S) ** interface returns false if S is a NULL pointer. If S is not a ** NULL pointer and is not a pointer to a valid [prepared statement] ** object, then the behavior is undefined and probably undesirable. ** -** This interface can be used in combination [sqlite3_next_stmt()] +** This interface can be used in combination [tdsqlite3_next_stmt()] ** to locate all prepared statements associated with a database ** connection that are in need of being reset. This can be used, ** for example, in diagnostic routines to search for prepared ** statements that are holding a transaction open. */ -SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*); +SQLITE_API int tdsqlite3_stmt_busy(tdsqlite3_stmt*); /* ** CAPI3REF: Dynamically Typed Value Object -** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value} +** KEYWORDS: {protected tdsqlite3_value} {unprotected tdsqlite3_value} ** -** SQLite uses the sqlite3_value object to represent all values +** SQLite uses the tdsqlite3_value object to represent all values ** that can be stored in a database table. SQLite uses dynamic typing -** for the values it stores. ^Values stored in sqlite3_value objects +** for the values it stores. ^Values stored in tdsqlite3_value objects ** can be integers, floating point values, strings, BLOBs, or NULL. ** -** An sqlite3_value object may be either "protected" or "unprotected". -** Some interfaces require a protected sqlite3_value. Other interfaces -** will accept either a protected or an unprotected sqlite3_value. -** Every interface that accepts sqlite3_value arguments specifies -** whether or not it requires a protected sqlite3_value. The -** [sqlite3_value_dup()] interface can be used to construct a new -** protected sqlite3_value from an unprotected sqlite3_value. +** An tdsqlite3_value object may be either "protected" or "unprotected". +** Some interfaces require a protected tdsqlite3_value. Other interfaces +** will accept either a protected or an unprotected tdsqlite3_value. +** Every interface that accepts tdsqlite3_value arguments specifies +** whether or not it requires a protected tdsqlite3_value. The +** [tdsqlite3_value_dup()] interface can be used to construct a new +** protected tdsqlite3_value from an unprotected tdsqlite3_value. ** ** The terms "protected" and "unprotected" refer to whether or not ** a mutex is held. An internal mutex is held for a protected -** sqlite3_value object but no mutex is held for an unprotected -** sqlite3_value object. If SQLite is compiled to be single-threaded -** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) +** tdsqlite3_value object but no mutex is held for an unprotected +** tdsqlite3_value object. If SQLite is compiled to be single-threaded +** (with [SQLITE_THREADSAFE=0] and with [tdsqlite3_threadsafe()] returning 0) ** or if SQLite is run in one of reduced mutex modes ** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] ** then there is no distinction between protected and unprotected -** sqlite3_value objects and they can be used interchangeably. However, +** tdsqlite3_value objects and they can be used interchangeably. However, ** for maximum code portability it is recommended that applications ** still make the distinction between protected and unprotected -** sqlite3_value objects even when not strictly required. +** tdsqlite3_value objects even when not strictly required. ** -** ^The sqlite3_value objects that are passed as parameters into the +** ^The tdsqlite3_value objects that are passed as parameters into the ** implementation of [application-defined SQL functions] are protected. -** ^The sqlite3_value object returned by -** [sqlite3_column_value()] is unprotected. -** Unprotected sqlite3_value objects may only be used as arguments -** to [sqlite3_result_value()], [sqlite3_bind_value()], and -** [sqlite3_value_dup()]. -** The [sqlite3_value_blob | sqlite3_value_type()] family of -** interfaces require protected sqlite3_value objects. +** ^The tdsqlite3_value object returned by +** [tdsqlite3_column_value()] is unprotected. +** Unprotected tdsqlite3_value objects may only be used as arguments +** to [tdsqlite3_result_value()], [tdsqlite3_bind_value()], and +** [tdsqlite3_value_dup()]. +** The [tdsqlite3_value_blob | tdsqlite3_value_type()] family of +** interfaces require protected tdsqlite3_value objects. */ -typedef struct sqlite3_value sqlite3_value; +typedef struct tdsqlite3_value tdsqlite3_value; /* ** CAPI3REF: SQL Function Context Object ** ** The context in which an SQL function executes is stored in an -** sqlite3_context object. ^A pointer to an sqlite3_context object +** tdsqlite3_context object. ^A pointer to an tdsqlite3_context object ** is always first parameter to [application-defined SQL functions]. ** The application-defined SQL function implementation will pass this -** pointer through into calls to [sqlite3_result_int | sqlite3_result()], -** [sqlite3_aggregate_context()], [sqlite3_user_data()], -** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()], -** and/or [sqlite3_set_auxdata()]. +** pointer through into calls to [tdsqlite3_result_int | tdsqlite3_result()], +** [tdsqlite3_aggregate_context()], [tdsqlite3_user_data()], +** [tdsqlite3_context_db_handle()], [tdsqlite3_get_auxdata()], +** and/or [tdsqlite3_set_auxdata()]. */ -typedef struct sqlite3_context sqlite3_context; +typedef struct tdsqlite3_context tdsqlite3_context; /* ** CAPI3REF: Binding Values To Prepared Statements ** KEYWORDS: {host parameter} {host parameters} {host parameter name} ** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding} -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** -** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants, +** ^(In the SQL statement text input to [tdsqlite3_prepare_v2()] and its variants, ** literals may be replaced by a [parameter] that matches one of following ** templates: ** @@ -4185,37 +4185,37 @@ typedef struct sqlite3_context sqlite3_context; ** In the templates above, NNN represents an integer literal, ** and VVV represents an alphanumeric identifier.)^ ^The values of these ** parameters (also called "host parameter names" or "SQL parameters") -** can be set using the sqlite3_bind_*() routines defined here. +** can be set using the tdsqlite3_bind_*() routines defined here. ** -** ^The first argument to the sqlite3_bind_*() routines is always -** a pointer to the [sqlite3_stmt] object returned from -** [sqlite3_prepare_v2()] or its variants. +** ^The first argument to the tdsqlite3_bind_*() routines is always +** a pointer to the [tdsqlite3_stmt] object returned from +** [tdsqlite3_prepare_v2()] or its variants. ** ** ^The second argument is the index of the SQL parameter to be set. ** ^The leftmost SQL parameter has an index of 1. ^When the same named ** SQL parameter is used more than once, second and subsequent ** occurrences have the same index as the first occurrence. ** ^The index for named parameters can be looked up using the -** [sqlite3_bind_parameter_index()] API if desired. ^The index +** [tdsqlite3_bind_parameter_index()] API if desired. ^The index ** for "?NNN" parameters is the value of NNN. -** ^The NNN value must be between 1 and the [sqlite3_limit()] +** ^The NNN value must be between 1 and the [tdsqlite3_limit()] ** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999). ** ** ^The third argument is the value to bind to the parameter. -** ^If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16() -** or sqlite3_bind_blob() is a NULL pointer then the fourth parameter -** is ignored and the end result is the same as sqlite3_bind_null(). +** ^If the third parameter to tdsqlite3_bind_text() or tdsqlite3_bind_text16() +** or tdsqlite3_bind_blob() is a NULL pointer then the fourth parameter +** is ignored and the end result is the same as tdsqlite3_bind_null(). ** ** ^(In those routines that have a fourth argument, its value is the ** number of bytes in the parameter. To be clear: the value is the ** number of bytes in the value, not the number of characters.)^ -** ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16() +** ^If the fourth parameter to tdsqlite3_bind_text() or tdsqlite3_bind_text16() ** is negative, then the length of the string is ** the number of bytes up to the first zero terminator. -** If the fourth parameter to sqlite3_bind_blob() is negative, then +** If the fourth parameter to tdsqlite3_bind_blob() is negative, then ** the behavior is undefined. -** If a non-negative fourth parameter is provided to sqlite3_bind_text() -** or sqlite3_bind_text16() or sqlite3_bind_text64() then +** If a non-negative fourth parameter is provided to tdsqlite3_bind_text() +** or tdsqlite3_bind_text16() or tdsqlite3_bind_text64() then ** that parameter must be the byte offset ** where the NUL terminator would occur assuming the string were NUL ** terminated. If any NUL characters occur at byte offsets less than @@ -4234,78 +4234,78 @@ typedef struct sqlite3_context sqlite3_context; ** information is in static, unmanaged space and does not need to be freed. ** ^If the fifth argument has the value [SQLITE_TRANSIENT], then ** SQLite makes its own private copy of the data immediately, before -** the sqlite3_bind_*() routine returns. +** the tdsqlite3_bind_*() routine returns. ** -** ^The sixth argument to sqlite3_bind_text64() must be one of +** ^The sixth argument to tdsqlite3_bind_text64() must be one of ** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE] ** to specify the encoding of the text in the third parameter. If -** the sixth argument to sqlite3_bind_text64() is not one of the +** the sixth argument to tdsqlite3_bind_text64() is not one of the ** allowed values shown above, or if the text encoding is different ** from the encoding specified by the sixth parameter, then the behavior ** is undefined. ** -** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that +** ^The tdsqlite3_bind_zeroblob() routine binds a BLOB of length N that ** is filled with zeroes. ^A zeroblob uses a fixed amount of memory ** (just an integer to hold its size) while it is being processed. ** Zeroblobs are intended to serve as placeholders for BLOBs whose ** content is later written using -** [sqlite3_blob_open | incremental BLOB I/O] routines. +** [tdsqlite3_blob_open | incremental BLOB I/O] routines. ** ^A negative value for the zeroblob results in a zero-length BLOB. ** -** ^The sqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in +** ^The tdsqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in ** [prepared statement] S to have an SQL value of NULL, but to also be ** associated with the pointer P of type T. ^D is either a NULL pointer or ** a pointer to a destructor function for P. ^SQLite will invoke the ** destructor D with a single argument of P when it is finished using ** P. The T parameter should be a static string, preferably a string -** literal. The sqlite3_bind_pointer() routine is part of the +** literal. The tdsqlite3_bind_pointer() routine is part of the ** [pointer passing interface] added for SQLite 3.20.0. ** -** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer +** ^If any of the tdsqlite3_bind_*() routines are called with a NULL pointer ** for the [prepared statement] or with a prepared statement for which -** [sqlite3_step()] has been called more recently than [sqlite3_reset()], -** then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_() +** [tdsqlite3_step()] has been called more recently than [tdsqlite3_reset()], +** then the call will return [SQLITE_MISUSE]. If any tdsqlite3_bind_() ** routine is passed a [prepared statement] that has been finalized, the ** result is undefined and probably harmful. ** -** ^Bindings are not cleared by the [sqlite3_reset()] routine. +** ^Bindings are not cleared by the [tdsqlite3_reset()] routine. ** ^Unbound parameters are interpreted as NULL. ** -** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an +** ^The tdsqlite3_bind_* routines return [SQLITE_OK] on success or an ** [error code] if anything goes wrong. ** ^[SQLITE_TOOBIG] might be returned if the size of a string or BLOB -** exceeds limits imposed by [sqlite3_limit]([SQLITE_LIMIT_LENGTH]) or +** exceeds limits imposed by [tdsqlite3_limit]([SQLITE_LIMIT_LENGTH]) or ** [SQLITE_MAX_LENGTH]. ** ^[SQLITE_RANGE] is returned if the parameter ** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails. ** -** See also: [sqlite3_bind_parameter_count()], -** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()]. +** See also: [tdsqlite3_bind_parameter_count()], +** [tdsqlite3_bind_parameter_name()], and [tdsqlite3_bind_parameter_index()]. */ -SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); -SQLITE_API int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64, +SQLITE_API int tdsqlite3_bind_blob(tdsqlite3_stmt*, int, const void*, int n, void(*)(void*)); +SQLITE_API int tdsqlite3_bind_blob64(tdsqlite3_stmt*, int, const void*, tdsqlite3_uint64, void(*)(void*)); -SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double); -SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int); -SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64); -SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int); -SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*)); -SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*)); -SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64, +SQLITE_API int tdsqlite3_bind_double(tdsqlite3_stmt*, int, double); +SQLITE_API int tdsqlite3_bind_int(tdsqlite3_stmt*, int, int); +SQLITE_API int tdsqlite3_bind_int64(tdsqlite3_stmt*, int, tdsqlite3_int64); +SQLITE_API int tdsqlite3_bind_null(tdsqlite3_stmt*, int); +SQLITE_API int tdsqlite3_bind_text(tdsqlite3_stmt*,int,const char*,int,void(*)(void*)); +SQLITE_API int tdsqlite3_bind_text16(tdsqlite3_stmt*, int, const void*, int, void(*)(void*)); +SQLITE_API int tdsqlite3_bind_text64(tdsqlite3_stmt*, int, const char*, tdsqlite3_uint64, void(*)(void*), unsigned char encoding); -SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*); -SQLITE_API int sqlite3_bind_pointer(sqlite3_stmt*, int, void*, const char*,void(*)(void*)); -SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n); -SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64); +SQLITE_API int tdsqlite3_bind_value(tdsqlite3_stmt*, int, const tdsqlite3_value*); +SQLITE_API int tdsqlite3_bind_pointer(tdsqlite3_stmt*, int, void*, const char*,void(*)(void*)); +SQLITE_API int tdsqlite3_bind_zeroblob(tdsqlite3_stmt*, int, int n); +SQLITE_API int tdsqlite3_bind_zeroblob64(tdsqlite3_stmt*, int, tdsqlite3_uint64); /* ** CAPI3REF: Number Of SQL Parameters -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** ** ^This routine can be used to find the number of [SQL parameters] ** in a [prepared statement]. SQL parameters are tokens of the ** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as -** placeholders for values that are [sqlite3_bind_blob | bound] +** placeholders for values that are [tdsqlite3_bind_blob | bound] ** to the parameters at a later time. ** ** ^(This routine actually returns the index of the largest (rightmost) @@ -4313,17 +4313,17 @@ SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64); ** number of unique parameters. If parameters of the ?NNN form are used, ** there may be gaps in the list.)^ ** -** See also: [sqlite3_bind_blob|sqlite3_bind()], -** [sqlite3_bind_parameter_name()], and -** [sqlite3_bind_parameter_index()]. +** See also: [tdsqlite3_bind_blob|tdsqlite3_bind()], +** [tdsqlite3_bind_parameter_name()], and +** [tdsqlite3_bind_parameter_index()]. */ -SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*); +SQLITE_API int tdsqlite3_bind_parameter_count(tdsqlite3_stmt*); /* ** CAPI3REF: Name Of A Host Parameter -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** -** ^The sqlite3_bind_parameter_name(P,N) interface returns +** ^The tdsqlite3_bind_parameter_name(P,N) interface returns ** the name of the N-th [SQL parameter] in the [prepared statement] P. ** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA" ** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA" @@ -4338,78 +4338,78 @@ SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*); ** ^If the value N is out of range or if the N-th parameter is ** nameless, then NULL is returned. ^The returned string is ** always in UTF-8 encoding even if the named parameter was -** originally specified as UTF-16 in [sqlite3_prepare16()], -** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. +** originally specified as UTF-16 in [tdsqlite3_prepare16()], +** [tdsqlite3_prepare16_v2()], or [tdsqlite3_prepare16_v3()]. ** -** See also: [sqlite3_bind_blob|sqlite3_bind()], -** [sqlite3_bind_parameter_count()], and -** [sqlite3_bind_parameter_index()]. +** See also: [tdsqlite3_bind_blob|tdsqlite3_bind()], +** [tdsqlite3_bind_parameter_count()], and +** [tdsqlite3_bind_parameter_index()]. */ -SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int); +SQLITE_API const char *tdsqlite3_bind_parameter_name(tdsqlite3_stmt*, int); /* ** CAPI3REF: Index Of A Parameter With A Given Name -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** ** ^Return the index of an SQL parameter given its name. ^The ** index value returned is suitable for use as the second -** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero +** parameter to [tdsqlite3_bind_blob|tdsqlite3_bind()]. ^A zero ** is returned if no matching parameter is found. ^The parameter ** name must be given in UTF-8 even if the original statement -** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or -** [sqlite3_prepare16_v3()]. +** was prepared from UTF-16 text using [tdsqlite3_prepare16_v2()] or +** [tdsqlite3_prepare16_v3()]. ** -** See also: [sqlite3_bind_blob|sqlite3_bind()], -** [sqlite3_bind_parameter_count()], and -** [sqlite3_bind_parameter_name()]. +** See also: [tdsqlite3_bind_blob|tdsqlite3_bind()], +** [tdsqlite3_bind_parameter_count()], and +** [tdsqlite3_bind_parameter_name()]. */ -SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName); +SQLITE_API int tdsqlite3_bind_parameter_index(tdsqlite3_stmt*, const char *zName); /* ** CAPI3REF: Reset All Bindings On A Prepared Statement -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** -** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset -** the [sqlite3_bind_blob | bindings] on a [prepared statement]. +** ^Contrary to the intuition of many, [tdsqlite3_reset()] does not reset +** the [tdsqlite3_bind_blob | bindings] on a [prepared statement]. ** ^Use this routine to reset all host parameters to NULL. */ -SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*); +SQLITE_API int tdsqlite3_clear_bindings(tdsqlite3_stmt*); /* ** CAPI3REF: Number Of Columns In A Result Set -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** ** ^Return the number of columns in the result set returned by the ** [prepared statement]. ^If this routine returns 0, that means the ** [prepared statement] returns no data (for example an [UPDATE]). ** ^However, just because this routine returns a positive number does not ** mean that one or more rows of data will be returned. ^A SELECT statement -** will always have a positive sqlite3_column_count() but depending on the +** will always have a positive tdsqlite3_column_count() but depending on the ** WHERE clause constraints and the table content, it might return no rows. ** -** See also: [sqlite3_data_count()] +** See also: [tdsqlite3_data_count()] */ -SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt); +SQLITE_API int tdsqlite3_column_count(tdsqlite3_stmt *pStmt); /* ** CAPI3REF: Column Names In A Result Set -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** ** ^These routines return the name assigned to a particular column -** in the result set of a [SELECT] statement. ^The sqlite3_column_name() +** in the result set of a [SELECT] statement. ^The tdsqlite3_column_name() ** interface returns a pointer to a zero-terminated UTF-8 string -** and sqlite3_column_name16() returns a pointer to a zero-terminated +** and tdsqlite3_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 [sqlite3_finalize()] or until the statement is automatically -** reprepared by the first call to [sqlite3_step()] for a particular run +** is destroyed by [tdsqlite3_finalize()] or until the statement is automatically +** reprepared by the first call to [tdsqlite3_step()] for a particular run ** or until the next call to -** sqlite3_column_name() or sqlite3_column_name16() on the same column. +** tdsqlite3_column_name() or tdsqlite3_column_name16() on the same column. ** -** ^If sqlite3_malloc() fails during the processing of either routine +** ^If tdsqlite3_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. ** @@ -4418,12 +4418,12 @@ SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt); ** then the name of the column is unspecified and may change from ** one release of SQLite to the next. */ -SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N); -SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N); +SQLITE_API const char *tdsqlite3_column_name(tdsqlite3_stmt*, int N); +SQLITE_API const void *tdsqlite3_column_name16(tdsqlite3_stmt*, int N); /* ** CAPI3REF: Source Of Data In A Query Result -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** ** ^These routines provide a means to determine the database, table, and ** table column that is the origin of a particular result column in @@ -4433,8 +4433,8 @@ SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N); ** the database name, the _table_ routines return the table name, and ** the origin_ routines return the column name. ** ^The returned string is valid until the [prepared statement] is destroyed -** using [sqlite3_finalize()] or until the statement is automatically -** reprepared by the first call to [sqlite3_step()] for a particular run +** using [tdsqlite3_finalize()] or until the statement is automatically +** reprepared by the first call to [tdsqlite3_step()] for a particular run ** or until the same information is requested ** again in a different encoding. ** @@ -4459,20 +4459,20 @@ SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N); ** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol. ** ** If two or more threads call one or more -** [sqlite3_column_database_name | column metadata interfaces] +** [tdsqlite3_column_database_name | column metadata interfaces] ** for the same [prepared statement] and result column ** at the same time then the results are undefined. */ -SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int); -SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int); -SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int); -SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int); -SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int); -SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int); +SQLITE_API const char *tdsqlite3_column_database_name(tdsqlite3_stmt*,int); +SQLITE_API const void *tdsqlite3_column_database_name16(tdsqlite3_stmt*,int); +SQLITE_API const char *tdsqlite3_column_table_name(tdsqlite3_stmt*,int); +SQLITE_API const void *tdsqlite3_column_table_name16(tdsqlite3_stmt*,int); +SQLITE_API const char *tdsqlite3_column_origin_name(tdsqlite3_stmt*,int); +SQLITE_API const void *tdsqlite3_column_origin_name16(tdsqlite3_stmt*,int); /* ** CAPI3REF: Declared Datatype Of A Query Result -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** ** ^(The first parameter is a [prepared statement]. ** If this statement is a [SELECT] statement and the Nth column of the @@ -4500,24 +4500,24 @@ SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int); ** is associated with individual values, not with the containers ** used to hold those values. */ -SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int); -SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int); +SQLITE_API const char *tdsqlite3_column_decltype(tdsqlite3_stmt*,int); +SQLITE_API const void *tdsqlite3_column_decltype16(tdsqlite3_stmt*,int); /* ** CAPI3REF: Evaluate An SQL Statement -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** ** After a [prepared statement] has been prepared using any of -** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()], -** or [sqlite3_prepare16_v3()] or one of the legacy -** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function +** [tdsqlite3_prepare_v2()], [tdsqlite3_prepare_v3()], [tdsqlite3_prepare16_v2()], +** or [tdsqlite3_prepare16_v3()] or one of the legacy +** interfaces [tdsqlite3_prepare()] or [tdsqlite3_prepare16()], this function ** must be called one or more times to evaluate the statement. ** -** The details of the behavior of the sqlite3_step() interface depend +** The details of the behavior of the tdsqlite3_step() interface depend ** on whether the statement was prepared using the newer "vX" interfaces -** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()], -** [sqlite3_prepare16_v2()] or the older legacy -** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the +** [tdsqlite3_prepare_v3()], [tdsqlite3_prepare_v2()], [tdsqlite3_prepare16_v3()], +** [tdsqlite3_prepare16_v2()] or the older legacy +** interfaces [tdsqlite3_prepare()] and [tdsqlite3_prepare16()]. The use of the ** new "vX" interface is recommended for new applications but the legacy ** interface will continue to be supported. ** @@ -4534,79 +4534,79 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int); ** continuing. ** ** ^[SQLITE_DONE] means that the statement has finished executing -** successfully. sqlite3_step() should not be called again on this virtual -** machine without first calling [sqlite3_reset()] to reset the virtual +** successfully. tdsqlite3_step() should not be called again on this virtual +** machine without first calling [tdsqlite3_reset()] to reset the virtual ** machine back to its initial state. ** ** ^If the SQL statement being executed returns any data, then [SQLITE_ROW] ** is returned each time a new row of data is ready for processing by the ** caller. The values may be accessed using the [column access functions]. -** sqlite3_step() is called again to retrieve the next row of data. +** tdsqlite3_step() is called again to retrieve the next row of data. ** ** ^[SQLITE_ERROR] means that a run-time error (such as a constraint -** violation) has occurred. sqlite3_step() should not be called again on -** the VM. More information may be found by calling [sqlite3_errmsg()]. +** violation) has occurred. tdsqlite3_step() should not be called again on +** the VM. More information may be found by calling [tdsqlite3_errmsg()]. ** ^With the legacy interface, a more specific error code (for example, ** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth) -** can be obtained by calling [sqlite3_reset()] on the +** can be obtained by calling [tdsqlite3_reset()] on the ** [prepared statement]. ^In the "v2" interface, -** the more specific error code is returned directly by sqlite3_step(). +** the more specific error code is returned directly by tdsqlite3_step(). ** ** [SQLITE_MISUSE] means that the this routine was called inappropriately. ** Perhaps it was called on a [prepared statement] that has -** already been [sqlite3_finalize | finalized] or on one that had +** already been [tdsqlite3_finalize | finalized] or on one that had ** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could ** be the case that the same database connection is being used by two or ** more threads at the same moment in time. ** ** For all versions of SQLite up to and including 3.6.23.1, a call to -** [sqlite3_reset()] was required after sqlite3_step() returned anything +** [tdsqlite3_reset()] was required after tdsqlite3_step() returned anything ** other than [SQLITE_ROW] before any subsequent invocation of -** sqlite3_step(). Failure to reset the prepared statement using -** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from -** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1], -** sqlite3_step() began -** calling [sqlite3_reset()] automatically in this circumstance rather +** tdsqlite3_step(). Failure to reset the prepared statement using +** [tdsqlite3_reset()] would result in an [SQLITE_MISUSE] return from +** tdsqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1], +** tdsqlite3_step() began +** calling [tdsqlite3_reset()] automatically in this circumstance rather ** than returning [SQLITE_MISUSE]. This is not considered a compatibility ** break because any application that ever receives an SQLITE_MISUSE error ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option ** can be used to restore the legacy behavior. ** -** Goofy Interface Alert: In the legacy interface, the sqlite3_step() +** Goofy Interface Alert: In the legacy interface, the tdsqlite3_step() ** API always returns a generic error code, [SQLITE_ERROR], following any ** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call -** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the +** [tdsqlite3_reset()] or [tdsqlite3_finalize()] in order to find one of the ** specific [error codes] that better describes the error. ** We admit that this is a goofy design. The problem has been fixed ** with the "v2" interface. If you prepare all of your SQL statements -** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()] -** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead -** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, +** using [tdsqlite3_prepare_v3()] or [tdsqlite3_prepare_v2()] +** or [tdsqlite3_prepare16_v2()] or [tdsqlite3_prepare16_v3()] instead +** of the legacy [tdsqlite3_prepare()] and [tdsqlite3_prepare16()] interfaces, ** then the more specific [error codes] are returned directly -** by sqlite3_step(). The use of the "vX" interfaces is recommended. +** by tdsqlite3_step(). The use of the "vX" interfaces is recommended. */ -SQLITE_API int sqlite3_step(sqlite3_stmt*); +SQLITE_API int tdsqlite3_step(tdsqlite3_stmt*); /* ** CAPI3REF: Number of columns in a result set -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** -** ^The sqlite3_data_count(P) interface returns the number of columns in the +** ^The tdsqlite3_data_count(P) interface returns the number of columns in the ** current row of the result set of [prepared statement] P. ** ^If prepared statement P does not have results ready to return -** (via calls to the [sqlite3_column_int | sqlite3_column()] family of -** interfaces) then sqlite3_data_count(P) returns 0. -** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer. -** ^The sqlite3_data_count(P) routine returns 0 if the previous call to -** [sqlite3_step](P) returned [SQLITE_DONE]. ^The sqlite3_data_count(P) -** will return non-zero if previous call to [sqlite3_step](P) returned +** (via calls to the [tdsqlite3_column_int | tdsqlite3_column()] family of +** interfaces) then tdsqlite3_data_count(P) returns 0. +** ^The tdsqlite3_data_count(P) routine also returns 0 if P is a NULL pointer. +** ^The tdsqlite3_data_count(P) routine returns 0 if the previous call to +** [tdsqlite3_step](P) returned [SQLITE_DONE]. ^The tdsqlite3_data_count(P) +** will return non-zero if previous call to [tdsqlite3_step](P) returned ** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum] ** where it always returns zero since each step of that multi-step ** pragma returns 0 columns of data. ** -** See also: [sqlite3_column_count()] +** See also: [tdsqlite3_column_count()] */ -SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); +SQLITE_API int tdsqlite3_data_count(tdsqlite3_stmt *pStmt); /* ** CAPI3REF: Fundamental Datatypes @@ -4643,25 +4643,25 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); /* ** CAPI3REF: Result Values From A Query ** KEYWORDS: {column access functions} -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** ** Summary: **
-**
sqlite3_column_blobBLOB result -**
sqlite3_column_doubleREAL result -**
sqlite3_column_int32-bit INTEGER result -**
sqlite3_column_int6464-bit INTEGER result -**
sqlite3_column_textUTF-8 TEXT result -**
sqlite3_column_text16UTF-16 TEXT result -**
sqlite3_column_valueThe result as an -** [sqlite3_value|unprotected sqlite3_value] object. +**
tdsqlite3_column_blobBLOB result +**
tdsqlite3_column_doubleREAL result +**
tdsqlite3_column_int32-bit INTEGER result +**
tdsqlite3_column_int6464-bit INTEGER result +**
tdsqlite3_column_textUTF-8 TEXT result +**
tdsqlite3_column_text16UTF-16 TEXT result +**
tdsqlite3_column_valueThe result as an +** [tdsqlite3_value|unprotected tdsqlite3_value] object. **
    -**
sqlite3_column_bytesSize of a BLOB +**
tdsqlite3_column_bytesSize of a BLOB ** or a UTF-8 TEXT result in bytes -**
sqlite3_column_bytes16   +**
tdsqlite3_column_bytes16   ** →  Size of UTF-16 ** TEXT in bytes -**
sqlite3_column_typeDefault +**
tdsqlite3_column_typeDefault ** datatype of the result **
** @@ -4669,92 +4669,92 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); ** ** ^These routines return information about a single column of the current ** result row of a query. ^In every case the first argument is a pointer -** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] -** that was returned from [sqlite3_prepare_v2()] or one of its variants) +** to the [prepared statement] that is being evaluated (the [tdsqlite3_stmt*] +** that was returned from [tdsqlite3_prepare_v2()] or one of its variants) ** and the second argument is the index of the column for which information ** should be returned. ^The leftmost column of the result set has the index 0. ** ^The number of columns in the result can be determined using -** [sqlite3_column_count()]. +** [tdsqlite3_column_count()]. ** ** If the SQL statement does not currently point to a valid row, or if the ** column index is out of range, the result is undefined. ** These routines may only be called when the most recent call to -** [sqlite3_step()] has returned [SQLITE_ROW] and neither -** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently. -** If any of these routines are called after [sqlite3_reset()] or -** [sqlite3_finalize()] or after [sqlite3_step()] has returned +** [tdsqlite3_step()] has returned [SQLITE_ROW] and neither +** [tdsqlite3_reset()] nor [tdsqlite3_finalize()] have been called subsequently. +** If any of these routines are called after [tdsqlite3_reset()] or +** [tdsqlite3_finalize()] or after [tdsqlite3_step()] has returned ** something other than [SQLITE_ROW], the results are undefined. -** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()] +** If [tdsqlite3_step()] or [tdsqlite3_reset()] or [tdsqlite3_finalize()] ** are called from a different thread while any of these routines ** are pending, then the results are undefined. ** ** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16) ** each return the value of a result column in a specific data format. If ** the result column is not initially in the requested format (for example, -** if the query returns an integer but the sqlite3_column_text() interface +** if the query returns an integer but the tdsqlite3_column_text() interface ** is used to extract the value) then an automatic type conversion is performed. ** -** ^The sqlite3_column_type() routine returns the +** ^The tdsqlite3_column_type() routine returns the ** [SQLITE_INTEGER | datatype code] for the initial data type ** of the result column. ^The returned value is one of [SQLITE_INTEGER], ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. -** The return value of sqlite3_column_type() can be used to decide which +** The return value of tdsqlite3_column_type() can be used to decide which ** of the first six interface should be used to extract the column value. -** The value returned by sqlite3_column_type() is only meaningful if no +** The value returned by tdsqlite3_column_type() is only meaningful if no ** automatic type conversions have occurred for the value in question. -** After a type conversion, the result of calling sqlite3_column_type() +** After a type conversion, the result of calling tdsqlite3_column_type() ** is undefined, though harmless. Future -** versions of SQLite may change the behavior of sqlite3_column_type() +** versions of SQLite may change the behavior of tdsqlite3_column_type() ** following a type conversion. ** -** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes() -** or sqlite3_column_bytes16() interfaces can be used to determine the size +** If the result is a BLOB or a TEXT string, then the tdsqlite3_column_bytes() +** or tdsqlite3_column_bytes16() interfaces can be used to determine the size ** of that BLOB or string. ** -** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes() +** ^If the result is a BLOB or UTF-8 string then the tdsqlite3_column_bytes() ** routine returns the number of bytes in that BLOB or string. -** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts +** ^If the result is a UTF-16 string, then tdsqlite3_column_bytes() converts ** the string to UTF-8 and then returns the number of bytes. -** ^If the result is a numeric value then sqlite3_column_bytes() uses -** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns +** ^If the result is a numeric value then tdsqlite3_column_bytes() uses +** [tdsqlite3_snprintf()] to convert that value to a UTF-8 string and returns ** the number of bytes in that string. -** ^If the result is NULL, then sqlite3_column_bytes() returns zero. +** ^If the result is NULL, then tdsqlite3_column_bytes() returns zero. ** -** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16() +** ^If the result is a BLOB or UTF-16 string then the tdsqlite3_column_bytes16() ** routine returns the number of bytes in that BLOB or string. -** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts +** ^If the result is a UTF-8 string, then tdsqlite3_column_bytes16() converts ** the string to UTF-16 and then returns the number of bytes. -** ^If the result is a numeric value then sqlite3_column_bytes16() uses -** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns +** ^If the result is a numeric value then tdsqlite3_column_bytes16() uses +** [tdsqlite3_snprintf()] to convert that value to a UTF-16 string and returns ** the number of bytes in that string. -** ^If the result is NULL, then sqlite3_column_bytes16() returns zero. +** ^If the result is NULL, then tdsqlite3_column_bytes16() returns zero. ** -** ^The values returned by [sqlite3_column_bytes()] and -** [sqlite3_column_bytes16()] do not include the zero terminators at the end +** ^The values returned by [tdsqlite3_column_bytes()] and +** [tdsqlite3_column_bytes16()] do not include the zero terminators at the end ** of the string. ^For clarity: the values returned by -** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of +** [tdsqlite3_column_bytes()] and [tdsqlite3_column_bytes16()] are the number of ** bytes in the string, not the number of characters. ** -** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(), +** ^Strings returned by tdsqlite3_column_text() and tdsqlite3_column_text16(), ** even empty strings, are always zero-terminated. ^The return -** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer. +** value from tdsqlite3_column_blob() for a zero-length BLOB is a NULL pointer. ** -** Warning: ^The object returned by [sqlite3_column_value()] is an -** [unprotected sqlite3_value] object. In a multithreaded environment, -** an unprotected sqlite3_value object may only be used safely with -** [sqlite3_bind_value()] and [sqlite3_result_value()]. -** If the [unprotected sqlite3_value] object returned by -** [sqlite3_column_value()] is used in any other way, including calls -** to routines like [sqlite3_value_int()], [sqlite3_value_text()], -** or [sqlite3_value_bytes()], the behavior is not threadsafe. -** Hence, the sqlite3_column_value() interface +** Warning: ^The object returned by [tdsqlite3_column_value()] is an +** [unprotected tdsqlite3_value] object. In a multithreaded environment, +** an unprotected tdsqlite3_value object may only be used safely with +** [tdsqlite3_bind_value()] and [tdsqlite3_result_value()]. +** If the [unprotected tdsqlite3_value] object returned by +** [tdsqlite3_column_value()] is used in any other way, including calls +** to routines like [tdsqlite3_value_int()], [tdsqlite3_value_text()], +** or [tdsqlite3_value_bytes()], the behavior is not threadsafe. +** Hence, the tdsqlite3_column_value() interface ** is normally only useful within the implementation of ** [application-defined SQL functions] or [virtual tables], not within ** top-level application code. ** ** The these routines may attempt to convert the datatype of the result. ** ^For example, if the internal representation is FLOAT and a text result -** is requested, [sqlite3_snprintf()] is used internally to perform the +** is requested, [tdsqlite3_snprintf()] is used internally to perform the ** conversion automatically. ^(The following table details the conversions ** that are applied: ** @@ -4782,20 +4782,20 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); ** )^ ** ** Note that when type conversions occur, pointers returned by prior -** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or -** sqlite3_column_text16() may be invalidated. +** calls to tdsqlite3_column_blob(), tdsqlite3_column_text(), and/or +** tdsqlite3_column_text16() may be invalidated. ** Type conversions and pointer invalidations might occur ** in the following cases: ** **
    -**
  • The initial content is a BLOB and sqlite3_column_text() or -** sqlite3_column_text16() is called. A zero-terminator might +**
  • The initial content is a BLOB and tdsqlite3_column_text() or +** tdsqlite3_column_text16() is called. A zero-terminator might ** need to be added to the string.
  • -**
  • The initial content is UTF-8 text and sqlite3_column_bytes16() or -** sqlite3_column_text16() is called. The content must be converted +**
  • The initial content is UTF-8 text and tdsqlite3_column_bytes16() or +** tdsqlite3_column_text16() is called. The content must be converted ** to UTF-16.
  • -**
  • The initial content is UTF-16 text and sqlite3_column_bytes() or -** sqlite3_column_text() is called. The content must be converted +**
  • The initial content is UTF-16 text and tdsqlite3_column_bytes() or +** tdsqlite3_column_text() is called. The content must be converted ** to UTF-8.
  • **
** @@ -4809,25 +4809,25 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); ** in one of the following ways: ** **
    -**
  • sqlite3_column_text() followed by sqlite3_column_bytes()
  • -**
  • sqlite3_column_blob() followed by sqlite3_column_bytes()
  • -**
  • sqlite3_column_text16() followed by sqlite3_column_bytes16()
  • +**
  • tdsqlite3_column_text() followed by tdsqlite3_column_bytes()
  • +**
  • tdsqlite3_column_blob() followed by tdsqlite3_column_bytes()
  • +**
  • tdsqlite3_column_text16() followed by tdsqlite3_column_bytes16()
  • **
** -** In other words, you should call sqlite3_column_text(), -** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result -** into the desired format, then invoke sqlite3_column_bytes() or -** sqlite3_column_bytes16() to find the size of the result. Do not mix calls -** to sqlite3_column_text() or sqlite3_column_blob() with calls to -** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16() -** with calls to sqlite3_column_bytes(). +** In other words, you should call tdsqlite3_column_text(), +** tdsqlite3_column_blob(), or tdsqlite3_column_text16() first to force the result +** into the desired format, then invoke tdsqlite3_column_bytes() or +** tdsqlite3_column_bytes16() to find the size of the result. Do not mix calls +** to tdsqlite3_column_text() or tdsqlite3_column_blob() with calls to +** tdsqlite3_column_bytes16(), and do not mix calls to tdsqlite3_column_text16() +** with calls to tdsqlite3_column_bytes(). ** ** ^The pointers returned are valid until a type conversion occurs as -** described above, or until [sqlite3_step()] or [sqlite3_reset()] or -** [sqlite3_finalize()] is called. ^The memory space used to hold strings +** described above, or until [tdsqlite3_step()] or [tdsqlite3_reset()] or +** [tdsqlite3_finalize()] is called. ^The memory space used to hold strings ** and BLOBs is freed automatically. Do not pass the pointers returned -** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into -** [sqlite3_free()]. +** from [tdsqlite3_column_blob()], [tdsqlite3_column_text()], etc. into +** [tdsqlite3_free()]. ** ** As long as the input parameters are correct, these routines will only ** fail if an out-of-memory error occurs during a format conversion. @@ -4835,50 +4835,50 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); ** errors: ** **
    -**
  • sqlite3_column_blob() -**
  • sqlite3_column_text() -**
  • sqlite3_column_text16() -**
  • sqlite3_column_bytes() -**
  • sqlite3_column_bytes16() +**
  • tdsqlite3_column_blob() +**
  • tdsqlite3_column_text() +**
  • tdsqlite3_column_text16() +**
  • tdsqlite3_column_bytes() +**
  • tdsqlite3_column_bytes16() **
** ** If an out-of-memory error occurs, then the return value from these ** routines is the same as if the column had contained an SQL NULL value. ** Valid SQL NULL returns can be distinguished from out-of-memory errors -** by invoking the [sqlite3_errcode()] immediately after the suspect +** by invoking the [tdsqlite3_errcode()] immediately after the suspect ** return value is obtained and before any ** other SQLite interface is called on the same [database connection]. */ -SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); -SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol); -SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol); -SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); -SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); -SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); -SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol); -SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol); -SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); -SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol); +SQLITE_API const void *tdsqlite3_column_blob(tdsqlite3_stmt*, int iCol); +SQLITE_API double tdsqlite3_column_double(tdsqlite3_stmt*, int iCol); +SQLITE_API int tdsqlite3_column_int(tdsqlite3_stmt*, int iCol); +SQLITE_API tdsqlite3_int64 tdsqlite3_column_int64(tdsqlite3_stmt*, int iCol); +SQLITE_API const unsigned char *tdsqlite3_column_text(tdsqlite3_stmt*, int iCol); +SQLITE_API const void *tdsqlite3_column_text16(tdsqlite3_stmt*, int iCol); +SQLITE_API tdsqlite3_value *tdsqlite3_column_value(tdsqlite3_stmt*, int iCol); +SQLITE_API int tdsqlite3_column_bytes(tdsqlite3_stmt*, int iCol); +SQLITE_API int tdsqlite3_column_bytes16(tdsqlite3_stmt*, int iCol); +SQLITE_API int tdsqlite3_column_type(tdsqlite3_stmt*, int iCol); /* ** CAPI3REF: Destroy A Prepared Statement Object -** DESTRUCTOR: sqlite3_stmt +** DESTRUCTOR: tdsqlite3_stmt ** -** ^The sqlite3_finalize() function is called to delete a [prepared statement]. +** ^The tdsqlite3_finalize() function is called to delete a [prepared statement]. ** ^If the most recent evaluation of the statement encountered no errors -** or if the statement is never been evaluated, then sqlite3_finalize() returns +** or if the statement is never been evaluated, then tdsqlite3_finalize() returns ** SQLITE_OK. ^If the most recent evaluation of statement S failed, then -** sqlite3_finalize(S) returns the appropriate [error code] or +** tdsqlite3_finalize(S) returns the appropriate [error code] or ** [extended error code]. ** -** ^The sqlite3_finalize(S) routine can be called at any point during +** ^The tdsqlite3_finalize(S) routine can be called at any point during ** the life cycle of [prepared statement] S: ** before statement S is ever evaluated, after -** one or more calls to [sqlite3_reset()], or after any call -** to [sqlite3_step()] regardless of whether or not the statement has +** one or more calls to [tdsqlite3_reset()], or after any call +** to [tdsqlite3_step()] regardless of whether or not the statement has ** completed execution. ** -** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op. +** ^Invoking tdsqlite3_finalize() on a NULL pointer is a harmless no-op. ** ** The application must finalize every [prepared statement] in order to avoid ** resource leaks. It is a grievous error for the application to try to use @@ -4886,47 +4886,47 @@ SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol); ** statement after it has been finalized can result in undefined and ** undesirable behavior such as segfaults and heap corruption. */ -SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt); +SQLITE_API int tdsqlite3_finalize(tdsqlite3_stmt *pStmt); /* ** CAPI3REF: Reset A Prepared Statement Object -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** -** The sqlite3_reset() function is called to reset a [prepared statement] +** The tdsqlite3_reset() function is called to reset a [prepared statement] ** object back to its initial state, ready to be re-executed. ** ^Any SQL statement variables that had values bound to them using -** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values. -** Use [sqlite3_clear_bindings()] to reset the bindings. +** the [tdsqlite3_bind_blob | tdsqlite3_bind_*() API] retain their values. +** Use [tdsqlite3_clear_bindings()] to reset the bindings. ** -** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S +** ^The [tdsqlite3_reset(S)] interface resets the [prepared statement] S ** back to the beginning of its program. ** -** ^If the most recent call to [sqlite3_step(S)] for the +** ^If the most recent call to [tdsqlite3_step(S)] for the ** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE], -** or if [sqlite3_step(S)] has never before been called on S, -** then [sqlite3_reset(S)] returns [SQLITE_OK]. +** or if [tdsqlite3_step(S)] has never before been called on S, +** then [tdsqlite3_reset(S)] returns [SQLITE_OK]. ** -** ^If the most recent call to [sqlite3_step(S)] for the +** ^If the most recent call to [tdsqlite3_step(S)] for the ** [prepared statement] S indicated an error, then -** [sqlite3_reset(S)] returns an appropriate [error code]. +** [tdsqlite3_reset(S)] returns an appropriate [error code]. ** -** ^The [sqlite3_reset(S)] interface does not change the values -** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S. +** ^The [tdsqlite3_reset(S)] interface does not change the values +** of any [tdsqlite3_bind_blob|bindings] on the [prepared statement] S. */ -SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); +SQLITE_API int tdsqlite3_reset(tdsqlite3_stmt *pStmt); /* ** CAPI3REF: Create Or Redefine SQL Functions ** KEYWORDS: {function creation routines} -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^These functions (collectively known as "function creation routines") ** are used to add SQL functions or aggregates or to redefine the behavior ** of existing SQL functions or aggregates. The only differences between -** the three "sqlite3_create_function*" routines are the text encoding +** the three "tdsqlite3_create_function*" routines are the text encoding ** expected for the second parameter (the name of the function being ** created) and the presence or absence of a destructor callback for -** the application data pointer. Function sqlite3_create_window_function() +** the application data pointer. Function tdsqlite3_create_window_function() ** is similar, but allows the user to supply the extra callback functions ** needed by [aggregate window functions]. ** @@ -4946,7 +4946,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** 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 [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third +** set by [tdsqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third ** parameter is less than -1 or greater than 127 then the behavior is ** undefined. ** @@ -4954,9 +4954,9 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** [SQLITE_UTF8 | text encoding] this SQL function prefers for ** its parameters. The application should set this parameter to ** [SQLITE_UTF16LE] if the function implementation invokes -** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the -** implementation invokes [sqlite3_value_text16be()] on an input, or -** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8] +** [tdsqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the +** implementation invokes [tdsqlite3_value_text16be()] on an input, or +** [SQLITE_UTF16] if [tdsqlite3_value_text16()] is used, or [SQLITE_UTF8] ** otherwise. ^The same SQL function may be registered multiple times using ** different preferred text encodings, with different implementations for ** each encoding. @@ -4989,10 +4989,10 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** ** ** ^(The fifth parameter is an arbitrary pointer. The implementation of the -** function can gain access to this pointer using [sqlite3_user_data()].)^ +** function can gain access to this pointer using [tdsqlite3_user_data()].)^ ** ** ^The sixth, seventh and eighth parameters passed to the three -** "sqlite3_create_function*" functions, xFunc, xStep and xFinal, are +** "tdsqlite3_create_function*" functions, xFunc, xStep and xFinal, are ** pointers to C-language functions that implement the SQL function or ** aggregate. ^A scalar SQL function requires an implementation of the xFunc ** callback only; NULL pointers must be passed as the xStep and xFinal @@ -5002,7 +5002,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** callbacks. ** ** ^The sixth, seventh, eighth and ninth parameters (xStep, xFinal, xValue -** and xInverse) passed to sqlite3_create_window_function are pointers to +** and xInverse) passed to tdsqlite3_create_window_function are pointers to ** C-language callbacks that implement the new function. xStep and xFinal ** must both be non-NULL. xValue and xInverse may either both be NULL, in ** which case a regular aggregate function is created, or must both be @@ -5011,14 +5011,14 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** of aggregate window functions are ** [user-defined window functions|available here]. ** -** ^(If the final parameter to sqlite3_create_function_v2() or -** sqlite3_create_window_function() is not NULL, then it is destructor for +** ^(If the final parameter to tdsqlite3_create_function_v2() or +** tdsqlite3_create_window_function() is not NULL, then it is destructor for ** the application data pointer. The destructor is invoked when the function ** is deleted, either by being overloaded or when the database connection ** closes.)^ ^The destructor is also invoked if the call to -** sqlite3_create_function_v2() fails. ^When the destructor callback is +** tdsqlite3_create_function_v2() fails. ^When the destructor callback is ** invoked, it is passed a single argument which is a copy of the application -** data pointer which was the fifth parameter to sqlite3_create_function_v2(). +** data pointer which was the fifth parameter to tdsqlite3_create_function_v2(). ** ** ^It is permitted to register multiple implementations of the same ** functions with the same name but with either differing numbers of @@ -5040,47 +5040,47 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** close the database connection nor finalize or reset the prepared ** statement in which the function is running. */ -SQLITE_API int sqlite3_create_function( - sqlite3 *db, +SQLITE_API int tdsqlite3_create_function( + tdsqlite3 *db, const char *zFunctionName, int nArg, int eTextRep, void *pApp, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*) + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*) ); -SQLITE_API int sqlite3_create_function16( - sqlite3 *db, +SQLITE_API int tdsqlite3_create_function16( + tdsqlite3 *db, const void *zFunctionName, int nArg, int eTextRep, void *pApp, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*) + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*) ); -SQLITE_API int sqlite3_create_function_v2( - sqlite3 *db, +SQLITE_API int tdsqlite3_create_function_v2( + tdsqlite3 *db, const char *zFunctionName, int nArg, int eTextRep, void *pApp, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*), void(*xDestroy)(void*) ); -SQLITE_API int sqlite3_create_window_function( - sqlite3 *db, +SQLITE_API int tdsqlite3_create_window_function( + tdsqlite3 *db, const char *zFunctionName, int nArg, int eTextRep, void *pApp, - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), - void (*xValue)(sqlite3_context*), - void (*xInverse)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*), + void (*xValue)(tdsqlite3_context*), + void (*xInverse)(tdsqlite3_context*,int,tdsqlite3_value**), void(*xDestroy)(void*) ); @@ -5095,15 +5095,15 @@ SQLITE_API int sqlite3_create_window_function( #define SQLITE_UTF16BE 3 /* IMP: R-51971-34154 */ #define SQLITE_UTF16 4 /* Use native byte order */ #define SQLITE_ANY 5 /* Deprecated */ -#define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ +#define SQLITE_UTF16_ALIGNED 8 /* tdsqlite3_create_collation only */ /* ** CAPI3REF: Function Flags ** ** These constants may be ORed together with the ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument -** to [sqlite3_create_function()], [sqlite3_create_function16()], or -** [sqlite3_create_function_v2()]. +** to [tdsqlite3_create_function()], [tdsqlite3_create_function16()], or +** [tdsqlite3_create_function_v2()]. ** **
** [[SQLITE_DETERMINISTIC]]
SQLITE_DETERMINISTIC
@@ -5153,12 +5153,12 @@ SQLITE_API int sqlite3_create_window_function( ** ** [[SQLITE_SUBTYPE]]
SQLITE_SUBTYPE
** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call -** [sqlite3_value_subtype()] to inspect the sub-types of its arguments. +** [tdsqlite3_value_subtype()] to inspect the sub-types of its arguments. ** Specifying this flag makes no difference for scalar or aggregate user ** functions. However, if it is not specified for a user-defined window ** function, then any sub-types belonging to arguments passed to the window ** function may be discarded before the window function is called (i.e. -** sqlite3_value_subtype() will always return 0). +** tdsqlite3_value_subtype() will always return 0). **
**
*/ @@ -5178,87 +5178,87 @@ SQLITE_API int sqlite3_create_window_function( ** these functions, we will not explain what they do. */ #ifndef SQLITE_OMIT_DEPRECATED -SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*); -SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*); -SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*); -SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); -SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); -SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int), - void*,sqlite3_int64); +SQLITE_API SQLITE_DEPRECATED int tdsqlite3_aggregate_count(tdsqlite3_context*); +SQLITE_API SQLITE_DEPRECATED int tdsqlite3_expired(tdsqlite3_stmt*); +SQLITE_API SQLITE_DEPRECATED int tdsqlite3_transfer_bindings(tdsqlite3_stmt*, tdsqlite3_stmt*); +SQLITE_API SQLITE_DEPRECATED int tdsqlite3_global_recover(void); +SQLITE_API SQLITE_DEPRECATED void tdsqlite3_thread_cleanup(void); +SQLITE_API SQLITE_DEPRECATED int tdsqlite3_memory_alarm(void(*)(void*,tdsqlite3_int64,int), + void*,tdsqlite3_int64); #endif /* ** CAPI3REF: Obtaining SQL Values -** METHOD: sqlite3_value +** METHOD: tdsqlite3_value ** ** Summary: **
-**
sqlite3_value_blobBLOB value -**
sqlite3_value_doubleREAL value -**
sqlite3_value_int32-bit INTEGER value -**
sqlite3_value_int6464-bit INTEGER value -**
sqlite3_value_pointerPointer value -**
sqlite3_value_textUTF-8 TEXT value -**
sqlite3_value_text16UTF-16 TEXT value in +**
tdsqlite3_value_blobBLOB value +**
tdsqlite3_value_doubleREAL value +**
tdsqlite3_value_int32-bit INTEGER value +**
tdsqlite3_value_int6464-bit INTEGER value +**
tdsqlite3_value_pointerPointer value +**
tdsqlite3_value_textUTF-8 TEXT value +**
tdsqlite3_value_text16UTF-16 TEXT value in ** the native byteorder -**
sqlite3_value_text16beUTF-16be TEXT value -**
sqlite3_value_text16leUTF-16le TEXT value +**
tdsqlite3_value_text16beUTF-16be TEXT value +**
tdsqlite3_value_text16leUTF-16le TEXT value **
    -**
sqlite3_value_bytesSize of a BLOB +**
tdsqlite3_value_bytesSize of a BLOB ** or a UTF-8 TEXT in bytes -**
sqlite3_value_bytes16   +**
tdsqlite3_value_bytes16   ** →  Size of UTF-16 ** TEXT in bytes -**
sqlite3_value_typeDefault +**
tdsqlite3_value_typeDefault ** datatype of the value -**
sqlite3_value_numeric_type   +**
tdsqlite3_value_numeric_type   ** →  Best numeric datatype of the value -**
sqlite3_value_nochange   +**
tdsqlite3_value_nochange   ** →  True if the column is unchanged in an UPDATE ** against a virtual table. -**
sqlite3_value_frombind   +**
tdsqlite3_value_frombind   ** →  True if value originated from a [bound parameter] **
** ** Details: ** ** These routines extract type, size, and content information from -** [protected sqlite3_value] objects. Protected sqlite3_value objects +** [protected tdsqlite3_value] objects. Protected tdsqlite3_value objects ** are used to pass parameter information into the functions that ** implement [application-defined SQL functions] and [virtual tables]. ** -** These routines work only with [protected sqlite3_value] objects. -** Any attempt to use these routines on an [unprotected sqlite3_value] +** These routines work only with [protected tdsqlite3_value] objects. +** Any attempt to use these routines on an [unprotected tdsqlite3_value] ** is not threadsafe. ** ** ^These routines work just like the corresponding [column access functions] -** except that these routines take a single [protected sqlite3_value] object -** pointer instead of a [sqlite3_stmt*] pointer and an integer column number. +** except that these routines take a single [protected tdsqlite3_value] object +** pointer instead of a [tdsqlite3_stmt*] pointer and an integer column number. ** -** ^The sqlite3_value_text16() interface extracts a UTF-16 string +** ^The tdsqlite3_value_text16() interface extracts a UTF-16 string ** in the native byte-order of the host machine. ^The -** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces +** tdsqlite3_value_text16be() and tdsqlite3_value_text16le() interfaces ** extract UTF-16 strings as big-endian and little-endian respectively. ** -** ^If [sqlite3_value] object V was initialized -** using [sqlite3_bind_pointer(S,I,P,X,D)] or [sqlite3_result_pointer(C,P,X,D)] +** ^If [tdsqlite3_value] object V was initialized +** using [tdsqlite3_bind_pointer(S,I,P,X,D)] or [tdsqlite3_result_pointer(C,P,X,D)] ** and if X and Y are strings that compare equal according to strcmp(X,Y), -** then sqlite3_value_pointer(V,Y) will return the pointer P. ^Otherwise, -** sqlite3_value_pointer(V,Y) returns a NULL. The sqlite3_bind_pointer() +** then tdsqlite3_value_pointer(V,Y) will return the pointer P. ^Otherwise, +** tdsqlite3_value_pointer(V,Y) returns a NULL. The tdsqlite3_bind_pointer() ** routine is part of the [pointer passing interface] added for SQLite 3.20.0. ** -** ^(The sqlite3_value_type(V) interface returns the +** ^(The tdsqlite3_value_type(V) interface returns the ** [SQLITE_INTEGER | datatype code] for the initial datatype of the -** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER], +** [tdsqlite3_value] object V. The returned value is one of [SQLITE_INTEGER], ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^ -** Other interfaces might change the datatype for an sqlite3_value object. +** Other interfaces might change the datatype for an tdsqlite3_value object. ** For example, if the datatype is initially SQLITE_INTEGER and -** sqlite3_value_text(V) is called to extract a text value for that -** integer, then subsequent calls to sqlite3_value_type(V) might return +** tdsqlite3_value_text(V) is called to extract a text value for that +** integer, then subsequent calls to tdsqlite3_value_type(V) might return ** SQLITE_TEXT. Whether or not a persistent internal datatype conversion ** occurs is undefined and may change from one release of SQLite to the next. ** -** ^(The sqlite3_value_numeric_type() interface attempts to apply +** ^(The tdsqlite3_value_numeric_type() interface attempts to apply ** numeric affinity to the value. This means that an attempt is ** made to convert the value to an integer or floating point. If ** such a conversion is possible without loss of information (in other @@ -5267,31 +5267,31 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6 ** The [SQLITE_INTEGER | datatype] after conversion is returned.)^ ** ** ^Within the [xUpdate] method of a [virtual table], the -** sqlite3_value_nochange(X) interface returns true if and only if +** tdsqlite3_value_nochange(X) interface returns true if and only if ** the column corresponding to X is unchanged by the UPDATE operation ** that the xUpdate method call was invoked to implement and if ** and the prior [xColumn] method call that was invoked to extracted ** the value for that column returned without setting a result (probably -** because it queried [sqlite3_vtab_nochange()] and found that the column +** because it queried [tdsqlite3_vtab_nochange()] and found that the column ** was unchanging). ^Within an [xUpdate] method, any value for which -** sqlite3_value_nochange(X) is true will in all other respects appear -** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other +** tdsqlite3_value_nochange(X) is true will in all other respects appear +** to be a NULL value. If tdsqlite3_value_nochange(X) is invoked anywhere other ** than within an [xUpdate] method call for an UPDATE statement, then ** the return value is arbitrary and meaningless. ** -** ^The sqlite3_value_frombind(X) interface returns non-zero if the -** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()] +** ^The tdsqlite3_value_frombind(X) interface returns non-zero if the +** value X originated from one of the [tdsqlite3_bind_int|tdsqlite3_bind()] ** interfaces. ^If X comes from an SQL literal value, or a table column, -** or an expression, then sqlite3_value_frombind(X) returns zero. +** or an expression, then tdsqlite3_value_frombind(X) returns zero. ** ** Please pay particular attention to the fact that the pointer returned -** from [sqlite3_value_blob()], [sqlite3_value_text()], or -** [sqlite3_value_text16()] can be invalidated by a subsequent call to -** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], -** or [sqlite3_value_text16()]. +** from [tdsqlite3_value_blob()], [tdsqlite3_value_text()], or +** [tdsqlite3_value_text16()] can be invalidated by a subsequent call to +** [tdsqlite3_value_bytes()], [tdsqlite3_value_bytes16()], [tdsqlite3_value_text()], +** or [tdsqlite3_value_text16()]. ** ** These routines must be called from the same thread as -** the SQL function that supplied the [sqlite3_value*] parameters. +** the SQL function that supplied the [tdsqlite3_value*] parameters. ** ** As long as the input parameter is correct, these routines can only ** fail if an out-of-memory error occurs during a format conversion. @@ -5299,142 +5299,142 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6 ** errors: ** **
    -**
  • sqlite3_value_blob() -**
  • sqlite3_value_text() -**
  • sqlite3_value_text16() -**
  • sqlite3_value_text16le() -**
  • sqlite3_value_text16be() -**
  • sqlite3_value_bytes() -**
  • sqlite3_value_bytes16() +**
  • tdsqlite3_value_blob() +**
  • tdsqlite3_value_text() +**
  • tdsqlite3_value_text16() +**
  • tdsqlite3_value_text16le() +**
  • tdsqlite3_value_text16be() +**
  • tdsqlite3_value_bytes() +**
  • tdsqlite3_value_bytes16() **
** ** If an out-of-memory error occurs, then the return value from these ** routines is the same as if the column had contained an SQL NULL value. ** Valid SQL NULL returns can be distinguished from out-of-memory errors -** by invoking the [sqlite3_errcode()] immediately after the suspect +** by invoking the [tdsqlite3_errcode()] immediately after the suspect ** return value is obtained and before any ** other SQLite interface is called on the same [database connection]. */ -SQLITE_API const void *sqlite3_value_blob(sqlite3_value*); -SQLITE_API double sqlite3_value_double(sqlite3_value*); -SQLITE_API int sqlite3_value_int(sqlite3_value*); -SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*); -SQLITE_API void *sqlite3_value_pointer(sqlite3_value*, const char*); -SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*); -SQLITE_API const void *sqlite3_value_text16(sqlite3_value*); -SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*); -SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); -SQLITE_API int sqlite3_value_bytes(sqlite3_value*); -SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); -SQLITE_API int sqlite3_value_type(sqlite3_value*); -SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); -SQLITE_API int sqlite3_value_nochange(sqlite3_value*); -SQLITE_API int sqlite3_value_frombind(sqlite3_value*); +SQLITE_API const void *tdsqlite3_value_blob(tdsqlite3_value*); +SQLITE_API double tdsqlite3_value_double(tdsqlite3_value*); +SQLITE_API int tdsqlite3_value_int(tdsqlite3_value*); +SQLITE_API tdsqlite3_int64 tdsqlite3_value_int64(tdsqlite3_value*); +SQLITE_API void *tdsqlite3_value_pointer(tdsqlite3_value*, const char*); +SQLITE_API const unsigned char *tdsqlite3_value_text(tdsqlite3_value*); +SQLITE_API const void *tdsqlite3_value_text16(tdsqlite3_value*); +SQLITE_API const void *tdsqlite3_value_text16le(tdsqlite3_value*); +SQLITE_API const void *tdsqlite3_value_text16be(tdsqlite3_value*); +SQLITE_API int tdsqlite3_value_bytes(tdsqlite3_value*); +SQLITE_API int tdsqlite3_value_bytes16(tdsqlite3_value*); +SQLITE_API int tdsqlite3_value_type(tdsqlite3_value*); +SQLITE_API int tdsqlite3_value_numeric_type(tdsqlite3_value*); +SQLITE_API int tdsqlite3_value_nochange(tdsqlite3_value*); +SQLITE_API int tdsqlite3_value_frombind(tdsqlite3_value*); /* ** CAPI3REF: Finding The Subtype Of SQL Values -** METHOD: sqlite3_value +** METHOD: tdsqlite3_value ** -** The sqlite3_value_subtype(V) function returns the subtype for +** The tdsqlite3_value_subtype(V) function returns the subtype for ** an [application-defined SQL function] argument V. The subtype ** information can be used to pass a limited amount of context from -** one SQL function to another. Use the [sqlite3_result_subtype()] +** one SQL function to another. Use the [tdsqlite3_result_subtype()] ** routine to set the subtype for the return value of an SQL function. */ -SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*); +SQLITE_API unsigned int tdsqlite3_value_subtype(tdsqlite3_value*); /* ** CAPI3REF: Copy And Free SQL Values -** METHOD: sqlite3_value +** METHOD: tdsqlite3_value ** -** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value] -** object D and returns a pointer to that copy. ^The [sqlite3_value] returned -** is a [protected sqlite3_value] object even if the input is not. -** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a +** ^The tdsqlite3_value_dup(V) interface makes a copy of the [tdsqlite3_value] +** object D and returns a pointer to that copy. ^The [tdsqlite3_value] returned +** is a [protected tdsqlite3_value] object even if the input is not. +** ^The tdsqlite3_value_dup(V) interface returns NULL if V is NULL or if a ** memory allocation fails. ** -** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object -** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer -** then sqlite3_value_free(V) is a harmless no-op. +** ^The tdsqlite3_value_free(V) interface frees an [tdsqlite3_value] object +** previously obtained from [tdsqlite3_value_dup()]. ^If V is a NULL pointer +** then tdsqlite3_value_free(V) is a harmless no-op. */ -SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value*); -SQLITE_API void sqlite3_value_free(sqlite3_value*); +SQLITE_API tdsqlite3_value *tdsqlite3_value_dup(const tdsqlite3_value*); +SQLITE_API void tdsqlite3_value_free(tdsqlite3_value*); /* ** CAPI3REF: Obtain Aggregate Function Context -** METHOD: sqlite3_context +** METHOD: tdsqlite3_context ** ** Implementations of aggregate SQL functions use this ** routine to allocate memory for storing their state. ** -** ^The first time the sqlite3_aggregate_context(C,N) routine is called +** ^The first time the tdsqlite3_aggregate_context(C,N) routine is called ** for a particular aggregate function, SQLite allocates ** N bytes of memory, zeroes out that memory, and returns a pointer ** to the new memory. ^On second and subsequent calls to -** sqlite3_aggregate_context() for the same aggregate function instance, +** tdsqlite3_aggregate_context() for the same aggregate function instance, ** the same buffer is returned. Sqlite3_aggregate_context() is normally ** called once for each invocation of the xStep callback and then one ** last time when the xFinal callback is invoked. ^(When no rows match ** an aggregate query, the xStep() callback of the aggregate function ** implementation is never called and xFinal() is called exactly once. -** In those cases, sqlite3_aggregate_context() might be called for the +** In those cases, tdsqlite3_aggregate_context() might be called for the ** first time from within xFinal().)^ ** -** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer +** ^The tdsqlite3_aggregate_context(C,N) routine returns a NULL pointer ** when first called if N is less than or equal to zero or if a memory ** allocate error occurs. ** -** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is +** ^(The amount of space allocated by tdsqlite3_aggregate_context(C,N) is ** determined by the N parameter on first successful call. Changing the -** value of N in any subsequents call to sqlite3_aggregate_context() within +** value of N in any subsequents call to tdsqlite3_aggregate_context() within ** the same aggregate function instance will not resize the memory ** allocation.)^ Within the xFinal callback, it is customary to set -** N=0 in calls to sqlite3_aggregate_context(C,N) so that no +** N=0 in calls to tdsqlite3_aggregate_context(C,N) so that no ** pointless memory allocations occur. ** ** ^SQLite automatically frees the memory allocated by -** sqlite3_aggregate_context() when the aggregate query concludes. +** tdsqlite3_aggregate_context() when the aggregate query concludes. ** ** The first parameter must be a copy of the -** [sqlite3_context | SQL function context] that is the first parameter +** [tdsqlite3_context | SQL function context] that is the first parameter ** to the xStep or xFinal callback routine that implements the aggregate ** function. ** ** This routine must be called from the same thread in which ** the aggregate SQL function is running. */ -SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes); +SQLITE_API void *tdsqlite3_aggregate_context(tdsqlite3_context*, int nBytes); /* ** CAPI3REF: User Data For Functions -** METHOD: sqlite3_context +** METHOD: tdsqlite3_context ** -** ^The sqlite3_user_data() interface returns a copy of +** ^The tdsqlite3_user_data() interface returns a copy of ** the pointer that was the pUserData parameter (the 5th parameter) -** of the [sqlite3_create_function()] -** and [sqlite3_create_function16()] routines that originally +** of the [tdsqlite3_create_function()] +** and [tdsqlite3_create_function16()] routines that originally ** registered the application defined function. ** ** This routine must be called from the same thread in which ** the application-defined function is running. */ -SQLITE_API void *sqlite3_user_data(sqlite3_context*); +SQLITE_API void *tdsqlite3_user_data(tdsqlite3_context*); /* ** CAPI3REF: Database Connection For Functions -** METHOD: sqlite3_context +** METHOD: tdsqlite3_context ** -** ^The sqlite3_context_db_handle() interface returns a copy of +** ^The tdsqlite3_context_db_handle() interface returns a copy of ** the pointer to the [database connection] (the 1st parameter) -** of the [sqlite3_create_function()] -** and [sqlite3_create_function16()] routines that originally +** of the [tdsqlite3_create_function()] +** and [tdsqlite3_create_function16()] routines that originally ** registered the application defined function. */ -SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); +SQLITE_API tdsqlite3 *tdsqlite3_context_db_handle(tdsqlite3_context*); /* ** CAPI3REF: Function Auxiliary Data -** METHOD: sqlite3_context +** METHOD: tdsqlite3_context ** ** These functions may be used by (non-aggregate) SQL functions to ** associate metadata with argument values. If the same value is passed to @@ -5447,36 +5447,36 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); ** the compiled regular expression can be reused on multiple ** invocations of the same function. ** -** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the metadata -** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument +** ^The tdsqlite3_get_auxdata(C,N) interface returns a pointer to the metadata +** associated by the tdsqlite3_set_auxdata(C,N,P,X) function with the Nth argument ** value to the application-defined function. ^N is zero for the left-most ** function argument. ^If there is no metadata -** associated with the function argument, the sqlite3_get_auxdata(C,N) interface +** associated with the function argument, the tdsqlite3_get_auxdata(C,N) interface ** returns a NULL pointer. ** -** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th +** ^The tdsqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th ** argument of the application-defined function. ^Subsequent -** calls to sqlite3_get_auxdata(C,N) return P from the most recent -** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or +** calls to tdsqlite3_get_auxdata(C,N) return P from the most recent +** tdsqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or ** NULL if the metadata has been discarded. -** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, +** ^After each call to tdsqlite3_set_auxdata(C,N,P,X) where X is not NULL, ** SQLite will invoke the destructor function X with parameter P exactly ** once, when the metadata is discarded. ** SQLite is free to discard the metadata at any time, including:
    **
  • ^(when the corresponding function parameter changes)^, or -**
  • ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the +**
  • ^(when [tdsqlite3_reset()] or [tdsqlite3_finalize()] is called for the ** SQL statement)^, or -**
  • ^(when sqlite3_set_auxdata() is invoked again on the same +**
  • ^(when tdsqlite3_set_auxdata() is invoked again on the same ** parameter)^, or -**
  • ^(during the original sqlite3_set_auxdata() call when a memory +**
  • ^(during the original tdsqlite3_set_auxdata() call when a memory ** allocation error occurs.)^
** ** Note the last bullet in particular. The destructor X in -** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the -** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() +** tdsqlite3_set_auxdata(C,N,P,X) might be called immediately, before the +** tdsqlite3_set_auxdata() interface even returns. Hence tdsqlite3_set_auxdata() ** should be called near the end of the function implementation and the ** function implementation should not make any use of P after -** sqlite3_set_auxdata() has been called. +** tdsqlite3_set_auxdata() has been called. ** ** ^(In practice, metadata is preserved between function calls for ** function parameters that are compile-time constants, including literal @@ -5489,15 +5489,15 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); ** These routines must be called from the same thread in which ** the SQL function is running. */ -SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N); -SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); +SQLITE_API void *tdsqlite3_get_auxdata(tdsqlite3_context*, int N); +SQLITE_API void tdsqlite3_set_auxdata(tdsqlite3_context*, int N, void*, void (*)(void*)); /* ** CAPI3REF: Constants Defining Special Destructor Behavior ** ** These are special values for the destructor that is passed in as the -** final argument to routines like [sqlite3_result_blob()]. ^If the destructor +** final argument to routines like [tdsqlite3_result_blob()]. ^If the destructor ** argument is SQLITE_STATIC, it means that the content pointer is constant ** and will never change. It does not need to be destroyed. ^The ** SQLITE_TRANSIENT value means that the content will likely change in @@ -5507,89 +5507,89 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi ** The typedef is necessary to work around problems in certain ** C++ compilers. */ -typedef void (*sqlite3_destructor_type)(void*); -#define SQLITE_STATIC ((sqlite3_destructor_type)0) -#define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1) +typedef void (*tdsqlite3_destructor_type)(void*); +#define SQLITE_STATIC ((tdsqlite3_destructor_type)0) +#define SQLITE_TRANSIENT ((tdsqlite3_destructor_type)-1) /* ** CAPI3REF: Setting The Result Of An SQL Function -** METHOD: sqlite3_context +** METHOD: tdsqlite3_context ** ** These routines are used by the xFunc or xFinal callbacks that ** implement SQL functions and aggregates. See -** [sqlite3_create_function()] and [sqlite3_create_function16()] +** [tdsqlite3_create_function()] and [tdsqlite3_create_function16()] ** for additional information. ** ** These functions work very much like the [parameter binding] family of ** functions used to bind values to host parameters in prepared statements. ** Refer to the [SQL parameter] documentation for additional information. ** -** ^The sqlite3_result_blob() interface sets the result from +** ^The tdsqlite3_result_blob() interface sets the result from ** an application-defined function to be the BLOB whose content is pointed ** to by the second parameter and which is N bytes long where N is the ** third parameter. ** -** ^The sqlite3_result_zeroblob(C,N) and sqlite3_result_zeroblob64(C,N) +** ^The tdsqlite3_result_zeroblob(C,N) and tdsqlite3_result_zeroblob64(C,N) ** interfaces set the result of the application-defined function to be ** a BLOB containing all zero bytes and N bytes in size. ** -** ^The sqlite3_result_double() interface sets the result from +** ^The tdsqlite3_result_double() interface sets the result from ** an application-defined function to be a floating point value specified ** by its 2nd argument. ** -** ^The sqlite3_result_error() and sqlite3_result_error16() functions +** ^The tdsqlite3_result_error() and tdsqlite3_result_error16() functions ** cause the implemented SQL function to throw an exception. ** ^SQLite uses the string pointed to by the -** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16() +** 2nd parameter of tdsqlite3_result_error() or tdsqlite3_result_error16() ** as the text of an error message. ^SQLite interprets the error -** message string from sqlite3_result_error() as UTF-8. ^SQLite -** interprets the string from sqlite3_result_error16() as UTF-16 in native -** byte order. ^If the third parameter to sqlite3_result_error() -** or sqlite3_result_error16() is negative then SQLite takes as the error +** message string from tdsqlite3_result_error() as UTF-8. ^SQLite +** interprets the string from tdsqlite3_result_error16() as UTF-16 in native +** byte order. ^If the third parameter to tdsqlite3_result_error() +** or tdsqlite3_result_error16() is negative then SQLite takes as the error ** message all text up through the first zero character. -** ^If the third parameter to sqlite3_result_error() or -** sqlite3_result_error16() is non-negative then SQLite takes that many +** ^If the third parameter to tdsqlite3_result_error() or +** tdsqlite3_result_error16() is non-negative then SQLite takes that many ** bytes (not characters) from the 2nd parameter as the error message. -** ^The sqlite3_result_error() and sqlite3_result_error16() +** ^The tdsqlite3_result_error() and tdsqlite3_result_error16() ** routines make a private copy of the error message text before ** they return. Hence, the calling function can deallocate or ** modify the text after they return without harm. -** ^The sqlite3_result_error_code() function changes the error code +** ^The tdsqlite3_result_error_code() function changes the error code ** returned by SQLite as a result of an error in a function. ^By default, -** the error code is SQLITE_ERROR. ^A subsequent call to sqlite3_result_error() -** or sqlite3_result_error16() resets the error code to SQLITE_ERROR. +** the error code is SQLITE_ERROR. ^A subsequent call to tdsqlite3_result_error() +** or tdsqlite3_result_error16() resets the error code to SQLITE_ERROR. ** -** ^The sqlite3_result_error_toobig() interface causes SQLite to throw an +** ^The tdsqlite3_result_error_toobig() interface causes SQLite to throw an ** error indicating that a string or BLOB is too long to represent. ** -** ^The sqlite3_result_error_nomem() interface causes SQLite to throw an +** ^The tdsqlite3_result_error_nomem() interface causes SQLite to throw an ** error indicating that a memory allocation failed. ** -** ^The sqlite3_result_int() interface sets the return value +** ^The tdsqlite3_result_int() interface sets the return value ** of the application-defined function to be the 32-bit signed integer ** value given in the 2nd argument. -** ^The sqlite3_result_int64() interface sets the return value +** ^The tdsqlite3_result_int64() interface sets the return value ** of the application-defined function to be the 64-bit signed integer ** value given in the 2nd argument. ** -** ^The sqlite3_result_null() interface sets the return value +** ^The tdsqlite3_result_null() interface sets the return value ** of the application-defined function to be NULL. ** -** ^The sqlite3_result_text(), sqlite3_result_text16(), -** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces +** ^The tdsqlite3_result_text(), tdsqlite3_result_text16(), +** tdsqlite3_result_text16le(), and tdsqlite3_result_text16be() interfaces ** set the return value of the application-defined function to be ** a text string which is represented as UTF-8, UTF-16 native byte order, ** UTF-16 little endian, or UTF-16 big endian, respectively. -** ^The sqlite3_result_text64() interface sets the return value of an +** ^The tdsqlite3_result_text64() interface sets the return value of an ** application-defined function to be a text string in an encoding ** specified by the fifth (and last) parameter, which must be one ** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]. ** ^SQLite takes the text result from the application from -** the 2nd parameter of the sqlite3_result_text* interfaces. -** ^If the 3rd parameter to the sqlite3_result_text* interfaces +** the 2nd parameter of the tdsqlite3_result_text* interfaces. +** ^If the 3rd parameter to the tdsqlite3_result_text* interfaces ** is negative, then SQLite takes result text from the 2nd parameter ** through the first zero character. -** ^If the 3rd parameter to the sqlite3_result_text* interfaces +** ^If the 3rd parameter to the tdsqlite3_result_text* interfaces ** is non-negative, then as many bytes (not characters) of the text ** pointed to by the 2nd parameter are taken as the application-defined ** function result. If the 3rd parameter is non-negative, then it @@ -5598,94 +5598,94 @@ typedef void (*sqlite3_destructor_type)(void*); ** in the string at a byte offset that is less than the value of the 3rd ** parameter, then the resulting string will contain embedded NULs and the ** result of expressions operating on strings with embedded NULs is undefined. -** ^If the 4th parameter to the sqlite3_result_text* interfaces -** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that +** ^If the 4th parameter to the tdsqlite3_result_text* interfaces +** or tdsqlite3_result_blob is a non-NULL pointer, then SQLite calls that ** function as the destructor on the text or BLOB result when it has ** finished using that result. -** ^If the 4th parameter to the sqlite3_result_text* interfaces or to -** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite +** ^If the 4th parameter to the tdsqlite3_result_text* interfaces or to +** tdsqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite ** assumes that the text or BLOB result is in constant space and does not ** copy the content of the parameter nor call a destructor on the content ** when it has finished using that result. -** ^If the 4th parameter to the sqlite3_result_text* interfaces -** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT +** ^If the 4th parameter to the tdsqlite3_result_text* interfaces +** or tdsqlite3_result_blob is the special constant SQLITE_TRANSIENT ** then SQLite makes a copy of the result into space obtained -** from [sqlite3_malloc()] before it returns. +** from [tdsqlite3_malloc()] before it returns. ** -** ^The sqlite3_result_value() interface sets the result of +** ^The tdsqlite3_result_value() interface sets the result of ** the application-defined function to be a copy of the -** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The -** sqlite3_result_value() interface makes a copy of the [sqlite3_value] -** so that the [sqlite3_value] specified in the parameter may change or -** be deallocated after sqlite3_result_value() returns without harm. -** ^A [protected sqlite3_value] object may always be used where an -** [unprotected sqlite3_value] object is required, so either -** kind of [sqlite3_value] object can be used with this interface. +** [unprotected tdsqlite3_value] object specified by the 2nd parameter. ^The +** tdsqlite3_result_value() interface makes a copy of the [tdsqlite3_value] +** so that the [tdsqlite3_value] specified in the parameter may change or +** be deallocated after tdsqlite3_result_value() returns without harm. +** ^A [protected tdsqlite3_value] object may always be used where an +** [unprotected tdsqlite3_value] object is required, so either +** kind of [tdsqlite3_value] object can be used with this interface. ** -** ^The sqlite3_result_pointer(C,P,T,D) interface sets the result to an -** SQL NULL value, just like [sqlite3_result_null(C)], except that it +** ^The tdsqlite3_result_pointer(C,P,T,D) interface sets the result to an +** SQL NULL value, just like [tdsqlite3_result_null(C)], except that it ** also associates the host-language pointer P or type T with that ** NULL value such that the pointer can be retrieved within an -** [application-defined SQL function] using [sqlite3_value_pointer()]. +** [application-defined SQL function] using [tdsqlite3_value_pointer()]. ** ^If the D parameter is not NULL, then it is a pointer to a destructor ** for the P parameter. ^SQLite invokes D with P as its only argument ** when SQLite is finished with P. The T parameter should be a static -** string and preferably a string literal. The sqlite3_result_pointer() +** string and preferably a string literal. The tdsqlite3_result_pointer() ** routine is part of the [pointer passing interface] added for SQLite 3.20.0. ** ** If these routines are called from within the different thread ** than the one containing the application-defined function that received -** the [sqlite3_context] pointer, the results are undefined. +** the [tdsqlite3_context] pointer, the results are undefined. */ -SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*)); -SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*, - sqlite3_uint64,void(*)(void*)); -SQLITE_API void sqlite3_result_double(sqlite3_context*, double); -SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int); -SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int); -SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*); -SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*); -SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int); -SQLITE_API void sqlite3_result_int(sqlite3_context*, int); -SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64); -SQLITE_API void sqlite3_result_null(sqlite3_context*); -SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*)); -SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64, +SQLITE_API void tdsqlite3_result_blob(tdsqlite3_context*, const void*, int, void(*)(void*)); +SQLITE_API void tdsqlite3_result_blob64(tdsqlite3_context*,const void*, + tdsqlite3_uint64,void(*)(void*)); +SQLITE_API void tdsqlite3_result_double(tdsqlite3_context*, double); +SQLITE_API void tdsqlite3_result_error(tdsqlite3_context*, const char*, int); +SQLITE_API void tdsqlite3_result_error16(tdsqlite3_context*, const void*, int); +SQLITE_API void tdsqlite3_result_error_toobig(tdsqlite3_context*); +SQLITE_API void tdsqlite3_result_error_nomem(tdsqlite3_context*); +SQLITE_API void tdsqlite3_result_error_code(tdsqlite3_context*, int); +SQLITE_API void tdsqlite3_result_int(tdsqlite3_context*, int); +SQLITE_API void tdsqlite3_result_int64(tdsqlite3_context*, tdsqlite3_int64); +SQLITE_API void tdsqlite3_result_null(tdsqlite3_context*); +SQLITE_API void tdsqlite3_result_text(tdsqlite3_context*, const char*, int, void(*)(void*)); +SQLITE_API void tdsqlite3_result_text64(tdsqlite3_context*, const char*,tdsqlite3_uint64, void(*)(void*), unsigned char encoding); -SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*)); -SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*)); -SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*)); -SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*); -SQLITE_API void sqlite3_result_pointer(sqlite3_context*, void*,const char*,void(*)(void*)); -SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); -SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n); +SQLITE_API void tdsqlite3_result_text16(tdsqlite3_context*, const void*, int, void(*)(void*)); +SQLITE_API void tdsqlite3_result_text16le(tdsqlite3_context*, const void*, int,void(*)(void*)); +SQLITE_API void tdsqlite3_result_text16be(tdsqlite3_context*, const void*, int,void(*)(void*)); +SQLITE_API void tdsqlite3_result_value(tdsqlite3_context*, tdsqlite3_value*); +SQLITE_API void tdsqlite3_result_pointer(tdsqlite3_context*, void*,const char*,void(*)(void*)); +SQLITE_API void tdsqlite3_result_zeroblob(tdsqlite3_context*, int n); +SQLITE_API int tdsqlite3_result_zeroblob64(tdsqlite3_context*, tdsqlite3_uint64 n); /* ** CAPI3REF: Setting The Subtype Of An SQL Function -** METHOD: sqlite3_context +** METHOD: tdsqlite3_context ** -** The sqlite3_result_subtype(C,T) function causes the subtype of +** The tdsqlite3_result_subtype(C,T) function causes the subtype of ** the result from the [application-defined SQL function] with -** [sqlite3_context] C to be the value T. Only the lower 8 bits +** [tdsqlite3_context] C to be the value T. Only the lower 8 bits ** of the subtype T are preserved in current versions of SQLite; ** higher order bits are discarded. ** The number of subtype bytes preserved by SQLite might increase ** in future releases of SQLite. */ -SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int); +SQLITE_API void tdsqlite3_result_subtype(tdsqlite3_context*,unsigned int); /* ** CAPI3REF: Define New Collating Sequences -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^These functions add, remove, or modify a [collation] associated ** with the [database connection] specified as the first argument. ** ** ^The name of the collation is a UTF-8 string -** for sqlite3_create_collation() and sqlite3_create_collation_v2() -** and a UTF-16 string in native byte order for sqlite3_create_collation16(). -** ^Collation names that compare equal according to [sqlite3_strnicmp()] are +** for tdsqlite3_create_collation() and tdsqlite3_create_collation_v2() +** and a UTF-16 string in native byte order for tdsqlite3_create_collation16(). +** ^Collation names that compare equal according to [tdsqlite3_strnicmp()] are ** considered to be the same name. ** ** ^(The third argument (eTextRep) must be one of the constants: @@ -5738,41 +5738,41 @@ SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int); ** collating function is registered and used, then the behavior of SQLite ** is undefined. ** -** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation() +** ^The tdsqlite3_create_collation_v2() works like tdsqlite3_create_collation() ** with the addition that the xDestroy callback is invoked on pArg when ** the collating function is deleted. ** ^Collating functions are deleted when they are overridden by later ** calls to the collation creation functions or when the -** [database connection] is closed using [sqlite3_close()]. +** [database connection] is closed using [tdsqlite3_close()]. ** ** ^The xDestroy callback is not called if the -** sqlite3_create_collation_v2() function fails. Applications that invoke -** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should +** tdsqlite3_create_collation_v2() function fails. Applications that invoke +** tdsqlite3_create_collation_v2() with a non-NULL xDestroy argument should ** check the return code and dispose of the application data pointer ** themselves rather than expecting SQLite to deal with it for them. ** This is different from every other SQLite interface. The inconsistency ** is unfortunate but cannot be changed without breaking backwards ** compatibility. ** -** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()]. +** See also: [tdsqlite3_collation_needed()] and [tdsqlite3_collation_needed16()]. */ -SQLITE_API int sqlite3_create_collation( - sqlite3*, +SQLITE_API int tdsqlite3_create_collation( + tdsqlite3*, const char *zName, int eTextRep, void *pArg, int(*xCompare)(void*,int,const void*,int,const void*) ); -SQLITE_API int sqlite3_create_collation_v2( - sqlite3*, +SQLITE_API int tdsqlite3_create_collation_v2( + tdsqlite3*, const char *zName, int eTextRep, void *pArg, int(*xCompare)(void*,int,const void*,int,const void*), void(*xDestroy)(void*) ); -SQLITE_API int sqlite3_create_collation16( - sqlite3*, +SQLITE_API int tdsqlite3_create_collation16( + tdsqlite3*, const void *zName, int eTextRep, void *pArg, @@ -5781,56 +5781,56 @@ SQLITE_API int sqlite3_create_collation16( /* ** CAPI3REF: Collation Needed Callbacks -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^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 sqlite3_collation_needed() API, +** ^If the function is registered using the tdsqlite3_collation_needed() API, ** then it is passed the names of undefined collation sequences as strings -** encoded in UTF-8. ^If sqlite3_collation_needed16() is used, +** encoded in UTF-8. ^If tdsqlite3_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 sqlite3_collation_needed() or -** sqlite3_collation_needed16(). The second argument is the database +** of the second argument to tdsqlite3_collation_needed() or +** tdsqlite3_collation_needed16(). The second argument is the database ** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE], ** or [SQLITE_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 -** [sqlite3_create_collation()], [sqlite3_create_collation16()], or -** [sqlite3_create_collation_v2()]. +** [tdsqlite3_create_collation()], [tdsqlite3_create_collation16()], or +** [tdsqlite3_create_collation_v2()]. */ -SQLITE_API int sqlite3_collation_needed( - sqlite3*, +SQLITE_API int tdsqlite3_collation_needed( + tdsqlite3*, void*, - void(*)(void*,sqlite3*,int eTextRep,const char*) + void(*)(void*,tdsqlite3*,int eTextRep,const char*) ); -SQLITE_API int sqlite3_collation_needed16( - sqlite3*, +SQLITE_API int tdsqlite3_collation_needed16( + tdsqlite3*, void*, - void(*)(void*,sqlite3*,int eTextRep,const void*) + void(*)(void*,tdsqlite3*,int eTextRep,const void*) ); #ifdef SQLITE_HAS_CODEC /* ** Specify the key for an encrypted database. This routine should be -** called right after sqlite3_open(). +** called right after tdsqlite3_open(). ** ** The code to implement this API is not available in the public release ** of SQLite. */ -SQLITE_API int sqlite3_key( - sqlite3 *db, /* Database to be rekeyed */ +SQLITE_API int tdsqlite3_key( + tdsqlite3 *db, /* Database to be rekeyed */ const void *pKey, int nKey /* The key */ ); -SQLITE_API int sqlite3_key_v2( - sqlite3 *db, /* Database to be rekeyed */ +SQLITE_API int tdsqlite3_key_v2( + tdsqlite3 *db, /* Database to be rekeyed */ const char *zDbName, /* Name of the database */ const void *pKey, int nKey /* The key */ ); @@ -5859,12 +5859,12 @@ SQLITE_API int sqlite3_key_v2( END SQLCIPHER */ -SQLITE_API int sqlite3_rekey( - sqlite3 *db, /* Database to be rekeyed */ +SQLITE_API int tdsqlite3_rekey( + tdsqlite3 *db, /* Database to be rekeyed */ const void *pKey, int nKey /* The new key */ ); -SQLITE_API int sqlite3_rekey_v2( - sqlite3 *db, /* Database to be rekeyed */ +SQLITE_API int tdsqlite3_rekey_v2( + tdsqlite3 *db, /* Database to be rekeyed */ const char *zDbName, /* Name of the database */ const void *pKey, int nKey /* The new key */ ); @@ -5873,7 +5873,7 @@ SQLITE_API int sqlite3_rekey_v2( ** Specify the activation key for a SEE database. Unless ** activated, none of the SEE routines will work. */ -SQLITE_API void sqlite3_activate_see( +SQLITE_API void tdsqlite3_activate_see( const char *zPassPhrase /* Activation phrase */ ); #endif @@ -5883,7 +5883,7 @@ SQLITE_API void sqlite3_activate_see( ** Specify the activation key for a CEROD database. Unless ** activated, none of the CEROD routines will work. */ -SQLITE_API void sqlite3_activate_cerod( +SQLITE_API void tdsqlite3_activate_cerod( const char *zPassPhrase /* Activation phrase */ ); #endif @@ -5891,7 +5891,7 @@ SQLITE_API void sqlite3_activate_cerod( /* ** CAPI3REF: Suspend Execution For A Short Time ** -** The sqlite3_sleep() function causes the current thread to suspend execution +** The tdsqlite3_sleep() function causes the current thread to suspend execution ** for at least a number of milliseconds specified in its parameter. ** ** If the operating system does not support sleep requests with @@ -5900,19 +5900,19 @@ SQLITE_API void sqlite3_activate_cerod( ** requested from the operating system is returned. ** ** ^SQLite implements this interface by calling the xSleep() -** method of the default [sqlite3_vfs] object. If the xSleep() method +** method of the default [tdsqlite3_vfs] object. If the xSleep() method ** of the default VFS is not implemented correctly, or not implemented at -** all, then the behavior of sqlite3_sleep() may deviate from the description +** all, then the behavior of tdsqlite3_sleep() may deviate from the description ** in the previous paragraphs. */ -SQLITE_API int sqlite3_sleep(int); +SQLITE_API int tdsqlite3_sleep(int); /* ** CAPI3REF: Name Of The Folder Holding Temporary Files ** ** ^(If this global variable is made to point to a string which is ** the name of a folder (a.k.a. directory), then all temporary files -** created by SQLite when using a built-in [sqlite3_vfs | VFS] +** created by SQLite when using a built-in [tdsqlite3_vfs | VFS] ** will be placed in that directory.)^ ^If this variable ** is a NULL pointer, then SQLite performs a search for an appropriate ** temporary file directory. @@ -5934,22 +5934,22 @@ SQLITE_API int sqlite3_sleep(int); ** thereafter. ** ** ^The [temp_store_directory pragma] may modify this variable and cause -** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, +** it to point to memory obtained from [tdsqlite3_malloc]. ^Furthermore, ** the [temp_store_directory pragma] always assumes that any string ** that this variable points to is held in memory obtained from -** [sqlite3_malloc] and the pragma may attempt to free that memory -** using [sqlite3_free]. +** [tdsqlite3_malloc] and the pragma may attempt to free that memory +** using [tdsqlite3_free]. ** Hence, if this variable is modified directly, either it should be -** made NULL or made to point to memory obtained from [sqlite3_malloc] +** made NULL or made to point to memory obtained from [tdsqlite3_malloc] ** or else the use of the [temp_store_directory pragma] should be avoided. ** Except when requested by the [temp_store_directory pragma], SQLite -** does not free the memory that sqlite3_temp_directory points to. If +** does not free the memory that tdsqlite3_temp_directory points to. If ** the application wants that memory to be freed, it must do ** so itself, taking care to only do so after all [database connection] ** objects have been destroyed. ** ** Note to Windows Runtime users: The temporary directory must be set -** prior to calling [sqlite3_open] or [sqlite3_open_v2]. Otherwise, various +** prior to calling [tdsqlite3_open] or [tdsqlite3_open_v2]. Otherwise, various ** features that require the use of temporary files may fail. Here is an ** example of how to do this using C++ with the Windows Runtime: ** @@ -5960,10 +5960,10 @@ SQLITE_API int sqlite3_sleep(int); ** memset(zPathBuf, 0, sizeof(zPathBuf)); ** WideCharToMultiByte(CP_UTF8, 0, zPath, -1, zPathBuf, sizeof(zPathBuf), **   NULL, NULL); -** sqlite3_temp_directory = sqlite3_mprintf("%s", zPathBuf); +** tdsqlite3_temp_directory = tdsqlite3_mprintf("%s", zPathBuf); ** */ -SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory; +SQLITE_API SQLITE_EXTERN char *tdsqlite3_temp_directory; /* ** CAPI3REF: Name Of The Folder Holding Database Files @@ -5971,7 +5971,7 @@ SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory; ** ^(If this global variable is made to point to a string which is ** the name of a folder (a.k.a. directory), then all database files ** specified with a relative pathname and created or accessed by -** SQLite when using a built-in windows [sqlite3_vfs | VFS] will be assumed +** SQLite when using a built-in windows [tdsqlite3_vfs | VFS] will be assumed ** to be relative to that directory.)^ ^If this variable is a NULL ** pointer, then SQLite assumes that all database files specified ** with a relative pathname are relative to the current directory @@ -5991,48 +5991,48 @@ SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory; ** thereafter. ** ** ^The [data_store_directory pragma] may modify this variable and cause -** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, +** it to point to memory obtained from [tdsqlite3_malloc]. ^Furthermore, ** the [data_store_directory pragma] always assumes that any string ** that this variable points to is held in memory obtained from -** [sqlite3_malloc] and the pragma may attempt to free that memory -** using [sqlite3_free]. +** [tdsqlite3_malloc] and the pragma may attempt to free that memory +** using [tdsqlite3_free]. ** Hence, if this variable is modified directly, either it should be -** made NULL or made to point to memory obtained from [sqlite3_malloc] +** made NULL or made to point to memory obtained from [tdsqlite3_malloc] ** or else the use of the [data_store_directory pragma] should be avoided. */ -SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory; +SQLITE_API SQLITE_EXTERN char *tdsqlite3_data_directory; /* ** CAPI3REF: Win32 Specific Interface ** ** These interfaces are available only on Windows. The -** [sqlite3_win32_set_directory] interface is used to set the value associated -** with the [sqlite3_temp_directory] or [sqlite3_data_directory] variable, to +** [tdsqlite3_win32_set_directory] interface is used to set the value associated +** with the [tdsqlite3_temp_directory] or [tdsqlite3_data_directory] variable, to ** zValue, depending on the value of the type parameter. The zValue parameter -** should be NULL to cause the previous value to be freed via [sqlite3_free]; -** a non-NULL value will be copied into memory obtained from [sqlite3_malloc] -** prior to being used. The [sqlite3_win32_set_directory] interface returns +** should be NULL to cause the previous value to be freed via [tdsqlite3_free]; +** a non-NULL value will be copied into memory obtained from [tdsqlite3_malloc] +** prior to being used. The [tdsqlite3_win32_set_directory] interface returns ** [SQLITE_OK] to indicate success, [SQLITE_ERROR] if the type is unsupported, ** or [SQLITE_NOMEM] if memory could not be allocated. The value of the -** [sqlite3_data_directory] variable is intended to act as a replacement for +** [tdsqlite3_data_directory] variable is intended to act as a replacement for ** the current directory on the sub-platforms of Win32 where that concept is -** not present, e.g. WinRT and UWP. The [sqlite3_win32_set_directory8] and -** [sqlite3_win32_set_directory16] interfaces behave exactly the same as the -** sqlite3_win32_set_directory interface except the string parameter must be +** not present, e.g. WinRT and UWP. The [tdsqlite3_win32_set_directory8] and +** [tdsqlite3_win32_set_directory16] interfaces behave exactly the same as the +** tdsqlite3_win32_set_directory interface except the string parameter must be ** UTF-8 or UTF-16, respectively. */ -SQLITE_API int sqlite3_win32_set_directory( +SQLITE_API int tdsqlite3_win32_set_directory( unsigned long type, /* Identifier for directory being set or reset */ void *zValue /* New value for directory being set or reset */ ); -SQLITE_API int sqlite3_win32_set_directory8(unsigned long type, const char *zValue); -SQLITE_API int sqlite3_win32_set_directory16(unsigned long type, const void *zValue); +SQLITE_API int tdsqlite3_win32_set_directory8(unsigned long type, const char *zValue); +SQLITE_API int tdsqlite3_win32_set_directory16(unsigned long type, const void *zValue); /* ** CAPI3REF: Win32 Directory Types ** ** These macros are only available on Windows. They define the allowed values -** for the type argument to the [sqlite3_win32_set_directory] interface. +** for the type argument to the [tdsqlite3_win32_set_directory] interface. */ #define SQLITE_WIN32_DATA_DIRECTORY_TYPE 1 #define SQLITE_WIN32_TEMP_DIRECTORY_TYPE 2 @@ -6040,9 +6040,9 @@ SQLITE_API int sqlite3_win32_set_directory16(unsigned long type, const void *zVa /* ** CAPI3REF: Test For Auto-Commit Mode ** KEYWORDS: {autocommit mode} -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The sqlite3_get_autocommit() interface returns non-zero or +** ^The tdsqlite3_get_autocommit() interface returns non-zero or ** zero if the given database connection is or is not in autocommit mode, ** respectively. ^Autocommit mode is on by default. ** ^Autocommit mode is disabled by a [BEGIN] statement. @@ -6059,26 +6059,26 @@ SQLITE_API int sqlite3_win32_set_directory16(unsigned long type, const void *zVa ** connection while this routine is running, then the return value ** is undefined. */ -SQLITE_API int sqlite3_get_autocommit(sqlite3*); +SQLITE_API int tdsqlite3_get_autocommit(tdsqlite3*); /* ** CAPI3REF: Find The Database Handle Of A Prepared Statement -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** -** ^The sqlite3_db_handle interface returns the [database connection] handle +** ^The tdsqlite3_db_handle interface returns the [database connection] handle ** to which a [prepared statement] belongs. ^The [database connection] -** returned by sqlite3_db_handle is the same [database connection] +** returned by tdsqlite3_db_handle is the same [database connection] ** that was the first argument -** to the [sqlite3_prepare_v2()] call (or its variants) that was used to +** to the [tdsqlite3_prepare_v2()] call (or its variants) that was used to ** create the statement in the first place. */ -SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); +SQLITE_API tdsqlite3 *tdsqlite3_db_handle(tdsqlite3_stmt*); /* ** CAPI3REF: Return The Filename For A Database Connection -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The sqlite3_db_filename(D,N) interface returns a pointer to the filename +** ^The tdsqlite3_db_filename(D,N) interface returns a pointer to the filename ** associated with database N of connection D. ** ^If there is no attached database N on the database ** connection D, or if database N is a temporary or in-memory database, then @@ -6096,29 +6096,29 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); ** If the filename pointer returned by this routine is not NULL, then it ** can be used as the filename input parameter to these routines: **
    -**
  • [sqlite3_uri_parameter()] -**
  • [sqlite3_uri_boolean()] -**
  • [sqlite3_uri_int64()] -**
  • [sqlite3_filename_database()] -**
  • [sqlite3_filename_journal()] -**
  • [sqlite3_filename_wal()] +**
  • [tdsqlite3_uri_parameter()] +**
  • [tdsqlite3_uri_boolean()] +**
  • [tdsqlite3_uri_int64()] +**
  • [tdsqlite3_filename_database()] +**
  • [tdsqlite3_filename_journal()] +**
  • [tdsqlite3_filename_wal()] **
*/ -SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName); +SQLITE_API const char *tdsqlite3_db_filename(tdsqlite3 *db, const char *zDbName); /* ** CAPI3REF: Determine if a database is read-only -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N +** ^The tdsqlite3_db_readonly(D,N) interface returns 1 if the database N ** of connection D is read-only, 0 if it is read/write, or -1 if N is not ** the name of a database on connection D. */ -SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName); +SQLITE_API int tdsqlite3_db_readonly(tdsqlite3 *db, const char *zDbName); /* ** CAPI3REF: Find the next prepared statement -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^This interface returns a pointer to the next [prepared statement] after ** pStmt associated with the [database connection] pDb. ^If pStmt is NULL @@ -6127,28 +6127,28 @@ SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName); ** satisfies the conditions of this routine, it returns NULL. ** ** The [database connection] pointer D in a call to -** [sqlite3_next_stmt(D,S)] must refer to an open database +** [tdsqlite3_next_stmt(D,S)] must refer to an open database ** connection and in particular must not be a NULL pointer. */ -SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt); +SQLITE_API tdsqlite3_stmt *tdsqlite3_next_stmt(tdsqlite3 *pDb, tdsqlite3_stmt *pStmt); /* ** CAPI3REF: Commit And Rollback Notification Callbacks -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The sqlite3_commit_hook() interface registers a callback +** ^The tdsqlite3_commit_hook() interface registers a callback ** function to be invoked whenever a transaction is [COMMIT | committed]. -** ^Any callback set by a previous call to sqlite3_commit_hook() +** ^Any callback set by a previous call to tdsqlite3_commit_hook() ** for the same database connection is overridden. -** ^The sqlite3_rollback_hook() interface registers a callback +** ^The tdsqlite3_rollback_hook() interface registers a callback ** function to be invoked whenever a transaction is [ROLLBACK | rolled back]. -** ^Any callback set by a previous call to sqlite3_rollback_hook() +** ^Any callback set by a previous call to tdsqlite3_rollback_hook() ** for the same database connection is overridden. ** ^The pArg argument is passed through to the callback. ** ^If the callback on a commit hook function returns non-zero, ** then the commit is converted into a rollback. ** -** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions +** ^The tdsqlite3_commit_hook(D,C,P) and tdsqlite3_rollback_hook(D,C,P) functions ** return the P argument from the previous call of the same function ** on the same [database connection] D, or NULL for ** the first call for each function on D. @@ -6157,10 +6157,10 @@ SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt); ** The callback implementation must not do anything that will modify ** the database connection that invoked the callback. Any actions ** to modify the database connection must be deferred until after the -** completion of the [sqlite3_step()] call that triggered the commit +** completion of the [tdsqlite3_step()] call that triggered the commit ** or rollback hook in the first place. ** Note that running any other SQL statements, including SELECT statements, -** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify +** or merely calling [tdsqlite3_prepare_v2()] and [tdsqlite3_step()] will modify ** the database connections for the meaning of "modify" in this paragraph. ** ** ^Registering a NULL function disables the callback. @@ -6177,16 +6177,16 @@ SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt); ** ^The rollback callback is not invoked if a transaction is ** automatically rolled back because the database connection is closed. ** -** See also the [sqlite3_update_hook()] interface. +** See also the [tdsqlite3_update_hook()] interface. */ -SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); -SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); +SQLITE_API void *tdsqlite3_commit_hook(tdsqlite3*, int(*)(void*), void*); +SQLITE_API void *tdsqlite3_rollback_hook(tdsqlite3*, void(*)(void *), void*); /* ** CAPI3REF: Data Change Notification Callbacks -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The sqlite3_update_hook() interface registers a callback function +** ^The tdsqlite3_update_hook() interface registers a callback function ** with the [database connection] identified by the first argument ** to be invoked whenever a row is updated, inserted or deleted in ** a [rowid table]. @@ -6196,7 +6196,7 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); ** ^The second argument is a pointer to the function to invoke when a ** row is updated, inserted or deleted in a rowid table. ** ^The first argument to the callback is a copy of the third argument -** to sqlite3_update_hook(). +** to tdsqlite3_update_hook(). ** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE], ** or [SQLITE_UPDATE], depending on the operation that caused the callback ** to be invoked. @@ -6219,21 +6219,21 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); ** The update hook implementation must not do anything that will modify ** the database connection that invoked the update hook. Any actions ** to modify the database connection must be deferred until after the -** completion of the [sqlite3_step()] call that triggered the update hook. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their +** completion of the [tdsqlite3_step()] call that triggered the update hook. +** Note that [tdsqlite3_prepare_v2()] and [tdsqlite3_step()] both modify their ** database connections for the meaning of "modify" in this paragraph. ** -** ^The sqlite3_update_hook(D,C,P) function +** ^The tdsqlite3_update_hook(D,C,P) function ** returns the P argument from the previous call ** on the same [database connection] D, or NULL for ** the first call on D. ** -** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()], -** and [sqlite3_preupdate_hook()] interfaces. +** See also the [tdsqlite3_commit_hook()], [tdsqlite3_rollback_hook()], +** and [tdsqlite3_preupdate_hook()] interfaces. */ -SQLITE_API void *sqlite3_update_hook( - sqlite3*, - void(*)(void *,int ,char const *,char const *,sqlite3_int64), +SQLITE_API void *tdsqlite3_update_hook( + tdsqlite3*, + void(*)(void *,int ,char const *,char const *,tdsqlite3_int64), void* ); @@ -6251,7 +6251,7 @@ SQLITE_API void *sqlite3_update_hook( ** sharing was enabled or disabled for each thread separately. ** ** ^(The cache sharing mode set by this interface effects all subsequent -** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()]. +** calls to [tdsqlite3_open()], [tdsqlite3_open_v2()], and [tdsqlite3_open16()]. ** Existing database connections continue to use the sharing mode ** that was in effect at the time they were opened.)^ ** @@ -6263,50 +6263,50 @@ SQLITE_API void *sqlite3_update_hook( ** continues to be provided for historical compatibility, but its use is ** discouraged. Any use of shared cache is discouraged. If shared cache ** must be used, it is recommended that shared cache only be enabled for -** individual database connections using the [sqlite3_open_v2()] interface +** individual database connections using the [tdsqlite3_open_v2()] interface ** with the [SQLITE_OPEN_SHAREDCACHE] flag. ** ** Note: This method is disabled on MacOS X 10.7 and iOS version 5.0 ** and will always return SQLITE_MISUSE. On those systems, ** shared cache mode should be enabled per-database connection via -** [sqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE]. +** [tdsqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE]. ** ** This interface is threadsafe on processors where writing a ** 32-bit integer is atomic. ** ** See Also: [SQLite Shared-Cache Mode] */ -SQLITE_API int sqlite3_enable_shared_cache(int); +SQLITE_API int tdsqlite3_enable_shared_cache(int); /* ** CAPI3REF: Attempt To Free Heap Memory ** -** ^The sqlite3_release_memory() interface attempts to free N bytes +** ^The tdsqlite3_release_memory() interface attempts to free N bytes ** of heap memory by deallocating non-essential memory allocations ** held by the database library. Memory used to cache database ** pages to improve performance is an example of non-essential memory. -** ^sqlite3_release_memory() returns the number of bytes actually freed, +** ^tdsqlite3_release_memory() returns the number of bytes actually freed, ** which might be more or less than the amount requested. -** ^The sqlite3_release_memory() routine is a no-op returning zero +** ^The tdsqlite3_release_memory() routine is a no-op returning zero ** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT]. ** -** See also: [sqlite3_db_release_memory()] +** See also: [tdsqlite3_db_release_memory()] */ -SQLITE_API int sqlite3_release_memory(int); +SQLITE_API int tdsqlite3_release_memory(int); /* ** CAPI3REF: Free Memory Used By A Database Connection -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap +** ^The tdsqlite3_db_release_memory(D) interface attempts to free as much heap ** memory as possible from database connection D. Unlike the -** [sqlite3_release_memory()] interface, this interface is in effect even +** [tdsqlite3_release_memory()] interface, this interface is in effect even ** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is ** omitted. ** -** See also: [sqlite3_release_memory()] +** See also: [tdsqlite3_release_memory()] */ -SQLITE_API int sqlite3_db_release_memory(sqlite3*); +SQLITE_API int tdsqlite3_db_release_memory(tdsqlite3*); /* ** CAPI3REF: Impose A Limit On Heap Size @@ -6314,7 +6314,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*); ** These interfaces impose limits on the amount of heap memory that will be ** by all database connections within a single process. ** -** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the +** ^The tdsqlite3_soft_heap_limit64() interface sets and/or queries the ** soft limit on the amount of heap memory that may be allocated by SQLite. ** ^SQLite strives to keep heap memory utilization below the soft heap ** limit by reducing the number of pages held in the page cache @@ -6324,30 +6324,30 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*); ** an [SQLITE_NOMEM] error. In other words, the soft heap limit ** is advisory only. ** -** ^The sqlite3_hard_heap_limit64(N) interface sets a hard upper bound of +** ^The tdsqlite3_hard_heap_limit64(N) interface sets a hard upper bound of ** N bytes on the amount of memory that will be allocated. ^The -** sqlite3_hard_heap_limit64(N) interface is similar to -** sqlite3_soft_heap_limit64(N) except that memory allocations will fail +** tdsqlite3_hard_heap_limit64(N) interface is similar to +** tdsqlite3_soft_heap_limit64(N) except that memory allocations will fail ** when the hard heap limit is reached. ** -** ^The return value from both sqlite3_soft_heap_limit64() and -** sqlite3_hard_heap_limit64() is the size of +** ^The return value from both tdsqlite3_soft_heap_limit64() and +** tdsqlite3_hard_heap_limit64() is the size of ** the heap limit prior to the call, or negative in the case of an ** error. ^If the argument N is negative ** then no change is made to the heap limit. Hence, the current ** size of heap limits can be determined by invoking -** sqlite3_soft_heap_limit64(-1) or sqlite3_hard_heap_limit(-1). +** tdsqlite3_soft_heap_limit64(-1) or tdsqlite3_hard_heap_limit(-1). ** ** ^Setting the heap limits to zero disables the heap limiter mechanism. ** ** ^The soft heap limit may not be greater than the hard heap limit. -** ^If the hard heap limit is enabled and if sqlite3_soft_heap_limit(N) +** ^If the hard heap limit is enabled and if tdsqlite3_soft_heap_limit(N) ** is invoked with a value of N that is greater than the hard heap limit, ** the the soft heap limit is set to the value of the hard heap limit. ** ^The soft heap limit is automatically enabled whenever the hard heap -** limit is enabled. ^When sqlite3_hard_heap_limit64(N) is invoked and +** limit is enabled. ^When tdsqlite3_hard_heap_limit64(N) is invoked and ** the soft heap limit is outside the range of 1..N, then the soft heap -** limit is set to N. ^Invoking sqlite3_soft_heap_limit64(0) when the +** limit is set to N. ^Invoking tdsqlite3_soft_heap_limit64(0) when the ** hard heap limit is enabled makes the soft heap limit equal to the ** hard heap limit. ** @@ -6360,49 +6360,49 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*); **
    **
  • The limit value is set to zero. **
  • Memory accounting is disabled using a combination of the -** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and +** [tdsqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and ** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option. **
  • An alternative page cache implementation is specified using -** [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...). +** [tdsqlite3_config]([SQLITE_CONFIG_PCACHE2],...). **
  • The page cache allocates from its own memory pool supplied -** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than +** by [tdsqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than ** from the heap. **
)^ ** ** The circumstances under which SQLite will enforce the heap limits may ** changes in future releases of SQLite. */ -SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N); -SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N); +SQLITE_API tdsqlite3_int64 tdsqlite3_soft_heap_limit64(tdsqlite3_int64 N); +SQLITE_API tdsqlite3_int64 tdsqlite3_hard_heap_limit64(tdsqlite3_int64 N); /* ** CAPI3REF: Deprecated Soft Heap Limit Interface ** DEPRECATED ** -** This is a deprecated version of the [sqlite3_soft_heap_limit64()] +** This is a deprecated version of the [tdsqlite3_soft_heap_limit64()] ** interface. This routine is provided for historical compatibility ** only. All new applications should use the -** [sqlite3_soft_heap_limit64()] interface rather than this one. +** [tdsqlite3_soft_heap_limit64()] interface rather than this one. */ -SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); +SQLITE_API SQLITE_DEPRECATED void tdsqlite3_soft_heap_limit(int N); /* ** CAPI3REF: Extract Metadata About A Column Of A Table -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns +** ^(The tdsqlite3_table_column_metadata(X,D,T,C,....) routine returns ** information about column C of table T in database D -** on [database connection] X.)^ ^The sqlite3_table_column_metadata() +** on [database connection] X.)^ ^The tdsqlite3_table_column_metadata() ** interface returns SQLITE_OK and fills in the non-NULL pointers in ** the final five arguments with appropriate values if the specified -** column exists. ^The sqlite3_table_column_metadata() interface returns +** column exists. ^The tdsqlite3_table_column_metadata() interface returns ** SQLITE_ERROR if the specified column does not exist. -** ^If the column-name parameter to sqlite3_table_column_metadata() is a +** ^If the column-name parameter to tdsqlite3_table_column_metadata() is a ** NULL pointer, then this routine simply checks for the existence of the ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it ** does not. If the table name parameter T in a call to -** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is +** tdsqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is ** undefined behavior. ** ** ^The column is identified by the second, third and fourth parameters to @@ -6456,8 +6456,8 @@ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); ** parsed, if that has not already been done, and returns an error if ** any errors are encountered while loading the schema. */ -SQLITE_API int sqlite3_table_column_metadata( - sqlite3 *db, /* Connection handle */ +SQLITE_API int tdsqlite3_table_column_metadata( + tdsqlite3 *db, /* Connection handle */ const char *zDbName, /* Database name or NULL */ const char *zTableName, /* Table name */ const char *zColumnName, /* Column name */ @@ -6470,11 +6470,11 @@ SQLITE_API int sqlite3_table_column_metadata( /* ** CAPI3REF: Load An Extension -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^This interface loads an SQLite extension library from the named file. ** -** ^The sqlite3_load_extension() interface attempts to load an +** ^The tdsqlite3_load_extension() interface attempts to load an ** [SQLite extension] library contained in the file zFile. If ** the file cannot be loaded directly, attempts are made to load ** with various operating-system specific extensions added. @@ -6484,36 +6484,36 @@ SQLITE_API int sqlite3_table_column_metadata( ** ** ^The entry point is zProc. ** ^(zProc may be 0, in which case SQLite will try to come up with an -** entry point name on its own. It first tries "sqlite3_extension_init". -** If that does not work, it constructs a name "sqlite3_X_init" where the +** entry point name on its own. It first tries "tdsqlite3_extension_init". +** If that does not work, it constructs a name "tdsqlite3_X_init" where the ** X is consists of the lower-case equivalent of all ASCII alphabetic ** characters in the filename from the last "/" to the first following ** "." and omitting any initial "lib".)^ -** ^The sqlite3_load_extension() interface returns +** ^The tdsqlite3_load_extension() interface returns ** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong. ** ^If an error occurs and pzErrMsg is not 0, then the -** [sqlite3_load_extension()] interface shall attempt to +** [tdsqlite3_load_extension()] interface shall attempt to ** fill *pzErrMsg with error message text stored in memory -** obtained from [sqlite3_malloc()]. The calling function -** should free this memory by calling [sqlite3_free()]. +** obtained from [tdsqlite3_malloc()]. The calling function +** should free this memory by calling [tdsqlite3_free()]. ** ** ^Extension loading must be enabled using -** [sqlite3_enable_load_extension()] or -** [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],1,NULL) +** [tdsqlite3_enable_load_extension()] or +** [tdsqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],1,NULL) ** prior to calling this API, ** otherwise an error will be returned. ** ** Security warning: It is recommended that the ** [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method be used to enable only this -** interface. The use of the [sqlite3_enable_load_extension()] interface +** interface. The use of the [tdsqlite3_enable_load_extension()] interface ** should be avoided. This will keep the SQL function [load_extension()] ** disabled and prevent SQL injections from giving attackers ** access to extension loading capabilities. ** ** See also the [load_extension() SQL function]. */ -SQLITE_API int sqlite3_load_extension( - sqlite3 *db, /* Load the extension into this database connection */ +SQLITE_API int tdsqlite3_load_extension( + tdsqlite3 *db, /* Load the extension into this database connection */ const char *zFile, /* Name of the shared library containing extension */ const char *zProc, /* Entry point. Derived from zFile if 0 */ char **pzErrMsg /* Put error message here if not 0 */ @@ -6521,21 +6521,21 @@ SQLITE_API int sqlite3_load_extension( /* ** CAPI3REF: Enable Or Disable Extension Loading -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^So as not to open security holes in older applications that are ** unprepared to deal with [extension loading], and as a means of disabling ** [extension loading] while evaluating user-entered SQL, the following API -** is provided to turn the [sqlite3_load_extension()] mechanism on and off. +** is provided to turn the [tdsqlite3_load_extension()] mechanism on and off. ** ** ^Extension loading is off by default. -** ^Call the sqlite3_enable_load_extension() routine with onoff==1 +** ^Call the tdsqlite3_enable_load_extension() routine with onoff==1 ** to turn extension loading on and call it with onoff==0 to turn ** it back off again. ** ** ^This interface enables or disables both the C-API -** [sqlite3_load_extension()] and the SQL function [load_extension()]. -** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) +** [tdsqlite3_load_extension()] and the SQL function [load_extension()]. +** ^(Use [tdsqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) ** to enable or disable only the C-API.)^ ** ** Security warning: It is recommended that extension loading @@ -6544,7 +6544,7 @@ SQLITE_API int sqlite3_load_extension( ** remains disabled. This will prevent SQL injections from giving attackers ** access to extension loading capabilities. */ -SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff); +SQLITE_API int tdsqlite3_enable_load_extension(tdsqlite3 *db, int onoff); /* ** CAPI3REF: Automatically Load Statically Linked Extensions @@ -6561,48 +6561,48 @@ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff); ** **
 **    int xEntryPoint(
-**      sqlite3 *db,
+**      tdsqlite3 *db,
 **      const char **pzErrMsg,
-**      const struct sqlite3_api_routines *pThunk
+**      const struct tdsqlite3_api_routines *pThunk
 **    );
 ** 
)^ ** ** If the xEntryPoint routine encounters an error, it should make *pzErrMsg -** point to an appropriate error message (obtained from [sqlite3_mprintf()]) +** point to an appropriate error message (obtained from [tdsqlite3_mprintf()]) ** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg ** is NULL before calling the xEntryPoint(). ^SQLite will invoke -** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any -** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()], -** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail. +** [tdsqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any +** xEntryPoint() returns an error, the [tdsqlite3_open()], [tdsqlite3_open16()], +** or [tdsqlite3_open_v2()] call that provoked the xEntryPoint() will fail. ** -** ^Calling sqlite3_auto_extension(X) with an entry point X that is already +** ^Calling tdsqlite3_auto_extension(X) with an entry point X that is already ** on the list of automatic extensions is a harmless no-op. ^No entry point ** will be called more than once for each database connection that is opened. ** -** See also: [sqlite3_reset_auto_extension()] -** and [sqlite3_cancel_auto_extension()] +** See also: [tdsqlite3_reset_auto_extension()] +** and [tdsqlite3_cancel_auto_extension()] */ -SQLITE_API int sqlite3_auto_extension(void(*xEntryPoint)(void)); +SQLITE_API int tdsqlite3_auto_extension(void(*xEntryPoint)(void)); /* ** CAPI3REF: Cancel Automatic Extension Loading ** -** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the +** ^The [tdsqlite3_cancel_auto_extension(X)] interface unregisters the ** initialization routine X that was registered using a prior call to -** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)] +** [tdsqlite3_auto_extension(X)]. ^The [tdsqlite3_cancel_auto_extension(X)] ** routine returns 1 if initialization routine X was successfully ** unregistered and it returns 0 if X was not on the list of initialization ** routines. */ -SQLITE_API int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void)); +SQLITE_API int tdsqlite3_cancel_auto_extension(void(*xEntryPoint)(void)); /* ** CAPI3REF: Reset Automatic Extension Loading ** ** ^This interface disables all automatic extensions previously -** registered using [sqlite3_auto_extension()]. +** registered using [tdsqlite3_auto_extension()]. */ -SQLITE_API void sqlite3_reset_auto_extension(void); +SQLITE_API void tdsqlite3_reset_auto_extension(void); /* ** The interface to the virtual-table mechanism is currently considered @@ -6616,14 +6616,14 @@ SQLITE_API void sqlite3_reset_auto_extension(void); /* ** Structures used by the virtual table interface */ -typedef struct sqlite3_vtab sqlite3_vtab; -typedef struct sqlite3_index_info sqlite3_index_info; -typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor; -typedef struct sqlite3_module sqlite3_module; +typedef struct tdsqlite3_vtab tdsqlite3_vtab; +typedef struct tdsqlite3_index_info tdsqlite3_index_info; +typedef struct tdsqlite3_vtab_cursor tdsqlite3_vtab_cursor; +typedef struct tdsqlite3_module tdsqlite3_module; /* ** CAPI3REF: Virtual Table Object -** KEYWORDS: sqlite3_module {virtual table module} +** KEYWORDS: tdsqlite3_module {virtual table module} ** ** This structure, sometimes called a "virtual table module", ** defines the implementation of a [virtual table]. @@ -6631,45 +6631,45 @@ typedef struct sqlite3_module sqlite3_module; ** ** ^A virtual table module is created by filling in a persistent ** instance of this structure and passing a pointer to that instance -** to [sqlite3_create_module()] or [sqlite3_create_module_v2()]. +** to [tdsqlite3_create_module()] or [tdsqlite3_create_module_v2()]. ** ^The registration remains valid until it is replaced by a different ** module or until the [database connection] closes. The content ** of this structure must not change while it is registered with ** any database connection. */ -struct sqlite3_module { +struct tdsqlite3_module { int iVersion; - int (*xCreate)(sqlite3*, void *pAux, + int (*xCreate)(tdsqlite3*, void *pAux, int argc, const char *const*argv, - sqlite3_vtab **ppVTab, char**); - int (*xConnect)(sqlite3*, void *pAux, + tdsqlite3_vtab **ppVTab, char**); + int (*xConnect)(tdsqlite3*, void *pAux, int argc, const char *const*argv, - sqlite3_vtab **ppVTab, char**); - int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*); - int (*xDisconnect)(sqlite3_vtab *pVTab); - int (*xDestroy)(sqlite3_vtab *pVTab); - int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); - int (*xClose)(sqlite3_vtab_cursor*); - int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr, - int argc, sqlite3_value **argv); - int (*xNext)(sqlite3_vtab_cursor*); - int (*xEof)(sqlite3_vtab_cursor*); - int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int); - int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid); - int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *); - int (*xBegin)(sqlite3_vtab *pVTab); - int (*xSync)(sqlite3_vtab *pVTab); - int (*xCommit)(sqlite3_vtab *pVTab); - int (*xRollback)(sqlite3_vtab *pVTab); - int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName, - void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), + tdsqlite3_vtab **ppVTab, char**); + int (*xBestIndex)(tdsqlite3_vtab *pVTab, tdsqlite3_index_info*); + int (*xDisconnect)(tdsqlite3_vtab *pVTab); + int (*xDestroy)(tdsqlite3_vtab *pVTab); + int (*xOpen)(tdsqlite3_vtab *pVTab, tdsqlite3_vtab_cursor **ppCursor); + int (*xClose)(tdsqlite3_vtab_cursor*); + int (*xFilter)(tdsqlite3_vtab_cursor*, int idxNum, const char *idxStr, + int argc, tdsqlite3_value **argv); + int (*xNext)(tdsqlite3_vtab_cursor*); + int (*xEof)(tdsqlite3_vtab_cursor*); + int (*xColumn)(tdsqlite3_vtab_cursor*, tdsqlite3_context*, int); + int (*xRowid)(tdsqlite3_vtab_cursor*, tdsqlite3_int64 *pRowid); + int (*xUpdate)(tdsqlite3_vtab *, int, tdsqlite3_value **, tdsqlite3_int64 *); + int (*xBegin)(tdsqlite3_vtab *pVTab); + int (*xSync)(tdsqlite3_vtab *pVTab); + int (*xCommit)(tdsqlite3_vtab *pVTab); + int (*xRollback)(tdsqlite3_vtab *pVTab); + int (*xFindFunction)(tdsqlite3_vtab *pVtab, int nArg, const char *zName, + void (**pxFunc)(tdsqlite3_context*,int,tdsqlite3_value**), void **ppArg); - int (*xRename)(sqlite3_vtab *pVtab, const char *zNew); + int (*xRename)(tdsqlite3_vtab *pVtab, const char *zNew); /* The methods above are in version 1 of the sqlite_module object. Those ** below are for version 2 and greater. */ - int (*xSavepoint)(sqlite3_vtab *pVTab, int); - int (*xRelease)(sqlite3_vtab *pVTab, int); - int (*xRollbackTo)(sqlite3_vtab *pVTab, int); + int (*xSavepoint)(tdsqlite3_vtab *pVTab, int); + int (*xRelease)(tdsqlite3_vtab *pVTab, int); + int (*xRollbackTo)(tdsqlite3_vtab *pVTab, int); /* The methods above are in versions 1 and 2 of the sqlite_module object. ** Those below are for version 3 and greater. */ int (*xShadowName)(const char*); @@ -6677,9 +6677,9 @@ struct sqlite3_module { /* ** CAPI3REF: Virtual Table Indexing Information -** KEYWORDS: sqlite3_index_info +** KEYWORDS: tdsqlite3_index_info ** -** The sqlite3_index_info structure and its substructures is used as part +** The tdsqlite3_index_info structure and its substructures is used as part ** of the [virtual table] interface to ** pass information into and receive the reply from the [xBestIndex] ** method of a [virtual table module]. The fields under **Inputs** are the @@ -6710,12 +6710,12 @@ struct sqlite3_module { ** The colUsed field indicates which columns of the virtual table may be ** required by the current scan. Virtual table columns are numbered from ** zero in the order in which they appear within the CREATE TABLE statement -** passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62), +** passed to tdsqlite3_declare_vtab(). For the first 63 columns (columns 0-62), ** the corresponding bit is set within the colUsed mask if the column may be ** required by SQLite. If the table has at least 64 columns and any column ** to the right of the first 63 is required, then bit 63 of colUsed is also ** set. In other words, column iCol may be required if the expression -** (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to +** (colUsed & ((tdsqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to ** non-zero. ** ** The [xBestIndex] method must fill aConstraintUsage[] with information @@ -6733,7 +6733,7 @@ struct sqlite3_module { ** ** ^The idxNum and idxPtr values are recorded and passed into the ** [xFilter] method. -** ^[sqlite3_free()] is used to free idxPtr if and only if +** ^[tdsqlite3_free()] is used to free idxPtr if and only if ** needToFreeIdxPtr is true. ** ** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in @@ -6764,56 +6764,56 @@ struct sqlite3_module { ** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by ** the xUpdate method are automatically rolled back by SQLite. ** -** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info +** IMPORTANT: The estimatedRows field was added to the tdsqlite3_index_info ** structure for SQLite [version 3.8.2] ([dateof:3.8.2]). ** If a virtual table extension is ** used with an SQLite version earlier than 3.8.2, the results of attempting ** to read or write the estimatedRows field are undefined (but are likely ** to include crashing the application). The estimatedRows field should -** therefore only be used if [sqlite3_libversion_number()] returns a +** therefore only be used if [tdsqlite3_libversion_number()] returns a ** value greater than or equal to 3008002. Similarly, the idxFlags field ** was added for [version 3.9.0] ([dateof:3.9.0]). ** It may therefore only be used if -** sqlite3_libversion_number() returns a value greater than or equal to +** tdsqlite3_libversion_number() returns a value greater than or equal to ** 3009000. */ -struct sqlite3_index_info { +struct tdsqlite3_index_info { /* Inputs */ int nConstraint; /* Number of entries in aConstraint */ - struct sqlite3_index_constraint { + struct tdsqlite3_index_constraint { int iColumn; /* Column constrained. -1 for ROWID */ unsigned char op; /* Constraint operator */ unsigned char usable; /* True if this constraint is usable */ int iTermOffset; /* Used internally - xBestIndex should ignore */ } *aConstraint; /* Table of WHERE clause constraints */ int nOrderBy; /* Number of terms in the ORDER BY clause */ - struct sqlite3_index_orderby { + struct tdsqlite3_index_orderby { int iColumn; /* Column number */ unsigned char desc; /* True for DESC. False for ASC. */ } *aOrderBy; /* The ORDER BY clause */ /* Outputs */ - struct sqlite3_index_constraint_usage { + struct tdsqlite3_index_constraint_usage { int argvIndex; /* if >0, constraint is part of argv to xFilter */ unsigned char omit; /* Do not code a test for this constraint */ } *aConstraintUsage; int idxNum; /* Number used to identify the index */ - char *idxStr; /* String, possibly obtained from sqlite3_malloc */ - int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ + char *idxStr; /* String, possibly obtained from tdsqlite3_malloc */ + int needToFreeIdxStr; /* Free idxStr using tdsqlite3_free() if true */ int orderByConsumed; /* True if output is already ordered */ double estimatedCost; /* Estimated cost of using this index */ /* Fields below are only available in SQLite 3.8.2 and later */ - sqlite3_int64 estimatedRows; /* Estimated number of rows returned */ + tdsqlite3_int64 estimatedRows; /* Estimated number of rows returned */ /* Fields below are only available in SQLite 3.9.0 and later */ int idxFlags; /* Mask of SQLITE_INDEX_SCAN_* flags */ /* Fields below are only available in SQLite 3.10.0 and later */ - sqlite3_uint64 colUsed; /* Input: Mask of columns used by statement */ + tdsqlite3_uint64 colUsed; /* Input: Mask of columns used by statement */ }; /* ** CAPI3REF: Virtual Table Scan Flags ** ** Virtual table implementations are allowed to set the -** [sqlite3_index_info].idxFlags field to some combination of +** [tdsqlite3_index_info].idxFlags field to some combination of ** these bits. */ #define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */ @@ -6822,7 +6822,7 @@ struct sqlite3_index_info { ** CAPI3REF: Virtual Table Constraint Operator Codes ** ** These macros define the allowed values for the -** [sqlite3_index_info].aConstraint[].op field. Each value represents +** [tdsqlite3_index_info].aConstraint[].op field. Each value represents ** an operator that is part of a constraint term in the wHERE clause of ** a query that uses a [virtual table]. */ @@ -6844,7 +6844,7 @@ struct sqlite3_index_info { /* ** CAPI3REF: Register A Virtual Table Implementation -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^These routines are used to register a new [virtual table module] name. ** ^Module names must be registered before @@ -6859,55 +6859,55 @@ struct sqlite3_index_info { ** into the [xCreate] and [xConnect] methods of the virtual table module ** when a new virtual table is be being created or reinitialized. ** -** ^The sqlite3_create_module_v2() interface has a fifth parameter which +** ^The tdsqlite3_create_module_v2() interface has a fifth parameter which ** is a pointer to a destructor for the pClientData. ^SQLite will ** invoke the destructor function (if it is not NULL) when SQLite ** no longer needs the pClientData pointer. ^The destructor will also -** be invoked if the call to sqlite3_create_module_v2() fails. -** ^The sqlite3_create_module() -** interface is equivalent to sqlite3_create_module_v2() with a NULL +** be invoked if the call to tdsqlite3_create_module_v2() fails. +** ^The tdsqlite3_create_module() +** interface is equivalent to tdsqlite3_create_module_v2() with a NULL ** destructor. ** -** ^If the third parameter (the pointer to the sqlite3_module object) is +** ^If the third parameter (the pointer to the tdsqlite3_module object) is ** NULL then no new module is create and any existing modules with the ** same name are dropped. ** -** See also: [sqlite3_drop_modules()] +** See also: [tdsqlite3_drop_modules()] */ -SQLITE_API int sqlite3_create_module( - sqlite3 *db, /* SQLite connection to register module with */ +SQLITE_API int tdsqlite3_create_module( + tdsqlite3 *db, /* SQLite connection to register module with */ const char *zName, /* Name of the module */ - const sqlite3_module *p, /* Methods for the module */ + const tdsqlite3_module *p, /* Methods for the module */ void *pClientData /* Client data for xCreate/xConnect */ ); -SQLITE_API int sqlite3_create_module_v2( - sqlite3 *db, /* SQLite connection to register module with */ +SQLITE_API int tdsqlite3_create_module_v2( + tdsqlite3 *db, /* SQLite connection to register module with */ const char *zName, /* Name of the module */ - const sqlite3_module *p, /* Methods for the module */ + const tdsqlite3_module *p, /* Methods for the module */ void *pClientData, /* Client data for xCreate/xConnect */ void(*xDestroy)(void*) /* Module destructor function */ ); /* ** CAPI3REF: Remove Unnecessary Virtual Table Implementations -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The sqlite3_drop_modules(D,L) interface removes all virtual +** ^The tdsqlite3_drop_modules(D,L) interface removes all virtual ** table modules from database connection D except those named on list L. ** The L parameter must be either NULL or a pointer to an array of pointers ** to strings where the array is terminated by a single NULL pointer. ** ^If the L parameter is NULL, then all virtual table modules are removed. ** -** See also: [sqlite3_create_module()] +** See also: [tdsqlite3_create_module()] */ -SQLITE_API int sqlite3_drop_modules( - sqlite3 *db, /* Remove modules from this connection */ +SQLITE_API int tdsqlite3_drop_modules( + tdsqlite3 *db, /* Remove modules from this connection */ const char **azKeep /* Except, do not remove the ones named here */ ); /* ** CAPI3REF: Virtual Table Instance Object -** KEYWORDS: sqlite3_vtab +** KEYWORDS: tdsqlite3_vtab ** ** Every [virtual table module] implementation uses a subclass ** of this object to describe a particular instance @@ -6917,29 +6917,29 @@ SQLITE_API int sqlite3_drop_modules( ** common to all module implementations. ** ** ^Virtual tables methods can set an error message by assigning a -** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should -** take care that any prior string is freed by a call to [sqlite3_free()] +** string obtained from [tdsqlite3_mprintf()] to zErrMsg. The method should +** take care that any prior string is freed by a call to [tdsqlite3_free()] ** prior to assigning a new string to zErrMsg. ^After the error message ** is delivered up to the client application, the string will be automatically -** freed by sqlite3_free() and the zErrMsg field will be zeroed. +** freed by tdsqlite3_free() and the zErrMsg field will be zeroed. */ -struct sqlite3_vtab { - const sqlite3_module *pModule; /* The module for this virtual table */ +struct tdsqlite3_vtab { + const tdsqlite3_module *pModule; /* The module for this virtual table */ int nRef; /* Number of open cursors */ - char *zErrMsg; /* Error message from sqlite3_mprintf() */ + char *zErrMsg; /* Error message from tdsqlite3_mprintf() */ /* Virtual table implementations will typically add additional fields */ }; /* ** CAPI3REF: Virtual Table Cursor Object -** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor} +** KEYWORDS: tdsqlite3_vtab_cursor {virtual table cursor} ** ** Every [virtual table module] implementation uses a subclass of the ** following structure to describe cursors that point into the ** [virtual table] and are used ** to loop through the virtual table. Cursors are created using the -** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed -** by the [sqlite3_module.xClose | xClose] method. Cursors are used +** [tdsqlite3_module.xOpen | xOpen] method of the module and are destroyed +** by the [tdsqlite3_module.xClose | xClose] method. Cursors are used ** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods ** of the module. Each module implementation will define ** the content of a cursor structure to suit its own needs. @@ -6947,8 +6947,8 @@ struct sqlite3_vtab { ** This superclass exists in order to define fields of the cursor that ** are common to all implementations. */ -struct sqlite3_vtab_cursor { - sqlite3_vtab *pVtab; /* Virtual table of this cursor */ +struct tdsqlite3_vtab_cursor { + tdsqlite3_vtab *pVtab; /* Virtual table of this cursor */ /* Virtual table implementations will typically add additional fields */ }; @@ -6960,11 +6960,11 @@ struct sqlite3_vtab_cursor { ** to declare the format (the names and datatypes of the columns) of ** the virtual tables they implement. */ -SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL); +SQLITE_API int tdsqlite3_declare_vtab(tdsqlite3*, const char *zSQL); /* ** CAPI3REF: Overload A Function For A Virtual Table -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^(Virtual tables can provide alternative implementations of functions ** using the [xFindFunction] method of the [virtual table module]. @@ -6979,7 +6979,7 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL); ** purpose is to be a placeholder function that can be overloaded ** by a [virtual table]. */ -SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg); +SQLITE_API int tdsqlite3_overload_function(tdsqlite3*, const char *zFuncName, int nArg); /* ** The interface to the virtual-table mechanism defined above (back up @@ -6996,19 +6996,19 @@ SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nA ** KEYWORDS: {BLOB handle} {BLOB handles} ** ** An instance of this object represents an open BLOB on which -** [sqlite3_blob_open | incremental BLOB I/O] can be performed. -** ^Objects of this type are created by [sqlite3_blob_open()] -** and destroyed by [sqlite3_blob_close()]. -** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces +** [tdsqlite3_blob_open | incremental BLOB I/O] can be performed. +** ^Objects of this type are created by [tdsqlite3_blob_open()] +** and destroyed by [tdsqlite3_blob_close()]. +** ^The [tdsqlite3_blob_read()] and [tdsqlite3_blob_write()] interfaces ** can be used to read or write small subsections of the BLOB. -** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes. +** ^The [tdsqlite3_blob_bytes()] interface returns the size of the BLOB in bytes. */ -typedef struct sqlite3_blob sqlite3_blob; +typedef struct tdsqlite3_blob tdsqlite3_blob; /* ** CAPI3REF: Open A BLOB For Incremental I/O -** METHOD: sqlite3 -** CONSTRUCTOR: sqlite3_blob +** METHOD: tdsqlite3 +** CONSTRUCTOR: tdsqlite3_blob ** ** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located ** in row iRow, column zColumn, table zTable in database zDb; @@ -7031,7 +7031,7 @@ typedef struct sqlite3_blob sqlite3_blob; ** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored ** in *ppBlob. Otherwise an [error code] is returned and, unless the error ** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided -** the API is not misused, it is always safe to call [sqlite3_blob_close()] +** the API is not misused, it is always safe to call [tdsqlite3_blob_close()] ** on *ppBlob after this function it returns. ** ** This function fails with SQLITE_ERROR if any of the following are true: @@ -7052,12 +7052,12 @@ typedef struct sqlite3_blob sqlite3_blob; ** ** ^Unless it returns SQLITE_MISUSE, this function sets the ** [database connection] error code and message accessible via -** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions. +** [tdsqlite3_errcode()] and [tdsqlite3_errmsg()] and related functions. ** -** A BLOB referenced by sqlite3_blob_open() may be read using the -** [sqlite3_blob_read()] interface and modified by using -** [sqlite3_blob_write()]. The [BLOB handle] can be moved to a -** different row of the same table using the [sqlite3_blob_reopen()] +** A BLOB referenced by tdsqlite3_blob_open() may be read using the +** [tdsqlite3_blob_read()] interface and modified by using +** [tdsqlite3_blob_write()]. The [BLOB handle] can be moved to a +** different row of the same table using the [tdsqlite3_blob_reopen()] ** interface. However, the column, table, or database of a [BLOB handle] ** cannot be changed after the [BLOB handle] is opened. ** @@ -7066,41 +7066,41 @@ typedef struct sqlite3_blob sqlite3_blob; ** then the BLOB handle is marked as "expired". ** This is true if any column of the row is changed, even a column ** other than the one the BLOB handle is open on.)^ -** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for +** ^Calls to [tdsqlite3_blob_read()] and [tdsqlite3_blob_write()] for ** an expired BLOB handle fail with a return code of [SQLITE_ABORT]. ** ^(Changes written into a BLOB prior to the BLOB expiring are not ** rolled back by the expiration of the BLOB. Such changes will eventually ** commit if the transaction continues to completion.)^ ** -** ^Use the [sqlite3_blob_bytes()] interface to determine the size of +** ^Use the [tdsqlite3_blob_bytes()] interface to determine the size of ** the opened blob. ^The size of a blob may not be changed by this ** interface. Use the [UPDATE] SQL command to change the size of a ** blob. ** -** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces +** ^The [tdsqlite3_bind_zeroblob()] and [tdsqlite3_result_zeroblob()] interfaces ** and the built-in [zeroblob] SQL function may be used to create a ** zero-filled blob to read or write using the incremental-blob interface. ** ** To avoid a resource leak, every open [BLOB handle] should eventually -** be released by a call to [sqlite3_blob_close()]. +** be released by a call to [tdsqlite3_blob_close()]. ** -** See also: [sqlite3_blob_close()], -** [sqlite3_blob_reopen()], [sqlite3_blob_read()], -** [sqlite3_blob_bytes()], [sqlite3_blob_write()]. +** See also: [tdsqlite3_blob_close()], +** [tdsqlite3_blob_reopen()], [tdsqlite3_blob_read()], +** [tdsqlite3_blob_bytes()], [tdsqlite3_blob_write()]. */ -SQLITE_API int sqlite3_blob_open( - sqlite3*, +SQLITE_API int tdsqlite3_blob_open( + tdsqlite3*, const char *zDb, const char *zTable, const char *zColumn, - sqlite3_int64 iRow, + tdsqlite3_int64 iRow, int flags, - sqlite3_blob **ppBlob + tdsqlite3_blob **ppBlob ); /* ** CAPI3REF: Move a BLOB Handle to a New Row -** METHOD: sqlite3_blob +** METHOD: tdsqlite3_blob ** ** ^This function is used to move an existing [BLOB handle] so that it points ** to a different row of the same database table. ^The new row is identified @@ -7109,23 +7109,23 @@ SQLITE_API int sqlite3_blob_open( ** remain the same. Moving an existing [BLOB handle] to a new row is ** faster than closing the existing handle and opening a new one. ** -** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] - +** ^(The new row must meet the same criteria as for [tdsqlite3_blob_open()] - ** it must exist and there must be either a blob or text value stored in ** the nominated column.)^ ^If the new row is not present in the table, or if ** it does not contain a blob or text value, or if another error occurs, an ** SQLite error code is returned and the blob handle is considered aborted. -** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or -** [sqlite3_blob_reopen()] on an aborted blob handle immediately return -** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle +** ^All subsequent calls to [tdsqlite3_blob_read()], [tdsqlite3_blob_write()] or +** [tdsqlite3_blob_reopen()] on an aborted blob handle immediately return +** SQLITE_ABORT. ^Calling [tdsqlite3_blob_bytes()] on an aborted blob handle ** always returns zero. ** ** ^This function sets the database handle error code and message. */ -SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); +SQLITE_API int tdsqlite3_blob_reopen(tdsqlite3_blob *, tdsqlite3_int64); /* ** CAPI3REF: Close A BLOB Handle -** DESTRUCTOR: sqlite3_blob +** DESTRUCTOR: tdsqlite3_blob ** ** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed ** unconditionally. Even if this routine returns an error code, the @@ -7140,15 +7140,15 @@ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); ** Calling this function with an argument that is not a NULL pointer or an ** open blob handle results in undefined behaviour. ^Calling this routine ** with a null pointer (such as would be returned by a failed call to -** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function +** [tdsqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function ** is passed a valid open blob handle, the values returned by the -** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning. +** tdsqlite3_errcode() and tdsqlite3_errmsg() functions are set before returning. */ -SQLITE_API int sqlite3_blob_close(sqlite3_blob *); +SQLITE_API int tdsqlite3_blob_close(tdsqlite3_blob *); /* ** CAPI3REF: Return The Size Of An Open BLOB -** METHOD: sqlite3_blob +** METHOD: tdsqlite3_blob ** ** ^Returns the size in bytes of the BLOB accessible via the ** successfully opened [BLOB handle] in its only argument. ^The @@ -7156,15 +7156,15 @@ SQLITE_API int sqlite3_blob_close(sqlite3_blob *); ** blob content; they cannot change the size of a blob. ** ** This routine only works on a [BLOB handle] which has been created -** by a prior successful call to [sqlite3_blob_open()] and which has not -** been closed by [sqlite3_blob_close()]. Passing any other pointer in +** by a prior successful call to [tdsqlite3_blob_open()] and which has not +** been closed by [tdsqlite3_blob_close()]. Passing any other pointer in ** to this routine results in undefined and probably undesirable behavior. */ -SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *); +SQLITE_API int tdsqlite3_blob_bytes(tdsqlite3_blob *); /* ** CAPI3REF: Read Data From A BLOB Incrementally -** METHOD: sqlite3_blob +** METHOD: tdsqlite3_blob ** ** ^(This function is used to read data from an open [BLOB handle] into a ** caller-supplied buffer. N bytes of data are copied into buffer Z @@ -7174,39 +7174,39 @@ SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *); ** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is ** less than zero, [SQLITE_ERROR] is returned and no data is read. ** ^The size of the blob (and hence the maximum value of N+iOffset) -** can be determined using the [sqlite3_blob_bytes()] interface. +** can be determined using the [tdsqlite3_blob_bytes()] interface. ** ** ^An attempt to read from an expired [BLOB handle] fails with an ** error code of [SQLITE_ABORT]. ** -** ^(On success, sqlite3_blob_read() returns SQLITE_OK. +** ^(On success, tdsqlite3_blob_read() returns SQLITE_OK. ** Otherwise, an [error code] or an [extended error code] is returned.)^ ** ** This routine only works on a [BLOB handle] which has been created -** by a prior successful call to [sqlite3_blob_open()] and which has not -** been closed by [sqlite3_blob_close()]. Passing any other pointer in +** by a prior successful call to [tdsqlite3_blob_open()] and which has not +** been closed by [tdsqlite3_blob_close()]. Passing any other pointer in ** to this routine results in undefined and probably undesirable behavior. ** -** See also: [sqlite3_blob_write()]. +** See also: [tdsqlite3_blob_write()]. */ -SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset); +SQLITE_API int tdsqlite3_blob_read(tdsqlite3_blob *, void *Z, int N, int iOffset); /* ** CAPI3REF: Write Data Into A BLOB Incrementally -** METHOD: sqlite3_blob +** METHOD: tdsqlite3_blob ** ** ^(This function is used to write data into an open [BLOB handle] from a ** caller-supplied buffer. N bytes of data are copied from the buffer Z ** into the open BLOB, starting at offset iOffset.)^ ** -** ^(On success, sqlite3_blob_write() returns SQLITE_OK. +** ^(On success, tdsqlite3_blob_write() returns SQLITE_OK. ** Otherwise, an [error code] or an [extended error code] is returned.)^ ** ^Unless SQLITE_MISUSE is returned, this function sets the ** [database connection] error code and message accessible via -** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions. +** [tdsqlite3_errcode()] and [tdsqlite3_errmsg()] and related functions. ** ** ^If the [BLOB handle] passed as the first argument was not opened for -** writing (the flags parameter to [sqlite3_blob_open()] was zero), +** writing (the flags parameter to [tdsqlite3_blob_open()] was zero), ** this function returns [SQLITE_READONLY]. ** ** This function may only modify the contents of the BLOB; it is @@ -7214,7 +7214,7 @@ SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset); ** ^If offset iOffset is less than N bytes from the end of the BLOB, ** [SQLITE_ERROR] is returned and no data is written. The size of the ** BLOB (and hence the maximum value of N+iOffset) can be determined -** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less +** using the [tdsqlite3_blob_bytes()] interface. ^If N or iOffset are less ** than zero [SQLITE_ERROR] is returned and no data is written. ** ** ^An attempt to write to an expired [BLOB handle] fails with an @@ -7225,31 +7225,31 @@ SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset); ** or by other independent statements. ** ** This routine only works on a [BLOB handle] which has been created -** by a prior successful call to [sqlite3_blob_open()] and which has not -** been closed by [sqlite3_blob_close()]. Passing any other pointer in +** by a prior successful call to [tdsqlite3_blob_open()] and which has not +** been closed by [tdsqlite3_blob_close()]. Passing any other pointer in ** to this routine results in undefined and probably undesirable behavior. ** -** See also: [sqlite3_blob_read()]. +** See also: [tdsqlite3_blob_read()]. */ -SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset); +SQLITE_API int tdsqlite3_blob_write(tdsqlite3_blob *, const void *z, int n, int iOffset); /* ** CAPI3REF: Virtual File System Objects ** -** A virtual filesystem (VFS) is an [sqlite3_vfs] object +** A virtual filesystem (VFS) is an [tdsqlite3_vfs] object ** that SQLite uses to interact ** with the underlying operating system. Most SQLite builds come with a ** single default VFS that is appropriate for the host computer. ** New VFSes can be registered and existing VFSes can be unregistered. ** The following interfaces are provided. ** -** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name. +** ^The tdsqlite3_vfs_find() interface returns a pointer to a VFS given its name. ** ^Names are case sensitive. ** ^Names are zero-terminated UTF-8 strings. ** ^If there is no match, a NULL pointer is returned. ** ^If zVfsName is NULL then the default VFS is returned. ** -** ^New VFSes are registered with sqlite3_vfs_register(). +** ^New VFSes are registered with tdsqlite3_vfs_register(). ** ^Each new VFS becomes the default VFS if the makeDflt flag is set. ** ^The same VFS can be registered multiple times without injury. ** ^To make an existing VFS into the default VFS, register it again @@ -7258,13 +7258,13 @@ SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOff ** VFS is registered with a name that is NULL or an empty string, ** then the behavior is undefined. ** -** ^Unregister a VFS with the sqlite3_vfs_unregister() interface. +** ^Unregister a VFS with the tdsqlite3_vfs_unregister() interface. ** ^(If the default VFS is unregistered, another VFS is chosen as ** the default. The choice for the new VFS is arbitrary.)^ */ -SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName); -SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt); -SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); +SQLITE_API tdsqlite3_vfs *tdsqlite3_vfs_find(const char *zVfsName); +SQLITE_API int tdsqlite3_vfs_register(tdsqlite3_vfs*, int makeDflt); +SQLITE_API int tdsqlite3_vfs_unregister(tdsqlite3_vfs*); /* ** CAPI3REF: Mutexes @@ -7295,14 +7295,14 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex ** implementation is included with the library. In this case the ** application must supply a custom mutex implementation using the -** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function -** before calling sqlite3_initialize() or any other public sqlite3_ -** function that calls sqlite3_initialize(). +** [SQLITE_CONFIG_MUTEX] option of the tdsqlite3_config() function +** before calling tdsqlite3_initialize() or any other public tdsqlite3_ +** function that calls tdsqlite3_initialize(). ** -** ^The sqlite3_mutex_alloc() routine allocates a new -** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc() +** ^The tdsqlite3_mutex_alloc() routine allocates a new +** mutex and returns a pointer to it. ^The tdsqlite3_mutex_alloc() ** routine returns NULL if it is unable to allocate the requested -** mutex. The argument to sqlite3_mutex_alloc() must one of these +** mutex. The argument to tdsqlite3_mutex_alloc() must one of these ** integer constants: ** **
    @@ -7323,7 +7323,7 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); **
** ** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) -** cause sqlite3_mutex_alloc() to create +** cause tdsqlite3_mutex_alloc() to create ** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE ** is used but not necessarily so when SQLITE_MUTEX_FAST is used. ** The mutex implementation does not need to make a distinction @@ -7333,7 +7333,7 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); ** implementation is available on the host platform, the mutex subsystem ** might return such a mutex in response to SQLITE_MUTEX_FAST. ** -** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other +** ^The other allowed parameters to tdsqlite3_mutex_alloc() (anything other ** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return ** a pointer to a static preexisting mutex. ^Nine static mutexes are ** used by the current version of SQLite. Future versions of SQLite @@ -7343,19 +7343,19 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); ** SQLITE_MUTEX_RECURSIVE. ** ** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST -** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() +** or SQLITE_MUTEX_RECURSIVE) is used then tdsqlite3_mutex_alloc() ** returns a different mutex on every call. ^For the static ** mutex types, the same mutex is returned on every call that has ** the same type number. ** -** ^The sqlite3_mutex_free() routine deallocates a previously +** ^The tdsqlite3_mutex_free() routine deallocates a previously ** allocated dynamic mutex. Attempting to deallocate a static ** mutex results in undefined behavior. ** -** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt +** ^The tdsqlite3_mutex_enter() and tdsqlite3_mutex_try() routines attempt ** to enter a mutex. ^If another thread is already within the mutex, -** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return -** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK] +** tdsqlite3_mutex_enter() will block and tdsqlite3_mutex_try() will return +** SQLITE_BUSY. ^The tdsqlite3_mutex_try() interface returns [SQLITE_OK] ** upon successful entry. ^(Mutexes created using ** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread. ** In such cases, the @@ -7364,27 +7364,27 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); ** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined. ** ** ^(Some systems (for example, Windows 95) do not support the operation -** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() +** implemented by tdsqlite3_mutex_try(). On those systems, tdsqlite3_mutex_try() ** will always return SQLITE_BUSY. The SQLite core only ever uses -** sqlite3_mutex_try() as an optimization so this is acceptable +** tdsqlite3_mutex_try() as an optimization so this is acceptable ** behavior.)^ ** -** ^The sqlite3_mutex_leave() routine exits a mutex that was +** ^The tdsqlite3_mutex_leave() routine exits a mutex that was ** previously entered by the same thread. The behavior ** is undefined if the mutex is not currently entered by the ** calling thread or is not currently allocated. ** -** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or -** sqlite3_mutex_leave() is a NULL pointer, then all three routines +** ^If the argument to tdsqlite3_mutex_enter(), tdsqlite3_mutex_try(), or +** tdsqlite3_mutex_leave() is a NULL pointer, then all three routines ** behave as no-ops. ** -** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()]. +** See also: [tdsqlite3_mutex_held()] and [tdsqlite3_mutex_notheld()]. */ -SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int); -SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*); -SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*); -SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*); -SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*); +SQLITE_API tdsqlite3_mutex *tdsqlite3_mutex_alloc(int); +SQLITE_API void tdsqlite3_mutex_free(tdsqlite3_mutex*); +SQLITE_API void tdsqlite3_mutex_enter(tdsqlite3_mutex*); +SQLITE_API int tdsqlite3_mutex_try(tdsqlite3_mutex*); +SQLITE_API void tdsqlite3_mutex_leave(tdsqlite3_mutex*); /* ** CAPI3REF: Mutex Methods Object @@ -7397,38 +7397,38 @@ SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*); ** implementation for specialized deployments or systems for which SQLite ** does not provide a suitable implementation. In this case, the application ** creates and populates an instance of this structure to pass -** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. +** to tdsqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. ** Additionally, an instance of this structure can be used as an ** output variable when querying the system for the current mutex ** implementation, using the [SQLITE_CONFIG_GETMUTEX] option. ** ** ^The xMutexInit method defined by this structure is invoked as -** part of system initialization by the sqlite3_initialize() function. +** part of system initialization by the tdsqlite3_initialize() function. ** ^The xMutexInit routine is called by SQLite exactly once for each -** effective call to [sqlite3_initialize()]. +** effective call to [tdsqlite3_initialize()]. ** ** ^The xMutexEnd method defined by this structure is invoked as -** part of system shutdown by the sqlite3_shutdown() function. The +** part of system shutdown by the tdsqlite3_shutdown() function. The ** implementation of this method is expected to release all outstanding ** resources obtained by the mutex methods implementation, especially ** those obtained by the xMutexInit method. ^The xMutexEnd() -** interface is invoked exactly once for each call to [sqlite3_shutdown()]. +** interface is invoked exactly once for each call to [tdsqlite3_shutdown()]. ** ** ^(The remaining seven methods defined by this structure (xMutexAlloc, ** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and ** xMutexNotheld) implement the following interfaces (respectively): ** **
    -**
  • [sqlite3_mutex_alloc()]
  • -**
  • [sqlite3_mutex_free()]
  • -**
  • [sqlite3_mutex_enter()]
  • -**
  • [sqlite3_mutex_try()]
  • -**
  • [sqlite3_mutex_leave()]
  • -**
  • [sqlite3_mutex_held()]
  • -**
  • [sqlite3_mutex_notheld()]
  • +**
  • [tdsqlite3_mutex_alloc()]
  • +**
  • [tdsqlite3_mutex_free()]
  • +**
  • [tdsqlite3_mutex_enter()]
  • +**
  • [tdsqlite3_mutex_try()]
  • +**
  • [tdsqlite3_mutex_leave()]
  • +**
  • [tdsqlite3_mutex_held()]
  • +**
  • [tdsqlite3_mutex_notheld()]
  • **
)^ ** -** The only difference is that the public sqlite3_XXX functions enumerated +** The only difference is that the public tdsqlite3_XXX functions enumerated ** above silently ignore any invocations that pass a NULL pointer instead ** of a valid mutex handle. The implementations of the methods defined ** by this structure are not required to handle this case. The results @@ -7441,33 +7441,33 @@ SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*); ** intervening calls to xMutexEnd(). Second and subsequent calls to ** xMutexInit() must be no-ops. ** -** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()] +** xMutexInit() must not use SQLite memory allocation ([tdsqlite3_malloc()] ** and its associates). Similarly, xMutexAlloc() must not use SQLite memory ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite ** memory allocation for a fast or recursive mutex. ** -** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is +** ^SQLite will invoke the xMutexEnd() method when [tdsqlite3_shutdown()] is ** called, but only if the prior call to xMutexInit returned SQLITE_OK. ** If xMutexInit fails in any way, it is expected to clean up after itself ** prior to returning. */ -typedef struct sqlite3_mutex_methods sqlite3_mutex_methods; -struct sqlite3_mutex_methods { +typedef struct tdsqlite3_mutex_methods tdsqlite3_mutex_methods; +struct tdsqlite3_mutex_methods { int (*xMutexInit)(void); int (*xMutexEnd)(void); - sqlite3_mutex *(*xMutexAlloc)(int); - void (*xMutexFree)(sqlite3_mutex *); - void (*xMutexEnter)(sqlite3_mutex *); - int (*xMutexTry)(sqlite3_mutex *); - void (*xMutexLeave)(sqlite3_mutex *); - int (*xMutexHeld)(sqlite3_mutex *); - int (*xMutexNotheld)(sqlite3_mutex *); + tdsqlite3_mutex *(*xMutexAlloc)(int); + void (*xMutexFree)(tdsqlite3_mutex *); + void (*xMutexEnter)(tdsqlite3_mutex *); + int (*xMutexTry)(tdsqlite3_mutex *); + void (*xMutexLeave)(tdsqlite3_mutex *); + int (*xMutexHeld)(tdsqlite3_mutex *); + int (*xMutexNotheld)(tdsqlite3_mutex *); }; /* ** CAPI3REF: Mutex Verification Routines ** -** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines +** The tdsqlite3_mutex_held() and tdsqlite3_mutex_notheld() routines ** are intended for use inside assert() statements. The SQLite core ** never uses these routines except inside an assert() and applications ** are advised to follow the lead of the core. The SQLite core only @@ -7484,24 +7484,24 @@ struct sqlite3_mutex_methods { ** versions of these routines, it should at least provide stubs that always ** return true so that one does not get spurious assertion failures. ** -** If the argument to sqlite3_mutex_held() is a NULL pointer then +** If the argument to tdsqlite3_mutex_held() is a NULL pointer then ** the routine should return 1. This seems counter-intuitive since ** clearly the mutex cannot be held if it does not exist. But ** the reason the mutex does not exist is because the build is not ** using mutexes. And we do not want the assert() containing the -** call to sqlite3_mutex_held() to fail, so a non-zero return is -** the appropriate thing to do. The sqlite3_mutex_notheld() +** call to tdsqlite3_mutex_held() to fail, so a non-zero return is +** the appropriate thing to do. The tdsqlite3_mutex_notheld() ** interface should also return 1 when given a NULL pointer. */ #ifndef NDEBUG -SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*); -SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*); +SQLITE_API int tdsqlite3_mutex_held(tdsqlite3_mutex*); +SQLITE_API int tdsqlite3_mutex_notheld(tdsqlite3_mutex*); #endif /* ** CAPI3REF: Mutex Types ** -** The [sqlite3_mutex_alloc()] interface takes a single argument +** The [tdsqlite3_mutex_alloc()] interface takes a single argument ** which is one of these integer constants. ** ** The set of static mutexes may change from one SQLite release to the @@ -7511,13 +7511,13 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*); #define SQLITE_MUTEX_FAST 0 #define SQLITE_MUTEX_RECURSIVE 1 #define SQLITE_MUTEX_STATIC_MASTER 2 -#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */ +#define SQLITE_MUTEX_STATIC_MEM 3 /* tdsqlite3_malloc() */ #define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */ -#define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */ -#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_randomness() */ +#define SQLITE_MUTEX_STATIC_OPEN 4 /* tdsqlite3BtreeOpen() */ +#define SQLITE_MUTEX_STATIC_PRNG 5 /* tdsqlite3_randomness() */ #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */ #define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */ -#define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */ +#define SQLITE_MUTEX_STATIC_PMEM 7 /* tdsqlite3PageMalloc() */ #define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */ #define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */ #define SQLITE_MUTEX_STATIC_APP3 10 /* For use by application */ @@ -7527,23 +7527,23 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*); /* ** CAPI3REF: Retrieve the mutex for a database connection -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^This interface returns a pointer the [sqlite3_mutex] object that +** ^This interface returns a pointer the [tdsqlite3_mutex] object that ** serializes access to the [database connection] given in the argument ** when the [threading mode] is Serialized. ** ^If the [threading mode] is Single-thread or Multi-thread then this ** routine returns a NULL pointer. */ -SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*); +SQLITE_API tdsqlite3_mutex *tdsqlite3_db_mutex(tdsqlite3*); /* ** CAPI3REF: Low-Level Control Of Database Files -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** KEYWORDS: {file control} ** -** ^The [sqlite3_file_control()] interface makes a direct call to the -** xFileControl method for the [sqlite3_io_methods] object associated +** ^The [tdsqlite3_file_control()] interface makes a direct call to the +** xFileControl method for the [tdsqlite3_io_methods] object associated ** with a particular database identified by the second argument. ^The ** name of the database is "main" for the main database or "temp" for the ** TEMP database, or the name that appears after the AS keyword for @@ -7555,35 +7555,35 @@ SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*); ** the xFileControl method. ^The return value of the xFileControl ** method becomes the return value of this routine. ** -** A few opcodes for [sqlite3_file_control()] are handled directly +** A few opcodes for [tdsqlite3_file_control()] are handled directly ** by the SQLite core and never invoke the -** sqlite3_io_methods.xFileControl method. +** tdsqlite3_io_methods.xFileControl method. ** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes -** a pointer to the underlying [sqlite3_file] object to be written into +** a pointer to the underlying [tdsqlite3_file] object to be written into ** the space pointed to by the 4th parameter. The ** [SQLITE_FCNTL_JOURNAL_POINTER] works similarly except that it returns -** the [sqlite3_file] object associated with the journal file instead of +** the [tdsqlite3_file] object associated with the journal file instead of ** the main database. The [SQLITE_FCNTL_VFS_POINTER] opcode returns -** a pointer to the underlying [sqlite3_vfs] object for the file. +** a pointer to the underlying [tdsqlite3_vfs] object for the file. ** The [SQLITE_FCNTL_DATA_VERSION] returns the data version counter ** from the pager. ** ** ^If the second parameter (zDbName) does not match the name of any ** open database file, then SQLITE_ERROR is returned. ^This error -** code is not remembered and will not be recalled by [sqlite3_errcode()] -** or [sqlite3_errmsg()]. The underlying xFileControl method might +** code is not remembered and will not be recalled by [tdsqlite3_errcode()] +** or [tdsqlite3_errmsg()]. The underlying xFileControl method might ** also return SQLITE_ERROR. There is no way to distinguish between ** an incorrect zDbName and an SQLITE_ERROR return from the underlying ** xFileControl method. ** ** See also: [file control opcodes] */ -SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*); +SQLITE_API int tdsqlite3_file_control(tdsqlite3*, const char *zDbName, int op, void*); /* ** CAPI3REF: Testing Interface ** -** ^The sqlite3_test_control() interface is used to read out internal +** ^The tdsqlite3_test_control() interface is used to read out internal ** state of SQLite and to inject faults into SQLite for testing ** purposes. ^The first parameter is an operation code that determines ** the number, meaning, and operation of all subsequent parameters. @@ -7597,18 +7597,18 @@ SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void* ** Unlike most of the SQLite API, this function is not guaranteed to ** operate consistently from one release to the next. */ -SQLITE_API int sqlite3_test_control(int op, ...); +SQLITE_API int tdsqlite3_test_control(int op, ...); /* ** CAPI3REF: Testing Interface Operation Codes ** ** These constants are the valid operation code parameters used -** as the first argument to [sqlite3_test_control()]. +** as the first argument to [tdsqlite3_test_control()]. ** ** These parameters and their meanings are subject to change ** without notice. These values are for testing purposes only. ** Applications should not use any of these parameters or the -** [sqlite3_test_control()] interface. +** [tdsqlite3_test_control()] interface. */ #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 @@ -7648,18 +7648,18 @@ SQLITE_API int sqlite3_test_control(int op, ...); ** whether or not a specific identifier needs to be escaped (for example, ** by enclosing in double-quotes) so as not to confuse the parser. ** -** The sqlite3_keyword_count() interface returns the number of distinct +** The tdsqlite3_keyword_count() interface returns the number of distinct ** keywords understood by SQLite. ** -** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and +** The tdsqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and ** makes *Z point to that keyword expressed as UTF8 and writes the number ** of bytes in the keyword into *L. The string that *Z points to is not -** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns +** zero-terminated. The tdsqlite3_keyword_name(N,Z,L) routine returns ** SQLITE_OK if N is within bounds and SQLITE_ERROR if not. If either Z ** or L are NULL or invalid pointers then calls to -** sqlite3_keyword_name(N,Z,L) result in undefined behavior. +** tdsqlite3_keyword_name(N,Z,L) result in undefined behavior. ** -** The sqlite3_keyword_check(Z,L) interface checks to see whether or not +** The tdsqlite3_keyword_check(Z,L) interface checks to see whether or not ** the L-byte UTF8 identifier that Z points to is a keyword, returning non-zero ** if it is and zero if not. ** @@ -7687,141 +7687,141 @@ SQLITE_API int sqlite3_test_control(int op, ...); ** SQLite is compiled with the [-DSQLITE_OMIT_VACUUM] option. Also, ** new keywords may be added to future releases of SQLite. */ -SQLITE_API int sqlite3_keyword_count(void); -SQLITE_API int sqlite3_keyword_name(int,const char**,int*); -SQLITE_API int sqlite3_keyword_check(const char*,int); +SQLITE_API int tdsqlite3_keyword_count(void); +SQLITE_API int tdsqlite3_keyword_name(int,const char**,int*); +SQLITE_API int tdsqlite3_keyword_check(const char*,int); /* ** CAPI3REF: Dynamic String Object ** KEYWORDS: {dynamic string} ** -** An instance of the sqlite3_str object contains a dynamically-sized +** An instance of the tdsqlite3_str object contains a dynamically-sized ** string under construction. ** -** The lifecycle of an sqlite3_str object is as follows: +** The lifecycle of an tdsqlite3_str object is as follows: **
    -**
  1. ^The sqlite3_str object is created using [sqlite3_str_new()]. -**
  2. ^Text is appended to the sqlite3_str object using various -** methods, such as [sqlite3_str_appendf()]. -**
  3. ^The sqlite3_str object is destroyed and the string it created -** is returned using the [sqlite3_str_finish()] interface. +**
  4. ^The tdsqlite3_str object is created using [tdsqlite3_str_new()]. +**
  5. ^Text is appended to the tdsqlite3_str object using various +** methods, such as [tdsqlite3_str_appendf()]. +**
  6. ^The tdsqlite3_str object is destroyed and the string it created +** is returned using the [tdsqlite3_str_finish()] interface. **
*/ -typedef struct sqlite3_str sqlite3_str; +typedef struct tdsqlite3_str tdsqlite3_str; /* ** CAPI3REF: Create A New Dynamic String Object -** CONSTRUCTOR: sqlite3_str +** CONSTRUCTOR: tdsqlite3_str ** -** ^The [sqlite3_str_new(D)] interface allocates and initializes -** a new [sqlite3_str] object. To avoid memory leaks, the object returned by -** [sqlite3_str_new()] must be freed by a subsequent call to -** [sqlite3_str_finish(X)]. +** ^The [tdsqlite3_str_new(D)] interface allocates and initializes +** a new [tdsqlite3_str] object. To avoid memory leaks, the object returned by +** [tdsqlite3_str_new()] must be freed by a subsequent call to +** [tdsqlite3_str_finish(X)]. ** -** ^The [sqlite3_str_new(D)] interface always returns a pointer to a -** valid [sqlite3_str] object, though in the event of an out-of-memory +** ^The [tdsqlite3_str_new(D)] interface always returns a pointer to a +** valid [tdsqlite3_str] object, though in the event of an out-of-memory ** error the returned object might be a special singleton that will ** silently reject new text, always return SQLITE_NOMEM from -** [sqlite3_str_errcode()], always return 0 for -** [sqlite3_str_length()], and always return NULL from -** [sqlite3_str_finish(X)]. It is always safe to use the value -** returned by [sqlite3_str_new(D)] as the sqlite3_str parameter -** to any of the other [sqlite3_str] methods. +** [tdsqlite3_str_errcode()], always return 0 for +** [tdsqlite3_str_length()], and always return NULL from +** [tdsqlite3_str_finish(X)]. It is always safe to use the value +** returned by [tdsqlite3_str_new(D)] as the tdsqlite3_str parameter +** to any of the other [tdsqlite3_str] methods. ** -** The D parameter to [sqlite3_str_new(D)] may be NULL. If the -** D parameter in [sqlite3_str_new(D)] is not NULL, then the maximum -** length of the string contained in the [sqlite3_str] object will be -** the value set for [sqlite3_limit](D,[SQLITE_LIMIT_LENGTH]) instead +** The D parameter to [tdsqlite3_str_new(D)] may be NULL. If the +** D parameter in [tdsqlite3_str_new(D)] is not NULL, then the maximum +** length of the string contained in the [tdsqlite3_str] object will be +** the value set for [tdsqlite3_limit](D,[SQLITE_LIMIT_LENGTH]) instead ** of [SQLITE_MAX_LENGTH]. */ -SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3*); +SQLITE_API tdsqlite3_str *tdsqlite3_str_new(tdsqlite3*); /* ** CAPI3REF: Finalize A Dynamic String -** DESTRUCTOR: sqlite3_str +** DESTRUCTOR: tdsqlite3_str ** -** ^The [sqlite3_str_finish(X)] interface destroys the sqlite3_str object X -** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()] +** ^The [tdsqlite3_str_finish(X)] interface destroys the tdsqlite3_str object X +** and returns a pointer to a memory buffer obtained from [tdsqlite3_malloc64()] ** that contains the constructed string. The calling application should -** pass the returned value to [sqlite3_free()] to avoid a memory leak. -** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any +** pass the returned value to [tdsqlite3_free()] to avoid a memory leak. +** ^The [tdsqlite3_str_finish(X)] interface may return a NULL pointer if any ** errors were encountered during construction of the string. ^The -** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the -** string in [sqlite3_str] object X is zero bytes long. +** [tdsqlite3_str_finish(X)] interface will also return a NULL pointer if the +** string in [tdsqlite3_str] object X is zero bytes long. */ -SQLITE_API char *sqlite3_str_finish(sqlite3_str*); +SQLITE_API char *tdsqlite3_str_finish(tdsqlite3_str*); /* ** CAPI3REF: Add Content To A Dynamic String -** METHOD: sqlite3_str +** METHOD: tdsqlite3_str ** -** These interfaces add content to an sqlite3_str object previously obtained -** from [sqlite3_str_new()]. +** These interfaces add content to an tdsqlite3_str object previously obtained +** from [tdsqlite3_str_new()]. ** -** ^The [sqlite3_str_appendf(X,F,...)] and -** [sqlite3_str_vappendf(X,F,V)] interfaces uses the [built-in printf] +** ^The [tdsqlite3_str_appendf(X,F,...)] and +** [tdsqlite3_str_vappendf(X,F,V)] interfaces uses the [built-in printf] ** functionality of SQLite to append formatted text onto the end of -** [sqlite3_str] object X. +** [tdsqlite3_str] object X. ** -** ^The [sqlite3_str_append(X,S,N)] method appends exactly N bytes from string S -** onto the end of the [sqlite3_str] object X. N must be non-negative. +** ^The [tdsqlite3_str_append(X,S,N)] method appends exactly N bytes from string S +** onto the end of the [tdsqlite3_str] object X. N must be non-negative. ** S must contain at least N non-zero bytes of content. To append a -** zero-terminated string in its entirety, use the [sqlite3_str_appendall()] +** zero-terminated string in its entirety, use the [tdsqlite3_str_appendall()] ** method instead. ** -** ^The [sqlite3_str_appendall(X,S)] method appends the complete content of -** zero-terminated string S onto the end of [sqlite3_str] object X. +** ^The [tdsqlite3_str_appendall(X,S)] method appends the complete content of +** zero-terminated string S onto the end of [tdsqlite3_str] object X. ** -** ^The [sqlite3_str_appendchar(X,N,C)] method appends N copies of the -** single-byte character C onto the end of [sqlite3_str] object X. +** ^The [tdsqlite3_str_appendchar(X,N,C)] method appends N copies of the +** single-byte character C onto the end of [tdsqlite3_str] object X. ** ^This method can be used, for example, to add whitespace indentation. ** -** ^The [sqlite3_str_reset(X)] method resets the string under construction -** inside [sqlite3_str] object X back to zero bytes in length. +** ^The [tdsqlite3_str_reset(X)] method resets the string under construction +** inside [tdsqlite3_str] object X back to zero bytes in length. ** ** These methods do not return a result code. ^If an error occurs, that fact -** is recorded in the [sqlite3_str] object and can be recovered by a -** subsequent call to [sqlite3_str_errcode(X)]. +** is recorded in the [tdsqlite3_str] object and can be recovered by a +** subsequent call to [tdsqlite3_str_errcode(X)]. */ -SQLITE_API void sqlite3_str_appendf(sqlite3_str*, const char *zFormat, ...); -SQLITE_API void sqlite3_str_vappendf(sqlite3_str*, const char *zFormat, va_list); -SQLITE_API void sqlite3_str_append(sqlite3_str*, const char *zIn, int N); -SQLITE_API void sqlite3_str_appendall(sqlite3_str*, const char *zIn); -SQLITE_API void sqlite3_str_appendchar(sqlite3_str*, int N, char C); -SQLITE_API void sqlite3_str_reset(sqlite3_str*); +SQLITE_API void tdsqlite3_str_appendf(tdsqlite3_str*, const char *zFormat, ...); +SQLITE_API void tdsqlite3_str_vappendf(tdsqlite3_str*, const char *zFormat, va_list); +SQLITE_API void tdsqlite3_str_append(tdsqlite3_str*, const char *zIn, int N); +SQLITE_API void tdsqlite3_str_appendall(tdsqlite3_str*, const char *zIn); +SQLITE_API void tdsqlite3_str_appendchar(tdsqlite3_str*, int N, char C); +SQLITE_API void tdsqlite3_str_reset(tdsqlite3_str*); /* ** CAPI3REF: Status Of A Dynamic String -** METHOD: sqlite3_str +** METHOD: tdsqlite3_str ** -** These interfaces return the current status of an [sqlite3_str] object. +** These interfaces return the current status of an [tdsqlite3_str] object. ** ** ^If any prior errors have occurred while constructing the dynamic string -** in sqlite3_str X, then the [sqlite3_str_errcode(X)] method will return -** an appropriate error code. ^The [sqlite3_str_errcode(X)] method returns +** in tdsqlite3_str X, then the [tdsqlite3_str_errcode(X)] method will return +** an appropriate error code. ^The [tdsqlite3_str_errcode(X)] method returns ** [SQLITE_NOMEM] following any out-of-memory error, or ** [SQLITE_TOOBIG] if the size of the dynamic string exceeds ** [SQLITE_MAX_LENGTH], or [SQLITE_OK] if there have been no errors. ** -** ^The [sqlite3_str_length(X)] method returns the current length, in bytes, -** of the dynamic string under construction in [sqlite3_str] object X. -** ^The length returned by [sqlite3_str_length(X)] does not include the +** ^The [tdsqlite3_str_length(X)] method returns the current length, in bytes, +** of the dynamic string under construction in [tdsqlite3_str] object X. +** ^The length returned by [tdsqlite3_str_length(X)] does not include the ** zero-termination byte. ** -** ^The [sqlite3_str_value(X)] method returns a pointer to the current +** ^The [tdsqlite3_str_value(X)] method returns a pointer to the current ** content of the dynamic string under construction in X. The value -** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X +** returned by [tdsqlite3_str_value(X)] is managed by the tdsqlite3_str object X ** and might be freed or altered by any subsequent method on the same -** [sqlite3_str] object. Applications must not used the pointer returned -** [sqlite3_str_value(X)] after any subsequent method call on the same +** [tdsqlite3_str] object. Applications must not used the pointer returned +** [tdsqlite3_str_value(X)] after any subsequent method call on the same ** object. ^Applications may change the content of the string returned -** by [sqlite3_str_value(X)] as long as they do not write into any bytes -** outside the range of 0 to [sqlite3_str_length(X)] and do not read or -** write any byte after any subsequent sqlite3_str method call. +** by [tdsqlite3_str_value(X)] as long as they do not write into any bytes +** outside the range of 0 to [tdsqlite3_str_length(X)] and do not read or +** write any byte after any subsequent tdsqlite3_str method call. */ -SQLITE_API int sqlite3_str_errcode(sqlite3_str*); -SQLITE_API int sqlite3_str_length(sqlite3_str*); -SQLITE_API char *sqlite3_str_value(sqlite3_str*); +SQLITE_API int tdsqlite3_str_errcode(tdsqlite3_str*); +SQLITE_API int tdsqlite3_str_length(tdsqlite3_str*); +SQLITE_API char *tdsqlite3_str_value(tdsqlite3_str*); /* ** CAPI3REF: SQLite Runtime Status @@ -7840,20 +7840,20 @@ SQLITE_API char *sqlite3_str_value(sqlite3_str*); ** ^(Other parameters record only the highwater mark and not the current ** value. For these latter parameters nothing is written into *pCurrent.)^ ** -** ^The sqlite3_status() and sqlite3_status64() routines return +** ^The tdsqlite3_status() and tdsqlite3_status64() routines return ** SQLITE_OK on success and a non-zero [error code] on failure. ** ** If either the current value or the highwater mark is too large to ** be represented by a 32-bit integer, then the values returned by -** sqlite3_status() are undefined. +** tdsqlite3_status() are undefined. ** -** See also: [sqlite3_db_status()] +** See also: [tdsqlite3_db_status()] */ -SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag); -SQLITE_API int sqlite3_status64( +SQLITE_API int tdsqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag); +SQLITE_API int tdsqlite3_status64( int op, - sqlite3_int64 *pCurrent, - sqlite3_int64 *pHighwater, + tdsqlite3_int64 *pCurrent, + tdsqlite3_int64 *pHighwater, int resetFlag ); @@ -7863,23 +7863,23 @@ SQLITE_API int sqlite3_status64( ** KEYWORDS: {status parameters} ** ** These integer constants designate various run-time status parameters -** that can be returned by [sqlite3_status()]. +** that can be returned by [tdsqlite3_status()]. ** **
** [[SQLITE_STATUS_MEMORY_USED]] ^(
SQLITE_STATUS_MEMORY_USED
**
This parameter is the current amount of memory checked out -** using [sqlite3_malloc()], either directly or indirectly. The -** figure includes calls made to [sqlite3_malloc()] by the application +** using [tdsqlite3_malloc()], either directly or indirectly. The +** figure includes calls made to [tdsqlite3_malloc()] by the application ** and internal memory usage by the SQLite library. Auxiliary page-cache ** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in ** this parameter. The amount returned is the sum of the allocation -** sizes as reported by the xSize method in [sqlite3_mem_methods].
)^ +** sizes as reported by the xSize method in [tdsqlite3_mem_methods].
)^ ** ** [[SQLITE_STATUS_MALLOC_SIZE]] ^(
SQLITE_STATUS_MALLOC_SIZE
**
This parameter records the largest memory allocation request -** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their +** handed to [tdsqlite3_malloc()] or [tdsqlite3_realloc()] (or their ** internal equivalents). Only the value returned in the -** *pHighwater parameter to [sqlite3_status()] is of interest. +** *pHighwater parameter to [tdsqlite3_status()] is of interest. ** The value written into the *pCurrent parameter is undefined.
)^ ** ** [[SQLITE_STATUS_MALLOC_COUNT]] ^(
SQLITE_STATUS_MALLOC_COUNT
@@ -7896,7 +7896,7 @@ SQLITE_API int sqlite3_status64( ** ^(
SQLITE_STATUS_PAGECACHE_OVERFLOW
**
This parameter returns the number of bytes of page cache ** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE] -** buffer and where forced to overflow to [sqlite3_malloc()]. The +** buffer and where forced to overflow to [tdsqlite3_malloc()]. The ** returned value includes allocations that overflowed because they ** where too large (they were larger than the "sz" parameter to ** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because @@ -7905,7 +7905,7 @@ SQLITE_API int sqlite3_status64( ** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(
SQLITE_STATUS_PAGECACHE_SIZE
**
This parameter records the largest memory allocation request ** handed to the [pagecache memory allocator]. Only the value returned in the -** *pHighwater parameter to [sqlite3_status()] is of interest. +** *pHighwater parameter to [tdsqlite3_status()] is of interest. ** The value written into the *pCurrent parameter is undefined.
)^ ** ** [[SQLITE_STATUS_SCRATCH_USED]]
SQLITE_STATUS_SCRATCH_USED
@@ -7938,7 +7938,7 @@ SQLITE_API int sqlite3_status64( /* ** CAPI3REF: Database Connection Status -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^This interface is used to retrieve runtime status information ** about a single [database connection]. ^The first argument is the @@ -7954,24 +7954,24 @@ SQLITE_API int sqlite3_status64( ** the resetFlg is true, then the highest instantaneous value is ** reset back down to the current value. ** -** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a +** ^The tdsqlite3_db_status() routine returns SQLITE_OK on success and a ** non-zero [error code] on failure. ** -** See also: [sqlite3_status()] and [sqlite3_stmt_status()]. +** See also: [tdsqlite3_status()] and [tdsqlite3_stmt_status()]. */ -SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg); +SQLITE_API int tdsqlite3_db_status(tdsqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg); /* ** CAPI3REF: Status Parameters for database connections ** KEYWORDS: {SQLITE_DBSTATUS options} ** ** These constants are the available integer "verbs" that can be passed as -** the second argument to the [sqlite3_db_status()] interface. +** the second argument to the [tdsqlite3_db_status()] interface. ** ** New verbs may be added in future releases of SQLite. Existing verbs ** might be discontinued. Applications should check the return code from -** [sqlite3_db_status()] to make sure that the call worked. -** The [sqlite3_db_status()] interface will return a non-zero error code +** [tdsqlite3_db_status()] to make sure that the call worked. +** The [tdsqlite3_db_status()] interface will return a non-zero error code ** if a discontinued or unsupported verb is invoked. ** **
@@ -8090,7 +8090,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r /* ** CAPI3REF: Prepared Statement Status -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** ** ^(Each prepared statement maintains various ** [SQLITE_STMTSTATUS counters] that measure the number @@ -8110,16 +8110,16 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r ** ^If the resetFlg is true, then the counter is reset to zero after this ** interface call returns. ** -** See also: [sqlite3_status()] and [sqlite3_db_status()]. +** See also: [tdsqlite3_status()] and [tdsqlite3_db_status()]. */ -SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); +SQLITE_API int tdsqlite3_stmt_status(tdsqlite3_stmt*, int op,int resetFlg); /* ** CAPI3REF: Status Parameters for prepared statements ** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters} ** ** These preprocessor macros define integer codes that name counter -** values associated with the [sqlite3_stmt_status()] interface. +** values associated with the [tdsqlite3_stmt_status()] interface. ** The meanings of the various counters are as follows: ** **
@@ -8157,14 +8157,14 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); ** [[SQLITE_STMTSTATUS_RUN]]
SQLITE_STMTSTATUS_RUN
**
^This is the number of times that the prepared statement has ** been run. A single "run" for the purposes of this counter is one -** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()]. -** The counter is incremented on the first [sqlite3_step()] call of each +** or more calls to [tdsqlite3_step()] followed by a call to [tdsqlite3_reset()]. +** The counter is incremented on the first [tdsqlite3_step()] call of each ** cycle. ** ** [[SQLITE_STMTSTATUS_MEMUSED]]
SQLITE_STMTSTATUS_MEMUSED
**
^This is the approximate number of bytes of heap memory ** used to store the prepared statement. ^This value is not actually -** a counter, and so the resetFlg parameter to sqlite3_stmt_status() +** a counter, and so the resetFlg parameter to tdsqlite3_stmt_status() ** is ignored when the opcode is SQLITE_STMTSTATUS_MEMUSED. **
**
@@ -8180,28 +8180,28 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); /* ** CAPI3REF: Custom Page Cache Object ** -** The sqlite3_pcache type is opaque. It is implemented by +** The tdsqlite3_pcache type is opaque. It is implemented by ** the pluggable module. The SQLite core has no knowledge of ** its size or internal structure and never deals with the -** sqlite3_pcache object except by holding and passing pointers +** tdsqlite3_pcache object except by holding and passing pointers ** to the object. ** -** See [sqlite3_pcache_methods2] for additional information. +** See [tdsqlite3_pcache_methods2] for additional information. */ -typedef struct sqlite3_pcache sqlite3_pcache; +typedef struct tdsqlite3_pcache tdsqlite3_pcache; /* ** CAPI3REF: Custom Page Cache Object ** -** The sqlite3_pcache_page object represents a single page in the +** The tdsqlite3_pcache_page object represents a single page in the ** page cache. The page cache will allocate instances of this ** object. Various methods of the page cache use pointers to instances ** of this object as parameters or as their return value. ** -** See [sqlite3_pcache_methods2] for additional information. +** See [tdsqlite3_pcache_methods2] for additional information. */ -typedef struct sqlite3_pcache_page sqlite3_pcache_page; -struct sqlite3_pcache_page { +typedef struct tdsqlite3_pcache_page tdsqlite3_pcache_page; +struct tdsqlite3_pcache_page { void *pBuf; /* The content of the page */ void *pExtra; /* Extra information associated with the page */ }; @@ -8210,9 +8210,9 @@ struct sqlite3_pcache_page { ** CAPI3REF: Application Defined Page Cache. ** KEYWORDS: {page cache} ** -** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can +** ^(The [tdsqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can ** register an alternative page cache implementation by passing in an -** instance of the sqlite3_pcache_methods2 structure.)^ +** instance of the tdsqlite3_pcache_methods2 structure.)^ ** In many applications, most of the heap memory allocated by ** SQLite is used for the page cache. ** By implementing a @@ -8226,16 +8226,16 @@ struct sqlite3_pcache_page { ** extreme measure that is only needed by the most demanding applications. ** The built-in page cache is recommended for most uses. ** -** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an -** internal buffer by SQLite within the call to [sqlite3_config]. Hence +** ^(The contents of the tdsqlite3_pcache_methods2 structure are copied to an +** internal buffer by SQLite within the call to [tdsqlite3_config]. Hence ** the application may discard the parameter after the call to -** [sqlite3_config()] returns.)^ +** [tdsqlite3_config()] returns.)^ ** ** [[the xInit() page cache method]] ** ^(The xInit() method is called once for each effective -** call to [sqlite3_initialize()])^ +** call to [tdsqlite3_initialize()])^ ** (usually only once during the lifetime of the process). ^(The xInit() -** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^ +** method is passed a copy of the tdsqlite3_pcache_methods2.pArg value.)^ ** The intent of the xInit() method is to set up global data structures ** required by the custom page cache implementation. ** ^(If the xInit() method is NULL, then the @@ -8243,14 +8243,14 @@ struct sqlite3_pcache_page { ** page cache.)^ ** ** [[the xShutdown() page cache method]] -** ^The xShutdown() method is called by [sqlite3_shutdown()]. +** ^The xShutdown() method is called by [tdsqlite3_shutdown()]. ** It can be used to clean up ** any outstanding resources before process shutdown, if required. ** ^The xShutdown() method may be NULL. ** ** ^SQLite automatically serializes calls to the xInit method, ** so the xInit method need not be threadsafe. ^The -** xShutdown method is only called from [sqlite3_shutdown()] so it does +** xShutdown method is only called from [tdsqlite3_shutdown()] so it does ** not need to be threadsafe either. All other methods must be threadsafe ** in multithreaded applications. ** @@ -8294,10 +8294,10 @@ struct sqlite3_pcache_page { ** ** [[the xFetch() page cache methods]] ** The xFetch() method locates a page in the cache and returns a pointer to -** an sqlite3_pcache_page object associated with that page, or a NULL pointer. -** The pBuf element of the returned sqlite3_pcache_page object will be a +** an tdsqlite3_pcache_page object associated with that page, or a NULL pointer. +** The pBuf element of the returned tdsqlite3_pcache_page object will be a ** pointer to a buffer of szPage bytes used to store the content of a -** single database page. The pExtra element of sqlite3_pcache_page will be +** single database page. The pExtra element of tdsqlite3_pcache_page will be ** a pointer to the szExtra bytes of extra storage that SQLite has requested ** for each entry in the page cache. ** @@ -8355,8 +8355,8 @@ struct sqlite3_pcache_page { ** [[the xDestroy() page cache method]] ** ^The xDestroy() method is used to delete a cache allocated by xCreate(). ** All resources associated with the specified cache should be freed. ^After -** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] -** handle invalid, and will not use it with any other sqlite3_pcache_methods2 +** calling the xDestroy() method, SQLite considers the [tdsqlite3_pcache*] +** handle invalid, and will not use it with any other tdsqlite3_pcache_methods2 ** functions. ** ** [[the xShrink() page cache method]] @@ -8365,56 +8365,56 @@ struct sqlite3_pcache_page { ** is not obligated to free any memory, but well-behaved implementations should ** do their best. */ -typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2; -struct sqlite3_pcache_methods2 { +typedef struct tdsqlite3_pcache_methods2 tdsqlite3_pcache_methods2; +struct tdsqlite3_pcache_methods2 { int iVersion; void *pArg; int (*xInit)(void*); void (*xShutdown)(void*); - sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable); - void (*xCachesize)(sqlite3_pcache*, int nCachesize); - int (*xPagecount)(sqlite3_pcache*); - sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); - void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard); - void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, + tdsqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable); + void (*xCachesize)(tdsqlite3_pcache*, int nCachesize); + int (*xPagecount)(tdsqlite3_pcache*); + tdsqlite3_pcache_page *(*xFetch)(tdsqlite3_pcache*, unsigned key, int createFlag); + void (*xUnpin)(tdsqlite3_pcache*, tdsqlite3_pcache_page*, int discard); + void (*xRekey)(tdsqlite3_pcache*, tdsqlite3_pcache_page*, unsigned oldKey, unsigned newKey); - void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); - void (*xDestroy)(sqlite3_pcache*); - void (*xShrink)(sqlite3_pcache*); + void (*xTruncate)(tdsqlite3_pcache*, unsigned iLimit); + void (*xDestroy)(tdsqlite3_pcache*); + void (*xShrink)(tdsqlite3_pcache*); }; /* ** This is the obsolete pcache_methods object that has now been replaced -** by sqlite3_pcache_methods2. This object is not used by SQLite. It is +** by tdsqlite3_pcache_methods2. This object is not used by SQLite. It is ** retained in the header file for backwards compatibility only. */ -typedef struct sqlite3_pcache_methods sqlite3_pcache_methods; -struct sqlite3_pcache_methods { +typedef struct tdsqlite3_pcache_methods tdsqlite3_pcache_methods; +struct tdsqlite3_pcache_methods { void *pArg; int (*xInit)(void*); void (*xShutdown)(void*); - sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable); - void (*xCachesize)(sqlite3_pcache*, int nCachesize); - int (*xPagecount)(sqlite3_pcache*); - void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); - void (*xUnpin)(sqlite3_pcache*, void*, int discard); - void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey); - void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); - void (*xDestroy)(sqlite3_pcache*); + tdsqlite3_pcache *(*xCreate)(int szPage, int bPurgeable); + void (*xCachesize)(tdsqlite3_pcache*, int nCachesize); + int (*xPagecount)(tdsqlite3_pcache*); + void *(*xFetch)(tdsqlite3_pcache*, unsigned key, int createFlag); + void (*xUnpin)(tdsqlite3_pcache*, void*, int discard); + void (*xRekey)(tdsqlite3_pcache*, void*, unsigned oldKey, unsigned newKey); + void (*xTruncate)(tdsqlite3_pcache*, unsigned iLimit); + void (*xDestroy)(tdsqlite3_pcache*); }; /* ** CAPI3REF: Online Backup Object ** -** The sqlite3_backup object records state information about an ongoing -** online backup operation. ^The sqlite3_backup object is created by -** a call to [sqlite3_backup_init()] and is destroyed by a call to -** [sqlite3_backup_finish()]. +** The tdsqlite3_backup object records state information about an ongoing +** online backup operation. ^The tdsqlite3_backup object is created by +** a call to [tdsqlite3_backup_init()] and is destroyed by a call to +** [tdsqlite3_backup_finish()]. ** ** See Also: [Using the SQLite Online Backup API] */ -typedef struct sqlite3_backup sqlite3_backup; +typedef struct tdsqlite3_backup tdsqlite3_backup; /* ** CAPI3REF: Online Backup API. @@ -8435,63 +8435,63 @@ typedef struct sqlite3_backup sqlite3_backup; ** ** ^(To perform a backup operation: **
    -**
  1. sqlite3_backup_init() is called once to initialize the +**
  2. tdsqlite3_backup_init() is called once to initialize the ** backup, -**
  3. sqlite3_backup_step() is called one or more times to transfer +**
  4. tdsqlite3_backup_step() is called one or more times to transfer ** the data between the two databases, and finally -**
  5. sqlite3_backup_finish() is called to release all resources +**
  6. tdsqlite3_backup_finish() is called to release all resources ** associated with the backup operation. **
)^ -** There should be exactly one call to sqlite3_backup_finish() for each -** successful call to sqlite3_backup_init(). +** There should be exactly one call to tdsqlite3_backup_finish() for each +** successful call to tdsqlite3_backup_init(). ** -** [[sqlite3_backup_init()]] sqlite3_backup_init() +** [[tdsqlite3_backup_init()]] tdsqlite3_backup_init() ** -** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the +** ^The D and N arguments to tdsqlite3_backup_init(D,N,S,M) are the ** [database connection] associated with the destination database ** and the database name, respectively. ** ^The database name is "main" for the main database, "temp" for the ** temporary database, or the name specified after the AS keyword in ** an [ATTACH] statement for an attached database. ** ^The S and M arguments passed to -** sqlite3_backup_init(D,N,S,M) identify the [database connection] +** tdsqlite3_backup_init(D,N,S,M) identify the [database connection] ** and database name of the source database, respectively. ** ^The source and destination [database connections] (parameters S and D) -** must be different or else sqlite3_backup_init(D,N,S,M) will fail with +** must be different or else tdsqlite3_backup_init(D,N,S,M) will fail with ** an error. ** -** ^A call to sqlite3_backup_init() will fail, returning NULL, if +** ^A call to tdsqlite3_backup_init() will fail, returning NULL, if ** there is already a read or read-write transaction open on the ** destination database. ** -** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is +** ^If an error occurs within tdsqlite3_backup_init(D,N,S,M), then NULL is ** returned and an error code and error message are stored in the ** destination [database connection] D. -** ^The error code and message for the failed call to sqlite3_backup_init() -** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or -** [sqlite3_errmsg16()] functions. -** ^A successful call to sqlite3_backup_init() returns a pointer to an -** [sqlite3_backup] object. -** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and -** sqlite3_backup_finish() functions to perform the specified backup +** ^The error code and message for the failed call to tdsqlite3_backup_init() +** can be retrieved using the [tdsqlite3_errcode()], [tdsqlite3_errmsg()], and/or +** [tdsqlite3_errmsg16()] functions. +** ^A successful call to tdsqlite3_backup_init() returns a pointer to an +** [tdsqlite3_backup] object. +** ^The [tdsqlite3_backup] object may be used with the tdsqlite3_backup_step() and +** tdsqlite3_backup_finish() functions to perform the specified backup ** operation. ** -** [[sqlite3_backup_step()]] sqlite3_backup_step() +** [[tdsqlite3_backup_step()]] tdsqlite3_backup_step() ** -** ^Function sqlite3_backup_step(B,N) will copy up to N pages between -** the source and destination databases specified by [sqlite3_backup] object B. +** ^Function tdsqlite3_backup_step(B,N) will copy up to N pages between +** the source and destination databases specified by [tdsqlite3_backup] object B. ** ^If N is negative, all remaining source pages are copied. -** ^If sqlite3_backup_step(B,N) successfully copies N pages and there +** ^If tdsqlite3_backup_step(B,N) successfully copies N pages and there ** are still more pages to be copied, then the function returns [SQLITE_OK]. -** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages +** ^If tdsqlite3_backup_step(B,N) successfully finishes copying all pages ** from source to destination, then it returns [SQLITE_DONE]. -** ^If an error occurs while running sqlite3_backup_step(B,N), +** ^If an error occurs while running tdsqlite3_backup_step(B,N), ** then an [error code] is returned. ^As well as [SQLITE_OK] and -** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY], +** [SQLITE_DONE], a call to tdsqlite3_backup_step() may return [SQLITE_READONLY], ** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an ** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code. ** -** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if +** ^(The tdsqlite3_backup_step() might return [SQLITE_READONLY] if **
    **
  1. the destination database was opened read-only, or **
  2. the destination database is using write-ahead-log journaling @@ -8500,76 +8500,76 @@ typedef struct sqlite3_backup sqlite3_backup; ** destination and source page sizes differ. **
)^ ** -** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then -** the [sqlite3_busy_handler | busy-handler function] +** ^If tdsqlite3_backup_step() cannot obtain a required file-system lock, then +** the [tdsqlite3_busy_handler | busy-handler function] ** is invoked (if one is specified). ^If the ** busy-handler returns non-zero before the lock is available, then ** [SQLITE_BUSY] is returned to the caller. ^In this case the call to -** sqlite3_backup_step() can be retried later. ^If the source +** tdsqlite3_backup_step() can be retried later. ^If the source ** [database connection] -** is being used to write to the source database when sqlite3_backup_step() +** is being used to write to the source database when tdsqlite3_backup_step() ** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this -** case the call to sqlite3_backup_step() can be retried later on. ^(If +** case the call to tdsqlite3_backup_step() can be retried later on. ^(If ** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or ** [SQLITE_READONLY] is returned, then -** there is no point in retrying the call to sqlite3_backup_step(). These +** there is no point in retrying the call to tdsqlite3_backup_step(). These ** errors are considered fatal.)^ The application must accept ** that the backup operation has failed and pass the backup operation handle -** to the sqlite3_backup_finish() to release associated resources. +** to the tdsqlite3_backup_finish() to release associated resources. ** -** ^The first call to sqlite3_backup_step() obtains an exclusive lock +** ^The first call to tdsqlite3_backup_step() obtains an exclusive lock ** on the destination file. ^The exclusive lock is not released until either -** sqlite3_backup_finish() is called or the backup operation is complete -** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to -** sqlite3_backup_step() obtains a [shared lock] on the source database that -** lasts for the duration of the sqlite3_backup_step() call. +** tdsqlite3_backup_finish() is called or the backup operation is complete +** and tdsqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to +** tdsqlite3_backup_step() obtains a [shared lock] on the source database that +** lasts for the duration of the tdsqlite3_backup_step() call. ** ^Because the source database is not locked between calls to -** sqlite3_backup_step(), the source database may be modified mid-way +** tdsqlite3_backup_step(), the source database may be modified mid-way ** through the backup process. ^If the source database is modified by an ** external process or via a database connection other than the one being ** used by the backup operation, then the backup will be automatically -** restarted by the next call to sqlite3_backup_step(). ^If the source +** restarted by the next call to tdsqlite3_backup_step(). ^If the source ** database is modified by the using the same database connection as is used ** by the backup operation, then the backup database is automatically ** updated at the same time. ** -** [[sqlite3_backup_finish()]] sqlite3_backup_finish() +** [[tdsqlite3_backup_finish()]] tdsqlite3_backup_finish() ** -** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the +** When tdsqlite3_backup_step() has returned [SQLITE_DONE], or when the ** application wishes to abandon the backup operation, the application -** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish(). -** ^The sqlite3_backup_finish() interfaces releases all -** resources associated with the [sqlite3_backup] object. -** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any +** should destroy the [tdsqlite3_backup] by passing it to tdsqlite3_backup_finish(). +** ^The tdsqlite3_backup_finish() interfaces releases all +** resources associated with the [tdsqlite3_backup] object. +** ^If tdsqlite3_backup_step() has not yet returned [SQLITE_DONE], then any ** active write-transaction on the destination database is rolled back. -** The [sqlite3_backup] object is invalid -** and may not be used following a call to sqlite3_backup_finish(). +** The [tdsqlite3_backup] object is invalid +** and may not be used following a call to tdsqlite3_backup_finish(). ** -** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no -** sqlite3_backup_step() errors occurred, regardless or whether or not -** sqlite3_backup_step() completed. +** ^The value returned by tdsqlite3_backup_finish is [SQLITE_OK] if no +** tdsqlite3_backup_step() errors occurred, regardless or whether or not +** tdsqlite3_backup_step() completed. ** ^If an out-of-memory condition or IO error occurred during any prior -** sqlite3_backup_step() call on the same [sqlite3_backup] object, then -** sqlite3_backup_finish() returns the corresponding [error code]. +** tdsqlite3_backup_step() call on the same [tdsqlite3_backup] object, then +** tdsqlite3_backup_finish() returns the corresponding [error code]. ** -** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() +** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from tdsqlite3_backup_step() ** is not a permanent error and does not affect the return value of -** sqlite3_backup_finish(). +** tdsqlite3_backup_finish(). ** -** [[sqlite3_backup_remaining()]] [[sqlite3_backup_pagecount()]] -** sqlite3_backup_remaining() and sqlite3_backup_pagecount() +** [[tdsqlite3_backup_remaining()]] [[tdsqlite3_backup_pagecount()]] +** tdsqlite3_backup_remaining() and tdsqlite3_backup_pagecount() ** -** ^The sqlite3_backup_remaining() routine returns the number of pages still -** to be backed up at the conclusion of the most recent sqlite3_backup_step(). -** ^The sqlite3_backup_pagecount() routine returns the total number of pages +** ^The tdsqlite3_backup_remaining() routine returns the number of pages still +** to be backed up at the conclusion of the most recent tdsqlite3_backup_step(). +** ^The tdsqlite3_backup_pagecount() routine returns the total number of pages ** in the source database at the conclusion of the most recent -** sqlite3_backup_step(). +** tdsqlite3_backup_step(). ** ^(The values returned by these functions are only updated by -** sqlite3_backup_step(). If the source database is modified in a way that +** tdsqlite3_backup_step(). If the source database is modified in a way that ** changes the size of the source database or the number of pages remaining, -** those changes are not reflected in the output of sqlite3_backup_pagecount() -** and sqlite3_backup_remaining() until after the next -** sqlite3_backup_step().)^ +** those changes are not reflected in the output of tdsqlite3_backup_pagecount() +** and tdsqlite3_backup_remaining() until after the next +** tdsqlite3_backup_step().)^ ** ** Concurrent Usage of Database Handles ** @@ -8581,8 +8581,8 @@ typedef struct sqlite3_backup sqlite3_backup; ** ** However, the application must guarantee that the destination ** [database connection] is not passed to any other API (by any thread) after -** sqlite3_backup_init() is called and before the corresponding call to -** sqlite3_backup_finish(). SQLite does not currently check to see +** tdsqlite3_backup_init() is called and before the corresponding call to +** tdsqlite3_backup_finish(). SQLite does not currently check to see ** if the application incorrectly accesses the destination [database connection] ** and so no error code is reported, but the operations may malfunction ** nevertheless. Use of the destination database connection while a @@ -8593,29 +8593,29 @@ typedef struct sqlite3_backup sqlite3_backup; ** is not accessed while the backup is running. In practice this means ** that the application must guarantee that the disk file being ** backed up to is not accessed by any connection within the process, -** not just the specific connection that was passed to sqlite3_backup_init(). +** not just the specific connection that was passed to tdsqlite3_backup_init(). ** -** The [sqlite3_backup] object itself is partially threadsafe. Multiple -** threads may safely make multiple concurrent calls to sqlite3_backup_step(). -** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount() +** The [tdsqlite3_backup] object itself is partially threadsafe. Multiple +** threads may safely make multiple concurrent calls to tdsqlite3_backup_step(). +** However, the tdsqlite3_backup_remaining() and tdsqlite3_backup_pagecount() ** APIs are not strictly speaking threadsafe. If they are invoked at the -** same time as another thread is invoking sqlite3_backup_step() it is +** same time as another thread is invoking tdsqlite3_backup_step() it is ** possible that they return invalid values. */ -SQLITE_API sqlite3_backup *sqlite3_backup_init( - sqlite3 *pDest, /* Destination database handle */ +SQLITE_API tdsqlite3_backup *tdsqlite3_backup_init( + tdsqlite3 *pDest, /* Destination database handle */ const char *zDestName, /* Destination database name */ - sqlite3 *pSource, /* Source database handle */ + tdsqlite3 *pSource, /* Source database handle */ const char *zSourceName /* Source database name */ ); -SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage); -SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p); -SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p); -SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); +SQLITE_API int tdsqlite3_backup_step(tdsqlite3_backup *p, int nPage); +SQLITE_API int tdsqlite3_backup_finish(tdsqlite3_backup *p); +SQLITE_API int tdsqlite3_backup_remaining(tdsqlite3_backup *p); +SQLITE_API int tdsqlite3_backup_pagecount(tdsqlite3_backup *p); /* ** CAPI3REF: Unlock Notification -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** ** ^When running in shared-cache mode, a database operation may fail with ** an [SQLITE_LOCKED] error if the required locks on the shared-cache or @@ -8636,17 +8636,17 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** identity of the database connection (the blocking connection) that ** has locked the required resource is stored internally. ^After an ** application receives an SQLITE_LOCKED error, it may call the -** sqlite3_unlock_notify() method with the blocked connection handle as +** tdsqlite3_unlock_notify() method with the blocked connection handle as ** the first argument to register for a callback that will be invoked ** when the blocking connections current transaction is concluded. ^The -** callback is invoked from within the [sqlite3_step] or [sqlite3_close] +** callback is invoked from within the [tdsqlite3_step] or [tdsqlite3_close] ** call that concludes the blocking connection's transaction. ** -** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, +** ^(If tdsqlite3_unlock_notify() is called in a multi-threaded application, ** there is a chance that the blocking connection will have already -** concluded its transaction by the time sqlite3_unlock_notify() is invoked. +** concluded its transaction by the time tdsqlite3_unlock_notify() is invoked. ** If this happens, then the specified callback is invoked immediately, -** from within the call to sqlite3_unlock_notify().)^ +** from within the call to tdsqlite3_unlock_notify().)^ ** ** ^If the blocked connection is attempting to obtain a write-lock on a ** shared-cache table, and more than one other connection currently holds @@ -8654,19 +8654,19 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** the other connections to use as the blocking connection. ** ** ^(There may be at most one unlock-notify callback registered by a -** blocked connection. If sqlite3_unlock_notify() is called when the +** blocked connection. If tdsqlite3_unlock_notify() is called when the ** blocked connection already has a registered unlock-notify callback, -** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is +** then the new callback replaces the old.)^ ^If tdsqlite3_unlock_notify() is ** called with a NULL pointer as its second argument, then any existing ** unlock-notify callback is canceled. ^The blocked connections ** unlock-notify callback may also be canceled by closing the blocked -** connection using [sqlite3_close()]. +** connection using [tdsqlite3_close()]. ** ** The unlock-notify callback is not reentrant. If an application invokes -** any sqlite3_xxx API functions from within an unlock-notify callback, a +** any tdsqlite3_xxx API functions from within an unlock-notify callback, a ** crash or deadlock may be the result. ** -** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always +** ^Unless deadlock is detected (see below), tdsqlite3_unlock_notify() always ** returns SQLITE_OK. ** ** Callback Invocation Details @@ -8697,8 +8697,8 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** Y is waiting on connection X's transaction, then neither connection ** will proceed and the system may remain deadlocked indefinitely. ** -** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock -** detection. ^If a given call to sqlite3_unlock_notify() would put the +** To avoid this scenario, the tdsqlite3_unlock_notify() performs deadlock +** detection. ^If a given call to tdsqlite3_unlock_notify() would put the ** system in a deadlocked state, then SQLITE_LOCKED is returned and no ** unlock-notify callback is registered. The system is said to be in ** a deadlocked state if connection A has registered for an unlock-notify @@ -8712,24 +8712,24 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** ** The "DROP TABLE" Exception ** -** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost -** always appropriate to call sqlite3_unlock_notify(). There is however, +** When a call to [tdsqlite3_step()] returns SQLITE_LOCKED, it is almost +** always appropriate to call tdsqlite3_unlock_notify(). There is however, ** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement, ** SQLite checks if there are any currently executing SELECT statements ** that belong to the same connection. If there are, SQLITE_LOCKED is ** returned. In this case there is no "blocking connection", so invoking -** sqlite3_unlock_notify() results in the unlock-notify callback being +** tdsqlite3_unlock_notify() results in the unlock-notify callback being ** invoked immediately. If the application then re-attempts the "DROP TABLE" ** or "DROP INDEX" query, an infinite loop might be the result. ** ** One way around this problem is to check the extended error code returned -** by an sqlite3_step() call. ^(If there is a blocking connection, then the +** by an tdsqlite3_step() call. ^(If there is a blocking connection, then the ** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in ** the special "DROP TABLE/INDEX" case, the extended error code is just ** SQLITE_LOCKED.)^ */ -SQLITE_API int sqlite3_unlock_notify( - sqlite3 *pBlocked, /* Waiting connection */ +SQLITE_API int tdsqlite3_unlock_notify( + tdsqlite3 *pBlocked, /* Waiting connection */ void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */ void *pNotifyArg /* Argument to pass to xNotify */ ); @@ -8738,82 +8738,82 @@ SQLITE_API int sqlite3_unlock_notify( /* ** CAPI3REF: String Comparison ** -** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications +** ^The [tdsqlite3_stricmp()] and [tdsqlite3_strnicmp()] APIs allow applications ** and extensions to compare the contents of two buffers containing UTF-8 ** strings in a case-independent fashion, using the same definition of "case ** independence" that SQLite uses internally when comparing identifiers. */ -SQLITE_API int sqlite3_stricmp(const char *, const char *); -SQLITE_API int sqlite3_strnicmp(const char *, const char *, int); +SQLITE_API int tdsqlite3_stricmp(const char *, const char *); +SQLITE_API int tdsqlite3_strnicmp(const char *, const char *, int); /* ** CAPI3REF: String Globbing * -** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if +** ^The [tdsqlite3_strglob(P,X)] interface returns zero if and only if ** string X matches the [GLOB] pattern P. ** ^The definition of [GLOB] pattern matching used in -** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the -** SQL dialect understood by SQLite. ^The [sqlite3_strglob(P,X)] function +** [tdsqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the +** SQL dialect understood by SQLite. ^The [tdsqlite3_strglob(P,X)] function ** is case sensitive. ** ** Note that this routine returns zero on a match and non-zero if the strings -** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()]. +** do not match, the same as [tdsqlite3_stricmp()] and [tdsqlite3_strnicmp()]. ** -** See also: [sqlite3_strlike()]. +** See also: [tdsqlite3_strlike()]. */ -SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr); +SQLITE_API int tdsqlite3_strglob(const char *zGlob, const char *zStr); /* ** CAPI3REF: String LIKE Matching * -** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if +** ^The [tdsqlite3_strlike(P,X,E)] interface returns zero if and only if ** string X matches the [LIKE] pattern P with escape character E. ** ^The definition of [LIKE] pattern matching used in -** [sqlite3_strlike(P,X,E)] is the same as for the "X LIKE P ESCAPE E" +** [tdsqlite3_strlike(P,X,E)] is the same as for the "X LIKE P ESCAPE E" ** operator in the SQL dialect understood by SQLite. ^For "X LIKE P" without -** the ESCAPE clause, set the E parameter of [sqlite3_strlike(P,X,E)] to 0. -** ^As with the LIKE operator, the [sqlite3_strlike(P,X,E)] function is case +** the ESCAPE clause, set the E parameter of [tdsqlite3_strlike(P,X,E)] to 0. +** ^As with the LIKE operator, the [tdsqlite3_strlike(P,X,E)] function is case ** insensitive - equivalent upper and lower case ASCII characters match ** one another. ** -** ^The [sqlite3_strlike(P,X,E)] function matches Unicode characters, though +** ^The [tdsqlite3_strlike(P,X,E)] function matches Unicode characters, though ** only ASCII characters are case folded. ** ** Note that this routine returns zero on a match and non-zero if the strings -** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()]. +** do not match, the same as [tdsqlite3_stricmp()] and [tdsqlite3_strnicmp()]. ** -** See also: [sqlite3_strglob()]. +** See also: [tdsqlite3_strglob()]. */ -SQLITE_API int sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc); +SQLITE_API int tdsqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc); /* ** CAPI3REF: Error Logging Interface ** -** ^The [sqlite3_log()] interface writes a message into the [error log] -** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()]. +** ^The [tdsqlite3_log()] interface writes a message into the [error log] +** established by the [SQLITE_CONFIG_LOG] option to [tdsqlite3_config()]. ** ^If logging is enabled, the zFormat string and subsequent arguments are -** used with [sqlite3_snprintf()] to generate the final output string. +** used with [tdsqlite3_snprintf()] to generate the final output string. ** -** The sqlite3_log() interface is intended for use by extensions such as +** The tdsqlite3_log() interface is intended for use by extensions such as ** virtual tables, collating functions, and SQL functions. While there is -** nothing to prevent an application from calling sqlite3_log(), doing so +** nothing to prevent an application from calling tdsqlite3_log(), doing so ** is considered bad form. ** ** The zFormat string must not be NULL. ** -** To avoid deadlocks and other threading problems, the sqlite3_log() routine +** To avoid deadlocks and other threading problems, the tdsqlite3_log() routine ** will not use dynamically allocated memory. The log message is stored in ** a fixed-length buffer on the stack. If the log message is longer than ** a few hundred characters, it will be truncated to the length of the ** buffer. */ -SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); +SQLITE_API void tdsqlite3_log(int iErrCode, const char *zFormat, ...); /* ** CAPI3REF: Write-Ahead Log Commit Hook -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The [sqlite3_wal_hook()] function is used to register a callback that +** ^The [tdsqlite3_wal_hook()] function is used to register a callback that ** is invoked each time data is committed to a database in wal mode. ** ** ^(The callback is invoked by SQLite after the commit has taken place and @@ -8821,7 +8821,7 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); ** may read, write or [checkpoint] the database as required. ** ** ^The first parameter passed to the callback function when it is invoked -** is a copy of the third parameter passed to sqlite3_wal_hook() when +** is a copy of the third parameter passed to tdsqlite3_wal_hook() when ** registering the callback. ^The second is a copy of the database handle. ** ^The third parameter is the name of the database that was written to - ** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter @@ -8837,24 +8837,24 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); ** are undefined. ** ** A single database handle may have at most a single write-ahead log callback -** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any +** registered at one time. ^Calling [tdsqlite3_wal_hook()] replaces any ** previously registered write-ahead log callback. ^Note that the -** [sqlite3_wal_autocheckpoint()] interface and the -** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will -** overwrite any prior [sqlite3_wal_hook()] settings. +** [tdsqlite3_wal_autocheckpoint()] interface and the +** [wal_autocheckpoint pragma] both invoke [tdsqlite3_wal_hook()] and will +** overwrite any prior [tdsqlite3_wal_hook()] settings. */ -SQLITE_API void *sqlite3_wal_hook( - sqlite3*, - int(*)(void *,sqlite3*,const char*,int), +SQLITE_API void *tdsqlite3_wal_hook( + tdsqlite3*, + int(*)(void *,tdsqlite3*,const char*,int), void* ); /* ** CAPI3REF: Configure an auto-checkpoint -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around -** [sqlite3_wal_hook()] that causes any database on [database connection] D +** ^The [tdsqlite3_wal_autocheckpoint(D,N)] is a wrapper around +** [tdsqlite3_wal_hook()] that causes any database on [database connection] D ** to automatically [checkpoint] ** after committing a transaction if there are N or ** more frames in the [write-ahead log] file. ^Passing zero or @@ -8862,15 +8862,15 @@ SQLITE_API void *sqlite3_wal_hook( ** checkpoints entirely. ** ** ^The callback registered by this function replaces any existing callback -** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback -** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism +** registered using [tdsqlite3_wal_hook()]. ^Likewise, registering a callback +** using [tdsqlite3_wal_hook()] disables the automatic checkpoint mechanism ** configured by this function. ** ** ^The [wal_autocheckpoint pragma] can be used to invoke this interface ** from SQL. ** ** ^Checkpoints initiated by this mechanism are -** [sqlite3_wal_checkpoint_v2|PASSIVE]. +** [tdsqlite3_wal_checkpoint_v2|PASSIVE]. ** ** ^Every new [database connection] defaults to having the auto-checkpoint ** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT] @@ -8878,35 +8878,35 @@ SQLITE_API void *sqlite3_wal_hook( ** is only necessary if the default setting is found to be suboptimal ** for a particular application. */ -SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N); +SQLITE_API int tdsqlite3_wal_autocheckpoint(tdsqlite3 *db, int N); /* ** CAPI3REF: Checkpoint a database -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to -** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^ +** ^(The tdsqlite3_wal_checkpoint(D,X) is equivalent to +** [tdsqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^ ** -** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the +** In brief, tdsqlite3_wal_checkpoint(D,X) causes the content in the ** [write-ahead log] for database X on [database connection] D to be ** transferred into the database file and for the write-ahead log to ** be reset. See the [checkpointing] documentation for addition ** information. ** ** This interface used to be the only way to cause a checkpoint to -** occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()] +** occur. But then the newer and more powerful [tdsqlite3_wal_checkpoint_v2()] ** interface was added. This interface is retained for backwards ** compatibility and as a convenience for applications that need to manually ** start a callback but which do not need the full power (and corresponding -** complication) of [sqlite3_wal_checkpoint_v2()]. +** complication) of [tdsqlite3_wal_checkpoint_v2()]. */ -SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); +SQLITE_API int tdsqlite3_wal_checkpoint(tdsqlite3 *db, const char *zDb); /* ** CAPI3REF: Checkpoint a database -** METHOD: sqlite3 +** METHOD: tdsqlite3 ** -** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint +** ^(The tdsqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint ** operation on database X of [database connection] D in mode M. Status ** information is written back into integers pointed to by L and C.)^ ** ^(The M parameter must be a valid [checkpoint mode]:)^ @@ -8922,7 +8922,7 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); ** **
SQLITE_CHECKPOINT_FULL
** ^This mode blocks (it invokes the -** [sqlite3_busy_handler|busy-handler callback]) until there is no +** [tdsqlite3_busy_handler|busy-handler callback]) until there is no ** database writer and all readers are reading from the most recent database ** snapshot. ^It then checkpoints all frames in the log file and syncs the ** database file. ^This mode blocks new database writers while it is pending, @@ -8987,15 +8987,15 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); ** attached database, SQLITE_ERROR is returned to the caller. ** ** ^Unless it returns SQLITE_MISUSE, -** the sqlite3_wal_checkpoint_v2() interface +** the tdsqlite3_wal_checkpoint_v2() interface ** sets the error information that is queried by -** [sqlite3_errcode()] and [sqlite3_errmsg()]. +** [tdsqlite3_errcode()] and [tdsqlite3_errmsg()]. ** ** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface ** from SQL. */ -SQLITE_API int sqlite3_wal_checkpoint_v2( - sqlite3 *db, /* Database handle */ +SQLITE_API int tdsqlite3_wal_checkpoint_v2( + tdsqlite3 *db, /* Database handle */ const char *zDb, /* Name of attached database (or NULL) */ int eMode, /* SQLITE_CHECKPOINT_* value */ int *pnLog, /* OUT: Size of WAL log in frames */ @@ -9007,8 +9007,8 @@ SQLITE_API int sqlite3_wal_checkpoint_v2( ** KEYWORDS: {checkpoint mode} ** ** These constants define all valid values for the "checkpoint mode" passed -** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface. -** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the +** as the third parameter to the [tdsqlite3_wal_checkpoint_v2()] interface. +** See the [tdsqlite3_wal_checkpoint_v2()] documentation for details on the ** meaning of each of these checkpoint modes. */ #define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */ @@ -9026,15 +9026,15 @@ SQLITE_API int sqlite3_wal_checkpoint_v2( ** If this interface is invoked outside the context of an xConnect or ** xCreate virtual table method then the behavior is undefined. ** -** In the call sqlite3_vtab_config(D,C,...) the D parameter is the +** In the call tdsqlite3_vtab_config(D,C,...) the D parameter is the ** [database connection] in which the virtual table is being created and ** which is passed in as the first argument to the [xConnect] or [xCreate] -** method that is invoking sqlite3_vtab_config(). The C parameter is one +** method that is invoking tdsqlite3_vtab_config(). The C parameter is one ** of the [virtual table configuration options]. The presence and meaning ** of parameters after C depend on which [virtual table configuration option] ** is used. */ -SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...); +SQLITE_API int tdsqlite3_vtab_config(tdsqlite3*, int op, ...); /* ** CAPI3REF: Virtual Table Configuration Options @@ -9042,16 +9042,16 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...); ** KEYWORDS: {virtual table configuration option} ** ** These macros define the various options to the -** [sqlite3_vtab_config()] interface that [virtual table] implementations +** [tdsqlite3_vtab_config()] interface that [virtual table] implementations ** can use to customize and optimize their behavior. ** **
** [[SQLITE_VTAB_CONSTRAINT_SUPPORT]] **
SQLITE_VTAB_CONSTRAINT_SUPPORT
**
Calls of the form -** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported, +** [tdsqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported, ** where X is an integer. If X is zero, then the [virtual table] whose -** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not +** [xCreate] or [xConnect] method invoked [tdsqlite3_vtab_config()] does not ** support constraints. In this configuration (which is the default) if ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been @@ -9070,7 +9070,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...); ** ** Virtual table implementations that are required to handle OR REPLACE ** must do so within the [xUpdate] method. If a call to the -** [sqlite3_vtab_on_conflict()] function indicates that the current ON +** [tdsqlite3_vtab_on_conflict()] function indicates that the current ON ** CONFLICT policy is REPLACE, the virtual table implementation should ** silently replace the appropriate rows within the xUpdate callback and ** return SQLITE_OK. Or, if this is not possible, it may return @@ -9080,7 +9080,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...); ** ** [[SQLITE_VTAB_DIRECTONLY]]
SQLITE_VTAB_DIRECTONLY
**
Calls of the form -** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the +** [tdsqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the ** the [xConnect] or [xCreate] methods of a [virtual table] implmentation ** prohibits that virtual table from being used from within triggers and ** views. @@ -9088,7 +9088,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...); ** ** [[SQLITE_VTAB_INNOCUOUS]]
SQLITE_VTAB_INNOCUOUS
**
Calls of the form -** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the +** [tdsqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the ** the [xConnect] or [xCreate] methods of a [virtual table] implmentation ** identify that virtual table as being safe to use from within triggers ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the @@ -9112,26 +9112,26 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...); ** of the SQL statement that triggered the call to the [xUpdate] method of the ** [virtual table]. */ -SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *); +SQLITE_API int tdsqlite3_vtab_on_conflict(tdsqlite3 *); /* ** CAPI3REF: Determine If Virtual Table Column Access Is For UPDATE ** -** If the sqlite3_vtab_nochange(X) routine is called within the [xColumn] +** If the tdsqlite3_vtab_nochange(X) routine is called within the [xColumn] ** method of a [virtual table], then it returns true if and only if the ** column is being fetched as part of an UPDATE operation during which the ** column value will not change. Applications might use this to substitute ** a return value that is less expensive to compute and that the corresponding ** [xUpdate] method understands as a "no-change" value. ** -** If the [xColumn] method calls sqlite3_vtab_nochange() and finds that +** If the [xColumn] method calls tdsqlite3_vtab_nochange() and finds that ** the column is not changed by the UPDATE statement, then the xColumn ** method can optionally return without setting a result, without calling -** any of the [sqlite3_result_int|sqlite3_result_xxxxx() interfaces]. -** In that case, [sqlite3_value_nochange(X)] will return true for the +** any of the [tdsqlite3_result_int|tdsqlite3_result_xxxxx() interfaces]. +** In that case, [tdsqlite3_value_nochange(X)] will return true for the ** same column in the [xUpdate] method. */ -SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*); +SQLITE_API int tdsqlite3_vtab_nochange(tdsqlite3_context*); /* ** CAPI3REF: Determine The Collation For a Virtual Table Constraint @@ -9139,29 +9139,29 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*); ** This function may only be called from within a call to the [xBestIndex] ** method of a [virtual table]. ** -** The first argument must be the sqlite3_index_info object that is the +** The first argument must be the tdsqlite3_index_info object that is the ** first parameter to the xBestIndex() method. The second argument must be -** an index into the aConstraint[] array belonging to the sqlite3_index_info +** an index into the aConstraint[] array belonging to the tdsqlite3_index_info ** structure passed to xBestIndex. This function returns a pointer to a buffer ** containing the name of the collation sequence for the corresponding ** constraint. */ -SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int); +SQLITE_API SQLITE_EXPERIMENTAL const char *tdsqlite3_vtab_collation(tdsqlite3_index_info*,int); /* ** CAPI3REF: Conflict resolution modes ** KEYWORDS: {conflict resolution mode} ** -** These constants are returned by [sqlite3_vtab_on_conflict()] to +** These constants are returned by [tdsqlite3_vtab_on_conflict()] to ** inform a [virtual table] implementation what the [ON CONFLICT] mode ** is for the SQL statement being evaluated. ** ** Note that the [SQLITE_IGNORE] constant is also used as a potential -** return value from the [sqlite3_set_authorizer()] callback and that +** return value from the [tdsqlite3_set_authorizer()] callback and that ** [SQLITE_ABORT] is also a [result code]. */ #define SQLITE_ROLLBACK 1 -/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */ +/* #define SQLITE_IGNORE 2 // Also used by tdsqlite3_authorizer() callback */ #define SQLITE_FAIL 3 /* #define SQLITE_ABORT 4 // Also an error code */ #define SQLITE_REPLACE 5 @@ -9171,8 +9171,8 @@ SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_ ** KEYWORDS: {scanstatus options} ** ** The following constants can be used for the T parameter to the -** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a -** different metric for sqlite3_stmt_scanstatus() to return. +** [tdsqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a +** different metric for tdsqlite3_stmt_scanstatus() to return. ** ** When the value returned to V is a string, space to hold that string is ** managed by the prepared statement S and will be automatically freed when @@ -9180,11 +9180,11 @@ SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_ ** **
** [[SQLITE_SCANSTAT_NLOOP]]
SQLITE_SCANSTAT_NLOOP
-**
^The [sqlite3_int64] variable pointed to by the V parameter will be +**
^The [tdsqlite3_int64] variable pointed to by the V parameter will be ** set to the total number of times that the X-th loop has run.
** ** [[SQLITE_SCANSTAT_NVISIT]]
SQLITE_SCANSTAT_NVISIT
-**
^The [sqlite3_int64] variable pointed to by the V parameter will be set +**
^The [tdsqlite3_int64] variable pointed to by the V parameter will be set ** to the total number of rows examined by all iterations of the X-th loop.
** ** [[SQLITE_SCANSTAT_EST]]
SQLITE_SCANSTAT_EST
@@ -9222,7 +9222,7 @@ SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_ /* ** CAPI3REF: Prepared Statement Scan Status -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** ** This interface returns information about the predicted and measured ** performance for pStmt. Advanced applications can use this @@ -9249,10 +9249,10 @@ SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_ ** as if the loop did not exist - it returns non-zero and leave the variable ** that pOut points to unchanged. ** -** See also: [sqlite3_stmt_scanstatus_reset()] +** See also: [tdsqlite3_stmt_scanstatus_reset()] */ -SQLITE_API int sqlite3_stmt_scanstatus( - sqlite3_stmt *pStmt, /* Prepared statement for which info desired */ +SQLITE_API int tdsqlite3_stmt_scanstatus( + tdsqlite3_stmt *pStmt, /* Prepared statement for which info desired */ int idx, /* Index of loop to report on */ int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */ void *pOut /* Result written here */ @@ -9260,24 +9260,24 @@ SQLITE_API int sqlite3_stmt_scanstatus( /* ** CAPI3REF: Zero Scan-Status Counters -** METHOD: sqlite3_stmt +** METHOD: tdsqlite3_stmt ** -** ^Zero all [sqlite3_stmt_scanstatus()] related event counters. +** ^Zero all [tdsqlite3_stmt_scanstatus()] related event counters. ** ** This API is only available if the library is built with pre-processor ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined. */ -SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*); +SQLITE_API void tdsqlite3_stmt_scanstatus_reset(tdsqlite3_stmt*); /* ** CAPI3REF: Flush caches to disk mid-transaction ** ** ^If a write-transaction is open on [database connection] D when the -** [sqlite3_db_cacheflush(D)] interface invoked, any dirty +** [tdsqlite3_db_cacheflush(D)] interface invoked, any dirty ** pages in the pager-cache that are not currently in use are written out ** to disk. A dirty page may be in use if a database cursor created by an ** active SQL statement is reading from it, or if it is page 1 of a database -** file (page 1 is always "in use"). ^The [sqlite3_db_cacheflush(D)] +** file (page 1 is always "in use"). ^The [tdsqlite3_db_cacheflush(D)] ** interface flushes caches for all schemas - "main", "temp", and ** any [attached] databases. ** @@ -9294,12 +9294,12 @@ SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*); ** example an IO error or out-of-memory condition), then processing is ** abandoned and an SQLite [error code] is returned to the caller immediately. ** -** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK. +** ^Otherwise, if no error occurs, [tdsqlite3_db_cacheflush()] returns SQLITE_OK. ** ** ^This function does not set the database handle error code or message -** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions. +** returned by the [tdsqlite3_errcode()] and [tdsqlite3_errmsg()] functions. */ -SQLITE_API int sqlite3_db_cacheflush(sqlite3*); +SQLITE_API int tdsqlite3_db_cacheflush(tdsqlite3*); /* ** CAPI3REF: The pre-update hook. @@ -9307,15 +9307,15 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*); ** ^These interfaces are only available if SQLite is compiled using the ** [SQLITE_ENABLE_PREUPDATE_HOOK] compile-time option. ** -** ^The [sqlite3_preupdate_hook()] interface registers a callback function +** ^The [tdsqlite3_preupdate_hook()] interface registers a callback function ** that is invoked prior to each [INSERT], [UPDATE], and [DELETE] operation ** on a database table. ** ^At most one preupdate hook may be registered at a time on a single -** [database connection]; each call to [sqlite3_preupdate_hook()] overrides +** [database connection]; each call to [tdsqlite3_preupdate_hook()] overrides ** the previous setting. -** ^The preupdate hook is disabled by invoking [sqlite3_preupdate_hook()] +** ^The preupdate hook is disabled by invoking [tdsqlite3_preupdate_hook()] ** with a NULL pointer as the second parameter. -** ^The third parameter to [sqlite3_preupdate_hook()] is passed through as +** ^The third parameter to [tdsqlite3_preupdate_hook()] is passed through as ** the first parameter to callbacks. ** ** ^The preupdate hook only fires for changes to real database tables; the @@ -9345,8 +9345,8 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*); ** function is not defined for operations on WITHOUT ROWID tables, or for ** INSERT operations on rowid tables. ** -** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()], -** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces +** The [tdsqlite3_preupdate_old()], [tdsqlite3_preupdate_new()], +** [tdsqlite3_preupdate_count()], and [tdsqlite3_preupdate_depth()] interfaces ** provide additional information about a preupdate event. These routines ** may only be called from within a preupdate callback. Invoking any of ** these routines from outside of a preupdate callback or with a @@ -9354,53 +9354,53 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*); ** to the preupdate callback results in undefined and probably undesirable ** behavior. ** -** ^The [sqlite3_preupdate_count(D)] interface returns the number of columns +** ^The [tdsqlite3_preupdate_count(D)] interface returns the number of columns ** in the row that is being inserted, updated, or deleted. ** -** ^The [sqlite3_preupdate_old(D,N,P)] interface writes into P a pointer to -** a [protected sqlite3_value] that contains the value of the Nth column of +** ^The [tdsqlite3_preupdate_old(D,N,P)] interface writes into P a pointer to +** a [protected tdsqlite3_value] that contains the value of the Nth column of ** the table row before it is updated. The N parameter must be between 0 ** and one less than the number of columns or the behavior will be ** undefined. This must only be used within SQLITE_UPDATE and SQLITE_DELETE ** preupdate callbacks; if it is used by an SQLITE_INSERT callback then the -** behavior is undefined. The [sqlite3_value] that P points to +** behavior is undefined. The [tdsqlite3_value] that P points to ** will be destroyed when the preupdate callback returns. ** -** ^The [sqlite3_preupdate_new(D,N,P)] interface writes into P a pointer to -** a [protected sqlite3_value] that contains the value of the Nth column of +** ^The [tdsqlite3_preupdate_new(D,N,P)] interface writes into P a pointer to +** a [protected tdsqlite3_value] that contains the value of the Nth column of ** the table row after it is updated. The N parameter must be between 0 ** and one less than the number of columns or the behavior will be ** undefined. This must only be used within SQLITE_INSERT and SQLITE_UPDATE ** preupdate callbacks; if it is used by an SQLITE_DELETE callback then the -** behavior is undefined. The [sqlite3_value] that P points to +** behavior is undefined. The [tdsqlite3_value] that P points to ** will be destroyed when the preupdate callback returns. ** -** ^The [sqlite3_preupdate_depth(D)] interface returns 0 if the preupdate +** ^The [tdsqlite3_preupdate_depth(D)] interface returns 0 if the preupdate ** callback was invoked as a result of a direct insert, update, or delete ** operation; or 1 for inserts, updates, or deletes invoked by top-level ** triggers; or 2 for changes resulting from triggers called by top-level ** triggers; and so forth. ** -** See also: [sqlite3_update_hook()] +** See also: [tdsqlite3_update_hook()] */ #if defined(SQLITE_ENABLE_PREUPDATE_HOOK) -SQLITE_API void *sqlite3_preupdate_hook( - sqlite3 *db, +SQLITE_API void *tdsqlite3_preupdate_hook( + tdsqlite3 *db, void(*xPreUpdate)( void *pCtx, /* Copy of third arg to preupdate_hook() */ - sqlite3 *db, /* Database handle */ + tdsqlite3 *db, /* Database handle */ int op, /* SQLITE_UPDATE, DELETE or INSERT */ char const *zDb, /* Database name */ char const *zName, /* Table name */ - sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */ - sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */ + tdsqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */ + tdsqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */ ), void* ); -SQLITE_API int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **); -SQLITE_API int sqlite3_preupdate_count(sqlite3 *); -SQLITE_API int sqlite3_preupdate_depth(sqlite3 *); -SQLITE_API int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **); +SQLITE_API int tdsqlite3_preupdate_old(tdsqlite3 *, int, tdsqlite3_value **); +SQLITE_API int tdsqlite3_preupdate_count(tdsqlite3 *); +SQLITE_API int tdsqlite3_preupdate_depth(tdsqlite3 *); +SQLITE_API int tdsqlite3_preupdate_new(tdsqlite3 *, int, tdsqlite3_value **); #endif /* @@ -9409,15 +9409,15 @@ SQLITE_API int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **); ** ^Attempt to return the underlying operating system error code or error ** number that caused the most recent I/O error or failure to open a file. ** The return value is OS-dependent. For example, on unix systems, after -** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be +** [tdsqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be ** called to get back the underlying "errno" that caused the problem, such ** as ENOSPC, EAUTH, EISDIR, and so forth. */ -SQLITE_API int sqlite3_system_errno(sqlite3*); +SQLITE_API int tdsqlite3_system_errno(tdsqlite3*); /* ** CAPI3REF: Database Snapshot -** KEYWORDS: {snapshot} {sqlite3_snapshot} +** KEYWORDS: {snapshot} {tdsqlite3_snapshot} ** ** An instance of the snapshot object records the state of a [WAL mode] ** database for some specific point in history. @@ -9430,29 +9430,29 @@ SQLITE_API int sqlite3_system_errno(sqlite3*); ** Subsequent changes to the database from other connections are not seen ** by the reader until a new read transaction is started. ** -** The sqlite3_snapshot object records state information about an historical +** The tdsqlite3_snapshot object records state information about an historical ** version of the database file so that it is possible to later open a new read ** transaction that sees that historical version of the database rather than ** the most recent version. */ -typedef struct sqlite3_snapshot { +typedef struct tdsqlite3_snapshot { unsigned char hidden[48]; -} sqlite3_snapshot; +} tdsqlite3_snapshot; /* ** CAPI3REF: Record A Database Snapshot -** CONSTRUCTOR: sqlite3_snapshot +** CONSTRUCTOR: tdsqlite3_snapshot ** -** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a -** new [sqlite3_snapshot] object that records the current state of +** ^The [tdsqlite3_snapshot_get(D,S,P)] interface attempts to make a +** new [tdsqlite3_snapshot] object that records the current state of ** schema S in database connection D. ^On success, the -** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly -** created [sqlite3_snapshot] object into *P and returns SQLITE_OK. +** [tdsqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly +** created [tdsqlite3_snapshot] object into *P and returns SQLITE_OK. ** If there is not already a read-transaction open on schema S when ** this function is called, one is opened automatically. ** ** The following must be true for this function to succeed. If any of -** the following statements are false when sqlite3_snapshot_get() is +** the following statements are false when tdsqlite3_snapshot_get() is ** called, SQLITE_ERROR is returned. The final value of *P is undefined ** in this case. ** @@ -9475,39 +9475,39 @@ typedef struct sqlite3_snapshot { ** database handle in autocommit mode but fails for some other reason, ** whether or not a read transaction is opened on schema S is undefined. ** -** The [sqlite3_snapshot] object returned from a successful call to -** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()] +** The [tdsqlite3_snapshot] object returned from a successful call to +** [tdsqlite3_snapshot_get()] must be freed using [tdsqlite3_snapshot_free()] ** to avoid a memory leak. ** -** The [sqlite3_snapshot_get()] interface is only available when the +** The [tdsqlite3_snapshot_get()] interface is only available when the ** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used. */ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get( - sqlite3 *db, +SQLITE_API SQLITE_EXPERIMENTAL int tdsqlite3_snapshot_get( + tdsqlite3 *db, const char *zSchema, - sqlite3_snapshot **ppSnapshot + tdsqlite3_snapshot **ppSnapshot ); /* ** CAPI3REF: Start a read transaction on an historical snapshot -** METHOD: sqlite3_snapshot +** METHOD: tdsqlite3_snapshot ** -** ^The [sqlite3_snapshot_open(D,S,P)] interface either starts a new read +** ^The [tdsqlite3_snapshot_open(D,S,P)] interface either starts a new read ** transaction or upgrades an existing one for schema S of ** [database connection] D such that the read transaction refers to ** historical [snapshot] P, rather than the most recent change to the -** database. ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK +** database. ^The [tdsqlite3_snapshot_open()] interface returns SQLITE_OK ** on success or an appropriate [error code] if it fails. ** ** ^In order to succeed, the database connection must not be in -** [autocommit mode] when [sqlite3_snapshot_open(D,S,P)] is called. If there +** [autocommit mode] when [tdsqlite3_snapshot_open(D,S,P)] is called. If there ** is already a read transaction open on schema S, then the database handle ** must have no active statements (SELECT statements that have been passed -** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()). +** to tdsqlite3_step() but not tdsqlite3_reset() or tdsqlite3_finalize()). ** SQLITE_ERROR is returned if either of these conditions is violated, or ** if schema S does not exist, or if the snapshot object is invalid. ** -** ^A call to sqlite3_snapshot_open() will fail to open if the specified +** ^A call to tdsqlite3_snapshot_open() will fail to open if the specified ** snapshot has been overwritten by a [checkpoint]. In this case ** SQLITE_ERROR_SNAPSHOT is returned. ** @@ -9519,7 +9519,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get( ** read transaction is undefined. If SQLITE_OK is returned, then the ** read transaction is now open on database snapshot P. ** -** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the +** ^(A call to [tdsqlite3_snapshot_open(D,S,P)] will fail if the ** database connection D does not know that the database file for ** schema S is in [WAL mode]. A database connection might not know ** that the database file is in [WAL mode] if there has been no prior @@ -9528,40 +9528,40 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get( ** (Hint: Run "[PRAGMA application_id]" against a newly opened ** database connection in order to make it ready to use snapshots.) ** -** The [sqlite3_snapshot_open()] interface is only available when the +** The [tdsqlite3_snapshot_open()] interface is only available when the ** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used. */ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open( - sqlite3 *db, +SQLITE_API SQLITE_EXPERIMENTAL int tdsqlite3_snapshot_open( + tdsqlite3 *db, const char *zSchema, - sqlite3_snapshot *pSnapshot + tdsqlite3_snapshot *pSnapshot ); /* ** CAPI3REF: Destroy a snapshot -** DESTRUCTOR: sqlite3_snapshot +** DESTRUCTOR: tdsqlite3_snapshot ** -** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P. -** The application must eventually free every [sqlite3_snapshot] object +** ^The [tdsqlite3_snapshot_free(P)] interface destroys [tdsqlite3_snapshot] P. +** The application must eventually free every [tdsqlite3_snapshot] object ** using this routine to avoid a memory leak. ** -** The [sqlite3_snapshot_free()] interface is only available when the +** The [tdsqlite3_snapshot_free()] interface is only available when the ** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used. */ -SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*); +SQLITE_API SQLITE_EXPERIMENTAL void tdsqlite3_snapshot_free(tdsqlite3_snapshot*); /* ** CAPI3REF: Compare the ages of two snapshot handles. -** METHOD: sqlite3_snapshot +** METHOD: tdsqlite3_snapshot ** -** The sqlite3_snapshot_cmp(P1, P2) interface is used to compare the ages +** The tdsqlite3_snapshot_cmp(P1, P2) interface is used to compare the ages ** of two valid snapshot handles. ** ** If the two snapshot handles are not associated with the same database ** file, the result of the comparison is undefined. ** ** Additionally, the result of the comparison is only valid if both of the -** snapshot handles were obtained by calling sqlite3_snapshot_get() since the +** snapshot handles were obtained by calling tdsqlite3_snapshot_get() since the ** last time the wal file was deleted. The wal file is deleted when the ** database is changed back to rollback mode or when the number of database ** clients drops to zero. If either snapshot handle was obtained before the @@ -9575,26 +9575,26 @@ SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*); ** This interface is only available if SQLite is compiled with the ** [SQLITE_ENABLE_SNAPSHOT] option. */ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp( - sqlite3_snapshot *p1, - sqlite3_snapshot *p2 +SQLITE_API SQLITE_EXPERIMENTAL int tdsqlite3_snapshot_cmp( + tdsqlite3_snapshot *p1, + tdsqlite3_snapshot *p2 ); /* ** CAPI3REF: Recover snapshots from a wal file -** METHOD: sqlite3_snapshot +** METHOD: tdsqlite3_snapshot ** ** If a [WAL file] remains on disk after all database connections close ** (either through the use of the [SQLITE_FCNTL_PERSIST_WAL] [file control] ** or because the last process to have the database opened exited without -** calling [sqlite3_close()]) and a new connection is subsequently opened -** on that database and [WAL file], the [sqlite3_snapshot_open()] interface +** calling [tdsqlite3_close()]) and a new connection is subsequently opened +** on that database and [WAL file], the [tdsqlite3_snapshot_open()] interface ** will only be able to open the last transaction added to the WAL file ** even though the WAL file contains other valid transactions. ** ** This function attempts to scan the WAL file associated with database zDb ** of database handle db and make all valid snapshots available to -** sqlite3_snapshot_open(). It is an error if there is already a read +** tdsqlite3_snapshot_open(). It is an error if there is already a read ** transaction open on the database, or if the database is not a WAL mode ** database. ** @@ -9603,12 +9603,12 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp( ** This interface is only available if SQLite is compiled with the ** [SQLITE_ENABLE_SNAPSHOT] option. */ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb); +SQLITE_API SQLITE_EXPERIMENTAL int tdsqlite3_snapshot_recover(tdsqlite3 *db, const char *zDb); /* ** CAPI3REF: Serialize a database ** -** The sqlite3_serialize(D,S,P,F) interface returns a pointer to memory +** The tdsqlite3_serialize(D,S,P,F) interface returns a pointer to memory ** that is a serialization of the S database on [database connection] D. ** If P is not a NULL pointer, then the size of the database in bytes ** is written into *P. @@ -9618,56 +9618,56 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c ** the serialization is the same sequence of bytes which would be written ** to disk if that database where backed up to disk. ** -** The usual case is that sqlite3_serialize() copies the serialization of -** the database into memory obtained from [sqlite3_malloc64()] and returns +** The usual case is that tdsqlite3_serialize() copies the serialization of +** the database into memory obtained from [tdsqlite3_malloc64()] and returns ** a pointer to that memory. The caller is responsible for freeing the ** returned value to avoid a memory leak. However, if the F argument ** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations -** are made, and the sqlite3_serialize() function will return a pointer +** are made, and the tdsqlite3_serialize() function will return a pointer ** to the contiguous memory representation of the database that SQLite ** is currently using for that database, or NULL if the no such contiguous ** memory representation of the database exists. A contiguous memory ** representation of the database will usually only exist if there has -** been a prior call to [sqlite3_deserialize(D,S,...)] with the same +** been a prior call to [tdsqlite3_deserialize(D,S,...)] with the same ** values of D and S. ** The size of the database is written into *P even if the ** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy ** of the database exists. ** -** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the +** A call to tdsqlite3_serialize(D,S,P,F) might return NULL even if the ** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory ** allocation error occurs. ** ** This interface is only available if SQLite is compiled with the ** [SQLITE_ENABLE_DESERIALIZE] option. */ -SQLITE_API unsigned char *sqlite3_serialize( - sqlite3 *db, /* The database connection */ +SQLITE_API unsigned char *tdsqlite3_serialize( + tdsqlite3 *db, /* The database connection */ const char *zSchema, /* Which DB to serialize. ex: "main", "temp", ... */ - sqlite3_int64 *piSize, /* Write size of the DB here, if not NULL */ + tdsqlite3_int64 *piSize, /* Write size of the DB here, if not NULL */ unsigned int mFlags /* Zero or more SQLITE_SERIALIZE_* flags */ ); /* -** CAPI3REF: Flags for sqlite3_serialize +** CAPI3REF: Flags for tdsqlite3_serialize ** ** Zero or more of the following constants can be OR-ed together for -** the F argument to [sqlite3_serialize(D,S,P,F)]. +** the F argument to [tdsqlite3_serialize(D,S,P,F)]. ** -** SQLITE_SERIALIZE_NOCOPY means that [sqlite3_serialize()] will return +** SQLITE_SERIALIZE_NOCOPY means that [tdsqlite3_serialize()] will return ** a pointer to contiguous in-memory database that it is currently using, ** without making a copy of the database. If SQLite is not currently using ** a contiguous in-memory database, then this option causes -** [sqlite3_serialize()] to return a NULL pointer. SQLite will only be +** [tdsqlite3_serialize()] to return a NULL pointer. SQLite will only be ** using a contiguous in-memory database if it has been initialized by a -** prior call to [sqlite3_deserialize()]. +** prior call to [tdsqlite3_deserialize()]. */ #define SQLITE_SERIALIZE_NOCOPY 0x001 /* Do no memory allocations */ /* ** CAPI3REF: Deserialize a database ** -** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the +** The tdsqlite3_deserialize(D,S,P,N,M,F) interface causes the ** [database connection] D to disconnect from database S and then ** reopen S as an in-memory database based on the serialization contained ** in P. The serialized database P is N bytes in size. M is the size of @@ -9677,45 +9677,45 @@ SQLITE_API unsigned char *sqlite3_serialize( ** size does not exceed M bytes. ** ** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will -** invoke sqlite3_free() on the serialization buffer when the database +** invoke tdsqlite3_free() on the serialization buffer when the database ** connection closes. If the SQLITE_DESERIALIZE_RESIZEABLE bit is set, then -** SQLite will try to increase the buffer size using sqlite3_realloc64() +** SQLite will try to increase the buffer size using tdsqlite3_realloc64() ** if writes on the database cause it to grow larger than M bytes. ** -** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the +** The tdsqlite3_deserialize() interface will fail with SQLITE_BUSY if the ** database is currently in a read transaction or is involved in a backup ** operation. ** -** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the +** If tdsqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then -** [sqlite3_free()] is invoked on argument P prior to returning. +** [tdsqlite3_free()] is invoked on argument P prior to returning. ** ** This interface is only available if SQLite is compiled with the ** [SQLITE_ENABLE_DESERIALIZE] option. */ -SQLITE_API int sqlite3_deserialize( - sqlite3 *db, /* The database connection */ +SQLITE_API int tdsqlite3_deserialize( + tdsqlite3 *db, /* The database connection */ const char *zSchema, /* Which DB to reopen with the deserialization */ unsigned char *pData, /* The serialized database content */ - sqlite3_int64 szDb, /* Number bytes in the deserialization */ - sqlite3_int64 szBuf, /* Total size of buffer pData[] */ + tdsqlite3_int64 szDb, /* Number bytes in the deserialization */ + tdsqlite3_int64 szBuf, /* Total size of buffer pData[] */ unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */ ); /* -** CAPI3REF: Flags for sqlite3_deserialize() +** CAPI3REF: Flags for tdsqlite3_deserialize() ** ** The following are allowed values for 6th argument (the F argument) to -** the [sqlite3_deserialize(D,S,P,N,M,F)] interface. +** the [tdsqlite3_deserialize(D,S,P,N,M,F)] interface. ** ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization -** in the P argument is held in memory obtained from [sqlite3_malloc64()] +** in the P argument is held in memory obtained from [tdsqlite3_malloc64()] ** and that SQLite should take ownership of this memory and automatically ** free it when it has finished using it. Without this flag, the caller ** is responsible for freeing any dynamically allocated memory. ** ** The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to -** grow the size of the database using calls to [sqlite3_realloc64()]. This +** grow the size of the database using calls to [tdsqlite3_realloc64()]. This ** flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used. ** Without this flag, the deserialized database cannot increase in size beyond ** the number of bytes specified by the M parameter. @@ -9723,8 +9723,8 @@ SQLITE_API int sqlite3_deserialize( ** The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database ** should be treated as read-only. */ -#define SQLITE_DESERIALIZE_FREEONCLOSE 1 /* Call sqlite3_free() on close */ -#define SQLITE_DESERIALIZE_RESIZEABLE 2 /* Resize using sqlite3_realloc64() */ +#define SQLITE_DESERIALIZE_FREEONCLOSE 1 /* Call tdsqlite3_free() on close */ +#define SQLITE_DESERIALIZE_RESIZEABLE 2 /* Resize using tdsqlite3_realloc64() */ #define SQLITE_DESERIALIZE_READONLY 4 /* Database is read-only */ /* @@ -9740,7 +9740,7 @@ SQLITE_API int sqlite3_deserialize( #endif #endif /* SQLITE3_H */ -/******** Begin file sqlite3rtree.h *********/ +/******** Begin file tdsqlite3rtree.h *********/ /* ** 2010 August 30 ** @@ -9762,16 +9762,16 @@ SQLITE_API int sqlite3_deserialize( extern "C" { #endif -typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry; -typedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info; +typedef struct tdsqlite3_rtree_geometry tdsqlite3_rtree_geometry; +typedef struct tdsqlite3_rtree_query_info tdsqlite3_rtree_query_info; /* The double-precision datatype used by RTree depends on the ** SQLITE_RTREE_INT_ONLY compile-time option. */ #ifdef SQLITE_RTREE_INT_ONLY - typedef sqlite3_int64 sqlite3_rtree_dbl; + typedef tdsqlite3_int64 tdsqlite3_rtree_dbl; #else - typedef double sqlite3_rtree_dbl; + typedef double tdsqlite3_rtree_dbl; #endif /* @@ -9780,10 +9780,10 @@ typedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info; ** ** SELECT ... FROM WHERE MATCH $zGeom(... params ...) */ -SQLITE_API int sqlite3_rtree_geometry_callback( - sqlite3 *db, +SQLITE_API int tdsqlite3_rtree_geometry_callback( + tdsqlite3 *db, const char *zGeom, - int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*), + int (*xGeom)(tdsqlite3_rtree_geometry*, int, tdsqlite3_rtree_dbl*,int*), void *pContext ); @@ -9792,10 +9792,10 @@ SQLITE_API int sqlite3_rtree_geometry_callback( ** A pointer to a structure of the following type is passed as the first ** argument to callbacks registered using rtree_geometry_callback(). */ -struct sqlite3_rtree_geometry { +struct tdsqlite3_rtree_geometry { void *pContext; /* Copy of pContext passed to s_r_g_c() */ int nParam; /* Size of array aParam[] */ - sqlite3_rtree_dbl *aParam; /* Parameters passed to SQL geom function */ + tdsqlite3_rtree_dbl *aParam; /* Parameters passed to SQL geom function */ void *pUser; /* Callback implementation user data */ void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */ }; @@ -9806,10 +9806,10 @@ struct sqlite3_rtree_geometry { ** ** SELECT ... FROM WHERE MATCH $zQueryFunc(... params ...) */ -SQLITE_API int sqlite3_rtree_query_callback( - sqlite3 *db, +SQLITE_API int tdsqlite3_rtree_query_callback( + tdsqlite3 *db, const char *zQueryFunc, - int (*xQueryFunc)(sqlite3_rtree_query_info*), + int (*xQueryFunc)(tdsqlite3_rtree_query_info*), void *pContext, void (*xDestructor)(void*) ); @@ -9818,34 +9818,34 @@ SQLITE_API int sqlite3_rtree_query_callback( /* ** A pointer to a structure of the following type is passed as the ** argument to scored geometry callback registered using -** sqlite3_rtree_query_callback(). +** tdsqlite3_rtree_query_callback(). ** ** Note that the first 5 fields of this structure are identical to -** sqlite3_rtree_geometry. This structure is a subclass of -** sqlite3_rtree_geometry. +** tdsqlite3_rtree_geometry. This structure is a subclass of +** tdsqlite3_rtree_geometry. */ -struct sqlite3_rtree_query_info { +struct tdsqlite3_rtree_query_info { void *pContext; /* pContext from when function registered */ int nParam; /* Number of function parameters */ - sqlite3_rtree_dbl *aParam; /* value of function parameters */ + tdsqlite3_rtree_dbl *aParam; /* value of function parameters */ void *pUser; /* callback can use this, if desired */ void (*xDelUser)(void*); /* function to free pUser */ - sqlite3_rtree_dbl *aCoord; /* Coordinates of node or entry to check */ + tdsqlite3_rtree_dbl *aCoord; /* Coordinates of node or entry to check */ unsigned int *anQueue; /* Number of pending entries in the queue */ int nCoord; /* Number of coordinates */ int iLevel; /* Level of current node or entry */ int mxLevel; /* The largest iLevel value in the tree */ - sqlite3_int64 iRowid; /* Rowid for current entry */ - sqlite3_rtree_dbl rParentScore; /* Score of parent node */ + tdsqlite3_int64 iRowid; /* Rowid for current entry */ + tdsqlite3_rtree_dbl rParentScore; /* Score of parent node */ int eParentWithin; /* Visibility of parent node */ int eWithin; /* OUT: Visibility */ - sqlite3_rtree_dbl rScore; /* OUT: Write the score here */ + tdsqlite3_rtree_dbl rScore; /* OUT: Write the score here */ /* The following fields are only available in 3.8.11 and later */ - sqlite3_value **apSqlParam; /* Original SQL values of parameters */ + tdsqlite3_value **apSqlParam; /* Original SQL values of parameters */ }; /* -** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. +** Allowed values for tdsqlite3_rtree_query.eWithin and .eParentWithin. */ #define NOT_WITHIN 0 /* Object completely outside of query region */ #define PARTLY_WITHIN 1 /* Object partially overlaps query region */ @@ -9858,8 +9858,8 @@ struct sqlite3_rtree_query_info { #endif /* ifndef _SQLITE3RTREE_H_ */ -/******** End of sqlite3rtree.h *********/ -/******** Begin file sqlite3session.h *********/ +/******** End of tdsqlite3rtree.h *********/ +/******** Begin file tdsqlite3session.h *********/ #if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) #define __SQLITESESSION_H_ 1 @@ -9878,7 +9878,7 @@ extern "C" { ** An instance of this object is a [session] that can be used to ** record changes to a database. */ -typedef struct sqlite3_session sqlite3_session; +typedef struct tdsqlite3_session tdsqlite3_session; /* ** CAPI3REF: Changeset Iterator Handle @@ -9886,11 +9886,11 @@ typedef struct sqlite3_session sqlite3_session; ** An instance of this object acts as a cursor for iterating ** over the elements of a [changeset] or [patchset]. */ -typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; +typedef struct tdsqlite3_changeset_iter tdsqlite3_changeset_iter; /* ** CAPI3REF: Create A New Session Object -** CONSTRUCTOR: sqlite3_session +** CONSTRUCTOR: tdsqlite3_session ** ** Create a new session object attached to database handle db. If successful, ** a pointer to the new object is written to *ppSession and SQLITE_OK is @@ -9901,13 +9901,13 @@ typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; ** database handle. ** ** Session objects created using this function should be deleted using the -** [sqlite3session_delete()] function before the database handle that they +** [tdsqlite3session_delete()] function before the database handle that they ** are attached to is itself closed. If the database handle is closed before ** the session object is deleted, then the results of calling any session -** module function, including [sqlite3session_delete()] on the session object +** module function, including [tdsqlite3session_delete()] on the session object ** are undefined. ** -** Because the session module uses the [sqlite3_preupdate_hook()] API, it +** Because the session module uses the [tdsqlite3_preupdate_hook()] API, it ** is not possible for an application to register a pre-update hook on a ** database handle that has one or more session objects attached. Nor is ** it possible to create a session object attached to a database handle for @@ -9919,36 +9919,36 @@ typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; ** attached database. It is not an error if database zDb is not attached ** to the database when the session object is created. */ -SQLITE_API int sqlite3session_create( - sqlite3 *db, /* Database handle */ +SQLITE_API int tdsqlite3session_create( + tdsqlite3 *db, /* Database handle */ const char *zDb, /* Name of db (e.g. "main") */ - sqlite3_session **ppSession /* OUT: New session object */ + tdsqlite3_session **ppSession /* OUT: New session object */ ); /* ** CAPI3REF: Delete A Session Object -** DESTRUCTOR: sqlite3_session +** DESTRUCTOR: tdsqlite3_session ** ** Delete a session object previously allocated using -** [sqlite3session_create()]. Once a session object has been deleted, the +** [tdsqlite3session_create()]. Once a session object has been deleted, the ** results of attempting to use pSession with any other session module ** function are undefined. ** ** Session objects must be deleted before the database handle to which they ** are attached is closed. Refer to the documentation for -** [sqlite3session_create()] for details. +** [tdsqlite3session_create()] for details. */ -SQLITE_API void sqlite3session_delete(sqlite3_session *pSession); +SQLITE_API void tdsqlite3session_delete(tdsqlite3_session *pSession); /* ** CAPI3REF: Enable Or Disable A Session Object -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** Enable or disable the recording of changes by a session object. When ** enabled, a session object records changes made to the database. When ** disabled - it does not. A newly created session object is enabled. -** Refer to the documentation for [sqlite3session_changeset()] for further +** Refer to the documentation for [tdsqlite3session_changeset()] for further ** details regarding how enabling and disabling a session object affects ** the eventual changesets. ** @@ -9959,11 +9959,11 @@ SQLITE_API void sqlite3session_delete(sqlite3_session *pSession); ** The return value indicates the final state of the session object: 0 if ** the session is disabled, or 1 if it is enabled. */ -SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable); +SQLITE_API int tdsqlite3session_enable(tdsqlite3_session *pSession, int bEnable); /* ** CAPI3REF: Set Or Clear the Indirect Change Flag -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** Each change recorded by a session object is marked as either direct or ** indirect. A change is marked as indirect if either: @@ -9989,16 +9989,16 @@ SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable); ** The return value indicates the final state of the indirect flag: 0 if ** it is clear, or 1 if it is set. */ -SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect); +SQLITE_API int tdsqlite3session_indirect(tdsqlite3_session *pSession, int bIndirect); /* ** CAPI3REF: Attach A Table To A Session Object -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** If argument zTab is not NULL, then it is the name of a table to attach ** to the session object passed as the first argument. All subsequent changes ** made to the table while the session object is enabled will be recorded. See -** documentation for [sqlite3session_changeset()] for further details. +** documentation for [tdsqlite3session_changeset()] for further details. ** ** Or, if argument zTab is NULL, then changes are recorded for all tables ** in the database. If additional tables are added to the database (by @@ -10033,30 +10033,30 @@ SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect) ** are recorded for rows for which (idx IS NULL) is true. However, for such ** rows a zero-length blob (SQL value X'') is stored in the changeset or ** patchset instead of a NULL value. This allows such changesets to be -** manipulated by legacy implementations of sqlite3changeset_invert(), +** manipulated by legacy implementations of tdsqlite3changeset_invert(), ** concat() and similar. ** -** The sqlite3changeset_apply() function automatically converts the +** The tdsqlite3changeset_apply() function automatically converts the ** zero-length blob back to a NULL value when updating the sqlite_stat1 -** table. However, if the application calls sqlite3changeset_new(), -** sqlite3changeset_old() or sqlite3changeset_conflict on a changeset +** table. However, if the application calls tdsqlite3changeset_new(), +** tdsqlite3changeset_old() or tdsqlite3changeset_conflict on a changeset ** iterator directly (including on a changeset iterator passed to a ** conflict-handler callback) then the X'' value is returned. The application ** must translate X'' to NULL itself if required. ** ** Legacy (older than 3.22.0) versions of the sessions module cannot capture ** changes made to the sqlite_stat1 table. Legacy versions of the -** sqlite3changeset_apply() function silently ignore any modifications to the +** tdsqlite3changeset_apply() function silently ignore any modifications to the ** sqlite_stat1 table that are part of a changeset or patchset. */ -SQLITE_API int sqlite3session_attach( - sqlite3_session *pSession, /* Session object */ +SQLITE_API int tdsqlite3session_attach( + tdsqlite3_session *pSession, /* Session object */ const char *zTab /* Table name */ ); /* ** CAPI3REF: Set a table filter on a Session Object. -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** The second argument (xFilter) is the "filter callback". For changes to rows ** in tables that are not attached to the Session object, the filter is called @@ -10064,8 +10064,8 @@ SQLITE_API int sqlite3session_attach( ** If xFilter returns 0, changes are not tracked. Note that once a table is ** attached, xFilter will not be called again. */ -SQLITE_API void sqlite3session_table_filter( - sqlite3_session *pSession, /* Session object */ +SQLITE_API void tdsqlite3session_table_filter( + tdsqlite3_session *pSession, /* Session object */ int(*xFilter)( void *pCtx, /* Copy of third arg to _filter_table() */ const char *zTab /* Table name */ @@ -10075,7 +10075,7 @@ SQLITE_API void sqlite3session_table_filter( /* ** CAPI3REF: Generate A Changeset From A Session Object -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** Obtain a changeset containing changes to the tables attached to the ** session object passed as the first argument. If successful, @@ -10105,8 +10105,8 @@ SQLITE_API void sqlite3session_table_filter( ** DELETE change only. ** ** The contents of a changeset may be traversed using an iterator created -** using the [sqlite3changeset_start()] API. A changeset may be applied to -** a database with a compatible schema using the [sqlite3changeset_apply()] +** using the [tdsqlite3changeset_start()] API. A changeset may be applied to +** a database with a compatible schema using the [tdsqlite3changeset_apply()] ** API. ** ** Within a changeset generated by this function, all changes related to a @@ -10114,12 +10114,12 @@ SQLITE_API void sqlite3session_table_filter( ** a changeset or when applying a changeset to a database, all changes related ** to a single table are processed before moving on to the next table. Tables ** are sorted in the same order in which they were attached (or auto-attached) -** to the sqlite3_session object. The order in which the changes related to +** to the tdsqlite3_session object. The order in which the changes related to ** a single table are stored is undefined. ** ** Following a successful call to this function, it is the responsibility of ** the caller to eventually free the buffer that *ppChangeset points to using -** [sqlite3_free()]. +** [tdsqlite3_free()]. ** **

Changeset Generation

** @@ -10167,7 +10167,7 @@ SQLITE_API void sqlite3session_table_filter( ** active, the resulting changeset will contain an UPDATE change instead of ** a DELETE and an INSERT. ** -** When a session object is disabled (see the [sqlite3session_enable()] API), +** When a session object is disabled (see the [tdsqlite3session_enable()] API), ** it does not accumulate records when rows are inserted, updated or deleted. ** This may appear to have some counter-intuitive effects if a single row ** is written to more than once during a session. For example, if a row @@ -10178,19 +10178,19 @@ SQLITE_API void sqlite3session_table_filter( ** another field of the same row is updated while the session is enabled, the ** resulting changeset will contain an UPDATE change that updates both fields. */ -SQLITE_API int sqlite3session_changeset( - sqlite3_session *pSession, /* Session object */ +SQLITE_API int tdsqlite3session_changeset( + tdsqlite3_session *pSession, /* Session object */ int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */ void **ppChangeset /* OUT: Buffer containing changeset */ ); /* ** CAPI3REF: Load The Difference Between Tables Into A Session -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** If it is not already attached to the session object passed as the first ** argument, this function attaches table zTbl in the same manner as the -** [sqlite3session_attach()] function. If zTbl does not exist, or if it +** [tdsqlite3session_attach()] function. If zTbl does not exist, or if it ** does not have a primary key, this function is a no-op (but does not return ** an error). ** @@ -10228,7 +10228,7 @@ SQLITE_API int sqlite3session_changeset( ** ** ** To clarify, if this function is called and then a changeset constructed -** using [sqlite3session_changeset()], then after applying that changeset to +** using [tdsqlite3session_changeset()], then after applying that changeset to ** database zFrom the contents of the two compatible tables would be ** identical. ** @@ -10239,10 +10239,10 @@ SQLITE_API int sqlite3session_changeset( ** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg ** may be set to point to a buffer containing an English language error ** message. It is the responsibility of the caller to free this buffer using -** sqlite3_free(). +** tdsqlite3_free(). */ -SQLITE_API int sqlite3session_diff( - sqlite3_session *pSession, +SQLITE_API int tdsqlite3session_diff( + tdsqlite3_session *pSession, const char *zFromDb, const char *zTbl, char **pzErrMsg @@ -10251,7 +10251,7 @@ SQLITE_API int sqlite3session_diff( /* ** CAPI3REF: Generate A Patchset From A Session Object -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** The differences between a patchset and a changeset are that: ** @@ -10263,23 +10263,23 @@ SQLITE_API int sqlite3session_diff( ** ** ** A patchset blob may be used with up to date versions of all -** sqlite3changeset_xxx API functions except for sqlite3changeset_invert(), +** tdsqlite3changeset_xxx API functions except for tdsqlite3changeset_invert(), ** which returns SQLITE_CORRUPT if it is passed a patchset. Similarly, ** attempting to use a patchset blob with old versions of the -** sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error. +** tdsqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error. ** ** Because the non-primary key "old.*" fields are omitted, no ** SQLITE_CHANGESET_DATA conflicts can be detected or reported if a patchset -** is passed to the sqlite3changeset_apply() API. Other conflict types work +** is passed to the tdsqlite3changeset_apply() API. Other conflict types work ** in the same way as for changesets. ** ** Changes within a patchset are ordered in the same way as for changesets -** generated by the sqlite3session_changeset() function (i.e. all changes for +** generated by the tdsqlite3session_changeset() function (i.e. all changes for ** a single table are grouped together, tables appear in the order in which ** they were attached to the session object). */ -SQLITE_API int sqlite3session_patchset( - sqlite3_session *pSession, /* Session object */ +SQLITE_API int tdsqlite3session_patchset( + tdsqlite3_session *pSession, /* Session object */ int *pnPatchset, /* OUT: Size of buffer at *ppPatchset */ void **ppPatchset /* OUT: Buffer containing patchset */ ); @@ -10292,18 +10292,18 @@ SQLITE_API int sqlite3session_patchset( ** more changes have been recorded, return zero. ** ** Even if this function returns zero, it is possible that calling -** [sqlite3session_changeset()] on the session handle may still return a +** [tdsqlite3session_changeset()] on the session handle may still return a ** changeset that contains no changes. This can happen when a row in ** an attached table is modified and then later on the original values ** are restored. However, if this function returns non-zero, then it is -** guaranteed that a call to sqlite3session_changeset() will return a +** guaranteed that a call to tdsqlite3session_changeset() will return a ** changeset containing zero changes. */ -SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession); +SQLITE_API int tdsqlite3session_isempty(tdsqlite3_session *pSession); /* ** CAPI3REF: Create An Iterator To Traverse A Changeset -** CONSTRUCTOR: sqlite3_changeset_iter +** CONSTRUCTOR: tdsqlite3_changeset_iter ** ** Create an iterator used to iterate through the contents of a changeset. ** If successful, *pp is set to point to the iterator handle and SQLITE_OK @@ -10314,20 +10314,20 @@ SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession); ** iterator created by this function: ** **
    -**
  • [sqlite3changeset_next()] -**
  • [sqlite3changeset_op()] -**
  • [sqlite3changeset_new()] -**
  • [sqlite3changeset_old()] +**
  • [tdsqlite3changeset_next()] +**
  • [tdsqlite3changeset_op()] +**
  • [tdsqlite3changeset_new()] +**
  • [tdsqlite3changeset_old()] **
** ** It is the responsibility of the caller to eventually destroy the iterator -** by passing it to [sqlite3changeset_finalize()]. The buffer containing the +** by passing it to [tdsqlite3changeset_finalize()]. The buffer containing the ** changeset (pChangeset) must remain valid until after the iterator is ** destroyed. ** ** Assuming the changeset blob was created by one of the -** [sqlite3session_changeset()], [sqlite3changeset_concat()] or -** [sqlite3changeset_invert()] functions, all changes within the changeset +** [tdsqlite3session_changeset()], [tdsqlite3changeset_concat()] or +** [tdsqlite3changeset_invert()] functions, all changes within the changeset ** that apply to a single table are grouped together. This means that when ** an application iterates through a changeset using an iterator created by ** this function, all changes that relate to a single table are visited @@ -10335,34 +10335,34 @@ SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession); ** the applies to table X, then one for table Y, and then later on visit ** another change for table X. ** -** The behavior of sqlite3changeset_start_v2() and its streaming equivalent +** The behavior of tdsqlite3changeset_start_v2() and its streaming equivalent ** may be modified by passing a combination of ** [SQLITE_CHANGESETSTART_INVERT | supported flags] as the 4th parameter. ** -** Note that the sqlite3changeset_start_v2() API is still experimental +** Note that the tdsqlite3changeset_start_v2() API is still experimental ** and therefore subject to change. */ -SQLITE_API int sqlite3changeset_start( - sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ +SQLITE_API int tdsqlite3changeset_start( + tdsqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ int nChangeset, /* Size of changeset blob in bytes */ void *pChangeset /* Pointer to blob containing changeset */ ); -SQLITE_API int sqlite3changeset_start_v2( - sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ +SQLITE_API int tdsqlite3changeset_start_v2( + tdsqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ int nChangeset, /* Size of changeset blob in bytes */ void *pChangeset, /* Pointer to blob containing changeset */ int flags /* SESSION_CHANGESETSTART_* flags */ ); /* -** CAPI3REF: Flags for sqlite3changeset_start_v2 +** CAPI3REF: Flags for tdsqlite3changeset_start_v2 ** ** The following flags may passed via the 4th parameter to -** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]: +** [tdsqlite3changeset_start_v2] and [tdsqlite3changeset_start_v2_strm]: ** **
SQLITE_CHANGESETAPPLY_INVERT
** Invert the changeset while iterating through it. This is equivalent to -** inverting a changeset using sqlite3changeset_invert() before applying it. +** inverting a changeset using tdsqlite3changeset_invert() before applying it. ** It is an error to specify this flag with a patchset. */ #define SQLITE_CHANGESETSTART_INVERT 0x0002 @@ -10370,20 +10370,20 @@ SQLITE_API int sqlite3changeset_start_v2( /* ** CAPI3REF: Advance A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** This function may only be used with iterators created by the function -** [sqlite3changeset_start()]. If it is called on an iterator passed to -** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE +** [tdsqlite3changeset_start()]. If it is called on an iterator passed to +** a conflict-handler callback by [tdsqlite3changeset_apply()], SQLITE_MISUSE ** is returned and the call has no effect. ** -** Immediately after an iterator is created by sqlite3changeset_start(), it +** Immediately after an iterator is created by tdsqlite3changeset_start(), it ** does not point to any change in the changeset. Assuming the changeset ** is not empty, the first call to this function advances the iterator to ** point to the first change in the changeset. Each subsequent call advances ** the iterator to point to the next change in the changeset (if any). If ** no error occurs and the iterator points to a valid change after a call -** to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned. +** to tdsqlite3changeset_next() has advanced it, SQLITE_ROW is returned. ** Otherwise, if all changes in the changeset have already been visited, ** SQLITE_DONE is returned. ** @@ -10391,27 +10391,27 @@ SQLITE_API int sqlite3changeset_start_v2( ** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or ** SQLITE_NOMEM. */ -SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter); +SQLITE_API int tdsqlite3changeset_next(tdsqlite3_changeset_iter *pIter); /* ** CAPI3REF: Obtain The Current Operation From A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** The pIter argument passed to this function may either be an iterator -** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator -** created by [sqlite3changeset_start()]. In the latter case, the most recent -** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this +** passed to a conflict-handler by [tdsqlite3changeset_apply()], or an iterator +** created by [tdsqlite3changeset_start()]. In the latter case, the most recent +** call to [tdsqlite3changeset_next()] must have returned [SQLITE_ROW]. If this ** is not the case, this function returns [SQLITE_MISUSE]. ** ** If argument pzTab is not NULL, then *pzTab is set to point to a ** nul-terminated utf-8 encoded string containing the name of the table ** affected by the current change. The buffer remains valid until either -** sqlite3changeset_next() is called on the iterator or until the +** tdsqlite3changeset_next() is called on the iterator or until the ** conflict-handler function returns. If pnCol is not NULL, then *pnCol is ** set to the number of columns in the table affected by the change. If ** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change ** is an indirect change, or false (0) otherwise. See the documentation for -** [sqlite3session_indirect()] for a description of direct and indirect +** [tdsqlite3session_indirect()] for a description of direct and indirect ** changes. Finally, if pOp is not NULL, then *pOp is set to one of ** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the ** type of change that the iterator currently points to. @@ -10420,8 +10420,8 @@ SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter); ** SQLite error code is returned. The values of the output variables may not ** be trusted in this case. */ -SQLITE_API int sqlite3changeset_op( - sqlite3_changeset_iter *pIter, /* Iterator object */ +SQLITE_API int tdsqlite3changeset_op( + tdsqlite3_changeset_iter *pIter, /* Iterator object */ const char **pzTab, /* OUT: Pointer to table name */ int *pnCol, /* OUT: Number of columns in table */ int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */ @@ -10430,7 +10430,7 @@ SQLITE_API int sqlite3changeset_op( /* ** CAPI3REF: Obtain The Primary Key Definition Of A Table -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** For each modified table, a changeset includes the following: ** @@ -10454,20 +10454,20 @@ SQLITE_API int sqlite3changeset_op( ** SQLITE_OK is returned and the output variables populated as described ** above. */ -SQLITE_API int sqlite3changeset_pk( - sqlite3_changeset_iter *pIter, /* Iterator object */ +SQLITE_API int tdsqlite3changeset_pk( + tdsqlite3_changeset_iter *pIter, /* Iterator object */ unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */ int *pnCol /* OUT: Number of entries in output array */ ); /* ** CAPI3REF: Obtain old.* Values From A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** The pIter argument passed to this function may either be an iterator -** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator -** created by [sqlite3changeset_start()]. In the latter case, the most recent -** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. +** passed to a conflict-handler by [tdsqlite3changeset_apply()], or an iterator +** created by [tdsqlite3changeset_start()]. In the latter case, the most recent +** call to [tdsqlite3changeset_next()] must have returned SQLITE_ROW. ** Furthermore, it may only be called if the type of change that the iterator ** currently points to is either [SQLITE_DELETE] or [SQLITE_UPDATE]. Otherwise, ** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL. @@ -10477,7 +10477,7 @@ SQLITE_API int sqlite3changeset_pk( ** [SQLITE_RANGE] is returned and *ppValue is set to NULL. ** ** If successful, this function sets *ppValue to point to a protected -** sqlite3_value object containing the iVal'th value from the vector of +** tdsqlite3_value object containing the iVal'th value from the vector of ** original row values stored as part of the UPDATE or DELETE change and ** returns SQLITE_OK. The name of the function comes from the fact that this ** is similar to the "old.*" columns available to update or delete triggers. @@ -10485,20 +10485,20 @@ SQLITE_API int sqlite3changeset_pk( ** If some other error occurs (e.g. an OOM condition), an SQLite error code ** is returned and *ppValue is set to NULL. */ -SQLITE_API int sqlite3changeset_old( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +SQLITE_API int tdsqlite3changeset_old( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Column number */ - sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ + tdsqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ ); /* ** CAPI3REF: Obtain new.* Values From A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** The pIter argument passed to this function may either be an iterator -** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator -** created by [sqlite3changeset_start()]. In the latter case, the most recent -** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. +** passed to a conflict-handler by [tdsqlite3changeset_apply()], or an iterator +** created by [tdsqlite3changeset_start()]. In the latter case, the most recent +** call to [tdsqlite3changeset_next()] must have returned SQLITE_ROW. ** Furthermore, it may only be called if the type of change that the iterator ** currently points to is either [SQLITE_UPDATE] or [SQLITE_INSERT]. Otherwise, ** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL. @@ -10508,7 +10508,7 @@ SQLITE_API int sqlite3changeset_old( ** [SQLITE_RANGE] is returned and *ppValue is set to NULL. ** ** If successful, this function sets *ppValue to point to a protected -** sqlite3_value object containing the iVal'th value from the vector of +** tdsqlite3_value object containing the iVal'th value from the vector of ** new row values stored as part of the UPDATE or INSERT change and ** returns SQLITE_OK. If the change is an UPDATE and does not include ** a new value for the requested column, *ppValue is set to NULL and @@ -10519,18 +10519,18 @@ SQLITE_API int sqlite3changeset_old( ** If some other error occurs (e.g. an OOM condition), an SQLite error code ** is returned and *ppValue is set to NULL. */ -SQLITE_API int sqlite3changeset_new( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +SQLITE_API int tdsqlite3changeset_new( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Column number */ - sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ + tdsqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ ); /* ** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** This function should only be used with iterator objects passed to a -** conflict-handler callback by [sqlite3changeset_apply()] with either +** conflict-handler callback by [tdsqlite3changeset_apply()] with either ** [SQLITE_CHANGESET_DATA] or [SQLITE_CHANGESET_CONFLICT]. If this function ** is called on any other iterator, [SQLITE_MISUSE] is returned and *ppValue ** is set to NULL. @@ -10540,22 +10540,22 @@ SQLITE_API int sqlite3changeset_new( ** [SQLITE_RANGE] is returned and *ppValue is set to NULL. ** ** If successful, this function sets *ppValue to point to a protected -** sqlite3_value object containing the iVal'th value from the +** tdsqlite3_value object containing the iVal'th value from the ** "conflicting row" associated with the current conflict-handler callback ** and returns SQLITE_OK. ** ** If some other error occurs (e.g. an OOM condition), an SQLite error code ** is returned and *ppValue is set to NULL. */ -SQLITE_API int sqlite3changeset_conflict( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +SQLITE_API int tdsqlite3changeset_conflict( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Column number */ - sqlite3_value **ppValue /* OUT: Value from conflicting row */ + tdsqlite3_value **ppValue /* OUT: Value from conflicting row */ ); /* ** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** This function may only be called with an iterator passed to an ** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case @@ -10564,43 +10564,43 @@ SQLITE_API int sqlite3changeset_conflict( ** ** In all other cases this function returns SQLITE_MISUSE. */ -SQLITE_API int sqlite3changeset_fk_conflicts( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +SQLITE_API int tdsqlite3changeset_fk_conflicts( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int *pnOut /* OUT: Number of FK violations */ ); /* ** CAPI3REF: Finalize A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** This function is used to finalize an iterator allocated with -** [sqlite3changeset_start()]. +** [tdsqlite3changeset_start()]. ** ** This function should only be called on iterators created using the -** [sqlite3changeset_start()] function. If an application calls this +** [tdsqlite3changeset_start()] function. If an application calls this ** function with an iterator passed to a conflict-handler by -** [sqlite3changeset_apply()], [SQLITE_MISUSE] is immediately returned and the +** [tdsqlite3changeset_apply()], [SQLITE_MISUSE] is immediately returned and the ** call has no effect. ** -** If an error was encountered within a call to an sqlite3changeset_xxx() -** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an -** [SQLITE_NOMEM] in [sqlite3changeset_new()]) then an error code corresponding +** If an error was encountered within a call to an tdsqlite3changeset_xxx() +** function (for example an [SQLITE_CORRUPT] in [tdsqlite3changeset_next()] or an +** [SQLITE_NOMEM] in [tdsqlite3changeset_new()]) then an error code corresponding ** to that error is returned by this function. Otherwise, SQLITE_OK is ** returned. This is to allow the following pattern (pseudo-code): ** **
-**   sqlite3changeset_start();
-**   while( SQLITE_ROW==sqlite3changeset_next() ){
+**   tdsqlite3changeset_start();
+**   while( SQLITE_ROW==tdsqlite3changeset_next() ){
 **     // Do something with change.
 **   }
-**   rc = sqlite3changeset_finalize();
+**   rc = tdsqlite3changeset_finalize();
 **   if( rc!=SQLITE_OK ){
 **     // An error has occurred 
 **   }
 ** 
*/ -SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); +SQLITE_API int tdsqlite3changeset_finalize(tdsqlite3_changeset_iter *pIter); /* ** CAPI3REF: Invert A Changeset @@ -10623,14 +10623,14 @@ SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); ** SQLITE_OK is returned. If an error occurs, both *pnOut and *ppOut are ** zeroed and an SQLite error code returned. ** -** It is the responsibility of the caller to eventually call sqlite3_free() +** It is the responsibility of the caller to eventually call tdsqlite3_free() ** on the *ppOut pointer to free the buffer allocation following a successful ** call to this function. ** ** WARNING/TODO: This function currently assumes that the input is a valid ** changeset. If it is not, the results are undefined. */ -SQLITE_API int sqlite3changeset_invert( +SQLITE_API int tdsqlite3changeset_invert( int nIn, const void *pIn, /* Input changeset */ int *pnOut, void **ppOut /* OUT: Inverse of input */ ); @@ -10643,25 +10643,25 @@ SQLITE_API int sqlite3changeset_invert( ** changeset A followed by changeset B. ** ** This function combines the two input changesets using an -** sqlite3_changegroup object. Calling it produces similar results as the +** tdsqlite3_changegroup object. Calling it produces similar results as the ** following code fragment: ** **
-**   sqlite3_changegroup *pGrp;
-**   rc = sqlite3_changegroup_new(&pGrp);
-**   if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA);
-**   if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB);
+**   tdsqlite3_changegroup *pGrp;
+**   rc = tdsqlite3_changegroup_new(&pGrp);
+**   if( rc==SQLITE_OK ) rc = tdsqlite3changegroup_add(pGrp, nA, pA);
+**   if( rc==SQLITE_OK ) rc = tdsqlite3changegroup_add(pGrp, nB, pB);
 **   if( rc==SQLITE_OK ){
-**     rc = sqlite3changegroup_output(pGrp, pnOut, ppOut);
+**     rc = tdsqlite3changegroup_output(pGrp, pnOut, ppOut);
 **   }else{
 **     *ppOut = 0;
 **     *pnOut = 0;
 **   }
 ** 
** -** Refer to the sqlite3_changegroup documentation below for details. +** Refer to the tdsqlite3_changegroup documentation below for details. */ -SQLITE_API int sqlite3changeset_concat( +SQLITE_API int tdsqlite3changeset_concat( int nA, /* Number of bytes in buffer pA */ void *pA, /* Pointer to buffer containing changeset A */ int nB, /* Number of bytes in buffer pB */ @@ -10677,49 +10677,49 @@ SQLITE_API int sqlite3changeset_concat( ** A changegroup is an object used to combine two or more ** [changesets] or [patchsets] */ -typedef struct sqlite3_changegroup sqlite3_changegroup; +typedef struct tdsqlite3_changegroup tdsqlite3_changegroup; /* ** CAPI3REF: Create A New Changegroup Object -** CONSTRUCTOR: sqlite3_changegroup +** CONSTRUCTOR: tdsqlite3_changegroup ** -** An sqlite3_changegroup object is used to combine two or more changesets +** An tdsqlite3_changegroup object is used to combine two or more changesets ** (or patchsets) into a single changeset (or patchset). A single changegroup ** object may combine changesets or patchsets, but not both. The output is ** always in the same format as the input. ** ** If successful, this function returns SQLITE_OK and populates (*pp) with -** a pointer to a new sqlite3_changegroup object before returning. The caller +** a pointer to a new tdsqlite3_changegroup object before returning. The caller ** should eventually free the returned object using a call to -** sqlite3changegroup_delete(). If an error occurs, an SQLite error code +** tdsqlite3changegroup_delete(). If an error occurs, an SQLite error code ** (i.e. SQLITE_NOMEM) is returned and *pp is set to NULL. ** -** The usual usage pattern for an sqlite3_changegroup object is as follows: +** The usual usage pattern for an tdsqlite3_changegroup object is as follows: ** **
    -**
  • It is created using a call to sqlite3changegroup_new(). +**
  • It is created using a call to tdsqlite3changegroup_new(). ** **
  • Zero or more changesets (or patchsets) are added to the object -** by calling sqlite3changegroup_add(). +** by calling tdsqlite3changegroup_add(). ** **
  • The result of combining all input changesets together is obtained -** by the application via a call to sqlite3changegroup_output(). +** by the application via a call to tdsqlite3changegroup_output(). ** -**
  • The object is deleted using a call to sqlite3changegroup_delete(). +**
  • The object is deleted using a call to tdsqlite3changegroup_delete(). **
** ** Any number of calls to add() and output() may be made between the calls to ** new() and delete(), and in any order. ** -** As well as the regular sqlite3changegroup_add() and -** sqlite3changegroup_output() functions, also available are the streaming -** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm(). +** As well as the regular tdsqlite3changegroup_add() and +** tdsqlite3changegroup_output() functions, also available are the streaming +** versions tdsqlite3changegroup_add_strm() and tdsqlite3changegroup_output_strm(). */ -SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); +SQLITE_API int tdsqlite3changegroup_new(tdsqlite3_changegroup **pp); /* ** CAPI3REF: Add A Changeset To A Changegroup -** METHOD: sqlite3_changegroup +** METHOD: tdsqlite3_changegroup ** ** Add all changes within the changeset (or patchset) in buffer pData (size ** nData bytes) to the changegroup. @@ -10793,19 +10793,19 @@ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); ** ** If no error occurs, SQLITE_OK is returned. */ -SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); +SQLITE_API int tdsqlite3changegroup_add(tdsqlite3_changegroup*, int nData, void *pData); /* ** CAPI3REF: Obtain A Composite Changeset From A Changegroup -** METHOD: sqlite3_changegroup +** METHOD: tdsqlite3_changegroup ** ** Obtain a buffer containing a changeset (or patchset) representing the ** current contents of the changegroup. If the inputs to the changegroup ** were themselves changesets, the output is a changeset. Or, if the ** inputs were patchsets, the output is also a patchset. ** -** As with the output of the sqlite3session_changeset() and -** sqlite3session_patchset() functions, all changes related to a single +** As with the output of the tdsqlite3session_changeset() and +** tdsqlite3session_patchset() functions, all changes related to a single ** table are grouped together in the output of this function. Tables appear ** in the same order as for the very first changeset added to the changegroup. ** If the second or subsequent changesets added to the changegroup contain @@ -10818,19 +10818,19 @@ SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pDa ** is returned and the output variables are set to the size of and a ** pointer to the output buffer, respectively. In this case it is the ** responsibility of the caller to eventually free the buffer using a -** call to sqlite3_free(). +** call to tdsqlite3_free(). */ -SQLITE_API int sqlite3changegroup_output( - sqlite3_changegroup*, +SQLITE_API int tdsqlite3changegroup_output( + tdsqlite3_changegroup*, int *pnData, /* OUT: Size of output buffer in bytes */ void **ppData /* OUT: Pointer to output buffer */ ); /* ** CAPI3REF: Delete A Changegroup Object -** DESTRUCTOR: sqlite3_changegroup +** DESTRUCTOR: tdsqlite3_changegroup */ -SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*); +SQLITE_API void tdsqlite3changegroup_delete(tdsqlite3_changegroup*); /* ** CAPI3REF: Apply A Changeset To A Database @@ -10863,13 +10863,13 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*); ** ** If there is no compatible table, it is not an error, but none of the ** changes associated with the table are applied. A warning message is issued -** via the sqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most +** via the tdsqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most ** one such warning is issued for each table in the changeset. ** ** For each change for which there is a compatible table, an attempt is made ** to modify the table contents according to the UPDATE, INSERT or DELETE ** change. If a change cannot be applied cleanly, the conflict handler -** function passed as the fifth argument to sqlite3changeset_apply() may be +** function passed as the fifth argument to tdsqlite3changeset_apply() may be ** invoked. A description of exactly when the conflict handler is invoked for ** each type of change is below. ** @@ -10883,8 +10883,8 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*); ** if the second argument passed to the conflict handler is either ** SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If the conflict-handler ** returns an illegal value, any changes already made are rolled back and -** the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different -** actions are taken by sqlite3changeset_apply() depending on the value +** the call to tdsqlite3changeset_apply() returns SQLITE_MISUSE. Different +** actions are taken by tdsqlite3changeset_apply() depending on the value ** returned by each invocation of the conflict-handler function. Refer to ** the documentation for the three ** [SQLITE_CHANGESET_OMIT|available return values] for details. @@ -10974,24 +10974,24 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*); ** SQLite error code returned. ** ** If the output parameters (ppRebase) and (pnRebase) are non-NULL and -** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2() +** the input is a changeset (not a patchset), then tdsqlite3changeset_apply_v2() ** may set (*ppRebase) to point to a "rebase" that may be used with the -** sqlite3_rebaser APIs buffer before returning. In this case (*pnRebase) +** tdsqlite3_rebaser APIs buffer before returning. In this case (*pnRebase) ** is set to the size of the buffer in bytes. It is the responsibility of the -** caller to eventually free any such buffer using sqlite3_free(). The buffer +** caller to eventually free any such buffer using tdsqlite3_free(). The buffer ** is only allocated and populated if one or more conflicts were encountered -** while applying the patchset. See comments surrounding the sqlite3_rebaser +** while applying the patchset. See comments surrounding the tdsqlite3_rebaser ** APIs for further details. ** -** The behavior of sqlite3changeset_apply_v2() and its streaming equivalent +** The behavior of tdsqlite3changeset_apply_v2() and its streaming equivalent ** may be modified by passing a combination of ** [SQLITE_CHANGESETAPPLY_NOSAVEPOINT | supported flags] as the 9th parameter. ** -** Note that the sqlite3changeset_apply_v2() API is still experimental +** Note that the tdsqlite3changeset_apply_v2() API is still experimental ** and therefore subject to change. */ -SQLITE_API int sqlite3changeset_apply( - sqlite3 *db, /* Apply change to "main" db of this handle */ +SQLITE_API int tdsqlite3changeset_apply( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int nChangeset, /* Size of changeset in bytes */ void *pChangeset, /* Changeset blob */ int(*xFilter)( @@ -11001,12 +11001,12 @@ SQLITE_API int sqlite3changeset_apply( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx /* First argument passed to xConflict */ ); -SQLITE_API int sqlite3changeset_apply_v2( - sqlite3 *db, /* Apply change to "main" db of this handle */ +SQLITE_API int tdsqlite3changeset_apply_v2( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int nChangeset, /* Size of changeset in bytes */ void *pChangeset, /* Changeset blob */ int(*xFilter)( @@ -11016,7 +11016,7 @@ SQLITE_API int sqlite3changeset_apply_v2( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx, /* First argument passed to xConflict */ void **ppRebase, int *pnRebase, /* OUT: Rebase data */ @@ -11024,10 +11024,10 @@ SQLITE_API int sqlite3changeset_apply_v2( ); /* -** CAPI3REF: Flags for sqlite3changeset_apply_v2 +** CAPI3REF: Flags for tdsqlite3changeset_apply_v2 ** ** The following flags may passed via the 9th parameter to -** [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +** [tdsqlite3changeset_apply_v2] and [tdsqlite3changeset_apply_v2_strm]: ** **
**
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
@@ -11041,7 +11041,7 @@ SQLITE_API int sqlite3changeset_apply_v2( ** **
SQLITE_CHANGESETAPPLY_INVERT
** Invert the changeset before applying it. This is equivalent to inverting -** a changeset using sqlite3changeset_invert() before applying it. It is +** a changeset using tdsqlite3changeset_invert() before applying it. It is ** an error to specify this flag with a patchset. */ #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 @@ -11069,7 +11069,7 @@ SQLITE_API int sqlite3changeset_apply_v2( ** required PRIMARY KEY fields is not present in the database. ** ** There is no conflicting row in this case. The results of invoking the -** sqlite3changeset_conflict() API are undefined. +** tdsqlite3changeset_conflict() API are undefined. ** **
SQLITE_CHANGESET_CONFLICT
** CHANGESET_CONFLICT is passed as the second argument to the conflict @@ -11089,8 +11089,8 @@ SQLITE_API int sqlite3changeset_apply_v2( ** CHANGESET_ABORT, the changeset is rolled back. ** ** No current or conflicting row information is provided. The only function -** it is possible to call on the supplied sqlite3_changeset_iter handle -** is sqlite3changeset_fk_conflicts(). +** it is possible to call on the supplied tdsqlite3_changeset_iter handle +** is tdsqlite3changeset_fk_conflicts(). ** **
SQLITE_CHANGESET_CONSTRAINT
** If any other constraint violation occurs while applying a change (i.e. @@ -11098,7 +11098,7 @@ SQLITE_API int sqlite3changeset_apply_v2( ** invoked with CHANGESET_CONSTRAINT as the second argument. ** ** There is no conflicting row in this case. The results of invoking the -** sqlite3changeset_conflict() API are undefined. +** tdsqlite3changeset_conflict() API are undefined. ** **
*/ @@ -11123,7 +11123,7 @@ SQLITE_API int sqlite3changeset_apply_v2( ** This value may only be returned if the second argument to the conflict ** handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this ** is not the case, any changes applied so far are rolled back and the -** call to sqlite3changeset_apply() returns SQLITE_MISUSE. +** call to tdsqlite3changeset_apply() returns SQLITE_MISUSE. ** ** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict ** handler, then the conflicting row is either updated or deleted, depending @@ -11136,7 +11136,7 @@ SQLITE_API int sqlite3changeset_apply_v2( ** **
SQLITE_CHANGESET_ABORT
** If this value is returned, any changes applied so far are rolled back -** and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +** and the call to tdsqlite3changeset_apply() returns SQLITE_ABORT. **
*/ #define SQLITE_CHANGESET_OMIT 0 @@ -11224,24 +11224,24 @@ SQLITE_API int sqlite3changeset_apply_v2( ** OMIT. ** ** In order to rebase a local changeset, the remote changeset must first -** be applied to the local database using sqlite3changeset_apply_v2() and +** be applied to the local database using tdsqlite3changeset_apply_v2() and ** the buffer of rebase information captured. Then: ** **
    -**
  1. An sqlite3_rebaser object is created by calling -** sqlite3rebaser_create(). +**
  2. An tdsqlite3_rebaser object is created by calling +** tdsqlite3rebaser_create(). **
  3. The new object is configured with the rebase buffer obtained from -** sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +** tdsqlite3changeset_apply_v2() by calling tdsqlite3rebaser_configure(). ** If the local changeset is to be rebased against multiple remote -** changesets, then sqlite3rebaser_configure() should be called +** changesets, then tdsqlite3rebaser_configure() should be called ** multiple times, in the same order that the multiple -** sqlite3changeset_apply_v2() calls were made. -**
  4. Each local changeset is rebased by calling sqlite3rebaser_rebase(). -**
  5. The sqlite3_rebaser object is deleted by calling -** sqlite3rebaser_delete(). +** tdsqlite3changeset_apply_v2() calls were made. +**
  6. Each local changeset is rebased by calling tdsqlite3rebaser_rebase(). +**
  7. The tdsqlite3_rebaser object is deleted by calling +** tdsqlite3rebaser_delete(). **
*/ -typedef struct sqlite3_rebaser sqlite3_rebaser; +typedef struct tdsqlite3_rebaser tdsqlite3_rebaser; /* ** CAPI3REF: Create a changeset rebaser object. @@ -11252,7 +11252,7 @@ typedef struct sqlite3_rebaser sqlite3_rebaser; ** occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew) ** to NULL. */ -SQLITE_API int sqlite3rebaser_create(sqlite3_rebaser **ppNew); +SQLITE_API int tdsqlite3rebaser_create(tdsqlite3_rebaser **ppNew); /* ** CAPI3REF: Configure a changeset rebaser object. @@ -11261,10 +11261,10 @@ SQLITE_API int sqlite3rebaser_create(sqlite3_rebaser **ppNew); ** Configure the changeset rebaser object to rebase changesets according ** to the conflict resolutions described by buffer pRebase (size nRebase ** bytes), which must have been obtained from a previous call to -** sqlite3changeset_apply_v2(). +** tdsqlite3changeset_apply_v2(). */ -SQLITE_API int sqlite3rebaser_configure( - sqlite3_rebaser*, +SQLITE_API int tdsqlite3rebaser_configure( + tdsqlite3_rebaser*, int nRebase, const void *pRebase ); @@ -11279,11 +11279,11 @@ SQLITE_API int sqlite3rebaser_configure( ** is set to point to the new buffer containing the rebased changeset and ** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the ** responsibility of the caller to eventually free the new buffer using -** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) +** tdsqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) ** are set to zero and an SQLite error code returned. */ -SQLITE_API int sqlite3rebaser_rebase( - sqlite3_rebaser*, +SQLITE_API int tdsqlite3rebaser_rebase( + tdsqlite3_rebaser*, int nIn, const void *pIn, int *pnOut, void **ppOut ); @@ -11294,9 +11294,9 @@ SQLITE_API int sqlite3rebaser_rebase( ** ** Delete the changeset rebaser object and all associated resources. There ** should be one call to this function for each successful invocation -** of sqlite3rebaser_create(). +** of tdsqlite3rebaser_create(). */ -SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p); +SQLITE_API void tdsqlite3rebaser_delete(tdsqlite3_rebaser *p); /* ** CAPI3REF: Streaming Versions of API functions. @@ -11306,19 +11306,19 @@ SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p); ** ** ** -**
Streaming functionNon-streaming equivalent
sqlite3changeset_apply_strm[sqlite3changeset_apply] -**
sqlite3changeset_apply_strm_v2[sqlite3changeset_apply_v2] -**
sqlite3changeset_concat_strm[sqlite3changeset_concat] -**
sqlite3changeset_invert_strm[sqlite3changeset_invert] -**
sqlite3changeset_start_strm[sqlite3changeset_start] -**
sqlite3session_changeset_strm[sqlite3session_changeset] -**
sqlite3session_patchset_strm[sqlite3session_patchset] +**
tdsqlite3changeset_apply_strm[tdsqlite3changeset_apply] +**
tdsqlite3changeset_apply_strm_v2[tdsqlite3changeset_apply_v2] +**
tdsqlite3changeset_concat_strm[tdsqlite3changeset_concat] +**
tdsqlite3changeset_invert_strm[tdsqlite3changeset_invert] +**
tdsqlite3changeset_start_strm[tdsqlite3changeset_start] +**
tdsqlite3session_changeset_strm[tdsqlite3session_changeset] +**
tdsqlite3session_patchset_strm[tdsqlite3session_patchset] **
** ** Non-streaming functions that accept changesets (or patchsets) as input ** require that the entire changeset be stored in a single buffer in memory. ** Similarly, those that return a changeset or patchset do so by returning -** a pointer to a single large buffer allocated using sqlite3_malloc(). +** a pointer to a single large buffer allocated using tdsqlite3_malloc(). ** Normally this is convenient. However, if an application running in a ** low-memory environment is required to handle very large changesets, the ** large contiguous memory allocations required can become onerous. @@ -11351,7 +11351,7 @@ SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p); ** an error, all processing is abandoned and the streaming API function ** returns a copy of the error code to the caller. ** -** In the case of sqlite3changeset_start_strm(), the xInput callback may be +** In the case of tdsqlite3changeset_start_strm(), the xInput callback may be ** invoked by the sessions module at any point during the lifetime of the ** iterator. If such an xInput callback returns an error, the iterator enters ** an error state, whereby all subsequent calls to iterator functions @@ -11388,8 +11388,8 @@ SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p); ** parameter set to a value less than or equal to zero. Other than this, ** no guarantees are made as to the size of the chunks of data returned. */ -SQLITE_API int sqlite3changeset_apply_strm( - sqlite3 *db, /* Apply change to "main" db of this handle */ +SQLITE_API int tdsqlite3changeset_apply_strm( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ void *pIn, /* First arg for xInput */ int(*xFilter)( @@ -11399,12 +11399,12 @@ SQLITE_API int sqlite3changeset_apply_strm( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx /* First argument passed to xConflict */ ); -SQLITE_API int sqlite3changeset_apply_v2_strm( - sqlite3 *db, /* Apply change to "main" db of this handle */ +SQLITE_API int tdsqlite3changeset_apply_v2_strm( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ void *pIn, /* First arg for xInput */ int(*xFilter)( @@ -11414,13 +11414,13 @@ SQLITE_API int sqlite3changeset_apply_v2_strm( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx, /* First argument passed to xConflict */ void **ppRebase, int *pnRebase, int flags ); -SQLITE_API int sqlite3changeset_concat_strm( +SQLITE_API int tdsqlite3changeset_concat_strm( int (*xInputA)(void *pIn, void *pData, int *pnData), void *pInA, int (*xInputB)(void *pIn, void *pData, int *pnData), @@ -11428,43 +11428,43 @@ SQLITE_API int sqlite3changeset_concat_strm( int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -SQLITE_API int sqlite3changeset_invert_strm( +SQLITE_API int tdsqlite3changeset_invert_strm( int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -SQLITE_API int sqlite3changeset_start_strm( - sqlite3_changeset_iter **pp, +SQLITE_API int tdsqlite3changeset_start_strm( + tdsqlite3_changeset_iter **pp, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn ); -SQLITE_API int sqlite3changeset_start_v2_strm( - sqlite3_changeset_iter **pp, +SQLITE_API int tdsqlite3changeset_start_v2_strm( + tdsqlite3_changeset_iter **pp, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int flags ); -SQLITE_API int sqlite3session_changeset_strm( - sqlite3_session *pSession, +SQLITE_API int tdsqlite3session_changeset_strm( + tdsqlite3_session *pSession, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -SQLITE_API int sqlite3session_patchset_strm( - sqlite3_session *pSession, +SQLITE_API int tdsqlite3session_patchset_strm( + tdsqlite3_session *pSession, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -SQLITE_API int sqlite3changegroup_add_strm(sqlite3_changegroup*, +SQLITE_API int tdsqlite3changegroup_add_strm(tdsqlite3_changegroup*, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn ); -SQLITE_API int sqlite3changegroup_output_strm(sqlite3_changegroup*, +SQLITE_API int tdsqlite3changegroup_output_strm(tdsqlite3_changegroup*, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -SQLITE_API int sqlite3rebaser_rebase_strm( - sqlite3_rebaser *pRebaser, +SQLITE_API int tdsqlite3rebaser_rebase_strm( + tdsqlite3_rebaser *pRebaser, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int (*xOutput)(void *pOut, const void *pData, int nData), @@ -11474,16 +11474,16 @@ SQLITE_API int sqlite3rebaser_rebase_strm( /* ** CAPI3REF: Configure global parameters ** -** The sqlite3session_config() interface is used to make global configuration +** The tdsqlite3session_config() interface is used to make global configuration ** changes to the sessions module in order to tune it to the specific needs ** of the application. ** -** The sqlite3session_config() interface is not threadsafe. If it is invoked +** The tdsqlite3session_config() interface is not threadsafe. If it is invoked ** while any other thread is inside any other sessions method then the ** results are undefined. Furthermore, if it is invoked after any sessions ** related objects have been created, the results are also undefined. ** -** The first argument to the sqlite3session_config() function must be one +** The first argument to the tdsqlite3session_config() function must be one ** of the SQLITE_SESSION_CONFIG_XXX constants defined below. The ** interpretation of the (void*) value passed as the second parameter and ** the effect of calling this function depends on the value of the first @@ -11504,10 +11504,10 @@ SQLITE_API int sqlite3rebaser_rebase_strm( ** This function returns SQLITE_OK if successful, or an SQLite error code ** otherwise. */ -SQLITE_API int sqlite3session_config(int op, void *pArg); +SQLITE_API int tdsqlite3session_config(int op, void *pArg); /* -** CAPI3REF: Values for sqlite3session_config(). +** CAPI3REF: Values for tdsqlite3session_config(). */ #define SQLITE_SESSION_CONFIG_STRMSIZE 1 @@ -11520,7 +11520,7 @@ SQLITE_API int sqlite3session_config(int op, void *pArg); #endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */ -/******** End of sqlite3session.h *********/ +/******** End of tdsqlite3session.h *********/ /******** Begin file fts5.h *********/ /* ** 2014 May 31 @@ -11554,7 +11554,7 @@ extern "C" { ** CUSTOM AUXILIARY FUNCTIONS ** ** Virtual table implementations may overload SQL functions by implementing -** the sqlite3_module.xFindFunction() method. +** the tdsqlite3_module.xFindFunction() method. */ typedef struct Fts5ExtensionApi Fts5ExtensionApi; @@ -11564,9 +11564,9 @@ typedef struct Fts5PhraseIter Fts5PhraseIter; typedef void (*fts5_extension_function)( const Fts5ExtensionApi *pApi, /* API offered by current FTS version */ Fts5Context *pFts, /* First arg to pass to pApi functions */ - sqlite3_context *pCtx, /* Context for returning result/error */ + tdsqlite3_context *pCtx, /* Context for returning result/error */ int nVal, /* Number of values in apVal[] array */ - sqlite3_value **apVal /* Array of trailing arguments */ + tdsqlite3_value **apVal /* Array of trailing arguments */ ); struct Fts5PhraseIter { @@ -11791,8 +11791,8 @@ struct Fts5ExtensionApi { void *(*xUserData)(Fts5Context*); int (*xColumnCount)(Fts5Context*); - int (*xRowCount)(Fts5Context*, sqlite3_int64 *pnRow); - int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64 *pnToken); + int (*xRowCount)(Fts5Context*, tdsqlite3_int64 *pnRow); + int (*xColumnTotalSize)(Fts5Context*, int iCol, tdsqlite3_int64 *pnToken); int (*xTokenize)(Fts5Context*, const char *pText, int nText, /* Text to tokenize */ @@ -11806,7 +11806,7 @@ struct Fts5ExtensionApi { int (*xInstCount)(Fts5Context*, int *pnInst); int (*xInst)(Fts5Context*, int iIdx, int *piPhrase, int *piCol, int *piOff); - sqlite3_int64 (*xRowid)(Fts5Context*); + tdsqlite3_int64 (*xRowid)(Fts5Context*); int (*xColumnText)(Fts5Context*, int iCol, const char **pz, int *pn); int (*xColumnSize)(Fts5Context*, int iCol, int *pnToken); diff --git a/sqlite/sqlite/sqlite3ext.h b/sqlite/sqlite/sqlite3ext.h index b5258e0da..1b5d136d5 100644 --- a/sqlite/sqlite/sqlite3ext.h +++ b/sqlite/sqlite/sqlite3ext.h @@ -29,303 +29,303 @@ ** versions of SQLite will not be able to load each other's shared ** libraries! */ -struct sqlite3_api_routines { - void * (*aggregate_context)(sqlite3_context*,int nBytes); - int (*aggregate_count)(sqlite3_context*); - int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*)); - int (*bind_double)(sqlite3_stmt*,int,double); - int (*bind_int)(sqlite3_stmt*,int,int); - int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64); - int (*bind_null)(sqlite3_stmt*,int); - int (*bind_parameter_count)(sqlite3_stmt*); - int (*bind_parameter_index)(sqlite3_stmt*,const char*zName); - const char * (*bind_parameter_name)(sqlite3_stmt*,int); - int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*)); - int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*)); - int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*); - int (*busy_handler)(sqlite3*,int(*)(void*,int),void*); - int (*busy_timeout)(sqlite3*,int ms); - int (*changes)(sqlite3*); - int (*close)(sqlite3*); - int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*, +struct tdsqlite3_api_routines { + void * (*aggregate_context)(tdsqlite3_context*,int nBytes); + int (*aggregate_count)(tdsqlite3_context*); + int (*bind_blob)(tdsqlite3_stmt*,int,const void*,int n,void(*)(void*)); + int (*bind_double)(tdsqlite3_stmt*,int,double); + int (*bind_int)(tdsqlite3_stmt*,int,int); + int (*bind_int64)(tdsqlite3_stmt*,int,sqlite_int64); + int (*bind_null)(tdsqlite3_stmt*,int); + int (*bind_parameter_count)(tdsqlite3_stmt*); + int (*bind_parameter_index)(tdsqlite3_stmt*,const char*zName); + const char * (*bind_parameter_name)(tdsqlite3_stmt*,int); + int (*bind_text)(tdsqlite3_stmt*,int,const char*,int n,void(*)(void*)); + int (*bind_text16)(tdsqlite3_stmt*,int,const void*,int,void(*)(void*)); + int (*bind_value)(tdsqlite3_stmt*,int,const tdsqlite3_value*); + int (*busy_handler)(tdsqlite3*,int(*)(void*,int),void*); + int (*busy_timeout)(tdsqlite3*,int ms); + int (*changes)(tdsqlite3*); + int (*close)(tdsqlite3*); + int (*collation_needed)(tdsqlite3*,void*,void(*)(void*,tdsqlite3*, int eTextRep,const char*)); - int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*, + int (*collation_needed16)(tdsqlite3*,void*,void(*)(void*,tdsqlite3*, int eTextRep,const void*)); - const void * (*column_blob)(sqlite3_stmt*,int iCol); - int (*column_bytes)(sqlite3_stmt*,int iCol); - int (*column_bytes16)(sqlite3_stmt*,int iCol); - int (*column_count)(sqlite3_stmt*pStmt); - const char * (*column_database_name)(sqlite3_stmt*,int); - const void * (*column_database_name16)(sqlite3_stmt*,int); - const char * (*column_decltype)(sqlite3_stmt*,int i); - const void * (*column_decltype16)(sqlite3_stmt*,int); - double (*column_double)(sqlite3_stmt*,int iCol); - int (*column_int)(sqlite3_stmt*,int iCol); - sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol); - const char * (*column_name)(sqlite3_stmt*,int); - const void * (*column_name16)(sqlite3_stmt*,int); - const char * (*column_origin_name)(sqlite3_stmt*,int); - const void * (*column_origin_name16)(sqlite3_stmt*,int); - const char * (*column_table_name)(sqlite3_stmt*,int); - const void * (*column_table_name16)(sqlite3_stmt*,int); - const unsigned char * (*column_text)(sqlite3_stmt*,int iCol); - const void * (*column_text16)(sqlite3_stmt*,int iCol); - int (*column_type)(sqlite3_stmt*,int iCol); - sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol); - void * (*commit_hook)(sqlite3*,int(*)(void*),void*); + const void * (*column_blob)(tdsqlite3_stmt*,int iCol); + int (*column_bytes)(tdsqlite3_stmt*,int iCol); + int (*column_bytes16)(tdsqlite3_stmt*,int iCol); + int (*column_count)(tdsqlite3_stmt*pStmt); + const char * (*column_database_name)(tdsqlite3_stmt*,int); + const void * (*column_database_name16)(tdsqlite3_stmt*,int); + const char * (*column_decltype)(tdsqlite3_stmt*,int i); + const void * (*column_decltype16)(tdsqlite3_stmt*,int); + double (*column_double)(tdsqlite3_stmt*,int iCol); + int (*column_int)(tdsqlite3_stmt*,int iCol); + sqlite_int64 (*column_int64)(tdsqlite3_stmt*,int iCol); + const char * (*column_name)(tdsqlite3_stmt*,int); + const void * (*column_name16)(tdsqlite3_stmt*,int); + const char * (*column_origin_name)(tdsqlite3_stmt*,int); + const void * (*column_origin_name16)(tdsqlite3_stmt*,int); + const char * (*column_table_name)(tdsqlite3_stmt*,int); + const void * (*column_table_name16)(tdsqlite3_stmt*,int); + const unsigned char * (*column_text)(tdsqlite3_stmt*,int iCol); + const void * (*column_text16)(tdsqlite3_stmt*,int iCol); + int (*column_type)(tdsqlite3_stmt*,int iCol); + tdsqlite3_value* (*column_value)(tdsqlite3_stmt*,int iCol); + void * (*commit_hook)(tdsqlite3*,int(*)(void*),void*); int (*complete)(const char*sql); int (*complete16)(const void*sql); - int (*create_collation)(sqlite3*,const char*,int,void*, + int (*create_collation)(tdsqlite3*,const char*,int,void*, int(*)(void*,int,const void*,int,const void*)); - int (*create_collation16)(sqlite3*,const void*,int,void*, + int (*create_collation16)(tdsqlite3*,const void*,int,void*, int(*)(void*,int,const void*,int,const void*)); - int (*create_function)(sqlite3*,const char*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*)); - int (*create_function16)(sqlite3*,const void*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*)); - int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*); - int (*data_count)(sqlite3_stmt*pStmt); - sqlite3 * (*db_handle)(sqlite3_stmt*); - int (*declare_vtab)(sqlite3*,const char*); + int (*create_function)(tdsqlite3*,const char*,int,int,void*, + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*)); + int (*create_function16)(tdsqlite3*,const void*,int,int,void*, + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*)); + int (*create_module)(tdsqlite3*,const char*,const tdsqlite3_module*,void*); + int (*data_count)(tdsqlite3_stmt*pStmt); + tdsqlite3 * (*db_handle)(tdsqlite3_stmt*); + int (*declare_vtab)(tdsqlite3*,const char*); int (*enable_shared_cache)(int); - int (*errcode)(sqlite3*db); - const char * (*errmsg)(sqlite3*); - const void * (*errmsg16)(sqlite3*); - int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**); - int (*expired)(sqlite3_stmt*); - int (*finalize)(sqlite3_stmt*pStmt); + int (*errcode)(tdsqlite3*db); + const char * (*errmsg)(tdsqlite3*); + const void * (*errmsg16)(tdsqlite3*); + int (*exec)(tdsqlite3*,const char*,tdsqlite3_callback,void*,char**); + int (*expired)(tdsqlite3_stmt*); + int (*finalize)(tdsqlite3_stmt*pStmt); void (*free)(void*); void (*free_table)(char**result); - int (*get_autocommit)(sqlite3*); - void * (*get_auxdata)(sqlite3_context*,int); - int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**); + int (*get_autocommit)(tdsqlite3*); + void * (*get_auxdata)(tdsqlite3_context*,int); + int (*get_table)(tdsqlite3*,const char*,char***,int*,int*,char**); int (*global_recover)(void); - void (*interruptx)(sqlite3*); - sqlite_int64 (*last_insert_rowid)(sqlite3*); + void (*interruptx)(tdsqlite3*); + sqlite_int64 (*last_insert_rowid)(tdsqlite3*); const char * (*libversion)(void); int (*libversion_number)(void); void *(*malloc)(int); char * (*mprintf)(const char*,...); - int (*open)(const char*,sqlite3**); - int (*open16)(const void*,sqlite3**); - int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); - int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); - void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*); - void (*progress_handler)(sqlite3*,int,int(*)(void*),void*); + int (*open)(const char*,tdsqlite3**); + int (*open16)(const void*,tdsqlite3**); + int (*prepare)(tdsqlite3*,const char*,int,tdsqlite3_stmt**,const char**); + int (*prepare16)(tdsqlite3*,const void*,int,tdsqlite3_stmt**,const void**); + void * (*profile)(tdsqlite3*,void(*)(void*,const char*,sqlite_uint64),void*); + void (*progress_handler)(tdsqlite3*,int,int(*)(void*),void*); void *(*realloc)(void*,int); - int (*reset)(sqlite3_stmt*pStmt); - void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_double)(sqlite3_context*,double); - void (*result_error)(sqlite3_context*,const char*,int); - void (*result_error16)(sqlite3_context*,const void*,int); - void (*result_int)(sqlite3_context*,int); - void (*result_int64)(sqlite3_context*,sqlite_int64); - void (*result_null)(sqlite3_context*); - void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*)); - void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_value)(sqlite3_context*,sqlite3_value*); - void * (*rollback_hook)(sqlite3*,void(*)(void*),void*); - int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*, + int (*reset)(tdsqlite3_stmt*pStmt); + void (*result_blob)(tdsqlite3_context*,const void*,int,void(*)(void*)); + void (*result_double)(tdsqlite3_context*,double); + void (*result_error)(tdsqlite3_context*,const char*,int); + void (*result_error16)(tdsqlite3_context*,const void*,int); + void (*result_int)(tdsqlite3_context*,int); + void (*result_int64)(tdsqlite3_context*,sqlite_int64); + void (*result_null)(tdsqlite3_context*); + void (*result_text)(tdsqlite3_context*,const char*,int,void(*)(void*)); + void (*result_text16)(tdsqlite3_context*,const void*,int,void(*)(void*)); + void (*result_text16be)(tdsqlite3_context*,const void*,int,void(*)(void*)); + void (*result_text16le)(tdsqlite3_context*,const void*,int,void(*)(void*)); + void (*result_value)(tdsqlite3_context*,tdsqlite3_value*); + void * (*rollback_hook)(tdsqlite3*,void(*)(void*),void*); + int (*set_authorizer)(tdsqlite3*,int(*)(void*,int,const char*,const char*, const char*,const char*),void*); - void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*)); + void (*set_auxdata)(tdsqlite3_context*,int,void*,void (*)(void*)); char * (*xsnprintf)(int,char*,const char*,...); - int (*step)(sqlite3_stmt*); - int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*, + int (*step)(tdsqlite3_stmt*); + int (*table_column_metadata)(tdsqlite3*,const char*,const char*,const char*, char const**,char const**,int*,int*,int*); void (*thread_cleanup)(void); - int (*total_changes)(sqlite3*); - void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*); - int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*); - void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*, + int (*total_changes)(tdsqlite3*); + void * (*trace)(tdsqlite3*,void(*xTrace)(void*,const char*),void*); + int (*transfer_bindings)(tdsqlite3_stmt*,tdsqlite3_stmt*); + void * (*update_hook)(tdsqlite3*,void(*)(void*,int ,char const*,char const*, sqlite_int64),void*); - void * (*user_data)(sqlite3_context*); - const void * (*value_blob)(sqlite3_value*); - int (*value_bytes)(sqlite3_value*); - int (*value_bytes16)(sqlite3_value*); - double (*value_double)(sqlite3_value*); - int (*value_int)(sqlite3_value*); - sqlite_int64 (*value_int64)(sqlite3_value*); - int (*value_numeric_type)(sqlite3_value*); - const unsigned char * (*value_text)(sqlite3_value*); - const void * (*value_text16)(sqlite3_value*); - const void * (*value_text16be)(sqlite3_value*); - const void * (*value_text16le)(sqlite3_value*); - int (*value_type)(sqlite3_value*); + void * (*user_data)(tdsqlite3_context*); + const void * (*value_blob)(tdsqlite3_value*); + int (*value_bytes)(tdsqlite3_value*); + int (*value_bytes16)(tdsqlite3_value*); + double (*value_double)(tdsqlite3_value*); + int (*value_int)(tdsqlite3_value*); + sqlite_int64 (*value_int64)(tdsqlite3_value*); + int (*value_numeric_type)(tdsqlite3_value*); + const unsigned char * (*value_text)(tdsqlite3_value*); + const void * (*value_text16)(tdsqlite3_value*); + const void * (*value_text16be)(tdsqlite3_value*); + const void * (*value_text16le)(tdsqlite3_value*); + int (*value_type)(tdsqlite3_value*); char *(*vmprintf)(const char*,va_list); /* Added ??? */ - int (*overload_function)(sqlite3*, const char *zFuncName, int nArg); + int (*overload_function)(tdsqlite3*, const char *zFuncName, int nArg); /* Added by 3.3.13 */ - int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); - int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); - int (*clear_bindings)(sqlite3_stmt*); + int (*prepare_v2)(tdsqlite3*,const char*,int,tdsqlite3_stmt**,const char**); + int (*prepare16_v2)(tdsqlite3*,const void*,int,tdsqlite3_stmt**,const void**); + int (*clear_bindings)(tdsqlite3_stmt*); /* Added by 3.4.1 */ - int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*, + int (*create_module_v2)(tdsqlite3*,const char*,const tdsqlite3_module*,void*, void (*xDestroy)(void *)); /* Added by 3.5.0 */ - int (*bind_zeroblob)(sqlite3_stmt*,int,int); - int (*blob_bytes)(sqlite3_blob*); - int (*blob_close)(sqlite3_blob*); - int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64, - int,sqlite3_blob**); - int (*blob_read)(sqlite3_blob*,void*,int,int); - int (*blob_write)(sqlite3_blob*,const void*,int,int); - int (*create_collation_v2)(sqlite3*,const char*,int,void*, + int (*bind_zeroblob)(tdsqlite3_stmt*,int,int); + int (*blob_bytes)(tdsqlite3_blob*); + int (*blob_close)(tdsqlite3_blob*); + int (*blob_open)(tdsqlite3*,const char*,const char*,const char*,tdsqlite3_int64, + int,tdsqlite3_blob**); + int (*blob_read)(tdsqlite3_blob*,void*,int,int); + int (*blob_write)(tdsqlite3_blob*,const void*,int,int); + int (*create_collation_v2)(tdsqlite3*,const char*,int,void*, int(*)(void*,int,const void*,int,const void*), void(*)(void*)); - int (*file_control)(sqlite3*,const char*,int,void*); - sqlite3_int64 (*memory_highwater)(int); - sqlite3_int64 (*memory_used)(void); - sqlite3_mutex *(*mutex_alloc)(int); - void (*mutex_enter)(sqlite3_mutex*); - void (*mutex_free)(sqlite3_mutex*); - void (*mutex_leave)(sqlite3_mutex*); - int (*mutex_try)(sqlite3_mutex*); - int (*open_v2)(const char*,sqlite3**,int,const char*); + int (*file_control)(tdsqlite3*,const char*,int,void*); + tdsqlite3_int64 (*memory_highwater)(int); + tdsqlite3_int64 (*memory_used)(void); + tdsqlite3_mutex *(*mutex_alloc)(int); + void (*mutex_enter)(tdsqlite3_mutex*); + void (*mutex_free)(tdsqlite3_mutex*); + void (*mutex_leave)(tdsqlite3_mutex*); + int (*mutex_try)(tdsqlite3_mutex*); + int (*open_v2)(const char*,tdsqlite3**,int,const char*); int (*release_memory)(int); - void (*result_error_nomem)(sqlite3_context*); - void (*result_error_toobig)(sqlite3_context*); + void (*result_error_nomem)(tdsqlite3_context*); + void (*result_error_toobig)(tdsqlite3_context*); int (*sleep)(int); void (*soft_heap_limit)(int); - sqlite3_vfs *(*vfs_find)(const char*); - int (*vfs_register)(sqlite3_vfs*,int); - int (*vfs_unregister)(sqlite3_vfs*); + tdsqlite3_vfs *(*vfs_find)(const char*); + int (*vfs_register)(tdsqlite3_vfs*,int); + int (*vfs_unregister)(tdsqlite3_vfs*); int (*xthreadsafe)(void); - void (*result_zeroblob)(sqlite3_context*,int); - void (*result_error_code)(sqlite3_context*,int); + void (*result_zeroblob)(tdsqlite3_context*,int); + void (*result_error_code)(tdsqlite3_context*,int); int (*test_control)(int, ...); void (*randomness)(int,void*); - sqlite3 *(*context_db_handle)(sqlite3_context*); - int (*extended_result_codes)(sqlite3*,int); - int (*limit)(sqlite3*,int,int); - sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*); - const char *(*sql)(sqlite3_stmt*); + tdsqlite3 *(*context_db_handle)(tdsqlite3_context*); + int (*extended_result_codes)(tdsqlite3*,int); + int (*limit)(tdsqlite3*,int,int); + tdsqlite3_stmt *(*next_stmt)(tdsqlite3*,tdsqlite3_stmt*); + const char *(*sql)(tdsqlite3_stmt*); int (*status)(int,int*,int*,int); - int (*backup_finish)(sqlite3_backup*); - sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*); - int (*backup_pagecount)(sqlite3_backup*); - int (*backup_remaining)(sqlite3_backup*); - int (*backup_step)(sqlite3_backup*,int); + int (*backup_finish)(tdsqlite3_backup*); + tdsqlite3_backup *(*backup_init)(tdsqlite3*,const char*,tdsqlite3*,const char*); + int (*backup_pagecount)(tdsqlite3_backup*); + int (*backup_remaining)(tdsqlite3_backup*); + int (*backup_step)(tdsqlite3_backup*,int); const char *(*compileoption_get)(int); int (*compileoption_used)(const char*); - int (*create_function_v2)(sqlite3*,const char*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), + int (*create_function_v2)(tdsqlite3*,const char*,int,int,void*, + void (*xFunc)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*), void(*xDestroy)(void*)); - int (*db_config)(sqlite3*,int,...); - sqlite3_mutex *(*db_mutex)(sqlite3*); - int (*db_status)(sqlite3*,int,int*,int*,int); - int (*extended_errcode)(sqlite3*); + int (*db_config)(tdsqlite3*,int,...); + tdsqlite3_mutex *(*db_mutex)(tdsqlite3*); + int (*db_status)(tdsqlite3*,int,int*,int*,int); + int (*extended_errcode)(tdsqlite3*); void (*log)(int,const char*,...); - sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64); + tdsqlite3_int64 (*soft_heap_limit64)(tdsqlite3_int64); const char *(*sourceid)(void); - int (*stmt_status)(sqlite3_stmt*,int,int); + int (*stmt_status)(tdsqlite3_stmt*,int,int); int (*strnicmp)(const char*,const char*,int); - int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*); - int (*wal_autocheckpoint)(sqlite3*,int); - int (*wal_checkpoint)(sqlite3*,const char*); - void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*); - int (*blob_reopen)(sqlite3_blob*,sqlite3_int64); - int (*vtab_config)(sqlite3*,int op,...); - int (*vtab_on_conflict)(sqlite3*); + int (*unlock_notify)(tdsqlite3*,void(*)(void**,int),void*); + int (*wal_autocheckpoint)(tdsqlite3*,int); + int (*wal_checkpoint)(tdsqlite3*,const char*); + void *(*wal_hook)(tdsqlite3*,int(*)(void*,tdsqlite3*,const char*,int),void*); + int (*blob_reopen)(tdsqlite3_blob*,tdsqlite3_int64); + int (*vtab_config)(tdsqlite3*,int op,...); + int (*vtab_on_conflict)(tdsqlite3*); /* Version 3.7.16 and later */ - int (*close_v2)(sqlite3*); - const char *(*db_filename)(sqlite3*,const char*); - int (*db_readonly)(sqlite3*,const char*); - int (*db_release_memory)(sqlite3*); + int (*close_v2)(tdsqlite3*); + const char *(*db_filename)(tdsqlite3*,const char*); + int (*db_readonly)(tdsqlite3*,const char*); + int (*db_release_memory)(tdsqlite3*); const char *(*errstr)(int); - int (*stmt_busy)(sqlite3_stmt*); - int (*stmt_readonly)(sqlite3_stmt*); + int (*stmt_busy)(tdsqlite3_stmt*); + int (*stmt_readonly)(tdsqlite3_stmt*); int (*stricmp)(const char*,const char*); int (*uri_boolean)(const char*,const char*,int); - sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64); + tdsqlite3_int64 (*uri_int64)(const char*,const char*,tdsqlite3_int64); const char *(*uri_parameter)(const char*,const char*); char *(*xvsnprintf)(int,char*,const char*,va_list); - int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*); + int (*wal_checkpoint_v2)(tdsqlite3*,const char*,int,int*,int*); /* Version 3.8.7 and later */ int (*auto_extension)(void(*)(void)); - int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64, + int (*bind_blob64)(tdsqlite3_stmt*,int,const void*,tdsqlite3_uint64, void(*)(void*)); - int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64, + int (*bind_text64)(tdsqlite3_stmt*,int,const char*,tdsqlite3_uint64, void(*)(void*),unsigned char); int (*cancel_auto_extension)(void(*)(void)); - int (*load_extension)(sqlite3*,const char*,const char*,char**); - void *(*malloc64)(sqlite3_uint64); - sqlite3_uint64 (*msize)(void*); - void *(*realloc64)(void*,sqlite3_uint64); + int (*load_extension)(tdsqlite3*,const char*,const char*,char**); + void *(*malloc64)(tdsqlite3_uint64); + tdsqlite3_uint64 (*msize)(void*); + void *(*realloc64)(void*,tdsqlite3_uint64); void (*reset_auto_extension)(void); - void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64, + void (*result_blob64)(tdsqlite3_context*,const void*,tdsqlite3_uint64, void(*)(void*)); - void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64, + void (*result_text64)(tdsqlite3_context*,const char*,tdsqlite3_uint64, void(*)(void*), unsigned char); int (*strglob)(const char*,const char*); /* Version 3.8.11 and later */ - sqlite3_value *(*value_dup)(const sqlite3_value*); - void (*value_free)(sqlite3_value*); - int (*result_zeroblob64)(sqlite3_context*,sqlite3_uint64); - int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64); + tdsqlite3_value *(*value_dup)(const tdsqlite3_value*); + void (*value_free)(tdsqlite3_value*); + int (*result_zeroblob64)(tdsqlite3_context*,tdsqlite3_uint64); + int (*bind_zeroblob64)(tdsqlite3_stmt*, int, tdsqlite3_uint64); /* Version 3.9.0 and later */ - unsigned int (*value_subtype)(sqlite3_value*); - void (*result_subtype)(sqlite3_context*,unsigned int); + unsigned int (*value_subtype)(tdsqlite3_value*); + void (*result_subtype)(tdsqlite3_context*,unsigned int); /* Version 3.10.0 and later */ - int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int); + int (*status64)(int,tdsqlite3_int64*,tdsqlite3_int64*,int); int (*strlike)(const char*,const char*,unsigned int); - int (*db_cacheflush)(sqlite3*); + int (*db_cacheflush)(tdsqlite3*); /* Version 3.12.0 and later */ - int (*system_errno)(sqlite3*); + int (*system_errno)(tdsqlite3*); /* Version 3.14.0 and later */ - int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*); - char *(*expanded_sql)(sqlite3_stmt*); + int (*trace_v2)(tdsqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*); + char *(*expanded_sql)(tdsqlite3_stmt*); /* Version 3.18.0 and later */ - void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64); + void (*set_last_insert_rowid)(tdsqlite3*,tdsqlite3_int64); /* Version 3.20.0 and later */ - int (*prepare_v3)(sqlite3*,const char*,int,unsigned int, - sqlite3_stmt**,const char**); - int (*prepare16_v3)(sqlite3*,const void*,int,unsigned int, - sqlite3_stmt**,const void**); - int (*bind_pointer)(sqlite3_stmt*,int,void*,const char*,void(*)(void*)); - void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*)); - void *(*value_pointer)(sqlite3_value*,const char*); - int (*vtab_nochange)(sqlite3_context*); - int (*value_nochange)(sqlite3_value*); - const char *(*vtab_collation)(sqlite3_index_info*,int); + int (*prepare_v3)(tdsqlite3*,const char*,int,unsigned int, + tdsqlite3_stmt**,const char**); + int (*prepare16_v3)(tdsqlite3*,const void*,int,unsigned int, + tdsqlite3_stmt**,const void**); + int (*bind_pointer)(tdsqlite3_stmt*,int,void*,const char*,void(*)(void*)); + void (*result_pointer)(tdsqlite3_context*,void*,const char*,void(*)(void*)); + void *(*value_pointer)(tdsqlite3_value*,const char*); + int (*vtab_nochange)(tdsqlite3_context*); + int (*value_nochange)(tdsqlite3_value*); + const char *(*vtab_collation)(tdsqlite3_index_info*,int); /* Version 3.24.0 and later */ int (*keyword_count)(void); int (*keyword_name)(int,const char**,int*); int (*keyword_check)(const char*,int); - sqlite3_str *(*str_new)(sqlite3*); - char *(*str_finish)(sqlite3_str*); - void (*str_appendf)(sqlite3_str*, const char *zFormat, ...); - void (*str_vappendf)(sqlite3_str*, const char *zFormat, va_list); - void (*str_append)(sqlite3_str*, const char *zIn, int N); - void (*str_appendall)(sqlite3_str*, const char *zIn); - void (*str_appendchar)(sqlite3_str*, int N, char C); - void (*str_reset)(sqlite3_str*); - int (*str_errcode)(sqlite3_str*); - int (*str_length)(sqlite3_str*); - char *(*str_value)(sqlite3_str*); + tdsqlite3_str *(*str_new)(tdsqlite3*); + char *(*str_finish)(tdsqlite3_str*); + void (*str_appendf)(tdsqlite3_str*, const char *zFormat, ...); + void (*str_vappendf)(tdsqlite3_str*, const char *zFormat, va_list); + void (*str_append)(tdsqlite3_str*, const char *zIn, int N); + void (*str_appendall)(tdsqlite3_str*, const char *zIn); + void (*str_appendchar)(tdsqlite3_str*, int N, char C); + void (*str_reset)(tdsqlite3_str*); + int (*str_errcode)(tdsqlite3_str*); + int (*str_length)(tdsqlite3_str*); + char *(*str_value)(tdsqlite3_str*); /* Version 3.25.0 and later */ - int (*create_window_function)(sqlite3*,const char*,int,int,void*, - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), - void (*xValue)(sqlite3_context*), - void (*xInv)(sqlite3_context*,int,sqlite3_value**), + int (*create_window_function)(tdsqlite3*,const char*,int,int,void*, + void (*xStep)(tdsqlite3_context*,int,tdsqlite3_value**), + void (*xFinal)(tdsqlite3_context*), + void (*xValue)(tdsqlite3_context*), + void (*xInv)(tdsqlite3_context*,int,tdsqlite3_value**), void(*xDestroy)(void*)); /* Version 3.26.0 and later */ - const char *(*normalized_sql)(sqlite3_stmt*); + const char *(*normalized_sql)(tdsqlite3_stmt*); /* Version 3.28.0 and later */ - int (*stmt_isexplain)(sqlite3_stmt*); - int (*value_frombind)(sqlite3_value*); + int (*stmt_isexplain)(tdsqlite3_stmt*); + int (*value_frombind)(tdsqlite3_value*); /* Version 3.30.0 and later */ - int (*drop_modules)(sqlite3*,const char**); + int (*drop_modules)(tdsqlite3*,const char**); /* Version 3.31.0 and later */ - sqlite3_int64 (*hard_heap_limit64)(sqlite3_int64); + tdsqlite3_int64 (*hard_heap_limit64)(tdsqlite3_int64); const char *(*uri_key)(const char*,int); const char *(*filename_database)(const char*); const char *(*filename_journal)(const char*); @@ -336,309 +336,309 @@ struct sqlite3_api_routines { ** This is the function signature used for all extension entry points. It ** is also defined in the file "loadext.c". */ -typedef int (*sqlite3_loadext_entry)( - sqlite3 *db, /* Handle to the database. */ +typedef int (*tdsqlite3_loadext_entry)( + tdsqlite3 *db, /* Handle to the database. */ char **pzErrMsg, /* Used to set error string on failure. */ - const sqlite3_api_routines *pThunk /* Extension API function pointers. */ + const tdsqlite3_api_routines *pThunk /* Extension API function pointers. */ ); /* ** The following macros redefine the API routines so that they are -** redirected through the global sqlite3_api structure. +** redirected through the global tdsqlite3_api structure. ** ** This header file is also used by the loadext.c source file ** (part of the main SQLite library - not an extension) so that -** it can get access to the sqlite3_api_routines structure +** it can get access to the tdsqlite3_api_routines structure ** definition. But the main library does not want to redefine ** the API. So the redefinition macros are only valid if the ** SQLITE_CORE macros is undefined. */ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) -#define sqlite3_aggregate_context sqlite3_api->aggregate_context +#define tdsqlite3_aggregate_context tdsqlite3_api->aggregate_context #ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_aggregate_count sqlite3_api->aggregate_count +#define tdsqlite3_aggregate_count tdsqlite3_api->aggregate_count #endif -#define sqlite3_bind_blob sqlite3_api->bind_blob -#define sqlite3_bind_double sqlite3_api->bind_double -#define sqlite3_bind_int sqlite3_api->bind_int -#define sqlite3_bind_int64 sqlite3_api->bind_int64 -#define sqlite3_bind_null sqlite3_api->bind_null -#define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count -#define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index -#define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name -#define sqlite3_bind_text sqlite3_api->bind_text -#define sqlite3_bind_text16 sqlite3_api->bind_text16 -#define sqlite3_bind_value sqlite3_api->bind_value -#define sqlite3_busy_handler sqlite3_api->busy_handler -#define sqlite3_busy_timeout sqlite3_api->busy_timeout -#define sqlite3_changes sqlite3_api->changes -#define sqlite3_close sqlite3_api->close -#define sqlite3_collation_needed sqlite3_api->collation_needed -#define sqlite3_collation_needed16 sqlite3_api->collation_needed16 -#define sqlite3_column_blob sqlite3_api->column_blob -#define sqlite3_column_bytes sqlite3_api->column_bytes -#define sqlite3_column_bytes16 sqlite3_api->column_bytes16 -#define sqlite3_column_count sqlite3_api->column_count -#define sqlite3_column_database_name sqlite3_api->column_database_name -#define sqlite3_column_database_name16 sqlite3_api->column_database_name16 -#define sqlite3_column_decltype sqlite3_api->column_decltype -#define sqlite3_column_decltype16 sqlite3_api->column_decltype16 -#define sqlite3_column_double sqlite3_api->column_double -#define sqlite3_column_int sqlite3_api->column_int -#define sqlite3_column_int64 sqlite3_api->column_int64 -#define sqlite3_column_name sqlite3_api->column_name -#define sqlite3_column_name16 sqlite3_api->column_name16 -#define sqlite3_column_origin_name sqlite3_api->column_origin_name -#define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16 -#define sqlite3_column_table_name sqlite3_api->column_table_name -#define sqlite3_column_table_name16 sqlite3_api->column_table_name16 -#define sqlite3_column_text sqlite3_api->column_text -#define sqlite3_column_text16 sqlite3_api->column_text16 -#define sqlite3_column_type sqlite3_api->column_type -#define sqlite3_column_value sqlite3_api->column_value -#define sqlite3_commit_hook sqlite3_api->commit_hook -#define sqlite3_complete sqlite3_api->complete -#define sqlite3_complete16 sqlite3_api->complete16 -#define sqlite3_create_collation sqlite3_api->create_collation -#define sqlite3_create_collation16 sqlite3_api->create_collation16 -#define sqlite3_create_function sqlite3_api->create_function -#define sqlite3_create_function16 sqlite3_api->create_function16 -#define sqlite3_create_module sqlite3_api->create_module -#define sqlite3_create_module_v2 sqlite3_api->create_module_v2 -#define sqlite3_data_count sqlite3_api->data_count -#define sqlite3_db_handle sqlite3_api->db_handle -#define sqlite3_declare_vtab sqlite3_api->declare_vtab -#define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache -#define sqlite3_errcode sqlite3_api->errcode -#define sqlite3_errmsg sqlite3_api->errmsg -#define sqlite3_errmsg16 sqlite3_api->errmsg16 -#define sqlite3_exec sqlite3_api->exec +#define tdsqlite3_bind_blob tdsqlite3_api->bind_blob +#define tdsqlite3_bind_double tdsqlite3_api->bind_double +#define tdsqlite3_bind_int tdsqlite3_api->bind_int +#define tdsqlite3_bind_int64 tdsqlite3_api->bind_int64 +#define tdsqlite3_bind_null tdsqlite3_api->bind_null +#define tdsqlite3_bind_parameter_count tdsqlite3_api->bind_parameter_count +#define tdsqlite3_bind_parameter_index tdsqlite3_api->bind_parameter_index +#define tdsqlite3_bind_parameter_name tdsqlite3_api->bind_parameter_name +#define tdsqlite3_bind_text tdsqlite3_api->bind_text +#define tdsqlite3_bind_text16 tdsqlite3_api->bind_text16 +#define tdsqlite3_bind_value tdsqlite3_api->bind_value +#define tdsqlite3_busy_handler tdsqlite3_api->busy_handler +#define tdsqlite3_busy_timeout tdsqlite3_api->busy_timeout +#define tdsqlite3_changes tdsqlite3_api->changes +#define tdsqlite3_close tdsqlite3_api->close +#define tdsqlite3_collation_needed tdsqlite3_api->collation_needed +#define tdsqlite3_collation_needed16 tdsqlite3_api->collation_needed16 +#define tdsqlite3_column_blob tdsqlite3_api->column_blob +#define tdsqlite3_column_bytes tdsqlite3_api->column_bytes +#define tdsqlite3_column_bytes16 tdsqlite3_api->column_bytes16 +#define tdsqlite3_column_count tdsqlite3_api->column_count +#define tdsqlite3_column_database_name tdsqlite3_api->column_database_name +#define tdsqlite3_column_database_name16 tdsqlite3_api->column_database_name16 +#define tdsqlite3_column_decltype tdsqlite3_api->column_decltype +#define tdsqlite3_column_decltype16 tdsqlite3_api->column_decltype16 +#define tdsqlite3_column_double tdsqlite3_api->column_double +#define tdsqlite3_column_int tdsqlite3_api->column_int +#define tdsqlite3_column_int64 tdsqlite3_api->column_int64 +#define tdsqlite3_column_name tdsqlite3_api->column_name +#define tdsqlite3_column_name16 tdsqlite3_api->column_name16 +#define tdsqlite3_column_origin_name tdsqlite3_api->column_origin_name +#define tdsqlite3_column_origin_name16 tdsqlite3_api->column_origin_name16 +#define tdsqlite3_column_table_name tdsqlite3_api->column_table_name +#define tdsqlite3_column_table_name16 tdsqlite3_api->column_table_name16 +#define tdsqlite3_column_text tdsqlite3_api->column_text +#define tdsqlite3_column_text16 tdsqlite3_api->column_text16 +#define tdsqlite3_column_type tdsqlite3_api->column_type +#define tdsqlite3_column_value tdsqlite3_api->column_value +#define tdsqlite3_commit_hook tdsqlite3_api->commit_hook +#define tdsqlite3_complete tdsqlite3_api->complete +#define tdsqlite3_complete16 tdsqlite3_api->complete16 +#define tdsqlite3_create_collation tdsqlite3_api->create_collation +#define tdsqlite3_create_collation16 tdsqlite3_api->create_collation16 +#define tdsqlite3_create_function tdsqlite3_api->create_function +#define tdsqlite3_create_function16 tdsqlite3_api->create_function16 +#define tdsqlite3_create_module tdsqlite3_api->create_module +#define tdsqlite3_create_module_v2 tdsqlite3_api->create_module_v2 +#define tdsqlite3_data_count tdsqlite3_api->data_count +#define tdsqlite3_db_handle tdsqlite3_api->db_handle +#define tdsqlite3_declare_vtab tdsqlite3_api->declare_vtab +#define tdsqlite3_enable_shared_cache tdsqlite3_api->enable_shared_cache +#define tdsqlite3_errcode tdsqlite3_api->errcode +#define tdsqlite3_errmsg tdsqlite3_api->errmsg +#define tdsqlite3_errmsg16 tdsqlite3_api->errmsg16 +#define tdsqlite3_exec tdsqlite3_api->exec #ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_expired sqlite3_api->expired +#define tdsqlite3_expired tdsqlite3_api->expired #endif -#define sqlite3_finalize sqlite3_api->finalize -#define sqlite3_free sqlite3_api->free -#define sqlite3_free_table sqlite3_api->free_table -#define sqlite3_get_autocommit sqlite3_api->get_autocommit -#define sqlite3_get_auxdata sqlite3_api->get_auxdata -#define sqlite3_get_table sqlite3_api->get_table +#define tdsqlite3_finalize tdsqlite3_api->finalize +#define tdsqlite3_free tdsqlite3_api->free +#define tdsqlite3_free_table tdsqlite3_api->free_table +#define tdsqlite3_get_autocommit tdsqlite3_api->get_autocommit +#define tdsqlite3_get_auxdata tdsqlite3_api->get_auxdata +#define tdsqlite3_get_table tdsqlite3_api->get_table #ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_global_recover sqlite3_api->global_recover +#define tdsqlite3_global_recover tdsqlite3_api->global_recover #endif -#define sqlite3_interrupt sqlite3_api->interruptx -#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid -#define sqlite3_libversion sqlite3_api->libversion -#define sqlite3_libversion_number sqlite3_api->libversion_number -#define sqlite3_malloc sqlite3_api->malloc -#define sqlite3_mprintf sqlite3_api->mprintf -#define sqlite3_open sqlite3_api->open -#define sqlite3_open16 sqlite3_api->open16 -#define sqlite3_prepare sqlite3_api->prepare -#define sqlite3_prepare16 sqlite3_api->prepare16 -#define sqlite3_prepare_v2 sqlite3_api->prepare_v2 -#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2 -#define sqlite3_profile sqlite3_api->profile -#define sqlite3_progress_handler sqlite3_api->progress_handler -#define sqlite3_realloc sqlite3_api->realloc -#define sqlite3_reset sqlite3_api->reset -#define sqlite3_result_blob sqlite3_api->result_blob -#define sqlite3_result_double sqlite3_api->result_double -#define sqlite3_result_error sqlite3_api->result_error -#define sqlite3_result_error16 sqlite3_api->result_error16 -#define sqlite3_result_int sqlite3_api->result_int -#define sqlite3_result_int64 sqlite3_api->result_int64 -#define sqlite3_result_null sqlite3_api->result_null -#define sqlite3_result_text sqlite3_api->result_text -#define sqlite3_result_text16 sqlite3_api->result_text16 -#define sqlite3_result_text16be sqlite3_api->result_text16be -#define sqlite3_result_text16le sqlite3_api->result_text16le -#define sqlite3_result_value sqlite3_api->result_value -#define sqlite3_rollback_hook sqlite3_api->rollback_hook -#define sqlite3_set_authorizer sqlite3_api->set_authorizer -#define sqlite3_set_auxdata sqlite3_api->set_auxdata -#define sqlite3_snprintf sqlite3_api->xsnprintf -#define sqlite3_step sqlite3_api->step -#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata -#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup -#define sqlite3_total_changes sqlite3_api->total_changes -#define sqlite3_trace sqlite3_api->trace +#define tdsqlite3_interrupt tdsqlite3_api->interruptx +#define tdsqlite3_last_insert_rowid tdsqlite3_api->last_insert_rowid +#define tdsqlite3_libversion tdsqlite3_api->libversion +#define tdsqlite3_libversion_number tdsqlite3_api->libversion_number +#define tdsqlite3_malloc tdsqlite3_api->malloc +#define tdsqlite3_mprintf tdsqlite3_api->mprintf +#define tdsqlite3_open tdsqlite3_api->open +#define tdsqlite3_open16 tdsqlite3_api->open16 +#define tdsqlite3_prepare tdsqlite3_api->prepare +#define tdsqlite3_prepare16 tdsqlite3_api->prepare16 +#define tdsqlite3_prepare_v2 tdsqlite3_api->prepare_v2 +#define tdsqlite3_prepare16_v2 tdsqlite3_api->prepare16_v2 +#define tdsqlite3_profile tdsqlite3_api->profile +#define tdsqlite3_progress_handler tdsqlite3_api->progress_handler +#define tdsqlite3_realloc tdsqlite3_api->realloc +#define tdsqlite3_reset tdsqlite3_api->reset +#define tdsqlite3_result_blob tdsqlite3_api->result_blob +#define tdsqlite3_result_double tdsqlite3_api->result_double +#define tdsqlite3_result_error tdsqlite3_api->result_error +#define tdsqlite3_result_error16 tdsqlite3_api->result_error16 +#define tdsqlite3_result_int tdsqlite3_api->result_int +#define tdsqlite3_result_int64 tdsqlite3_api->result_int64 +#define tdsqlite3_result_null tdsqlite3_api->result_null +#define tdsqlite3_result_text tdsqlite3_api->result_text +#define tdsqlite3_result_text16 tdsqlite3_api->result_text16 +#define tdsqlite3_result_text16be tdsqlite3_api->result_text16be +#define tdsqlite3_result_text16le tdsqlite3_api->result_text16le +#define tdsqlite3_result_value tdsqlite3_api->result_value +#define tdsqlite3_rollback_hook tdsqlite3_api->rollback_hook +#define tdsqlite3_set_authorizer tdsqlite3_api->set_authorizer +#define tdsqlite3_set_auxdata tdsqlite3_api->set_auxdata +#define tdsqlite3_snprintf tdsqlite3_api->xsnprintf +#define tdsqlite3_step tdsqlite3_api->step +#define tdsqlite3_table_column_metadata tdsqlite3_api->table_column_metadata +#define tdsqlite3_thread_cleanup tdsqlite3_api->thread_cleanup +#define tdsqlite3_total_changes tdsqlite3_api->total_changes +#define tdsqlite3_trace tdsqlite3_api->trace #ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_transfer_bindings sqlite3_api->transfer_bindings +#define tdsqlite3_transfer_bindings tdsqlite3_api->transfer_bindings #endif -#define sqlite3_update_hook sqlite3_api->update_hook -#define sqlite3_user_data sqlite3_api->user_data -#define sqlite3_value_blob sqlite3_api->value_blob -#define sqlite3_value_bytes sqlite3_api->value_bytes -#define sqlite3_value_bytes16 sqlite3_api->value_bytes16 -#define sqlite3_value_double sqlite3_api->value_double -#define sqlite3_value_int sqlite3_api->value_int -#define sqlite3_value_int64 sqlite3_api->value_int64 -#define sqlite3_value_numeric_type sqlite3_api->value_numeric_type -#define sqlite3_value_text sqlite3_api->value_text -#define sqlite3_value_text16 sqlite3_api->value_text16 -#define sqlite3_value_text16be sqlite3_api->value_text16be -#define sqlite3_value_text16le sqlite3_api->value_text16le -#define sqlite3_value_type sqlite3_api->value_type -#define sqlite3_vmprintf sqlite3_api->vmprintf -#define sqlite3_vsnprintf sqlite3_api->xvsnprintf -#define sqlite3_overload_function sqlite3_api->overload_function -#define sqlite3_prepare_v2 sqlite3_api->prepare_v2 -#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2 -#define sqlite3_clear_bindings sqlite3_api->clear_bindings -#define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob -#define sqlite3_blob_bytes sqlite3_api->blob_bytes -#define sqlite3_blob_close sqlite3_api->blob_close -#define sqlite3_blob_open sqlite3_api->blob_open -#define sqlite3_blob_read sqlite3_api->blob_read -#define sqlite3_blob_write sqlite3_api->blob_write -#define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2 -#define sqlite3_file_control sqlite3_api->file_control -#define sqlite3_memory_highwater sqlite3_api->memory_highwater -#define sqlite3_memory_used sqlite3_api->memory_used -#define sqlite3_mutex_alloc sqlite3_api->mutex_alloc -#define sqlite3_mutex_enter sqlite3_api->mutex_enter -#define sqlite3_mutex_free sqlite3_api->mutex_free -#define sqlite3_mutex_leave sqlite3_api->mutex_leave -#define sqlite3_mutex_try sqlite3_api->mutex_try -#define sqlite3_open_v2 sqlite3_api->open_v2 -#define sqlite3_release_memory sqlite3_api->release_memory -#define sqlite3_result_error_nomem sqlite3_api->result_error_nomem -#define sqlite3_result_error_toobig sqlite3_api->result_error_toobig -#define sqlite3_sleep sqlite3_api->sleep -#define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit -#define sqlite3_vfs_find sqlite3_api->vfs_find -#define sqlite3_vfs_register sqlite3_api->vfs_register -#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister -#define sqlite3_threadsafe sqlite3_api->xthreadsafe -#define sqlite3_result_zeroblob sqlite3_api->result_zeroblob -#define sqlite3_result_error_code sqlite3_api->result_error_code -#define sqlite3_test_control sqlite3_api->test_control -#define sqlite3_randomness sqlite3_api->randomness -#define sqlite3_context_db_handle sqlite3_api->context_db_handle -#define sqlite3_extended_result_codes sqlite3_api->extended_result_codes -#define sqlite3_limit sqlite3_api->limit -#define sqlite3_next_stmt sqlite3_api->next_stmt -#define sqlite3_sql sqlite3_api->sql -#define sqlite3_status sqlite3_api->status -#define sqlite3_backup_finish sqlite3_api->backup_finish -#define sqlite3_backup_init sqlite3_api->backup_init -#define sqlite3_backup_pagecount sqlite3_api->backup_pagecount -#define sqlite3_backup_remaining sqlite3_api->backup_remaining -#define sqlite3_backup_step sqlite3_api->backup_step -#define sqlite3_compileoption_get sqlite3_api->compileoption_get -#define sqlite3_compileoption_used sqlite3_api->compileoption_used -#define sqlite3_create_function_v2 sqlite3_api->create_function_v2 -#define sqlite3_db_config sqlite3_api->db_config -#define sqlite3_db_mutex sqlite3_api->db_mutex -#define sqlite3_db_status sqlite3_api->db_status -#define sqlite3_extended_errcode sqlite3_api->extended_errcode -#define sqlite3_log sqlite3_api->log -#define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64 -#define sqlite3_sourceid sqlite3_api->sourceid -#define sqlite3_stmt_status sqlite3_api->stmt_status -#define sqlite3_strnicmp sqlite3_api->strnicmp -#define sqlite3_unlock_notify sqlite3_api->unlock_notify -#define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint -#define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint -#define sqlite3_wal_hook sqlite3_api->wal_hook -#define sqlite3_blob_reopen sqlite3_api->blob_reopen -#define sqlite3_vtab_config sqlite3_api->vtab_config -#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict +#define tdsqlite3_update_hook tdsqlite3_api->update_hook +#define tdsqlite3_user_data tdsqlite3_api->user_data +#define tdsqlite3_value_blob tdsqlite3_api->value_blob +#define tdsqlite3_value_bytes tdsqlite3_api->value_bytes +#define tdsqlite3_value_bytes16 tdsqlite3_api->value_bytes16 +#define tdsqlite3_value_double tdsqlite3_api->value_double +#define tdsqlite3_value_int tdsqlite3_api->value_int +#define tdsqlite3_value_int64 tdsqlite3_api->value_int64 +#define tdsqlite3_value_numeric_type tdsqlite3_api->value_numeric_type +#define tdsqlite3_value_text tdsqlite3_api->value_text +#define tdsqlite3_value_text16 tdsqlite3_api->value_text16 +#define tdsqlite3_value_text16be tdsqlite3_api->value_text16be +#define tdsqlite3_value_text16le tdsqlite3_api->value_text16le +#define tdsqlite3_value_type tdsqlite3_api->value_type +#define tdsqlite3_vmprintf tdsqlite3_api->vmprintf +#define tdsqlite3_vsnprintf tdsqlite3_api->xvsnprintf +#define tdsqlite3_overload_function tdsqlite3_api->overload_function +#define tdsqlite3_prepare_v2 tdsqlite3_api->prepare_v2 +#define tdsqlite3_prepare16_v2 tdsqlite3_api->prepare16_v2 +#define tdsqlite3_clear_bindings tdsqlite3_api->clear_bindings +#define tdsqlite3_bind_zeroblob tdsqlite3_api->bind_zeroblob +#define tdsqlite3_blob_bytes tdsqlite3_api->blob_bytes +#define tdsqlite3_blob_close tdsqlite3_api->blob_close +#define tdsqlite3_blob_open tdsqlite3_api->blob_open +#define tdsqlite3_blob_read tdsqlite3_api->blob_read +#define tdsqlite3_blob_write tdsqlite3_api->blob_write +#define tdsqlite3_create_collation_v2 tdsqlite3_api->create_collation_v2 +#define tdsqlite3_file_control tdsqlite3_api->file_control +#define tdsqlite3_memory_highwater tdsqlite3_api->memory_highwater +#define tdsqlite3_memory_used tdsqlite3_api->memory_used +#define tdsqlite3_mutex_alloc tdsqlite3_api->mutex_alloc +#define tdsqlite3_mutex_enter tdsqlite3_api->mutex_enter +#define tdsqlite3_mutex_free tdsqlite3_api->mutex_free +#define tdsqlite3_mutex_leave tdsqlite3_api->mutex_leave +#define tdsqlite3_mutex_try tdsqlite3_api->mutex_try +#define tdsqlite3_open_v2 tdsqlite3_api->open_v2 +#define tdsqlite3_release_memory tdsqlite3_api->release_memory +#define tdsqlite3_result_error_nomem tdsqlite3_api->result_error_nomem +#define tdsqlite3_result_error_toobig tdsqlite3_api->result_error_toobig +#define tdsqlite3_sleep tdsqlite3_api->sleep +#define tdsqlite3_soft_heap_limit tdsqlite3_api->soft_heap_limit +#define tdsqlite3_vfs_find tdsqlite3_api->vfs_find +#define tdsqlite3_vfs_register tdsqlite3_api->vfs_register +#define tdsqlite3_vfs_unregister tdsqlite3_api->vfs_unregister +#define tdsqlite3_threadsafe tdsqlite3_api->xthreadsafe +#define tdsqlite3_result_zeroblob tdsqlite3_api->result_zeroblob +#define tdsqlite3_result_error_code tdsqlite3_api->result_error_code +#define tdsqlite3_test_control tdsqlite3_api->test_control +#define tdsqlite3_randomness tdsqlite3_api->randomness +#define tdsqlite3_context_db_handle tdsqlite3_api->context_db_handle +#define tdsqlite3_extended_result_codes tdsqlite3_api->extended_result_codes +#define tdsqlite3_limit tdsqlite3_api->limit +#define tdsqlite3_next_stmt tdsqlite3_api->next_stmt +#define tdsqlite3_sql tdsqlite3_api->sql +#define tdsqlite3_status tdsqlite3_api->status +#define tdsqlite3_backup_finish tdsqlite3_api->backup_finish +#define tdsqlite3_backup_init tdsqlite3_api->backup_init +#define tdsqlite3_backup_pagecount tdsqlite3_api->backup_pagecount +#define tdsqlite3_backup_remaining tdsqlite3_api->backup_remaining +#define tdsqlite3_backup_step tdsqlite3_api->backup_step +#define tdsqlite3_compileoption_get tdsqlite3_api->compileoption_get +#define tdsqlite3_compileoption_used tdsqlite3_api->compileoption_used +#define tdsqlite3_create_function_v2 tdsqlite3_api->create_function_v2 +#define tdsqlite3_db_config tdsqlite3_api->db_config +#define tdsqlite3_db_mutex tdsqlite3_api->db_mutex +#define tdsqlite3_db_status tdsqlite3_api->db_status +#define tdsqlite3_extended_errcode tdsqlite3_api->extended_errcode +#define tdsqlite3_log tdsqlite3_api->log +#define tdsqlite3_soft_heap_limit64 tdsqlite3_api->soft_heap_limit64 +#define tdsqlite3_sourceid tdsqlite3_api->sourceid +#define tdsqlite3_stmt_status tdsqlite3_api->stmt_status +#define tdsqlite3_strnicmp tdsqlite3_api->strnicmp +#define tdsqlite3_unlock_notify tdsqlite3_api->unlock_notify +#define tdsqlite3_wal_autocheckpoint tdsqlite3_api->wal_autocheckpoint +#define tdsqlite3_wal_checkpoint tdsqlite3_api->wal_checkpoint +#define tdsqlite3_wal_hook tdsqlite3_api->wal_hook +#define tdsqlite3_blob_reopen tdsqlite3_api->blob_reopen +#define tdsqlite3_vtab_config tdsqlite3_api->vtab_config +#define tdsqlite3_vtab_on_conflict tdsqlite3_api->vtab_on_conflict /* Version 3.7.16 and later */ -#define sqlite3_close_v2 sqlite3_api->close_v2 -#define sqlite3_db_filename sqlite3_api->db_filename -#define sqlite3_db_readonly sqlite3_api->db_readonly -#define sqlite3_db_release_memory sqlite3_api->db_release_memory -#define sqlite3_errstr sqlite3_api->errstr -#define sqlite3_stmt_busy sqlite3_api->stmt_busy -#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly -#define sqlite3_stricmp sqlite3_api->stricmp -#define sqlite3_uri_boolean sqlite3_api->uri_boolean -#define sqlite3_uri_int64 sqlite3_api->uri_int64 -#define sqlite3_uri_parameter sqlite3_api->uri_parameter -#define sqlite3_uri_vsnprintf sqlite3_api->xvsnprintf -#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2 +#define tdsqlite3_close_v2 tdsqlite3_api->close_v2 +#define tdsqlite3_db_filename tdsqlite3_api->db_filename +#define tdsqlite3_db_readonly tdsqlite3_api->db_readonly +#define tdsqlite3_db_release_memory tdsqlite3_api->db_release_memory +#define tdsqlite3_errstr tdsqlite3_api->errstr +#define tdsqlite3_stmt_busy tdsqlite3_api->stmt_busy +#define tdsqlite3_stmt_readonly tdsqlite3_api->stmt_readonly +#define tdsqlite3_stricmp tdsqlite3_api->stricmp +#define tdsqlite3_uri_boolean tdsqlite3_api->uri_boolean +#define tdsqlite3_uri_int64 tdsqlite3_api->uri_int64 +#define tdsqlite3_uri_parameter tdsqlite3_api->uri_parameter +#define tdsqlite3_uri_vsnprintf tdsqlite3_api->xvsnprintf +#define tdsqlite3_wal_checkpoint_v2 tdsqlite3_api->wal_checkpoint_v2 /* Version 3.8.7 and later */ -#define sqlite3_auto_extension sqlite3_api->auto_extension -#define sqlite3_bind_blob64 sqlite3_api->bind_blob64 -#define sqlite3_bind_text64 sqlite3_api->bind_text64 -#define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension -#define sqlite3_load_extension sqlite3_api->load_extension -#define sqlite3_malloc64 sqlite3_api->malloc64 -#define sqlite3_msize sqlite3_api->msize -#define sqlite3_realloc64 sqlite3_api->realloc64 -#define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension -#define sqlite3_result_blob64 sqlite3_api->result_blob64 -#define sqlite3_result_text64 sqlite3_api->result_text64 -#define sqlite3_strglob sqlite3_api->strglob +#define tdsqlite3_auto_extension tdsqlite3_api->auto_extension +#define tdsqlite3_bind_blob64 tdsqlite3_api->bind_blob64 +#define tdsqlite3_bind_text64 tdsqlite3_api->bind_text64 +#define tdsqlite3_cancel_auto_extension tdsqlite3_api->cancel_auto_extension +#define tdsqlite3_load_extension tdsqlite3_api->load_extension +#define tdsqlite3_malloc64 tdsqlite3_api->malloc64 +#define tdsqlite3_msize tdsqlite3_api->msize +#define tdsqlite3_realloc64 tdsqlite3_api->realloc64 +#define tdsqlite3_reset_auto_extension tdsqlite3_api->reset_auto_extension +#define tdsqlite3_result_blob64 tdsqlite3_api->result_blob64 +#define tdsqlite3_result_text64 tdsqlite3_api->result_text64 +#define tdsqlite3_strglob tdsqlite3_api->strglob /* Version 3.8.11 and later */ -#define sqlite3_value_dup sqlite3_api->value_dup -#define sqlite3_value_free sqlite3_api->value_free -#define sqlite3_result_zeroblob64 sqlite3_api->result_zeroblob64 -#define sqlite3_bind_zeroblob64 sqlite3_api->bind_zeroblob64 +#define tdsqlite3_value_dup tdsqlite3_api->value_dup +#define tdsqlite3_value_free tdsqlite3_api->value_free +#define tdsqlite3_result_zeroblob64 tdsqlite3_api->result_zeroblob64 +#define tdsqlite3_bind_zeroblob64 tdsqlite3_api->bind_zeroblob64 /* Version 3.9.0 and later */ -#define sqlite3_value_subtype sqlite3_api->value_subtype -#define sqlite3_result_subtype sqlite3_api->result_subtype +#define tdsqlite3_value_subtype tdsqlite3_api->value_subtype +#define tdsqlite3_result_subtype tdsqlite3_api->result_subtype /* Version 3.10.0 and later */ -#define sqlite3_status64 sqlite3_api->status64 -#define sqlite3_strlike sqlite3_api->strlike -#define sqlite3_db_cacheflush sqlite3_api->db_cacheflush +#define tdsqlite3_status64 tdsqlite3_api->status64 +#define tdsqlite3_strlike tdsqlite3_api->strlike +#define tdsqlite3_db_cacheflush tdsqlite3_api->db_cacheflush /* Version 3.12.0 and later */ -#define sqlite3_system_errno sqlite3_api->system_errno +#define tdsqlite3_system_errno tdsqlite3_api->system_errno /* Version 3.14.0 and later */ -#define sqlite3_trace_v2 sqlite3_api->trace_v2 -#define sqlite3_expanded_sql sqlite3_api->expanded_sql +#define tdsqlite3_trace_v2 tdsqlite3_api->trace_v2 +#define tdsqlite3_expanded_sql tdsqlite3_api->expanded_sql /* Version 3.18.0 and later */ -#define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid +#define tdsqlite3_set_last_insert_rowid tdsqlite3_api->set_last_insert_rowid /* Version 3.20.0 and later */ -#define sqlite3_prepare_v3 sqlite3_api->prepare_v3 -#define sqlite3_prepare16_v3 sqlite3_api->prepare16_v3 -#define sqlite3_bind_pointer sqlite3_api->bind_pointer -#define sqlite3_result_pointer sqlite3_api->result_pointer -#define sqlite3_value_pointer sqlite3_api->value_pointer +#define tdsqlite3_prepare_v3 tdsqlite3_api->prepare_v3 +#define tdsqlite3_prepare16_v3 tdsqlite3_api->prepare16_v3 +#define tdsqlite3_bind_pointer tdsqlite3_api->bind_pointer +#define tdsqlite3_result_pointer tdsqlite3_api->result_pointer +#define tdsqlite3_value_pointer tdsqlite3_api->value_pointer /* Version 3.22.0 and later */ -#define sqlite3_vtab_nochange sqlite3_api->vtab_nochange -#define sqlite3_value_nochange sqlite3_api->value_nochange -#define sqlite3_vtab_collation sqlite3_api->vtab_collation +#define tdsqlite3_vtab_nochange tdsqlite3_api->vtab_nochange +#define tdsqlite3_value_nochange tdsqlite3_api->value_nochange +#define tdsqlite3_vtab_collation tdsqlite3_api->vtab_collation /* Version 3.24.0 and later */ -#define sqlite3_keyword_count sqlite3_api->keyword_count -#define sqlite3_keyword_name sqlite3_api->keyword_name -#define sqlite3_keyword_check sqlite3_api->keyword_check -#define sqlite3_str_new sqlite3_api->str_new -#define sqlite3_str_finish sqlite3_api->str_finish -#define sqlite3_str_appendf sqlite3_api->str_appendf -#define sqlite3_str_vappendf sqlite3_api->str_vappendf -#define sqlite3_str_append sqlite3_api->str_append -#define sqlite3_str_appendall sqlite3_api->str_appendall -#define sqlite3_str_appendchar sqlite3_api->str_appendchar -#define sqlite3_str_reset sqlite3_api->str_reset -#define sqlite3_str_errcode sqlite3_api->str_errcode -#define sqlite3_str_length sqlite3_api->str_length -#define sqlite3_str_value sqlite3_api->str_value +#define tdsqlite3_keyword_count tdsqlite3_api->keyword_count +#define tdsqlite3_keyword_name tdsqlite3_api->keyword_name +#define tdsqlite3_keyword_check tdsqlite3_api->keyword_check +#define tdsqlite3_str_new tdsqlite3_api->str_new +#define tdsqlite3_str_finish tdsqlite3_api->str_finish +#define tdsqlite3_str_appendf tdsqlite3_api->str_appendf +#define tdsqlite3_str_vappendf tdsqlite3_api->str_vappendf +#define tdsqlite3_str_append tdsqlite3_api->str_append +#define tdsqlite3_str_appendall tdsqlite3_api->str_appendall +#define tdsqlite3_str_appendchar tdsqlite3_api->str_appendchar +#define tdsqlite3_str_reset tdsqlite3_api->str_reset +#define tdsqlite3_str_errcode tdsqlite3_api->str_errcode +#define tdsqlite3_str_length tdsqlite3_api->str_length +#define tdsqlite3_str_value tdsqlite3_api->str_value /* Version 3.25.0 and later */ -#define sqlite3_create_window_function sqlite3_api->create_window_function +#define tdsqlite3_create_window_function tdsqlite3_api->create_window_function /* Version 3.26.0 and later */ -#define sqlite3_normalized_sql sqlite3_api->normalized_sql +#define tdsqlite3_normalized_sql tdsqlite3_api->normalized_sql /* Version 3.28.0 and later */ -#define sqlite3_stmt_isexplain sqlite3_api->isexplain -#define sqlite3_value_frombind sqlite3_api->frombind +#define tdsqlite3_stmt_isexplain tdsqlite3_api->isexplain +#define tdsqlite3_value_frombind tdsqlite3_api->frombind /* Version 3.30.0 and later */ -#define sqlite3_drop_modules sqlite3_api->drop_modules +#define tdsqlite3_drop_modules tdsqlite3_api->drop_modules /* Version 3.31.0 andn later */ -#define sqlite3_hard_heap_limit64 sqlite3_api->hard_heap_limit64 -#define sqlite3_uri_key sqlite3_api->uri_key -#define sqlite3_filename_database sqlite3_api->filename_database -#define sqlite3_filename_journal sqlite3_api->filename_journal -#define sqlite3_filename_wal sqlite3_api->filename_wal +#define tdsqlite3_hard_heap_limit64 tdsqlite3_api->hard_heap_limit64 +#define tdsqlite3_uri_key tdsqlite3_api->uri_key +#define tdsqlite3_filename_database tdsqlite3_api->filename_database +#define tdsqlite3_filename_journal tdsqlite3_api->filename_journal +#define tdsqlite3_filename_wal tdsqlite3_api->filename_wal #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) /* This case when the file really is being compiled as a loadable ** extension */ -# define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0; -# define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v; +# define SQLITE_EXTENSION_INIT1 const tdsqlite3_api_routines *tdsqlite3_api=0; +# define SQLITE_EXTENSION_INIT2(v) tdsqlite3_api=v; # define SQLITE_EXTENSION_INIT3 \ - extern const sqlite3_api_routines *sqlite3_api; + extern const tdsqlite3_api_routines *tdsqlite3_api; #else /* This case when the file is being statically linked into the ** application */ diff --git a/sqlite/sqlite/sqlite3session.h b/sqlite/sqlite/sqlite3session.h index aac6342d7..5ad10cd56 100644 --- a/sqlite/sqlite/sqlite3session.h +++ b/sqlite/sqlite/sqlite3session.h @@ -16,7 +16,7 @@ extern "C" { ** An instance of this object is a [session] that can be used to ** record changes to a database. */ -typedef struct sqlite3_session sqlite3_session; +typedef struct tdsqlite3_session tdsqlite3_session; /* ** CAPI3REF: Changeset Iterator Handle @@ -24,11 +24,11 @@ typedef struct sqlite3_session sqlite3_session; ** An instance of this object acts as a cursor for iterating ** over the elements of a [changeset] or [patchset]. */ -typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; +typedef struct tdsqlite3_changeset_iter tdsqlite3_changeset_iter; /* ** CAPI3REF: Create A New Session Object -** CONSTRUCTOR: sqlite3_session +** CONSTRUCTOR: tdsqlite3_session ** ** Create a new session object attached to database handle db. If successful, ** a pointer to the new object is written to *ppSession and SQLITE_OK is @@ -39,13 +39,13 @@ typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; ** database handle. ** ** Session objects created using this function should be deleted using the -** [sqlite3session_delete()] function before the database handle that they +** [tdsqlite3session_delete()] function before the database handle that they ** are attached to is itself closed. If the database handle is closed before ** the session object is deleted, then the results of calling any session -** module function, including [sqlite3session_delete()] on the session object +** module function, including [tdsqlite3session_delete()] on the session object ** are undefined. ** -** Because the session module uses the [sqlite3_preupdate_hook()] API, it +** Because the session module uses the [tdsqlite3_preupdate_hook()] API, it ** is not possible for an application to register a pre-update hook on a ** database handle that has one or more session objects attached. Nor is ** it possible to create a session object attached to a database handle for @@ -57,36 +57,36 @@ typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; ** attached database. It is not an error if database zDb is not attached ** to the database when the session object is created. */ -int sqlite3session_create( - sqlite3 *db, /* Database handle */ +int tdsqlite3session_create( + tdsqlite3 *db, /* Database handle */ const char *zDb, /* Name of db (e.g. "main") */ - sqlite3_session **ppSession /* OUT: New session object */ + tdsqlite3_session **ppSession /* OUT: New session object */ ); /* ** CAPI3REF: Delete A Session Object -** DESTRUCTOR: sqlite3_session +** DESTRUCTOR: tdsqlite3_session ** ** Delete a session object previously allocated using -** [sqlite3session_create()]. Once a session object has been deleted, the +** [tdsqlite3session_create()]. Once a session object has been deleted, the ** results of attempting to use pSession with any other session module ** function are undefined. ** ** Session objects must be deleted before the database handle to which they ** are attached is closed. Refer to the documentation for -** [sqlite3session_create()] for details. +** [tdsqlite3session_create()] for details. */ -void sqlite3session_delete(sqlite3_session *pSession); +void tdsqlite3session_delete(tdsqlite3_session *pSession); /* ** CAPI3REF: Enable Or Disable A Session Object -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** Enable or disable the recording of changes by a session object. When ** enabled, a session object records changes made to the database. When ** disabled - it does not. A newly created session object is enabled. -** Refer to the documentation for [sqlite3session_changeset()] for further +** Refer to the documentation for [tdsqlite3session_changeset()] for further ** details regarding how enabling and disabling a session object affects ** the eventual changesets. ** @@ -97,11 +97,11 @@ void sqlite3session_delete(sqlite3_session *pSession); ** The return value indicates the final state of the session object: 0 if ** the session is disabled, or 1 if it is enabled. */ -int sqlite3session_enable(sqlite3_session *pSession, int bEnable); +int tdsqlite3session_enable(tdsqlite3_session *pSession, int bEnable); /* ** CAPI3REF: Set Or Clear the Indirect Change Flag -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** Each change recorded by a session object is marked as either direct or ** indirect. A change is marked as indirect if either: @@ -127,16 +127,16 @@ int sqlite3session_enable(sqlite3_session *pSession, int bEnable); ** The return value indicates the final state of the indirect flag: 0 if ** it is clear, or 1 if it is set. */ -int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect); +int tdsqlite3session_indirect(tdsqlite3_session *pSession, int bIndirect); /* ** CAPI3REF: Attach A Table To A Session Object -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** If argument zTab is not NULL, then it is the name of a table to attach ** to the session object passed as the first argument. All subsequent changes ** made to the table while the session object is enabled will be recorded. See -** documentation for [sqlite3session_changeset()] for further details. +** documentation for [tdsqlite3session_changeset()] for further details. ** ** Or, if argument zTab is NULL, then changes are recorded for all tables ** in the database. If additional tables are added to the database (by @@ -171,30 +171,30 @@ int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect); ** are recorded for rows for which (idx IS NULL) is true. However, for such ** rows a zero-length blob (SQL value X'') is stored in the changeset or ** patchset instead of a NULL value. This allows such changesets to be -** manipulated by legacy implementations of sqlite3changeset_invert(), +** manipulated by legacy implementations of tdsqlite3changeset_invert(), ** concat() and similar. ** -** The sqlite3changeset_apply() function automatically converts the +** The tdsqlite3changeset_apply() function automatically converts the ** zero-length blob back to a NULL value when updating the sqlite_stat1 -** table. However, if the application calls sqlite3changeset_new(), -** sqlite3changeset_old() or sqlite3changeset_conflict on a changeset +** table. However, if the application calls tdsqlite3changeset_new(), +** tdsqlite3changeset_old() or tdsqlite3changeset_conflict on a changeset ** iterator directly (including on a changeset iterator passed to a ** conflict-handler callback) then the X'' value is returned. The application ** must translate X'' to NULL itself if required. ** ** Legacy (older than 3.22.0) versions of the sessions module cannot capture ** changes made to the sqlite_stat1 table. Legacy versions of the -** sqlite3changeset_apply() function silently ignore any modifications to the +** tdsqlite3changeset_apply() function silently ignore any modifications to the ** sqlite_stat1 table that are part of a changeset or patchset. */ -int sqlite3session_attach( - sqlite3_session *pSession, /* Session object */ +int tdsqlite3session_attach( + tdsqlite3_session *pSession, /* Session object */ const char *zTab /* Table name */ ); /* ** CAPI3REF: Set a table filter on a Session Object. -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** The second argument (xFilter) is the "filter callback". For changes to rows ** in tables that are not attached to the Session object, the filter is called @@ -202,8 +202,8 @@ int sqlite3session_attach( ** If xFilter returns 0, changes are not tracked. Note that once a table is ** attached, xFilter will not be called again. */ -void sqlite3session_table_filter( - sqlite3_session *pSession, /* Session object */ +void tdsqlite3session_table_filter( + tdsqlite3_session *pSession, /* Session object */ int(*xFilter)( void *pCtx, /* Copy of third arg to _filter_table() */ const char *zTab /* Table name */ @@ -213,7 +213,7 @@ void sqlite3session_table_filter( /* ** CAPI3REF: Generate A Changeset From A Session Object -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** Obtain a changeset containing changes to the tables attached to the ** session object passed as the first argument. If successful, @@ -243,8 +243,8 @@ void sqlite3session_table_filter( ** DELETE change only. ** ** The contents of a changeset may be traversed using an iterator created -** using the [sqlite3changeset_start()] API. A changeset may be applied to -** a database with a compatible schema using the [sqlite3changeset_apply()] +** using the [tdsqlite3changeset_start()] API. A changeset may be applied to +** a database with a compatible schema using the [tdsqlite3changeset_apply()] ** API. ** ** Within a changeset generated by this function, all changes related to a @@ -252,12 +252,12 @@ void sqlite3session_table_filter( ** a changeset or when applying a changeset to a database, all changes related ** to a single table are processed before moving on to the next table. Tables ** are sorted in the same order in which they were attached (or auto-attached) -** to the sqlite3_session object. The order in which the changes related to +** to the tdsqlite3_session object. The order in which the changes related to ** a single table are stored is undefined. ** ** Following a successful call to this function, it is the responsibility of ** the caller to eventually free the buffer that *ppChangeset points to using -** [sqlite3_free()]. +** [tdsqlite3_free()]. ** **

Changeset Generation

** @@ -305,7 +305,7 @@ void sqlite3session_table_filter( ** active, the resulting changeset will contain an UPDATE change instead of ** a DELETE and an INSERT. ** -** When a session object is disabled (see the [sqlite3session_enable()] API), +** When a session object is disabled (see the [tdsqlite3session_enable()] API), ** it does not accumulate records when rows are inserted, updated or deleted. ** This may appear to have some counter-intuitive effects if a single row ** is written to more than once during a session. For example, if a row @@ -316,19 +316,19 @@ void sqlite3session_table_filter( ** another field of the same row is updated while the session is enabled, the ** resulting changeset will contain an UPDATE change that updates both fields. */ -int sqlite3session_changeset( - sqlite3_session *pSession, /* Session object */ +int tdsqlite3session_changeset( + tdsqlite3_session *pSession, /* Session object */ int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */ void **ppChangeset /* OUT: Buffer containing changeset */ ); /* ** CAPI3REF: Load The Difference Between Tables Into A Session -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** If it is not already attached to the session object passed as the first ** argument, this function attaches table zTbl in the same manner as the -** [sqlite3session_attach()] function. If zTbl does not exist, or if it +** [tdsqlite3session_attach()] function. If zTbl does not exist, or if it ** does not have a primary key, this function is a no-op (but does not return ** an error). ** @@ -366,7 +366,7 @@ int sqlite3session_changeset( ** ** ** To clarify, if this function is called and then a changeset constructed -** using [sqlite3session_changeset()], then after applying that changeset to +** using [tdsqlite3session_changeset()], then after applying that changeset to ** database zFrom the contents of the two compatible tables would be ** identical. ** @@ -377,10 +377,10 @@ int sqlite3session_changeset( ** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg ** may be set to point to a buffer containing an English language error ** message. It is the responsibility of the caller to free this buffer using -** sqlite3_free(). +** tdsqlite3_free(). */ -int sqlite3session_diff( - sqlite3_session *pSession, +int tdsqlite3session_diff( + tdsqlite3_session *pSession, const char *zFromDb, const char *zTbl, char **pzErrMsg @@ -389,7 +389,7 @@ int sqlite3session_diff( /* ** CAPI3REF: Generate A Patchset From A Session Object -** METHOD: sqlite3_session +** METHOD: tdsqlite3_session ** ** The differences between a patchset and a changeset are that: ** @@ -401,23 +401,23 @@ int sqlite3session_diff( ** ** ** A patchset blob may be used with up to date versions of all -** sqlite3changeset_xxx API functions except for sqlite3changeset_invert(), +** tdsqlite3changeset_xxx API functions except for tdsqlite3changeset_invert(), ** which returns SQLITE_CORRUPT if it is passed a patchset. Similarly, ** attempting to use a patchset blob with old versions of the -** sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error. +** tdsqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error. ** ** Because the non-primary key "old.*" fields are omitted, no ** SQLITE_CHANGESET_DATA conflicts can be detected or reported if a patchset -** is passed to the sqlite3changeset_apply() API. Other conflict types work +** is passed to the tdsqlite3changeset_apply() API. Other conflict types work ** in the same way as for changesets. ** ** Changes within a patchset are ordered in the same way as for changesets -** generated by the sqlite3session_changeset() function (i.e. all changes for +** generated by the tdsqlite3session_changeset() function (i.e. all changes for ** a single table are grouped together, tables appear in the order in which ** they were attached to the session object). */ -int sqlite3session_patchset( - sqlite3_session *pSession, /* Session object */ +int tdsqlite3session_patchset( + tdsqlite3_session *pSession, /* Session object */ int *pnPatchset, /* OUT: Size of buffer at *ppPatchset */ void **ppPatchset /* OUT: Buffer containing patchset */ ); @@ -430,18 +430,18 @@ int sqlite3session_patchset( ** more changes have been recorded, return zero. ** ** Even if this function returns zero, it is possible that calling -** [sqlite3session_changeset()] on the session handle may still return a +** [tdsqlite3session_changeset()] on the session handle may still return a ** changeset that contains no changes. This can happen when a row in ** an attached table is modified and then later on the original values ** are restored. However, if this function returns non-zero, then it is -** guaranteed that a call to sqlite3session_changeset() will return a +** guaranteed that a call to tdsqlite3session_changeset() will return a ** changeset containing zero changes. */ -int sqlite3session_isempty(sqlite3_session *pSession); +int tdsqlite3session_isempty(tdsqlite3_session *pSession); /* ** CAPI3REF: Create An Iterator To Traverse A Changeset -** CONSTRUCTOR: sqlite3_changeset_iter +** CONSTRUCTOR: tdsqlite3_changeset_iter ** ** Create an iterator used to iterate through the contents of a changeset. ** If successful, *pp is set to point to the iterator handle and SQLITE_OK @@ -452,20 +452,20 @@ int sqlite3session_isempty(sqlite3_session *pSession); ** iterator created by this function: ** **
    -**
  • [sqlite3changeset_next()] -**
  • [sqlite3changeset_op()] -**
  • [sqlite3changeset_new()] -**
  • [sqlite3changeset_old()] +**
  • [tdsqlite3changeset_next()] +**
  • [tdsqlite3changeset_op()] +**
  • [tdsqlite3changeset_new()] +**
  • [tdsqlite3changeset_old()] **
** ** It is the responsibility of the caller to eventually destroy the iterator -** by passing it to [sqlite3changeset_finalize()]. The buffer containing the +** by passing it to [tdsqlite3changeset_finalize()]. The buffer containing the ** changeset (pChangeset) must remain valid until after the iterator is ** destroyed. ** ** Assuming the changeset blob was created by one of the -** [sqlite3session_changeset()], [sqlite3changeset_concat()] or -** [sqlite3changeset_invert()] functions, all changes within the changeset +** [tdsqlite3session_changeset()], [tdsqlite3changeset_concat()] or +** [tdsqlite3changeset_invert()] functions, all changes within the changeset ** that apply to a single table are grouped together. This means that when ** an application iterates through a changeset using an iterator created by ** this function, all changes that relate to a single table are visited @@ -473,34 +473,34 @@ int sqlite3session_isempty(sqlite3_session *pSession); ** the applies to table X, then one for table Y, and then later on visit ** another change for table X. ** -** The behavior of sqlite3changeset_start_v2() and its streaming equivalent +** The behavior of tdsqlite3changeset_start_v2() and its streaming equivalent ** may be modified by passing a combination of ** [SQLITE_CHANGESETSTART_INVERT | supported flags] as the 4th parameter. ** -** Note that the sqlite3changeset_start_v2() API is still experimental +** Note that the tdsqlite3changeset_start_v2() API is still experimental ** and therefore subject to change. */ -int sqlite3changeset_start( - sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ +int tdsqlite3changeset_start( + tdsqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ int nChangeset, /* Size of changeset blob in bytes */ void *pChangeset /* Pointer to blob containing changeset */ ); -int sqlite3changeset_start_v2( - sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ +int tdsqlite3changeset_start_v2( + tdsqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ int nChangeset, /* Size of changeset blob in bytes */ void *pChangeset, /* Pointer to blob containing changeset */ int flags /* SESSION_CHANGESETSTART_* flags */ ); /* -** CAPI3REF: Flags for sqlite3changeset_start_v2 +** CAPI3REF: Flags for tdsqlite3changeset_start_v2 ** ** The following flags may passed via the 4th parameter to -** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]: +** [tdsqlite3changeset_start_v2] and [tdsqlite3changeset_start_v2_strm]: ** **
SQLITE_CHANGESETAPPLY_INVERT
** Invert the changeset while iterating through it. This is equivalent to -** inverting a changeset using sqlite3changeset_invert() before applying it. +** inverting a changeset using tdsqlite3changeset_invert() before applying it. ** It is an error to specify this flag with a patchset. */ #define SQLITE_CHANGESETSTART_INVERT 0x0002 @@ -508,20 +508,20 @@ int sqlite3changeset_start_v2( /* ** CAPI3REF: Advance A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** This function may only be used with iterators created by the function -** [sqlite3changeset_start()]. If it is called on an iterator passed to -** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE +** [tdsqlite3changeset_start()]. If it is called on an iterator passed to +** a conflict-handler callback by [tdsqlite3changeset_apply()], SQLITE_MISUSE ** is returned and the call has no effect. ** -** Immediately after an iterator is created by sqlite3changeset_start(), it +** Immediately after an iterator is created by tdsqlite3changeset_start(), it ** does not point to any change in the changeset. Assuming the changeset ** is not empty, the first call to this function advances the iterator to ** point to the first change in the changeset. Each subsequent call advances ** the iterator to point to the next change in the changeset (if any). If ** no error occurs and the iterator points to a valid change after a call -** to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned. +** to tdsqlite3changeset_next() has advanced it, SQLITE_ROW is returned. ** Otherwise, if all changes in the changeset have already been visited, ** SQLITE_DONE is returned. ** @@ -529,27 +529,27 @@ int sqlite3changeset_start_v2( ** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or ** SQLITE_NOMEM. */ -int sqlite3changeset_next(sqlite3_changeset_iter *pIter); +int tdsqlite3changeset_next(tdsqlite3_changeset_iter *pIter); /* ** CAPI3REF: Obtain The Current Operation From A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** The pIter argument passed to this function may either be an iterator -** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator -** created by [sqlite3changeset_start()]. In the latter case, the most recent -** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this +** passed to a conflict-handler by [tdsqlite3changeset_apply()], or an iterator +** created by [tdsqlite3changeset_start()]. In the latter case, the most recent +** call to [tdsqlite3changeset_next()] must have returned [SQLITE_ROW]. If this ** is not the case, this function returns [SQLITE_MISUSE]. ** ** If argument pzTab is not NULL, then *pzTab is set to point to a ** nul-terminated utf-8 encoded string containing the name of the table ** affected by the current change. The buffer remains valid until either -** sqlite3changeset_next() is called on the iterator or until the +** tdsqlite3changeset_next() is called on the iterator or until the ** conflict-handler function returns. If pnCol is not NULL, then *pnCol is ** set to the number of columns in the table affected by the change. If ** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change ** is an indirect change, or false (0) otherwise. See the documentation for -** [sqlite3session_indirect()] for a description of direct and indirect +** [tdsqlite3session_indirect()] for a description of direct and indirect ** changes. Finally, if pOp is not NULL, then *pOp is set to one of ** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the ** type of change that the iterator currently points to. @@ -558,8 +558,8 @@ int sqlite3changeset_next(sqlite3_changeset_iter *pIter); ** SQLite error code is returned. The values of the output variables may not ** be trusted in this case. */ -int sqlite3changeset_op( - sqlite3_changeset_iter *pIter, /* Iterator object */ +int tdsqlite3changeset_op( + tdsqlite3_changeset_iter *pIter, /* Iterator object */ const char **pzTab, /* OUT: Pointer to table name */ int *pnCol, /* OUT: Number of columns in table */ int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */ @@ -568,7 +568,7 @@ int sqlite3changeset_op( /* ** CAPI3REF: Obtain The Primary Key Definition Of A Table -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** For each modified table, a changeset includes the following: ** @@ -592,20 +592,20 @@ int sqlite3changeset_op( ** SQLITE_OK is returned and the output variables populated as described ** above. */ -int sqlite3changeset_pk( - sqlite3_changeset_iter *pIter, /* Iterator object */ +int tdsqlite3changeset_pk( + tdsqlite3_changeset_iter *pIter, /* Iterator object */ unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */ int *pnCol /* OUT: Number of entries in output array */ ); /* ** CAPI3REF: Obtain old.* Values From A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** The pIter argument passed to this function may either be an iterator -** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator -** created by [sqlite3changeset_start()]. In the latter case, the most recent -** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. +** passed to a conflict-handler by [tdsqlite3changeset_apply()], or an iterator +** created by [tdsqlite3changeset_start()]. In the latter case, the most recent +** call to [tdsqlite3changeset_next()] must have returned SQLITE_ROW. ** Furthermore, it may only be called if the type of change that the iterator ** currently points to is either [SQLITE_DELETE] or [SQLITE_UPDATE]. Otherwise, ** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL. @@ -615,7 +615,7 @@ int sqlite3changeset_pk( ** [SQLITE_RANGE] is returned and *ppValue is set to NULL. ** ** If successful, this function sets *ppValue to point to a protected -** sqlite3_value object containing the iVal'th value from the vector of +** tdsqlite3_value object containing the iVal'th value from the vector of ** original row values stored as part of the UPDATE or DELETE change and ** returns SQLITE_OK. The name of the function comes from the fact that this ** is similar to the "old.*" columns available to update or delete triggers. @@ -623,20 +623,20 @@ int sqlite3changeset_pk( ** If some other error occurs (e.g. an OOM condition), an SQLite error code ** is returned and *ppValue is set to NULL. */ -int sqlite3changeset_old( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +int tdsqlite3changeset_old( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Column number */ - sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ + tdsqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ ); /* ** CAPI3REF: Obtain new.* Values From A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** The pIter argument passed to this function may either be an iterator -** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator -** created by [sqlite3changeset_start()]. In the latter case, the most recent -** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. +** passed to a conflict-handler by [tdsqlite3changeset_apply()], or an iterator +** created by [tdsqlite3changeset_start()]. In the latter case, the most recent +** call to [tdsqlite3changeset_next()] must have returned SQLITE_ROW. ** Furthermore, it may only be called if the type of change that the iterator ** currently points to is either [SQLITE_UPDATE] or [SQLITE_INSERT]. Otherwise, ** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL. @@ -646,7 +646,7 @@ int sqlite3changeset_old( ** [SQLITE_RANGE] is returned and *ppValue is set to NULL. ** ** If successful, this function sets *ppValue to point to a protected -** sqlite3_value object containing the iVal'th value from the vector of +** tdsqlite3_value object containing the iVal'th value from the vector of ** new row values stored as part of the UPDATE or INSERT change and ** returns SQLITE_OK. If the change is an UPDATE and does not include ** a new value for the requested column, *ppValue is set to NULL and @@ -657,18 +657,18 @@ int sqlite3changeset_old( ** If some other error occurs (e.g. an OOM condition), an SQLite error code ** is returned and *ppValue is set to NULL. */ -int sqlite3changeset_new( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +int tdsqlite3changeset_new( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Column number */ - sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ + tdsqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ ); /* ** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** This function should only be used with iterator objects passed to a -** conflict-handler callback by [sqlite3changeset_apply()] with either +** conflict-handler callback by [tdsqlite3changeset_apply()] with either ** [SQLITE_CHANGESET_DATA] or [SQLITE_CHANGESET_CONFLICT]. If this function ** is called on any other iterator, [SQLITE_MISUSE] is returned and *ppValue ** is set to NULL. @@ -678,22 +678,22 @@ int sqlite3changeset_new( ** [SQLITE_RANGE] is returned and *ppValue is set to NULL. ** ** If successful, this function sets *ppValue to point to a protected -** sqlite3_value object containing the iVal'th value from the +** tdsqlite3_value object containing the iVal'th value from the ** "conflicting row" associated with the current conflict-handler callback ** and returns SQLITE_OK. ** ** If some other error occurs (e.g. an OOM condition), an SQLite error code ** is returned and *ppValue is set to NULL. */ -int sqlite3changeset_conflict( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +int tdsqlite3changeset_conflict( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int iVal, /* Column number */ - sqlite3_value **ppValue /* OUT: Value from conflicting row */ + tdsqlite3_value **ppValue /* OUT: Value from conflicting row */ ); /* ** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** This function may only be called with an iterator passed to an ** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case @@ -702,43 +702,43 @@ int sqlite3changeset_conflict( ** ** In all other cases this function returns SQLITE_MISUSE. */ -int sqlite3changeset_fk_conflicts( - sqlite3_changeset_iter *pIter, /* Changeset iterator */ +int tdsqlite3changeset_fk_conflicts( + tdsqlite3_changeset_iter *pIter, /* Changeset iterator */ int *pnOut /* OUT: Number of FK violations */ ); /* ** CAPI3REF: Finalize A Changeset Iterator -** METHOD: sqlite3_changeset_iter +** METHOD: tdsqlite3_changeset_iter ** ** This function is used to finalize an iterator allocated with -** [sqlite3changeset_start()]. +** [tdsqlite3changeset_start()]. ** ** This function should only be called on iterators created using the -** [sqlite3changeset_start()] function. If an application calls this +** [tdsqlite3changeset_start()] function. If an application calls this ** function with an iterator passed to a conflict-handler by -** [sqlite3changeset_apply()], [SQLITE_MISUSE] is immediately returned and the +** [tdsqlite3changeset_apply()], [SQLITE_MISUSE] is immediately returned and the ** call has no effect. ** -** If an error was encountered within a call to an sqlite3changeset_xxx() -** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an -** [SQLITE_NOMEM] in [sqlite3changeset_new()]) then an error code corresponding +** If an error was encountered within a call to an tdsqlite3changeset_xxx() +** function (for example an [SQLITE_CORRUPT] in [tdsqlite3changeset_next()] or an +** [SQLITE_NOMEM] in [tdsqlite3changeset_new()]) then an error code corresponding ** to that error is returned by this function. Otherwise, SQLITE_OK is ** returned. This is to allow the following pattern (pseudo-code): ** **
-**   sqlite3changeset_start();
-**   while( SQLITE_ROW==sqlite3changeset_next() ){
+**   tdsqlite3changeset_start();
+**   while( SQLITE_ROW==tdsqlite3changeset_next() ){
 **     // Do something with change.
 **   }
-**   rc = sqlite3changeset_finalize();
+**   rc = tdsqlite3changeset_finalize();
 **   if( rc!=SQLITE_OK ){
 **     // An error has occurred 
 **   }
 ** 
*/ -int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); +int tdsqlite3changeset_finalize(tdsqlite3_changeset_iter *pIter); /* ** CAPI3REF: Invert A Changeset @@ -761,14 +761,14 @@ int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); ** SQLITE_OK is returned. If an error occurs, both *pnOut and *ppOut are ** zeroed and an SQLite error code returned. ** -** It is the responsibility of the caller to eventually call sqlite3_free() +** It is the responsibility of the caller to eventually call tdsqlite3_free() ** on the *ppOut pointer to free the buffer allocation following a successful ** call to this function. ** ** WARNING/TODO: This function currently assumes that the input is a valid ** changeset. If it is not, the results are undefined. */ -int sqlite3changeset_invert( +int tdsqlite3changeset_invert( int nIn, const void *pIn, /* Input changeset */ int *pnOut, void **ppOut /* OUT: Inverse of input */ ); @@ -781,25 +781,25 @@ int sqlite3changeset_invert( ** changeset A followed by changeset B. ** ** This function combines the two input changesets using an -** sqlite3_changegroup object. Calling it produces similar results as the +** tdsqlite3_changegroup object. Calling it produces similar results as the ** following code fragment: ** **
-**   sqlite3_changegroup *pGrp;
-**   rc = sqlite3_changegroup_new(&pGrp);
-**   if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA);
-**   if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB);
+**   tdsqlite3_changegroup *pGrp;
+**   rc = tdsqlite3_changegroup_new(&pGrp);
+**   if( rc==SQLITE_OK ) rc = tdsqlite3changegroup_add(pGrp, nA, pA);
+**   if( rc==SQLITE_OK ) rc = tdsqlite3changegroup_add(pGrp, nB, pB);
 **   if( rc==SQLITE_OK ){
-**     rc = sqlite3changegroup_output(pGrp, pnOut, ppOut);
+**     rc = tdsqlite3changegroup_output(pGrp, pnOut, ppOut);
 **   }else{
 **     *ppOut = 0;
 **     *pnOut = 0;
 **   }
 ** 
** -** Refer to the sqlite3_changegroup documentation below for details. +** Refer to the tdsqlite3_changegroup documentation below for details. */ -int sqlite3changeset_concat( +int tdsqlite3changeset_concat( int nA, /* Number of bytes in buffer pA */ void *pA, /* Pointer to buffer containing changeset A */ int nB, /* Number of bytes in buffer pB */ @@ -815,49 +815,49 @@ int sqlite3changeset_concat( ** A changegroup is an object used to combine two or more ** [changesets] or [patchsets] */ -typedef struct sqlite3_changegroup sqlite3_changegroup; +typedef struct tdsqlite3_changegroup tdsqlite3_changegroup; /* ** CAPI3REF: Create A New Changegroup Object -** CONSTRUCTOR: sqlite3_changegroup +** CONSTRUCTOR: tdsqlite3_changegroup ** -** An sqlite3_changegroup object is used to combine two or more changesets +** An tdsqlite3_changegroup object is used to combine two or more changesets ** (or patchsets) into a single changeset (or patchset). A single changegroup ** object may combine changesets or patchsets, but not both. The output is ** always in the same format as the input. ** ** If successful, this function returns SQLITE_OK and populates (*pp) with -** a pointer to a new sqlite3_changegroup object before returning. The caller +** a pointer to a new tdsqlite3_changegroup object before returning. The caller ** should eventually free the returned object using a call to -** sqlite3changegroup_delete(). If an error occurs, an SQLite error code +** tdsqlite3changegroup_delete(). If an error occurs, an SQLite error code ** (i.e. SQLITE_NOMEM) is returned and *pp is set to NULL. ** -** The usual usage pattern for an sqlite3_changegroup object is as follows: +** The usual usage pattern for an tdsqlite3_changegroup object is as follows: ** **
    -**
  • It is created using a call to sqlite3changegroup_new(). +**
  • It is created using a call to tdsqlite3changegroup_new(). ** **
  • Zero or more changesets (or patchsets) are added to the object -** by calling sqlite3changegroup_add(). +** by calling tdsqlite3changegroup_add(). ** **
  • The result of combining all input changesets together is obtained -** by the application via a call to sqlite3changegroup_output(). +** by the application via a call to tdsqlite3changegroup_output(). ** -**
  • The object is deleted using a call to sqlite3changegroup_delete(). +**
  • The object is deleted using a call to tdsqlite3changegroup_delete(). **
** ** Any number of calls to add() and output() may be made between the calls to ** new() and delete(), and in any order. ** -** As well as the regular sqlite3changegroup_add() and -** sqlite3changegroup_output() functions, also available are the streaming -** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm(). +** As well as the regular tdsqlite3changegroup_add() and +** tdsqlite3changegroup_output() functions, also available are the streaming +** versions tdsqlite3changegroup_add_strm() and tdsqlite3changegroup_output_strm(). */ -int sqlite3changegroup_new(sqlite3_changegroup **pp); +int tdsqlite3changegroup_new(tdsqlite3_changegroup **pp); /* ** CAPI3REF: Add A Changeset To A Changegroup -** METHOD: sqlite3_changegroup +** METHOD: tdsqlite3_changegroup ** ** Add all changes within the changeset (or patchset) in buffer pData (size ** nData bytes) to the changegroup. @@ -931,19 +931,19 @@ int sqlite3changegroup_new(sqlite3_changegroup **pp); ** ** If no error occurs, SQLITE_OK is returned. */ -int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); +int tdsqlite3changegroup_add(tdsqlite3_changegroup*, int nData, void *pData); /* ** CAPI3REF: Obtain A Composite Changeset From A Changegroup -** METHOD: sqlite3_changegroup +** METHOD: tdsqlite3_changegroup ** ** Obtain a buffer containing a changeset (or patchset) representing the ** current contents of the changegroup. If the inputs to the changegroup ** were themselves changesets, the output is a changeset. Or, if the ** inputs were patchsets, the output is also a patchset. ** -** As with the output of the sqlite3session_changeset() and -** sqlite3session_patchset() functions, all changes related to a single +** As with the output of the tdsqlite3session_changeset() and +** tdsqlite3session_patchset() functions, all changes related to a single ** table are grouped together in the output of this function. Tables appear ** in the same order as for the very first changeset added to the changegroup. ** If the second or subsequent changesets added to the changegroup contain @@ -956,19 +956,19 @@ int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); ** is returned and the output variables are set to the size of and a ** pointer to the output buffer, respectively. In this case it is the ** responsibility of the caller to eventually free the buffer using a -** call to sqlite3_free(). +** call to tdsqlite3_free(). */ -int sqlite3changegroup_output( - sqlite3_changegroup*, +int tdsqlite3changegroup_output( + tdsqlite3_changegroup*, int *pnData, /* OUT: Size of output buffer in bytes */ void **ppData /* OUT: Pointer to output buffer */ ); /* ** CAPI3REF: Delete A Changegroup Object -** DESTRUCTOR: sqlite3_changegroup +** DESTRUCTOR: tdsqlite3_changegroup */ -void sqlite3changegroup_delete(sqlite3_changegroup*); +void tdsqlite3changegroup_delete(tdsqlite3_changegroup*); /* ** CAPI3REF: Apply A Changeset To A Database @@ -1001,13 +1001,13 @@ void sqlite3changegroup_delete(sqlite3_changegroup*); ** ** If there is no compatible table, it is not an error, but none of the ** changes associated with the table are applied. A warning message is issued -** via the sqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most +** via the tdsqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most ** one such warning is issued for each table in the changeset. ** ** For each change for which there is a compatible table, an attempt is made ** to modify the table contents according to the UPDATE, INSERT or DELETE ** change. If a change cannot be applied cleanly, the conflict handler -** function passed as the fifth argument to sqlite3changeset_apply() may be +** function passed as the fifth argument to tdsqlite3changeset_apply() may be ** invoked. A description of exactly when the conflict handler is invoked for ** each type of change is below. ** @@ -1021,8 +1021,8 @@ void sqlite3changegroup_delete(sqlite3_changegroup*); ** if the second argument passed to the conflict handler is either ** SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If the conflict-handler ** returns an illegal value, any changes already made are rolled back and -** the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different -** actions are taken by sqlite3changeset_apply() depending on the value +** the call to tdsqlite3changeset_apply() returns SQLITE_MISUSE. Different +** actions are taken by tdsqlite3changeset_apply() depending on the value ** returned by each invocation of the conflict-handler function. Refer to ** the documentation for the three ** [SQLITE_CHANGESET_OMIT|available return values] for details. @@ -1112,24 +1112,24 @@ void sqlite3changegroup_delete(sqlite3_changegroup*); ** SQLite error code returned. ** ** If the output parameters (ppRebase) and (pnRebase) are non-NULL and -** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2() +** the input is a changeset (not a patchset), then tdsqlite3changeset_apply_v2() ** may set (*ppRebase) to point to a "rebase" that may be used with the -** sqlite3_rebaser APIs buffer before returning. In this case (*pnRebase) +** tdsqlite3_rebaser APIs buffer before returning. In this case (*pnRebase) ** is set to the size of the buffer in bytes. It is the responsibility of the -** caller to eventually free any such buffer using sqlite3_free(). The buffer +** caller to eventually free any such buffer using tdsqlite3_free(). The buffer ** is only allocated and populated if one or more conflicts were encountered -** while applying the patchset. See comments surrounding the sqlite3_rebaser +** while applying the patchset. See comments surrounding the tdsqlite3_rebaser ** APIs for further details. ** -** The behavior of sqlite3changeset_apply_v2() and its streaming equivalent +** The behavior of tdsqlite3changeset_apply_v2() and its streaming equivalent ** may be modified by passing a combination of ** [SQLITE_CHANGESETAPPLY_NOSAVEPOINT | supported flags] as the 9th parameter. ** -** Note that the sqlite3changeset_apply_v2() API is still experimental +** Note that the tdsqlite3changeset_apply_v2() API is still experimental ** and therefore subject to change. */ -int sqlite3changeset_apply( - sqlite3 *db, /* Apply change to "main" db of this handle */ +int tdsqlite3changeset_apply( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int nChangeset, /* Size of changeset in bytes */ void *pChangeset, /* Changeset blob */ int(*xFilter)( @@ -1139,12 +1139,12 @@ int sqlite3changeset_apply( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx /* First argument passed to xConflict */ ); -int sqlite3changeset_apply_v2( - sqlite3 *db, /* Apply change to "main" db of this handle */ +int tdsqlite3changeset_apply_v2( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int nChangeset, /* Size of changeset in bytes */ void *pChangeset, /* Changeset blob */ int(*xFilter)( @@ -1154,7 +1154,7 @@ int sqlite3changeset_apply_v2( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx, /* First argument passed to xConflict */ void **ppRebase, int *pnRebase, /* OUT: Rebase data */ @@ -1162,10 +1162,10 @@ int sqlite3changeset_apply_v2( ); /* -** CAPI3REF: Flags for sqlite3changeset_apply_v2 +** CAPI3REF: Flags for tdsqlite3changeset_apply_v2 ** ** The following flags may passed via the 9th parameter to -** [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +** [tdsqlite3changeset_apply_v2] and [tdsqlite3changeset_apply_v2_strm]: ** **
**
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
@@ -1179,7 +1179,7 @@ int sqlite3changeset_apply_v2( ** **
SQLITE_CHANGESETAPPLY_INVERT
** Invert the changeset before applying it. This is equivalent to inverting -** a changeset using sqlite3changeset_invert() before applying it. It is +** a changeset using tdsqlite3changeset_invert() before applying it. It is ** an error to specify this flag with a patchset. */ #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 @@ -1207,7 +1207,7 @@ int sqlite3changeset_apply_v2( ** required PRIMARY KEY fields is not present in the database. ** ** There is no conflicting row in this case. The results of invoking the -** sqlite3changeset_conflict() API are undefined. +** tdsqlite3changeset_conflict() API are undefined. ** **
SQLITE_CHANGESET_CONFLICT
** CHANGESET_CONFLICT is passed as the second argument to the conflict @@ -1227,8 +1227,8 @@ int sqlite3changeset_apply_v2( ** CHANGESET_ABORT, the changeset is rolled back. ** ** No current or conflicting row information is provided. The only function -** it is possible to call on the supplied sqlite3_changeset_iter handle -** is sqlite3changeset_fk_conflicts(). +** it is possible to call on the supplied tdsqlite3_changeset_iter handle +** is tdsqlite3changeset_fk_conflicts(). ** **
SQLITE_CHANGESET_CONSTRAINT
** If any other constraint violation occurs while applying a change (i.e. @@ -1236,7 +1236,7 @@ int sqlite3changeset_apply_v2( ** invoked with CHANGESET_CONSTRAINT as the second argument. ** ** There is no conflicting row in this case. The results of invoking the -** sqlite3changeset_conflict() API are undefined. +** tdsqlite3changeset_conflict() API are undefined. ** **
*/ @@ -1261,7 +1261,7 @@ int sqlite3changeset_apply_v2( ** This value may only be returned if the second argument to the conflict ** handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this ** is not the case, any changes applied so far are rolled back and the -** call to sqlite3changeset_apply() returns SQLITE_MISUSE. +** call to tdsqlite3changeset_apply() returns SQLITE_MISUSE. ** ** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict ** handler, then the conflicting row is either updated or deleted, depending @@ -1274,7 +1274,7 @@ int sqlite3changeset_apply_v2( ** **
SQLITE_CHANGESET_ABORT
** If this value is returned, any changes applied so far are rolled back -** and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +** and the call to tdsqlite3changeset_apply() returns SQLITE_ABORT. **
*/ #define SQLITE_CHANGESET_OMIT 0 @@ -1362,24 +1362,24 @@ int sqlite3changeset_apply_v2( ** OMIT. ** ** In order to rebase a local changeset, the remote changeset must first -** be applied to the local database using sqlite3changeset_apply_v2() and +** be applied to the local database using tdsqlite3changeset_apply_v2() and ** the buffer of rebase information captured. Then: ** **
    -**
  1. An sqlite3_rebaser object is created by calling -** sqlite3rebaser_create(). +**
  2. An tdsqlite3_rebaser object is created by calling +** tdsqlite3rebaser_create(). **
  3. The new object is configured with the rebase buffer obtained from -** sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +** tdsqlite3changeset_apply_v2() by calling tdsqlite3rebaser_configure(). ** If the local changeset is to be rebased against multiple remote -** changesets, then sqlite3rebaser_configure() should be called +** changesets, then tdsqlite3rebaser_configure() should be called ** multiple times, in the same order that the multiple -** sqlite3changeset_apply_v2() calls were made. -**
  4. Each local changeset is rebased by calling sqlite3rebaser_rebase(). -**
  5. The sqlite3_rebaser object is deleted by calling -** sqlite3rebaser_delete(). +** tdsqlite3changeset_apply_v2() calls were made. +**
  6. Each local changeset is rebased by calling tdsqlite3rebaser_rebase(). +**
  7. The tdsqlite3_rebaser object is deleted by calling +** tdsqlite3rebaser_delete(). **
*/ -typedef struct sqlite3_rebaser sqlite3_rebaser; +typedef struct tdsqlite3_rebaser tdsqlite3_rebaser; /* ** CAPI3REF: Create a changeset rebaser object. @@ -1390,7 +1390,7 @@ typedef struct sqlite3_rebaser sqlite3_rebaser; ** occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew) ** to NULL. */ -int sqlite3rebaser_create(sqlite3_rebaser **ppNew); +int tdsqlite3rebaser_create(tdsqlite3_rebaser **ppNew); /* ** CAPI3REF: Configure a changeset rebaser object. @@ -1399,10 +1399,10 @@ int sqlite3rebaser_create(sqlite3_rebaser **ppNew); ** Configure the changeset rebaser object to rebase changesets according ** to the conflict resolutions described by buffer pRebase (size nRebase ** bytes), which must have been obtained from a previous call to -** sqlite3changeset_apply_v2(). +** tdsqlite3changeset_apply_v2(). */ -int sqlite3rebaser_configure( - sqlite3_rebaser*, +int tdsqlite3rebaser_configure( + tdsqlite3_rebaser*, int nRebase, const void *pRebase ); @@ -1417,11 +1417,11 @@ int sqlite3rebaser_configure( ** is set to point to the new buffer containing the rebased changeset and ** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the ** responsibility of the caller to eventually free the new buffer using -** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) +** tdsqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) ** are set to zero and an SQLite error code returned. */ -int sqlite3rebaser_rebase( - sqlite3_rebaser*, +int tdsqlite3rebaser_rebase( + tdsqlite3_rebaser*, int nIn, const void *pIn, int *pnOut, void **ppOut ); @@ -1432,9 +1432,9 @@ int sqlite3rebaser_rebase( ** ** Delete the changeset rebaser object and all associated resources. There ** should be one call to this function for each successful invocation -** of sqlite3rebaser_create(). +** of tdsqlite3rebaser_create(). */ -void sqlite3rebaser_delete(sqlite3_rebaser *p); +void tdsqlite3rebaser_delete(tdsqlite3_rebaser *p); /* ** CAPI3REF: Streaming Versions of API functions. @@ -1444,19 +1444,19 @@ void sqlite3rebaser_delete(sqlite3_rebaser *p); ** ** ** -**
Streaming functionNon-streaming equivalent
sqlite3changeset_apply_strm[sqlite3changeset_apply] -**
sqlite3changeset_apply_strm_v2[sqlite3changeset_apply_v2] -**
sqlite3changeset_concat_strm[sqlite3changeset_concat] -**
sqlite3changeset_invert_strm[sqlite3changeset_invert] -**
sqlite3changeset_start_strm[sqlite3changeset_start] -**
sqlite3session_changeset_strm[sqlite3session_changeset] -**
sqlite3session_patchset_strm[sqlite3session_patchset] +**
tdsqlite3changeset_apply_strm[tdsqlite3changeset_apply] +**
tdsqlite3changeset_apply_strm_v2[tdsqlite3changeset_apply_v2] +**
tdsqlite3changeset_concat_strm[tdsqlite3changeset_concat] +**
tdsqlite3changeset_invert_strm[tdsqlite3changeset_invert] +**
tdsqlite3changeset_start_strm[tdsqlite3changeset_start] +**
tdsqlite3session_changeset_strm[tdsqlite3session_changeset] +**
tdsqlite3session_patchset_strm[tdsqlite3session_patchset] **
** ** Non-streaming functions that accept changesets (or patchsets) as input ** require that the entire changeset be stored in a single buffer in memory. ** Similarly, those that return a changeset or patchset do so by returning -** a pointer to a single large buffer allocated using sqlite3_malloc(). +** a pointer to a single large buffer allocated using tdsqlite3_malloc(). ** Normally this is convenient. However, if an application running in a ** low-memory environment is required to handle very large changesets, the ** large contiguous memory allocations required can become onerous. @@ -1489,7 +1489,7 @@ void sqlite3rebaser_delete(sqlite3_rebaser *p); ** an error, all processing is abandoned and the streaming API function ** returns a copy of the error code to the caller. ** -** In the case of sqlite3changeset_start_strm(), the xInput callback may be +** In the case of tdsqlite3changeset_start_strm(), the xInput callback may be ** invoked by the sessions module at any point during the lifetime of the ** iterator. If such an xInput callback returns an error, the iterator enters ** an error state, whereby all subsequent calls to iterator functions @@ -1526,8 +1526,8 @@ void sqlite3rebaser_delete(sqlite3_rebaser *p); ** parameter set to a value less than or equal to zero. Other than this, ** no guarantees are made as to the size of the chunks of data returned. */ -int sqlite3changeset_apply_strm( - sqlite3 *db, /* Apply change to "main" db of this handle */ +int tdsqlite3changeset_apply_strm( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ void *pIn, /* First arg for xInput */ int(*xFilter)( @@ -1537,12 +1537,12 @@ int sqlite3changeset_apply_strm( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx /* First argument passed to xConflict */ ); -int sqlite3changeset_apply_v2_strm( - sqlite3 *db, /* Apply change to "main" db of this handle */ +int tdsqlite3changeset_apply_v2_strm( + tdsqlite3 *db, /* Apply change to "main" db of this handle */ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ void *pIn, /* First arg for xInput */ int(*xFilter)( @@ -1552,13 +1552,13 @@ int sqlite3changeset_apply_v2_strm( int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ - sqlite3_changeset_iter *p /* Handle describing change and conflict */ + tdsqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx, /* First argument passed to xConflict */ void **ppRebase, int *pnRebase, int flags ); -int sqlite3changeset_concat_strm( +int tdsqlite3changeset_concat_strm( int (*xInputA)(void *pIn, void *pData, int *pnData), void *pInA, int (*xInputB)(void *pIn, void *pData, int *pnData), @@ -1566,43 +1566,43 @@ int sqlite3changeset_concat_strm( int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -int sqlite3changeset_invert_strm( +int tdsqlite3changeset_invert_strm( int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -int sqlite3changeset_start_strm( - sqlite3_changeset_iter **pp, +int tdsqlite3changeset_start_strm( + tdsqlite3_changeset_iter **pp, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn ); -int sqlite3changeset_start_v2_strm( - sqlite3_changeset_iter **pp, +int tdsqlite3changeset_start_v2_strm( + tdsqlite3_changeset_iter **pp, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int flags ); -int sqlite3session_changeset_strm( - sqlite3_session *pSession, +int tdsqlite3session_changeset_strm( + tdsqlite3_session *pSession, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -int sqlite3session_patchset_strm( - sqlite3_session *pSession, +int tdsqlite3session_patchset_strm( + tdsqlite3_session *pSession, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -int sqlite3changegroup_add_strm(sqlite3_changegroup*, +int tdsqlite3changegroup_add_strm(tdsqlite3_changegroup*, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn ); -int sqlite3changegroup_output_strm(sqlite3_changegroup*, +int tdsqlite3changegroup_output_strm(tdsqlite3_changegroup*, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); -int sqlite3rebaser_rebase_strm( - sqlite3_rebaser *pRebaser, +int tdsqlite3rebaser_rebase_strm( + tdsqlite3_rebaser *pRebaser, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int (*xOutput)(void *pOut, const void *pData, int nData), @@ -1612,16 +1612,16 @@ int sqlite3rebaser_rebase_strm( /* ** CAPI3REF: Configure global parameters ** -** The sqlite3session_config() interface is used to make global configuration +** The tdsqlite3session_config() interface is used to make global configuration ** changes to the sessions module in order to tune it to the specific needs ** of the application. ** -** The sqlite3session_config() interface is not threadsafe. If it is invoked +** The tdsqlite3session_config() interface is not threadsafe. If it is invoked ** while any other thread is inside any other sessions method then the ** results are undefined. Furthermore, if it is invoked after any sessions ** related objects have been created, the results are also undefined. ** -** The first argument to the sqlite3session_config() function must be one +** The first argument to the tdsqlite3session_config() function must be one ** of the SQLITE_SESSION_CONFIG_XXX constants defined below. The ** interpretation of the (void*) value passed as the second parameter and ** the effect of calling this function depends on the value of the first @@ -1642,10 +1642,10 @@ int sqlite3rebaser_rebase_strm( ** This function returns SQLITE_OK if successful, or an SQLite error code ** otherwise. */ -int sqlite3session_config(int op, void *pArg); +int tdsqlite3session_config(int op, void *pArg); /* -** CAPI3REF: Values for sqlite3session_config(). +** CAPI3REF: Values for tdsqlite3session_config(). */ #define SQLITE_SESSION_CONFIG_STRMSIZE 1 diff --git a/tddb/td/db/SqliteDb.cpp b/tddb/td/db/SqliteDb.cpp index c8b5a34b4..1b303f787 100644 --- a/tddb/td/db/SqliteDb.cpp +++ b/tddb/td/db/SqliteDb.cpp @@ -84,16 +84,16 @@ Status SqliteDb::init(CSlice path, bool allow_creation) { TRY_STATUS(destroy(path)); } - sqlite3 *db; - CHECK(sqlite3_threadsafe() != 0); + tdsqlite3 *db; + CHECK(tdsqlite3_threadsafe() != 0); int rc = - sqlite3_open_v2(path.c_str(), &db, SQLITE_OPEN_READWRITE | (allow_creation ? SQLITE_OPEN_CREATE : 0), nullptr); + tdsqlite3_open_v2(path.c_str(), &db, SQLITE_OPEN_READWRITE | (allow_creation ? SQLITE_OPEN_CREATE : 0), nullptr); if (rc != SQLITE_OK) { auto res = detail::RawSqliteDb::last_error(db, path); - sqlite3_close(db); + tdsqlite3_close(db); return res; } - sqlite3_busy_timeout(db, 1000 * 5 /* 5 seconds */); + tdsqlite3_busy_timeout(db, 1000 * 5 /* 5 seconds */); raw_ = std::make_shared(db, path.str()); return Status::OK(); } @@ -108,14 +108,14 @@ static int trace_v2_callback(unsigned code, void *ctx, void *p_raw, void *x_raw) if (x[0] == '-' && x[1] == '-') { trace_callback(ctx, x); } else { - trace_callback(ctx, sqlite3_expanded_sql(static_cast(p_raw))); + trace_callback(ctx, tdsqlite3_expanded_sql(static_cast(p_raw))); } return 0; } void SqliteDb::trace(bool flag) { - sqlite3_trace_v2(raw_->db(), SQLITE_TRACE_STMT, flag ? trace_v2_callback : nullptr, nullptr); + tdsqlite3_trace_v2(raw_->db(), SQLITE_TRACE_STMT, flag ? trace_v2_callback : nullptr, nullptr); } Status SqliteDb::exec(CSlice cmd) { @@ -124,7 +124,7 @@ Status SqliteDb::exec(CSlice cmd) { if (enable_logging_) { VLOG(sqlite) << "Start exec " << tag("query", cmd) << tag("database", raw_->db()); } - auto rc = sqlite3_exec(raw_->db(), cmd.c_str(), nullptr, nullptr, &msg); + auto rc = tdsqlite3_exec(raw_->db(), cmd.c_str(), nullptr, nullptr, &msg); if (enable_logging_) { VLOG(sqlite) << "Finish exec " << tag("query", cmd) << tag("database", raw_->db()); } @@ -307,8 +307,9 @@ Status SqliteDb::destroy(Slice path) { } Result SqliteDb::get_statement(CSlice statement) { - sqlite3_stmt *stmt = nullptr; - auto rc = sqlite3_prepare_v2(get_native(), statement.c_str(), static_cast(statement.size()) + 1, &stmt, nullptr); + tdsqlite3_stmt *stmt = nullptr; + auto rc = + tdsqlite3_prepare_v2(get_native(), statement.c_str(), static_cast(statement.size()) + 1, &stmt, nullptr); if (rc != SQLITE_OK) { return Status::Error(PSLICE() << "Failed to prepare SQLite " << tag("statement", statement) << raw_->last_error()); } diff --git a/tddb/td/db/SqliteDb.h b/tddb/td/db/SqliteDb.h index 7792adfcc..a8c730dec 100644 --- a/tddb/td/db/SqliteDb.h +++ b/tddb/td/db/SqliteDb.h @@ -17,7 +17,7 @@ #include -struct sqlite3; +struct tdsqlite3; namespace td { @@ -63,7 +63,7 @@ class SqliteDb { static Result change_key(CSlice path, bool allow_creation, const DbKey &new_db_key, const DbKey &old_db_key); - sqlite3 *get_native() const { + tdsqlite3 *get_native() const { return raw_->db(); } diff --git a/tddb/td/db/SqliteStatement.cpp b/tddb/td/db/SqliteStatement.cpp index 2d36bd49b..f203edaa5 100644 --- a/tddb/td/db/SqliteStatement.cpp +++ b/tddb/td/db/SqliteStatement.cpp @@ -18,39 +18,39 @@ namespace td { int VERBOSITY_NAME(sqlite) = VERBOSITY_NAME(DEBUG) + 10; namespace { -int printExplainQueryPlan(StringBuilder &sb, sqlite3_stmt *pStmt) { - const char *zSql = sqlite3_sql(pStmt); +int printExplainQueryPlan(StringBuilder &sb, tdsqlite3_stmt *pStmt) { + const char *zSql = tdsqlite3_sql(pStmt); if (zSql == nullptr) { return SQLITE_ERROR; } sb << "Explain query " << zSql; - char *zExplain = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", zSql); + char *zExplain = tdsqlite3_mprintf("EXPLAIN QUERY PLAN %s", zSql); if (zExplain == nullptr) { return SQLITE_NOMEM; } - sqlite3_stmt *pExplain; /* Compiled EXPLAIN QUERY PLAN command */ - int rc = sqlite3_prepare_v2(sqlite3_db_handle(pStmt), zExplain, -1, &pExplain, nullptr); - sqlite3_free(zExplain); + tdsqlite3_stmt *pExplain; /* Compiled EXPLAIN QUERY PLAN command */ + int rc = tdsqlite3_prepare_v2(tdsqlite3_db_handle(pStmt), zExplain, -1, &pExplain, nullptr); + tdsqlite3_free(zExplain); if (rc != SQLITE_OK) { return rc; } - while (SQLITE_ROW == sqlite3_step(pExplain)) { - int iSelectid = sqlite3_column_int(pExplain, 0); - int iOrder = sqlite3_column_int(pExplain, 1); - int iFrom = sqlite3_column_int(pExplain, 2); - const char *zDetail = reinterpret_cast(sqlite3_column_text(pExplain, 3)); + while (SQLITE_ROW == tdsqlite3_step(pExplain)) { + int iSelectid = tdsqlite3_column_int(pExplain, 0); + int iOrder = tdsqlite3_column_int(pExplain, 1); + int iFrom = tdsqlite3_column_int(pExplain, 2); + const char *zDetail = reinterpret_cast(tdsqlite3_column_text(pExplain, 3)); sb << '\n' << iSelectid << ' ' << iOrder << ' ' << iFrom << ' ' << zDetail; } - return sqlite3_finalize(pExplain); + return tdsqlite3_finalize(pExplain); } } // namespace -SqliteStatement::SqliteStatement(sqlite3_stmt *stmt, std::shared_ptr db) +SqliteStatement::SqliteStatement(tdsqlite3_stmt *stmt, std::shared_ptr db) : stmt_(stmt), db_(std::move(db)) { CHECK(stmt != nullptr); } @@ -72,14 +72,14 @@ Result SqliteStatement::explain() { return sb.as_cslice().str(); } Status SqliteStatement::bind_blob(int id, Slice blob) { - auto rc = sqlite3_bind_blob(stmt_.get(), id, blob.data(), static_cast(blob.size()), nullptr); + auto rc = tdsqlite3_bind_blob(stmt_.get(), id, blob.data(), static_cast(blob.size()), nullptr); if (rc != SQLITE_OK) { return last_error(); } return Status::OK(); } Status SqliteStatement::bind_string(int id, Slice str) { - auto rc = sqlite3_bind_text(stmt_.get(), id, str.data(), static_cast(str.size()), nullptr); + auto rc = tdsqlite3_bind_text(stmt_.get(), id, str.data(), static_cast(str.size()), nullptr); if (rc != SQLITE_OK) { return last_error(); } @@ -87,21 +87,21 @@ Status SqliteStatement::bind_string(int id, Slice str) { } Status SqliteStatement::bind_int32(int id, int32 value) { - auto rc = sqlite3_bind_int(stmt_.get(), id, value); + auto rc = tdsqlite3_bind_int(stmt_.get(), id, value); if (rc != SQLITE_OK) { return last_error(); } return Status::OK(); } Status SqliteStatement::bind_int64(int id, int64 value) { - auto rc = sqlite3_bind_int64(stmt_.get(), id, value); + auto rc = tdsqlite3_bind_int64(stmt_.get(), id, value); if (rc != SQLITE_OK) { return last_error(); } return Status::OK(); } Status SqliteStatement::bind_null(int id) { - auto rc = sqlite3_bind_null(stmt_.get(), id); + auto rc = tdsqlite3_bind_null(stmt_.get(), id); if (rc != SQLITE_OK) { return last_error(); } @@ -127,8 +127,8 @@ StringBuilder &operator<<(StringBuilder &sb, SqliteStatement::Datatype type) { } Slice SqliteStatement::view_blob(int id) { LOG_IF(ERROR, view_datatype(id) != Datatype::Blob) << view_datatype(id); - auto *data = sqlite3_column_blob(stmt_.get(), id); - auto size = sqlite3_column_bytes(stmt_.get(), id); + auto *data = tdsqlite3_column_blob(stmt_.get(), id); + auto size = tdsqlite3_column_bytes(stmt_.get(), id); if (data == nullptr) { return Slice(); } @@ -136,8 +136,8 @@ Slice SqliteStatement::view_blob(int id) { } Slice SqliteStatement::view_string(int id) { LOG_IF(ERROR, view_datatype(id) != Datatype::Text) << view_datatype(id); - auto *data = sqlite3_column_text(stmt_.get(), id); - auto size = sqlite3_column_bytes(stmt_.get(), id); + auto *data = tdsqlite3_column_text(stmt_.get(), id); + auto size = tdsqlite3_column_bytes(stmt_.get(), id); if (data == nullptr) { return Slice(); } @@ -145,14 +145,14 @@ Slice SqliteStatement::view_string(int id) { } int32 SqliteStatement::view_int32(int id) { LOG_IF(ERROR, view_datatype(id) != Datatype::Integer) << view_datatype(id); - return sqlite3_column_int(stmt_.get(), id); + return tdsqlite3_column_int(stmt_.get(), id); } int64 SqliteStatement::view_int64(int id) { LOG_IF(ERROR, view_datatype(id) != Datatype::Integer) << view_datatype(id); - return sqlite3_column_int64(stmt_.get(), id); + return tdsqlite3_column_int64(stmt_.get(), id); } SqliteStatement::Datatype SqliteStatement::view_datatype(int id) { - auto type = sqlite3_column_type(stmt_.get(), id); + auto type = tdsqlite3_column_type(stmt_.get(), id); switch (type) { case SQLITE_INTEGER: return Datatype::Integer; @@ -170,7 +170,7 @@ SqliteStatement::Datatype SqliteStatement::view_datatype(int id) { } void SqliteStatement::reset() { - sqlite3_reset(stmt_.get()); + tdsqlite3_reset(stmt_.get()); state_ = State::Start; } @@ -178,10 +178,10 @@ Status SqliteStatement::step() { if (state_ == State::Finish) { return Status::Error("One has to reset statement"); } - VLOG(sqlite) << "Start step " << tag("query", sqlite3_sql(stmt_.get())) << tag("statement", stmt_.get()) + VLOG(sqlite) << "Start step " << tag("query", tdsqlite3_sql(stmt_.get())) << tag("statement", stmt_.get()) << tag("database", db_.get()); - auto rc = sqlite3_step(stmt_.get()); - VLOG(sqlite) << "Finish step " << tag("query", sqlite3_sql(stmt_.get())) << tag("statement", stmt_.get()) + auto rc = tdsqlite3_step(stmt_.get()); + VLOG(sqlite) << "Finish step " << tag("query", tdsqlite3_sql(stmt_.get())) << tag("statement", stmt_.get()) << tag("database", db_.get()); if (rc == SQLITE_ROW) { state_ = State::GotRow; @@ -195,8 +195,8 @@ Status SqliteStatement::step() { return last_error(); } -void SqliteStatement::StmtDeleter::operator()(sqlite3_stmt *stmt) { - sqlite3_finalize(stmt); +void SqliteStatement::StmtDeleter::operator()(tdsqlite3_stmt *stmt) { + tdsqlite3_finalize(stmt); } Status SqliteStatement::last_error() { diff --git a/tddb/td/db/SqliteStatement.h b/tddb/td/db/SqliteStatement.h index 16ef022ef..35148508c 100644 --- a/tddb/td/db/SqliteStatement.h +++ b/tddb/td/db/SqliteStatement.h @@ -16,8 +16,8 @@ #include -struct sqlite3; -struct sqlite3_stmt; +struct tdsqlite3; +struct tdsqlite3_stmt; namespace td { @@ -69,17 +69,17 @@ class SqliteStatement { private: friend class SqliteDb; - SqliteStatement(sqlite3_stmt *stmt, std::shared_ptr db); + SqliteStatement(tdsqlite3_stmt *stmt, std::shared_ptr db); class StmtDeleter { public: - void operator()(sqlite3_stmt *stmt); + void operator()(tdsqlite3_stmt *stmt); }; enum class State { Start, GotRow, Finish }; State state_ = State::Start; - std::unique_ptr stmt_; + std::unique_ptr stmt_; std::shared_ptr db_; Status last_error(); diff --git a/tddb/td/db/detail/RawSqliteDb.cpp b/tddb/td/db/detail/RawSqliteDb.cpp index eb6389eeb..83147562e 100644 --- a/tddb/td/db/detail/RawSqliteDb.cpp +++ b/tddb/td/db/detail/RawSqliteDb.cpp @@ -21,8 +21,8 @@ namespace detail { static std::atomic was_database_destroyed{false}; -Status RawSqliteDb::last_error(sqlite3 *db, CSlice path) { - return Status::Error(PSLICE() << Slice(sqlite3_errmsg(db)) << " for database \"" << path << '"'); +Status RawSqliteDb::last_error(tdsqlite3 *db, CSlice path) { + return Status::Error(PSLICE() << Slice(tdsqlite3_errmsg(db)) << " for database \"" << path << '"'); } Status RawSqliteDb::destroy(Slice path) { @@ -38,7 +38,7 @@ Status RawSqliteDb::destroy(Slice path) { Status RawSqliteDb::last_error() { //If database was corrupted, try to delete it. - auto code = sqlite3_errcode(db_); + auto code = tdsqlite3_errcode(db_); if (code == SQLITE_CORRUPT) { was_database_destroyed.store(true, std::memory_order_relaxed); destroy(path_).ignore(); @@ -52,7 +52,7 @@ bool RawSqliteDb::was_any_database_destroyed() { } RawSqliteDb::~RawSqliteDb() { - auto rc = sqlite3_close(db_); + auto rc = tdsqlite3_close(db_); LOG_IF(FATAL, rc != SQLITE_OK) << last_error(db_, path()); } diff --git a/tddb/td/db/detail/RawSqliteDb.h b/tddb/td/db/detail/RawSqliteDb.h index ad67aa949..c2227d1fa 100644 --- a/tddb/td/db/detail/RawSqliteDb.h +++ b/tddb/td/db/detail/RawSqliteDb.h @@ -11,14 +11,14 @@ #include "td/utils/SliceBuilder.h" #include "td/utils/Status.h" -struct sqlite3; +struct tdsqlite3; namespace td { namespace detail { class RawSqliteDb { public: - RawSqliteDb(sqlite3 *db, std::string path) : db_(db), path_(std::move(path)) { + RawSqliteDb(tdsqlite3 *db, std::string path) : db_(db), path_(std::move(path)) { } RawSqliteDb(const RawSqliteDb &) = delete; RawSqliteDb(RawSqliteDb &&) = delete; @@ -35,7 +35,7 @@ class RawSqliteDb { } static Status destroy(Slice path) TD_WARN_UNUSED_RESULT; - sqlite3 *db() { + tdsqlite3 *db() { return db_; } CSlice path() const { @@ -43,7 +43,7 @@ class RawSqliteDb { } Status last_error(); - static Status last_error(sqlite3 *db, CSlice path); + static Status last_error(tdsqlite3 *db, CSlice path); static bool was_any_database_destroyed(); @@ -68,7 +68,7 @@ class RawSqliteDb { } private: - sqlite3 *db_; + tdsqlite3 *db_; std::string path_; size_t begin_cnt_{0}; optional cipher_version_;