Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Make sure the SQLITE_TCLAPI macro is always defined and use it for all callback functions that must interface with the Tcl C API. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | callbackConv |
Files: | files | file ages | folders |
SHA1: |
f2f1323cc4d2ad2d6794dbfae8d50b74 |
User & Date: | mistachkin 2016-07-28 17:11:20.162 |
Original Comment: | Make sure the SQLITE_TCLAPI macro is always defined. |
Context
2016-07-28
| ||
18:06 | Adjustments to get 'testfixture.exe' compiling with Tcl 8.6 when __stdcall is enabled. (check-in: 90e89ec9c8 user: mistachkin tags: callbackConv) | |
17:11 | Make sure the SQLITE_TCLAPI macro is always defined and use it for all callback functions that must interface with the Tcl C API. (check-in: f2f1323cc4 user: mistachkin tags: callbackConv) | |
16:09 | More work on getting the 'testfixture.exe' target to work correctly. (check-in: 36b72fd609 user: mistachkin tags: callbackConv) | |
Changes
Changes to ext/fts3/fts3_test.c.
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ** that the sqlite3_tokenizer_module.xLanguage() method is invoked correctly. */ #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <string.h> #include <assert.h> #if defined(SQLITE_TEST) #if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) | > > > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ** that the sqlite3_tokenizer_module.xLanguage() method is invoked correctly. */ #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif #include <string.h> #include <assert.h> #if defined(SQLITE_TEST) #if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) |
︙ | ︙ | |||
143 144 145 146 147 148 149 | return nOcc; } /* ** Tclcmd: fts3_near_match DOCUMENT EXPR ?OPTIONS? */ | | | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | return nOcc; } /* ** Tclcmd: fts3_near_match DOCUMENT EXPR ?OPTIONS? */ static int SQLITE_TCLAPI fts3_near_match_cmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int nTotal = 0; int rc; |
︙ | ︙ | |||
278 279 280 281 282 283 284 | ** set cfg [fts3_configure_incr_load $new_chunksize $new_threshold] ** ** .... run tests .... ** ** # Restore initial incr-load settings: ** eval fts3_configure_incr_load $cfg */ | | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | ** set cfg [fts3_configure_incr_load $new_chunksize $new_threshold] ** ** .... run tests .... ** ** # Restore initial incr-load settings: ** eval fts3_configure_incr_load $cfg */ static int SQLITE_TCLAPI fts3_configure_incr_load_cmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifdef SQLITE_ENABLE_FTS3 extern int test_fts3_node_chunksize; |
︙ | ︙ | |||
488 489 490 491 492 493 494 | if( pCsr->iLangid>=100 ){ rc = SQLITE_ERROR; } return rc; } #endif | | | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | if( pCsr->iLangid>=100 ){ rc = SQLITE_ERROR; } return rc; } #endif static int SQLITE_TCLAPI fts3_test_tokenizer_cmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifdef SQLITE_ENABLE_FTS3 static const sqlite3_tokenizer_module testTokenizerModule = { |
︙ | ︙ | |||
517 518 519 520 521 522 523 | (const unsigned char *)&pPtr, sizeof(sqlite3_tokenizer_module *) )); #endif UNUSED_PARAMETER(clientData); return TCL_OK; } | | | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | (const unsigned char *)&pPtr, sizeof(sqlite3_tokenizer_module *) )); #endif UNUSED_PARAMETER(clientData); return TCL_OK; } static int SQLITE_TCLAPI fts3_test_varint_cmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifdef SQLITE_ENABLE_FTS3 char aBuf[24]; |
︙ | ︙ |
Changes to src/sqliteInt.h.
︙ | ︙ | |||
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | ** if it did occur. ** ** In all cases, the special comment must be enclosed in the usual ** slash-asterisk...asterisk-slash comment marks, with no spaces between the ** asterisks and the comment text. */ /* ** Make sure that rand_s() is available on Windows systems with MSVC 2005 ** or higher. */ #if defined(_MSC_VER) && _MSC_VER>=1400 # define _CRT_RAND_S #endif | > > > > > > > > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | ** if it did occur. ** ** In all cases, the special comment must be enclosed in the usual ** slash-asterisk...asterisk-slash comment marks, with no spaces between the ** asterisks and the comment text. */ /* ** Make sure the Tcl calling convention macro is defined. This macro is ** only used by test code and Tcl integration code. */ #ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI #endif /* ** Make sure that rand_s() is available on Windows systems with MSVC 2005 ** or higher. */ #if defined(_MSC_VER) && _MSC_VER>=1400 # define _CRT_RAND_S #endif |
︙ | ︙ |
Changes to src/tclsqlite.c.
︙ | ︙ | |||
33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # include "msvc.h" #endif #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <errno.h> /* ** Some additional include files are needed if this file is not ** appended to the amalgamation. */ | > > > | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # include "msvc.h" #endif #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif #include <errno.h> /* ** Some additional include files are needed if this file is not ** appended to the amalgamation. */ |
︙ | ︙ | |||
204 205 206 207 208 209 210 | Tcl_UnregisterChannel(pDb->interp, p->channel); } } /* ** Close an incremental blob channel. */ | > | > > | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | Tcl_UnregisterChannel(pDb->interp, p->channel); } } /* ** Close an incremental blob channel. */ static int SQLITE_TCLAPI incrblobClose( ClientData instanceData, Tcl_Interp *interp ){ IncrblobChannel *p = (IncrblobChannel *)instanceData; int rc = sqlite3_blob_close(p->pBlob); sqlite3 *db = p->pDb->db; /* Remove the channel from the SqliteDb.pIncrblob list. */ if( p->pNext ){ p->pNext->pPrev = p->pPrev; |
︙ | ︙ | |||
233 234 235 236 237 238 239 | } return TCL_OK; } /* ** Read data from an incremental blob channel. */ | | | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | } return TCL_OK; } /* ** Read data from an incremental blob channel. */ static int SQLITE_TCLAPI incrblobInput( ClientData instanceData, char *buf, int bufSize, int *errorCodePtr ){ IncrblobChannel *p = (IncrblobChannel *)instanceData; int nRead = bufSize; /* Number of bytes to read */ |
︙ | ︙ | |||
265 266 267 268 269 270 271 | p->iSeek += nRead; return nRead; } /* ** Write data to an incremental blob channel. */ | | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | p->iSeek += nRead; return nRead; } /* ** Write data to an incremental blob channel. */ static int SQLITE_TCLAPI incrblobOutput( ClientData instanceData, CONST char *buf, int toWrite, int *errorCodePtr ){ IncrblobChannel *p = (IncrblobChannel *)instanceData; int nWrite = toWrite; /* Number of bytes to write */ |
︙ | ︙ | |||
298 299 300 301 302 303 304 | p->iSeek += nWrite; return nWrite; } /* ** Seek an incremental blob channel. */ | | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | p->iSeek += nWrite; return nWrite; } /* ** Seek an incremental blob channel. */ static int SQLITE_TCLAPI incrblobSeek( ClientData instanceData, long offset, int seekMode, int *errorCodePtr ){ IncrblobChannel *p = (IncrblobChannel *)instanceData; |
︙ | ︙ | |||
324 325 326 327 328 329 330 | default: assert(!"Bad seekMode"); } return p->iSeek; } | > | > > > | > > > | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | default: assert(!"Bad seekMode"); } return p->iSeek; } static void SQLITE_TCLAPI incrblobWatch( ClientData instanceData, int mode ){ /* NO-OP */ } static int SQLITE_TCLAPI incrblobHandle( ClientData instanceData, int dir, ClientData *hPtr ){ return TCL_ERROR; } static Tcl_ChannelType IncrblobChannelType = { "incrblob", /* typeName */ TCL_CHANNEL_VERSION_2, /* version */ incrblobClose, /* closeProc */ |
︙ | ︙ | |||
486 487 488 489 490 491 492 | pDb->stmtList = 0; } /* ** TCL calls this procedure when an sqlite3 database command is ** deleted. */ | | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | pDb->stmtList = 0; } /* ** TCL calls this procedure when an sqlite3 database command is ** deleted. */ static void SQLITE_TCLAPI DbDeleteCmd(void *db){ SqliteDb *pDb = (SqliteDb*)db; flushStmtCache(pDb); closeIncrblobChannels(pDb); sqlite3_close(pDb->db); while( pDb->pFunc ){ SqlFunc *pFunc = pDb->pFunc; pDb->pFunc = pFunc->pNext; |
︙ | ︙ | |||
1791 1792 1793 1794 1795 1796 1797 | ** sqlite3 db1 "my_database" ** db1 close ** ** The first command opens a connection to the "my_database" database ** and calls that connection "db1". The second command causes this ** subroutine to be invoked. */ | > > | > > > | 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 | ** sqlite3 db1 "my_database" ** db1 close ** ** The first command opens a connection to the "my_database" database ** and calls that connection "db1". The second command causes this ** subroutine to be invoked. */ static int SQLITE_TCLAPI DbObjCmd( void *cd, Tcl_Interp *interp, int objc, Tcl_Obj *const*objv ){ SqliteDb *pDb = (SqliteDb*)cd; int choice; int rc = TCL_OK; static const char *DB_strs[] = { "authorizer", "backup", "busy", "cache", "changes", "close", "collate", "collation_needed", "commit_hook", |
︙ | ︙ | |||
3259 3260 3261 3262 3263 3264 3265 | ** database connection. This command creates a new command named ** DBNAME that is used to control that connection. The database ** connection is deleted when the DBNAME command is deleted. ** ** The second argument is the name of the database file. ** */ | > > | > > > | 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 | ** database connection. This command creates a new command named ** DBNAME that is used to control that connection. The database ** connection is deleted when the DBNAME command is deleted. ** ** The second argument is the name of the database file. ** */ static int SQLITE_TCLAPI DbMain( void *cd, Tcl_Interp *interp, int objc, Tcl_Obj *const*objv ){ SqliteDb *p; const char *zArg; char *zErrMsg; int i; const char *zFile; const char *zVfs = 0; int flags; |
︙ | ︙ | |||
3931 3932 3933 3934 3935 3936 3937 | #endif #if TCLSH==2 static const char *tclsh_main_loop(void); #endif #ifdef SQLITE_TEST static void init_all(Tcl_Interp *); | | | 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 | #endif #if TCLSH==2 static const char *tclsh_main_loop(void); #endif #ifdef SQLITE_TEST static void init_all(Tcl_Interp *); static int SQLITE_TCLAPI init_all_cmd( ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ Tcl_Interp *slave; |
︙ | ︙ | |||
3961 3962 3963 3964 3965 3966 3967 | ** Tclcmd: db_use_legacy_prepare DB BOOLEAN ** ** The first argument to this command must be a database command created by ** [sqlite3]. If the second argument is true, then the handle is configured ** to use the sqlite3_prepare_v2() function to prepare statements. If it ** is false, sqlite3_prepare(). */ | | | 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 | ** Tclcmd: db_use_legacy_prepare DB BOOLEAN ** ** The first argument to this command must be a database command created by ** [sqlite3]. If the second argument is true, then the handle is configured ** to use the sqlite3_prepare_v2() function to prepare statements. If it ** is false, sqlite3_prepare(). */ static int SQLITE_TCLAPI db_use_legacy_prepare_cmd( ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ Tcl_CmdInfo cmdInfo; SqliteDb *pDb; |
︙ | ︙ | |||
3998 3999 4000 4001 4002 4003 4004 | /* ** Tclcmd: db_last_stmt_ptr DB ** ** If the statement cache associated with database DB is not empty, ** return the text representation of the most recently used statement ** handle. */ | | | 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 | /* ** Tclcmd: db_last_stmt_ptr DB ** ** If the statement cache associated with database DB is not empty, ** return the text representation of the most recently used statement ** handle. */ static int SQLITE_TCLAPI db_last_stmt_ptr( ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ extern int sqlite3TestMakePointerStr(Tcl_Interp*, char*, void*); Tcl_CmdInfo cmdInfo; |
︙ | ︙ |
Changes to src/test1.c.
︙ | ︙ | |||
75 76 77 78 79 80 81 | /* ** A TCL command that returns the address of the sqlite* pointer ** for an sqlite connection instance. Bad things happen if the ** input is not an sqlite connection. */ | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | /* ** A TCL command that returns the address of the sqlite* pointer ** for an sqlite connection instance. Bad things happen if the ** input is not an sqlite connection. */ static int SQLITE_TCLAPI get_sqlite_pointer( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ struct SqliteDb *p; Tcl_CmdInfo cmdInfo; |
︙ | ︙ | |||
221 222 223 224 225 226 227 | /* ** Usage: io_trace FILENAME ** ** Turn I/O tracing on or off. If FILENAME is not an empty string, ** I/O tracing begins going into FILENAME. If FILENAME is an empty ** string, I/O tracing is turned off. */ | | | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | /* ** Usage: io_trace FILENAME ** ** Turn I/O tracing on or off. If FILENAME is not an empty string, ** I/O tracing begins going into FILENAME. If FILENAME is an empty ** string, I/O tracing is turned off. */ static int SQLITE_TCLAPI test_io_trace( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ #if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE) if( argc!=2 ){ |
︙ | ︙ | |||
262 263 264 265 266 267 268 | ** Usage: clang_sanitize_address ** ** Returns true if the program was compiled using clang with the ** -fsanitize=address switch on the command line. False otherwise. ** ** Also return true if the OMIT_MISUSE environment variable exists. */ | | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | ** Usage: clang_sanitize_address ** ** Returns true if the program was compiled using clang with the ** -fsanitize=address switch on the command line. False otherwise. ** ** Also return true if the OMIT_MISUSE environment variable exists. */ static int SQLITE_TCLAPI clang_sanitize_address( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ int res = 0; #if defined(__has_feature) |
︙ | ︙ | |||
289 290 291 292 293 294 295 | /* ** Usage: sqlite3_exec_printf DB FORMAT STRING ** ** Invoke the sqlite3_exec_printf() interface using the open database ** DB. The SQL is the string FORMAT. The format string should contain ** one %s or %q. STRING is the value inserted into %s or %q. */ | | | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | /* ** Usage: sqlite3_exec_printf DB FORMAT STRING ** ** Invoke the sqlite3_exec_printf() interface using the open database ** DB. The SQL is the string FORMAT. The format string should contain ** one %s or %q. STRING is the value inserted into %s or %q. */ static int SQLITE_TCLAPI test_exec_printf( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3 *db; Tcl_DString str; |
︙ | ︙ | |||
327 328 329 330 331 332 333 | /* ** Usage: sqlite3_exec_hex DB HEX ** ** Invoke the sqlite3_exec() on a string that is obtained by translating ** HEX into ASCII. Most characters are translated as is. %HH becomes ** a hex character. */ | | | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | /* ** Usage: sqlite3_exec_hex DB HEX ** ** Invoke the sqlite3_exec() on a string that is obtained by translating ** HEX into ASCII. Most characters are translated as is. %HH becomes ** a hex character. */ static int SQLITE_TCLAPI test_exec_hex( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3 *db; Tcl_DString str; |
︙ | ︙ | |||
373 374 375 376 377 378 379 | /* ** Usage: db_enter DB ** db_leave DB ** ** Enter or leave the mutex on a database connection. */ | | | | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | /* ** Usage: db_enter DB ** db_leave DB ** ** Enter or leave the mutex on a database connection. */ static int SQLITE_TCLAPI db_enter( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3 *db; if( argc!=2 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " DB", 0); return TCL_ERROR; } if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; sqlite3_mutex_enter(db->mutex); return TCL_OK; } static int SQLITE_TCLAPI db_leave( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3 *db; if( argc!=2 ){ |
︙ | ︙ | |||
411 412 413 414 415 416 417 | } /* ** Usage: sqlite3_exec DB SQL ** ** Invoke the sqlite3_exec interface using the open database DB */ | | | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | } /* ** Usage: sqlite3_exec DB SQL ** ** Invoke the sqlite3_exec interface using the open database DB */ static int SQLITE_TCLAPI test_exec( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3 *db; Tcl_DString str; |
︙ | ︙ | |||
458 459 460 461 462 463 464 | /* ** Usage: sqlite3_exec_nr DB SQL ** ** Invoke the sqlite3_exec interface using the open database DB. Discard ** all results */ | | | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | /* ** Usage: sqlite3_exec_nr DB SQL ** ** Invoke the sqlite3_exec interface using the open database DB. Discard ** all results */ static int SQLITE_TCLAPI test_exec_nr( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
485 486 487 488 489 490 491 | /* ** Usage: sqlite3_mprintf_z_test SEPARATOR ARG0 ARG1 ... ** ** Test the %z format of sqlite_mprintf(). Use multiple mprintf() calls to ** concatenate arg0 through argn using separator as the separator. ** Return the result. */ | | | 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | /* ** Usage: sqlite3_mprintf_z_test SEPARATOR ARG0 ARG1 ... ** ** Test the %z format of sqlite_mprintf(). Use multiple mprintf() calls to ** concatenate arg0 through argn using separator as the separator. ** Return the result. */ static int SQLITE_TCLAPI test_mprintf_z( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ char *zResult = 0; int i; |
︙ | ︙ | |||
508 509 510 511 512 513 514 | /* ** Usage: sqlite3_mprintf_n_test STRING ** ** Test the %n format of sqlite_mprintf(). Return the length of the ** input string. */ | | | 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | /* ** Usage: sqlite3_mprintf_n_test STRING ** ** Test the %n format of sqlite_mprintf(). Return the length of the ** input string. */ static int SQLITE_TCLAPI test_mprintf_n( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ char *zStr; int n = 0; |
︙ | ︙ | |||
532 533 534 535 536 537 538 | ** Test the of sqlite3_snprintf() routine. SIZE is the size of the ** output buffer in bytes. The maximum size is 100. FORMAT is the ** format string. INT is a single integer argument. The FORMAT ** string must require no more than this one integer argument. If ** You pass in a format string that requires more than one argument, ** bad things will happen. */ | | | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | ** Test the of sqlite3_snprintf() routine. SIZE is the size of the ** output buffer in bytes. The maximum size is 100. FORMAT is the ** format string. INT is a single integer argument. The FORMAT ** string must require no more than this one integer argument. If ** You pass in a format string that requires more than one argument, ** bad things will happen. */ static int SQLITE_TCLAPI test_snprintf_int( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ char zStr[100]; int n = atoi(argv[1]); |
︙ | ︙ | |||
558 559 560 561 562 563 564 | /* ** Usage: sqlite3_get_table_printf DB FORMAT STRING ?--no-counts? ** ** Invoke the sqlite3_get_table_printf() interface using the open database ** DB. The SQL is the string FORMAT. The format string should contain ** one %s or %q. STRING is the value inserted into %s or %q. */ | | | 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | /* ** Usage: sqlite3_get_table_printf DB FORMAT STRING ?--no-counts? ** ** Invoke the sqlite3_get_table_printf() interface using the open database ** DB. The SQL is the string FORMAT. The format string should contain ** one %s or %q. STRING is the value inserted into %s or %q. */ static int SQLITE_TCLAPI test_get_table_printf( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3 *db; Tcl_DString str; |
︙ | ︙ | |||
621 622 623 624 625 626 627 | /* ** Usage: sqlite3_last_insert_rowid DB ** ** Returns the integer ROWID of the most recent insert. */ | | | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | /* ** Usage: sqlite3_last_insert_rowid DB ** ** Returns the integer ROWID of the most recent insert. */ static int SQLITE_TCLAPI test_last_rowid( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3 *db; char zBuf[30]; |
︙ | ︙ | |||
645 646 647 648 649 650 651 | } /* ** Usage: sqlite3_key DB KEY ** ** Set the codec key. */ | | | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | } /* ** Usage: sqlite3_key DB KEY ** ** Set the codec key. */ static int SQLITE_TCLAPI test_key( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ #if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_CODEC_FROM_TCL) sqlite3 *db; |
︙ | ︙ | |||
673 674 675 676 677 678 679 | } /* ** Usage: sqlite3_rekey DB KEY ** ** Change the codec key. */ | | | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | } /* ** Usage: sqlite3_rekey DB KEY ** ** Change the codec key. */ static int SQLITE_TCLAPI test_rekey( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ #ifdef SQLITE_HAS_CODEC sqlite3 *db; |
︙ | ︙ | |||
701 702 703 704 705 706 707 | } /* ** Usage: sqlite3_close DB ** ** Closes the database opened by sqlite3_open. */ | | | 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | } /* ** Usage: sqlite3_close DB ** ** Closes the database opened by sqlite3_open. */ static int SQLITE_TCLAPI sqlite_test_close( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
725 726 727 728 729 730 731 | } /* ** Usage: sqlite3_close_v2 DB ** ** Closes the database opened by sqlite3_open. */ | | | 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 | } /* ** Usage: sqlite3_close_v2 DB ** ** Closes the database opened by sqlite3_open. */ static int SQLITE_TCLAPI sqlite_test_close_v2( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
1009 1010 1011 1012 1013 1014 1015 | ** The effect is similar to trying to use the same database connection from ** two threads at the same time. ** ** The original motivation for this routine was to be able to call the ** sqlite3_create_function function while a query is in progress in order ** to test the SQLITE_MISUSE detection logic. */ | | | 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 | ** The effect is similar to trying to use the same database connection from ** two threads at the same time. ** ** The original motivation for this routine was to be able to call the ** sqlite3_create_function function while a query is in progress in order ** to test the SQLITE_MISUSE detection logic. */ static int SQLITE_TCLAPI test_create_function( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ int rc; sqlite3 *db; |
︙ | ︙ | |||
1166 1167 1168 1169 1170 1171 1172 | ** This routine was later extended to test the use of sqlite3_result_error() ** within aggregate functions. ** ** Later: It is now also extended to register the aggregate function ** "legacy_count()" with the supplied database handle. This is used ** to test the deprecated sqlite3_aggregate_count() API. */ | | | 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 | ** This routine was later extended to test the use of sqlite3_result_error() ** within aggregate functions. ** ** Later: It is now also extended to register the aggregate function ** "legacy_count()" with the supplied database handle. This is used ** to test the deprecated sqlite3_aggregate_count() API. */ static int SQLITE_TCLAPI test_create_aggregate( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
1207 1208 1209 1210 1211 1212 1213 | ** Usage: printf TEXT ** ** Send output to printf. Use this rather than puts to merge the output ** in the correct sequence with debugging printfs inserted into C code. ** Puts uses a separate buffer and debugging statements will be out of ** sequence if it is used. */ | | | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 | ** Usage: printf TEXT ** ** Send output to printf. Use this rather than puts to merge the output ** in the correct sequence with debugging printfs inserted into C code. ** Puts uses a separate buffer and debugging statements will be out of ** sequence if it is used. */ static int SQLITE_TCLAPI test_printf( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ if( argc!=2 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], |
︙ | ︙ | |||
1229 1230 1231 1232 1233 1234 1235 | /* ** Usage: sqlite3_mprintf_int FORMAT INTEGER INTEGER INTEGER ** ** Call mprintf with three integer arguments */ | | | 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 | /* ** Usage: sqlite3_mprintf_int FORMAT INTEGER INTEGER INTEGER ** ** Call mprintf with three integer arguments */ static int SQLITE_TCLAPI sqlite3_mprintf_int( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ int a[3], i; char *z; |
︙ | ︙ | |||
1256 1257 1258 1259 1260 1261 1262 | } /* ** Usage: sqlite3_mprintf_int64 FORMAT INTEGER INTEGER INTEGER ** ** Call mprintf with three 64-bit integer arguments */ | | | 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 | } /* ** Usage: sqlite3_mprintf_int64 FORMAT INTEGER INTEGER INTEGER ** ** Call mprintf with three 64-bit integer arguments */ static int SQLITE_TCLAPI sqlite3_mprintf_int64( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ int i; sqlite_int64 a[3]; |
︙ | ︙ | |||
1289 1290 1291 1292 1293 1294 1295 | /* ** Usage: sqlite3_mprintf_long FORMAT INTEGER INTEGER INTEGER ** ** Call mprintf with three long integer arguments. This might be the ** same as sqlite3_mprintf_int or sqlite3_mprintf_int64, depending on ** platform. */ | | | 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 | /* ** Usage: sqlite3_mprintf_long FORMAT INTEGER INTEGER INTEGER ** ** Call mprintf with three long integer arguments. This might be the ** same as sqlite3_mprintf_int or sqlite3_mprintf_int64, depending on ** platform. */ static int SQLITE_TCLAPI sqlite3_mprintf_long( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ int i; long int a[3]; |
︙ | ︙ | |||
1320 1321 1322 1323 1324 1325 1326 | } /* ** Usage: sqlite3_mprintf_str FORMAT INTEGER INTEGER STRING ** ** Call mprintf with two integer arguments and one string argument */ | | | 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 | } /* ** Usage: sqlite3_mprintf_str FORMAT INTEGER INTEGER STRING ** ** Call mprintf with two integer arguments and one string argument */ static int SQLITE_TCLAPI sqlite3_mprintf_str( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ int a[3], i; char *z; |
︙ | ︙ | |||
1347 1348 1349 1350 1351 1352 1353 | } /* ** Usage: sqlite3_snprintf_str INTEGER FORMAT INTEGER INTEGER STRING ** ** Call mprintf with two integer arguments and one string argument */ | | | 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 | } /* ** Usage: sqlite3_snprintf_str INTEGER FORMAT INTEGER INTEGER STRING ** ** Call mprintf with two integer arguments and one string argument */ static int SQLITE_TCLAPI sqlite3_snprintf_str( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ int a[3], i; int n; |
︙ | ︙ | |||
1381 1382 1383 1384 1385 1386 1387 | } /* ** Usage: sqlite3_mprintf_double FORMAT INTEGER INTEGER DOUBLE ** ** Call mprintf with two integer arguments and one double argument */ | | | 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 | } /* ** Usage: sqlite3_mprintf_double FORMAT INTEGER INTEGER DOUBLE ** ** Call mprintf with two integer arguments and one double argument */ static int SQLITE_TCLAPI sqlite3_mprintf_double( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ int a[3], i; double r; |
︙ | ︙ | |||
1412 1413 1414 1415 1416 1417 1418 | /* ** Usage: sqlite3_mprintf_scaled FORMAT DOUBLE DOUBLE ** ** Call mprintf with a single double argument which is the product of the ** two arguments given above. This is used to generate overflow and underflow ** doubles to test that they are converted properly. */ | | | 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 | /* ** Usage: sqlite3_mprintf_scaled FORMAT DOUBLE DOUBLE ** ** Call mprintf with a single double argument which is the product of the ** two arguments given above. This is used to generate overflow and underflow ** doubles to test that they are converted properly. */ static int SQLITE_TCLAPI sqlite3_mprintf_scaled( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ int i; double r[2]; |
︙ | ︙ | |||
1442 1443 1444 1445 1446 1447 1448 | /* ** Usage: sqlite3_mprintf_stronly FORMAT STRING ** ** Call mprintf with a single double argument which is the product of the ** two arguments given above. This is used to generate overflow and underflow ** doubles to test that they are converted properly. */ | | | 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 | /* ** Usage: sqlite3_mprintf_stronly FORMAT STRING ** ** Call mprintf with a single double argument which is the product of the ** two arguments given above. This is used to generate overflow and underflow ** doubles to test that they are converted properly. */ static int SQLITE_TCLAPI sqlite3_mprintf_stronly( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ char *z; if( argc!=3 ){ |
︙ | ︙ | |||
1466 1467 1468 1469 1470 1471 1472 | /* ** Usage: sqlite3_mprintf_hexdouble FORMAT HEX ** ** Call mprintf with a single double argument which is derived from the ** hexadecimal encoding of an IEEE double. */ | | | 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 | /* ** Usage: sqlite3_mprintf_hexdouble FORMAT HEX ** ** Call mprintf with a single double argument which is derived from the ** hexadecimal encoding of an IEEE double. */ static int SQLITE_TCLAPI sqlite3_mprintf_hexdouble( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ char *z; double r; |
︙ | ︙ | |||
1499 1500 1501 1502 1503 1504 1505 | } /* ** Usage: sqlite3_enable_shared_cache ?BOOLEAN? ** */ #if !defined(SQLITE_OMIT_SHARED_CACHE) | | | 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 | } /* ** Usage: sqlite3_enable_shared_cache ?BOOLEAN? ** */ #if !defined(SQLITE_OMIT_SHARED_CACHE) static int SQLITE_TCLAPI test_enable_shared( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int rc; int enable; |
︙ | ︙ | |||
1536 1537 1538 1539 1540 1541 1542 | /* ** Usage: sqlite3_extended_result_codes DB BOOLEAN ** */ | | | 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 | /* ** Usage: sqlite3_extended_result_codes DB BOOLEAN ** */ static int SQLITE_TCLAPI test_extended_result_codes( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int enable; sqlite3 *db; |
︙ | ︙ | |||
1559 1560 1561 1562 1563 1564 1565 | return TCL_OK; } /* ** Usage: sqlite3_libversion_number ** */ | | | | 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 | return TCL_OK; } /* ** Usage: sqlite3_libversion_number ** */ static int SQLITE_TCLAPI test_libversion_number( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_libversion_number())); return TCL_OK; } /* ** Usage: sqlite3_table_column_metadata DB dbname tblname colname ** */ static int SQLITE_TCLAPI test_table_column_metadata( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; const char *zDb; |
︙ | ︙ | |||
1624 1625 1626 1627 1628 1629 1630 | Tcl_SetObjResult(interp, pRet); return TCL_OK; } #ifndef SQLITE_OMIT_INCRBLOB | | | 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 | Tcl_SetObjResult(interp, pRet); return TCL_OK; } #ifndef SQLITE_OMIT_INCRBLOB static int SQLITE_TCLAPI blobHandleFromObj( Tcl_Interp *interp, Tcl_Obj *pObj, sqlite3_blob **ppBlob ){ char *z; int n; |
︙ | ︙ | |||
1653 1654 1655 1656 1657 1658 1659 | instanceData = Tcl_GetChannelInstanceData(channel); *ppBlob = *((sqlite3_blob **)instanceData); } return TCL_OK; } | | | 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 | instanceData = Tcl_GetChannelInstanceData(channel); *ppBlob = *((sqlite3_blob **)instanceData); } return TCL_OK; } static int SQLITE_TCLAPI test_blob_reopen( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ Tcl_WideInt iRowid; sqlite3_blob *pBlob; |
︙ | ︙ | |||
1729 1730 1731 1732 1733 1734 1735 | ){ Tcl_BackgroundError(p->interp); } Tcl_DecrRefCount(pScript); return iRes; } | | | 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 | ){ Tcl_BackgroundError(p->interp); } Tcl_DecrRefCount(pScript); return iRes; } static int SQLITE_TCLAPI test_create_collation_v2( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ TestCollationX *p; sqlite3 *db; |
︙ | ︙ | |||
1804 1805 1806 1807 1808 1809 1810 | if( p->pFunc ) Tcl_DecrRefCount(p->pFunc); if( p->pStep ) Tcl_DecrRefCount(p->pStep); if( p->pFinal ) Tcl_DecrRefCount(p->pFinal); if( p->pDestroy ) Tcl_DecrRefCount(p->pDestroy); sqlite3_free(p); } | | | 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 | if( p->pFunc ) Tcl_DecrRefCount(p->pFunc); if( p->pStep ) Tcl_DecrRefCount(p->pStep); if( p->pFinal ) Tcl_DecrRefCount(p->pFinal); if( p->pDestroy ) Tcl_DecrRefCount(p->pDestroy); sqlite3_free(p); } static int SQLITE_TCLAPI test_create_function_v2( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The invoking TCL interpreter */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; const char *zFunc; |
︙ | ︙ | |||
1892 1893 1894 1895 1896 1897 1898 | } return TCL_OK; } /* ** Usage: sqlite3_load_extension DB-HANDLE FILE ?PROC? */ | | | 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 | } return TCL_OK; } /* ** Usage: sqlite3_load_extension DB-HANDLE FILE ?PROC? */ static int SQLITE_TCLAPI test_load_extension( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ Tcl_CmdInfo cmdInfo; sqlite3 *db; |
︙ | ︙ | |||
1950 1951 1952 1953 1954 1955 1956 | return rc; } /* ** Usage: sqlite3_enable_load_extension DB-HANDLE ONOFF */ | | | 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 | return rc; } /* ** Usage: sqlite3_enable_load_extension DB-HANDLE ONOFF */ static int SQLITE_TCLAPI test_enable_load( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ Tcl_CmdInfo cmdInfo; sqlite3 *db; |
︙ | ︙ | |||
1996 1997 1998 1999 2000 2001 2002 | /* ** Usage: sqlite_abort ** ** Shutdown the process immediately. This is not a clean shutdown. ** This command is used to test the recoverability of a database in ** the event of a program crash. */ | | | 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 | /* ** Usage: sqlite_abort ** ** Shutdown the process immediately. This is not a clean shutdown. ** This command is used to test the recoverability of a database in ** the event of a program crash. */ static int SQLITE_TCLAPI sqlite_abort( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ #if defined(_MSC_VER) /* We do this, otherwise the test will halt with a popup message |
︙ | ︙ | |||
2055 2056 2057 2058 2059 2060 2061 | } /* ** Usage: sqlite_register_test_function DB NAME ** ** Register the test SQL function on the database DB under the name NAME. */ | | | 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 | } /* ** Usage: sqlite_register_test_function DB NAME ** ** Register the test SQL function on the database DB under the name NAME. */ static int SQLITE_TCLAPI test_register_func( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
2084 2085 2086 2087 2088 2089 2090 | } /* ** Usage: sqlite3_finalize STMT ** ** Finalize a statement handle. */ | | | 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 | } /* ** Usage: sqlite3_finalize STMT ** ** Finalize a statement handle. */ static int SQLITE_TCLAPI test_finalize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int rc; |
︙ | ︙ | |||
2116 2117 2118 2119 2120 2121 2122 | } /* ** Usage: sqlite3_stmt_status STMT CODE RESETFLAG ** ** Get the value of a status counter from a statement. */ | | | 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 | } /* ** Usage: sqlite3_stmt_status STMT CODE RESETFLAG ** ** Get the value of a status counter from a statement. */ static int SQLITE_TCLAPI test_stmt_status( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int iValue; int i, op = 0, resetFlag; |
︙ | ︙ | |||
2161 2162 2163 2164 2165 2166 2167 | return TCL_OK; } #ifdef SQLITE_ENABLE_STMT_SCANSTATUS /* ** Usage: sqlite3_stmt_scanstatus STMT IDX */ | | | 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 | return TCL_OK; } #ifdef SQLITE_ENABLE_STMT_SCANSTATUS /* ** Usage: sqlite3_stmt_scanstatus STMT IDX */ static int SQLITE_TCLAPI test_stmt_scanstatus( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; /* First argument */ int idx; /* Second argument */ |
︙ | ︙ | |||
2211 2212 2213 2214 2215 2216 2217 | } return TCL_OK; } /* ** Usage: sqlite3_stmt_scanstatus_reset STMT */ | | | 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 | } return TCL_OK; } /* ** Usage: sqlite3_stmt_scanstatus_reset STMT */ static int SQLITE_TCLAPI test_stmt_scanstatus_reset( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; /* First argument */ if( objc!=2 ){ |
︙ | ︙ | |||
2234 2235 2236 2237 2238 2239 2240 | #ifdef SQLITE_ENABLE_SQLLOG /* ** Usage: sqlite3_config_sqllog ** ** Zero the SQLITE_CONFIG_SQLLOG configuration */ | | | | | 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 | #ifdef SQLITE_ENABLE_SQLLOG /* ** Usage: sqlite3_config_sqllog ** ** Zero the SQLITE_CONFIG_SQLLOG configuration */ static int SQLITE_TCLAPI test_config_sqllog( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ if( objc!=1 ){ Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } sqlite3_config(SQLITE_CONFIG_SQLLOG, 0, 0); return TCL_OK; } #endif /* ** Usage: vfs_current_time_int64 ** ** Return the value returned by the default VFS's xCurrentTimeInt64 method. */ static int SQLITE_TCLAPI vfsCurrentTimeInt64( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ i64 t; sqlite3_vfs *pVfs = sqlite3_vfs_find(0); if( objc!=1 ){ Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } pVfs->xCurrentTimeInt64(pVfs, &t); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(t)); return TCL_OK; } #ifdef SQLITE_ENABLE_SNAPSHOT /* ** Usage: sqlite3_snapshot_get DB DBNAME */ static int SQLITE_TCLAPI test_snapshot_get( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; sqlite3 *db; |
︙ | ︙ | |||
2310 2311 2312 2313 2314 2315 2316 | } #endif /* SQLITE_ENABLE_SNAPSHOT */ #ifdef SQLITE_ENABLE_SNAPSHOT /* ** Usage: sqlite3_snapshot_open DB DBNAME SNAPSHOT */ | | | 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 | } #endif /* SQLITE_ENABLE_SNAPSHOT */ #ifdef SQLITE_ENABLE_SNAPSHOT /* ** Usage: sqlite3_snapshot_open DB DBNAME SNAPSHOT */ static int SQLITE_TCLAPI test_snapshot_open( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; sqlite3 *db; |
︙ | ︙ | |||
2342 2343 2344 2345 2346 2347 2348 | } #endif /* SQLITE_ENABLE_SNAPSHOT */ #ifdef SQLITE_ENABLE_SNAPSHOT /* ** Usage: sqlite3_snapshot_free SNAPSHOT */ | | | | 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 | } #endif /* SQLITE_ENABLE_SNAPSHOT */ #ifdef SQLITE_ENABLE_SNAPSHOT /* ** Usage: sqlite3_snapshot_free SNAPSHOT */ static int SQLITE_TCLAPI test_snapshot_free( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_snapshot *pSnapshot; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "SNAPSHOT"); return TCL_ERROR; } pSnapshot = (sqlite3_snapshot*)sqlite3TestTextToPtr(Tcl_GetString(objv[1])); sqlite3_snapshot_free(pSnapshot); return TCL_OK; } #endif /* SQLITE_ENABLE_SNAPSHOT */ #ifdef SQLITE_ENABLE_SNAPSHOT /* ** Usage: sqlite3_snapshot_cmp SNAPSHOT1 SNAPSHOT2 */ static int SQLITE_TCLAPI test_snapshot_cmp( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int res; sqlite3_snapshot *p1; |
︙ | ︙ | |||
2389 2390 2391 2392 2393 2394 2395 | #endif /* SQLITE_ENABLE_SNAPSHOT */ /* ** Usage: sqlite3_next_stmt DB STMT ** ** Return the next statment in sequence after STMT. */ | | | 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 | #endif /* SQLITE_ENABLE_SNAPSHOT */ /* ** Usage: sqlite3_next_stmt DB STMT ** ** Return the next statment in sequence after STMT. */ static int SQLITE_TCLAPI test_next_stmt( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; sqlite3 *db = 0; |
︙ | ︙ | |||
2421 2422 2423 2424 2425 2426 2427 | /* ** Usage: sqlite3_stmt_readonly STMT ** ** Return true if STMT is a NULL pointer or a pointer to a statement ** that is guaranteed to leave the database unmodified. */ | | | 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 | /* ** Usage: sqlite3_stmt_readonly STMT ** ** Return true if STMT is a NULL pointer or a pointer to a statement ** that is guaranteed to leave the database unmodified. */ static int SQLITE_TCLAPI test_stmt_readonly( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int rc; |
︙ | ︙ | |||
2448 2449 2450 2451 2452 2453 2454 | /* ** Usage: sqlite3_stmt_busy STMT ** ** Return true if STMT is a non-NULL pointer to a statement ** that has been stepped but not to completion. */ | | | 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 | /* ** Usage: sqlite3_stmt_busy STMT ** ** Return true if STMT is a non-NULL pointer to a statement ** that has been stepped but not to completion. */ static int SQLITE_TCLAPI test_stmt_busy( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int rc; |
︙ | ︙ | |||
2474 2475 2476 2477 2478 2479 2480 | } /* ** Usage: uses_stmt_journal STMT ** ** Return true if STMT uses a statement journal. */ | | | 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 | } /* ** Usage: uses_stmt_journal STMT ** ** Return true if STMT uses a statement journal. */ static int SQLITE_TCLAPI uses_stmt_journal( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; |
︙ | ︙ | |||
2500 2501 2502 2503 2504 2505 2506 | /* ** Usage: sqlite3_reset STMT ** ** Reset a statement handle. */ | | | 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 | /* ** Usage: sqlite3_reset STMT ** ** Reset a statement handle. */ static int SQLITE_TCLAPI test_reset( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int rc; |
︙ | ︙ | |||
2535 2536 2537 2538 2539 2540 2541 | } /* ** Usage: sqlite3_expired STMT ** ** Return TRUE if a recompilation of the statement is recommended. */ | | | 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 | } /* ** Usage: sqlite3_expired STMT ** ** Return TRUE if a recompilation of the statement is recommended. */ static int SQLITE_TCLAPI test_expired( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_DEPRECATED sqlite3_stmt *pStmt; |
︙ | ︙ | |||
2559 2560 2561 2562 2563 2564 2565 | } /* ** Usage: sqlite3_transfer_bindings FROMSTMT TOSTMT ** ** Transfer all bindings from FROMSTMT over to TOSTMT */ | | | 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 | } /* ** Usage: sqlite3_transfer_bindings FROMSTMT TOSTMT ** ** Transfer all bindings from FROMSTMT over to TOSTMT */ static int SQLITE_TCLAPI test_transfer_bind( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_DEPRECATED sqlite3_stmt *pStmt1, *pStmt2; |
︙ | ︙ | |||
2586 2587 2588 2589 2590 2591 2592 | /* ** Usage: sqlite3_changes DB ** ** Return the number of changes made to the database by the last SQL ** execution. */ | | | 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 | /* ** Usage: sqlite3_changes DB ** ** Return the number of changes made to the database by the last SQL ** execution. */ static int SQLITE_TCLAPI test_changes( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; if( objc!=2 ){ |
︙ | ︙ | |||
2621 2622 2623 2624 2625 2626 2627 | ** string. VALUE is the new value. If FLAGS=="null" then VALUE is ** ignored and the value is set to NULL. If FLAGS=="static" then ** the value is set to the value of a static variable named ** "sqlite_static_bind_value". If FLAGS=="normal" then a copy ** of the VALUE is made. If FLAGS=="blob10" then a VALUE is ignored ** an a 10-byte blob "abc\000xyz\000pq" is inserted. */ | | | 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 | ** string. VALUE is the new value. If FLAGS=="null" then VALUE is ** ignored and the value is set to NULL. If FLAGS=="static" then ** the value is set to the value of a static variable named ** "sqlite_static_bind_value". If FLAGS=="normal" then a copy ** of the VALUE is made. If FLAGS=="blob10" then a VALUE is ignored ** an a 10-byte blob "abc\000xyz\000pq" is inserted. */ static int SQLITE_TCLAPI test_bind( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ sqlite3_stmt *pStmt; int rc; |
︙ | ︙ | |||
2743 2744 2745 2746 2747 2748 2749 | sqlite3EndBenignMalloc(); Tcl_EvalObjEx(i, pX, 0); Tcl_DecrRefCount(pX); Tcl_GetIntFromObj(i, Tcl_GetObjResult(i), &res); return res; } | | | 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 | sqlite3EndBenignMalloc(); Tcl_EvalObjEx(i, pX, 0); Tcl_DecrRefCount(pX); Tcl_GetIntFromObj(i, Tcl_GetObjResult(i), &res); return res; } static int SQLITE_TCLAPI test_collate( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; int val; |
︙ | ︙ | |||
2817 2818 2819 2820 2821 2822 2823 | int nB, const void *zB ){ int nCmp = (nA>nB ? nB : nA); int res = memcmp(zA, zB, nCmp); if( res==0 ) res = nA - nB; return res; } | | | 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 | int nB, const void *zB ){ int nCmp = (nA>nB ? nB : nA); int res = memcmp(zA, zB, nCmp); if( res==0 ) res = nA - nB; return res; } static int SQLITE_TCLAPI test_utf16bin_collate( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
2874 2875 2876 2877 2878 2879 2880 | sqlite3_create_collation( db, "test_collate", ENC(db), SQLITE_INT_TO_PTR(enc), test_collate_func); } /* ** Usage: add_test_collate_needed DB */ | | | 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 | sqlite3_create_collation( db, "test_collate", ENC(db), SQLITE_INT_TO_PTR(enc), test_collate_func); } /* ** Usage: add_test_collate_needed DB */ static int SQLITE_TCLAPI test_collate_needed( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
2925 2926 2927 2928 2929 2930 2931 | if( nKey2>0 && 1==(1&(SQLITE_PTR_TO_INT(pKey2))) ) unaligned_string_counter++; rc = memcmp(pKey1, pKey2, n); if( rc==0 ){ rc = nKey1 - nKey2; } return rc; } | | | 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 | if( nKey2>0 && 1==(1&(SQLITE_PTR_TO_INT(pKey2))) ) unaligned_string_counter++; rc = memcmp(pKey1, pKey2, n); if( rc==0 ){ rc = nKey1 - nKey2; } return rc; } static int SQLITE_TCLAPI add_alignment_test_collations( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; if( objc>=2 ){ |
︙ | ︙ | |||
3043 3044 3045 3046 3047 3048 3049 | sqlite3_result_text16be(pCtx, sqlite3_value_text16le(pVal), -1, SQLITE_TRANSIENT); sqlite3_result_text16le(pCtx, sqlite3_value_text16le(pVal), -1, SQLITE_TRANSIENT); sqlite3ValueFree(pVal); } #endif /* SQLITE_OMIT_UTF16 */ | | | 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 | sqlite3_result_text16be(pCtx, sqlite3_value_text16le(pVal), -1, SQLITE_TRANSIENT); sqlite3_result_text16le(pCtx, sqlite3_value_text16le(pVal), -1, SQLITE_TRANSIENT); sqlite3ValueFree(pVal); } #endif /* SQLITE_OMIT_UTF16 */ static int SQLITE_TCLAPI test_function( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_UTF16 sqlite3 *db; |
︙ | ︙ | |||
3088 3089 3090 3091 3092 3093 3094 | ** Usage: sqlite3_test_errstr <err code> ** ** Test that the english language string equivalents for sqlite error codes ** are sane. The parameter is an integer representing an sqlite error code. ** The result is a list of two elements, the string representation of the ** error code and the english language explanation. */ | | | 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 | ** Usage: sqlite3_test_errstr <err code> ** ** Test that the english language string equivalents for sqlite error codes ** are sane. The parameter is an integer representing an sqlite error code. ** The result is a list of two elements, the string representation of the ** error code and the english language explanation. */ static int SQLITE_TCLAPI test_errstr( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ char *zCode; int i; |
︙ | ︙ | |||
3121 3122 3123 3124 3125 3126 3127 | ** In the TCL test script, we can add code like this: ** ** if {$i==1485} breakpoint ** ** Then run testfixture in the debugger and wait for the breakpoint to ** fire. Then additional breakpoints can be set to trace down the bug. */ | | | | 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 | ** In the TCL test script, we can add code like this: ** ** if {$i==1485} breakpoint ** ** Then run testfixture in the debugger and wait for the breakpoint to ** fire. Then additional breakpoints can be set to trace down the bug. */ static int SQLITE_TCLAPI test_breakpoint( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ return TCL_OK; /* Do nothing */ } /* ** Usage: sqlite3_bind_zeroblob STMT IDX N ** ** Test the sqlite3_bind_zeroblob interface. STMT is a prepared statement. ** IDX is the index of a wildcard in the prepared statement. This command ** binds a N-byte zero-filled BLOB to the wildcard. */ static int SQLITE_TCLAPI test_bind_zeroblob( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int idx; |
︙ | ︙ | |||
3173 3174 3175 3176 3177 3178 3179 | /* ** Usage: sqlite3_bind_zeroblob64 STMT IDX N ** ** Test the sqlite3_bind_zeroblob64 interface. STMT is a prepared statement. ** IDX is the index of a wildcard in the prepared statement. This command ** binds a N-byte zero-filled BLOB to the wildcard. */ | | | 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 | /* ** Usage: sqlite3_bind_zeroblob64 STMT IDX N ** ** Test the sqlite3_bind_zeroblob64 interface. STMT is a prepared statement. ** IDX is the index of a wildcard in the prepared statement. This command ** binds a N-byte zero-filled BLOB to the wildcard. */ static int SQLITE_TCLAPI test_bind_zeroblob64( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int idx; |
︙ | ︙ | |||
3210 3211 3212 3213 3214 3215 3216 | /* ** Usage: sqlite3_bind_int STMT N VALUE ** ** Test the sqlite3_bind_int interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a 32-bit integer VALUE to that wildcard. */ | | | 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 | /* ** Usage: sqlite3_bind_int STMT N VALUE ** ** Test the sqlite3_bind_int interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a 32-bit integer VALUE to that wildcard. */ static int SQLITE_TCLAPI test_bind_int( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int idx; |
︙ | ︙ | |||
3250 3251 3252 3253 3254 3255 3256 | ** ** Return the address of a C-language array of 32-bit integers. ** ** Space to hold the array is obtained from malloc(). Call this procedure once ** with no arguments in order to release memory. Each call to this procedure ** overwrites the previous array. */ | | | 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 | ** ** Return the address of a C-language array of 32-bit integers. ** ** Space to hold the array is obtained from malloc(). Call this procedure once ** with no arguments in order to release memory. Each call to this procedure ** overwrites the previous array. */ static int SQLITE_TCLAPI test_intarray_addr( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int i; static int *p = 0; |
︙ | ︙ | |||
3284 3285 3286 3287 3288 3289 3290 | ** ** Return the address of a C-language array of 32-bit integers. ** ** Space to hold the array is obtained from malloc(). Call this procedure once ** with no arguments in order to release memory. Each call to this procedure ** overwrites the previous array. */ | | | 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 | ** ** Return the address of a C-language array of 32-bit integers. ** ** Space to hold the array is obtained from malloc(). Call this procedure once ** with no arguments in order to release memory. Each call to this procedure ** overwrites the previous array. */ static int SQLITE_TCLAPI test_int64array_addr( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int i; static sqlite3_int64 *p = 0; |
︙ | ︙ | |||
3320 3321 3322 3323 3324 3325 3326 | ** ** Return the address of a C-language array of doubles. ** ** Space to hold the array is obtained from malloc(). Call this procedure once ** with no arguments in order to release memory. Each call to this procedure ** overwrites the previous array. */ | | | 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 | ** ** Return the address of a C-language array of doubles. ** ** Space to hold the array is obtained from malloc(). Call this procedure once ** with no arguments in order to release memory. Each call to this procedure ** overwrites the previous array. */ static int SQLITE_TCLAPI test_doublearray_addr( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int i; static double *p = 0; |
︙ | ︙ | |||
3354 3355 3356 3357 3358 3359 3360 | ** ** Return the address of a C-language array of strings. ** ** Space to hold the array is obtained from malloc(). Call this procedure once ** with no arguments in order to release memory. Each call to this procedure ** overwrites the previous array. */ | | | 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 | ** ** Return the address of a C-language array of strings. ** ** Space to hold the array is obtained from malloc(). Call this procedure once ** with no arguments in order to release memory. Each call to this procedure ** overwrites the previous array. */ static int SQLITE_TCLAPI test_textarray_addr( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int i; static int n = 0; |
︙ | ︙ | |||
3387 3388 3389 3390 3391 3392 3393 | /* ** Usage: sqlite3_bind_int64 STMT N VALUE ** ** Test the sqlite3_bind_int64 interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a 64-bit integer VALUE to that wildcard. */ | | | 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 | /* ** Usage: sqlite3_bind_int64 STMT N VALUE ** ** Test the sqlite3_bind_int64 interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a 64-bit integer VALUE to that wildcard. */ static int SQLITE_TCLAPI test_bind_int64( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int idx; |
︙ | ︙ | |||
3425 3426 3427 3428 3429 3430 3431 | /* ** Usage: sqlite3_bind_double STMT N VALUE ** ** Test the sqlite3_bind_double interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a 64-bit integer VALUE to that wildcard. */ | | | 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 | /* ** Usage: sqlite3_bind_double STMT N VALUE ** ** Test the sqlite3_bind_double interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a 64-bit integer VALUE to that wildcard. */ static int SQLITE_TCLAPI test_bind_double( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int idx; |
︙ | ︙ | |||
3501 3502 3503 3504 3505 3506 3507 | /* ** Usage: sqlite3_bind_null STMT N ** ** Test the sqlite3_bind_null interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a NULL to the wildcard. */ | | | 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 | /* ** Usage: sqlite3_bind_null STMT N ** ** Test the sqlite3_bind_null interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a NULL to the wildcard. */ static int SQLITE_TCLAPI test_bind_null( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int idx; |
︙ | ︙ | |||
3537 3538 3539 3540 3541 3542 3543 | ** Usage: sqlite3_bind_text STMT N STRING BYTES ** ** Test the sqlite3_bind_text interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a UTF-8 string STRING to the wildcard. The string is BYTES bytes ** long. */ | | | 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 | ** Usage: sqlite3_bind_text STMT N STRING BYTES ** ** Test the sqlite3_bind_text interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a UTF-8 string STRING to the wildcard. The string is BYTES bytes ** long. */ static int SQLITE_TCLAPI test_bind_text( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int idx; |
︙ | ︙ | |||
3578 3579 3580 3581 3582 3583 3584 | ** Usage: sqlite3_bind_text16 ?-static? STMT N STRING BYTES ** ** Test the sqlite3_bind_text16 interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a UTF-16 string STRING to the wildcard. The string is BYTES bytes ** long. */ | | | 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 | ** Usage: sqlite3_bind_text16 ?-static? STMT N STRING BYTES ** ** Test the sqlite3_bind_text16 interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a UTF-16 string STRING to the wildcard. The string is BYTES bytes ** long. */ static int SQLITE_TCLAPI test_bind_text16( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_UTF16 sqlite3_stmt *pStmt; |
︙ | ︙ | |||
3626 3627 3628 3629 3630 3631 3632 | /* ** Usage: sqlite3_bind_blob ?-static? STMT N DATA BYTES ** ** Test the sqlite3_bind_blob interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a BLOB to the wildcard. The BLOB is BYTES bytes in size. */ | | | 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 | /* ** Usage: sqlite3_bind_blob ?-static? STMT N DATA BYTES ** ** Test the sqlite3_bind_blob interface. STMT is a prepared statement. ** N is the index of a wildcard in the prepared statement. This command ** binds a BLOB to the wildcard. The BLOB is BYTES bytes in size. */ static int SQLITE_TCLAPI test_bind_blob( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int len, idx; |
︙ | ︙ | |||
3678 3679 3680 3681 3682 3683 3684 | } /* ** Usage: sqlite3_bind_parameter_count STMT ** ** Return the number of wildcards in the given statement. */ | | | 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 | } /* ** Usage: sqlite3_bind_parameter_count STMT ** ** Return the number of wildcards in the given statement. */ static int SQLITE_TCLAPI test_bind_parameter_count( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; |
︙ | ︙ | |||
3702 3703 3704 3705 3706 3707 3708 | /* ** Usage: sqlite3_bind_parameter_name STMT N ** ** Return the name of the Nth wildcard. The first wildcard is 1. ** An empty string is returned if N is out of range or if the wildcard ** is nameless. */ | | | 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 | /* ** Usage: sqlite3_bind_parameter_name STMT N ** ** Return the name of the Nth wildcard. The first wildcard is 1. ** An empty string is returned if N is out of range or if the wildcard ** is nameless. */ static int SQLITE_TCLAPI test_bind_parameter_name( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int i; |
︙ | ︙ | |||
3729 3730 3731 3732 3733 3734 3735 | /* ** Usage: sqlite3_bind_parameter_index STMT NAME ** ** Return the index of the wildcard called NAME. Return 0 if there is ** no such wildcard. */ | | | 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 | /* ** Usage: sqlite3_bind_parameter_index STMT NAME ** ** Return the index of the wildcard called NAME. Return 0 if there is ** no such wildcard. */ static int SQLITE_TCLAPI test_bind_parameter_index( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; |
︙ | ︙ | |||
3754 3755 3756 3757 3758 3759 3760 | return TCL_OK; } /* ** Usage: sqlite3_clear_bindings STMT ** */ | | | | 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 | return TCL_OK; } /* ** Usage: sqlite3_clear_bindings STMT ** */ static int SQLITE_TCLAPI test_clear_bindings( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "STMT"); return TCL_ERROR; } if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR; Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_clear_bindings(pStmt))); return TCL_OK; } /* ** Usage: sqlite3_sleep MILLISECONDS */ static int SQLITE_TCLAPI test_sleep( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int ms; |
︙ | ︙ | |||
3799 3800 3801 3802 3803 3804 3805 | /* ** Usage: sqlite3_extended_errcode DB ** ** Return the string representation of the most recent sqlite3_* API ** error code. e.g. "SQLITE_ERROR". */ | | | 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 | /* ** Usage: sqlite3_extended_errcode DB ** ** Return the string representation of the most recent sqlite3_* API ** error code. e.g. "SQLITE_ERROR". */ static int SQLITE_TCLAPI test_ex_errcode( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
3826 3827 3828 3829 3830 3831 3832 | /* ** Usage: sqlite3_errcode DB ** ** Return the string representation of the most recent sqlite3_* API ** error code. e.g. "SQLITE_ERROR". */ | | | 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 | /* ** Usage: sqlite3_errcode DB ** ** Return the string representation of the most recent sqlite3_* API ** error code. e.g. "SQLITE_ERROR". */ static int SQLITE_TCLAPI test_errcode( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
3852 3853 3854 3855 3856 3857 3858 | /* ** Usage: sqlite3_errmsg DB ** ** Returns the UTF-8 representation of the error message string for the ** most recent sqlite3_* API call. */ | | | 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 | /* ** Usage: sqlite3_errmsg DB ** ** Returns the UTF-8 representation of the error message string for the ** most recent sqlite3_* API call. */ static int SQLITE_TCLAPI test_errmsg( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; const char *zErr; |
︙ | ︙ | |||
3881 3882 3883 3884 3885 3886 3887 | ** Usage: test_errmsg16 DB ** ** Returns the UTF-16 representation of the error message string for the ** most recent sqlite3_* API call. This is a byte array object at the TCL ** level, and it includes the 0x00 0x00 terminator bytes at the end of the ** UTF-16 string. */ | | | 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 | ** Usage: test_errmsg16 DB ** ** Returns the UTF-16 representation of the error message string for the ** most recent sqlite3_* API call. This is a byte array object at the TCL ** level, and it includes the 0x00 0x00 terminator bytes at the end of the ** UTF-16 string. */ static int SQLITE_TCLAPI test_errmsg16( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_UTF16 sqlite3 *db; |
︙ | ︙ | |||
3918 3919 3920 3921 3922 3923 3924 | ** Usage: sqlite3_prepare DB sql bytes ?tailvar? ** ** Compile up to <bytes> bytes of the supplied SQL string <sql> using ** database handle <DB>. The parameter <tailval> is the name of a global ** variable that is set to the unused portion of <sql> (if any). A ** STMT handle is returned. */ | | | 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 | ** Usage: sqlite3_prepare DB sql bytes ?tailvar? ** ** Compile up to <bytes> bytes of the supplied SQL string <sql> using ** database handle <DB>. The parameter <tailval> is the name of a global ** variable that is set to the unused portion of <sql> (if any). A ** STMT handle is returned. */ static int SQLITE_TCLAPI test_prepare( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; const char *zSql; |
︙ | ︙ | |||
3975 3976 3977 3978 3979 3980 3981 | ** Usage: sqlite3_prepare_v2 DB sql bytes ?tailvar? ** ** Compile up to <bytes> bytes of the supplied SQL string <sql> using ** database handle <DB>. The parameter <tailval> is the name of a global ** variable that is set to the unused portion of <sql> (if any). A ** STMT handle is returned. */ | | | 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 | ** Usage: sqlite3_prepare_v2 DB sql bytes ?tailvar? ** ** Compile up to <bytes> bytes of the supplied SQL string <sql> using ** database handle <DB>. The parameter <tailval> is the name of a global ** variable that is set to the unused portion of <sql> (if any). A ** STMT handle is returned. */ static int SQLITE_TCLAPI test_prepare_v2( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; const char *zSql; |
︙ | ︙ | |||
4043 4044 4045 4046 4047 4048 4049 | /* ** Usage: sqlite3_prepare_tkt3134 DB ** ** Generate a prepared statement for a zero-byte string as a test ** for ticket #3134. The string should be preceded by a zero byte. */ | | | 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 | /* ** Usage: sqlite3_prepare_tkt3134 DB ** ** Generate a prepared statement for a zero-byte string as a test ** for ticket #3134. The string should be preceded by a zero byte. */ static int SQLITE_TCLAPI test_prepare_tkt3134( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; static const char zSql[] = "\000SELECT 1"; |
︙ | ︙ | |||
4086 4087 4088 4089 4090 4091 4092 | ** Usage: sqlite3_prepare16 DB sql bytes tailvar ** ** Compile up to <bytes> bytes of the supplied SQL string <sql> using ** database handle <DB>. The parameter <tailval> is the name of a global ** variable that is set to the unused portion of <sql> (if any). A ** STMT handle is returned. */ | | | 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 | ** Usage: sqlite3_prepare16 DB sql bytes tailvar ** ** Compile up to <bytes> bytes of the supplied SQL string <sql> using ** database handle <DB>. The parameter <tailval> is the name of a global ** variable that is set to the unused portion of <sql> (if any). A ** STMT handle is returned. */ static int SQLITE_TCLAPI test_prepare16( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_UTF16 sqlite3 *db; |
︙ | ︙ | |||
4146 4147 4148 4149 4150 4151 4152 | ** Usage: sqlite3_prepare16_v2 DB sql bytes ?tailvar? ** ** Compile up to <bytes> bytes of the supplied SQL string <sql> using ** database handle <DB>. The parameter <tailval> is the name of a global ** variable that is set to the unused portion of <sql> (if any). A ** STMT handle is returned. */ | | | 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 | ** Usage: sqlite3_prepare16_v2 DB sql bytes ?tailvar? ** ** Compile up to <bytes> bytes of the supplied SQL string <sql> using ** database handle <DB>. The parameter <tailval> is the name of a global ** variable that is set to the unused portion of <sql> (if any). A ** STMT handle is returned. */ static int SQLITE_TCLAPI test_prepare16_v2( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_UTF16 sqlite3 *db; |
︙ | ︙ | |||
4201 4202 4203 4204 4205 4206 4207 | #endif /* SQLITE_OMIT_UTF16 */ return TCL_OK; } /* ** Usage: sqlite3_open filename ?options-list? */ | | | 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 | #endif /* SQLITE_OMIT_UTF16 */ return TCL_OK; } /* ** Usage: sqlite3_open filename ?options-list? */ static int SQLITE_TCLAPI test_open( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zFilename; sqlite3 *db; |
︙ | ︙ | |||
4228 4229 4230 4231 4232 4233 4234 | Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; } /* ** Usage: sqlite3_open_v2 FILENAME FLAGS VFS */ | | | 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 | Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; } /* ** Usage: sqlite3_open_v2 FILENAME FLAGS VFS */ static int SQLITE_TCLAPI test_open_v2( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zFilename; const char *zVfs; |
︙ | ︙ | |||
4298 4299 4300 4301 4302 4303 4304 | Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; } /* ** Usage: sqlite3_open16 filename options */ | | | 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 | Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; } /* ** Usage: sqlite3_open16 filename options */ static int SQLITE_TCLAPI test_open16( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_UTF16 const void *zFilename; |
︙ | ︙ | |||
4330 4331 4332 4333 4334 4335 4336 | /* ** Usage: sqlite3_complete16 <UTF-16 string> ** ** Return 1 if the supplied argument is a complete SQL statement, or zero ** otherwise. */ | | | 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 | /* ** Usage: sqlite3_complete16 <UTF-16 string> ** ** Return 1 if the supplied argument is a complete SQL statement, or zero ** otherwise. */ static int SQLITE_TCLAPI test_complete16( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #if !defined(SQLITE_OMIT_COMPLETE) && !defined(SQLITE_OMIT_UTF16) char *zBuf; |
︙ | ︙ | |||
4355 4356 4357 4358 4359 4360 4361 | } /* ** Usage: sqlite3_step STMT ** ** Advance the statement to the next row. */ | | | 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 | } /* ** Usage: sqlite3_step STMT ** ** Advance the statement to the next row. */ static int SQLITE_TCLAPI test_step( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int rc; |
︙ | ︙ | |||
4378 4379 4380 4381 4382 4383 4384 | rc = sqlite3_step(pStmt); /* if( rc!=SQLITE_DONE && rc!=SQLITE_ROW ) return TCL_ERROR; */ Tcl_SetResult(interp, (char *)t1ErrorName(rc), 0); return TCL_OK; } | | | | 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 | rc = sqlite3_step(pStmt); /* if( rc!=SQLITE_DONE && rc!=SQLITE_ROW ) return TCL_ERROR; */ Tcl_SetResult(interp, (char *)t1ErrorName(rc), 0); return TCL_OK; } static int SQLITE_TCLAPI test_sql( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "STMT"); return TCL_ERROR; } if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR; Tcl_SetResult(interp, (char *)sqlite3_sql(pStmt), TCL_VOLATILE); return TCL_OK; } static int SQLITE_TCLAPI test_ex_sql( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; char *z; |
︙ | ︙ | |||
4421 4422 4423 4424 4425 4426 4427 | } /* ** Usage: sqlite3_column_count STMT ** ** Return the number of columns returned by the sql statement STMT. */ | | | 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 | } /* ** Usage: sqlite3_column_count STMT ** ** Return the number of columns returned by the sql statement STMT. */ static int SQLITE_TCLAPI test_column_count( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; |
︙ | ︙ | |||
4446 4447 4448 4449 4450 4451 4452 | } /* ** Usage: sqlite3_column_type STMT column ** ** Return the type of the data in column 'column' of the current row. */ | | | 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 | } /* ** Usage: sqlite3_column_type STMT column ** ** Return the type of the data in column 'column' of the current row. */ static int SQLITE_TCLAPI test_column_type( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int col; |
︙ | ︙ | |||
4495 4496 4497 4498 4499 4500 4501 | /* ** Usage: sqlite3_column_int64 STMT column ** ** Return the data in column 'column' of the current row cast as an ** wide (64-bit) integer. */ | | | 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 | /* ** Usage: sqlite3_column_int64 STMT column ** ** Return the data in column 'column' of the current row cast as an ** wide (64-bit) integer. */ static int SQLITE_TCLAPI test_column_int64( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int col; |
︙ | ︙ | |||
4522 4523 4524 4525 4526 4527 4528 | Tcl_SetObjResult(interp, Tcl_NewWideIntObj(iVal)); return TCL_OK; } /* ** Usage: sqlite3_column_blob STMT column */ | | | 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 | Tcl_SetObjResult(interp, Tcl_NewWideIntObj(iVal)); return TCL_OK; } /* ** Usage: sqlite3_column_blob STMT column */ static int SQLITE_TCLAPI test_column_blob( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int col; |
︙ | ︙ | |||
4554 4555 4556 4557 4558 4559 4560 | } /* ** Usage: sqlite3_column_double STMT column ** ** Return the data in column 'column' of the current row cast as a double. */ | | | 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 | } /* ** Usage: sqlite3_column_double STMT column ** ** Return the data in column 'column' of the current row cast as a double. */ static int SQLITE_TCLAPI test_column_double( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int col; |
︙ | ︙ | |||
4583 4584 4585 4586 4587 4588 4589 | } /* ** Usage: sqlite3_data_count STMT ** ** Return the number of columns returned by the sql statement STMT. */ | | | 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 | } /* ** Usage: sqlite3_data_count STMT ** ** Return the number of columns returned by the sql statement STMT. */ static int SQLITE_TCLAPI test_data_count( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; |
︙ | ︙ | |||
4610 4611 4612 4613 4614 4615 4616 | /* ** Usage: sqlite3_column_text STMT column ** ** Usage: sqlite3_column_decltype STMT column ** ** Usage: sqlite3_column_name STMT column */ | | | 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 | /* ** Usage: sqlite3_column_text STMT column ** ** Usage: sqlite3_column_decltype STMT column ** ** Usage: sqlite3_column_name STMT column */ static int SQLITE_TCLAPI test_stmt_utf8( void * clientData, /* Pointer to SQLite API function to be invoke */ Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int col; |
︙ | ︙ | |||
4637 4638 4639 4640 4641 4642 4643 | zRet = xFunc(pStmt, col); if( zRet ){ Tcl_SetResult(interp, (char *)zRet, 0); } return TCL_OK; } | | | 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 | zRet = xFunc(pStmt, col); if( zRet ){ Tcl_SetResult(interp, (char *)zRet, 0); } return TCL_OK; } static int SQLITE_TCLAPI test_global_recover( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_DEPRECATED int rc; |
︙ | ︙ | |||
4662 4663 4664 4665 4666 4667 4668 | /* ** Usage: sqlite3_column_text STMT column ** ** Usage: sqlite3_column_decltype STMT column ** ** Usage: sqlite3_column_name STMT column */ | | | 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 | /* ** Usage: sqlite3_column_text STMT column ** ** Usage: sqlite3_column_decltype STMT column ** ** Usage: sqlite3_column_name STMT column */ static int SQLITE_TCLAPI test_stmt_utf16( void * clientData, /* Pointer to SQLite API function to be invoked */ Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_UTF16 sqlite3_stmt *pStmt; |
︙ | ︙ | |||
4706 4707 4708 4709 4710 4711 4712 | ** Usage: sqlite3_column_int STMT column ** ** Usage: sqlite3_column_bytes STMT column ** ** Usage: sqlite3_column_bytes16 STMT column ** */ | | | 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 | ** Usage: sqlite3_column_int STMT column ** ** Usage: sqlite3_column_bytes STMT column ** ** Usage: sqlite3_column_bytes16 STMT column ** */ static int SQLITE_TCLAPI test_stmt_int( void * clientData, /* Pointer to SQLite API function to be invoked */ Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; int col; |
︙ | ︙ | |||
4735 4736 4737 4738 4739 4740 4741 | } /* ** Usage: sqlite_set_magic DB MAGIC-NUMBER ** ** Set the db->magic value. This is used to test error recovery logic. */ | | | 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 | } /* ** Usage: sqlite_set_magic DB MAGIC-NUMBER ** ** Set the db->magic value. This is used to test error recovery logic. */ static int SQLITE_TCLAPI sqlite_set_magic( void * clientData, Tcl_Interp *interp, int argc, char **argv ){ sqlite3 *db; if( argc!=3 ){ |
︙ | ︙ | |||
4767 4768 4769 4770 4771 4772 4773 | } /* ** Usage: sqlite3_interrupt DB ** ** Trigger an interrupt on DB */ | | | 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 | } /* ** Usage: sqlite3_interrupt DB ** ** Trigger an interrupt on DB */ static int SQLITE_TCLAPI test_interrupt( void * clientData, Tcl_Interp *interp, int argc, char **argv ){ sqlite3 *db; if( argc!=2 ){ |
︙ | ︙ | |||
4808 4809 4810 4811 4812 4813 4814 | } /* ** Usage: sqlite3_stack_used DB SQL ** ** Try to measure the amount of stack space used by a call to sqlite3_exec */ | | | 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 | } /* ** Usage: sqlite3_stack_used DB SQL ** ** Try to measure the amount of stack space used by a call to sqlite3_exec */ static int SQLITE_TCLAPI test_stack_used( void * clientData, Tcl_Interp *interp, int argc, char **argv ){ sqlite3 *db; int i; |
︙ | ︙ | |||
4836 4837 4838 4839 4840 4841 4842 | /* ** Usage: sqlite_delete_function DB function-name ** ** Delete the user function 'function-name' from database handle DB. It ** is assumed that the user function was created as UTF8, any number of ** arguments (the way the TCL interface does it). */ | | | 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 | /* ** Usage: sqlite_delete_function DB function-name ** ** Delete the user function 'function-name' from database handle DB. It ** is assumed that the user function was created as UTF8, any number of ** arguments (the way the TCL interface does it). */ static int SQLITE_TCLAPI delete_function( void * clientData, Tcl_Interp *interp, int argc, char **argv ){ int rc; sqlite3 *db; |
︙ | ︙ | |||
4862 4863 4864 4865 4866 4867 4868 | /* ** Usage: sqlite_delete_collation DB collation-name ** ** Delete the collation sequence 'collation-name' from database handle ** DB. It is assumed that the collation sequence was created as UTF8 (the ** way the TCL interface does it). */ | | | 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 | /* ** Usage: sqlite_delete_collation DB collation-name ** ** Delete the collation sequence 'collation-name' from database handle ** DB. It is assumed that the collation sequence was created as UTF8 (the ** way the TCL interface does it). */ static int SQLITE_TCLAPI delete_collation( void * clientData, Tcl_Interp *interp, int argc, char **argv ){ int rc; sqlite3 *db; |
︙ | ︙ | |||
4887 4888 4889 4890 4891 4892 4893 | /* ** Usage: sqlite3_get_autocommit DB ** ** Return true if the database DB is currently in auto-commit mode. ** Return false if not. */ | | | 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 | /* ** Usage: sqlite3_get_autocommit DB ** ** Return true if the database DB is currently in auto-commit mode. ** Return false if not. */ static int SQLITE_TCLAPI get_autocommit( void * clientData, Tcl_Interp *interp, int argc, char **argv ){ char zBuf[30]; sqlite3 *db; |
︙ | ︙ | |||
4913 4914 4915 4916 4917 4918 4919 | /* ** Usage: sqlite3_busy_timeout DB MS ** ** Set the busy timeout. This is more easily done using the timeout ** method of the TCL interface. But we need a way to test the case ** where it returns SQLITE_MISUSE. */ | | | 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 | /* ** Usage: sqlite3_busy_timeout DB MS ** ** Set the busy timeout. This is more easily done using the timeout ** method of the TCL interface. But we need a way to test the case ** where it returns SQLITE_MISUSE. */ static int SQLITE_TCLAPI test_busy_timeout( void * clientData, Tcl_Interp *interp, int argc, char **argv ){ int rc, ms; sqlite3 *db; |
︙ | ︙ | |||
4939 4940 4941 4942 4943 4944 4945 | /* ** Usage: tcl_variable_type VARIABLENAME ** ** Return the name of the internal representation for the ** value of the given variable. */ | | | 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 | /* ** Usage: tcl_variable_type VARIABLENAME ** ** Return the name of the internal representation for the ** value of the given variable. */ static int SQLITE_TCLAPI tcl_variable_type( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ Tcl_Obj *pVar; if( objc!=2 ){ |
︙ | ︙ | |||
4965 4966 4967 4968 4969 4970 4971 | /* ** Usage: sqlite3_release_memory ?N? ** ** Attempt to release memory currently held but not actually required. ** The integer N is the number of bytes we are trying to release. The ** return value is the amount of memory actually released. */ | | | 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 | /* ** Usage: sqlite3_release_memory ?N? ** ** Attempt to release memory currently held but not actually required. ** The integer N is the number of bytes we are trying to release. The ** return value is the amount of memory actually released. */ static int SQLITE_TCLAPI test_release_memory( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) && !defined(SQLITE_OMIT_DISKIO) int N; |
︙ | ︙ | |||
4996 4997 4998 4999 5000 5001 5002 | /* ** Usage: sqlite3_db_release_memory DB ** ** Attempt to release memory currently held by database DB. Return the ** result code (which in the current implementation is always zero). */ | | | 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 | /* ** Usage: sqlite3_db_release_memory DB ** ** Attempt to release memory currently held by database DB. Return the ** result code (which in the current implementation is always zero). */ static int SQLITE_TCLAPI test_db_release_memory( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
5019 5020 5021 5022 5023 5024 5025 | } /* ** Usage: sqlite3_db_cacheflush DB ** ** Attempt to flush any dirty pages to disk. */ | | | 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 | } /* ** Usage: sqlite3_db_cacheflush DB ** ** Attempt to flush any dirty pages to disk. */ static int SQLITE_TCLAPI test_db_cacheflush( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
5047 5048 5049 5050 5051 5052 5053 | } /* ** Usage: sqlite3_system_errno DB ** ** Return the low-level system errno value. */ | | | 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 | } /* ** Usage: sqlite3_system_errno DB ** ** Return the low-level system errno value. */ static int SQLITE_TCLAPI test_system_errno( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; int iErrno; |
︙ | ︙ | |||
5070 5071 5072 5073 5074 5075 5076 | } /* ** Usage: sqlite3_db_filename DB DBNAME ** ** Return the name of a file associated with a database. */ | | | 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 | } /* ** Usage: sqlite3_db_filename DB DBNAME ** ** Return the name of a file associated with a database. */ static int SQLITE_TCLAPI test_db_filename( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; const char *zDbName; |
︙ | ︙ | |||
5094 5095 5096 5097 5098 5099 5100 | /* ** Usage: sqlite3_db_readonly DB DBNAME ** ** Return 1 or 0 if DBNAME is readonly or not. Return -1 if DBNAME does ** not exist. */ | | | 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 | /* ** Usage: sqlite3_db_readonly DB DBNAME ** ** Return 1 or 0 if DBNAME is readonly or not. Return -1 if DBNAME does ** not exist. */ static int SQLITE_TCLAPI test_db_readonly( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; const char *zDbName; |
︙ | ︙ | |||
5119 5120 5121 5122 5123 5124 5125 | /* ** Usage: sqlite3_soft_heap_limit ?N? ** ** Query or set the soft heap limit for the current thread. The ** limit is only changed if the N is present. The previous limit ** is returned. */ | | | 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 | /* ** Usage: sqlite3_soft_heap_limit ?N? ** ** Query or set the soft heap limit for the current thread. The ** limit is only changed if the N is present. The previous limit ** is returned. */ static int SQLITE_TCLAPI test_soft_heap_limit( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_int64 amt; Tcl_WideInt N = -1; |
︙ | ︙ | |||
5144 5145 5146 5147 5148 5149 5150 | } /* ** Usage: sqlite3_thread_cleanup ** ** Call the sqlite3_thread_cleanup API. */ | | | | 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 | } /* ** Usage: sqlite3_thread_cleanup ** ** Call the sqlite3_thread_cleanup API. */ static int SQLITE_TCLAPI test_thread_cleanup( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_DEPRECATED sqlite3_thread_cleanup(); #endif return TCL_OK; } /* ** Usage: sqlite3_pager_refcounts DB ** ** Return a list of numbers which are the PagerRefcount for all ** pagers on each database connection. */ static int SQLITE_TCLAPI test_pager_refcounts( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; int i; |
︙ | ︙ | |||
5208 5209 5210 5211 5212 5213 5214 | ** TCL build to see whether or not it supports 64-bit integers. It ** returns TRUE if it does and FALSE if not. ** ** This command is used to warn users that their TCL build is defective ** and that the errors they are seeing in the test scripts might be ** a result of their defective TCL rather than problems in SQLite. */ | | | 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 | ** TCL build to see whether or not it supports 64-bit integers. It ** returns TRUE if it does and FALSE if not. ** ** This command is used to warn users that their TCL build is defective ** and that the errors they are seeing in the test scripts might be ** a result of their defective TCL rather than problems in SQLite. */ static int SQLITE_TCLAPI working_64bit_int( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ Tcl_Obj *pTestObj; int working = 0; |
︙ | ︙ | |||
5233 5234 5235 5236 5237 5238 5239 | ** tclcmd: vfs_unlink_test ** ** This TCL command unregisters the primary VFS and then registers ** it back again. This is used to test the ability to register a ** VFS when none are previously registered, and the ability to ** unregister the only available VFS. Ticket #2738 */ | | | 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 | ** tclcmd: vfs_unlink_test ** ** This TCL command unregisters the primary VFS and then registers ** it back again. This is used to test the ability to register a ** VFS when none are previously registered, and the ability to ** unregister the only available VFS. Ticket #2738 */ static int SQLITE_TCLAPI vfs_unlink_test( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int i; sqlite3_vfs *pMain; |
︙ | ︙ | |||
5335 5336 5337 5338 5339 5340 5341 | /* ** tclcmd: vfs_initfail_test ** ** This TCL command attempts to vfs_find and vfs_register when the ** sqlite3_initialize() interface is failing. All calls should fail. */ | | | 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 | /* ** tclcmd: vfs_initfail_test ** ** This TCL command attempts to vfs_find and vfs_register when the ** sqlite3_initialize() interface is failing. All calls should fail. */ static int SQLITE_TCLAPI vfs_initfail_test( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_vfs one; one.zName = "__one"; |
︙ | ︙ | |||
5363 5364 5365 5366 5367 5368 5369 | static int nVfs = 0; /* ** tclcmd: vfs_unregister_all ** ** Unregister all VFSes. */ | | | 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 | static int nVfs = 0; /* ** tclcmd: vfs_unregister_all ** ** Unregister all VFSes. */ static int SQLITE_TCLAPI vfs_unregister_all( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int i; for(i=0; i<ArraySize(apVfs); i++){ |
︙ | ︙ | |||
5385 5386 5387 5388 5389 5390 5391 | /* ** tclcmd: vfs_reregister_all ** ** Restore all VFSes that were removed using vfs_unregister_all. Taking ** care to put the linked list back together in the same order as it was ** in before vfs_unregister_all was invoked. */ | | | | 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 | /* ** tclcmd: vfs_reregister_all ** ** Restore all VFSes that were removed using vfs_unregister_all. Taking ** care to put the linked list back together in the same order as it was ** in before vfs_unregister_all was invoked. */ static int SQLITE_TCLAPI vfs_reregister_all( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int i; for(i=nVfs-1; i>=0; i--){ sqlite3_vfs_register(apVfs[i], 1); } return TCL_OK; } /* ** tclcmd: file_control_test DB ** ** This TCL command runs the sqlite3_file_control interface and ** verifies correct operation of the same. */ static int SQLITE_TCLAPI file_control_test( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int iArg = 0; sqlite3 *db; |
︙ | ︙ | |||
5440 5441 5442 5443 5444 5445 5446 | /* ** tclcmd: file_control_lasterrno_test DB ** ** This TCL command runs the sqlite3_file_control interface and ** verifies correct operation of the SQLITE_LAST_ERRNO verb. */ | | | 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 | /* ** tclcmd: file_control_lasterrno_test DB ** ** This TCL command runs the sqlite3_file_control interface and ** verifies correct operation of the SQLITE_LAST_ERRNO verb. */ static int SQLITE_TCLAPI file_control_lasterrno_test( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int iArg = 0; sqlite3 *db; |
︙ | ︙ | |||
5478 5479 5480 5481 5482 5483 5484 | /* ** tclcmd: file_control_chunksize_test DB DBNAME SIZE ** ** This TCL command runs the sqlite3_file_control interface and ** verifies correct operation of the SQLITE_GET_LOCKPROXYFILE and ** SQLITE_SET_LOCKPROXYFILE verbs. */ | | | 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 | /* ** tclcmd: file_control_chunksize_test DB DBNAME SIZE ** ** This TCL command runs the sqlite3_file_control interface and ** verifies correct operation of the SQLITE_GET_LOCKPROXYFILE and ** SQLITE_SET_LOCKPROXYFILE verbs. */ static int SQLITE_TCLAPI file_control_chunksize_test( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int nSize; /* New chunk size */ char *zDb; /* Db name ("main", "temp" etc.) */ |
︙ | ︙ | |||
5515 5516 5517 5518 5519 5520 5521 | /* ** tclcmd: file_control_sizehint_test DB DBNAME SIZE ** ** This TCL command runs the sqlite3_file_control interface ** with SQLITE_FCNTL_SIZE_HINT */ | | | 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 | /* ** tclcmd: file_control_sizehint_test DB DBNAME SIZE ** ** This TCL command runs the sqlite3_file_control interface ** with SQLITE_FCNTL_SIZE_HINT */ static int SQLITE_TCLAPI file_control_sizehint_test( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ Tcl_WideInt nSize; /* Hinted size */ char *zDb; /* Db name ("main", "temp" etc.) */ |
︙ | ︙ | |||
5553 5554 5555 5556 5557 5558 5559 | /* ** tclcmd: file_control_lockproxy_test DB PWD ** ** This TCL command runs the sqlite3_file_control interface and ** verifies correct operation of the SQLITE_GET_LOCKPROXYFILE and ** SQLITE_SET_LOCKPROXYFILE verbs. */ | | | 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 | /* ** tclcmd: file_control_lockproxy_test DB PWD ** ** This TCL command runs the sqlite3_file_control interface and ** verifies correct operation of the SQLITE_GET_LOCKPROXYFILE and ** SQLITE_SET_LOCKPROXYFILE verbs. */ static int SQLITE_TCLAPI file_control_lockproxy_test( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; |
︙ | ︙ | |||
5623 5624 5625 5626 5627 5628 5629 | #if SQLITE_OS_WIN /* ** tclcmd: file_control_win32_av_retry DB NRETRY DELAY ** ** This TCL command runs the sqlite3_file_control interface with ** the SQLITE_FCNTL_WIN32_AV_RETRY opcode. */ | | | 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 | #if SQLITE_OS_WIN /* ** tclcmd: file_control_win32_av_retry DB NRETRY DELAY ** ** This TCL command runs the sqlite3_file_control interface with ** the SQLITE_FCNTL_WIN32_AV_RETRY opcode. */ static int SQLITE_TCLAPI file_control_win32_av_retry( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
5656 5657 5658 5659 5660 5661 5662 | /* ** tclcmd: file_control_win32_set_handle DB HANDLE ** ** This TCL command runs the sqlite3_file_control interface with ** the SQLITE_FCNTL_WIN32_SET_HANDLE opcode. */ | | | 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 | /* ** tclcmd: file_control_win32_set_handle DB HANDLE ** ** This TCL command runs the sqlite3_file_control interface with ** the SQLITE_FCNTL_WIN32_SET_HANDLE opcode. */ static int SQLITE_TCLAPI file_control_win32_set_handle( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
5692 5693 5694 5695 5696 5697 5698 | /* ** tclcmd: file_control_persist_wal DB PERSIST-FLAG ** ** This TCL command runs the sqlite3_file_control interface with ** the SQLITE_FCNTL_PERSIST_WAL opcode. */ | | | 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 | /* ** tclcmd: file_control_persist_wal DB PERSIST-FLAG ** ** This TCL command runs the sqlite3_file_control interface with ** the SQLITE_FCNTL_PERSIST_WAL opcode. */ static int SQLITE_TCLAPI file_control_persist_wal( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
5724 5725 5726 5727 5728 5729 5730 | /* ** tclcmd: file_control_powersafe_overwrite DB PSOW-FLAG ** ** This TCL command runs the sqlite3_file_control interface with ** the SQLITE_FCNTL_POWERSAFE_OVERWRITE opcode. */ | | | 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 | /* ** tclcmd: file_control_powersafe_overwrite DB PSOW-FLAG ** ** This TCL command runs the sqlite3_file_control interface with ** the SQLITE_FCNTL_POWERSAFE_OVERWRITE opcode. */ static int SQLITE_TCLAPI file_control_powersafe_overwrite( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
5756 5757 5758 5759 5760 5761 5762 | /* ** tclcmd: file_control_vfsname DB ?AUXDB? ** ** Return a string that describes the stack of VFSes. */ | | | 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 | /* ** tclcmd: file_control_vfsname DB ?AUXDB? ** ** Return a string that describes the stack of VFSes. */ static int SQLITE_TCLAPI file_control_vfsname( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; const char *zDbName = "main"; |
︙ | ︙ | |||
5788 5789 5790 5791 5792 5793 5794 | } /* ** tclcmd: file_control_tempfilename DB ?AUXDB? ** ** Return a string that is a temporary filename */ | | | 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 | } /* ** tclcmd: file_control_tempfilename DB ?AUXDB? ** ** Return a string that is a temporary filename */ static int SQLITE_TCLAPI file_control_tempfilename( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; const char *zDbName = "main"; |
︙ | ︙ | |||
5821 5822 5823 5824 5825 5826 5827 | /* ** tclcmd: sqlite3_vfs_list ** ** Return a tcl list containing the names of all registered vfs's. */ | | | 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 | /* ** tclcmd: sqlite3_vfs_list ** ** Return a tcl list containing the names of all registered vfs's. */ static int SQLITE_TCLAPI vfs_list( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_vfs *pVfs; Tcl_Obj *pRet = Tcl_NewObj(); |
︙ | ︙ | |||
5846 5847 5848 5849 5850 5851 5852 | /* ** tclcmd: sqlite3_limit DB ID VALUE ** ** This TCL command runs the sqlite3_limit interface and ** verifies correct operation of the same. */ | | | 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 | /* ** tclcmd: sqlite3_limit DB ID VALUE ** ** This TCL command runs the sqlite3_limit interface and ** verifies correct operation of the same. */ static int SQLITE_TCLAPI test_limit( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
5909 5910 5911 5912 5913 5914 5915 | /* ** tclcmd: save_prng_state ** ** Save the state of the pseudo-random number generator. ** At the same time, verify that sqlite3_test_control works even when ** called with an out-of-range opcode. */ | | | | | | | | 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 | /* ** tclcmd: save_prng_state ** ** Save the state of the pseudo-random number generator. ** At the same time, verify that sqlite3_test_control works even when ** called with an out-of-range opcode. */ static int SQLITE_TCLAPI save_prng_state( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int rc = sqlite3_test_control(9999); assert( rc==0 ); rc = sqlite3_test_control(-1); assert( rc==0 ); sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SAVE); return TCL_OK; } /* ** tclcmd: restore_prng_state */ static int SQLITE_TCLAPI restore_prng_state( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_test_control(SQLITE_TESTCTRL_PRNG_RESTORE); return TCL_OK; } /* ** tclcmd: reset_prng_state */ static int SQLITE_TCLAPI reset_prng_state( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_test_control(SQLITE_TESTCTRL_PRNG_RESET); return TCL_OK; } /* ** tclcmd: database_may_be_corrupt ** ** Indicate that database files might be corrupt. In other words, set the normal ** state of operation. */ static int SQLITE_TCLAPI database_may_be_corrupt( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, 0); return TCL_OK; } /* ** tclcmd: database_never_corrupt ** ** Indicate that database files are always well-formed. This enables extra assert() ** statements that test conditions that are always true for well-formed databases. */ static int SQLITE_TCLAPI database_never_corrupt( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, 1); return TCL_OK; } /* ** tclcmd: pcache_stats */ static int SQLITE_TCLAPI test_pcache_stats( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int nMin; int nMax; |
︙ | ︙ | |||
6023 6024 6025 6026 6027 6028 6029 | } #endif /* SQLITE_ENABLE_UNLOCK_NOTIFY */ /* ** tclcmd: sqlite3_unlock_notify db */ #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY | | | 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 | } #endif /* SQLITE_ENABLE_UNLOCK_NOTIFY */ /* ** tclcmd: sqlite3_unlock_notify db */ #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY static int SQLITE_TCLAPI test_unlock_notify( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
6049 6050 6051 6052 6053 6054 6055 | return TCL_OK; } #endif /* ** tclcmd: sqlite3_wal_checkpoint db ?NAME? */ | | | 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 | return TCL_OK; } #endif /* ** tclcmd: sqlite3_wal_checkpoint db ?NAME? */ static int SQLITE_TCLAPI test_wal_checkpoint( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ char *zDb = 0; sqlite3 *db; |
︙ | ︙ | |||
6093 6094 6095 6096 6097 6098 6099 | ** ** Otherwise, this command returns a list of three integers. The first integer ** is 1 if SQLITE_BUSY was returned, or 0 otherwise. The following two integers ** are the values returned via the output parameters by wal_checkpoint_v2() - ** the number of frames in the log and the number of frames in the log ** that have been checkpointed. */ | | | 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 | ** ** Otherwise, this command returns a list of three integers. The first integer ** is 1 if SQLITE_BUSY was returned, or 0 otherwise. The following two integers ** are the values returned via the output parameters by wal_checkpoint_v2() - ** the number of frames in the log and the number of frames in the log ** that have been checkpointed. */ static int SQLITE_TCLAPI test_wal_checkpoint_v2( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ char *zDb = 0; sqlite3 *db; |
︙ | ︙ | |||
6149 6150 6151 6152 6153 6154 6155 | return TCL_OK; } /* ** tclcmd: sqlite3_wal_autocheckpoint db VALUE */ | | | 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 | return TCL_OK; } /* ** tclcmd: sqlite3_wal_autocheckpoint db VALUE */ static int SQLITE_TCLAPI test_wal_autocheckpoint( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; int rc; |
︙ | ︙ | |||
6200 6201 6202 6203 6204 6205 6206 | Tcl_ListObjAppendElement( 0, pNew, Tcl_NewStringObj(sqlite3ErrName(err), -1) ); Tcl_ListObjAppendElement(0, pNew, Tcl_NewStringObj(zMsg, -1)); Tcl_EvalObjEx(logcallback.pInterp, pNew, TCL_EVAL_GLOBAL|TCL_EVAL_DIRECT); Tcl_DecrRefCount(pNew); } | | | 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 | Tcl_ListObjAppendElement( 0, pNew, Tcl_NewStringObj(sqlite3ErrName(err), -1) ); Tcl_ListObjAppendElement(0, pNew, Tcl_NewStringObj(zMsg, -1)); Tcl_EvalObjEx(logcallback.pInterp, pNew, TCL_EVAL_GLOBAL|TCL_EVAL_DIRECT); Tcl_DecrRefCount(pNew); } static int SQLITE_TCLAPI test_sqlite3_log( ClientData clientData, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ if( objc>2 ){ Tcl_WrongNumArgs(interp, 1, objv, "SCRIPT"); |
︙ | ︙ | |||
6231 6232 6233 6234 6235 6236 6237 | /* ** tcl_objproc COMMANDNAME ARGS... ** ** Run a TCL command using its objProc interface. Throw an error if ** the command has no objProc interface. */ | | | 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 | /* ** tcl_objproc COMMANDNAME ARGS... ** ** Run a TCL command using its objProc interface. Throw an error if ** the command has no objProc interface. */ static int SQLITE_TCLAPI runAsObjProc( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ Tcl_CmdInfo cmdInfo; if( objc<2 ){ |
︙ | ︙ | |||
6294 6295 6296 6297 6298 6299 6300 | printf("%d %d %d %s\n", iSelectid, iOrder, iFrom, zDetail); } return sqlite3_finalize(pExplain); } | | | 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 | printf("%d %d %d %s\n", iSelectid, iOrder, iFrom, zDetail); } return sqlite3_finalize(pExplain); } static int SQLITE_TCLAPI test_print_eqp( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; sqlite3_stmt *pStmt; |
︙ | ︙ | |||
6322 6323 6324 6325 6326 6327 6328 | return TCL_OK; } #endif /* SQLITE_OMIT_EXPLAIN */ /* ** sqlite3_test_control VERB ARGS... */ | | | 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 | return TCL_OK; } #endif /* SQLITE_OMIT_EXPLAIN */ /* ** sqlite3_test_control VERB ARGS... */ static int SQLITE_TCLAPI test_test_control( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ struct Verb { const char *zName; |
︙ | ︙ | |||
6401 6402 6403 6404 6405 6406 6407 | return TCL_OK; } #if SQLITE_OS_UNIX #include <sys/time.h> #include <sys/resource.h> | | | 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 | return TCL_OK; } #if SQLITE_OS_UNIX #include <sys/time.h> #include <sys/resource.h> static int SQLITE_TCLAPI test_getrusage( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ char buf[1024]; struct rusage r; |
︙ | ︙ | |||
6475 6476 6477 6478 6479 6480 6481 | #if SQLITE_OS_WIN /* ** lock_win32_file FILENAME DELAY1 DELAY2 ** ** Get an exclusive manditory lock on file for DELAY2 milliseconds. ** Wait DELAY1 milliseconds before acquiring the lock. */ | | | 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 | #if SQLITE_OS_WIN /* ** lock_win32_file FILENAME DELAY1 DELAY2 ** ** Get an exclusive manditory lock on file for DELAY2 milliseconds. ** Wait DELAY1 milliseconds before acquiring the lock. */ static int SQLITE_TCLAPI win32_file_lock( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ static struct win32FileLocker x = { "win32_file_lock", 0, 0, 0, 0, 0 }; const char *zFilename; |
︙ | ︙ | |||
6539 6540 6541 6542 6543 6544 6545 | /* ** exists_win32_path PATH ** ** Returns non-zero if the specified path exists, whose fully qualified name ** may exceed 260 characters if it is prefixed with "\\?\". */ | | | 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 | /* ** exists_win32_path PATH ** ** Returns non-zero if the specified path exists, whose fully qualified name ** may exceed 260 characters if it is prefixed with "\\?\". */ static int SQLITE_TCLAPI win32_exists_path( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "PATH"); |
︙ | ︙ | |||
6561 6562 6563 6564 6565 6566 6567 | /* ** find_win32_file PATTERN ** ** Returns a list of entries in a directory that match the specified pattern, ** whose fully qualified name may exceed 248 characters if it is prefixed with ** "\\?\". */ | | | 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 | /* ** find_win32_file PATTERN ** ** Returns a list of entries in a directory that match the specified pattern, ** whose fully qualified name may exceed 248 characters if it is prefixed with ** "\\?\". */ static int SQLITE_TCLAPI win32_find_file( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ HANDLE hFindFile = INVALID_HANDLE_VALUE; WIN32_FIND_DATAW findData; |
︙ | ︙ | |||
6606 6607 6608 6609 6610 6611 6612 | /* ** delete_win32_file FILENAME ** ** Deletes the specified file, whose fully qualified name may exceed 260 ** characters if it is prefixed with "\\?\". */ | | | 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 | /* ** delete_win32_file FILENAME ** ** Deletes the specified file, whose fully qualified name may exceed 260 ** characters if it is prefixed with "\\?\". */ static int SQLITE_TCLAPI win32_delete_file( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "FILENAME"); |
︙ | ︙ | |||
6630 6631 6632 6633 6634 6635 6636 | /* ** make_win32_dir DIRECTORY ** ** Creates the specified directory, whose fully qualified name may exceed 248 ** characters if it is prefixed with "\\?\". */ | | | 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 | /* ** make_win32_dir DIRECTORY ** ** Creates the specified directory, whose fully qualified name may exceed 248 ** characters if it is prefixed with "\\?\". */ static int SQLITE_TCLAPI win32_mkdir( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "DIRECTORY"); |
︙ | ︙ | |||
6654 6655 6656 6657 6658 6659 6660 | /* ** remove_win32_dir DIRECTORY ** ** Removes the specified directory, whose fully qualified name may exceed 248 ** characters if it is prefixed with "\\?\". */ | | | 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 | /* ** remove_win32_dir DIRECTORY ** ** Removes the specified directory, whose fully qualified name may exceed 248 ** characters if it is prefixed with "\\?\". */ static int SQLITE_TCLAPI win32_rmdir( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "DIRECTORY"); |
︙ | ︙ | |||
6681 6682 6683 6684 6685 6686 6687 | /* ** optimization_control DB OPT BOOLEAN ** ** Enable or disable query optimizations using the sqlite3_test_control() ** interface. Disable if BOOLEAN is false and enable if BOOLEAN is true. ** OPT is the name of the optimization to be disabled. */ | | | 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 | /* ** optimization_control DB OPT BOOLEAN ** ** Enable or disable query optimizations using the sqlite3_test_control() ** interface. Disable if BOOLEAN is false and enable if BOOLEAN is true. ** OPT is the name of the optimization to be disabled. */ static int SQLITE_TCLAPI optimization_control( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int i; sqlite3 *db; |
︙ | ︙ | |||
6744 6745 6746 6747 6748 6749 6750 | typedef struct sqlite3_api_routines sqlite3_api_routines; /* ** load_static_extension DB NAME ... ** ** Load one or more statically linked extensions. */ | | | 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 | typedef struct sqlite3_api_routines sqlite3_api_routines; /* ** load_static_extension DB NAME ... ** ** Load one or more statically linked extensions. */ static int SQLITE_TCLAPI tclLoadStaticExtensionCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ extern int sqlite3_amatch_init(sqlite3*,char**,const sqlite3_api_routines*); extern int sqlite3_carray_init(sqlite3*,char**,const sqlite3_api_routines*); |
︙ | ︙ | |||
6822 6823 6824 6825 6826 6827 6828 | return TCL_OK; } /* ** sorter_test_fakeheap BOOL ** */ | | | 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 | return TCL_OK; } /* ** sorter_test_fakeheap BOOL ** */ static int SQLITE_TCLAPI sorter_test_fakeheap( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int bArg; if( objc!=2 ){ |
︙ | ︙ | |||
6862 6863 6864 6865 6866 6867 6868 | ** Compile SQL statement $SQL1 and step it $NSTEP times. For each row, ** check that the leftmost and rightmost columns returned are both integers, ** and that both contain the same value. ** ** Then execute statement $SQL2. Check that the statement returns the same ** set of integers in the same order as in the previous step (using $SQL1). */ | | | 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 | ** Compile SQL statement $SQL1 and step it $NSTEP times. For each row, ** check that the leftmost and rightmost columns returned are both integers, ** and that both contain the same value. ** ** Then execute statement $SQL2. Check that the statement returns the same ** set of integers in the same order as in the previous step (using $SQL1). */ static int SQLITE_TCLAPI sorter_test_sort4_helper( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zSql1; const char *zSql2; |
︙ | ︙ | |||
6931 6932 6933 6934 6935 6936 6937 | #ifdef SQLITE_USER_AUTHENTICATION #include "sqlite3userauth.h" /* ** tclcmd: sqlite3_user_authenticate DB USERNAME PASSWORD */ | | | 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 | #ifdef SQLITE_USER_AUTHENTICATION #include "sqlite3userauth.h" /* ** tclcmd: sqlite3_user_authenticate DB USERNAME PASSWORD */ static int SQLITE_TCLAPI test_user_authenticate( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ char *zUser = 0; char *zPasswd = 0; |
︙ | ︙ | |||
6962 6963 6964 6965 6966 6967 6968 | } #endif /* SQLITE_USER_AUTHENTICATION */ #ifdef SQLITE_USER_AUTHENTICATION /* ** tclcmd: sqlite3_user_add DB USERNAME PASSWORD ISADMIN */ | | | 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 | } #endif /* SQLITE_USER_AUTHENTICATION */ #ifdef SQLITE_USER_AUTHENTICATION /* ** tclcmd: sqlite3_user_add DB USERNAME PASSWORD ISADMIN */ static int SQLITE_TCLAPI test_user_add( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ char *zUser = 0; char *zPasswd = 0; |
︙ | ︙ | |||
6995 6996 6997 6998 6999 7000 7001 | } #endif /* SQLITE_USER_AUTHENTICATION */ #ifdef SQLITE_USER_AUTHENTICATION /* ** tclcmd: sqlite3_user_change DB USERNAME PASSWORD ISADMIN */ | | | 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 | } #endif /* SQLITE_USER_AUTHENTICATION */ #ifdef SQLITE_USER_AUTHENTICATION /* ** tclcmd: sqlite3_user_change DB USERNAME PASSWORD ISADMIN */ static int SQLITE_TCLAPI test_user_change( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ char *zUser = 0; char *zPasswd = 0; |
︙ | ︙ | |||
7028 7029 7030 7031 7032 7033 7034 | } #endif /* SQLITE_USER_AUTHENTICATION */ #ifdef SQLITE_USER_AUTHENTICATION /* ** tclcmd: sqlite3_user_delete DB USERNAME */ | | | 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 | } #endif /* SQLITE_USER_AUTHENTICATION */ #ifdef SQLITE_USER_AUTHENTICATION /* ** tclcmd: sqlite3_user_delete DB USERNAME */ static int SQLITE_TCLAPI test_user_delete( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ char *zUser = 0; sqlite3 *db; |
︙ | ︙ | |||
7065 7066 7067 7068 7069 7070 7071 | ** ** TYPE BEHAVIOR ** 1 Overflow a signed integer ** 2 Jump based on an uninitialized variable ** 3 Read after free ** 4 Panic */ | | | 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 | ** ** TYPE BEHAVIOR ** 1 Overflow a signed integer ** 2 Jump based on an uninitialized variable ** 3 Read after free ** 4 Panic */ static int SQLITE_TCLAPI test_bad_behavior( ClientData clientData, /* Pointer to an integer containing zero */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int iType; int xyz; |
︙ | ︙ | |||
7115 7116 7117 7118 7119 7120 7121 | } /* ** tclcmd: register_dbstat_vtab DB ** ** Cause the dbstat virtual table to be available on the connection DB */ | | | 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 | } /* ** tclcmd: register_dbstat_vtab DB ** ** Cause the dbstat virtual table to be available on the connection DB */ static int SQLITE_TCLAPI test_register_dbstat_vtab( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifdef SQLITE_OMIT_VIRTUALTABLE Tcl_AppendResult(interp, "dbstat not available because of " |
︙ | ︙ | |||
7149 7150 7151 7152 7153 7154 7155 | } /* ** tclcmd: sqlite3_db_config DB SETTING VALUE ** ** Invoke sqlite3_db_config() for one of the setting values. */ | | | 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 | } /* ** tclcmd: sqlite3_db_config DB SETTING VALUE ** ** Invoke sqlite3_db_config() for one of the setting values. */ static int SQLITE_TCLAPI test_sqlite3_db_config( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ static const struct { const char *zName; |
︙ | ︙ | |||
7206 7207 7208 7209 7210 7211 7212 | extern int sqlite3_open_file_count; extern int sqlite3_sort_count; extern int sqlite3_current_time; #if SQLITE_OS_UNIX && defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE extern int sqlite3_hostid_num; #endif extern int sqlite3_max_blobsize; | | | 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 | extern int sqlite3_open_file_count; extern int sqlite3_sort_count; extern int sqlite3_current_time; #if SQLITE_OS_UNIX && defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE extern int sqlite3_hostid_num; #endif extern int sqlite3_max_blobsize; extern int SQLITE_TCLAPI sqlite3BtreeSharedCacheReport(void*, Tcl_Interp*,int,Tcl_Obj*CONST*); static int iZero = 0; static struct { char *zName; Tcl_CmdProc *xProc; } aCmd[] = { { "db_enter", (Tcl_CmdProc*)db_enter }, |
︙ | ︙ |
Changes to src/test2.c.
︙ | ︙ | |||
38 39 40 41 42 43 44 | } /* ** Usage: pager_open FILENAME N-PAGE ** ** Open a new pager */ | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | } /* ** Usage: pager_open FILENAME N-PAGE ** ** Open a new pager */ static int SQLITE_TCLAPI pager_open( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ u32 pageSize; Pager *pPager; |
︙ | ︙ | |||
75 76 77 78 79 80 81 | } /* ** Usage: pager_close ID ** ** Close the given pager. */ | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | } /* ** Usage: pager_close ID ** ** Close the given pager. */ static int SQLITE_TCLAPI pager_close( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Pager *pPager; int rc; |
︙ | ︙ | |||
102 103 104 105 106 107 108 | } /* ** Usage: pager_rollback ID ** ** Rollback changes */ | | | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | } /* ** Usage: pager_rollback ID ** ** Rollback changes */ static int SQLITE_TCLAPI pager_rollback( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Pager *pPager; int rc; |
︙ | ︙ | |||
129 130 131 132 133 134 135 | } /* ** Usage: pager_commit ID ** ** Commit all changes */ | | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | } /* ** Usage: pager_commit ID ** ** Commit all changes */ static int SQLITE_TCLAPI pager_commit( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Pager *pPager; int rc; |
︙ | ︙ | |||
161 162 163 164 165 166 167 | } /* ** Usage: pager_stmt_begin ID ** ** Start a new checkpoint. */ | | | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | } /* ** Usage: pager_stmt_begin ID ** ** Start a new checkpoint. */ static int SQLITE_TCLAPI pager_stmt_begin( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Pager *pPager; int rc; |
︙ | ︙ | |||
188 189 190 191 192 193 194 | } /* ** Usage: pager_stmt_rollback ID ** ** Rollback changes to a checkpoint */ | | | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | } /* ** Usage: pager_stmt_rollback ID ** ** Rollback changes to a checkpoint */ static int SQLITE_TCLAPI pager_stmt_rollback( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Pager *pPager; int rc; |
︙ | ︙ | |||
216 217 218 219 220 221 222 | } /* ** Usage: pager_stmt_commit ID ** ** Commit changes to a checkpoint */ | | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | } /* ** Usage: pager_stmt_commit ID ** ** Commit changes to a checkpoint */ static int SQLITE_TCLAPI pager_stmt_commit( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Pager *pPager; int rc; |
︙ | ︙ | |||
243 244 245 246 247 248 249 | } /* ** Usage: pager_stats ID ** ** Return pager statistics. */ | | | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | } /* ** Usage: pager_stats ID ** ** Return pager statistics. */ static int SQLITE_TCLAPI pager_stats( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Pager *pPager; int i, *a; |
︙ | ︙ | |||
276 277 278 279 280 281 282 | } /* ** Usage: pager_pagecount ID ** ** Return the size of the database file. */ | | | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | } /* ** Usage: pager_pagecount ID ** ** Return the size of the database file. */ static int SQLITE_TCLAPI pager_pagecount( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Pager *pPager; char zBuf[100]; |
︙ | ︙ | |||
302 303 304 305 306 307 308 | } /* ** Usage: page_get ID PGNO ** ** Return a pointer to a page from the database. */ | | | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | } /* ** Usage: page_get ID PGNO ** ** Return a pointer to a page from the database. */ static int SQLITE_TCLAPI page_get( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Pager *pPager; char zBuf[100]; |
︙ | ︙ | |||
339 340 341 342 343 344 345 | /* ** Usage: page_lookup ID PGNO ** ** Return a pointer to a page if the page is already in cache. ** If not in cache, return an empty string. */ | | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | /* ** Usage: page_lookup ID PGNO ** ** Return a pointer to a page if the page is already in cache. ** If not in cache, return an empty string. */ static int SQLITE_TCLAPI page_lookup( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Pager *pPager; char zBuf[100]; |
︙ | ︙ | |||
367 368 369 370 371 372 373 | } return TCL_OK; } /* ** Usage: pager_truncate ID PGNO */ | | | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | } return TCL_OK; } /* ** Usage: pager_truncate ID PGNO */ static int SQLITE_TCLAPI pager_truncate( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Pager *pPager; int pgno; |
︙ | ︙ | |||
392 393 394 395 396 397 398 | /* ** Usage: page_unref PAGE ** ** Drop a pointer to a page. */ | | | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | /* ** Usage: page_unref PAGE ** ** Drop a pointer to a page. */ static int SQLITE_TCLAPI page_unref( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ DbPage *pPage; if( argc!=2 ){ |
︙ | ︙ | |||
414 415 416 417 418 419 420 | } /* ** Usage: page_read PAGE ** ** Return the content of a page */ | | | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | } /* ** Usage: page_read PAGE ** ** Return the content of a page */ static int SQLITE_TCLAPI page_read( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ char zBuf[100]; DbPage *pPage; |
︙ | ︙ | |||
438 439 440 441 442 443 444 | } /* ** Usage: page_number PAGE ** ** Return the page number for a page. */ | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | } /* ** Usage: page_number PAGE ** ** Return the page number for a page. */ static int SQLITE_TCLAPI page_number( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ char zBuf[100]; DbPage *pPage; |
︙ | ︙ | |||
462 463 464 465 466 467 468 | } /* ** Usage: page_write PAGE DATA ** ** Write something into a page. */ | | | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | } /* ** Usage: page_write PAGE DATA ** ** Write something into a page. */ static int SQLITE_TCLAPI page_write( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ DbPage *pPage; char *pData; |
︙ | ︙ | |||
498 499 500 501 502 503 504 | ** ** Write a few bytes at the N megabyte point of FILENAME. This will ** create a large file. If the file was a valid SQLite database, then ** the next time the database is opened, SQLite will begin allocating ** new pages after N. If N is 2096 or bigger, this will test the ** ability of SQLite to write to large files. */ | | | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | ** ** Write a few bytes at the N megabyte point of FILENAME. This will ** create a large file. If the file was a valid SQLite database, then ** the next time the database is opened, SQLite will begin allocating ** new pages after N. If N is 2096 or bigger, this will test the ** ability of SQLite to write to large files. */ static int SQLITE_TCLAPI fake_big_file( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ sqlite3_vfs *pVfs; sqlite3_file *fd = 0; |
︙ | ︙ | |||
551 552 553 554 555 556 557 | /* ** test_control_pending_byte PENDING_BYTE ** ** Set the PENDING_BYTE using the sqlite3_test_control() interface. */ | | | 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | /* ** test_control_pending_byte PENDING_BYTE ** ** Set the PENDING_BYTE using the sqlite3_test_control() interface. */ static int SQLITE_TCLAPI testPendingByte( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int pbyte; int rc; |
︙ | ︙ | |||
616 617 618 619 620 621 622 | /* ** sqlite3_test_control_fault_install SCRIPT ** ** Arrange to invoke SCRIPT with the integer argument to sqlite3FaultSim() ** appended, whenever sqlite3FaultSim() is called. Or, if SCRIPT is the ** empty string, cancel the sqlite3FaultSim() callback. */ | | | 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | /* ** sqlite3_test_control_fault_install SCRIPT ** ** Arrange to invoke SCRIPT with the integer argument to sqlite3FaultSim() ** appended, whenever sqlite3FaultSim() is called. Or, if SCRIPT is the ** empty string, cancel the sqlite3FaultSim() callback. */ static int SQLITE_TCLAPI faultInstallCmd( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ const char *zScript; int nScript; |
︙ | ︙ | |||
659 660 661 662 663 664 665 | /* ** sqlite3BitvecBuiltinTest SIZE PROGRAM ** ** Invoke the SQLITE_TESTCTRL_BITVEC_TEST operator on test_control. ** See comments on sqlite3BitvecBuiltinTest() for additional information. */ | | | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | /* ** sqlite3BitvecBuiltinTest SIZE PROGRAM ** ** Invoke the SQLITE_TESTCTRL_BITVEC_TEST operator on test_control. ** See comments on sqlite3BitvecBuiltinTest() for additional information. */ static int SQLITE_TCLAPI testBitvecBuiltinTest( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int sz, rc; int nProg = 0; |
︙ | ︙ |
Changes to src/test3.c.
︙ | ︙ | |||
33 34 35 36 37 38 39 | static int nRefSqlite3 = 0; /* ** Usage: btree_open FILENAME NCACHE ** ** Open a new database */ | | | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | static int nRefSqlite3 = 0; /* ** Usage: btree_open FILENAME NCACHE ** ** Open a new database */ static int SQLITE_TCLAPI btree_open( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Btree *pBt; int rc, nCache; |
︙ | ︙ | |||
79 80 81 82 83 84 85 | } /* ** Usage: btree_close ID ** ** Close the given database. */ | | | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | } /* ** Usage: btree_close ID ** ** Close the given database. */ static int SQLITE_TCLAPI btree_close( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Btree *pBt; int rc; |
︙ | ︙ | |||
114 115 116 117 118 119 120 | /* ** Usage: btree_begin_transaction ID ** ** Start a new transaction */ | | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | /* ** Usage: btree_begin_transaction ID ** ** Start a new transaction */ static int SQLITE_TCLAPI btree_begin_transaction( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Btree *pBt; int rc; |
︙ | ︙ | |||
143 144 145 146 147 148 149 | } /* ** Usage: btree_pager_stats ID ** ** Returns pager statistics */ | | | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | } /* ** Usage: btree_pager_stats ID ** ** Returns pager statistics */ static int SQLITE_TCLAPI btree_pager_stats( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Btree *pBt; int i; |
︙ | ︙ | |||
193 194 195 196 197 198 199 | } /* ** Usage: btree_cursor ID TABLENUM WRITEABLE ** ** Create a new cursor. Return the ID for the cursor. */ | | | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | } /* ** Usage: btree_cursor ID TABLENUM WRITEABLE ** ** Create a new cursor. Return the ID for the cursor. */ static int SQLITE_TCLAPI btree_cursor( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Btree *pBt; int iTable; |
︙ | ︙ | |||
242 243 244 245 246 247 248 | } /* ** Usage: btree_close_cursor ID ** ** Close a cursor opened using btree_cursor. */ | | | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | } /* ** Usage: btree_close_cursor ID ** ** Close a cursor opened using btree_cursor. */ static int SQLITE_TCLAPI btree_close_cursor( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ BtCursor *pCur; Btree *pBt; |
︙ | ︙ | |||
279 280 281 282 283 284 285 | /* ** Usage: btree_next ID ** ** Move the cursor to the next entry in the table. Return 0 on success ** or 1 if the cursor was already on the last entry in the table or if ** the table is empty. */ | | | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | /* ** Usage: btree_next ID ** ** Move the cursor to the next entry in the table. Return 0 on success ** or 1 if the cursor was already on the last entry in the table or if ** the table is empty. */ static int SQLITE_TCLAPI btree_next( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ BtCursor *pCur; int rc; |
︙ | ︙ | |||
314 315 316 317 318 319 320 | /* ** Usage: btree_first ID ** ** Move the cursor to the first entry in the table. Return 0 if the ** cursor was left point to something and 1 if the table is empty. */ | | | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | /* ** Usage: btree_first ID ** ** Move the cursor to the first entry in the table. Return 0 if the ** cursor was left point to something and 1 if the table is empty. */ static int SQLITE_TCLAPI btree_first( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ BtCursor *pCur; int rc; |
︙ | ︙ | |||
349 350 351 352 353 354 355 | /* ** Usage: btree_eof ID ** ** Return TRUE if the given cursor is not pointing at a valid entry. ** Return FALSE if the cursor does point to a valid entry. */ | | | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | /* ** Usage: btree_eof ID ** ** Return TRUE if the given cursor is not pointing at a valid entry. ** Return FALSE if the cursor does point to a valid entry. */ static int SQLITE_TCLAPI btree_eof( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ BtCursor *pCur; int rc; |
︙ | ︙ | |||
378 379 380 381 382 383 384 | } /* ** Usage: btree_payload_size ID ** ** Return the number of bytes of payload */ | | | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | } /* ** Usage: btree_payload_size ID ** ** Return the number of bytes of payload */ static int SQLITE_TCLAPI btree_payload_size( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ BtCursor *pCur; u32 n; |
︙ | ︙ | |||
416 417 418 419 420 421 422 | ** getVarint() and varified to be unchanged. This repeats COUNT ** times. The first integer is START*MULTIPLIER. Each iteration ** increases the integer by INCREMENT. ** ** This command returns nothing if it works. It returns an error message ** if something goes wrong. */ | | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | ** getVarint() and varified to be unchanged. This repeats COUNT ** times. The first integer is START*MULTIPLIER. Each iteration ** increases the integer by INCREMENT. ** ** This command returns nothing if it works. It returns an error message ** if something goes wrong. */ static int SQLITE_TCLAPI btree_varint_test( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ u32 start, mult, count, incr; u64 in, out; |
︙ | ︙ | |||
500 501 502 503 504 505 506 | ** ** This command returns the btree handle for the main database associated ** with the database-handle passed as the argument. Example usage: ** ** sqlite3 db test.db ** set bt [btree_from_db db] */ | | | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | ** ** This command returns the btree handle for the main database associated ** with the database-handle passed as the argument. Example usage: ** ** sqlite3 db test.db ** set bt [btree_from_db db] */ static int SQLITE_TCLAPI btree_from_db( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ char zBuf[100]; Tcl_CmdInfo info; |
︙ | ︙ | |||
540 541 542 543 544 545 546 | } /* ** Usage: btree_ismemdb ID ** ** Return true if the B-Tree is currently stored entirely in memory. */ | | | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | } /* ** Usage: btree_ismemdb ID ** ** Return true if the B-Tree is currently stored entirely in memory. */ static int SQLITE_TCLAPI btree_ismemdb( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ Btree *pBt; int res; |
︙ | ︙ | |||
571 572 573 574 575 576 577 | } /* ** usage: btree_set_cache_size ID NCACHE ** ** Set the size of the cache used by btree $ID. */ | | | 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | } /* ** usage: btree_set_cache_size ID NCACHE ** ** Set the size of the cache used by btree $ID. */ static int SQLITE_TCLAPI btree_set_cache_size( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int nCache; Btree *pBt; |
︙ | ︙ | |||
601 602 603 604 605 606 607 | } /* ** usage: btree_insert CSR ?KEY? VALUE ** ** Set the size of the cache used by btree $ID. */ | | | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | } /* ** usage: btree_insert CSR ?KEY? VALUE ** ** Set the size of the cache used by btree $ID. */ static int SQLITE_TCLAPI btree_insert( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[] ){ BtCursor *pCur; int rc; |
︙ | ︙ |
Changes to src/test4.c.
︙ | ︙ | |||
121 122 123 124 125 126 127 | /* ** Usage: thread_create NAME FILENAME ** ** NAME should be an upper case letter. Start the thread running with ** an open connection to the given database. */ | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | /* ** Usage: thread_create NAME FILENAME ** ** NAME should be an upper case letter. Start the thread running with ** an open connection to the given database. */ static int SQLITE_TCLAPI tcl_thread_create( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; pthread_t x; |
︙ | ︙ | |||
170 171 172 173 174 175 176 | } /* ** Usage: thread_wait ID ** ** Wait on thread ID to reach its idle state. */ | | | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | } /* ** Usage: thread_wait ID ** ** Wait on thread ID to reach its idle state. */ static int SQLITE_TCLAPI tcl_thread_wait( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; |
︙ | ︙ | |||
214 215 216 217 218 219 220 | /* ** Usage: thread_halt ID ** ** Cause a thread to shut itself down. Wait for the shutdown to be ** completed. If ID is "*" then stop all threads. */ | | | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | /* ** Usage: thread_halt ID ** ** Cause a thread to shut itself down. Wait for the shutdown to be ** completed. If ID is "*" then stop all threads. */ static int SQLITE_TCLAPI tcl_thread_halt( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; |
︙ | ︙ | |||
249 250 251 252 253 254 255 | /* ** Usage: thread_argc ID ** ** Wait on the most recent thread_step to complete, then return the ** number of columns in the result set. */ | | | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | /* ** Usage: thread_argc ID ** ** Wait on the most recent thread_step to complete, then return the ** number of columns in the result set. */ static int SQLITE_TCLAPI tcl_thread_argc( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; char zBuf[100]; |
︙ | ︙ | |||
281 282 283 284 285 286 287 | /* ** Usage: thread_argv ID N ** ** Wait on the most recent thread_step to complete, then return the ** value of the N-th columns in the result set. */ | | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | /* ** Usage: thread_argv ID N ** ** Wait on the most recent thread_step to complete, then return the ** value of the N-th columns in the result set. */ static int SQLITE_TCLAPI tcl_thread_argv( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; int n; |
︙ | ︙ | |||
317 318 319 320 321 322 323 | /* ** Usage: thread_colname ID N ** ** Wait on the most recent thread_step to complete, then return the ** name of the N-th columns in the result set. */ | | | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | /* ** Usage: thread_colname ID N ** ** Wait on the most recent thread_step to complete, then return the ** name of the N-th columns in the result set. */ static int SQLITE_TCLAPI tcl_thread_colname( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; int n; |
︙ | ︙ | |||
353 354 355 356 357 358 359 | /* ** Usage: thread_result ID ** ** Wait on the most recent operation to complete, then return the ** result code from that operation. */ | | | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | /* ** Usage: thread_result ID ** ** Wait on the most recent operation to complete, then return the ** result code from that operation. */ static int SQLITE_TCLAPI tcl_thread_result( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; const char *zName; |
︙ | ︙ | |||
385 386 387 388 389 390 391 | /* ** Usage: thread_error ID ** ** Wait on the most recent operation to complete, then return the ** error string. */ | | | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | /* ** Usage: thread_error ID ** ** Wait on the most recent operation to complete, then return the ** error string. */ static int SQLITE_TCLAPI tcl_thread_error( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; |
︙ | ︙ | |||
430 431 432 433 434 435 436 | } /* ** Usage: thread_compile ID SQL ** ** Compile a new virtual machine. */ | | | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | } /* ** Usage: thread_compile ID SQL ** ** Compile a new virtual machine. */ static int SQLITE_TCLAPI tcl_thread_compile( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; if( argc!=3 ){ |
︙ | ︙ | |||
483 484 485 486 487 488 489 | } /* ** Usage: thread_step ID ** ** Advance the virtual machine by one step */ | | | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | } /* ** Usage: thread_step ID ** ** Advance the virtual machine by one step */ static int SQLITE_TCLAPI tcl_thread_step( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; if( argc!=2 ){ |
︙ | ︙ | |||
525 526 527 528 529 530 531 | } /* ** Usage: thread_finalize ID ** ** Finalize the virtual machine. */ | | | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | } /* ** Usage: thread_finalize ID ** ** Finalize the virtual machine. */ static int SQLITE_TCLAPI tcl_thread_finalize( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; if( argc!=2 ){ |
︙ | ︙ | |||
556 557 558 559 560 561 562 | } /* ** Usage: thread_swap ID ID ** ** Interchange the sqlite* pointer between two threads. */ | | | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | } /* ** Usage: thread_swap ID ID ** ** Interchange the sqlite* pointer between two threads. */ static int SQLITE_TCLAPI tcl_thread_swap( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i, j; sqlite3 *temp; |
︙ | ︙ | |||
596 597 598 599 600 601 602 | /* ** Usage: thread_db_get ID ** ** Return the database connection pointer for the given thread. Then ** remove the pointer from the thread itself. Afterwards, the thread ** can be stopped and the connection can be used by the main thread. */ | | | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | /* ** Usage: thread_db_get ID ** ** Return the database connection pointer for the given thread. Then ** remove the pointer from the thread itself. Afterwards, the thread ** can be stopped and the connection can be used by the main thread. */ static int SQLITE_TCLAPI tcl_thread_db_get( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; char zBuf[100]; |
︙ | ︙ | |||
627 628 629 630 631 632 633 | return TCL_OK; } /* ** Usage: thread_db_put ID DB ** */ | | | 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | return TCL_OK; } /* ** Usage: thread_db_put ID DB ** */ static int SQLITE_TCLAPI tcl_thread_db_put( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; extern int sqlite3TestMakePointerStr(Tcl_Interp*, char*, void*); |
︙ | ︙ | |||
659 660 661 662 663 664 665 | /* ** Usage: thread_stmt_get ID ** ** Return the database stmt pointer for the given thread. Then ** remove the pointer from the thread itself. */ | | | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | /* ** Usage: thread_stmt_get ID ** ** Return the database stmt pointer for the given thread. Then ** remove the pointer from the thread itself. */ static int SQLITE_TCLAPI tcl_thread_stmt_get( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; char zBuf[100]; |
︙ | ︙ |
Changes to src/test5.c.
︙ | ︙ | |||
26 27 28 29 30 31 32 | #include <string.h> /* ** The first argument is a TCL UTF-8 string. Return the byte array ** object with the encoded representation of the string, including ** the NULL terminator. */ | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #include <string.h> /* ** The first argument is a TCL UTF-8 string. Return the byte array ** object with the encoded representation of the string, including ** the NULL terminator. */ static int SQLITE_TCLAPI binarize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int len; char *bytes; |
︙ | ︙ | |||
54 55 56 57 58 59 60 | ** sqlite3_value_text(), on a value that contains a UTF-8 string. The idea ** is to figure out whether or not it is a problem to use sqlite3_value ** structures with collation sequence functions. ** ** If <do-calls> is 0, then the calls to sqlite3_value_text() are not ** actually made. */ | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | ** sqlite3_value_text(), on a value that contains a UTF-8 string. The idea ** is to figure out whether or not it is a problem to use sqlite3_value ** structures with collation sequence functions. ** ** If <do-calls> is 0, then the calls to sqlite3_value_text() are not ** actually made. */ static int SQLITE_TCLAPI test_value_overhead( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int do_calls; int repeat_count; |
︙ | ︙ | |||
118 119 120 121 122 123 124 | return pEnc->enc; } /* ** Usage: test_translate <string/blob> <from enc> <to enc> ?<transient>? ** */ | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | return pEnc->enc; } /* ** Usage: test_translate <string/blob> <from enc> <to enc> ?<transient>? ** */ static int SQLITE_TCLAPI test_translate( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ u8 enc_from; u8 enc_to; |
︙ | ︙ | |||
182 183 184 185 186 187 188 | /* ** Usage: translate_selftest ** ** Call sqlite3UtfSelfTest() to run the internal tests for unicode ** translation. If there is a problem an assert() will fail. **/ void sqlite3UtfSelfTest(void); | | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | /* ** Usage: translate_selftest ** ** Call sqlite3UtfSelfTest() to run the internal tests for unicode ** translation. If there is a problem an assert() will fail. **/ void sqlite3UtfSelfTest(void); static int SQLITE_TCLAPI test_translate_selftest( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_UTF16 sqlite3UtfSelfTest(); |
︙ | ︙ |
Changes to src/test6.c.
︙ | ︙ | |||
807 808 809 810 811 812 813 | /* ** tclcmd: sqlite3_crash_now ** ** Simulate a crash immediately. This function does not return ** (writeListSync() calls exit(-1)). */ | | | | 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 | /* ** tclcmd: sqlite3_crash_now ** ** Simulate a crash immediately. This function does not return ** (writeListSync() calls exit(-1)). */ static int SQLITE_TCLAPI crashNowCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ if( objc!=1 ){ Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } writeListSync(0, 1); assert( 0 ); return TCL_OK; } /* ** tclcmd: sqlite_crash_enable ENABLE ** ** Parameter ENABLE must be a boolean value. If true, then the "crash" ** vfs is added to the system. If false, it is removed. */ static int SQLITE_TCLAPI crashEnableCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int isEnable; static sqlite3_vfs crashVfs = { |
︙ | ︙ | |||
903 904 905 906 907 908 909 | ** "atomic64K", "sequential" and "safe_append". ** ** Example: ** ** sqlite_crashparams -sect 1024 -char {atomic sequential} ./test.db 1 ** */ | | | 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 | ** "atomic64K", "sequential" and "safe_append". ** ** Example: ** ** sqlite_crashparams -sect 1024 -char {atomic sequential} ./test.db 1 ** */ static int SQLITE_TCLAPI crashParamsObjCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int iDelay; const char *zCrashFile; |
︙ | ︙ | |||
950 951 952 953 954 955 956 | sqlite3CrashTestEnable = 1; return TCL_OK; error: return TCL_ERROR; } | | | 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | sqlite3CrashTestEnable = 1; return TCL_OK; error: return TCL_ERROR; } static int SQLITE_TCLAPI devSymObjCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ void devsym_register(int iDeviceChar, int iSectorSize); |
︙ | ︙ | |||
973 974 975 976 977 978 979 | return TCL_OK; } /* ** tclcmd: unregister_devsim */ | | | | 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 | return TCL_OK; } /* ** tclcmd: unregister_devsim */ static int SQLITE_TCLAPI dsUnregisterObjCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ void devsym_unregister(void); if( objc!=1 ){ Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } devsym_unregister(); return TCL_OK; } /* ** tclcmd: register_jt_vfs ?-default? PARENT-VFS */ static int SQLITE_TCLAPI jtObjCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int jt_register(char *, int); char *zParent = 0; |
︙ | ︙ | |||
1031 1032 1033 1034 1035 1036 1037 | return TCL_OK; } /* ** tclcmd: unregister_jt_vfs */ | | | 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | return TCL_OK; } /* ** tclcmd: unregister_jt_vfs */ static int SQLITE_TCLAPI jtUnregisterObjCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ void jt_unregister(void); |
︙ | ︙ |
Changes to src/test7.c.
︙ | ︙ | |||
149 150 151 152 153 154 155 | /* ** Usage: client_create NAME FILENAME ** ** NAME should be an upper case letter. Start the thread running with ** an open connection to the given database. */ | | | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | /* ** Usage: client_create NAME FILENAME ** ** NAME should be an upper case letter. Start the thread running with ** an open connection to the given database. */ static int SQLITE_TCLAPI tcl_client_create( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; pthread_t x; |
︙ | ︙ | |||
202 203 204 205 206 207 208 | } /* ** Usage: client_wait ID ** ** Wait on thread ID to reach its idle state. */ | | | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | } /* ** Usage: client_wait ID ** ** Wait on thread ID to reach its idle state. */ static int SQLITE_TCLAPI tcl_client_wait( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; |
︙ | ︙ | |||
246 247 248 249 250 251 252 | /* ** Usage: client_halt ID ** ** Cause a client thread to shut itself down. Wait for the shutdown to be ** completed. If ID is "*" then stop all client threads. */ | | | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | /* ** Usage: client_halt ID ** ** Cause a client thread to shut itself down. Wait for the shutdown to be ** completed. If ID is "*" then stop all client threads. */ static int SQLITE_TCLAPI tcl_client_halt( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; |
︙ | ︙ | |||
294 295 296 297 298 299 300 | /* ** Usage: client_argc ID ** ** Wait on the most recent client_step to complete, then return the ** number of columns in the result set. */ | | | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | /* ** Usage: client_argc ID ** ** Wait on the most recent client_step to complete, then return the ** number of columns in the result set. */ static int SQLITE_TCLAPI tcl_client_argc( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; char zBuf[100]; |
︙ | ︙ | |||
326 327 328 329 330 331 332 | /* ** Usage: client_argv ID N ** ** Wait on the most recent client_step to complete, then return the ** value of the N-th columns in the result set. */ | | | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | /* ** Usage: client_argv ID N ** ** Wait on the most recent client_step to complete, then return the ** value of the N-th columns in the result set. */ static int SQLITE_TCLAPI tcl_client_argv( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; int n; |
︙ | ︙ | |||
362 363 364 365 366 367 368 | /* ** Usage: client_colname ID N ** ** Wait on the most recent client_step to complete, then return the ** name of the N-th columns in the result set. */ | | | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | /* ** Usage: client_colname ID N ** ** Wait on the most recent client_step to complete, then return the ** name of the N-th columns in the result set. */ static int SQLITE_TCLAPI tcl_client_colname( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; int n; |
︙ | ︙ | |||
400 401 402 403 404 405 406 | /* ** Usage: client_result ID ** ** Wait on the most recent operation to complete, then return the ** result code from that operation. */ | | | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | /* ** Usage: client_result ID ** ** Wait on the most recent operation to complete, then return the ** result code from that operation. */ static int SQLITE_TCLAPI tcl_client_result( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; const char *zName; |
︙ | ︙ | |||
432 433 434 435 436 437 438 | /* ** Usage: client_error ID ** ** Wait on the most recent operation to complete, then return the ** error string. */ | | | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | /* ** Usage: client_error ID ** ** Wait on the most recent operation to complete, then return the ** error string. */ static int SQLITE_TCLAPI tcl_client_error( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; |
︙ | ︙ | |||
477 478 479 480 481 482 483 | } /* ** Usage: client_compile ID SQL ** ** Compile a new virtual machine. */ | | | 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | } /* ** Usage: client_compile ID SQL ** ** Compile a new virtual machine. */ static int SQLITE_TCLAPI tcl_client_compile( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; if( argc!=3 ){ |
︙ | ︙ | |||
530 531 532 533 534 535 536 | } /* ** Usage: client_step ID ** ** Advance the virtual machine by one step */ | | | 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | } /* ** Usage: client_step ID ** ** Advance the virtual machine by one step */ static int SQLITE_TCLAPI tcl_client_step( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; if( argc!=2 ){ |
︙ | ︙ | |||
572 573 574 575 576 577 578 | } /* ** Usage: client_finalize ID ** ** Finalize the virtual machine. */ | | | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | } /* ** Usage: client_finalize ID ** ** Finalize the virtual machine. */ static int SQLITE_TCLAPI tcl_client_finalize( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; if( argc!=2 ){ |
︙ | ︙ | |||
616 617 618 619 620 621 622 | } /* ** Usage: client_reset ID ** ** Finalize the virtual machine. */ | | | 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | } /* ** Usage: client_reset ID ** ** Finalize the virtual machine. */ static int SQLITE_TCLAPI tcl_client_reset( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i; if( argc!=2 ){ |
︙ | ︙ | |||
647 648 649 650 651 652 653 | } /* ** Usage: client_swap ID ID ** ** Interchange the sqlite* pointer between two threads. */ | | | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | } /* ** Usage: client_swap ID ID ** ** Interchange the sqlite* pointer between two threads. */ static int SQLITE_TCLAPI tcl_client_swap( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ const char **argv /* Text of each argument */ ){ int i, j; sqlite3 *temp; |
︙ | ︙ |
Changes to src/test8.c.
︙ | ︙ | |||
1353 1354 1355 1356 1357 1358 1359 | static void moduleDestroy(void *p){ sqlite3_free(p); } /* ** Register the echo virtual table module. */ | | | 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 | static void moduleDestroy(void *p){ sqlite3_free(p); } /* ** Register the echo virtual table module. */ static int SQLITE_TCLAPI register_echo_module( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int rc; sqlite3 *db; |
︙ | ︙ | |||
1393 1394 1395 1396 1397 1398 1399 | } /* ** Tcl interface to sqlite3_declare_vtab, invoked as follows from Tcl: ** ** sqlite3_declare_vtab DB SQL */ | | | 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 | } /* ** Tcl interface to sqlite3_declare_vtab, invoked as follows from Tcl: ** ** sqlite3_declare_vtab DB SQL */ static int SQLITE_TCLAPI declare_vtab( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; int rc; |
︙ | ︙ |
Changes to src/test9.c.
︙ | ︙ | |||
22 23 24 25 26 27 28 | #endif #include <stdlib.h> #include <string.h> /* ** c_collation_test */ | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #endif #include <stdlib.h> #include <string.h> /* ** c_collation_test */ static int SQLITE_TCLAPI c_collation_test( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ const char *zErrFunction = "N/A"; sqlite3 *db; |
︙ | ︙ | |||
63 64 65 66 67 68 69 | Tcl_AppendResult(interp, "Error testing function: ", zErrFunction, 0); return TCL_ERROR; } /* ** c_realloc_test */ | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | Tcl_AppendResult(interp, "Error testing function: ", zErrFunction, 0); return TCL_ERROR; } /* ** c_realloc_test */ static int SQLITE_TCLAPI c_realloc_test( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ void *p; const char *zErrFunction = "N/A"; |
︙ | ︙ | |||
104 105 106 107 108 109 110 | return TCL_ERROR; } /* ** c_misuse_test */ | | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | return TCL_ERROR; } /* ** c_misuse_test */ static int SQLITE_TCLAPI c_misuse_test( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ const char *zErrFunction = "N/A"; sqlite3 *db = 0; |
︙ | ︙ |
Changes to src/test_async.c.
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | */ #define TCL_THREADS #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #ifdef SQLITE_ENABLE_ASYNCIO #include "sqlite3async.h" #include "sqlite3.h" #include <assert.h> | > > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | */ #define TCL_THREADS #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif #ifdef SQLITE_ENABLE_ASYNCIO #include "sqlite3async.h" #include "sqlite3.h" #include <assert.h> |
︙ | ︙ | |||
36 37 38 39 40 41 42 | } testasync_g = { 0 }; TCL_DECLARE_MUTEX(testasync_g_writerMutex); /* ** sqlite3async_initialize PARENT-VFS ISDEFAULT */ | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | } testasync_g = { 0 }; TCL_DECLARE_MUTEX(testasync_g_writerMutex); /* ** sqlite3async_initialize PARENT-VFS ISDEFAULT */ static int SQLITE_TCLAPI testAsyncInit( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zParent; int isDefault; |
︙ | ︙ | |||
69 70 71 72 73 74 75 | } return TCL_OK; } /* ** sqlite3async_shutdown */ | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | } return TCL_OK; } /* ** sqlite3async_shutdown */ static int SQLITE_TCLAPI testAsyncShutdown( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3async_shutdown(); return TCL_OK; |
︙ | ︙ | |||
93 94 95 96 97 98 99 | } /* ** sqlite3async_start ** ** Start a new writer thread. */ | | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | } /* ** sqlite3async_start ** ** Start a new writer thread. */ static int SQLITE_TCLAPI testAsyncStart( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ volatile int isStarted = 0; ClientData threadData = (ClientData)&isStarted; |
︙ | ︙ | |||
125 126 127 128 129 130 131 | ** sqlite3async_wait ** ** Wait for the current writer thread to terminate. ** ** If the current writer thread is set to run forever then this ** command would block forever. To prevent that, an error is returned. */ | | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | ** sqlite3async_wait ** ** Wait for the current writer thread to terminate. ** ** If the current writer thread is set to run forever then this ** command would block forever. To prevent that, an error is returned. */ static int SQLITE_TCLAPI testAsyncWait( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int eCond; if( objc!=1 ){ |
︙ | ︙ | |||
151 152 153 154 155 156 157 | Tcl_MutexUnlock(&testasync_g_writerMutex); return TCL_OK; } /* ** sqlite3async_control OPTION ?VALUE? */ | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | Tcl_MutexUnlock(&testasync_g_writerMutex); return TCL_OK; } /* ** sqlite3async_control OPTION ?VALUE? */ static int SQLITE_TCLAPI testAsyncControl( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc = SQLITE_OK; int aeOpt[] = { SQLITEASYNC_HALT, SQLITEASYNC_DELAY, SQLITEASYNC_LOCKFILES }; |
︙ | ︙ |
Changes to src/test_autoext.c.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ************************************************************************* ** Test extension for testing the sqlite3_auto_extension() function. */ #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include "sqlite3ext.h" #ifndef SQLITE_OMIT_LOAD_EXTENSION SQLITE_EXTENSION_INIT1 /* | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ************************************************************************* ** Test extension for testing the sqlite3_auto_extension() function. */ #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif #include "sqlite3ext.h" #ifndef SQLITE_OMIT_LOAD_EXTENSION SQLITE_EXTENSION_INIT1 /* |
︙ | ︙ | |||
87 88 89 90 91 92 93 | } /* ** tclcmd: sqlite3_auto_extension_sqr ** ** Register the "sqr" extension to be loaded automatically. */ | | | | | | | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | } /* ** tclcmd: sqlite3_auto_extension_sqr ** ** Register the "sqr" extension to be loaded automatically. */ static int SQLITE_TCLAPI autoExtSqrObjCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc = sqlite3_auto_extension((void*)sqr_init); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return SQLITE_OK; } /* ** tclcmd: sqlite3_cancel_auto_extension_sqr ** ** Unregister the "sqr" extension. */ static int SQLITE_TCLAPI cancelAutoExtSqrObjCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc = sqlite3_cancel_auto_extension((void*)sqr_init); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return SQLITE_OK; } /* ** tclcmd: sqlite3_auto_extension_cube ** ** Register the "cube" extension to be loaded automatically. */ static int SQLITE_TCLAPI autoExtCubeObjCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc = sqlite3_auto_extension((void*)cube_init); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return SQLITE_OK; } /* ** tclcmd: sqlite3_cancel_auto_extension_cube ** ** Unregister the "cube" extension. */ static int SQLITE_TCLAPI cancelAutoExtCubeObjCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc = sqlite3_cancel_auto_extension((void*)cube_init); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return SQLITE_OK; } /* ** tclcmd: sqlite3_auto_extension_broken ** ** Register the broken extension to be loaded automatically. */ static int SQLITE_TCLAPI autoExtBrokenObjCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc = sqlite3_auto_extension((void*)broken_init); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return SQLITE_OK; } /* ** tclcmd: sqlite3_cancel_auto_extension_broken ** ** Unregister the broken extension. */ static int SQLITE_TCLAPI cancelAutoExtBrokenObjCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc = sqlite3_cancel_auto_extension((void*)broken_init); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return SQLITE_OK; } #endif /* SQLITE_OMIT_LOAD_EXTENSION */ /* ** tclcmd: sqlite3_reset_auto_extension ** ** Reset all auto-extensions */ static int SQLITE_TCLAPI resetAutoExtObjCmd( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_reset_auto_extension(); return SQLITE_OK; |
︙ | ︙ |
Changes to src/test_backup.c.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ** */ #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include "sqlite3.h" #include <assert.h> /* These functions are implemented in main.c. */ extern const char *sqlite3ErrName(int); /* These functions are implemented in test1.c. */ extern int getDbPointer(Tcl_Interp *, const char *, sqlite3 **); | > > > | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ** */ #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif #include "sqlite3.h" #include <assert.h> /* These functions are implemented in main.c. */ extern const char *sqlite3ErrName(int); /* These functions are implemented in test1.c. */ extern int getDbPointer(Tcl_Interp *, const char *, sqlite3 **); static int SQLITE_TCLAPI backupTestCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const*objv ){ enum BackupSubCommandEnum { BACKUP_STEP, BACKUP_FINISH, BACKUP_REMAINING, BACKUP_PAGECOUNT |
︙ | ︙ | |||
98 99 100 101 102 103 104 | Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_backup_pagecount(p))); break; } return TCL_OK; } | | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_backup_pagecount(p))); break; } return TCL_OK; } static void SQLITE_TCLAPI backupTestFinish(ClientData clientData){ sqlite3_backup *pBackup = (sqlite3_backup *)clientData; sqlite3_backup_finish(pBackup); } /* ** sqlite3_backup CMDNAME DESTHANDLE DESTNAME SRCHANDLE SRCNAME ** */ static int SQLITE_TCLAPI backupTestInit( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const*objv ){ sqlite3_backup *pBackup; sqlite3 *pDestDb; |
︙ | ︙ |
Changes to src/test_bestindex.c.
︙ | ︙ | |||
563 564 565 566 567 568 569 | ** Decode a pointer to an sqlite3 object. */ extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); /* ** Register the echo virtual table module. */ | | | 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | ** Decode a pointer to an sqlite3 object. */ extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); /* ** Register the echo virtual table module. */ static int SQLITE_TCLAPI register_tcl_module( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; if( objc!=2 ){ |
︙ | ︙ |
Changes to src/test_blob.c.
︙ | ︙ | |||
95 96 97 98 99 100 101 | } /* ** sqlite3_blob_open DB DATABASE TABLE COLUMN ROWID FLAGS VARNAME ** ** Tcl test harness for the sqlite3_blob_open() function. */ | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | } /* ** sqlite3_blob_open DB DATABASE TABLE COLUMN ROWID FLAGS VARNAME ** ** Tcl test harness for the sqlite3_blob_open() function. */ static int SQLITE_TCLAPI test_blob_open( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* Calling TCL interpreter */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; const char *zDb; |
︙ | ︙ | |||
146 147 148 149 150 151 152 | return TCL_OK; } /* ** sqlite3_blob_close HANDLE */ | | | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | return TCL_OK; } /* ** sqlite3_blob_close HANDLE */ static int SQLITE_TCLAPI test_blob_close( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_blob *pBlob; int rc; |
︙ | ︙ | |||
174 175 176 177 178 179 180 | } return TCL_OK; } /* ** sqlite3_blob_bytes HANDLE */ | | | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | } return TCL_OK; } /* ** sqlite3_blob_bytes HANDLE */ static int SQLITE_TCLAPI test_blob_bytes( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_blob *pBlob; int nByte; |
︙ | ︙ | |||
210 211 212 213 214 215 216 | ** blob handle. ** ** On success, a byte-array object containing the read data is ** returned. On failure, the interpreter result is set to the ** text representation of the returned error code (i.e. "SQLITE_NOMEM") ** and a Tcl exception is thrown. */ | | | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | ** blob handle. ** ** On success, a byte-array object containing the read data is ** returned. On failure, the interpreter result is set to the ** text representation of the returned error code (i.e. "SQLITE_NOMEM") ** and a Tcl exception is thrown. */ static int SQLITE_TCLAPI test_blob_read( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_blob *pBlob; int nByte; |
︙ | ︙ | |||
262 263 264 265 266 267 268 | ** to write the DATA byte-array to the underlying SQLite blob handle. ** at offset OFFSET. ** ** On success, an empty string is returned. On failure, the interpreter ** result is set to the text representation of the returned error code ** (i.e. "SQLITE_NOMEM") and a Tcl exception is thrown. */ | | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | ** to write the DATA byte-array to the underlying SQLite blob handle. ** at offset OFFSET. ** ** On success, an empty string is returned. On failure, the interpreter ** result is set to the text representation of the returned error code ** (i.e. "SQLITE_NOMEM") and a Tcl exception is thrown. */ static int SQLITE_TCLAPI test_blob_write( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_blob *pBlob; int iOffset; |
︙ | ︙ |
Changes to src/test_btree.c.
︙ | ︙ | |||
22 23 24 25 26 27 28 | /* ** Usage: sqlite3_shared_cache_report ** ** Return a list of file that are shared and the number of ** references to each file. */ | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | /* ** Usage: sqlite3_shared_cache_report ** ** Return a list of file that are shared and the number of ** references to each file. */ int SQLITE_TCLAPI sqlite3BtreeSharedCacheReport( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_OMIT_SHARED_CACHE extern BtShared *sqlite3SharedCacheList; |
︙ | ︙ |
Changes to src/test_demovfs.c.
︙ | ︙ | |||
641 642 643 644 645 646 647 648 649 650 | #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #if SQLITE_OS_UNIX | > > > | | | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif #if SQLITE_OS_UNIX static int SQLITE_TCLAPI register_demovfs( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_vfs_register(sqlite3_demovfs(), 1); return TCL_OK; } static int SQLITE_TCLAPI unregister_demovfs( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_vfs_unregister(sqlite3_demovfs()); return TCL_OK; |
︙ | ︙ |
Changes to src/test_fs.c.
︙ | ︙ | |||
871 872 873 874 875 876 877 | ** Decode a pointer to an sqlite3 object. */ extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); /* ** Register the echo virtual table module. */ | | | 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 | ** Decode a pointer to an sqlite3 object. */ extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); /* ** Register the echo virtual table module. */ static int SQLITE_TCLAPI register_fs_module( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; if( objc!=2 ){ |
︙ | ︙ |
Changes to src/test_func.c.
︙ | ︙ | |||
689 690 691 692 693 694 695 | /* ** TCLCMD: autoinstall_test_functions ** ** Invoke this TCL command to use sqlite3_auto_extension() to cause ** the standard set of test functions to be loaded into each new ** database connection. */ | | | 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | /* ** TCLCMD: autoinstall_test_functions ** ** Invoke this TCL command to use sqlite3_auto_extension() to cause ** the standard set of test functions to be loaded into each new ** database connection. */ static int SQLITE_TCLAPI autoinstall_test_funcs( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ extern int Md5_Register(sqlite3*); int rc = sqlite3_auto_extension((void*)registerTestFunctions); |
︙ | ︙ | |||
717 718 719 720 721 722 723 | /* ** tclcmd: abuse_create_function ** ** Make various calls to sqlite3_create_function that do not have valid ** parameters. Verify that the error condition is detected and reported. */ | | | 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | /* ** tclcmd: abuse_create_function ** ** Make various calls to sqlite3_create_function that do not have valid ** parameters. Verify that the error condition is detected and reported. */ static int SQLITE_TCLAPI abuse_create_function( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ extern int getDbPointer(Tcl_Interp*, const char*, sqlite3**); sqlite3 *db; |
︙ | ︙ |
Changes to src/test_hexio.c.
︙ | ︙ | |||
94 95 96 97 98 99 100 | /* ** Usage: hexio_read FILENAME OFFSET AMT ** ** Read AMT bytes from file FILENAME beginning at OFFSET from the ** beginning of the file. Convert that information to hexadecimal ** and return the resulting HEX string. */ | | | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | /* ** Usage: hexio_read FILENAME OFFSET AMT ** ** Read AMT bytes from file FILENAME beginning at OFFSET from the ** beginning of the file. Convert that information to hexadecimal ** and return the resulting HEX string. */ static int SQLITE_TCLAPI hexio_read( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int offset; int amt, got; |
︙ | ︙ | |||
144 145 146 147 148 149 150 | /* ** Usage: hexio_write FILENAME OFFSET DATA ** ** Write DATA into file FILENAME beginning at OFFSET from the ** beginning of the file. DATA is expressed in hexadecimal. */ | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | /* ** Usage: hexio_write FILENAME OFFSET DATA ** ** Write DATA into file FILENAME beginning at OFFSET from the ** beginning of the file. DATA is expressed in hexadecimal. */ static int SQLITE_TCLAPI hexio_write( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int offset; int nIn, nOut, written; |
︙ | ︙ | |||
192 193 194 195 196 197 198 | /* ** USAGE: hexio_get_int HEXDATA ** ** Interpret the HEXDATA argument as a big-endian integer. Return ** the value of that integer. HEXDATA can contain between 2 and 8 ** hexadecimal digits. */ | | | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | /* ** USAGE: hexio_get_int HEXDATA ** ** Interpret the HEXDATA argument as a big-endian integer. Return ** the value of that integer. HEXDATA can contain between 2 and 8 ** hexadecimal digits. */ static int SQLITE_TCLAPI hexio_get_int( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int val; int nIn, nOut; |
︙ | ︙ | |||
232 233 234 235 236 237 238 | /* ** USAGE: hexio_render_int16 INTEGER ** ** Render INTEGER has a 16-bit big-endian integer in hexadecimal. */ | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | /* ** USAGE: hexio_render_int16 INTEGER ** ** Render INTEGER has a 16-bit big-endian integer in hexadecimal. */ static int SQLITE_TCLAPI hexio_render_int16( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int val; unsigned char aNum[10]; |
︙ | ︙ | |||
259 260 261 262 263 264 265 | /* ** USAGE: hexio_render_int32 INTEGER ** ** Render INTEGER has a 32-bit big-endian integer in hexadecimal. */ | | | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | /* ** USAGE: hexio_render_int32 INTEGER ** ** Render INTEGER has a 32-bit big-endian integer in hexadecimal. */ static int SQLITE_TCLAPI hexio_render_int32( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int val; unsigned char aNum[10]; |
︙ | ︙ | |||
289 290 291 292 293 294 295 | /* ** USAGE: utf8_to_utf8 HEX ** ** The argument is a UTF8 string represented in hexadecimal. ** The UTF8 might not be well-formed. Run this string through ** sqlite3Utf8to8() convert it back to hex and return the result. */ | | | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | /* ** USAGE: utf8_to_utf8 HEX ** ** The argument is a UTF8 string represented in hexadecimal. ** The UTF8 might not be well-formed. Run this string through ** sqlite3Utf8to8() convert it back to hex and return the result. */ static int SQLITE_TCLAPI utf8_to_utf8( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifdef SQLITE_DEBUG int n; |
︙ | ︙ | |||
340 341 342 343 344 345 346 | /* ** USAGE: read_fts3varint BLOB VARNAME ** ** Read a varint from the start of BLOB. Set variable VARNAME to contain ** the interpreted value. Return the number of bytes of BLOB consumed. */ | | | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | /* ** USAGE: read_fts3varint BLOB VARNAME ** ** Read a varint from the start of BLOB. Set variable VARNAME to contain ** the interpreted value. Return the number of bytes of BLOB consumed. */ static int SQLITE_TCLAPI read_fts3varint( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int nBlob; unsigned char *zBlob; |
︙ | ︙ |
Changes to src/test_init.c.
︙ | ︙ | |||
184 185 186 187 188 189 190 | sqlite3_config(SQLITE_CONFIG_GETMALLOC, &wrapped.mem); sqlite3_config(SQLITE_CONFIG_GETPCACHE2, &wrapped.pcache); sqlite3_config(SQLITE_CONFIG_MUTEX, &mutexmethods); sqlite3_config(SQLITE_CONFIG_MALLOC, &memmethods); sqlite3_config(SQLITE_CONFIG_PCACHE2, &pcachemethods); } | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | sqlite3_config(SQLITE_CONFIG_GETMALLOC, &wrapped.mem); sqlite3_config(SQLITE_CONFIG_GETPCACHE2, &wrapped.pcache); sqlite3_config(SQLITE_CONFIG_MUTEX, &mutexmethods); sqlite3_config(SQLITE_CONFIG_MALLOC, &memmethods); sqlite3_config(SQLITE_CONFIG_PCACHE2, &pcachemethods); } static int SQLITE_TCLAPI init_wrapper_install( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int i; installInitWrappers(); |
︙ | ︙ | |||
208 209 210 211 212 213 214 | Tcl_AppendResult(interp, "Unknown argument: \"", z, "\""); return TCL_ERROR; } } return TCL_OK; } | | | | | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | Tcl_AppendResult(interp, "Unknown argument: \"", z, "\""); return TCL_ERROR; } } return TCL_OK; } static int SQLITE_TCLAPI init_wrapper_uninstall( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ if( objc!=1 ){ Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } sqlite3_shutdown(); sqlite3_config(SQLITE_CONFIG_MUTEX, &wrapped.mutex); sqlite3_config(SQLITE_CONFIG_MALLOC, &wrapped.mem); sqlite3_config(SQLITE_CONFIG_PCACHE2, &wrapped.pcache); return TCL_OK; } static int SQLITE_TCLAPI init_wrapper_clear( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ if( objc!=1 ){ Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } wrapped.mem_fail = 0; wrapped.mutex_fail = 0; wrapped.pcache_fail = 0; return TCL_OK; } static int SQLITE_TCLAPI init_wrapper_query( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ Tcl_Obj *pRet; |
︙ | ︙ |
Changes to src/test_intarray.c.
︙ | ︙ | |||
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | ** Everything below is interface for testing this module. */ #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif /* ** Routines to encode and decode pointers */ extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); extern void *sqlite3TestTextToPtr(const char*); extern int sqlite3TestMakePointerStr(Tcl_Interp*, char *zPtr, void*); extern const char *sqlite3ErrName(int); /* ** sqlite3_intarray_create DB NAME ** ** Invoke the sqlite3_intarray_create interface. A string that becomes ** the first parameter to sqlite3_intarray_bind. */ | > > > | | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | ** Everything below is interface for testing this module. */ #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif /* ** Routines to encode and decode pointers */ extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); extern void *sqlite3TestTextToPtr(const char*); extern int sqlite3TestMakePointerStr(Tcl_Interp*, char *zPtr, void*); extern const char *sqlite3ErrName(int); /* ** sqlite3_intarray_create DB NAME ** ** Invoke the sqlite3_intarray_create interface. A string that becomes ** the first parameter to sqlite3_intarray_bind. */ static int SQLITE_TCLAPI test_intarray_create( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; const char *zName; |
︙ | ︙ | |||
322 323 324 325 326 327 328 | } /* ** sqlite3_intarray_bind INTARRAY ?VALUE ...? ** ** Invoke the sqlite3_intarray_bind interface on the given array of integers. */ | | | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | } /* ** sqlite3_intarray_bind INTARRAY ?VALUE ...? ** ** Invoke the sqlite3_intarray_bind interface on the given array of integers. */ static int SQLITE_TCLAPI test_intarray_bind( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3_intarray *pArray; int rc = SQLITE_OK; |
︙ | ︙ |
Changes to src/test_malloc.c.
︙ | ︙ | |||
306 307 308 309 310 311 312 | } /* ** Usage: sqlite3_malloc NBYTES ** ** Raw test interface for sqlite3_malloc(). */ | | | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | } /* ** Usage: sqlite3_malloc NBYTES ** ** Raw test interface for sqlite3_malloc(). */ static int SQLITE_TCLAPI test_malloc( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int nByte; void *p; |
︙ | ︙ | |||
331 332 333 334 335 336 337 | } /* ** Usage: sqlite3_realloc PRIOR NBYTES ** ** Raw test interface for sqlite3_realloc(). */ | | | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | } /* ** Usage: sqlite3_realloc PRIOR NBYTES ** ** Raw test interface for sqlite3_realloc(). */ static int SQLITE_TCLAPI test_realloc( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int nByte; void *pPrior, *p; |
︙ | ︙ | |||
360 361 362 363 364 365 366 | } /* ** Usage: sqlite3_free PRIOR ** ** Raw test interface for sqlite3_free(). */ | | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | } /* ** Usage: sqlite3_free PRIOR ** ** Raw test interface for sqlite3_free(). */ static int SQLITE_TCLAPI test_free( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ void *pPrior; if( objc!=2 ){ |
︙ | ︙ | |||
391 392 393 394 395 396 397 | /* ** Usage: memset ADDRESS SIZE HEX ** ** Set a chunk of memory (obtained from malloc, probably) to a ** specified hex pattern. */ | | | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | /* ** Usage: memset ADDRESS SIZE HEX ** ** Set a chunk of memory (obtained from malloc, probably) to a ** specified hex pattern. */ static int SQLITE_TCLAPI test_memset( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ void *p; int size, n, i; |
︙ | ︙ | |||
437 438 439 440 441 442 443 | } /* ** Usage: memget ADDRESS SIZE ** ** Return memory as hexadecimal text. */ | | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | } /* ** Usage: memget ADDRESS SIZE ** ** Return memory as hexadecimal text. */ static int SQLITE_TCLAPI test_memget( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ void *p; int size, n; |
︙ | ︙ | |||
484 485 486 487 488 489 490 | } /* ** Usage: sqlite3_memory_used ** ** Raw test interface for sqlite3_memory_used(). */ | | | | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | } /* ** Usage: sqlite3_memory_used ** ** Raw test interface for sqlite3_memory_used(). */ static int SQLITE_TCLAPI test_memory_used( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(sqlite3_memory_used())); return TCL_OK; } /* ** Usage: sqlite3_memory_highwater ?RESETFLAG? ** ** Raw test interface for sqlite3_memory_highwater(). */ static int SQLITE_TCLAPI test_memory_highwater( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int resetFlag = 0; if( objc!=1 && objc!=2 ){ |
︙ | ︙ | |||
524 525 526 527 528 529 530 | /* ** Usage: sqlite3_memdebug_backtrace DEPTH ** ** Set the depth of backtracing. If SQLITE_MEMDEBUG is not defined ** then this routine is a no-op. */ | | | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | /* ** Usage: sqlite3_memdebug_backtrace DEPTH ** ** Set the depth of backtracing. If SQLITE_MEMDEBUG is not defined ** then this routine is a no-op. */ static int SQLITE_TCLAPI test_memdebug_backtrace( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int depth; if( objc!=2 ){ |
︙ | ︙ | |||
550 551 552 553 554 555 556 | } /* ** Usage: sqlite3_memdebug_dump FILENAME ** ** Write a summary of unfreed memory to FILENAME. */ | | | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | } /* ** Usage: sqlite3_memdebug_dump FILENAME ** ** Write a summary of unfreed memory to FILENAME. */ static int SQLITE_TCLAPI test_memdebug_dump( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "FILENAME"); |
︙ | ︙ | |||
575 576 577 578 579 580 581 | } /* ** Usage: sqlite3_memdebug_malloc_count ** ** Return the total number of times malloc() has been called. */ | | | 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | } /* ** Usage: sqlite3_memdebug_malloc_count ** ** Return the total number of times malloc() has been called. */ static int SQLITE_TCLAPI test_memdebug_malloc_count( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int nMalloc = -1; if( objc!=1 ){ |
︙ | ︙ | |||
615 616 617 618 619 620 621 | ** ** Each call to this routine overrides the prior counter value. ** This routine returns the number of simulated failures that have ** happened since the previous call to this routine. ** ** To disable simulated failures, use a COUNTER of -1. */ | | | 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | ** ** Each call to this routine overrides the prior counter value. ** This routine returns the number of simulated failures that have ** happened since the previous call to this routine. ** ** To disable simulated failures, use a COUNTER of -1. */ static int SQLITE_TCLAPI test_memdebug_fail( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int ii; int iFail; |
︙ | ︙ | |||
681 682 683 684 685 686 687 | /* ** Usage: sqlite3_memdebug_pending ** ** Return the number of malloc() calls that will succeed before a ** simulated failure occurs. A negative return value indicates that ** no malloc() failure is scheduled. */ | | | 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | /* ** Usage: sqlite3_memdebug_pending ** ** Return the number of malloc() calls that will succeed before a ** simulated failure occurs. A negative return value indicates that ** no malloc() failure is scheduled. */ static int SQLITE_TCLAPI test_memdebug_pending( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int nPending; if( objc!=1 ){ |
︙ | ︙ | |||
714 715 716 717 718 719 720 | ** Set a title string stored with each allocation. The TITLE is ** typically the name of the test that was running when the ** allocation occurred. The TITLE is stored with the allocation ** and can be used to figure out which tests are leaking memory. ** ** Each title overwrite the previous. */ | | | 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | ** Set a title string stored with each allocation. The TITLE is ** typically the name of the test that was running when the ** allocation occurred. The TITLE is stored with the allocation ** and can be used to figure out which tests are leaking memory. ** ** Each title overwrite the previous. */ static int SQLITE_TCLAPI test_memdebug_settitle( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_memdebug_title_count++; if( objc!=2 ){ |
︙ | ︙ | |||
795 796 797 798 799 800 801 | MallocLog *pLog = (MallocLog *)Tcl_GetHashValue(pEntry); Tcl_Free((char *)pLog); } Tcl_DeleteHashTable(&aMallocLog); Tcl_InitHashTable(&aMallocLog, MALLOC_LOG_KEYINTS); } | | | 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | MallocLog *pLog = (MallocLog *)Tcl_GetHashValue(pEntry); Tcl_Free((char *)pLog); } Tcl_DeleteHashTable(&aMallocLog); Tcl_InitHashTable(&aMallocLog, MALLOC_LOG_KEYINTS); } static int SQLITE_TCLAPI test_memdebug_log( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ static int isInit = 0; int iSub; |
︙ | ︙ | |||
893 894 895 896 897 898 899 | ** Set the scratch memory buffer using SQLITE_CONFIG_SCRATCH. ** The buffer is static and is of limited size. N might be ** adjusted downward as needed to accommodate the requested size. ** The revised value of N is returned. ** ** A negative SIZE causes the buffer pointer to be NULL. */ | | | 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 | ** Set the scratch memory buffer using SQLITE_CONFIG_SCRATCH. ** The buffer is static and is of limited size. N might be ** adjusted downward as needed to accommodate the requested size. ** The revised value of N is returned. ** ** A negative SIZE causes the buffer pointer to be NULL. */ static int SQLITE_TCLAPI test_config_scratch( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int sz, N, rc; Tcl_Obj *pResult; |
︙ | ︙ | |||
933 934 935 936 937 938 939 | ** Set the page-cache memory buffer using SQLITE_CONFIG_PAGECACHE. ** The buffer is static and is of limited size. N might be ** adjusted downward as needed to accommodate the requested size. ** The revised value of N is returned. ** ** A negative SIZE causes the buffer pointer to be NULL. */ | | | 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | ** Set the page-cache memory buffer using SQLITE_CONFIG_PAGECACHE. ** The buffer is static and is of limited size. N might be ** adjusted downward as needed to accommodate the requested size. ** The revised value of N is returned. ** ** A negative SIZE causes the buffer pointer to be NULL. */ static int SQLITE_TCLAPI test_config_pagecache( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int sz, N; Tcl_Obj *pRes; |
︙ | ︙ | |||
976 977 978 979 980 981 982 | ** Set up the alternative test page cache. Install if INSTALL_FLAG is ** true and uninstall (reverting to the default page cache) if INSTALL_FLAG ** is false. DISCARD_CHANGE is an integer between 0 and 100 inclusive ** which determines the chance of discarding a page when unpinned. 100 ** is certainty. 0 is never. PRNG_SEED is the pseudo-random number generator ** seed. */ | | | 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 | ** Set up the alternative test page cache. Install if INSTALL_FLAG is ** true and uninstall (reverting to the default page cache) if INSTALL_FLAG ** is false. DISCARD_CHANGE is an integer between 0 and 100 inclusive ** which determines the chance of discarding a page when unpinned. 100 ** is certainty. 0 is never. PRNG_SEED is the pseudo-random number generator ** seed. */ static int SQLITE_TCLAPI test_alt_pcache( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int installFlag; int discardChance = 0; |
︙ | ︙ | |||
1017 1018 1019 1020 1021 1022 1023 | } /* ** Usage: sqlite3_config_memstatus BOOLEAN ** ** Enable or disable memory status reporting using SQLITE_CONFIG_MEMSTATUS. */ | | | | 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | } /* ** Usage: sqlite3_config_memstatus BOOLEAN ** ** Enable or disable memory status reporting using SQLITE_CONFIG_MEMSTATUS. */ static int SQLITE_TCLAPI test_config_memstatus( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int enable, rc; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "BOOLEAN"); return TCL_ERROR; } if( Tcl_GetBooleanFromObj(interp, objv[1], &enable) ) return TCL_ERROR; rc = sqlite3_config(SQLITE_CONFIG_MEMSTATUS, enable); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** Usage: sqlite3_config_lookaside SIZE COUNT ** */ static int SQLITE_TCLAPI test_config_lookaside( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int sz, cnt; Tcl_Obj *pRet; |
︙ | ︙ | |||
1072 1073 1074 1075 1076 1077 1078 | /* ** Usage: sqlite3_db_config_lookaside CONNECTION BUFID SIZE COUNT ** ** There are two static buffers with BUFID 1 and 2. Each static buffer ** is 10KB in size. A BUFID of 0 indicates that the buffer should be NULL ** which will cause sqlite3_db_config() to allocate space on its own. */ | | | 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 | /* ** Usage: sqlite3_db_config_lookaside CONNECTION BUFID SIZE COUNT ** ** There are two static buffers with BUFID 1 and 2. Each static buffer ** is 10KB in size. A BUFID of 0 indicates that the buffer should be NULL ** which will cause sqlite3_db_config() to allocate space on its own. */ static int SQLITE_TCLAPI test_db_config_lookaside( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; int sz, cnt; |
︙ | ︙ | |||
1107 1108 1109 1110 1111 1112 1113 | Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** Usage: sqlite3_config_heap NBYTE NMINALLOC */ | | | 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 | Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** Usage: sqlite3_config_heap NBYTE NMINALLOC */ static int SQLITE_TCLAPI test_config_heap( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ static char *zBuf; /* Use this memory */ int nByte; /* Size of buffer to pass to sqlite3_config() */ |
︙ | ︙ | |||
1144 1145 1146 1147 1148 1149 1150 | Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_OK; } /* ** Usage: sqlite3_config_heap_size NBYTE */ | | | 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_OK; } /* ** Usage: sqlite3_config_heap_size NBYTE */ static int SQLITE_TCLAPI test_config_heap_size( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int nByte; /* Size to pass to sqlite3_config() */ int rc; /* Return code of sqlite3_config() */ |
︙ | ︙ | |||
1174 1175 1176 1177 1178 1179 1180 | /* ** Usage: sqlite3_config_error [DB] ** ** Invoke sqlite3_config() or sqlite3_db_config() with invalid ** opcodes and verify that they return errors. */ | | | 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 | /* ** Usage: sqlite3_config_error [DB] ** ** Invoke sqlite3_config() or sqlite3_db_config() with invalid ** opcodes and verify that they return errors. */ static int SQLITE_TCLAPI test_config_error( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; extern int getDbPointer(Tcl_Interp*, const char*, sqlite3**); |
︙ | ︙ | |||
1212 1213 1214 1215 1216 1217 1218 | /* ** Usage: sqlite3_config_uri BOOLEAN ** ** Enables or disables interpretation of URI parameters by default using ** SQLITE_CONFIG_URI. */ | | | 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 | /* ** Usage: sqlite3_config_uri BOOLEAN ** ** Enables or disables interpretation of URI parameters by default using ** SQLITE_CONFIG_URI. */ static int SQLITE_TCLAPI test_config_uri( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; int bOpenUri; |
︙ | ︙ | |||
1241 1242 1243 1244 1245 1246 1247 | /* ** Usage: sqlite3_config_cis BOOLEAN ** ** Enables or disables the use of the covering-index scan optimization. ** SQLITE_CONFIG_COVERING_INDEX_SCAN. */ | | | 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 | /* ** Usage: sqlite3_config_cis BOOLEAN ** ** Enables or disables the use of the covering-index scan optimization. ** SQLITE_CONFIG_COVERING_INDEX_SCAN. */ static int SQLITE_TCLAPI test_config_cis( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; int bUseCis; |
︙ | ︙ | |||
1269 1270 1271 1272 1273 1274 1275 | } /* ** Usage: sqlite3_config_pmasz INTEGER ** ** Set the minimum PMA size. */ | | | 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 | } /* ** Usage: sqlite3_config_pmasz INTEGER ** ** Set the minimum PMA size. */ static int SQLITE_TCLAPI test_config_pmasz( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; int iPmaSz; |
︙ | ︙ | |||
1299 1300 1301 1302 1303 1304 1305 | /* ** Usage: sqlite3_dump_memsys3 FILENAME ** sqlite3_dump_memsys5 FILENAME ** ** Write a summary of unfreed memsys3 allocations to FILENAME. */ | | | 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 | /* ** Usage: sqlite3_dump_memsys3 FILENAME ** sqlite3_dump_memsys5 FILENAME ** ** Write a summary of unfreed memsys3 allocations to FILENAME. */ static int SQLITE_TCLAPI test_dump_memsys3( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "FILENAME"); |
︙ | ︙ | |||
1335 1336 1337 1338 1339 1340 1341 | /* ** Usage: sqlite3_status OPCODE RESETFLAG ** ** Return a list of three elements which are the sqlite3_status() return ** code, the current value, and the high-water mark value. */ | | | 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 | /* ** Usage: sqlite3_status OPCODE RESETFLAG ** ** Return a list of three elements which are the sqlite3_status() return ** code, the current value, and the high-water mark value. */ static int SQLITE_TCLAPI test_status( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc, iValue, mxValue; int i, op = 0, resetFlag; |
︙ | ︙ | |||
1392 1393 1394 1395 1396 1397 1398 | /* ** Usage: sqlite3_db_status DATABASE OPCODE RESETFLAG ** ** Return a list of three elements which are the sqlite3_db_status() return ** code, the current value, and the high-water mark value. */ | | | 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 | /* ** Usage: sqlite3_db_status DATABASE OPCODE RESETFLAG ** ** Return a list of three elements which are the sqlite3_db_status() return ** code, the current value, and the high-water mark value. */ static int SQLITE_TCLAPI test_db_status( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc, iValue, mxValue; int i, op = 0, resetFlag; |
︙ | ︙ | |||
1453 1454 1455 1456 1457 1458 1459 | Tcl_SetObjResult(interp, pResult); return TCL_OK; } /* ** install_malloc_faultsim BOOLEAN */ | | | 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 | Tcl_SetObjResult(interp, pResult); return TCL_OK; } /* ** install_malloc_faultsim BOOLEAN */ static int SQLITE_TCLAPI test_install_malloc_faultsim( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; int isInstall; |
︙ | ︙ | |||
1477 1478 1479 1480 1481 1482 1483 | Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_OK; } /* ** sqlite3_install_memsys3 */ | | | | 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_OK; } /* ** sqlite3_install_memsys3 */ static int SQLITE_TCLAPI test_install_memsys3( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc = SQLITE_MISUSE; #ifdef SQLITE_ENABLE_MEMSYS3 const sqlite3_mem_methods *sqlite3MemGetMemsys3(void); rc = sqlite3_config(SQLITE_CONFIG_MALLOC, sqlite3MemGetMemsys3()); #endif Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_OK; } static int SQLITE_TCLAPI test_vfs_oom_test( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ extern int sqlite3_memdebug_vfs_oom_test; if( objc>2 ){ |
︙ | ︙ |
Changes to src/test_multiplex.c.
︙ | ︙ | |||
1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 | /***************************** Test Code ***********************************/ #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif extern const char *sqlite3ErrName(int); /* ** tclcmd: sqlite3_multiplex_initialize NAME MAKEDEFAULT */ | > > > | | 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 | /***************************** Test Code ***********************************/ #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif extern const char *sqlite3ErrName(int); /* ** tclcmd: sqlite3_multiplex_initialize NAME MAKEDEFAULT */ static int SQLITE_TCLAPI test_multiplex_initialize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zName; /* Name of new multiplex VFS */ int makeDefault; /* True to make the new VFS the default */ |
︙ | ︙ | |||
1267 1268 1269 1270 1271 1272 1273 | return TCL_OK; } /* ** tclcmd: sqlite3_multiplex_shutdown */ | | | 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | return TCL_OK; } /* ** tclcmd: sqlite3_multiplex_shutdown */ static int SQLITE_TCLAPI test_multiplex_shutdown( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; /* Value returned by multiplex_shutdown() */ |
︙ | ︙ | |||
1295 1296 1297 1298 1299 1300 1301 | return TCL_OK; } /* ** tclcmd: sqlite3_multiplex_dump */ | | | 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | return TCL_OK; } /* ** tclcmd: sqlite3_multiplex_dump */ static int SQLITE_TCLAPI test_multiplex_dump( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ Tcl_Obj *pResult; Tcl_Obj *pGroupTerm; |
︙ | ︙ | |||
1350 1351 1352 1353 1354 1355 1356 | Tcl_SetObjResult(interp, pResult); return TCL_OK; } /* ** Tclcmd: test_multiplex_control HANDLE DBNAME SUB-COMMAND ?INT-VALUE? */ | | | 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 | Tcl_SetObjResult(interp, pResult); return TCL_OK; } /* ** Tclcmd: test_multiplex_control HANDLE DBNAME SUB-COMMAND ?INT-VALUE? */ static int SQLITE_TCLAPI test_multiplex_control( ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; /* Return code from file_control() */ int idx; /* Index in aSub[] */ |
︙ | ︙ |
Changes to src/test_mutex.c.
︙ | ︙ | |||
152 153 154 155 156 157 158 | assert( g.isInit ); g.m.xMutexLeave(p->pReal); } /* ** sqlite3_shutdown */ | | | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | assert( g.isInit ); g.m.xMutexLeave(p->pReal); } /* ** sqlite3_shutdown */ static int SQLITE_TCLAPI test_shutdown( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; if( objc!=1 ){ Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } rc = sqlite3_shutdown(); Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_OK; } /* ** sqlite3_initialize */ static int SQLITE_TCLAPI test_initialize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; if( objc!=1 ){ Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } rc = sqlite3_initialize(); Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_OK; } /* ** install_mutex_counters BOOLEAN */ static int SQLITE_TCLAPI test_install_mutex_counters( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc = SQLITE_OK; int isInstall; |
︙ | ︙ | |||
255 256 257 258 259 260 261 | Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_OK; } /* ** read_mutex_counters */ | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_OK; } /* ** read_mutex_counters */ static int SQLITE_TCLAPI test_read_mutex_counters( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ Tcl_Obj *pRet; int ii; |
︙ | ︙ | |||
284 285 286 287 288 289 290 | return TCL_OK; } /* ** clear_mutex_counters */ | | | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | return TCL_OK; } /* ** clear_mutex_counters */ static int SQLITE_TCLAPI test_clear_mutex_counters( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int ii; |
︙ | ︙ | |||
308 309 310 311 312 313 314 | } /* ** Create and free a mutex. Return the mutex pointer. The pointer ** will be invalid since the mutex has already been freed. The ** return pointer just checks to see if the mutex really was allocated. */ | | | 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | } /* ** Create and free a mutex. Return the mutex pointer. The pointer ** will be invalid since the mutex has already been freed. The ** return pointer just checks to see if the mutex really was allocated. */ static int SQLITE_TCLAPI test_alloc_mutex( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #if SQLITE_THREADSAFE sqlite3_mutex *p = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); |
︙ | ︙ | |||
335 336 337 338 339 340 341 | ** ** SQLITE_CONFIG_SINGLETHREAD ** SQLITE_CONFIG_MULTITHREAD ** SQLITE_CONFIG_SERIALIZED ** ** Or OPTION can be an raw integer. */ | | | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | ** ** SQLITE_CONFIG_SINGLETHREAD ** SQLITE_CONFIG_MULTITHREAD ** SQLITE_CONFIG_SERIALIZED ** ** Or OPTION can be an raw integer. */ static int SQLITE_TCLAPI test_config( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ struct ConfigOption { const char *zName; |
︙ | ︙ | |||
397 398 399 400 401 402 403 | if( Tcl_GetIndexFromObj(pInterp, pObj, aName, "mutex name", 0, &iMutex) ){ return 0; } assert( iMutex!=SQLITE_MUTEX_FAST && iMutex!=SQLITE_MUTEX_RECURSIVE ); return counterMutexAlloc(iMutex); } | | | | | | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | if( Tcl_GetIndexFromObj(pInterp, pObj, aName, "mutex name", 0, &iMutex) ){ return 0; } assert( iMutex!=SQLITE_MUTEX_FAST && iMutex!=SQLITE_MUTEX_RECURSIVE ); return counterMutexAlloc(iMutex); } static int SQLITE_TCLAPI test_enter_static_mutex( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_mutex *pMutex; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "NAME"); return TCL_ERROR; } pMutex = getStaticMutexPointer(interp, objv[1]); if( !pMutex ){ return TCL_ERROR; } sqlite3_mutex_enter(pMutex); return TCL_OK; } static int SQLITE_TCLAPI test_leave_static_mutex( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_mutex *pMutex; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "NAME"); return TCL_ERROR; } pMutex = getStaticMutexPointer(interp, objv[1]); if( !pMutex ){ return TCL_ERROR; } sqlite3_mutex_leave(pMutex); return TCL_OK; } static int SQLITE_TCLAPI test_enter_db_mutex( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "DB"); return TCL_ERROR; } db = getDbPointer(interp, objv[1]); if( !db ){ return TCL_ERROR; } sqlite3_mutex_enter(sqlite3_db_mutex(db)); return TCL_OK; } static int SQLITE_TCLAPI test_leave_db_mutex( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; if( objc!=2 ){ |
︙ | ︙ |
Changes to src/test_osinst.c.
︙ | ︙ | |||
1104 1105 1106 1107 1108 1109 1110 1111 1112 | #if defined(SQLITE_TEST) || defined(TCLSH) #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif | > > > | | 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 | #if defined(SQLITE_TEST) || defined(TCLSH) #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif static int SQLITE_TCLAPI test_vfslog( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ struct SqliteDb { sqlite3 *db; }; sqlite3 *db; |
︙ | ︙ |
Changes to src/test_quota.c.
︙ | ︙ | |||
107 108 109 110 111 112 113 | int nRef; /* Number of times this file is open */ int deleteOnClose; /* True to delete this file when it closes */ quotaFile *pNext, **ppPrev; /* Linked list of files in the same group */ }; /* ** An instance of the following object represents each open connection | | | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | int nRef; /* Number of times this file is open */ int deleteOnClose; /* True to delete this file when it closes */ quotaFile *pNext, **ppPrev; /* Linked list of files in the same group */ }; /* ** An instance of the following object represents each open connection ** to a file that participates in quota tracking. This object is a ** subclass of sqlite3_file. The sqlite3_file object for the underlying ** VFS is appended to this structure. */ struct quotaConn { sqlite3_file base; /* Base class - must be first */ quotaFile *pFile; /* The underlying file */ /* The underlying VFS sqlite3_file is appended to this object */ |
︙ | ︙ | |||
150 151 152 153 154 155 156 | sqlite3_vfs *pOrigVfs; /* The sThisVfs is the VFS structure used by this shim. It is initialized ** at start-time and thus does not require a mutex */ sqlite3_vfs sThisVfs; | | | | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | sqlite3_vfs *pOrigVfs; /* The sThisVfs is the VFS structure used by this shim. It is initialized ** at start-time and thus does not require a mutex */ sqlite3_vfs sThisVfs; /* The sIoMethods defines the methods used by sqlite3_file objects ** associated with this shim. It is initialized at start-time and does ** not require a mutex. ** ** When the underlying VFS is called to open a file, it might return ** either a version 1 or a version 2 sqlite3_file object. This shim ** has to create a wrapper sqlite3_file of the same version. Hence ** there are two I/O method structures, one for version 1 and the other ** for version 2. */ sqlite3_io_methods sIoMethodsV1; sqlite3_io_methods sIoMethodsV2; |
︙ | ︙ | |||
186 187 188 189 190 191 192 | /* ** Acquire and release the mutex used to serialize access to the ** list of quotaGroups. */ static void quotaEnter(void){ sqlite3_mutex_enter(gQuota.pMutex); } static void quotaLeave(void){ sqlite3_mutex_leave(gQuota.pMutex); } | | | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | /* ** Acquire and release the mutex used to serialize access to the ** list of quotaGroups. */ static void quotaEnter(void){ sqlite3_mutex_enter(gQuota.pMutex); } static void quotaLeave(void){ sqlite3_mutex_leave(gQuota.pMutex); } /* Count the number of open files in a quotaGroup */ static int quotaGroupOpenFileCount(quotaGroup *pGroup){ int N = 0; quotaFile *pFile = pGroup->pFiles; while( pFile ){ if( pFile->nRef ) N++; pFile = pFile->pNext; |
︙ | ︙ | |||
395 396 397 398 399 400 401 | if( zMbcs ){ WideCharToMultiByte(codepage, 0, zTmpWide, nWide, zMbcs, nMbcs, 0, 0); } sqlite3_free(zTmpWide); return zMbcs; #else return (char*)zUtf8; /* No-op on unix */ | | | | | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | if( zMbcs ){ WideCharToMultiByte(codepage, 0, zTmpWide, nWide, zMbcs, nMbcs, 0, 0); } sqlite3_free(zTmpWide); return zMbcs; #else return (char*)zUtf8; /* No-op on unix */ #endif } /* ** Deallocate any memory allocated by quota_utf8_to_mbcs(). */ static void quota_mbcs_free(char *zOld){ #if SQLITE_OS_WIN sqlite3_free(zOld); #else /* No-op on unix */ #endif } /************************* VFS Method Wrappers *****************************/ /* ** This is the xOpen method used for the "quota" VFS. ** ** Most of the work is done by the underlying original VFS. This method ** simply links the new file into the appropriate quota group if it is a ** file that needs to be tracked. */ static int quotaOpen( sqlite3_vfs *pVfs, /* The quota VFS */ const char *zName, /* Name of file to be opened */ sqlite3_file *pConn, /* Fill in this file descriptor */ int flags, /* Flags to control the opening */ int *pOutFlags /* Flags showing results of opening */ ){ int rc; /* Result code */ quotaConn *pQuotaOpen; /* The new quota file descriptor */ quotaFile *pFile; /* Corresponding quotaFile obj */ quotaGroup *pGroup; /* The group file belongs to */ sqlite3_file *pSubOpen; /* Real file descriptor */ sqlite3_vfs *pOrigVfs = gQuota.pOrigVfs; /* Real VFS */ /* If the file is not a main database file or a WAL, then use the |
︙ | ︙ | |||
484 485 486 487 488 489 490 | ** the set of files in the quota group. */ static int quotaDelete( sqlite3_vfs *pVfs, /* The quota VFS */ const char *zName, /* Name of file to be deleted */ int syncDir /* Do a directory sync after deleting */ ){ | | | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | ** the set of files in the quota group. */ static int quotaDelete( sqlite3_vfs *pVfs, /* The quota VFS */ const char *zName, /* Name of file to be deleted */ int syncDir /* Do a directory sync after deleting */ ){ int rc; /* Result code */ quotaFile *pFile; /* Files in the quota */ quotaGroup *pGroup; /* The group file belongs to */ sqlite3_vfs *pOrigVfs = gQuota.pOrigVfs; /* Real VFS */ /* Do the actual file delete */ rc = pOrigVfs->xDelete(pOrigVfs, zName, syncDir); |
︙ | ︙ | |||
577 578 579 580 581 582 583 | if( pFile->iSize<iEnd ){ pGroup = pFile->pGroup; quotaEnter(); szNew = pGroup->iSize - pFile->iSize + iEnd; if( szNew>pGroup->iLimit && pGroup->iLimit>0 ){ if( pGroup->xCallback ){ | | | 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | if( pFile->iSize<iEnd ){ pGroup = pFile->pGroup; quotaEnter(); szNew = pGroup->iSize - pFile->iSize + iEnd; if( szNew>pGroup->iLimit && pGroup->iLimit>0 ){ if( pGroup->xCallback ){ pGroup->xCallback(pFile->zFilename, &pGroup->iLimit, szNew, pGroup->pArg); } if( szNew>pGroup->iLimit && pGroup->iLimit>0 ){ quotaLeave(); return SQLITE_FULL; } } |
︙ | ︙ | |||
734 735 736 737 738 739 740 | return pSubOpen->pMethods->xShmUnmap(pSubOpen, deleteFlag); } /************************** Public Interfaces *****************************/ /* ** Initialize the quota VFS shim. Use the VFS named zOrigVfsName ** as the VFS that does the actual work. Use the default if | | | 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | return pSubOpen->pMethods->xShmUnmap(pSubOpen, deleteFlag); } /************************** Public Interfaces *****************************/ /* ** Initialize the quota VFS shim. Use the VFS named zOrigVfsName ** as the VFS that does the actual work. Use the default if ** zOrigVfsName==NULL. ** ** The quota VFS shim is named "quota". It will become the default ** VFS if makeDefault is non-zero. ** ** THIS ROUTINE IS NOT THREADSAFE. Call this routine exactly once ** during start-up. */ |
︙ | ︙ | |||
904 905 906 907 908 909 910 | zFull = &((char *)fd)[gQuota.sThisVfs.szOsFile]; rc = gQuota.pOrigVfs->xFullPathname(gQuota.pOrigVfs, zFilename, gQuota.sThisVfs.mxPathname+1, zFull); } if( rc==SQLITE_OK ){ zFull[strlen(zFull)+1] = '\0'; | | | 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 | zFull = &((char *)fd)[gQuota.sThisVfs.szOsFile]; rc = gQuota.pOrigVfs->xFullPathname(gQuota.pOrigVfs, zFilename, gQuota.sThisVfs.mxPathname+1, zFull); } if( rc==SQLITE_OK ){ zFull[strlen(zFull)+1] = '\0'; rc = quotaOpen(&gQuota.sThisVfs, zFull, fd, SQLITE_OPEN_READONLY | SQLITE_OPEN_MAIN_DB, &outFlags); if( rc==SQLITE_OK ){ fd->pMethods->xFileSize(fd, &iSize); fd->pMethods->xClose(fd); }else if( rc==SQLITE_CANTOPEN ){ quotaGroup *pGroup; quotaFile *pFile; |
︙ | ︙ | |||
1012 1013 1014 1015 1016 1017 1018 | pFile = p->pFile; if( pFile && pFile->iSize<iEnd ){ quotaGroup *pGroup = pFile->pGroup; quotaEnter(); szNew = pGroup->iSize - pFile->iSize + iEnd; if( szNew>pGroup->iLimit && pGroup->iLimit>0 ){ if( pGroup->xCallback ){ | | | 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 | pFile = p->pFile; if( pFile && pFile->iSize<iEnd ){ quotaGroup *pGroup = pFile->pGroup; quotaEnter(); szNew = pGroup->iSize - pFile->iSize + iEnd; if( szNew>pGroup->iLimit && pGroup->iLimit>0 ){ if( pGroup->xCallback ){ pGroup->xCallback(pFile->zFilename, &pGroup->iLimit, szNew, pGroup->pArg); } if( szNew>pGroup->iLimit && pGroup->iLimit>0 ){ iEnd = pGroup->iLimit - pGroup->iSize + pFile->iSize; nmemb = (size_t)((iEnd - iOfst)/size); iEnd = iOfst + size*nmemb; szNew = pGroup->iSize - pFile->iSize + iEnd; |
︙ | ︙ | |||
1199 1200 1201 1202 1203 1204 1205 | /* ** Return the size of the file, as it is known to the quota subsystem. */ sqlite3_int64 sqlite3_quota_file_size(quota_FILE *p){ return p->pFile ? p->pFile->iSize : -1; } | | | 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 | /* ** Return the size of the file, as it is known to the quota subsystem. */ sqlite3_int64 sqlite3_quota_file_size(quota_FILE *p){ return p->pFile ? p->pFile->iSize : -1; } /* ** Determine the amount of data in bytes available for reading ** in the given file. */ long sqlite3_quota_file_available(quota_FILE *p){ FILE* f = p->f; long pos1, pos2; |
︙ | ︙ | |||
1271 1272 1273 1274 1275 1276 1277 | } } } quotaLeave(); sqlite3_free(zFull); return rc; } | | > > > | 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 | } } } quotaLeave(); sqlite3_free(zFull); return rc; } /***************************** Test Code ***********************************/ #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif /* ** Argument passed to a TCL quota-over-limit callback. */ typedef struct TclQuotaCallback TclQuotaCallback; struct TclQuotaCallback { |
︙ | ︙ | |||
1350 1351 1352 1353 1354 1355 1356 | sqlite3_free((char *)p); } } /* ** tclcmd: sqlite3_quota_initialize NAME MAKEDEFAULT */ | | | 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 | sqlite3_free((char *)p); } } /* ** tclcmd: sqlite3_quota_initialize NAME MAKEDEFAULT */ static int SQLITE_TCLAPI test_quota_initialize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zName; /* Name of new quota VFS */ int makeDefault; /* True to make the new VFS the default */ |
︙ | ︙ | |||
1379 1380 1381 1382 1383 1384 1385 | return TCL_OK; } /* ** tclcmd: sqlite3_quota_shutdown */ | | | 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 | return TCL_OK; } /* ** tclcmd: sqlite3_quota_shutdown */ static int SQLITE_TCLAPI test_quota_shutdown( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; /* Value returned by quota_shutdown() */ |
︙ | ︙ | |||
1402 1403 1404 1405 1406 1407 1408 | return TCL_OK; } /* ** tclcmd: sqlite3_quota_set PATTERN LIMIT SCRIPT */ | | | 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 | return TCL_OK; } /* ** tclcmd: sqlite3_quota_set PATTERN LIMIT SCRIPT */ static int SQLITE_TCLAPI test_quota_set( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zPattern; /* File pattern to configure */ Tcl_WideInt iLimit; /* Initial quota in bytes */ |
︙ | ︙ | |||
1456 1457 1458 1459 1460 1461 1462 | Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_STATIC); return TCL_OK; } /* ** tclcmd: sqlite3_quota_file FILENAME */ | | | 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 | Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_STATIC); return TCL_OK; } /* ** tclcmd: sqlite3_quota_file FILENAME */ static int SQLITE_TCLAPI test_quota_file( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zFilename; /* File pattern to configure */ int rc; /* Value returned by quota_file() */ |
︙ | ︙ | |||
1482 1483 1484 1485 1486 1487 1488 | Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_STATIC); return TCL_OK; } /* ** tclcmd: sqlite3_quota_dump */ | | | 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 | Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_STATIC); return TCL_OK; } /* ** tclcmd: sqlite3_quota_dump */ static int SQLITE_TCLAPI test_quota_dump( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ Tcl_Obj *pResult; Tcl_Obj *pGroupTerm; |
︙ | ︙ | |||
1530 1531 1532 1533 1534 1535 1536 | Tcl_SetObjResult(interp, pResult); return TCL_OK; } /* ** tclcmd: sqlite3_quota_fopen FILENAME MODE */ | | | 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 | Tcl_SetObjResult(interp, pResult); return TCL_OK; } /* ** tclcmd: sqlite3_quota_fopen FILENAME MODE */ static int SQLITE_TCLAPI test_quota_fopen( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zFilename; /* File pattern to configure */ const char *zMode; /* Mode string */ |
︙ | ︙ | |||
1560 1561 1562 1563 1564 1565 1566 | /* Defined in test1.c */ extern void *sqlite3TestTextToPtr(const char*); /* ** tclcmd: sqlite3_quota_fread HANDLE SIZE NELEM */ | | | 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 | /* Defined in test1.c */ extern void *sqlite3TestTextToPtr(const char*); /* ** tclcmd: sqlite3_quota_fread HANDLE SIZE NELEM */ static int SQLITE_TCLAPI test_quota_fread( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; char *zBuf; |
︙ | ︙ | |||
1594 1595 1596 1597 1598 1599 1600 | sqlite3_free(zBuf); return TCL_OK; } /* ** tclcmd: sqlite3_quota_fwrite HANDLE SIZE NELEM CONTENT */ | | | 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 | sqlite3_free(zBuf); return TCL_OK; } /* ** tclcmd: sqlite3_quota_fwrite HANDLE SIZE NELEM CONTENT */ static int SQLITE_TCLAPI test_quota_fwrite( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; char *zBuf; |
︙ | ︙ | |||
1622 1623 1624 1625 1626 1627 1628 | Tcl_SetObjResult(interp, Tcl_NewWideIntObj(got)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_fclose HANDLE */ | | | 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 | Tcl_SetObjResult(interp, Tcl_NewWideIntObj(got)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_fclose HANDLE */ static int SQLITE_TCLAPI test_quota_fclose( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; int rc; |
︙ | ︙ | |||
1644 1645 1646 1647 1648 1649 1650 | Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_fflush HANDLE ?HARDSYNC? */ | | | 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 | Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_fflush HANDLE ?HARDSYNC? */ static int SQLITE_TCLAPI test_quota_fflush( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; int rc; |
︙ | ︙ | |||
1670 1671 1672 1673 1674 1675 1676 | Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_fseek HANDLE OFFSET WHENCE */ | | | 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 | Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_fseek HANDLE OFFSET WHENCE */ static int SQLITE_TCLAPI test_quota_fseek( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; int ofst; |
︙ | ︙ | |||
1708 1709 1710 1711 1712 1713 1714 | Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_rewind HANDLE */ | | | | | 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 | Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_rewind HANDLE */ static int SQLITE_TCLAPI test_quota_rewind( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "HANDLE"); return TCL_ERROR; } p = sqlite3TestTextToPtr(Tcl_GetString(objv[1])); sqlite3_quota_rewind(p); return TCL_OK; } /* ** tclcmd: sqlite3_quota_ftell HANDLE */ static int SQLITE_TCLAPI test_quota_ftell( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; sqlite3_int64 x; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "HANDLE"); return TCL_ERROR; } p = sqlite3TestTextToPtr(Tcl_GetString(objv[1])); x = sqlite3_quota_ftell(p); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(x)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_ftruncate HANDLE SIZE */ static int SQLITE_TCLAPI test_quota_ftruncate( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; sqlite3_int64 x; |
︙ | ︙ | |||
1773 1774 1775 1776 1777 1778 1779 | Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_file_size HANDLE */ | | | | | 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 | Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_file_size HANDLE */ static int SQLITE_TCLAPI test_quota_file_size( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; sqlite3_int64 x; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "HANDLE"); return TCL_ERROR; } p = sqlite3TestTextToPtr(Tcl_GetString(objv[1])); x = sqlite3_quota_file_size(p); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(x)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_file_truesize HANDLE */ static int SQLITE_TCLAPI test_quota_file_truesize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; sqlite3_int64 x; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "HANDLE"); return TCL_ERROR; } p = sqlite3TestTextToPtr(Tcl_GetString(objv[1])); x = sqlite3_quota_file_truesize(p); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(x)); return TCL_OK; } /* ** tclcmd: sqlite3_quota_file_mtime HANDLE */ static int SQLITE_TCLAPI test_quota_file_mtime( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; time_t t; |
︙ | ︙ | |||
1838 1839 1840 1841 1842 1843 1844 | return TCL_OK; } /* ** tclcmd: sqlite3_quota_remove FILENAME */ | | | 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 | return TCL_OK; } /* ** tclcmd: sqlite3_quota_remove FILENAME */ static int SQLITE_TCLAPI test_quota_remove( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zFilename; /* File pattern to configure */ int rc; |
︙ | ︙ | |||
1862 1863 1864 1865 1866 1867 1868 | /* ** tclcmd: sqlite3_quota_glob PATTERN TEXT ** ** Test the glob pattern matching. Return 1 if TEXT matches PATTERN ** and return 0 if it does not. */ | | | 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 | /* ** tclcmd: sqlite3_quota_glob PATTERN TEXT ** ** Test the glob pattern matching. Return 1 if TEXT matches PATTERN ** and return 0 if it does not. */ static int SQLITE_TCLAPI test_quota_glob( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zPattern; /* The glob pattern */ const char *zText; /* Text to compare agains the pattern */ |
︙ | ︙ | |||
1888 1889 1890 1891 1892 1893 1894 | /* ** tclcmd: sqlite3_quota_file_available HANDLE ** ** Return the number of bytes from the current file point to the end of ** the file. */ | | | 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 | /* ** tclcmd: sqlite3_quota_file_available HANDLE ** ** Return the number of bytes from the current file point to the end of ** the file. */ static int SQLITE_TCLAPI test_quota_file_available( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; sqlite3_int64 x; |
︙ | ︙ | |||
1911 1912 1913 1914 1915 1916 1917 | } /* ** tclcmd: sqlite3_quota_ferror HANDLE ** ** Return true if the file handle is in the error state. */ | | | 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 | } /* ** tclcmd: sqlite3_quota_ferror HANDLE ** ** Return true if the file handle is in the error state. */ static int SQLITE_TCLAPI test_quota_ferror( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ quota_FILE *p; int x; |
︙ | ︙ |
Changes to src/test_rtree.c.
︙ | ︙ | |||
436 437 438 439 440 441 442 | *piRes = 1; } return SQLITE_OK; } #endif /* SQLITE_ENABLE_RTREE */ | | | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | *piRes = 1; } return SQLITE_OK; } #endif /* SQLITE_ENABLE_RTREE */ static int SQLITE_TCLAPI register_cube_geom( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_ENABLE_RTREE UNUSED_PARAMETER(clientData); |
︙ | ︙ | |||
464 465 466 467 468 469 470 | if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; rc = sqlite3_rtree_geometry_callback(db, "cube", cube_geom, (void *)&gHere); Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_STATIC); #endif return TCL_OK; } | | | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; rc = sqlite3_rtree_geometry_callback(db, "cube", cube_geom, (void *)&gHere); Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_STATIC); #endif return TCL_OK; } static int SQLITE_TCLAPI register_circle_geom( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #ifndef SQLITE_ENABLE_RTREE UNUSED_PARAMETER(clientData); |
︙ | ︙ |
Changes to src/test_schema.c.
︙ | ︙ | |||
302 303 304 305 306 307 308 | ** Decode a pointer to an sqlite3 object. */ extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); /* ** Register the schema virtual table module. */ | | | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | ** Decode a pointer to an sqlite3 object. */ extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); /* ** Register the schema virtual table module. */ static int SQLITE_TCLAPI register_schema_module( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ sqlite3 *db; if( objc!=2 ){ |
︙ | ︙ |
Changes to src/test_superlock.c.
︙ | ︙ | |||
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif struct InterpAndScript { Tcl_Interp *interp; Tcl_Obj *pScript; }; typedef struct InterpAndScript InterpAndScript; | > > > | | | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif struct InterpAndScript { Tcl_Interp *interp; Tcl_Obj *pScript; }; typedef struct InterpAndScript InterpAndScript; static void SQLITE_TCLAPI superunlock_del(ClientData cd){ sqlite3demo_superunlock((void *)cd); } static int SQLITE_TCLAPI superunlock_cmd( ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ if( objc!=1 ){ Tcl_WrongNumArgs(interp, 1, objv, ""); |
︙ | ︙ | |||
300 301 302 303 304 305 306 | return iVal; } /* ** Tclcmd: sqlite3demo_superlock CMDNAME PATH VFS BUSY-HANDLER-SCRIPT */ | | | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | return iVal; } /* ** Tclcmd: sqlite3demo_superlock CMDNAME PATH VFS BUSY-HANDLER-SCRIPT */ static int SQLITE_TCLAPI superlock_cmd( ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ void *pLock; /* Lock context */ char *zPath; |
︙ | ︙ |
Changes to src/test_syscall.c.
︙ | ︙ | |||
418 419 420 421 422 423 424 | return MAP_FAILED; } va_start(ap, d); pArg = va_arg(ap, void *); return orig_mremap(a, b, c, d, pArg); } | | | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | return MAP_FAILED; } va_start(ap, d); pArg = va_arg(ap, void *); return orig_mremap(a, b, c, d, pArg); } static int SQLITE_TCLAPI test_syscall_install( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_vfs *pVfs; int nElem; |
︙ | ︙ | |||
454 455 456 457 458 459 460 | } aSyscall[iCall].custom_errno = aSyscall[iCall].default_errno; } return TCL_OK; } | | | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | } aSyscall[iCall].custom_errno = aSyscall[iCall].default_errno; } return TCL_OK; } static int SQLITE_TCLAPI test_syscall_uninstall( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_vfs *pVfs; int i; |
︙ | ︙ | |||
478 479 480 481 482 483 484 | pVfs->xSetSystemCall(pVfs, aSyscall[i].zName, 0); aSyscall[i].xOrig = 0; } } return TCL_OK; } | | | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | pVfs->xSetSystemCall(pVfs, aSyscall[i].zName, 0); aSyscall[i].xOrig = 0; } } return TCL_OK; } static int SQLITE_TCLAPI test_syscall_reset( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_vfs *pVfs; int i; |
︙ | ︙ | |||
516 517 518 519 520 521 522 | return TCL_ERROR; } Tcl_ResetResult(interp); return TCL_OK; } | | | | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | return TCL_ERROR; } Tcl_ResetResult(interp); return TCL_OK; } static int SQLITE_TCLAPI test_syscall_exists( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_vfs *pVfs; sqlite3_syscall_ptr x; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } pVfs = sqlite3_vfs_find(0); x = pVfs->xGetSystemCall(pVfs, Tcl_GetString(objv[2])); Tcl_SetObjResult(interp, Tcl_NewBooleanObj(x!=0)); return TCL_OK; } static int SQLITE_TCLAPI test_syscall_fault( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int nCount = 0; int bPersist = 0; |
︙ | ︙ | |||
566 567 568 569 570 571 572 | Tcl_SetObjResult(interp, Tcl_NewIntObj(gSyscall.nFail)); gSyscall.nCount = nCount; gSyscall.bPersist = bPersist; gSyscall.nFail = 0; return TCL_OK; } | | | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | Tcl_SetObjResult(interp, Tcl_NewIntObj(gSyscall.nFail)); gSyscall.nCount = nCount; gSyscall.bPersist = bPersist; gSyscall.nFail = 0; return TCL_OK; } static int SQLITE_TCLAPI test_syscall_errno( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int iCall; int iErrno; |
︙ | ︙ | |||
612 613 614 615 616 617 618 | ); if( rc!=TCL_OK ) return rc; aSyscall[iCall].custom_errno = aErrno[iErrno].i; return TCL_OK; } | | | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 | ); if( rc!=TCL_OK ) return rc; aSyscall[iCall].custom_errno = aErrno[iErrno].i; return TCL_OK; } static int SQLITE_TCLAPI test_syscall_list( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zSys; sqlite3_vfs *pVfs; |
︙ | ︙ | |||
642 643 644 645 646 647 648 | } Tcl_SetObjResult(interp, pList); Tcl_DecrRefCount(pList); return TCL_OK; } | | | 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 | } Tcl_SetObjResult(interp, pList); Tcl_DecrRefCount(pList); return TCL_OK; } static int SQLITE_TCLAPI test_syscall_defaultvfs( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_vfs *pVfs; |
︙ | ︙ | |||
664 665 666 667 668 669 670 | return TCL_OK; } static int ts_getpagesize(void){ return gSyscall.pgsz; } | | | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | return TCL_OK; } static int ts_getpagesize(void){ return gSyscall.pgsz; } static int SQLITE_TCLAPI test_syscall_pagesize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_vfs *pVfs = sqlite3_vfs_find(0); int pgsz; |
︙ | ︙ | |||
699 700 701 702 703 704 705 | pVfs, "getpagesize", (sqlite3_syscall_ptr)ts_getpagesize ); } return TCL_OK; } | | | 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | pVfs, "getpagesize", (sqlite3_syscall_ptr)ts_getpagesize ); } return TCL_OK; } static int SQLITE_TCLAPI test_syscall( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ struct SyscallCmd { const char *zName; |
︙ | ︙ |
Changes to src/test_tclvar.c.
︙ | ︙ | |||
407 408 409 410 411 412 413 | ** Decode a pointer to an sqlite3 object. */ extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); /* ** Register the echo virtual table module. */ | | | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | ** Decode a pointer to an sqlite3 object. */ extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); /* ** Register the echo virtual table module. */ static int SQLITE_TCLAPI register_tclvar_module( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ ){ int rc = TCL_OK; sqlite3 *db; |
︙ | ︙ |
Changes to src/test_thread.c.
︙ | ︙ | |||
72 73 74 75 76 77 78 | extern int getDbPointer(Tcl_Interp *, const char *, sqlite3 **); extern int sqlite3TestMakePointerStr(Tcl_Interp *, char *, void *); extern int sqlite3TestErrCode(Tcl_Interp *, sqlite3 *, int); /* ** Handler for events of type EvalEvent. */ | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | extern int getDbPointer(Tcl_Interp *, const char *, sqlite3 **); extern int sqlite3TestMakePointerStr(Tcl_Interp *, char *, void *); extern int sqlite3TestErrCode(Tcl_Interp *, sqlite3 *, int); /* ** Handler for events of type EvalEvent. */ static int SQLITE_TCLAPI tclScriptEvent(Tcl_Event *evPtr, int flags){ int rc; EvalEvent *p = (EvalEvent *)evPtr; rc = Tcl_Eval(p->interp, p->zScript); if( rc!=TCL_OK ){ Tcl_BackgroundError(p->interp); } UNUSED_PARAMETER(flags); |
︙ | ︙ | |||
167 168 169 170 171 172 173 | ** Spawn a new thread with its own Tcl interpreter and run the ** specified SCRIPT(s) in it. The thread terminates after running ** the script. The result of the script is stored in the variable ** VARNAME. ** ** The caller can wait for the script to terminate using [vwait VARNAME]. */ | | | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | ** Spawn a new thread with its own Tcl interpreter and run the ** specified SCRIPT(s) in it. The thread terminates after running ** the script. The result of the script is stored in the variable ** VARNAME. ** ** The caller can wait for the script to terminate using [vwait VARNAME]. */ static int SQLITE_TCLAPI sqlthread_spawn( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ Tcl_ThreadId x; SqlThread *pNew; |
︙ | ︙ | |||
220 221 222 223 224 225 226 | ** script back to the parent thread for execution. The result of ** evaluating the SCRIPT is returned. The parent thread must enter ** the event loop for this to work - otherwise the caller will ** block indefinitely. ** ** NOTE: At the moment, this doesn't work. FIXME. */ | | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | ** script back to the parent thread for execution. The result of ** evaluating the SCRIPT is returned. The parent thread must enter ** the event loop for this to work - otherwise the caller will ** block indefinitely. ** ** NOTE: At the moment, this doesn't work. FIXME. */ static int SQLITE_TCLAPI sqlthread_parent( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ EvalEvent *pEvent; char *zMsg; |
︙ | ︙ | |||
265 266 267 268 269 270 271 | /* ** sqlthread open ** ** Open a database handle and return the string representation of ** the pointer value. */ | | | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | /* ** sqlthread open ** ** Open a database handle and return the string representation of ** the pointer value. */ static int SQLITE_TCLAPI sqlthread_open( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int sqlite3TestMakePointerStr(Tcl_Interp *interp, char *zPtr, void *p); |
︙ | ︙ | |||
315 316 317 318 319 320 321 | /* ** sqlthread open ** ** Return the current thread-id (Tcl_GetCurrentThread()) cast to ** an integer. */ | | | | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | /* ** sqlthread open ** ** Return the current thread-id (Tcl_GetCurrentThread()) cast to ** an integer. */ static int SQLITE_TCLAPI sqlthread_id( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ Tcl_ThreadId id = Tcl_GetCurrentThread(); Tcl_SetObjResult(interp, Tcl_NewIntObj(SQLITE_PTR_TO_INT(id))); UNUSED_PARAMETER(clientData); UNUSED_PARAMETER(objc); UNUSED_PARAMETER(objv); return TCL_OK; } /* ** Dispatch routine for the sub-commands of [sqlthread]. */ static int SQLITE_TCLAPI sqlthread_proc( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ struct SubCommand { char *zName; |
︙ | ︙ | |||
381 382 383 384 385 386 387 | /* ** The [clock_seconds] command. This is more or less the same as the ** regular tcl [clock seconds], except that it is available in testfixture ** when linked against both Tcl 8.4 and 8.5. Because [clock seconds] is ** implemented as a script in Tcl 8.5, it is not usually available to ** testfixture. */ | | | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | /* ** The [clock_seconds] command. This is more or less the same as the ** regular tcl [clock seconds], except that it is available in testfixture ** when linked against both Tcl 8.4 and 8.5. Because [clock seconds] is ** implemented as a script in Tcl 8.5, it is not usually available to ** testfixture. */ static int SQLITE_TCLAPI clock_seconds_proc( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ Tcl_Time now; Tcl_GetTime(&now); |
︙ | ︙ | |||
543 544 545 546 547 548 549 | /* END_SQLITE_BLOCKING_STEP */ /* ** Usage: sqlite3_blocking_step STMT ** ** Advance the statement to the next row. */ | | | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | /* END_SQLITE_BLOCKING_STEP */ /* ** Usage: sqlite3_blocking_step STMT ** ** Advance the statement to the next row. */ static int SQLITE_TCLAPI blocking_step_proc( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3_stmt *pStmt; |
︙ | ︙ | |||
569 570 571 572 573 574 575 | return TCL_OK; } /* ** Usage: sqlite3_blocking_prepare_v2 DB sql bytes ?tailvar? ** Usage: sqlite3_nonblocking_prepare_v2 DB sql bytes ?tailvar? */ | | | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | return TCL_OK; } /* ** Usage: sqlite3_blocking_prepare_v2 DB sql bytes ?tailvar? ** Usage: sqlite3_nonblocking_prepare_v2 DB sql bytes ?tailvar? */ static int SQLITE_TCLAPI blocking_prepare_v2_proc( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; const char *zSql; |
︙ | ︙ |
Changes to src/test_vfs.c.
︙ | ︙ | |||
1036 1037 1038 1039 1040 1041 1042 | } static int tvfsUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *p){ TestvfsFd *pFd = tvfsGetFd(pFile); return sqlite3OsUnfetch(pFd->pReal, iOfst, p); } | | | 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | } static int tvfsUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *p){ TestvfsFd *pFd = tvfsGetFd(pFile); return sqlite3OsUnfetch(pFd->pReal, iOfst, p); } static int SQLITE_TCLAPI testvfs_obj_cmd( ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ Testvfs *p = (Testvfs *)cd; |
︙ | ︙ | |||
1348 1349 1350 1351 1352 1353 1354 | break; } } return TCL_OK; } | | | 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 | break; } } return TCL_OK; } static void SQLITE_TCLAPI testvfs_obj_del(ClientData cd){ Testvfs *p = (Testvfs *)cd; if( p->pScript ) Tcl_DecrRefCount(p->pScript); sqlite3_vfs_unregister(p->pVfs); ckfree((char *)p->pVfs); ckfree((char *)p); } |
︙ | ︙ | |||
1391 1392 1393 1394 1395 1396 1397 | ** When the xShmLock method is invoked by SQLite, the following script is ** run: ** ** SCRIPT xShmLock FILENAME ID LOCK ** ** where LOCK is of the form "OFFSET NBYTE lock/unlock shared/exclusive" */ | | | 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 | ** When the xShmLock method is invoked by SQLite, the following script is ** run: ** ** SCRIPT xShmLock FILENAME ID LOCK ** ** where LOCK is of the form "OFFSET NBYTE lock/unlock shared/exclusive" */ static int SQLITE_TCLAPI testvfs_cmd( ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ static sqlite3_vfs tvfs_vfs = { 3, /* iVersion */ |
︙ | ︙ |