Fix current compilation errors.

This commit is contained in:
lganzzzo 2020-09-15 03:35:43 +03:00
parent d606713eab
commit 27960e98f5
7 changed files with 41 additions and 9 deletions

View File

@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
## use these variables to configure module installation
set(OATPP_THIS_MODULE_NAME oatpp-postgresql) ## name of the module (also name of folders in installation dirs)
set(OATPP_THIS_MODULE_VERSION "1.1.0") ## version of the module (also sufix of folders in installation dirs)
set(OATPP_THIS_MODULE_VERSION "1.2.0") ## version of the module (also sufix of folders in installation dirs)
set(OATPP_THIS_MODULE_LIBRARIES oatpp-postgresql) ## list of libraries to find when find_package is called
set(OATPP_THIS_MODULE_TARGETS oatpp-postgresql) ## list of targets to install
set(OATPP_THIS_MODULE_DIRECTORIES oatpp-postgresql) ## list of directories to install

View File

@ -239,4 +239,18 @@ std::shared_ptr<orm::QueryResult> Executor::rollback(const std::shared_ptr<orm::
return std::make_shared<QueryResult>(qres, pgConnection, m_connectionProvider, m_resultMapper);
}
v_int64 Executor::getSchemaVersion(const oatpp::String& suffix,
const std::shared_ptr<orm::Connection>& connection)
{
// TODO implement me!
}
void Executor::migrateSchema(const oatpp::String& script,
v_int64 newVersion,
const oatpp::String& suffix,
const std::shared_ptr<orm::Connection>& connection)
{
// TODO implement me!
}
}}

View File

@ -104,6 +104,14 @@ public:
std::shared_ptr<orm::QueryResult> rollback(const std::shared_ptr<orm::Connection>& connection) override;
v_int64 getSchemaVersion(const oatpp::String& suffix = nullptr,
const std::shared_ptr<orm::Connection>& connection = nullptr) override;
void migrateSchema(const oatpp::String& script,
v_int64 newVersion,
const oatpp::String& suffix = nullptr,
const std::shared_ptr<orm::Connection>& connection = nullptr) override;
};
}}

View File

@ -90,7 +90,7 @@ v_int64 QueryResult::getPosition() const {
return m_resultData.rowIndex;
}
v_int64 QueryResult::getCount() const {
v_int64 QueryResult::getKnownCount() const {
switch(m_type) {
case TYPE_TUPLES: return m_resultData.rowCount;
// case TYPE_COMMAND: return 0;
@ -98,8 +98,12 @@ v_int64 QueryResult::getCount() const {
return 0;
}
void QueryResult::fetch(oatpp::Void& polymorph, v_int64 count) {
polymorph = m_resultMapper->readRows(&m_resultData, polymorph.valueType, count);
bool QueryResult::hasMoreToFetch() const {
return getKnownCount() > 0;
}
oatpp::Void QueryResult::fetch(const oatpp::Type* const resultType, v_int64 count) {
return m_resultMapper->readRows(&m_resultData, resultType, count);
}
}}

View File

@ -64,9 +64,11 @@ public:
v_int64 getPosition() const override;
v_int64 getCount() const override;
v_int64 getKnownCount() const override;
void fetch(oatpp::Void& polymorph, v_int64 count) override;
bool hasMoreToFetch() const override;
oatpp::Void fetch(const oatpp::Type* const resultType, v_int64 count) override;
};

View File

@ -136,6 +136,10 @@ oatpp::Void ResultMapper::readOneRow(ResultData* dbData, const Type* type, v_int
oatpp::Void ResultMapper::readRows(ResultData* dbData, const Type* type, v_int64 count) {
if(count == -1) {
count = dbData->rowCount;
}
auto id = type->classId.id;
auto& method = m_readRowsMethods[id];

View File

@ -170,8 +170,8 @@ public:
auto executor = std::make_shared<oatpp::postgresql::Executor>(connectionPool);
auto client = MyClient(executor);
//client.createUser("my-login1", "pass1", "email@email.com1", connection);
//client.createUser("my-login2", "pass2", "email@email.com2", connection);
//client.createUser("my-login1", "pass1", "email@email.com1");
//client.createUser("my-login2", "pass2", "email@email.com2");
//client.insertInts(8, 8, 16, 16, 32, 32, 64, connection);
//client.insertInts(-1, -1, -1, -1, -1, -1, -1, connection);
@ -198,7 +198,7 @@ public:
//auto res = client.insertMultipleUsers();
if(res->isSuccess()) {
OATPP_LOGD(TAG, "OK, count=%d", res->getCount());
OATPP_LOGD(TAG, "OK, count=%d", res->getKnownCount());
} else {
auto message = res->getErrorMessage();
OATPP_LOGD(TAG, "Error, message=%s", message->c_str());