Example #1
0
// Rollback aborts the current transaction.
func (d *DB) Rollback() error {
	if C.kcdbendtran(d.db, 0) == 0 {
		msg := d.LastError()
		return KCError(fmt.Sprintf("Could not rollback the transaction: %s.", msg))
	}
	return nil
}
Example #2
0
// Commit commits the current transaction.
func (d *DB) Commit() error {
	if C.kcdbendtran(d.db, 1) == 0 {
		msg := d.LastError()
		return KCError(fmt.Sprintf("Could not commit the transaction: %s.", msg))
	}
	return nil
}
Example #3
0
func (kc *KCDB) EndTran(commit bool) (err error) {
	var ccommit C.int32_t
	if commit {
		ccommit = 1
	} else {
		ccommit = 0
	}
	if C.kcdbendtran(kc.db, ccommit) == 0 {
		err = kc.error()
	}
	return
}