MySQL Problem
#1

hello.
i had an little problem with my mysql-load/save system.

so, the account loads in ~0-1ms

I tried this:
pawn Код:
stock LoadPlayer(playerid)
{
    new count = GetTickCount();
    new Query[128], savingstring[40];
    format(Query, sizeof(Query), "SELECT * FROM `accounts` WHERE `Name` = '%s'", GetName(playerid));
    mysql_query(Query);
    mysql_store_result();
    while(mysql_fetch_row_format(Query,"|"))
    {
        mysql_fetch_field_row(savingstring, "Level"); Spieler[playerid][pLevel] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "Admin"); Spieler[playerid][pAdmin] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "Cash"); Spieler[playerid][pCash] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "Tutorial"); Spieler[playerid][pTutorial] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "AccountLocked"); Spieler[playerid][pAccountLocked] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "SpawnHealth"); Spieler[playerid][pSpawnHealth] = floatstr(savingstring);
        mysql_fetch_field_row(savingstring, "Geschlecht"); Spieler[playerid][pGeschlecht] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "Skin"); Spieler[playerid][pSkin] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "Perso"); Spieler[playerid][pPerso] = strval(savingstring);
    }  
    mysql_free_result();
    printf("Account wurde in %d ms geladen.", GetTickCount() - count);
"Account wurde in %d ms geladen" = Account was loaded in .. ms"

The ms shows "0" or "1". this is very good.
but if i save the player (logout/gmx)
it takes up to 40ms.
its too much!

pawn Код:
stock SavePlayer(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        new query[1024];
        new count = GetTickCount();
        format(query, sizeof(query), "UPDATE `accounts` SET Level=%d, Admin=%d, Cash=%d, Tutorial=%d, AccountLocked=%d, SpawnHealth=%f, Geschlecht=%d, Skin=%d, Perso=%d WHERE Name='%s'",
        Spieler[playerid][pLevel],
        Spieler[playerid][pAdmin],
        Spieler[playerid][pCash],
        Spieler[playerid][pTutorial],
        Spieler[playerid][pAccountLocked],
        Spieler[playerid][pSpawnHealth],
        Spieler[playerid][pGeschlecht],
        Spieler[playerid][pSkin],
        Spieler[playerid][pPerso],
        GetName(playerid));
        mysql_query(query);
        printf("Account wurde in %d ms gespeichert.", GetTickCount() - count);
    }
    return 1;
}
I use blueG's mysql plugin.

can anyone help me ? :/
Reply


Messages In This Thread
MySQL Problem - by 'Pawno. - 18.09.2012, 10:43
Re: MySQL Problem - by mamorunl - 18.09.2012, 10:53
Re: MySQL Problem - by playbox12 - 18.09.2012, 10:56
Re: MySQL Problem - by BlackBank - 18.09.2012, 12:53
AW: MySQL Problem - by 'Pawno. - 18.09.2012, 13:01
Re: MySQL Problem - by mamorunl - 18.09.2012, 13:26

Forum Jump:


Users browsing this thread: 2 Guest(s)