Re: Converting SQL Dialects

From: Date: Thu, 23 Jul 2009 19:39:08 +0000
Subject: Re: Converting SQL Dialects
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-295773@lists.php.net to get a copy of this message
> You might even be able to convert EMPTY(X) to COALESCE(X, '') = ''. > MySQL seems to be pretty forgiving with its implicit type-casting. Hmm... The new system I've written properly handles the datatype and EMPTY... So this would be a hack to much around with regexs to replace EMPTY in customer built selects. Now I fiddled around with this on 5.1.33-community on Windows and I get the following odd results... select coalesce(0,"")=0,coalesce("","")=0,coalesce(0,"")=0,coalesce("","")=0; returns 1, 1, 1, 1 but... select coalesce(0,"")="",coalesce("","")="",coalesce(0,"")="",coalesce("","")=""; returns 0, 1, 0, 1 Which implies that in certain circumstances "" = 0 but 0 != "" (unless I'm missing something). Either way it looks like I can use coalesce(X,"")=0 which should be useful! Matt

« previous php.general (#295773) next »