📄 otl3_compile.htm
字号:
name="OTL_ORA10G_R2"></a>OTL_ORA10G_R2</span></td>
<td style="vertical-align: top;">for
OCI10g, Release 2 (Oracle 10.2). All code that compiles and works
under #define OTL_ORA7,
OTL_ORA8, OTL_ORA8I, OTL_ORA9I, and OTL_ORA10G should work with
OTL_ORA10G_R2 .<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;"><span style="font-weight: bold;"><a
name="OTL_ORA11G"></a>OTL_ORA11G</span><br>
</td>
<td style="vertical-align: top;">for OCI11g Release 1 (Oracle
11.1). All code that compiles and works under #define OTL_ORA7,
OTL_ORA8, OTL_ORA8I, OTL_ORA9I, OTL_ORA10G, and OTL_ORA10G_R2 should
work with
OTL_ORA11G..</td>
</tr>
</tbody>
</table>
<br>
<br>
There are several extra macro definitions which control compilation of
the OTL header file:<br>
<br>
<table style="text-align: left; width: 992px; height: 3222px;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;"><span style="font-weight: bold;">#define</span><br>
</td>
<td style="vertical-align: top;"><span style="font-weight: bold;">Explanation</span><br>
</td>
</tr>
<tr>
<td style="vertical-align: top;"><font size="-1"><a name="OTL_ACE"></a><b>OTL_ACE</b> </font></td>
<td style="vertical-align: top;">(the same as
#define <a href="otl3_compile.htm#OTL_STL">OTL_STL</a>,
only for use with Adaptive Communication Environment (<a
href="http://www.cs.wustl.edu/%7Eschmidt/ACE.html">ACE</a>)).
This #defines makes OTL cmopile with ACE. Most features of OTL, which
require
#define OTL_STL to be on, compile with ACE, except for <a
href="otl3_output_iterator.htm">otl_output_iterator</a>, <a
href="otl3_input_iterator.htm">otl_input_iterator.</a>,
and the <a href="otl3_pl_tab.htm">STL
vector based PL/SQL table
container
classes</a> (otl_XXX_vec). OTL stream iterators were not implemented
for
ACE since the concept of stream iterators is not present in ACE. Same
with
with the otl_XXX_vec: vectors are not implemented in ACE. ACE has only
dynamic arrays with dynamically defined sizes.</td>
</tr>
<tr>
<td style="vertical-align: top;"><font size="-1"><a
name="OTL_ADD_NULL_TERMINATOR_TO_STRING_SIZE"></a><b>OTL_ADD<br>
_NULL<br>
_TERMINATOR<br>
_TO_STRING<br>
_SIZE</b>.</font></td>
<td style="vertical-align: top;">This
#define enables the addition of one byte / Unicode character to the
size
of a string buffer, when the buffer gets allocated on the program's
heap.
This alleviates the burden of remembering that an extra byte / Unicode
character needs to be added to the string buffer size to accomodate the
string's NULL terminator.</td>
</tr>
<tr>
<td style="vertical-align: top;"><font size="-1"><a
name="OTL_ANSI_CPP"></a><b>OTL_ANSI_CPP </b></font></td>
<td style="vertical-align: top;">for
turning on
ANSI C++
compliance mode: ANSI C++ typecasts (static_cast<>,
const_cast<>, reinterpret_cast<> instead of C-style
typecasts),<a href="#OTL_FUNC_THROW_SPEC_ON"> optional function throw</a>
clauses, <span style="font-style: italic;">typename</span> instead of <span
style="font-style: italic;">class</span> keywords in class type
template class parameters, etc.</td>
</tr>
<tr>
<td style="vertical-align: top;"><font size="-1"><a
name="OTL_BIGINT"></a><span style="font-weight: bold;">OTL_BIGINT</span> </font></td>
<td style="vertical-align: top;">This #define
enables support for <a href="otl3_bind_variables.htm#bigint">bigint</a>
(64-bit signed integer) bind
variables by specifynig a 64-bit signed integer
datatype name, for example:<br>
<pre>#define OTL_BIGINT __int64 // VC++, Borland C++</pre>
or<br>
<pre>#define OTL_BIGINT long long // GNU C++<br><br></pre>
ODBC and DB2-CLI support 64-bit integers natively, so does OTL. No OCI
(OCI7,OCI8, OCI8i, OCI9i) supports 64-bit integers, so OTL has to
emulate this of bind variables via strings (char[XXX]). OTL allocates
and binds a string variable with a placeholder that is defined as
<<a href="otl3_bind_variables.htm#bigint">bigint</a>>.<br>
<br>
In case if OTL_BIGINT, and one of the OTL_ORAxx #defines are defined
together, the following two defines also need to be enabled: <a
href="#OTL_BIGINT_TO_STR">OTL_BIGINT_TO_STR</a>, <a
href="#OTL_STR_TO_BIGINT">OTL_STR_TO_BIGINT</a>.<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;"><font size="-1"><span
style="font-weight: bold;"><a name="OTL_BIGINT_TO_STR"></a>OTL_BIGINT</span><br
style="font-weight: bold;">
<span style="font-weight: bold;">_TO_STR</span>(n,str)<br>
</font> </td>
<td style="vertical-align: top;">This #define is required when <a
href="#OTL_BIGINT">OTL_BIGINT</a> is enabled and when one of OTL_ORAxx
#defines is enabled, in order to support OTL internal bigint-to-string
conversion. This #define is supposed to provide bigint-to-string
conversion code that is most probably C++ compiler specific (because
64-bit ints are not part of the ANSI C++ standard), for example:<br>
<pre>#if defined(_MSC_VER) // VC++<br><br>#define <a
href="#OTL_BIGINT">OTL_BIGINT</a> __int64<br><br>#define <a
href="#OTL_STR_TO_BIGINT">OTL_STR_TO_BIGINT</a>(str,n) \<br>{ \<br> n=_atoi64(str); \<br>}<br><br>#define <a
href="#OTL_BIGINT_TO_STR">OTL_BIGINT_TO_STR</a>(n,str) \<br>{ \<br> _i64toa(n,str,10); \<br>}<br>#endif<br></pre>
<pre><br></pre>
</td>
</tr>
<tr>
<td style="vertical-align: top;"><font size="-1"><a
name="OTL_BIND_VAR_STRICT_TYPE_CHECKING_ON"></a><b>OTL_BIND_VAR<br>
_STRICT_<br>
TYPE_<br>
CHECKING_ON</b> </font></td>
<td style="vertical-align: top;">This #define
enables "bind
variable strict type checking", that is,
typos
in bind variable data type declarations get checked strictly. OTL, for
performance, checks out as few characters as possible in a bind
variable
declaration, in order to recognize a legitimate data type declaration.
Sometimes, it results in some parts of unrecognized declaration to be
left
as is, which, in its turn, causes a database runtime error, typically,
an SQL statement parse error. In most cases, it's okay, no trouble
whatsoever.
In very rare cases, depending on a concrete release of a database API,
on a specific platform, it causes a program core dump / crash.<br>
<br>
It is recommended to use this #define as part of the "Debug mode",
in
order to sort out errors of this kind. Then, when compiling in "Release
mode", the #define could be dropped. </td>
</tr>
<tr>
<td style="vertical-align: top;"><font size="-1"><a
name="OTL_DB2_CLI_MAP_LONG_VARCHAR_TO_VARCHAR"></a><b>OTL_DB2_CLI_<br>
MAP_LONG_<br>
VARCHAR_TO<br>
_VARCHAR</b>. </font></td>
<td style="vertical-align: top;">This #define works
in a
combination with #define <a href="otl3_compile.htm#OTL_DB2_CLI">OTL_DB2_CLI</a>.
It should be used in the case of the DB2 CLI on the client side and the
DB2 OS/390 on the server side, because all VARCHAR table columns that
are
>= 255 bytes get reported by the DB2 CLI as SQL_LONG_VARCHARs
(normally
reserved for DB2 CLOB columns). In DB2 UDB distributed (non-OS/390
flavor),
all VARCHARs get reported as DB2 CLI's SQL_VARCHARs. When #define
OTL_DB2_MAP_LONG_VARCHAR_TO_VARCHAR
is defined, all VARCHAR table colunms, which are shorter (<=) than
the
value defined by the #define, get mapped to SQL_VARCHAR, even though
the
DB2 CLI reports the columns as SQL_LONG_VARCHARs. For example:<br>
<br>
<tt>#define OTL_DB2_CLI</tt><br>
<tt>#define OTL_DB2_CLI_MAP_LONG_VARCHAR_TO_VARCHAR 4000</tt><br>
<tt>#include <otlv4.h><br>
<br>
</tt>In this example, all VARCHAR table columns, that are <=
4000
bytes,
will be mapped to SQL_VARCHAR, even though the client code connects to
a DB2 OS/390 database, and the client DB2 CLI reports the columns as
SQL_LONG_VARCHARs.
This <br>
kind of datatype mapping happens only on SELECT statements, or
stored
procedures that return a result set. </td>
</tr>
<tr>
<td style="vertical-align: top;"><font size="-1"><a
name="OTL_DEFAULT_CHAR_NULL_TO_VAL"></a><b>OTL_<br>
DEFAULT<br>
_CHAR_<br>
NULL_TO_VAL</b></font></td>
<td style="vertical-align: top;"><b> </b>When
this #define is set to a char value, in the case of a NULL, returned
from
the database, OTL assigns the value to the variable that is used in
operator>>(char&),
or in operator(unsigned char&). At the same time,
otl_stream::is_null()
can be used to check for NULL. This default value is more of a
convenience
than necessity. </td>
</tr>
<tr>
<td style="vertical-align: top;"><font size="-1"><a
name="OTL_DEFAULT_NUMERIC_NULL_TO_VAL"></a><b>OTL_<br>
DEFAULT<br>
_NUMERIC_<br>
NULL_TO_VAL</b></font></td>
<td style="vertical-align: top;">When
this #define is set to a numeric value, in the case of a NULL returned
from
the database, OTL assigns the value to the variable that is used in
operator>>(numeric_type&). At the same time,
otl_stream::is_null()
can be used to check for NULL. This default value is more of a
convenience
than necessity.</td>
</tr>
<tr>
<td style="vertical-align: top;"><font size="-1"><a
name="OTL_DEFAULT_DATETIME_NULL_TO_VAL"></a><b>OTL_DEFAULT<br>
_DATETIME<br>
_NULL_TO_VAL </b></font></td>
<td style="vertical-align: top;">When
this #define is set to a value of otl_datetime datatype, in the case of
a NULL, returned from the database, OTL assigns the value to to the
variable
that is used in operator>>(otl_datetime&). At the same time,
otl_stream::is_null()
can be used to check for NULL. This default value is more of a
convenience
than necessity. </td>
</tr>
<tr>
<td style="vertical-align: top;"><font size="-1"><a
name="OTL_DEFAULT_STRING_NULL_TO_VAL"></a><b>OTL_DEFAULT<br>
_STRING<br>
_NULL_TO_VAL</b> <br>
</font></td>
<td style="vertical-align: top;">When this #define
is set to a
string value, in the case of a NULL,
returned
from the database., OTL assigns the value to the variable that is used
in operator>>(std::string&), or in
operator>>(ACE_TString&), or
in a string class, defined by #define USER_DEFINED_STRING_CLASS:
opartor>>(USER_DEFINED_STRING_CLASS&).
Also, OTL assigns the value to the variable that is used in
operator>>(char*),
or in opartor>>(unsigned char*). At the same time,
otl_stream::is_null()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -