Brutha has asked for the wisdom of the Perl Monks concerning the following question:
again I am fighting with Class::DBI and DB2.
I have a created a couple of classes similar to the Class::DBI::Loader::DB2, which is not really a great help for existing databases with no primary/foreign keys. Here this is done with unique indices, I set up the all/essential/primary columns manually. This works and is not my problem. There are 148 tables. Yes, it takes some time to set up this mass.
Now I try to find in each table all rows, which have an attribute set. As Class::DBI searches work with equality, I use
As I do not want to write 148 times nearly the same I did the following:LRE::Mytable->retrieve_from_sql('locked<>0')
This works for a reduced array @AllTables, but if I scan all 148 tables I receive the error:foreach my $table ( @AllTables) { my @locked; # locked entries my $cmd=sprintf "\@locked=LRE::%s->retrieve_from_sql('locked<>0')" +, ucfirst lc $table; printf "$cmd\n"; eval $cmd; print @_; foreach my $row(@locked) { printf "$table %6d %s\n", $row->sysid, $row->name ; } }
(translated and shortened message)DBD::DB2::db prepare_cached failed: [IBM][CLI Driver][DB2/NT] SQL0954C + not enough memory (Application Heap) SQLSTATE=57011
How do I release the memory? I tried a dbi_commit() within the loop, but it did not help. This is independant of the table itself (and so the SQL statement), but the mass of statements. I am not sure, wether this is a DB2 driver or Class::DBI problem, as I never had problems with the DB2 interface so far and doing selects the hard way is working.
Thank you for any help.
And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
(Terry Pratchett, Small Gods)
|
|---|