InMemoryCatalogue.hpp 2.04 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(C) 2015  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

21
#include "catalogue/RdbmsCatalogue.hpp"
22
23
24
25
26

namespace cta {
namespace catalogue {

/**
27
 * CTA catalogue class to be used for unit testing.
28
 */
29
class InMemoryCatalogue: public RdbmsCatalogue {
30
public:
31

32
33
34
  /**
   * Constructor.
   *
Steven Murray's avatar
Steven Murray committed
35
   * @param conn The connection to the underlying relational database.  Please
36
   * note that the InMemoryCatalogue will own and therefore delete the
Steven Murray's avatar
Steven Murray committed
37
   * specified database connection.
38
   */
39
  InMemoryCatalogue();
40
41
42
43

  /**
   * Destructor.
   */
44
  virtual ~InMemoryCatalogue();
45

46
47
48
49
50
  using RdbmsCatalogue::insertArchiveFile;
  using RdbmsCatalogue::createTapeFile;
  using RdbmsCatalogue::getArchiveFile;
  using RdbmsCatalogue::getTapeLastFSeq;
  using RdbmsCatalogue::setTapeLastFSeq;
51

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
protected:

  /**
   * This is an InMemoryCatalogue specific method that creates the catalogue
   * database schema.
   */
  void createCatalogueSchema();

  /**
   * This is an InMemoryCatalogue specific method that executes the specified
   * non-query multi-line SQL statement.
   *
   * Please note that each statement must end with a semicolon.  If the last
   * statement is missing a semicolon then it will not be executed.
   *
   * @param multiStmt Non-query multi-line SQL statement.
   */
  void executeNonQueryMultiStmt(const std::string &multiStmt);

}; // class InMemoryCatalogue
72
73
74

} // namespace catalogue
} // namespace cta