forked from yql/yql-tables
-
Notifications
You must be signed in to change notification settings - Fork 30
/
query.multi.xml
35 lines (35 loc) · 1.15 KB
/
query.multi.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?xml version="1.0" encoding="UTF-8" ?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<sampleQuery>select * from {table} where queries="show tables;select * from feed where url='http://www.javarants.com/rss'"</sampleQuery>
<description>
Execute multiple unrelated queries in a single query. They will be returned in an array of query.
You can post the key if they are long by using @ variables. Separate them with a ;
</description>
</meta>
<bindings>
<select itemPath="queries.results" produces="XML">
<urls>
<url></url>
</urls>
<inputs>
<key id="queries" type="xs:string" paramType="variable" required="true" />
</inputs>
<execute><![CDATA[
var queryarray = queries.split(";");
var result = new Array(queryarray.length);
for (var i in queryarray) {
var query = queryarray[i].replace(/^ +| +$/g, "");
if (query != "") {
result[i] = y.query(query);
}
}
var querieselement = <queries/>;
for (var i in result) {
querieselement.query += result[i].results;
}
response.object = querieselement;
]]></execute>
</select>
</bindings>
</table>