/ Check-in [41b8f38b97]
Login

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

Overview
Comment:Fixes for harmless compiler warnings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | alter-table-rename-column
Files: files | file ages | folders
SHA3-256: 41b8f38b97bf0d1abcd6de8e940269fc4c51e2bbcf7b2e53e0c8440c58187c33
User & Date: drh 2018-09-01 20:02:07
Context
2018-09-01
20:23
Fix a problem with renaming a column in a table that has a temp trigger that references another attached database. check-in: 336b8a0923 user: dan tags: alter-table-rename-column
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
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/alter.c.

   263    263     const char *zTab;         /* Table name */
   264    264     char *zCol;               /* Null-terminated column definition */
   265    265     Column *pCol;             /* The new column */
   266    266     Expr *pDflt;              /* Default value for the new column */
   267    267     sqlite3 *db;              /* The database connection; */
   268    268     Vdbe *v;                  /* The prepared statement under construction */
   269    269     int r1;                   /* Temporary registers */
   270         -  char *zWhere;             /* WHERE clause for reloading schema */
   271    270   
   272    271     db = pParse->db;
   273    272     if( pParse->nErr || db->mallocFailed ) return;
   274    273     pNew = pParse->pNewTable;
   275    274     assert( pNew );
   276    275   
   277    276     assert( sqlite3BtreeHoldsAllMutexes(db) );
................................................................................
   395    394   **
   396    395   ** Routine sqlite3AlterFinishAddColumn() will be called to complete
   397    396   ** coding the "ALTER TABLE ... ADD" statement.
   398    397   */
   399    398   void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){
   400    399     Table *pNew;
   401    400     Table *pTab;
   402         -  Vdbe *v;
   403    401     int iDb;
   404    402     int i;
   405    403     int nAlloc;
   406    404     sqlite3 *db = pParse->db;
   407    405   
   408    406     /* Look up the table being altered. */
   409    407     assert( pParse->pNewTable==0 );
................................................................................
  1288   1286   */
  1289   1287   static void renameTableFunc(
  1290   1288     sqlite3_context *context,
  1291   1289     int NotUsed,
  1292   1290     sqlite3_value **argv
  1293   1291   ){
  1294   1292     sqlite3 *db = sqlite3_context_db_handle(context);
  1295         -  char *zOutput = 0;
  1296         -  char *zResult;
  1297         -  unsigned char const *zDb = sqlite3_value_text(argv[0]);
  1298         -  unsigned char const *zInput = sqlite3_value_text(argv[1]);
  1299         -  unsigned char const *zOld = sqlite3_value_text(argv[2]);
  1300         -  unsigned char const *zNew = sqlite3_value_text(argv[3]);
         1293  +  const char *zDb = (const char*)sqlite3_value_text(argv[0]);
         1294  +  const char *zInput = (const char*)sqlite3_value_text(argv[1]);
         1295  +  const char *zOld = (const char*)sqlite3_value_text(argv[2]);
         1296  +  const char *zNew = (const char*)sqlite3_value_text(argv[3]);
  1301   1297     int bTemp = sqlite3_value_int(argv[4]);
         1298  +  UNUSED_PARAMETER(NotUsed);
  1302   1299   
  1303   1300     if( zInput && zOld && zNew ){
  1304         -    unsigned const char *z;         /* Pointer to token */
  1305         -    int n;                          /* Length of token z */
  1306         -    int token;                      /* Type of token */
  1307         -
  1308   1301       Parse sParse;
  1309   1302       int rc;
  1310   1303       int bQuote = 1;
  1311   1304       RenameCtx sCtx;
  1312   1305       Walker sWalker;
  1313   1306   
  1314   1307   #ifndef SQLITE_OMIT_AUTHORIZATION
................................................................................
  1410   1403   
  1411   1404   static void renameTableTest(
  1412   1405     sqlite3_context *context,
  1413   1406     int NotUsed,
  1414   1407     sqlite3_value **argv
  1415   1408   ){
  1416   1409     sqlite3 *db = sqlite3_context_db_handle(context);
  1417         -  unsigned char const *zDb = sqlite3_value_text(argv[0]);
  1418         -  unsigned char const *zInput = sqlite3_value_text(argv[1]);
         1410  +  char const *zDb = (const char*)sqlite3_value_text(argv[0]);
         1411  +  char const *zInput = (const char*)sqlite3_value_text(argv[1]);
  1419   1412     int bTemp = sqlite3_value_int(argv[4]);
  1420   1413   
  1421         -  if( zInput==0 ) return;
  1422         -
  1423   1414   #ifndef SQLITE_OMIT_AUTHORIZATION
  1424   1415     sqlite3_xauth xAuth = db->xAuth;
  1425   1416     db->xAuth = 0;
  1426   1417   #endif
  1427   1418   
         1419  +  UNUSED_PARAMETER(NotUsed);
  1428   1420     if( zDb && zInput ){
  1429   1421       int rc;
  1430   1422       Parse sParse;
  1431   1423       rc = renameParseSql(&sParse, zDb, 1, db, zInput, bTemp);
  1432   1424       if( rc==SQLITE_OK ){
  1433   1425         if( sParse.pNewTable && sParse.pNewTable->pSelect ){
  1434   1426           NameContext sNC;