db.hh: use hasPrefix for prefix comparisons

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
This commit is contained in:
Graham Christensen 2021-02-24 07:00:26 -05:00 committed by GitHub
parent 62b2880dfc
commit e4cda87b5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,8 +17,7 @@ struct Connection : pqxx::connection
std::string lower_prefix = "dbi:Pg:";
std::string upper_prefix = "DBI:Pg:";
if ((std::string(s, 0, lower_prefix.size()) == lower_prefix) ||
(std::string(s, 0, upper_prefix.size()) == upper_prefix)) {
if (hasPrefix(s, lower_prefix) || hasPrefix(s, upper_prefix)) {
return concatStringsSep(" ", tokenizeString<Strings>(string(s, lower_prefix.size()), ";"));
}