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


PHP RedBeanDatabase::getDatabaseInfoFromDsnString方法代码示例

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


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

示例1: testGetDatabaseInfoFromConnectionString

 public function testGetDatabaseInfoFromConnectionString()
 {
     $dsn = 'mysql:host=localhost;port=3306;dbname=zurmo';
     // Not Coding Standard
     $databaseConnectionInfo = RedBeanDatabase::getDatabaseInfoFromDsnString($dsn);
     $compareData = array('databaseType' => 'mysql', 'databaseHost' => 'localhost', 'databasePort' => '3306', 'databaseName' => 'zurmo');
     $this->assertEquals($compareData, $databaseConnectionInfo);
     $dsn = 'mysql:host=127.0.0.1;dbname=zurmo';
     // Not Coding Standard
     $databaseConnectionInfo = RedBeanDatabase::getDatabaseInfoFromDsnString($dsn);
     $compareData = array('databaseType' => 'mysql', 'databaseHost' => '127.0.0.1', 'databasePort' => '3306', 'databaseName' => 'zurmo');
     $this->assertEquals($compareData, $databaseConnectionInfo);
     $dsn = 'mysql:host=localhost;dbname=zurmo;port=3306;';
     // Not Coding Standard
     $databaseConnectionInfo = RedBeanDatabase::getDatabaseInfoFromDsnString($dsn);
     $compareData = array('databaseType' => 'mysql', 'databaseHost' => 'localhost', 'databasePort' => '3306', 'databaseName' => 'zurmo');
     $this->assertEquals($compareData, $databaseConnectionInfo);
     $dsn = 'mysql:host=localhost;';
     // Not Coding Standard
     try {
         $databaseConnectionInfo = RedBeanDatabase::getDatabaseInfoFromDsnString($dsn);
         $this->fail();
     } catch (NotSupportedException $e) {
     }
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:25,代码来源:RedBeanDatabaseTest.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     list(, $this->temporaryDatabaseHostname, $this->temporaryDatabasePort, $this->temporaryDatabaseName) = array_values(RedBeanDatabase::getDatabaseInfoFromDsnString(Yii::app()->tempDb->connectionString));
     $this->temporaryDatabaseUsername = Yii::app()->tempDb->username;
     $this->temporaryDatabasePassword = Yii::app()->tempDb->password;
     $this->superUserPassword = 'super';
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:8,代码来源:InstallUtilTest.php

示例3: __construct

 public function __construct()
 {
     parent::__construct();
     list(, $this->temporaryDatabaseHostname, $this->temporaryDatabasePort, $this->temporaryDatabaseName) = array_values(RedBeanDatabase::getDatabaseInfoFromDsnString(Yii::app()->tempDb->connectionString));
     $this->temporaryDatabaseUsername = Yii::app()->tempDb->username;
     $this->temporaryDatabasePassword = Yii::app()->tempDb->password;
     $this->superUserPassword = 'super';
     $this->databaseBackupTestFile = INSTANCE_ROOT . '/protected/runtime/databaseBackupTest.sql';
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:9,代码来源:DatabaseCommandTest.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     list(, $this->databaseHostname, $this->databasePort, $this->databaseName) = array_values(RedBeanDatabase::getDatabaseInfoFromDsnString(Yii::app()->db->connectionString));
     $this->databaseUsername = Yii::app()->db->username;
     $this->databasePassword = Yii::app()->db->password;
     $this->superUserPassword = 'super';
     $this->instanceRoot = INSTANCE_ROOT;
     $this->perInstanceFile = "{$this->instanceRoot}/protected/config/perInstanceTest.php";
     $this->debugFile = "{$this->instanceRoot}/protected/config/debugTest.php";
     if (is_file($this->perInstanceFile)) {
         $this->perInstanceConfigContents = file_get_contents($this->perInstanceFile);
         unlink($this->perInstanceFile);
     }
     if (is_file($this->debugFile)) {
         $this->debugConfigContents = file_get_contents($this->debugFile);
         unlink($this->debugFile);
     }
     Yii::app()->gameHelper->muteScoringModelsOnSave();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:20,代码来源:InstallWalkthroughTest.php

示例5: run

 /**
  * Execute the action.
  * @param array command line parameters specific for this command
  */
 public function run($args)
 {
     set_time_limit('3600');
     if (!isset($args[0])) {
         $this->usageError('You must specify an action.');
     } else {
         $action = $args[0];
     }
     if (!isset($args[1])) {
         $this->usageError('You must specify a path to the file.');
     } else {
         $filePath = $args[1];
     }
     if (count($args) != 2 && count($args) != 8) {
         $this->usageError('Invalid number of arguments.');
     }
     if (count($args) == 8) {
         $databaseType = $args[2];
         $databaseHost = $args[3];
         $databaseName = $args[4];
         $databasePort = $args[5];
         $databaseUsername = $args[6];
         $databasePassword = $args[7];
     } else {
         $databaseConnectionInfo = RedBeanDatabase::getDatabaseInfoFromDsnString(Yii::app()->db->connectionString);
         $databaseType = $databaseConnectionInfo['databaseType'];
         $databaseHost = $databaseConnectionInfo['databaseHost'];
         $databaseName = $databaseConnectionInfo['databaseName'];
         $databasePort = $databaseConnectionInfo['databasePort'];
         $databaseUsername = Yii::app()->db->username;
         $databasePassword = Yii::app()->db->password;
     }
     if (!Yii::app()->isApplicationInMaintenanceMode()) {
         $this->usageError('Please set $maintenanceMode = true in the perInstance.php config file.');
     }
     if (!function_exists('exec')) {
         $this->usageError('exec() command is not available in PHP environment.');
     }
     try {
         $template = "{message}\n";
         $messageStreamer = new MessageStreamer($template);
         $messageStreamer->setExtraRenderBytes(0);
         $messageStreamer->add(' ');
         if ($action == 'backup') {
             $this->backupDatabase($filePath, $messageStreamer, $databaseType, $databaseHost, $databaseName, $databasePort, $databaseUsername, $databasePassword);
         } elseif ($action == 'restore') {
             $this->restoreDatabase($filePath, $messageStreamer, $databaseType, $databaseHost, $databaseName, $databasePort, $databaseUsername, $databasePassword);
         } else {
             $this->usageError('Invalid action. Valid values are "backup" and "restore".');
         }
     } catch (Exception $e) {
         $messageStreamer->add(Zurmo::t('Commands', 'An error occur during database backup/restore: {message}', array('{message}' => $e->getMessage())));
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:58,代码来源:DatabaseCommand.php

示例6: checkServicesAfterInstallationAndGetResultsDataForDisplay

 public static function checkServicesAfterInstallationAndGetResultsDataForDisplay()
 {
     $servicesToCheck = self::getServicesToCheckAfterInstallation();
     $form = new InstallSettingsForm();
     list(, $form->databaseHostname, $form->databasePort, $form->databaseName) = array_values(RedBeanDatabase::getDatabaseInfoFromDsnString(Yii::app()->db->connectionString));
     $form->databaseUsername = Yii::app()->db->username;
     $form->databasePassword = Yii::app()->db->password;
     return static::processServicesAndGetResultsData($servicesToCheck, $form);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:9,代码来源:CheckServicesUtil.php

示例7: databaseSupportsLoadLocalInFile

 /**
  * Check whether db supports load local infile or not.
  * public due to usage in benchmarks
  * @return bool
  */
 public static function databaseSupportsLoadLocalInFile()
 {
     list($databaseType, $databaseHostname, $databasePort) = array_values(RedBeanDatabase::getDatabaseInfoFromDsnString(Yii::app()->db->connectionString));
     return InstallUtil::checkDatabaseLoadLocalInFile($databaseType, $databaseHostname, Yii::app()->db->username, Yii::app()->db->password, $databasePort);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:10,代码来源:ImportDatabaseUtil.php


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