Re: Palm Databases (pdb) read from WinCE app
- From: "Mike" <test@xxxxxxxx>
- Date: Thu, 2 Jun 2005 09:53:57 +0100
> Thanks for the answer Mike. My problem is proper to write data...and
> particularly add new rows or delete rows.
> I use fixed-size records and no sort in the pdb header, but when, for
> example, I delete a record, I have to do the following steps:
>
> - shift all records below the deleted one
> - change all records address is pdb header
> - decrement by 1 the number of records
For deleting a record in a 'dirty' way, assuming that at some point you
could clean the file up, why not just load the record list, delete the
pointer to the record you want to delete, then rewrite the record list?
Doing this would leave the actual data in place, but would remove the
pointer to it. Your clean-up routine would need to rebuild the data at some
point so you don't have a load of orphaned records, but it would speed up
the delete process because you're not moving all the data. As far as I know
there's no reason that there can't be a gap of (size of each recordlist
entry * number of deleted records) between the end of the record list and
the start of the first records data.
> All these actions should be done in a "transactional" way, so that if for
> a causal reason the program breaks while deleting the record, the file
> shoudn't be corrupted. Is there any way to do this?
One way I could think of would be each time you update the file, what you
actually do is move the whole file, plus your changes, to another file. Then
when you know it's all worked properly, delete the old file and rename the
new one. Hard to guess how long this would take, I suppose it depends on the
device, the size of the file, and whether you have the file in main memory
or on a card.
Also, it depends really on what order you need to have the data in, or if
that even matters. For example to add a record, you could read the first
records data out of the file, write it at the end of the file and update
it's pointer in the record-list to reflect the new location, then write your
new record data on the end of the file, and add a record-list entry to the
end of the record-list pointing to the new data. Obviously the moving of the
first record is to create room for the record-list to grow, so you would
need to check whether this is required every time, which depends on the size
of your records. You could achieve this in a fault-tolerant way by carefully
choosing the order that you do each operation. Of course, if you need data
sorted (as I do for my application) you'd have to make sure the new
record-list entry is put in the correct location. As far as I know there's
no need to sort the data, just the record-list.
I would suggest that if speed is a real issue, use something on the Pocket
PC that there is a proper API for. Out of interest, why are you trying to
use a non-PPC file format on the PPC? I can see why you might want to read a
PDB, but is there a compelling reason for using a PPC database if you need
to write and update? Don't get me wrong, I'm sure there's a way to knock up
an API to do all you want and more, but it strikes me as a lot of work.
Mike
>
> "Mike" <test@xxxxxxxx> wrote in message
> news:O0PHt2oZFHA.3572@xxxxxxxxxxxxxxxxxxxxxxx
>> It would be quite easy to write something to read stuff out of a PDB
>> file - the file specs are generally available (I think from the
>> PalmSource web site). It's just a case of learning to interpret their
>> record pointers at the top of the file. It wouldn't be quite so easy to
>> write back again (because of variable length records, sorted order etc.)
>> but not impossible.
>>
>> Mike.
>>
>> "Roberto" <none@xxxxxxxx> wrote in message
>> news:u$k8AheZFHA.3864@xxxxxxxxxxxxxxxxxxxxxxx
>>> Hi all,
>>> is there any (possibly with sources) library that allows to manage pdb
>>> files on a WinCE / PPC application (reading, deleting, inserting, ...
>>> records)?
>>> I have seen that in StyleTap emulator Palm applications can manage pdb
>>> files...but is there a way to manage directly them from a WinCE
>>> application?
>>>
>>
>>
>
>
.
- Follow-Ups:
- Re: Palm Databases (pdb) read from WinCE app
- From: Roberto
- Re: Palm Databases (pdb) read from WinCE app
- References:
- Re: Palm Databases (pdb) read from WinCE app
- From: Mike
- Re: Palm Databases (pdb) read from WinCE app
- From: Roberto
- Re: Palm Databases (pdb) read from WinCE app
- Prev by Date: How to use the popup blocker in my client appliance?
- Next by Date: ReadFile hang
- Previous by thread: Re: Palm Databases (pdb) read from WinCE app
- Next by thread: Re: Palm Databases (pdb) read from WinCE app
- Index(es):
Relevant Pages
|