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

Method Exec

sqlchain/adapter/storage/sqlite3.go:119–133  ·  view source on GitHub ↗

Exec implements the Storage abstraction interface.

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

Source from the content-addressed store, hash-verified

117
118// Exec implements the Storage abstraction interface.
119func (s *SQLite3Storage) Exec(dbID string, query string, args ...interface{}) (affectedRows int64, lastInsertID int64, err error) {
120 var conn *sql.DB
121 if conn, err = s.getConn(dbID, false); err != nil {
122 return
123 }
124 defer conn.Close()
125
126 var result sql.Result
127 result, err = conn.Exec(query, args...)
128
129 affectedRows, _ = result.RowsAffected()
130 lastInsertID, _ = result.LastInsertId()
131
132 return
133}
134
135func (s *SQLite3Storage) getConn(dbID string, readonly bool) (db *sql.DB, err error) {
136 dbFile := filepath.Join(s.rootDir, dbID+".db3")

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