Core dump when I run a program that uses embedded sql
От | Ligia Pimentel |
---|---|
Тема | Core dump when I run a program that uses embedded sql |
Дата | |
Msg-id | 9mj7rp$14t2$1@news.tht.net обсуждение исходный текст |
Ответы |
Re: Core dump when I run a program that uses embedded sql
|
Список | 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 по дате отправления: