Date: 12/19/00
- Next message: nuitari <email protected>: "Re: [PHP-DB] searching for host"
- Previous message: MacBane: "[PHP-DB] MySQL"
- Next in thread: Mark Cowlishaw: "[PHP-DB] Re: extra spaces"
- Reply: Mark Cowlishaw: "[PHP-DB] Re: extra spaces"
- Reply: Tom Lane: "[PHP-DB] Re: [GENERAL] extra spaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 15 Dec 2000, Roland Roberts wrote:
> >>>>> "Soma" == Soma Interesting <dfunct <email protected>> writes:
>
> Soma> All values called from the database are still padded with
> Soma> extra spaces from the column size in the database. Is this
> Soma> normal - I don't remember this happening when I was using
> Soma> MySQL. I thought usually the database stripped the extra
> Soma> spaces when it retrieved the values.
>
> I guess I missed the orginal post about the problem, but...
>
> Are your columns char() or varchar()? The former is padded in
> PostgreSQL but not MySQL. The latter is what you really want.
According to "Postgres: Introduction and Concepts", varchar is slower
than char. So if you (like me) want to use char and get rid of the
padding spaces, you may use a regex replacement, as in
while ( <email protected>=$result->fetchrow)
{
$row[0] =~ s/[\s]+$//;
}
in perl, or
$array["name"]=preg_replace("'[\s]+$'", "", $array["name"], -1);
in PHP.
-- Alvaro Herrera (<alvherre[@]protecne.cl>)-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: nuitari <email protected>: "Re: [PHP-DB] searching for host"
- Previous message: MacBane: "[PHP-DB] MySQL"
- Next in thread: Mark Cowlishaw: "[PHP-DB] Re: extra spaces"
- Reply: Mark Cowlishaw: "[PHP-DB] Re: extra spaces"
- Reply: Tom Lane: "[PHP-DB] Re: [GENERAL] extra spaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

