2008年7月21日星期一

Re: [fw-db] executing .sql file using zend_db

Wojciech Naruniec wrote:
>
> $schema = explode(";\n", $schema);
> . . .
> $db->query($sql);
> . . .
>

It's a bit more complicated than that to support SQL scripts.
Try the following SQL script using your solution:

-- comment lines cannot be prepared as statements
-- mysql client tool builtin command cannot be prepared or executed by
server
USE testdb;

-- multi-line statement
CREATE TABLE foo (
string VARCHAR(100)
);

-- statement that is not supported as a prepared statement
LOAD DATA INFILE 'datafile.txt' INTO TABLE foo;

-- statement that is not terminated with a semicolon
DELIMITER //

-- statement contains semicolon without it being the statement terminator
CREATE PROCEDURE simpleproc (OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM foo;
END
//

Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/executing-.sql-file-using-zend_db-tp18569584p18574255.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: