I'd like to be able to put a result from SQL inline into my exported document. Something like this:
Latest database record is from src_sql[:colnames no :results scalar]{select DATE(CreatedAt) from Event order by CreatedAt desc limit 1;}.
In that case, the SQL result almost works (it surrounds the results with =...=), but at least on my Windows machine there is an extra ^M and newline in there. I'd be happy to submit a patch to strip whitespace from the end of the line in scalar mode, if people think that's a good idea.
In fact here's what I propose:
diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 658a54f..ac999f4 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -138,7 +138,8 @@ This function is called by `org-babel-execute-src-block'."
(org-babel-eval command "")
(org-babel-result-cond result-params
(with-temp-buffer
- (progn (insert-file-contents-literally out-file) (buffer-string)))
+ (progn (insert-file-contents-literally out-file)
+ (replace-regexp-in-string "[ \t\r\n]*$" "" (buffer-string))))
(with-temp-buffer
(cond
((or (eq (intern engine) 'mysql)
--
Gary