public class SqlExecutor
extends java.lang.Object
implements java.lang.AutoCloseable
| Constructor and Description |
|---|
SqlExecutor(java.sql.Connection con,
java.lang.String sql,
long maxAttachmentSize,
MessageCollector messages) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
close statement and db connection.
|
java.util.Collection<Record> |
execute(java.util.List<Value> parameters) |
Record |
executeAndMerge(java.util.List<Value> parameters) |
int |
executeUpdate(java.util.List<Value> parameters) |
int |
executeUpdate(java.util.List<Value> parameters,
int nullType)
execute update, supports null parameter values, too.
|
protected void |
finalize() |
java.lang.String |
getSql() |
public SqlExecutor(java.sql.Connection con,
java.lang.String sql,
long maxAttachmentSize,
MessageCollector messages)
throws java.sql.SQLException
con - a database connectionsql - an SQL statement which will be used as PreparedStatement, so it may contain '?' parameters.java.sql.SQLExceptionpublic java.lang.String getSql()
public Record executeAndMerge(java.util.List<Value> parameters) throws java.sql.SQLException, java.io.IOException
parameters - the parameters for the SQL (Prepared)statement given in the constructor. Values must not be null.java.sql.SQLExceptionjava.io.IOExceptionpublic java.util.Collection<Record> execute(java.util.List<Value> parameters) throws java.sql.SQLException, java.io.IOException
parameters - the parameters for the SQL (Prepared)statement given in the constructor. Values must not be null.java.sql.SQLExceptionjava.io.IOExceptionpublic int executeUpdate(java.util.List<Value> parameters) throws java.sql.SQLException, java.io.IOException
parameters - the parameters for the SQL (Prepared)statement given in the constructor. Values must not be null.java.sql.SQLExceptionjava.io.IOExceptionpublic int executeUpdate(java.util.List<Value> parameters, int nullType) throws java.sql.SQLException, java.io.IOException
parameters - the parameters for the SQL (Prepared)statement given in the constructor.nullType - SQL type for null values in parameters, see Types.java.sql.SQLExceptionjava.io.IOExceptionpublic void close()
close in interface java.lang.AutoCloseableprotected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable