Query input line too long and undefined symbol UPDATE
#1

Full errors:
pawn Код:
C:\Users\Justas\Desktop\GRP7.0\gamemodes\GRP7.pwn(4697) : error 075: input line too long (after substitutions)
C:\Users\Justas\Desktop\GRP7.0\gamemodes\GRP7.pwn(4698) : error 037: invalid string (possibly non-terminated string)
C:\Users\Justas\Desktop\GRP7.0\gamemodes\GRP7.pwn(4698) : error 017: undefined symbol "UPDATE"
C:\Users\Justas\Desktop\GRP7.0\gamemodes\GRP7.pwn(4698) : error 017: undefined symbol "playerdb"
C:\Users\Justas\Desktop\GRP7.0\gamemodes\GRP7.pwn(4698) : fatal error 107: too many error messages on one line
The query(lines 4695-4711):
pawn Код:
format(Query,sizeof(Query),"UPDATE playerdb SET Teises=%d, Pickup=%d, Ikalintas=%d, Bilietas=%d, Admin=%d, Uniformd=%d, Kills=%d, Liga=%d,\
    LigosLygis=%d, Telefonas=%d, Checkpoint=%d, Banke=%d, Namuose=%d,Textas=%d, Narkotikai=%d, Specialybe=%d, KalejimoLaikas=%d, Draudimas=%d, \
    Biznis=%d, Pcar=%d, Lytis=%d, Drabuziai=%d, Uniforma=%d, Mobsas=%d, PLead=%d, CBuilding=%d,Pinigai=%d, XP=%d, PosX='%f', PosY='%f', \
    PosZ='%f', Interior=%d, WantedLevel=%d, VirtualWorld=%d, Ginklas0=%d, Ammo0=%d,Ginklas1=%d', Ammo1=%d, Ginklas2=%d, Ammo2=%d, Ginklas3=%d, \
    Ammo3=%d, Ginklas4=%d, Ammo4=%d, Ginklas5=%d, Ammo5=%d, Ginklas6=%d, Ammo6=%d, Ginklas7=%d, Ammo7=%d, Ginklas8=%d, Ammo8=%d, Ginklas9=%d,\
    Ammo9=%d, Ginklas10=%d, Ammo10=%d, Ginklas11=%d, Ammo11=%d, pgang=%d, glead=%d WHERE Username='%s'"
,
    booltoint(playerDB[playerid][teises],booltoint(playerDB[playerid][pickup]),booltoint(playerDB[playerid][ikalintas]),
    booltoint(playerDB[playerid][bilietas]),playerDB[playerid][admin],booltoint(playerDB[playerid][uniformd]),playerDB[playerid][kills],
    playerDB[playerid][liga],playerDB[playerid][ligoslygis],playerDB[playerid][telefonas],playerDB[playerid][checkpoint],
    playerDB[playerid][banke],playerDB[playerid][namuose],playerDB[playerid][textas],playerDB[playerid][narkotikai],
    playerDB[playerid][specialybe],playerDB[playerid][kalejimo_laikas],playerDB[playerid][draudimas],playerDB[playerid][biznis],
    playerDB[playerid][pcar],playerDB[playerid][lytis],playerDB[playerid][drabuziai],playerDB[playerid][uniforma],playerDB[playerid][mobsas],
    playerDB[playerid][plead],playerDB[playerid][cbuilding],playerDB[playerid][pinigai],playerDB[playerid][XP],Pos[0],Pos[1],Pos[2],
    GetPlayerInterior(playerid),GetPlayerWantedLevel(playerid),GetPlayerVirtualWorld(playerid),weps[0][0],weps[1][0],weps[0][1],
    weps[1][1],weps[0][2],weps[1][2],weps[0][3],weps[1][3],weps[0][4],weps[1][4],weps[0][5],weps[1][5],weps[0][6],weps[1][6],
    weps[0][7],weps[1][7],weps[0][8],weps[1][8],weps[0][9],weps[1][9],weps[0][10],weps[1][10],weps[0][11],weps[1][11],
    playerDB[playerid][pgang],playerDB[plead],name);
And the weirdest thing is that, "UPDATE" isn't even in the line 4698
Reply
#2

I've had this problem before with a dialog, and the only solution I found was to separate it with strcat.

On a side note, funny how you spelled business, biznis. xD
Reply
#3

pawn Код:
[17:05:42] >> mysql_query_callback(Connection handle: 1)
[17:05:42] ProcessQueryThread(SendQuery) - Executing query UPDATE playerdb SET Teises=%d, Pickup=%d, Ikalintas=%d, Bilietas=%d, Admin=%d, Uniformd=%d, Kills=%d, Liga=%d,LigosLygis=%d, Telefonas=%d, Checkpoint=%d, Banke=%d, Namuose=%d,Textas=%d, Narkotikai=%d, Specialybe=%d, KalejimoLaikas=%d, Draudimas=%d,Biznis=%d, Pcar=%d, Lytis=%d, Drabuziai=%d, Uniforma=%d, Mobsas=%d, PLead=%d, CBuilding=%d,Pinigai=%d, XP=%d, PosX='%f', PosY='%f',PosZ='%f', Interior=%d, WantedLevel=%d, VirtualWorld=%d, Ginklas0=%d, Ammo0=%d,Ginklas1=%d, Ammo1=%d, Ginklas2=%d, Ammo2=%d, Ginklas3=%d, Ammo3=%d, Ginklas4=%d, Ammo4=%d, Ginklas5=%d, Ammo5=%d, Ginklas6=%d, Ammo6=%d, Ginklas7=%d, Ammo7=%d, Ginklas8=%d, Ammo8=%d, Ginklas9=%d, Ammo9=%d, Ginklas10=%d, Ammo10=%d, Ginklas11=%d, Ammo11=%d, pgang=%d, glead=%d WHERE Username='%s',booltoint(playerDB[playerid][teises],booltoin...
[17:05:42] ProcessQueryThread(SendQuery) - Error will be triggered to OnQueryError().

pawn Код:
strcat(Query,"UPDATE playerdb SET Teises=%d, Pickup=%d, Ikalintas=%d, Bilietas=%d, Admin=%d, Uniformd=%d, Kills=%d, Liga=%d,");
    strcat(Query,"LigosLygis=%d, Telefonas=%d, Checkpoint=%d, Banke=%d, Namuose=%d,Textas=%d, Narkotikai=%d, Specialybe=%d, KalejimoLaikas=%d, Draudimas=%d,");
    strcat(Query,"Biznis=%d, Pcar=%d, Lytis=%d, Drabuziai=%d, Uniforma=%d, Mobsas=%d, PLead=%d, CBuilding=%d,Pinigai=%d, XP=%d, PosX='%f', PosY='%f',");
    strcat(Query,"PosZ='%f', Interior=%d, WantedLevel=%d, VirtualWorld=%d, Ginklas0=%d, Ammo0=%d,Ginklas1=%d, Ammo1=%d, Ginklas2=%d, Ammo2=%d, Ginklas3=%d, ");
    strcat(Query,"Ammo3=%d, Ginklas4=%d, Ammo4=%d, Ginklas5=%d, Ammo5=%d, Ginklas6=%d, Ammo6=%d, Ginklas7=%d, Ammo7=%d, Ginklas8=%d, Ammo8=%d, Ginklas9=%d, ");
    strcat(Query,"Ammo9=%d, Ginklas10=%d, Ammo10=%d, Ginklas11=%d, Ammo11=%d, pgang=%d, glead=%d WHERE Username='%s',");
    strcat(Query,"booltoint(playerDB[playerid][teises],booltoint(playerDB[playerid][pickup]),booltoint(playerDB[playerid][ikalintas]),");
    strcat(Query,"booltoint(playerDB[playerid][bilietas]),playerDB[playerid][admin],booltoint(playerDB[playerid][uniformd]),playerDB[playerid][kills],");
    strcat(Query,"playerDB[playerid][liga],playerDB[playerid][ligoslygis],playerDB[playerid][telefonas],playerDB[playerid][checkpoint],");
    strcat(Query,"playerDB[playerid][banke],playerDB[playerid][namuose],playerDB[playerid][textas],playerDB[playerid][narkotikai],");
    strcat(Query,"playerDB[playerid][specialybe],playerDB[playerid][kalejimo_laikas],playerDB[playerid][draudimas],playerDB[playerid][biznis],");
    strcat(Query,"playerDB[playerid][pcar],playerDB[playerid][lytis],playerDB[playerid][drabuziai],playerDB[playerid][uniforma],playerDB[playerid][mobsas],");
    strcat(Query,"playerDB[playerid][plead],playerDB[playerid][cbuilding],playerDB[playerid][pinigai],playerDB[playerid][XP],Pos[0],Pos[1],Pos[2],");
    strcat(Query,"GetPlayerInterior(playerid),GetPlayerWantedLevel(playerid),GetPlayerVirtualWorld(playerid),weps[0][0],weps[1][0],weps[0][1],");
    strcat(Query,"weps[1][1],weps[0][2],weps[1][2],weps[0][3],weps[1][3],weps[0][4],weps[1][4],weps[0][5],weps[1][5],weps[0][6],weps[1][6],");
    strcat(Query,"weps[0][7],weps[1][7],weps[0][8],weps[1][8],weps[0][9],weps[1][9],weps[0][10],weps[1][10],weps[0][11],weps[1][11],");
    strcat(Query,"playerDB[playerid][pgang],playerDB[plead],name);");
On a side note, it's not funny,it is just means business in my language
Reply
#4

In order to print the data pertaining to the error using the following (add it in).

pawn Код:
public OnQueryError(errorid, error[], resultid, extraid, callback[], query[], connectionHandle) {
printf("EID: %d | Error: %s | Query: %s", errorid, error, query);
return 1;
}
Then check the log.

Chances are you are missing a table.
Reply
#5

pawn Код:
[17:53:42] EID: 1064 | Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%d, Pickup=%d, Ikalintas=%d, Bilietas=%d, Admin=%d, Uniformd=%d, Kills=%d, Liga=' at line 1 | Query: UPDATE playerdb SET Teises=%d, Pickup=%d, Ikalintas=%d, Bilietas=%d, Admin=%d, Uniformd=%d, Kills=%d, Liga=%d,LigosLygis=%d, Telefonas=%d, Checkpoint=%d, Banke=%d, Namuose=%d,Textas=%d, Narkotikai=%d, Specialybe=%d, KalejimoLaikas=%d, Draudimas=%d,Biznis=%d, Pcar=%d, Lytis=%d, Drabuziai=%d, Uniforma=%d, Mobsas=%d, PLead=%d, CBuilding=%d,Pinigai=%d, XP=%d, PosX='%f', PosY='%f',PosZ='%f', Interior=%d, WantedLevel=%d, VirtualWorld=%d, Ginklas0=%d, Ammo0=%d,Ginklas1=%d, Ammo1=%d, Ginklas2=%d, Ammo2=%d, Ginklas3=%d, Ammo3=%d, Ginklas4=%d, Ammo4=%d, Ginklas5=%d, Ammo5=%d, Ginklas6=%d, Ammo6=%d, Ginklas7=%d, Ammo7=%d, Ginklas8=%d, Ammo8=%d, Ginklas9=%d, Ammo9=%d, Ginklas10=%d, Ammo10=%d, Ginklas11=%d, Ammo11=%d, pgang=%d, glead=%d WHERE Username='%s',booltoint(playerDB[playerid][teises],booltoin
And I can't understand what's the problem... The problem is at the "Teises=%d", the field exists and is correct
Reply
#6

It MUST be the time for the bump now.

So I bump
Reply
#7

bump
Reply
#8

Код:
C:\Users\Justas\Desktop\GRP7.0\gamemodes\GRP7.pwn(4697) : error 075: input line too long (after substitutions)
C:\Users\Justas\Desktop\GRP7.0\gamemodes\GRP7.pwn(4698) : error 037: invalid string (possibly non-terminated string)
As soon as this error is displayed. Ignore all other errors from the same or near lines. UPDATE and and playerdb are not being recognized due to the fact that it splitted them apart when it found out the length is too large for a query. If you fix the length error, those two other errors will automatically be fixed.

As for your other concerns, please elaborate as I really can't understand your exact point.
Reply
#9

Well i did split them up, like this:
pawn Код:
strcat(Query,"UPDATE playerdb SET Teises=%d, Pickup=%d, Ikalintas=%d, Bilietas=%d, Admin=%d, Uniformd=%d, Kills=%d, Liga=%d,");
    strcat(Query,"LigosLygis=%d, Telefonas=%d, Checkpoint=%d, Banke=%d, Namuose=%d,Textas=%d, Narkotikai=%d, Specialybe=%d, KalejimoLaikas=%d, Draudimas=%d,");
    strcat(Query,"Biznis=%d, Pcar=%d, Lytis=%d, Drabuziai=%d, Uniforma=%d, Mobsas=%d, PLead=%d, CBuilding=%d,Pinigai=%d, XP=%d, PosX='%f', PosY='%f',");
    strcat(Query,"PosZ='%f', Interior=%d, WantedLevel=%d, VirtualWorld=%d, Ginklas0=%d, Ammo0=%d,Ginklas1=%d, Ammo1=%d, Ginklas2=%d, Ammo2=%d, Ginklas3=%d, ");
    strcat(Query,"Ammo3=%d, Ginklas4=%d, Ammo4=%d, Ginklas5=%d, Ammo5=%d, Ginklas6=%d, Ammo6=%d, Ginklas7=%d, Ammo7=%d, Ginklas8=%d, Ammo8=%d, Ginklas9=%d, ");
    strcat(Query,"Ammo9=%d, Ginklas10=%d, Ammo10=%d, Ginklas11=%d, Ammo11=%d, pgang=%d, glead=%d WHERE Username='%s',");
    strcat(Query,"booltoint(playerDB[playerid][teises],booltoint(playerDB[playerid][pickup]),booltoint(playerDB[playerid][ikalintas]),");
    strcat(Query,"booltoint(playerDB[playerid][bilietas]),playerDB[playerid][admin],booltoint(playerDB[playerid][uniformd]),playerDB[playerid][kills],");
    strcat(Query,"playerDB[playerid][liga],playerDB[playerid][ligoslygis],playerDB[playerid][telefonas],playerDB[playerid][checkpoint],");
    strcat(Query,"playerDB[playerid][banke],playerDB[playerid][namuose],playerDB[playerid][textas],playerDB[playerid][narkotikai],");
    strcat(Query,"playerDB[playerid][specialybe],playerDB[playerid][kalejimo_laikas],playerDB[playerid][draudimas],playerDB[playerid][biznis],");
    strcat(Query,"playerDB[playerid][pcar],playerDB[playerid][lytis],playerDB[playerid][drabuziai],playerDB[playerid][uniforma],playerDB[playerid][mobsas],");
    strcat(Query,"playerDB[playerid][plead],playerDB[playerid][cbuilding],playerDB[playerid][pinigai],playerDB[playerid][XP],Pos[0],Pos[1],Pos[2],");
    strcat(Query,"GetPlayerInterior(playerid),GetPlayerWantedLevel(playerid),GetPlayerVirtualWorld(playerid),weps[0][0],weps[1][0],weps[0][1],");
    strcat(Query,"weps[1][1],weps[0][2],weps[1][2],weps[0][3],weps[1][3],weps[0][4],weps[1][4],weps[0][5],weps[1][5],weps[0][6],weps[1][6],");
    strcat(Query,"weps[0][7],weps[1][7],weps[0][8],weps[1][8],weps[0][9],weps[1][9],weps[0][10],weps[1][10],weps[0][11],weps[1][11],");
    strcat(Query,"playerDB[playerid][pgang],playerDB[plead],name);");
But then a new problem occoured!
pawn Код:
[17:53:42] EID: 1064 | Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%d, Pickup=%d, Ikalintas=%d, Bilietas=%d, Admin=%d, Uniformd=%d, Kills=%d, Liga=' at line 1 | Query: UPDATE playerdb SET Teises=%d, Pickup=%d, Ikalintas=%d, Bilietas=%d, Admin=%d, Uniformd=%d, Kills=%d, Liga=%d,LigosLygis=%d, Telefonas=%d, Checkpoint=%d, Banke=%d, Namuose=%d,Textas=%d, Narkotikai=%d, Specialybe=%d, KalejimoLaikas=%d, Draudimas=%d,Biznis=%d, Pcar=%d, Lytis=%d, Drabuziai=%d, Uniforma=%d, Mobsas=%d, PLead=%d, CBuilding=%d,Pinigai=%d, XP=%d, PosX='%f', PosY='%f',PosZ='%f', Interior=%d, WantedLevel=%d, VirtualWorld=%d, Ginklas0=%d, Ammo0=%d,Ginklas1=%d, Ammo1=%d, Ginklas2=%d, Ammo2=%d, Ginklas3=%d, Ammo3=%d, Ginklas4=%d, Ammo4=%d, Ginklas5=%d, Ammo5=%d, Ginklas6=%d, Ammo6=%d, Ginklas7=%d, Ammo7=%d, Ginklas8=%d, Ammo8=%d, Ginklas9=%d, Ammo9=%d, Ginklas10=%d, Ammo10=%d, Ginklas11=%d, Ammo11=%d, pgang=%d, glead=%d WHERE Username='%s',booltoint(playerDB[playerid][teises],booltoin
Reply
#10

Dude, what in the name of god are you doing? Formatting field names into the query? Where is the logic in that? Quick answer - there is none.

Please read the SA-MP wiki about these functions! strcat is not a substitute for format. The latter is used to format the string that you're going to strcat (in your case).

There are plenty of approaches to this:
1. Large formats! Laaaaarge formats!
pawn Код:
format(str, sizeof(str), "UPDATE playerdb SET stuff1=%d,stuff2=%d,stuff3=%d", stuff1, stuff2, stuff3);
format(str, sizeof(str), "%s,stuff4=%d,stuff5=%d,stuff6=%d", str, stuff4, stuff5, stuff6);
// ...
format(str, sizeof(str), "%s WHERE ... = ...", str);
Personally, I freak out when I see this, because I've ran some tests on this... and it is slow. And it gets slower the longer your string gets... damn!

2. Format a part and concatenate (strcat) it onto a larger buffer.
pawn Код:
new querybuffer[1024], oneline[128];
format(oneline, "UPDATE playerdb SET stuff1=%d,stuff2=%d,stuff3=%d", stuff1, stuff2, stuff3);
strcat(querybuffer, oneline);
format(oneline, ",stuff4=%d,stuff5=%d,stuff6=%d", stuff4, stuff5, stuff6);
strcat(querybuffer, oneline)
// ...
format(oneline, " WHERE ... = ...", ..., ...);
strcat(querybuffer, online);
// query
This is quite elegant when done correctly.

Please note that in the two last examples, I only made the script format _3_ fields in each format. In a real situation, I'd recommend to go as close to the line length limit as possible.

3. Use the modified compiler by Zeex. I don't know if I would recommend it seeing you're a beginner, but meh, it is a solution of some sort.

4. UPDATE DATA ONLY WHEN DATA NEEDS TO BE UPDATED!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)