[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding emacsql to NonGNU ELPA?

From: Tomas Hlavaty
Subject: Re: Adding emacsql to NonGNU ELPA?
Date: Thu, 27 Jan 2022 23:56:17 +0100

On Thu 27 Jan 2022 at 04:19, Tim Landscheidt <tim@tim-landscheidt.de> wrote:
> There isn't anything similar for other languages, so why for
> SQL?

Of course there is.  Lisp is full of stuff like this.  For example,
there is a cons tree language for regular expressions in Emacs:

   (info "(elisp) Rx Notation")

There are also cons tree bases representations of xml, html, svg etc.

One can conveniently represent almost anything using cons trees.
It is great.

In Lisp, the first thing to do is to escape the concat string
inconvenient and insecure hell and use cons tree based representation
which is very easy to work with.

> This DSL would need to be /very/ complicated for it to
> be able to express non-trivial SQL statements.

On the contrary, it is very simple and allows writing arbitrary SQL

> What I dearly yearn for is an equivalent of
> shell-quote-argument (or prin1 & Co.) for SQL (and maybe
> other languages), e. g. in Emacs Lisp generate a Perl
> script, embedding strings that represent data gathered by
> Emacs Lisp.

If you need to generate a Perl script, you can create your own cons tree
based DSL which would ensure proper escaping is used in the right
places.  Simply recursively traverse the cons tree and output what you
want in a way you want.

For inspiration, here is what I do to generate PDF:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]