Skip to content
This repository was archived by the owner on Dec 8, 2021. It is now read-only.

Commit 4b648a0

Browse files
authored
refactor!: prepare for new field in SqlParams (#1265)
We're going to be adding a new field to SqlParams fairly soon, so to prevent an API break later, this PR adds a dummy field in the struct so that we can take the API breakage now rather than later. The struct field is named such that users *should* not use it by name, but its existence should require that it gets default initialized.
1 parent 23b3570 commit 4b648a0

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

google/cloud/spanner/client.cc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ RowStream Client::ExecuteQuery(SqlStatement statement) {
8686
return conn_->ExecuteQuery(
8787
{internal::MakeSingleUseTransaction(Transaction::ReadOnlyOptions()),
8888
std::move(statement),
89+
{},
8990
{}});
9091
}
9192

@@ -94,13 +95,14 @@ RowStream Client::ExecuteQuery(
9495
return conn_->ExecuteQuery(
9596
{internal::MakeSingleUseTransaction(std::move(transaction_options)),
9697
std::move(statement),
98+
{},
9799
{}});
98100
}
99101

100102
RowStream Client::ExecuteQuery(Transaction transaction,
101103
SqlStatement statement) {
102104
return conn_->ExecuteQuery(
103-
{std::move(transaction), std::move(statement), {}});
105+
{std::move(transaction), std::move(statement), {}, {}});
104106
}
105107

106108
RowStream Client::ExecuteQuery(QueryPartition const& partition) {
@@ -111,6 +113,7 @@ ProfileQueryResult Client::ProfileQuery(SqlStatement statement) {
111113
return conn_->ProfileQuery(
112114
{internal::MakeSingleUseTransaction(Transaction::ReadOnlyOptions()),
113115
std::move(statement),
116+
{},
114117
{}});
115118
}
116119

@@ -119,13 +122,14 @@ ProfileQueryResult Client::ProfileQuery(
119122
return conn_->ProfileQuery(
120123
{internal::MakeSingleUseTransaction(std::move(transaction_options)),
121124
std::move(statement),
125+
{},
122126
{}});
123127
}
124128

125129
ProfileQueryResult Client::ProfileQuery(Transaction transaction,
126130
SqlStatement statement) {
127131
return conn_->ProfileQuery(
128-
{std::move(transaction), std::move(statement), {}});
132+
{std::move(transaction), std::move(statement), {}, {}});
129133
}
130134

131135
StatusOr<std::vector<QueryPartition>> Client::PartitionQuery(
@@ -137,17 +141,20 @@ StatusOr<std::vector<QueryPartition>> Client::PartitionQuery(
137141

138142
StatusOr<DmlResult> Client::ExecuteDml(Transaction transaction,
139143
SqlStatement statement) {
140-
return conn_->ExecuteDml({std::move(transaction), std::move(statement), {}});
144+
return conn_->ExecuteDml(
145+
{std::move(transaction), std::move(statement), {}, {}});
141146
}
142147

143148
StatusOr<ProfileDmlResult> Client::ProfileDml(Transaction transaction,
144149
SqlStatement statement) {
145-
return conn_->ProfileDml({std::move(transaction), std::move(statement), {}});
150+
return conn_->ProfileDml(
151+
{std::move(transaction), std::move(statement), {}, {}});
146152
}
147153

148154
StatusOr<ExecutionPlan> Client::AnalyzeSql(Transaction transaction,
149155
SqlStatement statement) {
150-
return conn_->AnalyzeSql({std::move(transaction), std::move(statement), {}});
156+
return conn_->AnalyzeSql(
157+
{std::move(transaction), std::move(statement), {}, {}});
151158
}
152159

153160
StatusOr<BatchDmlResult> Client::ExecuteBatchDml(

google/cloud/spanner/connection.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class Connection {
8787
struct SqlParams {
8888
Transaction transaction;
8989
SqlStatement statement;
90+
struct {
91+
} placeholder_do_not_use_name_will_change;
9092
google::cloud::optional<std::string> partition_token;
9193
};
9294

google/cloud/spanner/query_partition.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ QueryPartition MakeQueryPartition(std::string const& transaction_id,
9999
Connection::SqlParams MakeSqlParams(QueryPartition const& query_partition) {
100100
return {internal::MakeTransactionFromIds(query_partition.session_id(),
101101
query_partition.transaction_id()),
102-
query_partition.sql_statement(), query_partition.partition_token()};
102+
query_partition.sql_statement(),
103+
{},
104+
query_partition.partition_token()};
103105
}
104106

105107
} // namespace internal

0 commit comments

Comments
 (0)