java.lang.AutoCloseable, java.sql.Statement, java.sql.WrapperVirtuosoPreparedStatementpublic class VirtuosoStatement
extends java.lang.Object
implements java.sql.Statement
Statement s = connection.createStatement()
Connection.createStatement()| Modifier and Type | Field | Description |
|---|---|---|
protected java.util.LinkedList<java.lang.Object> |
batch |
|
protected boolean |
close_flag |
|
protected boolean |
closeOnCompletion |
|
protected VirtuosoConnection |
connection |
|
protected java.lang.String |
cursorName |
|
protected int |
exec_type |
|
protected virtuoso.jdbc4.VirtuosoFuture |
future |
|
protected boolean |
isCached |
|
protected VirtuosoResultSetMetaData |
metaData |
|
protected Vector |
objparams |
|
protected Vector |
parameters |
|
protected VirtuosoParameterMetaData |
paramsMetaData |
|
protected int |
prefetch |
|
protected static int |
req_no |
|
protected boolean |
result_opened |
|
protected int |
rpc_timeout |
|
protected boolean |
sparql_executed |
|
protected java.lang.String |
statid |
|
protected int |
txn_timeout |
|
protected int |
type |
|
protected VirtuosoResultSet |
vresultSet |
|
protected boolean |
wait_result |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addBatch(java.lang.String sql) |
Adds a SQL command to the current batch of commands for the statement.
|
void |
cancel() |
Cancels this Statement object if both the DBMS and
driver support aborting an SQL statement.
|
protected void |
cancel_rs() |
|
void |
clearBatch() |
Makes the set of commands in the current batch empty.
|
void |
clearWarnings() |
Clears all the warnings reported on this Statement object.
|
void |
close() |
Releases this Statement object's database
and JDBC resources immediately instead of new wait for
this to happen when it is automatically closed.
|
void |
close_rs(boolean close_stmt,
boolean is_prepared) |
|
void |
closeOnCompletion() |
Specifies that this
Statement will be closed when all its
dependent result sets are closed. |
boolean |
execute(java.lang.String sql) |
Executes a SQL statement that may return multiple results.
|
boolean |
execute(java.lang.String sql,
int autoGeneratedKeys) |
|
boolean |
execute(java.lang.String sql,
int[] columnIndexes) |
|
boolean |
execute(java.lang.String sql,
java.lang.String[] columnNames) |
|
int[] |
executeBatch() |
Submits a batch of commands to the database for execution.
|
java.sql.ResultSet |
executeQuery(java.lang.String sql) |
Executes a SQL statement that returns a single ResultSet.
|
int |
executeUpdate(java.lang.String sql) |
Executes an SQL INSERT, UPDATE or DELETE statement.
|
int |
executeUpdate(java.lang.String sql,
int autoGeneratedKeys) |
|
int |
executeUpdate(java.lang.String sql,
int[] columnIndexes) |
|
int |
executeUpdate(java.lang.String sql,
java.lang.String[] columnNames) |
|
void |
finalize() |
Method runs when the garbage collector want to erase the object
|
java.sql.Connection |
getConnection() |
Returns the VirtuosoConnection object that produced this
VirtuosoStatement object.
|
int |
getExecType() |
Returns the type of executing query.
|
int |
getFetchDirection() |
Retrieves the direction for fetching rows from
database tables that is the default for result sets
generated from this VirtuosoStatement object.
|
int |
getFetchSize() |
Retrieves the number of result set rows that is the default
fetch size for result sets generated from this Statement object.
|
java.sql.ResultSet |
getGeneratedKeys() |
|
int |
getMaxFieldSize() |
Returns the maximum number of bytes allowed for any column value.
|
int |
getMaxRows() |
Retrieves the maximum number of rows that a
VirtuosoResultSet can contain.
|
boolean |
getMoreResults() |
Moves to a Statement's next result.
|
boolean |
getMoreResults(int current) |
|
int |
getQueryTimeout() |
Retrieves the number of seconds the driver will
new wait for a Statement to execute.
|
java.sql.ResultSet |
getResultSet() |
Returns the current result as a VirtuosoResultSet object.
|
int |
getResultSetConcurrency() |
Returns the result set concurrency.
|
int |
getResultSetHoldability() |
|
int |
getResultSetType() |
Returns the result set type.
|
protected VectorOfLong |
getStmtOpts() |
|
int |
getUpdateCount() |
Returns the current result as an update count;
if the result is a ResultSet or there are no more results, -1
is returned.
|
java.sql.SQLWarning |
getWarnings() |
Retrieves the first warning reported by calls on this Statement.
|
boolean |
isClosed() |
Retrieves whether this
Statement object has been closed. |
boolean |
isCloseOnCompletion() |
Returns a value indicating whether this
Statement will be
closed when all its dependent result sets are closed. |
boolean |
isPoolable() |
Returns a value indicating whether the
Statement
is poolable or not. |
boolean |
isWrapperFor(java.lang.Class<?> iface) |
Returns true if this either implements the interface argument or is directly or indirectly a wrapper
for an object that does.
|
protected void |
notify_error(java.lang.Throwable e) |
|
protected VirtuosoResultSet |
sendQuery(java.lang.String sql) |
Executes a SQL statement that returns a single ResultSet.
|
void |
setCursorName(java.lang.String name) |
Defines the SQL cursor name that will be used by
subsequent Statement
execute methods. |
void |
setEscapeProcessing(boolean enable) |
Toggles on and off escape substitution before sending SQL to the
database.
|
void |
setFetchDirection(int direction) |
Sets the default fetch direction for result sets generated by
this VirtuosoStatement object.
|
void |
setFetchSize(int rows) |
Gives the JDBC driver a hint as to the number of rows that should
be fetched from the database when more rows are needed.
|
void |
setMaxFieldSize(int max) |
Sets the limit for the maximum number of bytes in a column to
the given number of bytes.
|
void |
setMaxRows(int max) |
Sets the limit for the maximum number of rows that any
VirtuosoResultSet can contain to the given number.
|
void |
setPoolable(boolean poolable) |
Requests that a
Statement be pooled or not pooled. |
void |
setQueryTimeout(int seconds) |
Sets the number of seconds the driver will
new wait for a Statement to execute to the given number of seconds.
|
<T> T |
unwrap(java.lang.Class<T> iface) |
Returns an object that implements the given interface to allow access to
non-standard methods, or standard methods not exposed by the proxy.
|
protected Vector parameters
protected Vector objparams
protected java.util.LinkedList<java.lang.Object> batch
protected int type
protected int exec_type
protected VirtuosoConnection connection
protected int prefetch
protected int txn_timeout
protected int rpc_timeout
protected java.lang.String statid
protected java.lang.String cursorName
protected volatile boolean close_flag
protected boolean wait_result
protected boolean result_opened
protected boolean sparql_executed
protected static int req_no
protected volatile VirtuosoResultSet vresultSet
protected virtuoso.jdbc4.VirtuosoFuture future
protected VirtuosoResultSetMetaData metaData
protected boolean isCached
protected boolean closeOnCompletion
protected VirtuosoParameterMetaData paramsMetaData
protected VectorOfLong getStmtOpts() throws VirtuosoException
VirtuosoExceptionprotected VirtuosoResultSet sendQuery(java.lang.String sql) throws VirtuosoException
sql - the SQL request.VirtuosoException - If a database access error occurs.public void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic void cancel()
throws VirtuosoException
cancel in interface java.sql.StatementVirtuosoException - If a database access error occursprotected void cancel_rs()
throws VirtuosoException
VirtuosoExceptionpublic void close_rs(boolean close_stmt,
boolean is_prepared)
throws VirtuosoException
VirtuosoExceptionpublic void clearWarnings()
throws VirtuosoException
clearWarnings in interface java.sql.StatementVirtuosoException - No errors returned (just an implementation question).Statement.clearWarnings()public void close()
throws VirtuosoException
close in interface java.lang.AutoCloseableclose in interface java.sql.StatementVirtuosoException - If a database access error occurs.Statement.close()public boolean execute(java.lang.String sql)
throws VirtuosoException
execute in interface java.sql.Statementsql - Any SQL statement.VirtuosoException - If a database access error occurs.getResultSet(),
getUpdateCount(),
getMoreResults(),
Statement.execute(java.lang.String)public java.sql.ResultSet executeQuery(java.lang.String sql)
throws VirtuosoException
executeQuery in interface java.sql.Statementsql - Typically this is a static SQL SELECT statement. (null is possible)VirtuosoException - If a database access error occurs.Statement.executeQuery(java.lang.String)public int executeUpdate(java.lang.String sql)
throws VirtuosoException
executeUpdate in interface java.sql.Statementsql - a SQL INSERT, UPDATE or DELETE statement or a SQL
statement that returns nothingVirtuosoException - if a database access error occursStatement.executeUpdate(java.lang.String)public int getMaxFieldSize()
throws VirtuosoException
getMaxFieldSize in interface java.sql.StatementVirtuosoException - No errors returned (just an implementation question).Statement.getMaxFieldSize()public int getMaxRows()
throws VirtuosoException
getMaxRows in interface java.sql.StatementVirtuosoException - No errors returned (just an implementation question).Statement.getMaxRows()public boolean getMoreResults()
throws VirtuosoException
getMoreResults in interface java.sql.StatementVirtuosoException - if a database access error occursgetResultSet(),
execute(java.lang.String),
Statement.getMoreResults()public int getQueryTimeout()
throws VirtuosoException
getQueryTimeout in interface java.sql.StatementVirtuosoException - No errors returned (just an implementation question).Statement.getQueryTimeout()public java.sql.ResultSet getResultSet()
throws VirtuosoException
getResultSet in interface java.sql.StatementVirtuosoException - No errors returned (just an implementation question).getResultSet(),
execute(java.lang.String),
Statement.getResultSet()public int getUpdateCount()
throws VirtuosoException
getUpdateCount in interface java.sql.StatementVirtuosoException - if a database access error occursexecute(java.lang.String)public java.sql.SQLWarning getWarnings()
throws VirtuosoException
getWarnings in interface java.sql.StatementVirtuosoException - No errors returned (just an implementation question).Statement.getWarnings()public void setMaxFieldSize(int max)
throws VirtuosoException
setMaxFieldSize in interface java.sql.Statementmax - The new max column size limit; zero means unlimitedVirtuosoException - No errors returned (just an implementation question).Statement.setMaxFieldSize(int)public void setMaxRows(int max)
throws VirtuosoException
setMaxRows in interface java.sql.Statementmax - The new max rows limit; zero means unlimitedVirtuosoException - An internal error occurred.Statement.setMaxRows(int)public void setQueryTimeout(int seconds)
throws VirtuosoException
setQueryTimeout in interface java.sql.Statementseconds - the new query timeout limit in seconds; zero means.
unlimitedVirtuosoException - An internal error occurred.Statement.setQueryTimeout(int)public java.sql.Connection getConnection()
throws VirtuosoException
getConnection in interface java.sql.StatementVirtuosoException - No errors returned (just an implementation question).Statement.getConnection()public int getFetchDirection()
throws VirtuosoException
getFetchDirection in interface java.sql.StatementVirtuosoException - No errors returned (just an implementation question).Statement.getFetchDirection()public int getFetchSize()
throws VirtuosoException
getFetchSize in interface java.sql.StatementVirtuosoException - No errors returned (just an implementation question).Statement.getFetchSize()public int getResultSetConcurrency()
throws VirtuosoException
getResultSetConcurrency in interface java.sql.StatementVirtuosoException - No errors returned (just an implementation question).ResultSet,
Statement.getResultSetConcurrency()public int getResultSetType()
throws VirtuosoException
getResultSetType in interface java.sql.StatementVirtuosoException - No errors returned (just an implementation question).ResultSet,
Statement.getResultSetType()public void setFetchDirection(int direction)
throws VirtuosoException
setFetchDirection in interface java.sql.Statementdirection - the initial direction for processing rowsVirtuosoException - An internal error occurred.Statement.setFetchDirection(int)public void setFetchSize(int rows)
throws VirtuosoException
setFetchSize in interface java.sql.Statementrows - the number of rows to fetchVirtuosoException - An internal error occurred.Statement.setFetchSize(int)public void setCursorName(java.lang.String name)
throws VirtuosoException
execute methods. This name can then be
used in SQL positioned update/delete statements to identify the
current row in the ResultSet generated by this statement. If
the database does not support positioned update/delete, this
method is a noop. To insure that a cursor has the proper isolation
level to support updates, the cursor's SELECT statement should be
of the form 'select for update ...'. If the 'for update' phrase is
omitted, positioned updates may fail.
Note: By definition, positioned update/delete execution must be done by a different Statement than the one which generated the ResultSet being used for positioning. Also, cursor names must be unique within a connection.
setCursorName in interface java.sql.Statementname - the new cursor name, which must be unique within
a connectionVirtuosoException - if a database access error occurspublic void addBatch(java.lang.String sql)
throws VirtuosoException
addBatch in interface java.sql.Statementsql - typically this is a static SQL INSERT or UPDATE statementVirtuosoException - if a database access error occurspublic void clearBatch()
throws VirtuosoException
clearBatch in interface java.sql.StatementVirtuosoException - if a database access error occurspublic int[] executeBatch()
throws java.sql.BatchUpdateException
executeBatch in interface java.sql.Statementjava.sql.BatchUpdateException - if a database access error occurspublic void setEscapeProcessing(boolean enable)
throws VirtuosoException
setEscapeProcessing in interface java.sql.Statementenable - Indicate whether to enable or disable escape processing.VirtuosoException - No errors returned (just an implementation question).Statement.setEscapeProcessing(boolean)public int getExecType()
public boolean isClosed()
throws java.sql.SQLException
Statement object has been closed. A Statement is closed if the
method close has been called on it, or if it is automatically closed.isClosed in interface java.sql.StatementStatement object is closed; false if it is still openjava.sql.SQLException - if a database access error occurspublic boolean getMoreResults(int current)
throws java.sql.SQLException
getMoreResults in interface java.sql.Statementjava.sql.SQLExceptionpublic java.sql.ResultSet getGeneratedKeys()
throws java.sql.SQLException
getGeneratedKeys in interface java.sql.Statementjava.sql.SQLExceptionpublic int executeUpdate(java.lang.String sql,
int autoGeneratedKeys)
throws java.sql.SQLException
executeUpdate in interface java.sql.Statementjava.sql.SQLExceptionpublic int executeUpdate(java.lang.String sql,
int[] columnIndexes)
throws java.sql.SQLException
executeUpdate in interface java.sql.Statementjava.sql.SQLExceptionpublic int executeUpdate(java.lang.String sql,
java.lang.String[] columnNames)
throws java.sql.SQLException
executeUpdate in interface java.sql.Statementjava.sql.SQLExceptionpublic boolean execute(java.lang.String sql,
int autoGeneratedKeys)
throws java.sql.SQLException
execute in interface java.sql.Statementjava.sql.SQLExceptionpublic boolean execute(java.lang.String sql,
int[] columnIndexes)
throws java.sql.SQLException
execute in interface java.sql.Statementjava.sql.SQLExceptionpublic boolean execute(java.lang.String sql,
java.lang.String[] columnNames)
throws java.sql.SQLException
execute in interface java.sql.Statementjava.sql.SQLExceptionpublic int getResultSetHoldability()
throws java.sql.SQLException
getResultSetHoldability in interface java.sql.Statementjava.sql.SQLExceptionprotected void notify_error(java.lang.Throwable e)
throws VirtuosoException
VirtuosoExceptionpublic void setPoolable(boolean poolable)
throws java.sql.SQLException
Statement be pooled or not pooled. The value
specified is a hint to the statement pool implementation indicating
whether the applicaiton wants the statement to be pooled. It is up to
the statement pool manager as to whether the hint is used.
The poolable value of a statement is applicable to both internal statement caches implemented by the driver and external statement caches implemented by application servers and other applications.
By default, a Statement is not poolable when created, and
a PreparedStatement and CallableStatement
are poolable when created.
setPoolable in interface java.sql.Statementpoolable - requests that the statement be pooled if true and
that the statement not be pooled if false
java.sql.SQLException - if this method is called on a closed
Statement
public boolean isPoolable()
throws java.sql.SQLException
Statement
is poolable or not.
isPoolable in interface java.sql.Statementtrue if the Statement
is poolable; false otherwise
java.sql.SQLException - if this method is called on a closed
Statement
setPoolable(boolean)public <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap recursively on the wrapped object
or a proxy for that result. If the receiver is not a
wrapper and does not implement the interface, then an SQLException is thrown.unwrap in interface java.sql.Wrapperiface - A Class defining an interface that the result must implement.java.sql.SQLException - If no object found that implements the interfacepublic boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor on the wrapped
object. If this does not implement the interface and is not a wrapper, return false.
This method should be implemented as a low-cost operation compared to unwrap so that
callers can use this method to avoid expensive unwrap calls that may fail. If this method
returns true then calling unwrap with the same argument should succeed.isWrapperFor in interface java.sql.Wrapperiface - a Class defining an interface.java.sql.SQLException - if an error occurs while determining whether this is a wrapper
for an object with the given interface.public void closeOnCompletion()
throws java.sql.SQLException
Statement will be closed when all its
dependent result sets are closed. If execution of the Statement
does not produce any result sets, this method has no effect.
Note: Multiple calls to closeOnCompletion do
not toggle the effect on this Statement. However, a call to
closeOnCompletion does effect both the subsequent execution of
statements, and statements that currently have open, dependent,
result sets.
closeOnCompletion in interface java.sql.Statementjava.sql.SQLException - if this method is called on a closed
Statementpublic boolean isCloseOnCompletion()
throws java.sql.SQLException
Statement will be
closed when all its dependent result sets are closed.isCloseOnCompletion in interface java.sql.Statementtrue if the Statement will be closed when all
of its dependent result sets are closed; false otherwisejava.sql.SQLException - if this method is called on a closed
Statement