From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: [NonGNU ELPA] New package: sqlite3 Date: Tue, 21 Mar 2023 11:08:44 +0000 Message-ID: <87y1nq5pkz.fsf@posteo.net> References: <87cz5o6csk.fsf@bernoul.li> <87mt4swxsw.fsf@posteo.net> <875ybd7mbh.fsf@bernoul.li> <87y1nzb95o.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17289"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jonas Bernoulli , emacs-devel@gnu.org To: Lynn Winebarger Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 21 12:09:10 2023 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 1peZrZ-0004H1-Aa for ged-emacs-devel@m.gmane-mx.org; Tue, 21 Mar 2023 12:09:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1peZqu-0003C6-CJ; Tue, 21 Mar 2023 07:08:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peZqs-0003Bn-Ee for emacs-devel@gnu.org; Tue, 21 Mar 2023 07:08:26 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peZqp-0003vE-MF for emacs-devel@gnu.org; Tue, 21 Mar 2023 07:08:25 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 52A5D2406A0 for ; Tue, 21 Mar 2023 12:08:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1679396901; bh=H88welUpQ9dfXSW1ZICYq+ozIpAYrsZqu89kzcRRTAs=; h=From:To:Cc:Subject:Date:From; b=i23Tqry0ApH/e8YW0sDkgIMarWU6Ukza08eJle6ffxasFuczH+DhamKzdDoRJULCm UJs6bRweV8uyHpqYwSFONiETa0UCoCpx1i9CpO3ccLfzyNn5eORSGAN89W4JDT/GHX MchtP1R8vAHOTDmFmzqITbs6zgPrf4Fbi0vvpRvd+R09zRGkqizmuJQ11O0nVlYDBI rgG/7TwdAm4tdK/Jq77VJ/hsFI/7QiAUTBf7WcD3NT8r/r0Ig9GO5q1mGAG9CfQ5o9 9Hjrwyu4aW8TEwffIkNq1GjqbtXjXG8cgqhLz3wXLd2lwVLoF0xkFvS3gHLs9Dk7Np /VAIV0htC6pvg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PgpkD4ySnz6tpV; Tue, 21 Mar 2023 12:08:20 +0100 (CET) In-Reply-To: (Lynn Winebarger's message of "Tue, 21 Mar 2023 06:55:19 -0400") Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304638 Archived-At: Lynn Winebarger writes: > On Tue, Mar 21, 2023 at 3:22=E2=80=AFAM Jean Louis wro= te: >> * Philip Kaludercic [2023-03-14 19:17]: >> > Jonas Bernoulli writes: >> > >> > >> Do you have a link to the package you are talking about? >> > > >> > > Ups, here you go: https://github.com/pekingduck/emacs-sqlite3-api >> > >> > Would you happen to know if there is some rx-like, s-expression based >> > language for constructing SQL queries. I am not looking for anything >> > generic, just a way to avoid writing long strings. >> >> While such packages exists, for me I do not find them usable as then I >> have to forget about the SQL and learn about the new Emacs Lisp >> structure that is to correspond to SQL. I see personally no benefit in >> that. > > There are a couple of good reasons to use an sexpr-based query language: > * Avoiding sql injection issues by putting all the boilerplate for > interpolating data into queries into a macro expander To be fair, this is not a concern because SQLite supports parameterised queries: (sqlite-execute db "insert into foo values (?, ?)" '("bar" 2)) > * Treating code as data and vice-versa is a powerful programming technique Not sure about this.... Strings are data too, but neither the SQL statements or the regular expressions are (Elisp) code. To me the advantage of something like `rx' is that I can insert comments and make use of regular indentation. Then again, it would also be possible to provide specialised SQLite wrappers (sqlite-insert, sqlite-update, ...) instead of taking a `rx' like approach to generating strings. > The real power of embedding sqlite in elisp will come when sqlite data > structures can be used as efficient representations of sets and > relations in lisp code. Eventually, I would also expect to see > mutually recursive code enabled, with "virtual table" modules for > emacs data structures so they can be transparently used in sql code, > along with sql functions written in lisp. For example, you might > create a table from lisp data using a select statement rather than > executing a large number of insert statements. In-memory databases > would not be unusual, and should be dumpable objects.=20=20 What is the point of using a in-memory database if you want to dump it? > At that point, > you could expect to see such objects frequently used, e.g. for tag > tables, user configuration, abstract interpretation of lisp code, etc.