public abstract class Prepared
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
create
Whether to create a new object (for indexes).
|
protected java.util.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 java.lang.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.
|
java.util.List<TableView> |
getCteCleanups() |
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.
|
java.util.ArrayList<Parameter> |
getParameters()
Get the parameter list.
|
java.lang.String |
getPlanSQL()
Get the SQL statement with the execution plan.
|
Session |
getSession() |
java.lang.String |
getSQL()
Get the SQL statement.
|
protected static java.lang.String |
getSQL(Expression[] list)
Get the SQL snippet of the expression list.
|
protected static java.lang.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.
|
void |
setCteCleanups(java.util.List<TableView> cteCleanups)
Set the temporary views created for CTE's.
|
protected void |
setCurrentRowNumber(int rowNumber)
Set the current row number.
|
void |
setObjectId(int i)
Set the object id for this statement.
|
void |
setParameterList(java.util.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,
java.lang.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(java.lang.String sql)
Set the SQL statement.
|
java.lang.String |
toString()
Convert the statement to a String.
|
int |
update()
Execute the statement.
|
protected Session session
protected java.lang.String sqlStatement
protected boolean create
protected java.util.ArrayList<Parameter> parameters
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(java.util.ArrayList<Parameter> parameters)
parameters - the parameter listpublic java.util.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(java.lang.String sql)
sql - the SQL statementpublic java.lang.String getSQL()
protected int getCurrentObjectId()
protected int getObjectId()
public java.lang.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 java.lang.String toString()
toString in class java.lang.Objectprotected static java.lang.String getSQL(Value[] values)
values - the value listprotected static java.lang.String getSQL(Expression[] list)
list - the expression listprotected DbException setRow(DbException e, int rowId, java.lang.String values)
e - the exceptionrowId - the row numbervalues - the values of the rowpublic boolean isCacheable()
public java.util.List<TableView> getCteCleanups()
public void setCteCleanups(java.util.List<TableView> cteCleanups)
cteCleanups - the temporary viewspublic Session getSession()