Hi list, Possible newbie question so feel free to educate me ;) (Away for some days, so may not read response until back)
A patch by Ludo Brands on bufdataset (mantis 19930) got me thinking: const ftSupported = [ftString,ftGuid,... and so on]; procedure TCustomBufDataset.CreateDataset; var i:integer; begin ... // check if all types are supported For i:=0 to FieldDefs.Count-1 do if not (Fielddefs.items[i].DataType in ftSupported) then DatabaseErrorFmt(SUnsupportedFieldType,[Fieldtypenames[Fielddefs.items[i].DataType]]); CreateFields; end; Suppose I want to write a dataset data copier or importer/exporter, how do I detect supported datatypes in a dataset? For example, in my dbfexport test code, I make a bufdataset with all possible fields, then strip each field away when strange errors/AVs occur when assigning values to them. For other datasets (with similar checks as proposed in Ludo's patch), the runtime library is nice enough to warn me on field creation that it doesn't work. Am I missing something obvious or does it make sense to expose something like a SupportedFieldTypes property for datasets? How does Delphi do this? Besides that, I think it's an excellent idea to check for invalid datatypes when creating fields, rather than failing later on when assigning values to them. (Of course, if that is implemented in a lot of datasets, checking exceptions when creating fields would be a rough way of checking if a datatype is supported ;) I understand that 3rd party inherited datasets may not abide by this, but it's worth a shot to offer the functionality.. Thanks, Reinier _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal