Skip to content

Commit eb4ae54

Browse files
author
Fredrick Peter
committed
update for perfomance
1 parent 9573d05 commit eb4ae54

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/DBImport.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,17 @@ class DBImport{
4242
*/
4343
private $db;
4444

45-
45+
4646
/**
4747
* Construct Instance of Database
48+
*
49+
* @param string|null $connection
50+
* @return void
4851
*/
49-
public function __construct() {
52+
public function __construct($connection = null)
53+
{
5054
$this->error = Constant::STATUS_404;
51-
$this->db = DB::connection()->dbConnection();
55+
$this->db = DB::connection($connection)->dbConnection();
5256
}
5357

5458
/**
@@ -58,7 +62,7 @@ public function __construct() {
5862
* @return object
5963
* [status, message]
6064
*/
61-
public function import($path_to_sql = NULL)
65+
public function import($path_to_sql)
6266
{
6367
$this->realpath = Server::formatWithBaseDirectory($path_to_sql);
6468

src/Schema/JoinClause.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class JoinClause extends Builder
2323
/**
2424
* The connection of the parent query builder.
2525
*
26-
* @var \Tamedevelopers\Database\Schema\Builder\connection
26+
* @var \Tamedevelopers\Database\Schema\Builder\connection|mixed
2727
*/
2828
protected $parentConnection;
2929

src/helpers.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,16 @@ function app_manager()
7373
* Database Importation
7474
*
7575
* @param string $path_to_sql
76+
* @param string|null $connection
7677
*
7778
* @return object
7879
* [status, message]
7980
*/
80-
function import($path_to_sql = null)
81+
function import($path_to_sql, $connection = null)
8182
{
82-
return (new DBImport)->import($path_to_sql);
83+
$import = new DBImport($connection);
84+
85+
return $import->import($path_to_sql);
8386
}
8487
}
8588

0 commit comments

Comments
 (0)