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

this is my code and i have no mysql error :

Quote:
PHP код:
public OnPlayerConnect(playerid)
{
    new 
pName[MAX_PLAYER_NAME], pIp[40], escapedQuery[128];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
GetPlayerIp(playeridpIpMAX_IP_LENGTH);
    
mysql_format(gConnectionescapedQuery"SELECT * FROM `banList` WHERE `bannedName` = '%e' OR bannedIp = '%s'"pNamepIp);
    
mysql_function_query(gConnectionescapedQuerytrue"OnCheckBanList""i"playerid);

mysql_log :

Quote:

[07:40:23] >> mysql_connect(localhost, root, fc-rp, ******) on port 3306
[07:40:23] CMySQLHandler::CMySQLHandler() - constructor called.
[07:40:23] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "fc-rp" | Username: "root"
[07:40:23] CMySQLHandler::Connect() - Connection was successful.
[07:40:23] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[07:40:48] >> mysql_format( Connection handle: 1 )
[07:40:48] CMySQLHandler::EscapeString(Karim_Squallisss); - Escaped 16 characters to Karim_Squallisss.
[07:40:48] >> mysql_query_callback( Connection handle: 1 )
[07:40:48] Passing query SELECT * FROM `banList` WHERE `bannedName` = 'Karim_Squallisss' OR bannedIp = '127.0.0.1' | i
[07:40:48] ProcessQueryThread(OnCheckBanList) - Query was successful. (SELECT * FROM `banList` WHERE `bannedName` = 'Karim_Squallisss' OR bannedIp = '127.0.0.1')
[07:40:48] ProcessQueryThread(OnCheckBanList) - Data caching enabled.
[07:40:48] CMySQLHandler::StoreResult() - Result was stored.
[07:40:48] CMySQLHandler::FreeResult() - Result was successfully free'd.
[07:40:48] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[07:40:48] OnCheckBanList(i) - Threaded function called.
[07:40:48] ProcessTick() - The cache has been cleared.
[07:40:58] >> mysql_format( Connection handle: 1 )
[07:40:58] CMySQLHandler::EscapeString(Karim_Squallisss); - Escaped 16 characters to Karim_Squallisss.
[07:40:58] >> mysql_query_callback( Connection handle: 1 )
[07:40:58] Passing query SELECT * FROM `banList` WHERE `bannedName` = 'Karim_Squallisss' OR bannedIp = '127.0.0.1' | i
[07:40:58] ProcessQueryThread(OnCheckBanList) - Query was successful. (SELECT * FROM `banList` WHERE `bannedName` = 'Karim_Squallisss' OR bannedIp = '127.0.0.1')
[07:40:58] ProcessQueryThread(OnCheckBanList) - Data caching enabled.
[07:40:58] CMySQLHandler::StoreResult() - Result was stored.
[07:40:58] CMySQLHandler::FreeResult() - Result was successfully free'd.
[07:40:58] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[07:40:58] OnCheckBanList(i) - Threaded function called.
[07:40:58] ProcessTick() - The cache has been cleared.
[07:41:14] >> mysql_format( Connection handle: 1 )
[07:41:14] CMySQLHandler::EscapeString(Karim_Squallisss); - Escaped 16 characters to Karim_Squallisss.
[07:41:14] >> mysql_query_callback( Connection handle: 1 )
[07:41:14] Passing query SELECT * FROM `banList` WHERE `bannedName` = 'Karim_Squallisss' OR bannedIp = '127.0.0.1' | i
[07:41:14] ProcessQueryThread(OnCheckBanList) - Query was successful. (SELECT * FROM `banList` WHERE `bannedName` = 'Karim_Squallisss' OR bannedIp = '127.0.0.1')
[07:41:14] ProcessQueryThread(OnCheckBanList) - Data caching enabled.
[07:41:14] CMySQLHandler::StoreResult() - Result was stored.
[07:41:14] CMySQLHandler::FreeResult() - Result was successfully free'd.
[07:41:14] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[07:41:14] OnCheckBanList(i) - Threaded function called.
[07:41:14] ProcessTick() - The cache has been cleared.
samp_log
Quote:

SA-MP Dedicated Server
----------------------
v0.3e, ©2005-2012 SA-MP Team

[07:40:23] filterscripts = "" (string)
[07:40:23]
[07:40:23] Server Plugins
[07:40:23] --------------
[07:40:23] Loading plugin: mysql
[07:40:23]

> MySQL plugin R7 successfully loaded.

[07:40:23] Loaded.
[07:40:23] Loading plugin: sscanf
[07:40:23]

[07:40:23] ===============================

[07:40:23] sscanf plugin loaded.

[07:40:23] © 2009 Alex "******" Cole

[07:40:23] 0.3d-R2 500 Players "dnee"

[07:40:23] ===============================

[07:40:23] Loaded.
[07:40:23] Loading plugin: streamer
[07:40:23]

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[07:40:23] Loaded.
[07:40:23] Loading plugin: regex
[07:40:23]


[07:40:23] ______________________________________


[07:40:23] Regular Expression Plugin v0.2.1 loaded
[07:40:23] ______________________________________


[07:40:23] By: Fro © Copyright <TBG> 2009-2011
[07:40:23] ______________________________________


[07:40:23] Loaded.
[07:40:23] Loaded 4 plugins.

[07:40:23]
[07:40:23] Filterscripts
[07:40:23] ---------------
[07:40:23] Loaded 0 filterscripts.

[07:40:23]
----------------------------------
[07:40:23] Blank Gamemode by your name here
[07:40:23] ----------------------------------

[07:40:23] Number of vehicle models: 0
[07:40:48] Incoming connection: 127.0.0.1:56395
[07:40:48] [join] Karim_Squallisss has joined the server (0:127.0.0.1)
[07:40:48] [part] Karim_Squallisss has left the server (0:2)
[07:40:58] Incoming connection: 127.0.0.1:56396
[07:40:58] [join] Karim_Squallisss has joined the server (0:127.0.0.1)
[07:40:58] [part] Karim_Squallisss has left the server (0:2)
[07:41:13] Incoming connection: 127.0.0.1:56397
[07:41:14] [join] Karim_Squallisss has joined the server (0:127.0.0.1)
[07:41:14] [part] Karim_Squallisss has left the server (0:2)
Reply

Kick() "in" OnPlayerConnect() is bugged, try this:

pawn Код:
public OnCheckBanList(playerid) // just a test code without verification
{
    SendClientMessage(playerid, COLOR_ERROR, "Your are banned");
    SetTimerEx("KickPlayer", 4500, false, "d", playerid);
}

// Somewhere in the script..
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
    return Kick(playerid);
}
Reply

Yeah its working , thanks.
Reply

Quote:
Originally Posted by AndreT
Посмотреть сообщение
Threaded queries work fine in the R6 plugin, but there is a bug in the logging messages. However I suggest all scripters that want to start using this plugin to take on R7 immediately. Even more since you want threaded queries. R7 provides more functionality for those.

Is this bug fixed in R7?
Reply

http://files.g-stylezzz.com/mysql/rel/R7-2/mysql.dll
Reply

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
Thank you, but i need a linux version to our server too.
Where can i download it?

Because the R7 version eat much much ram :S
Reply

Quote:
Originally Posted by Reboma
Посмотреть сообщение
Thank you, but i need a linux version to our server too.
Where can i download it?

Because the R7 version eat much much ram :S
Well, read the post, and go to Downloads, and choose your desired version and Linux Distro.
Reply

Quote:
Originally Posted by Reboma
Посмотреть сообщение
Thank you, but i need a linux version to our server too.
Where can i download it?

Because the R7 version eat much much ram :S
http://www.egaming.ro/MySQL/R7-2/ or http://mirror1.egaming.ro/MySQL/R7-2/linux/
Reply

Those are not the original upload locations, so beware!
Reply

Quote:
Originally Posted by BlueG
Посмотреть сообщение
Thanks for all your feedback. I've recently fixed some of the known bugs (memory leaks as well as mysql_format() crashes while using the '%e' specifier) with the help of CHC and Zeex on IRC. I would like to share the source and get some feedback before I fully release it (to avoid future bugs).

http://www.file-upload.net/download-.../R7-2.rar.html
Can you please compile it so we can test it out?

EDIT: nvm need to pay more attention to the other posts.
Reply

Is it me or is R7-2 still crashing servers? My server crashes unexpectedly, crashdetect (4.8.1) picks up no backtrace and says it crashes due to an unknown error.. just like it did in R7. but the memory is stable around 33mb in R7-2 and it crashes randomly ;\
Reply

Do you have any code in OnQueryError ? if yes, comment it and try again.
Reply

Hello, all
I have special function written to R6 MySQL plugin
How can I rewrite it on R7 version?

Quote:

stock fromUnixTime(time)
{
new unbantime[25];
format(str, sizeof(str), "SELECT FROM_UNIXTIME( %d )", time);
if(mysql_query(str) && mysql_store_result())
{
mysql_fetch_row_format(unbantime);
}
mysql_free_result();
return unbantime;
}

Sorry for my English
Reply

Hey.

Now I started to learn MySQL, and I don't know how to "CREATE TABLE IF NOT EXISTS" in R7, mysql_query is different now, how I can ?

EDIT: I've found, lol: https://sampforum.blast.hk/showthread.php?tid=337810
The part with
Quote:

mysql_function_query(dbHandle, "UPDATE players SET kills = 10 WHERE id = 1", false, "", "");

EDIT2: I have
Quote:

mysql_function_query( 1, "INSERT INTO `Houses` (`House ID`,`House Name`,`House Owner`,`House Price`) VALUES(1,`stuntman`,`[SG]stuntman`,300000)", false, "", "" );

but it gives a error:
Код:
'Error 1054: Unknown column `stuntman` in `field list`
how I can fix it ? What's wrong with my code ?

EDIT: Fixed...
Reply

Quote:
Originally Posted by xxmitsu
Посмотреть сообщение
Do you have any code in OnQueryError ? if yes, comment it and try again.
pawn Код:
public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
{
    /*printf("EID: %d | Error: %s | Query: %s", errorid, error, query);
    switch(errorid)
    {
        case CR_COMMAND_OUT_OF_SYNC: {
            mysql_free_result();
            printf("[Mysql: Error - Callback: %s] - Commands Out Of Sync For - Query: %s", callback, query);
        }
        case ER_UNKNOWN_TABLE: printf("[Mysql: Error - Callback: %s] - Unknown table '%s' in %s - callback: %s", callback, error, query);
        case ER_SYNTAX_ERROR: printf("[Mysql: Error - Callback: %s] - Something is wrong in your syntax, query: %s", callback, query);
        case CR_SERVER_GONE_ERROR, CR_SERVER_LOST, CR_SERVER_LOST_EXTENDED: mysql_reconnect();
    }*/

    return 1;
}
Is that harmful? anyway commented and gonna test
Reply

@kar, comment the entire callback
Reply

@costel_nistor96 use 'stuntman' in place of ` ` when you insert VALUES !
Reply

R7-2 is always crashing: Heap underflow

Zeex made a fix for this, BlueG can you apply this? https://gist.github.com/2960412

I applied the patch, and compiled it on Debian 6 - http://************/bpuddoa
Reply

Quote:
Originally Posted by Edvin
Посмотреть сообщение
@costel_nistor96 use 'stuntman' in place of ` ` when you insert VALUES !
I've already edited to "solved". Next time read all.

Yes, this was.
Reply

Is there any possible way i can run this plugin ? Cuz im on host that is giving me acces to the Gpane(Gamepanel). And i do not control the whole server machine that my server is on and im on linux ofc... so how to do it ??
Reply


Forum Jump:


Users browsing this thread: 41 Guest(s)