Efficiency of duplicate copy
Posted: Wed Aug 01, 2007 6:32 pm
Hi guys,
I have a text file of usernames and password (one combination per line), a copy of which I am storing in a MYSQL database.
When my code executes the MYSQL database should be updated with an exact copy of the text file with any U/P combinations removed from the text file also removed from the database, and any new ones also added to the databse along with a time stamp.
The ordering is not important so no sorting is required, the two (text file and DB) simply must be identical. I'd appreciate any advice on the most efficient way of achieving this. How should I compare the text file and database? For example. should I copy both into an array first. Or should I simply read a line from the text file at a time and sequentially search the database row by row. Although this would appear to be the most obvious solution it is also probably the least efficient?
Your feedback would be much appreciated.
Many thanks,
Rob.
I have a text file of usernames and password (one combination per line), a copy of which I am storing in a MYSQL database.
When my code executes the MYSQL database should be updated with an exact copy of the text file with any U/P combinations removed from the text file also removed from the database, and any new ones also added to the databse along with a time stamp.
The ordering is not important so no sorting is required, the two (text file and DB) simply must be identical. I'd appreciate any advice on the most efficient way of achieving this. How should I compare the text file and database? For example. should I copy both into an array first. Or should I simply read a line from the text file at a time and sequentially search the database row by row. Although this would appear to be the most obvious solution it is also probably the least efficient?
Your feedback would be much appreciated.
Many thanks,
Rob.