Discussion:
Emptying Tables
(too old to reply)
Don
2008-09-29 00:18:28 UTC
Permalink
Hello All from Newport News


Some Time ago I asked how I might "Empty Tables" faster as I have a routine that empties 29 tables and it takes 5+ seconds.

Someone answered to try to do it through the BDE. I have misplaced that response.

I am revisiting that part of my code now and would like some help desiphering the BDE code to do this and how the parameters map to my tables and how I would call this function from my code.

Included is the syntax for Empty Table from The BDE help.

DBIResult DBIFN DbiEmptyTable (hDb, hCursor, pszTableName, [pszDriverType]);


DbiEmptyTable(hTmpDb, hCursor, NULL, NULL)

Thanks Don
unknown
2008-09-29 18:39:20 UTC
Permalink
On Sun, 28 Sep 2008 20:18:28 -0400 Don
Sender: Don <***@verizon.net>
wrote the following in:
Newsgroup: dbase.programming
Post by Don
Hello All from Newport News
Some Time ago I asked how I might "Empty Tables" faster as I have a routine that empties 29 tables and it takes 5+ seconds.
Someone answered to try to do it through the BDE. I have misplaced that response.
I am revisiting that part of my code now and would like some help desiphering the BDE code to do this and how the parameters map to my tables and how I would call this function from my code.
Included is the syntax for Empty Table from The BDE help.
DBIResult DBIFN DbiEmptyTable (hDb, hCursor, pszTableName, [pszDriverType]);
DbiEmptyTable(hTmpDb, hCursor, NULL, NULL)
Don,

Save the code below my signature as indicated. It works for me in XP Pro SP3 and Plus 2.21.

To empty the Fish table in the samples directory you would use the function in the following way:

? EmptyTableByDbi("dbasesamples", Fish.dbf")

Don't forget to make a copy of the Fish table before you try this :-)


Ivar B. Jessen


//----- Save as EmptyTableByDbi.prg -----
function EmptyTableByDbi
parameters cDatabasename, cTablename

extern cint DbiEmptyTable( chandle, chandle, cstring, cstring ) idapi32

d = new database()
d.databasename = cDatabasename
d.active = true
DatabaseHandle = d.handle
retVal = DbiEmptyTable(DatabaseHandle, null, cTableName, null)
d.active = false

return retVal
Donald R Plum
2008-09-30 01:21:47 UTC
Permalink
Post by unknown
On Sun, 28 Sep 2008 20:18:28 -0400 Don
Newsgroup: dbase.programming
Post by Don
Hello All from Newport News
Included is the syntax for Empty Table from The BDE help.
DBIResult DBIFN DbiEmptyTable (hDb, hCursor, pszTableName, [pszDriverType]);
DbiEmptyTable(hTmpDb, hCursor, NULL, NULL)
Don,
Save the code below my signature as indicated. It works for me in XP Pro SP3 and Plus 2.21.
? EmptyTableByDbi("dbasesamples", Fish.dbf")
Don't forget to make a copy of the Fish table before you try this :-)
Ivar B. Jessen
//----- Save as EmptyTableByDbi.prg -----
function EmptyTableByDbi
parameters cDatabasename, cTablename
extern cint DbiEmptyTable( chandle, chandle, cstring, cstring ) idapi32
d = new database()
d.databasename = cDatabasename
d.active = true
DatabaseHandle = d.handle
retVal = DbiEmptyTable(DatabaseHandle, null, cTableName, null)
d.active = false
return retVal
Ivar

Thanks so much!

That looks just what I was looking for, and a very explicit explanation.


Don
Don
2008-10-09 04:47:35 UTC
Permalink
Post by unknown
On Sun, 28 Sep 2008 20:18:28 -0400 Don
Newsgroup: dbase.programming
Post by Don
Hello All from Newport News
Some Time ago I asked how I might "Empty Tables" faster as I have a routine that empties 29 tables and it takes 5+ seconds.
Someone answered to try to do it through the BDE. I have misplaced that response.
Don,
Save the code below my signature as indicated. It works for me in XP Pro SP3 and Plus 2.21.
? EmptyTableByDbi("dbasesamples", Fish.dbf")
Don't forget to make a copy of the Fish table before you try this :-)
Ivar B. Jessen
//----- Save as EmptyTableByDbi.prg -----
function EmptyTableByDbi
parameters cDatabasename, cTablename
extern cint DbiEmptyTable( chandle, chandle, cstring, cstring ) idapi32
d = new database()
d.databasename = cDatabasename
d.active = true
DatabaseHandle = d.handle
retVal = DbiEmptyTable(DatabaseHandle, null, cTableName, null)
d.active = false
return retVal
Ivar

I worked on that routine last weekend.
Am using Vista and latest Dbase

Had to change
extern cint DbiEmptyTable( chandle, chandle, cstring, cstring ) idapi32

To
extern clogical DbiEmptyTable( chandle, chandle, cstring, cstring ) idapi32

Works great!!

And opens the door to more server side functions

Thanks again
Don

Loading...