diff --git a/manifest b/manifest index 03f8e5357d..d850ce6df3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\sin\smalloc3.test\spreventing\sall.test\sfrom\scompleting.\sNo\scode\schanges.\s(CVS\s4351) -D 2007-08-31T05:00:49 +C Convert\sthe\sTCL\sinterface\sto\suse\ssqlite3_open_v2\s(CVS\s4352) +D 2007-08-31T14:31:45 F Makefile.in bfcc303429a5d9dcd552d807ee016c77427418c3 F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -135,7 +135,7 @@ F src/sqlite3ext.h 3e5368b64a28602ef8abf9cfb6c8c1643903f238 F src/sqliteInt.h 5dbb7a934a88dfa9893e2627f4821b0464f5edc0 F src/sqliteLimit.h 1bcbbdfa856f8b71b561abb31edb864b0eca1d12 F src/table.c 1aeb9eab57b4235db86fe15a35dec76fb445a9c4 -F src/tclsqlite.c 5b801c7eeefe8c968325558e2a7977cf8a713d5f +F src/tclsqlite.c 8db035768623779c97d0509eb88ecbb49c51abca F src/test1.c 8b20d1f05777ac480d3caf8d5f79ab7a543513fc F src/test2.c 4ab230fbdc0decfa7422f6a052b609ba54f4dfac F src/test3.c 199a440ba2b38b26251393b609451a3484a15907 @@ -418,9 +418,9 @@ F test/substr.test 9f26cfca74397b26ab217fb838c3d0549eb4bcf3 F test/sync.test d05397b8f89f423dd6dba528692019ab036bc1c3 F test/table.test dbdfd06aef054ad5aed8e57a782137d57d5c5528 F test/tableapi.test 036575a98dcce7c92e9f39056839bbad8a715412 -F test/tclsqlite.test 593f3b30221e85786965d9e5670ae4f96b4e4159 +F test/tclsqlite.test 3addd6a88b8a756ec802ca8840587fa3d61bfcff F test/temptable.test c36f3e5a94507abb64f7ba23deeb4e1a8a8c3821 -F test/tester.tcl d6fd4e9eac69a7bc7791ca2f80c91945d1f6d1cc +F test/tester.tcl 577c2eb71a6e308f8e4d6b283c6a0d2966ed2824 F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35 F test/thread2.test 6d7b30102d600f51b4055ee3a5a19228799049fb F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b @@ -568,7 +568,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 1b39a714efbe1f4ccc8daf68a227a8c9b84a388f -R 5354fced5254a75816d7576469879796 -U danielk1977 -Z ef735893af1f42e3e38cbeb5ea49fed9 +P ee9b3e5e38c52f5669009a08aec58678ccad0d87 +R b9ef3977fd4686cc6e05c610911a5a80 +U drh +Z edb6e93aa3250c0879e9ae9ba46c5a0f diff --git a/manifest.uuid b/manifest.uuid index 0430f1344d..9454b4d1ab 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ee9b3e5e38c52f5669009a08aec58678ccad0d87 \ No newline at end of file +3434b7a9213f210498f43cb5094a0f3f5c25b957 \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 52ffc88c62..86cd06a9e9 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -12,7 +12,7 @@ ** A TCL Interface to SQLite. Append this file to sqlite3.c and ** compile the whole thing to build a TCL-enabled version of SQLite. ** -** $Id: tclsqlite.c,v 1.199 2007/08/30 14:58:20 drh Exp $ +** $Id: tclsqlite.c,v 1.200 2007/08/31 14:31:45 drh Exp $ */ #include "tcl.h" #include @@ -2255,7 +2255,8 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ } /* -** sqlite3 DBNAME FILENAME ?MODE? ?-key KEY? +** sqlite3 DBNAME FILENAME ?-vfs VFSNAME? ?-key KEY? ?-readonly BOOLEAN? +** ?-create BOOLEAN? ** ** This is the main Tcl command. When the "sqlite" Tcl command is ** invoked, this routine runs to process that command. @@ -2265,25 +2266,8 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ ** 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 directory that contains -** the sqlite database that is to be accessed. +** The second argument is the name of the database file. ** -** For testing purposes, we also support the following: -** -** sqlite3 -encoding -** -** Return the encoding used by LIKE and GLOB operators. Choices -** are UTF-8 and iso8859. -** -** sqlite3 -version -** -** Return the version number of the SQLite library. -** -** sqlite3 -tcl-uses-utf -** -** Return "1" if compiled with a Tcl uses UTF-8. Return "0" if -** not. Used by tests to make sure the library was compiled -** correctly. */ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ SqliteDb *p; @@ -2291,7 +2275,10 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ int nKey = 0; const char *zArg; char *zErrMsg; + int i; const char *zFile; + const char *zVfs = 0; + int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; Tcl_DString translatedFilename; if( objc==2 ){ zArg = Tcl_GetStringFromObj(objv[1], 0); @@ -2304,31 +2291,45 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ Tcl_AppendResult(interp,"1",0); #else Tcl_AppendResult(interp,"0",0); -#endif - return TCL_OK; - } - if( strcmp(zArg,"-tcl-uses-utf")==0 ){ -#ifdef TCL_UTF_MAX - Tcl_AppendResult(interp,"1",0); -#else - Tcl_AppendResult(interp,"0",0); #endif return TCL_OK; } } - if( objc==5 || objc==6 ){ - zArg = Tcl_GetStringFromObj(objv[objc-2], 0); + for(i=3; i+1db); + sqlite3_open_v2(zFile, &p->db, flags, zVfs); Tcl_DStringFree(&translatedFilename); if( SQLITE_OK!=sqlite3_errcode(p->db) ){ zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(p->db)); @@ -2426,12 +2427,14 @@ EXTERN int Tclsqlite_SafeInit(Tcl_Interp *interp){ return TCL_OK; } #ifdef TCLSH /***************************************************************************** ** The code that follows is used to build standalone TCL interpreters +** that are statically linked with SQLite. */ /* ** If the macro TCLSH is one, then put in code this for the ** "main" routine that will initialize Tcl and take input from -** standard input. +** standard input, or if a file is named on the command line +** the TCL interpreter reads and evaluates that file. */ #if TCLSH==1 static char zMainloop[] = diff --git a/test/tclsqlite.test b/test/tclsqlite.test index 30eccdd76f..158a0087d9 100644 --- a/test/tclsqlite.test +++ b/test/tclsqlite.test @@ -15,7 +15,7 @@ # interface is pretty well tested. This file contains some addition # tests for fringe issues that the main test suite does not cover. # -# $Id: tclsqlite.test,v 1.59 2007/06/19 23:01:42 drh Exp $ +# $Id: tclsqlite.test,v 1.60 2007/08/31 14:31:45 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -25,7 +25,7 @@ source $testdir/tester.tcl if {[sqlite3 -has-codec]} { set r "sqlite_orig HANDLE FILENAME ?-key CODEC-KEY?" } else { - set r "sqlite3 HANDLE FILENAME ?MODE?" + set r "sqlite3 HANDLE FILENAME ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN?" } do_test tcl-1.1 { set v [catch {sqlite3 bogus} msg] @@ -140,22 +140,20 @@ do_test tcl-1.20 { } {1 {wrong # args: should be "db copy CONFLICT-ALGORITHM TABLE FILENAME ?SEPARATOR? ?NULLINDICATOR?"}} -if {[sqlite3 -tcl-uses-utf]} { - catch {unset ::result} - do_test tcl-2.1 { - execsql "CREATE TABLE t\u0123x(a int, b\u1235 float)" - } {} - ifcapable schema_pragmas { - do_test tcl-2.2 { - execsql "PRAGMA table_info(t\u0123x)" - } "0 a int 0 {} 0 1 b\u1235 float 0 {} 0" - } - do_test tcl-2.3 { - execsql "INSERT INTO t\u0123x VALUES(1,2.3)" - db eval "SELECT * FROM t\u0123x" result break - set result(*) - } "a b\u1235" +catch {unset ::result} +do_test tcl-2.1 { + execsql "CREATE TABLE t\u0123x(a int, b\u1235 float)" +} {} +ifcapable schema_pragmas { + do_test tcl-2.2 { + execsql "PRAGMA table_info(t\u0123x)" + } "0 a int 0 {} 0 1 b\u1235 float 0 {} 0" } +do_test tcl-2.3 { + execsql "INSERT INTO t\u0123x VALUES(1,2.3)" + db eval "SELECT * FROM t\u0123x" result break + set result(*) +} "a b\u1235" # Test the onecolumn method diff --git a/test/tester.tcl b/test/tester.tcl index cc6acddb5f..23c9900f14 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -11,34 +11,8 @@ # This file implements some common TCL routines used for regression # testing the SQLite library # -# $Id: tester.tcl,v 1.88 2007/08/23 11:07:10 danielk1977 Exp $ +# $Id: tester.tcl,v 1.89 2007/08/31 14:31:45 drh Exp $ -# Make sure tclsqlite3 was compiled correctly. Abort now with an -# error message if not. -# -if {[sqlite3 -tcl-uses-utf]} { - if {"\u1234"=="u1234"} { - puts stderr "***** BUILD PROBLEM *****" - puts stderr "$argv0 was linked against an older version" - puts stderr "of TCL that does not support Unicode, but uses a header" - puts stderr "file (\"tcl.h\") from a new TCL version that does support" - puts stderr "Unicode. This combination causes internal errors." - puts stderr "Recompile using a TCL library and header file that match" - puts stderr "and try again.\n**************************" - exit 1 - } -} else { - if {"\u1234"!="u1234"} { - puts stderr "***** BUILD PROBLEM *****" - puts stderr "$argv0 was linked against an newer version" - puts stderr "of TCL that supports Unicode, but uses a header file" - puts stderr "(\"tcl.h\") from a old TCL version that does not support" - puts stderr "Unicode. This combination causes internal errors." - puts stderr "Recompile using a TCL library and header file that match" - puts stderr "and try again.\n**************************" - exit 1 - } -} set tcl_precision 15 set sqlite_pending_byte 0x0010000