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


PHP Connection::__construct方法代码示例

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


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

示例1: __construct

 /**
  * Constructs a \Drupal\Core\Database\Driver\sqlite\Connection object.
  */
 public function __construct(\PDO $connection, array $connection_options)
 {
     parent::__construct($connection, $connection_options);
     // We don't need a specific PDOStatement class here, we simulate it below.
     $this->statementClass = NULL;
     // This driver defaults to transaction support, except if explicitly passed FALSE.
     $this->transactionSupport = $this->transactionalDDLSupport = !isset($connection_options['transactions']) || $connection_options['transactions'] !== FALSE;
     $this->connectionOptions = $connection_options;
     // Attach one database for each registered prefix.
     $prefixes = $this->prefixes;
     foreach ($prefixes as &$prefix) {
         // Empty prefix means query the main database -- no need to attach anything.
         if (!empty($prefix)) {
             // Only attach the database once.
             if (!isset($this->attachedDatabases[$prefix])) {
                 $this->attachedDatabases[$prefix] = $prefix;
                 $this->query('ATTACH DATABASE :database AS :prefix', array(':database' => $connection_options['database'] . '-' . $prefix, ':prefix' => $prefix));
             }
             // Add a ., so queries become prefix.table, which is proper syntax for
             // querying an attached database.
             $prefix .= '.';
         }
     }
     // Regenerate the prefixes replacement table.
     $this->setPrefix($prefixes);
     // Detect support for SAVEPOINT.
     $version = $this->query('SELECT sqlite_version()')->fetchField();
     $this->savepointSupport = version_compare($version, '3.6.8') >= 0;
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:32,代码来源:Connection.php

示例2: __construct

 /**
  * Constructs a \Drupal\Core\Database\Driver\sqlite\Connection object.
  */
 public function __construct(\PDO $connection, array $connection_options)
 {
     // We don't need a specific PDOStatement class here, we simulate it in
     // static::prepare().
     $this->statementClass = NULL;
     parent::__construct($connection, $connection_options);
     // This driver defaults to transaction support, except if explicitly passed FALSE.
     $this->transactionSupport = $this->transactionalDDLSupport = !isset($connection_options['transactions']) || $connection_options['transactions'] !== FALSE;
     $this->connectionOptions = $connection_options;
     // Attach one database for each registered prefix.
     $prefixes = $this->prefixes;
     foreach ($prefixes as &$prefix) {
         // Empty prefix means query the main database -- no need to attach anything.
         if (!empty($prefix)) {
             // Only attach the database once.
             if (!isset($this->attachedDatabases[$prefix])) {
                 $this->attachedDatabases[$prefix] = $prefix;
                 if ($connection_options['database'] === ':memory:') {
                     // In memory database use ':memory:' as database name. According to
                     // http://www.sqlite.org/inmemorydb.html it will open a unique
                     // database so attaching it twice is not a problem.
                     $this->query('ATTACH DATABASE :database AS :prefix', array(':database' => $connection_options['database'], ':prefix' => $prefix));
                 } else {
                     $this->query('ATTACH DATABASE :database AS :prefix', array(':database' => $connection_options['database'] . '-' . $prefix, ':prefix' => $prefix));
                 }
             }
             // Add a ., so queries become prefix.table, which is proper syntax for
             // querying an attached database.
             $prefix .= '.';
         }
     }
     // Regenerate the prefixes replacement table.
     $this->setPrefix($prefixes);
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:37,代码来源:Connection.php

示例3: __construct

 /**
  * Constructs a Connection object.
  */
 public function __construct(\PDO $connection, array $connection_options = array())
 {
     parent::__construct($connection, $connection_options);
     // This driver defaults to transaction support, except if explicitly passed FALSE.
     $this->transactionSupport = !isset($connection_options['transactions']) || $connection_options['transactions'] !== FALSE;
     // MySQL never supports transactional DDL.
     $this->transactionalDDLSupport = FALSE;
     $this->connectionOptions = $connection_options;
 }
开发者ID:penguinclub,项目名称:penguinweb_drupal8,代码行数:12,代码来源:Connection.php

示例4: __construct

 /**
  * Constructs a connection object.
  */
 public function __construct(\PDO $connection, array $connection_options)
 {
     parent::__construct($connection, $connection_options);
     // This driver defaults to transaction support, except if explicitly passed FALSE.
     $this->transactionSupport = !isset($connection_options['transactions']) || $connection_options['transactions'] !== FALSE;
     // Transactional DDL is always available in PostgreSQL,
     // but we'll only enable it if standard transactions are.
     $this->transactionalDDLSupport = $this->transactionSupport;
     $this->connectionOptions = $connection_options;
     // Force PostgreSQL to use the UTF-8 character set by default.
     $this->connection->exec("SET NAMES 'UTF8'");
     // Execute PostgreSQL init_commands.
     if (isset($connection_options['init_commands'])) {
         $this->connection->exec(implode('; ', $connection_options['init_commands']));
     }
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:19,代码来源:Connection.php

示例5: __construct

  /**
   * Constructs a Connection object.
   */
  public function __construct(\PDO $connection, array $connection_options) {
    // Needs to happen before parent construct.
    $this->statementClass = Statement::class;
    
    parent::__construct($connection, $connection_options);  
    
    // This driver defaults to transaction support, except if explicitly passed FALSE.
    $this->transactionSupport = !isset($connection_options['transactions']) || $connection_options['transactions'] !== FALSE;
    $this->transactionalDDLSupport = $this->transactionSupport;

    // Store connection options for future reference.
    $this->connectionOptions = &$connection_options;
    
    // Fetch the name of the user-bound schema. It is the schema that SQL Server
    // will use for non-qualified tables.
    $this->schema()->defaultSchema = $this->schema()->GetDefaultSchema();

    // Set default direct query behaviour
    $this->directQuery = TRUE;//DatabaseUtils::GetConfigBoolean('MSSQL_DEFAULT_DIRECTQUERY');
    $this->statementCaching = DatabaseUtils::GetConfigBoolean('MSSQL_STATEMENT_CACHING');
  }
开发者ID:HamzaBendidane,项目名称:prel,代码行数:24,代码来源:Connection.php


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