加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

SQLite和elisp?

发布时间:2020-12-12 18:59:37 所属栏目:百科 来源:网络整理
导读:是否有针对elisp的SQLite包装器? 如果没有,调用通过启动进程控制SQLite的python代码是一个好主意吗?有更好的方法从elisp使用SQLite吗? 解决方法 从 Trey Jackson的起始链接,似乎有一个关于如何构建 a programmatic interface for elisp to an inferior-pr
是否有针对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界面的例子很有趣.)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读