xmldb index name munging

xmldb index name munging

بواسطة - Howard Miller
عدد الردود: 3
صورة Core developers صورة Documentation writers صورة Particularly helpful Moodlers صورة Peer reviewers صورة Plugin developers
Am I right in thinking that the names of indexes get munged by Moodle from whatever is in the code when they are created... example...

new xmldb_index('contextid-lowerboundary-letter'.....

...in the code, seems to end up as something like, 'mdl_gradlett_conlowlet_uix' in the database. I'm a bit confused about where this occurs.
متوسط التقييمات: -
رداً على Howard Miller

Re: xmldb index name munging

بواسطة - Dan Poltawski

IIRC it is completely under the control of the database driver. Presumably because of DB specific restrictions.

edit: Don't know how accurate/up to date this is, but see Development:XMLDB_key_and_index_naming and sql_generator::getNameForObject.

رداً على Dan Poltawski

Re: xmldb index name munging

بواسطة - Howard Miller
صورة Core developers صورة Documentation writers صورة Particularly helpful Moodlers صورة Peer reviewers صورة Plugin developers
Ahh.... that's the one. Thanks.

It's really hard to debug upgrade problems with duplicate indexes and stuff if you're not sure you've got the right one. Thanks مبتسم
رداً على Howard Miller

Re: xmldb index name munging

بواسطة - Dan Poltawski

I suppose its this part which is difficult and looks like we need to do it to fit into the character limits on various dbs:

columnames_abbreviated will be an abbreviated representation of the columns used by the object (index, key, sequence) generated by the concatenation of the first 3 chars of each field. For example, one index over the "name, level, context" fields be converted to the "namlevcon" abbreviation.

[...]

If any of the calculated names excess the infamous 30cc. the name will be reduced by removing characters from the "columnames_abbreviated" part until if fits completely.