Fixed a bug with DBI iterators and made the tets self-bootstrapping and added the...
[dbsrgits/DBM-Deep.git] / lib / DBM / Deep.pm
index 94c296f..bf507fc 100644 (file)
@@ -57,73 +57,6 @@ sub new {
     my $args = $class->_get_args( @_ );
     my $self;
     
-=pod
-    if (exists $args->{dbi}) {
-        eval {
-            require DBIx::Abstract;
-        }; if ( $@ ) {
-            __PACKAGE__->_throw_error('DBIx::Abstract not installed. You cannot use the SQL mode.');
-        }
-        unless (UNIVERSAL::isa($args->{dbi}, 'DBIx::Abstract')) {
-            $args->{dbi} = DBIx::Abstract->connect($args->{dbi});
-        }
-
-        if (defined $args->{id}) {
-            unless ($args->{id} =~ /^\d+$/ && $args->{id} > 0) {
-                __PACKAGE__->_throw_error('Invalid SQL record id');
-            }
-            my $util = {dbi => $args->{dbi}};
-            bless $util, 'DBM::Deep::SQL::Util';
-            my $q = $util->_select(
-                table  => 'rec_item',
-                fields => 'item_type',
-                where  => {id => $args->{id}},
-            );
-            if ($q->[0]->[0] eq 'array') {
-                $args->{type} = TYPE_ARRAY;
-            }
-            elsif ($q->[0]->[0] eq 'hash') {
-                $args->{type} = TYPE_HASH;
-            }
-            else {
-                DBM::Deep->_throw_error('Unknown SQL record id');
-            }
-        }
-        else {
-            my $util = {dbi => $args->{dbi}};
-            bless $util, 'DBM::Deep::SQL::Util';
-            if (defined($args->{type}) && $args->{type} eq TYPE_ARRAY) {
-                $args->{id} = $util->_create('array');
-            }
-            else {
-                $args->{id} = $util->_create('hash');
-            }
-        }
-
-        if (defined($args->{type}) && $args->{type} eq TYPE_ARRAY) {
-            $class = 'DBM::Deep::SQL::Array';
-            require DBM::Deep::SQL::Array;
-            tie @$self, $class, %$args;
-            if ($args->{prefetch}) {
-                (tied(@$self))->_prefetch();
-            }
-            return bless $self, $class;
-        }
-        else {
-            $class = 'DBM::Deep::SQL::Hash';
-            require DBM::Deep::SQL::Hash;
-            tie %$self, $class, %$args;
-            if ($args->{prefetch}) {
-                (tied(%$self))->_prefetch();
-            }
-            return bless $self, $class;
-        }
-    }
-=cut
-
-    ##
-    # Check if we want a tied hash or array.
-    ##
     if (defined($args->{type}) && $args->{type} eq TYPE_ARRAY) {
         $class = 'DBM::Deep::Array';
         require DBM::Deep::Array;