API Express Cutom Query

This forum contains topics that were moved from Get Satisfaction
Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

API Express Cutom Query

Post by Bernie »

Hi,

I want to perform the following custom query within API Express:

SELECT *
FROM [database].[dbo].[table]
where
Geometry::STGeomFromText('POLYGON((-115.2348 54.9285, -114.0511 54.9285, -114.0511 55.6325, -115.2348 55.6325, -115.2348 54.9285))',4326).STIntersects([Geometry])=1;

Unfortunately the syntax of creating a new instance of geometry (https://docs.microsoft.com/en-us/sql/...) gets interpreted as a SQL PARAMETER "STGeomFromText".

How can I avoid this? As far as I know I can't change or encodde that SQL syntax.

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

API Express Cutom Query

Post by Serhii Kulibaba »

Hello Bernie,

Unfortunately, this is outside the scope of our support. Please search online for an appropriate solution.

Appery.io API Express just sends the SQL request to your database

Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

API Express Cutom Query

Post by Bernie »

Hi Serhii,

Appery.io API Express does not simply send an SQL request to the database.
It is using and interpreting variables that are declared with a colon (:variable) at the beginning.

So asking whether this variable can be encoded or not should not be out of scope.
I am pretty sure that you guys are aware of certain special characters that are standard use within SQL.

With picking the colon character as the declaration character for a variable you didn't do your audience a big favor.
An alternative character that is not part of any standard SQL syntax would help to surpass the problem.

Please, think about that.

Thank you in advance.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

API Express Cutom Query

Post by Evgene Karachevtsev »

Hello Bernie,

Sorry for the delay. Unfortunately the only way here is to rewrity your query without colons.

Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

API Express Cutom Query

Post by Bernie »

Thanks, I solved it by creating a stored procedure.

The :: part is then handled directly within SQL server.

Post Reply