classMagnitudes
final class Magnitudes
Measures the operands whose size the server checks while it parses a server administration statement.
Rule: MYSQL-SERVER-MAGNITUDE-001. The length of a string operand is its byte count: the decoded bytes of a quoted string, half the hexadecimal digits rounded up, an eighth of the bits rounded up. A number at a position that is not an expression is converted as the server converts it: a hexadecimal literal by its digits, clamped to 2^63-1 as strtoll clamps it, any other number by the decimal digits it starts with (my_strtoll10 stops at a point or an exponent). The format identifier of an XA transaction identifier is refused above 2^63-1 from 5.7 on (format_id_overflow_detected in the xid action); 5.6 takes any. The comparison is exact on the digit strings, without a PHP number. At a position the grammar reads through dec_num_error a decimal or floating number is FractionalNumber (ER_ONLY_INTEGERS_ALLOWED). Terminates: one pass over the digits. Source: https://dev.mysql.com/doc/refman/8.4/en/number-literals.html, https://dev.mysql.com/doc/refman/8.4/en/hexadecimal-literals.html. Status: Implemented.
Constants§
public const LARGEST = '9223372036854775807'The largest signed 64-bit integer, the value strtoll gives a larger hexadecimal number.
Methods§
public function bytes(Text $text): intAnswers the number of bytes a string operand holds.
Parameters
$text | Text |
Returns
intTest cases 1
Called from 3
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Transaction\XaRule::limits() packages/sql-semantics-mysql/src/Lowering/Server/Transaction/XaRule.php:180
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\Xid::__construct() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/Xid.php:46
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\Xid::__construct() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/Xid.php:47
Calls 4
- function-call
strlenline 51 - class-const Radix::Hexadecimal() line 52
- function-call
intdivline 52 - class-const Radix::Bit() line 53
public function integral(Numeral $number): boolTells whether a number is an integer: digits only, or a hexadecimal literal.
Parameters
$number | Numeral |
Returns
boolTest cases 1
Called from 3
- method-call SqlSemantics\Platform\MySql\Rules\Server\Magnitudes::integer() packages/sql-semantics-mysql/src/Rules/Server/Magnitudes.php:70
- method-call SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::unset() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:142
- method-call SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::unset() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:146
Calls 1
- function-call
preg_matchline 62
public function integer(Derivation $derivation, Numeral $number): boolReports a decimal or floating number at a position that reads it through dec_num_error.
Parameters
$derivation | Derivation | |
$number | Numeral |
Returns
boolCalled from 4
- method-call SqlSemantics\Platform\MySql\Rules\Server\SpatialChecks::srid() packages/sql-semantics-mysql/src/Rules/Server/SpatialChecks.php:45
- method-call SqlSemantics\Platform\MySql\Rules\Server\SpatialChecks::attribute() packages/sql-semantics-mysql/src/Rules/Server/SpatialChecks.php:97
- method-call SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::derive() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:130
- method-call SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::size() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:155
Calls 3
- method-call Magnitudes::integral() line 70
- method-call Derivation::report() line 73
- new FractionalNumber line 73
public function format(Numeral $format, GrammarRelease $release): boolTells whether a release reads an XA format identifier: any number on 5.6, at most 2^63-1 later.
Parameters
$format | Numeral | |
$release | GrammarRelease |
Returns
boolTest cases 1
Called from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Transaction\XaRule::limits() packages/sql-semantics-mysql/src/Lowering/Server/Transaction/XaRule.php:183
- method-call SqlSemantics\Platform\MySql\Rules\Server\Magnitudes::identifier() packages/sql-semantics-mysql/src/Rules/Server/Magnitudes.php:93
Calls 3
- class-const GrammarRelease::MySql5651() line 83
- method-call Magnitudes::atMost() line 83
- class-const Magnitudes::LARGEST() line 83
public function identifier(Xid $xid, GrammarRelease $release): voidRefuses an XA transaction identifier whose format identifier the release rejects while it parses.
Parameters
$xid | Xid | |
$release | GrammarRelease |
Throws
InvalidConstruction When the format identifier exceeds what the release readsTest cases 1
Called from 5
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaCommit::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaCommit.php:45
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaEnd::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaEnd.php:45
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaPrepare::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaPrepare.php:44
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaRollback::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaRollback.php:44
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaStart::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaStart.php:45
Calls 2
- static-call Check::input() line 93
- method-call Magnitudes::format() line 93
public function atMost(Numeral $number, string $limit): boolTells whether a number the server converts to an unsigned integer is at most a limit given in decimal digits.
Parameters
$number | Numeral | |
$limit | string |
Returns
boolTest cases 1
Called from 6
- method-call SqlSemantics\Platform\MySql\Rules\Server\Magnitudes::format() packages/sql-semantics-mysql/src/Rules/Server/Magnitudes.php:83
- method-call SqlSemantics\Platform\MySql\Rules\Server\SpatialChecks::srid() packages/sql-semantics-mysql/src/Rules/Server/SpatialChecks.php:48
- method-call SqlSemantics\Platform\MySql\Rules\Server\SpatialChecks::srid() packages/sql-semantics-mysql/src/Rules/Server/SpatialChecks.php:50
- method-call SqlSemantics\Platform\MySql\Rules\Server\SpatialChecks::attribute() packages/sql-semantics-mysql/src/Rules/Server/SpatialChecks.php:97
- method-call SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::unset() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:142
- method-call SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::unset() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:146
Calls 6
- function-call
ltrimline 101 - method-call Magnitudes::decimal() line 101
- function-call
preg_replaceline 101 - function-call
strlenline 102 - function-call
strcmpline 102 - class-const Magnitudes::LARGEST() line 102
public function decimal(string $hexadecimal): stringConverts hexadecimal digits into decimal digits exactly.
Parameters
$hexadecimal | string |
Returns
stringTest cases 1
Called from 1
Test cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
MagnitudesTest::testAtMostComparesTheDigitsExactlycallsMagnitudesTest::testBytesCountsTheBytesOfEachSpellingcallsMagnitudesTest::testDecimalConvertsHexadecimalDigitscallsMagnitudesTest::testFormatTakesAnyNumberOnMySql56OnlycallsMagnitudesTest::testIdentifierRefusesAFormatTheReleaseRejectscallsMagnitudesTest::testIntegralTellsWhetherANumberIsAnIntegercalls
Relations§
Instantiated in 12
- new SqlSemantics\Platform\MySql\Lowering\Server\Transaction\XaRule::limits() packages/sql-semantics-mysql/src/Lowering/Server/Transaction/XaRule.php:179
- new SqlSemantics\Platform\MySql\Rules\Server\SpatialChecks::srid() packages/sql-semantics-mysql/src/Rules/Server/SpatialChecks.php:44
- new SqlSemantics\Platform\MySql\Rules\Server\SpatialChecks::attribute() packages/sql-semantics-mysql/src/Rules/Server/SpatialChecks.php:96
- new SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::derive() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:111
- new SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::unset() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:140
- new SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::size() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:155
- new SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaCommit::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaCommit.php:45
- new SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaEnd::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaEnd.php:45
- new SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaPrepare::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaPrepare.php:44
- new SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaRollback::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaRollback.php:44
- new SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaStart::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaStart.php:45
- new SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\Xid::__construct() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/Xid.php:45
Method calls 20
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Transaction\XaRule::limits() packages/sql-semantics-mysql/src/Lowering/Server/Transaction/XaRule.php:180
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Transaction\XaRule::limits() packages/sql-semantics-mysql/src/Lowering/Server/Transaction/XaRule.php:183
- method-call SqlSemantics\Platform\MySql\Rules\Server\SpatialChecks::srid() packages/sql-semantics-mysql/src/Rules/Server/SpatialChecks.php:45
- method-call SqlSemantics\Platform\MySql\Rules\Server\SpatialChecks::srid() packages/sql-semantics-mysql/src/Rules/Server/SpatialChecks.php:48
- method-call SqlSemantics\Platform\MySql\Rules\Server\SpatialChecks::srid() packages/sql-semantics-mysql/src/Rules/Server/SpatialChecks.php:50
- method-call SqlSemantics\Platform\MySql\Rules\Server\SpatialChecks::attribute() packages/sql-semantics-mysql/src/Rules/Server/SpatialChecks.php:97
- method-call SqlSemantics\Platform\MySql\Rules\Server\SpatialChecks::attribute() packages/sql-semantics-mysql/src/Rules/Server/SpatialChecks.php:97
- method-call SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::derive() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:130
- method-call SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::unset() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:142
- method-call SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::unset() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:142
- method-call SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::unset() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:146
- method-call SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::unset() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:146
- method-call SqlSemantics\Platform\MySql\Rules\Server\StorageOptions::size() packages/sql-semantics-mysql/src/Rules/Server/StorageOptions.php:155
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaCommit::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaCommit.php:45
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaEnd::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaEnd.php:45
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaPrepare::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaPrepare.php:44
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaRollback::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaRollback.php:44
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\XaStart::deriveStatement() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/XaStart.php:45
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\Xid::__construct() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/Xid.php:46
- method-call SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\Xid::__construct() packages/sql-semantics-mysql/src/Statement/Server/Transaction/Xa/Xid.php:47