SQLite和elisp?

前端之家收集整理的这篇文章主要介绍了SQLite和elisp?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
是否有针对elisp的sqlite包装器?

如果没有,调用通过启动进程控制sqlite的python代码是一个好主意吗?有更好的方法从elisp使用sqlite吗?

解决方法

Trey Jackson的起始链接,似乎有一个关于如何构建 a programmatic interface for elisp to an inferior-process sqlite的教程,例如源码查询&LT f是氟烃基;.它仅基于屏幕抓取 comint buffer(例如,不重用sql.el).以下是从该引用复制的不完整示例.

;; this is emacs lisp code
(defun sqlite-query ( sql-command )
 (set-buffer sqlite-output-buffer)          ;1
 (erase-buffer)                                 ;2
  (comint-redirect-send-command-to-process
    sql-command
    sqlite-output-buffer
    (get-buffer-process sqlite-process-buffer) nil)  ;3
  (accept-process-output
    (get-buffer-process sqlite-process-buffer)
     1)  ;need to wait to obtain results

  (let*  ((begin (goto-char (point-min)))       ;4
      (end (goto-char (point-max)))
      (num-lines (count-lines begin end))
      (counter 0)
      (results-rows ()))
    (goto-char (point-min))
    (while ( < counter num-lines)
      (setq results-rows (cons (chomp (thing-at-point 'line)) results-rows))
      (forward-line)
      (setq counter (+ 1 counter)))
    (car `(,results-rows))))

不幸的是,看起来没有任何现成的东西,但也许it is a good approach并且可能比尝试使用另一种中间语言更好.

(除此之外,我发现连接sqlite和emacs的Widget GUI界面的例子很有趣.)

猜你在找的Sqlite相关文章