📄 otl3_namespaces.htm
字号:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Sergei Kuchin">
<meta name="GENERATOR" content="Mozilla/4.75 [en] (Win98; U) [Netscape]">
<meta name="KeyWords" content="OTL, Oracle, ODBC, DB2, CLI, database API, C++, Template Library">
<title>OTL 4.0, OTL namespaces</title>
</head>
<body>
<center>
<h1>
OTL 4.0, OTL namespaces</h1></center>
<h1>
<a NAME="otl_namespace"></a>OTL namespaces</h1>
The user may want to define more than one instance of the OTL 4.0, e.g.
OTL 4.0/OCI7 and OTL 3.1/ODBC. In this example, two instances of otl_stream,
otl_connect and otl_exception will be generated. The first instance is
for the OCI7 and the second is for ODBC. In order to resolve the name conflict,
OTL automatically generates namespaces to wrap up the instances of the
OTL classes with, e.g. in the case of OTL_ODBC & OTL_ORA7, the following
namespaces get generated:
<ul>
<li>
<b>odbc::</b> -- to wrap up OTL/ODBC classes</li>
<li>
<b>oracle::</b> -- to wrap up OTL/OCIx classes</li>
<li>
<b>db2::</b> -- to wrap up OTL/DB2-CLI classes</li>
</ul>
Of course, if both ODBC and OCI7 are being used, both ODBC and OCI object
libraries need to be linked into the program, to resolve references to
all external functions.
<p>If only one out of many OTL #define's (OTL_ORA7, OTL_ORA8, OTL_ODBC,
OTL_DB2_CLI, OTL_ODBC_MYSQL) is specified, no namespaces are generated,
since there is no need.
<p>The following is the list of legitimate combinations of the OTL macro
definitions and namespaces to be generated:
<br>
<table BORDER >
<tr>
<td>OTL_ODBC or OTL_ODBC_MYSQL</td>
<td>No namespaces defined</td>
</tr>
<tr>
<td>OTL_ORA7</td>
<td>No namespaces defined</td>
</tr>
<tr>
<td>OTL_ORA8</td>
<td>No namespaces defined</td>
</tr>
<tr>
<td>OTL_DB2_CLI</td>
<td>No namespace defined</td>
</tr>
<tr>
<td>OTL_ODBC (or OTL_ODBC_MYSQL) &
<br>OTL_ORA8</td>
<td>Namespace <b>odbc </b>is defined for OTL/ODBC &
<br>namespace <b>oracle </b>is defined for OTL/OCI8</td>
</tr>
<tr>
<td>OTL_ODBC (or OTL_ODBC_MYSQL) &
<br>OTL_ORA7</td>
<td>Namespace <b>odbc </b>is defined for OTL/ODBC &
<br>namespace <b>oracle </b>is defined for OTL/OCI7</td>
</tr>
<tr>
<td>OTL_DB2_CLI &
<br>OTL_ORA7</td>
<td>Namespace <b>db2 </b>is defined for OTL/DB2-CLI &
<br>namespace <b>oracle </b>is defined for OTL/OCI7</td>
</tr>
<tr>
<td>OTL_DB2_CLI &
<br>OTL_ORA8</td>
<td>Namespace <b>db2 </b>is defined for OTL/DB2-CLI &
<br>namespace <b>oracle </b>is defined for OTL/OCI8</td>
</tr>
</table>
<p>In case when namespaces are defined, OTL objects need to be prefixed
with the namespace + the scope resolution operator, e.g.: oracle::otl_stream,
odbc::otl_stream, db2::otl_stream. The only two objects that aredefined
outside the namespaces are the <a href="otl3_long_string.htm">otl_long_string</a>
and <a href="#otl_null">otl_null</a> classes. OTL namespaces are useful
for working with more than database at the same time. For more detail,
see <a href="otl3_ex42.htm">example 42</a>.
<p>The OTL namespace default behavior can be changed by the following macro
definition: #define OTL_EXPLICIT_NAMESPACES. This #define forces OTL to
always generate namespaces.
<p>
<hr WIDTH="100%">
<center>
<p><a href="otl3_compile.htm">Prev</a> <a href="otl3_exc_list.htm">Next</a><a href="otl3.htm">Contents</a>
<a href="home.htm">Go Home</a></center>
<p>Copyright © 1996, 2008, Sergei Kuchin, email: <a href="mailto:skuchin@aceweb.com">skuchin@aceweb.com</a>,
<a href="mailto:skuchin@gmail.com">skuchin@gmail.com<script Language="JavaScript"><!-- hide from oldgmailsers
var modDate = new Date(document.lastModified)
document.write("<i> Last Updated:</i> " + (modDate.getMonth()+1) + "/" +
modDate.getDate() + "/" + "0"+(modDate.getYear())%100+".");
//-->
</script>
</a>.
<p><i>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.</i>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5456201-1");
pageTracker._trackPageview();
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -