Domanda

In a lots of places from a big project the SQL statements were added as

table.SQL.Add(' '
      + ' select tableA.Field1, '
      + ' tableA.Field2 Field2, '      
      + ' tableA.Field3, '
      + ' tableA.Field1 '
      + ' from tableA_!Version tableA left outer join tableB_00 tableB '
      + ' on tableB.Field1ID = :ID '
      + ' and          tableB.Nr = :Nr '
      + ' and tableA.Field12 = tableB.InhaltNummer '
      + ' where tableA.Field233 = 1 '
      + ' order by tableA.Field1 '
);

And I want to select this block of code and change it to be like

with     table.SQL do
 begin    
          Add('select tableA.Field1,');
          Add('tableA.Field2 Field2,');      
          Add('tableA.Field3,');
          Add('tableA.Field1');
          Add('from tableA_!Version tableA left outer join tableB_00 tableB');
          Add('on tableB.Field1ID = :ID');
          Add('and          tableB.Nr = :Nr');
          Add('and tableA.Field12 = tableB.InhaltNummer');
          Add('where tableA.Field233 = 1');
          Add('order by tableA.Field1');
end;          

because later the SQL statement is changed by using direct line number e.g

table.SQL.Lines[5] := 'something'

I was looking at Delphi's refactoring menu, GExpert or CNPack features but did not find something useful.Is there any feature which can help me?

È stato utile?

Soluzione

Castalia for Delphi (full disclosure: I'm the creator) has two tools that will do this. Read about them here: http://delphiblog.twodesk.com/working-with-code-in-your-code-multipaste-and-smart-trim

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top