in reply to Calling a Sybase Procedure with NUL in a parm

What is the datatype of the parameter to the proc?

As an explanation - when you use the first form DBD::Sybase assumes that the parameter is of type VARCHAR, which may not handle the NUL bytes very well (although I think it should, really).

If the parameter is supposed to be a binary parameter (VARBINARY, for example), then you should do something like this:

$sth = $dbh->prepare("exec my_proc ?"); $sth->bind_param(1, $packed, SQL_BINARY); $sth->execute;
or convert the packed value to a hex string and pass it as a hex string litteral (method #2).

Michael

Replies are listed 'Best First'.
Re: Re: Calling a Sybase Procedure with NUL in a parm
by thor (Priest) on Feb 05, 2003 at 01:22 UTC
    to answer your question, the parameter is indeed a VARCHAR field. Hadn't thought about converting to hex...though something tells me that the application on the other side won't like it. Worth a shot though...++ for you!

    thor

      May I ask why you need to store a packed value in a varchar column? Wouldn't binary/varbinary be more appropriate?

      Now having said that this might still be a bug with DBD::Sybase - I'll look into it.

      Michael

        You're asking exactly the question that I asked. However, this table has existed for 10+ years with the behavior that I've described. Basically, we have a process that communicates with other processes bi-directionally though this table. The column in question is the "message type". Why it wasn't stored just as a straight up integer is beyond me, but like I said, I've been handed a steaming pile and I have to deal with it.

        thor