arcolight commented on code in PR #7001:
URL: https://github.com/apache/ignite-3/pull/7001#discussion_r2538540938


##########
modules/platforms/cpp/ignite/odbc/sql_environment.cpp:
##########
@@ -20,8 +20,15 @@
 
 namespace ignite {
 
-sql_connection *sql_environment::create_connection() {
-    sql_connection *connection;
+sql_environment::sql_environment()
+    : m_timer_thread(detail::thread_timer::start([&] (auto&& err) {
+        std::cout << "[SQL ENV CTOR] error: " << err.what() << std::endl;

Review Comment:
   Fixed



##########
modules/platforms/cpp/ignite/odbc/sql_environment.cpp:
##########
@@ -32,16 +39,24 @@ void sql_environment::deregister_connection(sql_connection 
*conn) {
     m_connections.erase(conn);
 }
 
-sql_result sql_environment::internal_create_connection(sql_connection *&conn) {
-    conn = new sql_connection(this);
+sql_result sql_environment::internal_create_connection(sql_connection_ptr 
*&conn) {
+    auto conn_raw = new(std::nothrow) sql_connection(this, m_timer_thread);
+    if (!conn_raw) {
+        add_status_record(sql_state::SHY001_MEMORY_ALLOCATION, "Not enough 
memory.");
 
+        return sql_result::AI_ERROR;
+    }
+
+    conn = new(std::nothrow) sql_connection_ptr(conn_raw);
     if (!conn) {
+        delete conn;

Review Comment:
   Fixed



##########
modules/platforms/cpp/ignite/odbc/sql_connection.h:
##########
@@ -40,9 +41,12 @@ class sql_statement;
 /**
  * ODBC node connection.
  */
-class sql_connection : public diagnosable_adapter {
+class sql_connection : public diagnosable_adapter, public 
std::enable_shared_from_this<sql_connection>  {

Review Comment:
   Fixed



##########
modules/platforms/cpp/ignite/odbc/config/configuration.cpp:
##########
@@ -125,6 +128,16 @@ void configuration::from_config_map(const config_map 
&config_params) {
     try_get_string_param(m_ssl_key_file, config_params, key::ssl_key_file);
     try_get_string_param(m_ssl_cert_file, config_params, key::ssl_cert_file);
     try_get_string_param(m_ssl_ca_file, config_params, key::ssl_ca_file);
+
+    auto heartbeat_interval_it = config_params.find(key::heartbeat_interval);
+    if (heartbeat_interval_it != config_params.end()) {
+        auto heartbeat_interval_opt = 
parse_int<std::int32_t>(heartbeat_interval_it->second);
+        if (!heartbeat_interval_opt)
+            throw 
odbc_error(sql_state::S01S00_INVALID_CONNECTION_STRING_ATTRIBUTE,
+                "Invalid page size value: " + heartbeat_interval_it->second);

Review Comment:
   Fixed



-- 
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