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


PHP RedBeanDatabase::databaseType方法代码示例

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


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

示例1: setup

 /**
  * Sets up the database connection.
  * @param $dsn The datasource name. See: <a href="http://nl3.php.net/manual/en/pdo.construct.php">http://nl3.php.net/manual/en/pdo.construct.php</a>
  * @code
  *   "sqlite:database.txt"
  *   "mysql:host=localhost;dbname=oodb"
  *   "pgsql:host=localhost;dbname=oodb"
  * @endcode
  * @param $username The database user's login username.
  * @param $password The database user's login password.
  */
 public static function setup($dsn, $username, $password)
 {
     assert('is_string($dsn) && $dsn != ""');
     assert('$username == null || is_string($username) && $username != ""');
     assert('$password == null || is_string($password)');
     assert('!self::isSetup()');
     try {
         ZurmoRedBean::setup($dsn, $username, $password);
         static::freeze();
         if (SHOW_QUERY_DATA) {
             Yii::app()->performance->setRedBeanQueryLogger(ZurmoRedBeanPluginQueryLogger::getInstanceAndAttach(ZurmoRedBean::$adapter));
         }
         if (defined('REDBEAN_DEBUG_TO_FILE') && REDBEAN_DEBUG_TO_FILE) {
             $queryLoggerComponent = Yii::createComponent(array('class' => 'application.core.models.ZurmoRedBeanQueryFileLogger'));
             $queryLoggerComponent->init();
             Yii::app()->setComponent('queryFileLogger', $queryLoggerComponent);
             ZurmoRedBean::debug(true, Yii::app()->queryFileLogger);
         } else {
             ZurmoRedBean::debug(defined('REDBEAN_DEBUG') && REDBEAN_DEBUG);
         }
         self::$isSetup = true;
         self::$databaseType = substr($dsn, 0, strpos($dsn, ':'));
     } catch (Exception $e) {
         self::close();
         throw $e;
     }
     assert('static::isSetup()');
     assert('RedBeanDatabase::isFrozen()');
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:40,代码来源:RedBeanDatabase.php

示例2: setup

 /**
  * Sets up the database connection.
  * @param $dsn The datasource name. See: <a href="http://nl3.php.net/manual/en/pdo.construct.php">http://nl3.php.net/manual/en/pdo.construct.php</a>
  * @code
  *   "sqlite:database.txt"
  *   "mysql:host=localhost;dbname=oodb"
  *   "pgsql:host=localhost;dbname=oodb"
  * @endcode
  * @param $username The database user's login username.
  * @param $password The database user's login password.
  */
 public static function setup($dsn, $username, $password)
 {
     assert('is_string($dsn) && $dsn != ""');
     assert('$username == null || is_string($username) && $username != ""');
     assert('$password == null || is_string($password)');
     assert('!self::isSetup()');
     try {
         R::setup($dsn, $username, $password);
         R::$redbean->addEventListener("update", new RedBeanBeforeUpdateHintManager(R::$toolbox));
         if (SHOW_QUERY_DATA) {
             Yii::app()->performance->setRedBeanQueryLogger(ZurmoRedBeanPluginQueryLogger::getInstanceAndAttach(R::$adapter));
         }
         $debug = defined('REDBEAN_DEBUG') && REDBEAN_DEBUG;
         R::debug($debug);
         self::$isSetup = true;
         self::$databaseType = substr($dsn, 0, strpos($dsn, ':'));
     } catch (Exception $e) {
         self::close();
         throw $e;
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:32,代码来源:RedBeanDatabase.php


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