Browse Source

Fix issue with dbi processing in ob-sql.

* lisp/ob-sql.el (org-babel-execute:sql): Unquote cmdline argument in
  format string, dbish requires three separate arguments. Add dbi to
  the list of engines with automatically added header separator.
Rick Frankel 12 năm trước cách đây
mục cha
commit
78b3a03981
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      lisp/ob-sql.el

+ 3 - 2
lisp/ob-sql.el

@@ -103,10 +103,10 @@ This function is called by `org-babel-execute-src-block'."
                        (org-babel-temp-file "sql-out-")))
 	 (header-delim "")
          (command (case (intern engine)
-                    ('dbi (format "dbish --batch '%s' < %s | sed '%s' > %s"
+                    ('dbi (format "dbish --batch %s < %s | sed '%s' > %s"
 				  (or cmdline "")
 				  (org-babel-process-file-name in-file)
-				  "/^+/d;s/^\|//;$d"
+				  "/^+/d;s/^\|//;s/(NULL)/ /g;$d"
 				  (org-babel-process-file-name out-file)))
                     ('monetdb (format "mclient -f tab %s < %s > %s"
                                       (or cmdline "")
@@ -142,6 +142,7 @@ This function is called by `org-babel-execute-src-block'."
       (with-temp-buffer
 	(cond
 	  ((or (eq (intern engine) 'mysql)
+	       (eq (intern engine) 'dbi))
 	       (eq (intern engine) 'postgresql))
 	   ;; Add header row delimiter after column-names header in first line
 	   (cond