lidavidm commented on code in PR #3876:
URL: https://github.com/apache/arrow-adbc/pull/3876#discussion_r2801891501
##########
c/driver_manager/adbc_driver_manager.cc:
##########
@@ -398,6 +417,91 @@ AdbcStatusCode LoadDriverFromRegistry(HKEY root, const
std::wstring& driver_name
}
#endif // _WIN32
+#define CHECK_STATUS(EXPR) \
+ if (auto _status = (EXPR); _status != ADBC_STATUS_OK) { \
+ return _status; \
+ }
+
+AdbcStatusCode ProcessProfileValue(std::string_view value, std::string& out,
+ struct AdbcError* error) {
+ if (value.empty()) {
+ SetError(error, "Profile value is null");
+ return ADBC_STATUS_INVALID_ARGUMENT;
+ }
+
+ std::regex pattern(R"(\{\{\s*([^{}]*?)\s*\}\})");
+ auto end_of_last_match = value.begin();
+ auto begin = std::regex_iterator(value.begin(), value.end(), pattern);
+ auto end = decltype(begin){};
+ std::match_results<std::string_view::iterator>::difference_type
pos_last_match = 0;
+
+ out.resize(0);
+ for (auto itr = begin; itr != end; ++itr) {
+ auto match = *itr;
+ auto pos_match = match.position();
+ auto diff = pos_match - pos_last_match;
+ auto start_match = end_of_last_match;
+ std::advance(start_match, diff);
+ if (pos_match > 0 && value[pos_match - 1] == '\\') {
Review Comment:
Just, I thought it was difficult for the `env_var(FOO)` to be escaped
:slightly_smiling_face:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]