MySQL Problem [REQUIRE ASSISTANCE]
#1

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;
}
Reply
#2

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

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?
Reply
#4

Lets make it even more simplier:

Do you know how to format a string ?
Reply
#5

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

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;
}
Reply
#7

Is it a mysql bug?
Reply
#8

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

Last bump.
Reply
#10

try using r6 version
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)