Skip to content

Commit

Permalink
update construct
Browse files Browse the repository at this point in the history
  • Loading branch information
MygengBin committed Nov 25, 2022
1 parent 9b25d74 commit 448d657
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/Sqlbatis.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@

namespace Gengbin\Sqlbatis;

class Sqlbatis{
private $connectData = '';
private $userName = '';
private $userPassword = '';
function __construct($connectData='',$userName='',$userPassword='')
{
$this->connectData=$connectData;
$this->userName=$userName;
$this->userPassword=$userPassword;
}
abstract class Sqlbatis{
abstract function construct($connectData='',$userName='',$userPassword=''):array;

function resource(): array
{
Expand All @@ -20,8 +12,9 @@ function resource(): array
'errMessage'=>'',
'resource'=>null
];
$resource = $this->construct();
try {
$dataBaseHost = new PDO($this->connectData,$this->userName,$this->userPassword);
$dataBaseHost = new PDO($resource['connectData'],$resource['userName'],$resource['userPassword']);
$dataBaseHost->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$arr['resource']=$dataBaseHost;
}catch (PDOException $exception){
Expand Down

0 comments on commit 448d657

Please sign in to comment.