Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(r/adbcdrivermanager): Use std::vector<uint8_t> instead of std::basic_string<uint8_t> #1453

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions r/adbcdrivermanager/src/driver_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class Option {

Option() : type_(TYPE_MISSING) {}
explicit Option(const std::string& value) : type_(TYPE_STRING), value_string_(value) {}
explicit Option(const std::basic_string<uint8_t>& value)
explicit Option(const std::vector<uint8_t>& value)
: type_(TYPE_BYTES), value_bytes_(value) {}
explicit Option(double value) : type_(TYPE_DOUBLE), value_double_(value) {}
explicit Option(int64_t value) : type_(TYPE_INT), value_int_(value) {}
Expand All @@ -128,7 +128,7 @@ class Option {

const std::string& GetStringUnsafe() const { return value_string_; }

const std::basic_string<uint8_t>& GetBytesUnsafe() const { return value_bytes_; }
const std::vector<uint8_t>& GetBytesUnsafe() const { return value_bytes_; }

int64_t GetIntUnsafe() const { return value_int_; }

Expand All @@ -137,7 +137,7 @@ class Option {
private:
Type type_;
std::string value_string_;
std::basic_string<uint8_t> value_bytes_;
std::vector<uint8_t> value_bytes_;
double value_double_;
int64_t value_int_;

Expand Down Expand Up @@ -165,7 +165,7 @@ class Option {
AdbcStatusCode CGet(uint8_t* out, size_t* length) const {
switch (type_) {
case TYPE_BYTES: {
const std::basic_string<uint8_t>& value = GetBytesUnsafe();
const std::vector<uint8_t>& value = GetBytesUnsafe();
if (*length < value.size()) {
*length = value.size();
} else {
Expand Down Expand Up @@ -266,7 +266,7 @@ class ObjectBase {

AdbcStatusCode CSetOptionBytes(const char* key, const uint8_t* value, size_t length,
AdbcError* error) {
std::basic_string<uint8_t> cppvalue(value, length);
std::vector<uint8_t> cppvalue(value, value + length);
Option option(cppvalue);
return SetOption(key, option);
}
Expand Down
Loading