0

Php script:

   $db = Zend_Db_Table::getDefaultAdapter();
   $file_content = file_get_contents('file.sql', FILE_USE_INCLUDE_PATH);
   if($file_content!=''){
       $db->query($sql);
   }

It works for me if the sql file contains a simple sql query.

My sql file contains a procedure declaration:

DELIMITER $$
CREATE PROCEDURE PROC()
BEGIN
    ALTER ...... ;
    DELETE ..... ;
END $$
DELIMITER ;

2 Answers 2

1

If content of your file.sql is used as sql query string, it should look like the following(without "delimiters"):

CREATE PROCEDURE PROC()
BEGIN
    ALTER ...... ;
    DELETE ..... ;
END

Also, check if a certain procedure doesn't exist in database beforehand:

SELECT EXISTS (SELECT 1 FROM mysql.proc p WHERE db = 'db_name' 
AND name = 'PROC');
Sign up to request clarification or add additional context in comments.

Comments

0

Looks like it won't happen with ZF1.12

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.