[ANN] pg.el v0.2 -- Emacs Lisp interface to PostgreSQL
[ANN] pg.el v0.2 -- Emacs Lisp interface to PostgreSQL
От:
Eric Marsden <emarsden@mail.dotcom.fr>
Дата:
pg.el is a socket-level interface to PostgreSQL for emacs (text editor extraordinaire). The module is capable of type coercions from a range of SQL types to the equivalent Emacs Lisp type. It currently supports neither crypt or Kerberos authentication, nor large objects. The code (version 0.2) is available under GNU GPL from Changes since last release: * now works with XEmacs (tested with Emacs 19.34 & 20.2, and XEmacs 20.4) * added functions to provide database metainformation (list of databases, of tables, of columns) * arguments to `pg:result' are now :keywords * MULE-resistant* more self-testing code Please note that this is a programmer's API, and doesn't provide any form of user interface. Example: (defun demo () (interactive) (let* ((conn (pg:connect "template1" "postgres" "postgres")) (res (pg:exec conn "SELECT * from scshdemo WHERE a = 42"))) (message "status is %s" (pg:result res :status)) (message "metadata is %s" (pg:result res :attributes)) (message "data is %s" (pg:result res :tuples)) (pg:disconnect conn))) -- Eric Marsden It's elephants all the way down
Re: [INTERFACES] [ANN] pg.el v0.2 -- Emacs Lisp interface to PostgreSQL
От:
Hugh Lawson <hglawson@nr.infi.net>
Дата:
On 21 Jul 1999, Eric Marsden wrote: > pg.el is a socket-level interface to PostgreSQL for emacs (text > editor extraordinaire). The module is capable of type coercions from a > range of SQL types to the equivalent Emacs Lisp type. It currently > supports neither crypt or Kerberos authentication, nor large objects. [snip] > Please note that this is a programmer's API, and doesn't provide any > form of user interface. Example: > > (defun demo () > (interactive) > (let* ((conn (pg:connect "template1" "postgres" "postgres")) > (res (pg:exec conn "SELECT * from scshdemo WHERE a = 42"))) > (message "status is %s" (pg:result res :status)) > (message "metadata is %s" (pg:result res :attributes)) > (message "data is %s" (pg:result res :tuples)) > (pg:disconnect conn))) Hello Eric: I am asking a dumb question here, so please be patient. Does this mean that given pg.el you have to write elisp functions in order to make use of it? Is the "defun demo()" above an example of such a function? If I understand correct, to use pg.el, I would write an elisp function in emacs and then evaluate it. Have I got this right? Hugh Lawson Greensboro, North Carolina hglawson@nr.infi.net
Re: [INTERFACES] [ANN] pg.el v0.2 -- Emacs Lisp interface to PostgreSQL
От:
Thomas Lockhart <lockhart@alumni.caltech.edu>
Дата:
> pg.el is a socket-level interface to PostgreSQL for emacs (text
> editor extraordinaire). The module is capable of type coercions from a
> range of SQL types to the equivalent Emacs Lisp type. It currently
> supports neither crypt or Kerberos authentication, nor large objects.
> The code (version 0.2) is available under GNU GPL from
>
> Please note that this is a programmer's API, and doesn't provide any
> form of user interface.
Neat stuff! Just curious:
1) it looks lisp-y, but I didn't look very closely; how much does this
code resemble that for other lisp packages such as Allegro?
2) you are distributing it under GPL. No problem with that, but if you
were amenable to distributing under a BSD-style license we could
include it in the main Postgres distribution. Is that a possibility?
It would be nice to have the foundation for another language interface
for folks to work with.
Thanks again for the code. If the url you published is a good
long-term reference, then I'll add your introductory mail message to
the docs.
Regards.
- Thomas
--
Thomas Lockhart lockhart@alumni.caltech.edu
South Pasadena, California
Re: [INTERFACES] [ANN] pg.el v0.2 -- Emacs Lisp interface to PostgreSQL
От:
Eric Marsden <emarsden@mail.dotcom.fr>
Дата:
>>>>> "hl" == Hugh Lawson writes: hl> I am asking a dumb question here, so please be patient. Does hl> this mean that given pg.el you have to write elisp functions in hl> order to make use of it? hl> hl> Is the "defun demo()" above an example of such a function? If I hl> understand correct, to use pg.el, I would write an elisp function in hl> emacs and then evaluate it. Have I got this right? Hi Hugh, That's right. demo is an example of the type of elisp a programmer would write to access PostgreSQL from Emacs. You can also play around with it interactively: ELISP> (setq conn (pg:connect "template1" "postgres" "postgres")) ELISP> (setq res (pg:exec conn "SELECT * from scshdemo WHERE a=42")) ELISP> (pg:result res :status) "SELECT" etc I intend to get together with someone else who has written some table browsing stuff for Emacs to produce a browsing interface to PostgreSQL for the end user, but I haven't had time yet. -- Eric Marsden It's elephants all the way down
Re: [ANN] pg.el v0.2 -- Emacs Lisp interface to PostgreSQL
От:
Eric Marsden <emarsden@mail.dotcom.fr>
Дата:
>>>>> "tl" == Thomas Lockhart writes: tl> 1) it looks lisp-y, but I didn't look very closely; how much tl> does this code resemble that for other lisp packages such as tl> Allegro? I assume you mean other "lisp implementations such as Allegro Common Lisp"? The answer is that I have also written a Common Lisp version (actually I wrote the CL version first), and a Scheme version (Scheme is another language in the Lisp family), but given that there is no standard interface to sockets in either Common Lisp or Scheme, the code is implementation-specific. tl> 2) you are distributing it under GPL. No problem with that, but tl> if you were amenable to distributing under a BSD-style license tl> we could include it in the main Postgres distribution. Is that a tl> possibility? It would be nice to have the foundation for another tl> language interface for folks to work with. this may be a little tricky. pg.el will probably be distributed with Emacs in the future, and thus I will have to assign copyright to the FSF. I will talk with rms about that. Does that mean that even for client code which is intended to run completely independently from the backend, it is not possible to mix BSD and GNU GPL code? The Common Lisp and Scheme implementations, however, are under GNU LGPL, and I have no problem releasing them under another licence. tl> Thanks again for the code. If the url you published is a good tl> long-term reference, then I'll add your introductory mail tl> message to the docs. give me a few days and I'll write a special page for it. Thanks. -- Eric Marsden It's elephants all the way down
Re: [ANN] pg.el v0.2 -- Emacs Lisp interface to PostgreSQL
От:
Thomas Lockhart <lockhart@alumni.caltech.edu>
Дата:
pg.el is a socket-level interface to Postgres for emacs. Written by Eric Marsden on 21 Jul 1999. pg.el is a socket-level interface to Postgres for emacs (text editor extraordinaire). The module is capable of type coercions from a range of SQL types to the equivalent Emacs Lisp type. It currently supports neither crypt or Kerberos authentication, nor large objects. The code (version 0.2) is available under GNU GPL from http://www.chez.com/emarsden/downloads/pg.el Changes since last release: now works with XEmacs (tested with Emacs 19.34 & 20.2, and XEmacs 20.4) added functions to provide database metainformation (list of databases, of tables, of columns) arguments to `pg:result' are now :keywords MULE-resistant more self-testing code Please note that this is a programmer's API, and doesn't provide any form of user interface. Example: (defun demo () (interactive) (let* ((conn (pg:connect "template1" "postgres" "postgres")) (res (pg:exec conn "SELECT * from scshdemo WHERE a = 42"))) (message "status is %s" (pg:result res :status)) (message "metadata is %s" (pg:result res :attributes)) (message "data is %s" (pg:result res :tuples)) (pg:disconnect conn)))
Re: [ANN] pg.el v0.2 -- Emacs Lisp interface to PostgreSQL
От:
Eric Marsden <emarsden@mail.dotcom.fr>
Дата:
>>>>> "tl" == Thomas Lockhart writes: tl> Would the CL version be available for the Postgres source tree? tl> It could form a basis for a generic implementation (with, of tl> course, some socket-specific stuff). ok, that is probably the best solution. I will have to clean it up a little first, but if I remember correctly I wrote wrappers for the socket code in CLISP, CMUCL and ACL. -- Eric Marsden It's elephants all the way down
Re: [ANN] pg.el v0.2 -- Emacs Lisp interface to PostgreSQL
От:
Thomas Lockhart <lockhart@alumni.caltech.edu>
Дата:
> tl> Would the CL version be available for the Postgres source tree?
> tl> It could form a basis for a generic implementation (with, of
> tl> course, some socket-specific stuff).
> ok, that is probably the best solution. I will have to clean it up a
> little first, but if I remember correctly I wrote wrappers for the
> socket code in CLISP, CMUCL and ACL.
Fantastic! I'll be sure it gets in the tree if you post it.
Thanks.
- Thomas
--
Thomas Lockhart lockhart@alumni.caltech.edu
South Pasadena, California
Re: [INTERFACES] [ANN] pg.el v0.2 -- Emacs Lisp interface to PostgreSQL
От:
Hugh Lawson <hglawson@nr.infi.net>
Дата:
On 21 Jul 1999, Eric Marsden wrote: > Hi Hugh, > > That's right. demo is an example of the type of elisp a programmer > would write to access PostgreSQL from Emacs. You can also play around > with it interactively: > > ELISP> (setq conn (pg:connect "template1" "postgres" "postgres")) > > ELISP> (setq res (pg:exec conn "SELECT * from scshdemo WHERE a=42")) > > ELISP> (pg:result res :status) > "SELECT" I can't get the hang of doing this. How do you get the ELISP> prompt? And what exactly do you type? I have succeeded at making the example function work properly. Hugh Lawson Greensboro, North Carolina hglawson@nr.infi.net
Re: [ANN] pg.el v0.2 -- Emacs Lisp interface to PostgreSQL
От:
Eric Marsden <emarsden@mail.dotcom.fr>
Дата:
>>>>> "hl" == Hugh Lawson writes: ecm> ELISP> (setq conn (pg:connect "template1" "postgres" "postgres")) ecm> >> ecm> ELISP> (setq res (pg:exec conn "SELECT * from scshdemo WHERE a=42")) ecm> >> ecm> ELISP> (pg:result res :status) ecm> >> "SELECT" hl> I can't get the hang of doing this. How do you get the ELISP> hl> prompt? And what exactly do you type? hl> hl> I have succeeded at making the example function work properly. The "ELISP>" prompt is from typing `M-x ielm' in Emacs (I don't think that XEmacs has anything like this: it's an inferior emacs-lisp). You can also type in the sexps using the *scratch* buffer, or using `M-:'. -- Eric Marsden It's elephants all the way down
Re: [INTERFACES] Re: [ANN] pg.el v0.2 -- Emacs Lisp interface to PostgreSQL
От:
Hugh Lawson <hglawson@nr.infi.net>
Дата:
On 22 Jul 1999, Eric Marsden wrote: > >>>>> "hl" == Hugh Lawson writes: > > hl> I can't get the hang of doing this. How do you get the ELISP> > hl> prompt? And what exactly do you type? > hl> > hl> I have succeeded at making the example function work properly. > > The "ELISP>" prompt is from typing `M-x ielm' in Emacs (I don't think > that XEmacs has anything like this: it's an inferior emacs-lisp). You > can also type in the sexps using the *scratch* buffer, or using `M-:'. Thanks Eric, I did what you said, imitated your examples, and it worked. Hugh Lawson Greensboro, North Carolina hglawson@nr.infi.net