-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Leonard Levering
committed
Jul 23, 2020
1 parent
497323e
commit 210eb00
Showing
1 changed file
with
50 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Andrea | ||
* Date: 20/02/2018 | ||
* Time: 15:50 | ||
*/ | ||
|
||
namespace Abram\Odbc; | ||
|
||
use Illuminate\Database\Connectors\Connector; | ||
use Illuminate\Database\Connectors\ConnectorInterface; | ||
|
||
class ODBCConnector extends Connector implements ConnectorInterface | ||
{ | ||
|
||
/** | ||
* Establish a database connection. | ||
* | ||
* @param array $config | ||
* | ||
* @return \PDO | ||
* @internal param array $options | ||
* | ||
*/ | ||
public function connect(array $config) | ||
{ | ||
$options = $this->getOptions($config); | ||
|
||
$dsn = array_get($config, 'dsn'); | ||
|
||
$connection = $this->createConnection($dsn, $config, $options); | ||
|
||
return $connection; | ||
} | ||
|
||
/** | ||
* Create a new PDO connection instance. | ||
* | ||
* @param string $dsn | ||
* @param string $username | ||
* @param string $password | ||
* @param array $options | ||
* @return ODBCPdo | ||
*/ | ||
protected function createPdoConnection($dsn, $username, $password, $options) | ||
{ | ||
return new ODBCPdo($dsn, $username, $password); | ||
} | ||
} | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Andrea | ||
* Date: 20/02/2018 | ||
* Time: 15:50 | ||
*/ | ||
|
||
namespace Abram\Odbc; | ||
|
||
use Illuminate\Database\Connectors\Connector; | ||
use Illuminate\Database\Connectors\ConnectorInterface; | ||
|
||
class ODBCConnector extends Connector implements ConnectorInterface | ||
{ | ||
|
||
/** | ||
* Establish a database connection. | ||
* | ||
* @param array $config | ||
* | ||
* @return \PDO | ||
* @internal param array $options | ||
* | ||
*/ | ||
public function connect(array $config) | ||
{ | ||
$options = $this->getOptions($config); | ||
|
||
$dsn = Arr::get($config, 'dsn'); | ||
|
||
$connection = $this->createConnection($dsn, $config, $options); | ||
|
||
return $connection; | ||
} | ||
|
||
/** | ||
* Create a new PDO connection instance. | ||
* | ||
* @param string $dsn | ||
* @param string $username | ||
* @param string $password | ||
* @param array $options | ||
* @return ODBCPdo | ||
*/ | ||
protected function createPdoConnection($dsn, $username, $password, $options) | ||
{ | ||
return new ODBCPdo($dsn, $username, $password); | ||
} | ||
} |