/ Check-in [c7615b44]
Login

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

Overview
Comment:Changes to auth.c to promote full coverage testing. (CVS 6600)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c7615b44583c4b3afa45b57c6047478c18c234e9
User & Date: drh 2009-05-04 18:01:40
Context
2009-05-04
19:01
Avoid parsing cells that fit entirely on the b-tree page when searching a b-tree index. (CVS 6601) check-in: 77a82395 user: danielk1977 tags: trunk
18:01
Changes to auth.c to promote full coverage testing. (CVS 6600) check-in: c7615b44 user: drh tags: trunk
11:42
Speed up INSERT operations that add data to UNIQUE or PRIMARY KEY indexes by rationalizing duplicate seek operations. (CVS 6599) check-in: cac4f3d8 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/auth.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to implement the sqlite3_set_authorizer()
    13     13   ** API.  This facility is an optional feature of the library.  Embedded
    14     14   ** systems that do not need this facility may omit it by recompiling
    15     15   ** the library with -DSQLITE_OMIT_AUTHORIZATION=1
    16     16   **
    17         -** $Id: auth.c,v 1.30 2009/05/04 01:58:31 drh Exp $
           17  +** $Id: auth.c,v 1.31 2009/05/04 18:01:40 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   
    21     21   /*
    22     22   ** All of the code in this file may be omitted by defining a single
    23     23   ** macro.
    24     24   */
................................................................................
   119    119     assert( pExpr->op==TK_COLUMN );
   120    120     iDb = sqlite3SchemaToIndex(pParse->db, pSchema);
   121    121     if( iDb<0 ){
   122    122       /* An attempt to read a column out of a subquery or other
   123    123       ** temporary table. */
   124    124       return;
   125    125     }
   126         -  for(iSrc=0; pTabList && iSrc<pTabList->nSrc; iSrc++){
   127         -    if( pExpr->iTable==pTabList->a[iSrc].iCursor ) break;
   128         -  }
   129         -  if( pTabList && iSrc<pTabList->nSrc ){
          126  +  if( pTabList ){
          127  +    for(iSrc=0; ALWAYS(iSrc<pTabList->nSrc); iSrc++){
          128  +      if( pExpr->iTable==pTabList->a[iSrc].iCursor ) break;
          129  +    }
          130  +    assert( iSrc<pTabList->nSrc );
   130    131       pTab = pTabList->a[iSrc].pTab;
   131         -  }else if( (pStack = pParse->trigStack)!=0 ){
   132         -    /* This must be an attempt to read the NEW or OLD pseudo-tables
   133         -    ** of a trigger.
   134         -    */
   135         -    assert( pExpr->iTable==pStack->newIdx || pExpr->iTable==pStack->oldIdx );
   136         -    pTab = pStack->pTab;
          132  +  }else{
          133  +    pStack = pParse->trigStack;
          134  +    if( ALWAYS(pStack) ){
          135  +      /* This must be an attempt to read the NEW or OLD pseudo-tables
          136  +      ** of a trigger.
          137  +      */
          138  +      assert( pExpr->iTable==pStack->newIdx || pExpr->iTable==pStack->oldIdx );
          139  +      pTab = pStack->pTab;
          140  +    }
   137    141     }
   138         -  if( pTab==0 ) return;
          142  +  if( NEVER(pTab==0) ) return;
   139    143     if( pExpr->iColumn>=0 ){
   140    144       assert( pExpr->iColumn<pTab->nCol );
   141    145       zCol = pTab->aCol[pExpr->iColumn].zName;
   142    146     }else if( pTab->iPKey>=0 ){
   143    147       assert( pTab->iPKey<pTab->nCol );
   144    148       zCol = pTab->aCol[pTab->iPKey].zName;
   145    149     }else{
................................................................................
   207    211   ** popped.  Or if pParse==0, this routine is a no-op.
   208    212   */
   209    213   void sqlite3AuthContextPush(
   210    214     Parse *pParse,
   211    215     AuthContext *pContext, 
   212    216     const char *zContext
   213    217   ){
          218  +  assert( pParse );
   214    219     pContext->pParse = pParse;
   215         -  if( pParse ){
   216         -    pContext->zAuthContext = pParse->zAuthContext;
   217         -    pParse->zAuthContext = zContext;
   218         -  }
          220  +  pContext->zAuthContext = pParse->zAuthContext;
          221  +  pParse->zAuthContext = zContext;
   219    222   }
   220    223   
   221    224   /*
   222    225   ** Pop an authorization context that was previously pushed
   223    226   ** by sqlite3AuthContextPush
   224    227   */
   225    228   void sqlite3AuthContextPop(AuthContext *pContext){