@NotThreadSafe public class SQLProcessor extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SQLProcessor.CommitMode |
| Modifier and Type | Field and Description |
|---|---|
static String |
module
Module Name Used for debugging
|
static DatabaseType |
MSSQL |
| Constructor and Description |
|---|
SQLProcessor(String helperName)
Construct a SQLProcessor based on the helper/datasource.
|
SQLProcessor(String helperName,
Connection connection)
Construct a SQLProcessor with an connection given.
|
| Modifier and Type | Method and Description |
|---|---|
SQLProcessor |
addBatch()
Adds a set of parameters to underlying PreparedStatement object's batch of commands.
|
void |
close()
Commit if required and remove all allocated resources
|
void |
commit()
Commit all modifications
|
void |
execQuery(String sql,
ExecQueryCallbackFunctionIF aListener)
Execute a query based on the SQL string given.
|
int[] |
executeBatch()
Execute a batch query based on the prepared statement
|
ResultSet |
executeQuery()
Execute a query based on the prepared statement
|
ResultSet |
executeQuery(String sql)
Execute a query based on the SQL string given
|
int |
executeUpdate()
Execute updates
|
int |
executeUpdate(String sql)
Execute update based on the SQL statement given
|
SQLProcessor.CommitMode |
getCommitMode() |
Connection |
getConnection()
Get a connection from the ConnectionFactory
|
PreparedStatement |
getPreparedStatement()
Getter: get the prepared statement
|
ResultSet |
getResultSet()
Getter: get the currently activ ResultSet
|
boolean |
next()
Test if there more records available
|
SQLProcessor |
prepareStatement(String sql)
Prepare a statement.
|
SQLProcessor |
prepareStatement(String sql,
boolean specifyTypeAndConcur,
int resultSetType,
int resultSetConcurrency)
Prepare a statement.
|
void |
rollback()
Rollback all modifications
|
SQLProcessor |
setBinaryStream(Object field)
Set the next binding variable of the currently active prepared statement to write the serialized data of 'field'
to a BLOB that is stored as an OID SQL type.
|
SQLProcessor |
setBlob(byte[] field)
Set the next binding variable of the currently active prepared statement.
|
SQLProcessor |
setByteArray(byte[] field)
Set the next binding variable of the currently active prepared statement.
|
SQLProcessor |
setByteArrayData(Object field)
Set the next binding variable of the currently active prepared statement to write the serialized data of 'field'
to a BLOB that is stored as a Byte Array SQL type.
|
SQLProcessor |
setValue(Blob field)
Set the next binding variable of the currently active prepared statement
|
SQLProcessor |
setValue(Boolean field)
Set the next binding variable of the currently active prepared statement.
|
SQLProcessor |
setValue(Clob field)
Set the next binding variable of the currently active prepared statement
|
SQLProcessor |
setValue(Date field)
Set the next binding variable of the currently active prepared statement.
|
SQLProcessor |
setValue(Double field)
Set the next binding variable of the currently active prepared statement.
|
SQLProcessor |
setValue(Float field)
Set the next binding variable of the currently active prepared statement.
|
SQLProcessor |
setValue(Integer field)
Set the next binding variable of the currently active prepared statement.
|
SQLProcessor |
setValue(Long field)
Set the next binding variable of the currently active prepared statement.
|
SQLProcessor |
setValue(Object field)
Set the next binding variable of the currently active prepared statement.
|
SQLProcessor |
setValue(String field)
Set the next binding variable of the currently active prepared statement.
|
SQLProcessor |
setValue(Time field)
Set the next binding variable of the currently active prepared statement.
|
SQLProcessor |
setValue(Timestamp field)
Set the next binding variable of the currently active prepared statement.
|
String |
toString() |
public static final String module
public static final DatabaseType MSSQL
public SQLProcessor(String helperName)
It will be in SQLProcessor.CommitMode.EXPLICIT_COMMIT by default
This is the legacy mode of SQLProcessor as it was before the CommitMode support was added. This constructor has been left in place because other plugins may be using it and hence to preserve the API.
helperName - The datasource helper (see entityengine.xml <datasource name="..">)public SQLProcessor(String helperName, Connection connection)
It does not participate in any commiting not does it set the autoCommit mode of the connection
helperName - The datasource helper (see entityengine.xml <datasource name="..">)connection - The connection to be usedpublic SQLProcessor.CommitMode getCommitMode()
SQLProcessor.CommitMode the SQLProcessor is inpublic void commit()
throws GenericDataSourceException
GenericDataSourceException - if an SQLException occurspublic void rollback()
throws GenericDataSourceException
GenericDataSourceException - if an SQLException occurspublic void close()
throws GenericDataSourceException
GenericDataSourceException - if an SQLException occurspublic Connection getConnection() throws GenericEntityException
GenericEntityException - if an SQLException occurspublic SQLProcessor prepareStatement(String sql) throws GenericEntityException
sql - The SQL statement to be executedGenericEntityException - if an SQLException occurspublic SQLProcessor prepareStatement(String sql, boolean specifyTypeAndConcur, int resultSetType, int resultSetConcurrency) throws GenericEntityException
sql - The SQL statement to be executedspecifyTypeAndConcur - true if the result set Type and Concurrency has been specifiedresultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVEresultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or
ResultSet.CONCUR_UPDATABLEGenericEntityException - if an SQLException occurspublic ResultSet executeQuery() throws GenericDataSourceException
GenericDataSourceException - if an SQLException occurspublic ResultSet executeQuery(String sql) throws GenericEntityException
sql - The SQL string to be executedGenericDataSourceException - if an SQLException occursGenericEntityExceptionpublic int executeUpdate()
throws GenericDataSourceException
GenericDataSourceException - if an SQLException occurspublic int executeUpdate(String sql) throws GenericDataSourceException
sql - SQL statement to be executedGenericDataSourceException - if an SQLException occurs or (2) 0 for SQL statements that return nothingpublic int[] executeBatch()
throws GenericDataSourceException
GenericDataSourceException - if an SQLException occursStatement.executeBatch(),
PreparedStatement.addBatch()public boolean next()
throws GenericDataSourceException
GenericDataSourceException - if an SQLException occurspublic ResultSet getResultSet()
public PreparedStatement getPreparedStatement()
public void execQuery(String sql, ExecQueryCallbackFunctionIF aListener) throws GenericEntityException
sql - The SQL string to be executedaListener - The callback function objectGenericEntityException - if an SQLException occurspublic SQLProcessor setValue(String field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor setValue(Timestamp field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor setValue(Time field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor setValue(Date field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor setValue(Integer field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor setValue(Long field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor setValue(Float field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor setValue(Double field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor setValue(Boolean field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor setValue(Object field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor setValue(Blob field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor setValue(Clob field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor setBlob(byte[] field) throws SQLException
BLOB field, not a PostgreSQL BYTEA, a
SQLServer IMAGE, or an HSQL OTHER field. Use setByteArray(byte[])
to set those!field - the field valueSQLException - if something goes wrongpublic SQLProcessor setByteArray(byte[] field) throws SQLException
BYTEA, a SQLServer IMAGE,
or an HSQL OTHER field. Use setBlob(byte[]) to set BLOBs!field - the field valueSQLException - if something goes wrongpublic SQLProcessor setBinaryStream(Object field) throws SQLException
field - the field value in playSQLException - if somethings goes wrongpublic SQLProcessor addBatch() throws SQLException
SQLException - is something goes wrongPreparedStatement.addBatch()public SQLProcessor setByteArrayData(Object field) throws SQLException
This method is specifically added to support PostgreSQL BYTEA and SQLServer IMAGE datatypes.
field - the field value in playSQLException - if something goes wrongCopyright © 2024 Atlassian. All rights reserved.