简体   繁体   中英

Is there a more intelligent sql-preprocessor for Oracle than Pro*C/C++?

Does someone know if there is pre-processor for C /C++ in conjunction with Oracle that would allow me to write C or C++ code similar to:

void populateTableList(GuiList* tableList) {

     for users in ( select table_name, 
                           owner, 
                           tablespace_name
                      from dba_tables) 
     {
         tableList -> addRow(
                         users.table_name, 
                         users.owner, 
                         users.tablespace_name);
     }
 }

The main features I am looking for are

  • quasi-automatic declaration/definition of the selected values (here: users.table_name , users.owner and users.tablespace_name ) similar to the PL/SQL for loop statement and

  • an automatic fetch until finished mechanism (without explicitely calling a stmt.fetch() procedure or something) and

  • a validation of the correctnes of the sql statement at compile time.

Is there such a thing?

According to the following 9, 10, 11 pages there is no other C/C++ "precompiler" other than PRO*C/C++. There is a C/C++ programming language interface called OCI/OCCI, but technically this is not a precompiler

This page states that "OCI programs are not precompiled":

http://www.orafaq.com/wiki/Oracle_Call_Interfaces

These pages list the available C/C++ compiler tools:

9I precompiler page: http://docs.oracle.com/html/A97297_01/ch4_comp.htm

This page lists PRO*C/C++, 
and the Non C precompilers: PRO*COBOL, PRO*FORTRAN,
SQL for ADA, the OCI

10G precompiler page: See part number B25416-02 (This page Does not list any other C/C++ precompilers not already listed)

9I to 11 precompiler notes: https://blogs.oracle.com/db/entry/master_note_for_precompilers_oci_and_occi

(This page Does not list any other C/C++ precompilers not
already listed)

Ask Tom OCI/PRO*C comparison: http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:999630650601

This page shows an example that has an SQL statement with
invalid syntax being passed to OCI, through OCIStmtPrepare()
and the compile does not error.  This means that 
at the time of the OCI compile a complete syntax check
of the SQL statement is not done which is 
consistent with what I have seen.

This page states "OCI and Precompilers Support for (..)" implying that OCI does not do precompilation:

http://www.oracle.com/technetwork/database/features/oci/index.html

It looks like the code you have has SQL embedded in it. To check this code for validity at compile time would require a precompiler that has access to the data dictionary (I know PRO*C does, with a different syntax that what you have but none of the other ORACLE supported tools for C/C++ listed on the above pages do).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM