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.
| Function | Return type | Description | Example | Result |
|---|---|---|---|---|
getanchor(url) | varchar | extract the anchor part (after the #) from the url, may return null if no anchor exists | SELECT getanchor( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | example |
getbasename(url) | varchar | extract the base name part (after the / excluding the extension) from the path of the url, may return null | SELECT getbasename( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | Abc |
getcontext(url) | varchar | extract the path context part of the url | SELECT getcontext( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | /Doc/Abc.html |
getdomain(url) | varchar | extract the top-level domain part of the host part of the url, may return null | SELECT getdomain( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | org |
getextension(url) | varchar | extract the file extension part of the url, may return null | SELECT getextension( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | html |
getfile(url) | varchar | extract the last file part of the path of the url, may return null | SELECT getfile( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | Abc.html |
gethost(url) | varchar | extract the host part of the url, may return null | SELECT gethost( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | www\.monetdb.org |
getport(url) | varchar | extract the port number part of the url, may return null | SELECT getport( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | 458 |
getprotocol(url) | varchar | extract the protocol or scheme part of the url | SELECT getprotocol( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | https |
getquery(url) | varchar | extract the query part (after the ?) of the url, may return null | SELECT getquery( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | lang=nl&sort=asc |
getroboturl(url) | varchar | extract the location of the robot control file of the url | SELECT getroboturl( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | https://me:pw@www.monetdb .org:458/robots.txt |
getuser(url) | varchar | extract the user part of the url, may return null | SELECT getuser( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | me |
isaurl(string) | boolean | checks whether a character string complies to the url syntax format | SELECT isaurl( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' ); | true |
newurl(scheme, authority, path) | url | create a new url from three strings: scheme, authority or host and path | SELECT newurl( 'https', 'usr:pw@www.a.com:123', 'docs/index.html'); | https://usr:pw@www.a.com: 123/docs/index.html |
newurl(scheme, host, int port, path) | url | create a new url from three strings and a port number as third argument | SELECT newurl( 'https', 'www.a.com', 5567, 'docs/index.html'); | https://www.a.com: 5567/docs/index.html |
url_extract_host( url string, no_www bool) | varchar | extract the host part of the url, may return null | SELECT url_extract_host( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example', true); | monetdb.org |