Retrieving tables within your Cake database

I have been working lately on adding an installation process to my forum plugin. For this process I needed a way to retrieve a list of tables within a selected database, to make sure there are no table name conflicts. After asking the question on Twitter, I got the answer thanks to @pierremartin and @mark_story (of course!). You simply use the ConnectionManager class.

$db = ConnectionManager::getDataSource('default');
$tables = $db->listSources();

Very handy, and a lot easier then writing a custom query with execute().