aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/native/client/src/clientlib/drillClient.cpp5
-rw-r--r--contrib/native/client/src/clientlib/drillClientImpl.cpp14
-rw-r--r--contrib/native/client/src/include/drill/drillClient.hpp15
3 files changed, 23 insertions, 11 deletions
diff --git a/contrib/native/client/src/clientlib/drillClient.cpp b/contrib/native/client/src/clientlib/drillClient.cpp
index a8cfe8c31..02bc1a47c 100644
--- a/contrib/native/client/src/clientlib/drillClient.cpp
+++ b/contrib/native/client/src/clientlib/drillClient.cpp
@@ -297,6 +297,11 @@ RecordIterator* DrillClient::submitQuery(Drill::QueryType t, const std::string&
void* DrillClient::getApplicationContext(QueryHandle_t handle){
return ((DrillClientQueryResult*)handle)->getListenerContext();
}
+
+status_t DrillClient::getQueryStatus(QueryHandle_t handle){
+ return ((DrillClientQueryResult*)handle)->getQueryStatus();
+}
+
std::string& DrillClient::getError(){
return m_pImpl->getError()->msg;
}
diff --git a/contrib/native/client/src/clientlib/drillClientImpl.cpp b/contrib/native/client/src/clientlib/drillClientImpl.cpp
index 84aa6cdb0..c832a7916 100644
--- a/contrib/native/client/src/clientlib/drillClientImpl.cpp
+++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp
@@ -664,7 +664,6 @@ status_t DrillClientImpl::processQueryStatusResult(exec::shared::QueryResult* qr
ret=handleQryError(ret, qr->error(0), pDrillClientQueryResult);
}
break;
-
// m_pendingRequests should be decremented when the query is
// completed
case exec::shared::QueryResult_QueryState_CANCELED:
@@ -677,15 +676,16 @@ status_t DrillClientImpl::processQueryStatusResult(exec::shared::QueryResult* qr
break;
case exec::shared::QueryResult_QueryState_COMPLETED:
{
- // DO NOT call handleTerminateQryState because that
- // signals an error condition and the synchronous API
- // will then free the query result object without it
- // being processed by the application.
- ret=QRY_COMPLETED;
+ //Not clean to call the handleTerminatedQryState method
+ //because it signals an error to the listener.
+ //The ODBC driver expects this though and the sync API
+ //handles this (luckily).
+ ret=handleTerminatedQryState(ret,
+ getMessage(ERR_QRY_COMPLETED),
+ pDrillClientQueryResult);
m_pendingRequests--;
}
break;
-
default:
{
DRILL_LOG(LOG_TRACE) << "DrillClientImpl::processQueryResult: Unknown Query State.\n";
diff --git a/contrib/native/client/src/include/drill/drillClient.hpp b/contrib/native/client/src/include/drill/drillClient.hpp
index 490c823d5..0204855b2 100644
--- a/contrib/native/client/src/include/drill/drillClient.hpp
+++ b/contrib/native/client/src/include/drill/drillClient.hpp
@@ -191,6 +191,17 @@ class DECLSPEC_DRILL_CLIENT RecordIterator{
class DECLSPEC_DRILL_CLIENT DrillClient{
public:
+ /*
+ * Get the application context from query handle
+ */
+ static void* getApplicationContext(QueryHandle_t handle);
+
+ /*
+ * Get the query status from query handle
+ */
+ static status_t getQueryStatus(QueryHandle_t handle);
+
+
DrillClient();
~DrillClient();
@@ -238,10 +249,6 @@ class DECLSPEC_DRILL_CLIENT DrillClient{
* back. The listener callback will return the handle in the ctx parameter.
*/
status_t submitQuery(Drill::QueryType t, const std::string& plan, pfnQueryResultsListener listener, void* listenerCtx, QueryHandle_t* qHandle);
- /*
- * Get the application context from query handle
- */
- static void* getApplicationContext(QueryHandle_t handle);
/*
* Submit a query asynchronously and wait for results to be returned through an iterator that returns