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

Method Exec

sqlchain/adapter/storage/covenantsql.go:100–116  ·  view source on GitHub ↗

Exec implements the Storage abstraction interface.

(dbID string, query string, args ...interface{})

Source from the content-addressed store, hash-verified

98
99// Exec implements the Storage abstraction interface.
100func (s *CovenantSQLStorage) Exec(dbID string, query string, args ...interface{}) (affectedRows int64, lastInsertID int64, err error) {
101 var conn *sql.DB
102 if conn, err = s.getConn(dbID); err != nil {
103 return
104 }
105 defer conn.Close()
106
107 var result sql.Result
108 result, err = conn.Exec(query, args...)
109
110 if err == nil {
111 affectedRows, _ = result.RowsAffected()
112 lastInsertID, _ = result.LastInsertId()
113 }
114
115 return
116}
117
118func (s *CovenantSQLStorage) getConn(dbID string) (db *sql.DB, err error) {
119 cfg := client.NewConfig()

Callers

nothing calls this directly

Calls 5

getConnMethod · 0.95
CloseMethod · 0.65
ExecMethod · 0.65
RowsAffectedMethod · 0.45
LastInsertIdMethod · 0.45

Tested by

no test coverage detected