[rt-devel] [patch] support for additional DB parametrs
Ruslan U. Zakirov
cubic at acronis.ru
Fri Jul 25 08:02:26 EDT 2003
Hello.
I think it would be useful for people to have chance to pass additional
DBD parametrs through DSN.
I've got two different mysql servers on my machine. I don't find another
flexible way to specify connection properties except
'mysql_read_default_file=/etc/my_xxx.cnf'. And I think it would be
useful in another ways.
This patch don't check names of params, but DBI drop an error if
something will be wrong.
general changes tested.
mySQL part tested.
Pg specific not changed.
Oracle not tested.
Feedback is wellcome.
Best regards. Ruslan.
-------------- next part --------------
diff -Nru DBIx-SearchBuilder-0.88/SearchBuilder/Handle/Oracle.pm DBIx-SearchBuilder-0.88-my/SearchBuilder/Handle/Oracle.pm
--- DBIx-SearchBuilder-0.88/SearchBuilder/Handle/Oracle.pm 2003-06-24 05:14:37.000000000 +0400
+++ DBIx-SearchBuilder-0.88-my/SearchBuilder/Handle/Oracle.pm 2003-07-25 15:32:34.000000000 +0400
@@ -48,17 +48,8 @@
sub Connect {
my $self = shift;
-
- my %args = ( Driver => undef,
- Database => undef,
- User => undef,
- Password => undef,
- SID => undef,
- Host => undef,
- @_);
-
- $self->SUPER::Connect(%args);
-
+
+ $self->SUPER::Connect(@_);
$self->dbh->{LongTruncOk}=1;
$self->dbh->{LongReadLen}=8000;
@@ -157,6 +148,7 @@
Port => undef,
SID => undef,
RequireSSL => undef,
+ Additional => undef,
@_);
my $dsn = "dbi:$args{'Driver'}:";
@@ -169,6 +161,7 @@
}
$dsn .= ";port=$args{'Port'}" if (defined $args{'Port'} && $args{'Port'});
$dsn .= ";requiressl=1" if (defined $args{'RequireSSL'} && $args{'RequireSSL'});
+ $dsn .= ";$args{'Additional'}" if (defined $args{'Additional'} && $args{'Additional'});
$self->{'dsn'}= $dsn;
}
diff -Nru DBIx-SearchBuilder-0.88/SearchBuilder/Handle.pm DBIx-SearchBuilder-0.88-my/SearchBuilder/Handle.pm
--- DBIx-SearchBuilder-0.88/SearchBuilder/Handle.pm 2003-06-24 05:14:37.000000000 +0400
+++ DBIx-SearchBuilder-0.88-my/SearchBuilder/Handle.pm 2003-07-25 15:32:39.000000000 +0400
@@ -116,6 +116,7 @@
User => undef,
Password => undef,
RequireSSL => undef,
+ Additional => undef,
DisconnectHandleOnDestroy => undef,
@_);
@@ -166,6 +167,7 @@
Port => undef,
SID => undef,
RequireSSL => undef,
+ Additional => undef,
@_);
@@ -174,6 +176,7 @@
$dsn .= ";host=$args{'Host'}" if (defined$args{'Host'} && $args{'Host'});
$dsn .= ";port=$args{'Port'}" if (defined $args{'Port'} && $args{'Port'});
$dsn .= ";requiressl=1" if (defined $args{'RequireSSL'} && $args{'RequireSSL'});
+ $dsn .= ";$args{'Additional'}" if (defined $args{'Additional'} && $args{'Additional'});
$self->{'dsn'}= $dsn;
}
-------------- next part --------------
diff -Nru rt-3-0-4/etc/RT_Config.pm rt-3-0-4-my/etc/RT_Config.pm
--- rt-3-0-4/etc/RT_Config.pm 2003-07-12 12:24:40.000000000 +0400
+++ rt-3-0-4-my/etc/RT_Config.pm 2003-07-25 15:09:34.000000000 +0400
@@ -74,6 +74,10 @@
# set DatabaseRequireSSL to 1 to turn on SSL communication
Set($DatabaseRequireSSL , undef);
+# If you're whant define additional parametrs to DSN
+# set DatabaseAdditional to 'param1=value1;param2=value2...'
+Set($DatabaseAdditional , undef);
+
# }}}
# {{{ Incoming mail gateway configuration
diff -Nru rt-3-0-4/lib/RT/Handle.pm rt-3-0-4-my/lib/RT/Handle.pm
--- rt-3-0-4/lib/RT/Handle.pm 2003-07-12 12:24:37.000000000 +0400
+++ rt-3-0-4-my/lib/RT/Handle.pm 2003-07-25 15:05:50.000000000 +0400
@@ -87,6 +87,7 @@
Port => $RT::DatabasePort,
Driver => $RT::DatabaseType,
RequireSSL => $RT::DatabaseRequireSSL,
+ Additional => $RT::DatabaseAdditional,
DisconnectHandleOnDestroy => 1
);
More information about the Rt-devel
mailing list