PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: long binary?
Date: Oct 14 1998 10:52PM

Nathan Pilatzke writes:
 > I've got to display some fields of type 'long binary'.  I can retrieve
 > them but they don't print very nicely :)  I know that the contents of
 > these fields are text stored in a binary format.  Can anyone tell me
 > how to do decode them, or give me a shove in the right direction?  Can
 > CTLib do this or do I do it myself, and if I have to do it myself, what
 > perl functions/libraries do I need?

By long binary I suppose you mean IMAGE, right?

If you are using CTlib then these fields will be returned hex encoded
(this is the default conversion that Client library performs - not
something that I specifically enforce).

The data can be easily decoded using pack():

$bin = pack('H*', $hex);

Michael
-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@mbay.net       -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com