Datatypes in Embedded SQL - Mailing list pgsql-sql

From Mic
Subject Datatypes in Embedded SQL
Date
Msg-id 985388177.4065.0.pluto.c29fe0e4@news.demon.nl
Whole thread Raw
List 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;






pgsql-sql by date:

Previous
From: "pgsql-sql"
Date:
Subject: Re(2): trigger output to a file
Next
From: "Jack"
Date:
Subject: about raise exception