-3

我的 xml 文件大小是 600 mb 我如何插入到 mysql 表中

4

1 回答 1

0
 $block_size=100;
 $N=count($xml->product);
 $begin_block=0;
 while($begin_block<$N){
    try
    {
       mysql_query("BEGIN", $conn);
       $end_block=min($N, $begin_block+$block_size);

       for($j=$begin_block;$j<$end_block;$j++) {
          //check & insert into linkshareproducts ... $xml->product[$j]
       }
       mysql_query('COMMIT', $conn);
    }
    catch(Exception $e)
    {
       mysql_query('ROLLBACK', $conn);
    }
    $begin_block=$end_block;
 }
于 2013-02-13T04:55:43.660 回答