Using sscanf with SQLite
#2

You cannot get a whole line at once using a SQLite function but you can make one. I'll give you a example

pawn Код:
#define MAX_RET_STR 500
stock db_get_row(query[])
{
    new DBResult:Result, retstr[MAX_RET_STR], FieldName[50], singleresult[100];
    Result = db_query(query);
    new numfields = db_num_fields(Result);
    for(new a;a<numfields;a++)
    {
        db_field_name(Result, a, FieldName, 50);
        db_get_field_assoc(Result, FieldName, singleresult, 100);
        format(retstr, sizeof(retstr), "%s|%s", retstr, singleresult);
    }
    return retstr[1];
}
pawn Код:
User|Pass|Kills|Deaths|etc..
//Will return
[HiC]TheKiller|MyPass|20|30|etc..
I really don't see why you would want to though.

You could do something like this

pawn Код:
new Line[750];
format(Line, 750, "%s", db_get_row("SELECT * FROM userdata WHERE username = '[HiC]TheKiller'"));
sscanf(Line, "....", .....);
Reply


Messages In This Thread
Using sscanf with SQLite - by Scenario - 14.08.2011, 02:21
Re: Using sscanf with SQLite - by [HiC]TheKiller - 14.08.2011, 02:50
Re: Using sscanf with SQLite - by Grim_ - 14.08.2011, 02:51
Re: Using sscanf with SQLite - by Scenario - 14.08.2011, 02:56

Forum Jump:


Users browsing this thread: 1 Guest(s)