TdaSQL.sqltext hangs
if the query is tiring, TdaSQL.SQLTExt hangs. when I look in the RB source I
saw the fallowing code. Why do you open the query to get fields defs insted
of using
TQuery.FieldDefs.
procedure TdaBDEDataSet.GetFieldsForSQL(aList: TList; aSQL: TStrings);
var
lQuery: TQuery;
lBDEField: TField;
lField: TppField;
liIndex: Integer;
begin
aList.Clear;
lQuery := TQuery.Create(Self);
try
lQuery.DatabaseName :=
daGetBDEDatabaseForName(DatabaseName).DatabaseName;
lQuery.SessionName :=
daGetBDESessionForDatabase(DatabaseName).SessionName;
lQuery.SQL := aSQL;
lQuery.Active := True;
for liIndex := 0 to lQuery.FieldCount - 1 do
begin
lBDEField := lQuery.Fields[liIndex];
lField := TppField.Create(nil);
lField.FieldName := lBDEField.FieldName;
lField.FieldAlias := lBDEField.DisplayLabel;
lField.FieldLength := lBDEField.Size;
lField.DataType := ppConvertFieldType(lBDEField.DataType);
lField.DisplayWidth := lBDEField.DisplayWidth;
aList.Add(lField);
end;
finally
lQuery.Free;
end;
end; {procedure, GetFieldsForSQL}
saw the fallowing code. Why do you open the query to get fields defs insted
of using
TQuery.FieldDefs.
procedure TdaBDEDataSet.GetFieldsForSQL(aList: TList; aSQL: TStrings);
var
lQuery: TQuery;
lBDEField: TField;
lField: TppField;
liIndex: Integer;
begin
aList.Clear;
lQuery := TQuery.Create(Self);
try
lQuery.DatabaseName :=
daGetBDEDatabaseForName(DatabaseName).DatabaseName;
lQuery.SessionName :=
daGetBDESessionForDatabase(DatabaseName).SessionName;
lQuery.SQL := aSQL;
lQuery.Active := True;
for liIndex := 0 to lQuery.FieldCount - 1 do
begin
lBDEField := lQuery.Fields[liIndex];
lField := TppField.Create(nil);
lField.FieldName := lBDEField.FieldName;
lField.FieldAlias := lBDEField.DisplayLabel;
lField.FieldLength := lBDEField.Size;
lField.DataType := ppConvertFieldType(lBDEField.DataType);
lField.DisplayWidth := lBDEField.DisplayWidth;
aList.Add(lField);
end;
finally
lQuery.Free;
end;
end; {procedure, GetFieldsForSQL}
This discussion has been closed.
Comments
directly or are you using the query tools? Can you reproduce the "hanging"
on the DBDEMOS database? If so can you provide us with an example so that we
can investigate the problem? Please send it to support@digital-metaphors.com
RB opens the query because in testing it appeared that the FieldDefs were
always empty unless the query was opened.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
we generally change the where clause of the report sql.
some queries takes long time to open without necessary criteria added to
where section of the sql.
When you use Fielddefs.Update, it will be filled.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com