Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch branch-3.7.11 Excluding Merge-Ins
This is equivalent to a diff from 00bb9c9ce4 to f0f492245e
2017-07-21
| ||
07:45 | Add new interfaces sqlite3_result_pointer(), and sqlite3_value_pointer() and use them to transfer the eponymous FTS3 column pointer to the snippet() and offsets() routines. This changes is a cherry-pick of [f0f49224] with version-specific edits. That check-in was inspired by check-in [72de49f2]. (check-in: 69906880ce user: drh tags: branch-3.9.2) | |
03:23 | Add new interfaces sqlite3_result_pointer(), and sqlite3_value_pointer() and use them to transfer the eponymous FTS3 column pointer to the snippet() and offsets() routines. This is a cherry-pick of [f0f492245e95], which is in turn inspired by check-in [72de49f2]. (Leaf check-in: a66a5b397b user: drh tags: branch-3.8.6) | |
03:09 | Add new interfaces sqlite3_result_pointer(), and sqlite3_value_pointer() and use them to transfer the eponymous FTS3 column pointer to the snippet() and offsets() routines. This changes is inspired by check-in [72de49f2] but is new implementation, not a cherry-pick. (Leaf check-in: f0f492245e user: drh tags: branch-3.7.11) | |
2015-05-21
| ||
02:24 | Silently ignore any attempt to add a prefix index for prefixes zero bytes in size to an fts3/4 table. Or any prefix index size so large that it overflows a 32-bit signed integer. Cherrypick [ad4b19d2ac0889a] (check-in: 000197cc4e user: drh tags: branch-3.7.11) | |
00:50 | Add the ".open" command to the command-line shell. Cherrypick from [21eccb919441]. (check-in: a71e2a72c5 user: drh tags: branch-3.7.11) | |
2012-03-20
| ||
15:10 | Remove the _SafeInit() entry points from the TCL interface. They have long been no-ops. Removing them completely avoids confusion as to why they don't work. (check-in: 0fb26c7bfa user: drh tags: trunk) | |
11:35 | Version 3.7.11 (check-in: 00bb9c9ce4 user: drh tags: trunk, release, version-3.7.11) | |
03:10 | Fix out-of-bounds array references in the "echo" virtual table module used for testing. No changes to the SQLite core. (check-in: 7b449b301e user: drh tags: trunk) | |
Changes to ext/fts3/fts3.c.
︙ | |||
916 917 918 919 920 921 922 | 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 | - + + + + - + + + | for(p=zParam; *p; p++){ if( *p==',' ) nIndex++; } } aIndex = sqlite3_malloc(sizeof(struct Fts3Index) * nIndex); *apIndex = aIndex; |
︙ | |||
967 968 969 970 971 972 973 | 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 | - + + + + + | */ static int fts3ContentColumns( sqlite3 *db, /* Database handle */ const char *zDb, /* Name of db (i.e. "main", "temp" etc.) */ const char *zTbl, /* Name of content table */ const char ***pazCol, /* OUT: Malloc'd array of column names */ int *pnCol, /* OUT: Size of array *pazCol */ |
︙ | |||
1211 1212 1213 1214 1215 1216 1217 | 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 | - + | sqlite3_free(zCompress); sqlite3_free(zUncompress); zCompress = 0; zUncompress = 0; if( nCol==0 ){ sqlite3_free((void*)aCol); aCol = 0; |
︙ | |||
3054 3055 3056 3057 3058 3059 3060 | 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 | - + | /* This call is a request for the "docid" column. Since "docid" is an ** alias for "rowid", use the xRowid() method to obtain the value. */ sqlite3_result_int64(pCtx, pCsr->iPrevId); }else if( iCol==p->nColumn ){ /* The extra column whose name is the same as the table. ** Return a blob which is a pointer to the cursor. */ |
︙ | |||
3181 3182 3183 3184 3185 3186 3187 | 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 | - + - - - + - | */ static int fts3FunctionArg( sqlite3_context *pContext, /* SQL function call context */ const char *zFunc, /* Function name */ sqlite3_value *pVal, /* argv[0] passed to function */ Fts3Cursor **ppCsr /* OUT: Store cursor handle here */ ){ |
︙ |
Changes to src/fkey.c.
︙ | |||
1014 1015 1016 1017 1018 1019 1020 | 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 | - - + + - + - - + + - - + + - - + + | /* Create the expression "OLD.zToCol = zFromCol". It is important ** that the "OLD.zToCol" term is on the LHS of the = operator, so ** that the affinity and collation sequence associated with the ** parent table are used for the comparison. */ pEq = sqlite3PExpr(pParse, TK_EQ, sqlite3PExpr(pParse, TK_DOT, |
︙ | |||
1092 1093 1094 1095 1096 1097 1098 | 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 | - + - + - - + | /* Disable lookaside memory allocation */ enableLookaside = db->lookaside.bEnabled; db->lookaside.bEnabled = 0; pTrigger = (Trigger *)sqlite3DbMallocZero(db, sizeof(Trigger) + /* struct Trigger */ sizeof(TriggerStep) + /* Single step in trigger program */ |
︙ |
Changes to src/prepare.c.
︙ | |||
63 64 65 66 67 68 69 | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | - + | return 1; } assert( iDb>=0 && iDb<db->nDb ); if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */ if( argv[1]==0 ){ corruptSchema(pData, argv[0], 0); |
︙ | |||
94 95 96 97 98 99 100 | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | - - + + | db->mallocFailed = 1; }else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){ corruptSchema(pData, argv[0], sqlite3_errmsg(db)); } } } sqlite3_finalize(pStmt); |
︙ |
Changes to src/shell.c.
︙ | |||
430 431 432 433 434 435 436 437 438 439 440 441 442 443 | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | + | char nullvalue[20]; /* The text to print when a NULL comes back from ** the database */ struct previous_mode_data explainPrev; /* Holds the mode information just before ** .explain ON */ char outfile[FILENAME_MAX]; /* Filename for *out */ const char *zDbFilename; /* name of the database file */ char *zFreeOnClose; /* Filename to free when closing */ const char *zVfs; /* Name of VFS to use */ sqlite3_stmt *pStmt; /* Current statement if any. */ FILE *pLog; /* Write log output here */ }; /* ** These are the allowed modes. |
︙ | |||
1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 | 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 | + | " html HTML <table> code\n" " insert SQL insert statements for TABLE\n" " line One value per line\n" " list Values delimited by .separator string\n" " tabs Tab-separated values\n" " tcl TCL list elements\n" ".nullvalue STRING Print STRING in place of NULL values\n" ".open ?FILENAME? Close existing database and reopen FILENAME\n" ".output FILENAME Send output to FILENAME\n" ".output stdout Send output to the screen\n" ".prompt MAIN CONTINUE Replace the standard prompts\n" ".quit Exit this program\n" ".read FILENAME Execute SQL in FILENAME\n" ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE\n" ".schema ?TABLE? Show the CREATE statements\n" |
︙ | |||
1443 1444 1445 1446 1447 1448 1449 | 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 | - + + | /* Forward reference */ static int process_input(struct callback_data *p, FILE *in); /* ** Make sure the database is open. If it is not, then open it. If ** the database fails to open, print an error message and exit. */ |
︙ | |||
1574 1575 1576 1577 1578 1579 1580 | 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 | - + | } rc = sqlite3_open(zDestFile, &pDest); if( rc!=SQLITE_OK ){ fprintf(stderr, "Error: cannot open \"%s\"\n", zDestFile); sqlite3_close(pDest); return 1; } |
︙ | |||
1599 1600 1601 1602 1603 1604 1605 | 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 | - + - + | if( c=='b' && n>=3 && strncmp(azArg[0], "bail", n)==0 && nArg>1 && nArg<3 ){ bail_on_error = booleanValue(azArg[1]); }else if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 && nArg==1 ){ struct callback_data data; char *zErrMsg = 0; |
︙ | |||
1734 1735 1736 1737 1738 1739 1740 | 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 | - + | char *zSql; /* An SQL statement */ char *zLine; /* A single line of input from the file */ char **azCol; /* zLine[] broken up into columns */ char *zCommit; /* How to commit changes */ FILE *in; /* The input file */ int lineno = 0; /* Line number of input file */ |
︙ | |||
1849 1850 1851 1852 1853 1854 1855 | 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 | - + | sqlite3_finalize(pStmt); sqlite3_exec(p->db, zCommit, 0, 0, 0); }else if( c=='i' && strncmp(azArg[0], "indices", n)==0 && nArg<3 ){ struct callback_data data; char *zErrMsg = 0; |
︙ | |||
1915 1916 1917 1918 1919 1920 1921 | 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 | - + | #ifndef SQLITE_OMIT_LOAD_EXTENSION if( c=='l' && strncmp(azArg[0], "load", n)==0 && nArg>=2 ){ const char *zFile, *zProc; char *zErrMsg = 0; zFile = azArg[1]; zProc = nArg>=3 ? azArg[2] : 0; |
︙ | |||
1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 | 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 | + + + + + + + + + + + + + + + + + + + + | } }else if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 && nArg==2 ) { sqlite3_snprintf(sizeof(p->nullvalue), p->nullvalue, "%.*s", (int)ArraySize(p->nullvalue)-1, azArg[1]); }else if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){ sqlite3 *savedDb = p->db; const char *zSavedFilename = p->zDbFilename; char *zNewFilename = 0; p->db = 0; if( nArg>=2 ){ p->zDbFilename = zNewFilename = sqlite3_mprintf("%s", azArg[1]); } open_db(p, 1); if( p->db!=0 ){ sqlite3_close(savedDb); sqlite3_free(p->zFreeOnClose); p->zFreeOnClose = zNewFilename; }else{ sqlite3_free(zNewFilename); p->db = savedDb; p->zDbFilename = zSavedFilename; } }else if( c=='o' && strncmp(azArg[0], "output", n)==0 && nArg==2 ){ if( p->out!=stdout ){ fclose(p->out); } if( strcmp(azArg[1],"stdout")==0 ){ p->out = stdout; |
︙ | |||
2057 2058 2059 2060 2061 2062 2063 | 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 | - + | } rc = sqlite3_open(zSrcFile, &pSrc); if( rc!=SQLITE_OK ){ fprintf(stderr, "Error: cannot open \"%s\"\n", zSrcFile); sqlite3_close(pSrc); return 1; } |
︙ | |||
2087 2088 2089 2090 2091 2092 2093 | 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 | - + | } sqlite3_close(pSrc); }else if( c=='s' && strncmp(azArg[0], "schema", n)==0 && nArg<3 ){ struct callback_data data; char *zErrMsg = 0; |
︙ | |||
2193 2194 2195 2196 2197 2198 2199 | 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 | - + | p->statsOn = booleanValue(azArg[1]); }else if( c=='t' && n>1 && strncmp(azArg[0], "tables", n)==0 && nArg<3 ){ char **azResult; int nRow; char *zErrMsg; |
︙ | |||
2269 2270 2271 2272 2273 2274 2275 | 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 | - + | { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS }, { "iskeyword", SQLITE_TESTCTRL_ISKEYWORD }, { "scratchmalloc", SQLITE_TESTCTRL_SCRATCHMALLOC }, }; int testctrl = -1; int rc = 0; int i, n; |
︙ | |||
2368 2369 2370 2371 2372 2373 2374 | 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 | - + - + | azArg[1]); break; } } }else if( c=='t' && n>4 && strncmp(azArg[0], "timeout", n)==0 && nArg==2 ){ |
︙ | |||
2551 2552 2553 2554 2555 2556 2557 | 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 | - + | zSql[nSql++] = '\n'; memcpy(&zSql[nSql], zLine, len+1); nSql += len; } if( zSql && _contains_semicolon(&zSql[nSqlPrior], nSql-nSqlPrior) && sqlite3_complete(zSql) ){ p->cnt = 0; |
︙ | |||
2879 2880 2881 2882 2883 2884 2885 | 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 | - + | /* Go ahead and open the database file if it already exists. If the ** file does not exist, delay opening it. This prevents empty database ** files from being created if a user mistypes the database name argument ** to the sqlite command-line tool. */ if( access(data.zDbFilename, 0)==0 ){ |
︙ | |||
2971 2972 2973 2974 2975 2976 2977 | 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 | - + | if( i==argc-1 ) break; i++; z = argv[i]; if( z[0]=='.' ){ rc = do_meta_command(z, &data); if( rc && bail_on_error ) return rc; }else{ |
︙ | |||
2994 2995 2996 2997 2998 2999 3000 | 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 | - + | if( zFirstCmd ){ /* Run just the command that follows the database name */ if( zFirstCmd[0]=='.' ){ rc = do_meta_command(zFirstCmd, &data); }else{ |
︙ | |||
3042 3043 3044 3045 3046 3047 3048 3049 3050 | 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 | + | rc = process_input(&data, stdin); } } set_table_name(&data, 0); if( data.db ){ sqlite3_close(data.db); } sqlite3_free(data.zFreeOnClose); return rc; } |
Changes to src/sqlite.h.in.
︙ | |||
3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 | 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 | + | */ const void *sqlite3_value_blob(sqlite3_value*); int sqlite3_value_bytes(sqlite3_value*); int sqlite3_value_bytes16(sqlite3_value*); double sqlite3_value_double(sqlite3_value*); int sqlite3_value_int(sqlite3_value*); sqlite3_int64 sqlite3_value_int64(sqlite3_value*); void *sqlite3_value_pointer(sqlite3_value*); const unsigned char *sqlite3_value_text(sqlite3_value*); const void *sqlite3_value_text16(sqlite3_value*); const void *sqlite3_value_text16le(sqlite3_value*); const void *sqlite3_value_text16be(sqlite3_value*); int sqlite3_value_type(sqlite3_value*); int sqlite3_value_numeric_type(sqlite3_value*); |
︙ | |||
4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 | 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 | + | void sqlite3_result_error16(sqlite3_context*, const void*, int); void sqlite3_result_error_toobig(sqlite3_context*); void sqlite3_result_error_nomem(sqlite3_context*); void sqlite3_result_error_code(sqlite3_context*, int); void sqlite3_result_int(sqlite3_context*, int); void sqlite3_result_int64(sqlite3_context*, sqlite3_int64); void sqlite3_result_null(sqlite3_context*); void sqlite3_result_pointer(sqlite3_context*, void*); void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*)); void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*)); void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*)); void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*)); void sqlite3_result_value(sqlite3_context*, sqlite3_value*); void sqlite3_result_zeroblob(sqlite3_context*, int n); |
︙ |
Changes to src/sqliteInt.h.
︙ | |||
2337 2338 2339 2340 2341 2342 2343 | 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 | - + - + - + - - + + | * "SELECT" statement. The meanings of the other members is determined by the * value of "op" as follows: * * (op == TK_INSERT) * orconf -> stores the ON CONFLICT algorithm * pSelect -> If this is an INSERT INTO ... SELECT ... statement, then * this stores a pointer to the SELECT statement. Otherwise NULL. |
︙ |
Changes to src/trigger.c.
︙ | |||
369 370 371 372 373 374 375 | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | - + + - + - | static TriggerStep *triggerStepAllocate( sqlite3 *db, /* Database connection */ u8 op, /* Trigger opcode */ Token *pName /* The target name */ ){ TriggerStep *pTriggerStep; |
︙ | |||
663 664 665 666 667 668 669 | 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 | - + + - + - - + + - - + | if( pMask ){ *pMask = mask; } return (mask ? pList : 0); } /* |
︙ |
Changes to src/vdbeInt.h.
︙ | |||
147 148 149 150 151 152 153 154 155 156 157 158 159 160 | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | + | struct Mem { sqlite3 *db; /* The associated database connection */ char *z; /* String or BLOB value */ double r; /* Real value */ union { i64 i; /* Integer value used when MEM_Int is set in flags */ int nZero; /* Used when bit MEM_Zero is set in flags */ void *pPtr; /* Pointer when flags==MEM_Ptr|MEM_Null */ FuncDef *pDef; /* Used only when flags==MEM_Agg */ RowSet *pRowSet; /* Used only when flags==MEM_RowSet */ VdbeFrame *pFrame; /* Used when flags==MEM_Frame */ } u; int n; /* Number of characters in string value, excluding '\0' */ u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */ u8 type; /* One of SQLITE_NULL, SQLITE_TEXT, SQLITE_INTEGER, etc */ |
︙ | |||
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | + - + | #define MEM_TypeMask 0x00ff /* Mask of type bits */ /* Whenever Mem contains a valid string or blob representation, one of ** the following flags must be set to determine the memory management ** policy for Mem.z. The MEM_Term flag tells us whether or not the ** string is \000 or \u0000 terminated */ #define MEM_Ptr 0x8000 /* u.pPtr is valid if type==SQLITE_NULL */ #define MEM_Term 0x0200 /* String rep is nul terminated */ #define MEM_Dyn 0x0400 /* Need to call sqliteFree() on Mem.z */ #define MEM_Static 0x0800 /* Mem.z points to a static string */ #define MEM_Ephem 0x1000 /* Mem.z points to an ephemeral string */ #define MEM_Agg 0x2000 /* Mem.z points to an agg function context */ #define MEM_Zero 0x4000 /* Mem.i contains count of 0s appended to blob */ #ifdef SQLITE_OMIT_INCRBLOB #undef MEM_Zero #define MEM_Zero 0x0000 #endif /* ** Clear any existing type flags from a Mem and replace them with f */ #define MemSetTypeFlag(p, f) \ |
︙ |
Changes to src/vdbeapi.c.
︙ | |||
158 159 160 161 162 163 164 165 166 167 168 169 170 171 | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | + + + + + | return sqlite3VdbeRealValue((Mem*)pVal); } int sqlite3_value_int(sqlite3_value *pVal){ return (int)sqlite3VdbeIntValue((Mem*)pVal); } sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){ return sqlite3VdbeIntValue((Mem*)pVal); } void *sqlite3_value_pointer(sqlite3_value *pVal){ Mem *p = (Mem*)pVal; if( (p->flags&(MEM_TypeMask|MEM_Ptr))==(MEM_Null|MEM_Ptr) ) return p->u.pPtr; return 0; } const unsigned char *sqlite3_value_text(sqlite3_value *pVal){ return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8); } #ifndef SQLITE_OMIT_UTF16 const void *sqlite3_value_text16(sqlite3_value* pVal){ return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE); |
︙ | |||
229 230 231 232 233 234 235 236 237 238 239 240 241 242 | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | + + + + + + + | void sqlite3_result_int(sqlite3_context *pCtx, int iVal){ assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); sqlite3VdbeMemSetInt64(&pCtx->s, (i64)iVal); } void sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){ assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); sqlite3VdbeMemSetInt64(&pCtx->s, iVal); } void sqlite3_result_pointer(sqlite3_context *pCtx, void *pPtr){ assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); sqlite3VdbeMemSetNull(&pCtx->s); assert( (pCtx->s.flags & (MEM_TypeMask|MEM_Ptr))==MEM_Null ); pCtx->s.flags |= MEM_Ptr; pCtx->s.u.pPtr = pPtr; } void sqlite3_result_null(sqlite3_context *pCtx){ assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); sqlite3VdbeMemSetNull(&pCtx->s); } void sqlite3_result_text( sqlite3_context *pCtx, |
︙ |
Changes to src/vtab.c.
︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | + + | ** this struct allocated on the stack. It is used by the implementation of ** the sqlite3_declare_vtab() and sqlite3_vtab_config() APIs, both of which ** are invoked only from within xCreate and xConnect methods. */ struct VtabCtx { Table *pTab; VTable *pVTable; VtabCtx *pPrior; /* Parent context (if any) */ int bDeclared; /* True after sqlite3_declare_vtab() is called */ }; /* ** The actual function that does the work of creating a new module. ** This function implements the sqlite3_create_module() and ** sqlite3_create_module_v2() interfaces. */ |
︙ | |||
449 450 451 452 453 454 455 | 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 | - + + + + + + + + + + + + + + + - + + - + | ){ VtabCtx sCtx; VTable *pVTable; int rc; const char *const*azArg = (const char *const*)pTab->azModuleArg; int nArg = pTab->nModuleArg; char *zErr = 0; |
︙ | |||
656 657 658 659 660 661 662 663 | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | + - - + + | /* ** This function is used to set the schema of a virtual table. It is only ** valid to call this function from within the xCreate() or xConnect() of a ** virtual table module. */ int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ VtabCtx *pCtx = db->pVtabCtx; Parse *pParse; |
︙ | |||
690 691 692 693 694 695 696 | 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | - + | ){ if( !pTab->aCol ){ pTab->aCol = pParse->pNewTable->aCol; pTab->nCol = pParse->pNewTable->nCol; pParse->pNewTable->nCol = 0; pParse->pNewTable->aCol = 0; } |
︙ |
Changes to test/analyze.test.
︙ | |||
354 355 356 357 358 359 360 | 354 355 356 357 358 359 360 361 362 363 364 | - + | UPDATE sqlite_master SET sql='nonsense' WHERE name='sqlite_stat1'; } db close catch { sqlite3 db test.db } catchsql { ANALYZE } |
Changes to test/e_reindex.test.
︙ | |||
44 45 46 47 48 49 50 51 | 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 | + + - + - + + | # Test this by corrupting some database indexes, running REINDEX, and # observing that the corruption is gone. # do_execsql_test e_reindex-1.1 { INSERT INTO t1 VALUES(1, 2); INSERT INTO t1 VALUES(3, 4); INSERT INTO t1 VALUES(5, 6); CREATE TABLE saved(a,b,c,d,e); INSERT INTO saved SELECT * FROM sqlite_master WHERE type = 'index'; PRAGMA writable_schema = 1; |
︙ |
Changes to test/fkey1.test.
︙ | |||
113 114 115 116 117 118 119 120 121 | 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 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | ); PRAGMA foreign_key_list(t9); } } [concat \ {0 0 t5 d {} {SET DEFAULT} CASCADE NONE} \ {0 1 t5 e {} {SET DEFAULT} CASCADE NONE} \ ] # Stress the dequoting logic. The first test is not so bad. do_execsql_test fkey1-4.0 { PRAGMA foreign_keys=ON; CREATE TABLE "xx1"("xx2" TEXT PRIMARY KEY, "xx3" TEXT); INSERT INTO "xx1"("xx2","xx3") VALUES('abc','def'); CREATE TABLE "xx4"("xx5" TEXT REFERENCES "xx1" ON DELETE CASCADE); INSERT INTO "xx4"("xx5") VALUES('abc'); INSERT INTO "xx1"("xx2","xx3") VALUES('uvw','xyz'); SELECT 1, "xx5" FROM "xx4"; DELETE FROM "xx1"; SELECT 2, "xx5" FROM "xx4"; } {1 abc} # This case is identical to the previous except the "xx" in each name # is changed to a single escaped double-quote character. do_execsql_test fkey1-4.1 { PRAGMA foreign_keys=ON; CREATE TABLE """1"("""2" TEXT PRIMARY KEY, """3" TEXT); INSERT INTO """1"("""2","""3") VALUES('abc','def'); CREATE TABLE """4"("""5" TEXT REFERENCES """1" ON DELETE CASCADE); INSERT INTO """4"("""5") VALUES('abc'); INSERT INTO """1"("""2","""3") VALUES('uvw','xyz'); SELECT 1, """5" FROM """4"; DELETE FROM """1"; SELECT 2, """5" FROM """4"; } {1 abc} do_execsql_test fkey1-4.2 { PRAGMA table_info="""1"; } {0 {"2} TEXT 0 {} 1 1 {"3} TEXT 0 {} 0} finish_test |
Changes to test/fts3prefix.test.
︙ | |||
205 206 207 208 209 210 211 212 213 | 205 206 207 208 209 210 211 212 213 214 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 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | # do_catchsql_test 5.1 { CREATE VIRTUAL TABLE t4 USING fts4(prefix="abc"); } {1 {error parsing prefix parameter: abc}} do_catchsql_test 5.2 { CREATE VIRTUAL TABLE t4 USING fts4(prefix=""); } {0 {}} do_catchsql_test 5.3 { CREATE VIRTUAL TABLE t5 USING fts4(prefix="-1"); } {1 {error parsing prefix parameter: -1}} #------------------------------------------------------------------------- # Prefix indexes of size 0 are ignored. Demonstrate this by showing that # adding prefix=0 does not change the contents of the %_segdir table. # reset_db do_execsql_test 6.1.1 { CREATE VIRTUAL TABLE t1 USING fts4(prefix=0); CREATE VIRTUAL TABLE t2 USING fts4; INSERT INTO t1 VALUES('Twas Mulga Bill, from Eaglehawk, '); INSERT INTO t2 VALUES('Twas Mulga Bill, from Eaglehawk, '); } {} do_execsql_test 6.1.2 { SELECT md5sum(quote(root)) FROM t1_segdir; } [db eval {SELECT md5sum(quote(root)) FROM t2_segdir}] reset_db do_execsql_test 6.2.1 { CREATE VIRTUAL TABLE t1 USING fts4(prefix="1,0,2"); CREATE VIRTUAL TABLE t2 USING fts4(prefix="1,2"); INSERT INTO t1 VALUES('that caught the cycling craze;'); INSERT INTO t2 VALUES('that caught the cycling craze;'); } {} do_execsql_test 6.2.2 { SELECT md5sum(quote(root)) FROM t1_segdir; } [db eval {SELECT md5sum(quote(root)) FROM t2_segdir}] reset_db do_execsql_test 6.3.1 { CREATE VIRTUAL TABLE t1 USING fts4(prefix="1,3,2"); CREATE VIRTUAL TABLE t2 USING fts4(prefix="1,2"); INSERT INTO t1 VALUES('He turned away the good old horse'); INSERT INTO t2 VALUES('He turned away the good old horse'); } {} do_test 6.3.2 { set one [db eval {SELECT md5sum(quote(root)) FROM t1_segdir}] set two [db eval {SELECT md5sum(quote(root)) FROM t2_segdir}] expr {$one == $two} } 0 reset_db do_execsql_test 6.4.1 { CREATE VIRTUAL TABLE t1 USING fts4(prefix="1,600,2"); CREATE VIRTUAL TABLE t2 USING fts4(prefix="1,2"); INSERT INTO t1 VALUES('that served him many days;'); INSERT INTO t2 VALUES('that served him many days;'); } {} do_execsql_test 6.4.2 { SELECT md5sum(quote(root)) FROM t1_segdir; } [db eval {SELECT md5sum(quote(root)) FROM t2_segdir}] reset_db do_execsql_test 6.5.1 { CREATE VIRTUAL TABLE t1 USING fts4(prefix="2147483647,2147483648,2147483649"); CREATE VIRTUAL TABLE t2 USING fts4(prefix=""); INSERT INTO t1 VALUES('He dressed himself in cycling clothes'); INSERT INTO t2 VALUES('He dressed himself in cycling clothes'); } {} do_execsql_test 6.5.2 { SELECT md5sum(quote(root)) FROM t1_segdir; } [db eval {SELECT md5sum(quote(root)) FROM t2_segdir}] finish_test |
Changes to test/fts4content.test.
︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | + + + | # 7.* - Test that if content=xxx is specified and table xxx does not # exist, the FTS table can still be used for INSERT and some # SELECT statements. # # 8.* - Test that if the content=xxx and prefix options are used together, # the 'rebuild' command still works. # # 11.* - Test that circular references (e.g. "t1(content=t1)") are # detected. # do_execsql_test 1.1.1 { CREATE TABLE t1(a, b, c); INSERT INTO t1 VALUES('w x', 'x y', 'y z'); CREATE VIRTUAL TABLE ft1 USING fts4(content=t1); } |
︙ | |||
400 401 402 403 404 405 406 | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | - + | } #------------------------------------------------------------------------- # Test cases 6.* test # do_catchsql_test 6.1.1 { CREATE VIRTUAL TABLE ft7 USING fts4(content=t7); |
︙ | |||
427 428 429 430 431 432 433 | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | - + | SELECT name FROM sqlite_master WHERE name LIKE '%t7%' } { ft7 ft7_segments ft7_segdir sqlite_autoindex_ft7_segdir_1 ft7_docsize ft7_stat } do_catchsql_test 6.2.4 { SELECT * FROM ft7; |
︙ | |||
517 518 519 520 521 522 523 524 525 | 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 561 562 563 564 565 566 567 568 569 570 571 572 573 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } do_execsql_test 8.2 { SELECT * FROM ft10 WHERE a MATCH 'ab*'; } do_execsql_test 8.3 { INSERT INTO ft10(ft10) VALUES('rebuild'); } do_execsql_test 8.4 { SELECT rowid FROM ft10 WHERE a MATCH 'ab*'; } {1 2 3} do_execsql_test 8.5 { SELECT rowid FROM ft10 WHERE b MATCH 'abav*'; } {3} do_execsql_test 8.6 { SELECT rowid FROM ft10 WHERE ft10 MATCH 'abas*'; } {1} #------------------------------------------------------------------------- # Test cases 9.* # reset_db register_echo_module [sqlite3_connection_pointer db] do_execsql_test 9.1 { CREATE TABLE tbl1(a, b); INSERT INTO tbl1 VALUES('a b', 'c d'); INSERT INTO tbl1 VALUES('e f', 'a b'); CREATE VIRTUAL TABLE e1 USING echo(tbl1); CREATE VIRTUAL TABLE ft1 USING fts4(content=e1); INSERT INTO ft1(ft1) VALUES('rebuild'); } do_execsql_test 9.2 { SELECT rowid, * FROM ft1 WHERE ft1 MATCH 'e' } {2 {e f} {a b}} do_execsql_test 9.3 { SELECT rowid, * FROM ft1 WHERE ft1 MATCH 'a' } {1 {a b} {c d} 2 {e f} {a b}} do_execsql_test 9.4 { DELETE FROM ft1 WHERE docid=1; } do_execsql_test 9.5 { SELECT rowid, * FROM ft1 WHERE ft1 MATCH 'a' } {2 {e f} {a b}} do_execsql_test 9.6 { INSERT INTO ft1(ft1) VALUES('rebuild'); SELECT rowid, * FROM ft1 WHERE ft1 MATCH 'a' } {1 {a b} {c d} 2 {e f} {a b}} #------------------------------------------------------------------------- # Test cases 11.* # reset_db do_catchsql_test 11.1 { CREATE VIRTUAL TABLE x1 USING fts4(content=x1); } {1 {vtable constructor called recursively: x1}} finish_test |
Changes to test/index3.test.
︙ | |||
47 48 49 50 51 52 53 | 47 48 49 50 51 52 53 54 55 56 | - + | execsql { PRAGMA writable_schema=on; UPDATE sqlite_master SET sql='nonsense'; } db close catch { sqlite3 db test.db } catchsql { DROP INDEX i1 } |
Changes to test/trigger7.test.
︙ | |||
110 111 112 113 114 115 116 | 110 111 112 113 114 115 116 117 118 119 | - + | execsql { PRAGMA writable_schema=on; UPDATE sqlite_master SET sql='nonsense'; } db close catch { sqlite3 db test.db } catchsql { DROP TRIGGER t2r5 } |
Changes to test/triggerC.test.
︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 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. # #*********************************************************************** # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix triggerC ifcapable {!trigger} { finish_test return } #------------------------------------------------------------------------- # Test organization: |
︙ | |||
946 947 948 949 950 951 952 953 954 | 947 948 949 950 951 952 953 954 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 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | END; } {} do_catchsql_test triggerC-13.2 { UPDATE t12 SET a=a+1, b=b+1; } {1 {too many levels of trigger recursion}} #------------------------------------------------------------------------- # Check that table names used by trigger programs are dequoted exactly # once. # do_execsql_test 15.1.1 { PRAGMA recursive_triggers = 1; CREATE TABLE node( id int not null primary key, pid int not null default 0 references node, key varchar not null, path varchar default '', unique(pid, key) ); CREATE TRIGGER node_delete_referencing AFTER DELETE ON "node" BEGIN DELETE FROM "node" WHERE pid = old."id"; END; } do_execsql_test 15.1.2 { INSERT INTO node(id, pid, key) VALUES(9, 0, 'test'); INSERT INTO node(id, pid, key) VALUES(90, 9, 'test1'); INSERT INTO node(id, pid, key) VALUES(900, 90, 'test2'); DELETE FROM node WHERE id=9; SELECT * FROM node; } do_execsql_test 15.2.1 { CREATE TABLE x1 (x); CREATE TABLE x2 (a, b); CREATE TABLE '"x2"'(a, b); INSERT INTO x2 VALUES(1, 2); INSERT INTO x2 VALUES(3, 4); INSERT INTO '"x2"' SELECT * FROM x2; CREATE TRIGGER x1ai AFTER INSERT ON x1 BEGIN INSERT INTO """x2""" VALUES('x', 'y'); DELETE FROM """x2""" WHERE a=1; UPDATE """x2""" SET b = 11 WHERE a = 3; END; INSERT INTO x1 VALUES('go!'); } do_execsql_test 15.2.2 { SELECT * FROM x2; } {1 2 3 4} do_execsql_test 15.2.3 { SELECT * FROM """x2"""; } {3 11 x y} finish_test |