Examples of StringTemplate


Examples of org.antlr.stringtemplate.StringTemplate

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

    final String templateStr = ST_CREATE_SEQUENCE_STYLE_TWO;

    final StringTemplate startClauseTemplate = new StringTemplate("START WITH $startWith$ ,");
    final OptionalSqlClause startClause =
      new OptionalSqlClause(startClauseTemplate, ST_START_WITH_KEY, start);

    final StringTemplate incrementByClauseTemplate = new StringTemplate("INCREMENT BY $incrementBy$ ,");
    final OptionalSqlClause incrementClause =
      new OptionalSqlClause(incrementByClauseTemplate, ST_INCREMENT_BY_KEY, increment);

    final StringTemplate maxClauseTemplate = new StringTemplate("MAXVALUE $maximum$ ,");
    final OptionalSqlClause maxClause = new OptionalSqlClause(maxClauseTemplate, ST_MAXIMUM_KEY, maximum);

    final StringTemplate minClauseTemplate = new StringTemplate("MINVALUE $minimum$ ,");
    final OptionalSqlClause minClause = new OptionalSqlClause(minClauseTemplate, ST_MINIMUM_KEY, minimum);

    final StringTemplate st = new StringTemplate(templateStr);

    st.setAttribute(ST_SEQUENCE_NAME_KEY, "PUB." + sequenceName);
    st.setAttribute(ST_START_WITH_KEY, startClause.toString());
    st.setAttribute(ST_INCREMENT_KEY, incrementClause.toString());
    st.setAttribute(ST_MAXIMUM_KEY, maxClause.toString());
    st.setAttribute(ST_MINIMUM_KEY, minClause.toString());

    if (cycle)
    {
      st.setAttribute(ST_CYCLE_KEY, "CYCLE");
    }
    else
    {
      st.setAttribute(ST_CYCLE_KEY, "NOCYCLE");
    }

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

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

Examples of org.antlr.stringtemplate.StringTemplate

   */
  @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

Examples of org.antlr.stringtemplate.StringTemplate

  @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

Examples of org.antlr.stringtemplate.StringTemplate

    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

Examples of org.antlr.stringtemplate.StringTemplate

   */
  @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

Examples of org.antlr.stringtemplate.StringTemplate

   */
  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

Examples of org.antlr.stringtemplate.StringTemplate

    // [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

Examples of org.antlr.stringtemplate.StringTemplate

    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

Examples of org.antlr.stringtemplate.StringTemplate

    // "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
TOP
Copyright © 2018 www.massapi.com. 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.