コード例 #1
0
ファイル: PhpDumper.php プロジェクト: jimrucinski/Vine
 /**
  * {@inheritdoc}
  */
 public function createStream(array $tables = array())
 {
     if ($this->environment->isPdoEnabled()) {
         $connection = new MWP_IncrementalBackup_Database_PdoConnection($this->configuration);
     } elseif ($this->environment->isMysqliEnabled()) {
         $connection = new MWP_IncrementalBackup_Database_MysqliConnection($this->configuration);
     } elseif ($this->environment->isMysqlEnabled()) {
         $connection = new MWP_IncrementalBackup_Database_MysqlConnection($this->configuration);
     } else {
         throw new MWP_IncrementalBackup_Database_Exception_ConnectionException("No mysql drivers available.");
     }
     $this->options->setTables($tables);
     $dumper = new MWP_IncrementalBackup_Database_StreamableQuerySequenceDump($connection, $this->options);
     return $dumper->createStream();
 }
コード例 #2
0
 private function getPreferredConnection($methods)
 {
     foreach ($methods as $method) {
         try {
             if ($method == self::METHOD_PDO && $this->environment->isPdoEnabled()) {
                 $this->connection = new MWP_IncrementalBackup_Database_PdoConnection($this->configuration);
             } elseif ($method == self::METHOD_MYSQLI && $this->environment->isMysqliEnabled()) {
                 $this->connection = new MWP_IncrementalBackup_Database_MysqliConnection($this->configuration);
             } elseif ($method == self::METHOD_MYSQL && $this->environment->isMysqlEnabled()) {
                 $this->connection = new MWP_IncrementalBackup_Database_MysqlConnection($this->configuration);
             }
         } catch (Exception $e) {
         }
     }
 }