mirror of
https://github.com/dg/dibi.git
synced 2025-08-01 11:50:15 +02:00
Use null coalescing operator (#340)
This commit is contained in:
committed by
David Grudl
parent
f46b7f4d79
commit
74ba6cfd34
@@ -331,7 +331,7 @@ class MySqliDriver implements Dibi\Driver
|
|||||||
|
|
||||||
} elseif ($limit !== null || $offset) {
|
} elseif ($limit !== null || $offset) {
|
||||||
// see http://dev.mysql.com/doc/refman/5.0/en/select.html
|
// 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 : '');
|
. ($offset ? ' OFFSET ' . $offset : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -367,7 +367,7 @@ class PdoDriver implements Dibi\Driver
|
|||||||
case 'mysql':
|
case 'mysql':
|
||||||
if ($limit !== null || $offset) {
|
if ($limit !== null || $offset) {
|
||||||
// see http://dev.mysql.com/doc/refman/5.0/en/select.html
|
// 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 : '');
|
. ($offset ? ' OFFSET ' . $offset : '');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -383,7 +383,7 @@ class PdoDriver implements Dibi\Driver
|
|||||||
|
|
||||||
case 'sqlite':
|
case 'sqlite':
|
||||||
if ($limit !== null || $offset) {
|
if ($limit !== null || $offset) {
|
||||||
$sql .= ' LIMIT ' . ($limit === null ? '-1' : $limit)
|
$sql .= ' LIMIT ' . ($limit ?? '-1')
|
||||||
. ($offset ? ' OFFSET ' . $offset : '');
|
. ($offset ? ' OFFSET ' . $offset : '');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -267,7 +267,7 @@ class SqliteDriver implements Dibi\Driver
|
|||||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||||
|
|
||||||
} elseif ($limit !== null || $offset) {
|
} elseif ($limit !== null || $offset) {
|
||||||
$sql .= ' LIMIT ' . ($limit === null ? '-1' : $limit)
|
$sql .= ' LIMIT ' . ($limit ?? '-1')
|
||||||
. ($offset ? ' OFFSET ' . $offset : '');
|
. ($offset ? ' OFFSET ' . $offset : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user