SQLite

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
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.347
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
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/alter.c.
901
902
903
904
905
906
907
908

909
910
911
912
913
914
915
901
902
903
904
905
906
907

908
909
910
911
912
913
914
915







-
+







  int nQuot;

  /* Set zQuot to point to a buffer containing a quoted copy of the 
  ** identifier zNew. If the corresponding identifier in the original 
  ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to
  ** point to zQuot so that all substitutions are made using the
  ** quoted version of the new column name.  */
  zQuot = sqlite3_mprintf("\"%w\"", zNew);
  zQuot = sqlite3MPrintf(db, "\"%w\"", zNew);
  if( zQuot==0 ){
    return SQLITE_NOMEM;
  }else{
    nQuot = sqlite3Strlen30(zQuot);
  }
  if( bQuote ){
    zNew = zQuot;
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1098
1099
1100
1101
1102
1103
1104

1105
1106
1107
1108

1109
1110
1111
1112

1113
1114
1115

1116
1117
1118
1119
1120
1121
1122







-




-




-



-







  sqlite3_context *context,
  int NotUsed,
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_context_db_handle(context);
  RenameCtx sCtx;
  const char *zSql = (const char*)sqlite3_value_text(argv[0]);
  int nSql = sqlite3_value_bytes(argv[0]);
  const char *zDb = (const char*)sqlite3_value_text(argv[3]);
  const char *zTable = (const char*)sqlite3_value_text(argv[4]);
  int iCol = sqlite3_value_int(argv[5]);
  const char *zNew = (const char*)sqlite3_value_text(argv[6]);
  int nNew = sqlite3_value_bytes(argv[6]);
  int bQuote = sqlite3_value_int(argv[7]);
  const char *zOld;
  int bTemp = 0;
  int rc;
  char *zErr = 0;
  Parse sParse;
  Walker sWalker;
  Index *pIdx;
  char *zOut = 0;
  int i;
  Table *pTab;
#ifndef SQLITE_OMIT_AUTHORIZATION
  sqlite3_xauth xAuth = db->xAuth;
#endif

  UNUSED_PARAMETER(NotUsed);
1417
1418
1419
1420
1421
1422
1423


1424
1425
1426
1427
1428
1429
1430
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428







+
+







  int NotUsed,
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_context_db_handle(context);
  unsigned char const *zDb = sqlite3_value_text(argv[0]);
  unsigned char const *zInput = sqlite3_value_text(argv[1]);
  int bTemp = sqlite3_value_int(argv[4]);

  if( zInput==0 ) return;

#ifndef SQLITE_OMIT_AUTHORIZATION
  sqlite3_xauth xAuth = db->xAuth;
  db->xAuth = 0;
#endif

  if( zDb && zInput ){