|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsqlg2.GBase
public class GBase
Base class for all classes which are processed by preprocessor. Wraps access to JDBC methods allowing preprocessor to intercept them and extract required information. This class itself is not thread-safe, so it cannot be used by more than one thread at a time. Use wrappers generated by preprocessor to access business methods.
Field Summary | |
---|---|
static java.lang.String[] |
ALL_KEYS
Use it for autoKeys parameter of prepareStatementKey(String[], String) to
retrieve all generated columns. |
Constructor Summary | |
---|---|
GBase(LocalWrapperBase lwb)
Constructor. |
Method Summary | ||
---|---|---|
java.lang.Object[] |
callStoredBlock(java.lang.String block,
java.lang.Object... in)
Executes PL/SQL block. |
|
java.lang.Object[] |
callStoredProc(java.lang.String name,
boolean block,
java.lang.Object... in)
Executes stored procedure or PL/SQL block (depending of block parameter). |
|
java.lang.Object[] |
callStoredProc(java.lang.String name,
java.lang.Object... in)
Calls stored procedure. |
|
void |
close(java.sql.ResultSet rs,
java.sql.Statement st)
Closes result set and statement. |
|
void |
close(java.sql.Statement st)
Closes statement. |
|
void |
closeStatements()
Closes all open statements (usually this method is called by wrappers automatically). |
|
|
columnOf(java.lang.Class<T> cls,
java.sql.PreparedStatement stmt)
Executes select query returning single column of T. |
|
double[] |
columnOfDouble(java.sql.PreparedStatement stmt)
Executes select query returning single column of double . |
|
int[] |
columnOfInt(java.sql.PreparedStatement stmt)
Executes select query returning single column of int . |
|
long[] |
columnOfLong(java.sql.PreparedStatement stmt)
Executes select query returning single column of long . |
|
java.lang.Object[] |
columnOfObject(java.sql.PreparedStatement stmt)
Executes select query returning single column of Object . |
|
java.lang.String[] |
columnOfString(java.sql.PreparedStatement stmt)
Executes select query returning single column of String . |
|
static QueryPiece |
createQueryPiece(QueryPiece query)
This is for preprocessor-generated QueryPieces (see Query ). |
|
static QueryPiece |
createQueryPiece(java.lang.String sql)
Creates piece of SQL query consisting only of text. |
|
static QueryPiece |
createQueryPiece(java.lang.String sql,
java.lang.Object[] params,
java.lang.Class<?>[] paramTypes)
This is for preprocessor-generated QueryPieces (see Query ). |
|
static QueryPiece |
createQueryPiece(java.lang.String sql,
java.lang.Object[] params,
java.lang.String stmtId)
This is for preprocessor-generated QueryPieces (see Query ). |
|
java.sql.Statement |
createStatement()
Creates Statement. |
|
void |
endCall(java.sql.CallableStatement stmt)
Closes CallableStatement. |
|
void |
executeCall(java.sql.CallableStatement stmt)
Executes stored procedure or PL/SQL block. |
|
java.lang.Object[] |
executeCall(QueryPiece query)
Executes PL/SQL block constructed from pieces. |
|
java.lang.Object[] |
executeCall(java.lang.String sql,
java.lang.Object... params)
Executes CallableStatement. |
|
java.lang.Object[] |
executeCall(java.lang.String sql,
java.lang.Object[] params,
java.lang.Class<?>[] paramTypes)
This is for preprocessor-generated CallableStatements. |
|
java.lang.Object[] |
executeCall(java.lang.String sql,
java.lang.Object[] params,
java.lang.String stmtId)
This is for preprocessor-generated CallableStatements. |
|
void |
executeSql(java.lang.String sql)
Executes SQL statement. |
|
int |
executeUpdate(java.sql.PreparedStatement stmt)
Executes update/delete/insert SQL statement. |
|
int |
executeUpdate(java.sql.PreparedStatement stmt,
boolean reuse)
Same as executeUpdate(java.sql.PreparedStatement) but closes statement when reuse=false . |
|
static java.math.BigDecimal |
getBigDecimal(java.sql.CallableStatement stmt,
int i)
Returns OUT parameter of stored procedure with index i (from 1) as BigDecimal . |
|
static byte[] |
getBytes(java.sql.CallableStatement stmt,
int i)
Returns OUT parameter of stored procedure with index i (from 1) as byte[] . |
|
static java.sql.Date |
getDate(java.sql.CallableStatement stmt,
int i)
Returns OUT parameter of stored procedure with index i (from 1) as Date . |
|
static java.lang.Double |
getDouble(java.sql.CallableStatement stmt,
int i)
Returns OUT parameter of stored procedure with index i (from 1) as Double . |
|
java.lang.Number[] |
getGeneratedKeys(java.sql.PreparedStatement stmt)
Returns array of auto-generated keys for insert/update statement. |
|
static java.lang.Integer |
getInt(java.sql.CallableStatement stmt,
int i)
Returns OUT parameter of stored procedure with index i (from 1) as Integer . |
|
|
getInterface(java.lang.Class<T> iface)
Returns data access interface generated by preprocessor. |
|
protected java.sql.Connection |
getJdbcConnection()
Access to raw JDBC connection. |
|
static java.lang.Long |
getLong(java.sql.CallableStatement stmt,
int i)
Returns OUT parameter of stored procedure with index i (from 1) as Long . |
|
long |
getNextId(java.lang.String sequence)
Returns next number in sequence. |
|
static java.lang.Object |
getObject(java.sql.CallableStatement stmt,
int i)
Returns OUT parameter of stored procedure with index i (from 1) as Object . |
|
static java.lang.String |
getString(java.sql.CallableStatement stmt,
int i)
Returns OUT parameter of stored procedure with index i (from 1) as String . |
|
static java.sql.Time |
getTime(java.sql.CallableStatement stmt,
int i)
Returns OUT parameter of stored procedure with index i (from 1) as Time . |
|
static java.sql.Timestamp |
getTimestamp(java.sql.CallableStatement stmt,
int i)
Returns OUT parameter of stored procedure with index i (from 1) as Timestamp . |
|
static boolean |
isTesting()
Returns true if method is called at preprocessing time (false at application run time). |
|
|
metaRowQuery(java.sql.PreparedStatement stmt,
java.lang.Class<T> cls)
Returns result set metadata as RowType object. |
|
|
multiRowQuery(java.sql.PreparedStatement stmt,
java.lang.Class<T> cls)
Executes select query returning multiple (zero or more) rows. |
|
|
newRow(java.lang.Class<T> cls)
Create row instance by row type class; class should have EditableRowType annotation. |
|
|
optionalRowQuery(java.sql.PreparedStatement stmt,
java.lang.Class<T> cls)
Same as singleRowQuery(java.sql.PreparedStatement, Class) but returns
null when no rows found. |
|
|
optionalRowQueryReturning(java.lang.Class<T> cls,
java.sql.PreparedStatement stmt)
Same as singleRowQueryReturning(Class, java.sql.PreparedStatement) but returns
null when no rows found. |
|
java.math.BigDecimal |
optionalRowQueryReturningBigDecimal(java.sql.PreparedStatement stmt)
Same as singleRowQueryReturningBigDecimal(java.sql.PreparedStatement) but returns
null when no rows found. |
|
byte[] |
optionalRowQueryReturningBlob(java.sql.PreparedStatement stmt)
Same as singleRowQueryReturningBlob(java.sql.PreparedStatement) but returns
null when no rows found. |
|
byte[] |
optionalRowQueryReturningBytes(java.sql.PreparedStatement stmt)
Same as singleRowQueryReturningBytes(java.sql.PreparedStatement) but returns
null when no rows found. |
|
java.lang.String |
optionalRowQueryReturningClob(java.sql.PreparedStatement stmt)
Same as singleRowQueryReturningClob(java.sql.PreparedStatement) but returns
null when no rows found. |
|
java.sql.Date |
optionalRowQueryReturningDate(java.sql.PreparedStatement stmt)
Same as singleRowQueryReturningDate(java.sql.PreparedStatement) but returns
null when no rows found. |
|
java.lang.Double |
optionalRowQueryReturningDouble(java.sql.PreparedStatement stmt)
Same as singleRowQueryReturningDouble(java.sql.PreparedStatement) but returns
null when no rows found. |
|
java.lang.Integer |
optionalRowQueryReturningInt(java.sql.PreparedStatement stmt)
Same as singleRowQueryReturningInt(java.sql.PreparedStatement) but returns
null when no rows found. |
|
java.lang.Long |
optionalRowQueryReturningLong(java.sql.PreparedStatement stmt)
Same as singleRowQueryReturningLong(java.sql.PreparedStatement) but returns
null when no rows found. |
|
java.lang.Object |
optionalRowQueryReturningObject(java.sql.PreparedStatement stmt)
Same as singleRowQueryReturningObject(java.sql.PreparedStatement) but returns
null when no rows found. |
|
java.lang.String |
optionalRowQueryReturningString(java.sql.PreparedStatement stmt)
Same as singleRowQueryReturningString(java.sql.PreparedStatement) but returns
null when no rows found. |
|
java.sql.Time |
optionalRowQueryReturningTime(java.sql.PreparedStatement stmt)
Same as singleRowQueryReturningTime(java.sql.PreparedStatement) but returns
null when no rows found. |
|
java.sql.Timestamp |
optionalRowQueryReturningTimestamp(java.sql.PreparedStatement stmt)
Same as singleRowQueryReturningTimestamp(java.sql.PreparedStatement) but returns
null when no rows found. |
|
OutParameter |
out(java.lang.Object param)
This is for preprocessor-generated CallableStatements. |
|
static
|
outResultSet(java.lang.Class<T> cls)
Creates OUT parameter for cursor parameters. |
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
Creates CallableStatement for stored procedure (or PL/SQL block) call. |
|
java.sql.PreparedStatement |
prepareStatement(QueryPiece query)
Creates PreparedStatement for further execution. |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Creates PreparedStatement for further execution. |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.Object... params)
Creates PreparedStatement for further execution. |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.Object[] params,
java.lang.Class<?>[] paramTypes)
This is for preprocessor-generated PreparedStatements (see Prepare ). |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.Object[] params,
java.lang.String stmtId)
This is for preprocessor-generated PreparedStatements (see Prepare ). |
|
java.sql.PreparedStatement |
prepareStatementKey(java.lang.String[] autoKeys,
QueryPiece query)
Creates PreparedStatement with auto-generated keys for further execution. |
|
java.sql.PreparedStatement |
prepareStatementKey(java.lang.String[] autoKeys,
java.lang.String sql)
Creates PreparedStatement with auto-generated keys for further execution. |
|
java.sql.PreparedStatement |
prepareStatementKey(java.lang.String[] autoKeys,
java.lang.String sql,
java.lang.Object... params)
Creates PreparedStatement with auto-generated keys for further execution. |
|
java.sql.PreparedStatement |
prepareStatementKey(java.lang.String[] autoKeys,
java.lang.String sql,
java.lang.Object[] params,
java.lang.Class<?>[] paramTypes)
This is for preprocessor-generated PreparedStatements with auto-generated keys (see PrepareKey ). |
|
java.sql.PreparedStatement |
prepareStatementKey(java.lang.String[] autoKeys,
java.lang.String sql,
java.lang.Object[] params,
java.lang.String stmtId)
This is for preprocessor-generated PreparedStatements with auto-generated keys (see PrepareKey ). |
|
void |
setBlob(java.sql.PreparedStatement stmt,
byte[] data)
Writes bytes to BLOB. |
|
void |
setClob(java.sql.PreparedStatement stmt,
java.lang.String text)
Writes text to CLOB. |
|
void |
setParameter(java.sql.PreparedStatement st,
int index,
java.lang.Object param)
|
|
void |
setParameter(java.sql.PreparedStatement st,
int index,
java.lang.Object param,
java.lang.Class<?> cls)
|
|
void |
setParameters(java.sql.PreparedStatement st,
java.lang.Object... in)
Binds prepared statement parameters to specific values. |
|
|
singleRowQuery(java.sql.PreparedStatement stmt,
java.lang.Class<T> cls)
Executes select query, which should return one row (more or less than one rows raises runtime exception). |
|
|
singleRowQueryReturning(java.lang.Class<T> cls,
java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
java.math.BigDecimal |
singleRowQueryReturningBigDecimal(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
byte[] |
singleRowQueryReturningBlob(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
byte[] |
singleRowQueryReturningBytes(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
java.lang.String |
singleRowQueryReturningClob(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
java.sql.Date |
singleRowQueryReturningDate(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
double |
singleRowQueryReturningDouble(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
java.lang.Double |
singleRowQueryReturningDOUBLE(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
int |
singleRowQueryReturningInt(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
java.lang.Integer |
singleRowQueryReturningINT(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
long |
singleRowQueryReturningLong(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
java.lang.Long |
singleRowQueryReturningLONG(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
java.lang.Object |
singleRowQueryReturningObject(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
java.lang.String |
singleRowQueryReturningString(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
java.sql.Time |
singleRowQueryReturningTime(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
java.sql.Timestamp |
singleRowQueryReturningTimestamp(java.sql.PreparedStatement stmt)
Executes select query, which should return one row and one column (more or less than one rows raises runtime exception, more or less than one column raises preprocess-time exception). |
|
void |
traceSql(boolean ok)
SQL tracing. |
|
void |
traceSql(boolean ok,
long t0)
SQL tracing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String[] ALL_KEYS
autoKeys
parameter of prepareStatementKey(String[], String)
to
retrieve all generated columns.
PrepareKey.value()
Constructor Detail |
---|
public GBase(LocalWrapperBase lwb)
lwb
- wrapper for this objectMethod Detail |
---|
public static boolean isTesting()
protected final java.sql.Connection getJdbcConnection() throws java.sql.SQLException
isTesting()
before calling this method.
java.sql.SQLException
public final void traceSql(boolean ok)
ok
- false if SQL caused an errorpublic final void traceSql(boolean ok, long t0)
ok
- false if SQL caused an errort0
- business method start time (as in System.currentTimeMillis()
public final void executeSql(java.lang.String sql) throws java.sql.SQLException
Warning: usually you should call this method only at application run time, not at
preprocess time, because it can alter DB state (for example, when you execute DROP TABLE
statement). Since preprocessor executes business method code and it is undesirable for preprocessor
to alter DB state, calls to this method should be guarded by check of isTesting()
:
if (isTesting()) { executeSql("DROP TABLE BOBBY"); }
sql
- SQL statement to execute
java.sql.SQLException
public final java.sql.Statement createStatement() throws java.sql.SQLException
Warning: usually you should call this method only at application run time, not at
preprocess time, because it can alter DB state (for example, when you execute DROP TABLE
statement). Since preprocessor executes business method code and it is undesirable for preprocessor
to alter DB state, calls to this method should be guarded by check of isTesting()
:
if (isTesting()) { Statement st = createStatement(); st.execute("DROP TABLE BOBBY"); }
java.sql.SQLException
public static QueryPiece createQueryPiece(java.lang.String sql)
sql
- SQL textpublic static QueryPiece createQueryPiece(QueryPiece query)
Query
).
public static QueryPiece createQueryPiece(java.lang.String sql, java.lang.Object[] params, java.lang.Class<?>[] paramTypes)
Query
).
public static QueryPiece createQueryPiece(java.lang.String sql, java.lang.Object[] params, java.lang.String stmtId)
Query
).
public final java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
executeUpdate(java.sql.PreparedStatement)
or by some select method.
It is more convenient to use Prepare
annotation to generate such queries than
to use this method manually.
java.sql.SQLException
public final java.sql.PreparedStatement prepareStatementKey(java.lang.String[] autoKeys, java.lang.String sql) throws java.sql.SQLException
executeUpdate(java.sql.PreparedStatement, boolean)
and generated
keys extracted with getGeneratedKeys(java.sql.PreparedStatement)
.
It is more convenient to use PrepareKey
annotation to generate such queries than
to use this method manually.
autoKeys
- array of column names which are auto-generated. Note that upper/lower case may be significant
(depends on DB).
java.sql.SQLException
public final java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.Object[] params, java.lang.Class<?>[] paramTypes) throws java.sql.SQLException
Prepare
).
Creates PreparedStatement for further execution.
java.sql.SQLException
public final java.sql.PreparedStatement prepareStatementKey(java.lang.String[] autoKeys, java.lang.String sql, java.lang.Object[] params, java.lang.Class<?>[] paramTypes) throws java.sql.SQLException
PrepareKey
).
Creates PreparedStatement for further execution.
java.sql.SQLException
public final java.sql.PreparedStatement prepareStatement(QueryPiece query) throws java.sql.SQLException
executeUpdate(java.sql.PreparedStatement)
or by some select method.
java.sql.SQLException
public final java.sql.PreparedStatement prepareStatementKey(java.lang.String[] autoKeys, QueryPiece query) throws java.sql.SQLException
executeUpdate(java.sql.PreparedStatement, boolean)
and generated
keys extracted with getGeneratedKeys(java.sql.PreparedStatement)
.
autoKeys
- array of column names which are auto-generated. Note that upper/lower case may be significant
(depends on DB).
java.sql.SQLException
public final java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.Object[] params, java.lang.String stmtId) throws java.sql.SQLException
Prepare
).
Creates PreparedStatement for further execution.
java.sql.SQLException
public final java.sql.PreparedStatement prepareStatementKey(java.lang.String[] autoKeys, java.lang.String sql, java.lang.Object[] params, java.lang.String stmtId) throws java.sql.SQLException
PrepareKey
).
Creates PreparedStatement for further execution.
java.sql.SQLException
public final java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.Object... params) throws java.sql.SQLException
executeUpdate(java.sql.PreparedStatement)
or by some select method.
It is more convenient to use Prepare
annotation to generate such queries than
to use this method manually.
params
- parameters for PreparedStatement.setXXX
java.sql.SQLException
public final java.sql.PreparedStatement prepareStatementKey(java.lang.String[] autoKeys, java.lang.String sql, java.lang.Object... params) throws java.sql.SQLException
executeUpdate(java.sql.PreparedStatement, boolean)
and generated
keys extracted with getGeneratedKeys(java.sql.PreparedStatement)
.
It is more convenient to use PrepareKey
annotation to generate such queries than
to use this method manually.
autoKeys
- array of column names which are auto-generated. Note that upper/lower case may be significant
(depends on DB).params
- parameters for PreparedStatement.setXXX
java.sql.SQLException
public final java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
sql
- stored procedure to call.
Syntax is the same as for Connection.prepareCall(String)
:
java.sql.SQLException
public final OutParameter out(java.lang.Object param)
param
- Shoud be an array with at least one element to store output valuepublic static <T> TypedList<T> outResultSet(java.lang.Class<T> cls)
cls
- row type class to be returned from cursorpublic final java.lang.Object[] executeCall(QueryPiece query) throws java.sql.SQLException
query
- query text and parameter values
java.sql.SQLException
public final java.lang.Object[] executeCall(java.lang.String sql, java.lang.Object[] params, java.lang.Class<?>[] paramTypes) throws java.sql.SQLException
java.sql.SQLException
public final java.lang.Object[] executeCall(java.lang.String sql, java.lang.Object[] params, java.lang.String stmtId) throws java.sql.SQLException
java.sql.SQLException
public final java.lang.Object[] executeCall(java.lang.String sql, java.lang.Object... params) throws java.sql.SQLException
params
- parameters for CallableStatement.setXXX. Can contain OutParameter
.
java.sql.SQLException
public final <T> T newRow(java.lang.Class<T> cls)
EditableRowType
annotation.
Returns null
public final int executeUpdate(java.sql.PreparedStatement stmt) throws java.sql.SQLException
PreparedStatement.executeUpdate()
because the latter can modify
database state at preprocess phase.
This method does not close statement, so it can be called multiple times.
You don't have to close statement manually if it was created with prepareStatement(String)
or the like,
because all statements created with GBase
methods are closed automatically after business method exit.
stmt
- SQL statement
java.sql.SQLException
public final int executeUpdate(java.sql.PreparedStatement stmt, boolean reuse) throws java.sql.SQLException
executeUpdate(java.sql.PreparedStatement)
but closes statement when reuse=false
.
stmt
- SQL statementreuse
- false if close statement after execution
java.sql.SQLException
public final java.lang.Number[] getGeneratedKeys(java.sql.PreparedStatement stmt) throws java.sql.SQLException
prepareStatementKey(String[], sqlg2.db.QueryPiece)
autoKeys
parameter or by PrepareKey
annotation value. Number of elements in array equals to the number
of auto-generated columns.
java.sql.SQLException
public final void executeCall(java.sql.CallableStatement stmt) throws java.sql.SQLException
endCall(java.sql.CallableStatement)
to close it.
You can retrieve OUT parameters with getXXX(CallableStatement, int)
methods after call to this method.
java.sql.SQLException
public final void endCall(java.sql.CallableStatement stmt)
public static java.lang.Integer getInt(java.sql.CallableStatement stmt, int i) throws java.sql.SQLException
Integer
.
java.sql.SQLException
public static java.lang.Long getLong(java.sql.CallableStatement stmt, int i) throws java.sql.SQLException
Long
.
java.sql.SQLException
public static java.lang.Double getDouble(java.sql.CallableStatement stmt, int i) throws java.sql.SQLException
Double
.
java.sql.SQLException
public static java.lang.String getString(java.sql.CallableStatement stmt, int i) throws java.sql.SQLException
String
.
java.sql.SQLException
public static byte[] getBytes(java.sql.CallableStatement stmt, int i) throws java.sql.SQLException
byte[]
.
java.sql.SQLException
public static java.math.BigDecimal getBigDecimal(java.sql.CallableStatement stmt, int i) throws java.sql.SQLException
BigDecimal
.
java.sql.SQLException
public static java.sql.Date getDate(java.sql.CallableStatement stmt, int i) throws java.sql.SQLException
Date
.
java.sql.SQLException
public static java.sql.Time getTime(java.sql.CallableStatement stmt, int i) throws java.sql.SQLException
Time
.
java.sql.SQLException
public static java.sql.Timestamp getTimestamp(java.sql.CallableStatement stmt, int i) throws java.sql.SQLException
Timestamp
.
java.sql.SQLException
public static java.lang.Object getObject(java.sql.CallableStatement stmt, int i) throws java.sql.SQLException
Object
.
java.sql.SQLException
public final int singleRowQueryReturningInt(java.sql.PreparedStatement stmt) throws java.sql.SQLException
int
.
Closes statement after execution.
java.sql.SQLException
public final long singleRowQueryReturningLong(java.sql.PreparedStatement stmt) throws java.sql.SQLException
long
.
Closes statement after execution.
java.sql.SQLException
public final double singleRowQueryReturningDouble(java.sql.PreparedStatement stmt) throws java.sql.SQLException
double
.
Closes statement after execution.
java.sql.SQLException
public final java.lang.Integer singleRowQueryReturningINT(java.sql.PreparedStatement stmt) throws java.sql.SQLException
Integer
.
Closes statement after execution.
java.sql.SQLException
public final java.lang.Long singleRowQueryReturningLONG(java.sql.PreparedStatement stmt) throws java.sql.SQLException
Long
.
Closes statement after execution.
java.sql.SQLException
public final java.lang.Double singleRowQueryReturningDOUBLE(java.sql.PreparedStatement stmt) throws java.sql.SQLException
Double
.
Closes statement after execution.
java.sql.SQLException
public final java.lang.String singleRowQueryReturningString(java.sql.PreparedStatement stmt) throws java.sql.SQLException
String
.
Closes statement after execution.
java.sql.SQLException
public final byte[] singleRowQueryReturningBytes(java.sql.PreparedStatement stmt) throws java.sql.SQLException
byte[]
.
Closes statement after execution.
java.sql.SQLException
public final java.math.BigDecimal singleRowQueryReturningBigDecimal(java.sql.PreparedStatement stmt) throws java.sql.SQLException
BigDecimal
.
Closes statement after execution.
java.sql.SQLException
public final java.sql.Date singleRowQueryReturningDate(java.sql.PreparedStatement stmt) throws java.sql.SQLException
Date
.
Closes statement after execution.
java.sql.SQLException
public final java.sql.Time singleRowQueryReturningTime(java.sql.PreparedStatement stmt) throws java.sql.SQLException
Time
.
Closes statement after execution.
java.sql.SQLException
public final java.sql.Timestamp singleRowQueryReturningTimestamp(java.sql.PreparedStatement stmt) throws java.sql.SQLException
Timestamp
.
Closes statement after execution.
java.sql.SQLException
public final java.lang.Object singleRowQueryReturningObject(java.sql.PreparedStatement stmt) throws java.sql.SQLException
Object
.
Closes statement after execution.
java.sql.SQLException
public final java.lang.String singleRowQueryReturningClob(java.sql.PreparedStatement stmt) throws java.sql.SQLException
String
.
Closes statement after execution.
java.sql.SQLException
public final byte[] singleRowQueryReturningBlob(java.sql.PreparedStatement stmt) throws java.sql.SQLException
byte[]
.
Closes statement after execution.
java.sql.SQLException
public final <T extends MappedType> T singleRowQueryReturning(java.lang.Class<T> cls, java.sql.PreparedStatement stmt) throws java.sql.SQLException
cls
- class with user-defined mapping
java.sql.SQLException
public final java.lang.Integer optionalRowQueryReturningInt(java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturningInt(java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final java.lang.Long optionalRowQueryReturningLong(java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturningLong(java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final java.lang.Double optionalRowQueryReturningDouble(java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturningDouble(java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final java.lang.String optionalRowQueryReturningString(java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturningString(java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final byte[] optionalRowQueryReturningBytes(java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturningBytes(java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final java.math.BigDecimal optionalRowQueryReturningBigDecimal(java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturningBigDecimal(java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final java.sql.Date optionalRowQueryReturningDate(java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturningDate(java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final java.sql.Time optionalRowQueryReturningTime(java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturningTime(java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final java.sql.Timestamp optionalRowQueryReturningTimestamp(java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturningTimestamp(java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final java.lang.String optionalRowQueryReturningClob(java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturningClob(java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final byte[] optionalRowQueryReturningBlob(java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturningBlob(java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final java.lang.Object optionalRowQueryReturningObject(java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturningObject(java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final <T extends MappedType> T optionalRowQueryReturning(java.lang.Class<T> cls, java.sql.PreparedStatement stmt) throws java.sql.SQLException
singleRowQueryReturning(Class, java.sql.PreparedStatement)
but returns
null when no rows found.
Closes statement after execution.
cls
- class with user-defined mapping
java.sql.SQLException
public final int[] columnOfInt(java.sql.PreparedStatement stmt) throws java.sql.SQLException
int
.
Closes statement after execution.
java.sql.SQLException
public final long[] columnOfLong(java.sql.PreparedStatement stmt) throws java.sql.SQLException
long
.
Closes statement after execution.
java.sql.SQLException
public final double[] columnOfDouble(java.sql.PreparedStatement stmt) throws java.sql.SQLException
double
.
Closes statement after execution.
java.sql.SQLException
public final java.lang.String[] columnOfString(java.sql.PreparedStatement stmt) throws java.sql.SQLException
String
.
Closes statement after execution.
java.sql.SQLException
public final java.lang.Object[] columnOfObject(java.sql.PreparedStatement stmt) throws java.sql.SQLException
Object
.
Closes statement after execution.
java.sql.SQLException
public final <T extends MappedType> java.util.List<T> columnOf(java.lang.Class<T> cls, java.sql.PreparedStatement stmt) throws java.sql.SQLException
cls
- class with user-defined mapping
java.sql.SQLException
public final <T> T singleRowQuery(java.sql.PreparedStatement stmt, java.lang.Class<T> cls) throws java.sql.SQLException
stmt
- SQL statementcls
- row type class or interface generated by preprocessor (see RowType
).
java.sql.SQLException
public final <T> T optionalRowQuery(java.sql.PreparedStatement stmt, java.lang.Class<T> cls) throws java.sql.SQLException
singleRowQuery(java.sql.PreparedStatement, Class)
but returns
null when no rows found.
Closes statement after execution.
java.sql.SQLException
public final <T> java.util.List<T> multiRowQuery(java.sql.PreparedStatement stmt, java.lang.Class<T> cls) throws java.sql.SQLException
stmt
- SQL statementcls
- row type class or interface generated by preprocessor (see RowType
).
java.sql.SQLException
public final <T> T metaRowQuery(java.sql.PreparedStatement stmt, java.lang.Class<T> cls) throws java.sql.SQLException
java.sql.SQLException
public final void close(java.sql.Statement st)
public final void close(java.sql.ResultSet rs, java.sql.Statement st)
public final void closeStatements()
public final void setClob(java.sql.PreparedStatement stmt, java.lang.String text) throws java.sql.SQLException
SELECT … FOR UPDATE
SQL statement.
This method does NOT write EMPTY_CLOB
before writing data, so you should
do it yourself if required.
Closes statement after execution.
stmt
- SELECT … FOR UPDATE
SQL statementtext
- text to write
java.sql.SQLException
public final void setBlob(java.sql.PreparedStatement stmt, byte[] data) throws java.sql.SQLException
SELECT … FOR UPDATE
SQL statement.
This method does NOT write EMPTY_BLOB
before writing data, so you should
do it yourself if required.
Closes statement after execution.
stmt
- SELECT … FOR UPDATE
SQL statementdata
- bytes to write
java.sql.SQLException
public final long getNextId(java.lang.String sequence) throws java.sql.SQLException
sequence
- sequence name
java.sql.SQLException
public final void setParameters(java.sql.PreparedStatement st, java.lang.Object... in) throws java.sql.SQLException
MappedType
.
Effect is the same as for
setParameter(st, 1, in[0]);
...
setParameter(st, n, in[n - 1]);
st
- SQL statementin
- parameter values
java.sql.SQLException
public final void setParameter(java.sql.PreparedStatement st, int index, java.lang.Object param, java.lang.Class<?> cls) throws java.sql.SQLException
java.sql.SQLException
public final void setParameter(java.sql.PreparedStatement st, int index, java.lang.Object param) throws java.sql.SQLException
java.sql.SQLException
public final java.lang.Object[] callStoredProc(java.lang.String name, java.lang.Object... in) throws java.sql.SQLException
setParameters(java.sql.PreparedStatement, Object...)
.
name
- Stored procedure name. SQL statement is generated by procedure name
and parameters count as { call proc_name(in) }
.in
- input/output parameters array (see setParameters(java.sql.PreparedStatement, Object...)
).
Can contain objects of type OutParameter
.
TINYINT | Byte |
SMALLINT | Short |
INTEGER | Integer |
BIGINT | Long |
FLOAT | Float |
REAL, DOUBLE | Double |
DECIMAL, NUMERIC | BigDecimal |
CHAR, VARCHAR | String |
BINARY, VARBINARY | byte[] |
DATE | Date |
TIME | Time |
TIMESTAMP | Timestamp |
CLOB | String |
BLOB | byte[] |
OTHER | Object |
java.sql.SQLException
public final java.lang.Object[] callStoredBlock(java.lang.String block, java.lang.Object... in) throws java.sql.SQLException
callStoredProc(String, Object...)
.
block
- PL/SQL block text
java.sql.SQLException
public final java.lang.Object[] callStoredProc(java.lang.String name, boolean block, java.lang.Object... in) throws java.sql.SQLException
block
parameter).
If block == true
then callStoredBlock(String, Object...)
is executed,
else if block == false
then callStoredProc(String, Object...)
is executed.
java.sql.SQLException
public final <T extends LIDBCommon> T getInterface(java.lang.Class<T> iface)
SQLG
annotation having attribute
SQLG.inline()
= true
.
iface
- interface class
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |