Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

TdaSQL.sqltext hangs

edited May 2002 in General
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}

Comments

  • edited May 2002
    Can you describe the query you are making? Are you editing the SQLText
    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

  • edited June 2002
    Some times we need to edit the query, set the sql text from code.
    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.




  • edited June 2002
    Thanks, we'll have to try that.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.