Re: [O] [babel] Verbatim output from SQL command

2011-10-20 Thread Sebastien Vauban
Hi Eric,

Eric Schulte wrote:
 Sebastien Vauban wxhgmqzgw...@spammotel.com writes:
 Eric Schulte wrote:
 Babel seems to interpret every *leading space* as *one empty column*.
 Normal, feature, bug?

 Is there some workaround to this? I thought stating scalar would really
 completely override any interpretation...

 I've just pushed up a fix which should resolve this issue.

 It does better things, but at least at the wrong place.

 oh, I forgot to insert into a temporary buffer.  This should now be
 fixed.

This works like a charm. Thanks a lot!

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] [babel] Verbatim output from SQL command

2011-10-19 Thread Sebastien Vauban
Hi Eric,

Eric Schulte wrote:
 Babel seems to interpret every *leading space* as *one empty column*.
 Normal, feature, bug?

 Is there some workaround to this? I thought stating scalar would really
 completely override any interpretation...

 I've just pushed up a fix which should resolve this issue.

It does better things, but at least at the wrong place.

--8---cut here---start-8---
#+BABEL:   :engine msosql :cmdline -S SERVER -U USER -P PASS -d 
DATABASE -n -w 700 :results output

#+begin_src sql :eval yes :results scalar
EXEC sp_helptext 'reset_me'
#+end_src
--8---cut here---end---8---

becomes, after evaluation (indented for the sake of clarity):

--8---cut here---start-8---
#+BABEL:   :engine msosql :cmdline -S SERVER -U USER -P PASS -d 
DATABASE -n -w 700 :results output

Text


   

---

CREATE PROCEDURE reset_me
@pfi varchar(16)
AS
BEGIN
PRINT 'Done!'
END


#+begin_src sql :eval yes :results scalar
EXEC sp_helptext 'reset_me'
#+end_src

#+results:
#+begin_example
#+BABEL:   :engine msosql :cmdline -S SERVER -U USER -P PASS -d 
DATABASE -n -w 700 :results output

Text


   

---

CREATE PROCEDURE reset_me
@pfi varchar(16)
AS
BEGIN
PRINT 'Done!'
END


#+begin_src sql :eval yes :results scalar
EXEC sp_helptext 'reset_me'
#+end_src

#+end_example

--8---cut here---end---8---

In short, it seems that:

- results is inserted at point's position (in the above case, I was using the
  eval speed command `e', thus being at #).

- the results is duplicated, with some part of the source buffer being
  repeated as well... See the presence of 2 `#+BABEL:' lines in the buffer,
  after the evaluation.

- depending on the point from which I run the code evaluation, there is (or
  there isn't) an `#+begin_example' directive. The `#+end_example' is always
  present.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] [babel] Verbatim output from SQL command

2011-10-19 Thread Viktor Rosenfeld
Hi,

Sebastien Vauban wrote:

 #+BABEL:   :engine msosql :cmdline -S SERVER -U USER -P PASS -d 
 DATABASE -n -w 700

Where is the :engine directive documented?

Cheers,
Viktor



Re: [O] [babel] Verbatim output from SQL command

2011-10-19 Thread Nick Dokos
Viktor Rosenfeld listuse...@googlemail.com wrote:

 Hi,
 
 Sebastien Vauban wrote:
 
  #+BABEL:   :engine msosql :cmdline -S SERVER -U USER -P PASS -d 
  DATABASE -n -w 700
 
 Where is the :engine directive documented?
 

The only place I know of is lisp/ob-sql.el - there is support for the following 
engines currently:


,
| ...
| ('msosql (format osql %s -s \\t\ -i %s -o %s
|  (or cmdline )
|  (org-babel-process-file-name in-file)
|  (org-babel-process-file-name out-file)))
| ('mysql (format mysql %s  %s  %s
| (or cmdline )
|   (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
|   (org-babel-process-file-name in-file)
|   (org-babel-process-file-name out-file)
|   (or cmdline )))
| (t (error no support for the %s sql engine engine)
|   ...
`

Nick




Re: [O] [babel] Verbatim output from SQL command

2011-10-19 Thread Viktor Rosenfeld
Cool, thanks!

Nick Dokos wrote:

 Viktor Rosenfeld listuse...@googlemail.com wrote:
 
  Hi,
  
  Sebastien Vauban wrote:
  
   #+BABEL:   :engine msosql :cmdline -S SERVER -U USER -P PASS -d 
   DATABASE -n -w 700
  
  Where is the :engine directive documented?
  
 
 The only place I know of is lisp/ob-sql.el - there is support for the 
 following engines currently:
 
 
 ,
 | ...
 | ('msosql (format osql %s -s \\t\ -i %s -o %s
 |  (or cmdline )
 |  (org-babel-process-file-name in-file)
 |  (org-babel-process-file-name 
 out-file)))
 | ('mysql (format mysql %s  %s  %s
 | (or cmdline )
 | (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
 | (org-babel-process-file-name in-file)
 | (org-babel-process-file-name out-file)
 | (or cmdline )))
 | (t (error no support for the %s sql engine engine)
 | ...
 `
 
 Nick
 
 



Re: [O] [babel] Verbatim output from SQL command

2011-10-19 Thread Sebastien Vauban
Hi Viktor and Nick,

Nick Dokos wrote:
 Viktor Rosenfeld listuse...@googlemail.com wrote:
 Sebastien Vauban wrote:
 
  #+BABEL:   :engine msosql :cmdline -S SERVER -U USER -P PASS -d 
  DATABASE -n -w 700
 
 Where is the :engine directive documented?

 The only place I know of is lisp/ob-sql.el - there is support for the 
 following engines currently:


 ,
 | ...
 | ('msosql (format osql %s -s \\t\ -i %s -o %s
 |  (or cmdline )
 |  (org-babel-process-file-name in-file)
 |  (org-babel-process-file-name 
 out-file)))
 | ('mysql (format mysql %s  %s  %s
 | (or cmdline )
 | (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
 | (org-babel-process-file-name in-file)
 | (org-babel-process-file-name out-file)
 | (or cmdline )))
 | (t (error no support for the %s sql engine engine)
 | ...
 `

Nothing to add. The `engine' directive is SQL-specific.

Note that I have in mind to add such an `engine' directive to Ledger as well:
being able to let the transactions be processed by `ledger', `hledger' or
`beancount' -- the ones I know of, and which are mostly compatible between
each other.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] [babel] Verbatim output from SQL command

2011-10-19 Thread Eric Schulte
Sebastien Vauban wxhgmqzgw...@spammotel.com writes:

 Hi Eric,

 Eric Schulte wrote:
 Babel seems to interpret every *leading space* as *one empty column*.
 Normal, feature, bug?

 Is there some workaround to this? I thought stating scalar would really
 completely override any interpretation...

 I've just pushed up a fix which should resolve this issue.

 It does better things, but at least at the wrong place.


oh, I forgot to insert into a temporary buffer.  This should now be
fixed.

Thanks -- Eric

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] [babel] Verbatim output from SQL command

2011-10-18 Thread Eric Schulte
Hi Seb,

I've just pushed up a fix which should resolve this issue.

Best -- Eric

Sebastien Vauban wxhgmqzgw...@spammotel.com writes:

 #+BABEL:   :engine msosql :cmdline -S SERVER -U USER -P PASS -d 
 DATABASE -n -w 700

 * Show code of stored procedure

 Despite telling Babel that I'd like to see the output as it is, it displays it
 in a 4-column table.

 See http://i.imgur.com/neDO3.png for the original layout in SQL Query Analyser
 (1 column, 34 lines).

 Babel seems to interpret every *leading space* as *one empty column*. Normal,
 feature, bug?

 Is there some workaround to this?  I thought stating scalar would really
 completely override any interpretation...

 ** Code

 This is an example of code run against a Microsoft SQL server.

 #+begin_src sql :eval yes :results output scalar
 EXEC sp_helptext 'dt_setpropertybyid'
 #+end_src

 #+results:
 | Text|   
   |   
   |   
  |
 |-+-+-+|
 | /*  |   
   |   
   |   
  |
 | |   
   |   
   |   
  |
 | **  | If the property already exists, 
 reset the value; otherwise add property | 
 | 
|
 | |   
   |   
   |   
  |
 | **  |   
   | id -- the id in sysobjects of the 
 object|   
  |
 | |   
   |   
   |   
  |
 | **  |   
   | property -- the name of the property  
   |   
  |
 | |   
   |   
   |   
  |
 | **  |   
   | value -- the text value of the 
 property |
 |
 | |   
   |   
   |   
  |
 | **  |   
   | lvalue -- the binary value of the 
 property (image)  |   
  |
 | |   
   |   
   |   
  |
 | */  |   
   |   
   |   
  |
 | |   
   |