@@ -2,7 +2,6 @@ package connmysql
22
33import (
44 "context"
5- "encoding/hex"
65 "fmt"
76 "log/slog"
87 "slices"
@@ -439,35 +438,3 @@ func TestIntegrationGetTableSchemaPrimaryKeyVariants(t *testing.T) {
439438 })
440439 }
441440}
442-
443- func TestParsePartialRowEventTableID (t * testing.T ) {
444- t .Parallel ()
445-
446- // Real PARTIAL_ROW_DATA_EVENT payloads captured from MariaDB 12.3
447- decode := func (s string ) []byte {
448- b , err := hex .DecodeString (s )
449- require .NoError (t , err )
450- return b
451- }
452- // first fragment: total=9, seq=1, flags=FL_ORIG_EVENT_SIZE, then origSize + embedded rows event
453- firstFragment := decode ("09000000010000000126200000000000002cc0476a" +
454- "17010000002a20000000000000000012000000000001000203fc0100000000200000" )
455- // a continuation fragment: total=9, seq=2, no flags, raw row data
456- continuationFragment := decode ("09000000020000000079797979797979797979" )
457-
458- tableID , total , ok := parsePartialRowEventTableID (firstFragment )
459- require .True (t , ok , "first fragment table id should be recoverable" )
460- require .Equal (t , uint64 (18 ), tableID )
461- require .Equal (t , uint32 (9 ), total )
462-
463- _ , total , ok = parsePartialRowEventTableID (continuationFragment )
464- require .False (t , ok , "continuation fragment carries no table id" )
465- require .Equal (t , uint32 (9 ), total , "total_fragments is still readable on continuation fragments" )
466-
467- // too short for even the post-header
468- _ , _ , ok = parsePartialRowEventTableID ([]byte {0x09 , 0x00 , 0x00 })
469- require .False (t , ok )
470- // post-header present but content truncated before the embedded table id
471- _ , _ , ok = parsePartialRowEventTableID (firstFragment [:partialRowsHeaderLen + 8 + binlogCommonHeaderLen + 2 ])
472- require .False (t , ok )
473- }
0 commit comments