int tsmAddDataSetToDatabase ( TsmDatabase *database, TsmDataSet *dataset ) Add a dataset to a database
Add a dataset to a database.This function will add the contents of a TsmDataSet structure to the specified TsmDatabase. The dataset can contain multiple instances and all of these will be added as necessary. Only data that is not already in the dataset will be added.
This routine will first check to see if an entry already exists for the dataset in the database (i.e. if an entry with the same name field exists in the database). If the dataset does not already exist, then a new entry will be created and all of the fields copied over (strings are strdup'd). If the dataset does exist in the database already, then checks are made that all of the fields are the same (e.g. type, min/max resolution, etc.).
Once a dataset entry has been found or created, the routine will see if it needs to add any instances to this dataset. An instance is deemed to be unique by its URL and formats are the same, and if its server list is the same if the URL is for a DPSS set. If no instance already exists in the database, then one will be added.
If a DPSS instance of the dataset in the database is the same as the instance to be added, except that the set ID differs, then the set id will updated in the database with the new set ID.