Changes

Jump to navigation Jump to search
258 bytes added ,  14:52, 31 October 2023
no edit summary
* If any of the functions is called outside the servlet context, <code>[[XQuery Errors#BaseX Errors|basex:http]]</code> is raised.
* If a specified session id is not found, <code>[[#Errors|not-found]]</code> is raised.
* As sessions are side-effecting operations, all functions are flagged as ''non-deterministicnondeterministic''. As a result, some query optimizations will be suppressed.
=Functions=
{| width='100%'
|-valign="top"| width='120' | '''SignaturesSignature'''|{{Func|<pre>sessions:ids||() as xs:string*}}</pre>|-valign="top"
| '''Summary'''
|Returns the IDs of all registered sessions.
{| width='100%'
|-valign="top"| width='120' | '''SignaturesSignature'''|{{Func|<pre>sessions:created|( $id as xs:string|) as xs:dateTime}}</pre>|-valign="top"
| '''Summary'''
|Returns the creation time of the session specified by {{Mono|$id}}.
{| width='100%'
|-valign="top"| width='120' | '''SignaturesSignature'''|{{Func|<pre>sessions:accessed|( $id as xs:string|) as xs:dateTime}}</pre>|-valign="top"
| '''Summary'''
|Returns the last access time of the session specified by {{Mono|$id}}.
{| width='100%'
|-valign="top"| width='120' | '''SignaturesSignature'''|{{Func|<pre>sessions:names|( $id as xs:string|) as xs:string*}}</pre>|-valign="top"
| '''Summary'''
|Returns the names of all attributes bound to the session specified by {{Mono|$id}}.
{| width='100%'
|-valign="top"| width='120' | '''SignaturesSignature'''|{{Func|sessions:get|$id as xs:string, $name as xs:string|item()*}}<br/pre>{{Func|sessions:get|( $id as xs:string, $name as xs:string, $default as item()*| := ()) as item()*}}</pre>|-valign="top"
| '''Summary'''
|Returns the value of an attribute with the specified {{Code|$name}} from the session with the specified {{Mono|$id}}. If the attribute is unknown, an empty sequence or the optionally specified {{Code|$default}} value will be returned instead.
{| width='100%'
|-valign="top"| width='120' | '''SignaturesSignature'''|{{Func|<pre>sessions:set|( $id as xs:string, $name as xs:string, $value as item()*|) as empty-sequence()}}</pre>|-valign="top"
| '''Summary'''
|Returns the specified {{Code|value}} to the attribute with the specified {{Code|$name}} from the session with the specified {{Mono|$id}}.
{| width='100%'
|-valign="top"| width='120' | '''SignaturesSignature'''|{{Func|<pre>sessions:delete|( $id as xs:string, $name as xs:string|) as empty-sequence()}}</pre>|-valign="top"
| '''Summary'''
|Deletes an attribute with the specified {{Code|$name}} from the session with the specified {{Mono|$id}}.
{| width='100%'
|-valign="top"| width='120' | '''SignaturesSignature'''|{{Func|<pre>sessions:close|( $id as xs:string|) as empty-sequence()}}</pre>|-valign="top"
| '''Summary'''
|Unregisters the session specified by {{Mono|$id}}.
! width="110"|Code
|Description
|-valign="top"
|{{Code|not-found}}
|The specified session is not available.
;Version 9.3
* Updated: [[#sessions:get{{Function||sessions:get]]}}: Values that have no XQuery type will be returned as strings.
;Version 9.0
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu