Closed vopalev closed 3 years ago
Hi.
The formatted string is a valid SQL.
If you want to make formatted queries into single line, replace \n
or \r
by
, instead of remove them.
Wow :) That's right! But I chose a little other solution. Many thanks!
We have: ALTER TABLE public.Orders ADD CONSTRAINT "fk_Orders_ref_Customers" FOREIGN KEY (customer_id) REFERENCES public.Customers (id)
After standart SqlFormatter.format(sqlScript, FormatConfig.builder().build()): ALTER TABLE public.Orders ADD CONSTRAINT "fk_Orders_ref_Customers" FOREIGN KEY (customer_id) REFERENCES public.Customers (id)
Between public.Orders and ADD elements only row delimiter, without any spaces. And after replace all \n or \r we get invalid script: ALTER TABLE public.OrdersADD CONSTRAINT