|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.triactive.jdo.store.adapter.DatabaseAdapter
Provides methods for adapting SQL language elements to a specific vendor's database. A database adapter is primarily used to map generic JDBC data types and SQL identifiers to specific types/identifiers suitable for the database in use.
Each database adapter corresponds to a particular combination of database,
database version, driver, and driver version, etc. as provided by the
driver's own metadata.
Database adapters cannot be constructed directly, but must be obtained using
the getInstance(java.sql.Connection)
method.
DatabaseMetaData
Field Summary | |
protected DatabaseIdentifier |
dbid
The identifier for the underlying database. |
protected java.lang.String |
identifierQuoteString
The String used to quote SQL identifiers. |
protected java.util.Set |
keywords
The set of SQL keywords for this DBMS, in upper-case. |
protected int |
maxCatalogNameLength
The maximum length to be used for a schema name. |
protected int |
maxColumnNameLength
The maximum length to be used for a column name. |
protected int |
maxConstraintNameLength
The maximum length to be used for a table constraint name. |
protected int |
maxCorrelationNameLength
The maximum length to be used for a correlation name. |
protected int |
maxIndexNameLength
The maximum length to be used for an index name. |
protected int |
maxSchemaNameLength
The maximum length to be used for a schema name. |
protected int |
maxTableNameLength
The maximum length to be used for a table name. |
protected boolean |
storesLowerCaseIdentifiers
true if the database stores all identifiers in lower-case. |
protected boolean |
storesUpperCaseIdentifiers
true if the database stores all identifiers in upper-case. |
protected boolean |
supportsCorrelatedSubqueries
true if the database supports correlated subqueries. |
protected boolean |
supportsGroupByUnrelated
true if the database supports using a column that is not in the SELECT statement in a GROUP BY clause. |
protected boolean |
supportsOrderByUnrelated
true if the database supports using a column that is not in the SELECT statement in an ORDER BY clause. |
protected boolean |
supportsSubqueriesInExists
true if the database supports subqueries in EXISTS. |
protected boolean |
supportsSubqueriesInIns
true if the database supports subqueries in IN. |
protected java.util.Map |
typeMappings
A map of Java types to Mapping classes. |
protected java.util.List |
types
A list of TypeInfo object representing all the data types, in the
order returned by DatabaseMetaData.getTypeInfo() . |
Constructor Summary | |
protected |
DatabaseAdapter()
|
Method Summary | |
protected void |
adaptTo(DatabaseIdentifier dbid,
java.sql.DatabaseMetaData dmd)
Initializes the database adapter based on the given JDBC metadata. |
SqlExpression |
avgFunction(SqlExpression expr)
Returns the appropriate SQL expression for the JDOQL AVG() function. |
boolean |
bitTypeIsReallyBoolean()
true if the primary (ie first) eligible boolean data type is Types.BIT but in fact it fully behaves as a boolean type. |
SqlExpression |
cast(SqlExpression expr,
java.lang.Class toType)
Returns the appropriate SQL expression for casting an expression to another type. |
SqlExpression |
countFunction(SqlExpression expr)
Returns the appropriate SQL expression for the JDOQL COUNT() function. |
boolean |
createIndexesBeforeForeignKeys()
|
protected void |
createTypeInfo(java.sql.DatabaseMetaData dmd)
Creates TypeInfo objects for all of the data types and saves them in the 'types' list. |
java.lang.String |
getAddCandidateKeyStatement(ConstraintName ckName,
CandidateKey ck)
Returns the appropriate SQL to add a candidate key to its table. |
java.lang.String |
getAddForeignKeyStatement(ConstraintName fkName,
ForeignKey fk)
Returns the appropriate SQL to add a foreign key to its table. |
java.lang.String |
getAddPrimaryKeyStatement(ConstraintName pkName,
PrimaryKey pk)
Returns the appropriate SQL to add a primary key to its table. |
protected DatabaseIdentifier |
getBestIdentifyingPatterns()
Returns a database identifier containing patterns with which to identify which databases are best supported by this adapter. |
java.lang.String |
getCreateIndexStatement(IndexName idxName,
Index idx)
Returns the appropriate SQL to add an index to its table. |
java.lang.String |
getCreateTableStatement(BaseTable table,
Column[] columns)
Returns the appropriate SQL to create the given table having the given columns. |
java.sql.Timestamp |
getCurrentTimestamp(java.sql.Connection conn)
Returns a timestamp reflecting the database's current date and time. |
java.lang.String |
getDropForeignKeyStatement(BaseTable table,
ConstraintName fkName)
Returns the appropriate SQL to drop a foreign key from its table. |
java.lang.String |
getDropTableStatement(BaseTable table)
Returns the appropriate SQL to drop the given table. |
java.lang.String |
getDropViewStatement(View view)
Returns the appropriate SQL to drop the given view. |
java.lang.String |
getIdentifierQuoteString()
|
static DatabaseAdapter |
getInstance(java.sql.Connection conn)
Returns a DatabaseAdapter object appropriate for the database currently underlying the given Connection . |
int |
getMaxCatalogNameLength()
|
int |
getMaxColumnNameLength()
|
int |
getMaxConstraintNameLength()
|
int |
getMaxCorrelationNameLength()
|
int |
getMaxIndexNameLength()
|
int |
getMaxPreparedStatementParameters()
|
int |
getMaxSchemaNameLength()
|
int |
getMaxTableNameLength()
|
protected java.lang.String |
getQueryCurrentSchemaNameStatement()
Returns a statement that will return the name of the current schema. |
protected java.lang.String |
getQueryCurrentTimestampStatement()
Returns a statement that will return a timestamp reflecting the database's current date and time. |
java.lang.String |
getSchemaName(java.sql.Connection conn)
Returns name of the current schema on the specified connection. |
SqlState |
getSqlState(java.sql.SQLException se)
Returns a SqlState object for the specified SQLException, if one is present and valid. |
TypeInfo |
getTypeInfo(int dataType)
Returns type information for the database type that best implements the given JDBC type. |
TypeInfo |
getTypeInfo(int[] candidateDataTypes)
Returns type information for the first one of the given candidate JDBC data types supported by this database. |
int |
getUnlimitedLengthPrecisionValue(TypeInfo typeInfo)
Returns the precision value to be used when creating string columns of "unlimited" length. |
java.lang.String |
getVendorID()
Returns the unique vendor ID for databases served by this adapter. |
protected boolean |
isBestAdapterFor(DatabaseIdentifier dbid,
java.sql.DatabaseMetaData dmd)
Returns true if this adapter is best suited for use with
the specified database, based on its identifier and/or metadata. |
boolean |
isEmbeddedType(java.lang.Class c)
|
boolean |
isSqlKeyword(java.lang.String word)
Tests if a given string is a SQL key word. |
SqlExpression |
lengthMethod(StringExpression str)
Returns the appropriate SQL expression for the JDOQL String.length() method. |
protected java.lang.Class |
mappingClassFor(java.lang.Class c)
|
protected java.lang.Class |
mappingClassFor(FieldMetaData fmd)
|
SqlExpression |
maxFunction(SqlExpression expr)
Returns the appropriate SQL expression for the JDOQL MAX() function. |
SqlExpression |
minFunction(SqlExpression expr)
Returns the appropriate SQL expression for the JDOQL MIN() function. |
ColumnInfo |
newColumnInfo(java.sql.ResultSet rs)
A factory for ColumnInfo objects. |
ColumnMapping |
newColumnMapping(java.lang.Class c)
|
javax.jdo.JDOException |
newDataStoreException(java.lang.String message,
java.sql.SQLException e)
Create the appropriate JDODataStoreException or
JDOFatalDataStoreException for the given
SQLException based on whether the action causing
the exception has aborted the current transaction. |
ForeignKeyInfo |
newForeignKeyInfo(java.sql.ResultSet rs)
A factory for ForeignKeyInfo objects. |
IndexInfo |
newIndexInfo(java.sql.ResultSet rs)
A factory for IndexInfo objects. |
Mapping |
newMapping(java.lang.Class c)
|
Mapping |
newMapping(FieldMetaData fmd)
|
PrimaryKeyInfo |
newPrimaryKeyInfo(java.sql.ResultSet rs)
A factory for PrimaryKeyInfo objects. |
QueryStatement |
newQueryStatement(StoreManager storeMgr,
Table table)
|
QueryStatement |
newQueryStatement(StoreManager storeMgr,
Table table,
CorrelationName rangeVar)
|
QueryStatement |
newQueryStatement(StoreManager storeMgr,
Table table,
CorrelationName rangeVar,
QueryStatement subquery)
|
TableExpression |
newTableExpression(QueryStatement qs,
Table table,
CorrelationName rangeVar)
Returns a new TableExpression object appropriate for this DBMS. |
TableInfo |
newTableInfo(java.sql.ResultSet rs)
A factory for TableInfo objects. |
protected TypeInfo |
newTypeInfo(java.sql.ResultSet rs,
int row)
A factory for TypeInfo objects. |
protected static java.util.Set |
parseKeywordList(java.lang.String list)
Parses a comma-separated list of strings and returns them as a set. |
boolean |
storesLowerCaseIdentifiers()
|
boolean |
storesUpperCaseIdentifiers()
|
SqlExpression |
substringMethod(StringExpression str,
NumericExpression begin)
Returns the appropriate SQL expression for the JDOQL String.substring(str,begin) method. |
SqlExpression |
substringMethod(StringExpression str,
NumericExpression begin,
NumericExpression end)
Returns the appropriate SQL expression for the JDOQL String.substring(str,begin,end) method. |
SqlExpression |
sumFunction(SqlExpression expr)
Returns the appropriate SQL expression for the JDOQL SUM() function. |
boolean |
supportsBooleanComparison()
Indicates whether or not two boolean expressions can be directly compared to each other using the = or <> operator. |
boolean |
supportsCorrelatedSubqueries()
|
boolean |
supportsDeferredConstraints()
|
boolean |
supportsGroupByUnrelated()
|
boolean |
supportsNullsInCandidateKeys()
|
boolean |
supportsOrderByUnrelated()
|
boolean |
supportsSubqueriesInExists()
|
boolean |
supportsSubqueriesInIns()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected DatabaseIdentifier dbid
protected int maxCatalogNameLength
protected int maxSchemaNameLength
protected int maxTableNameLength
protected int maxConstraintNameLength
protected int maxCorrelationNameLength
protected int maxIndexNameLength
protected int maxColumnNameLength
protected boolean storesLowerCaseIdentifiers
protected boolean storesUpperCaseIdentifiers
protected boolean supportsCorrelatedSubqueries
protected boolean supportsSubqueriesInExists
protected boolean supportsSubqueriesInIns
protected boolean supportsGroupByUnrelated
protected boolean supportsOrderByUnrelated
protected java.lang.String identifierQuoteString
protected java.util.Set keywords
protected java.util.List types
TypeInfo
object representing all the data types, in the
order returned by DatabaseMetaData.getTypeInfo()
.
protected java.util.Map typeMappings
Mapping.getDefaultMappingsByType()
Constructor Detail |
protected DatabaseAdapter()
Method Detail |
public static DatabaseAdapter getInstance(java.sql.Connection conn) throws java.sql.SQLException
Connection
.
Databases are identified by constructing a DatabaseIdentifier
using the connection's DatabaseMetaData.
Multiple calls to this method with connections producing the same
DatabaseIdentifier will return the same
DatabaseAdapter.
conn
- an open database connection
java.sql.SQLException
- If a database error occurs.public java.lang.String getVendorID()
It is primarily used as a rough way for user code to distinguish among the dialects of SQL provided by different vendors. It is not intended to distinguish between releases over time of the same product. Strictly speaking two adapter classes could report the same vendor ID if they adapted to different versions of the same product.
The default implementation in this class derives a vendor ID by taking the adapter class name, removing the package prefix and any "Adapter" suffix, and converting to lower case.
protected DatabaseIdentifier getBestIdentifyingPatterns()
isBestAdapterFor(com.triactive.jdo.store.adapter.DatabaseIdentifier, java.sql.DatabaseMetaData)
.
Overriding this method is a simple but fairly flexible way for subclasses
to define which database(s) they support.
The default implementation in this class returns patterns that match the product name against the following regular expression:
If the vendor ID is a suitably unique keyword that would always be expected to occur in the product name of the target database (and to not occur in any others) then no other methods need to be overridden in order for the right adapter subclass to get selected."(?is).*" + getVendorID() + ".*"
getVendorID()
,
DatabaseIdentifier.matches(com.triactive.jdo.store.adapter.DatabaseIdentifier)
protected boolean isBestAdapterFor(DatabaseIdentifier dbid, java.sql.DatabaseMetaData dmd) throws java.sql.SQLException
true
if this adapter is best suited for use with
the specified database, based on its identifier and/or metadata.
This is the definitive method which determines whether or not an adapter
will be selected for use.
Once an adapter returns true
for a database, no other
adapters are consulted.
The default implementation in this class matches dbid
against the regex patterns returned by getBestIdentifyingPatterns()
.
Subclasses can override this method to perform a more sophisticated test.
dbid
- the database identifierdmd
- the database metadata
java.sql.SQLException
DatabaseIdentifier.matches(com.triactive.jdo.store.adapter.DatabaseIdentifier)
protected void adaptTo(DatabaseIdentifier dbid, java.sql.DatabaseMetaData dmd) throws java.sql.SQLException
dbid
- the database identifierdmd
- the database metadata
java.sql.SQLException
protected static java.util.Set parseKeywordList(java.lang.String list)
protected void createTypeInfo(java.sql.DatabaseMetaData dmd) throws java.sql.SQLException
adaptTo(com.triactive.jdo.store.adapter.DatabaseIdentifier, java.sql.DatabaseMetaData)
if
they want to customize the contents of types
.
java.sql.SQLException
public int getMaxCatalogNameLength()
public int getMaxSchemaNameLength()
public int getMaxTableNameLength()
public int getMaxConstraintNameLength()
public int getMaxCorrelationNameLength()
public int getMaxIndexNameLength()
public int getMaxColumnNameLength()
public int getMaxPreparedStatementParameters()
public boolean storesLowerCaseIdentifiers()
public boolean storesUpperCaseIdentifiers()
public java.lang.String getIdentifierQuoteString()
public boolean createIndexesBeforeForeignKeys()
public boolean supportsCorrelatedSubqueries()
public boolean supportsSubqueriesInExists()
public boolean supportsSubqueriesInIns()
public boolean supportsGroupByUnrelated()
public boolean supportsOrderByUnrelated()
public boolean supportsDeferredConstraints()
public boolean supportsNullsInCandidateKeys()
public boolean bitTypeIsReallyBoolean()
public boolean supportsBooleanComparison()
true
if boolean expressions can be compared,
false
otherwise.public SqlState getSqlState(java.sql.SQLException se)
se
- A caught SQL exception.
null
if se does not
contain a valid 5-character SQLSTATE.public javax.jdo.JDOException newDataStoreException(java.lang.String message, java.sql.SQLException e)
JDODataStoreException
or
JDOFatalDataStoreException
for the given
SQLException
based on whether the action causing
the exception has aborted the current transaction.
For historical reasons, the design of this method is flawed. To conform correctly to the spec, if a JDOFatalDataStoreException is returned then there should be some coordination with the appropriate PersistenceManager and its Transaction to allow them to reflect the fact that a transaction is no longer active. At the least, that means that this method would have to be passed a reference to a PersistenceManager.
An outstanding question remains how we can reliably determine via JDBC whether or not a failed statement has aborted the current database transaction. Bottom line, this area is ripe for refactoring.
The current implementation in this class always returns a new JDODataStoreException and never a JDOFatalDataStoreException.
message
- The message to include in the JDODataStoreException.e
- The SQLException to create a JDODataStoreException for.
JDODataStoreException
or
JDOFatalDataStoreException
that wraps the
given SQLException
. A fatal exception is used
to indicate that the active transaction has been aborted.protected TypeInfo newTypeInfo(java.sql.ResultSet rs, int row) throws java.sql.SQLException
ResultSet
object passed must have been
obtained from a call to DatabaseMetaData.getTypeInfo().
The constructor only retrieves the values from the current row; the
caller is required to advance to the next row with ResultSet.next()
.
rs
- The result set returned from DatabaseMetaData.getTypeInfo().row
- The current row number in the result set. The first row is 1.
null
if the type indicated by this row should be
excluded from use.
java.sql.SQLException
- If a database error occurs.public TableInfo newTableInfo(java.sql.ResultSet rs) throws java.sql.SQLException
The table information object is constructed from the current row of the given result set. The result set must have been obtained from a call to DatabaseMetaData.getTables().
The constructor only retrieves the values from the current row; the
caller is required to advance to the next row with ResultSet.next()
.
rs
- The result set returned from DatabaseMetaData.getTables().
java.sql.SQLException
- If a database error occurs.public ColumnInfo newColumnInfo(java.sql.ResultSet rs) throws java.sql.SQLException
The column information object is constructed from the current row of the given result set. The result set passed must have been obtained from a call to DatabaseMetaData.getColumns().
The constructor only retrieves the values from the current row; the
caller is required to advance to the next row with ResultSet.next()
.
rs
- The result set returned from DatabaseMetaData.getColumns().
java.sql.SQLException
- If a database error occurs.public PrimaryKeyInfo newPrimaryKeyInfo(java.sql.ResultSet rs) throws java.sql.SQLException
The primary key information object is constructed from the current row of the given result set. The result set must have been obtained from a call to DatabaseMetaData.getPrimaryKeys().
The constructor only retrieves the values from the current row; the
caller is required to advance to the next row with ResultSet.next()
.
rs
- The result set returned from DatabaseMetaData.getPrimaryKeys().
java.sql.SQLException
- If a database error occurs.public ForeignKeyInfo newForeignKeyInfo(java.sql.ResultSet rs) throws java.sql.SQLException
The column information object is constructed from the current row of the given result set. The result set passed must have been obtained from a call to DatabaseMetaData.getImportedKeys() or DatabaseMetaData.getExportedKeys().
The constructor only retrieves the values from the current row; the
caller is required to advance to the next row with ResultSet.next()
.
rs
- The result set returned from DatabaseMetaData.get??portedKeys().
java.sql.SQLException
- If a database error occurs.public IndexInfo newIndexInfo(java.sql.ResultSet rs) throws java.sql.SQLException
The index information object is constructed from the current row of the given result set. The result set must have been obtained from a call to DatabaseMetaData.getIndexInfo().
The constructor only retrieves the values from the current row; the
caller is required to advance to the next row with ResultSet.next()
.
rs
- The result set returned from DatabaseMetaData.getIndexInfo().
java.sql.SQLException
- If a database error occurs.public boolean isSqlKeyword(java.lang.String word)
The list of key words tested against is defined to contain all SQL/92
key words, plus any additional key words reported by the JDBC driver
for this adapter via DatabaseMetaData.getSQLKeywords()
.
In general, use of a SQL key word as an identifier should be avoided. SQL/92 key words are divided into reserved and non-reserved words. If a reserved word is used as an identifier it must be quoted with double quotes. Strictly speaking, the same is not true of non-reserved words. However, as C.J. Date writes in A Guide To The SQL Standard:
The rule by which it is determined within the standard that one key word needs to be reserved while another need not is not clear to this writer. In practice, it is probably wise to treat all key words as reserved.
word
- The word to test.
true
if word is a SQL key word for this
DBMS. The comparison is case-insensitive.Sql92Constants
public TypeInfo getTypeInfo(int dataType) throws UnsupportedDataTypeException
"Best" is taken simply to be the first type whose dataType number
matches.
That should be the type that most "closely ... maps" to the given JDBC
type based on the prescribed ordering for the rows returned by
DatabaseMetaData.getTypeInfo()
.
dataType
- JDBC type number of the data type.
UnsupportedDataTypeException
public TypeInfo getTypeInfo(int[] candidateDataTypes) throws UnsupportedDataTypeException
candidateDataTypes
- array of JDBC type numbers of the data types to be checked in order
of preference.
UnsupportedDataTypeException
public int getUnlimitedLengthPrecisionValue(TypeInfo typeInfo)
TypeInfo.precision
). However, for some
types in some databases the value must be computed specially.
typeInfo
- the typeInfo object for which the precision value is
needed.
public boolean isEmbeddedType(java.lang.Class c)
protected java.lang.Class mappingClassFor(java.lang.Class c)
protected java.lang.Class mappingClassFor(FieldMetaData fmd)
public final Mapping newMapping(java.lang.Class c)
public final Mapping newMapping(FieldMetaData fmd)
public final ColumnMapping newColumnMapping(java.lang.Class c)
public java.lang.String getSchemaName(java.sql.Connection conn) throws java.sql.SQLException
getQueryCurrentSchemaNameStatement()
and returns the string
from the first column of the first row of the result.
Subclasses can override this method to substitute an alternate way of
determining the current schema.
conn
- the connection
java.lang.UnsupportedOperationException
- If no method is available for determining the current schema.
java.sql.SQLException
- If executing the query fails.
javax.jdo.JDOFatalDataStoreException
- If the query returned no rows.public java.sql.Timestamp getCurrentTimestamp(java.sql.Connection conn) throws java.sql.SQLException
getQueryCurrentTimestampStatement()
and returns the Timestamp
from the first column of the first row of the result.
Subclasses can override this method to substitute an alternate way of
determining the current timestamp.
conn
- the connection
java.lang.UnsupportedOperationException
- If no method is available for determining the current timestamp.
java.sql.SQLException
- If executing the query fails.
javax.jdo.JDOFatalDataStoreException
- If the query returned no rows.protected java.lang.String getQueryCurrentSchemaNameStatement()
java.lang.UnsupportedOperationException
- If no statement is available for determining the current schema.protected java.lang.String getQueryCurrentTimestampStatement()
java.lang.UnsupportedOperationException
- If no statement is available for determining the current schema.public QueryStatement newQueryStatement(StoreManager storeMgr, Table table)
public QueryStatement newQueryStatement(StoreManager storeMgr, Table table, CorrelationName rangeVar)
public QueryStatement newQueryStatement(StoreManager storeMgr, Table table, CorrelationName rangeVar, QueryStatement subquery)
public TableExpression newTableExpression(QueryStatement qs, Table table, CorrelationName rangeVar)
qs
- The query statement in which the table expression will
be included.table
- The main table in the expression.rangeVar
- The SQL alias, or "range variable", to assign to the
expression or to the main table.public java.lang.String getCreateTableStatement(BaseTable table, Column[] columns)
CREATE TABLE FOO ( BAR VARCHAR(30), BAZ INTEGER )
table
- The table to create.columns
- The columns of the table.
public java.lang.String getAddPrimaryKeyStatement(ConstraintName pkName, PrimaryKey pk)
ALTER TABLE FOO ADD CONSTRAINT FOO_PK PRIMARY KEY (BAR)
pkName
- The name of the primary key to add.pk
- An object describing the primary key.
public java.lang.String getAddCandidateKeyStatement(ConstraintName ckName, CandidateKey ck)
ALTER TABLE FOO ADD CONSTRAINT FOO_CK UNIQUE (BAZ)
ckName
- The name of the candidate key to add.ck
- An object describing the candidate key.
public java.lang.String getAddForeignKeyStatement(ConstraintName fkName, ForeignKey fk)
ALTER TABLE FOO ADD CONSTRAINT FOO_FK1 FOREIGN KEY (BAR, BAZ) REFERENCES ABC (COL1, COL2)
fkName
- The name of the foreign key to add.fk
- An object describing the foreign key.
public java.lang.String getCreateIndexStatement(IndexName idxName, Index idx)
CREATE INDEX FOO_N1 ON FOO (BAR,BAZ) CREATE UNIQUE INDEX FOO_U1 ON FOO (BAR,BAZ)
idxName
- The name of the index to add.idx
- An object describing the index.
public java.lang.String getDropTableStatement(BaseTable table)
DROP TABLE FOO CASCADE
table
- The table to drop.
public java.lang.String getDropForeignKeyStatement(BaseTable table, ConstraintName fkName)
ALTER TABLE FOO DROP CONSTRAINT FOO_FK1
table
- The table from which to drop the foreign key.fkName
- The name of the foreign key to drop.
java.lang.UnsupportedOperationException
- If the DBMS doesn't support dropping foreign key constraints by
name.public java.lang.String getDropViewStatement(View view)
DROP VIEW FOO
view
- The view to drop.
public SqlExpression cast(SqlExpression expr, java.lang.Class toType)
CAST(expr AS type)
expr
- The expression to be cast.toType
- The Java type to cast it to.
public SqlExpression avgFunction(SqlExpression expr)
AVG(expr)
expr
- The argument to the AVG() function.
public SqlExpression countFunction(SqlExpression expr)
COUNT(expr)
expr
- The argument to the COUNT() function.
public SqlExpression maxFunction(SqlExpression expr)
MAX(expr)
expr
- The argument to the MAX() function.
public SqlExpression minFunction(SqlExpression expr)
MIN(expr)
expr
- The argument to the MIN() function.
public SqlExpression sumFunction(SqlExpression expr)
SUM(expr)
expr
- The argument to the SUM() function.
public SqlExpression lengthMethod(StringExpression str)
CHAR_LENGTH(str)
str
- The argument to the length() method.
public SqlExpression substringMethod(StringExpression str, NumericExpression begin)
Note that the value of begin is base 0 (Java-style), while most SQL string functions use base 1.SUBSTRING(str FROM begin)
str
- The first argument to the substring() method.begin
- The second argument to the substring() method.
public SqlExpression substringMethod(StringExpression str, NumericExpression begin, NumericExpression end)
Note that the value of begin is base 0 (Java-style), while most SQL string functions use base 1. Note also that an end position is given, while most SQL substring functions take a length.SUBSTRING(str FROM begin FOR len)
str
- The first argument to the substring() method.begin
- The second argument to the substring() method.end
- The third argument to the substring() method.
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |