Doxygen is a tool for generating documentation from source code and it currently handles many languages either natively or through add-on filters. This script is one such filter that transforms T-SQL into C-like code so that doxygen can then parse it natively.
While this means that you can benefit from the automated generation of documentation it does mean that you have to mentally translate a 'struct' back into a 'table' and reverse the type and member/variable names in declarations.
NB: There is a separate project underway that is designed to allow Doxygen to natively handle SQL and format it in more natural fashion.
The only file you need from the package is sql2doxygen.ps1
. Copy
it to somewhere suitable such as your Doxygen installation or the SQL project.
In the doxygen configuration file for your project you'll find a section about
options for input files. Near the bottom of that section you'll find an entry
called INPUT_FILTER
, set this to where the sql2doxygen.ps1
script lives.
#--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = . . . . INPUT_FILTER = "PowerShell.exe -File C:\Path\To\sql2doxygen.ps1" . . .
NB: The surrounding quotes are required or you'll get a cryptic error from Doxygen about not being able to find it.
In the package you'll find a subfolder called Example
that contains
a Doxygen project file and a few .sql files. Assuming the Doxygen .exe is on your
path and the location is writable you can generate the example output like so:-
C:\sql2doxygen\Example> doxygen.exe Doxygen.cfg
You should see a new folder appear called Dox
. Open index.html
to see the results:-
C:\sql2doxygen\Example> start Dox\index.html
NB: The example Doxygen.cfg file uses a relative path to reference the sql2doxygen
filter script and so you must ensure the current working directory (CWD) is set
to the Example
folder.
TODO... The example covers some of this in its introduction page.
This script is freeware - you get what you pay for, nothing more, nothing less.
Please check the web site for updates.
Email: gort@cix.co.uk
Web: www.cix.co.uk/~gort
Chris Oldwood
31st January 2012