IGNITE-2243: Implmented SQLGetEnvAttr.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/70370696 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/70370696 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/70370696 Branch: refs/heads/ignite-1786 Commit: 70370696fd136d0d0e1230957ac21837f3f2b4d1 Parents: 6c18d64 Author: isapego <[email protected]> Authored: Wed Jan 20 20:33:32 2016 +0300 Committer: isapego <[email protected]> Committed: Wed Jan 20 20:33:32 2016 +0300 ---------------------------------------------------------------------- .../include/ignite/odbc/environment.h | 21 +++++++++++++++++++- .../cpp/odbc/odbc-driver/src/environment.cpp | 10 ++++++++++ .../platforms/cpp/odbc/odbc-driver/src/odbc.cpp | 21 +++++++++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/70370696/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/environment.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/environment.h b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/environment.h index 4fff8d2..c88a7bf 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/environment.h +++ b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/environment.h @@ -68,6 +68,14 @@ namespace ignite */ void SetAttribute(int32_t attr, void* value, int32_t len); + /** + * Get attribute. + * + * @param attr Attribute to set. + * @param buffer Buffer to put value to. + */ + void GetAttribute(int32_t attr, app::ApplicationDataBuffer& buffer); + private: IGNITE_NO_COPY_ASSIGNMENT(Environment); @@ -95,9 +103,10 @@ namespace ignite * @return Operation result. */ SqlResult InternalTransactionRollback(); - + /** * Set attribute. + * Internal call. * * @param attr Attribute to set. * @param value Value. @@ -105,6 +114,16 @@ namespace ignite * @return Operation result. */ SqlResult InternalSetAttribute(int32_t attr, void* value, int32_t len); + + /** + * Get attribute. + * Internal call. + * + * @param attr Attribute to set. + * @param buffer Buffer to put value to. + * @return Operation result. + */ + SqlResult InternalGetAttribute(int32_t attr, app::ApplicationDataBuffer& buffer); }; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/70370696/modules/platforms/cpp/odbc/odbc-driver/src/environment.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/environment.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/environment.cpp index 58e018b..c5e4808 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/environment.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/environment.cpp @@ -87,6 +87,16 @@ namespace ignite { return SQL_RESULT_SUCCESS; } + + void Environment::GetAttribute(int32_t attr, app::ApplicationDataBuffer& buffer) + { + IGNITE_ODBC_API_CALL(InternalGetAttribute(attr, buffer)); + } + + SqlResult Environment::InternalGetAttribute(int32_t attr, app::ApplicationDataBuffer& buffer) + { + return SQL_RESULT_SUCCESS; + } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/70370696/modules/platforms/cpp/odbc/odbc-driver/src/odbc.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/odbc.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/odbc.cpp index 2f206b4..2b0e074 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/odbc.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/odbc.cpp @@ -1315,8 +1315,27 @@ SQLRETURN SQL_API SQLGetEnvAttr(SQLHENV env, SQLINTEGER valueBufLen, SQLINTEGER* valueResLen) { + using namespace ignite::odbc; + using namespace ignite::odbc::type_traits; + + using ignite::odbc::app::ApplicationDataBuffer; + LOG_MSG("SQLGetEnvAttr called\n"); - return SQL_SUCCESS; + + Environment *environment = reinterpret_cast<Environment*>(env); + + if (!environment) + return SQL_INVALID_HANDLE; + + SqlLen outResLen; + ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_DEFAULT, valueBuf, + static_cast<int32_t>(valueBufLen), &outResLen); + + environment->GetAttribute(attr, outBuffer); + + *valueResLen = static_cast<SQLSMALLINT>(outResLen); + + return environment->GetDiagnosticRecords().GetReturnCode(); } //
