diff --git a/conf/core/server.conf b/conf/core/server.conf index 246be9aa9285e4434803d3a71d18c24412922bf4..b00b6b76cf6aa4f0dc71fd632c1987c75d49f7e2 100644 --- a/conf/core/server.conf +++ b/conf/core/server.conf @@ -67,7 +67,7 @@ MYSQL_DATABASE_NAME=caosdb # User name for connecting to mysql MYSQL_USER_NAME=caosdb # Password for the user -MYSQL_USER_PASSWORD=caosdb +MYSQL_USER_PASSWORD=random1234 # Schema of mysql procedures and tables which is required by this CaosDB instance MYSQL_SCHEMA_VERSION=v5.0 @@ -169,8 +169,8 @@ ADMIN_EMAIL= BUGTRACKER_URI= # If set to true MySQL stores transaction benchmarks for all SQL queries. Used for benchmarking and debugging. -TRANSACTION_BENCHMARK_ENABLED=FALSE -#TRANSACTION_BENCHMARK_ENABLED=TRUE +#TRANSACTION_BENCHMARK_ENABLED=FALSE +TRANSACTION_BENCHMARK_ENABLED=TRUE # Location of the configuration file for the CaosDB cache. CACHE_CONF_LOC=./conf/core/cache.ccf # Set this option to true to lobally disable caching. Used for debugging. diff --git a/src/main/java/org/caosdb/server/query/Query.java b/src/main/java/org/caosdb/server/query/Query.java index 2697b77c316defc085a95be664e5d77f597f2824..be76324e767e5cc837196f24405450b39daa8717 100644 --- a/src/main/java/org/caosdb/server/query/Query.java +++ b/src/main/java/org/caosdb/server/query/Query.java @@ -377,7 +377,6 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac * have the RETRIEVE:ENTITY permission for a particular QueryTemplate it will be ignored. * * @param resultSet - * @throws SQLException * @throws QueryException */ public void applyQueryTemplates(final QueryInterface query, final String resultSet) @@ -677,41 +676,46 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac * @throws ParsingException */ public Query execute(final Access access) throws ParsingException { - parse(); - setAccess(access); - if (useCache()) { - this.resultSet = getCached(getCacheKey()); - } + try { + parse(); + setAccess(access); + if (useCache()) { + this.resultSet = getCached(getCacheKey()); + } - if (this.resultSet == null) { - executeNoCache(access); - if (this.cachable) { - setCache(getCacheKey(), this.resultSet); + if (this.resultSet == null) { + executeNoCache(access); + if (this.cachable) { + setCache(getCacheKey(), this.resultSet); + } + this.logger.debug("Uncached query {}", this.query); + } else { + this.logger.debug("Using cached result for {}", this.query); + this.cached = true; } - this.logger.debug("Uncached query {}", this.query); - } else { - this.logger.debug("Using cached result for {}", this.query); - this.cached = true; - } - // Fill resulting entities into container - if (this.container != null && this.type == Type.FIND) { - for (final IdVersionPair p : this.resultSet) { + // Fill resulting entities into container + if (this.container != null && this.type == Type.FIND) { + for (final IdVersionPair p : this.resultSet) { - if (p.id > 99) { - final Entity e = new RetrieveEntity(p.id, p.version); + if (p.id > 99) { + final Entity e = new RetrieveEntity(p.id, p.version); - // if query has select-clause: - if (this.selections != null && !this.selections.isEmpty()) { - e.addSelections(this.selections); + // if query has select-clause: + if (this.selections != null && !this.selections.isEmpty()) { + e.addSelections(this.selections); + } + this.container.add(e); } - this.container.add(e); } } + + } catch (final SQLException e) { + e.printStackTrace(); + throw new TransactionException(e); } return this; } - /** Remove all cached queries from the cache. */ public static void clearCache() { cacheETag = UUID.randomUUID().toString(); @@ -745,7 +749,7 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac return (List<IdVersionPair>) cache.get(key); } - protected void executeNoCache(final Access access) { + protected void executeNoCache(final Access access) throws SQLException { try { final String tabname = executeStrategy(this.versioned); filterEntitiesWithoutRetrievePermission(tabname); @@ -792,9 +796,9 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac * * @param resultSet * @throws SQLException - * @throws TransactionException */ - public void filterEntitiesWithoutRetrievePermission(final String resultSet) { + public void filterEntitiesWithoutRetrievePermission(final String resultSet) + throws SQLException { if (!filterEntitiesWithoutRetrievePermisions) { return; }