The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Grrr, snarl and other such things by deadweasle 2005-05-17 12:48:04
MySQL is evil! Yes, very, very, evil...

Anyone care to tell me why or how MySQL believes this:

DELETE FROM cats WHERE catID LIKE 123-11-11

means delete everything in the stupid table!?!?

To explain:
I have a table, filled with info about cats for a cat shelter, each cat has an ID that is a varchar and looks like so: 123-1-12. I didn't make the ID's up - they were that way when I got here. Anyway it was late and I forgot to quote the string. It deleted every entry in the table. Not 0 affected rows, not an error, just delete everything. Using like to compare a varchar field to a set of numbers with a dash in them will delete everything in the table, if you just have a number it behaves as it should, the moment that dash enters the picture good-bye data. *mutter*

- DW
[ Reply ]
  Out of curiosity by Elessar2005-05-17 13:16:05
    because I was lazy... by deadweasle2005-05-17 13:23:22
  And this is why transactions are good. by Arachnid2005-05-17 13:51:52

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)