[Bast-commits] r3638 - in trunk/DBIx-Class-Journal:
lib/DBIx/Class/Schema t/lib
castaway at dev.catalyst.perl.org
castaway at dev.catalyst.perl.org
Wed Aug 1 00:28:56 GMT 2007
Author: castaway
Date: 2007-08-01 00:28:55 +0100 (Wed, 01 Aug 2007)
New Revision: 3638
Modified:
trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal.pm
trunk/DBIx-Class-Journal/t/lib/DBICTest.pm
Log:
Passes tests again!
Bugfix in DBIx::Class::Schema::Journal::txn_do, for cases where all insert values are empty, bugfix needed in dbic really.. ;)
Modified: trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal.pm
===================================================================
--- trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal.pm 2007-07-30 19:23:38 UTC (rev 3637)
+++ trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal.pm 2007-07-31 23:28:55 UTC (rev 3638)
@@ -37,7 +37,7 @@
sub connection
{
my $self = shift;
- $self->next::method(@_);
+ my $schema = $self->next::method(@_);
# print STDERR join(":", $self->sources), "\n";
@@ -82,6 +82,8 @@
$self->_journal_schema->deploy();
$self->_journal_schema->class('ChangeSet')->belongs_to('user', @{$self->journal_user});
$self->_journal_schema->storage->disconnect();
+
+ return $schema;
}
sub get_audit_log_class_name
@@ -128,10 +130,13 @@
my $cs = $self->_journal_schema->resultset('ChangeSet');
$self->txn_begin;
- my $changeset = $cs->create({ ( $self->_journal_schema->current_user() ? ( user_id => $self->_journal_schema->current_user()) : () ),
-# user_id => $self->_journal_schema->current_user(),
- session_id => $self->_journal_schema->current_session(),
- });
+ my %changesetdata = ( $self->_journal_schema->current_user() ? ( 'user_id', $self->_journal_schema->current_user()) : () ),
+ ( $self->_journal_schema->current_session() ? ( session_id => $self->_journal_schema->current_session() ) : () );
+ if(!%changesetdata)
+ {
+ %changesetdata = ( ID => undef );
+ }
+ my $changeset = $cs->create({ %changesetdata });
$self->_journal_schema->current_changeset($changeset->ID);
$self->next::method($code);
Modified: trunk/DBIx-Class-Journal/t/lib/DBICTest.pm
===================================================================
--- trunk/DBIx-Class-Journal/t/lib/DBICTest.pm 2007-07-30 19:23:38 UTC (rev 3637)
+++ trunk/DBIx-Class-Journal/t/lib/DBICTest.pm 2007-07-31 23:28:55 UTC (rev 3638)
@@ -58,7 +58,19 @@
my $dbuser = $ENV{"DBICTEST_DBUSER"} || '';
my $dbpass = $ENV{"DBICTEST_DBPASS"} || '';
- my $schema = DBICTest::Schema->compose_connection('DBICTest' => $dsn, $dbuser, $dbpass);
+ my $schema;
+ my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
+
+ if ($args{compose_connection}) {
+ $schema = DBICTest::Schema->compose_connection(
+ 'DBICTest', @connect_info
+ );
+ } else {
+ $schema = DBICTest::Schema->compose_namespace('DBICTest')
+ ->connect(@connect_info);
+ print STDERR "Created Schema: ", ref($schema), "\n";
+ }
+# my $schema = DBICTest::Schema->compose_connection('DBICTest' => $dsn, $dbuser, $dbpass);
# $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']);
if ( !$args{no_deploy} ) {
__PACKAGE__->deploy_schema( $schema );
@@ -83,15 +95,15 @@
my $self = shift;
my $schema = shift;
- if ($ENV{"DBICTEST_SQLT_DEPLOY"}) {
+# if ($ENV{"DBICTEST_SQLT_DEPLOY"}) {
return $schema->deploy();
- } else {
- open IN, "t/lib/sqlite.sql";
- my $sql;
- { local $/ = undef; $sql = <IN>; }
- close IN;
- ($schema->storage->dbh->do($_) || print "Error on SQL: $_\n") for split(/;\n/, $sql);
- }
+# } else {
+# open IN, "t/lib/sqlite.sql";
+# my $sql;
+# { local $/ = undef; $sql = <IN>; }
+# close IN;
+# ($schema->storage->dbh->do($_) || print "Error on SQL: $_\n") for split(/;\n/, $sql);
+# }
}
=head2 populate_schema
More information about the Bast-commits
mailing list