All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ma.vi.esql.parser.define.AlterColumn Maven / Gradle / Ivy

Go to download

ESQL, SQL enhanced with metadata compiling to various relational databases

There is a newer version: 0.5.1
Show newest version
/*
 * Copyright (c) 2020 Vikash Madhow
 */

package ma.vi.esql.parser.define;

import ma.vi.base.tuple.T2;
import ma.vi.esql.parser.Context;
import ma.vi.esql.parser.Esql;

import java.util.Map;

public class AlterColumn extends AlterTableAction {
  public AlterColumn(Context context, String columnName, AlterColumnDefinition definition) {
    super(context,
        T2.of("columnName", new Esql<>(context, columnName)),
        T2.of("definition", definition));
  }

  public AlterColumn(AlterColumn other) {
    super(other);
  }

  @Override
  public AlterColumn copy() {
    if (!copying()) {
      try {
        copying(true);
        return new AlterColumn(this);
      } finally {
        copying(false);
      }
    } else {
      return this;
    }
  }

  @Override
  public String translate(Target target, Map parameters) {
    return "alter column " + columnName() + ' ' + definition().translate(target, parameters);
  }

  public String columnName() {
    return childValue("columnName");
  }

  public AlterColumnDefinition definition() {
    return child("definition");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy