embedded sql pointer to structure question

From: Feite Brekeveld <feite(dot)brekeveld(at)osiris-it(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: embedded sql pointer to structure question
Date: 2001-03-16 11:58:06
Message-ID: 3AB1FFCE.2E29FA84@osiris-it.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)brekeveld(at)osiris-it(dot)nl

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2001-03-16 12:02:10 Re: need hint for a trigger...
Previous Message Vilson farias 2001-03-16 11:57:35 Re: Why my vacuum fails?