From 536e04dd996041d2ae608e56ea6233850cc027f2 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 1 Aug 2017 10:28:50 +0500 Subject: Make query generator switchable --- src/org/traccar/database/DataManager.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 63d98818d..709d2f057 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -72,6 +72,8 @@ public class DataManager { private DataSource dataSource; + private boolean generateQueries; + public DataManager(Config config) throws Exception { this.config = config; @@ -120,6 +122,8 @@ public class DataManager { hikariConfig.setMaximumPoolSize(maxPoolSize); } + generateQueries = config.getBoolean("database.generateQueries"); + dataSource = new HikariDataSource(hikariConfig); } @@ -218,9 +222,11 @@ public class DataManager { } } String query = config.getString(queryName); - if (query == null) { + if (query == null && generateQueries) { query = constructObjectQuery(action, clazz, extended); config.setString(queryName, query); + } else { + Log.info("Query not provided: " + queryName); } return query; @@ -236,9 +242,11 @@ public class DataManager { queryName = "database.unlink" + owner.getSimpleName() + property.getSimpleName(); } String query = config.getString(queryName); - if (query == null) { + if (query == null && generateQueries) { query = constructPermissionQuery(action, owner, property.equals(User.class) ? ManagedUser.class : property); config.setString(queryName, query); + } else { + Log.info("Query not provided: " + queryName); } return query; -- cgit v1.2.3