>
> I'm having some problems with the load data infile running through exec().
> The file i am trying to load contains this:
> [excerpt of SQL script shown]
>
LOAD DATA INFILE is for loading raw data in a textual format, for instance
comma-separated values. This command cannot execute SQL statements from a
script. Only the mysql command-line tool can do that.
Because you were talking about SQL scripts, I assumed you had a script that
contained the LOAD DATA INFILE statement, and this statement in turn named
another file in the appropriate textual format.
I admit even the MySQL documentation website does not clearly describe the
format of the file that can be read by LOAD DATA INFILE. It just says
"loads data from a text file," so it's not surprising that you misunderstood
what can be in that text file.
tony stamp wrote:
>
> This limits me to two options: either the shell or shell_exec functions,
> or db::exec. Is db::exec basically a wrapper for shell or shell_exec? I'm
> just wondering if i will be able to use either approaches if the host has
> disabled shell access.
>
Right - since you have a SQL script, you must use the 'mysql' command-line
tool. If you don't have permission to run external commands from PHP using
shell_exec() or system(), then you are out of luck. You will have to run
your script with another interface, such as phpmyadmin.
The db::exec() function I mentioned has no relationship to shell_exec().
db::exec runs a single SQL statement, without preparing it. I thought you
wanted to run LOAD DATA INFILE, and this statement is incompatible with
being prepared, so it needs to be run another way. But this is irrelevant
anyway, because LOAD DATA INFILE is not what you need.
Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/executing-.sql-file-using-zend_db-tp18569584p18597527.html
Sent from the Zend DB mailing list archive at Nabble.com.
没有评论:
发表评论