On Thu, Aug 21, 2008 at 6:13 PM, Brion Vibber brion@wikimedia.org wrote:
Now, most of the time we explicitly use 1 and 0 when storing boolean values in MediaWiki, like:
'page_is_new' => ($lastRevision === 0) ? 1 : 0, 'page_is_redirect' => $rt !== NULL ? 1 : 0,
But it'd be nice not to break if people forget and use a genuine bool... for that matter it'd be nice to be able to do that as a matter of course. ;)
Would it make sense for the database abstraction layer to know our schema, so that it can automatically cast things to bool (or whatever is necessary) before handing them down to the actual database? If we wanted to get hardcore it could also do stuff like handle truncation for limited-length fields, but that's scarier (e.g. if someone manually alters their schema to lengthen a field, they'd have to tell MediaWiki about it).
Of course, if the abstraction layer doesn't know about a field it could fall back to current ignorant behavior.