Search Blog

Recent Comments
Re: Stats plugin ported to Model-Glue (by J.mihai at 12/14 8:52 AM)
Re: CFC DAO Generator (by rui at 7/04 5:42 AM)
Re: Updates to the DAO, Bean and Gateway generator (by rui at 7/04 4:49 AM)
Re: CFC DAO Generator (by fwscott at 6/22 7:03 PM)
Re: CFC DAO Generator (by dan at 6/22 12:38 PM)
Re: Trip to Thailand (by fwscott at 3/27 2:10 AM)
Re: CFC DAO Generator (by fwscott at 3/27 2:03 AM)
Re: CFC DAO Generator (by Garry Harstad at 3/26 12:30 PM)
Re: Trip to Thailand (by Niqui Merret at 3/23 4:51 PM)
Re: Adding a blogger ping utility to BlogCFM (by fwscott at 2/20 9:01 PM)
Categories
Annoucements (1 entries)
BlogCFM (3 entries)
CFC Generator (5 entries)
Coldfusion (11 entries)
Fusebox (2 entries)
Greasemonkey (1 entries)
Misc (3 entries)
Archives
November 2005 (2 entries)
October 2005 (1 entries)
August 2005 (1 entries)
July 2005 (4 entries)
June 2005 (5 entries)
May 2005 (7 entries)

Powered by
BlogCFM v1.01

May 2005
CFC Generator and my first real use
Post a Comment
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.
Posted by fwscott at 10:18 PM | Comments (0)
 
Subscription Options

You are not logged in, so your subscription status for this entry is unknown. You can login or register here.

No comments found.

Name:   Required
Email:   Required your email address will not be publicly displayed.

Want to receive notifications when new comments are added? Login/Register for an account.

Anti-spam key

Type in the text that you see in the above image:

Your comment:

Sorry, no HTML allowed!