Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge fixes from trunk. Fix the tclsqlite.test script. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | sqlite3_trace_v2 |
Files: | files | file ages | folders |
SHA1: |
d2b1fa55e8809ffc25a25f256349b8d0 |
User & Date: | drh 2016-07-15 02:55:51.860 |
Context
2016-07-15
| ||
10:01 | The sqlite3_expanded_sql() function compiles, but always returns NULL, when the SQLITE_OMIT_TRACE compile-time option is used. (check-in: 53c25ebe34 user: drh tags: sqlite3_trace_v2) | |
02:55 | Merge fixes from trunk. Fix the tclsqlite.test script. (check-in: d2b1fa55e8 user: drh tags: sqlite3_trace_v2) | |
02:50 | Disable the CSV extension when virtual tables are disabled. (check-in: ec7180892a user: drh tags: trunk) | |
01:49 | Modify the Tcl test command 'sqlite3_bind_blob' to make use of the Tcl_GetByteArrayFromObj() API. (check-in: e03c81895e user: mistachkin tags: sqlite3_trace_v2) | |
Changes
Changes to ext/misc/csv.c.
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #include <string.h> #include <stdlib.h> #include <assert.h> #include <stdarg.h> #include <ctype.h> #include <stdio.h> /* ** A macro to hint to the compiler that a function should not be ** inlined. */ #if defined(__GNUC__) # define CSV_NOINLINE __attribute__((noinline)) #elif defined(_MSC_VER) && _MSC_VER>=1310 | > > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #include <string.h> #include <stdlib.h> #include <assert.h> #include <stdarg.h> #include <ctype.h> #include <stdio.h> #ifndef SQLITE_OMIT_VIRTUALTABLE /* ** A macro to hint to the compiler that a function should not be ** inlined. */ #if defined(__GNUC__) # define CSV_NOINLINE __attribute__((noinline)) #elif defined(_MSC_VER) && _MSC_VER>=1310 |
︙ | ︙ | |||
830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 | 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ }; #endif /* SQLITE_TEST */ #ifdef _WIN32 __declspec(dllexport) #endif /* ** This routine is called when the extension is loaded. The new ** CSV virtual table module is registered with the calling database ** connection. */ int sqlite3_csv_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi ){ int rc; SQLITE_EXTENSION_INIT2(pApi); rc = sqlite3_create_module(db, "csv", &CsvModule, 0); #ifdef SQLITE_TEST if( rc==SQLITE_OK ){ rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0); } #endif return rc; } | > > > > > | 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 | 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ }; #endif /* SQLITE_TEST */ #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */ #ifdef _WIN32 __declspec(dllexport) #endif /* ** This routine is called when the extension is loaded. The new ** CSV virtual table module is registered with the calling database ** connection. */ int sqlite3_csv_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi ){ #ifndef SQLITE_OMIT_VIRTUALTABLE int rc; SQLITE_EXTENSION_INIT2(pApi); rc = sqlite3_create_module(db, "csv", &CsvModule, 0); #ifdef SQLITE_TEST if( rc==SQLITE_OK ){ rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0); } #endif return rc; #else return SQLITE_OK; #endif } |
Changes to src/alter.c.
︙ | ︙ | |||
597 598 599 600 601 602 603 604 605 606 607 608 609 610 | const char *zDb; /* Database name */ const char *zTab; /* Table name */ char *zCol; /* Null-terminated column definition */ Column *pCol; /* The new column */ Expr *pDflt; /* Default value for the new column */ sqlite3 *db; /* The database connection; */ Vdbe *v = pParse->pVdbe; /* The prepared statement under construction */ db = pParse->db; if( pParse->nErr || db->mallocFailed ) return; assert( v!=0 ); pNew = pParse->pNewTable; assert( pNew ); | > | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | const char *zDb; /* Database name */ const char *zTab; /* Table name */ char *zCol; /* Null-terminated column definition */ Column *pCol; /* The new column */ Expr *pDflt; /* Default value for the new column */ sqlite3 *db; /* The database connection; */ Vdbe *v = pParse->pVdbe; /* The prepared statement under construction */ int r1; /* Temporary registers */ db = pParse->db; if( pParse->nErr || db->mallocFailed ) return; assert( v!=0 ); pNew = pParse->pNewTable; assert( pNew ); |
︙ | ︙ | |||
691 692 693 694 695 696 697 | zDb, SCHEMA_TABLE(iDb), pNew->addColOffset, zCol, pNew->addColOffset+1, zTab ); sqlite3DbFree(db, zCol); db->flags = savedDbFlags; } | | | < < < < | > > > > > > | < > | 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | zDb, SCHEMA_TABLE(iDb), pNew->addColOffset, zCol, pNew->addColOffset+1, zTab ); sqlite3DbFree(db, zCol); db->flags = savedDbFlags; } /* Make sure the schema version is at least 3. But do not upgrade ** from less than 3 to 4, as that will corrupt any preexisting DESC ** index. */ r1 = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT); sqlite3VdbeUsesBtree(v, iDb); sqlite3VdbeAddOp2(v, OP_AddImm, r1, -2); sqlite3VdbeAddOp2(v, OP_IfPos, r1, sqlite3VdbeCurrentAddr(v)+2); VdbeCoverage(v); sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3); sqlite3ReleaseTempReg(pParse, r1); /* Reload the schema of the modified table. */ reloadTableSchema(pParse, pTab, pTab->zName); } /* ** This function is called by the parser after the table-name in |
︙ | ︙ |
Changes to test/alter3.test.
︙ | ︙ | |||
180 181 182 183 184 185 186 | ALTER TABLE t1 ADD c; SELECT * FROM t1; } } {1 100 {} 2 300 {}} if {!$has_codec} { do_test alter3-3.3 { get_file_format | | | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | ALTER TABLE t1 ADD c; SELECT * FROM t1; } } {1 100 {} 2 300 {}} if {!$has_codec} { do_test alter3-3.3 { get_file_format } {3} } ifcapable schema_version { do_test alter3-3.4 { execsql { PRAGMA schema_version; } } {11} |
︙ | ︙ | |||
216 217 218 219 220 221 222 | ALTER TABLE t1 ADD c DEFAULT 'hello world'; SELECT * FROM t1; } } {1 100 {hello world} 2 300 {hello world}} if {!$has_codec} { do_test alter3-4.3 { get_file_format | | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | ALTER TABLE t1 ADD c DEFAULT 'hello world'; SELECT * FROM t1; } } {1 100 {hello world} 2 300 {hello world}} if {!$has_codec} { do_test alter3-4.3 { get_file_format } {3} } ifcapable schema_version { do_test alter3-4.4 { execsql { PRAGMA schema_version; } } {21} |
︙ | ︙ | |||
266 267 268 269 270 271 272 | PRAGMA aux.schema_version; } } {31} } if {!$has_codec} { do_test alter3-5.5 { list [get_file_format test2.db] [get_file_format] | | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | PRAGMA aux.schema_version; } } {31} } if {!$has_codec} { do_test alter3-5.5 { list [get_file_format test2.db] [get_file_format] } {3 3} } do_test alter3-5.6 { execsql { ALTER TABLE aux.t1 ADD COLUMN d DEFAULT 1000; SELECT sql FROM aux.sqlite_master; } } {{CREATE TABLE t1(a,b, c VARCHAR(128), d DEFAULT 1000)}} |
︙ | ︙ | |||
343 344 345 346 347 348 349 | } {1} do_test alter3-7.2 { execsql { CREATE TABLE abc(a, b, c); ALTER TABLE abc ADD d DEFAULT NULL; } get_file_format | | | | | 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 | } {1} do_test alter3-7.2 { execsql { CREATE TABLE abc(a, b, c); ALTER TABLE abc ADD d DEFAULT NULL; } get_file_format } {3} do_test alter3-7.3 { execsql { ALTER TABLE abc ADD e DEFAULT 10; } get_file_format } {3} do_test alter3-7.4 { execsql { ALTER TABLE abc ADD f DEFAULT NULL; } get_file_format } {3} do_test alter3-7.5 { execsql { VACUUM; } get_file_format } {1} } |
︙ | ︙ |
Changes to test/alter4.test.
︙ | ︙ | |||
350 351 352 353 354 355 356 357 358 | real 9.22337203685478e+18 } do_execsql_test alter4-9.3 { ALTER TABLE t5 ADD COLUMN c INTEGER DEFAULT (-(-9223372036854775808)); SELECT typeof(c), c FROM t5; } {real 9.22337203685478e+18} finish_test | > > > > > > > > > > > > > > > > > > > | 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 | real 9.22337203685478e+18 } do_execsql_test alter4-9.3 { ALTER TABLE t5 ADD COLUMN c INTEGER DEFAULT (-(-9223372036854775808)); SELECT typeof(c), c FROM t5; } {real 9.22337203685478e+18} # Confirm that doing an ALTER TABLE on a legacy format database # does not corrupt DESC indexes. # # Ticket https://www.sqlite.org/src/tktview/f68bf68513a1c # do_test alter4-10.1 { db close sqlite3 db :memory: db eval { PRAGMA legacy_file_format=on; CREATE TABLE t1(a,b,c); CREATE INDEX t1a ON t1(a DESC); INSERT INTO t1 VALUES(1,2,3); INSERT INTO t1 VALUES(2,3,4); ALTER TABLE t1 ADD COLUMN d; PRAGMA integrity_check; } } {ok} finish_test |
Changes to test/tclsqlite.test.
︙ | ︙ | |||
30 31 32 33 34 35 36 | set v [catch {sqlite3 bogus} msg] regsub {really_sqlite3} $msg {sqlite3} msg lappend v $msg } [list 1 "wrong # args: should be \"$r\""] do_test tcl-1.2 { set v [catch {db bogus} msg] lappend v $msg | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | set v [catch {sqlite3 bogus} msg] regsub {really_sqlite3} $msg {sqlite3} msg lappend v $msg } [list 1 "wrong # args: should be \"$r\""] do_test tcl-1.2 { set v [catch {db bogus} msg] lappend v $msg } {1 {bad option "bogus": must be authorizer, backup, busy, cache, changes, close, collate, collation_needed, commit_hook, complete, copy, enable_load_extension, errorcode, eval, exists, function, incrblob, interrupt, last_insert_rowid, nullvalue, onecolumn, preupdate, profile, progress, rekey, restore, rollback_hook, status, timeout, total_changes, trace, trace_v2, transaction, unlock_notify, update_hook, version, or wal_hook}} do_test tcl-1.2.1 { set v [catch {db cache bogus} msg] lappend v $msg } {1 {bad option "bogus": must be flush or size}} do_test tcl-1.2.2 { set v [catch {db cache} msg] lappend v $msg |
︙ | ︙ |