Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SQLite和elisp?_Sqlite_Elisp - Fatal编程技术网

SQLite和elisp?

SQLite和elisp?,sqlite,elisp,Sqlite,Elisp,是否有用于elisp的SQLite包装 如果不是,调用通过启动进程或其他方式控制SQLite的python代码是一个好主意吗?有没有更好的方法从elisp使用SQLite?是你的朋友,这里有几个链接指向SQLite的几个工具 ,第一个链接可能就是您正在寻找的链接:处理与数据库的交互:。从的起始链接,似乎有一个关于如何构建的教程,例如sqlite查询。它基于屏幕抓取,仅用于此目的(例如,不重用sql.el)。以下是从该引用复制的不完整示例 ;; this is emacs lisp code (d

是否有用于elisp的SQLite包装

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

是你的朋友,这里有几个链接指向SQLite的几个工具

,第一个链接可能就是您正在寻找的链接:处理与数据库的交互:。

从的起始链接,似乎有一个关于如何构建的教程,例如
sqlite查询
。它基于屏幕抓取,仅用于此目的(例如,不重用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))))
;;这是emacs lisp代码
(defun sqlite查询(sql命令)
(设置缓冲区sqlite输出缓冲区);1
(擦除缓冲区);2
(comint重定向发送命令到进程)
sql命令
sqlite输出缓冲区
(获取缓冲区进程sqlite进程缓冲区)nil);3
(b)接受过程输出
(获取缓冲区进程sqlite进程缓冲区)
1) ;需要等待获得结果
(让*((开始(转到字符(最小点)));4
(结束(转到字符(最大点)))
(行数(计数行开始和结束))
(柜台0)
(结果行())
(转到字符(最小点))
(while(<计数器数量行)
(setq结果行(cons(chomp(点行上的事物))结果行))
(前线)
(setq计数器(+1个计数器)))
(car`(,结果行)))
不幸的是,那里看起来没有现成的东西,但可能比尝试使用另一种中间语言要好

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

我在这里写了一篇文章来回应代码。