LibreOffice Module dbaccess (master) 1
hsqlbinarynode.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include "hsqlbinarynode.hxx"
21#include "rowinputbinary.hxx"
22
23namespace dbahsql
24{
26 : m_nPos(nPos)
27{
28}
29
31{
32 SvStream* pStream = input.getInputStream();
33 if (!pStream)
34 return;
35
36 pStream->Seek(m_nPos + 8); // skip size and balance
37 pStream->ReadInt32(m_nLeft);
38 if (m_nLeft <= 0)
39 m_nLeft = -1;
40 pStream->ReadInt32(m_nRight);
41 if (m_nRight <= 0)
42 m_nRight = -1;
43}
44
45std::vector<css::uno::Any> HsqlBinaryNode::readRow(HsqlRowInputStream& input,
46 const std::vector<ColumnDefinition>& aColTypes,
47 sal_Int32 nIndexCount)
48{
49 // skip first 4 bytes (size), and index nodes, 16 bytes each
50 input.seek(m_nPos + 4 + nIndexCount * 16);
51 return input.readOneRow(aColTypes);
52}
53
54sal_Int32 HsqlBinaryNode::getLeft() const { return m_nLeft; }
55sal_Int32 HsqlBinaryNode::getRight() const { return m_nRight; }
56};
57
58/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & ReadInt32(sal_Int32 &rInt32)
void readChildren(HsqlRowInputStream const &rInput)
Read position of children from data file.
HsqlBinaryNode(sal_Int32 nPos)
Represents one element of an AVL tree in the binary file which contains the data.
sal_Int32 getLeft() const
Get Position of left children.
std::vector< css::uno::Any > readRow(HsqlRowInputStream &rInput, const std::vector< ColumnDefinition > &aColTypes, sal_Int32 nIndexCount)
Read the row represented by this node.
sal_Int32 getRight() const
Get Position of right children.
std::vector< css::uno::Any > readOneRow(const std::vector< ColumnDefinition > &colTypes)
Reads one row from the actual position.
SvStream * getInputStream() const
void seek(sal_Int32 nPos)
Sets the file-pointer offset, measured from the beginning of the file.
size_t m_nPos
sal_uInt16 nPos
const int nIndexCount