class SomeModel extends AppModel {
  function beforeSave($options = array()) {
    if (isset($this->data[$this->alias]['some_field'])) {
      $db =& ConnectionManager::getDataSource($this->useDbConfig);
      $this->set('checksum', $db->expression('MD5(some_field)'));
    }
  }
  return parent::beforeSave($options);
}

hth
grigri

On Jan 13, 4:27 pm, Shadows_Cl <[email protected]> wrote:
> I need use mysql functions at some model. Ex. i have a table with 3
> fields,  id (int),  date_access (datetime), and checksum (varchar)...
> but, i need to apply MD5 (mysql) to field checksum when add a new row.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to