sub insert {
my ($self, @rest) = @_;
$self->next::method(@rest);
-
+
return $self if $self->nocache;
- # Because the insert will die() if it can't insert into the db (or should)
- # we can be sure the object *was* inserted if we got this far. In which
- # case, given primary keys are unique and ID only returns a
- # value if the object has all its primary keys, we can be sure there
- # isn't a real one in the object index already because such a record
- # cannot have existed without the insert failing.
+ # Because the insert will die() if it can't insert into the db (or should)
+ # we can be sure the object *was* inserted if we got this far. In which
+ # case, given primary keys are unique and ID only returns a
+ # value if the object has all its primary keys, we can be sure there
+ # isn't a real one in the object index already because such a record
+ # cannot have existed without the insert failing.
if (my $key = $self->ID) {
my $live = $self->live_object_index;
weaken($live->{$key} = $self);
if ++$self->live_object_init_count->{count}
% $self->purge_object_index_every == 0;
}
- #use Data::Dumper; warn Dumper($self);
+
return $self;
}
if (ref $query eq 'ARRAY') {
foreach my $subquery (@$query) {
next unless ref $subquery; # -or
-# warn "ARRAY: " . Dumper $subquery;
$collapsed = $self->_collapse_query($subquery, $collapsed);
}
}
elsif (ref $query eq 'HASH') {
if (keys %$query and (keys %$query)[0] eq '-and') {
foreach my $subquery (@{$query->{-and}}) {
-# warn "HASH: " . Dumper $subquery;
$collapsed = $self->_collapse_query($subquery, $collapsed);
}
}
else {
-# warn "LEAF: " . Dumper $query;
foreach my $col (keys %$query) {
my $value = $query->{$col};
$collapsed->{$col}{$value}++;
if (ref $cond eq 'ARRAY') {
foreach my $subcond (@$cond) {
next unless ref $subcond; # -or
-# warn "ARRAY: " . Dumper $subcond;
$collapsed = $self->_collapse_cond($subcond, $collapsed);
}
}
elsif (ref $cond eq 'HASH') {
if (keys %$cond and (keys %$cond)[0] eq '-and') {
foreach my $subcond (@{$cond->{-and}}) {
-# warn "HASH: " . Dumper $subcond;
$collapsed = $self->_collapse_cond($subcond, $collapsed);
}
}
else {
-# warn "LEAF: " . Dumper $cond;
foreach my $col (keys %$cond) {
my $value = $cond->{$col};
$collapsed->{$col} = $value;
$self->throw_exception("No idea how to resolve join reftype ".ref $join);
} else {
my $count = ++$seen->{$join};
- #use Data::Dumper; warn Dumper($seen);
my $as = ($count > 1 ? "${join}_${count}" : $join);
my $rel_info = $self->relationship_info($join);
$self->throw_exception("No such relationship ${join}") unless $rel_info;
sub resolve_prefetch {
my ($self, $pre, $alias, $seen, $order, $collapse) = @_;
$seen ||= {};
- #$alias ||= $self->name;
- #warn $alias, Dumper $pre;
if( ref $pre eq 'ARRAY' ) {
return
map { $self->resolve_prefetch( $_, $alias, $seen, $order, $collapse ) }
$self->related_source($_)->resolve_prefetch(
$pre->{$_}, "${alias}.$_", $seen, $order, $collapse)
} keys %$pre;
- #die Dumper \@ret;
return @ret;
}
elsif( ref $pre ) {
return map { [ "${as}.$_", "${as_prefix}${pre}.$_", ] }
$rel_source->columns;
- #warn $alias, Dumper (\@ret);
- #return @ret;
}
}
$self->throw_exception( "Can't get last insert id" )
unless (@ids == @auto_pri);
$self->store_column($auto_pri[$_] => $ids[$_]) for 0 .. $#ids;
-#use Data::Dumper; warn Dumper($self);
}
use warnings;
use base 'DBIx::Class';
use POSIX 'strftime';
-use Data::Dumper;
__PACKAGE__->mk_classdata('_filedata');
__PACKAGE__->mk_classdata('upgrade_directory');
sub _strip_outer_paren {
my ($self, $arg) = @_;
-use Data::Dumper;
-
return $self->_SWITCH_refkind ($arg, {
ARRAYREFREF => sub {
$$arg->[0] = __strip_outer_paren ($$arg->[0]);
# @bind = map { ref $_ ? ''.$_ : $_ } @bind; # stringify args
## This must be an arrayref, else nothing works!
-
my $tuple_status = [];
-
- ##use Data::Dumper;
- ##print STDERR Dumper( $data, $sql, [@bind] );
-
- my $time = time();
## Get the bind_attributes, if any exist
my $bind_attributes = $self->source_bind_attributes($source);
sub new {
my ($class, $storage, $args, $attrs) = @_;
- #use Data::Dumper; warn Dumper(@_);
$class = ref $class if ref $class;
+
my $new = {
storage => $storage,
args => $args,
$DEBUG = 0 unless defined $DEBUG;
use Exporter;
-use Data::Dumper;
use SQL::Translator::Utils qw(debug normalize_name);
use base qw(Exporter);
use SQL::Translator::Schema::Constants;
use SQL::Translator::Utils qw(header_comment);
+use Data::Dumper ();
## Skip all column type translation, as we want to use whatever the parser got.