public class CassandraPreparedStatement extends CassandraStatement implements PreparedStatement, CassandraStatementJsonSupport
PreparedStatement.
It extends CassandraStatement and thereby also implements CassandraStatementExtras and
CassandraStatementJsonSupport interfaces providing extra methods not defined in JDBC API to manage
some properties specific to the Cassandra statements (e.g. consistency level) and ease usage of JSON features
INSERT INTO ... JSON and fromJson() provided by Cassandra.
batchQueries, connection, consistencyLevel, cql, currentResultSet, DEFAULT_FETCH_SIZE, escapeProcessing, fetchDirection, fetchSize, MAX_ASYNC_QUERIES, maxFieldSize, maxRows, resultSetConcurrency, resultSetHoldability, resultSetType, statement, STATEMENTS_SEPARATOR_REGEX, updateCountCLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO| Modifier and Type | Method and Description |
|---|---|
void |
addBatch() |
void |
cancel() |
void |
clearParameters() |
void |
close() |
void |
closeOnCompletion() |
boolean |
execute() |
boolean |
execute(String cql,
int[] columnIndexes) |
boolean |
execute(String cql,
String[] columnNames) |
int[] |
executeBatch() |
ResultSet |
executeQuery() |
int |
executeUpdate()
Executes the CQL statement in this
PreparedStatement object, which must be a CQL Data Manipulation
Language (DML) statement, such as INSERT, UPDATE or DELETE; or a CQL statement that
returns nothing, such as a DDL statement. |
int |
executeUpdate(String cql,
int[] columnIndexes) |
int |
executeUpdate(String cql,
String[] columnNames) |
ResultSet |
getGeneratedKeys() |
ResultSetMetaData |
getMetaData() |
ParameterMetaData |
getParameterMetaData() |
ResultSet |
getResultSet() |
boolean |
isCloseOnCompletion() |
boolean |
isWrapperFor(Class<?> iface) |
void |
setArray(int parameterIndex,
Array x) |
void |
setAsciiStream(int parameterIndex,
InputStream x) |
void |
setAsciiStream(int parameterIndex,
InputStream x,
int length) |
void |
setAsciiStream(int parameterIndex,
InputStream x,
long length) |
void |
setBigDecimal(int parameterIndex,
BigDecimal x) |
void |
setBinaryStream(int parameterIndex,
InputStream x) |
void |
setBinaryStream(int parameterIndex,
InputStream x,
int length) |
void |
setBinaryStream(int parameterIndex,
InputStream x,
long length) |
void |
setBlob(int parameterIndex,
Blob x) |
void |
setBlob(int parameterIndex,
InputStream inputStream) |
void |
setBlob(int parameterIndex,
InputStream inputStream,
long length) |
void |
setBoolean(int parameterIndex,
boolean x) |
void |
setByte(int parameterIndex,
byte x) |
void |
setBytes(int parameterIndex,
byte[] x) |
void |
setCharacterStream(int parameterIndex,
Reader reader) |
void |
setCharacterStream(int parameterIndex,
Reader reader,
int length) |
void |
setCharacterStream(int parameterIndex,
Reader reader,
long length) |
void |
setClob(int parameterIndex,
Clob x) |
void |
setClob(int parameterIndex,
Reader reader) |
void |
setClob(int parameterIndex,
Reader reader,
long length) |
void |
setCursorName(String name) |
void |
setDate(int parameterIndex,
Date x) |
void |
setDate(int parameterIndex,
Date x,
Calendar cal) |
void |
setDouble(int parameterIndex,
double x) |
void |
setDuration(int parameterIndex,
com.datastax.oss.driver.api.core.data.CqlDuration x)
Sets the designated parameter to the given
CqlDuration value. |
void |
setFloat(int parameterIndex,
float x) |
void |
setInt(int parameterIndex,
int x) |
<T> void |
setJson(int parameterIndex,
T x)
Sets the value of the designated parameter with the given object converted to a JSON string.
|
void |
setLong(int parameterIndex,
long x) |
void |
setNCharacterStream(int parameterIndex,
Reader value) |
void |
setNCharacterStream(int parameterIndex,
Reader value,
long length) |
void |
setNClob(int parameterIndex,
NClob value) |
void |
setNClob(int parameterIndex,
Reader reader) |
void |
setNClob(int parameterIndex,
Reader reader,
long length) |
void |
setNString(int parameterIndex,
String value) |
void |
setNull(int parameterIndex,
int sqlType) |
void |
setNull(int parameterIndex,
int sqlType,
String typeName) |
void |
setObject(int parameterIndex,
Object x) |
void |
setObject(int parameterIndex,
Object x,
int targetSqlType) |
void |
setObject(int parameterIndex,
Object x,
int targetSqlType,
int scaleOrLength) |
void |
setRef(int parameterIndex,
Ref x) |
void |
setRowId(int parameterIndex,
RowId x) |
void |
setShort(int parameterIndex,
short x) |
void |
setSQLXML(int parameterIndex,
SQLXML xmlObject) |
void |
setString(int parameterIndex,
String x) |
void |
setTime(int parameterIndex,
Time x) |
void |
setTime(int parameterIndex,
Time x,
Calendar cal) |
void |
setTimestamp(int parameterIndex,
Timestamp x) |
void |
setTimestamp(int parameterIndex,
Timestamp x,
Calendar cal) |
void |
setUnicodeStream(int parameterIndex,
InputStream x,
int length) |
void |
setURL(int parameterIndex,
URL value) |
<T> T |
unwrap(Class<T> iface) |
addBatch, checkNotClosed, clearBatch, clearWarnings, compareTo, execute, execute, executeQuery, executeUpdate, executeUpdate, getCassandraConnection, getConnection, getConsistencyLevel, getFetchDirection, getFetchSize, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isPoolable, resetResults, setConsistencyLevel, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeoutclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecuteLargeUpdate, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setObject, setObject, setRef, setSQLXML, setUnicodeStreamaddBatch, cancel, clearBatch, clearWarnings, closeOnCompletion, execute, execute, execute, execute, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeoutisWrapperFor, unwrappublic void close()
close in interface AutoCloseableclose in interface Statementclose in class CassandraStatementpublic void addBatch()
throws SQLException
addBatch in interface PreparedStatementSQLExceptionpublic void clearParameters()
throws SQLException
clearParameters in interface PreparedStatementSQLExceptionpublic boolean execute()
throws SQLException
execute in interface PreparedStatementSQLExceptionpublic int[] executeBatch()
throws SQLException
executeBatch in interface StatementexecuteBatch in class CassandraStatementSQLExceptionpublic ResultSet executeQuery() throws SQLException
executeQuery in interface PreparedStatementSQLExceptionpublic int executeUpdate()
throws SQLException
PreparedStatement object, which must be a CQL Data Manipulation
Language (DML) statement, such as INSERT, UPDATE or DELETE; or a CQL statement that
returns nothing, such as a DDL statement.executeUpdate in interface PreparedStatementSQLException - when something went wrong during the execution of the statement.public ResultSetMetaData getMetaData() throws SQLException
getMetaData in interface PreparedStatementSQLExceptionpublic ParameterMetaData getParameterMetaData() throws SQLException
getParameterMetaData in interface PreparedStatementSQLExceptionpublic void setBigDecimal(int parameterIndex,
BigDecimal x)
throws SQLException
setBigDecimal in interface PreparedStatementSQLExceptionpublic void setBlob(int parameterIndex,
Blob x)
throws SQLException
setBlob in interface PreparedStatementSQLExceptionpublic void setBlob(int parameterIndex,
InputStream inputStream)
throws SQLException
setBlob in interface PreparedStatementSQLExceptionpublic void setBoolean(int parameterIndex,
boolean x)
throws SQLException
setBoolean in interface PreparedStatementSQLExceptionpublic void setByte(int parameterIndex,
byte x)
throws SQLException
setByte in interface PreparedStatementSQLExceptionpublic void setBytes(int parameterIndex,
byte[] x)
throws SQLException
setBytes in interface PreparedStatementSQLExceptionpublic void setCharacterStream(int parameterIndex,
Reader reader,
int length)
throws SQLException
setCharacterStream in interface PreparedStatementSQLExceptionpublic void setDate(int parameterIndex,
Date x)
throws SQLException
setDate in interface PreparedStatementSQLExceptionpublic void setDate(int parameterIndex,
Date x,
Calendar cal)
throws SQLException
setDate in interface PreparedStatementSQLExceptionpublic void setDouble(int parameterIndex,
double x)
throws SQLException
setDouble in interface PreparedStatementSQLExceptionpublic void setDuration(int parameterIndex,
com.datastax.oss.driver.api.core.data.CqlDuration x)
throws SQLException
CqlDuration value.
This method is not JDBC standard but it helps to set DURATION CQL values into a prepared statement.
parameterIndex - The first parameter is 1, the second is 2, ...x - The parameter value.SQLException - if parameterIndex does not correspond to a parameter marker in the CQL statement;
if a database access error occurs or this method is called on a closed PreparedStatement.public void setFloat(int parameterIndex,
float x)
throws SQLException
setFloat in interface PreparedStatementSQLExceptionpublic void setInt(int parameterIndex,
int x)
throws SQLException
setInt in interface PreparedStatementSQLExceptionpublic void setLong(int parameterIndex,
long x)
throws SQLException
setLong in interface PreparedStatementSQLExceptionpublic void setNString(int parameterIndex,
String value)
throws SQLException
setNString in interface PreparedStatementSQLExceptionpublic void setNull(int parameterIndex,
int sqlType)
throws SQLException
setNull in interface PreparedStatementSQLExceptionpublic void setNull(int parameterIndex,
int sqlType,
String typeName)
throws SQLException
setNull in interface PreparedStatementSQLExceptionpublic void setObject(int parameterIndex,
Object x)
throws SQLException
setObject in interface PreparedStatementSQLExceptionpublic void setObject(int parameterIndex,
Object x,
int targetSqlType)
throws SQLException
setObject in interface PreparedStatementSQLExceptionpublic final void setObject(int parameterIndex,
Object x,
int targetSqlType,
int scaleOrLength)
throws SQLException
setObject in interface PreparedStatementSQLExceptionpublic void setRowId(int parameterIndex,
RowId x)
throws SQLException
setRowId in interface PreparedStatementSQLExceptionpublic void setShort(int parameterIndex,
short x)
throws SQLException
setShort in interface PreparedStatementSQLExceptionpublic void setString(int parameterIndex,
String x)
throws SQLException
setString in interface PreparedStatementSQLExceptionpublic void setTime(int parameterIndex,
Time x)
throws SQLException
setTime in interface PreparedStatementSQLExceptionpublic void setTime(int parameterIndex,
Time x,
Calendar cal)
throws SQLException
setTime in interface PreparedStatementSQLExceptionpublic void setTimestamp(int parameterIndex,
Timestamp x)
throws SQLException
setTimestamp in interface PreparedStatementSQLExceptionpublic void setTimestamp(int parameterIndex,
Timestamp x,
Calendar cal)
throws SQLException
setTimestamp in interface PreparedStatementSQLExceptionpublic void setURL(int parameterIndex,
URL value)
throws SQLException
setURL in interface PreparedStatementSQLExceptionpublic <T> void setJson(int parameterIndex,
T x)
throws SQLException
CassandraStatementJsonSupport
Typically, this method can be called to bind a JSON parameter in a CQL query like:
INSERT INTO exampleTable JSON ?;
or on a specific column using with the function fromJson():
INSERT INTO exampleTable (item) VALUES (fromJson(?));
setJson in interface CassandraStatementJsonSupportT - The type of the original object before conversion to a JSON string.parameterIndex - The parameter index (the first parameter is 1).x - The object containing the input parameter value.SQLException - if the parameter index does not correspond to a parameter marker in the SQL statement; if a
database access error occurs; if this method is called on a closed PreparedStatement
or if the object specified by x cannot be converted into a valid JSON string.public ResultSet getResultSet() throws SQLException
getResultSet in interface StatementgetResultSet in class CassandraStatementSQLExceptionpublic void cancel()
throws SQLException
SQLExceptionpublic boolean execute(String cql, int[] columnIndexes) throws SQLException
SQLExceptionpublic boolean execute(String cql, String[] columnNames) throws SQLException
SQLExceptionpublic int executeUpdate(String cql, int[] columnIndexes) throws SQLException
SQLExceptionpublic int executeUpdate(String cql, String[] columnNames) throws SQLException
SQLExceptionpublic ResultSet getGeneratedKeys() throws SQLException
SQLExceptionpublic void setCursorName(String name) throws SQLException
SQLExceptionpublic void closeOnCompletion()
throws SQLException
SQLExceptionpublic boolean isCloseOnCompletion()
throws SQLException
SQLExceptionpublic void setArray(int parameterIndex,
Array x)
throws SQLException
SQLExceptionpublic void setAsciiStream(int parameterIndex,
InputStream x)
throws SQLException
SQLExceptionpublic void setAsciiStream(int parameterIndex,
InputStream x,
int length)
throws SQLException
SQLExceptionpublic void setAsciiStream(int parameterIndex,
InputStream x,
long length)
throws SQLException
SQLExceptionpublic void setBinaryStream(int parameterIndex,
InputStream x)
throws SQLException
SQLExceptionpublic void setBinaryStream(int parameterIndex,
InputStream x,
int length)
throws SQLException
SQLExceptionpublic void setBinaryStream(int parameterIndex,
InputStream x,
long length)
throws SQLException
SQLExceptionpublic void setBlob(int parameterIndex,
InputStream inputStream,
long length)
throws SQLException
SQLExceptionpublic void setCharacterStream(int parameterIndex,
Reader reader)
throws SQLException
SQLExceptionpublic void setCharacterStream(int parameterIndex,
Reader reader,
long length)
throws SQLException
SQLExceptionpublic void setClob(int parameterIndex,
Clob x)
throws SQLException
SQLExceptionpublic void setClob(int parameterIndex,
Reader reader)
throws SQLException
SQLExceptionpublic void setClob(int parameterIndex,
Reader reader,
long length)
throws SQLException
SQLExceptionpublic void setNCharacterStream(int parameterIndex,
Reader value)
throws SQLException
SQLExceptionpublic void setNCharacterStream(int parameterIndex,
Reader value,
long length)
throws SQLException
SQLExceptionpublic void setNClob(int parameterIndex,
NClob value)
throws SQLException
SQLExceptionpublic void setNClob(int parameterIndex,
Reader reader)
throws SQLException
SQLExceptionpublic void setNClob(int parameterIndex,
Reader reader,
long length)
throws SQLException
SQLExceptionpublic void setRef(int parameterIndex,
Ref x)
throws SQLException
SQLExceptionpublic void setSQLXML(int parameterIndex,
SQLXML xmlObject)
throws SQLException
SQLExceptionpublic void setUnicodeStream(int parameterIndex,
InputStream x,
int length)
throws SQLException
SQLExceptionpublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor in interface WrapperSQLExceptionpublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap in interface WrapperSQLExceptionCopyright © 2020–2024 ING Bank. All rights reserved.