Archive for July, 2009

Strange 'source' commond in MySQL

Thursday, July 30th, 2009

Need a PHP tool to import files dumped by mysqldump, I try this code:

DB::query("source /myFile.sql");

But a syntax error was given.

Some one said "Note that the 'source' command used in the mysql client program is *not* a feature of the server but of the client. This means that you cannot do mysql_query('source myfile.sql');".

I tried many ways to import the file, at last the only way can work:

$command = "mysql -u $user -p $password -e 'SET NAMES utf8; \. myFile.sql' $dbname;";
`$command`;

一些翻唱

Sunday, July 19th, 2009

Can't catch exception in autoload

Monday, July 6th, 2009