- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
I wept with laughter.
Admin
// We can't do this in SQL as SQL has no Regex... DB = DoQuery("SELECT * FROM Users");
while (GetNextRecord(DB)) { if(RegEx(GetField(DB,"Firstname"), ... DoStuff(); }
I am not a robot.
Admin
Please show some sensitivity. I have a colleague called Adam with whom I had a meeting this morning. Trying not to laugh was no laughing matter, I can assure you.
Admin
Using the collate function to query, does this work with indexes? I can imagine if you are searching a very large database of people that these kinds of things could get rather slow if the index isn't built with this kind of text substitution in mind.
To that end, I would think that if handling these characters for names is a requirement, but searching them with accents, etc. stripped is also a requirement, I would have a field that stores the stripped names, and then strip them before I do a search.
Is this a valid answer, database people?
Admin
Admin
Admin
No, it's a type of duck, but it could be shellfish too, depends on how you cast inline to an object space of tuples.
{captcha:[minim]:ahctpac}
Admin
What a hack, using SELECT *, tisk tisk.
Admin
At least in Oracle you can create function-based indices.
Admin
TRWTF is that he thinks a "tech of technology" is a meaningful phrase.
Admin
Great idea. If I ever have twins I am going to name them both the same name, that way they can share legal name and DOB.
My humble little way of getting back at the matrix.
Admin
sigh its a marine mammal, closly related to whales and porpoises. Also... Is your google broken? or are you really that lazy? http://en.wikipedia.org/wiki/Dolphin
Admin
Any dev who deals with SQL DBs must know that SQL is a powerful language, and ideally suited for any kind of set-based query or operation, obviously perfect for datasets. It sounds like these dickheads had no understanding of this. I had to maintain an app like that - loads of generic "select * from x where id='y' " queries then looping through recordsets accumulating totals or doing lots of repeated filtering or worse still, nested loops doing a query with every iteration of the inner loop , to say, do some stuff & populate a list control. So often huge slow code blocks were replaced with a nice stored proc which returned just what was wanted in a fraction of the time
Admin
Regarding Anti-SQL Coalition, I have the impression NoSQL has the very same attitude. There is a bunch of morons who think that database should be just a flat file which they can write and read without any scheme.
Obviously, these idiots have to re-invent the wheel and code some scheme anyway, in a programming language which is not intended for it. They also have to implement custom routines for referential integrity, live without foreign keys, triggers, DB functions, and many other useful tools.
Essentially, there are perhaps 3 big companies that have a good reason to use a flat file instead of SQL RDBMS and then there are several thousand kiddies claiming SQL is crap because you need a scheme, or because it's not scalable, and so they use NoSQL. The scalability argument is false (they don't understand what they say), and the scheme argument is stupid (they don't understand what they say - when they skip the scheme it only leads to unknown structure, mess, disorder, and problems + there has to be something to have its role in the code)
Admin
And you has problem with C of 'ACID' when you have to deal with it manually, it is not a good thing. The relational DBMS solves this problem also. But when using those NoSql "databases" (i recuse to call it a database, perhaps a file system) will has to think carefully, but these idiots generally are some kids drop out of college and dont have real life experince, they all say shit and think that java can solve all problems.
Admin
UUID/GIUD as a unique constraint = good idea. UUID/GUID as the primary key = dumb idea.
You can have and use both. But in nearly every situation imaginable, the primary key should be an auto-incrementing integer -- and it should definitely NOT come from non-overlapping ranges for different tables.
In SQLite, if you don't specify a primary key, it automatically uses an 64-bit signed integer called ROWID as an auto-incrementing primary key.
Admin
CREATE INDEX person_name_index ON Persons( Replace(Replace(Replace(Replace( Replace(Replace(Replace(Replace( Replace(Replace(Replace(Replace( Replace(Replace(Replace(Replace(name, ' ',''), 'É','E'),'È','E'),'Ê','E'),'Ë','E'), 'À','A'),'Â','A'),'Ä','A'), 'Ï','I'),'Î','I'), 'Ç','C'), 'Ô','O'),'Ö','O'), 'Ü','U'),'Ù','U'),'Û','U') LIKE @name) )
Admin
Arrrggh...can we scale back on these fish puns, please?
Admin
Oh come on, that's just infantile. I can't believe that in 2011 people are still saying this. "SELECT *" is a great way to write a query that's robust with respect to addition / removal of columns. It surprises me that there's still hatred out there for "SELECT *", considering that most of the people who say things like this are working in interpreted languages with out-of-thread garbage collection mechanisms. Believe me, "SELECT *" is the least of your problems.
Admin
Yeah, really. Let's talk about the LPGA or the Indigo Girls or something else completely unrelated to fish.
Admin
I hate to be 'that guy', but don't you find stored procedures to be an incredible pain in the ass to deal with? I've basically banned them for the project I'm working on now. Yes, they can be very effective as targeted optimizations, but I've just never been able to set up the necessary infrastructure to debug T-SQL the same way I can debug C# or VB.NET. The result is a very disjointed developer experience. I know that, in theory, I should be able to do most of the same interactive debugging in T-SQL as I do in my client (C#) application. In practice, I get error messages which I interpret to mean, "go to the DBA with hat in hand."
I do believe in using a relational database, and in combining as much as possible into a single query (or DML statement). I'm not part of the "NoSQL" crowd. But I do think that stored procedures have some serious drawbacks. If I ever add any into my project, it will be in (desperate) response to real, observable performance issues.
Admin
Admin
Admin
Admin
Despite the fact the you're essentialy wrong, as someone else noted already, using php this way makes all PHP programmers look bad. check iconv with //translit option, and stop using user submitted cr*p code like this.
Admin
Admin
Yes, but when you have a to make a JOIN between a fact table with 10 billion rows and a master table with 100 rows, you use 16 bytes for each match instead of 4 (if using INT) or 1 (TINYINT). I have seen great performanc issues due to the use of GUID as PK in tiny tables referenced across tables with many data.
Admin
Their solution was horrible, and the solution of the OP is quite correct, but anyway I do see their point.
Of course, the solutioni is not writing that horrible sql. Being that a query used by an application, you could validate and clean user input before passing it to sql, avoiding the need of sql replaces or collate.
Personally I'm against logic inside the db, and against sprocs in a general way. Nowadays DDD design, ORMs and innovative technologies like Linq and other similar stuff can allow use to avoid the direct use of sql for about 90% of our needs.
Admin
"123 NW Main St #302"
I can think of almost no good reason to fragment that into House, Dir, Street, Type, and AptNo fields.