1 #ifndef INCLUDE_ORA_DATABASE_H
2 #define INCLUDE_ORA_DATABASE_H
14 #include <boost/shared_ptr.hpp>
40 Database(boost::shared_ptr<ConnectionPool>& connectionPool);
100 template <
typename T> boost::shared_ptr<T>
fetch(
const OId& oid);
106 template <
typename T>
OId insert(
const std::string& containerName,
const T& data);
109 template <
typename T>
OId insert(
const T& data);
115 template <
typename T>
void update(
const OId& oid,
const T& data );
133 bool getItemId(
const std::string& name,
OId& destination );
139 template <
typename T> boost::shared_ptr<T>
fetchByName(
const std::string& name );
158 void open(
bool writingAccess=
false );
176 boost::shared_ptr<void>
getTypedObjectByName(
const std::string& name,
const std::type_info& typeInfo );
186 template <
typename T>
192 template <
typename T>
195 return createContainer(
typeid(T) );
198 template <
typename T>
205 template <
typename T>
209 Container cont = getContainer( containerName,
typeid(data) );
210 int itemId = cont.
insert( data );
211 return OId( cont.
id(), itemId );
214 template <
typename T>
218 int itemId = cont.
insert( data );
219 return OId( cont.
id(), itemId );
222 template <
typename T>
230 template <
typename T>
233 return boost::static_pointer_cast<T>( getTypedObjectByName( name,
typeid(T) ) );
int insert(const T &data)
Object fetchItemByName(const std::string &name)
OId insert(const std::string &containerName, const T &data)
const std::string & connectionString()
bool getItemId(const std::string &name, OId &destination)
void open(bool writingAccess=false)
Transaction & transaction()
SharedSession & storageAccessSession()
void erase(const OId &oid)
Object fetchItem(const OId &oid)
Container containerHandle(const std::string &name)
boost::shared_ptr< T > fetchByName(const std::string &name)
std::set< std::string > containers()
void update(int itemId, const T &data)
boost::shared_ptr< T > fetch(const OId &oid)
bool dropContainer(const std::string &name)
Container createContainer()
boost::shared_ptr< DatabaseImpl > m_impl
DatabaseUtility utility()
bool getNamesForObject(const OId &oid, std::vector< std::string > &destination)
OId insertItem(const std::string &containerName, const Object &data)
Database & operator=(const Database &rhs)
bool connect(const std::string &connectionString, bool readOnly=false)
bool eraseObjectName(const std::string &name)
static std::string nameForContainer(const std::type_info &typeInfo)
void update(const OId &oid, const T &data)
boost::shared_ptr< T > fetch(int itemId)
bool listObjectNames(std::vector< std::string > &destination)
boost::shared_ptr< void > getTypedObjectByName(const std::string &name, const std::type_info &typeInfo)
Configuration & configuration()
void updateItem(const OId &oid, const Object &data)
void setObjectName(const std::string &name, const OId &oid)
std::string className(const T &t)
Container getContainer(const std::string &name, const std::type_info &typeInfo)