Skip to content

Commit 27960e9

Browse files
committed
Fix current compilation errors.
1 parent d606713 commit 27960e9

File tree

7 files changed

+41
-9
lines changed

7 files changed

+41
-9
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
55
## use these variables to configure module installation
66

77
set(OATPP_THIS_MODULE_NAME oatpp-postgresql) ## name of the module (also name of folders in installation dirs)
8-
set(OATPP_THIS_MODULE_VERSION "1.1.0") ## version of the module (also sufix of folders in installation dirs)
8+
set(OATPP_THIS_MODULE_VERSION "1.2.0") ## version of the module (also sufix of folders in installation dirs)
99
set(OATPP_THIS_MODULE_LIBRARIES oatpp-postgresql) ## list of libraries to find when find_package is called
1010
set(OATPP_THIS_MODULE_TARGETS oatpp-postgresql) ## list of targets to install
1111
set(OATPP_THIS_MODULE_DIRECTORIES oatpp-postgresql) ## list of directories to install

src/oatpp-postgresql/Executor.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,18 @@ std::shared_ptr<orm::QueryResult> Executor::rollback(const std::shared_ptr<orm::
239239
return std::make_shared<QueryResult>(qres, pgConnection, m_connectionProvider, m_resultMapper);
240240
}
241241

242+
v_int64 Executor::getSchemaVersion(const oatpp::String& suffix,
243+
const std::shared_ptr<orm::Connection>& connection)
244+
{
245+
// TODO implement me!
246+
}
247+
248+
void Executor::migrateSchema(const oatpp::String& script,
249+
v_int64 newVersion,
250+
const oatpp::String& suffix,
251+
const std::shared_ptr<orm::Connection>& connection)
252+
{
253+
// TODO implement me!
254+
}
255+
242256
}}

src/oatpp-postgresql/Executor.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ class Executor : public orm::Executor {
104104

105105
std::shared_ptr<orm::QueryResult> rollback(const std::shared_ptr<orm::Connection>& connection) override;
106106

107+
v_int64 getSchemaVersion(const oatpp::String& suffix = nullptr,
108+
const std::shared_ptr<orm::Connection>& connection = nullptr) override;
109+
110+
void migrateSchema(const oatpp::String& script,
111+
v_int64 newVersion,
112+
const oatpp::String& suffix = nullptr,
113+
const std::shared_ptr<orm::Connection>& connection = nullptr) override;
114+
107115
};
108116

109117
}}

src/oatpp-postgresql/QueryResult.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,20 @@ v_int64 QueryResult::getPosition() const {
9090
return m_resultData.rowIndex;
9191
}
9292

93-
v_int64 QueryResult::getCount() const {
93+
v_int64 QueryResult::getKnownCount() const {
9494
switch(m_type) {
9595
case TYPE_TUPLES: return m_resultData.rowCount;
9696
// case TYPE_COMMAND: return 0;
9797
}
9898
return 0;
9999
}
100100

101-
void QueryResult::fetch(oatpp::Void& polymorph, v_int64 count) {
102-
polymorph = m_resultMapper->readRows(&m_resultData, polymorph.valueType, count);
101+
bool QueryResult::hasMoreToFetch() const {
102+
return getKnownCount() > 0;
103+
}
104+
105+
oatpp::Void QueryResult::fetch(const oatpp::Type* const resultType, v_int64 count) {
106+
return m_resultMapper->readRows(&m_resultData, resultType, count);
103107
}
104108

105109
}}

src/oatpp-postgresql/QueryResult.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ class QueryResult : public orm::QueryResult {
6464

6565
v_int64 getPosition() const override;
6666

67-
v_int64 getCount() const override;
67+
v_int64 getKnownCount() const override;
6868

69-
void fetch(oatpp::Void& polymorph, v_int64 count) override;
69+
bool hasMoreToFetch() const override;
70+
71+
oatpp::Void fetch(const oatpp::Type* const resultType, v_int64 count) override;
7072

7173
};
7274

src/oatpp-postgresql/mapping/ResultMapper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ oatpp::Void ResultMapper::readOneRow(ResultData* dbData, const Type* type, v_int
136136

137137
oatpp::Void ResultMapper::readRows(ResultData* dbData, const Type* type, v_int64 count) {
138138

139+
if(count == -1) {
140+
count = dbData->rowCount;
141+
}
142+
139143
auto id = type->classId.id;
140144
auto& method = m_readRowsMethods[id];
141145

test/oatpp-postgresql/tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ class Test : public oatpp::test::UnitTest {
170170
auto executor = std::make_shared<oatpp::postgresql::Executor>(connectionPool);
171171
auto client = MyClient(executor);
172172

173-
//client.createUser("my-login1", "pass1", "email@email.com1", connection);
174-
//client.createUser("my-login2", "pass2", "email@email.com2", connection);
173+
//client.createUser("my-login1", "pass1", "email@email.com1");
174+
//client.createUser("my-login2", "pass2", "email@email.com2");
175175

176176
//client.insertInts(8, 8, 16, 16, 32, 32, 64, connection);
177177
//client.insertInts(-1, -1, -1, -1, -1, -1, -1, connection);
@@ -198,7 +198,7 @@ class Test : public oatpp::test::UnitTest {
198198
//auto res = client.insertMultipleUsers();
199199

200200
if(res->isSuccess()) {
201-
OATPP_LOGD(TAG, "OK, count=%d", res->getCount());
201+
OATPP_LOGD(TAG, "OK, count=%d", res->getKnownCount());
202202
} else {
203203
auto message = res->getErrorMessage();
204204
OATPP_LOGD(TAG, "Error, message=%s", message->c_str());

0 commit comments

Comments
 (0)