Modified:
branches/guffert/ChangeLog
branches/guffert/util/installer.c
Log:
Bug #36203 - connector prompting for login infomation although stored in odbc-profile
Modified: branches/guffert/ChangeLog
===================================================================
--- branches/guffert/ChangeLog 2008-05-15 14:34:36 UTC (rev 1112)
+++ branches/guffert/ChangeLog 2008-05-18 05:05:01 UTC (rev 1113)
@@ -3,6 +3,8 @@
Functionality added or changed:
Bugs fixed:
+ * System DSN lookup (using ODBC_BOTH_DSN) fails on Windows XP.
+ (Bug #36203)
----
Modified: branches/guffert/util/installer.c
===================================================================
--- branches/guffert/util/installer.c 2008-05-15 14:34:36 UTC (rev 1112)
+++ branches/guffert/util/installer.c 2008-05-18 05:05:01 UTC (rev 1113)
@@ -615,12 +615,17 @@
SQLWCHAR *entries= buf;
SQLWCHAR **dest;
SQLWCHAR val[256];
- int size;
+ int size, used;
int rc= 0;
UWORD config_mode= config_get();
unsigned int *intdest;
/* No need for SAVE_MODE() because we always call config_get() above. */
+#ifdef _WIN32
+ /* We must do this to detect the WinXP bug mentioned below */
+ memset(buf, 0xff, sizeof(buf));
+#endif
+
/* get entries and check if data source exists */
if ((size= SQLGetPrivateProfileStringW(ds->name, NULL, W_EMPTY,
buf, 8192, W_ODBC_INI)) < 1)
@@ -635,9 +640,16 @@
#ifdef DEBUG_MYODBC_DS_LOOKUP
{
int i;
+ char dbuf[100];
+ OutputDebugString("Dumping SQLGetPrivateProfileStringW result");
for (i= 0; i < size; ++i)
- printf("%wc - 0x%x\n", entries[i], entries[i]);
+ {
+ sprintf(dbuf, "[%d] = %wc - 0x%x\n", i,
+ (entries[i] < 0x7f && isalpha(entries[i]) ? entries[i] : 'X'),
+ entries[i]);
+ OutputDebugString(dbuf);
}
+ }
#endif
#ifdef _WIN32
@@ -648,6 +660,7 @@
* system dsn but return a corrupt list of attributes.
*
* See debug code above to print the exact data returned.
+ * See also: http://support.microsoft.com/kb/909122/
*/
if (config_mode == ODBC_BOTH_DSN &&
/* two null chars or a null and some bogus character */
@@ -657,12 +670,17 @@
{
/* revert to system mode and try again */
config_set(ODBC_SYSTEM_DSN);
- SQLGetPrivateProfileStringW(ds->name, NULL, W_EMPTY,
- buf, 8192, W_ODBC_INI);
+ if ((size= SQLGetPrivateProfileStringW(ds->name, NULL, W_EMPTY,
+ buf, 8192, W_ODBC_INI)) < 1)
+ {
+ rc= -1;
+ goto end;
+ }
}
#endif
- while (*entries)
+ for (used= 0; used < size; used += sqlwcharlen(entries) + 1,
+ entries += sqlwcharlen(entries) + 1)
{
ds_map_param(ds, entries, &dest, &intdest);
@@ -677,13 +695,11 @@
else if (!size)
/* skip blanks */;
else if (dest && !*dest)
- ds_set_strattr(dest, val);
+ ds_set_strnattr(dest, val, size);
else if (intdest)
*intdest= sqlwchartoul(val, NULL);
RESTORE_MODE();
-
- entries += sqlwcharlen(entries) + 1;
}
end:
| Thread |
|---|
| • Connector/ODBC 3.51 commit: r1113 - in branches/guffert: . util | jbalint | 18 May |