diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-20 07:14:23 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-20 07:14:23 -0700 |
commit | 5afb5176c63e97b1a99ef54aa7af09927fb1f3f2 (patch) | |
tree | f84e584602b9190e028ae8c68f4d37bb528bdb7e | |
parent | 45940f73c57b871711ee9fb41ebeba3c0ca9e9b6 (diff) | |
download | trackermap-server-5afb5176c63e97b1a99ef54aa7af09927fb1f3f2.tar.gz trackermap-server-5afb5176c63e97b1a99ef54aa7af09927fb1f3f2.tar.bz2 trackermap-server-5afb5176c63e97b1a99ef54aa7af09927fb1f3f2.zip |
Simplify select statements
-rw-r--r-- | debug.xml | 2 | ||||
-rw-r--r-- | src/main/java/org/traccar/storage/DatabaseStorage.java | 6 |
2 files changed, 6 insertions, 2 deletions
@@ -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())); |