Subject | Re: gpre and VisualC++ |
---|---|
Author | fabrice.aeschbacher@khe.siemens.de |
Post date | 2001-05-31T09:30:35Z |
Hi,
I've been playing with GPRE / VisualC++ too, found as for me no
compile problem (as soon I understood I must include gds.h), but some
others.
When trying to pre-process the following file cs.e with gpre, I am
getting
the following error:
"D:\Program Files\Interbase\bin\gpre" -c -n -s 3 -d
Controller.gdb cs.e
(E) cs.e:59: TABLE MY_TABLE is ambiguous
1 error, no warnings
I get the same error message for every table.
Same error also occures when trying to DELETE FROM any table.
Any idea what I did wrong?
Here is the cs.e file:
#include "cs.h"
#include <stdlib.h>
#include <string.h>
void pr_error (char *operation);
EXEC SQL
BEGIN DECLARE SECTION;
char db_name[128];
/*
* Declare a database handle.
*/
EXEC SQL
SET DATABASE db = COMPILETIME "Controller.gdb" RUNTIME :db_name;
EXEC SQL
END DECLARE SECTION;
int main(ARG(int, argc), ARG(char **, argv))
ARGLIST(int argc)
ARGLIST(char **argv)
{
db = NULL;
if (argc > 1)
strcpy (db_name, argv[1]);
else
strcpy (db_name, "Controller.gdb");
/*
* Connect to the database
*/
EXEC SQL
CONNECT db;
if (SQLCODE) {
pr_error("Connect database");
return 1;
}
printf("Connected to %s\n\n", db_name);
/*
* Set MY_TABLE.CS_TASK_RUNNING to 1
*/
EXEC SQL
SET TRANSACTION READ WRITE;
EXEC SQL
UPDATE MY_TABLE
SET CS_TASK_RUNNING = 1;
if (SQLCODE) {
pr_error("Update MY_TABLE table");
return 1;
}
printf("MY_TABLE.CS_TASK_RUNNING set to 1\n\n");
EXEC SQL
COMMIT;
EXEC SQL
DISCONNECT db;
printf("Disconnected from %s\n\n", db_name);
return 0;
}
/*
* Print the status, the SQLCODE, and exit.
* Also, indicate which operation the error occured on.
*/
void pr_error(ARG(char *, operation))
ARGLIST(char *operation)
{
printf("[\n");
printf("PROBLEM ON \"%s\".\n", operation);
isc_print_status(gds__status);
printf("SQLCODE = %d\n", SQLCODE);
printf("]\n");
}
I've been playing with GPRE / VisualC++ too, found as for me no
compile problem (as soon I understood I must include gds.h), but some
others.
When trying to pre-process the following file cs.e with gpre, I am
getting
the following error:
"D:\Program Files\Interbase\bin\gpre" -c -n -s 3 -d
Controller.gdb cs.e
(E) cs.e:59: TABLE MY_TABLE is ambiguous
1 error, no warnings
I get the same error message for every table.
Same error also occures when trying to DELETE FROM any table.
Any idea what I did wrong?
Here is the cs.e file:
#include "cs.h"
#include <stdlib.h>
#include <string.h>
void pr_error (char *operation);
EXEC SQL
BEGIN DECLARE SECTION;
char db_name[128];
/*
* Declare a database handle.
*/
EXEC SQL
SET DATABASE db = COMPILETIME "Controller.gdb" RUNTIME :db_name;
EXEC SQL
END DECLARE SECTION;
int main(ARG(int, argc), ARG(char **, argv))
ARGLIST(int argc)
ARGLIST(char **argv)
{
db = NULL;
if (argc > 1)
strcpy (db_name, argv[1]);
else
strcpy (db_name, "Controller.gdb");
/*
* Connect to the database
*/
EXEC SQL
CONNECT db;
if (SQLCODE) {
pr_error("Connect database");
return 1;
}
printf("Connected to %s\n\n", db_name);
/*
* Set MY_TABLE.CS_TASK_RUNNING to 1
*/
EXEC SQL
SET TRANSACTION READ WRITE;
EXEC SQL
UPDATE MY_TABLE
SET CS_TASK_RUNNING = 1;
if (SQLCODE) {
pr_error("Update MY_TABLE table");
return 1;
}
printf("MY_TABLE.CS_TASK_RUNNING set to 1\n\n");
EXEC SQL
COMMIT;
EXEC SQL
DISCONNECT db;
printf("Disconnected from %s\n\n", db_name);
return 0;
}
/*
* Print the status, the SQLCODE, and exit.
* Also, indicate which operation the error occured on.
*/
void pr_error(ARG(char *, operation))
ARGLIST(char *operation)
{
printf("[\n");
printf("PROBLEM ON \"%s\".\n", operation);
isc_print_status(gds__status);
printf("SQLCODE = %d\n", SQLCODE);
printf("]\n");
}