jrnlmode2-2.4 & 2-2.6, return incorrect results when using a codec with an
encryption routine
Expected: [0 {1 2 3 4 5 6}]
     Got: [1 {file is encrypted or is not a database}]

This happens because the sqlite db command in TCL opens the database with
the option -key {xyzzy}
# Use the pager codec if it is available
#
if {[sqlite3 -has-codec] && [info command sqlite_orig]==""} {
  rename sqlite3 sqlite_orig
  proc sqlite3 {args} {
    if {[llength $args]==2 && [string index [lindex $args 0] 0]!="-"} {
      lappend args -key {xyzzy}
    }
    uplevel 1 sqlite_orig $args
  }
}


However, when additional db commands are defined, there is no key added when
a codec exists

Suggested correction for 2-2.4 & 2-2.6

do_test jrnlmode2-2.4 {
  if {[sqlite3 -has-codec]} { 
    sqlite3 db2 test.db -readonly 1 -key {xyzzy} 
  } else {
    sqlite3 db2 test.db -readonly 1
  }
  catchsql { SELECT * FROM t1 } db2
} {0 {1 2 3 4 5 6}}



do_test jrnlmode2-2.6 {
  if {[sqlite3 -has-codec]} { 
    sqlite3 db2 test.db -readonly 1 -key {xyzzy} 
  } else {
    sqlite3 db2 test.db -readonly 1
  }
  catchsql { SELECT * FROM t1 } db2
} {0 {1 2 3 4 5 6}}


Thanks,

Noah

-- 
View this message in context: 
http://old.nabble.com/Error-in-jrnlmode2.test-with-encryption-codec-tp28951848p28951848.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to