When I have a loop like this:
foreach(...) {
$r1 = $zend_db->fetchRow("SELECT ... ");
$zend_table->insert($data_array, $where);
}
... running a few thousand times. Is it possible, that $r1
doesn't contain a record inserted in the previous loop?
At http://dev.mysql.com/doc/refman/5.1/en/query-cache.html they write "The query cache does not return stale data. When tables are modified, any relevant entries in the query cache are flushed." But maybe ZEND does some unexpected caching for SELECT or INSERT?
Do I need to use transactions to solve this?
I had an issue with double records and there is no other explanation where they came from. But I can't reproduce it, cause it happened two months ago, importing csv-data that no longer exists.