[Bast-commits] r9510 - in DBIx-Class/0.08/trunk: lib/DBIx/Class
t/sqlahacks/limit_dialects
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Tue Jun 1 13:04:48 GMT 2010
Author: ribasushi
Date: 2010-06-01 14:04:48 +0100 (Tue, 01 Jun 2010)
New Revision: 9510
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/SQLAHacks.pm
DBIx-Class/0.08/trunk/t/sqlahacks/limit_dialects/generic_subq.t
Log:
Move order outside of the GenSubQ subquery, to appease retarded Sybase
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/SQLAHacks.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/SQLAHacks.pm 2010-06-01 11:36:37 UTC (rev 9509)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/SQLAHacks.pm 2010-06-01 13:04:48 UTC (rev 9510)
@@ -466,7 +466,8 @@
my $cmp_op = $direction eq 'desc' ? '>' : '<';
my $count_tbl_alias = 'rownum__emulation';
- my $order_group_having = $self->_parse_rs_attrs($rs_attrs);
+ my $order_sql = $self->_order_by (delete $rs_attrs->{order_by});
+ my $group_having_sql = $self->_parse_rs_attrs($rs_attrs);
# add the order supplement (if any) as this is what will be used for the outer WHERE
$in_sel .= ", $_" for keys %{$extra_order_sel||{}};
@@ -474,9 +475,10 @@
$sql = sprintf (<<EOS,
SELECT $out_sel
FROM (
- SELECT $in_sel ${sql}${order_group_having}
+ SELECT $in_sel ${sql}${group_having_sql}
) %s
WHERE ( SELECT COUNT(*) FROM %s %s WHERE %s $cmp_op %s ) %s
+$order_sql
EOS
( map { $self->_quote ($_) } (
$rs_attrs->{alias},
Modified: DBIx-Class/0.08/trunk/t/sqlahacks/limit_dialects/generic_subq.t
===================================================================
--- DBIx-Class/0.08/trunk/t/sqlahacks/limit_dialects/generic_subq.t 2010-06-01 11:36:37 UTC (rev 9509)
+++ DBIx-Class/0.08/trunk/t/sqlahacks/limit_dialects/generic_subq.t 2010-06-01 13:04:48 UTC (rev 9510)
@@ -28,7 +28,6 @@
FROM books me
JOIN owners owner ON owner.id = me.owner
WHERE ( source = ? )
- ORDER BY me.title
) me
WHERE
(
@@ -36,6 +35,7 @@
FROM books rownum__emulation
WHERE rownum__emulation.title < me.title
) < 2
+ ORDER BY me.title
)',
[ [ 'source', 'Library' ] ],
);
@@ -69,7 +69,6 @@
FROM "books" "me"
JOIN "owners" "owner" ON "owner"."id" = "me"."owner"
WHERE ( "source" = ? )
- ORDER BY "title" DESC
) "me"
WHERE
(
@@ -77,6 +76,7 @@
FROM "books" "rownum__emulation"
WHERE "rownum__emulation"."title" > "me"."title"
) BETWEEN 1 AND 3
+ ORDER BY "title" DESC
)',
[ [ 'source', 'Library' ] ],
);
@@ -104,7 +104,6 @@
FROM "books" "me"
JOIN "owners" "owner" ON "owner"."id" = "me"."owner"
WHERE ( "source" = ? )
- ORDER BY "title"
) "me"
WHERE
(
@@ -112,6 +111,7 @@
FROM "books" "rownum__emulation"
WHERE "rownum__emulation"."title" < "me"."title"
) BETWEEN 1 AND 4294967295
+ ORDER BY "title"
)',
[ [ 'source', 'Library' ] ],
);
More information about the Bast-commits
mailing list