X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id F0EB8D1B51A for ; Wed, 24 Sep 2003 09:35:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 27452-08 for ; Wed, 24 Sep 2003 06:31:37 -0300 (ADT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.185]) by svr1.postgresql.org (Postfix) with ESMTP id 2014ED1B89A for ; Wed, 24 Sep 2003 06:31:35 -0300 (ADT) Received: from [212.227.126.160] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1A25zh-0005mq-00; Wed, 24 Sep 2003 11:31:33 +0200 Received: from [80.142.160.81] (helo=fam-meskes.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1A25zh-0006Yg-00; Wed, 24 Sep 2003 11:31:33 +0200 Received: by fam-meskes.de (Postfix, from userid 1000) id E7FBE10EF93; Wed, 24 Sep 2003 09:25:42 +0200 (CEST) Date: Wed, 24 Sep 2003 09:25:42 +0200 From: Michael Meskes To: Ryan Mooney Cc: pgsql-interfaces@postgresql.org Subject: Re: ECPG insert into table name as a variable Message-ID: <20030924072542.GA633@feivel.fam-meskes.de> Mail-Followup-To: Ryan Mooney , pgsql-interfaces@postgresql.org References: <20030923211207.GB13521@pcslink.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030923211207.GB13521@pcslink.com> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/66 X-Sequence-Number: 4484 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@jabber.org Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!