Hi Alain, Would the following work (escaping "-"s with a backslash)?
#+begin_src diff diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el index 364070e..838f013 100644 --- a/lisp/ob-sql.el +++ b/lisp/ob-sql.el @@ -73,7 +73,9 @@ This function is called by `org-babel-execute-src-block'." (org-babel-process-file-name out-file))) ('mysql (format "mysql %s -e \"source %s\" > %s" (or cmdline "") - (org-babel-process-file-name in-file) + (replace-regexp-in-string + "\\-" "\\\\-" + (org-babel-process-file-name in-file)) (org-babel-process-file-name out-file))) ('postgresql (format "psql -A -P footer=off -F \"\t\" -f %s -o %s %s" #+end_src Best -- Eric Alain Clément <alain.clem...@unil.ch> writes: > Hi Eric, > > Thanks for your prompt answer! Actually, it doesn't work since mysql > interprets backslashes as options, even between quotes. The value of my > `org-babel-temporary-directory' is > "/var/folders/9E/9EMu+g0oHBSrq-h9sX6i1U+++TM/-Tmp-/babel-86766893", but "+"'s > are escaped with a backslash at some stage. > > Thanks, > - Alain > > 2011/3/3 Eric Schulte <schulte.e...@gmail.com> > > Hi Alain, > > Does the following alternative fix work for you? > > #+begin_src diff<br> > Changes in HEAD<br> > Modified lisp/ob-sql.el<br> > diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el<br> > index 364070e..604d444 100644<br> > --- a/lisp/ob-sql.el<br> > +++ b/lisp/ob-sql.el<br> > @@ -71,7 +71,7 @@ This function is called by > `org-babel-execute-src-block'."<br> > (or cmdline "")<br> > (org-babel-process-file-name in-file)<br> > (org-babel-process-file-name out-file)))<br> > - ('mysql (format "mysql %s -e \"source %s\" > > %s"<br> > + ('mysql (format "mysql %s -e 'source %s' > > %s"<br> > (or cmdline "")<br> > (org-babel-process-file-name in-file)<br> > (org-babel-process-file-name out-file)))<br> > #+end_src<br> > Also, just out of curiosity would you mind sharing an example result of > `org-babel-temporary-directory' which contains backslashes? > > Thanks -- Eric > > Alain Cl?ment <alain.clem...@unil.ch> writes: > >> Hi everyone, >> >> The =org-babel-temp-file= string seems to be escaped with backslashes on >> some platforms (like MacOSX), which is not very appreciated by the =mysql >> -e= command. I suggest the following patch for =ob-sql.el= (Org-mode Version >> 7.4 (release_7.4.590.g85d4d)): >> >> 74c74 >> < ? ? ? ? ? ? ? ? ? ? ('mysql (format "mysql %s < %s > %s" >> --- >>> ? ? ? ? ? ? ? ? ? ? ('mysql (format "mysql %s -e \"source %s\" > %s" >> >> Best regards, >> -- Alain >> >> -- >> >> >> >> Alain Cl?ment >> Dr ?s sc. math?matiques >> >> Universit? de Lausanne >> Quartier UNIL-Centre >> B?timent Unicentre >> Bureau 339 >> CH-1015 Lausanne >> >> T. +41 21 692 20 36 (direct) >> T. +41 21 692 20 60 (secr?tariat) >> >> alain.clem...@unil.ch > > -- > > [lo_unil05_bleu] > > Alain Cl?ment > Dr ?s sc. math?matiques > > Universit? de Lausanne > Quartier UNIL-Centre > B?timent Unicentre > Bureau 339 > CH-1015 Lausanne > > T. +41 21 692 20 36 (direct) > T. +41 21 692 20 60 (secr?tariat) > > alain.clem...@unil.ch