You've already forked lazarus-ccr
RxFPC: new funtion in DBUtils - FieldValueToStrings
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4323 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -126,6 +126,7 @@ procedure CheckRequiredFields(const Fields: array of TField);
|
||||
function ExtractFieldName(const Fields: string; var Pos: Integer): string;
|
||||
procedure FillValueForField(const Field: TField; Value:Variant);
|
||||
procedure CloneRecord(DataSet: TDataSet; IgnoreFields: array of const);
|
||||
function FieldValueToStrings(const DataSet: TDataSet; const FieldName: string; List:TStrings = nil):TStrings;
|
||||
|
||||
{ SQL expressions }
|
||||
|
||||
@ -1040,4 +1041,35 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function FieldValueToStrings(const DataSet: TDataSet; const FieldName: string;
|
||||
List: TStrings): TStrings;
|
||||
var
|
||||
Field: TField;
|
||||
P: TBookMark;
|
||||
begin
|
||||
Result:=List;
|
||||
if not Assigned(Result) then
|
||||
Result:=TStringList.Create;
|
||||
if not Assigned(DataSet) then exit;
|
||||
Field:=DataSet.FindField(FieldName);
|
||||
if not Assigned(Field) then exit;
|
||||
|
||||
DataSet.DisableControls;
|
||||
Result.BeginUpdate;
|
||||
P:=DataSet.Bookmark;
|
||||
try
|
||||
DataSet.First;
|
||||
while not DataSet.EOF do
|
||||
begin
|
||||
if Result.IndexOf(Field.AsString) < 0 then
|
||||
Result.Add(Field.AsString);
|
||||
DataSet.Next;
|
||||
end;
|
||||
finally
|
||||
DataSet.Bookmark:=P;
|
||||
Result.EndUpdate;
|
||||
DataSet.EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -3847,7 +3847,7 @@ end;
|
||||
|
||||
procedure TRxDBGrid.SetDBHandlers(Value: boolean);
|
||||
begin
|
||||
if Value then
|
||||
if Value then
|
||||
begin
|
||||
if DataSource.DataSet.OnFilterRecord <> @FilterRec then
|
||||
begin
|
||||
|
Reference in New Issue
Block a user