[-] BO : remove sprintf() which are unnecessary

This commit is contained in:
lLefevre
2012-03-29 08:31:28 +00:00
parent 1b4093ba12
commit ba4e1a2baf
6 changed files with 12 additions and 24 deletions
+3 -3
View File
@@ -86,11 +86,11 @@ class CustomerMessageCore extends ObjectModel
FROM '._DB_PREFIX_.'customer_message FROM '._DB_PREFIX_.'customer_message
'); ');
else else
return (int)Db::getInstance()->getValue(sprintf(' return (int)Db::getInstance()->getValue('
SELECT COUNT(*) SELECT COUNT(*)
FROM '._DB_PREFIX_.'customer_message FROM '._DB_PREFIX_.'customer_message
WHERE %s WHERE '.$where
', $where)); );
} }
} }
+3 -3
View File
@@ -122,11 +122,11 @@ class CustomerThreadCore extends ObjectModel
FROM '._DB_PREFIX_.'customer_thread FROM '._DB_PREFIX_.'customer_thread
'); ');
else else
return (int)Db::getInstance()->getValue(sprintf(' return (int)Db::getInstance()->getValue('
SELECT COUNT(*) SELECT COUNT(*)
FROM '._DB_PREFIX_.'customer_thread FROM '._DB_PREFIX_.'customer_thread
WHERE %s WHERE '.$where
', $where)); );
} }
public static function getMessageCustomerThreads($id_customer_thread) public static function getMessageCustomerThreads($id_customer_thread)
+2 -2
View File
@@ -294,12 +294,12 @@ class EmployeeCore extends ObjectModel
public static function getTotalEmployeeShopById($id) public static function getTotalEmployeeShopById($id)
{ {
return (int)Db::getInstance()->getValue(sprintf('SELECT COUNT(*) FROM`'._DB_PREFIX_.'employee_shop` WHERE `id_employee` = %d', (int)$id)); return (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM`'._DB_PREFIX_.'employee_shop` WHERE `id_employee` = '.(int)$id);
} }
public static function getEmployeeShopById($id) public static function getEmployeeShopById($id)
{ {
$result = Db::getInstance()->executeS(sprintf('SELECT * FROM`'._DB_PREFIX_.'employee_shop` WHERE `id_employee` = %d', (int)$id)); $result = Db::getInstance()->executeS('SELECT * FROM`'._DB_PREFIX_.'employee_shop` WHERE `id_employee` = '.(int)$id);
$data = array(); $data = array();
foreach ($result as $group_data) foreach ($result as $group_data)
$data[] = (int)$group_data['id_shop']; $data[] = (int)$group_data['id_shop'];
+2 -2
View File
@@ -101,7 +101,7 @@ class RequestSqlCore extends ObjectModel
*/ */
public static function getRequestSqlById($id) public static function getRequestSqlById($id)
{ {
return Db::getInstance()->executeS(sprintf('SELECT `sql` FROM `'._DB_PREFIX_.'request_sql` WHERE `id_request_sql` = %d', $id)); return Db::getInstance()->executeS('SELECT `sql` FROM `'._DB_PREFIX_.'request_sql` WHERE `id_request_sql` = '.(int)$id);
} }
/** /**
@@ -216,7 +216,7 @@ class RequestSqlCore extends ObjectModel
*/ */
public function getAttributesByTable($table) public function getAttributesByTable($table)
{ {
return Db::getInstance()->executeS(sprintf('DESCRIBE %s', $table)); return Db::getInstance()->executeS('DESCRIBE '.pSQL($table));
} }
/** /**
+1 -7
View File
@@ -153,13 +153,7 @@ class GroupShopCore extends ObjectModel
*/ */
public static function getGroupShopById($id, $identifier, $table) public static function getGroupShopById($id, $identifier, $table)
{ {
$sql = sprintf(' return Db::getInstance()->executeS('SELECT `id_group_shop`, `'.pSQL($identifier).'` FROM `'._DB_PREFIX_.pSQL($table).'_group_shop` WHERE `'.pSQL($identifier).'` = '.(int)$id);
SELECT `id_group_shop`, `%s`
FROM `'._DB_PREFIX_.'%s_group_shop`
WHERE `%s` = %d'
, $identifier, $table, $identifier, $id);
return Db::getInstance()->executeS($sql);
} }
public function copyGroupShopData($old_id, $tables_import = false, $deleted = false) public function copyGroupShopData($old_id, $tables_import = false, $deleted = false)
+1 -7
View File
@@ -641,13 +641,7 @@ class ShopCore extends ObjectModel
*/ */
public static function getShopById($id, $identifier, $table) public static function getShopById($id, $identifier, $table)
{ {
$sql = sprintf(' return Db::getInstance()->executeS('SELECT `id_shop`, `'.pSQL($identifier).'` FROM `'._DB_PREFIX_.pSQL($table).'_shop` WHERE `'.pSQL($identifier).'` = '.(int)$id);
SELECT `id_shop`, `%s`
FROM `'._DB_PREFIX_.'%s_shop`
WHERE `%s` = %d',
pSQL($identifier), pSQL($table), pSQL($identifier), $id);
return Db::getInstance()->executeS($sql);
} }
public static function setContext($type, $id = null) public static function setContext($type, $id = null)