home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / database / oracle / 2739 < prev    next >
Encoding:
Text File  |  1993-01-09  |  1.9 KB  |  56 lines

  1. Newsgroups: comp.databases.oracle
  2. From: raph@panache.demon.co.uk (Raphael mankin)
  3. Path: sparky!uunet!pipex!demon!panache.demon.co.uk!raph
  4. Subject: Re: Pro*C / C++ ?? 
  5. Distribution: world
  6. References: <145384@lll-winken.LLNL.GOV>
  7. Organization: Solvfield Ltd.
  8. Reply-To: raph@panache.demon.co.uk
  9. X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
  10. Lines: 41
  11. Date: Fri, 8 Jan 1993 20:09:07 +0000
  12. Message-ID: <726523747snz@panache.demon.co.uk>
  13. Sender: usenet@demon.co.uk
  14.  
  15. In article <145384@lll-winken.LLNL.GOV> hudek@polaris.llnl.gov writes:
  16.  
  17. ><||>
  18. >
  19. >Question about Oracle's Pro*C precompiler:
  20. >
  21. >As I understand it and from a quick look at some output, this simply takes
  22. >source code statements that start with a key phrase (EXEC SQL...) and
  23. >translates them into C code and Oracle system calls.
  24. >
  25. >Given that, is there any reason why the output of Pro*C couldn't then be
  26. >run through Sun's C++ compiler and produce good executables? (since the
  27. >C++ compiler can obviously handle straight C code).  
  28. >
  29.  
  30. Yes you can embed SQL in C++. There are minor caveats.
  31.  
  32. 1. Function arguments and class members cannot be SQL variables (within a
  33.     DECLARE SECTION).
  34.  
  35. 2. ProC does not understand // comments.
  36.  
  37. 3. ProC generates things like:
  38.     struct sqlca sqlca;
  39.   which causes a name conflict in C++. You have to run a ``sed'' script over 
  40.   the generated C++ to substitute some of the names.
  41.  
  42. 4. You will have to include in every module, probably in a header file, a whole
  43.    raft of declarations of the form:
  44.     extern "C" void sqlxyz(...);
  45.    to link the Oracle library.
  46.  
  47. 5. You _may_ have trouble with the AT&T C++ compiler. It compiles and links
  48.    fine, but with some versions the code hangs when you connect to the DB.
  49.    g++ is OK, as are newer versions of AT&T.
  50.  
  51. 6. Be sure to have a DECLARE SECTION in file scope before any functions in
  52.    each file. This is true for C as well. Otherwise some things will be 
  53.    declared in the wrong scope.
  54. --------------
  55. Raphael Mankin            Nil taurus excretum
  56.