From: | Margarita Barvinok <brita(at)math(dot)lsa(dot)umich(dot)edu> |
---|---|
To: | pgsql-interfaces(at)postgreSQL(dot)org |
Subject: | [INTERFACES] Use ecpg |
Date: | 1999-01-28 15:16:00 |
Message-ID: | Pine.SOL.3.96-4hack.990128091535.15513B-100000@sewerurchin.math.lsa.umich.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
Hello All,
I just began to use postgresql-6.4.2 and ecpg (version: 2.4.4).
I try t precompile simple
code ( I took it from a book) and get this error message:
prog:17: parse error
Perhaps this is stupid error, but I have no idea what to do, because I
don't have good manual on Embedded SQL. Can I find somewhere
documentation on C-Embedded SQL?
Thanks, in advance, for any help.
-Margarita Barvinok
File prog:
/* *********************************************************** */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FAILURE 1
#define SUCCESS 0
void printError(void);
/* define the communication region */
EXEC SQL INCLUDE sqlca;
int main()
{
/* set error handler to bail out if we can't connect */
EXEC SQL WHENEVER SQLERROR
{ /* LINE 17 */
printError();
return FAILURE;
};
/* Connect to the database */
EXEC SQL CONNECT USER "dba" IDENTIFIED BY "sql";
printf("test");
EXEC SQL DISCONNECT;
return SUCCESS;
}
/*
* printError()
* function to print a description of any SQL errors
*/
void printError()
{
static char buffer[200];
printf("SQL error -- %s\n", buffer,
sqlerror_message( &sqlca, buffer, sizeof(buffer)));
}
/* ******************************************************************* */
From | Date | Subject | |
---|---|---|---|
Next Message | James Thompson | 1999-01-28 16:36:30 | Re: [INTERFACES] Use ecpg |
Previous Message | Pavel PaJaSoft Janousek | 1999-01-28 12:43:22 | EGCS & password connection |