Whilst Current Geek Me enjoyed writing this SELECT statement for mySQL

SELECT id, price, lesson AS l, CONCAT((DATE_FORMAT(start_date, ‘%a %D %b %Y : ‘)), IF(DATE_FORMAT(start_date, ‘%i’) = ‘00’, LOWER(DATE_FORMAT(start_date, ‘%l%p’)), LOWER(DATE_FORMAT(start_date, ‘%l:%i%p’))), ’ - ‘, IF(DATE_FORMAT(end_date, ‘%i’) = ‘00’, LOWER(DATE_FORMAT(end_date, ‘%l%p’)), LOWER(DATE_FORMAT(end_date, ‘%l:%i%p’))), ’ : $’, price) AS d, start_date AS sd, end_date AS ed, longdesc AS f FROM `cookingSchool` WHERE (start_date >= ‘2012-01-01 03:33:28’) ORDER BY start_date ASC

I’m sure Future Me is going to hate me when I have to change it.

Lazy coding: I know SQL better than I know how to chop up strings in Obj-C. 

My current approach with iOS coding is to just return some JSON with the strings just how I like so I have to do as little in Obj-C as possible. My justification is that the iOS device has limited processing power and my big chunky server has CPU cycles and disk to spare. I’ll just keep saying that until it isn’t true any longer. Probably around the time the iPhone 5 arrives.

  1. firecall posted this