Clorith/SQLSRV-DataBase-Class

close connections

ahmdjhnel1 opened this issue · 1 comments

hello.

i have a simple question, why connections isn't close?

i can't see any function for closing connection in your library.for this reason i do this work:

$database = new database($this->db_name,$this->db_pass,$this->db_user,$this->db_host);
$database->db_connect();
$conn = $database->get_db();
sqlsrv_close($conn);

it is standard?

The other way around could be like this:
end of class :
/**
* close the connection
*
* @SInCE 0.1.0
*
* @returns nothing
*/
public function db_close() {
sqlsrv_close ($this->db);
}

and in the script :
$SSMS = new SQLSRV_DataBase(xxxxxxx );
$SSMS->db_connect();
$sql ="select distinct xxxx from xxxxx";
$arrCon = $SSMS->get_results($sql,'array');
print_r($arrCon);
$SSMS->db_close();