Skip to content

Commit

Permalink
Merge pull request #8092 from Sesquipedalian/mysql_uuid
Browse files Browse the repository at this point in the history
Handles UUID datatype correctly in SMF\Db\APIs\MySQL::calculate_type
  • Loading branch information
Sesquipedalian authored Feb 8, 2024
2 parents a9ca4eb + 2149afd commit d83c11a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Sources/Db/APIs/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -1348,10 +1348,12 @@ public function calculate_type(string $type_name, ?int $type_size = null, bool $
if (!$reverse) {
$types = [
'inet' => 'varbinary',
'uuid' => 'binary',
];
} else {
$types = [
'varbinary' => 'inet',
'binary' => 'uuid',
];
}

Expand All @@ -1360,11 +1362,19 @@ public function calculate_type(string $type_name, ?int $type_size = null, bool $
if ($type_name == 'inet' && !$reverse) {
$type_size = 16;
$type_name = 'varbinary';
} elseif ($type_name == 'uuid' && !$reverse) {
$type_size = 16;
$type_name = 'binary';
} elseif ($type_name == 'varbinary' && $reverse && $type_size == 16) {
$type_name = 'inet';
$type_size = null;
} elseif ($type_name == 'binary' && $reverse && $type_size == 16) {
$type_name = 'uuid';
$type_size = null;
} elseif ($type_name == 'varbinary') {
$type_name = 'varbinary';
} elseif ($type_name == 'binary') {
$type_name = 'binary';
} else {
$type_name = $types[$type_name];
}
Expand Down

0 comments on commit d83c11a

Please sign in to comment.