Issues

ZF-8735: Unable to save a mysql spatial value in a Zend_Db_Table_Row_Abstract

Issue Type: Improvement Created: 2010-01-07T02:35:32.000+0000 Last Updated: 2010-01-08T09:50:56.000+0000 Status: Resolved Fix version(s): Reporter: Romain Lalaut (roro) Assignee: None Tags: - Zend_Db_Table

Related issues: Attachments:

Description

I use a mysql spatial column (POINT) with a spatial index on it. This kind of index doesn't allow a default value nor a NULL value. That's why we have to set it when we insert a row.

Problem : the value is binary and all the ways I tried were leading to this error : SQLSTATE[22003]: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field

I tried :

<pre class="highlight">
// $row is an instance of Zend_Db_Table_Row
$row->point = 0;
$row->save();



<pre class="highlight">
$row->point = "\0";
$row->save();



<pre class="highlight">
$row->point = NULL;
$row->save();



<pre class="highlight">
$row->point = 0x00000000010100000000000000000000000000000000000000; // The hexa of POINT(0,0)
$row->save();



<pre class="highlight">
$row->point = "0x00000000010100000000000000000000000000000000000000"; // The hexa of POINT(0,0)
$row->save();



<pre class="highlight">
$row->point = "PointFromWKB(Point(0, 0)"; 
$row->save();

Comments

Posted by Ralph Schindler (ralph) on 2010-01-08T09:50:55.000+0000

Try this:

<pre class="highlight">
$row->point = new Zend_Db_Expr("PointFromWKB(Point(0, 0)"); 
$row->save();

If using Zend_Db_Expr doesn't work for force non-quoted values, please reopen.

-ralph

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts