Hi Mac,

I'm not talking about spaces - I'm talking about lines.

in perl speak - specifically - put this into a bind variable then
into a table:-

       "foo\r\n\r\n"

then when you get it out again, you get this:-

       "foo"

... and even if I *was* talking about spaces, it's still a bug for the
same query to have 2 different effects, depending on whether I append
nothing to a string or not :-)

Also - I'm guessing that when the data is UTF-8, there'd be times when
trimming an "\r" or "\n" or " " could screw up the data big time too?

Chris


Thursday, February 5, 2004, 9:42:18 PM, you wrote:

MAC> On 02/04/2004 09:39 PM, [EMAIL PROTECTED] wrote:

>> Executing this:-
>> 
>>      UPDATE BLAH SET TRANSLATION=? WHERE ROWID=?
>> 
>> used always to work for me, but after a recent upgrade, I notice that
>> trailing blank lines are getting truncated during this update.
>> Executing this statement instead, and the problem goes away:-
>> 
>>    UPDATE BLAH SET TRANSLATION=? || '' WHERE ROWID=?
>> 
>> I'm using DBI 1.32 afaik (from the "man" page) with the latest oracle
>> database on RedHat ES 3.0.
>> 
>> Using the former version of Oracle on RedHat 9, there was no bug (both
>> "update" statements perform the same - nothing gets truncated).
>> 
>> Using an update statement without BIND variables works fine on
>> everything - eg:-
>> 
>>     UPDATE BLAH SET TRANSLATION='line with
>> 
>>     trailing blank lines
>> 
>>     ' WHERE ROWID='jkasdfkjhdfjk'
>> 
>> I tried a range of different connect strings and other stuff, but
>> after 3 hours of experimentation, I've narrowed it down to the above
>> info. nothing else I could find/do has any effect on the problem.
>> 
>> I think this is probably a bug (either in oracle, perl, RedHat or
>> DBI!) but if anyone knows otherwise, or has any other suggestions for
>> me to try (besides adding ||'' all thought my code!) please let me
>> know!

MAC> The Oracle OCI library trims trailing spaces for VARCHAR bind variables.
MAC> It has been that way via DBI for at least a couple years.  The
MAC> workaround is to call $sth->bind_param( 1, SQL_CHAR ) before the first
MAC> execute() call.  The bind variable type is remembered for future
MAC> execute() calls.

MAC> See ora_ph_type in http://search.cpan.org/dist/DBD-Oracle/Oracle.pm as
MAC> well.

Reply via email to