Skip to content

XML Blob Streaming ​

By default InstantObjects stores the attributes of type Part, Parts and References in a binary blob field of the table of the class. With the property BlobStreamFormat you can store them in memo fields in XML format instead.

Without this feature you cannot change the values of those fields without an InstantObjects application. With the XML format you can maintain those fields manually or with an external tool, and you can read them with any SQL tool.

TIP

XML blobs are one of the ways to avoid the blobs of the parts: the other one is external storage, which maps Parts and References to tables of their own.

The property BlobStreamFormat ​

BlobStreamFormat has the type TInstantStreamFormat and can be:

ValueMeaning
sfBinaryBinary blob (the default)
sfXMLXML text in a memo field

The property is available on:

ComponentVisibilityPurpose
TInstantConnectorpublishedManages the format during the connection (visible in the Object Inspector).
TInstantConnectionDefpublishedSaves the format in the connection file managed by the Connection Manager, which shows it in its form.
TInstantSchemepublicWhen the database is built it is important to know whether the fields are blobs or memos, because some databases use different kinds of fields for binary and for textual values.

Use the same format whenever you connect to an existing database, and build the database with the format you chose. To change the format of an existing database use TInstantPump: create a new empty database, set the source connector to sfBinary and the destination connector to sfXML, and pump.

The XML brokers always use the XML format.

Notes for the authors of brokers ​

To support BlobStreamFormat correctly in a broker:

1. The connection definition form (InstantXXXConnectionDef)

Add a combo box and a label for the format:

pascal
object StreamFormatComboBox: TComboBox
  Style = csDropDownList
end
object StreamFormatLabel: TLabel
  Caption = 'Blob &format'
  FocusControl = StreamFormatComboBox
end

Initialize the combo box when the form is created:

pascal
AssignInstantStreamFormat(StreamFormatComboBox.Items);

and in the methods that load and save the data of the form:

pascal
// LoadData
StreamFormatComboBox.ItemIndex := Ord(ConnectionDef.BlobStreamFormat);
// SaveData
ConnectionDef.BlobStreamFormat := TInstantStreamFormat(StreamFormatComboBox.ItemIndex);

2. The broker unit (InstantXXX.pas)

In InternalBuildDatabase pass the format to the scheme:

pascal
Scheme.BlobStreamFormat := BlobStreamFormat;

If a connector is maintained internally by a connection definition, it is initialized by the definition in TInstantConnectionDef.InitConnector.


Originally written by Carlo Barazzetta, 2004.

Released under Mozilla License, Version 2.0.