-C Fix\sthe\s".dump"\scommand\sin\sthe\sshell.\s\sTicket\s#2072.\s\sAlso\sticket\s#2065.\s(CVS\s3515)
-D 2006-11-20T16:21:10
+C Add\sperformance\stests\sto\sthe\stest\ssuite.\s(CVS\s3516)
+D 2006-11-23T09:39:16
F Makefile.in 8e14898d41a53033ecb687d93c9cd5d109fb9ae3
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/sqliteInt.h f6bac44ee7b8ee2614b046974551c22999ec674f
F src/table.c 6d0da66dde26ee75614ed8f584a1996467088d06
F src/tclsqlite.c e029f739bed90071789fe81a226d53e97a80a4d8
-F src/test1.c 3d0cb8837eb13e6cd5fe2b76a37ba8d9c0ad77fc
+F src/test1.c 19786ff3274635b6eac27a89f842416f388f3654
F src/test2.c ca74a1d8aeb7d9606e8f6b762c5daf85c1a3f92b
F src/test3.c 85135c09560c48bdb0a23c9b890ab405486b8ec9
F src/test4.c 8b784cd82de158a2317cb4ac4bc86f91ad315e25
F test/select3.test 33c78663e6b1b41220dcec4eb6affb1a05001ffe
F test/select4.test 305ba0a6e97efc5544def5e5cb49b54e1bf87fd9
F test/select5.test 0b47058d3e916c1fc9fe81f44b438e02bade21ce
-F test/select6.test a4e97b713b096f17414f50d078ec4efe7dc43253
+F test/select6.test 3607be760b1d4bfd337f43c13b5f3532ca5f09d9
F test/select7.test 95697d8e8355ef7538e2fe768da16838bbd0fcde
F test/server1.test e328b8e641ba8fe9273132cfef497383185dc1f5
F test/shared.test 0ed247941236788c255b3b29b5a82d5ca71b6432
F test/tableapi.test a1982276274d292110d549206bc365b2da43e2ee
F test/tclsqlite.test 51334389283c74bcbe28645a73159b17e239e9f3
F test/temptable.test c36f3e5a94507abb64f7ba23deeb4e1a8a8c3821
-F test/tester.tcl 2c2683d3bd51dac27750af89ff3d0f339823b603
+F test/tester.tcl a1940002407a4797c7748d633b92c58bfaa211cf
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
F test/thread2.test 6d7b30102d600f51b4055ee3a5a19228799049fb
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 2fdc147d0059dcdfff2da33bd9fedb0bee057aa1
-R 794dc2fbb3e0e83e5207db81c11bb327
+P 9fdc249609a4745715a2bf49bbf1376ea243a20a
+R efe8add04260169c1047f36db8e1352f
U drh
-Z 79a147f5026204797ae394029f543a2e
+Z 86f3e2483d981df2a6b869d1c8f0b98e
-9fdc249609a4745715a2bf49bbf1376ea243a20a
\ No newline at end of file
+270c745dffad7aa24f8707720b3d68ad7a6b2749
\ 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.224 2006/11/09 00:24:54 drh Exp $
+** $Id: test1.c,v 1.225 2006/11/23 09:39:16 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
return TCL_OK;
}
+/*
+** Decode a pointer to an sqlite3 object.
+*/
+static int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb){
+ struct SqliteDb *p;
+ Tcl_CmdInfo cmdInfo;
+ if( Tcl_GetCommandInfo(interp, zA, &cmdInfo) ){
+ p = (struct SqliteDb*)cmdInfo.objClientData;
+ *ppDb = p->db;
+ }else{
+ *ppDb = (sqlite3*)sqlite3TextToPtr(zA);
+ }
+ return TCL_OK;
+}
+
+
const char *sqlite3TestErrorName(int rc){
const char *zName = 0;
switch( rc & 0xff ){
return 0;
}
-/*
-** Decode a pointer to an sqlite3 object.
-*/
-static int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb){
- *ppDb = (sqlite3*)sqlite3TextToPtr(zA);
- return TCL_OK;
-}
-
/*
** Decode a pointer to an sqlite3_stmt object.
*/
return TCL_OK;
}
+/*
+** Usage: sqlite3_exec DB SQL
+**
+** Invoke the sqlite3_exec interface using the open database DB
+*/
+static int 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;
+ int rc;
+ char *zErr = 0;
+ char zBuf[30];
+ if( argc!=3 ){
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " DB SQL", 0);
+ return TCL_ERROR;
+ }
+ if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
+ Tcl_DStringInit(&str);
+ rc = sqlite3_exec(db, argv[2], exec_printf_cb, &str, &zErr);
+ sprintf(zBuf, "%d", rc);
+ Tcl_AppendElement(interp, zBuf);
+ Tcl_AppendElement(interp, rc==SQLITE_OK ? Tcl_DStringValue(&str) : zErr);
+ Tcl_DStringFree(&str);
+ if( zErr ) sqlite3_free(zErr);
+ if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
+ return TCL_OK;
+}
+
+/*
+** Usage: sqlite3_exec_nr DB SQL
+**
+** Invoke the sqlite3_exec interface using the open database DB. Discard
+** all results
+*/
+static int 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;
+ char *zErr = 0;
+ if( argc!=3 ){
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " DB SQL", 0);
+ return TCL_ERROR;
+ }
+ if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
+ rc = sqlite3_exec(db, argv[2], 0, 0, &zErr);
+ if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
+ return TCL_OK;
+}
+
/*
** Usage: sqlite3_mprintf_z_test SEPARATOR ARG0 ARG1 ...
**
{ "sqlite3_mprintf_n_test", (Tcl_CmdProc*)test_mprintf_n },
{ "sqlite3_last_insert_rowid", (Tcl_CmdProc*)test_last_rowid },
{ "sqlite3_exec_printf", (Tcl_CmdProc*)test_exec_printf },
+ { "sqlite3_exec", (Tcl_CmdProc*)test_exec },
+ { "sqlite3_exec_nr", (Tcl_CmdProc*)test_exec_nr },
{ "sqlite3_get_table_printf", (Tcl_CmdProc*)test_get_table_printf },
{ "sqlite3_close", (Tcl_CmdProc*)sqlite_test_close },
{ "sqlite3_create_function", (Tcl_CmdProc*)test_create_function },
# focus of this file is testing SELECT statements that contain
# subqueries in their FROM clause.
#
-# $Id: select6.test,v 1.24 2006/06/11 23:41:56 drh Exp $
+# $Id: select6.test,v 1.25 2006/11/23 09:39:16 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
}
} {1 1 1 2 2 2 3 4 3 4 7 7 4 8 15 12 5 5 20 21}
-do_test select6-2.0 {
+do_speed_test select6-2.0 {
execsql {
CREATE TABLE t2(a INTEGER PRIMARY KEY, b);
INSERT INTO t2 SELECT * FROM t1;
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
-# $Id: tester.tcl,v 1.69 2006/10/04 11:55:50 drh Exp $
+# $Id: tester.tcl,v 1.70 2006/11/23 09:39:16 drh Exp $
# Make sure tclsqlite3 was compiled correctly. Abort now with an
# error message if not.
set skip_test 0
set failList {}
set maxErr 1000
+if {![info exists speedTest]} {
+ set speedTest 0
+}
# Invoke the do_test procedure to run a single test
#
}
}
+# Run an SQL script.
+# Return the number of microseconds per statement.
+#
+proc speed_trial {name numstmt sql} {
+ puts -nonewline [format {%-20.20s } $name...]
+ flush stdout
+ set speed [time {sqlite3_exec_nr db $sql}]
+ set tm [lindex $speed 0]
+ set per [expr {$tm/(1.0*$numstmt)}]
+ set rate [expr {1000000.0*$numstmt/$tm}]
+ puts [format {%20.1f us/stmt %20.5f stmt/s} $per $rate]
+}
+
# The procedure uses the special "sqlite_malloc_stat" command
# (which is only available if SQLite is compiled with -DSQLITE_DEBUG=1)
# to see how many malloc()s have not been free()ed. The number