Re: Re: Re: Re: UNIQUE on blob
> Hi everybody, > my humble excuse to all I bothered with that ... mysql type mediumblob is working > perfectly, but there's another column in the tabel of type varchar > containing mostly the same values. So that's it > Stefan > > > P. S: I do the select first because I need the ID anyway. > > > > > Hi! > > > > > > First of all, MEDIUMBLOB type is case-sensitive. > > > I checked this sequence and everything worked as > > > expected. I think you have a mistake in your table. > > > What does "SHOW CREATE TABLE table" give? > > > Second, there is no needs to check that the value is already > > > presents using "SELECT" just to avoid an attempt of double > > > key value inserting. It is safe to insert without selecting. > > > After inserting you have just to check that really happened, > > > either record was inserted or error happened. > > > Why do you want to do iy - 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
Re: UNIQUE on blob
Hi! First of all, MEDIUMBLOB type is case-sensitive. I checked this sequence and everything worked as expected. I think you have a mistake in your table. What does "SHOW CREATE TABLE table" give? Second, there is no needs to check that the value is already presents using "SELECT" just to avoid an attempt of double key value inserting. It is safe to insert without selecting. After inserting you have just to check that really happened, either record was inserted or error happened. Why do you want to do iy Stefan Kuhn wrote: > Hi everybody, > I've got a MEDIUMBLOB column in a table, where I want values to be unique. So > I made it UNIQUE. > When my program wants to enter a value, it first does a select * from table > where column =x in order to see if x already exists, if not, it does an > insert. Now the interesting point: > If there is c1c1 in the column and I want to insert C1C1, the select > says, that this is not existing, so the insert is done. Then mySQL complains > about double keys. It seems that the UNIQUE comparision is not done > case-sensitive in BLOB-columns, which is bad. > Does anybody have an idea about how to solve this (I need the column to be > case-sensitive). > Many thanks > Stefan > -- For technical support contracts, visit https://order.mysql.com/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Mr. Alexander Barkov <[EMAIL PROTECTED]> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer /_/ /_/\_, /___/\___\_\___/ Izhevsk, Russia <___/ www.mysql.com +7-902-856-80-21 - 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
UNIQUE on blob
Hi everybody, I've got a MEDIUMBLOB column in a table, where I want values to be unique. So I made it UNIQUE. When my program wants to enter a value, it first does a select * from table where column =x in order to see if x already exists, if not, it does an insert. Now the interesting point: If there is c1c1 in the column and I want to insert C1C1, the select says, that this is not existing, so the insert is done. Then mySQL complains about double keys. It seems that the UNIQUE comparision is not done case-sensitive in BLOB-columns, which is bad. Does anybody have an idea about how to solve this (I need the column to be case-sensitive). Many thanks Stefan -- Stefan Kuhn M. A. MPI of Chemical Ecology, Winzerlaer Str. 10, Beutenberg Campus, 07745 Jena, Germany Tel: +49(0)3641 571261 - Fax: +49(0)3641 571202 - 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