public abstract class Prepared extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
create
Whether to create a new object (for indexes).
|
protected ArrayList<Parameter> |
parameters
The list of parameters.
|
protected boolean |
prepareAlways
If the query should be prepared before each execution.
|
protected Session |
session
The session.
|
protected String |
sqlStatement
The SQL string.
|
Constructor and Description |
---|
Prepared(Session session)
Create a new object.
|
Modifier and Type | Method and Description |
---|---|
void |
checkCanceled()
Check if this statement was canceled.
|
protected void |
checkParameters()
Check if all parameters have been set.
|
protected int |
getCurrentObjectId()
Get the object id to use for the database object that is created in this
statement.
|
int |
getCurrentRowNumber()
Get the current row number.
|
protected int |
getObjectId()
Get the current object id, or get a new id from the database.
|
ArrayList<Parameter> |
getParameters()
Get the parameter list.
|
String |
getPlanSQL()
Get the SQL statement with the execution plan.
|
String |
getSQL()
Get the SQL statement.
|
protected static String |
getSQL(Expression[] list)
Get the SQL snippet of the expression list.
|
protected static String |
getSQL(Value[] values)
Get the SQL snippet of the value list.
|
abstract int |
getType()
Get the command type as defined in CommandInterface
|
boolean |
isCacheable() |
boolean |
isQuery()
Check if this object is a query.
|
boolean |
isReadOnly()
Check if this command is read only.
|
abstract boolean |
isTransactional()
Check if this command is transactional.
|
boolean |
needRecompile()
Check if the statement needs to be re-compiled.
|
void |
prepare()
Prepare this statement.
|
ResultInterface |
query(int maxrows)
Execute the query.
|
abstract ResultInterface |
queryMeta()
Get an empty result set containing the meta data.
|
void |
setCommand(Command command)
Set the command.
|
protected void |
setCurrentRowNumber(int rowNumber)
Set the current row number.
|
void |
setObjectId(int i)
Set the object id for this statement.
|
void |
setParameterList(ArrayList<Parameter> parameters)
Set the parameter list of this statement.
|
void |
setPrepareAlways(boolean prepareAlways)
Set the prepare always flag.
|
protected DbException |
setRow(DbException e,
int rowId,
String values)
Set the SQL statement of the exception to the given row.
|
void |
setSession(Session currentSession)
Set the session for this statement.
|
void |
setSQL(String sql)
Set the SQL statement.
|
String |
toString()
Convert the statement to a String.
|
int |
update()
Execute the statement.
|
protected Session session
protected String sqlStatement
protected boolean create
protected boolean prepareAlways
public Prepared(Session session)
session
- the sessionpublic abstract boolean isTransactional()
public abstract ResultInterface queryMeta()
public abstract int getType()
public boolean isReadOnly()
public boolean needRecompile()
public void setParameterList(ArrayList<Parameter> parameters)
parameters
- the parameter listpublic ArrayList<Parameter> getParameters()
protected void checkParameters()
DbException
- if any parameter has not been setpublic void setCommand(Command command)
command
- the new commandpublic boolean isQuery()
public void prepare()
public int update()
DbException
- if it is a querypublic ResultInterface query(int maxrows)
maxrows
- the maximum number of rows to returnDbException
- if it is not a querypublic void setSQL(String sql)
sql
- the SQL statementpublic String getSQL()
protected int getCurrentObjectId()
protected int getObjectId()
public String getPlanSQL()
public void checkCanceled()
DbException
- if it was canceledpublic void setObjectId(int i)
i
- the object idpublic void setSession(Session currentSession)
currentSession
- the new sessionpublic void setPrepareAlways(boolean prepareAlways)
prepareAlways
- the new valueprotected void setCurrentRowNumber(int rowNumber)
rowNumber
- the row numberpublic int getCurrentRowNumber()
public String toString()
protected static String getSQL(Value[] values)
values
- the value listprotected static String getSQL(Expression[] list)
list
- the expression listprotected DbException setRow(DbException e, int rowId, String values)
e
- the exceptionrowId
- the row numbervalues
- the values of the rowpublic boolean isCacheable()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.