本文整理汇总了PHP中DBLayer::get_version方法的典型用法代码示例。如果您正苦于以下问题:PHP DBLayer::get_version方法的具体用法?PHP DBLayer::get_version怎么用?PHP DBLayer::get_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBLayer
的用法示例。
在下文中一共展示了DBLayer::get_version方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
default:
error(sprintf($lang_install['DB type not valid'], pun_htmlspecialchars($db_type)));
}
// Create the database object (and connect/select db)
$db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false);
// Validate prefix
if (strlen($db_prefix) > 0 && (!preg_match('%^[a-zA-Z_][a-zA-Z0-9_]*$%', $db_prefix) || strlen($db_prefix) > 40)) {
error(sprintf($lang_install['Table prefix error'], $db->prefix));
}
// Do some DB type specific checks
switch ($db_type) {
case 'mysql':
case 'mysqli':
case 'mysql_innodb':
case 'mysqli_innodb':
$mysql_info = $db->get_version();
if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<')) {
error(sprintf($lang_install['You are running error'], 'MySQL', $mysql_info['version'], FORUM_VERSION, MIN_MYSQL_VERSION));
}
break;
case 'pgsql':
$pgsql_info = $db->get_version();
if (version_compare($pgsql_info['version'], MIN_PGSQL_VERSION, '<')) {
error(sprintf($lang_install['You are running error'], 'PostgreSQL', $pgsql_info['version'], FORUM_VERSION, MIN_PGSQL_VERSION));
}
break;
case 'sqlite':
if (strtolower($db_prefix) == 'sqlite_') {
error($lang_install['Prefix reserved']);
}
break;
示例2: error
require FORUM_ROOT . 'include/dblayer/pgsql.php';
break;
case 'sqlite':
require FORUM_ROOT . 'include/dblayer/sqlite.php';
break;
case 'sqlite3':
require FORUM_ROOT . 'include/dblayer/sqlite3.php';
break;
default:
error(sprintf($lang_install['No such database type'], forum_htmlencode($db_type)));
}
// Create the database object (and connect/select db)
$forum_db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false);
// If MySQL, make sure it's at least 4.1.2
if (in_array($db_type, array('mysql', 'mysqli', 'mysql_innodb', 'mysqli_innodb'))) {
$mysql_info = $forum_db->get_version();
if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<')) {
error(sprintf($lang_install['Invalid MySQL version'], forum_htmlencode($mysql_info['version']), MIN_MYSQL_VERSION));
}
// Check InnoDB support in DB
if (in_array($db_type, array('mysql_innodb', 'mysqli_innodb'))) {
$result = $forum_db->query('SHOW VARIABLES LIKE \'have_innodb\'');
$row = $forum_db->fetch_assoc($result);
if (!$row || !isset($row['Value']) || strtolower($row['Value']) != 'yes') {
error($lang_install['MySQL InnoDB Not Supported']);
}
}
}
// Validate prefix
if (strlen($db_prefix) > 0 && (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $db_prefix) || strlen($db_prefix) > 40)) {
error(sprintf($lang_install['Invalid table prefix'], $db_prefix));