如何使用zend framework 1.12执行sql文件file.sql?

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 ;

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');