Permalink
Browse files

Release 0.2005

  • Loading branch information...
1 parent 239800f commit 0bd3c09affbe8c111accc5e7ea82ce531f15886b @muir committed Mar 10, 2012
Showing with 117 additions and 182 deletions.
  1. +3 −0 CHANGELOG
  2. +13 −3 Makefile.PL
  3. +62 −146 README
  4. +1 −2 lib/OOPS.pm
  5. +13 −12 lib/OOPS/DBO.pm
  6. +1 −2 lib/OOPS/DBOdebug.pm
  7. +1 −2 lib/OOPS/Setup.pm
  8. +1 −2 lib/OOPS/pg.pm
  9. +1 −2 lib/OOPS/sqlite2.pm
  10. +2 −2 lib/OOPS/sqlite_v3.pm
  11. +3 −0 summary
  12. +11 −4 t/OOPS/TestSetup.pm
  13. +1 −1 t/integrety1001.t
  14. +4 −4 t/misc2.t
View
@@ -29,6 +29,9 @@
With version 9.1, even less auto-conversion happens
so 0 != '0'.
+ Postgres is no longer tested against the original schmma
+ version.
+
SQLite:
Error messages for SQLite version 2 have changed a bit.
View
@@ -6,9 +6,19 @@ WriteMakefile(
NAME => 'OOPS',
DISTNAME => 'OOPS',
VERSION_FROM => 'lib/OOPS.pm',
- ($] >= 5.005 ?
- ('ABSTRACT' => 'Store any object in a RDBMS',
- 'AUTHOR' => 'David Muir Sharnoff <muir@idiom.org>') : ()),
+ ($] >= 5.005
+ ?
+ (
+ ABSTRACT => 'Store any object in a RDBMS',
+ AUTHOR => 'David Muir Sharnoff <cpan@dave.sharnoff.org>',
+ META_MERGE => {
+ resources => {
+ repository => 'http://github.com/muir/OOPS',
+ },
+ },
+ )
+ : ()
+ ),
dist => {COMPRESS=>'gzip', SUFFIX=>'gz'},
PREREQ_PM => {
'DBI' => 1.40,
View
208 README

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,7 +1,7 @@
package OOPS;
-our $VERSION = 0.2004;
+our $VERSION = 0.2005;
our $SCHEMA_VERSION = 1005;
require 5.008002;
@@ -18,7 +18,6 @@ use Carp qw(confess longmess verbose croak longmess);
use Scalar::Util qw(refaddr reftype blessed weaken);
use Hash::Util qw(lock_keys);
use B qw(svref_2object);
-use UNIVERSAL qw(can);
require OOPS::DBO;
#
View
@@ -13,7 +13,6 @@ package OOPS::DBO;
use strict;
use warnings;
use Carp;
-use UNIVERSAL qw(can);
use Scalar::Util qw(weaken);
require OOPS::DBOdebug;
require Exporter;
@@ -111,15 +110,6 @@ sub dbiconnect
unless $database =~ /^dbi:($backends)\b/i;
die "no database specified" unless $database;
my $dbms = "\L$1";
- require "OOPS/$dbms.pm";
-
- unless ($loaded{$dbms}++) {
- my $f = can("OOPS::$dbms", "deadlock_rx") || die;
- my @dl_rx = $f->();
- @deadlock_rx{@dl_rx} = ($dbms) x @dl_rx;
- my $rx = join('|', keys %deadlock_rx);
- $OOPS::transfailrx = qr/$rx/;
- }
my $dbh;
unless ($args->{no_dbh}) {
@@ -137,12 +127,23 @@ sub dbiconnect
if $OOPS::debug_queries & 32;
}
- my $tmode = can("OOPS::$dbms", "tmode") || die;
+ require "OOPS/$dbms.pm";
+
+ my $dboclass = "OOPS::$dbms";
+ unless ($loaded{$dbms}++) {
+ my $f = $dboclass->can("deadlock_rx") || die;
+ my @dl_rx = $f->();
+ @deadlock_rx{@dl_rx} = ($dbms) x @dl_rx;
+ my $rx = join('|', keys %deadlock_rx);
+ $OOPS::transfailrx = qr/$rx/;
+ }
+
+ my $tmode = $dboclass->can("tmode") || die;
&$tmode(undef, $dbh, $args->{readonly} || 0);
return $dbh unless wantarray;
- my $new = can("OOPS::$dbms", "new") || die;
+ my $new = $dboclass->can("new") || die;
my $dbo = &$new("OOPS::$dbms",
table_prefix => $prefix,
database => $database,
View
@@ -43,7 +43,6 @@ package OOPS::DBO::DBIdebug;
use strict;
use warnings;
-use UNIVERSAL qw(can);
use Carp qw(confess longmess);
use POSIX qw(EAGAIN ENOENT EEXIST O_RDWR);
use Fcntl qw(LOCK_SH LOCK_EX LOCK_NB LOCK_UN);
@@ -90,7 +89,7 @@ sub AUTOLOAD
my $a = $AUTOLOAD;
$a =~ s/.*:://;
die "USING AUTOLOAD ON $self->{dbh} ->$a()\n";
- my $method = can($self->{dbh},$a) || can($self->{dbh}, $AUTOLOAD) || confess "cannot find method $a for $self->[0]";
+ my $method = $self->{dbh}->can($a) || $self->{dbh}->can($AUTOLOAD) || confess "cannot find method $a for $self->[0]";
my @r;
if (wantarray) {
@r = &$method($self->{dbh}, @_);
View
@@ -8,7 +8,6 @@ package OOPS::Setup; # dummy
package OOPS;
-use UNIVERSAL;
use strict;
use warnings;
@@ -75,8 +74,8 @@ sub load_failure
{
my ($oops, $err) = @_;
- print "load_failure($err)\n" if $OOPS::debug_setup;
my $nodatarx = $oops->{dbo}->nodata_rx;
+ print "load_failure($err) -- compare to $nodatarx\n" if $OOPS::debug_setup;
return 0 unless $err =~ /$nodatarx/;
die "DBMS not initialized - use auto_initialize or initial_setup()\n"
View
@@ -300,7 +300,6 @@ package OOPS::pg::sth;
use strict;
use warnings;
-use UNIVERSAL qw(can);
use Carp qw(confess);
use DBD::Pg qw(:pg_types);
@@ -336,7 +335,7 @@ sub AUTOLOAD
our $AUTOLOAD;
my $a = $AUTOLOAD;
$a =~ s/.*:://;
- my $method = can($self->[0],$a) || can($self->[0], $AUTOLOAD) || confess "cannot find method $a for $self->[0]";
+ my $method = $self->[0]->can($a) || $self->[0]->can($AUTOLOAD) || confess "cannot find method $a for $self->[0]";
&$method($self->[0], @_);
}
View
@@ -34,8 +34,7 @@ sub lock_object {}
sub deadlock_rx
{
return (
- qr/database is locked/,
- qr/database is locked\(\d+\) at dbdimp\.c line /,
+ qr/database is locked(?:\(\d+\) at dbdimp\.c line )?/,
qr/unable to open database file\(\d+\) at dbdimp\.c line/,
);
}
View
@@ -30,14 +30,14 @@ sub lock_object {}
sub deadlock_rx
{
return (
- qr/database is locked\(\d+\) at dbdimp\.c line /,
+ qr/database is locked(?:\(\d+\) at dbdimp\.c line )?/,
qr/unable to open database file\(\d+\) at dbdimp\.c line/,
);
}
sub nodata_rx
{
- return qr/no such table: \S+object\(1\) at dbdimp\.c/;
+ return qr/no such table: \S+object(?:\(1\) at dbdimp\.c)?/;
}
sub initialize
View
@@ -10,6 +10,9 @@ my @files = sort(read_dir("results"));
# my $aggregate = TAP::Parser::Aggregator->new;
foreach my $file (@files) {
+ if (@ARGV) {
+ next unless $file =~ /$ARGV[0]/;
+ }
my $s = TAP::Parser::Source->new;
$s->source([ '/bin/cat', "results/$file" ]);
my $parser = TAP::Parser->new( { source => $s });
View
@@ -36,11 +36,18 @@ sub import
print "1..0 # skip run this by hand or set \$ENV{OOPSTEST_SLOW}\n";
exit;
}
- } elsif ($a =~ /^:(.+)/) {
- my $dbd = $1;
+ } elsif ($a =~ /^:(-)?(.+)/) {
+ my $dbd = $2;
if ($dbi{$dbd}) {
- $dbicheck = $dbd if ($ENV{OOPSTEST_DSN} && $ENV{OOPSTEST_DSN} =~ /^dbi:$dbd\b/i);
- push(@supported, $dbi{$dbd});
+ if ($1) {
+ if ($ENV{OOPSTEST_DSN} && $ENV{OOPSTEST_DSN} =~ /^dbi:$dbd\b/i) {
+ print "1..0 # skip this test not for $dbi{$dbd}\n";
+ exit;
+ }
+ } else {
+ $dbicheck = $dbd if ($ENV{OOPSTEST_DSN} && $ENV{OOPSTEST_DSN} =~ /^dbi:$dbd\b/i);
+ push(@supported, $dbi{$dbd});
+ }
} else {
die "Bad import spec: $a";
}
View
@@ -2,7 +2,7 @@
use FindBin;
use lib $FindBin::Bin;
-use OOPS::TestSetup qw(:slow :filter :mysql :pg :sqlite Data::Dumper Clone::PP);
+use OOPS::TestSetup qw(:slow :filter :mysql :sqlite Data::Dumper Clone::PP);
import Clone::PP qw(clone);
use OOPS::OOPS1001;
use Carp qw(confess);
View
@@ -78,13 +78,13 @@ resetall; # --------------------------------------------------
COMPARE
CP_VIRTUAL
- $tcTODO = "Mysql columns are a bit narrow" if $r1->{dbo}{dbms} eq 'mysql';
+ $::width = $r1->{dbo}{dbms} eq 'mysql' ? 37 : 57;
%$root = ();
- my $x = getref(%$root, 'FOO23' x 57);
- $root->{'FOO23' x 57} = \$x;
+ my $x = getref(%$root, 'FOO23' x $::width);
+ $root->{'FOO23' x $::width} = \$x;
CP_COMMIT
CP_COMPARE
- delete $root->{'FOO23' x 57};
+ delete $root->{'FOO23' x $::width};
CP_COMPARE
CP_COMMIT
COMPARE

0 comments on commit 0bd3c09

Please sign in to comment.