* Bypassing the prompts in M-x sql-sqlite
@ 2022-10-29 13:38 Eduardo Ochs
0 siblings, 0 replies; only message in thread
From: Eduardo Ochs @ 2022-10-29 13:38 UTC (permalink / raw)
To: help-gnu-emacs
Hi all,
this is - or should be - a very basic question about sql.el...
Let me start by some context.
1. Some context
===============
A person who has never used SQL in her life, but who knows this,
http://angg.twu.net/eepitch.html
can have a very quick introduction to how to use sqlite - in a very
primitive way - by just running this, by typing <f8> on each line:
• (eepitch-shell)
• (eepitch-kill)
• (eepitch-shell)
rm -v /tmp/music.sqlitedb
sqlite3 /tmp/music.sqlitedb
create table albums (
artist text,
album text
);
.dump albums
insert into albums (artist, album) values("Hugo Largo", "Drum");
insert into albums (artist, album) values("Medicine","Her Highness");
insert into albums (artist, album) values("Pink Industry","Retrospective");
insert into albums (artist, album) values("David Bowie", "Low");
.dump albums
.quit
The next step is to show her how to use sql.el. This
M-x sql-sqlite RET /tmp/music.sqlitedb RET
creates a buffer called "*SQL: SQLite*" in sql-interactive-mode mode.
The comments at the top of sql.el say:
This file provides a sql-mode and a sql-interactive-mode. The
original goals were two simple modes providing syntactic
highlighting. The interactive mode had to provide a command-line
history; the other mode had to provide "send region/buffer to SQL
interpreter" functions. "simple" in this context means easy to
use, easy to maintain and little or no bells and whistles. This
has changed somewhat as experience with the mode has accumulated.
It should be possible to have both methods of sending commands to
"*SQL: SQLite*" available at the same time - eepitch-line and
sql-send-{paragraph,region}...
2. The question
===============
How do I write a sexp that does the same as
M-x sql-sqlite RET /tmp/music.sqlitedb RET
when the SQL buffer doesn't exist, and the same as M-x sql-sqlite RET
when the SQL buffer already exists? I am probably misreading the code
in sql.el and, ahem, mislooking some important things, because all my
attempts to write code that bypasses the prompts have failed...
Thanks in advance! =)
Eduardo Ochs
http://angg.twu.net/eepitch.html#other-targets
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-29 13:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-29 13:38 Bypassing the prompts in M-x sql-sqlite Eduardo Ochs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).