ZF-1694: Class to execute a SQL script

Issue Type: New Feature Created: 2007-07-09T15:24:50.000+0000 Last Updated: 2008-12-09T11:44:05.000+0000 Status: Postponed Fix version(s): Reporter: Bill Karwin (bkarwin) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db

Related issues: Attachments:


This is a feature request for a class or method that executes a SQL script.

The class should recognize the syntax supported by SQL scripts of each respective RDBMS brand, if possible.

This should be written as a proposal using our development process.


Posted by Darby Felton (darby) on 2007-11-07T15:26:23.000+0000

Resolving as "Won't Fix," pending reasonable justification for reopening.

Posted by Wil Sinclair (wil) on 2007-11-08T20:57:33.000+0000

Reopening with target release set to none until we get more feedback on this feature. If it is determined that we will not implement this feature in any future release, it may be closed with 'Won't Fix'.

Posted by Wil Sinclair (wil) on 2008-03-25T20:43:52.000+0000

Please categorize/fix as needed.

Posted by Wil Sinclair (wil) on 2008-04-18T13:11:53.000+0000

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Posted by Wil Sinclair (wil) on 2008-12-08T16:41:51.000+0000

Ralph, please evaluate and decide if/how we should act on this.

Posted by Ralph Schindler (ralph) on 2008-12-09T11:07:43.000+0000

This is difficult, def. not something that we could handle as a feature via Issue tracker.

At current, the availability of multiple statements per query in any of the php db extensions is varied across the board. Even in PDO, there are different procedures on how to execute multiple statements with a single api call (whether to execute or not).

This means that each query in a single script would need to be parsed out. That being the case, one would have to have an SQL Tokenizer or Parser to identify when a query stops (assuming the user didnt change the delimiter).

That said, in order to do those tasks, a major component would need to be proposed and developed, and IMO, its gonna be a large undertaking.

So, that said, should i close this for now?

Posted by Bill Karwin (bkarwin) on 2008-12-09T11:44:04.000+0000

I logged this issue to keep note of a users' feature request a long time ago. But I wouldn't recommend doing it within the scope of the ZF project. It'd be a major project in itself.

Imagine that you need to accommodate script behavior including the following:

  • Duplicating SQL script builtin commands, such as USE and `CONNECT and CHARSET and DELIMITER. You shouldn't execute these against the database server.
  • SQL statements that can't be prepared statements, like START TRANSACTION. This set of statements may vary by version of the database.
  • SQL statements that contain semicolon, either inside string literals or in the body of a trigger or stored procedure.
  • SQL statements that are terminated by newline instead of semicolon, such as DELIMITER.

...and that's just for MySQL. Imagine implementing and testing a whole different set of syntax and rules like the above for Oracle, PostgreSQL, and all other databases supported by Zend_Db.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.