Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.

automatically getting a "frame" of a select-statement

nobswolf's profile image nobswolf posted 6 years ago in Feature discussion Permalink
In the Mysql Workbench I used before Heidi you get a complete default-select-statement with a right click on the table name and choosing "select rows" like

SELECT * FROM dummy.test;

This way you have a "starting point" which saves a lot of typing when you debugging schemas a lot. The phpmyadmin does similar.

Is this feature available in Heidi as well?
ansgar's profile image ansgar posted 6 years ago Permalink
In the very right box inside a query tab you see the selected table's "Columns in [table]". Expanding that enables you to select one or more columns, then a rightclick offers "Generate INSERT", "Generate UPDATE" and "Generate DELETE". Unfortunately, "Generate SELECT is missing heresmileThink it's a good idea to add SELECT to that menu.
nobswolf's profile image nobswolf posted 6 years ago Permalink
ah, and I found the snippets there...

It would be nice to have "automagic" replacement-variables to put the "currently active table" there. So I could add to snippets something like:

select $curAllCols
from $curTable
Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.
ansgar's profile image ansgar posted 6 years ago Permalink
As long as you only refer to this use case I prefer to add that above mentioned "Generate SELECT" menu item. If such a template logic per snippets would be more useful than that I will go and do what you suggest here.
nobswolf's profile image nobswolf posted 6 years ago Permalink
Thats a good question...

I'd say if there are more possible variables, then you could refactor the whole menu-structure there and make most of the entries a "snippet". So you get the details of the SQL out of your code, which is a good thing, IMHO.

But if the example above is the only thing that could be done with variables it might be a bit of overkill to code a parser for such variables.

I am a bit "locked on target" right now to give a good advise. Maybe other users have an opinion on this topic?
ansgar's profile image ansgar posted 6 years ago Permalink
Well, a new menu item besides the three other ones should be very simple to add, so that's definitely the first thing I'll do.
Code modification/commit from ansgar.becker, 6 years ago, revision 4477
Add "Generate SELECT..." menu item to query helpers context menu. See http://www.heidisql.com/forum.php?t=13108
ansgar's profile image ansgar posted 6 years ago Permalink
Done in r4477
jfalch's profile image jfalch posted 6 years ago Permalink
thanks; but i´m a bit confused right now. what do i have to do to see the "Generate SELECT" menu item ?
ansgar's profile image ansgar posted 6 years ago Permalink
Rightclick one or more column names, in the very right box of any query tab, after expanding "Column in [selected table]"
Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.
Plasm's profile image Plasm posted 6 years ago Permalink
A bit cosmetic:
Generate SELECT...
INSERT generieren...
UPDATE generieren...
DELETE generieren...

"SELECT generieren..." would fit better.
This issue probably exists only in the german translation(?)
ansgar's profile image ansgar posted 6 years ago Permalink
Ah yes... again I forgot to take translations into account. Thanks for the hint.

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