IGNITE-2248: Implemented SQLSpecialColumns with a stub in Statement.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bf566a82 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bf566a82 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bf566a82 Branch: refs/heads/ignite-1786 Commit: bf566a82e9da56086a9e4d53a1d59f167736abab Parents: 0346daf Author: isapego <[email protected]> Authored: Thu Jan 21 16:14:51 2016 +0300 Committer: isapego <[email protected]> Committed: Thu Jan 21 16:14:51 2016 +0300 ---------------------------------------------------------------------- .../odbc-driver/include/ignite/odbc/statement.h | 31 ++++++++++++ .../platforms/cpp/odbc/odbc-driver/src/odbc.cpp | 50 ++++++++++++++------ .../cpp/odbc/odbc-driver/src/statement.cpp | 15 ++++++ 3 files changed, 81 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/bf566a82/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/statement.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/statement.h b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/statement.h index 43ba239..4c49a76 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/statement.h +++ b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/statement.h @@ -235,6 +235,21 @@ namespace ignite const std::string& schema, const std::string& table); /** + * Get special columns. + * + * @param type Special column type. + * @param catalog Catalog name. + * @param schema Schema name. + * @param table Table name. + * @param scope Minimum required scope of the rowid. + * @param type Determines whether to return special columns that + * can have a NULL value. + */ + void ExecuteGetSpecialColumnsQuery(int16_t type, + const std::string& catalog, const std::string& schema, + const std::string& table, int16_t scope, int16_t nullable); + + /** * Get type info. * * @param sqlType SQL type for which to return info or SQL_ALL_TYPES. @@ -428,6 +443,22 @@ namespace ignite const std::string& schema, const std::string& table); /** + * Get special columns. + * + * @param type Special column type. + * @param catalog Catalog name. + * @param schema Schema name. + * @param table Table name. + * @param scope Minimum required scope of the rowid. + * @param type Determines whether to return special columns that + * can have a NULL value. + * @return Operation result. + */ + SqlResult InternalExecuteGetSpecialColumnsQuery(int16_t type, + const std::string& catalog, const std::string& schema, + const std::string& table, int16_t scope, int16_t nullable); + + /** * Get type info. * * @param sqlType SQL type for which to return info or SQL_ALL_TYPES. http://git-wip-us.apache.org/repos/asf/ignite/blob/bf566a82/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 2b0e074..7199ad3 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/odbc.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/odbc.cpp @@ -1338,6 +1338,41 @@ SQLRETURN SQL_API SQLGetEnvAttr(SQLHENV env, return environment->GetDiagnosticRecords().GetReturnCode(); } +SQLRETURN SQL_API SQLSpecialColumns(SQLHSTMT stmt, + SQLSMALLINT idType, + SQLCHAR* catalogName, + SQLSMALLINT catalogNameLen, + SQLCHAR* schemaName, + SQLSMALLINT schemaNameLen, + SQLCHAR* tableName, + SQLSMALLINT tableNameLen, + SQLSMALLINT scope, + SQLSMALLINT nullable) +{ + using namespace ignite::odbc; + + using ignite::utility::SqlStringToString; + + LOG_MSG("SQLSpecialColumns called\n"); + + Statement *statement = reinterpret_cast<Statement*>(stmt); + + if (!statement) + return SQL_INVALID_HANDLE; + + std::string catalog = SqlStringToString(catalogName, catalogNameLen); + std::string schema = SqlStringToString(schemaName, schemaNameLen); + std::string table = SqlStringToString(tableName, tableNameLen); + + LOG_MSG("catalog: %s\n", catalog.c_str()); + LOG_MSG("schema: %s\n", schema.c_str()); + LOG_MSG("table: %s\n", table.c_str()); + + statement->ExecuteGetSpecialColumnsQuery(idType, catalog, schema, table, scope, nullable); + + return statement->GetDiagnosticRecords().GetReturnCode(); +} + // // ==== Not implemented ==== // @@ -1445,21 +1480,6 @@ SQLRETURN SQL_API SQLSetStmtOption(SQLHSTMT stmt, return SQL_SUCCESS; } -SQLRETURN SQL_API SQLSpecialColumns(SQLHSTMT stmt, - SQLSMALLINT idType, - SQLCHAR* catalogName, - SQLSMALLINT catalogNameLen, - SQLCHAR* schemaName, - SQLSMALLINT schemaNameLen, - SQLCHAR* tableName, - SQLSMALLINT tableNameLen, - SQLSMALLINT scope, - SQLSMALLINT nullable) -{ - LOG_MSG("SQLSpecialColumns called\n"); - return SQL_SUCCESS; -} - SQLRETURN SQL_API SQLStatistics(SQLHSTMT stmt, SQLCHAR* catalogName, SQLSMALLINT catalogNameLen, http://git-wip-us.apache.org/repos/asf/ignite/blob/bf566a82/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 81cb523..4fd0294 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/statement.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/statement.cpp @@ -321,6 +321,21 @@ namespace ignite return currentQuery->Execute(); } + void Statement::ExecuteGetSpecialColumnsQuery(int16_t type, + const std::string& catalog, const std::string& schema, + const std::string& table, int16_t scope, int16_t nullable) + { + IGNITE_ODBC_API_CALL(InternalExecuteGetSpecialColumnsQuery(type, + catalog, schema, table, scope, nullable)); + } + + SqlResult Statement::InternalExecuteGetSpecialColumnsQuery(int16_t type, + const std::string& catalog, const std::string& schema, + const std::string& table, int16_t scope, int16_t nullable) + { + return SQL_RESULT_ERROR; + } + void Statement::ExecuteGetTypeInfoQuery(int16_t sqlType) { IGNITE_ODBC_API_CALL(InternalExecuteGetTypeInfoQuery(sqlType));
