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: Stephen dot Sprague at morganstanley dot com
Subject: Re: iso_1 and unicode
Date: Mar 10 2003 2:45PM

Hi Michael-
Yes and no.

Turned out I had a different problem. As I finally learned Sybase::CTLib
returns data from a image column as a hex *char* string (not true binary
- and same goes for varbinary) so when I was taking this char string and
spooning it back in the text field on the other server,  of  course,  it
underwent another tranformation. The Rx? I inserted an unpack  statement
to decode it to binary after retrieving it and before using  it  in  the
blk_xfer and everything's fine now. I'm only wondering  if  there  isn't
some option to turn of this hex char string transformation off from  the
perl API from the start.


As to the below, I'm still curious why the call to ct_con_props returned
a "0" even though I set it to utf8 -- but it's not critical in any way
shape or form.


Thanks,
Steve


On 7 Mar 2003 @ 10:30am, an entity claiming to be Michael Peppler scribbled:

mpeppl :I'm sorry for the delay - did you ever get an answer to this issue?
mpeppl :
mpeppl :Michael
mpeppl :
mpeppl :On Sat, 2003-02-15 at 06:45, Stephen.Sprague@morganstanley.com wrote:
mpeppl :
mpeppl :> Hi
mpeppl :> I'm having a little trouble trying to mimic the -J  switch  on  sybase's
mpeppl :> bcp command via Sybase::CTlib. I'm trying to pull a text field  from  an
mpeppl :> iso_1 server, convert it to unicode, and put it in a utf8 server.
mpeppl :>
mpeppl :> sybase docs tell me this:
mpeppl :>    run bcp "out" with the -Jutf8 switch (on the  iso_1  server)  and ensure
mpeppl :>    sp_configure "enable unicode conversions", 2 is  set.  then  bcp
mpeppl :>    "in" the file to the utf8 server.
mpeppl :>
mpeppl :>    (sounds easy enough)
mpeppl :>
mpeppl :>
mpeppl :> now, i'd like to use perl to do this...
mpeppl :>
mpeppl :> I infer this from the Sybase::CTlib (v2.15):
mpeppl :>
mpeppl :> use CS_SYB_CHARSET when connecting to the iso_1  server.
mpeppl :> ie.
mpeppl :>
mpeppl :>    my $dbh Sybase::CTlib->new($user, $pwd, $server, $pname, \
mpeppl :>                           { CON_PROPS => {CS_SYB_CHARSET =>'utf8'} });
mpeppl :>
mpeppl :>
mpeppl :> #now I figured I could get the property that indicated if conversion
mpeppl :> #was taking place if I select from this connection
mpeppl :>    my $val;
mpeppl :>    my $rc = $dbh->ct_con_props(CS_GET, CS_CHARSETCNV, $val, CS_INT_TYPE);
mpeppl :>    if($rc == CS_SUCCEED) {
mpeppl :>          print "val=$val\n";
mpeppl :>    } else {
mpeppl :>       print "ct_con_props failed\n";
mpeppl :>    }
mpeppl :>
mpeppl :> However, $val prints 0 in this case. I wouldn't expect that since unicode
mpeppl :> conversion is indeed set on the server.
mpeppl :>
mpeppl :> Has anyone else been down this path?
mpeppl :>
mpeppl :> Thanks,
mpeppl :> Steve
mpeppl :