提交 a79a70ef authored 作者: Owner's avatar Owner

Tried another getSQL() strategy for column naming

上级 67ba1c0e
...@@ -40,6 +40,9 @@ public class ColumnNamer { ...@@ -40,6 +40,9 @@ public class ColumnNamer {
String columnName = null; String columnName = null;
if (columnNameOverride != null){ if (columnNameOverride != null){
columnName = columnNameOverride; columnName = columnNameOverride;
if(!isAllowableColumnName(columnName)){
columnName = null;
}
} }
// try a name form the column alias // try a name form the column alias
if (columnName==null && columnExp.getAlias()!=null){ if (columnName==null && columnExp.getAlias()!=null){
...@@ -61,6 +64,16 @@ public class ColumnNamer { ...@@ -61,6 +64,16 @@ public class ColumnNamer {
columnName = null; columnName = null;
} }
} }
// try a name derived form the column expression plan SQL
if (columnName==null && columnExp.getSQL()!=null){
columnName = columnExp.getSQL();
if(!isAllowableColumnName(columnName)){
columnName = columnName.replace('\n', ' ').replace('\r', ' ');
}
if(!isAllowableColumnName(columnName)){
columnName = null;
}
}
// go with a innocuous default name pattern // go with a innocuous default name pattern
if (columnName==null){ if (columnName==null){
columnName = "_unnamed_column_"+(indexOfColumn+1)+"_"; columnName = "_unnamed_column_"+(indexOfColumn+1)+"_";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论