MySQL question (connection handle)
#1

Hi,I'm using BlueG's mysql plugin and I converted my gm to the R7 version.
My problem is this:
.
PHP код:
.
.
.
[
06:21:14] >> mysql_closeConnection handle)
[
06:21:14CMySQLHandler::~CMySQLHandler() - deconstructor called.
[
06:21:14CMySQLHandler::FreeResult() - The result is already empty.
[
06:21:14CMySQLHandler::Disconnect() - Connection was closed.
[
06:21:59] >> mysql_pingConnection handle)
[
06:21:59] >> mysql_ping() - Invalid connection handle. (You set1Highest connection handle ID is 0).
[
06:21:59] >> mysql_closeConnection handle)
[
06:21:59] >> mysql_close() - Invalid connection handle. (You set1Highest connection handle ID is 0).
[
06:21:59] >> mysql_connect(localhostrootsamp2, ******) on port 3306
[06:21:59CMySQLHandler::CMySQLHandler() - constructor called.
[
06:21:59CMySQLHandler::CMySQLHandler() - Connecting to "localhost" DB"samp2" Username"root"
[06:21:59CMySQLHandler::Connect() - Connection was successful.
[
06:21:59CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[
06:21:59] >> mysql_pingConnection handle)
[
06:21:59CMySQLHandler::Ping() - Connection is still alive.
[
06:21:59] >> mysql_query_callbackConnection handle)
[
06:21:59] >> mysql_query_callbackConnection handle)
[
06:21:59] >> mysql_query_callbackConnection handle)
[
06:21:59] >> mysql_query_callbackConnection handle)
[
06:21:59] >> mysql_query_callbackConnection handle)
[
06:21:59] >> mysql_query_callbackConnection handle)
[
06:21:59] >> mysql_query_callbackConnection handle)
[
06:21:59] >> mysql_query_callbackConnection handle)
[
06:21:59] >> mysql_query_callbackConnection handle)
[
06:21:59] >> mysql_query_callbackConnection handle)
[
06:21:59] >> mysql_query_callbackConnection handle)
[
06:21:59] >> mysql_query_callbackConnection handle)
[
06:21:59] >> mysql_query_callbackConnection handle)
.
.

Is it ok to return so much "mysql_query_callback( Connection handle: 1 )"?
If not, how can i fix it?

Thanks and srry for my bad english.
Reply
#2

It is ok, but why are you doing it?
Reply
#3

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
It is ok, but why are you doing it?
Doing what?
Reply
#4

Why are you sending so many queries within one second?
Reply
#5

That's how i update a player's info:

Код:
		
.
.
                format(l_string,sizeof(l_string), "UPDATE `players` SET `PlayerLevel` = '%d' WHERE `Name` = '%s'",PlayerInfo[playerid][pLevel],name);
		mysql_function_query(dbHandle, l_string, false, "", "");

		format(l_string,sizeof(l_string), "UPDATE `players` SET `AdminLevel` = '%d' WHERE `Name` = '%s'",PlayerInfo[playerid][pAdmin],name);
		mysql_function_query(dbHandle, l_string, false, "", "");

		format(l_string,sizeof(l_string), "UPDATE `players` SET `HelperLevel` = '%d' WHERE `Name` = '%s'",PlayerInfo[playerid][pHelper],name);
		mysql_function_query(dbHandle, l_string, false, "", "");

		format(l_string,sizeof(l_string), "UPDATE `players` SET `DonateRank` = '%d' WHERE `Name` = '%s'",PlayerInfo[playerid][pDonateRank],name);
		mysql_function_query(dbHandle, l_string, false, "", "");

		format(l_string,sizeof(l_string), "UPDATE `players` SET `UpgradePoints` = '%d' WHERE `Name` = '%s'",PlayerInfo[playerid][gPupgrade],name);
		mysql_function_query(dbHandle, l_string, false, "", "");
.
.
Reply
#6

In the R7 version, every query will call an callback when it finish its execution... the only "problem" there is that the plugin are calling an callback that is not even set, but I think that it will not slow down your server, since every query runs in a thread.
Reply
#7

Quote:
Originally Posted by pop.nicku
Посмотреть сообщение
That's how i update a player's info:

Код:
		
.
.
                format(l_string,sizeof(l_string), "UPDATE `players` SET `PlayerLevel` = '%d' WHERE `Name` = '%s'",PlayerInfo[playerid][pLevel],name);
		mysql_function_query(dbHandle, l_string, false, "", "");

		format(l_string,sizeof(l_string), "UPDATE `players` SET `AdminLevel` = '%d' WHERE `Name` = '%s'",PlayerInfo[playerid][pAdmin],name);
		mysql_function_query(dbHandle, l_string, false, "", "");

		format(l_string,sizeof(l_string), "UPDATE `players` SET `HelperLevel` = '%d' WHERE `Name` = '%s'",PlayerInfo[playerid][pHelper],name);
		mysql_function_query(dbHandle, l_string, false, "", "");

		format(l_string,sizeof(l_string), "UPDATE `players` SET `DonateRank` = '%d' WHERE `Name` = '%s'",PlayerInfo[playerid][pDonateRank],name);
		mysql_function_query(dbHandle, l_string, false, "", "");

		format(l_string,sizeof(l_string), "UPDATE `players` SET `UpgradePoints` = '%d' WHERE `Name` = '%s'",PlayerInfo[playerid][gPupgrade],name);
		mysql_function_query(dbHandle, l_string, false, "", "");
.
.
That honestly defeats the purpose of using mysql if you're going to update ONE field per query.
pawn Код:
format(l_string,sizeof l_string, "UPDATE `players` SET\
    `PlayerLevel` = %d,\
    `AdminLevel = %d,\
    `HelperLevel` = %d,\
    `DonateRank` = %d,\
    `UpgradePoints` = %d\
    `WHERE `Name` = '%s'"
,
    PlayerInfo[playerid][pLevel],
    PlayerInfo[playerid][pAdmin],
    PlayerInfo[playerid][pHelper],
    PlayerInfo[playerid][pDonateRank],
    PlayerInfo[playerid][gPupgrade],
    name
);
mysql_function_query(dbHandle, l_string, false, "", "");
Reply
#8

Yeah, i know, i did it so to detect the problems, if any...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)