Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default column_info

    Hi, I've got an issue with $dbh->column_info for DBD::Oracle.

    Basically the function returns undef to me and I've seen the exact
    same code
    work under DBD::ODBC.

    foreach my $column_nm (@column_nms) {
    my $sth = $dbh->column_info(undef, $schema, $table_nm,
    $column_nm);
    my $hashref = $sth->fetchrow_hashref(); ### line 278
    my $type_name = $hashref->{'type_name'};
    my $size = $hashref->{'column_size'};

    }

    Basically the fetchrow_hashref failes because:
    Can't call method "fetchrow_hashref" on an undefined value at
    /opt/ejpress/ams/cgi-bin/AMSDbMaintenance.pm line 278.


    I have 2 setups one of them is a clients (doesn't work) one of them is
    my
    local dev (works). Based on
    [url]http://search.cpan.org/author/TIMB/DBD-Oracle-1.14/Oracle.pm#column_info_[/url]
    [url]http://search.cpan.org/author/TIMB/DBI-1.37/DBI.pm[/url]

    Client:
    I do _not_ have root on this system.
    uname -a
    SunOS ejpnode1 5.9 Generic_112233-02 sun4u sparc SUNW,UltraAX-i2
    perl -v
    This is perl, v5.8.0 built for sun4-solaris
    perl -MDBI -e 'print $DBI::VERSION' => 1.37
    perl -MDBD::Oracle -e 'print $DBD::Oracle::VERSION' => 1.14

    Local:
    Win2k SP3
    perl -v
    This is perl, v5.6.1 built for MSWin32-x86-multi-thread
    perl -MDBD::Oracle -e 'print $DBD::Oracle::VERSION' => 1.14
    perl -MDBD::ODBC -e 'print $DBD::ODBC::VERSION' => 1.05

    ------------------------------------------------------------------------------
    Philip M. Gollucci
    eJournalPress
    DBA / Software Engineer / System Administrator
    E-Mail: pgollucci [at] ejournalpress.com
    URL : [url]http://www.ejournalpress.com[/url]
    Phone : 301.530.6375
    Philip M. Gollucci Guest

  2. #2

    Default Re: column_info

    The relevant line from the .trace file with level at 12

    T <- column_info(undef 'ejp' ...)= undef at AMSDbMaintenance.pm line 281

    > You may also want to check with the DBD::Oracle documentation as well.
    > I am not certain, but some methods are available with some drivers
    > (DBD modules) and others are not. Again, I'm not sure about this, so
    > you may want to double check me.
    Yes you are correct about some being available in one driver and not
    in others. The only reason I even asked this question is because
    _OF_ the documentation.

    Inerestingly, I had already checked. The DBI documentation lists it.
    The Oracle Documentation lists it. The ODBC documentation does _NOT_.
    Quite the opposite of what I would have expected.

    I've even look through the Code of DBI.
    in ~1.32
    sub column_info() {
    shift->_not_implent(.....)

    around 1.37 this now calls _columns(). This must be an XS function
    cause it was no where to be found.

    At any rate, I've worked around it, but would still like to know whats going on.

    SELECT table_name, column_name, data_type, nullable char_col_decl_length
    FROM all_tab_columns
    WHERE table_name = UPPER(?)
    AND owner = UPPER(?)
    Philip M. Gollucci Guest

  3. #3

    Default Re: column_info

    I've now run into another problem.

    Constraints and Indexes

    my $constraints;

    foreach my $table_nm (sort @table_nms) {
    $table_nm = lc $table_nm;
    my @key_names = $dbh->primary_key(undef, $cf->get('dbusername'), $table_nm);
    @key_names = sort grep { $_ = lc $_} @key_names;

    push @$constraints, {
    name => "$table_nm\_cst",
    columns => \@key_names
    };
    }


    If there is not Primary Key (CONSTRAINT - _cst) then I get the index (_idx)

    I may be able to use
    select index_name from user_indexes

    to work around this, but one would hope there is a better way.

    If your wondering, next up are Referential Integrity, Sequences
    and triggers. But I'll save those for tomorrow.

    Thanks again/in advance.
    Philip M. Gollucci Guest

  4. #4

    Default Re: column_info

    Surely you don't expect every DBD for Perl to list every DBI module. DBD::ODBC has a section called "Deviations from the DBI specification" and these are the only things done differently or not handled.
    Unregistered Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139