X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F36F1D7233 for ; Wed, 24 Aug 2005 03:48:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22409-10 for ; Wed, 24 Aug 2005 06:48:06 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by svr1.postgresql.org (Postfix) with ESMTP id A2875D7021 for ; Wed, 24 Aug 2005 03:48:04 -0300 (ADT) Received: from p508973B2.dip.t-dialin.net [80.137.115.178] (helo=feivel) by mrelayeu.kundenserver.de with ESMTP (Nemesis), id 0ML25U-1E7p3M17XV-0001qg; Wed, 24 Aug 2005 08:48:04 +0200 Received: by feivel (Postfix, from userid 1000) id 493F24B069; Tue, 23 Aug 2005 11:31:46 +0200 (CEST) Date: Tue, 23 Aug 2005 11:31:46 +0200 From: Michael Meskes To: Dirk Jagdmann Cc: pgsql-interfaces@postgresql.org Subject: Re: ecpg and VARCHAR Message-ID: <20050823093146.GA8559@1> Mail-Followup-To: Dirk Jagdmann , pgsql-interfaces@postgresql.org References: <42D040E8.8060309@cubic.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42D040E8.8060309@cubic.org> User-Agent: Mutt/1.5.10i X-Provags-ID: kundenserver.de abuse@kundenserver.de login:da5cff6069dd6897c77170232368d0ba X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.016 required=5 tests=[AWL=0.016] X-Spam-Level: X-Archive-Number: 200508/39 X-Sequence-Number: 5710 On Sat, Jul 09, 2005 at 11:26:00PM +0200, Dirk Jagdmann wrote: > I'd like to get some information on VARCHAR types with ecpg. If I > declare a VARCHAR without any size information I get a compilation error > from my gcc 3.4.4: > ... > Now I suppose this negative declaration should have initialized an empty > array and the generated sql code then allocates the space as needed? Well, actually no. You just found a way to declare a pointer to a varchar that wasn't tested for. I will fix this test. Unfortunately it only means that you will get an error message from ecpg. It simply is not implemented yet. Should be easy to do but my spare time is rare at the moment. > If I declared the VARCHAR with a size everything works fine. However I'd > like to know if the characters in the array contain a trailing 0 or if I > have to set this explicitely? No. With char it may, but with varchar it does not. > And then I'd like to know which is the preferred way to retrieve "text" > columns which contain arbitrary length texts with ecpg? How about 'char *'? Just make sure the pointer is NULL and you free it after use. Michael -- Michael Meskes Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org) ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!