Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Variable name change: azVar to apVar. (CVS 1404) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
45169ce015da07da9a874b5b075ea6a0 |
User & Date: | drh 2004-05-19 11:24:26.000 |
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: 821b0b297c user: drh tags: trunk) | |
11:24 | Variable name change: azVar to apVar. (CVS 1404) (check-in: 45169ce015 user: drh tags: trunk) | |
10:36 | Tests for text encoding conversion functions. Also new sqlite3_bindXX APIs. (CVS 1403) (check-in: f71844bc27 user: danielk1977 tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** ** $Id: vdbe.c,v 1.301 2004/05/19 11:24:26 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> #include "vdbeInt.h" /* |
︙ | ︙ | |||
852 853 854 855 856 857 858 | */ case OP_Variable: { int j = pOp->p1 - 1; Mem *pVar; assert( j>=0 && j<p->nVar ); /* If we need to translate between text encodings, do it now. If this is | | | | 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | */ case OP_Variable: { int j = pOp->p1 - 1; Mem *pVar; assert( j>=0 && j<p->nVar ); /* If we need to translate between text encodings, do it now. If this is ** required, then put the new string in p->apVar. This way, if the ** variable is used again, even after the virtual machine is reset, the ** conversion won't have to be done again. ** ** TODO: This is where we need to support databases that use other than ** UTF-8 on disk. */ pVar = &p->apVar[j]; if( pVar->flags&MEM_Str && !(pVar->flags&MEM_Utf8) ){ char *zUtf8; assert( pVar->flags&(MEM_Utf16le|MEM_Utf16be) ); zUtf8 = sqlite3utf16to8(pVar->z, pVar->n); if( !zUtf8 ){ goto no_mem; } |
︙ | ︙ |
Changes to src/vdbeInt.h.
︙ | ︙ | |||
267 268 269 270 271 272 273 | char **azColName; /* Becomes the 4th parameter to callbacks */ int nCursor; /* Number of slots in apCsr[] */ Cursor **apCsr; /* One element of this array for each open cursor */ Sorter *pSort; /* A linked list of objects to be sorted */ FILE *pFile; /* At most one open file handler */ int nField; /* Number of file fields */ char **azField; /* Data for each file field */ | | | | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | char **azColName; /* Becomes the 4th parameter to callbacks */ int nCursor; /* Number of slots in apCsr[] */ Cursor **apCsr; /* One element of this array for each open cursor */ Sorter *pSort; /* A linked list of objects to be sorted */ FILE *pFile; /* At most one open file handler */ int nField; /* Number of file fields */ char **azField; /* Data for each file field */ int nVar; /* Number of entries in apVar[] */ Mem *apVar; /* Values for the OP_Variable opcode. */ char *zLine; /* A single line from the input file */ int nLineAlloc; /* Number of spaces allocated for zLine */ int magic; /* Magic number for sanity checking */ int nMem; /* Number of memory locations currently allocated */ Mem *aMem; /* The memory locations */ Agg agg; /* Aggregate information */ int nSet; /* Number of sets allocated */ |
︙ | ︙ |
Changes to src/vdbeaux.c.
︙ | ︙ | |||
612 613 614 615 616 617 618 | */ if( p->aStack==0 ){ p->nVar = nVar; assert( nVar>=0 ); n = isExplain ? 10 : p->nOp; p->aStack = sqliteMalloc( n*(sizeof(p->aStack[0]) + 2*sizeof(char*)) /* aStack and zArgv */ | | | | | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 | */ if( p->aStack==0 ){ p->nVar = nVar; assert( nVar>=0 ); n = isExplain ? 10 : p->nOp; p->aStack = sqliteMalloc( n*(sizeof(p->aStack[0]) + 2*sizeof(char*)) /* aStack and zArgv */ + p->nVar*sizeof(Mem) /* apVar */ ); p->zArgv = (char**)&p->aStack[n]; p->azColName = (char**)&p->zArgv[n]; p->apVar = (Mem *)&p->azColName[n]; for(n=0; n<p->nVar; n++){ p->apVar[n].flags = MEM_Null; } } sqlite3HashInit(&p->agg.hash, SQLITE_HASH_BINARY, 0); p->agg.pSearch = 0; #ifdef MEMORY_DEBUG if( sqlite3OsFileExists("vdbe_trace") ){ |
︙ | ︙ | |||
757 758 759 760 761 762 763 | } /* ** Clean up the VM after execution. ** ** This routine will automatically close any cursors, lists, and/or ** sorters that were left open. It also deletes the values of | | | 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 | } /* ** Clean up the VM after execution. ** ** This routine will automatically close any cursors, lists, and/or ** sorters that were left open. It also deletes the values of ** variables in the aVar[] array. */ static void Cleanup(Vdbe *p){ int i; if( p->aStack ){ Mem *pTos = p->pTos; while( pTos>=p->aStack ){ if( pTos->flags & MEM_Dyn ){ |
︙ | ︙ | |||
951 952 953 954 955 956 957 | if( p->magic!=VDBE_MAGIC_RUN || p->pc!=0 ){ return SQLITE_MISUSE; } if( i<1 || i>p->nVar ){ return SQLITE_RANGE; } i--; | | | 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 | if( p->magic!=VDBE_MAGIC_RUN || p->pc!=0 ){ return SQLITE_MISUSE; } if( i<1 || i>p->nVar ){ return SQLITE_RANGE; } i--; pVar = &p->apVar[i]; if( pVar->flags&MEM_Dyn ){ sqliteFree(pVar->z); } pVar->flags = MEM_Null; return SQLITE_OK; } |
︙ | ︙ | |||
974 975 976 977 978 979 980 | int bytes, /* Number of bytes to copy */ int copy, /* True to copy the memory, false to copy a pointer */ int flags /* Valid combination of MEM_Blob, MEM_Str, MEM_UtfXX */ ){ Mem *pVar; vdbeUnbind(p, i); | | | 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 | int bytes, /* Number of bytes to copy */ int copy, /* True to copy the memory, false to copy a pointer */ int flags /* Valid combination of MEM_Blob, MEM_Str, MEM_UtfXX */ ){ Mem *pVar; vdbeUnbind(p, i); pVar = &p->apVar[i-1]; if( zVal ){ pVar->n = bytes; pVar->flags = flags; if( !copy ){ pVar->z = (char *)zVal; pVar->flags |= MEM_Static; |
︙ | ︙ | |||
1005 1006 1007 1008 1009 1010 1011 | } int sqlite3_bind_int64(sqlite3_stmt *p, int i, long long int iValue){ int rc; Vdbe *v = (Vdbe *)p; rc = vdbeUnbind(v, i); if( rc==SQLITE_OK ){ | | | | 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 | } int sqlite3_bind_int64(sqlite3_stmt *p, int i, long long int iValue){ int rc; Vdbe *v = (Vdbe *)p; rc = vdbeUnbind(v, i); if( rc==SQLITE_OK ){ Mem *pVar = &v->apVar[i-1]; pVar->flags = MEM_Int; pVar->i = iValue; } return SQLITE_OK; } int sqlite3_bind_int32(sqlite3_stmt *p, int i, int iValue){ return sqlite3_bind_int64(p, i, (long long int)iValue); } int sqlite3_bind_double(sqlite3_stmt *p, int i, double iValue){ int rc; Vdbe *v = (Vdbe *)p; rc = vdbeUnbind(v, i); if( rc==SQLITE_OK ){ Mem *pVar = &v->apVar[i-1]; pVar->flags = MEM_Real; pVar->r = iValue; } return SQLITE_OK; } int sqlite3_bind_null(sqlite3_stmt* p, int i){ |
︙ | ︙ | |||
1111 1112 1113 1114 1115 1116 1117 | } for(i=0; i<p->nOp; i++){ if( p->aOp[i].p3type==P3_DYNAMIC ){ sqliteFree(p->aOp[i].p3); } } for(i=0; i<p->nVar; i++){ | | | | 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 | } for(i=0; i<p->nOp; i++){ if( p->aOp[i].p3type==P3_DYNAMIC ){ sqliteFree(p->aOp[i].p3); } } for(i=0; i<p->nVar; i++){ if( p->apVar[i].flags&MEM_Dyn ){ sqliteFree(p->apVar[i].z); } } sqliteFree(p->aOp); sqliteFree(p->aLabel); sqliteFree(p->aStack); p->magic = VDBE_MAGIC_DEAD; sqliteFree(p); |
︙ | ︙ |