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


PHP jDb::getProfile方法代碼示例

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


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

示例1: execSQLScript

 /**
  * import a sql script into the given profile.
  *
  * The name of the script should be store in install/sql/$name.databasetype.sql
  * in the directory of the component. (replace databasetype by mysql, pgsql etc.)
  * 
  * @param string $name the name of the script, without suffixes
  */
 public function execSQLScript($name, $profile = '')
 {
     $tools = jDb::getTools($profile);
     $p = jDb::getProfile($profile);
     $driver = $p['driver'];
     if ($driver == 'pdo') {
         preg_match('/^(\\w+)\\:.*$/', $p['dsn'], $m);
         $driver = $m[1];
     }
     $tools->execSQLScript($this->path . 'install/sql/' . $name . '.' . $driver . '.sql');
 }
開發者ID:alienpham,項目名稱:helenekling,代碼行數:19,代碼來源:jInstallerBase.class.php

示例2: getProfile

 /**
  * return the profile name used for jacl connection
  * @return string profile name
  */
 public static function getProfile()
 {
     static $profile = '';
     if ($profile == '') {
         try {
             $prof = jDb::getProfile('jacl_profile', true);
         } catch (Exception $e) {
             $prof = jDb::getProfile();
         }
         $profile = $prof['name'];
     }
     return $profile;
 }
開發者ID:alienpham,項目名稱:helenekling,代碼行數:17,代碼來源:jAcl2Db.class.php

示例3: __construct

 function __construct($sel, $driver, $isprofile = true)
 {
     if ($isprofile) {
         $p = jDb::getProfile($driver);
         if ($p['driver'] == 'pdo') {
             $this->driver = substr($p['dsn'], 0, strpos($p['dsn'], ':'));
         } else {
             $this->driver = $p['driver'];
         }
     } else {
         $this->driver = $driver;
     }
     $this->_compiler = 'jDaoCompiler';
     $this->_compilerPath = JELIX_LIB_PATH . 'dao/jDaoCompiler.class.php';
     parent::__construct($sel);
 }
開發者ID:alienpham,項目名稱:helenekling,代碼行數:16,代碼來源:jSelectorDao.class.php

示例4: dbSize

 /**
  * Size of the database
  * @return array the total size and record of the database
  */
 public static function dbSize()
 {
     $profile = jDb::getProfile();
     $con = jDb::getConnection();
     $totalRecords = $totalSize = 0;
     if ($profile['driver'] == 'mysql' or $profile['driver'] == 'mysqli') {
         $results = $con->query('SHOW TABLE STATUS FROM `' . $profile['database'] . '`');
         foreach ($results as $status) {
             $totalRecords += $status->Rows;
             $totalSize += $status->Data_length + $status->Index_length;
         }
         $totalSize = $totalSize / 1024;
         if ($totalSize > 1024) {
             $totalSize = round($totalSize / 1024, 2) . ' MB';
         } else {
             $totalSize = round($totalSize, 2) . ' KB';
         }
     }
     return array($totalRecords, $totalSize);
 }
開發者ID:havefnubb,項目名稱:havefnubb,代碼行數:24,代碼來源:serverinfos.class.php


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