Line | Branch | Exec | Source |
---|---|---|---|
1 | // SPDX-FileCopyrightText: 2023 Carl Zeiss Microscopy GmbH | ||
2 | // | ||
3 | // SPDX-License-Identifier: MIT | ||
4 | |||
5 | #include "database_configuration.h" | ||
6 | #include "database_constants.h" | ||
7 | #include <stdexcept> | ||
8 | |||
9 | #include "database_utilities.h" | ||
10 | |||
11 | using namespace std; | ||
12 | |||
13 | 1192 | void DatabaseConfigurationCommon::SetTableName(TableTypeCommon tableType, const char* name) | |
14 | { | ||
15 |
1/2✓ Branch 0 taken 1192 times.
✗ Branch 1 not taken.
|
1192 | if (name != nullptr) |
16 | { | ||
17 | 1192 | this->map_tabletype_to_tablename_[tableType] = name; | |
18 | } | ||
19 | else | ||
20 | { | ||
21 | ✗ | this->map_tabletype_to_tablename_.erase(tableType); | |
22 | } | ||
23 | 1192 | } | |
24 | |||
25 | 118560 | /*virtual*/bool DatabaseConfigurationCommon::TryGetTableName(TableTypeCommon table_type, std::string* name) const | |
26 | { | ||
27 |
1/2✓ Branch 1 taken 118560 times.
✗ Branch 2 not taken.
|
118560 | const auto iterator = this->map_tabletype_to_tablename_.find(table_type); |
28 |
2/2✓ Branch 2 taken 4 times.
✓ Branch 3 taken 118556 times.
|
118560 | if (iterator == this->map_tabletype_to_tablename_.cend()) |
29 | { | ||
30 | 4 | return false; | |
31 | } | ||
32 | |||
33 |
1/2✓ Branch 0 taken 118556 times.
✗ Branch 1 not taken.
|
118556 | if (name != nullptr) |
34 | { | ||
35 |
1/2✓ Branch 2 taken 118556 times.
✗ Branch 3 not taken.
|
118556 | *name = iterator->second; |
36 | } | ||
37 | |||
38 | 118556 | return true; | |
39 | } | ||
40 | |||
41 | 118560 | std::string DatabaseConfigurationCommon::GetTableNameOrThrow(TableTypeCommon table_type) const | |
42 | { | ||
43 | 118560 | std::string table_name; | |
44 |
3/4✓ Branch 1 taken 118560 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 118556 times.
|
118560 | if (!this->TryGetTableName(table_type, &table_name)) |
45 | { | ||
46 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | throw std::runtime_error("table-name not present"); |
47 | } | ||
48 | |||
49 | 118556 | return table_name; | |
50 | 4 | } | |
51 | |||
52 | 1264 | bool DatabaseConfigurationCommon::TryGetColumnNameOfGeneralInfoTable(int columnIdentifier, std::string* column_name) const | |
53 | { | ||
54 | 1264 | const char* requested_column_name = nullptr; | |
55 |
2/3✓ Branch 0 taken 632 times.
✓ Branch 1 taken 632 times.
✗ Branch 2 not taken.
|
1264 | switch (columnIdentifier) |
56 | { | ||
57 | 632 | case kGeneralInfoTable_Column_Key: | |
58 | 632 | requested_column_name = "Key"; | |
59 | 632 | break; | |
60 | 632 | case kGeneralInfoTable_Column_ValueString: | |
61 | 632 | requested_column_name = "ValueString"; | |
62 | 632 | break; | |
63 | ✗ | default: | |
64 | ✗ | break; | |
65 | } | ||
66 | |||
67 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1264 times.
|
1264 | if (requested_column_name == nullptr) |
68 | { | ||
69 | ✗ | return false; | |
70 | } | ||
71 | |||
72 |
1/2✓ Branch 0 taken 1264 times.
✗ Branch 1 not taken.
|
1264 | if (column_name != nullptr) |
73 | { | ||
74 | 1264 | *column_name = requested_column_name; | |
75 | } | ||
76 | |||
77 | 1264 | return true; | |
78 | } | ||
79 | |||
80 | 172 | void DatabaseConfigurationCommon::SetColumnNameForBlobTable(int column_identifier, const char* column_name) | |
81 | { | ||
82 | 172 | SetColumnName(this->map_blobtable_columnids_to_columnname_, column_identifier, column_name); | |
83 | 172 | } | |
84 | |||
85 | 196 | bool DatabaseConfigurationCommon::TryGetColumnNameOfBlobTable(int column_identifier, std::string* column_name) const | |
86 | { | ||
87 | 196 | return GetColumnName(this->map_blobtable_columnids_to_columnname_, column_identifier, column_name); | |
88 | } | ||
89 | |||
90 | 1806 | void DatabaseConfigurationCommon::SetColumnNameForMetadataTable(int column_identifier, const char* column_name) | |
91 | { | ||
92 | 1806 | SetColumnName(this->map_metadatatable_columnids_to_columnname_, column_identifier, column_name); | |
93 | 1806 | } | |
94 | |||
95 | 11560 | bool DatabaseConfigurationCommon::TryGetColumnNameOfMetadataTable(int column_identifier, std::string* column_name) const | |
96 | { | ||
97 | 11560 | return GetColumnName(this->map_metadatatable_columnids_to_columnname_, column_identifier, column_name); | |
98 | } | ||
99 | |||
100 | 47930 | std::string DatabaseConfigurationCommon::GetTableNameForTilesDataOrThrow() const | |
101 | { | ||
102 | 47930 | return this->GetTableNameOrThrow(TableTypeCommon::TilesData); | |
103 | } | ||
104 | |||
105 | 48078 | std::string DatabaseConfigurationCommon::GetTableNameForTilesInfoOrThrow() const | |
106 | { | ||
107 | 48078 | return this->GetTableNameOrThrow(TableTypeCommon::TilesInfo); | |
108 | } | ||
109 | |||
110 | 632 | std::string DatabaseConfigurationCommon::GetTableNameForGeneralTableOrThrow() const | |
111 | { | ||
112 | 632 | return this->GetTableNameOrThrow(TableTypeCommon::GeneralInfo); | |
113 | } | ||
114 | |||
115 | 18692 | std::string DatabaseConfigurationCommon::GetTableNameForTilesSpatialIndexTableOrThrow() const | |
116 | { | ||
117 | 18692 | return this->GetTableNameOrThrow(TableTypeCommon::TilesSpatialIndex); | |
118 | } | ||
119 | |||
120 | 204 | std::string DatabaseConfigurationCommon::GetTableNameForBlobTableOrThrow() const | |
121 | { | ||
122 | 204 | return this->GetTableNameOrThrow(TableTypeCommon::Blobs); | |
123 | } | ||
124 | |||
125 | 3024 | std::string DatabaseConfigurationCommon::GetTableNameForMetadataTableOrThrow() const | |
126 | { | ||
127 | 3024 | return this->GetTableNameOrThrow(TableTypeCommon::Metadata); | |
128 | } | ||
129 | |||
130 | 1264 | std::string DatabaseConfigurationCommon::GetColumnNameOfGeneralInfoTableOrThrow(int column_identifier) const | |
131 | { | ||
132 | 1264 | string general_table_name; | |
133 |
2/4✓ Branch 1 taken 1264 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1264 times.
|
1264 | if (!this->TryGetColumnNameOfGeneralInfoTable(column_identifier, &general_table_name)) |
134 | { | ||
135 | ✗ | throw std::runtime_error("column-name not present"); | |
136 | } | ||
137 | |||
138 | 1264 | return general_table_name; | |
139 | ✗ | } | |
140 | |||
141 | 42040 | bool DatabaseConfigurationCommon::GetIsUsingSpatialIndex() const | |
142 | { | ||
143 |
1/2✓ Branch 1 taken 42040 times.
✗ Branch 2 not taken.
|
42040 | const auto iterator = this->map_tabletype_to_tablename_.find(TableTypeCommon::TilesSpatialIndex); |
144 | 42040 | return iterator != this->map_tabletype_to_tablename_.cend(); | |
145 | } | ||
146 | |||
147 | 94 | bool DatabaseConfigurationCommon::GetHasBlobsTable() const | |
148 | { | ||
149 |
1/2✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
|
94 | const auto iterator = this->map_tabletype_to_tablename_.find(TableTypeCommon::Blobs); |
150 | 94 | return iterator != this->map_tabletype_to_tablename_.cend(); | |
151 | } | ||
152 | |||
153 | ✗ | bool DatabaseConfigurationCommon::GetHasMetadataTable() const | |
154 | { | ||
155 | ✗ | const auto iterator = this->map_tabletype_to_tablename_.find(TableTypeCommon::Metadata); | |
156 | ✗ | return iterator != this->map_tabletype_to_tablename_.cend(); | |
157 | } | ||
158 | |||
159 | ✗ | bool DatabaseConfigurationCommon::IsDimensionIndexed(imgdoc2::Dimension dimension) const | |
160 | { | ||
161 | ✗ | return this->indexed_dimensions_.find(dimension) != this->indexed_dimensions_.cend(); | |
162 | } | ||
163 | |||
164 | 16 | bool DatabaseConfigurationCommon::IsTileDimensionValid(imgdoc2::Dimension dimension) const | |
165 | { | ||
166 |
1/2✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
|
16 | return this->dimensions_.find(dimension) != this->dimensions_.cend(); |
167 | } | ||
168 | |||
169 | 196 | std::string DatabaseConfigurationCommon::GetColumnNameOfBlobTableOrThrow(int column_identifier) const | |
170 | { | ||
171 | 196 | std::string column_name;; | |
172 |
2/4✓ Branch 1 taken 196 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 196 times.
|
196 | if (!this->TryGetColumnNameOfBlobTable(column_identifier, &column_name)) |
173 | { | ||
174 | ✗ | throw std::runtime_error("column-name not present"); | |
175 | } | ||
176 | |||
177 | 196 | return column_name; | |
178 | ✗ | } | |
179 | |||
180 | 11560 | std::string DatabaseConfigurationCommon::GetColumnNameOfMetadataTableOrThrow(int column_identifier) const | |
181 | { | ||
182 | 11560 | std::string column_name;; | |
183 |
2/4✓ Branch 1 taken 11560 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 11560 times.
|
11560 | if (!this->TryGetColumnNameOfMetadataTable(column_identifier, &column_name)) |
184 | { | ||
185 | ✗ | throw std::runtime_error("column-name not present"); | |
186 | } | ||
187 | |||
188 | 11560 | return column_name; | |
189 | ✗ | } | |
190 | |||
191 | 6286 | /*static*/void DatabaseConfigurationCommon::SetColumnName(std::map<int, std::string>& map, int columnIdentifier, const char* column_name) | |
192 | { | ||
193 |
1/2✓ Branch 0 taken 6286 times.
✗ Branch 1 not taken.
|
6286 | if (column_name != nullptr) |
194 | { | ||
195 | 6286 | map[columnIdentifier] = column_name; | |
196 | } | ||
197 | else | ||
198 | { | ||
199 | ✗ | map.erase(columnIdentifier); | |
200 | } | ||
201 | 6286 | } | |
202 | |||
203 | 769832 | /*static*/bool DatabaseConfigurationCommon::GetColumnName(const std::map<int, std::string>& map, int columnIdentifier, std::string* column_name) | |
204 | { | ||
205 |
1/2✓ Branch 1 taken 769832 times.
✗ Branch 2 not taken.
|
769832 | const auto iterator = map.find(columnIdentifier); |
206 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 769832 times.
|
769832 | if (iterator == map.cend()) |
207 | { | ||
208 | ✗ | return false; | |
209 | } | ||
210 | |||
211 |
1/2✓ Branch 0 taken 769832 times.
✗ Branch 1 not taken.
|
769832 | if (column_name != nullptr) |
212 | { | ||
213 |
1/2✓ Branch 2 taken 769832 times.
✗ Branch 3 not taken.
|
769832 | *column_name = iterator->second; |
214 | } | ||
215 | |||
216 | 769832 | return true; | |
217 | } | ||
218 | |||
219 | 258 | void DatabaseConfigurationCommon::SetDefaultColumnNamesForMetadataTable() | |
220 | { | ||
221 | 258 | this->SetColumnNameForMetadataTable(DatabaseConfigurationCommon::kMetadataTable_Column_Pk, DbConstants::kMetadataTable_Column_Pk_DefaultName); | |
222 | 258 | this->SetColumnNameForMetadataTable(DatabaseConfigurationCommon::kMetadataTable_Column_Name, DbConstants::kMetadataTable_Column_Name_DefaultName); | |
223 | 258 | this->SetColumnNameForMetadataTable(DatabaseConfigurationCommon::kMetadataTable_Column_AncestorId, DbConstants::kMetadataTable_Column_AncestorId_DefaultName); | |
224 | 258 | this->SetColumnNameForMetadataTable(DatabaseConfigurationCommon::kMetadataTable_Column_TypeDiscriminator, DbConstants::kMetadataTable_Column_TypeDiscriminator_DefaultName); | |
225 | 258 | this->SetColumnNameForMetadataTable(DatabaseConfigurationCommon::kMetadataTable_Column_ValueDouble, DbConstants::kMetadataTable_Column_ValueDouble_DefaultName); | |
226 | 258 | this->SetColumnNameForMetadataTable(DatabaseConfigurationCommon::kMetadataTable_Column_ValueInteger, DbConstants::kMetadataTable_Column_ValueInteger_DefaultName); | |
227 | 258 | this->SetColumnNameForMetadataTable(DatabaseConfigurationCommon::kMetadataTable_Column_ValueString, DbConstants::kMetadataTable_Column_ValueString_DefaultName); | |
228 | 258 | } | |
229 | |||
230 | // ---------------------------------------------------------------------------- | ||
231 | |||
232 | 184 | /*virtual*/ [[nodiscard]] imgdoc2::DocumentType DatabaseConfiguration2D::GetDocumentType() const | |
233 | { | ||
234 | 184 | return imgdoc2::DocumentType::kImage2d; | |
235 | } | ||
236 | |||
237 | 1344 | void DatabaseConfiguration2D::SetColumnNameForTilesInfoTable(int columnIdentifier, const char* column_name) | |
238 | { | ||
239 | 1344 | SetColumnName(this->map_tilesinfotable_columnids_to_columnname_, columnIdentifier, column_name); | |
240 | 1344 | } | |
241 | |||
242 | 21974 | bool DatabaseConfiguration2D::TryGetColumnNameOfTilesInfoTable(int columnIdentifier, std::string* column_name) const | |
243 | { | ||
244 | 21974 | return GetColumnName(this->map_tilesinfotable_columnids_to_columnname_, columnIdentifier, column_name); | |
245 | } | ||
246 | |||
247 | 1344 | void DatabaseConfiguration2D::SetColumnNameForTilesDataTable(int columnIdentifier, const char* column_name) | |
248 | { | ||
249 | 1344 | SetColumnName(this->map_tilesdatatable_columnids_to_columnname_, columnIdentifier, column_name); | |
250 | 1344 | } | |
251 | |||
252 | 20936 | bool DatabaseConfiguration2D::TryGetColumnNameOfTilesDataTable(int columnIdentifier, std::string* column_name) const | |
253 | { | ||
254 | 20936 | return GetColumnName(this->map_tilesdatatable_columnids_to_columnname_, columnIdentifier, column_name); | |
255 | } | ||
256 | |||
257 | 40 | void DatabaseConfiguration2D::SetColumnNameForTilesSpatialIndexTable(int columnIdentifier, const char* column_name) | |
258 | { | ||
259 | 40 | SetColumnName(this->map_tilespatialindextable_columnids_to_columnname_, columnIdentifier, column_name); | |
260 | 40 | } | |
261 | |||
262 | 3072 | bool DatabaseConfiguration2D::TryGetColumnNameOfTilesSpatialIndexTable(int columnIdentifier, std::string* column_name) const | |
263 | { | ||
264 | 3072 | return GetColumnName(this->map_tilespatialindextable_columnids_to_columnname_, columnIdentifier, column_name); | |
265 | } | ||
266 | |||
267 | |||
268 | 20936 | std::string DatabaseConfiguration2D::GetColumnNameOfTilesDataTableOrThrow(int column_identifier) const | |
269 | { | ||
270 | 20936 | std::string column_name; | |
271 |
2/4✓ Branch 1 taken 20936 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 20936 times.
|
20936 | if (!this->TryGetColumnNameOfTilesDataTable(column_identifier, &column_name)) |
272 | { | ||
273 | ✗ | throw std::runtime_error("column-name not present"); | |
274 | } | ||
275 | |||
276 | 20936 | return column_name; | |
277 | ✗ | } | |
278 | |||
279 | 21974 | std::string DatabaseConfiguration2D::GetColumnNameOfTilesInfoTableOrThrow(int columnIdentifier) const | |
280 | { | ||
281 | 21974 | std::string column_name; | |
282 |
2/4✓ Branch 1 taken 21974 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 21974 times.
|
21974 | if (!this->TryGetColumnNameOfTilesInfoTable(columnIdentifier, &column_name)) |
283 | { | ||
284 | ✗ | throw std::runtime_error("column-name not present"); | |
285 | } | ||
286 | |||
287 | 21974 | return column_name; | |
288 | ✗ | } | |
289 | |||
290 | 3072 | std::string DatabaseConfiguration2D::GetColumnNameOfTilesSpatialIndexTableOrThrow(int columnIdentifier) const | |
291 | { | ||
292 | 3072 | std::string column_name; | |
293 |
2/4✓ Branch 1 taken 3072 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3072 times.
|
3072 | if (!this->TryGetColumnNameOfTilesSpatialIndexTable(columnIdentifier, &column_name)) |
294 | { | ||
295 | ✗ | throw std::runtime_error("column-name not present"); | |
296 | } | ||
297 | |||
298 | 3072 | return column_name; | |
299 | ✗ | } | |
300 | |||
301 | 192 | void DatabaseConfiguration2D::SetDefaultColumnNamesForTilesInfoTable() | |
302 | { | ||
303 | 192 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration2D::kTilesInfoTable_Column_Pk, DbConstants::kTilesInfoTable_Column_Pk_DefaultName/*"Pk"*/); | |
304 | 192 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration2D::kTilesInfoTable_Column_TileX, DbConstants::kTilesInfoTable_Column_TileX_DefaultName/*"TileX"*/); | |
305 | 192 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration2D::kTilesInfoTable_Column_TileY, DbConstants::kTilesInfoTable_Column_TileY_DefaultName/*"TileY"*/); | |
306 | 192 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration2D::kTilesInfoTable_Column_TileW, DbConstants::kTilesInfoTable_Column_TileW_DefaultName /*"TileW"*/); | |
307 | 192 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration2D::kTilesInfoTable_Column_TileH, DbConstants::kTilesInfoTable_Column_TileH_DefaultName/*"TileH"*/); | |
308 | 192 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration2D::kTilesInfoTable_Column_PyramidLevel, DbConstants::kTilesInfoTable_Column_PyramidLevel_DefaultName/*"PyramidLevel"*/); | |
309 | 192 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration2D::kTilesInfoTable_Column_TileDataId, DbConstants::kTilesInfoTable_Column_TileDataId_DefaultName/*"TileDataId"*/); | |
310 | 192 | } | |
311 | |||
312 | 192 | void DatabaseConfiguration2D::SetDefaultColumnNamesForTilesDataTable() | |
313 | { | ||
314 | 192 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration2D::kTilesDataTable_Column_Pk, DbConstants::kTilesDataTable_Column_Pk_DefaultName/*"Pk"*/); | |
315 | 192 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration2D::kTilesDataTable_Column_PixelWidth, DbConstants::kTilesDataTable_Column_PixelWidth_DefaultName/*"PixelWidth"*/); | |
316 | 192 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration2D::kTilesDataTable_Column_PixelHeight, DbConstants::kTilesDataTable_Column_PixelHeight_DefaultName/*"PixelHeight"*/); | |
317 | 192 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration2D::kTilesDataTable_Column_PixelType, DbConstants::kTilesDataTable_Column_PixelType_DefaultName/*"PixelType"*/); | |
318 | 192 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration2D::kTilesDataTable_Column_TileDataType, DbConstants::kTilesDataTable_Column_TileDataType_DefaultName/*"TileDataType"*/); | |
319 | 192 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration2D::kTilesDataTable_Column_BinDataStorageType, DbConstants::kTilesDataTable_Column_BinDataStorageType_DefaultName/*"BinDataStorageType"*/); | |
320 | 192 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration2D::kTilesDataTable_Column_BinDataId, DbConstants::kTilesDataTable_Column_BinDataId_DefaultName/*"BinDataId"*/); | |
321 | 192 | } | |
322 | |||
323 | // ---------------------------------------------------------------------------- | ||
324 | |||
325 | 74 | /*virtual*/imgdoc2::DocumentType DatabaseConfiguration3D::GetDocumentType() const | |
326 | { | ||
327 | 74 | return imgdoc2::DocumentType::kImage3d; | |
328 | } | ||
329 | |||
330 | 720 | void DatabaseConfiguration3D::SetColumnNameForTilesInfoTable(int columnIdentifier, const char* column_name) | |
331 | { | ||
332 | 720 | SetColumnName(this->map_tilesinfotable_columnids_to_columnname_, columnIdentifier, column_name); | |
333 | 720 | } | |
334 | |||
335 | 314722 | bool DatabaseConfiguration3D::TryGetColumnNameOfTilesInfoTable(int columnIdentifier, std::string* column_name) const | |
336 | { | ||
337 | 314722 | return GetColumnName(this->map_tilesinfotable_columnids_to_columnname_, columnIdentifier, column_name); | |
338 | } | ||
339 | |||
340 | 720 | void DatabaseConfiguration3D::SetColumnNameForTilesDataTable(int columnIdentifier, const char* column_name) | |
341 | { | ||
342 | 720 | SetColumnName(this->map_tilesdatatable_columnids_to_columnname_, columnIdentifier, column_name); | |
343 | 720 | } | |
344 | |||
345 | 271160 | bool DatabaseConfiguration3D::TryGetColumnNameOfTilesDataTable(int columnIdentifier, std::string* column_name) const | |
346 | { | ||
347 | 271160 | return GetColumnName(this->map_tilesdatatable_columnids_to_columnname_, columnIdentifier, column_name); | |
348 | } | ||
349 | |||
350 | 140 | void DatabaseConfiguration3D::SetColumnNameForTilesSpatialIndexTable(int columnIdentifier, const char* column_name) | |
351 | { | ||
352 | 140 | SetColumnName(this->map_tilespatialindextable_columnids_to_columnname_, columnIdentifier, column_name); | |
353 | 140 | } | |
354 | |||
355 | 126212 | bool DatabaseConfiguration3D::TryGetColumnNameOfTilesSpatialIndexTable(int columnIdentifier, std::string* column_name) const | |
356 | { | ||
357 | 126212 | return GetColumnName(this->map_tilespatialindextable_columnids_to_columnname_, columnIdentifier, column_name); | |
358 | } | ||
359 | |||
360 | |||
361 | 271160 | std::string DatabaseConfiguration3D::GetColumnNameOfTilesDataTableOrThrow(int column_identifier) const | |
362 | { | ||
363 | 271160 | std::string column_name; | |
364 |
2/4✓ Branch 1 taken 271160 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 271160 times.
|
271160 | if (!this->TryGetColumnNameOfTilesDataTable(column_identifier, &column_name)) |
365 | { | ||
366 | ✗ | throw std::runtime_error("column-name not present"); | |
367 | } | ||
368 | |||
369 | 271160 | return column_name; | |
370 | ✗ | } | |
371 | |||
372 | 314722 | std::string DatabaseConfiguration3D::GetColumnNameOfTilesInfoTableOrThrow(int columnIdentifier) const | |
373 | { | ||
374 | 314722 | std::string column_name; | |
375 |
2/4✓ Branch 1 taken 314722 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 314722 times.
|
314722 | if (!this->TryGetColumnNameOfTilesInfoTable(columnIdentifier, &column_name)) |
376 | { | ||
377 | ✗ | throw std::runtime_error("column-name not present"); | |
378 | } | ||
379 | |||
380 | 314722 | return column_name; | |
381 | ✗ | } | |
382 | |||
383 | 126212 | std::string DatabaseConfiguration3D::GetColumnNameOfTilesSpatialIndexTableOrThrow(int columnIdentifier) const | |
384 | { | ||
385 | 126212 | std::string column_name; | |
386 |
2/4✓ Branch 1 taken 126212 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 126212 times.
|
126212 | if (!this->TryGetColumnNameOfTilesSpatialIndexTable(columnIdentifier, &column_name)) |
387 | { | ||
388 | ✗ | throw std::runtime_error("column-name not present"); | |
389 | } | ||
390 | |||
391 | 126212 | return column_name; | |
392 | ✗ | } | |
393 | |||
394 | 80 | void DatabaseConfiguration3D::SetDefaultColumnNamesForTilesInfoTable() | |
395 | { | ||
396 | 80 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration3D::kTilesInfoTable_Column_Pk, DbConstants::kTilesInfoTable_Column_Pk_DefaultName/*"Pk"*/); | |
397 | 80 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration3D::kTilesInfoTable_Column_TileX, DbConstants::kTilesInfoTable_Column_TileX_DefaultName/*"TileX"*/); | |
398 | 80 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration3D::kTilesInfoTable_Column_TileY, DbConstants::kTilesInfoTable_Column_TileY_DefaultName/*"TileY"*/); | |
399 | 80 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration3D::kTilesInfoTable_Column_TileZ, DbConstants::kTilesInfoTable_Column_TileZ_DefaultName/*"TileZ"*/); | |
400 | 80 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration3D::kTilesInfoTable_Column_TileW, DbConstants::kTilesInfoTable_Column_TileW_DefaultName/*"TileW"*/); | |
401 | 80 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration3D::kTilesInfoTable_Column_TileH, DbConstants::kTilesInfoTable_Column_TileH_DefaultName/*"TileH"*/); | |
402 | 80 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration3D::kTilesInfoTable_Column_TileD, DbConstants::kTilesInfoTable_Column_TileD_DefaultName/*"TileD"*/); | |
403 | 80 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration3D::kTilesInfoTable_Column_PyramidLevel, DbConstants::kTilesInfoTable_Column_PyramidLevel_DefaultName/*"PyramidLevel"*/); | |
404 | 80 | this->SetColumnNameForTilesInfoTable(DatabaseConfiguration3D::kTilesInfoTable_Column_TileDataId, DbConstants::kTilesInfoTable_Column_TileDataId_DefaultName/*"TileDataId"*/); | |
405 | 80 | } | |
406 | |||
407 | 80 | void DatabaseConfiguration3D::SetDefaultColumnNamesForTilesDataTable() | |
408 | { | ||
409 | 80 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration3D::kTilesDataTable_Column_Pk, DbConstants::kTilesDataTable_Column_Pk_DefaultName/*"Pk"*/); | |
410 | 80 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration3D::kTilesDataTable_Column_PixelWidth, DbConstants::kTilesDataTable_Column_PixelWidth_DefaultName/*"PixelWidth"*/); | |
411 | 80 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration3D::kTilesDataTable_Column_PixelHeight, DbConstants::kTilesDataTable_Column_PixelHeight_DefaultName/*"PixelHeight"*/); | |
412 | 80 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration3D::kTilesDataTable_Column_PixelDepth, DbConstants::kTilesDataTable_Column_PixelDepth_DefaultName/*"PixelDepth"*/); | |
413 | 80 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration3D::kTilesDataTable_Column_PixelDepth, DbConstants::kTilesDataTable_Column_PixelDepth_DefaultName/*"PixelDepth"*/); | |
414 | 80 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration3D::kTilesDataTable_Column_PixelType, DbConstants::kTilesDataTable_Column_PixelType_DefaultName/*"PixelType"*/); | |
415 | 80 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration3D::kTilesDataTable_Column_TileDataType, DbConstants::kTilesDataTable_Column_TileDataType_DefaultName/*"TileDataType"*/); | |
416 | 80 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration3D::kTilesDataTable_Column_BinDataStorageType, DbConstants::kTilesDataTable_Column_BinDataStorageType_DefaultName/*"BinDataStorageType"*/); | |
417 | 80 | this->SetColumnNameForTilesDataTable(DatabaseConfiguration3D::kTilesDataTable_Column_BinDataId, DbConstants::kTilesDataTable_Column_BinDataId_DefaultName/*"BinDataId"*/); | |
418 | 80 | } | |
419 |