These functions apply to MonetDB SQL type: URL (Uniform Resource Locator). A URL string has a specific syntax, see URL syntax for valid URL string patterns.
For the examples below we use following url_example
string:
'https://me@www.monetdb.org:458/Doc/Abc.html?lang=nl&sort=asc#example'
to create the shown results.
Note: You must include the sys.
prefix for all these URL functions (see examples) in order to work properly from other schemas than sys.
Function | Return type | Description | Example | Result |
---|---|---|---|---|
sys.getanchor(url) | clob | extract the anchor part (after the #) from the url, may return null if no achor exists | sys.getanchor(url_example) | example |
sys.getbasename(url) | clob | extract the base name part (after the / excluding the extension) from the path of the url, may return null | sys.getbasename(url_example) | Abc |
sys.getcontext(url) | clob | extract the path context part of the url | sys.getcontext(url_example) | /Doc/Abc.html |
sys.getdomain(url) | clob | extract the top-level domain part of the host part of the url, may return null | sys.getdomain(url_example) | org |
sys.getextension(url) | clob | extract the file extension part of the url, may return null | sys.getextension(url_example) | html |
sys.getfile(url) | clob | extract the last file part of the path of the url, may return null | sys.getfile(url_example) | Abc.html |
sys.gethost(url) | clob | extract the host part of the url, may return null | sys.gethost(url_example) | www.monetdb.org |
sys.getport(url) | clob | extract the port number part of the url, may return null | sys.getport(url_example) | 458 |
sys.getprotocol(url) | clob | extract the protocol or scheme part of the url | sys.getprotocol(url_example) | https |
sys.getquery(url) | clob | extract the query part (after the ?) of the url, may return null | sys.getquery(url_example) | lang=nl&sort=asc |
sys.getroboturl(url) | clob | extract the location of the robot control file of the url | sys.getroboturl(url_example) | https://me@www.monetdb.org:458/robots.txt |
sys.getuser(url) | clob | extract the user part of the url, may return null | sys.getuser(url_example) | me |
sys.isaurl(string) | boolean | checks whether a character string complies to the url syntax format | sys.isaurl(url_example) | true |
sys.newurl(scheme, authority, path) | url | create a new url from three strings: scheme, authority or host and path | sys.newurl('https', 'usr@www.a.com:123', 'docs/index.html') | https://usr@www.a.com:123/docs/index.html |
sys.newurl(scheme, host, int port, path) | url | create a new url from three strings and a port number as third argument | sys.newurl('https', 'www.a.com', 5567, 'docs/index.html') | https://www.a.com:5567/docs/index.html |