# Oracle, Odbc and DB2-CLI Template Library, Version 3.2

# What's New

# Rlogon() and otl_connect() constructor were enhanced with the auto_commit parameter

For more detail, see the rlogon() function and examples 46, 47, 48. The archived version of the OTL Programmer's Guide was updated.

# direct_exec() now returns a rows processed count; otl_stream::get_rpc() was added, it returns a rows processed count

For more detail, see get_rpc(), direct_exec(), and examples 43, 44, 45. The archived version of the OTL Progermmer's Guide was updated.

# OTL namespaces have been streamlined in OTL 3.1.30

For more detail, see OTL namespaces and example 42.

# Example 42 was added to demonstrate how to use more than one instance of OTL (e.g. OTL/ODBC and OTL/OCI8) and OTL namespaces

In order to see the example, click here. This new example demonstrates how to connect to both MS SQL Server and Oracle 8, creates tables in both, fill out the source table in MS SQL, and then copy it over to the target table in Oracle 8. Click here for more detail on the OTL namespaces. The archived version of the OTL Programmer's was updated.

# Example 41 was added to the list of examples in order to demonstrate how to do UPDATEs with CLOBs in Oracle 8

In order to see the example, click here. This new example demonstrates UPDATEs with CLOBs in Oracle 8. UPDATEs with BLOBs are similar to the UPDATEs with CLOBs if the word clob is replaced with the word blob. Also, the archived version of the OTL Progermmer's Guide was updated.

# OTL Header file is available for download

In order to dowload the OTL header file, click here.

# OTL Programmer's Guide is available in the archived format for download

In order to dowload the OTL Programmer's Guide, click here.

# OTL 3.0.26 in comparsion with OTL 3.0.20

In this release, a new data container was introduced: otl_datetime.. For more detail, see examples 38, 39 and 40. Otl_datetime is unified for both OCIx and ODBC, meaning that it can be used uniformly across the board.

NOTE. Important change in the OTL behavior: Oracle DATE [table] columns do not get mapped to the string variables any longer. They get mapped to the Oracle internal [7-byte] date format and can be read/written with the use otl_datetime variables. If need be, Oracle DATE has to be converted into the string format and back expilcitly with the help of TO_CHAR() and TO_DATE() functions, directly in SQL statements or PL/SQL blocks.

# OTL 3.0.20 in comparsion with OTL 3.0.19

In this release, a major effort was made to clean up as many compilation warnings as possible, to make OTL compilable at the level of C++ compiler warnings set to its maximum: typical warnings like unused arguments in function, typecasting, missing assigment operators or copy constructors, etc. Also, examples 35, 36 and 37 were added to the list of OTL examples in order to demonstrate the use of the otl_nocommit_stream class.

# OTL 3.0.19 in comparsion with OTL 3.0.16

In this release, OTL 3.1/ODBC was made compliant with the ODBC 3.x specification. In other words, older (ODBC 2.x) function calls were replaced with ODBC 3.x function calls, to straighten out the behavior of OTL 3.1/ODBC when it's connected to MS SQL Server 7.0. This is really an internal enchance of the library.

# OTL 3.0.16 in comparsion with OTL 3.0.0

In this release, a new class was introduced: otl_nocommit_stream. This class is a derivative of the otl_stream class. otl_nocommit_stream supports all features, supported by otl_stream, but it hehaves differently. otl_nocommit_stream does not commit transactions, as apposed to otl_stream that commits transactions by default.

# OTL 3.0 in comparison with OTL 2.x (updated 11/20/1999)

This version of the OTL is compatible with the OTL/ODBC 2.x and OTL/OCI 2.x series when otl_stream's, otl_connect's and otl_exception's are used. Support of low level features has been discontinued in this version.

The OTL 2.x/ODBC as well as OTL 2.x/OCI had the STL compliant otl_stream input and output iterators. Because of the low demand (I recevied too few requests on that) this feature has been discontinued. The iterators are based on the SGI STL. The old otl_iter.h header file can be used with the OTL 3.0, though.

The main difference between the OTL 3.1 and the OTL 2.x releases is that the OTL/OCI 2.x and the OTL/ODBC 2.x were integrated into a single library. A new, completely templatized framework was developed. Also, a series of so called OTL-adaptors was developed for the following database API's:

- Oracle Call Interface 7 (OCI7)
- Oracle Call Interface 8 (OCI8)
- Open DataBase Connectivity (ODBC)

A complete set of functions was developed to manipulate with Large Object (LOB) columns. In particular, the following datatypes are supported:

- MS SQL TEXT and IMAGE
- Sybase TEXT and IMAGE
- Oracle 7 LONG and LONG RAW
- LONG and LONG RAW in Oracle 8 as well as CLOB and BLOB

In otl_exception, a new field was introduced:

       char var_info[256]

It contains variable specific information in case if the following otl_exception is raised in the otl_stream operators >> or <<: "Incompatible datatypes in stream operation." It is useful when debugging operations with otl_streams. The var_info field provides a placeholder name (say, in an INSERT statement) or a relative number of an output column in a SELECT statement. Also, the var_info provides information on both the datatype of the placeholder/output column and the datatype of the actual parameter in the otl_stream operator to be used.

stm_text is no longer a char* pointer, it was replaced with the straight char stm_text[2048] array. First 2047 bytes of a SQL statement are copied over from an otl_stream (or constant statement) into the stm_text container.

In the OTL 3.1 instantiated from the template framework and the OTL-adaptor for ODBC (OTL 3.0/ODBC for short), a new placeholder notation is supported, similar to Oracle type style placeholders:

           "INSERT INTO test_tab VALUES(:f1<int>,:f2<char[33]>)"

In the OTL 2.x for ODBC, the placeholder notation was a little bit different:

           "INSERT INTO test_tab VALUES(:1<int>,:2<char[33]>)"

It is still possible to use the old notation in OTL3.0/ODBC but it is recommended to use the new placeholder notation since it is compatibel with the placeholder notation for OTL3.0/OCIx. It will make source code more portable across databases.

The only limitation on the new style ODBC placeholders is that it is not allowed to refer to the same placeholder in a SQL statement more than once. For example, the following SQL statement works in the OTL 3.0/OCI but it does not work in the OTL 3.0/ODBC:

        "SELECT * "
        "FROM test_tab "
        "WHERE f1>=:f1<int> "
        "  AND f1<=:f1*2 "

In the OTL 3.0/ODBC, it needs to be rewritten this way:

        "SELECT * "
        "FROM test_tab "
        "WHERE f1>=:f11<int> "
        "  AND f1<=:f12<int>*2 "

This is necessary in order to make each placeholder unique. This limitation is actually imposed by the ODBC standard. Placeholders in ODBC are positional, for example:

        "SELECT * "
        "FROM test_tab "
        "WHERE f1>= ? "
        "  AND f1<= ? * 2 "

So, the first question mark in the statement above is placeholder number 1. The second question mark is placeholder number 2.

Several new functions were introduced in the otl_stream and otl_connect classes. For example, in the OTL 3.0/ODBC:

             db.set_timeout(<X seconds>);

This function sets a timeout on a connect object. The function has no effect in the OTL 3.0/OCI. It works with ODBC only. If, in the future, OCI provides client side timeout functionality, the function will have an actual implementation.

See the OTL 3.0 manual or more detail.

## How to compile OTL 3.0

The following macro definitions (#define's) need to be defined in order to instantiate different implementations of the OTL 3.0:

- OTL_ODBC (for ODBC)
- OTL_ORA7 (for OCI7)
- OTL_ORA8 (for OCI8)

## New namespace naming convensions

By default, there is no namespace defined in the OTL 3.0. If need be, each instantiation (OCI7, OCI8 or ODBC) of the OTL 3.0 can be wrapped up with a separate namespace. See the OTL header file for more detail.

## New data container for Large Objects

otl_long_string class was introduced in the OTL 3.0 to hold Large Object values: TEXT's, IMAGE's, LONG's, LONG RAW's, CLOB's, BLOB's. The OTL 2.1/ODBC had the otl_long_string class but in the OTL 3.0 the class was generalized to contain any Large Objects

Two new placeholder datatypes were introduced:

- varchar_long (to declare TEXT (MS SQL, Sybase), LONG (Oracle 7/8) variables)
- raw_long (to declare IMAGE (MS SQL, Sybase), LONG RAW (Oracle 7/8) variables)
- clob (to declare CLOB (Oracle 8) variables)
- blob (to declare BLOB (Oracle 8) variables)

See the OTL 3.0 manual and the header file for more detail.

Go Home

Copyright © 1996, 2007, Sergei Kuchin, email: skuchin@ispwest.com, skuchin@gmail.com
.

Permission to use, copy, modify and redistribute this document for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies.