Skip to content

Commit

Permalink
Merge pull request #21 from akrabat/os400
Browse files Browse the repository at this point in the history
Support PHP_OS of OS400 & tweak doModifyLimitQuery
  • Loading branch information
akrabat committed Oct 13, 2021
2 parents 962e248 + 4f46035 commit 4478ff2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/Driver/AbstractDB2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
abstract class AbstractDB2Driver implements Driver
{
const SYSTEM_IBMI = 'AIX';
const SYSTEM_IBMI_OS400 = 'OS400';

public static function isIbmi()
{
return (PHP_OS === static::SYSTEM_IBMI || PHP_OS === static::SYSTEM_IBMI_OS400);
}

/**
* {@inheritdoc}
Expand All @@ -27,7 +33,7 @@ public function getDatabase(\Doctrine\DBAL\Connection $conn)
*/
public function getDatabasePlatform()
{
if (PHP_OS === static::SYSTEM_IBMI) {
if (static::isIbmi()) {
return new DB2IBMiPlatform();
} else {
return new DB2Platform();
Expand All @@ -39,7 +45,7 @@ public function getDatabasePlatform()
*/
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
{
if (PHP_OS === static::SYSTEM_IBMI) {
if (static::isIbmi()) {
return new DB2IBMiSchemaManager($conn);
} else {
return new DB2LUWSchemaManager($conn);
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/DB2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function connect(array $params, $username = null, $password = null, array
$password = null;
}

if (PHP_OS === static::SYSTEM_IBMI) {
if (static::isIbmi()) {
return new DB2IBMiConnection($params, $username, $password, $driverOptions);
} else {
return new DB2Connection($params, $username, $password, $driverOptions);
Expand Down
2 changes: 1 addition & 1 deletion src/Platform/DB2IBMiPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public function getCreateDatabaseSQL($database)
*/
protected function doModifyLimitQuery($query, $limit, $offset = null)
{
if ($limit === null && $offset === null) {
if ($limit === null && $offset <= 0) {
return $query;
}

Expand Down

0 comments on commit 4478ff2

Please sign in to comment.