library/src/blockclass/BP-BlockClass.cc
// Sets the spidered flag of the last retrieved record
Sets the spidered flag of the last retrieved record
Sets the spidered flag of the last retrieved record
BP_ERROR_T Block::setLastResultSpideredStatus(size_t status_code)
{
	if (!this->web_result_href || !this->web_result_id || !this->mysqlSession)
		return ERR_FAILURE;
	BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION;
	size_t id   = this->web_result_id;
	char * query = (char *) "UPDATE `results` SET `spidered` = ?, `spidered_timestamp` = NOW() WHERE `results`.`id` =?;";
	this->mysqlDestroyStatement();
	this->mysqlPrepareQuery(query);
	this->mysqlAddParameter(MYSQL_TYPE_LONG, (char *) &status_code, sizeof(status_code));
	this->mysqlAddParameter(MYSQL_TYPE_LONG, (char *) &id, sizeof(id));
	this->mysqlBindParameters();
	this->mysqlExecuteStatement();
	if(this->web_result_stack_n)
	{
		this->web_result_stack[this->web_result_stack_current_index].record_already_updated_spidered = 1;
	}
	this->mysqlDestroyStatement();
	BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_SUCCESS);
}
BP_ERROR_T Block :: setLastResultSpideredStatus ( size_t status_code ) { if ( ! this -> web_result_href || ! this -> web_result_id || ! this -> mysqlSession ) return ERR_FAILURE ; BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION ; size_t id = this -> web_result_id ; char * query = ( char * ) " " ; this -> mysqlDestroyStatement ( ) ; this -> mysqlPrepareQuery ( query ) ; this -> mysqlAddParameter ( MYSQL_TYPE_LONG , ( char * ) & status_code , sizeof ( status_code ) ) ; this -> mysqlAddParameter ( MYSQL_TYPE_LONG , ( char * ) & id , sizeof ( id ) ) ; this -> mysqlBindParameters ( ) ; this -> mysqlExecuteStatement ( ) ; if ( this -> web_result_stack_n ) { this -> web_result_stack [ this -> web_result_stack_current_index ] . record_already_updated_spidered = 1 ; } this -> mysqlDestroyStatement ( ) ; BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_SUCCESS ) ; }
Sets the spidered flag of the last retrieved record
Sets the spidered flag of the last retrieved record
// check for result // enter critical section // set local variables (for readability) // update query // prepare query // add parameters // add result id // bind parameters // execute query // === Now Manipulate Result Stack if Necessary (prevents dual updates with stack updates) // clear data where necessary // return indicating success