aboutsummaryrefslogtreecommitdiff
path: root/src/tclsqlite.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2011-10-11 12:58:38 +0000
committerdrh <drh@noemail.net>2011-10-11 12:58:38 +0000
commit29c21c77af012bed32e3c68c71b813f885c4641d (patch)
treed3d62d6714ba3e71397149a98943fab48ecff2b1 /src/tclsqlite.c
parent946e610a8497e3868e47ad2c976913ec37fb0df6 (diff)
parent67855877ffa8a1d70ab17a65ead5dd3872e4623a (diff)
downloadsqlite-29c21c77af012bed32e3c68c71b813f885c4641d.tar.gz
sqlite-29c21c77af012bed32e3c68c71b813f885c4641d.zip
Merge all the latest trunk changes into the sessions branch - especially
the SQLITE_ENABLE_STAT3 enhancements. FossilOrigin-Name: 403431cac6b039b0693915c5422f08dc60dae230
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r--src/tclsqlite.c67
1 files changed, 39 insertions, 28 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index 66cacc130..ddd960853 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -3685,33 +3685,34 @@ int Md5_Register(sqlite3 *db){
** the TCL interpreter reads and evaluates that file.
*/
#if TCLSH==1
-static char zMainloop[] =
- "set line {}\n"
- "while {![eof stdin]} {\n"
- "if {$line!=\"\"} {\n"
- "puts -nonewline \"> \"\n"
- "} else {\n"
- "puts -nonewline \"% \"\n"
- "}\n"
- "flush stdout\n"
- "append line [gets stdin]\n"
- "if {[info complete $line]} {\n"
- "if {[catch {uplevel #0 $line} result]} {\n"
- "puts stderr \"Error: $result\"\n"
- "} elseif {$result!=\"\"} {\n"
- "puts $result\n"
+static const char *tclsh_main_loop(void){
+ static const char zMainloop[] =
+ "set line {}\n"
+ "while {![eof stdin]} {\n"
+ "if {$line!=\"\"} {\n"
+ "puts -nonewline \"> \"\n"
+ "} else {\n"
+ "puts -nonewline \"% \"\n"
+ "}\n"
+ "flush stdout\n"
+ "append line [gets stdin]\n"
+ "if {[info complete $line]} {\n"
+ "if {[catch {uplevel #0 $line} result]} {\n"
+ "puts stderr \"Error: $result\"\n"
+ "} elseif {$result!=\"\"} {\n"
+ "puts $result\n"
+ "}\n"
+ "set line {}\n"
+ "} else {\n"
+ "append line \\n\n"
"}\n"
- "set line {}\n"
- "} else {\n"
- "append line \\n\n"
"}\n"
- "}\n"
-;
+ ;
+ return zMainloop;
+}
#endif
#if TCLSH==2
-static char zMainloop[] =
-#include "spaceanal_tcl.h"
-;
+static const char *tclsh_main_loop(void);
#endif
#ifdef SQLITE_TEST
@@ -3795,6 +3796,17 @@ static void init_all(Tcl_Interp *interp){
Md5_Init(interp);
#endif
+ /* Install the [register_dbstat_vtab] command to access the implementation
+ ** of virtual table dbstat (source file test_stat.c). This command is
+ ** required for testfixture and sqlite3_analyzer, but not by the production
+ ** Tcl extension. */
+#if defined(SQLITE_TEST) || TCLSH==2
+ {
+ extern int SqlitetestStat_Init(Tcl_Interp*);
+ SqlitetestStat_Init(interp);
+ }
+#endif
+
#ifdef SQLITE_TEST
{
extern int Sqliteconfig_Init(Tcl_Interp*);
@@ -3824,7 +3836,6 @@ static void init_all(Tcl_Interp *interp){
extern int Sqlitetestbackup_Init(Tcl_Interp*);
extern int Sqlitetestintarray_Init(Tcl_Interp*);
extern int Sqlitetestvfs_Init(Tcl_Interp *);
- extern int SqlitetestStat_Init(Tcl_Interp*);
extern int Sqlitetestrtree_Init(Tcl_Interp*);
extern int Sqlitequota_Init(Tcl_Interp*);
extern int Sqlitemultiplex_Init(Tcl_Interp*);
@@ -3870,7 +3881,6 @@ static void init_all(Tcl_Interp *interp){
Sqlitetestbackup_Init(interp);
Sqlitetestintarray_Init(interp);
Sqlitetestvfs_Init(interp);
- SqlitetestStat_Init(interp);
Sqlitetestrtree_Init(interp);
Sqlitequota_Init(interp);
Sqlitemultiplex_Init(interp);
@@ -3908,12 +3918,13 @@ int TCLSH_MAIN(int argc, char **argv){
** sqlite3_initialize() is. */
sqlite3_shutdown();
+ Tcl_FindExecutable(argv[0]);
+ interp = Tcl_CreateInterp();
+
#if TCLSH==2
sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
#endif
- Tcl_FindExecutable(argv[0]);
- interp = Tcl_CreateInterp();
init_all(interp);
if( argc>=2 ){
int i;
@@ -3934,7 +3945,7 @@ int TCLSH_MAIN(int argc, char **argv){
}
}
if( TCLSH==2 || argc<=1 ){
- Tcl_GlobalEval(interp, zMainloop);
+ Tcl_GlobalEval(interp, tclsh_main_loop());
}
return 0;
}