X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4173E52AF2 for ; Sat, 9 Jul 2005 18:26:11 -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 86968-07 for ; Sat, 9 Jul 2005 21:26:01 +0000 (GMT) Received: from roasted.cubic.org (roasted.cubic.org [193.108.181.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8A28152915 for ; Sat, 9 Jul 2005 18:26:00 -0300 (ADT) Received: from d010158.adsl.hansenet.de ([80.171.10.158] helo=mrmucke.doj) by roasted.cubic.org with esmtp (Exim 3.36 #1) id 1DrMpl-0005dO-00 for pgsql-interfaces@postgresql.org; Sat, 09 Jul 2005 23:26:01 +0200 Received: from [192.168.0.3] (helo=[192.168.0.3]) by mrmucke.doj with esmtp (Exim 3.36 #1) id 1DrMpk-0005Va-00 for pgsql-interfaces@postgresql.org; Sat, 09 Jul 2005 23:26:00 +0200 Message-ID: <42D040E8.8060309@cubic.org> Date: Sat, 09 Jul 2005 23:26:00 +0200 From: Dirk Jagdmann Organization: Cubic User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Subject: ecpg and VARCHAR Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200507/19 X-Sequence-Number: 5655 Hello developers, 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: --- file z.pgc ---- int main() { EXEC SQL BEGIN DECLARE SECTION; VARCHAR v; EXEC SQL END DECLARE SECTION; return 0; } ------------------- z.pgc: In function `main': z.pgc:4: error: size of array `arr' is negative Now I suppose this negative declaration should have initialized an empty array and the generated sql code then allocates the space as needed? 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? And then I'd like to know which is the preferred way to retrieve "text" columns which contain arbitrary length texts with ecpg? -- ---> doj / cubic ----> http://cubic.org/~doj -----> http://llg.cubic.org