本文整理汇总了PHP中Nette\Database\Connection::getAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::getAttribute方法的具体用法?PHP Connection::getAttribute怎么用?PHP Connection::getAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Database\Connection
的用法示例。
在下文中一共展示了Connection::getAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: topString
protected function topString()
{
if ($this->limit !== NULL && $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME) === 'dblib') {
return " TOP ($this->limit)"; //! offset is not supported
}
return '';
}
示例2: __construct
public function __construct($tableName, Connection $connection, IReflection $reflection)
{
$this->tableName = $tableName;
$this->databaseReflection = $reflection;
$this->driver = $connection->getSupplementalDriver();
$this->driverName = $connection->getAttribute(\PDO::ATTR_DRIVER_NAME);
$this->delimitedTable = $this->tryDelimite($tableName);
}
示例3: buildTopClause
protected function buildTopClause()
{
if ($this->limit !== NULL && $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME) === 'dblib') {
return " TOP ({$this->limit})";
//! offset is not supported
}
return '';
}
示例4: addWhere
public function addWhere($condition, $parameters = array())
{
$args = func_get_args();
$hash = md5(json_encode($args));
if (isset($this->conditions[$hash])) {
return false;
}
$this->conditions[$hash] = $condition;
$condition = $this->removeExtraTables($condition);
$condition = $this->tryDelimite($condition);
if (count($args) !== 2 || strpbrk($condition, '?:')) {
// where('column < ? OR column > ?', array(1, 2))
if (count($args) !== 2 || !is_array($parameters)) {
// where('column < ? OR column > ?', 1, 2)
$parameters = $args;
array_shift($parameters);
}
$this->parameters = array_merge($this->parameters, $parameters);
} elseif ($parameters === null) {
// where('column', NULL)
$condition .= ' IS NULL';
} elseif ($parameters instanceof Selection) {
// where('column', $db->$table())
$clone = clone $parameters;
if (!$clone->getSqlBuilder()->select) {
$clone->select($clone->primary);
}
if ($this->connection->getAttribute(PDO::ATTR_DRIVER_NAME) !== 'mysql') {
$condition .= ' IN (' . $clone->getSql() . ')';
} else {
$in = array();
foreach ($clone as $row) {
$this->parameters[] = array_values(iterator_to_array($row));
$in[] = count($row) === 1 ? '?' : '(?)';
}
$condition .= ' IN (' . ($in ? implode(', ', $in) : 'NULL') . ')';
}
} elseif (!is_array($parameters)) {
// where('column', 'x')
$condition .= ' = ?';
$this->parameters[] = $parameters;
} else {
// where('column', array(1, 2))
if ($parameters) {
$condition .= " IN (?)";
$this->parameters[] = $parameters;
} else {
$condition .= " IN (NULL)";
}
}
$this->where[] = $condition;
return true;
}