zorba::DynamicContext Class Reference

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

#include <zorba/dynamic_context.h>

List of all members.

Public Member Functions

virtual Item getCurrentDateTime ()=0
 Retrieve the dateTime Item used at the time the query is executed (see setCurrentDateTime()).
virtual int getImplicitTimezone ()=0
 Retrieve the implicit timezone used in comparisons or arithmetic operations of date, time, or dateTime values.
virtual bool setContextItem (const Item &aItem)=0
 Defines the context item.
virtual bool setContextItemAsDocument (const String &aDocURI, std::istream &aDocStream)=0
 Defines the context item and assigns it the document that results from parsing the given input stream.
virtual bool setCurrentDateTime (const Item &aDateTimeItem)=0
 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.
virtual bool setDefaultCollection (const Item &aCollectionUri)=0
 Defines the value of the default collection that is when calling the fn:collection function without a parameter.
virtual bool setImplicitTimezone (int aTimezone)=0
 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.
virtual bool setVariable (const String &aQName, const ResultIterator_t &aResultIterator)=0
 Defines the external variable identifies by aQName and assigns it the sequence that is returned by evaluating aResultIterator.
virtual bool setVariable (const String &aQName, const Item &aItem)=0
 Defines the external variable identified by aQName and assigns it the value of aItem.
virtual bool setVariableAsDocument (const String &aQName, const String &aDocURI, std::istream &aDocStream)=0
 Defines the external variable identifies by aQName and assigns it the the document that results from reading and parsing the given istream.
virtual ~DynamicContext ()
 Destructor.


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()).

Examples:

context.cpp, and simple.cpp.

Definition at line 36 of file dynamic_context.h.


Constructor & Destructor Documentation

virtual zorba::DynamicContext::~DynamicContext (  )  [inline, virtual]

Destructor.

Definition at line 42 of file dynamic_context.h.


Member Function Documentation

virtual Item zorba::DynamicContext::getCurrentDateTime (  )  [pure virtual]

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.

virtual int zorba::DynamicContext::getImplicitTimezone (  )  [pure virtual]

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 ErrorHandler is used.
Exceptions:
ZorbaException if an error occured.

virtual bool zorba::DynamicContext::setContextItem ( const Item aItem  )  [pure virtual]

Defines the context item.

Parameters:
aItem the Item that is used as value for the context item.
Returns:
true if the context item was set, false otherwise.
Exceptions:
ZorbaException if an error occured (e.g. the given Item is not valid).
Examples:
context.cpp.

virtual bool zorba::DynamicContext::setContextItemAsDocument ( const String aDocURI,
std::istream &  aDocStream 
) [pure virtual]

Defines the context item and assigns it the document that results from parsing the given input stream.

Parameters:
aDocURI the URI that is used to reference the document in the XmlDataManager.
aDocStream the istream used to read the document from.
Exceptions:
ZorbaException if an error occured (e.g. the input document could not be parsed).
Examples:
context.cpp.

virtual bool zorba::DynamicContext::setCurrentDateTime ( const Item aDateTimeItem  )  [pure virtual]

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:
aDateTimeItem the dateTime Item.
Returns:
true if the variable has been set successfully, false otherwise.
Exceptions:
ZorbaException if an error occured (e.g. the given Item is invalid or not a Item of type dateTime
Examples:
context.cpp.

virtual bool zorba::DynamicContext::setDefaultCollection ( const Item aCollectionUri  )  [pure virtual]

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

Parameters:
aCollectionUri the URI of the collection used by the fn:collection function.
Returns:
true if the default collection has been set successfully, false otherwise.
Exceptions:
ZorbaException if an error occured.

virtual bool zorba::DynamicContext::setImplicitTimezone ( int  aTimezone  )  [pure virtual]

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:
aTimezone the implicit timezone as int that should be used.
Returns:
true if the implicit timezone has been set successfully, false otherwise.
Exceptions:
ZorbaException if an error occured.

virtual bool zorba::DynamicContext::setVariable ( const String aQName,
const ResultIterator_t aResultIterator 
) [pure virtual]

Defines the external variable identifies by aQName and assigns it the sequence that is returned by evaluating aResultIterator.

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

virtual bool zorba::DynamicContext::setVariable ( const String aQName,
const Item aItem 
) [pure virtual]

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

Parameters:
aQName the QName that identifies the external variable.
aItem the Item that is used as value for the variable.
Returns:
true if the variable has been set, false otherwise.
Exceptions:
ZorbaException if an error occured (e.g. the given Item is not valid).
Examples:
context.cpp, and simple.cpp.

virtual bool zorba::DynamicContext::setVariableAsDocument ( const String aQName,
const String aDocURI,
std::istream &  aDocStream 
) [pure virtual]

Defines the external variable identifies by aQName and assigns it the the document that results from reading and parsing the given istream.

Parameters:
aQName the QName that identifies the external variable.
aDocURI the URI that is used to reference the document in the XmlDataManager.
aDocStream the istream used to read the document from.
Returns:
true if the variable has been set successfully, false otherwise.
Exceptions:
ZorbaException if an error occured (e.g. the given ResultIterator is not valid).
Examples:
context.cpp.


The documentation for this class was generated from the following file: