7/22 Important new function
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexCVS Info
Author Message
DJ Maze
Developer


Joined: Apr 19, 2004
Posts: 5668
Location: http://tinyurl.com/5z8dmv

PostPost subject: 7/22 Important new function
Posted: Fri Jul 23, 2004 2:50 pm
Reply with quote

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
View user's profile Visit poster's website Yahoo Messenger
Stephen
Silver Supporter


Joined: Apr 21, 2004
Posts: 734

PostPost subject: Re: 7/22 Important new function
Posted: Fri Jul 23, 2004 5:09 pm
Reply with quote

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
View user's profile Visit poster's website
alexm
500+ Posts Club


Joined: Apr 20, 2004
Posts: 574
Location: Lafayette, LA USA

PostPost subject: Re: 7/22 Important new function
Posted: Sat Jul 24, 2004 5:41 pm
Reply with quote

DJMaze wrote:
Function sql_fetch_unbuffered_rowset() is added to the class and should speed things up drastically especialy on large queries.

Something tells me that DJ stands in front of microwave oven yelling "Hurry Up!" Smile

And just when we thought is_user couldn't possibly get any faster... Wink

Just removing the need to access $db->sql_fetchrow() and $db->sql_freeresult() from outside of the $db class should provide a slightly noticable boost.

Kudos!

(p.s. remind me never to loan you my car)

_________________
The master will be pleased...

alexm's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Shared Host / Linux / Apache 1.3.23 / Mysql 3.23.58 / PHP 4.3.3 / CPG 8.2b & 8.3CVS
Back to top
View user's profile Visit poster's website
Stephen
Silver Supporter


Joined: Apr 21, 2004
Posts: 734

PostPost subject: Re: 7/22 Important new function
Posted: Sat Jul 24, 2004 5:43 pm
Reply with quote

alexm wrote:
Something tells me that DJ stands in front of microwave oven yelling "Hurry Up!" Smile
...
(p.s. remind me never to loan you my car)

LMAO Laughing Laughing Laughing Laughing Laughing Laughing Laughing


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
View user's profile Visit poster's website
DJ Maze
Developer


Joined: Apr 19, 2004
Posts: 5668
Location: http://tinyurl.com/5z8dmv

PostPost subject: Re: 7/22 Important new function
Posted: Sat Jul 24, 2004 6:01 pm
Reply with quote

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
View user's profile Visit poster's website Yahoo Messenger
yrret
Newbie


Joined: Apr 19, 2004
Posts: 15
Location: Southern California

PostPost subject: Re: 7/22 Important new function
Posted: Mon Jul 26, 2004 4:48 am
Reply with quote

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
View user's profile Visit poster's website AIM Address MSN Messenger Yahoo Messenger
Eestlane
I18N / L10N Lead Dev


Joined: Apr 06, 2005
Posts: 1406
Location: Estonia

PostPost subject: Re: 7/22 Important new function
Posted: Sat Oct 27, 2007 8:35 pm
Reply with quote

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
View user's profile Send e-mail Visit poster's website
greenday2k
Forum Admin


Joined: Aug 11, 2005
Posts: 484
Location: CO

PostPost subject: Re: 7/22 Important new function
Posted: Sun Sep 13, 2009 6:41 pm
Reply with quote

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
View user's profile Visit poster's website MSN Messenger Yahoo Messenger
Eestlane
I18N / L10N Lead Dev


Joined: Apr 06, 2005
Posts: 1406
Location: Estonia

PostPost subject: Re: 7/22 Important new function
Posted: Sun Sep 13, 2009 7:33 pm
Reply with quote

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
View user's profile Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexCVS Info All times are GMT
Page 1 of 1


Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

stopsoftwarepatents.eu petition banner
User Info [x]

Welcome Anonymous

Nickname
Password
(Register)

Last CVS commits [x]

Languages [x]

Community [x]

Support for DragonflyCMS in a other languages:

Deutsch
Español

X-links [x]
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

Preview theme [x]
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.


You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
This page generated in 0.4679 seconds with 17 DB Queries in 0.0336 seconds
Memory Usage: 3.13 MB
Interactive software released under GNU GPL, Code Credits, Privacy Policy