On Sun, 2 Dec 2012, Reinier Olislagers wrote:
With this code: procedure SortBufDataSet(DataSet: TBufDataSet; const FieldName: string); var Index_Name: string; begin Index_Name := FieldName + '__IdxA'; if (DataSet.IndexDefs.Find(Index_Name)<>Nil) then ... the last line throws an exception if the index does not exist; corresponding db.pas code: function TIndexDefs.Find(const IndexName: string): TIndexDef; begin Result := (inherited Find(IndexName)) as TIndexDef; if (Result=Nil) Then DatabaseErrorFmt(SIndexNotFound, [IndexName], FDataSet); end; However, the documentation states: Find...returns Nil if no matching index definition was found. Not a Delphi guy - should the implementation or the documentation be fixed?
I'll have a look tomorrow. Normally, the (unwritten) convention is that 'Find' returns nil. 'Get' raises an exception.
Michael. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal