6

I am comparing my old local.xml file with a new one (both run same version but one store was upgraded since 2010) and my old one is missing some attributes, should I add them? Is there any advantage by doing so?

<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>

Old local.xml

<host>localhost</host>
<username><![CDATA[yyy]]></username>
<password><![CDATA[yyyy]]></password>
<dbname><![CDATA[yyy]]></dbname>
<active>1</active>

New XML

<host><![CDATA[localhost]]></host>
<username><![CDATA[ffff]]></username>
<password><![CDATA[ffff]]></password>
<dbname><![CDATA[fff]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
<active>1</active>
6

If you look through the code in './app/code/core/Mage/Core/Model/Resource.php', you will see that Magento refers to the config node 'initStatements', seen here:

if ($connection instanceof Varien_Db_Adapter_Interface) {
    // run after initialization statements
    if (!empty($config['initStatements'])) {
        $connection->query($config['initStatements']);
    }
} else {
    $connection = false;
}

In this case, as your config does not contain the node 'initStatements' the query $connection->query($config['initStatements']) will never be executed.

The config from your original post is only MYSQL settings. So adding these will not alter any database settings, only the way queries are ran via Magento.

However if your store is running perfectly fine, then i would suggest to keep the configs as they are as Magento is more than likely to set these by default anyways.

If not then please (AS ALWAYS) perform this update on a test enviroment.

  • Wow, thanks! Do you think that adding those could slow down site by soe miliseconds as it now adds more attributes? – Vygantas Aug 1 '15 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.