classNumericMerge
final class NumericMerge
Merges two numeric types.
Rule: MYSQL-NUMERIC-MERGE-001, a part of MYSQL-TYPE-AGGREGATION-001. BOOL is TINYINT, SERIAL and BIT are BIGINT UNSIGNED. Two integers merge to the wider kind, unsigned when both are; an unsigned and a signed integer need the next wider signed kind, and BIGINT with BIGINT UNSIGNED needs DECIMAL. An integer with DECIMAL gives DECIMAL. Two FLOATs stay FLOAT; any other mixture with FLOAT, DOUBLE or REAL gives DOUBLE. Terminates: no recursion. Source: https://dev.mysql.com/doc/refman/8.4/en/union.html, https://dev.mysql.com/doc/refman/8.4/en/numeric-type-syntax.html. Status: Implemented.
Methods§
public function merge(TypeDescriptor $left, TypeDescriptor $right): TypeDescriptorAnswers the common type of two numeric types.
Parameters
$left | TypeDescriptor | |
$right | TypeDescriptor |
Returns
Test cases 1
Called from 1
Calls 6
- method-call NumericMerge::integral() line 49
- method-call NumericMerge::integers() line 52
- class-const FloatingKind::Float() line 55
- new Floating line 57
- class-const FloatingKind::Double() line 57
- new Decimal line 60
public function integral(TypeDescriptor $type): TypeDescriptorAnswers the integer type BOOL, SERIAL and BIT stand for, and every other type unchanged.
Parameters
$type | TypeDescriptor |
Returns
Test cases 1
Called from 2
Calls 11
- class-const ElementaryKind::Boolean() line 73
- new Integral line 73
- class-const IntegralKind::TinyInt() line 73
- class-const ElementaryKind::Serial() line 74
- class-const ElementaryKind::Bit() line 74
- class-const IntegralKind::BigInt() line 74
- class-const NumericModifier::Unsigned() line 74
- class-const ElementaryKind::Json() line 75
- class-const ElementaryKind::Vector() line 75
- new Floating line 75
- class-const FloatingKind::Double() line 75
public function integers(Integral $left, Integral $right): TypeDescriptorAnswers the common type of two integer types.
Returns
Test cases 1
Called from 1
Calls 7
- function-call
maxline 84 - class-const NumericMerge::WIDTHS() line 84
- method-call Integral::unsigned() line 85
- new Integral line 86
- class-const NumericMerge::KINDS() line 86
- class-const NumericModifier::Unsigned() line 86
- new Decimal line 91
Private surface 2§
Implementation details, listed for orientation only.
private const WIDTHS = ['TINYINT' => 1, 'SMALLINT' => 2, 'MEDIUMINT' => 3, 'INT' => 4, 'BIGINT' => 5]private const KINDS = [1 => \SqlSemantics\Platform\MySql\Statement\Type\Kind\IntegralKind::TinyInt, 2…Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.