SA-MP Forums Archive
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: Line too long (/showthread.php?tid=374306)



Line too long - Crazyboobs - 02.09.2012

why i cant fix this error? it says the line is too big
(38410) : error 075: input line too long (after substitutions)

pawn Код:
format(query, sizeof(query), "INSERT INTO data (user, password, IP, score, money, kills, deaths, registered, loggedin, level, cookies, cakes, biscuits, icecreams, YG, unlimitedb, quickweapon, vgoto, playerfly, TP, YGFunction1, YGFunction2, YGFunction3, YGFunction4, YGFunction5, YGFunction6, Bank, weed, Condoms, inalcatraz, hours, minutes, seconds, x1, y1, z1, interior1) VALUES('%s', SHA1('%s'), '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", pname, passwordstring, IP);



Re: Line too long - mamorunl - 02.09.2012

I take it that you are not too familiar with MySQL. You shouldve set up the database with NOT NULL types and a DEFAULT value. That way you wouldn't have had to create such a big query.


Re: Line too long - Deal-or-die - 02.09.2012

Try this
pawn Код:
format(query, sizeof(query), "INSERT INTO data (user, password, IP, score, money, kills, deaths, registered, loggedin, level, cookies, cakes, biscuits, icecreams, YG, unlimitedb, quickweapon, vgoto, playerfly, TP, YGFunction1) VALUES('%s', SHA1('%s'), '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)",pname,passwordstring,IP);
mysql_query(query);
format(query, sizeof(query), "INSERT INTO data (YGFunction2, YGFunction3, YGFunction4, YGFunction5, YGFunction6, Bank, weed, Condoms, inalcatraz, hours, minutes, seconds, x1, y1, z1, interior1) VALUES(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)");
mysql_query(query);



Re: Line too long - Crazyboobs - 02.09.2012

Quote:
Originally Posted by Deal-or-die
Посмотреть сообщение
Try this
pawn Код:
format(query, sizeof(query), "INSERT INTO data (user, password, IP, score, money, kills, deaths, registered, loggedin, level, cookies, cakes, biscuits, icecreams, YG, unlimitedb, quickweapon, vgoto, playerfly, TP, YGFunction1) VALUES('%s', SHA1('%s'), '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)",pname,passwordstring,IP);
mysql_query(query);
format(query, sizeof(query), "INSERT INTO data (YGFunction2, YGFunction3, YGFunction4, YGFunction5, YGFunction6, Bank, weed, Condoms, inalcatraz, hours, minutes, seconds, x1, y1, z1, interior1) VALUES(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)");
mysql_query(query);
Ok but when a player register then their name is registering in the database 2 times.
Why it is like that?


Re: Line too long - mamorunl - 02.09.2012

Because you got two INSERT INTOs whilst the second should be an UPDATE.

Even so, change your database and set default values and you wont need such a long query


Re: Line too long - Crazyboobs - 02.09.2012

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
Because you got two INSERT INTOs whilst the second should be an UPDATE.

Even so, change your database and set default values and you wont need such a long query
I didnt understand much, can you do that in this code ?

pawn Код:
format(query, sizeof(query), "INSERT INTO data (user, password, IP, score, money, kills, deaths, registered, loggedin, level, cookies, cakes, biscuits, icecreams, YG, unlimitedb, quickweapon, vgoto, playerfly, TP, YGFunction1) VALUES('%s', SHA1('%s'), '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)",pname,passwordstring,IP);
mysql_query(query);
format(query, sizeof(query), "INSERT INTO data (YGFunction2, YGFunction3, YGFunction4, YGFunction5, YGFunction6, Bank, weed, Condoms, inalcatraz, hours, minutes, seconds, x1, y1, z1, interior1) VALUES(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)");
mysql_query(query);



Re: Line too long - Kirollos - 02.09.2012

Quote:
Originally Posted by Deal-or-die
Посмотреть сообщение
Try this
pawn Код:
format(query, sizeof(query), "INSERT INTO data (user, password, IP, score, money, kills, deaths, registered, loggedin, level, cookies, cakes, biscuits, icecreams, YG, unlimitedb, quickweapon, vgoto, playerfly, TP, YGFunction1) VALUES('%s', SHA1('%s'), '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)",pname,passwordstring,IP);
mysql_query(query);
format(query, sizeof(query), "INSERT INTO data (YGFunction2, YGFunction3, YGFunction4, YGFunction5, YGFunction6, Bank, weed, Condoms, inalcatraz, hours, minutes, seconds, x1, y1, z1, interior1) VALUES(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)");
mysql_query(query);
that will make 2 accounts on database.

@crazyboobs,

try this

pawn Код:
new longstring[1000];

strcat(longstring, "(user, password, IP, score, money, kills, deaths, registered, loggedin, level, cookies, cakes, biscuits, icecreams, YG, unlimitedb, quickweapon, vgoto,");
strcat(longstring, " playerfly, TP, YGFunction1, YGFunction2, YGFunction3, YGFunction4, YGFunction5, YGFunction6, Bank, weed, Condoms, inalcatraz, hours, minutes, seconds, x1, y1, z1, interior1)");

format(query, sizeof(query), "INSERT INTO data %s VALUES('%s', SHA1('%s'), '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", longstring, pname, passwordstring, IP);



Re: Line too long - Crazyboobs - 02.09.2012

Quote:
Originally Posted by kirollos
Посмотреть сообщение
that will make 2 accounts on database.

@crazyboobs,

try this

pawn Код:
new longstring[1000];

strcat(longstring, "(user, password, IP, score, money, kills, deaths, registered, loggedin, level, cookies, cakes, biscuits, icecreams, YG, unlimitedb, quickweapon, vgoto,");
strcat(longstring, " playerfly, TP, YGFunction1, YGFunction2, YGFunction3, YGFunction4, YGFunction5, YGFunction6, Bank, weed, Condoms, inalcatraz, hours, minutes, seconds, x1, y1, z1, interior1)");

format(query, sizeof(query), "INSERT INTO data %s VALUES('%s', SHA1('%s'), '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", longstring, pname, passwordstring, IP);
I did something like this

pawn Код:
format(query, sizeof(query), "INSERT INTO data (user, password, IP, score, money, kills, deaths, registered, loggedin, level, cookies, cakes, biscuits, icecreams, YG, unlimitedb, quickweapon, vgoto, playerfly, TP, YGFunction1) VALUES('%s', SHA1('%s'), '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)",pname,passwordstring,IP);
    mysql_query(query);
    format(query, sizeof(query), "UPDATE data (YGFunction2, YGFunction3, YGFunction4, YGFunction5, YGFunction6, Bank, weed, Condoms, inalcatraz, hours, minutes, seconds, x1, y1, z1, interior1) VALUES(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)");
    mysql_query(query);
and now its working fine and it may cause any problem?


Re: Line too long - mamorunl - 02.09.2012

It is not working fine as that is not the way an UPDATE clause should be formatted, also it will update it on all accounts. GO FIX YOUR DATABASE SO YOU DONT HAVE TO CREATE THIS STUFF IN THE FIRST PLACE!

Want me to put it in even bigger letters? Go learn some database management first!


Re: Line too long - Crazyboobs - 02.09.2012

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
It is not working fine as that is not the way an UPDATE clause should be formatted, also it will update it on all accounts. GO FIX YOUR DATABASE SO YOU DONT HAVE TO CREATE THIS STUFF IN THE FIRST PLACE!

Want me to put it in even bigger letters? Go learn some database management first!
What about this?
pawn Код:
new longstring[1000];

strcat(longstring, "(user, password, IP, score, money, kills, deaths, registered, loggedin, level, cookies, cakes, biscuits, icecreams, YG, unlimitedb, quickweapon, vgoto,");
strcat(longstring, " playerfly, TP, YGFunction1, YGFunction2, YGFunction3, YGFunction4, YGFunction5, YGFunction6, Bank, weed, Condoms, inalcatraz, hours, minutes, seconds, x1, y1, z1, interior1)");

format(query, sizeof(query), "INSERT INTO data %s VALUES('%s', SHA1('%s'), '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", longstring, pname, passwordstring, IP);
And as you said' GO FIX YOUR DATABASE SO YOU DONT HAVE TO CREATE THIS STUFF IN THE FIRST PLACE!'
What i have to fix in database?