SQLiteSchemaInserter.hpp 1.9 KB
Newer Older
1
2
/*
 * @project        The CERN Tape Archive (CTA)
3
 * @copyright      Copyright(C) 2015-2021 CERN
4
5
6
7
 * @license        This program is free software: you can redistribute it and/or modify
 *                 it under the terms of the GNU General Public License as published by
 *                 the Free Software Foundation, either version 3 of the License, or
 *                 (at your option) any later version.
8
 *
9
10
11
12
 *                 This program is distributed in the hope that it will be useful,
 *                 but WITHOUT ANY WARRANTY; without even the implied warranty of
 *                 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *                 GNU General Public License for more details.
13
 *
14
15
 *                 You should have received a copy of the GNU General Public License
 *                 along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17
18
19
 */

#pragma once
#include "rdbms/Login.hpp"
20
#include "rdbms/ConnPool.hpp"
21
22
23

namespace cta {
namespace catalogue {
24
  /**
25
   * This class is used to create a InMemory SQLiteSchema from sql statements
26
27
28
   * 
   * @param sqliteConn the connection of the InMemory SQLite schema
   */
29
30
  class SQLiteSchemaInserter {
  public:
31
32
33
34
    /**
     * Constructor
     * @param sqliteConn the connection of the InMemory SQLite schema
     */
35
    SQLiteSchemaInserter(rdbms::Conn &sqliteConn);
36
    /**
37
38
     * Transform and insert the schema statements passed in parameter into the
     * InMemory SQLite database
39
     */
40
    void insert(const std::list<std::string> &schemaStatements);    
41
    virtual ~SQLiteSchemaInserter();
42
    
43
  private:
44
    cta::rdbms::Conn & m_sqliteCatalogueConn;
45
46
47
48
    /**
     * Execute all the statements passed in parameter against the InMemory SQLite database 
     * @param statements the statements to execute in the InMemory SQLite database
     */
49
    void executeStatements(const std::list<std::string> &statements);
50
51
52
53
54
  };
  
}}