|
Posted by Andy Jeffries on 03/29/06 14:15
On Wed, 29 Mar 2006 05:36:04 -0500, Jerry Stuckle wrote:
>>>I'd use a database such as MySql or Postgres. They are ideally suited
>>>for this kind of operation. And it's not that hard to program for them.
>>
>> I'd agree if he is the one inserting them in to a text file (he may be
>> being given it by another party).
>>
>> If he only has the text file, he'd have to parse it either way to insert
>> it into a DB or to just display it - so he might as well just display
>> it.
>
> Yes, he would have to parse it *once* to place all the information in the
> database. As a flat file he would have to parse it every time he wants
> anything from the database. And if the file format ever changes, he'll
> have to redo the code every place he needs to access it.
It depends what he's using the data for. Maybe this is code to parse it
put in to a database? I know at the moment he only wants to print it, but
maybe he's just taking it one step at a time.
To be honest, I think we actually have the same point of view on this, I
completely agree with you - I was just trying to explain (more for the
OP's benefit as I know you're a knowledgeable guy) that a database is a
great end-goal, but if it's for a one-off run it might be easier to just
display the information rather than add an intermediate step.
Your answer to "how do I display these fields" was "use a database"
without the intermediate step of how to get his data from the text file he
has in to the empty database he could make.
> Databases make your life so much simpler - even if you're not inserting
> into a file. Even with static data I almost always put the information
> in a database; it's just so much easier to access - and you don't run
> into problems like this.
Again though, while I generally agree - it depends on the purpose.
Without more information from the OP it's difficult for you or I to advise
whether putting it in a database is the best course of action.
For example, this may be a much simplified version of what he wants and it
may just be that his boss has said "here's a one-off dump of the CRM
database, can you get me the details for these users". He's
therefore writing a script to do it (wise man, the boss may ask the same
thing next month) but creating a database would be overkill as it won't be
accessed until possibly next month and by then the data would need
re-importing anyway.
But as I said, without knowing we're both just guessing :-)
Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos
[Back to original message]
|