From: Mic <Mic.c@sloten.demon.nl>
To: pgsql-sql@postgresql.org
Subject: Datatypes in Embedded SQL
Date: Fri, 23 Mar 2001 23:57:27 +0100
Message-ID: <985388177.4065.0.pluto.c29fe0e4@news.demon.nl> (raw)
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;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: Mic.c@sloten.demon.nl
Subject: Re: Datatypes in Embedded SQL
In-Reply-To: <985388177.4065.0.pluto.c29fe0e4@news.demon.nl>
References: <985388177.4065.0.pluto.c29fe0e4@news.demon.nl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox