Previous Page TOC Index Next Page



GUIDELINES FOR CALLING FUNCTIONS


This chapter describes the general characteristics of ODBC functions, determining driver conformance levels, the role of the Driver Manager, ODBC function arguments, and the values ODBC functions return.

General Information

Each SOLID SQL API and ODBC function name starts with the prefix "SQL." Each function accepts one or more arguments. Arguments are defined as input (to the driver) or output (from the the driver).

C programs that call ODBC functions must include the SQL.H, SQLEXT.H, and WINDOWS.H header files. These files define Windows and ODBC constants and types and provide function prototypes for all ODBC functions.

C programs that call SOLID SQL API functions must include the CLI0CORE.H, CLI0DEFS.H, CLI0ENV.H and CLI01EXT1.H header files. These files define constants and types and provide function prototypes for all SOLID SQL API functions.

Determining Driver Conformance Levels

ODBC defines conformance levels for drivers in two areas: the ODBC API and the ODBC SQL grammar (which includes the ODBC SQL data types). These levels establish standard sets of functionality. By inquiring the conformance levels supported by a driver, an application can easily determine if the driver provides the necessary functionality. For a complete discussion of ODBC conformance levels, see "ODBC Conformance Levels" in Chapter 1, "ODBC Theory of Operation."


Note The following sections refer to SQLGetInfo and SQLGetTypeInfo, which are part of the Level 1 API conformance level. Although it is strongly recommended that drivers support this conformance level, drivers are not required to do so. If these functions are not supported, an application developer must consult the driver documentation to determine its conformance levels.

Determining API Conformance Levels

ODBC functions are divided into core functions, which are defined in the X/Open and SQL Access Group Call Level Interface specification, and two levels of extension functions, with which ODBC extends this specification. To determine the function conformance level of a driver, an application calls SQLGetInfo with the SQL_ODBC_SAG_CLI_CONFORMANCE and SQL_ODBC_API_CONFORMANCE flags. Note that a driver can support one or more extension functions but not conform to ODBC extension Level 1 or 2. To determine if a driver supports a particular function, an application calls SQLGetFunctions. Note that SQLGetFunctions is implemented by the Driver Manager and can be called for any driver, regardless of its level.

Determining SQL Conformance Levels

The ODBC SQL grammar, which includes SQL data types, is divided into a minimum grammar, a core grammar, which corresponds to the X/Open and SQL Access Group SQL CAE specification (1992), and an extended grammar, which provides common extensions to SQL. To determine the SQL conformance level of a driver, an application calls SQLGetInfo with the SQL_ODBC_SQL_CONFORMANCE flag. To determine whether a driver supports a specific SQL extension, an application calls SQLGetInfo with a flag for that extension. For more information, see Appendix C, "SQL Grammar." To determine whether a driver supports a specific SQL data type, an application calls SQLGetTypeInfo.

Using the Driver Manager

The Driver Manager is a DLL that provides access to ODBC drivers. An application typically links with the Driver Manager import library (ODBC.LIB) to gain access to the Driver Manager.


Application accessing SOLID SQL API directly bypass the Driver Manager and cannot therefore use ODBC functions that are implemented in the Driver Manager.

Whenever an application calls an ODBC function, the Driver Manager performs one of the following actions:

Dynamic SQL

Dynamic SQL, which is included in the most recent ANSI specification, allows an application to generate and execute SQL statements at run time.

Dynamic SQL statements can be prepared. When a statement is prepared, the database environment generates an access plan and a description of the result set. The statement can be executed multiple times with the previously generated access plan, which minimizes processing overhead.

Parameters can be included in dynamic SQL statements. Parameters function in much the same way as host variables in embedded SQL. Prior to execution, assign values to the place held by each parameter. Unlike static SQL, parameters do not require length or data type definition prior to program compilation.

Dynamic SQL is not as efficient as static SQL, but is very useful if an application requires:

Call Level Interface

A Call Level Interface (CLI) for SQL consists of a library of function calls that support SQL statements. The ODBC interface is a CLI.

A CLI is typically used for dynamic access. The CLI defined by the X/Open and SQL Access Group — and therefore the ODBC interface — is similar to the dynamic embedded version of SQL described in the X/Open and SQL Access Group SQL CAE specification (1992).

The ODBC interface is designed to be used directly by application programmers, not to be the target of a preprocessor for embedded SQL.

A CLI is very straightforward to programmers who are familiar with function libraries. The function call interface does not require host variables or other embedded SQL concepts.

A CLI does not require a precompiler. To submit an SQL request, place an SQL command into a text buffer and pass the buffer as a parameter in a function call. CLI functions provide declarative capabilities and request management. Obtain error information as for any function call — by return code or error function call, depending on the CLI.

A CLI allows for specification of result storage before or after the results are available. Results can be determined and appropriate action taken without being limited to a specific set of data structures that were defined prior to the request. Deferral of storage specification is called late binding of variables.

For a comparison between embedded SQL statements and the ODBC call level interface, see Appendix E, "Comparison Between Embedded SQL and ODBC."

Interoperability

Interoperability for call level interfaces can be addressed in the following ways:

The second approach allows drivers to shield clients from database functionality differences, database protocol differences, and network differences. ODBC follows the second approach. ODBC can take advantage of standard database protocols and network protocols, but does not require the use of a standard database protocol or network protocol.

Previous Page TOC Index Next Page

Copyright © 1992-1997 Solid Information Technology Ltd All rights reserved.

usr/doc/solid-doc/html/progref/prguide3.gif100644 0 0 4017 6605026740 17220 0ustar rootrootGIF89aX3f3333f333ff3fffff3f3f̙3f3333f3333333333f3333333f3f33ff3f3f3f3333f3333333f3̙333333f333ff3ffffff3f33f3ff3f3f3ffff3fffffffffff3fffffff3fff̙ffff3fffff3f̙3333f33̙3ff3ffff̙f3f̙3f̙̙3f̙3f3333f333ff3fffff̙̙3̙f̙̙̙3f̙3f3f3333f333ff3fffff3f3f̙3fck֌{cscƽ޵֌Rks111c{sZks9JRBRZƌ{𠠤,X@ H*\ȰÇ#JHŋ3jHG?Iɓ(S\ɲ˗0cʜI͛8[xPdȜ@ ]s'HE=M*ѦF>tӪQ" uЯ`ò4OhӪ]˶۷p,Kܷbzݾ"iPpݬ]ZEtkTtK<02eRkě~YӗS^ͺk+~=2mп2MVſ&gsG,ڱ枫4J NFϾ~ßKo'O߀_ywǜ "G1Uf7x'$(z(Z-w&{3 `F!#x;V-E5xYL`95^]=gXBaJ8$H.%me$O rVey&^weI]V9e*h[si衈&N6裩-*餔V!QXj Vuo.Rbg !ȕ*f:vZ|ezL*,B٠Jec6쳊*+ۗVk&. cg/wjmg*fxk5YC\k9po* 6cV2T Cl,@ktJ*lL\tҘʼn;r[rh jv_g-ܐEMx߀nn8_p|7i,.~mϔUKw9VǙҴ¦3ʛ_̞7/A:Ѿ_#Ys9&Z=W%}ӻ׽;y}~췽~o~)l\?}Җ?dsٻwa tZ ؚ*4˹|= s-SXPf'\ gE}LTf]nH×pf5$ _@i_!4$ /k\@)0b .&~`,Hkh< ʼniq~;xWa9ΰ`h1HԚX?FCGE]#~Hx $H frq,eH+(  K$+Wlb-(I!gmF|I+M$5M%T7INjLxvy;usr/doc/solid-doc/html/progref/prguide3.htm100644 0 0 50024 6605026740 17262 0ustar rootroot prguide.htm

Previous Page TOC Index Next Page



GUIDELINES FOR CALLING FUNCTIONS


This chapter describes the general characteristics of ODBC functions, determining driver conformance levels, the role of the Driver Manager, ODBC function arguments, and the values ODBC functions return.

General Information

Each SOLID SQL API and ODBC function name starts with the prefix "SQL." Each function accepts one or more arguments. Arguments are defined as input (to the driver) or output (from the the driver).

C programs that call ODBC functions must include the SQL.H, SQLEXT.H, and WINDOWS.H header files. These files define Windows and ODBC constants and types and provide function prototypes for all ODBC functions.

C programs that call SOLID SQL API functions must include the CLI0CORE.H, CLI0DEFS.H, CLI0ENV.H and CLI01EXT1.H header files. These files define constants and types and provide function prototypes for all SOLID SQL API functions.

Determining Driver Conformance Levels

ODBC defines conformance levels for drivers in two areas: the ODBC API and the ODBC SQL grammar (which includes the ODBC SQL data types). These levels establish standard sets of functionality. By inquiring the conformance levels supported by a driver, an application can easily determine if the driver provides the necessary functionality. For a complete discussion of ODBC conformance levels, see "ODBC Conformance Levels" in Chapter 1, "ODBC Theory of Operation."


Note The following sections refer to SQLGetInfo and SQLGetTypeInfo, which are part of the Level 1 API conformance level. Although it is strongly recommended that drivers support this conformance level, drivers are not required to do so. If these functions are not supported, an application developer must consult the driver documentation to determine its conformance levels.

Determining API Conformance Levels

ODBC functions are divided into core