So i was right:P
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Mark
Stanton
Sent: Tuesday, March 25, 2003 5:39 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: data structure confusion
Got It!
<cfset thisDb.tables[tableCount] = structNew()>
<cfset thisDb.tables[tableCount].tableName = evaluate('tables_in_' &
databaseName)> is right.
<cfset "thisDb.tables[#tableCount#].tableName" = evaluate('tables_in_' &
databaseName)> is wrong.
structNew() was required (although not on the root "thisDb" variable) and my
syntax with quotes & hashes was wrong.
-------------------workign version----------------------
<!--- fill these two in as required --->
<cfset databaseName = "myDatabaseName">
<cfset dataSourceName = "myDataSourceName">
<cfquery datasource="#dataSourceName#" name="get_tables">
SHOW TABLES FROM #databaseName#
</cfquery>
<cfset thisDb.tables = ArrayNew(1)>
<cfset tableCount = 0>
<cfloop query="get_tables">
<cfset tableCount = tableCount + 1>
<cfset thisDb.tables[tableCount] = structNew()>
<cfset thisDb.tables[tableCount].tableName = evaluate('tables_in_' &
databaseName)>
<cfquery datasource="#dataSourceName#" name="get_fields">
SHOW FIELDS FROM #evaluate('tables_in_' & databaseName)#
</cfquery>
<cfset thisDb.tables[tableCount].fields = ArrayNew(1)>
<cfset fieldsCount = 0>
<cfloop query="get_fields">
<cfset fieldsCount = fieldsCount + 1>
<cfset thisDb.tables[tableCount].fields[fieldsCount] = structNew()>
<cfset thisDb.tables[tableCount].fields[fieldsCount].fieldName = field>
<cfset thisDb.tables[tableCount].fields[fieldsCount].fieldType = type>
<cfset thisDb.tables[tableCount].fields[fieldsCount].fieldKey = key>
<cfset thisDb.tables[tableCount].fields[fieldsCount].fieldNull = null>
<cfset thisDb.tables[tableCount].fields[fieldsCount].fieldDefault =
default>
<cfset thisDb.tables[tableCount].fields[fieldsCount].fieldExtra =
extra>
</cfloop>
</cfloop>
<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/
---
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/