library/src/blockclass/BP-BlockClass.cc
// write delayed jit entries to the database
write delayed jit entries to the database
write delayed jit entries to the database
BP_ERROR_T Block::flushWebJITExpressionMatchDelayedSQL()
{
	if(!this->mysqlSession)
		return ERR_FAILURE;
	BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION;
	if(!this->jit_delayed_insert_sql)
		BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_FAILURE);
	BP_StringUtils * builder = new BP_StringUtils(NULL);
	if(this->jit_delayed_insert_sql[bpstrlen(this->jit_delayed_insert_sql)-1] == ',')
		this->jit_delayed_insert_sql[bpstrlen(this->jit_delayed_insert_sql)-1] = (char) 0x00;
	builder->BuildString((char *) "INSERT INTO `web_jit_expression_matches` (group_id, test_id, result_id, sha1, matched) VALUES ");
	builder->BuildString(this->jit_delayed_insert_sql);
	this->mysqlDestroyStatement();
	this->mysqlPrepareQuery(builder->build_str);
	this->mysqlExecuteStatement();
	this->mysqlDestroyStatement();
	delete builder;
	tq_free(this->tq, this->jit_delayed_insert_sql);
	this->jit_delayed_insert_sql = NULL;
	BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_SUCCESS);
}
BP_ERROR_T Block :: flushWebJITExpressionMatchDelayedSQL ( ) { if ( ! this -> mysqlSession ) return ERR_FAILURE ; BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION ; if ( ! this -> jit_delayed_insert_sql ) BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_FAILURE ) ; BP_StringUtils * builder = new BP_StringUtils ( NULL ) ; if ( this -> jit_delayed_insert_sql [ bpstrlen ( this -> jit_delayed_insert_sql ) - 1 ] == ' ' ) this -> jit_delayed_insert_sql [ bpstrlen ( this -> jit_delayed_insert_sql ) - 1 ] = ( char ) 0x00 ; builder -> BuildString ( ( char * ) " " ) ; builder -> BuildString ( this -> jit_delayed_insert_sql ) ; this -> mysqlDestroyStatement ( ) ; this -> mysqlPrepareQuery ( builder -> build_str ) ; this -> mysqlExecuteStatement ( ) ; this -> mysqlDestroyStatement ( ) ; delete builder ; tq_free ( this -> tq , this -> jit_delayed_insert_sql ) ; this -> jit_delayed_insert_sql = NULL ; BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_SUCCESS ) ; }
write delayed jit entries to the database
write delayed jit entries to the database
// ensure we have a session // enter critical section // ensure we have a sql value set // create a new builder to finish the quey // remove trailing comma if necessary // build in the values // do the deed // destroy data // free item // return indicating success