List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:July 25 2002 7:04pm
Subject:Re: question about varchars
View as plain text  
Your application uses the field size and type to validate the data 
BEFORE sending it to MySQL.

Norris, Joseph wrote:

>What you say below is of great interest to me.  Currently I have been
>writing front end code to handle the size
>issue but I would like to be open to other possibilities. So my question
>about your answer below is:
>Just how does the developer obtain the error condition from Mysql when an
>or update sends data that is too long to a field with a restricted size?
>-----Original Message-----
>From: Ralf Narozny [mailto:rnarozny@stripped]
>Sent: Thursday, July 25, 2002 1:59 AM
>To: Desmond Lee
>Cc: mysql@stripped
>Subject: Re: question about varchars
>Desmond Lee wrote:
>>Hello there
>>Mysql documentation says the following:
>>"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."
>>So, then would there be anything wrong with making all my varchar's up 
>>to 255. That is defining most of my fields to be varchar(255) even 
>>when i know they may only go 100?
>There's nothing wrong with it for storage reasons only, but many 
>database developers use lengths to restrict the size of the entries. For 
>example storing the zipcodes from more than one country might need at 
>max 15 characters, so why allowing 255, preventing MySQL to raise an 
>error, if the ZIP is 100 chars long.
> Ralf

question about varcharsDesmond Lee25 Jul
  • Re: question about varcharsRalf Narozny25 Jul
  • Re: question about varcharsHarald Fuchs25 Jul
  • Re: question about varcharsVictoria Reznichenko25 Jul
RE: question about varcharsJoseph Norris25 Jul
  • Re: question about varcharsGerald Clark25 Jul
Re: question about varcharstoby -28 Jul
Re: question about varcharsxuefer tinys28 Jul