Gavin Sherry wrote:
> > I see what it is doing, but it seems quite unclear. Seeing that people
> > are using this as a pattern for other param processing, I will work on a
> > patch to convert this to DefElem.
>
> Wouldn't a few macros clean this up better (ie, make it clearer)?
>
> #define CDBOPTDBPATH 1
>
> #define optparam(l) (char *)lsecond(l)
> #define optparami(l) (int)lfirsti(lnext(l))
>
> foreach(l, $5)
> {
> List *optitem = (List *) lfirst(l);
>
> switch (lfirsti(optitem))
> {
> case CDBOPTDBPATH:
> n->dbpath = optparam(optitem);
> break;
>
> ...
>
>
> Regardless, I guess that code is pointless since the consensus seems to be
> that the use of DefElem is better since it allows for the abstraction of
> the parameters list. Obviously a good thing if CREATE DATABASE, COPY etc
> are to be extended often enough.
>
Yes, macros would be the way to go if we didn't have a cleaner
alternative.
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026