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: Re: how to use text/image fields wiht CTlib
Date: Feb 25 1998 11:45PM

Lal B Bandaru wrote:
> 
> Hi,
> 
> I am using Sybase::CTlib modules to insert and retrieve data into
> a table which has an image field and some varchar fields.
> What calls should I use. Can I do it with ct_sql() call.

Yes you can use ct_sql(). But you need to understand two things.

First, ClientLibrary will by default convert data coming from an
image field to hexadecimal data with a leading 0x. This is not
something that I do in sybperl, but gets done automatically by
Client Library. I personally think that that's brain dead, and
I may try to fix it in the future.

Second, if your images are larger than 64k you need to set the
TEXTSIZE option, either with a SET TEXTSIZE t-sql statement or
with a call to ct_option().

> 
> Do I have to do any encoding/decoding while inserting text/binary data
> into an image filed?

You don't have to encode anything when storing the image. But it will
be returned to you as a hex string by OpenClient.

This conversion is NOT done if you use TEXT instead of IMAGE fields 
(these two datatypes are otherwise identical).

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