[Bast-commits] r3304 - in trunk/DBIx-Class-Journal: lib/DBIx/Class
lib/DBIx/Class/Schema t/lib
castaway at dev.catalyst.perl.org
castaway at dev.catalyst.perl.org
Fri May 11 15:21:40 GMT 2007
Author: castaway
Date: 2007-05-11 15:21:39 +0100 (Fri, 11 May 2007)
New Revision: 3304
Modified:
trunk/DBIx-Class-Journal/lib/DBIx/Class/Journal.pm
trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal.pm
trunk/DBIx-Class-Journal/t/lib/DBICTest.pm
Log:
Fix "inserting audit_log twice" bug, start on allowing using the same schema
Modified: trunk/DBIx-Class-Journal/lib/DBIx/Class/Journal.pm
===================================================================
--- trunk/DBIx-Class-Journal/lib/DBIx/Class/Journal.pm 2007-05-11 14:16:30 UTC (rev 3303)
+++ trunk/DBIx-Class-Journal/lib/DBIx/Class/Journal.pm 2007-05-11 14:21:39 UTC (rev 3304)
@@ -17,6 +17,7 @@
{
my ($self) = @_;
+ return if($self->in_storage);
## create new transaction here?
my $res = $self->next::method();
if($self->in_storage)
Modified: trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal.pm
===================================================================
--- trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal.pm 2007-05-11 14:16:30 UTC (rev 3303)
+++ trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal.pm 2007-05-11 14:21:39 UTC (rev 3304)
@@ -23,6 +23,15 @@
$self->next::method(@_);
}
+# sub load_classes
+# {
+# my $class = shift;
+
+
+# $class->next::method(@_);
+
+# }
+
sub connection
{
my $self = shift;
@@ -30,12 +39,21 @@
# print STDERR join(":", $self->sources), "\n";
- my $journal_schema = DBIx::Class::Schema::Journal::DB->connect(@{ $self->journal_connection || $self->storage->connect_info });
-# print STDERR "conn", $journal_schema->storage->connect_info;
- if($self->journal_storage_type)
+ my $journal_schema;
+ if(!defined($self->journal_connection))
{
- $journal_schema->storage_type($self->journal_storage_type);
+ ## If no connection, use the same schema/storage etc as the user
+ DBIx::Class::Componentised->inject_base(ref $self, 'DBIx::Class::Schema::Journal::DB');
+ $journal_schema = $self;
}
+ else
+ {
+ $journal_schema = DBIx::Class::Schema::Journal::DB->connect(@{ $self->journal_connection });
+ if($self->journal_storage_type)
+ {
+ $journal_schema->storage_type($self->journal_storage_type);
+ }
+ }
## get our own private version of the journaling sources
$self->_journal_schema($journal_schema->compose_namespace(blessed($self) . '::Journal'));
Modified: trunk/DBIx-Class-Journal/t/lib/DBICTest.pm
===================================================================
--- trunk/DBIx-Class-Journal/t/lib/DBICTest.pm 2007-05-11 14:16:30 UTC (rev 3303)
+++ trunk/DBIx-Class-Journal/t/lib/DBICTest.pm 2007-05-11 14:21:39 UTC (rev 3304)
@@ -46,9 +46,12 @@
my $self = shift;
my %args = @_;
my $db_file = "t/var/DBIxClass.db";
+ my $db_audit = 't/var/Audit.db';
unlink($db_file) if -e $db_file;
unlink($db_file . "-journal") if -e $db_file . "-journal";
+ unlink($db_audit) if -e $db_audit;
+ unlink($db_audit . "-journal") if -e $db_audit . "-journal";
mkdir("t/var") unless -d "t/var";
my $dsn = $ENV{"DBICTEST_DSN"} || "dbi:SQLite:${db_file}";
More information about the Bast-commits
mailing list