本文整理汇总了PHP中MDB2_Driver_Common::queryCol方法的典型用法代码示例。如果您正苦于以下问题:PHP MDB2_Driver_Common::queryCol方法的具体用法?PHP MDB2_Driver_Common::queryCol怎么用?PHP MDB2_Driver_Common::queryCol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDB2_Driver_Common
的用法示例。
在下文中一共展示了MDB2_Driver_Common::queryCol方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDocumentTypes
/**
* Gets the available document type shortnames
*
* @param MDB2_Driver_Common $db the database driver to use to get the
* available document type shortnames.
*
* @return array an array containing the available document type shortnames.
*
* @throws NateGoSearchDBException if a database error occurs.
*/
public static function getDocumentTypes(MDB2_Driver_Common $db)
{
$sql = 'select shortname from NateGoSearchType';
$values = $db->queryCol($sql, 'text');
if (MDB2::isError($values)) {
throw new NateGoSearchDBException($values);
}
return $values;
}
示例2: getSearchHistoryPopularWords
/**
* Get a list of popular/successful search keywords
*
* This is used to query the database for a list of keywords from the
* NateGoSearchHistory table. The results are based upon the document_count
* of each of the keywords and if the words have been searched recently.
*
* @param MDB2_Driver_Common $db the database driver to use.
* @param integer $document_threshold optional. The minimum number of
* results in which a word must be
* contained to be considered
* popular. If not specified, 150
* is used.
* @param string $date_threshold optional. Search keywords must be after
* this date to be considered popular. Uses
* strtotime format. If not specified,
* '6 months ago' is used.
*
* @return array an array of popular search words
*/
public static function getSearchHistoryPopularWords(MDB2_Driver_Common $db, $document_threshold = 150, $date_threshold = '6 months ago')
{
$date = strtotime($date_threshold);
$date = date('c', $date);
$sql = sprintf('select distinct keywords from NateGoSearchHistory
where document_count > %s and creation_date > %s', $db->quote($document_threshold, 'integer'), $db->quote($date, 'date'));
$words = $db->queryCol($sql, 'text');
if (MDB2::isError($words)) {
throw new NateGoSearchDBException($words);
}
return $words;
}