public abstract class FndStatement extends java.lang.Object implements ifs.fnd.sf.admin.FndAbortableProcess, FndSqlData, java.lang.AutoCloseable
This is a framework internal class! Backward compatibility is not guaranteed.
Modifier and Type | Field and Description |
---|---|
protected java.sql.Connection |
c
Internal connection.
|
protected boolean |
callable
Flag indicating if the statement is a procedure call.
|
protected static int |
DEFAULT_BUFFER_SIZE
Default Buffer Size (65536)
|
protected Logger |
log
Database logger
|
protected java.util.List<FndSqlValue> |
parameters
List of parameters.
|
protected FndResultSet |
result
Internal result set.
|
protected java.sql.PreparedStatement |
stmt
Internal statement.
|
protected java.util.Calendar |
utcCalendar
Create a calendar object for TimeStamps to be in UTC Time
|
Modifier | Constructor and Description |
---|---|
protected |
FndStatement(FndConnection fndConnection)
Creates a new instance of FndStatement
|
Modifier and Type | Method and Description |
---|---|
void |
abort()
Attempt to abort an executing statement.
|
protected void |
bindArguments()
Bind arguments to statement and register out parameters (if any).
|
protected abstract void |
checkError(java.sql.SQLException e)
Check if the original error should be re-thrown as some other kind of error.
|
void |
checkResult()
Verify that a result exists.
|
void |
clearFetchedSize()
Clears the internal counter with approximate number of bytes fetched by query operation.
|
void |
clearParameters()
Clear previously defined parameters.
|
void |
clearParameters(int index)
Clear previously defined parameters beginning at the specified index.
|
void |
close()
Close internal JDBC statement.
|
boolean |
closeRefCursorStatement()
Check if the statement that returned a REF CURSOR should be closed after retrieving the cursor.
|
protected void |
debugNull(FndSqlValue val,
int colNr)
Used to debug null valued bind parameter.
|
void |
defineInOutParameter(FndSqlValue value)
Define an inout parameter for a procedure call.
|
void |
defineInParameter(FndAttribute attr)
Bind an argument (attribute value).
|
void |
defineInParameter(FndSqlValue value)
Bind an argument.
|
void |
defineOutParameter(java.lang.String name,
FndSqlType type)
Define an out parameter for a procedure call.
|
void |
defineParameter(FndSqlValue value)
Define a parameter.
|
boolean |
defineRefCursorVariable()
Check if REF CURSOR bind variable should be registered as OUT parameter.
|
boolean |
execute()
Execute any kind of statement.
|
boolean |
execute(boolean registerAsAbortableProcess)
Execute any kind of statement.
|
void |
executeQuery()
Execute SQL query and register this statement as an abortable process.
|
void |
executeQuery(boolean registerAsAbortableProcess)
Execute SQL query.
|
int |
executeUpdate()
Execute SQL update/insert/delete.
|
protected java.lang.String |
formatSize(int size)
Formats size into a String.
|
java.math.BigDecimal |
getBigDecimal(int colNr)
Get column (decimal) value from database (can only be used after executeQuery).
|
byte[] |
getBinary(int colNr)
Get column (binary) value from database (can only be used after executeQuery).
|
boolean |
getBinary(int colNr,
FndOutputStreamManager outputMgr)
Get column (binary) value from database into a stream.
|
protected java.sql.Blob |
getBlob(int colNr)
Get Blob locator.
|
boolean |
getBoolean(int colNr)
Get column (boolean) value from database (can only be used after executeQuery).
|
protected int |
getBufferSize(java.sql.Blob blob)
Get the buffer size to use when reading Blob.
|
protected int |
getBufferSize(java.sql.Clob clob)
Get the buffer size to use when reading Clob.
|
protected java.sql.Clob |
getClob(int colNr)
Get Clob locator.
|
java.sql.ResultSet |
getCursor(int parameterIndex)
Deprecated.
use getFndCursor() instead
|
java.sql.Date |
getDate(int colNr)
Get column (date) value from database (can only be used after executeQuery).
|
double |
getDouble(int colNr)
Get column (double) value from database (can only be used after executeQuery).
|
long |
getFetchedSize()
Gets approximate number of bytes fetched by query operation.
|
protected FndConnection |
getFndConnection()
Gets the instance of FndConnection that owns this statement.
|
FndResultSet |
getFndCursor(int parameterIndex)
Get Ref Cursor value from a procedure call.
|
FndResultSet |
getFndResult()
Get result set from executed statement.
|
int |
getInt(int colNr)
Get column (int) value from database (can only be used after executeQuery).
|
long |
getLong(int colNr)
Get column (long) value from database (can only be used after executeQuery).
|
byte[] |
getLongRaw(int colNr)
Get column (binary) value from database (can only be used after executeQuery).
|
java.lang.String |
getLongText(int colNr)
Get column (long text) value from database (can only be used after executeQuery).
|
protected java.lang.String |
getLongTextImpl(int colNr) |
protected java.lang.String |
getMessage(java.lang.Exception e)
Returns error message for given Exception removing white space from both ends of the string.
|
protected java.math.BigDecimal |
getOutBigDecimal(int parameterIndex) |
protected boolean |
getOutBoolean(int parameterIndex)
Get a out-parameter value
|
protected java.sql.Date |
getOutDate(int parameterIndex) |
protected double |
getOutDouble(int parameterIndex) |
protected int |
getOutInt(int parameterIndex) |
protected long |
getOutLong(int parameterIndex) |
protected byte[] |
getOutLongRaw(int parameterIndex)
Get a out-parameter value
|
protected java.lang.String |
getOutString(int parameterIndex)
Get an out-parameter value.
|
protected java.sql.Time |
getOutTime(int parameterIndex) |
protected java.sql.Timestamp |
getOutTimestamp(int parameterIndex)
Get timestamp value from an out parameter.
|
FndRefCursor |
getRefCursor()
Retrieves the REF CURSOR returned by this statement.
|
java.sql.ResultSet |
getResult()
Deprecated.
use getFndResult() instead
|
java.lang.String |
getSqlText() |
java.lang.String |
getString(int colNr)
Get column (string) value from database (can only be used after executeQuery).
|
java.lang.String |
getText(int colNr)
Get column (text) value from database (can only be used after executeQuery).
|
java.sql.Time |
getTime(int colNr)
Get column (time) value from database (can only be used after executeQuery).
|
java.sql.Timestamp |
getTimestamp(int colNr)
Get timestamp value from a executed statement or procedure call.
|
protected boolean |
isShortClobParameter(int pos)
Checks if the parameter bound at the specified position is a short (less than 32K) CLOB.
|
protected java.lang.String |
nativeSql(FndAutoString sql)
Convert sql string to native sql (as translated by the driver).
|
protected java.lang.String |
nativeSql(java.lang.String sql)
Convert sql string to native sql (as translated by the driver).
|
boolean |
parameterWasNull()
Retrieves whether the last OUT parameter read had the value of SQL NULL.
|
void |
prepare(FndAutoString sql)
Prepare SQL statement.
|
void |
prepare(FndAutoString sql,
boolean updateable)
Prepare SQL statement and control if resultset should be updateable or not.
|
void |
prepare(java.lang.String sql)
Prepare SQL statement.
|
void |
prepare(java.lang.String sql,
boolean updateable)
Prepare SQL statement and control if resultset should be updateable or not.
|
void |
prepareCall(FndAutoString sql)
Prepare a procedure call.
|
void |
prepareCall(java.lang.String sql)
Prepare a procedure call.
|
protected void |
prepareStatement(FndAutoString sql,
boolean updateable)
Prepare SQL statement.
|
protected void |
prepareStatement(java.lang.String sql,
boolean updateable)
Prepare SQL statement.
|
void |
recreateLogger()
Recreates the logger stored in a protected instance variable.
|
protected void |
registerOutParameter(FndSqlValue param,
int parameterIndex)
Register a out/inout parameter.
|
protected abstract void |
reportSqlError(java.sql.SQLException error)
Spool information about an SQL error to debug or standard output.
|
boolean |
resultWasNull()
Check if result from last fetched value from executed statement was null.
|
protected void |
setDouble(int colNr,
double value)
Bind double parameter.
|
void |
setFetchSize(int size)
Set pre-fetch size to use on this statement.
|
void |
setMaxRows(int max)
Set maximum number of rows to fetch.
|
void |
setRecursive()
Indicates that this statement is a recursive, framework generated, statement.
|
void |
setSpoolPlsqlTrace(boolean on)
Enable or disable spooling of PL/SQL trace.
|
protected abstract void |
setTimestamp(int colNr,
java.sql.Timestamp value)
Bind Timestamp parameter as Oracle DATE type.
|
protected void |
spoolPlSqlTrace()
Spool trace from PlSql call to the database logger.
|
boolean |
supportsDefineColumnType()
Check if this statement supports defineColumnType-functionality.
|
protected int |
toJavaSqlType(FndSqlType type)
Convert a FndSqlType to it's corresponding Java SQL type
|
protected boolean callable
protected java.util.List<FndSqlValue> parameters
protected java.sql.PreparedStatement stmt
protected java.sql.Connection c
protected FndResultSet result
protected Logger log
protected final java.util.Calendar utcCalendar
protected static final int DEFAULT_BUFFER_SIZE
protected FndStatement(FndConnection fndConnection)
fndConnection
- public void recreateLogger()
protected boolean isShortClobParameter(int pos)
pos
- 1-based positions of a bind variablepublic void clearFetchedSize()
public long getFetchedSize()
protected FndConnection getFndConnection()
public final void abort() throws SystemException
abort
in interface ifs.fnd.sf.admin.FndAbortableProcess
SystemException
protected void spoolPlSqlTrace() throws IfsException
IfsException
protected abstract void checkError(java.sql.SQLException e) throws IfsException
e
- Original exception thrown from databaseIfsException
- May re-throw the exception.public void setSpoolPlsqlTrace(boolean on)
on
- true to enable spooling of PL/SQL trace, false to disable.public void setFetchSize(int size) throws IfsException
size
- Pre-fetch size (number of rows)IfsException
public void setMaxRows(int max) throws IfsException
max
- Maximum number of rows.IfsException
public void clearParameters()
public void clearParameters(int index)
index
- the index of the first parameter to be cleared.protected void debugNull(FndSqlValue val, int colNr)
val
- Value of bind parametercolNr
- Bind parameter column number in statementprotected java.lang.String nativeSql(java.lang.String sql)
sql
- String containing SQL string.protected java.lang.String nativeSql(FndAutoString sql)
sql
- FndAutoString containing SQL string.protected abstract void setTimestamp(int colNr, java.sql.Timestamp value) throws IfsException
colNr
- column number.value
- parameter value.IfsException
protected void setDouble(int colNr, double value) throws IfsException, java.sql.SQLException
colNr
- column number.value
- parameter value.IfsException
java.sql.SQLException
protected void bindArguments() throws IfsException, java.sql.SQLException
IfsException
java.sql.SQLException
protected void registerOutParameter(FndSqlValue param, int parameterIndex) throws IfsException
param
- Parameter to register as an out parameterparameterIndex
- index position of parameter in procedure callIfsException
public void prepareCall(java.lang.String sql) throws IfsException
sql
- SQL stringIfsException
public void prepareCall(FndAutoString sql) throws IfsException
sql
- SQL string buffer.IfsException
public void prepare(FndAutoString sql) throws IfsException
sql
- SQL string buffer.IfsException
public void prepare(java.lang.String sql) throws IfsException
sql
- SQL string.IfsException
public void prepare(FndAutoString sql, boolean updateable) throws IfsException
sql
- SQL string buffer.updateable
- Indicates if resultset should be updateable or not.IfsException
public void prepare(java.lang.String sql, boolean updateable) throws IfsException
sql
- SQL string.updateable
- Indicates if resultset should be updateable or not.IfsException
protected void prepareStatement(FndAutoString sql, boolean updateable) throws IfsException
sql
- SQL string.updateable
- Flag controlling if result set should be updateable or not.IfsException
protected void prepareStatement(java.lang.String sql, boolean updateable) throws IfsException
sql
- SQL string.updateable
- Flag controlling if result set should be updateable or not.IfsException
public final void executeQuery() throws IfsException
IfsException
public final void executeQuery(boolean registerAsAbortableProcess) throws IfsException
registerAsAbortableProcess
- flag indicating if this statement should be registered on FndProcessList as an abortable processIfsException
public final int executeUpdate() throws IfsException
IfsException
- an error occurs in the driver/database.public final boolean execute() throws IfsException
IfsException
public final boolean execute(boolean registerAsAbortableProcess) throws IfsException
registerAsAbortableProcess
- Should this statement be abortable (using Abort Request from client)?IfsException
public java.sql.ResultSet getResult() throws SystemException
SystemException
- if result is null.getFndResult()
public FndResultSet getFndResult() throws SystemException
SystemException
- if result is null.public boolean resultWasNull() throws IfsException
IfsException
public void close() throws SystemException
close
in interface java.lang.AutoCloseable
SystemException
public void defineInParameter(FndAttribute attr) throws SystemException
attr
- Source attribute (Parameter direction set to In.)SystemException
public void defineInParameter(FndSqlValue value) throws SystemException
value
- Bind argument value (parameter direction will be set to In.)SystemException
public void defineParameter(FndSqlValue value)
value
- Parameter value. (Parameter direction set on value will be used.)public void defineOutParameter(java.lang.String name, FndSqlType type) throws SystemException
name
- Parameter nametype
- Type returned in this parameterSystemException
public void defineInOutParameter(FndSqlValue value) throws SystemException
value
- Value of inparameter.SystemException
public void checkResult() throws SystemException
SystemException
- if null.public java.lang.String getString(int colNr) throws IfsException
getString
in interface FndSqlData
colNr
- index number.IfsException
protected java.lang.String getOutString(int parameterIndex) throws java.sql.SQLException
parameterIndex
- java.sql.SQLException
public java.lang.String getText(int colNr) throws IfsException
getText
in interface FndSqlData
colNr
- index number.IfsException
public boolean getBoolean(int colNr) throws IfsException
getBoolean
in interface FndSqlData
colNr
- index number.IfsException
protected boolean getOutBoolean(int parameterIndex) throws java.sql.SQLException
parameterIndex
- java.sql.SQLException
protected int getBufferSize(java.sql.Blob blob)
blob
- Blob to get optimal buffer size for.public byte[] getBinary(int colNr) throws IfsException
getBinary
in interface FndSqlData
colNr
- index number.SystemException
IfsException
public boolean getBinary(int colNr, FndOutputStreamManager outputMgr) throws IfsException
getBinary
in interface FndSqlData
colNr
- column index number.outputMgr
- an output stream manager that controlls streaming of data from the databaseIfsException
public byte[] getLongRaw(int colNr) throws IfsException
getLongRaw
in interface FndSqlData
colNr
- index number.SystemException
IfsException
protected byte[] getOutLongRaw(int parameterIndex) throws java.sql.SQLException
parameterIndex
- java.sql.SQLException
public java.sql.Date getDate(int colNr) throws IfsException
getDate
in interface FndSqlData
colNr
- index number.SystemException
IfsException
protected java.sql.Date getOutDate(int parameterIndex) throws java.sql.SQLException
java.sql.SQLException
public java.math.BigDecimal getBigDecimal(int colNr) throws IfsException
getBigDecimal
in interface FndSqlData
colNr
- index number.IfsException
protected java.math.BigDecimal getOutBigDecimal(int parameterIndex) throws java.sql.SQLException
java.sql.SQLException
public long getLong(int colNr) throws IfsException
getLong
in interface FndSqlData
colNr
- Column index number.IfsException
protected long getOutLong(int parameterIndex) throws java.sql.SQLException
java.sql.SQLException
public int getInt(int colNr) throws IfsException
colNr
- Column index number.IfsException
protected int getOutInt(int parameterIndex) throws java.sql.SQLException
java.sql.SQLException
public double getDouble(int colNr) throws IfsException
getDouble
in interface FndSqlData
colNr
- index number.IfsException
protected double getOutDouble(int parameterIndex) throws java.sql.SQLException
java.sql.SQLException
protected int getBufferSize(java.sql.Clob clob)
clob
- Clob to get buffer size for.public java.lang.String getLongText(int colNr) throws IfsException
getLongText
in interface FndSqlData
colNr
- index number.IfsException
protected java.lang.String getLongTextImpl(int colNr) throws IfsException
IfsException
public java.sql.Time getTime(int colNr) throws IfsException
getTime
in interface FndSqlData
colNr
- index number.IfsException
protected java.sql.Time getOutTime(int parameterIndex) throws java.sql.SQLException
java.sql.SQLException
public java.sql.Timestamp getTimestamp(int colNr) throws IfsException
getTimestamp
in interface FndSqlData
colNr
- Column/parameter position in statement/procedure callIfsException
protected java.sql.Timestamp getOutTimestamp(int parameterIndex) throws java.sql.SQLException
parameterIndex
- Parameter position in procedure call.cal
- java.sql.SQLException
public java.sql.ResultSet getCursor(int parameterIndex) throws IfsException
parameterIndex
- Parameter position in procedure call.IfsException
getFndCursor(int)
public FndResultSet getFndCursor(int parameterIndex) throws IfsException
parameterIndex
- Parameter position in procedure call.IfsException
protected java.lang.String formatSize(int size)
size
- Number of bytes.protected java.sql.Blob getBlob(int colNr) throws IfsException
colNr
- Column number in statementIfsException
protected java.sql.Clob getClob(int colNr) throws IfsException
colNr
- Column number in statement.IfsException
protected int toJavaSqlType(FndSqlType type) throws SystemException
type
- Source FndSqlTypeSystemException
public boolean parameterWasNull() throws IfsException
IfsException
protected java.lang.String getMessage(java.lang.Exception e)
e
- protected abstract void reportSqlError(java.sql.SQLException error)
error
- error to be reportedpublic boolean supportsDefineColumnType()
public boolean defineRefCursorVariable()
public boolean closeRefCursorStatement()
public FndRefCursor getRefCursor() throws IfsException
IfsException
public final java.lang.String getSqlText()
public void setRecursive()