/ Check-in [45169ce0]
Login

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

Overview
Comment:Variable name change: azVar to apVar. (CVS 1404)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 45169ce015da07da9a874b5b075ea6a05f59f162
User & Date: drh 2004-05-19 11:24:26
Context
2004-05-19
11:31
Really remove the OP_StrEq opcode this time - appearently I didn't save the file out of the editor before doing the check-in (1397). (CVS 1405) check-in: 821b0b29 user: drh tags: trunk
11:24
Variable name change: azVar to apVar. (CVS 1404) check-in: 45169ce0 user: drh tags: trunk
10:36
Tests for text encoding conversion functions. Also new sqlite3_bindXX APIs. (CVS 1403) check-in: f71844bc user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.300 2004/05/19 10:35:01 danielk1977 Exp $
           46  +** $Id: vdbe.c,v 1.301 2004/05/19 11:24:26 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include "vdbeInt.h"
    52     52   
    53     53   /*
................................................................................
   852    852   */
   853    853   case OP_Variable: {
   854    854     int j = pOp->p1 - 1;
   855    855     Mem *pVar;
   856    856     assert( j>=0 && j<p->nVar );
   857    857   
   858    858     /* If we need to translate between text encodings, do it now. If this is
   859         -  ** required, then put the new string in p->azVar. This way, if the
          859  +  ** required, then put the new string in p->apVar. This way, if the
   860    860     ** variable is used again, even after the virtual machine is reset, the
   861    861     ** conversion won't have to be done again.
   862    862     **
   863    863     ** TODO: This is where we need to support databases that use other than
   864    864     ** UTF-8 on disk.
   865    865     */
   866         -  pVar = &p->azVar[j];
          866  +  pVar = &p->apVar[j];
   867    867     if( pVar->flags&MEM_Str && !(pVar->flags&MEM_Utf8) ){
   868    868       char *zUtf8;
   869    869       assert( pVar->flags&(MEM_Utf16le|MEM_Utf16be) );
   870    870       zUtf8 = sqlite3utf16to8(pVar->z, pVar->n);
   871    871       if( !zUtf8 ){
   872    872         goto no_mem;
   873    873       }

Changes to src/vdbeInt.h.

   267    267     char **azColName;   /* Becomes the 4th parameter to callbacks */
   268    268     int nCursor;        /* Number of slots in apCsr[] */
   269    269     Cursor **apCsr;     /* One element of this array for each open cursor */
   270    270     Sorter *pSort;      /* A linked list of objects to be sorted */
   271    271     FILE *pFile;        /* At most one open file handler */
   272    272     int nField;         /* Number of file fields */
   273    273     char **azField;     /* Data for each file field */
   274         -  int nVar;           /* Number of entries in azVariable[] */
   275         -  Mem *azVar;         /* Values for the OP_Variable opcode. */
          274  +  int nVar;           /* Number of entries in apVar[] */
          275  +  Mem *apVar;         /* Values for the OP_Variable opcode. */
   276    276     char *zLine;            /* A single line from the input file */
   277    277     int nLineAlloc;         /* Number of spaces allocated for zLine */
   278    278     int magic;              /* Magic number for sanity checking */
   279    279     int nMem;               /* Number of memory locations currently allocated */
   280    280     Mem *aMem;              /* The memory locations */
   281    281     Agg agg;                /* Aggregate information */
   282    282     int nSet;               /* Number of sets allocated */

Changes to src/vdbeaux.c.

   612    612     */
   613    613     if( p->aStack==0 ){
   614    614       p->nVar = nVar;
   615    615       assert( nVar>=0 );
   616    616       n = isExplain ? 10 : p->nOp;
   617    617       p->aStack = sqliteMalloc(
   618    618         n*(sizeof(p->aStack[0]) + 2*sizeof(char*))     /* aStack and zArgv */
   619         -      + p->nVar*sizeof(Mem)                          /* azVar */
          619  +      + p->nVar*sizeof(Mem)                          /* apVar */
   620    620       );
   621    621       p->zArgv = (char**)&p->aStack[n];
   622    622       p->azColName = (char**)&p->zArgv[n];
   623         -    p->azVar = (Mem *)&p->azColName[n];
          623  +    p->apVar = (Mem *)&p->azColName[n];
   624    624       for(n=0; n<p->nVar; n++){
   625         -      p->azVar[n].flags = MEM_Null;
          625  +      p->apVar[n].flags = MEM_Null;
   626    626       }
   627    627     }
   628    628   
   629    629     sqlite3HashInit(&p->agg.hash, SQLITE_HASH_BINARY, 0);
   630    630     p->agg.pSearch = 0;
   631    631   #ifdef MEMORY_DEBUG
   632    632     if( sqlite3OsFileExists("vdbe_trace") ){
................................................................................
   757    757   }
   758    758   
   759    759   /*
   760    760   ** Clean up the VM after execution.
   761    761   **
   762    762   ** This routine will automatically close any cursors, lists, and/or
   763    763   ** sorters that were left open.  It also deletes the values of
   764         -** variables in the azVariable[] array.
          764  +** variables in the aVar[] array.
   765    765   */
   766    766   static void Cleanup(Vdbe *p){
   767    767     int i;
   768    768     if( p->aStack ){
   769    769       Mem *pTos = p->pTos;
   770    770       while( pTos>=p->aStack ){
   771    771         if( pTos->flags & MEM_Dyn ){
................................................................................
   951    951     if( p->magic!=VDBE_MAGIC_RUN || p->pc!=0 ){
   952    952       return SQLITE_MISUSE;
   953    953     }
   954    954     if( i<1 || i>p->nVar ){
   955    955       return SQLITE_RANGE;
   956    956     }
   957    957     i--;
   958         -  pVar = &p->azVar[i];
          958  +  pVar = &p->apVar[i];
   959    959     if( pVar->flags&MEM_Dyn ){
   960    960       sqliteFree(pVar->z);
   961    961     }
   962    962     pVar->flags = MEM_Null;
   963    963     return SQLITE_OK;
   964    964   }
   965    965   
................................................................................
   974    974     int bytes,         /* Number of bytes to copy */
   975    975     int copy,          /* True to copy the memory, false to copy a pointer */
   976    976     int flags          /* Valid combination of MEM_Blob, MEM_Str, MEM_UtfXX */
   977    977   ){
   978    978     Mem *pVar;
   979    979   
   980    980     vdbeUnbind(p, i);
   981         -  pVar = &p->azVar[i-1];
          981  +  pVar = &p->apVar[i-1];
   982    982   
   983    983     if( zVal ){
   984    984       pVar->n = bytes;
   985    985       pVar->flags = flags;
   986    986       if( !copy ){
   987    987         pVar->z = (char *)zVal;
   988    988         pVar->flags |= MEM_Static;
................................................................................
  1005   1005   }
  1006   1006   
  1007   1007   int sqlite3_bind_int64(sqlite3_stmt *p, int i, long long int iValue){
  1008   1008     int rc;
  1009   1009     Vdbe *v = (Vdbe *)p;
  1010   1010     rc = vdbeUnbind(v, i);
  1011   1011     if( rc==SQLITE_OK ){
  1012         -    Mem *pVar = &v->azVar[i-1];
         1012  +    Mem *pVar = &v->apVar[i-1];
  1013   1013       pVar->flags = MEM_Int;
  1014   1014       pVar->i = iValue;
  1015   1015     }
  1016   1016     return SQLITE_OK;
  1017   1017   }
  1018   1018   
  1019   1019   int sqlite3_bind_int32(sqlite3_stmt *p, int i, int iValue){
................................................................................
  1021   1021   }
  1022   1022   
  1023   1023   int sqlite3_bind_double(sqlite3_stmt *p, int i, double iValue){
  1024   1024     int rc;
  1025   1025     Vdbe *v = (Vdbe *)p;
  1026   1026     rc = vdbeUnbind(v, i);
  1027   1027     if( rc==SQLITE_OK ){
  1028         -    Mem *pVar = &v->azVar[i-1];
         1028  +    Mem *pVar = &v->apVar[i-1];
  1029   1029       pVar->flags = MEM_Real;
  1030   1030       pVar->r = iValue;
  1031   1031     }
  1032   1032     return SQLITE_OK;
  1033   1033   }
  1034   1034   
  1035   1035   int sqlite3_bind_null(sqlite3_stmt* p, int i){
................................................................................
  1111   1111     }
  1112   1112     for(i=0; i<p->nOp; i++){
  1113   1113       if( p->aOp[i].p3type==P3_DYNAMIC ){
  1114   1114         sqliteFree(p->aOp[i].p3);
  1115   1115       }
  1116   1116     }
  1117   1117     for(i=0; i<p->nVar; i++){
  1118         -    if( p->azVar[i].flags&MEM_Dyn ){
  1119         -      sqliteFree(p->azVar[i].z);
         1118  +    if( p->apVar[i].flags&MEM_Dyn ){
         1119  +      sqliteFree(p->apVar[i].z);
  1120   1120       }
  1121   1121     }
  1122   1122     sqliteFree(p->aOp);
  1123   1123     sqliteFree(p->aLabel);
  1124   1124     sqliteFree(p->aStack);
  1125   1125     p->magic = VDBE_MAGIC_DEAD;
  1126   1126     sqliteFree(p);