SA-MP Forums Archive
Mysql input line to long help - 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: Mysql input line to long help (/showthread.php?tid=399623)



Mysql input line to long help - arko123 - 15.12.2012

Heres the code:
pawn Code:
new saveQuery2[200];
        format(saveQuery, sizeof(saveQuery), "%s, playerPhoneBook = '%d', playerGroup = '%d', playerGroupRank = '%d', playerIP = '%s', playerDropCarTimeout = '%d', playerHotwireTime = '%d', playerRope = '%d', playerVehicleParts = '%d', playerScrewDriver = '%d', playerGasCan = '%d', playerSprayCan = '%d', playerToolKit= '%d', playerIdentification = '%d',playerAdminDuty = '%d', playerCrimes = '%d', playerArrests = '%d', playerWarrants = '%d', playerAge = '%d', playerVIPtokens = '%d',  playerRags = '%d', playerCarEngineStatus = '%d', playerFuel = '%d'"
        , saveQuery, playerVariables[playerid][pPhoneBook], playerVariables[playerid][pGroup]
        , playerVariables[playerid][pGroupRank], playerVariables[playerid][pConnectionIP]
        , playerVariables[playerid][pDropCarTimeout], playerVariables[playerid][pHotwireTime]
        , playerVariables[playerid][pRope], playerVariables[playerid][pVehicleParts]
        , playerVariables[playerid][pScrewDriver], playerVariables[playerid][pGasCan]
        , playerVariables[playerid][pSprayCan], playerVariables[playerid][pToolKit]
        , playerVariables[playerid][pIdentification], playerVariables[playerid][pAdminDuty]
        , playerVariables[playerid][pCrimes], playerVariables[playerid][pArrests]
        , playerVariables[playerid][pWarrants], playerVariables[playerid][pAge]
        , playerVariables[playerid][pVIPtokens], playerVariables[playerid][pRags]
        , playerVariables[playerid][pCarEngineStatua], playerVariables[playerid][fuel]);
Heres the errors:
pawn Code:
5585) : error 075: input line too long (after substitutions)
(5586) : error 037: invalid string (possibly non-terminated string)
(5586) : warning 215: expression has no effect
(5586) : error 001: expected token: ";", but found "-identifier-"
(5586) : error 017: undefined symbol "d"
(5586) : fatal error 107: too many error messages on one line



Re: Mysql input line to long help - FTLOG - 15.12.2012

Use strcat(...


Re: Mysql input line to long help - [HiC]TheKiller - 15.12.2012

You're going to have to use multiple formats so that it does not exceed the max line length.

pawn Code:
new saveQuery2[200];
        format(saveQuery, sizeof(saveQuery), "%s, playerPhoneBook = '%d', playerGroup = '%d', playerGroupRank = '%d', playerIP = '%s', playerDropCarTimeout = '%d', playerHotwireTime = '%d', playerRope = '%d', playerVehicleParts = '%d', playerScrewDriver = '%d', playerGasCan = '%d', playerSprayCan = '%d', playerToolKit= '%d'"
        , saveQuery, playerVariables[playerid][pPhoneBook], playerVariables[playerid][pGroup]
        , playerVariables[playerid][pGroupRank], playerVariables[playerid][pConnectionIP]
        , playerVariables[playerid][pDropCarTimeout], playerVariables[playerid][pHotwireTime]
        , playerVariables[playerid][pRope], playerVariables[playerid][pVehicleParts]
        , playerVariables[playerid][pScrewDriver], playerVariables[playerid][pGasCan]
        , playerVariables[playerid][pSprayCan], playerVariables[playerid][pToolKit]);


        format(saveQuery, sizeof(saveQuery), "%s, playerIdentification = '%d',playerAdminDuty = '%d', playerCrimes = '%d', playerArrests = '%d', playerWarrants = '%d', playerAge = '%d', playerVIPtokens = '%d',  playerRags = '%d', playerCarEngineStatus = '%d', playerFuel = '%d'"
        , saveQuery
        , playerVariables[playerid][pIdentification], playerVariables[playerid][pAdminDuty]
        , playerVariables[playerid][pCrimes], playerVariables[playerid][pArrests]
        , playerVariables[playerid][pWarrants], playerVariables[playerid][pAge]
        , playerVariables[playerid][pVIPtokens], playerVariables[playerid][pRags]
        , playerVariables[playerid][pCarEngineStatua], playerVariables[playerid][fuel]);



Re: Mysql input line to long help - Konstantinos - 15.12.2012

Quote:
Originally Posted by [HiC]TheKiller
View Post
pawn Code:
new saveQuery2[00];
lol, you've got a typing mistake there!

pawn Code:
// --
        new saveQuery2[200];
        format(saveQuery, sizeof(saveQuery), "%s, playerPhoneBook = '%d', playerGroup = '%d', playerGroupRank = '%d', playerIP = '%s', playerDropCarTimeout = '%d', \
        playerHotwireTime = '%d', playerRope = '%d', playerVehicleParts = '%d', playerScrewDriver = '%d', playerGasCan = '%d', playerSprayCan = '%d', \
        playerToolKit= '%d', playerIdentification = '%d',playerAdminDuty = '%d', playerCrimes = '%d', playerArrests = '%d', playerWarrants = '%d', playerAge = '%d', \
        playerVIPtokens = '%d',  playerRags = '%d', playerCarEngineStatus = '%d', playerFuel = '%d'"

        , saveQuery, playerVariables[playerid][pPhoneBook], playerVariables[playerid][pGroup]
        , playerVariables[playerid][pGroupRank], playerVariables[playerid][pConnectionIP]
        , playerVariables[playerid][pDropCarTimeout], playerVariables[playerid][pHotwireTime]
        , playerVariables[playerid][pRope], playerVariables[playerid][pVehicleParts]
        , playerVariables[playerid][pScrewDriver], playerVariables[playerid][pGasCan]
        , playerVariables[playerid][pSprayCan], playerVariables[playerid][pToolKit]
        , playerVariables[playerid][pIdentification], playerVariables[playerid][pAdminDuty]
        , playerVariables[playerid][pCrimes], playerVariables[playerid][pArrests]
        , playerVariables[playerid][pWarrants], playerVariables[playerid][pAge]
        , playerVariables[playerid][pVIPtokens], playerVariables[playerid][pRags]
        , playerVariables[playerid][pCarEngineStatua], playerVariables[playerid][fuel]);



Re: Mysql input line to long help - Faisal_khan - 15.12.2012

You can use \ too instead of strcat.

EDIT:
NVM late post .


Re: Mysql input line to long help - ikey07 - 15.12.2012

Just dont forget to escape strings

mysql_real_escape_string();


Re: Mysql input line to long help - arko123 - 15.12.2012

Quote:
Originally Posted by Dwane
View Post
lol, you've got a typing mistake there!

pawn Code:
// --
        new saveQuery2[200];
        format(saveQuery, sizeof(saveQuery), "%s, playerPhoneBook = '%d', playerGroup = '%d', playerGroupRank = '%d', playerIP = '%s', playerDropCarTimeout = '%d', \
        playerHotwireTime = '%d', playerRope = '%d', playerVehicleParts = '%d', playerScrewDriver = '%d', playerGasCan = '%d', playerSprayCan = '%d', \
        playerToolKit= '%d', playerIdentification = '%d',playerAdminDuty = '%d', playerCrimes = '%d', playerArrests = '%d', playerWarrants = '%d', playerAge = '%d', \
        playerVIPtokens = '%d',  playerRags = '%d', playerCarEngineStatus = '%d', playerFuel = '%d'"

        , saveQuery, playerVariables[playerid][pPhoneBook], playerVariables[playerid][pGroup]
        , playerVariables[playerid][pGroupRank], playerVariables[playerid][pConnectionIP]
        , playerVariables[playerid][pDropCarTimeout], playerVariables[playerid][pHotwireTime]
        , playerVariables[playerid][pRope], playerVariables[playerid][pVehicleParts]
        , playerVariables[playerid][pScrewDriver], playerVariables[playerid][pGasCan]
        , playerVariables[playerid][pSprayCan], playerVariables[playerid][pToolKit]
        , playerVariables[playerid][pIdentification], playerVariables[playerid][pAdminDuty]
        , playerVariables[playerid][pCrimes], playerVariables[playerid][pArrests]
        , playerVariables[playerid][pWarrants], playerVariables[playerid][pAge]
        , playerVariables[playerid][pVIPtokens], playerVariables[playerid][pRags]
        , playerVariables[playerid][pCarEngineStatua], playerVariables[playerid][fuel]);
I still get the same errors when I use this


Re: Mysql input line to long help - Faisal_khan - 15.12.2012

Add more "\" then:
pawn Code:
"%s, playerPhoneBook = '%d',\ playerGroup = '%d',\ playerGroupRank = '%d',\ playerIP = '%s', playerDropCarTimeout = '%d', \
        playerHotwireTime = '%d',\ playerRope = '%d',\ playerVehicleParts = '%d',\ playerScrewDriver = '%d',\ playerGasCan = '%d',\ playerSprayCan = '%d', \
        playerToolKit= '%d',\ playerIdentification = '%d',\ playerAdminDuty = '%d', \playerCrimes = '%d',\ playerArrests = '%d',\ playerWarrants = '%d',\ playerAge = '%d', \
        playerVIPtokens = '%d',\ playerRags = '%d',\ playerCarEngineStatus = '%d',\ playerFuel = '%d'"
Hope this might work.


Re: Mysql input line to long help - arko123 - 15.12.2012

Quote:
Originally Posted by [HiC]TheKiller
View Post
You're going to have to use multiple formats so that it does not exceed the max line length.

pawn Code:
new saveQuery2[200];
        format(saveQuery, sizeof(saveQuery), "%s, playerPhoneBook = '%d', playerGroup = '%d', playerGroupRank = '%d', playerIP = '%s', playerDropCarTimeout = '%d', playerHotwireTime = '%d', playerRope = '%d', playerVehicleParts = '%d', playerScrewDriver = '%d', playerGasCan = '%d', playerSprayCan = '%d', playerToolKit= '%d'"
        , saveQuery, playerVariables[playerid][pPhoneBook], playerVariables[playerid][pGroup]
        , playerVariables[playerid][pGroupRank], playerVariables[playerid][pConnectionIP]
        , playerVariables[playerid][pDropCarTimeout], playerVariables[playerid][pHotwireTime]
        , playerVariables[playerid][pRope], playerVariables[playerid][pVehicleParts]
        , playerVariables[playerid][pScrewDriver], playerVariables[playerid][pGasCan]
        , playerVariables[playerid][pSprayCan], playerVariables[playerid][pToolKit]);


        format(saveQuery, sizeof(saveQuery), "%s, playerIdentification = '%d',playerAdminDuty = '%d', playerCrimes = '%d', playerArrests = '%d', playerWarrants = '%d', playerAge = '%d', playerVIPtokens = '%d',  playerRags = '%d', playerCarEngineStatus = '%d', playerFuel = '%d'"
        , saveQuery
        , playerVariables[playerid][pIdentification], playerVariables[playerid][pAdminDuty]
        , playerVariables[playerid][pCrimes], playerVariables[playerid][pArrests]
        , playerVariables[playerid][pWarrants], playerVariables[playerid][pAge]
        , playerVariables[playerid][pVIPtokens], playerVariables[playerid][pRags]
        , playerVariables[playerid][pCarEngineStatua], playerVariables[playerid][fuel]);
Thanks man this work for me


Re: Mysql input line to long help - Konstantinos - 15.12.2012

It sometimes happens, when the line is extremely long. I remember I made a register part with SQL and even if I used "\", it gave errors, but it's rarely.
Then, use strcat, because format into format is slow.