[Plugin] [REL] MySQL Plugin (Now on github!)

Quote:
Originally Posted by Lenny_Carlson
Quote:
Originally Posted by $ЂЯĢ
I have never had any problems with time functions in MySQL. Does it get wrong time only via SA:MP server (using this plugin) or also when running query via console/phpmyadmin/etc?
Only from the SA-MP server apparently, not via console at least

Quote:
Originally Posted by Sma_X
Are samp server and mysql server hosted on the same pc ?

Have you started/configured the mysql server with a different timezone ? http://dev.mysql.com/doc/refman/5.1/...e-support.html
Yes, it's hosted from the same PC and it's configured properly

I'm also joining the game on the same computer, do you think it could have something to do with low performance?
anyone?
Reply

links down,
can anyone upload the linux x86 version and libmysqlclient.so.15
Reply

How i can return russian charset? In base i have table with varchar (cp1251), in mode after mysql_connect mysql_set_charset("cp1251");, but no way..


[10:40:00] CMySQLHandler::FetchField("Owner") - ?
[10:40:00] >> mysql_real_escape_string( Connection handle: 1 )
[10:40:00] CMySQLHandler::EscapeString(?); - Escaped 7 characters to ?.


FIXED THANKS
Reply

How can i detect, if the mysql-client exits ?
Got that issue one time, and no player could acess the server anymore...
I`d like to restart the srever (restarting is not the problem) whenever the plugin crashs...
Reply

1. You select only field named 'time', so it's obvious that mysql_fetch_field can't find any field named 'hdwid'.
2. If plugin crashes, SA:MP server crashes.
3. MySQL client?
Reply

Yep, after i posted this, i saw it by myself, but thanks anyways

Nope, one time i got a log entry like this:
Quote:

Cant fetch the field... The MySQL Database has left

Reply

You probably got "MySQL server has gone away". Reas more about that here: http://dev.mysql.com/doc/refman/5.0/en/gone-away.html
Reply

Exactly, thanks
Reply

Hi $ЂЯĢ, i need your help, how i can restore my result with this query:

stock GetPlayerHouses(playerid)
{
new playername[MAX_PLAYER_NAME+10], sql[128];
GetPlayerName(playerid, playername, sizeof(playername));
format(sql, sizeof(sql), "SELECT ArrayID FROM houses WHERE Owner = '%s' AND Dates = 1", playername);
mysql_query(sql);
mysql_store_result();
}
In tables 3-4 same owner names, i need return all ArrayIDS, where Owner is playername and Dates = 1, it possible 2-3 playername in one table.

Regards.
Reply

update mysqllib.so link please
Reply

Nothing can be done atcompeltly same time. You can't raise your hands at the same time, computer can't start two programs at the same time, MySQL server cannot respond to two requests at the same time. There is a difference, maybe it's 0.00000000000000000000000001ms, but don't say it's the same time.

And I don't know what can be messed up since I haven't seen someone using two connections for the same thing on the same database.
Reply

Quote:
Originally Posted by ludow12
Hello

I have a problem.
I install mysql.dll on the plugins directory, and I config my server configuration but when I run the server, my Windows gives me an error:
MSVCR100.dll is missing...

I install this .dll on the system 32 directory but Windows gives me an other error...

What the problem ? How I do ?

Thanks

Sorry for my bad english.
Try with the VS9 version. That works for me
Reply

Quote:
Originally Posted by Seif_
No you didn't understand me, I'm using 2 connections, not 1. 2 connections but they're both on the same database but different tables. Because when I tried loading another table while loading a table, it messes up and just stops loading both tables, that's why 2 connections should solve it. And it actually did but now it stopped working.
Well, I didn't understand you because you are the first person I know that uses two connections to the same table. Could you tell us what is the query you want?, maybe there's another solution. If you still want to use two connection, we'll need more information to understand your problem.
Reply

Ok Astaroth

EDIT: Yes, my server runs correctly !
Thanks
Reply

How can I resolve MySQL error 2006, which says: "MySQL server has gone away". I researched it a bit and it had something to do with max_allowed_packet. How can I change 'max_allowed_packet' so I don't have to encounter this again?
Reply

Upon querying check your server connection is alive and if not reconnect. Or better yet do what I do - ping the server every 60 seconds.
Reply

Quote:
Originally Posted by Seif_
You're still not understanding. I'm not using 2 connections for the same table! I'm using 2 connections for the same database, but not table. I have a table that loads some stuff from another table. And when I try loading it while loading the other table with the SAME connection, it stops. So using 2 connections, each loading different tables, would work. And it did then it stopped working.

EDIT: Nevermind I fixed it... I thought mysql_connect returned 0 if it didn't connect to the database, figured 0 was also a connection ID now and I now used mysql_ping to check if it connected or not. Thanks, I also do stupid mistakes.
Ups, I mean "Database".
Reply

I am trying to make an OnPlayerLogin but when I /login, the data not load... but I have the SendClientMessage "You are now connected" correctly.

This is my code, I use R4 VS9 version of this plugin.

Код:
public OnPlayerLogin(playerid,password[])
{
	new query[256];
	new sendername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, sendername, sizeof(sendername));
	mysql_real_escape_string(password,password);
	format(query,sizeof(query),"SELECT * FROM %s WHERE Name = '%s' AND Password = md5('%s') LIMIT 1", TABLENAME, sendername, password);
	mysql_query(query);
	mysql_store_result(ConnexionBDD);
	if(mysql_retrieve_row(ConnexionBDD))
	{
		new field[11];
		mysql_store_result(ConnexionBDD);
		mysql_fetch_field_row(field, "Level"); PlayerInfo[playerid][pLevel] = strval(field);
		mysql_fetch_field_row(field, "AdminLevel"); PlayerInfo[playerid][pAdmin] = strval(field);
		mysql_fetch_field_row(field, "DonateRank"); PlayerInfo[playerid][pDonateRank] = strval(field);
		mysql_fetch_field_row(field, "Char"); PlayerInfo[playerid][pChar] = strval(field);
		mysql_fetch_field_row(field, "Bank"); PlayerInfo[playerid][pAccount] = strval(field);
		mysql_fetch_field_row(field, "Leader"); PlayerInfo[playerid][pLeader] = strval(field);
		mysql_fetch_field_row(field, "Member"); PlayerInfo[playerid][pMember] = strval(field);
		mysql_fetch_field_row(field, "Rank"); PlayerInfo[playerid][pRank] = strval(field);
		mysql_fetch_field_row(field, "Job"); PlayerInfo[playerid][pJob] = strval(field);
		mysql_fetch_field_row(field, "Kills"); PlayerInfo[playerid][pKills] = strval(field);
		mysql_fetch_field_row(field, "Deaths"); PlayerInfo[playerid][pDeaths] = strval(field);
		mysql_fetch_field_row(field, "PhoneBook"); PlayerInfo[playerid][pPhoneBook] = strval(field);
		mysql_fetch_field_row(field, "PhoneNr"); PlayerInfo[playerid][pPnumber] = strval(field);
		mysql_fetch_field_row(field, "Drugs"); PlayerInfo[playerid][pDrugs] = strval(field);
		mysql_fetch_field_row(field, "Warnings"); PlayerInfo[playerid][pWarns] = strval(field);
		mysql_fetch_field_row(field, "WarnReason1"); strmid(PlayerInfo[playerid][pWarnReason1], field, 0, strlen(field)-1, 255);
		mysql_fetch_field_row(field, "WarnReason2"); strmid(PlayerInfo[playerid][pWarnReason2], field, 0, strlen(field)-1, 255);
		mysql_fetch_field_row(field, "WarnReason3"); strmid(PlayerInfo[playerid][pWarnReason3], field, 0, strlen(field)-1, 255);
		SendClientMessage(playerid, COLOR_RED, "You are now connected.");
		gPlayerLogged[playerid] = 1;
		SpawnPlayer(playerid);
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, " Wrong password.");
	}
	mysql_free_result(ConnexionBDD);
	return 1;
}
Reply

Quote:
Originally Posted by ludow12
I am trying to make an OnPlayerLogin but when I /login, the data not load... but I have the SendClientMessage "You are now connected" correctly.

This is my code, I use R4 VS9 version of this plugin.

Код:
public OnPlayerLogin(playerid,password[])
{
	new query[256];
	new sendername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, sendername, sizeof(sendername));
	mysql_real_escape_string(password,password);
	format(query,sizeof(query),"SELECT * FROM %s WHERE Name = '%s' AND Password = md5('%s') LIMIT 1", TABLENAME, sendername, password);
	mysql_query(query);
	mysql_store_result(ConnexionBDD);
	if(mysql_retrieve_row(ConnexionBDD))
	{
		new field[11];
		mysql_store_result(ConnexionBDD);
		mysql_fetch_field_row(field, "Level"); PlayerInfo[playerid][pLevel] = strval(field);
		mysql_fetch_field_row(field, "AdminLevel"); PlayerInfo[playerid][pAdmin] = strval(field);
		mysql_fetch_field_row(field, "DonateRank"); PlayerInfo[playerid][pDonateRank] = strval(field);
		mysql_fetch_field_row(field, "Char"); PlayerInfo[playerid][pChar] = strval(field);
		mysql_fetch_field_row(field, "Bank"); PlayerInfo[playerid][pAccount] = strval(field);
		mysql_fetch_field_row(field, "Leader"); PlayerInfo[playerid][pLeader] = strval(field);
		mysql_fetch_field_row(field, "Member"); PlayerInfo[playerid][pMember] = strval(field);
		mysql_fetch_field_row(field, "Rank"); PlayerInfo[playerid][pRank] = strval(field);
		mysql_fetch_field_row(field, "Job"); PlayerInfo[playerid][pJob] = strval(field);
		mysql_fetch_field_row(field, "Kills"); PlayerInfo[playerid][pKills] = strval(field);
		mysql_fetch_field_row(field, "Deaths"); PlayerInfo[playerid][pDeaths] = strval(field);
		mysql_fetch_field_row(field, "PhoneBook"); PlayerInfo[playerid][pPhoneBook] = strval(field);
		mysql_fetch_field_row(field, "PhoneNr"); PlayerInfo[playerid][pPnumber] = strval(field);
		mysql_fetch_field_row(field, "Drugs"); PlayerInfo[playerid][pDrugs] = strval(field);
		mysql_fetch_field_row(field, "Warnings"); PlayerInfo[playerid][pWarns] = strval(field);
		mysql_fetch_field_row(field, "WarnReason1"); strmid(PlayerInfo[playerid][pWarnReason1], field, 0, strlen(field)-1, 255);
		mysql_fetch_field_row(field, "WarnReason2"); strmid(PlayerInfo[playerid][pWarnReason2], field, 0, strlen(field)-1, 255);
		mysql_fetch_field_row(field, "WarnReason3"); strmid(PlayerInfo[playerid][pWarnReason3], field, 0, strlen(field)-1, 255);
		SendClientMessage(playerid, COLOR_RED, "You are now connected.");
		gPlayerLogged[playerid] = 1;
		SpawnPlayer(playerid);
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, " Wrong password.");
	}
	mysql_free_result(ConnexionBDD);
	return 1;
}
I don't know if it's the problem but, you're calling "mysql_store_result" twice before get the flieds.

What says your mysql_log file?
Reply

Yes, I delete the mysql_store_result thanks.

But, I /login but the data not load completely, load only
Код:
mysql_fetch_field_row(field, "Warnings"); PlayerInfo[playerid][pWarns] = strval(field);
mysql_fetch_field_row(field, "WarnReason1"); strmid(PlayerInfo[playerid][pWarnReason1], field, 0, strlen(field)-1, 255);
mysql_fetch_field_row(field, "WarnReason2"); strmid(PlayerInfo[playerid][pWarnReason2], field, 0, strlen(field)-1, 255);
mysql_fetch_field_row(field, "WarnReason3"); strmid(PlayerInfo[playerid][pWarnReason3], field, 0, strlen(field)-1, 255);
I don't understand.

Thanks for your help!
Reply


Forum Jump:


Users browsing this thread: 27 Guest(s)