Пример #1
0
func (tx *OCI8Tx) Commit() error {
	tx.c.inTransaction = false
	if rv := C.OCITransCommit(
		(*C.OCISvcCtx)(tx.c.svc),
		(*C.OCIError)(tx.c.err),
		0); rv != C.OCI_SUCCESS {
		return ociGetError(tx.c.err)
	}
	return nil
}
Пример #2
0
func (tx *OCI8Tx) Commit() error {
	rv := C.OCITransCommit(
		(*C.OCISvcCtx)(tx.c.svc),
		(*C.OCIError)(tx.c.err),
		0)
	if rv == C.OCI_ERROR {
		return ociGetError(tx.c.err)
	}
	return nil
}
Пример #3
0
func (conn *OCI8Conn) Commit() error {
	if !conn.inTx {
		panic("Can't commit, not in transaction?")
	}
	rv := C.OCITransCommit(
		(*C.OCISvcCtx)(conn.svc),
		(*C.OCIError)(conn.err),
		0)
	conn.inTx = false
	return conn.check(rv, "OCI8Conn.Commit()")
}
Пример #4
0
// Commit commits the transaction on the connection.
func (conn *Connection) Commit() error {
	// make sure we are actually connected
	if !conn.IsConnected() {
		return nil //?
	}

	conn.srvMtx.Lock()
	defer conn.srvMtx.Unlock()
	// perform the commit
	//Py_BEGIN_ALLOW_THREADS
	if err := conn.environment.CheckStatus(
		C.OCITransCommit(conn.handle, conn.environment.errorHandle,
			C.ub4(conn.commitMode)), "Commit"); err != nil {
		return err
	}
	conn.commitMode = C.OCI_DEFAULT
	//Py_END_ALLOW_THREADS
	return nil
}
Пример #5
0
// Commit commits the transaction.
//
// Commit is a member of the driver.Tx interface.
func (tx *Tx) Commit() (err error) {
	tx.mu.Lock()
	defer tx.mu.Unlock()
	if tx == nil {
		return nil
	}
	tx.log(_drv.cfg.Log.Tx.Commit)
	if err = tx.checkIsOpen(); err != nil {
		return err
	}
	defer tx.closeWithRemove()
	r := C.OCITransCommit(
		tx.ses.ocisvcctx,      //OCISvcCtx    *svchp,
		tx.ses.srv.env.ocierr, //OCIError     *errhp,
		C.OCI_DEFAULT)         //ub4          flags );
	if r == C.OCI_ERROR {
		return tx.ses.srv.env.ociError()
	}
	return nil
}