MYSQL error 075: input line too long (after substitutions)
#1

Hello guys.. How some prob with saving player data at disconnect... Maybe some one could help,,
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    GetPlayerHealth(playerid,pInfo[playerid][Health]);
    GetPlayerArmour(playerid,pInfo[playerid][Armour]);
    new query[256], Float:pos[3];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    mysql_format(mysql, query, sizeof(query), "UPDATE `user` SET `Admin`=%d, `VIP`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f, `Health` = '%f', `Armour` = '%f', `Age`=%d, `Accent`=%s, `Gender`=%d,\
    `Faction`=%d, `Leader`=%d, `Member`=%d, `Gang`=%d, `StreetRespect`=%d, `Respect`=%d, `Level`=%d, `FightingStyle`=%d,\
     `WantedLevel`=%d, `WantedLevel`=%d, `CMDTIMER1`=%d, `CMDTIMER2`=%d,`CMDTIMER3`=%d, `CMDTIMER4`=%d, `Bodytype`=%d, `Muscle`=%d, WHERE `ID`=%d"
,\
    pInfo[playerid][Admin], pInfo[playerid][VIP], pInfo[playerid][Money], pos[0], pos[1], pos[2], pInfo[playerid][Health],pInfo[playerid][Armour],
    pInfo[playerid][Age], pInfo[playerid][Accent], pInfo[playerid][Gender], pInfo[playerid][Faction],
    pInfo[playerid][Leader], pInfo[playerid][Member], pInfo[playerid][Gang], pInfo[playerid][StreetRespect],
    pInfo[playerid][Respect], pInfo[playerid][Level], pInfo[playerid][FightingStyle], pInfo[playerid][WantedLevel],pInfo[playerid][CMDTIMER1],
    pInfo[playerid][CMDTIMER2], pInfo[playerid][CMDTIMER3], pInfo[playerid][CMDTIMER4], pInfo[playerid][Bodytype], pInfo[playerid][Muscle], pInfo[playerid][ID]);
    mysql_tquery(mysql, query, "", "");
    return 1;
}
ERROR:
pawn Код:
error 075: input line too long (after substitutions)
error 017: undefined symbol "pInf"
warning 217: loose indentation
rror 017: undefined symbol "o"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
With best regards Scrillex.
Reply
#2

try increasing your query length, if it doesn't work use strcat to give some space to your lines because there is a limit.
Reply
#3

Thank you for your answer.
Yeah tryed to increase the string same thing.. Could you give me an example for strcat?
Reply
#4

Sure,

pawn Код:
new Query[500];
strcat(Query, write your mysql related things here with "blablabla,", sizeof(Query));
    strcat(Query, write your mysql related things here with "blablabla,", sizeof(Query));
    strcat(Query, write your mysql related things here with "blablabla", sizeof(Query));
if you notice carefully the comas that I use at the first two are to specify that it is a continuation of the string so at the last one you are not supposed to put a coma. Tell me if it works.
Reply
#5

It will look like this or??
pawn Код:
strcat(Query, "UPDATE `user` SET `Admin`=%d, `VIP`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f, `Health` = '%f', `Armour` = '%f', `Age`=%d, `Accent`=%s, `Gender`=%d,\", sizeof(Query));
    strcat(Query, `Faction`=%d, `Leader`=%d, `Member`=%d, `Gang`=%d, `StreetRespect`=%d, `Respect`=%d, `Level`=%d, `FightingStyle`=%d,\", sizeof(Query));
     strcat(Query, `WantedLevel`=%d, `WantedLevel`=%d, `CMDTIMER1`=%d, `CMDTIMER2`=%d,`CMDTIMER3`=%d, `CMDTIMER4`=%d, `Bodytype`=%d, `Muscle`=%d, WHERE `ID`=%d"
,\", sizeof(Query));
Reply
#6

Yeah and then just link all of that to mysql_tquery(mysql, query, "", ""); and it should work.
Reply
#7

Thanks mate
Reply
#8

  1. Normalize your database (look it up if you don't know what that means)
  2. Do not save everything at once, which brings us right to:
  3. Save things when they change.
How often does admin change? How often does vip change? How often does level change? What's the deal updating values that probably haven't changed?
Reply
#9

So basically all what I could use update on when level or something is changing right? Like in cmd or something ?
Reply
#10

Whenever something changes, save it immediately.

Use many small functions to make it easier.

Like giving the player some money, you could write a small functions that adds the given money to the player and save it in your database.
And the good thing: you can call that function anywhere in your script (commands, callbacks, whatever) and it will save automatically.
Give the player money using that function and it is saved automatically.

PHP код:
Player_GiveMoney(playeridmoney)
{
    new 
query[128];
    
pInfo[playerid][Money] = pInfo[playerid][Money] + money;
    
mysql_format(mysqlquerysizeof(query), "UPDATE `user` SET `Money`=%d WHERE `ID`=%d"pInfo[playerid][Money], pInfo[playerid][ID]);
    
mysql_tquery(mysqlquery"""");
    return 
1;

You can use the same for all other values.
Update values when they change, then you don't even need to save anything under OnPlayerDisconnect.

It's also alot easier to tracks bugs/errors because you don't have a wall of text for one query as you'll be using alot of smaller queries like the one shown above.
One misplaced/forgotten comma is hard to find in such a huge block of text.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)