You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2016/09/26 17:23:01 UTC
[1/5] ignite git commit: IGNITE-3883: ODBC: Implemented
data-at-execution dialog. This closes #1073.
Repository: ignite
Updated Branches:
refs/heads/master d9c70a01b -> 62c07972d
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/src/odbc.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/odbc.cpp b/modules/platforms/cpp/odbc/src/odbc.cpp
index 74d0f9d..9df64d3 100644
--- a/modules/platforms/cpp/odbc/src/odbc.cpp
+++ b/modules/platforms/cpp/odbc/src/odbc.cpp
@@ -326,6 +326,8 @@ namespace ignite
std::string dsn = SqlStringToString(serverName, serverNameLen);
+ LOG_MSG("DSN: %s\n", dsn.c_str());
+
odbc::ReadDsnConfiguration(dsn.c_str(), config);
connection->Establish(config);
@@ -621,7 +623,7 @@ namespace ignite
using odbc::app::Parameter;
using odbc::type_traits::IsSqlTypeSupported;
- LOG_MSG("SQLBindParameter called\n");
+ LOG_MSG("SQLBindParameter called: %d, %d, %d\n", paramIdx, bufferType, paramSqlType);
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -631,9 +633,6 @@ namespace ignite
if (ioType != SQL_PARAM_INPUT)
return SQL_ERROR;
- if (resLen && (*resLen == SQL_DATA_AT_EXEC || *resLen <= SQL_LEN_DATA_AT_EXEC_OFFSET))
- return SQL_ERROR;
-
if (!IsSqlTypeSupported(paramSqlType))
return SQL_ERROR;
@@ -976,14 +975,14 @@ namespace ignite
case SQL_ATTR_PARAM_BIND_OFFSET_PTR:
{
- statement->SetParamBindOffsetPtr(reinterpret_cast<size_t*>(value));
+ statement->SetParamBindOffsetPtr(reinterpret_cast<int*>(value));
break;
}
case SQL_ATTR_ROW_BIND_OFFSET_PTR:
{
- statement->SetColumnBindOffsetPtr(reinterpret_cast<size_t*>(value));
+ statement->SetColumnBindOffsetPtr(reinterpret_cast<int*>(value));
break;
}
@@ -1334,4 +1333,36 @@ namespace ignite
return statement->GetDiagnosticRecords().GetReturnCode();
}
+ SQLRETURN SQLParamData(SQLHSTMT stmt, SQLPOINTER* value)
+ {
+ using namespace ignite::odbc;
+
+ LOG_MSG("SQLParamData called\n");
+
+ Statement *statement = reinterpret_cast<Statement*>(stmt);
+
+ if (!statement)
+ return SQL_INVALID_HANDLE;
+
+ statement->SelectParam(value);
+
+ return statement->GetDiagnosticRecords().GetReturnCode();
+ }
+
+ SQLRETURN SQLPutData(SQLHSTMT stmt, SQLPOINTER data, SQLLEN strLengthOrIndicator)
+ {
+ using namespace ignite::odbc;
+
+ LOG_MSG("SQLPutData called\n");
+
+ Statement *statement = reinterpret_cast<Statement*>(stmt);
+
+ if (!statement)
+ return SQL_INVALID_HANDLE;
+
+ statement->PutData(data, strLengthOrIndicator);
+
+ return statement->GetDiagnosticRecords().GetReturnCode();
+ }
+
} // namespace ignite;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/src/statement.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/statement.cpp b/modules/platforms/cpp/odbc/src/statement.cpp
index 8aae156..32f7c3f 100644
--- a/modules/platforms/cpp/odbc/src/statement.cpp
+++ b/modules/platforms/cpp/odbc/src/statement.cpp
@@ -33,8 +33,14 @@ namespace ignite
namespace odbc
{
Statement::Statement(Connection& parent) :
- connection(parent), columnBindings(), currentQuery(),
- rowsFetched(0), rowStatuses(0), paramBindOffset(0), columnBindOffset(0)
+ connection(parent),
+ columnBindings(),
+ currentQuery(),
+ rowsFetched(0),
+ rowStatuses(0),
+ paramBindOffset(0),
+ columnBindOffset(0),
+ currentParamIdx(0)
{
// No-op.
}
@@ -67,12 +73,12 @@ namespace ignite
columnBindings.clear();
}
- void Statement::SetColumnBindOffsetPtr(size_t * ptr)
+ void Statement::SetColumnBindOffsetPtr(int * ptr)
{
columnBindOffset = ptr;
}
- size_t * Statement::GetColumnBindOffsetPtr()
+ int* Statement::GetColumnBindOffsetPtr()
{
return columnBindOffset;
}
@@ -104,11 +110,25 @@ namespace ignite
void Statement::BindParameter(uint16_t paramIdx, const app::Parameter& param)
{
- IGNITE_ODBC_API_CALL_ALWAYS_SUCCESS;
+ IGNITE_ODBC_API_CALL(InternalBindParameter(paramIdx, param));
+ }
+
+
+ SqlResult Statement::InternalBindParameter(uint16_t paramIdx, const app::Parameter& param)
+ {
+ if (paramIdx == 0)
+ {
+ AddStatusRecord(SQL_STATE_24000_INVALID_CURSOR_STATE,
+ "The value specified for the argument ParameterNumber was less than 1.");
+
+ return SQL_RESULT_ERROR;
+ }
paramBindings[paramIdx] = param;
paramBindings[paramIdx].GetBuffer().SetPtrToOffsetPtr(¶mBindOffset);
+
+ return SQL_RESULT_SUCCESS;
}
void Statement::UnbindParameter(uint16_t paramIdx)
@@ -132,14 +152,14 @@ namespace ignite
return static_cast<uint16_t>(paramBindings.size());
}
- void Statement::SetParamBindOffsetPtr(size_t* ptr)
+ void Statement::SetParamBindOffsetPtr(int* ptr)
{
IGNITE_ODBC_API_CALL_ALWAYS_SUCCESS;
paramBindOffset = ptr;
}
- size_t * Statement::GetParamBindOffsetPtr()
+ int* Statement::GetParamBindOffsetPtr()
{
return paramBindOffset;
}
@@ -219,6 +239,21 @@ namespace ignite
return SQL_RESULT_ERROR;
}
+ bool paramDataReady = true;
+
+ app::ParameterBindingMap::iterator it;
+ for (it = paramBindings.begin(); it != paramBindings.end(); ++it)
+ {
+ app::Parameter& param = it->second;
+
+ param.ResetStoredData();
+
+ paramDataReady &= param.IsDataReady();
+ }
+
+ if (!paramDataReady)
+ return SQL_RESULT_NEED_DATA;
+
return currentQuery->Execute();
}
@@ -519,6 +554,107 @@ namespace ignite
{
return rowStatuses;
}
+
+ void Statement::SelectParam(void** paramPtr)
+ {
+ IGNITE_ODBC_API_CALL(InternalSelectParam(paramPtr));
+ }
+
+ SqlResult Statement::InternalSelectParam(void** paramPtr)
+ {
+ if (!paramPtr)
+ {
+ AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, "Invalid parameter: ValuePtrPtr is null.");
+
+ return SQL_RESULT_ERROR;
+ }
+
+ if (!currentQuery.get())
+ {
+ AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query is not prepared.");
+
+ return SQL_RESULT_ERROR;
+ }
+
+ app::ParameterBindingMap::iterator it;
+
+ if (currentParamIdx)
+ {
+ it = paramBindings.find(currentParamIdx);
+
+ if (it != paramBindings.end() && !it->second.IsDataReady())
+ {
+ AddStatusRecord(SQL_STATE_22026_DATA_LENGTH_MISMATCH,
+ "Less data was sent for a parameter than was specified with "
+ "the StrLen_or_IndPtr argument in SQLBindParameter.");
+
+ return SQL_RESULT_ERROR;
+ }
+ }
+
+ for (it = paramBindings.begin(); it != paramBindings.end(); ++it)
+ {
+ uint16_t paramIdx = it->first;
+ app::Parameter& param = it->second;
+
+ if (!param.IsDataReady())
+ {
+ *paramPtr = param.GetBuffer().GetData();
+
+ currentParamIdx = paramIdx;
+
+ return SQL_RESULT_NEED_DATA;
+ }
+ }
+
+ SqlResult res = currentQuery->Execute();
+
+ if (res != SQL_RESULT_SUCCESS)
+ res = SQL_RESULT_SUCCESS_WITH_INFO;
+
+ return res;
+ }
+
+ void Statement::PutData(void* data, SqlLen len)
+ {
+ IGNITE_ODBC_API_CALL(InternalPutData(data, len));
+ }
+
+ SqlResult Statement::InternalPutData(void* data, SqlLen len)
+ {
+ if (!data && len != 0 && len != SQL_DEFAULT_PARAM && len != SQL_NULL_DATA)
+ {
+ AddStatusRecord(SQL_STATE_HY009_INVALID_USE_OF_NULL_POINTER,
+ "Invalid parameter: DataPtr is null StrLen_or_Ind is not 0, "
+ "SQL_DEFAULT_PARAM, or SQL_NULL_DATA.");
+
+ return SQL_RESULT_ERROR;
+ }
+
+ if (currentParamIdx == 0)
+ {
+ AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR,
+ "Parameter is not selected with the SQLParamData.");
+
+ return SQL_RESULT_ERROR;
+ }
+
+ app::ParameterBindingMap::iterator it = paramBindings.find(currentParamIdx);
+
+ if (it == paramBindings.end())
+ {
+ AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR,
+ "Selected parameter has been unbound.");
+
+ return SQL_RESULT_ERROR;
+ }
+
+ app::Parameter& param = it->second;
+
+ param.PutData(data, len);
+
+ return SQL_RESULT_SUCCESS;
+ }
}
}
[3/5] ignite git commit: IGNITE-3956 .NET: Fix cache creation in
LINQPad examples This closes #1116
Posted by pt...@apache.org.
IGNITE-3956 .NET: Fix cache creation in LINQPad examples
This closes #1116
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/350e8465
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/350e8465
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/350e8465
Branch: refs/heads/master
Commit: 350e84656686eb81f8e12d569783db9914ca5a37
Parents: a4a933e
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 26 19:55:27 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 26 19:55:27 2016 +0300
----------------------------------------------------------------------
.../dotnet/Apache.Ignite.Core/NuGet/LINQPad/PutGetExample.linq | 2 +-
.../dotnet/Apache.Ignite.Core/NuGet/LINQPad/QueryExample.linq | 6 +++---
.../dotnet/Apache.Ignite.Linq/NuGet/LINQPad/QueryExample.linq | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/350e8465/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/PutGetExample.linq
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/PutGetExample.linq b/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/PutGetExample.linq
index 97d9bbe..7c77d09 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/PutGetExample.linq
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/PutGetExample.linq
@@ -42,7 +42,7 @@ void Main()
using (var ignite = Ignition.Start(cfg))
{
// Create new cache
- var cache = ignite.CreateCache<int, Organization>("orgs");
+ var cache = ignite.GetOrCreateCache<int, Organization>("orgs");
// Put data entry to cache
cache.Put(1, new Organization {Name = "Apache", Type="Private"});
http://git-wip-us.apache.org/repos/asf/ignite/blob/350e8465/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/QueryExample.linq
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/QueryExample.linq b/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/QueryExample.linq
index b7f7981..2a2454e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/QueryExample.linq
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/QueryExample.linq
@@ -45,14 +45,14 @@ void Main()
using (var ignite = Ignition.Start(cfg))
{
// Create and populate organization cache
- var orgs = ignite.GetOrCreateCache<int, Organization>(new CacheConfiguration("orgs",
+ var orgs = ignite.GetOrCreateCache<int, Organization>(new CacheConfiguration("orgs-sql",
new QueryEntity(typeof(int), typeof(Organization))));
orgs[1] = new Organization { Name = "Apache", Type = "Private", Size = 5300 };
orgs[2] = new Organization { Name = "Microsoft", Type = "Private", Size = 110000 };
orgs[3] = new Organization { Name = "Red Cross", Type = "Non-Profit", Size = 35000 };
// Create and populate person cache
- var persons = ignite.CreateCache<int, Person>(new CacheConfiguration("persons", typeof(Person)));
+ var persons = ignite.GetOrCreateCache<int, Person>(new CacheConfiguration("persons-sql", typeof(Person)));
persons[1] = new Person { OrgId = 1, Name = "James Wilson" };
persons[2] = new Person { OrgId = 1, Name = "Daniel Adams" };
persons[3] = new Person { OrgId = 2, Name = "Christian Moss" };
@@ -64,7 +64,7 @@ void Main()
// SQL query with join
const string orgName = "Apache";
- persons.Query(new SqlQuery(typeof(Person), "from Person, \"orgs\".Organization where Person.OrgId = \"orgs\".Organization._key and \"orgs\".Organization.Name = ?", orgName))
+ persons.Query(new SqlQuery(typeof(Person), "from Person, \"orgs-sql\".Organization where Person.OrgId = \"orgs-sql\".Organization._key and \"orgs-sql\".Organization.Name = ?", orgName))
.Dump("Persons working for " + orgName);
// Fields query
http://git-wip-us.apache.org/repos/asf/ignite/blob/350e8465/modules/platforms/dotnet/Apache.Ignite.Linq/NuGet/LINQPad/QueryExample.linq
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/NuGet/LINQPad/QueryExample.linq b/modules/platforms/dotnet/Apache.Ignite.Linq/NuGet/LINQPad/QueryExample.linq
index 9cce4ec..6a28f1f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/NuGet/LINQPad/QueryExample.linq
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/NuGet/LINQPad/QueryExample.linq
@@ -46,14 +46,14 @@ void Main()
using (var ignite = Ignition.Start(cfg))
{
// Create and populate organization cache
- var orgs = ignite.GetOrCreateCache<int, Organization>(new CacheConfiguration("orgs",
+ var orgs = ignite.GetOrCreateCache<int, Organization>(new CacheConfiguration("orgs-linq",
new QueryEntity(typeof(int), typeof(Organization))));
orgs[1] = new Organization { Name = "Apache", Type = "Private", Size = 5300 };
orgs[2] = new Organization { Name = "Microsoft", Type = "Private", Size = 110000 };
orgs[3] = new Organization { Name = "Red Cross", Type = "Non-Profit", Size = 35000 };
// Create and populate person cache
- var persons = ignite.CreateCache<int, Person>(new CacheConfiguration("persons", typeof(Person)));
+ var persons = ignite.GetOrCreateCache<int, Person>(new CacheConfiguration("persons-linq", typeof(Person)));
persons[1] = new Person { OrgId = 1, Name = "James Wilson" };
persons[2] = new Person { OrgId = 1, Name = "Daniel Adams" };
persons[3] = new Person { OrgId = 2, Name = "Christian Moss" };
[2/5] ignite git commit: IGNITE-3883: ODBC: Implemented
data-at-execution dialog. This closes #1073.
Posted by pt...@apache.org.
IGNITE-3883: ODBC: Implemented data-at-execution dialog. This closes #1073.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a4a933eb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a4a933eb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a4a933eb
Branch: refs/heads/master
Commit: a4a933eb708dadb6b67f6c062db32ffeef819184
Parents: 33a6878
Author: Igor Sapego <is...@gridgain.com>
Authored: Mon Sep 26 17:41:57 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 26 17:41:57 2016 +0300
----------------------------------------------------------------------
.../src/application_data_buffer_test.cpp | 129 ++++---
.../platforms/cpp/odbc-test/src/column_test.cpp | 10 +-
.../cpp/odbc-test/src/queries_test.cpp | 144 +++++++-
.../platforms/cpp/odbc-test/src/row_test.cpp | 4 +-
modules/platforms/cpp/odbc/Makefile.am | 3 +-
.../platforms/cpp/odbc/include/ignite/odbc.h | 5 +-
.../ignite/odbc/app/application_data_buffer.h | 58 +++-
.../odbc/include/ignite/odbc/app/parameter.h | 27 +-
.../cpp/odbc/include/ignite/odbc/common_types.h | 18 +-
.../include/ignite/odbc/config/configuration.h | 17 +-
.../cpp/odbc/include/ignite/odbc/statement.h | 58 +++-
.../platforms/cpp/odbc/project/vs/module.def | 1 -
.../odbc/src/app/application_data_buffer.cpp | 343 ++++++++++++++-----
.../platforms/cpp/odbc/src/app/parameter.cpp | 126 ++++++-
modules/platforms/cpp/odbc/src/common_types.cpp | 3 +
.../cpp/odbc/src/config/configuration.cpp | 27 ++
.../cpp/odbc/src/config/connection_info.cpp | 35 +-
modules/platforms/cpp/odbc/src/connection.cpp | 2 +-
.../odbc/src/diagnostic/diagnostic_record.cpp | 18 +
modules/platforms/cpp/odbc/src/entry_points.cpp | 30 +-
modules/platforms/cpp/odbc/src/odbc.cpp | 43 ++-
modules/platforms/cpp/odbc/src/statement.cpp | 150 +++++++-
22 files changed, 992 insertions(+), 259 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp b/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp
index 1900e75..f62bcd6 100644
--- a/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp
@@ -43,8 +43,8 @@ BOOST_AUTO_TEST_SUITE(ApplicationDataBufferTestSuite)
BOOST_AUTO_TEST_CASE(TestPutIntToString)
{
char buffer[1024];
- SqlLen reslen;
- size_t* offset = 0;
+ SqlLen reslen = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset);
@@ -76,8 +76,8 @@ BOOST_AUTO_TEST_CASE(TestPutIntToString)
BOOST_AUTO_TEST_CASE(TestPutFloatToString)
{
char buffer[1024];
- SqlLen reslen;
- size_t* offset = 0;
+ SqlLen reslen = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset);
@@ -101,8 +101,8 @@ BOOST_AUTO_TEST_CASE(TestPutFloatToString)
BOOST_AUTO_TEST_CASE(TestPutGuidToString)
{
char buffer[1024];
- SqlLen reslen;
- size_t* offset = 0;
+ SqlLen reslen = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset);
@@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE(TestPutGuidToString)
BOOST_AUTO_TEST_CASE(TestGetGuidFromString)
{
char buffer[] = "1da1ef8f-39ff-4d62-8b72-e8e9f3371801";
- SqlLen reslen;
+ SqlLen reslen = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer) - 1, &reslen, 0);
@@ -129,8 +129,8 @@ BOOST_AUTO_TEST_CASE(TestGetGuidFromString)
BOOST_AUTO_TEST_CASE(TestPutBinaryToString)
{
char buffer[1024];
- SqlLen reslen;
- size_t* offset = 0;
+ SqlLen reslen = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset);
@@ -145,8 +145,8 @@ BOOST_AUTO_TEST_CASE(TestPutBinaryToString)
BOOST_AUTO_TEST_CASE(TestPutStringToString)
{
char buffer[1024];
- SqlLen reslen;
- size_t* offset = 0;
+ SqlLen reslen = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset);
@@ -161,8 +161,8 @@ BOOST_AUTO_TEST_CASE(TestPutStringToString)
BOOST_AUTO_TEST_CASE(TestPutStringToWstring)
{
wchar_t buffer[1024];
- SqlLen reslen;
- size_t* offset = 0;
+ SqlLen reslen = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_WCHAR, buffer, sizeof(buffer), &reslen, &offset);
@@ -175,8 +175,8 @@ BOOST_AUTO_TEST_CASE(TestPutStringToWstring)
BOOST_AUTO_TEST_CASE(TestPutStringToLong)
{
long numBuf;
- SqlLen reslen;
- size_t* offset = 0;
+ SqlLen reslen = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, &offset);
@@ -190,8 +190,8 @@ BOOST_AUTO_TEST_CASE(TestPutStringToLong)
BOOST_AUTO_TEST_CASE(TestPutStringToTiny)
{
int8_t numBuf;
- SqlLen reslen;
- size_t* offset = 0;
+ SqlLen reslen = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_TINYINT, &numBuf, sizeof(numBuf), &reslen, &offset);
@@ -205,8 +205,8 @@ BOOST_AUTO_TEST_CASE(TestPutStringToTiny)
BOOST_AUTO_TEST_CASE(TestPutStringToFloat)
{
float numBuf;
- SqlLen reslen;
- size_t* offset = 0;
+ SqlLen reslen = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset);
@@ -220,8 +220,8 @@ BOOST_AUTO_TEST_CASE(TestPutStringToFloat)
BOOST_AUTO_TEST_CASE(TestPutIntToFloat)
{
float numBuf;
- SqlLen reslen;
- size_t* offset = 0;
+ SqlLen reslen = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset);
@@ -247,8 +247,8 @@ BOOST_AUTO_TEST_CASE(TestPutIntToFloat)
BOOST_AUTO_TEST_CASE(TestPutFloatToShort)
{
short numBuf;
- SqlLen reslen;
- size_t* offset = 0;
+ SqlLen reslen = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_SHORT, &numBuf, sizeof(numBuf), &reslen, &offset);
@@ -268,7 +268,7 @@ BOOST_AUTO_TEST_CASE(TestPutFloatToShort)
BOOST_AUTO_TEST_CASE(TestPutDecimalToDouble)
{
double numBuf;
- SqlLen reslen;
+ SqlLen reslen = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &numBuf, sizeof(numBuf), &reslen, 0);
@@ -297,7 +297,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToDouble)
BOOST_AUTO_TEST_CASE(TestPutDecimalToLong)
{
long numBuf;
- SqlLen reslen;
+ SqlLen reslen = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, 0);
@@ -324,7 +324,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToLong)
BOOST_AUTO_TEST_CASE(TestPutDecimalToString)
{
char strBuf[64];
- SqlLen reslen;
+ SqlLen reslen = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0);
@@ -351,7 +351,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToString)
BOOST_AUTO_TEST_CASE(TestPutDecimalToNumeric)
{
SQL_NUMERIC_STRUCT buf;
- SqlLen reslen;
+ SqlLen reslen = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_NUMERIC, &buf, sizeof(buf), &reslen, 0);
@@ -432,8 +432,8 @@ BOOST_AUTO_TEST_CASE(TestPutDateToDate)
SQL_DATE_STRUCT buf = { 0 };
SqlLen reslen = sizeof(buf);
- size_t offset = 0;
- size_t* offsetPtr = &offset;
+ int offset = 0;
+ int* offsetPtr = &offset;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr);
@@ -451,8 +451,8 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToDate)
SQL_DATE_STRUCT buf = { 0 };
SqlLen reslen = sizeof(buf);
- size_t offset = 0;
- size_t* offsetPtr = &offset;
+ int offset = 0;
+ int* offsetPtr = &offset;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr);
@@ -470,8 +470,8 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToTimestamp)
SQL_TIMESTAMP_STRUCT buf = { 0 };
SqlLen reslen = sizeof(buf);
- size_t offset = 0;
- size_t* offsetPtr = &offset;
+ int offset = 0;
+ int* offsetPtr = &offset;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr);
@@ -494,8 +494,8 @@ BOOST_AUTO_TEST_CASE(TestPutDateToTimestamp)
SqlLen reslen = sizeof(buf);
- size_t offset = 0;
- size_t* offsetPtr = &offset;
+ int offset = 0;
+ int* offsetPtr = &offset;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr);
@@ -516,7 +516,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromLong)
{
long numBuf = 42;
SqlLen reslen = sizeof(numBuf);
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, reslen, &reslen, &offset);
@@ -535,7 +535,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromDouble)
{
double numBuf = 43.36;
SqlLen reslen = sizeof(numBuf);
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &numBuf, reslen, &reslen, &offset);
@@ -554,7 +554,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromString)
{
char buf[] = "Some data 32d2d5hs";
SqlLen reslen = sizeof(buf);
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset);
@@ -567,7 +567,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromUshort)
{
unsigned short numBuf = 7162;
SqlLen reslen = sizeof(numBuf);
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT, &numBuf, reslen, &reslen, &offset);
@@ -584,7 +584,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromString)
{
char buf[] = "28.562";
SqlLen reslen = sizeof(buf);
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset);
@@ -601,7 +601,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromFloat)
{
float buf = 207.49f;
SqlLen reslen = sizeof(buf);
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &buf, reslen, &reslen, &offset);
@@ -618,7 +618,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromDouble)
{
double buf = 893.162;
SqlLen reslen = sizeof(buf);
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &buf, reslen, &reslen, &offset);
@@ -635,7 +635,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromString)
{
char buf[] = "39";
SqlLen reslen = sizeof(buf);
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset);
@@ -660,7 +660,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromFloat)
{
float buf = -107.49f;
SqlLen reslen = sizeof(buf);
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &buf, reslen, &reslen, &offset);
@@ -685,7 +685,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromDouble)
{
double buf = 42.97f;
SqlLen reslen = sizeof(buf);
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &buf, reslen, &reslen, &offset);
@@ -710,7 +710,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromBigint)
{
uint64_t buf = 19;
SqlLen reslen = sizeof(buf);
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT, &buf, reslen, &reslen, &offset);
@@ -744,8 +744,8 @@ BOOST_AUTO_TEST_CASE(TestGetIntWithOffset)
{ 42, sizeof(uint64_t) }
};
- size_t offset = 0;
- size_t* offsetPtr = &offset;
+ int offset = 0;
+ int* offsetPtr = &offset;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT, &buf[0].val, sizeof(buf[0].val), &buf[0].reslen, &offsetPtr);
@@ -779,8 +779,8 @@ BOOST_AUTO_TEST_CASE(TestSetStringWithOffset)
{ "", 0 }
};
- size_t offset = 0;
- size_t* offsetPtr = &offset;
+ int offset = 0;
+ int* offsetPtr = &offset;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf[0].val, sizeof(buf[0].val), &buf[0].reslen, &offsetPtr);
@@ -814,8 +814,8 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromString)
char buf[] = "1999-02-22";
SqlLen reslen = sizeof(buf);
- size_t offset = 0;
- size_t* offsetPtr = &offset;
+ int offset = 0;
+ int* offsetPtr = &offset;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr);
@@ -837,16 +837,11 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromString)
BOOST_AUTO_TEST_CASE(TestGetTimestampFromString)
{
- LOG_MSG("Test\n");
- LOG_MSG("Test\n");
- LOG_MSG("Test\n");
- LOG_MSG("Test\n");
-
char buf[] = "2018-11-01 17:45:59";
SqlLen reslen = sizeof(buf);
- size_t offset = 0;
- size_t* offsetPtr = &offset;
+ int offset = 0;
+ int* offsetPtr = &offset;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr);
@@ -876,8 +871,8 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromDate)
SqlLen reslen = sizeof(buf);
- size_t offset = 0;
- size_t* offsetPtr = &offset;
+ int offset = 0;
+ int* offsetPtr = &offset;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr);
@@ -907,8 +902,8 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromDate)
SqlLen reslen = sizeof(buf);
- size_t offset = 0;
- size_t* offsetPtr = &offset;
+ int offset = 0;
+ int* offsetPtr = &offset;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr);
@@ -942,8 +937,8 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromTimestamp)
SqlLen reslen = sizeof(buf);
- size_t offset = 0;
- size_t* offsetPtr = &offset;
+ int offset = 0;
+ int* offsetPtr = &offset;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr);
@@ -978,8 +973,8 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromTimestamp)
SqlLen reslen = sizeof(buf);
- size_t offset = 0;
- size_t* offsetPtr = &offset;
+ int offset = 0;
+ int* offsetPtr = &offset;
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc-test/src/column_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/column_test.cpp b/modules/platforms/cpp/odbc-test/src/column_test.cpp
index 4864a6a..6cbea8b 100644
--- a/modules/platforms/cpp/odbc-test/src/column_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/column_test.cpp
@@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE(TestColumnShort)
short shortBuf = 0;
SqlLen reslen = 0;
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_SIGNED_SHORT, &shortBuf, sizeof(shortBuf), &reslen, &offset);
@@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE(TestColumnString)
char strBuf[1024] = {};
SqlLen reslen = 0;
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, &offset);
@@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE(TestColumnStringSeveral)
std::string strBuf(data.size() / 3 + 2, 0);
SqlLen reslen = 0;
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_CHAR, &strBuf[0], strBuf.size(), &reslen, &offset);
@@ -246,7 +246,7 @@ BOOST_AUTO_TEST_CASE(TestColumnMultiString)
char strBuf[1024] = {};
SqlLen reslen = 0;
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, &offset);
@@ -287,4 +287,4 @@ BOOST_AUTO_TEST_CASE(TestColumnMultiString)
BOOST_REQUIRE(column2.GetUnreadDataLength() == 0);
}
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
+BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
index 7c10527..f0168bd 100644
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@ -174,8 +174,11 @@ struct QueriesTestSuiteFixture
SQLRETURN ret;
- TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5), BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
- TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), BinaryUtils::MakeDateGmt(1976, 1, 12), BinaryUtils::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 456));
+ TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
+ BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+
+ TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), BinaryUtils::MakeDateGmt(1976, 1, 12),
+ BinaryUtils::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 456));
testCache.Put(1, in1);
testCache.Put(2, in2);
@@ -335,8 +338,11 @@ BOOST_AUTO_TEST_CASE(TestTwoRowsString)
SQLRETURN ret;
- TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5), BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
- TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), BinaryUtils::MakeDateGmt(1976, 1, 12), BinaryUtils::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 999999999));
+ TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
+ BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+
+ TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), BinaryUtils::MakeDateGmt(1976, 1, 12),
+ BinaryUtils::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 999999999));
testCache.Put(1, in1);
testCache.Put(2, in2);
@@ -430,7 +436,8 @@ BOOST_AUTO_TEST_CASE(TestOneRowString)
SQLRETURN ret;
- TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5), BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+ TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
+ BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
testCache.Put(1, in);
@@ -493,7 +500,8 @@ BOOST_AUTO_TEST_CASE(TestOneRowStringLen)
SQLRETURN ret;
- TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5), BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+ TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
+ BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
testCache.Put(1, in);
@@ -535,4 +543,128 @@ BOOST_AUTO_TEST_CASE(TestOneRowStringLen)
BOOST_CHECK(ret == SQL_NO_DATA);
}
+BOOST_AUTO_TEST_CASE(TestDataAtExecution)
+{
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache");
+
+ SQLRETURN ret;
+
+ TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
+ BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+
+ TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), BinaryUtils::MakeDateGmt(1976, 1, 12),
+ BinaryUtils::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 999999999));
+
+ testCache.Put(1, in1);
+ testCache.Put(2, in2);
+
+ const size_t columnsCnt = 11;
+
+ SQLLEN columnLens[columnsCnt] = { 0 };
+ SQLCHAR columns[columnsCnt][ODBC_BUFFER_SIZE] = { 0 };
+
+ // Binding columns.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ {
+ ret = SQLBindCol(stmt, i + 1, SQL_C_CHAR, &columns[i], ODBC_BUFFER_SIZE, &columnLens[i]);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ }
+
+ SQLCHAR request[] = "SELECT i8Field, i16Field, i32Field, i64Field, strField, "
+ "floatField, doubleField, boolField, guidField, dateField, timestampField FROM TestType "
+ "WHERE i32Field = ? AND strField = ?";
+
+ ret = SQLPrepare(stmt, request, SQL_NTS);
+
+ SQLLEN ind1 = 1;
+ SQLLEN ind2 = 2;
+
+ SQLLEN len1 = SQL_DATA_AT_EXEC;
+ SQLLEN len2 = SQL_LEN_DATA_AT_EXEC(static_cast<SQLLEN>(in1.strField.size()));
+
+ ret = SQLBindParam(stmt, 1, SQL_C_SLONG, SQL_INTEGER, 100, 100, &ind1, &len1);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindParam(stmt, 2, SQL_C_CHAR, SQL_VARCHAR, 100, 100, &ind2, &len2);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLExecute(stmt);
+
+ BOOST_REQUIRE_EQUAL(ret, SQL_NEED_DATA);
+
+ void* oind;
+
+ ret = SQLParamData(stmt, &oind);
+
+ BOOST_REQUIRE_EQUAL(ret, SQL_NEED_DATA);
+
+ if (oind == &ind1)
+ ret = SQLPutData(stmt, &in1.i32Field, 0);
+ else if (oind == &ind2)
+ ret = SQLPutData(stmt, (SQLPOINTER)in1.strField.c_str(), (SQLLEN)in1.strField.size());
+ else
+ BOOST_FAIL("Unknown indicator value");
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLParamData(stmt, &oind);
+
+ BOOST_REQUIRE_EQUAL(ret, SQL_NEED_DATA);
+
+ if (oind == &ind1)
+ ret = SQLPutData(stmt, &in1.i32Field, 0);
+ else if (oind == &ind2)
+ ret = SQLPutData(stmt, (SQLPOINTER)in1.strField.c_str(), (SQLLEN)in1.strField.size());
+ else
+ BOOST_FAIL("Unknown indicator value");
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLParamData(stmt, &oind);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLFetch(stmt);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[0])), "1");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[1])), "2");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[2])), "3");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[3])), "4");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[4])), "5");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[5])), "6");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[6])), "7");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[7])), "1");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[8])), "00000000-0000-0008-0000-000000000009");
+ // Such format is used because Date returned as Timestamp.
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[9])), "1987-06-05 00:00:00");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[10])), "1998-12-27 01:02:03");
+
+ BOOST_CHECK_EQUAL(columnLens[0], 1);
+ BOOST_CHECK_EQUAL(columnLens[1], 1);
+ BOOST_CHECK_EQUAL(columnLens[2], 1);
+ BOOST_CHECK_EQUAL(columnLens[3], 1);
+ BOOST_CHECK_EQUAL(columnLens[4], 1);
+ BOOST_CHECK_EQUAL(columnLens[5], 1);
+ BOOST_CHECK_EQUAL(columnLens[6], 1);
+ BOOST_CHECK_EQUAL(columnLens[7], 1);
+ BOOST_CHECK_EQUAL(columnLens[8], 36);
+ BOOST_CHECK_EQUAL(columnLens[9], 19);
+ BOOST_CHECK_EQUAL(columnLens[10], 19);
+
+ ret = SQLFetch(stmt);
+ BOOST_CHECK(ret == SQL_NO_DATA);
+}
+
+
BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc-test/src/row_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/row_test.cpp b/modules/platforms/cpp/odbc-test/src/row_test.cpp
index 1fcd43e..f38e9c5 100644
--- a/modules/platforms/cpp/odbc-test/src/row_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/row_test.cpp
@@ -82,7 +82,7 @@ void CheckRowData(Row& row, size_t rowIdx)
char strBuf[1024];
SQLGUID guidBuf;
char bitBuf;
- size_t* offset = 0;
+ int* offset = 0;
ApplicationDataBuffer appLongBuf(type_traits::IGNITE_ODBC_C_TYPE_SIGNED_LONG, &longBuf, sizeof(longBuf), &reslen, &offset);
ApplicationDataBuffer appStrBuf(type_traits::IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, &offset);
@@ -206,4 +206,4 @@ BOOST_AUTO_TEST_CASE(TestTwoRows)
CheckRowData(row, 1);
}
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
+BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/Makefile.am b/modules/platforms/cpp/odbc/Makefile.am
index 1781bc0..3c8b37a 100644
--- a/modules/platforms/cpp/odbc/Makefile.am
+++ b/modules/platforms/cpp/odbc/Makefile.am
@@ -34,7 +34,8 @@ AM_CXXFLAGS = \
-std=c++0x
libignite_odbc_la_LIBADD = \
- @top_srcdir@/binary/libignite-binary.la
+ @top_srcdir@/binary/libignite-binary.la \
+ -lodbcinst
libignite_odbc_la_LDFLAGS = \
-no-undefined \
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/include/ignite/odbc.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc.h b/modules/platforms/cpp/odbc/include/ignite/odbc.h
index 40158dd..ec0861c 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc.h
@@ -252,6 +252,9 @@ namespace ignite
SQLSMALLINT scope,
SQLSMALLINT nullable);
+ SQLRETURN SQLParamData(SQLHSTMT stmt, SQLPOINTER* value);
+
+ SQLRETURN SQLPutData(SQLHSTMT stmt, SQLPOINTER data, SQLLEN strLengthOrIndicator);
} // namespace ignite
-#endif //_IGNITE_ODBC
\ No newline at end of file
+#endif //_IGNITE_ODBC
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h b/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h
index ed24359..0ce7818 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h
@@ -56,7 +56,8 @@ namespace ignite
* @param reslen Resulting data length.
* @param offset Pointer to buffer and reslen offset pointer.
*/
- ApplicationDataBuffer(type_traits::IgniteSqlType type, void* buffer, SqlLen buflen, SqlLen* reslen, size_t** offset = 0);
+ ApplicationDataBuffer(type_traits::IgniteSqlType type, void* buffer,
+ SqlLen buflen, SqlLen* reslen, int** offset = 0);
/**
* Copy constructor.
@@ -83,7 +84,7 @@ namespace ignite
*
* @param offset Pointer to offset pointer.
*/
- void SetPtrToOffsetPtr(size_t** offset)
+ void SetPtrToOffsetPtr(int** offset)
{
this->offset = offset;
}
@@ -272,6 +273,20 @@ namespace ignite
const SqlLen* GetResLen() const;
/**
+ * Get raw data.
+ *
+ * @return Buffer data.
+ */
+ void* GetData();
+
+ /**
+ * Get result data length.
+ *
+ * @return Data length pointer.
+ */
+ SqlLen* GetResLen();
+
+ /**
* Get buffer size in bytes.
*
* @return Buffer size.
@@ -281,21 +296,42 @@ namespace ignite
return buflen;
}
- private:
/**
- * Get raw data.
+ * Check if the data is going to be provided at execution.
*
- * @return Buffer data.
+ * @return True if the data is going to be provided
+ * at execution.
*/
- void* GetData();
+ bool IsDataAtExec() const;
/**
- * Get result data length.
+ * Get size of the data that is going to be provided at
+ * execution.
*
- * @return Data length pointer.
+ * @return Size of the data that is going to be provided
+ * at execution.
*/
- SqlLen* GetResLen();
+ size_t GetDataAtExecSize() const;
+
+ /**
+ * Get size of the input buffer.
+ *
+ * @return Input buffer size, or zero if the data is going
+ * to be provided at execution.
+ */
+ size_t GetInputSize() const;
+
+ /**
+ * Get buffer type.
+ *
+ * @return Buffer type.
+ */
+ type_traits::IgniteSqlType GetType() const
+ {
+ return type;
+ }
+ private:
/**
* Put value of numeric type in the buffer.
*
@@ -374,7 +410,7 @@ namespace ignite
SqlLen* reslen;
/** Pointer to implementation pointer to application offset */
- size_t** offset;
+ int** offset;
};
/** Column binging map type alias. */
@@ -383,4 +419,4 @@ namespace ignite
}
}
-#endif //_IGNITE_ODBC_APP_APPLICATION_DATA_BUFFER
\ No newline at end of file
+#endif //_IGNITE_ODBC_APP_APPLICATION_DATA_BUFFER
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/include/ignite/odbc/app/parameter.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/app/parameter.h b/modules/platforms/cpp/odbc/include/ignite/odbc/app/parameter.h
index d1ea697..0bd9395 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/app/parameter.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/app/parameter.h
@@ -90,6 +90,25 @@ namespace ignite
*/
ApplicationDataBuffer& GetBuffer();
+ /**
+ * Reset stored at-execution data.
+ */
+ void ResetStoredData();
+
+ /**
+ * Check if all the at-execution data has been stored.
+ * @return
+ */
+ bool IsDataReady() const;
+
+ /**
+ * Put at-execution data.
+ *
+ * @param data Data buffer pointer.
+ * @param len Data length.
+ */
+ void PutData(void* data, SqlLen len);
+
private:
/** Underlying data buffer. */
ApplicationDataBuffer buffer;
@@ -102,6 +121,12 @@ namespace ignite
/** IPD decimal digits. */
int16_t decDigits;
+
+ /** User provided null data at execution. */
+ bool nullData;
+
+ /** Stored at-execution data. */
+ std::vector<int8_t> storedData;
};
/** Parameter binging map type alias. */
@@ -110,4 +135,4 @@ namespace ignite
}
}
-#endif //_IGNITE_ODBC_APP_PARAMETER
\ No newline at end of file
+#endif //_IGNITE_ODBC_APP_PARAMETER
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h b/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h
index b01ec76..354cf08 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h
@@ -21,6 +21,8 @@
#include <stdint.h>
#include "system/odbc_constants.h"
+#include <ignite/odbc/system/odbc_constants.h>
+
namespace ignite
{
namespace odbc
@@ -42,7 +44,10 @@ namespace ignite
SQL_RESULT_ERROR,
/** No more data. */
- SQL_RESULT_NO_DATA
+ SQL_RESULT_NO_DATA,
+
+ /** No more data. */
+ SQL_RESULT_NEED_DATA
};
/**
@@ -68,9 +73,15 @@ namespace ignite
*/
SQL_STATE_01S02_OPTION_VALUE_CHANGED,
+ /** String data, length mismatch. */
+ SQL_STATE_22026_DATA_LENGTH_MISMATCH,
+
/** Invalid cursor state. */
SQL_STATE_24000_INVALID_CURSOR_STATE,
+ /** Invalid descriptor index. */
+ SQL_STATE_07009_INVALID_DESCRIPTOR_INDEX,
+
/**
* The driver was unable to establish a connection with the data
* source.
@@ -99,6 +110,9 @@ namespace ignite
*/
SQL_STATE_HY001_MEMORY_ALLOCATION,
+ /** Invalid use of null pointer. */
+ SQL_STATE_HY009_INVALID_USE_OF_NULL_POINTER,
+
/** Function sequence error. */
SQL_STATE_HY010_SEQUENCE_ERROR,
@@ -221,4 +235,4 @@ namespace ignite
}
}
-#endif //_IGNITE_ODBC_COMMON_TYPES
\ No newline at end of file
+#endif //_IGNITE_ODBC_COMMON_TYPES
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h b/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
index b5f385e..4fe4f1b 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
@@ -167,10 +167,7 @@ namespace ignite
*
* @param port Server port.
*/
- void SetTcpPort(uint16_t port)
- {
- arguments[Key::port] = common::LexicalCast<std::string>(port);
- }
+ void SetTcpPort(uint16_t port);
/**
* Get DSN.
@@ -217,10 +214,7 @@ namespace ignite
*
* @param server Server host.
*/
- void SetHost(const std::string& server)
- {
- arguments[Key::server] = server;
- }
+ void SetHost(const std::string& server);
/**
* Get cache.
@@ -257,10 +251,7 @@ namespace ignite
*
* @param address Address.
*/
- void SetAddress(const std::string& address)
- {
- arguments[Key::address] = address;
- }
+ void SetAddress(const std::string& address);
/**
* Get protocol version.
@@ -357,4 +348,4 @@ namespace ignite
}
}
-#endif //_IGNITE_ODBC_CONFIG_CONFIGURATION
\ No newline at end of file
+#endif //_IGNITE_ODBC_CONFIG_CONFIGURATION
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/include/ignite/odbc/statement.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/statement.h b/modules/platforms/cpp/odbc/include/ignite/odbc/statement.h
index 97d586f..35f1e98 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/statement.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/statement.h
@@ -81,14 +81,14 @@ namespace ignite
*
* @param ptr Column binding offset pointer.
*/
- void SetColumnBindOffsetPtr(size_t* ptr);
+ void SetColumnBindOffsetPtr(int* ptr);
/**
* Get column binding offset pointer.
*
* @return Column binding offset pointer.
*/
- size_t* GetColumnBindOffsetPtr();
+ int* GetColumnBindOffsetPtr();
/**
* Get number of columns in the result set.
@@ -129,14 +129,14 @@ namespace ignite
*
* @param ptr Parameter binding offset pointer.
*/
- void SetParamBindOffsetPtr(size_t* ptr);
+ void SetParamBindOffsetPtr(int* ptr);
/**
* Get parameter binding offset pointer.
*
* @return Parameter binding offset pointer.
*/
- size_t* GetParamBindOffsetPtr();
+ int* GetParamBindOffsetPtr();
/**
* Get value of the column in the result set.
@@ -328,10 +328,34 @@ namespace ignite
*/
uint16_t* GetRowStatusesPtr();
+ /**
+ * Select next parameter data for which is required.
+ *
+ * @param paramPtr Pointer to param id stored here.
+ */
+ void SelectParam(void** paramPtr);
+
+ /**
+ * Puts data for previously selected parameter or column.
+ *
+ * @param data Data.
+ * @param len Data length.
+ */
+ void PutData(void* data, SqlLen len);
+
private:
IGNITE_NO_COPY_ASSIGNMENT(Statement);
/**
+ * Bind parameter.
+ *
+ * @param paramIdx Parameter index.
+ * @param param Parameter.
+ * @return Operation result.
+ */
+ SqlResult InternalBindParameter(uint16_t paramIdx, const app::Parameter& param);
+
+ /**
* Get value of the column in the result set.
*
* @param columnIdx Column index.
@@ -488,6 +512,21 @@ namespace ignite
SqlResult InternalAffectedRows(int64_t& rowCnt);
/**
+ * Select next parameter data for which is required.
+ *
+ * @param paramPtr Pointer to param id stored here.
+ */
+ SqlResult InternalSelectParam(void** paramPtr);
+
+ /**
+ * Puts data for previously selected parameter or column.
+ *
+ * @param data Data.
+ * @param len Data length.
+ */
+ SqlResult InternalPutData(void* data, SqlLen len);
+
+ /**
* Constructor.
* Called by friend classes.
*
@@ -514,12 +553,15 @@ namespace ignite
uint16_t* rowStatuses;
/** Offset added to pointers to change binding of parameters. */
- size_t* paramBindOffset;
+ int* paramBindOffset;
- /* Offset added to pointers to change binding of column data. */
- size_t* columnBindOffset;
+ /** Offset added to pointers to change binding of column data. */
+ int* columnBindOffset;
+
+ /** Index of the parameter, which is currently being set. */
+ uint16_t currentParamIdx;
};
}
}
-#endif //_IGNITE_ODBC_STATEMENT
\ No newline at end of file
+#endif //_IGNITE_ODBC_STATEMENT
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/project/vs/module.def
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/project/vs/module.def b/modules/platforms/cpp/odbc/project/vs/module.def
index c94869b..df7bd22 100644
--- a/modules/platforms/cpp/odbc/project/vs/module.def
+++ b/modules/platforms/cpp/odbc/project/vs/module.def
@@ -35,7 +35,6 @@ EXPORTS
SQLTables
SQLBrowseConnect
SQLColumnPrivileges
- SQLDescribeParam
SQLForeignKeys
SQLMoreResults
SQLNativeSql
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
index 2190c00..1438b0c 100644
--- a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
+++ b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
@@ -36,20 +36,32 @@ namespace ignite
using ignite::impl::binary::BinaryUtils;
ApplicationDataBuffer::ApplicationDataBuffer() :
- type(type_traits::IGNITE_ODBC_C_TYPE_UNSUPPORTED), buffer(0), buflen(0), reslen(0), offset(0)
+ type(type_traits::IGNITE_ODBC_C_TYPE_UNSUPPORTED),
+ buffer(0),
+ buflen(0),
+ reslen(0),
+ offset(0)
{
// No-op.
}
ApplicationDataBuffer::ApplicationDataBuffer(type_traits::IgniteSqlType type,
- void* buffer, SqlLen buflen, SqlLen* reslen, size_t** offset) :
- type(type), buffer(buffer), buflen(buflen), reslen(reslen), offset(offset)
+ void* buffer, SqlLen buflen, SqlLen* reslen, int** offset) :
+ type(type),
+ buffer(buffer),
+ buflen(buflen),
+ reslen(reslen),
+ offset(offset)
{
// No-op.
}
ApplicationDataBuffer::ApplicationDataBuffer(const ApplicationDataBuffer & other) :
- type(other.type), buffer(other.buffer), buflen(other.buflen), reslen(other.reslen), offset(other.offset)
+ type(other.type),
+ buffer(other.buffer),
+ buflen(other.buflen),
+ reslen(other.reslen),
+ offset(other.offset)
{
// No-op.
}
@@ -74,6 +86,10 @@ namespace ignite
void ApplicationDataBuffer::PutNum(T value)
{
using namespace type_traits;
+
+ SqlLen* resLenPtr = GetResLen();
+ void* dataPtr = GetData();
+
switch (type)
{
case IGNITE_ODBC_C_TYPE_SIGNED_TINYINT:
@@ -151,10 +167,10 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_NUMERIC:
{
- if (GetData())
+ if (dataPtr)
{
SQL_NUMERIC_STRUCT* out =
- reinterpret_cast<SQL_NUMERIC_STRUCT*>(GetData());
+ reinterpret_cast<SQL_NUMERIC_STRUCT*>(dataPtr);
uint64_t uval = static_cast<uint64_t>(value < 0 ? -value : value);
@@ -172,27 +188,26 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_BINARY:
case IGNITE_ODBC_C_TYPE_DEFAULT:
{
- if (GetData())
+ if (dataPtr)
{
if (buflen >= sizeof(value))
{
- memcpy(GetData(), &value, sizeof(value));
+ memcpy(dataPtr, &value, sizeof(value));
- if (GetResLen())
- *GetResLen() = sizeof(value);
+ if (resLenPtr)
+ *resLenPtr = sizeof(value);
}
else
{
- memcpy(GetData(), &value, static_cast<size_t>(buflen));
+ memcpy(dataPtr, &value, static_cast<size_t>(buflen));
- if (GetResLen())
- *GetResLen() = SQL_NO_TOTAL;
+ if (resLenPtr)
+ *resLenPtr = SQL_NO_TOTAL;
}
}
- else if (GetResLen())
- {
- *GetResLen() = sizeof(value);
- }
+ else if (resLenPtr)
+ *resLenPtr = sizeof(value);
+
break;
}
@@ -212,8 +227,8 @@ namespace ignite
default:
{
- if (GetResLen())
- *GetResLen() = SQL_NO_TOTAL;
+ if (resLenPtr)
+ *resLenPtr = SQL_NO_TOTAL;
}
}
}
@@ -221,9 +236,11 @@ namespace ignite
template<typename Tbuf, typename Tin>
void ApplicationDataBuffer::PutNumToNumBuffer(Tin value)
{
- if (GetData())
+ void* dataPtr = GetData();
+
+ if (dataPtr)
{
- Tbuf* out = reinterpret_cast<Tbuf*>(GetData());
+ Tbuf* out = reinterpret_cast<Tbuf*>(dataPtr);
*out = static_cast<Tbuf>(value);
}
}
@@ -257,11 +274,14 @@ namespace ignite
{
SqlLen charSize = static_cast<SqlLen>(sizeof(OutCharT));
- if (GetData())
+ SqlLen* resLenPtr = GetResLen();
+ void* dataPtr = GetData();
+
+ if (dataPtr)
{
if (buflen >= charSize)
{
- OutCharT* out = reinterpret_cast<OutCharT*>(GetData());
+ OutCharT* out = reinterpret_cast<OutCharT*>(dataPtr);
SqlLen outLen = (buflen / charSize) - 1;
@@ -273,38 +293,41 @@ namespace ignite
out[toCopy] = 0;
}
- if (GetResLen())
+ if (resLenPtr)
{
if (buflen >= static_cast<SqlLen>((value.size() + 1) * charSize))
- *GetResLen() = static_cast<SqlLen>(value.size());
+ *resLenPtr = static_cast<SqlLen>(value.size());
else
- *GetResLen() = SQL_NO_TOTAL;
+ *resLenPtr = SQL_NO_TOTAL;
}
}
- else if (GetResLen())
- *GetResLen() = value.size();
+ else if (resLenPtr)
+ *resLenPtr = value.size();
}
void ApplicationDataBuffer::PutRawDataToBuffer(void *data, size_t len)
{
SqlLen ilen = static_cast<SqlLen>(len);
- if (GetData())
+ SqlLen* resLenPtr = GetResLen();
+ void* dataPtr = GetData();
+
+ if (dataPtr)
{
size_t toCopy = static_cast<size_t>(std::min(buflen, ilen));
- memcpy(GetData(), data, toCopy);
+ memcpy(dataPtr, data, toCopy);
- if (GetResLen())
+ if (resLenPtr)
{
if (buflen >= ilen)
- *GetResLen() = ilen;
+ *resLenPtr = ilen;
else
- *GetResLen() = SQL_NO_TOTAL;
+ *resLenPtr = SQL_NO_TOTAL;
}
}
- else if (GetResLen())
- *GetResLen() = ilen;
+ else if (resLenPtr)
+ *resLenPtr = ilen;
}
void ApplicationDataBuffer::PutInt8(int8_t value)
@@ -411,8 +434,10 @@ namespace ignite
default:
{
- if (GetResLen())
- *GetResLen() = SQL_NO_TOTAL;
+ SqlLen* resLenPtr = GetResLen();
+
+ if (resLenPtr)
+ *resLenPtr = SQL_NO_TOTAL;
}
}
@@ -456,8 +481,10 @@ namespace ignite
default:
{
- if (GetResLen())
- *GetResLen() = SQL_NO_TOTAL;
+ SqlLen* resLenPtr = GetResLen();
+
+ if (resLenPtr)
+ *resLenPtr = SQL_NO_TOTAL;
}
}
}
@@ -524,8 +551,10 @@ namespace ignite
default:
{
- if (GetResLen())
- *GetResLen() = SQL_NO_TOTAL;
+ SqlLen* resLenPtr = GetResLen();
+
+ if (resLenPtr)
+ *resLenPtr = SQL_NO_TOTAL;
}
}
@@ -534,13 +563,16 @@ namespace ignite
void ApplicationDataBuffer::PutNull()
{
- if (GetResLen())
- *GetResLen() = SQL_NULL_DATA;
+ SqlLen* resLenPtr = GetResLen();
+
+ if (resLenPtr)
+ *resLenPtr = SQL_NULL_DATA;
}
void ApplicationDataBuffer::PutDecimal(const common::Decimal& value)
{
using namespace type_traits;
+
switch (type)
{
case IGNITE_ODBC_C_TYPE_SIGNED_TINYINT:
@@ -612,8 +644,10 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_BINARY:
default:
{
- if (GetResLen())
- *GetResLen() = SQL_NO_TOTAL;
+ SqlLen* resLenPtr = GetResLen();
+
+ if (resLenPtr)
+ *resLenPtr = SQL_NO_TOTAL;
}
}
}
@@ -626,28 +660,31 @@ namespace ignite
BinaryUtils::DateToCTm(value, tmTime);
+ SqlLen* resLenPtr = GetResLen();
+ void* dataPtr = GetData();
+
switch (type)
{
case IGNITE_ODBC_C_TYPE_CHAR:
{
- char* buffer = reinterpret_cast<char*>(GetData());
+ char* buffer = reinterpret_cast<char*>(dataPtr);
if (buffer)
{
strftime(buffer, GetSize(), "%Y-%m-%d", &tmTime);
- if (GetResLen())
- *GetResLen() = strlen(buffer);
+ if (resLenPtr)
+ *resLenPtr = strlen(buffer);
}
- else if (GetResLen())
- *GetResLen() = sizeof("HHHH-MM-DD") - 1;
+ else if (resLenPtr)
+ *resLenPtr = sizeof("HHHH-MM-DD") - 1;
break;
}
case IGNITE_ODBC_C_TYPE_WCHAR:
{
- SQLWCHAR* buffer = reinterpret_cast<SQLWCHAR*>(GetData());
+ SQLWCHAR* buffer = reinterpret_cast<SQLWCHAR*>(dataPtr);
if (buffer)
{
@@ -662,18 +699,18 @@ namespace ignite
buffer[toCopy] = 0;
- if (GetResLen())
- *GetResLen() = toCopy;
+ if (resLenPtr)
+ *resLenPtr = toCopy;
}
- else if (GetResLen())
- *GetResLen() = sizeof("HHHH-MM-DD") - 1;
+ else if (resLenPtr)
+ *resLenPtr = sizeof("HHHH-MM-DD") - 1;
break;
}
case IGNITE_ODBC_C_TYPE_TDATE:
{
- SQL_DATE_STRUCT* buffer = reinterpret_cast<SQL_DATE_STRUCT*>(GetData());
+ SQL_DATE_STRUCT* buffer = reinterpret_cast<SQL_DATE_STRUCT*>(dataPtr);
buffer->year = tmTime.tm_year + 1900;
buffer->month = tmTime.tm_mon + 1;
@@ -684,7 +721,7 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_TTIMESTAMP:
{
- SQL_TIMESTAMP_STRUCT* buffer = reinterpret_cast<SQL_TIMESTAMP_STRUCT*>(GetData());
+ SQL_TIMESTAMP_STRUCT* buffer = reinterpret_cast<SQL_TIMESTAMP_STRUCT*>(dataPtr);
buffer->year = tmTime.tm_year + 1900;
buffer->month = tmTime.tm_mon + 1;
@@ -700,11 +737,11 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_BINARY:
case IGNITE_ODBC_C_TYPE_DEFAULT:
{
- if (GetData())
- memcpy(GetData(), &value, std::min(static_cast<size_t>(buflen), sizeof(value)));
+ if (dataPtr)
+ memcpy(dataPtr, &value, std::min(static_cast<size_t>(buflen), sizeof(value)));
- if (GetResLen())
- *GetResLen() = sizeof(value);
+ if (resLenPtr)
+ *resLenPtr = sizeof(value);
break;
}
@@ -723,8 +760,8 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_NUMERIC:
default:
{
- if (GetResLen())
- *GetResLen() = SQL_NO_TOTAL;
+ if (resLenPtr)
+ *resLenPtr = SQL_NO_TOTAL;
}
}
}
@@ -737,28 +774,31 @@ namespace ignite
BinaryUtils::TimestampToCTm(value, tmTime);
+ SqlLen* resLenPtr = GetResLen();
+ void* dataPtr = GetData();
+
switch (type)
{
case IGNITE_ODBC_C_TYPE_CHAR:
{
- char* buffer = reinterpret_cast<char*>(GetData());
+ char* buffer = reinterpret_cast<char*>(dataPtr);
if (buffer)
{
strftime(buffer, GetSize(), "%Y-%m-%d %H:%M:%S", &tmTime);
- if (GetResLen())
- *GetResLen() = strlen(buffer);
+ if (resLenPtr)
+ *resLenPtr = strlen(buffer);
}
- else if (GetResLen())
- *GetResLen() = sizeof("HHHH-MM-DD HH:MM:SS") - 1;
+ else if (resLenPtr)
+ *resLenPtr = sizeof("HHHH-MM-DD HH:MM:SS") - 1;
break;
}
case IGNITE_ODBC_C_TYPE_WCHAR:
{
- SQLWCHAR* buffer = reinterpret_cast<SQLWCHAR*>(GetData());
+ SQLWCHAR* buffer = reinterpret_cast<SQLWCHAR*>(dataPtr);
if (buffer)
{
@@ -773,18 +813,18 @@ namespace ignite
buffer[toCopy] = 0;
- if (GetResLen())
- *GetResLen() = toCopy;
+ if (resLenPtr)
+ *resLenPtr = toCopy;
}
- else if (GetResLen())
- *GetResLen() = sizeof("HHHH-MM-DD HH:MM:SS") - 1;
+ else if (resLenPtr)
+ *resLenPtr = sizeof("HHHH-MM-DD HH:MM:SS") - 1;
break;
}
case IGNITE_ODBC_C_TYPE_TDATE:
{
- SQL_DATE_STRUCT* buffer = reinterpret_cast<SQL_DATE_STRUCT*>(GetData());
+ SQL_DATE_STRUCT* buffer = reinterpret_cast<SQL_DATE_STRUCT*>(dataPtr);
buffer->year = tmTime.tm_year + 1900;
buffer->month = tmTime.tm_mon + 1;
@@ -795,7 +835,7 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_TTIMESTAMP:
{
- SQL_TIMESTAMP_STRUCT* buffer = reinterpret_cast<SQL_TIMESTAMP_STRUCT*>(GetData());
+ SQL_TIMESTAMP_STRUCT* buffer = reinterpret_cast<SQL_TIMESTAMP_STRUCT*>(dataPtr);
buffer->year = tmTime.tm_year + 1900;
buffer->month = tmTime.tm_mon + 1;
@@ -811,11 +851,11 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_BINARY:
case IGNITE_ODBC_C_TYPE_DEFAULT:
{
- if (GetData())
- memcpy(GetData(), &value, std::min(static_cast<size_t>(buflen), sizeof(value)));
+ if (dataPtr)
+ memcpy(dataPtr, &value, std::min(static_cast<size_t>(buflen), sizeof(value)));
- if (GetResLen())
- *GetResLen() = sizeof(value);
+ if (resLenPtr)
+ *resLenPtr = sizeof(value);
break;
}
@@ -834,8 +874,8 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_NUMERIC:
default:
{
- if (GetResLen())
- *GetResLen() = SQL_NO_TOTAL;
+ if (resLenPtr)
+ *resLenPtr = SQL_NO_TOTAL;
}
}
}
@@ -849,8 +889,13 @@ namespace ignite
{
case IGNITE_ODBC_C_TYPE_CHAR:
{
+ size_t paramLen = GetInputSize();
+
+ if (!paramLen)
+ break;
+
res.assign(reinterpret_cast<const char*>(GetData()),
- std::min(maxLen, static_cast<size_t>(buflen)));
+ std::min(maxLen, paramLen));
break;
}
@@ -953,7 +998,12 @@ namespace ignite
{
case IGNITE_ODBC_C_TYPE_CHAR:
{
- std::string str(reinterpret_cast<const char*>(GetData()), static_cast<size_t>(buflen));
+ size_t paramLen = GetInputSize();
+
+ if (!paramLen)
+ break;
+
+ std::string str(reinterpret_cast<const char*>(GetData()), paramLen);
std::stringstream converter;
@@ -1014,13 +1064,18 @@ namespace ignite
{
using namespace type_traits;
- T res = 0;
+ T res = T();
switch (type)
{
case IGNITE_ODBC_C_TYPE_CHAR:
{
- std::string str = GetString(static_cast<size_t>(buflen));
+ size_t paramLen = GetInputSize();
+
+ if (!paramLen)
+ break;
+
+ std::string str = GetString(paramLen);
std::stringstream converter;
@@ -1158,9 +1213,13 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_CHAR:
{
+ size_t paramLen = GetInputSize();
+
+ if (!paramLen)
+ break;
+
std::string str = utility::SqlStringToString(
- reinterpret_cast<const unsigned char*>(GetData()),
- static_cast<int32_t>(GetSize()));
+ reinterpret_cast<const unsigned char*>(GetData()), static_cast<int32_t>(paramLen));
sscanf(str.c_str(), "%d-%d-%d %d:%d:%d", &tmTime.tm_year, &tmTime.tm_mon,
&tmTime.tm_mday, &tmTime.tm_hour, &tmTime.tm_min, &tmTime.tm_sec);
@@ -1217,9 +1276,13 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_CHAR:
{
+ size_t paramLen = GetInputSize();
+
+ if (!paramLen)
+ break;
+
std::string str = utility::SqlStringToString(
- reinterpret_cast<const unsigned char*>(GetData()),
- static_cast<int32_t>(GetSize()));
+ reinterpret_cast<const unsigned char*>(GetData()), static_cast<int32_t>(paramLen));
sscanf(str.c_str(), "%d-%d-%d %d:%d:%d", &tmTime.tm_year, &tmTime.tm_mon,
&tmTime.tm_mday, &tmTime.tm_hour, &tmTime.tm_min, &tmTime.tm_sec);
@@ -1245,7 +1308,12 @@ namespace ignite
{
case IGNITE_ODBC_C_TYPE_CHAR:
{
- std::string str = GetString(static_cast<size_t>(buflen));
+ size_t paramLen = GetInputSize();
+
+ if (!paramLen)
+ break;
+
+ std::string str = GetString(paramLen);
std::stringstream converter;
@@ -1315,6 +1383,101 @@ namespace ignite
return utility::GetPointerWithOffset(ptr, **offset);
}
+
+ bool ApplicationDataBuffer::IsDataAtExec() const
+ {
+ const SqlLen* resLenPtr = GetResLen();
+
+ if (!resLenPtr)
+ return false;
+
+ int32_t ilen = static_cast<int32_t>(*resLenPtr);
+
+ return ilen <= SQL_LEN_DATA_AT_EXEC_OFFSET || ilen == SQL_DATA_AT_EXEC;
+ }
+
+ size_t ApplicationDataBuffer::GetDataAtExecSize() const
+ {
+ using namespace type_traits;
+
+ switch (type)
+ {
+ case IGNITE_ODBC_C_TYPE_WCHAR:
+ case IGNITE_ODBC_C_TYPE_CHAR:
+ case IGNITE_ODBC_C_TYPE_BINARY:
+ {
+ const SqlLen* resLenPtr = GetResLen();
+
+ if (!resLenPtr)
+ return 0;
+
+ int32_t ilen = static_cast<int32_t>(*resLenPtr);
+
+ if (ilen <= SQL_LEN_DATA_AT_EXEC_OFFSET)
+ ilen = static_cast<size_t>(SQL_LEN_DATA_AT_EXEC(ilen));
+ else
+ ilen = 0;
+
+ if (type == IGNITE_ODBC_C_TYPE_WCHAR)
+ ilen *= 2;
+
+ return ilen;
+ }
+
+ case IGNITE_ODBC_C_TYPE_SIGNED_SHORT:
+ case IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT:
+ return sizeof(short);
+
+ case IGNITE_ODBC_C_TYPE_SIGNED_LONG:
+ case IGNITE_ODBC_C_TYPE_UNSIGNED_LONG:
+ return sizeof(long);
+
+ case IGNITE_ODBC_C_TYPE_FLOAT:
+ return sizeof(float);
+
+ case IGNITE_ODBC_C_TYPE_DOUBLE:
+ return sizeof(double);
+
+ case IGNITE_ODBC_C_TYPE_BIT:
+ case IGNITE_ODBC_C_TYPE_SIGNED_TINYINT:
+ case IGNITE_ODBC_C_TYPE_UNSIGNED_TINYINT:
+ return sizeof(char);
+
+ case IGNITE_ODBC_C_TYPE_SIGNED_BIGINT:
+ case IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT:
+ return sizeof(SQLBIGINT);
+
+ case IGNITE_ODBC_C_TYPE_TDATE:
+ return sizeof(SQL_DATE_STRUCT);
+
+ case IGNITE_ODBC_C_TYPE_TTIME:
+ return sizeof(SQL_TIME_STRUCT);
+
+ case IGNITE_ODBC_C_TYPE_TTIMESTAMP:
+ return sizeof(SQL_TIMESTAMP_STRUCT);
+
+ case IGNITE_ODBC_C_TYPE_NUMERIC:
+ return sizeof(SQL_NUMERIC_STRUCT);
+
+ case IGNITE_ODBC_C_TYPE_GUID:
+ return sizeof(SQLGUID);
+
+ case IGNITE_ODBC_C_TYPE_DEFAULT:
+ case IGNITE_ODBC_C_TYPE_UNSUPPORTED:
+ default:
+ break;
+ }
+
+ return 0;
+ }
+
+ size_t ApplicationDataBuffer::GetInputSize() const
+ {
+ if (!IsDataAtExec())
+ return static_cast<size_t>(GetSize());
+
+ return GetDataAtExecSize();
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/src/app/parameter.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/app/parameter.cpp b/modules/platforms/cpp/odbc/src/app/parameter.cpp
index 3e14642..d70ef6a 100644
--- a/modules/platforms/cpp/odbc/src/app/parameter.cpp
+++ b/modules/platforms/cpp/odbc/src/app/parameter.cpp
@@ -33,7 +33,9 @@ namespace ignite
buffer(),
sqlType(),
columnSize(),
- decDigits()
+ decDigits(),
+ nullData(false),
+ storedData()
{
// No-op.
}
@@ -43,7 +45,9 @@ namespace ignite
buffer(buffer),
sqlType(sqlType),
columnSize(columnSize),
- decDigits(decDigits)
+ decDigits(decDigits),
+ nullData(false),
+ storedData()
{
// No-op.
}
@@ -52,7 +56,9 @@ namespace ignite
buffer(other.buffer),
sqlType(other.sqlType),
columnSize(other.columnSize),
- decDigits(other.decDigits)
+ decDigits(other.decDigits),
+ nullData(other.nullData),
+ storedData(other.storedData)
{
// No-op.
}
@@ -74,67 +80,85 @@ namespace ignite
void Parameter::Write(ignite::impl::binary::BinaryWriterImpl& writer) const
{
+ if (buffer.GetInputSize() == SQL_NULL_DATA)
+ {
+ writer.WriteNull();
+
+ return;
+ }
+
+ // Buffer to use to get data.
+ ApplicationDataBuffer buf(buffer);
+
+ SqlLen storedDataLen = static_cast<SqlLen>(storedData.size());
+
+ if (buffer.IsDataAtExec())
+ {
+ buf = ApplicationDataBuffer(buffer.GetType(),
+ const_cast<int8_t*>(&storedData[0]), storedDataLen, &storedDataLen);
+ }
+
switch (sqlType)
{
case SQL_CHAR:
case SQL_VARCHAR:
case SQL_LONGVARCHAR:
{
- utility::WriteString(writer, buffer.GetString(columnSize));
+ utility::WriteString(writer, buf.GetString(columnSize));
break;
}
case SQL_SMALLINT:
{
- writer.WriteInt16(buffer.GetInt16());
+ writer.WriteObject<int16_t>(buf.GetInt16());
break;
}
case SQL_INTEGER:
{
- writer.WriteInt32(buffer.GetInt32());
+ writer.WriteObject<int32_t>(buf.GetInt32());
break;
}
case SQL_FLOAT:
{
- writer.WriteFloat(buffer.GetFloat());
+ writer.WriteObject<float>(buf.GetFloat());
break;
}
case SQL_DOUBLE:
{
- writer.WriteDouble(buffer.GetDouble());
+ writer.WriteObject<double>(buf.GetDouble());
break;
}
case SQL_TINYINT:
{
- writer.WriteInt8(buffer.GetInt8());
+ writer.WriteObject<int8_t>(buf.GetInt8());
break;
}
case SQL_BIT:
{
- writer.WriteBool(buffer.GetInt8() != 0);
+ writer.WriteObject<bool>(buf.GetInt8() != 0);
break;
}
case SQL_BIGINT:
{
- writer.WriteInt64(buffer.GetInt64());
+ writer.WriteObject<int64_t>(buf.GetInt64());
break;
}
case SQL_DATE:
{
- writer.WriteDate(buffer.GetDate());
+ writer.WriteDate(buf.GetDate());
break;
}
case SQL_TIMESTAMP:
{
- writer.WriteTimestamp(buffer.GetTimestamp());
+ writer.WriteTimestamp(buf.GetTimestamp());
break;
}
@@ -142,14 +166,23 @@ namespace ignite
case SQL_VARBINARY:
case SQL_LONGVARBINARY:
{
- writer.WriteInt8Array(reinterpret_cast<const int8_t*>(buffer.GetData()),
- static_cast<int32_t>(buffer.GetSize()));
+ const ApplicationDataBuffer& constRef = buf;
+
+ const SqlLen* resLenPtr = constRef.GetResLen();
+
+ if (!resLenPtr)
+ break;
+
+ int32_t paramLen = static_cast<int32_t>(*resLenPtr);
+
+ writer.WriteInt8Array(reinterpret_cast<const int8_t*>(constRef.GetData()), paramLen);
+
break;
}
case SQL_GUID:
{
- writer.WriteGuid(buffer.GetGuid());
+ writer.WriteGuid(buf.GetGuid());
break;
}
@@ -157,7 +190,7 @@ namespace ignite
case SQL_DECIMAL:
{
common::Decimal dec;
- buffer.GetDecimal(dec);
+ buf.GetDecimal(dec);
utility::WriteDecimal(writer, dec);
@@ -169,10 +202,67 @@ namespace ignite
}
}
- ApplicationDataBuffer & Parameter::GetBuffer()
+ ApplicationDataBuffer& Parameter::GetBuffer()
{
return buffer;
}
+
+ void Parameter::ResetStoredData()
+ {
+ storedData.clear();
+
+ if (buffer.IsDataAtExec())
+ storedData.reserve(buffer.GetDataAtExecSize());
+ }
+
+ bool Parameter::IsDataReady() const
+ {
+ return !buffer.IsDataAtExec() ||
+ storedData.size() == buffer.GetDataAtExecSize();
+ }
+
+ void Parameter::PutData(void* data, SqlLen len)
+ {
+ if (len == SQL_DEFAULT_PARAM)
+ return;
+
+ if (len == SQL_NULL_DATA)
+ {
+ nullData = true;
+
+ return;
+ }
+
+ if (buffer.GetType() == type_traits::IGNITE_ODBC_C_TYPE_CHAR ||
+ buffer.GetType() == type_traits::IGNITE_ODBC_C_TYPE_BINARY)
+ {
+ SqlLen slen = len;
+
+ if (buffer.GetType() == type_traits::IGNITE_ODBC_C_TYPE_CHAR && slen == SQL_NTSL)
+ {
+ const char* str = reinterpret_cast<char*>(data);
+
+ slen = strlen(str);
+ }
+
+ if (slen <= 0)
+ return;
+
+ size_t beginPos = storedData.size();
+
+ storedData.resize(storedData.size() + static_cast<size_t>(slen));
+
+ memcpy(&storedData[beginPos], data, static_cast<size_t>(slen));
+
+ return;
+ }
+
+ size_t dataSize = buffer.GetDataAtExecSize();
+
+ storedData.resize(dataSize);
+
+ memcpy(&storedData[0], data, dataSize);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/src/common_types.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/common_types.cpp b/modules/platforms/cpp/odbc/src/common_types.cpp
index 276d9fd..36d11c2 100644
--- a/modules/platforms/cpp/odbc/src/common_types.cpp
+++ b/modules/platforms/cpp/odbc/src/common_types.cpp
@@ -37,6 +37,9 @@ namespace ignite
case SQL_RESULT_NO_DATA:
return SQL_NO_DATA;
+ case SQL_RESULT_NEED_DATA:
+ return SQL_NEED_DATA;
+
case SQL_RESULT_ERROR:
default:
return SQL_ERROR;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/src/config/configuration.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/configuration.cpp b/modules/platforms/cpp/odbc/src/config/configuration.cpp
index 74ccaaf..cc2cc5d 100644
--- a/modules/platforms/cpp/odbc/src/config/configuration.cpp
+++ b/modules/platforms/cpp/odbc/src/config/configuration.cpp
@@ -141,6 +141,33 @@ namespace ignite
}
}
+ void Configuration::SetTcpPort(uint16_t port)
+ {
+ arguments[Key::port] = common::LexicalCast<std::string>(port);
+
+ ArgumentMap::const_iterator it = arguments.find(Key::address);
+
+ if (it == arguments.end())
+ endPoint.port = port;
+ }
+
+ void Configuration::SetHost(const std::string& server)
+ {
+ arguments[Key::server] = server;
+
+ ArgumentMap::const_iterator it = arguments.find(Key::address);
+
+ if (it == arguments.end())
+ endPoint.host = server;
+ }
+
+ void Configuration::SetAddress(const std::string& address)
+ {
+ arguments[Key::address] = address;
+
+ ParseAddress(address, endPoint);
+ }
+
ProtocolVersion Configuration::GetProtocolVersion() const
{
ArgumentMap::const_iterator it = arguments.find(Key::protocolVersion);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/src/config/connection_info.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/connection_info.cpp b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
index ee2c22b..341ab7f 100644
--- a/modules/platforms/cpp/odbc/src/config/connection_info.cpp
+++ b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
@@ -62,7 +62,8 @@ namespace ignite
DBG_STR_CASE(SQL_CATALOG_TERM);
DBG_STR_CASE(SQL_TABLE_TERM);
DBG_STR_CASE(SQL_SCHEMA_TERM);
- DBG_STR_CASE(SQL_ASYNC_DBC_FUNCTIONS);
+ DBG_STR_CASE(SQL_NEED_LONG_DATA_LEN);
+// DBG_STR_CASE(SQL_ASYNC_DBC_FUNCTIONS);
DBG_STR_CASE(SQL_ASYNC_NOTIFICATION);
DBG_STR_CASE(SQL_GETDATA_EXTENSIONS);
DBG_STR_CASE(SQL_ODBC_INTERFACE_CONFORMANCE);
@@ -92,6 +93,8 @@ namespace ignite
DBG_STR_CASE(SQL_SQL92_PREDICATES);
DBG_STR_CASE(SQL_SQL92_RELATIONAL_JOIN_OPERATORS);
DBG_STR_CASE(SQL_SQL92_VALUE_EXPRESSIONS);
+ DBG_STR_CASE(SQL_STATIC_CURSOR_ATTRIBUTES1);
+ DBG_STR_CASE(SQL_STATIC_CURSOR_ATTRIBUTES2);
default:
break;
}
@@ -104,7 +107,7 @@ namespace ignite
ConnectionInfo::ConnectionInfo() : strParams(), intParams(),
shortParams()
{
- //========================= String Params =========================
+ //======================= String Params =======================
// Driver name.
strParams[SQL_DRIVER_NAME] = "Apache Ignite";
strParams[SQL_DBMS_NAME] = "Apache Ignite";
@@ -170,8 +173,16 @@ namespace ignite
strParams[SQL_SCHEMA_TERM] = "schema";
#endif // SQL_SCHEMA_TERM
+#ifdef SQL_NEED_LONG_DATA_LEN
+ // A character string: "Y" if the data source needs the length
+ // of a long data value (the data type is SQL_LONGVARCHAR,
+ // SQL_LONGVARBINARY) before that value is sent to the data
+ // source, "N" if it does not.
+ strParams[SQL_NEED_LONG_DATA_LEN ] = "Y";
+#endif // SQL_NEED_LONG_DATA_LEN
+
#ifdef SQL_ASYNC_DBC_FUNCTIONS
- //======================== Integer Params =========================
+ //====================== Integer Params =======================
// Indicates if the driver can execute functions asynchronously
// on the connection handle.
// SQL_ASYNC_DBC_CAPABLE = The driver can execute connection
@@ -342,7 +353,23 @@ namespace ignite
SQL_SRJO_NATURAL_JOIN | SQL_SRJO_INTERSECT_JOIN | SQL_SRJO_UNION_JOIN;
#endif // SQL_SQL92_RELATIONAL_JOIN_OPERATORS
- //========================= Short Params ==========================
+#ifdef SQL_STATIC_CURSOR_ATTRIBUTES1
+ // Bitmask that describes the attributes of a static cursor that
+ // are supported by the driver. This bitmask contains the first
+ // subset of attributes; for the second subset, see
+ // SQL_STATIC_CURSOR_ATTRIBUTES2.
+ intParams[SQL_STATIC_CURSOR_ATTRIBUTES1] = SQL_CA1_NEXT;
+#endif //SQL_STATIC_CURSOR_ATTRIBUTES1
+
+#ifdef SQL_STATIC_CURSOR_ATTRIBUTES2
+ // Bitmask that describes the attributes of a static cursor that
+ // are supported by the driver. This bitmask contains the second
+ // subset of attributes; for the first subset, see
+ // SQL_STATIC_CURSOR_ATTRIBUTES1.
+ intParams[SQL_STATIC_CURSOR_ATTRIBUTES2] = 0;
+#endif //SQL_STATIC_CURSOR_ATTRIBUTES2
+
+ //======================= Short Params ========================
#ifdef SQL_MAX_CONCURRENT_ACTIVITIES
// The maximum number of active statements that the driver can
// support for a connection. Zero mean no limit.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/src/connection.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/connection.cpp b/modules/platforms/cpp/odbc/src/connection.cpp
index cffecdf..cbbb2f7 100644
--- a/modules/platforms/cpp/odbc/src/connection.cpp
+++ b/modules/platforms/cpp/odbc/src/connection.cpp
@@ -52,7 +52,7 @@ namespace ignite
{
// No-op.
}
-
+
const config::ConnectionInfo& Connection::GetInfo() const
{
// Connection info is constant and the same for all connections now.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp b/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
index 8553ee4..1b654d2 100644
--- a/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
+++ b/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
@@ -40,9 +40,15 @@ namespace
/** SQL state 01S01 constant. */
const std::string STATE_01S01 = "01S01";
+ /** SQL state 22026 constant. */
+ const std::string STATE_22026 = "22026";
+
/** SQL state 24000 constant. */
const std::string STATE_24000 = "24000";
+ /** SQL state 07009 constant. */
+ const std::string STATE_07009 = "07009";
+
/** SQL state 08001 constant. */
const std::string STATE_08001 = "08001";
@@ -58,6 +64,9 @@ namespace
/** SQL state HY001 constant. */
const std::string STATE_HY001 = "HY001";
+ /** SQL state HY009 constant. */
+ const std::string STATE_HY009 = "HY009";
+
/** SQL state HY010 constant. */
const std::string STATE_HY010 = "HY010";
@@ -199,9 +208,15 @@ namespace ignite
case SQL_STATE_01S01_ERROR_IN_ROW:
return STATE_01S01;
+ case SQL_STATE_22026_DATA_LENGTH_MISMATCH:
+ return STATE_22026;
+
case SQL_STATE_24000_INVALID_CURSOR_STATE:
return STATE_24000;
+ case SQL_STATE_07009_INVALID_DESCRIPTOR_INDEX:
+ return STATE_07009;
+
case SQL_STATE_08001_CANNOT_CONNECT:
return STATE_08001;
@@ -217,6 +232,9 @@ namespace ignite
case SQL_STATE_HY001_MEMORY_ALLOCATION:
return STATE_HY001;
+ case SQL_STATE_HY009_INVALID_USE_OF_NULL_POINTER:
+ return STATE_HY009;
+
case SQL_STATE_HY010_SEQUENCE_ERROR:
return STATE_HY010;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4a933eb/modules/platforms/cpp/odbc/src/entry_points.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/entry_points.cpp b/modules/platforms/cpp/odbc/src/entry_points.cpp
index c3d24bb..08016cc 100644
--- a/modules/platforms/cpp/odbc/src/entry_points.cpp
+++ b/modules/platforms/cpp/odbc/src/entry_points.cpp
@@ -399,6 +399,19 @@ SQLRETURN SQL_API SQLSpecialColumns(SQLHSTMT stmt,
tableNameLen, scope, nullable);
}
+SQLRETURN SQL_API SQLParamData(SQLHSTMT stmt,
+ SQLPOINTER* value)
+{
+ return ignite::SQLParamData(stmt, value);
+}
+
+SQLRETURN SQL_API SQLPutData(SQLHSTMT stmt,
+ SQLPOINTER data,
+ SQLLEN strLengthOrIndicator)
+{
+ return ignite::SQLPutData(stmt, data, strLengthOrIndicator);
+}
+
//
// ==== Not implemented ====
//
@@ -467,21 +480,6 @@ SQLRETURN SQL_API SQLGetStmtOption(SQLHSTMT stmt,
return SQL_SUCCESS;
}
-SQLRETURN SQL_API SQLParamData(SQLHSTMT stmt,
- SQLPOINTER* value)
-{
- LOG_MSG("SQLParamData called\n");
- return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLPutData(SQLHSTMT stmt,
- SQLPOINTER data,
- SQLLEN strLengthOrIndicator)
-{
- LOG_MSG("SQLPutData called\n");
- return SQL_SUCCESS;
-}
-
SQLRETURN SQL_API SQLSetConnectOption(SQLHDBC conn,
SQLUSMALLINT option,
SQLULEN value)
@@ -665,6 +663,7 @@ SQLRETURN SQL_API SQLColumnPrivileges(SQLHSTMT stmt,
return SQL_SUCCESS;
}
+/*
SQLRETURN SQL_API SQLDescribeParam(SQLHSTMT stmt,
SQLUSMALLINT paramNum,
SQLSMALLINT* dataType,
@@ -675,6 +674,7 @@ SQLRETURN SQL_API SQLDescribeParam(SQLHSTMT stmt,
LOG_MSG("SQLDescribeParam called\n");
return SQL_SUCCESS;
}
+*/
SQLRETURN SQL_API SQLParamOptions(SQLHSTMT stmt,
SQLULEN paramSetSize,
[4/5] ignite git commit: Merge branch 'ignite-1.6.9' into ignite-1.7.2
Posted by pt...@apache.org.
Merge branch 'ignite-1.6.9' into ignite-1.7.2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bbc97580
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bbc97580
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bbc97580
Branch: refs/heads/master
Commit: bbc97580492609e2e4fc3d92b08b4740b984d78f
Parents: 4f9ac81 350e846
Author: isapego <is...@gridgain.com>
Authored: Mon Sep 26 20:17:43 2016 +0300
Committer: isapego <is...@gridgain.com>
Committed: Mon Sep 26 20:17:43 2016 +0300
----------------------------------------------------------------------
.../src/application_data_buffer_test.cpp | 129 ++++---
.../platforms/cpp/odbc-test/src/column_test.cpp | 10 +-
.../cpp/odbc-test/src/queries_test.cpp | 143 +++++++-
.../platforms/cpp/odbc-test/src/row_test.cpp | 4 +-
modules/platforms/cpp/odbc/Makefile.am | 3 +-
.../platforms/cpp/odbc/include/ignite/odbc.h | 6 +-
.../ignite/odbc/app/application_data_buffer.h | 58 +++-
.../odbc/include/ignite/odbc/app/parameter.h | 27 +-
.../cpp/odbc/include/ignite/odbc/common_types.h | 18 +-
.../include/ignite/odbc/config/configuration.h | 17 +-
.../cpp/odbc/include/ignite/odbc/statement.h | 58 +++-
.../platforms/cpp/odbc/project/vs/module.def | 1 -
.../platforms/cpp/odbc/project/vs/odbc.vcxproj | 2 +-
.../odbc/src/app/application_data_buffer.cpp | 343 ++++++++++++++-----
.../platforms/cpp/odbc/src/app/parameter.cpp | 126 ++++++-
modules/platforms/cpp/odbc/src/common_types.cpp | 3 +
.../cpp/odbc/src/config/configuration.cpp | 27 ++
.../cpp/odbc/src/config/connection_info.cpp | 35 +-
modules/platforms/cpp/odbc/src/connection.cpp | 2 +-
.../odbc/src/diagnostic/diagnostic_record.cpp | 18 +
modules/platforms/cpp/odbc/src/entry_points.cpp | 30 +-
modules/platforms/cpp/odbc/src/odbc.cpp | 45 ++-
modules/platforms/cpp/odbc/src/statement.cpp | 150 +++++++-
.../NuGet/LINQPad/PutGetExample.linq | 2 +-
.../NuGet/LINQPad/QueryExample.linq | 6 +-
.../NuGet/LINQPad/QueryExample.linq | 4 +-
26 files changed, 1000 insertions(+), 267 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bbc97580/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc-test/src/queries_test.cpp
index a82ab7e,f0168bd..73d57c9
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@@ -562,131 -543,128 +570,254 @@@ BOOST_AUTO_TEST_CASE(TestOneRowStringLe
BOOST_CHECK(ret == SQL_NO_DATA);
}
+ BOOST_AUTO_TEST_CASE(TestDataAtExecution)
+ {
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache");
+
+ SQLRETURN ret;
+
+ TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
+ BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+
+ TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), BinaryUtils::MakeDateGmt(1976, 1, 12),
+ BinaryUtils::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 999999999));
+
+ testCache.Put(1, in1);
+ testCache.Put(2, in2);
+
+ const size_t columnsCnt = 11;
+
+ SQLLEN columnLens[columnsCnt] = { 0 };
+ SQLCHAR columns[columnsCnt][ODBC_BUFFER_SIZE] = { 0 };
+
+ // Binding columns.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ {
+ ret = SQLBindCol(stmt, i + 1, SQL_C_CHAR, &columns[i], ODBC_BUFFER_SIZE, &columnLens[i]);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ }
+
+ SQLCHAR request[] = "SELECT i8Field, i16Field, i32Field, i64Field, strField, "
+ "floatField, doubleField, boolField, guidField, dateField, timestampField FROM TestType "
+ "WHERE i32Field = ? AND strField = ?";
+
+ ret = SQLPrepare(stmt, request, SQL_NTS);
+
+ SQLLEN ind1 = 1;
+ SQLLEN ind2 = 2;
+
+ SQLLEN len1 = SQL_DATA_AT_EXEC;
+ SQLLEN len2 = SQL_LEN_DATA_AT_EXEC(static_cast<SQLLEN>(in1.strField.size()));
+
+ ret = SQLBindParam(stmt, 1, SQL_C_SLONG, SQL_INTEGER, 100, 100, &ind1, &len1);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindParam(stmt, 2, SQL_C_CHAR, SQL_VARCHAR, 100, 100, &ind2, &len2);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLExecute(stmt);
+
+ BOOST_REQUIRE_EQUAL(ret, SQL_NEED_DATA);
+
+ void* oind;
+
+ ret = SQLParamData(stmt, &oind);
+
+ BOOST_REQUIRE_EQUAL(ret, SQL_NEED_DATA);
+
+ if (oind == &ind1)
+ ret = SQLPutData(stmt, &in1.i32Field, 0);
+ else if (oind == &ind2)
+ ret = SQLPutData(stmt, (SQLPOINTER)in1.strField.c_str(), (SQLLEN)in1.strField.size());
+ else
+ BOOST_FAIL("Unknown indicator value");
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLParamData(stmt, &oind);
+
+ BOOST_REQUIRE_EQUAL(ret, SQL_NEED_DATA);
+
+ if (oind == &ind1)
+ ret = SQLPutData(stmt, &in1.i32Field, 0);
+ else if (oind == &ind2)
+ ret = SQLPutData(stmt, (SQLPOINTER)in1.strField.c_str(), (SQLLEN)in1.strField.size());
+ else
+ BOOST_FAIL("Unknown indicator value");
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLParamData(stmt, &oind);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLFetch(stmt);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[0])), "1");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[1])), "2");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[2])), "3");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[3])), "4");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[4])), "5");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[5])), "6");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[6])), "7");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[7])), "1");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[8])), "00000000-0000-0008-0000-000000000009");
+ // Such format is used because Date returned as Timestamp.
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[9])), "1987-06-05 00:00:00");
+ BOOST_CHECK_EQUAL(std::string(reinterpret_cast<char*>(columns[10])), "1998-12-27 01:02:03");
+
+ BOOST_CHECK_EQUAL(columnLens[0], 1);
+ BOOST_CHECK_EQUAL(columnLens[1], 1);
+ BOOST_CHECK_EQUAL(columnLens[2], 1);
+ BOOST_CHECK_EQUAL(columnLens[3], 1);
+ BOOST_CHECK_EQUAL(columnLens[4], 1);
+ BOOST_CHECK_EQUAL(columnLens[5], 1);
+ BOOST_CHECK_EQUAL(columnLens[6], 1);
+ BOOST_CHECK_EQUAL(columnLens[7], 1);
+ BOOST_CHECK_EQUAL(columnLens[8], 36);
+ BOOST_CHECK_EQUAL(columnLens[9], 19);
+ BOOST_CHECK_EQUAL(columnLens[10], 19);
+
+ ret = SQLFetch(stmt);
+ BOOST_CHECK(ret == SQL_NO_DATA);
+ }
+
+BOOST_AUTO_TEST_CASE(TestDistributedJoins)
+{
+ // Starting additional node.
+ Ignite node1 = StartAdditionalNode("Node1");
+ Ignite node2 = StartAdditionalNode("Node2");
+
+ const int entriesNum = 1000;
+
+ // Filling cache with data.
+ for (int i = 0; i < entriesNum; ++i)
+ {
+ TestType entry;
+
+ entry.i32Field = i;
+ entry.i64Field = entriesNum - i - 1;
+
+ testCache.Put(i, entry);
+ }
+
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache");
+
+ SQLRETURN ret;
+
+ const size_t columnsCnt = 2;
+
+ SQLBIGINT columns[columnsCnt] = { 0 };
+
+ // Binding colums.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ {
+ ret = SQLBindCol(stmt, i + 1, SQL_C_SLONG, &columns[i], 0, 0);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ }
+
+ SQLCHAR request[] =
+ "SELECT T0.i32Field, T1.i64Field FROM TestType AS T0 "
+ "INNER JOIN TestType AS T1 "
+ "ON (T0.i32Field = T1.i64Field)";
+
+ ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ int rowsNum = CountRows(stmt);
+
+ BOOST_CHECK_GT(rowsNum, 0);
+ BOOST_CHECK_LT(rowsNum, entriesNum);
+
+ Disconnect();
+
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache;DISTRIBUTED_JOINS=true;");
+
+ // Binding colums.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ {
+ ret = SQLBindCol(stmt, i + 1, SQL_C_SLONG, &columns[i], 0, 0);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ }
+
+ ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ rowsNum = CountRows(stmt);
+
+ BOOST_CHECK_EQUAL(rowsNum, entriesNum);
+}
+
+BOOST_AUTO_TEST_CASE(TestDistributedJoinsWithOldVersion)
+{
+ // Starting additional node.
+ Ignite node1 = StartAdditionalNode("Node1");
+ Ignite node2 = StartAdditionalNode("Node2");
+
+ const int entriesNum = 1000;
+
+ // Filling cache with data.
+ for (int i = 0; i < entriesNum; ++i)
+ {
+ TestType entry;
+
+ entry.i32Field = i;
+ entry.i64Field = entriesNum - i - 1;
+
+ testCache.Put(i, entry);
+ }
+
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache;DISTRIBUTED_JOINS=true;PROTOCOL_VERSION=1.6.0");
+
+ SQLRETURN ret;
+
+ const size_t columnsCnt = 2;
+
+ SQLBIGINT columns[columnsCnt] = { 0 };
+
+ // Binding colums.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ {
+ ret = SQLBindCol(stmt, i + 1, SQL_C_SLONG, &columns[i], 0, 0);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ }
+
+ SQLCHAR request[] =
+ "SELECT T0.i32Field, T1.i64Field FROM TestType AS T0 "
+ "INNER JOIN TestType AS T1 "
+ "ON (T0.i32Field = T1.i64Field)";
+
+ ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ int rowsNum = CountRows(stmt);
+
+ BOOST_CHECK_GT(rowsNum, 0);
+ BOOST_CHECK_LT(rowsNum, entriesNum);
+}
+
BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/bbc97580/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
index 05a9ec3,4fe4f1b..c0d102b
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
@@@ -269,52 -251,9 +263,49 @@@ namespace ignit
*
* @param address Address.
*/
- void SetAddress(const std::string& address)
- {
- arguments[Key::address] = address;
- }
+ void SetAddress(const std::string& address);
/**
+ * Check distributed joins flag.
+ *
+ * @return True if distributed joins are enabled.
+ */
+ bool IsDistributedJoins() const
+ {
+ return GetBoolValue(Key::distributedJoins, DefaultValue::distributedJoins);
+ }
+
+ /**
+ * Set distributed joins.
+ *
+ * @param val Value to set.
+ */
+ void SetDistributedJoins(bool val)
+ {
+ SetBoolValue(Key::distributedJoins, val);
+ }
+
+ /**
+ * Check enforce join order flag.
+ *
+ * @return True if enforcing of join order is enabled.
+ */
+ bool IsEnforceJoinOrder() const
+ {
+ return GetBoolValue(Key::enforceJoinOrder, DefaultValue::enforceJoinOrder);
+ }
+
+ /**
+ * Set enforce joins.
+ *
+ * @param val Value to set.
+ */
+ void SetEnforceJoinOrder(bool val)
+ {
+ SetBoolValue(Key::enforceJoinOrder, val);
+ }
+
+ /**
* Get protocol version.
*
* @return Protocol version.
http://git-wip-us.apache.org/repos/asf/ignite/blob/bbc97580/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bbc97580/modules/platforms/cpp/odbc/src/config/configuration.cpp
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bbc97580/modules/platforms/cpp/odbc/src/connection.cpp
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bbc97580/modules/platforms/cpp/odbc/src/odbc.cpp
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc/src/odbc.cpp
index 74d0f9d,9df64d3..a4c750e
--- a/modules/platforms/cpp/odbc/src/odbc.cpp
+++ b/modules/platforms/cpp/odbc/src/odbc.cpp
@@@ -754,7 -753,7 +753,7 @@@ namespace ignit
LOG_MSG("columnSizeRes: %lld\n", columnSizeRes);
LOG_MSG("decimalDigitsRes: %lld\n", decimalDigitsRes);
LOG_MSG("nullableRes: %lld\n", nullableRes);
-- LOG_MSG("columnNameBuf: %s\n", columnNameBuf ? columnNameBuf : "<null>");
++ LOG_MSG("columnNameBuf: %s\n", columnNameBuf ? reinterpret_cast<const char*>(columnNameBuf) : "<null>");
LOG_MSG("columnNameLen: %d\n", columnNameLen ? *columnNameLen : -1);
if (dataType)
[5/5] ignite git commit: Merge remote-tracking branch
'remotes/community/ignite-1.7.2' into UPSTREAM_master
Posted by pt...@apache.org.
Merge remote-tracking branch 'remotes/community/ignite-1.7.2' into UPSTREAM_master
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/62c07972
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/62c07972
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/62c07972
Branch: refs/heads/master
Commit: 62c07972d7160ef48ec84799c65d4367a64c671c
Parents: d9c70a0 bbc9758
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 26 20:22:30 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 26 20:22:30 2016 +0300
----------------------------------------------------------------------
.../src/application_data_buffer_test.cpp | 129 ++++---
.../platforms/cpp/odbc-test/src/column_test.cpp | 10 +-
.../cpp/odbc-test/src/queries_test.cpp | 143 +++++++-
.../platforms/cpp/odbc-test/src/row_test.cpp | 4 +-
modules/platforms/cpp/odbc/Makefile.am | 3 +-
.../platforms/cpp/odbc/include/ignite/odbc.h | 6 +-
.../ignite/odbc/app/application_data_buffer.h | 58 +++-
.../odbc/include/ignite/odbc/app/parameter.h | 27 +-
.../cpp/odbc/include/ignite/odbc/common_types.h | 18 +-
.../include/ignite/odbc/config/configuration.h | 17 +-
.../cpp/odbc/include/ignite/odbc/statement.h | 58 +++-
.../platforms/cpp/odbc/project/vs/module.def | 1 -
.../platforms/cpp/odbc/project/vs/odbc.vcxproj | 2 +-
.../odbc/src/app/application_data_buffer.cpp | 343 ++++++++++++++-----
.../platforms/cpp/odbc/src/app/parameter.cpp | 126 ++++++-
modules/platforms/cpp/odbc/src/common_types.cpp | 3 +
.../cpp/odbc/src/config/configuration.cpp | 27 ++
.../cpp/odbc/src/config/connection_info.cpp | 35 +-
modules/platforms/cpp/odbc/src/connection.cpp | 2 +-
.../odbc/src/diagnostic/diagnostic_record.cpp | 18 +
modules/platforms/cpp/odbc/src/entry_points.cpp | 30 +-
modules/platforms/cpp/odbc/src/odbc.cpp | 45 ++-
modules/platforms/cpp/odbc/src/statement.cpp | 150 +++++++-
.../NuGet/LINQPad/PutGetExample.linq | 2 +-
.../NuGet/LINQPad/QueryExample.linq | 6 +-
.../NuGet/LINQPad/QueryExample.linq | 4 +-
26 files changed, 1000 insertions(+), 267 deletions(-)
----------------------------------------------------------------------