Line | Branch | Exec | Source |
---|---|---|---|
1 | // SPDX-FileCopyrightText: 2023 Carl Zeiss Microscopy GmbH | ||
2 | // | ||
3 | // SPDX-License-Identifier: MIT | ||
4 | |||
5 | #include <variant> | ||
6 | #include <sstream> | ||
7 | #include <algorithm> | ||
8 | #include <map> | ||
9 | #include <vector> | ||
10 | #include <gsl/assert> | ||
11 | #include "documentRead3d.h" | ||
12 | #include "../db/utilities.h" | ||
13 | #include "../db/sqlite/custom_functions.h" | ||
14 | |||
15 | using namespace std; | ||
16 | using namespace imgdoc2; | ||
17 | |||
18 | 4586 | /*virtual*/void DocumentRead3d::ReadBrickInfo(imgdoc2::dbIndex idx, imgdoc2::ITileCoordinateMutate* coordinate, imgdoc2::LogicalPositionInfo3D* info, imgdoc2::BrickBlobInfo* brick_blob_info) | |
19 | { | ||
20 |
1/2✓ Branch 1 taken 4586 times.
✗ Branch 2 not taken.
|
4586 | const auto query_statement = this->GetReadBrickInfo_Statement(coordinate != nullptr, info != nullptr, brick_blob_info != nullptr); |
21 |
1/2✓ Branch 2 taken 4586 times.
✗ Branch 3 not taken.
|
4586 | query_statement->BindInt64(1, idx); |
22 | |||
23 | // we are expecting exactly one result, or zero in case of "not found" | ||
24 |
3/4✓ Branch 6 taken 4586 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 4584 times.
|
4586 | if (!this->GetDocument()->GetDatabase_connection()->StepStatement(query_statement.get())) |
25 | { | ||
26 | // this means that the brick with the specified index ('idx') was not found | ||
27 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | ostringstream ss; |
28 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
2 | ss << "Request for reading brickinfo for an non-existing brick (with pk=" << idx << ")"; |
29 |
2/4✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | throw non_existing_tile_exception(ss.str(), idx); |
30 | 2 | } | |
31 | |||
32 | 4584 | int result_index = 0; | |
33 |
1/2✓ Branch 0 taken 4584 times.
✗ Branch 1 not taken.
|
4584 | if (coordinate != nullptr) |
34 | { | ||
35 |
1/2✓ Branch 1 taken 4584 times.
✗ Branch 2 not taken.
|
4584 | coordinate->Clear(); |
36 |
2/2✓ Branch 10 taken 4584 times.
✓ Branch 11 taken 4584 times.
|
9168 | for (const auto dimension : this->GetDocument()->GetDataBaseConfiguration3d()->GetTileDimensions()) |
37 | { | ||
38 |
2/4✓ Branch 2 taken 4584 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 4584 times.
✗ Branch 6 not taken.
|
4584 | coordinate->Set(dimension, query_statement->GetResultInt32(result_index++)); |
39 | } | ||
40 | } | ||
41 | |||
42 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4580 times.
|
4584 | if (info != nullptr) |
43 | { | ||
44 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | info->posX = query_statement->GetResultDouble(result_index++); |
45 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | info->posY = query_statement->GetResultDouble(result_index++); |
46 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | info->posZ = query_statement->GetResultDouble(result_index++); |
47 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | info->width = query_statement->GetResultDouble(result_index++); |
48 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | info->height = query_statement->GetResultDouble(result_index++); |
49 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | info->depth = query_statement->GetResultDouble(result_index++); |
50 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | info->pyrLvl = query_statement->GetResultInt32(result_index++); |
51 | } | ||
52 | |||
53 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4580 times.
|
4584 | if (brick_blob_info != nullptr) |
54 | { | ||
55 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | brick_blob_info->base_info.pixelWidth = query_statement->GetResultUInt32(result_index++); |
56 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | brick_blob_info->base_info.pixelHeight = query_statement->GetResultUInt32(result_index++); |
57 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | brick_blob_info->base_info.pixelDepth = query_statement->GetResultUInt32(result_index++); |
58 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | brick_blob_info->base_info.pixelType = query_statement->GetResultUInt8(result_index++); |
59 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | brick_blob_info->data_type = static_cast<DataTypes>(query_statement->GetResultInt32(result_index++)); // TODO(JBL): check whether valid enum value |
60 | } | ||
61 | 4586 | } | |
62 | 8 | /*virtual*/void DocumentRead3d::Query(const imgdoc2::IDimCoordinateQueryClause* coordinate_clause, const imgdoc2::ITileInfoQueryClause* tileinfo_clause, const std::function<bool(imgdoc2::dbIndex)>& func) | |
63 | { | ||
64 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 | const auto query_statement = this->CreateQueryStatement(coordinate_clause, tileinfo_clause); |
65 | |||
66 |
3/4✓ Branch 6 taken 2014 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2006 times.
✓ Branch 9 taken 8 times.
|
2014 | while (this->GetDocument()->GetDatabase_connection()->StepStatement(query_statement.get())) |
67 | { | ||
68 |
1/2✓ Branch 2 taken 2006 times.
✗ Branch 3 not taken.
|
2006 | const imgdoc2::dbIndex index = query_statement->GetResultInt64(0); |
69 |
1/2✓ Branch 1 taken 2006 times.
✗ Branch 2 not taken.
|
2006 | const bool continue_operation = func(index); |
70 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2006 times.
|
2006 | if (!continue_operation) |
71 | { | ||
72 | ✗ | break; | |
73 | } | ||
74 | } | ||
75 | 8 | } | |
76 | |||
77 | 8 | /*virtual*/void DocumentRead3d::GetTilesIntersectingCuboid(const imgdoc2::CuboidD& cuboid, const imgdoc2::IDimCoordinateQueryClause* coordinate_clause, const imgdoc2::ITileInfoQueryClause* tileinfo_clause, const std::function<bool(imgdoc2::dbIndex)>& func) | |
78 | { | ||
79 | 8 | shared_ptr<IDbStatement> query_statement; | |
80 |
3/4✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 4 times.
|
8 | if (this->GetDocument()->GetDataBaseConfiguration3d()->GetIsUsingSpatialIndex()) |
81 | { | ||
82 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | query_statement = this->GetTilesIntersectingCuboidQueryAndCoordinateAndInfoQueryClauseWithSpatialIndex(cuboid, coordinate_clause, tileinfo_clause); |
83 | } | ||
84 | else | ||
85 | { | ||
86 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | query_statement = this->GetTilesIntersectingCuboidQueryAndCoordinateAndInfoQueryClause(cuboid, coordinate_clause, tileinfo_clause); |
87 | } | ||
88 | |||
89 |
3/4✓ Branch 6 taken 56 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 48 times.
✓ Branch 9 taken 8 times.
|
56 | while (this->GetDocument()->GetDatabase_connection()->StepStatement(query_statement.get())) |
90 | { | ||
91 |
1/2✓ Branch 2 taken 48 times.
✗ Branch 3 not taken.
|
48 | const imgdoc2::dbIndex index = query_statement->GetResultInt64(0); |
92 |
1/2✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
|
48 | const bool continue_operation = func(index); |
93 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if (!continue_operation) |
94 | { | ||
95 | ✗ | break; | |
96 | } | ||
97 | } | ||
98 | 8 | } | |
99 | |||
100 | 28 | /*virtual*/void DocumentRead3d::GetTilesIntersectingPlane(const imgdoc2::Plane_NormalAndDistD& plane, const imgdoc2::IDimCoordinateQueryClause* coordinate_clause, const imgdoc2::ITileInfoQueryClause* tileinfo_clause, const std::function<bool(imgdoc2::dbIndex)>& func) | |
101 | { | ||
102 | 28 | shared_ptr<IDbStatement> query_statement; | |
103 |
3/4✓ Branch 5 taken 28 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 14 times.
✓ Branch 8 taken 14 times.
|
28 | if (this->GetDocument()->GetDataBaseConfiguration3d()->GetIsUsingSpatialIndex()) |
104 | { | ||
105 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | query_statement = this->GetTilesIntersectingWithPlaneQueryAndCoordinateAndInfoQueryClauseWithSpatialIndex(plane, coordinate_clause, tileinfo_clause); |
106 | } | ||
107 | else | ||
108 | { | ||
109 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | query_statement = this->GetTilesIntersectingWithPlaneQueryAndCoordinateAndInfoQueryClause(plane, coordinate_clause, tileinfo_clause); |
110 | } | ||
111 | |||
112 |
3/4✓ Branch 6 taken 2560 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2532 times.
✓ Branch 9 taken 28 times.
|
2560 | while (this->GetDocument()->GetDatabase_connection()->StepStatement(query_statement.get())) |
113 | { | ||
114 |
1/2✓ Branch 2 taken 2532 times.
✗ Branch 3 not taken.
|
2532 | const imgdoc2::dbIndex index = query_statement->GetResultInt64(0); |
115 |
1/2✓ Branch 1 taken 2532 times.
✗ Branch 2 not taken.
|
2532 | const bool continue_operation = func(index); |
116 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2532 times.
|
2532 | if (!continue_operation) |
117 | { | ||
118 | ✗ | break; | |
119 | } | ||
120 | } | ||
121 | 28 | } | |
122 | |||
123 | // interface IDocInfo | ||
124 | 4 | /*virtual*/void DocumentRead3d::GetTileDimensions(imgdoc2::Dimension* dimensions, std::uint32_t& count) | |
125 | { | ||
126 | 4 | DocumentReadBase::GetEntityDimensionsInternal( | |
127 | 4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetTileDimensions(), | |
128 | dimensions, | ||
129 | count); | ||
130 | 4 | } | |
131 | |||
132 | 2 | /*virtual*/std::map<imgdoc2::Dimension, imgdoc2::Int32Interval> DocumentRead3d::GetMinMaxForTileDimension(const std::vector<imgdoc2::Dimension>& dimensions_to_query_for) | |
133 | { | ||
134 | return this->GetMinMaxForTileDimensionInternal( | ||
135 | dimensions_to_query_for, | ||
136 | 4 | [this](Dimension dimension)->bool { return this->GetDocument()->GetDataBaseConfiguration3d()->IsTileDimensionValid(dimension); }, | |
137 | 8 | [this](ostringstream& ss, imgdoc2::Dimension dimension)->void { ss << this->GetDocument()->GetDataBaseConfiguration3d()->GetDimensionsColumnPrefix() << dimension; }, | |
138 |
2/4✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
|
2 | this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesInfoOrThrow()); |
139 | } | ||
140 | |||
141 | 14 | /*virtual*/std::uint64_t DocumentRead3d::GetTotalTileCount() | |
142 | { | ||
143 |
2/4✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
|
14 | return DocumentReadBase::GetTotalTileCount(this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesInfoOrThrow()); |
144 | } | ||
145 | |||
146 | 6 | /*virtual*/std::map<int, std::uint64_t> DocumentRead3d::GetTileCountPerLayer() | |
147 | { | ||
148 | return DocumentReadBase::GetTileCountPerLayer( | ||
149 |
1/2✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
|
12 | this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesInfoOrThrow(), |
150 |
2/4✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
|
18 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_PyramidLevel)); |
151 | } | ||
152 | |||
153 | 10 | /*virtual*/void DocumentRead3d::GetBricksBoundingBox(imgdoc2::DoubleInterval* bounds_x, imgdoc2::DoubleInterval* bounds_y, imgdoc2::DoubleInterval* bounds_z) | |
154 | { | ||
155 |
6/6✓ Branch 0 taken 6 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 2 times.
|
10 | if (bounds_x == nullptr && bounds_y == nullptr && bounds_z == nullptr) |
156 | { | ||
157 | // nothing to do here | ||
158 | 2 | return; | |
159 | } | ||
160 | |||
161 | // case "no spatial index" | ||
162 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 | const auto statement = this->CreateQueryTilesBoundingBoxStatement(bounds_x != nullptr, bounds_y != nullptr, bounds_z != nullptr); |
163 |
2/4✓ Branch 6 taken 8 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 8 times.
|
8 | if (!this->GetDocument()->GetDatabase_connection()->StepStatement(statement.get())) |
164 | { | ||
165 | ✗ | throw internal_error_exception("database-query gave no result, this is unexpected."); | |
166 | } | ||
167 | |||
168 | 8 | int result_index = 0; | |
169 |
1/2✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | result_index = DocumentReadBase::SetCoordinateBoundsValueIfNonNull(bounds_x, statement.get(), result_index); |
170 |
1/2✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | result_index = DocumentReadBase::SetCoordinateBoundsValueIfNonNull(bounds_y, statement.get(), result_index); |
171 |
1/2✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | DocumentReadBase::SetCoordinateBoundsValueIfNonNull(bounds_z, statement.get(), result_index); |
172 | 8 | } | |
173 | |||
174 | 4 | /*virtual*/void DocumentRead3d::ReadBrickData(imgdoc2::dbIndex idx, imgdoc2::IBlobOutput* data) | |
175 | { | ||
176 | // TODO(JBL): if following the idea of a "plug-able blob-storage component", then this operation would be affected. | ||
177 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | const shared_ptr<IDbStatement> query_statement = this->GetReadBrickDataQueryStatement(idx); |
178 | |||
179 | // TODO(JBL): - we expect one and only one result, should raise an error otherwise | ||
180 | // - also, we need to report if no result is found | ||
181 |
3/4✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 2 times.
|
4 | if (this->GetDocument()->GetDatabase_connection()->StepStatement(query_statement.get())) |
182 | { | ||
183 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | query_statement->GetResultBlob(0, data); |
184 | } | ||
185 | else | ||
186 | { | ||
187 | // this means that the tile with the specified index ('idx') was not found | ||
188 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | ostringstream ss; |
189 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
2 | ss << "Request for reading brick-data for an non-existing brick (with pk=" << idx << ")"; |
190 |
2/4✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | throw non_existing_tile_exception(ss.str(), idx); |
191 | 2 | } | |
192 | |||
193 | // if we found multiple "blobs" with above query, this is a fatal error | ||
194 |
2/4✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
|
2 | if (this->GetDocument()->GetDatabase_connection()->StepStatement(query_statement.get())) |
195 | { | ||
196 | ✗ | ostringstream ss; | |
197 | ✗ | ss << "Multiple results from 'ReadBrickData'-query, which must not happen."; | |
198 | ✗ | this->GetHostingEnvironment()->ReportFatalErrorAndExit(ss.str().c_str()); | |
199 | ✗ | } | |
200 | 4 | } | |
201 | |||
202 | 4 | std::shared_ptr<IDbStatement> DocumentRead3d::GetReadBrickDataQueryStatement(imgdoc2::dbIndex idx) | |
203 | { | ||
204 | // we create a statement like this: | ||
205 | // SELECT [BLOBS].[Data] | ||
206 | // FROM [TILESDATA] | ||
207 | // LEFT JOIN[BLOBS] ON [TILESDATA].[BinDataId] = [BLOBS].[Pk] | ||
208 | // WHERE [TILESDATA].[Pk] = ?1; | ||
209 | // | ||
210 | // To be noted: | ||
211 | // * If the row with the specified primary key is not found (in the TILESDATA-table), then we | ||
212 | // get an empty result set. | ||
213 | // * If, on the other hand, the row in TILESDATA is found, but there is no corresponding element in the | ||
214 | // [BLOBS]-table, then we a result with a null | ||
215 | // | ||
216 | // This allows us to distinguish between "invalid idx" and "no blob present" | ||
217 | |||
218 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | ostringstream string_stream; |
219 |
1/2✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
4 | string_stream << "SELECT [" << this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForBlobTableOrThrow() << "]." |
220 |
1/2✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
8 | << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfBlobTableOrThrow(DatabaseConfiguration3D::kBlobTable_Column_Data) << "] " |
221 |
2/4✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
|
12 | << "FROM [" << this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesDataOrThrow() << "] LEFT JOIN [" << this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForBlobTableOrThrow() << "] " |
222 |
2/4✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
|
12 | << "ON [" << this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesDataOrThrow() << "].[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_BinDataId) << "]" |
223 |
2/4✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
|
12 | << " = [" << this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForBlobTableOrThrow() << "].[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfBlobTableOrThrow(DatabaseConfiguration3D::kBlobTable_Column_Pk) << "]" |
224 |
28/56✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 4 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✓ Branch 25 taken 4 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 4 times.
✗ Branch 29 not taken.
✓ Branch 32 taken 4 times.
✗ Branch 33 not taken.
✓ Branch 35 taken 4 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 4 times.
✗ Branch 39 not taken.
✓ Branch 42 taken 4 times.
✗ Branch 43 not taken.
✓ Branch 45 taken 4 times.
✗ Branch 46 not taken.
✓ Branch 49 taken 4 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 4 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 4 times.
✗ Branch 56 not taken.
✓ Branch 59 taken 4 times.
✗ Branch 60 not taken.
✓ Branch 62 taken 4 times.
✗ Branch 63 not taken.
✓ Branch 66 taken 4 times.
✗ Branch 67 not taken.
✓ Branch 69 taken 4 times.
✗ Branch 70 not taken.
✓ Branch 72 taken 4 times.
✗ Branch 73 not taken.
✓ Branch 79 taken 4 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 4 times.
✗ Branch 83 not taken.
✓ Branch 85 taken 4 times.
✗ Branch 86 not taken.
✓ Branch 92 taken 4 times.
✗ Branch 93 not taken.
✓ Branch 95 taken 4 times.
✗ Branch 96 not taken.
✓ Branch 98 taken 4 times.
✗ Branch 99 not taken.
|
36 | << " WHERE [" << this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesDataOrThrow() << "].[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_Pk) << "] = ?1;"; |
225 | |||
226 | // we create a statement like this: | ||
227 | // | ||
228 | // SELECT [Data] FROM [BLOBS] WHERE [BLOBS].[Pk] = | ||
229 | // ( | ||
230 | // SELECT BinDataId FROM TILESDATA WHERE Pk = 1 AND BinDataStorageType = 1 | ||
231 | // ) | ||
232 | // | ||
233 | |||
234 |
2/4✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
|
4 | auto statement = this->GetDocument()->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
235 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | statement->BindInt64(1, idx); |
236 | 8 | return statement; | |
237 | 4 | } | |
238 | |||
239 | 4586 | shared_ptr<IDbStatement> DocumentRead3d::GetReadBrickInfo_Statement(bool include_brick_coordinates, bool include_logical_position_info, bool include_brick_blob_info) | |
240 | { | ||
241 | // If include_tile_blob_info is false, we create a SQL-state something like this: | ||
242 | // | ||
243 | // SELECT [Dim_C],[Dim_S],[Dim_T],[Dim_M],[TileX],[TileY],[TileW],[TileH],[PyramidLevel] FROM [TILESINFO] WHERE [TileDataId] = ?1; | ||
244 | // | ||
245 | // The SELECT-state contains all included dimensions, then TileX, TileY, TileZ, TileW, TileH, TileD, PyramidLevel. | ||
246 | // If include_brick_coordinates is false, then the dimensions are not included; and if include_logical_position_info is false, | ||
247 | // then the group "TileX, TileY, TileZ, TileW, TileH, TildeD, PyramidLevel" is not included. | ||
248 | // | ||
249 | // If include_tile_blob_info is true, then a SQL-statement something like this is created: | ||
250 | // | ||
251 | // SELECT [Dim_C],[Dim_S],[Dim_T],[Dim_M],[TileX],[TileY],[TileZ],[TileW],[TileH],[TileD],[PyramidLevel],[PixelWidth],[PixelHeight],[PixelDepth],[TILESDATA].[PixelType],[TILESDATA].[BinDataStorageType] | ||
252 | // FROM [TILESINFO] LEFT JOIN[TILESDATA] ON [TILESINFO].[TileDataId] = [TILESDATA].[Pk] | ||
253 | // WHERE[TileDataId] = ?1; | ||
254 | |||
255 |
1/2✓ Branch 1 taken 4586 times.
✗ Branch 2 not taken.
|
4586 | stringstream string_stream; |
256 |
1/2✓ Branch 1 taken 4586 times.
✗ Branch 2 not taken.
|
4586 | string_stream << "SELECT "; |
257 | |||
258 | // this is used to keep track whether an item (=column-name) as already been added (in order to add ',' when appropriate) | ||
259 | 4586 | bool item_has_been_added = false; | |
260 | |||
261 |
1/2✓ Branch 0 taken 4586 times.
✗ Branch 1 not taken.
|
4586 | if (include_brick_coordinates) |
262 | { | ||
263 |
1/2✓ Branch 6 taken 4586 times.
✗ Branch 7 not taken.
|
4586 | const auto tile_dimension = this->GetDocument()->GetDataBaseConfiguration3d()->GetTileDimensions(); |
264 |
2/2✓ Branch 4 taken 4586 times.
✓ Branch 5 taken 4586 times.
|
9172 | for (const auto dimension : tile_dimension) |
265 | { | ||
266 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4586 times.
|
4586 | if (item_has_been_added) |
267 | { | ||
268 | ✗ | string_stream << ","; | |
269 | } | ||
270 | |||
271 |
4/8✓ Branch 1 taken 4586 times.
✗ Branch 2 not taken.
✓ Branch 9 taken 4586 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 4586 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 4586 times.
✗ Branch 16 not taken.
|
4586 | string_stream << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetDimensionsColumnPrefix() << dimension << "]"; |
272 | 4586 | item_has_been_added = true; | |
273 | } | ||
274 | 4586 | } | |
275 | |||
276 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 4580 times.
|
4586 | if (include_logical_position_info) |
277 | { | ||
278 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if (item_has_been_added) |
279 | { | ||
280 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
6 | string_stream << ','; |
281 | } | ||
282 | |||
283 |
1/2✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
6 | string_stream << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileX) << "]," |
284 |
1/2✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
12 | << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileY) << "]," |
285 |
1/2✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
12 | << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileZ) << "]," |
286 |
1/2✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
12 | << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileW) << "]," |
287 |
1/2✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
12 | << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileH) << "]," |
288 |
1/2✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
12 | << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileD) << "]," |
289 |
22/44✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 6 times.
✗ Branch 12 not taken.
✓ Branch 15 taken 6 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 6 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 6 times.
✗ Branch 22 not taken.
✓ Branch 25 taken 6 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 6 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 6 times.
✗ Branch 32 not taken.
✓ Branch 35 taken 6 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 6 times.
✗ Branch 39 not taken.
✓ Branch 41 taken 6 times.
✗ Branch 42 not taken.
✓ Branch 45 taken 6 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 6 times.
✗ Branch 49 not taken.
✓ Branch 51 taken 6 times.
✗ Branch 52 not taken.
✓ Branch 55 taken 6 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 6 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 6 times.
✗ Branch 62 not taken.
✓ Branch 68 taken 6 times.
✗ Branch 69 not taken.
✓ Branch 71 taken 6 times.
✗ Branch 72 not taken.
✓ Branch 74 taken 6 times.
✗ Branch 75 not taken.
|
42 | << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_PyramidLevel) << "]"; |
290 | 6 | item_has_been_added = true; | |
291 | } | ||
292 | |||
293 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4582 times.
|
4586 | if (include_brick_blob_info) |
294 | { | ||
295 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (item_has_been_added) |
296 | { | ||
297 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | string_stream << ','; |
298 | } | ||
299 | |||
300 |
4/8✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
|
4 | string_stream << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_PixelWidth) << "],"; |
301 |
4/8✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
|
4 | string_stream << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_PixelHeight) << "],"; |
302 |
4/8✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
|
4 | string_stream << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_PixelDepth) << "],"; |
303 |
4/8✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
|
4 | string_stream << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_PixelType) << "],"; |
304 |
4/8✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
|
4 | string_stream << "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_TileDataType) << "]"; |
305 | } | ||
306 | |||
307 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 4586 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
4586 | if (!include_brick_coordinates && !include_logical_position_info && !include_brick_blob_info) |
308 | { | ||
309 | // c.f. https://stackoverflow.com/questions/4253960/sql-how-to-properly-check-if-a-record-exists -> if all three clauses are not given, | ||
310 | // we create a SQL-statement something like "SELECT 1 FROM [TILESINFO] WHERE [TileDataId] = ?1;" which gives a result of "1" if the | ||
311 | // row exists, and an empty result otherwise | ||
312 | ✗ | string_stream << " 1 "; | |
313 | } | ||
314 | |||
315 |
1/2✓ Branch 5 taken 4586 times.
✗ Branch 6 not taken.
|
4586 | const auto tiles_info_table_name = this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesInfoOrThrow(); |
316 |
1/2✓ Branch 5 taken 4586 times.
✗ Branch 6 not taken.
|
4586 | const auto tiles_data_table_name = this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesDataOrThrow(); |
317 | |||
318 |
3/6✓ Branch 1 taken 4586 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4586 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4586 times.
✗ Branch 8 not taken.
|
4586 | string_stream << " FROM [" << tiles_info_table_name << "] "; |
319 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4582 times.
|
4586 | if (include_brick_blob_info) |
320 | { | ||
321 | string_stream << "LEFT JOIN " << tiles_data_table_name << " ON " | ||
322 |
1/2✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
8 | << "[" << tiles_info_table_name << "].[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileDataId) << "]=" |
323 |
14/28✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 4 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 4 times.
✗ Branch 27 not taken.
✓ Branch 29 taken 4 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 4 times.
✗ Branch 33 not taken.
✓ Branch 39 taken 4 times.
✗ Branch 40 not taken.
✓ Branch 42 taken 4 times.
✗ Branch 43 not taken.
✓ Branch 45 taken 4 times.
✗ Branch 46 not taken.
|
8 | << "[" << tiles_data_table_name << "].[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_Pk) << "] "; |
324 | } | ||
325 | |||
326 |
4/8✓ Branch 1 taken 4586 times.
✗ Branch 2 not taken.
✓ Branch 8 taken 4586 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4586 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 4586 times.
✗ Branch 15 not taken.
|
4586 | string_stream << "WHERE [" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileDataId) << "]=?1;"; |
327 | |||
328 |
2/4✓ Branch 5 taken 4586 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 4586 times.
✗ Branch 9 not taken.
|
4586 | auto statement = this->GetDocument()->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
329 | 9172 | return statement; | |
330 | 4586 | } | |
331 | |||
332 | 8 | shared_ptr<IDbStatement> DocumentRead3d::CreateQueryStatement(const imgdoc2::IDimCoordinateQueryClause* coordinate_clause, const imgdoc2::ITileInfoQueryClause* tileinfo_clause) | |
333 | { | ||
334 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 | ostringstream string_stream; |
335 |
1/2✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
|
8 | string_stream << "SELECT [" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_Pk) << "]," << |
336 |
1/2✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
|
16 | "[" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileDataId) << "] " << |
337 |
1/2✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
|
16 | "FROM [" << this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesInfoOrThrow() << "] " << |
338 |
10/20✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 8 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 8 times.
✗ Branch 12 not taken.
✓ Branch 15 taken 8 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 8 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 8 times.
✗ Branch 22 not taken.
✓ Branch 25 taken 8 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 8 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 8 times.
✗ Branch 32 not taken.
|
32 | "WHERE "; |
339 | |||
340 |
1/2✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
|
8 | const auto query_statement_and_binding_info = Utilities::CreateWhereStatement(coordinate_clause, tileinfo_clause, *this->GetDocument()->GetDataBaseConfiguration3d()); |
341 |
2/4✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
|
8 | string_stream << get<0>(query_statement_and_binding_info) << ";"; |
342 | |||
343 |
2/4✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 8 times.
✗ Branch 9 not taken.
|
8 | auto statement = this->GetDocument()->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
344 | |||
345 | 8 | int binding_index = 1; | |
346 |
2/2✓ Branch 5 taken 4 times.
✓ Branch 6 taken 8 times.
|
12 | for (const auto& bind_info : get<1>(query_statement_and_binding_info)) |
347 | { | ||
348 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | if (holds_alternative<int>(bind_info.value)) |
349 | { | ||
350 |
2/4✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
|
4 | statement->BindInt32(binding_index, get<int>(bind_info.value)); |
351 | } | ||
352 | ✗ | else if (holds_alternative<int64_t>(bind_info.value)) | |
353 | { | ||
354 | ✗ | statement->BindInt64(binding_index, get<int64_t>(bind_info.value)); | |
355 | } | ||
356 | ✗ | else if (holds_alternative<double>(bind_info.value)) | |
357 | { | ||
358 | ✗ | statement->BindDouble(binding_index, get<double>(bind_info.value)); | |
359 | } | ||
360 | else | ||
361 | { | ||
362 | ✗ | throw logic_error("invalid variant"); | |
363 | } | ||
364 | |||
365 | 4 | ++binding_index; | |
366 | } | ||
367 | |||
368 | 16 | return statement; | |
369 | 8 | } | |
370 | |||
371 | 2 | std::shared_ptr<IDbStatement> DocumentRead3d::GetTilesIntersectingCuboidQuery(const imgdoc2::CuboidD& cuboid) | |
372 | { | ||
373 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | ostringstream string_stream; |
374 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | string_stream << "SELECT " << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_Pk) << " FROM " << |
375 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesInfoOrThrow() << " WHERE " << |
376 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileX) << '+' << |
377 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileW) << ">=?1 AND " << |
378 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileX) << "<=?2 AND " << |
379 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileY) << '+' << |
380 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileH) << ">=?3 AND " << |
381 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileY) << "<=?4 AND " << |
382 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileZ) << '+' << |
383 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileD) << ">=?5 AND " << |
384 |
24/48✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✓ Branch 19 taken 2 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 2 times.
✗ Branch 23 not taken.
✓ Branch 26 taken 2 times.
✗ Branch 27 not taken.
✓ Branch 29 taken 2 times.
✗ Branch 30 not taken.
✓ Branch 33 taken 2 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 2 times.
✗ Branch 37 not taken.
✓ Branch 40 taken 2 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 2 times.
✗ Branch 44 not taken.
✓ Branch 47 taken 2 times.
✗ Branch 48 not taken.
✓ Branch 50 taken 2 times.
✗ Branch 51 not taken.
✓ Branch 54 taken 2 times.
✗ Branch 55 not taken.
✓ Branch 57 taken 2 times.
✗ Branch 58 not taken.
✓ Branch 61 taken 2 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 2 times.
✗ Branch 65 not taken.
✓ Branch 68 taken 2 times.
✗ Branch 69 not taken.
✓ Branch 71 taken 2 times.
✗ Branch 72 not taken.
✓ Branch 78 taken 2 times.
✗ Branch 79 not taken.
✓ Branch 81 taken 2 times.
✗ Branch 82 not taken.
✓ Branch 84 taken 2 times.
✗ Branch 85 not taken.
|
22 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileZ) << "<=?6"; |
385 | |||
386 |
2/4✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
2 | auto statement = this->GetDocument()->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
387 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(1, cuboid.x); |
388 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(2, cuboid.x + cuboid.w); |
389 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(3, cuboid.y); |
390 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(4, cuboid.y + cuboid.h); |
391 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(5, cuboid.z); |
392 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(6, cuboid.z + cuboid.d); |
393 | 4 | return statement; | |
394 | 2 | } | |
395 | |||
396 | 4 | std::shared_ptr<IDbStatement> DocumentRead3d::GetTilesIntersectingCuboidQueryAndCoordinateAndInfoQueryClause(const imgdoc2::CuboidD& cuboid, const imgdoc2::IDimCoordinateQueryClause* coordinate_clause, const imgdoc2::ITileInfoQueryClause* tileinfo_clause) | |
397 | { | ||
398 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
4 | if (coordinate_clause == nullptr && tileinfo_clause == nullptr) |
399 | { | ||
400 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | return this->GetTilesIntersectingCuboidQuery(cuboid); |
401 | } | ||
402 | |||
403 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | ostringstream string_stream; |
404 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | string_stream << "SELECT " << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_Pk) << " FROM " << |
405 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesInfoOrThrow() << " WHERE (" << |
406 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileX) << '+' << |
407 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileW) << ">=?1 AND " << |
408 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileX) << "<=?2 AND " << |
409 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileY) << '+' << |
410 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileH) << ">=?3 AND " << |
411 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileY) << "<=?4 AND " << |
412 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileZ) << '+' << |
413 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileD) << ">=?5 AND " << |
414 |
24/48✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✓ Branch 19 taken 2 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 2 times.
✗ Branch 23 not taken.
✓ Branch 26 taken 2 times.
✗ Branch 27 not taken.
✓ Branch 29 taken 2 times.
✗ Branch 30 not taken.
✓ Branch 33 taken 2 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 2 times.
✗ Branch 37 not taken.
✓ Branch 40 taken 2 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 2 times.
✗ Branch 44 not taken.
✓ Branch 47 taken 2 times.
✗ Branch 48 not taken.
✓ Branch 50 taken 2 times.
✗ Branch 51 not taken.
✓ Branch 54 taken 2 times.
✗ Branch 55 not taken.
✓ Branch 57 taken 2 times.
✗ Branch 58 not taken.
✓ Branch 61 taken 2 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 2 times.
✗ Branch 65 not taken.
✓ Branch 68 taken 2 times.
✗ Branch 69 not taken.
✓ Branch 71 taken 2 times.
✗ Branch 72 not taken.
✓ Branch 78 taken 2 times.
✗ Branch 79 not taken.
✓ Branch 81 taken 2 times.
✗ Branch 82 not taken.
✓ Branch 84 taken 2 times.
✗ Branch 85 not taken.
|
22 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileZ) << "<=?6)"; |
415 | |||
416 |
1/2✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | const auto query_statement_and_binding_info = Utilities::CreateWhereStatement(coordinate_clause, tileinfo_clause, *this->GetDocument()->GetDataBaseConfiguration3d()); |
417 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
2 | string_stream << " AND " << get<0>(query_statement_and_binding_info) << ";"; |
418 | |||
419 |
2/4✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
2 | auto statement = this->GetDocument()->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
420 | 2 | int binding_index = 1; | |
421 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(binding_index++, cuboid.x); |
422 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(binding_index++, cuboid.x + cuboid.w); |
423 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(binding_index++, cuboid.y); |
424 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(binding_index++, cuboid.y + cuboid.h); |
425 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(binding_index++, cuboid.z); |
426 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(binding_index++, cuboid.z + cuboid.d); |
427 | |||
428 |
2/2✓ Branch 5 taken 8 times.
✓ Branch 6 taken 2 times.
|
10 | for (const auto& bind_info : get<1>(query_statement_and_binding_info)) |
429 | { | ||
430 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 | if (holds_alternative<int>(bind_info.value)) |
431 | { | ||
432 |
2/4✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
|
8 | statement->BindInt32(binding_index, get<int>(bind_info.value)); |
433 | } | ||
434 | ✗ | else if (holds_alternative<int64_t>(bind_info.value)) | |
435 | { | ||
436 | ✗ | statement->BindInt64(binding_index, get<int64_t>(bind_info.value)); | |
437 | } | ||
438 | ✗ | else if (holds_alternative<double>(bind_info.value)) | |
439 | { | ||
440 | ✗ | statement->BindDouble(binding_index, get<double>(bind_info.value)); | |
441 | } | ||
442 | else | ||
443 | { | ||
444 | ✗ | throw logic_error("invalid variant"); | |
445 | } | ||
446 | |||
447 | 8 | ++binding_index; | |
448 | } | ||
449 | |||
450 | 2 | return statement; | |
451 | 2 | } | |
452 | |||
453 | 4 | std::shared_ptr<IDbStatement> DocumentRead3d::GetTilesIntersectingCuboidQueryAndCoordinateAndInfoQueryClauseWithSpatialIndex(const imgdoc2::CuboidD& cuboid, const imgdoc2::IDimCoordinateQueryClause* coordinate_clause, const imgdoc2::ITileInfoQueryClause* tileinfo_clause) | |
454 | { | ||
455 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
4 | if (coordinate_clause == nullptr && tileinfo_clause == nullptr) |
456 | { | ||
457 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | return this->GetTilesIntersectingCuboidQueryWithSpatialIndex(cuboid); |
458 | } | ||
459 | |||
460 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | ostringstream string_stream; |
461 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | string_stream << "SELECT spatialindex." << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_Pk) << " FROM " |
462 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | << this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesSpatialIndexTableOrThrow() << " spatialindex " |
463 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | << "INNER JOIN " << this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesInfoOrThrow() << " info ON " |
464 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | << "spatialindex." << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_Pk) |
465 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | << " = info." << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_Pk) |
466 | << " WHERE (" << | ||
467 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MaxX) << ">=? AND " << |
468 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MinX) << "<=? AND " << |
469 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MaxY) << ">=? AND " << |
470 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MinY) << "<=? AND " << |
471 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MaxZ) << ">=? AND " << |
472 |
26/52✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
✓ Branch 22 taken 2 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 2 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 2 times.
✗ Branch 29 not taken.
✓ Branch 32 taken 2 times.
✗ Branch 33 not taken.
✓ Branch 35 taken 2 times.
✗ Branch 36 not taken.
✓ Branch 39 taken 2 times.
✗ Branch 40 not taken.
✓ Branch 42 taken 2 times.
✗ Branch 43 not taken.
✓ Branch 46 taken 2 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 2 times.
✗ Branch 50 not taken.
✓ Branch 53 taken 2 times.
✗ Branch 54 not taken.
✓ Branch 56 taken 2 times.
✗ Branch 57 not taken.
✓ Branch 60 taken 2 times.
✗ Branch 61 not taken.
✓ Branch 63 taken 2 times.
✗ Branch 64 not taken.
✓ Branch 67 taken 2 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 2 times.
✗ Branch 71 not taken.
✓ Branch 74 taken 2 times.
✗ Branch 75 not taken.
✓ Branch 77 taken 2 times.
✗ Branch 78 not taken.
✓ Branch 84 taken 2 times.
✗ Branch 85 not taken.
✓ Branch 87 taken 2 times.
✗ Branch 88 not taken.
✓ Branch 90 taken 2 times.
✗ Branch 91 not taken.
|
22 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MinZ) << "<=?) "; |
473 | |||
474 |
1/2✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | const auto query_statement_and_binding_info = Utilities::CreateWhereStatement(coordinate_clause, tileinfo_clause, *this->GetDocument()->GetDataBaseConfiguration3d()); |
475 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
2 | string_stream << " AND " << get<0>(query_statement_and_binding_info) << ";"; |
476 | |||
477 |
2/4✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
2 | auto statement = this->GetDocument()->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
478 | 2 | int binding_index = 1; | |
479 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(binding_index++, cuboid.x); |
480 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(binding_index++, cuboid.x + cuboid.w); |
481 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(binding_index++, cuboid.y); |
482 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(binding_index++, cuboid.y + cuboid.h); |
483 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(binding_index++, cuboid.z); |
484 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(binding_index++, cuboid.z + cuboid.d); |
485 | |||
486 |
2/2✓ Branch 5 taken 8 times.
✓ Branch 6 taken 2 times.
|
10 | for (const auto& bind_info : get<1>(query_statement_and_binding_info)) |
487 | { | ||
488 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 | if (holds_alternative<int>(bind_info.value)) |
489 | { | ||
490 |
2/4✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
|
8 | statement->BindInt32(binding_index, get<int>(bind_info.value)); |
491 | } | ||
492 | ✗ | else if (holds_alternative<int64_t>(bind_info.value)) | |
493 | { | ||
494 | ✗ | statement->BindInt64(binding_index, get<int64_t>(bind_info.value)); | |
495 | } | ||
496 | ✗ | else if (holds_alternative<double>(bind_info.value)) | |
497 | { | ||
498 | ✗ | statement->BindDouble(binding_index, get<double>(bind_info.value)); | |
499 | } | ||
500 | else | ||
501 | { | ||
502 | ✗ | throw logic_error("invalid variant"); | |
503 | } | ||
504 | |||
505 | 8 | ++binding_index; | |
506 | } | ||
507 | |||
508 | 2 | return statement; | |
509 | 2 | } | |
510 | |||
511 | 2 | std::shared_ptr<IDbStatement> DocumentRead3d::GetTilesIntersectingCuboidQueryWithSpatialIndex(const imgdoc2::CuboidD& cuboid) const | |
512 | { | ||
513 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | ostringstream string_stream; |
514 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | string_stream << "SELECT " << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_Pk) << " FROM " << |
515 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesSpatialIndexTableOrThrow() << " WHERE " << |
516 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MaxX) << ">=?1 AND " << |
517 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MinX) << "<=?2 AND " << |
518 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MaxY) << ">=?3 AND " << |
519 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MinY) << "<=?4 AND " << |
520 |
1/2✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MaxZ) << ">=?5 AND " << |
521 |
18/36✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✓ Branch 19 taken 2 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 2 times.
✗ Branch 23 not taken.
✓ Branch 26 taken 2 times.
✗ Branch 27 not taken.
✓ Branch 29 taken 2 times.
✗ Branch 30 not taken.
✓ Branch 33 taken 2 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 2 times.
✗ Branch 37 not taken.
✓ Branch 40 taken 2 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 2 times.
✗ Branch 44 not taken.
✓ Branch 47 taken 2 times.
✗ Branch 48 not taken.
✓ Branch 50 taken 2 times.
✗ Branch 51 not taken.
✓ Branch 57 taken 2 times.
✗ Branch 58 not taken.
✓ Branch 60 taken 2 times.
✗ Branch 61 not taken.
✓ Branch 63 taken 2 times.
✗ Branch 64 not taken.
|
16 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MinZ) << "<=?6"; |
522 | |||
523 |
2/4✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
2 | auto statement = this->GetDocument()->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
524 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(1, cuboid.x); |
525 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(2, cuboid.x + cuboid.w); |
526 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(3, cuboid.y); |
527 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(4, cuboid.y + cuboid.h); |
528 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(5, cuboid.z); |
529 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | statement->BindDouble(6, cuboid.z + cuboid.d); |
530 | |||
531 | 4 | return statement; | |
532 | 2 | } | |
533 | |||
534 | 14 | std::shared_ptr<IDbStatement> DocumentRead3d::GetTilesIntersectingWithPlaneQueryAndCoordinateAndInfoQueryClauseWithSpatialIndex(const imgdoc2::Plane_NormalAndDistD& plane, const imgdoc2::IDimCoordinateQueryClause* coordinate_clause, const imgdoc2::ITileInfoQueryClause* tileinfo_clause) const | |
535 | { | ||
536 |
1/2✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
|
14 | const auto query_statement_and_binding_info_clause = Utilities::CreateWhereStatement(coordinate_clause, tileinfo_clause, *this->GetDocument()->GetDataBaseConfiguration3d()); |
537 | |||
538 | // TODO(JBL): this is SQLite-specific, so best case would be - "somehow" move this to the SQLite-specific implementation of IDbStatement | ||
539 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | stringstream string_stream; |
540 |
1/2✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
|
14 | string_stream << "SELECT spatialindex." << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_Pk) << " FROM " |
541 |
1/2✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
|
28 | << this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesSpatialIndexTableOrThrow() << " spatialindex " |
542 |
1/2✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
|
28 | << "INNER JOIN " << this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesInfoOrThrow() << " info ON " |
543 |
1/2✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
|
28 | << "spatialindex." << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_Pk) |
544 |
1/2✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
|
28 | << " = info." << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_Pk) |
545 | << " WHERE (" | ||
546 |
1/2✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
|
28 | << "spatialindex." << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_Pk) |
547 | << " MATCH " << SqliteCustomFunctions::GetQueryFunctionName(SqliteCustomFunctions::Query::RTree_PlaneAabb3D) << "(?,?,?,?))" | ||
548 |
22/44✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
✓ Branch 12 taken 14 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 14 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 14 times.
✗ Branch 19 not taken.
✓ Branch 22 taken 14 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 14 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 14 times.
✗ Branch 29 not taken.
✓ Branch 32 taken 14 times.
✗ Branch 33 not taken.
✓ Branch 35 taken 14 times.
✗ Branch 36 not taken.
✓ Branch 39 taken 14 times.
✗ Branch 40 not taken.
✓ Branch 42 taken 14 times.
✗ Branch 43 not taken.
✓ Branch 45 taken 14 times.
✗ Branch 46 not taken.
✓ Branch 49 taken 14 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 14 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 14 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 14 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 14 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 14 times.
✗ Branch 65 not taken.
✓ Branch 68 taken 14 times.
✗ Branch 69 not taken.
✓ Branch 71 taken 14 times.
✗ Branch 72 not taken.
|
98 | << " AND " << get<0>(query_statement_and_binding_info_clause) << ";"; |
549 | |||
550 |
2/4✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
|
14 | auto statement = this->GetDocument()->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
551 | |||
552 | 14 | int binding_index = 1; | |
553 |
1/2✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
|
14 | statement->BindDouble(binding_index++, plane.normal.x); |
554 |
1/2✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
|
14 | statement->BindDouble(binding_index++, plane.normal.y); |
555 |
1/2✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
|
14 | statement->BindDouble(binding_index++, plane.normal.z); |
556 |
1/2✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
|
14 | statement->BindDouble(binding_index++, plane.distance); |
557 | |||
558 |
1/2✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
|
14 | Utilities::AddDataBindInfoListToDbStatement(get<1>(query_statement_and_binding_info_clause), statement.get(), binding_index); |
559 | |||
560 | 28 | return statement; | |
561 | 14 | } | |
562 | |||
563 | 14 | std::shared_ptr<IDbStatement> DocumentRead3d::GetTilesIntersectingWithPlaneQueryAndCoordinateAndInfoQueryClause(const imgdoc2::Plane_NormalAndDistD& plane, const imgdoc2::IDimCoordinateQueryClause* coordinate_clause, const imgdoc2::ITileInfoQueryClause* tileinfo_clause) const | |
564 | { | ||
565 |
1/2✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
|
14 | const auto intersect_with_plane_clause = Utilities::CreateWhereConditionForIntersectingWithPlaneClause(plane, *this->GetDocument()->GetDataBaseConfiguration3d()); |
566 |
1/2✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
|
14 | const auto query_statement_and_binding_info_clause = Utilities::CreateWhereStatement(coordinate_clause, tileinfo_clause, *this->GetDocument()->GetDataBaseConfiguration3d()); |
567 | |||
568 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
14 | stringstream string_stream; |
569 |
1/2✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
|
14 | string_stream << "SELECT [" << this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_Pk) << "] FROM " << |
570 |
1/2✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
|
28 | '[' << this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesInfoOrThrow() << "] WHERE " << |
571 |
10/20✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 14 times.
✗ Branch 12 not taken.
✓ Branch 15 taken 14 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 14 times.
✗ Branch 19 not taken.
✓ Branch 22 taken 14 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 14 times.
✗ Branch 26 not taken.
✓ Branch 29 taken 14 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 14 times.
✗ Branch 33 not taken.
|
42 | get<0>(intersect_with_plane_clause) << " AND " << get<0>(query_statement_and_binding_info_clause) << ";"; |
572 | |||
573 |
2/4✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
|
14 | auto statement = this->GetDocument()->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
574 | |||
575 | 14 | int binding_index = 1; | |
576 |
1/2✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
|
14 | binding_index = Utilities::AddDataBindInfoListToDbStatement(get<1>(intersect_with_plane_clause), statement.get(), binding_index); |
577 |
1/2✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
|
14 | Utilities::AddDataBindInfoListToDbStatement(get<1>(query_statement_and_binding_info_clause), statement.get(), binding_index); |
578 | |||
579 | 28 | return statement; | |
580 | 14 | } | |
581 | |||
582 | 8 | std::shared_ptr<IDbStatement> DocumentRead3d::CreateQueryTilesBoundingBoxStatement(bool include_x, bool include_y, bool include_z) const | |
583 | { | ||
584 |
8/10✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 8 times.
|
8 | Expects(include_x == true || include_y == true || include_z == true); |
585 | |||
586 | 8 | vector<QueryMinMaxForXyzInfo> query_min_max_for_xyz_info_list; | |
587 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 | query_min_max_for_xyz_info_list.reserve(3); |
588 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
8 | if (include_x) |
589 | { | ||
590 | 4 | query_min_max_for_xyz_info_list.push_back( | |
591 |
3/8✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
8 | QueryMinMaxForXyzInfo |
592 | { | ||
593 | 4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileX), | |
594 | 4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileW) | |
595 | }); | ||
596 | } | ||
597 | |||
598 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
8 | if (include_y) |
599 | { | ||
600 | 4 | query_min_max_for_xyz_info_list.push_back( | |
601 |
3/8✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
8 | QueryMinMaxForXyzInfo |
602 | { | ||
603 | 4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileY), | |
604 | 4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileH) | |
605 | }); | ||
606 | } | ||
607 | |||
608 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
8 | if (include_z) |
609 | { | ||
610 | 4 | query_min_max_for_xyz_info_list.push_back( | |
611 |
3/8✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
8 | QueryMinMaxForXyzInfo |
612 | { | ||
613 | 4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileZ), | |
614 | 4 | this->GetDocument()->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileD) | |
615 | }); | ||
616 | } | ||
617 | |||
618 |
2/4✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 8 times.
✗ Branch 9 not taken.
|
24 | return this->CreateQueryMinMaxForXyz(this->GetDocument()->GetDataBaseConfiguration3d()->GetTableNameForTilesInfoOrThrow(), query_min_max_for_xyz_info_list); |
619 | 8 | } | |
620 |