本文整理汇总了PHP中CDbConnection::getCommandBuilder方法的典型用法代码示例。如果您正苦于以下问题:PHP CDbConnection::getCommandBuilder方法的具体用法?PHP CDbConnection::getCommandBuilder怎么用?PHP CDbConnection::getCommandBuilder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDbConnection
的用法示例。
在下文中一共展示了CDbConnection::getCommandBuilder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeQuery
public function executeQuery(ESphinxQuery $query)
{
$cb = $this->db->getCommandBuilder();
$command = $cb->createFindCommand($query->getIndexes(), $this->createDbCriteria($query));
$meta = $this->createMeta($command);
return new ESphinxResult($meta);
}
示例2: executeQueries
/**
* Execute query collection
*
* @example
* <code>
* $queries = array(
* new ESphinxQuery("hello"),
* new ESphinxQuery("world"),
* );
* $results = $connection->executeQueries($queries);
* foreach($results as $result)
* var_dump($result); // print ESphinxResult
* </code>
* @param ESphinxQuery[] $queries
* @return ESphinxResult[]
*/
public function executeQueries(array $queries)
{
/** @var ESphinxQlCommandBuilder $cb */
$cb = $this->db->getCommandBuilder();
// prepearing
$tables = array();
$criterias = array();
foreach ($queries as $query) {
$tables[] = $query->getIndexes();
$criterias[] = $this->createDbCriteria($query);
}
// querying all queries
$command = $cb->createMultiFindCommand($tables, $criterias);
$reader = $command->query();
// processing result
$result = array();
foreach ($queries as $_query) {
$matches = $reader->readAll();
$reader->nextResult();
$metaInfo = $reader->readAll();
$reader->nextResult();
$result[] = $this->createResult($matches, $metaInfo);
}
return $result;
}