* [babel] Some variables with no default value don't provoke an error
@ 2011-09-14 9:05 Sebastien Vauban
2011-09-15 15:26 ` Eric Schulte
0 siblings, 1 reply; 5+ messages in thread
From: Sebastien Vauban @ 2011-09-14 9:05 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
As said previously, I've been forced to add a default value to many code
blocks I had in my local LOB, which I ingest in my `.emacs' file:
#+begin_src emacs-lisp
(when (try-require 'ob-lob)
(org-babel-lob-ingest "~/emacs/site-lisp/my-local-lob.org"))
#+end_src
Weirdly enough, in the following code block, I must add a default value for
vars `table', `column' and `type' but not for the var `nullability'.
I've even been able to add fake vars `something' and `else' with no error
being reported (at ingestion time):
#+srcname: add-column-in-table(table="", column="", something, type="", else, nullability)
#+begin_src sql
-- add column `$column' (if column does not exist yet)
IF NOT EXISTS (SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = '$table'
AND COLUMN_NAME = '$column')
BEGIN
ALTER TABLE $table
ADD $column $type $nullability
END
#+end_src
Note that, in the above state, the code block is ingested with no error, but,
if I remove the default value of var `table', it then generates back an
error...
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [babel] Some variables with no default value don't provoke an error
2011-09-14 9:05 [babel] Some variables with no default value don't provoke an error Sebastien Vauban
@ 2011-09-15 15:26 ` Eric Schulte
2011-09-16 9:42 ` Sebastien Vauban
0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2011-09-15 15:26 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: emacs-orgmode
"Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> As said previously, I've been forced to add a default value to many code
> blocks I had in my local LOB, which I ingest in my `.emacs' file:
>
> #+begin_src emacs-lisp
> (when (try-require 'ob-lob)
> (org-babel-lob-ingest "~/emacs/site-lisp/my-local-lob.org"))
> #+end_src
>
> Weirdly enough, in the following code block, I must add a default value for
> vars `table', `column' and `type' but not for the var `nullability'.
>
> I've even been able to add fake vars `something' and `else' with no error
> being reported (at ingestion time):
>
> #+srcname: add-column-in-table(table="", column="", something, type="", else, nullability)
> #+begin_src sql
> -- add column `$column' (if column does not exist yet)
> IF NOT EXISTS (SELECT *
> FROM INFORMATION_SCHEMA.COLUMNS
> WHERE TABLE_NAME = '$table'
> AND COLUMN_NAME = '$column')
> BEGIN
> ALTER TABLE $table
> ADD $column $type $nullability
> END
> #+end_src
>
> Note that, in the above state, the code block is ingested with no error, but,
> if I remove the default value of var `table', it then generates back an
> error...
>
I've just pushed up a check for these functional-syntax variables which
will ensure that each is given a default value. Since this check takes
place at the location of the code block it /does/ include the name of
the code block in the error message.
Cheers -- Eric
>
> Best regards,
> Seb
--
Eric Schulte
http://cs.unm.edu/~eschulte/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [babel] Some variables with no default value don't provoke an error
2011-09-15 15:26 ` Eric Schulte
@ 2011-09-16 9:42 ` Sebastien Vauban
2011-09-16 14:07 ` Eric Schulte
0 siblings, 1 reply; 5+ messages in thread
From: Sebastien Vauban @ 2011-09-16 9:42 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
Eric Schulte wrote:
> "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> Weirdly enough, in the following code block, I must add a default value for
>> vars `table', `column' and `type' but not for the var `nullability'.
>>
>> I've even been able to add fake vars `something' and `else' with no error
>> being reported (at ingestion time):
>>
>> #+srcname: add-column-in-table(table="", column="", something, type="", else, nullability)
>> #+begin_src sql
>> -- add column `$column' (if column does not exist yet)
>> IF NOT EXISTS (SELECT *
>> FROM INFORMATION_SCHEMA.COLUMNS
>> WHERE TABLE_NAME = '$table'
>> AND COLUMN_NAME = '$column')
>> BEGIN
>> ALTER TABLE $table
>> ADD $column $type $nullability
>> END
>> #+end_src
>>
>> Note that, in the above state, the code block is ingested with no error, but,
>> if I remove the default value of var `table', it then generates back an
>> error...
>
> I've just pushed up a check for these functional-syntax variables which
> will ensure that each is given a default value. Since this check takes
> place at the location of the code block it /does/ include the name of
> the code block in the error message.
If you have a couple of minutes, can you clarify some points to be sure I can
understand:
- What do you call functional-syntax vars? The ones in the #+srcname, next to
the block name, as opposed to the ones declared as :var arguments?
The fact, then, that we can get a clearer message in case of error, seems to
me an incentive to use that type of declaration...
- Why was `nullability' not detected to have no default value? Why were
`table', `column' and `type' well correctly detected?
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [babel] Some variables with no default value don't provoke an error
2011-09-16 9:42 ` Sebastien Vauban
@ 2011-09-16 14:07 ` Eric Schulte
2011-09-16 19:54 ` Sebastien Vauban
0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2011-09-16 14:07 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: emacs-orgmode
Hi,
"Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> Eric Schulte wrote:
>> "Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:
>>> Weirdly enough, in the following code block, I must add a default value for
>>> vars `table', `column' and `type' but not for the var `nullability'.
>>>
>>> I've even been able to add fake vars `something' and `else' with no error
>>> being reported (at ingestion time):
>>>
>>> #+srcname: add-column-in-table(table="", column="", something, type="", else, nullability)
>>> #+begin_src sql
>>> -- add column `$column' (if column does not exist yet)
>>> IF NOT EXISTS (SELECT *
>>> FROM INFORMATION_SCHEMA.COLUMNS
>>> WHERE TABLE_NAME = '$table'
>>> AND COLUMN_NAME = '$column')
>>> BEGIN
>>> ALTER TABLE $table
>>> ADD $column $type $nullability
>>> END
>>> #+end_src
>>>
>>> Note that, in the above state, the code block is ingested with no error, but,
>>> if I remove the default value of var `table', it then generates back an
>>> error...
>>
>> I've just pushed up a check for these functional-syntax variables which
>> will ensure that each is given a default value. Since this check takes
>> place at the location of the code block it /does/ include the name of
>> the code block in the error message.
>
> If you have a couple of minutes, can you clarify some points to be sure I can
> understand:
>
> - What do you call functional-syntax vars? The ones in the #+srcname, next to
> the block name, as opposed to the ones declared as :var arguments?
>
yes, that's exactly it, I don't know what "functional-syntax" is a good
or descriptive term, but it is used in the source code so I'm now
repeating it.
>
> The fact, then, that we can get a clearer message in case of error, seems to
> me an incentive to use that type of declaration...
>
I personally prefer the traditional ":var" style, I'll have to add
similar error checking there...
>
> - Why was `nullability' not detected to have no default value? Why were
> `table', `column' and `type' well correctly detected?
>
Meaning after you assigned values to the first three no error was thrown
when the fourth (nullability) wasn't assigned a value? Could you
provide a minimal example?
>
> Best regards,
> Seb
--
Eric Schulte
http://cs.unm.edu/~eschulte/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [babel] Some variables with no default value don't provoke an error
2011-09-16 14:07 ` Eric Schulte
@ 2011-09-16 19:54 ` Sebastien Vauban
0 siblings, 0 replies; 5+ messages in thread
From: Sebastien Vauban @ 2011-09-16 19:54 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
Eric Schulte wrote:
> "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> Eric Schulte wrote:
>>> "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>>>> Weirdly enough, in the following code block, I must add a default value for
>>>> vars `table', `column' and `type' but not for the var `nullability'.
>>>>
>>>> I've even been able to add fake vars `something' and `else' with no error
>>>> being reported (at ingestion time):
>>>>
>>>> #+srcname: add-column-in-table(table="", column="", something, type="", else, nullability)
>>>> #+begin_src sql
>>>> -- add column `$column' (if column does not exist yet)
>>>> IF NOT EXISTS (SELECT *
>>>> FROM INFORMATION_SCHEMA.COLUMNS
>>>> WHERE TABLE_NAME = '$table'
>>>> AND COLUMN_NAME = '$column')
>>>> BEGIN
>>>> ALTER TABLE $table
>>>> ADD $column $type $nullability
>>>> END
>>>> #+end_src
>>>>
>>>> Note that, in the above state, the code block is ingested with no error, but,
>>>> if I remove the default value of var `table', it then generates back an
>>>> error...
>>>
>>> I've just pushed up a check for these functional-syntax variables which
>>> will ensure that each is given a default value. Since this check takes
>>> place at the location of the code block it /does/ include the name of
>>> the code block in the error message.
>>
>> If you have a couple of minutes, can you clarify some points to be sure I can
>> understand:
>>
>> - What do you call functional-syntax vars? The ones in the #+srcname, next to
>> the block name, as opposed to the ones declared as :var arguments?
>
> yes, that's exactly it, I don't know what "functional-syntax" is a good
> or descriptive term, but it is used in the source code so I'm now
> repeating it.
OK.
>> The fact, then, that we can get a clearer message in case of error, seems to
>> me an incentive to use that type of declaration...
>
> I personally prefer the traditional ":var" style, I'll have to add
> similar error checking there...
Good to know.
>> - Why was `nullability' not detected to have no default value? Why were
>> `table', `column' and `type' well correctly detected?
>
> Meaning after you assigned values to the first three no error was thrown
> when the fourth (nullability) wasn't assigned a value? Could you
> provide a minimal example?
Yes, you summed up exactly what I (can assure you that) observed yesterday.
Though, now that the message includes the src-name, it is somehow fixed. I
can't reproduce it anymore... Thanks.
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-09-16 19:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-14 9:05 [babel] Some variables with no default value don't provoke an error Sebastien Vauban
2011-09-15 15:26 ` Eric Schulte
2011-09-16 9:42 ` Sebastien Vauban
2011-09-16 14:07 ` Eric Schulte
2011-09-16 19:54 ` Sebastien 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.