annotate OrthancFramework/Sources/SQLite/ITransaction.h @ 4845:02d77189d8ba received-instance-callback

added ReceivedInstanceCallback + sample C++ plugin
author Alain Mazy <am@osimis.io>
date Thu, 09 Dec 2021 17:22:40 +0100
parents 7053502fbf97
children 43e613a7756b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1235
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 *
3063
fa5ad4368fe3 new mail address
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
4 * Copyright (C) 2012-2016 Sebastien Jodogne <s.jodogne@orthanc-labs.com>,
1235
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Medical Physics Department, CHU of Liege, Belgium
4829
c847b0dfd255 added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
6 * Copyright (C) 2017-2021 Osimis S.A., Belgium
4831
7053502fbf97 added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4829
diff changeset
7 * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
1235
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * Redistribution and use in source and binary forms, with or without
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * modification, are permitted provided that the following conditions are
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * met:
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 *
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * * Redistributions of source code must retain the above copyright
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * notice, this list of conditions and the following disclaimer.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * * Redistributions in binary form must reproduce the above
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * copyright notice, this list of conditions and the following disclaimer
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * in the documentation and/or other materials provided with the
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * distribution.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * * Neither the name of Google Inc., the name of the CHU of Liege,
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * nor the names of its contributors may be used to endorse or promote
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * products derived from this software without specific prior written
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * permission.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 *
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 **/
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #pragma once
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 #include "NonCopyable.h"
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 namespace Orthanc
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 namespace SQLite
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 class ITransaction : public NonCopyable
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 {
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 public:
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 virtual ~ITransaction()
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 {
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 }
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 // Begins the transaction. This uses the default sqlite "deferred" transaction
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 // type, which means that the DB lock is lazily acquired the next time the
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 // database is accessed, not in the begin transaction command.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 virtual void Begin() = 0;
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 // Rolls back the transaction. This will happen automatically if you do
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 // nothing when the transaction goes out of scope.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 virtual void Rollback() = 0;
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 // Commits the transaction, returning true on success.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 virtual void Commit() = 0;
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 };
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 }
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 }