Exec implements the Storage abstraction interface.
(dbID string, query string, args ...interface{})
| 98 | |
| 99 | // Exec implements the Storage abstraction interface. |
| 100 | func (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 | |
| 118 | func (s *CovenantSQLStorage) getConn(dbID string) (db *sql.DB, err error) { |
| 119 | cfg := client.NewConfig() |
nothing calls this directly
no test coverage detected