RE: [PEAR] [MDB] Final thought
| From: | Lukas Smith | Date: | Wed, 17 Sep 2003 07:31:12 +0000 |
| Subject: | RE: [PEAR] [MDB] Final thought | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7862@lists.php.net to get a copy of this message | ||
> From: Thierry Bothorel [mailto:thierry.bo@netcourrier.com]
> Sent: Wednesday, September 17, 2003 8:38 AM
> I finally finished the move to MDB for my mrbs package! It works fine
at
> home on MySQL, and I released a test package, now I wait for feedbacks
> from
> users with the others DBMS.
Oki great.
> I did not tried first to optimize the code to use the more 'advanced'
> functions doing the query, fetching row and freeing result, because I
> first
> did not wanted to change the existing code around database functions.
So,
> a
> lot of fetchInto, but I use them when I can.
I assume you are not using the datatype conversion yet? Or you manually
calling convertResultRow()?
> I noticed a slight longer response time to all pages, but I knew that
it
> will be the case, but this is not very noticable because this
application
> does not use databases intensively.
> I had only a problem with an external script used to fill the database
> with
> random data for demo (around 1200 rows). The script is ran in 17
seconds
> on
> my computer with the previous database wrapper, and... hum, between 40
and
> 45 seconds with MDB. As the same SQL statement is executed 1200 times
> within
> nested loops, I used prepared querys to speed up this, but this was
> useless
> with my MyISAM Mysql tables. So I reduced the row number to 700 to not
> exceed the default 30 seconds time limit for php scripts.
Oh, that is unfortunate.
However wrappers tend to add considerable overhead.
Partly from the OO code, partly from error handling and partly from the
actually abstraction.
> Well ,one last question. What is the main purpose of functions lile
> queryAll? Is this only to write less lines of code?
> Well, we write one line instead of three (query, fetch, free), but
after
> that, to retrieve the data, instead of writing code to loop through
the
> result set to fetch the data, we have to loop through the nested array
> instead.
They are just convenience methods.
It really depends on what you prefer. In the web world you usually don't
fetch large result sets, so its not really that big of a deal to fetch
the entire data into an array. Especially since for mysql people usually
use buffered queries anyways. Here the data is fetched into the client
anyways. So using queryAll really adds no additional memory usage,
because you can then free the buffered result set earlier.
BTW: In MDB 2.x you can optionally define that result sets should not be
buffered. This means that a few methods become unavailable like
numRows() but is very important if you intent to handle large result
sets.
> An just a note about documentation. It would be nice to have all in
one
> place. The included html pages cover all function, wether the PEAR
manual
> lack a lot of functions, but have nice introduction for beginners.
Well I would appreciate it if people would help me here.
Some one could take the tutorial (fix it up a bit) or the xml schema
guide or the datatype guide etc and convert it to docbook.
Regards,
Lukas