in reply to Getting database type from db handle

Looking at the docs, database handles have a three attributes that sound useful. It turns out that all three are useful. I don't know how you could have missed them all.

$dbh->{Name}
$dbh->get_info( $GetInfoType{SQL_DBMS_NAME} );
$dbh->{Driver}->{Name}

Replies are listed 'Best First'.
Re^2: Getting database type from db handle
by leocharre (Priest) on Sep 22, 2009 at 15:37 UTC

    The DBI docs are pretty long, though.. It's tempting when first using it, to just read what you 'think' is essential to you, and skip all the 'extra' stuff.

    Still no excuse for RTFM! But.. I'm feeling a little leeway here on not catching that.. (no?)

      It's tempting when first using it, to just read what you 'think' is essential to you

      It sounds like you're saying that's a bad thing, but that's exactly how I got the answer.

      The DBI docs are pretty long, though..

      When wanting a property of a database handle, look at the index for database handles.

      * Database Handle Methods o clone o data_sources o do o last_insert_id o selectrow_array o selectrow_arrayref o selectrow_hashref o selectall_arrayref o selectall_hashref o selectcol_arrayref o prepare o prepare_cached o commit o rollback o begin_work o disconnect o ping o get_info o table_info o column_info o primary_key_info o primary_key o foreign_key_info o statistics_info o tables o type_info_all o type_info o quote o quote_identifier o take_imp_data * Database Handle Attributes o AutoCommit (boolean) o Driver (handle) o Name (string) o Statement (string, read-only) o RowCacheSize (integer) o Username (string)

      I got three possible answers from that. Three quick clicks indicates all three fulfill the OP's requirements.

      That's not long. That's among the shortest amount of reading I've had to do to find a function. And I found three!

        ++, good argument.

        I think .. learning.. that is.. knowing some tactics via which we can find the answers to our questions, is an art to itself.

        ikegami, you're no novice to perl.. Personally I am what I would call a virgin intermediate coder in perl- with the occassional voyeur moment to an orgy.

        I remember not that long ago, when I would look over something like the DBI docs and scan it. And then put it away. Maybe look at how to establish a connection, imagine to myself I had actually read the document, and not revisit it again. Thinking.. well, I've "read" the doc.. what I am asking myself now, must not be in the doc..

        At this point in my open source/perl life, I know to revisit docs. I know that chances are, the answer is there.

        When someone with access to a posix box asks how to find files by date created etc.. I feel a scolding slap come about my right arm.. the RTFM hand-down.
        I do feel somewhere inside me- that this OP's question.. Can arguably be allowed to pass for a *not* RTFM moment. Given the doc we are talking about.

        Dunno, I guess it's open for judgement.

Re^2: Getting database type from db handle
by songahji (Friar) on Sep 23, 2009 at 13:43 UTC
    many thanks. ++