SQLiteSchemaInserter.hpp 1.72 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
 * The CERN Tape Archive (CTA) project
 * Copyright © 2018 CERN
 *
 * 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.
 *
 * 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

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

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