|
||||||||||
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 int |
headPos
The position of the head record (used for indexes). |
protected ObjectArray<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(boolean needFresh,
boolean dataFile)
Get the current object id, or get a new id from the database. |
ObjectArray<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 java.lang.String |
getSQL(Expression[] list)
Get the SQL snippet of the expression list. |
protected java.lang.String |
getSQL(Value[] values)
Get the SQL snippet of the value list. |
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. |
LocalResult |
query(int maxrows)
Execute the query. |
abstract LocalResult |
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 |
setHeadPos(int headPos)
Set the head position. |
void |
setObjectId(int i)
Set the object id for this statement. |
void |
setParameterList(ObjectArray<Parameter> parameters)
Set the parameter list of this statement. |
void |
setPrepareAlways(boolean prepareAlways)
Set the prepare always flag. |
protected java.sql.SQLException |
setRow(java.sql.SQLException ex,
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 int headPos
protected ObjectArray<Parameter> parameters
protected boolean prepareAlways
Constructor Detail |
---|
public Prepared(Session session)
session
- the sessionMethod Detail |
---|
public abstract boolean isTransactional()
public abstract LocalResult queryMeta() throws java.sql.SQLException
java.sql.SQLException
public boolean isReadOnly()
public boolean needRecompile() throws java.sql.SQLException
java.sql.SQLException
public void setParameterList(ObjectArray<Parameter> parameters)
parameters
- the parameter listpublic ObjectArray<Parameter> getParameters()
protected void checkParameters() throws java.sql.SQLException
java.sql.SQLException
- if any parameter has not been setpublic void setCommand(Command command)
command
- the new commandpublic boolean isQuery()
public void prepare() throws java.sql.SQLException
java.sql.SQLException
public int update() throws java.sql.SQLException
java.sql.SQLException
- if it is a querypublic LocalResult query(int maxrows) throws java.sql.SQLException
maxrows
- the maximum number of rows to return
java.sql.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(boolean needFresh, boolean dataFile)
needFresh
- if a fresh id is requireddataFile
- if the object id is used for the
public java.lang.String getPlanSQL()
public void checkCanceled() throws java.sql.SQLException
java.sql.SQLException
- if it was canceledpublic void setObjectId(int i)
i
- the object idpublic void setHeadPos(int headPos)
headPos
- the head positionpublic void setSession(Session currentSession)
currentSession
- the new sessionpublic void setPrepareAlways(boolean prepareAlways)
prepareAlways
- the new valueprotected void setCurrentRowNumber(int rowNumber) throws java.sql.SQLException
rowNumber
- the row number
java.sql.SQLException
public int getCurrentRowNumber()
public java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.String getSQL(Value[] values)
values
- the value list
protected java.lang.String getSQL(Expression[] list)
list
- the expression list
protected java.sql.SQLException setRow(java.sql.SQLException ex, int rowId, java.lang.String values)
ex
- the exceptionrowId
- the row numbervalues
- the values of the row
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |