Package | Description |
---|---|
com.healthmarketscience.sqlbuilder |
Builder-style classes for generating a wide variety of SQL statements (see
the Syntax Reference for
the major highlights).
|
com.healthmarketscience.sqlbuilder.custom |
SqlBuilder supports two types of custom SQL:
Custom values/expressions within existing queries - this type of
customization can be achieved using the custom SqlObject variants:
CustomSql , CustomExpression , and CustomCondition .
Custom clauses added to existing queries - the classes in this package
(and subpackages) enable this type of customization, read on for
details.
|
com.healthmarketscience.sqlbuilder.custom.mysql |
SqlBuilder customizations specific to the MySQL database.
|
com.healthmarketscience.sqlbuilder.custom.oracle |
SqlBuilder customizations specific to the Oracle database.
|
com.healthmarketscience.sqlbuilder.custom.postgresql |
SqlBuilder customizations specific to the PostgreSQL database.
|
com.healthmarketscience.sqlbuilder.custom.sqlserver |
SqlBuilder customizations specific to the SQL Server database.
|
Modifier and Type | Class and Description |
---|---|
class |
SqlObjectList<ObjType extends SqlObject>
Maintains a list of SqlObjects.
|
Modifier and Type | Class and Description |
---|---|
class |
AliasedObject
Outputs the given object with a column alias
"<obj> AS <alias>" . |
class |
AlterTableQuery
Query which generates an
ALTER TABLE statement. |
static class |
AlterTableQuery.AddColumnAction
"Action" for adding a column to a table.,
e.g.
|
static class |
AlterTableQuery.AddConstraintAction
Base "Action" for adding a constraint to a table.,
e.g.
|
static class |
AlterTableQuery.AddForeignConstraintAction
Deprecated.
use AddConstraintAction instead
|
static class |
AlterTableQuery.AddPrimaryConstraintAction
Deprecated.
use AddConstraintAction instead
|
static class |
AlterTableQuery.AddUniqueConstraintAction
Deprecated.
use AddConstraintAction instead
|
class |
BaseCaseStatement<ThisType extends BaseCaseStatement<ThisType>>
Common base class for
"CASE ... |
class |
BaseCreateQuery<ThisType extends BaseCreateQuery<ThisType>>
Query which generates a CREATE statement.
|
class |
BaseCTEQuery<ThisType extends BaseCTEQuery<ThisType>>
Base class for all queries which support common table expressions (the
"WITH " clause).
|
class |
BaseGrantQuery<ThisType extends BaseGrantQuery<ThisType>>
Base of a query which generates a query for manipulating privileges.
|
static class |
BaseGrantQuery.Privilege
Encapsulation of a database privilege.
|
static class |
BaseGrantQuery.TargetObject
Information about the database object upon which a privilege allows (or
disallows) action.
|
class |
BetweenCondition
Outputs a "BETWEEN" condition
"(<column> [NOT] BETWEEN (<rightObj1>, <rightObj2>, ...) )" |
class |
BinaryCondition
Outputs a binary midfix based condition
"(<column1> <binaryOp> <column2>)" . |
class |
BooleanValueObject
By default, outputs a boolean value as a number literal, where
true
== 1 and false == 0 . |
class |
CaseStatement
Outputs a case statement like:
"CASE WHEN <cond1> THEN <result1> [ WHEN
<cond2> THEN <result2> WHEN ... |
class |
CheckConstraintClause
Outputs a table or column CHECK constraint like:
"[CONSTRAINT <name> ] CHECK (<condition>)" |
class |
ComboCondition
Outputs combination conditions joined by a given string (AND, OR)
"(<cond1> <comboOp> <cond2> <comboOp> <cond3> ...)" . |
class |
ComboExpression
Outputs combination expressions joined by a given mathematical operation (+,
-, *, /) or string operation (||)
"(<expr1> <exprOp> <expr2> <exprOp> <expr3> ...)" . |
class |
Comment
Generates a comment, e.g.
|
class |
CommonTableExpression
Outputs the Common Table Expression (CTE) definition as part of a
"WITH " clause. |
class |
Condition
An object representing a conditional expression.
|
class |
ConstraintClause
Outputs a table or column constraint clause (depending on the current
context)
[ CONSTRAINT <name> ] <type> [ (<col1> ...) ] . |
class |
CreateIndexQuery
Query which generates a CREATE INDEX statement.
|
class |
CreateTableQuery
Query which generates a CREATE TABLE statement.
|
class |
CreateViewQuery
Query which generates a CREATE VIEW statement.
|
class |
CustomCondition
Outputs the given custom object surrounded by parentheses
"(<customCond>)" . |
class |
CustomExpression
Outputs the given custom object surrounded by parentheses
"(<customExpr>)" . |
class |
CustomizableSqlObject
Base class for all SqlObjects which support SQL syntax customizations.
|
class |
CustomSql
Outputs the given object as is (can be used to insert any custom SQL into a
statement).
|
class |
DeleteQuery
Query which generates a DELETE statement.
|
class |
DropQuery
Query which generates a DROP statement.
|
class |
ExceptQuery
Query which generates a series of SELECT queries joined by EXCEPT clauses.
|
class |
Expression
An object representing a value expression.
|
class |
ExtractExpression
Outputs an extract expression like:
"EXTRACT(<datePart> FROM <dateExpression>)" |
class |
ForeignKeyConstraintClause
Outputs a table or column foreign constraint clause (depending on the
current context)
[ CONSTRAINT <name> ] FOREIGN KEY [ (<col1> ...) ] REFERENCES <refRable> [ (<refCol1> ...) ] . |
class |
FunctionCall
Outputs a function call
"<name>([<param1>, ... |
class |
GrantQuery
Query which generates a GRANT (privileges) statement.
|
class |
InCondition
Outputs an "IN" condition
"(<column> [NOT] IN (<rightObj1>, <rightObj2>, ...) )" |
class |
InsertQuery
Query which generates a simple INSERT statement.
|
class |
InsertSelectQuery
Query which generates an INSERT statement where the data is generated from
a SELECT query.
|
class |
IntersectQuery
Query which generates a series of SELECT queries joined by INTERSECT
clauses.
|
class |
JdbcEscape
Outputs SQL and a prefix enclosed within JDBC escape syntax
"{<prefix> <sql>}" . |
class |
JdbcScalarFunction
Outputs a JDBC escaped scalar function call
"{fn <funcCall>}" . |
class |
NegateExpression
Outputs the negation of the given expression "(- <expression>)"
|
class |
NotCondition
Outputs the negation of the given condition "(NOT <condition>)"
|
class |
NumberValueObject
Outputs a number literal
<value> . |
class |
OrderObject
Outputs the given object along with an order specification
<obj> <dir> |
class |
Query<ThisType extends Query<ThisType>>
Base class for all query statements which adds a validation facility.
|
static class |
QueryPreparer.BooleanStaticPlaceHolder
StaticPlaceHolder which calls setInt on the PreparedStatement
with the saved value.
|
static class |
QueryPreparer.IntegerStaticPlaceHolder
StaticPlaceHolder which calls setInt on the PreparedStatement
with the saved value.
|
static class |
QueryPreparer.ListPlaceHolder
A SqlObject which outputs 0 or more '?' separated by commas, and records
the current indexes at the times the
appendTo method is
called. |
static class |
QueryPreparer.LongStaticPlaceHolder
StaticPlaceHolder which calls setLong on the PreparedStatement
with the saved value.
|
static class |
QueryPreparer.MultiPlaceHolder
A SqlObject which outputs a '?', and records the current index at the
time(s) the
appendTo method is called. |
static class |
QueryPreparer.NullStaticPlaceHolder
StaticPlaceHolder which always calls setNull on the PreparedStatement
with the saved sql type.
|
static class |
QueryPreparer.ObjectStaticPlaceHolder<ObjType>
StaticPlaceHolder which calls setObject on the PreparedStatement
with the saved value.
|
static class |
QueryPreparer.PlaceHolder
A SqlObject which outputs a '?', and records the current index at the
time the
appendTo method is called. |
static class |
QueryPreparer.StaticPlaceHolder
Convenience PlaceHolder which also maintains a value which will always be
inserted into the PreparedStatement when
setValue is called. |
static class |
QueryPreparer.StringStaticPlaceHolder
StaticPlaceHolder which calls setString on the PreparedStatement
with the saved value.
|
static class |
QueryPreparer.TypedStaticPlaceHolder
StaticPlaceHolder which calls setObject on the PreparedStatement
with the saved value and the saved sql type.
|
static class |
QueryReader.Column
A SqlObject which outputs the passed in SqlObject, and records the
current index at the time the
appendTo method is called. |
class |
RevokeQuery
Query which generates a REVOKE (privileges) statement.
|
class |
SelectQuery
Query which generates a SELECT statement.
|
class |
SetOperationQuery<ThisType extends SetOperationQuery<ThisType>>
Base query for queries which generate a series of SELECT queries joined by
one or more "set operations", such as UNION [ALL], EXCEPT [ALL], and
INTERSECT [ALL].
|
class |
SimpleCaseStatement
Outputs a simple case statement like:
"CASE <column1> WHEN <val1> THEN <result1> [ WHEN
<val2> THEN <result2> WHEN ... |
class |
SqlObjectList<ObjType extends SqlObject>
Maintains a list of SqlObjects.
|
class |
Subquery
Outputs the given query surrounded by parentheses
"(<query>)" , useful for embedding one query within
another. |
class |
UnaryCondition
Outputs a unary based condition
"(<column> <unaryOp>)" or
"(<unaryOp> <column>)" . |
class |
UnionQuery
Query which generates a series of SELECT queries joined by UNION clauses.
|
class |
UpdateQuery
Query which generates an UPDATE statement.
|
class |
ValueObject
Outputs a quoted value
"'<value>'" . |
class |
WindowDefinitionClause
Outputs a window function clause like:
([PARTITION BY <cols>] [ORDER BY <cols>] [<frameClause>])
Can be used inline on a FunctionCall or via a named reference in a
SelectQuery . |
static class |
WindowDefinitionClause.FrameBound
Outputs a bound for the window frame clause.
|
Modifier and Type | Field and Description |
---|---|
protected SqlObject |
AlterTableQuery.AddConstraintAction._constraint |
protected SqlObject |
ConstraintClause._name |
protected SqlObject |
BaseCreateQuery._object |
protected SqlObject |
Subquery._query |
protected SqlObject |
ForeignKeyConstraintClause._refTable |
protected SqlObject |
CreateIndexQuery._table |
protected SqlObject |
BaseGrantQuery._targetObj |
static SqlObject |
SqlObject.ALL_SYMBOL
SqlObject which represents a
* string for generating
"SELECT *" statements. |
static SqlObject |
SqlObject.NULL_VALUE
SqlObject which represents a
NULL value string |
static SqlObject |
BaseGrantQuery.PUBLIC_GRANTEE
grantee object which represents PUBLIC access
|
static SqlObject |
SqlObject.QUESTION_MARK
SqlObject which represents a
? string for generating
prepared statements. |
Modifier and Type | Field and Description |
---|---|
protected SqlObjectList<SqlObject> |
ConstraintClause._columns |
protected SqlObjectList<SqlObject> |
BaseCreateQuery._columns |
protected SqlObjectList<SqlObject> |
CreateTableQuery._constraints |
protected SqlObjectList<SqlObject> |
BaseGrantQuery._grantees |
protected SqlObjectList<SqlObject> |
BaseGrantQuery._privileges |
protected SqlObjectList<SqlObject> |
ForeignKeyConstraintClause._refColumns |
static Converter<Column,SqlObject> |
Converter.COLUMN_TO_OBJ
Converter which converts a Column to a ColumnObject.
|
static Converter<Object,SqlObject> |
Converter.COLUMN_VALUE_TO_OBJ
Converter which converts a column value object to a SqlObject using
Converter.toColumnSqlObject(Object) |
static Converter<Object,SqlObject> |
Converter.CUSTOM_COLUMN_TO_OBJ
Converter which converts a custom column object to a SqlObject using
Converter.toCustomColumnSqlObject(Object) |
static Converter<Object,SqlObject> |
Converter.CUSTOM_TABLE_DEF_TO_OBJ
Converter which converts a custom table def object to a SqlObject using
Converter.toCustomTableDefSqlObject(Object) |
static Converter<Object,SqlObject> |
Converter.CUSTOM_TO_CONSTRAINTCLAUSE
Converter which converts an Object to a SqlObject using
Converter.toCustomConstraintSqlObject(java.lang.Object) |
static Converter<Object,SqlObject> |
Converter.CUSTOM_TO_OBJ
Converter which converts an Object to a CustomSql using
Converter.toCustomSqlObject(Object) |
static Converter<Object,SqlObject> |
Converter.TYPED_COLUMN_TO_OBJ
Converter which converts a Column to a TypedColumnObject or a value
object to a SqlObject using
Converter.toCustomSqlObject(Object) |
static Converter<Object,SqlObject> |
Converter.VALUE_TO_OBJ
Converter which converts a value object to a SqlObject using
Converter.toValueSqlObject(Object) |
Modifier and Type | Method and Description |
---|---|
static <ObjType extends SqlObject> |
SqlObjectList.create()
Constructs and returns a new SqlObjectList, conveniently allows
construction without respecifying generic param type.
|
static <ObjType extends SqlObject> |
SqlObjectList.create(String delimiter)
Constructs and returns a new SqlObjectList, conveniently allows
construction without respecifying generic param type.
|
Modifier and Type | Method and Description |
---|---|
SqlObject |
QueryReader.Column.getCustomColumnObject() |
static SqlObject |
AliasedObject.toAliasedObject(SqlObject obj,
String alias)
Optionally adds an alias to a SqlObject.
|
static SqlObject |
Converter.toColumnSqlObject(Column col)
Converts a Column to a SqlObject.
|
static SqlObject |
Converter.toColumnSqlObject(Column col,
String alias)
Converts a Column to a SqlObject with the given alias.
|
static SqlObject |
Converter.toColumnSqlObject(Object obj)
Converts a column Object to a SqlObject.
|
static SqlObject |
Converter.toColumnSqlObject(Object obj,
String alias)
Converts a column Object to a SqlObject with the given alias.
|
static SqlObject |
Converter.toConstraintSqlObject(Constraint constraint)
Converts a Constraint to a SqlObject.
|
static SqlObject |
Converter.toCustomColumnSqlObject(Object obj)
Converts a column Object to a SqlObject.
|
static SqlObject |
Converter.toCustomColumnSqlObject(Object obj,
String alias)
Converts a column Object to a SqlObject.
|
static SqlObject |
Converter.toCustomConstraintClause(Object obj)
Converts an constraint clause Object to a SqlObject.
|
static SqlObject |
Converter.toCustomConstraintSqlObject(Object obj)
Converts a constraint Object to a SqlObject for use in a constraint
clause..
|
static SqlObject |
Converter.toCustomFunctionSqlObject(Object obj)
Converts a function Object to a SqlObject.
|
static SqlObject |
Converter.toCustomIndexSqlObject(Object obj)
Converts a index Object to a SqlObject.
|
static SqlObject |
Converter.toCustomSqlObject(Object obj)
Converts an Object to a custom SqlObject.
|
static SqlObject |
Converter.toCustomSqlObject(Object obj,
String alias)
Converts an Object to a custom SqlObject.
|
static SqlObject |
Converter.toCustomTableDefSqlObject(Object table)
Converts a table Object to a SqlObject.
|
static SqlObject |
Converter.toCustomTableSqlObject(Object obj)
Converts a table Object to a SqlObject.
|
static SqlObject |
Converter.toCustomTypedColumnSqlObject(Object column)
Converts a column Object to a SqlObject.
|
static SqlObject |
Converter.toFunctionSqlObject(Function function)
Converts a Function to a SqlObject.
|
static SqlObject |
Converter.toIndexSqlObject(Index index)
Converts a Index to a SqlObject.
|
static SqlObject |
Converter.toTableDefSqlObject(Table table)
Converts a Table to a table definition SqlObject.
|
static SqlObject |
Converter.toTableSqlObject(Table table)
Converts a Table to a SqlObject.
|
static SqlObject |
Converter.toValueSqlObject(Object obj)
Converts a value Object to a SqlObject.
|
static SqlObject |
Converter.toValueSqlObject(Object obj,
String alias)
Converts a value Object to a SqlObject with the given alias.
|
Modifier and Type | Method and Description |
---|---|
Converter<Object,? extends SqlObject> |
UnaryCondition.CustomUnaryOp.getConverter()
Returns the Converter which handles the
Object -> SqlObject conversion for the operation value. |
Converter<Object,? extends SqlObject> |
UnaryCondition.Op.getConverter() |
Modifier and Type | Method and Description |
---|---|
SqlObjectList<ObjType> |
SqlObjectList.addObjects(ObjType... objs)
Adds the given objects to the list
|
void |
ValidationContext.collectNestedQuerySchemaObjects(SqlObject nestedQuery)
Handles schema object collection for nested queries.
|
static void |
SqlObject.collectSchemaObjects(SqlObject obj,
ValidationContext vContext)
Utility method for classes which may not be in this package to invoke
collectSchemaObjects(ValidationContext) on a SqlObject. |
protected void |
CustomizableSqlObject.maybeAppendTo(AppendableExt app,
HookAnchor anchor,
String clauseText,
SqlObject clauseContent,
boolean includeClause)
Appends the appropriate customizations for the given anchor (and possibly
the anchor clause itself) based on whether or not the clause should be
included.
|
static SqlObject |
AliasedObject.toAliasedObject(SqlObject obj,
String alias)
Optionally adds an alias to a SqlObject.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
SelectQuery.validateOrdering(int numColumns,
SqlObjectList<SqlObject> ordering,
boolean ignoreColumnCount)
Checks any indexed ordering values for validity using a variety of
criteria.
|
Constructor and Description |
---|
AliasedObject(SqlObject obj,
String alias) |
BaseCaseStatement(SqlObject operand) |
BaseCreateQuery(SqlObject objectStr) |
BinaryCondition(BinaryCondition.Op binaryOp,
SqlObject leftValue,
SqlObject rightValue) |
CustomCondition(SqlObject condStr) |
CustomExpression(SqlObject exprStr) |
JdbcEscape(JdbcEscape.Type type,
SqlObject val) |
OrderObject(OrderObject.Dir dir,
SqlObject obj) |
TargetObject(BaseGrantQuery.TargetObject.Type type,
SqlObject name) |
UnaryCondition(UnaryCondition.Op unaryOp,
SqlObject obj) |
Modifier and Type | Class and Description |
---|---|
class |
CustomSyntax
Utility base class for custom SQL syntax instances.
|
class |
NamedParamObject
SqlObject expression which inserts a "named" parameter like
":<name>" . |
Modifier and Type | Class and Description |
---|---|
class |
MysLimitClause
Appends a MySQL limit clause like
" LIMIT [<offset>] <limit>" for
use in SelectQuery s. |
Modifier and Type | Field and Description |
---|---|
static SqlObject |
MysObjects.AUTO_INCREMENT_COLUMN
Appends a MySQL
"AUTO_INCREMENT " column constraint. |
Modifier and Type | Class and Description |
---|---|
class |
OraTableSpaceClause
Appends an Oracle
" TABLESPACE ..." clause to a CreateTableQuery or CreateIndexQuery if a tableSpace has been
specified. |
Modifier and Type | Field and Description |
---|---|
static SqlObject |
OraObjects.ROWNUM
SqlObject which represents the Oracle
ROWNUM pseudo-column. |
Modifier and Type | Class and Description |
---|---|
class |
PgBinaryCondition
Condition which supports PostgreSQL specific binary operators.
|
class |
PgLimitClause
Appends a PostgreSQL limit clause like
" LIMIT <limit>" for use in
SelectQuery s. |
class |
PgOffsetClause
Appends a PostgreSQL offset clause like
" OFFSET <offset>" for use in
SelectQuery s. |
Modifier and Type | Class and Description |
---|---|
class |
MssTopClause
Appends a SQLServer TOP clause like
" TOP <count> [PERCENT]" for
use in SelectQuery s. |
Copyright © 2006–2021 OpenHMS. All rights reserved.