Core dump when I run a program that uses embedded sql - Mailing list pgsql-interfaces

From Ligia Pimentel
Subject Core dump when I run a program that uses embedded sql
Date
Msg-id 9mj7rp$14t2$1@news.tht.net
Whole thread Raw
Responses Re: Core dump when I run a program that uses embedded sql
List pgsql-interfaces
Hello.
I'm using postgres 7.1, and I'm on my first try to use embedded sql. Here's
my problem.

I'm trying to use an example I copied from the web:

/**************************************************  Example program  for embedded SQL:
tryit.pgc**************************************************/

#include <stdio.h>

EXEC SQL INCLUDE sqlca;

main () {   EXEC SQL BEGIN DECLARE SECTION;   int sup_id;   int sales;   int total;   float price;   VARCHAR
cof_name[33];  EXEC SQL END DECLARE SECTION;
 
   EXEC SQL CONNECT 'TarjetaDebito' ;   if(sqlca.sqlcode) {      printf("Error al connectar a la base de datos.\n");
exit(0);   }
 
   printf("Solicitud: ");   scanf("%d", &sup_id);
   EXEC SQL SELECT nombreenplastico, correlativo INTO :cof_name, :price                 FROM tarjeta WHERE correlativo
=:sup_id ;   if (sqlca.sqlcode==0) {      printf("Result: %s tarjeta con solicitud  $%5.2f\n", cof_name.arr,
 
price);   }   else {      printf("Error #%d: %s\n", sqlca.sqlerrm.sqlerrml,
sqlca.sqlerrm.sqlerrmc);   }
}

Nothing fancy as you can see... (of course I changed the names of the tables
and the fields to be able to find them on my server).

Then I precompile it (ecpg ...) successfully, and after that I compile it
with gcc (also everything OK aparently), and when I try to run my program, I
get
SEGMENTATION FAULT (core dumped).

I don't know where to start. Could you help me?

Thank you.

Ligia Pimentel





pgsql-interfaces by date:

Previous
From: "Billy G. Allie"
Date:
Subject: Re: PQgetvalue and User defined types/Arrays fields
Next
From: Peter Wasem
Date:
Subject: JDBC: Exception when calling ResultSet.previous()