isapego commented on code in PR #2322:
URL: https://github.com/apache/ignite-3/pull/2322#discussion_r1265219913


##########
modules/platforms/cpp/ignite/odbc/query/cursor.h:
##########
@@ -35,41 +35,98 @@ class cursor
 
     /**
      * Constructor.
-     * @param query_id ID of the executed query.
+     *
+     * @param page Data page.
+     */
+    explicit cursor(std::unique_ptr<result_page> page)
+        : m_current_page(std::move(page)) {}
+
+    /**
+     * Move cursor to the next row.
+     *
+     * @return False if data update required or no more data.
      */
-    explicit cursor(std::int64_t query_id)
-        : m_query_id(query_id) {}
+    bool next(const column_meta_vector &columns)
+    {
+        if (!has_data())
+            return false;
+
+        ++m_page_pos;
+        if (std::uint32_t(m_page_pos) >= m_current_page->get_size())
+        {
+            m_current_page.reset();
+            return false;
+        }
+
+        ++m_result_set_pos;
+        auto row_data = m_current_page->get_row(m_page_pos);
+
+        auto columns_cnt = columns.size();
+        binary_tuple_parser parser(std::int32_t(columns_cnt), row_data);
+
+        m_row.clear();
+        for (size_t i = 0; i < columns_cnt; ++i) {
+            auto &column = columns[i];
+            m_row.push_back(protocol::read_next_column(parser, 
column.get_data_type(), column.get_scale()));
+        }
+
+        return true;
+    }
 
     /**
      * Check if the cursor has data.
      *
      * @return True if the cursor has data.
      */
-    [[nodiscard]] bool has_data() const {
-        return false;
+    [[nodiscard]] bool has_data() const
+    {

Review Comment:
   Thanks. Run clang-format.



##########
modules/platforms/cpp/ignite/odbc/app/application_data_buffer.cpp:
##########


Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to