My typical usage of sql-mode in emacs is to:
a. open a foo.sql file and begin editing
b. decide I want to run it using the key bindings for sql-send-region
c. fire up my custom (db-connect) function to connect to an appropriate db and create a *SQL* buffer.
However the foo.sql doesn't know about the existence of the *SQL* buffer unless I perform a "m-x sql-mode" in the buffer in order to refresh its environment and detect that such a buffer exists at this point. I would like to embed some code in my custom db-connect function to visit all buffers using sql-mode and update the sql-buffer variable. I am sure several stack overflow members must have done this or something similar before.
Thanks,
SetJmp