Just found this weird case where load(speculative => 1) in
0.756_01 doesn't reuse the database connection, but keeps
creating new ones:

A simple schema:

    CREATE TABLE products (
      id         INTEGER PRIMARY KEY AUTO_INCREMENT,
      name       VARCHAR(255) UNIQUE
    );

And the code:

    use strict;
    use Rose::DB::Object::Loader;

    my $loader =
        Rose::DB::Object::Loader->new(
        db_dsn       => 'dbi:mysql:dbname=testdb2',
        db_username  => 'root',
        db_options   => { AutoCommit => 1, ChopBlanks => 1, RaiseError => 1 },
        class_prefix => 'My');

    $loader->make_classes();

    for (1..100) {
        my $p = My::Product->new(name => "myproduct");
        $p->load(speculative => 1);
    }

If you start this in the debugger and set a breakpoint in DBI::connect,
you'll see that it gets hit about 100 times.

-- Mike

Mike Schilli
[EMAIL PROTECTED]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to