public class PlsqlSelectCommand extends PlsqlCommand
For executing SELECT query statement through the PL/SQL Gateway. Can be
excuted individually or together with other statements in a
PlsqlCommandCollection
.
Must be associated with a Server
object
before it's executed. Unless it's run in a PlsqlCommandCollection
.
In that case, the collection's Server
object is used.
bindVariables, commandText, srv
Constructor and Description |
---|
PlsqlSelectCommand()
Creates a new instance of class.
|
PlsqlSelectCommand(Server srv)
Creates an instance of this class.
|
PlsqlSelectCommand(Server srv,
java.lang.String sql)
Creates in instance of this class.
|
PlsqlSelectCommand(java.lang.String sql)
Creates an instance of this class.
|
Modifier and Type | Method and Description |
---|---|
protected void |
createCommandRecord(Record cmd)
Formats this command to a Record for sending to the PL/SQL Gateway.
|
RecordCollection |
executeQuery()
Executes this
SELECT query statement and returns result set. |
long |
getMaxRows()
Gets the MAXROWS setting.
|
RecordCollection |
getResult()
Gets the select command's result set.
|
long |
getSkipRows()
Gets the SKIPROWS settings.
|
protected void |
processCommandRecord(Record cmd)
Parses a [Command] Record from the PL/SQL Gateway into this command.
|
void |
setMaxRows(long maxRows)
Sets the MAXROWS setting.
|
void |
setSelectColumns(java.lang.String selectColumns)
Sets meta-data describing type and size of every column in the select list.
|
void |
setSkipRows(long skipRows)
Sets the SKIPROWS setting.
|
execute, getBindVariables, getCommandText, getServer, setCommandText, setServer, toString
public PlsqlSelectCommand()
public PlsqlSelectCommand(Server srv)
Server
object to
use.srv
- the Server
object to use for this command.
Not used if run in a PlsqlCommandCollection
.public PlsqlSelectCommand(java.lang.String sql)
sql
- the SELECT
query to execute.public PlsqlSelectCommand(Server srv, java.lang.String sql)
Server
object to use
and the query to execute.srv
- Server
object to use. Unless run in a collection.sql
- the SELECT
query to execute.protected void createCommandRecord(Record cmd) throws APException
createCommandRecord
in class PlsqlCommand
APException
public void setSelectColumns(java.lang.String selectColumns)
DataType
.
An unknown type may be specified with "?".
An unknown size may be specified with -1.
Note! The implementation of this method depends on used JDBC driver.
For Oracle JDBC driver sizes of text columns are used to optimize memory allocation, while type markers are used to define the types of columns in the result set.
For DataDirect JDBC driver only type marker DEC (DataType.DECIMAL
)
is supported, all other column types and sizes are ignored.
selectColumns
- string containing meta-data, for example: "T^100,T^2000,?^0,?^0,DEC^-1"public RecordCollection executeQuery() throws APException
SELECT
query statement and returns result set.
A Server
object must have been set before calling this method.RecordCollection
with one record per row in the
result set. May be null
if there is no result set (which is
not the same as a result set with no rows).APException
- if there is an error executing the command.java.lang.IllegalStateException
- If no Server
object has been
set prior to invoking this method.public RecordCollection getResult()
null
if
there is no result set or the command hasn't been executed.public long getMaxRows()
setMaxRows(long)
public long getSkipRows()
setSkipRows(long)
protected void processCommandRecord(Record cmd) throws APException
processCommandRecord
in class PlsqlCommand
APException
public void setMaxRows(long maxRows)
maxRows
- the number of rows to limit the result set to. A value
of zero means MAXROWS is not used.public void setSkipRows(long skipRows)
skipRows
- the number of rows in the result set to skip. A value of
zero means SKIPROWS is not used.