Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add a test to check that the incrblob API cannot be used to write to an IPK column. Also a comment to explain why the incrblob code does not need to check if a column is part of a parent key before writing to it. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
dca2a7f608d9237039541707846c76cd |
User & Date: | dan 2009-10-02 06:35:06.000 |
Context
2009-10-02
| ||
14:23 | When inserting a row into a child table, invoke the authorization callback to request permission to read the parent key columns. (check-in: 9842f2d5f6 user: dan tags: trunk) | |
06:35 | Add a test to check that the incrblob API cannot be used to write to an IPK column. Also a comment to explain why the incrblob code does not need to check if a column is part of a parent key before writing to it. (check-in: dca2a7f608 user: dan tags: trunk) | |
2009-10-01
| ||
17:13 | Add test cases to cover the branches added by the previous commit. (check-in: aaa005b6da user: dan tags: trunk) | |
Changes
Changes to src/vdbeblob.c.
︙ | ︙ | |||
148 149 150 151 152 153 154 155 156 157 158 159 160 161 | ** It is against the rules to open a column to which either of these ** descriptions applies for writing. */ if( flags ){ const char *zFault = 0; Index *pIdx; #ifndef SQLITE_OMIT_FOREIGN_KEY if( db->flags&SQLITE_ForeignKeys ){ FKey *pFKey; for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){ int j; for(j=0; j<pFKey->nCol; j++){ if( pFKey->aCol[j].iFrom==iCol ){ zFault = "foreign key"; } | > > > > | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | ** It is against the rules to open a column to which either of these ** descriptions applies for writing. */ if( flags ){ const char *zFault = 0; Index *pIdx; #ifndef SQLITE_OMIT_FOREIGN_KEY if( db->flags&SQLITE_ForeignKeys ){ /* Check that the column is not part of an FK child key definition. It ** is not necessary to check if it is part of a parent key, as parent ** key columns must be indexed. The check below will pick up this ** case. */ FKey *pFKey; for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){ int j; for(j=0; j<pFKey->nCol; j++){ if( pFKey->aCol[j].iFrom==iCol ){ zFault = "foreign key"; } |
︙ | ︙ |
Changes to test/incrblob.test.
︙ | ︙ | |||
305 306 307 308 309 310 311 | do_test incrblob-4.7 { set rc [catch { set ::blob [db incrblob blobs i 2] } msg ] list $rc $msg } {1 {cannot open value of type null}} | | > > > > > > > > > > > > > > > > | 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 | do_test incrblob-4.7 { set rc [catch { set ::blob [db incrblob blobs i 2] } msg ] list $rc $msg } {1 {cannot open value of type null}} do_test incrblob-4.8.1 { execsql { INSERT INTO blobs(k, v, i) VALUES(X'010203040506070809', 'hello', 'world'); } set rc [catch { set ::blob [db incrblob blobs k 3] } msg ] list $rc $msg } {1 {cannot open indexed column for writing}} do_test incrblob-4.8.2 { execsql { CREATE TABLE t3(a INTEGER PRIMARY KEY, b); INSERT INTO t3 VALUES(1, 2); } set rc [catch { set ::blob [db incrblob -readonly t3 a 1] } msg ] list $rc $msg } {1 {cannot open value of type null}} do_test incrblob-4.8.3 { set rc [catch { set ::blob [db incrblob -readonly t3 rowid 1] } msg ] list $rc $msg } {1 {no such column: "rowid"}} do_test incrblob-4.9.1 { set rc [catch { set ::blob [db incrblob -readonly blobs k 3] } msg] } {0} do_test incrblob-4.9.2 { |
︙ | ︙ |