SA-MP Forums Archive
MySQL Problem [REQUIRE ASSISTANCE] - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL Problem [REQUIRE ASSISTANCE] (/showthread.php?tid=328002)



MySQL Problem [REQUIRE ASSISTANCE] - T0pAz - 23.03.2012

Can someone tell me what's wrong in here and is there any workaround to fix it?

pawn Код:
stock GetDataInt(tablename[], dataname[], targetname[], targetvalue[])
{
    new res;
    format(largestr, sizeof(largestr), "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", dataname, tablename, targetname, targetvalue);
    mysql_function_query(connectionHandle, largestr, true, "DataInt", "d", res);
    return res;
}
forward DataInt(&refint);
public DataInt(&refint)
{
    new
        rows,
        fields,
        storage[MAX_DATA]
    ;
    cache_get_data(rows, fields, connectionHandle);
    if(!rows)
        return cellmin;
    cache_get_row(0, 0, storage, connectionHandle);
    refint = strval(storage);
    return 1;
}



Re: MySQL Problem [REQUIRE ASSISTANCE] - Unte99 - 23.03.2012

pawn Код:
new res;
format(largestr, sizeof(largestr), "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", dataname, tablename, targetname, targetvalue);
What's this ? You are trying to format an integer ? Also different names - res and largestr.


Re: MySQL Problem [REQUIRE ASSISTANCE] - T0pAz - 23.03.2012

Quote:
Originally Posted by Unte99
Посмотреть сообщение
pawn Код:
new res;
format(largestr, sizeof(largestr), "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", dataname, tablename, targetname, targetvalue);
What's this ? You are trying to format an integer ? Also different names - res and largestr.
lolwut?


Re: MySQL Problem [REQUIRE ASSISTANCE] - Unte99 - 23.03.2012

Lets make it even more simplier:

Do you know how to format a string ?


Re: MySQL Problem [REQUIRE ASSISTANCE] - T0pAz - 23.03.2012

Quote:
Originally Posted by Unte99
Посмотреть сообщение
Lets make it even more simplier:

Do you know how to format a string ?
There is no problem on formatting the string. The problem is on the reference.


Re: MySQL Problem [REQUIRE ASSISTANCE] - T0pAz - 23.03.2012

Sorry for bumping, but I've tried this and it's still not working.

pawn Код:
stock GetDataInt(tablename[], dataname[], targetname[], targetvalue[])
{
    new res[MAX_DATA];
    format(largestr, sizeof(largestr), "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", dataname, tablename, targetname, targetvalue);
    mysql_function_query(connectionHandle, largestr, true, "DataInt", "s", res);
    return strval(res);
}
forward DataInt(data[]);
public DataInt(data[])
{
    new
        rows,
        fields,
        storage[MAX_DATA]
    ;
    cache_get_data(rows, fields, connectionHandle);
    if(!rows)
        return cellmin;
    cache_get_row(0, 0, storage, connectionHandle);
    format(data, MAX_DATA, "%s", storage);
    return 1;
}



Re: MySQL Problem [REQUIRE ASSISTANCE] - T0pAz - 23.03.2012

Is it a mysql bug?


Re: MySQL Problem [REQUIRE ASSISTANCE] - T0pAz - 23.03.2012

Sorry for bumping again, but is the mysql plugin version r7 really stable? I've seen many bugs including crashes, enormous amount of memory usage and this bug.


Re: MySQL Problem [REQUIRE ASSISTANCE] - T0pAz - 25.03.2012

Last bump.


AW: MySQL Problem [REQUIRE ASSISTANCE] - Tigerkiller - 25.03.2012

try using r6 version