[英]PHP, Adodb, sqlite3 and AutoExecute returns error 5 (SQLITE_BUSY)
I have a little problem. 我有一点问题。 I try execute couple of queries using AutoExecute:
我尝试使用AutoExecute执行几个查询:
$rows = array(
array(
"text" => md5(rand(1,999)),
"value" => rand(1,999)
),
array(
"text" => md5(rand(1,999)),
"value" => rand(1,999)
),
array(
"text" => md5(rand(1,999)),
"value" => rand(1,999)
)
/* [... and 10 more ...] */
);
foreach ($rows as $row)
{
if ($db->AutoExecute("sometable", $row, "INSERT"))
{
echo "Done";
}
else
{
echo "Error";
}
}
?>
and I got error code number 5. How to handle multiple queries using Adodb and AutoExecute? 我得到了错误代码5.如何使用Adodb和AutoExecute处理多个查询?
As explained in https://github.com/ADOdb/ADOdb/issues/286 : 如https://github.com/ADOdb/ADOdb/issues/286中所述 :
autoExecute() only handles a single record. autoExecute()仅处理单个记录。 Try with
试试吧
foreach($sql as $row) {
$db->autoExecute('test', $row, 'INSERT');
}
As a side note, due to the overhead of autoExecute(), it is probably more efficient do do this with a prepared statement. 作为旁注,由于autoExecute()的开销,使用预准备语句执行此操作可能更有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.