Hey all.
I've a questoin on embedded SQL. This is more a c question, i know, but i'm
going to ask anyway hoping there's another c developer looking who might be
able to help me out.
Thing is, I'm trying to declare a struct in the embedded SQL part in my
program, but the preprocessor complains about an 'unknown data type in line
162'. Is it not possible at all in Postgres? When i don't use the struct,
passing 4 variables instead, all goes well.
I Am using Postgres 7.0.2.
Regards,
Mic
/* ------------------------------------------------------DBinsRecord--------
does : Inserts a line in the db
args :
return : error code (0 = ok)---------------------------------------------------------------------------
*/
static int DBinsRecord ( DBstruct *Values
)
{ int nError = 0;
EXEC SQL BEGIN DECLARE SECTION; DBstruct *pRec = Values; EXEC SQL END DECLARE SECTION;
EXEC SQL INSERT INTO channel (line_nr ,nick ,type ,line) VALUES ( :pRec->line_nr ,
:pRec->nick , :pRec->type , :pRec->line);
nError = sqlca.sqlcode;
if (nError) printf ("error (%d):\n%s\n", nError, sqlca.sqlerrm.sqlerrmc);
return (nError);
}
with
typedef struct { int line_nr, type; char nick[10], line[160];
} DBstruct;