00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _SQL_STORE_H_
00018 #define _SQL_STORE_H_
00019
00020 #include <vector>
00021 #include <sys/time.h>
00022 #include <oasys/debug/Log.h>
00023 #include <oasys/serialize/SQLSerialize.h>
00024 #include "BundleStore.h"
00025 #include "PersistentStore.h"
00026
00027 namespace dtn {
00028
00033 class SQLStore : public PersistentStore, public oasys::Logger {
00034 public:
00035
00041 SQLStore(const char* table_name, oasys::SQLImplementation *db);
00042
00044
00048 int close();
00049
00054 int get(oasys::SerializableObject* obj, const int key);
00055
00059 int put(oasys::SerializableObject* obj, const int key);
00060
00065 int add(oasys::SerializableObject* obj, const int key);
00066
00071 int update(oasys::SerializableObject* obj, const int key);
00072
00077 int del(const int key);
00078
00083 int num_elements();
00084
00089 void keys(std::vector<int> * l);
00090
00094 int exists(const int id);
00095
00104 int elements(oasys::SerializableObjectVector* elements);
00105
00109 const char* table_name();
00110
00115 bool has_table(const char *name);
00116
00122 int create_table(oasys::SerializableObject* obj);
00123
00124
00129 int exec_query(const char* query);
00130
00136 void set_key_name(const char* name);
00137
00138 private:
00139
00143 const char* table_name_;
00144
00148 const char* key_name_;
00149
00150 oasys::SQLImplementation* sql_impl_;
00151 };
00152
00153 }
00154
00155 #endif