procedure TDBTreeView.UpdateSQL;
begin
if DataSet is TSQLQuery then begin
if fSQLWherePosition = -1 then
Raise Exception.Create('No where clause detected.');
TSQLQuery.SQLConnection.GetConnectionInfo();
{$if declared( TIBCONNECTION)}
if not assigned(FExpandNode) and assigned(FUpdateNode) then begin {Scrolling dataset}
TSQLQuery( DataSet ).SQL[ fSQLWherePosition ] := 'where '+GetRelationNameQualifier+'"' + FKeyField + '" = :KEY_VALUE AND ';
//Parser.Add2WhereClause(GetRelationNameQualifier + '"' + FKeyField + '" = :IBX_KEY_VALUE')
end
else
if (Items.Count = 0) then begin
{Need to Load Root Nodes}
TSQLQuery( DataSet ).SQL[ fSQLWherePosition ] := 'where '+GetRelationNameQualifier+'"' + FParentField + '" is null AND ';
//Parser.Add2WhereClause(GetRelationNameQualifier + '"' + FParentField + '" is null')
end
else
if assigned(FExpandNode) then
begin
TSQLQuery( DataSet ).SQL[ fSQLWherePosition ] := 'where ( '+GetRelationNameQualifier+'"' + FParentField + '" = :PARENT_VALUE OR '+GetRelationNameQualifier+'"' + FKeyField + '" = :PARENT_VALUE ) AND '
//Parser.Add2WhereClause(GetRelationNameQualifier + '"' + FParentField + '" = :IBX_PARENT_VALUE');
//Parser.Add2WhereClause(GetRelationNameQualifier + '"' + FKeyField + '" = :IBX_PARENT_VALUE',true);
end;
{$ENDIF}
{$if declared( TMYSQL57Connection) }
if not assigned(FExpandNode) and assigned(FUpdateNode) then begin {Scrolling dataset}
TSQLQuery( DataSet ).SQL[ fSQLWherePosition ] := 'where '+GetRelationNameQualifier+ FKeyField + ' = :KEY_VALUE AND ';
//Parser.Add2WhereClause(GetRelationNameQualifier + '"' + FKeyField + '" = :IBX_KEY_VALUE')
end
else
if (Items.Count = 0) then begin
{Need to Load Root Nodes}
TSQLQuery( DataSet ).SQL[ fSQLWherePosition ] := 'where '+GetRelationNameQualifier+ FParentField + ' is null AND ';
//Parser.Add2WhereClause(GetRelationNameQualifier + '"' + FParentField + '" is null')
end
else
if assigned(FExpandNode) then
begin
TSQLQuery( DataSet ).SQL[ fSQLWherePosition ] := 'where ( '+GetRelationNameQualifier+ FParentField + ' = :PARENT_VALUE OR '+GetRelationNameQualifier + FKeyField + ' = :PARENT_VALUE ) AND '
//Parser.Add2WhereClause(GetRelationNameQualifier + '"' + FParentField + '" = :IBX_PARENT_VALUE');
//Parser.Add2WhereClause(GetRelationNameQualifier + '"' + FKeyField + '" = :IBX_PARENT_VALUE',true);
end;
{$ENDIF}