From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCHES] WITH DELIMITERS in COPY |
Date: | 2002-04-16 23:55:25 |
Message-ID: | 200204162355.g3GNtQW28665@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Gavin Sherry | 2002-04-16 23:56:03 | Re: [PATCHES] WITH DELIMITERS in COPY |
Previous Message | Bruce Momjian | 2002-04-16 23:49:45 | Re: [PATCHES] WITH DELIMITERS in COPY |
From | Date | Subject | |
---|---|---|---|
Next Message | Gavin Sherry | 2002-04-16 23:56:03 | Re: [PATCHES] WITH DELIMITERS in COPY |
Previous Message | Bruce Momjian | 2002-04-16 23:49:45 | Re: [PATCHES] WITH DELIMITERS in COPY |