Public Member Functions
DynamicContext Class Reference

Instances of the class DynamicContext contain the information that is available at the time the query is executed. More...

List of all members.

Public Member Functions

 DynamicContext ()
 DynamicContext (const DynamicContext &aCtx)
 DynamicContext (zorba::DynamicContext *aCtx)
bool getContextItem (Item &aItem)
Item getCurrentDateTime ()
 Retrieve the dateTime Item used at the time the query is executed (see setCurrentDateTime()).
Item getDefaultCollection ()
 Return the value of the default collection that is used when calling the fn:collection function without a parameter.
int getImplicitTimezone ()
 Retrieve the implicit timezone used in comparisons or arithmetic operations of date, time, or dateTime values.
bool getVariable (const std::string &aNamespace, const std::string &aLocalname, Item &aItem, Iterator &aIterator)
 Returns the current value of an external variable.
bool setContextItem (Item &aItem)
 Defines the context item.
bool setCurrentDateTime (Item &aDateTimeItem)
 Defines the value of the current date time that can be accessed by the fn:current-dateTime() function at the time the query is executed.
bool setDefaultCollection (Item &aCollectionUri)
 Defines the value of the default collection that is used when calling the fn:collection function without a parameter.
bool setImplicitTimezone (int aTimezone)
 Defines the variable of the implicit timezone to be used when a date, time, or dateTime value that does not have a timezone is used in a comparison or arithmetic operation.
bool setVariable (const std::string &aNamespace, const std::string &aLocalname, Iterator &aIter)
 Defines the external variable identified by an expanded QName and assigns it the sequence that is returned by evaluating aIterator.
bool setVariable (const std::string &aQName, Item &aItem)
 Defines the external variable identified by aQName and assigns it the value of aItem.
bool setVariable (const std::string &aQName, Iterator &aIterator)
 Defines the external variable identified by aQName and assigns it the sequence that is returned by evaluating aIterator.

Detailed Description

Instances of the class DynamicContext contain the information that is available at the time the query is executed.

The class contains the information that is defined in the XQuery specification (see http://www.w3.org/TR/xquery/#eval_context).

A dynamic context always belongs to a particular query and, hence, can be retrieved by calling getDynamicContext on a compiled query (see XQuery::getDynamicContext()).

Definition at line 29 of file DynamicContext.h.


Constructor & Destructor Documentation

DynamicContext::DynamicContext ( )
inline

Definition at line 35 of file DynamicContext.h.

DynamicContext::DynamicContext ( const DynamicContext aCtx)
inline

Definition at line 36 of file DynamicContext.h.

DynamicContext::DynamicContext ( zorba::DynamicContext *  aCtx)
inline

Definition at line 37 of file DynamicContext.h.


Member Function Documentation

bool DynamicContext::getContextItem ( Item aItem)
Item DynamicContext::getCurrentDateTime ( )

Retrieve the dateTime Item used at the time the query is executed (see setCurrentDateTime()).

Returns:
Item the dateTime Item used at the time the query is executed.
Item DynamicContext::getDefaultCollection ( )

Return the value of the default collection that is used when calling the fn:collection function without a parameter.

Returns:
Item the default collection that is set in this dynamic context.
Exceptions:
ZorbaExceptionif an error occured.
int DynamicContext::getImplicitTimezone ( )

Retrieve the implicit timezone used in comparisons or arithmetic operations of date, time, or dateTime values.

Returns:
int the implicit timezone. Note that 0 is returned if an error occured and an DiagnosticHandler is used.
Exceptions:
ZorbaExceptionif an error occured.
bool DynamicContext::getVariable ( const std::string &  aNamespace,
const std::string &  aLocalname,
Item aItem,
Iterator aIterator 
)

Returns the current value of an external variable.

Exactly one of the two return values (aItem or aIterator) will be non-null; that is, have isNull() == false.

The named external variable may be located in the main query or in any modules imported directly or indirectly by the query.

Parameters:
aNamespacethe namespace URI of the variable's expanded QName
aLocalnamethe local name of the variable's expanded QName
aIteman Item representing the current (single-item) value of the external variable.
aIteratoran Iterator representing the current (possibly multi-item) value of the external variable.
Returns:
true if the variable has been retrieved successfully, false otherwise.
Exceptions:
ZorbaExceptionif an error occured.
bool DynamicContext::setContextItem ( Item aItem)

Defines the context item.

Parameters:
aItemthe Item that is used as value for the context item.
Returns:
true if the context item was set, false otherwise.
Exceptions:
ZorbaExceptionif an error occured (e.g. the given Item is not valid).
bool DynamicContext::setCurrentDateTime ( Item aDateTimeItem)

Defines the value of the current date time that can be accessed by the fn:current-dateTime() function at the time the query is executed.

If the current date time has not been set explicitly the value of the date and time is used at the time the query is created or cloned, respectively.

Parameters:
aDateTimeItemthe dateTime Item.
Returns:
true if the variable has been set successfully, false otherwise.
Exceptions:
ZorbaExceptionif an error occured (e.g. the given Item is invalid or not a Item of type dateTime)
bool DynamicContext::setDefaultCollection ( Item aCollectionUri)

Defines the value of the default collection that is used when calling the fn:collection function without a parameter.

Parameters:
aCollectionUrithe URI of the collection used by the fn:collection function.
Returns:
true if the default collection has been set successfully, false otherwise.
Exceptions:
ZorbaExceptionif an error occured.
bool DynamicContext::setImplicitTimezone ( int  aTimezone)

Defines the variable of the implicit timezone to be used when a date, time, or dateTime value that does not have a timezone is used in a comparison or arithmetic operation.

Parameters:
aTimezonethe implicit timezone as int that should be used.
Returns:
true if the implicit timezone has been set successfully, false otherwise.
Exceptions:
ZorbaExceptionif an error occured.
bool DynamicContext::setVariable ( const std::string &  aNamespace,
const std::string &  aLocalname,
Iterator aIter 
)

Defines the external variable identified by an expanded QName and assigns it the sequence that is returned by evaluating aIterator.

The named external variable may be located in the main query or in any modules imported directly or indirectly by the query.

Parameters:
aNamespacethe namespace URI of the variable's expanded QName
aLocalnamethe local name of the variable's expanded QName
aIterthe Iterator producing the sequence that is assigned to the variable.
Returns:
true if the variable has been set successfully, false otherwise.
Exceptions:
ZorbaExceptionif an error occured (e.g. the given Iterator is not valid).
bool DynamicContext::setVariable ( const std::string &  aQName,
Item aItem 
)

Defines the external variable identified by aQName and assigns it the value of aItem.

aQName may be in one of two forms: A lexical QName (eg. "ns:foo"), or a James Clark-style universal name (eg. "{nsuri}:foo"). If it is a universal name, then this method will find the named external variable in the main query or in any modules imported directly or indirectly by the query. If it is a lexical QName, then it is only possible to resolve the prefix in the the context of the main query, hence only external variables in the main query or those in directly-imported modules may be bound.

Parameters:
aQNamethe QName that identifies the external variable.
aItemthe Item that is used as value for the variable.
Returns:
true if the variable has been set, false otherwise.
Exceptions:
ZorbaExceptionif an error occured (e.g. the given Item is not valid).
bool DynamicContext::setVariable ( const std::string &  aQName,
Iterator aIterator 
)

Defines the external variable identified by aQName and assigns it the sequence that is returned by evaluating aIterator.

aQName may be in one of two forms: A lexical QName (eg. "ns:foo"), or a James Clark-style universal name (eg. "{nsuri}:foo"). If it is a universal name, then this method will find the named external variable in the main query or in any modules imported directly or indirectly by the query. If it is a lexical QName, then it is only possible to resolve the prefix in the the context of the main query, hence only external variables in the main query or those in directly-imported modules may be bound.

Parameters:
aQNamethe QName that identifies the external variable.
aIteratorthe Iterator producing the sequence that is assigned to the variable.
Returns:
true if the variable has been set successfully, false otherwise.
Exceptions:
ZorbaExceptionif an error occured (e.g. the given Iterator is not valid).

The documentation for this class was generated from the following file:
blog comments powered by Disqus