I would like to propose an enhancement that builds on the existing Convert to String functionality under CnPack Editor Menu → Others. The idea is to offer a similar conversion tool, but with additional options—either as a separate menu "SQL Conversion" submenu entry or as an enhancement to the current functionality.
Proposed Enhancements:
-
Bi-directional Conversion
-
Raw SQL to Delphi String:
Convert a standard SQL query into Delphi string literals.
Example:
SELECT
o.order_id,
o.total
FROM
orders o
WHERE
o.order_id = 200
converts into:
'SELECT' + #13#10 +
' o.order_id,' + #13#10 +
' o.total' + #13#10 +
'FROM' + #13#10 +
' orders o' + #13#10 +
'WHERE' + #13#10 +
' o.order_id = 200'
-
Delphi String to Raw SQL:
Allow conversion in the reverse direction—from Delphi string formatted SQL back to a standard raw SQL query—to facilitate easy copying and execution in an SQL manager.
-
Aligned Concatenation Operator
-
Vertical Alignment Option:
Introduce an option to pad the string literals so that the concatenation operator (+ #13#10 +) aligns vertically. This would improve readability and maintain the original indentation of the SQL query.
Example:
'SELECT ' + #13#10 +
' o.order_id, ' + #13#10 +
' o.total ' + #13#10 +
'FROM ' + #13#10 +
' orders o ' + #13#10 +
'WHERE ' + #13#10 +
' o.order_id = 200'
-
Configuration Option for Padding:
Allow users to choose whether to enable the alignment option and to configure the number of spaces applied after the longest line.
-
Enhanced or Separate Menu Option
- Separate Menu Entry or Enhanced Options:
I propose that this enhanced conversion functionality be either offered in a separate menu (for example, an "SQL Conversion" submenu) or by enhancing the current Convert to String option with additional configurable settings. This would let users toggle between different conversion modes without cluttering the existing tool.
-
Additional Ideas
-
SQL Formatting Options:
In addition to conversion, it could be beneficial to provide formatting settings (e.g., preserving original indentation, automatic case conversion for SQL keywords, etc.).
-
Integrated Workflow:
Enable a seamless workflow where developers can quickly switch between raw SQL and Delphi string formats with a single command, reducing manual editing steps.
I believe these enhancements would significantly improve the SQL conversion tool’s flexibility and usability. I'm looking forward to feedback from the maintainers on whether to implement this as a separate feature or as an extension of the current functionality, and any other suggestions are welcome.
I would like to propose an enhancement that builds on the existing Convert to String functionality under CnPack Editor Menu → Others. The idea is to offer a similar conversion tool, but with additional options—either as a separate menu "SQL Conversion" submenu entry or as an enhancement to the current functionality.
Proposed Enhancements:
Bi-directional Conversion
Raw SQL to Delphi String:
Convert a standard SQL query into Delphi string literals.
Example:
converts into:
Delphi String to Raw SQL:
Allow conversion in the reverse direction—from Delphi string formatted SQL back to a standard raw SQL query—to facilitate easy copying and execution in an SQL manager.
Aligned Concatenation Operator
Vertical Alignment Option:
Introduce an option to pad the string literals so that the concatenation operator (
+ #13#10 +) aligns vertically. This would improve readability and maintain the original indentation of the SQL query.Example:
Configuration Option for Padding:
Allow users to choose whether to enable the alignment option and to configure the number of spaces applied after the longest line.
Enhanced or Separate Menu Option
I propose that this enhanced conversion functionality be either offered in a separate menu (for example, an "SQL Conversion" submenu) or by enhancing the current Convert to String option with additional configurable settings. This would let users toggle between different conversion modes without cluttering the existing tool.
Additional Ideas
SQL Formatting Options:
In addition to conversion, it could be beneficial to provide formatting settings (e.g., preserving original indentation, automatic case conversion for SQL keywords, etc.).
Integrated Workflow:
Enable a seamless workflow where developers can quickly switch between raw SQL and Delphi string formats with a single command, reducing manual editing steps.
I believe these enhancements would significantly improve the SQL conversion tool’s flexibility and usability. I'm looking forward to feedback from the maintainers on whether to implement this as a separate feature or as an extension of the current functionality, and any other suggestions are welcome.