diff --git a/lib/MT/Object.pm b/lib/MT/Object.pm index 5be20011e..de9c1cd38 100644 --- a/lib/MT/Object.pm +++ b/lib/MT/Object.pm @@ -1796,9 +1796,6 @@ The name of the datasource for your class. The datasource is a name uniquely identifying your class--it is used by the object drivers to construct table names, file names, etc. So it should not be specific to any one driver. -Please note: the length of the datasource name should be conservative; some -drivers place limits on the length of table and column names. - =item * meta Specify this property if you wish to support the storage of additional @@ -2728,6 +2725,38 @@ object where I equals C, because it saves memory--only the I objects that you will be deleting are kept in memory at the same time. +=head2 Compatibility limitations on identifier name length + +You should be conservative with the length of your datasource and column names +because some drivers place hard limits on the length of table identifiers +(e.g. Oracle's 30-character limit). The datasource is of specific concern +because it I. + +For example, using a datasource like C with primary +key and indexed columns C, C, C and C +you might think you avoided the limit with the following identifiers: + + Table: mt_myclass_foobarbaz_map (OK, 25 characters) + + Columns: myclass_foobarbaz_map_id (OK, 25) + myclass_foobarbaz_map_foo_id (OK, 29) + myclass_foobarbaz_map_bar_id (OK, 29) + myclass_foobarbaz_map_baz_id (OK, 29) + +However, you need to also remember that all driver's use a special name for +indexes and some create a sequence identifier to track autoincremented primary +keys. It's almost always the index names which exceed the length: + + Sequence: mt_myclass_foobarbaz_map_id (OK, 28) + + Indexes: mt_myclass_foobarbaz_map_foo_id (FAIL, 32) + mt_myclass_foobarbaz_map_bar_id (FAIL, 32) + mt_myclass_foobarbaz_map_baz_id (FAIL, 32) + +The above would cause object initialization to fail completely making for a +very unhappy user of your code. By simply shortening the datasource value, you +can shorten every single identifier in the table. + =head1 SUBCLASSING It is possible to declare a subclass of an existing MT::Object class,