input line too long (after substitutions)
#1

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.
Reply
#2

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
Reply
#3

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...
Reply
#4

Use strcat.
https://sampwiki.blast.hk/wiki/Strcat
Reply
#5

I have a better solution: use DEFAULT values for your tables.
Reply
#6

Quote:
Originally Posted by AndreT
View Post
I have a better solution: use DEFAULT values for your tables.
How ?
Reply
#7

Quote:
Originally Posted by Linus-
View Post
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
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)