diff --git a/src/MySQLReplication/Event/DTO/QueryDTO.php b/src/MySQLReplication/Event/DTO/QueryDTO.php index 5c215b2d..1ec3604d 100644 --- a/src/MySQLReplication/Event/DTO/QueryDTO.php +++ b/src/MySQLReplication/Event/DTO/QueryDTO.php @@ -12,18 +12,21 @@ class QueryDTO extends EventDTO private $query; private $database; private $type = ConstEventsNames::QUERY; + private $threadId; public function __construct( EventInfo $eventInfo, string $database, int $executionTime, - string $query + string $query, + int $threadId ) { parent::__construct($eventInfo); $this->executionTime = $executionTime; $this->query = $query; $this->database = $database; + $this->threadId = $threadId; } public function getDatabase(): string @@ -46,6 +49,11 @@ public function getType(): string return $this->type; } + public function getThreadId(): int + { + return $this->threadId; + } + public function __toString(): string { return PHP_EOL . diff --git a/src/MySQLReplication/Event/QueryEvent.php b/src/MySQLReplication/Event/QueryEvent.php index 48e2b7db..88f6b318 100644 --- a/src/MySQLReplication/Event/QueryEvent.php +++ b/src/MySQLReplication/Event/QueryEvent.php @@ -12,7 +12,7 @@ class QueryEvent extends EventCommon { public function makeQueryDTO(): QueryDTO { - $this->binaryDataReader->advance(4); + $threadId = $this->binaryDataReader->readUInt32(); $executionTime = $this->binaryDataReader->readUInt32(); $schemaLength = $this->binaryDataReader->readUInt8(); $this->binaryDataReader->advance(2); @@ -26,7 +26,8 @@ public function makeQueryDTO(): QueryDTO $this->eventInfo, $schema, $executionTime, - $query + $query, + $threadId ); } } \ No newline at end of file