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):
385385 wbuf.write_int16(< int16_t> num_cols)
386386 # Tuple data
387387 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)
390394
391395 if wbuf.len() >= _COPY_BUFFER_SIZE:
392396 with timer:
Original file line number Diff line number Diff line change @@ -588,10 +588,12 @@ async def test_copy_records_to_table(self):
588588 for i in range (100 )
589589 ]
590590
591+ records .append (('a-100' , None , None ))
592+
591593 res = await self .con .copy_records_to_table (
592594 'copytab' , records = records )
593595
594- self .assertEqual (res , 'COPY 100 ' )
596+ self .assertEqual (res , 'COPY 101 ' )
595597
596598 finally :
597599 await self .con .execute ('DROP TABLE copytab' )
You can’t perform that action at this time.
0 commit comments