vendor/davedevelopment/phpmig/src/Phpmig/Adapter/PDO/SqlPgsql.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Phpmig\Adapter\PDO;
use Phpmig\Migration\Migration,
Phpmig\Adapter\AdapterInterface,
PDO;
/**
* Simple PDO adapter to work with Postgres SQL database in particular.
* @author Theodson https://github.com/theodson
*/
class SqlPgsql extends Sql
{
private $quote = "\"";
private $schemaName = "public";
/**
* Constructor
*
* @param \PDO $connection
* @param string $tableName
*/
public function __construct(\PDO $connection, $tableName, $schemaName = 'public')
{
parent::__construct($connection, $tableName);
$driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
$this->quote = in_array($driver, array('mysql', 'pgsql')) ? '"' : '`';
$this->schemaName = $schemaName;
}
private function quotedTableName()
{
$sql = "{$this->quote}{$this->schemaName}{$this->quote}.{$this->quote}{$this->tableName}{$this->quote}";
return $sql;
}
/**
* Fetch all
*
* @return array
*/
public function fetchAll()
{
$sql = "SELECT {$this->quote}version{$this->quote} FROM {$this->quotedTableName()} ORDER BY {$this->quote}version{$this->quote} ASC";
return $this->connection->query($sql, PDO::FETCH_COLUMN, 0)->fetchAll();
}
/**
* Up
*
* @param Migration $migration
* @return self
*/
public function up(Migration $migration)
{
$sql = "INSERT into {$this->quotedTableName()} (version) VALUES (:version);";
$this->connection->prepare($sql)
->execute(array(':version' => $migration->getVersion()));
return $this;
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。