当前位置: 首页>>代码示例>>PHP>>正文


PHP Connection::getWrappedConnection方法代码示例

本文整理汇总了PHP中Doctrine\DBAL\Connection::getWrappedConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::getWrappedConnection方法的具体用法?PHP Connection::getWrappedConnection怎么用?PHP Connection::getWrappedConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\DBAL\Connection的用法示例。


在下文中一共展示了Connection::getWrappedConnection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getConnection

 /**
  * @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
  */
 protected final function getConnection()
 {
     if (!$this->connection) {
         if (!self::$doctrine) {
             self::$doctrine = $this->getDoctrineConnection();
             $this->setupDatabase();
         }
         $this->connection = $this->createDefaultDbConnection(self::$doctrine->getWrappedConnection(), ':memory:');
     }
     return $this->connection;
 }
开发者ID:hongshuan,项目名称:avid-candidate-challenge-busted,代码行数:14,代码来源:EdgeToEdgeTestCase.php

示例2: getConnection

 /**
  * Returns the test database connection.
  *
  * @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
  */
 protected function getConnection()
 {
     $pdo = null;
     if (!$this->conn) {
         $this->conn = (require __DIR__ . '/../config/config.php');
         $structure = Structure::createFromYaml(__DIR__ . '/../config/structure.yml');
         $this->mf = new ManagerFactory($this->conn, $structure);
         $pdo = $this->conn->getWrappedConnection();
         $pdo->query("SET foreign_key_checks = 0");
     }
     return $this->createDefaultDBConnection($pdo);
 }
开发者ID:php-go,项目名称:db-doctrine,代码行数:17,代码来源:AbstractTest.php

示例3: getConnection

 public function getConnection()
 {
     if (!Environment::hasConnection()) {
         $this->markTestSkipped('No database connection available');
     }
     if (self::$con === null) {
         self::$con = Environment::getService('connection');
     }
     if ($this->connection === null) {
         $this->connection = self::$con;
     }
     return $this->createDefaultDBConnection($this->connection->getWrappedConnection(), Environment::getService('config')->get('psx_sql_db'));
 }
开发者ID:apioo,项目名称:fusio-impl,代码行数:13,代码来源:DbTestCase.php

示例4: getAggregateHistoryFor

 public function getAggregateHistoryFor(Identity $id, $offset = 0, $max = null)
 {
     $query = "SELECT * FROM `aggregate_events` WHERE identity = :identity";
     if ($offset > 0) {
         $query .= " OFFSET {$offset}";
     }
     if (!is_null($max)) {
         $query .= " LIMIT {$max}";
     }
     $pdo = $this->conn->getWrappedConnection();
     $stmt = $pdo->prepare($query);
     $stmt->execute([':identity' => (string) $id]);
     return new CommittedEvents($id, array_map(function ($row) {
         return unserialize($row['data']);
     }, $stmt->fetchAll(\PDO::FETCH_ASSOC)));
 }
开发者ID:bashilbers,项目名称:domain,代码行数:16,代码来源:MySqlEventStore.php

示例5: unbufferConnection

 /**
  * Closes connection if open, opens a unbuffered connection.
  *
  * @param Connection $connection
  *
  * @throws InvalidArgumentException
  */
 public static function unbufferConnection(Connection $connection)
 {
     /** @var PDOConnection $wrappedConnection */
     $wrappedConnection = $connection->getWrappedConnection();
     if (!$wrappedConnection instanceof PDOConnection) {
         throw new InvalidArgumentException('unbufferConection can only be used with pdo_mysql Doctrine driver.');
     }
     if ($wrappedConnection->getAttribute(PDO::ATTR_DRIVER_NAME) != 'mysql') {
         throw new InvalidArgumentException('unbufferConection can only be used with PDO mysql driver, got "' . $wrappedConnection->getAttribute(PDO::ATTR_DRIVER_NAME) . '" instead.');
     }
     if ($connection->isConnected()) {
         $connection->close();
     }
     $connection->getWrappedConnection()->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
     $connection->connect();
 }
开发者ID:asev,项目名称:ConnectionsBundle,代码行数:23,代码来源:UnbufferedConnectionHelper.php

示例6: __construct

 /**
  * Creates a new <tt>Statement</tt> for the given SQL and <tt>Connection</tt>.
  *
  * @param string                    $sql  The SQL of the statement.
  * @param \Doctrine\DBAL\Connection $conn The connection on which the statement should be executed.
  */
 public function __construct($sql, Connection $conn)
 {
     $this->sql = $sql;
     $this->stmt = $conn->getWrappedConnection()->prepare($sql);
     $this->conn = $conn;
     $this->platform = $conn->getDatabasePlatform();
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:13,代码来源:Statement.php

示例7: getFixtureLoader

 public function getFixtureLoader()
 {
     $testerClass = '\\Jackalope\\Test\\Tester\\' . ucfirst(strtolower($this->connection->getWrappedConnection()->getAttribute(PDO::ATTR_DRIVER_NAME)));
     if (!class_exists($testerClass)) {
         // load Generic Tester if no database specific Tester class found
         $testerClass = '\\Jackalope\\Test\\Tester\\Generic';
     }
     return new $testerClass(new \PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($this->connection->getWrappedConnection(), "tests"), $this->fixturePath);
 }
开发者ID:jackalope,项目名称:jackalope-prismic,代码行数:9,代码来源:ImplementationLoader.php

示例8: createTestSchema

 /**
  * Create a simple schema the tests can run against.
  *
  * if $randomTables is true, some other tables will be created.
  *
  * @param bool $randomTables
  */
 protected function createTestSchema($randomTables = false)
 {
     $pdo = $this->connection->getWrappedConnection();
     $pdo->query('CREATE TABLE Customer (
         id INTEGER PRIMARY KEY AUTO_INCREMENT,
         name VARCHAR(10)
     )');
     $pdo->query('CREATE TABLE Billing (
         id INTEGER PRIMARY KEY AUTO_INCREMENT,
         customer_id INTEGER,
         product VARCHAR(100),
         amount REAL,
         CONSTRAINT customer_id FOREIGN KEY (customer_id) REFERENCES Customer(id)
     )');
     $pdo->query('CREATE INDEX billing_product ON Billing (product)');
     if ($randomTables) {
         $pdo->query('CREATE TABLE RandomTable (
             id INTEGER PRIMARY KEY AUTO_INCREMENT,
             name VARCHAR(10)
         )');
         $pdo->query('CREATE TABLE RandomTable2 (
             id INTEGER PRIMARY KEY AUTO_INCREMENT,
             name VARCHAR(10)
         )');
     }
     // insert data
     $pdo->query('INSERT INTO Customer VALUES (1, "Markus")');
     $pdo->query('INSERT INTO Customer VALUES (2, "Konstantin")');
     $pdo->query('INSERT INTO Customer VALUES (3, "John")');
     $pdo->query('INSERT INTO Customer VALUES (4, "Konrad")');
     $pdo->query('INSERT INTO Customer VALUES (5, "Mark")');
     $pdo->query('INSERT INTO Billing VALUES (1, 1, "IT", 42)');
     $pdo->query('INSERT INTO Billing VALUES (2, 1, NULL, 1337)');
     $pdo->query('INSERT INTO Billing VALUES (3, 2, "Some stuff", 1337)');
     $pdo->query('INSERT INTO Billing VALUES (4, 5, "Another stuff", 1337)');
     $pdo->query('INSERT INTO Billing VALUES (5, 5, "LOLj stuff", 1337)');
     if ($randomTables) {
         $pdo->query('INSERT INTO RandomTable VALUES (1, "Foo")');
         $pdo->query('INSERT INTO RandomTable VALUES (2, "Bar")');
         $pdo->query('INSERT INTO RandomTable2 VALUES (1, "FooBar")');
     }
 }
开发者ID:digilist,项目名称:snakedumper,代码行数:49,代码来源:AbstractSqlTest.php

示例9: reset

 public function reset()
 {
     if (null === $this->connection) {
         throw new RepositoryException('Do not use RepositorySchema::reset when not instantiated with a connection');
     }
     $this->connection->getWrappedConnection()->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT);
     foreach ($this->toDropSql($this->connection->getDatabasePlatform()) as $sql) {
         $this->connection->exec($sql);
     }
     $this->connection->getWrappedConnection()->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
     foreach ($this->toSql($this->connection->getDatabasePlatform()) as $sql) {
         $this->connection->exec($sql);
     }
 }
开发者ID:viral810,项目名称:ngSimpleCMS,代码行数:14,代码来源:RepositorySchema.php

示例10: __construct

 /**
  * @param FactoryInterface $factory
  * @param Connection       $conn
  */
 public function __construct(FactoryInterface $factory, Connection $conn)
 {
     $this->factory = $factory;
     $this->valueConverter = $this->factory->get('PHPCR\\Util\\ValueConverter');
     $this->conn = $conn;
     if ($conn->getDatabasePlatform() instanceof PostgreSqlPlatform) {
         $this->sequenceWorkspaceName = 'phpcr_workspaces_id_seq';
         $this->sequenceNodeName = 'phpcr_nodes_id_seq';
         $this->sequenceTypeName = 'phpcr_type_nodes_node_type_id_seq';
     }
     // @TODO: move to "SqlitePlatform" and rename to "registerExtraFunctions"?
     if ($this->conn->getDatabasePlatform() instanceof SqlitePlatform) {
         $this->registerSqliteFunctions($this->conn->getWrappedConnection());
     }
 }
开发者ID:viral810,项目名称:ngSimpleCMS,代码行数:19,代码来源:Client.php

示例11: initConnection

 /**
  * Initialize the dbal connection lazily
  */
 private function initConnection()
 {
     if (true === $this->conn->isConnected() && true === $this->connectionInitialized) {
         return;
     }
     if ($this->conn->getDatabasePlatform() instanceof PostgreSqlPlatform) {
         $this->sequenceNodeName = 'phpcr_nodes_id_seq';
         $this->sequenceTypeName = 'phpcr_type_nodes_node_type_id_seq';
     }
     // @TODO: move to "SqlitePlatform" and rename to "registerExtraFunctions"?
     if ($this->conn->getDatabasePlatform() instanceof SqlitePlatform) {
         $this->registerSqliteFunctions($this->conn->getWrappedConnection());
     }
     $this->connectionInitialized = true;
 }
开发者ID:jackalope,项目名称:jackalope-doctrine-dbal,代码行数:18,代码来源:Client.php

示例12: getServerVersion

 private function getServerVersion()
 {
     $params = $this->con->getParams();
     // Explicit platform version requested (supersedes auto-detection), so we respect it.
     if (isset($params['serverVersion'])) {
         return $params['serverVersion'];
     }
     $wrappedConnection = $this->con->getWrappedConnection();
     if ($wrappedConnection instanceof ServerInfoAwareConnection) {
         return $wrappedConnection->getServerVersion();
     }
     // Support DBAL 2.4 by accessing it directly when using PDO PgSQL
     if ($wrappedConnection instanceof \PDO) {
         return $wrappedConnection->getAttribute(\PDO::ATTR_SERVER_VERSION);
     }
     // If we cannot guess the version, the empty string will mean we won't use the code for newer versions when doing version checks.
     return '';
 }
开发者ID:ayoah,项目名称:symfony,代码行数:18,代码来源:DbalSessionHandler.php

示例13: initConnection

 /**
  * {@inheritdoc}
  * @param \Doctrine\DBAL\Connection $connection
  */
 public function initConnection(Connection $connection)
 {
     /** @var $pdo PDO */
     $pdo = $connection->getWrappedConnection();
     $this->fkSupported = version_compare('3.6.19', $pdo->getAttribute(PDO::ATTR_SERVER_VERSION)) < 0;
     $pdo->exec($this->getEnableForeignKeysSQL());
 }
开发者ID:umisoft,项目名称:umi.framework,代码行数:11,代码来源:SqliteDialect.php

示例14: getServerVersion

 /**
  * @return mixed
  */
 public function getServerVersion()
 {
     return $this->db->getWrappedConnection()->getServerVersion();
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:7,代码来源:SchemaHelper.php

示例15: handle

 public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
 {
     $this->connection->executeQuery("SELECT public.get_message_func(" . $this->connection->getWrappedConnection()->quote($this->message, \PDO::PARAM_STR) . "::text);");
 }
开发者ID:rollerworks,项目名称:RollerworksDBBundle,代码行数:4,代码来源:UserErrorExceptionTest.php


注:本文中的Doctrine\DBAL\Connection::getWrappedConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。