library/src/blockclass/BP-BlockClass.cc
// if a jit check results in a match, you can use this to store the match in the db
if a jit check results in a match, you can use this to store the match in the db
if a jit check results in a match you can use this to store the match in the db
BP_ERROR_T Block::insertWebJITExpressionMatch(size_t group_id, size_t test_id, size_t result_id, char * match_val, size_t match_len)
{
	if(!match_val)
		return ERR_FAILURE;
	if(!this->mysqlSession)
		return ERR_FAILURE;
	BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION;
	char * query = (char *) "INSERT INTO `web_jit_expression_matches`(`group_id`, `test_id`, `result_id`, `sha1`, `matched`) VALUES (?, ?,  ?, SHA1(?), ? )";
	if (this->mysqlPrepareQuery((char *) query ) == ERR_FAILURE)
	{
		this->AddErrorToStack((char*) "\n Cannot prepare query");
		BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_FAILURE);
	}
	this->mysqlPrepareQuery(query);
	this->mysqlAddParameter(MYSQL_TYPE_LONG, (char *) &group_id, sizeof(group_id));
	this->mysqlAddParameter(MYSQL_TYPE_LONG, (char *) &test_id, sizeof(test_id));
	this->mysqlAddParameter(MYSQL_TYPE_LONG, (char *) &this->web_result_id, sizeof(this->web_result_id));
	this->mysqlAddParameter(MYSQL_TYPE_STRING, (char *) match_val, match_len);
	this->mysqlAddParameter(MYSQL_TYPE_STRING, (char *) match_val, match_len);
	this->mysqlBindParameters();
	this->mysqlExecuteStatement();
	this->mysqlDestroyStatement();
	BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_SUCCESS);
}
BP_ERROR_T Block :: insertWebJITExpressionMatch ( size_t group_id , size_t test_id , size_t result_id , char * match_val , size_t match_len ) { if ( ! match_val ) return ERR_FAILURE ; if ( ! this -> mysqlSession ) return ERR_FAILURE ; BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION ; char * query = ( char * ) " " ; if ( this -> mysqlPrepareQuery ( ( char * ) query ) == ERR_FAILURE ) { this -> AddErrorToStack ( ( char * ) " \n " ) ; BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_FAILURE ) ; } this -> mysqlPrepareQuery ( query ) ; this -> mysqlAddParameter ( MYSQL_TYPE_LONG , ( char * ) & group_id , sizeof ( group_id ) ) ; this -> mysqlAddParameter ( MYSQL_TYPE_LONG , ( char * ) & test_id , sizeof ( test_id ) ) ; this -> mysqlAddParameter ( MYSQL_TYPE_LONG , ( char * ) & this -> web_result_id , sizeof ( this -> web_result_id ) ) ; this -> mysqlAddParameter ( MYSQL_TYPE_STRING , ( char * ) match_val , match_len ) ; this -> mysqlAddParameter ( MYSQL_TYPE_STRING , ( char * ) match_val , match_len ) ; this -> mysqlBindParameters ( ) ; this -> mysqlExecuteStatement ( ) ; this -> mysqlDestroyStatement ( ) ; BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_SUCCESS ) ; }
if a jit check results in a match, you can use this to store the match in the db
if a jit check results in a match you can use this to store the match in the db
// ensure we have a match value // ensure we have a mysql session // enter critical section // update query // prepare the query // prepare query // add result type // add match // add sha1 // bind parameters // execute query // destroy the statement after the query runs // return indicating success