kostafey / ejc-sql

Emacs SQL client uses Clojure JDBC.
278 stars 29 forks source link

Where would be a good place to escape/handle the pipe char "|" in the results? #185

Open mbarton98 opened 1 year ago

mbarton98 commented 1 year ago

I have been using ejc-sql for adhoc queries for a while to integrate with my notes in org mode. Recently I noticed my data was shifted over with the wrong values for the columns. Turns out one of the columns had the "|" in the middle of a string value and that was interpreted as a column boundary.

I might be able to patch this, but wanted to get your opinion first on whether it should be done in the clojure or elisp code.

mbarton98 commented 1 year ago

It does not seem trivial. I tried in org result table to surround the string with double quotes, but org still interpreted the pipe char. Even tried | (backslash pipe) and that did not work. I ended up just replacing the pipe with a unicode BROKEN BAR "¦". Seems like I can just hack that when I see a problem with a result unless you can think of a better solution that does not involve modifying the returned value stored in the database.