Merge 'trunk' into 'sybase'
Rafael Kitover [Fri, 12 Jun 2009 00:05:30 +0000 (00:05 +0000)]
r5443@hlagh (orig r6597):  ribasushi | 2009-06-10 05:48:39 -0700
Adjust changelog
r5446@hlagh (orig r6600):  ribasushi | 2009-06-10 06:50:43 -0700
Release 0.08104
r5467@hlagh (orig r6614):  ribasushi | 2009-06-11 05:29:48 -0700
Move around inflation tests
r5468@hlagh (orig r6615):  ribasushi | 2009-06-11 05:32:07 -0700
explicitly remove manifest on author mode make
r5469@hlagh (orig r6616):  ribasushi | 2009-06-11 06:02:41 -0700
IC::DT changes:
Switch SQLite storage to DT::F::SQLite
Fix exception when undef_if_invalid and timezone are both set on a column
Split t/89inflate_datetime into separate tests
Adjust makefile author dependencies
r5470@hlagh (orig r6617):  ribasushi | 2009-06-11 06:07:41 -0700
Move file_column test to inflate/ too
r5472@hlagh (orig r6620):  ribasushi | 2009-06-11 07:16:20 -0700
 r5713@Thesaurus (orig r5712):  ribasushi | 2009-03-08 23:53:28 +0100
 Branch for datatype-aware updates
 r6604@Thesaurus (orig r6603):  ribasushi | 2009-06-10 18:08:25 +0200
 Test for type-aware update
 r6607@Thesaurus (orig r6606):  ribasushi | 2009-06-10 19:57:04 +0200
 Datatype aware update works
 r6609@Thesaurus (orig r6608):  ribasushi | 2009-06-10 20:06:40 +0200
 Whoops
 r6614@Thesaurus (orig r6613):  ribasushi | 2009-06-11 09:23:54 +0200
 Add attribute doc
 r6620@Thesaurus (orig r6619):  ribasushi | 2009-06-11 16:15:53 +0200
 Use equality, not comparison

r5474@hlagh (orig r6622):  ribasushi | 2009-06-11 07:21:53 -0700
Changes
r5486@hlagh (orig r6635):  ribasushi | 2009-06-11 12:29:10 -0700
Release 0.08105
r5487@hlagh (orig r6636):  frew | 2009-06-11 13:02:11 -0700
Escape filename so that t\9... won't look like octal
r5488@hlagh (orig r6637):  ribasushi | 2009-06-11 13:09:55 -0700
Adjust tests for the DT::F::MySQL -> DT::F::SQLite change
r5489@hlagh (orig r6638):  arcanez | 2009-06-11 13:29:53 -0700
cookbook tweak for count distinct
r5490@hlagh (orig r6639):  ribasushi | 2009-06-11 14:39:12 -0700
Factor out as_query properly
r5491@hlagh (orig r6640):  ribasushi | 2009-06-11 14:50:41 -0700
Release 0.08106
r5493@hlagh (orig r6642):  caelum | 2009-06-11 16:48:28 -0700
add support for DBICTEST_MSSQL_PERL5LIB to 74mssql.t

1  2 
Makefile.PL
lib/DBIx/Class/Storage/DBI.pm

diff --combined Makefile.PL
@@@ -73,12 -73,17 +73,17 @@@ my %force_requires_if_author = 
    'Test::Memory::Cycle'       => 0,
    'Devel::Cycle'              => 1.10,
  
+   # t/inflate/datetime*.t
+   # t/72.pg
+   # t/36datetime.t
    # t/60core.t
+   'DateTime::Format::SQLite'  => 0,
    'DateTime::Format::MySQL'   => 0,
-   
-   # t/89inflate_datetime.t
    'DateTime::Format::Pg'      => 0,
  
+   # t/96_is_deteministic_value.t
+   'DateTime::Format::Strptime' => 0,
    # t/72pg.t
    $ENV{DBICTEST_PG_DSN}
      ? ('Sys::SigAction'=> 0)
@@@ -92,9 -97,6 +97,8 @@@
    'namespace::clean'              => 0.11,
    'Hash::Merge',                  => 0.11,
  
-   # t/96_is_deteministic_value.t
 +  # t/746sybase.t
 +  'DateTime::Format::Strptime' => 0,
  );
  
  if ($Module::Install::AUTHOR) {
@@@ -113,12 -115,16 +117,16 @@@ EO
      build_requires ($module => $force_requires_if_author{$module});
    }
  
+   print "Regenerating README\n";
    system('pod2text lib/DBIx/Class.pm > README');
- }
  
- auto_provides;
+   if (-f 'MANIFEST') {
+     print "Removing MANIFEST\n";
+     unlink 'MANIFEST';
+   }
+ }
  
- auto_install;
+ auto_install();
  
  WriteAll();
  
@@@ -910,37 -910,6 +910,6 @@@ sub _prep_for_execute 
    return ($sql, \@bind);
  }
  
- =head2 as_query
- =over 4
- =item Arguments: $rs_attrs
- =item Return Value: \[ $sql, @bind ]
- =back
- Returns the SQL statement and bind vars that would result from the given
- ResultSet attributes (does not actually run a query)
- =cut
- sub as_query {
-   my ($self, $rs_attr) = @_;
-   my $sql_maker = $self->sql_maker;
-   local $sql_maker->{for};
-   # my ($op, $bind, $ident, $bind_attrs, $select, $cond, $order, $rows, $offset) = $self->_select_args(...);
-   my @args = $self->_select_args($rs_attr->{from}, $rs_attr->{select}, $rs_attr->{where}, $rs_attr);
-   # my ($sql, $bind) = $self->_prep_for_execute($op, $bind, $ident, [ $select, $cond, $order, $rows, $offset ]);
-   my ($sql, $bind) = $self->_prep_for_execute(
-     @args[0 .. 2],
-     [ @args[4 .. $#args] ],
-   );
-   return \[ "($sql)", @{ $bind || [] }];
- }
  
  sub _fix_bind_params {
      my ($self, @bind) = @_;
          } @bind;
  }
  
 +sub _flatten_bind_params {
 +    my ($self, @bind) = @_;
 +
 +    ### Turn @bind from something like this:
 +    ###   ( [ "artist", 1 ], [ "cdid", 1, 3 ] )
 +    ### to this:
 +    ###   ( 1, 1, 3 )
 +    return
 +        map {
 +            if ( defined( $_ && $_->[1] ) ) {
 +                @{$_}[ 1 .. $#$_ ];
 +            }
 +            else { undef; }
 +        } @bind;
 +}
 +
  sub _query_start {
      my ( $self, $sql, @bind ) = @_;
  
@@@ -1243,6 -1196,23 +1212,23 @@@ sub _select 
    return $self->_execute($self->_select_args(@_));
  }
  
+ sub _select_args_to_query {
+   my $self = shift;
+   my $sql_maker = $self->sql_maker;
+   local $sql_maker->{for};
+   # my ($op, $bind, $ident, $bind_attrs, $select, $cond, $order, $rows, $offset) 
+   #  = $self->_select_args($ident, $select, $cond, $attrs);
+   my ($op, $bind, $ident, $bind_attrs, @args) =
+     $self->_select_args(@_);
+   # my ($sql, $bind) = $self->_prep_for_execute($op, $bind, $ident, [ $select, $cond, $order, $rows, $offset ]);
+   my ($sql, $prepared_bind) = $self->_prep_for_execute($op, $bind, $ident, \@args);
+   return \[ "($sql)", @{ $prepared_bind || [] }];
+ }
  sub _select_args {
    my ($self, $ident, $select, $condition, $attrs) = @_;
  
@@@ -1325,20 -1295,13 +1311,20 @@@ sub _resolve_ident_sources 
    return $alias2source;
  }
  
 -sub count {
 +sub _copy_attributes_for_count {
    my ($self, $source, $attrs) = @_;
 +  my %attrs = %$attrs;
 +
 +  # take off any column specs, any pagers, record_filter is cdbi, and no point of ordering a count
 +  delete @attrs{qw/select as rows offset page order_by record_filter/};
  
 -  my $tmp_attrs = { %$attrs };
 +  return \%attrs;
 +}
 +
 +sub count {
 +  my ($self, $source, $attrs) = @_;
  
 -  # take off any pagers, record_filter is cdbi, and no point of ordering a count
 -  delete $tmp_attrs->{$_} for (qw/select as rows offset page order_by record_filter/);
 +  my $tmp_attrs = $self->_copy_attributes_for_count($source, $attrs);
  
    # overwrite the selector
    $tmp_attrs->{select} = { count => '*' };
@@@ -1582,6 -1545,27 +1568,27 @@@ sub bind_attribute_by_data_type 
      return;
  }
  
+ =head2 is_datatype_numeric
+ Given a datatype from column_info, returns a boolean value indicating if
+ the current RDBMS considers it a numeric value. This controls how
+ L<DBIx::Class::Row/set_column> decides whether to mark the column as
+ dirty - when the datatype is deemed numeric a C<< != >> comparison will
+ be performed instead of the usual C<eq>.
+ =cut
+ sub is_datatype_numeric {
+   my ($self, $dt) = @_;
+   return 0 unless $dt;
+   return $dt =~ /^ (?:
+     numeric | int(?:eger)? | (?:tiny|small|medium|big)int | dec(?:imal)? | real | float | double (?: \s+ precision)? | (?:big)?serial
+   ) $/ix;
+ }
  =head2 create_ddl_dir (EXPERIMENTAL)
  
  =over 4