-C Add\sa\s-cleanup\soption\sto\sTcl\stest\sproc\sdo_ioerr_test.\s(CVS\s2485)
-D 2005-05-26T15:20:53
+C Add\san\sexperimental\ssqlite3_get_autocommit()\sAPI\sused\sto\stest\swhether\sor\snot\nchanges\sare\scommitted\sautomatically.\s(CVS\s2486)
+D 2005-05-26T16:23:34
F Makefile.in 8129e7f261d405db783676f9ca31e0841768c652
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
F src/insert.c 34c25c33f51a43644a42cc091ac967b070c6b6d5
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
-F src/main.c 9fa85c83f5fc6344dcf412db6034375377b7a494
+F src/main.c f61bdb0a1afeb2eff7285f4f3752e1085ecc55ed
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
F src/os.h e5438be25cf96858787bf9b60fc7a2420e139ee3
F src/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c 071a484044efb74fb5d8f79560822cbfc7c906c3
F src/shell.c 25b3217d7c64e6497225439d261a253a23efff26
-F src/sqlite.h.in 3675e3ada207e09b9d52a0463561325df4ac26b5
+F src/sqlite.h.in f28f5b018f03a66aaf0bc1ab6985d8605d6b964f
F src/sqliteInt.h 0de60fafa8d9a15b03b4ed2cfbc2372a5b259295
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
F src/tclsqlite.c af0f002d9d6ab4f7f32b9bee5b57665946e76ad9
-F src/test1.c 4ad7ffe5a74fd99d4f73f6fd28ba27f403b3adba
+F src/test1.c 6a8943111d63b31433be49d9f9f7bee796ef12e1
F src/test2.c 7f0ef466706ac01414e1136b96e5d8a65cb97545
F src/test3.c 683e1e3819152ffd35da2f201e507228921148d0
F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
F test/btree6.test a5ede6bfbbb2ec8b27e62813612c0f28e8f3e027
F test/btree7.test a6d3b842db22af97dd14b989e90a2fd96066b72f
F test/capi2.test f897209386fb21cfdc9267595e0c667ebaca9164
-F test/capi3.test 7c1c91895239fef05427ceb628a193cb4f61031f
+F test/capi3.test feadced0b3cc4085c328439b7e64ce7963801c5b
F test/capi3b.test 5b6a66f9f295f79f443b5d3f33187fa5ef6cf336
F test/collate1.test f79736d2ebf5492167ee4d1f4ab4c09dda776b03
F test/collate2.test 224a632ba04907c049804b08162efd234aa7871f
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b
-P 7f67b9f0f398583651d226fabf2fafd2635d772a
-R c6bfa60e45e3c36269b49426e1b9d927
-U danielk1977
-Z 0110a3d4036ad18c1628df7000ce6af7
+P b0a898c05a2285c87d7da4d47dd697c58a0d4d58
+R 113e24d04585bd6cfafaa3cb61125259
+U drh
+Z f82135b994cfa2d26c1f56d5cdbaf4d2
-b0a898c05a2285c87d7da4d47dd697c58a0d4d58
\ No newline at end of file
+4a7f1275857602e3841ccb2d43a5c4d3d3e87bff
\ No newline at end of file
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.292 2005/05/26 12:37:30 danielk1977 Exp $
+** $Id: main.c,v 1.293 2005/05/26 16:23:34 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
return rc;
}
#endif
+
+/*
+** Test to see whether or not the database connection is in autocommit
+** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on
+** by default. Autocommit is disabled by a BEGIN statement and reenabled
+** by the next COMMIT or ROLLBACK.
+**
+******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
+*/
+int sqlite3_get_autocommit(sqlite3 *db){
+ return db->autoCommit;
+}
** This header file defines the interface that the SQLite library
** presents to client programs.
**
-** @(#) $Id: sqlite.h.in,v 1.133 2005/04/22 02:38:38 drh Exp $
+** @(#) $Id: sqlite.h.in,v 1.134 2005/05/26 16:23:34 drh Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
*/
int sqlite3_global_recover();
+/*
+** Test to see whether or not the database connection is in autocommit
+** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on
+** by default. Autocommit is disabled by a BEGIN statement and reenabled
+** by the next COMMIT or ROLLBACK.
+**
+******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
+*/
+int sqlite3_get_autocommit(sqlite3*);
+
+
+
#ifdef __cplusplus
} /* End of the 'extern "C"' block */
#endif
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.138 2005/04/28 17:18:49 drh Exp $
+** $Id: test1.c,v 1.139 2005/05/26 16:23:34 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
return TCL_OK;
}
+/*
+** Usage: sqlite3_get_autocommit DB
+**
+** Return true if the database DB is currently in auto-commit mode.
+** Return false if not.
+*/
+static int get_autocommit(
+ void * clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+){
+ char zBuf[30];
+ sqlite3 *db;
+ if( argc!=2 ){
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " DB", 0);
+ return TCL_ERROR;
+ }
+ if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
+ sprintf(zBuf, "%d", sqlite3_get_autocommit(db));
+ Tcl_AppendResult(interp, zBuf, 0);
+ return TCL_OK;
+}
+
/*
** Usage: tcl_variable_type VARIABLENAME
**
#if 0
{ "sqlite3_sleep", (Tcl_CmdProc*)test_sleep },
#endif
- { "sqlite_delete_function", (Tcl_CmdProc*)delete_function },
- { "sqlite_delete_collation", (Tcl_CmdProc*)delete_collation }
+ { "sqlite_delete_function", (Tcl_CmdProc*)delete_function },
+ { "sqlite_delete_collation", (Tcl_CmdProc*)delete_collation },
+ { "sqlite3_get_autocommit", (Tcl_CmdProc*)get_autocommit },
};
static struct {
char *zName;
# 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.31 2005/03/09 12:26:51 danielk1977 Exp $
+# $Id: capi3.test,v 1.32 2005/05/26 16:23:34 drh Exp $
#
set testdir [file dirname $argv0]
db close
set DB [sqlite3 db test.db]
+do_test capi3-1.0 {
+ sqlite3_get_autocommit $DB
+} 1
do_test capi3-1.1 {
set STMT [sqlite3_prepare $DB {SELECT name FROM sqlite_master} -1 TAIL]
sqlite3_finalize $STMT
INSERT INTO t1 VALUES(2, 'notatype');
}
} {}
+do_test capi3-11.1.1 {
+ sqlite3_get_autocommit $DB
+} 0
do_test capi3-11.2 {
set STMT [sqlite3_prepare $DB "SELECT func(b, a) FROM t1" -1 TAIL]
sqlite3_step $STMT
COMMIT;
}
} {1 {cannot commit transaction - SQL statements in progress}}
+do_test capi3-11.3.1 {
+ sqlite3_get_autocommit $DB
+} 0
do_test capi3-11.4 {
sqlite3_step $STMT
} {SQLITE_ERROR}
SELECT * FROM t1;
}
} {0 {1 int 2 notatype}}
+do_test capi3-11.6.1 {
+ sqlite3_get_autocommit $DB
+} 0
do_test capi3-11.7 {
catchsql {
COMMIT;
}
} {0 {}}
+do_test capi3-11.7.1 {
+ sqlite3_get_autocommit $DB
+} 1
do_test capi3-11.8 {
execsql {
CREATE TABLE t2(a);
INSERT INTO t2 VALUES(3);
}
} {}
+do_test capi3-11.8.1 {
+ sqlite3_get_autocommit $DB
+} 0
do_test capi3-11.9 {
set STMT [sqlite3_prepare $DB "SELECT a FROM t2" -1 TAIL]
sqlite3_step $STMT
} {SQLITE_ROW}
-do_test capi3-11.3 {
+do_test capi3-11.9.1 {
+ sqlite3_get_autocommit $DB
+} 0
+do_test capi3-11.9.2 {
catchsql {
ROLLBACK;
}
} {1 {cannot rollback transaction - SQL statements in progress}}
+do_test capi3-11.9.3 {
+ sqlite3_get_autocommit $DB
+} 0
do_test capi3-11.10 {
sqlite3_step $STMT
} {SQLITE_ROW}
SELECT a FROM t2;
}
} {1 2 3}
+do_test capi3-11.14.1 {
+ sqlite3_get_autocommit $DB
+} 0
do_test capi3-11.15 {
catchsql {
ROLLBACK;
}
} {0 {}}
+do_test capi3-11.15.1 {
+ sqlite3_get_autocommit $DB
+} 1
do_test capi3-11.16 {
execsql {
SELECT a FROM t2;