From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp12.migadu.com ([2001:41d0:403:4789::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms9.migadu.com with LMTPS
	id OJ5VLqqCzWT6AQAASxT56A
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sat, 05 Aug 2023 00:58:50 +0200
Received: from aspmx1.migadu.com ([2001:41d0:403:4789::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp12.migadu.com with LMTPS
	id YKpELqqCzWQgKgEAauVa8A
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sat, 05 Aug 2023 00:58:50 +0200
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id 1D9903E915
	for <larch@yhetil.org>; Sat,  5 Aug 2023 00:58:50 +0200 (CEST)
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=me.com header.s=1a1hai header.b=UDYHcaVd;
	spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org";
	dmarc=pass (policy=quarantine) header.from=me.com
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1691189930;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=TN6+U6mR6XvqSAWY+ZfMeuMzK6DaBo0fv9a+/yNG8UE=;
	b=OavVZBdtxncJbMPn/UBgfw5CQUmNIUDZRyGg3++qOffXvnFJmmVyOTOL5ElDoTC1MQ4/uR
	d+wwtjdn8Q5rIY8sVQ9RGvoMsuoyv6a4uqqMqsbJ5RajJZKzfxTzYrzAWB+y13nglN06MN
	jajebfXW6XMiBSCFrnF3OSxP8hGmAWQrJtEesENMUPSQgZxvToCNwpsg9zGGTtdWZnU8gw
	o/lsDslV+ELrPWN24vnyNply2RFAUaGASg61HEhNK5KxbHcThseG6QUsKgFif2MHr8fMj5
	yfg0BKgxaImO8ShD0mV5MQphECv/2In1hH0I/e4JjypliLOTkfpjWE+9cQs5ZA==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=me.com header.s=1a1hai header.b=UDYHcaVd;
	spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org";
	dmarc=pass (policy=quarantine) header.from=me.com
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1691189930; a=rsa-sha256; cv=none;
	b=DicGyl+FXc6b4wYTktSQr1gmcYGQOOpbTB9EWf7VqphF9o3iYVgQm8SKPpYfiaEtTX8IEd
	U4DETZSD3n4+ohJa3jwTW/seb6/DWJ4jePLPdgR9Nqol6H4nsV+El+VH9ounvanaHYb73O
	XOKkNps1V5EUhGKh4F9be1r+yhdMsM/I9mTAQ//oX/aW+2r9SYpj4P9JzpDEyX50mrNEXb
	gTxjCycF2pIJUJJ/Ae3+5iI+ITF8Ff4ERwFoMyVlrXbb283ShjSjDCsqhZTvgbGzOFPrGL
	sKnTmNA6nGD10WDtnbLADIcVjsTN4p+D2uZtuf5TiTWIuK1FvvJEGhlPwfBXGg==
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces@gnu.org>)
	id 1qS3kB-0001wb-O4; Fri, 04 Aug 2023 18:58:03 -0400
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 <salutis@me.com>) id 1qS3k8-0001uw-5M
 for emacs-orgmode@gnu.org; Fri, 04 Aug 2023 18:58:01 -0400
Received: from qs51p00im-qukt01080302.me.com ([17.57.155.21])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <salutis@me.com>) id 1qS3k5-0007TC-L2
 for emacs-orgmode@gnu.org; Fri, 04 Aug 2023 18:57:59 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai;
 t=1691189873; bh=TN6+U6mR6XvqSAWY+ZfMeuMzK6DaBo0fv9a+/yNG8UE=;
 h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type;
 b=UDYHcaVdDqwjFmVnYtOjIGGAiQjSkbsdpV8rB0zqToFdZ93FFaJF3QI0d6IpIZOp9
 a8aoLuADVH3fof0ATib/WLYrA/vLn5sBsVEmOqdVhEr/PX4XwdSBXFP5iGz0Rutjh+
 k0nei8E4ZmX3h8LhBwCh3BCVqNlzOB5ZJU/8QorCdgCF3Z9EyeFhH94NoR8lvDc4/7
 DiAhFgy4d8WcIY9k2UHLTQ0Oe7w+HlUbwAo0NAcx3tFS05dJ/mz/gStE3Ti0ea7N+D
 8ZXIN0YbiqQM82/s3/oFlG9cE/d3vNZmTu3vI0V7K8pOwn5gZhWAZ0e8Xfi11Q8CDM
 cA9CEjOco7ZNw==
Received: from Rudolfs-MacBook-Air.local (qs51p00im-dlb-asmtp-mailmevip.me.com
 [17.57.155.28])
 by qs51p00im-qukt01080302.me.com (Postfix) with ESMTPSA id C04E8114015D;
 Fri,  4 Aug 2023 22:57:52 +0000 (UTC)
From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= <salutis@me.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Max Nikulin <manikulin@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] ob-sqlite: Use a transient in-memory database by default
In-Reply-To: <87sf8zkz6a.fsf@localhost>
References: <20230503125903.95063-1-salutis@me.com>
 <u2ttkr$12t$1@ciao.gmane.io> <u2u2ag$mfm$1@ciao.gmane.io>
 <m2fs89i46t.fsf@me.com> <87a5x3wum8.fsf@localhost> <m2ilbjhbdt.fsf@me.com>
 <87ilbis8lx.fsf@localhost> <m2o7jofglx.fsf@me.com>
 <87sf8zkz6a.fsf@localhost>
Date: Sat, 05 Aug 2023 00:57:49 +0200
Message-ID: <m2y1iq8lg2.fsf@me.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Proofpoint-GUID: jYUEq0o9Xhm5YTByuH9b3kDsiGv-GPbt
X-Proofpoint-ORIG-GUID: jYUEq0o9Xhm5YTByuH9b3kDsiGv-GPbt
X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?=
 =?UTF-8?Q?2903e8d5c8f:6.0.138,18.0.790,17.11.62.513.0000000_definitions?=
 =?UTF-8?Q?=3D2022-01-12=5F02:2020-02-14=5F02,2022-01-12=5F02,2021-12-02?=
 =?UTF-8?Q?=5F01_signatures=3D0?=
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0
 spamscore=0 mlxscore=0
 bulkscore=0 clxscore=1015 adultscore=0 phishscore=0 mlxlogscore=863
 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.12.0-2212070000 definitions=main-2308040205
Received-SPF: pass client-ip=17.57.155.21; envelope-from=salutis@me.com;
 helo=qs51p00im-qukt01080302.me.com
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: emacs-orgmode@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
X-Migadu-Flow: FLOW_IN
X-Migadu-Country: US
X-Migadu-Queue-Id: 1D9903E915
X-Migadu-Scanner: mx1.migadu.com
X-Spam-Score: -6.66
X-Migadu-Spam-Score: -6.66
X-TUID: uhaj1BNNlohq

--=-=-=
Content-Type: text/plain

Ihor Radchenko <yantar92@posteo.net> writes:

> However, I think that it will provide more freedom to users if you alter
> org-babel-default-header-args:sqlite instead of hard-coding the default.
> May you update the patch accordingly?

Please see the attached patch.

> Also, can you update the docs at
> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sqlite.html
> ? The current docs declare :db header arg as mandatory.

Ditto, please see the second attached patch.

P.S. #1: This is my first contribution to the
WORG, and I am not sure if the patch is OK.
I do ever not plan to contribute to the WORG,
as I am not a fan of the idea and think that
all built-in backends (and more!) should be
documented in the Org manual.

P.S. #2: The Table of Contents (TOC) on the
WORG is "jumpy" on Safari.  In fact, it has
always been problematic for me, in one way or
another.  Why cannot TOC be included at the
beginning of the document, like in standard
Org exports?  Org and Emacs manuals, with no
"smart" side bars, get it right, IMO.

Rudy


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-ob-sqlite-Use-a-transient-in-memory-database-by-defa.patch

>From aac17ad21bf5fe85a57efd4183b80fdc5221d3aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
Date: Wed, 3 May 2023 14:59:03 +0200
Subject: [PATCH] ob-sqlite: Use a transient in-memory database by default

* etc/ORG-NEWS (New features): Add a news entry.
* lisp/ob-sqlite.el (org-babel-default-header-args:sqlite): Default
':db' to ":memory:".
* testing/lisp/test-ob-sqlite.el (ob-sqlite/in-file): Test the old behavior.
* testing/lisp/test-ob-sqlite.el (ob-sqlite/in-memory): Test the new behavior.
---
 etc/ORG-NEWS                   |  7 +++++++
 lisp/ob-sqlite.el              |  2 +-
 testing/lisp/test-ob-sqlite.el | 36 ++++++++++++++++++++++++++++++++--
 3 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 4f16eda24..40a4e79bd 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -489,6 +489,13 @@ Final hooks are added to the following commands:
 
 The prefix arguments are passed to ~org-insert-todo-heading~.
 
+*** Make ~ob-sqlite~ use in-database by default
+
+SQLite source blocks with no ~:db~ argument now execute against a
+transient in-memory database by default.  This makes Org match the
+default behavior of the ~sqlite3~ shell and makes SQLite blocks more
+practical out of the box.
+
 *** Add support for ~logind~ idle time in ~org-user-idle-seconds~
 
 When Emacs is built with =dbus= support and
diff --git a/lisp/ob-sqlite.el b/lisp/ob-sqlite.el
index 526b73ebd..75ef50913 100644
--- a/lisp/ob-sqlite.el
+++ b/lisp/ob-sqlite.el
@@ -39,7 +39,7 @@
 (declare-function orgtbl-to-csv "org-table" (table params))
 (declare-function org-table-to-lisp "org-table" (&optional txt))
 
-(defvar org-babel-default-header-args:sqlite '())
+(defvar org-babel-default-header-args:sqlite '((:db . ":memory:")))
 
 (defvar org-babel-header-args:sqlite
   '((db        . :any)
diff --git a/testing/lisp/test-ob-sqlite.el b/testing/lisp/test-ob-sqlite.el
index 72d75c9b7..621a11b0b 100644
--- a/testing/lisp/test-ob-sqlite.el
+++ b/testing/lisp/test-ob-sqlite.el
@@ -39,8 +39,40 @@
   .import $tb TestTable
   select * from TestTable;
 #+end_src"
-	    (org-babel-next-src-block)
-	    (org-babel-execute-src-block)))))
+	   (org-babel-next-src-block)
+	   (org-babel-execute-src-block)))))
+
+(ert-deftest ob-sqlite/in-memory ()
+  "Test in-memory temporariness."
+  (should
+   (equal 0
+          (progn
+            (org-test-with-temp-text
+	     "#+BEGIN_SRC sqlite
+PRAGMA user_version = 1;
+#+END_SRC"
+	     (org-babel-execute-src-block))
+            (org-test-with-temp-text
+	     "#+BEGIN_SRC sqlite
+PRAGMA user_version;
+#+END_SRC"
+	     (org-babel-execute-src-block))))))
+
+(ert-deftest ob-sqlite/in-file ()
+  "Test in-file permanency."
+  (should
+   (equal 1
+          (let ((file (org-babel-temp-file "test" ".sqlite")))
+            (org-test-with-temp-text
+	     (format "#+BEGIN_SRC sqlite :db %s
+PRAGMA user_version = 1;
+#+END_SRC" file)
+	     (org-babel-execute-src-block))
+            (org-test-with-temp-text
+	     (format "#+BEGIN_SRC sqlite :db %s
+PRAGMA user_version;
+#+END_SRC" file)
+	     (org-babel-execute-src-block))))))
 
 (provide 'test-ob-sqlite)
 ;;; test-ob-sqlite.el ends here
-- 
2.37.1 (Apple Git-137.1)


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Document-the-new-default-value-of-the-Babel-SQLite-d.patch

>From 2d756f51299131727a978da3bbdfbaaa3c67d36d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
Date: Sat, 5 Aug 2023 00:36:07 +0200
Subject: [PATCH] Document the new default value of the Babel/SQLite ':db'
 argument

---
 org-contrib/babel/languages/ob-doc-sqlite.org | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/org-contrib/babel/languages/ob-doc-sqlite.org b/org-contrib/babel/languages/ob-doc-sqlite.org
index d7febb0c..981eca34 100644
--- a/org-contrib/babel/languages/ob-doc-sqlite.org
+++ b/org-contrib/babel/languages/ob-doc-sqlite.org
@@ -91,7 +91,8 @@ There are no language-specific default header arguments for SQLite.
 There are 11 SQLite-specific header arguments.
 
  - db :: a string with the name of the file that holds the SQLite
-         database. Babel requires this header argument. 
+   database. Defaults to =":memory:"=, a special "file name" that
+   makes SQLite use a temporary in-memory database.
  - header :: if present, turn on headers in the output format. Headers
              are also output with the header argument =:colnames yes=.
  - echo :: if present, set the SQLite dot command =.echo= to =ON=.
-- 
2.37.1 (Apple Git-137.1)


--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

--=20
"We shall not cease from exploration
 And the end of all our exploring
 Will be to arrive where we started
 And know the place for the first time"
--- T. S. Eliot, Little Gidding, Four Quarters, 1943

Rudolf Adamkovi=C4=8D <salutis@me.com> [he/him]
Studenohorsk=C3=A1 25
84103 Bratislava
Slovakia

--=-=-=--