📄 collection_8c-source.html
字号:
<a name="l00117"></a>00117 )<a name="l00118"></a>00118 <a name="l00119"></a>00119 return res;<a name="l00120"></a>00120 }<a name="l00121"></a>00121 <a name="l00122"></a>00122 <span class="comment">/* ************************************************************************ *</span><a name="l00123"></a>00123 <span class="comment"> * PUBLIC FUNCTIONS</span><a name="l00124"></a>00124 <span class="comment"> * ************************************************************************ */</span><a name="l00125"></a>00125 <a name="l00126"></a>00126 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00127"></a>00127 <span class="comment"> * OCI_CollCreate</span><a name="l00128"></a>00128 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00129"></a>00129 <a name="l00130"></a><a class="code" href="group__g__collection.html#g60ff6fdf0c0b8b2761ddba752ffad42b">00130</a> <a class="code" href="struct_o_c_i___coll.html" title="Oracle Collections (VARRAYs and Nested Tables) representation.">OCI_Coll</a> * OCI_API <a class="code" href="group__g__collection.html#g60ff6fdf0c0b8b2761ddba752ffad42b" title="Create a local collection instance.">OCI_CollCreate</a>(<a class="code" href="struct_o_c_i___schema.html" title="Schema metadata handle.">OCI_Schema</a> *schema)<a name="l00131"></a>00131 {<a name="l00132"></a>00132 <a class="code" href="struct_o_c_i___coll.html" title="Oracle Collections (VARRAYs and Nested Tables) representation.">OCI_Coll</a> *coll = NULL;<a name="l00133"></a>00133 <a name="l00134"></a>00134 OCI_CHECK_INITIALIZED(NULL);<a name="l00135"></a>00135 <a name="l00136"></a>00136 OCI_CHECK_PTR(OCI_IPC_SCHEMA, schema, NULL);<a name="l00137"></a>00137 OCI_CHECK(schema->ccode == OCI_UNKNOWN, NULL)<a name="l00138"></a>00138 <a name="l00139"></a>00139 coll = OCI_CollInit(schema->con, &coll, (OCIColl *) NULL, schema);<a name="l00140"></a>00140 <a name="l00141"></a>00141 OCI_RESULT(coll != NULL);<a name="l00142"></a>00142 <a name="l00143"></a>00143 <span class="keywordflow">return</span> coll;<a name="l00144"></a>00144 }<a name="l00145"></a>00145 <a name="l00146"></a>00146 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00147"></a>00147 <span class="comment"> * OCI_CollFree</span><a name="l00148"></a>00148 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00149"></a>00149 <a name="l00150"></a><a class="code" href="group__g__collection.html#g8663babe980c99ff0441feedff973912">00150</a> <span class="keywordtype">boolean</span> OCI_API <a class="code" href="group__g__collection.html#g8663babe980c99ff0441feedff973912" title="Free a local collection.">OCI_CollFree</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="l00151"></a>00151 {<a name="l00152"></a>00152 OCI_CHECK_PTR(OCI_IPC_COLLECTION, coll, FALSE);<a name="l00153"></a>00153 OCI_CHECK_OBJECT_FETCHED(coll, FALSE);<a name="l00154"></a>00154 <a name="l00155"></a>00155 <span class="comment">/* free data element accessor */</span><a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="keywordflow">if</span> (coll-><a class="code" href="struct_o_c_i___coll.html#7d09c118ff0a39a1987405a26593136e">elem</a> != NULL)<a name="l00158"></a>00158 {<a name="l00159"></a>00159 <a class="code" href="group__g__collection.html#gdf1010d812aa53c3b27d991fa47b4f98" title="Free a local collection element.">OCI_ElemFree</a>(coll-><a class="code" href="struct_o_c_i___coll.html#7d09c118ff0a39a1987405a26593136e">elem</a>);<a name="l00160"></a>00160 coll-><a class="code" href="struct_o_c_i___coll.html#7d09c118ff0a39a1987405a26593136e">elem</a> = NULL;<a name="l00161"></a>00161 }<a name="l00162"></a>00162 <a name="l00163"></a>00163 <span class="comment">/* create collection for local object */</span><a name="l00164"></a>00164 <a name="l00165"></a>00165 <span class="keywordflow">if</span> (coll-><a class="code" href="struct_o_c_i___coll.html#ab5e919829343ed52c8ecbc6415a95b5">hstate</a> == OCI_OBJECT_ALLOCATED)<a name="l00166"></a>00166 { <a name="l00167"></a>00167 OCI_OCIObjectFree(OCILib.env, coll-><a class="code" href="struct_o_c_i___coll.html#0e39b5a3577e164a231eefdc17c13968">nty</a>-><a class="code" href="struct_o_c_i___schema.html#0ef69317a497d87f4c4b1c2975592f5f">con</a>-><a class="code" href="struct_o_c_i___connection.html#573a359867139990b1b0f50aa7a86175">err</a>,<a name="l00168"></a>00168 coll-><a class="code" href="struct_o_c_i___coll.html#cd0eeebc9c44bcabe4a2ef626d94bef1">handle</a>, OCI_OBJECTFREE_NONULL);<a name="l00169"></a>00169 }<a name="l00170"></a>00170 <a name="l00171"></a>00171 OCI_FREE(coll);<a name="l00172"></a>00172 <a name="l00173"></a>00173 OCI_RESULT(TRUE);<a name="l00174"></a>00174 <a name="l00175"></a>00175 <span class="keywordflow">return</span> TRUE;<a name="l00176"></a>00176 }<a name="l00177"></a>00177 <a name="l00178"></a>00178 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00179"></a>00179 <span class="comment"> * OCI_CollAssign</span><a name="l00180"></a>00180 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00181"></a>00181 <a name="l00182"></a><a class="code" href="group__g__collection.html#g5121ce70006885b5f45df2c764ec8d8e">00182</a> <span class="keywordtype">boolean</span> OCI_API <a class="code" href="group__g__collection.html#g5121ce70006885b5f45df2c764ec8d8e" title="Assign a collection to another another one.">OCI_CollAssign</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___coll.html" title="Oracle Collections (VARRAYs and Nested Tables) representation.">OCI_Coll</a> *coll_src)<a name="l00183"></a>00183 {<a name="l00184"></a>00184 <span class="keywordtype">boolean</span> res = TRUE;<a name="l00185"></a>00185 <a name="l00186"></a>00186 OCI_CHECK_PTR(OCI_IPC_COLLECTION, coll, FALSE);<a name="l00187"></a>00187 OCI_CHECK_PTR(OCI_IPC_COLLECTION, coll_src, FALSE);<a name="l00188"></a>00188 <a name="l00189"></a>00189 OCI_CHECK_COMPAT(coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>, <a name="l00190"></a>00190 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>,<a name="l00191"></a>00191 coll_src-><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="l00192"></a>00192 <a name="l00193"></a>00193 OCI_CALL2<a name="l00194"></a>00194 (<a name="l00195"></a>00195 res, coll-><a class="code" href="struct_o_c_i___coll.html#7b4f1aa1b566e2e8d4e62844991aeed5">con</a>,<a name="l00196"></a>00196 <a name="l00197"></a>00197 OCICollAssign(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>, coll_src-><a class="code" href="struct_o_c_i___coll.html#cd0eeebc9c44bcabe4a2ef626d94bef1">handle</a>)<a name="l00198"></a>00198 )<a name="l00199"></a>00199 <a name="l00200"></a>00200 OCI_CollGetInternalSize(coll);<a name="l00201"></a>00201 <a name="l00202"></a>00202 OCI_RESULT(res);<a name="l00203"></a>00203 <a name="l00204"></a>00204 <span class="keywordflow">return</span> res;<a name="l00205"></a>00205 }<a name="l00206"></a>00206 <a name="l00207"></a>00207 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00208"></a>00208 <span class="comment"> * OCI_CollGetType</span><a name="l00209"></a>00209 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00210"></a>00210 <a name="l00211"></a><a class="code" href="group__g__collection.html#g18518027318ac527c9cbefab4f16b7ba">00211</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> OCI_API <a class="code" href="group__g__collection.html#g18518027318ac527c9cbefab4f16b7ba" title="Return the collection type.">OCI_CollGetType</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="l00212"></a>00212 {<a name="l00213"></a>00213 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> type = OCI_UNKNOWN;<a name="l00214"></a>00214 <a name="l00215"></a>00215 OCI_CHECK_PTR(OCI_IPC_COLLECTION, coll, OCI_UNKNOWN);<a name="l00216"></a>00216 <a name="l00217"></a>00217 <span class="keywordflow">if</span> (coll-><a class="code" href="struct_o_c_i___coll.html#0e39b5a3577e164a231eefdc17c13968">nty</a>-><a class="code" href="struct_o_c_i___schema.html#9621c72ebf1ceb7161f6d0c49d4c8264">ccode</a> == OCI_TYPECODE_TABLE)<a name="l00218"></a>00218 type = OCI_COLL_NESTED_TABLE;<a name="l00219"></a>00219 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(coll-><a class="code" href="struct_o_c_i___coll.html#0e39b5a3577e164a231eefdc17c13968">nty</a>-><a class="code" href="struct_o_c_i___schema.html#9621c72ebf1ceb7161f6d0c49d4c8264">ccode</a> == OCI_TYPECODE_VARRAY)<a name="l00220"></a>00220 type = OCI_COLL_VARRAY;<a name="l00221"></a>00221 <a name="l00222"></a>00222 OCI_RESULT(TRUE);<a name="l00223"></a>00223 <a name="l00224"></a>00224 <span class="keywordflow">return</span> type;<a name="l00225"></a>00225 }<a name="l00226"></a>00226 <a name="l00227"></a>00227 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00228"></a>00228 <span class="comment"> * OCI_CollGetCount</span><a name="l00229"></a>00229 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00230"></a>00230 <a name="l00231"></a><a class="code" href="group__g__collection.html#gfdc86421c73ed6955a965097cb335a64">00231</a> <span class="keywordtype">int</span> OCI_API <a class="code" href="group__g__collection.html#gfdc86421c73ed6955a965097cb335a64" title="Returns the maximum number of elements of the given collection.">OCI_CollGetMax</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="l00232"></a>00232 {<a name="l00233"></a>00233 <span class="keywordtype">int</span> max = 0;<a name="l00234"></a>00234 <a name="l00235"></a>00235 OCI_CHECK_PTR(OCI_IPC_COLLECTION, coll, 0);<a name="l00236"></a>00236 <a name="l00237"></a>00237 max = OCICollMax(OCILib.env, coll-><a class="code" href="struct_o_c_i___coll.html#cd0eeebc9c44bcabe4a2ef626d94bef1">handle</a>);<a name="l00238"></a>00238 <a name="l00239"></a>00239 OCI_RESULT(TRUE);<a name="l00240"></a>00240 <a name="l00241"></a>00241 <span class="keywordflow">return</span> max;<a name="l00242"></a>00242 }<a name="l00243"></a>00243 <a name="l00244"></a>00244 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00245"></a>00245 <span class="comment"> * OCI_CollGetSize</span><a name="l00246"></a>00246 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00247"></a>00247
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -