Skip to content

Commit 1f05cb3

Browse files
committed
WL10754: Fix issue when using empty string in Collection.modify()
1 parent ed459b0 commit 1f05cb3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/mysqlx/statement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def __init__(self, target, doc_based=True, condition=None):
163163
self._has_bindings = False
164164
self._binding_map = {}
165165
self._bindings = []
166-
if condition is not None:
166+
if condition:
167167
self.where(condition)
168168

169169
def where(self, condition):

tests/test_mysqlx_crud.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,8 @@ def test_modify(self):
920920
# Collection.modify() is not allowed without a condition
921921
result = collection.modify().unset(["young"])
922922
self.assertRaises(mysqlx.ProgrammingError, result.execute)
923+
result = collection.modify("").unset(["young"])
924+
self.assertRaises(mysqlx.ProgrammingError, result.execute)
923925

924926
self.schema.drop_collection(collection_name)
925927

0 commit comments

Comments
 (0)