| Author |
Message |
DJ Maze


Joined: Apr 19, 2004 Posts: 5668 Location: http://tinyurl.com/5z8dmv
|
Post subject: 7/22 Important new function Posted: Fri Jul 23, 2004 2:50 pm |
|
To reduce system load i've reread the mysql.php class for db reading.
Normally it stores all query info into the class so you can recieve fieldset information.
This is now obsolete since there's none file which needs the information.
Function sql_fetch_unbuffered_rowset() is added to the class and should speed things up drastically especialy on large queries.
But what does the function do ?
You run a query thru it BUT it doesn't buffer the output which reduces memory usage and a small speed increase.
Since the result is unbuffered you need to fetch all data or else the result gets lost, so it puts the result in a rowset (sql_fetchrowset) and returns all data unbufferd.
example:
PHP:
$smilies = $db->sql_fetch_unbuffered_rowset('SELECT * FROM '.$prefix.'_bbsmilies', __FILE__, __LINE__);
This way you have all needed data fast in a rowset without bloating the system. The old depreciated way is
PHP:
$result = $db->sql_query('SELECT * FROM '.$prefix.'_bbsmilies', false, __FILE__, __LINE__); $smilies = $db->sql_fetchrowset($result); $db->sql_freeresult($result);
DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Fedora 12 / 2.2.15 / 5.1.47 / 5.3.3 / CVS |
|
| Back to top |
|
 |
Stephen


Joined: Apr 21, 2004 Posts: 734
|
Post subject: Re: 7/22 Important new function Posted: Fri Jul 23, 2004 5:09 pm |
|
Thats very very cool DJ
Stephen's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Cent OS :: 1.3.34 :: 4.1.13 :: 4.4.2 :: CVS |
|
| Back to top |
|
 |
alexm


Joined: Apr 20, 2004 Posts: 574 Location: Lafayette, LA USA
|
|
| Back to top |
|
 |
Stephen


Joined: Apr 21, 2004 Posts: 734
|
|
| Back to top |
|
 |
DJ Maze


Joined: Apr 19, 2004 Posts: 5668 Location: http://tinyurl.com/5z8dmv
|
Post subject: Re: 7/22 Important new function Posted: Sat Jul 24, 2004 6:01 pm |
|
Indeed my microwave has already 900watts but is still slow
DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Fedora 12 / 2.2.15 / 5.1.47 / 5.3.3 / CVS |
|
| Back to top |
|
 |
yrret


Joined: Apr 19, 2004 Posts: 15 Location: Southern California
|
Post subject: Re: 7/22 Important new function Posted: Mon Jul 26, 2004 4:48 am |
|
very cool.
By the way it is deprecated. Normally I don't obsess on typos, but I thought it might get searched on.
_________________ --
Microsoft is not the answer.
It is the question.
The answer is "NO!"
yrret's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Various, depends on server |
|
| Back to top |
|
 |
Eestlane


Joined: Apr 06, 2005 Posts: 1406 Location: Estonia
|
Post subject: Re: 7/22 Important new function Posted: Sat Oct 27, 2007 8:35 pm |
|
I haven't seen this function before, would is still be good to use:
PHP:
$result = $db->sql_fetch_unbuffered_rowset('SELECT * FROM '.$prefix.'_table');
instead of:
PHP:
$result = $db->sql_query('SELECT * FROM '.$prefix.'_table'); $rows = $db->sql_fetchrowset($result); $db->sql_freeresult($result);
?
Though, I'm too lazy to look up what's the difference in fetchrow and fetchrowset.
Eestlane's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/2.0.63/5.0.67/5.2.8/9.2.1 |
|
| Back to top |
|
 |
greenday2k


Joined: Aug 11, 2005 Posts: 484 Location: CO
|
Post subject: Re: 7/22 Important new function Posted: Sun Sep 13, 2009 6:41 pm |
|
I've seen but did not understand what it does.
what's the difference in fetchrow and fetchrowset. ?
_________________ www.greenday2k.net


greenday2k's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
 |
|
| Back to top |
|
 |
Eestlane


Joined: Apr 06, 2005 Posts: 1406 Location: Estonia
|
Post subject: Re: 7/22 Important new function Posted: Sun Sep 13, 2009 7:33 pm |
|
With fetchrow you can fetch a row in case of one result or iterate through multiple results with while loop for example. fetchrowset returns array (I'm just guessing actually). I'm not sure if there is difference in speed.
Eestlane's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/2.0.63/5.0.67/5.2.8/9.2.1 |
|
| Back to top |
|
 |