If the data does not change that often, you should be okay writing it to a
cfml file and then including it. On future uses of the data you can check
to see if the file already exists and if not re-generate it, and if it
does, just include it. Whenever the data in the DB record is updated, also
delete the generated cfml file which will force the script it to
re-generate it the next time it is requested. I do this with one of my apps
and it works good.

<cfset requestedpage = "5.cfm">

<!--- include CFML from Record ID 5 --->
<cfif not fileExists("#request.fileroot#generatedCFML/#requestedpage#")>
    <cfquery name="myCFML">
         select *
         from tbl_CFMLRespository
         where ID=5
    </cfquery>

    <!---- write the cfml to a file --->
    <cfilfe action=""
file="#request.fileroot#generatedCFML/#requestedpage#" output="#myCFML.cfml#">
</cfif>

<!--- include the generated cfml file --->
<cfinclude template="generatedCFML/#requestedpage#">

On your page where the CFML in the Database gets updated, you would simply
delete the file after it was updated:

<cfquery name="myCFML">
         update tbl_CFMLRespository
         set cfml='<cfif x is 7 or z is 9><cfset myFlag=true></cfif>'
         where ID=5
    </cfquery>

    <!---- delete the cfml file if it exists --->
     <cfif fileExists("#request.fileroot#generatedCFML/5.cfm")>
        <cfilfe action="" file="#request.fileroot#generatedCFML/5.cfm">
     </cfif>

Brook

P.S This is Pseudo Code!

At 12:11 PM 4/9/2004, you wrote:

>yeah I know ... just running on empty here.
>pushing 35 hours of non-sleep...
>
>
>soon I can go home and crash for awhile.
>
>-----Original Message-----
>From: Barney Boisvert [mailto:[EMAIL PROTECTED]
>Sent: Friday, April 09, 2004 3:03 PM
>To: CF-Talk
>Subject: RE: CF in a database (my apologies)
>
>You're not totally off base.  You could use evaluate for some things
>(expressions), but certainly not for any actual CFML.  Not sure if that
>would be useful for anything, but it could well be.
>
>Cheers,
>barneyb
>
> > -----Original Message-----
> > From: Adkins, Randy [mailto:[EMAIL PROTECTED]
> > Sent: Friday, April 09, 2004 11:56 AM
> > To: CF-Talk
> > Subject: RE: CF in a database (my apologies)
> >
> > spoke to soon, doh nevermind, thats right, you can't cause
> > the evaluae would
> > to display the code as string and not as commands..
> >
> > My apologies.. lack of sleep the last few days
> >
> > -----Original Message-----
> > From: Barney Boisvert [mailto:[EMAIL PROTECTED]
> > Sent: Friday, April 09, 2004 2:53 PM
> > To: CF-Talk
> > Subject: RE: CF in a database
> >
> >
> > The short answer is no.
> >
> > The long answer is you can do it by writing the CF from the
> > DB to a file,
> > and the include that file.  However, that's nasty because you have the
> > compilation cycle every request, and writing files and then
> > deleting them
> > adds a lot of overhead.  Back in the pre-MX days, I know some
> > people used
> > this solution on a RAMDISK which probably worked pretty well,
> > because there
> > wasn't a precompile cycle (the CFML was interpreted).
> >
> > Cheers,
> > barneyb
> >
> > > -----Original Message-----
> > > From: Eric Jones [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, April 09, 2004 11:45 AM
> > > To: CF-Talk
> > > Subject: CF in a database
> > >
> > > I posted this on CF-Newbie as well. Sorry for the cross post.
> > >
> > >
> > > Hey all,
> > >     I'm wondering is it possible to store CF Code in a
> > > database and then have the CF server execute it when it's
> > > extracted? if so can you give me a working example??
> > >
> > > ERJ
> > >
> > >
> >   _____
> >
> >
> >
> >
>   _____
>
>----------
>[<http://www.houseoffusion.com/lists.cfm/link=t:4>Todays Threads]
>[<http://www.houseoffusion.com/lists.cfm/link=i:4:159520>This Message]
>[<http://www.houseoffusion.com/lists.cfm/link=s:4>Subscription]
>[<http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=905.825.4>Fast
>  Unsubscribe] [<http://www.houseoffusion.com/signin/>User Settings]
>
>----------
><http://www.houseoffusion.com/banners/view.cfm?bannerid=36>
>[]
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to