handle_tx: mostly separate SQL from HTML.
handle_tx: Move SQL to DataStore.