[comp.databases] ESQL/C in ORACLE: bug ??

geissler@D012S050@ap542.uucp (Norbert Geissler) (04/29/91)

We use an UNIX V.2 derivate called SINIX 5.22 and a NSC 32532 machine (MX300).
Using PRO*C V1.3.15.1.2 with ORACLE V6.0.31
we get an interesting problem:

If we declare the parameter of a C-function as ESQL/C hostvariable,
the precompiler generates code which is not compilable with our
C-Compiler due to generation of illegal static declarations in C.
Example:

	ESQL/C                          C generated by precompiler

prsqlca(s,sqlca)                        prsqlca(s,sqlca)
EXEC SQL BEGIN DECLARE SECTION;         /* SQL stmt #3
char *s;                                EXEC SQL BEGIN DECLARE SECTION;
EXEC SQL END DECLARE SECTION;           */
struct sqlca *sqlca;                    char *s;
{                                       /* SQL stmt #4
/* body */                              EXEC SQL END DECLARE SECTION;
}                                       */
					static int SQLTM[8];
					static int sqlusi[1] = {
					0};
					static int SQLBT0 = 1;
					static int SQLBT1 = 2;
					static int SQLBT2 = 4;
					static int SQLBT3 = 9;
					static unsigned long sqlvsn = 10315;
					static int IAPSUCC = 0;
					static int IAPFAIL = 1403;
					static int IAPFTL  = 535;
					extern  void  sqliem();
					struct sqlca *sqlca;
					{
					/* body */
					}

Our ORACLE hotline can't answer our questions, so we ask you:

1) Is it possible to declare a parameter of a C-function as
   ESQL/C hostvariable in PRO*C ? (ESQL/C from other DBMS allows it !)

2) The precompiler creates a lot of static declarations there.
   What are they for ?

3) Is this a bug ??


Thanks in advance !

---
Norbert Geissler, SIEMENS-NIXDORF AG, SNI AP 154, Munich, Germany
UUCP: geissler@ap542.uucp       INTERNET: geissler%ap542@ztivax.siemens.com
..for chess, that superb, cold, infinitely satisfying anodyne to life, I feel
the ardour of a lover, the humility of a disciple.  (Herbert Russel Wakefield)

cdm@INEL.GOV (Dale Cook) (05/03/91)

In article <1991Apr29.153133.9717@ap542.uucp> you write:
|> We use an UNIX V.2 derivate called SINIX 5.22 and a NSC 32532 machine (MX300).
|> Using PRO*C V1.3.15.1.2 with ORACLE V6.0.31
|> we get an interesting problem:
|> 
|> If we declare the parameter of a C-function as ESQL/C hostvariable,
|> the precompiler generates code which is not compilable with our
|> C-Compiler due to generation of illegal static declarations in C.
|> 
|> Our ORACLE hotline can't answer our questions, so we ask you:
|> 
|> 1) Is it possible to declare a parameter of a C-function as
|>    ESQL/C hostvariable in PRO*C ? (ESQL/C from other DBMS allows it !)
|> 

I've never tried it, but there's nothing in the documentation which 
explicitly prohibits it.

|> 2) The precompiler creates a lot of static declarations there.
|>    What are they for ?
|> 

They are values Oracle says will be available for your use when you use
embedded SQL calls.  I believe you are probably getting them because you
have not created a *global* BEGIN/END DECLARE SECTION pair in your compiled
unit.  In our documentation (PRO*C Supplement V 1.3) on page 1-5 under the
"DECLARE SECTION", last sentence on the page it says "You can define declare
sections globally or locally but you must define at least one global declare
section even if it holds no declarations."

|> 3) Is this a bug ??
|> 

I don't think so.  It is due to a certain vagueness that permeates Oracle
documentation.

Hope this helps.



----------------------------------------------------------------------
--- Dale Cook          "I may not have made much money, but BY GOD,
    cdm@inel.gov        I never talked to no pigs, neither." -J. Spoon
The opinions are mine.  The following disclaimer is my employers.
----------------------------------------------------------------------
========== long legal disclaimer follows, press n to skip ===========

Neither the United States Government or the Idaho National Engineering
Laboratory or any of their employees, makes any warranty, whatsoever,
implied, or assumes any legal liability or responsibility regarding any
information, disclosed, or represents that its use would not infringe
privately owned rights.  No specific reference constitutes or implies
endorsement, recommendation, or favoring by the United States
Government or the Idaho National Engineering Laboratory.  The views and
opinions expressed herein do not necessarily reflect those of the
United States Government or the Idaho National Engineering Laboratory,
and shall not be used for advertising or product endorsement purposes.