Created
September 6, 2011 05:36
-
-
Save yuya-matsushima/1196682 to your computer and use it in GitHub Desktop.
計測テストしたファイル見つけた
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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