Skip to content

Commit 148e9e1

Browse files
authored
docs(spanner): reorganize Client::ExecuteQuery() docs (googleapis#13221)
The overloads for `Client::ExecuteQuery()` used `@copydoc` to share documentation, but this meant they had overly general specifications, and included examples that did not apply to the overload at hand. Let's instead give each overload an independent documentation block, so that the text and examples are closely related to the behavior.
1 parent 10d83ac commit 148e9e1

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

google/cloud/spanner/client.h

+23-18
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,8 @@ class Client {
249249
std::vector<std::string> columns, Options opts = {});
250250

251251
/**
252-
* Executes a SQL query.
253-
*
254-
* Operations inside read-write transactions might return `ABORTED`. If this
255-
* occurs, the application should restart the transaction from the beginning.
256-
*
257-
* Callers can optionally supply a `Transaction` or
258-
* `Transaction::SingleUseOptions` used to create a single-use transaction -
259-
* or neither, in which case a single-use transaction with default options
260-
* is used.
252+
* Executes a SQL query in a single-use transaction created with the
253+
* default options.
261254
*
262255
* `SELECT * ...` queries are supported, but there's no guarantee about the
263256
* order, nor number, of returned columns. Therefore, the caller must look up
@@ -267,9 +260,6 @@ class Client {
267260
* returned/ignored, and the column order is known. This enables more
268261
* efficient and simpler code.
269262
*
270-
* Can also execute a DML statement with a returning clause in a read/write
271-
* transaction.
272-
*
273263
* @note No individual row in the `RowStream` can exceed 100 MiB, and no
274264
* column value can exceed 10 MiB.
275265
*
@@ -281,10 +271,6 @@ class Client {
281271
* Using `SELECT *`.
282272
* @snippet samples.cc spanner-query-data-select-star
283273
*
284-
* @par Example
285-
* Using a DML statement with `THEN RETURN`.
286-
* @snippet samples.cc spanner-update-dml-returning
287-
*
288274
* @param statement The SQL statement to execute.
289275
* @param opts (optional) The `Options` to use for this call. If given,
290276
* these will take precedence over the options set at the client and
@@ -293,18 +279,37 @@ class Client {
293279
RowStream ExecuteQuery(SqlStatement statement, Options opts = {});
294280

295281
/**
296-
* @copydoc ExecuteQuery(SqlStatement, Options)
282+
* Executes a SQL query in a single-use transaction created with the
283+
* @p transaction_options.
297284
*
298285
* @param transaction_options Execute this query in a single-use transaction
299286
* with these options.
287+
* @param statement The SQL statement to execute.
288+
* @param opts (optional) The `Options` to use for this call. If given,
289+
* these will take precedence over the options set at the client and
290+
* environment levels.
300291
*/
301292
RowStream ExecuteQuery(Transaction::SingleUseOptions transaction_options,
302293
SqlStatement statement, Options opts = {});
303294

304295
/**
305-
* @copydoc ExecuteQuery(SqlStatement, Options)
296+
* Executes a SQL query in an existing transaction.
297+
*
298+
* Operations inside read-write transactions might return `ABORTED`. If this
299+
* occurs, the application should restart the transaction from the beginning.
300+
*
301+
* Can execute a DML statement with a returning clause in a read/write
302+
* transaction.
303+
*
304+
* @par Example
305+
* Using a DML statement with `THEN RETURN`.
306+
* @snippet samples.cc spanner-update-dml-returning
306307
*
307308
* @param transaction Execute this query as part of an existing transaction.
309+
* @param statement The SQL statement to execute.
310+
* @param opts (optional) The `Options` to use for this call. If given,
311+
* these will take precedence over the options set at the client and
312+
* environment levels.
308313
*/
309314
RowStream ExecuteQuery(Transaction transaction, SqlStatement statement,
310315
Options opts = {});

0 commit comments

Comments
 (0)