Groups > dBase > dBase Internet > Re: hard deletes




hard deletes

hard deletes
Thu, 10 Apr 2008 13:25:02 -040
dBase Plus  I am having problems getting records deleted from a file.  I 
have an Internet application that allows retail insurance agents to enter 
information about trucking accounts and get a quote.  One of the items they 
must give us information on is the actual vehicles to insure.  So, I have a 
separate table for vehicles called "units.dbf" where they can enter as
many 
units as they please.  Later in the application they can review, edit or 
delete units they have entered or add additional units.  In other portions 
of the application our underwriters can view/print/edit the applications, 
including a vehicle list.  In order to have reports while the system is live 
I have an application that creates a temporary table for reporting.  The 
main vehicle table is "units.dbf" and the temporary reporting table is

"unit.dbf".  So when it's time to view or print a vehicle list I clear
out 
the temporary table and append records to it from the permanent table.

Here's the problem.  If the user deletes a unit, I use the OOP hard delete 
(q.rowset.delete()) and the unit disappears from the Internet list. 
However, when I append the records from the permanent table to the temporary 
table the deleted records are still there and transfer to the temporary 
file.  For example, if the agent accidentally enters the same unit twice and 
goes back to delete one, it appears to be deleted.  However, when the 
vehicle list prints both units are still there.  I thought using the hard 
delete got rid of that problem.  What do I need to do?

-- 
Dan Anderson
UBI Processing Dept.
andersond@ubinc.com
800-444-4824 ext 101 

Post Reply
Re: hard deletes
Thu, 10 Apr 2008 14:15:52 -040
Hi Dan,

As you have discovered through experience, q.rowset.deleted() is not a hard 
delete. Have you tried
    append all from units.dbf for not deleted()

Another choice would be to convert units.dbf to a paradox table, since such
tables 
do not support soft deletes.


Dan Anderson wrote:
> dBase Plus  I am having problems getting records deleted from a file.  I 
> have an Internet application that allows retail insurance agents to enter 
> information about trucking accounts and get a quote.  One of the items they

> must give us information on is the actual vehicles to insure.  So, I have a

> separate table for vehicles called "units.dbf" where they can
enter as many 
> units as they please.  Later in the application they can review, edit or 
> delete units they have entered or add additional units.  In other portions

> of the application our underwriters can view/print/edit the applications, 
> including a vehicle list.  In order to have reports while the system is
live 
> I have an application that creates a temporary table for reporting.  The 
> main vehicle table is "units.dbf" and the temporary reporting
table is 
> "unit.dbf".  So when it's time to view or print a vehicle list I
clear out 
> the temporary table and append records to it from the permanent table.
> 
> Here's the problem.  If the user deletes a unit, I use the OOP hard delete

> (q.rowset.delete()) and the unit disappears from the Internet list. 
> However, when I append the records from the permanent table to the
temporary 
> table the deleted records are still there and transfer to the temporary 
> file.  For example, if the agent accidentally enters the same unit twice
and 
> goes back to delete one, it appears to be deleted.  However, when the 
> vehicle list prints both units are still there.  I thought using the hard 
> delete got rid of that problem.  What do I need to do?
Post Reply
Re: hard deletes
Thu, 10 Apr 2008 15:05:42 -050
> However, when the  vehicle list prints both units are still there.  I 
> thought using the hard delete got rid of that problem.  What do I need to 
> do?

Dan

When you run the report can you:
"set deleted on"
to hide deleted records

or how about using the name of the user as a name for the temporary file 
like this:

oCGI['username'] = getenv("REMOTE_USER")

then use unit.dbf as the structure for their specific temp file.

or here is a method to create and populate a table from scratch (somewhat 
untested and you would have to test for the file 2nd time around to make 
sure it did not exists in which case you would need to drop the old table 
first:

d = new database()
d.databasename = "<your database>"
d.active = true

cUser  = getenv("REMOTE_USER")

d.executeSQL("create table " + cUser + " (id varchar(8), name
varchar(40))")

q = new query()
q.database = d
q.sql = 'select * from ' + cUser
q.requestlive = false
q.active = true
q.sql = [insert into ] + cUser + [ (id, name) values ('001', 'truck 1')]
q.sql = [insert into ] + cUser + [  (id, name) values ('003', 'truck 3')]
q.sql = [insert into ] + cUser + [  (id, name) values ('0004', 'truck4')]
q.sql = [update ] + cUser + [  set name = 'truck 2' where id = '001']
q.requery()
q.active = false

//close databases
d.active = false




Post Reply
Re: hard deletes
Fri, 11 Apr 2008 05:51:55 -070
Dan Anderson wrote:
> dBase Plus  I am having problems getting records deleted from a file.  I 

.DBFs do not do a Hard Delete, but a Soft Delete -- this is the default 
and has been this way from day one of dBASE II (if not earlier back to 
Vulcan).

As others have undoubtedly noted, you need to PACK the table to remove 
them completely from the table.

.DBFs are the only table format that use this functionality, but it is 
an integral part of the .DBF table ...

Ken

-- 
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
Post Reply
Re: hard deletes
Fri, 11 Apr 2008 08:20:23 -040
In article <iJ1aBJzmIHA.1096@news-server>, andersond@ubinc.com says...
> dBase Plus  I am having problems getting records deleted from a file.  I 
> have an Internet application that allows retail insurance agents to enter 
> information about trucking accounts and get a quote.  One of the items they

> must give us information on is the actual vehicles to insure.  So, I have a

> separate table for vehicles called "units.dbf" where they can
enter as many 
> units as they please.  Later in the application they can review, edit or 
> delete units they have entered or add additional units.  In other portions

> of the application our underwriters can view/print/edit the applications, 
> including a vehicle list.  In order to have reports while the system is
live 
> I have an application that creates a temporary table for reporting.  The 
> main vehicle table is "units.dbf" and the temporary reporting
table is 
> "unit.dbf".  So when it's time to view or print a vehicle list I
clear out 
> the temporary table and append records to it from the permanent table.
> 
> Here's the problem.  If the user deletes a unit, I use the OOP hard delete

> (q.rowset.delete()) and the unit disappears from the Internet list. 

There is no such thing as a hard delete with a .dbf file, no matter what 
function call you use.  I prefer to use a record recycling system when 
using .dbf's, rather than deleting and having to either pack them out, 
or living with a growing file of deleted trucks. 

... 

-- 
Remove the ns_ from if replying by e-mail (but keep posts in the 
Post Reply
about | contact