提交 27c5fd08 authored 作者: Owner's avatar Owner

Standardized names, removed sysout comments from test

上级 18ef6e09
...@@ -36,16 +36,22 @@ public class ColumnNamer { ...@@ -36,16 +36,22 @@ public class ColumnNamer {
* @return the new column name * @return the new column name
*/ */
public static String getColumnName(Expression columnExp, int indexOfColumn, String columnNameOverride) { public static String getColumnName(Expression columnExp, int indexOfColumn, String columnNameOverride) {
// try a name form the column name override
String columnName = null; String columnName = null;
if (columnNameOverride != null){ if (columnNameOverride != null){
columnName = columnNameOverride; columnName = columnNameOverride;
} }
// try a name form the column alias
if (columnName==null && columnExp.getAlias()!=null){ if (columnName==null && columnExp.getAlias()!=null){
columnName = columnExp.getAlias(); columnName = columnExp.getAlias();
if(!isAllowableColumnName(columnName)){
columnName = columnName.replace('\n', ' ').replace('\r', ' ');
}
if(!isAllowableColumnName(columnName)){ if(!isAllowableColumnName(columnName)){
columnName = null; columnName = null;
} }
} }
// try a name derived form the column expression SQL
if (columnName==null && columnExp.getColumnName()!=null){ if (columnName==null && columnExp.getColumnName()!=null){
columnName = columnExp.getColumnName(); columnName = columnExp.getColumnName();
if(!isAllowableColumnName(columnName)){ if(!isAllowableColumnName(columnName)){
...@@ -55,6 +61,7 @@ public class ColumnNamer { ...@@ -55,6 +61,7 @@ public class ColumnNamer {
columnName = null; columnName = null;
} }
} }
// go with a innocuous default name pattern
if (columnName==null){ if (columnName==null){
columnName = "_unnamed_column_"+(indexOfColumn+1)+"_"; columnName = "_unnamed_column_"+(indexOfColumn+1)+"_";
} }
......
...@@ -541,8 +541,6 @@ public class TestGeneralCommonTableQueries extends TestBase { ...@@ -541,8 +541,6 @@ public class TestGeneralCommonTableQueries extends TestBase {
} }
conn.close(); conn.close();
//System.out.println("conn.close();");
deleteDb("commonTableExpressionQueries"); deleteDb("commonTableExpressionQueries");
//System.out.println("deleteDb(commonTableExpressionQueries);");
} }
} }
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论