本文整理汇总了PHP中Zend\Db\Adapter\ParameterContainer::merge方法的典型用法代码示例。如果您正苦于以下问题:PHP ParameterContainer::merge方法的具体用法?PHP ParameterContainer::merge怎么用?PHP ParameterContainer::merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Db\Adapter\ParameterContainer
的用法示例。
在下文中一共展示了ParameterContainer::merge方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processHaving
protected function processHaving(PlatformInterface $platform, Adapter $adapter = null, ParameterContainer $parameterContainer = null)
{
if ($this->having->count() == 0) {
return null;
}
$whereParts = $this->processExpression($this->having, $platform, $adapter, $this->processInfo['paramPrefix'] . 'having');
if ($parameterContainer) {
$parameterContainer->merge($whereParts->getParameterContainer());
}
return array($whereParts->getSql());
}
示例2: processSubSelect
protected function processSubSelect(Select $subselect, PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
{
if ($driver) {
$stmtContainer = new StatementContainer();
// Track subselect prefix and count for parameters
$this->processInfo['subselectCount']++;
$subselect->processInfo['subselectCount'] = $this->processInfo['subselectCount'];
$subselect->processInfo['paramPrefix'] = 'subselect' . $subselect->processInfo['subselectCount'];
// call subselect
$subselect->prepareStatement(new \Zend\Db\Adapter\Adapter($driver, $platform), $stmtContainer);
// copy count
$this->processInfo['subselectCount'] = $subselect->processInfo['subselectCount'];
$parameterContainer->merge($stmtContainer->getParameterContainer()->getNamedArray());
$sql = $stmtContainer->getSql();
} else {
$sql = $subselect->getSqlString($platform);
}
return $sql;
}
示例3: processOrder
protected function processOrder(PlatformInterface $platform, Adapter $adapter = null, ParameterContainer $parameterContainer = null)
{
if (empty($this->order)) {
return null;
}
$orders = array();
foreach ($this->order as $k => $v) {
if ($v instanceof Expression) {
/** @var $orderParts \Zend\Db\Adapter\StatementContainer */
$orderParts = $this->processExpression($v, $platform, $adapter);
if ($parameterContainer) {
$parameterContainer->merge($orderParts->getParameterContainer());
}
$orders[] = array($orderParts->getSql());
continue;
}
if (is_int($k)) {
if (strpos($v, ' ') !== false) {
list($k, $v) = preg_split('# #', $v, 2);
} else {
$k = $v;
$v = self::ORDER_ASCENDING;
}
}
if (strtoupper($v) == self::ORDER_DESCENDING) {
$orders[] = array($platform->quoteIdentifierInFragment($k), self::ORDER_DESCENDING);
} else {
$orders[] = array($platform->quoteIdentifierInFragment($k), self::ORDER_ASCENDING);
}
}
return array($orders);
}
示例4: processHaving
protected function processHaving(PlatformInterface $platform, Adapter $adapter = null, ParameterContainer $parameterContainer = null)
{
if ($this->having->count() == 0) {
return null;
}
$whereParts = $this->processExpression($this->having, $platform, $adapter ? $adapter->getDriver() : null, 'having');
if (count($whereParts['parameters']) > 0) {
$parameterContainer->merge($whereParts['parameters']);
}
return array($whereParts['sql']);
}
示例5: processJoins
protected function processJoins(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
{
if (!$this->joins) {
return null;
}
// process joins
$joinSpecArgArray = array();
foreach ($this->joins as $j => $join) {
$joinSpecArgArray[$j] = array();
// type
$joinSpecArgArray[$j][] = strtoupper($join['type']);
// table name
$joinSpecArgArray[$j][] = is_array($join['name']) ? $platform->quoteIdentifier(current($join['name'])) . ' ' . $platform->quoteIdentifier(key($join['name'])) : $platform->quoteIdentifier($join['name']);
// on expression
$joinSpecArgArray[$j][] = $join['on'] instanceof ExpressionInterface ? $this->processExpression($join['on'], $platform, $driver, $this->processInfo['paramPrefix'] . 'join') : $platform->quoteIdentifierInFragment($join['on'], array('=', 'AND', 'OR', '(', ')', 'BETWEEN'));
// on
if ($joinSpecArgArray[$j][2] instanceof StatementContainerInterface) {
if ($parameterContainer) {
$parameterContainer->merge($joinSpecArgArray[$j][2]->getParameterContainer());
}
$joinSpecArgArray[$j][2] = $joinSpecArgArray[$j][2]->getSql();
}
}
return array($joinSpecArgArray);
}
示例6: processOption
protected function processOption(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
{
if (empty($this->option)) {
return null;
}
// process options
$options = array();
foreach ($this->option as $optName => $optValue) {
$optionSql = '';
if ($optValue instanceof Expression) {
$parameterPrefix = $this->processInfo['paramPrefix'] . 'option';
$optionParts = $this->processExpression($optValue, $platform, $driver, $parameterPrefix);
if ($parameterContainer) {
$parameterContainer->merge($optionParts->getParameterContainer());
}
$optionSql .= $optionParts->getSql();
} else {
if ($driver && $parameterContainer) {
$parameterContainer->offsetSet('option_' . $optName, $optValue);
$optionSql .= $driver->formatParameterName('option_' . $optName);
} else {
$optionSql .= $platform->quoteValue($optValue);
}
}
$options[] = array($platform->quoteIdentifier($optName), $optionSql);
}
return array($options);
}
示例7: processSubSelect
protected function processSubSelect(Select $subselect, PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
{
if ($driver) {
$stmtContainer = new StatementContainer();
// Track subselect prefix and count for parameters
$this->processInfo['subselectCount']++;
$subselect->processInfo['subselectCount'] = $this->processInfo['subselectCount'];
$subselect->processInfo['paramPrefix'] = 'subselect' . $subselect->processInfo['subselectCount'];
// call subselect
if ($this instanceof PlatformDecoratorInterface) {
/** @var Select|PlatformDecoratorInterface $subselectDecorator */
$subselectDecorator = clone $this;
$subselectDecorator->setSubject($subselect);
$subselectDecorator->prepareStatement(new Adapter($driver, $platform), $stmtContainer);
} else {
$subselect->prepareStatement(new Adapter($driver, $platform), $stmtContainer);
}
// copy count
$this->processInfo['subselectCount'] = $subselect->processInfo['subselectCount'];
$parameterContainer->merge($stmtContainer->getParameterContainer()->getNamedArray());
$sql = $stmtContainer->getSql();
} else {
if ($this instanceof PlatformDecoratorInterface) {
$subselectDecorator = clone $this;
$subselectDecorator->setSubject($subselect);
$sql = $subselectDecorator->getSqlString($platform);
} else {
$sql = $subselect->getSqlString($platform);
}
}
return $sql;
}