Rapid Database Application Development
|
||
Development |
"Microsoft Access for Linux"
|
|
Rich Data Containersstarted: june 2006, jstaniek
IntroductionSince Kexi 1.6 we have BLOB data type supported. It's called "Object" in Kexi for simplicity. There is defined "subType" property for this data type, but for now it contains only one item: Image. In the future Kexi version there will be more subtypes like document (probably ODF), multimedia file (movie, sound), and user defined subtypes. From storage point of view, each additional subtype does not matter - the data is still a binary array. But each subtype requires it's own set of widgets, namely Table View cell editor, Form widget, and (in to future) Report widget. These widgets can be implemented as read-only or read/write. Below we'll mostly focus on the simplest and already implemented case: Image Object (subtype). ^ tocNeedsWhat we want to achieve is to keep backward compatibility. There is currently something we may want to address before 1.6 release:
The extenstions can be implemented by storing rich data within a single field of type "Object". We can refer to such field as to rich data container. About metadata: the minimal metadata includes:
By inserting files like images user provides filenames. These are lost unless we store them somewhere near the BLOB data. In fact we already store the metadata for any static image (the one that is put onto the form surface) in the kexi__blob "system" table. ^ tocUse CaseUser defined a table ''"persons (name Text, surname Text, photo Object) and entered some records. She prefers to save another image for a given person. She can redesign (normalize) the database and create additional child table containing images for persons. But having rich data containers available she doesn't need to. What she does:
Note: the widget supporting multiple images is more complicated compared to the original Image widget ^ tocIdeasIt's interesting that this feature, being planned for Kexi, is already somewhat implemented in MSA 2k7 co(see New Attachment Data Type section). There can be two methods to implement the functinality: METHOD1: save an xml string at the beginning of the BLOB data and then append data objects. The xml strong could contain sizes of the data objects and some metadata for them. The layout: size_of_xml_stingxml stringOBJECT_DATA1...OBJECT_DATAn Where size_of_xml_sting is and integer equal to the size of the xml string. Example xml string: <container> <object><mimetype>image/png</mimetype> <filename>moon.png</filename> </object> </container> Pros of this method:
Cons of this method:
METHOD2.1: A case when "allowMultipleObjects" property is false for the field. Upon defining the field as supporting multiple objects, create the following fields instead of a single BLOB:
Within Kexi GUI, the field will be still visible as single item. METHOD2.2: A case when "allowMultipleObjects" property is true for the field. Upon defining the field as supporting multiple objects, instead of a single BLOB, create a separate table containing the following fields:
Within Kexi GUI, the field will be still visible as single item. In fact, METHOD2.2 is what MSA utilizes. Pros of this method:
Cons of this method:
Proposed verdict: Methods 2.1 and 2.2 are better. RFC |
|||||
|