Changes

Jump to navigation Jump to search
546 bytes added ,  12:49, 8 July 2020
no edit summary
=Conventions=
* The module will be available if the {{Code|basex-api}} library is found in the classpath. This is the case if you use one of the complete distributions of BaseX (zip, exe, war).* All functions and errors are assigned of the <code><nowiki>http://basex.org/modules/sessions</nowiki></code> namespace, which is statically bound to the {{Code|sessions}} prefix.* 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 in this module are flagged as ''non-deterministic''. This means that the evaluation order of the functions As a result, some query optimizations will not be influenced by the compilersuppressed.
All functions are assigned to the {{Code|http://basex.org/modules/sessions}} namespace, which must be dynamically imported. In this documentation, the namespace is bound to the {{Code|=Functions= ==sessions}} prefix. Errors are assigned to the {{Code|http://basex.org/errors}} namespace, which is statically bound to the {{Code|bxerr}} prefix.ids==
If {| width='100%'|-| width='120' | '''Signatures'''|{{Func|sessions:ids||xs:string*}}|-| '''Summary'''|Returns the module is called outside IDs of all registered sessions.|} ==sessions:created== {| width='100%'|-| width='120' | '''Signatures'''|{{Func|sessions:created|$id as xs:string|xs:dateTime}}|-| '''Summary'''|Returns the servlet context, creation time of the error [[#BXSE0003session specified by {{Mono|BXSE0003]] is raised$id}}. If a specified session is not found, [[#BXSE0004|BXSE0004]] is raised.}
=Functions=sessions:accessed==
==sessions:id==
{| width='100%'
|-
| width='90120' | '''Signatures'''|{{Func|sessions:idsaccessed|$id as xs:string|xs:stringdateTime}}
|-
| '''Summary'''
|Returns the IDs last access time of all registered sessionsthe session specified by {{Mono|$id}}.
|}
==sessions:names==
 
{| width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|sessions:names|$id as xs:string|xs:string*}}
|-
| '''Summary'''
|Returns the names of all variables attributes bound to the session specified by {{Mono|$id}}.
|}
==sessions:get==
 
{| width='100%'
|-
| width='90120' | '''Signatures'''|{{Func|sessions:get|$id as xs:string, $key name as xs:string|xs:string?item()*}}<br/>{{Func|sessions:get|$id as xs:string, $key name as xs:string, $default as xs:stringitem()*|xs:stringitem()*}}
|-
| '''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 existattribute 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.
|}
==sessions:set==
 
{| width='100%'
|-
| width='90120' | '''Signatures'''|{{Func|sessions:set|$id as xs:string, $key name as xs:string, $value as xs:stringitem()*|empty-sequence()}}
|-
| '''Summary'''
|Assigns a Returns the specified {{Code|value }} to a variable bound to the attribute with the specified {{Code|$name}} from the session with the specified by {{Mono|$id}}.
|-
| '''Errors'''
|{{Error|BXSE0001set|#Errors}} a function item was specified as The supplied value of a session variablecannot be materialized.
|}
==sessions:delete==
 
{| width='100%'
|-
| width='90120' | '''Signatures'''|{{Func|sessions:delete|$id as xs:string, $key name as xs:string|empty-sequence()}}
|-
| '''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%'
|-
| width='90120' | '''Signatures'''
|{{Func|sessions:close|$id as xs:string|empty-sequence()}}
|-
{| class="wikitable" width="100%"
! width="5%110"|Code! width="95%"|Description|-|{{Code|BXSE0001}}|A function item was specified as value of a session attribute.|-|{{Code|BXSE0002}}|An error occurred while retrieving the value of a session attribute.
|-
|{{Code|BXSE0003set}}|A function was called outside the servlet contextThe supplied value cannot be stored.
|-
|{{Code|BXSE0004not-found}}|The specified session was is not foundavailable.
|}
=Changelog=
 
;Version 9.3
* Updated: [[#sessions:get|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
* Updated: Allow sequences as session values.
This module was introduced with Version 7.5.
 
[[Category:XQuery]]
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu