Exemplo n.º 1
0
/************************************************************************
* name: connection_end_tran
* arguments: 
* returns/side-effects: 
* description: 
* NOTE: 
************************************************************************/
PRIVATE RETCODE
connection_end_tran (ODBC_CONNECTION * conn, short completion_type)
{
  ODBC_STATEMENT *stmt;
  int cci_rc;
  T_CCI_ERROR cci_err_buf;
  char type;

  if (completion_type == SQL_COMMIT)
    {
      type = CCI_TRAN_COMMIT;
    }
  else
    {
      type = CCI_TRAN_ROLLBACK;
    }

  if (conn->connhd > 0)
    {
      cci_rc = cci_end_tran (conn->connhd, type, &cci_err_buf);
      if (cci_rc < 0)
	{
	  odbc_set_diag_by_cci (conn->diag, cci_rc, cci_err_buf.err_msg);
	  return ODBC_ERROR;
	}
    }

  // delete all open cursor
  for (stmt = conn->statements; stmt; stmt = stmt->next)
    {
      odbc_close_cursor (stmt);
    }

  return ODBC_SUCCESS;
}
Exemplo n.º 2
0
VALUE
cubrid_conn_end_tran(Connection *con, int type)
{
    int res;
    T_CCI_ERROR error;

    CHECK_CONNECTION(con, Qnil);

    res = cci_end_tran(con->handle, type, &error);
    if (res < 0) {
        cubrid_handle_error(res, &error);
    }

    return Qnil;
}
Exemplo n.º 3
0
HRESULT CCUBRIDSession::DoCASCCICommit(bool bCommit)
{
	int hConn;
	HRESULT hr = GetConnectionHandle(&hConn);
	if(FAILED(hr)) return E_FAIL;

	T_CCI_ERROR err_buf;
	int rc = cci_end_tran(hConn, bCommit?CCI_TRAN_COMMIT:CCI_TRAN_ROLLBACK, &err_buf);
	if(rc<0) return bCommit?XACT_E_COMMITFAILED:E_FAIL;

	// TxnCallback을 호출해 좀비로 만든다.
	POSITION pos = m_grpTxnCallbacks.GetHeadPosition();
	while(pos)
		m_grpTxnCallbacks.GetNext(pos)->TxnCallback(0);

	return S_OK;
}