StreamingStatement

<< Click to Display Table of Contents >>

Navigation:  Integrating Blaze with Other Systems > SQLstream JDBC Driver > Extensions to JDBC API >

StreamingStatement

Previous pageReturn to chapter overviewNext page

Every Statement and PreparedStatement created by the SQLstream JDBC driver implements the StreamingStatement interface This object is used to execute a streaming SQL statement and return its results. The following code shows the getRowtimeBound method of this interface.

interface StreamingStatement extends java.sql.Statement {

   long getStatementId();

   long getQueryTimeoutMillis();

   void setQueryTimeoutMillis(long);

   Timestamp getRowtimeBound()

;

}

Interface Summary

public interface StreamingStatement

extends Statement

SQLstream streaming statement interface.

 

This interface extends Statement to include methods for getting the statement's unique identifier, getting rowtime bounds, and managing millisecond-granularity statement timeouts. See http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html for details on Statement.

Field Summary

Fields

Modifier and Type

Field and Description

static long

TIMEOUT_NO_WAIT

Timeout interval for no-wait polling.

Fields inherited from interface java.sql.Statement

CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO

Method Summary

Methods

Modifier and Type

Method and Description

long

getQueryTimeoutMillis()

Returns the query timeout value of this statement, in milliseconds, as set by setQueryTimeoutMillis(long).

Timestamp

getRowtimeBound()

Returns the latest rowtime bound from the target stream.

long

getStatementId()

Returns the unique identifier of this statement.

void

setQueryTimeoutMillis(long millis)

Sets the query timeout of this StreamingStatement.

Methods inherited from interface java.sql.Statement

addBatch, cancel, clearBatch, clearWarnings, close, closeOnCompletion, execute, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout

Methods inherited from interface java.sql.Wrapper

isWrapperFor, unwrap

Method Detail

Method

Details

getStatementId

long getStatementId()

throws SQLException

Returns the unique identifier of this statement.

Returns:

statement identifier

Throws:

SQLException - if the statement is not open or statement type does not prepare a server-side statement

getQueryTimeoutMillis

long getQueryTimeoutMillis()

                          throws SQLException

Returns the query timeout value of this statement, in milliseconds, as set by setQueryTimeoutMillis(long).

Returns:

the current query timeout limit in milliseconds; zero means there is no limit

Throws:

SQLException - if a database access error occurs

getRowtimeBound

Timestamp getRowtimeBound()

throws SQLException

Returns the latest rowtime bound from the target stream. This is a lower bound on the rowtime of the next row to arrive on the stream.

For a SELECT statement or other query, the target is the stream of results. For an INSERT statement the target is the stream into which rows are being inserted. Other kinds of statements (such as DDL) have no target statement.

Returns:

rowtime bound (UTC)

Throws:

SQLException

setQueryTimeoutMillis

void setQueryTimeoutMillis(long millis)

                          throws SQLException

Sets the query timeout of this StreamingStatement.

When a timeout t is set, the JDBC driver will wait no longer than t milliseconds for the server to execute the statement. If this time limit is exceeded during statement execution, the statement throws a SQLException. This method is like Statement.setQueryTimeout(int), but with millisecond precision.

The timeout applies each time this statement is executed, by a call to Statement.execute(java.lang.String), Statement.executeUpdate(java.lang.String), or Statement.executeQuery(java.lang.String). The timeout clock starts when such a method is called and stops when it returns: thus the timeout is a maximum time allowed to execute a DDL or DML statement, or to wait for the ResultSet returned by executing a query. Note that the timeout reflects the passage of real time, which need not be related to the rowtime of a stream.

By default, a statement has no timeout (will wait forever); this is denoted as a timeout value 0.

Fetch timeouts

When the statement is a query, execution returns a ResultSet, and the query timeout value becomes the fetch timeout. This timeout affects all methods that fetch new data from the server, such as ResultSet.next().

Parameters:

millis - the new query timeout limit in milliseconds; zero means there is no limit (wait forever), and TIMEOUT_NO_WAIT means do a no-wait poll

Throws:

SQLException - if a database access error occurs

See Also:

getQueryTimeoutMillis(), Statement.getQueryTimeout(), Statement.setQueryTimeout(int)