本文整理汇总了PHP中S::sqlMetaData方法的典型用法代码示例。如果您正苦于以下问题:PHP S::sqlMetaData方法的具体用法?PHP S::sqlMetaData怎么用?PHP S::sqlMetaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::sqlMetaData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIdsFromTable
function getIdsFromTable($startId, $endId)
{
list($tableName, $primaryKey) = $this->getPrimaryKeyAndTable();
$result = array();
$query = $GLOBALS['db']->query(sprintf("SELECT %s FROM %s WHERE %s >= %s AND %s <= %s", S::sqlMetaData($primaryKey), S::sqlMetaData($tableName), S::sqlMetaData($primaryKey), S::sqlEscape($startId), S::sqlMetaData($primaryKey), S::sqlEscape($endId)));
while ($rt = $GLOBALS['db']->fetch_array($query)) {
$result[] = $rt[$primaryKey];
}
return $result;
}
示例2: getThreadDataWithTmsgs
function getThreadDataWithTmsgs($query)
{
$threads = $tmsgsTables = array();
while ($rt = $GLOBALS['db']->fetch_array($query)) {
$threads[$rt['tid']] = $rt;
$tmsgsTableName = GetTtable($rt['tid']);
$tmsgsTables[$tmsgsTableName][] = $rt['tid'];
}
if (!S::isArray($threads)) {
return array();
}
foreach ($tmsgsTables as $tableName => $tids) {
$tmsgsQuery = $GLOBALS['db']->query("SELECT * FROM " . S::sqlMetaData($tableName) . " WHERE tid IN(" . S::sqlImplode($tids) . ")");
while ($rt = $GLOBALS['db']->fetch_array($tmsgsQuery)) {
$rt['threadurl'] = $GLOBALS['db_bbsurl'] . '/read.php?tid=' . $rt['tid'];
$rt['forumurl'] = $GLOBALS['db_bbsurl'] . '/thread.php?fid=' . $threads[$rt['tid']]['fid'];
$threads[$rt['tid']] = array_merge($threads[$rt['tid']], $rt);
}
}
return $threads;
}
示例3: getMinAndMaxIdByTableName
function getMinAndMaxIdByTableName($tableName)
{
if ($tableName != 'pw_pidtmp' && !preg_match('|^pw_posts\\d*$|i', $tableName)) {
return array('min' => 0, 'max' => 0);
}
return $GLOBALS['db']->get_one("SELECT min(pid) AS min,max(pid) AS max FROM " . S::sqlMetaData($tableName));
}