Class it_dbi:

/**
 * Create a record like replace(), but optimize if similar or identical record already exists
 * MUST GIVE ALL FIELDS INCLUDING ID
 * @param $tags key => value pairs to set
 */
function store($tags = array())
{
    return $tags[$this->_p['keyfield']] && $this->read($tags[$this->_p['keyfield']]) ? $this->update($tags) : $this->replace($tags);
}