diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-02 18:51:34 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-02 18:51:34 +1200 |
commit | af72af207613c80b8d66814d30644e4228e9b9e6 (patch) | |
tree | 56409810df0967976dce60799180fbee41e82439 /src/org/traccar/database/ObjectConverter.java | |
parent | 44da47950bdd75be57714158fd8a6d59c94460b5 (diff) | |
download | traccar-server-af72af207613c80b8d66814d30644e4228e9b9e6.tar.gz traccar-server-af72af207613c80b8d66814d30644e4228e9b9e6.tar.bz2 traccar-server-af72af207613c80b8d66814d30644e4228e9b9e6.zip |
Refactor data manager code
Diffstat (limited to 'src/org/traccar/database/ObjectConverter.java')
-rw-r--r-- | src/org/traccar/database/ObjectConverter.java | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/org/traccar/database/ObjectConverter.java b/src/org/traccar/database/ObjectConverter.java index 8d6e73123..7852c88f4 100644 --- a/src/org/traccar/database/ObjectConverter.java +++ b/src/org/traccar/database/ObjectConverter.java @@ -45,10 +45,6 @@ public class ObjectConverter { return array.build(); } - private static String getColumnName(String key) { - return key.replaceAll("([A-Z])", "_$1").toLowerCase(); - } - private static boolean hasColumn(ResultSet resultSet, String columnName) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); for (int i = 1; i <= metaData.getColumnCount(); i++) { @@ -67,9 +63,8 @@ public class ObjectConverter { } public static String getString(ResultSet record, String key) throws SQLException { - String column = getColumnName(key); - if (hasColumn(record, column)) { - return record.getString(column); + if (hasColumn(record, key)) { + return record.getString(key); } return null; } @@ -88,9 +83,8 @@ public class ObjectConverter { } public static long getLong(ResultSet record, String key) throws SQLException { - String column = getColumnName(key); - if (hasColumn(record, column)) { - return record.getLong(column); + if (hasColumn(record, key)) { + return record.getLong(key); } return 0; } @@ -111,9 +105,8 @@ public class ObjectConverter { } public static Date getDate(ResultSet record, String key) throws SQLException { - String column = getColumnName(key); - if (hasColumn(record, column)) { - return record.getDate(column); + if (hasColumn(record, key)) { + return record.getDate(key); } return null; } |