Porting the AdaptiveDB code over to MoM
Posted by mholmes on 05 Feb 2010 in Activity log
Today was the first test of the new AdaptiveDB code rewrites and new features on a serious scale, on the MoM db. Greg and I ported it over by writing a new local_classes.php file for the system. These are some notable issues, all solved:
- I had forgotten that I'd created a special lat-long field for storing coordinates, for the MoM project. We had to port that field definition back into the main codebase.
- That field wasn't quite functioning right, because when an empty string was returned to the db for storage, a zero was written. Obviously zero is a real coordinate, which is not the same as no coordinate at all. So I've rewritten the
saveToDb()
code inMdhRecord
to take account of that. - We discovered that when an integer field is used as a filter, a zero is written to the filter input automatically because zero was being set as the default value for the field, causing a filter value to be created on the page without the user's intervention. Because integer fields CAN be legitimately zero, we can't of course treat this as a special case, so I had to depend on the typing looseness of PHP to set the initial value of the field to an empty string, which solves the problem.
- Various other minor tweaks.
The idea of presenting data from a link table as if it were "part of" two different parent tables works really well; you just have to remember to get the field name parameters right (which is pretty hard -- I'm going to have to do some proper documentation here, once it all shakes down).