1 #ifndef INCLUDE_ORA_DATABASE_H
2 #define INCLUDE_ORA_DATABASE_H
15 #include <boost/shared_ptr.hpp>
41 Database(boost::shared_ptr<ConnectionPool>& connectionPool);
59 bool connect(
const std::string& connectionString,
const std::string& asRole,
bool readOnly=
false );
77 bool create( std::string userSchemaVersion = std::string(
"") );
113 template <
typename T> boost::shared_ptr<T>
fetch(
const OId& oid);
119 template <
typename T>
OId insert(
const std::string& containerName,
const T& data);
122 template <
typename T>
OId insert(
const T& data);
128 template <
typename T>
void update(
const OId& oid,
const T& data );
146 bool getItemId(
const std::string& name,
OId& destination );
152 template <
typename T> boost::shared_ptr<T>
fetchByName(
const std::string& name );
171 void open(
bool writingAccess=
false );
189 boost::shared_ptr<void>
getTypedObjectByName(
const std::string& name,
const std::type_info& typeInfo );
199 template <
typename T>
205 template <
typename T>
208 return createContainer(
typeid(
T) );
211 template <
typename T>
218 template <
typename T>
222 Container cont = getContainer( containerName,
typeid(data) );
223 int itemId = cont.
insert( data );
224 return OId( cont.
id(), itemId );
227 template <
typename T>
231 int itemId = cont.
insert( data );
232 return OId( cont.
id(), itemId );
235 template <
typename T>
243 template <
typename T>
246 return boost::static_pointer_cast<
T>( getTypedObjectByName( name,
typeid(
T) ) );
bool create(std::string userSchemaVersion=std::string(""))
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)
ora::Version schemaVersion(bool userSchema=false)
void open(bool writingAccess=false)
bool lockContainer(const std::string &name)
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)
char data[epos_bytes_allocation]
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)
void setAccessPermission(const std::string &principal, bool forWrite)