minor optimization, let the PDO driver do that for us
This commit is contained in:
parent
05f77e45bc
commit
8389c2a2d6
1 changed files with 5 additions and 12 deletions
|
@ -486,19 +486,13 @@ class Database extends AbstractData
|
||||||
*/
|
*/
|
||||||
protected function _getExpiredPastes($batchsize)
|
protected function _getExpiredPastes($batchsize)
|
||||||
{
|
{
|
||||||
$pastes = array();
|
$statement = $this->_db->prepare(
|
||||||
$rows = $this->_select(
|
|
||||||
'SELECT "dataid" FROM "' . $this->_sanitizeIdentifier('paste') .
|
'SELECT "dataid" FROM "' . $this->_sanitizeIdentifier('paste') .
|
||||||
'" WHERE "expiredate" < ? AND "expiredate" != ? ' .
|
'" WHERE "expiredate" < ? AND "expiredate" != ? ' .
|
||||||
($this->_type === 'oci' ? 'FETCH NEXT ? ROWS ONLY' : 'LIMIT ?'),
|
($this->_type === 'oci' ? 'FETCH NEXT ? ROWS ONLY' : 'LIMIT ?')
|
||||||
array(time(), 0, $batchsize)
|
|
||||||
);
|
);
|
||||||
if (is_array($rows) && count($rows)) {
|
$statement->execute(array(time(), 0, $batchsize));
|
||||||
foreach ($rows as $row) {
|
return $statement->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||||
$pastes[] = $row['dataid'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $pastes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -506,10 +500,9 @@ class Database extends AbstractData
|
||||||
*/
|
*/
|
||||||
public function getAllPastes()
|
public function getAllPastes()
|
||||||
{
|
{
|
||||||
$pastes = $this->_db->_query(
|
return $this->_db->_query(
|
||||||
'SELECT "dataid" FROM "' . $this->_sanitizeIdentifier('paste') . '"'
|
'SELECT "dataid" FROM "' . $this->_sanitizeIdentifier('paste') . '"'
|
||||||
)->fetchAll(PDO::FETCH_COLUMN, 0);
|
)->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||||
return $pastes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue