Package org.antlr.stringtemplate

Examples of org.antlr.stringtemplate.StringTemplate


    } else
    {
      templateStr = ST_UPDATE_STYLE_ONE;
    }

    StringTemplate st = new StringTemplate(templateStr);

    return DialectUtils.getUpdateSQL(st,
      tableName,
      setColumns,
      setValues,
View Full Code Here


  @Override
  public String[] getColumnNullableAlterSQL(TableColumnInfo info, DatabaseObjectQualifier qualifier,
    SqlGenerationPreferences prefs)
  {
    // "ALTER TABLE $tableName$ ALTER COLUMN $columnName$ SET $nullable$";
    StringTemplate st = new StringTemplate(ST_ALTER_COLUMN_NULL_STYLE_ONE);
    HashMap<String, String> valuesMap =
      DialectUtils.getValuesMap(ST_TABLE_NAME_KEY,
        info.getTableName(),
        ST_COLUMN_NAME_KEY,
        info.getColumnName());
View Full Code Here

  {
    // Pre-requisites are that column needs to be primary key and it must be integer type.
    // alter table IDENTITYTEST2 alter column myid identity

    // "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,
View Full Code Here

    // "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");
    }

    return DialectUtils.getAddForeignKeyConstraintSQL(fkST,
View Full Code Here

  {
    // ALTER TABLE <tablename> ADD [CONSTRAINT <constraintname>] UNIQUE (<column list>);

    // "ALTER TABLE $tableName$ " +
    // "ADD CONSTRAINT $constraintName$ UNIQUE ($columnName; separator=\",\"$)";
    StringTemplate st = new StringTemplate(ST_ADD_UNIQUE_CONSTRAINT_STYLE_TWO);

    HashMap<String, String> valuesMap =
      DialectUtils.getValuesMap(ST_TABLE_NAME_KEY, tableName, ST_CONSTRAINT_NAME_KEY, constraintName);

    return new String[] { DialectUtils.getAddUniqueConstraintSQL(st,
View Full Code Here

    // ALTER SEQUENCE <sequencename> RESTART WITH <value>;

    // "ALTER SEQUENCE $sequenceName$ " +
    // "$restartWith$ $startValue$ " +
    // "$incrementBy$ $incrementValue$ ";
    StringTemplate st = new StringTemplate(ST_ALTER_SEQUENCE_STYLE_ONE);

    st.setAttribute(ST_SEQUENCE_NAME_KEY, sequenceName);
    st.setAttribute(ST_RESTART_WITH_KEY, "RESTART WITH");
    st.setAttribute(ST_START_VALUE_KEY, restart);

    return new String[] { st.toString() };
  }
View Full Code Here

    // CREATE [UNIQUE] INDEX <index> ON <table> (<column> [DESC] [, ...]) [DESC];

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

    StringTemplate st = new StringTemplate(ST_CREATE_INDEX_STYLE_TWO);

    HashMap<String, String> valuesMap =
      DialectUtils.getValuesMap(ST_INDEX_NAME_KEY, indexName, ST_TABLE_NAME_KEY, tableName);

    if (unique)
View Full Code Here

    // [START WITH <startvalue>] [INCREMENT BY <incrementvalue>];

    // "CREATE SEQUENCE $sequenceName$ $startWith$ " +
    // "$increment$ $minimum$ $maximum$ $cache$ $cycle$";

    StringTemplate st = new StringTemplate(ST_CREATE_SEQUENCE_STYLE_TWO);

    HashMap<String, String> valuesMap = DialectUtils.getValuesMap(ST_SEQUENCE_NAME_KEY, sequenceName);

    OptionalSqlClause startWithClause = new OptionalSqlClause("START WITH", start);
    OptionalSqlClause incrementByClause = new OptionalSqlClause("INCREMENT BY", increment);
View Full Code Here

    // [ORDER BY orderExpression [, ...]]
    // [LIMIT <limit> [OFFSET <offset>]];

    // "CREATE VIEW $viewName$ " +
    // "AS $selectStatement$ $with$ $checkOptionType$ $checkOption$";
    StringTemplate st = new StringTemplate(ST_CREATE_VIEW_STYLE_ONE);

    HashMap<String, String> valuesMap = new HashMap<String, String>();
    valuesMap.put("viewName", viewName);
    valuesMap.put("selectStatement", definition);
View Full Code Here

  @Override
  public String getDropConstraintSQL(String tableName, String constraintName,
    DatabaseObjectQualifier qualifier, SqlGenerationPreferences prefs)
  {
    // ALTER TABLE $tableName$ DROP CONSTRAINT $constraintName$
    StringTemplate st = new StringTemplate(ST_DROP_CONSTRAINT_STYLE_ONE);

    HashMap<String, String> valuesMap =
      DialectUtils.getValuesMap(ST_TABLE_NAME_KEY, tableName, ST_CONSTRAINT_NAME_KEY, constraintName);

    return DialectUtils.bindTemplateAttributes(this, st, valuesMap, qualifier, prefs);
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.