library/src/blockclass/BP-BlockClass.cc
// this will disable web result stack entries which have a configuration that matches the configured thresholds
// (query is very fast due to multiple indexing).
this will disable web result stack entries which have a configuration that matches the configured thresholds
(query is very fast due to multiple indexing).
this will disable web result stack entries which have a configuration that matches the configured thresholds ( query is very fast due to multiple indexing ) .
BP_ERROR_T Block::disableWebResultStackRecords(size_t base_hit_threshold, size_t path_hit_threshold, size_t script_hit_threshold)
{
	if(!this->mysqlSession)
		return ERR_FAILURE;
	BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION;
	if(!this->web_result_stack_n)
		BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_FAILURE);
	char * base_hit_threshold_s   = BP_SizeTToMySQLBuffer(base_hit_threshold);
	char * path_hit_threshold_s   = BP_SizeTToMySQLBuffer(path_hit_threshold);
	char * script_hit_threshold_s = BP_SizeTToMySQLBuffer(script_hit_threshold);
	this->webResultStackWhereClauses();
	BP_StringUtils * builder = NULL;
	if(this->path_n)
	{
		builder = new BP_StringUtils(NULL);
		builder->BuildString((char *) "UPDATE `results` SET `disabled` = 1 ");
		builder->BuildString((char *) " JOIN `result_path_uris` ON ");
		builder->BuildString((char *) this->results_in_path_clause);
		builder->BuildString((char *) " WHERE ");
		builder->BuildString((char *) this->results_in_id_clause);
		builder->BuildString((char *) " AND `result_path_uris`.`hits` >= ");
		builder->BuildString((char *) path_hit_threshold_s);
		this->mysqlPrepareQuery(builder->build_str);
		this->mysqlExecuteStatement();
		this->mysqlDestroyStatement();
		delete builder;
	}
	if(this->base_n)
	{
		builder = new BP_StringUtils(NULL);
		builder->BuildString((char *) "UPDATE `results` SET `disabled` = 1, `disabled_base` = 1 JOIN `result_base_uris` ON ");
		builder->BuildString((char *) this->results_in_base_clause);
		builder->BuildString((char *) " WHERE ");
		builder->BuildString((char *) this->results_in_id_clause);
		builder->BuildString((char *) " AND `result_base_uris`.`hits` >= ");
		builder->BuildString((char *) base_hit_threshold_s);
		this->mysqlPrepareQuery(builder->build_str);
		this->mysqlExecuteStatement();
		this->mysqlDestroyStatement();
		delete builder;
	}
	if(this->script_n)
	{
		builder = new BP_StringUtils(NULL);
		builder->BuildString((char *) "UPDATE `results` SET `disabled` = 1, `disabled_script` = 1 JOIN `result_script_uris` ON ");
		builder->BuildString((char *) this->results_in_script_clause);
		builder->BuildString((char *) " WHERE ");
		builder->BuildString((char *) this->results_in_id_clause);
		builder->BuildString((char *) " AND `result_script_uris`.`hits` >= ");
		builder->BuildString((char *) script_hit_threshold_s);
		this->mysqlPrepareQuery(builder->build_str);
		this->mysqlExecuteStatement();
		this->mysqlDestroyStatement();
		delete builder;
	}
	if(base_hit_threshold_s)
		bpfree(base_hit_threshold_s);
	if(path_hit_threshold_s)
		bpfree(path_hit_threshold_s);
	if(script_hit_threshold_s)
		bpfree(script_hit_threshold_s);
	BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_SUCCESS);
}
BP_ERROR_T Block :: disableWebResultStackRecords ( size_t base_hit_threshold , size_t path_hit_threshold , size_t script_hit_threshold ) { if ( ! this -> mysqlSession ) return ERR_FAILURE ; BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION ; if ( ! this -> web_result_stack_n ) BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_FAILURE ) ; char * base_hit_threshold_s = BP_SizeTToMySQLBuffer ( base_hit_threshold ) ; char * path_hit_threshold_s = BP_SizeTToMySQLBuffer ( path_hit_threshold ) ; char * script_hit_threshold_s = BP_SizeTToMySQLBuffer ( script_hit_threshold ) ; this -> webResultStackWhereClauses ( ) ; BP_StringUtils * builder = NULL ; if ( this -> path_n ) { builder = new BP_StringUtils ( NULL ) ; builder -> BuildString ( ( char * ) " " ) ; builder -> BuildString ( ( char * ) " " ) ; builder -> BuildString ( ( char * ) this -> results_in_path_clause ) ; builder -> BuildString ( ( char * ) " " ) ; builder -> BuildString ( ( char * ) this -> results_in_id_clause ) ; builder -> BuildString ( ( char * ) " " ) ; builder -> BuildString ( ( char * ) path_hit_threshold_s ) ; this -> mysqlPrepareQuery ( builder -> build_str ) ; this -> mysqlExecuteStatement ( ) ; this -> mysqlDestroyStatement ( ) ; delete builder ; } if ( this -> base_n ) { builder = new BP_StringUtils ( NULL ) ; builder -> BuildString ( ( char * ) " " ) ; builder -> BuildString ( ( char * ) this -> results_in_base_clause ) ; builder -> BuildString ( ( char * ) " " ) ; builder -> BuildString ( ( char * ) this -> results_in_id_clause ) ; builder -> BuildString ( ( char * ) " " ) ; builder -> BuildString ( ( char * ) base_hit_threshold_s ) ; this -> mysqlPrepareQuery ( builder -> build_str ) ; this -> mysqlExecuteStatement ( ) ; this -> mysqlDestroyStatement ( ) ; delete builder ; } if ( this -> script_n ) { builder = new BP_StringUtils ( NULL ) ; builder -> BuildString ( ( char * ) " " ) ; builder -> BuildString ( ( char * ) this -> results_in_script_clause ) ; builder -> BuildString ( ( char * ) " " ) ; builder -> BuildString ( ( char * ) this -> results_in_id_clause ) ; builder -> BuildString ( ( char * ) " " ) ; builder -> BuildString ( ( char * ) script_hit_threshold_s ) ; this -> mysqlPrepareQuery ( builder -> build_str ) ; this -> mysqlExecuteStatement ( ) ; this -> mysqlDestroyStatement ( ) ; delete builder ; } if ( base_hit_threshold_s ) bpfree ( base_hit_threshold_s ) ; if ( path_hit_threshold_s ) bpfree ( path_hit_threshold_s ) ; if ( script_hit_threshold_s ) bpfree ( script_hit_threshold_s ) ; BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_SUCCESS ) ; }
this will disable web result stack entries which have a configuration that matches the configured thresholds
(query is very fast due to multiple indexing).
this will disable web result stack entries which have a configuration that matches the configured thresholds ( query is very fast due to multiple indexing ) .
// ensure we have a mysql session // enter db critical section // only work when we have a result stack to  process // base hit threshold // path hi treshold // script hit threshold // create where clauses // create a new builder // create new builder // build update path query // build and execute // build update base query // build and execute // build update script query // build and execute // bpfree allocated variables.  Don't use // tq free as it is not used for variable allocation. // return indicating success