I would like to know how to arrange the code on view creation.

ejin's profile image ejin posted 2 years ago in General Permalink

The view is created like an attached file image. (view_create.gif)

To modify a view, select the view in HeidiSQL and enter Edit, it is difficult to see because it only comes out on one line like an attached file. (view_modify.gif)

Can't you check the code in a well-organized state to make it easier to see when editing an existing view?

Every time I modify the view query, I have a hard time.

2 attachment(s):
  • view_create
  • view_modify
ansgar's profile image ansgar posted 2 years ago Permalink

You can try Query > "Reformat SQL" to make it more readable again. But that won't bring up the original indentation, which is lost as soon as the server saves the view definition.

There's also a button for that reformat action:

Description

ejin's profile image ejin posted 2 years ago Permalink

Hello. ansgar.

Thank you for answer.

I know the sorting method, but unlike the code when the view was first created, it is more difficult to see because it contains unnecessary ['] and the database name.

Except for these codes, is there any way to make the view code appear as it is when the view code was first created?

When the procedure and trigger are created, the code appears as it is, so it is easy to see, but when only the view is created, the initial code does not appear as it is. Is there any other way?

You can try Query > "Reformat SQL" to make it more readable again. But that won't bring up the original indentation, which is lost as soon as the server saves the view definition.

There's also a button for that reformat action:

Description

1 attachment(s):
  • view_er
ansgar's profile image ansgar posted 2 years ago Permalink

Yes I know what you mean. Unfortunately the server converts your code in that way, for some reason. HeidiSQL then tries to load that original code but that fails in many cases:

SELECT CAST(LOAD_FILE(
   CONCAT(
     IFNULL(@@GLOBAL.datadir, CONCAT(@@GLOBAL.basedir, 'data/')),
     'dshop/view_talk_sms_send_list.frm'
   )) AS CHAR CHARACTER SET utf8);

You can try that query in a query tab to see if that returns something. If not, then HeidiSQL will fail as well, and loads the view with such a query:

SHOW CREATE VIEW `dshop`.`view_talk_sms_send_list`;
ejin's profile image ejin posted 2 years ago Permalink

Hello ansgar. Thank you for your response.

The view is still not organized nicely. It seems to be a weakness of HeidiSQL. ㅠㅠ

thank you for your attention. :)

Yes I know what you mean. Unfortunately the server converts your code in that way, for some reason. HeidiSQL then tries to load that original code but that fails in many cases:

SELECT CAST(LOAD_FILE(
   CONCAT(
     IFNULL(@@GLOBAL.datadir, CONCAT(@@GLOBAL.basedir, 'data/')),
     'dshop/view_talk_sms_send_list.frm'
   )) AS CHAR CHARACTER SET utf8);

You can try that query in a query tab to see if that returns something. If not, then HeidiSQL will fail as well, and loads the view with such a query:

SHOW CREATE VIEW `dshop`.`view_talk_sms_send_list`;
feelie75's profile image feelie75 posted 2 years ago Permalink

fwiw, MS SQL server does save your views exactly as created and MS SSMS will pull them back up exactly as created, which is very helpful indeed.

ejin's profile image ejin posted 2 years ago Permalink

Hello. feelie75. Thanks for the reply.

I didn't know much about MS SSMS, so I checked it out and it was very helpful. It's not solved, but I've learned something new :)

thank you :)

fwiw, MS SQL server does save your views exactly as created and MS SSMS will pull them back up exactly as created, which is very helpful indeed.> fwiw, MS SQL server does save your views exactly as created and MS SSMS will pull them back up exactly as created, which is very helpful indeed.

ansgar's profile image ansgar posted 2 years ago Permalink

The view is still not organized nicely. It seems to be a weakness of HeidiSQL.

You obviously did not read the replies: the server converts your code in that way.

ejin's profile image ejin posted 2 years ago Permalink

Hello. ansgar

I checked the contents of the second reply with a translator.

There are limits to what you can understand. ㅠㅠ

When I translated it into Korean, I had some difficulties.

I will check your answer again.

Thank you for your response. :)

The view is still not organized nicely. It seems to be a weakness of HeidiSQL.

You obviously did not read the replies: the server converts your code in that way.

Please login to leave a reply, or register at first.