作者: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
// LastInsertRowid returns the rowid of the most recent successful INSERT into the database.
// If a separate thread performs a new INSERT on the same database connection while the LastInsertRowid() function is running and thus changes the last insert rowid, then the value returned by LastInsertRowid() is unpredictable and might not equal either the old or the new last insert rowid.
// (See http://sqlite.org/c3ref/last_insert_rowid.html)
func (c *Conn) LastInsertRowid() int64 {
return int64(C.sqlite3_last_insert_rowid(c.db))
}
作者:ly
项目:go-db-sqlite
func (self *sqlConnection) sqlLastInsertRowId() int64 {
return int64(C.sqlite3_last_insert_rowid(self.handle))
}
作者:ly
项目:go-sqlite
func (r *SQLiteResult) LastInsertId() (int64, error) {
var rr int64
rr = int64(C.sqlite3_last_insert_rowid(r.s.c.db))
return rr, nil
}
作者:cska
项目:gosqlite
func (h *Handle) LastInsertRowID() int64 {
return int64(C.sqlite3_last_insert_rowid(h.cptr))
}
作者:seacoastbo
项目:go-sqlite
func (r *SQLiteResult) LastInsertId() (int64, error) {
return int64(C.sqlite3_last_insert_rowid(r.s.c.db)), nil
}
作者:rw
项目:gosqlite
func (db *Database) LastInsertRowID() int64 {
return int64(C.sqlite3_last_insert_rowid(db.handle))
}
作者:gidde
项目:cloudlu
// LastInsertId returns the ROWID of the most recent successful INSERT
// statement.
// [http://www.sqlite.org/c3ref/last_insert_rowid.html]
func (c *Conn) LastInsertId() int64 {
if c.db == nil {
return 0
}
return int64(C.sqlite3_last_insert_rowid(c.db))
}