本文整理匯總了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);
}