Bug #8382 Commandbuilder does not handle queries to other databases than the default one-
Submitted: 9 Feb 2005 1:37 Modified: 23 Jun 2005 17:23
Reporter: Henrik Johnson Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.4 OS:Windows (Windows)
Assigned to: Reggie Burnett CPU Architecture:Any

[9 Feb 2005 1:37] Henrik Johnson
Description:
The commandbuilder does not handle SQL of the form.

select * from {database}.{table}

How to repeat:
Just execute the query in a data adapter, try using the commandbuilder to generate update statements and it will not generate the correct SQL (The database part will be silently dropped).

Suggested fix:
I have a patch ready that fixes it, just let me know where to fix it and I will. I am available at spam@henrik.org.
[9 Feb 2005 1:37] Henrik Johnson
New commandbuilder file.

Attachment: CommandBuilder.cs (text/plain), 13.43 KiB.

[9 Feb 2005 1:38] Henrik Johnson
New datareader class that fills in the BaseSchemaName with the DatabaseName of the statement.

Attachment: datareader.cs (text/plain), 21.84 KiB.

[9 Feb 2005 1:39] Henrik Johnson
Ok, I found how to post files so I uploaded the files I modified (From the 1.0.4 release).
[17 Feb 2005 0:08] Henrik Johnson
It seems that if you are connected to a 4.0.* database the MySqlField.DatabaseName doesn't get filled in with the correct data (It is null). So the fix I uploaded only works for 4.1 or greater.
[23 Jun 2005 16:57] Reggie Burnett
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html
[23 Jun 2005 16:59] Reggie Burnett
Fixed in 1.0.5
[23 Jun 2005 17:23] Mike Hillyer
Documented in 1.0.5 Changelog:

<listitem><para>Fixed a bug where the <literal>MySqlCommandBuilder</literal> class could not handle queries that references tables in a database other than the default database. (Bug #8382)</para></listitem>