I have a heavily modified version of DBD::Multiplex which is the basis for what will be included in DBI v2. Tom Kishel [CC'd] has kindly offered to step back into developing it for me. [Thanks Tom.]
Perhaps he can polish up what I've given him and release it as a 2.0 version sooner rather than wait for DBI v2. That would make it easier for existing users to upgrade and test the new one without having to wait for DBI v2.0 Tim. On Fri, Aug 13, 2004 at 01:24:20PM -0400, Pat Deegan wrote: > Greetings DBI list, > > I'm not certain this is the right place to send this but the "tkishel AT > tdlc.com" address contained within the DBD::Multiplex documentation is > bouncing mail. > > > Been running into problems with DBD::Multiplex (1.9) on perl, v5.8.3 > built for i686-linux system. > > Errors were: > Modification of non-creatable hash value attempted, subscript > "Statement" at /usr/lib/perl5/site_perl/5.8.3/DBD/Multiplex.pm line > 415. > > and > > Argument "SELECT * FROM foo WHERE bar = 'baz..." isn' t numeric > in numeric ne (!=) at /usr/lib/perl5/site_perl/5.8.3/DBD/Multiplex.pm > line 535. > > >From what I gather, DBD drivers are supposed to let the DBI take care of > $dbh->{'Statement'} so values within are set "read-only". Didn't bother > to really check why DBD::Multiplex is manipulating it, I just inserted a > workaround that keeps Perl from barfing. > > The attached patch fixes both of these minor issues. > > > Question: is there any way to define which servers the dbh handle reads > from? > > I'm using the 'mx_master_id' to specify where writes should be made but > I'd like to restrict access to that server to writes--i.e. reads should > only be made from one of the replicated DBs and not the master. > > Is this possible with DBD::Multiplex? If not, should I extend it by > inheriting from it or might the functionality be useful enough to > incorporated directly into DBD::Multiplex? > > > Thanks for the modules and regards to all contributors, > -- > Pat Deegan > http://www.psychogenic.com/ > PGP Key: http://www.keyserver.net 0x03F86A50 > --- Multiplex-1.9.pm 2004-08-10 18:17:10.000000000 -0400 > +++ Multiplex-1.9.1.pm 2004-08-10 19:05:14.000000000 -0400 > @@ -68,6 +68,7 @@ > # TK Note: > # do() is a method of a database handle, not a statement handle. > if ($method eq 'do' or $method eq 'disconnect') { > + delete $parent_handle->{'Statement'}; > $parent_handle->{'Statement'} = $_[0]; > } > > @@ -382,6 +383,7 @@ > $imp_data_size = 0; > use strict; > > + > ######################################## > # The statement handle constructor. > # This function calls mx_do_calls and therefore cannot be called using > mx_method_all. > @@ -412,6 +414,7 @@ > } > > # Don't forget this! > + delete $dbh->{Statement}; > $dbh->{'Statement'} = $statement; > > %multiplex_options = ('parent_handle' => $dbh, 'exit_mode' => $exit_mode); > @@ -532,7 +535,7 @@ > my ($statement) = @_; > my ($result); > > - if (($$statement =~ /^SELECT/i) && ($$statement != /INSERT |UPDATE |DELETE > |CREATE |DROP |INTO /i)) { > + if (($$statement =~ /^SELECT/i) && ($$statement !~ /INSERT |UPDATE |DELETE > |CREATE |DROP |INTO /i)) { > $result = 'first_success'; > } else { >