Subject Re: Comparing two Sps
Author Didier Gasser-Morlay
Adam, Allan




> > there are db compare utilities which use a reference and target
db, they
> > compare and result in an alter statement for the procedure.
> > Is this no good for your purpose?
> > Alan

In theory they are good but I the SP compare is just one step in a
much larger comparison utility I am writing for which I will not find
any off-the-shelf utility. I have designed a templating system in
which data structure is embedded with front-end (javascript) and
back-end (php) and this utility will be part of the upgrading
mechanism. So I want to have one single utility that (as other tools
do check tables, SPs and triggers but also compare the content of
several "system" tables

>
> I agree with Alan. It is likely that if the "same" SP exists in both
> databases (ie. The same version of the SP), there would be no
> difference in white space and comments etc.

You've got a point there except that sometimes (programmers are not
always consistent) the same mod is applied in both the source and
target database manually so spaces migh be different. But I agree this
might not be so often and the worse would be to have a false positive
(is found to be different whislt in fact they're not)


> I am not familiar with what information BLR stores and what it doesn't
> store, and whether differences in white spaces and comments create a
> different BLR (I doubt it), but it just seems like overkill when all
> you are truly after is whether their definitions are bytewise
> identical, or whether they are different. You could then use one of
> the many database comparison tools to tell you and write a change
> script for you.

I just thought that may be a BLR comparison might be more thourough,
but I am not after building a functional comparison (the xUnit idea)
since I'd have to rebuild it every so often.

So I'll settle with the Char-based comparison which will give me a
very good head start and see how it goes over the next few weeks

Thanks both of you for this it helped fixing ideas,

Didier


> To test whether functionwise they are identical, you should use the
> xUnit derivative in whatever language you are most familiar, and your
> test cases will prove it 5 seconds whether they are identical or not.
> Of course this assumes you have appropriate coverage in your test
> cases, which may not be a reality. If you do not have appropriate test
> cases, firstly use your DB comparison tool to tell you whether they
> are the same, then start writing some test cases.
>
> Adam