MySQL Threaded Query Help
#1

How would i set iRows (in stock MySQL_NameExists) to the value that is being returned in NameExistsCheck?

Код:
stock MySQL_NameExists(const account[])
{
	new
	    szQuery[128],
		iRows = 0;
		

	mysql_tquery(MySQL, "SELECT * FROM `accounts` WHERE `Name` = 'Bryan'", "NameExistsCheck()", "", "");

	//Set iRows to rows in NameExistsCheck()

	printf("Rows for name exists: '%d'", iRows);

	return iRows;
}

forward NameExistsCheck();
public NameExistsCheck()
{
	new rows = cache_get_row_count();
	printf("Rows for name exists2: '%d'", rows);
		
	if(rows >= 1) {
		rows = 1;
	}
	else {
		rows = 0;
	}

	return rows;
}
Reply
#2

It doesn't work like that. Such constructs aren't at all possible with threaded queries. Y_inline is probably the closest you can get.

The public function doesn't actually return program flow to the place it was initiated. That's pretty much the whole point of threads. The main server thread doesn't have to wait for the query and as soon as the query gets sent the server continues to do other stuff.
Reply
#3

Okay but if i use mysql_query won't the server freeze?

EDIT: I'll just put the rest of the coding in that function for registration/login. Not sure why i didn't think of that in the first place. Thanks for the response anyway!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)