Re: Fastest: Embedded SQL or OCI ?
Date: 1996/02/28
Message-ID: <4h2iv4$66l_at_news.mpd.tandem.com>#1/1
charlotte_at_parmo.u-net.com (Thomas Christensen) wrote:
>
>As far as I know the ProC preprocessor only converts the embedded SQL
>into OCI calls, so it's basically the same.
>
I haven't used Pro*C in several years, but I once compared the translated
output from the Pro*C preprocessor to equivalent code written using the
OCI and the function calls were _not_ the same. The compiled code using
Pro*C was larger and slower. However, this was 3 years ago, so my information
may be out of date.
I prefer using the OCI for three reasons not related to performance:
- You're not mixing two different languages together. There's a certain cognitive dissonance that results from having SQL statements appear in the middle of your C/C++ code. Using the OCI is like using any other C library; the SQL statements are just character string arguments.
- I have had to write a lot of dynamic SQL. Dynamic SQL is unbelievably complex and painful using Pro*C - not to mention slooooow - but is relatively straightforward using the OCI.
- It's a lot easier to integrate the OCI into C++. You can write some simple wrapper classes around the OCI and have a low-level C++ class library for Oracle. You can then take that library and abstract it to a database-independent library that can provide a common interface to Oracle and, say, Sybase (and yes, I have done this).
Embedded SQL was a great advance in the COBOL/PL-1/Fortran era. It may still be a good answer when you have to support an application that is written in different languages on different platforms. But if you're using C or C++, it seems to me that a function call interface like the OCI is better.
Chip
Chip Received on Wed Feb 28 1996 - 00:00:00 CET
