I have a requirement for a standard HTML form to collect a postcode or address, fire this off to our GIS (Geographical Information System), which returns a number of parameters incuding a slippy map etc. The form itself will not change over time, and as part of the process SQL queries will need to be passed to a seperate Postgres database. The flow will go something like this:
The question I have is it worth writing a custom module just for 1 page? I like the idea of using the Drupal API for sanitising the data and using D7's database abstraction layer for accessing Postgres, but I could also embed the code as a template override. I would prefer to keep the code well away from anyone who might accidently change it, so I'd rather not to add this as a PHP code block to the page.
I am also wary of changing the default database - could the following code snippet impact the rest of the site if the page failed to completely load?
<?phpdb_set_active('mydb');db_query('SELECT * FROM table_in_anotherdb');//Switch back to the default connection when finished.db_set_active('default');?>
From http://drupal.org/node/18429 - How to connect multiple databases within Drupal
As this is a new system, I want to make sure that it follows Drupal best practice - Any suggestions or recomendations would be really appreciated.