emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Re: Patch for ob-sql.el SQL output


From: Sébastien Vauban
Subject: [Orgmode] Re: Patch for ob-sql.el SQL output
Date: Wed, 22 Dec 2010 11:23:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (windows-nt)

Hi Charles,

Charles Sebold wrote:
> What do you think would be a good solution for the blank between the output
> of a table and the row count if someone didn't run SET NOCOUNT ON?
>
> I mean, should that be another hline, or no blank line, or what?
>
> If somebody's trying to programatically use this table, it will mess up
> their data, but I would think they wouldn't have NOCOUNT off in that case.

I always disable the COUNT (let's say, enable the NOCOUNT) as this messes up
all the tables, but I don't have a good solution, would we want to see the
total -- which is, though, an instructive and important data.

Depending on the context of the SELECT, it could sometimes be equivalent to an
Org table formula (vsum), but how to automatically tell??


> It seems to me like the right thing to do is another hline, but I'm not
> convinced. And it is even more of a hack, because I don't know how to test
> for the "rows affected" line without an ugly search for some regexp like "
> rows? affected)", and in other language environments I would guess it
> doesn't even say that.
>
> In the intermediate output file the row count line is preceded by a blank
> line, but if there is only one column being output how can you tell the
> difference between that and a blank record?
>
> Anyway, if somebody wants the row count line at the moment I don't know how
> to work around the extra blank without a ton of logic for single-column or
> multi-column responses, and this is probably just making this code more and
> more osql-specific, which will not be helpful for people on free database
> systems. But if anybody has any ideas or suggestions, I may have a little
> time to try to implement them.

I would say that you could identify that blank line by looking at line "-2", I
mean counted from the bottom of the table.

I have no idea how other engines report such data (I don't have Postgre or
MySQL at hand), but I'd be interested in hearing from them.

Other idea: don't put the COUNT information in the table, but just under it,
as normal Org text. Maybe that's the most portable and viable solution?

Best regards,
  Seb

-- 
Sébastien Vauban




reply via email to

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