3

PHPを使用してマルチクエリを実行する場合、クエリの最大数はありますか?

  $conn = new mysqli($db_hostname, $db_username, $db_password);
    if (mysqli_connect_errno()) {
      exit('Connect failed: '. mysqli_connect_error());
    }  

   $sql = "CREATE TABLE IF NOT EXISTS......";
   $sql .= "CREATE TABLE IF NOT EXISTS......";
   $sql .= "CREATE TABLE IF NOT EXISTS......";
   $sql .= "INSERT ......";
   $sql .= "INSERT ......";
    <and so on>
    mysqli_autocommit($conn, false);
    mysqli_multi_query($conn, $sql);
    mysqli_rollback($conn); 
4

1 に答える 1

0

I don't now wheter the PHP function mysqli_multi_query is implemented by using the multiquery possibilitie s of the MySQL API or if this splits the statements on the PHP side.

But you could try raising net_buffer_length but and max_allowed_packet in your my.cnf. But I was under the impression that these were per statement buffers.

To be clear to people that stumble here, not out of curiosity as the OP did, but because they bumped into the maximum: There usually are other ways to do many INSERTs.

于 2012-10-09T11:40:29.763 に答える