Install and upgrade script will often have these calls in them:



I know they are not required due to me not using them for several such scripts. Can anyone explain their purpose and if there are any implications to using/not using them?

1 Answer 1


If you peek at Varien_Db_Adapter_Pdo_Mysql (I got there by looking into Mage_Core_Model_Resource_Setup which does getConnection()->startSetup()) you'll see that this call does some database-specific prepping:

public function startSetup()
    $this->raw_query("SET SQL_MODE=''");
    return $this;

public function endSetup()
    $this->raw_query("SET SQL_MODE=IFNULL(@OLD_SQL_MODE,'')");
    $this->raw_query("SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS=0, 0, 1)");
    return $this;

Basically most of these are for compatibility and some of them speed up a few operations (for example disabling the foreign key checks).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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