From: | Michael Meskes <meskes(at)postgresql(dot)org> |
---|---|
To: | Ryan Mooney <ryan(at)pcslink(dot)com> |
Cc: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Re: ECPG insert into table name as a variable |
Date: | 2003-09-24 07:25:42 |
Message-ID: | 20030924072542.GA633@feivel.fam-meskes.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
On Tue, Sep 23, 2003 at 11:12:07AM -1000, Ryan Mooney wrote:
> EXEC SQL INSERT INTO :tname (host, point, type, cooked) VALUES (:host, :name, :type, :cooked);
This is not possible as of now, but of course could be implemented.
> When I tried hacking the resulting C code (as a test exercise) like:
>
> { ECPGdo(__LINE__, 0, 1, NULL, "insert into ? ( host , point , type , cooked ) values ( ? , ? , ? , ? )",
> ECPGt_char,&(tname),(long)0,(long)1,1*sizeof(char),
You need to specify the indicator here as this:
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
> ECPGt_char,&(host),(long)0,(long)1,1*sizeof(char),
> ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
> ECPGt_char,&(name),(long)0,(long)1,1*sizeof(char),
> ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
> ECPGt_char,&(type),(long)1,(long)1,1*sizeof(char),
> ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
> ECPGt_char,&(cooked),(long)1,(long)1,1*sizeof(char),
> ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
> ECPGt_char,(starttime),(long)30,(long)1,30*sizeof(char),
> ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
> ECPGt_char,(interval),(long)30,(long)1,30*sizeof(char),
> ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
>
> it got all funny and didn't work very well (well ok it didn't work at all):
> pg.pgc:129 SQL Insert failed: Invalid statement name (null) in line 124.
>
> So, I was wondering am I just missing some obvious way to do this, or
> is this not supported at all?
So far it is not, sorry.
Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes(at)jabber(dot)org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
From | Date | Subject | |
---|---|---|---|
Next Message | Lee Kindness | 2003-09-24 16:27:57 | ECPG insert into table name as a variable |
Previous Message | Roman Bogorodskiy | 2003-09-24 03:18:41 | Re: troubles with getting data from tables |