diff --git a/src/method/method_invoke_group.cpp b/src/method/method_invoke_group.cpp index 8b54d4d25ab..64a4f4208ea 100644 --- a/src/method/method_invoke_group.cpp +++ b/src/method/method_invoke_group.cpp @@ -343,6 +343,12 @@ namespace cubmethod query_cursor * method_invoke_group::create_cursor (QUERY_ID query_id, bool oid_included) { + if (query_id == NULL_QUERY_ID || query_id >= SHRT_MAX) + { + // false query e.g) SELECT * FROM db_class WHERE 0 <> 0 + return nullptr; + } + m_cursor_set.insert (query_id); return m_rctx->create_cursor (m_thread_p, query_id, oid_included); } diff --git a/src/method/method_invoke_java.cpp b/src/method/method_invoke_java.cpp index c45973df963..bbb7ae2c0c7 100644 --- a/src/method/method_invoke_java.cpp +++ b/src/method/method_invoke_java.cpp @@ -451,9 +451,7 @@ namespace cubmethod { std::uint64_t qid = current_result_info.query_id; bool is_oid_included = current_result_info.include_oid; - query_cursor *cursor = m_group->create_cursor (qid, is_oid_included); - - assert (cursor != nullptr); + (void) m_group->create_cursor (qid, is_oid_included); } } @@ -496,7 +494,6 @@ namespace cubmethod } fetch_info info; - int i = 0; SCAN_CODE s_code = S_SUCCESS; while (s_code == S_SUCCESS) diff --git a/src/method/method_query_handler.cpp b/src/method/method_query_handler.cpp index 7aa9683a6f7..449de8b4903 100644 --- a/src/method/method_query_handler.cpp +++ b/src/method/method_query_handler.cpp @@ -523,7 +523,14 @@ namespace cubmethod if (qres && qres->type == T_SELECT) { - result_info.query_id = qres->res.s.query_id; + if (qresult.tuple_count > 0) + { + result_info.query_id = qres->res.s.query_id; + } + else + { + result_info.query_id = NULL_QUERY_ID; // initialized value + } } return error; } diff --git a/src/method/method_runtime_context.cpp b/src/method/method_runtime_context.cpp index e635bff9c7e..de2b2aab1a0 100644 --- a/src/method/method_runtime_context.cpp +++ b/src/method/method_runtime_context.cpp @@ -259,8 +259,7 @@ namespace cubmethod { if (query_id == NULL_QUERY_ID || query_id >= SHRT_MAX) { - // something wrong! - assert (false); + // false query e.g) SELECT * FROM db_class WHERE 0 <> 0 return nullptr; }