real_connect($host, $user, $passwd, $db, $port, $socket, $flags); } else { parent::__construct($host, $user, $passwd, $db, $port, $socket); } } } function my_get_charsets($link) { /* Those tree are set by SET NAMES */ $charsets = array( 'client' => NULL, 'results' => NULL, 'connection' => NULL, ); if (!($res = mysqli_query($link, "SHOW VARIABLES LIKE '%character%'"))) { printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); return $charsets; } $names = array(); while ($row = mysqli_fetch_assoc($res)) { $names[$row['Variable_name']] = $row['Value']; } mysqli_free_result($res); if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $names['character_set_client']))) || !($details = mysqli_fetch_assoc($res))) { printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); return $charsets; } mysqli_free_result($res); $charsets['client'] = array( 'charset' => $details['Charset'], 'desc' => $details['Description'], 'collation' => $details['Default collation'], 'maxlen' => $details['Maxlen'], 'nr' => NULL, ); if (!($res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $details['Default collation']))) || !($collation = mysqli_fetch_assoc($res))) { printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); return $charsets; } mysqli_free_result($res); $charsets['client']['nr'] = $collation['Id']; if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $names['character_set_results']))) || !($details = mysqli_fetch_assoc($res))) { printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); return $charsets; } mysqli_free_result($res); $charsets['results'] = array( 'charset' => $details['Charset'], 'desc' => $details['Description'], 'collation' => $details['Default collation'], 'maxlen' => $details['Maxlen'], 'nr' => NULL, ); if (!($res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $details['Default collation']))) || !($collation = mysqli_fetch_assoc($res))) { printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); return $charsets; } mysqli_free_result($res); $charsets['results']['nr'] = $collation['Id']; if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $names['character_set_connection']))) || !($details = mysqli_fetch_assoc($res))) { printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); return $charsets; } mysqli_free_result($res); $charsets['connection'] = array( 'charset' => $details['Charset'], 'desc' => $details['Description'], 'collation' => $details['Default collation'], 'maxlen' => $details['Maxlen'], 'nr' => NULL, ); if (!($res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $details['Default collation']))) || !($collation = mysqli_fetch_assoc($res))) { printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); return $charsets; } mysqli_free_result($res); $charsets['connection']['nr'] = $collation['Id']; return $charsets; } function have_innodb($link) { if (($res = $link->query("SHOW VARIABLES LIKE 'have_innodb'")) && ($row = $res->fetch_row()) && !empty($row)) { if ($row[1] == "DISABLED" || $row[1] == "NO") { return false; } return true; } else { /* MySQL 5.6.1+ */ if ($res = $link->query("SHOW ENGINES")) { while ($row = $res->fetch_assoc()) { if (!isset($row['Engine']) || !isset($row['Support'])) return false; if (('InnoDB' == $row['Engine']) && (('YES' == $row['Support']) || ('DEFAULT' == $row['Support'])) ) { return true; } } return false; } else { return false; } } return false; } } else { printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n"); } function handle_catchable_fatal($errno, $error, $file, $line) { static $errcodes = array(); if (empty($errcodes)) { $constants = get_defined_constants(); foreach ($constants as $name => $value) { if (substr($name, 0, 2) == "E_") $errcodes[$value] = $name; } } printf("[%s] %s in %s on line %s\n", (isset($errcodes[$errno])) ? $errcodes[$errno] : $errno, $error, $file, $line); return true; } ?>