[linux] MySQL odstranuje medzery na konci retazcov

Matus "fantomas" Uhlar uhlar na fantomas.sk
Pondělí Leden 27 22:58:13 CET 2003


-> Pri vlozeni retazca do stlpca tabulky, ktory obsahuje na konci medzery 
-> pride u databazoveho servera MySQL k pre mna necakanej konverzii, ktora 
-> odstranuje koncove medzery. Demonstracny priklad:

-> Mojou otazkou je, ci je to featura alebo bug. Hladal som v dokumentacii
-> (vyrazy "trim", "white", "remove") a nie je tam o tom ziadna zmineka.  
-> Verzia MySQL je 3.23.47, privital by som, keby mi to niekto otestoval aj s
-> inymi. Dakujem.

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#CHAR

<CITE>
The length of a CHAR column is fixed to the length that you declare when you
create the table. The length can be any value between 1 and 255. (As of
MySQL Version 3.23, the length of CHAR may be 0 to 255.) When CHAR values
are stored, they are right-padded with spaces to the specified length. When
CHAR values are retrieved, trailing spaces are removed.

Values in VARCHAR columns are variable-length strings. You can declare a
VARCHAR column to be any length between 1 and 255, just as for CHAR columns.
However, in contrast to CHAR, VARCHAR values are stored using only as many
characters as are needed, plus one byte to record the length. Values are not
padded; instead, trailing spaces are removed when values are stored. (This
space removal differs from the ANSI SQL specification.)
</CITE>

ak ak dobre chapem dokumentaciu, neda sa to obist... MySQL team by ti mozno
povedal viac.

-- 
 Matus "fantomas" Uhlar, uhlar na fantomas.sk ; http://www.fantomas.sk/
 Warning: I don't wish to receive spam to this address.
 Varovanie: Nezelam si na tuto adresu dostavat akukolvek reklamnu postu.
 Eagles may soar, but weasels don't get sucked into jet engines. 



Další informace o konferenci linux