[Info-Ingres] Embedded SQL
kodaliece at gmail.com
kodaliece at gmail.com
Fri Mar 23 00:10:47 CDT 2007
Hi,
Following the Embedded SQL program I've written:
#include <stdio.h>
EXEC SQL INCLUDE SQLCA;
void main()
{
EXEC SQL CONNECT causp;
EXEC SQL WHENEVER SQLERROR STOP;
EXEC SQL DELETE FROM skeletons WHERE id = 40;
EXEC SQL DISCONNECT;
}
After writing this I've used the command : esqlc TestKt.sc. This
command generated the TestKT.c file.
TestKT.c is as follows:
# include "C:\IngresII\ingres\files\eqdef.h"
#include <stdio.h>
# include "C:\IngresII\ingres\files\eqsqlca.h"
__declspec(dllimport) IISQLCA sqlca; /* SQL Communications Area
*/
void main()
{
/* # line 7 "TestKT.sc" */ /* connect */
{
IIsqInit(&sqlca);
IIsqConnect(0,"causp",(char *)0, (char *)0, (char *)0, (char *)0,
(char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0,
(char *)0, (char *)0, (char *)0);
}
/* # line 11 "TestKT.sc" */ /* delete */
{
IIsqInit(&sqlca);
IIwritio(0,(short *)0,1,32,0,"delete from skeletons where
id=40");
IIsyncup((char *)0,0);
if (sqlca.sqlcode < 0)
IIsqStop(&sqlca);
}
/* # line 13 "TestKT.sc" */ /* disconnect */
{
IIsqInit(&sqlca);
IIsqDisconnect();
if (sqlca.sqlcode < 0)
IIsqStop(&sqlca);
}
/* # line 14 "TestKT.sc" */ /* host code */
}
When I try to run this file using TurboC I am getting the following
errors:
ERROR D:\TestKT.c 4: 'sqlca' not an argument in function __declspec
ERROR D:\TestKT.c 6: 'main' not an argument in function __declspec
ERROR D:\TestKT.c 6: Declaration syntax error in function __declspec
Thanks
Mohan
More information about the Info-Ingres
mailing list