Package com.exasol.sql.ddl.create
Class CreateTable
- java.lang.Object
-
- com.exasol.sql.AbstractFragment
-
- com.exasol.sql.ddl.create.CreateTable
-
- All Implemented Interfaces:
CreateTableFragment
,Fragment
,SqlStatement
public class CreateTable extends AbstractFragment implements SqlStatement, CreateTableFragment
This class implements an SQLCreateTable
statement
-
-
Field Summary
-
Fields inherited from class com.exasol.sql.AbstractFragment
root
-
-
Constructor Summary
Constructors Constructor Description CreateTable(String tableName)
Create a new instance of anCreateTable
statement
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(CreateTableVisitor visitor)
Accept a visitor (e.g.CreateTable
booleanColumn(String columnName)
Add boolean columnCreateTable
charColumn(String columnName, int length)
Add char column.CreateTable
dateColumn(String columnName)
Add date columnCreateTable
decimalColumn(String columnName, int precision, int scale)
Add decimal column.CreateTable
doublePrecisionColumn(String columnName)
Add double precision columnColumnsDefinition
getColumnsDefinition()
Get columns definition of the table.String
getTableName()
Get the table nameCreateTable
intervalDayToSecondColumn(String columnName, int yearPrecision, int millisecondPrecision)
Add interval day to second column.CreateTable
intervalYearToMonthColumn(String columnName, int yearPrecision)
Add interval year to month column.CreateTable
timestampColumn(String columnName)
Add timestamp columnCreateTable
timestampWithLocalTimeZoneColumn(String columnName)
Add timestamp with local time zone columnCreateTable
varcharColumn(String columnName, int length)
Add varchar column.-
Methods inherited from class com.exasol.sql.AbstractFragment
getRoot
-
-
-
-
Constructor Detail
-
CreateTable
public CreateTable(String tableName)
Create a new instance of anCreateTable
statement- Parameters:
tableName
- name of the table to create
-
-
Method Detail
-
booleanColumn
public CreateTable booleanColumn(String columnName)
Add boolean column- Parameters:
columnName
- name of the column to be added- Returns:
this
for fluent programming
-
charColumn
public CreateTable charColumn(String columnName, int length)
Add char column.- Parameters:
columnName
- name of the column to be addedlength
- pre-defined length for stored strings- Returns:
this
for fluent programming
-
varcharColumn
public CreateTable varcharColumn(String columnName, int length)
Add varchar column.- Parameters:
columnName
- name of the column to be addedlength
- pre-defined length for stored strings- Returns:
this
for fluent programming
-
dateColumn
public CreateTable dateColumn(String columnName)
Add date column- Parameters:
columnName
- name of the column to be added- Returns:
this
for fluent programming
-
decimalColumn
public CreateTable decimalColumn(String columnName, int precision, int scale)
Add decimal column.- Parameters:
columnName
- name of the column to be addedprecision
- precision for numeric valuescale
- scale for numeric value- Returns:
this
for fluent programming
-
doublePrecisionColumn
public CreateTable doublePrecisionColumn(String columnName)
Add double precision column- Parameters:
columnName
- name of the column to be added- Returns:
this
for fluent programming
-
timestampColumn
public CreateTable timestampColumn(String columnName)
Add timestamp column- Parameters:
columnName
- name of the column to be added- Returns:
this
for fluent programming
-
timestampWithLocalTimeZoneColumn
public CreateTable timestampWithLocalTimeZoneColumn(String columnName)
Add timestamp with local time zone column- Parameters:
columnName
- name of the column to be added- Returns:
this
for fluent programming
-
intervalDayToSecondColumn
public CreateTable intervalDayToSecondColumn(String columnName, int yearPrecision, int millisecondPrecision)
Add interval day to second column.- Parameters:
columnName
- name of the column to be addedyearPrecision
- year precision valuemillisecondPrecision
- millisecond precision value- Returns:
this
for fluent programming
-
intervalYearToMonthColumn
public CreateTable intervalYearToMonthColumn(String columnName, int yearPrecision)
Add interval year to month column.- Parameters:
columnName
- name of the column to be addedyearPrecision
- year precision value- Returns:
this
for fluent programming
-
getTableName
public String getTableName()
Get the table name- Returns:
- table name
-
getColumnsDefinition
public ColumnsDefinition getColumnsDefinition()
Get columns definition of the table.- Returns:
- columns
-
accept
public void accept(CreateTableVisitor visitor)
Description copied from interface:CreateTableFragment
Accept a visitor (e.g. a renderer or validator)- Specified by:
accept
in interfaceCreateTableFragment
- Parameters:
visitor
- visitor to accept
-
-