|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.fatwire.cs.core.db.PreparedStmt
public final class PreparedStmt
This class is a thin abstraction over the JDBC PreparedStatement functionality.
It is constructed with SQL and a list of affected tables. Then, each placeholder is identified - see PreparedStmt.setElement(int, java.lang.String, java.lang.String)
.
Once all elements have been set, the object is complete (see PreparedStmt.isComplete()
.)
A StatementParam
object is created using PreparedStmt.newParam()
, and the parameter is then populated with the prepared statement variables which are passed to the statement when executed.
Constructor Summary | |
---|---|
PreparedStmt(java.lang.String sStmt, java.util.List<java.lang.String> tables) Constructs a new PreparedStmt using basic SQL construct that is used to build a prepared statement and tables used in it (in the form clause). |
Method Summary | |
---|---|
java.lang.Object |
clone() Deep copy |
java.lang.String |
columnNameAt(int pos) Returns column name at given placeholder position |
int |
getFetchDirection() Returns the configured fetch direction |
int |
getFetchSize() Returns the fetch size that will be used while executing this statement. |
int |
getLimit() Returns the max number of rows configured. |
int |
getPositionsCount() Returns the number of placeholders in this prepared statement. |
java.lang.String |
getStatement() Returns the SQL statement used for preparing the prepared statement. |
java.util.List<java.lang.String> |
getTables() Returns table names as a part of this prepared statement. |
java.util.List<java.lang.Integer> |
getTypes() Returns list of 'types' (Integer representation of sql types) in the order in which they appear in the prepared statement. |
boolean |
isComplete() Indicates if this instance is completely formed (bound with data). |
StatementParam |
newParam() Creates an exemplar instance of Parameter container. |
void |
setElement(int pos, int type) Sets type information at position pos. |
void |
setElement(int pos, java.lang.String sTableName, java.lang.String sFieldName) Sets type information at position pos. |
void |
setFetchDirection(int fetchDirection) Sets the JDBC fetch direction to be used for result execution The value defaults to
|
void |
setFetchSize(int fetchSize) Sets the fetch size to to be used for execution of this statement |
void |
setLimit(int limit) Sets the maximum number of rows for execution of this statement. |
java.lang.String |
tableNameAt(int pos) Returns tablename specified at a given position |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PreparedStmt(java.lang.String sStmt, java.util.List<java.lang.String> tables)
sStmt
-tables
-Method Detail |
---|
public void setElement(int pos, java.lang.String sTableName, java.lang.String sFieldName)
pos
- 0 based index of the placeholder positionsTableName
- Name of the table where sFieldName can be found. The table must exist in the same database, accessible by the user. This table is usually a part of the SQL statement itself.sFieldName
- name of the field whose datatype will be used for the placeholder with index pos.public void setElement(int pos, int type)
pos
- 0 based index of the placeholder positiontype
- one of constants in Types
Types
public java.lang.String getStatement()
public int getPositionsCount()
public java.util.List<java.lang.Integer> getTypes()
public java.lang.String tableNameAt(int pos)
pos
- index of the placeholder (0 based)public java.lang.String columnNameAt(int pos)
pos
- index of the placeholder (0 based)public java.util.List<java.lang.String> getTables()
public StatementParam newParam()
public boolean isComplete()
public void setFetchSize(int fetchSize)
fetchSize
- desired fetch size, ignored if fetchSize < 0public int getFetchSize()
public void setFetchDirection(int fetchDirection)
ResultSet.FETCH_FORWARD
fetchDirection
- new fetch direction must be ResultSet.FETCH_FORWARD
, ResultSet.FETCH_REVERSE
or ResultSet.FETCH_UNKNOWN
. Other values ignoredpublic int getFetchDirection()
ResultSet.FETCH_FORWARD
, ResultSet.FETCH_REVERSE
or ResultSet.FETCH_UNKNOWN
public int getLimit()
public void setLimit(int limit)
limit
- maximum number of rows to be returned (negative values are ignored at the execution time)public java.lang.Object clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.