-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/master' into use-new-column-definition-builder
# Conflicts: # tests/Common/CommonColumnSchemaBuilderTest.php
- Loading branch information
Showing
17 changed files
with
131 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Db\Connection; | ||
|
||
/** | ||
* Should be implemented by a class that provides information about the database server. | ||
*/ | ||
interface ServerInfoInterface | ||
{ | ||
/** | ||
* Returns a server version as a string comparable by {@see version_compare()}. | ||
*/ | ||
public function getVersion(): string; | ||
} |
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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Db\Driver\Pdo; | ||
|
||
use PDO; | ||
use Yiisoft\Db\Connection\ServerInfoInterface; | ||
|
||
class PdoServerInfo implements ServerInfoInterface | ||
{ | ||
protected string|null $version = null; | ||
|
||
public function __construct(protected PdoConnectionInterface $db) | ||
{ | ||
} | ||
|
||
public function getVersion(): string | ||
{ | ||
if ($this->version === null) { | ||
/** @var string */ | ||
$this->version = $this->db->getActivePDO()?->getAttribute(PDO::ATTR_SERVER_VERSION) ?? ''; | ||
} | ||
|
||
return $this->version; | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Driver\PDO; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Yiisoft\Db\Tests\Support\TestTrait; | ||
|
||
class PdoServerInfoTest extends TestCase | ||
{ | ||
use TestTrait; | ||
|
||
public function testGetVersion(): void | ||
{ | ||
$db = $this->getConnection(); | ||
$serverInfo = $db->getServerInfo(); | ||
|
||
$this->assertIsString($serverInfo->getVersion()); | ||
} | ||
} |
Oops, something went wrong.