Обсуждение: Embedded SQL in 'C' (cursors)
Does anyone know how to open a cursor for 'C" ..?
I have checked the previous postings but cannot locate the proper syntax
here is a snipit :
void ShowTable_type(){
EXEC SQL BEGIN DECLARE SECTION;
char *Atid; // variables to retrieve the table info
char *Adesc;
EXEC SQL END DECLARE SECTION;
EXEC SQL CONNECT 'nathan';
EXEC SQL DECLARE lets_get_tid CURSOR FOR
SELECT type.tid;
printf("Choose the TID to delete\n\n<TID> \n");
do{
EXEC SQL OPEN lets_get_tid;
EXEC SQL FETCH lets_get_tid INTO //line 255
:Atid;
printf("%s",Atid);
}while(SQLCODE != SQLEND);
EXEC SQL CLOSE lets_get_tid;
}
What am I doing wrong ..? here what happens when I rund ecpg :
ecpg 4sql.c -o 4comp.c
4sql.c:124: parse error
make: *** [sql] Error 255
Please if anyone has any ideas please let me know.
Thank you
Nathan
On Thu, 3 Jun 1999 nathan@khmere.com wrote: > Does anyone know how to open a cursor for 'C" ..? > If you download the source code for postgresql there are test programs located in the src/interfaces/ecpg/test directory. These files are about the best learning tools I found for ecpg usage. IIRC There is an example of cursor usage in one of .pgc files. ->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-< James Thompson 138 Cardwell Hall Manhattan, Ks 66506 785-532-0561 Kansas State University Department of Mathematics ->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<