站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 server API Documentation 英文版文档

SQLUtil (JBoss Server API) - JBoss 4.0.1 sp1 server API Documentation 英文版文档


org.jboss.ejb.plugins.cmp.jdbc
Class SQLUtil

java.lang.Object
  extended byorg.jboss.ejb.plugins.cmp.jdbc.SQLUtil

public final class SQLUtil
extends Object

SQLUtil helps with building sql statements.

Version:
$Revision: 1.29 $
Author:
Dain Sundstrom, Alex Loubyansky, Joachim Van der Auwera

Nested Class Summary
static class SQLUtil.OldColumns
          utility class to store the information returned by getOldColumns()
static class SQLUtil.OldIndexes
          utility class to store the information returned by getOldColumns()
 
Field Summary
static String ABS
           
static String AND
           
static String ASC
           
static String AVG
           
static String BETWEEN
           
static String COMMA
           
static String CONCAT
           
static String COUNT
           
static String CREATE_INDEX
           
static String CREATE_TABLE
           
static String DELETE_FROM
           
static String DESC
           
static String DISTINCT
           
static String DROP_TABLE
           
static String EMPTY
           
static String EMPTY_STRING
           
static String ESCAPE
           
static String EXISTS
           
static String FROM
           
static String IN
           
static String INSERT_INTO
           
static String IS
           
static String LCASE
           
static String LEFT_JOIN
           
static String LEFT_OUTER_JOIN
           
static String LENGTH
           
static String LIKE
           
static String LIMIT
           
static String LOCATE
           
static String MAX
           
static String MEMBER_OF
           
static String MIN
           
static String MOD
           
static String NOT
           
static String NOT_EQUAL
           
static String NULL
           
static String OFFSET
           
static String ON
           
static String OR
           
static String ORDERBY
           
static String SELECT
           
static String SET
           
static String SQRT
           
static String SUBSTRING
           
static String SUM
           
static String TYPE
           
static String UCASE
           
static String UPDATE
           
static String VALUES
           
static String WHERE
           
 
Constructor Summary
SQLUtil()
           
 
Method Summary
static void addToRwords(String word)
           
static StringBuffer appendColumnNamesClause(JDBCAbstractEntityBridge entity, String eagerLoadGroup, StringBuffer sb)
          Returns ', columnName0 [, columnName1 [AND columnName2 [...]]]'
static StringBuffer appendColumnNamesClause(JDBCAbstractEntityBridge entity, String eagerLoadGroup, String alias, StringBuffer sb)
          Returns ', columnName0 [, columnName1 [AND columnName2 [...]]]'
static StringBuffer appendColumnNamesClause(JDBCFieldBridge[] fields, boolean[] mask, String identifier, StringBuffer buf)
          Returns ', columnName0 [, columnName1 [AND columnName2 [...]]]'
static StringBuffer appendColumnNamesClause(JDBCFieldBridge[] fields, String identifier, StringBuffer buf)
          Returns ', columnName0 [, columnName1 [AND columnName2 [...]]]'
static void dropTable(DataSource dataSource, String tableName)
           
static String fixConstraintName(String name, DataSource dataSource)
           
static String fixTableName(String tableName, DataSource dataSource)
           
static StringBuffer getColumnNamesClause(JDBCEntityBridge.FieldIterator loadIter, StringBuffer sb)
          Returns columnName0 [, columnName1 [AND columnName2 [...]]]
static StringBuffer getColumnNamesClause(JDBCFieldBridge[] fields, StringBuffer sb)
          Returns columnName0 [, columnName1 [AND columnName2 [...]]]
static StringBuffer getColumnNamesClause(JDBCFieldBridge[] fields, String identifier, StringBuffer buf)
          Returns columnName0 [, columnName1 [AND columnName2 [...]]]
static StringBuffer getColumnNamesClause(JDBCFieldBridge field, StringBuffer sb)
          Returns columnName0 [, columnName1 [, columnName2 [...]]]
static StringBuffer getColumnNamesClause(JDBCFieldBridge field, String identifier, StringBuffer sb)
          Returns identifier.columnName0 [, identifier.columnName1 [, identifier.columnName2 [...]]]
static String getCreateTableColumnsClause(JDBCFieldBridge[] fields)
           
static String getCreateTableColumnsClause(JDBCType type)
          Returns columnName0 sqlType0 [, columnName1 sqlType0 [, columnName2 sqlType0 [...]]]
static StringBuffer getIsNullClause(boolean not, JDBCFieldBridge[] fields, String identifier, StringBuffer buf)
          Returns identifier.columnName0 IS [NOT] NULL [AND identifier.columnName1 IS [NOT] NULL [AND identifier.columnName2 IS [NOT] NULL [...]]]
static StringBuffer getIsNullClause(boolean not, JDBCFieldBridge field, String identifier, StringBuffer buf)
          Returns identifier.columnName0 IS [NOT] NULL [AND identifier.columnName1 IS [NOT] NULL [AND identifier.columnName2 IS [NOT] NULL [...]]]
static StringBuffer getJoinClause(JDBCAbstractCMRFieldBridge cmrField, String parentAlias, String childAlias, StringBuffer buf)
           
static StringBuffer getJoinClause(JDBCFieldBridge[] pkFields, String parent, JDBCFieldBridge[] fkFields, String child, StringBuffer buf)
           
static SQLUtil.OldColumns getOldColumns(String tableName, DataSource dataSource)
           
static SQLUtil.OldIndexes getOldIndexes(String tableName, DataSource dataSource)
           
static StringBuffer getRelationTableJoinClause(JDBCAbstractCMRFieldBridge cmrField, String parentAlias, String relationTableAlias, StringBuffer buf)
           
static String getSchema(String tableName)
           
static StringBuffer getSelfCompareWhereClause(JDBCFieldBridge[] fields, String fromIdentifier, String toIdentifier, StringBuffer buf)
           
static StringBuffer getSelfCompareWhereClause(JDBCFieldBridge fromField, JDBCFieldBridge toField, String fromIdentifier, String toIdentifier, StringBuffer buf)
           
static StringBuffer getSetClause(JDBCEntityBridge.FieldIterator fieldsIter, StringBuffer buf)
          Returns columnName0=? [, columnName1=? [, columnName2=? [...]]]
static String getTableNameWithoutSchema(String tableName)
           
static StringBuffer getValuesClause(JDBCFieldBridge[] fields, StringBuffer buf)
          Returns ? [, ? [, ? [...]]]
static StringBuffer getWhereClause(JDBCFieldBridge[] fields, long mask, StringBuffer buf)
          Returns columnName0=? [AND columnName1=? [AND columnName2=? [...]]]
static StringBuffer getWhereClause(JDBCFieldBridge[] fields, StringBuffer buf)
          Returns columnName0=? [AND columnName1=? [AND columnName2=? [...]]]
static StringBuffer getWhereClause(JDBCFieldBridge[] fields, String identifier, StringBuffer buf)
          Returns identifier.columnName0=? [AND identifier.columnName1=? [AND identifier.columnName2=? [...]]]
static StringBuffer getWhereClause(JDBCFieldBridge field, StringBuffer buf)
          Returns columnName0=? [AND columnName1=? [AND columnName2=? [...]]]
static StringBuffer getWhereClause(JDBCType type, String identifier, StringBuffer buf)
          Returns identifier.columnName0=? [AND identifier.columnName1=? [AND identifier.columnName2=? [...]]]
static boolean tableExists(String tableName, DataSource dataSource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_STRING

public static final String EMPTY_STRING
See Also:
Constant Field Values

INSERT_INTO

public static final String INSERT_INTO
See Also:
Constant Field Values

VALUES

public static final String VALUES
See Also:
Constant Field Values

SELECT

public static final String SELECT
See Also:
Constant Field Values

DISTINCT

public static final String DISTINCT
See Also:
Constant Field Values

FROM

public static final String FROM
See Also:
Constant Field Values

WHERE

public static final String WHERE
See Also:
Constant Field Values

ORDERBY

public static final String ORDERBY
See Also:
Constant Field Values

DELETE_FROM

public static final String DELETE_FROM
See Also:
Constant Field Values

AND

public static final String AND
See Also:
Constant Field Values

OR

public static final String OR
See Also:
Constant Field Values

NOT

public static final String NOT
See Also:
Constant Field Values

EXISTS

public static final String EXISTS
See Also:
Constant Field Values

COMMA

public static final String COMMA
See Also:
Constant Field Values

LEFT_JOIN

public static final String LEFT_JOIN
See Also:
Constant Field Values

LEFT_OUTER_JOIN

public static final String LEFT_OUTER_JOIN
See Also:
Constant Field Values

ON

public static final String ON
See Also:
Constant Field Values

NOT_EQUAL

public static final String NOT_EQUAL
See Also:
Constant Field Values

CREATE_TABLE

public static final String CREATE_TABLE
See Also:
Constant Field Values

DROP_TABLE

public static final String DROP_TABLE
See Also:
Constant Field Values

CREATE_INDEX

public static final String CREATE_INDEX
See Also:
Constant Field Values

NULL

public static final String NULL
See Also:
Constant Field Values

IS

public static final String IS
See Also:
Constant Field Values

IN

public static final String IN
See Also:
Constant Field Values

EMPTY

public static final String EMPTY
See Also:
Constant Field Values

BETWEEN

public static final String BETWEEN
See Also:
Constant Field Values

LIKE

public static final String LIKE
See Also:
Constant Field Values

MEMBER_OF

public static final String MEMBER_OF
See Also:
Constant Field Values

ESCAPE

public static final String ESCAPE
See Also:
Constant Field Values

CONCAT

public static final String CONCAT
See Also:
Constant Field Values

SUBSTRING

public static final String SUBSTRING
See Also:
Constant Field Values

LCASE

public static final String LCASE
See Also:
Constant Field Values

UCASE

public static final String UCASE
See Also:
Constant Field Values

LENGTH

public static final String LENGTH
See Also:
Constant Field Values

LOCATE

public static final String LOCATE
See Also:
Constant Field Values

ABS

public static final String ABS
See Also:
Constant Field Values

MOD

public static final String MOD
See Also:
Constant Field Values

SQRT

public static final String SQRT
See Also:
Constant Field Values

COUNT

public static final String COUNT
See Also:
Constant Field Values

MAX

public static final String MAX
See Also:
Constant Field Values

MIN

public static final String MIN
See Also:
Constant Field Values

AVG

public static final String AVG
See Also:
Constant Field Values

SUM

public static final String SUM
See Also:
Constant Field Values

ASC

public static final String ASC
See Also:
Constant Field Values

DESC

public static final String DESC
See Also:
Constant Field Values

OFFSET

public static final String OFFSET
See Also:
Constant Field Values

LIMIT

public static final String LIMIT
See Also:
Constant Field Values

UPDATE

public static final String UPDATE
See Also:
Constant Field Values

SET

public static final String SET
See Also:
Constant Field Values

TYPE

public static final String TYPE
See Also:
Constant Field Values
Constructor Detail

SQLUtil

public SQLUtil()
Method Detail

getTableNameWithoutSchema

public static String getTableNameWithoutSchema(String tableName)

getSchema

public static String getSchema(String tableName)

fixTableName

public static String fixTableName(String tableName,
                                  DataSource dataSource)
                           throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

addToRwords

public static void addToRwords(String word)

fixConstraintName

public static String fixConstraintName(String name,
                                       DataSource dataSource)
                                throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

getCreateTableColumnsClause

public static String getCreateTableColumnsClause(JDBCFieldBridge[] fields)

getCreateTableColumnsClause

public static String getCreateTableColumnsClause(JDBCType type)
Returns columnName0 sqlType0 [, columnName1 sqlType0 [, columnName2 sqlType0 [...]]]


getColumnNamesClause

public static StringBuffer getColumnNamesClause(JDBCFieldBridge[] fields,
                                                StringBuffer sb)
Returns columnName0 [, columnName1 [AND columnName2 [...]]]


getColumnNamesClause

public static StringBuffer getColumnNamesClause(JDBCFieldBridge[] fields,
                                                String identifier,
                                                StringBuffer buf)
Returns columnName0 [, columnName1 [AND columnName2 [...]]]


getColumnNamesClause

public static StringBuffer getColumnNamesClause(JDBCEntityBridge.FieldIterator loadIter,
                                                StringBuffer sb)
Returns columnName0 [, columnName1 [AND columnName2 [...]]]


getColumnNamesClause

public static StringBuffer getColumnNamesClause(JDBCFieldBridge field,
                                                StringBuffer sb)
Returns columnName0 [, columnName1 [, columnName2 [...]]]


getColumnNamesClause

public static StringBuffer getColumnNamesClause(JDBCFieldBridge field,
                                                String identifier,
                                                StringBuffer sb)
Returns identifier.columnName0 [, identifier.columnName1 [, identifier.columnName2 [...]]]


appendColumnNamesClause

public static StringBuffer appendColumnNamesClause(JDBCAbstractEntityBridge entity,
                                                   String eagerLoadGroup,
                                                   StringBuffer sb)
Returns ', columnName0 [, columnName1 [AND columnName2 [...]]]'


appendColumnNamesClause

public static StringBuffer appendColumnNamesClause(JDBCAbstractEntityBridge entity,
                                                   String eagerLoadGroup,
                                                   String alias,
                                                   StringBuffer sb)
Returns ', columnName0 [, columnName1 [AND columnName2 [...]]]'


appendColumnNamesClause

public static StringBuffer appendColumnNamesClause(JDBCFieldBridge[] fields,
                                                   boolean[] mask,
                                                   String identifier,
                                                   StringBuffer buf)
Returns ', columnName0 [, columnName1 [AND columnName2 [...]]]'


appendColumnNamesClause

public static StringBuffer appendColumnNamesClause(JDBCFieldBridge[] fields,
                                                   String identifier,
                                                   StringBuffer buf)
Returns ', columnName0 [, columnName1 [AND columnName2 [...]]]'


getSetClause

public static StringBuffer getSetClause(JDBCEntityBridge.FieldIterator fieldsIter,
                                        StringBuffer buf)
Returns columnName0=? [, columnName1=? [, columnName2=? [...]]]


getValuesClause

public static StringBuffer getValuesClause(JDBCFieldBridge[] fields,
                                           StringBuffer buf)
Returns ? [, ? [, ? [...]]]


getWhereClause

public static StringBuffer getWhereClause(JDBCFieldBridge[] fields,
                                          StringBuffer buf)
Returns columnName0=? [AND columnName1=? [AND columnName2=? [...]]]


getWhereClause

public static StringBuffer getWhereClause(JDBCFieldBridge[] fields,
                                          String identifier,
                                          StringBuffer buf)
Returns identifier.columnName0=? [AND identifier.columnName1=? [AND identifier.columnName2=? [...]]]


getWhereClause

public static StringBuffer getWhereClause(JDBCFieldBridge[] fields,
                                          long mask,
                                          StringBuffer buf)
Returns columnName0=? [AND columnName1=? [AND columnName2=? [...]]]


getWhereClause

public static StringBuffer getWhereClause(JDBCFieldBridge field,
                                          StringBuffer buf)
Returns columnName0=? [AND columnName1=? [AND columnName2=? [...]]]


getWhereClause

public static StringBuffer getWhereClause(JDBCType type,
                                          String identifier,
                                          StringBuffer buf)
Returns identifier.columnName0=? [AND identifier.columnName1=? [AND identifier.columnName2=? [...]]]


getIsNullClause

public static StringBuffer getIsNullClause(boolean not,
                                           JDBCFieldBridge[] fields,
                                           String identifier,
                                           StringBuffer buf)
Returns identifier.columnName0 IS [NOT] NULL [AND identifier.columnName1 IS [NOT] NULL [AND identifier.columnName2 IS [NOT] NULL [...]]]


getIsNullClause

public static StringBuffer getIsNullClause(boolean not,
                                           JDBCFieldBridge field,
                                           String identifier,
                                           StringBuffer buf)
Returns identifier.columnName0 IS [NOT] NULL [AND identifier.columnName1 IS [NOT] NULL [AND identifier.columnName2 IS [NOT] NULL [...]]]


getJoinClause

public static StringBuffer getJoinClause(JDBCAbstractCMRFieldBridge cmrField,
                                         String parentAlias,
                                         String childAlias,
                                         StringBuffer buf)

getRelationTableJoinClause

public static StringBuffer getRelationTableJoinClause(JDBCAbstractCMRFieldBridge cmrField,
                                                      String parentAlias,
                                                      String relationTableAlias,
                                                      StringBuffer buf)

getJoinClause

public static StringBuffer getJoinClause(JDBCFieldBridge[] pkFields,
                                         String parent,
                                         JDBCFieldBridge[] fkFields,
                                         String child,
                                         StringBuffer buf)

getSelfCompareWhereClause

public static StringBuffer getSelfCompareWhereClause(JDBCFieldBridge[] fields,
                                                     String fromIdentifier,
                                                     String toIdentifier,
                                                     StringBuffer buf)

getSelfCompareWhereClause

public static StringBuffer getSelfCompareWhereClause(JDBCFieldBridge fromField,
                                                     JDBCFieldBridge toField,
                                                     String fromIdentifier,
                                                     String toIdentifier,
                                                     StringBuffer buf)

tableExists

public static boolean tableExists(String tableName,
                                  DataSource dataSource)
                           throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

getOldColumns

public static SQLUtil.OldColumns getOldColumns(String tableName,
                                               DataSource dataSource)
                                        throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

getOldIndexes

public static SQLUtil.OldIndexes getOldIndexes(String tableName,
                                               DataSource dataSource)
                                        throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

dropTable

public static void dropTable(DataSource dataSource,
                             String tableName)
                      throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.