From 96db81c50c7d72bef77ed80356ebfc315c2ef54a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 4 Mar 2010 17:18:30 +0000 Subject: [PATCH] dont use IN ( ), if there's only one value, it's slower for MySQL --- phpgwapi/inc/class.egw_db.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index 15e1ea8272..dccda952b1 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -7,7 +7,7 @@ * @package api * @subpackage db * @author Ralf Becker - * @copyright (c) 2003-9 by Ralf Becker + * @copyright (c) 2003-10 by Ralf Becker * @version $Id$ */ @@ -1469,6 +1469,11 @@ class egw_db { $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)) { $or_null = '';