Fixed a typo and added a commented out block for CSV, but CSV doesn't work ATM.

This commit is contained in:
Elijah Perrault committed 2011-02-13 21:45:29 -07:00
1 parent 7f4655121e
commit 20a8e8c2e4
2 files changed
+21 -5

No files matched your search

+16 -4
View File
@@ -183,11 +183,11 @@ given (lc((conf_get('database:format'))[0][0])) {
system "chmod a+x $Bin/../etc/".(conf_get('database:filename'))[0][0]; system "chmod a+x $Bin/../etc/".(conf_get('database:filename'))[0][0];
} }
# Connect to database. # Connect to database.
$DB = DBI->connect("dbi:SQLite:dbname=$Bin/../etc/".(conf_get('database:filename'))[0][0]); $DB = DBI->connect("dbi:SQLite:dbname=$Bin/../etc/".(conf_get('database:filename'))[0][0]) or err(2, 'Failed to connect to database!', 1);
} }
when ('mysql') { when ('mysql') {
# MySQL. # MySQL.
if ($ENFEAT !~ /mysql/) { err(2, 'Auto not built with SQLite support. Aborting.', 1); } if ($ENFEAT !~ /mysql/) { err(2, 'Auto not built with MySQL support. Aborting.', 1); }
my @reqcval = qw(database:host database:name database:username database:password); my @reqcval = qw(database:host database:name database:username database:password);
foreach (@reqcval) { if (!conf_get($_)) { err(2, "Missing required configuration value $_. Aborting.", 1); } } foreach (@reqcval) { if (!conf_get($_)) { err(2, "Missing required configuration value $_. Aborting.", 1); } }
undef @reqcval; undef @reqcval;
@@ -199,14 +199,26 @@ given (lc((conf_get('database:format'))[0][0])) {
if (conf_get('database:port')) { if (conf_get('database:port')) {
# If we were given a port, connect with it. # If we were given a port, connect with it.
$DB = DBI->connect('DBI:mysql:database='.(conf_get('database:name'))[0][0].';host='.(conf_get('database:host'))[0][0].';port='.(conf_get('database:port'))[0][0], $DB = DBI->connect('DBI:mysql:database='.(conf_get('database:name'))[0][0].';host='.(conf_get('database:host'))[0][0].';port='.(conf_get('database:port'))[0][0],
(conf_get('database:username'))[0][0], (conf_get('database:password'))[0][0]); (conf_get('database:username'))[0][0], (conf_get('database:password'))[0][0]) or err(2, 'Failed to connect to database!', 1);;
} }
else { else {
# If not, connect without specifying a port. # If not, connect without specifying a port.
$DB = DBI->connect('DBI:mysql:database='.(conf_get('database:name'))[0][0].';host='.(conf_get('database:host'))[0][0], $DB = DBI->connect('DBI:mysql:database='.(conf_get('database:name'))[0][0].';host='.(conf_get('database:host'))[0][0],
(conf_get('database:username'))[0][0], (conf_get('database:password'))[0][0]); (conf_get('database:username'))[0][0], (conf_get('database:password'))[0][0]) or err(2, 'Failed to connect to database!', 1);;
} }
} }
# CSV no work. :(
#when ('csv') {
# # CSV.
# if ($ENFEAT !~ /csv/) { err(2, 'Auto not built with CSV support.', 1); }
# if (!conf_get('database:dir')) { err(2, 'Missing required configuration value database:dir. Aborting.', 1); }
#
# # Import DBD::CSV.
# require DBD::CSV;
#
# # Connect to database.
# $DB = DBI->connect("dbi:CSV:f_dir=$Bin/../etc/".(conf_get('database:dir'))[0][0]) or err(2, 'Failed to connect to database!', 1);
#}
# Unknown database format. # Unknown database format.
default { err(2, 'Unknown database format \''.lc((conf_get('database:format'))[0][0]).'\'. Aborting.', 1); } default { err(2, 'Unknown database format \''.lc((conf_get('database:format'))[0][0]).'\'. Aborting.', 1); }
} }
+5 -1
View File
@@ -38,8 +38,11 @@ if (defined $ARGV[0]) {
$features .= ' ipv6'; $features .= ' ipv6';
} }
elsif ($_ eq '--with-mysql') { elsif ($_ eq '--with-mysql') {
$features =~ s/sqlite/mysql/; $features =~ s/(sqlite|csv)/mysql/g;
} }
#elsif ($_ eq '--with-csv') {
# $features =~ s/(sqlite|mysql)/csv/g;
#}
else { else {
println "Warning: Unknown option '$_'"; println "Warning: Unknown option '$_'";
} }
@@ -102,6 +105,7 @@ println "\0";
modfind('DBI'); modfind('DBI');
modfind('DBD::SQLite') if $features =~ /sqlite/; modfind('DBD::SQLite') if $features =~ /sqlite/;
modfind('DBD::mysql') if $features =~ /mysql/; modfind('DBD::mysql') if $features =~ /mysql/;
modfind('DBD::CSV') if $features =~ /csv/;
modfind('Class::Unload'); modfind('Class::Unload');
modfind('IO::Socket::INET6') if $features =~ /ipv6/; modfind('IO::Socket::INET6') if $features =~ /ipv6/;
modfind('IO::Socket::SSL') if $features =~ /ssl/; modfind('IO::Socket::SSL') if $features =~ /ssl/;