📄 object_8c-source.html
字号:
<a name="l00258"></a>00258 <a name="l00259"></a>00259 OCI_CHECK_PTR(OCI_IPC_CONNECTION, con, NULL);<a name="l00260"></a>00260 OCI_CHECK_PTR(OCI_IPC_SCHEMA, schema, NULL);<a name="l00261"></a>00261 <a name="l00262"></a>00262 obj = OCI_ObjectInit(con, &obj, NULL, schema);<a name="l00263"></a>00263 <a name="l00264"></a>00264 OCI_RESULT(obj != NULL);<a name="l00265"></a>00265 <a name="l00266"></a>00266 <span class="keywordflow">return</span> obj;<a name="l00267"></a>00267 }<a name="l00268"></a>00268 <a name="l00269"></a>00269 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00270"></a>00270 <span class="comment"> * OCI_ObjectFree</span><a name="l00271"></a>00271 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00272"></a>00272 <a name="l00273"></a><a class="code" href="group__g__usertypes.html#g3fd2c9dfdcab2c56400c95c31cc0851e">00273</a> <span class="keywordtype">boolean</span> OCI_API <a class="code" href="group__g__usertypes.html#g3fd2c9dfdcab2c56400c95c31cc0851e" title="Free a local object.">OCI_ObjectFree</a>(<a class="code" href="struct_o_c_i___object.html" title="Oracle Named types representation.">OCI_Object</a> *obj)<a name="l00274"></a>00274 {<a name="l00275"></a>00275 OCI_CHECK_PTR(OCI_IPC_OBJECT, obj, FALSE);<a name="l00276"></a>00276 <a name="l00277"></a>00277 OCI_CHECK_OBJECT_FETCHED(obj, FALSE);<a name="l00278"></a>00278 <a name="l00279"></a>00279 <span class="comment">/* if the object has sub-objects that have been fetched, we need to free</span><a name="l00280"></a>00280 <span class="comment"> these objects */</span><a name="l00281"></a>00281 <a name="l00282"></a>00282 <span class="keywordflow">if</span> (obj-><a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a> != NULL)<a name="l00283"></a>00283 {<a name="l00284"></a>00284 ub2 i;<a name="l00285"></a>00285 <a name="l00286"></a>00286 <span class="keywordflow">for</span> (i = 0; i < obj-><a class="code" href="struct_o_c_i___object.html#9fddeb4cff3c8e79ca972f4b2d83e2f6">nty</a>-><a class="code" href="struct_o_c_i___schema.html#7e653f740904e095a5dd9e2919f354ff">nb_cols</a>; i++)<a name="l00287"></a>00287 {<a name="l00288"></a>00288 <span class="keywordflow">if</span> (obj-><a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>[i] != NULL)<a name="l00289"></a>00289 {<a name="l00290"></a>00290 ((OCI_Datatype *) obj-><a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>[i])->hstate = OCI_OBJECT_FETCHED_DIRTY;<a name="l00291"></a>00291 <a name="l00292"></a>00292 <span class="keywordflow">switch</span> (obj-><a class="code" href="struct_o_c_i___object.html#9fddeb4cff3c8e79ca972f4b2d83e2f6">nty</a>-><a class="code" href="struct_o_c_i___schema.html#cf25d0fa0236499ea3845ab77338a5e9">cols</a>[i].<a class="code" href="struct_o_c_i___column.html#93bfdf4f9926d4680f93356402177110">type</a>)<a name="l00293"></a>00293 {<a name="l00294"></a>00294 <span class="keywordflow">case</span> OCI_CDT_DATETIME:<a name="l00295"></a>00295 <a name="l00296"></a>00296 <a class="code" href="group__g__date.html#gedf77cfe4bd5dab7909e4c2fb5173b48" title="Free an OCI_Date handle.">OCI_DateFree</a>((<a class="code" href="struct_o_c_i___date.html" title="Oracle internal date representation.">OCI_Date</a> *) obj-><a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>[i]);<a name="l00297"></a>00297 <span class="keywordflow">break</span>;<a name="l00298"></a>00298 <a name="l00299"></a>00299 <span class="keywordflow">case</span> OCI_CDT_LOB:<a name="l00300"></a>00300 <a name="l00301"></a>00301 <a class="code" href="group__g__lob.html#gac269a3de312c2c7d1a6193a9ab79545" title="Free a local temporary lob.">OCI_LobFree</a>((<a class="code" href="struct_o_c_i___lob.html" title="Oracle Internal Large objects :.">OCI_Lob</a> *) obj-><a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>[i]);<a name="l00302"></a>00302 <span class="keywordflow">break</span>;<a name="l00303"></a>00303 <a name="l00304"></a>00304 <span class="keywordflow">case</span> OCI_CDT_FILE:<a name="l00305"></a>00305 <a name="l00306"></a>00306 <a class="code" href="group__g__file.html#gd4b58b6d80e24bb045fb82d78c5cf36a" title="Free a local File object.">OCI_FileFree</a>((<a class="code" href="struct_o_c_i___file.html" title="Oracle External Large objects :.">OCI_File</a> *) obj-><a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>[i]);<a name="l00307"></a>00307 <span class="keywordflow">break</span>;<a name="l00308"></a>00308 <a name="l00309"></a>00309 <span class="keywordflow">case</span> OCI_CDT_OBJECT:<a name="l00310"></a>00310 <a name="l00311"></a>00311 <a class="code" href="group__g__usertypes.html#g3fd2c9dfdcab2c56400c95c31cc0851e" title="Free a local object.">OCI_ObjectFree</a>((<a class="code" href="struct_o_c_i___object.html" title="Oracle Named types representation.">OCI_Object</a> *) obj-><a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>[i]);<a name="l00312"></a>00312 <span class="keywordflow">break</span>;<a name="l00313"></a>00313 <a name="l00314"></a>00314 <span class="keywordflow">case</span> OCI_CDT_COLLECTION:<a name="l00315"></a>00315 <a name="l00316"></a>00316 <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> *) obj-><a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>[i]);;<a name="l00317"></a>00317 <span class="keywordflow">break</span>;<a name="l00318"></a>00318 <a name="l00319"></a>00319 <span class="keywordflow">case</span> OCI_CDT_TIMESTAMP:<a name="l00320"></a>00320 <a name="l00321"></a>00321 <a class="code" href="group__g__timestamp.html#g60e9851db1175d6b650f9df00db274da" title="Free an OCI_Timestamp handle.">OCI_TimestampFree</a>((<a class="code" href="struct_o_c_i___timestamp.html" title="Oracle internal timespamp representation.">OCI_Timestamp</a> *) obj-><a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>[i]);<a name="l00322"></a>00322 <span class="keywordflow">break</span>;<a name="l00323"></a>00323 <a name="l00324"></a>00324 <span class="keywordflow">case</span> OCI_CDT_INTERVAL:<a name="l00325"></a>00325 <a name="l00326"></a>00326 <a class="code" href="group__g__timestamp.html#g7623b368ab3486c15c6d671054fac3e3" title="Free an OCI_Interval handle.">OCI_IntervalFree</a>((<a class="code" href="struct_o_c_i___interval.html" title="Oracle internal interval representation.">OCI_Interval</a> *) obj-><a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>[i]);<a name="l00327"></a>00327 <span class="keywordflow">break</span>;<a name="l00328"></a>00328 }<a name="l00329"></a>00329 }<a name="l00330"></a>00330 }<a name="l00331"></a>00331 <a name="l00332"></a>00332 OCI_FREE(obj-><a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>);<a name="l00333"></a>00333 }<a name="l00334"></a>00334 <a name="l00335"></a>00335 <span class="keywordflow">if</span> (obj-><a class="code" href="struct_o_c_i___object.html#675b03e6dac56a3ff7c6743302e90ffc">hstate</a> == OCI_OBJECT_ALLOCATED)<a name="l00336"></a>00336 {<a name="l00337"></a>00337 OCI_OCIObjectFree(OCILib.env, obj-><a class="code" href="struct_o_c_i___object.html#8bde19100472fa2836e320e8e0878954">con</a>-><a class="code" href="struct_o_c_i___connection.html#573a359867139990b1b0f50aa7a86175">err</a>, obj-><a class="code" href="struct_o_c_i___object.html#68ed912c697729f379e568beb84236c9">handle</a>, <a name="l00338"></a>00338 OCI_OBJECTFREE_NONULL);<a name="l00339"></a>00339 }<a name="l00340"></a>00340 <a name="l00341"></a>00341 OCI_FREE(obj-><a class="code" href="struct_o_c_i___object.html#96a0b7cfa2636dde43654219b0c2aa0a">buf</a>);<a name="l00342"></a>00342 OCI_FREE(obj);<a name="l00343"></a>00343 <a name="l00344"></a>00344 OCI_RESULT(TRUE);<a name="l00345"></a>00345 <a name="l00346"></a>00346 <span class="keywordflow">return</span> TRUE;<a name="l00347"></a>00347 }<a name="l00348"></a>00348 <a name="l00349"></a>00349 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00350"></a>00350 <span class="comment"> * OCI_ObjectGetInt</span><a name="l00351"></a>00351 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00352"></a>00352 <a name="l00353"></a><a class="code" href="group__g__usertypes.html#gbeb0db1bb555a25b3012838aae3b9d11">00353</a> <span class="keywordtype">short</span> OCI_API <a class="code" href="group__g__usertypes.html#gbeb0db1bb555a25b3012838aae3b9d11" title="Return the short value of the given object attribute.">OCI_ObjectGetShort</a>(<a class="code" href="struct_o_c_i___object.html" title="Oracle Named types representation.">OCI_Object</a> *obj, <span class="keyword">const</span> mtext *attr)<a name="l00354"></a>00354 {<a name="l00355"></a>00355 <span class="keywordtype">short</span> value = 0;<a name="l00356"></a>00356 <a name="l00357"></a>00357 OCI_ObjectGetNumber(obj, attr, &value, <span class="keyword">sizeof</span>(value), OCI_NUM_SHORT);<a name="l00358"></a>00358 <a name="l00359"></a>00359 <span class="keywordflow">return</span> value;<a name="l00360"></a>00360 }<a name="l00361"></a>00361 <a name="l00362"></a>00362 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00363"></a>00363 <span class="comment"> * OCI_ObjectGetUnsignedInt</span><a name="l00364"></a>00364 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00365"></a>00365 <a name="l00366"></a><a class="code" href="group__g__usertypes.html#gd3b4fbb26ad147d477a9865fffa318f7">00366</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> OCI_API <a class="code" href="group__g__usertypes.html#gd3b4fbb26ad147d477a9865fffa318f7" title="Return the unsigned short value of the given object attribute.">OCI_ObjectGetUnsignedShort</a>(<a class="code" href="struct_o_c_i___object.html" title="Oracle Named types representation.">OCI_Object</a> *obj,<a name="l00367"></a>00367 <span class="keyword">const</span> mtext *attr)<a name="l00368"></a>00368 {<a name="l00369"></a>00369 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> value = 0;<a name="l00370"></a>00370 <a name="l00371"></a>00371 OCI_ObjectGetNumber(obj, attr, &value, <span class="keyword">sizeof</span>(value), OCI_NUM_USHORT);<a name="l00372"></a>00372 <a name="l00373"></a>00373 <span class="keywordflow">return</span> value;<a name="l00374"></a>00374 }<a name="l00375"></a>00375 <a name="l00376"></a>00376 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00377"></a>00377 <span class="comment"> * OCI_ObjectGetInt</span><a name="l00378"></a>00378 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00379"></a>00379 <a name="l00380"></a><a class="code" href="group__g__usertypes.html#g05bf984246cbaaa6d554af9cfb8d99e9">00380</a> <span class="keywordtype">int</span> OCI_API <a class="code" href="group__g__usertypes.html#g05bf984246cbaaa6d554af9cfb8d99e9" title="Return the integer value of the given object attribute.">OCI_ObjectGetInt</a>(<a class="code" href="struct_o_c_i___object.html" title="Oracle Named types representation.">OCI_Object</a> *obj, <span class="keyword">const</span> mtext *attr)<a name="l00381"></a>00381 {<a name="l00382"></a>00382 <span class="keywordtype">int</span> value = 0;<a name="l00383"></a>00383 <a name="l00384"></a>00384 OCI_ObjectGetNumber(obj, attr, &value, <span class="keyword">sizeof</span>(value), OCI_NUM_INT);<a name="l00385"></a>00385 <a name="l00386"></a>00386 <span class="keywordflow">return</span> value;<a name="l00387"></a>00387 }<a name="l00388"></a>00388 <a name="l00389"></a>00389 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00390"></a>00390 <span class="comment"> * OCI_ObjectGetUnsignedInt</span><a name="l00391"></a>00391 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00392"></a>00392 <a name="l00393"></a><a class="code" href="group__g__usertypes.html#g689f788d7a209d771e3bd58df9e2d107">00393</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> OCI_API <a class="code" href="group__g__usertypes.html#g689f788d7a209d771e3bd58df9e2d107" title="Return the unsigned integer value of the given object attribute.">OCI_ObjectGetUnsignedInt</a>(<a class="code" href="struct_o_c_i___object.html" title="Oracle Named types representation.">OCI_Object</a> *obj, <span class="keyword">const</span> mtext *attr)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -