mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Setup/Misc
* wrap db test in try/catch block * escape more mysql8 keywords
This commit is contained in:
@@ -56,15 +56,17 @@ class DB
|
|||||||
if (strstr($options['host'], ':'))
|
if (strstr($options['host'], ':'))
|
||||||
[$options['host'], $port] = explode(':', $options['host']);
|
[$options['host'], $port] = explode(':', $options['host']);
|
||||||
|
|
||||||
if ($link = @mysqli_connect($options['host'], $options['user'], $options['pass'], $options['db'], $port ?: $defPort))
|
try {
|
||||||
{
|
$link = @mysqli_connect($options['host'], $options['user'], $options['pass'], $options['db'], $port ?: $defPort);
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
$err = '['.mysqli_connect_errno().'] '.mysqli_connect_error();
|
$err = '['.mysqli_connect_errno().'] '.mysqli_connect_error();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static function errorHandler($message, $data)
|
public static function errorHandler($message, $data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ class Profiler
|
|||||||
// talents
|
// talents
|
||||||
for ($j = 0; $j < 3; $j++)
|
for ($j = 0; $j < 3; $j++)
|
||||||
{
|
{
|
||||||
$_ = DB::Aowow()->selectCol('SELECT spell AS ARRAY_KEY, MAX(IF(spell IN (?a), `rank`, 0)) FROM ?_talents WHERE class = ?d AND tab = ?d GROUP BY id ORDER BY row, col ASC', !empty($t[$i]) ? $t[$i] : [0], $char['class'], $j);
|
$_ = DB::Aowow()->selectCol('SELECT spell AS ARRAY_KEY, MAX(IF(spell IN (?a), `rank`, 0)) FROM ?_talents WHERE class = ?d AND tab = ?d GROUP BY id ORDER BY `row`, `col` ASC', !empty($t[$i]) ? $t[$i] : [0], $char['class'], $j);
|
||||||
$data['talentbuild'.($i + 1)] .= implode('', $_);
|
$data['talentbuild'.($i + 1)] .= implode('', $_);
|
||||||
if ($data['activespec'] == $i)
|
if ($data['activespec'] == $i)
|
||||||
$data['talenttree'.($j + 1)] = array_sum($_);
|
$data['talenttree'.($j + 1)] = array_sum($_);
|
||||||
|
|||||||
Reference in New Issue
Block a user