[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: database driven component chooser - part II



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Levente wrote:
> Christoph Lechner <cl0023@xxxxxxx> wrote:
>> OK. I took a look at the database. So a question came to mind when I saw
>> the layout of the 'device' table:
>> Why do you store the relationship between entries in the 'device' table
>> and entries in the 'supplier' table in fields named supplier*,
>> ordering_code*, price* in the 'device' table? What if there are more
>> than 3 suppliers for any given part?
>>
>> As the relation between 'device' and 'supplier' is a many-many
>> relationship, you'd be better off creating just another table, holding
>> the device's ID, the ID of the supplier and fields for the ordering_code
>> and the price. Then you only need to LEFT JOIN the tables
>> rel-device-supplier and supplier and you get all suppliers for a given
>> part. This would give you a somewhat tidier DB layout ...
> 
> Ok,
> 
> I have modified the structure of my database. Thank's for the hint.
Ok, seen that. Looks really nice now.

But make sure to add an ID field with autoincrement turned on to the new
relation table 'source' to avoid collisions. These can really screw it up :(

Why not add an index over 'dev_ID' and 'sup_ID'? Would tweak the
performance quite alot.

Just another 2 cents :)

CU
- - cl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHAqblWo2QgtqY4K8RAqPkAJ9PTUMtWICdTS0d8n3mUH+qWXR42wCePrfm
LZkyAX1CNVg30PIIqfTLtmc=
=T69q
-----END PGP SIGNATURE-----


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user