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)
+--- Thread: [MySQL] Input line too long (/showthread.php?tid=283506)



[MySQL] Input line too long - Markx - 15.09.2011

Fixed.


Re: [MySQL] Input line too long - Mikkel_Pedersen - 15.09.2011

When I have a string that is too long I usually split it into several pieces and then use strcat to make them into one big string.
pawn Код:
new string[500]; //should be big enough
format(string, sizeof string, "long text 1 here");
strcat(string, "this text will be added to 'string' ");
strcat(string, "this text will be added to the new string (which contains the text above)");
//then here you use "string" instead of your long text (as "string" now contains all the text)



Re: [MySQL] Input line too long - Vince - 15.09.2011

Execute multiple queries or use strcat. But here's a tip: In MySQL you can set default values for nearly everything, even the registration date. When these are all set, the only thing you need to do is:

pawn Код:
format(query, sizeof(query), "INSERT INTO playerdata (user, password) VALUES ('%s', '%s')", pname, passwordstring);



Re: [MySQL] Input line too long - Markx - 15.09.2011

Heard of that method but didnt try it, lol, lets see if it works...

EDIT: can someone post the working code? Im confused.


Re: [MySQL] Input line too long - System64 - 15.09.2011

pawn Код:
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, warns, warn1reason, warn2reason, warn3reason, recordkillsteak, registerdate, laston, posx, \
    posy, posz, posa, IP"
);
format(query, sizeof(query), "VALUES('%s', SHA1('%s'), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s', 0, 0, 0, \ //Error line
    'N/A', 'N/A', 'N/A', '%s', '%s', 0, 0, 0, 0, '%s')"
, pname, passwordstring, Bannedby, ReggDate, LastOn, IP);
adn in mysql_query use query, mysql_query(query);


Re: [MySQL] Input line too long - Markx - 15.09.2011

Quote:
Originally Posted by System64
Посмотреть сообщение
pawn Код:
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, warns, warn1reason, warn2reason, warn3reason, recordkillsteak, registerdate, laston, posx, \
    posy, posz, posa, IP"
);
format(query, sizeof(query), "VALUES('%s', SHA1('%s'), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s', 0, 0, 0, \ //Error line
    'N/A', 'N/A', 'N/A', '%s', '%s', 0, 0, 0, 0, '%s')"
, pname, passwordstring, Bannedby, ReggDate, LastOn, IP);
adn in mysql_query use query, mysql_query(query);
That code fails, but thanks anyway.

STRCAT is freaking confusing, can someone post a working code with it?

EDIT: Nevermind it works. I fail, lol. It compiles


Re: [MySQL] Input line too long - [Diablo] - 15.09.2011

Use Vince's answer and fill in the columns with default values. That way, you can only insert username and pass, everything else is autofilled with values you specify.


Re: [MySQL] Input line too long - MP2 - 15.09.2011

You can't have default values for text fields though iirc