Simon Harriyott

Build machine and SQL Server

Today I added some SQL Server action to the daily build process. This deletes the database from the previous build, and runs the SQL scripts for adding the UDTs, tables, indexs, foreign keys etc.

A contractor, who left before I joined, had written a handy utility to compare the current database version to the installed database version and run the correct update scripts. I modified this to run in unattended mode, and use command line arguments for the server, user name and so on.

The existing code was "challenging". There were magic numbers identifying button controls, so the "Next >" button was cmdAction(2), and the "Cancel" button was cmdAction(3). These all called the same method, which had a select statement to choose what to do next.

There was a database access class, which handled all the communication with the database, from anywhere in the program, except for one of the modules, which used its own connection.

I'd love to have time to "refactor" all this, but unfortunately I don't.
27 April 2005