Mujkoni 3 Posted November 1, 2018 (edited) SQL to Delphi code Download Default option is CommandText, but you can change it. There is also option SQL.Add Edited November 1, 2018 by Mujkoni 3 Share this post Link to post
Kryvich 165 Posted November 1, 2018 I think 5 function calls or 5 assigments is not the best code style. Consider these variants: SQL.Add('SELECT EntCity, EntStageName' + sLineBreak + 'FROM Entertainers' + sLineBreak + 'WHERE 1=1' + sLineBreak + 'AND TEST=''TEST''' + sLineBreak + 'ORDER BY EntCity ASC, EntStageName ASC'); CommandText := 'SELECT EntCity, EntStageName' + sLineBreak + 'FROM Entertainers' + sLineBreak + 'WHERE 1=1' + sLineBreak + 'AND TEST=''TEST''' + sLineBreak + 'ORDER BY EntCity ASC, EntStageName ASC'; Optionally replace line breaks with spaces: SQL.Add('SELECT EntCity, EntStageName ' + 'FROM Entertainers ' + 'WHERE 1=1 ' + 'AND TEST=''TEST'' ' + 'ORDER BY EntCity ASC, EntStageName ASC'); 5 Share this post Link to post
Uwe Raabe 2057 Posted November 1, 2018 Recent Delphi versions also allow something like this: SQL.AddStrings([ 'FROM Entertainers', 'WHERE 1=1', 'AND TEST=''TEST''', 'ORDER BY EntCity ASC, EntStageName ASC' ]); 3 Share this post Link to post
Alexander Elagin 143 Posted November 1, 2018 SQL.Add (or AddStrings) does not clear the previous content of the SQL text possibly producing the incorrect result. Either explicitly clear the list with SQL.Clear before adding new lines or simply use the Text property: SQL.Text := .... 1 Share this post Link to post
Kryvich 165 Posted November 1, 2018 BTW Delphi IDE has MultiPaste feature, which can paste lines adding a prefix and a suffix, and escaping quotes. https://www.youtube.com/watch?v=ca8itZ9xXnA (Don't know how to insert Youtube video). 1 Share this post Link to post
Tommi Prami 130 Posted November 2, 2018 Pretty handy, also if it could remove the Delphi formattings so I could easily take SQL and paste it then to SQL tool to tinker with... Share this post Link to post
Edwin Yip 154 Posted November 7, 2018 Try GExperts -> Editor Experts -> Paste String As. This is a gem from GExperts. Furthermore - you have 'Copy Raw Strings' which does the opposite. 3 Share this post Link to post
CoMPi74 3 Posted July 7, 2023 On 11/7/2018 at 1:30 PM, Edwin Yip said: Try GExperts -> Editor Experts -> Paste String As. This is a gem from GExperts. Furthermore - you have 'Copy Raw Strings' which does the opposite. Is it possible to modify the templates? Or are they hardcoded? I mean I would like to paste my strings as '%s +', so without 'sLineBreak +' and similar. Share this post Link to post
dummzeuch 1505 Posted July 7, 2023 2 hours ago, CoMPi74 said: Is it possible to modify the templates? Or are they hardcoded? I mean I would like to paste my strings as '%s +', so without 'sLineBreak +' and similar. There is the "Convert Strings", editor expert which allows for more complex conversions. 1 Share this post Link to post
CoMPi74 3 Posted July 10, 2023 On 7/7/2023 at 6:01 PM, dummzeuch said: There is the "Convert Strings", editor expert which allows for more complex conversions. @dummzeuch That is exactly what I need :) Thank you Share this post Link to post
Alberto Paganini 3 Posted January 27 (edited) Hello, Isn't the download still available ? Is there an alternative link ? Many thanks Alberto Edited January 27 by Alberto Paganini Share this post Link to post