Multiple SQL statements against different table each get output tab and export files using the first table name only

[expired user #9718]'s profile image [expired user #9718] posted 9 years ago in General Permalink

I think I am experiencing a consistent bug on v9.3.0.5051. I have seen this bug on previous versions, also, so it is not only about v9.3.0.5051.

If I create and run a multiple statement query like this: select from A; select from B; select * from C;

then, all 3 output tabs get only the first table name (A) and their data all export to files as SQL Inserts using the first table name only, like this: INSERT INTO "A" (A columns...) VALUES (A values...); INSERT INTO "A" (B columns...) VALUES (B values...); INSERT INTO "A" (C columns...) VALUES (C values...);

What should happen is the 3 tabs each have their proper, corresponding table, and the exports to files look like this: INSERT INTO "A" (A columns...) VALUES (A values...); INSERT INTO "B" (B columns...) VALUES (B values...); INSERT INTO "C" (C columns...) VALUES (C values...);

I am using a MS SQL Server database in this instance. Not sure if same problem exists with MySQL database.

INMOVES's profile image INMOVES posted 9 years ago Permalink

This is what happens with 5057 on a MariaDB database, exports all seem ok.

1 attachment(s):
  • multi_select
Code modification/commit 693aeb3 from ansgarbecker, 9 years ago, revision 9.3.0.5058
Fix bug in TAdoDBQuery.TableName when multiple queries were executed. See http://www.heidisql.com/forum.php?t=20979
ansgar's profile image ansgar posted 9 years ago Permalink

MySQL and MariaDB report their table name via C API, which is quite nice. MSSQL does not do that, so HeidiSQL has to find the table name with much effort somewhere within the SQL query. This failed yet when you executed multiple queries in a batch. r5058 fixes that. But it still fails to detect the right query when you have activated "Send batch in one go". Please update and test if that also works for you in "Send queries one by one" mode.

Code modification/commit bc70226 from ansgarbecker, 9 years ago, revision 9.3.0.5059
MSSQL table names: Revert previous change in TAdoDBQuery.TableName and assign separate SQL strings earlier, in TAdoDBConnection.GetLastResults. Fixes wrong table name in "Send queries in one go" mode. See http://www.heidisql.com/forum.php?t=20979
ansgar's profile image ansgar posted 9 years ago Permalink

r5059 now should fix the wrong table for the other mode as well (Send batch in one go).

[expired user #9718]'s profile image [expired user #9718] posted 9 years ago Permalink

I am confirming that the software update fixed the problem. I am amazed because I posted the problem late at night and then 4 hours later I was informed that the problem has been fixed. Really, you guys are fantastic beyond words.

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