Changes

Jump to navigation Jump to search
74 bytes removed ,  14:52, 31 October 2023
no edit summary
=Conventions=
* The module will be available if the {{Code|basex-api}} package must be included library is found in the classpath. This is always the case if you use one of the complete distributions of BaseX (zip, exe, war) of BaseX.* All functions and errors are assigned to of the <code><nowiki>http://basex.org/modules/sessions</nowiki></code> namespace. The module must be imported in the query prolog:<pre class="brush:xquery">import module namespace sessions = "http://basex.org/modules/sessions";...</pre>* In this documentation, the namespace which is statically bound to the {{Code|sessions}} prefix.* Errors are assigned to If any of the functions is called outside the servlet context, <code><nowiki>[[XQuery Errors#BaseX Errors|basex:http://basex.org/errors</nowiki>]]</code> namespace, which is statically bound to the {{Code|bxerr}} prefixraised.* If any of the functions a specified session id is called outside the servlet contextnot found, the error {{Error|BXSE0003|<code>[[#Errors}} |not-found]]</code> is raised.* As sessions are side-effecting operations, all functions are flagged as ''non-deterministicnondeterministic''. This means that the functions As a result, some query optimizations will not be reordered by the compilersuppressed.
=Functions=
==sessions:ids==
 
{| 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.
==sessions:created==
 
{| 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}}.
==sessions:accessed==
 
{| 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}}.
==sessions:names==
 
{| 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 variables attributes bound to the session specified by {{Mono|$id}}.
|}
{| width='100%'
|-valign="top"| width='120' | '''SignaturesSignature'''|{{Func|sessions:get|$id as xs:string, $key as xs:string|item()*}}<br/pre>{{Func|sessions:get|( $id as xs:string, $key name as xs:string, $default as item()*| := ()) as item()*}}</pre>|-valign="top"
| '''Summary'''
|Returns the value of a variable bound to an attribute with the specified {{Code|$name}} from the session with the specified by {{Mono|$id}}. If the variable does not exist, or if the key attribute is unknown, an empty sequence or the optionally specified default value is returned instead.|-| '''Errors'''|{{ErrorCode|BXSE0002|#Errors$default}} the value of a session variable could not will be retrievedreturned instead.
|}
{| width='100%'
|-valign="top"| width='120' | '''SignaturesSignature'''|{{Func|<pre>sessions:set|( $id as xs:string, $key name as xs:string, $value as item()*|) as empty-sequence()}}</pre>|-valign="top"
| '''Summary'''
|Binds Returns the specified key/{{Code|value pair }} to the session attribute with the specified by {{MonoCode|$idname}}.|-| '''Errors'''|from the session with the specified {{ErrorMono|BXSE0001|#Errors$id}} a function item was specified as value of a session variable.
|}
{| width='100%'
|-valign="top"| width='120' | '''SignaturesSignature'''|{{Func|<pre>sessions:delete|( $id as xs:string, $key name as xs:string|) as empty-sequence()}}</pre>|-valign="top"
| '''Summary'''
|Deletes a variable bound to an attribute with the specified {{Code|$name}} from the session with the specified by {{Mono|$id}}.
|}
==sessions:close==
 
{| 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|BXSE0001}}|A function item was specified as value of a session attribute.|not-|{{Code|BXSE0002}}|An error occurred while retrieving the value of a session attribute.|-|{{Code|BXSE0003}}|A function was called outside the servlet context.|-|{{Code|BXSE0004found}}|The specified session was is not foundavailable.
|}
=Changelog=
 
;Version 9.3
* Updated: {{Function||sessions:get}}: Values that have no XQuery type will be returned as strings.
 
;Version 9.0
* Updated: error codes updated; errors now use the module namespace
;Version 8.4
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu