From f2094d7a9c37b78cc239cd99d9c2e9544e22acaa Mon Sep 17 00:00:00 2001 From: rMalie Date: Fri, 23 Dec 2011 00:05:39 +0000 Subject: [PATCH] // Fix access table for old mysql configurations git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11733 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/db/Db.php | 4 ++-- install-new/classes/xmlLoader.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/classes/db/Db.php b/classes/db/Db.php index 5be1b2fba..2d3bfe795 100644 --- a/classes/db/Db.php +++ b/classes/db/Db.php @@ -250,7 +250,7 @@ abstract class DbCore * * @param string $table Table where insert/update data * @param string $data Data to insert/update - * @param string $type INSERT or INSERT IGNORE or UPDATE + * @param string $type INSERT or INSERT IGNORE or REPLACE or UPDATE * @param string $where WHERE clause, only for UPDATE (optional) * @param int $limit LIMIT clause (optional) * @param bool $use_cache @@ -263,7 +263,7 @@ abstract class DbCore return true; $type = strtoupper($type); - if ($type == 'INSERT' || $type == 'INSERT IGNORE') + if ($type == 'INSERT' || $type == 'INSERT IGNORE' || $type == 'REPLACE') { // Check if $data is a list of row $current = current($data); diff --git a/install-new/classes/xmlLoader.php b/install-new/classes/xmlLoader.php index c1a8eb976..e39d121f0 100644 --- a/install-new/classes/xmlLoader.php +++ b/install-new/classes/xmlLoader.php @@ -406,7 +406,11 @@ class InstallXmlLoader else { // Create entity in database); - if (!Db::getInstance()->autoExecute(_DB_PREFIX_.$entity, array_map('pSQL', $data), 'INSERT IGNORE')) + $execute_type = 'INSERT IGNORE'; + if ($entity == 'access') + $execute_type = 'REPLACE'; + + if (!Db::getInstance()->autoExecute(_DB_PREFIX_.$entity, array_map('pSQL', $data), $execute_type)) $this->setError($this->language->l('An SQL error occured for entity %1$s: %2$s', $entity, Db::getInstance()->getMsgError())); $entity_id = Db::getInstance()->Insert_ID();