Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > d9faa203c2b0b6fbb179d93daaea81b7 > files > 592

libdtn-devel-2.6.0-1mdv2009.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>DTN Reference Implementation: SQLStore.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
<h1>SQLStore.h</h1><a href="SQLStore_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> *    Copyright 2004-2006 Intel Corporation</span>
<a name="l00003"></a>00003 <span class="comment"> * </span>
<a name="l00004"></a>00004 <span class="comment"> *    Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="l00005"></a>00005 <span class="comment"> *    you may not use this file except in compliance with the License.</span>
<a name="l00006"></a>00006 <span class="comment"> *    You may obtain a copy of the License at</span>
<a name="l00007"></a>00007 <span class="comment"> * </span>
<a name="l00008"></a>00008 <span class="comment"> *        http://www.apache.org/licenses/LICENSE-2.0</span>
<a name="l00009"></a>00009 <span class="comment"> * </span>
<a name="l00010"></a>00010 <span class="comment"> *    Unless required by applicable law or agreed to in writing, software</span>
<a name="l00011"></a>00011 <span class="comment"> *    distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="l00012"></a>00012 <span class="comment"> *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="l00013"></a>00013 <span class="comment"> *    See the License for the specific language governing permissions and</span>
<a name="l00014"></a>00014 <span class="comment"> *    limitations under the License.</span>
<a name="l00015"></a>00015 <span class="comment"> */</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef _SQL_STORE_H_</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _SQL_STORE_H_</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;sys/time.h&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;oasys/debug/Log.h&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;oasys/serialize/SQLSerialize.h&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="BundleStore_8h.html">BundleStore.h</a>"</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="PersistentStore_8h.html">PersistentStore.h</a>"</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="keyword">namespace </span>dtn {
<a name="l00028"></a>00028 
<a name="l00033"></a><a class="code" href="classdtn_1_1SQLStore.html">00033</a> <span class="keyword">class </span><a class="code" href="classdtn_1_1SQLStore.html" title="Implementation of a StorageManager with an underlying SQL database.">SQLStore</a> : <span class="keyword">public</span> <a class="code" href="classdtn_1_1PersistentStore.html" title="The abstract base class implementing a persistent storage system.">PersistentStore</a>, <span class="keyword">public</span> oasys::<a class="code" href="classoasys_1_1Logger.html">Logger</a>  {
<a name="l00034"></a>00034 <span class="keyword">public</span>:
<a name="l00035"></a>00035     
<a name="l00041"></a>00041     <a class="code" href="classdtn_1_1SQLStore.html#b030b66affcf610886797093d65242b0" title="Create a SQLStore with specfied table_name.">SQLStore</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classdtn_1_1SQLStore.html#6d8cec258be1296e5dc3a0d23180cecc" title="Returns the table name associated with this store.">table_name</a>, oasys::SQLImplementation *db);
<a name="l00042"></a>00042     
<a name="l00044"></a>00044 
<a name="l00048"></a>00048     <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1SQLStore.html#e658972b34f6e008a90b58b1d97761da" title="Close the table.">close</a>();
<a name="l00049"></a>00049     
<a name="l00054"></a>00054     <span class="keywordtype">int</span> <span class="keyword">get</span>(oasys::SerializableObject* obj, <span class="keyword">const</span> <span class="keywordtype">int</span> key);
<a name="l00055"></a>00055  
<a name="l00059"></a>00059     <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1SQLStore.html#88ab4d56c234a37399ce8a0be748e095" title="Store the object with the given key.">put</a>(oasys::SerializableObject* obj, <span class="keyword">const</span> <span class="keywordtype">int</span> key);
<a name="l00060"></a>00060 
<a name="l00065"></a>00065     <span class="keywordtype">int</span> <span class="keyword">add</span>(oasys::SerializableObject* obj, <span class="keyword">const</span> <span class="keywordtype">int</span> key);
<a name="l00066"></a>00066     
<a name="l00071"></a>00071     <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1SQLStore.html#bbaa6642234705adf3fe5a2e0d157bb2" title="Update the object&amp;#39;s state in the sql store.">update</a>(oasys::SerializableObject* obj, <span class="keyword">const</span> <span class="keywordtype">int</span> key);
<a name="l00072"></a>00072     
<a name="l00077"></a>00077     <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1SQLStore.html#ef53bb4baf876f7d747ad7d0ae3b7889" title="Delete an obj (identified by key).">del</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> key);
<a name="l00078"></a>00078 
<a name="l00083"></a>00083     <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1SQLStore.html#57f01f62cff0806c2b9a895f8ce6d430" title="Return number of elements in the store.">num_elements</a>();
<a name="l00084"></a>00084 
<a name="l00089"></a>00089     <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1SQLStore.html#6e58acdb3c6d58d1e8578d6346a0fe74" title="Return list of keys for all elements in the store.">keys</a>(std::vector&lt;int&gt; * l);
<a name="l00090"></a>00090 
<a name="l00094"></a>00094     <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1SQLStore.html#f2c2581a726c6ff3d7a24effac94013c" title="Name of the table in the database to which this SQLStore corresponds.">exists</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> <span class="keywordtype">id</span>);
<a name="l00095"></a>00095     
<a name="l00104"></a>00104     <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1SQLStore.html#a139f635213aaf30dfe70661592cc9ab" title="Extract all elements from the store, potentially matching the &amp;quot;where&amp;quot; clause...">elements</a>(oasys::SerializableObjectVector* <a class="code" href="classdtn_1_1SQLStore.html#a139f635213aaf30dfe70661592cc9ab" title="Extract all elements from the store, potentially matching the &amp;quot;where&amp;quot; clause...">elements</a>);
<a name="l00105"></a>00105 
<a name="l00109"></a>00109     <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classdtn_1_1SQLStore.html#6d8cec258be1296e5dc3a0d23180cecc" title="Returns the table name associated with this store.">table_name</a>();
<a name="l00110"></a>00110 
<a name="l00115"></a>00115     <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1SQLStore.html#c776c04ade8e2aabd2525bbd62fd1530" title="Checks if the table already exists.">has_table</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name);
<a name="l00116"></a>00116 
<a name="l00122"></a>00122     <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1SQLStore.html#f62b2fe2426008579d36c59c021396a4" title="Creates table a table in the store for objects which has the same type as obj.">create_table</a>(oasys::SerializableObject* obj);
<a name="l00123"></a>00123 
<a name="l00124"></a>00124 
<a name="l00129"></a>00129     <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1SQLStore.html#bb5d4d8859c45b952824464ece27aaec" title="Executes the given query.">exec_query</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* query);
<a name="l00130"></a>00130 
<a name="l00136"></a>00136     <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1SQLStore.html#82fe00e1e7773a5b1ffe9aa16c01ba54" title="Set&amp;#39;s the key name.">set_key_name</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* name);
<a name="l00137"></a>00137 
<a name="l00138"></a>00138 <span class="keyword">private</span>:
<a name="l00139"></a>00139 
<a name="l00143"></a><a class="code" href="classdtn_1_1SQLStore.html#88b491808f01bb924556bc45d0bcd1d5">00143</a>     <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classdtn_1_1SQLStore.html#88b491808f01bb924556bc45d0bcd1d5" title="Name of the table in the database to which this SQLStore corresponds.">table_name_</a>;    
<a name="l00144"></a>00144     
<a name="l00148"></a><a class="code" href="classdtn_1_1SQLStore.html#d45884fe2aef26d9bb21c70cd403a171">00148</a>     <span class="keyword">const</span> <span class="keywordtype">char</span>*  <a class="code" href="classdtn_1_1SQLStore.html#d45884fe2aef26d9bb21c70cd403a171" title="Field name by which the objects are keyed.">key_name_</a>; 
<a name="l00149"></a>00149 
<a name="l00150"></a><a class="code" href="classdtn_1_1SQLStore.html#3ac21b1c7b83baa5bacbcac387356477">00150</a>     oasys::SQLImplementation*  <a class="code" href="classdtn_1_1SQLStore.html#3ac21b1c7b83baa5bacbcac387356477" title="Name of the table in the database to which this SQLStore corresponds.">sql_impl_</a>;
<a name="l00151"></a>00151 };
<a name="l00152"></a>00152 
<a name="l00153"></a>00153 } <span class="comment">// namespace dtn</span>
<a name="l00154"></a>00154 
<a name="l00155"></a>00155 <span class="preprocessor">#endif </span><span class="comment">/* _SQL_STORE_H_ */</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Jul 21 14:09:47 2008 for DTN Reference Implementation by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>