[linux] MySQL odstranuje medzery na konci retazcov

Ondrej Jombik nepto na pobox.sk
Středa Leden 29 21:48:42 CET 2003


> 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.

Dakujem, toto som si v manuali nevsimol. Obavam sa, ze to chapes dobre.  
Cize akokolvek by som sa snazil, pri MySQL vo VARCHAR a CHAR na konci mat
medzery nebudem. Mozem teda:

	* zvolit iny datovy typ (BLOB to uz robit nebude? - skutocne 
	  efektivne)
	* pouzit workaround (zapisat si na koniec retazca nejaky znak a 
	  ten pri tahani dat z databazy odstranit; skutocne uzasne)
	* zmenit RDBMS (skutocne komplexne)

Celkom prijemna situacia. Necham si to prejst hlavou. ;-)

--
  _/|   Ondrej Jombik - nepto na php.net - http://www.nepto.sk - OJ812-RIPE
 <_  \  Platon SDG - open source software development - http://platon.sk
   `\|  Nech operacia X na mnozine G tvori grupu, potom plati...  rundu!
    '`




Další informace o konferenci linux