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 DAO Generator: Take two
Post a Comment
Since my first post of the CFC DAO Generator I have made a few changes.

  1. Reorganized my CFCs to read table information.
  2. Added a tableindex CFC to hold an index of a table.
  3. Interface now generates a gateway CFC for the table based on indexes.
  4. Added the ability to save the generated CFCs.
With the above changes, I am now able to automatically generate all my database CFCs with little to no changes.  The gateway CFC now contains querys based on every index of the table being shown, so assuming I built the table correctly, all searchable fields should have a query generated for them.

Also, this should work with all databases supported by ColdFusion which makes it a big plus.

Again, you can demo the CFCCreator here and download the source here.

Please read the README file inside the zip for installation instructions.

Any further suggestions to make this better, leave some comments.
Posted by fwscott at 5:50 PM | Comments (12)
 
Subscription Options

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

Re: CFC DAO Generator: Take two
Nice idea Francis!

Only prob is that I'm getting an error when I try this out on the CFMX7 sample apps.

CFArtGallery > ART

====================

Query Of Queries runtime error. Comparison Exception: While executing "=" Unsupported Type Comparison Exception: Comparator operator "=" does not support comparison between following types: Left hand side expression type = "LONG". Right hand side expression type = "STRING".

==================

Thoughts?

Posted by Dick on May 25, 2005 at 10:51 AM

Re: CFC DAO Generator: Take two
Doh, for some reason that art gallery database returns a different type for the index query.

Had to add a couple things..

---------------------------

And change the querys to use PreserverSingleQuotes(comparestr)

Updated the downloadable and demo version.

Posted by fwscott on May 25, 2005 at 11:09 AM

Re: CFC DAO Generator: Take two
hmm, it appears that the blog software takes out code in comments.

But the updates are there.

Posted by fwscott on May 25, 2005 at 11:10 AM

Re: CFC DAO Generator: Take two
Getting there. I now get this error when I try to save the output...

Element BEAN is undefined in FORM.

Posted by Dick on May 26, 2005 at 10:36 AM

Re: CFC DAO Generator: Take two
Hey Dick,

this sounds like the index.cfm file is not up to date.

You should probably delete the full cfccreator directory and unzip the files again.

Posted by fwscott on May 26, 2005 at 12:27 PM

Re: CFC DAO Generator: Take two
Any idea how to get around the CF7 duplicate() issue?

With Coldfusion 7 you can't duplicate() CFC's it throws the following error:

Exception Message Unable to duplicate a ColdFusion Component. Detail ColdFusion does not support making a copy of a ColdFusion Component.

Any idea what changes I can make to correct this issue?

Posted by Jeff on July 18, 2005 at 11:49 PM

Re: CFC DAO Generator: Take two
In the gateway.xsl file in the transforms directory.

About line 30 change the duplicate() function to: CreateObject("component","").init();

Posted by fwscott on July 19, 2005 at 4:45 PM

Re: CFC DAO Generator: Take two
hmmm, it appears I cant figure out a way to show HTML/XML code in comments. Send me an email to the address in the readme file.

Posted by fwscott on July 19, 2005 at 4:47 PM

Re: CFC DAO Generator: Take two
hi ya Scotty, great stuff mate!

but just two quick things:

1) a simple JS error on document.getElementById() from the SELECT boxes. this seems to be because the elements 'tablename' and 'save' don't exist on the page until postback/refreshed. Only applicaable when the page first loads (however it throws a JS error that stops the postback so if you visit it the first time you get nowhere....

2) I've got a datasource that is in the admin but has (temp) moved so it'll generate an error if accessed. So...even though you've got a cftry/catch over the

"cfset conn = dss.getDatasource(names[i]).getConnection()"

and

"cfset databasetype = conn.getMetaData().getDatabaseProductName()"

the bad connection still throws....strange....I coulda sworn that the try/catch you've already got would have been all that was needed to skip over that bad datasource and move onto the next....but it doesn't....

anyhoo, thanx again. a new toy to play with

cheers barry.b

Posted by barry.b on September 22, 2005 at 3:38 AM

Re: CFC DAO Generator: Take two
just another small "touch up" from table.cfc

select * from indexqry WHERE NON_UNIQUE = #PreserveSingleQuotes(comparestrprimary)#

Query Of Queries runtime error. Comparison Exception: While executing "=" Unsupported Type Comparison Exception: Comparator operator "=" does not support comparison between following types: Left hand side expression type = "DOUBLE". Right hand side expression type = "STRING". ----------------------------------------- it's just a preserveSingleQuotes() thing. probably because I'm using CF7. dropping the preserveSingleQuotes() and the quotes with "comparestrprimary" and "comparestrnonprimary" seems to work just fine.

no biggie. just a few polite suggestions for the DAO generator Take three...

thanx again barry.b

Posted by barry.b on September 22, 2005 at 6:32 PM

Re: CFC DAO Generator: Take two
Hi Francis. Do you can give us an example about how to instantiate and how to use your cfccreator generated code? Sorry: this is a OO CF newbie guy. Thanks for your time and patience!

Posted by Marco on February 5, 2007 at 7:13 PM

Re: CFC DAO Generator: Take two
Hi Marco, if you could email me at the address in the readme file, I would be happy to point you in the right direction.

There are many different routes you can take, especially with the ORM frameworks that are available in ColdFusion now.

Posted by fwscott on February 6, 2007 at 10:16 PM

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!