Update database.php

This commit is contained in:
Namhyeon Go 2018-06-29 13:27:33 +09:00 committed by GitHub
parent a546d1c9cb
commit 4ff759aa99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,9 +7,11 @@
*/
if(!function_exists("get_db_connect")) {
function get_db_connect() {
function get_db_connect($a=32, $b=0) {
$config = get_config();
$conn = false;
try {
$conn = new PDO(
sprintf(
@ -23,7 +25,14 @@ if(!function_exists("get_db_connect")) {
);
$conn->query("SET NAMES 'utf8'");
} catch(Exception $e) {
set_error($e->getMessage());
if($b > $a) {
set_error($e->getMessage());
show_errors();
} else {
$b++;
sleep(0.03);
$conn = get_db_connect($a, $b);
}
}
return $conn;