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

📄 timestamp_8c-source.html

📁 ORACLE编程的好东西,纯C写的OCI封装.很好用,支持数据池.
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<a name="l00132"></a>00132 <span class="preprocessor">#if OCI_VERSION_COMPILE &gt;= OCI_9</span><a name="l00133"></a>00133 <span class="preprocessor"></span><a name="l00134"></a>00134     tmsp = OCI_TimestampInit(con, &amp;tmsp, NULL, type);<a name="l00135"></a>00135 <a name="l00136"></a>00136 <span class="preprocessor">#else</span><a name="l00137"></a>00137 <span class="preprocessor"></span><a name="l00138"></a>00138     OCI_NOT_USED(type);<a name="l00139"></a>00139 <a name="l00140"></a>00140 <span class="preprocessor">#endif</span><a name="l00141"></a>00141 <span class="preprocessor"></span><a name="l00142"></a>00142     OCI_RESULT(tmsp != NULL);<a name="l00143"></a>00143 <a name="l00144"></a>00144     <span class="keywordflow">return</span> tmsp;<a name="l00145"></a>00145 }<a name="l00146"></a>00146 <a name="l00147"></a>00147 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00148"></a>00148 <span class="comment"> * OCI_TimestampFree</span><a name="l00149"></a>00149 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00150"></a>00150 <a name="l00151"></a><a class="code" href="group__g__timestamp.html#g60e9851db1175d6b650f9df00db274da">00151</a> <span class="keywordtype">boolean</span> OCI_API <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> *tmsp)<a name="l00152"></a>00152 {<a name="l00153"></a>00153     OCI_CHECK_PTR(OCI_IPC_TIMESTAMP, tmsp, FALSE);<a name="l00154"></a>00154     <a name="l00155"></a>00155     OCI_CHECK_TIMESTAMP_ENABLED(tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#8d58d5aabe4cf9100bfdfc8428fbc234">con</a>, FALSE);<a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="preprocessor">#if OCI_VERSION_COMPILE &gt;= OCI_9</span><a name="l00158"></a>00158 <span class="preprocessor"></span><a name="l00159"></a>00159     OCI_CHECK_OBJECT_FETCHED(tmsp, FALSE);<a name="l00160"></a>00160 <a name="l00161"></a>00161     <span class="keywordflow">if</span> (tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#8ff4e6c21d3682581e93c36e9abc9b39">hstate</a> == OCI_OBJECT_ALLOCATED)<a name="l00162"></a>00162     {<a name="l00163"></a>00163         ub4 htype  = 0;<a name="l00164"></a>00164 <a name="l00165"></a>00165         <span class="keywordflow">if</span> (tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#c650d324d802e3484654ec52df509ff5">type</a> == OCI_TIMESTAMP)<a name="l00166"></a>00166             htype = OCI_DTYPE_TIMESTAMP;<a name="l00167"></a>00167         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#c650d324d802e3484654ec52df509ff5">type</a> == OCI_TIMESTAMP_TZ)<a name="l00168"></a>00168             htype = OCI_DTYPE_TIMESTAMP_TZ;<a name="l00169"></a>00169         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#c650d324d802e3484654ec52df509ff5">type</a> == OCI_TIMESTAMP_LTZ)<a name="l00170"></a>00170             htype = OCI_DTYPE_TIMESTAMP_LTZ;<a name="l00171"></a>00171 <a name="l00172"></a>00172        OCI_DescriptorFree((dvoid *) tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#fc374755147e6be3141d875fdad3cf8a">handle</a>, htype);<a name="l00173"></a>00173     }<a name="l00174"></a>00174 <a name="l00175"></a>00175     OCI_FREE(tmsp);<a name="l00176"></a>00176    <a name="l00177"></a>00177 <span class="preprocessor">#endif</span><a name="l00178"></a>00178 <span class="preprocessor"></span>   <a name="l00179"></a>00179    OCI_RESULT(TRUE);<a name="l00180"></a>00180 <a name="l00181"></a>00181    <span class="keywordflow">return</span> TRUE;<a name="l00182"></a>00182 }<a name="l00183"></a>00183 <a name="l00184"></a>00184 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00185"></a>00185 <span class="comment"> * OCI_TimestampGetType</span><a name="l00186"></a>00186 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00187"></a>00187 <a name="l00188"></a><a class="code" href="group__g__timestamp.html#ga6a59f18f308bd55841654bd66c6cee6">00188</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> OCI_API <a class="code" href="group__g__timestamp.html#ga6a59f18f308bd55841654bd66c6cee6" title="Return the type of the given Timestamp object.">OCI_TimestampGetType</a>(<a class="code" href="struct_o_c_i___timestamp.html" title="Oracle internal timespamp representation.">OCI_Timestamp</a> *tmsp)<a name="l00189"></a>00189 {<a name="l00190"></a>00190     OCI_CHECK_PTR(OCI_IPC_TIMESTAMP, tmsp, OCI_UNKNOWN);<a name="l00191"></a>00191 <a name="l00192"></a>00192     OCI_CHECK_TIMESTAMP_ENABLED(tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#8d58d5aabe4cf9100bfdfc8428fbc234">con</a>, OCI_UNKNOWN);<a name="l00193"></a>00193 <a name="l00194"></a>00194     OCI_RESULT(TRUE);<a name="l00195"></a>00195 <a name="l00196"></a>00196     <span class="keywordflow">return</span> tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#c650d324d802e3484654ec52df509ff5">type</a>;<a name="l00197"></a>00197 }<a name="l00198"></a>00198 <a name="l00199"></a>00199 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00200"></a>00200 <span class="comment"> * OCI_DateZoneToZone</span><a name="l00201"></a>00201 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00202"></a>00202 <a name="l00203"></a><a class="code" href="group__g__timestamp.html#g6b8356c2fcaa984d2d63edd5cc7a357b">00203</a> <span class="keywordtype">boolean</span> OCI_API <a class="code" href="group__g__timestamp.html#g6b8356c2fcaa984d2d63edd5cc7a357b" title="Assign the value of a timestamp handle to another one.">OCI_TimestampAssign</a>(<a class="code" href="struct_o_c_i___timestamp.html" title="Oracle internal timespamp representation.">OCI_Timestamp</a> *tmsp, <a class="code" href="struct_o_c_i___timestamp.html" title="Oracle internal timespamp representation.">OCI_Timestamp</a> *tmsp_src)<a name="l00204"></a>00204 {<a name="l00205"></a>00205     <span class="keywordtype">boolean</span> res = TRUE;<a name="l00206"></a>00206 <a name="l00207"></a>00207     OCI_CHECK_PTR(OCI_IPC_TIMESTAMP, tmsp,     FALSE);<a name="l00208"></a>00208     OCI_CHECK_PTR(OCI_IPC_TIMESTAMP, tmsp_src, FALSE);<a name="l00209"></a>00209 <a name="l00210"></a>00210     OCI_CHECK_TIMESTAMP_ENABLED(tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#8d58d5aabe4cf9100bfdfc8428fbc234">con</a>, FALSE);<a name="l00211"></a>00211 <a name="l00212"></a>00212 <span class="preprocessor">#if OCI_VERSION_COMPILE &gt;= OCI_9</span><a name="l00213"></a>00213 <span class="preprocessor"></span><a name="l00214"></a>00214     OCI_CALL4<a name="l00215"></a>00215     (<a name="l00216"></a>00216         res, tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#a63a28fecaeb556596429ac636329b22">err</a>, tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#8d58d5aabe4cf9100bfdfc8428fbc234">con</a>,<a name="l00217"></a>00217         <a name="l00218"></a>00218         OCIDateTimeAssign((dvoid *) OCILib.env, tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#a63a28fecaeb556596429ac636329b22">err</a>,<a name="l00219"></a>00219                           tmsp_src-&gt;<a class="code" href="struct_o_c_i___timestamp.html#fc374755147e6be3141d875fdad3cf8a">handle</a>, tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#fc374755147e6be3141d875fdad3cf8a">handle</a>)<a name="l00220"></a>00220     )<a name="l00221"></a>00221 <a name="l00222"></a>00222 <span class="preprocessor">#endif</span><a name="l00223"></a>00223 <span class="preprocessor"></span><a name="l00224"></a>00224    OCI_RESULT(res);<a name="l00225"></a>00225 <a name="l00226"></a>00226    <span class="keywordflow">return</span> res;<a name="l00227"></a>00227 }<a name="l00228"></a>00228 <a name="l00229"></a>00229 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00230"></a>00230 <span class="comment"> * OCI_TimestampCheck</span><a name="l00231"></a>00231 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00232"></a>00232 <a name="l00233"></a><a class="code" href="group__g__timestamp.html#gb23aaba98e752b92725045205bd55a03">00233</a> <span class="keywordtype">int</span> OCI_API <a class="code" href="group__g__timestamp.html#gb23aaba98e752b92725045205bd55a03" title="Check if the given timestamp is valid.">OCI_TimestampCheck</a>(<a class="code" href="struct_o_c_i___timestamp.html" title="Oracle internal timespamp representation.">OCI_Timestamp</a> *tmsp)<a name="l00234"></a>00234 {<a name="l00235"></a>00235     <span class="keywordtype">boolean</span> res = TRUE;<a name="l00236"></a>00236     ub4 value   = 0;<a name="l00237"></a>00237 <a name="l00238"></a>00238     OCI_CHECK_PTR(OCI_IPC_TIMESTAMP, tmsp, value);<a name="l00239"></a>00239 <a name="l00240"></a>00240     OCI_CHECK_TIMESTAMP_ENABLED(tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#8d58d5aabe4cf9100bfdfc8428fbc234">con</a>, value);<a name="l00241"></a>00241 <a name="l00242"></a>00242 <span class="preprocessor">#if OCI_VERSION_COMPILE &gt;= OCI_9</span><a name="l00243"></a>00243 <span class="preprocessor"></span><a name="l00244"></a>00244     OCI_CALL4<a name="l00245"></a>00245     (<a name="l00246"></a>00246         res, tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#a63a28fecaeb556596429ac636329b22">err</a>, tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#8d58d5aabe4cf9100bfdfc8428fbc234">con</a>,<a name="l00247"></a>00247         <a name="l00248"></a>00248         OCIDateTimeCheck((dvoid *) OCILib.env, tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#a63a28fecaeb556596429ac636329b22">err</a>, tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#fc374755147e6be3141d875fdad3cf8a">handle</a>, &amp;value)<a name="l00249"></a>00249     )<a name="l00250"></a>00250 <a name="l00251"></a>00251 <span class="preprocessor">#endif</span><a name="l00252"></a>00252 <span class="preprocessor"></span> <a name="l00253"></a>00253     OCI_RESULT(res);<a name="l00254"></a>00254 <a name="l00255"></a>00255     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>) value;<a name="l00256"></a>00256 }<a name="l00257"></a>00257 <a name="l00258"></a>00258 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00259"></a>00259 <span class="comment"> * OCI_TimestampCompare</span><a name="l00260"></a>00260 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00261"></a>00261 <a name="l00262"></a><a class="code" href="group__g__timestamp.html#g8063cc410dc2ed2a80aa9a434e759b0b">00262</a> <span class="keywordtype">int</span> OCI_API <a class="code" href="group__g__timestamp.html#g8063cc410dc2ed2a80aa9a434e759b0b" title="Compares two tTimestamp handles.">OCI_TimestampCompare</a>(<a class="code" href="struct_o_c_i___timestamp.html" title="Oracle internal timespamp representation.">OCI_Timestamp</a> *tmsp, <a class="code" href="struct_o_c_i___timestamp.html" title="Oracle internal timespamp representation.">OCI_Timestamp</a> *tmsp2)<a name="l00263"></a>00263 {<a name="l00264"></a>00264     <span class="keywordtype">boolean</span> res = TRUE;<a name="l00265"></a>00265     sword value = OCI_ERROR;<a name="l00266"></a>00266 <a name="l00267"></a>00267     OCI_CHECK_PTR(OCI_IPC_TIMESTAMP, tmsp,  value);<a name="l00268"></a>00268     OCI_CHECK_PTR(OCI_IPC_TIMESTAMP, tmsp2, value);<a name="l00269"></a>00269 <a name="l00270"></a>00270     OCI_CHECK_TIMESTAMP_ENABLED(tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#8d58d5aabe4cf9100bfdfc8428fbc234">con</a>, FALSE);<a name="l00271"></a>00271 <a name="l00272"></a>00272 <span class="preprocessor">#if OCI_VERSION_COMPILE &gt;= OCI_9</span><a name="l00273"></a>00273 <span class="preprocessor"></span><a name="l00274"></a>00274     OCI_CALL4<a name="l00275"></a>00275     (<a name="l00276"></a>00276         res, tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#a63a28fecaeb556596429ac636329b22">err</a>, tmsp-&gt;<a class="code" href="struct_o_c_i___timestamp.html#8d58d5aabe4cf9100bfdfc8428fbc234">con</a>,<a name="l00277"></a>00277         

⌨️ 快捷键说明

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