aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup/default.xml2
-rw-r--r--src/org/traccar/database/DataManager.java12
2 files changed, 12 insertions, 2 deletions
diff --git a/setup/default.xml b/setup/default.xml
index ea8c32fbd..2c126e6dd 100644
--- a/setup/default.xml
+++ b/setup/default.xml
@@ -28,6 +28,8 @@
<entry key='database.ignoreUnknown'>true</entry>
+ <entry key='database.generateQueries'>true</entry>
+
<entry key='database.changelog'>./schema/changelog-master.xml</entry>
<entry key='database.loginUser'>
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;