From: <lph...@us...> - 2010-04-09 20:10:13
|
Revision: 26559 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=26559&view=rev Author: lphuberdeau Date: 2010-04-09 19:09:43 +0000 (Fri, 09 Apr 2010) Log Message: ----------- [FIX] When no values are provided, invalid SQL is generated. Equivalent of field IN() is false Modified Paths: -------------- branches/5.x/lib/core/lib/TikiDb.php Modified: branches/5.x/lib/core/lib/TikiDb.php =================================================================== --- branches/5.x/lib/core/lib/TikiDb.php 2010-04-09 19:02:12 UTC (rev 26558) +++ branches/5.x/lib/core/lib/TikiDb.php 2010-04-09 19:09:43 UTC (rev 26559) @@ -223,8 +223,13 @@ $part = '`' . $part . '`'; $field = implode('.', $parts); $bindvars = array_merge( $bindvars, $values ); - $values = rtrim( str_repeat( '?,', count( $values ) ), ',' ); - return " $field IN( $values ) "; + + if( count( $values ) > 0 ) { + $values = rtrim( str_repeat( '?,', count( $values ) ), ',' ); + return " $field IN( $values ) "; + } else { + return " 0 "; + } } // }}} function parentObjects(&$objects, $table, $childKey, $parentKey) // {{{ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |