Hi !
It will be great to have in the query/view editor, each field on different line (like in MySQL workbench). Hi think is more visual friendly when you edit with a lot of fields.
Thanks for your great soft and works !!
;)
Query editor -- Each field in different line (more visual friendly)
We're talking about the VIEW editor, right? That VIEW body is a bit tricky to get from the original query, as the MySQL server rewrites the body when you save a VIEW. But Heidi already tries to load it from the .frm file on the server. Can you please paste here what you see in the SQL log at the bottom when you open the VIEW?
But in the view editor, I mean the "Field" section. Each field like this:
`tblservicescommande`.`idService` AS `idService`,
...is on a separate line like this:
`tblservicescommande`.`idService` AS `idService`,
`tblservicescommande`.`idService2` AS `idService2`,
`tblservicescommande`.`idService3` AS `idService3`,
`tblservicescommande`.`idService4` AS `idService4`,
`tblservicescommande`.`idService5` AS `idService5`,
etc...
Is more readable on each line than all on the same line like this:
`tblservicescommande`.`idService` AS `idService`,`tblservicescommande`.`idService2` AS `idService2`,`tblservicescommande`.`idService3` AS `idService3`,`tblservicescommande`.`idService4` AS `idService4`, etc...
Thank you very much and keep the good work ! ;)
`tblservicescommande`.`idService` AS `idService`,
...is on a separate line like this:
`tblservicescommande`.`idService` AS `idService`,
`tblservicescommande`.`idService2` AS `idService2`,
`tblservicescommande`.`idService3` AS `idService3`,
`tblservicescommande`.`idService4` AS `idService4`,
`tblservicescommande`.`idService5` AS `idService5`,
etc...
Is more readable on each line than all on the same line like this:
`tblservicescommande`.`idService` AS `idService`,`tblservicescommande`.`idService2` AS `idService2`,`tblservicescommande`.`idService3` AS `idService3`,`tblservicescommande`.`idService4` AS `idService4`, etc...
Thank you very much and keep the good work ! ;)
That's what I meant. The server modifies a VIEW body when you save it. Later checks for SHOW CREATE VIEW show the whole body in a one-liner. That's bad, but not really fixable by HeidiSQL. Though HeidiSQL already does its best to retrieve the originaly body, by issuing such a vicious query:
However, that returns an empty string in many cases, probably because of missing file privileges on the server.
Now, in HeidiSQL, you have the "Reformat SQL" feature (see the white main toolbar button with a pencil on it, 6th one counted from the right). Clicking that, or pressing its shortcut Ctrl+F8 brings the SQL in any editor in order again.
SELECT LOAD_FILE(CONCAT(IFNULL(@@GLOBAL.datadir, CONCAT(@@GLOBAL.basedir, 'data/')), 'dbname/viewname.frm'));
However, that returns an empty string in many cases, probably because of missing file privileges on the server.
Now, in HeidiSQL, you have the "Reformat SQL" feature (see the white main toolbar button with a pencil on it, 6th one counted from the right). Clicking that, or pressing its shortcut Ctrl+F8 brings the SQL in any editor in order again.
No news on this ?
I made other testing and effectively,if the server is on Windows the view keep the view body like you mention, but if it's a Linux server he doesn't.
I check the "FILE" privilege, I have all privillege, and even with root access. Not working...
But, like I said in my last post, I found that is probably
the ASCII New Line/line return code that is different in UNIX vs Windows who make the troubles...
Thanks and keep the good works !
I made other testing and effectively,if the server is on Windows the view keep the view body like you mention, but if it's a Linux server he doesn't.
I check the "FILE" privilege, I have all privillege, and even with root access. Not working...
But, like I said in my last post, I found that is probably
the ASCII New Line/line return code that is different in UNIX vs Windows who make the troubles...
Thanks and keep the good works !
Hi !
BODY from Windows MySQL:
------------------------
select
`tblservicescommande`.`idService` AS `idService`,
`tblservicescommande`.`isservice_ratache` AS `isservice_ratache`,
`tblservicescommande`.`noCommande` AS `noCommande`,
`tblservicescommande`.`duree_serv` AS `duree_serv`,
`tblitems_2_prix`.`competence` AS `competence`,
`tblitem`.`Nom` AS `Nom`,
if((`tblservicescommande`.`isservice_ratache` is not null),
`tblservicescommande`.`isservice_ratache`,
`tblservicescommande`.`idService`) AS `ID1`,
`tblservicescommande`.`nblogement` AS `nblog`
from
((`tblservicescommande`
left join `tblitems_2_prix` ON ((`tblservicescommande`.`idItem` = `tblitems_2_prix`.`idItem`)))
left join `tblitem` ON ((`tblservicescommande`.`idItem` = `tblitem`.`idItem`)))
where
((cast(`tblservicescommande`.`dateService` as date) >= now())
and ((`tblitems_2_prix`.`nbLogement` = `tblservicescommande`.`nblogement`)
or (`tblitems_2_prix`.`nbLogement` = 0)))
Body from Linux MySQL (One liner...):
----------------------
select `tblservicescommande`.`idService` AS `idService`,`tblservicescommande`.`isservice_ratache` AS `isservice_ratache`,`tblservicescommande`.`noCommande` AS `noCommande`,`tblservicescommande`.`duree_serv` AS `duree_serv`,`tblitems_2_prix`.`competence` AS `competence`,`tblitem`.`Nom` AS `Nom`,if((`tblservicescommande`.`isservice_ratache` is not null),`tblservicescommande`.`isservice_ratache`,`tblservicescommande`.`idService`) AS `ID1`,`tblservicescommande`.`nblogement` AS `nblog` from ((`tblservicescommande` left join `tblitems_2_prix` on((`tblservicescommande`.`idItem` = `tblitems_2_prix`.`idItem`))) left join `tblitem` on((`tblservicescommande`.`idItem` = `tblitem`.`idItem`))) where ((cast(`tblservicescommande`.`dateService` as date) >= now()) and ((`tblitems_2_prix`.`nbLogement` = `tblservicescommande`.`nblogement`) or (`tblitems_2_prix`.`nbLogement` = 0)))
Thanks !
BODY from Windows MySQL:
------------------------
select
`tblservicescommande`.`idService` AS `idService`,
`tblservicescommande`.`isservice_ratache` AS `isservice_ratache`,
`tblservicescommande`.`noCommande` AS `noCommande`,
`tblservicescommande`.`duree_serv` AS `duree_serv`,
`tblitems_2_prix`.`competence` AS `competence`,
`tblitem`.`Nom` AS `Nom`,
if((`tblservicescommande`.`isservice_ratache` is not null),
`tblservicescommande`.`isservice_ratache`,
`tblservicescommande`.`idService`) AS `ID1`,
`tblservicescommande`.`nblogement` AS `nblog`
from
((`tblservicescommande`
left join `tblitems_2_prix` ON ((`tblservicescommande`.`idItem` = `tblitems_2_prix`.`idItem`)))
left join `tblitem` ON ((`tblservicescommande`.`idItem` = `tblitem`.`idItem`)))
where
((cast(`tblservicescommande`.`dateService` as date) >= now())
and ((`tblitems_2_prix`.`nbLogement` = `tblservicescommande`.`nblogement`)
or (`tblitems_2_prix`.`nbLogement` = 0)))
Body from Linux MySQL (One liner...):
----------------------
select `tblservicescommande`.`idService` AS `idService`,`tblservicescommande`.`isservice_ratache` AS `isservice_ratache`,`tblservicescommande`.`noCommande` AS `noCommande`,`tblservicescommande`.`duree_serv` AS `duree_serv`,`tblitems_2_prix`.`competence` AS `competence`,`tblitem`.`Nom` AS `Nom`,if((`tblservicescommande`.`isservice_ratache` is not null),`tblservicescommande`.`isservice_ratache`,`tblservicescommande`.`idService`) AS `ID1`,`tblservicescommande`.`nblogement` AS `nblog` from ((`tblservicescommande` left join `tblitems_2_prix` on((`tblservicescommande`.`idItem` = `tblitems_2_prix`.`idItem`))) left join `tblitem` on((`tblservicescommande`.`idItem` = `tblitem`.`idItem`))) where ((cast(`tblservicescommande`.`dateService` as date) >= now()) and ((`tblitems_2_prix`.`nbLogement` = `tblservicescommande`.`nblogement`) or (`tblitems_2_prix`.`nbLogement` = 0)))
Thanks !
From the SQL LOG after selecting view (Linux MySQL):
SELECT LOAD_FILE(CONCAT(IFNULL(@@GLOBAL.datadir, CONCAT(@@GLOBAL.basedir, 'data/')), 'bdtic/vue_competences.frm'));
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='vue_competences' AND TABLE_SCHEMA='bdtic' ;
SELECT CURRENT_USER();
SELECT LOAD_FILE(CONCAT(IFNULL(@@GLOBAL.datadir, CONCAT(@@GLOBAL.basedir, 'data/')), 'bdtic/vue_competences.frm'));
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='vue_competences' AND TABLE_SCHEMA='bdtic' ;
SELECT CURRENT_USER();
OK, no error after LOAD_FILE. This means that works, but you have stored the VIEW afterwards with the one-liner. Please modify the VIEW on your Linux MySQL, let's say with a few linefeeds. Then save it, go to another table or view and then back to this view. Linefeeds should have been preserved now, right?
Not for HeidiSQL - the editor displays Linux and Windows linebreaks (and Mac style and some others also). So, I wonder what the LOAD_FILE command gives you.
Please fire in a query tab and post the result here:
Please fire in a query tab and post the result here:
SELECT LOAD_FILE(CONCAT(IFNULL(@@GLOBAL.datadir, CONCAT(@@GLOBAL.basedir, 'data/')), 'bdtic/vue_competences.frm'));
Hi Ansgar !
So for this, do you think it's possible to upgrade the CTRL-F8 function to have just one field per line on the SELECT line and not just one command per line?
Now we have this:
SELECT `tblservicescommande`.`idService` AS `idService`,`tblservicescommande`.`IdTech` AS `IdTech`,`tblservicescommande`.`idItem` AS `idItem`,`tbl........
I think it will be great to have like this on multiple line:
SELECT
`tblservicescommande`.`idService` AS `idService`,
`tblservicescommande`.`IdTech` AS `IdTech`,
`tblservicescommande`.`idItem` AS `idItem`,
`tbl..........
Thanks Ansgar !
So for this, do you think it's possible to upgrade the CTRL-F8 function to have just one field per line on the SELECT line and not just one command per line?
Now we have this:
SELECT `tblservicescommande`.`idService` AS `idService`,`tblservicescommande`.`IdTech` AS `IdTech`,`tblservicescommande`.`idItem` AS `idItem`,`tbl........
I think it will be great to have like this on multiple line:
SELECT
`tblservicescommande`.`idService` AS `idService`,
`tblservicescommande`.`IdTech` AS `IdTech`,
`tblservicescommande`.`idItem` AS `idItem`,
`tbl..........
Thanks Ansgar !
What the auto-formatter does is highly subject to personal preferences, in many details. There was already a discussion somewhere in the tracker, without a reasonable consensus. Finally I decided to leave it as it is. It's quite ok currently, and I am not wanting to serve hundreds of personal preferences for this cosmetic feature.
Please login to leave a reply, or register at first.