Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2Q1iSw95355 for ; Sun, 25 Mar 2001 20:44:28 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2NN9xw84058 for ; Fri, 23 Mar 2001 18:09:59 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f2NMv9k12941 for pgsql-sql@postgresql.org; Fri, 23 Mar 2001 17:57:09 -0500 (EST) (envelope-from news) From: "Mic" X-Newsgroups: comp.databases.postgresql.sql Subject: Datatypes in Embedded SQL Date: Fri, 23 Mar 2001 23:57:27 +0100 Message-ID: <985388177.4065.0.pluto.c29fe0e4@news.demon.nl> X-NNTP-Posting-Host: sloten.demon.nl:194.159.224.228 X-Complaints-To: abuse@nl.demon.net X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Lines: 68 To: pgsql-sql@postgresql.org X-Archive-Number: 200103/503 X-Sequence-Number: 2174 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;