postgresql - CakePHP putting quotes around function name in WHERE clause -


I am using various functions from the earthdistance module in PostgreSQL, one of these ll_to_earth latitude Looking at the / lenght combination, I am trying to get the nearest point of my database through CakePHP 1.2.5 Fixed.

  // set dummy data $ latitude = 30.4393696; $ Longitude = -97.6200043; // Create a simple bound box in a WHERE conditions, sort points according to location and the nearest point $ location = $ this-> location-> Search ('first', array '' fields '' array ('coders', 'coders', '' earth_distance (coors, llu_t_arth ($ latitude, longitude)) es distance ",), 'conditions' = = '= & Gt; ll_to_earth (' ($ latitude - 0.5) ',' ($ longitude - 0.5). '' '' '' '' '' '' ' 'Ll_to_earth ('. ($ Latitude + 0.5). ',' ($ Longitude + 0.5). ')', 'Command' => array ('distance ASC'),));  

The SQL output (formatted for easy readings) looks like this:

  select "location". "Id" as "location__id" "Place" as "location". "Places" as "location" as "location" & gt; = 'll_to_earth (29.9393696, -97.1200043) "location" as "location", earth_distance (cors, ll_to_earth (30.4393696) , -97.6200043))) and 'COOWS' & lt; = 'Ll_to_earth (30.9393696, -96.1200043)' order bye 'distance "ASC limit1"  

You can see where my problem is: The KPPHP is referring to my search, In which the function name is ll_to_earth . Do I need to manually query the model's query method, or is there any way to tell the cake? Is that ll_to_earth is a DB function and not to be quoted?

You should be able to do this:

  $ location = $ it-> location-> ( "First", array ('fields' = & gt; array ('id', 'code', '' earth_destance '' (cosors, llo_arth ($ latitude, longitude)) "interval"), 'conditions' = & gt; Array ('Cords' = ll_to_earth ('. ($ Latitude - 0.5)', '. ($ Longitude - 0.5).') And cows  array ('distance ASC'),));  

But bypass all senitiking too Defense is doing with the cake input, so you have to take care of themselves.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -