ADD: PRAGMA cipher_compatibility
This commit is contained in:
parent
d681773ef0
commit
abf681aaa9
19
sqlite3.go
19
sqlite3.go
|
@ -1016,6 +1016,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
|||
|
||||
// PRAGMA's
|
||||
encryptKey := ""
|
||||
cipher_compatibility := -1
|
||||
autoVacuum := -1
|
||||
busyTimeout := 5000
|
||||
caseSensitiveLike := -1
|
||||
|
@ -1042,6 +1043,15 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
|||
encryptKey = val
|
||||
}
|
||||
|
||||
// _cipher_compatibility
|
||||
if val := params.Get("_cipher_compatibility"); val != "" {
|
||||
iv, err := strconv.ParseInt(val, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Invalid _cipher_compatibility: %v: %v", val, err)
|
||||
}
|
||||
cipher_compatibility = int(iv)
|
||||
}
|
||||
|
||||
// Authentication
|
||||
if _, ok := params["_auth"]; ok {
|
||||
authCreate = true
|
||||
|
@ -1406,6 +1416,15 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// Cipher Compatibility
|
||||
// The cipher_compatibility pragma should be called immediately after if provided
|
||||
if cipher_compatibility > -1 {
|
||||
if err := exec(fmt.Sprintf("PRAGMA cipher_compatibility = %d;", cipher_compatibility)); err != nil {
|
||||
C.sqlite3_close_v2(db)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// USER AUTHENTICATION
|
||||
//
|
||||
// User Authentication is always performed even when
|
||||
|
|
Loading…
Reference in New Issue