IGNITE-5377: ODBC: Exposed SqlFieldsQuery hints as parameters..
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/97021944 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/97021944 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/97021944 Branch: refs/heads/ignite-2.1.2-exchange Commit: 97021944f9e0167a7a037208f7a1a3e731597d0d Parents: c507152 Author: Igor Sapego <[email protected]> Authored: Tue Jun 20 18:50:44 2017 +0300 Committer: Igor Sapego <[email protected]> Committed: Tue Jun 20 18:50:44 2017 +0300 ---------------------------------------------------------------------- .../processors/odbc/SqlListenerNioListener.java | 4 +- .../odbc/odbc/OdbcRequestHandler.java | 16 +++++- .../cpp/odbc-test/src/configuration_test.cpp | 56 +++++++++++++++----- .../include/ignite/odbc/config/configuration.h | 52 ++++++++++++++++++ .../cpp/odbc/include/ignite/odbc/connection.h | 2 +- .../cpp/odbc/include/ignite/odbc/message.h | 11 +++- .../odbc/system/ui/dsn_configuration_window.h | 8 +++ .../src/system/ui/dsn_configuration_window.cpp | 34 +++++++++++- .../cpp/odbc/src/config/configuration.cpp | 4 ++ modules/platforms/cpp/odbc/src/connection.cpp | 14 +++-- modules/platforms/cpp/odbc/src/dsn_config.cpp | 6 +++ modules/platforms/cpp/odbc/src/message.cpp | 9 +++- 12 files changed, 192 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/97021944/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java index 6bb4e29..a879796 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java @@ -239,9 +239,11 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]> if (clientType == ODBC_CLIENT) { boolean distributedJoins = reader.readBoolean(); boolean enforceJoinOrder = reader.readBoolean(); + boolean replicatedOnly = reader.readBoolean(); + boolean collocated = reader.readBoolean(); SqlListenerRequestHandler handler = new OdbcRequestHandler(ctx, busyLock, maxCursors, distributedJoins, - enforceJoinOrder); + enforceJoinOrder, replicatedOnly, collocated); SqlListenerMessageParser parser = new OdbcMessageParser(ctx); http://git-wip-us.apache.org/repos/asf/ignite/blob/97021944/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java index 46f6ace..bb54b59 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java @@ -80,22 +80,32 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler { /** Enforce join order flag. */ private final boolean enforceJoinOrder; + /** Replicated only flag. */ + private final boolean replicatedOnly; + + /** Collocated flag. */ + private final boolean collocated; + /** * Constructor. - * * @param ctx Context. * @param busyLock Shutdown latch. * @param maxCursors Maximum allowed cursors. * @param distributedJoins Distributed joins flag. * @param enforceJoinOrder Enforce join order flag. + * @param replicatedOnly Replicated only flag. + * @param collocated Collocated flag. */ public OdbcRequestHandler(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors, - boolean distributedJoins, boolean enforceJoinOrder) { + boolean distributedJoins, boolean enforceJoinOrder, boolean replicatedOnly, + boolean collocated) { this.ctx = ctx; this.busyLock = busyLock; this.maxCursors = maxCursors; this.distributedJoins = distributedJoins; this.enforceJoinOrder = enforceJoinOrder; + this.replicatedOnly = replicatedOnly; + this.collocated = collocated; log = ctx.log(getClass()); } @@ -175,6 +185,8 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler { qry.setDistributedJoins(distributedJoins); qry.setEnforceJoinOrder(enforceJoinOrder); + qry.setReplicatedOnly(replicatedOnly); + qry.setCollocated(collocated); qry.setSchema(req.schema()); QueryCursor qryCur = ctx.query().querySqlFieldsNoCache(qry, true); http://git-wip-us.apache.org/repos/asf/ignite/blob/97021944/modules/platforms/cpp/odbc-test/src/configuration_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp index a2cd280..d00d8b3 100644 --- a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp @@ -40,10 +40,20 @@ namespace const int32_t testPageSize = 4321; const bool testDistributedJoins = true; const bool testEnforceJoinOrder = true; + const bool testReplicatedOnly = true; + const bool testCollocated = true; const std::string testAddress = testServerHost + ':' + ignite::common::LexicalCast<std::string>(testServerPort); } +const char* BoolToStr(bool val, bool lowerCase = true) +{ + if (lowerCase) + return val ? "true" : "false"; + + return val ? "TRUE" : "FALSE"; +} + void CheckValidAddress(const char* connectStr, uint16_t port) { Configuration cfg; @@ -118,14 +128,18 @@ void CheckConnectionConfig(const Configuration& cfg) BOOST_CHECK_EQUAL(cfg.GetPageSize(), testPageSize); BOOST_CHECK_EQUAL(cfg.IsDistributedJoins(), testDistributedJoins); BOOST_CHECK_EQUAL(cfg.IsEnforceJoinOrder(), testEnforceJoinOrder); + BOOST_CHECK_EQUAL(cfg.IsReplicatedOnly(), testReplicatedOnly); + BOOST_CHECK_EQUAL(cfg.IsCollocated(), testCollocated); std::stringstream constructor; constructor << "address=" << testAddress << ';' - << "distributed_joins=" << (testDistributedJoins ? "true" : "false") << ';' + << "collocated=" << BoolToStr(testCollocated) << ';' + << "distributed_joins=" << BoolToStr(testDistributedJoins) << ';' << "driver={" << testDriverName << "};" - << "enforce_join_order=" << (testEnforceJoinOrder ? "true" : "false") << ';' + << "enforce_join_order=" << BoolToStr(testEnforceJoinOrder) << ';' << "page_size=" << testPageSize << ';' + << "replicated_only=" << BoolToStr(testReplicatedOnly) << ';' << "schema=" << testSchemaName << ';'; const std::string& expectedStr = constructor.str(); @@ -144,6 +158,8 @@ void CheckDsnConfig(const Configuration& cfg) BOOST_CHECK_EQUAL(cfg.GetPageSize(), Configuration::DefaultValue::pageSize); BOOST_CHECK_EQUAL(cfg.IsDistributedJoins(), false); BOOST_CHECK_EQUAL(cfg.IsEnforceJoinOrder(), false); + BOOST_CHECK_EQUAL(cfg.IsReplicatedOnly(), false); + BOOST_CHECK_EQUAL(cfg.IsCollocated(), false); } BOOST_AUTO_TEST_SUITE(ConfigurationTestSuite) @@ -158,6 +174,8 @@ BOOST_AUTO_TEST_CASE(CheckTestValuesNotEquealDefault) BOOST_CHECK_NE(testPageSize, Configuration::DefaultValue::pageSize); BOOST_CHECK_NE(testDistributedJoins, Configuration::DefaultValue::distributedJoins); BOOST_CHECK_NE(testEnforceJoinOrder, Configuration::DefaultValue::enforceJoinOrder); + BOOST_CHECK_NE(testReplicatedOnly, Configuration::DefaultValue::replicatedOnly); + BOOST_CHECK_NE(testCollocated, Configuration::DefaultValue::collocated); } BOOST_AUTO_TEST_CASE(TestConnectStringUppercase) @@ -168,8 +186,10 @@ BOOST_AUTO_TEST_CASE(TestConnectStringUppercase) constructor << "DRIVER={" << testDriverName << "};" << "ADDRESS=" << testAddress << ';' - << "DISTRIBUTED_JOINS=" << (testDistributedJoins ? "TRUE" : "FALSE") << ';' - << "ENFORCE_JOIN_ORDER=" << (testEnforceJoinOrder ? "TRUE" : "FALSE") << ';' + << "DISTRIBUTED_JOINS=" << BoolToStr(testDistributedJoins, false) << ';' + << "ENFORCE_JOIN_ORDER=" << BoolToStr(testEnforceJoinOrder, false) << ';' + << "COLLOCATED=" << BoolToStr(testCollocated, false) << ';' + << "REPLICATED_ONLY=" << BoolToStr(testReplicatedOnly, false) << ';' << "PAGE_SIZE=" << testPageSize << ';' << "SCHEMA=" << testSchemaName; @@ -189,8 +209,10 @@ BOOST_AUTO_TEST_CASE(TestConnectStringLowercase) constructor << "driver={" << testDriverName << "};" << "address=" << testAddress << ';' << "page_size=" << testPageSize << ';' - << "distributed_joins=" << (testDistributedJoins ? "true" : "false") << ';' - << "enforce_join_order=" << (testEnforceJoinOrder ? "true" : "false") << ';' + << "distributed_joins=" << BoolToStr(testDistributedJoins) << ';' + << "enforce_join_order=" << BoolToStr(testEnforceJoinOrder) << ';' + << "replicated_only=" << BoolToStr(testReplicatedOnly) << ';' + << "collocated=" << BoolToStr(testCollocated) << ';' << "schema=" << testSchemaName; const std::string& connectStr = constructor.str(); @@ -209,8 +231,10 @@ BOOST_AUTO_TEST_CASE(TestConnectStringZeroTerminated) constructor << "driver={" << testDriverName << "};" << "address=" << testAddress << ';' << "page_size=" << testPageSize << ';' - << "distributed_joins=" << (testDistributedJoins ? "true" : "false") << ';' - << "enforce_join_order=" << (testEnforceJoinOrder ? "true" : "false") << ';' + << "replicated_only=" << BoolToStr(testReplicatedOnly) << ';' + << "collocated=" << BoolToStr(testCollocated) << ';' + << "distributed_joins=" << BoolToStr(testDistributedJoins) << ';' + << "enforce_join_order=" << BoolToStr(testEnforceJoinOrder) << ';' << "schema=" << testSchemaName; const std::string& connectStr = constructor.str(); @@ -229,8 +253,10 @@ BOOST_AUTO_TEST_CASE(TestConnectStringMixed) constructor << "Driver={" << testDriverName << "};" << "Address=" << testAddress << ';' << "Page_Size=" << testPageSize << ';' - << "Distributed_Joins=" << (testDistributedJoins ? "True" : "False") << ';' - << "Enforce_Join_Order=" << (testEnforceJoinOrder ? "True" : "False") << ';' + << "Distributed_Joins=" << BoolToStr(testDistributedJoins, false) << ';' + << "Enforce_Join_Order=" << BoolToStr(testEnforceJoinOrder) << ';' + << "Replicated_Only=" << BoolToStr(testReplicatedOnly, false) << ';' + << "Collocated=" << BoolToStr(testCollocated) << ';' << "Schema=" << testSchemaName; const std::string& connectStr = constructor.str(); @@ -249,8 +275,10 @@ BOOST_AUTO_TEST_CASE(TestConnectStringWhitepaces) constructor << "DRIVER = {" << testDriverName << "} ;\n" << " ADDRESS =" << testAddress << "; " << " PAGE_SIZE= " << testPageSize << ';' - << " DISTRIBUTED_JOINS=" << (testDistributedJoins ? "TRUE" : "FALSE") << ';' - << "ENFORCE_JOIN_ORDER= " << (testEnforceJoinOrder ? "TRUE " : "FALSE ") << ';' + << " DISTRIBUTED_JOINS=" << BoolToStr(testDistributedJoins, false) << ';' + << "COLLOCATED =" << BoolToStr(testCollocated, false) << " ;" + << " REPLICATED_ONLY= " << BoolToStr(testReplicatedOnly, false) << ';' + << "ENFORCE_JOIN_ORDER= " << BoolToStr(testEnforceJoinOrder, false) << " ;" << "SCHEMA = \n\r" << testSchemaName; const std::string& connectStr = constructor.str(); @@ -318,6 +346,8 @@ BOOST_AUTO_TEST_CASE(TestConnectStringInvalidBoolKeys) keys.insert("distributed_joins"); keys.insert("enforce_join_order"); + keys.insert("replicated_only"); + keys.insert("collocated"); for (Set::const_iterator it = keys.begin(); it != keys.end(); ++it) { @@ -342,6 +372,8 @@ BOOST_AUTO_TEST_CASE(TestConnectStringValidBoolKeys) keys.insert("distributed_joins"); keys.insert("enforce_join_order"); + keys.insert("replicated_only"); + keys.insert("collocated"); for (Set::const_iterator it = keys.begin(); it != keys.end(); ++it) { http://git-wip-us.apache.org/repos/asf/ignite/blob/97021944/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 5850d50..e024275 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h @@ -73,6 +73,12 @@ namespace ignite /** Connection attribute keyword for fetch results page size attribute. */ static const std::string pageSize; + + /** Connection attribute keyword for replicated only attribute. */ + static const std::string replicatedOnly; + + /** Connection attribute keyword for collocated attribute. */ + static const std::string collocated; }; /** Default values for configuration. */ @@ -107,6 +113,12 @@ namespace ignite /** Default value for enforce join order attribute. */ static const bool enforceJoinOrder; + + /** Default value for replicated only attribute. */ + static const bool replicatedOnly; + + /** Default value for collocated attribute. */ + static const bool collocated; }; /** @@ -306,6 +318,46 @@ namespace ignite } /** + * Check replicated only flag. + * + * @return True if replicated only is enabled. + */ + bool IsReplicatedOnly() const + { + return GetBoolValue(Key::replicatedOnly, DefaultValue::replicatedOnly); + } + + /** + * Set replicated only flag. + * + * @param val Value to set. + */ + void SetReplicatedOnly(bool val) + { + SetBoolValue(Key::replicatedOnly, val); + } + + /** + * Check collocated flag. + * + * @return True if collocated is enabled. + */ + bool IsCollocated() const + { + return GetBoolValue(Key::collocated, DefaultValue::collocated); + } + + /** + * Set collocated. + * + * @param val Value to set. + */ + void SetCollocated(bool val) + { + SetBoolValue(Key::collocated, val); + } + + /** * Get protocol version. * * @return Protocol version. http://git-wip-us.apache.org/repos/asf/ignite/blob/97021944/modules/platforms/cpp/odbc/include/ignite/odbc/connection.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/connection.h b/modules/platforms/cpp/odbc/include/ignite/odbc/connection.h index 1f91767..da19e1b 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/connection.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/connection.h @@ -207,7 +207,7 @@ namespace ignite * Create statement associated with the connection. * Internal call. * - * @param Pointer to valid instance on success and NULL on failure. + * @param statement Pointer to valid instance on success and NULL on failure. * @return Operation result. */ SqlResult::Type InternalCreateStatement(Statement*& statement); http://git-wip-us.apache.org/repos/asf/ignite/blob/97021944/modules/platforms/cpp/odbc/include/ignite/odbc/message.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/message.h b/modules/platforms/cpp/odbc/include/ignite/odbc/message.h index 1a1cac2..c6df0c9 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/message.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/message.h @@ -86,8 +86,11 @@ namespace ignite * @param version Protocol version. * @param distributedJoins Distributed joins flag. * @param enforceJoinOrder Enforce join order flag. + * @param replicatedOnly Replicated only flag. + * @param collocated Collocated flag. */ - HandshakeRequest(const ProtocolVersion& version, bool distributedJoins, bool enforceJoinOrder); + HandshakeRequest(const ProtocolVersion& version, bool distributedJoins, bool enforceJoinOrder, + bool replicatedOnly, bool collocated); /** * Destructor. @@ -109,6 +112,12 @@ namespace ignite /** Enforce join order flag. */ bool enforceJoinOrder; + + /** Replicated only flag. */ + bool replicatedOnly; + + /** Collocated flag. */ + bool collocated; }; /** http://git-wip-us.apache.org/repos/asf/ignite/blob/97021944/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h b/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h index 46d00cf..87f5806 100644 --- a/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h +++ b/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h @@ -52,6 +52,8 @@ namespace ignite PAGE_SIZE_LABEL, DISTRIBUTED_JOINS_CHECK_BOX, ENFORCE_JOIN_ORDER_CHECK_BOX, + REPLICATED_ONLY_CHECK_BOX, + COLLOCATED_CHECK_BOX, PROTOCOL_VERSION_LABEL, PROTOCOL_VERSION_COMBO_BOX, OK_BUTTON, @@ -137,6 +139,12 @@ namespace ignite /** Enforce join order CheckBox. */ std::auto_ptr<Window> enforceJoinOrderCheckBox; + /** Replicated only CheckBox. */ + std::auto_ptr<Window> replicatedOnlyCheckBox; + + /** Collocated CheckBox. */ + std::auto_ptr<Window> collocatedCheckBox; + /** Protocol version edit field. */ std::auto_ptr<Window> protocolVersionLabel; http://git-wip-us.apache.org/repos/asf/ignite/blob/97021944/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp b/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp index ffb7120..c8bb9f8 100644 --- a/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp +++ b/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp @@ -32,7 +32,7 @@ namespace ignite DsnConfigurationWindow::DsnConfigurationWindow(Window* parent, config::Configuration& config): CustomWindow(parent, "IgniteConfigureDsn", "Configure Apache Ignite DSN"), width(360), - height(270), + height(280), connectionSettingsGroupBox(), nameLabel(), nameEdit(), @@ -44,6 +44,8 @@ namespace ignite pageSizeEdit(), distributedJoinsCheckBox(), enforceJoinOrderCheckBox(), + replicatedOnlyCheckBox(), + collocatedCheckBox(), protocolVersionLabel(), protocolVersionComboBox(), okButton(), @@ -159,6 +161,14 @@ namespace ignite enforceJoinOrderCheckBox = CreateCheckBox(editPosX + checkBoxSize + interval, rowPos, checkBoxSize, rowSize, "Enforce Join Order", ChildId::ENFORCE_JOIN_ORDER_CHECK_BOX, config.IsEnforceJoinOrder()); + rowPos += rowSize; + + replicatedOnlyCheckBox = CreateCheckBox(editPosX, rowPos, checkBoxSize, rowSize, + "Replicated Only", ChildId::REPLICATED_ONLY_CHECK_BOX, config.IsReplicatedOnly()); + + collocatedCheckBox = CreateCheckBox(editPosX + checkBoxSize + interval, rowPos, checkBoxSize, + rowSize, "Collocated", ChildId::COLLOCATED_CHECK_BOX, config.IsCollocated()); + rowPos += interval * 2 + rowSize; connectionSettingsGroupBox = CreateGroupBox(margin, sectionBegin, width - 2 * margin, @@ -222,6 +232,20 @@ namespace ignite break; } + case ChildId::REPLICATED_ONLY_CHECK_BOX: + { + replicatedOnlyCheckBox->SetChecked(!replicatedOnlyCheckBox->IsChecked()); + + break; + } + + case ChildId::COLLOCATED_CHECK_BOX: + { + collocatedCheckBox->SetChecked(!collocatedCheckBox->IsChecked()); + + break; + } + case ChildId::PROTOCOL_VERSION_COMBO_BOX: default: return false; @@ -254,6 +278,8 @@ namespace ignite bool distributedJoins; bool enforceJoinOrder; + bool replicatedOnly; + bool collocated; nameEdit->GetText(dsn); addressEdit->GetText(address); @@ -271,6 +297,8 @@ namespace ignite distributedJoins = distributedJoinsCheckBox->IsEnabled() && distributedJoinsCheckBox->IsChecked(); enforceJoinOrder = enforceJoinOrderCheckBox->IsEnabled() && enforceJoinOrderCheckBox->IsChecked(); + replicatedOnly = replicatedOnlyCheckBox->IsEnabled() && replicatedOnlyCheckBox->IsChecked(); + collocated = collocatedCheckBox->IsEnabled() && collocatedCheckBox->IsChecked(); LOG_MSG("Retriving arguments:"); LOG_MSG("DSN: " << dsn); @@ -280,6 +308,8 @@ namespace ignite LOG_MSG("Protocol version: " << version); LOG_MSG("Distributed Joins: " << (distributedJoins ? "true" : "false")); LOG_MSG("Enforce Join Order: " << (enforceJoinOrder ? "true" : "false")); + LOG_MSG("Replicated only: " << (replicatedOnly ? "true" : "false")); + LOG_MSG("Collocated: " << (collocated ? "true" : "false")); if (dsn.empty()) throw IgniteError(IgniteError::IGNITE_ERR_GENERIC, "DSN name can not be empty."); @@ -291,6 +321,8 @@ namespace ignite cfg.SetProtocolVersion(version); cfg.SetDistributedJoins(distributedJoins); cfg.SetEnforceJoinOrder(enforceJoinOrder); + cfg.SetReplicatedOnly(replicatedOnly); + cfg.SetCollocated(collocated); } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/97021944/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 854cb2b..1863197 100644 --- a/modules/platforms/cpp/odbc/src/config/configuration.cpp +++ b/modules/platforms/cpp/odbc/src/config/configuration.cpp @@ -42,6 +42,8 @@ namespace ignite const std::string Configuration::Key::enforceJoinOrder = "enforce_join_order"; const std::string Configuration::Key::protocolVersion = "protocol_version"; const std::string Configuration::Key::pageSize = "page_size"; + const std::string Configuration::Key::replicatedOnly = "replicated_only"; + const std::string Configuration::Key::collocated = "collocated"; const std::string Configuration::DefaultValue::dsn = "Apache Ignite DSN"; const std::string Configuration::DefaultValue::driver = "Apache Ignite"; @@ -54,6 +56,8 @@ namespace ignite const bool Configuration::DefaultValue::distributedJoins = false; const bool Configuration::DefaultValue::enforceJoinOrder = false; + const bool Configuration::DefaultValue::replicatedOnly = false; + const bool Configuration::DefaultValue::collocated = false; const ProtocolVersion& Configuration::DefaultValue::protocolVersion = ProtocolVersion::GetCurrent(); http://git-wip-us.apache.org/repos/asf/ignite/blob/97021944/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 f43a562..d281f3b 100644 --- a/modules/platforms/cpp/odbc/src/connection.cpp +++ b/modules/platforms/cpp/odbc/src/connection.cpp @@ -323,13 +323,17 @@ namespace ignite { bool distributedJoins = false; bool enforceJoinOrder = false; + bool replicatedOnly = false; + bool collocated = false; ProtocolVersion protocolVersion; try { + protocolVersion = config.GetProtocolVersion(); distributedJoins = config.IsDistributedJoins(); enforceJoinOrder = config.IsEnforceJoinOrder(); - protocolVersion = config.GetProtocolVersion(); + replicatedOnly = config.IsReplicatedOnly(); + collocated = config.IsCollocated(); } catch (const IgniteError& err) { @@ -340,12 +344,13 @@ namespace ignite if (!protocolVersion.IsSupported()) { - AddStatusRecord(SqlState::S01S00_INVALID_CONNECTION_STRING_ATTRIBUTE, "Protocol version is not supported: " + protocolVersion.ToString()); + AddStatusRecord(SqlState::S01S00_INVALID_CONNECTION_STRING_ATTRIBUTE, + "Protocol version is not supported: " + protocolVersion.ToString()); return SqlResult::AI_ERROR; } - HandshakeRequest req(protocolVersion, distributedJoins, enforceJoinOrder); + HandshakeRequest req(protocolVersion, distributedJoins, enforceJoinOrder, replicatedOnly, collocated); HandshakeResponse rsp; try @@ -371,7 +376,8 @@ namespace ignite constructor << "Additional info: " << rsp.GetError(); constructor << "Current node Apache Ignite version: " << rsp.GetCurrentVer().ToString() << ", " - << "driver protocol version introduced in version: " << config.GetProtocolVersion().ToString() << "."; + << "driver protocol version introduced in version: " + << config.GetProtocolVersion().ToString() << "."; AddStatusRecord(SqlState::S08001_CANNOT_CONNECT, constructor.str()); http://git-wip-us.apache.org/repos/asf/ignite/blob/97021944/modules/platforms/cpp/odbc/src/dsn_config.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/src/dsn_config.cpp b/modules/platforms/cpp/odbc/src/dsn_config.cpp index cabd06e..9d6e385 100644 --- a/modules/platforms/cpp/odbc/src/dsn_config.cpp +++ b/modules/platforms/cpp/odbc/src/dsn_config.cpp @@ -102,6 +102,10 @@ namespace ignite bool enforceJoinOrder = ReadDsnBool(dsn, Configuration::Key::enforceJoinOrder, config.IsEnforceJoinOrder()); + bool replicatedOnly = ReadDsnBool(dsn, Configuration::Key::replicatedOnly, config.IsReplicatedOnly()); + + bool collocated = ReadDsnBool(dsn, Configuration::Key::collocated, config.IsCollocated()); + std::string version = ReadDsnString(dsn, Configuration::Key::protocolVersion, config.GetProtocolVersion().ToString().c_str()); @@ -116,6 +120,8 @@ namespace ignite config.SetSchema(schema); config.SetDistributedJoins(distributedJoins); config.SetEnforceJoinOrder(enforceJoinOrder); + config.SetReplicatedOnly(replicatedOnly); + config.SetCollocated(collocated); config.SetProtocolVersion(version); config.SetPageSize(pageSize); } http://git-wip-us.apache.org/repos/asf/ignite/blob/97021944/modules/platforms/cpp/odbc/src/message.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/src/message.cpp b/modules/platforms/cpp/odbc/src/message.cpp index c0fddbe..79bf9c2 100644 --- a/modules/platforms/cpp/odbc/src/message.cpp +++ b/modules/platforms/cpp/odbc/src/message.cpp @@ -22,10 +22,13 @@ namespace ignite { namespace odbc { - HandshakeRequest::HandshakeRequest(const ProtocolVersion& version, bool distributedJoins, bool enforceJoinOrder): + HandshakeRequest::HandshakeRequest(const ProtocolVersion& version, bool distributedJoins, + bool enforceJoinOrder, bool replicatedOnly, bool collocated): version(version), distributedJoins(distributedJoins), - enforceJoinOrder(enforceJoinOrder) + enforceJoinOrder(enforceJoinOrder), + replicatedOnly(replicatedOnly), + collocated(collocated) { // No-op. } @@ -47,6 +50,8 @@ namespace ignite writer.WriteBool(distributedJoins); writer.WriteBool(enforceJoinOrder); + writer.WriteBool(replicatedOnly); + writer.WriteBool(collocated); } QueryExecuteRequest::QueryExecuteRequest(const std::string& schema, const std::string& sql, const app::ParameterSet& params):
