PDO Connection Sharing

In PDO/MySQL (Not sure which it’s a feature of) variables that are assigned are stored over the life of the connection. This is something I want to use but need is fairly important that it doesn’t get meddled with between times. Does Yii / PDO reuse connections between clients or is it one connection per session?

Thanks

You can reuse connections by setting the persistant flag. Not sure if that helps, though.

That does help thanks. But raises more questions as usual.

Has anyone tested whether setting the PDO attribute to persist the connection actually effects the variables used? I might try and put together a test for this later on.

I’ve got no idea, I never tried to set variables on persistant connections. But: They do persist, so watch out for uncommitted transactions.