作者:rs
项目:sqlit
func (s *stmt) Exec(args []driver.Value) (driver.Result, error) {
if s.closed {
panic("database/sql/driver: misuse of sqlite driver: Exec after Close")
}
if s.rows {
panic("database/sql/driver: misuse of sqlite driver: Exec with active Rows")
}
err := s.start(args)
if err != nil {
return nil, err
}
rv := C.sqlite3_step(s.stmt)
if errno(rv) != stepDone {
if rv == 0 {
rv = 21 // errMisuse
}
return nil, s.c.error(rv)
}
id := int64(C.sqlite3_last_insert_rowid(s.c.db))
rows := int64(C.sqlite3_changes(s.c.db))
return &result{id, rows}, nil
}
作者:kazy
项目:go-sqlit
func (stmt Stmt) Exec(args []driver.Value) (driver.Result, error) {
if err := stmt.bind(args); err != nil {
return nil, err
}
r := C.sqlite3_step(stmt.stmt)
db := C.sqlite3_db_handle(stmt.stmt)
if r != C.SQLITE_DONE && r != C.SQLITE_ROW {
return nil, dbError(db)
}
var result Result
result.rowsAffected = int64(C.sqlite3_changes(db))
result.lastInsertId = int64(C.sqlite3_last_insert_rowid(db))
return &result, nil
}
作者:npower
项目:gosqlit
// Changes returns the number of database rows that were changed or inserted or deleted by the most recently completed SQL statement on the database connection.
// If a separate thread makes changes on the same database connection while Changes() is running then the value returned is unpredictable and not meaningful.
// (See http://sqlite.org/c3ref/changes.html)
func (c *Conn) Changes() int {
return int(C.sqlite3_changes(c.db))
}
作者:ly
项目:go-db-sqlite
func (self *sqlConnection) sqlChanges() int {
return int(C.sqlite3_changes(self.handle))
}
作者:ly
项目:go-sqlite
func (r *SQLiteResult) RowsAffected() (int64, error) {
return int64(C.sqlite3_changes(r.s.c.db)), nil
}
作者:cska
项目:gosqlite
func (h *Handle) Changes() int {
return int(C.sqlite3_changes(h.cptr))
}
作者:rw
项目:gosqlite
func (db *Database) Changes() int {
return int(C.sqlite3_changes(db.handle))
}
作者:gidde
项目:cloudlu
// RowsAffected returns the number of rows that were changed, inserted, or
// deleted by the most recent statement. Auxiliary changes caused by triggers or
// foreign key actions are not counted.
// [http://www.sqlite.org/c3ref/changes.html]
func (c *Conn) RowsAffected() int {
if c.db == nil {
return 0
}
return int(C.sqlite3_changes(c.db))
}