in reply to Re: Re: Clean Code - What a mess...
in thread Clean Code - What a mess...
The way that prepare_cached works is that it uses your
entire SQL statement as the key to a hash (the value is
the statement handle). So if statements differ in any way
(even whitespace), then you are storing another key/value
pair in the statement cache (and the database creates
another cursor if the
database supports cursors). With 200,000 lines of input and no placeholders in sight, you are abusing prepare_cached and are wasting memory. If you use placeholders, then the only difference in your cached statements will be the table names, and you shouldn't run out of memory (assuming there
aren't too many table names).