Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix error handling in sqlite3session_diff() when it is invoked for table "sqlite_stat1". |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
874285e477dd9bd164e25ddb08b6b80d |
User & Date: | dan 2018-01-12 19:20:15.804 |
Context
2018-01-12
| ||
19:33 | Simplification to the implementation of OP_Insert. (check-in: 6acbdba59e user: drh tags: trunk) | |
19:20 | Fix error handling in sqlite3session_diff() when it is invoked for table "sqlite_stat1". (check-in: 874285e477 user: dan tags: trunk) | |
18:46 | Avoid an unnecessary branch when not using pre-update hooks. (check-in: ec96707eb3 user: drh tags: trunk) | |
Changes
Changes to ext/session/sessionD.test.
︙ | ︙ | |||
217 218 219 220 221 222 223 224 225 | do_test 4.2.2 { sqlite3session S db main S attach t2 list [catch { S diff ixua t2 } msg] $msg } {1 {SQLITE_SCHEMA - table schemas do not match}} S delete finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | do_test 4.2.2 { sqlite3session S db main S attach t2 list [catch { S diff ixua t2 } msg] $msg } {1 {SQLITE_SCHEMA - table schemas do not match}} S delete do_test 4.3.1 { sqlite3session S db main S attach t4 execsql { CREATE TABLE t4(i PRIMARY KEY, b) } list [catch { S diff ixua t4 } msg] $msg } {1 {SQLITE_SCHEMA - table schemas do not match}} S delete do_catchsql_test 4.3.2 { SELECT * FROM ixua.t4; } {1 {no such table: ixua.t4}} do_test 4.4.1 { sqlite3session S db main S attach sqlite_stat1 execsql { ANALYZE } execsql { DROP TABLE ixua.sqlite_stat1 } list [catch { S diff ixua sqlite_stat1 } msg] $msg } {1 {SQLITE_SCHEMA - table schemas do not match}} S delete do_catchsql_test 4.4.2 { SELECT * FROM ixua.sqlite_stat1; } {1 {no such table: ixua.sqlite_stat1}} do_test 4.5.1 { sqlite3session S db main S attach t8 list [catch { S diff ixua t8 } msg] $msg } {0 {}} S delete do_catchsql_test 4.5.2 { SELECT * FROM ixua.i8; } {1 {no such table: ixua.i8}} finish_test |
Changes to ext/session/sessionstat1.test.
︙ | ︙ | |||
115 116 117 118 119 120 121 | } {} do_execsql_test -db db2 2.4 { SELECT * FROM sqlite_stat1 } { } | | | 115 116 117 118 119 120 121 122 123 124 125 | } {} do_execsql_test -db db2 2.4 { SELECT * FROM sqlite_stat1 } { } do_execsql_test -db db2 2.5 { SELECT count(*) FROM t1 } 32 finish_test |
Changes to ext/session/sqlite3session.c.
︙ | ︙ | |||
937 938 939 940 941 942 943 | char **azCol = 0; u8 *abPK = 0; assert( pazCol && pabPK ); nThis = sqlite3Strlen30(zThis); if( nThis==12 && 0==sqlite3_stricmp("sqlite_stat1", zThis) ){ | > > | | | | | | > > > > > | 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 | char **azCol = 0; u8 *abPK = 0; assert( pazCol && pabPK ); nThis = sqlite3Strlen30(zThis); if( nThis==12 && 0==sqlite3_stricmp("sqlite_stat1", zThis) ){ rc = sqlite3_table_column_metadata(db, zDb, zThis, 0, 0, 0, 0, 0, 0); if( rc==SQLITE_OK ){ /* For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. */ zPragma = sqlite3_mprintf( "SELECT 0, 'tbl', '', 0, '', 1 UNION ALL " "SELECT 1, 'idx', '', 0, '', 2 UNION ALL " "SELECT 2, 'stat', '', 0, '', 0" ); }else if( rc==SQLITE_ERROR ){ zPragma = sqlite3_mprintf(""); }else{ return rc; } }else{ zPragma = sqlite3_mprintf("PRAGMA '%q'.table_info('%q')", zDb, zThis); } if( !zPragma ) return SQLITE_NOMEM; rc = sqlite3_prepare_v2(db, zPragma, -1, &pStmt, 0); sqlite3_free(zPragma); |
︙ | ︙ | |||
1502 1503 1504 1505 1506 1507 1508 | int i; for(i=0; i<nCol; i++){ if( pTo->abPK[i]!=abPK[i] ) bMismatch = 1; if( sqlite3_stricmp(azCol[i], pTo->azCol[i]) ) bMismatch = 1; if( abPK[i] ) bHasPk = 1; } } | < | 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 | int i; for(i=0; i<nCol; i++){ if( pTo->abPK[i]!=abPK[i] ) bMismatch = 1; if( sqlite3_stricmp(azCol[i], pTo->azCol[i]) ) bMismatch = 1; if( abPK[i] ) bHasPk = 1; } } } sqlite3_free((char*)azCol); if( bMismatch ){ *pzErrMsg = sqlite3_mprintf("table schemas do not match"); rc = SQLITE_SCHEMA; } if( bHasPk==0 ){ |
︙ | ︙ |