Skip to content

Commit

Permalink
* restructure sql query
Browse files Browse the repository at this point in the history
 * always use quote() with all values 



git-svn-id: https://svn.php.net/repository/pear/packages/Mail_Queue/trunk@312725 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
till committed Jun 30, 2011
1 parent f860006 commit 2a07ce1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Mail/Queue/Container/mdb2.php
Expand Up @@ -225,9 +225,12 @@ function _preload()
return $res;
}
$query = 'SELECT * FROM ' . $this->mail_table
.' WHERE sent_time IS NULL AND try_sent < '. $this->try
.' AND time_to_send <= '.$this->db->quote(date('Y-m-d H:i:s'), 'timestamp')
.' ORDER BY time_to_send';
. ' WHERE'
. ' sent_time is NULL AND'
. ' try_sent < '. $this->db->quote($this->try, 'integer') . ' AND'
. ' time_to_send <= '.$this->db->quote(date('Y-m-d H:i:s'), 'timestamp')
. ' ORDER BY time_to_send';

$this->db->setLimit($this->limit, $this->offset);
$res = $this->db->query($query);
if (PEAR::isError($res)) {
Expand All @@ -238,6 +241,7 @@ function _preload()

$this->_last_item = 0;
$this->queue_data = array(); //reset buffer

while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
//var_dump($row['headers']);
if (!is_array($row)) {
Expand Down

0 comments on commit 2a07ce1

Please sign in to comment.