?
Solved

Threaded insert into MySQL database

Posted on 2011-09-06
4
Medium Priority
?
378 Views
Last Modified: 2012-05-12
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.
0
Comment
Question by:DigitalNam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:brezniczky
ID: 36491094
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?

0
 
LVL 1

Author Comment

by:DigitalNam
ID: 36491309
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.
0
 
LVL 38

Accepted Solution

by:
Geert Gruwez earned 2000 total points
ID: 36492663
fwiw ...
how do you know before the start of the thread how items (folders) you will have ?

update progressbar from a thread > see my article
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/A_239-Displaying-progress-in-the-main-form-from-a-thread-in-Delphi.html

listing files into memo with thread and progressbar
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_26193383.html#32795255

for the database inserts, i guess you want the delta
here it depends on how many items you have
1: load the list from the database into memory and compare them
2: vice versa, save the list to the database (in a extra table) and compare the two tables (with stored procedure or query)
3: set table restrictions > unique key and ignore the insert duplicate errors
0
 
LVL 3

Expert Comment

by:brezniczky
ID: 36515969
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?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question