本文整理汇总了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');
}
示例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;
}
示例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);
}
示例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);
}