protected function replaceRaws(&$sql, &$params) {
		$i = 0;
		$sql = preg_replace_callback('/\?/', function() use(&$i, &$params) {
			if($params[$i] instanceof static) {
				$r = $params[$i];
				$sql = $r->buildSQL();
				$params = array_merge(array_slice($params, 0, $i), $r->getParameters(), array_slice($params, $i+1));
				return '('.$sql.')';
			}
			if($params[$i] instanceof Raw) {
				$r = $params[$i];
				$sql = $r->getSQL();
				$params = array_merge(array_slice($params, 0, $i), $r->getParameters(), array_slice($params, $i+1));
				return $sql;
			}
			else
				return '?';
		}, $sql);
	}