public function saveMessages()
    {
        if (!$this->getId()) {
            return $this->save();
        }

        $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
        /* @var $connection Varien_Db_Adapter_Interface */

        $count = $connection
            ->update(
                $this->getResource()->getMainTable(),
                array('messages' => $this->getMessages()),
                array('schedule_id = ?' => $this->getId())
            );

        if (!$count) {
            /**
             * Check if the row was not updated because of data truncation.
             */
            $warning = $this->_getPdoWarning($connection->getConnection());
            if ($warning && $warning->Code = 1265) {
                $maxLength = strlen($this->getMessages()) - 5000;
                $this->setMessages($warning->Level . ': ' .
                    str_replace(' at row 1', '.', $warning->Message) . PHP_EOL . PHP_EOL .
                    '...' . substr($this->getMessages(), -$maxLength));
            }
        }

        return $this;
    }
public function saveMessages()
    {
        if (!$this->getId()) {
            return $this->save();
        }

        $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
        /* @var $connection Varien_Db_Adapter_Interface */

        $count = $connection
            ->update(
                $this->getResource()->getMainTable(),
                array('messages' => $this->getMessages()),
                array('schedule_id = ?' => $this->getId())
            );

        if (!$count) {
            /**
             * Check if the row was not updated because of data truncation.
             */
            $warning = $this->_getPdoWarning($connection->getConnection());
            if ($warning && $warning->Code = 1265) {
                $maxLength = strlen($this->getMessages()) - 5000;
                $this->setMessages($warning->Level . ': ' .
                    str_replace(' at row 1', '.', $warning->Message) . PHP_EOL . PHP_EOL .
                    '...' . substr($this->getMessages(), -$maxLength));
            }
        }

        return $this;
    }
public function saveMessages ( ) { if ( ! $ this -> getId ( ) ) { return $ this -> save ( ) ; } $ connection = Mage :: getSingleton ( 'core/resource' ) -> getConnection ( 'core_write' ) ; /* @var $connection Varien_Db_Adapter_Interface */ $ count = $ connection -> update ( $ this -> getResource ( ) -> getMainTable ( ) , array ( 'messages' => $ this -> getMessages ( ) ) , array ( 'schedule_id = ?' => $ this -> getId ( ) ) ) ; if ( ! $ count ) { /**
             * Check if the row was not updated because of data truncation.
             */ $ warning = $ this -> _getPdoWarning ( $ connection -> getConnection ( ) ) ; if ( $ warning && $ warning -> Code = 1265 ) { $ maxLength = strlen ( $ this -> getMessages ( ) ) - 5000 ; $ this -> setMessages ( $ warning -> Level . ': ' . str_replace ( ' at row 1' , '.' , $ warning -> Message ) . PHP_EOL . PHP_EOL . '...' . substr ( $ this -> getMessages ( ) , - $ maxLength ) ) ; } } return $ this ; }
Save the messages directly to the schedule record.

If the `messages` field was not updated in the database,
check if this is because of `data truncation` and fix the message length.

@return $this
Save the messages directly to the schedule record .