Page 1 of 1

API Express Cutom Query

Posted: Fri Feb 23, 2018 3:05 pm
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.


API Express Cutom Query

Posted: Mon Feb 26, 2018 3:38 pm
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


API Express Cutom Query

Posted: Tue Feb 27, 2018 10:16 pm
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.


API Express Cutom Query

Posted: Sat Mar 03, 2018 9:54 am
by Evgene Karachevtsev

Hello Bernie,

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


API Express Cutom Query

Posted: Wed Mar 07, 2018 9:05 pm
by Bernie

Thanks, I solved it by creating a stored procedure.

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