php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54211 delimiter ends with syntax error
Submitted: 2011-03-10 08:50 UTC Modified: 2011-03-11 04:49 UTC
From: svecpetr at svecpetr dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.17 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: svecpetr at svecpetr dot com
New email:
PHP Version: OS:

 

 [2011-03-10 08:50 UTC] svecpetr at svecpetr dot com
Description:
------------
in mysql_query is impossible to execute command

DELIMITER |

for example mysql_query('DELIMITER |');
this ends with mysql syntax error 1064

... when delimiter is not function... is impossible to run command CREATE TRIGGER because at the end of this command is always ... ; END ...



---
From manual page: http://www.php.net/function.mysql-query#Description
---


Test script:
---------------
mysql_query('DELIMITER |');
mysql_query('SHOW TABLES|');
mysql_query('DELIMITER ;');

Expected result:
----------------
enable delimiter


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-10 17:21 UTC] carsten_sttgt at gmx dot de
> in mysql_query is impossible to execute command
> DELIMITER |

"delimiter" is a command for the command line client and not a SQL statement known by the server.

> ... when delimiter is not function... is impossible to run command
> CREATE TRIGGER because at the end of this command is always ... ; END ...

Just create your trigger (including BEGIN ...; END) as usual, should work. As always with querys in PHP, no ";" at the end of the query string.
 [2011-03-11 04:49 UTC] aharvey@php.net
-Status: Open +Status: Bogus
 [2011-03-11 04:49 UTC] aharvey@php.net
I think Carsten has pretty much nailed this one. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 02:01:29 2024 UTC