Rapid Database Application Development
|
||
Development |
"Microsoft Access for Linux"
|
|
Extended Table Schema Informationstarted: april 2006, jstaniek
IntroductionFrom time to time we want to add some properties for table schema. We want to avoid extending kexi_ _fields or kexi_ _objects schemas, so instead, for each table, one optional entry has been added within kexi__objectdata table, under {TABLE_ID} id and "extended_schema" subid: INSERT INTO kexi__objectdata o_id, o_data, o_sub_id ({TABLE_ID}, {DATA}, "extended_schema"); {DATA} is an UTF-8-encoded string contining well defined XML like this: <!DOCTYPE EXTENDED_TABLE_SCHEMA> <EXTENDED_TABLE_SCHEMA version="1"> <field name="..."> <property name="visibleDecimalPlaces"> <number>4</number> </property> [..more properties and other elements..] </field> [..] </EXTENDED_TABLE_SCHEMA> The EXTENDED_TABLE_SCHEMA element defines version, that can be used for extensibility. ^ tocOther subelements of the "field" tag
Notes
Connection::storeDataBlock( tableSchema->id(), qdomDocument.toString(1), "extended_schema" )
Connection::loadDataBlock( tableSchema->id(), string, "extended_schema" )
Connection::removeDataBlock( tableSchema->id(), "extended_schema")
select kexi_ _objects.o_id, o_name, o_data from kexi_ _objects, kexi_ _objectdata where kexi_ _objectdata.o_sub_id=="extended_schema" and kexi_ _objects.o_id=kexi_ _objectdata.o_id;^ toc TODOsTODO: In particular, to acheive upward and backward compatibility, future versions of KexiDB can seek for EXTENDED_TABLE_SCHEMA element of a newest possible version and save the information two or more times within EXTENDED_TABLE_SCHEMA element with different version, e.g. if currently the newest ver is 3: <EXTENDED_TABLE_SCHEMA version="1"> ...information compatible with format v>=1... </EXTENDED_TABLE_SCHEMA> <EXTENDED_TABLE_SCHEMA version="2"> ...information compatible with format v>=2... </EXTENDED_TABLE_SCHEMA> <EXTENDED_TABLE_SCHEMA version="3"> ...information compatible with the most current format... </EXTENDED_TABLE_SCHEMA> Thus, even if sematic has been changed in version i, chances are we can save and load it for all versions of the KexiDB. Versions <i can just ignore <EXTENDED_TABLE_SCHEMA version="i">. |
|||||
|