Skip to content

Commit 86dd77f

Browse files
removed std::format
1 parent e878b8d commit 86dd77f

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

examples/basic_example/basic_example.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@ std::string OptionalToString<std::string>(const std::optional<std::string>& opt)
4949
static void CreateTables(TQueryClient client) {
5050
//! Creates sample tables with the ExecuteQuery method
5151
ThrowOnError(client.RetryQuerySync([](TSession session) {
52-
auto query = std::format(R"(
52+
auto query = R"(
5353
CREATE TABLE series (
5454
series_id Uint64,
5555
title Utf8,
5656
series_info Utf8,
5757
release_date Uint64,
5858
PRIMARY KEY (series_id)
5959
);
60-
)");
60+
)";
6161
return session.ExecuteQuery(query, TTxControl::NoTx()).GetValueSync();
6262
}));
6363

6464
ThrowOnError(client.RetryQuerySync([](TSession session) {
65-
auto query = std::format(R"(
65+
auto query = R"(
6666
CREATE TABLE seasons (
6767
series_id Uint64,
6868
season_id Uint64,
@@ -71,12 +71,12 @@ static void CreateTables(TQueryClient client) {
7171
last_aired Uint64,
7272
PRIMARY KEY (series_id, season_id)
7373
);
74-
)");
74+
)";
7575
return session.ExecuteQuery(query, TTxControl::NoTx()).GetValueSync();
7676
}));
7777

7878
ThrowOnError(client.RetryQuerySync([](TSession session) {
79-
auto query = std::format(R"(
79+
auto query = R"(
8080
CREATE TABLE episodes (
8181
series_id Uint64,
8282
season_id Uint64,
@@ -85,7 +85,7 @@ static void CreateTables(TQueryClient client) {
8585
air_date Uint64,
8686
PRIMARY KEY (series_id, season_id, episode_id)
8787
);
88-
)");
88+
)";
8989
return session.ExecuteQuery(query, TTxControl::NoTx()).GetValueSync();
9090
}));
9191
}
@@ -94,23 +94,23 @@ static void CreateTables(TQueryClient client) {
9494

9595
static void DropTables(TQueryClient client) {
9696
ThrowOnError(client.RetryQuerySync([](TSession session) {
97-
auto query = std::format(R"(
97+
auto query = R"(
9898
DROP TABLE series;
99-
)");
99+
)";
100100
return session.ExecuteQuery(query, TTxControl::NoTx()).GetValueSync();
101101
}));
102102

103103
ThrowOnError(client.RetryQuerySync([](TSession session) {
104-
auto query = std::format(R"(
104+
auto query = R"(
105105
DROP TABLE seasons;
106-
)");
106+
)";
107107
return session.ExecuteQuery(query, TTxControl::NoTx()).GetValueSync();
108108
}));
109109

110110
ThrowOnError(client.RetryQuerySync([](TSession session) {
111-
auto query = std::format(R"(
111+
auto query = R"(
112112
DROP TABLE episodes;
113-
)");
113+
)";
114114
return session.ExecuteQuery(query, TTxControl::NoTx()).GetValueSync();
115115
}));
116116
}
@@ -119,7 +119,7 @@ static void DropTables(TQueryClient client) {
119119

120120
void FillTableData(TQueryClient client) {
121121
ThrowOnError(client.RetryQuerySync([](TSession session) {
122-
auto query = std::format(R"(
122+
auto query = R"(
123123
DECLARE $seriesData AS List<Struct<
124124
series_id: Uint64,
125125
title: Utf8,
@@ -165,7 +165,7 @@ void FillTableData(TQueryClient client) {
165165
title,
166166
CAST(air_date AS Uint16) AS air_date
167167
FROM AS_TABLE($episodesData);
168-
)");
168+
)";
169169

170170
auto params = GetTablesDataParams();
171171

@@ -179,11 +179,11 @@ void FillTableData(TQueryClient client) {
179179
void SelectSimple(TQueryClient client) {
180180
std::optional<TResultSet> resultSet;
181181
ThrowOnError(client.RetryQuerySync([&resultSet](TSession session) {
182-
auto query = std::format(R"(
182+
auto query = R"(
183183
SELECT series_id, title, CAST(release_date AS Date) AS release_date
184184
FROM series
185185
WHERE series_id = 1;
186-
)");
186+
)";
187187

188188
auto txControl =
189189
// Begin a new transaction with SerializableRW mode
@@ -211,10 +211,10 @@ void SelectSimple(TQueryClient client) {
211211

212212
void UpsertSimple(TQueryClient client) {
213213
ThrowOnError(client.RetryQuerySync([](TSession session) {
214-
auto query = std::format(R"(
214+
auto query = R"(
215215
UPSERT INTO episodes (series_id, season_id, episode_id, title) VALUES
216216
(2, 6, 1, "TBD");
217-
)");
217+
)";
218218

219219
return session.ExecuteQuery(query,
220220
TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).GetValueSync();
@@ -226,7 +226,7 @@ void SelectWithParams(TQueryClient client) {
226226
ThrowOnError(client.RetryQuerySync([&resultSet](TSession session) {
227227
ui64 seriesId = 2;
228228
ui64 seasonId = 3;
229-
auto query = std::format(R"(
229+
auto query = R"(
230230
DECLARE $seriesId AS Uint64;
231231
DECLARE $seasonId AS Uint64;
232232
@@ -235,7 +235,7 @@ void SelectWithParams(TQueryClient client) {
235235
INNER JOIN series AS sr
236236
ON sa.series_id = sr.series_id
237237
WHERE sa.series_id = $seriesId AND sa.season_id = $seasonId;
238-
)");
238+
)";
239239

240240
auto params = TParamsBuilder()
241241
.AddParam("$seriesId")
@@ -272,13 +272,13 @@ void MultiStep(TQueryClient client) {
272272
ThrowOnError(client.RetryQuerySync([&resultSet](TSession session) {
273273
ui64 seriesId = 2;
274274
ui64 seasonId = 5;
275-
auto query1 = std::format(R"(
275+
auto query1 = R"(
276276
DECLARE $seriesId AS Uint64;
277277
DECLARE $seasonId AS Uint64;
278278
279279
SELECT first_aired AS from_date FROM seasons
280280
WHERE series_id = $seriesId AND season_id = $seasonId;
281-
)");
281+
)";
282282

283283
auto params1 = TParamsBuilder()
284284
.AddParam("$seriesId")
@@ -320,14 +320,14 @@ void MultiStep(TQueryClient client) {
320320
TInstant toDate = userFunc(fromDate);
321321

322322
// Construct next query based on the results of client logic
323-
auto query2 = std::format(R"(
323+
auto query2 = R"(
324324
DECLARE $seriesId AS Uint64;
325325
DECLARE $fromDate AS Uint64;
326326
DECLARE $toDate AS Uint64;
327327
328328
SELECT season_id, episode_id, title, air_date FROM episodes
329329
WHERE series_id = $seriesId AND air_date >= $fromDate AND air_date <= $toDate;
330-
)");
330+
)";
331331

332332
auto params2 = TParamsBuilder()
333333
.AddParam("$seriesId")
@@ -384,11 +384,11 @@ void ExplicitTcl(TQueryClient client) {
384384
// Get newly created transaction id
385385
auto tx = beginResult.GetTransaction();
386386

387-
auto query = std::format(R"(
387+
auto query = R"(
388388
DECLARE $airDate AS Date;
389389
390390
UPDATE episodes SET air_date = CAST($airDate AS Uint16) WHERE title = "TBD";
391-
)");
391+
)";
392392

393393
auto params = TParamsBuilder()
394394
.AddParam("$airDate")
@@ -414,14 +414,14 @@ void StreamQuerySelect(TQueryClient client) {
414414
std::cout << "> StreamQuery:" << std::endl;
415415

416416
ThrowOnError(client.RetryQuerySync([](TQueryClient client) -> TStatus {
417-
auto query = std::format(R"(
417+
auto query = R"(
418418
DECLARE $series AS List<UInt64>;
419419
420420
SELECT series_id, season_id, title, CAST(first_aired AS Date) AS first_aired
421421
FROM seasons
422422
WHERE series_id IN $series
423423
ORDER BY season_id;
424-
)");
424+
)";
425425

426426
auto paramsBuilder = TParamsBuilder();
427427
auto& listParams = paramsBuilder

examples/basic_example/basic_example.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
NYdb::TParams GetTablesDataParams();
1010

11-
bool Run(const NYdb::TDriver& driver);
11+
bool Run(const NYdb::TDriver& driver);

examples/basic_example/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ int main(int argc, char** argv) {
5757

5858
driver.Stop(true);
5959
return 0;
60-
}
60+
}

0 commit comments

Comments
 (0)