Skip to content

Commit

Permalink
Specify legacy pragma before any other encryption-related pragma
Browse files Browse the repository at this point in the history
  • Loading branch information
jgiannuzzi committed Jul 19, 2023
1 parent f58fe46 commit 618f3f7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sqlite3.go
Original file line number Diff line number Diff line change
Expand Up @@ -1657,6 +1657,14 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
}
}

// Legacy
if legacy > -1 {
if err := exec(fmt.Sprintf("PRAGMA legacy = %d;", legacy)); err != nil {
C.sqlite3_close_v2(db)
return nil, err
}
}

// Check HMAC
if hmacCheck > -1 {
if err := exec(fmt.Sprintf("PRAGMA hmac_check = %d;", hmacCheck)); err != nil {
Expand All @@ -1681,14 +1689,6 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
}
}

// Legacy
if legacy > -1 {
if err := exec(fmt.Sprintf("PRAGMA legacy = %d;", legacy)); err != nil {
C.sqlite3_close_v2(db)
return nil, err
}
}

// Legacy Page Size
if legacyPageSize > -1 {
if err := exec(fmt.Sprintf("PRAGMA legacy_page_size = %d;", legacyPageSize)); err != nil {
Expand Down

0 comments on commit 618f3f7

Please sign in to comment.