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.
See: Description
Interface | Description |
---|---|
HookAnchor |
Marker interface for the custom hook anchors use by specific SqlObjects.
|
Class | Description |
---|---|
CustomSyntax |
Utility base class for custom SQL syntax instances.
|
NamedParamObject |
SqlObject expression which inserts a "named" parameter like
":<name>" . |
Enum | Description |
---|---|
HookType |
Enum defining the type of customization relative to the HookAnchor
(which is typically a sub-clause within a query).
|
CustomSql
, CustomExpression
, and CustomCondition
.Inserting custom SQL syntax into queries involves a few different pieces all working together.
SelectQuery
). This is done via a
nested Hook
enum which defines the "hook anchors" for that type
(e.g. SelectQuery.Hook
).HookAnchor
marker interface)
defines locations within the related query in which custom SQL syntax
can be inserted. Custom SQL syntax generally falls into one of two
categories: additional keywords which enhance an existing clause or
additional sub-clauses within a query. In both cases, the custom
syntax needs to be inserted into the correct location within the query
and the "hook anchor" provides the first of two important bits of
location information.HookType
is the
second bit of important information which ties the custom SQL syntax to
the correct location in the query. It defines how the custom syntax
should be inserted relative to the "hook anchor".CustomSyntax
, but that is
not a requirement. CustomSyntax
based implementations know how
to insert themselves into the correct location in relevant queries so
they can easily be added to a query using the simplified addCustomization()
method (e.g. SelectQuery.addCustomization(CustomSyntax)
).
However, any ad hoc custom syntax can be added to customizable queries
by specifying the HookType and "hook anchor" when adding (e.g. SelectQuery.addCustomization(Hook,HookType,Object)
)SqlBuilder currently has existing constructs for few common database specific customizations:
com.healthmarketscience.sqlbuilder.custom.oracle
com.healthmarketscience.sqlbuilder.custom.mysql
com.healthmarketscience.sqlbuilder.custom.postgresql
com.healthmarketscience.sqlbuilder.custom.sqlserver
Only a few SqlBuilder queryies are currently customizable:
Copyright © 2006–2021 OpenHMS. All rights reserved.