Update database.php
This commit is contained in:
parent
a546d1c9cb
commit
4ff759aa99
|
@ -7,9 +7,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!function_exists("get_db_connect")) {
|
if(!function_exists("get_db_connect")) {
|
||||||
function get_db_connect() {
|
function get_db_connect($a=32, $b=0) {
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
|
||||||
|
$conn = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$conn = new PDO(
|
$conn = new PDO(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -23,7 +25,14 @@ if(!function_exists("get_db_connect")) {
|
||||||
);
|
);
|
||||||
$conn->query("SET NAMES 'utf8'");
|
$conn->query("SET NAMES 'utf8'");
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
|
if($b > $a) {
|
||||||
set_error($e->getMessage());
|
set_error($e->getMessage());
|
||||||
|
show_errors();
|
||||||
|
} else {
|
||||||
|
$b++;
|
||||||
|
sleep(0.03);
|
||||||
|
$conn = get_db_connect($a, $b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $conn;
|
return $conn;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user