From 1645bf46e869b20fc73eb0e32420a7bbd207c8d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Fri, 10 Aug 2001 19:03:05 +0000 Subject: [PATCH] optimized a bit the MySQL version query --- defines.inc.php3 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/defines.inc.php3 b/defines.inc.php3 index ad3ffaada5..8628a4acfd 100755 --- a/defines.inc.php3 +++ b/defines.inc.php3 @@ -38,28 +38,23 @@ if (defined('PHP_OS') && eregi('win', PHP_OS)) { } // MySQL Version - -if (!empty($server)){ - $result = @mysql_query('SELECT VERSION() AS version'); +if (!empty($server)) { + $result = mysql_query('SELECT VERSION() AS version'); if ($result != FALSE && @mysql_num_rows($result) > 0) { - $result = mysql_query('SELECT VERSION() AS version') or mysql_die(); $row = mysql_fetch_array($result); define('MYSQL_MAJOR_VERSION', (double)substr($row['version'], 0, 4)); define('MYSQL_MINOR_VERSION', (double)substr($row['version'], 5)); } else { - $result = @mysql_query('SHOW VARIABLES like \'version\''); + $result = @mysql_query('SHOW VARIABLES LIKE \'version\''); if ($result != FALSE && @mysql_num_rows($result) > 0){ $row = mysql_fetch_row($result); define('MYSQL_MAJOR_VERSION', (double)substr($row[1], 0, 4)); define('MYSQL_MINOR_VERSION', (double)substr($row[1], 5)); - } else { - define('MYSQL_MAJOR_VERSION', 3.21); - define('MYSQL_MINOR_VERSION', 0); } } -} -else{ +} // end server id is defined case +if (!defined('MYSQL_MAJOR_VERSION')) { define('MYSQL_MAJOR_VERSION', 3.21); define('MYSQL_MINOR_VERSION', 0); -} +} // end if ?>