Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on SQLite.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/sqlite.e>
#           or at <http://angg.twu.net/e/sqlite.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######





# «.attach»		(to "attach")
# «.cli»		(to "cli")
# «.comments»		(to "comments")
# «.comparison»		(to "comparison")
# «.create-index»	(to "create-index")
# «.create-function»	(to "create-function")
# «.create-table»	(to "create-table")
# «.copy-table»		(to "copy-table")
# «.date»		(to "date")
# «.dump»		(to "dump")
# «.index»		(to "index")
# «.in-memory»		(to "in-memory")
# «.insert»		(to "insert")
# «.join»		(to "join")
# «.rowid»		(to "rowid")
# «.select»		(to "select")
# «.separator»		(to "separator")
# «.sqlite_schema»	(to "sqlite_schema")
# «.string-functions»	(to "string-functions")
# «.transaction»	(to "transaction")
# «.union»		(to "union")
# «.update»		(to "update")
# «.values»		(to "values")
# «.view»		(to "view")
# «.with-recursive»	(to "with-recursive")
#
# «.lua»		(to "lua")
# «.lua-src»		(to "lua-src")
# «.lua-wiki»		(to "lua-wiki")
# «.lua-metatables»	(to "lua-metatables")
# «.lua-rows»		(to "lua-rows")
#
# «.lsqlite3»			(to "lsqlite3")
# «.sqlite-debs»		(to "sqlite-debs")
# «.sqlite3-deb-src»		(to "sqlite3-deb-src")
# «.pr.sqlitedb»		(to "pr.sqlitedb")
# «.music-2022»			(to "music-2022")
# «.bypass-prompt»		(to "bypass-prompt")
# «.litecli»			(to "litecli")
# «.music.db»			(to "music.db")
# «.sqlite-mode»		(to "sqlite-mode")
# «.sql-mode»			(to "sql-mode")
# «.python»			(to "python")
# «.elisp»			(to "elisp")
# «.surprisingly-slow»		(to "surprisingly-slow")
# «.surprisingly-slow-2»	(to "surprisingly-slow-2")
# «.elisp-benchmark»		(to "elisp-benchmark")



# (find-es "recutils")
# (find-es "sql" "sqlite")

apti sqlite sqlite-doc sqlite3 sqlite3-doc

# (find-status   "sqlite3")
# (find-vldifile "sqlite3.list")
# (find-udfile   "sqlite3/")
# (find-status   "sqlite3-doc")
# (find-vldifile "sqlite3-doc.list")
# (find-udfile   "sqlite3-doc/")

apti sqlite3-doc




#####
#
# attach
# 2024sep26
#
#####

# «attach»  (to ".attach")
# (find-sqlite3doc "lang_attach")
# (find-sqlite3doc "lang_naming")
# (find-sqlite3doc "schematab")
# (find-angg "LUA/SqlPdfs1.lua" "createall-tests" "sqlite-mode-open")
# (to "copy-table")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/
rm -fv a.db b.db

sqlite3 a.db
 create table tbl1 (c1, c2);
 insert into  tbl1 values (10, 20);
 insert into  tbl1 values (30, 40);
.databases
.dump
.exit

sqlite3 b.db
 attach database "a.db" as aa;
.databases
 select * from aa.tbl1;
 select * from    tbl1;
 create table tbl2 (c1, c2);
 insert into tbl2 SELECT * FROM tbl1;
.tables
.dump
.exit




#####
#
# cli
# 2024sep26
#
#####

# «cli»  (to ".cli")
# (find-man "1 sqlite3")
# (find-sqlite3doc "cli")




#####
#
# comments
# 2024sep26
#
#####

# «comments»  (to ".comments")
# (find-sqlite3doc "lang_comment")

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
/* hello
*/



#####
#
# comparison
# 2024sep30
#
#####

# «comparison»  (to ".comparison")
# https://www.techonthenet.com/sqlite/comparison_operators.php
# (find-sqlite3doc "lang_expr#operators")
# (find-sqlite3doc "lang_expr#cast_expressions")
# (find-sqlite3doc "datatype3#type_affinity")
# (find-sqlite3doc "datatype3#determination_of_column_affinity")
# (find-sqlite3doc "datatype3#affinity_of_expressions")

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
select 2=3;
select 4=4;
select "4"=4;
select "4"==4;
select cast("4" as integer)==4;
select 2<123;
select "2"<"123";
select cast(2 as text) < cast(123 as text);
select cast("2" as integer) < cast("123" as integer);



#####
#
# create-index
# 2024sep25
#
#####

# «create-index»  (to ".create-index")
# file:///usr/share/doc/sqlite3/lang_createindex.html
# (find-sqlite3doc "lang_createindex")



#####
#
# Defining New SQL Functions
# 2024oct21
#
#####

# «create-function»  (to ".create-function")
# (find-sqlite3doc "appfunc#defining_new_sql_functions")
# (find-lsqlite3wiki "db_create_function" "db:create_function")



#####
#
# CREATE TABLE
# 2024sep26
#
#####

# «create-table»  (to ".create-table")
# (find-sqlite3doc "lang_createtable")
# (find-sqlite3doc "lang_createtable#unique_constraints")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
ee_dofile "~/LUA/SqlPdfs1.lua"   -- (find-angg "LUA/SqlPdfs1.lua")
= dbkeys



#####
#
# copy-table
# 2024sep28
#
#####

# «copy-table»  (to ".copy-table")
# https://tableplus.com/blog/2018/07/sqlite-how-to-copy-table-to-another-database.html
# https://stackoverflow.com/questions/2359205/copying-data-from-one-sqlite-database-to-another



#####
#
# Dates
# 2024oct09
#
#####

# «date»  (to ".date")
# (find-sqlite3doc "lang_datefunc")
# (find-es "puro" "calendario-atual")
# (find-angg "SQLITE/calendar1.sql")
# (find-angg "LUA/SQLite1.lua" "dates_between")

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
select                date("now");
select      julianday(date("now"));
select      julianday(date("now"))+2;
select date(julianday(date("now"))+2);
select julianday("2024-09-23"), julianday("2024-02-06");

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
load_sqlite()
dates_between = function (d1,d2)
    local j1 = db:selectf("julianday(%q)", d1)
    local j2 = db:selectf("julianday(%q)", d2)
    local A = VTable {}
    for j=j1,j2 do table.insert(A, db:selectf("date(%q)", j)) end
    return A
  end

= dates_between("2024-09-23", "2024-10-01")


= db:selectf()


select date(julianday(date("now"))+2);
select julianday("2024-09-23"), julianday("2024-02-06");






#####
#
# .dump
# 2024sep07
#
#####

# «dump»  (to ".dump")
# (find-man "1 sqlite3")
# (find-man "1 sqlite3" ".dump")
# (find-sqlite3doc "cli")
# (find-sqlite3doc "cli#special_commands_to_sqlite3_dot_commands_")
# (find-sqlite3doc "cli#converting_an_entire_database_to_an_ascii_text_file")
# (find-angg "SQLITE/test1.sql")



#####
#
# index
# 2024oct09
#
#####

# «index»  (to ".index")
# (find-sqlite3doc "lang_indexedby")
# (find-sqlite3doc "lang_createtable#the_create_table_command")
# (find-sqlite3doc "lang_createtable#unique_constraints")




#####
#
# In-memory databases
# 2024sep26
#
#####

# «in-memory»  (to ".in-memory")
# (find-sqlite3doc "inmemorydb")
# (find-efunction 'eepitch-sqlite3)

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
CREATE TABLE tbl1 (col1, col2);
insert into tbl1 values ('hello!',  10);
insert into tbl1 values ('goodbye', 20);
.mode columns
.headers on
select * from tbl1;
.help
.databases
.dump tbl1
.exit


* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
.databases

-- ATTACH DATABASE ':memory:' AS aux1;
ATTACH DATABASE '/tmp/disk1.db' AS disk1;



#####
#
# insert
# 2024sep27
#
#####

# «insert»  (to ".insert")
# (find-sqlite3doc "lang_insert")
# (find-sqlite3doc "lang_insert" "INSERT INTO table SELECT ...;")





#####
#
# join
# 2024sep27
#
#####

# «join»  (to ".join")
# https://www.sqlitetutorial.net/sqlite-join/
# (find-sqlite3doc "lang_select#simple_select_processing")
# (find-sqlite3doc "syntax/table-or-subquery")
# (find-sqlite3doc "syntax/join-clause")
# (find-sqlite3doc "syntax/join-operator")
# (find-sqlite3doc "syntax/join-constraint")
# (find-sqlite3doc "syntax/join-clause")

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
/*
   25 35 ->  4 5
   26 36 ->    6
    | |      | |
    v v      v v
    1   -> 7 8
    2 3 ->     9
*/
CREATE TABLE tbl_ac (a, c);
CREATE TABLE tbl_bc (b, c);
insert into tbl_ac values (1, 7);
insert into tbl_ac values (2, 9);
insert into tbl_ac values (3, 9);
insert into tbl_bc values (4, 8);
insert into tbl_bc values (5, 9);
insert into tbl_bc values (6, 9);
.dump

SELECT a,tbl_ac.c,b FROM tbl_ac      INNER JOIN tbl_bc ON tbl_ac.c = tbl_bc.c;
SELECT a,tbl_ac.c,b FROM tbl_ac            JOIN tbl_bc ON tbl_ac.c = tbl_bc.c;
SELECT a,tbl_ac.c,b FROM tbl_ac            JOIN tbl_bc USING (c);
SELECT a,tbl_ac.c,b FROM tbl_ac LEFT       JOIN tbl_bc USING (c);
SELECT a,tbl_ac.c,b FROM tbl_ac LEFT OUTER JOIN tbl_bc USING (c);
SELECT a,tbl_ac.c,b FROM tbl_ac      CROSS JOIN tbl_bc ;
SELECT *            FROM tbl_ac      CROSS JOIN tbl_bc ;





#####
#
# rowid
# 2024sep27
#
#####

# «rowid»  (to ".rowid")
# (find-sqlite3doc "withoutrowid")
# (find-sqlite3doc "lang_createtable#the_primary_key")
# (find-sqlite3doc "lang_createtable#rowid")

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
create table tbl1(one varchar(10), two smallint);
insert into tbl1 values('hello!',10);
insert into tbl1 values('goodbye', 20);



#####
#
# select and .separator
# 2024sep27
#
#####

# «select»     (to ".select")
# «separator»  (to ".separator")
# (find-sqlite3doc "lang_select")
# (find-sqlite3doc "cli#changing_output_formats")
# (find-sqlite3doc "lang_select#limitoffset")

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
create table tbl1(one varchar(10), two smallint);
insert into tbl1 values('hello!',  10);
insert into tbl1 values('goodbye', 20);
select * from tbl1;
.separator "  " \n
select * from tbl1;
select two,one from tbl1;
select two*10 from tbl1;



#####
#
# sqlite_schema
# 2024sep30
#
#####

# «sqlite_schema»  (to ".sqlite_schema")
# (find-sqlite3doc "cli#querying_the_database_schema")

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
create table tbl1(col1,col2);
.tables
.mode columns
select * from sqlite_schema;
.help tables




#####
#
# string-functions
# 2024sep30
#
#####

# «string-functions»  (to ".string-functions")
# https://www.sqlitetutorial.net/sqlite-string-functions/
# (find-sqlite3doc "lang_corefunc#substr")

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
select substr("abcdef", 2, 3);  -- "bcd"
select substr("abcdef", 2);     -- "bcdef"
select 2+5;
select "ab"||"cd";
select 12||34;



#####
#
# transaction
# 2024sep30
#
#####

# «transaction»  (to ".transaction")
# (find-sqlite3doc "transactional")
# (find-sqlite3doc "lang_transaction")
# https://mail.google.com/mail/u/0/#inbox/QgrcJHsHsHzwbJjZshlhWCBhtVtQpfNhRNV Basile



#####
#
# union
# 2024oct10
#
#####

# «union»  (to ".union")
# (find-sqlite3doc "unionvtab")
# (to "with-recursive")



#####
#
# update
# 2024sep27
#
#####

# «update»  (to ".update")
# (find-sqlite3doc "lang_update")
# https://stackoverflow.com/questions/6776657/how-to-change-a-value-in-a-column-on-a-sqlite-database



#####
#
# values
# 2024oct09
#
#####

# «values»  (to ".values")
# (find-sqlite3doc "lang_select#the_values_clause")


#####
#
# view
# 2024sep30
#
#####

# «view»  (to ".view")
# (find-sqlite3doc "lang_createview")



#####
#
# with-recursive
# 2024oct09
#
#####

# «with-recursive»  (to ".with-recursive")
# (find-fline "~/LOGS/2024oct11.emacs" "WITH RECURSIVE cnt(x)")
# (find-fline "~/LOGS/2024oct11.emacs" "INSERT INTO tbl SELECT x FROM cnt")
# (to "union")

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
WITH RECURSIVE cnt(x) AS
  (VALUES(1)
   UNION ALL
   SELECT x+1 FROM cnt WHERE x<10)
SELECT x FROM cnt;

CREATE TABLE tbl1(n);
WITH RECURSIVE cnt(x) AS
  (VALUES(1)
   UNION ALL
   SELECT x+1 FROM cnt WHERE x<10)
INSERT INTO tbl1 SELECT x FROM cnt;
.dump

# (find-sqlite3doc "lang_select")
# (find-sqlite3doc "lang_with")
# (find-sqlite3doc "lang_with#recursive_common_table_expressions")
# (find-sqlite3doc "lang_with#recursive_query_examples")
# (find-sqlite3doc "syntax/common-table-expression")
# (find-sqlite3doc "syntax/compound-operator")
# (find-sqlite3doc "syntax/cte-table-name")
# (find-sqlite3doc "syntax/result-column")
# (find-sqlite3doc "syntax/select-core")
# (find-sqlite3doc "syntax/table-or-subquery")
# (find-sqlite3doc "syntax/with-clause")

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<10) SELECT x FROM cnt;
/*             \-/ -                \-------/        \-/      \-/       \--/        \-/     \-/
               t-n cn               cmpnd-op         r-c      tos       expr        r-c     tos
               \----/                         \----------------------------/  \---------------/
               c-t-n                          select-core                     select-core
                          \------------------------------------------------/
                          select-stmt
               \------------------------------------------------------------/
               common-table-expression
\---------------------------------------------------------------------------/
with-clause
\---------------------------------------------------------------------------------------------/
select-stmt
*/

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
WITH RECURSIVE
  cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<10)
SELECT x FROM cnt;

* (eepitch-sqlite3)
* (eepitch-kill)
* (eepitch-sqlite3)
WITH RECURSIVE numbers(i) AS (
  SELECT 20  -- Start at 20
  UNION ALL
  SELECT i + 1 FROM numbers WHERE i < 30  -- Increment until 30
)
SELECT i FROM numbers;





#####
#
# lua
# 2024oct20
#
#####

# «lua»  (to ".lua")
# (to "lsqlite3")
# (find-angg "LUA/SqlPdfs1.lua")
# (find-angg "LUA/LSQLite1.lua")



#####
#
# Downloading the source for lsqlite3 (and its wiki)
# 2024oct22
#
#####

# «lua-src»  (to ".lua-src")
# (to "lua-wiki")

# (find-es "lua5" "lqslite3-src")
# (find-luarocks-links "sqlite")
# (find-luarocks-links "lsqlite3")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "/tmp/luarocks/")
rm -Rfv /tmp/luarocks/
mkdir   /tmp/luarocks/
cd      /tmp/luarocks/
luarocks download lsqlite3
ls -lAF
# (find-fline "/tmp/luarocks/lsqlite3-0.9.6-1.rockspec")
wget http://lua.sqlite.org/index.cgi/zip/lsqlite3_v096.zip

rm -Rfv           ~/usrc/lsqlite3_v096/
unzip -d ~/usrc/ /tmp/luarocks/lsqlite3_v096.zip
cd                ~/usrc/lsqlite3_v096/
wget -P           ~/usrc/lsqlite3_v096/ \
    -nc http://lua.sqlite.org/index.cgi/doc/tip/doc/lsqlite3.wiki
mv                                     lsqlite3.wiki \
                                       lsqlite3.wiki.html
# file:///home/edrx/usrc/lsqlite3_v096/lsqlite3.wiki.html

# (find-angg ".emacs" "find-lsqlite3wiki")
# (find-lsqlite3wiki "stmt_nrows")





#####
#
# lua-metatables
# 2024oct20
#
#####

# «lua-metatables»  (to ".lua-metatables")
# (find-angg "LUA/LSQLite1.lua" "lsqlite3-tables")
# (find-lsqlite3file "lsqlite3.c" "attempt to change readonly table")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
load_sqlite()
= sqlite3_db_methods
= sqlite3_db_sortedkeys()


-- (find-lsqlite3wiki "sqlite3_functions" "SQLite3 functions")
-- (find-lsqlite3file "lsqlite3.c" "luaL_Reg sqlitelib[] =")
= VTable(sortedkeys(sqlite3))

-- (find-lsqlite3wiki "database_methods" "Database methods")
-- (find-lsqlite3file "lsqlite3.c" "luaL_Reg dblib[] =")
  db = sqlite3.open_memory()
= db
= VTable(sortedkeys(getmetatable(db)))

-- (find-lsqlite3wiki "methods_for_prepared_statements" "Methods for prepared statements")
-- (find-lsqlite3file "lsqlite3.c" "luaL_Reg vmlib[] =")
  dbprep = db:prepare("SELECT 2+3;")
= dbprep
= VTable(sortedkeys(getmetatable(dbprep)))

  sqlite3.__sortedkeys = function () return VTable(sortedkeys(sqlite3)) end
= sqlite3.__sortedkeys()




#####
#
# db:rows, db:nrows and db:urows
# 2024oct20
#
#####

# «lua-rows»  (to ".lua-rows")
# (find-angg "LUA/LSQLite1.lua")
# (find-lsqlite3wiki "db_exec"  "db:exec")
# (find-lsqlite3wiki "db_rows"  "db:rows"  "list:     each row as {v1,v2}")
# (find-lsqlite3wiki "db_nrows" "db:nrows" "named:    each row as {name1=v1,name2=v2})
# (find-lsqlite3wiki "db_urows" "db:urows" "unpacked: each row as v1,v2")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
load_sqlite()
= db:exec [=[
  CREATE TABLE numbers(num1,num2);
  INSERT INTO numbers VALUES(10,11);
  INSERT INTO numbers VALUES(20,22);
]=]
for L   in db:rows ('SELECT * FROM numbers') do PP(L) end
for T   in db:nrows('SELECT * FROM numbers') do PP(T) end
for a,b in db:urows('SELECT * FROM numbers') do PP(a,b) end
for a,b in db:urows('SELECT date("now"),julianday(date("now"))') do PP(a,b) end

= dbkeys


a

select                date("now");
select      julianday(date("now"));




#####
#
# lua-wiki
# 2024oct20
#
#####

# «lua-wiki»  (to ".lua-wiki")
# (find-angg ".emacs" "find-lsqlite3wiki")
# (to "lua-src")

(find-lsqlite3wiki "__index__" "")
(find-lsqlite3wiki "name" "NAME")
(find-lsqlite3wiki "overview" "OVERVIEW")
(find-lsqlite3wiki "download" "DOWNLOAD")
(find-lsqlite3wiki "installation" "INSTALLATION")
(find-lsqlite3wiki "examples" "EXAMPLES")
(find-lsqlite3wiki "verification_tests" "VERIFICATION TESTS")
(find-lsqlite3wiki "reference" "REFERENCE")
(find-lsqlite3wiki "sqlite3_functions" "SQLite3 functions")
(find-lsqlite3wiki "sqlite3_complete" "sqlite3.complete")
(find-lsqlite3wiki "sqlite3_open" "sqlite3.open")
(find-lsqlite3wiki "sqlite3_open_memory" "sqlite3.open_memory")
(find-lsqlite3wiki "sqlite3_open_ptr" "sqlite3.open_ptr")
(find-lsqlite3wiki "sqlite3_backup_init" "sqlite3.backup_init")
(find-lsqlite3wiki "sqlite3_temp_directory" "sqlite3.temp_directory")
(find-lsqlite3wiki "sqlite3_version" "sqlite3.version")
(find-lsqlite3wiki "sqlite3_lversion" "sqlite3.lversion")
(find-lsqlite3wiki "database_methods" "Database methods")
(find-lsqlite3wiki "db_busy_handler" "db:busy_handler")
(find-lsqlite3wiki "db_busy_timeout" "db:busy_timeout")
(find-lsqlite3wiki "db_changes" "db:changes")
(find-lsqlite3wiki "db_close" "db:close")
(find-lsqlite3wiki "db_close_vm" "db:close_vm")
(find-lsqlite3wiki "db_get_ptr" "db:get_ptr")
(find-lsqlite3wiki "db_commit_hook" "db:commit_hook")
(find-lsqlite3wiki "db_create_aggregate" "db:create_aggregate")
(find-lsqlite3wiki "db_create_collation" "db:create_collation")
(find-lsqlite3wiki "db_create_function" "db:create_function")
(find-lsqlite3wiki "db_load_extension" "db:load_extension")
(find-lsqlite3wiki "db_errcode" "db:errcode")
(find-lsqlite3wiki "db_errmsg" "db:errmsg")
(find-lsqlite3wiki "db_exec" "db:exec")
(find-lsqlite3wiki "db_interrupt" "db:interrupt")
(find-lsqlite3wiki "db_db_filename" "db:db_filename")
(find-lsqlite3wiki "db_isopen" "db:isopen")
(find-lsqlite3wiki "db_last_insert_rowid" "db:last_insert_rowid")
(find-lsqlite3wiki "db_nrows" "db:nrows")
(find-lsqlite3wiki "db_prepare" "db:prepare")
(find-lsqlite3wiki "db_progress_handler" "db:progress_handler")
(find-lsqlite3wiki "db_rollback_hook" "db:rollback_hook")
(find-lsqlite3wiki "db_rows" "db:rows")
(find-lsqlite3wiki "db_total_changes" "db:total_changes")
(find-lsqlite3wiki "db_trace" "db:trace")
(find-lsqlite3wiki "db_update_hook" "db:update_hook")
(find-lsqlite3wiki "db_urows" "db:urows")
(find-lsqlite3wiki "methods_for_prepared_statements" "Methods for prepared statements")
(find-lsqlite3wiki "stmt_bind" "stmt:bind")
(find-lsqlite3wiki "stmt_bind_blob" "stmt:bind_blob")
(find-lsqlite3wiki "stmt_bind_names" "stmt:bind_names")
(find-lsqlite3wiki "stmt_bind_parameter_count" "stmt:bind_parameter_count")
(find-lsqlite3wiki "stmt_bind_parameter_name" "stmt:bind_parameter_name")
(find-lsqlite3wiki "stmt_bind_values" "stmt:bind_values")
(find-lsqlite3wiki "stmt_columns" "stmt:columns")
(find-lsqlite3wiki "stmt_finalize" "stmt:finalize")
(find-lsqlite3wiki "stmt_get_name" "stmt:get_name")
(find-lsqlite3wiki "stmt_get_named_types" "stmt:get_named_types")
(find-lsqlite3wiki "stmt_get_named_values" "stmt:get_named_values")
(find-lsqlite3wiki "stmt_get_names" "stmt:get_names")
(find-lsqlite3wiki "stmt_get_type" "stmt:get_type")
(find-lsqlite3wiki "stmt_get_types" "stmt:get_types")
(find-lsqlite3wiki "stmt_get_unames" "stmt:get_unames")
(find-lsqlite3wiki "stmt_get_utypes" "stmt:get_utypes")
(find-lsqlite3wiki "stmt_get_uvalues" "stmt:get_uvalues")
(find-lsqlite3wiki "stmt_get_value" "stmt:get_value")
(find-lsqlite3wiki "stmt_get_values" "stmt:get_values")
(find-lsqlite3wiki "stmt_isopen" "stmt:isopen")
(find-lsqlite3wiki "stmt_nrows" "stmt:nrows")
(find-lsqlite3wiki "stmt_reset" "stmt:reset")
(find-lsqlite3wiki "stmt_rows" "stmt:rows")
(find-lsqlite3wiki "stmt_step" "stmt:step")
(find-lsqlite3wiki "stmt_urows" "stmt:urows")
(find-lsqlite3wiki "stmt_last_insert_rowid" "stmt:last_insert_rowid")
(find-lsqlite3wiki "methods_for_callback_contexts" "Methods for callback contexts")
(find-lsqlite3wiki "context_aggregate_count" "context:aggregate_count")
(find-lsqlite3wiki "context_get_aggregate_data" "context:get_aggregate_data")
(find-lsqlite3wiki "context_set_aggregate_data" "context:set_aggregate_data")
(find-lsqlite3wiki "context_result" "context:result")
(find-lsqlite3wiki "context_result_null" "context:result_null")
(find-lsqlite3wiki "context_result_number" "context:result_number")
(find-lsqlite3wiki "context_result_int" "context:result_int")
(find-lsqlite3wiki "context_result_text" "context:result_text")
(find-lsqlite3wiki "context_result_blob" "context:result_blob")
(find-lsqlite3wiki "context_result_error" "context:result_error")
(find-lsqlite3wiki "context_user_data" "context:user_data")
(find-lsqlite3wiki "methods_for_online_backup" "Methods for Online Backup")
(find-lsqlite3wiki "bu_step" "backup:step")
(find-lsqlite3wiki "bu_remaining" "backup:remaining")
(find-lsqlite3wiki "bu_pagecount" "backup:pagecount")
(find-lsqlite3wiki "bu_finish" "backup:finish")
(find-lsqlite3wiki "numerical_error_and_result_codes" "Numerical error and result codes")
(find-lsqlite3wiki "version" "VERSION")
(find-lsqlite3wiki "credits" "CREDITS")
(find-lsqlite3wiki "license" "LICENSE")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
bigstr = ee_readfile "~/usrc/lsqlite3_v096/lsqlite3.wiki.html"
pat = '<a name="(.-)">(.-)</a>'
for a,b in bigstr:gmatch(pat) do
  print(format('(find-lsqlite3wiki "%s" "%s")', a,b))
end
-- = bigstr
-- for a,b in bigstr:gmatch(pat) do print(a,b) end








#####
#
# Sqlite3 ".deb"s
# 2024sep07
#
#####

# «sqlite-debs»  (to ".sqlite-debs")
# (find-zsh "installeddebs | sort | grep sqlite")
# (find-zsh "availabledebs | sort | grep sqlite")
# (find-status   "sqlite3")
# (find-vldifile "sqlite3.list")
# (find-udfile   "sqlite3/")
# (find-status   "sqlite3-doc")
# (find-vldifile "sqlite3-doc.list")
# (find-udfile   "sqlite3-doc/")
# (find-status   "libsqlite3-0")
# (find-vldifile "libsqlite3-0:amd64.list")
# (find-udfile   "libsqlite3-0/")
# (find-status   "libsqlite3-tcl")
# (find-vldifile "libsqlite3-tcl.list")
# (find-udfile   "libsqlite3-tcl/")
# (code-c-d "sqlitedoc" "/usr/share/doc/sqlite3/")
# (find-sqlitedocfile "")
# (find-sqlite3doc "index")
# (find-sqlite3doc "lang")
# (find-sqlite3doc "lang_insert")
# (find-sqlitedocsh "cat *.html")
# (find-sqlitedocsh "cat *.html | unhtml")

# A simple test:
# (find-man "1 sqlite3")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
sqlite3 /tmp/ex1.db
create table tbl1 (one varchar(10), two smallint);
insert into tbl1 values ('hello!',  10);
insert into tbl1 values ('goodbye', 20);
.mode columns
.headers on
select * from tbl1;
.help
.databases
.dump tbl1
.exit

# (find-sh "sqlite3 /tmp/ex1 .dump")

# (find-fline "/tmp/")
# (find-fline "/tmp/ex1")




#####
#
# sqlite3-deb-src
# 2024sep26
#
#####

# «sqlite3-deb-src»  (to ".sqlite3-deb-src")
# (find-apt-get-source-links "sqlite3")
# (code-c-d "sqlite3src" "/tmp/d/sqlite3-3.34.1/")
# (find-sqlite3srcfile "")
# (find-sqlite3srcsh "find * | sort")





#####
#
# notes on converting the "pr" text database to sqlite
# 2007dec27
#
#####

# «pr.sqlitedb»  (to ".pr.sqlitedb")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -v   /tmp/pr.sqlitedb
sqlite3 /tmp/pr.sqlitedb
create table tbl1 (
  title text,
  state text,
  responsible text,
  class text,
  release text,
  arrivaldate text
);

insert into tbl1 (title, state, responsible, class, release, arrivaldate)
  values (
    'aplicar filtro para melhorar visualizacao da velocidade dos servos',
    'open',
    'andre.
luiz@',
    'feature-request',
    'ihmtelm-0-9',
    '2007dez21'
  );

.dump tbl1





#####
#
# music-2022
# 2022oct09
#
#####

# «music-2022»  (to ".music-2022")

* (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



#####
#
# bypass-prompt
# 2022oct29
#
#####

# «bypass-prompt»  (to ".bypass-prompt")
# https://lists.gnu.org/archive/html/help-gnu-emacs/2022-10/msg00807.html
# (find-efunctiondescr 'sql-sqlite)
# (find-efunction      'sql-sqlite)
# Bypassing the prompts in M-x sql-sqlite

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




#####
#
# litecli
# 2023jan27
#
#####

# «litecli»  (to ".litecli")
# https://github.com/dbcli/litecli
# https://litecli.com/
# (find-fline "~/LOGS/2023jan27.emacs" "<grym> i usually use litecli")
# (find-git-links "https://github.com/dbcli/litecli" "litecli")
# (code-c-d "litecli" "~/usrc/litecli/")
# (find-liteclifile "")
# (find-pip3-links "litecli")




#####
#
# music.db
# 2024sep08
#
#####

# «music.db»  (to ".music.db")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -v   /tmp/music.db
sqlite3 /tmp/music.db
 create table albums (
   stars  real,
   artist text,
   album  text
   );
.dump albums
 insert into albums(stars, artist, album) values(20, "The Stooges", "Funhouse");
 insert into albums(stars, artist, album) values(16, "Medicine","Her Highness");
 insert into albums(stars, artist, album) values(16, "David Bowie", "Low");
.dump albums
.quit



(defun eepitch-music ()
  "Like `eepitch-shell', but runs \"sqlite3 /tmp/music.db\"."
  (interactive)
  (eepitch-comint "sqlite: music" "sqlite3 /tmp/music.db"))

(defun find-musicsql (sqlstatements &rest rest)
  "Like `find-sh', but runs \"sqlite3 /tmp/music.db SQLSTATEMENTS\"."
  (apply 'find-callprocess `("sqlite3" "/tmp/music.db" ,sqlstatements) rest))


* (eepitch-music)
* (eepitch-kill)
* (eepitch-music)
.dump
-- (find-musicsql ".dump")
-- (find-musicsql ".dump" "Bowie")


# file:///usr/share/doc/sqlite-doc/quickstart.html
# (find-es "tcl" "prompts")
# (find-man "3tcl package")
# (find-man "3tcl package" "DESCRIPTION")
# (find-man "3tcl package" "DESCRIPTION" "package require ?-exact? package")
# (find-fline "/usr/lib/sqlite3/pkgIndex.tcl")

* (eepitch-tcl)
* (eepitch-kill)
* (eepitch-tcl)
set tcl_prompt2 {puts -nonewline "> "}
package names
foreach n [lsort [package names]] {puts $n}
package require sqlite3
sqlite3
sqlite3 musicdb
sqlite3 musicdb /tmp/music.db
musicdb help
proc ins {stars artist album} {
  musicdb eval "insert into albums(stars, artist, album) values($stars, \"$artist\", \"$album\");"
}
ins 20 "The Stooges"            "Funhouse"
ins 16 "Medicine"               "Her Highness"
ins 16 "David Bowie"            "Low"
ins 12 "The Jesus & Mary Chain" "Psychocandy"
ins 12 "Secos & Molhados"       "Secos & Molhados (1973)"
ins  9 "Bauhaus"                "In the Flat Field (vynil)"
ins  9 "Dinosaur Jr."           "Just Like Heaven EP (vynil)"
ins  9 "Patti Smith"            "Horses"
ins  8 "Neil Young"             "Rock in Rio 2001 (bootleg)"
ins  8 "Velvet Underground"     "White Light/White Heat"
ins  7 "Young Marble Giants"    "Colossal Youth"
ins  7 "Hugo Largo"             "Drum"
ins  6 "Linton Kwesi Johnson"   "Dread Beat & Blood"
ins  6 "Rolling Stones"         "Sticky Fingers"

# (find-musicsql ".dump")
# (find-musicsql ".dump" "Bowie")




#####
#
# lsqlite3
# 2024sep08
#
#####

# «lsqlite3»  (to ".lsqlite3")
# (to "lua")
# (find-es "lua5" "lqslite3-src")
# (find-luarocks-links)
# (find-luarocks-links "sqlite")
# (find-luarocks-links "lsqlite3")
# (code-c-d "lsqlite3" "~/.luarocks/lib/luarocks/rocks/lsqlite3/0.9.6-1/")
# (find-lsqlite3file "")
# (find-lsqlite3file "examples/")
# (find-lsqlite3file "examples/aggregate.lua")
# (find-lsqlite3file "examples/smart.lua" "INSERT INTO test VALUES (:key, :value)")
# (find-sh "find ~/.luarocks/ ~/.cache/luarocks/ | sort")
# (find-sh "find ~/.luarocks/ ~/.cache/luarocks/ | sort" ".luarocks/lib/lua/5.1/lsqlite3.so")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
-- (find-angg "LUA/Path.lua")
Path.prependtocpath "~/.luarocks/lib/lua/5.1/?.so"
sqlite3 = require("lsqlite3")
db = sqlite3.open_memory()
PP(db)
= VTable(sortedkeys(getmetatable(db)))

= db:exec "CREATE TABLE test (col1, col2)"

assert( db:exec "CREATE TABLE test (col1, col2)" )
assert( db:exec "INSERT INTO test VALUES (1, 2)" )
assert( db:exec "INSERT INTO test VALUES (2, 4)" )
assert( db:exec "INSERT INTO test VALUES (3, 6)" )
assert( db:exec "INSERT INTO test VALUES (4, 8)" )
assert( db:exec "INSERT INTO test VALUES (5, 10)" )

square_error_sum = 0

step = function (ctx, a, b)
    local error        = a - b
    local square_error = error * error
    square_error_sum   = square_error_sum + square_error
  end

final = function (ctx)
    ctx:result_number( square_error_sum / ctx:aggregate_count() )
  end

assert( db:create_aggregate("my_stats", 2, step, final) )

for a,b in db:urows("SELECT col1, col2 FROM test") do
  print("a b: ", a, b)
end

for my_stats in db:urows("SELECT my_stats(col1, col2) FROM test") do
  print("my_stats:", my_stats)
end




#####
#
# sqlite-mode
# 2024aug27
#
#####

# «sqlite-mode»  (to ".sqlite-mode")
# https://xenodium.com/emacs-29s-sqlite-mode/
# https://christiantietze.de/posts/2024/01/emacs-sqlite-mode-open-sqlite-files-automatically/
# https://www.reddit.com/r/emacs/comments/rlwipm/emacs_team_considering_including_sqlite/
# (find-efile "sqlite-mode.el")
# (find-efile "sqlite-mode.el" "pragma table_info(%s)")



#####
#
# sql-mode
# 2024oct02
#
#####

# «sql-mode»  (to ".sql-mode")
# (find-ekeymapdescr sql-mode-menu)
# (find-ekeymapdescr sql-mode-menu "sql-highlight-sqlite-keywords")
# (find-efunctionpp 'sql-highlight-sqlite-keywords)
# (find-hfunction   'sql-highlight-sqlite-keywords)
# (find-efunction 'sql-set-product)
# (find-hfunction 'sql-set-product)
# (find-efile "progmodes/sql.el" "(sql-set-product (or sql-product 'ansi))")

(sql-set-product 'sql-product)
(sql-set-product 'sql-product)

# (find-hfunction 'menu-bar-keymap)
# (find-efunction 'menu-bar-keymap)
# (find-ekeymapdescr (menu-bar-keymap))

# (find-ekeymapdescr (menu-bar-current-active-maps))

# (find-fline "~/SQLITE/tudos1.sql")




#####
#
# The Python API
# 2024sep07
#
#####

# «python»  (to ".python")
# (find-es "llms" "sqlite-to-python")
# (find-pydoc "library/sqlite3")
# (find-pydoc "library/sqlite3#sqlite3.connect")
# (find-pydoc "library/sqlite3#sqlite3.Connection")
# (find-pydoc "library/sqlite3#sqlite3.Connection.cursor")
# (find-pydoc "library/sqlite3#sqlite3.Connection.commit")
# (find-pydoc "library/sqlite3#sqlite3.Connection.iterdump")
# (find-pydoc "library/sqlite3#sqlite3.Connection.close")
# (find-pydoc "library/sqlite3#sqlite3.Cursor")
# (find-pydoc "library/sqlite3#sqlite3.Cursor.execute")
# (find-pydoc "library/sqlite3#sqlite3.Cursor.fetchall")





#####
#
# elisp
# 2024sep07
#
#####

# «elisp»  (to ".elisp")
# (find-elnode "Database")
# (find-es "llms" "sqlite-to-elisp")




#####
#
# surprisingly-slow
# 2024sep29
#
#####

# «surprisingly-slow»  (to ".surprisingly-slow")
# (find-es "emacs" "benchmark")
# https://lists.gnu.org/archive/html/help-gnu-emacs/2024-09/msg00228.html
# https://mail.google.com/mail/u/0/#sent/QgrcJHsHsHzwbJjZshlhWCBhtVtQpfNhRNV

Hi list,

I am trying to learn how to use SQLite from Emacs, but it is much
slower than I expected... my laptop is very old - it is a refurbished
Thinkpad T400, that is from 2008 in some sense - but my first "real"
program using SQLite took more than one minute to insert 300 rows, so
I obviously did something wrong in it...

Below is a self-contained miniature. Its sexps are intended to be
executed with the reader's favorite variant of C-e C-x C-e, and
executing the "diskcmds" _usually_ takes more than one second here.

What am I missing? Do I need to tell SQLite to change some flags?
Which ones? Pointers, please?

I am on Debian Oldstable ("Bookworm") and I tested the code below with
both emacs29 and emacs31, both compiled from the git repository some
weeks ago.

  Thanks in advance =(,
    Eduardo Ochs
    http://anggtwu.net/#eev
    http://anggtwu.net/eepitch.html

;; (ee-copy-rest-3m nil ";;-- end" "/tmp/s.el")

(require 'benchmark)
(require 'sqlite)
(require 'sqlite-mode)

(setq memcmds
  '((setq db (sqlite-open))
    (sqlite-execute db "CREATE  TABLE tbl1 (col1, col2);")
    (sqlite-execute db "INSERT   INTO tbl1 VALUES (10, 20);")
    (sqlite-execute db "INSERT   INTO tbl1 VALUES (30, 40);")
    (sqlite-select  db "SELECT * FROM tbl1;")
    (sqlite-close db)))

(setq diskcmds
  '((delete-file "/tmp/foo.db")
    (setq db (sqlite-open "/tmp/foo.db"))
    (sqlite-execute db "CREATE  TABLE tbl1 (col1, col2);")
    (sqlite-execute db "INSERT   INTO tbl1 VALUES (10, 20);")
    (sqlite-execute db "INSERT   INTO tbl1 VALUES (30, 40);")
    (sqlite-select  db "SELECT * FROM tbl1;")
    (sqlite-close db)))

(defun my-benchmark-elapse (&rest forms)
  (eval `(benchmark-elapse ,@forms)))

;; (delete-file "/tmp/foo.db")
(mapcar 'eval memcmds)
(mapcar 'eval diskcmds)
;; (sqlite-mode-open-file "/tmp/foo.db")

;; (delete-file "/tmp/foo.db")
(mapcar 'my-benchmark-elapse memcmds)
(mapcar 'my-benchmark-elapse diskcmds)
;; (sqlite-mode-open-file "/tmp/foo.db")

;;-- end



#####
#
# surprisingly-slow-2
# 2024oct01
#
#####

# «surprisingly-slow-2»  (to ".surprisingly-slow-2")
# (find-angg "SQLITE/surprisingly-slow-2.el")
# https://lists.gnu.org/archive/html/help-gnu-emacs/2024-09/msg00228.html Edrx1
# https://lists.gnu.org/archive/html/help-gnu-emacs/2024-10/msg00000.html Tassilo1
# https://lists.gnu.org/archive/html/help-gnu-emacs/2024-10/msg00004.html Edrx2

;; (ee-copy-rest-3m nil ";;-- end" "/tmp/s.el")

(require 'benchmark)
(require 'sqlite)
(require 'sqlite-mode)

(defun my-insert1 (n)
  (let ((cmd (format "INSERT INTO tbl1 VALUES (%d, %d);"
		     n (* 10 n))))
    `(sqlite-execute db ,cmd)))

(defun my-inserts (n)
  (cl-loop for i from 1 to n
	   collect (my-insert1 i)))

;; Test: (my-insert1 1)
;;       (my-insert1 2)
;;       (my-inserts 4)

(setq my-memcmds
  '((setq db (sqlite-open))
    (sqlite-execute db "CREATE  TABLE tbl1 (col1, col2);")
    (sqlite-execute db "INSERT   INTO tbl1 VALUES (10, 20);")
    (sqlite-execute db "INSERT   INTO tbl1 VALUES (30, 40);")
    (sqlite-select  db "SELECT * FROM tbl1;")
    (sqlite-close db)))

(setq my-diskcmds
  '((delete-file "/tmp/foo.db")
    (setq db (sqlite-open "/tmp/foo.db"))
    (sqlite-execute db "CREATE  TABLE tbl1 (col1, col2);")
    (sqlite-execute db "INSERT   INTO tbl1 VALUES (10, 20);")
    (sqlite-execute db "INSERT   INTO tbl1 VALUES (30, 40);")
    (sqlite-select  db "SELECT * FROM tbl1;")
    (sqlite-close db)))

(setq my-diskcmds2
  `((delete-file "/tmp/foo.db")
    (setq db (sqlite-open "/tmp/foo.db"))
    (sqlite-execute db "BEGIN;")
    (sqlite-execute db "CREATE  TABLE tbl1 (col1, col2);")
    (sqlite-execute db "INSERT   INTO tbl1 VALUES (10, 20);")
    (sqlite-execute db "INSERT   INTO tbl1 VALUES (30, 40);")
    (sqlite-execute db "COMMIT;")
    (sqlite-select  db "SELECT * FROM tbl1;")
    (sqlite-close db)))

(setq my-diskcmds3
  `((delete-file "/tmp/foo.db")
    (setq db (sqlite-open "/tmp/foo.db"))
    (sqlite-execute db "BEGIN;")
    (sqlite-execute db "CREATE  TABLE tbl1 (col1, col2);")
    (progn ,@(my-inserts 100))
    (sqlite-execute db "COMMIT;")
    (sqlite-select  db "SELECT * FROM tbl1;")
    (sqlite-close db)))

(defun my-benchmark-elapse (&rest forms)
  (eval `(benchmark-elapse ,@forms)))

;; (delete-file "/tmp/foo.db")
(mapcar 'eval my-memcmds)
(mapcar 'eval my-diskcmds)
(mapcar 'eval my-diskcmds2)
(mapcar 'eval my-diskcmds3)
;; (sqlite-mode-open-file "/tmp/foo.db")

;; (delete-file "/tmp/foo.db")
(mapcar 'my-benchmark-elapse my-memcmds)
(mapcar 'my-benchmark-elapse my-diskcmds)
(mapcar 'my-benchmark-elapse my-diskcmds2)
(mapcar 'my-benchmark-elapse my-diskcmds3)
;; (sqlite-mode-open-file "/tmp/foo.db")

;;-- end






#####
#
# elisp-benchmark
# 2024sep29
#
#####

# «elisp-benchmark»  (to ".elisp-benchmark")





http://leveldb.googlecode.com/svn/trunk/doc/benchmark.html

http://www.sqlite.org/wal.html

https://www.sqlite.org/whentouse.html

sqlitestudio

https://corecursive.com/066-sqlite-with-richard-hipp/

https://lars.ingebrigtsen.no/2018/08/28/imdb-in-emacs-or-honey-i-made-an-orm/

https://github.com/mhayashi1120/Emacs-esqlite

https://buttondown.email/jaffray/archive/databases-are-not-compilers/ the closure property
https://www.reddit.com/r/emacs/comments/1bhqz2h/sqlitemodeextras_now_on_melpa/
https://oldmoe.blog/2024/04/30/backup-strategies-for-sqlite-in-production/

# (find-google-links "how to copy a table to another database in sqlite")
# (find-fline "~/LOGS/2024oct17.emacs" "union all (select * from remote2)")

https://sqlite.org/forum/info/8976d99d27a2e674 By Richard Hipp - I think that will go a lot faster.





#  Local Variables:
#  coding:               utf-8-unix
#  End: