Changeset: 14fcabac5155 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=14fcabac5155
Added Files:
        sql/test/json/Tests/pathexpr.sql
Branch: default
Log Message:

Functional test for path expressions
to be finalised


diffs (33 lines):

diff --git a/sql/test/json/Tests/pathexpr.sql b/sql/test/json/Tests/pathexpr.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/json/Tests/pathexpr.sql
@@ -0,0 +1,28 @@
+create table jspath(js json);
+insert into jspath values('[{"book":{ "category": "reference", "author": 
"Nigel Rees", "title": "Sayings of the Century", "price": 8.95 }, "book":{ 
"category": "fiction", "author": "Evelyn Waugh", "title": "Sword of Honour", 
"price": 12.99 }, "book":{ "category": "fiction", "author": "Herman Melville", 
"title": "Moby Dick", "isbn": "0-553-21311-3", "price": 8.99 }, "book":{ 
"category": "fiction", "author": "J. R. R. Tolkien", "title": "The Lord of the 
Rings", "isbn": "0-395-19395-8", "price": 22.99 }, "pencil":{ "color": "red", 
"price": 19.95 }}]');
+
+select * from jspath;
+
+select json.filter(js,".book") from jspath;
+select json.filter(js,".pencil") from jspath;
+select json.filter(js,"pencil") from jspath;
+select json.filter(js,"..author") from jspath;
+select json.filter(js,"..category") from jspath;
+
+select json.filter(js,".book[0]") from jspath;
+select json.filter(js,".book[1]") from jspath;
+select json.filter(js,".book[2]") from jspath;
+select json.filter(js,".book[3]") from jspath;
+select json.filter(js,".book.category") from jspath;
+
+declare s json;
+set s = '[[{\"name\":\"john\"}], {\"name\":\"mary\"}]';
+select json.path(s,"..name");
+select  json.path(s,".name");
+
+select json.filter(js,".book[-1]") from jspath;
+select json.filter(js,".book[4]") from jspath;
+select json.filter(js,"$$$") from jspath;
+select json.filter(js,"...") from jspath;
+select json.filter(js,"[[2]]") from jspath;
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to