1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
12 #include <com/sun/star/embed/XStorage.hpp>
16 #include "columndef.hxx"
20 using SqlStatementVector
= std::vector
<OUString
>;
25 css::uno::Reference
<css::embed::XStorage
>& m_rStorage
;
27 // column type for each table. It is filled after parsing schema.
28 std::map
<OUString
, std::vector
<ColumnDefinition
>> m_ColumnTypes
;
30 // root element's position of data for each table
31 std::map
<OUString
, std::vector
<sal_Int32
>> m_Indexes
;
33 // primary keys of each table
34 std::map
<OUString
, std::vector
<OUString
>> m_PrimaryKeys
;
36 SqlStatementVector m_sCreateStatements
;
37 SqlStatementVector m_sAlterStatements
;
40 explicit SchemaParser(css::uno::Reference
<css::embed::XStorage
>& rStorage
);
43 * Parses table definitions contained by a file called "script" in storage.
48 * @return A vector of schema definition SQL strings in Firebird dialect.
50 const SqlStatementVector
& getCreateStatements() const { return m_sCreateStatements
; }
53 * @return A vector of alter SQL strings in Firebird dialect.
55 const SqlStatementVector
& getAlterStatements() const { return m_sAlterStatements
; }
58 * Returns the column types of a table. It should not be called before
59 * calling parseSchema().
61 * @param sTableName name of the table.
63 * @return A vector of column descriptors.
65 std::vector
<ColumnDefinition
> getTableColumnTypes(const OUString
& sTableName
) const;
68 * Returns a vector of indexes for each table. These indexes are used for
69 * locating the data related to the actual table in the binary file.
71 * The indexes point to root elements of AVL trees. Each node of the tree
74 const std::map
<OUString
, std::vector
<sal_Int32
>>& getTableIndexes() const;
77 * Returns a vector of column names for each table. These columns are the
78 * primary keys of the table.
80 const std::map
<OUString
, std::vector
<OUString
>>& getPrimaryKeys() const;
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */