mysql - How to count number of SQL statements in text file? -


my program restores mysql database sql file. if wanted display progress of sql execution in program, need know number of sql statements in file. how can in mysql? (the queries may consist of mysql specific multi-row insert statements)

i use either mysql command line tools or python api. you're welcome post solutions other dbms too.

the simple (and easy) way: add print statements sql script file, displaying progess messages.

the advantage (apart obvious 'it's hard parse multi-statement constructs') precise control on progress. example, statements might take longer run others need weight them.

i wouldn't think of progress in terms of number of statements executed. print out feedback specific tasks have been started , completed, such 'synchronising table 'blah'', 'updating stored procedure x' etc


Comments