public function update($query)
    {
        $resources = $query->getRepository()->getResources();

        foreach ($resources as $resource) {
            $names[] = $query->getPrefix().$resource->getName().' AS '.$this->_store->quoteName($resource->getAlias());
            //only join update if there are no order			
            if (!empty($query->order)) {
                break;
            }
        }

        $operation = $query->operation['value'];

        if (is_array($query->operation['value'])) {
            $operation = array();
            foreach ($query->operation['value'] as $key => $value) {
                $operation[] = is_numeric($key) ? $value : '@col('.$key.')='.$this->_store->quoteValue($value);
            }
            $operation = implode(',', $operation);
        }

        //only join update if there are no order
        if (empty($query->order)) {
            $resources = $query->getRepository()->getResources();

            foreach ($resources->getLinks() as $link) {
                $query->where($link->child, '=', $link->parent);
            }
        }

        $clause = 'UPDATE '.implode($names, ', ').' SET '.$operation;

        return $clause;
    }