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 (R7 source available) - Vince - 20.02.2012

By my experience, one does not have to free the result if there was no result stored in the first place (empty result set).


Re: [REL] MySQL Plugin (R7 source available) - AndreT - 20.02.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
By my experience, one does not have to free the result if there was no result stored in the first place (empty result set).
Yeah, thanks for notifying.

It isn't elementary for everyone to understand that using these functions requires having a result stored by mysql_store_result()


AW: Re: [REL] MySQL Plugin (R7 source available) - Dandimite - 20.02.2012

Quote:
Originally Posted by AndreT
Посмотреть сообщение
Check if you're passing the right connection parameter to mysql_free_result(). Commands get out of synchronization if you have forgotten to free a result.

Codes like this are a source of problems as well, if there are 0 rows!
pawn Код:
// query
if(!mysql_num_rows())
{
    // send a message, blabla, whateva
    return true;
}
mysql_free_result();
Also, why not update your plugin to the newest version?
I forgot the connection parameter on each fuction except mysql_query <.< (yea its stupid i know xD)

And why I dont use the new version: my script isnґt threaded and i dont worked whit this. so i have to learn, but i think to start whit mysql and query isnґt the best way. so i learn threaded scripting and then starts whit threaded mysql scripting^^

And thanks 4 the fast help


Re: Re : [REL] MySQL Plugin (R7 source available) - Ricop522 - 20.02.2012

Quote:
Originally Posted by ombre
Посмотреть сообщение
Thanks Pooh7.

Kick in OnQueryFinish don't work? because I use and when I test and connects in the server I see the server restarting or lost connection ( but the server run) In the log there is 1 and 2. I'm kick because in the log "Neo has left the server" but don't have "server close the connection" or my clientmessage.

Код:
switch(resultid)
{
	case THREAD_BAN:
	{
		mysql_store_result(SQL1);
		if(IsPlayerConnected(extraid))
		{
			if(mysql_retrieve_row(SQL1))
			{
				...
				if()
				{
					...
                                        print("1");
					Kick(extraid);
                                        print("2");
			                mysql_free_result(SQL1);
				        return 1;
				}
                         }
		}
		mysql_free_result(SQL1);
         }
}
Same problem...


Re: [REL] MySQL Plugin (R7 source available) - Pooh7 - 20.02.2012

It works fine for me...

If you can't find a sloution, try to make the timer (100ms) that will kick a player, and put it in OnQueryFinish, it should help.


Re : [REL] MySQL Plugin (R7 source available) - ombre - 20.02.2012

pooh7 I use only threaded query.

In onplayerconnect if I use kick without return 1 = lost connection but if I use return 1 = close connection. But if I call OnQueryFinish in onplayerconnect and I kick the player in OnQueryFinish with or without return = lost connection + I don't see the sendclientmessage.

You use kick in OnQueryFinish (call other that onplayerconnect) for to works fine no?

EDIT: I use a timer and it's ok.


Re: Re : [REL] MySQL Plugin (R7 source available) - steki. - 20.02.2012

Quote:
Originally Posted by ombre
Посмотреть сообщение
pooh7 I use only threaded query.

In onplayerconnect if I use kick without return 1 = lost connection but if I use return 1 = close connection. But if I call OnQueryFinish in onplayerconnect and I kick the player in OnQueryFinish with or without return = lost connection + I don't see the sendclientmessage.

You use kick in OnQueryFinish (call other that onplayerconnect) for to works fine no?

EDIT: I use a timer and it's ok.
Quote:
Originally Posted by krisk @ ls-rp.com
Kick() and Ban() packets has high network priority while normal message packets has not, this will in many cases make the server kick you before you get a message about why. Meaning that if your name isn't registered it might kick you without telling you why.
aaaa


Re: [REL] MySQL Plugin (R7 source available) - kurta999 - 22.02.2012

There are possible to fetch the complete line with chace like mysql_fetch_row_format(), and then load the data with sscanf (p<|>....) ?


Re: [REL] MySQL Plugin (R7 source available) - Pooh7 - 22.02.2012

There is no cache function for that.


Re: [REL] MySQL Plugin (R7 source available) - Kar - 22.02.2012

Can someone compile R7 on CentOS 5? Volt-Host uses CentOS 5 on there servers ;\


Re: [REL] MySQL Plugin (R7 source available) - AndreT - 22.02.2012

From my post 2 weeks ago: http://sf-se.net/dev/mysql_r7_centos.so

Try it out!


Re: [REL] MySQL Plugin (R7 source available) - Kar - 23.02.2012

[04:01:45] Failed (libmysqlclient_r.so.16: cannot open shared object file: No such file or directory)
[04:01:45] Loading plugin: mysql_R7.so

yet they are saying a CentOS 5 version will work..?


Re: [REL] MySQL Plugin (R7 - 25/02/12) - Calgon - 25.02.2012

Thanks for the update.


Re: [REL] MySQL Plugin (R7 - 25/02/12) - Luis- - 25.02.2012

My script wont compile, i've added the new include and dll file.
Код:
C:\Users\BooNii3\Scripts\Project Avaition 0.3d\gamemodes\projectaviation.pwn(2971) : error 017: undefined symbol "mysql_query"
I don't know why.


Re: [REL] MySQL Plugin (R7 - 25/02/12) - TheArcher - 25.02.2012

Only 1 fix & 1 feature for R7? Seems like not effort on this update.


Respuesta: Re: [REL] MySQL Plugin (R7 - 25/02/12) - kirk - 25.02.2012

Quote:
Originally Posted by TheArcher
Посмотреть сообщение
Only 1 fix & 1 feature for R7? Seems like not effort on this update.
If i were you i would open the source code.


Re: [REL] MySQL Plugin (R7 - 25/02/12) - AndreT - 25.02.2012

Quote:
Originally Posted by -Luis
Посмотреть сообщение
My script wont compile, i've added the new include and dll file.
Код:
C:\Users\BooNii3\Scripts\Project Avaition 0.3d\gamemodes\projectaviation.pwn(2971) : error 017: undefined symbol "mysql_query"
I don't know why.
Look up a few pages!

There is a macro for mysql_query as far as I can remember, but it is a little bugged. Remove the spaces in the definition's first parameter, so e.g.
#define HELLO(%1, %2, %3) printf("HEY!");
becomes
#define HELLO(%1,%2,%3) printf("HEY!");

Then the macro will work, but nevertheless I suggest you rewrite your queries to the new mysql_function_query format! It is much more useful, again, look through the thread for more information!


Re: [REL] MySQL Plugin (R7 - 25/02/12) - Vince - 25.02.2012

Quote:
Originally Posted by -Luis
Посмотреть сообщение
My script wont compile, i've added the new include and dll file.
Код:
C:\Users\BooNii3\Scripts\Project Avaition 0.3d\gamemodes\projectaviation.pwn(2971) : error 017: undefined symbol "mysql_query"
I don't know why.
As stated, the R7 will only work for threaded queries. The mysql_query function is removed and there is now only mysql_function_query.


Re: [REL] MySQL Plugin (R7 - 25/02/12) - AndreT - 25.02.2012

@Vince
Open up a_mysql.inc. There are 2 macros for backwards compatibility:
pawn Код:
#define mysql_query_callback(%1,%2,%3,%4,%5) \
    mysql_function_query(%5, %2, false, %3, "siii", %2, %1, %4, %5)

#define mysql_query(%1,%2,%3,%4) \
    mysql_function_query(%4, %1, false, "OnQueryFinish", "siii", %1, %2, %3, %4)
I fixed the spacing.


Re: [REL] MySQL Plugin (R7 - 25/02/12) - Calgon - 25.02.2012

Quote:
Originally Posted by TheArcher
Посмотреть сообщение
Only 1 fix & 1 feature for R7? Seems like not effort on this update.
The source code for R7 has been available for a while, it has only just been compiled for Windows and with a bug fix that was reported.