This method returns the raw SQL filter array.
This is a lowlevel method. For a more friendly method
please take a look at the facade: R::bindFunc().
public static getSQLFilters ( ) : array | ||
return | array |
/** * Test Facade bind function method. * Test for MySQL WKT spatial format. */ public function testFunctionFilters() { R::nuke(); R::bindFunc('read', 'location.point', 'asText'); R::bindFunc('write', 'location.point', 'GeomFromText'); R::store(R::dispense('location')); R::freeze(true); try { R::find('location'); fail(); } catch (SQL $exception) { pass(); } R::freeze(false); try { R::find('location'); pass(); } catch (SQL $exception) { fail(); } $location = R::dispense('location'); $location->point = 'POINT(14 6)'; R::store($location); $columns = R::inspect('location'); asrt($columns['point'], 'point'); $location = $location->fresh(); asrt($location->point, 'POINT(14 6)'); R::nuke(); $location = R::dispense('location'); $location->point = 'LINESTRING(0 0,1 1,2 2)'; R::store($location); $columns = R::inspect('location'); asrt($columns['point'], 'linestring'); $location->bustcache = 2; R::store($location); $location = $location->fresh(); asrt($location->point, 'LINESTRING(0 0,1 1,2 2)'); R::nuke(); $location = R::dispense('location'); $location->point = 'POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7,5 5))'; R::store($location); $columns = R::inspect('location'); asrt($columns['point'], 'polygon'); $location->bustcache = 4; R::store($location); $location = $location->fresh(); asrt($location->point, 'POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7,5 5))'); R::bindFunc('read', 'location.point', NULL); $location->bustcache = 1; R::store($location); $location = $location->fresh(); asrt($location->point === 'POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7,5 5))', FALSE); $filters = AQueryWriter::getSQLFilters(); asrt(is_array($filters), TRUE); asrt(count($filters), 2); asrt(isset($filters[QueryWriter::C_SQLFILTER_READ]), TRUE); asrt(isset($filters[QueryWriter::C_SQLFILTER_WRITE]), TRUE); R::bindFunc('read', 'place.point', 'asText'); R::bindFunc('write', 'place.point', 'GeomFromText'); R::bindFunc('read', 'place.line', 'asText'); R::bindFunc('write', 'place.line', 'GeomFromText'); R::nuke(); $place = R::dispense('place'); $place->point = 'POINT(13.2 666.6)'; $place->line = 'LINESTRING(9.2 0,3 1.33)'; R::store($place); $columns = R::inspect('place'); asrt($columns['point'], 'point'); asrt($columns['line'], 'linestring'); $place = R::findOne('place'); asrt($place->point, 'POINT(13.2 666.6)'); asrt($place->line, 'LINESTRING(9.2 0,3 1.33)'); R::bindFunc('read', 'place.point', NULL); R::bindFunc('write', 'place.point', NULL); R::bindFunc('read', 'place.line', NULL); R::bindFunc('write', 'place.line', NULL); }