Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch writable-vtab-without-rowid Excluding Merge-Ins
This is equivalent to a diff from e49279e6 to f38ff718
2017-08-10
| ||
20:43 | Allow WITHOUT ROWID virtual tables to be writable as long as they have exactly one column as their PRIMARY KEY. (check-in: c601d128 user: drh tags: trunk) | |
20:36 | Add the "instance" type to the fts5vocab virtual table module. For direct access to the contents of the fts5 term index. (check-in: 34a7bd71 user: dan tags: trunk) | |
19:12 | Fix a typo in csv01.test introduced by the previous commit. (Closed-Leaf check-in: f38ff718 user: dan tags: writable-vtab-without-rowid) | |
19:10 | Add extra tests to this branch. (check-in: b0e3b88a user: dan tags: writable-vtab-without-rowid) | |
15:19 | Experimental changes that allow a WITHOUT ROWID virtual table to be writable as long as it has only a single-column PRIMARY KEY. (check-in: ab9ee4c1 user: drh tags: writable-vtab-without-rowid) | |
03:27 | Add a first draft of the "vtablog" extensions that implements a generic virtual table useful for experimentation using the command-line shell. (check-in: e49279e6 user: drh tags: trunk) | |
2017-08-09
| ||
22:55 | Preserve the error code from xConnect or xCreate methods in virtual table implementations when they are encountered during parsing. (check-in: dcdf0913 user: drh tags: trunk) | |
Changes to src/delete.c.
︙ | |||
498 499 500 501 502 503 504 | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 | + + + - + + | if( !IsVirtual(pTab) && aToOpen[iDataCur-iTabCur] ){ assert( pPk!=0 || pTab->pSelect!=0 ); sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, addrBypass, iKey, nKey); VdbeCoverage(v); } }else if( pPk ){ addrLoop = sqlite3VdbeAddOp1(v, OP_Rewind, iEphCur); VdbeCoverage(v); if( IsVirtual(pTab) ){ sqlite3VdbeAddOp3(v, OP_Column, iEphCur, 0, iKey); }else{ |
︙ |
Changes to src/test_tclvar.c.
︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 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 | + + + + + + + + + + + + + + + + + + + | ************************************************************************* ** Code for testing the virtual table interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** ** The emphasis of this file is a virtual table that provides ** access to TCL variables. ** ** The TCLVAR eponymous virtual table has a schema like this: ** ** CREATE TABLE tclvar( ** name TEXT, -- base name of the variable: "x" in "$x(y)" ** arrayname TEXT, -- array index name: "y" in "$x(y)" ** value TEXT, -- the value of the variable ** fullname TEXT, -- the full name of the variable ** PRIMARY KEY(fullname) ** ) WITHOUT ROWID; ** ** DELETE, INSERT, and UPDATE operations use the "fullname" field to ** determine the variable to be modified. Changing "value" to NULL ** deletes the variable. ** ** For SELECT operations, the "name" and "arrayname" fields will always ** match the "fullname" field. For DELETE, INSERT, and UPDATE, the ** "name" and "arrayname" fields are ignored and the variable is modified ** according to "fullname" and "value" only. */ #include "sqliteInt.h" #if defined(INCLUDE_SQLITE_TCL_H) # include "sqlite_tcl.h" #else # include "tcl.h" #endif |
︙ | |||
63 64 65 66 67 68 69 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | - + + + + + + | void *pAux, int argc, const char *const*argv, sqlite3_vtab **ppVtab, char **pzErr ){ tclvar_vtab *pVtab; static const char zSchema[] = |
︙ | |||
247 248 249 250 251 252 253 254 255 256 257 258 259 260 | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | + + + + + + + + + + | break; } case 2: { Tcl_Obj *pVal = Tcl_GetVar2Ex(interp, z1, *z2?z2:0, TCL_GLOBAL_ONLY); sqlite3_result_text(ctx, Tcl_GetString(pVal), -1, SQLITE_TRANSIENT); break; } case 3: { char *z3; if( p2 ){ z3 = sqlite3_mprintf("%s(%s)", z1, z2); sqlite3_result_text(ctx, z3, -1, sqlite3_free); }else{ sqlite3_result_text(ctx, z1, -1, SQLITE_TRANSIENT); } break; } } return SQLITE_OK; } static int tclvarRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ *pRowid = 0; return SQLITE_OK; |
︙ | |||
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 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + | } } pIdxInfo->idxStr = zStr; pIdxInfo->needToFreeIdxStr = 1; return SQLITE_OK; } /* ** Invoked for any UPDATE, INSERT, or DELETE against a tclvar table */ static int tclvarUpdate( sqlite3_vtab *tab, int argc, sqlite3_value **argv, sqlite_int64 *pRowid ){ tclvar_vtab *pTab = (tclvar_vtab*)tab; if( argc==1 ){ /* A DELETE operation. The variable to be deleted is stored in argv[0] */ const char *zVar = (const char*)sqlite3_value_text(argv[0]); Tcl_UnsetVar(pTab->interp, zVar, TCL_GLOBAL_ONLY); return SQLITE_OK; } if( sqlite3_value_type(argv[0])==SQLITE_NULL ){ /* An INSERT operation */ const char *zValue = (const char*)sqlite3_value_text(argv[4]); const char *zName; if( sqlite3_value_type(argv[5])!=SQLITE_TEXT ){ tab->zErrMsg = sqlite3_mprintf("the 'fullname' column must be TEXT"); return SQLITE_ERROR; } zName = (const char*)sqlite3_value_text(argv[5]); if( zValue ){ Tcl_SetVar(pTab->interp, zName, zValue, TCL_GLOBAL_ONLY); }else{ Tcl_UnsetVar(pTab->interp, zName, TCL_GLOBAL_ONLY); } return SQLITE_OK; } if( sqlite3_value_type(argv[0])==SQLITE_TEXT && sqlite3_value_type(argv[1])==SQLITE_TEXT ){ /* An UPDATE operation */ const char *zOldName = (const char*)sqlite3_value_text(argv[0]); const char *zNewName = (const char*)sqlite3_value_text(argv[1]); const char *zValue = (const char*)sqlite3_value_text(argv[4]); if( strcmp(zOldName, zNewName)!=0 || zValue==0 ){ Tcl_UnsetVar(pTab->interp, zOldName, TCL_GLOBAL_ONLY); } if( zValue!=0 ){ Tcl_SetVar(pTab->interp, zNewName, zValue, TCL_GLOBAL_ONLY); } return SQLITE_OK; } tab->zErrMsg = sqlite3_mprintf("prohibited TCL variable change"); return SQLITE_ERROR; } /* ** A virtual table module that provides read-only access to a ** Tcl global variable namespace. */ static sqlite3_module tclvarModule = { 0, /* iVersion */ tclvarConnect, tclvarConnect, tclvarBestIndex, tclvarDisconnect, tclvarDisconnect, tclvarOpen, /* xOpen - open a cursor */ tclvarClose, /* xClose - close a cursor */ tclvarFilter, /* xFilter - configure scan constraints */ tclvarNext, /* xNext - advance a cursor */ tclvarEof, /* xEof - check for end of scan */ tclvarColumn, /* xColumn - read data */ tclvarRowid, /* xRowid - read data */ |
︙ |
Changes to src/update.c.
︙ | |||
799 800 801 802 803 804 805 | 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | - - - - - - + + + + + + + + + + + + + + + + + | regRowid = ++pParse->nMem; /* Start scanning the virtual table */ pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0,0,WHERE_ONEPASS_DESIRED,0); if( pWInfo==0 ) return; /* Populate the argument registers. */ |
︙ |
Changes to src/vtab.c.
︙ | |||
769 770 771 772 773 774 775 | 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | + + - + + + + + | Index *pIdx; pTab->aCol = pNew->aCol; pTab->nCol = pNew->nCol; pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid); pNew->nCol = 0; pNew->aCol = 0; assert( pTab->pIndex==0 ); assert( HasRowid(pNew) || sqlite3PrimaryKeyIndex(pNew)!=0 ); if( !HasRowid(pNew) |
︙ |
Changes to test/csv01.test.
︙ | |||
89 90 91 92 93 94 95 96 97 98 99 100 101 102 | 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 | + - - + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + | } {5 9} # The rowid column is not visible on a WITHOUT ROWID virtual table do_catchsql_test 3.2 { SELECT rowid, a FROM t3; } {1 {no such column: rowid}} # Multi-column WITHOUT ROWID virtual tables may not be writable. do_catchsql_test 4.0 { DROP TABLE t3; CREATE VIRTUAL TABLE temp.t4 USING csv_wr( data= '1,2,3,4 5,6,7,8 9,10,11,12 |
Changes to test/vtab2.test.
︙ | |||
56 57 58 59 60 61 62 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | - + - + | } {6} register_tclvar_module [sqlite3_connection_pointer db] do_test vtab2-2.1 { set ::abc 123 execsql { CREATE VIRTUAL TABLE vars USING tclvar; |
︙ |
Changes to test/vtabE.test.
︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + + - + | set vtabE2(c) d do_test vtabE-1 { db eval { CREATE VIRTUAL TABLE t1 USING tclvar; CREATE VIRTUAL TABLE t2 USING tclvar; CREATE TABLE t3(a INTEGER PRIMARY KEY, b); SELECT t1.name, t1.arrayname, t1.value, t2.name, t2.arrayname, t2.value, |
︙ |
Changes to test/vtabH.test.
︙ | |||
51 52 53 54 55 56 57 | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | - + | #-------------------------------------------------------------------------- register_tclvar_module db set ::xyz 10 do_execsql_test 2.0 { CREATE VIRTUAL TABLE vars USING tclvar; |
︙ |
Added test/vtabJ.test.