Skip to content

Commit

Permalink
fix: sqlite query escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
lampajr committed Feb 21, 2024
1 parent ec2c7b1 commit f9770ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ml_metadata/metadata_store/query_config_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,11 @@ absl::Status QueryConfigExecutor::DowngradeMetadataSource(
}

std::string QueryConfigExecutor::Bind(const char* value) {
return metadata_source_->EscapeString(value);
return absl::StrCat("'", metadata_source_->EscapeString(value), "'");
}

std::string QueryConfigExecutor::Bind(absl::string_view value) {
return metadata_source_->EscapeString(value);
return absl::StrCat("'", metadata_source_->EscapeString(value), "'");
}

std::string QueryConfigExecutor::Bind(int value) {
Expand Down
2 changes: 1 addition & 1 deletion ml_metadata/metadata_store/sqlite_metadata_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ absl::Status SqliteMetadataSource::RollbackImpl() {
}

std::string SqliteMetadataSource::EscapeString(absl::string_view value) const {
return SqliteEscapeString(value);
return absl::StrCat("'", SqliteEscapeString(value), "'");
}

std::string SqliteMetadataSource::EncodeBytes(absl::string_view value) const {
Expand Down

0 comments on commit f9770ba

Please sign in to comment.