public final class PreparedStmt extends Object implements Cloneable
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 and Description |
---|
PreparedStmt(String sStmt, List<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).
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Deep copy
|
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 maximum number of rows configured.
|
int |
getPositionsCount()
Returns the number of placeholders in this prepared statement.
|
String |
getStatement()
Returns the SQL statement used for preparing the prepared statement.
|
List<String> |
getTables()
Returns table names as a part of this prepared statement.
|
List<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).
|
com.fatwire.cs.core.db.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, String sTableName, 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.
|
String |
tableNameAt(int pos)
Returns tablename specified at a given position
|
public void setElement(int pos, String sTableName, 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)
public String getStatement()
public int getPositionsCount()
public List<Integer> getTypes()
public String tableNameAt(int pos)
pos
- index of the placeholder (0 based)public String columnNameAt(int pos)
pos
- index of the placeholder (0 based)public List<String> getTables()
public com.fatwire.cs.core.db.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()
public int getLimit()
public void setLimit(int limit)
limit
- maximum number of rows to be returned (negative values are ignored at the execution time)