dont use IN ( ), if there's only one value, it's slower for MySQL

This commit is contained in:
Ralf Becker 2010-03-04 17:18:30 +00:00
parent 0f2eceefb8
commit 96db81c50c

View File

@ -7,7 +7,7 @@
* @package api * @package api
* @subpackage db * @subpackage db
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de> * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2003-9 by Ralf Becker <RalfBecker-AT-outdoor-training.de> * @copyright (c) 2003-10 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @version $Id$ * @version $Id$
*/ */
@ -1469,6 +1469,11 @@ class egw_db
{ {
$maxlength = $column_definitions[$key]['type'] == 'varchar' ? $column_definitions[$key]['precision'] : null; $maxlength = $column_definitions[$key]['type'] == 'varchar' ? $column_definitions[$key]['precision'] : null;
} }
// dont use IN ( ), if there's only one value, it's slower for MySQL
if (is_array($data) && count($data) == 1)
{
$data = array_shift($data);
}
if (is_array($data)) if (is_array($data))
{ {
$or_null = ''; $or_null = '';