| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.oozie.util.db.SqlStatement
public abstract class SqlStatement
The SqlStatement is used to generate SQL Statements. Prepare the generated Statements and also to parse
 the resultSets
| Nested Class Summary | |
|---|---|
static class | 
SqlStatement.Condition
Construct the condition statement that will be used in the where clause  | 
static class | 
SqlStatement.Delete
SQL Statement generator for DELETE Statements  | 
static class | 
SqlStatement.Insert
INSERT Statement generator  | 
static class | 
SqlStatement.ResultSetReader
ResultSetReader is used to parse the result set and gives methods for getting appropriate type of
 data given the column name | 
static class | 
SqlStatement.Select
Select Statement generator.  | 
static class | 
SqlStatement.Update
UPDATE SQL Statement generator  | 
| Field Summary | |
|---|---|
protected  boolean | 
forUpdate
 | 
protected  StringBuilder | 
sb
 | 
protected  List<Object> | 
values
 | 
| Constructor Summary | |
|---|---|
SqlStatement()
 | 
|
| Method Summary | |
|---|---|
static SqlStatement.Condition | 
and(SqlStatement.Condition... conds)
Logical AND condition Generator  | 
static SqlStatement.Condition | 
between(Schema.Column column,
               Object lVal,
               Object rVal)
BETWEEN range checking statement  | 
static SqlStatement.Delete | 
deleteFrom(Schema.Table table)
Return a new Delete Statement  | 
static SqlStatement.Select | 
getCount(Schema.Table... tables)
Select count(*) Statement generator.  | 
 SqlStatement | 
getNewStatementWithValues(Map<Object,Object> newValues)
Replace the keys(newValues) which are place holders in the sql statements with the corresponding new values.  | 
static SqlStatement.Condition | 
greaterThan(Schema.Column column,
                       Object value)
Generate Condition statement for GREATER THAN condition checking  | 
static SqlStatement.Condition | 
greaterThanOrEqual(Schema.Column column,
                                     Object value)
Generate Condition statement for GREATER THAN OR EQUAL condition checking  | 
static SqlStatement.Condition | 
in(Schema.Column column,
     Object... values)
IN Condition for checking multiple values  | 
static SqlStatement.Condition | 
in(Schema.Column column,
     SqlStatement.Select select)
Sub query with IN condition  | 
static SqlStatement.Insert | 
insertInto(Schema.Table table)
Return a new Insert Statement  | 
static SqlStatement.Condition | 
isEqual(Schema.Column column,
               Object value)
Generate Condition statement for equality check  | 
static SqlStatement.Condition | 
isLike(Schema.Column column,
             String value)
Generate condition statement for IS LIKE  | 
static SqlStatement.Condition | 
isNotEqual(Schema.Column column,
                     Object value)
Generate InEquality Condition statement  | 
static SqlStatement.Condition | 
isNotLike(Schema.Column column,
                   String value)
Generates condition statement for IS NOT LIKE  | 
static SqlStatement.Condition | 
isNotNull(Schema.Column column)
Generate condition statement for IS NOT NULL  | 
static SqlStatement.Condition | 
isNull(Schema.Column column)
Generate condition statement for IS NULL  | 
static SqlStatement.Condition | 
lessThan(Schema.Column column,
                 Object value)
Generate Condition statement for LESS THAN condition checking  | 
static SqlStatement.Condition | 
lessThanOrEqual(Schema.Column column,
                               Object value)
Generate Condition statement for LESS THAN OR EQUAL condition checking  | 
static SqlStatement.Condition | 
notBetween(Schema.Column column,
                     Object lVal,
                     Object rVal)
NOT BETWEEN range checking statement  | 
static SqlStatement.Condition | 
notIn(Schema.Column column,
           Object... values)
NOT IN Condition for checking multiple values  | 
static SqlStatement.Condition | 
notIn(Schema.Column column,
           SqlStatement.Select select)
Sub query with NOT IN condition  | 
static SqlStatement.Condition | 
or(SqlStatement.Condition... conds)
Logical OR condition generator  | 
static SqlStatement.ResultSetReader | 
parse(ResultSet rSet)
Create the ResultSetReader object that has the methods to access the data from the result set | 
 PreparedStatement | 
prepare(Connection conn)
Prepare the SQL Statement.  | 
 PreparedStatement | 
prepare(PreparedStatement pStmt)
Assign the values to Prepared Statement.  | 
 PreparedStatement | 
prepareAndSetValues(Connection conn)
Prepare the SQL Statement that is generated and assign the values to prepared statement.  | 
 PreparedStatement | 
prepareForBatch(Connection conn,
                               List<? extends Map<Object,Object>> values,
                               PreparedStatement pStmt)
Preparing Multiple statements for batch execution.  | 
static SqlStatement.Select | 
selectAllFrom(Schema.Table... tables)
Return a Select All Statement  | 
static SqlStatement.Select | 
selectColumns(Schema.Column... columns)
Return a Select Statement  | 
 SqlStatement | 
setValue(Object oldVal,
                 Object newVal)
Replace the place holders with actual values in the sql statement  | 
static SqlStatement.Update | 
update(Schema.Table table)
Return a new Update Statement  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected boolean forUpdate
protected StringBuilder sb
protected List<Object> values
| Constructor Detail | 
|---|
public SqlStatement()
| Method Detail | 
|---|
public static SqlStatement.Condition isNull(Schema.Column column)
column - column name
public static SqlStatement.Condition isNotNull(Schema.Column column)
column - column name
public static SqlStatement.Condition isLike(Schema.Column column,
                                            String value)
column - column namevalue - value to be checked
public static SqlStatement.Condition isNotLike(Schema.Column column,
                                               String value)
column - column namevalue - value to be checked
public static SqlStatement.Condition isEqual(Schema.Column column,
                                             Object value)
column - value - 
public static SqlStatement.Condition isNotEqual(Schema.Column column,
                                                Object value)
column - value - 
public static SqlStatement.Condition lessThan(Schema.Column column,
                                              Object value)
column - value - 
public static SqlStatement.Condition greaterThan(Schema.Column column,
                                                 Object value)
column - value - 
public static SqlStatement.Condition lessThanOrEqual(Schema.Column column,
                                                     Object value)
column - value - 
public static SqlStatement.Condition greaterThanOrEqual(Schema.Column column,
                                                        Object value)
column - value - 
public static SqlStatement.Condition in(Schema.Column column,
                                        Object... values)
column - values - 
public static SqlStatement.Condition notIn(Schema.Column column,
                                           Object... values)
column - values - 
public static SqlStatement.Condition in(Schema.Column column,
                                        SqlStatement.Select select)
column - select - 
public static SqlStatement.Condition notIn(Schema.Column column,
                                           SqlStatement.Select select)
column - select - 
public static SqlStatement.Condition between(Schema.Column column,
                                             Object lVal,
                                             Object rVal)
column - lVal - min value for range checkingrVal - max value for range checking
public static SqlStatement.Condition notBetween(Schema.Column column,
                                                Object lVal,
                                                Object rVal)
column - lVal - min value for range checkingrVal - max value for range checking
public static SqlStatement.Condition and(SqlStatement.Condition... conds)
conds - list of conditions for AND
public static SqlStatement.Condition or(SqlStatement.Condition... conds)
conds - list of conditions for OR
public PreparedStatement prepareAndSetValues(Connection conn)
                                      throws SQLException
conn - Connection
SQLException
public PreparedStatement prepare(PreparedStatement pStmt)
                          throws SQLException
pStmt - Prepared Statement
SQLException
public PreparedStatement prepare(Connection conn)
                          throws SQLException
conn - Connection
SQLException
public PreparedStatement prepareForBatch(Connection conn,
                                         List<? extends Map<Object,Object>> values,
                                         PreparedStatement pStmt)
                                  throws SQLException
conn - Connectionvalues - A list of maps that contains the actual values
SQLException
public SqlStatement setValue(Object oldVal,
                             Object newVal)
oldVal - Place holdernewVal - Actual Value
public SqlStatement getNewStatementWithValues(Map<Object,Object> newValues)
newValues - 
public static SqlStatement.ResultSetReader parse(ResultSet rSet)
ResultSetReader object that has the methods to access the data from the result set
rSet - Result Set
public static SqlStatement.Insert insertInto(Schema.Table table)
table - 
public static SqlStatement.Update update(Schema.Table table)
table - 
public static SqlStatement.Delete deleteFrom(Schema.Table table)
table - 
public static SqlStatement.Select selectAllFrom(Schema.Table... tables)
tables - 
public static SqlStatement.Select selectColumns(Schema.Column... columns)
columns - columns to select
public static SqlStatement.Select getCount(Schema.Table... tables)
tables - 
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||