I haven’t been using vim for very long, but I’ve gotten over the initial learning curve of getting used to the different editing modes. With some help from the guys in #vim on irc.freenode.net, I managed to get this gem:
:call SwitchDB() :function SwitchDB() : let g:current_db = input(“Database > “) :endfunction
Control-m to execute a query. Control-d to switch databases. It’ll prompt you the first time.