in reply to Re^2: Abstracting Class::DBI Database Connection Data
in thread Abstracting Class::DBI Database Connection Data

Doesn't db_Main have to return an Ima::DBI compatible handle now, rather then just a plain DBI handle?

It says so, rather obliquely:

The preferred method for doing this is to supply your own db_Main() method rather than calling connection(). This method should return a valid database handle, and should ensure it sets the standard attributes described above, preferably by combining $class->_default_attributes() with your own.

I think the part about a valid database handle is where they mean one derived from Ima::DBI.

Update:

If you scan up right above the Dynamic Database Connections / db_Main heading, it says:

We use the inherited RootClass of DBIx::ContextualFetch from Ima::DBI, and you should be very careful not to change this unless you know what you're doing!

Maybe someone with a little more knowledge on this than I can provide a working example?

  • Comment on Re^3: Abstracting Class::DBI Database Connection Data

Replies are listed 'Best First'.
Re^4: Abstracting Class::DBI Database Connection Data
by gryphon (Abbot) on Jun 08, 2004 at 22:44 UTC

    Maybe someone with a little more knowledge on this than I can provide a working example?

    Yes, exactly. I think I get what I need to do, but I most certainly don't have a clue how to do it. If anyone has some working code they'd be willing to share, I would be very grateful.

    gryphon
    code('Perl') || die;

      sub db_Main { Ima::DBI->connect_cached(@conn_info); }

        Can't locate object method "connect_cached" via package "Ima::DBI" at MyCDBI.pm line 4.

        gryphon
        code('Perl') || die;