SQLite

Check-in [ab99faca6c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In shell, in shell_exec() logic, use type info if available when outputting in "insert" mode for other types in addition to blobs. Changed shell_exec() to use sqlite_prepare_v2(). Ticket [72adc99de9] and [7b61b6c6ce].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ab99faca6ce57a5e37405dfc8dc55d149cf3f8a3
User & Date: shane 2009-10-22 18:12:59.000
Original Comment: In shell, in shell_exec() logic, use type info if available when outputting in "insert" mode for other types in addition to blobs. Changed shell_exec() to use sqlite_prepare_v2(). Ticket [72adc99de9].
References
2009-10-22
19:38 Fixed ticket [7b61b6c6ce]: insert mode is incorrectly converting text to numbers plus 4 other changes (artifact: 91fba9fd6a user: shane)
18:15 Ticket [72adc99de9] shell mode insert doesn't output blobs as blobs status still Review with 1 other change (artifact: 4fc3cc9ef5 user: shane)
Context
2009-10-22
20:50
Add some sample requirement implementation comments to where.c. (check-in: 9854ad00ae user: drh tags: trunk)
18:12
In shell, in shell_exec() logic, use type info if available when outputting in "insert" mode for other types in addition to blobs. Changed shell_exec() to use sqlite_prepare_v2(). Ticket [72adc99de9] and [7b61b6c6ce]. (check-in: ab99faca6c user: shane tags: trunk)
17:30
Updated shell to output blobs in X'1234' form when in "insert" mode. Ticket [72adc99de9]. (check-in: a2ad9e6363 user: shane tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/shell.c.
1643
1644
1645
1646
1647
1648
1649
1650

1651





1652
1653
1654
1655
1656
1657
1658
1643
1644
1645
1646
1647
1648
1649

1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663







-
+

+
+
+
+
+







      break;
    }
    case MODE_Insert: {
      if( azArg==0 ) break;
      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);
          if( zSep[0] ) fprintf(p->out,"%s",zSep);
          output_hex_blob(p->out, pBlob, nBlob);
        }else if( isNumber(azArg[i], 0) ){
          fprintf(p->out,"%s%s",zSep, azArg[i]);
1826
1827
1828
1829
1830
1831
1832
1833

1834
1835
1836
1837
1838
1839
1840
1831
1832
1833
1834
1835
1836
1837

1838
1839
1840
1841
1842
1843
1844
1845







-
+







  sqlite3_stmt *pStmt = NULL;
  int rc, rc2;

  if( pzErrMsg ){
    *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);
    }
  }else{
    /* perform the first step.  this will tell us if we
    ** have a result set or not and how wide it is.