Prepared

A prepared statement.

Methods
static String getSQL(Value[] values)
Get the SQL snippet of the value list.
static String getSQL(Value[] values)
Get the SQL snippet of the value list.
Parameters:
values - the value list
Returns:
the SQL snippet
static String getSQL(Expression[] list)
Get the SQL snippet of the expression list.
static String getSQL(Expression[] list)
Get the SQL snippet of the expression list.
Parameters:
list - the expression list
Returns:
the SQL snippet
Prepared(Session session)
Create a new object.
Prepared(Session session)
Create a new object.
Parameters:
session - the session
void checkCanceled()
Check if this statement was canceled.
void checkCanceled()
Check if this statement was canceled.
Throws:
DbException - if it was canceled
void checkParameters()
Check if all parameters have been set.
void checkParameters()
Check if all parameters have been set.
Throws:
DbException - if any parameter has not been set
List getCteCleanups()
List getCteCleanups()
Returns:
the temporary views created for CTE's.
int getCurrentObjectId()
Get the object id to use for the database object that is created in this statement.
int getCurrentObjectId()
Get the object id to use for the database object that is created in this statement. This id is only set when the object is persistent. If not set, this method returns 0.
Returns:
the object id or 0 if not set
int getCurrentRowNumber()
Get the current row number.
int getCurrentRowNumber()
Get the current row number.
Returns:
the row number
long getModificationMetaId()
Get the meta data modification id of the database when this statement was compiled.
long getModificationMetaId()
Get the meta data modification id of the database when this statement was compiled.
Returns:
the meta data modification id
int getObjectId()
Get the current object id, or get a new id from the database.
int getObjectId()
Get the current object id, or get a new id from the database. The object id is used when creating new database object (CREATE statement).
Returns:
the object id
ArrayList getParameters()
Get the parameter list.
ArrayList getParameters()
Get the parameter list.
Returns:
the parameter list
String getPlanSQL()
Get the SQL statement with the execution plan.
String getPlanSQL()
Get the SQL statement with the execution plan.
Returns:
the execution plan
String getSQL()
Get the SQL statement.
String getSQL()
Get the SQL statement.
Returns:
the SQL statement
Session getSession()
Session getSession()
int getType()
Get the command type as defined in CommandInterface
int getType()
Get the command type as defined in CommandInterface
Returns:
the statement type
boolean isCacheable()
boolean isCacheable()
boolean isQuery()
Check if this object is a query.
boolean isQuery()
Check if this object is a query.
Returns:
true if it is
boolean isReadOnly()
Check if this command is read only.
boolean isReadOnly()
Check if this command is read only.
Returns:
true if it is
boolean isTransactional()
Check if this command is transactional.
boolean isTransactional()
Check if this command is transactional. If it is not, then it forces the current transaction to commit.
Returns:
true if it is
boolean needRecompile()
Check if the statement needs to be re-compiled.
boolean needRecompile()
Check if the statement needs to be re-compiled.
Returns:
true if it must
void prepare()
Prepare this statement.
void prepare()
Prepare this statement.
ResultInterface query(int maxrows)
Execute the query.
ResultInterface query(int maxrows)
Execute the query.
Parameters:
maxrows - the maximum number of rows to return
Returns:
the result set
Throws:
DbException - if it is not a query
ResultInterface queryMeta()
Get an empty result set containing the meta data.
ResultInterface queryMeta()
Get an empty result set containing the meta data.
Returns:
the result set
void setCommand(Command command)
Set the command.
void setCommand(Command command)
Set the command.
Parameters:
command - the new command
void setCteCleanups(List cteCleanups)
Set the temporary views created for CTE's.
void setCteCleanups(List cteCleanups)
Set the temporary views created for CTE's.
Parameters:
cteCleanups - the temporary views
void setCurrentRowNumber(int rowNumber)
Set the current row number.
void setCurrentRowNumber(int rowNumber)
Set the current row number.
Parameters:
rowNumber - the row number
void setModificationMetaId(long id)
Set the meta data modification id of this statement.
void setModificationMetaId(long id)
Set the meta data modification id of this statement.
Parameters:
id - the new id
void setObjectId(int i)
Set the object id for this statement.
void setObjectId(int i)
Set the object id for this statement.
Parameters:
i - the object id
void setParameterList(ArrayList parameters)
Set the parameter list of this statement.
void setParameterList(ArrayList parameters)
Set the parameter list of this statement.
Parameters:
parameters - the parameter list
void setPrepareAlways(boolean prepareAlways)
Set the prepare always flag.
void setPrepareAlways(boolean prepareAlways)
Set the prepare always flag. If set, the statement is re-compiled whenever it is executed.
Parameters:
prepareAlways - the new value
DbException setRow(DbException e, int rowId, String values)
Set the SQL statement of the exception to the given row.
DbException setRow(DbException e, int rowId, String values)
Set the SQL statement of the exception to the given row.
Parameters:
e - the exception
rowId - the row number
values - the values of the row
Returns:
the exception
void setSQL(String sql)
Set the SQL statement.
void setSQL(String sql)
Set the SQL statement.
Parameters:
sql - the SQL statement
void setSession(Session currentSession)
Set the session for this statement.
void setSession(Session currentSession)
Set the session for this statement.
Parameters:
currentSession - the new session
String toString()
Convert the statement to a String.
String toString()
Convert the statement to a String.
Returns:
the SQL statement
void trace(long startTimeNanos, int rowCount)
Print information about the statement executed if info trace level is enabled.
void trace(long startTimeNanos, int rowCount)
Print information about the statement executed if info trace level is enabled.
Parameters:
startTimeNanos - when the statement was started
rowCount - the query or update row count
int update()
Execute the statement.
int update()
Execute the statement.
Returns:
the update count
Throws:
DbException - if it is a query

Fields
static boolean create
static ArrayList parameters
static boolean prepareAlways
static Session session
static String sqlStatement

create

Whether to create a new object (for indexes).

parameters

The list of parameters.

prepareAlways

If the query should be prepared before each execution. This is set for queries with LIKE ?, because the query plan depends on the parameter value.

session

The session.

sqlStatement

The SQL string.