I am trying to avoid using hardcoded references to mysql database schemas inside sql queries for my forms. The only solution I can think of is to create a component with the schema name stored in a field and then to read that from the javascript expression {{ }} inside the sql query editor. Now I just change form name in one place. Is there any downsides to doing this? Is it better to softcode references a different way?
Hey @Joshua_B
There isn't necessarily a downside, but you may run into some prepared statement issues with using the schema as a variable in a SQL query.
One thing you can consider instead is to make separate resources for each of your DB connections so that the schema can be controlled by the resource in your forms. You should be able to grab the resource ids from the DB connections and then use those for the Query Resource:
This way you can set the resource to use (and it's schema) based on the form being submitted.
If this is not quite what you need, you might have to setup a JS Query or Transformer to parse out your full query or disable prepared statements in your current DB resource (though this does have some downsides).
I decided to use a different resource for each of my DB connections.
