Package org.apache.torque.sql

# Klasse 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 1917245 2024-04-21 14:06:23Z tv $
Autor:
  Henning P. Schmiedehausen, Thomas Fischer

- ## Feldübersicht

  Felder
  Modifizierer und Typ
  Feld
  Beschreibung
  `static final String[]`
  `FUNCTION_DELIMITERS`
  Delimiters for SQL functions.
  `protected static final org.apache.logging.log4j.Logger`
  `log`
  Logging

- ## Methodenübersicht

  Modifizierer und Typ
  Methode
  Beschreibung
  `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.

  ### Von Klasse geerbte Methoden java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Felddetails

  - ### log

    protected static final org.apache.logging.log4j.Logger log
    Logging

  - ### FUNCTION_DELIMITERS

    public static final String[] FUNCTION_DELIMITERS
    Delimiters for SQL functions.

- ## Methodendetails

  - ### 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.
    Gibt zurück:
      the current WhereClausePsPartBuilders, not null.

  - ### buildQuery

    public static Query buildQuery(Criteria crit) throws TorqueException
    Builds a Query from a criteria.
    Parameter:
      `crit` - the criteria to build the query from, not null.
    Gibt zurück:
      the corresponding query to the criteria.
    Löst aus:
      `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.
    Parameter:
      `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.
    Gibt zurück:
      The table name to use inside the SQL statement. If null is passed into this method, null is returned.
    Löst aus:
      `TorqueException` - if Torque is not yet initialized.

  - ### getUnqualifiedName

    public static String getUnqualifiedName(String name, String dbName) throws TorqueException
    Unqualify a table or column name.
    Parameter:
      `name` - the name to unqualify. If null is passed in, null is returned.
      `dbName` - name of the database
    Gibt zurück:
      The unqualified name.
    Löst aus:
      `TorqueException` - if the name cannot be determined.

  - ### guessFullTableFromCriteria

    public static String guessFullTableFromCriteria(Criteria criteria) throws TorqueException
    Guesses a table name from a criteria by inspecting the first column in the criteria.
    Parameter:
      `criteria` - the criteria to guess the table name from.
    Gibt zurück:
      the table name, not null.
    Löst aus:
      `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.
    Parameter:
      `tableName` - the name of the table.
      `dbName` - the name of the database, null for the default db.
    Gibt zurück:
      the table map for the table, not null.
    Löst aus:
      `TorqueException` - if the database or table is unknown.