Re: [Q] large flat files usage
Re: [Q] large flat files usage
- Subject: Re: [Q] large flat files usage
- From: Phillip Morelock <email@hidden>
- Date: Fri, 21 Jun 2002 02:06:36 -0700
On 6/21/02 1:45 AM, "Martin Reed" <email@hidden> wrote:
>
No. There is no concept of insert for a normal file such as you are planning
>
to work with. You will either overwrite existing data or possibly extend the
>
length of the file. A full blown database program (Oracle, mySQL etc) has to
>
cope with the same behaviour, which is part of the "fun" of writing them.
>
>
If:
>
- you have an index in to your data ie offsets to records
>
- you have very few updates
>
- you don't mind the file getting a bit bigger
>
then a very simple approach is just to write new records to the end of the
>
file and update the index. Occasionally you'll probably want to compact the
>
data file by copying it minus the gaps to a new file (and updating the index
>
to match). This has the useful side-effect of keeping old records around for
>
a while "just in case".
>
>
Mind you, if your needs get even a little bit more complicated I'd switch to
>
one of the several free relational databases out there :-)
On 6/21/02 1:39 AM, "Georg Tuparev" <email@hidden> wrote:
>
you can find the sources somewhere... What you would like to achieve is
>
something like a primitive database - possible but not a trivial task.
>
Consider other possibilities before going along this road! You might
>
even consider using a real embedded database...
I can see by the gentle voices of reason that I've gotten in a bit over my
head here! Yes, a database would be ideal (never realized how much I'd
gotten used to it). I appreciate the advice.
- I can't change the flat files. Gotta work with them as-is at this stage,
since it's all there is. Could process them into a database, but it's not
practical in this situation.....yes I know it's odd :-)
- The editing functionality is not really necessary, I just got ahead of
myself. I got "creative" and ambitious -- a dangerous combination!
Think I will go back to starting with read-only functionality as phase 1,
which was the original requirement anyway. The VM-mapped NSData buffer
worked pretty well for that, and I had a hacked-up little indexing scheme
going for one file type.
In the meantime I'll pick up:
Stevens, Richard W. (1999). Advanced Programming in the Unix Environment
Massachusetts: Addison Wesley Longman, Inc.
ISBN: 0201563177
Thanks again,
fillup
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.