Changes

Jump to navigation Jump to search
3,239 bytes added ,  01:19, 26 September 2012
Created page with "This XQuery Module can only be called from users with ''Admin'' permissions. It contains functions for accessing and modifying all registered server-side sessi..."
This [[Module Library|XQuery Module]] can only be called from users with ''Admin'' permissions. It contains functions for accessing and modifying all registered server-side sessions. This module is mainly useful in the context of [[Web Application]]s.

=Conventions=

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 will not be influenced by the compiler.

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|sessions}} prefix. Errors are assigned to the {{Code|http://basex.org/errors}} namespace, which is statically bound to the {{Code|bxerr}} prefix.

If the module is called outside the servlet context, the error [[#BXSE0003|BXSE0003]] is raised. If a specified session is not found, [[#BXSE0004|BXSE0004]] is raised.

=Functions=

==sessions:id==
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|sessions:ids||xs:string}}
|-
| '''Summary'''
|Returns the IDs of all registered sessions.
|}

==sessions:names==
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|sessions:names|$id as xs:string|xs:string*}}
|-
| '''Summary'''
|Returns the names of all variables bound to the session specified by {{Mono|$id}}.
|}

==sessions:get==
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|sessions:get|$id as xs:string, $key as xs:string|xs:string?}}<br/>{{Func|sessions:get|$id as xs:string, $key as xs:string, $default as xs:string|xs:string}}
|-
| '''Summary'''
|Returns the value of a variable bound to the session specified by {{Mono|$id}}. If the variable does not exist, an empty sequence or the optionally specified default value is returned instead.
|-
| '''Errors'''
|{{Error|BXSE0002|#Errors}} the value of a session variable could not be retrieved.
|}

==sessions:set==
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|sessions:set|$id as xs:string, $key as xs:string, $value as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Assigns a value to a variable bound to the session specified by {{Mono|$id}}.
|-
| '''Errors'''
|{{Error|BXSE0001|#Errors}} a function item was specified as value of a session variable.
|}

==sessions:delete==
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|sessions:delete|$id as xs:string, $key as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Deletes a variable bound to the session specified by {{Mono|$id}}.
|}

==sessions:close==
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|sessions:close|$id as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Unregisters the session specified by {{Mono|$id}}.
|}

=Errors=

{| class="wikitable" width="100%"
! width="5%"|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|BXSE0003}}
|A function was called outside the servlet context.
|-
|{{Code|BXSE0004}}
|The specified session was not found.
|}

=Changelog=

This module was introduced with Version 7.5.

[[Category:XQuery]]
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu