Revision history for DBIx::Class
+ - add horrific fix to make Oracle's retarded limit syntax work
+
0.05003 2006-02-08 17:50:20
- add component_class accessors and use them for *_class
- small fixes to Serialize and ResultSetManager
return $self->SUPER::_quote($label);
}
+sub _RowNum {
+ my $self = shift;
+ my $c;
+ $_[0] =~ s/SELECT (.*?) FROM/
+ 'SELECT '.join(', ', map { $_.' AS col'.++$c } split(', ', $1)).' FROM'/e;
+ $self->SUPER::_RowNum(@_);
+}
+
# Accessor for setting limit dialect. This is useful
# for JDBC-bridge among others where the remote SQL-dialect cannot
# be determined by the name of the driver alone.
--- /dev/null
+use strict;
+use warnings;
+
+use Test::More;
+use DBIx::Class::Storage::DBI;
+
+plan tests => 1;
+
+my $sa = new DBIC::SQL::Abstract;
+
+$sa->limit_dialect('RowNum');
+
+is($sa->select('rubbish',
+ [ 'foo.id', 'bar.id' ],
+ undef, undef, 1, 3),
+ 'SELECT * FROM
+(
+ SELECT A.*, ROWNUM r FROM
+ (
+ SELECT foo.id AS col1, bar.id AS col2 FROM rubbish
+ ) A
+ WHERE ROWNUM < 5
+) B
+WHERE r >= 4
+', 'Munged stuff to make Oracle not explode');