public function applyCriterias($sql, $parameters = array(), $ordering = array(), $limit = -1, $offset = -1)
{
if (count($ordering) > 0) {
$sql = $this->applyOrdering($sql, $ordering);
}
if ($limit >= 0 || $offset >= 0) {
$sql = $this->applyLimitOffset($sql, $limit, $offset);
}
$command = $this->createCommand($sql);
$this->bindArrayValues($command, $parameters);
return $command;
}