File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -385,8 +385,12 @@ cdef class BaseProtocol(CoreProtocol):
385
385
wbuf.write_int16(< int16_t> num_cols)
386
386
# Tuple data
387
387
for i in range (num_cols):
388
- codec = < Codec> cpython.PyTuple_GET_ITEM(codecs, i)
389
- codec.encode(settings, wbuf, row[i])
388
+ item = row[i]
389
+ if item is None :
390
+ wbuf.write_int32(- 1 )
391
+ else :
392
+ codec = < Codec> cpython.PyTuple_GET_ITEM(codecs, i)
393
+ codec.encode(settings, wbuf, item)
390
394
391
395
if wbuf.len() >= _COPY_BUFFER_SIZE:
392
396
with timer:
Original file line number Diff line number Diff line change @@ -588,10 +588,12 @@ async def test_copy_records_to_table(self):
588
588
for i in range (100 )
589
589
]
590
590
591
+ records .append (('a-100' , None , None ))
592
+
591
593
res = await self .con .copy_records_to_table (
592
594
'copytab' , records = records )
593
595
594
- self .assertEqual (res , 'COPY 100 ' )
596
+ self .assertEqual (res , 'COPY 101 ' )
595
597
596
598
finally :
597
599
await self .con .execute ('DROP TABLE copytab' )
You can’t perform that action at this time.
0 commit comments