Skip to content

Commit a95da6a

Browse files
Use built-in config equality operator. (#377)
1 parent df752f8 commit a95da6a

File tree

3 files changed

+4
-33
lines changed

3 files changed

+4
-33
lines changed

mytile/ha_mytile.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ int tile::mytile::create(const char *name, TABLE *table_arg,
794794
cfg["sm.encryption_key"] = encryption_key.c_str();
795795
}
796796

797-
if (!compare_configs(cfg, this->config)) {
797+
if (cfg != this->config) {
798798
this->config = cfg;
799799
this->ctx = build_context(this->config);
800800
}
@@ -819,7 +819,7 @@ int tile::mytile::open(const char *name, int mode, uint test_if_locked) {
819819
cfg["sm.encryption_key"] = encryption_key.c_str();
820820
}
821821

822-
if (!compare_configs(cfg, this->config)) {
822+
if (cfg != this->config) {
823823
this->config = cfg;
824824
this->ctx = build_context(this->config);
825825
}
@@ -3433,7 +3433,7 @@ void tile::mytile::open_array_for_reads(THD *thd) {
34333433
// First rebuild context with new config if needed
34343434
tiledb::Config cfg = build_config(ha_thd());
34353435

3436-
if (!compare_configs(cfg, this->config)) {
3436+
if (cfg != this->config) {
34373437
this->config = cfg;
34383438
this->ctx = build_context(this->config);
34393439
}
@@ -3532,7 +3532,7 @@ void tile::mytile::open_array_for_writes(THD *thd) {
35323532
// First rebuild context with new config if needed
35333533
tiledb::Config cfg = build_config(ha_thd());
35343534

3535-
if (!compare_configs(cfg, this->config)) {
3535+
if (cfg != this->config) {
35363536
this->config = cfg;
35373537
this->ctx = build_context(this->config);
35383538
}

mytile/utils.cc

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,6 @@ std::vector<std::string> tile::split(const std::string &str, char delim) {
5555
return res;
5656
}
5757

58-
/**
59-
* compares two config
60-
* @param rhs
61-
* @param lhs
62-
* @return true is identical, false otherwise
63-
*/
64-
bool tile::compare_configs(tiledb::Config &rhs, tiledb::Config &lhs) {
65-
// Check every parameter to see if they are the same or different
66-
for (auto &it : rhs) {
67-
try {
68-
if (lhs.get(it.first) != it.second) {
69-
return false;
70-
}
71-
} catch (tiledb::TileDBError &e) {
72-
return false;
73-
}
74-
}
75-
76-
return true;
77-
}
78-
7958
bool tile::is_numeric_type(const tiledb_datatype_t &datatype) {
8059
switch (datatype) {
8160
case TILEDB_INT8:

mytile/utils.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,6 @@ tiledb::Config build_config(THD *thd);
121121
*/
122122
tiledb::Context build_context(tiledb::Config &cfg);
123123

124-
/**
125-
* compares two config
126-
* @param rhs
127-
* @param lhs
128-
* @return true is identical, false otherwise
129-
*/
130-
bool compare_configs(tiledb::Config &rhs, tiledb::Config &lhs);
131-
132124
/**
133125
* Log errors only if log level is set to error or higher
134126
* @param thd thd to get log level from

0 commit comments

Comments
 (0)