comparison Odbc/Plugins/OdbcIndex.h @ 329:b5fb8b77ce4d

initial commit of ODBC framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 10 Aug 2021 20:08:53 +0200
parents
children 16aac0287485 cd9521e04249
comparison
equal deleted inserted replaced
328:6a49c495c940 329:b5fb8b77ce4d
1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Affero General Public License
9 * as published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/
20
21
22 #pragma once
23
24 #include "../../Framework/Plugins/IndexBackend.h"
25
26 namespace OrthancDatabases
27 {
28 class OdbcIndex : public IndexBackend
29 {
30 private:
31 unsigned int maxConnectionRetries_;
32 unsigned int connectionRetryInterval_;
33 std::string connectionString_;
34
35 public:
36 OdbcIndex(OrthancPluginContext* context,
37 const std::string& connectionString);
38
39 unsigned int GetMaxConnectionRetries() const
40 {
41 return maxConnectionRetries_;
42 }
43
44 void SetMaxConnectionRetries(unsigned int retries)
45 {
46 maxConnectionRetries_ = retries;
47 }
48
49 unsigned int GetConnectionRetryInterval() const
50 {
51 return connectionRetryInterval_;
52 }
53
54 void SetConnectionRetryInterval(unsigned int seconds);
55
56 virtual IDatabaseFactory* CreateDatabaseFactory() ORTHANC_OVERRIDE;
57
58 virtual void ConfigureDatabase(DatabaseManager& manager) ORTHANC_OVERRIDE;
59
60 virtual bool HasRevisionsSupport() const ORTHANC_OVERRIDE
61 {
62 return true;
63 }
64
65 virtual int64_t CreateResource(DatabaseManager& manager,
66 const char* publicId,
67 OrthancPluginResourceType type) ORTHANC_OVERRIDE;
68
69 virtual void DeleteResource(IDatabaseBackendOutput& output,
70 DatabaseManager& manager,
71 int64_t id) ORTHANC_OVERRIDE;
72
73 virtual void LogChange(DatabaseManager& manager,
74 int32_t changeType,
75 int64_t resourceId,
76 OrthancPluginResourceType resourceType,
77 const char* date) ORTHANC_OVERRIDE;
78
79 virtual int64_t GetLastChangeIndex(DatabaseManager& manager) ORTHANC_OVERRIDE;
80
81 virtual void DeleteAttachment(IDatabaseBackendOutput& output,
82 DatabaseManager& manager,
83 int64_t id,
84 int32_t attachment) ORTHANC_OVERRIDE;
85 };
86 }