Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch pragma-onconflict Excluding Merge-Ins
This is equivalent to a diff from 3c36948f16 to 3e5d38f5b3
2016-02-27
| ||
19:19 | Tighter description of I/O stats in the shell. Show I/O stats on speedtest1.c. (check-in: f681d80034 user: drh tags: trunk) | |
19:03 | More compact implementation of PRAGMA onconflict, and some test cases. (Leaf check-in: 3e5d38f5b3 user: drh tags: pragma-onconflict) | |
17:16 | Experimental "PRAGMA onconflict=FAIL" statement to change the default ON CONFLICT algorithm to something other than ABORT. (check-in: 3a0c347cca user: drh tags: pragma-onconflict) | |
17:12 | Enhance the ".stats" command in sqlite3.exe to show one-time stats information if invoked with one argument. Also show /proc/PID/io information if run on Linux. (check-in: 3c36948f16 user: drh tags: trunk) | |
14:04 | Fix a requirement mark to conform to a typo fix in the documentation. (check-in: d1392c6279 user: drh tags: trunk) | |
Changes to src/insert.c.
︙ | |||
984 985 986 987 988 989 990 | 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 | - + | ** do the insertion. */ #ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pTab) ){ const char *pVTab = (const char *)sqlite3GetVTable(db, pTab); sqlite3VtabMakeWritable(pParse, pTab); sqlite3VdbeAddOp4(v, OP_VUpdate, 1, pTab->nCol+2, regIns, pVTab, P4_VTAB); |
︙ | |||
1278 1279 1280 1281 1282 1283 1284 | 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 | - + - + | continue; } onError = pTab->aCol[i].notNull; if( onError==OE_None ) continue; /* This column is allowed to be NULL */ if( overrideError!=OE_Default ){ onError = overrideError; }else if( onError==OE_Default ){ |
︙ | |||
1321 1322 1323 1324 1325 1326 1327 | 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 | - + - + - + | /* Test all CHECK constraints */ #ifndef SQLITE_OMIT_CHECK if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){ ExprList *pCheck = pTab->pCheck; pParse->ckBase = regNewData+1; |
︙ | |||
1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 | 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 | + | /* Check to see if the new rowid already exists in the table. Skip ** the following conflict logic if it does not. */ sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData); VdbeCoverage(v); /* Generate code that deals with a rowid collision */ if( onError==OE_Default ) onError = db->dfltOnError; switch( onError ){ default: { onError = OE_Abort; /* Fall thru into the next case */ } case OE_Rollback: case OE_Abort: |
︙ | |||
1528 1529 1530 1531 1532 1533 1534 | 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 | - + | sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn); sqlite3VdbeResolveLabel(v, addrUniqueOk); continue; /* pIdx is not a UNIQUE index */ } if( overrideError!=OE_Default ){ onError = overrideError; }else if( onError==OE_Default ){ |
︙ | |||
1906 1907 1908 1909 1910 1911 1912 | 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 | - + | #ifndef SQLITE_OMIT_VIRTUALTABLE if( pDest->tabFlags & TF_Virtual ){ return 0; /* tab1 must not be a virtual table */ } #endif if( onError==OE_Default ){ if( pDest->iPKey>=0 ) onError = pDest->keyConf; |
︙ |
Changes to src/main.c.
︙ | |||
2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 | 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 | + | } } sqlite3_mutex_enter(db->mutex); db->errMask = 0xff; db->nDb = 2; db->magic = SQLITE_MAGIC_BUSY; db->aDb = db->aDbStatic; db->dfltOnError = OE_Abort; assert( sizeof(db->aLimit)==sizeof(aHardLimit) ); memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit)); db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS; db->autoCommit = 1; db->nextAutovac = -1; db->szMmap = sqlite3GlobalConfig.szMmap; |
︙ |
Changes to src/pragma.c.
︙ | |||
1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 | 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 | + + + + + + + + + + + + + + + + + + + + + | ){ sqlite3_limit(db, SQLITE_LIMIT_WORKER_THREADS, (int)(N&0x7fffffff)); } returnSingleInt(v, "threads", sqlite3_limit(db, SQLITE_LIMIT_WORKER_THREADS, -1)); break; } /* ** PRAGMA onconflict ** PRAGMA onconflict = FAIL ** PRAGMA onconflict = ABORT ** PRAGMA onconflict = ROLLBACK ** ** Set the default conflict handling algorithm. */ case PragTyp_ONCONFLICT: { static const char *azMode[] = { "ABORT", "FAIL", "ROLLBACK" }; static const u8 aeMode[] = { OE_Abort, OE_Fail, OE_Rollback }; const char *zRes = 0; int i; for(i=0; i<ArraySize(azMode); i++){ if( sqlite3_stricmp(azMode[i], zRight)==0 ) db->dfltOnError = aeMode[i]; if( db->dfltOnError==aeMode[i] ) zRes = azMode[i]; } returnSingleText(v, "onconflict", zRes); break; } #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) /* ** Report the current state of file logs for all databases */ case PragTyp_LOCK_STATUS: { static const char *const azLockName[] = { |
︙ |
Changes to src/pragma.h.
︙ | |||
24 25 26 27 28 29 30 | 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 | + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + | #define PragTyp_INTEGRITY_CHECK 18 #define PragTyp_JOURNAL_MODE 19 #define PragTyp_JOURNAL_SIZE_LIMIT 20 #define PragTyp_LOCK_PROXY_FILE 21 #define PragTyp_LOCKING_MODE 22 #define PragTyp_PAGE_COUNT 23 #define PragTyp_MMAP_SIZE 24 #define PragTyp_ONCONFLICT 25 |
︙ | |||
295 296 297 298 299 300 301 302 303 304 305 306 307 308 | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | + + + + + + | /* ePragTyp: */ PragTyp_PAGE_COUNT, /* ePragFlag: */ PragFlag_NeedSchema, /* iArg: */ 0 }, { /* zName: */ "mmap_size", /* ePragTyp: */ PragTyp_MMAP_SIZE, /* ePragFlag: */ 0, /* iArg: */ 0 }, #endif { /* zName: */ "onconflict", /* ePragTyp: */ PragTyp_ONCONFLICT, /* ePragFlag: */ 0, /* iArg: */ 0 }, #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) { /* zName: */ "page_count", /* ePragTyp: */ PragTyp_PAGE_COUNT, /* ePragFlag: */ PragFlag_NeedSchema, /* iArg: */ 0 }, { /* zName: */ "page_size", /* ePragTyp: */ PragTyp_PAGE_SIZE, /* ePragFlag: */ 0, |
︙ | |||
457 458 459 460 461 462 463 | 464 465 466 467 468 469 470 471 | - + | #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) { /* zName: */ "writable_schema", /* ePragTyp: */ PragTyp_FLAG, /* ePragFlag: */ 0, /* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode }, #endif }; |
Changes to src/sqliteInt.h.
︙ | |||
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 | 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 | + | u8 mallocFailed; /* True if we have seen a malloc failure */ u8 bBenignMalloc; /* Do not require OOMs if true */ u8 dfltLockMode; /* Default locking-mode for attached dbs */ signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */ u8 suppressErr; /* Do not issue error messages if true */ u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */ u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */ u8 dfltOnError; /* Default conflict handling. OE_Abort */ int nextPagesize; /* Pagesize after VACUUM if >0 */ u32 magic; /* Magic number for detect library misuse */ int nChange; /* Value returned by sqlite3_changes() */ int nTotalChange; /* Value returned by sqlite3_total_changes() */ int aLimit[SQLITE_N_LIMIT]; /* Limits */ int nMaxSorterMmap; /* Maximum size of regions mapped by sorter */ struct sqlite3InitInfo { /* Information used during initialization */ |
︙ |
Changes to src/update.c.
︙ | |||
790 791 792 793 794 795 796 | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | - + | ** invoke the VUpdate method. */ for(i=0; i<nArg; i++){ sqlite3VdbeAddOp3(v, OP_Column, ephemTab, i, regArg+i); } } sqlite3VtabMakeWritable(pParse, pTab); sqlite3VdbeAddOp4(v, OP_VUpdate, 0, nArg, regArg, pVTab, P4_VTAB); |
︙ |
Added test/onconflict1.test.