-C Test\scases\sto\simprove\scoverage\sof\svdbe.c.\s(CVS\s2193)
-D 2005-01-11T13:02:34
+C Improved\stest\scoverage\sfor\sutil.c.\s(CVS\s2194)
+D 2005-01-11T15:28:33
F Makefile.in ecf441ac5ca1ccfc8748a8a9537706e69893dfa4
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
F src/sqliteInt.h a362fd46ba14f67e8e088d30ecbbe228545c43fe
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
F src/tclsqlite.c 354d3e4525c7b29c8f50b1a0125d55c63c916fbc
-F src/test1.c b7d94c54e58f95452387a5cabdf98b2be8059f29
+F src/test1.c ad1b46266b357c283981b2a289cf29bdb35cb26a
F src/test2.c b11fa244fff02190707dd0879987c37c75e61fc8
F src/test3.c a72f20066cccd5a7b9f20b7b78fa9b05b47b3020
F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
F src/trigger.c 98f3b07c08ba01b34cff139ef9687883d325ae8e
F src/update.c 0979397c41ac29c54fe0cc687a356d8629a633af
F src/utf.c e45ce11be6922408cd381561721f6cca7d3b992a
-F src/util.c 29f43c4a7b9ff29302f7899f793be6836b6cd7f9
+F src/util.c bf42625f35492864faa6fe14aa5a858de25cc2a0
F src/vacuum.c 1a9db113a027461daaf44724c71dd1ebbd064203
F src/vdbe.c 8ef389f567e233768a845e7dffacb21308e4f3e8
F src/vdbe.h 067ca8d6750ba4f69a50284765e5883dee860181
F test/misc1.test 744f60d1025fa978708b96cb222a07a1feb1524a
F test/misc2.test bc852f1622d98b610d1f3e2ceb36ed7271256050
F test/misc3.test 928a2f1e1189924ed14e1ae074e34f40688bdf94
-F test/misc4.test c683ab8182172474c804b346f8a39ca786322250
+F test/misc4.test 7edc2542eadd98555c2d25c222b88a93124975ae
F test/misuse.test 2d7c46160f7c214f761fc5d030684a37ae8832a6
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
F test/null.test 5a945790ef21b24fd602fe2c7a23847b903f8687
F test/reindex.test 3552c6b944a3fab28cfd3049c04c65cb79419757
F test/rollback.test 4097328d44510277244ef4fa51b22b2f11d7ef4c
F test/rowid.test 1ce3f1520d2082b0363e7d9bdef904cb72b9efe8
+F test/safety.test 907b64fee719554a3622853812af3886fddbbb4f
F test/select1.test 524d4323f3921db16138f8b1765f1cc44e030bf4
F test/select2.test 91a2225926039b0d1687840735c284dbbf89f0bc
F test/select3.test 9de435aa84fc406708cd8dc1b1d60e7f27cea685
F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl c3b50d3ac31c54be2a1af9b488a89d22f1e6e746
-P ce8e4e885a46cec35b64a81925eb330048ea5cbb
-R 44bedd6ab22a6b83aa2c8db7d5317250
-U danielk1977
-Z edff517034081f5d7cb31d6aed3503e0
+P a6b45722071bde543c4ea28a432339d8708a5cac
+R b0945886e1d424e5155d631ce7e7c70d
+U drh
+Z b50ef0a8c73264bba1e64798ccde8b34
-a6b45722071bde543c4ea28a432339d8708a5cac
\ No newline at end of file
+ad451a2ddc7993035768f2801d590311807f4397
\ No newline at end of file
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.117 2004/11/22 19:12:21 drh Exp $
+** $Id: test1.c,v 1.118 2005/01/11 15:28:33 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
return TCL_OK;
}
+/*
+** Usage: sqlite_set_magic DB MAGIC-NUMBER
+**
+** Set the db->magic value. This is used to test error recovery logic.
+*/
+static int sqlite_set_magic(
+ void * clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+){
+ sqlite3 *db;
+ if( argc!=3 ){
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " DB MAGIC", 0);
+ return TCL_ERROR;
+ }
+ if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
+ if( strcmp(argv[2], "SQLITE_MAGIC_OPEN")==0 ){
+ db->magic = SQLITE_MAGIC_OPEN;
+ }else if( strcmp(argv[2], "SQLITE_MAGIC_CLOSED")==0 ){
+ db->magic = SQLITE_MAGIC_CLOSED;
+ }else if( strcmp(argv[2], "SQLITE_MAGIC_BUSY")==0 ){
+ db->magic = SQLITE_MAGIC_BUSY;
+ }else if( strcmp(argv[2], "SQLITE_MAGIC_ERROR")==0 ){
+ db->magic = SQLITE_MAGIC_ERROR;
+ }else if( Tcl_GetInt(interp, argv[2], &db->magic) ){
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
/*
** Usage: tcl_variable_type VARIABLENAME
**
{ "breakpoint", (Tcl_CmdProc*)test_breakpoint },
{ "sqlite3_key", (Tcl_CmdProc*)test_key },
{ "sqlite3_rekey", (Tcl_CmdProc*)test_rekey },
+ { "sqlite_set_magic", (Tcl_CmdProc*)sqlite_set_magic },
};
static struct {
char *zName;
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
-** $Id: util.c,v 1.123 2004/12/25 01:03:14 drh Exp $
+** $Id: util.c,v 1.124 2005/01/11 15:28:33 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
return h - '0';
}else if( h>='a' && h<='f' ){
return h - 'a' + 10;
- }else if( h>='A' && h<='F' ){
- return h - 'A' + 10;
}else{
- return 0;
+ assert( h>='A' && h<='F' );
+ return h - 'A' + 10;
}
}
#endif /* (!SQLITE_OMIT_BLOB_LITERAL && !SQLITE_HAS_CODEC) || SQLITE_TEST */
# This file implements tests for miscellanous features that were
# left out of other test files.
#
-# $Id: misc4.test,v 1.8 2004/11/22 13:35:42 danielk1977 Exp $
+# $Id: misc4.test,v 1.9 2005/01/11 15:28:33 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
} {{} {} 1 x 1 z}
} ;# ifcapable compound
-
finish_test
--- /dev/null
+# 2005 January 11
+#
+# 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.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library. The
+# focus of this file is testing the sqlite3SafetyOn and sqlite3SafetyOff
+# functions. Those routines are not strictly necessary - they are
+# designed to detect misuse of the library.
+#
+# $Id: safety.test,v 1.1 2005/01/11 15:28:33 drh Exp $
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+do_test safety-1.1 {
+ db close
+ set DB [sqlite3 db test.db]
+ db eval {CREATE TABLE t1(a)}
+ sqlite_set_magic $DB SQLITE_MAGIC_BUSY
+ catchsql {
+ SELECT name FROM sqlite_master;
+ }
+} {1 {library routine called out of sequence}}
+do_test safety-1.2 {
+ sqlite_set_magic $DB SQLITE_MAGIC_OPEN
+ catchsql {
+ SELECT name FROM sqlite_master
+ }
+} {0 t1}
+
+do_test safety-2.1 {
+ proc safety_on {} "sqlite_set_magic $DB SQLITE_MAGIC_BUSY"
+ db function safety_on safety_on
+ catchsql {
+ SELECT safety_on(), name FROM sqlite_master
+ }
+} {1 {library routine called out of sequence}}
+do_test safety-2.2 {
+ catchsql {
+ SELECT 'hello'
+ }
+} {1 {library routine called out of sequence}}
+do_test safety-2.3 {
+ sqlite3_close $DB
+} {SQLITE_MISUSE}
+do_test safety-2.4 {
+ sqlite_set_magic $DB SQLITE_MAGIC_OPEN
+ execsql {
+ SELECT name FROM sqlite_master
+ }
+} {t1}
+
+do_test safety-3.1 {
+ set rc [catch {
+ db eval {SELECT name FROM sqlite_master} {
+ sqlite_set_magic $DB SQLITE_MAGIC_BUSY
+ }
+ } msg]
+ lappend rc $msg
+} {1 {library routine called out of sequence}}
+sqlite_set_magic $DB SQLITE_MAGIC_OPEN
+
+finish_test