I am importing a very large SQL dump file. The file creates tables (about 50) and inserts values into the tables. I do this by running a system command in my program:

system ("mysql -u theuser --password=thepassword --force thedatabase < thedumpfile");

It takes up to 30 minutes to complete. I'd like to give the user an indication of what's going on, since it takes so long. I'm looking for ideas on the best way to do this.

I know the table names before I begin the import. I'm thinking I could display a list of all the table names, maybe colored in red. Then, as each insert statement is complete, I could color the table name green. But what's the best way to do this? I could parse the dump file, doing each "create table" and "insert into" statement individually, but I think that's a bad idea. This could introduce errors in the import of the file (which would be catastrophic) for the sake of the GUI (which is simply nice-to-have).

Perhaps a separate thread (or even a program) that checks the database periodically to see if a table exists. If it does, I know the previous table (they're alphabetical in the dump file) must be complete. But I hesitate to ping on the database while it's being written to. Is there a safe way to do this?

Thanks in advance for something clever. I get extra points for a snazzy GUI.