当前位置: 首页>>代码示例>>PHP>>正文


PHP MDB2_Driver_Common::queryCol方法代码示例

本文整理汇总了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;
 }
开发者ID:GervaisdeM,项目名称:nate-go-search,代码行数:19,代码来源:NateGoSearch.php

示例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;
    }
开发者ID:GervaisdeM,项目名称:nate-go-search,代码行数:32,代码来源:NateGoSearchQuery.php


注:本文中的MDB2_Driver_Common::queryCol方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。