本文整理汇总了PHP中DBConnect::commit方法的典型用法代码示例。如果您正苦于以下问题:PHP DBConnect::commit方法的具体用法?PHP DBConnect::commit怎么用?PHP DBConnect::commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBConnect
的用法示例。
在下文中一共展示了DBConnect::commit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_update
//.........这里部分代码省略.........
}
if (!is_bool($new_order) && !is_numeric($new_order))
{
throw new DBForumException(
'$new_order must be numeric or boolean');
}
if (!is_bool($new_content))
{
self::validate_content($new_content, $this->post_datatype);
}
if (!is_bool($metadata) && !is_string($metadata))
{
throw new DBDataTypeException(
'$metadata must be a string');
}
if (is_bool($new_content) &&
is_bool($new_parent) &&
is_bool($new_order) &&
is_bool($metadata))
{
return;
}
try
{
if (!is_bool($new_parent) || !is_bool($new_order) || !is_bool($metadata))
{
if (is_bool($new_order) && !is_bool($new_parent))
{
$new_order = $this->db->quick_query(
"SELECT max(".self::POSTORDER.") FROM ".self::FCORE_FORUM_POST." WHERE
".self::POSTPARENT."=$new_parent AND
".self::FORUM_ID."=$this->forum_id", true);
if ($new_order == null)
{
$new_order = 0;
}
else
{
$new_order = $new_order[0]["max(".self::POSTORDER.")"];
$new_order++;
}
}
$set = "";
if (!is_bool($new_parent))
{
if ($new_parent != 0)
{
$count = $this->db->quick_query(
"SELECT COUNT(*) FROM ".self::FCORE_FORUM_POST." WHERE
".self::FORUM_ID."=$this->forum_id &&
".self::POST_ID."=$new_parent",
true);
$count = $count[0]["COUNT(*)"];
if ($count == 0)
{
throw new Exception(
"the parent id does not exist in this forum");
}
}
$set .= self::POSTPARENT."=$new_parent";
if (!is_bool($new_order) || !is_bool($metadata))
{
$set .= ",";
}
}
if (!is_bool($new_order))
{
$set .= self::POSTORDER."=$new_order";
if (!is_bool($metadata))
{
$set .= ",";
}
}
if (!is_bool($metadata))
{
$set .= self::METADATA."='$metadata'";
}
$this->db->quick_query(
"UPDATE ".self::FCORE_FORUM_POST." SET
$set
WHERE
".self::POST_ID."=$post_id AND
".self::FORUM_ID."=$this->forum_id");
$this->db->commit();
}
if (is_string($new_content))
{
DBDataType::UpdateContentFromOrigin(
$new_content,
self::build_datatype_origin($this->origin_type),
$post_id);
}
}
catch(Exception $e)
{
$this->db->rollback();
throw new DBForumException($e->getMessage());
}
}
示例2: delete_all
/**
*
*/
public function delete_all()
{
try
{
$this->conn->quick_query(
"DELETE FROM ".$this->config_map[self::DB_TABLE_NAME]
);
$this->conn->commit();
}
catch(DBConnectException $e)
{
$this->conn->rollback();
FCore::GetLogger()->log(Logger::LEVEL_ERROR, $e->getMessage());
throw new DBFactoryException(
"An Error Occurred While Attempting To Delete: ", $e);
}
}