annotate Core/SQLite/ITransaction.h @ 3790:59704c124722

fix typo in plugin SDK
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 21 Mar 2020 16:20:43 +0100
parents fa5ad4368fe3
children
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
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * Redistribution and use in source and binary forms, with or without
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * modification, are permitted provided that the following conditions are
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * met:
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * * Redistributions of source code must retain the above copyright
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * notice, this list of conditions and the following disclaimer.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * * Redistributions in binary form must reproduce the above
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * copyright notice, this list of conditions and the following disclaimer
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in the documentation and/or other materials provided with the
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * distribution.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * * Neither the name of Google Inc., the name of the CHU of Liege,
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * nor the names of its contributors may be used to endorse or promote
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * products derived from this software without specific prior written
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * permission.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 **/
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 #pragma once
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #include "NonCopyable.h"
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 namespace Orthanc
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 SQLite
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 class ITransaction : public NonCopyable
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 public:
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 virtual ~ITransaction()
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 {
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 }
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 // Begins the transaction. This uses the default sqlite "deferred" transaction
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 // 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
55 // database is accessed, not in the begin transaction command.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 virtual void Begin() = 0;
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 // Rolls back the transaction. This will happen automatically if you do
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 // nothing when the transaction goes out of scope.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 virtual void Rollback() = 0;
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 // Commits the transaction, returning true on success.
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 virtual void Commit() = 0;
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 };
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 }
9b4977e3c19d abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 }