'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)
'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) {
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();
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 ) = @_;
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) = @_;
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 => '*' };
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