15 #ifndef ORM_FUNCTIONAL_OBJECT_HPP
16 #define ORM_FUNCTIONAL_OBJECT_HPP
48 std::string
processJSON(
const std::string& input_message);
77 void createDriverByName();
79 void setDatabaseName();
80 void setWritePolicy();
81 void setWriteUnique();
83 void put(
const std::string &
key,
const std::string & value ) {
84 this->_dbDriver->put(key,value);
85 this->_status = this->_dbDriver->getLastError();
87 std::string
get (
const std::string &
key ) {
88 std::string value(this->_dbDriver->get(key));
89 this->_status = this->_dbDriver->getLastError();
92 std::vector<std::string> get_all () {
93 std::vector<std::string> value (this->_dbDriver->get_all());
94 this->_status = this->_dbDriver->getLastError();
97 void del (
const std::string& key) {
98 this->_dbDriver->del(key);
99 this->_status = _dbDriver->getLastError();
106 Poco::SharedPtr<Response> putData(
const std::string&);
107 Poco::SharedPtr<Response> getData(
const std::string&);
108 Poco::SharedPtr<Response> delData(
const std::string&);
109 Poco::SharedPtr<Response> checkData(
const std::string&);
110 Poco::SharedPtr<Response> getAllKeys(
const std::string&);
111 Poco::SharedPtr<Response> adminData(
const std::string&);
115 inline int getLastError() {
return _dbDriver->getLastError(); }
123 STATUS loadResourcesFromJSON(
const std::string&, std::map<std::string, std::string>&);
124 STATUS loadDocIdsFromJSON(
const std::string&, std::vector<std::string>&);
131 const std::string getDBEngine()
const {
return this->_dbConfig.
getDriverName(); }
133 unsigned int _errorCode;
134 std::string _errorMsg;
137 typedef std::function<Poco::SharedPtr<HCE::Response>(
ORMFunctionalObject*,
const std::string&)> FP;
138 std::vector<FP> command;
140 Poco::SharedPtr<HCE::BaseDB> _dbDriver;
142 Poco::DynamicFactory<HCE::BaseDB> _factory;
145 inline void ORMFunctionalObject::createDriverByName() {
147 this->_dbDriver = this->_factory.createInstance( this->_dbConfig.
getDriverName() );
151 inline void ORMFunctionalObject::setDriverUrl() {
153 if (this->_dbDriver) {
154 this->_dbDriver->setDriverUrl( this->_dbConfig.
getDataBaseUrl() );
159 inline void ORMFunctionalObject::setDatabaseName() {
161 if (this->_dbDriver) {
168 inline void ORMFunctionalObject::setWritePolicy() {
170 if (this->_dbDriver) {
171 this->_dbDriver->setWritePolicy(this->_dbConfig.
getWritePolicy());
177 inline void ORMFunctionalObject::setWriteUnique() {
179 if (this->_dbDriver) {
180 this->_dbDriver->setWriteUnique(this->_dbConfig.
getWriteUnique());