forked from mirror/go-sqlite3
add BeginContext
This commit is contained in:
parent
025b917610
commit
755d5be32c
|
@ -514,6 +514,10 @@ func (c *SQLiteConn) execQuery(cmd string) (driver.Result, error) {
|
||||||
|
|
||||||
// Begin transaction.
|
// Begin transaction.
|
||||||
func (c *SQLiteConn) Begin() (driver.Tx, error) {
|
func (c *SQLiteConn) Begin() (driver.Tx, error) {
|
||||||
|
return c.begin(context.Background())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *SQLiteConn) begin(ctx context.Context) (driver.Tx, error) {
|
||||||
if _, err := c.execQuery(c.txlock); err != nil {
|
if _, err := c.execQuery(c.txlock); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,10 @@ func (c *SQLiteConn) PrepareContext(ctx context.Context, query string) (driver.S
|
||||||
return c.prepare(ctx, query)
|
return c.prepare(ctx, query)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *SQLiteConn) BeginContext(ctx context.Context) (driver.Tx, error) {
|
||||||
|
return c.begin(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *SQLiteStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
|
func (s *SQLiteStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
|
||||||
list := make([]namedValue, len(args))
|
list := make([]namedValue, len(args))
|
||||||
for i, nv := range args {
|
for i, nv := range args {
|
||||||
|
|
Loading…
Reference in New Issue