annotate OrthancFramework/Sources/SQLite/StatementReference.h @ 5666:aa231c18b9d2 find-refactoring

adding computed tags
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Jul 2024 18:31:54 +0200
parents f7adfb22e20e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
59
c996319e90bc renaming in Core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 50
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1220
9b9026560a5f SQLite wrapper is now fully independent of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
3 *
3063
fa5ad4368fe3 new mail address
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2302
diff changeset
4 * Copyright (C) 2012-2016 Sebastien Jodogne <s.jodogne@orthanc-labs.com>,
1220
9b9026560a5f SQLite wrapper is now fully independent of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
5 * Medical Physics Department, CHU of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
6 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
7 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
8 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 *
17
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
10 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
11 *
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
12 * Redistribution and use in source and binary forms, with or without
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
13 * modification, are permitted provided that the following conditions are
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
14 * met:
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 *
17
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
16 * * Redistributions of source code must retain the above copyright
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
17 * notice, this list of conditions and the following disclaimer.
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
18 * * Redistributions in binary form must reproduce the above
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
19 * copyright notice, this list of conditions and the following disclaimer
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
20 * in the documentation and/or other materials provided with the
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
21 * distribution.
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
22 * * Neither the name of Google Inc., the name of the CHU of Liege,
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
23 * nor the names of its contributors may be used to endorse or promote
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
24 * products derived from this software without specific prior written
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
25 * permission.
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
26 *
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
db4d996ea264 licensing of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 **/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 #pragma once
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
3992
f9863630ec7f working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3063
diff changeset
43 #if ORTHANC_SQLITE_STANDALONE == 1
f9863630ec7f working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3063
diff changeset
44 # define ORTHANC_PUBLIC
f9863630ec7f working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3063
diff changeset
45 #else
f9863630ec7f working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3063
diff changeset
46 # include "../OrthancFramework.h"
f9863630ec7f working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3063
diff changeset
47 #endif
f9863630ec7f working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3063
diff changeset
48
1221
2255e66da726 getting rid of the dependency against Boost in the SQLite C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1220
diff changeset
49 #include "NonCopyable.h"
2302
f31dfb131dee fix backward compatibility with SQLite < 3.19.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
50 #include "SQLiteTypes.h"
1221
2255e66da726 getting rid of the dependency against Boost in the SQLite C++ wrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1220
diff changeset
51
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 #include <stdint.h>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 #include <stdlib.h>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
59
c996319e90bc renaming in Core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 50
diff changeset
56 namespace Orthanc
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 namespace SQLite
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 {
3992
f9863630ec7f working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3063
diff changeset
60 class ORTHANC_PUBLIC StatementReference : NonCopyable
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 private:
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 StatementReference* root_; // Only used for non-root nodes
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 uint32_t refCount_; // Only used for root node
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 struct sqlite3_stmt* statement_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 bool IsRoot() const;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 public:
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 StatementReference();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 StatementReference(sqlite3* database,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 const char* sql);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 StatementReference(StatementReference& other);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 ~StatementReference();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 uint32_t GetReferenceCount() const;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
4304
50b0c69b653a continued abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
81 struct sqlite3_stmt* GetWrappedObject() const;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 }