* [Babel] Tangling ignores LOB file?
@ 2010-12-07 14:17 Sébastien Vauban
2010-12-15 17:18 ` Eric Schulte
0 siblings, 1 reply; 4+ messages in thread
From: Sébastien Vauban @ 2010-12-07 14:17 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
#+TITLE: Tangling process ignores LOB?
#+DATE: 2010-12-07
#+LANGUAGE: en_US
#+BABEL: :cmdline -S server -U user -P password -d database -n -w 700 :results output :exports both
* Abstract
References to named code blocks located in a LOB file seem to be ignored by
the tangling process.
* Example
** Common code
These 2 SQL code blocks are, and will be, reused all over the place:
#+srcname: set-count-off
#+begin_src sql :eval never
-- no longer display the count message
SET NOCOUNT ON
#+end_src
#+srcname: defvar-now
#+begin_src sql :eval never
DECLARE @now smalldatetime
SET @now = CONVERT(smalldatetime,
CAST(YEAR(GETDATE()) AS char(4)) + '-' +
CAST(MONTH(GETDATE()) AS char(2)) + '-' +
CAST(DAY(GETDATE()) AS char(2)) + ' ' +
CAST(DATEPART(hh, GETDATE()) AS char(2)) + ':' +
CAST(DATEPART(mi, GETDATE()) AS char(2)) + ':' +
'00',
120) -- ODBC canonical
#+end_src
** Specific code
For example, I use them here:
#+begin_src sql :engine msosql :noweb yes
<<set-count-off>>
<<defvar-now>>
SELECT TOP 5 @now AS now
FROM table
#+end_src
#+results:
| now |
| ------------------- |
| 2010-12-07 15:14:00 |
| 2010-12-07 15:14:00 |
| 2010-12-07 15:14:00 |
| 2010-12-07 15:14:00 |
| 2010-12-07 15:14:00 |
| |
And it works (see the /results/ table). But...
* Problem
If I put the *common code blocks* into some LOB file (i.e., I move them out of
this file) and ingest it, then the specific code does not properly run
anymore.
In other words, it seems that the tangle process does not take into account
the code blocks located in the LOB.
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Babel] Tangling ignores LOB file?
2010-12-07 14:17 [Babel] Tangling ignores LOB file? Sébastien Vauban
@ 2010-12-15 17:18 ` Eric Schulte
2010-12-20 14:13 ` Sébastien Vauban
0 siblings, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2010-12-15 17:18 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
Hi Seb,
I just pushed up a fix which should allow noweb references to be
resolved using the library of babel.
Thanks -- Eric
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> #+TITLE: Tangling process ignores LOB?
> #+DATE: 2010-12-07
> #+LANGUAGE: en_US
>
> #+BABEL: :cmdline -S server -U user -P password -d database -n -w 700 :results output :exports both
>
> * Abstract
>
> References to named code blocks located in a LOB file seem to be ignored by
> the tangling process.
>
> * Example
>
> ** Common code
>
> These 2 SQL code blocks are, and will be, reused all over the place:
>
> #+srcname: set-count-off
> #+begin_src sql :eval never
> -- no longer display the count message
> SET NOCOUNT ON
> #+end_src
>
> #+srcname: defvar-now
> #+begin_src sql :eval never
> DECLARE @now smalldatetime
> SET @now = CONVERT(smalldatetime,
> CAST(YEAR(GETDATE()) AS char(4)) + '-' +
> CAST(MONTH(GETDATE()) AS char(2)) + '-' +
> CAST(DAY(GETDATE()) AS char(2)) + ' ' +
> CAST(DATEPART(hh, GETDATE()) AS char(2)) + ':' +
> CAST(DATEPART(mi, GETDATE()) AS char(2)) + ':' +
> '00',
> 120) -- ODBC canonical
> #+end_src
>
> ** Specific code
>
> For example, I use them here:
>
> #+begin_src sql :engine msosql :noweb yes
> <<set-count-off>>
> <<defvar-now>>
> SELECT TOP 5 @now AS now
> FROM table
> #+end_src
>
> #+results:
> | now |
> | ------------------- |
> | 2010-12-07 15:14:00 |
> | 2010-12-07 15:14:00 |
> | 2010-12-07 15:14:00 |
> | 2010-12-07 15:14:00 |
> | 2010-12-07 15:14:00 |
> | |
>
> And it works (see the /results/ table). But...
>
> * Problem
>
> If I put the *common code blocks* into some LOB file (i.e., I move them out of
> this file) and ingest it, then the specific code does not properly run
> anymore.
>
> In other words, it seems that the tangle process does not take into account
> the code blocks located in the LOB.
>
> Best regards,
> Seb
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Babel] Tangling ignores LOB file?
2010-12-15 17:18 ` Eric Schulte
@ 2010-12-20 14:13 ` Sébastien Vauban
2010-12-20 15:31 ` Sébastien Vauban
0 siblings, 1 reply; 4+ messages in thread
From: Sébastien Vauban @ 2010-12-20 14:13 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
"Eric Schulte" wrote:
>> In other words, it seems that the tangle process does not take into account
>> the code blocks located in the LOB.
>>
> I just pushed up a fix which should allow noweb references to be resolved
> using the library of babel.
TESTED as FIXED. Case is CLOSED.
Thanks a lot.
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Babel] Tangling ignores LOB file?
2010-12-20 14:13 ` Sébastien Vauban
@ 2010-12-20 15:31 ` Sébastien Vauban
0 siblings, 0 replies; 4+ messages in thread
From: Sébastien Vauban @ 2010-12-20 15:31 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
> "Eric Schulte" wrote:
>>> In other words, it seems that the tangle process does not take into
>>> account the code blocks located in the LOB.
>>
>> I just pushed up a fix which should allow noweb references to be resolved
>> using the library of babel.
>
> TESTED as FIXED. Case is CLOSED.
>
> Thanks a lot.
Though, I just discovered a little problem not related to tangling, but well
to the LOB:
#+TITLE: nil when code block is moved to my LOB
#+DATE: 2010-12-20
#+LANGUAGE: en_US
#+BABEL: :engine msosql :cmdline -S server -U user -P password -d database -n -w 700 :results output :exports both :noweb yes
* Abstract
When the code block is local to the file, the =call= is returning expected
results, when =C-c C-v C-e=.
When moved to the LOB (and the LOB ingested), the same =call= returns =nil=.
* Example
** Local source code block
The code block is in the same file as the one where the =call= is located.
#+srcname: show-count-per-tinyint-value
#+begin_src sql :var table="sometable" :var column="somecolumn"
SELECT $column, COUNT(ISNULL($column, 255)) AS 'Count'
FROM $table
GROUP BY $column
ORDER BY $column
#+end_src
#+call: show-count-per-tinyint-value(table="mytable", column="mycolumn")
#+results: show-count-per-tinyint-value(table="mytable", column="mycolumn")
| mycolumn | Count |
| ------------ | ----------- |
| NULL | 8062 |
| 0 | 5759 |
| 1 | 49174 |
| 2 | 1994 |
| 3 | 9651 |
| 4 | 27 |
| 5 | 2262 |
| 6 | 21 |
| | |
| (8 lignes affectFs) | |
** Now, with the source code in the LOB
After having moved the code block to the LOB (and ingested it), the execution
does not return the expected results anymore:
#+call: show-count-per-tinyint-value(table="mytable", column="mycolumn")
#+results: show-count-per-tinyint-value(table="mytable", column="mycolumn")
: nil
* Extra
Would it be possible to have:
- the previewing enabled, and
- speed commands
on the =call= lines?
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-12-20 15:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-07 14:17 [Babel] Tangling ignores LOB file? Sébastien Vauban
2010-12-15 17:18 ` Eric Schulte
2010-12-20 14:13 ` Sébastien Vauban
2010-12-20 15:31 ` Sébastien Vauban
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.