[power-matchmaker] r2765 committed - Make column name lookup case insensitive.

0 views
Skip to first unread message

power-ma...@googlecode.com

unread,
Jan 26, 2011, 12:22:30 PM1/26/11
to matchmake...@googlegroups.com
Revision: 2765
Author: dr....@gmail.com
Date: Wed Jan 26 09:21:40 2011
Log: Make column name lookup case insensitive.
http://code.google.com/p/power-matchmaker/source/detail?r=2765

Modified:
/branches/0.9.7/src/ca/sqlpower/matchmaker/address/AddressPool.java

=======================================
--- /branches/0.9.7/src/ca/sqlpower/matchmaker/address/AddressPool.java Wed
Jan 26 07:10:41 2011
+++ /branches/0.9.7/src/ca/sqlpower/matchmaker/address/AddressPool.java Wed
Jan 26 09:21:40 2011
@@ -587,8 +587,7 @@
*/
boolean usingNewNames = true;

- if (columnMetaData.containsKey(OLD_OUTPUT_DELIVERY_INSTALLATION_NAME) ||
-
columnMetaData.containsKey(OLD_OUTPUT_DELIVERY_INSTALLATION_NAME.toUpperCase()))
{
+ if (columnMetaData.containsKey(OLD_OUTPUT_DELIVERY_INSTALLATION_NAME)) {
usingNewNames = false;
}
engineLogger.debug("Using new shorter names? " + usingNewNames);
@@ -1105,7 +1104,7 @@

/**
* Build a Map of column meta data for the given table.
- * The Map's keys are the column names, which may or may not be in upper
case.
+ * The Map's keys are the column names, in lower case, to match the
constants in this class.
* The Map's values are the column widths (as Integers).
*
* SQLExceptions are not propogated to the caller. However, if no column
data
@@ -1122,11 +1121,12 @@
columns = meta.getColumns(table.getCatalogName(),
table.getSchemaName(), table.getName(), null);

while (columns.next()) {
- String col = columns.getString("COLUMN_NAME");
+ String col = StringUtils.lowerCase(columns.getString("COLUMN_NAME"));
int size = columns.getInt("COLUMN_SIZE");
+
engineLogger.debug("Column: " + col + " Size: " + size);

- columnMetaData.put(col, Integer.valueOf(size));
+ columnMetaData.put(col.toLowerCase(), Integer.valueOf(size));
}
} catch (SQLException e) {
// Don't propogate exception, just log and keep rolling on.

Reply all
Reply to author
Forward
0 new messages