Sunday, November 9, 2014

Re: really verid sql thing

Using = with float is usually a very bad idea.

You can look into https://github.com/dereuromark/cakephp-geo and how it does the custom finder for this.

mark



Am Sonntag, 9. November 2014 16:39:42 UTC+1 schrieb Radharadhya Dasa:
Hi,

Today I pop into something really strange.

$this->Contacts->find()
           
->select(['id', 'name'])
           
->where([
                   
'lat' => $sameLatLng['lat'],
                   
'lng' => $sameLatLng['lng']
                   
]);

IT creates the following query: SELECT Contacts.id AS `Contacts__id`, Contacts.name AS `Contacts__name` FROM contacts Contacts WHERE (lat = 46.569206 AND lng = 17.68384)

On DebugKit at the sql log panel there is 0 at num rows colomn.

If I copy the same query and run it by phpmyadmin I got 4 entries, and this is the right result.

Everything deleted from /tmp/cache. I working on the same database.

Any idea???

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: