IGNITE-1786: Better support for the x86.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b0b2c907 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b0b2c907 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b0b2c907 Branch: refs/heads/ignite-1786 Commit: b0b2c907cb6cf31c5ba3f9d99dd365e6a4bf4026 Parents: 37de912 Author: isapego <[email protected]> Authored: Fri Jan 15 16:26:57 2016 +0300 Committer: isapego <[email protected]> Committed: Fri Jan 15 16:26:57 2016 +0300 ---------------------------------------------------------------------- .../ignite/odbc/app/application_data_buffer.h | 13 ++--- .../include/ignite/odbc/app/parameter.h | 4 +- .../include/ignite/odbc/common_types.h | 15 ++++-- .../include/ignite/odbc/meta/column_meta.h | 3 +- .../odbc-driver/include/ignite/odbc/statement.h | 4 +- .../odbc-driver/project/vs/odbc-driver.vcxproj | 6 +-- .../src/app/application_data_buffer.cpp | 30 +++++------ .../cpp/odbc/odbc-driver/src/app/parameter.cpp | 2 +- .../cpp/odbc/odbc-driver/src/decimal.cpp | 2 +- .../diagnostic/diagnostic_record_storage.cpp | 2 +- .../odbc/odbc-driver/src/meta/column_meta.cpp | 2 +- .../platforms/cpp/odbc/odbc-driver/src/odbc.cpp | 13 ++--- .../src/query/column_metadata_query.cpp | 2 +- .../odbc/odbc-driver/src/query/data_query.cpp | 2 +- .../src/query/table_metadata_query.cpp | 2 +- .../cpp/odbc/odbc-driver/src/statement.cpp | 4 +- .../src/application_data_buffer_test.cpp | 55 ++++++++++---------- .../cpp/odbc/odbc-test/src/row_test.cpp | 4 +- 18 files changed, 88 insertions(+), 77 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/app/application_data_buffer.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/app/application_data_buffer.h b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/app/application_data_buffer.h index c2d4d1b..d77f598 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/app/application_data_buffer.h +++ b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/app/application_data_buffer.h @@ -25,6 +25,7 @@ #include <ignite/guid.h> #include "ignite/odbc/decimal.h" +#include "ignite/odbc/common_types.h" #include "ignite/odbc/type_traits.h" namespace ignite @@ -53,7 +54,7 @@ namespace ignite * @param reslen Resulting data length. * @param offset Pointer to buffer and reslen offset pointer. */ - ApplicationDataBuffer(type_traits::IgniteSqlType type, void* buffer, int64_t buflen, int64_t* reslen, size_t** offset = 0); + ApplicationDataBuffer(type_traits::IgniteSqlType type, void* buffer, SqlLen buflen, SqlLen* reslen, size_t** offset = 0); /** * Copy constructor. @@ -222,14 +223,14 @@ namespace ignite * * @return Data length pointer. */ - const int64_t* GetResLen() const; + const SqlLen* GetResLen() const; /** * Get buffer size in bytes. * * @return Buffer size. */ - int64_t GetSize() const + SqlLen GetSize() const { return buflen; } @@ -247,7 +248,7 @@ namespace ignite * * @return Data length pointer. */ - int64_t* GetResLen(); + SqlLen* GetResLen(); /** * Put value of numeric type in the buffer. @@ -321,10 +322,10 @@ namespace ignite void* buffer; /** Buffer length. */ - int64_t buflen; + SqlLen buflen; /** Result length. */ - int64_t* reslen; + SqlLen* reslen; /** Pointer to implementation pointer to application offset */ size_t** offset; http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/app/parameter.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/app/parameter.h b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/app/parameter.h index 2a274e1..8756f48 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/app/parameter.h +++ b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/app/parameter.h @@ -55,7 +55,7 @@ namespace ignite * @param decDigits IPD decimal digits. */ Parameter(const ApplicationDataBuffer& buffer, int16_t sqlType, - uint64_t columnSize, int16_t decDigits); + size_t columnSize, int16_t decDigits); /** * Copy constructor. @@ -98,7 +98,7 @@ namespace ignite int16_t sqlType; /** IPD column size. */ - uint64_t columnSize; + size_t columnSize; /** IPD decimal digits. */ int16_t decDigits; http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/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 80562c5..1d007fb 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 @@ -24,6 +24,13 @@ namespace ignite { namespace odbc { + +#ifdef _WIN64 + typedef long long SqlLen; +#else + typedef long SqlLen; +#endif + /** * SQL result. */ @@ -43,8 +50,8 @@ namespace ignite }; /** - * Provides detailed information about the cause of a warning or error. - */ + * Provides detailed information about the cause of a warning or error. + */ enum SqlState { /** Undefined state. Internal, should never be exposed to user. */ @@ -106,8 +113,8 @@ namespace ignite }; /** - * Diagnostic field type. - */ + * Diagnostic field type. + */ enum DiagnosticField { /** Header record field: Count of rows in the cursor. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/meta/column_meta.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/meta/column_meta.h b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/meta/column_meta.h index ccea0ae..e90070e 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/meta/column_meta.h +++ b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/meta/column_meta.h @@ -23,6 +23,7 @@ #include "ignite/impl/binary/binary_reader_impl.h" +#include "ignite/odbc/common_types.h" #include "ignite/odbc/utility.h" namespace ignite @@ -174,7 +175,7 @@ namespace ignite * @param value Output attribute value. * @return True if the attribute supported and false otherwise. */ - bool GetAttribute(uint16_t fieldId, int64_t& value) const; + bool GetAttribute(uint16_t fieldId, SqlLen& value) const; private: /** Schema name. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/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 a42da26..2449e07 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 @@ -268,7 +268,7 @@ namespace ignite * @param numbuf Numeric value buffer. */ void GetColumnAttribute(uint16_t colIdx, uint16_t attrId, char* strbuf, - int16_t buflen, int16_t* reslen, int64_t* numbuf); + int16_t buflen, int16_t* reslen, SqlLen* numbuf); /** * Get number of rows affected by the statement. @@ -429,7 +429,7 @@ namespace ignite * @return Operation result. */ SqlResult InternalGetColumnAttribute(uint16_t colIdx, uint16_t attrId, - char* strbuf, int16_t buflen, int16_t* reslen, int64_t* numbuf); + char* strbuf, int16_t buflen, int16_t* reslen, SqlLen* numbuf); /** * Get number of rows affected by the statement. http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj b/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj index 925b1b9..2f48e8d 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj +++ b/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj @@ -25,13 +25,13 @@ </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> + <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <PlatformToolset>v100</PlatformToolset> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> + <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v100</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> @@ -44,7 +44,7 @@ <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> + <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v100</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-driver/src/app/application_data_buffer.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/app/application_data_buffer.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/app/application_data_buffer.cpp index 3a3d061..5096820 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/app/application_data_buffer.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/app/application_data_buffer.cpp @@ -36,7 +36,7 @@ namespace ignite } ApplicationDataBuffer::ApplicationDataBuffer(type_traits::IgniteSqlType type, - void* buffer, int64_t buflen, int64_t* reslen, size_t** offset) : + void* buffer, SqlLen buflen, SqlLen* reslen, size_t** offset) : type(type), buffer(buffer), buflen(buflen), reslen(reslen), offset(offset) { // No-op. @@ -178,7 +178,7 @@ namespace ignite } else { - memcpy(GetData(), &value, buflen); + memcpy(GetData(), &value, static_cast<size_t>(buflen)); if (GetResLen()) *GetResLen() = SQL_NO_TOTAL; @@ -236,7 +236,7 @@ namespace ignite template<typename OutCharT, typename InCharT> void ApplicationDataBuffer::PutStrToStrBuffer(const std::basic_string<InCharT>& value) { - int64_t charSize = static_cast<int64_t>(sizeof(OutCharT)); + SqlLen charSize = static_cast<SqlLen>(sizeof(OutCharT)); if (GetData()) { @@ -244,11 +244,11 @@ namespace ignite { OutCharT* out = reinterpret_cast<OutCharT*>(GetData()); - int64_t outLen = (buflen / charSize) - 1; + SqlLen outLen = (buflen / charSize) - 1; - int64_t toCopy = std::min<int64_t>(outLen, value.size()); + SqlLen toCopy = std::min<size_t>(outLen, value.size()); - for (int64_t i = 0; i < toCopy; ++i) + for (SqlLen i = 0; i < toCopy; ++i) out[i] = value[i]; out[toCopy] = 0; @@ -256,8 +256,8 @@ namespace ignite if (GetResLen()) { - if (buflen >= static_cast<int64_t>((value.size() + 1) * charSize)) - *GetResLen() = value.size(); + if (buflen >= static_cast<SqlLen>((value.size() + 1) * charSize)) + *GetResLen() = static_cast<SqlLen>(value.size()); else *GetResLen() = SQL_NO_TOTAL; } @@ -268,11 +268,11 @@ namespace ignite void ApplicationDataBuffer::PutRawDataToBuffer(void *data, size_t len) { - int64_t ilen = static_cast<int64_t>(len); + SqlLen ilen = static_cast<SqlLen>(len); if (GetData()) { - int64_t toCopy = std::min(buflen, ilen); + size_t toCopy = static_cast<size_t>(std::min(buflen, ilen)); memcpy(GetData(), data, toCopy); @@ -532,7 +532,7 @@ namespace ignite case IGNITE_ODBC_C_TYPE_DEFAULT: { if (GetData()) - memcpy(GetData(), &value, std::min<size_t>(buflen, sizeof(value))); + memcpy(GetData(), &value, std::min(static_cast<size_t>(buflen), sizeof(value))); if (GetResLen()) *GetResLen() = sizeof(value); @@ -559,7 +559,7 @@ namespace ignite case IGNITE_ODBC_C_TYPE_CHAR: { res.assign(reinterpret_cast<const char*>(GetData()), - std::min<size_t>(maxLen, buflen)); + std::min(maxLen, static_cast<size_t>(buflen))); break; } @@ -657,7 +657,7 @@ namespace ignite return ApplyOffset(buffer); } - const int64_t* ApplicationDataBuffer::GetResLen() const + const SqlLen* ApplicationDataBuffer::GetResLen() const { return ApplyOffset(reslen); } @@ -667,7 +667,7 @@ namespace ignite return ApplyOffset(buffer); } - int64_t* ApplicationDataBuffer::GetResLen() + SqlLen* ApplicationDataBuffer::GetResLen() { return ApplyOffset(reslen); } @@ -683,7 +683,7 @@ namespace ignite { case IGNITE_ODBC_C_TYPE_CHAR: { - std::string str = GetString(buflen); + std::string str = GetString(static_cast<size_t>(buflen)); std::stringstream converter(str); http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-driver/src/app/parameter.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/app/parameter.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/app/parameter.cpp index d390569..dbe33e1 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/app/parameter.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/app/parameter.cpp @@ -39,7 +39,7 @@ namespace ignite } Parameter::Parameter(const ApplicationDataBuffer& buffer, int16_t sqlType, - uint64_t columnSize, int16_t decDigits) : + size_t columnSize, int16_t decDigits) : buffer(buffer), sqlType(sqlType), columnSize(columnSize), http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-driver/src/decimal.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/decimal.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/decimal.cpp index f88534b..0fa37fb 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/decimal.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/decimal.cpp @@ -65,7 +65,7 @@ namespace ignite int32_t localScale = GetScale(); - for (size_t i = 0; i < len; ++i) + for (int32_t i = 0; i < len; ++i) { res = (res * 256) + magnitude[i]; http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-driver/src/diagnostic/diagnostic_record_storage.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/diagnostic/diagnostic_record_storage.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/diagnostic/diagnostic_record_storage.cpp index 52ac414..90c0a4f 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/diagnostic/diagnostic_record_storage.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/diagnostic/diagnostic_record_storage.cpp @@ -159,7 +159,7 @@ namespace ignite break; } - if (recNum < 1 || recNum > statusRecords.size()) + if (recNum < 1 || static_cast<size_t>(recNum) > statusRecords.size()) return SQL_RESULT_NO_DATA; // Status record. http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-driver/src/meta/column_meta.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/meta/column_meta.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/meta/column_meta.cpp index b0d5015..ab12aad 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/meta/column_meta.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/meta/column_meta.cpp @@ -143,7 +143,7 @@ namespace ignite } } - bool ColumnMeta::GetAttribute(uint16_t fieldId, int64_t& value) const + bool ColumnMeta::GetAttribute(uint16_t fieldId, SqlLen& value) const { using namespace ignite::impl::binary; http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/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 b819744..6b2f4ae 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/odbc.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/odbc.cpp @@ -781,6 +781,7 @@ SQLRETURN SQL_API SQLDescribeCol(SQLHSTMT stmt, SQLSMALLINT* nullable) { using ignite::odbc::Statement; + using ignite::odbc::SqlLen; LOG_MSG("SQLDescribeCol called\n"); @@ -792,10 +793,10 @@ SQLRETURN SQL_API SQLDescribeCol(SQLHSTMT stmt, statement->GetColumnAttribute(columnNum, SQL_DESC_NAME, reinterpret_cast<char*>(columnNameBuf), columnNameBufLen, columnNameLen, 0); - int64_t dataTypeRes; - int64_t columnSizeRes; - int64_t decimalDigitsRes; - int64_t nullableRes; + SqlLen dataTypeRes; + SqlLen columnSizeRes; + SqlLen decimalDigitsRes; + SqlLen nullableRes; statement->GetColumnAttribute(columnNum, SQL_DESC_TYPE, 0, 0, 0, &dataTypeRes); statement->GetColumnAttribute(columnNum, SQL_DESC_PRECISION, 0, 0, 0, &columnSizeRes); @@ -1102,7 +1103,7 @@ SQLRETURN SQL_API SQLGetDiagField(SQLSMALLINT handleType, LOG_MSG("SQLGetDiagField called: %d\n", recNum); - int64_t outResLen; + SqlLen outResLen; ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_DEFAULT, buffer, bufferLen, &outResLen); SqlResult result; @@ -1183,7 +1184,7 @@ SQLRETURN SQL_API SQLGetDiagRec(SQLSMALLINT handleType, if (nativeError) *nativeError = 0; - int64_t outResLen; + SqlLen outResLen; ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_CHAR, msgBuffer, msgBufferLen, &outResLen); outBuffer.PutString(record.GetMessage()); http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-driver/src/query/column_metadata_query.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/query/column_metadata_query.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/query/column_metadata_query.cpp index a4db450..083b367 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/query/column_metadata_query.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/query/column_metadata_query.cpp @@ -286,7 +286,7 @@ namespace ignite meta = rsp.GetMeta(); - for (int i = 0; i < meta.size(); ++i) + for (size_t i = 0; i < meta.size(); ++i) { LOG_MSG("[%d] SchemaName: %s\n", i, meta[i].GetSchemaName().c_str()); LOG_MSG("[%d] TableName: %s\n", i, meta[i].GetTableName().c_str()); http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-driver/src/query/data_query.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/query/data_query.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/query/data_query.cpp index 187ed65..b630993 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/query/data_query.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/query/data_query.cpp @@ -174,7 +174,7 @@ namespace ignite LOG_MSG("Query id: %lld\n", cursor->GetQueryId()); - for (int i = 0; i < rsp.GetMeta().size(); ++i) + for (size_t i = 0; i < rsp.GetMeta().size(); ++i) { LOG_MSG("[%d] SchemaName: %s\n", i, rsp.GetMeta()[i].GetSchemaName().c_str()); LOG_MSG("[%d] TypeName: %s\n", i, rsp.GetMeta()[i].GetTableName().c_str()); http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-driver/src/query/table_metadata_query.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/query/table_metadata_query.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/query/table_metadata_query.cpp index d381ee4..5375515 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/query/table_metadata_query.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/query/table_metadata_query.cpp @@ -212,7 +212,7 @@ namespace ignite meta = rsp.GetMeta(); - for (int i = 0; i < meta.size(); ++i) + for (size_t i = 0; i < meta.size(); ++i) { LOG_MSG("[%d] CatalogName: %s\n", i, meta[i].GetCatalogName().c_str()); LOG_MSG("[%d] SchemaName: %s\n", i, meta[i].GetSchemaName().c_str()); http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/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 506afcd..e31d75a 100644 --- a/modules/platforms/cpp/odbc/odbc-driver/src/statement.cpp +++ b/modules/platforms/cpp/odbc/odbc-driver/src/statement.cpp @@ -393,7 +393,7 @@ namespace ignite } void Statement::GetColumnAttribute(uint16_t colIdx, uint16_t attrId, - char* strbuf, int16_t buflen, int16_t* reslen, int64_t* numbuf) + char* strbuf, int16_t buflen, int16_t* reslen, SqlLen* numbuf) { IGNITE_ODBC_API_CALL(InternalGetColumnAttribute(colIdx, attrId, strbuf, buflen, reslen, numbuf)); @@ -401,7 +401,7 @@ namespace ignite SqlResult Statement::InternalGetColumnAttribute(uint16_t colIdx, uint16_t attrId, char* strbuf, int16_t buflen, int16_t* reslen, - int64_t* numbuf) + SqlLen* numbuf) { const meta::ColumnMetaVector *meta = GetMeta(); http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-test/src/application_data_buffer_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/src/application_data_buffer_test.cpp b/modules/platforms/cpp/odbc/odbc-test/src/application_data_buffer_test.cpp index 8194dad..632f05f 100644 --- a/modules/platforms/cpp/odbc/odbc-test/src/application_data_buffer_test.cpp +++ b/modules/platforms/cpp/odbc/odbc-test/src/application_data_buffer_test.cpp @@ -28,6 +28,7 @@ #define FLOAT_PRECISION 0.0000001f using namespace ignite; +using namespace ignite::odbc; using namespace ignite::odbc::app; using namespace ignite::odbc::type_traits; @@ -36,7 +37,7 @@ BOOST_AUTO_TEST_SUITE(ApplicationDataBufferTestSuite) BOOST_AUTO_TEST_CASE(TestPutIntToString) { char buffer[1024]; - int64_t reslen; + SqlLen reslen; size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); @@ -69,7 +70,7 @@ BOOST_AUTO_TEST_CASE(TestPutIntToString) BOOST_AUTO_TEST_CASE(TestPutFloatToString) { char buffer[1024]; - int64_t reslen; + SqlLen reslen; size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); @@ -94,7 +95,7 @@ BOOST_AUTO_TEST_CASE(TestPutFloatToString) BOOST_AUTO_TEST_CASE(TestPutGuidToString) { char buffer[1024]; - int64_t reslen; + SqlLen reslen; size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); @@ -110,7 +111,7 @@ BOOST_AUTO_TEST_CASE(TestPutGuidToString) BOOST_AUTO_TEST_CASE(TestPutBinaryToString) { char buffer[1024]; - int64_t reslen; + SqlLen reslen; size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); @@ -126,7 +127,7 @@ BOOST_AUTO_TEST_CASE(TestPutBinaryToString) BOOST_AUTO_TEST_CASE(TestPutStringToString) { char buffer[1024]; - int64_t reslen; + SqlLen reslen; size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); @@ -142,7 +143,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToString) BOOST_AUTO_TEST_CASE(TestPutStringToWstring) { wchar_t buffer[1024]; - int64_t reslen; + SqlLen reslen; size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_WCHAR, buffer, sizeof(buffer), &reslen, &offset); @@ -156,7 +157,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToWstring) BOOST_AUTO_TEST_CASE(TestPutStringToLong) { long numBuf; - int64_t reslen; + SqlLen reslen; size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, &offset); @@ -171,7 +172,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToLong) BOOST_AUTO_TEST_CASE(TestPutStringToTiny) { int8_t numBuf; - int64_t reslen; + SqlLen reslen; size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_TINYINT, &numBuf, sizeof(numBuf), &reslen, &offset); @@ -186,7 +187,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToTiny) BOOST_AUTO_TEST_CASE(TestPutStringToFloat) { float numBuf; - int64_t reslen; + SqlLen reslen; size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset); @@ -201,7 +202,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToFloat) BOOST_AUTO_TEST_CASE(TestPutIntToFloat) { float numBuf; - int64_t reslen; + SqlLen reslen; size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset); @@ -228,7 +229,7 @@ BOOST_AUTO_TEST_CASE(TestPutIntToFloat) BOOST_AUTO_TEST_CASE(TestPutFloatToShort) { short numBuf; - int64_t reslen; + SqlLen reslen; size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_SHORT, &numBuf, sizeof(numBuf), &reslen, &offset); @@ -249,7 +250,7 @@ BOOST_AUTO_TEST_CASE(TestPutFloatToShort) BOOST_AUTO_TEST_CASE(TestPutDecimalToDouble) { double numBuf; - int64_t reslen; + SqlLen reslen; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &numBuf, sizeof(numBuf), &reslen, 0); @@ -278,7 +279,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToDouble) BOOST_AUTO_TEST_CASE(TestPutDecimalToLong) { long numBuf; - int64_t reslen; + SqlLen reslen; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, 0); @@ -305,7 +306,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToLong) BOOST_AUTO_TEST_CASE(TestPutDecimalToString) { char strBuf[64]; - int64_t reslen; + SqlLen reslen; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); @@ -332,7 +333,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToString) BOOST_AUTO_TEST_CASE(TestGetStringFromLong) { long numBuf = 42; - int64_t reslen = sizeof(numBuf); + SqlLen reslen = sizeof(numBuf); size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, reslen, &reslen, &offset); @@ -351,7 +352,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromLong) BOOST_AUTO_TEST_CASE(TestGetStringFromDouble) { double numBuf = 43.36; - int64_t reslen = sizeof(numBuf); + SqlLen reslen = sizeof(numBuf); size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &numBuf, reslen, &reslen, &offset); @@ -370,7 +371,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromDouble) BOOST_AUTO_TEST_CASE(TestGetStringFromString) { char buf[] = "Some data 32d2d5hs"; - int64_t reslen = sizeof(buf); + SqlLen reslen = sizeof(buf); size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset); @@ -383,7 +384,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromString) BOOST_AUTO_TEST_CASE(TestGetFloatFromUshort) { unsigned short numBuf = 7162; - int64_t reslen = sizeof(numBuf); + SqlLen reslen = sizeof(numBuf); size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT, &numBuf, reslen, &reslen, &offset); @@ -400,7 +401,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromUshort) BOOST_AUTO_TEST_CASE(TestGetFloatFromString) { char buf[] = "28.562"; - int64_t reslen = sizeof(buf); + SqlLen reslen = sizeof(buf); size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset); @@ -417,7 +418,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromString) BOOST_AUTO_TEST_CASE(TestGetFloatFromFloat) { float buf = 207.49f; - int64_t reslen = sizeof(buf); + SqlLen reslen = sizeof(buf); size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &buf, reslen, &reslen, &offset); @@ -434,7 +435,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromFloat) BOOST_AUTO_TEST_CASE(TestGetFloatFromDouble) { double buf = 893.162; - int64_t reslen = sizeof(buf); + SqlLen reslen = sizeof(buf); size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &buf, reslen, &reslen, &offset); @@ -451,7 +452,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromDouble) BOOST_AUTO_TEST_CASE(TestGetIntFromString) { char buf[] = "39"; - int64_t reslen = sizeof(buf); + SqlLen reslen = sizeof(buf); size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset); @@ -476,7 +477,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromString) BOOST_AUTO_TEST_CASE(TestGetIntFromFloat) { float buf = -107.49f; - int64_t reslen = sizeof(buf); + SqlLen reslen = sizeof(buf); size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &buf, reslen, &reslen, &offset); @@ -501,7 +502,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromFloat) BOOST_AUTO_TEST_CASE(TestGetIntFromDouble) { double buf = 42.97f; - int64_t reslen = sizeof(buf); + SqlLen reslen = sizeof(buf); size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &buf, reslen, &reslen, &offset); @@ -526,7 +527,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromDouble) BOOST_AUTO_TEST_CASE(TestGetIntFromBigint) { uint64_t buf = 19; - int64_t reslen = sizeof(buf); + SqlLen reslen = sizeof(buf); size_t* offset = 0; ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT, &buf, reslen, &reslen, &offset); @@ -553,7 +554,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntWithOffset) struct TestStruct { uint64_t val; - int64_t reslen; + SqlLen reslen; }; TestStruct buf[2] = { @@ -588,7 +589,7 @@ BOOST_AUTO_TEST_CASE(TestSetStringWithOffset) struct TestStruct { char val[64]; - int64_t reslen; + SqlLen reslen; }; TestStruct buf[2] = { http://git-wip-us.apache.org/repos/asf/ignite/blob/b0b2c907/modules/platforms/cpp/odbc/odbc-test/src/row_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/src/row_test.cpp b/modules/platforms/cpp/odbc/odbc-test/src/row_test.cpp index 031a8c6..a0eed39 100644 --- a/modules/platforms/cpp/odbc/odbc-test/src/row_test.cpp +++ b/modules/platforms/cpp/odbc/odbc-test/src/row_test.cpp @@ -75,7 +75,7 @@ void FillMemWithData(ignite::impl::interop::InteropUnpooledMemory& mem, size_t r void CheckRowData(Row& row, size_t rowIdx) { - int64_t reslen; + SqlLen reslen; long longBuf; char strBuf[1024]; @@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE(TestRowSkip) { BOOST_REQUIRE(row.GetSize() == 4); - for (size_t j = 0; j < row.GetSize(); ++j) + for (int32_t j = 0; j < row.GetSize(); ++j) BOOST_REQUIRE(row.SkipColumn()); BOOST_REQUIRE(row.MoveToNext());
