Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop SQL splitting string literals when I press Enter in DataGrip or IntelliJ Database Editor?

When my cursor is after an open quote in a SQL statement in an IntelliJ database console and I press Enter, it closes the quote on the current line and adds a concatenation symbol with an open quote on the newline.

I disabled formatting the SQL code style settings but that didn't fix it for me.

UPDATE blah SET blah2 = 'something<pressed enter>' ||
  '<argh!>...';

Is there a way to disable this autoformatting?

like image 635
khoomeister Avatar asked Mar 17 '17 17:03

khoomeister


People also ask

Does IntelliJ have DataGrip?

 It is the same. DataGrip and the Database plugin for IntelliJ IDEA have the same functionality.

What is IntelliJ DataGrip?

DataGrip is a database management environment for developers. It is designed to query, create, and manage databases. Databases can work locally, on a server, or in the cloud.

How do you code in DataGrip?

In the editor, press Ctrl+Shift+Enter or from the main menu select Code | Complete Current Statement. DataGrip inserts the required trailing comma automatically in structs, slices, and other composite literals. The caret is moved to the position where you can start typing the next statement.


2 Answers

This request was addressed in 2017.1 version, as a result, Insert string concatenation on Enter setting was added specifically for SQL: Insert string concatenation on Enter

like image 128
CrazyCoder Avatar answered Sep 27 '22 18:09

CrazyCoder


This can be archived since IntelliJ 13. You simply need to wrap your code with

// @formatter:off

your code goes here

// @formatter:on 

Since IntelliJ Idea 15-16(pardon if i'm wrong), you can also make permanent set up by Preferences > Editor > Code Style option

Hope it helps

like image 31
Malakai Avatar answered Sep 27 '22 17:09

Malakai