Binary is an option on the varchar type
I pulled the following quote from the mysql website.

It just does not seem to be working anymore.

[NATIONAL] VARCHAR(M) [BINARY]
A variable-length string. NOTE: Trailing spaces are removed when the
value is stored (this differs from the ANSI SQL specification). The
range of M is 1 to 255 characters. VARCHAR values are sorted and
compared in case-insensitive fashion unless the BINARY keyword is given.
See section 7.7.1 Silent Column Specification Changes. VARCHAR is a
shorthand for CHARACTER VARYING. See section 7.3.4.1 The CHAR and
VARCHAR Types.

Rolf Hopkins wrote:
> 
> I think you are a bit confused with binary and varchar.  varchar is used to
> store strings such as "the cow jumped over the moon" and binary means that
> it is case sensitive.
> 
> You are trying to insert a hex value of 0x1, right?  I think this is an
> illegal value and those two entries are set to NULL.  MySQL behaves
> differently from standard in that it inserts default values instead, if
> there is an error, which in your case, would be NULL.  What you want instead
> is an integer column.
> 
> ----- Original Message -----
> From: "Tommie Jones" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, February 07, 2001 3:30
> Subject: binary bug in mysql 3.23.30-gamma
> 
> > In the process of converting over to 3.23.30-gamma from 3.22
> >
> > whenever I set the field to a binary field to a value it stores it in
> > the database as zero.
> >
> > Does anyone have any suggestions.
> >
> > I am having a problem with the binary data type... Here is the log to
> > demonstrate.
> >
> >
> > ---------------------------------------------------------
> > mysql> create table crud (bin varchar(16) binary);
> > Query OK, 0 rows affected (0.02 sec)
> >
> > mysql> insert into crud (bin) values (0x1);
> > Query OK, 1 row affected (0.00 sec)
> >
> > mysql> insert into crud (bin) values (0x2);
> > Query OK, 1 row affected (0.00 sec)
> >
> > mysql> select * from crud where bin=0;
> > +------+
> > | bin  |
> > +------+
> > |     |
> > |     |
> > +------+
> > 2 rows in set (0.00 sec)
> >
> > mysql> select * from crud where bin=0x0;
> > +------+
> > | bin  |
> > +------+
> > |     |
> > |     |
> > +------+
> > 2 rows in set (0.00 sec)
> >
> > mysql> select * from crud where bin=0x1;
> > Empty set (0.00 sec)
> >
> > mysql> select * from crud where bin=0x2;
> > Empty set (0.00 sec)
> >
> > ----------------------------------------------------------------------
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to