本文整理汇总了PHP中Query::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Query::execute方法的具体用法?PHP Query::execute怎么用?PHP Query::execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query::execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProfile
/**
* Get user profile
*
* @access public
* @param resource $ldap
* @param string $baseDn
* @param string $query
* @return array
*/
public function getProfile($ldap, $baseDn, $query)
{
$this->query->execute($ldap, $baseDn, $query, $this->getAttributes());
$profile = array();
if ($this->query->hasResult()) {
$profile = $this->prepareProfile();
}
return $profile;
}
示例2: testExecuteQueryFailed
public function testExecuteQueryFailed()
{
self::$functions->expects($this->once())->method('ldap_search')->with($this->equalTo('my_ldap_resource'), $this->equalTo('ou=People,dc=kanboard,dc=local'), $this->equalTo('uid=my_user'), $this->equalTo(array('displayname')))->will($this->returnValue(false));
$query = new Query();
$query->execute('my_ldap_resource', 'ou=People,dc=kanboard,dc=local', 'uid=my_user', array('displayname'));
$this->assertFalse($query->hasResult());
}
示例3: toArray
public function toArray()
{
$data = $this->_cache->getData();
// print_r($data);
if (empty($data))
{
$query = new Query($this->_callChain);
try
{
$data = $query->execute();
if (! empty($data))
{
$this->_cache->populate($data[0]);
}
$data = $this->_cache->getData();
}
catch (Exception $e)
{
throw $e;
}
}
return $data;
}
示例4: Query
/**
* Gets a Role object
*
* @param id the Role Id
* @return the Role object
*/
function &get($id)
{
$query = new Query("Role");
$criteria = new Criteria($query, "ID", $id);
$query->setCriterion($criteria);
return $this->mapOne($query->execute());
}
示例5: execute
public function execute(array $parameters = array(), array $options = array())
{
if ($stmt = parent::execute($parameters, $options)) {
return $stmt->rowCount();
}
return $stmt;
}
示例6: Query
/**
* Gets RoleUser objects by a roleId
*
* @param $roleId role id looked up
* @return Array - array with RoleUser objects
*/
function &findByRoleId($roleId)
{
$query = new Query("RoleUser");
$criteria = new Criteria($query, "roleID", $roleId);
$query->setCriterion($criteria);
return $this->mapAll($query->execute());
}
示例7: Query
/**
* Gets the classes whose objects the user can execute certain action
*
* @param $action object - The action that the user should be allowed to do
* @param $user User - The user that holds de permissions
* @return Array - an array of class objects
*/
function &findByPermission($action, $user)
{
$classQuery = new Query("Class");
// Navigate relationships
$folderClassQuery =& $classQuery->queryRelationedClass("FolderClass");
$permissionQuery =& $folderClassQuery->queryRelationedClass("Permission");
$actionQuery =& $permissionQuery->queryRelationedClass("Action", Relationship::ManyToOneType());
$roleQuery =& $permissionQuery->queryRelationedClass("Role", Relationship::ManyToOneType());
$roleUserQuery =& $roleQuery->queryRelationedClass("RoleUser");
$userQuery =& $roleUserQuery->queryRelationedClass("User", Relationship::ManyToOneType());
// Criterias
$criteriaGroup = new CriteriaGroup();
$actionCriteria = new Criteria($actionQuery, "action", $action->getAction());
$userCriteria = new Criteria($userQuery, "ID", $user->getId());
$criteriaGroup->addCriterion($actionCriteria);
$criteriaGroup->addCriterion($userCriteria);
$classQuery->setCriterion($criteriaGroup);
// sorting
$order = new Order($classQuery, "title", "ASC");
$classQuery->addOrder($order);
// Execute the query
$recordset =& $classQuery->execute();
$array = $this->mapAll($recordset);
return $array;
}
示例8: findByFolderClassId
/**
* Gets a list with permissions for a folderClass object
* @param $folderClassId FolderClass - the folderClass object
* @return Array with permission objects
*/
function findByFolderClassId($folderClassId)
{
$query = new Query("Permission");
$criteria = new Criteria($query, "folderClassID", $folderClassId);
$query->setCriterion($criteria);
return $this->mapAll($query->execute());
}
示例9: findByClassId
/**
* Gets a class' attributes
*
* @param classId id of a class
* @return array of class objects
*/
function findByClassId($classId)
{
$query = new Query("ClassAttribute");
$criteria = new Criteria($query, "classID", $classId);
$query->setCriterion($criteria);
$order = new Order($query, "position", Order::OrderTypeAsc());
$query->addOrder($order);
return $this->mapAll($query->execute());
}
示例10: testBadData
public function testBadData()
{
$path = __DIR__ . '/fixtures/datastore/querytest';
$config = new Config($path . '/');
$repo = new Repository('baddata', $config);
$query = new Query($repo);
$result = $query->execute();
$this->assertEquals(1, count($result));
}
示例11: loadModels
/**
* Load the next round of models.
*/
private function loadModels()
{
$start = $this->rangeStart($this->pointer, $this->limit);
if ($this->loadedStart !== $start) {
$this->query->start($start);
$this->models = $this->query->execute();
$this->loadedStart = $start;
}
}
示例12: execute
/**
* Execution method
* Bypasses constructor subject if value provided
* @param mixed $value
* @return array
*/
public function execute($value = null)
{
if (is_null($value)) {
if (empty($this->subject)) {
return $value;
}
$value = $this->subject;
}
return parent::execute($value);
}
示例13: count
public function count()
{
$this->count = true;
if ($count = $this->getDataCache()) {
return $count;
}
$count = parent::execute()->count();
$this->setDataCache($count);
return $count;
}
示例14: execute
/**
* Checks the cache to see if this query exists and returns it. If it's
* not in the cache then the query is run, stored and then returned.
*
* @return Result The result of the query.
*/
public function execute()
{
// Generate a cache key by comparing our parameters to see if we've
// made this query before
$key = $this->getParameterHash() . $this->getFileHash();
// Try and fetch a cached result object from APC
$result = apc_fetch($key, $success);
// If the result isn't in the cache then we run the real query
if (!$success) {
$result = parent::execute();
apc_store($key, $result);
}
return $result;
}
示例15: isPlay
function isPlay($idJoueur, $idTournoi, $database)
{
$sql_func = 'SELECT * FROM joueurtournoi WHERE id_joueur = :id_joueur AND id_tournoi = :id_tournoi';
$query_func = new Query($database, $sql_func);
$query_func->bind(':id_joueur', $idJoueur, PDO::PARAM_INT);
$query_func->bind(':id_tournoi', $idTournoi, PDO::PARAM_INT);
if ($query_func->execute()) {
$jeux = $query_func->getResult();
}
if (empty($jeux)) {
//ne joue pas a ce jeux
return 0;
} else {
//joue a ce jeux
return 1;
}
}