service (sid) | user | pwd |
---|---|---|
prod | owner app | god |
dev | dbo | love |
uat | dba | secret |
Created
October 29, 2012 12:50
-
-
Save ivv-private/3973344 to your computer and use it in GitHub Desktop.
blog-con-mgr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'sqlplus) | |
(require 'org-table) | |
(defvar sqlplus-x-columns '(sqlplus-x-service sqlplus-x-user sqlplus-x-pwd)) | |
(defun sqlplus-x-connect () | |
"Build a connection string and make a connection. The point must be in an org-mode table. | |
Columns of the table must correspond to the `sqlplus-x-columns' variable." | |
(interactive) | |
(org-table-force-dataline) | |
(let | |
((cur-row (nth (org-table-current-dline) (org-table-to-lisp))) | |
(is-user-selected (= (org-table-current-column) (+ 1 (position 'sqlplus-x-user sqlplus-x-columns))))) | |
(sqlplus | |
(format | |
"%s/%s@%s" | |
(if is-user-selected | |
(thing-at-point 'symbol) | |
(nth (position 'sqlplus-x-user sqlplus-x-columns) cur-row)) | |
(nth (position 'sqlplus-x-pwd sqlplus-x-columns) cur-row) | |
(nth (position 'sqlplus-x-service sqlplus-x-columns) cur-row)) | |
(concat (nth (position 'sqlplus-x-service sqlplus-x-columns) cur-row) ".sqp")))) | |
(global-set-key [f4] 'sqlplus-x-connect) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment