Re: Need Help deleting record from text file



Why so defensive? All I said was that for some operations a database is
faster than flat files and for some operations it is slower. If you are
going to be so dogmatic that you cannot accept that then I suspect that all
your opinions are probably questionable.

If you are going to do a binary search of an array then you need the whole
thing in memory, or you need to load it in fragments which will be slow and
messy.
Of course there is no magic to databases, but you can treat them as black
boxes which might as well be magic, the trick is obviously indexing which
allows complex queries to be answered far faster than any search on a flat
file - again obviously this only refers to large datasets, for a few hundred
items a flat file will be faster but we are dealing with sets of several
thousand items so the hypothetical examples will be larger sets where the
database has the clear advantage.

The OP is as you say reading in the data to an array - He then needs to
store it so he can compare the folder content with what is backed up, for
that he needs a record of prior content and a record of what's archived
which will be either the flat file or the database, so a database will speed
it up because he does not have to read in the array of existing content and
previous archive records because all that can be left unloaded but
accessible in the database.

Also once you have a rough idea of what you are doing coding for databases
with VB6 is a doddle, while maintaining ones own index of flat file content
and devising a suitable random access method to get at the bits you need is
a lot more complex.

Dave O.

"Mike Williams" <mikea@xxxxxxxxxxxxxxxxx> wrote in message
news:%23059sMPAIHA.1204@xxxxxxxxxxxxxxxxxxxxxxx
"Dave O." <nobody@xxxxxxxxxxx> wrote in message
news:u6TkcoOAIHA.4732@xxxxxxxxxxxxxxxxxxxxxxx

Entering data into a database will be a bit slower
as it indexes the data on entry however retrieval
will be faster.

Faster than what?

The other main speed advantage is that opening a
database should be a lot faster than reading the
whole array into memory.

Who said you need to read an entire array into memory just to access a
small portion of it? I certainly never suggested that. If you need to save
a very large array to disk as a data file you can use standard VB I/O code
to do it efficiently. If you write the data in a suitable format you can
later open the data file by reading just a relatively small header chunk
and then read in the elements or the portion of data you require. This
method will work for all data types, including large variable length
strings, if you write the code properly. Obviously the indexing method
chosen will vary depending on the circumstances and on the kind of data
and the kind of uses you are likely to put it to, but it certainly is
possible to do this stuff very effieciently in ordinary VB code without
needing to use a standard "database". Databases do not contain "alien
magic" ;-)

Besides, the OP is reading his data (the names of the files contained in a
specific folder) using FindFirstFile and FindNextFile (presumably) and
dumping that data (the names of the files) directly in to a VB string
array and then sorting the array. How is using a database going to speed
up that operation!

Mike





.



Relevant Pages

  • Re: Need Help deleting record from text file
    ... Who said you need to read an entire array into memory just to access a small portion of it? ... If you write the data in a suitable format you can later open the data file by reading just a relatively small header chunk and then read in the elements or the portion of data you require. ... How is using a database going to speed up that operation! ...
    (microsoft.public.vb.general.discussion)
  • Re: Need Help deleting record from text file
    ... In many circumstances retrieval of data from a "home grown" data file will actually be faster than from a general purpose commercial database. ... save his data to disk using a "flat file" unindexed arrangement. ... In fact I never mentioned him saving his data to disk in any format at all. ... Admittedly a nice "ready made" database does make it relatively easy for people to store and retrieve data fairly rapidly without needing to write too much code or to worry about the methods used by the "black box" to perform such feats, and I certainly would not suggest that they should not be used, but I think that for many tasks a "home grown" data format would be as good as, and in some cases better than, a standard database. ...
    (microsoft.public.vb.general.discussion)
  • Re: Just say no to threads [Was: Software architecture]
    ... they knew there was going to be a database in the app. ... Now my colleague just spent a couple/three weeks designing an SQL ... Turns out they have a flat file of sample information, ...
    (comp.object)
  • RE: Cisco LEAP
    ... aren't meant to work this way; that's largely why database applications work ... For that, sure, a flat file is faster. ... Network with over 10,000 of the brightest minds in information security ... most highly-anticipated industry event of the year. ...
    (Pen-Test)
  • Re: Portugal and Azores Ceres question
    ... is the advantage of Access over a flat file ... I cannot see a stamp database requiring a deeper platform. ... Why risk the typos and the time to query a table like that? ... The report generator in Access is a 2 pass processor. ...
    (rec.collecting.stamps.discuss)