MySQL LAST_INSERT_ID w/ persistent connection

Posts 1–5 of 5 · Page 1 of 1
MySQL LAST_INSERT_ID w/ persistent connection
Anyone know how you should handle getting LAST_INSERT_ID with a persistent connection? From what I understand, it can be extremely dangerous. Anyone got a bodge fix, without opening another connection?
Why use a persistent connection? I never use those. Just open up a connection for a transaction and close it. Let mysql handle the concurrency.
Quote Originally Posted by Dave84311 View Post
Why use a persistent connection? I never use those. Just open up a connection for a transaction and close it. Let mysql handle the concurrency.
Why open tens of connections when you can simply open one? and dw, i got around it. i don't believe there is a way to do it.
Does MySQL not have connection pooling? closing/reopening is probably more efficient than keeping one open for extended periods of time.
I don't recommend using pconnection, under all circumstances though, you just have to make a failsafe for the possible case of an erronous return, meaning you should always have the call return a row, no matter what.

I mean the whole idea of "One connection vs. Unlimited" seems to be the only ever, EVER, argument, and it is so stupid that you should not use it.

Sure, you can have one OBJECT to handle all the tasks of any other object you would use, I mean why can't an object contain the neccessary information to substitute for all other objects? Right? Well, sure, that's a good way to put it, but no it's stupid and you know it, so why must you persistently push for something similarly stupid when you as a developer understand the underlying problem of an insecurity...

I hope I don't offend anyone, and I'm not particularly fond of persistent connections, never felt the need to use it... There is a way to make it safe, but it would defeat the overall purpose. That is to have a non-persistent connection to a persistent connection that is encapsulated and only accessible when needed, well it's a stupid idea anyway, but good luck on your issues.
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us