📄 hash_8c-source.html
字号:
<a name="l00147"></a>00147 <a name="l00148"></a>00148 <span class="keywordflow">if</span> (table-><a class="code" href="struct_o_c_i___hash_table.html#9dfd0e1c5cf8bfdfe4c8f0c6ed525ee8">items</a> != NULL)<a name="l00149"></a>00149 {<a name="l00150"></a>00150 OCI_FREE(table-><a class="code" href="struct_o_c_i___hash_table.html#9dfd0e1c5cf8bfdfe4c8f0c6ed525ee8">items</a>);<a name="l00151"></a>00151 }<a name="l00152"></a>00152 <a name="l00153"></a>00153 OCI_FREE(table);<a name="l00154"></a>00154 <a name="l00155"></a>00155 OCI_RESULT(TRUE);<a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="keywordflow">return</span> TRUE;<a name="l00158"></a>00158 }<a name="l00159"></a>00159 <a name="l00160"></a>00160 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00161"></a>00161 <span class="comment"> * OCI_HashGetSize</span><a name="l00162"></a>00162 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00163"></a>00163 <a name="l00164"></a><a class="code" href="group__g__hash.html#g0c09d091560a0ef02c96558a254b32db">00164</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> OCI_API <a class="code" href="group__g__hash.html#g0c09d091560a0ef02c96558a254b32db" title="Return the size of the hash table.">OCI_HashGetSize</a>(<a class="code" href="struct_o_c_i___hash_table.html" title="OCILIB implementation of hash tables.">OCI_HashTable</a> *table)<a name="l00165"></a>00165 {<a name="l00166"></a>00166 OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table, 0);<a name="l00167"></a>00167 <a name="l00168"></a>00168 OCI_RESULT(TRUE);<a name="l00169"></a>00169 <a name="l00170"></a>00170 <span class="keywordflow">return</span> table-><a class="code" href="struct_o_c_i___hash_table.html#97279c92f378e6d7055b84cef40f37f8">size</a>;<a name="l00171"></a>00171 }<a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00174"></a>00174 <span class="comment"> * OCI_HashGetType</span><a name="l00175"></a>00175 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00176"></a>00176 <a name="l00177"></a><a class="code" href="group__g__hash.html#g3fee7204caa79b6a907888afad3e54ec">00177</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> OCI_API <a class="code" href="group__g__hash.html#g3fee7204caa79b6a907888afad3e54ec" title="Return the type of the hash table.">OCI_HashGetType</a>(<a class="code" href="struct_o_c_i___hash_table.html" title="OCILIB implementation of hash tables.">OCI_HashTable</a> *table)<a name="l00178"></a>00178 {<a name="l00179"></a>00179 OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table, OCI_UNKNOWN);<a name="l00180"></a>00180 <a name="l00181"></a>00181 OCI_RESULT(TRUE);<a name="l00182"></a>00182 <a name="l00183"></a>00183 <span class="keywordflow">return</span> table-><a class="code" href="struct_o_c_i___hash_table.html#a6525f1ae5c855c254e80a406b0448b4">type</a>;<a name="l00184"></a>00184 }<a name="l00185"></a>00185 <a name="l00186"></a>00186 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00187"></a>00187 <span class="comment"> * OCI_HashGetValue</span><a name="l00188"></a>00188 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00189"></a>00189 <a name="l00190"></a><a class="code" href="group__g__hash.html#g459349a19b3780933d87a9a1257d4f7b">00190</a> <a class="code" href="struct_o_c_i___hash_value.html" title="Hash table entry value.">OCI_HashValue</a> * OCI_API <a class="code" href="group__g__hash.html#g459349a19b3780933d87a9a1257d4f7b" title="Return the first hash slot that matches the key.">OCI_HashGetValue</a>(<a class="code" href="struct_o_c_i___hash_table.html" title="OCILIB implementation of hash tables.">OCI_HashTable</a> *table, <span class="keyword">const</span> mtext *key)<a name="l00191"></a>00191 {<a name="l00192"></a>00192 <a class="code" href="struct_o_c_i___hash_entry.html" title="Hash table entry.">OCI_HashEntry</a> *e = NULL;<a name="l00193"></a>00193 <a class="code" href="struct_o_c_i___hash_value.html" title="Hash table entry value.">OCI_HashValue</a> *v = NULL;<a name="l00194"></a>00194 <a name="l00195"></a>00195 OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table, NULL);<a name="l00196"></a>00196 <a name="l00197"></a>00197 e = <a class="code" href="group__g__hash.html#g28b2bb02f22478e93a7f65e399f5b704" title="Lookup for an entry matching the key in the table.">OCI_HashLookup</a>(table, key, FALSE);<a name="l00198"></a>00198 <a name="l00199"></a>00199 <span class="keywordflow">if</span> (e != NULL)<a name="l00200"></a>00200 v = e-><a class="code" href="struct_o_c_i___hash_entry.html#8a6e3f404f4b84f31f8b026ba9c651a5">values</a>;<a name="l00201"></a>00201 <a name="l00202"></a>00202 OCI_RESULT(v != NULL);<a name="l00203"></a>00203 <a name="l00204"></a>00204 <span class="keywordflow">return</span> v;<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_HashGetEntry</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__hash.html#gac21d1abb64dd64e797b1fe8e8638675">00211</a> <a class="code" href="struct_o_c_i___hash_entry.html" title="Hash table entry.">OCI_HashEntry</a> * OCI_API <a class="code" href="group__g__hash.html#gac21d1abb64dd64e797b1fe8e8638675" title="Return the entry slot of the hash table internal list at the given position.">OCI_HashGetEntry</a>(<a class="code" href="struct_o_c_i___hash_table.html" title="OCILIB implementation of hash tables.">OCI_HashTable</a> *table, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index)<a name="l00212"></a>00212 {<a name="l00213"></a>00213 OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table, NULL);<a name="l00214"></a>00214 OCI_CHECK_BOUND(NULL, index, 1, table-><a class="code" href="struct_o_c_i___hash_table.html#97279c92f378e6d7055b84cef40f37f8">size</a>, NULL);<a name="l00215"></a>00215 <a name="l00216"></a>00216 OCI_RESULT(TRUE);<a name="l00217"></a>00217 <a name="l00218"></a>00218 <span class="keywordflow">return</span> table-><a class="code" href="struct_o_c_i___hash_table.html#9dfd0e1c5cf8bfdfe4c8f0c6ed525ee8">items</a>[index];<a name="l00219"></a>00219 }<a name="l00220"></a>00220 <a name="l00221"></a>00221 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00222"></a>00222 <span class="comment"> * OCI_HashGetString</span><a name="l00223"></a>00223 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00224"></a>00224 <a name="l00225"></a><a class="code" href="group__g__hash.html#gbf7b27da6793f98c0f635fd3b40957e5">00225</a> <span class="keyword">const</span> mtext * OCI_API <a class="code" href="group__g__hash.html#gbf7b27da6793f98c0f635fd3b40957e5" title="Return the string value associated to the given key.">OCI_HashGetString</a>(<a class="code" href="struct_o_c_i___hash_table.html" title="OCILIB implementation of hash tables.">OCI_HashTable</a> *table, <span class="keyword">const</span> mtext *key)<a name="l00226"></a>00226 {<a name="l00227"></a>00227 <a class="code" href="struct_o_c_i___hash_value.html" title="Hash table entry value.">OCI_HashValue</a> *v = NULL;<a name="l00228"></a>00228 <span class="keyword">const</span> mtext *value = NULL;<a name="l00229"></a>00229 <a name="l00230"></a>00230 OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table, NULL);<a name="l00231"></a>00231 OCI_CHECK(table-><a class="code" href="struct_o_c_i___hash_table.html#a6525f1ae5c855c254e80a406b0448b4">type</a> != OCI_HASH_STRING, NULL);<a name="l00232"></a>00232 <a name="l00233"></a>00233 v = <a class="code" href="group__g__hash.html#g459349a19b3780933d87a9a1257d4f7b" title="Return the first hash slot that matches the key.">OCI_HashGetValue</a>(table, key);<a name="l00234"></a>00234 <a name="l00235"></a>00235 <span class="keywordflow">if</span> (v != NULL)<a name="l00236"></a>00236 {<a name="l00237"></a>00237 value = v-><a class="code" href="struct_o_c_i___hash_value.html#b702bde98ae6323bcfd9996245c5b000">value</a>.<a class="code" href="union_o_c_i___variant.html#3fcdb2b40ab4ece809f7676c148252a6">p_mtext</a>;<a name="l00238"></a>00238 }<a name="l00239"></a>00239 <a name="l00240"></a>00240 OCI_RESULT(v != NULL);<a name="l00241"></a>00241 <a name="l00242"></a>00242 <span class="keywordflow">return</span> value;<a name="l00243"></a>00243 }<a name="l00244"></a>00244 <a name="l00245"></a>00245 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00246"></a>00246 <span class="comment"> * OCI_HashGetInt</span><a name="l00247"></a>00247 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00248"></a>00248 <a name="l00249"></a><a class="code" href="group__g__hash.html#g66c44e17f92225a26b274df4c5794fc2">00249</a> <span class="keywordtype">int</span> OCI_API <a class="code" href="group__g__hash.html#g66c44e17f92225a26b274df4c5794fc2" title="Return the integer value associated to the given key.">OCI_HashGetInt</a>(<a class="code" href="struct_o_c_i___hash_table.html" title="OCILIB implementation of hash tables.">OCI_HashTable</a> *table, <span class="keyword">const</span> mtext *key)<a name="l00250"></a>00250 {<a name="l00251"></a>00251 <a class="code" href="struct_o_c_i___hash_value.html" title="Hash table entry value.">OCI_HashValue</a> *v = NULL;<a name="l00252"></a>00252 <span class="keywordtype">int</span> value = 0;<a name="l00253"></a>00253 <a name="l00254"></a>00254 OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table, 0);<a name="l00255"></a>00255 OCI_CHECK(table-><a class="code" href="struct_o_c_i___hash_table.html#a6525f1ae5c855c254e80a406b0448b4">type</a> != OCI_HASH_INTEGER, 0);<a name="l00256"></a>00256 <a name="l00257"></a>00257 v = <a class="code" href="group__g__hash.html#g459349a19b3780933d87a9a1257d4f7b" title="Return the first hash slot that matches the key.">OCI_HashGetValue</a>(table, key);<a name="l00258"></a>00258 <a name="l00259"></a>00259 <span class="keywordflow">if</span> (v != NULL)<a name="l00260"></a>00260 {<a name="l00261"></a>00261 value = v-><a class="code" href="struct_o_c_i___hash_value.html#b702bde98ae6323bcfd9996245c5b000">value</a>.<a class="code" href="union_o_c_i___variant.html#6494e451f95e0ececa95fc3ef872c089">num</a>;<a name="l00262"></a>00262 }<a name="l00263"></a>00263 <a name="l00264"></a>00264 OCI_RESULT(v != NULL);<a name="l00265"></a>00265 <a name="l00266"></a>00266 <span class="keywordflow">return</span> value;<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_HashGetPointer</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__hash.html#g4b5fe71fbbb41265efa5645e4dd5838a">00273</a> <span class="keywordtype">void</span> * OCI_API <a class="code" href="group__g__hash.html#g4b5fe71fbbb41265efa5645e4dd5838a" title="Return a pointer associated with the given key.">OCI_HashGetPointer</a>(<a class="code" href="struct_o_c_i___hash_table.html" title="OCILIB implementation of hash tables.">OCI_HashTable</a> *table, <span class="keyword">const</span> mtext *key)<a name="l00274"></a>00274 {<a name="l00275"></a>00275 <a class="code" href="struct_o_c_i___hash_value.html" title="Hash table entry value.">OCI_HashValue</a> *v = NULL;<a name="l00276"></a>00276 <span class="keywordtype">void</span> *value = NULL;<a name="l00277"></a>00277 <a name="l00278"></a>00278 OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table, NULL);<a name="l00279"></a>00279 OCI_CHECK(table-><a class="code" href="struct_o_c_i___hash_table.html#a6525f1ae5c855c254e80a406b0448b4">type</a> != OCI_HASH_POINTER, NULL);<a name="l00280"></a>00280 <a name="l00281"></a>00281 v = <a class="code" href="group__g__hash.html#g459349a19b3780933d87a9a1257d4f7b" title="Return the first hash slot that matches the key.">OCI_HashGetValue</a>(table, key);<a name="l00282"></a>00282 <a name="l00283"></a>00283 <span class="keywordflow">if</span> (v != NULL)<a name="l00284"></a>00284 {<a name="l00285"></a>00285 value = v-><a class="code" href="struct_o_c_i___hash_value.html#b702bde98ae6323bcfd9996245c5b000">value</a>.<a class="code" href="union_o_c_i___variant.html#180948b8747aef48eb41410df5686070">p_void</a>;<a name="l00286"></a>00286 }<a name="l00287"></a>00287 <a name="l00288"></a>00288 OCI_RESULT(v != NULL);<a name="l00289"></a>00289 <a name="l00290"></a>00290 <span class="keywordflow">return</span> value;<a name="l00291"></a>00291 }<a name="l00292"></a>00292 <a name="l00293"></a>00293 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00294"></a>00294 <span class="comment"> * OCI_HashAdd</span><a name="l00295"></a>00295 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00296"></a>00296 <a name="l00297"></a>00297 <span class="keywordtype">boolean</span> OCI_HashAdd(<a class="code" href="struct_o_c_i___hash_table.html" title="OCILIB implementation of hash tables.">OCI_HashTable</a> *table, <span class="keyword">const</span> mtext *key, <a class="code" href="union_o_c_i___variant.html" title="Internal Variant type based on union C type.">OCI_Variant</a> value, <a name="l00298"></a>00298 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> type)<a name="l00299"></a>00299 {<a name="l00300"></a>00300 <a class="code" href="struct_o_c_i___hash_entry.html" title="Hash table entry.">OCI_HashEntry</a> * e = NULL;<a name="l00301"></a>00301 <a class="code" href="struct_o_c_i___hash_value.html" title="Hash table entry value.">OCI_HashValue</a> * v = NULL, *v1 = NULL, *v2 = NULL;<a name="l00302"></a>00302 <a name="l00303"></a>00303 OCI_CHECK(table == NULL, FALSE);<a name="l00304"></a>00304 OCI_CHECK(key == NULL, FALSE);<a name="l00305"></a>00305 OCI_CHECK(table-><a class="code" href="struct_o_c_i___hash_table.html#a6525f1ae5c855c254e80a406b0448b4">type</a> != type, FALSE);<a name="l00306"></a>00306 <a name="l00307"></a>00307 e = <a class="code" href="group__g__hash.html#g28b2bb02f22478e93a7f65e399f5b704" title="Lookup for an entry matching the key in the table.">OCI_HashLookup</a>(table, key, TRUE);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -