Link to home
Start Free TrialLog in
Avatar of DigitalNam
DigitalNamFlag for Namibia

asked on

Threaded insert into MySQL database

I need some help with the following. I need to scan a directory with it's subdirectories in a thread (with a progress bar) and add all the ID3 tags into a mysql database. I only want to add new files to the database, so if certain directories where removed it must also be updated in the database.
Avatar of brezniczky
brezniczky
Flag of United Kingdom of Great Britain and Northern Ireland image

Hello,

You'lll need some kind of interthread synchronization, like TThread.Synchronize() to update the position of the progress bar.

You'll probably be able to insert the obtained data into the database from the background thread without a hassle, too, for instance, using ODBC driver via ADO (not ADOExpress). Though I am not experienced with that, it should be working, except if there are problems with the MySQL ODBC driver.

(At the time writing, I would not dare to state anything about the feasibility of the buit-in Windows file watching possibilities. Last time I had negative experiences with them, though infrequently.)

Are you interested in all of the steps you mentioned above, or only some specific ones?

Avatar of DigitalNam

ASKER

Hi brezniczky,I absolutely have no idea how to go about with the thread searching and progress bar part, the adding to the MySQL isn't a big issue for me, that I can do.
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello,

Should you stick to the concept of having a progress bar or even remaining time estimate on the UI during the process, maybe if you decompose the procedure into two steps - one for enumerating the files based on their extension (unknown length), and one for trying to read up the ID3's (from an a priori known number of files), you can achieve something similar to what you wanted.

I don't know if all your questions are answered already - do you have any more?