 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Neil MacDonald Guest
|
Posted: Wed Feb 07, 2007 11:42 pm Post subject: Deleted records in dBase .DBF files |
|
|
Can someone say how D2006 and BDE handle deleted records in a .DBF file?
I have deleted a record in a TTable in my application, and it disappears
from view. It no longer appears when viewing with Database Desktop, and it
appears in a 3rd party viewer as a record marked for deletion. All of which
I would expect.
But if I close my application and restart it, the so-called deleted record
shows again.
Is there something I should have done to make the deletion stick? Is there
an equivalent method to the dBase PACK command to physically delete
'deleted' records, or are they there for all time?
Neil |
|
| Back to top |
|
 |
John Herbster Guest
|
Posted: Thu Feb 08, 2007 12:56 am Post subject: Re: Deleted records in dBase .DBF files |
|
|
"Neil MacDonald" <neil.mcd (AT) btinternet (DOT) com> wrote
| Quote: | Can someone say how D2006 and BDE handle
deleted records in a .DBF file?
|
Neil,
Here is "something": As I recall, the first byte in DBF
(dBase) table records is reserved for indicating deletion.
The DBM (database manager) should change it to the
"deleted" state when a record is deleted. I believe
that there is a dBase function called "Pack" to
compress these deleted records out of the table.
Also, if I recall correctly, there was a display filter switch
that could turn on and off the display of the "deleted"
records (with a special symbol at the left of TDBGrid
display of rows which were deleted). Perhaps in your
case, the records were not getting written back to the
file *or* when reading them back, the filter switch is
set to display the "deleted" records.
HTH, JohnH |
|
| Back to top |
|
 |
Neil MacDonald Guest
|
Posted: Thu Feb 08, 2007 9:11 am Post subject: Re: Deleted records in dBase .DBF files |
|
|
John
Yes, the DBF file behaves as you say - the 3rd party viewer shows the
record is marked as deleted, and I could PACK the file if I had dBase
installed.
But
1. I can't see how to PACK within Delphi
2. I can't find a property/method for a TTable, TDataSet , TDBGrid which
allows deleted records to be displayed or not.
Neil
"John Herbster" <herb-sci1_at_sbcglobal.net> wrote in message
news:45ca20e4$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Neil MacDonald" <neil.mcd (AT) btinternet (DOT) com> wrote
Can someone say how D2006 and BDE handle
deleted records in a .DBF file?
Neil,
Here is "something": As I recall, the first byte in DBF
(dBase) table records is reserved for indicating deletion.
The DBM (database manager) should change it to the
"deleted" state when a record is deleted. I believe
that there is a dBase function called "Pack" to
compress these deleted records out of the table.
Also, if I recall correctly, there was a display filter switch
that could turn on and off the display of the "deleted"
records (with a special symbol at the left of TDBGrid
display of rows which were deleted). Perhaps in your
case, the records were not getting written back to the
file *or* when reading them back, the filter switch is
set to display the "deleted" records.
HTH, JohnH
|
|
|
| Back to top |
|
 |
Andy Vines Guest
|
Posted: Thu Feb 08, 2007 5:14 pm Post subject: Re: Deleted records in dBase .DBF files |
|
|
"Neil MacDonald" <neil.mcd (AT) btinternet (DOT) com> wrote in message
news:45cada0c (AT) newsgroups (DOT) borland.com...
| Quote: | John
Yes, the DBF file behaves as you say - the 3rd party viewer shows the
record is marked as deleted, and I could PACK the file if I had dBase
installed.
But
1. I can't see how to PACK within Delphi
2. I can't find a property/method for a TTable, TDataSet , TDBGrid which
allows deleted records to be displayed or not.
Neil
"John Herbster" <herb-sci1_at_sbcglobal.net> wrote in message
news:45ca20e4$1 (AT) newsgroups (DOT) borland.com...
"Neil MacDonald" <neil.mcd (AT) btinternet (DOT) com> wrote
Can someone say how D2006 and BDE handle
deleted records in a .DBF file?
Neil,
Here is "something": As I recall, the first byte in DBF
(dBase) table records is reserved for indicating deletion.
The DBM (database manager) should change it to the
"deleted" state when a record is deleted. I believe
that there is a dBase function called "Pack" to
compress these deleted records out of the table.
Also, if I recall correctly, there was a display filter switch
that could turn on and off the display of the "deleted"
records (with a special symbol at the left of TDBGrid
display of rows which were deleted). Perhaps in your
case, the records were not getting written back to the
file *or* when reading them back, the filter switch is
set to display the "deleted" records.
HTH, JohnH
|
In the Jedi VCL library there is JvBDEUtils.pas this has ShowDeleted()
function and PackTable() and ReIndexTable() funtions.
I use the ShowDeleted funtion on my grid then color the deleted fields
different to distinguish them. |
|
| Back to top |
|
 |
John Herbster Guest
|
Posted: Thu Feb 08, 2007 5:49 pm Post subject: Re: Deleted records in dBase .DBF files |
|
|
"Neil MacDonald" <neil.mcd (AT) btinternet (DOT) com> wrote
| Quote: | I have deleted a record in a TTable in my application,
and it disappears from view. It no longer appears when |
viewing with Database Desktop, and it appears in a 3rd
party viewer as a record marked for deletion. ... But if
I close my application and restart it, the so-called
deleted record shows again.
Neil, I found this though I have not read it
"Deleted records return alive"
http://groups.google.com/group/comp.lang.clipper/browse_frm/thread/fdd3a711e469f732
Can you use your 3-rd party viewer to find *when* the
delete flag gets turned off?
HTH, JohnH |
|
| Back to top |
|
 |
Neil MacDonald Guest
|
Posted: Thu Feb 08, 2007 9:26 pm Post subject: Re: Deleted records in dBase .DBF files |
|
|
Thanks, Andy
Jedi VCL (including JvBDEUtils.pas)seems a real sledgehammer, which I don't
really want to get into - but if I have to, how do you hook the Utils into a
TTable, or do you have to use a Jedi version of TTable?
Neil
"Andy Vines" <andy.vines (AT) amcukfasteners (DOT) co.uk> wrote in message
news:45cb0615 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Neil MacDonald" <neil.mcd (AT) btinternet (DOT) com> wrote in message
news:45cada0c (AT) newsgroups (DOT) borland.com...
John
Yes, the DBF file behaves as you say - the 3rd party viewer shows the
record is marked as deleted, and I could PACK the file if I had dBase
installed.
But
1. I can't see how to PACK within Delphi
2. I can't find a property/method for a TTable, TDataSet , TDBGrid which
allows deleted records to be displayed or not.
Neil
"John Herbster" <herb-sci1_at_sbcglobal.net> wrote in message
news:45ca20e4$1 (AT) newsgroups (DOT) borland.com...
"Neil MacDonald" <neil.mcd (AT) btinternet (DOT) com> wrote
Can someone say how D2006 and BDE handle
deleted records in a .DBF file?
Neil,
Here is "something": As I recall, the first byte in DBF
(dBase) table records is reserved for indicating deletion.
The DBM (database manager) should change it to the
"deleted" state when a record is deleted. I believe
that there is a dBase function called "Pack" to
compress these deleted records out of the table.
Also, if I recall correctly, there was a display filter switch
that could turn on and off the display of the "deleted"
records (with a special symbol at the left of TDBGrid
display of rows which were deleted). Perhaps in your
case, the records were not getting written back to the
file *or* when reading them back, the filter switch is
set to display the "deleted" records.
HTH, JohnH
In the Jedi VCL library there is JvBDEUtils.pas this has ShowDeleted()
function and PackTable() and ReIndexTable() funtions.
I use the ShowDeleted funtion on my grid then color the deleted fields
different to distinguish them.
|
|
|
| Back to top |
|
 |
Neil MacDonald Guest
|
Posted: Thu Feb 08, 2007 9:29 pm Post subject: Re: Deleted records in dBase .DBF files |
|
|
Thanks, John
That article is about Clipper programming, and as far as I can tell, the
dBase end is working OK.
The delete flag doesn't get turned off - it's just that Delphi ignores it.
Neil
"John Herbster" <herb-sci1_AT_sbcglobal.net> wrote in message
news:45cb0d4b$1 (AT) newsgroups (DOT) borland.com...
| Quote: | "Neil MacDonald" <neil.mcd (AT) btinternet (DOT) com> wrote
I have deleted a record in a TTable in my application,
and it disappears from view. It no longer appears when
viewing with Database Desktop, and it appears in a 3rd
party viewer as a record marked for deletion. ... But if
I close my application and restart it, the so-called
deleted record shows again.
Neil, I found this though I have not read it
"Deleted records return alive"
http://groups.google.com/group/comp.lang.clipper/browse_frm/thread/fdd3a711e469f732
Can you use your 3-rd party viewer to find *when* the
delete flag gets turned off?
HTH, JohnH
|
|
|
| Back to top |
|
 |
Vitali Kalinin Guest
|
Posted: Thu Feb 08, 2007 9:47 pm Post subject: Re: Deleted records in dBase .DBF files |
|
|
| Have you tried old good DbiPackTable? |
|
| Back to top |
|
 |
Neil MacDonald Guest
|
Posted: Fri Feb 09, 2007 12:36 am Post subject: Re: Deleted records in dBase .DBF files |
|
|
Vitali
I didn't know about . I'll give it a try. Many thanks.
Neil
"Vitali Kalinin" <vitkalinin (AT) yahoo (DOT) com> wrote in message
news:45cb45f9$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Have you tried old good DbiPackTable?
|
|
|
| Back to top |
|
 |
Andy Vines Guest
|
Posted: Mon Feb 12, 2007 6:57 pm Post subject: Re: Deleted records in dBase .DBF files |
|
|
"Neil MacDonald" <neil.mcd (AT) btinternet (DOT) com> wrote in message
news:45cb41a2$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Thanks, Andy
Jedi VCL (including JvBDEUtils.pas)seems a real sledgehammer, which I
don't really want to get into - but if I have to, how do you hook the
Utils into a TTable, or do you have to use a Jedi version of TTable?
Neil
|
You don't need to use the full JVCL, just include the JvBDEUtils in the
unit and then you just feed it your standard TTable.
eg.
DataSetShowDeleted(tblBrowse, True);
PackTable(tblBrowse);
ReindexTable(tblBrowse); |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|