Skip to content

Commit 925f54f

Browse files
committed
POST /sql to execute sql query
1 parent 071afa6 commit 925f54f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

SQLKPI/REST.cls.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<XMLNamespace>http://www.intersystems.com/urlmap</XMLNamespace>
99
<Data><![CDATA[
1010
<Routes>
11+
<Route Url="/sql" Method="POST" Call="executeSQL"/>
12+
<Route Url="/kpi" Method="POST" Call="generateKPI"/>
1113
<Route Url="/logout" Method="GET" Call="logout"/>
1214
<Route Url="/test" Method="GET" Call="test"/>
1315
</Routes>
@@ -37,5 +39,20 @@ Test</Description>
3739
return $$$OK
3840
]]></Implementation>
3941
</Method>
42+
43+
<Method name="executeSQL">
44+
<ClassMethod>1</ClassMethod>
45+
<FormalSpec>sql:%String</FormalSpec>
46+
<ReturnType>%Status</ReturnType>
47+
<Implementation><![CDATA[
48+
#dim sc As %Status = $$$OK
49+
set provider = ##class(%ZEN.Auxiliary.altJSONSQLProvider).%New()
50+
set provider.maxRows = $$$MaxCacheInt
51+
set provider.%Format = "tw"
52+
set provider.sql = %request.Content.SQL
53+
set sc = provider.%DrawJSON()
54+
return sc
55+
]]></Implementation>
56+
</Method>
4057
</Class>
4158
</Export>

0 commit comments

Comments
 (0)