Skip to content

Loading…

SQL Server doModifyLimitQuery() quoting of doctrine_rownum causes error #159

Merged
merged 1 commit into from

4 participants

@dt-creasis

SQL Server doesn't like the quoted alias for doctrine_rownum and fails when setting setMaxResults() and setFirstResult() in query, returning an error like "Conversion failed when converting the varchar value 'doctrine_rownum' to data type int. (severity 16)"

Not sure why the column alias is quoted as have never seen that used before.

@dt-creasis dt-creasis SQL Server doesn't like the quoted alias for doctrine_rownum and fail…
…s when setting setMaxResults() and setFirstResult() in query, returning an error like "Conversion failed when converting the varchar value 'doctrine_rownum' to data type int. (severity 16)"
129394c
@travisbot

This pull request passes (merged 129394c into e537745).

@beberlei beberlei merged commit 0760d95 into doctrine:master
@beberlei
Doctrine member

You forgot to run the testsuite. This breaks one test

@stof
Doctrine member

@beberlei according to @travisbot, it was passing one month ago when the PR was sent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 7, 2012
  1. @dt-creasis

    SQL Server doesn't like the quoted alias for doctrine_rownum and fail…

    dt-creasis committed
    …s when setting setMaxResults() and setFirstResult() in query, returning an error like "Conversion failed when converting the varchar value 'doctrine_rownum' to data type int. (severity 16)"
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View
2 lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
@@ -704,7 +704,7 @@ protected function doModifyLimitQuery($query, $limit, $offset = null)
$start = $offset + 1;
$end = $offset + $limit;
- $query = "SELECT * FROM (SELECT ROW_NUMBER() OVER ($over) AS \"doctrine_rownum\", $query) AS doctrine_tbl WHERE \"doctrine_rownum\" BETWEEN $start AND $end";
+ $query = "SELECT * FROM (SELECT ROW_NUMBER() OVER ($over) AS doctrine_rownum, $query) AS doctrine_tbl WHERE doctrine_rownum BETWEEN $start AND $end";
}
}
Something went wrong with that request. Please try again.