Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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 ( [id://11107844]=note: print w/replies, xml ) Need Help??


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

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

Replies are listed 'Best First'.
Re^3: Strange DBI/DBD::ODBC behaviour (right truncation of data on ODBC call)
by poj (Abbot) on Oct 22, 2019 at 20:47 UTC

    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://11107844]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found