Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Characters after 255 getting truncated while using the DBLib package

by ganeshm69 (Novice)
on Jul 10, 2007 at 22:42 UTC ( [id://625935]=perlquestion: print w/replies, xml ) Need Help??

ganeshm69 has asked for the wisdom of the Perl Monks concerning the following question:

I created a table TAB1 with column A, where A is varchar 400
$query = " select A from TAB1 "; my($DB) = Sybase::DBlib->dblogin( $User, $Password, $Server); $DB->dbuse( database ); $DB->dbcmd($query); $DB->dbsqlexec; $DB->dbresults; while ( %dbdata = $DB->dbnextrow(1) ) { foreach ( sort keys %dbdata ) { my $CurColumn = $_; print $CurColumn; my $tempname = $dbdata{$CurColumn}; print "[$tempname]\n"; } }
Sample Output: ATHIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE Correct Value should be the below THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE THIS IS A TEST MESSAGE 255 THIS IS A TEST MESSAGE the data after 255 characters are getting truncated is this normal, or can I fix this?.
  • Comment on Characters after 255 getting truncated while using the DBLib package
  • Download Code

Replies are listed 'Best First'.
Re: Characters after 255 getting truncated while using the DBLib package
by GrandFather (Saint) on Jul 10, 2007 at 23:51 UTC

    The quick reference documentation for Sybase ASE 12.5 says in the Datatypes section:

    varchar(n) char[acter] varying 255 characters or fewer

    so varchar 400 would seem to illegal.


    DWIM is Perl's answer to Gödel
Re: Characters after 255 getting truncated while using the DBLib package
by Jenda (Abbot) on Jul 10, 2007 at 23:19 UTC

    Any reason why you are not using DBI? I do believe you should "go with the crowd" and use DBI unless you really really need something that DBI+DBD::Sybase doesn't support.

Re: Characters after 255 getting truncated while using the DBLib package
by GrandFather (Saint) on Jul 10, 2007 at 23:02 UTC

    You actually haven't given us very much to go on. No sample output. No indication of the table schema in the database. Inconsistent code (where does $CASHDB come from). Nothing we can run to reproduce your results (see I know what I mean. Why don't you? for hints).

    I'd take a look at the column format for the field you are having trouble with. I'd guess it is limited to length 255.

    Update: no indication that you have updated your node since the initial version of my reply.


    DWIM is Perl's answer to Gödel
Re: Characters after 255 getting truncated while using the DBLib package
by mpeppler (Vicar) on Jul 14, 2007 at 05:30 UTC
    DBlib doesn't support wide varchar columns. This is because the underlying DB-Library API has not been updated to handle wide varchars.

    The solution is to move to Sybase::CTlib or DBI/DBD::Sybase, and make sure that you have OpenClient 12.5 or later installed (and available at build time).

    I'll add that Sybase has been saying for the last 10 years or so that DBlib would not be updated to handle new features at the protocol level. Hence you should not be using DBlibrary.

    Michael

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-26 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found