| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-FileCopyrightText: 2023 Carl Zeiss Microscopy GmbH | ||
| 2 | // | ||
| 3 | // SPDX-License-Identifier: MIT | ||
| 4 | |||
| 5 | #include <sstream> | ||
| 6 | #include <vector> | ||
| 7 | #include <gsl/gsl> | ||
| 8 | #include "documentWrite3d.h" | ||
| 9 | #include "transactionHelper.h" | ||
| 10 | |||
| 11 | using namespace std; | ||
| 12 | using namespace imgdoc2; | ||
| 13 | |||
| 14 | 38648 | /*virtual*/imgdoc2::dbIndex DocumentWrite3d::AddBrick( | |
| 15 | const imgdoc2::ITileCoordinate* coordinate, | ||
| 16 | const imgdoc2::LogicalPositionInfo3D* logical_position_3d_info, | ||
| 17 | const imgdoc2::BrickBaseInfo* brickInfo, | ||
| 18 | imgdoc2::DataTypes data_type, | ||
| 19 | imgdoc2::TileDataStorageType storage_type, | ||
| 20 | const imgdoc2::IDataObjBase* data) | ||
| 21 | { | ||
| 22 | TransactionHelper<dbIndex> transaction{ | ||
| 23 | 38648 | this->document_->GetDatabase_connection(), | |
| 24 | ✗ | [&]()->dbIndex | |
| 25 | { | ||
| 26 | 38648 | return this->AddBrickInternal(coordinate, logical_position_3d_info, brickInfo, data_type, storage_type, data); | |
| 27 | } | ||
| 28 |
1/2✓ Branch 4 taken 38648 times.
✗ Branch 5 not taken.
|
38648 | }; |
| 29 | |||
| 30 |
1/2✓ Branch 1 taken 38648 times.
✗ Branch 2 not taken.
|
77296 | return transaction.Execute(); |
| 31 | 38648 | } | |
| 32 | |||
| 33 | 4 | /*virtual*/void DocumentWrite3d::BeginTransaction() | |
| 34 | { | ||
| 35 | 4 | this->document_->GetDatabase_connection()->BeginTransaction(); | |
| 36 | 2 | } | |
| 37 | |||
| 38 | 8 | /*virtual*/void DocumentWrite3d::CommitTransaction() | |
| 39 | { | ||
| 40 | 8 | this->document_->GetDatabase_connection()->EndTransaction(true); | |
| 41 | 2 | } | |
| 42 | |||
| 43 | 2 | /*virtual*/void DocumentWrite3d::RollbackTransaction() | |
| 44 | { | ||
| 45 | 2 | this->document_->GetDatabase_connection()->EndTransaction(false); | |
| 46 | ✗ | } | |
| 47 | |||
| 48 | 38648 | imgdoc2::dbIndex DocumentWrite3d::AddBrickInternal( | |
| 49 | const imgdoc2::ITileCoordinate* coordinate, | ||
| 50 | const imgdoc2::LogicalPositionInfo3D* logical_position_info_3d, | ||
| 51 | const imgdoc2::BrickBaseInfo* brick_base_info, | ||
| 52 | imgdoc2::DataTypes data_type, | ||
| 53 | imgdoc2::TileDataStorageType storage_type, | ||
| 54 | const imgdoc2::IDataObjBase* data) | ||
| 55 | { | ||
| 56 |
1/2✓ Branch 1 taken 38648 times.
✗ Branch 2 not taken.
|
38648 | const auto tiles_data_id = this->AddBrickData(brick_base_info, data_type, storage_type, data); |
| 57 | |||
| 58 |
1/2✓ Branch 1 taken 38648 times.
✗ Branch 2 not taken.
|
38648 | ostringstream string_stream; |
| 59 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
38648 | string_stream << "INSERT INTO [" << this->document_->GetDataBaseConfiguration3d()->GetTableNameForTilesInfoOrThrow() << "] (" |
| 60 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileX) << "]," |
| 61 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileY) << "]," |
| 62 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileZ) << "]," |
| 63 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileW) << "]," |
| 64 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileH) << "]," |
| 65 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileD) << "]," |
| 66 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_PyramidLevel) << "]," |
| 67 |
28/56✓ Branch 1 taken 38648 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 38648 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 38648 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 38648 times.
✗ Branch 12 not taken.
✓ Branch 15 taken 38648 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 38648 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 38648 times.
✗ Branch 22 not taken.
✓ Branch 25 taken 38648 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 38648 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 38648 times.
✗ Branch 32 not taken.
✓ Branch 35 taken 38648 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 38648 times.
✗ Branch 39 not taken.
✓ Branch 41 taken 38648 times.
✗ Branch 42 not taken.
✓ Branch 45 taken 38648 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 38648 times.
✗ Branch 49 not taken.
✓ Branch 51 taken 38648 times.
✗ Branch 52 not taken.
✓ Branch 55 taken 38648 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 38648 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 38648 times.
✗ Branch 62 not taken.
✓ Branch 65 taken 38648 times.
✗ Branch 66 not taken.
✓ Branch 68 taken 38648 times.
✗ Branch 69 not taken.
✓ Branch 71 taken 38648 times.
✗ Branch 72 not taken.
✓ Branch 75 taken 38648 times.
✗ Branch 76 not taken.
✓ Branch 78 taken 38648 times.
✗ Branch 79 not taken.
✓ Branch 81 taken 38648 times.
✗ Branch 82 not taken.
✓ Branch 87 taken 38648 times.
✗ Branch 88 not taken.
✓ Branch 90 taken 38648 times.
✗ Branch 91 not taken.
✓ Branch 93 taken 38648 times.
✗ Branch 94 not taken.
|
347832 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesInfoTableOrThrow(DatabaseConfiguration3D::kTilesInfoTable_Column_TileDataId) << "]"; |
| 68 | |||
| 69 | 38648 | vector<int> coordinate_values; | |
| 70 |
1/2✓ Branch 1 taken 38648 times.
✗ Branch 2 not taken.
|
38648 | coordinate->EnumCoordinates( |
| 71 |
1/2✓ Branch 1 taken 38648 times.
✗ Branch 2 not taken.
|
38648 | [&](Dimension dimension, int value)->bool |
| 72 | { | ||
| 73 | 38848 | string_stream << ", [" << this->document_->GetDataBaseConfiguration3d()->GetDimensionsColumnPrefix() << dimension << ']'; | |
| 74 | 38848 | coordinate_values.push_back(value); | |
| 75 | 38848 | return true; | |
| 76 | }); | ||
| 77 | |||
| 78 |
1/2✓ Branch 1 taken 38648 times.
✗ Branch 2 not taken.
|
38648 | string_stream << ") VALUES( ?, ?, ?, ?, ?, ?, ?, ?"; |
| 79 |
2/2✓ Branch 1 taken 38848 times.
✓ Branch 2 taken 38648 times.
|
77496 | for (size_t i = 0; i < coordinate_values.size(); ++i) |
| 80 | { | ||
| 81 |
1/2✓ Branch 1 taken 38848 times.
✗ Branch 2 not taken.
|
38848 | string_stream << ", ?"; |
| 82 | } | ||
| 83 | |||
| 84 |
1/2✓ Branch 1 taken 38648 times.
✗ Branch 2 not taken.
|
38648 | string_stream << ");"; |
| 85 | |||
| 86 |
2/4✓ Branch 4 taken 38648 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 38648 times.
✗ Branch 8 not taken.
|
38648 | const auto statement = this->document_->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
| 87 | 38648 | int binding_index = 1; | |
| 88 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindDouble(binding_index++, logical_position_info_3d->posX); |
| 89 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindDouble(binding_index++, logical_position_info_3d->posY); |
| 90 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindDouble(binding_index++, logical_position_info_3d->posZ); |
| 91 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindDouble(binding_index++, logical_position_info_3d->width); |
| 92 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindDouble(binding_index++, logical_position_info_3d->height); |
| 93 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindDouble(binding_index++, logical_position_info_3d->depth); |
| 94 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindInt32(binding_index++, logical_position_info_3d->pyrLvl); |
| 95 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindInt64(binding_index++, tiles_data_id); |
| 96 | |||
| 97 |
2/2✓ Branch 5 taken 38848 times.
✓ Branch 6 taken 38648 times.
|
77496 | for (const int coordinate_value : coordinate_values) |
| 98 | { | ||
| 99 |
1/2✓ Branch 2 taken 38848 times.
✗ Branch 3 not taken.
|
38848 | statement->BindInt32(binding_index++, coordinate_value); |
| 100 | } | ||
| 101 | |||
| 102 |
1/2✓ Branch 5 taken 38648 times.
✗ Branch 6 not taken.
|
38648 | const auto row_id = this->document_->GetDatabase_connection()->ExecuteAndGetLastRowId(statement.get()); |
| 103 | |||
| 104 |
3/4✓ Branch 4 taken 38648 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 18000 times.
✓ Branch 7 taken 20648 times.
|
38648 | if (this->document_->GetDataBaseConfiguration3d()->GetIsUsingSpatialIndex()) |
| 105 | { | ||
| 106 |
1/2✓ Branch 1 taken 18000 times.
✗ Branch 2 not taken.
|
18000 | this->AddToSpatialIndex(row_id, *logical_position_info_3d); |
| 107 | } | ||
| 108 | |||
| 109 | 38648 | return row_id; | |
| 110 | 38648 | } | |
| 111 | |||
| 112 | 38648 | imgdoc2::dbIndex DocumentWrite3d::AddBrickData(const imgdoc2::BrickBaseInfo* brick_base_info, imgdoc2::DataTypes data_type, imgdoc2::TileDataStorageType storage_type, const imgdoc2::IDataObjBase* data) | |
| 113 | { | ||
| 114 | // first, add the blob data | ||
| 115 | 38648 | dbIndex blob_db_index = 0; | |
| 116 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 38644 times.
|
38648 | if (data != nullptr) |
| 117 | { | ||
| 118 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | blob_db_index = this->AddBlobData(storage_type, data); |
| 119 | } | ||
| 120 | |||
| 121 |
1/2✓ Branch 1 taken 38648 times.
✗ Branch 2 not taken.
|
38648 | ostringstream string_stream; |
| 122 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
38648 | string_stream << "INSERT INTO " << this->document_->GetDataBaseConfiguration3d()->GetTableNameForTilesDataOrThrow() << " (" |
| 123 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_PixelWidth) << "]," |
| 124 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_PixelHeight) << "]," |
| 125 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_PixelDepth) << "]," |
| 126 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_PixelType) << "]," |
| 127 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_TileDataType) << "]," |
| 128 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_BinDataStorageType) << "]," |
| 129 |
1/2✓ Branch 3 taken 38648 times.
✗ Branch 4 not taken.
|
77296 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesDataTableOrThrow(DatabaseConfiguration3D::kTilesDataTable_Column_BinDataId) << "]" |
| 130 |
24/48✓ Branch 1 taken 38648 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 38648 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 38648 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 38648 times.
✗ Branch 12 not taken.
✓ Branch 15 taken 38648 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 38648 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 38648 times.
✗ Branch 22 not taken.
✓ Branch 25 taken 38648 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 38648 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 38648 times.
✗ Branch 32 not taken.
✓ Branch 35 taken 38648 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 38648 times.
✗ Branch 39 not taken.
✓ Branch 41 taken 38648 times.
✗ Branch 42 not taken.
✓ Branch 45 taken 38648 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 38648 times.
✗ Branch 49 not taken.
✓ Branch 51 taken 38648 times.
✗ Branch 52 not taken.
✓ Branch 55 taken 38648 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 38648 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 38648 times.
✗ Branch 62 not taken.
✓ Branch 65 taken 38648 times.
✗ Branch 66 not taken.
✓ Branch 68 taken 38648 times.
✗ Branch 69 not taken.
✓ Branch 71 taken 38648 times.
✗ Branch 72 not taken.
✓ Branch 75 taken 38648 times.
✗ Branch 76 not taken.
✓ Branch 78 taken 38648 times.
✗ Branch 79 not taken.
|
347832 | ") VALUES( ?1, ?2, ?3, ?4, ?5, ?6, ?7);"; |
| 131 | |||
| 132 |
2/4✓ Branch 4 taken 38648 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 38648 times.
✗ Branch 8 not taken.
|
38648 | const auto statement = this->document_->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
| 133 | |||
| 134 | 38648 | int binding_index = 1; | |
| 135 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindInt32(binding_index++, brick_base_info->pixelWidth); |
| 136 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindInt32(binding_index++, brick_base_info->pixelHeight); |
| 137 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindInt32(binding_index++, brick_base_info->pixelDepth); |
| 138 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindInt32(binding_index++, brick_base_info->pixelType); |
| 139 |
1/2✓ Branch 2 taken 38648 times.
✗ Branch 3 not taken.
|
38648 | statement->BindInt32(binding_index++, static_cast<underlying_type_t<decltype(data_type)>>(data_type)); |
| 140 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 38644 times.
|
38648 | if (data != nullptr) |
| 141 | { | ||
| 142 | // for data-type "zero" | ||
| 143 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | statement->BindInt32(binding_index++, static_cast<underlying_type_t<decltype(storage_type)>>(storage_type)); |
| 144 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | statement->BindInt64(binding_index++, blob_db_index); |
| 145 | } | ||
| 146 | |||
| 147 |
1/2✓ Branch 5 taken 38648 times.
✗ Branch 6 not taken.
|
38648 | const auto row_id = this->document_->GetDatabase_connection()->ExecuteAndGetLastRowId(statement.get()); |
| 148 | 38648 | return row_id; | |
| 149 | 38648 | } | |
| 150 | |||
| 151 | 4 | imgdoc2::dbIndex DocumentWrite3d::AddBlobData(imgdoc2::TileDataStorageType storage_type, const imgdoc2::IDataObjBase* data) | |
| 152 | { | ||
| 153 | // TODO(JBL) - combine with 2d version | ||
| 154 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | Expects(data != nullptr); |
| 155 | |||
| 156 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if (storage_type != TileDataStorageType::BlobInDatabase) |
| 157 | { | ||
| 158 | ✗ | throw invalid_operation_exception("Storage-types other than 'blob-in-database' are not implemented."); | |
| 159 | } | ||
| 160 | |||
| 161 |
2/4✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
|
4 | if (!this->document_->GetDataBaseConfiguration3d()->GetHasBlobsTable()) |
| 162 | { | ||
| 163 | ✗ | throw invalid_operation_exception("The database does not have a blob-table."); | |
| 164 | } | ||
| 165 | |||
| 166 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | const auto insert_data_statement = this->CreateInsertDataStatement(data); |
| 167 | |||
| 168 |
1/2✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
|
4 | const auto row_id = this->document_->GetDatabase_connection()->ExecuteAndGetLastRowId(insert_data_statement.get()); |
| 169 | 4 | return row_id; | |
| 170 | 4 | } | |
| 171 | |||
| 172 | 4 | std::shared_ptr<IDbStatement> DocumentWrite3d::CreateInsertDataStatement(const imgdoc2::IDataObjBase* data) | |
| 173 | { | ||
| 174 | // TODO(JBL) - combine with 2d version | ||
| 175 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | ostringstream string_stream; |
| 176 |
1/2✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
4 | string_stream << "INSERT INTO [" << this->document_->GetDataBaseConfiguration3d()->GetTableNameForBlobTableOrThrow() << "] (" |
| 177 |
1/2✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfBlobTableOrThrow(DatabaseConfigurationCommon::kBlobTable_Column_Data) << "]" |
| 178 |
7/14✓ 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.
|
12 | << ") VALUES( ?1 );"; |
| 179 | |||
| 180 |
2/4✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
|
4 | auto statement = this->document_->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
| 181 | 4 | const void* ptr_data = nullptr; | |
| 182 | 4 | size_t size_data = 0; | |
| 183 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | data->GetData(&ptr_data, &size_data); |
| 184 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | statement->BindBlob_Static(1, ptr_data, size_data); |
| 185 | 8 | return statement; | |
| 186 | 4 | } | |
| 187 | |||
| 188 | 18000 | void DocumentWrite3d::AddToSpatialIndex(imgdoc2::dbIndex index, const imgdoc2::LogicalPositionInfo3D& logical_position_info) | |
| 189 | { | ||
| 190 |
1/2✓ Branch 1 taken 18000 times.
✗ Branch 2 not taken.
|
18000 | ostringstream string_stream; |
| 191 |
1/2✓ Branch 3 taken 18000 times.
✗ Branch 4 not taken.
|
18000 | string_stream << "INSERT INTO " << this->document_->GetDataBaseConfiguration3d()->GetTableNameForTilesSpatialIndexTableOrThrow() << " (" |
| 192 |
1/2✓ Branch 3 taken 18000 times.
✗ Branch 4 not taken.
|
36000 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_Pk) << "]," |
| 193 |
1/2✓ Branch 3 taken 18000 times.
✗ Branch 4 not taken.
|
36000 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MinX) << "]," |
| 194 |
1/2✓ Branch 3 taken 18000 times.
✗ Branch 4 not taken.
|
36000 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MaxX) << "]," |
| 195 |
1/2✓ Branch 3 taken 18000 times.
✗ Branch 4 not taken.
|
36000 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MinY) << "]," |
| 196 |
1/2✓ Branch 3 taken 18000 times.
✗ Branch 4 not taken.
|
36000 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MaxY) << "]," |
| 197 |
1/2✓ Branch 3 taken 18000 times.
✗ Branch 4 not taken.
|
36000 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MinZ) << "]," |
| 198 |
1/2✓ Branch 3 taken 18000 times.
✗ Branch 4 not taken.
|
36000 | << "[" << this->document_->GetDataBaseConfiguration3d()->GetColumnNameOfTilesSpatialIndexTableOrThrow(DatabaseConfiguration3D::kTilesSpatialIndexTable_Column_MaxZ) << "]" |
| 199 |
24/48✓ Branch 1 taken 18000 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 18000 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 18000 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 18000 times.
✗ Branch 12 not taken.
✓ Branch 15 taken 18000 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 18000 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 18000 times.
✗ Branch 22 not taken.
✓ Branch 25 taken 18000 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 18000 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 18000 times.
✗ Branch 32 not taken.
✓ Branch 35 taken 18000 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 18000 times.
✗ Branch 39 not taken.
✓ Branch 41 taken 18000 times.
✗ Branch 42 not taken.
✓ Branch 45 taken 18000 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 18000 times.
✗ Branch 49 not taken.
✓ Branch 51 taken 18000 times.
✗ Branch 52 not taken.
✓ Branch 55 taken 18000 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 18000 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 18000 times.
✗ Branch 62 not taken.
✓ Branch 65 taken 18000 times.
✗ Branch 66 not taken.
✓ Branch 68 taken 18000 times.
✗ Branch 69 not taken.
✓ Branch 71 taken 18000 times.
✗ Branch 72 not taken.
✓ Branch 75 taken 18000 times.
✗ Branch 76 not taken.
✓ Branch 78 taken 18000 times.
✗ Branch 79 not taken.
|
162000 | ") VALUES(?1,?2,?3,?4,?5,?6,?7);"; |
| 200 | |||
| 201 |
2/4✓ Branch 4 taken 18000 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 18000 times.
✗ Branch 8 not taken.
|
18000 | const auto statement = this->document_->GetDatabase_connection()->PrepareStatement(string_stream.str()); |
| 202 | |||
| 203 | 18000 | int binding_index = 1; | |
| 204 |
1/2✓ Branch 2 taken 18000 times.
✗ Branch 3 not taken.
|
18000 | statement->BindInt64(binding_index++, index); |
| 205 |
1/2✓ Branch 2 taken 18000 times.
✗ Branch 3 not taken.
|
18000 | statement->BindDouble(binding_index++, logical_position_info.posX); |
| 206 |
1/2✓ Branch 2 taken 18000 times.
✗ Branch 3 not taken.
|
18000 | statement->BindDouble(binding_index++, logical_position_info.posX + logical_position_info.width); |
| 207 |
1/2✓ Branch 2 taken 18000 times.
✗ Branch 3 not taken.
|
18000 | statement->BindDouble(binding_index++, logical_position_info.posY); |
| 208 |
1/2✓ Branch 2 taken 18000 times.
✗ Branch 3 not taken.
|
18000 | statement->BindDouble(binding_index++, logical_position_info.posY + logical_position_info.height); |
| 209 |
1/2✓ Branch 2 taken 18000 times.
✗ Branch 3 not taken.
|
18000 | statement->BindDouble(binding_index++, logical_position_info.posZ); |
| 210 |
1/2✓ Branch 2 taken 18000 times.
✗ Branch 3 not taken.
|
18000 | statement->BindDouble(binding_index++, logical_position_info.posZ + logical_position_info.depth); |
| 211 | |||
| 212 |
1/2✓ Branch 5 taken 18000 times.
✗ Branch 6 not taken.
|
18000 | this->document_->GetDatabase_connection()->ExecuteAndGetLastRowId(statement.get()); |
| 213 | 18000 | } | |
| 214 |