IGNITE-2248: Implmented Statement::InternalExecuteSpecialColumnsQuery.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8b1db4ef Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8b1db4ef Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8b1db4ef Branch: refs/heads/ignite-1786 Commit: 8b1db4ef54f83a70e5a92aa7c7c8d15ad51fb368 Parents: d86a82c Author: isapego <[email protected]> Authored: Thu Jan 21 17:27:27 2016 +0300 Committer: isapego <[email protected]> Committed: Thu Jan 21 17:27:27 2016 +0300 ---------------------------------------------------------------------- .../include/ignite/odbc/common_types.h | 47 +++++++++++--------- .../ignite/odbc/query/special_columns_query.h | 2 +- .../cpp/odbc/odbc-driver/src/statement.cpp | 17 ++++++- 3 files changed, 42 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/8b1db4ef/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/common_types.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/common_types.h b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/common_types.h index c065872..8e1dbf2 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/common_types.h +++ b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/common_types.h @@ -73,48 +73,49 @@ namespace ignite SQL_STATE_24000_INVALID_CURSOR_STATE, /** - * The driver was unable to establish a connection with the data - * source. - */ + * The driver was unable to establish a connection with the data + * source. + */ SQL_STATE_08001_CANNOT_CONNECT, /** - * The specified ConnectionHandle had already been used - * to establish a connection with a data source, and the connection - * was still open. - */ + * The specified ConnectionHandle had already been used + * to establish a connection with a data source, and the connection + * was still open. + */ SQL_STATE_08002_ALREADY_CONNECTED, /** The connection specified was not open. */ SQL_STATE_08003_NOT_CONNECTED, /** - * An error occurred for which there was no specific SQLSTATE - * and for which no implementation-specific SQLSTATE was defined. - */ + * An error occurred for which there was no specific SQLSTATE + * and for which no implementation-specific SQLSTATE was defined. + */ SQL_STATE_HY000_GENERAL_ERROR, /** - * The driver was unable to allocate memory for the specified - * handle. - */ + * The driver was unable to allocate memory for the specified + * handle. + */ SQL_STATE_HY001_MEMORY_ALLOCATION, - /** - * Function sequence error. - */ + /** Function sequence error. */ SQL_STATE_HY010_SEQUENCE_ERROR, + /** Column type out of range. */ + SQL_STATE_HY097_COLUMN_TYPE_OUT_OF_RANGE, + /** - * The driver does not support the feature of ODBC behavior that - * the application requested. - */ + * The driver does not support the feature of ODBC behavior that + * the application requested. + */ SQL_STATE_HYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED, /** - * The connection timeout period expired before the data source - * responded to the request. - */ + * The connection timeout period expired before the data source + * responded to the request. + */ SQL_STATE_HYT01_CONNECTIOIN_TIMEOUT }; @@ -216,6 +217,8 @@ namespace ignite * @return Internal EnvironmentAttribute type value. */ EnvironmentAttribute EnvironmentAttributeToInternal(int32_t attr); + + } } http://git-wip-us.apache.org/repos/asf/ignite/blob/8b1db4ef/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/query/special_columns_query.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/query/special_columns_query.h b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/query/special_columns_query.h index ad45791..f5affad 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/query/special_columns_query.h +++ b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/query/special_columns_query.h @@ -29,7 +29,7 @@ namespace ignite /** * Special columns query. */ - class SpecialColumnsQuery : Query + class SpecialColumnsQuery : public Query { public: http://git-wip-us.apache.org/repos/asf/ignite/blob/8b1db4ef/modules/platforms/cpp/odbc/odbc-driver/src/statement.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/statement.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/statement.cpp index d7ea288..4bf0db9 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/statement.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/statement.cpp @@ -22,6 +22,7 @@ #include "ignite/odbc/query/foreign_keys_query.h" #include "ignite/odbc/query/primary_keys_query.h" #include "ignite/odbc/query/type_info_query.h" +#include "ignite/odbc/query/special_columns_query.h" #include "ignite/odbc/connection.h" #include "ignite/odbc/utility.h" #include "ignite/odbc/message.h" @@ -317,7 +318,21 @@ namespace ignite const std::string& catalog, const std::string& schema, const std::string& table, int16_t scope, int16_t nullable) { - return SQL_RESULT_ERROR; + if (type != SQL_BEST_ROWID && type != SQL_ROWVER) + { + AddStatusRecord(SQL_STATE_HY097_COLUMN_TYPE_OUT_OF_RANGE, + "An invalid IdentifierType value was specified."); + + return SQL_RESULT_ERROR; + } + + if (currentQuery.get()) + currentQuery->Close(); + + currentQuery.reset(new query::SpecialColumnsQuery(*this, type, + catalog, schema, table, scope, nullable)); + + return currentQuery->Execute(); } void Statement::ExecuteGetTypeInfoQuery(int16_t sqlType)
