func (c *SQLiteConn) exec(cmd string) error { pcmd := C.CString(cmd) defer C.free(unsafe.Pointer(pcmd)) rv := C.sqlite3_exec(c.db, pcmd, nil, nil, nil) if rv != C.SQLITE_OK { return errors.New(C.GoString(C.sqlite3_errmsg(c.db))) } return nil }
func (c *SQLiteConn) exec(cmd string) error { pcmd := C.CString(cmd) defer C.free(unsafe.Pointer(pcmd)) rv := C.sqlite3_exec(c.db, pcmd, nil, nil, nil) if rv != C.SQLITE_OK { return c.lastError() } return nil }
func (conn Conn) Begin() (driver.Tx, error) { sql := C.CString("begin;") defer C.free(unsafe.Pointer(sql)) r := C.sqlite3_exec(conn.db, sql, nil, nil, nil) if r != C.SQLITE_OK { return nil, dbError(conn.db) } return &Tx{db: conn.db}, nil }
func (tx Tx) Rollback() error { sql := C.CString("rollback;") defer C.free(unsafe.Pointer(sql)) r := C.sqlite3_exec(tx.db, sql, nil, nil, nil) if r != C.SQLITE_OK { return dbError(tx.db) } return nil }
func (c *SQLiteConn) exec(cmd string) (driver.Result, error) { pcmd := C.CString(cmd) defer C.free(unsafe.Pointer(pcmd)) rv := C.sqlite3_exec(c.db, pcmd, nil, nil, nil) if rv != C.SQLITE_OK { return nil, c.lastError() } return &SQLiteResult{ int64(C._sqlite3_last_insert_rowid(c.db)), int64(C._sqlite3_changes(c.db)), }, nil }
func (c *conn) exec(cmd string) error { cstring := C.CString(cmd) defer C.free(unsafe.Pointer(cstring)) rv := C.sqlite3_exec(c.db, cstring, nil, nil, nil) return c.error(rv) }
// exec calls sqlite3_exec on sql, which must be a null-terminated C string. func (c *Conn) exec(sql *C.char) error { if rc := C.sqlite3_exec(c.db, sql, nil, nil, nil); rc != OK { return libErr(rc, c.db) } return nil }
// FastExec executes one or many non-parameterized statement(s) (separated by semi-colon) with no control and no stmt cache. func (c *Conn) FastExec(sql string) error { sqlstr := C.CString(sql) err := c.error(C.sqlite3_exec(c.db, sqlstr, nil, nil, nil)) C.free(unsafe.Pointer(sqlstr)) return err }