List:MySQL and Java« Previous MessageNext Message »
From:Mark Matthews Date:January 21 2003 6:39pm
Subject:Re: Possible bug in PreparedStatement.setString(int,String) ?
View as plain text  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Luca Lafranchi wrote:
>> Nope. It's a feature. See http://www.mysql.com/doc/en/CHAR.html
>>
>> "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.)"
>>
> 
> Ok, but then how do I store and retrieve a string with trailing spaces, 
> given that even with CHAR columns those spaces are "removed upon 
> retrieval"?


Use a column of type 'TEXT':

http://www.mysql.com/doc/en/BLOB.html

	-Mark


- -- 
MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/

For technical support contracts, visit https://order.mysql.com/?ref=mmma

     __  ___     ___ ____  __
    /  |/  /_ __/ __/ __ \/ /  Mark Matthews <mark@stripped>
   / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
  /_/  /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
         <___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.1.90 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQE+LZPstvXNTca6JD8RAtPAAJiiZqn3bBsUN1VZr0q4rGMm1osbAJ4ra3n9
m2mxnFQLa8KKYVL62W4q9A==
=Yyyr
-----END PGP SIGNATURE-----

Thread
Possible bug in PreparedStatement.setString(int,String) ?Luca Lafranchi21 Jan
  • Re: Possible bug in PreparedStatement.setString(int,String) ?Mark Matthews21 Jan
  • Re: Possible bug in PreparedStatement.setString(int,String) ?Luca Lafranchi21 Jan
    • Re: Possible bug in PreparedStatement.setString(int,String) ?Mark Matthews21 Jan
      • load file errorRemoved13 Nov
    • installation problemRemoved13 Nov
  • Re: Possible bug in PreparedStatement.setString(int,String) ?Luca Lafranchi22 Jan