[Info]: Load data with sscanf2 / on MySQL -
Speed++ - 11.08.2012
Hello,
i have a question with sscanf... load data on mysql with sscanf:
i have found, this example:
pawn Код:
sscanf(resultline, "p<|>dd", PlayerInfo[playerid][level], PlayerInfo[playerid][adminlevel]);
the p<|> is the divisor... and i understand
but in this another example... no
this the code:
pawn Код:
sscanf(query, "e<p<|>s[24]s[17]iii>", ... ecc);
why
e<p<|> ? .. who is the e<p ??
Re: [Info]: Load data with sscanf2 / on MySQL -
[DOG]irinel1996 - 11.08.2012
E means that you're loading data into an enum. Asigning it in enum variables.
Re: [Info]: Load data with sscanf2 / on MySQL -
Speed++ - 11.08.2012
Quote:
Originally Posted by irinel1996
E means that you're loading data into an enum. Asigning it in enum variables.
|
yes i understand this.. but what is the
e<p ?
Re: [Info]: Load data with sscanf2 / on MySQL -
Speed++ - 11.08.2012
?
Re: [Info]: Load data with sscanf2 / on MySQL -
[DOG]irinel1996 - 11.08.2012
e means that the variables where will be the data asigned are from an enum, nothing else. And the
p is the same with or without e.
If you do that:
pawn Код:
enum Vars
{
name[24], //string = s[24].
age //integer = i
};
new example[MAX_PLAYERS][Vars];
//---------------------
sscanf(query,"e<p<|>s[24]i>",example[playerid][name],example[playerid][age]);
Hope you understand..
Re: [Info]: Load data with sscanf2 / on MySQL -
Ranama - 11.08.2012
p<|> means that sscanf will take out all | written in the text and split it up there, this is at least what I'm using it for.
Re: [Info]: Load data with sscanf2 / on MySQL -
Speed++ - 11.08.2012
ok, i understand
Thanks
Re: [Info]: Load data with sscanf2 / on MySQL -
Speed++ - 11.08.2012
another question for sscanf..
sscanf(query ,"e<p<|>
{s[1]s[1]
}dd>
why usage the { } , is used for ignore a variable
?
Re: [Info]: Load data with sscanf2 / on MySQL -
Speed++ - 11.08.2012
help
?
Re: [Info]: Load data with sscanf2 / on MySQL -
[DOG]irinel1996 - 11.08.2012
It jumps over it, doesn't load it.
Let's suppose that in your MySQL table you have 3 fields:
-name (varchar)
-sex (varchar - let's suppose it'd be 10 big cells in the enum to understand sscanf)
-age (integer)
And in your GM your enum has just 2 variables. Name and age:
pawn Код:
enum Vars {
name[24],
age
};
new data[MAX_PLAYERS][Vars];
//-----------
sscanf(query,"e<p<|>s[24]{s[10]}i",data[playerid][name],data[playerid][age]); //it didn't load sex because we don't have variable to asign the value.
Best regards!