Skip to content

Commit

Permalink
Merge branch krowinski master (#16)
Browse files Browse the repository at this point in the history
* Sync `krowinski:master` into master:

- Fix JsonBinaryDecoder when there is NULL in data or if there is long.
- Preserve threadId in QUERY_EVENT.

* Fix CS

---------

Co-authored-by: xiemaomao <[email protected]>
  • Loading branch information
Moln and xiemaomao authored Jan 19, 2024
1 parent 31dad1f commit 7073c7b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Based on a great work of creators:https://github.com/noplay/python-mysql-repli
**Note:** Resolve these issues:

- Add regular expression matching support for `DatabasesOnly` or `TablesOnly` of `Config`.
```php
(new ConfigBuilder())->withTablesOnly(['log_\d+'])->build(); // Table `log_20240101`
```
- Resolve [krowinski/php-mysql-replication#94](https://github.com/krowinski/php-mysql-replication/issues/94), change static config properties to non-static.
- Add retry feature.
```php
Expand Down
2 changes: 1 addition & 1 deletion src/MySQLReplication/Event/DTO/QueryDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(
string $database,
int $executionTime,
string $query,
int $threadId
int $threadId = 0
) {
parent::__construct($eventInfo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function parseToString(): string
{
// Sometimes, we can insert a NULL JSON even we set the JSON field as NOT NULL.
// If we meet this case, we can return a 'null' value.
if($this->binaryDataReader->getBinaryDataLength() === 0) {
if ($this->binaryDataReader->getBinaryDataLength() === 0) {
return 'null';
}
$this->parseJson($this->binaryDataReader->readUInt8());
Expand Down Expand Up @@ -251,7 +251,7 @@ private function getOffsetOrInLinedValue(int $bytes, int $intSize, int $valueEnt

// In binlog format, JSON arrays are fixed width elements, even though type value can be smaller.
// In order to properly process this case, we need to move cursor to the next element, which is on position 1 + $valueEntrySize (1 is length of type)
if($type === self::UINT16 || $type === self::INT16) {
if ($type === self::UINT16 || $type === self::INT16) {
$readNextBytes = $valueEntrySize - 2 - 1;
$this->binaryDataReader->read($readNextBytes);
}
Expand Down

0 comments on commit 7073c7b

Please sign in to comment.