Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion google/cloud/spanner/internal/status_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "google/cloud/spanner/internal/status_utils.h"
#include "google/cloud/grpc_error_delegate.h"
#include "google/cloud/internal/absl_str_cat_quiet.h"
#include "google/cloud/internal/status_payload_keys.h"
#include "absl/strings/match.h"
#include <google/rpc/error_details.pb.h>
Expand All @@ -38,7 +39,8 @@ bool IsSessionNotFound(google::cloud::Status const& status) {
for (google::protobuf::Any const& any : proto.details()) {
if (any.UnpackTo(&resource_info)) {
google::spanner::v1::Session session;
auto session_url = "type.googleapis.com/" + session.GetTypeName();
auto session_url =
absl::StrCat("type.googleapis.com/", session.GetTypeName());
return resource_info.resource_type() == session_url;
}
}
Expand Down
5 changes: 4 additions & 1 deletion google/cloud/spanner/proto_enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ class ProtoEnum {
explicit operator enum_type() const { return v_; }

/// The fully-qualified name of the enum type, scope delimited by periods.
static std::string const& TypeName() { return Descriptor()->full_name(); }
static std::string const& TypeName() {
static std::string const kName(Descriptor()->full_name());
return kName;
}

/// @name Relational operators
///@{
Expand Down
3 changes: 2 additions & 1 deletion google/cloud/spanner/proto_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class ProtoMessage {

/// The fully-qualified name of the message type, scope delimited by periods.
static std::string const& TypeName() {
return message_type::GetDescriptor()->full_name();
static std::string const kName(message_type::GetDescriptor()->full_name());
return kName;
}

/// @name Relational operators
Expand Down
4 changes: 3 additions & 1 deletion google/cloud/spanner/testing/status_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "google/cloud/spanner/testing/status_utils.h"
#include "google/cloud/grpc_error_delegate.h"
#include "google/cloud/internal/absl_str_cat_quiet.h"
#include <google/rpc/error_details.pb.h>
#include <google/rpc/status.pb.h>
#include <google/spanner/v1/spanner.pb.h>
Expand All @@ -25,7 +26,8 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

grpc::Status SessionNotFoundRpcError(std::string name) {
google::spanner::v1::Session session;
auto session_url = "type.googleapis.com/" + session.GetTypeName();
auto session_url =
absl::StrCat("type.googleapis.com/", session.GetTypeName());

google::rpc::ResourceInfo resource_info;
resource_info.set_resource_type(session_url);
Expand Down
Loading