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

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

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()
Reply

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
Reply

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...
Reply

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.
Reply

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.
Reply

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
Reply

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

There is no cache function for that.
Reply

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

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

Try it out!
Reply

[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..?
Reply

Thanks for the update.
Reply

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.
Reply

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

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.
Reply

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!
Reply

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.
Reply

@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.
Reply

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)