1
0
mirror of https://github.com/dg/dibi.git synced 2025-07-31 11:20:25 +02:00

Use null coalescing operator (#340)

This commit is contained in:
Josef Drábek
2019-10-17 22:12:54 +02:00
committed by David Grudl
parent f46b7f4d79
commit 74ba6cfd34
3 changed files with 4 additions and 4 deletions

View File

@@ -331,7 +331,7 @@ class MySqliDriver implements Dibi\Driver
} elseif ($limit !== null || $offset) {
// see http://dev.mysql.com/doc/refman/5.0/en/select.html
$sql .= ' LIMIT ' . ($limit === null ? '18446744073709551615' : $limit)
$sql .= ' LIMIT ' . ($limit ?? '18446744073709551615')
. ($offset ? ' OFFSET ' . $offset : '');
}
}

View File

@@ -367,7 +367,7 @@ class PdoDriver implements Dibi\Driver
case 'mysql':
if ($limit !== null || $offset) {
// see http://dev.mysql.com/doc/refman/5.0/en/select.html
$sql .= ' LIMIT ' . ($limit === null ? '18446744073709551615' : $limit)
$sql .= ' LIMIT ' . ($limit ?? '18446744073709551615')
. ($offset ? ' OFFSET ' . $offset : '');
}
break;
@@ -383,7 +383,7 @@ class PdoDriver implements Dibi\Driver
case 'sqlite':
if ($limit !== null || $offset) {
$sql .= ' LIMIT ' . ($limit === null ? '-1' : $limit)
$sql .= ' LIMIT ' . ($limit ?? '-1')
. ($offset ? ' OFFSET ' . $offset : '');
}
break;

View File

@@ -267,7 +267,7 @@ class SqliteDriver implements Dibi\Driver
throw new Dibi\NotSupportedException('Negative offset or limit.');
} elseif ($limit !== null || $offset) {
$sql .= ' LIMIT ' . ($limit === null ? '-1' : $limit)
$sql .= ' LIMIT ' . ($limit ?? '-1')
. ($offset ? ' OFFSET ' . $offset : '');
}
}