[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: jdbc urls
From: |
joakim |
Subject: |
Re: jdbc urls |
Date: |
Wed, 04 Jun 2008 18:03:19 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Chong Yidong <address@hidden> writes:
>
> It depends on how large the code is. If you posted a patch, we would be
> able to get a better idea.
This is the code I use for "planner".
My thought was that it could be better implemented in ffap.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; jdbc urls
(defun planner-browse-url-jdbc (url)
"Browse JDBC URLs."
;; code for browsing JDBC URLs
;; url to test with:
(string-match
"jdbc:\\([^:/]*\\)://\\([^/]*\\)/\\([^?]*\\).user=\\([^&]*\\)&password=\\(.*\\)"
url)
(let
((driver (match-string 1 url))
(sql-server (match-string 2 url))
(sql-database (match-string 3 url))
(sql-user (match-string 4 url))
(sql-password (match-string 5 url))
)
(message "jdbc url:%s driver:%s host:%s db:%s usr:%s pwd:%s" url driver
sql-server sql-database sql-user sql-password)
(sql-postgres)
(sql-rename-buffer) ;renames the buffer to something useful
)
)
;jdbc:\\([^:/]*\\)://\\([^/]*\\)/\\([^?]*\\).user=\\([^&]*\\)&password=\\(.*\\)
(defun planner-resolve-url-jdbc (url)
"Resolve JDBC URLs."
;; Turn a JDBC URL into an http:// URL, if applicable
;; Otherwise omit this and use 'identify below
nil)
(planner-add-protocol "jdbc:" 'planner-browse-url-jdbc
'planner-resolve-url-jdbc)
;; So if you activate a url like:
;; jdbc:postgresql://localhost/pgdatabase?user=demo&password=demo
;; it will open that server in sql mode.
;; TODO:
;; - driver is just ignored, should for to the correct postgres/mssql
;; whatever driver function. currently it just does postgres
;; - sql mode prompts for arguments, with the data suplied in the jdbc
;; url as defaults, I would rather not have it prompt.
;; - try to remember if there is a buffer for this url already and optionaly go
there instead
--
Joakim Verona
- jdbc urls, joakim, 2008/06/04
- Re: jdbc urls, Chong Yidong, 2008/06/04
- Re: jdbc urls, Stefan Monnier, 2008/06/04
- Re: jdbc urls, joakim, 2008/06/04
- Re: jdbc urls, Stefan Monnier, 2008/06/04
- Re: jdbc urls, joakim, 2008/06/12
- Re: jdbc urls, joakim, 2008/06/12
- Re: jdbc urls, Stefan Monnier, 2008/06/13
- Re: jdbc urls, joakim, 2008/06/15