vendor/davedevelopment/phpmig/src/Phpmig/Adapter/PDO/SqlOci.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Phpmig\Adapter\PDO;

use Phpmig\Migration\Migration,
	PDO;

/**
 * Simple PDO adapter to work with ORACLE database in particular.
 * @author omenrpg https://github.com/omenrpg
 */
class SqlOci extends Sql {

	/**
	 * Constructor
	 *
	 * @param \PDO $connection
	 * @param string $tableName
	 *
	 * @throws \Exception
	 */
	public function __construct( \PDO $connection, $tableName ) {
		parent::__construct( $connection, $tableName );
		$driver = $this->connection->getAttribute( PDO::ATTR_DRIVER_NAME );
		if ( ! in_array( $driver, array( 'oci', 'oci8' ) ) ) {
			throw new \Exception( 'Please install OCI drivers for PDO!' );
		}
	}

	/**
	 * Fetch all
	 *
	 * @return array
	 */
	public function fetchAll() {
		$sql = 'SELECT "version" FROM "' . $this->tableName . '" ORDER BY "version" 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->tableName . '" ("version") VALUES (:version)';
		$this->connection->prepare( $sql )
		                 ->execute( array(
			                 ':version'      => $migration->getVersion()
		                 ) );

		return $this;
	}

	/**
	 * Down
	 *

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。