Welcome Guest, Not a member yet? Register   Sign In
ActiveRecord Where is adding "is null" when I don't want it to
#1

[eluser]Unknown[/eluser]
Hello!

I'm stumped and would greatly appreciate help.

I'm trying to get Active Record to produce this:
Code:
WHERE MBRContains(GeomFromText('POLYGON((32.653132834095 -117.40548330929, 32.653132834095 -117.06151669071, 32.942267165905 -117.06151669071,32.942267165905 -117.40548330929,32.653132834095 -117.40548330929))'),geoPoint)

But when I do this:
Code:
$this->db->where("MBRContains(GeomFromText('POLYGON((32.653132834095 -117.40548330929, 32.653132834095 -117.06151669071, 32.942267165905 -117.06151669071,32.942267165905 -117.40548330929,32.653132834095 -117.40548330929))'),geoPoint)");
#$this->db->where("MBRContains(GeomFromText('POLYGON((32.653132834095 -117.40548330929, 32.653132834095 -117.06151669071, 32.942267165905 -117.06151669071,32.942267165905 -117.40548330929,32.653132834095 -117.40548330929))'),geoPoint)",null,false);//I have also tried this version.

it always tacks on "is null" like this:
Code:
WHERE MBRContains(GeomFromText('POLYGON((32.653132834095 -117.40548330929, 32.653132834095 -117.06151669071, 32.942267165905 -117.06151669071,32.942267165905 -117.40548330929,32.653132834095 -117.40548330929))'),geoPoint) IS NULL

I've tried using the "3rd parameter" mentioned here: http://ellislab.com/codeigniter/user-gui...tml#select

I can't seem to get this to work.

Ideas?

Thanks!
Ryan

P.S. After using CI for the past 10 months, I'm starting to feel similarly to this guy about how painful ActiveRecord is sometimes: http://ellislab.com/forums/viewthread/164792/#793124
#2

[eluser]Unknown[/eluser]
Also, I can't just equate the MBRContains() to 1 or TRUE. That would work (I'd get the proper results, I think), but it would be slow because that seems to prevent MySQL from using the spatial index (on geoPoint) on the table, according to the EXPLAIN query. For some reason, geoPoint's spatial index works only when the MBRContains() stands alone and isn't equated to 1 or TRUE.




Theme © iAndrew 2016 - Forum software by © MyBB