Bug #33615 Database combobox not populated correctly when problematic database specified
Submitted: 2 Jan 2008 2:05 Modified: 14 Feb 2008 16:39
Reporter: Jared S (Silver Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.1 OS:Microsoft Windows (Any)
Assigned to: Lawrenty Novitsky CPU Architecture:Any
Tags: database, qc

[2 Jan 2008 2:05] Jared S
Description:
Hi,

5.0 produces error when user select database when database text box has rubbish.
5.1 produces an empty list of databases when database text box has rubbish

How to repeat:
1. Create new ODBC
2. Type 'a' into databse textbox
3. Now drop downlist

RESULT varies from 5.0 to 5.1 versions
[2 Jan 2008 8:07] Tonci Grgin
Hi Jared and thanks for your report.

Verified as described with following comments:
 - c/ODBC 5.0 is *discontinued*, please do not file bugs against it any more
 - c/ODBC 5.1 truly displays empty list in process of clearing bad input from drop down list. Next click on drop down list shows databases correctly.

I don't see a bug here but the behavior probably can be corrected.
[2 Jan 2008 21:56] Jim Winstead
What is probably happening here is that the setup library is using the entered database name when making a connection to the server to get the list of databases, and failing to authenticate because of the nonexistent database. In mygetdatabases(), we should make sure no database is specified in the DataSource (just set it aside during the Connect call). Also, errors encountered by mygetdatabases() should be handled correctly in the Windows GUI code.
[27 Jan 2008 20:12] Lawrenty Novitsky
Patch for 5.1 - setup dialog doesn't care about selected DB then databases list retrieved

Attachment: bug33615.patch (application/octet-stream, text), 643 bytes.

[28 Jan 2008 22:50] Jim Winstead
i think that it would be more clear to set aside the whole pointer, not just swap in a \0 as the first character. in my first look at the patch, i assumed the second conditional expression was wrong because i expected the pointer itself to be set/unset.
[29 Jan 2008 12:32] Lawrenty Novitsky
Fixed patch - whole pointer reset/set. Right, it's more simple this way

Attachment: bug33615.patch (application/octet-stream, text), 586 bytes.

[2 Feb 2008 4:42] Jess Balint
I think we should also add this to preserve any database name that is currently entered.

Index: setupgui/windows/odbcdialogparams.cpp
===================================================================
--- setupgui/windows/odbcdialogparams.cpp       (revision 1010)
+++ setupgui/windows/odbcdialogparams.cpp       (working copy)
@@ -506,6 +506,8 @@
         for (; dbtmp; dbtmp= list_rest(dbtmp))
           ComboBox_AddString(hwndCtl, (SQLWCHAR *)dbtmp->data);
         list_free(dbs, 1);
+        if (pParams->database)
+          ComboBox_SetText(hwndCtl, pParams->database);
       }
     }
   }
[2 Feb 2008 10:16] Lawrenty Novitsky
That already has been done in patch to auto-complete bug, that is not posted yet.
[7 Feb 2008 7:08] Lawrenty Novitsky
Committed as revision 1020.
[14 Feb 2008 16:39] MC Brown
A note has been added to the 5.1.2 changelog: 

Specifying a non-existent database name within the GUI dialog would result in an empty list, not an error.