Package org.antlr.stringtemplate

Examples of org.antlr.stringtemplate.StringTemplate


    // CREATE VIEW name [(view_col [, view_col …])]
    // AS <select> [WITH CHECK OPTION];

    // "CREATE VIEW $viewName$ " +
    // "AS $selectStatement$ $withCheckOption$";
    final StringTemplate st = new StringTemplate(ST_CREATE_VIEW_STYLE_TWO);

    final HashMap<String, String> valuesMap =
      DialectUtils.getValuesMap(ST_VIEW_NAME_KEY, viewName, ST_SELECT_STATEMENT_KEY, definition);

    if (checkOption != null)
View Full Code Here


   */
  @Override
  public String getDropIndexSQL(final String tableName, final String indexName, final boolean cascade,
    final DatabaseObjectQualifier qualifier, final SqlGenerationPreferences prefs)
  {
    final StringTemplate st = new StringTemplate(ST_DROP_INDEX_STYLE_ONE);
    final HashMap<String, String> valuesMap = new HashMap<String, String>();
    valuesMap.put(ST_INDEX_NAME_KEY, indexName);
    valuesMap.put(ST_TABLE_NAME_KEY, tableName);
    return DialectUtils.bindAttributes(this, st, valuesMap, qualifier, prefs);
  }
View Full Code Here

  @Override
  public String getRenameTableSQL(final String oldTableName, final String newTableName,
    final DatabaseObjectQualifier qualifier, final SqlGenerationPreferences prefs)
  {
    // "ALTER TABLE $oldObjectName$ RENAME TO $newObjectName$";
    final StringTemplate st = new StringTemplate(ST_RENAME_OBJECT_STYLE_ONE);

    final HashMap<String, String> valuesMap =
      DialectUtils.getValuesMap(ST_OLD_OBJECT_NAME_KEY, oldTableName, ST_NEW_OBJECT_NAME_KEY, newTableName);

    return DialectUtils.bindTemplateAttributes(this, st, valuesMap, qualifier, prefs);
View Full Code Here

    final String templateStr =
      "SELECT 'CREATE VIEW $viewName$ AS ' || VIEWTEXT " + "FROM SYSPROGRESS.SYSVIEWS "
        + "where VIEWNAME = '$viewName$' and OWNER = '$schemaName$' ";

    final StringTemplate st = new StringTemplate(templateStr);
    st.setAttribute(ST_VIEW_NAME_KEY, viewName);
    st.setAttribute(ST_SCHEMA_NAME_KEY, qualifier.getSchema());

    return st.toString();
  }
View Full Code Here

   */
  @Override
  public String getColumnDropSQL(String tableName, String columnName, DatabaseObjectQualifier qualifier,
    SqlGenerationPreferences prefs) throws UnsupportedOperationException
  {
    StringTemplate st = new StringTemplate(DROP_COLUMN_SQL_TEMPLATE);

    HashMap<String, String> valuesMap =
      DialectUtils.getValuesMap(ST_TABLE_NAME_KEY, tableName, ST_COLUMN_NAME_KEY, columnName);

    return DialectUtils.bindTemplateAttributes(this, st, valuesMap, qualifier, prefs);
View Full Code Here

   */
  public String[] getAddAutoIncrementSQL(TableColumnInfo column, DatabaseObjectQualifier qualifier,
    SqlGenerationPreferences prefs)
  {
    // "ALTER TABLE $tableName$ ALTER COLUMN $columnName$ IDENTITY";
    StringTemplate st = new StringTemplate(ST_ADD_AUTO_INCREMENT_STYLE_TWO);

    HashMap<String, String> valuesMap =
      DialectUtils.getValuesMap(ST_TABLE_NAME_KEY, column.getTableName(), ST_COLUMN_NAME_KEY,
        column.getColumnName());

View Full Code Here

    // [ON UPDATE {CASCADE | SET DEFAULT | SET NULL}]

    // "ALTER TABLE $childTableName$ " +
    // "ADD $constraint$ $constraintName$ FOREIGN KEY ( $childColumn; separator=\",\"$ ) " +
    // "REFERENCES $parentTableName$ ( $parentColumn; separator=\",\"$ )";
    StringTemplate fkST = new StringTemplate(ST_ADD_FOREIGN_KEY_CONSTRAINT_STYLE_ONE);
    HashMap<String, String> fkValuesMap = DialectUtils.getValuesMap(ST_CHILD_TABLE_KEY, localTableName);
    fkValuesMap.put(ST_CONSTRAINT_KEY, "CONSTRAINT");
    fkValuesMap.put(ST_CONSTRAINT_NAME_KEY, constraintName);
    fkValuesMap.put(ST_PARENT_TABLE_KEY, refTableName);

    StringTemplate childIndexST = null;
    HashMap<String, String> ckIndexValuesMap = null;

    if (autoFKIndex)
    {
      // "CREATE $unique$ $storageOption$ INDEX $indexName$ " +
      // "ON $tableName$ ( $columnName; separator=\",\"$ )";

      childIndexST = new StringTemplate(ST_CREATE_INDEX_STYLE_TWO);
      ckIndexValuesMap = new HashMap<String, String>();
      ckIndexValuesMap.put(ST_INDEX_NAME_KEY, "fk_child_idx");
      ckIndexValuesMap.put(ST_TABLE_NAME_KEY, localTableName);
    }
View Full Code Here

    TableColumnInfo[] columns, DatabaseObjectQualifier qualifier, SqlGenerationPreferences prefs)
  {
    // "ALTER TABLE $tableName$ " +
    // "ADD $constraint$ $constraintName$ UNIQUE $index$ $indexName$ $indexType$ ( $indexColumnName$ )";

    StringTemplate st = new StringTemplate(ST_ADD_UNIQUE_CONSTRAINT_STYLE_ONE);

    HashMap<String, String> valuesMap =
      DialectUtils.getValuesMap(ST_TABLE_NAME_KEY, tableName, ST_CONSTRAINT_KEY, "CONSTRAINT",
        ST_CONSTRAINT_NAME_KEY, constraintName);
View Full Code Here

    // "ALTER SEQUENCE $sequenceName$ " +
    // "$restartWith$ $startValue$ " +
    // "$incrementBy$ $incrementValue$ ";

    StringTemplate st = new StringTemplate(ST_ALTER_SEQUENCE_STYLE_ONE);

    HashMap<String, String> valuesMap = DialectUtils.getValuesMap(ST_SEQUENCE_NAME_KEY, sequenceName);
    if (DialectUtils.isNotEmptyString(restart))
    {
      valuesMap.put(ST_RESTART_WITH_KEY, "RESTART WITH");
View Full Code Here

    SqlGenerationPreferences prefs)
  {
    // CREATE {[UNIQUE [HASH]] INDEX [[IF NOT EXISTS] newIndexName]
    // | PRIMARY KEY [HASH]} ON (columnName [,...])

    StringTemplate st = new StringTemplate(ST_CREATE_INDEX_STYLE_TWO);
    // "CREATE $unique$ $storageOption$ INDEX $indexName$ " +
    // "ON $tableName$ ( $columnName; separator=\",\"$ )";

    HashMap<String, String> valuesMap = new HashMap<String, String>();
View Full Code Here

TOP

Related Classes of org.antlr.stringtemplate.StringTemplate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.