本文整理汇总了PHP中RedBeanPHP\QueryWriter\AQueryWriter::getSQLFilters方法的典型用法代码示例。如果您正苦于以下问题:PHP AQueryWriter::getSQLFilters方法的具体用法?PHP AQueryWriter::getSQLFilters怎么用?PHP AQueryWriter::getSQLFilters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBeanPHP\QueryWriter\AQueryWriter
的用法示例。
在下文中一共展示了AQueryWriter::getSQLFilters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFunctionFilters
/**
* 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);
}