Mark

Cant see anywhere where you are creating the struct in the first place

Also you are delaring an Array and naming it with a DOT notations.

Also, varialbes can not be straight numbers, which is wat the count ends up
being.


try

<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)>
</cfloop>

Steve

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Mark
Stanton
Sent: Tuesday, March 25, 2003 5:11 PM
To: CFAussie Mailing List
Subject: [cfaussie] data structure confusion


I'm trying to make a cfc that will receive a database name & data source
name and return a structure that describes the databases properties. Kind of
like the following:

database.tables[1].tableName = "myTableName"
database.tables[1].fields[1].fieldName = "myFieldName"
database.tables[1].fields[1].fieldDefault = "1"
database.tables[1].fields[1].fieldType = "int"
database.tables[1].fields[1].fieldKey = "Primary"
database.tables[1].fields[1].fieldNull = "No"
database.tables[1].fields[1].fieldExtra = "auto_increment"


I'm not really having much luck - keep getting tripped up on the very first
bit: database.tables[1].tableName = "myTableName"

<cfset databaseName = "myDatabaseName">
<cfset dataSourceName = "myDSN">

<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#].tableName" = evaluate('tables_in_' &
databaseName)>
        <cfdump var="#thisDb#">
        etc...

The error is: 'The string "thisDb.tables[1].tableName" is not a valid
ColdFusion variable name. '

I've tried pretty much every alternative I can think of and still no luck.
Any ideas appreciated.


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/

Reply via email to