SA-MP Forums Archive
[Plugin] [REL] MySQL Plugin (Now on github!) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] [REL] MySQL Plugin (Now on github!) (/showthread.php?tid=56564)



Re: [REL] MySQL Plugin R5 (04/09/10) - Sergei - 11.10.2010

Oh my god. Start learning MySQL from begining. This isn't dini.


Re: [REL] MySQL Plugin R5 (04/09/10) - kurta999 - 12.10.2010

pawn Code:
WHERE (`id` = '%s')
This is shit! The reg id isn't string, use this:
pawn Code:
WHERE (`id` = '%d')
Queryes: ( Example )
pawn Code:
format(query, sizeof(query), "UPDATE `players` SET `PlayerLevel`='%d', `AdminLevel`='%d', `DonateRank`='%d' WHERE `id` = '%d'", PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pDonateRank], PlayerInfo[playerid][pSQLID]);
mysql_query(query);

// If query is long, continue this
format(query, sizeof(query), "UPDATE `players` SET `UpgradePoints`='%d', `ConnectedTime`='%d' WHERE `id` = '%d'",PlayerInfo[playerid][gPupgrade], PlayerInfo[playerid][pConnectTime], PlayerInfo[playerid][pSQLID]);
mysql_query(query);



Re: [REL] MySQL Plugin R5 (04/09/10) - Sergei - 12.10.2010

Code:
UPDATE players SET PlayerLevel=%d, AdminLevel=%d, DonateRank=%d WHERE id=%d
This would do the job. Without useless tags to shorten the string.


AW: [REL] MySQL Plugin R5 (04/09/10) - 4#Future - 17.10.2010

Hello community,

I have found some error...

In the orginal thread G-sTyLeZzZ write:

Quote:

# mysql_ping( [connectionHandle = 1] )
* Returns true (1) if the connection is alive, else (-1)

...but in the wiki he writes:

Quote:

0 if alive, 1 if dead.

if(!mysql_ping()) print("MySQL connection is still alive!");
if(mysql_ping()) print("MySQL connection is dead!");

So my question, which of them two is now the RIGHT usage?

Is "mysql_ping()" 1 = alive or 1 = dead??

Greetings - Fake


Re: [REL] MySQL Plugin R5 (04/09/10) - Sergei - 17.10.2010

0 if alive, 1 if dead. You can always try it yourself, can't you?


[REL] MySQL Plugin R5 (04/09/10) >> BUG REPORT! - 4#Future - 17.10.2010

Hello guys,

I have found a very big bug!
The usage "mysql_ping()" is still write false in the wiki...

I tested it and found the following...

Code:
if(mysql_ping())
{
   CONNECTION is true
}
But...

Code:
if(!mysql_ping())
{
   CONNECTION is false
}
That means, the function "if(mysql_ping())" returns 1 - ALIVE and 0 - DEATH.


On the other side it's not logical for MySQL to return " !mysql_ping() " as true, because ! means false...
Thats the right return and I tested it again and again, thats okay!

So for alle the guys who has problems, fix this and don't do it like the wiki!


Greetings - 4#Future


Re: [REL] MySQL Plugin R5 (04/09/10) >> BUG REPORT! - Calgon - 22.10.2010

Quote:
Originally Posted by 4#Future
View Post
big wall of text
OH MY GOD THIS IS BIGGER THAN Y2K! WE'RE ALL GOING TO DIE







f


Re: [REL] MySQL Plugin R5 (04/09/10) >> BUG REPORT! - Sergei - 22.10.2010

Quote:
Originally Posted by 4#Future
View Post
On the other side it's not logical for MySQL to return " !mysql_ping() " as true, because ! means false...
Yes it is logical: http://dev.mysql.com/doc/refman/5.1/en/mysql-ping.html
Quote:

Return Values

Zero if the connection to the server is active. Nonzero if an error occurred. A nonzero return does not indicate whether the MySQL server itself is down; the connection might be broken for other reasons such as network problems.

Return values of this plugin has been changed many times already.


Re: [REL] MySQL Plugin R5 (04/09/10) - Hal - 02.01.2011

Quote:
Originally Posted by GangsTa[MD]
Посмотреть сообщение
Where can I learn to script in MySQL?
Wiki page https://sampwiki.blast.hk/wiki/MySQL_Plugin

some tutorials here http://www.w3schools.com/sql/default.asp


Re: [REL] MySQL Plugin R5 (04/09/10) - Sergei - 02.01.2011

Quote:
Originally Posted by Hal
Посмотреть сообщение
It's https://sampwiki.blast.hk/wiki/MySQL


[REL] MySQL Plugin R5 (04/09/10) - [NoV]LaZ - 02.01.2011

Quote:
Originally Posted by [NoV]LaZ
Посмотреть сообщение
I don't know if anyone has this issue, but loading vehicles, checkpoints, etc. via database in OnGameModeInit using threaded queries is not possible. Or, maybe it is possible, I just don't know how.
I solved this. My problem was with the table. I attributed the wrong data type to fields holding float values. The vehicles are created although in server console is printed "Number of vehicles loaded: 0".


Re: [REL] MySQL Plugin R5 (04/09/10) - Slice - 02.01.2011

@LaZ:
The reason it says 0 models in the console is because that info is printed right after OnGameModeInit; however, when using a threaded query the code gets executed slightly after OnGameModeInit.
In my opinion it's not really neccessary to use threaded queries in OnGameModeInit unless using an external server or something.


Re: [REL] MySQL Plugin R5 (04/09/10) - Ivan_Pantovic - 05.01.2011

I get this error each time i try to use this plugin on windows :

What should i do ?


Re: [REL] MySQL Plugin R5 (04/09/10) - Souvlaki - 05.01.2011

Does it work on linux?
If not. do you have

pawn Код:
main() { }
in your script?


Re: [REL] MySQL Plugin R5 (04/09/10) - Ivan_Pantovic - 06.01.2011

Quote:
Originally Posted by Souvlaki
Посмотреть сообщение
Does it work on linux?
If not. do you have

pawn Код:
main() { }
in your script?
I didn't have it, now i added it and works perfect, thanks !


Re: [REL] MySQL Plugin R5 (04/09/10) - gtg2808 - 07.01.2011

mmmm


Re: [REL] MySQL Plugin R5 (04/09/10) - Sergei - 07.01.2011

Here is all you need: https://sampwiki.blast.hk/wiki/MySQL


Re: [REL] MySQL Plugin R5 (04/09/10) - gtg2808 - 07.01.2011

k thx ....


Re: [REL] MySQL Plugin R5 (04/09/10) - Sergei - 07.01.2011

Field names can't include spaces, so I can't give you example using your code. And don't post me a visitor message asking for a help ever again.


Re: [REL] MySQL Plugin R5 (04/09/10) - kurta999 - 08.01.2011

For me everytime crash server with this in windows. Usally after escaped text in query ( Chatlog, Commandlog ).

In linux not have any problem.