I managed to work around my problem making a change in doctrine directly.
I know it's not ideal but solved my problem with the rowCount ().
see:
public function executeQuery($query, array $params = array(), $types =
array(), QueryCacheProfile $qcp = null)
{
if ($qcp !== null) {
return $this->executeCacheQuery($query, $params, $types, $qcp);
}
$this->connect();
$logger = $this->_config->getSQLLogger();
if ($logger) {
$logger->startQuery($query, $params, $types);
}
try {
$extraPar = array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL);
if ($params) {
list($query, $params, $types) =
SQLParserUtils::expandListParameters($query, $params, $types);
if ($this->getDriver()->getName() === 'pdo_sqlsrv') {
$stmt = $this->_conn->prepare($query, $extraPar);
} else {
$stmt = $this->_conn->prepare($query);
}
if ($types) {
$this->_bindTypedValues($stmt, $params, $types);
$stmt->execute();
} else {
$stmt->execute($params);
}
} else {
if ($this->getDriver()->getName() === 'pdo_sqlsrv') {
$stmt = $this->_conn->prepare($query, $extraPar);
$stmt->execute();
} else {
$stmt = $this->_conn->query($query);
}
}
} catch (\Exception $ex) {
throw DBALException::driverExceptionDuringQuery($this->_driver,
$ex, $query, $this->resolveParams($params, $types));
}
$stmt->setFetchMode($this->defaultFetchMode);
if ($logger) {
$logger->stopQuery();
}
return $stmt;
}
2015-01-06 10:17 GMT-03:00 Pablo <[email protected]>:
> I'm sorry for this but I am a beginner. I'll try to explain:
>
> I have a class that uses the DBAL doctrine, this class I have a method
> that has the function to return the number of lines of a "resultset". as I
> said, it works with mysql and postgress but failed when I tried to use with
> sqlserver.
>
> in fact need to know if there is a way to recover the number of lines of a
> "resultset" portably.
>
> my function:
>
> public function nLinhas($resultSet)
> {
> if (!\is_object($resultSet)) {
> throw new \Exception($this->getExcecao(2));
> }
>
> return (int) $resultSet->rowCount();
> }
>
>
>
> 2015-01-06 9:40 GMT-03:00 Nima Sadjadi <[email protected]>:
>
> I don't know what exactly you want to do, can't you just use "count" in
>> your dql, with getSingleScalarResult instead of getResult?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "doctrine-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/doctrine-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Pablo Vanni
>
--
Pablo Vanni
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.