> Thanks Adrian Cesana and Pan for all of your mails
> ..Its has been really helpful to me.
> I have a question ,Pan you have written in one of your
> mails that its better to compact and repair the
> database manually rather then using CF programm.Can
> you please tell me why yoyu said so.
> Shally
The technique I use involves CFUSION_DBCONNECTIONS_FLUSH()
call which breaks connections for all datasources. It's necessary
as the DAO call will fail (and throw an error) if the target .mdb
is locked (i.e. in use and a .ldb file exists for that .mdb).
It is more convenient from the operator's point of view to
schedule an automatic compress&repair, but I don't like the
idea that a user might get an error when the .mdb is unavailable.
The chances of this occuring is a calculation of the time
involved (milliseconds) vs. traffic making use of the templates
that might be calling the .mdb through a query. In most
case it will be a small probability of a conflict.
If you want to automate regardless of the above, you might try
what I have done is some applications, i.e. set a value in an
unrelated datasource that any template that references
a .mdb that is the target of a scheduled compress&repair
must check before continuing. The value determines if
the template continues or is switched to a refreshing
"please wait" page until the compression is done.
You would implement that something like this:
db system
table dbSTATUS
field targetMDB (name of dsn)
field door (default value = "open")
--------------------
production.cfm
<!--- template that makes use of target .mdb ---->
<cfquery datasource="systemDSN" name="checkDoor">
select door
from dbSTATUS
where targetMDB="foo";
</cfquery>
<cfif(NOT checkDoor.door IS "closed")>
do normal processing
<cfelse>
<cflocate url="wait.cfm" addtoken="yes/no">
</cfif>
-------------------------
wait.cfm
<cfheader name="Refresh" value="15">
<cfquery datasource="systemDSN" name="checkDoor">
select door
from dbSTATUS
where targetMDB="foo";
</cfquery>
<cfif(NOT checkDoor.door IS "closed")>
<cflocate url="production.cfm" addtoken="yes/no">
<cfelse>
<cfoutput>please wait db is being updated<br></cfoutput>
</cfif>
------------------
compress_repair.cfm
<!--------
scheduled template that works on .mdb and opens/shuts door
---->
<cfquery datasource="systemDSN" name="doorknob">
UPDATE dbSTATUS
set door="closed"
where targetMDB="foo";
</cfquery>
[compression code]
<cfquery datasource="systemDSN" name="doorknob">
UPDATE dbSTATUS
set door="open"
where targetMDB="foo";
</cfquery>
This synchronoization technique is also useful when accessing
and integrating a dataflow from a remote source or program
that is writing realtime values to a dsn.
Pan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists