Skip to content

Commit 116ad15

Browse files
committed
WL11930 Core API v1 alignment
1 parent 688a3f4 commit 116ad15

File tree

4 files changed

+21
-51
lines changed

4 files changed

+21
-51
lines changed

devapi/tests/crud-t.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ TEST_F(Crud, doc_path)
13241324
EXPECT_EQ(string("February"), static_cast<string>(doc["date"]["monthName"]));
13251325
EXPECT_EQ(4, static_cast<int>(doc["date"]["days"][0]));
13261326

1327-
coll.modify("true").arrayDelete("date.days[0]").execute();
1327+
coll.modify("true").unset("date.days[0]").execute();
13281328
docs = coll.find().execute();
13291329
doc = docs.fetchOne();
13301330
EXPECT_EQ(2, static_cast<int>(doc["date"]["days"][0]));
@@ -1788,11 +1788,11 @@ TEST_F(Crud, diagnostic)
17881788
cout << w << endl;
17891789
}
17901790

1791-
EXPECT_EQ(2U, res.getWarningCount());
1791+
EXPECT_EQ(2U, res.getWarningsCount());
17921792

17931793
std::vector<Warning> warnings = res.getWarnings();
17941794

1795-
for (unsigned i = 0; i < res.getWarningCount(); ++i)
1795+
for (unsigned i = 0; i < res.getWarningsCount(); ++i)
17961796
{
17971797
EXPECT_EQ(warnings[i].getCode(), res.getWarning(i).getCode());
17981798
}

devapi/tests/first-t.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ TEST_F(First, warnings_multi_rset)
586586
when during result transfer the warnings will be reported.
587587
*/
588588

589-
EXPECT_NO_THROW(res.getWarningCount());
589+
EXPECT_NO_THROW(res.getWarningsCount());
590590
EXPECT_NO_THROW(res.getWarnings());
591591

592592
res.nextResult();
@@ -601,7 +601,7 @@ TEST_F(First, warnings_multi_rset)
601601
std::vector<Warning> warnings = res.getWarnings();
602602

603603
EXPECT_EQ(1, warnings.size());
604-
EXPECT_EQ(1, res.getWarningCount());
604+
EXPECT_EQ(1, res.getWarningsCount());
605605

606606
for(auto warn : warnings)
607607
{
@@ -733,7 +733,7 @@ TEST_F(First, sqlresult)
733733
.bind(L"baz")
734734
.execute();
735735

736-
EXPECT_EQ(3, res.getAffectedRowsCount());
736+
EXPECT_EQ(3, res.getAffectedItemsCount());
737737
EXPECT_EQ(1, res.getAutoIncrementValue());
738738
}
739739

@@ -747,20 +747,20 @@ TEST_F(First, sqlresult)
747747
.bind(L"baz")
748748
.execute();
749749

750-
EXPECT_EQ(3, res.getAffectedRowsCount());
750+
EXPECT_EQ(3, res.getAffectedItemsCount());
751751
EXPECT_EQ(4, res.getAutoIncrementValue());
752752
}
753753

754754
{
755755
SqlResult res = get_sess().sql(L"SELECT * from test.t")
756756
.execute();
757757

758-
EXPECT_THROW(res.getAffectedRowsCount(), mysqlx::Error);
758+
EXPECT_THROW(res.getAffectedItemsCount(), mysqlx::Error);
759759
EXPECT_THROW(res.getAutoIncrementValue(), mysqlx::Error);
760760

761761
while (res.nextResult());
762762

763-
EXPECT_EQ(0, res.getAffectedRowsCount());
763+
EXPECT_EQ(0, res.getAffectedItemsCount());
764764
EXPECT_EQ(0, res.getAutoIncrementValue());
765765
}
766766

include/mysqlx/devapi/collection_crud.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -537,23 +537,6 @@ class CollectionModify
537537
CATCH_AND_WRAP
538538
}
539539

540-
/**
541-
Delete an element from an array field of a document.
542-
543-
The `field` parameter should be a document path pointing at a location
544-
inside an array field. The element at the indicated location is removed from
545-
the array.
546-
*/
547-
548-
CollectionModify& arrayDelete(const Field &field)
549-
{
550-
try {
551-
get_impl()->add_operation(Impl::ARRAY_DELETE, std::wstring(field));
552-
return *this;
553-
}
554-
CATCH_AND_WRAP
555-
}
556-
557540
/**
558541
Apply JSON Patch to a target JSON document.
559542

include/mysqlx/devapi/result.h

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Result_common
7676

7777
/// Get the number of warnings stored in the result.
7878

79-
unsigned getWarningCount() const
79+
unsigned getWarningsCount() const
8080
{
8181
try {
8282
return Base::get_warning_count();
@@ -108,6 +108,17 @@ class Result_common
108108
// TODO: expose this in the API?
109109
//using WarningsIterator = Result_detail::iterator;
110110

111+
/**
112+
Get the count of affected items (rows or doucuments) from manipulation statements.
113+
*/
114+
115+
uint64_t getAffectedItemsCount() const
116+
{
117+
try {
118+
return Result_detail::get_affected_rows();
119+
} CATCH_AND_WRAP
120+
}
121+
111122
protected:
112123

113124
// Wrap base ctors/assginment with catch handlers
@@ -169,17 +180,6 @@ class Result
169180

170181
Result() = default;
171182

172-
/**
173-
Get the count of affected items from manipulation statements.
174-
*/
175-
176-
uint64_t getAffectedItemsCount() const
177-
{
178-
try {
179-
return Result_detail::get_affected_rows();
180-
} CATCH_AND_WRAP
181-
}
182-
183183
/**
184184
Get the auto-increment value if one was generated by a table insert
185185
statement.
@@ -711,19 +711,6 @@ class SqlResult
711711
}
712712

713713

714-
/**
715-
Get the count of affected items from data manipulation statements.
716-
*/
717-
718-
uint64_t getAffectedRowsCount()
719-
{
720-
try {
721-
return Result_detail::get_affected_rows();
722-
}
723-
CATCH_AND_WRAP
724-
}
725-
726-
727714
/**
728715
Get the auto-increment value if one was generated by a table insert
729716
statement.

0 commit comments

Comments
 (0)