in reply to DBI and last_insert_id

Well, if the ON DUPLICATE KEY UPDATE clause fires, I doubt you get anything in last_insert_id().

Replies are listed 'Best First'.
Re^2: DBI and last_insert_id
by cog (Parson) on Jan 29, 2009 at 11:26 UTC
    True, but I'm not even getting the correct value in last_insert_id() even without it failing.

      Ok, here are a couple more thoughts. First, is there possibly another insert in your real code between the first insert and your call to last_insert_id? A side effect of some sub call maybe?

      Second, you definitely should be able to see data you inserted during a transaction with a SELECT, even if the data is not committed yet, provided your queries are all coming from the same connection. That sounds very suspicious to me.

        ... is there possibly another insert in your real code between ...

        No, the statements are just one after the other and there's no call to any other methods in between.

        ... you definitely should be able to see data you inserted during a transaction with a SELECT ...

        I was under that impression too, but didn't think too much of it. Now that I have someone telling me that, I'm going to look into that. Thanks.