[INTERFACES] Use ecpg - Mailing list pgsql-interfaces

From Margarita Barvinok
Subject [INTERFACES] Use ecpg
Date
Msg-id Pine.SOL.3.96-4hack.990128091535.15513B-100000@sewerurchin.math.lsa.umich.edu
Whole thread Raw
Responses Re: [INTERFACES] Use ecpg
Re: [INTERFACES] Use ecpg
List 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)));
}

/* ******************************************************************* */






pgsql-interfaces by date:

Previous
From: Alessandro Baldoni
Date:
Subject: Binary cursors and arrays
Next
From: James Thompson
Date:
Subject: Re: [INTERFACES] Use ecpg