SA-MP Forums Archive
Failing Query - R7 - 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: Failing Query - R7 (/showthread.php?tid=441209)



Failing Query - R7 - Riddy - 02.06.2013

Before R7, these queries worked.

Now, I get this:
Код:
[02:39:31] Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
[02:39:31] ErrorID: 1064
I really don't get what changed on the latest plugin to stop these long queries from working.
Код:
UPDATE `properties` SET X = `%f`, Y = `%f`, Z = `%f`, eX = `%f`, eY = `%f`, eZ = `%f`, Owner = %s, Description = %s, \
		Cost = %d, Hel = %d, Arm = %d, Int = %d, Lock = %d, Owned = %d, Rooms = %d, Rent = %d, Rentabil = %d, \
		Takings = %d, Date = %d, Level = %d, World = %d, OutWorld = %d, OutInt = %d, OTaken = %d, Clothes = %d, \
		Clothes2 = %d, Clothes3 = %d, Safe = %d, Radio = %d, Station = %d, TV = %d WHERE ID = %d
That is currently what I have for my query..


Re: Failing Query - R7 - GWMPT - 02.06.2013

Код:
UPDATE `properties` SET `X` = '%f', `Y` = '%f', `Z` = '%f', `eX` = '%f', `eY` = '%f', `eZ` = '%f', `Owner` = '%s', `Description` = '%s', \
		`Cost` = '%d', `Hel` = '%d', `Arm` = '%d', `Int` = '%d', `Lock` = '%d', `Owned` = '%d', `Rooms` = '%d', `Rent` = '%d', `Rentabil` = '%d', \
		`Takings` = '%d', `Date` = '%d', `Level` = '%d', `World` = '%d', `OutWorld` = '%d', `OutInt` = '%d', `OTaken` = '%d', `Clothes` = '%d', \
		`Clothes2` = '%d', `Clothes3` = '%d', `Safe` = '%d', `Radio` = '%d', `Station` = '%d' AND `TV` = '%d' WHERE `ID` = '%d'
Try that.


Re: Failing Query - R7 - Lorenc_ - 02.06.2013

Quote:
Originally Posted by Kikito
Посмотреть сообщение
Код:
UPDATE `properties` SET `X` = '%f', `Y` = '%f', `Z` = '%f', `eX` = '%f', `eY` = '%f', `eZ` = '%f', `Owner` = '%s', `Description` = '%s', \
		`Cost` = '%d', `Hel` = '%d', `Arm` = '%d', `Int` = '%d', `Lock` = '%d', `Owned` = '%d', `Rooms` = '%d', `Rent` = '%d', `Rentabil` = '%d', \
		`Takings` = '%d', `Date` = '%d', `Level` = '%d', `World` = '%d', `OutWorld` = '%d', `OutInt` = '%d', `OTaken` = '%d', `Clothes` = '%d', \
		`Clothes2` = '%d', `Clothes3` = '%d', `Safe` = '%d', `Radio` = '%d', `Station` = '%d' AND `TV` = '%d' WHERE `ID` = '%d'
Try that.
You only use single quotes on strings!!!!


Re: Failing Query - R7 - Scenario - 02.06.2013

You're using the graves incorrectly. Doing so can cause SQL errors.

pawn Код:
Y = `%f`
You're doing it the complete opposite way. It should be:

pawn Код:
`Y` = %f
However, you either have to surround each field (i.e. "Y") in graves, or just not use them at all. I like using them for clarity, but it's completely up to you as it's your code.


Re: Failing Query - R7 - Riddy - 02.06.2013

I've tried without graving (which is my normal way), still no difference. Why is that long queries fail to work. My saving for player accounts has similar coding, but it works fine...


Re: Failing Query - R7 - Scenario - 02.06.2013

Split the query up.


Re: Failing Query - R7 - Konstantinos - 02.06.2013

It's because the lenght of the string is not large enough to store it and it cuts it, so it will give syntax error.

By the way
pawn Код:
// An example about '':
"UPDATE `something` SET integer = %d, float = %f, string = '%s' WHERE ID = 0"



Re: Failing Query - R7 - IstuntmanI - 02.06.2013

Look into the mysql log and show us the final query.

Also, I recommend you to use MySQL R8 ****** Code.


Re: Failing Query - R7 - Scenario - 02.06.2013

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
Look into the mysql log and show us the final query.

Also, I recommend you to use MySQL R8 ****** Code.
R20 is much faster, but R8 is an improvement of course.


Re: Failing Query - R7 - Riddy - 02.06.2013

Quote:
Originally Posted by _Zeus
Посмотреть сообщение
It's because the lenght of the string is not large enough to store it and it cuts it, so it will give syntax error.

By the way
pawn Код:
// An example about '':
"UPDATE `something` SET integer = %d, float = %f, string = '%s' WHERE ID = 0"
Yep clumsy me.

I am using MySQL R7 REV 20

EDIT: Infact, that did not fix it. I'll ty RealCop's splitting input.