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


PHP SQLQBuilder::countFromMultipleTables方法代码示例

本文整理汇总了PHP中SQLQBuilder::countFromMultipleTables方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLQBuilder::countFromMultipleTables方法的具体用法?PHP SQLQBuilder::countFromMultipleTables怎么用?PHP SQLQBuilder::countFromMultipleTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLQBuilder的用法示例。


在下文中一共展示了SQLQBuilder::countFromMultipleTables方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkEmpJobTitle

 /**
  * Check if given employees job title matches the given title name.
  *
  * @param int $empNum Employee number
  * @param String $jobTitleName The job title name to check
  * @return boolean True if employee has given job title, false otherwise
  */
 public function checkEmpJobTitle($empNumber, $jobTitleName)
 {
     $titleMatches = false;
     $tables[0] = '`hs_hr_employee` a';
     $tables[1] = '`hs_hr_job_title` b';
     $joinConditions[1] = 'a.`job_title_code` = b.`jobtit_code`';
     $selectConditions[] = "a.`emp_number` = " . $empNumber;
     $selectConditions[] = "b.`jobtit_name` = '" . $jobTitleName . "'";
     $sqlBuilder = new SQLQBuilder();
     $sql = $sqlBuilder->countFromMultipleTables($tables, $joinConditions, $selectConditions);
     $conn = new DMLFunctions();
     $result = $conn->executeQuery($sql);
     if ($result) {
         $row = mysql_fetch_array($result, MYSQL_NUM);
         $count = $row[0];
         if ($count == 1) {
             $titleMatches = true;
         }
     }
     return $titleMatches;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:28,代码来源:EmpInfo.php

示例2: getCount

 /**
  * Count job vacancys with given search conditions
  * @param string $searchStr Search string
  * @param string $searchFieldNo Integer giving which field to search on
  */
 public static function getCount($searchStr = '', $searchFieldNo = self::SORT_FIELD_NONE)
 {
     $count = 0;
     $fields[0] = "a." . self::DB_FIELD_VACANCY_ID;
     $fields[1] = "c.jobtit_name";
     $fields[2] = "CONCAT(b.`emp_firstname`, ' ', b.`emp_lastname`)";
     $fields[3] = "a." . self::DB_FIELD_ACTIVE;
     $fields[4] = "a." . self::DB_FIELD_DESCRIPTION;
     $tables[0] = self::TABLE_NAME . ' a';
     $tables[1] = 'hs_hr_employee b';
     $tables[2] = 'hs_hr_job_title c';
     $joinConditions[1] = 'a.' . self::DB_FIELD_MANAGER_ID . ' = b.emp_number';
     $joinConditions[2] = 'a.jobtit_code = c.jobtit_code';
     $selectConditions = null;
     if ($searchFieldNo >= 0 && $searchFieldNo < count($fields) && trim($searchStr) != '') {
         if ($searchFieldNo == self::SORT_FIELD_ACTIVE) {
             $active = $searchStr ? self::STATUS_ACTIVE : self::STATUS_INACTIVE;
             $selectConditions[] = "{$fields[$searchFieldNo]} = " . $active;
         } else {
             $filteredSearch = mysql_real_escape_string($searchStr);
             $selectConditions[] = "{$fields[$searchFieldNo]} LIKE '" . $filteredSearch . "%'";
         }
     }
     $sqlBuilder = new SQLQBuilder();
     $sql = $sqlBuilder->countFromMultipleTables($tables, $joinConditions, $selectConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($sql);
     if ($result) {
         $line = mysql_fetch_array($result, MYSQL_NUM);
         $count = $line[0];
     }
     return $count;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:38,代码来源:JobVacancy.php


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