📄 otl3_connect_class.htm
字号:
<li> <a name="set_stream_pool_size"></a>Set the <a
href="otl3_stream_pooling.htm">otl_stream
pool</a> size. This function can be activated with #define <a
href="otl3_compile.htm#OTL_STREAM_POOLING_ON">OTL_STREAM_POOLING_ON,</a>
used together with #define <a href="otl3_compile.htm#OTL_STL">OTL_STL</a>.
If OTL_STREAM_POOLING_ON is defined in the program, the function body
gets
included into the target code. Also, a default stream pool gets
allocated
as part the otl_connect object, even if the function doesn't get
called.
Therefore, a call to the function will reallocate all the resources,
allocated
by the default stream pool, or by previous calls to
set_stream_pool_size().</li>
</ul>
<pre> void set_stream_pool_size<br> (const int max_size=otl_max_default_pool_size);</pre>
<ul>
<li> <a name="set_character_set"></a>This function is available for
OTL/<b><i>OCI8i/9i</i><span style="font-style: italic;">/10g/11g</span></b>
under #define <a href="otl3_compile.htm#OTL_UNICODE">OTL_UNICODE</a>
only.
In Unicode OTL, the Oracle database default or national character set
is
allowed to be set:</li>
<br>
<ul>
<li>SQLCS_IMPLICIT -- database default (implicit) character set</li>
<li>SQLCS_NCHAR -- database national (second) character set. </li>
<p><tt>void set_character_set(const int char_set=SQLCS_IMPLICIT);</tt></p>
</ul>
<p><br>
The default character set (SQLCS_IMPLICIT) needs to be set when
Unicode containers are used with the VARCHAR2, CHAR, LONG, and CLOB
column
types. In the case if Unicode containers are used with NVARCHAR2,
NCAHR,
and NCLOB datatypes, the national character set (SQLCS_NCHAR) needs to
be set. </p>
<p>SQLCS_IMPLICIT, and SQLCS_NCHAR are defined by the OCI header
files. </p>
<p>Since this function is part of the otl_connect class, all
otl_streams,
that gets opened via a concrete connect object, will use the character
set, that was set by the function. </p>
<p>The semantic of :var<<a href="otl3_bind_variables.htm#char">char</a>[...]...>
declaration of string bind variables was extended to accomodate the
Unicode
strings. For example, char[20] means a string of 19 double-byte Unicode
characters, plus 19 double-byte possible surrogate characters, plus one
double-byte null terminator. It sounds a little complicated, but that
is
just a reflection of a plethora of Unicode standards, coding
techniques.
It is strongly recommended to read the Unicode standards themselves,
then
the Oracle implementations the Unicode. By the way, Oracle 8i and 9i
differ
in that regard substantially.<br>
<br>
</p>
</ul>
<ul>
<li><a name="set_throw_on_sql_success_with_info"></a>OTL/ODBC,
OTL/DB2-CLI only. Set the "OTL throws on SQL_SUCCESS_WITH_INFO"" flag.
When the flag is set, and SQLExecDirect() / SQLExecute() function
returns SQL_SUCCESS_WITH_INFO, OTL throws an otl_exception. This is
useful for communicating more information from the SQL call, especially
if the call is a call to a stored procedure, or a Transact-SQL batch
that may return more diagnostic information than usual. The function is
enabled only when #define OTL_THROWS_ON_SQL_SUCCES_WITH_INFO is defined.<br>
</li>
<pre>#if defined(<a
href="otl3_compile.htm#OTL_THROWS_ON_SQL_SUCCESS_WITH_INFO">OTL_THROWS_ON_SQL_SUCCESS_WITH_INFO</a>)<br> void set_throw_on_sql_success_with_info(const bool throw_flag=false);<br>#endif<br><br></pre>
<li><a name="operator_ll"></a>Send a string to the otl_connect
object. If the object is not connected to a database then the string is
a connection
string in the "userid/passwd@db" format and it makes the object connect
to the database. If the object is already connected, the string is a
static SQL statement that the connect object executes immediately.<br>
<br>
<tt>otl_connect& operator<<(const char* str);<br>
<br>
<br>
</tt></li>
<li><a name="operator_lle"></a>Send a string to the otl_connect
object. The connect object saves the string for further use with
operator <a href="#operator_gg">>></a>(). The string is an SQL
statement with placeholders that could be sent to an otl_stream object.
In other words, this operator is a deferred SQL statement. <br>
<br>
<tt>otl_connect& operator<<=(const char* str);<br>
<br>
</tt></li>
<li><a name="operator_gg"></a>Send the SQL statement that was saved
with operator <a href="operator_lle"><<=</a> to an otl_stream
object. It makes the otl_stream object open the SQL statement. If there
was no SQL statement previously save by the connect object, the connect
object sends the following string to the otl_stream: <span
style="font-family: monospace;">"*** INVALID COMMAND ***"</span>.,
which causes an SQL parse error in the otl_stream, which ends up in an
otl_exception.<br>
<br>
<tt>otl_connect& operator>>(otl_stream& s);<br>
<br>
</tt></li>
<li><a name="direct_exec"></a>Direct execution of a static SQL
statement, the function returns the
Rows Processed Count (RPC)<br>
<br>
<tt>long direct_exec(const char *sqlstm, // SQL Statement<br>
int ignore_error =</tt><tt> </tt><a
href="otl3_exception_class.htm#enum"><span
style="font-family: monospace;">otl_exception::enabled</span></a><tt>
// "ignore error" flag </tt><br>
<tt>
);<br>
<br>
</tt></li>
<li><a name="syntax_check"></a>Parses a static SQL statement,
raises an <a href="otl3_exception_class.htm">otl_exception</a> if
there is an SQL error.<br>
<br>
<tt>void syntax_check(const char *sqlstm // SQL Statement<br>
</tt><tt>
);</tt><br>
</li>
</ul>
<ul>
</ul>
<ul>
<li><tt></tt><a name="set_connection_mode"></a>When #define <a
href="otl3_compile.htm#OTL_ODBC_MULTI_MODE">OTL_ODBC_MULTI_MODE</a> is
enabled, OTL allows ODBC connections to more than one database type to
be made from the same program at the same time without enabling any
dababase specific #define's, which would be in conflict.<br>
<pre>#if defined(<a href="otl3_compile.htm#OTL_ODBC_MULTI_MODE"><span
style="text-decoration: underline;">OTL_ODBC_MULTI_MODE</span></a>)</pre>
<tt> void set_connection_mode(const int
connection_mode);</tt><br>
<span style="font-family: monospace;">
// set connection mode before otl_connect::rlogon() is called. <br>
// See the <a
href="#connection_mode_list">connection mode list</a> for mode detail.</span><tt></tt><br>
<br>
<tt> int get_connection_mode();</tt><span
style="font-family: monospace;"> <br>
// get connection mode for the
otl_connect object.</span><br>
<br>
<pre>#endif<br></pre>
<p><a name="connection_mode_list"></a>The following is the list of
available ODBC connection mode integer constants that can be used in
calls to set_connection_mode() (ODBC driver specific restrictions like
the stream buffer size / unsupported bulk interface still apply, see
example <a href="otl4_ex675.htm">675</a> for more detail):</p>
</li>
<ul>
<li>OTL_DEFAULT_ODBC_CONNECT (equivalent of #define <a
href="otl3_compile.htm#OTL_ODBC">OTL_ODBC</a>). The following database
types can be used with the OTL default ODBC multi-mode when the
corresponding ODBC driver is used:<br>
<br>
</li>
<ul>
<li>DB2</li>
<li>FireBird<br>
</li>
<li>Informix</li>
<li>MS ACCESS</li>
<li>Oracle</li>
<li>SAP/MAX DB<br>
</li>
<li>SQLite<br>
</li>
<li>Sybase</li>
<li>Any other compatible ODBC source<br>
<br>
</li>
</ul>
<li>OTL_TIMESTEN_ODBC_CONNECT (equivalent of #define <a
href="otl3_compile.htm#OTL_ODBC">OTL_ODBC</a> + ODBC connection to
TimesTen on the backend)<br>
<br>
</li>
<li>OTL_MSSQL_2005_ODBC_CONNECT (equivalent of #define <a
href="otl3_compile.htm#OTL_ODBC_MSSQL_2005">OTL_ODBC_MSSQL_2005</a>)<br>
<br>
</li>
<li>OTL_POSTGRESQL_ODBC_CONNECT (equivalent of #define <a
href="otl3_compile.htm#OTL_ODBC_POSTGRESQL">OTL_ODBC_POSTGRESQL</a>)<br>
<br>
</li>
<li>OTL_ENTERPRISE_DB_ODBC_CONNECT (equivalent of #define <a
href="otl3_compile.htm#OTL_ODBC_ENTERPRISEDB">OTL_ODBC_ENTERPRISEDB</a>)<br>
<br>
</li>
<li>OTL_MYODBC35_ODBC_CONNECT (equivalent of #define <a
href="otl3_compile.htm#OTL_ODBC">OTL_ODBC</a> + #define <a
href="otl3_compile.htm#OTL_ODBC_SELECT_STM_EXECUTE_BEFORE_DESCRIBE">OTL_ODBC_SELECT_STM_EXECUTE_BEFORE_DESCRIBE</a>)<br>
<br>
</li>
<li><a name="OTL_MSSQL_2008_ODBC_CONNECT"></a>OTL_MSSQL_2008_ODBC_CONNECT
(equivalent of #define <a href="otl3_compile.htm#OTL_ODBC_MSSQL_2008">OTL_ODBC_MSSQL_2008</a>)</li>
</ul>
</ul>
<pre><font size="+2">}; // end of otl_connect</font></pre>
<center>
<hr width="100%">
<p><a href="otl3_bind_variables.htm">Prev</a> <a
href="otl3_exception_class.htm">Next</a><a href="otl3.htm">Contents</a><a
href="home.htm">Go
Home</a></p>
</center>
#define OTL_ODBC_SELECT_STM_EXECUTE_BEFORE_DESCRIBE
href="mailto:skuchin@aceweb.com">skuchin@aceweb.com,
<a href="mailto:skuchin@gmail.com">skuchin@gmail.com</a>.
<script language="JavaScript"><!-- hide from old browsers
var modDate = new Date(document.lastModified)
document.write("<i> Last Updated:</i> " + (modDate.getMonth()+1) + "/" +
modDate.getDate() + "/" + "0"+(modDate.getYear())%100+".");
//-->
</script>
<p></p>
<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>
</p>
<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 + -