现在我有这样的方法:
function exportFromTransbase($table_name) {
$odbc_query = "SELECT * FROM " . $table_name;
$data = odbc_exec($this->odbc_id, $odbc_query);
odbc_longreadlen($data, 10485760);
while($row = odbc_fetch_array($data))
{
foreach($row as $key => $value) {
$keys[] = "`" . $key . "`";
$values[] = "'" . mysql_real_escape_string($value) . "'";
}
$mysql_query = "INSERT INTO `" . strtolower(substr($table_name, 4)) . "` (" . implode(",", $keys) . ") VALUES (" . implode(",", $values) . ")";
mysql_query($mysql_query);
set_time_limit(3600);
unset($keys);
unset($values);
unset($row);
}
if ($mysql_query){
print "Ýêñïîðò äàííûõ èç òàáëèöû " . $table_name . " çàâåðøåí!";
//strtolower(substr($table_name, 4))
}
}
但是导入mysql的时候很慢。我决定将其更改为导出到文件 .sql,以便将来我可以通过终端或 phpmyadmin 导入该表。如何更改导出到 sql 文件我的数据?
笔记!我正在从 transbase 转换为 mysql