mirror of https://github.com/apache/nifi.git
NIFI-3494: GenerateTableFetch Some JDBC Drivers Have Trouble With Name vs Label
Signed-off-by: Matt Burgess <mattyb149@apache.org> This closes #1517
This commit is contained in:
parent
bf2f04fb5f
commit
d689ac561e
|
@ -251,7 +251,10 @@ public class GenerateTableFetch extends AbstractDatabaseFetchProcessor {
|
|||
// Update the state map with the newly-observed maximum values
|
||||
ResultSetMetaData rsmd = resultSet.getMetaData();
|
||||
for (int i = 2; i <= rsmd.getColumnCount(); i++) {
|
||||
String resultColumnName = rsmd.getColumnName(i).toLowerCase();
|
||||
//Some JDBC drivers consider the columns name and label to be very different things.
|
||||
// Since this column has been aliased lets check the label first,
|
||||
// if there is no label we'll use the column name.
|
||||
String resultColumnName = (StringUtils.isNotEmpty(rsmd.getColumnLabel(i))?rsmd.getColumnLabel(i):rsmd.getColumnName(i)).toLowerCase();
|
||||
String fullyQualifiedStateKey = getStateKey(tableName, resultColumnName);
|
||||
String resultColumnCurrentMax = statePropertyMap.get(fullyQualifiedStateKey);
|
||||
if (StringUtils.isEmpty(resultColumnCurrentMax) && !isDynamicTableName) {
|
||||
|
|
Loading…
Reference in New Issue