classCreateSpatialReference
final class CreateSpatialReference
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.CREATE [OR REPLACE] SPATIAL REFERENCE SYSTEM [IF NOT EXISTS] srid attribute …: a request to define a spatial reference system (MySQL 8.0 and later).
Mirrors PT_create_srs (Sql_cmd_create_srs). Rule: MYSQL-CREATE-SRS-001. The attributes are kept in written order. The problems the server reports while it parses the statement are diagnostics (MYSQL-SRS-CHECK-001). A spatial reference system is no relation, so the statement declares none. Source: https://dev.mysql.com/doc/refman/8.4/en/create-spatial-reference-system.html. Status: Implemented.
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("create or replace spatial reference system 4120 name 'Greek' organization 'EPSG' identified by 4120 definition 'GEOGCS[]'");
[$create->toString(), $create->facts->diagnostics] // => ["CREATE OR REPLACE SPATIAL REFERENCE SYSTEM 4120 NAME 'Greek' ORGANIZATION 'EPSG' IDENTIFIED BY 4120 DEFINITION 'GEOGCS[]'", []]Properties§
public list<SpatialAttribute> $attributespublic bool $orReplacepublic bool $ifNotExistspublic Numeral $sridMethods§
public function __construct(
public bool $orReplace,
public bool $ifNotExists,
public Numeral $srid,
list<SpatialAttribute> $attributes,
)Parameters
$orReplace | bool | Whether OR REPLACE is written |
$ifNotExists | bool | Whether IF NOT EXISTS is written |
$srid | Numeral | The spatial reference system identifier |
$attributes | list<SpatialAttribute> | The attributes in written order |
Throws
InvalidConstruction When OR REPLACE and IF NOT EXISTS are both writtenCalls 3
- static-call Check::input() line 49
- static-call Check::listOf() line 50
- class-const SpatialAttribute::class() line 50
public function deriveStatement(Derivation $derivation): voidReports the problems the server finds while it parses the statement.
Parameters
$derivation | Derivation |
Calls 3
- new SpatialChecks line 58
- method-call SpatialChecks::srid() line 59
- method-call SpatialChecks::attributes() line 60
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 68
- method-call Output::node() line 76
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
Relations§
Instantiated in 2
- new SqlSemantics\Platform\MySql\Lowering\Server\Instance\SpatialRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Instance/SpatialRule.php:61
- new SqlSemantics\Platform\MySql\Lowering\Server\Instance\SpatialRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Instance/SpatialRule.php:67