pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dirk Jagdmann <doj@cubic.org>
To: pgsql-interfaces@postgresql.org
Subject: ecpg and VARCHAR
Date: Sat, 09 Jul 2005 23:26:00 +0200
Message-ID: <42D040E8.8060309@cubic.org> (raw)

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



view thread (3+ messages)  latest in thread

Message-ID: <42D040E8.8060309@cubic.org>
Permalink:  ../42D040E8.8060309@cubic.org/
Also on:    postgresql.org/message-id/42D040E8.8060309@cubic.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: doj@cubic.org
  Subject: Re: ecpg and VARCHAR
  In-Reply-To: <42D040E8.8060309@cubic.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox