diff options
Diffstat (limited to 'example/url.sql')
-rw-r--r-- | example/url.sql | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/example/url.sql b/example/url.sql new file mode 100644 index 0000000..813917e --- /dev/null +++ b/example/url.sql @@ -0,0 +1,19 @@ +SELECT load_extension('./url'); + +-- invoke the url function to get any url by it's elements +select scheme, user, password, host , port, path, query, fragment, "url" + from url('ws://echo.example.com/?name=boost&thingy=foo&name=sqlite&#demo'); + +-- table-ize the segments of url +select idx, segment from segments('/foo/bar/foo/xyz'); + +-- tag::query[] +-- table-ize the query of url +select * from query('name=boost&thingy=foo&name=sqlite&foo'); +select * from query where query_string = 'name=boost&thingy=foo&name=sqlite&foo'; +-- end::query[] + +-- do a left join on the table, so we can use the table function to normalize data. +select host , query.name, query.value +from url('ws://echo.example.com/?name=boost&thingy=foo&name=sqlite#demo') left join query on query.query_string = url.query; + |