On second thought, added PostgreSQL support. But official modules do not work with it yet.
This commit is contained in:
1 parent
0bbf9ae5f1
commit
69c9ccb917
4 files changed
+29
-7
No files matched your search
@@ -219,6 +219,27 @@ given (lc((conf_get('database:format'))[0][0])) {
|
||||
# # 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);
|
||||
#}
|
||||
when ('pgsql') {
|
||||
# PostgreSQL.
|
||||
if ($ENFEAT !~ /pgsql/) { err(2, 'Auto not built with PostgreSQL support. Aborting.', 1); }
|
||||
my @reqcval = qw(database:name database:host database:username database:password);
|
||||
foreach (@reqcval) { if (!conf_get($_)) { err(2, "Missing required configuration value $_. Aborting.", 1); } }
|
||||
|
||||
# Import DBD::Pg.
|
||||
require DBD::Pg;
|
||||
|
||||
# Connect to database.
|
||||
if (conf_get('database:port')) {
|
||||
# If a specific port was given, use it.
|
||||
$DB = DBI->connect('dbi:Pg:db='.(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]) or err(2, 'Failed to connect to database!', 1);
|
||||
}
|
||||
else {
|
||||
# We were not given a port, connect using PGPORT (usually 5432)
|
||||
$DB = DBI->connect('dbi:Pg:db='.(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]) or err(2, 'Failed to connect to database!', 1);
|
||||
}
|
||||
}
|
||||
# Unknown database format.
|
||||
default { err(2, 'Unknown database format \''.lc((conf_get('database:format'))[0][0]).'\'. Aborting.', 1); }
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
|
||||
|
||||
3.0 Indev
|
||||
===============================================================================
|
||||
* Added PostgreSQL support. Official modules do not support this yet.
|
||||
* database:format now a required configuration value.
|
||||
* Added support for MySQL. ./install --with-mysql
|
||||
* Added a database upgrade script for upgrading the `qdb` table in 3.0.0a3
|
||||
|
||||
@@ -31,7 +31,7 @@ Legend:
|
||||
[O] Implement Auto-Flatfile as the main format
|
||||
[X] Add SQLite support as default
|
||||
[x] Add MySQL support
|
||||
[O] Add PostgreSQL support
|
||||
[X] Add PostgreSQL support
|
||||
[O] Add Oracle DB support
|
||||
|
||||
[O] Sys
|
||||
|
||||
@@ -38,12 +38,12 @@ if (defined $ARGV[0]) {
|
||||
$features .= ' ipv6';
|
||||
}
|
||||
elsif ($_ eq '--with-mysql') {
|
||||
$features =~ s/(sqlite|csv)/mysql/g;
|
||||
$features =~ s/(sqlite|pgsql)/mysql/g;
|
||||
}
|
||||
#elsif ($_ eq '--with-csv') {
|
||||
# $features =~ s/(sqlite|mysql)/csv/g;
|
||||
#}
|
||||
else {
|
||||
elsif ($_ eq '--with-pgsql') {
|
||||
$features =~ s/(sqlite|mysql)/pgsql/g;
|
||||
}
|
||||
else {
|
||||
println "Warning: Unknown option '$_'";
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ println "\0";
|
||||
modfind('DBI');
|
||||
modfind('DBD::SQLite') if $features =~ /sqlite/;
|
||||
modfind('DBD::mysql') if $features =~ /mysql/;
|
||||
modfind('DBD::CSV') if $features =~ /csv/;
|
||||
modfind('DBD::Pg') if $features =~ /pgsql/;
|
||||
modfind('Class::Unload');
|
||||
modfind('IO::Socket::INET6') if $features =~ /ipv6/;
|
||||
modfind('IO::Socket::SSL') if $features =~ /ssl/;
|
||||
|
||||
Reference in new issue
Block a user