Hi all,
I'm trying to loop through multiple MySQL databases to get the names of every table in them and I'm hitting a problem that probably has a simply solution but I need another set of eyes to check.
I have more code than below however this is the stripped down version of where I am hitting the problem.
Up until the <!--- PROBLEM AREA ---> section, everything is fine and returns as expected. However, MySQL returns the list of tables as #tables_in_dbname#, where dbname is the name of the database. Because I am running this against multiple databases, I can't hard code this variable.
I'm basically looking to do the equivelent of #tables_in_#qdb.database##, however obviously that won't work but it's the easiest way I can think of to explain.
Any suggestions are welcome, even if it means rewriting the whole thing.![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
Wullie
Fresh Look - Quality Coldfusion/Windows Hosting
The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
I'm trying to loop through multiple MySQL databases to get the names of every table in them and I'm hitting a problem that probably has a simply solution but I need another set of eyes to check.
I have more code than below however this is the stripped down version of where I am hitting the problem.
Code:
<cfquery name="qdb" datasource="#application.dsn#" username="#application.user#" password="#application.pass#">
SHOW DATABASES
</cfquery>
<cfloop query="qdb">
<cfquery name="qtable" datasource="#application.dsn#" username="#application.user#" password="#application.pass#">
SHOW TABLES FROM #DATABASE#
</cfquery>
<cfoutput query="qtable">
<!--- PROBLEM AREA --->
</cfoutput>
</cfloop>
Up until the <!--- PROBLEM AREA ---> section, everything is fine and returns as expected. However, MySQL returns the list of tables as #tables_in_dbname#, where dbname is the name of the database. Because I am running this against multiple databases, I can't hard code this variable.
I'm basically looking to do the equivelent of #tables_in_#qdb.database##, however obviously that won't work but it's the easiest way I can think of to explain.
Any suggestions are welcome, even if it means rewriting the whole thing.
![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
Wullie
Fresh Look - Quality Coldfusion/Windows Hosting
The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell