[Bast-commits] r3240 - in trunk/DBIx-Class-Journal: lib/DBIx/Class
lib/DBIx/Class/Schema lib/DBIx/Class/Schema/Journal/DB t t/lib
castaway at dev.catalyst.perl.org
castaway at dev.catalyst.perl.org
Sat May 5 19:11:47 GMT 2007
Author: castaway
Date: 2007-05-05 19:11:45 +0100 (Sat, 05 May 2007)
New Revision: 3240
Modified:
trunk/DBIx-Class-Journal/lib/DBIx/Class/Journal.pm
trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal.pm
trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditHistory.pm
trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditLog.pm
trunk/DBIx-Class-Journal/t/01test.t
trunk/DBIx-Class-Journal/t/lib/DBICTest.pm
Log:
Debugging and tests, why do we get "database locked" with sqlite?
Modified: trunk/DBIx-Class-Journal/lib/DBIx/Class/Journal.pm
===================================================================
--- trunk/DBIx-Class-Journal/lib/DBIx/Class/Journal.pm 2007-05-05 16:34:14 UTC (rev 3239)
+++ trunk/DBIx-Class-Journal/lib/DBIx/Class/Journal.pm 2007-05-05 18:11:45 UTC (rev 3240)
@@ -25,7 +25,9 @@
print STDERR "Schema: ", ref($self->result_source->schema), "\n";
my $al = $self->result_source->schema->_journal_schema->resultset("${s_name}AuditLog");
$al->create({
- changeset => $self->result_source->schema->_journal_schema->current_changeset(),
+# created => {
+# changeset => $self->result_source->schema->_journal_schema->current_changeset(),
+# },
});
}
Modified: trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditHistory.pm
===================================================================
--- trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditHistory.pm 2007-05-05 16:34:14 UTC (rev 3239)
+++ trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditHistory.pm 2007-05-05 18:11:45 UTC (rev 3240)
@@ -14,8 +14,10 @@
{
my ($self, $data, @rest) = @_;
- $data->{change} = {
- changeset_id => $self->result_source->schema->_journal_schema->current_changeset,
+ $data->{change} = {
+# ID => \'DEFAULT',
+ changeset_id => $source->schema->current_changeset,
+ %{$data->{created}},
};
$self->next::method($data, @rest);
Modified: trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditLog.pm
===================================================================
--- trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditLog.pm 2007-05-05 16:34:14 UTC (rev 3239)
+++ trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditLog.pm 2007-05-05 18:11:45 UTC (rev 3240)
@@ -25,8 +25,10 @@
{
my ($self, $data, $source, @rest) = @_;
- $data->{created} = {
+ $data->{created} = {
+# ID => \'DEFAULT',
changeset_id => $source->schema->current_changeset,
+ %{$data->{created}},
};
$self->next::method($data, $source, @rest);
Modified: trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal.pm
===================================================================
--- trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal.pm 2007-05-05 16:34:14 UTC (rev 3239)
+++ trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal.pm 2007-05-05 18:11:45 UTC (rev 3240)
@@ -11,6 +11,18 @@
__PACKAGE__->mk_classdata('journal_user'); ## [ class, field for user id ]
__PACKAGE__->mk_classdata('_journal_schema');
+sub throw_exception
+{
+}
+
+sub exception_action
+{
+ my $self = shift;
+ print STDERR Carp::longmess;
+
+ $self->next::method(@_);
+}
+
sub connection
{
my $self = shift;
@@ -92,8 +104,8 @@
## Create a new changeset, then run $code as a transaction
my $cs = $self->_journal_schema->resultset('ChangeSet');
- my $changeset = $cs->create({
- user_id => $self->_journal_schema->current_user(),
+ 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(),
});
$self->_journal_schema->current_changeset($changeset->ID);
Modified: trunk/DBIx-Class-Journal/t/01test.t
===================================================================
--- trunk/DBIx-Class-Journal/t/01test.t 2007-05-05 16:34:14 UTC (rev 3239)
+++ trunk/DBIx-Class-Journal/t/01test.t 2007-05-05 18:11:45 UTC (rev 3240)
@@ -21,9 +21,12 @@
isa_ok($schema->_journal_schema->source('ArtistAuditLog'), 'DBIx::Class::ResultSource', 'ArtistAuditLog source exists');
my $new_cd = $schema->txn_do( sub {
+ my $artist = $schema->resultset('Artist')->create({
+ name => 'Fred Bloggs',
+ });
return $schema->resultset('CD')->create({
title => 'Angry young man',
- artist => 0,
+ artist => $artist,
year => 2000,
});
});
Modified: trunk/DBIx-Class-Journal/t/lib/DBICTest.pm
===================================================================
--- trunk/DBIx-Class-Journal/t/lib/DBICTest.pm 2007-05-05 16:34:14 UTC (rev 3239)
+++ trunk/DBIx-Class-Journal/t/lib/DBICTest.pm 2007-05-05 18:11:45 UTC (rev 3240)
@@ -56,7 +56,7 @@
my $dbpass = $ENV{"DBICTEST_DBPASS"} || '';
my $schema = DBICTest::Schema->compose_connection('DBICTest' => $dsn, $dbuser, $dbpass);
- $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']);
+# $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']);
if ( !$args{no_deploy} ) {
__PACKAGE__->deploy_schema( $schema );
__PACKAGE__->populate_schema( $schema ) if( !$args{no_populate} );
More information about the Bast-commits
mailing list