------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C Check-in\s[19064d7cea]\sbroke\sthe\spTail\sreturn\son\ssqlite3_prepare16()\swhen\nthe\sSQL\scontained\ssurrogates.\sThis\scheck-in\srestores\scorrect\sfunction.\nPart\sof\sticket\s[3fe897352e].
-D 2009-10-24T01:55:15
+C In\sshell,\schanged\s".tables"\scommand\sto\snot\sadd\s'%'\sto\sspecified\spattern.\s\sThis\sis\sconsistent\nwith\sother\scommands\sthat\stake\sa\sLIKE\spattern\s(.dump,\s.schema,\s.indices).\nUpdated\sinternal\shelp\sto\sbetter\sdescribe\sLIKE\spattern\susage.\nFixed\sa\sfew\smore\sinconsistencies\sin\serror\smessages.\sTicket\s[6da68f691b].
+D 2009-10-24T02:00:07
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a77dfde96ad86aafd3f71651a4333a104debe86a
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/resolve.c 3ac31c7181fab03732125fdedf7c2091a5c07f1b
F src/rowset.c c64dafba1f9fd876836c8db8682966b9d197eb1f
F src/select.c cbe366a0ce114856e66f5daf0f848d7c48a88298
-F src/shell.c 19c86a22e32096a3bc6845b200a793fb9f2d0376
+F src/shell.c 0e43ac51c416d61e5491beeed14495b37941f9ab
F src/sqlite.h.in 5853e42a4066a6c9c3bf6592a9d57d0012bfdb90
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
F src/sqliteInt.h 3b00a3ce79e60c5a47c342b738c8b75013f3ec84
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 19064d7cea838e1a93fe63743ed247f440679e97
-R 44dc5ec300c49505c4d9505ed09a5846
-U drh
-Z 311a3a4efd8a48ee4d5b8ab3156cfc0d
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFK4l6HoxKgR168RlERAh4lAJ9MkpkD9AGChuh3laSqM4tt1RLMVwCdHia4
-0BLXlH3U8qi9GDIqnVIMoCM=
-=ltxy
------END PGP SIGNATURE-----
+P 65b1e3a4c31f6cb6fd3f600701658b0cdbee603f
+R 33ed6fc2ad95ec267314811e76645c50
+U shane
+Z 74660ae65b33d7b4cfbd712c9f8b941d
if( needQuote ) n += 2;
z = p->zDestTable = malloc( n+1 );
if( z==0 ){
- fprintf(stderr,"Out of memory!\n");
+ fprintf(stderr,"Error: out of memory\n");
exit(1);
}
n = 0;
rc2 = sqlite3_finalize(pStmt);
/* if the last sqlite3_finalize() didn't complete successfully
- ** AND we don't have a save error from sqlite3_step ... */
+ ** AND we don't have a saved error from sqlite3_step ... */
if( (SQLITE_OK != rc2) && (SQLITE_OK == rc) ){
rc = rc2;
if( pzErrMsg ){
".bail ON|OFF Stop after hitting an error. Default OFF\n"
".databases List names and files of attached databases\n"
".dump ?TABLE? ... Dump the database in an SQL text format\n"
+ " If TABLE specified, only dump tables matching\n"
+ " LIKE pattern TABLE.\n"
".echo ON|OFF Turn command echo on or off\n"
".exit Exit this program\n"
".explain ON|OFF Turn output mode suitable for EXPLAIN on or off.\n"
".header(s) ON|OFF Turn display of headers on or off\n"
".help Show this message\n"
".import FILE TABLE Import data from FILE into TABLE\n"
- ".indices TABLE Show names of all indices on TABLE\n"
+ ".indices ?TABLE? Show names of all indices\n"
+ " If TABLE specified, only show indices for tables\n"
+ " matching LIKE pattern TABLE.\n"
#ifdef SQLITE_ENABLE_IOTRACE
".iotrace FILE Enable I/O diagnostic logging to FILE\n"
#endif
".read FILENAME Execute SQL in FILENAME\n"
".restore ?DB? FILE Restore content of DB (default \"main\") from FILE\n"
".schema ?TABLE? Show the CREATE statements\n"
+ " If TABLE specified, only show tables matching\n"
+ " LIKE pattern TABLE.\n"
".separator STRING Change separator used by output mode and .import\n"
".show Show the current values for various settings\n"
- ".tables ?PATTERN? List names of tables matching a LIKE pattern\n"
+ ".tables ?TABLE? List names of tables\n"
+ " If TABLE specified, only list tables matching\n"
+ " LIKE pattern TABLE.\n"
".timeout MS Try opening locked tables for MS milliseconds\n"
".width NUM NUM ... Set column widths for \"column\" mode\n"
;
shellstaticFunc, 0, 0);
}
if( db==0 || SQLITE_OK!=sqlite3_errcode(db) ){
- fprintf(stderr,"Unable to open database \"%s\": %s\n",
+ fprintf(stderr,"Error: unable to open database \"%s\": %s\n",
p->zDbFilename, sqlite3_errmsg(db));
exit(1);
}
sqlite3_exec(p->db, zCommit, 0, 0, 0);
}else
- if( c=='i' && strncmp(azArg[0], "indices", n)==0 && nArg>1 ){
+ if( c=='i' && strncmp(azArg[0], "indices", n)==0 ){
struct callback_data data;
char *zErrMsg = 0;
open_db(p);
memcpy(&data, p, sizeof(data));
data.showHeader = 0;
data.mode = MODE_List;
- zShellStatic = azArg[1];
- sqlite3_exec(p->db,
- "SELECT name FROM sqlite_master "
- "WHERE type='index' AND tbl_name LIKE shellstatic() "
- "UNION ALL "
- "SELECT name FROM sqlite_temp_master "
- "WHERE type='index' AND tbl_name LIKE shellstatic() "
- "ORDER BY 1",
- callback, &data, &zErrMsg
- );
- zShellStatic = 0;
+ if( nArg==1 ){
+ rc = sqlite3_exec(p->db,
+ "SELECT name FROM sqlite_master "
+ "WHERE type='index' AND name NOT LIKE 'sqlite_%' "
+ "UNION ALL "
+ "SELECT name FROM sqlite_temp_master "
+ "WHERE type='index' "
+ "ORDER BY 1",
+ callback, &data, &zErrMsg
+ );
+ }else{
+ zShellStatic = azArg[1];
+ rc = sqlite3_exec(p->db,
+ "SELECT name FROM sqlite_master "
+ "WHERE type='index' AND tbl_name LIKE shellstatic() "
+ "UNION ALL "
+ "SELECT name FROM sqlite_temp_master "
+ "WHERE type='index' AND tbl_name LIKE shellstatic() "
+ "ORDER BY 1",
+ callback, &data, &zErrMsg
+ );
+ zShellStatic = 0;
+ }
if( zErrMsg ){
fprintf(stderr,"Error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
rc = 1;
+ }else if( rc != SQLITE_OK ){
+ fprintf(stderr,"Error: querying sqlite_master and sqlite_temp_master\n");
+ rc = 1;
}
}else
if( nArg==1 ){
rc = sqlite3_get_table(p->db,
"SELECT name FROM sqlite_master "
- "WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%'"
+ "WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%' "
"UNION ALL "
"SELECT name FROM sqlite_temp_master "
"WHERE type IN ('table','view') "
zShellStatic = azArg[1];
rc = sqlite3_get_table(p->db,
"SELECT name FROM sqlite_master "
- "WHERE type IN ('table','view') AND name LIKE '%'||shellstatic()||'%' "
+ "WHERE type IN ('table','view') AND name LIKE shellstatic() "
"UNION ALL "
"SELECT name FROM sqlite_temp_master "
- "WHERE type IN ('table','view') AND name LIKE '%'||shellstatic()||'%' "
+ "WHERE type IN ('table','view') AND name LIKE shellstatic() "
"ORDER BY 1",
&azResult, &nRow, 0, &zErrMsg
);
}
}
if( zSql ){
- if( !_all_whitespace(zSql) ) fprintf(stderr, "Incomplete SQL: %s\n", zSql);
+ if( !_all_whitespace(zSql) ) fprintf(stderr, "Error: incomplete SQL: %s\n", zSql);
free(zSql);
}
free(zLine);
home_dir = find_home_dir();
if( home_dir==0 ){
#if !defined(__RTP__) && !defined(_WRS_KERNEL)
- fprintf(stderr,"%s: cannot locate your home directory!\n", Argv0);
+ fprintf(stderr,"%s: Error: cannot locate your home directory\n", Argv0);
#endif
return 1;
}
nBuf = strlen30(home_dir) + 16;
zBuf = malloc( nBuf );
if( zBuf==0 ){
- fprintf(stderr,"%s: out of memory!\n", Argv0);
- exit(1);
+ fprintf(stderr,"%s: Error: out of memory\n",Argv0);
+ return 1;
}
sqlite3_snprintf(nBuf, zBuf,"%s/.sqliterc",home_dir);
free(home_dir);
in = fopen(sqliterc,"rb");
if( in ){
if( stdin_is_interactive ){
- printf("-- Loading resources from %s\n",sqliterc);
+ fprintf(stderr,"-- Loading resources from %s\n",sqliterc);
}
rc = process_input(p,in);
fclose(in);
#ifdef SQLITE_OMIT_MEMORYDB
if( data.zDbFilename==0 ){
- fprintf(stderr,"%s: no database filename specified\n", argv[0]);
- exit(1);
+ fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
+ return 1;
}
#endif
** is given on the command line, look for a file named ~/.sqliterc and
** try to process it.
*/
- process_sqliterc(&data,zInitFile);
+ rc = process_sqliterc(&data,zInitFile);
+ if( rc>0 ){
+ return rc;
+ }
/* Make a second pass through the command-line argument and set
** options. This second pass is delayed until after the initialization
}else if( strcmp(z,"-help")==0 || strcmp(z, "--help")==0 ){
usage(1);
}else{
- fprintf(stderr,"%s: unknown option: %s\n", Argv0, z);
+ fprintf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
fprintf(stderr,"Use -help for a list of options.\n");
return 1;
}
*/
if( zFirstCmd[0]=='.' ){
rc = do_meta_command(zFirstCmd, &data);
- exit(rc);
+ return rc;
}else{
- int rc;
open_db(&data);
rc = shell_exec(data.db, zFirstCmd, shell_callback, &data, &zErrMsg);
- if( rc!=0 && zErrMsg!=0 ){
- fprintf(stderr,"SQL error: %s\n", zErrMsg);
- exit(1);
+ if( zErrMsg!=0 ){
+ fprintf(stderr,"Error: %s\n", zErrMsg);
+ return rc!=0 ? rc : 1;
+ }else if( rc!=0 ){
+ fprintf(stderr,"Error: unable to process SQL \"%s\"\n", zFirstCmd);
+ return rc;
}
}
}else{
set_table_name(&data, 0);
if( db ){
if( sqlite3_close(db)!=SQLITE_OK ){
- fprintf(stderr,"error closing database: %s\n", sqlite3_errmsg(db));
+ fprintf(stderr,"Error: cannot close database \"%s\"\n", sqlite3_errmsg(db));
+ rc++;
}
}
return rc;