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: Respuesta: [REL] MySQL Plugin (R7 released) - Reboma - 11.07.2012

Quote:
Originally Posted by Kar
Посмотреть сообщение
It adds up now

R7-2 fixes, + Zeex's fix, has anyone compiled that yet?
I already applied Zeex's heap underflow fix and compiled it on Debian 6:
Quote:
Originally Posted by Reboma
Посмотреть сообщение
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
But the memory leak isn't fixed yet, or i did not found.

AndreT: I already posted my pmap result 2-3 pages ago: http://pastebin.com/raw.php?i=LGkJexAq


Re: [REL] MySQL Plugin (R7 released) - AnonymousUser - 11.07.2012

Please help..

pawn Код:
I have a problem with loading last player connect date and last player connected IP. It is always null! But the values in PMA is not null :3 Tried to print, everything is fine.

OnPlayerConnect:

[pawn]  format(szQuery, 77, "SELECT `Name` FROM `players` WHERE `Name` = '%s'", GetPlayerNameEx(playerid));
mysql_function_query(iHandle, szQuery, true, "OnPlayerConnectEx", "ds", playerid, szName[playerid]);
OnPlayerConnectEx:

pawn Код:
PUB::OnPlayerConnectEx(playerid, Name[])
{
    new iFields, iRows;
       
    cache_get_data(iRows, iFields);
    if (iRows)
    {
           // login check
    }
    else
    {
           // register
    }
    return true;
}

Login:

pawn Код:
format(szQuery, 77, "SELECT `Name` FROM `players` WHERE `Name` = '%s'", GetPlayerNameEx(playerid));
mysql_function_query(iHandle, szQuery, true, "OnPlayerLogin", "dsd", playerid, GetPlayerNameEx(playerid), 1);
OnPlayerLogin:

pawn Код:
PUB::OnPlayerLogin(playerid, Name[], ResultID)
{
    new szQuery[213], iFields, iRows;
       
    switch (ResultID)
    {
        case 1:
        {
            cache_get_data(iRows, iFields);
            format(szQuery, 61, "SELECT `IP` FROM `players` WHERE `IP` = '%s'", GetPlayerIpEx(playerid));
            mysql_function_query(iHandle, szQuery, true, "OnPlayerLogin", "dsd", playerid, GetPlayerNameEx(playerid), (iRows) ? (2) : (3));
        }
        case 2:
        {
            cache_get_data(iRows, iFields);
            if (iRows)
            {
                format(szQuery, 125, "SELECT `LastSeen`, `LastIP` FROM `players` WHERE `Name` = '%s'", GetPlayerNameEx(playerid));
                mysql_function_query(iHandle, szQuery, true, "OnPlayerLogin", "dsd", playerid, GetPlayerNameEx(playerid), 5);
            }
            else
            {
                // The IP doesnt match with registration IP,  let's open login dialog
            }
        }
        case 3:
        {
            cache_get_data(iRows, iFields);
            if (iRows >= MAX_ACCOUNTS_PER_IP)
            {
                // Player haves 3 accounts already, kick him.
                Kick(playerid);
            }
            else
            {
                // Player doesnt have more than three accounts, open registration dialog
            }
        }
        case 4:
        {
            cache_get_data(iRows, iFields);
            if (iRows)
            {
                format(szQuery, 125, "SELECT `LastSeen`, `LastIP` FROM `players` WHERE `Name` = '%s'", GetPlayerNameEx(playerid));
                mysql_function_query(iHandle, szQuery, true, "OnPlayerLogin", "dsd", playerid, GetPlayerNameEx(playerid), 5);
            }
            else
            {
                if (iBadPassword[playerid] == MAX_PASSWORD_WARNS - 1)
                {
                    // Player entered wrong password three times. Kick him
                    Kick(playerid);
                    return true;
                }
                // Player havent entered wrong password three times, lets open login dialog.
                iBadPassword[playerid] += 1;
            }
        }
        case 5:
        {
            cache_get_row(0, 0, pInfo[playerid][statsLastSeen]);
            cache_get_row(0, 1, pInfo[playerid][statsLastIP]);

            printf("Last Seen: %s\nLast IP: %s", date(pInfo[playerid][statsLastSeen]), pInfo[playerid][statslastIP]);

            strcpy(pInfo[playerid][statsLastIP], GetPlayerIpEx(playerid), 17);
            pInfo[playerid][statsLastSeen] = GetCurrentDateInUnix();
            iLoggedIn[playerid] = true;
        }
    }
    return true;
}
Functions date(), GetCurrentDateInUnix(), GetPlayerIpEx() works fine in other places..[/pawn]


Re: [REL] MySQL Plugin (R7 released) - EvolutionS - 12.07.2012

10:41:53] Loading plugin: mysql_debian.so
[10:41:53] Failed (/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by plugins/mysql_debian.so))
[10:41:53] Loaded 0 plugins.

Help!


Re: [REL] MySQL Plugin (R7 released) - x96664 - 12.07.2012

Where can I find tutorial to make MySQL script?


Re: [REL] MySQL Plugin (R7 released) - IstuntmanI - 14.07.2012

I can use multiple threads at once ?

Like:
Код:
// same callback
mysql_function_query( 1, "SELECT * FROM `Accounts` WHERE `Name` = 'Parrot'", false, "OnPlayerLogin", "i", playerid );
mysql_function_query( 1, "SELECT * FROM `Houses` WHERE `Owner` = 'Parrot'", false, "OnHouseDetect", "i", playerid );



Re: [REL] MySQL Plugin (R7 released) - xxmitsu - 15.07.2012

Quote:
Originally Posted by TheArcher
View Post
Only for linux?
Can you test this version (http://www.egaming.ro/MySQL/R7-2/windows-untested/) on windows, please ?


Re: [REL] MySQL Plugin (R7 released) - TheArcher - 15.07.2012

Quote:
Originally Posted by xxmitsu
View Post
Can you test this version (http://www.egaming.ro/MySQL/R7-2/windows-untested/) on windows, please ?
I wish i could download it.


Re: [REL] MySQL Plugin (R7 released) - Reboma - 16.07.2012

The memory leak is fully fixed in v4?


Re: [REL] MySQL Plugin (R7 released) - xxmitsu - 16.07.2012

Personally with the latest version, I get an error when using mysql_format.

Code:
[12:34:08] [debug] Server crashed while executing newegDB.amx
[12:34:08] [debug] AMX backtrace:
[12:34:08] [debug] #0  native mysql_format () [007fc5e0] from mysql.so
[12:34:08] [debug] #1  000909c0 in MySQLConnectAccount (playerid=14) at I:\_eGaming\samp\_new_mysql-0.3d\__CORECTAT0.3c\pawno-3\include\eG_functii/eG_xan_mysql_func.inc:130
with code:

pawn Code:
stock MySQLConnectAccount(playerid)
{
    new query[220], plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
line130 --->    mysql_format(connectionHandle, query, "SELECT players.id,coalesce(players_logins.time ,UNIX_TIMESTAMP(NOW())) FROM players LEFT JOIN players_logins ON players.id=players_logins.userid WHERE LOWER(players.Name) = LOWER('%e')", plname);
    mysql_function_query(connectionHandle, query, true, "ConnectThread", "d", playerid);
    return 1;
}



Re: [REL] MySQL Plugin (R7 released) - Danny - 16.07.2012

Is there any official release coming by BlueG? I'd prefer that one with low risk on crashes before i'll update my gamemode.


Re: [REL] MySQL Plugin (R7 released) - misticini - 16.07.2012

Check my version of mysql plugin r7-2 with fix, i think that work (compiled for windows, but have to the source code)

http://www.solidfiles.com/d/881b943ede/


Re: [REL] MySQL Plugin (R7 released) - Kar - 17.07.2012

Ok, static-v4 is almost perfectly fine! but theres still a few problems.

My server used to crash almost 8 times a day, since static-v3 it crashed once every day, IDK what else can be crashing it, crashdetect is not saying anything, it must be this plugin. dugi said that you said that cache could probably cause it, idk. All my queries are using cache expect the registration query, it still uses the old mysql_store_result, idk why I never changed over that query.

If you need any more information..just tell me what


Re: [REL] MySQL Plugin (R7 released) - Joske_Vermeulen - 17.07.2012

Quote:
Originally Posted by Kar
View Post
Ok, static-v4 is almost perfectly fine! but theres still a few problems.

My server used to crash almost 8 times a day, since static-v3 it crashed once every day, IDK what else can be crashing it, crashdetect is not saying anything, it must be this plugin. dugi said that you said that cache could probably cause it, idk. All my queries are using cache expect the registration query, it still uses the old mysql_store_result, idk why I never changed over that query.

If you need any more information..just tell me what
I use A LOT of queries (ALL CACHE) with version 1 of R7 and my server starts with about 50 mb ram usage and then crashes after 3-4 days when it reaches about 150 mb. (I have never used any newer version simply because it's still not fixed and R7-1 seems to be working more optimal for me)

When I was using the old R5 or R6 before this, my ram usage has always been ~250 mb with barely any crashes.

(Crashdetect does not trace anything at all too, I had it loaded when it crashed a couple of a times)


Re: [REL] MySQL Plugin (R7 released) - Mr_Kent - 17.07.2012

All good health! I really do not speak English, so I use a translator! Tell me, why do not work the download link? And will they work? Thanks in advance!


Re: [REL] MySQL Plugin (R7 released) - iTorran - 19.07.2012

When I use mysql_close() in OnGameModeExit, the server will hang.
Nobody can join, and all players at the time of GMX are reported as online on client.

This worked fine with Windows, but started hanging when we switched to Debian.


Re: [REL] MySQL Plugin (R7 released) - Gumica - 21.07.2012

It would be nice if someone would make tutorial for reg/log system with R7.
I still don't understand query function with cache -.-'
clear example would be cool, example is example xD


Re: [REL] MySQL Plugin (R7 released) - BoBiTzaa - 23.07.2012

[20:01:42] Error: Function not registered: 'mysql_query'
[20:01:42] Script[gamemodes/GameGate.amx]: Run time error 19: "File or function is not found"

How fix on r7?


Respuesta: [REL] MySQL Plugin (R7 released) - Sabio - 23.07.2012

Mirror RC7 pls?


Re: [REL] MySQL Plugin (R7 released) - IstuntmanI - 23.07.2012

Quote:
Originally Posted by BoBiTzaa
Посмотреть сообщение
[20:01:42] Error: Function not registered: 'mysql_query'
[20:01:42] Script[gamemodes/GameGate.amx]: Run time error 19: "File or function is not found"

How fix on r7?
You need to use the plugin too, not only the include.


Re: [REL] MySQL Plugin (R7 released) - BoBiTzaa - 24.07.2012

i used plugin mysql.dll