本文整理汇总了PHP中CacheManager::GetDataTableIdFromValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CacheManager::GetDataTableIdFromValue方法的具体用法?PHP CacheManager::GetDataTableIdFromValue怎么用?PHP CacheManager::GetDataTableIdFromValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CacheManager
的用法示例。
在下文中一共展示了CacheManager::GetDataTableIdFromValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetDataTableIdFromValue
static function GetDataTableIdFromValue($_database, $_column_s, $_value_s, $_canBeNumeric = true, $_maxlength = null)
{
if (!is_array($_value_s)) {
if (!$_canBeNumeric && is_numeric($_value_s)) {
return $_value_s;
}
if (!is_array($_value_s) && $_maxlength != null && strlen($_value_s) > $_maxlength) {
$_value_s = substr($_value_s, 0, $_maxlength);
}
$_value_s = array(0 => $_value_s);
}
if (!is_array($_column_s)) {
$_column_s = array(0 => $_column_s);
}
$ckey = "IFV" . md5($_database . serialize($_column_s) . serialize($_value_s));
if (isset(CacheManager::$DataTableResolved[$ckey])) {
return CacheManager::$DataTableResolved[$ckey];
}
$columns = $values = $onupdatefields = "";
for ($i = 0; $i < count($_column_s); $i++) {
$columns .= ",`" . $_column_s[$i] . "`";
$values .= ", '" . DBManager::RealEscape($_value_s[$i]) . "'";
if ($i > 0) {
$onupdatefields .= ",`" . $_column_s[$i] . "`='" . DBManager::RealEscape($_value_s[$i]) . "'";
}
}
DBManager::Execute(true, "INSERT IGNORE INTO `" . DB_PREFIX . $_database . "` (`id`" . $columns . ") VALUES (NULL" . $values . ") ON DUPLICATE KEY UPDATE `id`=LAST_INSERT_ID(`id`)" . $onupdatefields . ";");
$resid = DBManager::GetLastInsertedId();
if (is_numeric($resid) || $_value_s == "INVALID_DATA") {
return CacheManager::$DataTableResolved[$ckey] = $resid;
} else {
return CacheManager::GetDataTableIdFromValue($_database, $_column_s, "INVALID_DATA", $_canBeNumeric, $_maxlength);
}
}
示例2: GetBrowserId
function GetBrowserId($_browser)
{
return CacheManager::GetDataTableIdFromValue(DATABASE_VISITOR_DATA_BROWSERS, "browser", $_browser);
/*
DBManager::Execute(true,"INSERT IGNORE INTO `".DB_PREFIX.DATABASE_VISITOR_DATA_BROWSERS."` (`id`, `browser`) VALUES (NULL, '".DBManager::RealEscape($_browser)."');");
$row = DBManager::FetchArray(DBManager::Execute(true,"SELECT `id` FROM `".DB_PREFIX.DATABASE_VISITOR_DATA_BROWSERS."` WHERE `browser`='".DBManager::RealEscape($_browser)."';"));
return $row["id"];
*/
}