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
1 parent
fb8d745
commit ff1e545
Showing
12 changed files
with
160 additions
and
33 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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace Soluble\DbWrapper\Connection; | ||
|
||
use Soluble\DbWrapper\Adapter\MysqliAdapter; | ||
use Soluble\DbWrapper\Connection\Mysql\AbstractMysqlConnection; | ||
use mysqli; | ||
|
||
class MysqliConnection extends AbstractMysqlConnection implements ConnectionInterface | ||
{ | ||
|
||
/** | ||
* | ||
* @var MysqliAdapter | ||
*/ | ||
protected $adapter; | ||
|
||
|
||
/** | ||
* | ||
* @var mysqli | ||
*/ | ||
protected $resource; | ||
|
||
/** | ||
* | ||
* @param MysqliAdapter $adapter | ||
* @param mysqli $resource | ||
*/ | ||
public function __construct(MysqliAdapter $adapter, $resource) | ||
{ | ||
$this->adapter = $adapter; | ||
$this->resource = $resource; | ||
} | ||
|
||
|
||
/** | ||
* {@inheritdoc} | ||
* @return \mysqli | ||
*/ | ||
public function getResource() | ||
{ | ||
return $this->resource; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getHost() | ||
{ | ||
$infos = explode(' ', trim($this->resource->host_info)); | ||
return strtolower($infos[0]); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace Soluble\DbWrapper\Connection; | ||
|
||
use Soluble\DbWrapper\Adapter\PdoMysqlAdapter; | ||
use Soluble\DbWrapper\Connection\Mysql\AbstractMysqlConnection; | ||
use PDO; | ||
|
||
class PdoMysqlConnection extends AbstractMysqlConnection implements ConnectionInterface | ||
{ | ||
|
||
/** | ||
* | ||
* @var PdoMysqlAdapter | ||
*/ | ||
protected $adapter; | ||
|
||
|
||
/** | ||
* | ||
* @var PDO | ||
*/ | ||
protected $resource; | ||
|
||
/** | ||
* | ||
* @param PdoMysqlAdapter $adapter | ||
* @param PDO $resource | ||
*/ | ||
public function __construct(PdoMysqlAdapter $adapter, PDO $resource) | ||
{ | ||
$this->adapter = $adapter; | ||
$this->resource = $resource; | ||
} | ||
|
||
|
||
/** | ||
* {@inheritdoc} | ||
* @return PDO | ||
*/ | ||
public function getResource() | ||
{ | ||
return $this->resource; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getHost() | ||
{ | ||
$infos = explode(' ', trim($this->resource->getAttribute(PDO::ATTR_CONNECTION_STATUS))); | ||
return strtolower($infos[0]); | ||
} | ||
} |
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
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
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
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