From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Re: [Babel] How to pass variables to SQL blocks? Date: Mon, 13 Dec 2010 15:06:37 -0700 Message-ID: <87mxo9fhua.fsf@gmail.com> References: <80pqtoqfkh.fsf@missioncriticalit.com> <87ipzefcga.fsf@gmail.com> <80tyixlr0s.fsf@missioncriticalit.com> <87y67th2kj.fsf@gmail.com> <80fwu1pdsj.fsf@missioncriticalit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=55050 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PSGXe-0000DX-D4 for emacs-orgmode@gnu.org; Mon, 13 Dec 2010 17:06:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PSGXa-0002iN-QB for emacs-orgmode@gnu.org; Mon, 13 Dec 2010 17:06:46 -0500 Received: from mail-yx0-f169.google.com ([209.85.213.169]:37169) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PSGXa-0002iG-Md for emacs-orgmode@gnu.org; Mon, 13 Dec 2010 17:06:42 -0500 Received: by yxl31 with SMTP id 31so4287873yxl.0 for ; Mon, 13 Dec 2010 14:06:42 -0800 (PST) In-Reply-To: <80fwu1pdsj.fsf@missioncriticalit.com> (=?utf-8?Q?=22S=C3=A9b?= =?utf-8?Q?astien?= Vauban"'s message of "Mon, 13 Dec 2010 22:23:56 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?S=C3=A9bastien?= Vauban Cc: emacs-orgmode@gnu.org S=C3=A9bastien Vauban writes: > Hi Eric, > > "Eric Schulte" wrote: >> S=C3=A9bastien Vauban writes: >>> (I thought this feature would be implemented using "real" SQL vars, hen= ce my @ >>> prefix. But viewing the code shows the replacement is made outside of t= he SQL >>> snippet's knowledge.) >> >> I agree that using real SQL variables would be preferable. If you want >> to submit a patch to this effect I would be happy to review it and apply. > > I'll give a shot -- not in the really short term, though. Which example s= hould > I look at? shell? > great, and please no rush. shell actually has rather sophisticated variable passing, maybe sqlite and gnuplot would provide examples more similar to sql. > > >>> Maybe the following should be put on some TODO list, even if not urgent? >>> >>>>> * No warning if block does not exist >>>>> >>>>> Please note that inexistent references are ignored, without further >>>>> notice. That's the case for such a block (where I forgot the number >>>>> suffix): >>>>> >>>>> #+srcname: contains-inexistent-ref >>>>> #+begin_src sql :noweb yes >>>>> <> >>>>> #+end_src >> >> The lack of notice (or error) was originally intentional. The logic >> being that there may be languages in which <> constructs are >> part of the language syntax, and in those languages Org-mode should >> ignore such constructs unless the "something" contained in the <<>>'s is >> actually the name of a code block. >> >> It may make sense to revisit this design decision. > > IMHO, it should, yes. Because a typo is so easy, and the results can be v= ery > different then, from what's expected... OK, there is always a preview mod= e, > but an alert is better (for me). > > Maybe adding an option for those languages, that would suppress such warn= ings? > That may be the best idea, once again a header argument may be the most flexible solution. > > Re helper functions for such named code blocks, do you have an idea what I > should do to have the IMenu index of code blocks working? See previous th= read > [[http://mid.gmane.org/808w09foxd.fsf%40missioncriticalit.com][Re: imenu > support for babel blocks]]. > I don't have any experience with IMenu support, however to map over all code blocks in a file extracting information I would suggest using the org-babel-map-src-blocks macro. Cheers -- Eric > > Thanks for any hint! > > Best regards, > Seb