Forum OpenACS Development: Replacing SQL bind variables in Emacs

I've written an article explaining how one can customize Emacs so that OpenACS bind variables are being replaced with real values. Read it at http://www.thecodemill.biz/publications/articles/emacs-sql-vars/

With the customization in place you can enter query definitions with bind variables and all in an interactive SQL buffer and have Emacs ask you for values for the bind variables in the query. Pure magic!

Works almost perfect with MMM mode for XQL files as described in my article on the XQL DTD over at http://www.thecodemill.biz/publications/articles/xql-dtd/.

/Bart

Collapse
Posted by Rocael Hernández Rizzardini on
cool Bart,
what about oracle, something like this?
(defadvice sql-oracle (after sql-oracle)
  "Use xql-query-bind-and-send for `comint-input-sender'."
  (setq comint-input-sender 'xql-query-bind-and-send)
)
Collapse
Posted by Bart Teeuwisse on

Rocael,

to be honest, I'm not 100% sure if Oracle places the same quotes (') around the bound values as Postgres does. If it doesn't you'd have to modify xql-query-bind-and-send. Provided that both databases can use the same function, you'd have to add:

(defadvice sql-oracle (after sql-oracle)
  "Use xql-query-bind-and-send for `comint-input-sender'."
  (setq comint-input-sender 'xql-query-bind-and-send)
)
(ad-activate 'sql-oracle)

The ad-activate is important, it activates the defined advise. If you leave it out, nothing will happen.

/Bart

Collapse
Posted by Randy O'Meara on
Awwww. I was just taking the time to look at both of your articles regarding Emacs and XQL/SQL, but it looks like your site is having problems. I get the following, even at the root of your site:

"The requested URL was not found on this server."

Randy

Collapse
Posted by Bart Teeuwisse on
Randy,

sorry, had to turn the power off for some electricity upgrades. The server is back up.

/Bart

Collapse
Posted by Randy O'Meara on
Bart: I just wanted to say thanks for putting this information together and sharing it. This is slick and has simplified my life several times over the last couple months. If other folks haven't set this up, they should definitely give it a try!

Randy