Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge the ORDER BY LIMIT fix, and other enhancements, from trunk. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | apple-osx |
Files: | files | file ages | folders |
SHA1: |
bf5a9542d0600062651aedc6d2543ce7 |
User & Date: | drh 2016-08-04 09:13:42.493 |
Context
2016-08-04
| ||
12:33 | Add the experimental SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION compile-time option. When enabled, the "unknown function" error is suppressed for EXPLAIN and a no-op function named "unknown()" is substituted. This facilitiates using the command-line shell to analyze queries from applications that contain many application-defined functions that are not normally available to the shell. (check-in: e22ca3cdd0 user: drh tags: apple-osx) | |
09:13 | Merge the ORDER BY LIMIT fix, and other enhancements, from trunk. (check-in: bf5a9542d0 user: drh tags: apple-osx) | |
09:09 | Make sure the ORDER BY LIMIT optimization is not applied if the inner-most loop can only have a single iteration and is hence not really a loop. (check-in: 13e3bd3de6 user: drh tags: trunk) | |
2016-07-28
| ||
18:42 | Merge recent trunk fixes. (check-in: 9765744586 user: drh tags: apple-osx) | |
Changes
Changes to Makefile.msc.
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # <</mark>> # Set this non-0 to enable full warnings (-W4, etc) when compiling. # !IFNDEF USE_FULLWARN USE_FULLWARN = 0 !ENDIF # Set this non-0 to use "stdcall" calling convention for the core library # and shell executable. # !IFNDEF USE_STDCALL USE_STDCALL = 0 !ENDIF | > > > > > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # <</mark>> # Set this non-0 to enable full warnings (-W4, etc) when compiling. # !IFNDEF USE_FULLWARN USE_FULLWARN = 0 !ENDIF # Set this non-0 to enable full runtime error checks (-RTC1, etc). This # has no effect if (any) optimizations are enabled. # !IFNDEF USE_RUNTIME_CHECKS USE_RUNTIME_CHECKS = 0 !ENDIF # Set this non-0 to use "stdcall" calling convention for the core library # and shell executable. # !IFNDEF USE_STDCALL USE_STDCALL = 0 !ENDIF |
︙ | ︙ | |||
460 461 462 463 464 465 466 | # also be noted here that building any target with these "stdcall" options # will most likely fail if the Tcl library is also required. This is due # to how the Tcl library functions are declared and exported (i.e. without # an explicit calling convention, which results in "cdecl"). # !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0 !IF "$(PLATFORM)"=="x86" | | | > > > | | > > > > > > > > > | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | # also be noted here that building any target with these "stdcall" options # will most likely fail if the Tcl library is also required. This is due # to how the Tcl library functions are declared and exported (i.e. without # an explicit calling convention, which results in "cdecl"). # !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0 !IF "$(PLATFORM)"=="x86" CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall # <<mark>> TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl # <</mark>> !ELSE !IFNDEF PLATFORM CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall # <<mark>> TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl # <</mark>> !ELSE CORE_CCONV_OPTS = SHELL_CCONV_OPTS = # <<mark>> TEST_CCONV_OPTS = # <</mark>> !ENDIF !ENDIF !ELSE CORE_CCONV_OPTS = SHELL_CCONV_OPTS = # <<mark>> TEST_CCONV_OPTS = # <</mark>> !ENDIF # These are additional compiler options used for the core library. # !IFNDEF CORE_COMPILE_OPTS !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0 CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport) |
︙ | ︙ | |||
831 832 833 834 835 836 837 838 839 840 841 842 843 844 | # If optimizations are enabled or disabled (either implicitly or # explicitly), add the necessary flags. # !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0 TCC = $(TCC) -Od BCC = $(BCC) -Od !ELSEIF $(OPTIMIZATIONS)>=3 TCC = $(TCC) -Ox BCC = $(BCC) -Ox !ELSEIF $(OPTIMIZATIONS)==2 TCC = $(TCC) -O2 BCC = $(BCC) -O2 !ELSEIF $(OPTIMIZATIONS)==1 | > > > > | 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | # If optimizations are enabled or disabled (either implicitly or # explicitly), add the necessary flags. # !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0 TCC = $(TCC) -Od BCC = $(BCC) -Od !IF $(USE_RUNTIME_CHECKS)!=0 TCC = $(TCC) -RTC1 BCC = $(BCC) -RTC1 !ENDIF !ELSEIF $(OPTIMIZATIONS)>=3 TCC = $(TCC) -Ox BCC = $(BCC) -Ox !ELSEIF $(OPTIMIZATIONS)==2 TCC = $(TCC) -O2 BCC = $(BCC) -O2 !ELSEIF $(OPTIMIZATIONS)==1 |
︙ | ︙ | |||
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 | # Generated header files # SRC11 = \ keywordhash.h \ opcodes.h \ parse.h \ $(SQLITE3H) # All source code files. # SRC = $(SRC00) $(SRC01) $(SRC02) $(SRC03) $(SRC04) $(SRC05) $(SRC06) $(SRC07) $(SRC08) $(SRC09) $(SRC10) $(SRC11) # Source code to the test files. # | > > > > > > | 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 | # Generated header files # SRC11 = \ keywordhash.h \ opcodes.h \ parse.h \ $(SQLITE3H) # Generated Tcl header files # SRC12 = \ sqlite_tcl.h \ sqlite_tclDecls.h # All source code files. # SRC = $(SRC00) $(SRC01) $(SRC02) $(SRC03) $(SRC04) $(SRC05) $(SRC06) $(SRC07) $(SRC08) $(SRC09) $(SRC10) $(SRC11) # Source code to the test files. # |
︙ | ︙ | |||
1337 1338 1339 1340 1341 1342 1343 | $(TOP)\src\os_setup.h \ $(TOP)\src\os_win.h \ $(TOP)\src\pager.h \ $(TOP)\src\pcache.h \ parse.h \ $(TOP)\src\pragma.h \ $(SQLITE3H) \ | | | 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 | $(TOP)\src\os_setup.h \ $(TOP)\src\os_win.h \ $(TOP)\src\pager.h \ $(TOP)\src\pcache.h \ parse.h \ $(TOP)\src\pragma.h \ $(SQLITE3H) \ sqlite3ext.h \ $(TOP)\src\sqliteInt.h \ $(TOP)\src\sqliteLimit.h \ $(TOP)\src\vdbe.h \ $(TOP)\src\vdbeInt.h \ $(TOP)\src\vxworks.h \ $(TOP)\src\whereInt.h |
︙ | ︙ | |||
1495 1496 1497 1498 1499 1500 1501 | # This target creates a directory named "tsrc" and fills it with # copies of all of the C source code and header files needed to # build on the target system. Some of the C source code and header # files are automatically generated. This target takes care of # all that automatic generation. # | | > | 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 | # This target creates a directory named "tsrc" and fills it with # copies of all of the C source code and header files needed to # build on the target system. Some of the C source code and header # files are automatically generated. This target takes care of # all that automatic generation. # .target_source: $(SRC) $(TOP)\tool\vdbe-compress.tcl fts5.c sqlite_tcl.h -rmdir /Q/S tsrc 2>NUL -mkdir tsrc for %i in ($(SRC00)) do copy /Y %i tsrc for %i in ($(SRC01)) do copy /Y %i tsrc for %i in ($(SRC02)) do copy /Y %i tsrc for %i in ($(SRC03)) do copy /Y %i tsrc for %i in ($(SRC04)) do copy /Y %i tsrc for %i in ($(SRC05)) do copy /Y %i tsrc for %i in ($(SRC06)) do copy /Y %i tsrc for %i in ($(SRC07)) do copy /Y %i tsrc for %i in ($(SRC08)) do copy /Y %i tsrc for %i in ($(SRC09)) do copy /Y %i tsrc for %i in ($(SRC10)) do copy /Y %i tsrc for %i in ($(SRC11)) do copy /Y %i tsrc for %i in ($(SRC12)) do copy /Y %i tsrc copy /Y fts5.c tsrc copy /Y fts5.h tsrc del /Q tsrc\sqlite.h.in tsrc\parse.y 2>NUL $(TCLSH_CMD) $(TOP)\tool\vdbe-compress.tcl $(OPTS) < tsrc\vdbe.c > vdbe.new move vdbe.new tsrc\vdbe.c echo > .target_source |
︙ | ︙ | |||
1791 1792 1793 1794 1795 1796 1797 | wherecode.lo: $(TOP)\src\wherecode.c $(HDR) $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\wherecode.c whereexpr.lo: $(TOP)\src\whereexpr.c $(HDR) $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\whereexpr.c | | | | 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 | wherecode.lo: $(TOP)\src\wherecode.c $(HDR) $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\wherecode.c whereexpr.lo: $(TOP)\src\whereexpr.c $(HDR) $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\whereexpr.c tclsqlite.lo: $(TOP)\src\tclsqlite.c $(HDR) sqlite_tcl.h $(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c tclsqlite-shell.lo: $(TOP)\src\tclsqlite.c $(HDR) sqlite_tcl.h $(LTCOMPILE) $(NO_WARN) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c tclsqlite3.exe: tclsqlite-shell.lo $(SQLITE3C) $(SQLITE3H) $(LIBRESOBJS) $(LTLINK) $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite-shell.lo $(LIBRESOBJS) $(LTLIBS) $(TLIBS) # Rules to build opcodes.c and opcodes.h # |
︙ | ︙ | |||
1823 1824 1825 1826 1827 1828 1829 | move parse.h parse.h.temp $(TCLSH_CMD) $(TOP)\tool\addopcodes.tcl parse.h.temp > parse.h $(SQLITE3H): $(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION $(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > $(SQLITE3H) sqlite3ext.h: .target_source | > > | | 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 | move parse.h parse.h.temp $(TCLSH_CMD) $(TOP)\tool\addopcodes.tcl parse.h.temp > parse.h $(SQLITE3H): $(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION $(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > $(SQLITE3H) sqlite3ext.h: .target_source type tsrc\sqlite3ext.h | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*\)" "(SQLITE_CALLBACK *)" \ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*" "(SQLITE_APICALL *" > sqlite3ext.h copy /Y sqlite3ext.h tsrc\sqlite3ext.h mkkeywordhash.exe: $(TOP)\tool\mkkeywordhash.c $(BCC) $(NO_WARN) -Fe$@ $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) \ $(TOP)\tool\mkkeywordhash.c /link $(LDFLAGS) $(NLTLINKOPTS) $(NLTLIBPATHS) keywordhash.h: $(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe .\mkkeywordhash.exe > keywordhash.h |
︙ | ︙ | |||
1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 | # hidden when the library is built via the amalgamation). # TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN) TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024 TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C) !IF $(USE_AMALGAMATION)==0 TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0) !ELSE TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1) !ENDIF | > > > > > > > > > > > > > > > > > > > | | 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 | # hidden when the library is built via the amalgamation). # TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN) TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) $(TEST_CCONV_OPTS) TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C) !IF $(USE_AMALGAMATION)==0 TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0) !ELSE TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1) !ENDIF sqlite_tclDecls.h: echo #ifndef SQLITE_TCLAPI > sqlite_tclDecls.h echo # define SQLITE_TCLAPI >> sqlite_tclDecls.h echo #endif >> sqlite_tclDecls.h type "$(TCLINCDIR)\tclDecls.h" \ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "^(EXTERN(?: CONST\d+?)?\s+?[^\(]*?\s+?)Tcl_" "\1 SQLITE_TCLAPI Tcl_" \ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "^(EXTERN\s+?(?:void|VOID)\s+?)TclFreeObj" "\1 SQLITE_TCLAPI TclFreeObj" \ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*tcl_" "(SQLITE_TCLAPI *tcl_" \ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*tclFreeObj" "(SQLITE_TCLAPI *tclFreeObj" \ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*" "(SQLITE_TCLAPI *" >> sqlite_tclDecls.h sqlite_tcl.h: sqlite_tclDecls.h type "$(TCLINCDIR)\tcl.h" | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact tclDecls.h sqlite_tclDecls.h \ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "typedef (.*?)\(Tcl_" "typedef \1 (SQLITE_TCLAPI Tcl_" \ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "void (*freeProc)" "void (SQLITE_TCLAPI *freeProc)" \ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "Tcl_HashEntry *(*findProc)" "Tcl_HashEntry *(SQLITE_TCLAPI *findProc)" \ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "Tcl_HashEntry *(*createProc)" "Tcl_HashEntry *(SQLITE_TCLAPI *createProc)" >> sqlite_tcl.h testfixture.exe: $(TESTFIXTURE_SRC) $(SQLITE3H) $(LIBRESOBJS) $(HDR) sqlite_tcl.h $(LTLINK) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \ -DBUILD_sqlite -I$(TCLINCDIR) \ $(TESTFIXTURE_SRC) \ /link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) extensiontest: testfixture.exe testloadext.dll @set PATH=$(LIBTCLPATH);$(PATH) |
︙ | ︙ | |||
2014 2015 2016 2017 2018 2019 2020 | @set PATH=$(LIBTCLPATH);$(PATH) .\testfixture.exe $(TOP)\test\veryquick.test $(TESTOPTS) smoketest: $(TESTPROGS) @set PATH=$(LIBTCLPATH);$(PATH) .\testfixture.exe $(TOP)\test\main.test $(TESTOPTS) | | | 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 | @set PATH=$(LIBTCLPATH);$(PATH) .\testfixture.exe $(TOP)\test\veryquick.test $(TESTOPTS) smoketest: $(TESTPROGS) @set PATH=$(LIBTCLPATH);$(PATH) .\testfixture.exe $(TOP)\test\main.test $(TESTOPTS) sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl sqlite_tcl.h echo #define TCLSH 2 > $@ echo #define SQLITE_ENABLE_DBSTAT_VTAB 1 >> $@ copy $@ + $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@ echo static const char *tclsh_main_loop(void){ >> $@ echo static const char *zMainloop = >> $@ $(TCLSH_CMD) $(TOP)\tool\tostr.tcl $(TOP)\tool\spaceanal.tcl >> $@ echo ; return zMainloop; } >> $@ |
︙ | ︙ | |||
2094 2095 2096 2097 2098 2099 2100 | del /Q lemon.* lempar.c parse.* 2>NUL del /Q mkkeywordhash.* keywordhash.h 2>NUL del /Q notasharedlib.* 2>NUL -rmdir /Q/S .deps 2>NUL -rmdir /Q/S .libs 2>NUL -rmdir /Q/S tsrc 2>NUL del /Q .target_source 2>NUL | | | 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 | del /Q lemon.* lempar.c parse.* 2>NUL del /Q mkkeywordhash.* keywordhash.h 2>NUL del /Q notasharedlib.* 2>NUL -rmdir /Q/S .deps 2>NUL -rmdir /Q/S .libs 2>NUL -rmdir /Q/S tsrc 2>NUL del /Q .target_source 2>NUL del /Q tclsqlite3.exe sqlite_tcl.h sqlite_tclDecls.h 2>NUL del /Q testloadext.dll 2>NUL del /Q testfixture.exe test.db 2>NUL del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe 2>NUL del /Q changeset.exe 2>NUL del /Q showjournal.exe showstat4.exe showwal.exe speedtest1.exe 2>NUL del /Q mptester.exe wordcount.exe rbu.exe srcck1.exe 2>NUL del /Q sqlite3.c sqlite3-*.c 2>NUL |
︙ | ︙ |
Changes to autoconf/Makefile.msc.
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Set this non-0 to enable full warnings (-W4, etc) when compiling. # !IFNDEF USE_FULLWARN USE_FULLWARN = 0 !ENDIF # Set this non-0 to use "stdcall" calling convention for the core library # and shell executable. # !IFNDEF USE_STDCALL USE_STDCALL = 0 !ENDIF | > > > > > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # Set this non-0 to enable full warnings (-W4, etc) when compiling. # !IFNDEF USE_FULLWARN USE_FULLWARN = 0 !ENDIF # Set this non-0 to enable full runtime error checks (-RTC1, etc). This # has no effect if (any) optimizations are enabled. # !IFNDEF USE_RUNTIME_CHECKS USE_RUNTIME_CHECKS = 0 !ENDIF # Set this non-0 to use "stdcall" calling convention for the core library # and shell executable. # !IFNDEF USE_STDCALL USE_STDCALL = 0 !ENDIF |
︙ | ︙ | |||
445 446 447 448 449 450 451 | # also be noted here that building any target with these "stdcall" options # will most likely fail if the Tcl library is also required. This is due # to how the Tcl library functions are declared and exported (i.e. without # an explicit calling convention, which results in "cdecl"). # !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0 !IF "$(PLATFORM)"=="x86" | | | | | | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | # also be noted here that building any target with these "stdcall" options # will most likely fail if the Tcl library is also required. This is due # to how the Tcl library functions are declared and exported (i.e. without # an explicit calling convention, which results in "cdecl"). # !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0 !IF "$(PLATFORM)"=="x86" CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall !ELSE !IFNDEF PLATFORM CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall !ELSE CORE_CCONV_OPTS = SHELL_CCONV_OPTS = !ENDIF !ENDIF !ELSE CORE_CCONV_OPTS = |
︙ | ︙ | |||
736 737 738 739 740 741 742 743 744 745 746 747 748 749 | # If optimizations are enabled or disabled (either implicitly or # explicitly), add the necessary flags. # !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0 TCC = $(TCC) -Od BCC = $(BCC) -Od !ELSEIF $(OPTIMIZATIONS)>=3 TCC = $(TCC) -Ox BCC = $(BCC) -Ox !ELSEIF $(OPTIMIZATIONS)==2 TCC = $(TCC) -O2 BCC = $(BCC) -O2 !ELSEIF $(OPTIMIZATIONS)==1 | > > > > | 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | # If optimizations are enabled or disabled (either implicitly or # explicitly), add the necessary flags. # !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0 TCC = $(TCC) -Od BCC = $(BCC) -Od !IF $(USE_RUNTIME_CHECKS)!=0 TCC = $(TCC) -RTC1 BCC = $(BCC) -RTC1 !ENDIF !ELSEIF $(OPTIMIZATIONS)>=3 TCC = $(TCC) -Ox BCC = $(BCC) -Ox !ELSEIF $(OPTIMIZATIONS)==2 TCC = $(TCC) -O2 BCC = $(BCC) -O2 !ELSEIF $(OPTIMIZATIONS)==1 |
︙ | ︙ |
Changes to ext/fts2/fts2_tokenizer.c.
︙ | ︙ | |||
95 96 97 98 99 100 101 | } sqlite3_result_blob(context, (void *)&pPtr, sizeof(pPtr), SQLITE_TRANSIENT); } #ifdef SQLITE_TEST | > > > | > | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | } sqlite3_result_blob(context, (void *)&pPtr, sizeof(pPtr), SQLITE_TRANSIENT); } #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <string.h> /* ** Implementation of a special SQL scalar function for testing tokenizers ** designed to be used in concert with the Tcl testing framework. This ** function must be called with two arguments: ** |
︙ | ︙ |
Changes to ext/fts3/fts3_test.c.
︙ | ︙ | |||
14 15 16 17 18 19 20 | ** testing. It contains a Tcl command that can be used to test if a document ** matches an FTS NEAR expression. ** ** As of March 2012, it also contains a version 1 tokenizer used for testing ** that the sqlite3_tokenizer_module.xLanguage() method is invoked correctly. */ | > > > | > > > > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ** testing. It contains a Tcl command that can be used to test if a document ** matches an FTS NEAR expression. ** ** As of March 2012, it also contains a version 1 tokenizer used for testing ** 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) /* Required so that the "ifdef SQLITE_ENABLE_FTS3" below works */ |
︙ | ︙ | |||
139 140 141 142 143 144 145 | 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; |
︙ | ︙ | |||
274 275 276 277 278 279 280 | ** 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; |
︙ | ︙ | |||
484 485 486 487 488 489 490 | 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 = { |
︙ | ︙ | |||
513 514 515 516 517 518 519 | (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 ext/fts3/fts3_tokenizer.c.
︙ | ︙ | |||
220 221 222 223 224 225 226 | sqlite3_free(zCopy); return rc; } #ifdef SQLITE_TEST | > > > | > | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | sqlite3_free(zCopy); return rc; } #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <string.h> /* ** Implementation of a special SQL scalar function for testing tokenizers ** designed to be used in concert with the Tcl testing framework. This ** function must be called with two or more arguments: ** |
︙ | ︙ |
Changes to ext/fts5/fts5_tcl.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ****************************************************************************** ** */ #ifdef SQLITE_TEST | > > > | > > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ** ****************************************************************************** ** */ #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 #ifdef SQLITE_ENABLE_FTS5 #include "fts5.h" #include <string.h> #include <assert.h> |
︙ | ︙ | |||
74 75 76 77 78 79 80 | return aErr[i].rc; } } return SQLITE_ERROR; } | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | return aErr[i].rc; } } return SQLITE_ERROR; } static int SQLITE_TCLAPI f5tDbAndApi( Tcl_Interp *interp, Tcl_Obj *pObj, sqlite3 **ppDb, fts5_api **ppApi ){ sqlite3 *db = 0; int rc = f5tDbPointer(interp, pObj, &db); |
︙ | ︙ | |||
160 161 162 163 164 165 166 | if( rc==TCL_OK ){ rc = f5tResultToErrorCode(Tcl_GetStringResult(p->interp)); } return rc; } | | | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | if( rc==TCL_OK ){ rc = f5tResultToErrorCode(Tcl_GetStringResult(p->interp)); } return rc; } static int SQLITE_TCLAPI xF5tApi(void*, Tcl_Interp*, int, Tcl_Obj *CONST []); static int xQueryPhraseCb( const Fts5ExtensionApi *pApi, Fts5Context *pFts, void *pCtx ){ F5tFunction *p = (F5tFunction*)pCtx; |
︙ | ︙ | |||
205 206 207 208 209 210 211 | } /* ** api sub-command... ** ** Description... */ | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | } /* ** api sub-command... ** ** Description... */ static int SQLITE_TCLAPI xF5tApi( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ struct Sub { const char *zName; |
︙ | ︙ | |||
598 599 600 601 602 603 604 | } /* ** sqlite3_fts5_create_function DB NAME SCRIPT ** ** Description... */ | | | 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | } /* ** sqlite3_fts5_create_function DB NAME SCRIPT ** ** Description... */ static int SQLITE_TCLAPI f5tCreateFunction( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ char *zName; Tcl_Obj *pScript; |
︙ | ︙ | |||
668 669 670 671 672 673 674 | /* ** sqlite3_fts5_tokenize DB TOKENIZER TEXT ** ** Description... */ | | | 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 | /* ** sqlite3_fts5_tokenize DB TOKENIZER TEXT ** ** Description... */ static int SQLITE_TCLAPI f5tTokenize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ char *zText; int nText; |
︙ | ︙ | |||
874 875 876 877 878 879 880 | pInst->pContext->xToken = xOldToken; return rc; } /* ** sqlite3_fts5_token ?-colocated? TEXT START END */ | | | 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | pInst->pContext->xToken = xOldToken; return rc; } /* ** sqlite3_fts5_token ?-colocated? TEXT START END */ static int SQLITE_TCLAPI f5tTokenizerReturn( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ F5tTokenizerContext *p = (F5tTokenizerContext*)clientData; int iStart; |
︙ | ︙ | |||
945 946 947 948 949 950 951 | ** tokenizer instance "returned" by SCRIPT. Specifically, to tokenize ** text SCRIPT2 is invoked with a single argument appended to it - the ** text to tokenize. ** ** SCRIPT2 should invoke the [sqlite3_fts5_token] command once for each ** token within the tokenized text. */ | | | 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | ** tokenizer instance "returned" by SCRIPT. Specifically, to tokenize ** text SCRIPT2 is invoked with a single argument appended to it - the ** text to tokenize. ** ** SCRIPT2 should invoke the [sqlite3_fts5_token] command once for each ** token within the tokenized text. */ static int SQLITE_TCLAPI f5tCreateTokenizer( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ F5tTokenizerContext *pContext = (F5tTokenizerContext*)clientData; sqlite3 *db; |
︙ | ︙ | |||
988 989 990 991 992 993 994 | Tcl_AppendResult(interp, "error in fts5_api.xCreateTokenizer()", 0); return TCL_ERROR; } return TCL_OK; } | | | | 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | Tcl_AppendResult(interp, "error in fts5_api.xCreateTokenizer()", 0); return TCL_ERROR; } return TCL_OK; } static void SQLITE_TCLAPI xF5tFree(ClientData clientData){ ckfree(clientData); } /* ** sqlite3_fts5_may_be_corrupt BOOLEAN ** ** Set or clear the global "may-be-corrupt" flag. Return the old value. */ static int SQLITE_TCLAPI f5tMayBeCorrupt( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int bOld = sqlite3_fts5_may_be_corrupt; |
︙ | ︙ | |||
1029 1030 1031 1032 1033 1034 1035 | unsigned int h = 13; for(i=n-1; i>=0; i--){ h = (h << 3) ^ h ^ p[i]; } return (h % nSlot); } | | | 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | unsigned int h = 13; for(i=n-1; i>=0; i--){ h = (h << 3) ^ h ^ p[i]; } return (h % nSlot); } static int SQLITE_TCLAPI f5tTokenHash( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ char *z; int n; |
︙ | ︙ | |||
1054 1055 1056 1057 1058 1059 1060 | z = Tcl_GetStringFromObj(objv[2], &n); iVal = f5t_fts5HashKey(nSlot, z, n); Tcl_SetObjResult(interp, Tcl_NewIntObj(iVal)); return TCL_OK; } | | | 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 | z = Tcl_GetStringFromObj(objv[2], &n); iVal = f5t_fts5HashKey(nSlot, z, n); Tcl_SetObjResult(interp, Tcl_NewIntObj(iVal)); return TCL_OK; } static int SQLITE_TCLAPI f5tRegisterMatchinfo( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; sqlite3 *db = 0; |
︙ | ︙ | |||
1079 1080 1081 1082 1083 1084 1085 | if( rc!=SQLITE_OK ){ Tcl_SetResult(interp, (char*)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_ERROR; } return TCL_OK; } | | | 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 | if( rc!=SQLITE_OK ){ Tcl_SetResult(interp, (char*)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_ERROR; } return TCL_OK; } static int SQLITE_TCLAPI f5tRegisterTok( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; sqlite3 *db = 0; |
︙ | ︙ |
Changes to ext/misc/json1.c.
︙ | ︙ | |||
1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 | */ static void jsonQuoteFunc( sqlite3_context *ctx, int argc, sqlite3_value **argv ){ JsonString jx; jsonInit(&jx, ctx); jsonAppendValue(&jx, argv[0]); jsonResult(&jx); sqlite3_result_subtype(ctx, JSON_SUBTYPE); } | > | 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 | */ static void jsonQuoteFunc( sqlite3_context *ctx, int argc, sqlite3_value **argv ){ JsonString jx; UNUSED_PARAM(argc); jsonInit(&jx, ctx); jsonAppendValue(&jx, argv[0]); jsonResult(&jx); sqlite3_result_subtype(ctx, JSON_SUBTYPE); } |
︙ | ︙ |
Changes to ext/misc/percentile.c.
︙ | ︙ | |||
163 164 165 166 167 168 169 | } p->a[p->nUsed++] = y; } /* ** Compare to doubles for sorting using qsort() */ | | | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | } p->a[p->nUsed++] = y; } /* ** Compare to doubles for sorting using qsort() */ static int SQLITE_CDECL doubleCmp(const void *pA, const void *pB){ double a = *(double*)pA; double b = *(double*)pB; if( a==b ) return 0; if( a<b ) return -1; return +1; } |
︙ | ︙ |
Changes to ext/misc/spellfix.c.
︙ | ︙ | |||
2227 2228 2229 2230 2231 2232 2233 | return iDistance + 32 - iLog2; } /* ** Compare two spellfix1_row objects for sorting purposes in qsort() such ** that they sort in order of increasing distance. */ | | | 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 | return iDistance + 32 - iLog2; } /* ** Compare two spellfix1_row objects for sorting purposes in qsort() such ** that they sort in order of increasing distance. */ static int SQLITE_CDECL spellfix1RowCompare(const void *A, const void *B){ const struct spellfix1_row *a = (const struct spellfix1_row*)A; const struct spellfix1_row *b = (const struct spellfix1_row*)B; return a->iScore - b->iScore; } /* ** A structure used to pass information from spellfix1FilterForMatch() |
︙ | ︙ |
Changes to ext/misc/vfsstat.c.
︙ | ︙ | |||
805 806 807 808 809 810 811 | ){ int rc = SQLITE_OK; SQLITE_EXTENSION_INIT2(pApi); vstat_vfs.pVfs = sqlite3_vfs_find(0); vstat_vfs.base.szOsFile = sizeof(VStatFile) + vstat_vfs.pVfs->szOsFile; rc = sqlite3_vfs_register(&vstat_vfs.base, 1); if( rc==SQLITE_OK ){ | | | 805 806 807 808 809 810 811 812 813 814 815 816 | ){ int rc = SQLITE_OK; SQLITE_EXTENSION_INIT2(pApi); vstat_vfs.pVfs = sqlite3_vfs_find(0); vstat_vfs.base.szOsFile = sizeof(VStatFile) + vstat_vfs.pVfs->szOsFile; rc = sqlite3_vfs_register(&vstat_vfs.base, 1); if( rc==SQLITE_OK ){ rc = sqlite3_auto_extension(vstatRegister); } if( rc==SQLITE_OK ) rc = SQLITE_OK_LOAD_PERMANENTLY; return rc; } |
Changes to ext/rbu/test_rbu.c.
︙ | ︙ | |||
13 14 15 16 17 18 19 | #include "sqlite3.h" #if defined(SQLITE_TEST) #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) #include "sqlite3rbu.h" | > > > | > > > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include "sqlite3.h" #if defined(SQLITE_TEST) #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) #include "sqlite3rbu.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif #include <assert.h> /* From main.c */ extern const char *sqlite3ErrName(int); extern int sqlite3TestMakePointerStr(Tcl_Interp*, char*, void*); void test_rbu_delta(sqlite3_context *pCtx, int nArg, sqlite3_value **apVal){ |
︙ | ︙ | |||
45 46 47 48 49 50 51 | Tcl_BackgroundError(interp); } Tcl_DecrRefCount(pScript); } | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | Tcl_BackgroundError(interp); } Tcl_DecrRefCount(pScript); } static int SQLITE_TCLAPI test_sqlite3rbu_cmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int ret = TCL_OK; sqlite3rbu *pRbu = (sqlite3rbu*)clientData; |
︙ | ︙ | |||
188 189 190 191 192 193 194 | return ret; } /* ** Tclcmd: sqlite3rbu CMD <target-db> <rbu-db> ?<state-db>? */ | | | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | return ret; } /* ** Tclcmd: sqlite3rbu CMD <target-db> <rbu-db> ?<state-db>? */ static int SQLITE_TCLAPI test_sqlite3rbu( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3rbu *pRbu = 0; const char *zCmd; |
︙ | ︙ | |||
218 219 220 221 222 223 224 | Tcl_SetObjResult(interp, objv[1]); return TCL_OK; } /* ** Tclcmd: sqlite3rbu_vacuum CMD <target-db> <state-db> */ | | | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | Tcl_SetObjResult(interp, objv[1]); return TCL_OK; } /* ** Tclcmd: sqlite3rbu_vacuum CMD <target-db> <state-db> */ static int SQLITE_TCLAPI test_sqlite3rbu_vacuum( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3rbu *pRbu = 0; const char *zCmd; |
︙ | ︙ | |||
246 247 248 249 250 251 252 | Tcl_SetObjResult(interp, objv[1]); return TCL_OK; } /* ** Tclcmd: sqlite3rbu_create_vfs ?-default? NAME PARENT */ | | | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | Tcl_SetObjResult(interp, objv[1]); return TCL_OK; } /* ** Tclcmd: sqlite3rbu_create_vfs ?-default? NAME PARENT */ static int SQLITE_TCLAPI test_sqlite3rbu_create_vfs( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zName; const char *zParent; |
︙ | ︙ | |||
281 282 283 284 285 286 287 | Tcl_ResetResult(interp); return TCL_OK; } /* ** Tclcmd: sqlite3rbu_destroy_vfs NAME */ | | | | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | Tcl_ResetResult(interp); return TCL_OK; } /* ** Tclcmd: sqlite3rbu_destroy_vfs NAME */ static int SQLITE_TCLAPI test_sqlite3rbu_destroy_vfs( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const char *zName; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "NAME"); return TCL_ERROR; } zName = Tcl_GetString(objv[1]); sqlite3rbu_destroy_vfs(zName); return TCL_OK; } /* ** Tclcmd: sqlite3rbu_internal_test */ static int SQLITE_TCLAPI test_sqlite3rbu_internal_test( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; |
︙ | ︙ | |||
343 344 345 346 347 348 349 | for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ Tcl_CreateObjCommand(interp, aObjCmd[i].zName, aObjCmd[i].xProc, 0, 0); } return TCL_OK; } #else | > > > | > | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ Tcl_CreateObjCommand(interp, aObjCmd[i].zName, aObjCmd[i].xProc, 0, 0); } return TCL_OK; } #else #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif int SqliteRbu_Init(Tcl_Interp *interp){ return TCL_OK; } #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) */ #endif /* defined(SQLITE_TEST) */ |
Changes to ext/session/test_session.c.
1 2 3 4 5 6 7 | #if defined(SQLITE_TEST) && defined(SQLITE_ENABLE_SESSION) \ && defined(SQLITE_ENABLE_PREUPDATE_HOOK) #include "sqlite3session.h" #include <assert.h> #include <string.h> | > > > | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #if defined(SQLITE_TEST) && defined(SQLITE_ENABLE_SESSION) \ && defined(SQLITE_ENABLE_PREUPDATE_HOOK) #include "sqlite3session.h" #include <assert.h> #include <string.h> #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" # ifndef SQLITE_TCLAPI # define SQLITE_TCLAPI # endif #endif typedef struct TestSession TestSession; struct TestSession { sqlite3_session *pSession; Tcl_Interp *interp; Tcl_Obj *pFilterScript; }; |
︙ | ︙ | |||
103 104 105 106 107 108 109 | ** $session changeset ** $session delete ** $session enable BOOL ** $session indirect INTEGER ** $session patchset ** $session table_filter SCRIPT */ | | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | ** $session changeset ** $session delete ** $session enable BOOL ** $session indirect INTEGER ** $session patchset ** $session table_filter SCRIPT */ static int SQLITE_TCLAPI test_session_cmd( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ TestSession *p = (TestSession*)clientData; sqlite3_session *pSession = p->pSession; |
︙ | ︙ | |||
236 237 238 239 240 241 242 | break; } } return TCL_OK; } | | | | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | break; } } return TCL_OK; } static void SQLITE_TCLAPI test_session_del(void *clientData){ TestSession *p = (TestSession*)clientData; if( p->pFilterScript ) Tcl_DecrRefCount(p->pFilterScript); sqlite3session_delete(p->pSession); ckfree((char*)p); } /* ** Tclcmd: sqlite3session CMD DB-HANDLE DB-NAME */ static int SQLITE_TCLAPI test_sqlite3session( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; Tcl_CmdInfo info; |
︙ | ︙ | |||
602 603 604 605 606 607 608 | return SQLITE_OK; } /* ** sqlite3changeset_apply DB CHANGESET CONFLICT-SCRIPT ?FILTER-SCRIPT? */ | | | 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | return SQLITE_OK; } /* ** sqlite3changeset_apply DB CHANGESET CONFLICT-SCRIPT ?FILTER-SCRIPT? */ static int SQLITE_TCLAPI test_sqlite3changeset_apply( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; /* Database handle */ Tcl_CmdInfo info; /* Database Tcl command (objv[1]) info */ |
︙ | ︙ | |||
657 658 659 660 661 662 663 | Tcl_ResetResult(interp); return TCL_OK; } /* ** sqlite3changeset_apply_replace_all DB CHANGESET */ | | | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | Tcl_ResetResult(interp); return TCL_OK; } /* ** sqlite3changeset_apply_replace_all DB CHANGESET */ static int SQLITE_TCLAPI test_sqlite3changeset_apply_replace_all( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ sqlite3 *db; /* Database handle */ Tcl_CmdInfo info; /* Database Tcl command (objv[1]) info */ |
︙ | ︙ | |||
692 693 694 695 696 697 698 | return TCL_OK; } /* ** sqlite3changeset_invert CHANGESET */ | | | 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | return TCL_OK; } /* ** sqlite3changeset_invert CHANGESET */ static int SQLITE_TCLAPI test_sqlite3changeset_invert( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; /* Return code from changeset_invert() */ TestStreamInput sIn; /* Input stream */ |
︙ | ︙ | |||
731 732 733 734 735 736 737 | sqlite3_free(sOut.p); return rc; } /* ** sqlite3changeset_concat LEFT RIGHT */ | | | 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | sqlite3_free(sOut.p); return rc; } /* ** sqlite3changeset_concat LEFT RIGHT */ static int SQLITE_TCLAPI test_sqlite3changeset_concat( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ int rc; /* Return code from changeset_invert() */ |
︙ | ︙ | |||
779 780 781 782 783 784 785 | sqlite3_free(sOut.p); return rc; } /* ** sqlite3session_foreach VARNAME CHANGESET SCRIPT */ | | | 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 | sqlite3_free(sOut.p); return rc; } /* ** sqlite3session_foreach VARNAME CHANGESET SCRIPT */ static int SQLITE_TCLAPI test_sqlite3session_foreach( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ void *pChangeset; int nChangeset; |
︙ | ︙ |
Changes to src/btree.c.
︙ | ︙ | |||
6387 6388 6389 6390 6391 6392 6393 | } #endif } } /* ** A CellArray object contains a cache of pointers and sizes for a | | | 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 | } #endif } } /* ** A CellArray object contains a cache of pointers and sizes for a ** consecutive sequence of cells that might be held on multiple pages. */ typedef struct CellArray CellArray; struct CellArray { int nCell; /* Number of cells in apCell[] */ MemPage *pRef; /* Reference page */ u8 **apCell; /* All cells begin balanced */ u16 *szCell; /* Local size of all cells in apCell[] */ |
︙ | ︙ |
Changes to src/date.c.
︙ | ︙ | |||
1108 1109 1110 1111 1112 1113 1114 | static void currentTimeFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ time_t t; char *zFormat = (char *)sqlite3_user_data(context); | < | 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 | static void currentTimeFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ time_t t; char *zFormat = (char *)sqlite3_user_data(context); sqlite3_int64 iT; struct tm *pTm; struct tm sNow; char zBuf[20]; UNUSED_PARAMETER(argc); UNUSED_PARAMETER(argv); |
︙ | ︙ |
Changes to src/loadext.c.
︙ | ︙ | |||
17 18 19 20 21 22 23 | #define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */ #endif #include "sqlite3ext.h" #include "sqliteInt.h" #include <string.h> #ifndef SQLITE_OMIT_LOAD_EXTENSION | < | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */ #endif #include "sqlite3ext.h" #include "sqliteInt.h" #include <string.h> #ifndef SQLITE_OMIT_LOAD_EXTENSION /* ** Some API routines are omitted when various features are ** excluded from a build of SQLite. Substitute a NULL pointer ** for any missing APIs. */ #ifndef SQLITE_ENABLE_COLUMN_METADATA # define sqlite3_column_database_name 0 |
︙ | ︙ | |||
106 107 108 109 110 111 112 113 114 115 116 117 118 119 | #define sqlite3_blob_bytes 0 #define sqlite3_blob_close 0 #define sqlite3_blob_open 0 #define sqlite3_blob_read 0 #define sqlite3_blob_write 0 #define sqlite3_blob_reopen 0 #endif /* ** The following structure contains pointers to all SQLite API routines. ** A pointer to this structure is passed into extensions when they are ** loaded so that the extension can make calls back into the SQLite ** library. ** | > > > > | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | #define sqlite3_blob_bytes 0 #define sqlite3_blob_close 0 #define sqlite3_blob_open 0 #define sqlite3_blob_read 0 #define sqlite3_blob_write 0 #define sqlite3_blob_reopen 0 #endif #if defined(SQLITE_OMIT_TRACE) # define sqlite3_trace_v2 0 #endif /* ** The following structure contains pointers to all SQLite API routines. ** A pointer to this structure is passed into extensions when they are ** loaded so that the extension can make calls back into the SQLite ** library. ** |
︙ | ︙ | |||
412 413 414 415 416 417 418 | sqlite3_value_subtype, sqlite3_result_subtype, /* Version 3.10.0 and later */ sqlite3_status64, sqlite3_strlike, sqlite3_db_cacheflush, /* Version 3.12.0 and later */ | | > > > | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | sqlite3_value_subtype, sqlite3_result_subtype, /* Version 3.10.0 and later */ sqlite3_status64, sqlite3_strlike, sqlite3_db_cacheflush, /* Version 3.12.0 and later */ sqlite3_system_errno, /* Version 3.14.0 and later */ sqlite3_trace_v2, sqlite3_expanded_sql }; /* ** Attempt to load an SQLite extension library contained in the file ** zFile. The entry point is zProc. zProc may be 0 in which case a ** default entry point name (sqlite3_extension_init) is used. Use ** of the default name is recommended. |
︙ | ︙ | |||
435 436 437 438 439 440 441 | sqlite3 *db, /* Load the extension into this database connection */ const char *zFile, /* Name of the shared library containing extension */ const char *zProc, /* Entry point. Use "sqlite3_extension_init" if 0 */ char **pzErrMsg /* Put error message here if not 0 */ ){ sqlite3_vfs *pVfs = db->pVfs; void *handle; | | | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | sqlite3 *db, /* Load the extension into this database connection */ const char *zFile, /* Name of the shared library containing extension */ const char *zProc, /* Entry point. Use "sqlite3_extension_init" if 0 */ char **pzErrMsg /* Put error message here if not 0 */ ){ sqlite3_vfs *pVfs = db->pVfs; void *handle; sqlite3_loadext_entry xInit; char *zErrmsg = 0; const char *zEntry; char *zAltEntry = 0; void **aHandle; u64 nMsg = 300 + sqlite3Strlen30(zFile); int ii; int rc; |
︙ | ︙ | |||
494 495 496 497 498 499 500 | sqlite3_snprintf(nMsg, zErrmsg, "unable to open shared library [%s]", zFile); sqlite3OsDlError(pVfs, nMsg-1, zErrmsg); } } return SQLITE_ERROR; } | < | | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | sqlite3_snprintf(nMsg, zErrmsg, "unable to open shared library [%s]", zFile); sqlite3OsDlError(pVfs, nMsg-1, zErrmsg); } } return SQLITE_ERROR; } xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry); /* If no entry point was specified and the default legacy ** entry point name "sqlite3_extension_init" was not found, then ** construct an entry point name "sqlite3_X_init" where the X is ** replaced by the lowercase value of every ASCII alphabetic ** character in the filename after the last "/" upto the first ".", ** and eliding the first three characters if they are "lib". |
︙ | ︙ | |||
527 528 529 530 531 532 533 | for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){ if( sqlite3Isalpha(c) ){ zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c]; } } memcpy(zAltEntry+iEntry, "_init", 6); zEntry = zAltEntry; | < | | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){ if( sqlite3Isalpha(c) ){ zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c]; } } memcpy(zAltEntry+iEntry, "_init", 6); zEntry = zAltEntry; xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry); } if( xInit==0 ){ if( pzErrMsg ){ nMsg += sqlite3Strlen30(zEntry); *pzErrMsg = zErrmsg = sqlite3_malloc64(nMsg); if( zErrmsg ){ sqlite3_snprintf(nMsg, zErrmsg, |
︙ | ︙ | |||
658 659 660 661 662 663 664 | #endif /* ** Register a statically linked extension that is automatically ** loaded by every new database connection. */ | | > > | 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | #endif /* ** Register a statically linked extension that is automatically ** loaded by every new database connection. */ int sqlite3_auto_extension( void (*xInit)(void) ){ int rc = SQLITE_OK; #ifndef SQLITE_OMIT_AUTOINIT rc = sqlite3_initialize(); if( rc ){ return rc; }else #endif |
︙ | ︙ | |||
703 704 705 706 707 708 709 | ** set of routines that is invoked for each new database connection, if it ** is currently on the list. If xInit is not on the list, then this ** routine is a no-op. ** ** Return 1 if xInit was found on the list and removed. Return 0 if xInit ** was not on the list. */ | | > > | 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | ** set of routines that is invoked for each new database connection, if it ** is currently on the list. If xInit is not on the list, then this ** routine is a no-op. ** ** Return 1 if xInit was found on the list and removed. Return 0 if xInit ** was not on the list. */ int sqlite3_cancel_auto_extension( void (*xInit)(void) ){ #if SQLITE_THREADSAFE sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); #endif int i; int n = 0; wsdAutoextInit; sqlite3_mutex_enter(mutex); |
︙ | ︙ | |||
752 753 754 755 756 757 758 | ** ** If anything goes wrong, set an error in the database connection. */ void sqlite3AutoLoadExtensions(sqlite3 *db){ u32 i; int go = 1; int rc; | | < | | 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 | ** ** If anything goes wrong, set an error in the database connection. */ void sqlite3AutoLoadExtensions(sqlite3 *db){ u32 i; int go = 1; int rc; sqlite3_loadext_entry xInit; wsdAutoextInit; if( wsdAutoext.nExt==0 ){ /* Common case: early out without every having to acquire a mutex */ return; } for(i=0; go; i++){ char *zErrmsg; #if SQLITE_THREADSAFE sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); #endif sqlite3_mutex_enter(mutex); if( i>=wsdAutoext.nExt ){ xInit = 0; go = 0; }else{ xInit = (sqlite3_loadext_entry)wsdAutoext.aExt[i]; } sqlite3_mutex_leave(mutex); zErrmsg = 0; if( xInit && (rc = xInit(db, &zErrmsg, &sqlite3Apis))!=0 ){ sqlite3ErrorWithMsg(db, rc, "automatic extension loading failed: %s", zErrmsg); go = 0; } sqlite3_free(zErrmsg); } } |
Changes to src/shell.c.
︙ | ︙ | |||
2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 | static int sql_trace_callback( unsigned mType, void *pArg, void *pP, void *pX ){ FILE *f = (FILE*)pArg; if( f ){ const char *z = (const char*)pX; int i = (int)strlen(z); while( i>0 && z[i-1]==';' ){ i--; } utf8_printf(f, "%.*s;\n", i, z); } return 0; | > > | 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 | static int sql_trace_callback( unsigned mType, void *pArg, void *pP, void *pX ){ FILE *f = (FILE*)pArg; UNUSED_PARAMETER(mType); UNUSED_PARAMETER(pP); if( f ){ const char *z = (const char*)pX; int i = (int)strlen(z); while( i>0 && z[i-1]==';' ){ i--; } utf8_printf(f, "%.*s;\n", i, z); } return 0; |
︙ | ︙ |
Changes to src/sqlite.h.in.
︙ | ︙ | |||
50 51 52 53 54 55 56 57 | #endif #ifndef SQLITE_API # define SQLITE_API #endif #ifndef SQLITE_CDECL # define SQLITE_CDECL #endif #ifndef SQLITE_STDCALL | > > > | > > > > > > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #endif #ifndef SQLITE_API # define SQLITE_API #endif #ifndef SQLITE_CDECL # define SQLITE_CDECL #endif #ifndef SQLITE_APICALL # define SQLITE_APICALL #endif #ifndef SQLITE_STDCALL # define SQLITE_STDCALL SQLITE_APICALL #endif #ifndef SQLITE_CALLBACK # define SQLITE_CALLBACK #endif #ifndef SQLITE_SYSAPI # define SQLITE_SYSAPI #endif /* ** These no-op macros are used in front of interfaces to mark those ** interfaces as either deprecated or experimental. New applications ** should not use deprecated interfaces - they are supported for backwards ** compatibility only. Application writers should be aware that |
︙ | ︙ | |||
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | ** at the internal representation of an [sqlite3_mutex]. It only ** deals with pointers to the [sqlite3_mutex] object. ** ** Mutexes are created using [sqlite3_mutex_alloc()]. */ typedef struct sqlite3_mutex sqlite3_mutex; /* ** CAPI3REF: OS Interface Object ** ** An instance of the sqlite3_vfs object defines the interface between ** the SQLite core and the underlying operating system. The "vfs" ** in the name of the object stands for "virtual file system". See ** the [VFS | VFS documentation] for further information. | > > > > > > > > > > | 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 | ** at the internal representation of an [sqlite3_mutex]. It only ** deals with pointers to the [sqlite3_mutex] object. ** ** Mutexes are created using [sqlite3_mutex_alloc()]. */ typedef struct sqlite3_mutex sqlite3_mutex; /* ** CAPI3REF: Loadable Extension Thunk ** ** A pointer to the opaque sqlite3_api_routines structure is passed as ** the third parameter to entry points of [loadable extensions]. This ** structure must be typedefed in order to work around compiler warnings ** on some platforms. */ typedef struct sqlite3_api_routines sqlite3_api_routines; /* ** CAPI3REF: OS Interface Object ** ** An instance of the sqlite3_vfs object defines the interface between ** the SQLite core and the underlying operating system. The "vfs" ** in the name of the object stands for "virtual file system". See ** the [VFS | VFS documentation] for further information. |
︙ | ︙ | |||
2230 2231 2232 2233 2234 2235 2236 | ** database connection that invoked the busy handler. In other words, ** the busy handler is not reentrant. Any such actions ** result in undefined behavior. ** ** A busy handler must not close the database connection ** or [prepared statement] that invoked the busy handler. */ | | | 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 | ** database connection that invoked the busy handler. In other words, ** the busy handler is not reentrant. Any such actions ** result in undefined behavior. ** ** A busy handler must not close the database connection ** or [prepared statement] that invoked the busy handler. */ int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*); /* ** CAPI3REF: Set A Busy Timeout ** METHOD: sqlite3 ** ** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps ** for a specified amount of time when a table is locked. ^The handler |
︙ | ︙ | |||
4682 4683 4684 4685 4686 4687 4688 | ** calls to sqlite3_get_auxdata(C,N) return P from the most recent ** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or ** NULL if the metadata has been discarded. ** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, ** SQLite will invoke the destructor function X with parameter P exactly ** once, when the metadata is discarded. ** SQLite is free to discard the metadata at any time, including: <ul> | | | | | > | | | 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 | ** calls to sqlite3_get_auxdata(C,N) return P from the most recent ** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or ** NULL if the metadata has been discarded. ** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, ** SQLite will invoke the destructor function X with parameter P exactly ** once, when the metadata is discarded. ** SQLite is free to discard the metadata at any time, including: <ul> ** <li> ^(when the corresponding function parameter changes)^, or ** <li> ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the ** SQL statement)^, or ** <li> ^(when sqlite3_set_auxdata() is invoked again on the same ** parameter)^, or ** <li> ^(during the original sqlite3_set_auxdata() call when a memory ** allocation error occurs.)^ </ul> ** ** Note the last bullet in particular. The destructor X in ** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the ** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() ** should be called near the end of the function implementation and the ** function implementation should not make any use of P after ** sqlite3_set_auxdata() has been called. |
︙ | ︙ | |||
5648 5649 5650 5651 5652 5653 5654 | ** ^Extension loading is off by default. ** ^Call the sqlite3_enable_load_extension() routine with onoff==1 ** to turn extension loading on and call it with onoff==0 to turn ** it back off again. ** ** ^This interface enables or disables both the C-API ** [sqlite3_load_extension()] and the SQL function [load_extension()]. | | | | | 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 | ** ^Extension loading is off by default. ** ^Call the sqlite3_enable_load_extension() routine with onoff==1 ** to turn extension loading on and call it with onoff==0 to turn ** it back off again. ** ** ^This interface enables or disables both the C-API ** [sqlite3_load_extension()] and the SQL function [load_extension()]. ** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) ** to enable or disable only the C-API.)^ ** ** <b>Security warning:</b> It is recommended that extension loading ** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method ** rather than this interface, so the [load_extension()] SQL function ** remains disabled. This will prevent SQL injections from giving attackers ** access to extension loading capabilities. */ int sqlite3_enable_load_extension(sqlite3 *db, int onoff); /* ** CAPI3REF: Automatically Load Statically Linked Extensions ** ** ^This interface causes the xEntryPoint() function to be invoked for ** each new [database connection] that is created. The idea here is that ** xEntryPoint() is the entry point for a statically linked [SQLite extension] ** that is to be automatically loaded into all new database connections. ** ** ^(Even though the function prototype shows that xEntryPoint() takes ** no arguments and returns void, SQLite invokes xEntryPoint() with three ** arguments and expects an integer result as if the signature of the ** entry point where as follows: ** ** <blockquote><pre> ** int xEntryPoint( ** sqlite3 *db, ** const char **pzErrMsg, ** const struct sqlite3_api_routines *pThunk |
︙ | ︙ | |||
5695 5696 5697 5698 5699 5700 5701 | ** ^Calling sqlite3_auto_extension(X) with an entry point X that is already ** on the list of automatic extensions is a harmless no-op. ^No entry point ** will be called more than once for each database connection that is opened. ** ** See also: [sqlite3_reset_auto_extension()] ** and [sqlite3_cancel_auto_extension()] */ | | | | 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 | ** ^Calling sqlite3_auto_extension(X) with an entry point X that is already ** on the list of automatic extensions is a harmless no-op. ^No entry point ** will be called more than once for each database connection that is opened. ** ** See also: [sqlite3_reset_auto_extension()] ** and [sqlite3_cancel_auto_extension()] */ int sqlite3_auto_extension(void(*xEntryPoint)(void)); /* ** CAPI3REF: Cancel Automatic Extension Loading ** ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the ** initialization routine X that was registered using a prior call to ** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)] ** routine returns 1 if initialization routine X was successfully ** unregistered and it returns 0 if X was not on the list of initialization ** routines. */ int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void)); /* ** CAPI3REF: Reset Automatic Extension Loading ** ** ^This interface disables all automatic extensions previously ** registered using [sqlite3_auto_extension()]. */ |
︙ | ︙ |
Changes to src/sqlite3ext.h.
︙ | ︙ | |||
15 16 17 18 19 20 21 | ** as extensions by SQLite should #include this file instead of ** sqlite3.h. */ #ifndef SQLITE3EXT_H #define SQLITE3EXT_H #include "sqlite3.h" | < < | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** as extensions by SQLite should #include this file instead of ** sqlite3.h. */ #ifndef SQLITE3EXT_H #define SQLITE3EXT_H #include "sqlite3.h" /* ** The following structure holds pointers to all of the SQLite API ** routines. ** ** WARNING: In order to maintain backwards compatibility, add new ** interfaces to the end of this structure only. If you insert new ** interfaces in the middle of this structure, then older different |
︙ | ︙ | |||
281 282 283 284 285 286 287 288 289 290 291 292 293 294 | int (*db_cacheflush)(sqlite3*); /* Version 3.12.0 and later */ int (*system_errno)(sqlite3*); /* Version 3.14.0 and later */ int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*); char *(*expanded_sql)(sqlite3_stmt*); }; /* ** The following macros redefine the API routines so that they are ** redirected through the global sqlite3_api structure. ** ** This header file is also used by the loadext.c source file ** (part of the main SQLite library - not an extension) so that | > > > > > > > > > > | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | int (*db_cacheflush)(sqlite3*); /* Version 3.12.0 and later */ int (*system_errno)(sqlite3*); /* Version 3.14.0 and later */ int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*); char *(*expanded_sql)(sqlite3_stmt*); }; /* ** This is the function signature used for all extension entry points. It ** is also defined in the file "loadext.c". */ typedef int (*sqlite3_loadext_entry)( sqlite3 *db, /* Handle to the database. */ char **pzErrMsg, /* Used to set error string on failure. */ const sqlite3_api_routines *pThunk /* Extension API function pointers. */ ); /* ** The following macros redefine the API routines so that they are ** redirected through the global sqlite3_api structure. ** ** This header file is also used by the loadext.c source file ** (part of the main SQLite library - not an extension) so that |
︙ | ︙ |
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 |
︙ | ︙ | |||
222 223 224 225 226 227 228 | /* ** Make sure that the compiler intrinsics we desire are enabled when ** compiling with an appropriate version of MSVC unless prevented by ** the SQLITE_DISABLE_INTRINSIC define. */ #if !defined(SQLITE_DISABLE_INTRINSIC) | | | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | /* ** Make sure that the compiler intrinsics we desire are enabled when ** compiling with an appropriate version of MSVC unless prevented by ** the SQLITE_DISABLE_INTRINSIC define. */ #if !defined(SQLITE_DISABLE_INTRINSIC) # if defined(_MSC_VER) && _MSC_VER>=1400 # if !defined(_WIN32_WCE) # include <intrin.h> # pragma intrinsic(_byteswap_ushort) # pragma intrinsic(_byteswap_ulong) # pragma intrinsic(_ReadWriteBarrier) # else # include <cmnintrin.h> |
︙ | ︙ |
Changes to src/status.c.
︙ | ︙ | |||
154 155 156 157 158 159 160 | wsdStat.mxValue[op] = wsdStat.nowValue[op]; } sqlite3_mutex_leave(pMutex); (void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */ return SQLITE_OK; } int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){ | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | wsdStat.mxValue[op] = wsdStat.nowValue[op]; } sqlite3_mutex_leave(pMutex); (void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */ return SQLITE_OK; } int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){ sqlite3_int64 iCur = 0, iHwtr = 0; int rc; #ifdef SQLITE_ENABLE_API_ARMOR if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT; #endif rc = sqlite3_status64(op, &iCur, &iHwtr, resetFlag); if( rc==0 ){ *pCurrent = (int)iCur; |
︙ | ︙ |
Changes to src/tclsqlite.c.
︙ | ︙ | |||
26 27 28 29 30 31 32 | ** SQLite. This option implies -DSQLITE_TCLMD5. */ /* ** If requested, include the SQLite compiler options file for MSVC. */ #if defined(INCLUDE_MSVC_H) | | > > > | > > > > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ** SQLite. This option implies -DSQLITE_TCLMD5. */ /* ** If requested, include the SQLite compiler options file for MSVC. */ #if defined(INCLUDE_MSVC_H) # 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. */ #ifndef SQLITE_AMALGAMATION |
︙ | ︙ | |||
200 201 202 203 204 205 206 | 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; |
︙ | ︙ | |||
229 230 231 232 233 234 235 | } 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 */ |
︙ | ︙ | |||
261 262 263 264 265 266 267 | 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 */ |
︙ | ︙ | |||
294 295 296 297 298 299 300 | 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; |
︙ | ︙ | |||
320 321 322 323 324 325 326 | 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 */ |
︙ | ︙ | |||
482 483 484 485 486 487 488 | 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; |
︙ | ︙ | |||
1130 1131 1132 1133 1134 1135 1136 | ** This function is part of the implementation of the command: ** ** $db transaction [-deferred|-immediate|-exclusive] SCRIPT ** ** It is invoked after evaluating the script SCRIPT to commit or rollback ** the transaction or savepoint opened by the [transaction] command. */ | | | 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 | ** This function is part of the implementation of the command: ** ** $db transaction [-deferred|-immediate|-exclusive] SCRIPT ** ** It is invoked after evaluating the script SCRIPT to commit or rollback ** the transaction or savepoint opened by the [transaction] command. */ static int SQLITE_TCLAPI DbTransPostCmd( ClientData data[], /* data[0] is the Sqlite3Db* for $db */ Tcl_Interp *interp, /* Tcl interpreter */ int result /* Result of evaluating SCRIPT */ ){ static const char *const azEnd[] = { "RELEASE _tcl_transaction", /* rc==TCL_ERROR, nTransaction!=0 */ "COMMIT", /* rc!=TCL_ERROR, nTransaction==0 */ |
︙ | ︙ | |||
1677 1678 1679 1680 1681 1682 1683 | #endif /* ** This function is part of the implementation of the command: ** ** $db eval SQL ?ARRAYNAME? SCRIPT */ | | | 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 | #endif /* ** This function is part of the implementation of the command: ** ** $db eval SQL ?ARRAYNAME? SCRIPT */ static int SQLITE_TCLAPI DbEvalNextCmd( ClientData data[], /* data[0] is the (DbEvalContext*) */ Tcl_Interp *interp, /* Tcl interpreter */ int result /* Result so far */ ){ int rc = result; /* Return code */ /* The first element of the data[] array is a pointer to a DbEvalContext |
︙ | ︙ | |||
1787 1788 1789 1790 1791 1792 1793 | ** 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", |
︙ | ︙ | |||
3230 3231 3232 3233 3234 3235 3236 | } #if SQLITE_TCL_NRE /* ** Adaptor that provides an objCmd interface to the NRE-enabled ** interface implementation. */ | | | 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 | } #if SQLITE_TCL_NRE /* ** Adaptor that provides an objCmd interface to the NRE-enabled ** interface implementation. */ static int SQLITE_TCLAPI DbObjCmdAdaptor( void *cd, Tcl_Interp *interp, int objc, Tcl_Obj *const*objv ){ return Tcl_NRCallObjProc(interp, DbObjCmd, cd, objc, objv); } |
︙ | ︙ | |||
3255 3256 3257 3258 3259 3260 3261 | ** 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; |
︙ | ︙ | |||
3775 3776 3777 3778 3779 3780 3781 | zDigest[j] = 0; } /* ** A TCL command for md5. The argument is the text to be hashed. The ** Result is the hash in base64. */ | > > | > > > | 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 | zDigest[j] = 0; } /* ** A TCL command for md5. The argument is the text to be hashed. The ** Result is the hash in base64. */ static int SQLITE_TCLAPI md5_cmd( void*cd, Tcl_Interp *interp, int argc, const char **argv ){ MD5Context ctx; unsigned char digest[16]; char zBuf[50]; void (*converter)(unsigned char*, char*); if( argc!=2 ){ Tcl_AppendResult(interp,"wrong # args: should be \"", argv[0], |
︙ | ︙ | |||
3799 3800 3801 3802 3803 3804 3805 | return TCL_OK; } /* ** A TCL command to take the md5 hash of a file. The argument is the ** name of the file. */ | > > > > | > | 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 | return TCL_OK; } /* ** A TCL command to take the md5 hash of a file. The argument is the ** name of the file. */ static int SQLITE_TCLAPI md5file_cmd( void*cd, Tcl_Interp *interp, int argc, const char **argv ){ FILE *in; MD5Context ctx; void (*converter)(unsigned char*, char*); unsigned char digest[16]; char zBuf[10240]; if( argc!=2 ){ |
︙ | ︙ | |||
3879 3880 3881 3882 3883 3884 3885 | unsigned char digest[16]; char zBuf[33]; p = sqlite3_aggregate_context(context, sizeof(*p)); MD5Final(digest,p); MD5DigestToBase16(digest, zBuf); sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); } | | > > > > | 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 | unsigned char digest[16]; char zBuf[33]; p = sqlite3_aggregate_context(context, sizeof(*p)); MD5Final(digest,p); MD5DigestToBase16(digest, zBuf); sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); } int Md5_Register( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pThunk ){ int rc = sqlite3_create_function(db, "md5sum", -1, SQLITE_UTF8, 0, 0, md5step, md5finalize); sqlite3_overload_function(db, "md5sum", -1); /* To exercise this API */ return rc; } #endif /* defined(SQLITE_TEST) */ |
︙ | ︙ | |||
3927 3928 3929 3930 3931 3932 3933 | #endif #if TCLSH==2 static const char *tclsh_main_loop(void); #endif #ifdef SQLITE_TEST static void init_all(Tcl_Interp *); | | | 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 | #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; |
︙ | ︙ | |||
3957 3958 3959 3960 3961 3962 3963 | ** 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(). */ | | | 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 | ** 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; |
︙ | ︙ | |||
3994 3995 3996 3997 3998 3999 4000 | /* ** 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. */ | | | 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 | /* ** 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; |
︙ | ︙ | |||
4119 4120 4121 4122 4123 4124 4125 | Sqlitetest_init_Init(interp); Sqlitetest_malloc_Init(interp); Sqlitetest_mutex_Init(interp); Sqlitetestschema_Init(interp); Sqlitetesttclvar_Init(interp); Sqlitetestfs_Init(interp); SqlitetestThread_Init(interp); | | | 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 | Sqlitetest_init_Init(interp); Sqlitetest_malloc_Init(interp); Sqlitetest_mutex_Init(interp); Sqlitetestschema_Init(interp); Sqlitetesttclvar_Init(interp); Sqlitetestfs_Init(interp); SqlitetestThread_Init(interp); SqlitetestOnefile_Init(); SqlitetestOsinst_Init(interp); Sqlitetestbackup_Init(interp); Sqlitetestintarray_Init(interp); Sqlitetestvfs_Init(interp); Sqlitetestrtree_Init(interp); Sqlitequota_Init(interp); Sqlitemultiplex_Init(interp); |
︙ | ︙ | |||
4163 4164 4165 4166 4167 4168 4169 | /* Needed for the setrlimit() system call on unix */ #if defined(unix) #include <sys/resource.h> #endif #define TCLSH_MAIN main /* Needed to fake out mktclapp */ | | | 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 | /* Needed for the setrlimit() system call on unix */ #if defined(unix) #include <sys/resource.h> #endif #define TCLSH_MAIN main /* Needed to fake out mktclapp */ int SQLITE_CDECL TCLSH_MAIN(int argc, char **argv){ Tcl_Interp *interp; #if !defined(_WIN32_WCE) if( getenv("BREAK") ){ fprintf(stderr, "attach debugger to process %d and press any key to continue.\n", GETPID()); |
︙ | ︙ |
Changes to src/test1.c.
︙ | ︙ | |||
15 16 17 18 19 20 21 | */ #include "sqliteInt.h" #if SQLITE_OS_WIN # include "os_win.h" #endif #include "vdbeInt.h" | > > > | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | */ #include "sqliteInt.h" #if SQLITE_OS_WIN # include "os_win.h" #endif #include "vdbeInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #include <string.h> /* ** This is a copy of the first part of the SqliteDb structure in ** tclsqlite.c. We need it here so that the get_sqlite_pointer routine ** can extract the sqlite3* pointer from an existing Tcl SQLite |
︙ | ︙ | |||
71 72 73 74 75 76 77 | /* ** 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; |
︙ | ︙ | |||
217 218 219 220 221 222 223 | /* ** 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 ){ |
︙ | ︙ | |||
258 259 260 261 262 263 264 | ** 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) |
︙ | ︙ | |||
285 286 287 288 289 290 291 | /* ** 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; |
︙ | ︙ | |||
323 324 325 326 327 328 329 | /* ** 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; |
︙ | ︙ | |||
369 370 371 372 373 374 375 | /* ** 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 ){ |
︙ | ︙ | |||
407 408 409 410 411 412 413 | } /* ** 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; |
︙ | ︙ | |||
454 455 456 457 458 459 460 | /* ** 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; |
︙ | ︙ | |||
481 482 483 484 485 486 487 | /* ** 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; |
︙ | ︙ | |||
504 505 506 507 508 509 510 | /* ** 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; |
︙ | ︙ | |||
528 529 530 531 532 533 534 | ** 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]); |
︙ | ︙ | |||
554 555 556 557 558 559 560 | /* ** 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; |
︙ | ︙ | |||
617 618 619 620 621 622 623 | /* ** 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]; |
︙ | ︙ | |||
641 642 643 644 645 646 647 | } /* ** 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; |
︙ | ︙ | |||
669 670 671 672 673 674 675 | } /* ** 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; |
︙ | ︙ | |||
697 698 699 700 701 702 703 | } /* ** 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; |
︙ | ︙ | |||
721 722 723 724 725 726 727 | } /* ** 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; |
︙ | ︙ | |||
1005 1006 1007 1008 1009 1010 1011 | ** 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; |
︙ | ︙ | |||
1162 1163 1164 1165 1166 1167 1168 | ** 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; |
︙ | ︙ | |||
1203 1204 1205 1206 1207 1208 1209 | ** 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], |
︙ | ︙ | |||
1225 1226 1227 1228 1229 1230 1231 | /* ** 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; |
︙ | ︙ | |||
1252 1253 1254 1255 1256 1257 1258 | } /* ** 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]; |
︙ | ︙ | |||
1285 1286 1287 1288 1289 1290 1291 | /* ** 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]; |
︙ | ︙ | |||
1316 1317 1318 1319 1320 1321 1322 | } /* ** 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; |
︙ | ︙ | |||
1343 1344 1345 1346 1347 1348 1349 | } /* ** 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; |
︙ | ︙ | |||
1377 1378 1379 1380 1381 1382 1383 | } /* ** 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; |
︙ | ︙ | |||
1408 1409 1410 1411 1412 1413 1414 | /* ** 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]; |
︙ | ︙ | |||
1438 1439 1440 1441 1442 1443 1444 | /* ** 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 ){ |
︙ | ︙ | |||
1462 1463 1464 1465 1466 1467 1468 | /* ** 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; |
︙ | ︙ | |||
1495 1496 1497 1498 1499 1500 1501 | } /* ** 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; |
︙ | ︙ | |||
1532 1533 1534 1535 1536 1537 1538 | /* ** 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; |
︙ | ︙ | |||
1555 1556 1557 1558 1559 1560 1561 | 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; |
︙ | ︙ | |||
1620 1621 1622 1623 1624 1625 1626 | 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; |
︙ | ︙ | |||
1649 1650 1651 1652 1653 1654 1655 | 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; |
︙ | ︙ | |||
1725 1726 1727 1728 1729 1730 1731 | ){ 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; |
︙ | ︙ | |||
1800 1801 1802 1803 1804 1805 1806 | 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; |
︙ | ︙ | |||
1888 1889 1890 1891 1892 1893 1894 | } 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; |
︙ | ︙ | |||
1946 1947 1948 1949 1950 1951 1952 | 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; |
︙ | ︙ | |||
1992 1993 1994 1995 1996 1997 1998 | /* ** 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 |
︙ | ︙ | |||
2051 2052 2053 2054 2055 2056 2057 | } /* ** 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; |
︙ | ︙ | |||
2080 2081 2082 2083 2084 2085 2086 | } /* ** 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; |
︙ | ︙ | |||
2112 2113 2114 2115 2116 2117 2118 | } /* ** 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; |
︙ | ︙ | |||
2157 2158 2159 2160 2161 2162 2163 | 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 */ |
︙ | ︙ | |||
2207 2208 2209 2210 2211 2212 2213 | } 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 ){ |
︙ | ︙ | |||
2230 2231 2232 2233 2234 2235 2236 | #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; |
︙ | ︙ | |||
2306 2307 2308 2309 2310 2311 2312 | } #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; |
︙ | ︙ | |||
2338 2339 2340 2341 2342 2343 2344 | } #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; |
︙ | ︙ | |||
2385 2386 2387 2388 2389 2390 2391 | #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; |
︙ | ︙ | |||
2417 2418 2419 2420 2421 2422 2423 | /* ** 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; |
︙ | ︙ | |||
2444 2445 2446 2447 2448 2449 2450 | /* ** 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; |
︙ | ︙ | |||
2470 2471 2472 2473 2474 2475 2476 | } /* ** 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; |
︙ | ︙ | |||
2496 2497 2498 2499 2500 2501 2502 | /* ** 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; |
︙ | ︙ | |||
2531 2532 2533 2534 2535 2536 2537 | } /* ** 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; |
︙ | ︙ | |||
2555 2556 2557 2558 2559 2560 2561 | } /* ** 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; |
︙ | ︙ | |||
2582 2583 2584 2585 2586 2587 2588 | /* ** 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 ){ |
︙ | ︙ | |||
2617 2618 2619 2620 2621 2622 2623 | ** 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; |
︙ | ︙ | |||
2739 2740 2741 2742 2743 2744 2745 | 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; |
︙ | ︙ | |||
2813 2814 2815 2816 2817 2818 2819 | 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; |
︙ | ︙ | |||
2870 2871 2872 2873 2874 2875 2876 | 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; |
︙ | ︙ | |||
2921 2922 2923 2924 2925 2926 2927 | 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 ){ |
︙ | ︙ | |||
3039 3040 3041 3042 3043 3044 3045 | 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; |
︙ | ︙ | |||
3084 3085 3086 3087 3088 3089 3090 | ** 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; |
︙ | ︙ | |||
3117 3118 3119 3120 3121 3122 3123 | ** 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; |
︙ | ︙ | |||
3169 3170 3171 3172 3173 3174 3175 | /* ** 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; |
︙ | ︙ | |||
3206 3207 3208 3209 3210 3211 3212 | /* ** 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; |
︙ | ︙ | |||
3246 3247 3248 3249 3250 3251 3252 | ** ** 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; |
︙ | ︙ | |||
3280 3281 3282 3283 3284 3285 3286 | ** ** 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; |
︙ | ︙ | |||
3316 3317 3318 3319 3320 3321 3322 | ** ** 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; |
︙ | ︙ | |||
3350 3351 3352 3353 3354 3355 3356 | ** ** 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; |
︙ | ︙ | |||
3383 3384 3385 3386 3387 3388 3389 | /* ** 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; |
︙ | ︙ | |||
3421 3422 3423 3424 3425 3426 3427 | /* ** 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; |
︙ | ︙ | |||
3497 3498 3499 3500 3501 3502 3503 | /* ** 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; |
︙ | ︙ | |||
3533 3534 3535 3536 3537 3538 3539 | ** 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; |
︙ | ︙ | |||
3574 3575 3576 3577 3578 3579 3580 | ** 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; |
︙ | ︙ | |||
3622 3623 3624 3625 3626 3627 3628 | /* ** 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; |
︙ | ︙ | |||
3674 3675 3676 3677 3678 3679 3680 | } /* ** 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; |
︙ | ︙ | |||
3698 3699 3700 3701 3702 3703 3704 | /* ** 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; |
︙ | ︙ | |||
3725 3726 3727 3728 3729 3730 3731 | /* ** 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; |
︙ | ︙ | |||
3750 3751 3752 3753 3754 3755 3756 | return TCL_OK; } /* ** Usage: sqlite3_clear_bindings STMT ** */ | | | 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 | 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; |
︙ | ︙ | |||
3788 3789 3790 3791 3792 3793 3794 | Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_clear_bindings(0))); return TCL_OK; } /* ** Usage: sqlite3_sleep MILLISECONDS */ | | | 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 | Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_clear_bindings(0))); 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; |
︙ | ︙ | |||
3813 3814 3815 3816 3817 3818 3819 | /* ** Usage: sqlite3_extended_errcode DB ** ** Return the string representation of the most recent sqlite3_* API ** error code. e.g. "SQLITE_ERROR". */ | | | 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 | /* ** 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; |
︙ | ︙ | |||
3840 3841 3842 3843 3844 3845 3846 | /* ** Usage: sqlite3_errcode DB ** ** Return the string representation of the most recent sqlite3_* API ** error code. e.g. "SQLITE_ERROR". */ | | | 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 | /* ** 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; |
︙ | ︙ | |||
3866 3867 3868 3869 3870 3871 3872 | /* ** Usage: sqlite3_errmsg DB ** ** Returns the UTF-8 representation of the error message string for the ** most recent sqlite3_* API call. */ | | | 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 | /* ** 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; |
︙ | ︙ | |||
3895 3896 3897 3898 3899 3900 3901 | ** 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. */ | | | 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 | ** 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; |
︙ | ︙ | |||
3932 3933 3934 3935 3936 3937 3938 | ** 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. */ | | | 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 | ** 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; |
︙ | ︙ | |||
3989 3990 3991 3992 3993 3994 3995 | ** 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. */ | | | 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 | ** 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; |
︙ | ︙ | |||
4057 4058 4059 4060 4061 4062 4063 | /* ** 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. */ | | | 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 | /* ** 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"; |
︙ | ︙ | |||
4100 4101 4102 4103 4104 4105 4106 | ** 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. */ | | | 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 | ** 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; |
︙ | ︙ | |||
4160 4161 4162 4163 4164 4165 4166 | ** 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. */ | | | 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 | ** 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; |
︙ | ︙ | |||
4215 4216 4217 4218 4219 4220 4221 | #endif /* SQLITE_OMIT_UTF16 */ return TCL_OK; } /* ** Usage: sqlite3_open filename ?options-list? */ | | | 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 | #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; |
︙ | ︙ | |||
4242 4243 4244 4245 4246 4247 4248 | Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; } /* ** Usage: sqlite3_open_v2 FILENAME FLAGS VFS */ | | | 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 | 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; |
︙ | ︙ | |||
4312 4313 4314 4315 4316 4317 4318 | Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; } /* ** Usage: sqlite3_open16 filename options */ | | | 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 | 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; |
︙ | ︙ | |||
4344 4345 4346 4347 4348 4349 4350 | /* ** Usage: sqlite3_complete16 <UTF-16 string> ** ** Return 1 if the supplied argument is a complete SQL statement, or zero ** otherwise. */ | | | 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 | /* ** 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; |
︙ | ︙ | |||
4369 4370 4371 4372 4373 4374 4375 | } /* ** Usage: sqlite3_step STMT ** ** Advance the statement to the next row. */ | | | 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 | } /* ** 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; |
︙ | ︙ | |||
4392 4393 4394 4395 4396 4397 4398 | rc = sqlite3_step(pStmt); /* if( rc!=SQLITE_DONE && rc!=SQLITE_ROW ) return TCL_ERROR; */ Tcl_SetResult(interp, (char *)t1ErrorName(rc), 0); return TCL_OK; } | | | | 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 | 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; |
︙ | ︙ | |||
4435 4436 4437 4438 4439 4440 4441 | } /* ** Usage: sqlite3_column_count STMT ** ** Return the number of columns returned by the sql statement STMT. */ | | | 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 | } /* ** 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; |
︙ | ︙ | |||
4460 4461 4462 4463 4464 4465 4466 | } /* ** Usage: sqlite3_column_type STMT column ** ** Return the type of the data in column 'column' of the current row. */ | | | 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 | } /* ** 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; |
︙ | ︙ | |||
4509 4510 4511 4512 4513 4514 4515 | /* ** Usage: sqlite3_column_int64 STMT column ** ** Return the data in column 'column' of the current row cast as an ** wide (64-bit) integer. */ | | | 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 | /* ** 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; |
︙ | ︙ | |||
4536 4537 4538 4539 4540 4541 4542 | Tcl_SetObjResult(interp, Tcl_NewWideIntObj(iVal)); return TCL_OK; } /* ** Usage: sqlite3_column_blob STMT column */ | | | 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 | 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; |
︙ | ︙ | |||
4568 4569 4570 4571 4572 4573 4574 | } /* ** Usage: sqlite3_column_double STMT column ** ** Return the data in column 'column' of the current row cast as a double. */ | | | 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 | } /* ** 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; |
︙ | ︙ | |||
4597 4598 4599 4600 4601 4602 4603 | } /* ** Usage: sqlite3_data_count STMT ** ** Return the number of columns returned by the sql statement STMT. */ | | | 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 | } /* ** 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; |
︙ | ︙ | |||
4624 4625 4626 4627 4628 4629 4630 | /* ** Usage: sqlite3_column_text STMT column ** ** Usage: sqlite3_column_decltype STMT column ** ** Usage: sqlite3_column_name STMT column */ | | | 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 | /* ** 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; |
︙ | ︙ | |||
4651 4652 4653 4654 4655 4656 4657 | zRet = xFunc(pStmt, col); if( zRet ){ Tcl_SetResult(interp, (char *)zRet, 0); } return TCL_OK; } | | | 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 | 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; |
︙ | ︙ | |||
4676 4677 4678 4679 4680 4681 4682 | /* ** Usage: sqlite3_column_text STMT column ** ** Usage: sqlite3_column_decltype STMT column ** ** Usage: sqlite3_column_name STMT column */ | | | 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 | /* ** 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; |
︙ | ︙ | |||
4720 4721 4722 4723 4724 4725 4726 | ** Usage: sqlite3_column_int STMT column ** ** Usage: sqlite3_column_bytes STMT column ** ** Usage: sqlite3_column_bytes16 STMT column ** */ | | | 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 | ** 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; |
︙ | ︙ | |||
4749 4750 4751 4752 4753 4754 4755 | } /* ** Usage: sqlite_set_magic DB MAGIC-NUMBER ** ** Set the db->magic value. This is used to test error recovery logic. */ | | | 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 | } /* ** 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 ){ |
︙ | ︙ | |||
4781 4782 4783 4784 4785 4786 4787 | } /* ** Usage: sqlite3_interrupt DB ** ** Trigger an interrupt on DB */ | | | 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 | } /* ** 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 ){ |
︙ | ︙ | |||
4822 4823 4824 4825 4826 4827 4828 | } /* ** Usage: sqlite3_stack_used DB SQL ** ** Try to measure the amount of stack space used by a call to sqlite3_exec */ | | | 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 | } /* ** 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; |
︙ | ︙ | |||
4850 4851 4852 4853 4854 4855 4856 | /* ** 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). */ | | | 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 | /* ** 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; |
︙ | ︙ | |||
4876 4877 4878 4879 4880 4881 4882 | /* ** 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). */ | | | 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 | /* ** 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; |
︙ | ︙ | |||
4901 4902 4903 4904 4905 4906 4907 | /* ** Usage: sqlite3_get_autocommit DB ** ** Return true if the database DB is currently in auto-commit mode. ** Return false if not. */ | | | 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 | /* ** 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; |
︙ | ︙ | |||
4927 4928 4929 4930 4931 4932 4933 | /* ** 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. */ | | | 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 | /* ** 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; |
︙ | ︙ | |||
4953 4954 4955 4956 4957 4958 4959 | /* ** Usage: tcl_variable_type VARIABLENAME ** ** Return the name of the internal representation for the ** value of the given variable. */ | | | 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 | /* ** 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 ){ |
︙ | ︙ | |||
4979 4980 4981 4982 4983 4984 4985 | /* ** 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. */ | | | 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 | /* ** 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; |
︙ | ︙ | |||
5010 5011 5012 5013 5014 5015 5016 | /* ** 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). */ | | | 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 | /* ** 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; |
︙ | ︙ | |||
5033 5034 5035 5036 5037 5038 5039 | } /* ** Usage: sqlite3_db_cacheflush DB ** ** Attempt to flush any dirty pages to disk. */ | | | 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 | } /* ** 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; |
︙ | ︙ | |||
5061 5062 5063 5064 5065 5066 5067 | } /* ** Usage: sqlite3_system_errno DB ** ** Return the low-level system errno value. */ | | | 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 | } /* ** 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; |
︙ | ︙ | |||
5084 5085 5086 5087 5088 5089 5090 | } /* ** Usage: sqlite3_db_filename DB DBNAME ** ** Return the name of a file associated with a database. */ | | | 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 | } /* ** 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; |
︙ | ︙ | |||
5108 5109 5110 5111 5112 5113 5114 | /* ** Usage: sqlite3_db_readonly DB DBNAME ** ** Return 1 or 0 if DBNAME is readonly or not. Return -1 if DBNAME does ** not exist. */ | | | 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 | /* ** 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; |
︙ | ︙ | |||
5133 5134 5135 5136 5137 5138 5139 | /* ** 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. */ | | | 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 | /* ** 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; |
︙ | ︙ | |||
5158 5159 5160 5161 5162 5163 5164 | } /* ** Usage: sqlite3_thread_cleanup ** ** Call the sqlite3_thread_cleanup API. */ | | | | 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 | } /* ** 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; |
︙ | ︙ | |||
5222 5223 5224 5225 5226 5227 5228 | ** 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. */ | | | 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 | ** 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; |
︙ | ︙ | |||
5247 5248 5249 5250 5251 5252 5253 | ** 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 */ | | | 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 | ** 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; |
︙ | ︙ | |||
5349 5350 5351 5352 5353 5354 5355 | /* ** 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. */ | | | 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 | /* ** 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"; |
︙ | ︙ | |||
5377 5378 5379 5380 5381 5382 5383 | static int nVfs = 0; /* ** tclcmd: vfs_unregister_all ** ** Unregister all VFSes. */ | | | 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 | 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++){ |
︙ | ︙ | |||
5399 5400 5401 5402 5403 5404 5405 | /* ** 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. */ | | | | 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 | /* ** 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; |
︙ | ︙ | |||
5454 5455 5456 5457 5458 5459 5460 | /* ** 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. */ | | | 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 | /* ** 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; |
︙ | ︙ | |||
5582 5583 5584 5585 5586 5587 5588 | /* ** 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. */ | | | 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 | /* ** 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.) */ |
︙ | ︙ | |||
5619 5620 5621 5622 5623 5624 5625 | /* ** tclcmd: file_control_sizehint_test DB DBNAME SIZE ** ** This TCL command runs the sqlite3_file_control interface ** with SQLITE_FCNTL_SIZE_HINT */ | | | 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 | /* ** 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.) */ |
︙ | ︙ | |||
5657 5658 5659 5660 5661 5662 5663 | /* ** 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. */ | | | 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 | /* ** 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; |
︙ | ︙ | |||
5811 5812 5813 5814 5815 5816 5817 | #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. */ | | | 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 | #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; |
︙ | ︙ | |||
5844 5845 5846 5847 5848 5849 5850 | /* ** 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. */ | | | 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 | /* ** 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; |
︙ | ︙ | |||
5880 5881 5882 5883 5884 5885 5886 | /* ** tclcmd: file_control_persist_wal DB PERSIST-FLAG ** ** This TCL command runs the sqlite3_file_control interface with ** the SQLITE_FCNTL_PERSIST_WAL opcode. */ | | | 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 | /* ** 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; |
︙ | ︙ | |||
5911 5912 5913 5914 5915 5916 5917 | } /* ** tclcmd: file_control_powersafe_overwrite DB PSOW-FLAG ** ** This TCL command runs the sqlite3_file_control interface with ** the SQLITE_FCNTL_POWERSAFE_OVERWRITE opcode. */ | | | 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 | } /* ** 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; |
︙ | ︙ | |||
5943 5944 5945 5946 5947 5948 5949 | /* ** tclcmd: file_control_vfsname DB ?AUXDB? ** ** Return a string that describes the stack of VFSes. */ | | | 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 | /* ** 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"; |
︙ | ︙ | |||
5975 5976 5977 5978 5979 5980 5981 | } /* ** tclcmd: file_control_tempfilename DB ?AUXDB? ** ** Return a string that is a temporary filename */ | | | 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 | } /* ** 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"; |
︙ | ︙ | |||
6008 6009 6010 6011 6012 6013 6014 | /* ** tclcmd: sqlite3_vfs_list ** ** Return a tcl list containing the names of all registered vfs's. */ | | | 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 | /* ** 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(); |
︙ | ︙ | |||
6033 6034 6035 6036 6037 6038 6039 | /* ** tclcmd: sqlite3_limit DB ID VALUE ** ** This TCL command runs the sqlite3_limit interface and ** verifies correct operation of the same. */ | | | 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 | /* ** 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; |
︙ | ︙ | |||
6096 6097 6098 6099 6100 6101 6102 | /* ** 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. */ | | | | | | | | 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 | /* ** 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; |
︙ | ︙ | |||
6210 6211 6212 6213 6214 6215 6216 | } #endif /* SQLITE_ENABLE_UNLOCK_NOTIFY */ /* ** tclcmd: sqlite3_unlock_notify db */ #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY | | | 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 | } #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; |
︙ | ︙ | |||
6236 6237 6238 6239 6240 6241 6242 | return TCL_OK; } #endif /* ** tclcmd: sqlite3_wal_checkpoint db ?NAME? */ | | | 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 | 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; |
︙ | ︙ | |||
6280 6281 6282 6283 6284 6285 6286 | ** ** 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. */ | | | 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 | ** ** 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; |
︙ | ︙ | |||
6336 6337 6338 6339 6340 6341 6342 | return TCL_OK; } /* ** tclcmd: sqlite3_wal_autocheckpoint db VALUE */ | | | 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 | 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; |
︙ | ︙ | |||
6387 6388 6389 6390 6391 6392 6393 | 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); } | | | 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 | 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"); |
︙ | ︙ | |||
6418 6419 6420 6421 6422 6423 6424 | /* ** tcl_objproc COMMANDNAME ARGS... ** ** Run a TCL command using its objProc interface. Throw an error if ** the command has no objProc interface. */ | | | 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 | /* ** 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 ){ |
︙ | ︙ | |||
6481 6482 6483 6484 6485 6486 6487 | printf("%d %d %d %s\n", iSelectid, iOrder, iFrom, zDetail); } return sqlite3_finalize(pExplain); } | | | 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 | 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; |
︙ | ︙ | |||
6509 6510 6511 6512 6513 6514 6515 | return TCL_OK; } #endif /* SQLITE_OMIT_EXPLAIN */ /* ** sqlite3_test_control VERB ARGS... */ | | | 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 | 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; |
︙ | ︙ | |||
6588 6589 6590 6591 6592 6593 6594 | return TCL_OK; } #if SQLITE_OS_UNIX #include <sys/time.h> #include <sys/resource.h> | | | 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 | 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; |
︙ | ︙ | |||
6631 6632 6633 6634 6635 6636 6637 | #if SQLITE_OS_WIN #include <process.h> /* ** The background thread that does file locking. */ | | | 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 | #if SQLITE_OS_WIN #include <process.h> /* ** The background thread that does file locking. */ static void SQLITE_CDECL win32_file_locker(void *pAppData){ struct win32FileLocker *p = (struct win32FileLocker*)pAppData; if( p->evName ){ HANDLE ev = OpenEvent(EVENT_MODIFY_STATE, FALSE, p->evName); if ( ev ){ SetEvent(ev); CloseHandle(ev); } |
︙ | ︙ | |||
6662 6663 6664 6665 6666 6667 6668 | #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. */ | | | 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 | #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; |
︙ | ︙ | |||
6726 6727 6728 6729 6730 6731 6732 | /* ** 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 "\\?\". */ | | | 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 | /* ** 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"); |
︙ | ︙ | |||
6748 6749 6750 6751 6752 6753 6754 | /* ** 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 ** "\\?\". */ | | | 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 | /* ** 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; |
︙ | ︙ | |||
6793 6794 6795 6796 6797 6798 6799 | /* ** delete_win32_file FILENAME ** ** Deletes the specified file, whose fully qualified name may exceed 260 ** characters if it is prefixed with "\\?\". */ | | | 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 | /* ** 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"); |
︙ | ︙ | |||
6817 6818 6819 6820 6821 6822 6823 | /* ** make_win32_dir DIRECTORY ** ** Creates the specified directory, whose fully qualified name may exceed 248 ** characters if it is prefixed with "\\?\". */ | | | 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 | /* ** 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"); |
︙ | ︙ | |||
6841 6842 6843 6844 6845 6846 6847 | /* ** remove_win32_dir DIRECTORY ** ** Removes the specified directory, whose fully qualified name may exceed 248 ** characters if it is prefixed with "\\?\". */ | | | 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 | /* ** 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"); |
︙ | ︙ | |||
6868 6869 6870 6871 6872 6873 6874 | /* ** 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. */ | | | 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 | /* ** 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; |
︙ | ︙ | |||
6925 6926 6927 6928 6929 6930 6931 | } return TCL_ERROR; } sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, db, mask); return TCL_OK; } | < | | 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 | } return TCL_ERROR; } sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, db, mask); return TCL_OK; } /* ** 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*); |
︙ | ︙ | |||
7009 7010 7011 7012 7013 7014 7015 | return TCL_OK; } /* ** sorter_test_fakeheap BOOL ** */ | | | 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 | 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 ){ |
︙ | ︙ | |||
7049 7050 7051 7052 7053 7054 7055 | ** 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). */ | | | 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 | ** 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; |
︙ | ︙ | |||
7118 7119 7120 7121 7122 7123 7124 | #ifdef SQLITE_USER_AUTHENTICATION #include "sqlite3userauth.h" /* ** tclcmd: sqlite3_user_authenticate DB USERNAME PASSWORD */ | | | 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 | #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; |
︙ | ︙ | |||
7149 7150 7151 7152 7153 7154 7155 | } #endif /* SQLITE_USER_AUTHENTICATION */ #ifdef SQLITE_USER_AUTHENTICATION /* ** tclcmd: sqlite3_user_add DB USERNAME PASSWORD ISADMIN */ | | | 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 | } #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; |
︙ | ︙ | |||
7182 7183 7184 7185 7186 7187 7188 | } #endif /* SQLITE_USER_AUTHENTICATION */ #ifdef SQLITE_USER_AUTHENTICATION /* ** tclcmd: sqlite3_user_change DB USERNAME PASSWORD ISADMIN */ | | | 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 | } #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; |
︙ | ︙ | |||
7215 7216 7217 7218 7219 7220 7221 | } #endif /* SQLITE_USER_AUTHENTICATION */ #ifdef SQLITE_USER_AUTHENTICATION /* ** tclcmd: sqlite3_user_delete DB USERNAME */ | | | 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 | } #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; |
︙ | ︙ | |||
7252 7253 7254 7255 7256 7257 7258 | ** ** TYPE BEHAVIOR ** 1 Overflow a signed integer ** 2 Jump based on an uninitialized variable ** 3 Read after free ** 4 Panic */ | | | 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 | ** ** 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; |
︙ | ︙ | |||
7302 7303 7304 7305 7306 7307 7308 | } /* ** tclcmd: register_dbstat_vtab DB ** ** Cause the dbstat virtual table to be available on the connection DB */ | | | 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 | } /* ** 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 " |
︙ | ︙ | |||
7336 7337 7338 7339 7340 7341 7342 | } /* ** tclcmd: sqlite3_db_config DB SETTING VALUE ** ** Invoke sqlite3_db_config() for one of the setting values. */ | | | 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 | } /* ** 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; |
︙ | ︙ | |||
7393 7394 7395 7396 7397 7398 7399 | 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; | | | 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 | 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.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Code for testing the pager.c module in SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. */ #include "sqliteInt.h" | > > > | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** ************************************************************************* ** Code for testing the pager.c module in SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #include <string.h> #include <ctype.h> extern const char *sqlite3ErrName(int); /* |
︙ | ︙ | |||
34 35 36 37 38 39 40 | } /* ** 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; |
︙ | ︙ | |||
71 72 73 74 75 76 77 | } /* ** 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; |
︙ | ︙ | |||
98 99 100 101 102 103 104 | } /* ** 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; |
︙ | ︙ | |||
125 126 127 128 129 130 131 | } /* ** 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; |
︙ | ︙ | |||
157 158 159 160 161 162 163 | } /* ** 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; |
︙ | ︙ | |||
184 185 186 187 188 189 190 | } /* ** 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; |
︙ | ︙ | |||
212 213 214 215 216 217 218 | } /* ** 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; |
︙ | ︙ | |||
239 240 241 242 243 244 245 | } /* ** 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; |
︙ | ︙ | |||
272 273 274 275 276 277 278 | } /* ** 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]; |
︙ | ︙ | |||
298 299 300 301 302 303 304 | } /* ** 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]; |
︙ | ︙ | |||
335 336 337 338 339 340 341 | /* ** 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]; |
︙ | ︙ | |||
363 364 365 366 367 368 369 | } 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; |
︙ | ︙ | |||
388 389 390 391 392 393 394 | /* ** 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 ){ |
︙ | ︙ | |||
410 411 412 413 414 415 416 | } /* ** 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; |
︙ | ︙ | |||
434 435 436 437 438 439 440 | } /* ** 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; |
︙ | ︙ | |||
458 459 460 461 462 463 464 | } /* ** 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; |
︙ | ︙ | |||
494 495 496 497 498 499 500 | ** ** 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; |
︙ | ︙ | |||
547 548 549 550 551 552 553 | /* ** 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; |
︙ | ︙ | |||
612 613 614 615 616 617 618 | /* ** 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; |
︙ | ︙ | |||
655 656 657 658 659 660 661 | /* ** 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.
︙ | ︙ | |||
11 12 13 14 15 16 17 | ************************************************************************* ** Code for testing the btree.c module in SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. */ #include "sqliteInt.h" #include "btreeInt.h" | > > > | > | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | ************************************************************************* ** Code for testing the btree.c module in SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. */ #include "sqliteInt.h" #include "btreeInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #include <string.h> extern const char *sqlite3ErrName(int); /* ** A bogus sqlite3 connection structure for use in the btree ** tests. */ static sqlite3 sDb; 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; |
︙ | ︙ | |||
75 76 77 78 79 80 81 | } /* ** 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; |
︙ | ︙ | |||
110 111 112 113 114 115 116 | /* ** 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; |
︙ | ︙ | |||
139 140 141 142 143 144 145 | } /* ** 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; |
︙ | ︙ | |||
189 190 191 192 193 194 195 | } /* ** 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; |
︙ | ︙ | |||
238 239 240 241 242 243 244 | } /* ** 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; |
︙ | ︙ | |||
275 276 277 278 279 280 281 | /* ** 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; |
︙ | ︙ | |||
310 311 312 313 314 315 316 | /* ** 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; |
︙ | ︙ | |||
345 346 347 348 349 350 351 | /* ** 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; |
︙ | ︙ | |||
374 375 376 377 378 379 380 | } /* ** 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; |
︙ | ︙ | |||
412 413 414 415 416 417 418 | ** 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; |
︙ | ︙ | |||
496 497 498 499 500 501 502 | ** ** 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; |
︙ | ︙ | |||
536 537 538 539 540 541 542 | } /* ** 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; |
︙ | ︙ | |||
567 568 569 570 571 572 573 | } /* ** 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; |
︙ | ︙ | |||
597 598 599 600 601 602 603 | } /* ** 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.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the SQLite library in a multithreaded environment. */ #include "sqliteInt.h" | > > > | > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the SQLite library in a multithreaded environment. */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #if SQLITE_OS_UNIX && SQLITE_THREADSAFE #include <stdlib.h> #include <string.h> #include <pthread.h> #include <sched.h> #include <ctype.h> |
︙ | ︙ | |||
117 118 119 120 121 122 123 | /* ** 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; |
︙ | ︙ | |||
166 167 168 169 170 171 172 | } /* ** 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; |
︙ | ︙ | |||
210 211 212 213 214 215 216 | /* ** 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; |
︙ | ︙ | |||
245 246 247 248 249 250 251 | /* ** 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]; |
︙ | ︙ | |||
277 278 279 280 281 282 283 | /* ** 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; |
︙ | ︙ | |||
313 314 315 316 317 318 319 | /* ** 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; |
︙ | ︙ | |||
349 350 351 352 353 354 355 | /* ** 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; |
︙ | ︙ | |||
381 382 383 384 385 386 387 | /* ** 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; |
︙ | ︙ | |||
426 427 428 429 430 431 432 | } /* ** 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 ){ |
︙ | ︙ | |||
479 480 481 482 483 484 485 | } /* ** 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 ){ |
︙ | ︙ | |||
521 522 523 524 525 526 527 | } /* ** 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 ){ |
︙ | ︙ | |||
552 553 554 555 556 557 558 | } /* ** 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; |
︙ | ︙ | |||
592 593 594 595 596 597 598 | /* ** 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]; |
︙ | ︙ | |||
623 624 625 626 627 628 629 | 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*); |
︙ | ︙ | |||
655 656 657 658 659 660 661 | /* ** 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.
︙ | ︙ | |||
13 14 15 16 17 18 19 | ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. Specifically, the code in this file ** is used for testing the SQLite routines for converting between ** the various supported unicode encodings. */ #include "sqliteInt.h" #include "vdbeInt.h" | > > > | > | | 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 | ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. Specifically, the code in this file ** is used for testing the SQLite routines for converting between ** the various supported unicode encodings. */ #include "sqliteInt.h" #include "vdbeInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #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; |
︙ | ︙ | |||
50 51 52 53 54 55 56 | ** 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; |
︙ | ︙ | |||
114 115 116 117 118 119 120 | 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; |
︙ | ︙ | |||
178 179 180 181 182 183 184 | /* ** 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.
︙ | ︙ | |||
12 13 14 15 16 17 18 | ** ** This file contains code that modified the OS layer in order to simulate ** the effect on the database file of an OS crash or power failure. This ** is used to test the ability of SQLite to recover from those situations. */ #if SQLITE_TEST /* This file is used for testing only */ #include "sqliteInt.h" | > > > | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ** ** This file contains code that modified the OS layer in order to simulate ** the effect on the database file of an OS crash or power failure. This ** is used to test the ability of SQLite to recover from those situations. */ #if SQLITE_TEST /* This file is used for testing only */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #ifndef SQLITE_OMIT_DISKIO /* This file is a no-op if disk I/O is disabled */ /* #define TRACE_CRASHTEST */ typedef struct CrashFile CrashFile; typedef struct CrashGlobal CrashGlobal; |
︙ | ︙ | |||
803 804 805 806 807 808 809 | /* ** 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 = { |
︙ | ︙ | |||
899 900 901 902 903 904 905 | ** "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; |
︙ | ︙ | |||
946 947 948 949 950 951 952 | 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); |
︙ | ︙ | |||
969 970 971 972 973 974 975 | 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; |
︙ | ︙ | |||
1027 1028 1029 1030 1031 1032 1033 | 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.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the client/server version of the SQLite library. ** Derived from test4.c. */ #include "sqliteInt.h" | > > > | > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the client/server version of the SQLite library. ** Derived from test4.c. */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif /* ** This test only works on UNIX with a SQLITE_THREADSAFE build that includes ** the SQLITE_SERVER option. */ #if defined(SQLITE_SERVER) && !defined(SQLITE_OMIT_SHARED_CACHE) && \ SQLITE_OS_UNIX && SQLITE_THREADSAFE |
︙ | ︙ | |||
145 146 147 148 149 150 151 | /* ** 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; |
︙ | ︙ | |||
198 199 200 201 202 203 204 | } /* ** 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; |
︙ | ︙ | |||
242 243 244 245 246 247 248 | /* ** 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; |
︙ | ︙ | |||
290 291 292 293 294 295 296 | /* ** 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]; |
︙ | ︙ | |||
322 323 324 325 326 327 328 | /* ** 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; |
︙ | ︙ | |||
358 359 360 361 362 363 364 | /* ** 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; |
︙ | ︙ | |||
396 397 398 399 400 401 402 | /* ** 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; |
︙ | ︙ | |||
428 429 430 431 432 433 434 | /* ** 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; |
︙ | ︙ | |||
473 474 475 476 477 478 479 | } /* ** 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 ){ |
︙ | ︙ | |||
526 527 528 529 530 531 532 | } /* ** 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 ){ |
︙ | ︙ | |||
568 569 570 571 572 573 574 | } /* ** 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 ){ |
︙ | ︙ | |||
612 613 614 615 616 617 618 | } /* ** 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 ){ |
︙ | ︙ | |||
643 644 645 646 647 648 649 | } /* ** 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.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Code for testing the virtual table interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. */ #include "sqliteInt.h" | > > > | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** ************************************************************************* ** Code for testing the virtual table interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #include <string.h> #ifndef SQLITE_OMIT_VIRTUALTABLE typedef struct echo_vtab echo_vtab; typedef struct echo_cursor echo_cursor; |
︙ | ︙ | |||
1349 1350 1351 1352 1353 1354 1355 | 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; |
︙ | ︙ | |||
1389 1390 1391 1392 1393 1394 1395 | } /* ** 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.
︙ | ︙ | |||
11 12 13 14 15 16 17 | ************************************************************************* ** ** This file contains obscure tests of the C-interface required ** for completeness. Test code is written in C for these cases ** as there is not much point in binding to Tcl. */ #include "sqliteInt.h" | > > > | > | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ************************************************************************* ** ** This file contains obscure tests of the C-interface required ** for completeness. Test code is written in C for these cases ** as there is not much point in binding to Tcl. */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #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; |
︙ | ︙ | |||
59 60 61 62 63 64 65 | 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"; |
︙ | ︙ | |||
100 101 102 103 104 105 106 | 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.
︙ | ︙ | |||
11 12 13 14 15 16 17 | ************************************************************************* ** ** This file contains a binding of the asynchronous IO extension interface ** (defined in ext/async/sqlite3async.h) to Tcl. */ #define TCL_THREADS | > > > | > > > > | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ************************************************************************* ** ** This file contains a binding of the asynchronous IO extension interface ** (defined in ext/async/sqlite3async.h) to Tcl. */ #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> /* From main.c */ extern const char *sqlite3ErrName(int); struct TestAsyncGlobal { int isInstalled; /* True when async VFS is installed */ } 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; |
︙ | ︙ | |||
65 66 67 68 69 70 71 | } 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; |
︙ | ︙ | |||
89 90 91 92 93 94 95 | } /* ** 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; |
︙ | ︙ | |||
121 122 123 124 125 126 127 | ** 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 ){ |
︙ | ︙ | |||
147 148 149 150 151 152 153 | 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2006 August 23 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Test extension for testing the sqlite3_auto_extension() function. */ | > > > | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /* ** 2006 August 23 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** 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 /* ** The sqr() SQL function returns the square of its input value. |
︙ | ︙ | |||
83 84 85 86 87 88 89 | } /* ** 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(*)(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(*)(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(*)(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(*)(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(*)(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(*)(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.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains test logic for the sqlite3_backup() interface. ** */ | > > > | > > > > | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains test logic for the sqlite3_backup() interface. ** */ #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 |
︙ | ︙ | |||
94 95 96 97 98 99 100 | 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.
︙ | ︙ | |||
89 90 91 92 93 94 95 | ** for the current scan. The leftmost column returned by the SELECT is assumed ** to contain the rowid. Other columns must follow, in order from left to ** right. */ #include "sqliteInt.h" | > > > | > | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | ** for the current scan. The leftmost column returned by the SELECT is assumed ** to contain the rowid. Other columns must follow, in order from left to ** right. */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #ifndef SQLITE_OMIT_VIRTUALTABLE typedef struct tcl_vtab tcl_vtab; typedef struct tcl_cursor tcl_cursor; /* |
︙ | ︙ | |||
559 560 561 562 563 564 565 | ** 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.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** */ #include "sqliteInt.h" | > > > | > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #include <string.h> #include <assert.h> #ifndef SQLITE_OMIT_INCRBLOB /* These functions are implemented in main.c. */ extern const char *sqlite3ErrName(int); |
︙ | ︙ | |||
91 92 93 94 95 96 97 | } /* ** 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; |
︙ | ︙ | |||
142 143 144 145 146 147 148 | 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; |
︙ | ︙ | |||
170 171 172 173 174 175 176 | } 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; |
︙ | ︙ | |||
206 207 208 209 210 211 212 | ** 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; |
︙ | ︙ | |||
258 259 260 261 262 263 264 | ** 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.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Code for testing the btree.c module in SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. */ #include "btreeInt.h" | > > > | > | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ** ************************************************************************* ** Code for testing the btree.c module in SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. */ #include "btreeInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif /* ** 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_config.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 | #include "sqliteLimit.h" #include "sqliteInt.h" #if SQLITE_OS_WIN # include "os_win.h" #endif | > > > | > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include "sqliteLimit.h" #include "sqliteInt.h" #if SQLITE_OS_WIN # include "os_win.h" #endif #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #include <string.h> /* ** Macro to stringify the results of the evaluation a pre-processor ** macro. i.e. so that STRINGVALUE(SQLITE_NOMEM) -> "7". */ |
︙ | ︙ |
Changes to src/test_demovfs.c.
︙ | ︙ | |||
637 638 639 640 641 642 643 | } #endif /* !defined(SQLITE_TEST) || SQLITE_OS_UNIX */ #ifdef SQLITE_TEST | > > > | > > > > | | | 637 638 639 640 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 | } #endif /* !defined(SQLITE_TEST) || SQLITE_OS_UNIX */ #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.
︙ | ︙ | |||
58 59 60 61 62 63 64 | ** contents of the file-system, starting at "/". To restrict the search ** space, the virtual table supports LIKE and GLOB constraints on the ** 'path' column. For example: ** ** SELECT * FROM fstree WHERE path LIKE '/home/dan/sqlite/%' */ #include "sqliteInt.h" | > > > | > | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | ** contents of the file-system, starting at "/". To restrict the search ** space, the virtual table supports LIKE and GLOB constraints on the ** 'path' column. For example: ** ** SELECT * FROM fstree WHERE path LIKE '/home/dan/sqlite/%' */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> |
︙ | ︙ | |||
867 868 869 870 871 872 873 | ** 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.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing all sorts of SQLite interfaces. This code ** implements new SQL functions used by the test scripts. */ #include "sqlite3.h" | > > > | > < | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing all sorts of SQLite interfaces. This code ** implements new SQL functions used by the test scripts. */ #include "sqlite3.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #include <string.h> #include <assert.h> #include "sqliteInt.h" #include "vdbeInt.h" /* ** Allocate nByte bytes of space using sqlite3_malloc(). If the ** allocation fails, call sqlite3_result_error_nomem() to notify ** the database handle that malloc() has failed. */ static void *testContextMalloc(sqlite3_context *context, int nByte){ |
︙ | ︙ | |||
636 637 638 639 640 641 642 | int argc, sqlite3_value **argv ){ sqlite3_result_value(context, argv[0]); sqlite3_result_subtype(context, (unsigned int)sqlite3_value_int(argv[1])); } | | > > > > | 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | int argc, sqlite3_value **argv ){ sqlite3_result_value(context, argv[0]); sqlite3_result_subtype(context, (unsigned int)sqlite3_value_int(argv[1])); } static int registerTestFunctions( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pThunk ){ static const struct { char *zName; signed char nArg; unsigned int eTextRep; /* 1: UTF-16. 0: UTF-8 */ void (*xFunc)(sqlite3_context*,int,sqlite3_value **); } aFuncs[] = { { "randstr", 2, SQLITE_UTF8, randStr }, |
︙ | ︙ | |||
685 686 687 688 689 690 691 | /* ** 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. */ | | | | | | | 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 | /* ** 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 *, char **, const sqlite3_api_routines *); int rc = sqlite3_auto_extension((void(*)(void))registerTestFunctions); if( rc==SQLITE_OK ){ rc = sqlite3_auto_extension((void(*)(void))Md5_Register); } Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } /* ** A bogus step function and finalizer function. */ static void tStep(sqlite3_context *a, int b, sqlite3_value **c){} static void tFinal(sqlite3_context *a){} /* ** 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; |
︙ | ︙ | |||
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | return TCL_OK; abuse_err: Tcl_AppendResult(interp, "sqlite3_create_function abused test failed", (char*)0); return TCL_ERROR; } /* ** Register commands with the TCL interpreter. */ int Sqlitetest_func_Init(Tcl_Interp *interp){ static struct { char *zName; Tcl_ObjCmdProc *xProc; } aObjCmd[] = { { "autoinstall_test_functions", autoinstall_test_funcs }, { "abuse_create_function", abuse_create_function }, }; int i; | > | | | | 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | return TCL_OK; abuse_err: Tcl_AppendResult(interp, "sqlite3_create_function abused test failed", (char*)0); return TCL_ERROR; } /* ** Register commands with the TCL interpreter. */ int Sqlitetest_func_Init(Tcl_Interp *interp){ static struct { char *zName; Tcl_ObjCmdProc *xProc; } aObjCmd[] = { { "autoinstall_test_functions", autoinstall_test_funcs }, { "abuse_create_function", abuse_create_function }, }; int i; extern int Md5_Register(sqlite3 *, char **, const sqlite3_api_routines *); for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ Tcl_CreateObjCommand(interp, aObjCmd[i].zName, aObjCmd[i].xProc, 0, 0); } sqlite3_initialize(); sqlite3_auto_extension((void(*)(void))registerTestFunctions); sqlite3_auto_extension((void(*)(void))Md5_Register); return TCL_OK; } |
Changes to src/test_hexio.c.
︙ | ︙ | |||
14 15 16 17 18 19 20 | ** database files and displaying the content of those files as ** hexadecimal. We could, in theory, use the built-in "binary" ** command of TCL to do a lot of this, but there are some issues ** with historical versions of the "binary" command. So it seems ** easier and safer to build our own mechanism. */ #include "sqliteInt.h" | > > > | > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ** database files and displaying the content of those files as ** hexadecimal. We could, in theory, use the built-in "binary" ** command of TCL to do a lot of this, but there are some issues ** with historical versions of the "binary" command. So it seems ** easier and safer to build our own mechanism. */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #include <string.h> #include <assert.h> /* ** Convert binary to hex. The input zBuf[] contains N bytes of |
︙ | ︙ | |||
90 91 92 93 94 95 96 | /* ** 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; |
︙ | ︙ | |||
140 141 142 143 144 145 146 | /* ** 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; |
︙ | ︙ | |||
188 189 190 191 192 193 194 | /* ** 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; |
︙ | ︙ | |||
228 229 230 231 232 233 234 | /* ** 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]; |
︙ | ︙ | |||
255 256 257 258 259 260 261 | /* ** 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]; |
︙ | ︙ | |||
285 286 287 288 289 290 291 | /* ** 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; |
︙ | ︙ | |||
336 337 338 339 340 341 342 | /* ** 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.
︙ | ︙ | |||
23 24 25 26 27 28 29 | ** of those subsystems that were initialized, and ** 3) A subsequent call to sqlite3_initialize() attempts to initialize ** the remaining, uninitialized, subsystems. */ #include "sqliteInt.h" #include <string.h> | > > > | > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ** of those subsystems that were initialized, and ** 3) A subsequent call to sqlite3_initialize() attempts to initialize ** the remaining, uninitialized, subsystems. */ #include "sqliteInt.h" #include <string.h> #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif static struct Wrapped { sqlite3_pcache_methods2 pcache; sqlite3_mem_methods mem; sqlite3_mutex_methods mutex; int mem_init; /* True if mem subsystem is initalized */ |
︙ | ︙ | |||
180 181 182 183 184 185 186 | 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(); |
︙ | ︙ | |||
204 205 206 207 208 209 210 | 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.
︙ | ︙ | |||
266 267 268 269 270 271 272 | } /***************************************************************************** ** Everything below is interface for testing this module. */ #ifdef SQLITE_TEST | > > > | > > > > | | 266 267 268 269 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; |
︙ | ︙ | |||
318 319 320 321 322 323 324 | } /* ** 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.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** ** This file contains code used to implement test interfaces to the ** memory allocation subsystem. */ #include "sqliteInt.h" | > > > | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** ************************************************************************* ** ** This file contains code used to implement test interfaces to the ** memory allocation subsystem. */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #include <string.h> #include <assert.h> /* ** This structure is used to encapsulate the global state variables used ** by malloc() fault simulation. |
︙ | ︙ | |||
302 303 304 305 306 307 308 | } /* ** 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; |
︙ | ︙ | |||
327 328 329 330 331 332 333 | } /* ** 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; |
︙ | ︙ | |||
356 357 358 359 360 361 362 | } /* ** 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 ){ |
︙ | ︙ | |||
387 388 389 390 391 392 393 | /* ** 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; |
︙ | ︙ | |||
433 434 435 436 437 438 439 | } /* ** 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; |
︙ | ︙ | |||
480 481 482 483 484 485 486 | } /* ** 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 ){ |
︙ | ︙ | |||
520 521 522 523 524 525 526 | /* ** 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 ){ |
︙ | ︙ | |||
546 547 548 549 550 551 552 | } /* ** 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"); |
︙ | ︙ | |||
571 572 573 574 575 576 577 | } /* ** 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 ){ |
︙ | ︙ | |||
611 612 613 614 615 616 617 | ** ** 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; |
︙ | ︙ | |||
677 678 679 680 681 682 683 | /* ** 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 ){ |
︙ | ︙ | |||
710 711 712 713 714 715 716 | ** 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 ){ |
︙ | ︙ | |||
791 792 793 794 795 796 797 | 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; |
︙ | ︙ | |||
889 890 891 892 893 894 895 | ** 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; |
︙ | ︙ | |||
929 930 931 932 933 934 935 | ** 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; |
︙ | ︙ | |||
972 973 974 975 976 977 978 | ** 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; |
︙ | ︙ | |||
1013 1014 1015 1016 1017 1018 1019 | } /* ** 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; |
︙ | ︙ | |||
1068 1069 1070 1071 1072 1073 1074 | /* ** 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; |
︙ | ︙ | |||
1103 1104 1105 1106 1107 1108 1109 | 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() */ |
︙ | ︙ | |||
1140 1141 1142 1143 1144 1145 1146 | 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() */ |
︙ | ︙ | |||
1170 1171 1172 1173 1174 1175 1176 | /* ** 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**); |
︙ | ︙ | |||
1208 1209 1210 1211 1212 1213 1214 | /* ** 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; |
︙ | ︙ | |||
1237 1238 1239 1240 1241 1242 1243 | /* ** 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; |
︙ | ︙ | |||
1265 1266 1267 1268 1269 1270 1271 | } /* ** 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; |
︙ | ︙ | |||
1295 1296 1297 1298 1299 1300 1301 | /* ** 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"); |
︙ | ︙ | |||
1331 1332 1333 1334 1335 1336 1337 | /* ** 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; |
︙ | ︙ | |||
1388 1389 1390 1391 1392 1393 1394 | /* ** 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; |
︙ | ︙ | |||
1449 1450 1451 1452 1453 1454 1455 | 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; |
︙ | ︙ | |||
1473 1474 1475 1476 1477 1478 1479 | 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.
︙ | ︙ | |||
1193 1194 1195 1196 1197 1198 1199 | gMultiplex.sIoMethodsV2.iVersion = 2; gMultiplex.sIoMethodsV2.xShmMap = multiplexShmMap; gMultiplex.sIoMethodsV2.xShmLock = multiplexShmLock; gMultiplex.sIoMethodsV2.xShmBarrier = multiplexShmBarrier; gMultiplex.sIoMethodsV2.xShmUnmap = multiplexShmUnmap; sqlite3_vfs_register(&gMultiplex.sThisVfs, makeDefault); | | | 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 | gMultiplex.sIoMethodsV2.iVersion = 2; gMultiplex.sIoMethodsV2.xShmMap = multiplexShmMap; gMultiplex.sIoMethodsV2.xShmLock = multiplexShmLock; gMultiplex.sIoMethodsV2.xShmBarrier = multiplexShmBarrier; gMultiplex.sIoMethodsV2.xShmUnmap = multiplexShmUnmap; sqlite3_vfs_register(&gMultiplex.sThisVfs, makeDefault); sqlite3_auto_extension((void(*)(void))multiplexFuncInit); return SQLITE_OK; } /* ** CAPI: Shutdown the multiplex system - sqlite3_multiplex_shutdown() ** |
︙ | ︙ | |||
1225 1226 1227 1228 1229 1230 1231 | sqlite3_vfs_unregister(&gMultiplex.sThisVfs); memset(&gMultiplex, 0, sizeof(gMultiplex)); return rc; } /***************************** Test Code ***********************************/ #ifdef SQLITE_TEST | > > > | > > > > | | 1225 1226 1227 1228 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 | sqlite3_vfs_unregister(&gMultiplex.sThisVfs); memset(&gMultiplex, 0, sizeof(gMultiplex)); 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 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 */ |
︙ | ︙ | |||
1263 1264 1265 1266 1267 1268 1269 | 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() */ |
︙ | ︙ | |||
1291 1292 1293 1294 1295 1296 1297 | 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; |
︙ | ︙ | |||
1346 1347 1348 1349 1350 1351 1352 | 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.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains test logic for the sqlite3_mutex interfaces. */ | > > > | > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains test logic for the sqlite3_mutex interfaces. */ #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include "sqlite3.h" #include "sqliteInt.h" #include <stdlib.h> #include <assert.h> #include <string.h> #define MAX_MUTEXES (SQLITE_MUTEX_STATIC_VFS3+1) |
︙ | ︙ | |||
148 149 150 151 152 153 154 | 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; |
︙ | ︙ | |||
251 252 253 254 255 256 257 | 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; |
︙ | ︙ | |||
280 281 282 283 284 285 286 | 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; |
︙ | ︙ | |||
304 305 306 307 308 309 310 | } /* ** 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); |
︙ | ︙ | |||
331 332 333 334 335 336 337 | ** ** 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; |
︙ | ︙ | |||
393 394 395 396 397 398 399 | 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.
︙ | ︙ | |||
1100 1101 1102 1103 1104 1105 1106 | /************************************************************************** *************************************************************************** ** Tcl interface starts here. */ #if defined(SQLITE_TEST) || defined(TCLSH) | > > > | > > > > | | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 | /************************************************************************** *************************************************************************** ** Tcl interface starts here. */ #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 1295 | } } } 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 { Tcl_Interp *interp; /* Interpreter in which to run the script */ |
︙ | ︙ | |||
1346 1347 1348 1349 1350 1351 1352 | 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 */ |
︙ | ︙ | |||
1375 1376 1377 1378 1379 1380 1381 | 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() */ |
︙ | ︙ | |||
1398 1399 1400 1401 1402 1403 1404 | 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 */ |
︙ | ︙ | |||
1452 1453 1454 1455 1456 1457 1458 | 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() */ |
︙ | ︙ | |||
1478 1479 1480 1481 1482 1483 1484 | 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; |
︙ | ︙ | |||
1526 1527 1528 1529 1530 1531 1532 | 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 */ |
︙ | ︙ | |||
1556 1557 1558 1559 1560 1561 1562 | /* 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; |
︙ | ︙ | |||
1590 1591 1592 1593 1594 1595 1596 | 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; |
︙ | ︙ | |||
1618 1619 1620 1621 1622 1623 1624 | 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; |
︙ | ︙ | |||
1640 1641 1642 1643 1644 1645 1646 | 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; |
︙ | ︙ | |||
1666 1667 1668 1669 1670 1671 1672 | 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; |
︙ | ︙ | |||
1704 1705 1706 1707 1708 1709 1710 | 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; |
︙ | ︙ | |||
1769 1770 1771 1772 1773 1774 1775 | 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; |
︙ | ︙ | |||
1834 1835 1836 1837 1838 1839 1840 | 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; |
︙ | ︙ | |||
1858 1859 1860 1861 1862 1863 1864 | /* ** 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 */ |
︙ | ︙ | |||
1884 1885 1886 1887 1888 1889 1890 | /* ** 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; |
︙ | ︙ | |||
1907 1908 1909 1910 1911 1912 1913 | } /* ** 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.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Code for testing all sorts of SQLite interfaces. This code ** is not included in the SQLite library. */ #include "sqlite3.h" | > > > | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** ************************************************************************* ** Code for testing all sorts of SQLite interfaces. This code ** is not included in the SQLite library. */ #include "sqlite3.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif /* Solely for the UNUSED_PARAMETER() macro. */ #include "sqliteInt.h" #ifdef SQLITE_ENABLE_RTREE /* ** Type used to cache parameter information for the "circle" r-tree geometry |
︙ | ︙ | |||
349 350 351 352 353 354 355 | } /* END of implementation of "circle" geometry callback. ************************************************************************** *************************************************************************/ #include <assert.h> | > > > | > | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | } /* END of implementation of "circle" geometry callback. ************************************************************************** *************************************************************************/ #include <assert.h> #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif typedef struct Cube Cube; struct Cube { double x; double y; double z; double width; |
︙ | ︙ | |||
428 429 430 431 432 433 434 | *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); |
︙ | ︙ | |||
456 457 458 459 460 461 462 | 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.
︙ | ︙ | |||
31 32 33 34 35 36 37 | ")" /* If SQLITE_TEST is defined this code is preprocessed for use as part ** of the sqlite test binary "testfixture". Otherwise it is preprocessed ** to be compiled into an sqlite dynamic extension. */ #ifdef SQLITE_TEST | | > > > | > | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ")" /* If SQLITE_TEST is defined this code is preprocessed for use as part ** of the sqlite test binary "testfixture". Otherwise it is preprocessed ** to be compiled into an sqlite dynamic extension. */ #ifdef SQLITE_TEST # include "sqliteInt.h" # if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" # else # include "tcl.h" # endif #else # include "sqlite3ext.h" SQLITE_EXTENSION_INIT1 #endif #include <stdlib.h> #include <string.h> #include <assert.h> |
︙ | ︙ | |||
298 299 300 301 302 303 304 | ** 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.
︙ | ︙ | |||
253 254 255 256 257 258 259 | ************************************************************************** ************************************************************************** *************************************************************************/ #ifdef SQLITE_TEST | > > > | > > > > | | | 253 254 255 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 286 | ************************************************************************** ************************************************************************** *************************************************************************/ #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, ""); |
︙ | ︙ | |||
297 298 299 300 301 302 303 | return iVal; } /* ** Tclcmd: sqlite3demo_superlock CMDNAME PATH VFS BUSY-HANDLER-SCRIPT */ | | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | 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.
︙ | ︙ | |||
72 73 74 75 76 77 78 | ** If PGSZ is a power of two greater than 256, install a wrapper around ** OS function getpagesize() that reports the system page size as PGSZ. ** Or, if PGSZ is less than zero, remove any wrapper already installed. */ #include "sqliteInt.h" #include "sqlite3.h" | > > > | > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | ** If PGSZ is a power of two greater than 256, install a wrapper around ** OS function getpagesize() that reports the system page size as PGSZ. ** Or, if PGSZ is less than zero, remove any wrapper already installed. */ #include "sqliteInt.h" #include "sqlite3.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #include <string.h> #include <assert.h> #if SQLITE_OS_UNIX /* From main.c */ |
︙ | ︙ | |||
414 415 416 417 418 419 420 | 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; |
︙ | ︙ | |||
450 451 452 453 454 455 456 | } 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; |
︙ | ︙ | |||
474 475 476 477 478 479 480 | 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; |
︙ | ︙ | |||
512 513 514 515 516 517 518 | 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; |
︙ | ︙ | |||
562 563 564 565 566 567 568 | 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; |
︙ | ︙ | |||
608 609 610 611 612 613 614 | ); 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; |
︙ | ︙ | |||
638 639 640 641 642 643 644 | } 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; |
︙ | ︙ | |||
660 661 662 663 664 665 666 | 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; |
︙ | ︙ | |||
695 696 697 698 699 700 701 | 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.
︙ | ︙ | |||
13 14 15 16 17 18 19 | ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** ** The emphasis of this file is a virtual table that provides ** access to TCL variables. */ #include "sqliteInt.h" | > > > | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** ** The emphasis of this file is a virtual table that provides ** access to TCL variables. */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #include <stdlib.h> #include <string.h> #ifndef SQLITE_OMIT_VIRTUALTABLE /* ** Characters that make up the idxStr created by xBestIndex for xFilter. |
︙ | ︙ | |||
403 404 405 406 407 408 409 | ** 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.
︙ | ︙ | |||
12 13 14 15 16 17 18 | ** ** This file contains the implementation of some Tcl commands used to ** test that sqlite3 database handles may be concurrently accessed by ** multiple threads. Right now this only works on unix. */ #include "sqliteInt.h" | > > > | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ** ** This file contains the implementation of some Tcl commands used to ** test that sqlite3 database handles may be concurrently accessed by ** multiple threads. Right now this only works on unix. */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif #if SQLITE_THREADSAFE #include <errno.h> #if !defined(_MSC_VER) #include <unistd.h> |
︙ | ︙ | |||
68 69 70 71 72 73 74 | 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); |
︙ | ︙ | |||
163 164 165 166 167 168 169 | ** 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; |
︙ | ︙ | |||
216 217 218 219 220 221 222 | ** 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; |
︙ | ︙ | |||
261 262 263 264 265 266 267 | /* ** 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 280 281 282 283 284 285 286 287 288 289 290 | /* ** 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); const char *zFilename; sqlite3 *db; char zBuf[100]; extern int Md5_Register(sqlite3*,char**,const sqlite3_api_routines*); UNUSED_PARAMETER(clientData); UNUSED_PARAMETER(objc); zFilename = Tcl_GetString(objv[2]); sqlite3_open(zFilename, &db); #ifdef SQLITE_HAS_CODEC |
︙ | ︙ | |||
295 296 297 298 299 300 301 | sqlite3_close(db); Tcl_AppendResult(interp, zErrMsg, (char*)0); sqlite3_free(zErrMsg); return TCL_ERROR; } } #endif | | | | | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 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 | sqlite3_close(db); Tcl_AppendResult(interp, zErrMsg, (char*)0); sqlite3_free(zErrMsg); return TCL_ERROR; } } #endif Md5_Register(db, 0, 0); sqlite3_busy_handler(db, xBusy, 0); if( sqlite3TestMakePointerStr(interp, zBuf, db) ) return TCL_ERROR; Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; } /* ** 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; |
︙ | ︙ | |||
377 378 379 380 381 382 383 | /* ** 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); |
︙ | ︙ | |||
539 540 541 542 543 544 545 | /* 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; |
︙ | ︙ | |||
565 566 567 568 569 570 571 | 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.
︙ | ︙ | |||
24 25 26 27 28 29 30 | ** -mxpathname INTEGER (Value for sqlite3_vfs.mxPathname) ** -iversion INTEGER (Value for sqlite3_vfs.iVersion) */ #if SQLITE_TEST /* This file is used for testing only */ #include "sqlite3.h" #include "sqliteInt.h" | > > > | > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | ** -mxpathname INTEGER (Value for sqlite3_vfs.mxPathname) ** -iversion INTEGER (Value for sqlite3_vfs.iVersion) */ #if SQLITE_TEST /* This file is used for testing only */ #include "sqlite3.h" #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif typedef struct Testvfs Testvfs; typedef struct TestvfsShm TestvfsShm; typedef struct TestvfsBuffer TestvfsBuffer; typedef struct TestvfsFile TestvfsFile; typedef struct TestvfsFd TestvfsFd; |
︙ | ︙ | |||
1032 1033 1034 1035 1036 1037 1038 | } 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; |
︙ | ︙ | |||
1344 1345 1346 1347 1348 1349 1350 | 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); } |
︙ | ︙ | |||
1387 1388 1389 1390 1391 1392 1393 | ** 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 */ |
︙ | ︙ |
Changes to src/vtab.c.
︙ | ︙ | |||
943 944 945 946 947 948 949 | ** sqlite3.aVTrans[] array. */ rc = growVTrans(db); if( rc==SQLITE_OK ){ rc = pModule->xBegin(pVTab->pVtab); if( rc==SQLITE_OK ){ int iSvpt = db->nStatement + db->nSavepoint; addToVTrans(db, pVTab); | | > > > | 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | ** sqlite3.aVTrans[] array. */ rc = growVTrans(db); if( rc==SQLITE_OK ){ rc = pModule->xBegin(pVTab->pVtab); if( rc==SQLITE_OK ){ int iSvpt = db->nStatement + db->nSavepoint; addToVTrans(db, pVTab); if( iSvpt && pModule->xSavepoint ){ pVTab->iSavepoint = iSvpt; rc = pModule->xSavepoint(pVTab->pVtab, iSvpt-1); } } } } return rc; } /* |
︙ | ︙ |
Changes to src/where.c.
︙ | ︙ | |||
2474 2475 2476 2477 2478 2479 2480 | && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK ){ LogEst nIter; pNew->u.btree.nEq++; pNew->nSkip++; pNew->aLTerm[pNew->nLTerm++] = 0; pNew->wsFlags |= WHERE_SKIPSCAN; | | | | 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 | && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK ){ LogEst nIter; pNew->u.btree.nEq++; pNew->nSkip++; pNew->aLTerm[pNew->nLTerm++] = 0; pNew->wsFlags |= WHERE_SKIPSCAN; nIter = pProbe->aiRowLogEst[saved_nEq] - pProbe->aiRowLogEst[saved_nEq+1]; pNew->nOut -= nIter; /* TUNING: Because uncertainties in the estimates for skip-scan queries, ** add a 1.375 fudge factor to make skip-scan slightly less likely. */ nIter += 5; whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul); pNew->nOut = saved_nOut; pNew->u.btree.nEq = saved_nEq; pNew->nSkip = saved_nSkip; pNew->wsFlags = saved_wsFlags; } |
︙ | ︙ | |||
2782 2783 2784 2785 2786 2787 2788 | ** doing table lookups. The cost will be 3x the number of ** lookups. Take into account WHERE clause terms that can be ** satisfied using just the index, and that do not require a ** table lookup. */ LogEst nLookup = rSize + 16; /* Base cost: N*3 */ int ii; int iCur = pSrc->iCursor; | | | | | 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 | ** doing table lookups. The cost will be 3x the number of ** lookups. Take into account WHERE clause terms that can be ** satisfied using just the index, and that do not require a ** table lookup. */ LogEst nLookup = rSize + 16; /* Base cost: N*3 */ int ii; int iCur = pSrc->iCursor; WhereClause *pWC2 = &pWInfo->sWC; for(ii=0; ii<pWC2->nTerm; ii++){ WhereTerm *pTerm = &pWC2->a[ii]; if( !sqlite3ExprCoveredByIndex(pTerm->pExpr, iCur, pProbe) ){ break; } /* pTerm can be evaluated using just the index. So reduce ** the expected number of table lookups accordingly */ if( pTerm->truthProb<=0 ){ nLookup += pTerm->truthProb; |
︙ | ︙ | |||
3967 3968 3969 3970 3971 3972 3973 | pWInfo->eDistinct = WHERE_DISTINCT_ORDERED; } }else{ pWInfo->nOBSat = pFrom->isOrdered; pWInfo->revMask = pFrom->revLoop; if( pWInfo->nOBSat<=0 ){ pWInfo->nOBSat = 0; | | | 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 | pWInfo->eDistinct = WHERE_DISTINCT_ORDERED; } }else{ pWInfo->nOBSat = pFrom->isOrdered; pWInfo->revMask = pFrom->revLoop; if( pWInfo->nOBSat<=0 ){ pWInfo->nOBSat = 0; if( nLoop>0 && (pFrom->aLoop[nLoop-1]->wsFlags & WHERE_ONEROW)==0 ){ Bitmask m = 0; int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, pFrom, WHERE_ORDERBY_LIMIT, nLoop-1, pFrom->aLoop[nLoop-1], &m); if( rc==pWInfo->pOrderBy->nExpr ){ pWInfo->bOrderedInnerLoop = 1; pWInfo->revMask = m; } |
︙ | ︙ |
Changes to test/fts3conf.test.
︙ | ︙ | |||
206 207 208 209 210 211 212 213 214 | ROLLBACK TO abc; COMMIT; } do_execsql_test 4.2.2 { SELECT * FROM t01 WHERE t01 MATCH 'b'; INSERT INTO t01(t01) VALUES('integrity-check'); } {} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 206 207 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 | ROLLBACK TO abc; COMMIT; } do_execsql_test 4.2.2 { SELECT * FROM t01 WHERE t01 MATCH 'b'; INSERT INTO t01(t01) VALUES('integrity-check'); } {} do_execsql_test 4.3.1 { CREATE VIRTUAL TABLE t02 USING fts4; INSERT INTO t01 VALUES('1 1 1'); INSERT INTO t02 VALUES('2 2 2'); BEGIN; SAVEPOINT abc; INSERT INTO t01 VALUES('a b c'); INSERT INTO t02 VALUES('a b c'); ROLLBACK TO abc; COMMIT; } do_execsql_test 4.3.2 { SELECT * FROM t01 WHERE t01 MATCH 'b'; INSERT INTO t01(t01) VALUES('integrity-check'); } {} do_execsql_test 4.4.1 { CREATE TABLE A(ID INTEGER PRIMARY KEY, AnotherID INTEGER, Notes TEXT); CREATE VIRTUAL TABLE AFTS USING FTS4 (Notes); CREATE TRIGGER A_DeleteTrigger AFTER DELETE ON A FOR EACH ROW BEGIN DELETE FROM AFTS WHERE rowid=OLD.ID; END; CREATE TABLE B(ID INTEGER PRIMARY KEY,Notes TEXT); CREATE VIRTUAL TABLE BFTS USING FTS3 (Notes); CREATE TRIGGER B_DeleteTrigger AFTER DELETE ON B FOR EACH ROW BEGIN DELETE FROM BFTS WHERE rowid=OLD.ID; END; } do_execsql_test 4.4.2 { BEGIN TRANSACTION; DELETE FROM A WHERE AnotherID=1; DELETE FROM B WHERE ID=1; COMMIT; } finish_test |
Changes to test/fuzzcheck.c.
︙ | ︙ | |||
778 779 780 781 782 783 784 | */ static void showHelp(void){ printf("Usage: %s [options] SOURCE-DB ?ARGS...?\n", g.zArgv0); printf( "Read databases and SQL scripts from SOURCE-DB and execute each script against\n" "each database, checking for crashes and memory leaks.\n" "Options:\n" | | | | | | | | | | | | | | | | | | | 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 | */ static void showHelp(void){ printf("Usage: %s [options] SOURCE-DB ?ARGS...?\n", g.zArgv0); printf( "Read databases and SQL scripts from SOURCE-DB and execute each script against\n" "each database, checking for crashes and memory leaks.\n" "Options:\n" " --cell-size-check Set the PRAGMA cell_size_check=ON\n" " --dbid N Use only the database where dbid=N\n" " --export-db DIR Write databases to files(s) in DIR. Works with --dbid\n" " --export-sql DIR Write SQL to file(s) in DIR. Also works with --sqlid\n" " --help Show this help text\n" " -q|--quiet Reduced output\n" " --limit-mem N Limit memory used by test SQLite instance to N bytes\n" " --limit-vdbe Panic if any test runs for more than 100,000 cycles\n" " --load-sql ARGS... Load SQL scripts fro files into SOURCE-DB\n" " --load-db ARGS... Load template databases from files into SOURCE_DB\n" " -m TEXT Add a description to the database\n" " --native-vfs Use the native VFS for initially empty database files\n" " --rebuild Rebuild and vacuum the database file\n" " --result-trace Show the results of each SQL command\n" " --sqlid N Use only SQL where sqlid=N\n" " --timeout N Abort if any single test needs more than N seconds\n" " -v|--verbose Increased output. Repeat for more output.\n" ); } int main(int argc, char **argv){ sqlite3_int64 iBegin; /* Start time of this program */ int quietFlag = 0; /* True if --quiet or -q */ int verboseFlag = 0; /* True if --verbose or -v */ |
︙ | ︙ |
Changes to test/limit2.test.
︙ | ︙ | |||
72 73 74 75 76 77 78 79 80 81 82 | do_execsql_test limit2-120.2 { SELECT a, b, '|' FROM t1 WHERE a IN (2,4,5,3,1) ORDER BY +b DESC LIMIT 5; } {5 9999 | 1 1999 | 1 1998 | 1 1997 | 1 1996 |} do_test limit2-120.3 { set slow_count $sqlite_search_count expr {$fast_count < 0.02*$slow_count} } {1} finish_test | > > > > > > > > > > > > > > > > > > > > > > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | do_execsql_test limit2-120.2 { SELECT a, b, '|' FROM t1 WHERE a IN (2,4,5,3,1) ORDER BY +b DESC LIMIT 5; } {5 9999 | 1 1999 | 1 1998 | 1 1997 | 1 1996 |} do_test limit2-120.3 { set slow_count $sqlite_search_count expr {$fast_count < 0.02*$slow_count} } {1} # Bug report against the new ORDER BY LIMIT optimization just prior to # release. (Unreleased so there is no ticket). # # Make sure the optimization is not applied if the inner loop can only # provide a single row of output. # do_execsql_test limit2-200 { CREATE TABLE t200(a, b); WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<1000) INSERT INTO t200(a,b) SELECT x, x FROM c; CREATE TABLE t201(x INTEGER PRIMARY KEY, y); INSERT INTO t201(x,y) VALUES(2,12345); SELECT *, '|' FROM t200, t201 WHERE x=b ORDER BY y LIMIT 3; } {2 2 2 12345 |} do_execsql_test limit2-210 { SELECT *, '|' FROM t200 LEFT JOIN t201 ON x=b ORDER BY y LIMIT 3; } {1 1 {} {} | 3 3 {} {} | 4 4 {} {} |} finish_test |
Changes to test/loadext.test.
︙ | ︙ | |||
77 78 79 80 81 82 83 | # test file. # if {![file exists $testextension]} { set srcdir [file dir $testdir]/src set testextsrc $srcdir/test_loadext.c set cmdline [concat exec gcc $gcc_shared] | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | # test file. # if {![file exists $testextension]} { set srcdir [file dir $testdir]/src set testextsrc $srcdir/test_loadext.c set cmdline [concat exec gcc $gcc_shared] lappend cmdline -Wall -I$srcdir -I. -I.. -g $testextsrc -o $testextension if {[catch $cmdline msg]} { puts "Skipping loadext tests: Test extension not built..." puts $msg finish_test return } |
︙ | ︙ |
Changes to test/releasetest.tcl.
︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 | --disable-amalgamation --disable-shared --enable-session } "Sanitize" { CC=clang -fsanitize=undefined -DSQLITE_ENABLE_STAT4 --enable-session } "Have-Not" { # The "Have-Not" configuration sets all possible -UHAVE_feature options # in order to verify that the code works even on platforms that lack # these support services. -DHAVE_FDATASYNC=0 -DHAVE_GMTIME_R=0 | > > > > | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | --disable-amalgamation --disable-shared --enable-session } "Sanitize" { CC=clang -fsanitize=undefined -DSQLITE_ENABLE_STAT4 --enable-session } "Stdcall" { -DUSE_STDCALL=1 -O2 } "Have-Not" { # The "Have-Not" configuration sets all possible -UHAVE_feature options # in order to verify that the code works even on platforms that lack # these support services. -DHAVE_FDATASYNC=0 -DHAVE_GMTIME_R=0 |
︙ | ︙ | |||
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | } Darwin-x86_64 { "Locking-Style" "mptest test" "Have-Not" test "Apple" "threadtest fulltest" } "Windows NT-intel" { "Have-Not" test "Default" "mptest fulltestonly" } "Windows NT-amd64" { "Have-Not" test "Default" "mptest fulltestonly" } # The Failure-Detection platform runs various tests that deliberately # fail. This is used as a test of this script to verify that this script # correctly identifies failures. | > > | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | } Darwin-x86_64 { "Locking-Style" "mptest test" "Have-Not" test "Apple" "threadtest fulltest" } "Windows NT-intel" { "Stdcall" test "Have-Not" test "Default" "mptest fulltestonly" } "Windows NT-amd64" { "Stdcall" test "Have-Not" test "Default" "mptest fulltestonly" } # The Failure-Detection platform runs various tests that deliberately # fail. This is used as a test of this script to verify that this script # correctly identifies failures. |
︙ | ︙ | |||
721 722 723 724 725 726 727 728 729 730 731 732 733 734 | # proc makeCommand { targets makeOpts cflags opts } { set result [list trace_cmd exec] if {$::MSVC} { set nmakeDir [file nativename $::SRCDIR] set nmakeFile [file nativename [file join $nmakeDir Makefile.msc]] lappend result nmake /f $nmakeFile TOP=$nmakeDir } else { lappend result make } foreach makeOpt $makeOpts { lappend result $makeOpt } lappend result clean | > > > | 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 | # proc makeCommand { targets makeOpts cflags opts } { set result [list trace_cmd exec] if {$::MSVC} { set nmakeDir [file nativename $::SRCDIR] set nmakeFile [file nativename [file join $nmakeDir Makefile.msc]] lappend result nmake /f $nmakeFile TOP=$nmakeDir if {[regexp {USE_STDCALL=1} $cflags]} { lappend result USE_STDCALL=1 } } else { lappend result make } foreach makeOpt $makeOpts { lappend result $makeOpt } lappend result clean |
︙ | ︙ |
Changes to test/scanstatus.test.
︙ | ︙ | |||
329 330 331 332 333 334 335 | do_eqp_test 5.3.1 { SELECT count(*) FROM t2 WHERE y = 'j'; } {0 0 0 {SEARCH TABLE t2 USING COVERING INDEX t2xy (ANY(x) AND y=?)}} do_execsql_test 5.3.2 { SELECT count(*) FROM t2 WHERE y = 'j'; } {19} do_scanstatus_test 5.3.3 { | | | | 329 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 355 356 357 358 359 | do_eqp_test 5.3.1 { SELECT count(*) FROM t2 WHERE y = 'j'; } {0 0 0 {SEARCH TABLE t2 USING COVERING INDEX t2xy (ANY(x) AND y=?)}} do_execsql_test 5.3.2 { SELECT count(*) FROM t2 WHERE y = 'j'; } {19} do_scanstatus_test 5.3.3 { nLoop 1 nVisit 19 nEst 56.0 zName t2xy zExplain {SEARCH TABLE t2 USING COVERING INDEX t2xy (ANY(x) AND y=?)} } do_eqp_test 5.4.1 { SELECT count(*) FROM t1, t2 WHERE y = c; } { 0 0 0 {SCAN TABLE t1 USING COVERING INDEX t1bc} 0 1 1 {SEARCH TABLE t2 USING COVERING INDEX t2xy (ANY(x) AND y=?)} } do_execsql_test 5.4.2 { SELECT count(*) FROM t1, t2 WHERE y = c; } {200} do_scanstatus_test 5.4.3 { nLoop 1 nVisit 10 nEst 10.0 zName t1bc zExplain {SCAN TABLE t1 USING COVERING INDEX t1bc} nLoop 10 nVisit 200 nEst 56.0 zName t2xy zExplain {SEARCH TABLE t2 USING COVERING INDEX t2xy (ANY(x) AND y=?)} } do_eqp_test 5.5.1 { SELECT count(*) FROM t1, t3 WHERE y = c; } { 0 0 1 {SCAN TABLE t3} |
︙ | ︙ |
Changes to test/shell1.test.
︙ | ︙ | |||
867 868 869 870 871 872 873 874 875 876 877 878 879 880 | # return character (and on Windows, the end-of-file character) # cannot be used here. # if {$i==0x0D || ($tcl_platform(platform)=="windows" && $i==0x1A)} { continue } if {$i>=0xE0 && $tcl_platform(os)=="OpenBSD"} continue set hex [format %02X $i] set char [subst \\x$hex]; set oldChar $char set escapes [list] if {$tcl_platform(platform)=="windows"} { # # NOTE: On Windows, we need to escape all the whitespace characters, # the alarm (\a) character, and those with special meaning to | > | 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 | # return character (and on Windows, the end-of-file character) # cannot be used here. # if {$i==0x0D || ($tcl_platform(platform)=="windows" && $i==0x1A)} { continue } if {$i>=0xE0 && $tcl_platform(os)=="OpenBSD"} continue if {$i>=0xE0 && $i<=0xEF && $tcl_platform(os)=="Linux"} continue set hex [format %02X $i] set char [subst \\x$hex]; set oldChar $char set escapes [list] if {$tcl_platform(platform)=="windows"} { # # NOTE: On Windows, we need to escape all the whitespace characters, # the alarm (\a) character, and those with special meaning to |
︙ | ︙ |
Changes to test/skipscan1.test.
︙ | ︙ | |||
39 40 41 42 43 44 45 | # index unconstrainted. # do_execsql_test skipscan1-1.2 { SELECT a,b,c,d,'|' FROM t1 WHERE b=345 ORDER BY a; } {abc 345 7 8 | def 345 9 10 |} do_execsql_test skipscan1-1.2eqp { EXPLAIN QUERY PLAN | | | | | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | # index unconstrainted. # do_execsql_test skipscan1-1.2 { SELECT a,b,c,d,'|' FROM t1 WHERE b=345 ORDER BY a; } {abc 345 7 8 | def 345 9 10 |} do_execsql_test skipscan1-1.2eqp { EXPLAIN QUERY PLAN SELECT a,b,c,d,'|' FROM t1 WHERE d<>99 AND b=345 ORDER BY a; } {/* USING INDEX t1abc (ANY(a) AND b=?)*/} do_execsql_test skipscan1-1.2sort { EXPLAIN QUERY PLAN SELECT a,b,c,d,'|' FROM t1 WHERE d<>99 AND b=345 ORDER BY a; } {~/*ORDER BY*/} do_execsql_test skipscan1-1.3 { SELECT a,b,c,d,'|' FROM t1 WHERE d<>99 AND b=345 ORDER BY a DESC; } {def 345 9 10 | abc 345 7 8 |} do_execsql_test skipscan1-1.3eqp { EXPLAIN QUERY PLAN SELECT a,b,c,d,'|' FROM t1 WHERE d<>99 AND b=345 ORDER BY a DESC; } {/* USING INDEX t1abc (ANY(a) AND b=?)*/} do_execsql_test skipscan1-1.3sort { EXPLAIN QUERY PLAN SELECT a,b,c,d,'|' FROM t1 WHERE d<>99 AND b=345 ORDER BY a DESC; } {~/*ORDER BY*/} do_execsql_test skipscan1-1.4 { SELECT a,b,c,d,'|' FROM t1 WHERE c=6 ORDER BY a, b, c; } {abc 234 6 7 | bcd 100 6 11 |} do_execsql_test skipscan1-1.4eqp { EXPLAIN QUERY PLAN |
︙ | ︙ | |||
146 147 148 149 150 151 152 | ** columns are not selective. */ ANALYZE; UPDATE sqlite_stat1 SET stat='10000 5000 2000 10' WHERE idx NOT NULL; ANALYZE sqlite_master; } {} do_execsql_test skipscan1-2.2 { | | | | | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | ** columns are not selective. */ ANALYZE; UPDATE sqlite_stat1 SET stat='10000 5000 2000 10' WHERE idx NOT NULL; ANALYZE sqlite_master; } {} do_execsql_test skipscan1-2.2 { SELECT a,b,c,d,'|' FROM t2 WHERE d<>99 AND b=345 ORDER BY a; } {abc 345 7 8 | def 345 9 10 |} do_execsql_test skipscan1-2.2eqp { EXPLAIN QUERY PLAN SELECT a,b,c,d,'|' FROM t2 WHERE d<>99 AND b=345 ORDER BY a; } {/* USING INDEX sqlite_autoindex_t2_1 (ANY(a) AND b=?)*/} do_execsql_test skipscan1-2.2sort { EXPLAIN QUERY PLAN SELECT a,b,c,d,'|' FROM t2 WHERE d<>99 AND b=345 ORDER BY a; } {~/*ORDER BY*/} do_execsql_test skipscan1-3.1 { CREATE TABLE t3(a TEXT, b INT, c INT, d INT, PRIMARY KEY(a,b,c)) WITHOUT ROWID; INSERT INTO t3 SELECT * FROM t1; |
︙ | ︙ |
Added test/time-wordcount.sh.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #!/bin/sh # # This script runs the wordcount program in different ways and generates # an output useful for performance comparisons. # # Select the source text to be analyzed. # if test "x$1" = "x"; then echo "Usage: $0 FILENAME [ARGS...]"; exit 1; fi # Do test runs # rm -f wcdb1.db ./wordcount --tag A: --timer --summary wcdb1.db $* --insert rm -f wcdb2.db ./wordcount --tag B: --timer --summary wcdb2.db $* --insert --without-rowid rm -f wcdb1.db ./wordcount --tag C: --timer --summary wcdb1.db $* --replace rm -f wcdb2.db ./wordcount --tag D: --timer --summary wcdb2.db $* --replace --without-rowid rm -f wcdb1.db ./wordcount --tag E: --timer --summary wcdb1.db $* --select rm -f wcdb2.db ./wordcount --tag F: --timer --summary wcdb2.db $* --select --without-rowid ./wordcount --tag G: --timer --summary wcdb1.db $* --query ./wordcount --tag H: --timer --summary wcdb1.db $* --query --without-rowid ./wordcount --tag I: --timer --summary wcdb1.db $* --delete ./wordcount --tag J: --timer --summary wcdb2.db $* --delete --without-rowid # Clean up temporary files created. # rm -f wcdb1.db wcdb2.db |
Changes to test/walprotocol.test.
︙ | ︙ | |||
65 66 67 68 69 70 71 | } [list {0 1 lock exclusive} {1 7 lock exclusive} \ {1 7 unlock exclusive} {0 1 unlock exclusive} \ ] proc lock_callback {method filename handle lock} { if {$lock == "1 7 lock exclusive"} { return SQLITE_BUSY } return SQLITE_OK } | | | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | } [list {0 1 lock exclusive} {1 7 lock exclusive} \ {1 7 unlock exclusive} {0 1 unlock exclusive} \ ] proc lock_callback {method filename handle lock} { if {$lock == "1 7 lock exclusive"} { return SQLITE_BUSY } return SQLITE_OK } puts "# Warning: This next test case causes SQLite to call xSleep(1) 100 times." puts "# Normally this equates to a delay of roughly 10 seconds, but if SQLite" puts "# is built on unix without HAVE_USLEEP defined, it may be much longer." do_test 1.3 { db close set ::locks [list] sqlite3 db test.db -vfs T catchsql { SELECT * FROM x } |
︙ | ︙ |
Changes to test/wordcount.c.
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ** --stats Show sqlite3_status() results at the end. ** --pagesize NNN Use a page size of NNN ** --cachesize NNN Use a cache size of NNN ** --commit NNN Commit after every NNN operations ** --nosync Use PRAGMA synchronous=OFF ** --journal MMMM Use PRAGMA journal_mode=MMMM ** --timer Time the operation of this program ** ** Modes: ** ** Insert mode means: ** (1) INSERT OR IGNORE INTO wordcount VALUES($new,1) ** (2) UPDATE wordcount SET cnt=cnt+1 WHERE word=$new -- if (1) is a noop ** | > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ** --stats Show sqlite3_status() results at the end. ** --pagesize NNN Use a page size of NNN ** --cachesize NNN Use a cache size of NNN ** --commit NNN Commit after every NNN operations ** --nosync Use PRAGMA synchronous=OFF ** --journal MMMM Use PRAGMA journal_mode=MMMM ** --timer Time the operation of this program ** --tag NAME Tag all output using NAME. Use only stdout. ** ** Modes: ** ** Insert mode means: ** (1) INSERT OR IGNORE INTO wordcount VALUES($new,1) ** (2) UPDATE wordcount SET cnt=cnt+1 WHERE word=$new -- if (1) is a noop ** |
︙ | ︙ | |||
78 79 80 81 82 83 84 85 86 87 88 89 90 91 | #include <string.h> #include <ctype.h> #include <stdlib.h> #include <stdarg.h> #include "sqlite3.h" #define ISALPHA(X) isalpha((unsigned char)(X)) /* Return the current wall-clock time */ static sqlite3_int64 realTime(void){ static sqlite3_vfs *clockVfs = 0; sqlite3_int64 t; if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0); if( clockVfs->iVersion>=1 && clockVfs->xCurrentTimeInt64!=0 ){ clockVfs->xCurrentTimeInt64(clockVfs, &t); | > > > | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | #include <string.h> #include <ctype.h> #include <stdlib.h> #include <stdarg.h> #include "sqlite3.h" #define ISALPHA(X) isalpha((unsigned char)(X)) /* Output tag */ char *zTag = "--"; /* Return the current wall-clock time */ static sqlite3_int64 realTime(void){ static sqlite3_vfs *clockVfs = 0; sqlite3_int64 t; if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0); if( clockVfs->iVersion>=1 && clockVfs->xCurrentTimeInt64!=0 ){ clockVfs->xCurrentTimeInt64(clockVfs, &t); |
︙ | ︙ | |||
111 112 113 114 115 116 117 | printf("%s;\n", zSql); } /* An sqlite3_exec() callback that prints results on standard output, ** each column separated by a single space. */ static int printResult(void *NotUsed, int nArg, char **azArg, char **azNm){ int i; | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | printf("%s;\n", zSql); } /* An sqlite3_exec() callback that prints results on standard output, ** each column separated by a single space. */ static int printResult(void *NotUsed, int nArg, char **azArg, char **azNm){ int i; printf("%s", zTag); for(i=0; i<nArg; i++){ printf(" %s", azArg[i] ? azArg[i] : "(null)"); } printf("\n"); return 0; } |
︙ | ︙ | |||
216 217 218 219 220 221 222 223 224 225 226 227 228 229 | sqlite3_stmt *pInsert = 0; /* The INSERT statement */ sqlite3_stmt *pUpdate = 0; /* The UPDATE statement */ sqlite3_stmt *pSelect = 0; /* The SELECT statement */ sqlite3_stmt *pDelete = 0; /* The DELETE statement */ FILE *in; /* The open input file */ int rc; /* Return code from an SQLite interface */ int iCur, iHiwtr; /* Statistics values, current and "highwater" */ sqlite3_int64 sumCnt = 0; /* Sum in QUERY mode */ sqlite3_int64 startTime; char zInput[2000]; /* A single line of input */ /* Process command-line arguments */ for(i=1; i<argc; i++){ const char *z = argv[i]; | > | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | sqlite3_stmt *pInsert = 0; /* The INSERT statement */ sqlite3_stmt *pUpdate = 0; /* The UPDATE statement */ sqlite3_stmt *pSelect = 0; /* The SELECT statement */ sqlite3_stmt *pDelete = 0; /* The DELETE statement */ FILE *in; /* The open input file */ int rc; /* Return code from an SQLite interface */ int iCur, iHiwtr; /* Statistics values, current and "highwater" */ FILE *pTimer = stderr; /* Output channel for the timer */ sqlite3_int64 sumCnt = 0; /* Sum in QUERY mode */ sqlite3_int64 startTime; char zInput[2000]; /* A single line of input */ /* Process command-line arguments */ for(i=1; i<argc; i++){ const char *z = argv[i]; |
︙ | ︙ | |||
262 263 264 265 266 267 268 269 270 271 272 273 274 275 | i++; pageSize = atoi(argv[i]); }else if( strcmp(z,"commit")==0 && i<argc-1 ){ i++; commitInterval = atoi(argv[i]); }else if( strcmp(z,"journal")==0 && i<argc-1 ){ zJMode = argv[++i]; }else{ fatal_error("unknown option: %s\n", argv[i]); } }else if( zDbName==0 ){ zDbName = argv[i]; }else if( zFileToRead==0 ){ zFileToRead = argv[i]; | > > > | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | i++; pageSize = atoi(argv[i]); }else if( strcmp(z,"commit")==0 && i<argc-1 ){ i++; commitInterval = atoi(argv[i]); }else if( strcmp(z,"journal")==0 && i<argc-1 ){ zJMode = argv[++i]; }else if( strcmp(z,"tag")==0 && i<argc-1 ){ zTag = argv[++i]; pTimer = stdout; }else{ fatal_error("unknown option: %s\n", argv[i]); } }else if( zDbName==0 ){ zDbName = argv[i]; }else if( zFileToRead==0 ){ zFileToRead = argv[i]; |
︙ | ︙ | |||
458 459 460 461 462 463 464 | if( zFileToRead ) fclose(in); sqlite3_finalize(pInsert); sqlite3_finalize(pUpdate); sqlite3_finalize(pSelect); sqlite3_finalize(pDelete); if( iMode==MODE_QUERY ){ | | | | | | | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | if( zFileToRead ) fclose(in); sqlite3_finalize(pInsert); sqlite3_finalize(pUpdate); sqlite3_finalize(pSelect); sqlite3_finalize(pDelete); if( iMode==MODE_QUERY ){ printf("%s sum of cnt: %lld\n", zTag, sumCnt); rc = sqlite3_prepare_v2(db,"SELECT sum(cnt*cnt) FROM wordcount", -1, &pSelect, 0); if( rc==SQLITE_OK && sqlite3_step(pSelect)==SQLITE_ROW ){ printf("%s double-check: %lld\n", zTag, sqlite3_column_int64(pSelect, 0)); } sqlite3_finalize(pSelect); } if( showTimer ){ sqlite3_int64 elapseTime = realTime() - startTime; fprintf(pTimer, "%3d.%03d wordcount", (int)(elapseTime/1000), (int)(elapseTime%1000)); for(i=1; i<argc; i++) if( i!=showTimer ) fprintf(pTimer, " %s", argv[i]); fprintf(pTimer, "\n"); } if( showSummary ){ sqlite3_create_function(db, "checksum", -1, SQLITE_UTF8, 0, 0, checksumStep, checksumFinalize); sqlite3_exec(db, "SELECT 'count(*): ', count(*) FROM wordcount;\n" |
︙ | ︙ | |||
497 498 499 500 501 502 503 | printResult, 0, 0); } /* Database connection statistics printed after both prepared statements ** have been finalized */ if( showStats ){ sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED, &iCur, &iHiwtr, 0); | | | | | | | | | | | | | | | | | | | 505 506 507 508 509 510 511 512 513 514 515 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 552 553 554 | printResult, 0, 0); } /* Database connection statistics printed after both prepared statements ** have been finalized */ if( showStats ){ sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED, &iCur, &iHiwtr, 0); printf("%s Lookaside Slots Used: %d (max %d)\n", zTag, iCur,iHiwtr); sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &iCur, &iHiwtr, 0); printf("%s Successful lookasides: %d\n", zTag, iHiwtr); sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &iCur,&iHiwtr,0); printf("%s Lookaside size faults: %d\n", zTag, iHiwtr); sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &iCur,&iHiwtr,0); printf("%s Lookaside OOM faults: %d\n", zTag, iHiwtr); sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, 0); printf("%s Pager Heap Usage: %d bytes\n", zTag, iCur); sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1); printf("%s Page cache hits: %d\n", zTag, iCur); sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1); printf("%s Page cache misses: %d\n", zTag, iCur); sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1); printf("%s Page cache writes: %d\n", zTag, iCur); sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, 0); printf("%s Schema Heap Usage: %d bytes\n", zTag, iCur); sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, 0); printf("%s Statement Heap Usage: %d bytes\n", zTag, iCur); } sqlite3_close(db); /* Global memory usage statistics printed after the database connection ** has closed. Memory usage should be zero at this point. */ if( showStats ){ sqlite3_status(SQLITE_STATUS_MEMORY_USED, &iCur, &iHiwtr, 0); printf("%s Memory Used (bytes): %d (max %d)\n", zTag,iCur,iHiwtr); sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &iCur, &iHiwtr, 0); printf("%s Outstanding Allocations: %d (max %d)\n",zTag,iCur,iHiwtr); sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &iCur, &iHiwtr, 0); printf("%s Pcache Overflow Bytes: %d (max %d)\n",zTag,iCur,iHiwtr); sqlite3_status(SQLITE_STATUS_SCRATCH_OVERFLOW, &iCur, &iHiwtr, 0); printf("%s Scratch Overflow Bytes: %d (max %d)\n",zTag,iCur,iHiwtr); sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &iCur, &iHiwtr, 0); printf("%s Largest Allocation: %d bytes\n",zTag,iHiwtr); sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, &iCur, &iHiwtr, 0); printf("%s Largest Pcache Allocation: %d bytes\n",zTag,iHiwtr); sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHiwtr, 0); printf("%s Largest Scratch Allocation: %d bytes\n",zTag,iHiwtr); } return 0; } |
Changes to tool/mksqlite3c-noext.tcl.
︙ | ︙ | |||
216 217 218 219 220 221 222 | append line " " [string trim $rettype] if {[string index $rettype end] ne "*"} { append line " " } if {[lsearch -exact $cdecllist $funcname] >= 0} { append line SQLITE_CDECL } else { | | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | append line " " [string trim $rettype] if {[string index $rettype end] ne "*"} { append line " " } if {[lsearch -exact $cdecllist $funcname] >= 0} { append line SQLITE_CDECL } else { append line SQLITE_APICALL } append line " " $funcname $rest puts $out $line } else { puts $out "SQLITE_PRIVATE $line" } } elseif {[regexp $varpattern $line all varname]} { |
︙ | ︙ |
Changes to tool/mksqlite3c.tcl.
︙ | ︙ | |||
108 109 110 111 112 113 114 | os.h pager.h parse.h pcache.h pragma.h rtree.h sqlite3session.h | < | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | os.h pager.h parse.h pcache.h pragma.h rtree.h sqlite3session.h sqlite3.h sqlite3ext.h sqlite3rbu.h sqliteicu.h sqliteInt.h sqliteLimit.h sqlrr.h |
︙ | ︙ | |||
229 230 231 232 233 234 235 | append line " " [string trim $rettype] if {[string index $rettype end] ne "*"} { append line " " } if {[lsearch -exact $cdecllist $funcname] >= 0} { append line SQLITE_CDECL } else { | | | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | append line " " [string trim $rettype] if {[string index $rettype end] ne "*"} { append line " " } if {[lsearch -exact $cdecllist $funcname] >= 0} { append line SQLITE_CDECL } else { append line SQLITE_APICALL } append line " " $funcname $rest puts $out $line } else { puts $out "SQLITE_PRIVATE $line" } } elseif {[regexp $varpattern $line all varname]} { |
︙ | ︙ |
Changes to tool/mksqlite3h.tcl.
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # 2) Adds SQLITE_API in front of the declaration of API functions, # 3) Replaces the string --VERS-- with the current library version, # formatted as a string (e.g. "3.6.17"), and # 4) Replaces the string --VERSION-NUMBER-- with current library version, # formatted as an integer (e.g. "3006017"). # 5) Replaces the string --SOURCE-ID-- with the date and time and sha1 # hash of the fossil-scm manifest for the source tree. # # This script outputs to stdout. # # Example usage: # # tclsh mksqlite3h.tcl ../sqlite >sqlite3.h # | > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # 2) Adds SQLITE_API in front of the declaration of API functions, # 3) Replaces the string --VERS-- with the current library version, # formatted as a string (e.g. "3.6.17"), and # 4) Replaces the string --VERSION-NUMBER-- with current library version, # formatted as an integer (e.g. "3006017"). # 5) Replaces the string --SOURCE-ID-- with the date and time and sha1 # hash of the fossil-scm manifest for the source tree. # 6) Adds the SQLITE_CALLBACK calling convention macro in front of all # callback declarations. # # This script outputs to stdout. # # Example usage: # # tclsh mksqlite3h.tcl ../sqlite >sqlite3.h # |
︙ | ︙ | |||
116 117 118 119 120 121 122 | append line " " [string trim $rettype] if {[string index $rettype end] ne "*"} { append line " " } if {[lsearch -exact $cdecllist $funcname] >= 0} { append line SQLITE_CDECL } else { | | > > > | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | append line " " [string trim $rettype] if {[string index $rettype end] ne "*"} { append line " " } if {[lsearch -exact $cdecllist $funcname] >= 0} { append line SQLITE_CDECL } else { append line SQLITE_APICALL } append line " " $funcname $rest } } set line [string map [list (*sqlite3_syscall_ptr) \ "(SQLITE_SYSAPI *sqlite3_syscall_ptr)"] $line] regsub {\(\*} $line {(SQLITE_CALLBACK *} line puts $line } close $in if {![regexp {sqlite\.h\.in} $file]} { puts "/******** End of [file tail $file] *********/" } } |
Changes to tool/replace.tcl.
1 2 3 4 5 6 7 8 9 | #!/usr/bin/tcl # # Replace string with another string -OR- include # only lines successfully modified with a regular # expression. # set mode [string tolower [lindex $argv 0]] set from [lindex $argv 1] set to [lindex $argv 2] | > > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #!/usr/bin/tcl # # Replace string with another string -OR- include # only lines successfully modified with a regular # expression. # fconfigure stdout -translation binary -encoding binary fconfigure stderr -translation binary -encoding binary set mode [string tolower [lindex $argv 0]] set from [lindex $argv 1] set to [lindex $argv 2] if {$mode ni [list exact regsub include]} {exit 1} if {[string length $from]==0} {exit 2} while {![eof stdin]} { set line [gets stdin] if {[eof stdin]} break switch -exact $mode { exact {set line [string map [list $from $to] $line]} regsub {regsub -all -- $from $line $to line} include {if {[regsub -all -- $from $line $to line]==0} continue} } puts stdout $line } |