PDA

View Full Version : Input line too long MySQL

Boolean
10/01/2015, 12:39 PM
Can anyone give me a solution?

ERROR:

PRP\gamemodes\PRPSQL.pwn(1524) : error 075: input line too long (after substitutions)
PRP\gamemodes\PRPSQL.pwn(1525) : error 037: invalid string (possibly non-terminated string)
PRP\gamemodes\PRPSQL.pwn(1525) : error 017: undefined symbol "INSERT"
PRP\gamemodes\PRPSQL.pwn(1525) : error 017: undefined symbol "INTO"
PRP\gamemodes\PRPSQL.pwn(1525) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

5 Errors.

CODE:

COMMAND:createhouse(playerid, params[])
{
new string[150], price, query[555];

if(Logged[playerid] != 1) return SCM(playerid, GREY, NOTLOGGED);
if(sscanf(params, "i", price)) return SCM(playerid, WHITE, "Hint: /createhouse (price)");

for(new idx = 1; idx < sizeof(HouseInfo); idx++)
{
if(HouseInfo[idx][house_id] == 0)
{
new Float:X, Float:Y, Float:Z, Float:A, location[MAX_ZONE_NAME];
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);

HouseInfo[idx][Price] = price;
HouseInfo[idx][Lock] = 1;
format(HouseInfo[idx][Owner], 64, "The State");
format(HouseInfo[idx][StreetName], 64, "House number | Streetname");

HouseInfo[idx][EX] = X;
HouseInfo[idx][EY] = Y;
HouseInfo[idx][EZ] = Z;
HouseInfo[idx][EA] = A;

HouseInfo[idx][ExInterior] = GetPlayerInterior(playerid);
HouseInfo[idx][ExVirtualWorld] = GetPlayerVirtualWorld(playerid);

HouseInfo[idx][IntVirtualWorld] = idx+200;

GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
format(string, sizeof(string), "AdmWarn: %s has created a house at %s. [ID: %d]", GetName(playerid), location, idx);

new string2[150];
HouseInfo[idx][Checkpoint] = CreateDynamicCP(HouseInfo[idx][EX], HouseInfo[idx][EY], HouseInfo[idx][EZ], 1.0, HouseInfo[idx][ExVirtualWorld], HouseInfo[idx][ExInterior], -1, 5.0);

if(!HouseInfo[idx][Lock]) format(string2, sizeof(string2), "[%s]\n{33AA33}%s", HouseInfo[idx][StreetName], HouseLock(idx));
else format(string2, sizeof(string2), "[%s]\n{FF0000}%s", HouseInfo[idx][StreetName], HouseLock(idx));
HouseInfo[idx][houseText] = CreateDynamic3DTextLabel(string2, GREY, HouseInfo[idx][EX], HouseInfo[idx][EY], HouseInfo[idx][EZ]+0.3, 5);

format(query, sizeof(query), "INSERT INTO houses (`id`, `ex`, `ey`, `ez`, `ix`, `iy`, `iz`, `intangle`, `exangle`, `exinterior`, `exvirtualworld`, `intinterior`, `intvirtualworld`, \
`owned`, `price`, `lock`, `rent`, `rentprice`, `invmoney`, `day`, `month`, `year`, `invwep1`, `invwep2`, `invwep3`, `invammo1`, `invammo2`, `invammo3`, \
/*LINE 1524*/`owner`, `streetname`) VALUES ('%d', '%f', '%f', '%f', '0', '0', '0', '0', '%f', '%d', '%d', '0', '0', '0', '%d', '1', '0', '0', '0', '0', '0', '0', \
'0', '0', '0', '0', '0', '0', '0', '0')", idx, X, Y, Z, A, HouseInfo[idx][ExInterior], HouseInfo[idx][ExVirtualWorld], HouseInfo[idx][Price]);
mysql_query(query);

idx = MAX_HOUSES;
}
}
return true;
}

Vince
10/01/2015, 12:49 PM
1) Use default values. This will significantly shorten your query because you don't have to insert zeros.
2) Inventory information should actually be moved to a separate table. If there can be an indefinite amount of something it should be in a separate table. Now you can argue that you only want to store three weapons, but if in the future you decide you want to store more you have to edit your database and your queries, whereas with proper normalization you wouldn't have to change anything.
3) day, month and year can probably be collapsed into a single column, using either a Unix timestamp or the DateTime type.

Boolean
10/01/2015, 12:55 PM
1) Use default values. This will significantly shorten your query because you don't have to insert zeros.
2) Inventory information should actually be moved to a separate table. If there can be an indefinite amount of something it should be in a separate table. Now you can argue that you only want to store three weapons, but if in the future you decide you want to store more you have to edit your database and your queries, whereas with proper normalization you wouldn't have to change anything.
3) day, month and year can probably be collapsed into a single column, using either a Unix timestamp or the DateTime type.
Could you give me an example of how to use default values? Also, if I were to make a separate table for the inventory, how would I link it to the house I'm creating?