We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Why I Cannot Execute delimiter ;; in Mysql

index.php

$di->set('modelsManager', 'Phalcon\Mvc\Model\Manager');

controller :

$model = $this->modelsManager->getWriteConnection(new Module());

$model->execute("delimiter //");

error code:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 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'

other SQL will be good. except the delimiter

I using Using Raw SQL In Pdo was good for running .

<?php

$dsn = 'mysql:host=localhost;dbname=xxxx';
$user = 'xxx';
$password = '123456';

try {
     $dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
     echo 'Connection failed: ' . $e->getMessage();
}

$sth = $dbh->prepare("delimiter //");
$sth->execute();
var_dump($sth);