當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Connection::errorInfo方法代碼示例

本文整理匯總了PHP中Doctrine\DBAL\Connection::errorInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connection::errorInfo方法的具體用法?PHP Connection::errorInfo怎麽用?PHP Connection::errorInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\DBAL\Connection的用法示例。


在下文中一共展示了Connection::errorInfo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: connectDatabase

 private function connectDatabase(OutputInterface $output)
 {
     $param = array();
     $param['host'] = $this->dialog->ask($output, '<question>Where is your database server? [localhost]</question> ', 'localhost');
     $param['user'] = $this->dialog->ask($output, '<question>What is your database username? [root]</question> ', 'root');
     $param['password'] = $this->dialog->ask($output, '<question>What is your database password?</question> ', '');
     $param['driver'] = 'pdo_mysql';
     // Save dbName for later use to create database
     $this->dbName = $this->dialog->ask($output, '<question>What is your database name? [BungaWire]</question> ', 'BungaWire');
     $output->writeln('');
     // Write empty line for easy read
     $config = new Configuration();
     $this->dbConnection = DriverManager::getConnection($param, $config);
     $this->dbConnection->connect();
     if ($this->dbConnection->isConnected() === false) {
         $output->writeln('Database connection failed, please check your setting');
         $output->writeln('You connection configuration is:');
         $output->writeln('host: ' . $param['host']);
         $output->writeln('user: ' . $param['user']);
         $output->writeln('password: ' . $param['password']);
         $output->writeln('Database Name: ' . $param['dbname']);
         $output->writeln('Driver: ' . $param['driver']);
         $output->writeln($this->dbConnection->errorInfo());
         $output->writeln('Please try again!');
         $this->connectDatabase($output);
     } else {
         $output->writeln('Database connected!');
     }
 }
開發者ID:gusdecool,項目名稱:bunga-wire,代碼行數:29,代碼來源:InstallRun.php

示例2: __get

 /**
  * Return an object property
  *
  * @param string $strKey The property name
  *
  * @return string|null The property value
  */
 public function __get($strKey)
 {
     if ($strKey == 'error') {
         $info = $this->resConnection->errorInfo();
         return 'SQLSTATE ' . $info[0] . ': error ' . $info[1] . ': ' . $info[2];
     }
     return null;
 }
開發者ID:contao,項目名稱:core-bundle,代碼行數:15,代碼來源:Database.php

示例3: errorMsg

 /**
  * Fetch extended error information associated with the last database operation.
  *
  * @return string
  */
 public function errorMsg()
 {
     return json_encode($this->connection->errorInfo());
 }
開發者ID:sourcefabric,項目名稱:newscoop,代碼行數:9,代碼來源:AdoDbAdapter.php


注:本文中的Doctrine\DBAL\Connection::errorInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。