query: Add support for attached databases
query: Add support for attached databases

- Add -a switch to attach an additional database before beginning the
transaction

- Move transaction processing into its own function

- Move command-line parsing into its own function

cmusatyalab/openisr,cmusatyalab/openisr,cmusatyalab/openisr,cmusatyalab/openisr,cmusatyalab/openisr