|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.command.Prepared
public abstract class Prepared
A prepared statement.
Field Summary | |
---|---|
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 Summary | |
---|---|
Prepared(Session session)
Create a new object. |
Method Summary | |
---|---|
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. |
java.util.ArrayList<Parameter> |
getParameters()
Get the parameter list. |
java.lang.String |
getPlanSQL()
Get the SQL statement with the execution plan. |
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. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Session session
protected java.lang.String sqlStatement
protected boolean create
protected java.util.ArrayList<Parameter> parameters
protected boolean prepareAlways
Constructor Detail |
---|
public Prepared(Session session)
session
- the sessionMethod Detail |
---|
public 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()
SQLException
- if any parameter has not been setpublic void setCommand(Command command)
command
- the new commandpublic boolean isQuery()
public void prepare()
SQLException
public int update()
SQLException
- if it is a querypublic ResultInterface query(int maxrows)
maxrows
- the maximum number of rows to return
SQLException
- 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()
SQLException
- 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.Object
protected static java.lang.String getSQL(Value[] values)
values
- the value list
protected static java.lang.String getSQL(Expression[] list)
list
- the expression list
protected DbException setRow(DbException e, int rowId, java.lang.String values)
e
- the exceptionrowId
- the row numbervalues
- the values of the row
public boolean isCacheable()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |