Re: Some basic ecpg questions

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Murphy Pope <pope_murphy(at)hotmail(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Some basic ecpg questions
Date: 2002-03-21 09:57:38
Message-ID: 20020321095738.GB715@feivel.fam-meskes.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Wed, Mar 20, 2002 at 07:08:28PM -0500, Murphy Pope wrote:
> 1) It looks like I have to define each data type twice: once for ecpg and once for C. Is that correct or is there something basic that I am missing?

I just committed some patches for this. Up to postgresql version 7.2
this is correct.

> 2) I could not seem to include a varchar inside of a struct - the ecpg preprocessor got confused by that. My construct looked something like:
>
> typedef struct
> {
> int id;
> varchar data[50];
> } foo;

C does not know varchar at all.

> When I tried to declare a 'foo' inside of the DECLATION SECTION, ecpg seemed to produce some code that my GNU CC didn't understand. (If it would help, I can send in the actual source and resulting .c file).

Please try the actual CVS version as this part was just changed earlier
today.

> 3) If I use EXEC SQL TYPE to declare a structure, it doesn't look like I can use an array of these structures to retreive multiple rows. Using the previous example structures, I want to do something like:
>
> EXEC SQL BEGIN DECLARATION SECTION;
> foo records[5];
> EXEC SQL END DECLARATION SECTION;
>
> EXEC SQL select * into :records from bar limit 5;

Did you EXEC SQL TYPE datatype foo?

If so, please send me a simple example file I I can reproduce this.

Michael
--
Michael Meskes
Michael(at)Fam-Meskes(dot)De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Hal Davison 2002-03-21 15:34:46 ARRAY
Previous Message Michael Meskes 2002-03-21 09:46:30 Re: ecpg weird behavior