codeigniter - Getting two queries while working with Stream Entries -
i have code:
public function index($offset = 0) { $params = array( 'stream' => 'companies', 'namespace' => 'companies', 'paginate' => 'yes', 'pag_segment' => 3 ); // build regular expression match items db $regexp = "'^[" . strtolower($this->uri->segment(4)) . strtoupper($this->uri->segment(4)) . "]'"; $params['where'] = "name regexp " . $regexp; $entries = $this->streams->entries->get_entries($params); $this->template->set('items', $entries)->build('index'); }
i don't know why i'm getting 2 queries, see details below:
0.0008 select default_companies.*, cb_users.id created_by||user_id, cb_users.email created_by||email, cb_users.username created_by||username, profiles.display_name created_by||display_name default_companies left join default_users cb_users on cb_users.id=default_companies.created_by left join default_profiles profiles on profiles.user_id=default_companies.created_by (name regexp '^[mm]') order
default_companies
.created
desc
this query right 1 , generate valid records ...
0.0008 select default_companies.*, cb_users.id created_by||user_id, cb_users.email created_by||email, cb_users.username created_by||username, profiles.display_name created_by||display_name default_companies left join default_users cb_users on cb_users.id=default_companies.created_by left join default_profiles profiles on profiles.user_id=default_companies.created_by (name regexp '^[mm]') order
default_companies
.created
desc limit 10 offset 4
this second query (don't know yet why it's executed) doesn't return values because offset
parameter view empty. wrong here? did miss something? i'm running pyrocms 2.2.1 community
the first query gets executed in system/cms/modules/streams_core/models/rows_m.php around line 658. simple counts total of records in stream table, pagination right.
but i'm not sure, why sets offset of 4. should set 0, if it's missing.
you should try adding $offset parameter $params array get_entries function , check happens next.
Comments
Post a Comment