zabbix-agent2/src/libs/zbxdb/db.c
/******************************************************************************
 *                                                                            *
 * Function: zbx_db_commit                                                    *
 *                                                                            *
 * Purpose: commit transaction                                                *
 *                                                                            *
 * Comments: do nothing if DB does not support transactions                   *
 *                                                                            *
 ******************************************************************************/
zbx_db_commit

Purpose: commit transaction

Comments: do nothing if DB does not support transactions
zbx_db_commit Purpose : commit transaction Comments : do nothing if DB does not support transactions
int	zbx_db_commit(void)
{
	int	rc = ZBX_DB_OK;
#ifdef HAVE_ORACLE
	sword	err;
#endif
	if (0 == txn_level)
	{
		zabbix_log(LOG_LEVEL_CRIT, "ERROR: commit without transaction."
				" Please report it to Zabbix Team.");
		assert(0);
	}
	if (ZBX_DB_OK != txn_error)
		return ZBX_DB_FAIL; 
#if defined(HAVE_ORACLE)
	if (OCI_SUCCESS != (err = OCITransCommit(oracle.svchp, oracle.errhp, OCI_DEFAULT)))
		rc = OCI_handle_sql_error(ERR_Z3005, err, "commit failed");
#elif defined(HAVE_MYSQL) || defined(HAVE_POSTGRESQL) || defined(HAVE_SQLITE3)
	rc = zbx_db_execute("commit;");
#endif
	if (ZBX_DB_OK > rc) { 
		txn_error = rc;
		return rc;
	}
#ifdef HAVE_SQLITE3
	zbx_mutex_unlock(sqlite_access);
#endif
	txn_level--;
	txn_end_error = ZBX_DB_OK;
	return rc;
}
int zbx_db_commit ( void ) { int rc = ZBX_DB_OK ; #ifdef HAVE_ORACLE sword err ; #endif if ( 0 == txn_level ) { zabbix_log ( LOG_LEVEL_CRIT , " " " " ) ; assert ( 0 ) ; } if ( ZBX_DB_OK != txn_error ) return ZBX_DB_FAIL ; #if defined ( HAVE_ORACLE ) if ( OCI_SUCCESS != ( err = OCITransCommit ( oracle . svchp , oracle . errhp , OCI_DEFAULT ) ) ) rc = OCI_handle_sql_error ( ERR_Z3005 , err , " " ) ; #elif defined ( HAVE_MYSQL ) || defined ( HAVE_POSTGRESQL ) || defined ( HAVE_SQLITE3 ) rc = zbx_db_execute ( " " ) ; #endif if ( ZBX_DB_OK > rc ) { txn_error = rc ; return rc ; } #ifdef HAVE_SQLITE3 zbx_mutex_unlock ( sqlite_access ) ; #endif txn_level -- ; txn_end_error = ZBX_DB_OK ; return rc ; }
Function: zbx_db_commit                                                    
                                                                            
 Purpose: commit transaction                                                
                                                                            
 Comments: do nothing if DB does not support transactions
Function : zbx_db_commit Purpose : commit transaction Comments : do nothing if DB does not support transactions
/* commit called on failed transaction */ /* commit failed */