From: | "Mic" <Mic(dot)c(at)sloten(dot)demon(dot)nl> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Datatypes in Embedded SQL |
Date: | 2001-03-23 22:57:27 |
Message-ID: | 985388177.4065.0.pluto.c29fe0e4@news.demon.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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;
From | Date | Subject | |
---|---|---|---|
Next Message | pgsql-sql | 2001-03-23 23:22:32 | Re(2): trigger output to a file |
Previous Message | Andrew Perrin | 2001-03-23 19:53:47 | Re: trigger output to a file |