From: | "Ligia Pimentel" <lmpimentel(at)yahoo(dot)com> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Core dump when I run a program that uses embedded sql |
Date: | 2001-08-29 16:08:24 |
Message-ID: | 9mj7rp$14t2$1@news.tht.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | DI Hasenöhrl | 2001-08-29 19:51:37 | link tables from DB1 to DB2 |
Previous Message | Marc G. Fournier | 2001-08-29 15:00:38 | List archives moved and cleaned up ... |