Table of Contents
- Title and Copyright Information
- Preface
- Changes in Pro*C/C++
- Part I Introduction and Concepts
- Introduction
- What is an Oracle Precompiler?
- Why Use the Oracle Pro*C/C++ Precompiler
- Why Use SQL
- Why Use PL/SQL
- Pro*C/C++ Precompiler Benefits
- Directory Structure
- Library Files
- Frequently Asked Questions
- What is a VARCHAR?
- Does Pro*C/C++ Generate Calls to the Oracle Call Interface?
- Why Not Code Using SQLLIB Calls and Not Use Pro*C/C++?
- Can I Call A PL/SQL Stored Procedure From a Pro*C/C++ Program?
- Can I Write C++ Code, and Precompile It Using Pro*C/C++?
- Can I Use Bind Variables Anywhere in a SQL Statement?
- I Am Confused By Character Handling in Pro*C/C++.
- Is There Anything Special About Character Pointers?
- Does SPOOL Work in Pro*C/C++?
- Where Can I Find The On-line Versions of the Example Programs?
- How Can I Compile and Link My Application?
- Does Pro*C/C++ Now Support Using Structures As Host Variables?
- Is It Possible to Have Recursive Functions In Pro*C/C++ If I Use Embedded SQL In the Function?
- Can I Use Any Release of Pro*C/C++ with Any Version of the Oracle Server?
- When My Application Runs, I Keep Getting an Ora-1405 Error (Fetched Column Value Is NULL).
- Are All SQLLIB Functions Private?
- How Does Oracle Support The New Object Types?
- Compatibility, Upgrading, and Migration
- Precompiler Concepts
- Key Concepts of Embedded SQL Programming
- Steps in Developing an Embedded SQL Application
- Guidelines for Programming
- Conditional Precompilation
- Precompile Separately
- Compile and Link
- Example Tables
- Example Program: A Simple Query
- Example Program: A Simple Query using SQL99 Syntax
- Database Concepts
- Connect to the Database
- Advanced Connection Options
- Definitions of Transactions Terms
- How Data Integrity Is Ensured
- How to Begin and End Transactions
- Using the COMMIT Statement
- Using the SAVEPOINT Statement
- The ROLLBACK Statement
- The RELEASE Option
- The SET TRANSACTION Statement
- Override Default Locking
- Fetch Across COMMITs
- Distributed Transactions Handling
- Guidelines
- Datatypes and Host Variables
- Oracle Datatypes
- Host Variables
- Indicator Variables
- VARCHAR Variables
- Cursor Variables
- CONTEXT Variables
- Universal ROWIDs
- Host Structures
- Pointer Variables
- Globalization Support
- NCHAR Variables
- Handling Boolean Data
- Advanced Topics
- Character Data
- Datatype Conversion
- Datatype Equivalencing
- The C Preprocessor
- Precompiled Header Files
- The Oracle Preprocessor
- Evaluation of Numeric Constants
- SQLLIB Extensions for OCI Release 8 Interoperability
- Interface to OCI Release 8
- Embedded OCI Release 7 Calls
- New Names for SQLLIB Public Functions
- X/Open Application Development
- Embedded SQL
- Host Variables
- Indicator Variables
- The Basic SQL Statements
- Using Boolean Data Type
- The DML Returning Clause
- Cursors
- Scrollable Cursors
- Optimizer Hints
- Fix Execution Plan
- The CURRENT OF Clause
- The Cursor Statements
- A Complete Example Using Non-Scrollable Cursor
- A Complete Example Using Scrollable Cursor
- Positioned Update
- Explicit Request Boundaries for Handling Planned Maintenance
- Embedded PL/SQL
- Host Arrays
- Why Use Arrays?
- About Declaring Host Arrays
- About Using Arrays in SQL Statements
- About Selecting into Arrays
- About Inserting with Arrays
- About Updating with Arrays
- About Deleting with Arrays
- About Using the FOR Clause
- About Using the WHERE Clause
- Arrays of Structs
- Arrays of Structs Usage
- Restrictions on Arrays of Structs
- About Declaring an Array of Structs
- Variables Guidelines
- About Declaring a Pointer to an Array of Structs
- Examples
- Example 1: A Simple Array of Structs of Scalars
- Example 2: Using Mixed Scalar Arrays with An Array of Structs
- Example 3: Using Multiple Arrays of Structs with a Cursor
- Example 4: Individual Array and Struct Member Referencing
- Example 5: Using Indicator Variables, a Special Case
- Example 6: Using a Pointer to an Array of Structs
- About Mimicking CURRENT OF
- About Using Additional Array Insert/Select Syntax
- About Using Implicit Buffered Insert
- Scrollable Cursors
- Handling Runtime Errors
- The Need for Error Handling
- Error Handling Alternatives
- The SQLSTATE Status Variable
- About Declaring SQLCODE
- Key Components of Error Reporting Using the SQLCA
- Using the SQL Communications Area (SQLCA)
- About Getting the Full Text of Error Messages
- About Using the WHENEVER Directive
- About Obtaining the Text of SQL Statements
- About Using the Oracle Communications Area (ORACA)
- Precompiler Options
- The Precompiler Command
- Precompiler Options
- Quick Reference
- Entering Options
- About Data Use Case Domain Metadata Support
- About Using the Precompiler Options
- AUTO_CONNECT
- CHAR_MAP
- CINCR
- CLOSE_ON_COMMIT
- CMAX
- CMIN
- CNOWAIT
- CODE
- COMMON_PARSER
- COMP_CHARSET
- CONFIG
- CPOOL
- CPP_SUFFIX
- CTIMEOUT
- DB2_ARRAY
- DBMS
- DEF_SQLCODE
- DEFINE
- DURATION
- DYNAMIC
- ERRORS
- ERRTYPE
- EVENTS
- FIPS
- HEADER
- HOLD_CURSOR
- IMPLICIT_SVPT
- INAME
- INCLUDE
- INTYPE
- LINES
- LNAME
- LTYPE
- MAX_ROW_INSERT
- MAXLITERAL
- MAXOPENCURSORS
- MODE
- NATIVE_TYPES
- NLS_CHAR
- NLS_LOCAL
- OBJECTS
- ONAME
- ORACA
- OUTLINE
- OUTLNPREFIX
- PAGELEN
- PARSE
- PLAN_BASELINE
- PLAN_PREFIX
- PLAN_RUN
- PLAN_FIXED
- PLAN_ENABLED
- MEMFORPREFETCH
- PREFETCH
- RELEASE_CURSOR
- RUNOUTLINE
- SELECT_ERROR
- SPOOL
- STMT_CACHE
- SYS_INCLUDE
- THREADS
- TYPE_CODE
- UNSAFE_NULL
- USERID
- UTF16_CHARSET
- VARCHAR
- VERSION
- Multithreaded Applications
- Introduction
- Part II Applications
- C++ Applications
- Oracle Dynamic SQL
- What is Dynamic SQL?
- Advantages and Disadvantages of Dynamic SQL
- When to Use Dynamic SQL
- Requirements for Dynamic SQL Statements
- How Dynamic SQL Statements are Processed
- Methods for Using Dynamic SQL
- Using Method 1
- Using Method 2
- Using Method 3
- Using Method 4
- About Using the DECLARE STATEMENT Statement
- About Using PL/SQL
- Dynamic SQL Statement Caching
- About Boolean Data Type Support
- ANSI Dynamic SQL
- Oracle Dynamic SQL: Method 4
- Meeting the Special Requirements of Method 4
- Understanding the SQLDA
- About Using the SQLDA Variables
- Some Preliminaries
- The Basic Steps
- A Closer Look at Each Step
- Declare a Host String
- Declare the SQLDAs
- Allocate Storage Space for the Descriptors
- Set the Maximum Number to DESCRIBE
- Put the Query Text in the Host String
- PREPARE the Query from the Host String
- DECLARE a Cursor
- DESCRIBE the Bind Variables
- Reset Number of Placeholders
- Get Values and Allocate Storage for Bind Variables
- OPEN the Cursor
- DESCRIBE the Select List
- Reset Number of Select-List Items
- Reset Length/Datatype of Each Select-list Item
- FETCH Rows from the Active Set
- Get and Process Select-List Values
- Deallocate Storage
- CLOSE the Cursor
- About Using Host Arrays
- sample12.pc
- About Using Domain Metadata
- Example Program: Dynamic SQL Method 4
- Sample Program : Dynamic SQL Method 4 using Scrollable Cursors
- LOBs
- Objects
- Introduction to Objects
- About Using Object Types in Pro*C/C++
- The Object Cache
- Associative Interface
- Navigational Interface
- Converting Object Attributes and C Types
- Object Options Set/Get
- New Precompiler Options for Objects
- An Object Example in Pro*C/C++
- Example Code for Type Inheritance
- Example Code for Navigational Access
- About Using C Structures
- About Using REFs
- About Using OCIDate, OCIString, OCINumber, and OCIRaw
- Summarizing the New Database Types in Pro*C/C++
- Restrictions on Using Oracle Datatypes in Dynamic SQL
- Collections
- The Object Type Translator
- OTT Overview
- What is the Object Type Translator
- Using OTT with OCI Applications
- About Using OTT with Pro*C/C++ Applications
- OTT Reference
- User Exits
- What Is a User Exit?
- Why Write a User Exit?
- About Developing a User Exit
- About Writing a User Exit
- EXEC TOOLS Statements
- About Calling a User Exit
- About Passing Parameters to a User Exit
- About Returning Values to a Form
- An Example of Using User Exits
- About Precompiling and Compiling a User Exit
- Example Program: A User Exit
- About Using the GENXTB Utility
- About Linking a User Exit into SQL*Forms
- Guidelines
- Appendixes
- Reserved Words, Keywords, and Namespaces
- Performance Tuning
- What Causes Poor Performance?
- How Can Performance Be Improved?
- About Using Host Arrays
- About Using Embedded PL/SQL
- About Optimizing SQL Statements
- About Statement Caching
- About Using Indexes
- About Taking Advantage of Row-Level Locking
- About Eliminating Unnecessary Parsing
- About Avoiding Unnecessary Reparsing
- About Using Connection Pooling
- About Session Pooling
- About Using Oracle Connection Manager in Traffic Director Mode
- Syntactic and Semantic Checking
- System-Specific References
- System-Specific Information
- Location of Standard Header Files
- About Specifying Location of Included Files for the C Compiler
- ANSI C Support
- Struct Component Alignment
- Size of an Integer and ROWID
- Byte Ordering
- About Connecting to the Oracle Server
- About Linking in an XA Library
- Location of the Pro*C/C++ Executable
- System Configuration File
- INCLUDE Option Syntax
- About Compiling and Linking
- User Exits
- System-Specific Information
- Embedded SQL Statements and Directives
- Summary of Precompiler Directives and Embedded SQL Statements
- About The Statement Descriptions
- How to Read Syntax Diagrams
- ALLOCATE (Executable Embedded SQL Extension)
- ALLOCATE DESCRIPTOR (Executable Embedded SQL)
- CACHE FREE ALL (Executable Embedded SQL Extension)
- CALL (Executable Embedded SQL)
- CLOSE (Executable Embedded SQL)
- COLLECTION APPEND (Executable Embedded SQL Extension)
- COLLECTION DESCRIBE (Executable Embedded SQL Extension)
- COLLECTION GET (Executable Embedded SQL Extension)
- COLLECTION RESET (Executable Embedded SQL Extension)
- COLLECTION SET (Executable Embedded SQL Extension)
- COLLECTION TRIM (Executable Embedded SQL Extension)
- COMMIT (Executable Embedded SQL)
- CONNECT (Executable Embedded SQL Extension)
- CONTEXT ALLOCATE (Executable Embedded SQL Extension)
- CONTEXT FREE (Executable Embedded SQL Extension)
- CONTEXT OBJECT OPTION GET (Executable Embedded SQL Extension)
- CONTEXT OBJECT OPTION SET (Executable Embedded SQL Ext)
- CONTEXT USE (Oracle Embedded SQL Directive)
- DEALLOCATE DESCRIPTOR (Embedded SQL Statement)
- DECLARE CURSOR (Embedded SQL Directive)
- DECLARE DATABASE (Oracle Embedded SQL Directive)
- DECLARE STATEMENT (Embedded SQL Directive)
- DECLARE TABLE (Oracle Embedded SQL Directive)
- DECLARE TYPE (Oracle Embedded SQL Directive)
- DELETE (Executable Embedded SQL)
- DESCRIBE (Executable Embedded SQL Extension)
- DESCRIBE DESCRIPTOR (Executable Embedded SQL)
- ENABLE THREADS (Executable Embedded SQL Extension)
- EXECUTE ... END-EXEC (Executable Embedded SQL Extension)
- EXECUTE (Executable Embedded SQL)
- EXECUTE DESCRIPTOR (Executable Embedded SQL)
- EXECUTE IMMEDIATE (Executable Embedded SQL)
- FETCH (Executable Embedded SQL)
- FETCH DESCRIPTOR (Executable Embedded SQL)
- FREE (Executable Embedded SQL Extension)
- GET DESCRIPTOR (Executable Embedded SQL)
- INSERT (Executable Embedded SQL)
- LOB APPEND (Executable Embedded SQL Extension)
- LOB ASSIGN (Executable Embedded SQL Extension)
- LOB CLOSE (Executable Embedded SQL Extension)
- LOB COPY (Executable Embedded SQL Extension)
- LOB CREATE TEMPORARY (Executable Embedded SQL Extension)
- LOB DESCRIBE (Executable Embedded SQL Extension)
- LOB DISABLE BUFFERING (Executable Embedded SQL Extension)
- LOB ENABLE BUFFERING (Executable Embedded SQL Extension)
- LOB ERASE (Executable Embedded SQL Extension)
- LOB FILE CLOSE ALL (Executable Embedded SQL Extension)
- LOB FILE SET (Executable Embedded SQL Extension)
- LOB FLUSH BUFFER (Executable Embedded SQL Extension)
- LOB FREE TEMPORARY (Executable Embedded SQL Extension)
- LOB LOAD (Executable Embedded SQL Extension)
- LOB OPEN (Executable Embedded SQL Extension)
- LOB READ (Executable Embedded SQL Extension)
- LOB TRIM (Executable Embedded SQL Extension)
- LOB WRITE (Executable Embedded SQL Extension)
- OBJECT CREATE (Executable Embedded SQL Extension)
- OBJECT DELETE (Executable Embedded SQL Extension)
- OBJECT DEREF (Executable Embedded SQL Extension)
- OBJECT FLUSH (Executable Embedded SQL Extension)
- OBJECT GET (Executable Embedded SQL Extension)
- OBJECT RELEASE (Executable Embedded SQL Extension)
- OBJECT SET (Executable Embedded SQL Extension)
- OBJECT UPDATE (Executable Embedded SQL Extension)
- OPEN (Executable Embedded SQL)
- OPEN DESCRIPTOR (Executable Embedded SQL)
- PREPARE (Executable Embedded SQL)
- REGISTER CONNECT (Executable Embedded SQL Extension)
- ROLLBACK (Executable Embedded SQL)
- SAVEPOINT (Executable Embedded SQL)
- SELECT (Executable Embedded SQL)
- SET DESCRIPTOR (Executable Embedded SQL)
- TYPE (Oracle Embedded SQL Directive)
- UPDATE (Executable Embedded SQL)
- VAR (Oracle Embedded SQL Directive)
- WHENEVER (Embedded SQL Directive)
- Sample Programs
- Integrating Pro*C/C++ into Microsoft Visual Studio .NET