Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Optimize failure info??
Thu, Oct 25 2018 5:13 AMPermanent Link

Ian Branch

Avatar

Hi Team,
   This is sort of a follow on from my earlier post about Verification failure information.

   Yes, it's the problematic LAN at my Customer's.
   
   Got a copy of their data today and did a Verification via a utility I have made.
{sql}
SCRIPT(IN TableName VARCHAR COLLATE ANSI_CI, IN StructureOnly BOOLEAN, OUT OK BOOLEAN)
BEGIN
DECLARE Stmt STATEMENT;
PREPARE Stmt FROM 'VERIFY TABLE '+QUOTEDSTR(TableName,'"')+'';
EXECUTE Stmt;
SET OK =  STMTRESULT(Stmt);
END
{sql}

   This is tested and if the verification fails tells the user that it is now going to do a Repair.
{sql}
Repair Table 'xxxxxxx'      //   'xxxxxx' is of course the relevant table.
{sql}

   Once done and successsful, an optimize is done.
{sql}
Optimize table 'xxxxxx' using 'yyyyyy' no backup files   // 'yyyyyy' being the relevant field.
{sql}

   Today the optimize failed on a table.  Reloading the data and repeating the process using Manager it told me that
there was a constraint conflict, dupliacte record.
   I opened and checked the table and sure enough the record was there twice.  I deleted the less complete one.

   To my question - If the Optimize fails - Can I pick up that message that Manager gave me be retrieved programatically
so it can be shown within my App?

Regards,
Ian
Thu, Oct 25 2018 6:52 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


OPTIMIZE doesn't seem to have a STMTRESULT so probably not.

The only thing I can think of is to wrap it in a try..except block and handle the exception. I'd also suggest leaving backup files and clean up after a successful verify/repair/optimize


Roy Lambert
Thu, Oct 25 2018 11:47 AMPermanent Link

Ian Branch

Avatar

Thanks Roy,
   Unfortunate.  I will look at trapping Error #1004 to start with.
Regards,
Ian
Tue, Oct 30 2018 1:27 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ian,

<< Today the optimize failed on a table. >>

It failed *after* a repair ?  If so, then there's something seriously wonky with their storage system.

<< To my question - If the Optimize fails - Can I pick up that message that Manager gave me be retrieved programmatically so it can be shown within my App? >>

What you want is to use this event handler with the REPAIR TABLE statement:

https://www.elevatesoft.com/manual?action=viewevent&id=edb2&product=rsdelphiwin32&version=10T&comp=TEDBQuery&event=OnLogMessage

Any messages regarding the repair will be sent out via this event handler.

Tim Young
Elevate Software
www.elevatesoft.com
Image