Connection ID (thread ID) for the connection

I am creating a replication friendly application and need to avoid creating temporary tables. Instead I wish to create real tables inline with article here:

To do this I need access to the Connection ID (thread ID) for the connection so I can form unique table names in my application. I have looked through the API for CDbConnection but cannot find a wrapper method or property for this.

Does anyone know how I could access this?

There might be a method for this in PDO for this, but I cannot spot one at a quick glance. In the meantime: SELECT CONNECTION_ID() should do.

Btw: Have you checked this already?

Thanks Da:Sourcerer. I am not sure if I will end up using mixed-format replication yet. Also I am doing a lot of analysis and the majority of my reads (prior to caching) will come from temporary tables. As row-based replication does not actually replicate temporary tables at all I am assuming that unless I create ‘real’ tables to store this ‘temporary’ data then I will always be reading from the master and not the slave.