emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sébastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: Re: Patch for ob-sql.el SQL output
Date: Wed, 22 Dec 2010 11:23:54 +0100	[thread overview]
Message-ID: <80fwtqayx1.fsf@missioncriticalit.com> (raw)
In-Reply-To: AANLkTimFPtxF4-pjTT3hiVzM2m20gPGJSA9FfhqGLqdr@mail.gmail.com

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


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-12-22 10:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-21 15:02 Patch for ob-sql.el SQL output Charles Sebold
2010-12-21 15:34 ` Sébastien Vauban
2010-12-21 16:57   ` Charles Sebold
2010-12-21 17:08     ` Charles Sebold
2010-12-21 17:34       ` Eric Schulte
2010-12-21 18:58         ` Charles Sebold
2010-12-22 10:23           ` Sébastien Vauban [this message]
2010-12-22 10:05         ` Sébastien Vauban

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80fwtqayx1.fsf@missioncriticalit.com \
    --to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).