emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Eric Schulte
Subject: Re: [O] [babel] Verbatim output from SQL command
Date: Tue, 18 Oct 2011 10:15:33 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux)

Hi Seb,

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

Best -- Eric

"Sebastien Vauban" <address@hidden> 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)                                          |                   
>                          |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> | */                                      |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> | create procedure dbo.dt_setpropertybyid |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         | @id int,                          
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         | @property varchar(64),            
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         | @value varchar(255),              
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         | @lvalue image                     
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> | as                                      |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         | set nocount on                    
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         | declare @uvalue nvarchar(255)     
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         | set @uvalue = 
> convert(nvarchar(255), @value)                            |                   
>                                                                           |   
>                                          |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         | if exists (select * from 
> dbo.dtproperties                               |                              
>                                                                |              
>                               |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       | where address@hidden 
> and address@hidden) |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         | begin                             
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       | --                                    
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       | -- bump the version count for this 
> row as we update it                                      |                    
>                         |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       | --                                    
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       | update dbo.dtproperties set 
> address@hidden, address@hidden, address@hidden, version=version+1 |           
>                                  |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       | where address@hidden 
> and address@hidden  |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         | end                               
>                                       |                                       
>                                                       |                       
>                      |
> |                                         |                                   
>                                       |                                       
>                                                       |                       
>                      |
> |                                         | else                              
>                                       |                                       
>                                                       |                       
>                      |
> ...
>
> Best regards,
>   Seb

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]