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)));
}
/* ******************************************************************* */