(MySql) input line too long
#1

When I compile I get this error "error 075: input line too long (after substitutions)" I already try some things as the Strcat but not work at least I could not use it correctly

Code:
mysql_format(mysqlConnectHandle, PlayerQuery[playerid], sizeof(PlayerQuery), "INSERT INTO `playerinfo` (`ipAdress`, `name`, `password`, `admin`, `moderator`, `vip`, `credits`, `language`, `timeMuted`, `timeJailed`, `banned`, `skin`, `spawnInterior`) VALUES ('%s', '%e', sha1('%e'), '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i')", PlayerInfo[playerid][ipAdress], PlayerInfo[playerid][name], PlayerInfo[playerid][password], PlayerInfo[playerid][admin], PlayerInfo[playerid][moderator], PlayerInfo[playerid][vip], PlayerInfo[playerid][credits], PlayerInfo[playerid][language], PlayerInfo[playerid][timeMuted], PlayerInfo[playerid][timeJailed], PlayerInfo[playerid][banned], PlayerInfo[playerid][skin], PlayerInfo[playerid][spawnInterior]);
mysql_tquery(mysqlConnectHandle, PlayerQuery[playerid], "", "");
Reply
#2

Look into the mysql_tquery definition and see what's the maximum it can handle for a query.
My guess is that your mysql_format query is too long for PlayerQuery[playerid].
Reply
#3

Quote:
Originally Posted by InglewoodRoleplay
View Post
Look into the mysql_tquery definition and see what's the maximum it can handle for a query.
My guess is that your mysql_format query is too long for PlayerQuery[playerid].
Thanks the suggestion but even I change the PlayerQuery to PlayerQuery[999][MAX_PLAYERS] (Only for test) and have the same error.
Reply
#4

Quote:
Originally Posted by goldspy98
View Post
Thanks the suggestion but even I change the PlayerQuery to PlayerQuery[999][MAX_PLAYERS] (Only for test) and have the same error.
Why are you using PlayerQuery[999][MAXPLAYERS]?
Try defining
pawn Code:
new SQLQuery[2048]; //(I know it's too big) at the top of your script
and then use it for your queries. See if that still happens. I don't think it makes much sense to use that PlayerQuery you're using for each player since it's just a server string that gets sent to SQL.
Then to free your string you can use:
pawn Code:
SQLQuery[0] = 0; //(Before you format it, of course.)
mysql_format(mysqlConnectHandle, SQLQuery, sizeof(SQLQuery), "INSERT INTO `playerinfo` (`ipAdress`, `name`, `password`, `admin`, `moderator`, `vip`, `credits`, `language`, `timeMuted`, `timeJailed`, `banned`, `skin`, `spawnInterior`) VALUES ('%s', '%e', sha1('%e'), '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i')", PlayerInfo[playerid][ipAdress], PlayerInfo[playerid][name], PlayerInfo[playerid][password], PlayerInfo[playerid][admin], PlayerInfo[playerid][moderator], PlayerInfo[playerid][vip], PlayerInfo[playerid][credits], PlayerInfo[playerid][language], PlayerInfo[playerid][timeMuted], PlayerInfo[playerid][timeJailed], PlayerInfo[playerid][banned], PlayerInfo[playerid][skin], PlayerInfo[playerid][spawnInterior]);
mysql_tquery(mysqlConnectHandle, SQLQuery, "", "");
If possible tell me what parameters mysql_tquery accepts since that may be part of the problem as well.
Reply
#5

Quote:
Originally Posted by InglewoodRoleplay
View Post
Why are you using PlayerQuery[999][MAXPLAYERS]?
Try defining
pawn Code:
new SQLQuery[2048]; //(I know it's too big) at the top of your script
and then use it for your queries. See if that still happens. I don't think it makes much sense to use that PlayerQuery you're using for each player since it's just a server string that gets sent to SQL.
Then to free your string you can use:
pawn Code:
SQLQuery[0] = 0; //(Before you format it, of course.)
mysql_format(mysqlConnectHandle, SQLQuery, sizeof(SQLQuery), "INSERT INTO `playerinfo` (`ipAdress`, `name`, `password`, `admin`, `moderator`, `vip`, `credits`, `language`, `timeMuted`, `timeJailed`, `banned`, `skin`, `spawnInterior`) VALUES ('%s', '%e', sha1('%e'), '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i')", PlayerInfo[playerid][ipAdress], PlayerInfo[playerid][name], PlayerInfo[playerid][password], PlayerInfo[playerid][admin], PlayerInfo[playerid][moderator], PlayerInfo[playerid][vip], PlayerInfo[playerid][credits], PlayerInfo[playerid][language], PlayerInfo[playerid][timeMuted], PlayerInfo[playerid][timeJailed], PlayerInfo[playerid][banned], PlayerInfo[playerid][skin], PlayerInfo[playerid][spawnInterior]);
mysql_tquery(mysqlConnectHandle, SQLQuery, "", "");
If possible tell me what parameters mysql_tquery accepts since that may be part of the problem as well.
Now I put thus but have the same error "error 075: input line too long (after substitutions)"

Code:
new SQLQuery[2048];

SQLQuery[0] = 0;
mysql_format(mysqlConnectHandle, SQLQuery, sizeof(SQLQuery), "INSERT INTO `playerinfo` (`ipAdress`, `name`, `password`, `admin`, `moderator`, `vip`, `credits`, `language`, `timeMuted`, `timeJailed`, `banned`, `skin`, `spawnInterior`) VALUES ('%s', '%e', sha1('%e'), '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i')", PlayerInfo[playerid][ipAdress], PlayerInfo[playerid][name], PlayerInfo[playerid][password], PlayerInfo[playerid][admin], PlayerInfo[playerid][moderator], PlayerInfo[playerid][vip], PlayerInfo[playerid][credits], PlayerInfo[playerid][language], PlayerInfo[playerid][timeMuted], PlayerInfo[playerid][timeJailed], PlayerInfo[playerid][banned], PlayerInfo[playerid][skin], PlayerInfo[playerid][spawnInterior]);
mysql_tquery(mysqlConnectHandle, SQLQuery, "", "");
I think the problem not is in variable, is in the line size because even if the variable has any size have the same problem and if I decrease the content of the line I don't have more any error.

Code:
mysql_format(mysqlConnectHandle, SQLQuery, sizeof(SQLQuery), "INSERT INTO `playerinfo` (`ipAdress`, `name`, `password`, `admin`, `moderator`, `vip`, `credits`, `language`) VALUES ('%s', '%e', sha1('%e'), '%i', '%i', '%i', '%i', '%i')", PlayerInfo[playerid][ipAdress], PlayerInfo[playerid][name], PlayerInfo[playerid][password], PlayerInfo[playerid][admin], PlayerInfo[playerid][moderator], PlayerInfo[playerid][vip], PlayerInfo[playerid][credits], PlayerInfo[playerid][language]); //Withdrawn: PlayerInfo[playerid][timeMuted], PlayerInfo[playerid][timeJailed], PlayerInfo[playerid][banned], PlayerInfo[playerid][skin], PlayerInfo[playerid][spawnInterior]
mysql_tquery(mysqlConnectHandle, SQLQuery, "", "");
--------------------------

Code:
mysql_tquery(connectionHandle, query[], callback[], format[], {Float,_}:...)
connectionHandle The connection handle this will be processed on.
query[] The query you want to execute.
callback[] The query you want to process.
format[] The format specifier string.
{Float,_}:... Indefinite number of arguments.

Returns 1 on success, 0 on fail.
Reply
#6

What plugin are you using, is it BlueG's R6, R7 or a different one?

Update:
Anyways, here's how I write my queries using the R7 MySQL plugin:

pawn Code:
format(SQLQuery, sizeof(SQLQuery),"INSERT INTO `playerinfo` (`ipAdress`, `name`, `password`, `admin`, `moderator`, `vip`, `credits`, `language`, `timeMuted`, `timeJailed`, `banned`, `skin`, `spawnInterior`) VALUES ('%s', '%e', sha1('%e'), '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i')", PlayerInfo[playerid][ipAdress], PlayerInfo[playerid][name], PlayerInfo[playerid][password], PlayerInfo[playerid][admin], PlayerInfo[playerid][moderator], PlayerInfo[playerid][vip], PlayerInfo[playerid][credits], PlayerInfo[playerid][language], PlayerInfo[playerid][timeMuted], PlayerInfo[playerid][timeJailed], PlayerInfo[playerid][banned], PlayerInfo[playerid][skin], PlayerInfo[playerid][spawnInterior]);
mysql_function_query(mysqlConnectHandle, SQLQuery, true, "EmptyCallback", "");
Reply
#7

Quote:
Originally Posted by InglewoodRoleplay
View Post
What plugin are you using, is it BlueG's R6, R7 or a different one?
I use a plugin of BlueG's but a more recent version the R34 (https://code.******.com/p/sa-mp-mysql-plugin/)

Wiki Samp: https://sampwiki.blast.hk/wiki/MySQL/R33


If it is not good if you can suggest another is because is the my first time I try use a system of mysql for SAMP.

---------------------

Quote:
Originally Posted by InglewoodRoleplay
View Post
Anyways, here's how I write my queries using the R7 MySQL plugin:

pawn Code:
format(SQLQuery, sizeof(SQLQuery),"INSERT INTO `playerinfo` (`ipAdress`, `name`, `password`, `admin`, `moderator`, `vip`, `credits`, `language`, `timeMuted`, `timeJailed`, `banned`, `skin`, `spawnInterior`) VALUES ('%s', '%e', sha1('%e'), '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i')", PlayerInfo[playerid][ipAdress], PlayerInfo[playerid][name], PlayerInfo[playerid][password], PlayerInfo[playerid][admin], PlayerInfo[playerid][moderator], PlayerInfo[playerid][vip], PlayerInfo[playerid][credits], PlayerInfo[playerid][language], PlayerInfo[playerid][timeMuted], PlayerInfo[playerid][timeJailed], PlayerInfo[playerid][banned], PlayerInfo[playerid][skin], PlayerInfo[playerid][spawnInterior]);
mysql_function_query(mysqlConnectHandle, SQLQuery, true, "EmptyCallback", "");
The version R34 not have the fuction mysql_function_query the equivalent fuction is mysql_tquery I think, you is better I use the version R7?
Reply
#8

Quote:
Originally Posted by goldspy98
View Post
I use a plugin of BlueG's but a more recent version the R34 (https://code.******.com/p/sa-mp-mysql-plugin/)

Wiki Samp: https://sampwiki.blast.hk/wiki/MySQL/R33


If it is not good if you can suggest another is because is the my first time I try use a system of mysql for SAMP.
Try using the alternative method I gave you above and if it still does not work wait for someone who can explain you how to use that plugin since I'm not really experienced with that one to be honest.

Update:

I use R7 because I'm used to it and I haven't had issues with it, although I wouldn't recommend you to downgrade if that's newer as you're saying. As I said, you would want to wait for someone who is experienced with that plugin.
Reply
#9

Quote:
Originally Posted by InglewoodRoleplay
View Post
Try using the alternative method I gave you above and if it still does not work wait for someone who can explain you how to use that plugin since I'm not really experienced with that one to be honest.
With your code I need use mysql_escape_string() for name and password?

----------------------

Ok I will try others methods including your suggestion, thanks the help
Reply
#10

Quote:
Originally Posted by goldspy98
View Post
With your code I need use mysql_escape_string() for name and password?
mysql_escape_string is used for input fields in order to prevent MySQL injections. It's used to escape special characters like "`" inside strings and yes, I believe that's the standard for mostly everything unless R27 is updated and it doesn't require you to escape queries.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)