From: Mic <Mic.c@sloten.demon.nl>
To: pgsql-interfaces@postgresql.org
Subject: Datatypes in embedded SQL
Date: Mon, 26 Mar 2001 20:35:05 +0200
Message-ID: <985631638.19816.0.pluto.c29fe0e4@news.demon.nl> (raw)
Hey all.
I've a question on embedded sql.
Thing is, I'm trying to declare a struct in the embedded SQL part in my C
program, but the preprocessor complains about an 'unknown data type in line
162'. Is it not possible at all in Postgres to declare a structure? I tried
writing out the DBstruct in the SQL DECLARE section, that didn't work
either.
When i don't use the struct, passing 4 variables instead, all goes well.
I Am using Postgres server 7.0.2, and the pgcl preprocessor, running under
Mandrake Linux.
Regards,
Mic
preveously defined:
typedef struct {
int line_nr,
type;
char nick[10],
line[161];
} DBstruct;
/* ------------------------------------------------------DBinsRecord--------
does : Inserts a line in the db
args :
return : error code (0 = ok)
---------------------------------------------------------------------------
*/
static int DBinsRecord (
DBstruct *Values
)
{
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);
return (sqlca.sqlcode);
}
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 using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: Mic.c@sloten.demon.nl
Subject: Re: Datatypes in embedded SQL
In-Reply-To: <985631638.19816.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