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

📄 object_8c-source.html

📁 ORACLE编程的好东西,纯C写的OCI封装.很好用,支持数据池.
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<a name="l00530"></a>00530 <a name="l00531"></a>00531         res = (date != NULL);<a name="l00532"></a>00532 <a name="l00533"></a>00533         <span class="keywordflow">if</span> (res == TRUE)<a name="l00534"></a>00534             res = OCI_ObjectGetAttr(obj, attr, (<span class="keywordtype">void</span> **) &amp;date-&gt;<a class="code" href="struct_o_c_i___date.html#681a98f7d9313d572b3618044e2e4650">handle</a>, &amp;ind, &amp;tdo);<a name="l00535"></a>00535     }<a name="l00536"></a>00536 <a name="l00537"></a>00537     OCI_RESULT(res);<a name="l00538"></a>00538 <a name="l00539"></a>00539     <span class="keywordflow">return</span> date;<a name="l00540"></a>00540 }<a name="l00541"></a>00541 <a name="l00542"></a>00542 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00543"></a>00543 <span class="comment"> * OCI_ObjectGetTimeStamp</span><a name="l00544"></a>00544 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00545"></a>00545 <a name="l00546"></a><a class="code" href="group__g__usertypes.html#g35a2a5b42dc6a188c7c1226ea2472d2a">00546</a> <a class="code" href="struct_o_c_i___timestamp.html" title="Oracle internal timespamp representation.">OCI_Timestamp</a> * OCI_API <a class="code" href="group__g__usertypes.html#g35a2a5b42dc6a188c7c1226ea2472d2a" title="Return the timestamp value of the given object attribute.">OCI_ObjectGetTimeStamp</a>(<a class="code" href="struct_o_c_i___object.html" title="Oracle Named types representation.">OCI_Object</a> *obj, <a name="l00547"></a>00547                                                <span class="keyword">const</span> mtext *attr)<a name="l00548"></a>00548 {<a name="l00549"></a>00549     <a class="code" href="struct_o_c_i___timestamp.html" title="Oracle internal timespamp representation.">OCI_Timestamp</a> *tmsp = NULL;<a name="l00550"></a>00550     <span class="keywordtype">boolean</span> res         = FALSE;<a name="l00551"></a>00551     <span class="keywordtype">int</span> index           = OCI_ObjectGetIndex(obj, attr, OCI_CDT_TIMESTAMP);<a name="l00552"></a>00552     <span class="keywordflow">if</span> (index &gt;= 0)<a name="l00553"></a>00553     {<a name="l00554"></a>00554         OCIInd ind          = 0;<a name="l00555"></a>00555         OCIType *tdo        = NULL;<a name="l00556"></a>00556         OCIDateTime **value = NULL;<a name="l00557"></a>00557 <a name="l00558"></a>00558         res = OCI_ObjectGetAttr(obj, attr, (<span class="keywordtype">void</span> **) &amp;value, &amp;ind, &amp;tdo);<a name="l00559"></a>00559 <a name="l00560"></a>00560         <span class="keywordflow">if</span> ((res == TRUE) &amp;&amp; (value != NULL))<a name="l00561"></a>00561         {<a name="l00562"></a>00562            tmsp = OCI_TimestampInit(obj-&gt;<a class="code" href="struct_o_c_i___object.html#8bde19100472fa2836e320e8e0878954">con</a>, <a name="l00563"></a>00563                                     (<a class="code" href="struct_o_c_i___timestamp.html" title="Oracle internal timespamp representation.">OCI_Timestamp</a> **) &amp;obj-&gt;<a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>[index], <a name="l00564"></a>00564                                     (OCIDateTime *) *value, <a name="l00565"></a>00565                                     obj-&gt;<a class="code" href="struct_o_c_i___object.html#9fddeb4cff3c8e79ca972f4b2d83e2f6">nty</a>-&gt;<a class="code" href="struct_o_c_i___schema.html#cf25d0fa0236499ea3845ab77338a5e9">cols</a>[index].<a class="code" href="struct_o_c_i___column.html#e1fb2448942e7ee1c3fa23662612f1e6">subtype</a>);<a name="l00566"></a>00566         <a name="l00567"></a>00567            res = (tmsp != NULL);<a name="l00568"></a>00568         }<a name="l00569"></a>00569     }<a name="l00570"></a>00570 <a name="l00571"></a>00571     OCI_RESULT(res);<a name="l00572"></a>00572 <a name="l00573"></a>00573     <span class="keywordflow">return</span> tmsp;<a name="l00574"></a>00574 }<a name="l00575"></a>00575 <a name="l00576"></a>00576 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00577"></a>00577 <span class="comment"> * OCI_ObjectGetInterval</span><a name="l00578"></a>00578 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00579"></a>00579 <a name="l00580"></a><a class="code" href="group__g__usertypes.html#gea3e41e37f3a6490aad8c0355adbcd5d">00580</a> <a class="code" href="struct_o_c_i___interval.html" title="Oracle internal interval representation.">OCI_Interval</a> * OCI_API <a class="code" href="group__g__usertypes.html#gea3e41e37f3a6490aad8c0355adbcd5d" title="Return the interval value of the given object attribute.">OCI_ObjectGetInterval</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="l00581"></a>00581 {<a name="l00582"></a>00582     <a class="code" href="struct_o_c_i___interval.html" title="Oracle internal interval representation.">OCI_Interval</a> *itv = NULL;<a name="l00583"></a>00583     <span class="keywordtype">boolean</span> res       = FALSE;<a name="l00584"></a>00584     <span class="keywordtype">int</span> index         = OCI_ObjectGetIndex(obj, attr, OCI_CDT_INTERVAL);<a name="l00585"></a>00585 <a name="l00586"></a>00586     <span class="keywordflow">if</span> (index &gt;= 0)<a name="l00587"></a>00587     {<a name="l00588"></a>00588         OCIInd ind          = 0;<a name="l00589"></a>00589         OCIType *tdo        = NULL;<a name="l00590"></a>00590         OCIInterval **value = NULL;<a name="l00591"></a>00591         <a name="l00592"></a>00592         res = OCI_ObjectGetAttr(obj, attr, (<span class="keywordtype">void</span> **) &amp;value, &amp;ind, &amp;tdo);<a name="l00593"></a>00593 <a name="l00594"></a>00594         <span class="keywordflow">if</span> ((res == TRUE) &amp;&amp; (value != NULL))<a name="l00595"></a>00595         {<a name="l00596"></a>00596             itv = OCI_IntervalInit(obj-&gt;<a class="code" href="struct_o_c_i___object.html#8bde19100472fa2836e320e8e0878954">con</a>, <a name="l00597"></a>00597                                    (<a class="code" href="struct_o_c_i___interval.html" title="Oracle internal interval representation.">OCI_Interval</a> **) &amp;obj-&gt;<a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>[index], <a name="l00598"></a>00598                                    (OCIInterval *) *value, <a name="l00599"></a>00599                                    obj-&gt;<a class="code" href="struct_o_c_i___object.html#9fddeb4cff3c8e79ca972f4b2d83e2f6">nty</a>-&gt;<a class="code" href="struct_o_c_i___schema.html#cf25d0fa0236499ea3845ab77338a5e9">cols</a>[index].<a class="code" href="struct_o_c_i___column.html#e1fb2448942e7ee1c3fa23662612f1e6">subtype</a>);<a name="l00600"></a>00600 <a name="l00601"></a>00601             res = (itv != NULL);<a name="l00602"></a>00602         }<a name="l00603"></a>00603     }<a name="l00604"></a>00604 <a name="l00605"></a>00605     OCI_RESULT(res);<a name="l00606"></a>00606 <a name="l00607"></a>00607     <span class="keywordflow">return</span> itv;<a name="l00608"></a>00608 }<a name="l00609"></a>00609 <a name="l00610"></a>00610 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00611"></a>00611 <span class="comment"> * OCI_ObjectGetColl</span><a name="l00612"></a>00612 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00613"></a>00613 <a name="l00614"></a><a class="code" href="group__g__usertypes.html#ge1a5c025c74cf611e9ed4b1330b72db9">00614</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__usertypes.html#ge1a5c025c74cf611e9ed4b1330b72db9" title="Return the collection value of the given object attribute.">OCI_ObjectGetColl</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="l00615"></a>00615 {<a name="l00616"></a>00616     <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="l00617"></a>00617     <span class="keywordtype">boolean</span> res    = FALSE;<a name="l00618"></a>00618     <span class="keywordtype">int</span> index      = OCI_ObjectGetIndex(obj, attr, OCI_CDT_COLLECTION);<a name="l00619"></a>00619 <a name="l00620"></a>00620     <span class="keywordflow">if</span> (index &gt;= 0)<a name="l00621"></a>00621     {<a name="l00622"></a>00622         OCIInd ind      = 0;<a name="l00623"></a>00623         OCIType *tdo    = NULL;<a name="l00624"></a>00624         OCIColl **value = NULL;<a name="l00625"></a>00625         <a name="l00626"></a>00626         res = OCI_ObjectGetAttr(obj, attr, (<span class="keywordtype">void</span> **) &amp;value, &amp;ind, &amp;tdo);<a name="l00627"></a>00627 <a name="l00628"></a>00628         <span class="keywordflow">if</span> ((res == TRUE) &amp;&amp; (value != NULL))<a name="l00629"></a>00629         {<a name="l00630"></a>00630             coll = OCI_CollInit(obj-&gt;<a class="code" href="struct_o_c_i___object.html#8bde19100472fa2836e320e8e0878954">con</a>, <a name="l00631"></a>00631                                 (<a class="code" href="struct_o_c_i___coll.html" title="Oracle Collections (VARRAYs and Nested Tables) representation.">OCI_Coll</a> **) &amp;obj-&gt;<a class="code" href="struct_o_c_i___object.html#c200f98bde82ce8df32af3f17a453b20">objs</a>[index], <a name="l00632"></a>00632                                 (OCIColl *) value, <a name="l00633"></a>00633                                 obj-&gt;<a class="code" href="struct_o_c_i___object.html#9fddeb4cff3c8e79ca972f4b2d83e2f6">nty</a>-&gt;<a class="code" href="struct_o_c_i___schema.html#cf25d0fa0236499ea3845ab77338a5e9">cols</a>[index].<a class="code" href="struct_o_c_i___column.html#a01d51754a48d80bf033b589b6127781">nty</a>);<a name="l00634"></a>00634 <a name="l00635"></a>00635             res = (coll != NULL);<a name="l00636"></a>00636         }<a name="l00637"></a>00637     }<a name="l00638"></a>00638 <a name="l00639"></a>00639     OCI_RESULT(res);<a name="l00640"></a>00640 <a name="l00641"></a>00641     <span class="keywordflow">return</span> coll;<a name="l00642"></a>00642 }<a name="l00643"></a>00643 <a name="l00644"></a>00644 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00645"></a>00645 <span class="comment"> * OCI_ObjectGetObject</span><a name="l00646"></a>00646 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00647"></a>00647 <a name="l00648"></a><a class="code" href="group__g__usertypes.html#g89378768a57c72154e464a99a20ac5ae">00648</a> <a class="code" href="struct_o_c_i___object.html" title="Oracle Named types representation.">OCI_Object</a> * OCI_API <a class="code" href="group__g__usertypes.html#g89378768a57c72154e464a99a20ac5ae" title="Return the object value of the given object attribute.">OCI_ObjectGetObject</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="l00649"></a>00649 {<a name="l00650"></a>00650     <a class="code" href="struct_o_c_i___object.html" title="Oracle Named types representation.">OCI_Object</a> *obj2 = NULL;<a name="l00651"></a>00651     <span class="keywordtype">boolean</span> res      = FALSE;<a name="l00652"></a>00652     <span class="keywordtype">int</span> index        = OCI_ObjectGetIndex(obj, attr, OCI_CDT_OBJECT);<a name="l00653"></a>00653 <a name="l00654"></a>00654     <span class="keywordflow">if</span> (index &gt;= 0)<a name="l00655"></a>00655     {     <a name="l00656"></a>00656         OCIInd ind    = 0;<a name="l00657"></a>00657         OCIType *tdo  = NULL;<a name="l00658"></a>00658         <span class="keywordtype">void</span> *value   = NULL;<a name="l00659"></a>00659 <a name="l00660"></a>00660         res = OCI_ObjectGetAttr(obj, attr, (<span class="keywordtype">void</span> **) &amp;value, &amp;ind, &amp;tdo);<a name="l00661"></a>00661 <a name="l00662"></a>00662         <span class="keywordflow">if</span> ((res == TRUE) &amp;&amp; (value != NULL))<a name="l00663"></a>00663         {<a name="l00664"></a>00664             obj2 = OCI_ObjectInit(obj-&gt;<a class="code" href="struct_o_c_i___object.html#8bde19100472fa2836e320e8e0878954">con</a>, (<a class="code" href="struct_o_c_i___object.html" title="Oracle Named types representation.">OCI_Object</a> **) &amp;obj-&gt;<a class="code" href="struct_o_

⌨️ 快捷键说明

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