diff options
author | jakefeasel <jfeasel@gmail.com> | 2015-05-03 10:14:49 -0700 |
---|---|---|
committer | jakefeasel <jfeasel@gmail.com> | 2015-05-03 10:14:49 -0700 |
commit | 113e1b943d2e9d83446f66fbf874e33e7c3b35c6 (patch) | |
tree | a4c553b670fd12d9fb5efa72b17d19aa7ae13fba | |
parent | eae94d281b27dae3175983fc56d1139e2623e976 (diff) | |
download | sqlfiddle2-113e1b943d2e9d83446f66fbf874e33e7c3b35c6.zip sqlfiddle2-113e1b943d2e9d83446f66fbf874e33e7c3b35c6.tar.gz sqlfiddle2-113e1b943d2e9d83446f66fbf874e33e7c3b35c6.tar.bz2 |
Do not attempt to create schemas that never get deprovisioned
-rw-r--r-- | src/main/resources/script/executeQuery.groovy | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/main/resources/script/executeQuery.groovy b/src/main/resources/script/executeQuery.groovy index e4f6dd7..bb9f5c9 100644 --- a/src/main/resources/script/executeQuery.groovy +++ b/src/main/resources/script/executeQuery.groovy @@ -153,25 +153,27 @@ if (securityContext.authorizationId.component == "system/fiddles/users") { if (db_type.context == "host") { - def schema = openidm.action("endpoint/createSchema", "create", schema_def) - - if (schema.containsKey("error")) { - response.sets = [ - [ - STATEMENT: "", - RESULTS: [DATA: [], COLUMNS: []], - SUCCEEDED: false, - ERRORMESSAGE: schema.error + // schemas that we never deprovision don't need to be created + if (schema_def.deprovision) { + def schema = openidm.action("endpoint/createSchema", "create", schema_def) + + if (schema.containsKey("error")) { + response.sets = [ + [ + STATEMENT: "", + RESULTS: [DATA: [], COLUMNS: []], + SUCCEEDED: false, + ERRORMESSAGE: schema.error + ] ] - ] - return response + return response + } } // We get the details about how to connect to the running DB by doing a read on it - def hostDatabase = openidm.read("system/hosts/databases/db_" + schema._id) + def hostDatabase = openidm.read("system/hosts/databases/db_" + schema_def._id) def hostConnection = Sql.newInstance(hostDatabase.jdbc_url, hostDatabase.username, hostDatabase.pw, hostDatabase.jdbc_class_name) - hostConnection.withStatement { it.queryTimeout = 10 } // mysql handles transactions poorly; better to just make the whole thing readonly |