input line too long (after substitutions) -
Linus- - 30.08.2011
Hey i have an error:
Quote:
C:\Users\Linus\Desktop\SA-MP0.3c\filterscripts\SQLite.pwn(250) : error 075: input line too long (after substitutions)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
|
Here's the error line:
pawn Code:
format(Query, sizeof(Query), "INSERT INTO `USERS` (`NAME`, `PASSWORD`, `IP`, `SCORE`, `CASH`, `ADMINLEVEL`, `KILLS`, `DEATHS`, `VIPLEVEL`, `Hours`, `Minutes`, `Seconds`, `RegisteredDate`, `LastX`, `LastY`, `LastZ`, `Interior`, `Armour`, `Health`, `GamingPoints`, `Wantedlevel`, `Skin`, `FightStyle`, `LastOn`) VALUES('%s','%s','%s', '0', '500', '0', '0', '0', '0', '0', '0', '0', '%s', '0', '0', '0', '0', '0', '0', '0', '0', '%d', '%s', '0')", name, inputtext, ip, strdate, Skin, GetPlayerFightStyleName(playerid)); // Error line (250)
db_free_result(db_query(Database, Query));
How to fix it? please help me please.
Re: input line too long (after substitutions) -
TTJJ - 30.08.2011
Hi Linus-
I would suggest spliting it up using
strins
Cut that format in half and on the next line append data to the string using strins.
Documentation on strins:
https://sampwiki.blast.hk/wiki/Strins
Cheers,
TJ
Re: input line too long (after substitutions) -
Jochemd - 30.08.2011
You can break the line as long it ends with a comma, not in a string
pawn Code:
format(Query, sizeof(Query),
"INSERT INTO `USERS` (`NAME`, `PASSWORD`, `IP`, `SCORE`, `CASH`, `ADMINLEVEL`, `KILLS`, `DEATHS`, `VIPLEVEL`, `Hours`, `Minutes`, `Seconds`, `RegisteredDate`, `LastX`, `LastY`, `LastZ`, `Interior`, `Armour`, `Health`, `GamingPoints`, `Wantedlevel`, `Skin`, `FightStyle`, `LastOn`) VALUES('%s','%s','%s', '0', '500', '0', '0', '0', '0', '0', '0', '0', '%s', '0', '0', '0', '0', '0', '0', '0', '0', '%d', '%s', '0')",
name, inputtext, ip, strdate, Skin, GetPlayerFightStyleName(playerid)); // Error line (250)
Try this.
@ TTJJ: That's bullshit. It would just copy a string. For such things you should use strcat...
Re: input line too long (after substitutions) -
[MWR]Blood - 30.08.2011
Use strcat.
https://sampwiki.blast.hk/wiki/Strcat
Re: input line too long (after substitutions) -
AndreT - 30.08.2011
I have a better solution: use DEFAULT values for your tables.
Re: input line too long (after substitutions) -
Linus- - 30.08.2011
Quote:
Originally Posted by AndreT
I have a better solution: use DEFAULT values for your tables.
|
How ?
Re: input line too long (after substitutions) -
Jochemd - 30.08.2011
Quote:
Originally Posted by Linus-
How ?
|
At the place where you design your table, you can put default values.
A good and free program for MySQL Administration would be
Navicat
Re: input line too long (after substitutions) -
JaTochNietDan - 30.08.2011
Most of those values are just being inserted as static default values, why not set up a default value in the MySQL table so that it does it automatically? Then you don't have to insert those values everytime you add a new row to your table. If you're using a MySQL manager such as Navicat, then you can simply set a default value in there when you're creating/editing the table.
When you're creating the table using a query, here is an example query on how to set default values for columns:
pawn Code:
CREATE TABLE example_default_now (
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
created INT DEFAULT 0
string VARCHAR(10) DEFAULT 'empty'
);
Hope that helps
You can also simply use "NOT NULL" to make it so that the field can never be null, which will result in the field being empty should no value be specified when the row is being created.