LibreOffice Module dbaccess (master) 1
parseschema.hxx
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
10#pragma once
11
12#include <com/sun/star/embed/XStorage.hpp>
13#include <vector>
14#include <map>
15
16#include "columndef.hxx"
17
18namespace dbahsql
19{
20using SqlStatementVector = std::vector<OUString>;
21
23{
24private:
25 css::uno::Reference<css::embed::XStorage>& m_rStorage;
26
27 // column type for each table. It is filled after parsing schema.
28 std::map<OUString, std::vector<ColumnDefinition>> m_ColumnTypes;
29
30 // root element's position of data for each table
31 std::map<OUString, std::vector<sal_Int32>> m_Indexes;
32
33 // primary keys of each table
34 std::map<OUString, std::vector<OUString>> m_PrimaryKeys;
35
38
39public:
40 explicit SchemaParser(css::uno::Reference<css::embed::XStorage>& rStorage);
41
45 void parseSchema();
46
51
56
65 std::vector<ColumnDefinition> getTableColumnTypes(const OUString& sTableName) const;
66
74 const std::map<OUString, std::vector<sal_Int32>>& getTableIndexes() const;
75
80 const std::map<OUString, std::vector<OUString>>& getPrimaryKeys() const;
81};
82}
83
84/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::map< OUString, std::vector< sal_Int32 > > m_Indexes
Definition: parseschema.hxx:31
SqlStatementVector m_sCreateStatements
Definition: parseschema.hxx:36
void parseSchema()
Parses table definitions contained by a file called "script" in storage.
const SqlStatementVector & getCreateStatements() const
Definition: parseschema.hxx:50
const std::map< OUString, std::vector< OUString > > & getPrimaryKeys() const
Returns a vector of column names for each table.
std::map< OUString, std::vector< ColumnDefinition > > m_ColumnTypes
Definition: parseschema.hxx:28
const SqlStatementVector & getAlterStatements() const
Definition: parseschema.hxx:55
std::vector< ColumnDefinition > getTableColumnTypes(const OUString &sTableName) const
Returns the column types of a table.
const std::map< OUString, std::vector< sal_Int32 > > & getTableIndexes() const
Returns a vector of indexes for each table.
SqlStatementVector m_sAlterStatements
Definition: parseschema.hxx:37
std::map< OUString, std::vector< OUString > > m_PrimaryKeys
Definition: parseschema.hxx:34
css::uno::Reference< css::embed::XStorage > & m_rStorage
Definition: parseschema.hxx:25
SchemaParser(css::uno::Reference< css::embed::XStorage > &rStorage)
std::vector< OUString > SqlStatementVector
Definition: parseschema.hxx:20