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: Peter Sinnott <psinnottie at aol dot com>
Subject: Re: DBD::Sybase - Inserting null character
Date: Jul 8 2004 12:51PM

On Thu, Jul 08, 2004 at 02:30:50PM +0200, Michael Peppler wrote:
> On Wed, 2004-07-07 at 17:12, Peter Sinnott wrote:
> > 
> > I have a table that I need to update some rows in. The update procedure
> > available requires that I pass all the fields of the row into it. Some
> > of the existing rows have null characters. I'd like to preserve 
> > null characters in the columns I'm not changing.
> 
> In dbdimp.c, function _dbd_rebind_ph() we have:
> 
>       default:
>         phs->datafmt.datatype = CS_CHAR_TYPE;
>         value = phs->sv_buf;
>         value_len = CS_NULLTERM; /*Allow embedded NUL bytes in strings?*/
>         /* PR/446: should an empty string cause a NULL, or not? */
>         if(*(char*)value == 0) {
>         if(imp_dbh->bindEmptyStringNull) {
>             value = NULL;
>             value_len = CS_UNUSED;
>         } else {
>             value = " ";
>         }
>         }
>         break;
> 
> Try commenting out that "value_len = CS_NULLTERM", rebuild, and then use
> the $sth = $dbh->prepare("exec proc_name ?, ?") form to run your proc.
> The NUL bytes *should* now get sent to the server.

This does indeed seem to do the trick. 
Thank you for your help with this.


Peter

-- 
It's our responsibility to seamlessly create unique benefits in order to 
enthusiastically maintain high standards in technology