|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sqlproc.engine.SqlOrder
public class SqlOrder
The list of ordering directives for the SQL Processor queries execution. The class layout is based on the Composite design pattern. Instances of this class can be obtained only using one of the factory methods.
For example there's a table PERSON with two columns - ID and NAME. The META SQL query can be the next one:
ALL_PEOPLE(QRY)=
select ID @id, NAME @name
from PERSON
{= where
{& id=:id}
{& UPPER(name)=:+name}
}
{#1 order by ID}
{#2 order by NAME}
;
In the case of the SQL Processor invocation
SqlEngine sqlEngine = sqlLoader.getQueryEngine("ALL_PEOPLE");
List<Person> list = sqlEngine.query(session, Person.class, null, SqlOrder.getAscOrder(1));
the output list is sorted in ascending order based on the column ID.
In the case of the SQL Processor invocation
SqlEngine sqlEngine = sqlLoader.getQueryEngine("ALL_PEOPLE");
List<Person> list = sqlEngine.query(session, Person.class, new Object(), SqlOrder.getDescOrder(2));
the output list is sorted in descending order based on the column NAME.
For more info please see the Tutorials.
| Nested Class Summary | |
|---|---|
static class |
SqlOrder.Order
The enumeration for the ordering directives. |
| Field Summary | |
|---|---|
private SqlOrder.Order |
orderDirection
The ordering direction (no ordering, ascending or descending). |
private int |
orderId
The ordering id. |
private List<SqlOrder> |
orders
The list of all ordering directives. |
| Constructor Summary | |
|---|---|
private |
SqlOrder()
Creates a new empty ordering directive list. |
private |
SqlOrder(int orderId,
SqlOrder.Order orderDirection)
Creates a new ordering directive list. |
| Method Summary | |
|---|---|
SqlOrder |
addAscOrder(int orderId)
Adds one more ascending ordering directive into the list of ordering directives. |
SqlOrder |
addDescOrder(int orderId)
Adds one more descending ordering directive into the list of ordering directives. |
SqlOrder |
addOrder(int orderId)
Adds one more ascending or descending ordering directive into the list of ordering directives. |
static SqlOrder |
getAscOrder(int orderId)
The factory method. |
static SqlOrder |
getDescOrder(int orderId)
The factory method. |
static SqlOrder |
getOrder()
The factory method. |
static SqlOrder |
getOrder(int orderId)
The factory method. |
SqlOrder.Order |
getOrderDirection()
Returns the ordering direction (no ordering, ascending or descending). |
int |
getOrderId()
Returns the ordering id. |
List<SqlOrder> |
getOrders()
Returns the list of ordering directives. |
String |
toString()
For debug purposes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private int orderId
private SqlOrder.Order orderDirection
private List<SqlOrder> orders
| Constructor Detail |
|---|
private SqlOrder()
private SqlOrder(int orderId,
SqlOrder.Order orderDirection)
orderId - the ordering idorderDirection - the ordering direction| Method Detail |
|---|
public static SqlOrder getOrder()
public static SqlOrder getAscOrder(int orderId)
orderId - the ordering id
public static SqlOrder getDescOrder(int orderId)
orderId - the ordering id
public static SqlOrder getOrder(int orderId)
orderId - the ordering id. Can be a negative one for a descending ordering directive.
public SqlOrder addAscOrder(int orderId)
orderId - the ordering id
public SqlOrder addDescOrder(int orderId)
orderId - the ordering id
public SqlOrder addOrder(int orderId)
orderId - the ordering id. Can be a negative one for a descending ordering directive.
public int getOrderId()
public SqlOrder.Order getOrderDirection()
public List<SqlOrder> getOrders()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||