Changes

Jump to navigation Jump to search
18 bytes removed ,  12:49, 8 July 2020
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 , which is statically bound to the query prolog:<pre class="brush:xquery">import module namespace {{Code|sessions = "http://basex}} prefix.org/modules/sessions";...</pre>
* If any of the functions is called outside the servlet context, <code>[[XQuery Errors#BaseX Errors|basex:http]]</code> is raised.
* If the requested 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-deterministic''. This means that the functions As a result, some query optimizations will not be reordered by the compilersuppressed.
=Functions=
|-
| '''Summary'''
|Returns the names of all variables attributes bound to the session specified by {{Mono|$id}}.
|}
|-
| width='120' | '''Signatures'''
|{{Func|sessions:get|$id as xs:string, $key name as xs:string|item()*}}<br/>{{Func|sessions:get|$id as xs:string, $key name as xs:string, $default as item()*|item()*}}
|-
| '''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 {{Code|$default}} value is will be returned instead.|-| '''Errors'''|{{Error|get|#Errors}} the value of a session variable could not be retrieved.
|}
|-
| width='120' | '''Signatures'''
|{{Func|sessions:set|$id as xs:string, $key name as xs:string, $value as item()*|empty-sequence()}}
|-
| '''Summary'''
|Binds Returns the specified key/{{Code|value pair }} to the attribute with the specified {{Code|$name}} from the session with the specified by {{Mono|$id}}.
|-
| '''Errors'''
|-
| width='120' | '''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}}.
|}
! width="110"|Code
|Description
|-
|{{Code|get}}
|The stored attribute is no XQuery value.
|-
|{{Code|set}}
|The supplied value cannot be materializedstored.
|-
|{{Code|not-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.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu