コード例 #1
0
ファイル: utility.cpp プロジェクト: chandresh-pancholi/ignite
        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);
        }
コード例 #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);
                }
コード例 #3
0
ファイル: result_page.cpp プロジェクト: AtosCodex/ignite
        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);
            }
        }
コード例 #4
0
ファイル: utility.cpp プロジェクト: EdShangGG/ignite
        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()));
            }
        }