Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions sqlite3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down