MySQL Input line too long
#1

How can I possibly split this code in two to make it shorter? I'm getting this error,
Код:
C:\Users\Test\Desktop\roleplay.pwn(8228) : error 075: input line too long (after substitutions)
C:\Users\Test\Desktop\roleplay.pwn(8229) : error 037: invalid string (possibly non-terminated string)
C:\Users\Test\Desktop\roleplay.pwn(8229) : error 017: undefined symbol "UPDATE"
C:\Users\Test\Desktop\roleplay.pwn(8229) : error 029: invalid expression, assumed zero
C:\Users\Test\Desktop\roleplay.pwn(8229) : fatal error 107: too many error messages on one line
Код:
	format(query, sizeof(query), "UPDATE `companies` SET `companyName` = '%s', `companyColor` = '%d', `companyType` = '%d', `companyRanks` = '%d', `companyInformationX` = '%.4f', `companyInformationY` = '%.4f', `companyInformationZ` = '%.4f', `companyInformationInt` = '%d', `companyInformationWorld` = '%d', `companyPurchaseX` = '%.4f', `companyPurchaseY` = '%.4f', `companyPurchaseZ` = '%.4f', `companyPurchaseInt` = '%d', `companyPurchaseWorld` = '%d', `SpawnX` = '%f', `SpawnY` = '%f', `SpawnZ` = '%f', `SpawnInterior` = '%d', `SpawnVW` = '%d'",
		SQL_ReturnEscaped(CompanyData[companyid][companyName]),
		CompanyData[companyid][companyColor],
		CompanyData[companyid][companyType],
		CompanyData[companyid][companyRanks],
		CompanyData[companyid][companyInformationPos][0],
		CompanyData[companyid][companyInformationPos][1],
    	CompanyData[companyid][companyInformationPos][2],
		CompanyData[companyid][companyInformationInt],
		CompanyData[companyid][companyInformationWorld],
		CompanyData[companyid][companyPurchasePos][0],
		CompanyData[companyid][companyPurchasePos][1],
    	CompanyData[companyid][companyPurchasePos][2],
		CompanyData[companyid][companyPurchaseInt],
		CompanyData[companyid][companyPurchaseWorld],
Reply
#2

Hello!

You have to do that like this:
PHP код:
format(query,sizeof query,"UPDATE `companies` SET `companyName`='%s',`companyColor`=%d,`companyType`=%d,`companyRanks`=%d,`companyInformationX`=%.4f,",
SQL_RetrunEscaped(CompanyData[companyid][companyName]),CompanyData[companyid][companyColor],CompanyData[companyid][companyType],CompanyData[companyid][companyRanks],
CompanyData[companyid][companyInformationPos][0]);
format(query,sizeof query,"%s`companyInformationY`=%.4f,`companyInformationZ`=%.4f,//and so on",
query,CompanyData[companyid][CompanyInformationPos][1
It is an example so you have to complete this.


- Mencent
Reply
#3

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

You have to do that like this:
PHP код:
format(query,sizeof query,"UPDATE `companies` SET `companyName`='%s',`companyColor`=%d,`companyType`=%d,`companyRanks`=%d,`companyInformationX`=%.4f,",
SQL_RetrunEscaped(CompanyData[companyid][companyName]),CompanyData[companyid][companyColor],CompanyData[companyid][companyType],CompanyData[companyid][companyRanks],
CompanyData[companyid][companyInformationPos][0]);
format(query,sizeof query,"%s`companyInformationY`=%.4f,`companyInformationZ`=%.4f,//and so on",
query,CompanyData[companyid][CompanyInformationPos][1
It is an example so you have to complete this.


- Mencent
For some reason I'm getting this error now,
Код:
C:\Users\Test\Desktop\roleplay.pwn(8229 -- 8254) : error 001: expected token: ",", but found ";"
This is line 8229 - 8254
Код:
Company_Save(companyid)
{
	format(query, sizeof(query), "UPDATE `companies` SET `companyName` = '%s', `companyColor` = '%d', `companyType` = '%d', `companyRanks` = '%d',",
		SQL_ReturnEscaped(CompanyData[companyid][companyName]),
		CompanyData[companyid][companyColor],
		CompanyData[companyid][companyType],
		CompanyData[companyid][companyRanks],
	format(query, sizeof(query), "%s `companyInformationX` = '%.4f', `companyInformationY` = '%.4f', `companyInformationZ` = '%.4f', \
    `companyInformationInt` = '%d', `companyInformationWorld` = '%d',",
		CompanyData[companyid][companyInformationPos][0],
		CompanyData[companyid][companyInformationPos][1],
    	CompanyData[companyid][companyInformationPos][2],
		CompanyData[companyid][companyInformationInt],
		CompanyData[companyid][companyInformationWorld],
	format(query, sizeof(query), "%s `companyPurchaseX` = '%.4f', `companyPurchaseY` = '%.4f', `companyPurchaseZ` = '%.4f', \
	`companyPurchaseInt` = '%d', `companyPurchaseWorld` = '%d',",
		CompanyData[companyid][companyPurchasePos][0],
		CompanyData[companyid][companyPurchasePos][1],
    	CompanyData[companyid][companyPurchasePos][2],
		CompanyData[companyid][companyPurchaseInt],
		CompanyData[companyid][companyPurchaseWorld],
	format(query, sizeof(query), "%s `SpawnX` = '%f', `SpawnY` = '%f', `SpawnZ` = '%f', `SpawnInterior` = '%d', `SpawnVW` = '%d',",
		CompanyData[companyid][SpawnX],
		CompanyData[companyid][SpawnY],
	    CompanyData[companyid][SpawnZ],
    	CompanyData[companyid][SpawnInterior],
		CompanyData[companyid][SpawnVW]
	);
Reply
#4

Fixed..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)