private function select($query, $parameters = array(), $fetch_mode = SelectQueryResult::FETCH_ASSOC)
 {
     $this->querier->disable_query_translator();
     $result = $this->querier->select($query, $parameters, $fetch_mode);
     $this->querier->enable_query_translator();
     return $result;
 }
Example #2
0
 /**
  * @desc count the number of rows from the <code>$table_name</code> table matching the
  * <code>$condition</code> condition
  * @param string $table_name the name of the table on which work will be done
  * @param string $condition the update condition beginning just after the where clause.
  * For example, <code>"length > 50 and weight < 100"</code>
  * @param string $count_column the column name on which count or * if all
  * @param string[string] $parameters the query_var map
  * @return int the number of rows returned
  */
 public function count($table_name, $condition = 'WHERE 1', $parameters = array(), $count_column = '*')
 {
     $query = 'SELECT COUNT(' . $count_column . ') FROM ' . $table_name;
     if (!empty($condition)) {
         $query .= ' ' . $condition;
     }
     $row = $this->querier->select($query, $parameters, SelectQueryResult::FETCH_NUM)->fetch();
     return (int) $row[0];
 }