Class SQLCreateTableStatement
- java.lang.Object
-
- com.alibaba.druid.sql.ast.SQLObjectImpl
-
- com.alibaba.druid.sql.ast.SQLStatementImpl
-
- com.alibaba.druid.sql.ast.statement.SQLCreateTableStatement
-
- All Implemented Interfaces:
SQLDbTypedObject,SQLObject,SQLStatement,SQLCreateStatement,SQLDDLStatement
- Direct Known Subclasses:
BigQueryCreateTableStatement,BlinkCreateTableStatement,CKCreateTableStatement,DB2CreateTableStatement,GaussDbCreateTableStatement,HiveCreateTableStatement,MySqlCreateTableStatement,OracleCreateTableStatement,PrestoCreateTableStatement,RedshiftCreateTableStatement,SparkCreateTableStatement,StarRocksCreateTableStatement,SynapseCreateTableStatement,TDCreateTableStatement
public class SQLCreateTableStatement extends SQLStatementImpl implements SQLDDLStatement, SQLCreateStatement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSQLCreateTableStatement.Feature-
Nested classes/interfaces inherited from interface com.alibaba.druid.sql.ast.statement.SQLDDLStatement
SQLDDLStatement.DDLObjectType
-
-
Field Summary
-
Fields inherited from class com.alibaba.druid.sql.ast.SQLStatementImpl
afterSemi, dbType, headHints
-
Fields inherited from class com.alibaba.druid.sql.ast.SQLObjectImpl
attributes, hint, parent, sourceColumn, sourceLine
-
-
Constructor Summary
Constructors Constructor Description SQLCreateTableStatement()SQLCreateTableStatement(DbType dbType)
-
Method Summary
-
Methods inherited from class com.alibaba.druid.sql.ast.SQLStatementImpl
cloneTo, getDbType, getHeadHintsDirect, isAfterSemi, setAfterSemi, setDbType, setHeadHints, toLowerCaseString, toParameterizedString, toString, toUnformattedString
-
Methods inherited from class com.alibaba.druid.sql.ast.SQLObjectImpl
accept, acceptChild, acceptChild, addAfterComment, addAfterComment, addBeforeComment, addBeforeComment, cloneTo, computeDataType, containsAttribute, getAfterCommentsDirect, getAttribute, getAttributes, getAttributesDirect, getBeforeCommentsDirect, getHint, getParent, getParent, getSourceColumn, getSourceLine, hasAfterComment, hasBeforeComment, output, putAttribute, setHint, setParent, setSource, setSourceLine
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.alibaba.druid.sql.ast.SQLObject
accept, addAfterComment, addAfterComment, addBeforeComment, addBeforeComment, containsAttribute, getAfterCommentsDirect, getAttribute, getAttributes, getAttributesDirect, getBeforeCommentsDirect, getParent, getParent, getSourceColumn, getSourceLine, hasAfterComment, hasBeforeComment, output, putAttribute, setParent, setSource
-
Methods inherited from interface com.alibaba.druid.sql.ast.SQLStatement
getDbType, getHeadHintsDirect, isAfterSemi, setAfterSemi, setHeadHints, toLowerCaseString, toParameterizedString, toString
-
-
-
-
Field Detail
-
features
protected int features
-
tableSource
protected SQLExprTableSource tableSource
-
tableElementList
protected List<SQLTableElement> tableElementList
-
inherits
protected SQLExprTableSource inherits
-
select
protected SQLSelect select
-
comment
protected SQLExpr comment
-
like
protected SQLExprTableSource like
-
compress
protected Boolean compress
-
logging
protected Boolean logging
-
tablespace
protected SQLName tablespace
-
partitionBy
protected SQLPartitionBy partitionBy
-
partitionOf
protected SQLPartitionOf partitionOf
-
localPartitioning
protected SQLPartitionBy localPartitioning
-
unique
protected SQLUnique unique
-
storedAs
protected SQLExpr storedAs
-
storedBy
protected SQLExpr storedBy
-
location
protected SQLExpr location
-
engine
protected SQLExpr engine
-
orderBy
protected SQLOrderBy orderBy
-
onCommitPreserveRows
protected boolean onCommitPreserveRows
-
onCommitDeleteRows
protected boolean onCommitDeleteRows
-
rowFormat
protected SQLExternalRecordFormat rowFormat
-
partitionColumns
protected final List<SQLColumnDefinition> partitionColumns
-
clusteringType
protected ClusteringType clusteringType
-
clusteredBy
protected final List<SQLSelectOrderByItem> clusteredBy
-
sortedBy
protected final List<SQLSelectOrderByItem> sortedBy
-
isAutoBucket
protected boolean isAutoBucket
-
buckets
protected int buckets
-
shards
protected int shards
-
tableOptions
protected final List<SQLAssignItem> tableOptions
-
replace
protected boolean replace
-
ignore
protected boolean ignore
-
single
protected boolean single
-
lifeCycle
protected SQLExpr lifeCycle
-
-
Constructor Detail
-
SQLCreateTableStatement
public SQLCreateTableStatement()
-
SQLCreateTableStatement
public SQLCreateTableStatement(DbType dbType)
-
-
Method Detail
-
accept0
protected void accept0(SQLASTVisitor v)
- Overrides:
accept0in classSQLStatementImpl
-
acceptChild
protected void acceptChild(SQLASTVisitor v)
-
isAutoBucket
public boolean isAutoBucket()
-
setAutoBucket
public void setAutoBucket(boolean autoBucket)
-
getEngine
public SQLExpr getEngine()
-
setEngine
public void setEngine(SQLExpr x)
-
getOrderBy
public SQLOrderBy getOrderBy()
-
setOrderBy
public void setOrderBy(SQLOrderBy orderBy)
-
getComment
public SQLExpr getComment()
-
setComment
public void setComment(SQLExpr comment)
-
getName
public SQLName getName()
- Specified by:
getNamein interfaceSQLCreateStatement
-
getTableName
public String getTableName()
-
getSchema
public String getSchema()
-
setSchema
public void setSchema(String name)
-
setName
public void setName(SQLName name)
-
setName
public void setName(String name)
-
getTableSource
public SQLExprTableSource getTableSource()
-
setTableSource
public void setTableSource(SQLExprTableSource tableSource)
-
setTableName
public void setTableName(String tableName)
-
config
public void config(SQLCreateTableStatement.Feature feature)
-
isEnabled
public boolean isEnabled(SQLCreateTableStatement.Feature feature)
-
config
public void config(SQLCreateTableStatement.Feature feature, boolean state)
-
isTemporary
public boolean isTemporary()
-
setTemporary
public void setTemporary(boolean value)
-
getTableElementList
public List<SQLTableElement> getTableElementList()
-
getColumn
public SQLColumnDefinition getColumn(String columnName)
-
getColumnDefinitions
public List<SQLColumnDefinition> getColumnDefinitions()
-
addColumn
public void addColumn(String name, SQLDataType dataType)
-
addColumn
public void addColumn(SQLColumnDefinition column)
-
isIfNotExists
public boolean isIfNotExists()
-
setIfNotExists
public void setIfNotExists(boolean value)
-
getInherits
public SQLExprTableSource getInherits()
-
setInherits
public void setInherits(SQLExprTableSource inherits)
-
getSelect
public SQLSelect getSelect()
-
setSelect
public void setSelect(SQLSelect select)
-
getUnique
public SQLUnique getUnique()
-
setUnique
public void setUnique(SQLUnique unique)
-
getLike
public SQLExprTableSource getLike()
-
setLike
public void setLike(SQLName like)
-
setLike
public void setLike(SQLExprTableSource like)
-
getCompress
public Boolean getCompress()
-
setCompress
public void setCompress(Boolean compress)
-
getLogging
public Boolean getLogging()
-
setLogging
public void setLogging(Boolean logging)
-
getTablespace
public SQLName getTablespace()
-
setTablespace
public void setTablespace(SQLName x)
-
getPartitioning
public SQLPartitionBy getPartitioning()
-
getLocalPartitioning
public SQLPartitionBy getLocalPartitioning()
-
setPartitionBy
public void setPartitionBy(SQLPartitionBy partitionBy)
-
getPartitionOf
public SQLPartitionOf getPartitionOf()
-
setPartitionOf
public void setPartitionOf(SQLPartitionOf partitionOf)
-
setLocalPartitioning
public void setLocalPartitioning(SQLPartitionBy localPartitioning)
-
getChildren
public List<SQLObject> getChildren()
- Specified by:
getChildrenin interfaceSQLStatement- Overrides:
getChildrenin classSQLStatementImpl
-
hasBodyBeforeComment
public boolean hasBodyBeforeComment()
-
computeName
public String computeName()
-
containsColumn
public boolean containsColumn(String columName)
-
findColumn
public SQLColumnDefinition findColumn(String columName)
-
findColumn
public SQLColumnDefinition findColumn(long columName_hash)
-
isPrimaryColumn
public boolean isPrimaryColumn(String columnName)
-
isPrimaryColumn
public boolean isPrimaryColumn(long columnNameHash)
-
isOnlyPrimaryKey
public boolean isOnlyPrimaryKey(long columnNameHash)
-
isMUL
public boolean isMUL(String columnName)
only for show columns
-
isUNI
public boolean isUNI(String columnName)
only for show columns
-
findUnique
public MySqlUnique findUnique(String columnName)
-
findIndex
public SQLTableElement findIndex(String columnName)
-
forEachColumn
public void forEachColumn(Consumer<SQLColumnDefinition> columnConsumer)
-
findPrimaryKey
public SQLPrimaryKey findPrimaryKey()
-
findForeignKey
public List<SQLForeignKeyConstraint> findForeignKey()
-
hashForeignKey
public boolean hashForeignKey()
-
isReferenced
public boolean isReferenced(SQLName tableName)
-
isReferenced
public boolean isReferenced(String tableName)
-
foreignKeyToAlterTable
public SQLAlterTableStatement foreignKeyToAlterTable()
-
sort
public static void sort(List<SQLStatement> stmtList)
-
simplify
public void simplify()
-
apply
public boolean apply(SQLDropIndexStatement x)
-
apply
public boolean apply(SQLCommentStatement x)
-
apply
public boolean apply(SQLAlterTableStatement alter)
-
alterApply
protected boolean alterApply(SQLAlterTableItem item)
-
apply
protected boolean apply(SQLAlterTableTruncatePartition item)
-
apply
protected boolean apply(SQLAlterTableAddIndex item)
-
columnIndexOf
protected int columnIndexOf(SQLName column)
-
cloneTo
public void cloneTo(SQLCreateTableStatement x)
-
isReplace
public boolean isReplace()
-
setReplace
public void setReplace(boolean replace)
-
isIgnore
public boolean isIgnore()
-
setIgnore
public void setIgnore(boolean ignore)
-
isSingle
public boolean isSingle()
-
setSingle
public void setSingle(boolean single)
-
getStoredAs
public SQLExpr getStoredAs()
-
setStoredAs
public void setStoredAs(SQLExpr x)
-
getStoredBy
public SQLExpr getStoredBy()
-
setStoredBy
public void setStoredBy(SQLExpr x)
-
clone
public SQLCreateTableStatement clone()
- Specified by:
clonein interfaceSQLObject- Specified by:
clonein interfaceSQLStatement- Overrides:
clonein classSQLStatementImpl
-
toString
public String toString()
- Specified by:
toStringin interfaceSQLStatement- Overrides:
toStringin classSQLStatementImpl
-
isOnCommitPreserveRows
public boolean isOnCommitPreserveRows()
-
setOnCommitPreserveRows
public void setOnCommitPreserveRows(boolean onCommitPreserveRows)
-
isExternal
public boolean isExternal()
-
setExternal
public void setExternal(boolean external)
-
getClusteringType
public ClusteringType getClusteringType()
-
setClusteringType
public void setClusteringType(ClusteringType clusteringType)
-
getClusteredBy
public List<SQLSelectOrderByItem> getClusteredBy()
-
addClusteredByItem
public void addClusteredByItem(SQLSelectOrderByItem item)
-
getSortedBy
public List<SQLSelectOrderByItem> getSortedBy()
-
addSortedByItem
public void addSortedByItem(SQLSelectOrderByItem item)
-
getBuckets
public int getBuckets()
-
setBuckets
public void setBuckets(int buckets)
-
getShards
public int getShards()
-
setShards
public void setShards(int shards)
-
getPartitionColumns
public List<SQLColumnDefinition> getPartitionColumns()
-
addPartitionColumn
public void addPartitionColumn(SQLColumnDefinition column)
-
getTableOptions
public List<SQLAssignItem> getTableOptions()
-
getTblProperties
@Deprecated public List<SQLAssignItem> getTblProperties()
Deprecated.
-
addTblProperty
@Deprecated public void addTblProperty(String name, SQLExpr value)
Deprecated.
-
getRowFormat
public SQLExternalRecordFormat getRowFormat()
-
setRowFormat
public void setRowFormat(SQLExternalRecordFormat x)
-
isDimension
public boolean isDimension()
-
setDimension
public void setDimension(boolean dimension)
-
getLocation
public SQLExpr getLocation()
-
setLocation
public void setLocation(SQLExpr x)
-
removeOption
public boolean removeOption(String name)
-
getCatalog
public String getCatalog()
-
containsDuplicateColumnNames
public boolean containsDuplicateColumnNames()
-
containsDuplicateColumnNames
public boolean containsDuplicateColumnNames(boolean throwException)
-
getDDLObjectType
public SQLDDLStatement.DDLObjectType getDDLObjectType()
- Specified by:
getDDLObjectTypein interfaceSQLDDLStatement
-
getLifeCycle
public SQLExpr getLifeCycle()
-
setLifeCycle
public void setLifeCycle(SQLExpr x)
-
-