diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2005-09-26 19:31:41 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2005-09-26 19:31:41 +0000 |
commit | 94d1e563607f8aa9dee4e362d02e90b24db96aca (patch) | |
tree | 9bddb0952503e6baef4d0d6631cbfe6e3bfc032f /ext/pdo_sqlite/sqlite/src/shell.c | |
parent | 74c7eb772384faf2e0c78e62f24f78fd875bf757 (diff) | |
download | php-git-94d1e563607f8aa9dee4e362d02e90b24db96aca.tar.gz |
Update bundled libsqlite3 to version 3.2.7
Diffstat (limited to 'ext/pdo_sqlite/sqlite/src/shell.c')
-rw-r--r-- | ext/pdo_sqlite/sqlite/src/shell.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/ext/pdo_sqlite/sqlite/src/shell.c b/ext/pdo_sqlite/sqlite/src/shell.c index cd32a9e172..61ff2482d5 100644 --- a/ext/pdo_sqlite/sqlite/src/shell.c +++ b/ext/pdo_sqlite/sqlite/src/shell.c @@ -313,7 +313,7 @@ static void output_c_string(FILE *out, const char *z){ fputc('\\', out); fputc('r', out); }else if( !isprint(c) ){ - fprintf(out, "\\%03o", c); + fprintf(out, "\\%03o", c&0xff); }else{ fputc(c, out); } @@ -656,10 +656,14 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){ zType = azArg[1]; zSql = azArg[2]; - if( strcmp(zTable,"sqlite_sequence")!=0 ){ - fprintf(p->out, "%s;\n", zSql); - }else{ + if( strcmp(zTable, "sqlite_sequence")==0 ){ fprintf(p->out, "DELETE FROM sqlite_sequence;\n"); + }else if( strcmp(zTable, "sqlite_stat1")==0 ){ + fprintf(p->out, "ANALYZE sqlite_master;\n"); + }else if( strncmp(zTable, "sqlite_", 7)==0 ){ + return 0; + }else{ + fprintf(p->out, "%s;\n", zSql); } if( strcmp(zType, "table")==0 ){ @@ -1290,7 +1294,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ "SELECT sql FROM " " (SELECT * FROM sqlite_master UNION ALL" " SELECT * FROM sqlite_temp_master) " - "WHERE type!='meta' AND sql NOTNULL " + "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'" "ORDER BY substr(type,2,1), name", callback, &data, &zErrMsg ); @@ -1334,7 +1338,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ if( nArg==1 ){ rc = sqlite3_get_table(p->db, "SELECT name FROM sqlite_master " - "WHERE type IN ('table','view') " + "WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%'" "UNION ALL " "SELECT name FROM sqlite_temp_master " "WHERE type IN ('table','view') " @@ -1698,6 +1702,13 @@ int main(int argc, char **argv){ } data.out = stdout; +#ifdef SQLITE_OMIT_MEMORYDB + if( data.zDbFilename==0 ){ + fprintf(stderr,"%s: no database filename specified\n", argv[0]); + exit(1); + } +#endif + /* Go ahead and open the database file if it already exists. If the ** file does not exist, delay opening it. This prevents empty database ** files from being created if a user mistypes the database name argument |