Multiple resultsets' names in tabs

igitur's profile image igitur posted 9 years ago in General Permalink

I have 2 queries and the results show in 2 tabs, as you can see in the screenshot. But all the tabs have the same name, which is deduced from the first query's table name.

ansgar's profile image ansgar posted 9 years ago Permalink

I fixed that some time ago. Please update HeidiSQL to the latest build to get that fix.

igitur's profile image igitur posted 9 years ago Permalink

I'm using the latest nightly. 9.3.0.5075

ansgar's profile image ansgar posted 9 years ago Permalink

Works for me, on MSSQL. See attachment.

I cannot see why that should not work for someone else on the latest builds. See this thread for details: http://www.heidisql.com/forum.php?t=20979

1 attachment(s):
  • mssql-multi-result-tabs
igitur's profile image igitur posted 9 years ago Permalink

I think the semicolon is the difference. It's optional of course?

ansgar's profile image ansgar posted 9 years ago Permalink

What? No semicolon between two queries? How the hell does that work? Must be a MSSQL-super-feature, or?

igitur's profile image igitur posted 9 years ago Permalink

On MSSQL the semicolon is used to separate batches, so I prefer to leave it out. When I have to files with thousands of statements, eg inserts, I would put a semicolon after every 500th statement.

But otherwise the parser is clever enough to know where the new query starts.

kalvaro's profile image kalvaro posted 9 years ago Permalink

SQL Server used to splits statements by context. The use of semicolons was introduced later (I believe it didn't even exist in earlier versions) and I believe it's now the recommended practice.

There's also the GO batch separator but strictly speaking it isn't a statement separator.

ansgar's profile image ansgar posted 9 years ago Permalink

Well then I see no way of retrieving the right table name for a result in HeidiSQL. For MySQL there are C-API functions, which in MSSQL or the ADODB driver do not provide. So, HeidiSQL parses the SQL queries to find the right table name. When parsing a batch, HeidiSQL relies on the semicolon. I see no way of detecting queries by context, like the MSSQL server does.

igitur's profile image igitur posted 9 years ago Permalink

Yeah, I realised it would be difficult. It might be possible to parse the SQL with ZeosLib, but I'm unsure whether it can handle all the different SQL dialects. And it probably adds a lot of overhead for a fairly trivial enhancement anyway.

ansgar's profile image ansgar posted 9 years ago Permalink

HeidiSQL was based on Zeoslib some years ago, until I wrote my own database layer. Using ZeosLib just for this purpose would be really overkill.

igitur's profile image igitur posted 9 years ago Permalink

In that case, if the number of result sets and number of queries (as separated by semicolons) are not equal, maybe it's better to display Results 1, Results 2, etc?

ansgar's profile image ansgar posted 9 years ago Permalink

Well, that would break tab names when you separate the queries by semicolon, which works well currently.

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