EllisLab text mark
Advanced Search
     
Active Record and mssql_data_seek
Posted: 26 April 2010 07:01 AM   [ Ignore ]
Joined: 2009-04-28
34 posts

Hi, I’m currently using active record with mssql2000, I need to use the msssql_data_seek php command, how do I do it with an Active Record query?

Thank you

 
Posted: 26 April 2010 12:48 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2007-09-09
306 posts

On the result object that you get back after running a query, you can call $result->_data_seek($n) which calls mssql_data_seek($result_id, $n) on the query results.  Note that CI intends this to be a private method, but because they don’t actually declare it as private, you can call it yourself.  Another option is to just call mssql_data_seek and related functions yourself specifying the first param as $result->result_id where $result is the return value of the query.

 Signature 

UberSignal |
Zenedy | Anyvite | Tweetvite

 
Posted: 27 April 2010 06:52 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2009-04-28
34 posts
dmorin - 26 April 2010 04:48 PM

On the result object that you get back after running a query, you can call $result->_data_seek($n) which calls mssql_data_seek($result_id, $n) on the query results.  Note that CI intends this to be a private method, but because they don’t actually declare it as private, you can call it yourself.  Another option is to just call mssql_data_seek and related functions yourself specifying the first param as $result->result_id where $result is the return value of the query.

Thank you.
I actually did it a bit different:

ADDED a parameter in result_array called $offset.
This parameter is being passed to _data_seek($offset).

 
Posted: 11 September 2012 08:52 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-25
71 posts

I’ve tried the _data_seek() option and I’m still not getting an offset.
I’ve checked and the function is still not officially set to private.

I’m hoping my syntax is just off… any ideas?

public function get_data($offset$per_page)
{
    $result 
$this->db->get('my_table_data'$offset$per_page);
    
$result->_data_seek($offset);
    echo 
$this->db->last_query();
    return 
$result->result_array($offset);