dongwuwu6104 2018-06-12 14:43
浏览 40

php-mysqli等待'multi_query'查询完成?

I am importing a mysqlsqldump as follows.

$command = file_get_contents($dumpfile);
$conn->multi_query($command);
while (mysqli_next_result($conn)); // Flush out the results.

I have stripped down the code here, to just focus on the problem.

Now everything is working correctly, except that I have a query after this command.

And that query is not finding the tables which are supposed to be there after the import from previous step.

Then I realised that the import process using above method somehow seems asyncronous, and long after the php has finished execution the import seems to be going on. And once the import has finished, I am able to execute that same query manually which earlier returned the error saying "so and so table.column doesn't exist".

So, Is there a way to wait it out, for the multi_query process to complete, and then proceed with the execution in php?

  • 写回答

1条回答 默认 最新

  • dougu4704 2018-06-12 14:47
    关注

    Ok, My bad, actually, the following line does make the php wait till the processing is completed, its just that I had passed a different connection handle.

    while (mysqli_next_result($conn)); // Flush out the results.
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思