MySql plugin R7 problem..
#1

Why mysql_num_rows always return -1 ?

i have this in mysql log
Code:
[22:37:35] >> mysql_num_rows( Connection handle: 1 )
[22:37:35] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)
but connection is good and all other mysql functions work , only mysql_num_rows return -1 ..
Reply
#2

The connection maybe is dieing on the query, take a look on it, if you're not changing the data or adding rows which aren't on mysql...
Reply
#3

Where's the rest of the log? Dead connection is mainly the result of wrong authentication credentials.
Reply
#4

Code:
[00:32:47]  ** MySQL Debugging enabled (06/15/12)
[00:32:47]  
[00:32:47] >> mysql_connect(localhost, root, db, ******) on port 3306
[00:32:47] CMySQLHandler::CMySQLHandler() - constructor called.
[00:32:47] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "sampserver" | Username: "root"
[00:32:47] CMySQLHandler::Connect() - Connection was successful.
[00:32:47] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[00:32:47] >> mysql_ping( Connection handle: 1 )
[00:32:47] CMySQLHandler::Ping() - Connection is still alive.
[00:32:51] >> mysql_query_callback( Connection handle: 1 )
[00:32:51] >> mysql_store_result( Connection handle: 1 )
[00:32:51] CMySQLHandler::StoreResult() - No data to store.
[00:32:51] Passing query SELECT * FROM Users | 
[00:32:51] >> mysql_retrieve_row( Connection handle: 1 )
[00:32:51] CMySQLHandler::RetrieveRow() - You cannot call this function now. (Reason: Empty Result)
[00:32:51] >> mysql_free_result( Connection handle: 1 )
[00:32:51] CMySQLHandler::FreeResult() - The result is already empty.
[00:32:51] ProcessQueryThread(OnQueryFinish) - Query was successful. (SELECT * FROM Users)
[00:32:51] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[00:32:51] OnQueryFinish() - Threaded function called.
[00:35:29] >> mysql_query_callback( Connection handle: 1 )
[00:35:29] >> mysql_store_result( Connection handle: 1 )
[00:35:29] CMySQLHandler::StoreResult() - Result was stored.
[00:35:29] Passing query SELECT * FROM Users WHERE User ='dud' | 
[00:35:29] >> mysql_num_rows( Connection handle: 1 )
[00:35:29] CMySQLHandler::NumRows() - Returned 1 row(s)
[00:35:29] >> mysql_num_rows( Connection handle: 1 )
[00:35:29] CMySQLHandler::NumRows() - Returned 1 row(s)
[00:35:29] >> mysql_query_callback( Connection handle: 1 )
[00:35:29] >> mysql_free_result( Connection handle: 1 )
[00:35:29] CMySQLHandler::FreeResult() - Result was successfully free'd.
[00:35:30] ProcessQueryThread(OnQueryFinish) - Query was successful. (SELECT * FROM Users WHERE User ='dud')
[00:35:30] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[00:35:30] OnQueryFinish() - Threaded function called.
[00:35:30] CMySQLHandler::ProcessQueryThread() - Reconnection attempt in background thread.
[00:35:30] CMySQLHandler::Connect() - Connection was successful.
[00:35:30] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[00:35:30] Passing query   UPDATE Users SET  AdminLevel = '10' WHERE User = 'dud' )
[00:35:30] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[00:35:30] OnQueryFinish() - Threaded function called.
[00:35:31] >> mysql_query_callback( Connection handle: 1 )
[00:35:31] >> mysql_store_result( Connection handle: 1 )
[00:35:31] CMySQLHandler::StoreResult() - No data to store.
[00:35:31] >> mysql_num_rows( Connection handle: 1 )
[00:35:31] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)
[00:35:31] Passing query SELECT * FROM Users WHERE User ='dud' | 
[00:35:31] ProcessQueryThread(OnQueryFinish) - Query was successful. (SELECT * FROM Users WHERE User ='dud')
[00:35:31] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[00:35:31] >> mysql_num_rows( Connection handle: 1 )
[00:35:31] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)
[00:35:31] >> mysql_num_rows( Connection handle: 1 )
[00:35:31] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)
[00:35:31] >> mysql_query_callback( Connection handle: 1 )
[00:35:31] >> mysql_free_result( Connection handle: 1 )
[00:35:31] CMySQLHandler::FreeResult() - The result is already empty.
[00:35:31] OnQueryFinish() - Threaded function called.
[00:35:31] CMySQLHandler::ProcessQueryThread() - Reconnection attempt in background thread.
[00:35:31] CMySQLHandler::Connect() - Connection was successful.
[00:35:31] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[00:35:31] Passing query INSERT INTO Users (User) VALUES('dud') | 
[00:35:31] ProcessQueryThread(OnQueryFinish) - Query was successful. (INSERT INTO Users (User) VALUES('dud'))
[00:35:31] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[00:35:31] OnQueryFinish() - Threaded function called.
Reply
#5

bump
Reply
#6

Quote:
Code:
CMySQLHandler::RetrieveRow() - You cannot call this function now. (Reason: Empty Result)
It seems that you have freed the result before getting the number of rows.
Reply
#7

I'm having the same issue. Says connection successful, but says dead connection when I try to do anything.

Here's the pawn code for the mysql

Code:
public OnPlayerConnect(playerid)
{
    new DBHandle = mysql_connect("127.0.0.1","root","samp","changeme");
	new pname[24], checkPlayerName[110], result[500], welcome[50];
	GetPlayerName(playerid, pname, 24);
	mysql_format(DBHandle, checkPlayerName, "SELECT * FROM 'playerdata' WHERE 'user' = '%s'", pname);
	mysql_reconnect(DBHandle);
	mysql_function_query(DBHandle, checkPlayerName, false, "", "");
	mysql_store_result();
	new rows = mysql_num_rows();
	if(rows == 0)
	{
	    SendClientMessage(playerid, -1, "You don't exist!!");
 	}
 	else if(rows == 1)
 	{
		format(welcome,sizeof(welcome), "Welcome back, %s", pname);
		SendClientMessage(playerid, -1, welcome);
		SendClientMessage(playerid, -1, "lololol");
	}
	else
	{
	    SendClientMessage(playerid, -1, "this is a fallback");
 	}
	return 1;
}
Here's the mysql.log
Code:
[10:42:27] >> mysql_connect(127.0.0.1, root, samp, ******) on port 3306
[10:42:27] CMySQLHandler::CMySQLHandler() - constructor called.
[10:42:27] CMySQLHandler::CMySQLHandler() - Connecting to "127.0.0.1" | DB: "samp" | Username: "root"
[10:42:27] CMySQLHandler::Connect() - Connection was successful.
[10:42:27] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[10:42:50] >> mysql_connect(127.0.0.1, root, samp, ******) on port 3306
[10:42:50] CMySQLHandler::Connect() - Connection was successful.
[10:42:50] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[10:42:50] >> mysql_format( Connection handle: 1 )
[10:42:50] >> mysql_reconnect( Connection handle: 1 )
[10:42:50] CMySQLHandler::Disconnect() - Connection was closed.
[10:42:50] CMySQLHandler::Connect() - Connection was successful.
[10:42:50] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[10:42:50] >> mysql_query_callback( Connection handle: 1 )
[10:42:50] >> mysql_store_result( Connection handle: 1 )
[10:42:50] CMySQLHandler::StoreResult() - No data to store.
[10:42:50] Passing query SELECT * FROM 'playerdata' WHERE 'user' = 'person' | 
[10:42:50] >> mysql_num_rows( Connection handle: 1 )
[10:42:50] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[10:42:50] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)
I don't understand why this is happening, is it a problem with my code? I don't think it's a permissions issue as I'm logging in as root for mysql.

I know it's not wrong login credentials becuase I tried the wrong info and it said that access was denied...
Reply
#8

i have the same problem :@
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)