Skip to content

Instantly share code, notes, and snippets.

@yuya-matsushima
Created September 6, 2011 05:36
Show Gist options
  • Save yuya-matsushima/1196682 to your computer and use it in GitHub Desktop.
Save yuya-matsushima/1196682 to your computer and use it in GitHub Desktop.
計測テストしたファイル見つけた
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Tests_model extends CI_Model {
public function __construct()
{
parent::__construct();
$this->load->database();
}
public function get_count1()
{
$sql = 'SELECT result_id FROM tests WHERE result = 1';
$query = $this->db->query($sql);
return $query->num_rows();
}
public function get_count2()
{
$sql = 'SELECT 1 FROM tests WHERE result = 1';
$query = $this->db->query($sql);
return $query->num_rows();
}
public function get_count3()
{
$sql = 'SELECT COUNT(result_id) AS count FROM tests WHERE result = 1';
$query = $this->db->query($sql);
return $query->row()->count;
}
public function get_count4()
{
return $this->db->where('result', 1)->count_all_results('tests');
}
}
/* End of file tests_model.php */
/* Location: ./application/models/tests_model.php */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment