SA-MP Forums Archive
MySQL, input line too long - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL, input line too long (/showthread.php?tid=276566)



MySQL, input line too long - Markx - 14.08.2011

ok, i get the errors what thay mean but how could i make the query in 2 lines, not in one?

pawn Code:
format(query, sizeof(query), "INSERT INTO playerdata (user, password, score, money, level, vip, kma, rank, kills, deaths, muted, jailed, frozen, mutedtimes, jailedtimes, frozentimes, banned, bannedby, logins, cookies, warn1, warn2, warn3, warn1reason, warn2reason, warn3reason, dateregisterd, kickedtimes, restorepos, slapedtimes, posx, posy, posz, posa, IP) VALUES('%s', SHA1('%s'), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s', 017, 0, 0, 0, 0, 'No Warn', 'No Warn', 'No Warn', '%s', 0, 0, 0, 0, 0, 0, 0, '%s')", pname, passwordstring, Bannedby, ReggedDate, IP);
    mysql_query(query);
Code:
C:\Users\iMarkx\Desktop\CAS v5.0\gamemodes\CAS - Copy1.pwn(597) : error 075: input line too long (after substitutions)
C:\Users\iMarkx\Desktop\CAS v5.0\gamemodes\CAS - Copy1.pwn(598) : error 037: invalid string (possibly non-terminated string)
C:\Users\iMarkx\Desktop\CAS v5.0\gamemodes\CAS - Copy1.pwn(598) : error 017: undefined symbol "INSERT"
C:\Users\iMarkx\Desktop\CAS v5.0\gamemodes\CAS - Copy1.pwn(598) : error 017: undefined symbol "INTO"
C:\Users\iMarkx\Desktop\CAS v5.0\gamemodes\CAS - Copy1.pwn(598) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.



Re: MySQL, input line too long - robanswe - 14.08.2011

This time you can do:

pawn Code:
format(query, sizeof(query),
    "INSERT INTO playerdata (user, password, score, money, level, vip, kma, rank, kills, deaths, muted, jailed, frozen, mutedtimes, jailedtimes, frozentimes, banned, bannedby, logins, cookies, warn1, warn2, warn3, warn1reason, warn2reason, warn3reason, dateregisterd, kickedtimes, restorepos, slapedtimes, posx, posy, posz, posa, IP) VALUES('%s', SHA1('%s'), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s', 017, 0, 0, 0, 0, 'No Warn', 'No Warn', 'No Warn', '%s', 0, 0, 0, 0, 0, 0, 0, '%s')",
    pname, passwordstring, Bannedby, ReggedDate, IP);
But if you one day needs a even longer string then use https://sampwiki.blast.hk/wiki/Strpack .


Re: MySQL, input line too long - [HiC]TheKiller - 14.08.2011

pawn Code:
format(query, sizeof(query), "INSERT INTO playerdata (user, password, score, money, level, vip, kma, rank, kills, deaths, muted, jailed, frozen, mutedtimes, jailedtimes, frozentimes, banned, bannedby, logins,");
format(query, sizeof(query),  "%s cookies, warn1, warn2, warn3, warn1reason, warn2reason, warn3reason, dateregisterd, kickedtimes, restorepos, slapedtimes, posx, posy, posz, posa, IP)", query);
format(query, sizeof(query), "%s VALUES('%s', SHA1('%s'), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s', 017, 0, 0, 0, 0, 'No Warn', 'No Warn', 'No Warn', '%s', 0, 0, 0, 0, 0, 0, 0, '%s')", query, pname, passwordstring, Bannedby, ReggedDate, IP);
Doing that should fix it.


Re: MySQL, input line too long - robanswe - 14.08.2011

Quote:
Originally Posted by [HiC]TheKiller
View Post
pawn Code:
format(query, sizeof(query), "INSERT INTO playerdata (user, password, score, money, level, vip, kma, rank, kills, deaths, muted, jailed, frozen, mutedtimes, jailedtimes, frozentimes, banned, bannedby, logins,");
format(query, sizeof(query),  "%s cookies, warn1, warn2, warn3, warn1reason, warn2reason, warn3reason, dateregisterd, kickedtimes, restorepos, slapedtimes, posx, posy, posz, posa, IP)", query);
format(query, sizeof(query), "%s VALUES('%s', SHA1('%s'), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s', 017, 0, 0, 0, 0, 'No Warn', 'No Warn', 'No Warn', '%s', 0, 0, 0, 0, 0, 0, 0, '%s')", query, pname, passwordstring, Bannedby, ReggedDate, IP);
Doing that should fix it.
Format is for formating only! Use https://sampwiki.blast.hk/wiki/Strpack instead. Also he doesn't need to do that at all becouse the string isn't so long so you can just do like my first post in here.


Re: MySQL, input line too long - Grim_ - 14.08.2011

Quote:
Originally Posted by robanswe
View Post
Format is for formating only! Use https://sampwiki.blast.hk/wiki/Strpack instead. Also he doesn't need to do that at all becouse the string isn't so long so you can just do like my first post in here.
Actually, he is formatting the string.

Also, in the case you should concatenate the string, not pack it: https://sampwiki.blast.hk/wiki/Strcat


Re: MySQL, input line too long - Tigerkiller - 14.08.2011

pawn Code:
format(query, sizeof(query), "INSERT INTO playerdata (user, password, score, money, level, vip, kma, rank, kills, deaths, muted, jailed, frozen, mutedtimes, jailedtimes, frozentimes, banned, bannedby, logins, cookies, warn1, warn2, warn3, warn1reason, warn2reason, warn3reason, dateregisterd, kickedtimes, restorepos, slapedtimes, posx, posy, posz, posa, IP) VALUES('%s', SHA1('%s'), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s', 017, 0, 0, 0, 0, 'No Warn', 'No Warn', 'No Warn', '%s', 0, 0, 0, 0, 0, 0, 0, '%s'", pname, passwordstring, Bannedby, ReggedDate, IP);



Re: MySQL, input line too long - robanswe - 14.08.2011

Quote:
Originally Posted by Grim_
View Post
Actually, he is formatting the string.

Also, in the case you should concatenate the string, not pack it: https://sampwiki.blast.hk/wiki/Strcat
I fail it was strcat I was going to send.


Re: MySQL, input line too long - Markx - 15.08.2011

Alright, both rep+


Re: MySQL, input line too long - RyDeR` - 15.08.2011

If you're still interested there's another way. Just add '\' where you go to a new line:
pawn Code:
format(query, sizeof(query),
    "INSERT INTO playerdata (user, password, score, money, level, vip, kma, rank, kills, deaths, muted, jailed, \
    frozen, mutedtimes, jailedtimes, frozentimes, banned, bannedby, logins, cookies, warn1, warn2, warn3, \
    warn1reason, warn2reason, warn3reason, dateregisterd, kickedtimes, restorepos, slapedtimes, posx, posy, \
    posz, posa, IP) VALUES('%s', SHA1('%s'), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s', 017, 0, 0, 0, \
    0, 'No Warn', 'No Warn', 'No Warn', '%s', 0, 0, 0, 0, 0, 0, 0, '%s')"
,
pname, passwordstring, Bannedby, ReggedDate, IP);
mysql_query(query);



Re: MySQL, input line too long - robanswe - 16.08.2011

Quote:
Originally Posted by RyDeR`
View Post
If you're still interested there's another way. Just add '\' where you go to a new line:
pawn Code:
format(query, sizeof(query),
    "INSERT INTO playerdata (user, password, score, money, level, vip, kma, rank, kills, deaths, muted, jailed, \
    frozen, mutedtimes, jailedtimes, frozentimes, banned, bannedby, logins, cookies, warn1, warn2, warn3, \
    warn1reason, warn2reason, warn3reason, dateregisterd, kickedtimes, restorepos, slapedtimes, posx, posy, \
    posz, posa, IP) VALUES('%s', SHA1('%s'), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s', 017, 0, 0, 0, \
    0, 'No Warn', 'No Warn', 'No Warn', '%s', 0, 0, 0, 0, 0, 0, 0, '%s')"
,
pname, passwordstring, Bannedby, ReggedDate, IP);
mysql_query(query);
Wow thanks a lot that will speed up the query writing speed for sure.

+rep