Skip to content

Commit 2d916a4

Browse files
committed
Resolving comment
1 parent 94ae55e commit 2d916a4

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

mssql_python/row.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,21 @@ def __init__(self, cursor, description, values, column_map=None):
3333
if hasattr(cursor.connection, '_output_converters') and cursor.connection._output_converters:
3434
self._values = self._apply_output_converters(values)
3535
else:
36-
# Check for native_uuid setting
37-
if not get_settings().native_uuid:
38-
# Convert UUID objects to strings when native_uuid is False
39-
processed_values = []
40-
for i, value in enumerate(values):
41-
if i < len(description) and description[i] and isinstance(value, uuid.UUID):
42-
processed_values.append(str(value))
43-
else:
44-
processed_values.append(value)
45-
self._values = processed_values
36+
self._values = self._process_uuid_values(values, description)
37+
38+
def _process_uuid_values(self, values, description):
39+
"""
40+
Convert UUID objects to strings if native_uuid setting is False.
41+
"""
42+
if get_settings().native_uuid:
43+
return values
44+
processed_values = []
45+
for i, value in enumerate(values):
46+
if i < len(description) and description[i] and isinstance(value, uuid.UUID):
47+
processed_values.append(str(value))
4648
else:
47-
self._values = values
49+
processed_values.append(value)
50+
return processed_values
4851

4952
# TODO: ADO task - Optimize memory usage by sharing column map across rows
5053
# Instead of storing the full cursor_description in each Row object:

0 commit comments

Comments
 (0)