aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-08-01 10:28:50 +0500
committerAbyss777 <abyss@fox5.ru>2017-08-01 10:28:50 +0500
commit536e04dd996041d2ae608e56ea6233850cc027f2 (patch)
treed7ac5b7d06f1db616571a05297d8996e8beaa60e /src/org
parent06df08150504f86cc7e34c1ef90277c87ba55b99 (diff)
downloadtrackermap-server-536e04dd996041d2ae608e56ea6233850cc027f2.tar.gz
trackermap-server-536e04dd996041d2ae608e56ea6233850cc027f2.tar.bz2
trackermap-server-536e04dd996041d2ae608e56ea6233850cc027f2.zip
Make query generator switchable
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/database/DataManager.java12
1 files changed, 10 insertions, 2 deletions
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;