Example #1
0
        void ReadDecimal(ignite::impl::binary::BinaryReaderImpl& reader, common::Decimal& decimal)
        {
            int8_t hdr = reader.ReadInt8();

            assert(hdr == ignite::impl::binary::IGNITE_TYPE_DECIMAL);

            int32_t scale = reader.ReadInt32();

            int32_t len = reader.ReadInt32();

            std::vector<int8_t> mag;

            mag.resize(len);

            impl::binary::BinaryUtils::ReadInt8Array(reader.GetStream(), mag.data(), static_cast<int32_t>(mag.size()));

            int32_t sign = 1;
            
            if (mag[0] < 0)
            {
                mag[0] &= 0x7F;

                sign = -1;
            }

            common::Decimal res(mag.data(), static_cast<int32_t>(mag.size()), scale, sign);

            decimal.Swap(res);
        }
Example #2
0
                virtual void ProcessOutput(ignite::impl::binary::BinaryReaderImpl& reader)
                {
                    Timestamp commitTime = reader.ReadTopObject<Timestamp>();
                    Timestamp rollbackTime = reader.ReadTopObject<Timestamp>();
                    int32_t commits = reader.ReadInt32();
                    int32_t rollbacks = reader.ReadInt32();

                    val = TransactionMetrics(commitTime, rollbackTime, commits, rollbacks);
                }
Example #3
0
        void ResultPage::Read(ignite::impl::binary::BinaryReaderImpl& reader)
        {
            last = reader.ReadBool();
            size = reader.ReadInt32();

            ignite::impl::interop::InteropInputStream& stream = *reader.GetStream();

            int32_t dataToRead = stream.Remaining();

            data.Length(dataToRead);

            if (dataToRead)
            {
                data.Reallocate(dataToRead);

                reader.GetStream()->ReadInt8Array(data.Data(), dataToRead);
            }
        }
Example #4
0
        void ReadString(ignite::impl::binary::BinaryReaderImpl& reader, std::string& str)
        {
            int32_t strLen = reader.ReadString(0, 0);
            if (!strLen)
            {
                str.clear();

                char dummy;

                reader.ReadString(&dummy, sizeof(dummy));
            }
            else
            {
                str.resize(strLen);

                reader.ReadString(&str[0], static_cast<int32_t>(str.size()));
            }
        }