Hi!
Another option for working with this came to me after looking at your
code. If you have a new recordset and the old one you must be getting
them from somewhere. Is it possible to just do a diff against the two
sets if they are raw SQL exports? Maybe then you could do
insert/updates based on that.
I have a couple of non-related suggestions that I think might help.
If not then just ignore them.
- "\"" can be written as tick quote tick instead of quote escape quote
quote (' " ') so that you don't have to escape it.
- Your database object could return a result object on queries. If
you make it return a result object then your query result gets shoved
into that. So you'd have a db_pgsql and db_pgsql_result that way you
don't have to pass around that handle everywhere. You just run
$result = $db->query(sql). Then result contains all the methods for
fetching your data.
- If you can run this locally you can use XDebug to figure out what
the problem is with your memory issue. Also you can use the trace
feature to see what is going on under the hood.