On Mon, 2003-10-06 at 12:36, Susan Ator wrote:
> The problem with using a database is the files within the directory are
> changing on, sometimes, a minute by minute basis. I think reading them into
> the database then deleting them when they are deleted from the directory
> would be a huge amount of overhead. No?

Not if they are changing on a minute by minute basis. Most of your
queries will be selects.

> Something else which I did not make clear in my previous post; when the
> files are removed from the directory I no longer want them displaying in my
> web page.

Double delete, from filesystem and from database. You pretty much have 3
choices that I can think of here:

  1. use a database which is suited to your task
  2. Use the filesystem but load the list everytime and apply ksort
     (you already said you don't want to do this).
  3. Use the filesystem, sort the entries, and cache the sorted result.
     (this is very database like).

Cheers,
Rob.

> 
> Susan
> 
> -----Original Message-----
> From: Robert Cummings [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 06, 2003 12:18 PM
> To: Susan Ator
> Cc: PHP-General
> Subject: Re: [PHP] File read and sort question
> 
> 
> On Mon, 2003-10-06 at 12:10, Susan Ator wrote:
> > I have a directory with an ever-changing number of files. Some will be
> > removed and others added on a continuing basis.
> > 
> > The files are ascii with the following layout:
> > 
> > <SENDER> Name
> > <SUBJECT> Subject line
> > <RELEASE_DATE> mm/dd/yyyy
> > <RELEASE_TIME> hh:mm
> > 
> > I can easily get a list of files and pull the necessary information. I
> need,
> > however to be able to sort by RELEASE_DATE *and* RELEASE_TIME
> > 
> > Philosophically, what is the best way to handle this? I'm hesitant to pull
> > all the information into an array and use ksort since there are, on
> average,
> > ~1000 messages in this directory which need to be processed.
> 
> Smells like a job for a database :)  Otherwise you'll need to either
> read all the data in, or create another file heirarchy with the
> appropriate redundancy to retrieve in sorted order, which incidentally
> probably loads all the file names then sorts. Really it's a database,
> database, database issue *grin*.
> 
> Cheers,
> Rob.
> -- 
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for       |
> | creating re-usable components quickly and easily.          |
> `------------------------------------------------------------'
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to