Hi again,
If you have a lot of scripts that, for
example, load large data files, make a module with a sub that you call
to load the files and use it from all your scripts. Pass the data by
reference to the calling scripts. Then you will isolate the large
lexical in that one module.
Better yet, don't load a large file into memory.
I'll see what I can do when the problem arises, but of course, I now know I
should better avoid loading too much data in RAM at once, because of data
persistance.
All this discussion has been made from a theoritical point of view, I don't
have any practical situation in mind right now, but knowing the pros and
cons, I'll choose the best way when problems arise.
I tried to use "mysql_use_result" this morning, but without success.
There's probably just a syntax mistake in your script somewhere. This
is what I use, to turn it on for specific statement handles:
my $sth = $dbh->prepare($sql, {mysql_use_result => 1});
I am not sure this is a syntax problem (and I tried your syntax as well).
for example, when I then create a statement like:
$sth = $dbh->prepare($sql);
I can test $sth->{mysql_use_result}, and it brings 1, showing that my wish
has been taken into account by the compiler.
Actually, I tried to do the same with PHP, using mysql_unbuffered_query
(because here, when we talk about mysql_use_result, we are talking about
unbuffered queries) and the result is the same: my query data is fetched
from the server all at once.
So, actually, I suspect there is a problem somwhere with my MySQL libraries
or so (I don't really know where to investigate).
So, for now, there's no way for me to use unbuffered queries...
Lionel.