Changeset 429
- Timestamp:
- 05/11/08 13:58:49 (4 years ago)
- Location:
- wiki-toolkit/trunk
- Files:
-
- 3 modified
-
Changes (modified) (1 diff)
-
Makefile.PL (modified) (3 diffs)
-
lib/Wiki/Toolkit/TestLib.pm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wiki-toolkit/trunk/Changes
r427 r429 13 13 Fix test suite's incorrect passing of DBIxFTSMySQL connection 14 14 parameters 15 Add missing prereq of DBI (caught by the CPAN testers) and don't 16 use DBI in Makefile.PL 15 17 16 18 0.74 9 June 2007 -
wiki-toolkit/trunk/Makefile.PL
r428 r429 1 1 use ExtUtils::MakeMaker; 2 use DBI;3 2 use Data::Dumper; 4 3 use strict; … … 76 75 77 76 # Finally ask questions; then check the settings work. 78 my %dsn_prefix = ( MySQL => "dbi:mysql:",79 Pg => "dbi:Pg:dbname=" );80 77 my %driver = ( MySQL => "DBD::mysql", 81 78 Pg => "DBD::Pg" ); … … 106 103 undef $dbhost unless ($dbhost and $dbhost ne "undef"); 107 104 108 # Check that these connection parameters actually work.109 my $dsn = $dsn_prefix{$store_type}.$dbname;110 $dsn .= ";host=$dbhost" if $dbhost;111 my $dbh = eval { DBI->connect($dsn,112 $dbuser, $dbpass, {PrintError => 1})113 or die DBI->errstr;114 };115 die "\nCan't connect to $store_type with those parameters:"116 . "\n" . $@ . "\n\n"117 . "Please re-run 'perl Makefile.PL' and supply correct "118 . "parameters.\n\n" if $@;119 $dbh->disconnect;120 121 # Save them if they do.122 105 $config{$store_type}{dbname} = $dbname; 123 106 $config{$store_type}{dbuser} = $dbuser; -
wiki-toolkit/trunk/lib/Wiki/Toolkit/TestLib.pm
r427 r429 5 5 use Wiki::Toolkit; 6 6 use Wiki::Toolkit::TestConfig; 7 use DBI; 7 8 8 9 use vars qw( $VERSION @wiki_info ); … … 43 44 44 45 my %datastore_info; 46 47 my %dsn_prefix = ( MySQL => "dbi:mysql:", 48 Pg => "dbi:Pg:dbname=", 49 SQLite => "dbi:SQLite:dbname="); 50 45 51 foreach my $dbtype (qw( MySQL Pg SQLite )) { 46 52 if ( $configured{$dbtype}{dbname} ) { … … 48 54 my $store_class = "Wiki::Toolkit::Store::$dbtype"; 49 55 my $setup_class = "Wiki::Toolkit::Setup::$dbtype"; 56 my $dsn = $dsn_prefix{$dbtype}.$config{dbname}; 57 my $err; 58 if ($err = _test_dsn( $dsn, $config{dbuser}, $config{dbpass}, $config{dbhost})) { 59 warn "connecting to test $dbtype database failed: $err\n"; 60 warn "will skip $dbtype tests\n"; 61 next; 62 } 50 63 $datastore_info{$dbtype} = { 51 64 class => $store_class, … … 258 271 } 259 272 273 sub _test_dsn { 274 my ( $dsn, $dbuser, $dbpass, $dbhost ) = @_; 275 $dsn .= ";host=$dbhost" if $dbhost; 276 my $dbh = eval { 277 DBI->connect($dsn, $dbuser, $dbpass, {RaiseError => 1}); 278 }; 279 return $@; 280 } 281 282 260 283 =back 261 284 … … 271 294 272 295 Copyright (C) 2003-2004 Kake Pugh. All Rights Reserved. 296 Copyright (C) 2008 the Wiki::Toolkit team. All Rights Reserved. 273 297 274 298 This module is free software; you can redistribute it and/or modify it
