com.marklogic.xdbc
Interface XDBCResultSequence


public interface XDBCResultSequence

A sequence of XQuery values representing the result of evaluating a single XQuery statement.

The result sequence is used as an Iterator which retrieves the values sequentially in the order of evaluation by the XQuery.

When retrieving the sequence values as Java types, maximum fidelity is preserved whenever possible.

See Also:
W3C XML Schema Datatypes

Field Summary
static int XDBC_AnyURI
          Constant indicating the XML Schema type AnyURI
static int XDBC_Base64Binary
          Constant indicating the XML Schema type Base64Binary
static int XDBC_Binary
          Constant indicating the special type Binary
static int XDBC_Boolean
          Constant indicating the XML Schema type Boolean
static int XDBC_CONCUR_READ_ONLY
          Constant indicating the concurrency mode for an XDBCResultSequence containing items that can NOT be updated through the result sequence.
static int XDBC_CONCUR_UPDATABLE
          Constant indicating the concurrency mode for an XDBCResultSequence containing items that may be updated through the result sequence.
static int XDBC_Date
          Constant indicating the XML Schema type Date
static int XDBC_DateTime
          Constant indicating the XML Schema type DateTime
static int XDBC_DayTimeDuration
          Constant indicating the XML Schema type Schema
static int XDBC_Decimal
          Constant indicating the XML Schema type Decimal
static int XDBC_Double
          Constant indicating the XML Schema type Double
static int XDBC_Duration
          Constant indicating the XML Schema type Duration
static int XDBC_Float
          Constant indicating the XML Schema type Float
static int XDBC_GDay
          Constant indicating the XML Schema type GDay
static int XDBC_GMonth
          Constant indicating the XML Schema type GMonth
static int XDBC_GMonthDay
          Constant indicating the XML Schema type GMonthDay
static int XDBC_GYear
          Constant indicating the XML Schema type GYear
static int XDBC_GYearMonth
          Constant indicating the XML Schema type GYearMonth
static int XDBC_HexBinary
          Constant indicating the XML Schema type HexBinary
static int XDBC_Integer
          Constant indicating the XML Schema type Integer
static int XDBC_Node
          Constant indicating the XML Schema type Node
static int XDBC_QName
          Constant indicating the XML Schema type QName
static int XDBC_String
          Constant indicating the XML Schema type String
static int XDBC_Text
          Constant indicating the special type Text
static int XDBC_Time
          Constant indicating the XML Schema type Time
static int XDBC_YearMonthDuration
          Constant indicating the XML Schema type YearMonthDuration
 
Method Summary
 void clearWarnings()
          Clear all the warnings reported on this XQuery statement.
 void close()
          Releases this XDBCResultSequence object's database and XDBC resources immediately instead of waiting for this to be done by the Java runtime.
 boolean get_boolean()
          Returns the item as a Java primitive boolean type.
 Date get_Date()
          Returns the item as a Java Date type.
 BigDecimal get_Decimal()
          Returns the item as a Java BigDecimal type.
 double get_double()
          Returns the item as a Java primitive double type.
 float get_float()
          Returns the item as a Java primitive float type.
 int get_int()
          Returns the item as a Java primitive int type.
 long get_long()
          Returns the item as a Java primitive long type.
 String get_String()
          Returns the item as a Java String type.
 XDBCSchemaTypes.AnyURI getAnyURI()
          Schema type item accessor
 XDBCSchemaTypes.Base64Binary getBase64Binary()
          Schema type item accessor
 XDBCSchemaTypes.Binary getBinary()
          Special type item accessor
 XDBCSchemaTypes.Boolean getBoolean()
          Schema type item accessor
 int getBufferSize()
          Returns the current buffer size, which is the number of bytes that that should be fetched from the database in a single read of results.
 XDBCSchemaTypes.Date getDate()
          Schema type item accessor
 XDBCSchemaTypes.DateTime getDateTime()
          Schema type item accessor
 XDBCSchemaTypes.DayTimeDuration getDayTimeDuration()
          Schema type item accessor
 XDBCSchemaTypes.Decimal getDecimal()
          Schema type item accessor
 XDBCSchemaTypes.Double getDouble()
          Schema type item accessor
 XDBCSchemaTypes.Duration getDuration()
          Schema type item accessor
 XDBCSchemaTypes.Float getFloat()
          Schema type item accessor
 XDBCSchemaTypes.GDay getGDay()
          Schema type item accessor
 XDBCSchemaTypes.GMonth getGMonth()
          Schema type item accessor
 XDBCSchemaTypes.GMonthDay getGMonthDay()
          Schema type item accessor
 XDBCSchemaTypes.GYear getGYear()
          Schema type item accessor
 XDBCSchemaTypes.GYearMonth getGYearMonth()
          Schema type item accessor
 XDBCSchemaTypes.HexBinary getHexBinary()
          Schema type item accessor
 InputStream getInputStream()
          Returns a java.io.InputStream that can be used to read the item.
 XDBCSchemaTypes.Integer getInteger()
          Schema type item accessor
 int getItemType()
          Returns the type of the current item as a constant integer.
 int getNextType()
          Returns the type of the next item as a constant integer.
 XDBCSchemaTypes.Node getNode()
          Schema type item accessor
 XDBCSchemaTypes.QName getQName()
          Schema type item accessor
 BufferedReader getReader()
          Returns a java.io.BufferedReader that can be used to read the current sequence item.
 int getResultSequenceConcurrency()
          Gets the concurrency setting for this XDBCResultSequence object.
 XDBCStatement getStatement()
          Returns the XDBCStatement object that produced this XDBCResultSequence object.
 XDBCSchemaTypes.String getString()
          Schema type item accessor
 XDBCSchemaTypes.Text getText()
          Special type item accessor
 XDBCSchemaTypes.Time getTime()
          Schema type item accessor
 XDBCWarning getWarnings()
          Retrieves the warnings reported by calls on this XQuery statement.
 XDBCSchemaTypes.YearMonthDuration getYearMonthDuration()
          Schema type item accessor
 boolean hasNext()
          Returns true if this XDBCResultSequence has more items.
 boolean isClosed()
          Tests if this XDBCResultSequence is closed.
 Iterator iterator()
          Returns a java.util.Iterator wrapper for this XDBCResultSequence object.
 Object next()
          Returns the next item of the result sequence.
 InputStream nextInputStream()
          Returns the next item of the result sequence as a java.io.InputStream object.
 BufferedReader nextReader()
          Returns the next item of the result sequence as a java.io.BufferedReader object.
 void setBufferSize(int size)
          Gives the XDBC driver a hint about the number of bytes that should be fetched from the database in a single read of results.
 

Field Detail

XDBC_CONCUR_READ_ONLY

public static final int XDBC_CONCUR_READ_ONLY
Constant indicating the concurrency mode for an XDBCResultSequence containing items that can NOT be updated through the result sequence.

See Also:
Constant Field Values

XDBC_CONCUR_UPDATABLE

public static final int XDBC_CONCUR_UPDATABLE
Constant indicating the concurrency mode for an XDBCResultSequence containing items that may be updated through the result sequence.

See Also:
Constant Field Values

XDBC_AnyURI

public static final int XDBC_AnyURI
Constant indicating the XML Schema type AnyURI

See Also:
Constant Field Values

XDBC_Base64Binary

public static final int XDBC_Base64Binary
Constant indicating the XML Schema type Base64Binary

See Also:
Constant Field Values

XDBC_Boolean

public static final int XDBC_Boolean
Constant indicating the XML Schema type Boolean

See Also:
Constant Field Values

XDBC_Date

public static final int XDBC_Date
Constant indicating the XML Schema type Date

See Also:
Constant Field Values

XDBC_DateTime

public static final int XDBC_DateTime
Constant indicating the XML Schema type DateTime

See Also:
Constant Field Values

XDBC_Decimal

public static final int XDBC_Decimal
Constant indicating the XML Schema type Decimal

See Also:
Constant Field Values

XDBC_Integer

public static final int XDBC_Integer
Constant indicating the XML Schema type Integer

See Also:
Constant Field Values

XDBC_Double

public static final int XDBC_Double
Constant indicating the XML Schema type Double

See Also:
Constant Field Values

XDBC_Duration

public static final int XDBC_Duration
Constant indicating the XML Schema type Duration

See Also:
Constant Field Values

XDBC_DayTimeDuration

public static final int XDBC_DayTimeDuration
Constant indicating the XML Schema type Schema

See Also:
Constant Field Values

XDBC_YearMonthDuration

public static final int XDBC_YearMonthDuration
Constant indicating the XML Schema type YearMonthDuration

See Also:
Constant Field Values

XDBC_Float

public static final int XDBC_Float
Constant indicating the XML Schema type Float

See Also:
Constant Field Values

XDBC_GDay

public static final int XDBC_GDay
Constant indicating the XML Schema type GDay

See Also:
Constant Field Values

XDBC_GMonth

public static final int XDBC_GMonth
Constant indicating the XML Schema type GMonth

See Also:
Constant Field Values

XDBC_GMonthDay

public static final int XDBC_GMonthDay
Constant indicating the XML Schema type GMonthDay

See Also:
Constant Field Values

XDBC_GYear

public static final int XDBC_GYear
Constant indicating the XML Schema type GYear

See Also:
Constant Field Values

XDBC_GYearMonth

public static final int XDBC_GYearMonth
Constant indicating the XML Schema type GYearMonth

See Also:
Constant Field Values

XDBC_HexBinary

public static final int XDBC_HexBinary
Constant indicating the XML Schema type HexBinary

See Also:
Constant Field Values

XDBC_Node

public static final int XDBC_Node
Constant indicating the XML Schema type Node

See Also:
Constant Field Values

XDBC_QName

public static final int XDBC_QName
Constant indicating the XML Schema type QName

See Also:
Constant Field Values

XDBC_String

public static final int XDBC_String
Constant indicating the XML Schema type String

See Also:
Constant Field Values

XDBC_Time

public static final int XDBC_Time
Constant indicating the XML Schema type Time

See Also:
Constant Field Values

XDBC_Text

public static final int XDBC_Text
Constant indicating the special type Text

See Also:
Constant Field Values

XDBC_Binary

public static final int XDBC_Binary
Constant indicating the special type Binary

See Also:
Constant Field Values
Method Detail

close

public void close()
           throws XDBCException
Releases this XDBCResultSequence object's database and XDBC resources immediately instead of waiting for this to be done by the Java runtime.

Calling this method frees up resources immediately and its use is strongly encouraged.

Throws:
XDBCException - if a database access error occurs.

getStatement

public XDBCStatement getStatement()
                           throws XDBCException
Returns the XDBCStatement object that produced this XDBCResultSequence object.

Returns:
the XDBCStatement object used to create this result sequence.
Throws:
XDBCException - if a database access error occurs.

getResultSequenceConcurrency

public int getResultSequenceConcurrency()
                                 throws XDBCException
Gets the concurrency setting for this XDBCResultSequence object.

Returns:
the concurrency level for this XDBCResultSequence object.
Throws:
XDBCException - if a database access error occurs.
See Also:
XDBC_CONCUR_READ_ONLY, XDBC_CONCUR_UPDATABLE

getItemType

public int getItemType()
Returns the type of the current item as a constant integer.

Returns:
an integer type value.
See Also:
XDBC_AnyURI, XDBC_Base64Binary, XDBC_Boolean, XDBC_Date, XDBC_DateTime, XDBC_Decimal, XDBC_Integer, XDBC_Double, XDBC_Duration, XDBC_DayTimeDuration, XDBC_YearMonthDuration, XDBC_Float, XDBC_GDay, XDBC_GMonth, XDBC_GMonthDay, XDBC_GYear, XDBC_GYearMonth, XDBC_HexBinary, XDBC_Node, XDBC_QName, XDBC_String, XDBC_Time, XDBC_Text, XDBC_Binary

getNextType

public int getNextType()
                throws XDBCException
Returns the type of the next item as a constant integer. The value -1 is returned if there is no next item. This method allow the application to peek ahead in the sequence and make decisions about how to handle the next item. Note that next(), nextReader(), or nextInputStream() must be called to actually get the value of the next item.

Returns:
an integer type value.
Throws:
XDBCException - if a conversion or fetch error occurs.
See Also:
XDBC_AnyURI, XDBC_Base64Binary, XDBC_Boolean, XDBC_Date, XDBC_DateTime, XDBC_Decimal, XDBC_Integer, XDBC_Double, XDBC_Duration, XDBC_DayTimeDuration, XDBC_YearMonthDuration, XDBC_Float, XDBC_GDay, XDBC_GMonth, XDBC_GMonthDay, XDBC_GYear, XDBC_GYearMonth, XDBC_HexBinary, XDBC_Node, XDBC_QName, XDBC_String, XDBC_Time, XDBC_Text, XDBC_Binary

next

public Object next()
            throws XDBCException
Returns the next item of the result sequence. Use the getItemType() method to determine the type of the object.

Returns:
a Java Object which is the next item; null if there is no next item.
Throws:
XDBCException - if a database access error occurs.

hasNext

public boolean hasNext()
                throws XDBCException
Returns true if this XDBCResultSequence has more items.

Returns:
true if there are more items on this result sequence, false if there are none.
Throws:
XDBCException - if a database access error occurs.

iterator

public Iterator iterator()
Returns a java.util.Iterator wrapper for this XDBCResultSequence object.

Returns:
a java.util.Iterator for this result sequence.
See Also:
Iterator

setBufferSize

public void setBufferSize(int size)
Gives the XDBC driver a hint about the number of bytes that should be fetched from the database in a single read of results. Normally this value does not need to be changed. A suitable default is used.

This setting may be changed during the fetching of the items in the sequence, if necessary.

Since this is a hint only, the XDBC driver may choose to ignore this value.

Parameters:
size - the integer number of bytes to fetch at one time; must be greater than zero.
See Also:
getBufferSize()

getBufferSize

public int getBufferSize()
Returns the current buffer size, which is the number of bytes that that should be fetched from the database in a single read of results.

Returns:
the integer number of bytes
See Also:
setBufferSize(int)

getWarnings

public XDBCWarning getWarnings()
                        throws XDBCException
Retrieves the warnings reported by calls on this XQuery statement. The warnings form a linked list, and this method returns the first warning in the list. New warnings will be appended to the end of the list.

Returns:
the first XDBCWarning in the linked list of warnings for this statement, or null if no warnings have occurred.
Throws:
XDBCException - if a database access error occurs.

clearWarnings

public void clearWarnings()
                   throws XDBCException
Clear all the warnings reported on this XQuery statement. After this method is called, getWarnings() will return null until another warning occurs.

Throws:
XDBCException - if a database access error occurs.

isClosed

public boolean isClosed()
                 throws XDBCException
Tests if this XDBCResultSequence is closed.

Returns:
true if this XDBCResultSequence is closed, false if it is still open.
Throws:
XDBCException - if a database access error occurs

getAnyURI

public XDBCSchemaTypes.AnyURI getAnyURI()
Schema type item accessor


getBase64Binary

public XDBCSchemaTypes.Base64Binary getBase64Binary()
Schema type item accessor


getBoolean

public XDBCSchemaTypes.Boolean getBoolean()
Schema type item accessor


getDate

public XDBCSchemaTypes.Date getDate()
Schema type item accessor


getDateTime

public XDBCSchemaTypes.DateTime getDateTime()
Schema type item accessor


getDecimal

public XDBCSchemaTypes.Decimal getDecimal()
Schema type item accessor


getInteger

public XDBCSchemaTypes.Integer getInteger()
Schema type item accessor


getDouble

public XDBCSchemaTypes.Double getDouble()
Schema type item accessor


getDuration

public XDBCSchemaTypes.Duration getDuration()
Schema type item accessor


getDayTimeDuration

public XDBCSchemaTypes.DayTimeDuration getDayTimeDuration()
Schema type item accessor


getYearMonthDuration

public XDBCSchemaTypes.YearMonthDuration getYearMonthDuration()
Schema type item accessor


getFloat

public XDBCSchemaTypes.Float getFloat()
Schema type item accessor


getGDay

public XDBCSchemaTypes.GDay getGDay()
Schema type item accessor


getGMonth

public XDBCSchemaTypes.GMonth getGMonth()
Schema type item accessor


getGMonthDay

public XDBCSchemaTypes.GMonthDay getGMonthDay()
Schema type item accessor


getGYear

public XDBCSchemaTypes.GYear getGYear()
Schema type item accessor


getGYearMonth

public XDBCSchemaTypes.GYearMonth getGYearMonth()
Schema type item accessor


getHexBinary

public XDBCSchemaTypes.HexBinary getHexBinary()
Schema type item accessor


getNode

public XDBCSchemaTypes.Node getNode()
Schema type item accessor


getQName

public XDBCSchemaTypes.QName getQName()
Schema type item accessor


getString

public XDBCSchemaTypes.String getString()
Schema type item accessor


getTime

public XDBCSchemaTypes.Time getTime()
Schema type item accessor


getBinary

public XDBCSchemaTypes.Binary getBinary()
Special type item accessor


getText

public XDBCSchemaTypes.Text getText()
Special type item accessor


get_float

public float get_float()
                throws XDBCException
Returns the item as a Java primitive float type.

Returns:
the float representation of this item.
Throws:
XDBCException - if a conversion or fetch error occurs.

get_double

public double get_double()
                  throws XDBCException
Returns the item as a Java primitive double type.

Returns:
the double representation of this item.
Throws:
XDBCException - if a conversion or fetch error occurs.

get_int

public int get_int()
            throws XDBCException
Returns the item as a Java primitive int type.

Returns:
the int representation of this item.
Throws:
XDBCException - if a conversion or fetch error occurs.

get_long

public long get_long()
              throws XDBCException
Returns the item as a Java primitive long type.

Returns:
the long representation of this item.
Throws:
XDBCException - if a conversion or fetch error occurs.

get_boolean

public boolean get_boolean()
                    throws XDBCException
Returns the item as a Java primitive boolean type.

Returns:
the booleanfloat representation of this item.
Throws:
XDBCException - if a conversion or fetch error occurs.

get_Date

public Date get_Date()
              throws XDBCException
Returns the item as a Java Date type.

Returns:
a java.util.Date object representing this item.
Throws:
XDBCException - if a conversion or fetch error occurs.
See Also:
java.util.Date

get_Decimal

public BigDecimal get_Decimal()
                       throws XDBCException
Returns the item as a Java BigDecimal type.

Returns:
a java.math.BigDecimal object representing this item.
Throws:
XDBCException - if a conversion or fetch error occurs.
See Also:
java.math.BigDecimal

get_String

public String get_String()
                  throws XDBCException
Returns the item as a Java String type.

Returns:
a String object representing this item.
Throws:
XDBCException - if a conversion or fetch error occurs.

getInputStream

public InputStream getInputStream()
                           throws XDBCException
Returns a java.io.InputStream that can be used to read the item.

Returns:
a java.io.InputStream object for reading this item.
Throws:
XDBCException - if a conversion or fetch error occurs.

getReader

public BufferedReader getReader()
                         throws XDBCException
Returns a java.io.BufferedReader that can be used to read the current sequence item.

Returns:
a java.io.BufferedReader object for reading the current sequence item.
Throws:
XDBCException - if a conversion or fetch error occurs.

nextReader

public BufferedReader nextReader()
                          throws XDBCException
Returns the next item of the result sequence as a java.io.BufferedReader object. Supports reading the results as Unicode stream. This method is similar to next() in that it advances to the next sequence item. One of next(), nextReader(), or nextInputStream() should be called, but not more than one for a given sequence item.

Returns:
a java.io.BufferedReader object for reading the next item.
Throws:
XDBCException - if a conversion or fetch error occurs
See Also:
java.io.BufferedReader

nextInputStream

public InputStream nextInputStream()
                            throws XDBCException
Returns the next item of the result sequence as a java.io.InputStream object. This method is similar to next() in that it advances to the next sequence item. One of next(), nextReader(), or nextInputStream() should be called, but not more than one for a given sequence item.

Returns:
a java.io.InputStream object for reading the next item.
Throws:
XDBCException - if a conversion or fetch error occurs
See Also:
java.io.InputStream