本文整理汇总了PHP中DataAccess::PrepareAndExecuteQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP DataAccess::PrepareAndExecuteQuery方法的具体用法?PHP DataAccess::PrepareAndExecuteQuery怎么用?PHP DataAccess::PrepareAndExecuteQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataAccess
的用法示例。
在下文中一共展示了DataAccess::PrepareAndExecuteQuery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PrepareAndExecuteQuery
protected function PrepareAndExecuteQuery($query, $params)
{
$stmt = parent::PrepareAndExecuteQuery($query, $params);
if (!$stmt) {
// If this was a general error, attempt to reconnect and retry the query
// UPDATED: Only care about specific general errors
if ($this->errno == 'HY000' && strpos($this->errorMsg, 'General error: 2006 MySQL server has gone away') !== false) {
echo "Database Error. Waiting 1 minute before attempting to Reconnect.\n";
sleep(60);
echo "Attempting to reconnect...\n";
$this->conn = null;
$this->connect($this->host, $this->user, $this->pass, $this->dbname);
if (!$this->hasError()) {
return parent::PrepareAndExecuteQuery($query, $params);
}
echo "Reconnect Failed\n";
return false;
}
}
return $stmt;
}