SQLite

Check-in [e4fa8be770]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add one more authentication test to fkey2.test to cover an untested branch.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e4fa8be770eb79806d489be46f68f969de17378b
User & Date: dan 2009-10-02 15:29:10.000
Context
2009-10-03
07:04
Handle an SQLITE_IGNORE returned when requesting authorization to read parent key columns by pretending the parent key columns contain NULL values. (check-in: 3c24df38e6 user: dan tags: trunk)
2009-10-02
15:29
Add one more authentication test to fkey2.test to cover an untested branch. (check-in: e4fa8be770 user: dan tags: trunk)
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)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/fkey2.test.
1406
1407
1408
1409
1410
1411
1412











1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
    set authargs
  } {SQLITE_UPDATE nought b main {} SQLITE_READ cross e main {} SQLITE_READ cross e main {} SQLITE_READ nought b main {} SQLITE_READ nought b main {} SQLITE_READ nought b main {} SQLITE_UPDATE cross e main {} SQLITE_READ nought b main {} SQLITE_READ cross e main {} SQLITE_READ nought b main {} SQLITE_READ nought b main {}}

  do_test fkey2-18.6 {
    execsql {SELECT * FROM cross}
  } {0 5 0}












  rename auth {}
  proc auth {args} {
    if {[lindex $args 1] == "long"} {return SQLITE_IGNORE}
    return SQLITE_OK
  }
  do_test fkey2-18.7 {
    catchsql { INSERT INTO short VALUES(1, 3, 2) }
  } {1 {access to long.b is prohibited}}

  db auth {}
  unset authargs
}








>
>
>
>
>
>
>
>
>
>
>





|







1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
    set authargs
  } {SQLITE_UPDATE nought b main {} SQLITE_READ cross e main {} SQLITE_READ cross e main {} SQLITE_READ nought b main {} SQLITE_READ nought b main {} SQLITE_READ nought b main {} SQLITE_UPDATE cross e main {} SQLITE_READ nought b main {} SQLITE_READ cross e main {} SQLITE_READ nought b main {} SQLITE_READ nought b main {}}

  do_test fkey2-18.6 {
    execsql {SELECT * FROM cross}
  } {0 5 0}

  do_test fkey2-18.7 {
    execsql {
      CREATE TABLE one(a INTEGER PRIMARY KEY, b);
      CREATE TABLE two(b, c REFERENCES one);
      INSERT INTO one VALUES(101, 102);
    }
    set authargs [list]
    execsql { INSERT INTO two VALUES(100, 101); }
    set authargs
  } {SQLITE_INSERT two {} main {} SQLITE_READ one a main {}}

  rename auth {}
  proc auth {args} {
    if {[lindex $args 1] == "long"} {return SQLITE_IGNORE}
    return SQLITE_OK
  }
  do_test fkey2-18.8 {
    catchsql { INSERT INTO short VALUES(1, 3, 2) }
  } {1 {access to long.b is prohibited}}

  db auth {}
  unset authargs
}