So, I thought the CFC generator would be a perfect match for my coding needs till I started coding with the generated CFCs. I found myself having to create a gateway CFC for each table.
I knew I would need gateway objects but at first I did not think I could automate what I needed. Then I noticed that most of my gateway querys were based on indexes created in the database.
Well, the CFC Generator already can read all indexes on a database but I was only taking advantage of the primary key index. So, I just had to add a new class of tableindex and feed the other indexes into the class. I already have some changes made to my private version of the generator and will upload them to my site soon.
Can already tell you that the table to XML structure has changed a little.
It now looks like
<table>
<name>tablename</tablename>
<dbtype>Database type</dbtype>
<columns>
<column>
<name>column name1</name>
<length>column length</length>
etc
etc
etc
</column>
<column>
<name>column name2</name>
<length>column length</length>
etc
etc
etc
</column>
</columns>
<!--This is where new stuff and the beauty of XML/XSL come into play -->
<indexes>
<index>
<name>Index name</name>
<type>index type</type>
<columns>
<column>
<name>column name1</name>
<length>column length</length>
etc
etc
etc
</column>
<column>
<name>column name2</name>
<length>column length</length>
etc
etc
etc
</column>
</columns>
</index>
</indexs>
</table>
I imagine the default generated gateway CFC will have functions something like:
<cffunction name="get#Tablename#by#indexname#" returntype="query">
<cfargument name="#indexfield1#" type="#indexfield1type#" required="true">
<cfargument name="#indexfield2#" type="#indexfield2type#" required="true">
<cfquery .....................
</cfquery>
<cfreturn thequery>
</cffunction>
and a getAll function to read all rows from the table.
Also, the next version should work with any database supported by CF with no changes made to code.