Skip to content

MySQL 8 SRID support #119

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

Merged
merged 28 commits into from
Apr 14, 2020
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4db0a4a
Updated Blueprint to accept srid for all geometry types
grimzy Feb 7, 2019
ccce934
Added tests for migrations. Abstracted createApplication process in i…
grimzy Feb 7, 2019
cb05acf
Added SRID to GeometryInterface and Geometry models. Updated query bu…
grimzy Feb 7, 2019
bf7888f
Fixed unit tests
grimzy Feb 8, 2019
eae31fa
Merge branch 'master' into srid
sikhlana Dec 7, 2019
0f94263
WKB parser now parses the SRID of the given WKB value.
sikhlana Dec 7, 2019
7d0578b
Fixes tests.
sikhlana Dec 7, 2019
2fbd40d
Updates dependency constraints.
sikhlana Dec 7, 2019
aa2a28a
Removes PHP 7.4 from .travis.yml
sikhlana Dec 7, 2019
81b8305
Merge branch 'srid-fix'
sikhlana Dec 7, 2019
11a6904
That was a weird condition.
sikhlana Dec 8, 2019
de5bd4d
Merge branch 'srid'
sikhlana Dec 8, 2019
c6462ff
Whops!
sikhlana Dec 8, 2019
01caece
Merge branch 'srid'
sikhlana Dec 8, 2019
e056dc3
Adds a new option to st_geomfromtext to make sure MySQL understands t…
sikhlana Dec 8, 2019
fe7d6bf
Merge branch 'srid'
sikhlana Dec 8, 2019
48c3554
Merge pull request #111 from sikhlana/srid
grimzy Feb 29, 2020
e4879ed
Apply fixes from StyleCI
grimzy Feb 29, 2020
3578a93
Fix versions after merging PR
grimzy Feb 29, 2020
aad71bf
Fixes for Laravel 5.2+/MySQL 8:
grimzy Feb 29, 2020
8fc0019
Apply fixes from StyleCI
grimzy Feb 29, 2020
b636f3c
Fixed MySqlGrammar::modifySrid()
grimzy Feb 29, 2020
db42f20
Fixed MySqlGrammar::__construct()
grimzy Feb 29, 2020
1314606
Merge remote-tracking branch 'origin/master' into srid
grimzy Mar 9, 2020
b9e6f4a
Apply fixes from StyleCI
grimzy Mar 9, 2020
eb01c85
Updated unit tests
grimzy Mar 9, 2020
9bbadd7
Updated doc :book:
grimzy Apr 14, 2020
e3bcd37
Updated links in doc :book:
grimzy Apr 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WKB parser now parses the SRID of the given WKB value.
  • Loading branch information
sikhlana committed Dec 7, 2019
commit 0f942632e4a9f2ac9dd1f0f52e48e04e292af177
15 changes: 12 additions & 3 deletions src/Types/Geometry.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,23 @@ public static function getWKTClass($value)

public static function fromWKB($wkb)
{
// mysql adds 4 NUL bytes at the start of the binary
$srid = substr($wkb, 0, 4);
$srid = unpack('L', $srid)[1];

$wkb = substr($wkb, 4);
$parser = new Parser(new Factory());

return $parser->parse($wkb);
/** @var Geometry $parsed */
$parsed = $parser->parse($wkb);

if ($srid >= 0 && $srid < 4000) {
$parsed->setSrid($srid);
}

return $parsed;
}

public static function fromWKT($wkt, $srid = 0)
public static function fromWKT($wkt, $srid = null)
{
$wktArgument = static::getWKTArgument($wkt);

Expand Down