|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.jdbc.sql.SQLBuffer
public final class SQLBuffer
Buffer for SQL statements that can be used to create java.sql.PreparedStatements. This buffer holds the SQL statement parameters and their corresponding columns. The parameters introduced by the runtime system are distinguished from the parameters set by the user.
Constructor Summary | |
---|---|
SQLBuffer(DBDictionary dict)
Default constructor. |
|
SQLBuffer(SQLBuffer buf)
Copy constructor. |
Method Summary | |
---|---|
void |
addCastForParam(String oper,
Val val)
Replace SQL '?' with CAST string if required by DB platform |
SQLBuffer |
append(Column col)
|
SQLBuffer |
append(DBIdentifier name)
|
SQLBuffer |
append(Select sel,
JDBCFetchConfiguration fetch)
Append a subselect. |
SQLBuffer |
append(Sequence seq)
|
SQLBuffer |
append(SQLBuffer buf)
Append all SQL and parameters of the given buffer. |
SQLBuffer |
append(String s)
|
SQLBuffer |
append(Table table)
|
SQLBuffer |
appendCount(Select sel,
JDBCFetchConfiguration fetch)
Append a subselect count. |
SQLBuffer |
appendValue(boolean b)
Append a parameter value. |
SQLBuffer |
appendValue(boolean b,
Column col)
Append a parameter value. |
SQLBuffer |
appendValue(byte b)
Append a parameter value. |
SQLBuffer |
appendValue(byte b,
Column col)
Append a parameter value. |
SQLBuffer |
appendValue(char c)
Append a parameter value. |
SQLBuffer |
appendValue(char c,
Column col)
Append a parameter value. |
SQLBuffer |
appendValue(double d)
Append a parameter value. |
SQLBuffer |
appendValue(double d,
Column col)
Append a parameter value. |
SQLBuffer |
appendValue(float f)
Append a parameter value. |
SQLBuffer |
appendValue(float f,
Column col)
Append a parameter value. |
SQLBuffer |
appendValue(int i)
Append a parameter value. |
SQLBuffer |
appendValue(int i,
Column col)
Append a parameter value. |
SQLBuffer |
appendValue(long l)
Append a parameter value. |
SQLBuffer |
appendValue(long l,
Column col)
Append a parameter value. |
SQLBuffer |
appendValue(Object o)
Append a parameter value. |
SQLBuffer |
appendValue(Object o,
Column col)
Append a system inserted parameter value for a specific column. |
SQLBuffer |
appendValue(Object o,
Column col,
Parameter userParam)
Append a user parameter value for a specific column. |
SQLBuffer |
appendValue(short s)
Append a parameter value. |
SQLBuffer |
appendValue(short s,
Column col)
Append a parameter value. |
Object |
clone()
Perform a shallow clone of this SQL Buffer. |
boolean |
equals(Object other)
|
List |
getColumns()
|
List |
getParameters()
Return the list of parameter values. |
String |
getSQL()
Return the SQL for this buffer. |
String |
getSQL(boolean replaceParams)
Returns the SQL for this buffer. |
List |
getUserParameters()
Get the user parameter positions in the list of parameters. |
int |
hashCode()
|
boolean |
isEmpty()
Return true if the buffer is emtpy. |
CallableStatement |
prepareCall(Connection conn)
Create and populate the parameters of a prepared statement using the SQL in this buffer. |
CallableStatement |
prepareCall(Connection conn,
int rsType,
int rsConcur)
Create and populate the parameters of a prepared statement using the SQL in this buffer. |
CallableStatement |
prepareCall(Connection conn,
JDBCFetchConfiguration fetch,
int rsType,
int rsConcur)
Create and populate the parameters of a prepred statement using the SQL in this buffer and the given fetch configuration. |
PreparedStatement |
prepareStatement(Connection conn)
Create and populate the parameters of a prepared statement using the SQL in this buffer. |
PreparedStatement |
prepareStatement(Connection conn,
int rsType,
int rsConcur)
Create and populate the parameters of a prepared statement using the SQL in this buffer. |
PreparedStatement |
prepareStatement(Connection conn,
JDBCFetchConfiguration fetch,
int rsType,
int rsConcur)
Create and populate the parameters of a prepred statement using the SQL in this buffer and the given fetch configuration. |
boolean |
replace(Select old,
Select sel)
Replace a subselect. |
void |
replaceSqlString(int start,
int end,
String newString)
Replace current buffer string with the new string |
void |
setParameters(List params)
|
void |
setParameters(PreparedStatement ps)
Populate the parameters of an existing PreparedStatement with values from this buffer. |
boolean |
sqlEquals(String sql)
Compare internal SQL without resolving subselects or stringifying parameters. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SQLBuffer(DBDictionary dict)
public SQLBuffer(SQLBuffer buf)
Method Detail |
---|
public Object clone()
clone
in class Object
public boolean isEmpty()
public SQLBuffer append(SQLBuffer buf)
public SQLBuffer append(DBIdentifier name)
public SQLBuffer append(Table table)
public SQLBuffer append(Sequence seq)
public SQLBuffer append(Column col)
public SQLBuffer append(String s)
public SQLBuffer append(Select sel, JDBCFetchConfiguration fetch)
public SQLBuffer appendCount(Select sel, JDBCFetchConfiguration fetch)
public boolean replace(Select old, Select sel)
public SQLBuffer appendValue(Object o)
public SQLBuffer appendValue(Object o, Column col)
public SQLBuffer appendValue(Object o, Column col, Parameter userParam)
userParam
- if non-null, designates a 'user' parameter.public SQLBuffer appendValue(boolean b)
public SQLBuffer appendValue(boolean b, Column col)
public SQLBuffer appendValue(byte b)
public SQLBuffer appendValue(byte b, Column col)
public SQLBuffer appendValue(char c)
public SQLBuffer appendValue(char c, Column col)
public SQLBuffer appendValue(double d)
public SQLBuffer appendValue(double d, Column col)
public SQLBuffer appendValue(float f)
public SQLBuffer appendValue(float f, Column col)
public SQLBuffer appendValue(int i)
public SQLBuffer appendValue(int i, Column col)
public SQLBuffer appendValue(long l)
public SQLBuffer appendValue(long l, Column col)
public SQLBuffer appendValue(short s)
public SQLBuffer appendValue(short s, Column col)
public List getParameters()
public List getUserParameters()
getParameters()
list. The even element
of the returned list refers to the user parameter key.
This structure is preferred over a normal map because a user parameter
may occur more than one in the parameters.
public String getSQL()
public String getSQL(boolean replaceParams)
replaceParams
- if true, then replace parameters with the
actual parameter valuespublic PreparedStatement prepareStatement(Connection conn) throws SQLException
SQLException
public PreparedStatement prepareStatement(Connection conn, int rsType, int rsConcur) throws SQLException
SQLException
public PreparedStatement prepareStatement(Connection conn, JDBCFetchConfiguration fetch, int rsType, int rsConcur) throws SQLException
SQLException
public CallableStatement prepareCall(Connection conn) throws SQLException
SQLException
public CallableStatement prepareCall(Connection conn, int rsType, int rsConcur) throws SQLException
SQLException
public CallableStatement prepareCall(Connection conn, JDBCFetchConfiguration fetch, int rsType, int rsConcur) throws SQLException
SQLException
public void setParameters(PreparedStatement ps) throws SQLException
SQLException
public int hashCode()
hashCode
in class Object
public boolean sqlEquals(String sql)
public boolean equals(Object other)
equals
in class Object
public void addCastForParam(String oper, Val val)
oper
- val
- public void replaceSqlString(int start, int end, String newString)
start
- replace start positionend
- replace end positionnewString
- public void setParameters(List params)
public List getColumns()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |