From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Hlavaty Newsgroups: gmane.emacs.devel Subject: Re: Adding emacsql to NonGNU ELPA? Date: Thu, 27 Jan 2022 23:56:17 +0100 Message-ID: <878rv0yei6.fsf@logand.com> References: <87ilv13v3y.fsf@gnus.org> <87czkdg695.fsf@vagabond.tim-landscheidt.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7876"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Tim Landscheidt Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 27 23:57:05 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nDDhR-0001na-3F for ged-emacs-devel@m.gmane-mx.org; Thu, 27 Jan 2022 23:57:05 +0100 Original-Received: from localhost ([::1]:50874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDDhP-00042e-OC for ged-emacs-devel@m.gmane-mx.org; Thu, 27 Jan 2022 17:57:03 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDDgt-0003N2-PX for emacs-devel@gnu.org; Thu, 27 Jan 2022 17:56:31 -0500 Original-Received: from logand.com ([37.48.87.44]:49140) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDDgs-0005g7-12 for emacs-devel@gnu.org; Thu, 27 Jan 2022 17:56:31 -0500 Original-Received: by logand.com (Postfix, from userid 1001) id 053A819ECC7; Thu, 27 Jan 2022 23:56:21 +0100 (CET) X-Mailer: emacs 27.2 (via feedmail 11-beta-1 I) In-Reply-To: <87czkdg695.fsf@vagabond.tim-landscheidt.de> Received-SPF: pass client-ip=37.48.87.44; envelope-from=tom@logand.com; helo=logand.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:285508 Archived-At: On Thu 27 Jan 2022 at 04:19, Tim Landscheidt 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