aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-20 07:14:23 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-20 07:14:23 -0700
commit5afb5176c63e97b1a99ef54aa7af09927fb1f3f2 (patch)
treef84e584602b9190e028ae8c68f4d37bb528bdb7e
parent45940f73c57b871711ee9fb41ebeba3c0ca9e9b6 (diff)
downloadtrackermap-server-5afb5176c63e97b1a99ef54aa7af09927fb1f3f2.tar.gz
trackermap-server-5afb5176c63e97b1a99ef54aa7af09927fb1f3f2.tar.bz2
trackermap-server-5afb5176c63e97b1a99ef54aa7af09927fb1f3f2.zip
Simplify select statements
-rw-r--r--debug.xml2
-rw-r--r--src/main/java/org/traccar/storage/DatabaseStorage.java6
2 files changed, 6 insertions, 2 deletions
diff --git a/debug.xml b/debug.xml
index 73576b20b..50e70c812 100644
--- a/debug.xml
+++ b/debug.xml
@@ -12,7 +12,7 @@
<entry key='web.console'>true</entry>
<entry key='logger.console'>true</entry>
- <entry key='logger.queries'>false</entry>
+ <entry key='logger.queries'>true</entry>
<entry key='database.driver'>org.h2.Driver</entry>
<entry key='database.url'>jdbc:h2:./target/database</entry>
diff --git a/src/main/java/org/traccar/storage/DatabaseStorage.java b/src/main/java/org/traccar/storage/DatabaseStorage.java
index 052f11ad2..eec72b510 100644
--- a/src/main/java/org/traccar/storage/DatabaseStorage.java
+++ b/src/main/java/org/traccar/storage/DatabaseStorage.java
@@ -54,7 +54,11 @@ public class DatabaseStorage extends Storage {
@Override
public <T> List<T> getObjects(Class<T> clazz, Request request) throws StorageException {
StringBuilder query = new StringBuilder("SELECT ");
- query.append(formatColumns(request.getColumns(), clazz, "get", c -> c));
+ if (request.getColumns() instanceof Columns.All) {
+ query.append('*');
+ } else {
+ query.append(formatColumns(request.getColumns(), clazz, "get", c -> c));
+ }
query.append(" FROM ").append(getStorageName(clazz));
query.append(formatCondition(request.getCondition()));
query.append(formatOrder(request.getOrder()));