drh | dd2a43a | 2017-12-14 19:24:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | ** This is the source code to a "tclsh" that has SQLite built-in. |
| 3 | ** |
| 4 | ** The startup script is located as follows: |
| 5 | ** |
| 6 | ** (1) Open the executable as an appended SQLite database and try to |
| 7 | ** read the startup script out of that database. |
| 8 | ** |
| 9 | ** (2) If the first argument is a readable file, try to open that file |
| 10 | ** as an SQLite database and read the startup script out of that |
| 11 | ** database. |
| 12 | ** |
| 13 | ** (3) If the first argument is a readable file with a ".tcl" extension, |
| 14 | ** then try to run that script directly. |
| 15 | ** |
| 16 | ** If none of the above steps work, then the program runs as an interactive |
| 17 | ** tclsh. |
| 18 | */ |
| 19 | #define TCLSH_INIT_PROC sqlite3_tclapp_init_proc |
| 20 | #define SQLITE_ENABLE_DBSTAT_VTAB 1 |
| 21 | #undef SQLITE_THREADSAFE |
| 22 | #define SQLITE_THREADSAFE 0 |
| 23 | #undef SQLITE_ENABLE_COLUMN_METADATA |
| 24 | #define SQLITE_OMIT_DECLTYPE 1 |
| 25 | #define SQLITE_OMIT_DEPRECATED 1 |
| 26 | #define SQLITE_OMIT_PROGRESS_CALLBACK 1 |
| 27 | #define SQLITE_OMIT_SHARED_CACHE 1 |
| 28 | #define SQLITE_DEFAULT_MEMSTATUS 0 |
| 29 | #define SQLITE_MAX_EXPR_DEPTH 0 |
| 30 | INCLUDE sqlite3.c |
| 31 | INCLUDE $ROOT/ext/misc/appendvfs.c |
mistachkin | 98dfb2f | 2018-01-08 14:24:08 +0000 | [diff] [blame] | 32 | #ifdef SQLITE_HAVE_ZLIB |
drh | 8682e12 | 2018-01-07 20:38:10 +0000 | [diff] [blame] | 33 | INCLUDE $ROOT/ext/misc/zipfile.c |
| 34 | INCLUDE $ROOT/ext/misc/sqlar.c |
mistachkin | 98dfb2f | 2018-01-08 14:24:08 +0000 | [diff] [blame] | 35 | #endif |
drh | dd2a43a | 2017-12-14 19:24:00 +0000 | [diff] [blame] | 36 | INCLUDE $ROOT/src/tclsqlite.c |
| 37 | |
| 38 | const char *sqlite3_tclapp_init_proc(Tcl_Interp *interp){ |
| 39 | (void)interp; |
| 40 | sqlite3_appendvfs_init(0,0,0); |
mistachkin | 98dfb2f | 2018-01-08 14:24:08 +0000 | [diff] [blame] | 41 | #ifdef SQLITE_HAVE_ZLIB |
drh | 8682e12 | 2018-01-07 20:38:10 +0000 | [diff] [blame] | 42 | sqlite3_auto_extension((void(*)(void))sqlite3_sqlar_init); |
| 43 | sqlite3_auto_extension((void(*)(void))sqlite3_zipfile_init); |
mistachkin | 98dfb2f | 2018-01-08 14:24:08 +0000 | [diff] [blame] | 44 | #endif |
drh | 8682e12 | 2018-01-07 20:38:10 +0000 | [diff] [blame] | 45 | |
drh | dd2a43a | 2017-12-14 19:24:00 +0000 | [diff] [blame] | 46 | return |
| 47 | BEGIN_STRING |
| 48 | INCLUDE $ROOT/tool/sqltclsh.tcl |
| 49 | END_STRING |
| 50 | ; |
| 51 | } |