all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tomas Hlavaty <tom@logand.com>
To: Tim Landscheidt <tim@tim-landscheidt.de>
Cc: emacs-devel@gnu.org
Subject: Re: Adding emacsql to NonGNU ELPA?
Date: Thu, 27 Jan 2022 23:56:17 +0100	[thread overview]
Message-ID: <878rv0yei6.fsf@logand.com> (raw)
In-Reply-To: <87czkdg695.fsf@vagabond.tim-landscheidt.de>

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
statements.

> 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:
https://logand.com/sw/emacs-pdf/file/emacs-pdf.el.html#l118



  parent reply	other threads:[~2022-01-27 22:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-02 16:16 Adding emacsql to NonGNU ELPA? Stefan Kangas
2022-01-02 17:09 ` Teemu Likonen
2022-01-03 11:40 ` Lars Ingebrigtsen
2022-01-03 12:54   ` Tim Cross
2022-01-03 16:00     ` [External] : " Drew Adams
2022-01-27  4:19   ` Tim Landscheidt
2022-01-27  6:03     ` Stefan Monnier
2022-01-27 14:54       ` Tim Landscheidt
2022-01-27 15:52         ` Stefan Monnier
2022-01-27 22:56     ` Tomas Hlavaty [this message]
     [not found]     ` <87bkzwyek6.fsf@logand.com>
     [not found]       ` <87h79obnuy.fsf@vagabond.tim-landscheidt.de>
2022-01-28 19:12         ` Tomas Hlavaty

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

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

  git send-email \
    --in-reply-to=878rv0yei6.fsf@logand.com \
    --to=tom@logand.com \
    --cc=emacs-devel@gnu.org \
    --cc=tim@tim-landscheidt.de \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.