unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: joakim@verona.se
To: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: jdbc urls
Date: Wed, 04 Jun 2008 18:03:19 +0200	[thread overview]
Message-ID: <m3iqwptcfs.fsf@verona.se> (raw)
In-Reply-To: <874p89xp27.fsf@stupidchicken.com> (Chong Yidong's message of "Wed, 04 Jun 2008 10:17:04 -0400")

Chong Yidong <cyd@stupidchicken.com> 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




  reply	other threads:[~2008-06-04 16:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04 11:42 jdbc urls joakim
2008-06-04 14:17 ` Chong Yidong
2008-06-04 16:03   ` joakim [this message]
2008-06-04 17:35 ` Stefan Monnier
2008-06-04 19:35   ` joakim
2008-06-05  2:11     ` Stefan Monnier
2008-06-12 16:25       ` joakim
2008-06-12 18:16         ` joakim
2008-06-13 14:56         ` Stefan Monnier
2008-06-15 22:42           ` joakim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3iqwptcfs.fsf@verona.se \
    --to=joakim@verona.se \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).