MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / BeginTx

Method BeginTx

client/conn.go:244–261  ·  view source on GitHub ↗

BeginTx implements the driver.ConnBeginTx.BeginTx method.

(ctx context.Context, opts driver.TxOptions)

Source from the content-addressed store, hash-verified

242
243// BeginTx implements the driver.ConnBeginTx.BeginTx method.
244func (c *conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {
245 if atomic.LoadInt32(&c.closed) != 0 {
246 return nil, driver.ErrBadConn
247 }
248
249 // start transaction
250 log.WithField("inTx", c.inTransaction).Debug("begin transaction")
251
252 if c.inTransaction {
253 return nil, sql.ErrTxDone
254 }
255
256 // TODO(xq262144): make use of the ctx argument
257 c.inTransaction = true
258 c.queries = c.queries[:0]
259
260 return c, nil
261}
262
263// PrepareContext implements the driver.ConnPrepareContext.ConnPrepareContext method.
264func (c *conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) {

Callers 5

BeginMethod · 0.95
ExecuteTxFunction · 0.80
PrepareMethod · 0.80
QueryMethod · 0.80
ExecMethod · 0.80

Calls 2

WithFieldFunction · 0.92
DebugMethod · 0.80

Tested by

no test coverage detected