ClickHouse / clickhouse-odbc

ODBC driver for ClickHouse
https://clickhouse.tech
Apache License 2.0
239 stars 84 forks source link

API sqlcancel is not supported #422

Open tianbeierlu opened 1 year ago

tianbeierlu commented 1 year ago

To kill a slow query through the ODBC interface, we can normally use "sqlcancel". However, "clickhouse-odbc" does not implement this function, and there will be no response after calling this interface. Therefore, the only way to kill the slow query is through "kill query" in "clickhouse-server". the mysql odbc and oracle odbc all works.

SQLRETURN SQL_API EXPORTED_FUNCTION(SQLCancel)(
    SQLHSTMT     StatementHandle
) {
    auto func = [&] (Statement & statement) {
        statement.closeCursor();
        return SQL_SUCCESS;
    };

    return CALL_WITH_TYPED_HANDLE(SQL_HANDLE_STMT, StatementHandle, func);
}

from odbc.cpp,we find the sqlcancel API,it only works when cursor happend.