本文整理汇总了PHP中PdoDataAccess::ReportDB方法的典型用法代码示例。如果您正苦于以下问题:PHP PdoDataAccess::ReportDB方法的具体用法?PHP PdoDataAccess::ReportDB怎么用?PHP PdoDataAccess::ReportDB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PdoDataAccess
的用法示例。
在下文中一共展示了PdoDataAccess::ReportDB方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ReportServerRunquery_fetchMode
public static function ReportServerRunquery_fetchMode($query, $whereParams = array())
{
if (!isset(self::$ReportDB)) {
$_host = config::$db_servers['slave']['host'];
$_user = config::$db_servers['slave']['report_user'];
$_pass = config::$db_servers['slave']['report_pass'];
$_default_db = sys_config::$db_server['database'];
self::$ReportDB = self::getPdoObject($_host, $_user, $_pass, $_default_db, $ShowException);
}
$PDO_Obj = self::$ReportDB;
/*@var $PDO_Obj PDO*/
//-------------------
$mainQuery = $query;
$statement = $PDO_Obj->prepare(self::CorrectFarsiString($query));
$keys = array_keys($whereParams);
for ($i = 0; $i < count($keys); $i++) {
$st = is_int($keys[$i]) ? $keys[$i] + 1 : $keys[$i];
$whereParams[$keys[$i]] = self::CorrectFarsiString($whereParams[$keys[$i]]);
$statement->bindParam($st, $whereParams[$keys[$i]]);
if (is_int($keys[$i])) {
$mainQuery = preg_replace("/\\?/", "'" . $whereParams[$keys[$i]] . "'", $mainQuery, 1);
} else {
$mainQuery = str_replace($keys[$i], "'" . $whereParams[$keys[$i]] . "'", $mainQuery);
}
}
//.............................
$statement->execute();
self::$statements[$PDO_Obj->getAttribute(PDO::ATTR_CONNECTION_STATUS)] = $statement;
self::$queryString = $mainQuery;
//.............................
if ($statement->errorCode() == "00000") {
return $statement;
}
parent::PushException(array_merge($statement->errorInfo(), array("query" => $statement->queryString)));
return false;
}