Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.torque.sql
Class SqlBuilder

    java.lang.Object
      org.apache.torque.sql.SqlBuilder

    public final class SqlBuilder

extends Object

Factored out code that is used to process SQL tables. This code comes from BasePeer and is put here to reduce complexity in the BasePeer class. You should not use the methods here directly!

Version:
  $Id: SqlBuilder.java 1450486 2013-02-26 22:18:00Z tfischer $
Author:
  Henning P. Schmiedehausen, Thomas Fischer

Field Summary
`static String[]` | `FUNCTION_DELIMITERS` Delimiters for SQL functions.
`protected static org.apache.commons.logging.Log` | `log` Logging

Method Summary
`static Query` | `buildQuery(Criteria crit)` Deprecated. please use org.apache.torque.criteria.Criteria instead of org.apache.torque.util.Criteria.
`static Query` | `buildQuery(Criteria crit)` Builds a Query from a criteria.
`static String` | `getFullTableName(String table, String dbName)` Fully qualify a table name with an optional schema reference.
`static TableMap` | `getTableMap(String tableName, String dbName)` Returns the table map for a table.
`static String` | `getUnqualifiedName(String name, String dbName)` Unqualify a table or column name.
`static List<WhereClausePsPartBuilder>` | `getWhereClausePsPartBuilders()` Returns the Builders which are responsible to render single where clause conditions.
`static String` | `guessFullTableFromCriteria(Criteria criteria)` Guesses a table name from a criteria by inspecting the first column in the criteria.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected static final org.apache.commons.logging.Log log

  Logging

### FUNCTION_DELIMITERS

    public static final String[] FUNCTION_DELIMITERS

  Delimiters for SQL functions.

Method Detail

### getWhereClausePsPartBuilders

    public static List<WhereClausePsPartBuilder> getWhereClausePsPartBuilders()

  Returns the Builders which are responsible to render single where clause conditions. The returned list can be modified in order to change the rendered SQL.

  Returns:
    the current WhereClausePsPartBuilders, not null.

### buildQuery

    @Deprecated
    public static Query buildQuery(Criteria crit)
                            throws TorqueException

  Deprecated. please use org.apache.torque.criteria.Criteria instead of org.apache.torque.util.Criteria.

  Builds a Query from a criteria.

  Parameters:
    `crit` - the criteria to build the query from, not null.
  Returns:
    the corresponding query to the criteria.
  Throws:
    `TorqueException` - if an error occurs

### buildQuery

    public static Query buildQuery(Criteria crit)
                            throws TorqueException

  Builds a Query from a criteria.

  Parameters:
    `crit` - the criteria to build the query from, not null.
  Returns:
    the corresponding query to the criteria.
  Throws:
    `TorqueException` - if an error occurs

### getFullTableName

    public static String getFullTableName(String table,
                                          String dbName)
                                   throws TorqueException

  Fully qualify a table name with an optional schema reference.

  Parameters:
    `table` - The table name to use. If null is passed in, null is returned.
    `dbName` - The name of the database to which this tables belongs. If null is passed, the default database is used.
  Returns:
    The table name to use inside the SQL statement. If null is passed into this method, null is returned.
  Throws:
    `TorqueException` - if an error occurs

### getUnqualifiedName

    public static String getUnqualifiedName(String name,
                                            String dbName)
                                     throws TorqueException

  Unqualify a table or column name.

  Parameters:
    `name` - the name to unqualify. If null is passed in, null is returned.
  Returns:
    The unqualified name.
  Throws:
    `TorqueException`

### guessFullTableFromCriteria

    public static String guessFullTableFromCriteria(Criteria criteria)
                                             throws TorqueException

  Guesses a table name from a criteria by inspecting the first column in the criteria.

  Parameters:
    `criteria` - the criteria to guess the table name from.
  Returns:
    the table name, not null.
  Throws:
    `TorqueException` - if the table name cannot be determined.

### getTableMap

    public static TableMap getTableMap(String tableName,
                                       String dbName)
                                throws TorqueException

  Returns the table map for a table.

  Parameters:
    `tableName` - the name of the table.
    `dbName` - the name of the database, null for the default db.
  Returns:
    the table map for the table, not null.
  Throws:
    `TorqueException` - if the database or table is unknown.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2013 The Apache Software Foundation. All Rights Reserved.