Index: src/test3.c ================================================================== --- src/test3.c +++ src/test3.c @@ -11,11 +11,11 @@ ************************************************************************* ** 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. ** -** $Id: test3.c,v 1.46 2004/06/29 13:18:24 danielk1977 Exp $ +** $Id: test3.c,v 1.47 2004/06/30 02:35:51 danielk1977 Exp $ */ #include "sqliteInt.h" #include "pager.h" #include "btree.h" #include "tcl.h" @@ -418,11 +418,11 @@ " ID METADATA...\" (METADATA is ", zBuf, " integers)", 0); return TCL_ERROR; } if( Tcl_GetInt(interp, argv[1], (int*)&pBt) ) return TCL_ERROR; for(i=1; i #include @@ -592,11 +592,11 @@ ** ** Am empty string is considered non-numeric. */ int sqlite3IsNumber(const char *z, int *realnum, u8 enc){ int incr = (enc==SQLITE_UTF8?1:2); - if( enc==SQLITE_UTF16LE ) z++; + if( enc==SQLITE_UTF16BE ) z++; if( *z=='-' || *z=='+' ) z += incr; if( !isdigit(*z) ){ return 0; } z += incr; Index: src/vdbe.c ================================================================== --- src/vdbe.c +++ src/vdbe.c @@ -41,11 +41,11 @@ ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.394 2004/06/29 13:54:50 drh Exp $ +** $Id: vdbe.c,v 1.395 2004/06/30 02:35:51 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" #include #include "vdbeInt.h" @@ -700,10 +700,11 @@ pTos->z = pOp->p3; pTos->n = strlen(pTos->z); pTos->enc = SQLITE_UTF8; pTos->r = sqlite3VdbeRealValue(pTos); pTos->flags |= MEM_Real; + sqlite3VdbeChangeEncoding(pTos, db->enc); break; } /* Opcode: String8 * * P3 ** Index: test/btree.test ================================================================== --- test/btree.test +++ test/btree.test @@ -9,11 +9,11 @@ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is btree database backend # -# $Id: btree.test,v 1.28 2004/06/20 03:06:18 dougcurrie Exp $ +# $Id: btree.test,v 1.29 2004/06/30 02:35:51 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -370,18 +370,18 @@ do_test btree-5.1 { btree_get_meta $::b1 } {0 0 0 0 0 0 0 0 0 0} do_test btree-5.2 { set rc [catch { - btree_update_meta $::b1 1 2 3 4 5 6 7 8 9 10 + btree_update_meta $::b1 0 1 2 3 4 5 6 7 8 9 } msg] lappend rc $msg } {1 SQLITE_ERROR} do_test btree-5.3 { btree_begin_transaction $::b1 set rc [catch { - btree_update_meta $::b1 1 2 3 4 5 6 7 8 9 10 + btree_update_meta $::b1 0 1 2 3 4 5 6 7 8 9 } msg] lappend rc $msg } {0 {}} do_test btree-5.4 { btree_get_meta $::b1 @@ -391,11 +391,11 @@ btree_rollback $::b1 btree_get_meta $::b1 } {0 0 0 0 0 0 0 0 0 0} do_test btree-5.6 { btree_begin_transaction $::b1 - btree_update_meta $::b1 10 20 30 40 50 60 70 80 90 100 + btree_update_meta $::b1 0 10 20 30 40 50 60 70 80 90 btree_commit $::b1 btree_get_meta $::b1 } {0 10 20 30 40 50 60 70 80 90} proc select_all {cursor} { Index: test/capi3.test ================================================================== --- test/capi3.test +++ test/capi3.test @@ -9,11 +9,11 @@ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script testing the callback-free C/C++ API. # -# $Id: capi3.test,v 1.17 2004/06/29 14:03:58 danielk1977 Exp $ +# $Id: capi3.test,v 1.18 2004/06/30 02:35:51 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -403,16 +403,14 @@ INSERT INTO t1 VALUES('one', 'two', NULL); INSERT INTO t1 VALUES(1.2, 1.3, 1.4); } set sql "SELECT * FROM t1" set STMT [sqlite3_prepare $DB $sql -1 TAIL] - sqlite3_column_count $STMT } 3 check_header $STMT capi3-5.1 {a b c} {VARINT BLOB VARCHAR(16)} - do_test capi3-5.2 { sqlite3_step $STMT } SQLITE_ROW check_header $STMT capi3-5.3 {a b c} {VARINT BLOB VARCHAR(16)} @@ -438,10 +436,11 @@ do_test capi3-5.12 { sqlite3_finalize $STMT } SQLITE_OK +set ::ENC [execsql {pragma encoding}] db close do_test capi3-6.0 { set DB [sqlite3_open test.db] set sql {SELECT a FROM t1 order by rowid} @@ -466,17 +465,18 @@ # Do this by updating the file format via the btree layer. do_test capi3-7.1 { set ::bt [btree_open test.db 10 0] btree_begin_transaction $::bt set meta [btree_get_meta $::bt] - lset meta 5 2 - eval [concat btree_update_meta $::bt $meta] + lset meta 2 2 + eval [concat btree_update_meta $::bt [lrange $meta 0 end]] btree_commit $::bt btree_close $::bt } {} do_test capi3-7.2 { sqlite3 db test.db +breakpoint catchsql { SELECT * FROM sqlite_master; } } {1 {unsupported file format}} @@ -496,10 +496,11 @@ btree_begin_transaction $::bt set ::bc [btree_cursor $::bt 1 1] # Build a 5-field row record consisting of 5 null records. This is # officially black magic. + unset data set data [binary format c6 {6 0 0 0 0 0}] btree_insert $::bc 5 $data btree_close_cursor $::bc btree_commit $::bt @@ -516,12 +517,18 @@ btree_begin_transaction $::bt set ::bc [btree_cursor $::bt 1 1] # Build a 5-field row record. The first field is a string 'table', and # subsequent fields are all NULL. Replace the other broken record with - # this one and try to read the schema again. - set data [binary format c6a5 {6 23 0 0 0 0} table] + # this one and try to read the schema again. The broken record uses + # either UTF-8 or native UTF-16 (if this file is being run by + # utf16.test). + if { [string match UTF-16* $::ENC] } { + set data [binary format c6a10 {6 33 0 0 0 0} [utf16 table]] + } else { + set data [binary format c6a5 {6 23 0 0 0 0} table] + } btree_insert $::bc 5 $data btree_close_cursor $::bc btree_commit $::bt btree_close $::bt Index: test/trace.test ================================================================== --- test/trace.test +++ test/trace.test @@ -10,15 +10,16 @@ #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the "sqlite3_trace()" API. # -# $Id: trace.test,v 1.1 2004/06/29 11:26:59 drh Exp $ +# $Id: trace.test,v 1.2 2004/06/30 02:35:51 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl +set ::stmtlist {} do_test trace-1.1 { set rc [catch {db trace 1 2 3} msg] lappend rc $msg } {1 {wrong # args: should be "db trace ?CALLBACK?"}} proc trace_proc cmd { Index: test/types.test ================================================================== --- test/types.test +++ test/types.test @@ -10,11 +10,11 @@ #*********************************************************************** # This file implements regression tests for SQLite library. Specfically # it tests that the different storage classes (integer, real, text etc.) # all work correctly. # -# $Id: types.test,v 1.7 2004/05/27 19:59:33 drh Exp $ +# $Id: types.test,v 1.8 2004/06/30 02:35:51 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Tests in this file are organized roughly as follows: @@ -258,15 +258,23 @@ execsql { SELECT a FROM t4; } } [list $string10 $string500 $string500000] -# Check that all the record sizes are as we expected. -do_test types-2.4.3 { - set root [db eval {select rootpage from sqlite_master where name = 't4'}] - record_sizes $root -} {12 503 500004} +# Check that all the record sizes are as we expected. This is dependant on +# the database encoding. +if { [execsql {pragma encoding}] == "UTF-8" } { + do_test types-2.4.3 { + set root [db eval {select rootpage from sqlite_master where name = 't4'}] + record_sizes $root + } {12 503 500004} +} else { + do_test types-2.4.3 { + set root [db eval {select rootpage from sqlite_master where name = 't4'}] + record_sizes $root + } {22 1003 1000004} +} do_test types-2.5.1 { execsql { DROP TABLE t1; DROP TABLE t2; Index: test/utf16.test ================================================================== --- test/utf16.test +++ test/utf16.test @@ -8,11 +8,11 @@ # May you share freely, never taking more than you give. # #*********************************************************************** # This file runs all tests. # -# $Id: utf16.test,v 1.2 2004/06/29 23:52:48 danielk1977 Exp $ +# $Id: utf16.test,v 1.3 2004/06/30 02:35:51 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl rename finish_test really_finish_test2 proc finish_test {} {} @@ -30,18 +30,17 @@ intpkey.test ioerr.test join2.test join.test lastinsert.test laststmtchanges.test limit.test lock2.test lock.test main.test memdb.test minmax.test misc1.test misc2.test misc3.test notnull.test null.test progress.test quote.test rowid.test select1.test select2.test select3.test select4.test select5.test select6.test sort.test - subselect.test tableapi.test table.test tclsqlite.test temptable.test - trace.test trans.test trigger1.test trigger2.test trigger3.test + subselect.test tableapi.test table.test temptable.test + trace.test trigger1.test trigger2.test trigger3.test trigger4.test types2.test types.test unique.test update.test vacuum.test view.test where.test } foreach f $F {lappend FILES $testdir/$f} } -puts $FILES rename sqlite3 real_sqlite3 proc sqlite3 {args} { set r [eval "real_sqlite3 $args"] if { [llength $args] == 2 } {