I tested Alekseys app again on separate host with test table, and it worked
perfect. I switched store engine to innodb, worked with my model API methods

$this->view->assign('rows', $news->fetchNewsByIds(range(1,64)));
and
*$news->publishNews($ids);*
*
*
on 64 rows, and still no error.

I do similar in my project

$newsTable->publishNews($ids);
foreach ($newsTable->fetchNewsByIds($ids) as $news) {
$news->publishOnTwitter();
}

maybe I should move fetchNewsByIds out of the foreach, but that should not
be the problem.

To make it more clear, there are model methods:

/**
 * Fetch news by Ids.
 *
 * @param array $ids array of news ids
 * @return Automobili_Model_Table_Rowset_News
 */
public function fetchNewsByIds($ids) {
return $this->fetchAll(
 $this->select()
->from($this->_name)
->where($this->getAdapter()->quoteInto('id IN (?)', $ids,
Zend_Db::INT_TYPE))
 ->order('date DESC')
);
}

/**
 * Publish news.
 *
 * @param array $ids aray of news ids
 */
public function publishNews($ids) {
 $this->update(
array('status' => self::ACTIVE),
$this->getAdapter()->quoteInto('id IN (?)', $ids, Zend_Db::INT_TYPE)
 );
}

Row have this publish on twitter, which shouldn't have nothing to do with
the problem

public function publishOnTwitter() {
$credentials =
Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption('twitter');
     $twitter = new Zend_Service_Twitter($credentials['username'],
$credentials['password']);
     $twitter->status->update(sprintf('%s %s', $this->title, $this->url));
 }

Does anyone see what I cannot see?

Regards,
Saša Stamenković


On Tue, May 25, 2010 at 12:46 AM, Саша Стаменковић <[email protected]>wrote:

> Thanks Aleksey! It works perfect on my server. I don't get it, on the first
> look, I do exactly same thing in my code. Will take a closer look at it
> tommorow, and then share with you where the error was.
>
>  Only difference i see is that table is myisam, my was innodb. We'll see.
>
> Regards,
> Saša Stamenković
>
>
>
> On Tue, May 25, 2010 at 12:40 AM, Bill Karwin <[email protected]> wrote:
>
>> On May 24, 2010, at 12:18 PM, Саша Стаменковић wrote:
>>
>>  Sure, when you have unlimited number of db operation over a period of
>>> time. I'll come up with my own offline quoting.
>>>
>>
>> You should use the function provided by the database API.  The function
>> mysqli_real_escape_string() requires an active database connection because
>> it needs to know the character set used by the connection.  But this isn't a
>> problem; it's necessary so it can do quoting safely.
>>
>> Please DON'T try to write your own quoting function unless you are an
>> expert with multi-byte character sets.  It's surprisingly difficult to write
>> a quoting function that's safe.
>>
>> Read
>> http://shiflett.org/blog/2006/jan/addslashes-versus-mysql-real-escape-string
>>
>> Regards,
>> Bill Karwin
>
>
>

Reply via email to