Stored Procedures
The stored procedure code referenced in this section is available in a zip file here. The zip file includes scripts for both linux and Windows to load the procedures in the database. There are separate directories in the file for procedure code used by PostgreSQL, MySQL, and Oracle.
Both the stored procedure code and the load script require: The script, when executed, will prompt the user for the database username, password, and the database name where the MusicXML data is stored.
The score view
View score_view references music data records in a score, along with the record's measure and pitch information.
Procedure score_report
The score_report procedure iterates over the music data records in the score view, and for each iteration calculates the current state of the score, stores the current state in temporary tables, and calls an individual report procedure.
score_report also creates join database records for each measure in a score, and a finishing record indicating that the report has been run so that there aren't duplicate report runs.
Stored Functions
Stored convenience functions included are:
Individual report procedures
Individual report procedures are called by procedure score_report once every music data iteration. The report procedure queries the current score state in the temporary tables stored by the score report procedure, makes its own calculations and stores the results in its own dedicated reports table. The data in the reports table is then used by the BI software to create a visual display.
The individual reports here are:
Executing a score report
A score report is executed by calling procecure score_report.
Calling score_report populates the reports table for that report.
Call score_report at the mysql prompt using the call command, the report name and the Score ID of a score that's in the MusicXML database. The Score ID of a score is found in table SCORE, field ID.
Example: call score_report('pitch_count_report', 5);