ソースを参照

Only add PDO::PGSQL_ATTR_DISABLE_PREPARES for versions of PHP that support it.

FusionPBX 3 年 前
コミット
1d705d2fa7
1 ファイル変更6 行追加1 行削除
  1. 6 1
      resources/classes/database.php

+ 6 - 1
resources/classes/database.php

@@ -1130,7 +1130,12 @@ include "root.php";
 					}
 
 				//set the error mode
-					$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION, PDO::PGSQL_ATTR_DISABLE_PREPARES);
+					$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+				//reduce prepared statement latency
+					if (defined('PDO::PGSQL_ATTR_DISABLE_PREPARES') {
+						$this->db->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES);
+					}
 
 				//execute the query, and return the results
 					try {