]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
In shell, in shell_exec() logic, use type info if available when
authorshane <shane@noemail.net>
Thu, 22 Oct 2009 18:12:58 +0000 (18:12 +0000)
committershane <shane@noemail.net>
Thu, 22 Oct 2009 18:12:58 +0000 (18:12 +0000)
outputting in "insert" mode for other types in addition to blobs.
Changed shell_exec() to use sqlite_prepare_v2().  Ticket [72adc99de9].

FossilOrigin-Name: ab99faca6ce57a5e37405dfc8dc55d149cf3f8a3

manifest
manifest.uuid
src/shell.c

index 2200135623d60d42eaed9f37a6c167c2b5519e2d..876ad014eeaa2cffbcc85b78db959a5d54d351d7 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Updated\sshell\sto\soutput\sblobs\sin\sX'1234'\sform\swhen\sin\s"insert"\smode.\s\sTicket\s[72adc99de9].
-D 2009-10-22T17:30:16
+C In\sshell,\sin\sshell_exec()\slogic,\suse\stype\sinfo\sif\savailable\swhen\noutputting\sin\s"insert"\smode\sfor\sother\stypes\sin\saddition\sto\sblobs.\nChanged\sshell_exec()\sto\suse\ssqlite_prepare_v2().\s\sTicket\s[72adc99de9].
+D 2009-10-22T18:12:59
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 4ca3f1dd6efa2075bcb27f4dc43eef749877740d
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -161,7 +161,7 @@ F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628
 F src/resolve.c 3ac31c7181fab03732125fdedf7c2091a5c07f1b
 F src/rowset.c c64dafba1f9fd876836c8db8682966b9d197eb1f
 F src/select.c cbe366a0ce114856e66f5daf0f848d7c48a88298
-F src/shell.c 47dc8e71891a4b42ce1cff2625f2c88fa1d59a21
+F src/shell.c 5d875ff501a361459fb3b7750af7818298acb515
 F src/sqlite.h.in 5853e42a4066a6c9c3bf6592a9d57d0012bfdb90
 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
 F src/sqliteInt.h 3b00a3ce79e60c5a47c342b738c8b75013f3ec84
@@ -761,7 +761,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P e51af74c3aeb82604841cc83a490351d1422e838
-R 5e972fea3b82d3b02406cd88c5212c96
+P a2ad9e6363308b7137fcb1916769151b96933cdb
+R 31077e5a7f05cf18a673f218ab4410cb
 U shane
-Z 205a2d1cb1ef075c240f437a28ecdf29
+Z c29d7d7c6294333d062cff9c1215bb17
index f1471d0868cbde9cf0489b4d35e87ce7bda66191..efcd5ba72f17b229ae04b1690be79b461b8fb558 100644 (file)
@@ -1 +1 @@
-a2ad9e6363308b7137fcb1916769151b96933cdb
\ No newline at end of file
+ab99faca6ce57a5e37405dfc8dc55d149cf3f8a3
\ No newline at end of file
index b0d71627550abcb7c8700e5e5b4f91c5a2cf4798..a819a63e5e2865411d3b3822bc172a59577c7949 100644 (file)
@@ -1647,8 +1647,13 @@ static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int
       fprintf(p->out,"INSERT INTO %s VALUES(",p->zDestTable);
       for(i=0; i<nArg; i++){
         char *zSep = i>0 ? ",": "";
-        if( azArg[i]==0 ){
+        if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){
           fprintf(p->out,"%sNULL",zSep);
+        }else if( aiType && aiType[i]==SQLITE_TEXT ){
+          if( zSep[0] ) fprintf(p->out,"%s",zSep);
+          output_quoted_string(p->out, azArg[i]);
+        }else if( aiType && (aiType[i]==SQLITE_INTEGER || aiType[i]==SQLITE_FLOAT) ){
+          fprintf(p->out,"%s%s",zSep, azArg[i]);
         }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
           const void *pBlob = sqlite3_column_blob(p->pStmt, i);
           int nBlob = sqlite3_column_bytes(p->pStmt, i);
@@ -1830,7 +1835,7 @@ static int shell_exec(
     *pzErrMsg = NULL;
   }
 
-  rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);
+  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
   if( (SQLITE_OK != rc) || !pStmt ){
     if( pzErrMsg ){
       *pzErrMsg = save_err_msg(db);