library/src/databases/bpdb/BP-DB.cc
// Attempts to checkin a mariadb connection after you're done with use.  All data
// from previous queries are cleared after checkin of a connection.
Attempts to checkin a mariadb connection after you're done with use.  All data
from previous queries are cleared after checkin of a connection.
Attempts to checkin a mariadb connection after you ' re done with use . All data from previous queries are cleared after checkin of a connection .
BP_ERROR_T BP_DBCheckInMariadbConnection(P_BPDB bpdb, P_BP_MYSQL_SESSION mariadbi)
{
	if(!bpdb)
		return ERR_FAILURE;
	if(!bpdb->system_hreg)
		return ERR_FAILURE;
	BPDB_ENTER_CRITICAL_SECTION;
	P_BP_MYSQL_SESSION lookup_connection = BP_DBLookupMariadbConnectionByUUID(bpdb, mariadbi->uuid);
	if(!lookup_connection)
	{
		BP_DBAddErrorMsg(bpdb, "BP_DBCheckInMariadbConnection tried to lookup connection for checkin via BP_DBLookupMariadbConnectionByUUID, but failed.");
		return ERR_FAILURE;
	}
	if(!lookup_connection->pool_available)
	{
		mariadbi->pool_available = BP_TRUE;
		BPDB_LEAVE_CRITICAL_SECTION_AND_RETURN(ERR_SUCCESS);
	}
	BPDB_LEAVE_CRITICAL_SECTION_AND_RETURN(ERR_FAILURE);
}
BP_ERROR_T BP_DBCheckInMariadbConnection ( P_BPDB bpdb , P_BP_MYSQL_SESSION mariadbi ) { if ( ! bpdb ) return ERR_FAILURE ; if ( ! bpdb -> system_hreg ) return ERR_FAILURE ; BPDB_ENTER_CRITICAL_SECTION ; P_BP_MYSQL_SESSION lookup_connection = BP_DBLookupMariadbConnectionByUUID ( bpdb , mariadbi -> uuid ) ; if ( ! lookup_connection ) { BP_DBAddErrorMsg ( bpdb , " " ) ; return ERR_FAILURE ; } if ( ! lookup_connection -> pool_available ) { mariadbi -> pool_available = BP_TRUE ; BPDB_LEAVE_CRITICAL_SECTION_AND_RETURN ( ERR_SUCCESS ) ; } BPDB_LEAVE_CRITICAL_SECTION_AND_RETURN ( ERR_FAILURE ) ; }
Attempts to checkin a mariadb connection after you're done with use.
Attempts to checkin a mariadb connection after you ' re done with use .
// ensure we have a bpdb structure // enter critical section // lookup the connection in the table // make the pool entry available // return null if we can't find a connection which hasn't been checked out