use of com.alibaba.druid.sql.ast.statement.SQLTableElement in project canal by alibaba.
the class MemoryTableMeta method parse.
private TableMeta parse(SQLCreateTableStatement statement) {
int size = statement.getTableElementList().size();
if (size > 0) {
TableMeta tableMeta = new TableMeta();
for (int i = 0; i < size; ++i) {
SQLTableElement element = statement.getTableElementList().get(i);
processTableElement(element, tableMeta);
}
return tableMeta;
}
return null;
}
use of com.alibaba.druid.sql.ast.statement.SQLTableElement in project druid by alibaba.
the class BlinkOutputVisitor method printTableElements.
protected void printTableElements(List<SQLTableElement> tableElementList) {
int size = tableElementList.size();
if (size == 0) {
return;
}
BlinkCreateTableStatement stmt = (BlinkCreateTableStatement) tableElementList.get(0).getParent();
print0(" (");
this.indentCount++;
println();
for (int i = 0; i < size; ++i) {
SQLTableElement element = tableElementList.get(i);
element.accept(this);
if (i != size - 1) {
print(',');
}
if (this.isPrettyFormat() && element.hasAfterComment()) {
print(' ');
printlnComment(element.getAfterCommentsDirect());
}
if (i != size - 1) {
println();
}
}
if (stmt.getPeriodFor() != null) {
print(',');
println();
print0(ucase ? "PERIODĀ FOR " : "periodĀ for ");
stmt.getPeriodFor().accept(this);
}
this.indentCount--;
println();
print(')');
}
use of com.alibaba.druid.sql.ast.statement.SQLTableElement in project Mycat_plus by coderczp.
the class GlobalTableUtil method hasGlobalColumn.
private static boolean hasGlobalColumn(SQLStatement statement) {
for (SQLTableElement tableElement : ((SQLCreateTableStatement) statement).getTableElementList()) {
SQLName sqlName = null;
if (tableElement instanceof SQLColumnDefinition) {
sqlName = ((SQLColumnDefinition) tableElement).getName();
}
if (sqlName != null) {
String simpleName = sqlName.getSimpleName();
simpleName = StringUtil.removeBackquote(simpleName);
if (tableElement instanceof SQLColumnDefinition && GLOBAL_TABLE_MYCAT_COLUMN.equalsIgnoreCase(simpleName)) {
return true;
}
}
}
return false;
}
use of com.alibaba.druid.sql.ast.statement.SQLTableElement in project Mycat_plus by coderczp.
the class DruidMysqlCreateTableTest method hasColumn.
private static boolean hasColumn(SQLStatement statement) {
for (SQLTableElement tableElement : ((SQLCreateTableStatement) statement).getTableElementList()) {
SQLName sqlName = null;
if (tableElement instanceof SQLColumnDefinition) {
sqlName = ((SQLColumnDefinition) tableElement).getName();
}
if (sqlName != null) {
String simpleName = sqlName.getSimpleName();
simpleName = StringUtil.removeBackquote(simpleName);
if (tableElement instanceof SQLColumnDefinition && "_slot".equalsIgnoreCase(simpleName)) {
return true;
}
}
}
return false;
}
use of com.alibaba.druid.sql.ast.statement.SQLTableElement in project Mycat-Server by MyCATApache.
the class DruidMysqlCreateTableTest method hasColumn.
private static boolean hasColumn(SQLStatement statement) {
for (SQLTableElement tableElement : ((SQLCreateTableStatement) statement).getTableElementList()) {
SQLName sqlName = null;
if (tableElement instanceof SQLColumnDefinition) {
sqlName = ((SQLColumnDefinition) tableElement).getName();
}
if (sqlName != null) {
String simpleName = sqlName.getSimpleName();
simpleName = StringUtil.removeBackquote(simpleName);
if (tableElement instanceof SQLColumnDefinition && "_slot".equalsIgnoreCase(simpleName)) {
return true;
}
}
}
return false;
}
Aggregations