Sign up ×
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

I have created a stored procedure which do some updates in database. Now when I am trying to add that stored procedure using magento install script from sql folder, It is not being updated..

I cannot see stored procedure created in database.. I am using below syntax there

$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$write->query(STORED_PROCEDURE_SYNTAX);
share|improve this question

1 Answer 1

up vote 0 down vote accepted

Thank you all. I got solution from another stackoverflow comment

Now I have used syntax as below.

$sql = <<< __SQLPRC
STORED_PROCEDURE
__SQLPRC;

and run it using

$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$write->exec($sql);

and it is working fine now

share|improve this answer
    
Does the .sql file not work in your scenario? (Which imo sounds like the better way of running SQL code) – Ash Sep 23 '14 at 13:13
    
I have not tried it as now I got solution using php file. But will try that in future – Shabbir Sep 23 '14 at 13:14
    
I would recommend looking over This article by Alan Storm to understand how set-up resources work and i'm then sure you can create a install-X.X.X.sql to run the SQL syntax directly as your solution is a long winded way of the same thing. – Ash Sep 23 '14 at 13:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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