|
|
sybperl-l Archive
Up Prev Next
From: Alain Trembleau <apt at melbpc dot org dot au>
Subject: Problem with dbschema.pl
Date: Nov 9 1999 11:43AM
I seem to have found a problem with the dbschema.pl script. It was
incorrectly generating 'sp_foreignkey' statements.
I have made changes to the file to fix it, and a copy of the file is
attached.
The differences between the two files are:
$ diff dbschema.pl old.dbschema.pl
..
(I have removed the comment changes that I have made)
..
374,381c372,379
< depkey1 = col_name(k.depid, depkey1),
< depkey2 = col_name(k.depid, depkey2),
< depkey3 = col_name(k.depid, depkey3),
< depkey4 = col_name(k.depid, depkey4),
< depkey5 = col_name(k.depid, depkey5),
< depkey6 = col_name(k.depid, depkey6),
< depkey7 = col_name(k.depid, depkey7),
< depkey8 = col_name(k.depid, depkey8)
---
> depkey1 = col_name(k.depid, key1),
> depkey2 = col_name(k.depid, key2),
> depkey3 = col_name(k.depid, key3),
> depkey4 = col_name(k.depid, key4),
> depkey5 = col_name(k.depid, key5),
> depkey6 = col_name(k.depid, key6),
> depkey7 = col_name(k.depid, key7),
> depkey8 = col_name(k.depid, key8)
408c406
< PrintCols (@dat[3..10]);
---
> PrintCols (@dat[11..18]);
The old version of the script did not correctly identify the dependency
keys (compare with sp_helpkey). Note also that when printing out the
foreign key statements the key values that need to be printed out are
not the dependency keys, but the keys of the referencing table.
If I have got this wrong, please let me know!
Also, who is maintaining dbschema.pl? I would be happy to look after
it, and make any further changes that people might want.
Cheers
alain
|