Skip to content

Commit

Permalink
Merge branch 'main' into dev/birschick-bq/client-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
birschick-bq committed Oct 23, 2024
2 parents 6a0a647 + 4639ca8 commit 18a7c8a
Show file tree
Hide file tree
Showing 20 changed files with 528 additions and 565 deletions.
11 changes: 11 additions & 0 deletions c/driver/framework/base_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,22 @@ class Driver {
}

auto error_obj = reinterpret_cast<Status*>(error->private_data);
if (!error_obj) {
return 0;
}
return error_obj->CDetailCount();
}

static AdbcErrorDetail CErrorGetDetail(const AdbcError* error, int index) {
if (error->vendor_code != ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA) {
return {nullptr, nullptr, 0};
}

auto error_obj = reinterpret_cast<Status*>(error->private_data);
if (!error_obj) {
return {nullptr, nullptr, 0};
}

return error_obj->CDetail(index);
}

Expand Down
8 changes: 4 additions & 4 deletions c/driver/framework/objects.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ struct GetObjectsBuilder {
}

Status AppendCatalogs() {
UNWRAP_STATUS(helper->LoadCatalogs());
UNWRAP_STATUS(helper->LoadCatalogs(catalog_filter));
while (true) {
UNWRAP_RESULT(auto maybe_catalog, helper->NextCatalog());
if (!maybe_catalog.has_value()) break;
Expand All @@ -302,7 +302,7 @@ struct GetObjectsBuilder {
}

Status AppendSchemas(std::string_view catalog) {
UNWRAP_STATUS(helper->LoadSchemas(catalog));
UNWRAP_STATUS(helper->LoadSchemas(catalog, schema_filter));
while (true) {
UNWRAP_RESULT(auto maybe_schema, helper->NextSchema());
if (!maybe_schema.has_value()) break;
Expand All @@ -323,7 +323,7 @@ struct GetObjectsBuilder {
}

Status AppendTables(std::string_view catalog, std::string_view schema) {
UNWRAP_STATUS(helper->LoadTables(catalog, schema));
UNWRAP_STATUS(helper->LoadTables(catalog, schema, table_filter, table_types));
while (true) {
UNWRAP_RESULT(auto maybe_table, helper->NextTable());
if (!maybe_table.has_value()) break;
Expand All @@ -348,7 +348,7 @@ struct GetObjectsBuilder {

Status AppendColumns(std::string_view catalog, std::string_view schema,
std::string_view table) {
UNWRAP_STATUS(helper->LoadColumns(catalog, schema, table));
UNWRAP_STATUS(helper->LoadColumns(catalog, schema, table, column_filter));
while (true) {
UNWRAP_RESULT(auto maybe_column, helper->NextColumn());
if (!maybe_column.has_value()) break;
Expand Down
12 changes: 8 additions & 4 deletions c/driver/framework/objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,26 +108,30 @@ struct GetObjectsHelper {
return status::NotImplemented("GetObjects");
}

virtual Status LoadCatalogs() {
virtual Status LoadCatalogs(std::optional<std::string_view> catalog_filter) {
return status::NotImplemented("GetObjects at depth = catalog");
};

virtual Result<std::optional<std::string_view>> NextCatalog() { return std::nullopt; }

virtual Status LoadSchemas(std::string_view catalog) {
virtual Status LoadSchemas(std::string_view catalog,
std::optional<std::string_view> schema_filter) {
return status::NotImplemented("GetObjects at depth = schema");
};

virtual Result<std::optional<std::string_view>> NextSchema() { return std::nullopt; }

virtual Status LoadTables(std::string_view catalog, std::string_view schema) {
virtual Status LoadTables(std::string_view catalog, std::string_view schema,
std::optional<std::string_view> table_filter,
const std::vector<std::string_view>& table_types) {
return status::NotImplemented("GetObjects at depth = table");
};

virtual Result<std::optional<Table>> NextTable() { return std::nullopt; }

virtual Status LoadColumns(std::string_view catalog, std::string_view schema,
std::string_view table) {
std::string_view table,
std::optional<std::string_view> column_filter) {
return status::NotImplemented("GetObjects at depth = column");
};

Expand Down
Loading

0 comments on commit 18a7c8a

Please sign in to comment.