* Fix bug jira data import prompts code error.

This commit is contained in:
tanghucheng
2023-05-30 07:18:42 +00:00
parent f52bdfb360
commit d3b84f49a5
3 changed files with 18 additions and 5 deletions
+3 -5
View File
@@ -21,13 +21,11 @@ class convertModel extends model
*/
public function connectDB($dbName = '')
{
$dsn = "mysql:host={$this->config->db->host}; port={$this->config->db->port};dbname={$dbName}";
$config = clone $this->config->db;
$config->name = $dbName;
try
{
$dbh = new PDO($dsn, $this->config->db->user, $this->config->db->password);
$dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->exec("SET NAMES {$this->config->db->encoding}");
$dbh = new dbh($config);
$this->sourceDBH = $dbh;
return $dbh;
}