Codebase list libdbix-class-perl / 113e3dd
-> This version fixes core regressions, which is a subtle bug because the module just starts to return bad data... Recommend upgrade immediately. Jonathan Yu 14 years ago
9 changed file(s) with 40 addition(s) and 39 deletion(s). Raw diff Collapse all Expand all
00 Revision history for DBIx::Class
1
2 0.08106 2009-06-11 21:42:00 (UTC)
3 - Switched SQLite storage driver to DateTime::Format::SQLite
4 (proper timezone handling)
5 - Fix more test problems
16
27 0.08105 2009-06-11 19:04:00 (UTC)
38 - Update of numeric columns now properly uses != to determine
4949 MailingList: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
5050 license: http://dev.perl.org/licenses/
5151 repository: http://dev.catalyst.perl.org/svnweb/bast/browse/DBIx-Class/
52 version: 0.08105
52 version: 0.08106
0 libdbix-class-perl (0.08105-1) unstable; urgency=low
0 libdbix-class-perl (0.08106-1) unstable; urgency=low
11
22 [ Jonathan Yu ]
33 * New upstream release (many bugfixes, no feature changes)
4 -> This version fixes core regressions, which is a subtle bug because
5 the module just starts to return bad data... Recommend upgrade
6 immediately.
47 * Added /me to uploaders & copyright
58 * Updated M::I information
69
278278 my $count = $rs->count;
279279
280280 # Equivalent SQL:
281 # SELECT COUNT( DISTINCT( me.name ) ) FROM artist me
281 # SELECT COUNT( * ) FROM (SELECT me.name FROM artist me GROUP BY me.name) count_subq:
282282
283283 =head2 Grouping results
284284
19261926
19271927 sub as_query {
19281928 my $self = shift;
1929 return $self->result_source->storage->as_query($self->_resolved_attrs);
1929
1930 my $attrs = $self->_resolved_attrs_copy;
1931
1932 my ($sqlbind, $bind_attrs) = $self->result_source->storage
1933 ->_select_args_to_query ($attrs->{from}, $attrs->{select}, $attrs->{where}, $attrs);
1934
1935 return $sqlbind;
19301936 }
19311937
19321938 =head2 find_or_new
909909 return ($sql, \@bind);
910910 }
911911
912 =head2 as_query
913
914 =over 4
915
916 =item Arguments: $rs_attrs
917
918 =item Return Value: \[ $sql, @bind ]
919
920 =back
921
922 Returns the SQL statement and bind vars that would result from the given
923 ResultSet attributes (does not actually run a query)
924
925 =cut
926
927 sub as_query {
928 my ($self, $rs_attr) = @_;
929
930 my $sql_maker = $self->sql_maker;
931 local $sql_maker->{for};
932
933 # my ($op, $bind, $ident, $bind_attrs, $select, $cond, $order, $rows, $offset) = $self->_select_args(...);
934 my @args = $self->_select_args($rs_attr->{from}, $rs_attr->{select}, $rs_attr->{where}, $rs_attr);
935
936 # my ($sql, $bind) = $self->_prep_for_execute($op, $bind, $ident, [ $select, $cond, $order, $rows, $offset ]);
937 my ($sql, $bind) = $self->_prep_for_execute(
938 @args[0 .. 2],
939 [ @args[4 .. $#args] ],
940 );
941 return \[ "($sql)", @{ $bind || [] }];
942 }
943912
944913 sub _fix_bind_params {
945914 my ($self, @bind) = @_;
12241193 my $sql_maker = $self->sql_maker;
12251194 local $sql_maker->{for};
12261195 return $self->_execute($self->_select_args(@_));
1196 }
1197
1198 sub _select_args_to_query {
1199 my $self = shift;
1200
1201 my $sql_maker = $self->sql_maker;
1202 local $sql_maker->{for};
1203
1204 # my ($op, $bind, $ident, $bind_attrs, $select, $cond, $order, $rows, $offset)
1205 # = $self->_select_args($ident, $select, $cond, $attrs);
1206 my ($op, $bind, $ident, $bind_attrs, @args) =
1207 $self->_select_args(@_);
1208
1209 # my ($sql, $bind) = $self->_prep_for_execute($op, $bind, $ident, [ $select, $cond, $order, $rows, $offset ]);
1210 my ($sql, $prepared_bind) = $self->_prep_for_execute($op, $bind, $ident, \@args);
1211
1212 return \[ "($sql)", @{ $prepared_bind || [] }];
12271213 }
12281214
12291215 sub _select_args {
2323 # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports
2424 # brain damage and presumably various other packaging systems too
2525
26 $VERSION = '0.08105';
26 $VERSION = '0.08106';
2727
2828 $VERSION = eval $VERSION; # numify for warning-free dev releases
2929
1010
1111 plan tests => 106;
1212
13 eval { require DateTime::Format::MySQL };
13 eval { require DateTime::Format::SQLite };
1414 my $NO_DTFM = $@ ? 1 : 0;
1515
1616 my @art = $schema->resultset("Artist")->search({ }, { order_by => 'name DESC'});
194194
195195 # get_inflated_columns w/relation and accessor alias
196196 SKIP: {
197 skip "This test requires DateTime::Format::MySQL", 8 if $NO_DTFM;
197 skip "This test requires DateTime::Format::SQLite", 8 if $NO_DTFM;
198198
199199 isa_ok($new->updated_date, 'DateTime', 'have inflated object via accessor');
200200 my %tdata = $new->get_inflated_columns;
388388
389389 # test get_inflated_columns with objects
390390 SKIP: {
391 skip "This test requires DateTime::Format::MySQL", 5 if $NO_DTFM;
391 skip "This test requires DateTime::Format::SQLite", 5 if $NO_DTFM;
392392 my $event = $schema->resultset('Event')->search->first;
393393 my %edata = $event->get_inflated_columns;
394394 is($edata{'id'}, $event->id, 'got id');
5050
5151 # Make sure the carp/croak override in SQLA works (via SQLAHacks)
5252 my $file = __FILE__;
53 $file = "\Q$file\E";
5354 throws_ok (sub {
5455 $schema->resultset ('Artist')->search ({}, { order_by => { -asc => 'stuff', -desc => 'staff' } } )->as_query;
5556 }, qr/$file/, 'Exception correctly croak()ed');