Board index » delphi » Empty Table not the same DB desktop empty

Empty Table not the same DB desktop empty

Hello,

I have noticed that ttable.emptytable seems to delete the records one at
a time, takes a long time with medium sized paradox database (30,000
records), and does not reduce the file size.  Using Database Desktop
Tools/Empty the action is almost instantaneous and the file is reduced
to the minimum size.  Is there any way to get the same results from a
delphi program?

TIA...Jim

 

Re:Empty Table not the same DB desktop empty


Quote
> I have noticed that ttable.emptytable seems to delete the records one at
> a time, takes a long time with medium sized paradox database (30,000
> records), and does not reduce the file size.  Using Database Desktop
> Tools/Empty the action is almost instantaneous and the file is reduced
> to the minimum size.  Is there any way to get the same results from a
> delphi program?

I don't have an exact answer (as I can't see what DD is actually doing
internally) but my guess would be that DD is actually calling
TTable.CreateTable (or the BDE's dbiCreateTable) with the same field and
index properties of the existing table, essentially "re-creating" it.  That
is:

(1) Get current table structure(s) including field defs, index defs, etc.
(2) Delete current table.
(3) Create new table using this structure information.

I would imagine this would be very fast.

Regards,
Vinnie Murdico
Software with Brains, Inc.
Value-Priced Bug-Tracking Software
http://www.softwarewithbrains.com

Re:Empty Table not the same DB desktop empty


Quote
Jim Andrews (j...@azdogs.com) wrote:

: I have noticed that ttable.emptytable seems to delete the records one at
: a time, takes a long time with medium sized paradox database (30,000
: records), and does not reduce the file size.  Using Database Desktop
: Tools/Empty the action is almost instantaneous and the file is reduced
: to the minimum size.  Is there any way to get the same results from a
: delphi program?

As far as reducing the file size, follow the call to empty the table
with a call to pack the table.  This, however, involves API calls to
the BDE.  More info on how to do the API calls, and a "pack table"
component, are available at Borland's website.  As to the time issue,
I'm not sure, but you could experiment with whether using a BDE API
call to empty the table is faster. Borland's been moving their web
pages around, but you may still be able to get there from
http://www.borland.com/devsupport/bde/

There are also a lot of enhanced components and library routines to
make the most efficient use of the BDE in the freeware rxLib component
library, which comes with full source code.  http://www.rxlib.com/

Let us know if you find a more efficient way.
--
Rick Carter
carte...@email.uc.edu

Other Threads