Updating typed datasets
This Lesson shows how to accomplish something in-between Sql Connection and Sql Data Reader interaction by using the Data Set and Sql Data Adapter objects.
A Data Set is an in-memory data store that can hold numerous tables.
Storing additional metadata for a dataset beyond the default metadata in CKAN is a common use case.
CKAN provides a simple way to do this by allowing you to store arbitrary key/value pairs against a dataset when creating or updating the dataset.
By using CKAN’s IDataset Form plugin interface, a CKAN plugin can add custom, first-class metadata fields to CKAN datasets, and can do custom validation of these fields.
For each parameter, the schema will contain a corresponding list of functions that will be run against the value of the parameter.
The available data types are listed in section Data Types. Adding an item will fail when there already is an item with the same id. Data Set(); // subscribe to any change in the Data Set data.on('*', function (event, properties, sender Id) ); // add an item data.add(); // triggers an 'add' event data.update(); // triggers an 'update' event data.remove(1); // triggers an 'remove' event is provided, this id will be passed with the triggered event to all subscribers.
The function returns an array with the ids of the added items. The method will throw an Error when an item with the same id as any of the added items already exists. Syntax: The method ignores removal of non-existing items, and returns an array containing the ids of the items which are actually removed from the Data Set.
When data is fetched from a server which uses some specific field to identify items, this field name can be specified in the Data Set using the option An object containing field names as key, and data types as value.
By default, the type of the properties of items are left unchanged.