|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.slamb.axamol.library.Statement
public class Statement
Parameterized SQL statement stored in XML.
Instances of this class are not tied to any particular database connection. They are also immutable (threadsafe) once parsed. Together, these two characteristics make this class work with database pools.
| Field Summary | |
|---|---|
protected java.util.Map |
columns
Information about explicitly specified columns. |
protected java.util.Map |
databases
SQL stuff for each supported database type. |
protected org.slamb.axamol.library.Statement.Handler |
handler
The handler parsing this or null if parsing is complete. |
protected static org.apache.commons.logging.Log |
log
|
protected java.lang.String |
name
The name of this statement. |
static java.lang.String |
NS_STATEMENT
XML namespace for a statement. |
protected java.util.Map |
parameters
Information for each parameter. |
protected int |
type
The type of this query, TYPE_xxx. |
static int |
TYPE_QUERY
Query statement. |
static int |
TYPE_UPDATE
Update statement. |
protected static java.util.Map |
types
|
| Constructor Summary | |
|---|---|
Statement()
|
|
| Method Summary | |
|---|---|
void |
clearTimings()
Resets all peformance timings for this statement. |
java.sql.ResultSet |
executeQuery(java.sql.PreparedStatement p,
java.util.Map params)
Executes this statement as a query, returning the ResultSet. |
int |
executeUpdate(java.sql.PreparedStatement p,
java.util.Map params)
Executes this statement as an update. |
java.util.Map |
getColumns()
Returns information about explicit columns. |
org.xml.sax.ContentHandler |
getHandler()
Returns the handler being used to parse this statement. |
java.lang.String |
getName()
|
org.slamb.common.stats.Sample |
getTimings()
Retrieves statistics on time to execute. |
int |
getType()
Returns the type of this statement. |
boolean |
isComplete()
Returns true iff this statement is completely parsed. |
java.lang.String |
makeSQL(java.sql.Connection connection,
java.util.Map params,
java.lang.String orderByClause)
Creates SQL for the given parameters. |
void |
setServerPrepare(java.sql.PreparedStatement ps)
Tells the database server if it should use server-side prepared statements. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.commons.logging.Log log
protected static final java.util.Map types
public static final java.lang.String NS_STATEMENT
public static final int TYPE_QUERY
public static final int TYPE_UPDATE
protected int type
protected org.slamb.axamol.library.Statement.Handler handler
protected java.lang.String name
protected java.util.Map parameters
protected java.util.Map columns
protected java.util.Map databases
| Constructor Detail |
|---|
public Statement()
| Method Detail |
|---|
public java.lang.String getName()
public org.xml.sax.ContentHandler getHandler()
Pre-condition: The statement is being parsed.
public boolean isComplete()
public int getType()
public java.util.Map getColumns()
public java.lang.String makeSQL(java.sql.Connection connection,
java.util.Map params,
java.lang.String orderByClause)
throws java.sql.SQLException
params - The parameters. If null, an empty map is used.orderByClause - If non-null, will be appended with the leading
text " order by ". Only makes sense for queries.
java.sql.SQLException
public void setServerPrepare(java.sql.PreparedStatement ps)
throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet executeQuery(java.sql.PreparedStatement p,
java.util.Map params)
throws java.sql.SQLException
Pre-condition: This is a query statement, not an update statement.
p - A prepared statement, as returned by p.params - The invocation parameters. If null, an empty map is used.
java.sql.SQLExceptionmakeSQL(java.sql.Connection, java.util.Map, java.lang.String),
executeUpdate(java.sql.PreparedStatement, java.util.Map),
PreparedStatement.executeQuery()
public int executeUpdate(java.sql.PreparedStatement p,
java.util.Map params)
throws java.sql.SQLException
Pre-condition: This is an update statement, not a query statement.
p - A prepared statement, as returned by p.params - The invocation parameters. If null, an empty map is used.
java.sql.SQLExceptionmakeSQL(java.sql.Connection, java.util.Map, java.lang.String),
executeQuery(java.sql.PreparedStatement, java.util.Map),
PreparedStatement.executeUpdate()public void clearTimings()
public org.slamb.common.stats.Sample getTimings()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||