]> granicus.if.org Git - php/commitdiff
merge patch from http://www.sqlite.org/cvstrac/chngview?cn=1953
authorStanislav Malyshev <stas@php.net>
Mon, 3 Jan 2005 11:29:27 +0000 (11:29 +0000)
committerStanislav Malyshev <stas@php.net>
Mon, 3 Jan 2005 11:29:27 +0000 (11:29 +0000)
bug led to PHP exiting on queries with unknown columns

ext/sqlite/libsqlite/src/auth.c

index 3f861c710de424c444ea70fbc29b03d5022a8853..040488077c5878ab58dc695fd095dc5c2501a221 100644 (file)
@@ -111,6 +111,7 @@ void sqliteAuthRead(
   const char *zCol;     /* Name of the column of the table */
   int iSrc;             /* Index in pTabList->a[] of table being read */
   const char *zDBase;   /* Name of database being accessed */
+  TriggerStack *pStack; /* The stack of current triggers */
 
   if( db->xAuth==0 ) return;
   assert( pExpr->op==TK_COLUMN );
@@ -119,15 +120,14 @@ void sqliteAuthRead(
   }
   if( iSrc>=0 && iSrc<pTabList->nSrc ){
     pTab = pTabList->a[iSrc].pTab;
-  }else{
+  }else if( (pStack = pParse->trigStack)!=0 ){
     /* This must be an attempt to read the NEW or OLD pseudo-tables
     ** of a trigger.
     */
-    TriggerStack *pStack; /* The stack of current triggers */
-    pStack = pParse->trigStack;
-    assert( pStack!=0 );
     assert( pExpr->iTable==pStack->newIdx || pExpr->iTable==pStack->oldIdx );
     pTab = pStack->pTab;
+  }else{
+    return;
   }
   if( pTab==0 ) return;
   if( pExpr->iColumn>=0 ){