Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Strange DBI/DBD::ODBC behaviour (right truncation of data on ODBC call)

by poj (Abbot)
on Oct 22, 2019 at 10:01 UTC ( #11107839=note: print w/replies, xml ) Need Help??


in reply to Strange DBI/DBD::ODBC behaviour (right truncation of data on ODBC call)

Have you tried odbc_lob_read ?

poj
  • Comment on Re: Strange DBI/DBD::ODBC behaviour (right truncation of data on ODBC call)

Replies are listed 'Best First'.
Re^2: Strange DBI/DBD::ODBC behaviour (right truncation of data on ODBC call)
by jahero (Pilgrim) on Oct 22, 2019 at 11:51 UTC

    Thanks for the tip.

    I have tried it now.

    $sth = $dbh->prepare($sql); $sth->execute(); my $lob; my $chrs_or_bytes_read = $sth->odbc_lob_read(0, \$lob, 65535, { TreatA +sLOB=>1 });

    Results in .. Column 0 was not bound with TreatAsLOB

    I guess this particular DBI method can only be used on columns that are bound to a prepare statement. If that's true, it can not be used in this instance. There is nothing to bind.

    $sth = $dbh->prepare($sql); $sth->bind_col(1, \$lob); $sth->execute();
    fails with
    cannot bind to non-existent field 1

    I am sending a DDL statement (show table) into the database, and expecting to get a DDL script of the particular table as output. Everything works fine up until to a certain size of the DDL script, then I am getting the "truncation" error mentioned in the original post.

    Regards, Jan

      I can't test this on Terradata but seems to work on MSSQL

      my $sth = $dbh->prepare('select lob from table_lob'); $sth->execute(); $sth->bind_col(1, undef, {TreatAsLOB=>1}); $sth->fetch; $sth->odbc_lob_read(1, \my $data, 65335); print $data;
      poj

        Thank you for the learning opportunity, that worked.

        I need to brush my DBI skills a bit more!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11107839]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2022-05-25 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (90 votes). Check out past polls.

    Notices?