MYSQL crash problems -
Saurik - 27.11.2011
Hello.
I've recently moved to a VPS Debian 6. I installed the proper Blueg's plugin for a debian server.
When i am using a command which checks and echos a player's ban details, the server crashes. This did not happen with volt-host and the other plugin volt-host provided me with. ( i did not edit the script)
The thing that crashes the server is mysql_get_field (it crashes the server)
Interesting thing is that the field "Banner" doesn't crash the server but all others do.
Code:
IRCCMD:banned(botid, channel[], user[], host[], params[])
{
new name[100],msg[300];
if(sscanf(params, "s", name)) return 0;
format(Query, sizeof(Query), "SELECT `banner`,`reason`,`banlength`,`bandate` FROM `bans` WHERE `name` = '%s' LIMIT 1 ", name);
mysql_query(Query);
mysql_store_result();
if (mysql_num_rows() == 0) return IRC_GroupSay(gGroupID,IRC_ADMIN,"1 Sorry, This user is not found in bans list.");
new banner[30],reason[50],bandate[30],index, line[50],buffer[149],banl[30],result[200];
mysql_retrieve_row(); <---- DOESNT CRASH IT
mysql_get_field("banner", banner); <---- DOESNT CRASH IT
mysql_get_field("reason", reason); <---- crashes it
mysql_get_field("banlength", banl); <----- Crashes it
mysql_get_field("bandate", bandate); <--- crashes it
/// REST OF THE CODE NOW SHOWN (doesnt crash it anyway)
return 1;
}
Re: MYSQL crash problems -
Scenario - 27.11.2011
pawn Code:
mysql_get_field("reason", reason);
Is the "reason" longer than 50 characters in length?
Re: MYSQL crash problems -
Saurik - 27.11.2011
nope, the reason is "poop" also i increased all the strings. still crashes.
Re: MYSQL crash problems -
Scenario - 27.11.2011
No errors in the mysql_log.txt file either?
Re: MYSQL crash problems -
Saurik - 27.11.2011
nope, no errors. just crashes.
Re: MYSQL crash problems -
blazee14 - 27.11.2011
Do you have IRC Logs?
Re: MYSQL crash problems -
Saurik - 27.11.2011
there is no need for irc logs
Re: MYSQL crash problems -
Scenario - 27.11.2011
Quote:
Originally Posted by blazee14
Do you have IRC Logs?
|
The issue is with MySQL here, not with IRC.
---
Try using sscanf to retrieve the information. I'll give you an example if you are sure how:
pawn Code:
new szResult[2500];
mysql_store_result();
while(mysql_fetch_row_format(szResult, "|"))
{
sscanf("p<|>s[25]s[129]iiii", pInfo[extraid][pUsername], pInfo[extraid][pPassword], pInfo[extraid][pAdmin], pInfo[extraid][pScore], pInfo[extraid][pKills], pInfo[extraid][pDeaths]);
mysql_free_result();
}
Something like that. Notice how the "s's" and "i's" in the sscanf line correspond with the type of variable they are being saved into.