📄 collection_8c-source.html
字号:
<a name="l00248"></a><a class="code" href="group__g__collection.html#g107e9fef3fc0bced6503e566a67dfcb5">00248</a> <span class="keywordtype">int</span> OCI_API <a class="code" href="group__g__collection.html#g107e9fef3fc0bced6503e566a67dfcb5" title="Returns the current number of elements of the given collection.">OCI_CollGetSize</a>(<a class="code" href="struct_o_c_i___coll.html" title="Oracle Collections (VARRAYs and Nested Tables) representation.">OCI_Coll</a> *coll)<a name="l00249"></a>00249 {<a name="l00250"></a>00250 <span class="keywordtype">int</span> size = 0;<a name="l00251"></a>00251 <a name="l00252"></a>00252 OCI_CHECK_PTR(OCI_IPC_COLLECTION, coll, 0);<a name="l00253"></a>00253 <a name="l00254"></a>00254 size = coll-><a class="code" href="struct_o_c_i___coll.html#6d9fad8c88861770d8d825492fffaa5f">size</a>;<a name="l00255"></a>00255 <a name="l00256"></a>00256 OCI_RESULT(TRUE);<a name="l00257"></a>00257 <a name="l00258"></a>00258 <span class="keywordflow">return</span> size;<a name="l00259"></a>00259 }<a name="l00260"></a>00260 <a name="l00261"></a>00261 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00262"></a>00262 <span class="comment"> * OCI_CollTrim</span><a name="l00263"></a>00263 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00264"></a>00264 <a name="l00265"></a><a class="code" href="group__g__collection.html#gc5e37e3a0fd362c8c3aa150d5cb66c51">00265</a> <span class="keywordtype">boolean</span> OCI_API <a class="code" href="group__g__collection.html#gc5e37e3a0fd362c8c3aa150d5cb66c51" title="Trims the given number of elements from the end of the collection.">OCI_CollTrim</a>(<a class="code" href="struct_o_c_i___coll.html" title="Oracle Collections (VARRAYs and Nested Tables) representation.">OCI_Coll</a> *coll, <span class="keywordtype">int</span> nb_elem)<a name="l00266"></a>00266 {<a name="l00267"></a>00267 <span class="keywordtype">boolean</span> res = TRUE;<a name="l00268"></a>00268 <a name="l00269"></a>00269 OCI_CHECK_PTR(OCI_IPC_COLLECTION, coll, FALSE);<a name="l00270"></a>00270 <a name="l00271"></a>00271 OCI_CHECK_BOUND(coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>, nb_elem, 1, coll-><a class="code" href="struct_o_c_i___coll.html#6d9fad8c88861770d8d825492fffaa5f">size</a>, FALSE);<a name="l00272"></a>00272 <a name="l00273"></a>00273 OCI_CALL2<a name="l00274"></a>00274 (<a name="l00275"></a>00275 res, coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>, <a name="l00276"></a>00276 <a name="l00277"></a>00277 OCICollTrim(OCILib.env, coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>-><a class="code" href="struct_o_c_i___connection.html#573a359867139990b1b0f50aa7a86175">err</a>, (sb4) nb_elem, coll-><a class="code" href="struct_o_c_i___coll.html#cd0eeebc9c44bcabe4a2ef626d94bef1">handle</a>)<a name="l00278"></a>00278 )<a name="l00279"></a>00279 <a name="l00280"></a>00280 OCI_CollGetInternalSize(coll);<a name="l00281"></a>00281 <a name="l00282"></a>00282 OCI_RESULT(res);<a name="l00283"></a>00283 <a name="l00284"></a>00284 <span class="keywordflow">return</span> res;<a name="l00285"></a>00285 }<a name="l00286"></a>00286 <a name="l00287"></a>00287 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00288"></a>00288 <span class="comment"> * OCI_CollGetAt</span><a name="l00289"></a>00289 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00290"></a>00290 <a name="l00291"></a><a class="code" href="group__g__collection.html#g65523dc5e889b8d1e956674dd05e9b8b">00291</a> <a class="code" href="struct_o_c_i___elem.html" title="Oracle Collection item representation.">OCI_Elem</a> * OCI_API <a class="code" href="group__g__collection.html#g65523dc5e889b8d1e956674dd05e9b8b" title="Return the element at the given position in the collection.">OCI_CollGetAt</a>(<a class="code" href="struct_o_c_i___coll.html" title="Oracle Collections (VARRAYs and Nested Tables) representation.">OCI_Coll</a> *coll, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index)<a name="l00292"></a>00292 {<a name="l00293"></a>00293 <span class="keywordtype">boolean</span> res = TRUE;<a name="l00294"></a>00294 <span class="keywordtype">boolean</span> exists = FALSE;<a name="l00295"></a>00295 <span class="keywordtype">void</span> *data = NULL;<a name="l00296"></a>00296 OCIInd *p_ind = NULL;<a name="l00297"></a>00297 <a class="code" href="struct_o_c_i___elem.html" title="Oracle Collection item representation.">OCI_Elem</a> *elem = NULL;<a name="l00298"></a>00298 <a name="l00299"></a>00299 OCI_CHECK_PTR(OCI_IPC_COLLECTION, coll, NULL);<a name="l00300"></a>00300 OCI_CHECK_BOUND(coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>, (<span class="keywordtype">int</span>) index, 1, coll-><a class="code" href="struct_o_c_i___coll.html#6d9fad8c88861770d8d825492fffaa5f">size</a>, FALSE);<a name="l00301"></a>00301 <a name="l00302"></a>00302 OCI_CALL2<a name="l00303"></a>00303 (<a name="l00304"></a>00304 res, coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>, <a name="l00305"></a>00305 <a name="l00306"></a>00306 OCICollGetElem(OCILib.env, coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>-><a class="code" href="struct_o_c_i___connection.html#573a359867139990b1b0f50aa7a86175">err</a>, coll-><a class="code" href="struct_o_c_i___coll.html#cd0eeebc9c44bcabe4a2ef626d94bef1">handle</a>, (sb4) index-1, <a name="l00307"></a>00307 &exists, &data, (<span class="keywordtype">void</span> **) &p_ind)<a name="l00308"></a>00308 )<a name="l00309"></a>00309 <a name="l00310"></a>00310 <span class="keywordflow">if</span> (res == TRUE && exists == TRUE && data != NULL)<a name="l00311"></a>00311 {<a name="l00312"></a>00312 elem = coll-><a class="code" href="struct_o_c_i___coll.html#7d09c118ff0a39a1987405a26593136e">elem</a> = OCI_ElemInit(coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>, &coll-><a class="code" href="struct_o_c_i___coll.html#7d09c118ff0a39a1987405a26593136e">elem</a>, <a name="l00313"></a>00313 (OCIColl *) data, <a name="l00314"></a>00314 p_ind, coll-><a class="code" href="struct_o_c_i___coll.html#0e39b5a3577e164a231eefdc17c13968">nty</a>-><a class="code" href="struct_o_c_i___schema.html#cf25d0fa0236499ea3845ab77338a5e9">cols</a>);<a name="l00315"></a>00315 }<a name="l00316"></a>00316 <a name="l00317"></a>00317 OCI_RESULT(res);<a name="l00318"></a>00318 <a name="l00319"></a>00319 <span class="keywordflow">return</span> elem;<a name="l00320"></a>00320 }<a name="l00321"></a>00321 <a name="l00322"></a>00322 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00323"></a>00323 <span class="comment"> * OCI_CollSetAt</span><a name="l00324"></a>00324 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00325"></a>00325 <a name="l00326"></a><a class="code" href="group__g__collection.html#g5fa6e43afbe0dc39b56b52f8e09dc29a">00326</a> <span class="keywordtype">boolean</span> OCI_API <a class="code" href="group__g__collection.html#g5fa6e43afbe0dc39b56b52f8e09dc29a" title="Assign the given element value to the element at the given position in the collection...">OCI_CollSetAt</a>(<a class="code" href="struct_o_c_i___coll.html" title="Oracle Collections (VARRAYs and Nested Tables) representation.">OCI_Coll</a> *coll, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index, <a class="code" href="struct_o_c_i___elem.html" title="Oracle Collection item representation.">OCI_Elem</a> *elem)<a name="l00327"></a>00327 {<a name="l00328"></a>00328 <span class="keywordtype">boolean</span> res = TRUE;<a name="l00329"></a>00329 <a name="l00330"></a>00330 OCI_CHECK_PTR(OCI_IPC_COLLECTION, coll, FALSE);<a name="l00331"></a>00331 OCI_CHECK_PTR(OCI_IPC_ELEMENT, elem, FALSE);<a name="l00332"></a>00332 OCI_CHECK_COMPAT(coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>, elem-><a class="code" href="struct_o_c_i___elem.html#89b019f0c9d281432fc411d1ebf7ea1f">col</a>-><a class="code" href="struct_o_c_i___column.html#ad9396e5095db31c838023313a41569e">icode</a>, coll-><a class="code" href="struct_o_c_i___coll.html#0e39b5a3577e164a231eefdc17c13968">nty</a>-><a class="code" href="struct_o_c_i___schema.html#cf25d0fa0236499ea3845ab77338a5e9">cols</a>[0].<a class="code" href="struct_o_c_i___column.html#ad9396e5095db31c838023313a41569e">icode</a>, FALSE);<a name="l00333"></a>00333 <a name="l00334"></a>00334 OCI_CALL2<a name="l00335"></a>00335 (<a name="l00336"></a>00336 res, coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>, <a name="l00337"></a>00337 <a name="l00338"></a>00338 OCICollAssignElem(OCILib.env, coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>-><a class="code" href="struct_o_c_i___connection.html#573a359867139990b1b0f50aa7a86175">err</a>, (sb4) index, elem-><a class="code" href="struct_o_c_i___elem.html#c0d4f7331dec95693a62f16f58fd83b1">handle</a>,<a name="l00339"></a>00339 elem-><a class="code" href="struct_o_c_i___elem.html#c6e12298a89c23a2d9c67d79be728246">ind</a>,coll-><a class="code" href="struct_o_c_i___coll.html#cd0eeebc9c44bcabe4a2ef626d94bef1">handle</a>)<a name="l00340"></a>00340 )<a name="l00341"></a>00341 <a name="l00342"></a>00342 OCI_RESULT(res);<a name="l00343"></a>00343 <a name="l00344"></a>00344 <span class="keywordflow">return</span> res;<a name="l00345"></a>00345 }<a name="l00346"></a>00346 <a name="l00347"></a>00347 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00348"></a>00348 <span class="comment"> * OCI_CollAppend</span><a name="l00349"></a>00349 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00350"></a>00350 <a name="l00351"></a><a class="code" href="group__g__collection.html#g8b92db49c038ae235ef85743194ace83">00351</a> <span class="keywordtype">boolean</span> OCI_API <a class="code" href="group__g__collection.html#g8b92db49c038ae235ef85743194ace83" title="Append the given element at the end of the collection.">OCI_CollAppend</a>(<a class="code" href="struct_o_c_i___coll.html" title="Oracle Collections (VARRAYs and Nested Tables) representation.">OCI_Coll</a> *coll, <a class="code" href="struct_o_c_i___elem.html" title="Oracle Collection item representation.">OCI_Elem</a> *elem)<a name="l00352"></a>00352 {<a name="l00353"></a>00353 <span class="keywordtype">boolean</span> res = TRUE;<a name="l00354"></a>00354 <a name="l00355"></a>00355 OCI_CHECK_PTR(OCI_IPC_COLLECTION, coll, FALSE);<a name="l00356"></a>00356 OCI_CHECK_PTR(OCI_IPC_ELEMENT, elem, FALSE);<a name="l00357"></a>00357 OCI_CHECK_COMPAT(coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>, elem-><a class="code" href="struct_o_c_i___elem.html#89b019f0c9d281432fc411d1ebf7ea1f">col</a>-><a class="code" href="struct_o_c_i___column.html#ad9396e5095db31c838023313a41569e">icode</a>, coll-><a class="code" href="struct_o_c_i___coll.html#0e39b5a3577e164a231eefdc17c13968">nty</a>-><a class="code" href="struct_o_c_i___schema.html#cf25d0fa0236499ea3845ab77338a5e9">cols</a>[0].<a class="code" href="struct_o_c_i___column.html#ad9396e5095db31c838023313a41569e">icode</a>, FALSE);<a name="l00358"></a>00358 <a name="l00359"></a>00359 OCI_CALL2<a name="l00360"></a>00360 (<a name="l00361"></a>00361 res, coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>, <a name="l00362"></a>00362 <a name="l00363"></a>00363 OCICollAppend(OCILib.env, coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>-><a class="code" href="struct_o_c_i___connection.html#573a359867139990b1b0f50aa7a86175">err</a>, elem-><a class="code" href="struct_o_c_i___elem.html#c0d4f7331dec95693a62f16f58fd83b1">handle</a>, elem-><a class="code" href="struct_o_c_i___elem.html#c6e12298a89c23a2d9c67d79be728246">ind</a>, <a name="l00364"></a>00364 coll-><a class="code" href="struct_o_c_i___coll.html#cd0eeebc9c44bcabe4a2ef626d94bef1">handle</a>)<a name="l00365"></a>00365 )<a name="l00366"></a>00366 <a name="l00367"></a>00367 OCI_CollGetInternalSize(coll);<a name="l00368"></a>00368 <a name="l00369"></a>00369 OCI_RESULT(res);<a name="l00370"></a>00370 <a name="l00371"></a>00371 <span class="keywordflow">return</span> res;<a name="l00372"></a>00372 }</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Thu Oct 9 10:07:42 2008 for OCILIB (C Driver for Oracle) by <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 + -