added org sqlite db init
This commit is contained in:
parent
3969e6dfe7
commit
41bc0cf8cf
14
conf.org
14
conf.org
|
@ -2641,13 +2641,25 @@ Org mode is great and all, but in many cases, text files just won't cut it. Hard
|
|||
#+BEGIN_SRC emacs-lisp
|
||||
(require 'sql)
|
||||
|
||||
(defconst nd/sqlite3-cmd
|
||||
"sqlite3"
|
||||
"The shell command to summon sqlite3.")
|
||||
|
||||
(defconst nd/org-sqlite-db-path
|
||||
(expand-file-name "archive.db" org-directory)
|
||||
"Path for the sqlite database that holds archive data.")
|
||||
|
||||
(defun nd/org-init-db ()
|
||||
"Make a sqlite database for org archive files if it does not exits already."
|
||||
(process-file-shell-command (concat "touch " nd/org-sqlite-db-path)))
|
||||
(unless (file-exists-p nd/org-sqlite-db-path)
|
||||
(process-file-shell-command (concat "touch " nd/org-sqlite-db-path))
|
||||
(nd/sql-cmd nd/org-sqlite-db-path "create table test(one smallint);")))
|
||||
|
||||
(defun nd/sql-cmd (db sql)
|
||||
"Execute string SQL on database DB using sqlite3 shell command.
|
||||
Returns the output of CMD. SQL should not contain any quotes as if it
|
||||
were entered on the shell."
|
||||
(shell-command-to-string (concat nd/sqlite3-cmd " " db " \"" sql "\"")))
|
||||
#+END_SRC
|
||||
* tools
|
||||
** printing
|
||||
|
|
Loading…
Reference in New Issue