Fixes typo
This commit is contained in:
@@ -8,7 +8,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
sql.Register("sqlite3_with_extensions", &sqlite3.SQLiteDriver{true, nil})
|
sql.Register("sqlite3_with_extensions",
|
||||||
|
&sqlite3.SQLiteDriver{
|
||||||
|
EnableLoadExtension: true,
|
||||||
|
ConnectHook: nil,
|
||||||
|
})
|
||||||
|
|
||||||
db, err := sql.Open("sqlite3_with_extensions", ":memory:")
|
db, err := sql.Open("sqlite3_with_extensions", ":memory:")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
12
sqlite3.go
12
sqlite3.go
@@ -77,7 +77,7 @@ func init() {
|
|||||||
|
|
||||||
// Driver struct.
|
// Driver struct.
|
||||||
type SQLiteDriver struct {
|
type SQLiteDriver struct {
|
||||||
EnableLoadExtentions bool
|
EnableLoadExtension bool
|
||||||
ConnectHook func(*SQLiteConn)
|
ConnectHook func(*SQLiteConn)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ func (tx *SQLiteTx) Rollback() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *SQLiteConn) AutoCommit() bool {
|
func (c *SQLiteConn) AutoCommit() bool {
|
||||||
return int(C.sqlite3_get_autocommit()) != 0
|
return int(C.sqlite3_get_autocommit(c.db)) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *SQLiteConn) exec(cmd string) error {
|
func (c *SQLiteConn) exec(cmd string) error {
|
||||||
@@ -182,11 +182,11 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
|||||||
return nil, errors.New(C.GoString(C.sqlite3_errmsg(db)))
|
return nil, errors.New(C.GoString(C.sqlite3_errmsg(db)))
|
||||||
}
|
}
|
||||||
|
|
||||||
enableLoadExtentions := 0
|
enableLoadExtension := 0
|
||||||
if d.EnableLoadExtentions {
|
if d.EnableLoadExtension {
|
||||||
enableLoadExtentions = 1
|
enableLoadExtension = 1
|
||||||
}
|
}
|
||||||
rv = C.sqlite3_enable_load_extension(db, C.int(enableLoadExtentions))
|
rv = C.sqlite3_enable_load_extension(db, C.int(enableLoadExtension))
|
||||||
if rv != C.SQLITE_OK {
|
if rv != C.SQLITE_OK {
|
||||||
return nil, errors.New(C.GoString(C.sqlite3_errmsg(db)))
|
return nil, errors.New(C.GoString(C.sqlite3_errmsg(db)))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user