/ Check-in [7be760e9]
Login

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

Overview
Comment:Remove an unused variable from sqlite3Insert() and fix harmless compiler warnings associated with -DSQLITE_MUTATION_TEST.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7be760e907274131bcd4acfaff9e72c9c59a05e7d411db3d9afe690fe0d64b4b
User & Date: drh 2017-10-03 17:17:34
Context
2017-10-03
17:29
Add some OK_IF_ALWAYS_TRUE() marks on optimization branches in select.c. check-in: 1dd82808 user: drh tags: trunk
17:17
Remove an unused variable from sqlite3Insert() and fix harmless compiler warnings associated with -DSQLITE_MUTATION_TEST. check-in: 7be760e9 user: drh tags: trunk
16:57
Fix the sqlite3_column_decltype() interface to return the correct datatype when the value comes through a CTE. check-in: 966438bd user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/insert.c.

   480    480     SrcList *pTabList,    /* Name of table into which we are inserting */
   481    481     Select *pSelect,      /* A SELECT statement to use as the data source */
   482    482     IdList *pColumn,      /* Column names corresponding to IDLIST. */
   483    483     int onError           /* How to handle constraint errors */
   484    484   ){
   485    485     sqlite3 *db;          /* The main database structure */
   486    486     Table *pTab;          /* The table to insert into.  aka TABLE */
   487         -  char *zTab;           /* Name of the table into which we are inserting */
   488    487     int i, j;             /* Loop counters */
   489    488     Vdbe *v;              /* Generate code into this virtual machine */
   490    489     Index *pIdx;          /* For looping over indices of the table */
   491    490     int nColumn;          /* Number of columns in the data */
   492    491     int nHidden = 0;      /* Number of hidden columns if TABLE is virtual */
   493    492     int iDataCur = 0;     /* VDBE cursor that is the main data repository */
   494    493     int iIdxCur = 0;      /* First index cursor */
................................................................................
   536    535       sqlite3SelectDelete(db, pSelect);
   537    536       pSelect = 0;
   538    537     }
   539    538   
   540    539     /* Locate the table into which we will be inserting new information.
   541    540     */
   542    541     assert( pTabList->nSrc==1 );
   543         -  zTab = pTabList->a[0].zName;
   544         -  if( NEVER(zTab==0) ) goto insert_cleanup;
   545    542     pTab = sqlite3SrcListLookup(pParse, pTabList);
   546    543     if( pTab==0 ){
   547    544       goto insert_cleanup;
   548    545     }
   549    546     iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
   550    547     assert( iDb<db->nDb );
   551    548     if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0,

Changes to src/main.c.

  3707   3707   
  3708   3708       /*
  3709   3709       **  sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, int X)
  3710   3710       **
  3711   3711       ** This action provides a run-time test to see how the ALWAYS and
  3712   3712       ** NEVER macros were defined at compile-time.
  3713   3713       **
  3714         -    ** The return value is ALWAYS(X).  
         3714  +    ** The return value is ALWAYS(X) if X is true, or 0 if X is false.
  3715   3715       **
  3716   3716       ** The recommended test is X==2.  If the return value is 2, that means
  3717   3717       ** ALWAYS() and NEVER() are both no-op pass-through macros, which is the
  3718   3718       ** default setting.  If the return value is 1, then ALWAYS() is either
  3719   3719       ** hard-coded to true or else it asserts if its argument is false.
  3720   3720       ** The first behavior (hard-coded to true) is the case if
  3721   3721       ** SQLITE_TESTCTRL_ASSERT shows that assert() is disabled and the second
................................................................................
  3730   3730       **      // ALWAYS(x) asserts that x is true. NEVER(x) asserts x is false.
  3731   3731       **    }else{
  3732   3732       **      // ALWAYS(x) is a constant 1.  NEVER(x) is a constant 0.
  3733   3733       **    }
  3734   3734       */
  3735   3735       case SQLITE_TESTCTRL_ALWAYS: {
  3736   3736         int x = va_arg(ap,int);
  3737         -      rc = ALWAYS(x);
         3737  +      rc = x ? ALWAYS(x) : 0;
  3738   3738         break;
  3739   3739       }
  3740   3740   
  3741   3741       /*
  3742   3742       **   sqlite3_test_control(SQLITE_TESTCTRL_BYTEORDER);
  3743   3743       **
  3744   3744       ** The integer returned reveals the byte-order of the computer on which

Changes to src/select.c.

   408    408     struct SrcList_item *pLeft;     /* Left table being joined */
   409    409     struct SrcList_item *pRight;    /* Right table being joined */
   410    410   
   411    411     pSrc = p->pSrc;
   412    412     pLeft = &pSrc->a[0];
   413    413     pRight = &pLeft[1];
   414    414     for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){
   415         -    Table *pLeftTab = pLeft->pTab;
   416    415       Table *pRightTab = pRight->pTab;
   417    416       int isOuter;
   418    417   
   419         -    if( NEVER(pLeftTab==0 || pRightTab==0) ) continue;
          418  +    if( NEVER(pLeft->pTab==0 || pRightTab==0) ) continue;
   420    419       isOuter = (pRight->fg.jointype & JT_OUTER)!=0;
   421    420   
   422    421       /* When the NATURAL keyword is present, add WHERE clause terms for
   423    422       ** every column that the two tables have in common.
   424    423       */
   425    424       if( pRight->fg.jointype & JT_NATURAL ){
   426    425         if( pRight->pOn || pRight->pUsing ){