⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 group__g__abort.html

📁 oci的源码,可以在任何平台上编译,相当方便实用
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>OCILIB (C Driver for Oracle): Aborting long operations</title><link href="doxygen.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.5.4 --><div class="tabs">  <ul>    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>    <li><a href="modules.html"><span>Modules</span></a></li>    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>    <li><a href="files.html"><span>Files</span></a></li>  </ul></div><h1>Aborting long operations</h1><hr><a name="_details"></a><h2>Detailed Description</h2>The Oracle OCI provides the ability to establish a server connection in :<p><ul><li>blocking mode: each call to an OCI function returns control to the application when the call completes</li><li>non-blocking mode (based on polling paradigm) : the application have to call each function until its has completed its job</li></ul><p>OCILIB implements OCI in blocking mode. The application has to wait for OCI calls to complete to continue.<p>Some operations can be long to be processed by the server.<p>In order to cancel the current pending call, OCILIB provides <a class="el" href="group__g__abort.html#gf34a39ddfb3b6677eab1add1a4052e4d" title="Perform an immediate abort of any currently Oracle OCI call.">OCI_Break()</a> that cancel the last internal OCI Call and then raise an OCI abortion error code.<p><dl class="note" compact><dt><b>Note:</b></dt><dd>Any call to <a class="el" href="group__g__abort.html#gf34a39ddfb3b6677eab1add1a4052e4d" title="Perform an immediate abort of any currently Oracle OCI call.">OCI_Break()</a> has to be done from a separate thread because the thread that has executed a long OCI call is waiting for its OCI call to complete.</dd></dl><dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment"><span class="preprocessor">#include "windows.h"</span><span class="preprocessor">#include "process.h"</span><span class="preprocessor">#include "ocilib.h"</span><span class="comment">/* Example on Microsoft platform */</span><span class="keyword">static</span> HANDLE evt;<span class="keywordtype">void</span> long_oracle_call(<span class="keywordtype">void</span> *data){    <a class="code" href="struct_o_c_i___statement.html" title="Oracle SQL or PL/SQL statement.">OCI_Statement</a> *st  = OCI_CreateStatement((<a class="code" href="struct_o_c_i___connection.html" title="Oracle physical connection.">OCI_Connection</a> *) data);     <a class="code" href="struct_o_c_i___resultset.html" title="Collection of output columns from a select statement.">OCI_Resultset</a> *rs;    <span class="comment">/* execute a query that takes a long time to process */</span>    <a class="code" href="group__g__exec.html#gf2163ec44e644cc734c393188707985b" title="Parse and execute a SQL statement or PL/SQL block.">OCI_ExecuteStmt</a>(st, <span class="stringliteral">"select code, content from huge_table"</span>);    rs = <a class="code" href="group__g__fetch.html#gf2a9e28b66a9538ba0ffb62bffb87c16" title="Retrieve the resultset handle from an executed statement.">OCI_GetResultset</a>(st);    <span class="keywordflow">while</span> (<a class="code" href="group__g__fetch.html#g36ac26dcea78f6074421781e401f97ba" title="Fetch the next row of the resultset.">OCI_FetchNext</a>(rs))    {        printf(<span class="stringliteral">"%i - %s"</span>, <a class="code" href="group__g__fetch.html#ga8d80dc30b2012eaddd13efa9dfb711d" title="Return the current integer value of the column at the given index in the resultset...">OCI_GetInt</a>(rs, 1), <a class="code" href="group__g__fetch.html#g755a9b07c174feacd05c86e0e44b0ab0" title="Return the current string value of the column at the given index in the resultset...">OCI_GetString</a>(rs, 2));    }    SetEvent(evt);}<span class="keywordtype">int</span> main(<span class="keywordtype">void</span>){   <a class="code" href="struct_o_c_i___connection.html" title="Oracle physical connection.">OCI_Connection</a> *cn;   <span class="keywordflow">if</span> (!<a class="code" href="group__g__init.html#gcdb642d75f7c8478e083634144bc813c" title="Initializes the library.">OCI_Initialize</a>(NULL, NULL, OCI_ENV_DEFAULT))        <span class="keywordflow">return</span> EXIT_FAILURE;    cn = <a class="code" href="group__g__connect.html#gdb6e2cdf759587dd81c2fda7c5f44338" title="Create a physical connection to an Oracle database server.">OCI_ConnectionCreate</a>(<span class="stringliteral">"db"</span>, <span class="stringliteral">"usr"</span>, <span class="stringliteral">"pwd"</span>, OCI_SESSION_DEFAULT);    evt = CreateEvent(0, TRUE, FALSE, 0);    _beginthread(long_oracle_call, 0, cn);    <span class="keywordflow">if</span> (WaitForSingleObject(evt, 10000) != WAIT_OBJECT_0)    {        <a class="code" href="group__g__abort.html#gf34a39ddfb3b6677eab1add1a4052e4d" title="Perform an immediate abort of any currently Oracle OCI call.">OCI_Break</a>(cn);        Sleep(2000);    }    <a class="code" href="group__g__init.html#g639706aa8e9689c7ebffc018fac6d3ae" title="Clean up all resources allocated by the library.">OCI_Cleanup</a>();     <span class="keywordflow">return</span> EXIT_SUCCESS;}</pre></div> </dd></dl><p><table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr><tr><td colspan="2"><br><h2>Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">OCI_EXPORT boolean OCI_API&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__g__abort.html#gf34a39ddfb3b6677eab1add1a4052e4d">OCI_Break</a> (<a class="el" href="struct_o_c_i___connection.html">OCI_Connection</a> *con)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Perform an immediate abort of any currently Oracle OCI call.  <a href="#gf34a39ddfb3b6677eab1add1a4052e4d"></a><br></td></tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="gf34a39ddfb3b6677eab1add1a4052e4d"></a><!-- doxytag: member="ocilib.h::OCI_Break" ref="gf34a39ddfb3b6677eab1add1a4052e4d" args="(OCI_Connection *con)" --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">OCI_EXPORT boolean OCI_API OCI_Break           </td>          <td>(</td>          <td class="paramtype"><a class="el" href="struct_o_c_i___connection.html">OCI_Connection</a> *&nbsp;</td>          <td class="paramname"> <em>con</em>          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"></td>        </tr>      </table></div><div class="memdoc"><p>Perform an immediate abort of any currently Oracle OCI call. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>con</em>&nbsp;</td><td>- connection handle</td></tr>  </table></dl><dl class="note" compact><dt><b>Note:</b></dt><dd>The current call will abort and generate an error</dd></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>Returns FALSE if connection handle is NULL otherwise TRUE </dd></dl><p>Definition at line <a class="el" href="connection_8c-source.html#l01075">1075</a> of file <a class="el" href="connection_8c-source.html">connection.c</a>.</p><p>References <a class="el" href="ocilib__types_8h-source.html#l00269">OCI_Connection::cxt</a>, and <a class="el" href="ocilib__types_8h-source.html#l00267">OCI_Connection::err</a>.</p></div></div><p><hr size="1"><address style="text-align: right;"><small>Generated on Sat Apr 18 01:13:15 2009 for OCILIB (C Driver for Oracle) by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.4 </small></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -