Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch version_2 Excluding Merge-Ins
This is equivalent to a diff from 7ace5762 to 47fee16b
2007-01-08
| ||
16:20 | Fix a date round-off problem in strftime(). Ticket #2153. (CVS 3575) (Leaf check-in: 47fee16b user: drh tags: version_2) | |
13:43 | Fix a round-off error in the %W conversion of strftime(). Ticket #2150. (CVS 3572) (check-in: e6a18741 user: drh tags: version_2) | |
2004-04-23
| ||
23:37 | Add some extra debugging logic to lemon.c. Ticket #692. (CVS 1304) (check-in: 635f674d user: drh tags: version_2) | |
23:20 | Branch version_2. Code for version 3 is on the trunk. (CVS 1303) (check-in: db84ddf5 user: drh tags: trunk) | |
17:04 | Get the temp_store and default_temp_store pragmas working. Update the documentation. Also fix a malloc problem that popped up during the regression testing. (CVS 1302) (check-in: 7ace5762 user: drh tags: trunk) | |
2004-03-26
| ||
23:16 | Fix windows DLL section of Makefile.in for use with build dir. (CVS 1301) (check-in: 1e84f70f user: rdc tags: trunk) | |
Changes to VERSION.
| 1 | - + |
|
Changes to main.mk.
︙ | |||
151 152 153 154 155 156 157 158 159 160 161 162 163 164 | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | + + + + + + + + + + + + + + | libsqlite.a: $(LIBOBJ) $(AR) libsqlite.a $(LIBOBJ) $(RANLIB) libsqlite.a sqlite$(EXE): $(TOP)/src/shell.c libsqlite.a sqlite.h $(TCCX) $(READLINE_FLAGS) -o sqlite$(EXE) $(TOP)/src/shell.c \ libsqlite.a $(LIBREADLINE) $(THREADLIB) sqlite_analyzer$(EXE): $(TOP)/src/tclsqlite.c libsqlite.a $(TESTSRC) \ $(TOP)/tool/spaceanal.tcl sed \ -e '/^#/d' \ -e 's,\\,\\\\,g' \ -e 's,",\\",g' \ -e 's,^,",' \ -e 's,$$,\\n",' \ $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h $(TCCX) $(TCL_FLAGS) -DTCLSH=2 -DSQLITE_TEST=1 -static -o \ sqlite_analyzer$(EXE) $(TESTSRC) $(TOP)/src/tclsqlite.c \ libsqlite.a $(LIBTCL) # This target creates a directory named "tsrc" and fills it with # copies of all of the C source code and header files needed to # build on the target system. Some of the C source code and header # files are automatically generated. This target takes care of # all that automatic generation. # |
︙ |
Changes to publish.sh.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | - + + + - - + + + + + - + - + - + + - + - + - + + + - + + + - - - | #!/bin/sh # # This script is used to compile SQLite and all its documentation and # ship everything up to the SQLite website. This script will only work # on the system "zadok" at the Hwaci offices. But others might find # the script useful as an example. # # Set srcdir to the name of the directory that contains the publish.sh # script. # srcdir=`echo "$0" | sed 's%\(^.*\)/[^/][^/]*$%\1%'` |
︙ | |||
72 73 74 75 76 77 78 | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | - + | --def tclsqlite.def -v --export-all \ --driver-name i386-mingw32msvc-gcc \ --dlltool-name i386-mingw32msvc-dlltool \ --as i386-mingw32msvc-as \ --target i386-mingw32 \ -dllname tclsqlite.dll -lmsvcrt *.o $TCLSTUBLIB i386-mingw32msvc-strip tclsqlite.dll |
︙ | |||
129 130 131 132 133 134 135 | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | + - + - - - - + - - + - - + + + - - - - + - + - - + + - - - - - - - - - - | --def sqlite.def -v --export-all \ --driver-name i386-mingw32msvc-gcc \ --dlltool-name i386-mingw32msvc-dlltool \ --as i386-mingw32msvc-as \ --target i386-mingw32 \ -dllname sqlite.dll -lmsvcrt *.o i386-mingw32msvc-strip sqlite.dll zip ../doc/tclsqlite-$VERSW.zip tclsqlite.dll |
Changes to src/attach.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | /* ** 2003 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the ATTACH and DETACH commands. ** |
︙ | |||
133 134 135 136 137 138 139 140 141 142 143 144 145 | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | + + - - - + + + - - - + + + + | ** ** The pDbname argument is the name of the database in the DETACH statement. */ void sqliteDetach(Parse *pParse, Token *pDbname){ int i; sqlite *db; Vdbe *v; Db *pDb; v = sqliteGetVdbe(pParse); sqliteVdbeAddOp(v, OP_Halt, 0, 0); if( pParse->explain ) return; db = pParse->db; for(i=0; i<db->nDb; i++){ pDb = &db->aDb[i]; |
︙ |
Changes to src/auth.c.
︙ | |||
10 11 12 13 14 15 16 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - + | ** ************************************************************************* ** This file contains code used to implement the sqlite_set_authorizer() ** API. This facility is an optional feature of the library. Embedded ** systems that do not need this facility may omit it by recompiling ** the library with -DSQLITE_OMIT_AUTHORIZATION=1 ** |
︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | + - + - - - + + | ){ sqlite *db = pParse->db; int rc; Table *pTab; /* The table being read */ 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 ); for(iSrc=0; iSrc<pTabList->nSrc; iSrc++){ if( pExpr->iTable==pTabList->a[iSrc].iCursor ) break; } if( iSrc>=0 && iSrc<pTabList->nSrc ){ pTab = pTabList->a[iSrc].pTab; |
︙ | |||
170 171 172 173 174 175 176 | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | - + | const char *zArg1, const char *zArg2, const char *zArg3 ){ sqlite *db = pParse->db; int rc; |
︙ |
Changes to src/btree_rb.c.
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - + | /* ** 2003 Feb 4 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* |
︙ | |||
307 308 309 310 311 312 313 | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | - + | * Print a representation of a node to stdout. This function is only included * so you can call it from within a debugger if things get really bad. It * is not called from anyplace in the code. */ static void print_node(BtRbNode *pNode) { char * str = append_node(0, pNode, 0); |
︙ |
Changes to src/build.c.
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + | ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** PRAGMA ** |
︙ | |||
1030 1031 1032 1033 1034 1035 1036 | 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | - + | ** the end. */ sEnd = pParse->sLastToken; if( sEnd.z[0]!=0 && sEnd.z[0]!=';' ){ sEnd.z += sEnd.n; } sEnd.n = 0; |
︙ | |||
1533 1534 1535 1536 1537 1538 1539 | 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 | - + - + | ** If pName==0 it means that we are ** dealing with a primary key or UNIQUE constraint. We have to invent our ** own name. */ if( pName && !db->init.busy ){ Index *pISameName; /* Another index with the same name */ Table *pTSameName; /* A table with same name as the index */ |
︙ |
Changes to src/date.c.
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - + | ** This file contains the C functions that implement date and time ** functions for SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** |
︙ | |||
796 797 798 799 800 801 802 | 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | - + - + + + - + - + - + | sprintf(&z[j],"%02d.%03d",s,ms); j += strlen(&z[j]); break; } case 'H': sprintf(&z[j],"%02d",x.h); j+=2; break; case 'W': /* Fall thru */ case 'j': { |
︙ | |||
843 844 845 846 847 848 849 850 851 852 853 854 855 | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 | + - - + | /* ** This function registered all of the above C functions as SQL ** functions. This should be the only routine in this file with ** external linkage. */ void sqliteRegisterDateTimeFunctions(sqlite *db){ #ifndef SQLITE_OMIT_DATETIME_FUNCS static struct { char *zName; int nArg; int dataType; void (*xFunc)(sqlite_func*,int,const char**); } aFuncs[] = { |
Changes to src/expr.c.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** |
︙ | |||
120 121 122 123 124 125 126 | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | - + | Expr *sqliteExprDup(Expr *p){ Expr *pNew; if( p==0 ) return 0; pNew = sqliteMallocRaw( sizeof(*p) ); if( pNew==0 ) return 0; memcpy(pNew, p, sizeof(*pNew)); if( p->token.z!=0 ){ |
︙ | |||
151 152 153 154 155 156 157 | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | - + + + + | struct ExprList_item *pItem; int i; if( p==0 ) return 0; pNew = sqliteMalloc( sizeof(*pNew) ); if( pNew==0 ) return 0; pNew->nExpr = pNew->nAlloc = p->nExpr; pNew->a = pItem = sqliteMalloc( p->nExpr*sizeof(p->a[0]) ); |
︙ |
Changes to src/func.c.
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - + | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** |
︙ | |||
153 154 155 156 157 158 159 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | - + - + - + - + | sqlite_set_result_string(context, zBuf, -1); } /* ** Implementation of the upper() and lower() SQL functions. */ static void upperFunc(sqlite_func *context, int argc, const char **argv){ |
︙ | |||
513 514 515 516 517 518 519 520 521 522 523 524 525 526 | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | + + - + - + - + - + - + - + | */ static void minmaxStep(sqlite_func *context, int argc, const char **argv){ MinMaxCtx *p; int (*xCompare)(const char*, const char*); int mask; /* 0 for min() or 0xffffffff for max() */ assert( argc==2 ); if( argv[0]==0 ) return; /* Ignore NULL values */ if( argv[1][0]=='n' ){ xCompare = sqliteCompare; }else{ xCompare = strcmp; } mask = (int)sqlite_user_data(context); assert( mask==0 || mask==-1 ); p = sqlite_aggregate_context(context, sizeof(*p)); |
︙ | |||
617 618 619 620 621 622 623 | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | - + + + + + + - + + + + + + | { "stddev", 1, SQLITE_NUMERIC, 0, stdDevStep, stdDevFinalize }, #endif }; static const char *azTypeFuncs[] = { "min", "max", "typeof" }; int i; for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){ |
︙ |
Changes to src/main.c.
︙ | |||
10 11 12 13 14 15 16 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - + | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** |
︙ | |||
185 186 187 188 189 190 191 | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | - + + + + | ** indicate success or failure. */ static int sqliteInitOne(sqlite *db, int iDb, char **pzErrMsg){ int rc; BtCursor *curMain; int size; Table *pTab; |
︙ | |||
212 213 214 215 216 217 218 | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | - - - + + + - - - - - + - - - - - + - - + + - - + - - - - + + - - - - - - + + - - + - + - + - - + + - + - - - - - - - - + - | " name text,\n" " tbl_name text,\n" " rootpage integer,\n" " sql text\n" ")" ; |
︙ | |||
316 317 318 319 320 321 322 | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | - + - - - - + + + + + + + + + + + + + + + + + + + - - - - + + + + + + - - + + - - - | /* This happens if the database was initially empty */ db->file_format = 4; }else if( db->file_format>4 ){ sqliteBtreeCloseCursor(curMain); sqliteSetString(pzErrMsg, "unsupported file format", (char*)0); return SQLITE_ERROR; } |
︙ | |||
387 388 389 390 391 392 393 | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | - + - + + + + + + + + + + + + | int i, rc; if( db->init.busy ) return SQLITE_OK; assert( (db->flags & SQLITE_Initialized)==0 ); rc = SQLITE_OK; db->init.busy = 1; for(i=0; rc==SQLITE_OK && i<db->nDb; i++){ |
︙ | |||
865 866 867 868 869 870 871 | 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | - + - + | ){ #if SQLITE_MIN_SLEEP_MS==1 static const char delays[] = { 1, 2, 5, 10, 15, 20, 25, 25, 25, 50, 50, 50, 100}; static const short int totals[] = { 0, 1, 3, 8, 18, 33, 53, 78, 103, 128, 178, 228, 287}; # define NDELAY (sizeof(delays)/sizeof(delays[0])) |
︙ | |||
935 936 937 938 939 940 941 | 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | - + | /* ** This routine installs a default busy handler that waits for the ** specified number of milliseconds before returning 0. */ void sqlite_busy_timeout(sqlite *db, int ms){ if( ms>0 ){ |
︙ |
Changes to src/os.c.
︙ | |||
460 461 462 463 464 465 466 467 468 469 470 471 472 473 | 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | + + + + + | int *pReadonly ){ #if OS_UNIX int rc; id->dirfd = -1; id->fd = open(zFilename, O_RDWR|O_CREAT|O_LARGEFILE|O_BINARY, 0644); if( id->fd<0 ){ #ifdef EISDIR if( errno==EISDIR ){ return SQLITE_CANTOPEN; } #endif id->fd = open(zFilename, O_RDONLY|O_LARGEFILE|O_BINARY); if( id->fd<0 ){ return SQLITE_CANTOPEN; } *pReadonly = 1; }else{ *pReadonly = 0; |
︙ | |||
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 | 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 | + + + + + + + + + + | return SQLITE_CANTOPEN; } TRACE3("OPENDIR %-3d %s\n", id->dirfd, zDirname); #endif return SQLITE_OK; } /* ** If the following global variable points to a string which is the ** name of a directory, then that directory will be used to store ** temporary files. */ const char *sqlite_temp_directory = 0; /* ** Create a temporary file name in zBuf. zBuf must be big enough to ** hold at least SQLITE_TEMPNAME_SIZE characters. */ int sqliteOsTempFileName(char *zBuf){ #if OS_UNIX static const char *azDirs[] = { 0, "/var/tmp", "/usr/tmp", "/tmp", ".", }; static unsigned char zChars[] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789"; int i, j; struct stat buf; const char *zDir = "."; azDirs[0] = sqlite_temp_directory; for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){ if( azDirs[i]==0 ) continue; if( stat(azDirs[i], &buf) ) continue; if( !S_ISDIR(buf.st_mode) ) continue; if( access(azDirs[i], 07) ) continue; zDir = azDirs[i]; break; } do{ |
︙ | |||
811 812 813 814 815 816 817 818 | 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | + + - - - + + + + + + + - + + + + - + + - + + + - + | #endif #if OS_WIN static char zChars[] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789"; int i, j; const char *zDir; char zTempPath[SQLITE_TEMPNAME_SIZE]; if( sqlite_temp_directory==0 ){ |
︙ | |||
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 | 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 | + + + + | return SQLITE_IOERR; }else{ return SQLITE_OK; } } #endif } #ifdef SQLITE_NOSYNC # define fsync(X) 0 #endif /* ** Make sure all writes to a particular file are committed to disk. ** ** Under Unix, also make sure that the directory entry for the file ** has been created by fsync-ing the directory that contains the file. ** If we do not do this and we encounter a power failure, the directory |
︙ | |||
1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 | 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 | + | char *sqliteOsFullPathname(const char *zRelative){ #if OS_UNIX char *zFull = 0; if( zRelative[0]=='/' ){ sqliteSetString(&zFull, zRelative, (char*)0); }else{ char zBuf[5000]; zBuf[0] = 0; sqliteSetString(&zFull, getcwd(zBuf, sizeof(zBuf)), "/", zRelative, (char*)0); } return zFull; #endif #if OS_WIN char *zNotUsed; |
︙ |
Changes to src/pager.c.
︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | - + | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** |
︙ | |||
1925 1926 1927 1928 1929 1930 1931 | 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 | - + | ** of the dont_rollback() call. */ void sqlitepager_dont_write(Pager *pPager, Pgno pgno){ PgHdr *pPg; pPg = pager_lookup(pPager, pgno); pPg->alwaysRollback = 1; |
︙ |
Changes to src/printf.c.
︙ | |||
223 224 225 226 227 228 229 230 231 232 233 234 235 236 | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | + | double rounder; /* Used for rounding floating point values */ etByte flag_dp; /* True if decimal point should be shown */ etByte flag_rtz; /* True if trailing zeros should be removed */ etByte flag_exp; /* True to force display of the exponent */ int nsd; /* Number of significant digits returned */ #endif func(arg,"",0); count = length = 0; bufpt = 0; for(; (c=(*fmt))!=0; ++fmt){ if( c!='%' ){ int amt; bufpt = (char *)fmt; amt = 1; |
︙ | |||
669 670 671 672 673 674 675 | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | - - - + + + + + | memcpy(pM->zText, pM->zBase, pM->nChar); } }else{ pM->zText = pM->xRealloc(pM->zText, pM->nAlloc); } } } |
︙ |
Changes to src/select.c.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** |
︙ | |||
359 360 361 362 363 364 365 366 367 368 369 370 371 372 | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | + + + + + + + + + + + + + + + + + + + + + + + + | if( zType==0 ) return; for(i=0; i<nColumn; i++){ zType[i] = sqliteExprType(pEList->a[i].pExpr)==SQLITE_SO_NUM ? 'n' : 't'; } zType[i] = 0; sqliteVdbeChangeP3(v, -1, zType, P3_DYNAMIC); } /* ** Add code to implement the OFFSET and LIMIT */ static void codeLimiter( Vdbe *v, /* Generate code into this VM */ Select *p, /* The SELECT statement being coded */ int iContinue, /* Jump here to skip the current record */ int iBreak, /* Jump here to end the loop */ int nPop /* Number of times to pop stack when jumping */ ){ if( p->iOffset>=0 ){ int addr = sqliteVdbeCurrentAddr(v) + 2; if( nPop>0 ) addr++; sqliteVdbeAddOp(v, OP_MemIncr, p->iOffset, addr); if( nPop>0 ){ sqliteVdbeAddOp(v, OP_Pop, nPop, 0); } sqliteVdbeAddOp(v, OP_Goto, 0, iContinue); } if( p->iLimit>=0 ){ sqliteVdbeAddOp(v, OP_MemIncr, p->iLimit, iBreak); } } /* ** This routine generates the code for the inside of the inner loop ** of a SELECT. ** ** If srcTab and nColumn are both zero, then the pEList expressions ** are evaluated in order to get the data for this row. If nColumn>0 |
︙ | |||
384 385 386 387 388 389 390 391 392 393 394 395 396 397 | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | + + - + - - - - + - - - - - + + + + | int eDest, /* How to dispose of the results */ int iParm, /* An argument to the disposal method */ int iContinue, /* Jump here to continue with next row */ int iBreak /* Jump here to break out of the inner loop */ ){ Vdbe *v = pParse->pVdbe; int i; int hasDistinct; /* True if the DISTINCT keyword is present */ if( v==0 ) return 0; assert( pEList!=0 ); /* If there was a LIMIT clause on the SELECT statement, then do the check ** to see if this row should be output. */ hasDistinct = distinct>=0 && pEList && pEList->nExpr>0; |
︙ | |||
566 567 568 569 570 571 572 | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | - - - - - - + - - | ){ int end1 = sqliteVdbeMakeLabel(v); int end2 = sqliteVdbeMakeLabel(v); int addr; if( eDest==SRT_Sorter ) return; sqliteVdbeAddOp(v, OP_Sort, 0, 0); addr = sqliteVdbeAddOp(v, OP_SortNext, 0, end1); |
︙ | |||
806 807 808 809 810 811 812 | 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 | - + + | } } }else if( p->span.z && p->span.z[0] ){ sqliteSetNString(&pTab->aCol[i].zName, p->span.z, p->span.n, 0); }else{ char zBuf[30]; sprintf(zBuf, "column%d", i+1); |
︙ | |||
939 940 941 942 943 944 945 | 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | - + - + - + - + - - + | pNew->a[pNew->nExpr-1].zName = a[k].zName; a[k].pExpr = 0; a[k].zName = 0; }else{ /* This expression is a "*" or a "TABLE.*" and needs to be ** expanded. */ int tableSeen = 0; /* Set to 1 when TABLE matches */ |
︙ | |||
998 999 1000 1001 1002 1003 1004 | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 | - - + + + | pExpr = pRight; pExpr->span = pExpr->token; } pNew = sqliteExprListAppend(pNew, pExpr, 0); } } if( !tableSeen ){ |
︙ | |||
1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 | 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 | + + + + + + | } cont = sqliteVdbeMakeLabel(v); if( pIdx==0 ){ sqliteVdbeAddOp(v, seekOp, base, 0); }else{ sqliteVdbeAddOp(v, OP_Integer, pIdx->iDb, 0); sqliteVdbeOp3(v, OP_OpenRead, base+1, pIdx->tnum, pIdx->zName, P3_STATIC); if( seekOp==OP_Rewind ){ sqliteVdbeAddOp(v, OP_String, 0, 0); sqliteVdbeAddOp(v, OP_MakeKey, 1, 0); sqliteVdbeAddOp(v, OP_IncrKey, 0, 0); seekOp = OP_MoveTo; } sqliteVdbeAddOp(v, seekOp, base+1, 0); sqliteVdbeAddOp(v, OP_IdxRecno, base+1, 0); sqliteVdbeAddOp(v, OP_Close, base+1, 0); sqliteVdbeAddOp(v, OP_MoveTo, base, 0); } eList.nExpr = 1; memset(&eListItem, 0, sizeof(eListItem)); |
︙ |
Changes to src/shell.c.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** |
︙ | |||
587 588 589 590 591 592 593 | 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | - + - + | char *zErrMsg = 0; open_db(p); fprintf(p->out, "BEGIN TRANSACTION;\n"); if( nArg==1 ){ sqlite_exec(p->db, "SELECT name, type, sql FROM sqlite_master " "WHERE type!='meta' AND sql NOT NULL " |
︙ |
Changes to src/sqlite.h.in.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | - + + + + - + + | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This header file defines the interface that the SQLite library ** presents to client programs. ** |
︙ | |||
475 476 477 478 479 480 481 | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | - + + + + + + + + + + + + + + + | */ int sqlite_function_type( sqlite *db, /* The database there the function is registered */ const char *zName, /* Name of the function */ int datatype /* The datatype for this function */ ); #define SQLITE_NUMERIC (-1) |
︙ |
Changes to src/sqliteInt.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** |
︙ | |||
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | + + + + | */ #ifndef UINT32_TYPE # define UINT32_TYPE unsigned int #endif #ifndef UINT16_TYPE # define UINT16_TYPE unsigned short int #endif #ifndef INT16_TYPE # define INT16_TYPE short int #endif #ifndef UINT8_TYPE # define UINT8_TYPE unsigned char #endif #ifndef INT8_TYPE # define INT8_TYPE signed char #endif #ifndef INTPTR_TYPE # if SQLITE_PTR_SZ==4 # define INTPTR_TYPE int # else # define INTPTR_TYPE long long # endif #endif typedef UINT32_TYPE u32; /* 4-byte unsigned integer */ typedef UINT16_TYPE u16; /* 2-byte unsigned integer */ typedef INT16_TYPE i16; /* 2-byte signed integer */ typedef UINT8_TYPE u8; /* 1-byte unsigned integer */ typedef UINT8_TYPE i8; /* 1-byte signed integer */ typedef INTPTR_TYPE ptr; /* Big enough to hold a pointer */ typedef unsigned INTPTR_TYPE uptr; /* Big enough to hold a pointer */ /* ** Defer sourcing vdbe.h until after the "u8" typedef is defined. |
︙ | |||
758 759 760 761 762 763 764 | 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | - - + + | ** With the addition of multiple database support, the following structure ** can also be used to describe a particular table such as the table that ** is modified by an INSERT, DELETE, or UPDATE statement. In standard SQL, ** such a table must be a simple name: ID. But in SQLite, the table can ** now be identified by a database name, a dot, then the table name: ID.ID. */ struct SrcList { |
︙ | |||
1112 1113 1114 1115 1116 1117 1118 | 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 | - + | void *sqliteRealloc(void*,int); char *sqliteStrDup(const char*); char *sqliteStrNDup(const char*, int); # define sqliteCheckMemory(a,b) #endif char *sqliteMPrintf(const char*, ...); char *sqliteVMPrintf(const char*, va_list); |
︙ |
Changes to src/table.c.
︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - + | typedef struct TabResult { char **azResult; char *zErrMsg; int nResult; int nAlloc; int nRow; int nColumn; |
︙ | |||
192 193 194 195 196 197 198 | 192 193 194 195 196 197 198 199 200 201 202 203 | - + | void sqlite_free_table( char **azResult /* Result returned from from sqlite_get_table() */ ){ if( azResult ){ int i, n; azResult--; if( azResult==0 ) return; |
Changes to src/tclsqlite.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** A TCL Interface to SQLite ** |
︙ | |||
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 | 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 | + + + + + - + + - + | ** If compiled using mktclapp, this routine runs to initialize ** everything. */ int Et_AppInit(Tcl_Interp *interp){ return Sqlite_Init(interp); } #endif /*************************************************************************** ** The remaining code is only included if the TCLSH macro is defined to ** be an integer greater than 0 */ #if defined(TCLSH) && TCLSH>0 /* ** If the macro TCLSH is defined and is one, then put in code for the |
︙ | |||
1189 1190 1191 1192 1193 1194 1195 1196 | 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 | + - - - + - - + + + + + - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + | "}\n" "set line {}\n" "} else {\n" "append line \\n\n" "}\n" "}\n" ; #endif /* TCLSH==1 */ |
Changes to src/test1.c.
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | - + | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the printf() interface to SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** |
︙ | |||
971 972 973 974 975 976 977 978 979 980 981 982 983 984 | 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 | + | ** Register commands with the TCL interpreter. */ int Sqlitetest1_Init(Tcl_Interp *interp){ extern int sqlite_search_count; extern int sqlite_interrupt_count; extern int sqlite_open_file_count; extern int sqlite_current_time; extern int sqlite_temp_directory; static struct { char *zName; Tcl_CmdProc *xProc; } aCmd[] = { { "sqlite_mprintf_int", (Tcl_CmdProc*)sqlite_mprintf_int }, { "sqlite_mprintf_str", (Tcl_CmdProc*)sqlite_mprintf_str }, { "sqlite_mprintf_double", (Tcl_CmdProc*)sqlite_mprintf_double }, |
︙ | |||
1016 1017 1018 1019 1020 1021 1022 1023 1024 | 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | + + | (char*)&sqlite_interrupt_count, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_open_file_count", (char*)&sqlite_open_file_count, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_current_time", (char*)&sqlite_current_time, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_static_bind_value", (char*)&sqlite_static_bind_value, TCL_LINK_STRING); Tcl_LinkVar(interp, "sqlite_temp_directory", (char*)&sqlite_temp_directory, TCL_LINK_STRING); return TCL_OK; } |
Changes to src/update.c.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | - + - + + + + | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle UPDATE statements. ** |
︙ | |||
244 245 246 247 248 249 250 | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | + + + + - + | */ sqliteVdbeAddOp(v, OP_OpenPseudo, oldIdx, 0); sqliteVdbeAddOp(v, OP_OpenPseudo, newIdx, 0); /* The top of the update loop for when there are triggers. */ sqliteVdbeAddOp(v, OP_ListRewind, 0, 0); sqliteVdbeAddOp(v, OP_StackDepth, 0, 0); sqliteVdbeAddOp(v, OP_MemStore, iStackDepth, 1); loopStart = sqliteVdbeAddOp(v, OP_MemLoad, iStackDepth, 0); sqliteVdbeAddOp(v, OP_StackReset, 0, 0); |
︙ | |||
291 292 293 294 295 296 297 | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | - + | if( !isView ){ sqliteVdbeAddOp(v, OP_Close, iCur, 0); } /* Fire the BEFORE and INSTEAD OF triggers */ if( sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_BEFORE, pTab, |
︙ | |||
332 333 334 335 336 337 338 | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | - + - + | ** the old data for each record to be updated because some columns ** might not change and we will need to copy the old value. ** Also, the old data is needed to delete the old index entires. ** So make the cursor point at the old record. */ if( !row_triggers_exist ){ sqliteVdbeAddOp(v, OP_ListRewind, 0, 0); |
︙ | |||
364 365 366 367 368 369 370 | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | - + | sqliteExprCode(pParse, pChanges->a[j].pExpr); } } /* Do constraint checks */ sqliteGenerateConstraintChecks(pParse, pTab, iCur, aIdxUsed, chngRecno, 1, |
︙ | |||
400 401 402 403 404 405 406 | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | - + - - + + | if( openAll || aIdxUsed[i] ) sqliteVdbeAddOp(v, OP_Close, iCur+i+1, 0); } sqliteVdbeAddOp(v, OP_Close, iCur, 0); pParse->nTab = iCur; } if( sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_AFTER, pTab, |
︙ |
Changes to src/util.c.
︙ | |||
10 11 12 13 14 15 16 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - + | ** ************************************************************************* ** Utility functions used throughout sqlite. ** ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** |
︙ | |||
326 327 328 329 330 331 332 | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | - + - - + + - - - + + | /* ** Create a string from the 2nd and subsequent arguments (up to the ** first NULL argument), store the string in memory obtained from ** sqliteMalloc() and make the pointer indicated by the 1st argument ** point to that string. The 1st argument must either be NULL or ** point to memory obtained from sqliteMalloc(). */ |
︙ | |||
500 501 502 503 504 505 506 | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | - + - + | ** there is no consistency, we will define our own. */ int sqliteStrICmp(const char *zLeft, const char *zRight){ register unsigned char *a, *b; a = (unsigned char *)zLeft; b = (unsigned char *)zRight; while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; } |
︙ |
Changes to src/vacuum.c.
︙ | |||
10 11 12 13 14 15 16 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - + | ** ************************************************************************* ** This file contains code used to implement the VACUUM command. ** ** Most of the code in this file may be omitted by defining the ** SQLITE_OMIT_VACUUM macro. ** |
︙ | |||
159 160 161 162 163 164 165 | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | - - - - - - - - - - - - - - - - - - | sqlite_freemem(zErrMsg); } } if( rc!=SQLITE_ABORT ) p->rc = rc; return rc; } |
︙ | |||
222 223 224 225 226 227 228 | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | - - - - - - - - + + + | char *zTemp = 0; /* a temporary file in same directory as zFilename */ sqlite *dbNew = 0; /* The new vacuumed database */ int rc = SQLITE_OK; /* Return code from service routines */ int i; /* Loop counter */ char *zErrMsg; /* Error message */ vacuumStruct sVac; /* Information passed to callbacks */ |
︙ | |||
276 277 278 279 280 281 282 | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | - - - - - - - + + + + + + + + + + + + + + + - + | if( (rc = execsql(pzErrMsg, dbNew, "PRAGMA synchronous=off; BEGIN"))!=0 ){ goto end_of_vacuum; } sVac.dbOld = db; sVac.dbNew = dbNew; sVac.pzErrMsg = pzErrMsg; |
Changes to src/vdbe.c.
︙ | |||
39 40 41 42 43 44 45 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | - + - + | ** ** 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. ** |
︙ | |||
2933 2934 2935 2936 2937 2938 2939 | 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 | - - + - | assert( pNos->flags & MEM_Int ); nKey = sizeof(int); iKey = intToKey(pNos->i); zKey = (char*)&iKey; if( pOp->p2 & OPFLAG_NCHANGE ) db->nChange++; if( pOp->p2 & OPFLAG_LASTROWID ) db->lastRowid = pNos->i; if( pOp->p2 & OPFLAG_CSCHANGE ) db->csChange++; |
︙ | |||
4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 | 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 | + + + + | pTos++; pMem = &pFocus->aMem[i]; *pTos = *pMem; if( pTos->flags & MEM_Str ){ pTos->flags &= ~(MEM_Dyn|MEM_Static|MEM_Short); pTos->flags |= MEM_Ephem; } if( pTos->flags & MEM_AggCtx ){ Release(pTos); pTos->flags = MEM_Null; } break; } /* Opcode: AggNext * P2 * ** ** Make the next aggregate value the current aggregate. The prior ** aggregate is deleted. If all aggregate values have been consumed, |
︙ | |||
4691 4692 4693 4694 4695 4696 4697 | 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 | - - + + + | if( pOp->opcode==OP_SetFirst ){ pSet->prev = sqliteHashFirst(&pSet->hash); if( pSet->prev==0 ){ pc = pOp->p2 - 1; break; } }else{ |
︙ | |||
4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 | 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | */ case OP_Vacuum: { if( sqliteSafetyOff(db) ) goto abort_due_to_misuse; rc = sqliteRunVacuum(&p->zErrMsg, db); if( sqliteSafetyOn(db) ) goto abort_due_to_misuse; break; } /* Opcode: StackDepth * * * ** ** Push an integer onto the stack which is the depth of the stack prior ** to that integer being pushed. */ case OP_StackDepth: { int depth = (&pTos[1]) - p->aStack; pTos++; pTos->i = depth; pTos->flags = MEM_Int; break; } /* Opcode: StackReset * * * ** ** Pop a single integer off of the stack. Then pop the stack ** as many times as necessary to get the depth of the stack down ** to the value of the integer that was popped. */ case OP_StackReset: { int depth, goal; assert( pTos>=p->aStack ); Integerify(pTos); goal = pTos->i; depth = (&pTos[1]) - p->aStack; assert( goal<depth ); popStack(&pTos, depth-goal); break; } /* An other opcode is illegal... */ default: { sqlite_snprintf(sizeof(zBuf),zBuf,"%d",pOp->opcode); sqliteSetString(&p->zErrMsg, "unknown opcode ", zBuf, (char*)0); rc = SQLITE_INTERNAL; |
︙ | |||
4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 | 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 | + | } #endif } /* The end of the for(;;) loop the loops through opcodes */ /* If we reach this point, it means that execution is finished. */ vdbe_halt: CHECK_FOR_INTERRUPT if( rc ){ p->rc = rc; rc = SQLITE_ERROR; }else{ rc = SQLITE_DONE; } p->magic = VDBE_MAGIC_HALT; |
︙ |
Changes to src/vdbeaux.c.
︙ | |||
507 508 509 510 511 512 513 | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | - + | /* ** Print a single opcode. This routine is used for debugging only. */ void sqliteVdbePrintOp(FILE *pOut, int pc, Op *pOp){ char *zP3; char zPtr[40]; if( pOp->p3type==P3_POINTER ){ |
︙ | |||
561 562 563 564 565 566 567 | 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | - + | rc = SQLITE_ERROR; sqliteSetString(&p->zErrMsg, sqlite_error_string(p->rc), (char*)0); }else{ sprintf(p->zArgv[0],"%d",i); sprintf(p->zArgv[2],"%d", p->aOp[i].p1); sprintf(p->zArgv[3],"%d", p->aOp[i].p2); if( p->aOp[i].p3type==P3_POINTER ){ |
︙ |
Changes to src/where.c.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. ** |
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - + | ** are being used, so we assign a single bit in a 32-bit word to track ** that cursor. Then a 32-bit integer is able to show the set of all ** cursors being used. */ typedef struct ExprMaskSet ExprMaskSet; struct ExprMaskSet { int n; /* Number of assigned cursor values */ |
︙ | |||
119 120 121 122 123 124 125 | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | - + + + | ** sets their opcodes to TK_COLUMN and their Expr.iTable fields to ** the VDBE cursor number of the table. */ static int exprTableUsage(ExprMaskSet *pMaskSet, Expr *p){ unsigned int mask = 0; if( p==0 ) return 0; if( p->op==TK_COLUMN ){ |
︙ | |||
264 265 266 267 268 269 270 271 272 273 274 275 276 277 | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } } if( pMatch && pbRev ){ *pbRev = sortOrder==SQLITE_SO_DESC; } return pMatch; } /* ** Disable a term in the WHERE clause. Except, do not disable the term ** if it controls a LEFT OUTER JOIN and it did not originate in the ON ** or USING clause of that join. ** ** Consider the term t2.z='ok' in the following queries: ** ** (1) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x WHERE t2.z='ok' ** (2) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok' ** (3) SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok' ** ** The t2.z='ok' is disabled in the in (2) because it did not originate ** in the ON clause. The term is disabled in (3) because it is not part ** of a LEFT OUTER JOIN. In (1), the term is not disabled. ** ** Disabling a term causes that term to not be tested in the inner loop ** of the join. Disabling is an optimization. We would get the correct ** results if nothing were ever disabled, but joins might run a little ** slower. The trick is to disable as much as we can without disabling ** too much. If we disabled in (1), we'd get the wrong answer. ** See ticket #813. */ static void disableTerm(WhereLevel *pLevel, Expr **ppExpr){ Expr *pExpr = *ppExpr; if( pLevel->iLeftJoin==0 || ExprHasProperty(pExpr, EP_FromJoin) ){ *ppExpr = 0; } } /* ** Generate the beginning of the loop used for WHERE clause processing. ** The return value is a pointer to an (opaque) structure that contains ** information needed to terminate the loop. Later, the calling routine ** should invoke sqliteWhereEnd() with the return value of this function ** in order to complete the WHERE clause processing. |
︙ | |||
732 733 734 735 736 737 738 | 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | - + | pLevel->inP2 = sqliteVdbeAddOp(v, OP_FullKey, pX->iTable, 0); pLevel->inOp = OP_Next; pLevel->inP1 = pX->iTable; } }else{ sqliteExprCode(pParse, aExpr[k].p->pLeft); } |
︙ | |||
756 757 758 759 760 761 762 | 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 | - + - + - + | if( pX==0 ) continue; if( aExpr[k].idxLeft==iCur && (aExpr[k].prereqRight & loopMask)==aExpr[k].prereqRight && pX->pLeft->iColumn==pIdx->aiColumn[j] ){ if( pX->op==TK_EQ ){ sqliteExprCode(pParse, pX->pRight); |
︙ | |||
850 851 852 853 854 855 856 | 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | - + | sqliteExprCode(pParse, aExpr[k].p->pRight); }else{ sqliteExprCode(pParse, aExpr[k].p->pLeft); } sqliteVdbeAddOp(v, OP_ForceInt, aExpr[k].p->op==TK_LT || aExpr[k].p->op==TK_GT, brk); sqliteVdbeAddOp(v, OP_MoveTo, iCur, brk); |
︙ | |||
872 873 874 875 876 877 878 | 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 | - + | pLevel->iMem = pParse->nMem++; sqliteVdbeAddOp(v, OP_MemStore, pLevel->iMem, 1); if( aExpr[k].p->op==TK_LT || aExpr[k].p->op==TK_GT ){ testOp = OP_Ge; }else{ testOp = OP_Gt; } |
︙ | |||
927 928 929 930 931 932 933 | 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 | - + - + | if( aExpr[k].p==0 ) continue; if( aExpr[k].idxLeft==iCur && aExpr[k].p->op==TK_EQ && (aExpr[k].prereqRight & loopMask)==aExpr[k].prereqRight && aExpr[k].p->pLeft->iColumn==pIdx->aiColumn[j] ){ sqliteExprCode(pParse, aExpr[k].p->pRight); |
︙ | |||
973 974 975 976 977 978 979 | 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 | - + - + | if( aExpr[k].idxLeft==iCur && (pExpr->op==TK_LT || pExpr->op==TK_LE) && (aExpr[k].prereqRight & loopMask)==aExpr[k].prereqRight && pExpr->pLeft->iColumn==pIdx->aiColumn[j] ){ sqliteExprCode(pParse, pExpr->pRight); leFlag = pExpr->op==TK_LE; |
︙ | |||
1032 1033 1034 1035 1036 1037 1038 | 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 | - + - + | if( aExpr[k].idxLeft==iCur && (pExpr->op==TK_GT || pExpr->op==TK_GE) && (aExpr[k].prereqRight & loopMask)==aExpr[k].prereqRight && pExpr->pLeft->iColumn==pIdx->aiColumn[j] ){ sqliteExprCode(pParse, pExpr->pRight); geFlag = pExpr->op==TK_GE; |
︙ |
Changes to test/auth.test.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # |
︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + + + + + + | } db authorizer ::auth catchsql {CREATE TABLE t1(a,b,c)} } {1 {not authorized}} do_test auth-1.1.2 { db errorcode } {23} do_test auth-1.1.3 { # Ticket #896. catchsql { SELECT x; } } {1 {no such column: x}} do_test auth-1.2 { execsql {SELECT name FROM sqlite_master} } {} do_test auth-1.3.1 { proc auth {code arg1 arg2 arg3 arg4} { if {$code=="SQLITE_CREATE_TABLE"} { set ::authargs [list $arg1 $arg2 $arg3 $arg4] |
︙ |
Changes to test/date.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | # 2003 October 31 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing date and time functions. # |
︙ | |||
91 92 93 94 95 96 97 | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | - + + + + + + + + + + + + + + | datetest 3.4 {strftime('%j','2003-10-31 12:34:56.432')} 304 datetest 3.5 {strftime('%J','2003-10-31 12:34:56.432')} 2452944.024264259 datetest 3.6 {strftime('%m','2003-10-31 12:34:56.432')} 10 datetest 3.7 {strftime('%M','2003-10-31 12:34:56.432')} 34 datetest 3.8 {strftime('%s','2003-10-31 12:34:56.432')} 1067603696 datetest 3.9 {strftime('%S','2003-10-31 12:34:56.432')} 56 datetest 3.10 {strftime('%w','2003-10-31 12:34:56.432')} 5 |
︙ |
Changes to test/func.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing built-in functions. # |
︙ | |||
260 261 262 263 264 265 266 267 268 269 270 271 272 273 | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | + + + + + | } {z+67890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP} do_test func-8.3 { execsql { CREATE TEMP TABLE t3 AS SELECT a FROM t2 ORDER BY a DESC; SELECT min('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3; } } {z+1abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP} do_test func-8.4 { execsql { SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3; } } {z+67890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP} # How do you test the random() function in a meaningful, deterministic way? # do_test func-9.1 { execsql { SELECT random() is not null; } |
︙ |
Changes to test/index.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE INDEX statement. # |
︙ | |||
510 511 512 513 514 515 516 517 518 | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | + + + + + + + + + + + + + + + | INSERT INTO t1 VALUES('+',9); INSERT INTO t1 VALUES('+12347.E+02',10); INSERT INTO t1 VALUES('+12347E+02',11); SELECT b FROM t1 ORDER BY a; } } {8 5 2 1 3 6 11 9 10 4 7} integrity_check index-15.1 # Drop index with a quoted name. Ticket #695. # do_test index-16.1 { execsql { CREATE INDEX "t6i2" ON t6(c); DROP INDEX "t6i2"; } } {} do_test index-16.2 { execsql { DROP INDEX "t6i1"; } } {} finish_test |
Changes to test/interrupt.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | # 2004 Feb 8 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is the sqlite_interrupt() API. # |
︙ | |||
33 34 35 36 37 38 39 | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | - + + - + - + - + - + - + | } # This routine attempts to execute the sql in $sql. It triggers an # interrupt a progressively later and later points during the processing # and checks to make sure SQLITE_INTERRUPT is returned. Eventually, # the routine completes successfully. # |
︙ | |||
157 158 159 160 161 162 163 164 165 | 158 159 160 161 162 163 164 165 166 167 | + | set max_count [expr {1000000-$sqlite_interrupt_count}] for {set i 1} {$i<$max_count-5} {incr i 1} { do_test interrupt-4.$i.1 { set ::sqlite_interrupt_count $::i catchsql $sql } {1 interrupted} } finish_test |
Added test/join3_28.test.
|
Added test/join4_28.test.
|
Changes to test/limit.test.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the LIMIT ... OFFSET ... clause # of SELECT statements. # |
︙ | |||
289 290 291 292 293 294 295 296 297 | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | + + + + + + + + + + + + + + + + + + + + | } {31} do_test limit-7.12 { execsql { SELECT a+27 FROM t6 INTERSECT SELECT x FROM t2 ORDER BY 1 DESC LIMIT 1 OFFSET 1; } } {30} # Tests for limit in conjunction with distinct. The distinct should # occur before both the limit and the offset. Ticket #749. # do_test limit-8.1 { execsql { SELECT DISTINCT round(x/100) FROM t3 LIMIT 5; } } {0 1 2 3 4} do_test limit-8.2 { execsql { SELECT DISTINCT round(x/100) FROM t3 LIMIT 5 OFFSET 5; } } {5 6 7 8 9} do_test limit-8.3 { execsql { SELECT DISTINCT round(x/100) FROM t3 LIMIT 5 OFFSET 25; } } {25 26 27 28 29} finish_test |
Changes to test/minmax.test.
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | - + | # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing SELECT statements that contain # aggregate min() and max() functions and which are handled as # as a special case. # |
︙ | |||
64 65 66 67 68 69 70 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | - + | do_test minmax-1.5 { execsql {CREATE INDEX t1i1 ON t1(x)} set sqlite_search_count 0 execsql {SELECT min(x) FROM t1} } {1} do_test minmax-1.6 { set sqlite_search_count |
︙ | |||
271 272 273 274 275 276 277 278 279 | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | do_test minmax-9.2 { execsql { SELECT max(rowid) FROM ( SELECT max(rowid) FROM t4 EXCEPT SELECT max(rowid) FROM t5 ) } } {{}} # If there is a NULL in an aggregate max() or min(), ignore it. An # aggregate min() or max() will only return NULL if all values are NULL. # do_test minmax-10.1 { execsql { CREATE TABLE t6(x); INSERT INTO t6 VALUES(1); INSERT INTO t6 VALUES(2); INSERT INTO t6 VALUES(NULL); SELECT coalesce(min(x),-1) FROM t6; } } {1} do_test minmax-10.2 { execsql { SELECT max(x) FROM t6; } } {2} do_test minmax-10.3 { execsql { CREATE INDEX i6 ON t6(x); SELECT coalesce(min(x),-1) FROM t6; } } {1} do_test minmax-10.4 { execsql { SELECT max(x) FROM t6; } } {2} do_test minmax-10.5 { execsql { DELETE FROM t6 WHERE x NOT NULL; SELECT count(*) FROM t6; } } 1 do_test minmax-10.6 { execsql { SELECT count(x) FROM t6; } } 0 do_test minmax-10.7 { execsql { SELECT (SELECT min(x) FROM t6), (SELECT max(x) FROM t6); } } {{} {}} do_test minmax-10.8 { execsql { SELECT min(x), max(x) FROM t6; } } {{} {}} do_test minmax-10.9 { execsql { INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; INSERT INTO t6 SELECT * FROM t6; SELECT count(*) FROM t6; } } 1024 do_test minmax-10.10 { execsql { SELECT count(x) FROM t6; } } 0 do_test minmax-10.11 { execsql { SELECT (SELECT min(x) FROM t6), (SELECT max(x) FROM t6); } } {{} {}} do_test minmax-10.12 { execsql { SELECT min(x), max(x) FROM t6; } } {{} {}} finish_test |
Changes to test/null.test.
︙ | |||
90 91 92 93 94 95 96 97 98 99 100 101 102 103 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | + | do_test null-2.8 { execsql { select ifnull(case c when b then 1 else 0 end, 99) from t1; } } {1 0 0 1 0 0 0} # Check to see that NULL values are ignored in aggregate functions. # (except for min().) # do_test null-3.1 { execsql { select count(*), count(b), count(c), sum(b), sum(c), avg(b), avg(c), min(b), max(b) from t1; } } {7 4 6 2 3 0.5 0.5 0 1} |
︙ |
Changes to test/select1.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the SELECT statement. # |
︙ | |||
608 609 610 611 612 613 614 | 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | - + + + + + + | } } {t3.a 1 t3.b 2 t4.a 3 t4.b 4} do_test select1-11.3 { execsql2 { SELECT * FROM t3 AS x, t4 AS y; } } {x.a 1 x.b 2 y.a 3 y.b 4} |
︙ |
Changes to test/tclsqlite.test.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - + | # This file implements regression tests for TCL interface to the # SQLite library. # # Actually, all tests are based on the TCL interface, so the main # interface is pretty well tested. This file contains some addition # tests for fringe issues that the main test suite does not cover. # |
︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | + + | } } msg] regsub {:.*$} $msg {} msg lappend v $msg } {1 {syntax error in expression "x*"}} if {[sqlite -encoding]=="UTF-8" && [sqlite -tcl-uses-utf]} { catch {unset ::result} do_test tcl-2.1 { execsql "CREATE TABLE t\u0123x(a int, b\u1235 float)" execsql "PRAGMA table_info(t\u0123x)" } "0 a int 0 {} 0 1 b\u1235 float 0 {} 0" do_test tcl-2.2 { execsql "INSERT INTO t\u0123x VALUES(1,2.3)" db eval "SELECT * FROM t\u0123x" result break set result(*) } "a b\u1235" } if {[sqlite -encoding]=="iso8859" && [sqlite -tcl-uses-utf]} { do_test tcl-2.1 { execsql "CREATE TABLE t\251x(a int, b\306 float)" execsql "PRAGMA table_info(t\251x)" } "0 a int 0 {} 0 1 b\306 float 0 {} 0" unset -nocomplain result do_test tcl-2.2 { execsql "INSERT INTO t\251x VALUES(1,2.3)" db eval "SELECT * FROM t\251x" result break set result(*) } "a b\306" } |
︙ |
Changes to test/trigger1.test.
︙ | |||
408 409 410 411 412 413 414 415 416 | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | do_test trigger-9.2 { execsql { INSERT INTO t3 VALUES(1,3); SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4; } } {1 2 1 3 99 99 1 3} execsql { DROP TABLE t2; DROP TABLE t3; DROP TABLE t4; } # Skip the remaining tests if we have a codec. The ATTACH command # will not work right on these tests when there is a codec. # if {[sqlite -has-codec]} { finish_test return } # Ticket #764. At one stage TEMP triggers would fail to re-install when the # schema was reloaded. The following tests ensure that TEMP triggers are # correctly re-installed. # # Also verify that references within trigger programs are resolved at # statement compile time, not trigger installation time. This means, for # example, that you can drop and re-create tables referenced by triggers. do_test trigger-10.0 { file delete -force test2.db file delete -force test2.db-journal sqlite db2 test2.db execsql {CREATE TABLE t3(a, b, c);} db2 db2 close execsql { ATTACH 'test2.db' AS aux; } } {} do_test trigger-10.1 { execsql { CREATE TABLE t1(a, b, c); CREATE temp TABLE t2(a, b, c); CREATE TABLE insert_log(db, a, b, c); } } {} do_test trigger-10.2 { execsql { CREATE TEMP TRIGGER trig1 AFTER INSERT ON t1 BEGIN INSERT INTO insert_log VALUES('main', new.a, new.b, new.c); END; CREATE TEMP TRIGGER trig2 AFTER INSERT ON t2 BEGIN INSERT INTO insert_log VALUES('temp', new.a, new.b, new.c); END; CREATE TEMP TRIGGER trig3 AFTER INSERT ON t3 BEGIN INSERT INTO insert_log VALUES('aux', new.a, new.b, new.c); END; } } {} do_test trigger-10.3 { execsql { INSERT INTO t1 VALUES(1, 2, 3); INSERT INTO t2 VALUES(4, 5, 6); INSERT INTO t3 VALUES(7, 8, 9); } } {} do_test trigger-10.4 { execsql { SELECT * FROM insert_log; } } {main 1 2 3 temp 4 5 6 aux 7 8 9} do_test trigger-10.5 { execsql { BEGIN; INSERT INTO t1 VALUES(1, 2, 3); INSERT INTO t2 VALUES(4, 5, 6); INSERT INTO t3 VALUES(7, 8, 9); ROLLBACK; } } {} do_test trigger-10.6 { execsql { SELECT * FROM insert_log; } } {main 1 2 3 temp 4 5 6 aux 7 8 9} do_test trigger-10.7 { execsql { DELETE FROM insert_log; INSERT INTO t1 VALUES(11, 12, 13); INSERT INTO t2 VALUES(14, 15, 16); INSERT INTO t3 VALUES(17, 18, 19); } } {} do_test trigger-10.8 { execsql { SELECT * FROM insert_log; } } {main 11 12 13 temp 14 15 16 aux 17 18 19} do_test trigger-10.8 { # Drop and re-create the insert_log table in a different database. Note # that we can change the column names because the trigger programs don't # use them explicitly. execsql { DROP TABLE insert_log; CREATE temp TABLE insert_log(db, d, e, f); } } {} do_test trigger-10.10 { execsql { INSERT INTO t1 VALUES(21, 22, 23); INSERT INTO t2 VALUES(24, 25, 26); INSERT INTO t3 VALUES(27, 28, 29); } } {} do_test trigger-10.11 { execsql { SELECT * FROM insert_log; } } {main 21 22 23 temp 24 25 26 aux 27 28 29} finish_test |
Changes to test/view.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | # 2002 February 26 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing VIEW statements. # |
︙ | |||
380 381 382 383 384 385 386 387 388 389 | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | + + + + + + + + + + + + + + + + + + | } } {5 1 4 2 3 4} do_test view-9.6 { execsql { SELECT * FROM v10 ORDER BY 1; } } {3 4 4 2 5 1} # Tables with columns having peculiar quoted names used in views # Ticket #756. # do_test view-10.1 { execsql { CREATE TABLE t3("9" integer, [4] text); INSERT INTO t3 VALUES(1,2); CREATE VIEW v_t3_a AS SELECT a.[9] FROM t3 AS a; CREATE VIEW v_t3_b AS SELECT "4" FROM t3; SELECT * FROM v_t3_a; } } {1} do_test view-10.2 { execsql { SELECT * FROM v_t3_b; } } {2} finish_test |
Changes to tool/lemon.c.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - - - - - - - | */ #include <stdio.h> #include <stdarg.h> #include <string.h> #include <ctype.h> #include <stdlib.h> |
︙ | |||
36 37 38 39 40 41 42 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | - | char *msort(); extern void *malloc(); /******** From the file "action.h" *************************************/ struct action *Action_new(); struct action *Action_sort(); |
︙ | |||
370 371 372 373 374 375 376 | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | - + | return rc; } /* Sort parser actions */ struct action *Action_sort(ap) struct action *ap; { |
︙ | |||
807 808 809 810 811 812 813 | 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | - + | /* Get a pointer to the state described by the basis configuration set ** constructed in the preceding loop */ newstp = getstate(lemp); /* The state "newstp" is reached from the state "stp" by a shift action ** on the symbol "sp" */ |
︙ | |||
908 909 910 911 912 913 914 | 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | - + | stp = lemp->sorted[i]; for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ for(j=0; j<lemp->nterminal; j++){ if( SetFind(cfp->fws,j) ){ /* Add a reduce action to the state "stp" which will reduce by the ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ |
︙ | |||
1184 1185 1186 1187 1188 1189 1190 | 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 | - + - + | } } return; } /* Sort the configuration list */ void Configlist_sort(){ |
︙ | |||
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 | 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 | + | printf(" %d states, %d parser table entries, %d conflicts\n", lem.nstate, lem.tablesize, lem.nconflict); } if( lem.nconflict ){ fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); } exit(lem.errorcnt + lem.nconflict); return (lem.errorcnt + lem.nconflict); } /******************** From the file "msort.c" *******************************/ /* ** A generic merge-sort program. ** ** USAGE: ** Let "ptr" be a pointer to some structure which is at the head of |
︙ | |||
2872 2873 2874 2875 2876 2877 2878 | 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 | - + + + | */ void emit_destructor_code(out,sp,lemp,lineno) FILE *out; struct symbol *sp; struct lemon *lemp; int *lineno; { |
︙ |
Added tool/spaceanal.tcl.