Subject | RE: [firebird-support] LTRIM and RTRIM failures |
---|---|
Author | Rick Debay |
Post date | 2006-05-11T21:40:24Z |
I'm getting this via email, thus the top-posting.
The VARCHAR field is actually a domain:
CREATE DOMAIN D_PO AS
VARCHAR(16)
COLLATE ISO8859_1;
Production is running LI-V6.3.1.4481 Firebird 1.5 which I think is
1.5.1.
but LTRIM and RTRIM showing something else. Unless... I only checked
one character, maybe the LAST character is not a space?
I won't be able to respond again until Monday, you see I have to take my
son to Disneyworld. Sometimes it pays to be a parent :-)
Rick
-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Milan Babuskov
Sent: Thursday, May 11, 2006 4:31 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] LTRIM and RTRIM failures
Rick Debay wrote:
didn't bother to read rest of the message as you placed the question on
top:
http://lists.freebsd.org/pipermail/freebsd-chat/2004-August/002567.html
As for original question...
Results: 11, 11
I guess this is the problem? However, I'm unable to reproduce it (as
shown below). Perhaps you could give more details: FB version, operating
system, database (and column) charset.
I took FB2.0 and used the EMPLOYEE database:
update employee
set first_name = ' Robert '
where first_name = 'Robert';
commit;
select
'*'||first_name||'*' original, strlen(first_name) len,
'*'||ltrim(first_name)||'*' ltrimmed, '*'||rtrim(first_name)||'*'
rtrimmed, '*'||ltrim(rtrim(first_name))||'*' bothtrim,
strlen(ltrim(rtrim(first_name)))
from EMPLOYEE
where first_name CONTAINING 'Rob';
returns:
ORIGINAL LEN LTRIMMED RTRIMMED BOTHTRIM STRLEN
------------- --- ----------- ---------- --------- ------
* Robert * 11 *Robert * * Robert* *Robert* 6
*Roberto* 7 *Roberto* *Roberto* *Roberto* 7
Everything looks ok to me.
1)) > from rdb$database > Results: 3, 32
This one looks ok too.
--
Milan Babuskov
http://swoes.blogspot.com/
http://www.flamerobin.org
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links
The VARCHAR field is actually a domain:
CREATE DOMAIN D_PO AS
VARCHAR(16)
COLLATE ISO8859_1;
Production is running LI-V6.3.1.4481 Firebird 1.5 which I think is
1.5.1.
> This one looks ok too.That was a sanity check. The strange one is the ASCII_VAL showing 32,
but LTRIM and RTRIM showing something else. Unless... I only checked
one character, maybe the LAST character is not a space?
I won't be able to respond again until Monday, you see I have to take my
son to Disneyworld. Sometimes it pays to be a parent :-)
Rick
-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Milan Babuskov
Sent: Thursday, May 11, 2006 4:31 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] LTRIM and RTRIM failures
Rick Debay wrote:
> Table DDL shows the field as VARCHAR.Oh, I see it now. Well, now you know why top-posting is Bad(tm). I
didn't bother to read rest of the message as you placed the question on
top:
http://lists.freebsd.org/pipermail/freebsd-chat/2004-August/002567.html
As for original question...
> Let's test that particular item again > Select strlen(po.PO),strlen(ltrim(rtrim(po.PO))) > from RPL_PO po where po.ID = 3144 >
Results: 11, 11
I guess this is the problem? However, I'm unable to reproduce it (as
shown below). Perhaps you could give more details: FB version, operating
system, database (and column) charset.
I took FB2.0 and used the EMPLOYEE database:
update employee
set first_name = ' Robert '
where first_name = 'Robert';
commit;
select
'*'||first_name||'*' original, strlen(first_name) len,
'*'||ltrim(first_name)||'*' ltrimmed, '*'||rtrim(first_name)||'*'
rtrimmed, '*'||ltrim(rtrim(first_name))||'*' bothtrim,
strlen(ltrim(rtrim(first_name)))
from EMPLOYEE
where first_name CONTAINING 'Rob';
returns:
ORIGINAL LEN LTRIMMED RTRIMMED BOTHTRIM STRLEN
------------- --- ----------- ---------- --------- ------
* Robert * 11 *Robert * * Robert* *Robert* 6
*Roberto* 7 *Roberto* *Roberto* *Roberto* 7
Everything looks ok to me.
> Hmmm, let me put quotes around it in order to see leading or trailing= 3144
> characters > select '''' || po.PO || '''' from rpl_po po where po.ID
> Results: '2895-01V 'strlen(ltrim(rtrim(' xxx '))), > ascii_val(substring(' xxx ' from 5 for
>
> Let's test LTRIM and RTRIM and see what they return > select >
1)) > from rdb$database > Results: 3, 32
This one looks ok too.
--
Milan Babuskov
http://swoes.blogspot.com/
http://www.flamerobin.org
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links