http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core-test/src/transactions_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/transactions_test.cpp b/modules/platforms/cpp/core-test/src/transactions_test.cpp index 3bf1ac6..68ab78a 100644 --- a/modules/platforms/cpp/core-test/src/transactions_test.cpp +++ b/modules/platforms/cpp/core-test/src/transactions_test.cpp @@ -187,7 +187,7 @@ BOOST_AUTO_TEST_CASE(TransactionRollbackOnly) tx.Close(); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_ROLLED_BACK, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::ROLLED_BACK, tx.GetState()); BOOST_CHECK(tx.IsRollbackOnly()); BOOST_CHECK_EQUAL(1, cache.Get(1)); @@ -207,55 +207,55 @@ BOOST_AUTO_TEST_CASE(TransactionAttributes) Transaction tx = transactions.GetTx(); BOOST_REQUIRE(!tx.IsValid()); - tx = transactions.TxStart(IGNITE_TX_CONCURRENCY_OPTIMISTIC, - IGNITE_TX_ISOLATION_SERIALIZABLE, 1000, 100); + tx = transactions.TxStart(TransactionConcurrency::OPTIMISTIC, + TransactionIsolation::SERIALIZABLE, 1000, 100); BOOST_REQUIRE(transactions.GetTx().IsValid()); - BOOST_CHECK_EQUAL(IGNITE_TX_CONCURRENCY_OPTIMISTIC, tx.GetConcurrency()); - BOOST_CHECK_EQUAL(IGNITE_TX_ISOLATION_SERIALIZABLE, tx.GetIsolation()); + BOOST_CHECK_EQUAL(TransactionConcurrency::OPTIMISTIC, tx.GetConcurrency()); + BOOST_CHECK_EQUAL(TransactionIsolation::SERIALIZABLE, tx.GetIsolation()); BOOST_CHECK_EQUAL(1000, tx.GetTimeout()); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_ACTIVE, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::ACTIVE, tx.GetState()); tx.Commit(); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_COMMITTED, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::COMMITTED, tx.GetState()); tx = transactions.GetTx(); BOOST_CHECK(!tx.IsValid()); - tx = transactions.TxStart(IGNITE_TX_CONCURRENCY_PESSIMISTIC, - IGNITE_TX_ISOLATION_READ_COMMITTED, 2000, 10); + tx = transactions.TxStart(TransactionConcurrency::PESSIMISTIC, + TransactionIsolation::READ_COMMITTED, 2000, 10); BOOST_REQUIRE(transactions.GetTx().IsValid()); - BOOST_CHECK_EQUAL(IGNITE_TX_CONCURRENCY_PESSIMISTIC, tx.GetConcurrency()); - BOOST_CHECK_EQUAL(IGNITE_TX_ISOLATION_READ_COMMITTED, tx.GetIsolation()); + BOOST_CHECK_EQUAL(TransactionConcurrency::PESSIMISTIC, tx.GetConcurrency()); + BOOST_CHECK_EQUAL(TransactionIsolation::READ_COMMITTED, tx.GetIsolation()); BOOST_CHECK_EQUAL(2000, tx.GetTimeout()); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_ACTIVE, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::ACTIVE, tx.GetState()); tx.Rollback(); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_ROLLED_BACK, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::ROLLED_BACK, tx.GetState()); tx = transactions.GetTx(); BOOST_CHECK(!tx.IsValid()); - tx = transactions.TxStart(IGNITE_TX_CONCURRENCY_OPTIMISTIC, - IGNITE_TX_ISOLATION_REPEATABLE_READ, 3000, 0); + tx = transactions.TxStart(TransactionConcurrency::OPTIMISTIC, + TransactionIsolation::REPEATABLE_READ, 3000, 0); BOOST_REQUIRE(transactions.GetTx().IsValid()); - BOOST_CHECK_EQUAL(IGNITE_TX_CONCURRENCY_OPTIMISTIC, tx.GetConcurrency()); - BOOST_CHECK_EQUAL(IGNITE_TX_ISOLATION_REPEATABLE_READ, tx.GetIsolation()); + BOOST_CHECK_EQUAL(TransactionConcurrency::OPTIMISTIC, tx.GetConcurrency()); + BOOST_CHECK_EQUAL(TransactionIsolation::REPEATABLE_READ, tx.GetIsolation()); BOOST_CHECK_EQUAL(3000, tx.GetTimeout()); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_ACTIVE, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::ACTIVE, tx.GetState()); tx.Close(); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_ROLLED_BACK, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::ROLLED_BACK, tx.GetState()); tx = transactions.GetTx(); @@ -531,7 +531,7 @@ BOOST_AUTO_TEST_CASE(TransactionRollbackOnlyNe) if (!err.GetCode() == IgniteError::IGNITE_SUCCESS) BOOST_ERROR(err.GetText()); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_ROLLED_BACK, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::ROLLED_BACK, tx.GetState()); BOOST_CHECK(tx.IsRollbackOnly()); BOOST_CHECK_EQUAL(1, cache.Get(1)); @@ -553,64 +553,64 @@ BOOST_AUTO_TEST_CASE(TransactionAttributesNe) Transaction tx = transactions.GetTx(); BOOST_REQUIRE(!tx.IsValid()); - tx = transactions.TxStart(IGNITE_TX_CONCURRENCY_OPTIMISTIC, - IGNITE_TX_ISOLATION_SERIALIZABLE, 1000, 100, err); + tx = transactions.TxStart(TransactionConcurrency::OPTIMISTIC, + TransactionIsolation::SERIALIZABLE, 1000, 100, err); if (!err.GetCode() == IgniteError::IGNITE_SUCCESS) BOOST_ERROR(err.GetText()); BOOST_REQUIRE(transactions.GetTx().IsValid()); - BOOST_CHECK_EQUAL(IGNITE_TX_CONCURRENCY_OPTIMISTIC, tx.GetConcurrency()); - BOOST_CHECK_EQUAL(IGNITE_TX_ISOLATION_SERIALIZABLE, tx.GetIsolation()); + BOOST_CHECK_EQUAL(TransactionConcurrency::OPTIMISTIC, tx.GetConcurrency()); + BOOST_CHECK_EQUAL(TransactionIsolation::SERIALIZABLE, tx.GetIsolation()); BOOST_CHECK_EQUAL(1000, tx.GetTimeout()); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_ACTIVE, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::ACTIVE, tx.GetState()); tx.Commit(); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_COMMITTED, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::COMMITTED, tx.GetState()); tx = transactions.GetTx(); BOOST_CHECK(!tx.IsValid()); - tx = transactions.TxStart(IGNITE_TX_CONCURRENCY_PESSIMISTIC, - IGNITE_TX_ISOLATION_READ_COMMITTED, 2000, 10, err); + tx = transactions.TxStart(TransactionConcurrency::PESSIMISTIC, + TransactionIsolation::READ_COMMITTED, 2000, 10, err); if (!err.GetCode() == IgniteError::IGNITE_SUCCESS) BOOST_ERROR(err.GetText()); BOOST_REQUIRE(transactions.GetTx().IsValid()); - BOOST_CHECK_EQUAL(IGNITE_TX_CONCURRENCY_PESSIMISTIC, tx.GetConcurrency()); - BOOST_CHECK_EQUAL(IGNITE_TX_ISOLATION_READ_COMMITTED, tx.GetIsolation()); + BOOST_CHECK_EQUAL(TransactionConcurrency::PESSIMISTIC, tx.GetConcurrency()); + BOOST_CHECK_EQUAL(TransactionIsolation::READ_COMMITTED, tx.GetIsolation()); BOOST_CHECK_EQUAL(2000, tx.GetTimeout()); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_ACTIVE, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::ACTIVE, tx.GetState()); tx.Rollback(); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_ROLLED_BACK, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::ROLLED_BACK, tx.GetState()); tx = transactions.GetTx(); BOOST_CHECK(!tx.IsValid()); - tx = transactions.TxStart(IGNITE_TX_CONCURRENCY_OPTIMISTIC, - IGNITE_TX_ISOLATION_REPEATABLE_READ, 3000, 0, err); + tx = transactions.TxStart(TransactionConcurrency::OPTIMISTIC, + TransactionIsolation::REPEATABLE_READ, 3000, 0, err); if (!err.GetCode() == IgniteError::IGNITE_SUCCESS) BOOST_ERROR(err.GetText()); BOOST_REQUIRE(transactions.GetTx().IsValid()); - BOOST_CHECK_EQUAL(IGNITE_TX_CONCURRENCY_OPTIMISTIC, tx.GetConcurrency()); - BOOST_CHECK_EQUAL(IGNITE_TX_ISOLATION_REPEATABLE_READ, tx.GetIsolation()); + BOOST_CHECK_EQUAL(TransactionConcurrency::OPTIMISTIC, tx.GetConcurrency()); + BOOST_CHECK_EQUAL(TransactionIsolation::REPEATABLE_READ, tx.GetIsolation()); BOOST_CHECK_EQUAL(3000, tx.GetTimeout()); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_ACTIVE, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::ACTIVE, tx.GetState()); tx.Close(); - BOOST_CHECK_EQUAL(IGNITE_TX_STATE_ROLLED_BACK, tx.GetState()); + BOOST_CHECK_EQUAL(TransactionState::ROLLED_BACK, tx.GetState()); tx = transactions.GetTx();
http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/include/ignite/cache/cache.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/cache/cache.h b/modules/platforms/cpp/core/include/ignite/cache/cache.h index 33fffc8..e37e806 100644 --- a/modules/platforms/cpp/core/include/ignite/cache/cache.h +++ b/modules/platforms/cpp/core/include/ignite/cache/cache.h @@ -95,7 +95,7 @@ namespace ignite /** * Checks whether this cache contains no key-value mappings. - * Semantically equals to Cache.Size(IGNITE_PEEK_MODE_PRIMARY) == 0. + * Semantically equals to Cache.Size(CachePeekMode::PRIMARY) == 0. * * This method should only be used on the valid instance. * @@ -114,7 +114,7 @@ namespace ignite /** * Checks whether this cache contains no key-value mappings. - * Semantically equals to Cache.Size(IGNITE_PEEK_MODE_PRIMARY) == 0. + * Semantically equals to Cache.Size(CachePeekMode::PRIMARY) == 0. * * This method should only be used on the valid instance. * @@ -1256,7 +1256,7 @@ namespace ignite */ int32_t LocalSize() { - return LocalSize(IGNITE_PEEK_MODE_ALL); + return LocalSize(CachePeekMode::ALL); } /** @@ -1269,7 +1269,7 @@ namespace ignite */ int32_t LocalSize(IgniteError& err) { - return LocalSize(IGNITE_PEEK_MODE_ALL, err); + return LocalSize(CachePeekMode::ALL, err); } /** @@ -1315,7 +1315,7 @@ namespace ignite */ int32_t Size() { - return Size(ignite::cache::IGNITE_PEEK_MODE_ALL); + return Size(ignite::cache::CachePeekMode::ALL); } /** @@ -1329,7 +1329,7 @@ namespace ignite */ int32_t Size(IgniteError& err) { - return Size(ignite::cache::IGNITE_PEEK_MODE_ALL, err); + return Size(ignite::cache::CachePeekMode::ALL, err); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/include/ignite/cache/cache_peek_mode.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/cache/cache_peek_mode.h b/modules/platforms/cpp/core/include/ignite/cache/cache_peek_mode.h index ef9d031..7edaecb 100644 --- a/modules/platforms/cpp/core/include/ignite/cache/cache_peek_mode.h +++ b/modules/platforms/cpp/core/include/ignite/cache/cache_peek_mode.h @@ -30,45 +30,48 @@ namespace ignite /** * Enumeration of all supported cache peek modes. */ - enum CachePeekMode + struct CachePeekMode { - /** - * Peeks into all available cache storages. - */ - IGNITE_PEEK_MODE_ALL = 0x01, + enum Type + { + /** + * Peeks into all available cache storages. + */ + ALL = 0x01, - /** - * Peek into near cache only (don't peek into partitioned cache). - * In case of LOCAL cache, behaves as IGNITE_PEEK_MODE_ALL mode. - */ - IGNITE_PEEK_MODE_NEAR = 0x02, + /** + * Peek into near cache only (don't peek into partitioned cache). + * In case of LOCAL cache, behaves as CachePeekMode::ALL mode. + */ + NEAR_CACHE = 0x02, - /** - * Peek value from primary copy of partitioned cache only (skip near cache). - * In case of LOCAL cache, behaves as IGNITE_PEEK_MODE_ALL mode. - */ - IGNITE_PEEK_MODE_PRIMARY = 0x04, + /** + * Peek value from primary copy of partitioned cache only (skip near cache). + * In case of LOCAL cache, behaves as CachePeekMode::ALL mode. + */ + PRIMARY = 0x04, - /** - * Peek value from backup copies of partitioned cache only (skip near cache). - * In case of LOCAL cache, behaves as IGNITE_PEEK_MODE_ALL mode. - */ - IGNITE_PEEK_MODE_BACKUP = 0x08, + /** + * Peek value from backup copies of partitioned cache only (skip near cache). + * In case of LOCAL cache, behaves as CachePeekMode::ALL mode. + */ + BACKUP = 0x08, - /** - * Peeks value from the on-heap storage only. - */ - IGNITE_PEEK_MODE_ONHEAP = 0x10, + /** + * Peeks value from the on-heap storage only. + */ + ONHEAP = 0x10, - /** - * Peeks value from the off-heap storage only, without loading off-heap value into cache. - */ - IGNITE_PEEK_MODE_OFFHEAP = 0x20, + /** + * Peeks value from the off-heap storage only, without loading off-heap value into cache. + */ + OFFHEAP = 0x20, - /** - * Peeks value from the swap storage only, without loading swapped value into cache. - */ - IGNITE_PEEK_MODE_SWAP = 0x40 + /** + * Peeks value from the swap storage only, without loading swapped value into cache. + */ + SWAP = 0x40 + }; }; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/include/ignite/ignite_binding.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/ignite_binding.h b/modules/platforms/cpp/core/include/ignite/ignite_binding.h index 70bdedb..344bdf6 100644 --- a/modules/platforms/cpp/core/include/ignite/ignite_binding.h +++ b/modules/platforms/cpp/core/include/ignite/ignite_binding.h @@ -84,7 +84,7 @@ namespace ignite if (im) { - im->RegisterCallback(impl::IgniteBindingImpl::CACHE_ENTRY_PROCESSOR_APPLY, + im->RegisterCallback(impl::IgniteBindingImpl::CallbackType::CACHE_ENTRY_PROCESSOR_APPLY, binary::BinaryType<P>::GetTypeId(), impl::binding::ListenerApply<P, typename P::KeyType, typename P::ValueType, typename P::ReturnType, typename P::ArgumentType>, err); } @@ -110,7 +110,7 @@ namespace ignite if (im) { - im->RegisterCallback(impl::IgniteBindingImpl::CACHE_ENTRY_FILTER_CREATE, + im->RegisterCallback(impl::IgniteBindingImpl::CallbackType::CACHE_ENTRY_FILTER_CREATE, typeId, impl::binding::FilterCreate<F>); } else http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/include/ignite/impl/bindings.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/impl/bindings.h b/modules/platforms/cpp/core/include/ignite/impl/bindings.h index ce77672..c1ada12 100644 --- a/modules/platforms/cpp/core/include/ignite/impl/bindings.h +++ b/modules/platforms/cpp/core/include/ignite/impl/bindings.h @@ -75,13 +75,13 @@ namespace ignite V value; bool exists = reader.TryReadObject<V>(value); - cache::MutableCacheEntryState entryState; + cache::MutableCacheEntryState::Type entryState; R res = procHolder.template Process<R, K, V>(key, value, exists, entryState); writer.WriteInt8(static_cast<int8_t>(entryState)); - if (entryState == cache::ENTRY_STATE_VALUE_SET) + if (entryState == cache::MutableCacheEntryState::VALUE_SET) writer.WriteTopObject(value); writer.WriteTopObject(res); http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/include/ignite/impl/cache/cache_entry_processor_holder.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/cache_entry_processor_holder.h b/modules/platforms/cpp/core/include/ignite/impl/cache/cache_entry_processor_holder.h index decbaa9..a821407 100644 --- a/modules/platforms/cpp/core/include/ignite/impl/cache/cache_entry_processor_holder.h +++ b/modules/platforms/cpp/core/include/ignite/impl/cache/cache_entry_processor_holder.h @@ -31,22 +31,25 @@ namespace ignite /** * Mutable Cache entry state. */ - enum MutableCacheEntryState + struct MutableCacheEntryState { - /** No changes have been committed to entry. */ - ENTRY_STATE_INTACT = 0, + enum Type + { + /** No changes have been committed to entry. */ + INTACT = 0, - /** Value of the entry has been changed. */ - ENTRY_STATE_VALUE_SET = 1, + /** Value of the entry has been changed. */ + VALUE_SET = 1, - /** Entry has been removed from cache. */ - ENTRY_STATE_VALUE_REMOVED = 2, + /** Entry has been removed from cache. */ + VALUE_REMOVED = 2, - /** Error occured. Represented in portable form. */ - ENTRY_STATE_ERR_PORTABLE = 3, + /** Error occured. Represented in binary form. */ + ERR_BINARY = 3, - /** Error occured. Represented in string form. */ - ENTRY_STATE_ERR_STRING = 4 + /** Error occured. Represented in string form. */ + ERR_STRING = 4 + }; }; /** @@ -59,17 +62,17 @@ namespace ignite * @return Cache entry state. */ template<typename V> - MutableCacheEntryState GetMutableCacheEntryState(const V& valueBefore, bool existsBefore, - const V& valueAfter, bool existsAfter) + MutableCacheEntryState::Type GetMutableCacheEntryState(const V& valueBefore, bool existsBefore, + const V& valueAfter, bool existsAfter) { if ((!existsBefore && existsAfter) || (existsBefore && existsAfter && !(valueBefore == valueAfter))) - return ENTRY_STATE_VALUE_SET; + return MutableCacheEntryState::VALUE_SET; if (existsBefore && !existsAfter) - return ENTRY_STATE_VALUE_REMOVED; + return MutableCacheEntryState::VALUE_REMOVED; - return ENTRY_STATE_INTACT; + return MutableCacheEntryState::INTACT; } /** @@ -147,7 +150,7 @@ namespace ignite * @return Result of the processing. */ template<typename R, typename K, typename V> - R Process(const K& key, V& value, bool exists, MutableCacheEntryState &state) + R Process(const K& key, V& value, bool exists, MutableCacheEntryState::Type &state) { typedef ignite::cache::MutableCacheEntry<K, V> Entry; http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/include/ignite/impl/ignite_binding_impl.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/impl/ignite_binding_impl.h b/modules/platforms/cpp/core/include/ignite/impl/ignite_binding_impl.h index 7b20c50..a99855a 100644 --- a/modules/platforms/cpp/core/include/ignite/impl/ignite_binding_impl.h +++ b/modules/platforms/cpp/core/include/ignite/impl/ignite_binding_impl.h @@ -43,13 +43,16 @@ namespace ignite typedef int64_t(Callback)(binary::BinaryReaderImpl&, binary::BinaryWriterImpl&, IgniteEnvironment&); public: - enum CallbackType + struct CallbackType { - CACHE_ENTRY_PROCESSOR_APPLY = 1, + enum Type + { + CACHE_ENTRY_PROCESSOR_APPLY = 1, - CACHE_ENTRY_FILTER_CREATE = 2, + CACHE_ENTRY_FILTER_CREATE = 2, - CACHE_ENTRY_FILTER_APPLY = 3, + CACHE_ENTRY_FILTER_APPLY = 3, + }; }; /** http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h b/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h index 0d32561..f9b2b7f 100644 --- a/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h +++ b/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h @@ -36,16 +36,19 @@ namespace ignite /** * Operation result. */ - enum OperationResult + struct OperationResult { - /** Null. */ - ResultNull = 0, + enum Type + { + /** Null. */ + AI_NULL = 0, - /** Success. */ - ResultSuccess = 1, + /** Success. */ + AI_SUCCESS = 1, - /** Error. */ - ResultError = -1 + /** Error. */ + AI_ERROR = -1 + }; }; /** @@ -65,7 +68,7 @@ namespace ignite * Internal out operation. * * @param opType Operation type. - * @param outOp Input. + * @param inOp Input. * @param err Error. * @return Result. */ @@ -129,7 +132,7 @@ namespace ignite * @param err Error. * @return Operation result. */ - OperationResult InStreamOutLong(int32_t opType, InteropMemory& outInMem, IgniteError& err); + OperationResult::Type InStreamOutLong(int32_t opType, InteropMemory& outInMem, IgniteError& err); /** * Internal out-in operation. http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/include/ignite/impl/transactions/transaction_impl.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/impl/transactions/transaction_impl.h b/modules/platforms/cpp/core/include/ignite/impl/transactions/transaction_impl.h index 6889c62..959a6de 100644 --- a/modules/platforms/cpp/core/include/ignite/impl/transactions/transaction_impl.h +++ b/modules/platforms/cpp/core/include/ignite/impl/transactions/transaction_impl.h @@ -128,7 +128,7 @@ namespace ignite * @param err Error. * @return Current state. */ - TransactionState GetState(IgniteError& err); + TransactionState::Type GetState(IgniteError& err); /** * Get concurrency. @@ -206,7 +206,7 @@ namespace ignite int32_t txSize; /** Transaction state. */ - TransactionState state; + TransactionState::Type state; /** Closed flag. */ bool closed; http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/include/ignite/impl/transactions/transactions_impl.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/impl/transactions/transactions_impl.h b/modules/platforms/cpp/core/include/ignite/impl/transactions/transactions_impl.h index 651c64f..ba754c5 100644 --- a/modules/platforms/cpp/core/include/ignite/impl/transactions/transactions_impl.h +++ b/modules/platforms/cpp/core/include/ignite/impl/transactions/transactions_impl.h @@ -72,7 +72,7 @@ namespace ignite * @param err Error. * @return Resulting state. */ - TransactionState TxCommit(int64_t id, IgniteError& err); + TransactionState::Type TxCommit(int64_t id, IgniteError& err); /** * Rollback Transaction. @@ -81,7 +81,7 @@ namespace ignite * @param err Error. * @return Resulting state. */ - TransactionState TxRollback(int64_t id, IgniteError& err); + TransactionState::Type TxRollback(int64_t id, IgniteError& err); /** * Close Transaction. @@ -90,7 +90,7 @@ namespace ignite * @param err Error. * @return Resulting state. */ - TransactionState TxClose(int64_t id, IgniteError& err); + TransactionState::Type TxClose(int64_t id, IgniteError& err); /** * Make transaction into rollback-only. @@ -110,7 +110,7 @@ namespace ignite * @param id Transaction ID. * @return Resulting state. */ - TransactionState TxState(int64_t id, IgniteError& err); + TransactionState::Type TxState(int64_t id, IgniteError& err); /** * Get metrics. @@ -127,7 +127,7 @@ namespace ignite * @param state Integer constant state. * @return TransactionState constant. */ - TransactionState ToTransactionState(int state); + TransactionState::Type ToTransactionState(int state); IGNITE_NO_COPY_ASSIGNMENT(TransactionsImpl) }; http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/include/ignite/transactions/transaction.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/transactions/transaction.h b/modules/platforms/cpp/core/include/ignite/transactions/transaction.h index b51a42c..b42a253 100644 --- a/modules/platforms/cpp/core/include/ignite/transactions/transaction.h +++ b/modules/platforms/cpp/core/include/ignite/transactions/transaction.h @@ -202,7 +202,7 @@ namespace ignite * * @throw IgniteError class instance in case of failure. */ - TransactionState GetState(); + TransactionState::Type GetState(); /** * Get current state. @@ -214,7 +214,7 @@ namespace ignite * @param err Error. * @return Transaction state. */ - TransactionState GetState(IgniteError& err); + TransactionState::Type GetState(IgniteError& err); /** * Get concurrency. @@ -223,9 +223,9 @@ namespace ignite * * @return Concurrency. */ - TransactionConcurrency GetConcurrency() const + TransactionConcurrency::Type GetConcurrency() const { - return static_cast<TransactionConcurrency>(impl.Get()->GetConcurrency()); + return static_cast<TransactionConcurrency::Type>(impl.Get()->GetConcurrency()); } /** @@ -235,9 +235,9 @@ namespace ignite * * @return Isolation. */ - TransactionIsolation GetIsolation() const + TransactionIsolation::Type GetIsolation() const { - return static_cast<TransactionIsolation>(impl.Get()->GetIsolation()); + return static_cast<TransactionIsolation::Type>(impl.Get()->GetIsolation()); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/include/ignite/transactions/transaction_consts.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/transactions/transaction_consts.h b/modules/platforms/cpp/core/include/ignite/transactions/transaction_consts.h index 8b25d3a..069574f 100644 --- a/modules/platforms/cpp/core/include/ignite/transactions/transaction_consts.h +++ b/modules/platforms/cpp/core/include/ignite/transactions/transaction_consts.h @@ -30,113 +30,122 @@ namespace ignite /** * Transaction concurrency control model. */ - enum TransactionConcurrency + struct TransactionConcurrency { - /** - * Optimistic concurrency model. In this mode all cache operations - * are not distributed to other nodes until Transaction::Commit() - * is called. In this mode one @c 'PREPARE' message will be sent to - * participating cache nodes to start acquiring per-transaction - * locks, and once all nodes reply @c 'OK', a one-way @c 'COMMIT' - * message is sent without waiting for reply. - * - * Note that in this mode, optimistic failures are only possible in - * conjunction with ::IGNITE_TX_ISOLATION_SERIALIZABLE isolation - * level. In all other cases, optimistic transactions will never - * fail optimistically and will always be identically ordered on all - * participating grid nodes. - */ - IGNITE_TX_CONCURRENCY_OPTIMISTIC = 0, - - /** - * Pessimistic concurrency model. In this mode a lock is acquired - * on all cache operations with exception of read operations in - * ::IGNITE_TX_ISOLATION_READ_COMMITTED mode. All optional filters - * passed into cache operations will be evaluated after successful - * lock acquisition. Whenever Transaction::Commit() is called, a - * single one-way @c 'COMMIT' message is sent to participating cache - * nodes without waiting for reply. Note that there is no reason for - * distributed @c 'PREPARE' step, as all locks have been already - * acquired. - */ - IGNITE_TX_CONCURRENCY_PESSIMISTIC = 1 + enum Type + { + /** + * Optimistic concurrency model. In this mode all cache operations + * are not distributed to other nodes until Transaction::Commit() + * is called. In this mode one @c 'PREPARE' message will be sent to + * participating cache nodes to start acquiring per-transaction + * locks, and once all nodes reply @c 'OK', a one-way @c 'COMMIT' + * message is sent without waiting for reply. + * + * Note that in this mode, optimistic failures are only possible in + * conjunction with ::IGNITE_TX_ISOLATION_SERIALIZABLE isolation + * level. In all other cases, optimistic transactions will never + * fail optimistically and will always be identically ordered on all + * participating grid nodes. + */ + OPTIMISTIC = 0, + + /** + * Pessimistic concurrency model. In this mode a lock is acquired + * on all cache operations with exception of read operations in + * ::IGNITE_TX_ISOLATION_READ_COMMITTED mode. All optional filters + * passed into cache operations will be evaluated after successful + * lock acquisition. Whenever Transaction::Commit() is called, a + * single one-way @c 'COMMIT' message is sent to participating cache + * nodes without waiting for reply. Note that there is no reason for + * distributed @c 'PREPARE' step, as all locks have been already + * acquired. + */ + PESSIMISTIC = 1 + }; }; /** * Defines different cache transaction isolation levels. */ - enum TransactionIsolation + struct TransactionIsolation { - /** - * Read committed isolation level. This isolation level means that - * always a committed value will be provided for read operations. - * With this isolation level values are always read from cache - * global memory or persistent store every time a value is accessed. - * In other words, if the same key is accessed more than once within - * the same transaction, it may have different value every time - * since global cache memory may be updated concurrently by other - * threads. - */ - IGNITE_TX_ISOLATION_READ_COMMITTED = 0, - - /** - * Repeatable read isolation level. This isolation level means that - * if a value was read once within transaction, then all consecutive - * reads will provide the same in-transaction value. With this - * isolation level accessed values are stored within in-transaction - * memory, so consecutive access to the same key within the same - * transaction will always return the value that was previously read - * or updated within this transaction. If concurrency is - * ::IGNITE_TX_CONCURRENCY_PESSIMISTIC, then a lock on the key will - * be acquired prior to accessing the value. - */ - IGNITE_TX_ISOLATION_REPEATABLE_READ = 1, - - /** - * Serializable isolation level. This isolation level means that all - * transactions occur in a completely isolated fashion, as if all - * transactions in the system had executed serially, one after the - * other. Read access with this level happens the same way as with - * ::IGNITE_TX_ISOLATION_REPEATABLE_READ level. However, in - * ::IGNITE_TX_CONCURRENCY_OPTIMISTIC mode, if some transactions - * cannot be serially isolated from each other, then one winner will - * be picked and the other transactions in conflict will result in - * IgniteError being thrown. - */ - IGNITE_TX_ISOLATION_SERIALIZABLE = 2 + enum Type + { + /** + * Read committed isolation level. This isolation level means that + * always a committed value will be provided for read operations. + * With this isolation level values are always read from cache + * global memory or persistent store every time a value is accessed. + * In other words, if the same key is accessed more than once within + * the same transaction, it may have different value every time + * since global cache memory may be updated concurrently by other + * threads. + */ + READ_COMMITTED = 0, + + /** + * Repeatable read isolation level. This isolation level means that + * if a value was read once within transaction, then all consecutive + * reads will provide the same in-transaction value. With this + * isolation level accessed values are stored within in-transaction + * memory, so consecutive access to the same key within the same + * transaction will always return the value that was previously read + * or updated within this transaction. If concurrency is + * ::IGNITE_TX_CONCURRENCY_PESSIMISTIC, then a lock on the key will + * be acquired prior to accessing the value. + */ + REPEATABLE_READ = 1, + + /** + * Serializable isolation level. This isolation level means that all + * transactions occur in a completely isolated fashion, as if all + * transactions in the system had executed serially, one after the + * other. Read access with this level happens the same way as with + * ::IGNITE_TX_ISOLATION_REPEATABLE_READ level. However, in + * ::IGNITE_TX_CONCURRENCY_OPTIMISTIC mode, if some transactions + * cannot be serially isolated from each other, then one winner will + * be picked and the other transactions in conflict will result in + * IgniteError being thrown. + */ + SERIALIZABLE = 2 + }; }; /** * Cache transaction state. */ - enum TransactionState + struct TransactionState { - /** %Transaction started. */ - IGNITE_TX_STATE_ACTIVE, + enum Type + { + /** %Transaction started. */ + ACTIVE, - /** %Transaction validating. */ - IGNITE_TX_STATE_PREPARING, + /** %Transaction validating. */ + PREPARING, - /** %Transaction validation succeeded. */ - IGNITE_TX_STATE_PREPARED, + /** %Transaction validation succeeded. */ + PREPARED, - /** %Transaction is marked for rollback. */ - IGNITE_TX_STATE_MARKED_ROLLBACK, + /** %Transaction is marked for rollback. */ + MARKED_ROLLBACK, - /** %Transaction commit started (validating finished). */ - IGNITE_TX_STATE_COMMITTING, + /** %Transaction commit started (validating finished). */ + COMMITTING, - /** %Transaction commit succeeded. */ - IGNITE_TX_STATE_COMMITTED, + /** %Transaction commit succeeded. */ + COMMITTED, - /** %Transaction rollback started (validation failed). */ - IGNITE_TX_STATE_ROLLING_BACK, + /** %Transaction rollback started (validation failed). */ + ROLLING_BACK, - /** %Transaction rollback succeeded. */ - IGNITE_TX_STATE_ROLLED_BACK, + /** %Transaction rollback succeeded. */ + ROLLED_BACK, - /** %Transaction rollback failed or is otherwise unknown state. */ - IGNITE_TX_STATE_UNKNOWN + /** %Transaction rollback failed or is otherwise unknown state. */ + UNKNOWN + }; }; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/include/ignite/transactions/transactions.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/transactions/transactions.h b/modules/platforms/cpp/core/include/ignite/transactions/transactions.h index 98282bd..579dcd2 100644 --- a/modules/platforms/cpp/core/include/ignite/transactions/transactions.h +++ b/modules/platforms/cpp/core/include/ignite/transactions/transactions.h @@ -108,8 +108,8 @@ namespace ignite * @param isolation Isolation. * @return New transaction instance. */ - Transaction TxStart(TransactionConcurrency concurrency, - TransactionIsolation isolation); + Transaction TxStart(TransactionConcurrency::Type concurrency, + TransactionIsolation::Type isolation); /** * Starts new transaction with the specified concurrency and @@ -120,8 +120,8 @@ namespace ignite * @param err Error. * @return New transaction instance. */ - Transaction TxStart(TransactionConcurrency concurrency, - TransactionIsolation isolation, IgniteError& err); + Transaction TxStart(TransactionConcurrency::Type concurrency, + TransactionIsolation::Type isolation, IgniteError& err); /** * Starts transaction with specified isolation, concurrency, @@ -134,8 +134,8 @@ namespace ignite * (may be approximate). * @return New transaction instance. */ - Transaction TxStart(TransactionConcurrency concurrency, - TransactionIsolation isolation, int64_t timeout, + Transaction TxStart(TransactionConcurrency::Type concurrency, + TransactionIsolation::Type isolation, int64_t timeout, int32_t txSize); /** @@ -149,8 +149,8 @@ namespace ignite * @param err Error. * @return New transaction instance. */ - Transaction TxStart(TransactionConcurrency concurrency, - TransactionIsolation isolation, int64_t timeout, + Transaction TxStart(TransactionConcurrency::Type concurrency, + TransactionIsolation::Type isolation, int64_t timeout, int32_t txSize, IgniteError& err); /** http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp b/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp index 73c96fd..36c42a1 100644 --- a/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp +++ b/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp @@ -36,13 +36,16 @@ namespace ignite { namespace binary { - enum Operation + struct Operation { - /** Operation: metadata get. */ - OP_GET_META = 1, + enum Type + { + /** Operation: metadata get. */ + GET_META = 1, - /** Operation: metadata update. */ - OP_PUT_META = 3 + /** Operation: metadata update. */ + PUT_META = 3 + }; }; BinaryTypeUpdaterImpl::BinaryTypeUpdaterImpl(IgniteEnvironment& env, jobject javaRef) : @@ -97,7 +100,7 @@ namespace ignite out.Synchronize(); - long long res = env.Context()->TargetInStreamOutLong(javaRef, OP_PUT_META, mem.Get()->PointerLong(), &jniErr); + long long res = env.Context()->TargetInStreamOutLong(javaRef, Operation::PUT_META, mem.Get()->PointerLong(), &jniErr); IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err); @@ -118,7 +121,7 @@ namespace ignite out.Synchronize(); - env.Context()->TargetInStreamOutStream(javaRef, OP_GET_META, + env.Context()->TargetInStreamOutStream(javaRef, Operation::GET_META, outMem.Get()->PointerLong(), inMem.Get()->PointerLong(), &jniErr); IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err); http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/src/impl/cache/query/continuous/continuous_query_handle_impl.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/src/impl/cache/query/continuous/continuous_query_handle_impl.cpp b/modules/platforms/cpp/core/src/impl/cache/query/continuous/continuous_query_handle_impl.cpp index b15183b..f98d674 100644 --- a/modules/platforms/cpp/core/src/impl/cache/query/continuous/continuous_query_handle_impl.cpp +++ b/modules/platforms/cpp/core/src/impl/cache/query/continuous/continuous_query_handle_impl.cpp @@ -33,11 +33,14 @@ namespace ignite { namespace continuous { - enum Command + struct Command { - GET_INITIAL_QUERY = 0, + enum Type + { + GET_INITIAL_QUERY = 0, - CLOSE = 1 + CLOSE = 1 + }; }; ContinuousQueryHandleImpl::ContinuousQueryHandleImpl(SP_IgniteEnvironment env, int64_t handle, jobject javaRef) : @@ -52,7 +55,7 @@ namespace ignite ContinuousQueryHandleImpl::~ContinuousQueryHandleImpl() { - env.Get()->Context()->TargetInLongOutLong(javaRef, CLOSE, 0); + env.Get()->Context()->TargetInLongOutLong(javaRef, Command::CLOSE, 0); JniContext::Release(javaRef); @@ -73,7 +76,7 @@ namespace ignite JniErrorInfo jniErr; - jobject res = env.Get()->Context()->TargetOutObject(javaRef, GET_INITIAL_QUERY, &jniErr); + jobject res = env.Get()->Context()->TargetOutObject(javaRef, Command::GET_INITIAL_QUERY, &jniErr); IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err); http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/src/impl/cluster/cluster_group_impl.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/src/impl/cluster/cluster_group_impl.cpp b/modules/platforms/cpp/core/src/impl/cluster/cluster_group_impl.cpp index d30c321..1bddeac 100644 --- a/modules/platforms/cpp/core/src/impl/cluster/cluster_group_impl.cpp +++ b/modules/platforms/cpp/core/src/impl/cluster/cluster_group_impl.cpp @@ -26,9 +26,12 @@ namespace ignite { namespace cluster { - enum Command + struct Command { - FOR_SERVERS = 23 + enum Type + { + FOR_SERVERS = 23 + }; }; ClusterGroupImpl::ClusterGroupImpl(SP_IgniteEnvironment env, jobject javaRef) : @@ -46,7 +49,7 @@ namespace ignite { JniErrorInfo jniErr; - jobject res = InOpObject(FOR_SERVERS, err); + jobject res = InOpObject(Command::FOR_SERVERS, err); if (jniErr.code != java::IGNITE_JNI_ERR_SUCCESS) return SP_ClusterGroupImpl(); http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/src/impl/ignite_environment.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/src/impl/ignite_environment.cpp b/modules/platforms/cpp/core/src/impl/ignite_environment.cpp index 8457bbb..2231003 100644 --- a/modules/platforms/cpp/core/src/impl/ignite_environment.cpp +++ b/modules/platforms/cpp/core/src/impl/ignite_environment.cpp @@ -42,16 +42,19 @@ namespace ignite /** * Callback codes. */ - enum CallbackOp + struct OperationCallback { - CACHE_INVOKE = 8, - CONTINUOUS_QUERY_LISTENER_APPLY = 18, - CONTINUOUS_QUERY_FILTER_CREATE = 19, - CONTINUOUS_QUERY_FILTER_APPLY = 20, - CONTINUOUS_QUERY_FILTER_RELEASE = 21, - REALLOC = 36, - ON_START = 49, - ON_STOP = 50 + enum Type + { + CACHE_INVOKE = 8, + CONTINUOUS_QUERY_LISTENER_APPLY = 18, + CONTINUOUS_QUERY_FILTER_CREATE = 19, + CONTINUOUS_QUERY_FILTER_APPLY = 20, + CONTINUOUS_QUERY_FILTER_RELEASE = 21, + REALLOC = 36, + ON_START = 49, + ON_STOP = 50 + }; }; /** @@ -68,14 +71,14 @@ namespace ignite switch (type) { - case ON_STOP: + case OperationCallback::ON_STOP: { delete env; break; } - case CONTINUOUS_QUERY_LISTENER_APPLY: + case OperationCallback::CONTINUOUS_QUERY_LISTENER_APPLY: { SharedPointer<InteropMemory> mem = env->Get()->GetMemory(val); @@ -84,7 +87,7 @@ namespace ignite break; } - case CONTINUOUS_QUERY_FILTER_CREATE: + case OperationCallback::CONTINUOUS_QUERY_FILTER_CREATE: { SharedPointer<InteropMemory> mem = env->Get()->GetMemory(val); @@ -93,7 +96,7 @@ namespace ignite break; } - case CONTINUOUS_QUERY_FILTER_APPLY: + case OperationCallback::CONTINUOUS_QUERY_FILTER_APPLY: { SharedPointer<InteropMemory> mem = env->Get()->GetMemory(val); @@ -102,13 +105,13 @@ namespace ignite break; } - case CONTINUOUS_QUERY_FILTER_RELEASE: + case OperationCallback::CONTINUOUS_QUERY_FILTER_RELEASE: { // No-op. break; } - case CACHE_INVOKE: + case OperationCallback::CACHE_INVOKE: { SharedPointer<InteropMemory> mem = env->Get()->GetMemory(val); @@ -143,14 +146,14 @@ namespace ignite switch (type) { - case ON_START: + case OperationCallback::ON_START: { env->Get()->OnStartCallback(val1, reinterpret_cast<jobject>(arg)); break; } - case REALLOC: + case OperationCallback::REALLOC: { SharedPointer<InteropMemory> mem = env->Get()->GetMemory(val1); @@ -363,7 +366,7 @@ namespace ignite bool invoked = false; int64_t res = binding.Get()->InvokeCallback(invoked, - IgniteBindingImpl::CACHE_ENTRY_FILTER_CREATE, filterId, reader, writer); + IgniteBindingImpl::CallbackType::CACHE_ENTRY_FILTER_CREATE, filterId, reader, writer); if (!invoked) { @@ -424,7 +427,8 @@ namespace ignite bool invoked = false; - binding.Get()->InvokeCallback(invoked, IgniteBindingImpl::CACHE_ENTRY_PROCESSOR_APPLY, procId, reader, writer); + binding.Get()->InvokeCallback(invoked, + IgniteBindingImpl::CallbackType::CACHE_ENTRY_PROCESSOR_APPLY, procId, reader, writer); if (!invoked) { http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp b/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp index 3904dfa..b0932e7 100644 --- a/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp +++ b/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp @@ -186,18 +186,18 @@ namespace ignite IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err); - if (jniErr.code == IGNITE_JNI_ERR_SUCCESS && res == ResultSuccess) + if (jniErr.code == IGNITE_JNI_ERR_SUCCESS && res == OperationResult::AI_SUCCESS) ReadFrom(outInMem.Get(), outOp); - else if (res == ResultNull) + else if (res == OperationResult::AI_NULL) outOp.SetNull(); - else if (res == ResultError) + else if (res == OperationResult::AI_ERROR) ReadError(outInMem.Get(), err); else assert(false); } } - InteropTarget::OperationResult InteropTarget::InStreamOutLong(int32_t opType, + InteropTarget::OperationResult::Type InteropTarget::InStreamOutLong(int32_t opType, InteropMemory& outInMem, IgniteError& err) { JniErrorInfo jniErr; @@ -210,10 +210,10 @@ namespace ignite IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err); - return static_cast<OperationResult>(res); + return static_cast<OperationResult::Type>(res); } - return ResultError; + return OperationResult::AI_ERROR; } int64_t InteropTarget::OutInOpLong(int32_t opType, int64_t val, IgniteError& err) http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/src/impl/transactions/transaction_impl.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/src/impl/transactions/transaction_impl.cpp b/modules/platforms/cpp/core/src/impl/transactions/transaction_impl.cpp index 63b3b6b..852b7d7 100644 --- a/modules/platforms/cpp/core/src/impl/transactions/transaction_impl.cpp +++ b/modules/platforms/cpp/core/src/impl/transactions/transaction_impl.cpp @@ -37,7 +37,7 @@ namespace ignite isolation(isolation), timeout(timeout), txSize(txSize), - state(IGNITE_TX_STATE_UNKNOWN), + state(TransactionState::UNKNOWN), closed(false) { // No-op. @@ -97,7 +97,7 @@ namespace ignite return; } - TransactionState newState = txs.Get()->TxCommit(id, err); + TransactionState::Type newState = txs.Get()->TxCommit(id, err); if (err.GetCode() == IgniteError::IGNITE_SUCCESS) { @@ -118,7 +118,7 @@ namespace ignite return; } - TransactionState newState = txs.Get()->TxRollback(id, err); + TransactionState::Type newState = txs.Get()->TxRollback(id, err); if (err.GetCode() == IgniteError::IGNITE_SUCCESS) { @@ -139,7 +139,7 @@ namespace ignite return; } - TransactionState newState = txs.Get()->TxClose(id, err); + TransactionState::Type newState = txs.Get()->TxClose(id, err); if (err.GetCode() == IgniteError::IGNITE_SUCCESS) { @@ -165,14 +165,14 @@ namespace ignite bool TransactionImpl::IsRollbackOnly(IgniteError& err) { - TransactionState state0 = GetState(err); + TransactionState::Type state0 = GetState(err); - return state0 == IGNITE_TX_STATE_MARKED_ROLLBACK || - state0 == IGNITE_TX_STATE_ROLLING_BACK || - state0 == IGNITE_TX_STATE_ROLLED_BACK; + return state0 == TransactionState::MARKED_ROLLBACK || + state0 == TransactionState::ROLLING_BACK || + state0 == TransactionState::ROLLED_BACK; } - TransactionState TransactionImpl::GetState(IgniteError& err) + TransactionState::Type TransactionImpl::GetState(IgniteError& err) { common::concurrent::CsLockGuard guard(accessLock); http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/src/impl/transactions/transactions_impl.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/src/impl/transactions/transactions_impl.cpp b/modules/platforms/cpp/core/src/impl/transactions/transactions_impl.cpp index 79f58c5..133b375 100644 --- a/modules/platforms/cpp/core/src/impl/transactions/transactions_impl.cpp +++ b/modules/platforms/cpp/core/src/impl/transactions/transactions_impl.cpp @@ -30,24 +30,34 @@ namespace ignite /** * Transaction opertion. */ - enum Operation + struct Operation { - /** Get metrics. */ - OP_METRICS = 2, - /** Start tx. */ - OP_START = 3, - /** Commit. */ - OP_COMMIT = 4, - /** Rollback. */ - OP_ROLLBACK = 5, - /** Close tx. */ - OP_CLOSE = 6, - /** Get tx state. */ - OP_STATE = 7, - /** Set rollback-only mode. */ - OP_SET_ROLLBACK_ONLY = 8, - /** Reset metrics. */ - OP_RESET_METRICS = 11, + enum Type + { + /** Get metrics. */ + METRICS = 2, + + /** Start tx. */ + START = 3, + + /** Commit. */ + COMMIT = 4, + + /** Rollback. */ + ROLLBACK = 5, + + /** Close tx. */ + CLOSE = 6, + + /** Get tx state. */ + STATE = 7, + + /** Set rollback-only mode. */ + SET_ROLLBACK_ONLY = 8, + + /** Reset metrics. */ + RESET_METRICS = 11, + }; }; TransactionsImpl::TransactionsImpl(SP_IgniteEnvironment env, jobject javaRef) : @@ -148,34 +158,34 @@ namespace ignite InTransactionStartOperation inOp(concurrency, isolation, timeout, txSize); OutTransactionStartOperation outOp; - OutInOp(OP_START, inOp, outOp, err); + OutInOp(Operation::START, inOp, outOp, err); return outOp.Get(); } - TransactionsImpl::TransactionState TransactionsImpl::TxCommit(int64_t id, IgniteError& err) + TransactionState::Type TransactionsImpl::TxCommit(int64_t id, IgniteError& err) { JniErrorInfo jniErr; - int state = static_cast<int>(OutInOpLong(OP_COMMIT, id, err)); + int state = static_cast<int>(OutInOpLong(Operation::COMMIT, id, err)); return ToTransactionState(state); } - TransactionsImpl::TransactionState TransactionsImpl::TxRollback(int64_t id, IgniteError& err) + TransactionState::Type TransactionsImpl::TxRollback(int64_t id, IgniteError& err) { JniErrorInfo jniErr; - int state = static_cast<int>(OutInOpLong(OP_ROLLBACK, id, err)); + int state = static_cast<int>(OutInOpLong(Operation::ROLLBACK, id, err)); return ToTransactionState(state); } - TransactionsImpl::TransactionState TransactionsImpl::TxClose(int64_t id, IgniteError& err) + TransactionState::Type TransactionsImpl::TxClose(int64_t id, IgniteError& err) { JniErrorInfo jniErr; - int state = static_cast<int>(OutInOpLong(OP_CLOSE, id, err)); + int state = static_cast<int>(OutInOpLong(Operation::CLOSE, id, err)); return ToTransactionState(state); } @@ -184,16 +194,16 @@ namespace ignite { JniErrorInfo jniErr; - bool rollbackOnly = OutInOpLong(OP_SET_ROLLBACK_ONLY, id, err) == 1; + bool rollbackOnly = OutInOpLong(Operation::SET_ROLLBACK_ONLY, id, err) == 1; return rollbackOnly; } - TransactionsImpl::TransactionState TransactionsImpl::TxState(int64_t id, IgniteError& err) + TransactionState::Type TransactionsImpl::TxState(int64_t id, IgniteError& err) { JniErrorInfo jniErr; - int state = static_cast<int>(OutInOpLong(OP_STATE, id, err)); + int state = static_cast<int>(OutInOpLong(Operation::STATE, id, err)); return ToTransactionState(state); } @@ -248,32 +258,32 @@ namespace ignite { OutTransactionMetricsOperation op; - InOp(OP_METRICS, op, err); + InOp(Operation::METRICS, op, err); if (err.GetCode() == IgniteError::IGNITE_SUCCESS) return op.Get(); - return ignite::transactions::TransactionMetrics(); + return TransactionMetrics(); } - TransactionsImpl::TransactionState TransactionsImpl::ToTransactionState(int state) + TransactionState::Type TransactionsImpl::ToTransactionState(int state) { using namespace ignite::transactions; switch (state) { - case IGNITE_TX_STATE_ACTIVE: - case IGNITE_TX_STATE_PREPARING: - case IGNITE_TX_STATE_PREPARED: - case IGNITE_TX_STATE_MARKED_ROLLBACK: - case IGNITE_TX_STATE_COMMITTING: - case IGNITE_TX_STATE_COMMITTED: - case IGNITE_TX_STATE_ROLLING_BACK: - case IGNITE_TX_STATE_ROLLED_BACK: - case IGNITE_TX_STATE_UNKNOWN: - return static_cast<TransactionState>(state); + case TransactionState::ACTIVE: + case TransactionState::PREPARING: + case TransactionState::PREPARED: + case TransactionState::MARKED_ROLLBACK: + case TransactionState::COMMITTING: + case TransactionState::COMMITTED: + case TransactionState::ROLLING_BACK: + case TransactionState::ROLLED_BACK: + case TransactionState::UNKNOWN: + return static_cast<TransactionState::Type>(state); default: - return IGNITE_TX_STATE_UNKNOWN; + return TransactionState::UNKNOWN; } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/src/transactions/transaction.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/src/transactions/transaction.cpp b/modules/platforms/cpp/core/src/transactions/transaction.cpp index 59e2d4a..469fea9 100644 --- a/modules/platforms/cpp/core/src/transactions/transaction.cpp +++ b/modules/platforms/cpp/core/src/transactions/transaction.cpp @@ -172,18 +172,18 @@ namespace ignite return false; } - TransactionState Transaction::GetState() + TransactionState::Type Transaction::GetState() { IgniteError err; - TransactionState res = GetState(err); + TransactionState::Type res = GetState(err); IgniteError::ThrowIfNeeded(err); return res; } - TransactionState Transaction::GetState(IgniteError& err) + TransactionState::Type Transaction::GetState(IgniteError& err) { err = IgniteError(); @@ -197,7 +197,7 @@ namespace ignite "Instance is not usable (did you check for error?)."); } - return IGNITE_TX_STATE_UNKNOWN; + return TransactionState::UNKNOWN; } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core/src/transactions/transactions.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/src/transactions/transactions.cpp b/modules/platforms/cpp/core/src/transactions/transactions.cpp index 081f97a..4c1ea70 100644 --- a/modules/platforms/cpp/core/src/transactions/transactions.cpp +++ b/modules/platforms/cpp/core/src/transactions/transactions.cpp @@ -66,12 +66,12 @@ namespace ignite Transaction Transactions::TxStart(IgniteError& err) { - return TxStart(IGNITE_TX_CONCURRENCY_PESSIMISTIC, - IGNITE_TX_ISOLATION_READ_COMMITTED, 0, 0, err); + return TxStart(TransactionConcurrency::PESSIMISTIC, + TransactionIsolation::READ_COMMITTED, 0, 0, err); } - Transaction Transactions::TxStart(TransactionConcurrency concurrency, - TransactionIsolation isolation) + Transaction Transactions::TxStart(TransactionConcurrency::Type concurrency, + TransactionIsolation::Type isolation) { IgniteError err; @@ -82,14 +82,14 @@ namespace ignite return tx; } - Transaction Transactions::TxStart(TransactionConcurrency concurrency, - TransactionIsolation isolation, IgniteError& err) + Transaction Transactions::TxStart(TransactionConcurrency::Type concurrency, + TransactionIsolation::Type isolation, IgniteError& err) { return TxStart(concurrency, isolation, 0, 0, err); } - Transaction Transactions::TxStart(TransactionConcurrency concurrency, - TransactionIsolation isolation, int64_t timeout, int32_t txSize) + Transaction Transactions::TxStart(TransactionConcurrency::Type concurrency, + TransactionIsolation::Type isolation, int64_t timeout, int32_t txSize) { IgniteError err; @@ -101,8 +101,8 @@ namespace ignite return tx; } - Transaction Transactions::TxStart(TransactionConcurrency concurrency, - TransactionIsolation isolation, int64_t timeout, int32_t txSize, + Transaction Transactions::TxStart(TransactionConcurrency::Type concurrency, + TransactionIsolation::Type isolation, int64_t timeout, int32_t txSize, IgniteError& err) { err = IgniteError(); http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/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 cca1dad..4454066 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 @@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(TestPutIntToString) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, buffer, sizeof(buffer), &reslen, &offset); appBuf.PutInt8(12); BOOST_CHECK(!strcmp(buffer, "12")); @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(TestPutFloatToString) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, buffer, sizeof(buffer), &reslen, &offset); appBuf.PutFloat(12.42f); BOOST_CHECK(!strcmp(buffer, "12.42")); @@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE(TestPutGuidToString) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, buffer, sizeof(buffer), &reslen, &offset); ignite::Guid guid(0x1da1ef8f39ff4d62ULL, 0x8b72e8e9f3371801ULL); @@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE(TestPutBinaryToString) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, buffer, sizeof(buffer), &reslen, &offset); uint8_t binary[] = { 0x21, 0x84, 0xF4, 0xDC, 0x01, 0x00, 0xFF, 0xF0 }; @@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToString) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, buffer, sizeof(buffer), &reslen, &offset); std::string testString("Test string"); @@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToWstring) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_WCHAR, buffer, sizeof(buffer), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_WCHAR, buffer, sizeof(buffer), &reslen, &offset); std::string testString("Test string"); @@ -166,7 +166,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToLong) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, &offset); appBuf.PutString("424242424"); BOOST_CHECK(numBuf == 424242424L); @@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToTiny) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_TINYINT, &numBuf, sizeof(numBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_SIGNED_TINYINT, &numBuf, sizeof(numBuf), &reslen, &offset); appBuf.PutString("12"); BOOST_CHECK(numBuf == 12); @@ -196,7 +196,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToFloat) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset); appBuf.PutString("12.21"); BOOST_CHECK_CLOSE_FRACTION(numBuf, 12.21, FLOAT_PRECISION); @@ -211,7 +211,7 @@ BOOST_AUTO_TEST_CASE(TestPutIntToFloat) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset); appBuf.PutInt8(5); BOOST_CHECK_CLOSE_FRACTION(numBuf, 5.0, FLOAT_PRECISION); @@ -238,7 +238,7 @@ BOOST_AUTO_TEST_CASE(TestPutFloatToShort) SqlLen reslen = 0; int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_SHORT, &numBuf, sizeof(numBuf), &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_SIGNED_SHORT, &numBuf, sizeof(numBuf), &reslen, &offset); appBuf.PutDouble(5.42); BOOST_CHECK(numBuf == 5); @@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToDouble) double numBuf; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &numBuf, sizeof(numBuf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_DOUBLE, &numBuf, sizeof(numBuf), &reslen, 0); common::Decimal decimal; @@ -287,7 +287,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToLong) long numBuf; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, 0); common::Decimal decimal; @@ -314,7 +314,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToString) char strBuf[64]; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); common::Decimal decimal; @@ -341,7 +341,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToNumeric) SQL_NUMERIC_STRUCT buf; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_NUMERIC, &buf, sizeof(buf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_NUMERIC, &buf, sizeof(buf), &reslen, 0); common::Decimal decimal; @@ -392,7 +392,7 @@ BOOST_AUTO_TEST_CASE(TestPutDateToString) char strBuf[64] = { 0 }; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); Date date = common::MakeDateGmt(1999, 2, 22); @@ -409,7 +409,7 @@ BOOST_AUTO_TEST_CASE(TestPutDateToDate) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); Date date = common::MakeDateGmt(1984, 5, 27); @@ -429,7 +429,7 @@ BOOST_AUTO_TEST_CASE(TestPutDateToTimestamp) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); Date date = common::MakeDateGmt(1984, 5, 27); @@ -449,7 +449,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimeToString) char strBuf[64] = { 0 }; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); Time time = common::MakeTimeGmt(7, 15, 0); @@ -466,7 +466,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimeToTime) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIME, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIME, &buf, sizeof(buf), &reslen, &offsetPtr); Time time = common::MakeTimeGmt(23, 51, 1); @@ -482,7 +482,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToString) char strBuf[64] = { 0 }; SqlLen reslen = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); Timestamp date = common::MakeTimestampGmt(2018, 11, 1, 17, 45, 59); @@ -499,7 +499,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToDate) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); Timestamp ts = common::MakeTimestampGmt(2004, 8, 14, 6, 34, 51, 573948623); @@ -518,7 +518,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToTime) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIME, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIME, &buf, sizeof(buf), &reslen, &offsetPtr); Timestamp ts = common::MakeTimestampGmt(2004, 8, 14, 6, 34, 51, 573948623); @@ -537,7 +537,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToTimestamp) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); Timestamp ts = common::MakeTimestampGmt(2004, 8, 14, 6, 34, 51, 573948623); @@ -557,7 +557,7 @@ BOOST_AUTO_TEST_CASE(TestGetGuidFromString) char buffer[] = "1da1ef8f-39ff-4d62-8b72-e8e9f3371801"; SqlLen reslen = sizeof(buffer) - 1; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer) - 1, &reslen, 0); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, buffer, sizeof(buffer) - 1, &reslen, 0); ignite::Guid guid = appBuf.GetGuid(); @@ -570,7 +570,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromLong) SqlLen reslen = sizeof(numBuf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_SIGNED_LONG, &numBuf, reslen, &reslen, &offset); std::string res = appBuf.GetString(32); @@ -589,7 +589,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromDouble) SqlLen reslen = sizeof(numBuf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &numBuf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_DOUBLE, &numBuf, reslen, &reslen, &offset); std::string res = appBuf.GetString(32); @@ -608,7 +608,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromString) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf, reslen, &reslen, &offset); std::string res = appBuf.GetString(reslen); @@ -621,7 +621,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromUshort) SqlLen reslen = sizeof(numBuf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT, &numBuf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_UNSIGNED_SHORT, &numBuf, reslen, &reslen, &offset); float resFloat = appBuf.GetFloat(); @@ -638,7 +638,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromString) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf, reslen, &reslen, &offset); float resFloat = appBuf.GetFloat(); @@ -655,7 +655,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromFloat) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_FLOAT, &buf, reslen, &reslen, &offset); float resFloat = appBuf.GetFloat(); @@ -672,7 +672,7 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromDouble) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_DOUBLE, &buf, reslen, &reslen, &offset); float resFloat = appBuf.GetFloat(); @@ -689,7 +689,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromString) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf, reslen, &reslen, &offset); int64_t resInt64 = appBuf.GetInt64(); @@ -714,7 +714,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromFloat) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_FLOAT, &buf, reslen, &reslen, &offset); int64_t resInt64 = appBuf.GetInt64(); @@ -739,7 +739,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromDouble) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_DOUBLE, &buf, reslen, &reslen, &offset); int64_t resInt64 = appBuf.GetInt64(); @@ -764,7 +764,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromBigint) SqlLen reslen = sizeof(buf); int* offset = 0; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT, &buf, reslen, &reslen, &offset); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_UNSIGNED_BIGINT, &buf, reslen, &reslen, &offset); int64_t resInt64 = appBuf.GetInt64(); @@ -799,7 +799,7 @@ BOOST_AUTO_TEST_CASE(TestGetIntWithOffset) 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); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_UNSIGNED_BIGINT, &buf[0].val, sizeof(buf[0].val), &buf[0].reslen, &offsetPtr); int64_t val = appBuf.GetInt64(); @@ -834,7 +834,7 @@ BOOST_AUTO_TEST_CASE(TestSetStringWithOffset) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf[0].val, sizeof(buf[0].val), &buf[0].reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf[0].val, sizeof(buf[0].val), &buf[0].reslen, &offsetPtr); appBuf.PutString("Hello Ignite!"); @@ -869,7 +869,7 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromString) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr); Date date = appBuf.GetDate(); @@ -895,7 +895,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimeFromString) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr); Time time = appBuf.GetTime(); @@ -921,7 +921,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromString) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_CHAR, &buf[0], sizeof(buf), &reslen, &offsetPtr); Timestamp date = appBuf.GetTimestamp(); @@ -952,7 +952,7 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromDate) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); Date date = appBuf.GetDate(); @@ -983,7 +983,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromDate) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr); Timestamp ts = appBuf.GetTimestamp(); @@ -1014,7 +1014,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromTime) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIME, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIME, &buf, sizeof(buf), &reslen, &offsetPtr); Time time = appBuf.GetTime(); @@ -1049,7 +1049,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromTimestamp) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); Timestamp ts = appBuf.GetTimestamp(); @@ -1085,7 +1085,7 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromTimestamp) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); Date date = appBuf.GetDate(); @@ -1120,7 +1120,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimeFromTimestamp) int offset = 0; int* offsetPtr = &offset; - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); + ApplicationDataBuffer appBuf(OdbcNativeType::AI_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr); Time time = appBuf.GetTime();
