MCPcopy Create free account
hub / github.com/actiontech/dtle / setDtleQuery

Method setDtleQuery

driver/mysql/binlog/binlog_reader.go:791–807  ·  view source on GitHub ↗
(query string)

Source from the content-addressed store, hash-verified

789 return nil
790}
791func (b *BinlogReader) setDtleQuery(query string) string {
792 if strings.Contains(query, "/*dtle_gtid1") {
793 return query
794 } else {
795 coordinate := b.entryContext.Entry.Coordinates.(*common.MySQLCoordinateTx)
796 uuidStr := uuid.UUID(coordinate.SID).String()
797 tag := fmt.Sprintf("/*dtle_gtid1 %v %v %v dtle_gtid*/", b.execCtx.Subject, uuidStr, coordinate.GNO)
798
799 upperQuery := strings.ToUpper(query)
800 if strings.HasPrefix(upperQuery, "CREATE DEFINER=") {
801 if strings.HasSuffix(upperQuery, "END") {
802 return fmt.Sprintf("%v %v END", query[:len(query)-3], tag)
803 }
804 }
805 return fmt.Sprintf("%v %v", query, tag)
806 }
807}
808
809func (b *BinlogReader) sendEntry(entriesChannel chan<- *common.EntryContext) {
810 isBig := b.entryContext.Entry.IsPartOfBigTx()

Callers 1

handleQueryEventMethod · 0.95

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected