Subject | Re: [Firebird-general] Need to trim extra spaces at the end of field value - PHP / Firebird |
---|---|
Author | Carlos H. Cantu |
Post date | 2009-04-08T21:34:50Z |
Sorry, I think I need to clarify a bit more:
CHAR will return the string with as much trailing spaces needed to fit
the result size to the declared CHAR size of the field.
To make it easier to understand:
select '|' || cast('12345' as varchar(10)) || '|' from rdb$database
will return |12345|
select '|' || cast('12345' as char(10)) || '|' from rdb$database
will return |12345 |
select '|' || cast('12345 ' as varchar(10)) || '|' from rdb$database
will return |12345 |
[]s
Carlos H. Cantu
Firebird Performance in Detail - http://videos.firebirddevelopersday.com
www.firebirdnews.org - www.FireBase.com.br
CHC> This is not a support list... please send next questions to fb-support
CHC> ;)
CHC> BTW, "PHP is correct", since char in Firebird really store the
CHC> trailing spaces. If you dont want it, use VARCHAR, or use TRIM
CHC> function in the select to remove the spaces.
CHC> []s
CHC> Carlos H. Cantu
CHC> Firebird Performance in Detail -
CHC> http://videos.firebirddevelopersday.com
CHC> www.firebirdnews.org - www.FireBase.com.br
HDC>> Hi all
HDC>> I'm having trouble because PHP ibase_fetch_object() is returning
HDC>> extra spaces at the end of field value when datatye is char. Is
HDC>> there some work arround for avoiding this.
HDC>> Any help will be appreciated.
HDC>> Nando.
HDC>> ------------------------------------
HDC>> Community email addresses:
HDC>> Post message: Firebird-general@yahoogroups.com
HDC>> Subscribe: Firebird-general-subscribe@yahoogroups.com
HDC>> Unsubscribe: Firebird-general-unsubscribe@yahoogroups.com
HDC>> List owner: Firebird-general-owner@yahoogroups.com
HDC>> Shortcut URL to this page:
HDC>> http://www.yahoogroups.com/community/Firebird-generalYahoo! Groups Links
CHC> ------------------------------------
CHC> Community email addresses:
CHC> Post message: Firebird-general@yahoogroups.com
CHC> Subscribe: Firebird-general-subscribe@yahoogroups.com
CHC> Unsubscribe: Firebird-general-unsubscribe@yahoogroups.com
CHC> List owner: Firebird-general-owner@yahoogroups.com
CHC> Shortcut URL to this page:
CHC> http://www.yahoogroups.com/community/Firebird-generalYahoo! Groups Links
CHAR will return the string with as much trailing spaces needed to fit
the result size to the declared CHAR size of the field.
To make it easier to understand:
select '|' || cast('12345' as varchar(10)) || '|' from rdb$database
will return |12345|
select '|' || cast('12345' as char(10)) || '|' from rdb$database
will return |12345 |
select '|' || cast('12345 ' as varchar(10)) || '|' from rdb$database
will return |12345 |
[]s
Carlos H. Cantu
Firebird Performance in Detail - http://videos.firebirddevelopersday.com
www.firebirdnews.org - www.FireBase.com.br
CHC> This is not a support list... please send next questions to fb-support
CHC> ;)
CHC> BTW, "PHP is correct", since char in Firebird really store the
CHC> trailing spaces. If you dont want it, use VARCHAR, or use TRIM
CHC> function in the select to remove the spaces.
CHC> []s
CHC> Carlos H. Cantu
CHC> Firebird Performance in Detail -
CHC> http://videos.firebirddevelopersday.com
CHC> www.firebirdnews.org - www.FireBase.com.br
HDC>> Hi all
HDC>> I'm having trouble because PHP ibase_fetch_object() is returning
HDC>> extra spaces at the end of field value when datatye is char. Is
HDC>> there some work arround for avoiding this.
HDC>> Any help will be appreciated.
HDC>> Nando.
HDC>> ------------------------------------
HDC>> Community email addresses:
HDC>> Post message: Firebird-general@yahoogroups.com
HDC>> Subscribe: Firebird-general-subscribe@yahoogroups.com
HDC>> Unsubscribe: Firebird-general-unsubscribe@yahoogroups.com
HDC>> List owner: Firebird-general-owner@yahoogroups.com
HDC>> Shortcut URL to this page:
HDC>> http://www.yahoogroups.com/community/Firebird-generalYahoo! Groups Links
CHC> ------------------------------------
CHC> Community email addresses:
CHC> Post message: Firebird-general@yahoogroups.com
CHC> Subscribe: Firebird-general-subscribe@yahoogroups.com
CHC> Unsubscribe: Firebird-general-unsubscribe@yahoogroups.com
CHC> List owner: Firebird-general-owner@yahoogroups.com
CHC> Shortcut URL to this page:
CHC> http://www.yahoogroups.com/community/Firebird-generalYahoo! Groups Links