added "LoginTimeout"

This commit is contained in:
2023-05-23 15:22:09 -04:00
parent ae968a6b3e
commit cca0b7a81a

View File

@@ -1,10 +1,10 @@
<?php <?php
/** /**
* @desc A simple and convenient php sqlsrv class * @desc A simple and convenient php sqlsrv class
* @author Yaseng WwW.Yaseng.Me [] * @author Originaly made by Yaseng WwW.Yaseng.Me, now maintained and update by Sebastien Plante
* v1.3 * @version v1.4
* @link * @link https://gitea.urbanghetto.net/nka/php_sqlsrv_class
*/ */
class sqlsrv class sqlsrv
@@ -19,7 +19,7 @@ class sqlsrv
//connection //connection
function __construct($server, $user, $pass, $dbname) function __construct($server, $user, $pass, $dbname)
{ {
$this->conn = @sqlsrv_connect($server, array('UID' => $user, 'PWD' => $pass, 'Database' => $dbname)); $this->conn = @sqlsrv_connect($server, array('UID' => $user, 'PWD' => $pass, 'Database' => $dbname, 'LoginTimeout' => 10));
if ($this->conn === false) { if ($this->conn === false) {
$this->error_log[] = sqlsrv_errors(); $this->error_log[] = sqlsrv_errors();
throw new Exception($this->error_log[0][0]["message"]); throw new Exception($this->error_log[0][0]["message"]);