Posted on: 2009/8/24 12:05
Is it that when module is implemented to XOOPS, the database for the module is generated automatically by XOOPS?
Are there no referential integrity set in the XOOPS database generally?
Two tables A and B. Both are referencing to each other's primary keys with 1:N relation like explained in DBDesigner's online documentation (one - to - many relation One row in the source table matches many rows in the destination table.)
For example xoops_banner and xoops_bannerfinish tables have such referential "connection" between each other. Both have their primary keys also as foreign keys and they refer to each other by them. Confusing.
Why is it done like this?
Every module contains a /sql/mysql.sql file (appointed in xoops_version.php), which contains the table structure for the module's specific tables. These tables are created at module install and removed with uninstall.
No, all tables are MyISAM tables and referential integrity is only possible with the InnoDB storage engine, which is not always available.
Such things are not possible between two tables.
If the (unique) primary keys (are used to) point to each other you have a one to one relation.
I think you are misinterpreting the functions between these two tables. AFAIK When a banner has had its required display times it is copied to the other table and deleted in the first table and the 2 bid are both PRIMARY KEY, but are unrelated.
They do have both a 1 to many relation with bannerclient trough their cid field. One client can have many running and finished banners.
Hmm, now I thought that is it with MyISAM that you have to always do the Cartesian product with the two tables which should have relations between each other? And with WHERE clause pick up the correct rows.
And the functionality of the database is just in code where the database is really used.
I think the designer is looking for similar names and thinks there is a relation. Some existing relations may not be found eg uid and user_id.
But as in case 1 it is not. In fact the bid name is a shortcut for banner id and block id and is thus totally unrelated.
- 2 is the same case.
- 3 unrelated as explained before.
- 4 as explained before.
The cartesian product has nothing to do with table relations, but is the result of a query on two or more tables with no join condition.
The database is fully functional, but the relations are done in the PHP code. That's why I told you to examine the sources.