On Wed, Jun 29, 2011 at 9:27 PM, akaariai <akaar...@cc.hut.fi> wrote: > On Jun 28, 5:46 pm, Javier Guerra Giraldez <jav...@guerrag.com> wrote: >> i might be totally wrong (wouldn't be first time..) but i've found >> myself having to adapt to local dialects almost every time i see some >> SQL inside a function, especially on mysql and sqlite. maybe it's >> because of the bad quality of code i tend to see (typically >> originating from hand-coded mssql accesses deep within an excel >> sheet), but seeing CASE also rings my "i'll need an extra week just >> for this" alarm. >> > > I really do hope that the CASE WHEN construction can be used in all > supported databases. I have high hopes that it can be used, because > the CASE WHEN construction is one of the most standard constructions > in SQL, and because I have tested it on MySQL 5.0, PostgreSQL 8.4, > SQLite3 and Oracle 10g.
The CASE syntax is definitely SQL Standard, so that part is OK. I'm sure we'll discuss some weird NULL handling or similar somewhere. I'm not sure I like your ORM syntax to generate that though. Why not just pass through the case statement directly? That way *any* legal CASE statement can be used, without inventing new ORM syntax each time. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.