public class Select extends SQL
Modifier and Type | Field and Description |
---|---|
protected java.sql.ResultSet |
rs
stores results
|
Constructor and Description |
---|
Select(Column... columns)
Create a new select for the given columns.
|
Select(Column[] columns,
boolean distinct)
Create a new select for the given columns.
|
Select(java.util.Set<Column> columns)
Create a new select with a collection of columns
|
Modifier and Type | Method and Description |
---|---|
Select |
and(Column c,
Constraint constraint)
Add to the where clause
|
Select |
and(Constraint constraint)
Add to the where clause
|
void |
close()
Close the statement.
|
Select |
from(Table table)
Add a 'from table' clause.
|
Select |
join(Table table)
Create an ordinary join on another table
|
Select |
leftjoin(Table table)
Create a left join on another table
|
Select |
limit(int limit)
Add a limit clause
|
Select |
limit(int limit,
int offset)
Add a limit clause
|
Select |
on(Column c,
Constraint constraint)
Add an on clause following a join
|
Select |
or(Column c,
Constraint constraint)
Add to the where clause
|
Select |
or(Constraint constraint)
Add to the where clause
|
Select |
orderby(Column... columns)
Add an order by clause
|
Select |
orderby(Column c)
Add an order by clause
|
Select |
orderby(Column c,
SQL.Order order)
Add an order by clause
|
Select |
orderby(java.lang.String by,
SQL.Order order)
Add an order by clause
|
java.sql.ResultSet |
query(java.sql.Connection conn)
Binds the constrained variables, executes the query and returns a
reference to the result.
|
java.sql.ResultSet |
query(java.sql.Connection conn,
boolean streaming)
Binds the constrained variables, executes the query and returns a
reference to the result.
|
java.lang.String |
toString() |
Select |
union(Column... cols)
Construct a union select
|
Select |
union(Column[] cols,
boolean distinct)
Construct a union to this select
|
Select |
union(java.util.Set<Column> cols)
Construct a union select
|
Select |
where(Column c,
Constraint constraint)
Start a where clause
|
public Select(Column... columns)
columns
- Columns to return in querypublic Select(java.util.Set<Column> columns)
columns
- Columns to return in querypublic Select(Column[] columns, boolean distinct)
columns
- Columns to returndistinct
- True if distinctpublic Select union(Column... cols)
cols
- list of columnspublic Select union(java.util.Set<Column> cols)
cols
- list of columnspublic Select union(Column[] cols, boolean distinct)
cols
- list of columnsdistinct
- true for distinctpublic Select from(Table table)
table
- Instance of tablepublic Select join(Table table)
table
- the table to joinpublic Select leftjoin(Table table)
table
- the table to joinpublic Select on(Column c, Constraint constraint)
c
- the column to join onconstraint
- how to constrain the joinpublic Select where(Column c, Constraint constraint)
c
- the column to join onconstraint
- how to constrain the joinpublic Select and(Column c, Constraint constraint)
c
- the column to join onconstraint
- how to constrain the columnpublic Select and(Constraint constraint)
constraint
- what to constrainpublic Select or(Column c, Constraint constraint)
c
- the column to join onconstraint
- how to constrain the columnpublic Select or(Constraint constraint)
constraint
- what to constrainpublic Select orderby(Column c)
c
- column to order onpublic Select orderby(Column c, SQL.Order order)
c
- column to order onorder
- specify the orderpublic Select orderby(java.lang.String by, SQL.Order order)
by
- the fieldorder
- the sort orderpublic Select orderby(Column... columns)
columns
- column to order onpublic Select limit(int limit)
limit
- number or rowspublic Select limit(int limit, int offset)
limit
- number or rowsoffset
- row offset from zeropublic java.lang.String toString()
toString
in class java.lang.Object
public java.sql.ResultSet query(java.sql.Connection conn, boolean streaming) throws java.sql.SQLException
conn
- Connection to usestreaming
- if true, attempt to set streaming of resultsetjava.sql.SQLException
- Query failedpublic java.sql.ResultSet query(java.sql.Connection conn) throws java.sql.SQLException
conn
- Connection to usejava.sql.SQLException
- Query failedpublic void close() throws java.sql.SQLException
java.sql.SQLException
- Failed to close statementCopyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona