community.borland.com

Article #25389: Trying to use the -d(atabase) compile switch with GPRE

Problem:
Getting an error when trying to use the  -d(atabase) 
switch with GPRE in an embedded application that 
uses explicit database handle declarations.

 

Solution:
The (-d) option should only be used when you want 
GPRE to handle the 'database handle' stuff.  If you 
are naming them yourself you should NOT use (-d) 
in your compile line.

In the case I dealt with the customer was getting the 
following error:

/usr/interbase/bin/gpre -m -c -n -d vob_db_schema.gdb ../db__str.e
 db__str.c
 (E) ../db__str.e:545: PROCEDURE str_delete is ambiguous
 1 error, no warnings
 
Gpre is telling you that it finds the 'database handle' 
ambiguous.  I tested this with the following slice of code.

Example of using "explicit" database handles.  DO NOT 
USE the -d(atabase) switch at compile time.

compile line:
gpre -z -e -n -c test.e 

file 
-----

#include "ibase.h"

main()
{

 EXEC SQL
  SET DATABASE My_Handle = "employee.gdb";

 EXEC SQL
  CONNECT My_Handle;

 EXEC SQL
  EXECUTE PROCEDURE DELETE_EMPLOYEE 145;

}

----

Example of NOT using "explicit" database handles.  USE the 
-d(atabase) switch at compile time.

compile lines:
gpre -z -e -n -c -d employee.gdb test1.e

file 
-----
#include "ibase.h"

 EXEC SQL 
  BEGIN DECLARE SECTION;

 EXEC SQL 
  END DECLARE SECTION; 

main()
{

int EMP_NO;

 EXEC SQL
  EXECUTE PROCEDURE DELETE_EMPLOYEE 145;

}

----

Last Modified: 29-SEP-00