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

📄 resultset_8c-source.html

📁 oci的源码,可以在任何平台上编译,相当方便实用
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<a name="l00258"></a>00258             OCI_Define *def = &amp;(rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#ca691fad2f84ecfb8956f5e1649c0a53">defs</a>[i]);<a name="l00259"></a>00259 <a name="l00260"></a>00260             <span class="keywordflow">if</span> (def-&gt;col.type == OCI_CDT_LONG &amp;&amp; def-&gt;buf.handle == handle)<a name="l00261"></a>00261             {<a name="l00262"></a>00262                 <span class="comment">/* get the long object for the given internal row */</span><a name="l00263"></a>00263 <a name="l00264"></a>00264                 <a class="code" href="struct_o_c_i___long.html" title="Oracle Long datatype.">OCI_Long</a> *lg = (<a class="code" href="struct_o_c_i___long.html" title="Oracle Long datatype.">OCI_Long</a> *) def-&gt;buf.data[iter];<a name="l00265"></a>00265 <a name="l00266"></a>00266                 <span class="comment">/* setup up piece size */</span><a name="l00267"></a>00267 <a name="l00268"></a>00268                 ub4 bufsize = rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#c12ae7da6f8d20f00c6ad69cdb31373a">stmt</a>-&gt;<a class="code" href="struct_o_c_i___statement.html#f66fea62f75b943c334283cd346fb729">long_size</a>;<a name="l00269"></a>00269 <a name="l00270"></a>00270                 if (lg-&gt;<a class="code" href="struct_o_c_i___long.html#0eb52b112b73161c67c5e8631e5bd62d">type</a> == OCI_CLONG)<a name="l00271"></a>00271                     bufsize += <span class="keyword">sizeof</span>(dtext);<a name="l00272"></a>00272 <a name="l00273"></a>00273                 <span class="comment">/* check buffer */</span><a name="l00274"></a>00274 <a name="l00275"></a>00275                 <span class="keywordflow">if</span> (lg-&gt;<a class="code" href="struct_o_c_i___long.html#c1d382a8949e5d85954dc900c7b2ac7f">buffer</a> == NULL)<a name="l00276"></a>00276                 {<a name="l00277"></a>00277                     lg-&gt;<a class="code" href="struct_o_c_i___long.html#1f42064a259fdac9565d6251378fd5ad">maxsize</a> = bufsize;<a name="l00278"></a>00278 <a name="l00279"></a>00279                     lg-&gt;<a class="code" href="struct_o_c_i___long.html#c1d382a8949e5d85954dc900c7b2ac7f">buffer</a>  = (ub1 *) OCI_MemAlloc(OCI_IPC_LONG_BUFFER,<a name="l00280"></a>00280                                                        lg-&gt;<a class="code" href="struct_o_c_i___long.html#1f42064a259fdac9565d6251378fd5ad">maxsize</a>, 1, FALSE);<a name="l00281"></a>00281 <a name="l00282"></a>00282                     lg-&gt;<a class="code" href="struct_o_c_i___long.html#c1d382a8949e5d85954dc900c7b2ac7f">buffer</a>[0] = 0;<a name="l00283"></a>00283                 }<a name="l00284"></a>00284                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (lg-&gt;<a class="code" href="struct_o_c_i___long.html#936260167a8950b8022f7050f2f3dd87">size</a> &gt;= lg-&gt;<a class="code" href="struct_o_c_i___long.html#1f42064a259fdac9565d6251378fd5ad">maxsize</a>)<a name="l00285"></a>00285                 {<a name="l00286"></a>00286                     lg-&gt;<a class="code" href="struct_o_c_i___long.html#1f42064a259fdac9565d6251378fd5ad">maxsize</a> = lg-&gt;<a class="code" href="struct_o_c_i___long.html#936260167a8950b8022f7050f2f3dd87">size</a> + bufsize;<a name="l00287"></a>00287 <a name="l00288"></a>00288                     lg-&gt;<a class="code" href="struct_o_c_i___long.html#c1d382a8949e5d85954dc900c7b2ac7f">buffer</a>  = (ub1 *) OCI_MemRealloc(lg-&gt;<a class="code" href="struct_o_c_i___long.html#c1d382a8949e5d85954dc900c7b2ac7f">buffer</a>,<a name="l00289"></a>00289                                                          OCI_IPC_LONG_BUFFER,<a name="l00290"></a>00290                                                          lg-&gt;<a class="code" href="struct_o_c_i___long.html#1f42064a259fdac9565d6251378fd5ad">maxsize</a>, 1);<a name="l00291"></a>00291                 }<a name="l00292"></a>00292 <a name="l00293"></a>00293                 res = (lg-&gt;<a class="code" href="struct_o_c_i___long.html#c1d382a8949e5d85954dc900c7b2ac7f">buffer</a> != NULL);<a name="l00294"></a>00294 <a name="l00295"></a>00295                 <span class="comment">/* update piece info */</span><a name="l00296"></a>00296 <a name="l00297"></a>00297                 <span class="keywordflow">if</span> (res == TRUE)<a name="l00298"></a>00298                 {<a name="l00299"></a>00299                     lg-&gt;<a class="code" href="struct_o_c_i___long.html#db940d366e35a86fb32a9c4218cdbce9">piecesize</a> = bufsize;<a name="l00300"></a>00300 <a name="l00301"></a>00301                     OCI_CALL1<a name="l00302"></a>00302                     (<a name="l00303"></a>00303                         res, rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#c12ae7da6f8d20f00c6ad69cdb31373a">stmt</a>-&gt;<a class="code" href="struct_o_c_i___statement.html#338ddf58debd7de6ab9355f1e75d78f6">con</a>, rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#c12ae7da6f8d20f00c6ad69cdb31373a">stmt</a>,<a name="l00304"></a>00304 <a name="l00305"></a>00305                         OCIStmtSetPieceInfo((dvoid *) handle,<a name="l00306"></a>00306                                             (ub4) OCI_HTYPE_DEFINE,<a name="l00307"></a>00307                                             lg-&gt;<a class="code" href="struct_o_c_i___long.html#772460c6f3bb2b3c13dd231f1439c41c">stmt</a>-&gt;<a class="code" href="struct_o_c_i___statement.html#338ddf58debd7de6ab9355f1e75d78f6">con</a>-&gt;<a class="code" href="struct_o_c_i___connection.html#573a359867139990b1b0f50aa7a86175">err</a>,<a name="l00308"></a>00308                                             (dvoid *) (lg-&gt;<a class="code" href="struct_o_c_i___long.html#c1d382a8949e5d85954dc900c7b2ac7f">buffer</a> + lg-&gt;<a class="code" href="struct_o_c_i___long.html#936260167a8950b8022f7050f2f3dd87">size</a>),<a name="l00309"></a>00309                                             &amp;lg-&gt;<a class="code" href="struct_o_c_i___long.html#db940d366e35a86fb32a9c4218cdbce9">piecesize</a>, piece,<a name="l00310"></a>00310                                             lg-&gt;<a class="code" href="struct_o_c_i___long.html#4c9c3f77e49a44d38c3c5db253f8e6c2">def</a>-&gt;buf.inds, (ub2 *) NULL)<a name="l00311"></a>00311                      )<a name="l00312"></a>00312 <a name="l00313"></a>00313                 }<a name="l00314"></a>00314 <a name="l00315"></a>00315                 <span class="keywordflow">break</span>;<a name="l00316"></a>00316             }<a name="l00317"></a>00317         }<a name="l00318"></a>00318 <a name="l00319"></a>00319         <span class="comment">/* fetch data */</span><a name="l00320"></a>00320 <a name="l00321"></a>00321 <span class="preprocessor">#if defined(OCI_STMT_SCROLLABLE_READONLY)</span><a name="l00322"></a>00322 <span class="preprocessor"></span><a name="l00323"></a>00323         <span class="keywordflow">if</span> (OCILib.use_scrollable_cursors == TRUE)<a name="l00324"></a>00324         {<a name="l00325"></a>00325             rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#261b838dbeb0658e84d45a210542c7e8">fetch_status</a> = OCIStmtFetch2(rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#c12ae7da6f8d20f00c6ad69cdb31373a">stmt</a>-&gt;<a class="code" href="struct_o_c_i___statement.html#e526a309495dc7d8bcb747b2771de6b9">stmt</a>, rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#c12ae7da6f8d20f00c6ad69cdb31373a">stmt</a>-&gt;<a class="code" href="struct_o_c_i___statement.html#338ddf58debd7de6ab9355f1e75d78f6">con</a>-&gt;<a class="code" href="struct_o_c_i___connection.html#573a359867139990b1b0f50aa7a86175">err</a>,<a name="l00326"></a>00326                                              rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#f1e985de777e4ab098b2183fc43e4612">fetch_size</a>, (ub2) OCI_FETCH_NEXT,<a name="l00327"></a>00327                                              (sb4) 0, (ub4) OCI_DEFAULT);<a name="l00328"></a>00328         }<a name="l00329"></a>00329         <span class="keywordflow">else</span><a name="l00330"></a>00330 <span class="preprocessor">#endif</span><a name="l00331"></a>00331 <span class="preprocessor"></span>        {<a name="l00332"></a>00332             rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#261b838dbeb0658e84d45a210542c7e8">fetch_status</a> = OCIStmtFetch(rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#c12ae7da6f8d20f00c6ad69cdb31373a">stmt</a>-&gt;<a class="code" href="struct_o_c_i___statement.html#e526a309495dc7d8bcb747b2771de6b9">stmt</a>, rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#c12ae7da6f8d20f00c6ad69cdb31373a">stmt</a>-&gt;<a class="code" href="struct_o_c_i___statement.html#338ddf58debd7de6ab9355f1e75d78f6">con</a>-&gt;<a class="code" href="struct_o_c_i___connection.html#573a359867139990b1b0f50aa7a86175">err</a>,<a name="l00333"></a>00333                                             rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#f1e985de777e4ab098b2183fc43e4612">fetch_size</a>, (ub2) OCI_FETCH_NEXT,<a name="l00334"></a>00334                                             (ub4) OCI_DEFAULT);<a name="l00335"></a>00335         }<a name="l00336"></a>00336 <a name="l00337"></a>00337         <span class="keywordflow">if</span> (rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#261b838dbeb0658e84d45a210542c7e8">fetch_status</a> == OCI_NO_DATA)<a name="l00338"></a>00338             rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#261b838dbeb0658e84d45a210542c7e8">fetch_status</a> = rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#261b838dbeb0658e84d45a210542c7e8">fetch_status</a>;<a name="l00339"></a>00339 <a name="l00340"></a>00340         <span class="comment">/* check for return value of fetch call */</span><a name="l00341"></a>00341 <a name="l00342"></a>00342         <span class="keywordflow">if</span> (rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#261b838dbeb0658e84d45a210542c7e8">fetch_status</a> == OCI_ERROR)<a name="l00343"></a>00343         {<a name="l00344"></a>00344               OCI_ExceptionOCI(rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#c12ae7da6f8d20f00c6ad69cdb31373a">stmt</a>-&gt;<a class="code" href="struct_o_c_i___statement.html#338ddf58debd7de6ab9355f1e75d78f6">con</a>-&gt;<a class="code" href="struct_o_c_i___connection.html#573a359867139990b1b0f50aa7a86175">err</a>, rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#c12ae7da6f8d20f00c6ad69cdb31373a">stmt</a>-&gt;<a class="code" href="struct_o_c_i___statement.html#338ddf58debd7de6ab9355f1e75d78f6">con</a>, rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#c12ae7da6f8d20f00c6ad69cdb31373a">stmt</a>);<a name="l00345"></a>00345               res = FALSE;<a name="l00346"></a>00346         }<a name="l00347"></a>00347         <span class="keywordflow">else</span><a name="l00348"></a>00348         {<a name="l00349"></a>00349             <span class="comment">/* search for the given column */</span><a name="l00350"></a>00350 <a name="l00351"></a>00351             <span class="keywordflow">for</span> (i = 0; i &lt; rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#5c03dc5e587cf642f7417ee62b2ea808">nb_defs</a>; i++)<a name="l00352"></a>00352             {<a name="l00353"></a>00353                 OCI_Define *def = &amp;rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#ca691fad2f84ecfb8956f5e1649c0a53">defs</a>[i];<a name="l00354"></a>00354 <a name="l00355"></a>00355                 <span class="keywordflow">if</span> (def-&gt;col.type == OCI_CDT_LONG &amp;&amp; def-&gt;buf.handle == handle)<a name="l00356"></a>00356                 {<a name="l00357"></a>00357                     <span class="comment">/* get the long object for the given internal row */</span><a name="l00358"></a>00358 <a name="l00359"></a>00359                     <a class="code" href="struct_o_c_i___long.html" title="Oracle Long datatype.">OCI_Long</a> *lg = (<a class="code" href="struct_o_c_i___long.html" title="Oracle Long datatype.">OCI_Long</a> *) def-&gt;buf.data[iter];<a name="l00360"></a>00360 <a name="l00361"></a>00361                     lg-&gt;<a class="code" href="struct_o_c_i___long.html#936260167a8950b8022f7050f2f3dd87">size</a> += lg-&gt;<a class="code" href="struct_o_c_i___long.html#db940d366e35a86fb32a9c4218cdbce9">piecesize</a>;<a name="l00362"></a>00362 <a name="l00363"></a>00363                     <span class="keywordflow">break</span>;<a name="l00364"></a>00364                 }<a name="l00365"></a>00365             }<a name="l00366"></a>00366         }<a name="l00367"></a>00367     }<a name="l00368"></a>00368 <a name="l00369"></a>00369     <span class="comment">/* for LONG columns, set the zero terminal string */</span><a name="l00370"></a>00370 <a name="l00371"></a>00371     <span class="keywordflow">for</span> (i = 0; i &lt; rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#5c03dc5e587cf642f7417ee62b2ea808">nb_defs</a>; i++)<a name="l00372"></a>00372     {<a name="l00373"></a>00373         OCI_Define *def = &amp;rs-&gt;<a class="code" href="struct_o_c_i___resultset.html#ca691fad2f84ecfb8956f5e1649c0a53">defs</a>[i];<a name="l00374"></a>00374 <a name="l00375"></a>00375         <span class="keywordflow">if</span> (def-&gt;col.type == OCI_CDT_LONG &amp;&amp; def-&gt;col.subtype == OCI_CLONG)<a name="l00376"></a>00376         {<a name="l00377"></a>00377             <span class="keywordflow">for</span> (j = 0; j &lt; def-&gt;buf.count; j++)<a name="l00378"></a>00378             {<a name="l00379"></a>00379                 <a class="code" href="struct_o_c_i___long.html" title="Oracle Long datatype.">OCI_Long</a> *lg = (<a class="code" href="struct_o_c_i___long.html" title="Oracle Long datatype.">OCI_Long</a> *) def-&gt;buf.data[j];<a name="l00380"></a>00380 <a name="l00381"></a>00381                 if (lg-&gt;<a class="code" href="struct_o_c_i___long.html#c1d382a8949e5d85954dc900c7b2ac7f">buffer</a> != NULL)<a name="l00382"></a>00382                     lg-&gt;<a class="code" href="struct_o_c_i___long.html#c1d382a8949e5d85954dc900c7b2ac7f">buffer</a>[lg-&gt;<a class="code" href="struct_o_c_i___long.html#936260167a8950b8022f7050f2f3dd87">size</a>] = 0;<a name="l00383"></a>00383             }<a name="l00384"></a>00384         }<a name="l00385"></a>00385     }<a name="l00386"></a>00386 <a name="l00387"></a>00387     <span class="keywordflow">return</span> res;<a name="l00388"></a>00388 }<a name="l00389"></a>00389 <a name="l00390"></a>00390 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00391"></a>00391 <span class="comment"> * OCI_FetchData</span><a name="l00392"></a>00392 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00393"></a>00393 

⌨️ 快捷键说明

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