/ Check-in [d0a8bd6a]
Login

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

Overview
Comment:Change the sqlite3_bind_value() implementation to use a default branch on the type switch so that there are no untested jumps in the switch. (CVS 6505)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:d0a8bd6a53c5da0ac6b88818f82c7f7d330b527a
User & Date: drh 2009-04-14 12:58:20
Context
2009-04-14
18:44
nMax can be zero and subtracting 1 from an unsigned zero produces undesirable results (CVS 6506) check-in: a117d82d user: aswift tags: trunk
12:58
Change the sqlite3_bind_value() implementation to use a default branch on the type switch so that there are no untested jumps in the switch. (CVS 6505) check-in: d0a8bd6a user: drh tags: trunk
12:43
Reimplement the sqlite3_bind_value() interface so that it works when the value being bound comes from a different database connection. (CVS 6504) check-in: 3db0c798 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbeapi.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   **
    13     13   ** This file contains code use to implement APIs that are part of the
    14     14   ** VDBE.
    15     15   **
    16         -** $Id: vdbeapi.c,v 1.162 2009/04/14 12:43:34 drh Exp $
           16  +** $Id: vdbeapi.c,v 1.163 2009/04/14 12:58:20 drh Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include "vdbeInt.h"
    20     20   
    21     21   #if 0 && defined(SQLITE_ENABLE_MEMORY_MANAGEMENT)
    22     22   /*
    23     23   ** The following structure contains pointers to the end points of a
................................................................................
  1149   1149   ){
  1150   1150     return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE);
  1151   1151   }
  1152   1152   #endif /* SQLITE_OMIT_UTF16 */
  1153   1153   int sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_value *pValue){
  1154   1154     int rc;
  1155   1155     switch( pValue->type ){
  1156         -    case SQLITE_NULL: {
  1157         -      rc = sqlite3_bind_null(pStmt, i);
  1158         -      break;
  1159         -    }
  1160   1156       case SQLITE_INTEGER: {
  1161   1157         rc = sqlite3_bind_int64(pStmt, i, pValue->u.i);
  1162   1158         break;
  1163   1159       }
  1164   1160       case SQLITE_FLOAT: {
  1165   1161         rc = sqlite3_bind_double(pStmt, i, pValue->r);
  1166   1162         break;
................................................................................
  1170   1166           rc = sqlite3_bind_zeroblob(pStmt, i, pValue->u.nZero);
  1171   1167         }else{
  1172   1168           rc = sqlite3_bind_blob(pStmt, i, pValue->z, pValue->n,SQLITE_TRANSIENT);
  1173   1169         }
  1174   1170         break;
  1175   1171       }
  1176   1172       case SQLITE_TEXT: {
  1177         -      rc = bindText(pStmt,i,  pValue->z, pValue->n, SQLITE_TRANSIENT, pValue->enc);
         1173  +      rc = bindText(pStmt,i,  pValue->z, pValue->n, SQLITE_TRANSIENT,
         1174  +                              pValue->enc);
         1175  +      break;
         1176  +    }
         1177  +    default: {
         1178  +      rc = sqlite3_bind_null(pStmt, i);
  1178   1179         break;
  1179   1180       }
  1180   1181     }
  1181   1182     return rc;
  1182   1183   }
  1183   1184   int sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){
  1184   1185     int rc;