-
Notifications
You must be signed in to change notification settings - Fork 102
fix #115 for mysql 8.4.0 #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
1d794b4
c5b38e5
6ca015c
bee8f75
418625f
bb27b5d
0c31198
2a372a7
f0fa732
2e87e3c
c310edb
09abaf4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,16 +114,21 @@ public function readUInt24(): int | |
return $data[1] + ($data[2] << 8) + ($data[3] << 16); | ||
} | ||
|
||
public function readUInt64(): string | ||
public function readUInt64(): string|int | ||
{ | ||
return $this->unpackUInt64($this->read(self::UNSIGNED_INT64_LENGTH)); | ||
} | ||
|
||
public function unpackUInt64(string $binary): string | ||
public function unpackUInt64(string $binary): string|int | ||
{ | ||
$data = self::unpack('V*', $binary); | ||
|
||
return bcadd((string)$data[1], bcmul((string)$data[2], bcpow('2', '32'))); | ||
$num = bcadd((string)$data[1], bcmul((string)$data[2], bcpow('2', '32'))); | ||
if($num>PHP_INT_MAX || $num<PHP_INT_MIN){ | ||
return $num; | ||
}else{ | ||
return intval($num); | ||
} | ||
Comment on lines
+127
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its better to return always string here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like you are really close to getting this done, @krowinski maybe you can be the tie breaker and just say how you want it to get this rolling? Would be awesome to get Mysql 8.4 support rolling. |
||
} | ||
|
||
public function readInt24(): int | ||
|
@@ -138,11 +143,16 @@ public function readInt24(): int | |
return $res; | ||
} | ||
|
||
public function readInt64(): string | ||
public function readInt64(): string|int | ||
{ | ||
$data = self::unpack('V*', $this->read(self::UNSIGNED_INT64_LENGTH)); | ||
|
||
return bcadd((string)$data[1], (string)($data[2] << 32)); | ||
$num = bcadd((string)$data[1], (string)($data[2] << 32)); | ||
if($num>PHP_INT_MAX || $num<PHP_INT_MIN){ | ||
return $num; | ||
}else{ | ||
return intval($num); | ||
} | ||
Comment on lines
+150
to
+155
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
} | ||
|
||
public function readLengthString(int $size): string | ||
|
@@ -286,7 +296,7 @@ public function readDouble(): float | |
|
||
public function readTableId(): string | ||
{ | ||
return $this->unpackUInt64($this->read(self::UNSIGNED_INT48_LENGTH) . chr(0) . chr(0)); | ||
return (string)$this->unpackUInt64($this->read(self::UNSIGNED_INT48_LENGTH) . chr(0) . chr(0)); | ||
} | ||
|
||
public function isComplete(int $size): bool | ||
|
Uh oh!
There was an error while loading. Please reload this page.