summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakefeasel <jfeasel@gmail.com>2015-05-05 06:29:59 -0700
committerjakefeasel <jfeasel@gmail.com>2015-05-05 06:29:59 -0700
commitf851bd51cac04f425118cf2b7a07a98bf41b1f0c (patch)
tree1c04f2e08667cca21bbdd2899a58cb131ecbd60b
parent3f2624bd2dbdc06c14df15c65746a80341de58b9 (diff)
downloadsqlfiddle2-f851bd51cac04f425118cf2b7a07a98bf41b1f0c.zip
sqlfiddle2-f851bd51cac04f425118cf2b7a07a98bf41b1f0c.tar.gz
sqlfiddle2-f851bd51cac04f425118cf2b7a07a98bf41b1f0c.tar.bz2
Checking for hosts before attempting to call createSchema, particularly for old fiddles
-rw-r--r--src/main/resources/script/executeQuery.groovy12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/resources/script/executeQuery.groovy b/src/main/resources/script/executeQuery.groovy
index bb9f5c9..840263f 100644
--- a/src/main/resources/script/executeQuery.groovy
+++ b/src/main/resources/script/executeQuery.groovy
@@ -153,6 +153,18 @@ if (securityContext.authorizationId.component == "system/fiddles/users") {
if (db_type.context == "host") {
+ if (db_type.num_hosts == 0) {
+ response.sets = [
+ [
+ STATEMENT: "",
+ RESULTS: [DATA: [], COLUMNS: []],
+ SUCCEEDED: false,
+ ERRORMESSAGE: "No host of this type available to create schema. Try using a different database version."
+ ]
+ ]
+ return response
+ }
+
// schemas that we never deprovision don't need to be created
if (schema_def.deprovision) {
def schema = openidm.action("endpoint/createSchema", "create", schema_def)