aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/ObjectConverter.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-05-02 18:51:34 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-05-02 18:51:34 +1200
commitaf72af207613c80b8d66814d30644e4228e9b9e6 (patch)
tree56409810df0967976dce60799180fbee41e82439 /src/org/traccar/database/ObjectConverter.java
parent44da47950bdd75be57714158fd8a6d59c94460b5 (diff)
downloadtrackermap-server-af72af207613c80b8d66814d30644e4228e9b9e6.tar.gz
trackermap-server-af72af207613c80b8d66814d30644e4228e9b9e6.tar.bz2
trackermap-server-af72af207613c80b8d66814d30644e4228e9b9e6.zip
Refactor data manager code
Diffstat (limited to 'src/org/traccar/database/ObjectConverter.java')
-rw-r--r--src/org/traccar/database/ObjectConverter.java19
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;
}