|
From: <pau...@us...> - 2008-10-20 14:31:17
|
Revision: 1017
http://everydevel.svn.sourceforge.net/everydevel/?rev=1017&view=rev
Author: paul_the_nomad
Date: 2008-10-20 14:31:07 +0000 (Mon, 20 Oct 2008)
Log Message:
-----------
Squashed commit of the following:
commit 71120bd98a9aaf239024d7c218114ead3d0899e8
Author: Paul <pa...@ag...>
Date: Mon Oct 20 15:14:26 2008 +0100
Patch reversing the effects of a FUBAR created by the way that git-svn squashes git commits before applying them to a subversion repository.
commit efac9219c8c711ff04c4a018cef2bca1412c55fb
Merge: 8e23dc3... 455dce8...
Author: Paul <pa...@ag...>
Date: Thu Oct 16 16:37:45 2008 +0100
Merge /home/paul/git/edev
commit 455dce8923aa2d3db9fab8cdcde12c3c1e79c7aa
Merge: 2001008... 93e93ac...
Author: Paul <pa...@ag...>
Date: Tue Oct 14 21:12:13 2008 +0100
Merge /home/paul/git-svn/edev
commit 93e93ac1bc592ae67b94f2c692f2baf3972cfcfc
Author: Paul <pa...@pa...>
Date: Tue Jul 15 12:46:48 2008 +0100
Capitalise nodelet titles. And codelisting in monospace rather than fixed.
Modified Paths:
--------------
trunk/ebase/TODO
trunk/ebase/lib/Everything/DB/Pg.pm
trunk/ebase/lib/Everything/DB/Test/Pg.pm
trunk/ebase/lib/Everything/DB/mysql.pm
trunk/ebase/t/DB/Live/Pg.t
trunk/ebase/t/DB/Live/mysql.t
Modified: trunk/ebase/TODO
===================================================================
--- trunk/ebase/TODO 2008-10-15 21:28:26 UTC (rev 1016)
+++ trunk/ebase/TODO 2008-10-20 14:31:07 UTC (rev 1017)
@@ -7,15 +7,7 @@
* Amend FromObject.pm so that form objects return labels with a 'for'
attribute and id in the input tag.
-<<<<<<< HEAD:ebase/TODO
-=======
-* Require Everything::HTML::Response classes to create certain HTTP headers
-
-* Everything::HTML::Response classes to return error values on error -
- e.g. Forbidden
->>>>>>> Changes to the response class interface:ebase/TODO
-
* Change default DB (for all DBs) setup so default encoding is utf8
* Documentation - Ecore should be self documenting
Modified: trunk/ebase/lib/Everything/DB/Pg.pm
===================================================================
--- trunk/ebase/lib/Everything/DB/Pg.pm 2008-10-15 21:28:26 UTC (rev 1016)
+++ trunk/ebase/lib/Everything/DB/Pg.pm 2008-10-20 14:31:07 UTC (rev 1017)
@@ -80,6 +80,11 @@
while ( my $field = $cursor->fetchrow_hashref )
{
+
+ # DBD::Pg seems to automatically quote some (but not
+ # all) column names. This is a workaround.
+ $$field{COLUMN_NAME} =~ s/^"?(.*?)"?$/$1/;
+
# for backwards compatibility
$$field{Field} = $$field{COLUMN_NAME};
@@ -683,14 +688,13 @@
$host ||= 'localhost';
my $dbh;
- if ( $dbname ) {
- undef $this->{dbh};
- undef $this->{nb};
- $dbh = DBI->connect( "DBI:Pg:dbname=postgres;host=$host;port=$port",
+ $dbh = DBI->connect( "DBI:Pg:dbname=postgres;host=$host;port=$port",
$user, $password )
or die "Unable to get database connection!";
- } else {
- $dbh = $this->getDatabaseHandle;
+
+ if ( ref $this ) {
+ undef $this->{nb};
+ undef $this->{dbh};
}
$dbh->do( "drop database $dbname" );
Modified: trunk/ebase/lib/Everything/DB/Test/Pg.pm
===================================================================
--- trunk/ebase/lib/Everything/DB/Test/Pg.pm 2008-10-15 21:28:26 UTC (rev 1016)
+++ trunk/ebase/lib/Everything/DB/Test/Pg.pm 2008-10-20 14:31:07 UTC (rev 1017)
@@ -81,7 +81,7 @@
can_ok( $self->{class}, 'getFieldsHash' ) || return;
$self->{instance}->{nb}->clear;
$self->{instance}->{dbh}->clear;
- my $fields = [ { Field => 'foo', foo => 1 }, { Field => 'bar', bar => 2 } ];
+ my $fields = [ { COLUMN_NAME => 'foo', foo => 1 }, { COLUMN_NAME => 'bar', bar => 2 } ];
$self->{instance}->{dbh}->mock( 'column_info', sub { shift; } );
$self->{instance}->{dbh}->set_series( 'fetchrow_hashref', @$fields );
$self->{instance}->{dbh}->set_false( 'err' );
Modified: trunk/ebase/lib/Everything/DB/mysql.pm
===================================================================
--- trunk/ebase/lib/Everything/DB/mysql.pm 2008-10-15 21:28:26 UTC (rev 1016)
+++ trunk/ebase/lib/Everything/DB/mysql.pm 2008-10-20 14:31:07 UTC (rev 1017)
@@ -508,8 +508,11 @@
sub drop_database {
my ( $this, $dbname, $user, $password, $host, $port ) = @_;
+ $host ||= '';
+ $port ||= '';
+
my $dbh;
- if ( $dbname ) {
+ if ( ! ref $this || ! $this->{dbh} ) {
$dbh = DBI->connect( "DBI:mysql:$dbname:$host", $user, $password )
or die "Unable to get database connection!";
} else {
@@ -517,7 +520,12 @@
}
$dbh->do( "drop database $dbname" );
- die $DBI::errstr if $DBI::errstr;
+
+ if ( $DBI::errstr ) {
+ die $DBI::errstr;
+ return 0;
+ }
+
return 1;
}
Modified: trunk/ebase/t/DB/Live/Pg.t
===================================================================
--- trunk/ebase/t/DB/Live/Pg.t 2008-10-15 21:28:26 UTC (rev 1016)
+++ trunk/ebase/t/DB/Live/Pg.t 2008-10-20 14:31:07 UTC (rev 1017)
@@ -1,27 +1,36 @@
#!/usr/bin/perl
-use Everything::DB::Test::Live::Pg;
+use lib 't/lib';
+use DBTestUtil qw/config_file skip_cond/;
+use Everything::DB::Test::Live;
use strict;
use warnings;
+
# touch 't/lib/db/run-tests' to run.
my $RUN_TESTS = -e 't/lib/db/run-tests';
my $msg;
-my $config = Everything::Config->new( file => 't/lib/db/Pg.conf' );
+my $config_file = config_file();
+my @config_args;
+
+push @config_args, file => $config_file if -e $config_file;
+
+my $config = Everything::Config->new( @config_args );
+
if ( ! $RUN_TESTS ) {
- Everything::DB::Test::Live::Pg->SKIP_CLASS('Time consuming live database tests skipped by default.') unless $RUN_TESTS;
+ Everything::DB::Test::Live->SKIP_CLASS('Time consuming live database tests skipped by default.') unless $RUN_TESTS;
} elsif ( ! $config->database_superuser ) {
- Everything::DB::Test::Live::Pg->SKIP_CLASS('Skipping tests database super user must be set.')
+ Everything::DB::Test::Live->SKIP_CLASS('Skipping tests database super user must be set.')
}
-my $tests = Everything::DB::Test::Live::Pg->new( config => $config, SKIP => $msg ) ;
+my $tests = Everything::DB::Test::Live->new( config => $config, SKIP => $msg ) ;
$tests->runtests;
Modified: trunk/ebase/t/DB/Live/mysql.t
===================================================================
--- trunk/ebase/t/DB/Live/mysql.t 2008-10-15 21:28:26 UTC (rev 1016)
+++ trunk/ebase/t/DB/Live/mysql.t 2008-10-20 14:31:07 UTC (rev 1017)
@@ -1,5 +1,7 @@
#!/usr/bin/perl
+use lib 't/lib';
+use DBTestUtil qw/config_file skip_cond/;
use Everything::DB::Test::Live;
use strict;
use warnings;
@@ -10,8 +12,14 @@
my $msg;
-my $config = Everything::Config->new( file => 't/lib/db/mysql.conf' );
+my $config_file = config_file();
+my @config_args;
+
+push @config_args, file => $config_file if -e $config_file;
+
+my $config = Everything::Config->new( @config_args );
+
if ( ! $RUN_TESTS ) {
Everything::DB::Test::Live->SKIP_CLASS('Time consuming live database tests skipped by default.') unless $RUN_TESTS;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|