2000 ----- Original Message ----- From: "Robertson-Ravo, Neil (REC)" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 02, 2002 2:08 PM Subject: RE: [ cf-dev ] Re: cfCompact
> which version? > > -----Original Message----- > From: Giles Roadnight [mailto:[EMAIL PROTECTED]] > Sent: 02 October 2002 14:01 > To: [EMAIL PROTECTED] > Subject: Re: [ cf-dev ] Re: cfCompact > > > Yes it is Access. Sorry, didn't realise we don't do attachments. Here is the > code: > > <!--- Check the attributes ---> > <cfscript> > // Default error variable > caller.error=0; > > //Check the database attribute > if (not IsDefined("attributes.database")) > caller.error=caller.error+1; // No database attribute present > else > { > if (not FileExists(attributes.database)) > caller.error=caller.error+2; // Database attribute does not point to a > valid database > path=GetDirectoryFromPath(attributes.database); > success=0; > while (success IS 0) > { > attributes.tempdatabase=path & randrange(1000,9999) & ".mdb"; > if (not FileExists(attributes.tempdatabase)) > success=1; // We have a non-existing filename > } > } > > //Check the backupdatabase attribute > if (IsDefined("attributes.backup")) > if (FileExists(attributes.backupdatabase)) > caller.error=caller.error+4; // Backupdatabase already exists > </cfscript> > > <cfif not caller.error> > <cfif IsDefined("attributes.backupdatabase")> > <cffile action="COPY" source="#attributes.database#" > destination="#attributes.backupdatabase#"> > </cfif> > > <!--- Connect to/Create the object ---> > <cftry> > <cfobject type="COM" action="CONNECT" name="objaccess" > class="Access.Application"> > <cfcatch type="Any"> > <cfset request.comerror = cfcatch.message> > <cfset caller.error = 10> > <cfobject type="COM" action="CREATE" name="objaccess" > class="Access.Application"> > </cfcatch> > </cftry> > > <!--- Compact the database to a temporary datbase ---> > <cftry> > <cfscript> > objDBEngine = objaccess.DBEngine; > temp = objDBEngine.CompactDatabase("#attributes.database#", > "#attributes.tempdatabase#"); > </cfscript> > <cfcatch type="Any"> > <cfset request.comerror = cfcatch.message> > <cfif cfcatch.message is ""> > <cfset request.comerror = cfcatch.detail> > </cfif> > <cfset caller.error = 10> > </cfcatch> > </cftry> > > <!--- Delete the old database and rename the temporary database ---> > <cfif FileExists(attributes.tempdatabase)> > <cffile action="DELETE" file="#attributes.database#"> > <cffile action="RENAME" source="#attributes.tempdatabase#" > destination="#attributes.database#"> > </cfif> > > </cfif> > > ----- Original Message ----- > From: "Robertson-Ravo, Neil (REC)" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, October 02, 2002 1:56 PM > Subject: RE: [ cf-dev ] Re: cfCompact > > > > Oh, I gather this is Access yeah? :-) > > > > -----Original Message----- > > From: Giles Roadnight [mailto:[EMAIL PROTECTED]] > > Sent: 02 October 2002 13:55 > > To: [EMAIL PROTECTED] > > Subject: [ cf-dev ] Re: cfCompact > > > > > > Here is the code: > > > > <CF_COMPACT > > DATABASE="#request.dataroot##attributes.database#" > > BACKUPDATABASE="#request.dataroot##request.destinationFilename#"> > > > > I have attached the template too. > > > > > > -- > > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > For human help, e-mail: [EMAIL PROTECTED] > > > > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > For human help, e-mail: [EMAIL PROTECTED] > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > For human help, e-mail: [EMAIL PROTECTED] > -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
