Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/tool/sqlite3_analyzer.c.in # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / tool / sqlite3_analyzer.c.in` 80 lines ยท 1982 bytes Raw Blame History 1 /* 2 ** Read an SQLite database file and analyze its space utilization. Generate 3 ** text on standard output. 4 */ 5 #define TCLSH_INIT_PROC sqlite3_analyzer_init_proc 6 IFDEF INCLUDE_SQLITE3_C 7 #undef SQLITE_ENABLE_DBSTAT_VTAB 8 #define SQLITE_ENABLE_DBSTAT_VTAB 1 9 #undef SQLITE_THREADSAFE 10 #define SQLITE_THREADSAFE 0 11 #undef SQLITE_ENABLE_COLUMN_METADATA 12 #define SQLITE_OMIT_DECLTYPE 1 13 #define SQLITE_OMIT_DEPRECATED 1 14 #define SQLITE_OMIT_PROGRESS_CALLBACK 1 15 #define SQLITE_OMIT_SHARED_CACHE 1 16 #define SQLITE_DEFAULT_MEMSTATUS 0 17 #define SQLITE_MAX_EXPR_DEPTH 0 18 #define SQLITE_OMIT_LOAD_EXTENSION 1 19 INCLUDE sqlite3.c 20 ELSE 21 #include "sqlite3.h" 22 ENDIF 23 INCLUDE $ROOT/src/tclsqlite.c 24 25 #if defined(_WIN32) 26 INCLUDE $ROOT/ext/misc/sqlite3_stdio.h 27 INCLUDE $ROOT/ext/misc/sqlite3_stdio.c 28 29 /* Substitute "puts" command. Only these forms recognized: 30 ** 31 ** puts STRING 32 ** puts stderr STRING 33 ** puts -nonewline STRING 34 */ 35 static int subst_puts( 36 void *NotUsed, 37 Tcl_Interp *interp, 38 int objc, 39 Tcl_Obj *const*objv 40 ){ 41 FILE *pOut = stdout; 42 const char *zOut; 43 int addNewLine = 1; 44 if( objc==2 ){ 45 zOut = Tcl_GetString(objv[1]); 46 }else if( objc!=3 ){ 47 Tcl_WrongNumArgs(interp, 1, objv, "?stderr|-nonewline? STRING"); 48 return TCL_ERROR; 49 }else{ 50 const char *zArg = Tcl_GetString(objv[1]); 51 if( zArg==0 ) return TCL_ERROR; 52 zOut = Tcl_GetString(objv[2]); 53 if( strcmp(zArg, "stderr")==0 ){ 54 pOut = stderr; 55 }else if( strcmp(zArg, "-nonewline")==0 ){ 56 addNewLine = 0; 57 }else{ 58 Tcl_AppendResult(interp, "bad argument: ", zArg, NULL); 59 return TCL_ERROR; 60 } 61 } 62 sqlite3_fputs(zOut, pOut); 63 if( addNewLine ) sqlite3_fputs("\n", pOut); 64 fflush(pOut); 65 return TCL_OK; 66 } 67 #endif /* defined(_WIN32) */ 68 69 const char *sqlite3_analyzer_init_proc(Tcl_Interp *interp){ 70 #if defined(_WIN32) 71 Tcl_CreateObjCommand(interp, "puts", subst_puts, 0, 0); 72 #else 73 (void)interp; 74 #endif 75 return 76 BEGIN_STRING 77 INCLUDE $ROOT/tool/spaceanal.tcl 78 END_STRING 79 ; 80 }