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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
5 + 17 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Sun Jun 16 20:01:28 2024 UTC