H2QueryBuilder
This helper class is used to build SQL statements.
| Methods |
| static void |
appendColumns(StringBuilder s, String[] columns)
Append the column to the string builder.
|
| static void |
appendColumns(StringBuilder s, String[] columns)
Append the column to the string builder. The columns are separated by
comma.
Parameters:
s - the target string builder
columns - the columns
|
| static String |
buildQueryString(boolean distinct, String tables, String[] columns, String where, String groupBy, String having, String orderBy, String limit)
Return the SELECT statement for the given parameters.
|
| static String |
buildQueryString(boolean distinct, String tables, String[] columns, String where, String groupBy, String having, String orderBy, String limit)
Return the SELECT statement for the given parameters.
Parameters:
distinct - if only distinct rows should be returned
tables - the list of tables
columns - the list of columns
where - the where condition or null
groupBy - the group by list or null
having - the having condition or null
orderBy - the order by list or null
limit - the limit or null
Returns:
the query
|
| void |
appendWhere(CharSequence inWhere)
Append the text to the where clause.
|
| void |
appendWhere(CharSequence inWhere)
Append the text to the where clause.
Parameters:
inWhere - the text to append
|
| void |
appendWhereEscapeString(String inWhere)
Append the text to the where clause.
|
| void |
appendWhereEscapeString(String inWhere)
Append the text to the where clause. The text is escaped.
Parameters:
inWhere - the text to append
|
| String |
buildQuery(String[] projectionIn, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit)
Return the SELECT UNION statement for the given parameters.
|
| String |
buildQuery(String[] projectionIn, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit)
Return the SELECT UNION statement for the given parameters.
Parameters:
projectionIn - TODO
selection - TODO
selectionArgs - TODO
groupBy - the group by list or null
having - the having condition or null
orderBy - the order by list or null
limit - the limit or null
Returns:
the query
|
| String |
buildUnionQuery(String[] subQueries, String orderBy, String limit)
Return the SELECT UNION statement for the given parameters.
|
| String |
buildUnionQuery(String[] subQueries, String orderBy, String limit)
Return the SELECT UNION statement for the given parameters.
Parameters:
subQueries - TODO
orderBy - the order by list or null
limit - the limit or null
Returns:
the query
|
| String |
buildUnionSubQuery(String typeDiscriminatorColumn, String[] unionColumns, Set columnsPresentInTable, int computedColumnsOffset, String typeDiscriminatorValue, String selection, String[] selectionArgs, String groupBy, String having)
Return the SELECT UNION statement for the given parameters.
|
| String |
buildUnionSubQuery(String typeDiscriminatorColumn, String[] unionColumns, Set columnsPresentInTable, int computedColumnsOffset, String typeDiscriminatorValue, String selection, String[] selectionArgs, String groupBy, String having)
Return the SELECT UNION statement for the given parameters.
Parameters:
typeDiscriminatorColumn - TODO
unionColumns - TODO
columnsPresentInTable - TODO
computedColumnsOffset - TODO
typeDiscriminatorValue - TODO
selection - TODO
selectionArgs - TODO
groupBy - the group by list or null
having - the having condition or null
Returns:
the query
|
| String |
getTables()
Get the list of tables.
|
| String |
getTables()
Get the list of tables.
Returns:
the list of tables
|
| Cursor |
query(H2Database db, String[] projectionIn, String selection, String[] selectionArgs, String groupBy, String having, String orderBy)
Run the query for the given parameters.
|
| Cursor |
query(H2Database db, String[] projectionIn, String selection, String[] selectionArgs, String groupBy, String having, String orderBy)
Run the query for the given parameters.
Parameters:
db - the connection
projectionIn - TODO
selection - TODO
selectionArgs - TODO
groupBy - the group by list or null
having - the having condition or null
orderBy - the order by list or null
Returns:
the cursor
|
| Cursor |
query(H2Database db, String[] projectionIn, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit)
Run the query for the given parameters.
|
| Cursor |
query(H2Database db, String[] projectionIn, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit)
Run the query for the given parameters.
Parameters:
db - the connection
projectionIn - TODO
selection - TODO
selectionArgs - TODO
groupBy - the group by list or null
having - the having condition or null
orderBy - the order by list or null
limit - the limit or null
Returns:
the cursor
|
| void |
setCursorFactory(H2Database.CursorFactory factory)
Set the cursor factory.
|
| void |
setCursorFactory(H2Database.CursorFactory factory)
Set the cursor factory.
Parameters:
factory - the new value
|
| void |
setDistinct(boolean distinct)
Enable or disable the DISTINCT flag.
|
| void |
setDistinct(boolean distinct)
Enable or disable the DISTINCT flag.
Parameters:
distinct - the new value
|
| void |
setProjectionMap(Map columnMap)
TODO
|
| void |
setProjectionMap(Map columnMap)
TODO
Parameters:
columnMap - TODO
|
| void |
setTables(String inTables)
Set the list of tables.
|
| void |
setTables(String inTables)
Set the list of tables.
Parameters:
inTables - the list of tables
|
|