Gary: It's built for mySql but yes database dependent in terms of the
queries & the expected results.

I've tweaked it slightly to avoid all the arrays - seems to make more sense
in my mind now & also dumps in a much more readable format.


One question can I get away with:

<cfset thisDb.tables = structNew()>

or should I be using:

<cfset thisDb = structNew()>
<cfset thisDb.tables = structNew()>

????

------------------------
<cfsilent>
<cfset databaseName = "myDatabaseName">
<cfset dataSourceName = "myDataSourceName">

<cfquery datasource="#dataSourceName#" name="get_tables">
SHOW TABLES FROM #databaseName#
</cfquery>

<cfset thisDb.tables = structNew()>
<cfloop query="get_tables">

        <cfset tableName = evaluate('tables_in_' & databaseName)>
        <cfset thisDb.tables[tableName] = structNew()>

        <cfquery datasource="#dataSourceName#" name="get_fields">
        SHOW FIELDS FROM #evaluate('tables_in_' & databaseName)#
        </cfquery>

        <cfset thisDb.tables[tableName].fields = structNew()>
        <cfloop query="get_fields">

                <cfset fieldName = field>
                <cfset thisDb.tables[tableName].fields[fieldName] = structNew()>

                <cfset thisDb.tables[tableName].fields[fieldName].fieldType = type>
                <cfset thisDb.tables[tableName].fields[fieldName].fieldKey = key>
                <cfset thisDb.tables[tableName].fields[fieldName].fieldNull = null>
                <cfset thisDb.tables[tableName].fields[fieldName].fieldDefault = 
default>
                <cfset thisDb.tables[tableName].fields[fieldName].fieldExtra = extra>
        </cfloop>
</cfloop>

</cfsilent>
<cfdump var="#thisDb#">
-------------------------



Cheers

Mark


______________
Mark Stanton
Web Production
Gruden Pty Ltd
Tel: 9956 6388
Mob: 0410 458 201
Fax: 9956 8433
www.gruden.com



---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to