From: Danny Milosavljevic <dannym@scratchpost.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Cuirass news
Date: Sun, 28 Jan 2018 23:23:43 +0100 [thread overview]
Message-ID: <20180128232343.152cfe86@scratchpost.org> (raw)
In-Reply-To: <87fu6pzmdl.fsf@gnu.org>
Hi Ludo,
On Sun, 28 Jan 2018 22:47:34 +0100
ludo@gnu.org (Ludovic Courtès) wrote:
> I’ve already applied two commits in civodul/guile-sqlite3. I think the
> statement cache requires some more work though (see below).
Nice.
> > If that's OK I'll replace the reference in guix-master, or we could do a
> > pull request to the civodul repository.
>
> I think we should stick to a single repo for guile-sqlite3, though it
> prolly shouldn’t be called “civodul/”. Perhaps you can create
> guile-sqlite3/guile-sqlite3 and add the two of us plus Andy there for a
> start?
Hmm, should I create a new user account on notabug for that?
> The problem is that interned symbols are potentially not GC’d (though I
> think with Guile 2.2 and its weak sets they may be subject to GC.)
Too bad. If that's the case it's not as good as it could be.
> The other issue is that we’d still be caching potentially a lot more
> than needed. For instance, we don’t know whether a statement is a
> one-off statement (used only once, for instance because it’s derived
> from user parameters passed through the HTTP API or something),
Well, that shouldn't happen because it would allow SQL injection.
I usually write filters like (:parameter IS NULL OR (foo = :parameter))
so that the SQL text doesn't change.
On the other hand, if only the parameter values change it will reuse the
same statement.
> Thinking more about it, I’m inclined to not try to be smart and instead
> let users explicitly ask for caching when they want to.
Whatever else, I think it would be good to actually use prepared statements
for what they are for ;-)
That they prevent sql injection is a nice bonus but what they are supposed to
do is prevent the database engine from having to parse text and build a query
plan every time someone changes one bit somewhere.
So I'm still for "caching" those. I've left sqlite-exec inside guix-cuirass
rather than guile-sqlite3 so that the user of the guile-sqlite3 can decide
caching, among other things.
We could also have two macros, sqlite-exec-reuse and sqlite-exec
(right now it decides that implicitly by whether the SQL text is a string
literal or not - I think in practise that's what cuirass will always do).
The stuff that's in dannym guile-sqlite3 has no new effect if you don't use
sqlite-prepare* (note star) - so it should be quite conservative already.
sqlite-prepare* is written in a way that it always caches - I purposefully
left the two other cases with non-literal strings out. So you can't
sqlite-prepare* with a non-literal string.
And maybe also remove the arg bindings from in there.
Then the new API would be: sqlite-prepare for new prepared statements,
sqlite-prepare* for caching prepared statements.
next prev parent reply other threads:[~2018-01-28 22:23 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-24 22:12 Cuirass news Ludovic Courtès
2018-01-25 10:55 ` Mathieu Othacehe
2018-01-25 10:59 ` Mathieu Othacehe
2018-01-25 13:09 ` Ludovic Courtès
2018-01-26 14:30 ` Danny Milosavljevic
2018-01-27 16:01 ` Ludovic Courtès
2018-01-27 17:18 ` Danny Milosavljevic
2018-01-27 19:12 ` Danny Milosavljevic
2018-01-28 21:47 ` Ludovic Courtès
2018-01-28 22:23 ` Danny Milosavljevic [this message]
2018-01-29 9:57 ` Andy Wingo
2018-02-08 13:37 ` Ludovic Courtès
2018-02-08 16:29 ` Danny Milosavljevic
2018-02-08 22:21 ` Ludovic Courtès
2018-02-08 23:05 ` Danny Milosavljevic
2018-02-09 6:17 ` Gábor Boskovits
2018-02-09 9:41 ` Ludovic Courtès
2018-02-09 11:29 ` Danny Milosavljevic
2018-02-09 16:53 ` Ludovic Courtès
2018-02-09 17:06 ` Danny Milosavljevic
2018-02-10 11:18 ` Ludovic Courtès
2018-02-13 9:12 ` Danny Milosavljevic
2018-02-14 13:43 ` Ludovic Courtès
2018-02-14 23:17 ` Ludovic Courtès
2018-02-19 15:35 ` Danny Milosavljevic
2018-02-19 15:35 ` [PATCH] database: Simplify 'db-get-builds' Danny Milosavljevic
2018-02-19 17:52 ` [PATCH] database: db-get-builds: Inline output selection Danny Milosavljevic
2018-02-19 22:08 ` Cuirass news Danny Milosavljevic
2018-03-02 13:21 ` Ludovic Courtès
2018-03-02 22:06 ` Ludovic Courtès
2018-03-02 23:29 ` Danny Milosavljevic
2018-02-14 23:21 ` Ludovic Courtès
2018-01-25 21:06 ` Ricardo Wurmus
2018-01-26 11:12 ` Ludovic Courtès
2018-01-25 22:28 ` Danny Milosavljevic
2018-01-26 10:47 ` Ludovic Courtès
2018-01-28 12:33 ` Cuirass frontend Danny Milosavljevic
2018-01-29 17:42 ` Ludovic Courtès
2018-01-26 0:46 ` Cuirass news Danny Milosavljevic
2018-01-27 17:27 ` Danny Milosavljevic
2018-01-28 21:48 ` Ludovic Courtès
2018-01-26 17:55 ` Jan Nieuwenhuizen
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=20180128232343.152cfe86@scratchpost.org \
--to=dannym@scratchpost.org \
--cc=guix-devel@gnu.org \
--cc=ludo@gnu.org \
/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/guix.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.