如何在调用一种模型方法期间更改 Kohana 框架内的 mysql 定界符?

How to change mysql Delimiter inside Kohana framework during call one model method?

我有一种方法必须创建 mysql 过程,并且 运行 它。问题是更改定界符

public function doSomeThing(){
    $run = array();
    $run[] = DB::query(null, "DELIMITER $$");
    //... here we continue of pushing more commands
    /**
     * @var Database_Query[] $run
     */
    foreach($run as $command){
        $command->execute();
    }
}

我看到异常:

Database_Exception [ 1064 ]: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER $$' at line 1 [ DELIMITER $$ ]

我做错了什么?谢谢

正如您在 this answer, you cannot use the DELIMITER via PHP as it is a command line statement. Just leave it out and use an array of queries (Kohana sadly does not support multiple queries 中看到的那样,只需调用 DB)