------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C Add\sa\ssqlite3_log()\scall\son\sanonymous\sconstraint\sfailures.\nFix\sthe\soutput\sof\stest\scases\shaving\sto\sdo\swith\simproved\sreprepare\sreporting.\nFix\sthe\sVACUUM\scommand\sto\sreport\smore\shelpful\serror\smessages\swhen\sthings\sgo\nwrong.
-D 2010-02-24T19:23:56
+C Changes\sto\scompile\stime\soption\sdiags\sto\sreport\svalues\sfor\ssome\sdefines.\s\s\nAdded\stest\scases\sto\sTCL\stest\ssuite\s(ctime.test).
+D 2010-02-24T19:36:10
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/build.c 254a273acb8923f3bdecc933d787f4f67737c489
F src/callback.c 908f3e0172c3d4058f4ca0acd42c637c52e9669f
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
-F src/ctime.c af27b864e4f6aa179cae9488e20d9bc281200e50
+F src/ctime.c ceb247eb31620bba66a94c3f697db489a1652353
F src/date.c 485a4409a384310e6d93fd1104a9d0a8658becd9
F src/delete.c 610dc008e88a9599f905f5cbe9577ac9c36e0581
F src/expr.c d0a345e1d8995e142bc5d9f39a97b9981d7d8f23
F src/test_autoext.c 30e7bd98ab6d70a62bb9ba572e4c7df347fe645e
F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de
F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2
-F src/test_config.c 220a67047af393756f55760fdf442d935d0d88f3
+F src/test_config.c 5844274bf6cec4af3e6461fb3e2d349082635e81
F src/test_devsym.c de3c9af2bb9a8b1e44525c449e4ec3f88e3d4110
F src/test_func.c 13b582345fb1185a93e46c53310fae8547dcce20
F src/test_hexio.c 1237f000ec7a491009b1233f5c626ea71bce1ea2
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
F test/createtab.test 199cf68f44e5d9e87a0b8afc7130fdeb4def3272
F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
+F test/ctime.test aa0953d27564dac33d6c3fd5903312788b7fa383
F test/date.test 0b8473ed9ab6fd4283b4a01f035e1067762ba734
F test/default.test 6faf23ccb300114924353007795aa9a8ec0aa9dc
F test/delete.test f7629d9eb245dfca170169cc5c7a735dec34aeb4
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P a8c984c1d6cb6e2fc95a07eb32befeea122e8ed3
-R 2b722edc5008cbf38737ae2ef5623db4
-U drh
-Z 8f72e9f3a584b7bfbd7a9cae96339e61
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFLhXzPoxKgR168RlERAhuKAJ0bK7dYcMKjnA8nUy8KJNd03rqo5gCfbk0E
-IcFdGuxfI3OrBOGRpsZhtkE=
-=e87x
------END PGP SIGNATURE-----
+P 69a493182fd77bec91598516ee42c11a6db1d039
+R 0595378132dd801ca4b7473a352dc602
+U shaneh
+Z ced54587bc46e680be6da59f4025dfb3
-69a493182fd77bec91598516ee42c11a6db1d039
\ No newline at end of file
+dd480f62afa56ff85c2dd57ee7a16eee427e823f
\ No newline at end of file
#include "sqliteInt.h"
/*
-** An array of names of all compile-time options.
+** An array of names of all compile-time options. This array should
+** be sorted A-Z.
**
** This array looks large, but in a typical installation actually uses
-** only a handful of compile-time options, so most this array is usually
+** only a handful of compile-time options, so most times this array is usually
** rather short and uses little memory space.
*/
static const char * const azCompileOpt[] = {
+
+/* These macros are provided to "stringify" the value of the define
+** for those options in which the value is meaningful. */
+#define CTIMEOPT_VAL_(opt) #opt
+#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
+
#ifdef SQLITE_32BIT_ROWID
"32BIT_ROWID",
#endif
#ifdef SQLITE_DEBUG
"DEBUG",
#endif
+#ifdef SQLITE_DEFAULT_LOCKING_MODE
+ "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
+#endif
#ifdef SQLITE_DISABLE_DIRSYNC
"DISABLE_DIRSYNC",
#endif
"ENABLE_LOAD_EXTENSION",
#endif
#ifdef SQLITE_ENABLE_LOCKING_STYLE
- "ENABLE_LOCKING_STYLE",
+ "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
#endif
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
"ENABLE_MEMORY_MANAGEMENT",
#ifdef SQLITE_TCL
"TCL",
#endif
+#ifdef SQLITE_TEMP_STORE
+ "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
+#endif
#ifdef SQLITE_TEST
"TEST",
#endif
+#ifdef SQLITE_THREADSAFE
+ "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
+#endif
#ifdef SQLITE_USE_ALLOCA
"USE_ALLOCA",
#endif
#ifdef SQLITE_ZERO_MALLOC
- "ZERO_MALLOC",
+ "ZERO_MALLOC"
#endif
};
/* Since ArraySize(azCompileOpt) is normally in single digits, a
** linear search is adequate. No need for a binary search. */
for(i=0; i<ArraySize(azCompileOpt); i++){
- if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n+1)==0 ) return 1;
+ if( (sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0)
+ && ( (azCompileOpt[i][n]==0) || (azCompileOpt[i][n]=='=') ) ) return 1;
}
return 0;
}
TCL_GLOBAL_ONLY);
#endif
-
+#ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
+ Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "0", TCL_GLOBAL_ONLY);
+#else
+ Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "1", TCL_GLOBAL_ONLY);
+#endif
#ifdef SQLITE_OMIT_COMPLETE
Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY);
--- /dev/null
+# 2009 February 24
+#
+# 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.
+#
+# This file implements tests for the compile time diagnostic
+# functions.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# Test organization:
+#
+# ctime-1.*: Test pragma support.
+# ctime-2.*: Test function support.
+#
+
+ifcapable !pragma||!compileoption_diags {
+ finish_test
+ return
+}
+
+#####################
+# ctime-1.*: Test pragma support.
+
+do_test ctime-1.1.1 {
+ catchsql {
+ PRAGMA compile_options();
+ }
+} {1 {near ")": syntax error}}
+do_test ctime-1.1.2 {
+ catchsql {
+ PRAGMA compile_options(NULL);
+ }
+} {1 {near "NULL": syntax error}}
+do_test ctime-1.1.3 {
+ catchsql {
+ PRAGMA compile_options *;
+ }
+} {1 {near "*": syntax error}}
+
+do_test ctime-1.2.1 {
+ set ans [ catchsql {
+ PRAGMA compile_options;
+ } ]
+ list [ lindex $ans 0 ]
+} {0}
+# the results should be in sorted order already
+do_test ctime-1.2.2 {
+ set ans [ catchsql {
+ PRAGMA compile_options;
+ } ]
+ list [ lindex $ans 0 ] [ expr { [lsort [lindex $ans 1]]==[lindex $ans 1] } ]
+} {0 1}
+
+do_test ctime-1.3.1 {
+ catchsql {
+ PRAGMA compile_option();
+ }
+} {1 {near ")": syntax error}}
+do_test ctime-1.3.2 {
+ catchsql {
+ PRAGMA compile_option(NULL);
+ }
+} {1 {near "NULL": syntax error}}
+do_test ctime-1.3.3 {
+ catchsql {
+ PRAGMA compile_option foo;
+ }
+} {1 {near "foo": syntax error}}
+do_test ctime-1.3.4 {
+ catchsql {
+ PRAGMA compile_option 'foo';
+ }
+} {1 {near "'foo'": syntax error}}
+
+# SQLITE_THREADSAFE should pretty much always be defined
+# one way or the other, and it must have a value of 0 or 1.
+do_test ctime-1.4.1 {
+ catchsql {
+ PRAGMA compile_option('SQLITE_THREADSAFE');
+ }
+} {0 1}
+do_test ctime-1.4.2 {
+ catchsql {
+ PRAGMA compile_option('THREADSAFE');
+ }
+} {0 1}
+do_test ctime-1.4.3 {
+ catchsql {
+ PRAGMA compile_option("THREADSAFE");
+ }
+} {0 1}
+do_test ctime-1.4.4 {
+ catchsql {
+ PRAGMA compile_option='THREADSAFE';
+ }
+} {0 1}
+do_test ctime-1.4.5 {
+ catchsql {
+ PRAGMA compile_option="THREADSAFE";
+ }
+} {0 1}
+
+do_test ctime-1.4 {
+ set ans1 [ catchsql {
+ PRAGMA compile_option('THREADSAFE=0');
+ } ]
+ set ans2 [ catchsql {
+ PRAGMA compile_option('THREADSAFE=1');
+ } ]
+ lsort [ list $ans1 $ans2 ]
+} {{0 0} {0 1}}
+
+do_test ctime-1.5 {
+ execsql {
+ PRAGMA compile_option('THREADSAFE=');
+ }
+} {0}
+do_test ctime-1.6 {
+ execsql {
+ PRAGMA compile_option('SQLITE_OMIT_COMPILEOPTION_DIAGS');
+ }
+} {0}
+do_test ctime-1.7 {
+ execsql {
+ PRAGMA compile_option('OMIT_COMPILEOPTION_DIAGS');
+ }
+} {0}
+
+#####################
+# ctime-2.*: Test function support.
+
+do_test ctime-2.1.1 {
+ catchsql {
+ SELECT sqlite_compile_option_used();
+ }
+} {1 {wrong number of arguments to function sqlite_compile_option_used()}}
+do_test ctime-2.1.2 {
+ catchsql {
+ SELECT sqlite_compile_option_used(NULL);
+ }
+} {0 {{}}}
+do_test ctime-2.1.3 {
+ catchsql {
+ SELECT sqlite_compile_option_used("");
+ }
+} {0 0}
+do_test ctime-2.1.4 {
+ catchsql {
+ SELECT sqlite_compile_option_used('');
+ }
+} {0 0}
+do_test ctime-2.1.5 {
+ catchsql {
+ SELECT sqlite_compile_option_used(foo);
+ }
+} {1 {no such column: foo}}
+do_test ctime-2.1.6 {
+ catchsql {
+ SELECT sqlite_compile_option_used('THREADSAFE', 0);
+ }
+} {1 {wrong number of arguments to function sqlite_compile_option_used()}}
+
+do_test ctime-2.2.1 {
+ catchsql {
+ SELECT sqlite_compile_option_get();
+ }
+} {1 {wrong number of arguments to function sqlite_compile_option_get()}}
+do_test ctime-2.2.2 {
+ catchsql {
+ SELECT sqlite_compile_option_get(0, 0);
+ }
+} {1 {wrong number of arguments to function sqlite_compile_option_get()}}
+
+# This assumes there is at least 1 compile time option
+# (see SQLITE_THREADSAFE above).
+do_test ctime-2.3 {
+ catchsql {
+ SELECT sqlite_compile_option_used(sqlite_compile_option_get(0));
+ }
+} {0 1}
+
+# This assumes there is at least 1 compile time option
+# (see SQLITE_THREADSAFE above).
+do_test ctime-2.4 {
+ set res [ catchsql {
+ SELECT sqlite_compile_option_get(0);
+ } ]
+ list [lindex $res 0]
+} {0}
+
+# Get the list of defines using the pragma,
+# then try querying each one with the functions.
+set ans [ catchsql {
+ PRAGMA compile_options;
+} ]
+set opts [ lindex $ans 1 ]
+set tc 1
+foreach opt $opts {
+ do_test ctime-2.5.$tc {
+ set N [ expr {$tc-1} ]
+ set ans1 [ catchsql {
+ SELECT sqlite_compile_option_get($N);
+ } ]
+ set ans2 [ catchsql {
+ SELECT sqlite_compile_option_used($opt);
+ } ]
+ list [ lindex $ans1 0 ] [ expr { [lindex $ans1 1]==$opt } ] \
+ [ expr { $ans2 } ]
+ } {0 1 {0 1}}
+ incr tc 1
+}
+# test 1 past array bounds
+do_test ctime-2.5.$tc {
+ set N [ expr {$tc-1} ]
+ set ans [ catchsql {
+ SELECT sqlite_compile_option_get($N);
+ } ]
+} {0 {{}}}
+incr tc 1
+# test 1 before array bounds (N=-1)
+do_test ctime-2.5.$tc {
+ set N -1
+ set ans [ catchsql {
+ SELECT sqlite_compile_option_get($N);
+ } ]
+} {0 {{}}}
+
+
+finish_test