/ Check-in [2be9850c]
Login

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

Overview
Comment:Rename fields of the internal AuxData object to make them unique and easier to search for.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:2be9850cef6492e168243807c34af72119ffbe414027a12c4eda6c421b5b950d
User & Date: drh 2017-05-10 19:42:52
Context
2017-05-11
12:05
Change the SQLITE_READ authorization call for unreferenced tables to use an empty string for the column name, as this is less likely to impact legacy authorization callbacks that assume column names are always non-NULL. check-in: 4139953a user: drh tags: trunk
2017-05-10
19:42
Rename fields of the internal AuxData object to make them unique and easier to search for. check-in: 2be9850c user: drh tags: trunk
16:33
Improved documentation for the SQLITE_READ authorizer callback. No code changes. check-in: 92c5ea70 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbeInt.h.

   283    283   ** Each auxiliary data pointer stored by a user defined function 
   284    284   ** implementation calling sqlite3_set_auxdata() is stored in an instance
   285    285   ** of this structure. All such structures associated with a single VM
   286    286   ** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed
   287    287   ** when the VM is halted (if not before).
   288    288   */
   289    289   struct AuxData {
   290         -  int iOp;                        /* Instruction number of OP_Function opcode */
   291         -  int iArg;                       /* Index of function argument. */
          290  +  int iAuxOp;                     /* Instruction number of OP_Function opcode */
          291  +  int iAuxArg;                    /* Index of function argument. */
   292    292     void *pAux;                     /* Aux data pointer */
   293         -  void (*xDelete)(void *);        /* Destructor for the aux data */
   294         -  AuxData *pNext;                 /* Next element in list */
          293  +  void (*xDeleteAux)(void*);      /* Destructor for the aux data */
          294  +  AuxData *pNextAux;              /* Next element in list */
   295    295   };
   296    296   
   297    297   /*
   298    298   ** The "context" argument for an installable function.  A pointer to an
   299    299   ** instance of this structure is the first argument to the routines used
   300    300   ** implement the SQL functions.
   301    301   **

Changes to src/vdbeapi.c.

   810    810   
   811    811     assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
   812    812   #if SQLITE_ENABLE_STAT3_OR_STAT4
   813    813     if( pCtx->pVdbe==0 ) return 0;
   814    814   #else
   815    815     assert( pCtx->pVdbe!=0 );
   816    816   #endif
   817         -  for(pAuxData=pCtx->pVdbe->pAuxData; pAuxData; pAuxData=pAuxData->pNext){
   818         -    if( pAuxData->iOp==pCtx->iOp && pAuxData->iArg==iArg ) break;
          817  +  for(pAuxData=pCtx->pVdbe->pAuxData; pAuxData; pAuxData=pAuxData->pNextAux){
          818  +    if( pAuxData->iAuxOp==pCtx->iOp && pAuxData->iAuxArg==iArg ){
          819  +      return pAuxData->pAux;
          820  +    }
   819    821     }
   820         -
   821         -  return (pAuxData ? pAuxData->pAux : 0);
          822  +  return 0;
   822    823   }
   823    824   
   824    825   /*
   825    826   ** Set the auxiliary data pointer and delete function, for the iArg'th
   826    827   ** argument to the user-function defined by pCtx. Any previous value is
   827    828   ** deleted by calling the delete function specified when it was set.
   828    829   */
................................................................................
   839    840     if( iArg<0 ) goto failed;
   840    841   #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
   841    842     if( pVdbe==0 ) goto failed;
   842    843   #else
   843    844     assert( pVdbe!=0 );
   844    845   #endif
   845    846   
   846         -  for(pAuxData=pVdbe->pAuxData; pAuxData; pAuxData=pAuxData->pNext){
   847         -    if( pAuxData->iOp==pCtx->iOp && pAuxData->iArg==iArg ) break;
          847  +  for(pAuxData=pVdbe->pAuxData; pAuxData; pAuxData=pAuxData->pNextAux){
          848  +    if( pAuxData->iAuxOp==pCtx->iOp && pAuxData->iAuxArg==iArg ) break;
   848    849     }
   849    850     if( pAuxData==0 ){
   850    851       pAuxData = sqlite3DbMallocZero(pVdbe->db, sizeof(AuxData));
   851    852       if( !pAuxData ) goto failed;
   852         -    pAuxData->iOp = pCtx->iOp;
   853         -    pAuxData->iArg = iArg;
   854         -    pAuxData->pNext = pVdbe->pAuxData;
          853  +    pAuxData->iAuxOp = pCtx->iOp;
          854  +    pAuxData->iAuxArg = iArg;
          855  +    pAuxData->pNextAux = pVdbe->pAuxData;
   855    856       pVdbe->pAuxData = pAuxData;
   856    857       if( pCtx->fErrorOrAux==0 ){
   857    858         pCtx->isError = 0;
   858    859         pCtx->fErrorOrAux = 1;
   859    860       }
   860         -  }else if( pAuxData->xDelete ){
   861         -    pAuxData->xDelete(pAuxData->pAux);
          861  +  }else if( pAuxData->xDeleteAux ){
          862  +    pAuxData->xDeleteAux(pAuxData->pAux);
   862    863     }
   863    864   
   864    865     pAuxData->pAux = pAux;
   865         -  pAuxData->xDelete = xDelete;
          866  +  pAuxData->xDeleteAux = xDelete;
   866    867     return;
   867    868   
   868    869   failed:
   869    870     if( xDelete ){
   870    871       xDelete(pAux);
   871    872     }
   872    873   }

Changes to src/vdbeaux.c.

  2964   2964   **    * the corresponding bit in argument mask is clear (where the first
  2965   2965   **      function parameter corresponds to bit 0 etc.).
  2966   2966   */
  2967   2967   void sqlite3VdbeDeleteAuxData(sqlite3 *db, AuxData **pp, int iOp, int mask){
  2968   2968     while( *pp ){
  2969   2969       AuxData *pAux = *pp;
  2970   2970       if( (iOp<0)
  2971         -     || (pAux->iOp==iOp && (pAux->iArg>31 || !(mask & MASKBIT32(pAux->iArg))))
         2971  +     || (pAux->iAuxOp==iOp 
         2972  +          && (pAux->iAuxArg>31 || !(mask & MASKBIT32(pAux->iAuxArg))))
  2972   2973       ){
  2973         -      testcase( pAux->iArg==31 );
  2974         -      if( pAux->xDelete ){
  2975         -        pAux->xDelete(pAux->pAux);
         2974  +      testcase( pAux->iAuxArg==31 );
         2975  +      if( pAux->xDeleteAux ){
         2976  +        pAux->xDeleteAux(pAux->pAux);
  2976   2977         }
  2977         -      *pp = pAux->pNext;
         2978  +      *pp = pAux->pNextAux;
  2978   2979         sqlite3DbFree(db, pAux);
  2979   2980       }else{
  2980         -      pp= &pAux->pNext;
         2981  +      pp= &pAux->pNextAux;
  2981   2982       }
  2982   2983     }
  2983   2984   }
  2984   2985   
  2985   2986   /*
  2986   2987   ** Free all memory associated with the Vdbe passed as the second argument,
  2987   2988   ** except for object itself, which is preserved.