Mysql error 075: input line too long
#1

Hey, I'm getting errors again...

pawn Код:
stock SaveFactions(factionid)
{
    new query[1000];
    format(query, sizeof(query), "UPDATE `Factions` SET `FactionName` = '%s', `CommandTypes` = %d, `RankName1` = '%s', `RankName2` = '%s', `RankName3` = '%s', `RankName4` = '%s', `RankName5` = '%s', `RankName6` = '%s',`RankName7` = '%s', `Skin1` = %d, `Skin2` = %d, `Skin2` = %d, `Skin3` = %d, `Skin4` = %d, `Skin5` = %d, `Skin6` = %d, `Skin7` = %d, `HQInteriorID` = %d, `HQInteriorX` = '%f', `HQInteriorY` = '%f', `HQInteriorZ` = '%f', `HQInteriorA` = '%f', `HQExteriorID` = %d, `HQExteriorX` = '%f', `HQExteriorY` = '%f', `HQExteriorZ` = '%f', `HQExteriorA` = '%f', `SafeInteriorID` = %d, `SafeX`= '%f', `SafeY` = '%f', `SafeZ` = '%f', `SafeWorld` = %d, `HQLock` = %d, `FOwner` = '%s', WHERE `FactionID` = %d",
        Faction[factionid][FactionName],
        Faction[factionid][RankName1],
        Faction[factionid][RankName2],
        Faction[factionid][RankName3],
        Faction[factionid][RankName4],
        Faction[factionid][RankName5],
        Faction[factionid][RankName6],
        Faction[factionid][RankName7],
        Faction[factionid][Skin1],
        Faction[factionid][Skin2],
        Faction[factionid][Skin3],
        Faction[factionid][Skin4],
        Faction[factionid][Skin5],
        Faction[factionid][Skin6],
        Faction[factionid][Skin7],
        Faction[factionid][HQInteriorID],
        Faction[factionid][HQInteriorX],
        Faction[factionid][HQInteriorY],
        Faction[factionid][HQInteriorZ],
        Faction[factionid][HQInteriorA],
        Faction[factionid][HQExteriorID],
        Faction[factionid][HQExteriorX],
        Faction[factionid][HQExteriorY],
        Faction[factionid][HQExteriorZ],
        Faction[factionid][HQExteriorA],
        Faction[factionid][SafeInteriorID],
        Faction[factionid][SafeX],
        Faction[factionid][SafeY],
        Faction[factionid][SafeZ],
        Faction[factionid][SafeWorld],
        Faction[factionid][HQLock],
        Faction[factionid][FOwner],
        factionid,
    mysql_function_query(connectionHandle, query, false, "DefaultCallback", "");
    return 1;
}
Код:
C:\Users\User\Desktop\GTA RP Script\gamemodes\RolePlay.pwn(2050) : error 075: input line too long (after substitutions)
C:\Users\User\Desktop\GTA RP Script\gamemodes\RolePlay.pwn(2051) : error 037: invalid string (possibly non-terminated string)
C:\Users\User\Desktop\GTA RP Script\gamemodes\RolePlay.pwn(2051) : error 017: undefined symbol "UPDATE"
C:\Users\User\Desktop\GTA RP Script\gamemodes\RolePlay.pwn(2051) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\GTA RP Script\gamemodes\RolePlay.pwn(2051) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#2

Hi, the problem is your query line is too large (not size wise) but as in it's width across the PAWNO editor.

You're going to have to spilt it up using the '/' character.

pawn Код:
format(query, sizeof(query), "UPDATE `Factions` SET `FactionName` = '%s', `CommandTypes` = %d, `RankName1` = '%s', `RankName2` = '%s', \
`RankName3` = '%s', `RankName4` = '%s', `RankName5` = '%s', `RankName6` = '%s',`RankName7` = '%s', \
`Skin1` = %d, `Skin2` = %d, `Skin2` = %d, `Skin3` = %d, `Skin4` = %d, `Skin5` = %d, `Skin6` = %d, `Skin7` = %d, `HQInteriorID` = %d, \
`HQInteriorX` = '%f', `HQInteriorY` = '%f', `HQInteriorZ` = '%f', `HQExteriorID` = %d, `HQExteriorX` = '%f', `HQExteriorY` = '%f', \
`HQExteriorZ` = '%f', `SafeInteriorID` = %d, `SafeX`= '%f', `SafeY` = '%f', `SafeZ` = '%f', `SafeWorld` = %d, \
`HQLock` = %d, `FOwner` = '%s'(comma here wasn't needed :)) WHERE `FactionID` = %d"
,
Also there is an error in your sql code. After `fOwner` = '%s', An additional comma at the end isn't needed .

Goodluck, that should provide you with a fix.
Reply
#3

Quote:
Originally Posted by Haydz
Посмотреть сообщение
Hi, the problem is your query line is too large (not size wise) but as in it's width across the PAWNO editor.

You're going to have to spilt it up using the '/' character.

pawn Код:
format(query, sizeof(query), "UPDATE `Factions` SET `FactionName` = '%s', `CommandTypes` = %d, `RankName1` = '%s', `RankName2` = '%s', \
`RankName3` = '%s', `RankName4` = '%s', `RankName5` = '%s', `RankName6` = '%s',`RankName7` = '%s', \
`Skin1` = %d, `Skin2` = %d, `Skin2` = %d, `Skin3` = %d, `Skin4` = %d, `Skin5` = %d, `Skin6` = %d, `Skin7` = %d, `HQInteriorID` = %d, \
`HQInteriorX` = '%f', `HQInteriorY` = '%f', `HQInteriorZ` = '%f', `HQExteriorID` = %d, `HQExteriorX` = '%f', `HQExteriorY` = '%f', \
`HQExteriorZ` = '%f', `SafeInteriorID` = %d, `SafeX`= '%f', `SafeY` = '%f', `SafeZ` = '%f', `SafeWorld` = %d, \
`HQLock` = %d, `FOwner` = '%s', WHERE `FactionID` = %d"
,
Also there is an error in your sql code. After `fOwner` = '%s', An additional comma at the end isn't needed .

Goodluck, that should provide you with a fix.
Worked, thanks Rep+
Reply
#4

I'm going to say this again and again until someone listens: if you need to add numbers to field names then you're doing it wrong. Use more tables.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
I'm going to say this again and again until someone listens: if you need to add numbers to field names then you're doing it wrong. Use more tables.
What do you mean?
Reply
#6

pawn Код:
stock SaveFaction(factionid)
{
    new query[5000];
    format(query, sizeof(query), "UPDATE `Factions` SET `FactionName` = '%s', `CommandTypes` = %d, `RankName1` = '%s', `RankName2` = '%s', \
    `RankName3` = '%s', `RankName4` = '%s', `RankName5` = '%s', `RankName6` = '%s',\
    `RankName7` = '%s', `Skin1` = %d, `Skin2` = %d, `Skin2` = %d, `Skin3` = %d, `Skin4` = %d, \
    `Skin5` = %d, `Skin6` = %d, `Skin7` = %d, \
    `HQInteriorID` = %d, `HQInteriorX` = '%f', `HQInteriorY` = '%f', `HQInteriorZ` = '%f', \
    `HQInteriorA` = '%f', `HQExteriorID` = %d, `HQExteriorX` = '%f', `HQExteriorY` = '%f', \
    `HQExteriorZ` = '%f', `HQExteriorA` = '%f', `SafeInteriorID` = %d, `SafeX`= '%f', `SafeY` = '%f', \
    `SafeZ` = '%f', `SafeWorld` = %d,`HQLock` = %d, `FOwner` = '%s' WHERE `FactionID` = %d"
,
        Factions[factionid][FactionName],
        Factions[factionid][RankName1],
        Factions[factionid][RankName2],
        Factions[factionid][RankName3],
        Factions[factionid][RankName4],
        Factions[factionid][RankName5],
        Factions[factionid][RankName6],
        Factions[factionid][RankName7],
        Factions[factionid][Skin1],
        Factions[factionid][Skin2],
        Factions[factionid][Skin3],
        Factions[factionid][Skin4],
        Factions[factionid][Skin5],
        Factions[factionid][Skin6],
        Factions[factionid][Skin7],
        Factions[factionid][HQInteriorID],
        Factions[factionid][HQInteriorX],
        Factions[factionid][HQInteriorY],
        Factions[factionid][HQInteriorZ],
        Factions[factionid][HQInteriorA],
        Factions[factionid][HQExteriorID],
        Factions[factionid][HQExteriorX],
        Factions[factionid][HQExteriorY],
        Factions[factionid][HQExteriorZ],
        Factions[factionid][HQExteriorA],
        Factions[factionid][SafeInteriorID],
        Factions[factionid][SafeX],
        Factions[factionid][SafeY],
        Factions[factionid][SafeZ],
        Factions[factionid][SafeWorld],
        Factions[factionid][HQLock],
        Factions[factionid][FOwner],
        factionid,
    mysql_function_query(connectionHandle, query, false, "DefaultCallback", "");
    return 1;
}
Errors are back....

Код:
C:\Users\User\Desktop\GTA RP Script\gamemodes\RolePlay.pwn(2050) : error 075: input line too long (after substitutions)
C:\Users\User\Desktop\GTA RP Script\gamemodes\RolePlay.pwn(2051) : error 037: invalid string (possibly non-terminated string)
C:\Users\User\Desktop\GTA RP Script\gamemodes\RolePlay.pwn(2051) : error 017: undefined symbol "UPDATE"
C:\Users\User\Desktop\GTA RP Script\gamemodes\RolePlay.pwn(2051) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\GTA RP Script\gamemodes\RolePlay.pwn(2051) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#7

The way I see it you should use at least three tables. One for the main information, one for the ranks and one for the skins. This will also allow you to have an arbitrary amount of ranks and skins, rather than a fixed amount.

Table 1 will be the main table and will contain everything you have right now, except for skins and rank. It needs an id field, though.
Table 2 will contain the ranks and will look like this:

factionidrankidrankname
11Beginner
12Advanced
13Senior
14Master
Second table for skins follows the same structure, but it doesn't need a sequence number.

factionidskinid
1211
1212
1225
1233
Lots of stuff also doesn't need to be updated. It's not like you're going to move the headquarters every 5 minutes. In the unlikely event that you do move the headquarters then you should propagate that information (and that information only) to the database immediately in a separate function.
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
The way I see it you should use at least three tables. One for the main information, one for the ranks and one for the skins. This will also allow you to have an arbitrary amount of ranks and skins, rather than a fixed amount.

Table 1 will be the main table and will contain everything you have right now, except for skins and rank. It needs an id field, though.
Table 2 will contain the ranks and will look like this:

factionidrankidrankname
11Beginner
12Advanced
13Senior
14Master
Second table for skins follows the same structure, but it doesn't need a sequence number.

factionidskinid
1211
1212
1225
1233
Lots of stuff also doesn't need to be updated. It's not like you're going to move the headquarters every 5 minutes. In the unlikely event that you do move the headquarters then you should propagate that information (and that information only) to the database immediately in a separate function.
Can you send me a forum PM in the dutch language since I just started to work with Mysql and I don't really understand this xD
Reply
#9

Quote:
Originally Posted by Haydz
Посмотреть сообщение
Hi, the problem is your query line is too large (not size wise) but as in it's width across the PAWNO editor.

You're going to have to spilt it up using the '/' character.

pawn Код:
format(query, sizeof(query), "UPDATE `Factions` SET `FactionName` = '%s', `CommandTypes` = %d, `RankName1` = '%s', `RankName2` = '%s', \
`RankName3` = '%s', `RankName4` = '%s', `RankName5` = '%s', `RankName6` = '%s',`RankName7` = '%s', \
`Skin1` = %d, `Skin2` = %d, `Skin2` = %d, `Skin3` = %d, `Skin4` = %d, `Skin5` = %d, `Skin6` = %d, `Skin7` = %d, `HQInteriorID` = %d, \
`HQInteriorX` = '%f', `HQInteriorY` = '%f', `HQInteriorZ` = '%f', `HQExteriorID` = %d, `HQExteriorX` = '%f', `HQExteriorY` = '%f', \
`HQExteriorZ` = '%f', `SafeInteriorID` = %d, `SafeX`= '%f', `SafeY` = '%f', `SafeZ` = '%f', `SafeWorld` = %d, \
`HQLock` = %d, `FOwner` = '%s'(comma here wasn't needed :)) WHERE `FactionID` = %d"
,
Also there is an error in your sql code. After `fOwner` = '%s', An additional comma at the end isn't needed .

Goodluck, that should provide you with a fix.
That cannot fix the problem, because '\' tells the compiler that the line doesn't end here and continues, so it forces the compiler to process multiple lines as a single line, which means that the logical line will still be too long, even though you've split it into multiple physical lines.

You can fix it by using multiple format() functions, like this:

pawn Код:
stock SaveFaction(factionid)
{
    new query[5000];
    format(query, sizeof(query), "UPDATE `Factions` SET `FactionName` = '%s', `CommandTypes` = %d, `RankName1` = '%s', `RankName2` = '%s', \
    `RankName3` = '%s', `RankName4` = '%s', `RankName5` = '%s', `RankName6` = '%s', "
,
        Factions[factionid][FactionName],
        Factions[factionid][RankName1],
        Factions[factionid][RankName2],
        Factions[factionid][RankName3],
        Factions[factionid][RankName4],
        Factions[factionid][RankName5],
        Factions[factionid][RankName6]);
    format(query, sizeof(query), "%s`RankName7` = '%s', `Skin1` = %d, `Skin2` = %d, `Skin2` = %d, `Skin3` = %d, `Skin4` = %d, \
    `Skin5` = %d, `Skin6` = %d, `Skin7` = %d, \
    `HQInteriorID` = %d, `HQInteriorX` = '%f', `HQInteriorY` = '%f', `HQInteriorZ` = '%f', \
    `HQInteriorA` = '%f', "
,
        query,
        Factions[factionid][RankName7],
        Factions[factionid][Skin1],
        Factions[factionid][Skin2],
        Factions[factionid][Skin3],
        Factions[factionid][Skin4],
        Factions[factionid][Skin5],
        Factions[factionid][Skin6],
        Factions[factionid][Skin7],
        Factions[factionid][HQInteriorID],
        Factions[factionid][HQInteriorX],
        Factions[factionid][HQInteriorY],
        Factions[factionid][HQInteriorZ],
        Factions[factionid][HQInteriorA]);
    format(query, sizeof(query), "%s`HQExteriorID` = %d, `HQExteriorX` = '%f', `HQExteriorY` = '%f', \
    `HQExteriorZ` = '%f', `HQExteriorA` = '%f', `SafeInteriorID` = %d, `SafeX`= '%f', `SafeY` = '%f', \
    `SafeZ` = '%f', `SafeWorld` = %d,`HQLock` = %d, `FOwner` = '%s' WHERE `FactionID` = %d"
,
        query,
        Factions[factionid][HQExteriorID],
        Factions[factionid][HQExteriorX],
        Factions[factionid][HQExteriorY],
        Factions[factionid][HQExteriorZ],
        Factions[factionid][HQExteriorA],
        Factions[factionid][SafeInteriorID],
        Factions[factionid][SafeX],
        Factions[factionid][SafeY],
        Factions[factionid][SafeZ],
        Factions[factionid][SafeWorld],
        Factions[factionid][HQLock],
        Factions[factionid][FOwner],
        factionid);
    mysql_function_query(connectionHandle, query, false, "DefaultCallback", "");
    return 1;
}
You can also use strcat().
Reply
#10

Solved, thanks Pooh7
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)