aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-08-01 18:10:06 +1200
committerGitHub <noreply@github.com>2017-08-01 18:10:06 +1200
commite400191c041b33284743b2303ab72721e831a0a3 (patch)
treed7ac5b7d06f1db616571a05297d8996e8beaa60e /src/org/traccar/database
parent06df08150504f86cc7e34c1ef90277c87ba55b99 (diff)
parent536e04dd996041d2ae608e56ea6233850cc027f2 (diff)
downloadtrackermap-server-e400191c041b33284743b2303ab72721e831a0a3.tar.gz
trackermap-server-e400191c041b33284743b2303ab72721e831a0a3.tar.bz2
trackermap-server-e400191c041b33284743b2303ab72721e831a0a3.zip
Merge pull request #3405 from Abyss777/query_generator_switch
Make query generator switchable
Diffstat (limited to 'src/org/traccar/database')
-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;