/ Check-in [2e2cf992f5]
Login

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

Overview
Comment:Fix some harmless compiler warnings and improve defenses against OOM errors.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | alter-table-rename-column
Files: files | file ages | folders
SHA3-256: 2e2cf992f5d6cae2030c3c03b0eb98af3b130e86a719b991e41380138751f615
User & Date: drh 2018-09-01 16:55:36
Context
2018-09-01
20:02
Fixes for harmless compiler warnings. check-in: 41b8f38b97 user: drh tags: alter-table-rename-column
16:55
Fix some harmless compiler warnings and improve defenses against OOM errors. check-in: 2e2cf992f5 user: drh tags: alter-table-rename-column
16:13
Merge alter-table-rename-table back into this branch. check-in: ad704a7c86 user: dan tags: alter-table-rename-column
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/alter.c.

   901    901     int nQuot;
   902    902   
   903    903     /* Set zQuot to point to a buffer containing a quoted copy of the 
   904    904     ** identifier zNew. If the corresponding identifier in the original 
   905    905     ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to
   906    906     ** point to zQuot so that all substitutions are made using the
   907    907     ** quoted version of the new column name.  */
   908         -  zQuot = sqlite3_mprintf("\"%w\"", zNew);
          908  +  zQuot = sqlite3MPrintf(db, "\"%w\"", zNew);
   909    909     if( zQuot==0 ){
   910    910       return SQLITE_NOMEM;
   911    911     }else{
   912    912       nQuot = sqlite3Strlen30(zQuot);
   913    913     }
   914    914     if( bQuote ){
   915    915       zNew = zQuot;
................................................................................
  1098   1098     sqlite3_context *context,
  1099   1099     int NotUsed,
  1100   1100     sqlite3_value **argv
  1101   1101   ){
  1102   1102     sqlite3 *db = sqlite3_context_db_handle(context);
  1103   1103     RenameCtx sCtx;
  1104   1104     const char *zSql = (const char*)sqlite3_value_text(argv[0]);
  1105         -  int nSql = sqlite3_value_bytes(argv[0]);
  1106   1105     const char *zDb = (const char*)sqlite3_value_text(argv[3]);
  1107   1106     const char *zTable = (const char*)sqlite3_value_text(argv[4]);
  1108   1107     int iCol = sqlite3_value_int(argv[5]);
  1109   1108     const char *zNew = (const char*)sqlite3_value_text(argv[6]);
  1110         -  int nNew = sqlite3_value_bytes(argv[6]);
  1111   1109     int bQuote = sqlite3_value_int(argv[7]);
  1112   1110     const char *zOld;
  1113   1111     int bTemp = 0;
  1114   1112     int rc;
  1115         -  char *zErr = 0;
  1116   1113     Parse sParse;
  1117   1114     Walker sWalker;
  1118   1115     Index *pIdx;
  1119         -  char *zOut = 0;
  1120   1116     int i;
  1121   1117     Table *pTab;
  1122   1118   #ifndef SQLITE_OMIT_AUTHORIZATION
  1123   1119     sqlite3_xauth xAuth = db->xAuth;
  1124   1120   #endif
  1125   1121   
  1126   1122     UNUSED_PARAMETER(NotUsed);
................................................................................
  1417   1413     int NotUsed,
  1418   1414     sqlite3_value **argv
  1419   1415   ){
  1420   1416     sqlite3 *db = sqlite3_context_db_handle(context);
  1421   1417     unsigned char const *zDb = sqlite3_value_text(argv[0]);
  1422   1418     unsigned char const *zInput = sqlite3_value_text(argv[1]);
  1423   1419     int bTemp = sqlite3_value_int(argv[4]);
         1420  +
         1421  +  if( zInput==0 ) return;
  1424   1422   
  1425   1423   #ifndef SQLITE_OMIT_AUTHORIZATION
  1426   1424     sqlite3_xauth xAuth = db->xAuth;
  1427   1425     db->xAuth = 0;
  1428   1426   #endif
  1429   1427   
  1430   1428     if( zDb && zInput ){