embedded sql pointer to structure question - Mailing list pgsql-general

From Feite Brekeveld
Subject embedded sql pointer to structure question
Date
Msg-id 3AB1FFCE.2E29FA84@osiris-it.nl
Whole thread Raw
Responses Re: embedded sql pointer to structure question
List pgsql-general
Hi,

I have an application using structures say

typedef struct {
   int id;
   char value[40];
} MYREC;


When passing a record to a function insert_record( MYREC *pmyrec)

how to deal with the sql-statement regarding the fields of the struct ?
When doing this (TESTPROGRAM) :

exec sql whenever sqlerror sqlprint;

exec sql include sqlca;

exec sql type MYREC is struct {
    int id;
    char value;
} ;

int main()
{
   MYREC mr;
  mr.id = 10;
  strcpy(mr.value, "testval");
...

 Exec sql begin declare section;
   MYREC *pmr = &mr;

 exec sql end declare section;

EXEC SQL INSERT INTO test    VALUES(:pmr->id, :pmr->value);
...
}

I get the message :        ERROR: The variable id is not declared
--
Feite Brekeveld
feite.brekeveld@osiris-it.nl


pgsql-general by date:

Previous
From: fabrizio.ermini@sysdat.it
Date:
Subject: need hint for a trigger...
Next
From: Anand Raman
Date:
Subject: pg_dump not working..