golang.org/x/build@v0.0.0-20240506185731-218518f32b70/perfdata/db/sqlite3/sqlite3.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build cgo 6 7 // Package sqlite3 provides the sqlite3 driver for 8 // x/build/perfdata/db. It must be imported instead of go-sqlite3 to 9 // ensure foreign keys are properly honored. 10 package sqlite3 11 12 import ( 13 "database/sql" 14 15 sqlite3 "github.com/mattn/go-sqlite3" 16 "golang.org/x/build/perfdata/db" 17 ) 18 19 func init() { 20 db.RegisterOpenHook("sqlite3", func(db *sql.DB) error { 21 db.Driver().(*sqlite3.SQLiteDriver).ConnectHook = func(c *sqlite3.SQLiteConn) error { 22 _, err := c.Exec("PRAGMA foreign_keys = ON;", nil) 23 return err 24 } 25 return nil 26 }) 27 }