Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Latest Jan 12 CVS HEAD |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | sourceforge |
Files: | files | file ages | folders |
SHA1: |
a7f98646af388f7701567f0a7e9c8c14 |
User & Date: | rmsimpson 2006-01-12 20:54:07.000 |
Context
2006-01-12
| ||
20:55 | Optimize and fix the DataAdapter tests, shorten the locktest duration check-in: bb2c450c63 user: rmsimpson tags: sourceforge | |
20:54 | Latest Jan 12 CVS HEAD check-in: a7f98646af user: rmsimpson tags: sourceforge | |
20:53 | Remove unnecessary assignment check-in: 3407377976 user: rmsimpson tags: sourceforge | |
Changes
Changes to SQLite.Interop/src/alter.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 used to generate VDBE code ** that implements the ALTER TABLE command. ** |
︙ | |||
263 264 265 266 267 268 269 | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | - + | char *zName = 0; /* NULL-terminated version of pName */ sqlite3 *db = pParse->db; /* Database connection */ Vdbe *v; #ifndef SQLITE_OMIT_TRIGGER char *zWhere = 0; /* Where clause to locate temp triggers */ #endif |
︙ | |||
497 498 499 500 501 502 503 | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | - + | Vdbe *v; int iDb; int i; int nAlloc; /* Look up the table being altered. */ assert( pParse->pNewTable==0 ); |
︙ |
Changes to SQLite.Interop/src/analyze.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 | - + | /* ** 2005 July 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 contains code associated with the ANALYZE command. ** |
︙ |
Changes to SQLite.Interop/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. ** |
︙ | |||
167 168 169 170 171 172 173 | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | - | /* If the file was opened successfully, read the schema for the new database. ** If this fails, or if opening the file failed, then close the file and ** remove the entry from the db->aDb[] array. i.e. put everything back the way ** we found it. */ if( rc==SQLITE_OK ){ |
︙ | |||
269 270 271 272 273 274 275 | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | - + | int rc; NameContext sName; Vdbe *v; FuncDef *pFunc; sqlite3* db = pParse->db; #ifndef SQLITE_OMIT_AUTHORIZATION |
︙ | |||
300 301 302 303 304 305 306 | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | - + | } v = sqlite3GetVdbe(pParse); sqlite3ExprCode(pParse, pFilename); sqlite3ExprCode(pParse, pDbname); sqlite3ExprCode(pParse, pKey); |
︙ |
Changes to SQLite.Interop/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 sqlite3_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 ** |
︙ |
Changes to SQLite.Interop/src/btree.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 | - + | /* ** 2004 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. ** ************************************************************************* |
︙ | |||
553 554 555 556 557 558 559 | 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | - + | /* ** Save the positions of all cursors except pExcept open on the table ** with root-page iRoot. Usually, this is called just before cursor ** pExcept is used to modify the table (BtreeDelete() or BtreeInsert()). */ static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){ BtCursor *p; |
︙ | |||
580 581 582 583 584 585 586 | 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | - + | ** If the second argument argument - doSeek - is false, then instead of ** returning the cursor to it's saved position, any saved position is deleted ** and the cursor state set to CURSOR_INVALID. */ static int restoreCursorPosition(BtCursor *pCur, int doSeek){ int rc = SQLITE_OK; if( pCur->eState==CURSOR_REQUIRESEEK ){ |
︙ | |||
606 607 608 609 610 611 612 | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | - + | ** SQLITE_LOCKED if not. */ static int queryTableLock(Btree *p, Pgno iTab, u8 eLock){ BtShared *pBt = p->pBt; BtLock *pIter; /* This is a no-op if the shared-cache is not enabled */ |
︙ | |||
654 655 656 657 658 659 660 | 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | - + | */ static int lockTable(Btree *p, Pgno iTable, u8 eLock){ BtShared *pBt = p->pBt; BtLock *pLock = 0; BtLock *pIter; /* This is a no-op if the shared-cache is not enabled */ |
︙ | |||
719 720 721 722 723 724 725 | 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 | - + | static void unlockAllTables(Btree *p){ BtLock **ppIter = &p->pBt->pLock; /* If the shared-cache extension is not enabled, there should be no ** locks in the BtShared.pLock list, making this procedure a no-op. Assert ** that this is the case. */ |
︙ | |||
1542 1543 1544 1545 1546 1547 1548 | 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 | - - + + | int flags /* Options */ ){ BtShared *pBt; /* Shared part of btree structure */ Btree *p; /* Handle to return */ int rc; int nReserve; unsigned char zDbHeader[100]; |
︙ | |||
1568 1569 1570 1571 1572 1573 1574 | 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 | + - + - + + | return SQLITE_NOMEM; } p->inTrans = TRANS_NONE; p->pSqlite = pSqlite; /* Try to find an existing Btree structure opened on zFilename. */ #if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO) pTsdro = sqlite3ThreadDataReadOnly(); |
︙ | |||
1655 1656 1657 1658 1659 1660 1661 | 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 | - - - + + + - + | } pBt->usableSize = pBt->pageSize - nReserve; assert( (pBt->pageSize & 7)==0 ); /* 8-byte alignment of pageSize */ sqlite3pager_set_pagesize(pBt->pPager, pBt->pageSize); #ifndef SQLITE_OMIT_SHARED_CACHE /* Add the new btree to the linked list starting at ThreadData.pBtree */ |
︙ | |||
1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 | 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 | + | assert( pBt->nRef>0 ); pBt->nRef--; if( pBt->nRef ){ return SQLITE_OK; } /* Remove the shared-btree from the thread wide list */ pTsd = sqlite3ThreadData(); if( pTsd->pBtree==pBt ){ pTsd->pBtree = pBt->pNext; }else{ BtShared *pPrev; for(pPrev=pTsd->pBtree; pPrev && pPrev->pNext!=pBt; pPrev=pPrev->pNext); if( pPrev ){ pPrev->pNext = pBt->pNext; |
︙ | |||
3319 3320 3321 3322 3323 3324 3325 | 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 | - - - + + + + + + + + + + + | return SQLITE_CORRUPT_BKPT; } pageIntegrity(pPage); while( lwr<=upr ){ void *pCellKey; i64 nCellKey; pCur->idx = (lwr+upr)/2; |
︙ | |||
6494 6495 6496 6497 6498 6499 6500 | 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + | rc = queryTableLock(p, iTab, lockType); if( rc==SQLITE_OK ){ rc = lockTable(p, iTab, lockType); } #endif return rc; } /* ** The following debugging interface has to be in this file (rather ** than in, for example, test1.c) so that it can get access to ** the definition of BtShared. */ #if defined(SQLITE_TEST) && defined(TCLSH) #include <tcl.h> int sqlite3_shared_cache_report( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ const ThreadData *pTd = sqlite3ThreadDataReadOnly(); if( pTd->useSharedData ){ BtShared *pBt; Tcl_Obj *pRet = Tcl_NewObj(); for(pBt=pTd->pBtree; pBt; pBt=pBt->pNext){ const char *zFile = sqlite3pager_filename(pBt->pPager); Tcl_ListObjAppendElement(interp, pRet, Tcl_NewStringObj(zFile, -1)); Tcl_ListObjAppendElement(interp, pRet, Tcl_NewIntObj(pBt->nRef)); } Tcl_SetObjResult(interp, pRet); } return TCL_OK; } #endif |
Changes to SQLite.Interop/src/btree.h.
︙ | |||
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. ** ************************************************************************* ** This header file defines the interface that the sqlite B-Tree file ** subsystem. See comments in the source code for a detailed description ** of what each interface routine does. ** |
︙ |
Changes to SQLite.Interop/src/build.c.
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + | ** CREATE INDEX ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** |
︙ | |||
62 63 64 65 66 67 68 | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | - - + | int iTab, u8 isWriteLock, const char *zName ){ int i; int nBytes; TableLock *p; |
︙ | |||
94 95 96 97 98 99 100 | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | - + | /* ** Code an OP_TableLock instruction for each table locked by the ** statement (configured by calls to sqlite3TableLock()). */ static void codeTableLocks(Parse *pParse){ int i; Vdbe *pVdbe; |
︙ | |||
127 128 129 130 131 132 133 | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | - + | ** Note that if an error occurred, it might be the case that ** no VDBE code was generated. */ void sqlite3FinishCoding(Parse *pParse){ sqlite3 *db; Vdbe *v; |
︙ | |||
251 252 253 254 255 256 257 | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | - | ** ** See also sqlite3LocateTable(). */ Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){ Table *p = 0; int i; assert( zName!=0 ); |
︙ | |||
307 308 309 310 311 312 313 | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | - | ** for duplicate index names is done.) The search order is ** TEMP first, then MAIN, then any auxiliary databases added ** using the ATTACH command. */ Index *sqlite3FindIndex(sqlite3 *db, const char *zName, const char *zDb){ Index *p = 0; int i; |
︙ | |||
389 390 391 392 393 394 395 | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | - | ** files. If iDb>=2 then reset the internal schema for only the ** single file indicated. */ void sqlite3ResetInternalSchema(sqlite3 *db, int iDb){ int i, j; assert( iDb>=0 && iDb<db->nDb ); |
︙ | |||
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | 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 | + + + - + | ** PRIMARY KEY or UNIQUE keywords are parsed. Those keywords will cause ** indices to be created and the table record must come before the ** indices. Hence, the record number for the table must be allocated ** now. */ if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){ int lbl; int fileFormat; sqlite3BeginWriteOperation(pParse, 0, iDb); /* If the file format and encoding in the database have not been set, ** set them now. */ sqlite3VdbeAddOp(v, OP_ReadCookie, iDb, 1); /* file_format */ lbl = sqlite3VdbeMakeLabel(v); sqlite3VdbeAddOp(v, OP_If, 0, lbl); fileFormat = (db->flags & SQLITE_LegacyFileFmt)!=0 ? 1 : SQLITE_DEFAULT_FILE_FORMAT; |
︙ | |||
1362 1363 1364 1365 1366 1367 1368 | 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 | - + | Select *pSelect /* Select from a "CREATE ... AS SELECT" */ ){ Table *p; sqlite3 *db = pParse->db; int iDb; if( (pEnd==0 && pSelect==0) || |
︙ | |||
1599 1600 1601 1602 1603 1604 1605 | 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 | - + | /* Make a copy of the entire SELECT statement that defines the view. ** This will force all the Expr.token.z values to be dynamically ** allocated rather than point to the input string - which means that ** they will persist after the current sqlite3_exec() call returns. */ p->pSelect = sqlite3SelectDup(pSelect); sqlite3SelectDelete(pSelect); |
︙ | |||
1841 1842 1843 1844 1845 1846 1847 | 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 | - + + + | */ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){ Table *pTab; Vdbe *v; sqlite3 *db = pParse->db; int iDb; |
︙ | |||
2200 2201 2202 2203 2204 2205 2206 | 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 | - + | int iDb; /* Index of the database that is being written */ Token *pName = 0; /* Unqualified name of the index to create */ struct ExprList_item *pListItem; /* For looping over pList */ int nCol; int nExtra = 0; char *zExtra; |
︙ | |||
2354 2355 2356 2357 2358 2359 2360 | 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 | - + | sizeof(int)*nCol + /* Index.aiColumn */ sizeof(int)*(nCol+1) + /* Index.aiRowEst */ sizeof(char *)*nCol + /* Index.azColl */ sizeof(u8)*nCol + /* Index.aSortOrder */ nName + 1 + /* Index.zName */ nExtra /* Collation sequence names */ ); |
︙ | |||
2641 2642 2643 2644 2645 2646 2647 | 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 | - + | */ void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists){ Index *pIndex; Vdbe *v; sqlite3 *db = pParse->db; int iDb; |
︙ | |||
2850 2851 2852 2853 2854 2855 2856 | 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 | - + | /* ** Assign cursors to all tables in a SrcList */ void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){ int i; struct SrcList_item *pItem; |
︙ | |||
2899 2900 2901 2902 2903 2904 2905 | 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 | - + - + - + | */ void sqlite3BeginTransaction(Parse *pParse, int type){ sqlite3 *db; Vdbe *v; int i; if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return; |
︙ | |||
3211 3212 3213 3214 3215 3216 3217 | 3212 3213 3214 3215 3216 3217 3218 | - | if( pParse->nErr ){ sqliteFree(pKey); pKey = 0; } return pKey; } |
Changes to SQLite.Interop/src/callback.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. ** ************************************************************************* ** ** This file contains functions used to access the internal hash tables ** of user defined functions and collation sequences. ** |
︙ | |||
174 175 176 177 178 179 180 | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | - + + | pColl[0].zName[nName] = 0; pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, nName, pColl); /* If a malloc() failure occured in sqlite3HashInsert(), it will ** return the pColl pointer to be deleted (because it wasn't added ** to the hash table). */ |
︙ |
Changes to SQLite.Interop/src/complete.c.
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - + | ** An tokenizer for SQL ** ** This file contains C code that implements the sqlite3_complete() API. ** This code used to be part of the tokenizer.c source file. But by ** separating it out, the code will be automatically omitted from ** static links that do not use it. ** |
︙ |
Changes to SQLite.Interop/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 ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** |
︙ |
Changes to SQLite.Interop/src/delete.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 ** in order to generate code for DELETE FROM statements. ** |
︙ | |||
104 105 106 107 108 109 110 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | - + | #ifndef SQLITE_OMIT_TRIGGER int isView; /* True if attempting to delete from a view */ int triggers_exist = 0; /* True if any triggers exist */ #endif sContext.pParse = 0; |
︙ |
Changes to SQLite.Interop/src/experimental.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 not a part of the official ** SQLite API. These routines are unsupported. ** |
︙ |
Changes to SQLite.Interop/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. ** |
︙ | |||
259 260 261 262 263 264 265 | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | - + | /* ** Set the Expr.span field of the given expression to span all ** text between the two given tokens. */ void sqlite3ExprSpan(Expr *pExpr, Token *pLeft, Token *pRight){ assert( pRight!=0 ); assert( pLeft!=0 ); |
︙ | |||
354 355 356 357 358 359 360 | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | - + | if( i>=pParse->nVarExpr ){ pExpr->iTable = ++pParse->nVar; if( pParse->nVarExpr>=pParse->nVarExprAlloc-1 ){ pParse->nVarExprAlloc += pParse->nVarExprAlloc + 10; sqlite3ReallocOrFree((void**)&pParse->apVarExpr, pParse->nVarExprAlloc*sizeof(pParse->apVarExpr[0]) ); } |
︙ | |||
458 459 460 461 462 463 464 | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | - + + | if( pOldExpr->span.z!=0 && pNewExpr ){ /* Always make a copy of the span for top-level expressions in the ** expression list. The logic in SELECT processing that determines ** the names of columns in the result set needs this information */ sqlite3TokenCopy(&pNewExpr->span, &pOldExpr->span); } assert( pNewExpr==0 || pNewExpr->span.z!=0 |
︙ | |||
827 828 829 830 831 832 833 | 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 | - + | struct SrcList_item *pMatch = 0; /* The matching pSrcList item */ NameContext *pTopNC = pNC; /* First namecontext in the list */ assert( pColumnToken && pColumnToken->z ); /* The Z in X.Y.Z cannot be NULL */ zDb = sqlite3NameFromToken(pDbToken); zTab = sqlite3NameFromToken(pTableToken); zCol = sqlite3NameFromToken(pColumnToken); |
︙ | |||
1304 1305 1306 1307 1308 1309 1310 | 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 | - + | ** If all of the above are false, then we can run this code just once ** save the results, and reuse the same result on subsequent invocations. */ if( !ExprHasAnyProperty(pExpr, EP_VarSelect) && !pParse->trigStack ){ int mem = pParse->nMem++; sqlite3VdbeAddOp(v, OP_MemLoad, mem, 0); testAddr = sqlite3VdbeAddOp(v, OP_If, 0, 0); |
︙ |
Changes to SQLite.Interop/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. ** |
︙ |
Changes to SQLite.Interop/src/hash.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 is the implementation of generic hash-tables ** used in SQLite. ** |
︙ |
Changes to SQLite.Interop/src/hash.h.
︙ | |||
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 is the header file for the generic hash-table implemenation ** used in SQLite. ** |
︙ |
Changes to SQLite.Interop/src/insert.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 INSERT statements in SQLite. ** |
︙ | |||
221 222 223 224 225 226 227 | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | - + + + | int triggers_exist = 0; /* True if there are FOR EACH ROW triggers */ #endif #ifndef SQLITE_OMIT_AUTOINCREMENT int counterRowid; /* Memory cell holding rowid of autoinc counter */ #endif |
︙ | |||
327 328 329 330 331 332 333 | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | - + + + | int rc, iInitCode; iInitCode = sqlite3VdbeAddOp(v, OP_Goto, 0, 0); iSelectLoop = sqlite3VdbeCurrentAddr(v); iInsertBlock = sqlite3VdbeMakeLabel(v); /* Resolve the expressions in the SELECT statement and execute it. */ rc = sqlite3Select(pParse, pSelect, SRT_Subroutine, iInsertBlock,0,0,0,0); |
︙ |
Changes to SQLite.Interop/src/keywordhash.h.
︙ | |||
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 | - + - + - + - - + + - - - + + + - + - - - + + + - + | "CASECASTCOLLATECOLUMNCOMMITCONFLICTCONSTRAINTERSECTCREATECROSS" "CURRENT_DATECURRENT_TIMESTAMPLANDESCDETACHDISTINCTDROPRAGMATCH" "FAILIMITFROMFULLGROUPDATEIFIMMEDIATEINSERTINSTEADINTOFFSETISNULL" "JOINORDEREPLACEOUTERESTRICTPRIMARYQUERYRIGHTROLLBACKROWHENUNION" "UNIQUEUSINGVACUUMVALUESVIEWHERE"; static const unsigned char aHash[127] = { 92, 80, 107, 91, 0, 4, 0, 0, 114, 0, 83, 0, 0, |
︙ | |||
60 61 62 63 64 65 66 | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | - + - + - - + + | TK_OR, TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_THEN, TK_END, TK_DEFAULT, TK_TRANSACTION,TK_ON, TK_JOIN_KW, TK_ALTER, TK_RAISE, TK_EACH, TK_CHECK, TK_KEY, TK_AFTER, TK_REFERENCES, TK_ESCAPE, TK_ELSE, TK_EXCEPT, TK_TRIGGER, TK_LIKE_KW, TK_EXPLAIN, TK_INITIALLY, TK_ALL, TK_ANALYZE, TK_EXCLUSIVE, TK_EXISTS, TK_STATEMENT, TK_AND, TK_DEFERRABLE, TK_ATTACH, TK_HAVING, TK_LIKE_KW, |
︙ |
Changes to SQLite.Interop/src/legacy.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. ** |
︙ | |||
117 118 119 120 121 122 123 | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | - + | azCols = 0; } exec_out: if( pStmt ) sqlite3_finalize(pStmt); if( azCols ) sqliteFree(azCols); |
︙ |
Changes to SQLite.Interop/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. ** |
︙ | |||
172 173 174 175 176 177 178 | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | - + | /* The temp-database schema is allocated differently from the other schema ** objects (using sqliteMalloc() directly, instead of sqlite3BtreeSchema()). ** So it needs to be freed here. Todo: Why not roll the temp schema into ** the same sqliteMalloc() as the one that allocates the database ** structure? */ sqliteFree(db->aDb[1].pSchema); |
︙ | |||
641 642 643 644 645 646 647 | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | - + | /* ** Return UTF-8 encoded English language explanation of the most recent ** error. */ const char *sqlite3_errmsg(sqlite3 *db){ const char *z; |
︙ | |||
680 681 682 683 684 685 686 | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | - + - + | 0, 'c', 0, 'a', 0, 'l', 0, 'l', 0, 'e', 0, 'd', 0, ' ', 0, 'o', 0, 'u', 0, 't', 0, ' ', 0, 'o', 0, 'f', 0, ' ', 0, 's', 0, 'e', 0, 'q', 0, 'u', 0, 'e', 0, 'n', 0, 'c', 0, 'e', 0, 0, 0 }; const void *z; |
︙ | |||
723 724 725 726 727 728 729 | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | - + | const char *zFilename, /* Database filename UTF-8 encoded */ sqlite3 **ppDb /* OUT: Returned database handle */ ){ sqlite3 *db; int rc; CollSeq *pColl; |
︙ | |||
850 851 852 853 854 855 856 | 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | - + | zFilename8 = sqlite3ValueText(pVal, SQLITE_UTF8); if( zFilename8 ){ rc = openDatabase(zFilename8, ppDb); if( rc==SQLITE_OK && *ppDb ){ rc = sqlite3_exec(*ppDb, "PRAGMA encoding = 'UTF-16'", 0, 0, 0); } }else{ |
︙ | |||
1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | + + + + + + + + + + + | */ if( pTd->pBtree && !enable ){ assert( pTd->useSharedData ); return SQLITE_MISUSE; } pTd->useSharedData = enable; sqlite3ReleaseThreadData(); return SQLITE_OK; } #endif /* ** This is a convenience routine that makes sure that all thread-specific ** data for this thread has been deallocated. */ void sqlite3_thread_cleanup(void){ ThreadData *pTd = sqlite3ThreadData(); memset(pTd, 0, sizeof(*pTd)); sqlite3ReleaseThreadData(); } |
Changes to SQLite.Interop/src/opcodes.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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 64 65 66 67 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 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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | + + + + + + + + - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - | /* Automatically generated. Do not edit */ /* See the mkopcodec.awk script for details. */ #if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG) const char *const sqlite3OpcodeNames[] = { "?", /* 1 */ "MemLoad", /* 125 */ "HexBlob", /* 2 */ "Column", /* 3 */ "SetCookie", /* 4 */ "IfMemPos", /* 124 */ "Real", /* 5 */ "Sequence", /* 6 */ "MoveGt", /* 71 */ "Ge", /* 7 */ "RowKey", /* 67 */ "Eq", /* 8 */ "OpenWrite", /* 65 */ "NotNull", /* 9 */ "If", /* 140 */ "ToInt", /* 86 */ "String8", /* 10 */ "Pop", /* 11 */ "CollSeq", /* 12 */ "OpenRead", /* 13 */ "Expire", /* 14 */ "AutoCommit", /* 68 */ "Gt", /* 15 */ "IntegrityCk", |
Changes to SQLite.Interop/src/os.h.
︙ | |||
288 289 290 291 292 293 294 | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | - + | int sqlite3OsTempFileName(char*); int sqlite3OsRandomSeed(char*); int sqlite3OsSleep(int ms); int sqlite3OsCurrentTime(double*); void sqlite3OsEnterMutex(void); void sqlite3OsLeaveMutex(void); int sqlite3OsInMutex(void); |
︙ | |||
331 332 333 334 335 336 337 | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | - + | int (*xRandomSeed)(char*); int (*xSleep)(int ms); int (*xCurrentTime)(double*); void (*xEnterMutex)(void); void (*xLeaveMutex)(void); int (*xInMutex)(void); |
︙ |
Changes to SQLite.Interop/src/os_unix.c.
︙ | |||
1623 1624 1625 1626 1627 1628 1629 | 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 | - - - + + + - - - + + - - - + + + + + - + + + + + + + - - - - + + + + + + + + + + - + - + - + + - + - + + - - - - - - + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + | ** Return TRUE if we are currently within the mutex and FALSE if not. */ int sqlite3UnixInMutex(){ return inMutex; } /* |
︙ |
Changes to SQLite.Interop/src/os_win.c.
︙ | |||
40 41 42 43 44 45 46 47 | 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 80 81 82 | + + + + - + - - - - - - + + + + + - + - - - - - + + + - - - + | */ #if defined(_WIN32_WCE) # define OS_WINCE 1 #else # define OS_WINCE 0 #endif /* ** WinCE lacks native support for file locking so we have to fake it ** with some code of our own. */ #if OS_WINCE |
︙ | |||
120 121 122 123 124 125 126 | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | GetVersionEx(&sInfo); sqlite3_os_type = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1; } return sqlite3_os_type==2; } #endif /* OS_WINCE */ |
︙ | |||
214 215 216 217 218 219 220 | 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 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 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 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 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 397 398 399 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 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 | - + - - + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + - + - - + - - - - + + + + + + + + + + + + - + + - - - + + + - - + - - + + - - + - + + + - - - + + + + + + - - + + + - - + - + - - + + - + - - - + + - + - - - - + + + - + - - + - - + + + + - + - - + - - + - + - - + - + - - - + - + - - - + - - + - - + - - + + - - - + + + - - + + + + + + + + - - + + + - - + + - - + - - + + - - - - + + + + - + - - + + + - - - + + - - + + - + - - + - - - + + - + - - + - - - + + - + - + + + + + + + - + - - + + + - - + + - - + - + - + - - - + + + - + - - - + + - - + + + + + - - + - - + - - + - - - + + - + - - + - - - + + + + + + + - - - - + + + + + + + - - - + + - - - - - + + + + + + + + + - - + + + + | if( nByte == 0 ){ sqliteFree(zFilename); zFilename = 0; } return zFilename; } |
︙ | |||
557 558 559 560 561 562 563 | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | - - + + | sqliteFree(zWide); return SQLITE_CANTOPEN; } *pReadonly = 1; }else{ *pReadonly = 0; } |
︙ | |||
664 665 666 667 668 669 670 | 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | - - | return SQLITE_CANTOPEN; } f.h = h; f.locktype = NO_LOCK; f.sharedLockByte = 0; #if OS_WINCE f.zDeleteOnClose = delFlag ? utf8ToUnicode(zFilename) : 0; |
︙ | |||
716 717 718 719 720 721 722 | 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | - - | return SQLITE_CANTOPEN; } f.h = h; f.locktype = NO_LOCK; f.sharedLockByte = 0; #if OS_WINCE f.zDeleteOnClose = 0; |
︙ | |||
806 807 808 809 810 811 812 | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | - - + - | */ static int winClose(OsFile **pId){ winFile *pFile; if( pId && (pFile = (winFile*)*pId)!=0 ){ TRACE2("CLOSE %d\n", pFile->h); CloseHandle(pFile->h); #if OS_WINCE |
︙ | |||
1435 1436 1437 1438 1439 1440 1441 | 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 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 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | - - - - + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + - + - + + + - - - - - - + + + + + + + + + + + + + + | if( sqlite3_current_time ){ *prNow = sqlite3_current_time/86400.0 + 2440587.5; } #endif return 0; } |
Changes to SQLite.Interop/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. ** |
︙ | |||
280 281 282 283 284 285 286 | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | - + | int nRead,nWrite; /* Database pages read/written */ #endif void (*xDestructor)(void*,int); /* Call this routine when freeing pages */ void (*xReiniter)(void*,int); /* Call this routine when reloading pages */ void (*xCodec)(void*,void*,Pgno,int); /* Routine for en/decoding data */ void *pCodecArg; /* First argument to xCodec() */ PgHdr *aHash[N_PG_HASH]; /* Hash table to map page number to PgHdr */ |
︙ | |||
1614 1615 1616 1617 1618 1619 1620 | 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 | - - + + - + | int i; int tempFile = 0; int memDb = 0; int readOnly = 0; int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; int noReadlock = (flags & PAGER_NO_READLOCK)!=0; char zTemp[SQLITE_TEMPNAME_SIZE]; |
︙ | |||
1716 1717 1718 1719 1720 1721 1722 | 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 | - - + + + | pPager->pFirstSynced = 0; pPager->pLast = 0; pPager->nExtra = FORCE_ALIGNMENT(nExtra); pPager->sectorSize = PAGER_SECTOR_SIZE; pPager->pBusyHandler = 0; memset(pPager->aHash, 0, sizeof(pPager->aHash)); *ppPager = pPager; |
︙ | |||
2023 2024 2025 2026 2027 2028 2029 | 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 | - - + + | ** This function always succeeds. If a transaction is active an attempt ** is made to roll it back. If an error occurs during the rollback ** a hot journal may be left in the filesystem but no error is returned ** to the caller. */ int sqlite3pager_close(Pager *pPager){ PgHdr *pPg, *pNext; |
︙ | |||
2083 2084 2085 2086 2087 2088 2089 | 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 | - + + + + | sqlite3OsClose(&pPager->fd); /* Temp files are automatically deleted by the OS ** if( pPager->tempFile ){ ** sqlite3OsDelete(pPager->zFilename); ** } */ |
︙ | |||
2452 2453 2454 2455 2456 2457 2458 | 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 | - + - + | ** by the current thread may be sqliteFree()ed. ** ** nReq is the number of bytes of memory required. Once this much has ** been released, the function returns. A negative value for nReq means ** free as much memory as possible. The return value is the total number ** of bytes of memory released. */ |
︙ | |||
2477 2478 2479 2480 2481 2482 2483 | 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 | - + | ** iteration (which only runs if the first failed to free nReq bytes of ** memory) is permitted to call fsync(). This is of course much more ** expensive. */ for(i=0; i<=1; i++){ /* Loop through all the SQLite pagers opened by the current thread. */ |
︙ | |||
2523 2524 2525 2526 2527 2528 2529 | 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 | - + | pager_error(p, rc); } } } return nReleased; } |
︙ |
Changes to SQLite.Interop/src/pager.h.
︙ | |||
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. ** ************************************************************************* ** This header file defines the interface that the sqlite page cache ** subsystem. The page cache subsystem reads and writes a file a page ** at a time and provides a journal for rollback. ** |
︙ |
Changes to SQLite.Interop/src/parse.c.
︙ | |||
171 172 173 174 175 176 177 | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 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 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 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 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 397 398 399 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 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 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 574 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - + + + + + + - - + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - + + - + - - - - - + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + | ** yy_shift_ofst[] For each state, the offset into yy_action for ** shifting terminals. ** yy_reduce_ofst[] For each state, the offset into yy_action for ** shifting non-terminals after a reduce. ** yy_default[] Default action for each state. */ static const YYACTIONTYPE yy_action[] = { |
︙ |
Changes to SQLite.Interop/src/pragma.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 PRAGMA command. ** |
︙ | |||
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 | + | { "vdbe_trace", SQLITE_VdbeTrace }, { "sql_trace", SQLITE_SqlTrace }, { "vdbe_listing", SQLITE_VdbeListing }, { "full_column_names", SQLITE_FullColNames }, { "short_column_names", SQLITE_ShortColNames }, { "count_changes", SQLITE_CountRows }, { "empty_result_callbacks", SQLITE_NullCallback }, { "legacy_file_format", SQLITE_LegacyFileFmt }, #ifndef SQLITE_OMIT_CHECK { "ignore_check_constraints", SQLITE_IgnoreChecks }, #endif /* The following is VERY experimental */ { "writable_schema", SQLITE_WriteSchema }, { "omit_readlock", SQLITE_NoReadlock }, |
︙ | |||
804 805 806 807 808 809 810 | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 | - + + + + | sqlite3VdbeAddOp(v, OP_Callback, 1, 0); }else{ /* "PRAGMA encoding = XXX" */ /* Only change the value of sqlite.enc if the database handle is not ** initialized. If the main database exists, the new sqlite.enc value ** will be overwritten when the schema is next loaded. If it does not ** already exists, it will be created to use the new encoding value. */ |
︙ |
Changes to SQLite.Interop/src/prepare.c.
︙ | |||
9 10 11 12 13 14 15 | 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 | - + - + | ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains the implementation of the sqlite3_prepare() ** interface, and routines that contribute to loading the database schema ** from disk. ** |
︙ | |||
45 46 47 48 49 50 51 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | - + | ** */ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **azColName){ InitData *pData = (InitData*)pInit; sqlite3 *db = pData->db; int iDb; |
︙ | |||
150 151 152 153 154 155 156 | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | - - - - - - - - - - - - - - - - - - - - | ")" ; #else #define temp_master_schema 0 #endif assert( iDb>=0 && iDb<db->nDb ); |
︙ | |||
208 209 210 211 212 213 214 | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | - + + + | } sqlite3SafetyOn(db); /* Create a cursor to hold the database open */ pDb = &db->aDb[iDb]; if( pDb->pBt==0 ){ |
︙ | |||
268 269 270 271 272 273 274 275 276 277 278 279 280 281 | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | + + | if( meta[4]!=ENC(db) ){ sqlite3BtreeCloseCursor(curMain); sqlite3SetString(pzErrMsg, "attached databases must use the same" " text encoding as main database", (char*)0); return SQLITE_ERROR; } } }else{ DbSetProperty(db, iDb, DB_Empty); } pDb->pSchema->enc = ENC(db); size = meta[2]; if( size==0 ){ size = MAX_PAGES; } pDb->pSchema->cache_size = size; sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); |
︙ | |||
315 316 317 318 319 320 321 | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | - + | #ifndef SQLITE_OMIT_ANALYZE if( rc==SQLITE_OK ){ sqlite3AnalysisLoad(db, iDb); } #endif sqlite3BtreeCloseCursor(curMain); } |
︙ | |||
339 340 341 342 343 344 345 346 347 | 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 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | + - + + - + - - - - - + - - - + + - - | ** error occurs, write an error message into *pzErrMsg. ** ** After the database is initialized, the SQLITE_Initialized ** bit is set in the flags field of the sqlite structure. */ int sqlite3Init(sqlite3 *db, char **pzErrMsg){ int i, rc; int called_initone = 0; if( db->init.busy ) return SQLITE_OK; |
︙ | |||
511 512 513 514 515 516 517 | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | - + | const char** pzTail /* OUT: End of parsed string */ ){ Parse sParse; char *zErrMsg = 0; int rc = SQLITE_OK; int i; |
︙ | |||
534 535 536 537 538 539 540 541 542 | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | + + - + | sqlite3SafetyOff(db); return SQLITE_LOCKED; } } memset(&sParse, 0, sizeof(sParse)); sParse.db = db; sParse.pTsd = sqlite3ThreadData(); sParse.pTsd->nRef++; sqlite3RunParser(&sParse, zSql, &zErrMsg); |
︙ | |||
586 587 588 589 590 591 592 | 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | - + + + | }else{ sqlite3Error(db, rc, 0); } /* We must check for malloc failure last of all, in case malloc() failed ** inside of the sqlite3Error() call above or something. */ |
︙ |
Changes to SQLite.Interop/src/random.c.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - + | ************************************************************************* ** This file contains code to implement a pseudo-random number ** generator (PRNG) for SQLite. ** ** Random numbers are used by some of the database backends in order ** to generate random integer keys for tables or random filenames. ** |
︙ |
Changes to SQLite.Interop/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. ** |
︙ | |||
868 869 870 871 872 873 874 | 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 | - + + | /* If this is an EXPLAIN, skip this step */ if( pParse->explain ){ return; } #endif assert( v!=0 ); |
︙ | |||
997 998 999 1000 1001 1002 1003 | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | - + | /* Use the original text of the column expression as its name */ zName = sqlite3MPrintf("%T", &p->span); }else{ /* If all else fails, make up a name */ zName = sqlite3MPrintf("column%d", i+1); } sqlite3Dequote(zName); |
︙ | |||
1069 1070 1071 1072 1073 1074 1075 | 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 | - + + + | static int prepSelectStmt(Parse *pParse, Select *p){ int i, j, k, rc; SrcList *pTabList; ExprList *pEList; Table *pTab; struct SrcList_item *pFrom; |
︙ | |||
2686 2687 2688 2689 2690 2691 2692 | 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 | - + + + | int isDistinct; /* True if the DISTINCT keyword is present */ int distinct; /* Table to use for the distinct set */ int rc = 1; /* Value to return from this function */ int addrSortIndex; /* Address of an OP_OpenVirtual instruction */ AggInfo sAggInfo; /* Information used by aggregate queries */ int iEnd; /* Address of the end of the query */ |
︙ | |||
2940 2941 2942 2943 2944 2945 2946 | 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 | - + | } sAggInfo.nAccumulator = sAggInfo.nColumn; for(i=0; i<sAggInfo.nFunc; i++){ if( sqlite3ExprAnalyzeAggList(&sNC, sAggInfo.aFunc[i].pExpr->pList) ){ goto select_end; } } |
︙ |
Changes to SQLite.Interop/src/server.c.
︙ | |||
58 59 60 61 62 63 64 | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | - + - | ** to SQLite version 3.3.0 it probably was not worth the trouble. But ** with SQLite version 3.3.0 and beyond you can get significant performance ** and concurrency improvements and memory usage reductions by going ** client/server. ** ** Note: The extra features of version 3.3.0 described by points (2) ** through (4) above are only available if you compile without the |
︙ | |||
252 253 254 255 256 257 258 | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | - + | ** sqlite3_prepare ** sqlite3_step ** sqlite3_reset ** sqlite3_finalize ** sqlite3_close ** ** Clients should use the following client-side routines instead of |
︙ | |||
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | + + | ** This routine implements the server. To start the server, first ** make sure g.serverHalt is false, then create a new detached thread ** on this procedure. See the sqlite3_server_start() routine below ** for an example. This procedure loops until g.serverHalt becomes ** true. */ void *sqlite3_server(void *NotUsed){ sqlite3_enable_shared_cache(1); if( pthread_mutex_trylock(&g.serverMutex) ){ sqlite3_enable_shared_cache(0); return 0; /* Another server is already running */ } while( !g.serverHalt ){ SqlMessage *pMsg; /* Remove the last message from the message queue. */ |
︙ | |||
389 390 391 392 393 394 395 396 397 398 399 400 401 402 | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | + | /* Signal the client that the message has been processed. */ pMsg->op = MSG_Done; pthread_mutex_unlock(&pMsg->clientMutex); pthread_cond_signal(&pMsg->clientWakeup); } pthread_mutex_unlock(&g.serverMutex); sqlite3_thread_cleanup(); return 0; } /* ** Start a server thread if one is not already running. If there ** is aleady a server thread running, the new thread will quickly ** die and this routine is effectively a no-op. |
︙ |
Changes to SQLite.Interop/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. ** |
︙ |
Changes to SQLite.Interop/src/sqlite3.def.
︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | - | sqlite3_complete16 sqlite3_create_collation sqlite3_create_collation16 sqlite3_create_function sqlite3_create_function16 sqlite3_data_count sqlite3_db_handle |
︙ | |||
60 61 62 63 64 65 66 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | - - - + + | sqlite3_libversion_number sqlite3_mprintf sqlite3_open sqlite3_open16 sqlite3_prepare sqlite3_prepare16 sqlite3_progress_handler |
︙ |
Changes to SQLite.Interop/src/sqlite3.h.
︙ | |||
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 header file defines the interface that the SQLite library ** presents to client programs. ** |
︙ | |||
188 189 190 191 192 193 194 195 196 197 198 199 200 201 | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | + | #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ #define SQLITE_AUTH 23 /* Authorization denied */ #define SQLITE_FORMAT 24 /* Auxiliary database format error */ #define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ #define SQLITE_NOTADB 26 /* File opened that is not a database file */ #define SQLITE_ROW 100 /* sqlite3_step() has another row ready */ #define SQLITE_DONE 101 /* sqlite3_step() has finished executing */ /* end-of-return-codes */ /* ** Each entry in an SQLite table has a unique integer key. (The key is ** the value of the INTEGER PRIMARY KEY column if there is such a column, ** otherwise the key is generated at random. The unique key is always ** available as the ROWID, OID, or _ROWID_ column.) The following routine ** returns the integer key of the most recent insert in the database. |
︙ | |||
1325 1326 1327 1328 1329 1330 1331 | 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 | - - - - - - - - - - + + - - + + + + + + + + + + + + + + + | ** This function is only available if the library is compiled without ** the SQLITE_OMIT_SHARED_CACHE macro defined. It is used to enable or ** disable (if the argument is true or false, respectively) the ** "shared pager" feature. */ int sqlite3_enable_shared_cache(int); |
Changes to SQLite.Interop/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. ** |
︙ | |||
282 283 284 285 286 287 288 | 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 | - + + + + + + - - + + - + - - + | #endif #define sqliteFree(x) sqlite3FreeX(x) #define sqliteAllocSize(x) sqlite3AllocSize(x) /* |
︙ | |||
393 394 395 396 397 398 399 400 401 | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | + - | int schema_cookie; /* Database schema version number for this file */ Hash tblHash; /* All tables indexed by name */ Hash idxHash; /* All (named) indices indexed by name */ Hash trigHash; /* All triggers indexed by name */ Hash aFKey; /* Foreign keys indexed by to-table */ Table *pSeqTab; /* The sqlite_sequence table used by AUTOINCREMENT */ u8 file_format; /* Schema format version for this file */ u8 enc; /* Text encoding used by this database */ u16 flags; /* Flags associated with this schema */ int cache_size; /* Number of pages to use in the cache */ |
︙ | |||
419 420 421 422 423 424 425 426 427 428 429 430 431 432 | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | + | ** ** DB_UnresetViews means that one or more views have column names that ** have been filled out. If the schema changes, these column names might ** changes and so the view will need to be reset. */ #define DB_SchemaLoaded 0x0001 /* The schema has been loaded */ #define DB_UnresetViews 0x0002 /* Some views have defined column names */ #define DB_Empty 0x0004 /* The file is empty (length 0 bytes) */ #define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE) /* ** Each database is an instance of the following structure. ** ** The sqlite.lastRowid records the last insert rowid generated by an |
︙ | |||
518 519 520 521 522 523 524 | 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 | - + | ** Possible values for the sqlite.flags and or Db.flags fields. ** ** On sqlite.flags, the SQLITE_InTrans value means that we have ** executed a BEGIN. On Db.flags, SQLITE_InTrans means a statement ** transaction is active on that particular database file. */ #define SQLITE_VdbeTrace 0x00000001 /* True to trace VDBE execution */ |
︙ | |||
1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 | 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 | + | int nErr; /* Number of errors seen */ int nTab; /* Number of previously allocated VDBE cursors */ int nMem; /* Number of memory cells used so far */ int nSet; /* Number of sets used so far */ int ckOffset; /* Stack offset to data used by CHECK constraints */ u32 writeMask; /* Start a write transaction on these databases */ u32 cookieMask; /* Bitmask of schema verified databases */ ThreadData *pTsd; /* Thread specific data for this thread */ int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */ int cookieValue[MAX_ATTACHED+2]; /* Values of cookies to verify */ #ifndef SQLITE_OMIT_SHARED_CACHE int nTableLock; /* Number of locks in aTableLock */ TableLock *aTableLock; /* Required table locks for shared-cache mode */ #endif |
︙ | |||
1726 1727 1728 1729 1730 1731 1732 | 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 | - + + + | void sqlite3Analyze(Parse*, Token*, Token*); int sqlite3InvokeBusyHandler(BusyHandler*); int sqlite3FindDb(sqlite3*, Token*); void sqlite3AnalysisLoad(sqlite3*,int iDB); void sqlite3DefaultRowEst(Index*); void sqlite3RegisterLikeFunctions(sqlite3*, int); int sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*); |
︙ |
Changes to SQLite.Interop/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 ** |
︙ |
Changes to SQLite.Interop/src/tokenize.c.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - + | ************************************************************************* ** An tokenizer for SQL ** ** This file contains C code that splits an SQL input string up into ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** |
︙ | |||
257 258 259 260 261 262 263 | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | - + + | } /* Fall through into the next case if the '#' is not followed by ** a digit. Try to match #AAAA where AAAA is a parameter name. */ } #ifndef SQLITE_OMIT_TCL_VARIABLE case '$': #endif |
︙ | |||
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 | 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 367 368 369 370 | + - + | int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ int nErr = 0; int i; void *pEngine; int tokenType; int lastTokenParsed = -1; sqlite3 *db = pParse->db; ThreadData *pTsd = pParse->pTsd; extern void *sqlite3ParserAlloc(void*(*)(int)); extern void sqlite3ParserFree(void*, void(*)(void*)); extern int sqlite3Parser(void*, int, Token, Parse*); db->flags &= ~SQLITE_Interrupt; pParse->rc = SQLITE_OK; i = 0; pEngine = sqlite3ParserAlloc((void*(*)(int))sqlite3MallocX); if( pEngine==0 ){ return SQLITE_NOMEM; } assert( pParse->sLastToken.dyn==0 ); assert( pParse->pNewTable==0 ); assert( pParse->pNewTrigger==0 ); assert( pParse->nVar==0 ); assert( pParse->nVarExpr==0 ); assert( pParse->nVarExprAlloc==0 ); assert( pParse->apVarExpr==0 ); pParse->zTail = pParse->zSql = zSql; |
︙ | |||
402 403 404 405 406 407 408 | 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | - + | if( lastTokenParsed!=TK_SEMI ){ sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse); pParse->zTail = &zSql[i]; } sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse); } sqlite3ParserFree(pEngine, sqlite3FreeX); |
︙ |
Changes to SQLite.Interop/src/trigger.c.
︙ | |||
77 78 79 80 81 82 83 | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - + + + - + | } /* If the trigger name was unqualified, and the table is a temp table, ** then set iDb to 1 to create the trigger in the temporary database. ** If sqlite3SrcListLookup() returns 0, indicating the table does not ** exist, the error is caught by the block below. */ |
︙ | |||
251 252 253 254 255 256 257 | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | - + | if( db->init.busy ){ int n; Table *pTab; Trigger *pDel; pDel = sqlite3HashInsert(&db->aDb[iDb].pSchema->trigHash, pTrig->name, strlen(pTrig->name)+1, pTrig); if( pDel ){ |
︙ | |||
435 436 437 438 439 440 441 | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | - + | Trigger *pTrigger = 0; int i; const char *zDb; const char *zName; int nName; sqlite3 *db = pParse->db; |
︙ |
Changes to SQLite.Interop/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 | - + | ** 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. ** |
︙ | |||
96 97 98 99 100 101 102 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | - + + + | int triggers_exist = 0; /* True if any row triggers exist */ #endif int newIdx = -1; /* index of trigger "new" temp table */ int oldIdx = -1; /* index of trigger "old" temp table */ sContext.pParse = 0; |
︙ |
Changes to SQLite.Interop/src/utf.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 to translate between UTF-8, ** UTF-16, UTF-16BE, and UTF-16LE. ** |
︙ |
Changes to SQLite.Interop/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. ** |
︙ | |||
62 63 64 65 66 67 68 | 62 63 64 65 66 67 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 | - + + - + | ** * Guardposts to detect overwrites. ** * Ability to cause a specific Malloc() or Realloc() to fail. ** * Audit outstanding memory allocations (i.e check for leaks). */ #define MAX(x,y) ((x)>(y)?(x):(y)) |
︙ | |||
117 118 119 120 121 122 123 | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | + - + + | #endif /* ** Number of 32-bit guard words. This should probably be a multiple of ** 2 since on 64-bit machines we want the value returned by sqliteMalloc() ** to be 8-byte aligned. */ #ifndef TESTALLOC_NGUARD |
︙ | |||
430 431 432 433 434 435 436 | 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | - + + | } #endif /* ** This is the test layer's wrapper around sqlite3OsMalloc(). */ static void * OSMALLOC(int n){ |
︙ | |||
471 472 473 474 475 476 477 | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | - + + | sqlite3_nFree++; } /* ** This is the test layer's wrapper around sqlite3OsRealloc(). */ static void * OSREALLOC(void *pRealloc, int n){ |
︙ | |||
500 501 502 503 504 505 506 | 505 506 507 508 509 510 511 512 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 | - + - + + - + + + + - - + | */ #define OSMALLOC(x) sqlite3OsMalloc(x) #define OSREALLOC(x,y) sqlite3OsRealloc(x,y) #define OSFREE(x) sqlite3OsFree(x) #define OSSIZEOF(x) sqlite3OsAllocationSize(x) #define OSMALLOC_FAILED() |
︙ | |||
560 561 562 563 564 565 566 | 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | - - + - + | /* ** Resize the allocation at p to n bytes by calling sqlite3OsRealloc(). The ** pointer to the new allocation is returned. If the Realloc() call fails, ** attempt to free memory by calling sqlite3_release_memory(). */ void *sqlite3Realloc(void *p, int n){ |
︙ | |||
1302 1303 1304 1305 1306 1307 1308 | 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 | - - + + + - - - - - + + + + - - - - + + + + + + + + + + + + + + - + - - + - - - - - - - + - - - - - - - - - - - - + + - - + + | } #endif /* ** Return a pointer to the ThreadData associated with the calling thread. */ ThreadData *sqlite3ThreadData(){ |
Changes to SQLite.Interop/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. ** |
︙ | |||
99 100 101 102 103 104 105 | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | - + | int nFilename; /* number of characters in zFilename[] */ char *zTemp = 0; /* a temporary file in same directory as zFilename */ Btree *pMain; /* The database being vacuumed */ Btree *pTemp; char *zSql = 0; int rc2; int saved_flags; /* Saved value of the db->flags */ |
︙ | |||
146 147 148 149 150 151 152 | 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 | - - - - - - - - - + | ** that we don't even bother to set a maximum loop count. */ do { zTemp[nFilename] = '-'; randomName((unsigned char*)&zTemp[nFilename+1]); } while( sqlite3OsFileExists(zTemp) ); |
︙ | |||
306 307 308 309 310 311 312 | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | - + - - - - + - - - - - + + | ** was committed at the btree level). So it safe to end the transaction ** by manually setting the autoCommit flag to true and detaching the ** vacuum database. The vacuum_db journal file is deleted when the pager ** is closed by the DETACH. */ db->autoCommit = 1; |
︙ |
Changes to SQLite.Interop/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 | - + | ** ** 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. ** |
︙ | |||
375 376 377 378 379 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 412 413 414 | 375 376 377 378 379 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 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | + + + - + | int sqlite3VdbeExec( Vdbe *p /* The VDBE */ ){ int pc; /* The program counter */ Op *pOp; /* Current operation */ int rc = SQLITE_OK; /* Value to return */ sqlite3 *db = p->db; /* The database */ u8 encoding = ENC(db); /* The database encoding */ Mem *pTos; /* Top entry in the operand stack */ #ifdef VDBE_PROFILE unsigned long long start; /* CPU clock count at start of opcode */ int origPc; /* Program counter at start of opcode */ #endif #ifndef SQLITE_OMIT_PROGRESS_CALLBACK int nProgressOps = 0; /* Opcodes executed since progress callback. */ #endif #ifndef NDEBUG Mem *pStackLimit; #endif ThreadData *pTsd = sqlite3ThreadData(); if( p->magic!=VDBE_MAGIC_RUN ) return SQLITE_MISUSE; pTsd->nRef++; assert( db->magic==SQLITE_MAGIC_BUSY ); pTos = p->pTos; if( p->rc==SQLITE_NOMEM ){ /* This happens if a malloc() inside a call to sqlite3_column_text() or ** sqlite3_column_text16() failed. */ goto no_mem; } assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY ); p->rc = SQLITE_OK; assert( p->explain==0 ); if( p->popStack ){ popStack(&pTos, p->popStack); p->popStack = 0; } p->resOnStack = 0; db->busyHandler.nBusy = 0; CHECK_FOR_INTERRUPT; for(pc=p->pc; rc==SQLITE_OK; pc++){ assert( pc>=0 && pc<p->nOp ); assert( pTos<=&p->aStack[pc] ); |
︙ | |||
588 589 590 591 592 593 594 595 596 597 598 599 600 601 | 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | + | p->pc = pc; p->errorAction = pOp->p2; if( pOp->p3 ){ sqlite3SetString(&p->zErrMsg, pOp->p3, (char*)0); } rc = sqlite3VdbeHalt(p); assert( rc==SQLITE_BUSY || rc==SQLITE_OK ); pTsd->nRef--; if( rc==SQLITE_BUSY ){ p->rc = SQLITE_BUSY; return SQLITE_BUSY; } return p->rc ? SQLITE_ERROR : SQLITE_DONE; } |
︙ | |||
635 636 637 638 639 640 641 | 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | - + - + - + | pTos++; pTos->flags = MEM_Str|MEM_Static|MEM_Term; pTos->z = pOp->p3; pTos->n = strlen(pTos->z); pTos->enc = SQLITE_UTF8; pTos->r = sqlite3VdbeRealValue(pTos); pTos->flags |= MEM_Real; |
︙ | |||
680 681 682 683 684 685 686 | 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | - + | */ case OP_String: { pTos++; assert( pOp->p3!=0 ); pTos->flags = MEM_Str|MEM_Static|MEM_Term; pTos->z = pOp->p3; pTos->n = pOp->p1; |
︙ | |||
884 885 886 887 888 889 890 | 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 | - + + | /* Make sure the results of the current row are \000 terminated ** and have an assigned type. The results are deephemeralized as ** as side effect. */ for(; pMem<=pTos; pMem++ ){ sqlite3VdbeMemNulTerminate(pMem); |
︙ | |||
925 926 927 928 929 930 931 | 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | - + | nByte = 0; for(i=0; i<nField; i++, pTerm++){ assert( pOp->p2==0 || (pTerm->flags&MEM_Str) ); if( pTerm->flags&MEM_Null ){ nByte = -1; break; } |
︙ | |||
964 965 966 967 968 969 970 | 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 | - + | if( pOp->p2==0 ){ popStack(&pTos, nField); } pTos++; pTos->n = j; pTos->flags = MEM_Str|MEM_Dyn|MEM_Term; pTos->xDel = 0; |
︙ | |||
1138 1139 1140 1141 1142 1143 1144 | 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 | - + | apVal = p->apArg; assert( apVal || n==0 ); pArg = &pTos[1-n]; for(i=0; i<n; i++, pArg++){ apVal[i] = pArg; |
︙ | |||
1163 1164 1165 1166 1167 1168 1169 | 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 | - + - + - + | assert( pOp[-1].p3type==P3_COLLSEQ ); assert( pOp[-1].opcode==OP_CollSeq ); ctx.pColl = (CollSeq *)pOp[-1].p3; } if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse; (*ctx.pFunc->xFunc)(&ctx, n, apVal); if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse; |
︙ | |||
1280 1281 1282 1283 1284 1285 1286 | 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 | - + | ** convert it into the least integer that is greater than or equal to its ** current value if P1==0, or to the least integer that is strictly ** greater than its current value if P1==1. */ case OP_ForceInt: { /* no-push */ i64 v; assert( pTos>=p->aStack ); |
︙ | |||
1315 1316 1317 1318 1319 1320 1321 | 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 | - + | ** ** If the top of the stack is not an integer and P2 is not zero and ** P1 is 1, then the stack is popped. In all other cases, the depth ** of the stack is unchanged. */ case OP_MustBeInt: { /* no-push */ assert( pTos>=p->aStack ); |
︙ | |||
1363 1364 1365 1366 1367 1368 1369 | 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 | - + - + | ** A NULL value is not changed by this routine. It remains NULL. */ case OP_ToText: { /* same as TK_TO_TEXT, no-push */ assert( pTos>=p->aStack ); if( pTos->flags & MEM_Null ) break; assert( MEM_Str==(MEM_Blob>>3) ); pTos->flags |= (pTos->flags&MEM_Blob)>>3; |
︙ | |||
1563 1564 1565 1566 1567 1568 1569 | 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 | - - + + | } break; } } affinity = pOp->p1 & 0xFF; if( affinity ){ |
︙ | |||
2064 2065 2066 2067 2068 2069 2070 | 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 | - + | rc = sqlite3VdbeMemFromBtree(pCrsr, aOffset[p2], len, pC->isIndex,&sMem); if( rc!=SQLITE_OK ){ goto op_column_out; } zData = sMem.z; } sqlite3VdbeSerialGet((u8*)zData, aType[p2], pTos); |
︙ | |||
2188 2189 2190 2191 2192 2193 2194 | 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 | - + | file_format = p->minWriteFileFormat; /* Loop through the elements that will make up the record to figure ** out how much space is required for the new record. */ for(pRec=pData0; pRec<=pTos; pRec++){ if( zAffinity ){ |
︙ | |||
2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 | 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 | + | ** still running, and a transaction is active, return an error indicating ** that the other VMs must complete first. */ sqlite3SetString(&p->zErrMsg, "cannot ", rollback?"rollback":"commit", " transaction - SQL statements in progress", (char*)0); rc = SQLITE_ERROR; }else if( i!=db->autoCommit ){ pTsd->nRef--; if( pOp->p2 ){ assert( i==1 ); sqlite3RollbackAll(db); db->autoCommit = 1; }else{ db->autoCommit = i; if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){ |
︙ | |||
2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 | 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 | + | if( pBt ){ rc = sqlite3BtreeBeginTrans(pBt, pOp->p2); if( rc==SQLITE_BUSY ){ p->pc = pc; p->rc = SQLITE_BUSY; p->pTos = pTos; pTsd->nRef--; return SQLITE_BUSY; } if( rc!=SQLITE_OK && rc!=SQLITE_READONLY /* && rc!=SQLITE_BUSY */ ){ goto abort_due_to_error; } } break; |
︙ | |||
2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 | 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 | + | pCur->pIncrKey = &pCur->bogusIncrKey; } switch( rc ){ case SQLITE_BUSY: { p->pc = pc; p->rc = SQLITE_BUSY; p->pTos = &pTos[1 + (pOp->p2<=0)]; /* Operands must remain on stack */ pTsd->nRef--; return SQLITE_BUSY; } case SQLITE_OK: { int flags = sqlite3BtreeFlags(pCur->pCursor); /* Sanity checking. Only the lower four bits of the flags byte should ** be used. Bit 3 (mask 0x08) is unpreditable. The lower 3 bits ** (mask 0x07) should be either 5 (intkey+leafdata for tables) or |
︙ | |||
2796 2797 2798 2799 2800 2801 2802 | 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 | - + | if( rc!=SQLITE_OK ){ goto abort_due_to_error; } pC->lastRowid = pTos->i; pC->rowidIsValid = res==0; }else{ assert( pTos->flags & MEM_Blob ); |
︙ | |||
2901 2902 2903 2904 2905 2906 2907 | 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 | - + | Cursor *pC; assert( pTos>=p->aStack ); assert( i>=0 && i<p->nCursor ); assert( p->apCsr[i]!=0 ); if( (pC = p->apCsr[i])->pCursor!=0 ){ int res, rx; assert( pC->isTable==0 ); |
︙ | |||
2968 2969 2970 2971 2972 2973 2974 | 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 | - + | char *zKey; /* The value of K */ int nKey; /* Number of bytes in K */ int len; /* Number of bytes in K without the rowid at the end */ int szRowid; /* Size of the rowid column at the end of zKey */ /* Make sure K is a string and make zKey point to K */ |
︙ | |||
3799 3800 3801 3802 3803 3804 3805 | 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 | - + | assert( i>=0 && i<p->nCursor ); assert( p->apCsr[i]!=0 ); assert( pTos>=p->aStack ); if( (pC = p->apCsr[i])->pCursor!=0 ){ int res, rc; assert( pTos->flags & MEM_Blob ); /* Created using OP_Make*Key */ |
︙ | |||
4016 4017 4018 4019 4020 4021 4022 | 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 | - + - + | zSql = sqlite3MPrintf( "SELECT name, rootpage, sql, %d FROM '%q'.%s WHERE %s", pOp->p1, db->aDb[iDb].zName, zMaster, pOp->p3); if( zSql==0 ) goto no_mem; sqlite3SafetyOff(db); assert( db->init.busy==0 ); db->init.busy = 1; |
︙ | |||
4128 4129 4130 4131 4132 4133 4134 | 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 | - + | }else{ pTos->z = z; pTos->n = strlen(z); pTos->flags = MEM_Str | MEM_Dyn | MEM_Term; pTos->xDel = 0; } pTos->enc = SQLITE_UTF8; |
︙ | |||
4404 4405 4406 4407 4408 4409 4410 | 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 | - + | assert( n>=0 ); pRec = &pTos[1-n]; assert( pRec>=p->aStack ); apVal = p->apArg; assert( apVal || n==0 ); for(i=0; i<n; i++, pRec++){ apVal[i] = pRec; |
︙ | |||
4549 4550 4551 4552 4553 4554 4555 | 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 | - + | ** of the program. It is only here for testing and debugging. ** On the other hand, it does burn CPU cycles every time through ** the evaluator loop. So we can leave it out when NDEBUG is defined. */ #ifndef NDEBUG /* Sanity checking on the top element of the stack */ if( pTos>=p->aStack ){ |
︙ | |||
4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 | 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 | + | p->rc = rc; rc = SQLITE_ERROR; }else{ rc = SQLITE_DONE; } sqlite3VdbeHalt(p); p->pTos = pTos; pTsd->nRef--; return rc; /* Jump to here if a malloc() fails. It's hard to get a malloc() ** to fail on a modern VM computer, so this code is untested. */ no_mem: sqlite3SetString(&p->zErrMsg, "out of memory", (char*)0); |
︙ | |||
4612 4613 4614 4615 4616 4617 4618 | 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 | - + | /* Fall thru into abort_due_to_error */ /* Jump to here for any other kind of fatal error. The "rc" variable ** should hold the error number. */ abort_due_to_error: if( p->zErrMsg==0 ){ |
︙ |
Changes to SQLite.Interop/src/vdbe.h.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - + | ************************************************************************* ** Header file for the Virtual DataBase Engine (VDBE) ** ** This header defines the interface to the virtual database engine ** or VDBE. The VDBE implements an abstract machine that runs a ** simple program to access and modify the underlying database. ** |
︙ |
Changes to SQLite.Interop/src/vdbeapi.c.
︙ | |||
152 153 154 155 156 157 158 | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | - + | ** statement is completely executed or an error occurs. */ int sqlite3_step(sqlite3_stmt *pStmt){ Vdbe *p = (Vdbe*)pStmt; sqlite3 *db; int rc; |
︙ | |||
400 401 402 403 404 405 406 | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | - + | static void columnMallocFailure(sqlite3_stmt *pStmt) { /* If malloc() failed during an encoding conversion within an ** sqlite3_column_XXX API, then set the return code of the statement to ** SQLITE_NOMEM. The next call to _step() (if any) will return SQLITE_ERROR ** and _finalize() will return NOMEM. */ |
︙ |
Changes to SQLite.Interop/src/vdbeaux.c.
︙ | |||
98 99 100 101 102 103 104 | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | - + | int i; VdbeOp *pOp; i = p->nOp; p->nOp++; assert( p->magic==VDBE_MAGIC_INIT ); resizeOpArray(p, i+1); |
︙ | |||
297 298 299 300 301 302 303 | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | - + | ** Add a whole list of operations to the operation stack. Return the ** address of the first operation added. */ int sqlite3VdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){ int addr; assert( p->magic==VDBE_MAGIC_INIT ); resizeOpArray(p, p->nOp + nOp); |
︙ | |||
411 412 413 414 415 416 417 | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | - + | ** the Vdbe. In these cases we can just copy the pointer. ** ** If addr<0 then change P3 on the most recently inserted instruction. */ void sqlite3VdbeChangeP3(Vdbe *p, int addr, const char *zP3, int n){ Op *pOp; assert( p->magic==VDBE_MAGIC_INIT ); |
︙ | |||
468 469 470 471 472 473 474 | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | - + + | /* ** Replace the P3 field of the most recently coded instruction with ** comment text. */ void sqlite3VdbeComment(Vdbe *p, const char *zFormat, ...){ va_list ap; assert( p->nOp>0 ); |
︙ | |||
734 735 736 737 738 739 740 | 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | - + | nStack*sizeof(p->aStack[0]) /* aStack */ + nArg*sizeof(Mem*) /* apArg */ + nVar*sizeof(Mem) /* aVar */ + nVar*sizeof(char*) /* azVar */ + nMem*sizeof(Mem) /* aMem */ + nCursor*sizeof(Cursor*) /* apCsr */ ); |
︙ | |||
886 887 888 889 890 891 892 | 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 | - + | ** the string is freed using sqliteFree() when the vdbe is finished with ** it. Otherwise, N bytes of zName are copied. */ int sqlite3VdbeSetColName(Vdbe *p, int idx, const char *zName, int N){ int rc; Mem *pColName; assert( idx<(2*p->nResColumn) ); |
︙ | |||
1149 1150 1151 1152 1153 1154 1155 | 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 | - + | ** means the close did not happen and needs to be repeated. */ int sqlite3VdbeHalt(Vdbe *p){ sqlite3 *db = p->db; int i; int (*xFunc)(Btree *pBt) = 0; /* Function to call on each btree backend */ |
︙ | |||
1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 | 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 | + + + + + + + + + + + + + + + + + | } return len; } } return 0; } /* ** The header of a record consists of a sequence variable-length integers. ** These integers are almost always small and are encoded as a single byte. ** The following macro takes advantage this fact to provide a fast decode ** of the integers in a record header. It is faster for the common case ** where the integer is a single byte. It is a little slower when the ** integer is two or more bytes. But overall it is faster. ** ** The following expressions are equivalent: ** ** x = sqlite3GetVarint32( A, &B ); ** ** x = GetVarint( A, B ); ** */ #define GetVarint(A,B) ((B = *(A))<=0x7f ? 1 : sqlite3GetVarint32(A, &B)) /* ** This function compares the two table rows or index records specified by ** {nKey1, pKey1} and {nKey2, pKey2}, returning a negative, zero ** or positive integer if {nKey1, pKey1} is less than, equal to or ** greater than {nKey2, pKey2}. Both Key1 and Key2 must be byte strings ** composed by the OP_MakeRecord opcode of the VDBE. */ |
︙ | |||
1702 1703 1704 1705 1706 1707 1708 | 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 | - + - + - + - + | const unsigned char *aKey2 = (const unsigned char *)pKey2; Mem mem1; Mem mem2; mem1.enc = pKeyInfo->enc; mem2.enc = pKeyInfo->enc; |
︙ |
Changes to SQLite.Interop/src/vdbemem.c.
︙ | |||
747 748 749 750 751 752 753 754 755 756 757 758 | 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | + + - + | const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){ if( !pVal ) return 0; assert( enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE || enc==SQLITE_UTF8); if( pVal->flags&MEM_Null ){ return 0; } assert( (MEM_Blob>>3) == MEM_Str ); pVal->flags |= (pVal->flags & MEM_Blob)>>3; if( pVal->flags&MEM_Str ){ sqlite3VdbeChangeEncoding(pVal, enc); }else if( !(pVal->flags&MEM_Blob) ){ sqlite3VdbeMemStringify(pVal, enc); } |
︙ |
Changes to SQLite.Interop/src/where.c.
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - + | ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. This module is reponsible for ** generating the code that loops through a table looking for applicable ** rows. Indices are selected and used to speed the search when doing ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** |
︙ | |||
563 564 565 566 567 568 569 | 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | - + | WhereTerm *pTerm = &pWC->a[idxTerm]; Expr *pExpr = pTerm->pExpr; Bitmask prereqLeft; Bitmask prereqAll; int nPattern; int isComplete; |
︙ | |||
1434 1435 1436 1437 1438 1439 1440 | 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 | - + | whereClauseInit(&wc, pParse); whereSplit(&wc, pWhere, TK_AND); /* Allocate and initialize the WhereInfo structure that will become the ** return value. */ pWInfo = sqliteMalloc( sizeof(WhereInfo) + pTabList->nSrc*sizeof(WhereLevel)); |
︙ | |||
1458 1459 1460 1461 1462 1463 1464 | 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 | - + | ** want to analyze these virtual terms, so start analyzing at the end ** and work forward so that the added virtual terms are never processed. */ for(i=0; i<pTabList->nSrc; i++){ createMask(&maskSet, pTabList->a[i].iCursor); } exprAnalyzeAll(pTabList, &maskSet, &wc); |
︙ |